ProgressIndicator.st
author Claus Gittinger <cg@exept.de>
Mon, 09 Jun 2008 17:17:20 +0200
changeset 3442 5cd8447cf5a9
parent 3430 9fee581fff1d
child 3542 3e9b8a2186da
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
62
claus
parents: 50
diff changeset
     1
"
claus
parents: 50
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents: 50
diff changeset
     3
	      All Rights Reserved
claus
parents: 50
diff changeset
     4
claus
parents: 50
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents: 50
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents: 50
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents: 50
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents: 50
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents: 50
diff changeset
    10
 hereby transferred.
claus
parents: 50
diff changeset
    11
"
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
1789
99a33f0b2164 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
    13
50
claus
parents:
diff changeset
    14
View subclass:#ProgressIndicator
826
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
    15
	instanceVariableNames:'percentage showPercentage fgColor bgColor connectedTop
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    16
		connectedLabel collector finishAction closeTopWhenDone showBusy
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    17
		busyPosition busyDelta busyIndicationProcess'
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    18
	classVariableNames:''
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    19
	poolDictionaries:''
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    20
	category:'Views-Misc'
50
claus
parents:
diff changeset
    21
!
claus
parents:
diff changeset
    22
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
    23
!ProgressIndicator class methodsFor:'documentation'!
50
claus
parents:
diff changeset
    24
62
claus
parents: 50
diff changeset
    25
copyright
claus
parents: 50
diff changeset
    26
"
claus
parents: 50
diff changeset
    27
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents: 50
diff changeset
    28
	      All Rights Reserved
claus
parents: 50
diff changeset
    29
claus
parents: 50
diff changeset
    30
 This software is furnished under a license and may be used
claus
parents: 50
diff changeset
    31
 only in accordance with the terms of that license and with the
claus
parents: 50
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
claus
parents: 50
diff changeset
    33
 be provided or otherwise made available to, or used by, any
claus
parents: 50
diff changeset
    34
 other person.  No title to or ownership of the software is
claus
parents: 50
diff changeset
    35
 hereby transferred.
claus
parents: 50
diff changeset
    36
"
claus
parents: 50
diff changeset
    37
!
claus
parents: 50
diff changeset
    38
50
claus
parents:
diff changeset
    39
documentation
claus
parents:
diff changeset
    40
"
claus
parents:
diff changeset
    41
    a view showing a rectangle filled according the percentage value.
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    42
    Can be used as a progress indicator a la MSwindows;
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    43
    it can also be configured as a non-percentage busy indication
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    44
    via the showBusyIndication flag (a la netscape).
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    45
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
    46
    Can be used as a widget within an application, or
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
    47
    via the convenient #inBox: instance creation messages,
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
    48
    which shows a progressDisplay in a modalBox, while some
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
    49
    action is performed.
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
    50
    See examples.
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    51
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    52
    [author:]
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    53
	Claus Gittinger
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    54
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    55
    [see also:]
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    56
	ActionWaitBox AnimatedLabel
50
claus
parents:
diff changeset
    57
"
claus
parents:
diff changeset
    58
!
claus
parents:
diff changeset
    59
claus
parents:
diff changeset
    60
examples
claus
parents:
diff changeset
    61
"
62
claus
parents: 50
diff changeset
    62
    basic (internal) interface
claus
parents: 50
diff changeset
    63
    (if progress indicator is to be used in a complex box ...):
50
claus
parents:
diff changeset
    64
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    65
    Before you get frustrated - see the convenient-interface examples
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    66
    at the end ;-)
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    67
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    68
									[exBegin]
50
claus
parents:
diff changeset
    69
      |top p h|
claus
parents:
diff changeset
    70
62
claus
parents: 50
diff changeset
    71
      top := ModalBox new.
50
claus
parents:
diff changeset
    72
      top extent:300@100.
claus
parents:
diff changeset
    73
      top label:'Progress'.
claus
parents:
diff changeset
    74
      p := ProgressIndicator in:top.
claus
parents:
diff changeset
    75
      p origin:(0.0@0.5) corner:(1.0@0.5).
claus
parents:
diff changeset
    76
      p level:-1.
62
claus
parents: 50
diff changeset
    77
      h := p preferredExtent y.
50
claus
parents:
diff changeset
    78
      p topInset:(h // 2) negated; 
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    79
	bottomInset:(h // 2) negated;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    80
	leftInset:5;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    81
	rightInset:5.
50
claus
parents:
diff changeset
    82
claus
parents:
diff changeset
    83
      [
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    84
	  1 to:100 do:[:val |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    85
	      (Delay forSeconds:0.05) wait.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    86
	      p percentage:val 
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    87
	  ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    88
	  top hide.
62
claus
parents: 50
diff changeset
    89
      ] fork.
claus
parents: 50
diff changeset
    90
      top open.
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    91
									[exEnd]
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    92
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    93
    as a busy indicator
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
    94
									[exBegin]
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    95
      |top p h|
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    96
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    97
      top := ModalBox new.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    98
      top extent:300@100.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    99
      top label:'Busy'.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   100
      p := ProgressIndicator in:top.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   101
      p origin:(0.0@0.5) corner:(1.0@0.5).
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   102
      p level:-1.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   103
      h := p preferredExtent y.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   104
      p topInset:(h // 2) negated; 
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   105
	bottomInset:(h // 2) negated;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   106
	leftInset:5;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   107
	rightInset:5.
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   108
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   109
      p showBusyIndication:true.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   110
      [
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   111
	  'do something here ....'.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   112
	  (Delay forSeconds:5) wait.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   113
	  top hide.
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   114
      ] fork.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   115
      top open.
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   116
									[exEnd]
50
claus
parents:
diff changeset
   117
claus
parents:
diff changeset
   118
    changing colors, turning percentage display off:
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   119
									[exBegin]
50
claus
parents:
diff changeset
   120
      |top p h|
claus
parents:
diff changeset
   121
claus
parents:
diff changeset
   122
      top := StandardSystemView new.
claus
parents:
diff changeset
   123
      top extent:300@100.
claus
parents:
diff changeset
   124
      top label:'Progress'.
claus
parents:
diff changeset
   125
      p := ProgressIndicator in:top.
claus
parents:
diff changeset
   126
      p origin:(0.0@0.5) corner:(1.0@0.5).
claus
parents:
diff changeset
   127
      p level:-1.
claus
parents:
diff changeset
   128
      p showPercentage:false.
claus
parents:
diff changeset
   129
      p foregroundColor:(Color red).
claus
parents:
diff changeset
   130
      h := 10.
claus
parents:
diff changeset
   131
      p topInset:(h // 2) negated; 
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   132
	bottomInset:(h // 2) negated;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   133
	leftInset:5;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   134
	rightInset:5.
50
claus
parents:
diff changeset
   135
      top open.
claus
parents:
diff changeset
   136
      [
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   137
	  1 to:100 do:[:val |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   138
	      (Delay forSeconds:0.05) wait.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   139
	      p percentage:val 
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   140
	  ]
50
claus
parents:
diff changeset
   141
      ] fork
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   142
									[exEnd]
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   143
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   144
    as a busy indicator and percentage display (as in netscape)
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   145
									[exBegin]
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   146
      |top p h|
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   147
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   148
      top := ModalBox new.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   149
      top extent:300@60.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   150
      top label:'Busy'.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   151
      p := ProgressIndicator in:top.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   152
      p origin:(0.0@0.5) corner:(1.0@0.5).
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   153
      p level:-1.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   154
      p showPercentage:false.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   155
      p backgroundColor:(Color cyan).
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   156
      h := p preferredExtent y.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   157
      p topInset:(h // 3) negated; 
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   158
	bottomInset:(h // 3) negated;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   159
	leftInset:5;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   160
	rightInset:5.
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   161
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   162
      p showBusyIndication:true.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   163
      [
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   164
	  top label:'Busy'.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   165
	  1 to:100 do:[:i |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   166
	    (Delay forSeconds:0.05) wait.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   167
	  ].
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   168
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   169
	  top label:'Percentage'.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   170
	  p showBusyIndication:false.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   171
	  1 to:100 do:[:i |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   172
	    (Delay forSeconds:0.05) wait.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   173
	    p percentage:i. 
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   174
	  ].
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   175
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   176
	  top hide.
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   177
      ] fork.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   178
      top open.
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   179
									[exEnd]
50
claus
parents:
diff changeset
   180
claus
parents:
diff changeset
   181
    with border (2D look):
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   182
									[exBegin]
50
claus
parents:
diff changeset
   183
      |top p h|
claus
parents:
diff changeset
   184
claus
parents:
diff changeset
   185
      top := StandardSystemView new.
claus
parents:
diff changeset
   186
      top extent:300@100.
claus
parents:
diff changeset
   187
      top label:'Progress'.
claus
parents:
diff changeset
   188
      p := ProgressIndicator in:top.
claus
parents:
diff changeset
   189
      p origin:(0.0@0.5) corner:(1.0@0.5).
claus
parents:
diff changeset
   190
      p borderWidth:1.
62
claus
parents: 50
diff changeset
   191
      h := p preferredExtent y.
50
claus
parents:
diff changeset
   192
      p topInset:(h // 2) negated; 
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   193
	bottomInset:(h // 2) negated;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   194
	leftInset:5;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   195
	rightInset:5.
50
claus
parents:
diff changeset
   196
      top open.
claus
parents:
diff changeset
   197
      [
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   198
	  1 to:100 do:[:val |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   199
	      (Delay forSeconds:0.05) wait.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   200
	      p percentage:val 
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   201
	  ]
50
claus
parents:
diff changeset
   202
      ] fork
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   203
									[exEnd]
50
claus
parents:
diff changeset
   204
claus
parents:
diff changeset
   205
claus
parents:
diff changeset
   206
    getting progress from a model:
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   207
									[exBegin]
50
claus
parents:
diff changeset
   208
      |model top p h|
claus
parents:
diff changeset
   209
claus
parents:
diff changeset
   210
      model := 0 asValue.
claus
parents:
diff changeset
   211
claus
parents:
diff changeset
   212
      top := StandardSystemView new.
claus
parents:
diff changeset
   213
      top extent:300@100.
claus
parents:
diff changeset
   214
      top label:'Progress'.
claus
parents:
diff changeset
   215
      p := ProgressIndicator in:top.
claus
parents:
diff changeset
   216
      p model:model.
claus
parents:
diff changeset
   217
      p origin:(0.0@0.5) corner:(1.0@0.5).
claus
parents:
diff changeset
   218
      p level:-1.
62
claus
parents: 50
diff changeset
   219
      h := p preferredExtent y.
50
claus
parents:
diff changeset
   220
      p topInset:(h // 2) negated; 
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   221
	bottomInset:(h // 2) negated;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   222
	leftInset:5;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   223
	rightInset:5.
50
claus
parents:
diff changeset
   224
      top open.
claus
parents:
diff changeset
   225
claus
parents:
diff changeset
   226
      [
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   227
	  1 to:100 do:[:val |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   228
	      (Delay forSeconds:0.05) wait.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   229
	      model value:val 
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   230
	  ]
50
claus
parents:
diff changeset
   231
      ] fork
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   232
									[exEnd]
50
claus
parents:
diff changeset
   233
62
claus
parents: 50
diff changeset
   234
50
claus
parents:
diff changeset
   235
    concrete example:
claus
parents:
diff changeset
   236
      search all files in the source directory for a string
claus
parents:
diff changeset
   237
      using grep. Show progress while doing so.
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   238
									[exBegin]
50
claus
parents:
diff changeset
   239
      |top p h names done|
claus
parents:
diff changeset
   240
claus
parents:
diff changeset
   241
      top := StandardSystemView new.
claus
parents:
diff changeset
   242
      top extent:300@100.
claus
parents:
diff changeset
   243
      top label:'Searching ...'.
claus
parents:
diff changeset
   244
      p := ProgressIndicator in:top.
claus
parents:
diff changeset
   245
      p origin:(0.0@0.5) corner:(1.0@0.5).
claus
parents:
diff changeset
   246
      p level:-1.
62
claus
parents: 50
diff changeset
   247
      h := p preferredExtent y.
50
claus
parents:
diff changeset
   248
      p topInset:(h // 2) negated; 
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   249
	bottomInset:(h // 2) negated;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   250
	leftInset:5;
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   251
	rightInset:5.
50
claus
parents:
diff changeset
   252
      top openWithPriority:(Processor activePriority + 1).
claus
parents:
diff changeset
   253
claus
parents:
diff changeset
   254
      names := 'source' asFilename directoryContents.
claus
parents:
diff changeset
   255
      done := 0.
claus
parents:
diff changeset
   256
      names do:[:aName |
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   257
	|fn stream line|
50
claus
parents:
diff changeset
   258
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   259
	p percentage:(done / names size * 100).
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   260
	fn := ('source/' , aName) asFilename.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   261
	fn isDirectory ifFalse:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   262
	    stream := fn readStream.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   263
	    [stream atEnd] whileFalse:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   264
		line := stream nextLine.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   265
		(line findString:'subclass:') ~~ 0 ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   266
		    Transcript showCR:line
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   267
		].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   268
	    ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   269
	    stream close.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   270
	].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   271
	done := done + 1
50
claus
parents:
diff changeset
   272
      ].
claus
parents:
diff changeset
   273
claus
parents:
diff changeset
   274
      top destroy
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   275
									[exEnd]
62
claus
parents: 50
diff changeset
   276
claus
parents: 50
diff changeset
   277
claus
parents: 50
diff changeset
   278
   using the convenient inBox-interface
claus
parents: 50
diff changeset
   279
claus
parents: 50
diff changeset
   280
   (this creates a box and an activity label and evaluates a block
claus
parents: 50
diff changeset
   281
    to indicate ...)
claus
parents: 50
diff changeset
   282
claus
parents: 50
diff changeset
   283
    basic interface demonstration:
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   284
									[exBegin]
62
claus
parents: 50
diff changeset
   285
      |p|
claus
parents: 50
diff changeset
   286
claus
parents: 50
diff changeset
   287
      p := ProgressIndicator 
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   288
		inBoxWithLabel:'doing something  ...'
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   289
		abortable:true.
62
claus
parents: 50
diff changeset
   290
      p showProgressOf:
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   291
	    [:progressValue :currentAction |
62
claus
parents: 50
diff changeset
   292
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   293
	      1 to:100 do:[:val |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   294
		  (Delay forSeconds:0.05) wait.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   295
		  val == 25 ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   296
		      currentAction value:'still going ...'
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   297
		  ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   298
		  val == 50 ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   299
		      currentAction value:'halfway through ...'
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   300
		  ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   301
		  val == 75 ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   302
		      currentAction value:'almost finished ...'
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   303
		  ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   304
		  progressValue value:val 
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   305
	      ]
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   306
	    ]
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   307
									[exEnd]
62
claus
parents: 50
diff changeset
   308
claus
parents: 50
diff changeset
   309
claus
parents: 50
diff changeset
   310
    above search example using this convenient interface:
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   311
									[exBegin]
62
claus
parents: 50
diff changeset
   312
      |p|
claus
parents: 50
diff changeset
   313
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   314
      p := ProgressIndicator 
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   315
		inBoxWithLabel:'searching files ...'
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   316
		abortable:false.
62
claus
parents: 50
diff changeset
   317
      p showProgressOf:
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   318
	    [:progressValue :currentAction |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   319
		|names nDone|
62
claus
parents: 50
diff changeset
   320
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   321
		names := 'source' asFilename directoryContents.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   322
		nDone := 0.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   323
		names do:[:aName |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   324
		  |fn stream line|
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   325
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   326
		  progressValue value:(nDone / names size * 100).
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   327
		  currentAction value:'searching ' , 'source/' , aName , ' ...'.
62
claus
parents: 50
diff changeset
   328
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   329
		  fn := ('source/' , aName) asFilename.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   330
		  fn isDirectory ifFalse:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   331
		      stream := fn readStream.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   332
		      [stream atEnd] whileFalse:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   333
			  line := stream nextLine.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   334
			  (line findString:'subclass:') ~~ 0 ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   335
			      Transcript showCR:line
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   336
			  ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   337
		      ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   338
		      stream close.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   339
		  ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   340
		  nDone := nDone + 1
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   341
		].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   342
	    ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   343
									[exEnd]
62
claus
parents: 50
diff changeset
   344
claus
parents: 50
diff changeset
   345
claus
parents: 50
diff changeset
   346
    a nice example: copying files a la windows ...
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   347
    the following copies all files to /dev/null.
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   348
									[exBegin]
62
claus
parents: 50
diff changeset
   349
      |p|
claus
parents: 50
diff changeset
   350
claus
parents: 50
diff changeset
   351
      (ProgressIndicator 
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   352
		inBoxWithLabel:'copy files to /dev/null ...'
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   353
		abortable:true)
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   354
	 showProgressOf:
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   355
	    [:progressValue :currentAction |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   356
		|files nFiles nDone|
62
claus
parents: 50
diff changeset
   357
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   358
		files := '.' asFilename directoryContents.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   359
		nFiles := files size.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   360
		nDone := 0.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   361
		files do:[:aFileName |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   362
		    |percent|
50
claus
parents:
diff changeset
   363
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   364
		    nDone := nDone + 1.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   365
		    percent := nDone / nFiles * 100.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   366
		    progressValue value:percent. 
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   367
		    aFileName asFilename isDirectory ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   368
			Transcript showCR:('skipping ' , aFileName , ' ...'). 
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   369
			currentAction value:('skipping ' , aFileName , ' ...'). 
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   370
		    ] ifFalse:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   371
			Transcript showCR:('copying ' , aFileName , ' ...').
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   372
			currentAction value:('copying ' , aFileName , ' ...').
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   373
			Object errorSignal handle:[:ex |
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   374
			    self warn:'an error occurred while copying ' , aFileName.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   375
			    ex return
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   376
			] do:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   377
			    aFileName asFilename copyTo:'/dev/null'.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   378
			]
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   379
		    ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   380
		].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   381
	    ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   382
									[exEnd]
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   383
"
50
claus
parents:
diff changeset
   384
! !
claus
parents:
diff changeset
   385
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   386
!ProgressIndicator class methodsFor:'instance creation'!
62
claus
parents: 50
diff changeset
   387
3442
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   388
displayBusyIndicator:aLabel abortable:abortable at:aPoint during:aBlock
2850
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   389
    "easy interface - show progress while evaluating aBlock.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   390
     The block is passed a valueHolder, which is to be set to values from
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   391
     startValue to endValue during the blocks evaluation.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   392
     This is scaled to 0..100% completion.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   393
     Set the valueHolder to nil, to get a busy-indicator"
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   394
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   395
    |p|
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   396
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   397
    p := self
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   398
            inBoxWithLabel:aLabel 
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   399
            icon:nil
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   400
            text:aLabel
3442
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   401
            abortable:abortable
2850
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   402
            view:nil
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   403
            closeWhenDone:true.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   404
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   405
    p showBusyIndication:true.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   406
    p showBusyIndicatorDuring:[
2931
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   407
        CannotReturnError catch:[
3430
9fee581fff1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   408
            aBlock valueWithOptionalArgument:p.    
2850
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   409
        ]
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   410
    ]
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   411
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   412
    "
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   413
     ProgressIndicator
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   414
        displayBusyIndicator:'doobidoobidoo...'
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   415
        at:(Screen default center)
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   416
        during:[
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   417
            200 to:400 by:5 do:[:i |
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   418
                Delay waitForSeconds:0.1.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   419
            ]
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   420
        ].
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   421
    "
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   422
!
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   423
3442
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   424
displayBusyIndicator:aLabel at:aPoint during:aBlock
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   425
    "easy interface - show progress while evaluating aBlock.
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   426
     The block is passed a valueHolder, which is to be set to values from
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   427
     startValue to endValue during the blocks evaluation.
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   428
     This is scaled to 0..100% completion.
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   429
     Set the valueHolder to nil, to get a busy-indicator"
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   430
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   431
    self
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   432
        displayBusyIndicator:aLabel 
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   433
        abortable:false 
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   434
        at:aPoint 
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   435
        during:aBlock
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   436
!
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
   437
1462
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   438
displayProgress:aLabel at:aPoint from:startValue to:endValue during:aBlock
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   439
    "easy interface - show progress while evaluating aBlock.
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   440
     The block is passed a valueHolder, which is to be set to values from
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   441
     startValue to endValue during the blocks evaluation.
2435
86d3ac1ebb76 busy indicator
Claus Gittinger <cg@exept.de>
parents: 2404
diff changeset
   442
     This is scaled to 0..100% completion.
86d3ac1ebb76 busy indicator
Claus Gittinger <cg@exept.de>
parents: 2404
diff changeset
   443
     Set the valueHolder to nil, to get a busy-indicator"
1462
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   444
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   445
    |p|
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   446
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   447
    p := self
2931
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   448
            inBoxWithLabel:aLabel 
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   449
            icon:nil
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   450
            text:aLabel
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   451
            abortable:false
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   452
            view:nil
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   453
            closeWhenDone:true.
1462
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   454
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   455
    p showProgressOf:[:progressValue :currentAction |
2931
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   456
        |scaler|
1463
741925565153 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
   457
2931
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   458
        scaler := [:scaledValue | 
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   459
                        |newPercentage oldPercentage oldLabel|
2435
86d3ac1ebb76 busy indicator
Claus Gittinger <cg@exept.de>
parents: 2404
diff changeset
   460
2931
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   461
                        scaledValue isNil ifTrue:[
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   462
                            p showBusyIndication:true
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   463
                        ] ifFalse:[
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   464
                            p showBusyIndication:false.
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   465
                            oldPercentage := progressValue value.
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   466
                            newPercentage := (scaledValue - startValue) / (endValue-startValue) * 100.
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   467
                            newPercentage ~= oldPercentage ifTrue:[
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   468
                                progressValue value:newPercentage.
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   469
                            ].
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   470
                            oldLabel := currentAction value.
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   471
                            oldLabel ~= aLabel ifTrue:[
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   472
                                currentAction value:aLabel.
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   473
                            ]
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   474
                        ]
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   475
                  ].
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   476
        CannotReturnError catch:[
3430
9fee581fff1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   477
            aBlock valueWithOptionalArgument:scaler and:p.    
2931
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   478
        ]
1462
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   479
    ]
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   480
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   481
    "
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   482
     ProgressIndicator
2931
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   483
        displayProgress:'doobidoobidoo...'
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   484
        at:(Screen default center)
3430
9fee581fff1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   485
        from:200 to:400
2931
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   486
        during:[:val |
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   487
            200 to:400 by:5 do:[:i |
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   488
                val value:i.
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   489
                Delay waitForSeconds:0.1.
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   490
            ]
74fc63bea835 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2921
diff changeset
   491
        ].
1462
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   492
    "
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   493
!
e3c0a367a7e8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   494
62
claus
parents: 50
diff changeset
   495
inBox
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   496
    "create a topView containing an instance of myself,
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   497
     for later use with #showProgressOf:"
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   498
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   499
    ^ self inBoxWithLabel:'executing ...' abortable:false
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   500
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   501
    "Modified: 22.10.1997 / 21:08:37 / cg"
62
claus
parents: 50
diff changeset
   502
!
claus
parents: 50
diff changeset
   503
claus
parents: 50
diff changeset
   504
inBoxWithLabel:aLabel
claus
parents: 50
diff changeset
   505
    "create a topView containing an instance of myself,
claus
parents: 50
diff changeset
   506
     for later use with #showProgressOf:"
claus
parents: 50
diff changeset
   507
claus
parents: 50
diff changeset
   508
    ^ self inBoxWithLabel:aLabel abortable:false 
claus
parents: 50
diff changeset
   509
!
claus
parents: 50
diff changeset
   510
claus
parents: 50
diff changeset
   511
inBoxWithLabel:aLabel abortable:abortable
claus
parents: 50
diff changeset
   512
    "create a topView containing an instance of myself,
claus
parents: 50
diff changeset
   513
     for later use with #showProgressOf:"
claus
parents: 50
diff changeset
   514
219
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   515
    ^ self
634
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   516
	inBoxWithLabel:aLabel   
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   517
	text:''
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   518
	abortable:abortable
219
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   519
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   520
    "Modified: 17.7.1996 / 15:14:58 / cg"
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   521
!
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   522
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   523
inBoxWithLabel:aLabel icon:anIcon text:text abortable:abortable view:additionalView closeWhenDone:closeWhenDoneBoolean
219
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   524
    "create a topView containing an instance of myself,
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   525
     for later use with #showProgressOf:"
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   526
2436
6c0df331b7b1 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2435
diff changeset
   527
    |top p l y y2|
62
claus
parents: 50
diff changeset
   528
claus
parents: 50
diff changeset
   529
    top := Dialog new.
claus
parents: 50
diff changeset
   530
    top label:aLabel.
claus
parents: 50
diff changeset
   531
    top cursor:(Cursor wait).
826
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   532
    y2 := 0.
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   533
    anIcon notNil ifTrue:[
3425
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   534
        y := top yPosition.
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   535
        l := top addTextLabel:anIcon.
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   536
        l borderWidth:0.
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   537
        l adjust:#left.
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   538
        l cursor:(Cursor wait).
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   539
        y2 := top yPosition.
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   540
        top yPosition:y.
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   541
    ].
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   542
219
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   543
    l := top addTextLabel:text.
62
claus
parents: 50
diff changeset
   544
    l borderWidth:0.
74
claus
parents: 62
diff changeset
   545
    l adjust:#left.
62
claus
parents: 50
diff changeset
   546
    l cursor:(Cursor wait).
826
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   547
    anIcon notNil ifTrue: [l leftInset:(anIcon width + 10)].
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   548
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   549
    top yPosition:(top yPosition max:y2).
62
claus
parents: 50
diff changeset
   550
claus
parents: 50
diff changeset
   551
    top addVerticalSpace.
claus
parents: 50
diff changeset
   552
claus
parents: 50
diff changeset
   553
    p := ProgressIndicator new.
3425
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   554
    p extent:(1.0 @ p preferredHeight).
62
claus
parents: 50
diff changeset
   555
    p level:-1.
claus
parents: 50
diff changeset
   556
    p leftInset:5;
claus
parents: 50
diff changeset
   557
      rightInset:5.
claus
parents: 50
diff changeset
   558
    p cursor:(Cursor wait).
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   559
    p closeTopWhenDone:closeWhenDoneBoolean.
62
claus
parents: 50
diff changeset
   560
    p connectToTop:top label:l.
claus
parents: 50
diff changeset
   561
claus
parents: 50
diff changeset
   562
    top addComponent:p.
claus
parents: 50
diff changeset
   563
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   564
    additionalView notNil ifTrue:[
3425
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   565
        top addComponent:additionalView.
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   566
        additionalView extent:(1.0 @ additionalView preferredHeight).
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   567
    ].
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   568
62
claus
parents: 50
diff changeset
   569
    abortable ifTrue:[
3425
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   570
        top addVerticalSpace.
20459e327062 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   571
        top addAbortButton
62
claus
parents: 50
diff changeset
   572
    ].
claus
parents: 50
diff changeset
   573
claus
parents: 50
diff changeset
   574
    ^ p
219
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   575
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   576
    "Created: 17.7.1996 / 15:14:33 / cg"
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
   577
    "Modified: 17.7.1996 / 15:16:58 / cg"
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   578
!
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   579
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   580
inBoxWithLabel:aLabel text:text abortable:abortable
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   581
    "create a topView containing an instance of myself,
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   582
     for later use with #showProgressOf:"
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   583
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   584
    ^ self
634
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   585
	inBoxWithLabel:aLabel 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   586
	text:text 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   587
	abortable:abortable 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   588
	view:nil
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   589
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   590
!
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   591
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   592
inBoxWithLabel:aLabel text:text abortable:abortable view:additionalView
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   593
    "create a topView containing an instance of myself,
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   594
     for later use with #showProgressOf:"
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   595
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   596
    ^ self
634
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   597
	inBoxWithLabel:aLabel 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   598
	text:text 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   599
	abortable:abortable 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   600
	view:additionalView 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   601
	closeWhenDone:true
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   602
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   603
!
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   604
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   605
inBoxWithLabel:aLabel text:text abortable:abortable view:additionalView closeWhenDone:closeWhenDoneBoolean
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   606
    "create a topView containing an instance of myself,
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   607
     for later use with #showProgressOf:"
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   608
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   609
    ^ self
634
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   610
	inBoxWithLabel:aLabel 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   611
	icon:nil
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   612
	text:text 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   613
	abortable:abortable 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   614
	view:additionalView 
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   615
	closeWhenDone:closeWhenDoneBoolean
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   616
1681
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   617
!
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   618
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   619
progressOpenOn:progressModel label:aLabel
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   620
    "create and open a progressIndicator dialog window,
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   621
     bit do not open it modal; instead, it is opened modeless
1834
ba170c21ed76 defaultExtent computation fixed
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
   622
     and control returns to the caller.
1681
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   623
     The models value is assumed to be 0..1 
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   624
     (which is for compatibility and different from ST/X's percentage use)
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   625
     Added for VW compatibility (RB)."
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   626
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   627
    |p ra|
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   628
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   629
    p := self
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   630
	    inBoxWithLabel:aLabel 
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   631
	    icon:nil
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   632
	    text:aLabel
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   633
	    abortable:false
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   634
	    view:nil
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   635
	    closeWhenDone:false.
1681
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   636
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   637
    ra := RangeAdaptor on:progressModel start:0 stop:0.01 grid:nil.
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   638
    p model:ra.
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   639
2132
fd5b29a20fe1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   640
    p topView openModeless; waitUntilVisible.
1681
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   641
    ^ p.
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   642
9ef9e8ec0f43 progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 1463
diff changeset
   643
    "Modified: / 4.2.2000 / 01:25:55 / cg"
62
claus
parents: 50
diff changeset
   644
! !
claus
parents: 50
diff changeset
   645
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   646
!ProgressIndicator methodsFor:'accessing'!
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   647
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   648
percentage:aNumber
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   649
    "set the percentage"
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   650
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   651
    |newPercentage|
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   652
2040
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   653
    aNumber < 0 ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   654
        newPercentage := -1.
2040
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   655
    ] ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   656
        newPercentage := ((aNumber max:0) min:100) rounded.
2040
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   657
    ].
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 865
diff changeset
   658
    newPercentage ~= percentage ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   659
        percentage := newPercentage.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   660
        self invalidateRepairNow:true.
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   661
    ]
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   662
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 865
diff changeset
   663
    "Modified: / 6.6.1998 / 19:43:56 / cg"
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   664
!
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   665
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   666
showBusyIndication:aBooleanHolder
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   667
    "switch between percentage mode (if false) and busy indication (if true)"
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   668
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   669
    aBooleanHolder ~~ showBusy ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   670
	showBusy notNil ifTrue:[        
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   671
	    showBusy removeDependent:self.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   672
	].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   673
	showBusy := aBooleanHolder.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   674
	showBusy addDependent:self.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   675
	(showBusy value) ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   676
	    self startBusyIndicationProcess.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   677
	] ifFalse:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   678
	    self stopBusyIndicationProcess
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   679
	].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   680
	shown ifTrue:[self redraw]
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   681
    ].
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   682
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   683
    "Created: / 21.10.1998 / 17:35:16 / cg"
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   684
    "Modified: / 21.10.1998 / 18:03:06 / cg"
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   685
! !
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   686
2404
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   687
!ProgressIndicator methodsFor:'accessing-behavior'!
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   688
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   689
closeTopWhenDone:aBoolean
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   690
    "set/clear the close-topView-when-done flag"
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   691
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   692
    closeTopWhenDone := aBoolean
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   693
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   694
    "Created: 3.9.1996 / 14:22:03 / cg"
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   695
    "Modified: 29.3.1997 / 16:08:19 / cg"
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   696
!
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   697
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   698
finishAction:aBlock 
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   699
    "define an action to be performed when finished"
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   700
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   701
    finishAction := aBlock
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   702
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   703
    "Created: 3.9.1996 / 14:15:15 / cg"
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   704
    "Modified: 29.3.1997 / 16:08:35 / cg"
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   705
! !
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   706
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
   707
!ProgressIndicator methodsFor:'accessing-look'!
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   708
826
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   709
backgroundColor 
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   710
    "return the percentage displays background color"
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   711
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   712
    ^ bgColor
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   713
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   714
!
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   715
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   716
backgroundColor:aColor 
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   717
    "set the percentage displays background color"
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   718
993
6274668e8262 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   719
    aColor ~= bgColor ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   720
        bgColor := aColor.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   721
        self invalidateRepairNow:true
826
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   722
    ].
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   723
993
6274668e8262 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   724
    "Modified: / 20.7.1998 / 23:32:48 / cg"
826
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   725
!
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   726
335
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   727
foregroundColor 
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   728
    "return the percentage displays foreground color"
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   729
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   730
    ^ fgColor
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   731
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   732
    "Created: 29.3.1997 / 16:12:28 / cg"
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   733
!
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   734
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   735
foregroundColor:aColor 
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   736
    "set the percentage displays foreground color"
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   737
993
6274668e8262 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   738
    aColor ~= fgColor ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   739
        fgColor := aColor.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   740
        self invalidateRepairNow:true
336
5199e2058981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   741
    ].
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   742
993
6274668e8262 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   743
    "Modified: / 20.7.1998 / 23:27:47 / cg"
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   744
!
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   745
335
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   746
showPercentage
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   747
    "return the flag controlling if the percentage is to be shown numerically"
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   748
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   749
    ^ showPercentage
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   750
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   751
    "Created: 29.3.1997 / 16:12:39 / cg"
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   752
!
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   753
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   754
showPercentage:aBoolean
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   755
    "set/clear the flag controlling if the percentage is to be shown numerically"
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   756
336
5199e2058981 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   757
    showPercentage := aBoolean.
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   758
    self invalidateRepairNow:true
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   759
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 865
diff changeset
   760
    "Modified: / 6.6.1998 / 19:28:44 / cg"
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   761
! !
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   762
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   763
!ProgressIndicator methodsFor:'change & update'!
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   764
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   765
update:aspect with:aParameter from:changedObject
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   766
    "react upon value changes of my model"
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   767
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   768
    (aspect == aspectMsg
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   769
    and:[changedObject == model]) ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   770
	self percentage:(model perform:aspectMsg).
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   771
	^ self
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   772
    ].
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   773
    changedObject == showBusy ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   774
	self redraw.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   775
	^ self
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   776
    ].
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   777
    ^ super update:aspect with:aParameter from:changedObject
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   778
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   779
    "Modified: / 21.10.1998 / 18:01:52 / cg"
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   780
! !
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   781
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   782
!ProgressIndicator methodsFor:'drawing'!
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   783
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   784
redraw
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   785
    "redraw the percentage bar and optional percentage string"
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   786
2040
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   787
    |s lx rx sx sy sw m2 m w h doBusy|
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   788
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   789
    m := margin + 1.
863
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   790
    m2 := m*2.
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   791
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   792
    w := width - m2.
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   793
    h := height - m2.
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   794
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 865
diff changeset
   795
"/    self clear.
863
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   796
2040
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   797
    doBusy := showBusy value.
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   798
    doBusy ifFalse:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   799
	percentage value < 0 ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   800
	    self startBusyIndicationProcess.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   801
	    doBusy := true.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   802
	].        
2040
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   803
    ].
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   804
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   805
    doBusy ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   806
	self paint:bgColor.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   807
	self fillRectangleX:m y:m width:w height:h.
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   808
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   809
	lx := (w * busyPosition / 100) rounded.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   810
	rx := (w * (busyPosition + 20) / 100) rounded.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   811
	rx := rx min:w.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   812
	lx := lx max:m.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   813
	self paint:fgColor.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   814
	self fillRectangleX:lx y:m width:(rx - lx) height:h.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   815
	^ self
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   816
    ].
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   817
2040
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   818
    self stopBusyIndicationProcess.
702df7addef9 busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents: 1935
diff changeset
   819
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   820
    rx := (w * percentage / 100) rounded.
826
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   821
    self paint:bgColor.
843
34de7f6bea2d do only draw what to draw
tz
parents: 826
diff changeset
   822
    self fillRectangleX:m+rx y:m width:w-rx height:h.
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   823
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   824
    showPercentage ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   825
	s := percentage printString , ' %'.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   826
	font := font onDevice:device.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   827
	sw := font widthOf:s .
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   828
	sx := (width - sw) // 2.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   829
	sy := height // 2 + font descent + 2.
347
3264e5caa799 fixed #fgColor;
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   830
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   831
	rx <= (sx+sw) ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   832
	    self paint:Color black.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   833
	    self displayString:s x:sx y:sy.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   834
	]
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   835
    ].
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   836
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   837
    self paint:fgColor.
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   838
    self fillRectangleX:m y:m width:rx height:h.
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   839
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   840
    showPercentage ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   841
	rx >= sx ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   842
	    self clippingRectangle:(m@m corner:rx+1 @ h).
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   843
	    self paint:Color white.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   844
	    self displayString:s x:sx y:sy.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   845
	    self clippingRectangle:nil
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   846
	]
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   847
    ]
347
3264e5caa799 fixed #fgColor;
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   848
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   849
    "Modified: / 21.10.1998 / 18:01:58 / cg"
863
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   850
!
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   851
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   852
sizeChanged:how
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   853
    super sizeChanged:how.
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   854
    self invalidate
863
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   855
a401ecea61a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
   856
    "Created: / 18.4.1998 / 02:34:37 / cg"
865
5c15ad847ad2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   857
    "Modified: / 18.4.1998 / 14:09:40 / cg"
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   858
! !
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   859
2501
832cbac295b8 method category rename
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   860
!ProgressIndicator methodsFor:'initialization & release'!
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   861
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   862
destroy
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   863
    busyIndicationProcess notNil ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   864
	self stopBusyIndicationProcess
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   865
    ].
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   866
    super destroy.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   867
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   868
    "Created: / 21.10.1998 / 17:29:58 / cg"
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   869
    "Modified: / 21.10.1998 / 17:30:36 / cg"
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   870
!
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   871
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   872
initStyle
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   873
    "initialize styleSheet values"
335
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   874
575
9279151db8f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
   875
    <resource: #style (#'progressIndicator.viewBackground'
2921
1e8c394e895e resource directive
Claus Gittinger <cg@exept.de>
parents: 2878
diff changeset
   876
                       #'progressIndicator.foregroundColor')>
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   877
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   878
    super initStyle.
335
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   879
347
3264e5caa799 fixed #fgColor;
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   880
    self is3D ifTrue:[
2921
1e8c394e895e resource directive
Claus Gittinger <cg@exept.de>
parents: 2878
diff changeset
   881
        self level:-1
347
3264e5caa799 fixed #fgColor;
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   882
    ].
3264e5caa799 fixed #fgColor;
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   883
826
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   884
    bgColor := styleSheet colorAt:'progressIndicator.viewBackground' default:Color white.
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   885
    fgColor := styleSheet colorAt:'progressIndicator.foregroundColor' default:Color blue.
335
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   886
    fgColor := fgColor onDevice:device.
6f007bdeae94 resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   887
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   888
    showPercentage := true.
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   889
!
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   890
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   891
initialize
826
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   892
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   893
    super initialize.
826
d8470e26754d revised for the docu (step 4)
tz
parents: 634
diff changeset
   894
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   895
    percentage := 0.
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   896
    showBusy := false.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   897
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   898
    "Modified: / 21.10.1998 / 17:33:02 / cg"
1935
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   899
!
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   900
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   901
mapped
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   902
    super mapped.
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   903
    (showBusy value) ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   904
	self startBusyIndicationProcess.
1935
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   905
    ].
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   906
!
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   907
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   908
unmapped
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   909
    super unmapped.
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   910
    (showBusy value) ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   911
	self stopBusyIndicationProcess.
1935
a2338e64cf2f terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents: 1852
diff changeset
   912
    ].
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   913
! !
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   914
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   915
!ProgressIndicator methodsFor:'private'!
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   916
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   917
connectToTop:top label:label
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   918
    connectedTop := top.
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   919
    connectedLabel := label
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   920
!
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   921
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   922
startBusyIndicationProcess
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   923
    busyIndicationProcess isNil ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   924
	busyPosition := 0.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   925
	busyDelta := 5.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   926
	busyIndicationProcess := [
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   927
				    [self realized] whileTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   928
					Delay waitForSeconds:0.2.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   929
					self shown ifTrue:[
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   930
					    self updateBusyIndicatorPosition.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   931
					]
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   932
				    ].
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   933
				    busyIndicationProcess := nil.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   934
				 ] fork.
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   935
    ].
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   936
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   937
    "Created: / 21.10.1998 / 18:02:35 / cg"
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   938
    "Modified: / 21.10.1998 / 18:03:49 / cg"
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   939
!
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   940
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   941
stopBusyIndicationProcess
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   942
    busyIndicationProcess notNil ifTrue:[
2563
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   943
	busyIndicationProcess terminate.
b04147223487 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
   944
	busyIndicationProcess := nil
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   945
    ].
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   946
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   947
    "Created: / 21.10.1998 / 17:30:19 / cg"
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   948
!
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   949
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   950
updateBusyIndicatorPosition
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   951
    busyPosition := busyPosition + busyDelta.
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   952
    busyPosition >= 80 ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   953
        busyDelta > 0 ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   954
            busyDelta := busyDelta negated.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   955
        ]
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   956
    ] ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   957
        busyPosition <= 0 ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   958
            busyDelta < 0 ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   959
                busyDelta := busyDelta negated.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   960
            ]
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   961
        ]
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   962
    ].
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
   963
    self invalidate
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   964
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   965
    "Created: / 21.10.1998 / 17:33:28 / cg"
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   966
    "Modified: / 21.10.1998 / 17:58:58 / cg"
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   967
! !
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   968
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   969
!ProgressIndicator methodsFor:'queries'!
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   970
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   971
preferredExtent
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   972
    "return my preferred extent"
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   973
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   974
    preferredExtent notNil ifTrue:[
634
cee0d1f706e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   975
	^ preferredExtent
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   976
    ].
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   977
    ^ 100 @ (font height + font descent + ((margin + 1) * 2))
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
   978
574
be7f980eb6dc commentary
Claus Gittinger <cg@exept.de>
parents: 347
diff changeset
   979
    "Modified: 22.10.1997 / 21:07:17 / cg"
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   980
! !
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   981
62
claus
parents: 50
diff changeset
   982
!ProgressIndicator methodsFor:'showing progress'!
claus
parents: 50
diff changeset
   983
2850
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   984
showBusyIndicatorDuring:aBlock
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   985
    "show progress, while evaluating aBlock.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   986
     If the receiver has been created with inBox, show the
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   987
     box centered on the screen. If not, the view is assumed to
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   988
     be contained in another view, and no special startup actions
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   989
     are performed.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   990
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   991
     Caveat: cannot (currently) suppress close of the box ..."
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   992
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   993
    |labelValue p|
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   994
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   995
    connectedLabel notNil ifTrue:[
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   996
        labelValue := (connectedLabel label ? '') asValue.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   997
        connectedLabel 
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   998
            model:labelValue;
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
   999
            aspect:#value;
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1000
            labelMessage:#value.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1001
    ] ifFalse:[
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1002
        labelValue := '' asValue.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1003
    ].
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1004
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1005
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1006
    "/ the worker process
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1007
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1008
    p := [
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1009
        [
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1010
            WindowGroup windowGroupQuerySignal handle:[:ex |
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1011
                ex proceedWith:self topView windowGroup
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1012
            ] do:[
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1013
                aBlock value
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1014
            ]
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1015
        ] ensure:[
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1016
            p := nil.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1017
            closeTopWhenDone ifTrue:[
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1018
                connectedTop hide
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1019
            ].
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1020
            finishAction value
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1021
        ]
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1022
    ] newProcess.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1023
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1024
    Processor activeProcess 
