ShowMeHowItWorks.st
author Claus Gittinger <cg@exept.de>
Mon, 14 Oct 2019 20:55:04 +0200
changeset 3787 7b01435dcf25
parent 3784 f6654cc10071
child 3790 a28f8340a3eb
permissions -rw-r--r--
#FEATURE by exept class: ShowMeHowItWorks added: #do:from: #do:from:withUI: #doStream:from: #drag:toComponent:dropAt: #expand: #findComponent:ifMultiple: #findComponent:inAllApplications:ifMultiple: #label: #movePointerToComponent:rightBottomOffset: #movePointerToComponent:rightOffset: removed: #nextCommand comment/format in: #do: #findComponent: #waitFor:timeout: changed: #do:withUI: #doCommand: #doStream: #press: #release: #select: #selectIndex:in: class: ShowMeHowItWorks class added: #do:from:withUI:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
     1
"{ Encoding: utf8 }"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
     2
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ Package: 'stx:libtool2' }"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
"{ NameSpace: Smalltalk }"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
Object subclass:#ShowMeHowItWorks
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
     8
	instanceVariableNames:'application opStream streamStack lastComponentName lastComponent
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
     9
		lastResult voice translate language verifying
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
    10
		closeApplicationWhenFinished defaultComponentWaitTime ui'
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
    11
	classVariableNames:'IntroShownCount DebugMode'
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
	poolDictionaries:''
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
	category:'Interface-Help'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
!ShowMeHowItWorks class methodsFor:'documentation'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
documentation
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
"
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    20
    automatic presentations.
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    21
    To see how it works, open a methodFinder:
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    22
        MethodFinderWindow open
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    23
    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
    24
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
    [author:]
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
        Claus Gittinger
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
example
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    31
    MethodFinderWindow open.
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    32
    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
    ShowMeHowItWorks do:#(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
        ( showing: 'Choose the number of arguments' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
            moveTo: NumberOfArguments
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
            select: '1' 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
        ))  
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
        (showing: 'Click into the "receiver" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
            moveTo: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
            click: ReceiverEditor 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
        (showing: 'Enter a value (or expression) into "receiver" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
        (showing: 'Click into the "first argument" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
            moveTo: Arg1Editor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
        (showing: 'Enter a value (or expression) into "receiver" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
!ShowMeHowItWorks class methodsFor:'running'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    58
application:anApplicationOrNilForAll do:specArray 
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    59
    "spec contains a list of action commands (show: / moveTo: etc.)"
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    60
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    61
    self new 
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    62
        application:anApplicationOrNilForAll;
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    63
        do:specArray 
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    64
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    65
    "
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    66
     ShowMeHowItWorks do:
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    67
        #(
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    68
            (language: de)
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    69
            (show: 'üben üben üben')
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    70
            (wait: 0.5)
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    71
            (moveTo: NameOfComponent)
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    72
        )    
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    73
    "
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    74
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    75
    "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    76
    "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    77
!
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
    78
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
do:specArray
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
    80
    "spec contains a list of action commands (show: / moveTo: etc.)"
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
    81
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
    82
    self do:specArray withUI:false
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
    84
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
    85
     ShowMeHowItWorks do:
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
    86
        #(
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
    87
            (language: de)
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
    88
            (show: 'üben üben üben')
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
    89
            (wait: 0.5)
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
    90
            (moveTo: NameOfComponent)
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
    91
        )    
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
    92
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
    93
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
    94
    "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
    95
    "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
    96
!
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
    97
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
    98
do:specArray from:startLabelOrNil withUI:withUIBoolean
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
    99
    "spec contains a list of action commands (show: / moveTo: etc.)"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   100
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   101
    self new 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   102
        do:specArray 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   103
        from:startLabelOrNil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   104
        withUI:withUIBoolean
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   105
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   106
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   107
     ShowMeHowItWorks 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   108
        do:#(
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   109
            (language: de)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   110
            (show: 'üben üben üben')
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   111
            (wait: 0.5)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   112
            (moveTo: NameOfComponent)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   113
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   114
        withUI:true
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   115
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   116
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   117
    "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   118
    "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   119
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   120
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   121
do:specArray withUI:withUIBoolean
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   122
    "spec contains a list of action commands (show: / moveTo: etc.)"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   123
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   124
    self new do:specArray withUI:withUIBoolean
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   125
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   126
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   127
     ShowMeHowItWorks 
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   128
        do:#(
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   129
            (language: de)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   130
            (show: 'üben üben üben')
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   131
            (wait: 0.5)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   132
            (moveTo: NameOfComponent)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   133
        )
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   134
        withUI:true
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   135
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   136
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   137
    "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   138
    "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   139
! !
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   140
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   141
!ShowMeHowItWorks methodsFor:'accessing'!
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   142
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   143
application:anApplication
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   144
    "if set, only that application is presented (widget search is limtied to that one)"
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   145
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   146
    application := anApplication.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
!ShowMeHowItWorks methodsFor:'commands'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   151
intro
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   152
    <action>
3724
e513514f6ce7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
   153
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   154
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   155
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   156
    IntroShownCount := (IntroShownCount ? 0).
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   157
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   158
    "/ only say this a few times..
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   159
    IntroShownCount > 3 ifTrue:[^ self].
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   160
    IntroShownCount := IntroShownCount + 1.
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   161
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   162
    self language:(Smalltalk language).    
3724
e513514f6ce7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
   163
    self tell:(self class classResources 
3733
1da1137b6f23 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
   164
                string:'You can stop this show, by pressing the SHIFT key').
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   165
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   166
    "Created: / 19-07-2019 / 15:49:19 / Claus Gittinger"
3733
1da1137b6f23 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
   167
    "Modified: / 23-07-2019 / 11:06:13 / Claus Gittinger"
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   168
!
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   169
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   170
label:nameOfLabel
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   171
    <action>
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   172
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   173
    "/ skipped here; see goto
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   174
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   175
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   176
language:lang
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   177
    <action>
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   178
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   179
    voice := OperatingSystem bestVoiceForLanguage:lang.
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   180
    translate := false.
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   181
    language := lang.
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   182
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   183
    "Created: / 23-07-2019 / 10:27:02 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   184
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   185
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   186
open:applicationClassName
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   187
    <action>
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   188
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   189
    |appClass|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   190
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   191
    (appClass := Smalltalk classNamed:applicationClassName) isNil ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   192
        self error:'no such application class'
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   193
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   194
    verifying ifFalse:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   195
        application := appClass new openAndWaitUntilVisible.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   196
        closeApplicationWhenFinished := true.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   197
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   198
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   199
    "Created: / 19-07-2019 / 15:09:45 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   200
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   201
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
pause
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
    
3724
e513514f6ce7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
   205
    Dialog information:(self class classResources 
e513514f6ce7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3717
diff changeset
   206
                            stringWithCRs:'Show Paused.\Click on "OK" to proceed')
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
    "Created: / 19-07-2019 / 15:03:17 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   209
    "Modified: / 19-07-2019 / 16:13:33 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   212
raise:what
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   213
    <action>
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   214
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   215
    verifying ifTrue:[^ self].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   216
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   217
    what == #application ifTrue:[
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   218
        application topView raise.
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   219
        ^ self
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   220
    ].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   221
    what == #masterApplication ifTrue:[
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   222
        application windowGroup isModal ifTrue:[
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   223
            application windowGroup mainGroup topViews first raise
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   224
        ] ifFalse:[
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   225
            (application masterApplication ? application) topViews first raise.
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   226
        ].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   227
        ^ self
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   228
    ].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   229
    self halt.
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   230
!
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   231
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   232
show:message
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   233
    "showing (and speak) some message."
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   234
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   235
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   236
    
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   237
    self showing:message saying:nil do:nil
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   238
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   239
    "Created: / 19-07-2019 / 15:59:18 / Claus Gittinger"
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   240
    "Modified (comment): / 19-07-2019 / 18:54:36 / Claus Gittinger"
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   241
!
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   242
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   243
show:message for:seconds
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   244
    "showing (and speak) some message and wait for some time."
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   245
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   246
    <action>
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   247
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   248
    DebugMode == true ifTrue:[^ self].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   249
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   250
    self show:message.
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   251
    self wait:seconds.
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   252
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   253
    "Created: / 19-07-2019 / 18:54:20 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   254
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   255
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   256
show:message saying:sentenceOrNil
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   257
    "showing (and speak) some message."
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   258
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   259
    <action>
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   260
    
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   261
    self showing:message saying:sentenceOrNil do:nil
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   262
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   263
    "Created: / 19-07-2019 / 15:59:18 / Claus Gittinger"
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   264
    "Modified (comment): / 19-07-2019 / 18:54:36 / Claus Gittinger"
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   265
!
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   266
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   267
show:message saying:sentenceOrNil for:seconds
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   268
    "showing (and speak) some message and wait for some time."
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   269
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   270
    <action>
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   271
    
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   272
    DebugMode == true ifTrue:[^ self].
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   273
    self show:message saying:sentenceOrNil.
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   274
    self wait:seconds.
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   275
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   276
    "Created: / 19-07-2019 / 18:54:20 / Claus Gittinger"
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   277
!
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   278
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   279
showing:message do:operationsOrNothing
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   280
    "execute operationsOrNothing while showing (and speaking) some message."
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
    
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   284
    self showing:message saying:nil do:operationsOrNothing
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   285
!
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   286
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   287
showing:message saying:sentenceOrNil do:operationsOrNothing
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   288
    "execute operationsOrNothing while showing (and speaking) some message."
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   289
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   290
    <action>
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   291
    
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   292
    |xLatedMessage messageView talkDone|
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   294
    xLatedMessage := (translate and:[application notNil]) 
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   295
                            ifTrue:[application resources string:message]
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   296
                            ifFalse:[message].
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   297
    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   298
    self assert:(operationsOrNothing isNil or:[operationsOrNothing isSequenceable]).
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   300
    messageView := ActiveHelpView for:xLatedMessage.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
    "/ messageView shapeStyle:#cartoon.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
    [
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   303
        messageView origin:(Screen current pointerPosition + (0 @ 20)).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   304
        messageView makeFullyVisible.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
        messageView realize.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
        self talking ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
            talkDone := Semaphore new.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
            [
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   310
                self tell:(sentenceOrNil ? xLatedMessage).
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
                talkDone signal
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
            ] fork.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
            
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
            "/
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
            "/ allow speaker some headoff
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   316
            verifying ifFalse:[
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   317
                Delay waitForSeconds:(xLatedMessage size / 15)+0.5.
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   318
            ].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
        ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   321
        operationsOrNothing notEmptyOrNil ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   322
            self doStream:(operationsOrNothing readStream).
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   323
        ].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
    ] ensure:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
        messageView destroy
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
    self talking ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
        talkDone wait.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
    "Created: / 19-07-2019 / 11:19:27 / Claus Gittinger"
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   332
    "Modified: / 23-07-2019 / 10:52:30 / Claus Gittinger"
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   333
!
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   334
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   335
thankyou
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   336
    <action>
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   337
    
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   338
    self show:(self randomThankYou).
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   339
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   340
    "Created: / 23-07-2019 / 10:50:43 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
