WindowGroup.st
author Claus Gittinger <cg@exept.de>
Sat, 09 Nov 1996 17:01:12 +0100
changeset 1111 13b350d13122
parent 1110 3ffcd22497fd
child 1116 c04e4739b42c
permissions -rw-r--r--
commentary
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     1
"
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
     3
	      All Rights Reserved
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     4
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     5
 This software is furnished under a license and may be used
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     6
 only in accordance with the terms of that license and with the
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     9
 other person.  No title to or ownership of the software is
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
    10
 hereby transferred.
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
    11
"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
    12
bc3949e465a0 Initial revision
claus
parents:
diff changeset
    13
Object subclass:#WindowGroup
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
    14
	instanceVariableNames:'views topViews myProcess mySensor isModal previousGroup focusView
417
940ebb195fc6 added isModalForSubView flag
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
    15
		focusSequence preEventHook postEventHook pointerView
940ebb195fc6 added isModalForSubView flag
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
    16
		isForModalSubview'
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
    17
	classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
    18
		WindowGroupQuerySignal LastEventQuerySignal'
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
    19
	poolDictionaries:''
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
    20
	category:'Interface-Support'
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
    21
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
    22
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
    23
!WindowGroup class methodsFor:'documentation'!
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    24
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    25
copyright
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    26
"
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    27
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
    28
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    29
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    30
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    31
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    33
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    34
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    35
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    36
"
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    37
!
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    38
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    39
documentation
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    40
"
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    41
    In Smalltalk/X, the known (ST-80) concept of a controller has been
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    42
    extended (split) into a WindowGroup which handles process related stuff, 
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    43
    and the Controller, which only handles events for a view and defines the user interaction.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    44
    All interaction is via event queues - there is no polling in controllers (not even conceptionally).
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    45
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    46
    WindowGroups are responsible to wait for and forward events for a group of 
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    47
    windows. All views in a windowGroup share a single windowSensor which holds the
144
claus
parents: 141
diff changeset
    48
    event queue (therefore views all share the same input event queue).
claus
parents: 141
diff changeset
    49
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    50
    The event queues are filled with incoming events as arriving from the physical display.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    51
    This is done by a separate process (so called event-dispatcher) which runs at a higher
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    52
    priority. The event dispatcher determines the queue into which an event has to be placed
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    53
    by the view for which the event is destined (via the views sensor).
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    54
    There may be multiple event dispatchers running (to support multiple displays);
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    55
    see the documentation/examples in DeviceWorkstation/XWorkstation on how this is done.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    56
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    57
    Except for modal boxes, a separate process is created for each windowGroup 
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    58
    which waits for events to arrive and processes them, by sending corresponding
144
claus
parents: 141
diff changeset
    59
    event messages to the views controller or the view (*). 
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    60
    The controller is determined by asking the view (for which the event is destined);
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    61
    if the returned controller is nil, the event is sent directly to the view.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    62
    This allows for simple views to work without a controller.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    63
    (all of this is actually done in a WindowEvent method)
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    64
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    65
    Therefore, multiple applications run pseudo parallel.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    66
    Even if some window performs a long time computation, events are still received
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    67
    and entered into the corresponding event queues (because the event dispatcher process
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    68
    runs at a higher priority). However, the actual processing of the event is only
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    69
    possibly if no other process is busy at the same or a higher priority.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    70
    It is possible to change a windowProcesses priority in order to give other windows
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    71
    a chance to execute (some views do this while performing longtime actions).
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    72
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    73
    Modal boxes create an extra window group for the components of the modal
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    74
    box, but execute the event-processing loop for this new group in the original process - 
144
claus
parents: 141
diff changeset
    75
    therefore, the original windowgroup is blocked for the duration of the modal 
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    76
    interaction.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    77
    However, the modal-event processing loop peeks into the original groups event queue
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    78
    from time to time, and handles expose events. Thus, even while blocked for user input,
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    79
    the original group continues to get update/redraw events.
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    80
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    81
    Normally, one windowgroup is associated to each topview (StandardSystemView)
144
claus
parents: 141
diff changeset
    82
    and all of its subviews. However, this is not strictly required; 
claus
parents: 141
diff changeset
    83
    it is possible to create extra windowgroups for subviews, which will let them
claus
parents: 141
diff changeset
    84
    run in parallel 
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    85
        (for example, the FileBrowsers kill-Button is created that 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    86
         way, to allow a kill of an executing unix command, while the browser 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    87
         itself reads the pipeStream for incoming text.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    88
         Even if the fileBrowser is busy reading the pipe, the killButton is still
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    89
         working and allows terminating the pipe-read action).
144
claus
parents: 141
diff changeset
    90
claus
parents: 141
diff changeset
    91
    On the other hand, multiple topviews can be placed into the same windowGroup;
claus
parents: 141
diff changeset
    92
    which allows for multiview applications, of which only one communicates with
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    93
    the user at a time.
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    94
    Multiple topviews within a windowGropup can be configured to behave like one 
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    95
    unit with respect to iconification, deiconification and termination.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    96
    This is done by creating multiple topViews in one group, and setting up a master/slave
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    97
    or partner relation among them (see TopView>>beSlave and TopView>>bePartner).
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    98
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
    99
    WindowGroups also support a focus window: this is the one that gets the
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   100
    keyboard input - even if the cursor is located in another subview.
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   101
    The sequence is defined by the topView or its model (typically an applicationModel).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   102
    It should return an orderedCollection of subviews when asked via #focusSequence.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   103
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   104
    For debugging, windowGroups allow hooks to be installed around the processing of
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   105
    events - preEventHook is sent a #procesEvent: message before an event is processed,
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   106
    postEventHook is informed after the event has been processed.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   107
    The preEventHook should return true - if it returns true, the event is considered
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   108
    being already processed by the hook and ignored.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   109
    This allows for event-tracing, timing or even filtering (if preEventHook returns true).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   110
    (notice: there is also an eventHook facility available in the sensor class.)
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   111
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   112
    Finally, windowgroups are the perfect place for things like defining a
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   113
    cursor for all associated views, flushing all input, waiting for expose
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   114
    events etc.
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   115
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
   116
    Dont get confused:
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   117
        You dont have to care for details in the normal case, a windowgroup is
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   118
        created for you automatically, when a view is opened.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   119
        All of the internals are not required to be known for most applications.
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
   120
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   121
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   122
    [instance variables:]
144
claus
parents: 141
diff changeset
   123
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   124
        views                   collection of views of this group
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   125
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   126
        topViews                collection of topviews of this group
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   127
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   128
        myProcess               the process executing the events
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   129
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   130
        mySensor                my input sensor
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   131
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   132
        isModal                 true if this is for a modal box
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   133
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   134
        previousGroup           if modal, the group that started this one
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   135
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   136
        focusView               the one that has the focus (or nil)
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   137
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   138
        focusSequence           defines the focus sequence
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   139
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   140
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   141
    [class variables:]
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   142
        LeaveSignal             if raised, a modal box leaves (closes)
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   143
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   144
        WindowGroupQuerySignal  to ask for the current windowGroup,
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   145
                                anywhere in the program, simply raise this
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   146
                                signal. The raise returns nil, for processes,
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   147
                                which are not under control of a windowGroup.
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   148
                                (i.e. wg := WindowGroup windowGroupQuerySignal raise)
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   149
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   150
        LastEventQuerySignal    to ask for the event which was responsible
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   151
                                for being where you are (whereever that is).
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   152
                                The raise returns nil, if you did not arrive
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   153
                                there due to an event.
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   154
                                (i.e. ev := WindowGroup lastEventQuerySignal raise)
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   155
                                The event can be asked for the view, the type
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   156
                                of event, x/y position etc.
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   157
144
claus
parents: 141
diff changeset
   158
    (*) 
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   159
        due to historic reasons, many views have the controller functionality
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   160
        integrated, and handle events themself. The windowSensor takes care
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   161
        of this, by checking if a view has a controller, and, if so, forwarding 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   162
        the events to it. Otherwise, events are sent directly to the view.
144
claus
parents: 141
diff changeset
   163
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   164
        In the future, all views will be rewritten to actually use a controller.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   165
        Currently (being in the middle of this migration), only some views
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   166
        (buttons, toggles and subclasses) do so.
144
claus
parents: 141
diff changeset
   167
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   168
    For more information, read 'introduction to view programming' in the
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   169
    doc/online directory.
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   170
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 605
diff changeset
   171
    [author:]
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 605
diff changeset
   172
        Claus Gittinger
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 605
diff changeset
   173
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   174
    [see also:]
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   175
        WindowSensor WindowEvent EventListener KeyboardForwarder
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   176
        DeviceWorkstation
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   177
        View StandardSystemView
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   178
        ApplicationModel
651
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   179
        Process ProcessorScheduler
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   180
        (``Working with processes'': programming/processes.html#VIEWSNPROCS)
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   181
"
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   182
! !
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   183
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   184
!WindowGroup class methodsFor:'initialization'!
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   185
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   186
initialize
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   187
    LeaveSignal isNil ifTrue:[
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   188
        LeaveSignal := (Signal new) mayProceed:true.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   189
        LeaveSignal nameClass:self message:#leaveSignal.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   190
        LeaveSignal notifierString:'unhandled leave signal'.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   191
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   192
        WindowGroupQuerySignal := QuerySignal new.
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   193
        WindowGroupQuerySignal nameClass:self message:#windowGroupQuerySignal.
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   194
        WindowGroupQuerySignal notifierString:'query for windowgroup'.
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   195
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   196
        LastEventQuerySignal := QuerySignal new.
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   197
        LastEventQuerySignal nameClass:self message:#lastEventQuerySignal.
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   198
        LastEventQuerySignal notifierString:'query for last event'.
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   199
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   200
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   201
    "WindowGroup initialize"
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   202
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   203
    "Modified: 9.11.1996 / 17:00:53 / cg"
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   204
! !
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   205
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   206
!WindowGroup class methodsFor:'instance creation'!
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   207
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   208
new
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   209
    "create and return a new WindowGroup object"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   210
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   211
    ^ self basicNew initialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   212
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   213
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   214
!WindowGroup class methodsFor:'Signal constants'!
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   215
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   216
lastEventQuerySignal
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   217
    "return the signal which is used to query for the last event"
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   218
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   219
    ^ LastEventQuerySignal
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   220
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   221
    "Created: 17.7.1996 / 20:36:04 / cg"
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   222
!
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   223
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   224
leaveSignal
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   225
    "return the signal which is used to exit a modal loop.
144
claus
parents: 141
diff changeset
   226
     This private signal, is always cought while a modalbox is active.
claus
parents: 141
diff changeset
   227
     Raising it will exit the modal loop and return from the views #openModal
claus
parents: 141
diff changeset
   228
     method."
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   229
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   230
    ^ LeaveSignal
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   231
!
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   232
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   233
windowGroupQuerySignal
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   234
    "return the signal which is used to query for the windowGroup"
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   235
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   236
    ^ WindowGroupQuerySignal
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   237
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   238
    "Created: 17.7.1996 / 20:36:04 / cg"
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   239
! !
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   240
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   241
!WindowGroup class methodsFor:'accessing'!
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   242
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   243
activeGroup
180
claus
parents: 172
diff changeset
   244
    "return the currently active windowGroup.
claus
parents: 172
diff changeset
   245
     The returned value may not be fully correct, in case the current process
claus
parents: 172
diff changeset
   246
     handles multiple windowGroups simulaniously. In this case, 
claus
parents: 172
diff changeset
   247
     the first group is returned (prefering a modal if there is one). 
claus
parents: 172
diff changeset
   248
     (maybe we should return a collection of windowGroups here).
claus
parents: 172
diff changeset
   249
claus
parents: 172
diff changeset
   250
     This method is required to simulate the historic ST-80 single display
claus
parents: 172
diff changeset
   251
     behavior for Cursor>>show / Cursor>>showWhile and some others (raising the
claus
parents: 172
diff changeset
   252
     activeGroups topView when modalBoxes appear) on multiple display screens. 
claus
parents: 172
diff changeset
   253
     These methods should change the cursor for the currently 
claus
parents: 172
diff changeset
   254
     active windowGroup ONLY, instead of globally affecting the display or
claus
parents: 172
diff changeset
   255
     all views
claus
parents: 172
diff changeset
   256
     (since, depending on the priority, other views could be unaffacted by this 
claus
parents: 172
diff changeset
   257
      and an overall cursor change does not make sense.)"
claus
parents: 172
diff changeset
   258
claus
parents: 172
diff changeset
   259
    |activeProcess groups wg|
claus
parents: 172
diff changeset
   260
claus
parents: 172
diff changeset
   261
    Processor isNil ifTrue:[^ nil]. "/ only during very early init phase
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   262
180
claus
parents: 172
diff changeset
   263
    activeProcess := Processor activeProcess.
claus
parents: 172
diff changeset
   264
    " caching the last value ..."
565
6867f1a9a470 oops - leftover global LastActive
Claus Gittinger <cg@exept.de>
parents: 513
diff changeset
   265
    activeProcess == LastActiveProcess ifTrue:[
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   266
        LastActiveGroup process == LastActiveProcess ifTrue:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   267
            ^ LastActiveGroup
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   268
        ]
180
claus
parents: 172
diff changeset
   269
    ].
claus
parents: 172
diff changeset
   270
    groups := self scheduledWindowGroups 
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   271
                select:[:wg | wg process == activeProcess].
180
claus
parents: 172
diff changeset
   272
    groups size == 1 ifTrue:[
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   273
        wg := groups anElement
180
claus
parents: 172
diff changeset
   274
    ] ifFalse:[
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   275
        wg := groups detect:[:wg | wg isModal] ifNone:nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   276
        wg isNil ifTrue:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   277
            wg := groups anElement
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   278
        ]
180
claus
parents: 172
diff changeset
   279
    ].
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   280
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   281
    wg isNil ifTrue:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   282
        "/ mhmh - no windowGroup found;
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   283
        "/ (possibly in a forked subProcess)
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   284
        "/ try querySignal
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   285
        WindowGroupQuerySignal isHandled ifTrue:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   286
            wg := WindowGroupQuerySignal raise
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   287
        ]
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   288
    ].
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   289
180
claus
parents: 172
diff changeset
   290
    wg notNil ifTrue:[
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   291
        LastActiveProcess := activeProcess.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   292
        LastActiveGroup := wg.
180
claus
parents: 172
diff changeset
   293
    ].
claus
parents: 172
diff changeset
   294
    ^ wg
claus
parents: 172
diff changeset
   295
claus
parents: 172
diff changeset
   296
    "
claus
parents: 172
diff changeset
   297
     WindowGroup activeGroup 
claus
parents: 172
diff changeset
   298
    "
claus
parents: 172
diff changeset
   299
claus
parents: 172
diff changeset
   300
    "Modified: 3.9.1995 / 14:49:53 / claus"
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   301
    "Modified: 17.7.1996 / 15:39:19 / cg"
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   302
!
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   303
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   304
scheduledWindowGroups
180
claus
parents: 172
diff changeset
   305
    "return a collection of all windowGroups (possibly for different
claus
parents: 172
diff changeset
   306
     display devices) which are scheduled (i.e. which have a process 
claus
parents: 172
diff changeset
   307
     running, handling events)."
claus
parents: 172
diff changeset
   308
claus
parents: 172
diff changeset
   309
    |set screens|
claus
parents: 172
diff changeset
   310
claus
parents: 172
diff changeset
   311
    screens := Screen allScreens.
claus
parents: 172
diff changeset
   312
    screens isNil ifTrue:[^ #()].
claus
parents: 172
diff changeset
   313
claus
parents: 172
diff changeset
   314
    set := IdentitySet new.
claus
parents: 172
diff changeset
   315
    screens do:[:aDevice |
claus
parents: 172
diff changeset
   316
	aDevice allViewsDo:[:aView |
claus
parents: 172
diff changeset
   317
	    |wg|
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   318
180
claus
parents: 172
diff changeset
   319
	    (wg := aView windowGroup) notNil ifTrue:[
claus
parents: 172
diff changeset
   320
		wg process notNil ifTrue:[
claus
parents: 172
diff changeset
   321
		    set add:wg
claus
parents: 172
diff changeset
   322
		]
claus
parents: 172
diff changeset
   323
	    ].
claus
parents: 172
diff changeset
   324
	].
claus
parents: 172
diff changeset
   325
    ].
claus
parents: 172
diff changeset
   326
    ^ set asArray
claus
parents: 172
diff changeset
   327
claus
parents: 172
diff changeset
   328
    "
claus
parents: 172
diff changeset
   329
     WindowGroup scheduledWindowGroups   
claus
parents: 172
diff changeset
   330
    "
claus
parents: 172
diff changeset
   331
claus
parents: 172
diff changeset
   332
    "Modified: 1.9.1995 / 13:43:09 / claus"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   333
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   334
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   335
setActiveGroup:aGroup
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   336
    "set the currently active windowGroup.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   337
     Temporary; do not use this interface, it will vanish."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   338
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   339
    LastActiveProcess := Processor activeProcess.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   340
    LastActiveGroup := aGroup
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   341
! !
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   342
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   343
!WindowGroup methodsFor:'accessing'!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   344
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   345
device
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   346
    "return the device, we receive our events from"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   347
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   348
    self obsoleteMethodWarning:'use #graphicsDevice'.
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   349
    ^ self graphicsDevice
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   350
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   351
    "Modified: 5.7.1996 / 17:53:58 / cg"
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   352
!
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   353
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   354
graphicsDevice
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   355
    "return the device, we receive our events from"
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   356
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   357
    (topViews notNil and:[topViews isEmpty not]) ifTrue:[
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   358
        ^ topViews first graphicsDevice 
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   359
    ].
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   360
    (views notNil and:[views isEmpty not]) ifTrue:[
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   361
        ^ views first graphicsDevice
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   362
    ].
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   363
    ^ nil
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   364
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   365
    "Modified: 13.12.1995 / 14:18:11 / stefan"
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   366
    "Modified: 28.5.1996 / 20:26:59 / cg"
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   367
    "Created: 5.7.1996 / 17:53:31 / cg"
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   368
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   369
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   370
isModal
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   371
    "return true, if the receiver is in a modal mode
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   372
     (i.e. for a modal box)"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   373
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   374
    ^ isModal
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   375
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   376
    "Modified: 7.3.1996 / 14:29:46 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   377
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   378
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   379
mainGroup
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   380
    "return the main windowgroup (for modal groups only) 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   381
     that is the top one, which is not modal.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   382
     NonModal groups return themSelf.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   383
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   384
     There is one exception to this: the debugger (which is sort of modal)
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   385
     returns itself as mainGroup (not its debuggee)."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   386
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   387
    |g prev|
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   388
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   389
    g := self.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   390
    [g notNil and:[g isModal and:[(prev := g previousGroup) notNil]]] whileTrue:[
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   391
        g := prev
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   392
    ].
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   393
    ^ g
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   394
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   395
    "Modified: 3.9.1995 / 14:57:20 / claus"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   396
    "Modified: 7.3.1996 / 14:29:28 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   397
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   398
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   399
previousGroup
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   400
    "return the windowgroup that started this group. (for modal groups only).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   401
     This may be another modalGroup (for boxes opened by boxes).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   402
     NonModal groups return nil."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   403
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   404
    ^ previousGroup
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   405
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   406
    "Modified: 7.3.1996 / 14:28:46 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   407
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   408
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   409
process 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   410
    "return the windowGroups process"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   411
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   412
    ^ myProcess
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   413
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   414
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   415
sensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   416
    "return the windowGroups sensor.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   417
     All events for any of the groups views is handled by that sensor."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   418
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   419
    ^ mySensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   420
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   421
    "Modified: 7.3.1996 / 14:30:21 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   422
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   423
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   424
sensor:aSensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   425
    "set the windowGroups sensor"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   426
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   427
    mySensor := aSensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   428
! !
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   429
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   430
!WindowGroup methodsFor:'accessing-hook'!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   431
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   432
postEventHook 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   433
    "return the postEventHook if any"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   434
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   435
    ^ postEventHook
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   436
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   437
    "Created: 7.3.1996 / 14:42:46 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   438
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   439
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   440
postEventHook:anObject 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   441
    "set the postEventHook - this one will get all events
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   442
     passed after being processed here (via #processEvent:)."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   443
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   444
    postEventHook := anObject
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   445
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   446
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   447
preEventHook 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   448
    "return the preEventHook if any"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   449
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   450
    ^ preEventHook
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   451
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   452
    "Created: 7.3.1996 / 14:42:42 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   453
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   454
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   455
preEventHook:anObject 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   456
    "set the preEventHook - this one will get all events
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   457
     passed before being processed here (via #processEvent:).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   458
     If this returns true, the event is supposed to be already
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   459
     processed and ignored here.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   460
     Otherwise, it is processed as usual."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   461
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   462
    preEventHook := anObject
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   463
! !
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   464
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   465
!WindowGroup methodsFor:'accessing-views'!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   466
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   467
addTopView:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   468
    "add a topview to the group"
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   469
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   470
    topViews isNil ifTrue:[
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   471
        topViews := OrderedCollection new.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   472
    ].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   473
    (topViews includesIdentical:aView) ifFalse:[
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   474
        topViews add:aView
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   475
    ]
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   476
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   477
    "Modified: 6.3.1996 / 15:35:15 / cg"
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   478
!
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   479
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   480
addView:aView
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   481
    "add aView to the windowGroup"
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   482
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   483
    views isNil ifTrue:[
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   484
        views := OrderedCollection new.
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   485
    ].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   486
    (views includesIdentical:aView) ifFalse:[
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   487
        views add:aView
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   488
    ]
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   489
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   490
    "Modified: 6.3.1996 / 15:35:41 / cg"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   491
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   492
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   493
removeView:aView
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   494
    "remove aView from the windowGroup;
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   495
     if this was the last view in this group, 
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   496
     also shut down the corresponding process 
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   497
     (actually, only wake it up here - it will terminate itself 
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   498
      when finding out that all views are gone)"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   499
263
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   500
    |sema|
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   501
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   502
    views notNil ifTrue:[
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   503
	views remove:aView ifAbsent:[].
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   504
	views isEmpty ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   505
	    views := nil
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   506
	]
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   507
    ].
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   508
    topViews notNil ifTrue:[
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   509
	topViews remove:aView ifAbsent:[].
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   510
	topViews isEmpty ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   511
	    topViews := nil
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   512
	]
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   513
    ].
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   514
    "
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   515
     wakeup my process to look if last view has been
262
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   516
     removed (modalBoxes terminate their modalLoop if so)
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   517
    "
262
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   518
    mySensor notNil ifTrue:[
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   519
	(sema := mySensor eventSemaphore) notNil ifTrue:[
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   520
	    sema signal
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   521
	]
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   522
    ]
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   523
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   524
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   525
topViews
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   526
    "return the topviews accociated to this windowGroup"
172
claus
parents: 162
diff changeset
   527
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   528
    ^ topViews
172
claus
parents: 162
diff changeset
   529
!
claus
parents: 162
diff changeset
   530
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   531
views
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   532
    "return the views accociated to this windowGroup"
172
claus
parents: 162
diff changeset
   533
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   534
    ^ views
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   535
! !
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   536
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   537
!WindowGroup methodsFor:'activation / deactivation'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   538
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   539
closeDownViews
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   540
    "destroy all views associated to this window group"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   541
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   542
    topViews notNil ifTrue:[
403
a3ff487fba88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   543
	topViews do:[:aTopView | aTopView notNil ifTrue:[aTopView destroy]]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   544
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   545
    views := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   546
    topViews := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   547
    mySensor := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   548
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   549
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   550
realizeTopViews:isRestart
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   551
    "realize all topViews associated to this windowGroup.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   552
     If this is a restart, tell topViews about it."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   553
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   554
    topViews notNil ifTrue:[
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   555
	topViews do:[:aView |
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   556
	    aView realize.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   557
	    isRestart ifTrue:[
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   558
		aView restarted
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   559
	    ]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   560
	].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   561
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   562
!
180
claus
parents: 172
diff changeset
   563
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   564
restart
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   565
    "restart after a snapin."
180
claus
parents: 172
diff changeset
   566
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   567
    topViews notNil ifTrue:[
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   568
	"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   569
	 need a new semaphore, since obsolete processes 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   570
	 (from our previous live) may still sit on the current semaphore
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   571
	"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   572
	mySensor eventSemaphore:Semaphore new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   573
	isModal ifFalse:[
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   574
	    self startup:true 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   575
	]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   576
    ]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   577
!
180
claus
parents: 172
diff changeset
   578
582
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   579
shutDown
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   580
    "shutdown the window group; close all views and
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   581
     terminate process"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   582
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   583
    |p|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   584
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   585
    self closeDownViews.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   586
    myProcess notNil ifTrue:[
582
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   587
        p := myProcess.
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   588
        myProcess := nil.
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   589
        p terminate.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   590
    ]
582
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   591
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   592
    "Created: 22.4.1996 / 17:58:37 / cg"
180
claus
parents: 172
diff changeset
   593
!
claus
parents: 172
diff changeset
   594
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   595
startup:isRestart
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   596
    "startup the window-group;
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   597
     this creates a new window group process, which
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   598
     does the event processing."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   599
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   600
    |top nm dev devNm|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   601
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   602
    previousGroup := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   603
    myProcess isNil ifTrue:[
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   604
        isModal := false.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   605
        myProcess := [
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   606
            self realizeTopViews:isRestart.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   607
            self eventLoopWhile:[true] onLeave:[]
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   608
        ] forkAt:Processor userSchedulingPriority.
180
claus
parents: 172
diff changeset
   609
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   610
        (topViews notNil and:[topViews isEmpty not]) ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   611
            "
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   612
             give the handler process a user friendly name
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   613
            "
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   614
            top := topViews first.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   615
            nm := top processName.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   616
            (dev := top graphicsDevice) notNil ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   617
                devNm := dev displayName.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   618
                (devNm notNil and:[devNm ~= Display displayName]) ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   619
                    nm := nm , ' (' , devNm , ')'
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   620
                ]
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   621
            ]
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   622
        ] ifFalse:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   623
            nm := 'window handler'.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   624
        ].
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   625
        myProcess name:nm.
931
00fd4b461c31 renamed beProcessGroupLeader to beGroupLeader
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
   626
        myProcess beGroupLeader.
180
claus
parents: 172
diff changeset
   627
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   628
        "
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   629
         when the process gets suspended, there maybe still buffered draw requests.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   630
         Flush them.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   631
        "
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   632
        myProcess suspendAction:[ 
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   633
            |dev|
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   634
            dev := self graphicsDevice.
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   635
            dev notNil ifTrue:[dev flush].
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   636
        ].
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   637
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   638
        "when the process dies, we have to close-down
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   639
         the views as well
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   640
        "
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   641
        myProcess exitAction:[self closeDownViews]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   642
    ]
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   643
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   644
    "Modified: 13.12.1995 / 14:04:53 / stefan"
931
00fd4b461c31 renamed beProcessGroupLeader to beGroupLeader
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
   645
    "Modified: 8.7.1996 / 14:08:55 / cg"
180
claus
parents: 172
diff changeset
   646
!
claus
parents: 172
diff changeset
   647
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   648
startupModal:checkBlock
301
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   649
    "startup the window-group in a modal loop 
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   650
     (i.e. under the currently running process);
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   651
     checkBlock is evaluated and the modal loop is left, whenever false is returned."
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   652
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   653
    ^ self startupModal:checkBlock forGroup:WindowGroup activeGroup.
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   654
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   655
    "Created: 10.12.1995 / 14:15:11 / cg"
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   656
!
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   657
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   658
startupModal:checkBlock forGroup:mainGroup
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   659
    "startup the window-group in a modal loop 
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   660
     (i.e. under the currently running process);
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   661
     checkBlock is evaluated and loop is left, when false is
301
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   662
     returned.
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   663
     The mainGroup info is required to allow peeking into its
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   664
     event queue in order for its expose/redraws to be handled."
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   665
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   666
    "set previousGroup to the main (non-modal) group"
180
claus
parents: 172
diff changeset
   667
301
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   668
    previousGroup := mainGroup.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   669
    isModal := true.
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   670
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   671
    WindowGroupQuerySignal handle:[:ex |
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   672
        ex proceedWith:self
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   673
    ] do:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   674
        self realizeTopViews:false.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   675
        self 
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   676
            eventLoopWhile:checkBlock 
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   677
            onLeave:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   678
                "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   679
                 cleanup, in case of a terminate
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   680
                "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   681
                previousGroup := nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   682
                topViews := nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   683
                views := nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   684
                "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   685
                 the following is rubbish;
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   686
                 the views could be reused ..
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   687
                "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   688
    "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   689
                topViews notNil ifTrue:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   690
                    topViews do:[:aView |
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   691
                        aView destroy
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   692
                    ].
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   693
                    topViews := nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   694
                ].
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   695
                views notNil ifTrue:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   696
                    views do:[:aView |
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   697
                        aView destroy
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   698
                    ].
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   699
                    views := nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   700
                ].
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   701
    "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   702
            ]
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   703
        ]
301
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   704
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   705
    "Created: 10.12.1995 / 14:14:26 / cg"
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   706
    "Modified: 17.7.1996 / 15:40:37 / cg"
180
claus
parents: 172
diff changeset
   707
! !
claus
parents: 172
diff changeset
   708
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   709
!WindowGroup methodsFor:'enumerating'!
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   710
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   711
allTopViewsExcept:aView do:aBlock
157
claus
parents: 152
diff changeset
   712
    "evaluate aBlock for all topviews except aView in this group.
claus
parents: 152
diff changeset
   713
     This works on a copy of the view collection, to allow for
158
claus
parents: 157
diff changeset
   714
     destroy and other collection changing operations to be done."
157
claus
parents: 152
diff changeset
   715
claus
parents: 152
diff changeset
   716
    topViews notNil ifTrue:[
claus
parents: 152
diff changeset
   717
	topViews copy do:[:v |
claus
parents: 152
diff changeset
   718
	    v ~~ aView ifTrue:[aBlock value:v]
claus
parents: 152
diff changeset
   719
	]
claus
parents: 152
diff changeset
   720
    ].
claus
parents: 152
diff changeset
   721
!
claus
parents: 152
diff changeset
   722
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   723
allViewsDo:aBlock
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   724
    "evaluate aBlock for all views & topviews in this group.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   725
     This works on a copy of the view collection, to allow for
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   726
     destroy and other collection changing operations to be done."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   727
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   728
    topViews notNil ifTrue:[topViews copy do:aBlock].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   729
    views notNil ifTrue:[views copy do:aBlock]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   730
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   731
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   732
partnersDo:aBlock
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   733
    "evaluate aBlock for all partnerViews.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   734
     This works on a copy of the view collection, to allow for
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   735
     destroy and other collection changing operations to be done."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   736
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   737
    topViews notNil ifTrue:[
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   738
	topViews copy do:[:v |
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   739
	    v notNil ifTrue:[
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   740
		v type == #partner ifTrue:[aBlock value:v].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   741
	    ]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   742
	]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   743
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   744
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   745
157
claus
parents: 152
diff changeset
   746
slavesDo:aBlock
claus
parents: 152
diff changeset
   747
    "evaluate aBlock for all slaveViews.
claus
parents: 152
diff changeset
   748
     This works on a copy of the view collection, to allow for
158
claus
parents: 157
diff changeset
   749
     destroy and other collection changing operations to be done."
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   750
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   751
    topViews notNil ifTrue:[
157
claus
parents: 152
diff changeset
   752
	topViews copy do:[:v |
claus
parents: 152
diff changeset
   753
	    v notNil ifTrue:[
claus
parents: 152
diff changeset
   754
		v type == #slave ifTrue:[aBlock value:v].
claus
parents: 152
diff changeset
   755
	    ]
claus
parents: 152
diff changeset
   756
	]
claus
parents: 152
diff changeset
   757
    ].
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   758
! !
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   759
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   760
!WindowGroup methodsFor:'event debugging'!
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   761
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   762
traceEvents:trueOrFalse
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   763
    |hook|
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   764
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   765
    trueOrFalse ifFalse:[
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   766
        "/
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   767
        "/ remove any eventHook on the receiver
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   768
        "/
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   769
        self preEventHook:nil.
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
   770
        "/ Transcript showCR:'removed eventHook'.
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   771
    ] ifTrue:[
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   772
        "/
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   773
        "/ set an eventHook on its windowGroup
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   774
        "/
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   775
        hook := Plug new.
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   776
        hook respondTo:#processEvent:
698
3be775ccac3c printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   777
                  with:[:ev | ev displayString printCR. false].
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   778
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   779
        self preEventHook:hook.
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
   780
        "/ Transcript showCR:'set eventHook for tracing'.
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   781
    ]
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   782
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   783
    "Created: 24.4.1996 / 10:25:21 / cg"
698
3be775ccac3c printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   784
    "Modified: 20.5.1996 / 10:30:00 / cg"
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   785
! !
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   786
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
   787
!WindowGroup methodsFor:'event handling'!
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   788
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   789
eventLoop
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   790
    "loop executed by windowGroup process;
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   791
     wait-for and process events forever"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   792
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   793
   self eventLoopWhile:[true] onLeave:[]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   794
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   795
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   796
eventLoopWhile:aBlock onLeave:cleanupActions
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   797
    "wait-for and process events.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   798
     Stay in this loop while there are still any views to dispatch for,
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   799
     and aBlock evaluates to true.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   800
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   801
     Some signals are cought & handled: 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   802
        LeaveSignal forces an exit from the eventLoop;
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   803
        AbortSignal brings us back into the loop, processing the next event."
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   804
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   805
    |thisProcess sigs|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   806
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   807
    thisProcess := Processor activeProcess.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   808
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   809
    sigs := SignalSet 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   810
                with:AbortSignal 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   811
                with:LeaveSignal 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   812
                with:ActivityNotificationSignal.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   813
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   814
    [
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   815
        |p g mainGroup mySema waitSema|
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   816
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   817
        waitSema := mySema := mySensor eventSemaphore.
325
b24d9a1c74dc stefans modalBox changes (no more polling)
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
   818
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   819
        isModal ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   820
            mainGroup := self mainGroup.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   821
            mainGroup == self ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   822
                mainGroup := nil
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   823
            ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   824
            mainGroup notNil ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   825
                waitSema := SemaphoreSet with:mySema 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   826
                                         with:(mainGroup sensor eventSemaphore).
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   827
            ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   828
        ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   829
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   830
        [aBlock value] whileTrue:[ 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   831
            LastActiveGroup := self.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   832
            LastActiveProcess := thisProcess.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   833
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   834
            (views isNil and:[topViews isNil]) ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   835
                myProcess notNil ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   836
                    p := myProcess.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   837
                    myProcess := nil.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   838
                    p terminate.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   839
                    "not reached - there is no life after death"
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   840
                ].
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   841
                "
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   842
                 this is the end of a modal loop
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   843
                 (not having a private process ...)
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   844
                "
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   845
                ^ self
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   846
            ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   847
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   848
            "/
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   849
            "/ on abort, stay in the event loop
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   850
            "/
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   851
            sigs handle:[:ex |
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   852
                |theSig|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   853
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   854
                (theSig := ex signal) == AbortSignal ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   855
                    "/
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   856
                    "/ on abort, stay in loop
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   857
                    "/
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   858
                    ex return
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   859
                ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   860
                theSig == LeaveSignal ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   861
                    "/
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   862
                    "/ on leave, exit the event loop
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   863
                    "/
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   864
                    ^ self
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   865
                ].
323
619085d52522 be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents: 319
diff changeset
   866
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   867
                "/ ActivityNotification
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   868
                "/
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   869
                "/ if I am a modal-group, let it be handled
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   870
                "/ by the outer main-groups handler
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   871
                "/ otherwise show the activityMessage and continue.
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   872
                "/
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   873
                isModal ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   874
                    ex reject
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   875
                    "never reached"
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   876
                ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   877
                self showActivity:(ex errorString).
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   878
                ex proceed.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   879
            ] do:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   880
                |dev gotSema mainView|
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   881
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   882
                "/ no more events. Flush device output. This may produce more events.
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   883
                dev := self graphicsDevice.
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   884
                dev notNil ifTrue:[dev flush].
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   885
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   886
                thisProcess setStateTo:#eventWait if:#active.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   887
                gotSema := waitSema wait.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   888
                LastActiveGroup := self.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   889
                LastActiveProcess := thisProcess.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   890
                gotSema == mySema ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   891
                    self processEvents
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   892
                ] ifFalse:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   893
                    mainGroup topViews notNil ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   894
                        mainView := mainGroup topViews first
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   895
                    ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   896
                    mainView notNil ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   897
                        (mainGroup sensor hasConfigureEventFor:mainView) ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   898
                             topViews first raiseDeiconified
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   899
                        ]
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   900
                    ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   901
                    "
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   902
                     if modal, also check for redraw events in my maingroup
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   903
                     (we arrive here after we woke up on maingroup sensor eventSemaphore)
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   904
                    "
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   905
                    mainGroup processExposeEvents.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   906
                ]
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   907
            ].
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   908
        ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   909
    ] valueNowOrOnUnwindDo:[
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   910
        cleanupActions notNil ifTrue:[cleanupActions value]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   911
    ]
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   912
325
b24d9a1c74dc stefans modalBox changes (no more polling)
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
   913
    "Modified: 14.12.1995 / 11:12:24 / stefan"
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   914
    "Modified: 5.7.1996 / 17:54:25 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   915
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   916
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   917
leaveEventLoop
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   918
    "immediately leave the event loop, returning way back.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   919
     This can be used to leave (and closedown) a modal group.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   920
     (for normal views, this does not make sense)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   921
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   922
    ^ LeaveSignal raise
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   923
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   924
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   925
processEvents
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   926
    "process events from either the damage- or user input queues.
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   927
     Abort is assumed to be handled elsewhere."
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
   928
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   929
    <resource: #keyboard (#Escape )>
496
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   930
388
64e43f82d93e Escape leaves modalBoxes or PopUpViews
Claus Gittinger <cg@exept.de>
parents: 387
diff changeset
   931
    |event ignore key|
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   932
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   933
    self processExposeEvents.
180
claus
parents: 172
diff changeset
   934
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   935
    [mySensor hasEvents] whileTrue:[
496
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   936
        event := mySensor nextEvent.
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   937
        event notNil ifTrue:[
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   938
            (views notNil or:[topViews notNil]) ifTrue:[
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   939
                LastEventQuerySignal handle:[:ex |
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   940
                    ex proceedWith:event
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   941
                ] do:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   942
                    ignore := false.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   943
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   944
                    (preEventHook  notNil 
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   945
                    and:[preEventHook processEvent:event]) ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   946
                        ignore := true.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   947
                    ].
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   948
                    ignore ifFalse:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   949
                        event isKeyPressEvent ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   950
                            key := event key.
172
claus
parents: 162
diff changeset
   951
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   952
                            key == #Escape ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   953
                                isModal ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   954
                                    topViews first hideRequest
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   955
                                ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   956
                            ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   957
                        ].
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   958
                        event isPointerEnterEvent ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   959
                            pointerView := event view
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   960
                        ].
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   961
                        event isPointerLeaveEvent ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   962
                            pointerView := nil
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   963
                        ].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   964
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   965
                        ignore ifFalse:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   966
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   967
                            "/  button events turn off explicit focus, and revert
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   968
                            "/  to implicit focus control
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   969
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   970
                            (focusView notNil
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   971
                            and:[event isButtonEvent]) ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   972
                                self focusView:nil
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   973
                            ].
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   974
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   975
                            "/ let the event forward itself
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   976
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   977
                            LastActiveGroup := self.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   978
                            LastActiveProcess := Processor activeProcess.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   979
                            event sendEventWithFocusOn:focusView.
496
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   980
                        ]
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   981
                    ].
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   982
                    postEventHook notNil ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   983
                        postEventHook processEvent:event
496
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   984
                    ]
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   985
                ]
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   986
            ]
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   987
        ].
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   988
    ]
357
3655807445b7 keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   989
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   990
    "Modified: 7.3.1996 / 17:46:27 / cg"
48
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
   991
!
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
   992
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
   993
processExposeEvents
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   994
    "process only expose events from the damage queue"
48
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
   995
180
claus
parents: 172
diff changeset
   996
    |event view rect x y w h sensor thisProcess|
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   997
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   998
    (sensor := mySensor) isNil ifTrue:[^ self].
48
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
   999
180
claus
parents: 172
diff changeset
  1000
    thisProcess := Processor activeProcess.
claus
parents: 172
diff changeset
  1001
claus
parents: 172
diff changeset
  1002
    [sensor hasDamage] whileTrue:[
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1003
        LastActiveGroup := self.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1004
        LastActiveProcess := thisProcess.
180
claus
parents: 172
diff changeset
  1005
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1006
        event := sensor nextDamage.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1007
        event notNil ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1008
            (views notNil or:[topViews notNil]) ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1009
                LastEventQuerySignal handle:[:ex |
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1010
                    ex proceedWith:event
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1011
                ] do:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1012
                    (preEventHook notNil 
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1013
                    and:[preEventHook processEvent:event]) ifFalse:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1014
                        event isDamage ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1015
                            view := event view.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1016
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1017
                            "/ if the view is no longer shown (iconified or closed),
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1018
                            "/ this is a leftover event and ignored.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1019
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1020
                            view shown ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1021
                                rect := event rectangle.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1022
                                x := rect left.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1023
                                y := rect top.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1024
                                w := rect width.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1025
                                h := rect height.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1026
                                LastActiveGroup := self.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1027
                                LastActiveProcess := thisProcess.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1028
                                view transformation notNil ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1029
                                    view deviceExposeX:x y:y width:w height:h
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1030
                                ] ifFalse:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1031
                                    view exposeX:x y:y width:w height:h
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1032
                                ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1033
                            ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1034
                        ] ifFalse:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1035
                            "
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1036
                             mhmh - could we possibly arrive here ?
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1037
                            "
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1038
                            LastActiveGroup := self.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1039
                            LastActiveProcess := thisProcess.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1040
                            event sendEvent.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1041
                        ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1042
                    ].
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1043
                    postEventHook notNil ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1044
                        postEventHook processEvent:event
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1045
                    ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1046
                ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1047
            ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1048
        ]
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1049
    ]
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
  1050
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
  1051
28
3879ff2138f1 *** empty log message ***
claus
parents: 26
diff changeset
  1052
waitForExposeFor:aView
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1053
    "wait for a noExpose event for aView, then process all exposes.
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1054
     To be used after a scroll.
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1055
     This is very Xspecific and not needed with other systems
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1056
     (i.e. a synthetic noExpose may be generated there)."
28
3879ff2138f1 *** empty log message ***
claus
parents: 26
diff changeset
  1057
3879ff2138f1 *** empty log message ***
claus
parents: 26
diff changeset
  1058
    mySensor waitForExposeFor:aView.
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1059
    AbortSignal catch:[
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1060
        self processExposeEvents
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1061
    ]
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1062
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1063
    "Modified: 6.3.1996 / 15:58:36 / cg"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
  1064
! !
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1065
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1066
!WindowGroup methodsFor:'focus control'!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1067
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1068
focusNext
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1069
    "give focus to the next view in the focusSequence.
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1070
     Skip invisible views."
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1071
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1072
    |index index0 last next|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1073
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1074
    focusSequence := self focusSequence.
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1075
    (last := focusSequence size) == 0 ifTrue:[^ self].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1076
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1077
    focusView notNil ifTrue:[
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1078
        index := index0 := (focusSequence identityIndexOf:focusView).
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1079
    ] ifFalse:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1080
        index := 0.
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1081
    ].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1082
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1083
    [next isNil] whileTrue:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1084
        index := index + 1.
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1085
        index > last ifTrue:[
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1086
            index := 1.
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1087
            index0 isNil ifTrue:[^ self].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1088
        ].
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1089
        index == index0 ifTrue:[^ self].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1090
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1091
        next := (focusSequence at:index).
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1092
        next realized not ifTrue:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1093
            next := nil
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1094
        ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1095
    ].
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1096
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1097
    self focusView:next
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1098
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1099
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1100
     |top v1 v2|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1101
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1102
     top := StandardSystemView new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1103
     v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1104
     v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1105
     top open.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1106
     top windowGroup focusSequence:(Array with:v1 with:v2).
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1107
     top windowGroup focusOn:v1.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1108
     (Delay forSeconds:10) wait.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1109
     top windowGroup focusNext.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1110
    "
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1111
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1112
    "Modified: 17.7.1996 / 12:27:30 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1113
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1114
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1115
focusPrevious
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1116
    "give focus to previous view in focusSequence"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1117
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1118
    |index prev index0|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1119
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1120
    focusSequence := self focusSequence.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1121
    focusSequence size == 0 ifTrue:[^ self].
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1122
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1123
    focusView notNil ifTrue:[
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1124
        index := index0 := (focusSequence identityIndexOf:focusView).
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1125
    ] ifFalse:[
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1126
        index := focusSequence size + 1.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1127
    ].
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1128
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1129
    [prev isNil] whileTrue:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1130
        index := index - 1.
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1131
        index < 1 ifTrue:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1132
            index := focusSequence size.
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1133
            index0 isNil ifTrue:[^ self].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1134
        ].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1135
        index == index0 ifTrue:[^ self].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1136
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1137
        prev := (focusSequence at:index).
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1138
        prev realized not ifTrue:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1139
            prev := nil
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1140
        ].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1141
    ].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1142
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1143
    self focusView:prev
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1144
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1145
    "Modified: 17.7.1996 / 12:42:10 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1146
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1147
135
claus
parents: 121
diff changeset
  1148
focusSequence
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1149
    "return my focus sequence for focusNext/focusPrevious.
135
claus
parents: 121
diff changeset
  1150
     Focus is stepped in the order in which subviews occur in
claus
parents: 121
diff changeset
  1151
     the sequence"
claus
parents: 121
diff changeset
  1152
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1153
    focusSequence notNil ifTrue:[^ focusSequence].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1154
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1155
    topViews do:[:top |
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1156
        focusSequence := top focusSequence.
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1157
        focusSequence notNil ifTrue:[^ focusSequence].
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1158
    ].
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1159
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1160
    ^ nil
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1161
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1162
    "Modified: 6.3.1996 / 17:50:01 / cg"
135
claus
parents: 121
diff changeset
  1163
!
claus
parents: 121
diff changeset
  1164
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1165
focusSequence:aSequenceableCollection
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1166
    "define the focus sequence for focusNext/focusPrevious.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1167
     Focus is stepped in the order in which subviews occur in
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1168
     the sequence"
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1169
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1170
    focusSequence := aSequenceableCollection
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1171
!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1172
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1173
focusView
135
claus
parents: 121
diff changeset
  1174
    "return the view which currently has the focus"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1175
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1176
    ^ focusView
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1177
!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1178
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1179
focusView:aViewOrNil
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1180
    "give focus to aViewOrNil"
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1181
410
9d9d03fa5d82 moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents: 408
diff changeset
  1182
    focusView == aViewOrNil ifTrue:[^ self].
9d9d03fa5d82 moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents: 408
diff changeset
  1183
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1184
    focusView notNil ifTrue:[
777
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1185
        "/ lost explicit focus
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1186
        focusView == aViewOrNil ifTrue:[^ self].
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1187
        focusView showNoFocus:true.
357
3655807445b7 keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
  1188
    ] ifFalse:[
777
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1189
        pointerView notNil ifTrue:[
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1190
            pointerView ~~ aViewOrNil ifTrue:[
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1191
                "/ lost implicit focus
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1192
                pointerView showNoFocus:false
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1193
            ]
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1194
        ].
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1195
    ].
387
aa80487842b8 compile event classes with optSpace;
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  1196
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1197
    focusView := aViewOrNil.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1198
    focusView notNil ifTrue:[
777
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1199
        "/ got explicit focus
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1200
        focusView showFocus:true.
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1201
    ].
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1202
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1203
    "
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1204
     |top v1 v2|
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1205
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1206
     top := StandardSystemView new.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1207
     v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1208
     v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1209
     top open.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1210
     top windowGroup focusView:v1.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1211
    "
357
3655807445b7 keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
  1212