2878
6a88c8ffeb14 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
  1025
        withHigherPriorityDo:
6a88c8ffeb14 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
  1026
            [
6a88c8ffeb14 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
  1027
                p resume.
6a88c8ffeb14 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
  1028
                self topView show.
6a88c8ffeb14 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
  1029
            ].
2850
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1030
    p notNil ifTrue:[p terminate].
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1031
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1032
    "
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1033
      |p|
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1034
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1035
      p := ProgressIndicator inBox.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1036
      p showBusyIndication:true.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1037
      p showProgressOf:
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1038
            [:progressValue :currentAction |
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1039
                1 to:200 do:[:percent |
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1040
                    (Delay forSeconds:0.05) wait.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1041
                    progressValue value:percent 
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1042
                ].
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1043
            ].
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1044
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1045
      'it can be reused ...'.  
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1046
      p showBusyIndication:false.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1047
      p showProgressOf:
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1048
            [:progressValue :currentAction |
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1049
                1 to:100 by:5 do:[:percent |
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1050
                    (Delay forSeconds:0.05) wait.
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1051
                    progressValue value:percent 
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1052
                ].
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1053
            ].
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1054
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1055
    "
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1056
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1057
    "Modified: / 21.10.1998 / 17:37:00 / cg"
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1058
!
4e58a7e9c323 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2837
diff changeset
  1059
