cg@2587: " cg@2587: COPYRIGHT (c) 2008 by eXept Software AG cg@2587: All Rights Reserved cg@2587: cg@2587: This software is furnished under a license and may be used cg@2587: only in accordance with the terms of that license and with the cg@2587: inclusion of the above copyright notice. This software may not cg@2587: be provided or otherwise made available to, or used by, any cg@2587: other person. No title to or ownership of the software is cg@2587: hereby transferred. cg@2587: " cg@2300: "{ Package: 'stx:libtool2' }" cg@2300: cg@2300: FlyByHelp subclass:#FlyByWindowInformation cg@2699: instanceVariableNames:'lastApplication lastView cleanupAction finishSemaphore finished' cg@2300: classVariableNames:'' cg@2300: poolDictionaries:'' cg@2300: category:'Interface-Help' cg@2300: ! cg@2300: cg@2300: !FlyByWindowInformation class methodsFor:'documentation'! cg@2300: cg@2587: copyright cg@2587: " cg@2587: COPYRIGHT (c) 2008 by eXept Software AG cg@2587: All Rights Reserved cg@2587: cg@2587: This software is furnished under a license and may be used cg@2587: only in accordance with the terms of that license and with the cg@2587: inclusion of the above copyright notice. This software may not cg@2587: be provided or otherwise made available to, or used by, any cg@2587: other person. No title to or ownership of the software is cg@2587: hereby transferred. cg@2587: " cg@2587: ! cg@2587: cg@2300: examples cg@2300: " cg@2300: self shownInformationOfViewUnderMouseUntilButtonIsPressed cg@2300: " cg@2300: ! cg@2300: cg@2300: shownInformationOfViewUnderMouseUntilButtonIsPressed cg@2300: self start waitUntilFinished cg@2300: cg@2300: " cg@2300: self shownInformationOfViewUnderMouseUntilButtonIsPressed cg@2300: " cg@2300: ! ! cg@2300: cg@2300: !FlyByWindowInformation methodsFor:'accessing'! cg@2300: cg@2699: cleanupAction:something cg@2300: cleanupAction := something. cg@2300: ! cg@2300: cg@2300: lastApplication cg@2300: ^ lastApplication cg@2300: ! cg@2300: cg@2300: lastView cg@2300: ^ lastView cg@2300: ! ! cg@2300: cg@2543: !FlyByWindowInformation methodsFor:'defaults'! cg@2543: cg@2543: flyByHelpTimeoutMillis cg@2543: ^ 1000 cg@2543: ! ! cg@2543: cg@2300: !FlyByWindowInformation methodsFor:'event handling'! cg@2300: cg@2340: buttonMotion:buttonAndModifierState x:x y:y view:aView cg@2702: finished == true ifTrue:[^ self]. cg@2702: cg@2340: super buttonMotion:buttonAndModifierState x:x y:y view:aView. cg@2300: ^ true cg@2300: ! cg@2300: cg@2300: buttonPress:button x:x y:y view:aView cg@2300: self stop. cg@2300: ^ true cg@2300: ! cg@2300: cg@2300: keyPress:key x:x y:y view:aView cg@2943: cg@2943: cg@2823: |obj objToInspect objToBrowse lcKey| cg@2300: cg@2300: key == #Escape ifTrue:[ cg@2300: self stop. cg@2300: ^ true cg@2300: ]. cg@2300: cg@2435: key == $? ifTrue:[ cg@2435: [ sv@2836: WindowTreeView notNil ifTrue:[ sv@2836: WindowTreeView openOn:(lastView topView) initialSelection:lastView. sv@2836: ] ifFalse:[ sv@2836: self warn:'WindowTreeView class is not present!!'. sv@2836: ]. cg@2435: ] fork. cg@2435: self stop. cg@2435: ^ true. cg@2300: ]. cg@2435: cg@2823: key == #Return ifTrue:[ cg@2823: objToBrowse := lastApplication ? lastView cg@2823: ]. cg@2823: cg@2435: key isCharacter ifTrue:[ cg@2435: lcKey := key asLowercase. cg@2435: cg@2435: lcKey == $a ifTrue:[ cg@2435: obj := lastApplication cg@2435: ]. cg@2435: lcKey == $o ifTrue:[ cg@2824: lastView notNil ifTrue:[ cg@2824: obj := lastView model cg@2824: ]. cg@2435: ]. cg@2435: lcKey == $m ifTrue:[ cg@2824: lastApplication notNil ifTrue:[ cg@2824: obj := lastApplication masterApplication cg@2824: ] cg@2824: ]. cg@2824: lcKey == $t ifTrue:[ cg@2824: lastApplication notNil ifTrue:[ cg@2824: obj := lastApplication topApplication cg@2824: ]. cg@2300: ]. cg@2435: lcKey == $v ifTrue:[ cg@2435: obj := lastView cg@2435: ]. cg@2939: lcKey == $g ifTrue:[ cg@2939: obj := lastView windowGroup cg@2939: ]. cg@2824: lcKey == $w ifTrue:[ cg@2824: lastView notNil ifTrue:[ cg@2824: obj := lastView topView cg@2824: ] cg@2435: ]. cg@2435: obj notNil ifTrue:[ cg@2435: key isLowercase ifTrue:[ cg@2823: objToInspect := obj cg@2435: ] ifFalse:[ cg@2823: objToBrowse := obj cg@2435: ]. cg@2435: ]. cg@2300: ]. cg@2300: cg@2823: objToInspect notNil ifTrue:[ cg@2823: [ objToInspect inspect ] forkAt:(Processor userSchedulingPriority). cg@2823: ]. cg@2823: objToBrowse notNil ifTrue:[ cg@2823: [ objToBrowse browse ] forkAt:(Processor userSchedulingPriority). cg@2823: ]. cg@2823: cg@2300: ^ true cg@2823: cg@2824: "Modified: / 12-11-2010 / 11:51:04 / cg" cg@2300: ! ! cg@2300: cg@2300: !FlyByWindowInformation methodsFor:'help texts'! cg@2300: cg@2300: helpTextFor:aView at:aPointOrNil cg@2699: "generate the text to be shown as popup-flyby info" cg@2699: cg@2824: |resources| cg@2824: cg@2300: lastView := aView. cg@2300: lastApplication := aView application. cg@2300: cg@2824: resources := self class classResources. cg@2824: cg@2824: ^ Text streamContents:[:s | cg@2824: |topViewToInspect applicationToInspect cg@2824: masterApplicationToInspect topApplicationToInspect modelToInspect cg@2939: genComponentNameForApplication windowGroupToInspect| cg@2700: cg@2824: genComponentNameForApplication := cg@2824: [:app :s | cg@2700: (app notNil cg@2700: and:[ app builder notNil ]) ifTrue:[ cg@2700: |components v| cg@2700: cg@2700: components := app builder namedComponents. cg@2700: cg@2700: v := aView. cg@2700: [ (components includes:v) not cg@2700: and:[v container notNil] cg@2700: ] whileTrue:[ cg@2700: v := v container. cg@2700: ]. cg@2700: (components includes:v) ifTrue:[ cg@2700: |k| cg@2700: cg@2700: k := components keyAtValue:v. cg@2700: v == aView ifTrue:[ cg@2824: s nextPutLine:(' component: ' , k). cg@2700: ] ifFalse:[ cg@2824: s nextPutLine:(' subview of component: ' , k). cg@2700: ]. cg@2700: ]. cg@2700: ]. cg@2700: ]. cg@2314: cg@2300: aView topView ~~ aView ifTrue:[ cg@2314: topViewToInspect := aView topView. cg@2300: ]. cg@2300: lastApplication notNil ifTrue:[ cg@2314: applicationToInspect := lastApplication. cg@2314: masterApplicationToInspect := lastApplication masterApplication. cg@2824: masterApplicationToInspect notNil ifTrue:[ cg@2824: masterApplicationToInspect == applicationToInspect ifTrue:[ cg@2824: masterApplicationToInspect := nil cg@2824: ] ifFalse:[ cg@2824: topApplicationToInspect := masterApplicationToInspect topApplication. cg@2824: topApplicationToInspect == masterApplicationToInspect ifTrue:[ cg@2824: topApplicationToInspect := nil cg@2824: ] cg@2824: ]. cg@2824: ] cg@2314: ]. cg@2314: aView model notNil ifTrue:[ cg@2314: modelToInspect := aView model. cg@2314: ((modelToInspect == applicationToInspect) cg@2314: or:[ modelToInspect == masterApplicationToInspect ]) ifTrue:[ cg@2314: modelToInspect := nil. cg@2300: ]. cg@2300: ]. cg@2314: cg@2824: applicationToInspect notNil ifTrue:[ cg@2824: s nextPutLine:(resources string:'Application: %1' with:applicationToInspect class name allBold). cg@2824: genComponentNameForApplication value:applicationToInspect value:s. cg@2314: ]. cg@2700: masterApplicationToInspect notNil ifTrue:[ cg@2824: s nextPutLine:(resources string:'Master-Application: %1' with:masterApplicationToInspect class name allBold). cg@2824: "/ genComponentNameForApplication value:masterApplicationToInspect value:s. cg@2824: ]. cg@2824: topApplicationToInspect notNil ifTrue:[ cg@2824: s nextPutLine:(resources string:'Top-Application: %1' with:topApplicationToInspect class name allBold). cg@2824: "/ genComponentNameForApplication value:topApplicationToInspect value:s. cg@2700: ]. cg@2824: s nextPutLine:(resources string:'View: %1 "%2"' with:aView class name allBold with:aView name). cg@2824: topViewToInspect notNil ifTrue:[ cg@2824: s nextPutLine:(resources string:'Topview: %1' with:topViewToInspect class name allBold). cg@2314: ]. cg@2824: modelToInspect notNil ifTrue:[ cg@2824: s nextPutLine:(resources string:'Model: %1' with:modelToInspect class name allBold). cg@2824: ]. cg@2699: cg@2300: s cr. cg@2300: s nextPutLine:'Press:'. cg@2435: s nextPutLine:' ? to show the viewtree'. cg@2314: applicationToInspect notNil ifTrue:[ cg@2300: s nextPutLine:' a to inspect application (A to browse)'. cg@2314: masterApplicationToInspect notNil ifTrue:[ cg@2300: s nextPutLine:' m to inspect masterApplication (M to browse)'. cg@2824: topApplicationToInspect notNil ifTrue:[ cg@2824: s nextPutLine:' t to inspect masterApplication (T to browse)'. cg@2824: ] cg@2300: ]. cg@2300: ]. cg@2823: s nextPutLine:' v to inspect view (V to browse)'. cg@2823: topViewToInspect notNil ifTrue:[ cg@2824: s nextPutLine:' w to inspect topWindow (W to browse)'. cg@2823: ]. cg@2939: aView windowGroup notNil ifTrue:[ cg@2939: s nextPutLine:' g to inspect windowGroup'. cg@2939: ]. cg@2823: modelToInspect notNil ifTrue:[ cg@2823: s nextPutLine:' o to inspect model (O to browse)'. cg@2823: ]. cg@2823: s cr. cg@2823: s nextPutLine:'RETURN to browse application.'. cg@2823: s nextPutAll:'ESC or click to leave flyBy-info mode.'. cg@2300: ] cg@2300: cg@2300: " cg@2300: self shownInformationOfViewUnderMouseUntilButtonIsPressed cg@2300: " cg@2823: cg@2824: "Modified: / 12-11-2010 / 11:54:59 / cg" cg@2300: ! ! cg@2300: cg@2710: !FlyByWindowInformation methodsFor:'private'! cg@2710: cg@2847: handleMouseIn:aView x:x y:y cg@2847: finished == true ifTrue:[^ self]. cg@2847: super handleMouseIn:aView x:x y:y cg@2847: ! cg@2847: cg@2710: targetViewInitiatesHelpViaSensor cg@2710: ^ false cg@2710: ! ! cg@2710: cg@2300: !FlyByWindowInformation methodsFor:'queries'! cg@2300: cg@2300: toolTipFollowsMouse cg@2300: ^ true cg@2300: ! ! cg@2300: cg@2300: !FlyByWindowInformation methodsFor:'start & stop'! cg@2300: cg@2699: initiateHelpFor:aView at:aPointOrNil cg@2710: self initiateHelpFor:aView at:aPointOrNil now:true cg@2699: ! cg@2699: cg@2699: initiateHelpFor:aView at:aPointOrNil now:showItNow cg@2702: finished == true ifTrue:[^ self]. cg@2699: super initiateHelpFor:aView at:aPointOrNil now:showItNow cg@2699: ! cg@2699: cg@2300: start cg@2300: |l| cg@2300: cg@2702: finished == true ifTrue:[^ self]. cg@2702: cg@2300: l := FlyByHelp currentHelpListener. cg@2300: l notNil ifTrue:[ cg@2300: FlyByHelp stop. cg@2300: cleanupAction := [ FlyByHelp start ]. cg@2300: ]. cg@2300: finishSemaphore := Semaphore new. cg@2699: finished := false. cg@2300: super start. cg@2300: ! cg@2300: cg@2300: stop cg@2699: finished := true. cg@2300: super stop. cg@2300: cleanupAction value. cg@2300: finishSemaphore notNil ifTrue:[ cg@2300: finishSemaphore signalIf. cg@2300: ]. cg@2300: ! cg@2300: cg@2300: waitUntilFinished cg@2300: finishSemaphore wait. cg@2300: ! ! cg@2300: cg@2300: !FlyByWindowInformation class methodsFor:'documentation'! cg@2300: cg@2587: version_CVS cg@2587: ^ '$Header$' cg@2300: ! ! cg@2943: