ShowMeHowItWorks.st
author Claus Gittinger <cg@exept.de>
Sun, 20 Oct 2019 16:38:40 +0200
changeset 3798 eafc4c1bb53e
parent 3797 5ab4b911e388
child 3799 bbb4c1dbce25
permissions -rw-r--r--
#FEATURE by exept class: ShowMeHowItWorks added: #clear #fastMoveRelativeX:y: #freezePin:ofStep:with: #key: #selectPin:ofStep: changed: #click:inComponent:clickTime: #findComponent:in: #movePointerToScreenPosition:speed: #screenBoundsOfComponent: #select: #withViewAndPositionFor:do: class: ShowMeHowItWorks::ItemInView added: #isItemInView #isVisible
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3792
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
     1
"{ Encoding: utf8 }"
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
     2
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ Package: 'stx:libtool2' }"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
"{ NameSpace: Smalltalk }"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
Object subclass:#ShowMeHowItWorks
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
     8
	instanceVariableNames:'application opStream streamStack lastComponentName lastComponent
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
     9
		lastResult voice translate language verifying
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    10
		closeApplicationWhenFinished defaultComponentWaitTime ui
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    11
		theShowFile'
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
    12
	classVariableNames:'IntroShownCount DebugMode StartLabel'
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
	poolDictionaries:''
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
	category:'Interface-Help'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
    17
Object subclass:#ItemInView
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
    18
	instanceVariableNames:'view item boundsInView'
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
    19
	classVariableNames:''
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
    20
	poolDictionaries:''
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
    21
	privateIn:ShowMeHowItWorks
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
    22
!
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
    23
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!ShowMeHowItWorks class methodsFor:'documentation'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
documentation
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
"
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    28
    automatic presentations.
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    29
    To see how it works, open a methodFinder:
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    30
        MethodFinderWindow open
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    31
    and select its 'Show me how it works' item in the help menu.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
    [author:]
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
        Claus Gittinger
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
example
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    39
    MethodFinderWindow open.
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    40
    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    ShowMeHowItWorks do:#(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
        ( showing: 'Choose the number of arguments' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
            moveTo: NumberOfArguments
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
            select: '1' 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
        ))  
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
        (showing: 'Click into the "receiver" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
            moveTo: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
            click: ReceiverEditor 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
        (showing: 'Enter a value (or expression) into "receiver" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
        (showing: 'Click into the "first argument" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
            moveTo: Arg1Editor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
        (showing: 'Enter a value (or expression) into "receiver" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    )
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    62
!
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    63
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    64
scriptFormat
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    65
"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    66
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    67
    speaking:
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    68
        show:           'text'
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    69
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    70
    mouse movement:
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    71
        moveTo:         '<component>'       move there and circle around
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    72
        fastMoveTo:     '<component>'       move without circling
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    73
        (drag: '<fromComponent>' toComponent: '<toComponent>' dropAt:<pos> show:'text')
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    74
            pos is one of #topLeft, #topCenter, #topRght, #bottomLeft, #bottomCenter, #bottomRight
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    75
            text is spoken before the drop
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    76
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    77
    mouse actions:
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    78
        click
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    79
        click:          buttonNumber
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    80
        select:         itemsIndexOrLabelOrPattern
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    81
            itemsIndexOrLabelOrPattern can be an integer or text
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    82
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    83
    misc:
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    84
        wait:           seconds             just pause
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    85
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    86
        label:          'name'              for debugging, presentation can be started at some
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    87
                                            label, by setting the StartLabel class variable
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    88
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    89
        (waitFor: '<component>' timeout:seconds)
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    90
                                            wait for a component to appear
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    91
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    92
        open            'nameOfAppModelClass'
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    93
                                            open an application (class)
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    94
        intro           
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    95
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    96
component naming:
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    97
    '<component>' can be:
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    98
        name of a component, as defined in the UI-spec's nameKey,
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
    99
        helpKey
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   100
        title
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   101
        label
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   102
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   103
     a path like 'ProjectTree/ToolBar' will first find ProjectTrue, then ToolBar
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   104
     a menu item index like 'Toolbar/item[idx]'
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   105
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   106
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   107
"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
!ShowMeHowItWorks class methodsFor:'running'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   112
application:anApplicationOrNilForAll do:specArray 
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   113
    "spec contains a list of action commands (show: / moveTo: etc.)"
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   114
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   115
    self new 
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   116
        application:anApplicationOrNilForAll;
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   117
        do:specArray 
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   118
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   119
    "
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   120
     ShowMeHowItWorks do:
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   121
        #(
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   122
            (language: de)
3792
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
   123
            (show: 'üben üben üben')
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   124
            (wait: 0.5)
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   125
            (moveTo: NameOfComponent)
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   126
        )    
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   127
    "
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   128
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   129
    "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   130
    "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   131
!
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   132
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   133
application:anApplicationOrNilForAll doShowFile:aFilename 
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   134
    "spec contains a list of action commands (show: / moveTo: etc.)"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   135
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   136
    self new 
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   137
        application:anApplicationOrNilForAll;
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   138
        doShowFile:aFilename 
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   139
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   140
    "
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   141
     ShowMeHowItWorks do:
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   142
        #(
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   143
            (language: de)
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   144
            (show: 'üben üben üben')
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   145
            (wait: 0.5)
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   146
            (moveTo: NameOfComponent)
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   147
        )    
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   148
    "
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   149
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   150
    "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   151
    "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   152
!
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   153
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
do:specArray
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   155
    "spec contains a list of action commands (show: / moveTo: etc.)"
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   156
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   157
    self do:specArray withUI:false
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   159
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   160
     ShowMeHowItWorks do:
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   161
        #(
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   162
            (language: de)
3792
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
   163
            (show: 'üben üben üben')
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   164
            (wait: 0.5)
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   165
            (moveTo: NameOfComponent)
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   166
        )    
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   167
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   168
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   169
    "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   170
    "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   171
!
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   172
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   173
do:specArray from:startLabelOrNil withUI:withUIBoolean
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   174
    "spec contains a list of action commands (show: / moveTo: etc.)"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   175
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   176
    self new 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   177
        do:specArray 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   178
        from:startLabelOrNil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   179
        withUI:withUIBoolean
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   180
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   181
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   182
     ShowMeHowItWorks 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   183
        do:#(
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   184
            (language: de)
3792
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
   185
            (show: 'üben üben üben')
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   186
            (wait: 0.5)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   187
            (moveTo: NameOfComponent)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   188
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   189
        withUI:true
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   190
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   191
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   192
    "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   193
    "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   194
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   195
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   196
do:specArray withUI:withUIBoolean
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   197
    "spec contains a list of action commands (show: / moveTo: etc.)"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   198
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   199
    self new do:specArray withUI:withUIBoolean
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   200
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   201
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   202
     ShowMeHowItWorks 
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   203
        do:#(
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   204
            (language: de)
3792
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
   205
            (show: 'üben üben üben')
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   206
            (wait: 0.5)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   207
            (moveTo: NameOfComponent)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   208
        )
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   209
        withUI:true
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   210
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   211
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   212
    "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   213
    "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   214
! !
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   215
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   216
!ShowMeHowItWorks methodsFor:'accessing'!
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   217
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   218
application:anApplication
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   219
    "if set, only that application is presented (widget search is limtied to that one)"
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   220
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   221
    application := anApplication.
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   222
!
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   223
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   224
setLanguage:lang
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   225
    voice := OperatingSystem bestVoiceForLanguage:lang.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   226
    language := lang.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   227
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   228
    "Created: / 23-07-2019 / 10:27:02 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
!ShowMeHowItWorks methodsFor:'commands'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   233
freezePin:pinName ofStep:stepName with:freezeString
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   234
    <action>
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   235
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   236
    |diagramEditor pinPO|
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   237
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   238
    (diagramEditor := lastComponent) isScrollWrapper ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   239
        diagramEditor := lastComponent scrolledView
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   240
    ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   241
    pinPO := diagramEditor 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   242
            detectPOForWhich:[:po |
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   243
                po isPin 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   244
                and:[ po name = pinName
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   245
                and:[ po owningStepPO name = stepName ]]
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   246
            ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   247
    diagramEditor selection:{ pinPO }.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   248
    diagramEditor doubleClickOn:pinPO.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   249
    self fastMoveTo:(lastComponentName,'/','EditField').
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   250
    self click.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   251
    self type:freezeString.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   252
    self key:#Return.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   253
!
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   254
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   255
intro
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   256
    <action>
3724
e513514f6ce7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
   257
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   258
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   259
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   260
    IntroShownCount := (IntroShownCount ? 0).
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   261
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   262
    "/ only say this a few times..
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   263
    IntroShownCount > 3 ifTrue:[^ self].
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   264
    IntroShownCount := IntroShownCount + 1.
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   265
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   266
    language isNil ifTrue:[
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   267
        self setLanguage:(Smalltalk language). 
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   268
    ].
3724
e513514f6ce7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
   269
    self tell:(self class classResources 
3733
1da1137b6f23 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
   270
                string:'You can stop this show, by pressing the SHIFT key').
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   271
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   272
    "Created: / 19-07-2019 / 15:49:19 / Claus Gittinger"
3733
1da1137b6f23 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
   273
    "Modified: / 23-07-2019 / 11:06:13 / Claus Gittinger"
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   274
!
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   275
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   276
label:nameOfLabel
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   277
    <action>
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   278
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   279
    "/ skipped here; see goto
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   280
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   281
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   282
language:lang
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   283
    <action>
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   284
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   285
    self setLanguage:lang.
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   286
    translate := false.
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   287
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   288
    "Created: / 23-07-2019 / 10:27:02 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   289
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   290
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   291
open:applicationClassName
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   292
    <action>
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   293
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   294
    |appClass|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   295
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   296
    (appClass := Smalltalk classNamed:applicationClassName) isNil ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   297
        self error:'no such application class'
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   298
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   299
    verifying ifFalse:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   300
        application := appClass new openAndWaitUntilVisible.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   301
        closeApplicationWhenFinished := true.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   302
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   303
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   304
    "Created: / 19-07-2019 / 15:09:45 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   305
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   306
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
pause
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
    
3724
e513514f6ce7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
   310
    Dialog information:(self class classResources 
e513514f6ce7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
   311
                            stringWithCRs:'Show Paused.\Click on "OK" to proceed')
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
    "Created: / 19-07-2019 / 15:03:17 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   314
    "Modified: / 19-07-2019 / 16:13:33 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   317
raise:what
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   318
    <action>
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   319
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   320
    verifying ifTrue:[^ self].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   321
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   322
    what == #application ifTrue:[
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   323
        application topView raise.
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   324
        ^ self
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   325
    ].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   326
    what == #masterApplication ifTrue:[
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   327
        application windowGroup isModal ifTrue:[
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   328
            application windowGroup mainGroup topViews first raise
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   329
        ] ifFalse:[
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   330
            (application masterApplication ? application) topViews first raise.
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   331
        ].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   332
        ^ self
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   333
    ].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   334
    self halt.
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   335
!
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   336
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   337
selectPin:pinName ofStep:stepName
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   338
    <action>
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   339
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   340
    |diagramEditor pinPo|
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   341
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   342
    (diagramEditor := lastComponent) isScrollWrapper ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   343
        diagramEditor := lastComponent scrolledView
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   344
    ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   345
    pinPo := diagramEditor 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   346
            detectPOForWhich:[:po |
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   347
                po isPin 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   348
                and:[ po name = pinName
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   349
                and:[ po owningStepPO name = stepName ]]
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   350
            ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   351
    self movePointerToComponent:diagramEditor offset:pinPo frame center.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   352
    diagramEditor selection:{ pinPo }. 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   353
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   354
!
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   355
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   356
show:message
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   357
    "showing (and speak) some message."
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   358
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   359
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   360
    
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   361
    self showing:message saying:nil do:nil
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   362
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   363
    "Created: / 19-07-2019 / 15:59:18 / Claus Gittinger"
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   364
    "Modified (comment): / 19-07-2019 / 18:54:36 / Claus Gittinger"
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   365
!
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   366
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   367
show:message for:seconds
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   368
    "showing (and speak) some message and wait for some time."
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   369
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   370
    <action>
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   371
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   372
    DebugMode == true ifTrue:[^ self].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   373
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   374
    self show:message.
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   375
    self wait:seconds.
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   376
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   377
    "Created: / 19-07-2019 / 18:54:20 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   378
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   379
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   380
show:message saying:sentenceOrNil
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   381
    "showing (and speak) some message."
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   382
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   383
    <action>
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   384
    
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   385
    self showing:message saying:sentenceOrNil do:nil
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   386
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   387
    "Created: / 19-07-2019 / 15:59:18 / Claus Gittinger"
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   388
    "Modified (comment): / 19-07-2019 / 18:54:36 / Claus Gittinger"
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   389
!
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   390
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   391
show:message saying:sentenceOrNil for:seconds
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   392
    "showing (and speak) some message and wait for some time."
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   393
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   394
    <action>
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   395
    
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   396
    DebugMode == true ifTrue:[^ self].
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   397
    self show:message saying:sentenceOrNil.
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   398
    self wait:seconds.
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   399
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   400
    "Created: / 19-07-2019 / 18:54:20 / Claus Gittinger"
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   401
!
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   402
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   403
showing:message do:operationsOrNothing
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   404
    "execute operationsOrNothing while showing (and speaking) some message."
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
    
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   408
    self showing:message saying:nil do:operationsOrNothing
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   409
!
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   410
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   411
showing:message saying:sentenceOrNil do:operationsOrNothing
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   412
    "execute operationsOrNothing while showing (and speaking) some message."
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   413
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   414
    <action>
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   415
    
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   416
    |xLatedMessage messageView talkDone|
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   418
    xLatedMessage := (translate and:[application notNil]) 
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   419
                            ifTrue:[application resources string:message]
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   420
                            ifFalse:[message].
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   421
    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   422
    self assert:(operationsOrNothing isNil or:[operationsOrNothing isSequenceable]).
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   424
    messageView := ActiveHelpView for:xLatedMessage.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
    "/ messageView shapeStyle:#cartoon.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
    [
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   427
        messageView origin:(Screen current pointerPosition + (0 @ 20)).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   428
        messageView makeFullyVisible.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
        messageView realize.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
        self talking ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
            talkDone := Semaphore new.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
            [
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   434
                self tell:(sentenceOrNil ? xLatedMessage).
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
                talkDone signal
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
            ] fork.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
            
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
            "/
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
            "/ allow speaker some headoff
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   440
            verifying ifFalse:[
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   441
                Delay waitForSeconds:(xLatedMessage size / 15)+0.5.
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   442
            ].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
        ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   445
        operationsOrNothing notEmptyOrNil ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   446
            self doStream:(operationsOrNothing readStream).
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   447
        ].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
    ] ensure:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
        messageView destroy
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
    self talking ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
        talkDone wait.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
    "Created: / 19-07-2019 / 11:19:27 / Claus Gittinger"
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   456
    "Modified: / 23-07-2019 / 10:52:30 / Claus Gittinger"
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   457
!
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   458
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   459
thankyou
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   460
    <action>
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   461
    
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   462
    self show:(self randomThankYou).
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   463
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   464
    "Created: / 23-07-2019 / 10:50:43 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
wait:seconds
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
    
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   470
    verifying ifTrue:[^ self].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   471
    DebugMode == true ifTrue:[^ self].
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   472
    Display ctrlDown ifTrue:[^ self].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   473
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
    Delay waitForSeconds:seconds
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
    "Created: / 19-07-2019 / 15:09:45 / Claus Gittinger"
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   477
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   478
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   479
waitFor:componentName timeout:seconds
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   480
    <action>
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   481
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   482
    |endTime|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   483
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
   484
    verifying ifTrue:[^ self].
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
   485
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   486
    endTime := Timestamp now + seconds.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   487
    [   
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   488
        (self findComponent:componentName inAllApplications:true ifMultiple:nil) notNil ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   489
            ^ self
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   490
        ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   491
        Delay waitForSeconds:0.05.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   492
        Timestamp now > endTime ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   493
            self error:('component %1 not present after %2' bindWith:componentName with:seconds)
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   494
        ]
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   495
    ] loop
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   498
!ShowMeHowItWorks methodsFor:'commands - checking'!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   499
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   500
isEmpty:componentName
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   501
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   502
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   503
    |component|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   504
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   505
    component := self componentNamed:componentName.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   506
    component isScrollWrapper ifTrue:[ component := component scrolledView ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   507
    component isTextView ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   508
        ^ component contents isEmptyOrNil
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   509
    ] ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   510
        self halt.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   511
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   512
    self error:'isEmpty: unhandled component type: ',component displayString.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   513
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   514
    "Created: / 19-07-2019 / 15:33:47 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   515
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   516
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   517
unless:query do:actions
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   518
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   519
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   520
    |result|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   521
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   522
    result := self doCommand:query.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   523
    result ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   524
        self doCommand:actions
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   525
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   526
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   527
    "Created: / 19-07-2019 / 15:33:32 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   528
! !
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   529
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   530
!ShowMeHowItWorks methodsFor:'commands - mouse & keyboard'!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   531
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   532
clear
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   533
    "clear entry fields"
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   534
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   535
    <action>
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   536
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   537
    verifying ifTrue:[^ self].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   538
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   539
    lastComponent contents:nil
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   540
!
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   541
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   542
click
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   543
    "press-release"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   544
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   545
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   546
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   547
    ^ self click:1 inComponent:lastComponent
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   548
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   549
    "Created: / 19-07-2019 / 16:11:03 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   550
!
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
click:buttonNr
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
    "press-release"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   557
    self assert:(buttonNr isInteger).
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   558
    ^ self click:buttonNr inComponent:lastComponent
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
    "Created: / 19-07-2019 / 13:21:20 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   561
    "Modified: / 19-07-2019 / 16:10:19 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   564
clickIn:componentName
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   565
    "press-release"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   566
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   567
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   568
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   569
    ^ self click:1 inComponent:(self componentNamed:componentName)
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   570
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   571
    "Created: / 19-07-2019 / 16:09:58 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   572
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   573
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   574
drag:itemsIndexOrLabelOrPattern toComponent:targetComponentName dropAt:where
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   575
    "drag an item (by index or label) from the current treeView,
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   576
     into another component.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   577
     where is one of: #top, #center or #bottom.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   578
     allowed after moving to:
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   579
        aSelectionInHierarchyView
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   580
    "    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   581
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   582
    <action>
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   583
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   584
    self drag:itemsIndexOrLabelOrPattern toComponent:targetComponentName dropAt:where show:nil
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   585
!
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   586
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   587
drag:itemsIndexOrLabelOrPattern toComponent:targetComponentName dropAt:where show:textWhenDroppingOrNil
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   588
    "drag an item (by index or label) from the current treeView,
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   589
     into another component.
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   590
     where is one of: #top, #center or #bottom.
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   591
     allowed after moving to:
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   592
        aSelectionInHierarchyView
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   593
    "    
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   594
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   595
    <action>
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   596
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   597
    |sourceComponent targetComponent idx yPos sourcePos sourcePosOnScreen
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   598
     targetPos targetPosOnScreen targetPosInSource dNdMgr|
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   599
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   600
    verifying ifTrue:[^ self].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   601
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   602
    targetComponent := self findComponent:targetComponentName.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   603
    self assert:targetComponent notNil.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   604
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   605
    ((sourceComponent := lastComponent) isKindOf:ScrollableView) ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   606
        sourceComponent := sourceComponent scrolledView.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   607
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   608
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
   609
    targetPos := self where:where inComponent:targetComponent. 
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   610
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   611
    (sourceComponent isKindOf:HierarchicalListView) ifTrue:[
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   612
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   613
        itemsIndexOrLabelOrPattern isInteger ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   614
            idx := itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   615
        ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   616
            itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   617
                idx := sourceComponent indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   618
            ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   619
                idx := sourceComponent indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   620
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   621
            idx == 0 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   622
                self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   623
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   624
        ].
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
   625
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   626
        yPos := sourceComponent yVisibleOfLine:idx.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   627
        self movePointerToComponent:sourceComponent rightOffset:(10 @ (yPos + 3)).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   628
        Delay waitForSeconds:0.5.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   629
        sourcePosOnScreen := Display pointerPosition.
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
   630
        sourcePos := Display translatePoint:sourcePosOnScreen fromView:nil toView:sourceComponent.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
   631
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
   632
        targetPosOnScreen := Display translatePoint:targetPos fromView:targetComponent toView:nil.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
   633
        targetPosInSource := Display translatePoint:targetPosOnScreen fromView:nil toView:sourceComponent.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   634
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
   635
        sourceComponent simulateButtonPress:1 at:sourcePos sendDisplayEvent:false.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
   636
        sourceComponent simulateButtonPress:1 at:sourcePos sendDisplayEvent:true.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
   637
        Delay waitForSeconds:0.2.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   638
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   639
        dNdMgr := sourceComponent startDragAt:sourcePos.
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   640
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   641
        textWhenDroppingOrNil notNil ifTrue:[
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   642
            self show:textWhenDroppingOrNil.
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   643
        ].
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   644
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   645
        Delay waitForSeconds:1.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   646
        self movePointerToComponent:targetComponent offset:targetPos.
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   647
        Delay waitForSeconds:1.
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   648
        dNdMgr buttonMotion:1 x:targetPos x y:targetPos y view:targetComponent.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   649
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   650
        dNdMgr buttonRelease:1 x:targetPos x y:targetPos y view:targetComponent.
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
   651
        sourceComponent simulateButtonRelease:1 at:targetPos sendDisplayEvent:false.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   652
        ^ self
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   653
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   654
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   655
    self error:'cannot expand in this component'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   656
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   657
    "Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   658
    "Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   659
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   660
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   661
expand:itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   662
    "expand an item in a treeView by label,
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   663
     allowed after moving to:
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   664
        aSelectionInHierarchyView
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   665
    "    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   666
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   667
    <action>
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   668
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   669
    |component|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   670
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   671
    verifying ifTrue:[^ self].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   672
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   673
    ((component := lastComponent) isKindOf:ScrollableView) ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   674
        component := component scrolledView.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   675
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   676
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   677
    (component isKindOf:HierarchicalListView) ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   678
        |idx yPos|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   679
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   680
        itemsIndexOrLabelOrPattern isInteger ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   681
            idx := itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   682
        ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   683
            itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   684
                idx := component indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   685
            ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   686
                idx := component indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   687
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   688
            idx == 0 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   689
                self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   690
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   691
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   692
        yPos := component yVisibleOfLine:idx.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   693
        self movePointerToComponent:component offset:(0 @ (yPos + 3)).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   694
        Delay waitForSeconds:0.5.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   695
        (component listAt:idx) expand.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   696
        ^ self
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   697
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   698
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   699
    self error:'cannot expand in this component'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   700
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   701
    "Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   702
    "Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   703
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   704
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   705
fastMoveRelativeX:dX y:dY
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   706
    "move the mouse to a new relative position"
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   707
    
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   708
    <action>
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   709
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   710
    |screen newPos currentPos|
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   711
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   712
    verifying ifTrue:[^ self].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   713
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   714
    screen := Screen current.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   715
    currentPos := screen pointerPosition.   
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   716
    newPos := currentPos + (dX @ dY).
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   717
    self fastMovePointerToScreenPosition:newPos
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   718
!
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   719
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   720
fastMoveTo:componentName
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   721
    "move the mouse to componentName without circling"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   722
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   723
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   724
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   725
    |component|
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   726
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   727
    component := self componentNamed:componentName.
3717
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
   728
    self movePointerToComponent:component speed:(self pointerMoveSpeedFast).
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   729
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   730
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   731
     ShowMeHowItWorks basicNew fastMoveTo:'Classes'
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   732
     ShowMeHowItWorks basicNew fastMoveTo:'Klassen'
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   733
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   734
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   735
    "Created: / 19-07-2019 / 15:39:23 / Claus Gittinger"
3717
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
   736
    "Modified: / 20-07-2019 / 08:14:16 / Claus Gittinger"
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   737
    "Modified (comment): / 23-07-2019 / 09:33:31 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   738
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   739
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   740
key:aKeySymbol
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   741
    "press/release a key"
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   742
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   743
    <action>
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   744
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   745
    |t|
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   746
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   747
    verifying ifTrue:[^ self].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   748
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   749
    t := Display ctrlDown ifTrue:[0.05] ifFalse:[0.1].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   750
    lastComponent 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   751
        simulateKey:aKeySymbol at:(lastComponent extent // 2) sendDisplayEvent:false keyPressTime:t
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   752
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   753
    "Created: / 19-07-2019 / 15:50:40 / Claus Gittinger"
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   754
!
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   755
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   756
moveTo:componentName
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   757
    "move the mouse to componentName,
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
     then circle around it a few times"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   760
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
    |component|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   764
    component := self componentNamed:componentName.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
    self movePointerToComponent:component.
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   766
    Display ctrlDown ifTrue:[^ self].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   767
    self circlePointerAroundComponent:component.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   769
    "Created: / 19-07-2019 / 11:20:42 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   770
    "Modified: / 19-07-2019 / 15:38:11 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   773
press:buttonNr
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   774
    <action>
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   775
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   776
    "press at the current position"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   777
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   778
    self assert:(buttonNr isInteger).
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   779
    ^ self press:buttonNr inComponent:lastComponent.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   780
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   781
"/    "press at the current position"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   782
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   783
"/    |position screen x y|
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   784
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   785
"/    verifying ifTrue:[^ self].
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   786
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   787
"/    screen := Screen current.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   788
"/    position := screen pointerPosition.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   789
"/    x := position x.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   790
"/    y := position y.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   791
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   792
"/    "/ self movePointerToScreenPosition:position.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   793
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   794
"/    false "OperatingSystem isOSXlike" ifTrue:[
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   795
"/        |osxPos|
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   796
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   797
"/        osxPos := OperatingSystem getMousePosition.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   798
"/        x := osxPos x rounded.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   799
"/        y := osxPos y rounded.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   800
"/        OperatingSystem generateButtonEvent:buttonNr down:true x:x y:y.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   801
"/        ^ self.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   802
"/    ].
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   803
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   804
"/    screen sendKeyOrButtonEvent:#buttonPress x:x y:y keyOrButton:buttonNr state:0 toViewId:(screen rootWindowId).
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   805
"/    screen flush.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   806
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   807
"/    "Created: / 19-07-2019 / 13:52:38 / Claus Gittinger"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   808
"/    "Modified: / 23-07-2019 / 09:38:31 / Claus Gittinger"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   809
!
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   810
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   811
release:buttonNr
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   812
    <action>
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   813
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   814
    "release at the current position"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   815
    
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   816
    <action>
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   817
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   818
    self assert:(buttonNr isInteger).
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   819
    ^ self press:buttonNr inComponent:lastComponent.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   820
"/    |position screen x y|
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   821
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   822
"/    verifying ifTrue:[^ self].
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   823
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   824
"/    screen := Screen current.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   825
"/    position := screen pointerPosition.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   826
"/    x := position x.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   827
"/    y := position y.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   828
"/    
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   829
"/    self movePointerToScreenPosition:position.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   830
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   831
"/    false "OperatingSystem isOSXlike" ifTrue:[
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   832
"/        |osxPos|
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   833
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   834
"/        osxPos := OperatingSystem getMousePosition.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   835
"/        x := osxPos x rounded.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   836
"/        y := osxPos y rounded.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   837
"/        OperatingSystem generateButtonEvent:buttonNr down:false x:x y:y.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   838
"/        ^ self.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   839
"/    ].
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   840
"/
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   841
"/    screen sendKeyOrButtonEvent:#buttonRelease x:x y:y keyOrButton:buttonNr state:0 toViewId:(screen rootWindowId).
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   842
"/    screen flush.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   843
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   844
    "Created: / 19-07-2019 / 13:53:05 / Claus Gittinger"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   845
    "Modified: / 23-07-2019 / 09:38:38 / Claus Gittinger"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   846
!
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   847
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   848
select:itemsIndexOrLabelOrPattern
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
    "select an item by label,
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
     allowed after moving to:
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
        aComboBox
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
        aSelectionInListView
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
    "    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   855
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   857
    |idx component|
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   858
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   859
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   860
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   861
    ((component := lastComponent) isKindOf:ScrollableView) ifTrue:[
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   862
        component := component scrolledView.
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   863
    ].
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   864
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   865
    (component isKindOf:ComboView) ifTrue:[
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
        "/ click on the menubutton
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   867
        self movePointerToComponent:component menuButton.
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   868
        self click:1 inComponent:component menuButton.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
        Delay waitForSeconds:0.3.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   870
        itemsIndexOrLabelOrPattern isInteger ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   871
            idx := itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   872
        ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   873
            itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   874
                idx := component list findFirst:[:lbl | itemsIndexOrLabelOrPattern match:lbl]
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   875
            ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   876
                idx := component list indexOf:itemsIndexOrLabelOrPattern.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   877
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   878
            idx == 0 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   879
                self error:'no such item in comboList: ',itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   880
            ].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   881
        ].
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   882
        component select:idx.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
        Delay waitForSeconds:0.3.
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   884
        component shownMenu notNil ifTrue:[
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   885
            component shownMenu hide.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   886
        ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   887
        ^ self
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   888
    ].    
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   889
    (component isKindOf:HierarchicalListView) ifTrue:[
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   890
        |idx yPos|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   891
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   892
        itemsIndexOrLabelOrPattern isInteger ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   893
            idx := itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   894
        ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   895
            itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   896
                idx := component indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   897
            ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   898
                idx := component indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   899
            ].
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   900
            idx == 0 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   901
                self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   902
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   903
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   904
        yPos := component yVisibleOfLine:idx.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   905
        self movePointerToComponent:component offset:(0 @ (yPos + 3)).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   906
        component simulateButtonPress:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   907
        Delay waitForSeconds:0.1.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   908
        component simulateButtonRelease:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   909
        "/ component selection:idx.
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   910
        ^ self
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   911
    ].
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   912
    (component isKindOf:SelectionInListModelView) ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   913
        |idx yPos|
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   914
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   915
        itemsIndexOrLabelOrPattern isInteger ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   916
            idx := itemsIndexOrLabelOrPattern
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   917
        ] ifFalse:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   918
            itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   919
                idx := component indexOfElementForWhich:[:el | el notNil and:[itemsIndexOrLabelOrPattern match:el string]]. 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   920
            ] ifFalse:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   921
                idx := component indexOfElementForWhich:[:el | el notNil and:[el string = itemsIndexOrLabelOrPattern]].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   922
            ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   923
            idx == 0 ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   924
                self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   925
            ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   926
        ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   927
        yPos := component yVisibleOfLine:idx.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   928
        self movePointerToComponent:component offset:(0 @ (yPos + 3)).
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   929
        component simulateButtonPress:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   930
        Delay waitForSeconds:0.1.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   931
        component simulateButtonRelease:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   932
        "/ component selection:idx.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   933
        ^ self
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   934
    ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   935
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   936
    (component isKindOf:ItemInView) ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   937
        component isMenuItem ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   938
            self movePointerToComponent:component.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   939
            self halt.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   940
        ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   941
    ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   942
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
   943
    self error:('cannot select this component: %1' bindWith:component className)
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   944
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   945
    "Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   946
    "Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   947
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   948
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
selectIndex:itemsIndex
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   950
    "select an item by index,
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   951
     allowed after moving to:
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   952
        aComboBox
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   953
        aSelectionInListView
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   954
    "    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   955
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   956
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   957
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   958
    self selectIndex:itemsIndex in:lastComponent
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   959
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   960
    "Created: / 19-07-2019 / 14:20:11 / Claus Gittinger"
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   961
    "Modified: / 19-07-2019 / 21:59:36 / Claus Gittinger"
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   962
!
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   963
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   964
selectIndex:itemsIndex in:widgetArg
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   965
    "select an item by index,
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   966
     allowed after moving to:
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   967
        aComboBox
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   968
        aSelectionInListView
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   969
    "    
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   970
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   971
    <action>
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   972
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   973
    |widget y offset possibleWidgets|
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   974
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   975
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   976
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   977
    (widget := widgetArg) isScrollWrapper ifTrue:[
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   978
        widget := widget scrolledView
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   979
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   980
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   981
    (widget isKindOf:ComboView) ifTrue:[
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
        "/ click on the menubutton
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   983
        self movePointerToComponent:widget menuButton.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   984
        self click:1 inComponent:widget menuButton.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   985
        Delay waitForSeconds:0.5.
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   986
        widget select:itemsIndex.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   987
        Delay waitForSeconds:0.5.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   988
        ^ self
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   989
    ].    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   990
    (widget isKindOf:SelectionInListView) ifTrue:[
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   991
        (widget isLineVisible:itemsIndex) ifFalse:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   992
            widget scrollToLine:itemsIndex
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   993
        ].    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   994
        "/ click on the item
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   995
        y := widget yOfLine:itemsIndex.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   996
        offset := (widget width // 2) @ y.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   997
        self movePointerToComponent:widget offset:offset.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   998
        widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   999
        Delay waitForSeconds:(self clickTime).
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1000
        widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1001
        Delay waitForSeconds:0.5.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1002
        ^ self
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1003
    ].
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1004
    (widget isKindOf:SelectionInListModelView) ifTrue:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1005
        (widget isLineVisible:itemsIndex) ifFalse:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1006
            widget scrollToLine:itemsIndex
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1007
        ].    
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1008
        y := widget yVisibleOfLine:itemsIndex.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1009
        offset := (widget width // 2) @ y.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1010
        self movePointerToComponent:widget offset:offset.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1011
        widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1012
        Delay waitForSeconds:(self clickTime).
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1013
        widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1014
        Delay waitForSeconds:0.5.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1015
        ^ self
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1016
    ].
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1017
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1018
    "/ none of it - see what is in there
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1019
    possibleWidgets := OrderedCollection new.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1020
    widget allSubViewsDo:[:each |
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1021
        ((each isKindOf:ComboView) 
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1022
          or:[(each isKindOf:SelectionInListView)
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1023
          or:[(each isKindOf:SelectionInListModelView)
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1024
        ]]) ifTrue:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1025
            possibleWidgets add:each
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1026
        ]
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1027
    ].
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1028
    possibleWidgets size == 1 ifTrue:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1029
        self selectIndex:itemsIndex in:(possibleWidgets first).
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1030
        ^ self
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1031
    ].    
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1032
    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1033
    self error:'cannot select this component'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1034
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1035
    "Created: / 19-07-2019 / 21:59:15 / Claus Gittinger"
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1036
    "Modified: / 20-07-2019 / 07:57:41 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1037
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1038
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1039
type:aString
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1040
    "enter text into the last component"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1041
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1042
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1043
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
  1044
    |t|
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
  1045
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1046
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1047
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
  1048
    t := Display ctrlDown ifTrue:[0.05] ifFalse:[0.1].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
  1049
    lastComponent 
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
  1050
        simulateTextInput:aString at:(lastComponent extent // 2) 
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
  1051
        sendDisplayEvent:false keyPressTime:t
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1052
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1053
    "Created: / 19-07-2019 / 15:50:40 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1054
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1055
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1056
!ShowMeHowItWorks methodsFor:'defaults'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1057
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1058
circlingCount
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1059
    "circle around move-end position that many times"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1060
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1061
    ^ 3
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1062
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1063
    "Created: / 19-07-2019 / 13:03:45 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1064
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1065
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1066
circlingRadius 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1067
    "radius when circling"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1068
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1069
    ^ 30 "/ pixels
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1070
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1071
    "Created: / 19-07-2019 / 13:07:59 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1072
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1073
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1074
circlingSpeed 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1075
    "time per round when circling"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1076
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1077
    ^ 0.3 seconds.       "/ time per round
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1078
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1079
    "Created: / 19-07-2019 / 13:02:34 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1080
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1081
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1082
clickTime
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1083
    "when clicking"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1084
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1085
    ^ self shortClickTime
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1086
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1087
    "Created: / 19-07-2019 / 13:17:20 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1088
    "Modified: / 19-07-2019 / 15:21:51 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1089
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1090
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1091
longClickTime
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1092
    "when clicking buttons"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1093
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1094
    ^ 500 milliseconds
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1095
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1096
    "Created: / 19-07-2019 / 15:21:42 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1097
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1098
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1099
pointerAnimationDelay
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1100
    ^ 50 milliseconds.   "/ 20 updates per second
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1101
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1102
    "Created: / 19-07-2019 / 13:04:45 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1103
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1104
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1105
pointerMoveSpeed
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1106
    ^ 400.   "/ pixels per second
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1107
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1108
    "Created: / 19-07-2019 / 13:05:40 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1109
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1110
3717
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
  1111
pointerMoveSpeedFast
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
  1112
    ^ 600.   "/ pixels per second
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
  1113
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
  1114
    "Created: / 20-07-2019 / 08:13:58 / Claus Gittinger"
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
  1115
!
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
  1116
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1117
shortClickTime
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1118
    "when clicking"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1119
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1120
    ^ 100 milliseconds
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1121
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1122
    "Created: / 19-07-2019 / 15:21:29 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1123
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1124
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1125
talking
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1126
    "/ DebugMode := true
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1127
    verifying ifTrue:[^ false].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1128
    DebugMode == true ifTrue:[^ false].
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1129
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1130
    "/ ^ Expecco::ExpeccoPreferences current speechEffectsEnabled
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1131
    ^ true
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1132
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1133
    "Created: / 19-07-2019 / 14:31:14 / Claus Gittinger"
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1134
    "Modified (comment): / 23-07-2019 / 09:45:35 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1135
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1136
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1137
!ShowMeHowItWorks methodsFor:'helper'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1138
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1139
randomThankYou
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1140
    ^ #(
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1141
        'thank you, for watching'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1142
        'thank you for watching'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1143
        'thank you'
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1144
        'thanks'
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1145
        'have a good day'
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1146
        'have a nice day'
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1147
        'have fun'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1148
        'have fun with expecco'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1149
        'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: "to sin"'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1150
        'happy hacking'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1151
        'happy hacking, I hope you liked what you saw'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1152
        'hope you liked it'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1153
        'see you again'
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1154
        'be the source with you'
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1155
        'be the force with you'
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1156
        'may the force be with you'
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1157
        'may the source be with you'
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1158
        'please give feedback, and let us know, if you liked it'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1159
        'if you have any questions, please contact exept'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1160
        'if you need more information, please take a look at the wiki'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1161
    ) atRandom
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1162
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1163
    "
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1164
     OperatingSystem speak:'may the source be with you'
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1165
     OperatingSystem speak:'have fun with expecco'
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
  1166
     OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: to sin'
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1167
     OperatingSystem speak:'happy hacking, I hope you liked what you saw'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1168
     OperatingSystem speak:'please give feedback, and let us know, if you liked it'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1169
     OperatingSystem speak:'if you have any questions, please contact exept'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1170
     OperatingSystem speak:'if you need more information, please take a look at the wiki'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1171
    "
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1172
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1173
    "Created: / 19-07-2019 / 21:39:18 / Claus Gittinger"
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1174
!
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1175
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1176
tell:message
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1177
    self talking ifTrue:[
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1178
        OperatingSystem speak:message voiceName:voice.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1179
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1180
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1181
    "Created: / 19-07-2019 / 14:57:50 / Claus Gittinger"
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1182
    "Modified: / 23-07-2019 / 10:28:02 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1183
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1184
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1185
!ShowMeHowItWorks methodsFor:'helpers - broken'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1186
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1187
click:buttonNr atPosition:position
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1188
    "press-release at position"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1189
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1190
    |screen|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1191
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1192
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1193
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1194
    screen := Screen current.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1195
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1196
    screen setPointerPosition:position.    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1197
    screen flush.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1198
    self click:buttonNr
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1199
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1200
    "Created: / 19-07-2019 / 13:14:51 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1201
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1202
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1203
!ShowMeHowItWorks methodsFor:'helpers - component search'!
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1204
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1205
componentNamed:componentName
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1206
    "retrieve a component by name or report an error if not found.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1207
     Can return either a view or a menu item"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1208
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1209
    |component|
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1210
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1211
    lastComponentName := componentName.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1212
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1213
    component := self findComponent:componentName.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1214
    component isNil ifTrue:[
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1215
        self error:'no component found for: ',componentName mayProceed:verifying.
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1216
        ^ nil
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1217
    ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1218
    lastComponent := component.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1219
    ^ component
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1220
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1221
    "Created: / 19-07-2019 / 15:37:35 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1222
    "Modified (comment): / 23-07-2019 / 09:31:53 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1223
!
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1224
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1225
findComponent:componentName
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1226
    "find a component by name - in the active and possibly in any app.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1227
     Can return either a view or a menu item"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1228
    
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1229
    ^ self 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1230
        findComponent:componentName
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1231
        inAllApplications:true
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1232
        ifMultiple:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1233
            self proceedableError:('multiple components found by name: ',componentName).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1234
            nil
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1235
        ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1236
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1237
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1238
     ShowMeHowItWorks basicNew findComponent:'Classes'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1239
     ShowMeHowItWorks basicNew findComponent:'Klassen'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1240
    "
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1241
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1242
    "Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1243
    "Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1244
    "Modified (comment): / 23-07-2019 / 09:32:44 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1245
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1246
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1247
findComponent:componentName ifMultiple:exceptionalValue
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1248
    "find a component by name - in the active and possibly in any app.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1249
     Can return either a view or a menu item"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1250
    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1251
    ^ self
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1252
        findComponent:componentName
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1253
        inAllApplications:true
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1254
        ifMultiple:exceptionalValue
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1255
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1256
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1257
     ShowMeHowItWorks basicNew findComponent:'Classes'
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1258
     ShowMeHowItWorks basicNew findComponent:'Klassen'
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1259
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1260
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1261
    "Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1262
    "Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1263
    "Modified (comment): / 23-07-2019 / 09:32:44 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1264
!
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1265
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1266
findComponent:componentNameOrPath in:anApplicationOrViewOrMenuItem
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1267
    "find a component by name inside an app or inside a view.
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1268
     Uses the NameKey of the spec, and optionally the label or modelKey.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1269
     Can return either a view or a menu item"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1270
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1271
    |quoted idxString idx app window component componentNameSymbol 
3793
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1272
     foundByName foundByHelpKey foundByTitle foundByLabel item
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1273
     checkIfAllMenuItemsDoTheSame|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1274
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1275
    "/ split at "/";
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1276
    "/ but not if inside quotes
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1277
    quoted := false.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1278
    componentNameOrPath doWithIndex:[:ch :idx |
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1279
        ch == $" ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1280
            quoted := quoted not.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1281
        ] ifFalse:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1282
            ((ch == $/) and:[quoted not]) ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1283
                |containerName restPath container|
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1284
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1285
                containerName := componentNameOrPath copyTo:idx-1.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1286
                restPath := componentNameOrPath copyFrom:idx+1.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1287
                container := self findComponent:containerName in:anApplicationOrViewOrMenuItem.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1288
                container isNil ifTrue:[ ^ nil ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1289
                ^ self findComponent:restPath in:container
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1290
            ]
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1291
        ]
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1292
    ].
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1293
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1294
    (anApplicationOrViewOrMenuItem isKindOf:ItemInView) ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1295
        anApplicationOrViewOrMenuItem isMenuItem ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1296
            ^ self findComponent:componentNameOrPath in:anApplicationOrViewOrMenuItem item submenu
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1297
        ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1298
    ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1299
3797
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1300
    (componentNameOrPath startsWith:'item[') ifTrue:[
3794
49da17b54a22 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  1301
        anApplicationOrViewOrMenuItem isMenu ifFalse:[
49da17b54a22 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  1302
            self assert:false message:'container is not a menu'.
49da17b54a22 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  1303
        ].
3797
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1304
        idxString := (componentNameOrPath withoutPrefix:'item[') withoutSuffix:']'.
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1305
        (idxString conform:#isDigit) ifTrue:[
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1306
            idx := Integer readFrom:idxString.
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1307
            item := anApplicationOrViewOrMenuItem itemAtIndex:idx.
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1308
        ] ifFalse:[
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1309
            idxString := idxString withoutQuotes.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1310
            idxString includesMatchCharacters ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1311
                item := 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1312
                    anApplicationOrViewOrMenuItem itemForWhich:[:item |
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1313
                        (item nameKey matches: idxString)
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1314
                        or:[ (item textLabel matches: idxString) 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1315
                        or:[ (item value isSymbol and:[item value matches: idxString])]]
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1316
                    ]
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1317
            ] ifFalse:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1318
                item := 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1319
                    anApplicationOrViewOrMenuItem itemForWhich:[:item |
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1320
                        item nameKey = idxString
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1321
                        or:[ item textLabel = idxString 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1322
                        or:[ (item value isSymbol and:[ item value = idxString ])]]
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1323
                    ]
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1324
            ].
3797
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1325
        ].
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1326
        self assert:item notNil message:('no menu item named "%1"' bindWith:idxString).
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1327
        ^ ItemInView new view:anApplicationOrViewOrMenuItem item:item boundsInView:(item layout)
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1328
    ].
3797
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1329
    (componentNameOrPath startsWith:'tab[') ifTrue:[
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1330
        (anApplicationOrViewOrMenuItem isKindOf:NoteBookView) ifFalse:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1331
            self assert:false message:'container is not a notebook'.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1332
        ].
3797
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1333
        idxString := (componentNameOrPath withoutPrefix:'tab[') withoutSuffix:']'.
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1334
        (idxString conform:#isDigit) ifTrue:[
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1335
            idx := Integer readFrom:idxString.
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1336
            item := anApplicationOrViewOrMenuItem tabAtIndex:idx.
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1337
        ] ifFalse:[
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1338
            idxString := idxString withoutQuotes.
3797
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1339
            item := anApplicationOrViewOrMenuItem tabForWhich:[:tab | tab tabItem rawLabel = idxString].
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1340
            item isNil ifTrue:[
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1341
                item := anApplicationOrViewOrMenuItem tabForWhich:[:tab | tab printableLabel = idxString].
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1342
                item isNil ifTrue:[
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1343
                    item := anApplicationOrViewOrMenuItem tabForWhich:[:tab | tab activeHelpKey = idxString].
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1344
                ].
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1345
            ].
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1346
        ].
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1347
        self assert:item notNil.
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1348
        ^ ItemInView new view:anApplicationOrViewOrMenuItem item:item boundsInView:(item layout)
3794
49da17b54a22 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  1349
    ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1350
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1351
    componentNameSymbol := componentNameOrPath asSymbolIfInterned ? componentNameOrPath.
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1352
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1353
    (app := anApplicationOrViewOrMenuItem) isView ifTrue:[
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1354
        window := anApplicationOrViewOrMenuItem.
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1355
        app := anApplicationOrViewOrMenuItem application
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1356
    ].
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1357
    app isApplicationModel ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1358
        (component := app componentAt:componentNameSymbol) notNil ifTrue:[^ component].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1359
        window := window ? app window.
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1360
    ] ifFalse:[
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1361
        (app askFor:#isMenuItem) ifTrue:[
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1362
            window := app submenu.
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1363
        ]
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1364
    ].
3792
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1365
    window notNil ifTrue:[
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1366
        window shown ifFalse:[^ nil].
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1367
    ].
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1368
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1369
    "/ mhmh - search through all widgets of anApplication; 
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1370
    "/ maybe it was not created via the builder/spec,
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1371
    "/ or it has changed its name.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1372
    "/ look for: widget's name, widget's title, widget's label
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1373
    foundByName := OrderedCollection new. 
3793
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1374
    foundByHelpKey := OrderedCollection new. 
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1375
    foundByTitle := OrderedCollection new. 
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1376
    foundByLabel := OrderedCollection new.
