FlyByHelp.st
author Claus Gittinger <cg@exept.de>
Sat, 12 Jul 2008 15:54:02 +0200
changeset 2519 af89806c67e4
parent 2518 fc1d2b481b6e
child 2521 7e51aa294156
permissions -rw-r--r--
comment
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1802
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
     1
"
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
     2
 COPYRIGHT (c) 2001 by eXept Software AG
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
     3
              All Rights Reserved
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
     4
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
     5
 This software is furnished under a license and may be used
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
     6
 only in accordance with the terms of that license and with the
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
     9
 other person.  No title to or ownership of the software is
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    10
 hereby transferred.
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    11
"
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libview2' }"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
ActiveHelp subclass:#FlyByHelp
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'currentFrame currentView currentHelpView showProcess closeProcess'
1892
4c38a0c4369b *** empty log message ***
ca
parents: 1802
diff changeset
    16
	classVariableNames:''
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'Interface-Help'
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
1802
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    21
!FlyByHelp class methodsFor:'documentation'!
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    22
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    23
copyright
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    24
"
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    25
 COPYRIGHT (c) 2001 by eXept Software AG
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    26
              All Rights Reserved
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    27
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    28
 This software is furnished under a license and may be used
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    29
 only in accordance with the terms of that license and with the
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    31
 be provided or otherwise made available to, or used by, any
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    32
 other person.  No title to or ownership of the software is
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    33
 hereby transferred.
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    34
"
1893
f369ffca3d9f *** empty log message ***
ca
parents: 1892
diff changeset
    35
!
f369ffca3d9f *** empty log message ***
ca
parents: 1892
diff changeset
    36
f369ffca3d9f *** empty log message ***
ca
parents: 1892
diff changeset
    37
examples
f369ffca3d9f *** empty log message ***
ca
parents: 1892
diff changeset
    38
"
f369ffca3d9f *** empty log message ***
ca
parents: 1892
diff changeset
    39
     FlyByHelp isActive
f369ffca3d9f *** empty log message ***
ca
parents: 1892
diff changeset
    40
f369ffca3d9f *** empty log message ***
ca
parents: 1892
diff changeset
    41
     FlyByHelp stop
f369ffca3d9f *** empty log message ***
ca
parents: 1892
diff changeset
    42
     FlyByHelp start
f369ffca3d9f *** empty log message ***
ca
parents: 1892
diff changeset
    43
"
1802
ef3539bf86b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    44
! !
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
!FlyByHelp class methodsFor:'initialization'!
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
initialize
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    "set default delay & help-display times"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
1657
447db4aae998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
    51
    ShowTime := 10.
447db4aae998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
    52
    DelayTime := 0.4.
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    "
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
     FlyByHelp initialize
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    "
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    "Modified: 27.4.1996 / 15:07:27 / cg"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
! !
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
    61
!FlyByHelp methodsFor:'event handling'!
1540
f6948fc36460 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1536
diff changeset
    62
2474
ef24105ee7a2 code cleanup (arg-names)
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
    63
buttonMotion:buttonAndModifierState x:x y:y view:aView
2519
af89806c67e4 comment
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
    64
    aView == currentHelpView ifTrue:[
af89806c67e4 comment
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
    65
        "/ the help-bubble itself
af89806c67e4 comment
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
    66
        ^ false
af89806c67e4 comment
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
    67
    ].
af89806c67e4 comment
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
    68
2518
fc1d2b481b6e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
    69
    "/ don't start tooltip, if this view is not active
fc1d2b481b6e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
    70
    "/ aView topView isActive ifFalse:[^ false].
2477
b009e0b51999 suppress tooltip for inactive (lower) windows
Claus Gittinger <cg@exept.de>
parents: 2474
diff changeset
    71
2474
ef24105ee7a2 code cleanup (arg-names)
Claus Gittinger <cg@exept.de>
parents: 2392
diff changeset
    72
    ^ super buttonMotion:buttonAndModifierState x:x y:y view:aView
