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