3792
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1377
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1378
    window withAllSubViewsDo:[:each |
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1379
        |foundIt|
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1380
        
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1381
        foundIt := false.
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1382
        each shown ifTrue:[
3793
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1383
            {
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1384
                #name . foundByName .
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1385
                #helpKey . foundByHelpKey .
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1386
                #title . foundByTitle .
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1387
                #label . foundByLabel .
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1388
            } pairWiseDo:[:attr :coll |
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1389
                foundIt ifFalse:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1390
                    [
3793
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1391
                        (each perform:attr) = componentNameSymbol ifTrue:[ 
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1392
                            coll add:each. foundIt := true
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1393
                        ]
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1394
                    ] on:MessageNotUnderstood do:[:ex | ].
3793
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1395
                ]
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1396
            ].
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1397
            foundIt ifFalse:[
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1398
                each isMenu ifTrue:[
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1399
                    (item := each detectItemForNameKey:componentNameSymbol) notNil ifTrue:[
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1400
                        foundByName add:item. foundIt := true
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1401
                    ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1402
                    foundIt ifFalse:[
3793
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1403
                        (item := each detectItemForKey:componentNameSymbol) notNil ifTrue:[
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1404
                            foundByName add:item. foundIt := true 
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1405
                        ].    
3793
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1406
                        foundIt ifFalse:[
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1407
                            (item := each detectItemForLabel:componentNameSymbol) notNil ifTrue:[
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1408
                                foundByLabel add:item. foundIt := true 
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1409
                            ].    
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1410
                        ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1411
                    ].
3793
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1412
                ].    
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1413
            ].
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1414
        ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1415
    ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1416
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1417
    "/ a check, if multiple menu items have the same action, then choose the first found
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1418
    checkIfAllMenuItemsDoTheSame := 
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1419
        [:itemsFound |
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1420
            |visibleItems|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1421
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1422
            (itemsFound conform:[:each | each askFor:#isMenuItem]) ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1423
                (itemsFound collect:[:item | item itemValue]) asSet size == 1 ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1424
                    "/ choose one which is visible, if possible
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1425
                    visibleItems := itemsFound select:[:item | item menuPanel shown].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1426
                    visibleItems notEmpty ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1427
                        ^ visibleItems first
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1428
                    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1429
                    ^ itemsFound first.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1430
                ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1431
            ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1432
        ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1433
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1434
    foundByName notEmpty ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1435
        checkIfAllMenuItemsDoTheSame value:foundByName.
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1436
        self assert:(foundByName size == 1) message:'multiple components found by name'.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1437
        ^ foundByName first.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1438
    ].
3793
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1439
    foundByHelpKey notEmpty ifTrue:[
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1440
        checkIfAllMenuItemsDoTheSame value:foundByHelpKey.
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1441
        self assert:(foundByHelpKey size == 1) message:'multiple components found by helpKey'.
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1442
        ^ foundByHelpKey first.
4759769ba7a3 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3792
diff changeset
  1443
    ].
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1444
    foundByTitle notEmpty ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1445
        checkIfAllMenuItemsDoTheSame value:foundByTitle.
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1446
        self assert:(foundByTitle size == 1) message:'multiple components found by title'.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1447
        ^ foundByTitle first.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1448
    ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1449
    foundByLabel notEmpty ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1450
        checkIfAllMenuItemsDoTheSame value:foundByLabel.
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1451
        self assert:(foundByLabel size == 1) message:'multiple components found by label'.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1452
        ^ foundByLabel first.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1453
    ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1454
    ^ component
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1455
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1456
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1457
     self basicNew findComponent:'Klassen' in:(Transcript topView)
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1458
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1459
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1460
    "Created: / 19-07-2019 / 11:36:21 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1461
    "Modified (comment): / 23-07-2019 / 09:31:34 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1462
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1463
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1464
findComponent:componentName inAllApplications:inAllApplicationsBool ifMultiple:exceptionalValue
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1465
    "find a component by name - in the active and possibly in any app.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1466
     Can return either a view or a menu item"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1467
    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1468
    |component candidates modalGroup|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1469
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1470
    application notNil ifTrue:[ 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1471
        (component := self findComponent:componentName in:application) notNil ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1472
            ^ component.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1473
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1474
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1475
    candidates := OrderedCollection new.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1476
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1477
    "/ is there a modal dialog open for the app?
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1478
    (modalGroup := application windowGroup modalGroup) notNil ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1479
        modalGroup topViews do:[:eachModalTopView |
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1480
            component := self findComponent:componentName in:eachModalTopView.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1481
            component notNil ifTrue:[ 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1482
                candidates add:component
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1483
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1484
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1485
        candidates size == 1 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1486
            ^ candidates first
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1487
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1488
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1489
    inAllApplicationsBool ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1490
        "/ search through all current applications
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1491
        WindowGroup scheduledWindowGroups do:[:eachWG |
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1492
            |eachApp|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1493
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1494
            (eachApp := eachWG application) notNil ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1495
                component := self findComponent:componentName in:eachApp.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1496
                component notNil ifTrue:[ 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1497
                    candidates add:component
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1498
                ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1499
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1500
        ].
3792
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1501
        candidates isEmpty ifTrue:[
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1502
            Display allTopViews do:[:eachTopView |
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1503
                component := self findComponent:componentName in:eachTopView.
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1504
                component notNil ifTrue:[ 
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1505
                    candidates add:component
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1506
                ].
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1507
            ]
7682b28c1e92 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
  1508
        ].
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1509
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1510
        candidates size == 1 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1511
            ^ candidates first
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1512
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1513
        candidates notEmpty ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1514
            "/ multiple elements (probably there are multiple topviews open...
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1515
            "/ check the current windowGroup
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1516
            ^ exceptionalValue value
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1517
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1518
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1519
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1520
    ^ nil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1521
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1522
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1523
     ShowMeHowItWorks basicNew findComponent:'Classes'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1524
     ShowMeHowItWorks basicNew findComponent:'Klassen'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1525
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1526
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1527
    "Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1528
    "Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1529
    "Modified (comment): / 23-07-2019 / 09:32:44 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1530
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1531
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1532
screenBoundsOfComponent:aWidgetOrMenuItemOrTab
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1533
    |itemLayout|
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1534
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1535
    aWidgetOrMenuItemOrTab isView ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1536
        ^ aWidgetOrMenuItemOrTab screenBounds
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1537
    ].
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1538
    (aWidgetOrMenuItemOrTab askFor:#isMenuItem) ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1539
        |menuPanel menuBounds|
3717
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
  1540
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1541
        aWidgetOrMenuItemOrTab isVisible ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1542
            (itemLayout := aWidgetOrMenuItemOrTab layout) notNil ifTrue:[
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1543
                menuPanel := aWidgetOrMenuItemOrTab view.
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1544
                menuPanel shown ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1545
                    menuBounds := menuPanel screenBounds.
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1546
                    ^ itemLayout + menuBounds origin 
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1547
                ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1548
            ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1549
        ].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1550
    ].
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1551
    (aWidgetOrMenuItemOrTab askFor:#isNoteBookTab) ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1552
        (itemLayout := aWidgetOrMenuItemOrTab layout) notNil ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1553
            |notebook notebookBounds|
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1554
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1555
            notebook := aWidgetOrMenuItemOrTab view.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1556
            notebook shown ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1557
                notebookBounds := notebook screenBounds.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1558
                ^ itemLayout + notebookBounds origin 
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1559
            ].
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1560
        ]. 
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1561
        self halt.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1562
    ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1563
    ^ nil.
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1564
! !
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1565
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1566
!ShowMeHowItWorks methodsFor:'helpers - mouse buttons'!
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1567
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1568
click:buttonNr inComponent:component
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1569
    "press-release in a component"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1570
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1571
    |t|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1572
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1573
    t := self shortClickTime.
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1574
    ((component isKindOf:Button) 
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1575
      or:[(component askFor:#isMenuItem)]
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1576
    )ifTrue:[
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1577
        t := self longClickTime
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1578
    ].    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1579
    self click:buttonNr inComponent:component clickTime:t
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1580
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1581
    "Created: / 19-07-2019 / 13:18:27 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1582
    "Modified: / 19-07-2019 / 15:22:47 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1583
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1584
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1585
click:buttonNr inComponent:viewOrMenuItem clickTime:clickTime 
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1586
    "press-release in a component"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1587
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1588
    self withViewAndPositionFor:viewOrMenuItem do:[:viewToClick :clickPos |
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1589
        Display activePointerGrab == Display rootView ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1590
            |pos|
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1591
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1592
            pos := Display translatePoint:clickPos fromView:viewToClick toView:nil.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1593
            OperatingSystem isOSXlike ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1594
                OperatingSystem 
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1595
                    generateMouseMoveEventX:pos x y:pos y;
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1596
                    generateButtonEvent:buttonNr down:true x:pos x y:pos y;
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1597
                    generateButtonEvent:buttonNr down:false x:pos x y:pos y;
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1598
                    generateButtonEvent:buttonNr down:true x:pos x y:pos y;
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1599
                    generateButtonEvent:buttonNr down:false x:pos x y:pos y.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1600
                ^ self.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1601
            ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1602
            Display rootView simulateButtonPress:buttonNr at:pos sendDisplayEvent:true.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1603
            Delay waitForSeconds:clickTime.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1604
            Display rootView simulateButtonRelease:buttonNr at:pos sendDisplayEvent:true.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1605
        ] ifFalse:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1606
            viewToClick simulateButtonPress:buttonNr at:clickPos sendDisplayEvent:false.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1607
            Delay waitForSeconds:clickTime.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1608
            viewToClick simulateButtonRelease:buttonNr at:clickPos sendDisplayEvent:false.
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1609
        ].
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1610
    ].
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1611
!
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1612
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1613
press:buttonNr inComponent:viewOrMenuItem 
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1614
    "press in a component"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1615
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1616
    self withViewAndPositionFor:viewOrMenuItem do:[:viewToClick :clickPos |
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1617
        viewToClick simulateButtonPress:buttonNr at:clickPos sendDisplayEvent:false.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1618
    ]
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1619
!
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1620
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1621
release:buttonNr inComponent:viewOrMenuItem 
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1622
    "release in a component"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1623
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1624
    self withViewAndPositionFor:viewOrMenuItem do:[:viewToClick :clickPos |
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1625
        viewToClick simulateButtonRelease:buttonNr at:clickPos sendDisplayEvent:false.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1626
    ]
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1627
!
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1628
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1629
withViewAndPositionFor:viewOrMenuItem do:aBlock
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1630
    "helper for click, press and release"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1631
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1632
    |viewToClick clickPos|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1633
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1634
    self assert:viewOrMenuItem notNil.
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1635
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1636
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1637
    (viewOrMenuItem isKindOf:ItemInView) ifTrue:[
3797
5ab4b911e388 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3796
diff changeset
  1638
        viewToClick := viewOrMenuItem view.
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1639
        clickPos := viewOrMenuItem layout center.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1640
        self assert:(clickPos notNil).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1641
    ] ifFalse:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1642
        viewToClick := viewOrMenuItem.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1643
        clickPos := viewToClick extent // 2.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1644
    ].
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1645
    aBlock value:viewToClick value:clickPos.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1646
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1647
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1648
!ShowMeHowItWorks methodsFor:'helpers - mouse movement'!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1649
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1650
circlePointerAroundComponent:aWidgetOrMenuItem
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1651
    "circle around it a few times"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1652
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1653
    |bounds position|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1654
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1655
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1656
    bounds isNil ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1657
        self error:'no bounds found for: ',aWidgetOrMenuItem printString.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1658
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1659
    position := bounds center rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1660
    self circlePointerAroundScreenPosition:position
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1661
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1662
    "Created: / 19-07-2019 / 13:12:35 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1663
    "Modified: / 23-07-2019 / 09:38:12 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1664
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1665
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1666
circlePointerAroundScreenPosition:position
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1667
    "circle around it a few times"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1668
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1669
    |screen stepDelayTime numCircles circlingSpeed radius|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1670
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1671
    verifying ifTrue:[^ self].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1672
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1673
    screen := Screen current.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1674
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1675
    circlingSpeed := self circlingSpeed.    "/ time per round
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1676
    numCircles := self circlingCount.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1677
    stepDelayTime := self pointerAnimationDelay.   "/ update interval
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1678
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1679
    radius := self circlingRadius.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1680
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1681
    "/ move it around a few times
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1682
    1 to:numCircles do:[:round |
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1683
        |n angle|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1684
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1685
        n := circlingSpeed / stepDelayTime. "/ nr of steps per circle
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1686
        angle := 360 / n.                   "/ angle-delta per step
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1687
        1 to:n do:[:step |
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1688
            |a x y|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1689
            
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1690
            a := angle * step.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1691
            "/ clockwise starting above the center
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1692
            x := position x + (radius * a degreesToRadians sin).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1693
            y := position y + (radius * a degreesToRadians cos).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1694
"/ Transcript showCR:(x@y).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1695
            screen setPointerPosition:(x@y) rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1696
            screen flush.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1697
            Delay waitFor:stepDelayTime.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1698
        ].    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1699
        "/ and back
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1700
        screen setPointerPosition:position rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1701
        screen flush.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1702
        Delay waitFor:stepDelayTime.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1703
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1704
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1705
    "Created: / 23-07-2019 / 09:37:46 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1706
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1707
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1708
fastMovePointerToScreenPosition:position
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1709
    self movePointerToScreenPosition:position speed:(self pointerMoveSpeedFast).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1710
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1711
    "Created: / 23-07-2019 / 09:36:20 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1712
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1713
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1714
movePointerToComponent:aWidgetOrMenuItem
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1715
    "move the mouse to aWidget's center"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1716
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1717
    |bounds|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1718
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1719
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1720
    self movePointerToScreenPosition:(bounds center rounded).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1721
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1722
    "Created: / 19-07-2019 / 13:11:33 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1723
    "Modified: / 23-07-2019 / 09:37:01 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1724
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1725
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1726
movePointerToComponent:aWidgetOrMenuItem offset:offset
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1727
    "move the mouse to position inside aWidget's"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1728
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1729
    |bounds|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1730
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1731
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1732
    self movePointerToScreenPosition:(bounds origin + offset) rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1733
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1734
    "Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1735
    "Modified: / 23-07-2019 / 09:36:57 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1736
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1737
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1738
movePointerToComponent:aWidgetOrMenuItem rightBottomOffset:offset
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1739
    "move the mouse to position inside aWidget's.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1740
     Offset is from the rightBottom"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1741
    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1742
    |bounds|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1743
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1744
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1745
    self movePointerToScreenPosition:(bounds corner - offset) rounded.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1746
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1747
    "Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1748
    "Modified: / 23-07-2019 / 09:36:57 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1749
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1750
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1751
movePointerToComponent:aWidgetOrMenuItem rightOffset:offset
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1752
    "move the mouse to position inside aWidget's.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1753
     Offset is from the rightTop (i.e. x is subtracted, y is added)"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1754
    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1755
    |bounds pos|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1756
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1757
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1758
    pos := (bounds right - offset x) @ (bounds top + offset y).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1759
    self movePointerToScreenPosition:pos rounded.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1760
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1761
    "Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1762
    "Modified: / 23-07-2019 / 09:36:57 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1763
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1764
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1765
movePointerToComponent:aWidgetOrMenuItemOrTab speed:pixelsPerSecond
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1766
    "move the mouse to aWidget's center"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1767
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1768
    |bounds position|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1769
    
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1770
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItemOrTab.
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1771
    bounds isNil ifTrue:[
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1772
        self error:'no bounds found for: ',aWidgetOrMenuItemOrTab printString.
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1773
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1774
    position := bounds center rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1775
    self movePointerToScreenPosition:position speed:pixelsPerSecond.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1776
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1777
    "Created: / 20-07-2019 / 08:12:49 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1778
    "Modified: / 23-07-2019 / 09:37:27 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1779
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1781
movePointerToScreenPosition:newPosition
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1782
    "move the mouse to newPosition"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1783
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1784
    self movePointerToScreenPosition:newPosition speed:(self pointerMoveSpeed)
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1785
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1786
    "Created: / 23-07-2019 / 09:36:39 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1787
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1788
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1789
movePointerToScreenPosition:newPosition speed:pixelsPerSecond
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1790
    "move the mouse to newPosition, which is a screen position"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1791
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1792
    |screen distance start numSteps moveTime stepDelayTime delta|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1793
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1794
    verifying ifTrue:[^ self].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1795
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1796
    screen := Screen current.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1797
    start := screen pointerPosition.   
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1798
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1799
    distance := start dist:newPosition.
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1800
    distance = 0 ifTrue:[
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1801
        "/ already there
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1802
        screen setPointerPosition:newPosition. "/ do it anyway, in case of rounding errors
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1803
        ^ self
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1804
    ].
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1805
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1806
    moveTime := (distance / pixelsPerSecond) seconds.   "/ time to move
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1807
    stepDelayTime := self pointerAnimationDelay.        "/ update every 50ms
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1808
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1809
    numSteps := moveTime / stepDelayTime.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1810
    numSteps = 0 ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1811
        "/ already there
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  1812
        screen setPointerPosition:newPosition. "/ do it anyway, in case of rounding errors
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1813
        ^ self
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1814
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1815
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1816
    delta := (newPosition - start) / numSteps.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1817
    1 to:numSteps do:[:step |
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1818
        |p|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1819
        
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1820
        p := (start + (delta * step)) rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1821
"/ Transcript showCR:p.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1822
        screen setPointerPosition:p.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1823
        screen flush.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1824
        Delay waitFor:stepDelayTime.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1825
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1826
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1827
    "Created: / 23-07-2019 / 09:36:45 / Claus Gittinger"
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1828
!
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1829
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1830
where:where inComponent:aComponent
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1831
    where == #center ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1832
        ^ aComponent center
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1833
    ].
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1834
    where == #leftCenter ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1835
        ^ aComponent leftCenter + (5@0). 
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1836
    ].
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1837
    where == #rightCenter ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1838
        ^ aComponent rightCenter - (5@0). 
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1839
    ].
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1840
    where == #topLeft ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1841
        ^ aComponent topLeft + (5@5). 
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1842
    ].
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1843
    where == #topCenter ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1844
        ^ aComponent topCenter + (0@5). 
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1845
    ].
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1846
    where == #topRight ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1847
        ^ aComponent topRight - (5@5). 
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1848
    ].
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1849
    where == #bottomCenter ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1850
        ^ aComponent bottomCenter - (0 @ 5)
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1851
    ].
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1852
    where == #bottomLeft ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1853
        ^ aComponent bottomLeft + (5 @ -5)
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1854
    ].
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1855
    where == #bottomRight ifTrue:[
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1856
        ^ aComponent bottomLeft - (5 @ 5)
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1857
    ].
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  1858
    self error:'where is this'
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1859
! !
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1860
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1861
!ShowMeHowItWorks methodsFor:'running'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1862
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1863
do:specArray
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1864
    "must run as a separate process;
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1865
     otherwise - if started by the app itself -
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1866
     no events will be processed while running"
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1867
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  1868
    "/ StartLabel := nil.
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  1869
    "/ StartLabel := 'start'.
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  1870
    self do:specArray from:StartLabel
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1871
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1872
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1873
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1874
     ShowMeHowItWorks do:
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1875
        #(
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1876
            (show: 'blah blah')
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1877
            (moveTo: NameOfComponent)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1878
        )    
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1879
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1880
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1881
    "Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1882
    "Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1883