62
claus
parents: 50
diff changeset
  1060
showProgressOf:aBlock
claus
parents: 50
diff changeset
  1061
    "show progress, while evaluating aBlock.
claus
parents: 50
diff changeset
  1062
     If the receiver has been created with inBox, show the
claus
parents: 50
diff changeset
  1063
     box centered on the screen. If not, the view is assumed to
claus
parents: 50
diff changeset
  1064
     be contained in another view, and no special startup actions
claus
parents: 50
diff changeset
  1065
     are performed.
claus
parents: 50
diff changeset
  1066
claus
parents: 50
diff changeset
  1067
     The block is passed two arguments, the progressValue,
claus
parents: 50
diff changeset
  1068
     which should be set to the percentage from time-to-time
claus
parents: 50
diff changeset
  1069
     within the block and an action value, which should be set to
claus
parents: 50
diff changeset
  1070
     the currently performed action (a string) from time to time.
claus
parents: 50
diff changeset
  1071
     The second valueHolder can be left unchanged.
claus
parents: 50
diff changeset
  1072
claus
parents: 50
diff changeset
  1073
     Caveat: cannot (currently) suppress close of the box ..."
claus
parents: 50
diff changeset
  1074
221
976e5a608dfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
  1075
    |progressValue labelValue p|
62
claus
parents: 50
diff changeset
  1076
claus
parents: 50
diff changeset
  1077
    progressValue := 0 asValue.
claus
parents: 50
diff changeset
  1078
claus
parents: 50
diff changeset
  1079
    connectedLabel notNil ifTrue:[
2837
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1080
        labelValue := (connectedLabel label ? '') asValue.
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1081
        connectedLabel 
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1082
            model:labelValue;
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1083
            aspect:#value;
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1084
            labelMessage:#value.
1834
ba170c21ed76 defaultExtent computation fixed
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
  1085
    ] ifFalse:[
2837
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1086
        labelValue := '' asValue.
62
claus
parents: 50
diff changeset
  1087
    ].
claus
parents: 50
diff changeset
  1088
1834
ba170c21ed76 defaultExtent computation fixed
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
  1089
62
claus
parents: 50
diff changeset
  1090
    self model:progressValue.
claus
parents: 50
diff changeset
  1091
221
976e5a608dfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
  1092
    "/ the worker process
976e5a608dfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 220
diff changeset
  1093
62
claus
parents: 50
diff changeset
  1094
    p := [
2837
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1095
        [
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1096
            WindowGroup windowGroupQuerySignal handle:[:ex |
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1097
                ex proceedWith:self topView windowGroup
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1098
            ] do:[
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1099
                aBlock value:progressValue value:labelValue
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1100
            ]
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1101
        ] ensure:[
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1102
            p := nil.
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1103
            closeTopWhenDone ifTrue:[
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1104
                connectedTop hide
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1105
            ].
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1106
            finishAction value
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1107
        ]
1850
e22e95d8f184 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1108
    ] newProcess.
62
claus
parents: 50
diff changeset
  1109
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1110
    Processor activeProcess 
2878
6a88c8ffeb14 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
  1111
        withHigherPriorityDo:[
2837
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1112
            p resume.
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1113
            self topView show.
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1114
        ].
237
ecea4b3a34ce more interfaces
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1115
    p notNil ifTrue:[p terminate].
62
claus
parents: 50
diff changeset
  1116
claus
parents: 50
diff changeset
  1117
    "
claus
parents: 50
diff changeset
  1118
      |p|
claus
parents: 50
diff changeset
  1119
claus
parents: 50
diff changeset
  1120
      p := ProgressIndicator inBox.
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
  1121
      p showBusyIndication:true.
62
claus
parents: 50
diff changeset
  1122
      p showProgressOf:
2837
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1123
            [:progressValue :currentAction |
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1124
                1 to:200 do:[:percent |
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1125
                    (Delay forSeconds:0.05) wait.
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1126
                    progressValue value:percent 
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1127
                ].
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1128
            ].
62
claus
parents: 50
diff changeset
  1129
claus
parents: 50
diff changeset
  1130
      'it can be reused ...'.  
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
  1131
      p showBusyIndication:false.
62
claus
parents: 50
diff changeset
  1132
      p showProgressOf:
2837
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1133
            [:progressValue :currentAction |
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1134
                1 to:100 by:5 do:[:percent |
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1135
                    (Delay forSeconds:0.05) wait.
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1136
                    progressValue value:percent 
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1137
                ].
d788335f2010 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1138
            ].
62
claus
parents: 50
diff changeset
  1139
claus
parents: 50
diff changeset
  1140
    "
219
44246b9b4288 use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents: 201
diff changeset
  1141
1168
35e46761842f added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
  1142
    "Modified: / 21.10.1998 / 17:37:00 / cg"
62
claus
parents: 50
diff changeset
  1143
! !
claus
parents: 50
diff changeset
  1144
334
8af14110efdb comments & category changes
Claus Gittinger <cg@exept.de>
parents: 237
diff changeset
  1145
!ProgressIndicator class methodsFor:'documentation'!
50
claus
parents:
diff changeset
  1146
183
c63a4f284a6d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1147
version
3442
5cd8447cf5a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3430
diff changeset
  1148
    ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.55 2008-06-09 15:17:20 cg Exp $'
50
claus
parents:
diff changeset
  1149
! !