1540
f6948fc36460 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1536
diff changeset
    73
!
f6948fc36460 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1536
diff changeset
    74
f6948fc36460 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1536
diff changeset
    75
pointerLeave:state view:aView
f6948fc36460 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1536
diff changeset
    76
    aView == currentHelpView ifTrue:[^ self].
f6948fc36460 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1536
diff changeset
    77
    super pointerLeave:state view:aView
f6948fc36460 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1536
diff changeset
    78
! !
f6948fc36460 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1536
diff changeset
    79
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
    80
!FlyByHelp methodsFor:'help texts'!
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
helpTextFromModel:aModel view:aView at:aPointOrNil 
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
    "helper: ask aModel for its helpText."
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    |text|
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    aPointOrNil notNil ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
        (aModel respondsTo:#flyByHelpTextFor:at:) ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
            text := aModel flyByHelpTextFor:aView at:aPointOrNil.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
        ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    text isNil ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
        (aModel respondsTo:#flyByHelpTextFor:) ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
            text := aModel flyByHelpTextFor:aView.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
        ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    ^ text
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
!
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
helpTextFromView:aView at:aPointOrNil 
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    "helper: ask aView for its helpText."
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    |text|
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
    aPointOrNil notNil ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
        (aView respondsTo:#flyByHelpTextAt:) ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
            text := aView flyByHelpTextAt:aPointOrNil.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
        ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    text isNil ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
        (aView respondsTo:#flyByHelpText) ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
            text := aView flyByHelpText.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
        ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    ^ text.
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   116
! !
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   117
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   118
!FlyByHelp methodsFor:'private'!
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
hideIfPointerLeft:aView
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
    "hide help, if the pointer is not in aView"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    |whereOnScreen|
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    currentFrame notNil ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
        whereOnScreen := aView graphicsDevice pointerPosition.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
        (currentFrame notNil
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
        and:[(currentFrame insetBy:1@1) containsPoint:whereOnScreen]) ifFalse:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
            self hideHelp.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
        ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    "Modified: 28.5.1996 / 20:18:28 / cg"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
!
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
initiateHelpFor:aView at:aPointOrNil now:showItNow
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    "ask aView for helpText, passing x/y coordinates;
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
     start a timeout process to display this helpText after some delay;
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
     Normally used internally, but can also be used by widgets to force 
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
     re-negotiation of the displayed helpText 
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
     (for example in a menu, when the selection changes)"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   144
    |text delayTime|
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    (self interestedIn:aView) ifFalse:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
        ^ self
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
    text := self helpTextFor:aView at:aPointOrNil.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    lastHelpText = text ifTrue:[
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   152
        self toolTipFollowsMouse ifFalse:[
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   153
            ^ self
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   154
        ]
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    text size > 0 ifTrue:[
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   158
        delayTime := self delayTime.
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   159
        (showItNow not and:[delayTime > 0]) ifTrue:[
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
            self stopHelpDisplayProcess.
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   161
            showProcess := 
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   162
                [
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   163
                        Delay waitForSeconds:delayTime.
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   164
                        showProcess := nil.
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   165
                        aView device anyButtonPressed ifFalse:[
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   166
                            self showHelp:text for:aView
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   167
                        ]
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   168
                ] forkAt:(Processor userSchedulingPriority + 1).
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
        ] ifFalse:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
            self showHelp:text for:aView
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
        ]
1542
f63515aab510 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
   172
    ] ifFalse:[
f63515aab510 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
   173
        self hideHelp
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
!
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
interestedIn:aView
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
    "return true, if I am interested in aView (either listeningForAll,
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
     or in my list of apps)"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    aView isNil ifTrue:[^ false].
2495
728d6935dc5b also interestedIn: help, if a pointer moves
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
   182
    "/ aView topView == currentHelpView ifTrue:[^ false].
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    ^ super interestedIn:aView
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
! !
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   187
!FlyByHelp methodsFor:'queries'!
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   188
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   189
toolTipFollowsMouse
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   190
    ^ false
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   191
! !
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   192
1768
7011c938442e method category rename
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   193
!FlyByHelp methodsFor:'show & hide help'!
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
hideHelp
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
    "hide the help text"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
    |p|
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
1540
f6948fc36460 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1536
diff changeset
   200
    lastHelpText := nil.
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
    self stopHelpDisplayProcess.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
    currentHelpView notNil ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
        [
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
            currentHelpView destroy.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
            currentHelpView := nil.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
            currentView := nil.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
        ] valueUninterruptably
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
    currentFrame := nil.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    closeProcess notNil ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
        p := closeProcess. closeProcess := nil.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
        p terminate.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
    ]
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
    "Modified: 28.6.1997 / 14:03:50 / cg"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
!
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
showHelp:aHelpText for:view
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
    "show the help text for aView"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
    |org p v dev|
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
    view == currentView ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
        lastHelpText = aHelpText ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
            ^ self
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
        ]
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    lastHelpText := aHelpText.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
    closeProcess notNil ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
        p := closeProcess. closeProcess := nil.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
        p terminate.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
    currentHelpView notNil ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
        self hideHelp
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    org := view originRelativeTo:nil.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    currentFrame := org extent:view extent.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    org :=org + (view extent // 2).
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
1677
dc49ab70b762 open helpView on the correcdt device
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
   244
    dev := view graphicsDevice.
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
1963
fb6663696d20 removed withCRs in showHelp:
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
   246
    v := ActiveHelpView for:aHelpText onDevice:dev.
1677
dc49ab70b762 open helpView on the correcdt device
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
   247
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
    org := dev pointerPosition.
1657
447db4aae998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
   249
    org := org + (0@18"24").
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
    (org x + v width) > dev width ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
        org := (org x - v width) @ org y
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
    (org y + v height) > dev height ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
        org := org x @ (org y - v height).
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
    v origin:org.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
"/    currentHelpView open.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
    v realize.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
    v enableButtonMotionEvents.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    v enableMotionEvents.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
    currentHelpView := v.
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   263
    currentView := view.
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   265
    self showTime notNil ifTrue:[
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   266
        closeProcess := [
1546
1af738601dae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1542
diff changeset
   267
                [
2392
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   268
                    (Delay forSeconds:self showTime) wait.
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   269
                    [
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   270
                        currentHelpView notNil ifTrue:[
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   271
                            currentHelpView destroy.
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   272
                            currentHelpView := nil.
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   273
                        ]
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   274
                    ] valueUninterruptably
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   275
                ] ifCurtailed:[
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   276
                    closeProcess := nil.
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   277
                ].
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   278
            ] newProcess.
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   279
        closeProcess priority:(Processor userSchedulingPriority + 1).
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   280
        closeProcess resume.
02244f5708b7 reafctored
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   281
    ].
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
1963
fb6663696d20 removed withCRs in showHelp:
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
   283
    "Modified: / 31-08-1995 / 19:20:45 / claus"
fb6663696d20 removed withCRs in showHelp:
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
   284
    "Modified: / 16-03-2004 / 15:27:50 / cg"
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
!
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
stopHelpDisplayProcess
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
    |p|
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
    showProcess notNil ifTrue:[
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
        p := showProcess. showProcess := nil.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
        p terminate.
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
    ].
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
    "Created: 28.6.1997 / 14:03:17 / cg"
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
! !
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
!FlyByHelp class methodsFor:'documentation'!
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
version
2519
af89806c67e4 comment
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   301
    ^ '$Header: /cvs/stx/stx/libview2/FlyByHelp.st,v 1.22 2008-07-12 13:54:02 cg Exp $'
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
! !
1657
447db4aae998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
   303
1536
fa0601a87d6e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
FlyByHelp initialize!