!
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1884
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1885
do:specArray from:startLabelOrNil withUI:withUIBoolean
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1886
    "must run as a separate process;
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1887
     otherwise - if started by the app itself -
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1888
     no events will be processed while running"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1889
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1890
    withUIBoolean ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1891
        ui := ShowMeHowItWorksRunner openOn:self.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1892
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1893
    self do:specArray from:startLabelOrNil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1894
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1895
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1896
     ShowMeHowItWorks 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1897
        do:#(
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1898
            (show: 'blah blah')
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1899
            (moveTo: NameOfComponent)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1900
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1901
        withUI:true
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1902
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1903
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1904
    "Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1905
    "Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1906
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1907
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1908
do:specArray withUI:withUIBoolean
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1909
    "must run as a separate process;
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1910
     otherwise - if started by the app itself -
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1911
     no events will be processed while running"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1912
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1913
    withUIBoolean ifTrue:[
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1914
        ui := ShowMeHowItWorksRunner openOn:self.
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1915
    ].
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1916
    self do:specArray from:nil
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1917
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1918
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1919
     ShowMeHowItWorks 
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1920
        do:#(
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1921
            (show: 'blah blah')
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1922
            (moveTo: NameOfComponent)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1923
        )
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1924
        withUI:true
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1925
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1926
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1927
    "Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1928
    "Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1929
