FlyByWindowInformation.st
author Claus Gittinger <cg@exept.de>
Wed, 27 Feb 2008 12:11:30 +0100
changeset 2314 e65082256c46
parent 2300 afddc24415dc
child 2340 e51e52c8e849
permissions -rw-r--r--
*** empty log message ***
cg@2300
     1
"{ Package: 'stx:libtool2' }"
cg@2300
     2
cg@2300
     3
FlyByHelp subclass:#FlyByWindowInformation
cg@2300
     4
	instanceVariableNames:'lastApplication lastView cleanupAction finishSemaphore'
cg@2300
     5
	classVariableNames:''
cg@2300
     6
	poolDictionaries:''
cg@2300
     7
	category:'Interface-Help'
cg@2300
     8
!
cg@2300
     9
cg@2300
    10
!FlyByWindowInformation class methodsFor:'documentation'!
cg@2300
    11
cg@2300
    12
examples
cg@2300
    13
"
cg@2300
    14
    self shownInformationOfViewUnderMouseUntilButtonIsPressed
cg@2300
    15
"
cg@2300
    16
!
cg@2300
    17
cg@2300
    18
shownInformationOfViewUnderMouseUntilButtonIsPressed
cg@2300
    19
    self start waitUntilFinished
cg@2300
    20
cg@2300
    21
    "
cg@2300
    22
     self shownInformationOfViewUnderMouseUntilButtonIsPressed
cg@2300
    23
    "
cg@2300
    24
! !
cg@2300
    25
cg@2300
    26
!FlyByWindowInformation methodsFor:'accessing'!
cg@2300
    27
cg@2300
    28
cleanupAction:something
cg@2300
    29
    cleanupAction := something.
cg@2300
    30
!
cg@2300
    31
cg@2300
    32
lastApplication
cg@2300
    33
    ^ lastApplication
cg@2300
    34
!
cg@2300
    35
cg@2300
    36
lastView
cg@2300
    37
    ^ lastView
cg@2300
    38
! !
cg@2300
    39
cg@2300
    40
!FlyByWindowInformation methodsFor:'event handling'!
cg@2300
    41
cg@2300
    42
buttonMotion:state x:x y:y view:aView
cg@2300
    43
    super buttonMotion:state x:x y:y view:aView.
cg@2300
    44
    ^ true
cg@2300
    45
!
cg@2300
    46
cg@2300
    47
buttonPress:button x:x y:y view:aView
cg@2300
    48
    self stop.
cg@2300
    49
    ^ true
cg@2300
    50
!
cg@2300
    51
cg@2300
    52
keyPress:key x:x y:y view:aView
cg@2300
    53
    |obj action|
cg@2300
    54
cg@2300
    55
    key == #Escape ifTrue:[
cg@2300
    56
        self stop.
cg@2300
    57
        ^ true
cg@2300
    58
    ].
cg@2300
    59
cg@2300
    60
    key asLowercase == $a ifTrue:[
cg@2300
    61
        obj := lastApplication
cg@2300
    62
    ].
cg@2314
    63
    key asLowercase == $o ifTrue:[
cg@2314
    64
        obj := lastView model
cg@2314
    65
    ].
cg@2300
    66
    key asLowercase == $m ifTrue:[
cg@2300
    67
        obj := lastApplication masterApplication
cg@2300
    68
    ].
cg@2300
    69
    key asLowercase == $v ifTrue:[
cg@2300
    70
        obj := lastView
cg@2300
    71
    ].
cg@2300
    72
    key asLowercase == $t ifTrue:[
cg@2300
    73
        obj := lastView topView
cg@2300
    74
    ].
cg@2300
    75
    obj notNil ifTrue:[
cg@2300
    76
        key isLowercase ifTrue:[
cg@2300
    77
            action := [ obj inspect ].
cg@2300
    78
        ] ifFalse:[
cg@2300
    79
            action := [ obj browse ].
cg@2300
    80
        ].
cg@2300
    81
        action forkAt:8.
cg@2300
    82
    ].
cg@2300
    83
cg@2300
    84
    ^ true
cg@2300
    85
! !
cg@2300
    86
cg@2300
    87
!FlyByWindowInformation methodsFor:'help texts'!
cg@2300
    88
cg@2300
    89
helpTextFor:aView at:aPointOrNil
cg@2300
    90
    lastView := aView.
cg@2300
    91
    lastApplication := aView application.
cg@2300
    92
