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