!
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1930
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1931
doShowFile:aFilename
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1932
    "the file from which the show was loaded"
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1933
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1934
    |spec|
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1935
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1936
    theShowFile := aFilename.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1937
    aFilename readingFileWithEncoding:#utf8 do:[:s |
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1938
        spec := Array readFrom:s.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1939
    ].
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1940
    self do:spec.
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1941
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1942
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1943
!
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1944
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1945
prepare
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1946
    language isNil ifTrue:[
3795
0b36f57fd1c9 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1947
        self setLanguage:(Smalltalk language).
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1948
    ].
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1949
    translate := false.
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1950
    
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1951
    application isNil ifTrue:[
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1952
        application := WindowGroup activeMainApplication.
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1953
    ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1954
    closeApplicationWhenFinished := false.
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  1955
    defaultComponentWaitTime isNil ifTrue:[ defaultComponentWaitTime := 1 ].
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1956
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1957
    "Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1958
    "Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1959
!
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1960
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1961
verify:specArray
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1962
    "/ run in verifying mode
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1963
    verifying := true.
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1964
    [
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1965
        Error handle:[:ex |
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1966
            Transcript showCR:('Possible error (encountered while verifying):\.... %1' withCRs)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1967
                         with:ex description withCRs.
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
  1968
            Display ctrlDown ifTrue:[ex reject].
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1969
        ] do:[
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1970
            self show:' '. "/ to avoid an audible disturbance on OSX
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1971
            self doStream:(specArray readStream)
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1972
        ].
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1973
    ] ensure:[
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1974
        verifying := false.
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1975
    ].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1976
! !
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1977
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1978
!ShowMeHowItWorks methodsFor:'running - private'!
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1979
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1980
do:specArray from:startLabelOrNil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1981
    "must run as a separate process;
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1982
     otherwise - if started by the app itself -
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1983
     no events will be processed while running"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1984
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  1985
    |wasFlyByActive|
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1986
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  1987
    (wasFlyByActive := FlyByHelp isSuspended) ifFalse:[
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  1988
        FlyByHelp suspend.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1989
    ].
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  1990
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1991
    self prepare.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1992
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1993
    "/ run once in verifying mode
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1994
    [
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1995
        self verify:specArray.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1996
    ] ensure:[
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  1997
        wasFlyByActive ifTrue:[FlyByHelp resume].
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1998
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1999
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2000
    [
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  2001
        FlyByHelp suspend.
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  2002
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2003
        [
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2004
            Error handle:[:ex |
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2005
                Dialog warn:(self class classResources 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2006
                                    stringWithCRs:'An error was encountered in the show:\\%1' 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2007
                                    with:ex description withCRs)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2008
            ] do:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2009
                self doStream:(specArray readStream) from:startLabelOrNil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2010
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2011
        ] ensure:[
3790
a28f8340a3eb #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
  2012
            wasFlyByActive ifTrue:[FlyByHelp resume].
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2013
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2014
    ] fork.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2015
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2016
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2017
     ShowMeHowItWorks do:
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2018
        #(
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2019
            (show: 'blah blah')
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2020
            (moveTo: NameOfComponent)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2021
        )    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2022
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2023
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2024
    "Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2025
    "Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2026
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2027
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2028
doCommand:op
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  2029
    "execute a single command"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  2030
    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2031
    |numArgs sel args method|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2032
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2033
    op isArray ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2034
        op first isArray ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2035
            self doStream:op readStream.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2036
            ^ self.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2037
        ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2038
        
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2039
        "/ construct a selector from keyword parts at odd indices
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2040
        sel := ((op with:(1 to:op size) select:[:el :idx | idx odd]) asStringWith:'') asSymbol.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2041
        "/ construct arg vector from parts at even indices
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2042
        args := op with:(1 to:op size) select:[:el :idx | idx even].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2043
    ] ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2044
        sel := op.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2045
        numArgs := sel argumentCount.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2046
        args := opStream next:numArgs.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2047
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2048
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2049
    (self respondsTo:sel) ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2050
        self error:'bad operation: ',sel
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2051
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2052
    method := self class lookupMethodFor:sel.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2053
    (method hasAnnotation:#action) ifFalse:[self halt].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2054
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2055
    lastResult := self perform:sel withArguments:args.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2056
    ^ lastResult
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2057
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2058
"<<END
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2059
     ShowMeHowItWorks do:#(
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2060
        showing: 'Choose the number of arguments'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2061
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2062
            moveTo: NumberOfArguments
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2063
            select: '1'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2064
        )    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2065
        showing: 'Click into the "receiver" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2066
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2067
            moveTo: ReceiverEditor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2068
            click: ReceiverEditor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2069
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2070
        showing: 'Enter a value (or expression) into "receiver" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2071
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2072
            enter: '100'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2073
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2074
        showing: 'Click into the "first argument" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2075
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2076
            moveTo: Arg1Editor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2077
            click: ReceiverEditor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2078
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2079
        showing: 'Enter a value (or expression) into "receiver" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2080
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2081
            enter: '100'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2082
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2083
     )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2084
END"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2085
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2086
    "Created: / 19-07-2019 / 15:34:55 / Claus Gittinger"
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  2087
    "Modified: / 23-07-2019 / 09:14:26 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2088
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2089
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2090
doStream:specStream
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2091
    self doStream:specStream from:nil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2092
    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2093
"<<END
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2094
     ShowMeHowItWorks do:#(
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2095
        showing: 'Choose the number of arguments'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2096
        do: (
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2097
            moveTo: NumberOfArguments
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2098
            select: '1'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2099
        )    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2100
        showing: 'Click into the "receiver" field'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2101
        do: (
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2102
            moveTo: ReceiverEditor
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2103
            click: ReceiverEditor
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2104
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2105
        showing: 'Enter a value (or expression) into "receiver" field'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2106
        do: (
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2107
            enter: '100'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2108
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2109
        showing: 'Click into the "first argument" field'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2110
        do: (
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2111
            moveTo: Arg1Editor
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2112
            click: ReceiverEditor
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2113
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2114
        showing: 'Enter a value (or expression) into "receiver" field'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2115
        do: (
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2116
            enter: '100'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2117
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2118
     )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2119
END"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2120
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2121
    "Created: / 19-07-2019 / 10:52:24 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2122
    "Modified: / 23-07-2019 / 11:48:45 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2123
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2124
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2125
doStream:specStream from:startLabelOrNil
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  2126
    |previousStream resources|
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2127
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  2128
    resources := self class classResources.
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2129
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2130
    streamStack isNil ifTrue:[ streamStack := OrderedCollection new ].
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2131
    streamStack add:opStream.
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2132
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2133
    previousStream := opStream.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2134
    [
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2135
        |nextCommand|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2136
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2137
        opStream := specStream.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2138
        startLabelOrNil notNil ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2139
            |found|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2140
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2141
            "/ skip for that label
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2142
            found := false.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2143
            [ found ] whileFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2144
                |cmd|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2145
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2146
                cmd := opStream nextOrNil.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2147
                cmd isNil ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2148
                    self proceedableError:'label not found: ',startLabelOrNil.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2149
                    ^ self.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2150
                ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2151
                (cmd = 'label:') ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2152
                    found := (opStream next = startLabelOrNil)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2153
                ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2154
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2155
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2156
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2157
        [opStream atEnd] whileFalse:[
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2158
            nextCommand := opStream next.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2159
            self doCommand:nextCommand.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  2160
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2161
            Display shiftDown ifTrue:[
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  2162
                (IntroShownCount ? 0) > 3 ifFalse:[
3738
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2163
                    self tell:(self possiblyTranslate:'You pressed the SHIFT key.').
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  2164
                ].    
3738
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2165
                self tell:(self possiblyTranslate:'Do you want to stop the show?').
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  2166
                (Dialog confirm:(resources stringWithCRs:'Stop the demonstration?'))
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
  2167
                ifTrue:[
3738
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2168
                    self tell:(self possiblyTranslate:'OK,').
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2169
                    self tell:(self possiblyTranslate:(self randomThankYou)).
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
  2170
                    ^ AbortOperationRequest raise
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
  2171
                ].    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2172
            ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2173
        ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2174
    ] ensure:[
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2175
        streamStack removeLast.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2176
        opStream := previousStream
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2177
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2178
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2179
"<<END
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2180
     ShowMeHowItWorks do:#(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2181
        showing: 'Choose the number of arguments'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2182
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2183
            moveTo: NumberOfArguments
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2184
            select: '1'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2185
        )    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2186
        showing: 'Click into the "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2187
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2188
            moveTo: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2189
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2190
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2191
        showing: 'Enter a value (or expression) into "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2192
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2193
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2194
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2195
        showing: 'Click into the "first argument" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2196
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2197
            moveTo: Arg1Editor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2198
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2199
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2200
        showing: 'Enter a value (or expression) into "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2201
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2202
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2203
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2204
     )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2205
END"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2206
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2207
    "Created: / 19-07-2019 / 10:52:24 / Claus Gittinger"
3738
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2208
    "Modified: / 23-07-2019 / 11:48:45 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2209
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2210
3738
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2211
possiblyTranslate:aString
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2212
    translate ifTrue:[^ self class classResources string:aString].
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2213
    ^ aString
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2214
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2215
    "Created: / 23-07-2019 / 11:48:17 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2216
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2217
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2218
!ShowMeHowItWorks::ItemInView class methodsFor:'documentation'!
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2219
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2220
documentation
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2221
"
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2222
    documentation to be added.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2223
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2224
    class:
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2225
        <a short class summary here, describing what instances represent>
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2226
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2227
    responsibilities:    
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2228
        <describing what my main role is>
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2229
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2230
    collaborators:    
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2231
        <describing with whom and how I talk to>
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2232
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2233
    API:
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2234
        <public api and main messages>
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2235
        
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2236
    example:
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2237
        <a one-line examples on how to use - can also be in a separate example method>
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2238
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2239
    implementation:
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2240
        <implementation points>
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2241
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2242
    [author:]
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2243
        exept MBP
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2244
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2245
    [instance variables:]
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2246
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2247
    [class variables:]
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2248
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2249
    [see also:]
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2250
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2251
"
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2252
! !
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2253
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2254
!ShowMeHowItWorks::ItemInView methodsFor:'accessing'!
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2255
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2256
boundsInView
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2257
    ^ boundsInView
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2258
!
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2259
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2260
item
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2261
    ^ item
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2262
!
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2263
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2264
layout
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2265
    ^ item layout
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2266
!
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2267
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2268
view
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2269
    ^ view
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2270
!
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2271
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2272
view:viewArg item:itemArg boundsInView:boundsInViewArg 
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2273
    view := viewArg.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2274
    item := itemArg.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2275
    boundsInView := boundsInViewArg.
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2276
! !
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2277
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2278
!ShowMeHowItWorks::ItemInView methodsFor:'testing'!
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2279
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  2280
isItemInView
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  2281
    ^ true
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  2282
!
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  2283
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2284
isMenuItem
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2285
    ^ item askFor:#isMenuItem
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2286
!
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2287
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2288
isNoteBookTab
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2289
    ^ item isKindOf:NoteBookView::Tab
3798
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  2290
!
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  2291
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  2292
isVisible
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  2293
    ^ view shown
eafc4c1bb53e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3797
diff changeset
  2294
    and:[item isVisible]
3796
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2295
! !
4ed3796c2d60 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2296
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2297
!ShowMeHowItWorks class methodsFor:'documentation'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2298
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2299
version_CVS
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2300
    ^ '$Header$'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2301
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2302