cg@2300
    93
    ^ String streamContents:[:s |
cg@2314
    94
        |topViewToInspect applicationToInspect masterApplicationToInspect modelToInspect|
cg@2314
    95
cg@2300
    96
        aView topView ~~ aView ifTrue:[
cg@2314
    97
            topViewToInspect := aView topView.
cg@2300
    98
        ].
cg@2300
    99
        lastApplication notNil ifTrue:[
cg@2314
   100
            applicationToInspect := lastApplication.
cg@2314
   101
            masterApplicationToInspect := lastApplication masterApplication.
cg@2314
   102
        ].
cg@2314
   103
        aView model notNil ifTrue:[
cg@2314
   104
            modelToInspect := aView model.
cg@2314
   105
            ((modelToInspect == applicationToInspect)
cg@2314
   106
            or:[ modelToInspect == masterApplicationToInspect ]) ifTrue:[
cg@2314
   107
                modelToInspect := nil.
cg@2300
   108
            ].
cg@2300
   109
        ].
cg@2314
   110
cg@2314
   111
cg@2314
   112
        s nextPutLine:('View: ' , aView class name).
cg@2314
   113
        modelToInspect notNil ifTrue:[
cg@2314
   114
            s nextPutLine:('Model: ' , modelToInspect class name).
cg@2314
   115
        ].
cg@2314
   116
        topViewToInspect notNil ifTrue:[
cg@2314
   117
            s nextPutLine:('Topview: ' , topViewToInspect class name).
cg@2314
   118
        ].
cg@2314
   119
        applicationToInspect notNil ifTrue:[
cg@2314
   120
            s nextPutLine:('Application: ' , applicationToInspect class name).
cg@2314
   121
        ].
cg@2314
   122
        masterApplicationToInspect notNil ifTrue:[
cg@2314
   123
            s nextPutLine:('Masterapplication: ' , masterApplicationToInspect class name).
cg@2314
   124
        ].
cg@2314
   125
cg@2300
   126
        s cr.
cg@2300
   127
        s nextPutLine:'Press:'.
cg@2300
   128
        s nextPutLine:'    v to inspect view (V to browse)'.
cg@2314
   129
        modelToInspect notNil ifTrue:[
cg@2314
   130
            s nextPutLine:'    o to inspect model (O to browse)'.
cg@2314
   131
        ].
cg@2314
   132
        topViewToInspect notNil ifTrue:[
cg@2300
   133
            s nextPutLine:'    t to inspect topView (T to browse)'.
cg@2300
   134
        ].
cg@2314
   135
        applicationToInspect notNil ifTrue:[
cg@2300
   136
            s nextPutLine:'    a to inspect application (A to browse)'.
cg@2314
   137
            masterApplicationToInspect notNil ifTrue:[
cg@2300
   138
                s nextPutLine:'    m to inspect masterApplication (M to browse)'.
cg@2300
   139
            ].
cg@2300
   140
        ].
cg@2300
   141
        s nextPutAll:'    ESC or button to leave'.
cg@2300
   142
    ]
cg@2300
   143
cg@2300
   144
    "
cg@2300
   145
     self shownInformationOfViewUnderMouseUntilButtonIsPressed
cg@2300
   146
    "
cg@2300
   147
! !
cg@2300
   148
cg@2300
   149
!FlyByWindowInformation methodsFor:'queries'!
cg@2300
   150
cg@2300
   151
toolTipFollowsMouse
cg@2300
   152
    ^ true
cg@2300
   153
! !
cg@2300
   154
cg@2300
   155
!FlyByWindowInformation methodsFor:'start & stop'!
cg@2300
   156
cg@2300
   157
start
cg@2300
   158
    |l|
cg@2300
   159
cg@2300
   160
    l := FlyByHelp currentHelpListener.
cg@2300
   161
    l notNil ifTrue:[
cg@2300
   162
        FlyByHelp stop.
cg@2300
   163
        cleanupAction := [ FlyByHelp start ].
cg@2300
   164
    ].
cg@2300
   165
    finishSemaphore := Semaphore new.
cg@2300
   166
    super start.
cg@2300
   167
!
cg@2300
   168
cg@2300
   169
stop
cg@2300
   170
    super stop.
cg@2300
   171
    cleanupAction value.
cg@2300
   172
    finishSemaphore notNil ifTrue:[
cg@2300
   173
        finishSemaphore signalIf.
cg@2300
   174
    ].
cg@2300
   175
!
cg@2300
   176
cg@2300
   177
waitUntilFinished
cg@2300
   178
    finishSemaphore wait.
cg@2300
   179
! !
cg@2300
   180
cg@2300
   181
!FlyByWindowInformation class methodsFor:'documentation'!
cg@2300
   182
cg@2300
   183
version
cg@2300
   184
    ^ '$Header$'
cg@2300
   185
! !