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