wait:seconds
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
    
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   346
    verifying ifTrue:[^ self].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   347
    DebugMode == true ifTrue:[^ self].
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   348
    Display ctrlDown ifTrue:[^ self].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   349
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
    Delay waitForSeconds:seconds
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
    "Created: / 19-07-2019 / 15:09:45 / Claus Gittinger"
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   353
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   354
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   355
waitFor:componentName timeout:seconds
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   356
    <action>
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   357
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   358
    |endTime|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   359
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
   360
    verifying ifTrue:[^ self].
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
   361
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   362
    endTime := Timestamp now + seconds.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   363
    [   
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   364
        (self findComponent:componentName inAllApplications:true ifMultiple:nil) notNil ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   365
            ^ self
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   366
        ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   367
        Delay waitForSeconds:0.05.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   368
        Timestamp now > endTime ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   369
            self error:('component %1 not present after %2' bindWith:componentName with:seconds)
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   370
        ]
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   371
    ] loop
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   374
!ShowMeHowItWorks methodsFor:'commands - checking'!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   375
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   376
isEmpty:componentName
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   377
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   378
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   379
    |component|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   380
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   381
    component := self componentNamed:componentName.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   382
    component isScrollWrapper ifTrue:[ component := component scrolledView ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   383
    component isTextView ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   384
        ^ component contents isEmptyOrNil
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   385
    ] ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   386
        self halt.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   387
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   388
    self error:'isEmpty: unhandled component type: ',component displayString.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   389
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   390
    "Created: / 19-07-2019 / 15:33:47 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   391
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   392
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   393
unless:query do:actions
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   394
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   395
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   396
    |result|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   397
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   398
    result := self doCommand:query.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   399
    result ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   400
        self doCommand:actions
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   401
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   402
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   403
    "Created: / 19-07-2019 / 15:33:32 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   404
! !
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   405
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   406
!ShowMeHowItWorks methodsFor:'commands - mouse & keyboard'!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   407
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   408
click
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   409
    "press-release"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   410
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   411
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   412
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   413
    ^ self click:1 inComponent:lastComponent
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   414
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   415
    "Created: / 19-07-2019 / 16:11:03 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   416
!
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
click:buttonNr
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
    "press-release"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   423
    self assert:(buttonNr isInteger).
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   424
    ^ self click:buttonNr inComponent:lastComponent
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
    "Created: / 19-07-2019 / 13:21:20 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   427
    "Modified: / 19-07-2019 / 16:10:19 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   430
clickIn:componentName
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   431
    "press-release"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   432
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   433
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   434
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   435
    ^ self click:1 inComponent:(self componentNamed:componentName)
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   436
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   437
    "Created: / 19-07-2019 / 16:09:58 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   438
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   439
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   440
drag:itemsIndexOrLabelOrPattern toComponent:targetComponentName dropAt:where
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   441
    "drag an item (by index or label) from the current treeView,
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   442
     into another component.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   443
     where is one of: #top, #center or #bottom.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   444
     allowed after moving to:
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   445
        aSelectionInHierarchyView
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   446
    "    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   447
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   448
    <action>
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   449
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   450
    |sourceComponent targetComponent idx yPos sourcePos sourcePosOnScreen
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   451
     targetPos targetPosOnScreen targetPosInSource|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   452
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   453
    self assert:( #(top center bottom) includes:where).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   454
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   455
    verifying ifTrue:[^ self].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   456
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   457
    targetComponent := self findComponent:targetComponentName.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   458
    self assert:targetComponent notNil.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   459
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   460
    ((sourceComponent := lastComponent) isKindOf:ScrollableView) ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   461
        sourceComponent := sourceComponent scrolledView.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   462
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   463
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   464
    (sourceComponent isKindOf:HierarchicalListView) ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   465
        where == #top ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   466
            targetPos := targetComponent topCenter. 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   467
        ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   468
            where == #center ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   469
                targetPos := targetComponent center
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   470
            ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   471
                where == #bottom ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   472
                    targetPos := targetComponent bottomCenter - (0 @ 1)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   473
                ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   474
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   475
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   476
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   477
        itemsIndexOrLabelOrPattern isInteger ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   478
            idx := itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   479
        ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   480
            itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   481
                idx := sourceComponent indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   482
            ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   483
                idx := sourceComponent indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   484
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   485
            idx == 0 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   486
                self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   487
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   488
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   489
        yPos := sourceComponent yVisibleOfLine:idx.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   490
        self movePointerToComponent:sourceComponent rightOffset:(10 @ (yPos + 3)).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   491
        Delay waitForSeconds:0.5.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   492
        sourcePosOnScreen := Display pointerPosition.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   493
        sourcePos := Display translatePoint:sourcePosOnScreen from:nil to:sourceComponent.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   494
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   495
        targetPosOnScreen := Display translatePoint:targetPos from:targetComponent to:nil.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   496
        targetPosInSource := Display translatePoint:targetPosOnScreen from:nil to:sourceComponent.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   497
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   498
        sourceComponent simulateButtonPress:1 at:sourcePos sendDisplayEvent:true.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   499
        Delay waitForSeconds:0.5.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   500
        self movePointerToComponent:targetComponent offset:targetPos.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   501
        sourceComponent simulateButtonMotion:1 to:targetPosInSource sendDisplayEvent:false.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   502
        sourceComponent simulateButtonRelease:1 at:targetPosInSource sendDisplayEvent:false.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   503
self halt.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   504
        sourceComponent simulateButtonMotion:1 to:targetPosInSource sendDisplayEvent:false.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   505
        Delay waitForSeconds:0.5.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   506
        sourceComponent simulateButtonRelease:1 at:targetPosInSource sendDisplayEvent:true.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   507
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   508
"/        self movePointerToComponent:targetComponent offset:targetPos.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   509
"/        Delay waitForSeconds:2.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   510
"/        self press:1.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   511
"/        Delay waitForSeconds:2.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   512
"/        self release:1.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   513
"/        Delay waitForSeconds:0.5.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   514
        self halt.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   515
        ^ self
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   516
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   517
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   518
    self error:'cannot expand in this component'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   519
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   520
    "Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   521
    "Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   522
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   523
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   524
expand:itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   525
    "expand an item in a treeView by label,
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   526
     allowed after moving to:
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   527
        aSelectionInHierarchyView
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   528
    "    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   529
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   530
    <action>
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   531
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   532
    |component|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   533
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   534
    verifying ifTrue:[^ self].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   535
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   536
    ((component := lastComponent) isKindOf:ScrollableView) ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   537
        component := component scrolledView.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   538
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   539
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   540
    (component isKindOf:HierarchicalListView) ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   541
        |idx yPos|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   542
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   543
        itemsIndexOrLabelOrPattern isInteger ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   544
            idx := itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   545
        ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   546
            itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   547
                idx := component indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   548
            ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   549
                idx := component indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   550
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   551
            idx == 0 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   552
                self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   553
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   554
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   555
        yPos := component yVisibleOfLine:idx.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   556
        self movePointerToComponent:component offset:(0 @ (yPos + 3)).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   557
        Delay waitForSeconds:0.5.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   558
        (component listAt:idx) expand.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   559
        ^ self
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   560
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   561
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   562
    self error:'cannot expand in this component'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   563
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   564
    "Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   565
    "Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   566
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   567
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   568
fastMoveTo:componentName
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   569
    "move the mouse to componentName without circling"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   573
    |component|
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   575
    component := self componentNamed:componentName.
3717
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
   576
    self movePointerToComponent:component speed:(self pointerMoveSpeedFast).
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   577
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   578
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   579
     ShowMeHowItWorks basicNew fastMoveTo:'Classes'
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   580
     ShowMeHowItWorks basicNew fastMoveTo:'Klassen'
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   581
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   582
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   583
    "Created: / 19-07-2019 / 15:39:23 / Claus Gittinger"
3717
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
   584
    "Modified: / 20-07-2019 / 08:14:16 / Claus Gittinger"
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   585
    "Modified (comment): / 23-07-2019 / 09:33:31 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   586
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
moveTo:componentName
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
    "move the mouse to componentName,
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
     then circle around it a few times"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   594
    |component|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   596
    component := self componentNamed:componentName.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   597
    self movePointerToComponent:component.
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   598
    Display ctrlDown ifTrue:[^ self].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
    self circlePointerAroundComponent:component.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
    "Created: / 19-07-2019 / 11:20:42 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   602
    "Modified: / 19-07-2019 / 15:38:11 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   605
select:itemsIndexOrLabelOrPattern
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
    "select an item by label,
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
     allowed after moving to:
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   608
        aComboBox
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
        aSelectionInListView
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
    "    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   614
    |idx component|
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   615
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   616
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   617
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   618
    ((component := lastComponent) isKindOf:ScrollableView) ifTrue:[
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   619
        component := component scrolledView.
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   620
    ].
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   621
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   622
    (component isKindOf:ComboView) ifTrue:[
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
        "/ click on the menubutton
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   624
        self movePointerToComponent:component menuButton.
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   625
        self click:1 inComponent:component menuButton.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
        Delay waitForSeconds:0.3.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   627
        itemsIndexOrLabelOrPattern isInteger ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   628
            idx := itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   629
        ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   630
            itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   631
                idx := component list findFirst:[:lbl | itemsIndexOrLabelOrPattern match:lbl]
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   632
            ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   633
                idx := component list indexOf:itemsIndexOrLabelOrPattern.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   634
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   635
            idx == 0 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   636
                self error:'no such item in comboList: ',itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   637
            ].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
        ].
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   639
        component select:idx.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
        Delay waitForSeconds:0.3.
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   641
        component shownMenu notNil ifTrue:[
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   642
            component shownMenu hide.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
        ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
        ^ self
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
    ].    
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   646
    (component isKindOf:HierarchicalListView) ifTrue:[
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   647
        |idx yPos|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   648
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   649
        itemsIndexOrLabelOrPattern isInteger ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   650
            idx := itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   651
        ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   652
            itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   653
                idx := component indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   654
            ] ifFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   655
                idx := component indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   656
            ].
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   657
            idx == 0 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   658
                self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   659
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   660
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   661
        yPos := component yVisibleOfLine:idx.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   662
        self movePointerToComponent:component offset:(0 @ (yPos + 3)).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   663
        component simulateButtonPress:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   664
        Delay waitForSeconds:0.1.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   665
        component simulateButtonRelease:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   666
        "/ component selection:idx.
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   667
        ^ self
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   668
    ].
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
   669
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
    self error:'cannot select this component'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
    "Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
    "Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
selectIndex:itemsIndex
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
    "select an item by index,
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
     allowed after moving to:
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
        aComboBox
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
        aSelectionInListView
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
    "    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   685
    self selectIndex:itemsIndex in:lastComponent
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   686
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   687
    "Created: / 19-07-2019 / 14:20:11 / Claus Gittinger"
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   688
    "Modified: / 19-07-2019 / 21:59:36 / Claus Gittinger"
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   689
!
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   690
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   691
selectIndex:itemsIndex in:widgetArg
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   692
    "select an item by index,
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   693
     allowed after moving to:
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   694
        aComboBox
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   695
        aSelectionInListView
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   696
    "    
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   697
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   698
    <action>
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   699
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   700
    |widget y offset possibleWidgets|
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   701
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   702
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   703
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   704
    (widget := widgetArg) isScrollWrapper ifTrue:[
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   705
        widget := widget scrolledView
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   706
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   707
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   708
    (widget isKindOf:ComboView) ifTrue:[
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   709
        "/ click on the menubutton
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   710
        self movePointerToComponent:widget menuButton.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   711
        self click:1 inComponent:widget menuButton.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   712
        Delay waitForSeconds:0.5.
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   713
        widget select:itemsIndex.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   714
        Delay waitForSeconds:0.5.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   715
        ^ self
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
    ].    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   717
    (widget isKindOf:SelectionInListView) ifTrue:[
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   718
        (widget isLineVisible:itemsIndex) ifFalse:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   719
            widget scrollToLine:itemsIndex
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   720
        ].    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   721
        "/ click on the item
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   722
        y := widget yOfLine:itemsIndex.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   723
        offset := (widget width // 2) @ y.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   724
        self movePointerToComponent:widget offset:offset.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   725
        widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   726
        Delay waitForSeconds:(self clickTime).
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   727
        widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   728
        Delay waitForSeconds:0.5.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   729
        ^ self
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   730
    ].
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   731
    (widget isKindOf:SelectionInListModelView) ifTrue:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   732
        (widget isLineVisible:itemsIndex) ifFalse:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   733
            widget scrollToLine:itemsIndex
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   734
        ].    
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   735
        y := widget yVisibleOfLine:itemsIndex.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   736
        offset := (widget width // 2) @ y.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   737
        self movePointerToComponent:widget offset:offset.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   738
        widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   739
        Delay waitForSeconds:(self clickTime).
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   740
        widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   741
        Delay waitForSeconds:0.5.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   742
        ^ self
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   743
    ].
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   744
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   745
    "/ none of it - see what is in there
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   746
    possibleWidgets := OrderedCollection new.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   747
    widget allSubViewsDo:[:each |
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   748
        ((each isKindOf:ComboView) 
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   749
          or:[(each isKindOf:SelectionInListView)
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   750
          or:[(each isKindOf:SelectionInListModelView)
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   751
        ]]) ifTrue:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   752
            possibleWidgets add:each
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   753
        ]
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   754
    ].
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   755
    possibleWidgets size == 1 ifTrue:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   756
        self selectIndex:itemsIndex in:(possibleWidgets first).
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   757
        ^ self
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   758
    ].    
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   759
    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   760
    self error:'cannot select this component'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   762
    "Created: / 19-07-2019 / 21:59:15 / Claus Gittinger"
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   763
    "Modified: / 20-07-2019 / 07:57:41 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   764
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   765
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   766
type:aString
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   767
    "enter text into the last component"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   768
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   769
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   770
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   771
    |t|
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   772
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   773
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   774
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   775
    t := Display ctrlDown ifTrue:[0.05] ifFalse:[0.1].
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   776
    lastComponent 
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   777
        simulateTextInput:aString at:(lastComponent extent // 2) 
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   778
        sendDisplayEvent:false keyPressTime:t
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   779
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   780
    "Created: / 19-07-2019 / 15:50:40 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   783
!ShowMeHowItWorks methodsFor:'defaults'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   785
circlingCount
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
    "circle around move-end position that many times"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   788
    ^ 3
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   789
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   790
    "Created: / 19-07-2019 / 13:03:45 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   792
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
circlingRadius 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
    "radius when circling"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   796
    ^ 30 "/ pixels
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   797
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   798
    "Created: / 19-07-2019 / 13:07:59 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   799
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   800
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
circlingSpeed 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
    "time per round when circling"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
    ^ 0.3 seconds.       "/ time per round
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
    "Created: / 19-07-2019 / 13:02:34 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
clickTime
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
    "when clicking"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   812
    ^ self shortClickTime
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
    "Created: / 19-07-2019 / 13:17:20 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   815
    "Modified: / 19-07-2019 / 15:21:51 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   816
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   817
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   818
longClickTime
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   819
    "when clicking buttons"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   820
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   821
    ^ 500 milliseconds
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   822
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   823
    "Created: / 19-07-2019 / 15:21:42 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
pointerAnimationDelay
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
    ^ 50 milliseconds.   "/ 20 updates per second
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
    "Created: / 19-07-2019 / 13:04:45 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   830
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   831
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
pointerMoveSpeed
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
    ^ 400.   "/ pixels per second
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
    "Created: / 19-07-2019 / 13:05:40 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
3717
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
   838
pointerMoveSpeedFast
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
   839
    ^ 600.   "/ pixels per second
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
   840
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
   841
    "Created: / 20-07-2019 / 08:13:58 / Claus Gittinger"
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
   842
!
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
   843
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   844
shortClickTime
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   845
    "when clicking"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   846
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   847
    ^ 100 milliseconds
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   848
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   849
    "Created: / 19-07-2019 / 15:21:29 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   850
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   851
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
talking
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   853
    "/ DebugMode := true
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   854
    verifying ifTrue:[^ false].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   855
    DebugMode == true ifTrue:[^ false].
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   856
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   857
    "/ ^ Expecco::ExpeccoPreferences current speechEffectsEnabled
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
    ^ true
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
    "Created: / 19-07-2019 / 14:31:14 / Claus Gittinger"
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   861
    "Modified (comment): / 23-07-2019 / 09:45:35 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
!ShowMeHowItWorks methodsFor:'helper'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   866
randomThankYou
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   867
    ^ #(
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   868
        'thank you, for watching'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   869
        'thank you for watching'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   870
        'thank you'
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   871
        'thanks'
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   872
        'have a good day'
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   873
        'have a nice day'
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   874
        'have fun'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   875
        'have fun with expecco'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   876
        '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
   877
        'happy hacking'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   878
        'happy hacking, I hope you liked what you saw'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   879
        'hope you liked it'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   880
        'see you again'
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   881
        'be the source with you'
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   882
        'be the force with you'
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   883
        'may the force be with you'
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   884
        'may the source be with you'
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   885
        '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
   886
        'if you have any questions, please contact exept'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   887
        '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
   888
    ) atRandom
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   889
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   890
    "
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   891
     OperatingSystem speak:'may the source be with you'
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   892
     OperatingSystem speak:'have fun with expecco'
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   893
     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
   894
     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
   895
     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
   896
     OperatingSystem speak:'if you have any questions, please contact exept'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   897
     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
   898
    "
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   899
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   900
    "Created: / 19-07-2019 / 21:39:18 / Claus Gittinger"
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   901
!
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   902
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
tell:message
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
    self talking ifTrue:[
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   905
        OperatingSystem speak:message voiceName:voice.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   907
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
    "Created: / 19-07-2019 / 14:57:50 / Claus Gittinger"
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
   909
    "Modified: / 23-07-2019 / 10:28:02 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   910
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   912
!ShowMeHowItWorks methodsFor:'helpers - broken'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   913
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   914
click:buttonNr atPosition:position
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   915
    "press-release at position"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   916
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   917
    |screen|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   918
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   919
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
   920
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   921
    screen := Screen current.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   922
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   923
    screen setPointerPosition:position.    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   924
    screen flush.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   925
    self click:buttonNr
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   926
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   927
    "Created: / 19-07-2019 / 13:14:51 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   928
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   929
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   930
!ShowMeHowItWorks methodsFor:'helpers - component search'!
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   931
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   932
componentNamed:componentName
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   933
    "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
   934
     Can return either a view or a menu item"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   935
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   936
    |component|
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   937
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   938
    lastComponentName := componentName.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   939
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   940
    component := self findComponent:componentName.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   941
    component isNil ifTrue:[
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   942
        self error:'no component found for: ',componentName mayProceed:verifying.
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   943
        ^ nil
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   944
    ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   945
    lastComponent := component.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   946
    ^ component
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   947
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   948
    "Created: / 19-07-2019 / 15:37:35 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   949
    "Modified (comment): / 23-07-2019 / 09:31:53 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   950
!
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   951
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   952
findComponent:componentName
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   953
    "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
   954
     Can return either a view or a menu item"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   955
    
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   956
    ^ self 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   957
        findComponent:componentName
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   958
        inAllApplications:true
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   959
        ifMultiple:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   960
            self proceedableError:('multiple components found by name: ',componentName).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   961
            nil
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   962
        ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   963
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   964
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   965
     ShowMeHowItWorks basicNew findComponent:'Classes'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   966
     ShowMeHowItWorks basicNew findComponent:'Klassen'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   967
    "
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   968
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   969
    "Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   970
    "Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   971
    "Modified (comment): / 23-07-2019 / 09:32:44 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   972
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   973
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   974
findComponent:componentName ifMultiple:exceptionalValue
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   975
    "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
   976
     Can return either a view or a menu item"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   977
    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   978
    ^ self
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   979
        findComponent:componentName
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   980
        inAllApplications:true
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
   981
        ifMultiple:exceptionalValue
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   982
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   983
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   984
     ShowMeHowItWorks basicNew findComponent:'Classes'
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   985
     ShowMeHowItWorks basicNew findComponent:'Klassen'
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   986
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   987
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   988
    "Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   989
    "Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   990
    "Modified (comment): / 23-07-2019 / 09:32:44 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   991
!
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   992
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
   993
findComponent:componentNameOrPath in:anApplicationOrViewOrMenuItem
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   994
    "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
   995
     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
   996
     Can return either a view or a menu item"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
   997
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   998
    |idx app window component componentNameSymbol foundByName foundByTitle foundByLabel item
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
   999
     checkIfAllMenuItemsDoTheSame|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1000
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1001
    (componentNameOrPath includes:$/) ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1002
        (idx := componentNameOrPath indexOf:$/) ~~ 0 ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1003
            |containerName restPath container|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1004
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1005
            containerName := componentNameOrPath copyTo:idx-1.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1006
            restPath := componentNameOrPath copyFrom:idx+1.
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1007
            container := self findComponent:containerName in:anApplicationOrViewOrMenuItem.
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1008
            container isNil ifTrue:[ ^ nil ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1009
            ^ self findComponent:restPath in:container
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1010
        ]
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1011
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1012
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1013
    componentNameSymbol := componentNameOrPath asSymbolIfInterned ? componentNameOrPath.
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1014
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1015
    (app := anApplicationOrViewOrMenuItem) isView ifTrue:[
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1016
        window := anApplicationOrViewOrMenuItem.
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1017
        app := anApplicationOrViewOrMenuItem application
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1018
    ].
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1019
    app isApplicationModel ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1020
        (component := app componentAt:componentNameSymbol) notNil ifTrue:[^ component].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1021
        window := window ? app window.
3781
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1022
    ] ifFalse:[
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1023
        app isMenuItem ifTrue:[
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1024
            window := app submenu.
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1025
        ]
0040ac44a2f3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  1026
    ].
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1027
    
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1028
    "/ mhmh - search through all widgets of anApplication; 
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1029
    "/ maybe it was not created via the builder/spec,
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1030
    "/ or it has changed its name.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1031
    "/ look for: widget's name, widget's title, widget's label
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1032
    foundByName := OrderedCollection new. 
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1033
    foundByTitle := OrderedCollection new. 
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1034
    foundByLabel := OrderedCollection new.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1035
    
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1036
    window withAllSubViewsDo:[:each |
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1037
        |foundIt|
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1038
        
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1039
        foundIt := false.
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1040
        each shown ifTrue:[
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1041
            [
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1042
                each name = componentNameSymbol ifTrue:[ foundByName add:each. foundIt := true ].
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1043
            ] on:MessageNotUnderstood do:[:ex | ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1044
            foundIt ifFalse:[
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1045
                [
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1046
                    each title = componentNameSymbol ifTrue:[ foundByTitle add:each. foundIt := true ].
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1047
                ] on:MessageNotUnderstood do:[:ex | ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1048
                foundIt ifFalse:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1049
                    [
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1050
                        each label = componentNameSymbol ifTrue:[ foundByLabel add:each. foundIt := true ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1051
                    ] on:MessageNotUnderstood do:[:ex | ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1052
                    foundIt ifFalse:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1053
                        each isMenu ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1054
                            (item := each detectItemForNameKey:componentNameSymbol) notNil ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1055
                                foundByName add:item. foundIt := true
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1056
                            ].
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1057
                            foundIt ifFalse:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1058
                                (item := each detectItemForKey:componentNameSymbol) notNil ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1059
                                    foundByName add:item. foundIt := true 
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1060
                                ].    
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1061
                                foundIt ifFalse:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1062
                                    (item := each detectItemForLabel:componentNameSymbol) notNil ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1063
                                        foundByLabel add:item. foundIt := true 
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1064
                                    ].    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1065
                                ].
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1066
                            ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1067
                        ].    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1068
                    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1069
                ]    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1070
            ].
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1071
        ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1072
    ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1073
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1074
    "/ 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
  1075
    checkIfAllMenuItemsDoTheSame := 
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1076
        [:itemsFound |
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1077
            |visibleItems|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1078
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1079
            (itemsFound conform:[:each | each askFor:#isMenuItem]) ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1080
                (itemsFound collect:[:item | item itemValue]) asSet size == 1 ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1081
                    "/ choose one which is visible, if possible
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1082
                    visibleItems := itemsFound select:[:item | item menuPanel shown].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1083
                    visibleItems notEmpty ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1084
                        ^ visibleItems first
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1085
                    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1086
                    ^ itemsFound first.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1087
                ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1088
            ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1089
        ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1090
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1091
    foundByName notEmpty ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1092
        checkIfAllMenuItemsDoTheSame value:foundByName.
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1093
        self assert:(foundByName size == 1) message:'multiple components found by name'.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1094
        ^ foundByName first.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1095
    ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1096
    foundByTitle notEmpty ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1097
        checkIfAllMenuItemsDoTheSame value:foundByTitle.
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1098
        self assert:(foundByTitle size == 1) message:'multiple components found by title'.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1099
        ^ foundByTitle first.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1100
    ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1101
    foundByLabel notEmpty ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1102
        checkIfAllMenuItemsDoTheSame value:foundByLabel.
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1103
        self assert:(foundByLabel size == 1) message:'multiple components found by label'.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1104
        ^ foundByLabel first.
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1105
    ].
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1106
    ^ component
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1107
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1108
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1109
     self basicNew findComponent:'Klassen' in:(Transcript topView)
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1110
    "
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1111
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1112
    "Created: / 19-07-2019 / 11:36:21 / Claus Gittinger"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1113
    "Modified (comment): / 23-07-2019 / 09:31:34 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1114
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1115
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1116
findComponent:componentName inAllApplications:inAllApplicationsBool ifMultiple:exceptionalValue
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1117
    "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
  1118
     Can return either a view or a menu item"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1119
    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1120
    |component candidates modalGroup|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1121
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1122
    application notNil ifTrue:[ 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1123
        (component := self findComponent:componentName in:application) notNil ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1124
            ^ component.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1125
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1126
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1127
    candidates := OrderedCollection new.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1128
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1129
    "/ is there a modal dialog open for the app?
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1130
    (modalGroup := application windowGroup modalGroup) notNil ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1131
        modalGroup topViews do:[:eachModalTopView |
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1132
            component := self findComponent:componentName in:eachModalTopView.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1133
            component notNil ifTrue:[ 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1134
                candidates add:component
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1135
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1136
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1137
        candidates size == 1 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1138
            ^ candidates first
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1139
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1140
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1141
    inAllApplicationsBool ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1142
        "/ search through all current applications
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1143
        WindowGroup scheduledWindowGroups do:[:eachWG |
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1144
            |eachApp|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1145
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1146
            (eachApp := eachWG application) notNil ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1147
                component := self findComponent:componentName in:eachApp.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1148
                component notNil ifTrue:[ 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1149
                    candidates add:component
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1150
                ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1151
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1152
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1153
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1154
        candidates size == 1 ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1155
            ^ candidates first
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
        candidates notEmpty ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1158
            "/ multiple elements (probably there are multiple topviews open...
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1159
            "/ check the current windowGroup
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1160
            ^ exceptionalValue value
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1161
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1162
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1163
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1164
    ^ nil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1165
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1166
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1167
     ShowMeHowItWorks basicNew findComponent:'Classes'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1168
     ShowMeHowItWorks basicNew findComponent:'Klassen'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1169
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1170
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1171
    "Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1172
    "Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1173
    "Modified (comment): / 23-07-2019 / 09:32:44 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1174
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1175
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1176
screenBoundsOfComponent:aWidgetOrMenuItem
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1177
    aWidgetOrMenuItem isView ifTrue:[
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1178
        ^ aWidgetOrMenuItem screenBounds
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1179
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1180
    (aWidgetOrMenuItem askFor:#isMenuItem) ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1181
        |menuPanel menuBounds|
3717
26224649d91c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
  1182
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1183
        aWidgetOrMenuItem isVisible ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1184
            aWidgetOrMenuItem layout notNil ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1185
                menuPanel := aWidgetOrMenuItem menuPanel.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1186
                menuPanel shown ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1187
                    menuBounds := menuPanel screenBounds.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1188
                    ^ aWidgetOrMenuItem layout + menuBounds origin 
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1189
                ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1190
            ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1191
        ].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1192
    ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1193
    ^ nil.
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1194
! !
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1195
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1196
!ShowMeHowItWorks methodsFor:'helpers - mouse buttons'!
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1197
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1198
click:buttonNr inComponent:component
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1199
    "press-release in a component"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1200
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1201
    |t|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1202
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1203
    t := self shortClickTime.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1204
    (component isKindOf:Button) ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1205
        t := self longClickTime
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1206
    ].    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1207
    self click:buttonNr inComponent:component clickTime:t
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1208
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1209
    "Created: / 19-07-2019 / 13:18:27 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1210
    "Modified: / 19-07-2019 / 15:22:47 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1211
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1212
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1213
click:buttonNr inComponent:viewOrMenuItem clickTime:clickTime 
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1214
    "press-release in a component"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1215
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1216
    |viewToClick clickPos|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1217
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1218
    self assert:viewOrMenuItem notNil.
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1219
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1220
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1221
    (viewOrMenuItem askFor:#isMenuItem) ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1222
        viewToClick := viewOrMenuItem menuPanel.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1223
        clickPos := viewOrMenuItem layout center.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1224
        self assert:(clickPos notNil).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1225
    ] ifFalse:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1226
        viewToClick := viewOrMenuItem.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1227
        clickPos := viewToClick extent // 2.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1228
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1229
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1230
    viewToClick simulateButtonPress:buttonNr at:clickPos sendDisplayEvent:false.
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1231
    Delay waitForSeconds:clickTime.
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1232
    viewToClick simulateButtonRelease:buttonNr at:clickPos sendDisplayEvent:false.
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1233
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1234
"/    self click:buttonNr atPosition:(component extent // 2)
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1235
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1236
    "Created: / 19-07-2019 / 15:21:05 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1237
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1238
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1239
press:buttonNr
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1240
    "press at the current position"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1241
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1242
    |position screen x y|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1243
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1244
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1245
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1246
    screen := Screen current.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1247
    position := screen pointerPosition.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1248
    x := position x.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1249
    y := position y.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1250
    
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1251
    "/ self movePointerToScreenPosition:position.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1252
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1253
    false "OperatingSystem isOSXlike" ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1254
        |osxPos|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1255
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1256
        osxPos := OperatingSystem getMousePosition.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1257
        x := osxPos x rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1258
        y := osxPos y rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1259
        OperatingSystem generateButtonEvent:buttonNr down:true x:x y:y.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1260
        ^ self.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1262
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1263
    screen sendKeyOrButtonEvent:#buttonPress x:x y:y keyOrButton:buttonNr state:0 toViewId:(screen rootWindowId).
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1264
    screen flush.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1265
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1266
    "Created: / 19-07-2019 / 13:52:38 / Claus Gittinger"
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1267
    "Modified: / 23-07-2019 / 09:38:31 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1268
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1269
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1270
release:buttonNr
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1271
    "press-release at the current position"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1272
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1273
    |position screen x y|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1274
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1275
    verifying ifTrue:[^ self].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1276
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1277
    screen := Screen current.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1278
    position := screen pointerPosition.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1279
    x := position x.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1280
    y := position y.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1281
    
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1282
    "/ self movePointerToScreenPosition:position.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1283
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1284
    false "OperatingSystem isOSXlike" ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1285
        |osxPos|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1286
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1287
        osxPos := OperatingSystem getMousePosition.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1288
        x := osxPos x rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1289
        y := osxPos y rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1290
        OperatingSystem generateButtonEvent:buttonNr down:false x:x y:y.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1291
        ^ self.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1292
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1293
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1294
    screen sendKeyOrButtonEvent:#buttonRelease x:x y:y keyOrButton:buttonNr state:0 toViewId:(screen rootWindowId).
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1295
    screen flush.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1296
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1297
    "Created: / 19-07-2019 / 13:53:05 / Claus Gittinger"
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1298
    "Modified: / 23-07-2019 / 09:38:38 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1299
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1300
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1301
!ShowMeHowItWorks methodsFor:'helpers - mouse movement'!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1302
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1303
circlePointerAroundComponent:aWidgetOrMenuItem
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1304
    "circle around it a few times"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1305
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1306
    |bounds position|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1307
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1308
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1309
    bounds isNil ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1310
        self error:'no bounds found for: ',aWidgetOrMenuItem printString.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1311
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1312
    position := bounds center rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1313
    self circlePointerAroundScreenPosition:position
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1314
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1315
    "Created: / 19-07-2019 / 13:12:35 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1316
    "Modified: / 23-07-2019 / 09:38:12 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1317
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1318
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1319
circlePointerAroundScreenPosition:position
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1320
    "circle around it a few times"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1321
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1322
    |screen stepDelayTime numCircles circlingSpeed radius|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1323
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1324
    verifying ifTrue:[^ self].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1325
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1326
    screen := Screen current.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1327
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1328
    circlingSpeed := self circlingSpeed.    "/ time per round
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1329
    numCircles := self circlingCount.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1330
    stepDelayTime := self pointerAnimationDelay.   "/ update interval
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1331
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1332
    radius := self circlingRadius.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1333
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1334
    "/ move it around a few times
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1335
    1 to:numCircles do:[:round |
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1336
        |n angle|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1337
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1338
        n := circlingSpeed / stepDelayTime. "/ nr of steps per circle
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1339
        angle := 360 / n.                   "/ angle-delta per step
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1340
        1 to:n do:[:step |
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1341
            |a x y|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1342
            
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1343
            a := angle * step.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1344
            "/ clockwise starting above the center
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1345
            x := position x + (radius * a degreesToRadians sin).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1346
            y := position y + (radius * a degreesToRadians cos).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1347
"/ Transcript showCR:(x@y).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1348
            screen setPointerPosition:(x@y) rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1349
            screen flush.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1350
            Delay waitFor:stepDelayTime.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1351
        ].    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1352
        "/ and back
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1353
        screen setPointerPosition:position rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1354
        screen flush.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1355
        Delay waitFor:stepDelayTime.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1356
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1357
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1358
    "Created: / 23-07-2019 / 09:37:46 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1359
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1360
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1361
fastMovePointerToScreenPosition:position
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1362
    self movePointerToScreenPosition:position speed:(self pointerMoveSpeedFast).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1363
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1364
    "Created: / 23-07-2019 / 09:36:20 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1365
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1366
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1367
movePointerToComponent:aWidgetOrMenuItem
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1368
    "move the mouse to aWidget's center"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1369
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1370
    |bounds|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1371
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1372
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1373
    self movePointerToScreenPosition:(bounds center rounded).
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1374
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1375
    "Created: / 19-07-2019 / 13:11:33 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1376
    "Modified: / 23-07-2019 / 09:37:01 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1377
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1378
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1379
movePointerToComponent:aWidgetOrMenuItem offset:offset
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1380
    "move the mouse to position inside aWidget's"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1381
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1382
    |bounds|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1383
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1384
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1385
    self movePointerToScreenPosition:(bounds origin + offset) rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1386
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1387
    "Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1388
    "Modified: / 23-07-2019 / 09:36:57 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1389
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1390
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1391
movePointerToComponent:aWidgetOrMenuItem rightBottomOffset:offset
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1392
    "move the mouse to position inside aWidget's.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1393
     Offset is from the rightBottom"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1394
    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1395
    |bounds|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1396
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1397
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1398
    self movePointerToScreenPosition:(bounds corner - offset) rounded.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1399
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1400
    "Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1401
    "Modified: / 23-07-2019 / 09:36:57 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1402
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1403
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1404
movePointerToComponent:aWidgetOrMenuItem rightOffset:offset
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1405
    "move the mouse to position inside aWidget's.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1406
     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
  1407
    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1408
    |bounds pos|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1409
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1410
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1411
    pos := (bounds right - offset x) @ (bounds top + offset y).
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1412
    self movePointerToScreenPosition:pos rounded.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1413
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1414
    "Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1415
    "Modified: / 23-07-2019 / 09:36:57 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1416
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1417
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1418
movePointerToComponent:aWidgetOrMenuItem speed:pixelsPerSecond
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1419
    "move the mouse to aWidget's center"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1420
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1421
    |bounds position|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1422
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1423
    bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1424
    bounds isNil ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1425
        self error:'no bounds found for: ',aWidgetOrMenuItem printString.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1426
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1427
    position := bounds center rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1428
    self movePointerToScreenPosition:position speed:pixelsPerSecond.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1429
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1430
    "Created: / 20-07-2019 / 08:12:49 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1431
    "Modified: / 23-07-2019 / 09:37:27 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1432
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1433
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1434
movePointerToScreenPosition:newPosition
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1435
    "move the mouse to newPosition"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1436
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1437
    self movePointerToScreenPosition:newPosition speed:(self pointerMoveSpeed)
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1438
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1439
    "Created: / 23-07-2019 / 09:36:39 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1440
!
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1441
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1442
movePointerToScreenPosition:newPosition speed:pixelsPerSecond
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1443
    "move the mouse to newPosition, which is a screen position"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1444
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1445
    |screen distance start numSteps moveTime stepDelayTime delta|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1446
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1447
    verifying ifTrue:[^ self].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1448
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1449
    screen := Screen current.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1450
    start := screen pointerPosition.   
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1451
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1452
    distance := start dist:newPosition.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1453
    moveTime := (distance / pixelsPerSecond) seconds.   "/ time to move
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1454
    stepDelayTime := self pointerAnimationDelay.        "/ update every 50ms
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1455
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1456
    numSteps := moveTime / stepDelayTime.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1457
    numSteps = 0 ifTrue:[
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1458
        "/ already there
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1459
        ^ self
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1460
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1461
    
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1462
    delta := (newPosition - start) / numSteps.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1463
    1 to:numSteps do:[:step |
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1464
        |p|
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1465
        
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1466
        p := (start + (delta * step)) rounded.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1467
"/ Transcript showCR:p.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1468
        screen setPointerPosition:p.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1469
        screen flush.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1470
        Delay waitFor:stepDelayTime.
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1471
    ].
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1472
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1473
    "Created: / 23-07-2019 / 09:36:45 / Claus Gittinger"
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1474
! !
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1475
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1476
!ShowMeHowItWorks methodsFor:'running'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1477
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1478
do:specArray
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1479
    "must run as a separate process;
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1480
     otherwise - if started by the app itself -
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1481
     no events will be processed while running"
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1482
    |startLabel|
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1483
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1484
    startLabel := 'start'.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1485
    self do:specArray from:startLabel
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1486
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1487
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1488
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1489
     ShowMeHowItWorks do:
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1490
        #(
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1491
            (show: 'blah blah')
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1492
            (moveTo: NameOfComponent)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1493
        )    
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1494
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1495
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1496
    "Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1497
    "Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1498
!
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1499
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1500
do:specArray from:startLabelOrNil withUI:withUIBoolean
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1501
    "must run as a separate process;
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1502
     otherwise - if started by the app itself -
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1503
     no events will be processed while running"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1504
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1505
    withUIBoolean ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1506
        ui := ShowMeHowItWorksRunner openOn:self.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1507
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1508
    self do:specArray from:startLabelOrNil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1509
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1510
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1511
     ShowMeHowItWorks 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1512
        do:#(
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1513
            (show: 'blah blah')
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1514
            (moveTo: NameOfComponent)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1515
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1516
        withUI:true
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1517
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1518
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1519
    "Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1520
    "Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1521
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1522
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1523
do:specArray withUI:withUIBoolean
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1524
    "must run as a separate process;
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1525
     otherwise - if started by the app itself -
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1526
     no events will be processed while running"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1527
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1528
    withUIBoolean ifTrue:[
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1529
        ui := ShowMeHowItWorksRunner openOn:self.
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1530
    ].
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1531
    self do:specArray from:nil
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1532
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1533
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1534
     ShowMeHowItWorks 
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1535
        do:#(
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1536
            (show: 'blah blah')
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1537
            (moveTo: NameOfComponent)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1538
        )
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1539
        withUI:true
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1540
    "
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1541
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1542
    "Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1543
    "Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1544
!
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1545
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1546
prepare
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1547
    language isNil ifTrue:[
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1548
        self language:(Smalltalk language).
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1549
    ].
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1550
    translate := false.
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1551
    
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1552
    application isNil ifTrue:[
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1553
        application := WindowGroup activeMainApplication.
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1554
    ].
3780
604d8ffc8903 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3776
diff changeset
  1555
    closeApplicationWhenFinished := false.
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  1556
    defaultComponentWaitTime isNil ifTrue:[ defaultComponentWaitTime := 1 ].
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1557
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1558
    "Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1559
    "Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1560
!
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1561
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1562
verify:specArray
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1563
    "/ run in verifying mode
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1564
    verifying := true.
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1565
    [
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1566
        Error handle:[:ex |
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1567
            Transcript showCR:('Possible error (encountered while verifying):\.... %1' withCRs)
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1568
                         with:ex description withCRs.
3776
371ad059085a #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
  1569
            Display ctrlDown ifTrue:[ex reject].
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1570
        ] do:[
3784
f6654cc10071 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
  1571
            self show:' '. "/ to avoid an audible disturbance on OSX
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1572
            self doStream:(specArray readStream)
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1573
        ].
3775
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1574
    ] ensure:[
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1575
        verifying := false.
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1576
    ].
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1577
! !
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1578
0e44d27ee647 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3739
diff changeset
  1579
!ShowMeHowItWorks methodsFor:'running - private'!
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1580
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1581
do:specArray from:startLabelOrNil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1582
    "must run as a separate process;
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1583
     otherwise - if started by the app itself -
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1584
     no events will be processed while running"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1585
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1586
    |wasActive|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1587
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1588
    (wasActive := ActiveHelp isActive) ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1589
        ActiveHelp stop.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1590
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1591
    self prepare.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1592
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1593
    "/ run once in verifying mode
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1594
    [
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1595
        self verify:specArray.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1596
    ] ensure:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1597
        wasActive ifTrue:[ActiveHelp start].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1598
    ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1599
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1600
    [
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1601
        ActiveHelp stop.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1602
        [
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1603
            Error handle:[:ex |
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1604
                Dialog warn:(self class classResources 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1605
                                    stringWithCRs:'An error was encountered in the show:\\%1' 
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1606
                                    with:ex description withCRs)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1607
            ] do:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1608
                self doStream:(specArray readStream) from:startLabelOrNil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1609
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1610
        ] ensure:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1611
            wasActive ifTrue:[ActiveHelp start].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1612
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1613
    ] fork.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1614
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1615
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1616
     ShowMeHowItWorks do:
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1617
        #(
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1618
            (show: 'blah blah')
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1619
            (moveTo: NameOfComponent)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1620
        )    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1621
    "
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1622
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1623
    "Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1624
    "Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1625
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1626
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1627
doCommand:op
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1628
    "execute a single command"
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1629
    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1630
    |numArgs sel args method|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1631
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1632
    op isArray ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1633
        op first isArray ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1634
            self doStream:op readStream.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1635
            ^ self.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1636
        ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1637
        
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1638
        "/ construct a selector from keyword parts at odd indices
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1639
        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
  1640
        "/ construct arg vector from parts at even indices
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1641
        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
  1642
    ] ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1643
        sel := op.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1644
        numArgs := sel argumentCount.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1645
        args := opStream next:numArgs.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1646
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1647
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1648
    (self respondsTo:sel) ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1649
        self error:'bad operation: ',sel
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1650
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1651
    method := self class lookupMethodFor:sel.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1652
    (method hasAnnotation:#action) ifFalse:[self halt].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1653
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1654
    lastResult := self perform:sel withArguments:args.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1655
    ^ lastResult
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1656
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1657
"<<END
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1658
     ShowMeHowItWorks do:#(
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1659
        showing: 'Choose the number of arguments'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1660
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1661
            moveTo: NumberOfArguments
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1662
            select: '1'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1663
        )    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1664
        showing: 'Click into the "receiver" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1665
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1666
            moveTo: ReceiverEditor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1667
            click: ReceiverEditor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1668
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1669
        showing: 'Enter a value (or expression) into "receiver" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1670
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1671
            enter: '100'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1672
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1673
        showing: 'Click into the "first argument" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1674
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1675
            moveTo: Arg1Editor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1676
            click: ReceiverEditor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1677
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1678
        showing: 'Enter a value (or expression) into "receiver" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1679
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1680
            enter: '100'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1681
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1682
     )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1683
END"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1684
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1685
    "Created: / 19-07-2019 / 15:34:55 / Claus Gittinger"
3727
6faffd2a64a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3724
diff changeset
  1686
    "Modified: / 23-07-2019 / 09:14:26 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1687
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  1688
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1689
doStream:specStream
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1690
    self doStream:specStream from:nil
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1691
    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1692
"<<END
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1693
     ShowMeHowItWorks do:#(
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1694
        showing: 'Choose the number of arguments'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1695
        do: (
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1696
            moveTo: NumberOfArguments
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1697
            select: '1'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1698
        )    
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1699
        showing: 'Click into the "receiver" field'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1700
        do: (
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1701
            moveTo: ReceiverEditor
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1702
            click: ReceiverEditor
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1703
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1704
        showing: 'Enter a value (or expression) into "receiver" field'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1705
        do: (
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1706
            enter: '100'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1707
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1708
        showing: 'Click into the "first argument" field'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1709
        do: (
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1710
            moveTo: Arg1Editor
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1711
            click: ReceiverEditor
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1712
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1713
        showing: 'Enter a value (or expression) into "receiver" field'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1714
        do: (
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1715
            enter: '100'
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1716
        )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1717
     )
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1718
END"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1719
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1720
    "Created: / 19-07-2019 / 10:52:24 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1721
    "Modified: / 23-07-2019 / 11:48:45 / Claus Gittinger"
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1722
!
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1723
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1724
doStream:specStream from:startLabelOrNil
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1725
    |previousStream resources|
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1726
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1727
    resources := self class classResources.
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  1728
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  1729
    streamStack isNil ifTrue:[ streamStack := OrderedCollection new ].
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  1730
    streamStack add:opStream.
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  1731
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1732
    previousStream := opStream.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1733
    [
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1734
        |nextCommand|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1735
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1736
        opStream := specStream.
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1737
        startLabelOrNil notNil ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1738
            |found|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1739
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1740
            "/ skip for that label
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1741
            found := false.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1742
            [ found ] whileFalse:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1743
                |cmd|
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1744
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1745
                cmd := opStream nextOrNil.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1746
                cmd isNil ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1747
                    self proceedableError:'label not found: ',startLabelOrNil.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1748
                    ^ self.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1749
                ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1750
                (cmd = 'label:') ifTrue:[
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1751
                    found := (opStream next = startLabelOrNil)
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1752
                ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1753
            ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1754
        ].
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1755
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1756
        [opStream atEnd] whileFalse:[
3787
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1757
            nextCommand := opStream next.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1758
            self doCommand:nextCommand.
7b01435dcf25 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 3784
diff changeset
  1759
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1760
            Display shiftDown ifTrue:[
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1761
                (IntroShownCount ? 0) > 3 ifFalse:[
3738
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  1762
                    self tell:(self possiblyTranslate:'You pressed the SHIFT key.').
3728
e7faeed17679 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3727
diff changeset
  1763
                ].    
3738
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  1764
                self tell:(self possiblyTranslate:'Do you want to stop the show?').
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
  1765
                (Dialog confirm:(resources stringWithCRs:'Stop the demonstration?'))
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
  1766
                ifTrue:[
3738
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  1767
                    self tell:(self possiblyTranslate:'OK,').
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  1768
                    self tell:(self possiblyTranslate:(self randomThankYou)).
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
  1769
                    ^ AbortOperationRequest raise
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
  1770
                ].    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1771
            ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1772
        ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1773
    ] ensure:[
3783
e935b92253c9 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  1774
        streamStack removeLast.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1775
        opStream := previousStream
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1776
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1777
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1778
"<<END
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1779
     ShowMeHowItWorks do:#(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1780
        showing: 'Choose the number of arguments'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1781
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1782
            moveTo: NumberOfArguments
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1783
            select: '1'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1784
        )    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1785
        showing: 'Click into the "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1786
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1787
            moveTo: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1788
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1789
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1790
        showing: 'Enter a value (or expression) into "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1791
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1792
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1793
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1794
        showing: 'Click into the "first argument" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1795
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1796
            moveTo: Arg1Editor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1797
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1798
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1799
        showing: 'Enter a value (or expression) into "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1800
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1801
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1802
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1803
     )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1804
END"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1805
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1806
    "Created: / 19-07-2019 / 10:52:24 / Claus Gittinger"
3738
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  1807
    "Modified: / 23-07-2019 / 11:48:45 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1808
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1809
3738
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  1810
possiblyTranslate:aString
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  1811
    translate ifTrue:[^ self class classResources string:aString].
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  1812
    ^ aString
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  1813
fcd5a6af06d4 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  1814
    "Created: / 23-07-2019 / 11:48:17 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1815
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1816
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1817
!ShowMeHowItWorks class methodsFor:'documentation'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1818
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1819
version_CVS
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1820
    ^ '$Header$'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1821
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1822