cg@2300: "{ Package: 'stx:libtool2' }" cg@2300: cg@2300: FlyByHelp subclass:#FlyByWindowInformation cg@2300: instanceVariableNames:'lastApplication lastView cleanupAction finishSemaphore' cg@2300: classVariableNames:'' cg@2300: poolDictionaries:'' cg@2300: category:'Interface-Help' cg@2300: ! cg@2300: cg@2300: !FlyByWindowInformation class methodsFor:'documentation'! cg@2300: 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@2300: 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@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@2435: |obj action 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: [ cg@2435: WindowTreeView openOn:(lastView topView) initialSelection:lastView. cg@2435: ] fork. cg@2435: self stop. cg@2435: ^ true. cg@2300: ]. cg@2435: 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@2435: obj := lastView model cg@2435: ]. cg@2435: lcKey == $m ifTrue:[ cg@2435: obj := lastApplication masterApplication cg@2300: ]. cg@2435: lcKey == $v ifTrue:[ cg@2435: obj := lastView cg@2435: ]. cg@2435: lcKey == $t ifTrue:[ cg@2435: obj := lastView topView cg@2435: ]. cg@2435: obj notNil ifTrue:[ cg@2435: key isLowercase ifTrue:[ cg@2435: action := [ obj inspect ]. cg@2435: ] ifFalse:[ cg@2435: action := [ obj browse ]. cg@2435: ]. cg@2435: action forkAt:8. cg@2435: ]. cg@2300: ]. cg@2300: cg@2300: ^ true cg@2300: ! ! cg@2300: cg@2300: !FlyByWindowInformation methodsFor:'help texts'! cg@2300: cg@2300: helpTextFor:aView at:aPointOrNil cg@2300: lastView := aView. cg@2300: lastApplication := aView application. cg@2300: cg@2300: ^ String streamContents:[:s | cg@2314: |topViewToInspect applicationToInspect masterApplicationToInspect modelToInspect| 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@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@2352: s nextPutLine:('View: ' , aView class name, ' "',aView name printString,'"'). cg@2314: modelToInspect notNil ifTrue:[ cg@2314: s nextPutLine:('Model: ' , modelToInspect class name). cg@2314: ]. cg@2314: topViewToInspect notNil ifTrue:[ cg@2314: s nextPutLine:('Topview: ' , topViewToInspect class name). cg@2314: ]. cg@2314: applicationToInspect notNil ifTrue:[ cg@2314: s nextPutLine:('Application: ' , applicationToInspect class name). cg@2314: ]. cg@2314: masterApplicationToInspect notNil ifTrue:[ cg@2314: s nextPutLine:('Masterapplication: ' , masterApplicationToInspect class name). cg@2314: ]. cg@2314: cg@2300: s cr. cg@2300: s nextPutLine:'Press:'. cg@2435: s nextPutLine:' ? to show the viewtree'. cg@2300: s nextPutLine:' v to inspect view (V to browse)'. cg@2314: modelToInspect notNil ifTrue:[ cg@2314: s nextPutLine:' o to inspect model (O to browse)'. cg@2314: ]. cg@2314: topViewToInspect notNil ifTrue:[ cg@2300: s nextPutLine:' t to inspect topView (T to browse)'. cg@2300: ]. 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@2300: ]. cg@2300: ]. cg@2493: s nextPutAll:'ESC or button to leave flyBy-info mode.'. cg@2300: ] cg@2300: cg@2300: " cg@2300: self shownInformationOfViewUnderMouseUntilButtonIsPressed cg@2300: " cg@2300: ! ! cg@2300: 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@2300: start cg@2300: |l| cg@2300: 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@2300: super start. cg@2300: ! cg@2300: cg@2300: stop 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@2300: version cg@2300: ^ '$Header$' cg@2300: ! !