-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHotDraw HotPaint.pst
554 lines (467 loc) · 36.6 KB
/
HotDraw HotPaint.pst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
<?xml version="1.0"?>
<st-source>
<!--
Name: HotDraw HotPaint
Notice: Copyright 1993 - 2013 John Brant
This utility is made available to use under the MIT license, as detailed below.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
DbIdentifier: psql_public_cst_2007
DbTrace: 87407
DbUsername: niallr
DbVersion: 1.5
DevelopmentPrerequisites: #(#(#any 'HotDraw Framework' ''))
PackageName: HotDraw HotPaint
Parcel: #('HotDraw HotPaint')
ParcelName: HotDraw HotPaint
PrerequisiteParcels: #(#('HotDraw Framework' ''))
PrintStringCache: (1.5,niallr)
Version: 1.5
Post-Load Block:
[:pkg | Refactory.HotDraw.HotPaintEditor postLoadActionFor: pkg]
Date: 3:03:03 PM April 5, 2013
-->
<time-stamp>From VisualWorks®, Pre-Release 7.10 (mar13.4) of 22 March 2013 on 5 April 2013 at 15:03:03</time-stamp>
<do-it>(Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.']</do-it>
<class>
<name>CanvasFigure</name>
<environment>Refactory.HotDraw</environment>
<super>Refactory.HotDraw.Figure</super>
<private>false</private>
<indexed-type>none</indexed-type>
<inst-vars>pixmap width </inst-vars>
<class-inst-vars></class-inst-vars>
<imports></imports>
<category>HotDraw-HotPaint</category>
<attributes>
<package>HotDraw HotPaint</package>
</attributes>
</class>
<comment>
<class-id>Refactory.HotDraw.CanvasFigure</class-id>
<body>A CanvasFigure is a concrete subclass that can be painted with painting tools
like the airbrush and paintbrush. It uses color, too.</body>
</comment>
<class>
<name>HotPaintEditor</name>
<environment>Refactory.HotDraw</environment>
<super>Refactory.HotDraw.DrawingEditor</super>
<private>false</private>
<indexed-type>none</indexed-type>
<inst-vars></inst-vars>
<class-inst-vars></class-inst-vars>
<imports></imports>
<category>HotDraw-HotPaint</category>
<attributes>
<package>HotDraw HotPaint</package>
</attributes>
</class>
<comment>
<class-id>Refactory.HotDraw.HotPaintEditor</class-id>
<body>This editor is a typical HotDraw editor except that it contains tools for creating CanvasFigures and painting on them.
HotPaintEditor open</body>
</comment>
<methods>
<class-id>Refactory.HotDraw.CanvasFigure</class-id> <category>private</category>
<body package="HotDraw HotPaint">brushWidth
^self width ** 2</body>
<body package="HotDraw HotPaint">resetBounds
| newPixmap extent |
extent := self bounds extent - (self lineWidth * 2).
(extent x <= 0 or: [extent y <= 0]) ifTrue: [extent := 0 @ 0].
(pixmap notNil and: [extent = pixmap extent]) ifTrue: [^self].
newPixmap := Pixmap extent: extent.
pixmap isNil
ifFalse: [pixmap displayOn: newPixmap graphicsContext at: 0 @ 0].
pixmap := newPixmap</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.CanvasFigure</class-id> <category>accessing</category>
<body package="HotDraw HotPaint">menuAt: aPoint
| mb |
mb := MenuBuilder new.
mb beginSubMenuLabeled: 'Tool Width'.
#('1 Smallest' '2 Small' '3 Medium' '4 Big' '5 Biggest') with: (1 to: 5)
do: [:label :i | mb add: label -> [self width: i]].
mb endSubMenu.
mb beginSubMenuLabeled: 'Tool Color'.
#(#black #cyan #red #green #blue #yellow #pink)
do: [:each | mb add: each -> [self fillColor: (ColorValue perform: each)]].
mb endSubMenu.
^mb menu</body>
<body package="HotDraw HotPaint">width
^width</body>
<body package="HotDraw HotPaint">width: anInteger
width := anInteger.
self changed</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.CanvasFigure</class-id> <category>initialize-release</category>
<body package="HotDraw HotPaint">initialize: aRectangle
bounds := aRectangle.
width := 2.
self
lineColor: ColorValue black;
fillColor: ColorValue black;
lineWidth: 1;
resetBounds;
opaque</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.CanvasFigure</class-id> <category>painting</category>
<body package="HotDraw HotPaint">paintAt: aPoint
| aRectangle gc extent |
extent := self brushWidth @ self brushWidth.
aRectangle := aPoint - (extent // 2) - self origin extent: extent.
gc := pixmap graphicsContext paint: self fillColor.
gc
displayWedgeBoundedBy: aRectangle
startAngle: 0
sweepAngle: 360.
self changed</body>
<body package="HotDraw HotPaint">paintAt: aPoint brushMask: aMask
pixmap graphicsContext paint: self fillColor.
pixmap graphicsContext displayImage: aMask
at: aPoint - (8 @ 8) - self origin.
self changed</body>
<body package="HotDraw HotPaint">paintFrom: startPoint to: endPoint
| gc |
gc := pixmap graphicsContext.
gc paint: self fillColor.
gc lineWidth: self brushWidth.
gc displayLineFrom: startPoint - self origin to: endPoint - self origin.
self changed</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.CanvasFigure</class-id> <category>displaying</category>
<body package="HotDraw HotPaint">displayFigureOn: aGraphicsContext
| originForPixmap |
originForPixmap := self origin.
self lineWidth > 0
ifTrue:
[originForPixmap := originForPixmap + self lineWidth.
aGraphicsContext lineWidth: self lineWidth.
aGraphicsContext paint: self lineColor.
aGraphicsContext displayRectangularBorder: self bounds].
pixmap displayOn: aGraphicsContext at: originForPixmap</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.CanvasFigure</class-id> <category>changing</category>
<body package="HotDraw HotPaint">changed: anAspectSymbol with: aParameter
self resetBounds.
super changed: anAspectSymbol with: aParameter</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.CanvasFigure class</class-id> <category>instance creation</category>
<body package="HotDraw HotPaint">createAt: aPoint
^self rectangle: (aPoint corner: aPoint)</body>
<body package="HotDraw HotPaint">rectangle: aRectangle
^self new initialize: aRectangle</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.HotPaintEditor</class-id> <category>drawing description</category>
<body package="HotDraw HotPaint">toolNames
"Return the list of names for the tools."
^super toolNames
, #(nil 'Hot Paint Canvas Tool' 'Hot Paint Paintbrush Tool' 'Hot Paint Mask Tool' 'Hot Paint Image Tool' 'Hot Paint Erase Tool')</body>
<body package="HotDraw HotPaint">windowName
^'Hot Paint Editor'</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.HotPaintEditor class</class-id> <category>accessing</category>
<body package="HotDraw HotPaint">images
| anArrayOfBits anArrayOfMasks |
anArrayOfBits := #(#[3 224 7 240 12 24 24 12 48 6 96 2 68 35 192 129 129 1 194 2 83 146 72 38 103 196 48 12 14 24 3 224] #[24 24 60 60 126 126 255 255 255 255 255 255 255 255 255 255 127 254 63 252 31 248 15 248 7 240 3 224 1 192 0 128]).
anArrayOfMasks := Array new: anArrayOfBits size.
^(1 to: anArrayOfBits size) collect:
[:i |
anArrayOfMasks at: i
put: (Image
extent: 16 @ 16
depth: 1
palette: (MappedPalette with: ColorValue white with: ColorValue red)
bits: (anArrayOfBits at: i)
pad: 8)]</body>
<body package="HotDraw HotPaint">paintStyles
| anArrayOfBits anArrayOfMasks |
anArrayOfBits := #(#[0 0 0 0 0 0 0 0 0 0 4 64 0 0 1 0 0 0 4 64 0 0 0 0 0 0 0 0 0 0 0 0] #[0 0 0 0 0 0 0 0 2 128 0 0 2 72 0 16 0 192 1 0 4 136 2 160 1 0 0 0 0 0 0 0] #[0 0 0 0 0 72 24 72 4 80 1 0 0 64 48 70 30 208 0 96 2 80 0 64 4 8 8 64 16 68 32 2] #[0 64 1 0 4 8 83 16 42 196 36 129 0 72 74 156 66 201 41 0 32 73 2 164 9 16 16 40 3 68 0 0] #[0 0 5 132 43 112 20 188 107 86 89 184 62 164 75 254 30 210 115 76 93 184 54 98 37 84 58 168 77 210 0 0]).
anArrayOfMasks := Array new: anArrayOfBits size.
^(1 to: anArrayOfBits size) collect:
[:i |
anArrayOfMasks at: i
put: (Image
extent: 16 @ 16
depth: 1
palette: CoveragePalette monoMaskPalette
bits: (anArrayOfBits at: i)
pad: 8)]</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.HotPaintEditor class</class-id> <category>resources</category>
<body package="HotDraw HotPaint">hotPaintEraseIcon
^OpaqueImage figure: self hotPaintEraseImage
shape: self hotPaintEraseMask</body>
<body package="HotDraw HotPaint">hotPaintImageIcon
^OpaqueImage figure: self hotPaintImageImage
shape: self hotPaintImageMask</body>
<body package="HotDraw HotPaint">hotPaintMaskIcon
^OpaqueImage figure: self hotPaintMaskImage
shape: self hotPaintMaskMask</body>
<body package="HotDraw HotPaint">hotPaintPaintbrushIcon
^OpaqueImage figure: self hotPaintPaintbrushImage
shape: self hotPaintPaintbrushMask</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.HotPaintEditor class</class-id> <category>parcel load/unload/save</category>
<body package="HotDraw HotPaint">obsolete
[Tool reinitialize] on: Error do: [:ex | ex return: nil].
super obsolete</body>
<body package="HotDraw HotPaint">postLoadActionFor: aParcel
Tool reinitialize</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.Tool class</class-id> <category>tool states</category>
<body package="HotDraw HotPaint">initializeCanvasToolStates
"This method was automatically generated by the HotDraw ToolStateMachineEditor.
To edit this method, evaluate the comment below"
"| states transitions stateTable |
states := ((OrderedCollection new) add: (ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Create Origin/Corner Figure'; instVarAt: 3 put: '[:tool :event | ]'; instVarAt: 4 put: (Point x: 59 y: 197); instVarAt: 5 put: false; instVarAt: 6 put: true; yourself); add: (ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Hot Paint Canvas Tool'; instVarAt: 3 put: (Text string: '[:tool :event |
tool valueAt: #class put: CanvasFigure.
tool cursor: Cursor origin]' runs: (RunArray runs: #(84) values: #(nil))); instVarAt: 4 put: (Point x: 193 y: 81); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Menu'; instVarAt: 3 put: '[:tool :event | ]'; instVarAt: 4 put: (Point x: 352 y: 199); instVarAt: 5 put: false; instVarAt: 6 put: true; yourself); yourself).
stateTable := Dictionary new.
states do: [:each | stateTable at: each name put: each].
transitions := OrderedCollection new.
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Hot Paint Canvas Tool'); to: (stateTable at: 'Create Origin/Corner Figure'); type: (TransitionType basicNew instVarAt: 1 put: #redButtonPress; yourself); points: ((OrderedCollection new) add: (Point x: 211 y: 106); add: (Point x: 151 y: 197); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Hot Paint Canvas Tool'); to: (stateTable at: 'Menu'); type: (TransitionType basicNew instVarAt: 1 put: #yellowButtonPress; yourself); points: ((OrderedCollection new) add: (Point x: 295 y: 110); add: (Point x: 362 y: 200); yourself); yourself).
ToolStateMachineEditor openWithStates: states connections: transitions"
Tool states at: 'Hot Paint Canvas Tool' put: (ToolState name: 'Hot Paint Canvas Tool' command: [:tool :event |
tool valueAt: #class put: CanvasFigure.
tool cursor: Cursor origin]).
(Tool stateFor: 'Hot Paint Canvas Tool') redButtonPress: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Create Origin/Corner Figure'); yourself).
(Tool stateFor: 'Hot Paint Canvas Tool') yellowButtonPress: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Menu'); yourself).</body>
<body package="HotDraw HotPaint">initializeMaskStates
"This method was automatically generated by the HotDraw ToolStateMachineEditor.
To edit this method, evaluate the comment below"
"| states transitions stateTable |
states := ((Core.OrderedCollection new) add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Press Mask (HotPaint)'; instVarAt: 3 put: '[:tool :event |
tool valueAt: #figure put: (tool figureAtEvent: event).
]'; instVarAt: 4 put: (Core.Point x: 111 y: 209); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Paint Mask (HotPaint)'; instVarAt: 3 put: (Text string: '[:tool :event |
| masks mask figure |
figure := tool valueAt: #figure.
masks := tool valueAt: #masks.
mask := masks at: ((figure width min: masks size) max: 1).
figure paintAt: (tool cursorPointFor: event)
brushMask: mask]' runs: (Core.RunArray runs: #(224) values: #(nil))); instVarAt: 4 put: (Core.Point x: 115 y: 282); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'End State'; instVarAt: 3 put: '[:tool :event | ]'; instVarAt: 4 put: (Core.Point x: 92 y: 359); instVarAt: 5 put: false; instVarAt: 6 put: true; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Hot Paint Image Tool'; instVarAt: 3 put: (Text string: '[:tool :event |
tool valueAt: #masks put: HotPaintEditor images]' runs: (Core.RunArray runs: #(65) values: #(nil))); instVarAt: 4 put: (Core.Point x: 45 y: 64); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Hot Paint Mask Tool'; instVarAt: 3 put: (Text string: '[:tool :event |
tool valueAt: #masks put: HotPaintEditor paintStyles]' runs: (Core.RunArray runs: #(70) values: #(nil))); instVarAt: 4 put: (Core.Point x: 294 y: 74); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Menu'; instVarAt: 3 put: '[:tool :event | ]'; instVarAt: 4 put: (Core.Point x: 452 y: 196); instVarAt: 5 put: false; instVarAt: 6 put: true; yourself); yourself).
stateTable := Dictionary new.
states do: [:each | stateTable at: each name put: each].
transitions := OrderedCollection new.
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Paint Mask (HotPaint)'); to: (stateTable at: 'Paint Mask (HotPaint)'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #mouseMove; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 245.679 y: 292.614); add: (Core.Point x: 309 y: 279); add: (Core.Point x: 309 y: 299); add: (Core.Point x: 241.593 y: 301.313); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Paint Mask (HotPaint)'); to: (stateTable at: 'End State'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #redButtonRelease; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 162.384 y: 308.896); add: (Core.Point x: 127.508 y: 357.776); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Hot Paint Image Tool'); to: (stateTable at: 'Press Mask (HotPaint)'); type: (Refactory.HotDraw.FigureTransitionType basicNew instVarAt: 1 put: #redButtonPress; instVarAt: 2 put: ((Core.Array new: 1) at: 1 put: Refactory.HotDraw.CanvasFigure; yourself); yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 81.2093 y: 90.0367); add: (Core.Point x: 120.891 y: 212.901); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Hot Paint Mask Tool'); to: (stateTable at: 'Press Mask (HotPaint)'); type: (Refactory.HotDraw.FigureTransitionType basicNew instVarAt: 1 put: #redButtonPress; instVarAt: 2 put: ((Core.Array new: 1) at: 1 put: Refactory.HotDraw.CanvasFigure; yourself); yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 348.358 y: 101.264); add: (Core.Point x: 219.635 y: 210.125); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Hot Paint Mask Tool'); to: (stateTable at: 'Menu'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #yellowButtonPress; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 369.625 y: 100.812); add: (Core.Point x: 463.263 y: 195.256); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Hot Paint Image Tool'); to: (stateTable at: 'Menu'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #yellowButtonPress; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 170.928 y: 81.2185); add: (Core.Point x: 344 y: 26); add: (Core.Point x: 478 y: 39); add: (Core.Point x: 475.012 y: 195.387); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Press Mask (HotPaint)'); to: (stateTable at: 'Paint Mask (HotPaint)'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #immediate; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 182.125 y: 236.781); add: (Core.Point x: 184.306 y: 280.894); yourself); yourself).
ToolStateMachineEditor openWithStates: states connections: transitions"
Tool states at: 'Press Mask (HotPaint)' put: (ToolState name: 'Press Mask (HotPaint)' command: [:tool :event |
tool valueAt: #figure put: (tool figureAtEvent: event).
]).
Tool states at: 'Paint Mask (HotPaint)' put: (ToolState name: 'Paint Mask (HotPaint)' command: [:tool :event |
| masks mask figure |
figure := tool valueAt: #figure.
masks := tool valueAt: #masks.
mask := masks at: ((figure width min: masks size) max: 1).
figure paintAt: (tool cursorPointFor: event)
brushMask: mask]).
Tool states at: 'Hot Paint Image Tool' put: (ToolState name: 'Hot Paint Image Tool' command: [:tool :event |
tool valueAt: #masks put: HotPaintEditor images]).
Tool states at: 'Hot Paint Mask Tool' put: (ToolState name: 'Hot Paint Mask Tool' command: [:tool :event |
tool valueAt: #masks put: HotPaintEditor paintStyles]).
(Tool stateFor: 'Paint Mask (HotPaint)') mouseMove: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Paint Mask (HotPaint)'); yourself).
(Tool stateFor: 'Paint Mask (HotPaint)') redButtonRelease: ((SimpleTransitionTable new) goto: (Tool stateFor: 'End State'); yourself).
(Tool stateFor: 'Press Mask (HotPaint)') immediate: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Paint Mask (HotPaint)'); yourself).
(Tool stateFor: 'Hot Paint Mask Tool') yellowButtonPress: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Menu'); yourself).
(Tool stateFor: 'Hot Paint Mask Tool') redButtonPress: ((FigureTransitionTable new) on: Refactory.HotDraw.CanvasFigure goto: (Tool stateFor: 'Press Mask (HotPaint)'); yourself).
(Tool stateFor: 'Hot Paint Image Tool') yellowButtonPress: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Menu'); yourself).
(Tool stateFor: 'Hot Paint Image Tool') redButtonPress: ((FigureTransitionTable new) on: Refactory.HotDraw.CanvasFigure goto: (Tool stateFor: 'Press Mask (HotPaint)'); yourself).</body>
<body package="HotDraw HotPaint">initializePaintbrushStates
"This method was automatically generated by the HotDraw ToolStateMachineEditor.
To edit this method, evaluate the comment below"
"| states transitions stateTable |
states := ((Core.OrderedCollection new) add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Hot Paint Erase Tool'; instVarAt: 3 put: '[:tool :event | ]'; instVarAt: 4 put: (Core.Point x: 93 y: 35); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Hot Paint Paintbrush Tool'; instVarAt: 3 put: '[:tool :event | ]'; instVarAt: 4 put: (Core.Point x: 289 y: 26); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Initial Erase State (HotPaint)'; instVarAt: 3 put: '[:tool :event |
| figure |
figure := tool figureAtEvent: event.
tool valueAt: #color put: figure fillColor.
figure fillColor: ColorValue white.
]'; instVarAt: 4 put: (Core.Point x: 75 y: 114); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Start painting (HotPaint)'; instVarAt: 3 put: (Text string: '[:tool :event |
| currentPoint figure |
figure := tool figureAtEvent: event.
currentPoint := tool cursorPointFor: event.
figure paintAt: currentPoint.
tool valueAt: #figure put: figure.
tool valueAt: #lastPoint put: currentPoint
]' runs: (Core.RunArray runs: #(231) values: #(nil))); instVarAt: 4 put: (Core.Point x: 153 y: 175); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Move brush (HotPaint)'; instVarAt: 3 put: (Text string: '[:tool :event |
| currentPoint |
currentPoint := tool cursorPointFor: event.
(tool valueAt: #figure) paintFrom: (tool valueAt: #lastPoint)
to: currentPoint.
tool valueAt: #lastPoint put: currentPoint
]' runs: (Core.RunArray runs: #(203) values: #(nil))); instVarAt: 4 put: (Core.Point x: 282 y: 250); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'End painting (HotPaint)'; instVarAt: 3 put: (Text string: '[:tool :event |
| figure |
figure := tool valueAt: #figure.
figure paintAt: (tool valueAt: #lastPoint).
figure fillColor: (tool valueAt: #color)]' runs: (Core.RunArray runs: #(146) values: #(nil))); instVarAt: 4 put: (Core.Point x: 97 y: 326); instVarAt: 5 put: true; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Initial Paint State (HotPaint)'; instVarAt: 3 put: '[:tool :event |
tool valueAt: #color put: (tool figureAtEvent: event) fillColor.
]'; instVarAt: 4 put: (Core.Point x: 285 y: 116); instVarAt: 5 put: false; instVarAt: 6 put: false; yourself); add: (Refactory.HotDraw.ToolStateModel basicNew instVarAt: 1 put: nil; instVarAt: 2 put: 'Menu'; instVarAt: 3 put: '[:tool :event | ]'; instVarAt: 4 put: (Core.Point x: 40 y: 184); instVarAt: 5 put: false; instVarAt: 6 put: true; yourself); yourself).
stateTable := Dictionary new.
states do: [:each | stateTable at: each name put: each].
transitions := OrderedCollection new.
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Hot Paint Erase Tool'); to: (stateTable at: 'Initial Erase State (HotPaint)'); type: (Refactory.HotDraw.FigureTransitionType basicNew instVarAt: 1 put: #redButtonPress; instVarAt: 2 put: ((Core.Array new: 1) at: 1 put: Refactory.HotDraw.CanvasFigure; yourself); yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 177.75 y: 61.8125); add: (Core.Point x: 197 y: 75); add: (Core.Point x: 170.422 y: 113.391); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Move brush (HotPaint)'); to: (stateTable at: 'End painting (HotPaint)'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #redButtonRelease; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 322.656 y: 275.5); add: (Core.Point x: 201.355 y: 326.395); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Move brush (HotPaint)'); to: (stateTable at: 'Move brush (HotPaint)'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #mouseMove; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 417.812 y: 258.938); add: (Core.Point x: 445 y: 258); add: (Core.Point x: 445 y: 278); add: (Core.Point x: 409.922 y: 271.297); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Start painting (HotPaint)'); to: (stateTable at: 'Move brush (HotPaint)'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #mouseMove; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 250.297 y: 201.547); add: (Core.Point x: 325.802 y: 249.243); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Start painting (HotPaint)'); to: (stateTable at: 'End painting (HotPaint)'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #redButtonRelease; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 220.5 y: 202.875); add: (Core.Point x: 174.363 y: 325.038); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Hot Paint Paintbrush Tool'); to: (stateTable at: 'Initial Paint State (HotPaint)'); type: (Refactory.HotDraw.FigureTransitionType basicNew instVarAt: 1 put: #redButtonPress; instVarAt: 2 put: ((Core.Array new: 1) at: 1 put: Refactory.HotDraw.CanvasFigure; yourself); yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 380.437 y: 52.8125); add: (Core.Point x: 404 y: 75); add: (Core.Point x: 378.406 y: 115.359); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Hot Paint Erase Tool'); to: (stateTable at: 'Menu'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #yellowButtonPress; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 137.125 y: 61.8125); add: (Core.Point x: 59 y: 87); add: (Core.Point x: 63.9609 y: 183.242); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Hot Paint Paintbrush Tool'); to: (stateTable at: 'Menu'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #yellowButtonPress; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 303.32 y: 29.4531); add: (Core.Point x: 215 y: 9); add: (Core.Point x: 84 y: 10); add: (Core.Point x: 40 y: 91); add: (Core.Point x: 50.9141 y: 184.266); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Initial Erase State (HotPaint)'); to: (stateTable at: 'Start painting (HotPaint)'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #immediate; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 172.953 y: 140.82); add: (Core.Point x: 208.845 y: 173.994); yourself); yourself).
transitions add: (ToolStateTransitionModel new from: (stateTable at: 'Initial Paint State (HotPaint)'); to: (stateTable at: 'Start painting (HotPaint)'); type: (Refactory.HotDraw.TransitionType basicNew instVarAt: 1 put: #immediate; yourself); points: ((Core.OrderedCollection new) add: (Core.Point x: 333.273 y: 142.598); add: (Core.Point x: 256.774 y: 174.383); yourself); yourself).
ToolStateMachineEditor openWithStates: states connections: transitions"
Tool states at: 'Hot Paint Erase Tool' put: (ToolState name: 'Hot Paint Erase Tool' command: [:tool :event | ]).
Tool states at: 'Hot Paint Paintbrush Tool' put: (ToolState name: 'Hot Paint Paintbrush Tool' command: [:tool :event | ]).
Tool states at: 'Initial Erase State (HotPaint)' put: (ToolState name: 'Initial Erase State (HotPaint)' command: [:tool :event |
| figure |
figure := tool figureAtEvent: event.
tool valueAt: #color put: figure fillColor.
figure fillColor: ColorValue white.
]).
Tool states at: 'Start painting (HotPaint)' put: (ToolState name: 'Start painting (HotPaint)' command: [:tool :event |
| currentPoint figure |
figure := tool figureAtEvent: event.
currentPoint := tool cursorPointFor: event.
figure paintAt: currentPoint.
tool valueAt: #figure put: figure.
tool valueAt: #lastPoint put: currentPoint
]).
Tool states at: 'Move brush (HotPaint)' put: (ToolState name: 'Move brush (HotPaint)' command: [:tool :event |
| currentPoint |
currentPoint := tool cursorPointFor: event.
(tool valueAt: #figure) paintFrom: (tool valueAt: #lastPoint)
to: currentPoint.
tool valueAt: #lastPoint put: currentPoint
]).
Tool states at: 'End painting (HotPaint)' put: (EndToolState name: 'End painting (HotPaint)' command: [:tool :event |
| figure |
figure := tool valueAt: #figure.
figure paintAt: (tool valueAt: #lastPoint).
figure fillColor: (tool valueAt: #color)]).
Tool states at: 'Initial Paint State (HotPaint)' put: (ToolState name: 'Initial Paint State (HotPaint)' command: [:tool :event |
tool valueAt: #color put: (tool figureAtEvent: event) fillColor.
]).
(Tool stateFor: 'Initial Paint State (HotPaint)') immediate: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Start painting (HotPaint)'); yourself).
(Tool stateFor: 'Move brush (HotPaint)') redButtonRelease: ((SimpleTransitionTable new) goto: (Tool stateFor: 'End painting (HotPaint)'); yourself).
(Tool stateFor: 'Move brush (HotPaint)') mouseMove: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Move brush (HotPaint)'); yourself).
(Tool stateFor: 'Start painting (HotPaint)') mouseMove: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Move brush (HotPaint)'); yourself).
(Tool stateFor: 'Start painting (HotPaint)') redButtonRelease: ((SimpleTransitionTable new) goto: (Tool stateFor: 'End painting (HotPaint)'); yourself).
(Tool stateFor: 'Initial Erase State (HotPaint)') immediate: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Start painting (HotPaint)'); yourself).
(Tool stateFor: 'Hot Paint Paintbrush Tool') yellowButtonPress: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Menu'); yourself).
(Tool stateFor: 'Hot Paint Paintbrush Tool') redButtonPress: ((FigureTransitionTable new) on: Refactory.HotDraw.CanvasFigure goto: (Tool stateFor: 'Initial Paint State (HotPaint)'); yourself).
(Tool stateFor: 'Hot Paint Erase Tool') yellowButtonPress: ((SimpleTransitionTable new) goto: (Tool stateFor: 'Menu'); yourself).
(Tool stateFor: 'Hot Paint Erase Tool') redButtonPress: ((FigureTransitionTable new) on: Refactory.HotDraw.CanvasFigure goto: (Tool stateFor: 'Initial Erase State (HotPaint)'); yourself).</body>
</methods>
<methods>
<class-id>Refactory.HotDraw.HotPaintEditor class</class-id> <category>resources</category>
<body package="HotDraw HotPaint">hotPaintCanvasIcon
"UIMaskEditor new openOnClass: self andSelector: #hotPaintCanvasIcon"
<resource: #image>
^CachedImage on: (Image extent: 16@16 depth: 2 bitsPerPixel: 2 palette: (MappedPalette withColors: ((Array new: 4) at: 1 put: ColorValue black; at: 2 put: ColorValue red; at: 3 put: ColorValue blue; at: 4 put: ColorValue white; yourself)) usingBits: #[0 0 0 0 63 255 255 252 63 255 243 252 63 255 204 252 63 255 243 252 61 247 255 252 61 87 255 252 61 87 255 232 63 95 255 168 63 255 254 172 63 255 250 188 63 255 234 252 63 255 171 252 63 255 175 252 63 255 255 252 0 0 0 0])</body>
<body package="HotDraw HotPaint">hotPaintEraseImage
"UIMaskEditor new openOnClass: self andSelector: #hotPaintEraseImage"
<resource: #image>
^CachedImage on: (Image extent: 16@16 depth: 3 bitsPerPixel: 4 palette: (MappedPalette withColors: ((Array new: 5) at: 1 put: ColorValue black; at: 2 put: (ColorValue red: 3/4 green: 3/4 blue: 0); at: 3 put: ColorValue yellow; at: 4 put: ColorValue white; at: 5 put: (ColorValue red: 3/4 green: 3/4 blue: 3/4); yourself)) usingBits: #[51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 48 0 0 3 51 51 51 51 3 35 35 32 51 51 51 48 50 50 50 0 51 51 51 3 35 35 32 16 51 51 48 50 50 50 1 16 51 51 3 35 35 32 17 3 51 48 50 50 50 1 16 51 51 4 68 68 64 17 3 51 51 4 68 68 64 16 51 51 51 4 68 68 64 3 51 51 51 48 0 0 0 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51])</body>
<body package="HotDraw HotPaint">hotPaintEraseMask
"UIMaskEditor new openOnClass: self andSelector: #hotPaintEraseMask"
<resource: #image>
^CachedImage on: (Image extent: 16@16 depth: 1 bitsPerPixel: 1 palette: CoveragePalette monoMaskPalette usingBits: #[0 0 0 0 0 0 0 0 0 0 0 0 0 126 0 0 0 255 0 0 1 255 0 0 3 255 0 0 7 255 0 0 15 254 0 0 31 252 0 0 63 248 0 0 63 240 0 0 63 224 0 0 31 192 0 0 0 0 0 0 0 0 0 0])</body>
<body package="HotDraw HotPaint">hotPaintImageImage
"UIMaskEditor new openOnClass: self andSelector: #hotPaintImageImage"
<resource: #image>
^CachedImage on: (Image extent: 16@16 depth: 1 bitsPerPixel: 1 palette: MonoMappedPalette blackWhite usingBits: #[255 255 0 0 254 63 0 0 252 31 0 0 252 31 0 0 254 63 0 0 255 127 0 0 255 127 0 0 240 7 0 0 255 127 0 0 255 127 0 0 255 127 0 0 255 127 0 0 254 191 0 0 253 223 0 0 251 239 0 0 247 247 0 0])</body>
<body package="HotDraw HotPaint">hotPaintImageMask
"UIMaskEditor new openOnClass: self andSelector: #hotPaintImageMask"
<resource: #image>
^CachedImage on: (Image extent: 16@16 depth: 1 bitsPerPixel: 1 palette: CoveragePalette monoMaskPalette usingBits: #[0 0 0 0 1 192 0 0 3 224 0 0 3 224 0 0 1 192 0 0 0 128 0 0 0 128 0 0 15 248 0 0 0 128 0 0 0 128 0 0 0 128 0 0 0 128 0 0 1 64 0 0 2 32 0 0 4 16 0 0 8 8 0 0])</body>
<body package="HotDraw HotPaint">hotPaintMaskImage
"UIMaskEditor new openOnClass: self andSelector: #hotPaintMaskImage"
<resource: #image>
^CachedImage on: (Image extent: 16@16 depth: 2 bitsPerPixel: 2 palette: (MappedPalette withColors: ((Array new: 3) at: 1 put: ColorValue black; at: 2 put: ColorValue red; at: 3 put: ColorValue white; yourself)) usingBits: #[170 170 169 169 170 170 154 154 170 170 169 169 170 169 154 154 170 38 169 169 170 41 154 154 160 2 169 169 160 2 154 154 160 2 169 169 160 2 170 154 160 2 170 169 160 2 170 170 160 2 170 170 160 2 170 170 160 2 170 170 170 170 170 170])</body>
<body package="HotDraw HotPaint">hotPaintMaskMask
"UIMaskEditor new openOnClass: self andSelector: #hotPaintMaskMask"
<resource: #image>
^CachedImage on: (Image extent: 16@16 depth: 1 bitsPerPixel: 1 palette: CoveragePalette monoMaskPalette usingBits: #[0 17 0 0 0 68 0 0 0 17 0 0 1 68 0 0 10 17 0 0 9 68 0 0 62 17 0 0 62 68 0 0 62 17 0 0 62 4 0 0 62 1 0 0 62 0 0 0 62 0 0 0 62 0 0 0 62 0 0 0 0 0 0 0])</body>
<body package="HotDraw HotPaint">hotPaintPaintbrushImage
"UIMaskEditor new openOnClass: self andSelector: #hotPaintPaintbrushImage"
<resource: #image>
^CachedImage on: (Image extent: 16@16 depth: 2 bitsPerPixel: 2 palette: (MappedPalette withColors: ((Array new: 3) at: 1 put: ColorValue black; at: 2 put: ColorValue red; at: 3 put: ColorValue white; yourself)) usingBits: #[170 170 170 170 170 170 42 170 170 168 74 170 170 168 74 170 170 168 74 170 170 168 74 170 170 168 74 170 170 161 82 170 170 5 84 42 170 21 85 42 170 0 0 42 170 42 170 42 170 40 138 42 170 40 138 42 168 0 0 170 170 170 170 170])</body>
<body package="HotDraw HotPaint">hotPaintPaintbrushMask
"UIMaskEditor new openOnClass: self andSelector: #hotPaintPaintbrushMask"
<resource: #image>
^CachedImage on: (Image extent: 16@16 depth: 1 bitsPerPixel: 1 palette: CoveragePalette monoMaskPalette usingBits: #[0 0 0 0 0 128 0 0 1 192 0 0 1 192 0 0 1 192 0 0 1 192 0 0 1 192 0 0 3 224 0 0 15 248 0 0 15 248 0 0 15 248 0 0 15 248 0 0 15 248 0 0 15 248 0 0 31 240 0 0 0 0 0 0])</body>
</methods>
<methods>
<class-id>Tools.VisualLauncher</class-id> <category>actions</category>
<body package="HotDraw HotPaint">toolsHotDrawPaint
<menuItem: 'Hot Paint'
nameKey: nil
menu: #(#menuBar #tools #HotDraw)
position: 10.02>
(#{Refactory.HotDraw.HotPaintEditor} valueOrDo: [^self]) open</body>
</methods>
<do-it>"Imported Classes:"</do-it>
<do-it>self error: 'Attempting to file-in parcel imports. Choose terminate or close'</do-it>
<class>
<name>VisualLauncher</name>
<environment>Tools</environment>
<super>UI.ApplicationModel</super>
<private>false</private>
<indexed-type>none</indexed-type>
<inst-vars>menuBar toolBar textCollector toolDock </inst-vars>
<class-inst-vars></class-inst-vars>
<imports></imports>
<category>Tools-Misc</category>
<attributes>
<package>Tools-Misc</package>
</attributes>
</class>
<class>
<name>Figure</name>
<environment>Refactory.HotDraw</environment>
<super>Graphics.VisualPart</super>
<private>false</private>
<indexed-type>none</indexed-type>
<inst-vars>dependents state attributes model bounds </inst-vars>
<class-inst-vars></class-inst-vars>
<imports></imports>
<category>HotDraw-Framework</category>
<attributes>
<package>HotDraw Framework</package>
</attributes>
</class>
<class>
<name>DrawingEditor</name>
<environment>Refactory.HotDraw</environment>
<super>UI.ApplicationModel</super>
<private>false</private>
<indexed-type>none</indexed-type>
<inst-vars>buttons drawing </inst-vars>
<class-inst-vars></class-inst-vars>
<imports></imports>
<category>HotDraw-Framework</category>
<attributes>
<package>HotDraw Framework</package>
</attributes>
</class>
</st-source>