777
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1213
    "Modified: 31.5.1996 / 21:13:25 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1214
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1215
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1216
!WindowGroup methodsFor:'initialization'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1217
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1218
initialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1219
    "setup the windowgroup, by creating a new sensor
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1220
     and an event semaphore"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1221
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1222
    mySensor := WindowSensor new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1223
    mySensor eventSemaphore:Semaphore new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1224
    isModal := false.
417
940ebb195fc6 added isModalForSubView flag
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
  1225
    isForModalSubview := false.
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1226
!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1227
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1228
reinitialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1229
    "reinitialize the windowgroup after an image restart"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1230
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1231
    "throw away old (zombie) process"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1232
    myProcess notNil ifTrue:[
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1233
	"careful: the old processes exitaction must be cleared
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1234
	 otherwise, it might do destroy or other actions when it
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1235
	 gets finalized ...
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1236
	"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1237
	myProcess exitAction:nil.
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1238
	myProcess suspendAction:nil.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1239
	myProcess := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1240
    ].
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1241
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1242
    "throw away old events"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1243
    mySensor reinitialize
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1244
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1245
    "Modified: 13.12.1995 / 13:45:35 / stefan"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1246
! !
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1247
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1248
!WindowGroup methodsFor:'printing'!
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1249
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1250
printOn:aStream
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1251
    "return a printed representation;
144
claus
parents: 141
diff changeset
  1252
     just for more user friendlyness: add name of process."
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1253
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1254
    myProcess isNil ifTrue:[
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1255
	(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1256
	    aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')').
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1257
	    ^ self.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1258
	].
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1259
	^ super printOn:aStream
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1260
    ].
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1261
    aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')')
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1262
! !
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1263
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1264
!WindowGroup methodsFor:'special'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1265
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1266
restoreCursors
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1267
    "restore the original cursors in all of my views"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1268
330
13a3fa93330c careful - view could have been destroyed in the meanwhile (in restoreCursors)
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
  1269
    self allViewsDo:[:aView |  
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1270
        |c dev id cid|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1271
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1272
        dev := aView graphicsDevice.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1273
        dev notNil ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1274
            (id := aView id) notNil ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1275
                c := aView cursor on:dev.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1276
                (cid := c id) notNil ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1277
                    dev setCursor:cid in:id.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1278
                ]
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1279
            ]
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1280
        ]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1281
    ].
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1282
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1283
    "Modified: 28.5.1996 / 20:27:14 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1284
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1285
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1286
showActivity:someMessage
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1287
    "some activityNotification shalt be communicated to
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1288
     the user; 
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1289
     forward it to my first topView if there is one
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1290
     (that one should know how to deal with it)"
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1291
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1292
    topViews notNil ifTrue:[
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1293
        topViews first showActivity:someMessage
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1294
    ]
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1295
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1296
    "Created: 16.12.1995 / 18:39:40 / cg"
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1297
    "Modified: 23.4.1996 / 21:36:54 / cg"
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1298
!
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1299
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1300
showCursor:aCursor
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1301
    "change the cursor to aCursor in all of my views."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1302
406
aaf6b6b1e787 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 403
diff changeset
  1303
    |c id dev|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1304
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1305
    c := aCursor.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1306
    self allViewsDo:[:aView |  
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1307
        c := c on:(dev := aView graphicsDevice).
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1308
        (id := c id) notNil ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1309
            dev setCursor:id in:aView id.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1310
        ]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1311
    ].
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1312
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1313
    "Modified: 28.5.1996 / 20:27:17 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1314
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1315
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1316
withCursor:aCursor do:aBlock
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1317
    "evaluate aBlock while showing aCursor in all
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1318
     my views (used to show wait-cursor while doing something).
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1319
     Return the result as returned by aBlock."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1320
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1321
    |oldCursors dev|
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1322
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1323
    dev := self graphicsDevice.   
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1324
    dev isNil ifTrue:[
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1325
        ^ aBlock value
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1326
    ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1327
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1328
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1329
     get mapping of view->cursor for all of my subviews
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1330
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1331
    oldCursors := IdentityDictionary new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1332
    self allViewsDo:[:aView |
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1333
        oldCursors at:aView put:(aView cursor).
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1334
        aView cursor:aCursor now:false
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1335
    ].
329
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1336
    "/
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1337
    "/ here sync looks better; flush leads to almost invisible cursors when accepting.
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1338
    "/ I dont really know why (maybe unix does not context-switch to the Xserver
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1339
    "/ early enough after the requests have been sent ?)
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1340
    "/
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1341
"/    dev flush. 
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1342
    dev sync.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1343
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1344
    ^ aBlock valueNowOrOnUnwindDo:[
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1345
        "
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1346
         restore cursors from the mapping
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1347
        "
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1348
        oldCursors keysAndValuesDo:[:view :cursor |
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1349
            view cursor:cursor now:false.
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1350
        ].
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1351
        dev flush "/ sync.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1352
    ]
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1353
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1354
    "Modified: 5.7.1996 / 17:54:16 / cg"
408
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1355
!
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1356
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1357
withWaitCursorDo:aBlock
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1358
    "evaluate aBlock while showing a waitCursor in all
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1359
     my views (used to show wait-cursor while doing something time consuming).
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1360
     Return the result as returned by aBlock."
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1361
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1362
    ^ self withCursor:(Cursor wait) do:aBlock
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1363
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1364
    "Created: 6.2.1996 / 19:51:53 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1365
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1366
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1367
!WindowGroup methodsFor:'special accessing'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1368
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1369
isForModalSubview 
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1370
    "special for windowgroups for modal subviews.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1371
     These must be flagged specially to avoid the views being reassigned
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1372
     to the maingroup.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1373
     This is a private interface to the SimpleView class"
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1374
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1375
    ^ isForModalSubview
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1376
!
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1377
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1378
isForModalSubview:aBoolean
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1379
    "special for windowgroups for modal subviews.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1380
     These must be flagged specially to avoid the views being reassigned
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1381
     to the maingroup.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1382
     This is a private interface to the SimpleView class"
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1383
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1384
    isForModalSubview := aBoolean
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1385
!
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1386
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1387
setModal:aBoolean
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1388
    "special entry for debugger: set the modal flag.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1389
     Not for public use"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1390
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1391
    isModal := aBoolean
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1392
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1393
    "Modified: 3.9.1995 / 14:51:04 / claus"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1394
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1395
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1396
setPreviousGroup:aGroup
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1397
    "special entry for debugger:
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1398
     set the windowgroup that started this group (for modal groups only).
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1399
     This is not a public interface."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1400
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1401
    previousGroup := aGroup
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1402
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1403
    "Modified: 3.9.1995 / 14:55:40 / claus"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1404
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1405
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1406
setProcess:aProcess 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1407
    "special entry for debugger: set the windowGroups process.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1408
     Not for public use."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1409
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1410
    myProcess := aProcess
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1411
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1412
    "Modified: 3.9.1995 / 14:25:38 / claus"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1413
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1414
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1415
!WindowGroup class methodsFor:'documentation'!
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1416
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1417
version
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1418
    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.90 1996-11-09 16:01:12 cg Exp $'
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1419
! !
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1420
WindowGroup initialize!