-
Notifications
You must be signed in to change notification settings - Fork 1
/
Morphic-DWM.pck.st
1036 lines (873 loc) · 35.7 KB
/
Morphic-DWM.pck.st
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
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'From Cuis 6.0 [latest update: #5898] on 5 July 2023 at 10:34:01 pm'!
'Description Dynamic tiling window manager for Cuis Smalltalk.'!
!provides: 'Morphic-DWM' 1 80!
SystemOrganization addCategory: #'Morphic-DWM'!
!classDefinition: #WindowStackMorph category: #'Morphic-DWM'!
LayoutMorph subclass: #WindowStackMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-DWM'!
!classDefinition: 'WindowStackMorph class' category: #'Morphic-DWM'!
WindowStackMorph class
instanceVariableNames: ''!
!classDefinition: #WindowTilingMorph category: #'Morphic-DWM'!
LayoutMorph subclass: #WindowTilingMorph
instanceVariableNames: 'mainWindow stack'
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-DWM'!
!classDefinition: 'WindowTilingMorph class' category: #'Morphic-DWM'!
WindowTilingMorph class
instanceVariableNames: ''!
!classDefinition: #WindowManagerMorph category: #'Morphic-DWM'!
BoxedMorph subclass: #WindowManagerMorph
instanceVariableNames: 'pages currentPage ownerExtent highlightedPage'
classVariableNames: 'Current'
poolDictionaries: ''
category: 'Morphic-DWM'!
!classDefinition: 'WindowManagerMorph class' category: #'Morphic-DWM'!
WindowManagerMorph class
instanceVariableNames: ''!
!classDefinition: #DWMTheme category: #'Morphic-DWM'!
Theme subclass: #DWMTheme
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-DWM'!
!classDefinition: 'DWMTheme class' category: #'Morphic-DWM'!
DWMTheme class
instanceVariableNames: ''!
!classDefinition: #WindowManagerPage category: #'Morphic-DWM'!
Object subclass: #WindowManagerPage
instanceVariableNames: 'tilingMorph windows'
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-DWM'!
!classDefinition: 'WindowManagerPage class' category: #'Morphic-DWM'!
WindowManagerPage class
instanceVariableNames: ''!
!WindowStackMorph methodsFor: 'submorphs-add/remove' stamp: 'len 11/18/2015 03:14'!
privateAddMorph: aMorph atIndex: anInteger
aMorph owner == self ifTrue: [^ self].
super privateAddMorph: aMorph atIndex: anInteger! !
!WindowStackMorph methodsFor: 'submorphs-add/remove' stamp: 'len 3/24/2021 15:15:44'!
privateMoveFrontMorph: aMorph
aMorph owner == self ifTrue: [^ self].
^ super privateMoveFrontMorph: aMorph! !
!WindowStackMorph methodsFor: 'submorphs-add/remove' stamp: 'len 11/17/2015 05:57'!
removedMorph: aMorph
super removedMorph: aMorph.
" owner notNil ifTrue: [owner stackChanged]."
self layoutSubmorphs! !
!WindowTilingMorph methodsFor: 'initialization' stamp: 'len 11/19/2015 07:24'!
initialize
super initialize.
self sticky: true! !
!WindowTilingMorph methodsFor: 'submorphs-add/remove' stamp: 'len 11/17/2015 05:58'!
addMorphBack: aMorph
aMorph owner == self ifTrue: [^ self].
^ super addMorphBack: aMorph! !
!WindowTilingMorph methodsFor: 'submorphs-add/remove' stamp: 'len 11/17/2015 04:31'!
addMorphFront: aMorph
aMorph owner == self ifTrue: [^ self]. "we do this to avoid system windows to come to front (and change the desired order wrt the stack) when clicking on them"
^ super addMorphFront: aMorph! !
!WindowTilingMorph methodsFor: 'submorphs-add/remove' stamp: 'len 11/16/2015 05:45'!
addWindow: aSystemWindow
aSystemWindow layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1).
self addMorphBack: aSystemWindow.
mainWindow notNil ifTrue: [self pushWindow].
mainWindow _ aSystemWindow.! !
!WindowTilingMorph methodsFor: 'submorphs-add/remove' stamp: 'len 11/18/2015 03:15'!
privateAddMorph: aMorph atIndex: anInteger
aMorph owner == self ifTrue: [^ self].
super privateAddMorph: aMorph atIndex: anInteger! !
!WindowTilingMorph methodsFor: 'submorphs-add/remove' stamp: 'len 3/24/2021 15:14:40'!
privateMoveBackMorph: aMorph
aMorph owner == self ifTrue: [^ self]. "we do this to avoid system windows to come to front (and change the desired order wrt the stack) when clicking on them"
^ super privateMoveBackMorph: aMorph! !
!WindowTilingMorph methodsFor: 'submorphs-add/remove' stamp: 'len 3/24/2021 15:14:02'!
privateMoveFrontMorph: aMorph
aMorph owner == self ifTrue: [^ self]. "we do this to avoid system windows to come to front (and change the desired order wrt the stack) when clicking on them"
^ super privateMoveFrontMorph: aMorph! !
!WindowTilingMorph methodsFor: 'submorphs-add/remove' stamp: 'len 11/17/2015 05:56'!
removedMorph: aMorph
aMorph == mainWindow
ifTrue: [mainWindow _ nil]
ifFalse: [aMorph == stack ifTrue: [stack _ nil]]! !
!WindowTilingMorph methodsFor: 'private' stamp: 'len 11/16/2015 13:45'!
popWindow
"There's no main window, pop a window from the stack and set it as main window."
stack isNil ifTrue: [^ self].
mainWindow _ stack submorphs detect: [:one | one is: #SystemWindow] ifNone: [].
mainWindow isNil ifTrue: [^ self removeStack].
self addMorphBack: mainWindow.
stack hasSubmorphs ifFalse: [self removeStack]! !
!WindowTilingMorph methodsFor: 'private' stamp: 'len 11/17/2015 03:35'!
pushWindow
"Make room available for a new main window. Push the current main window to the stack."
mainWindow isNil ifTrue: [^ self].
stack isNil
ifTrue:
[stack _ direction == #vertical
ifTrue: [WindowStackMorph newRow layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1); yourself]
ifFalse: [WindowStackMorph newColumn layoutSpec: (LayoutSpec proportionalWidth: 0.8 proportionalHeight: 1); yourself].
stack color: self color.
self addMorphFront: stack].
stack addMorphBack: mainWindow! !
!WindowTilingMorph methodsFor: 'private' stamp: 'len 5/22/2020 09:13:49'!
refresh
mainWindow isNil ifTrue: [self popWindow].
stack isNil ifFalse: [stack hasSubmorphs not ifTrue: [self removeStack]].
stack isNil ifFalse: [stack layoutSubmorphs].
self layoutSubmorphs! !
!WindowTilingMorph methodsFor: 'private' stamp: 'len 11/16/2015 04:38'!
removeStack
stack isNil ifTrue: [^ self].
stack delete.
stack _ nil! !
!WindowManagerMorph methodsFor: 'actions' stamp: 'len 5/22/2020 10:33:53'!
moveWindow: aSystemWindow toPage: anInteger
| newPage |
newPage _ pages at: anInteger.
newPage == currentPage ifTrue: [^ self].
(aSystemWindow hasProperty: #floatingBounds) ifTrue: [^ self].
currentPage windowClosed: aSystemWindow.
aSystemWindow removeHalo.
aSystemWindow visible: false.
newPage windowOpen: aSystemWindow.
self step.
self redrawNeeded! !
!WindowManagerMorph methodsFor: 'actions' stamp: 'len 5/22/2020 10:33:39'!
switchToPage: anInteger
| newPage |
newPage _ pages at: anInteger.
currentPage == newPage ifTrue: [^ self].
" newPage isEmpty ifTrue: [^ currentPage flash]."
currentPage hide.
currentPage _ newPage.
currentPage show.
self step.
self redrawNeeded! !
!WindowManagerMorph methodsFor: 'actions' stamp: 'len 6/6/2023 08:15:22'!
windowToggleTiling: aSystemWIndow
currentPage windowToggleTiling: aSystemWIndow windowsArea: self windowsArea! !
!WindowManagerMorph methodsFor: 'drawing' stamp: 'len 6/6/2023 12:57:37'!
drawOn: aCanvas
| font w rect |
aCanvas fillRectangle: self morphLocalBounds color: color.
font := self font.
w := font lineSpacing.
rect := 0@0 extent: w@w.
pages withIndexDo: [:page :i|
page == currentPage
ifTrue: [aCanvas fillRectangle: (rect insetBy: 1) color: Color black].
i = highlightedPage
ifTrue: [aCanvas frameRectangle: (rect insetBy: 1) borderWidth: 1 color: Color white].
aCanvas
drawString: i printString
at: rect topLeft + (4@1)
font: font
color: (page == currentPage ifTrue: [Color white] ifFalse: [page isEmpty ifTrue: [Color black] ifFalse: [Color gray]]).
rect := rect translatedBy: w@0].
" activeWindowLabel ifNotNil:
[:aString|
aCanvas drawString: activeWindowLabel asString
at: rect topRight + (w@1)
font: font
color: Color black]"! !
!WindowManagerMorph methodsFor: 'events' stamp: 'len 6/6/2023 08:33:14'!
handlesMouseDown: evt
^ true! !
!WindowManagerMorph methodsFor: 'events' stamp: 'len 6/6/2023 12:46:57'!
handlesMouseHover
^ true! !
!WindowManagerMorph methodsFor: 'events' stamp: 'len 6/6/2023 12:38:16'!
handlesMouseOver: evt
^ true! !
!WindowManagerMorph methodsFor: 'events' stamp: 'len 6/6/2023 20:00:50'!
keyStroke: aKeyboardEvent morph: aMorph
"Handle global shortcuts. Return true if the event was handled, false otherwise."
"Global shortcuts should use command (Mac) / alt (PC) key.
Control key is reserved for normal shortcuts (local shortcuts, defined by a morph), except ctrl-esc for the world menu."
| i |
aKeyboardEvent controlKeyPressed ifTrue:
[aKeyboardEvent isEsc ifTrue: [self world invokeWorldMenu. ^true]. ^false].
aKeyboardEvent commandAltKeyPressed ifFalse: [^false].
aKeyboardEvent isEsc
ifTrue: [aMorph owningWindow ifNotNil: [:w| w fullScreen. ^true]].
aKeyboardEvent keyCharacter = $w
ifTrue: [aMorph owningWindow ifNotNil: [:w| w delete. ^true]].
aKeyboardEvent keyCharacter = $t
ifTrue: [aMorph owningWindow ifNotNil: [:w| self windowToggleTiling: w. ^true]].
(aKeyboardEvent keyValue between: $1 asciiValue and: $8 asciiValue)
ifTrue: [self switchToPage: aKeyboardEvent keyValue - $1 asciiValue + 1. ^true].
(i := #(33 64 35 36 37 94 38 42) indexOf: aKeyboardEvent keyValue) > 0
ifTrue: [aMorph owningWindow ifNotNil: [:w| self moveWindow: w toPage: i; switchToPage: i. ^true]].
"Shortcuts to open new windows:"
aKeyboardEvent keyCharacter = $B
ifTrue: [BrowserWindow openBrowser. ^true].
aKeyboardEvent keyCharacter = $W
ifTrue: [Workspace new contents: ''; openLabel: 'Workspace'. ^true].
aKeyboardEvent keyCharacter = $T
ifTrue: [TranscriptWindow openTranscript. ^true].
aKeyboardEvent keyCharacter = $P
ifTrue: [CodePackageListWindow openPackageList. ^true].
aKeyboardEvent keyCharacter = $F
ifTrue: [FileListWindow openFileList. ^true].
aKeyboardEvent keyCharacter = $C
ifTrue: [ChangeSorterWindow open: ChangeSorter new label: nil. ^true].
aKeyboardEvent keyCharacter = $S
ifTrue: [TestRunnerWindow openTestRunner. ^true].
aKeyboardEvent keyCharacter = $M
ifTrue: [MessageNamesWindow open: MessageNames new label: 'Message Names'. ^true].
^ false! !
!WindowManagerMorph methodsFor: 'events' stamp: 'len 6/6/2023 08:32:04'!
mouseButton1Up: aMouseButtonEvent localPosition: localEventPosition
| pageNumber |
pageNumber := (localEventPosition x // self font lineSpacing) rounded + 1.
(pageNumber between: 1 and: 8) ifTrue: [self switchToPage: pageNumber]! !
!WindowManagerMorph methodsFor: 'events' stamp: 'len 6/6/2023 12:57:16'!
mouseHover: aMouseMoveEvent localPosition: localEventPosition
| i |
((i := (localEventPosition x // self defaultHeight + 1) rounded) between: 1 and: 8) ifTrue:
[highlightedPage := i.
self redrawNeeded].! !
!WindowManagerMorph methodsFor: 'events' stamp: 'len 6/6/2023 12:54:23'!
mouseLeave: evt
highlightedPage := nil.
self redrawNeeded! !
!WindowManagerMorph methodsFor: 'events' stamp: 'len 5/22/2020 08:43:45'!
windowClosed: aSystemWindow
currentPage windowClosed: aSystemWindow.
" currentPage isEmpty ifTrue:
[| currentIndex |
currentIndex _ pages indexOf: currentPage.
(currentIndex - 1 to: 1 by: -1), (currentIndex + 1 to: pages size)
do: [:i| (pages at: i) isEmpty ifFalse: [^ self switchToPage: i]]]"! !
!WindowManagerMorph methodsFor: 'events' stamp: 'len 1/28/2022 12:33:32'!
windowOpen: aSystemWindow
currentPage windowOpen: aSystemWindow.
" aSystemWindow addHalo"! !
!WindowManagerMorph methodsFor: 'initialization' stamp: 'len 5/22/2020 15:41:20'!
initialize
super initialize.
self color: (Color white alpha: 0.15).
pages _ (1 to: 8) collect: [:each | WindowManagerPage new].
currentPage _ pages first! !
!WindowManagerMorph methodsFor: 'initialization' stamp: 'len 5/22/2020 09:15:01'!
reset
pages do: [:each| each delete].
pages _ (1 to: 8) collect: [:each | WindowManagerPage new].
currentPage _ pages first.
SystemWindow allSubInstances do: [:each|each isInWorld ifTrue: [self addWindow: each]]! !
!WindowManagerMorph methodsFor: 'stepping' stamp: 'len 1/28/2022 15:41:29'!
step
| newOwnerExtent |
self comeToFront.
newOwnerExtent _ owner morphExtent.
ownerExtent = newOwnerExtent ifFalse: [self updateBounds. ownerExtent _ newOwnerExtent]! !
!WindowManagerMorph methodsFor: 'stepping' stamp: 'len 1/28/2022 12:29:04'!
stepTime
^ 1000! !
!WindowManagerMorph methodsFor: 'submorphs-accessing' stamp: 'len 1/28/2022 15:40:05'!
noteNewOwner: aMorph
"I have just been added as a submorph of aMorph"
Current ifNotNil: [:m| Current delete].
Current _ self.
super noteNewOwner: aMorph.
self reset.
self updateBounds! !
!WindowManagerMorph methodsFor: 'submorphs-add/remove' stamp: 'len 1/28/2022 15:39:38'!
delete
pages do: [:each| each delete].
super delete.
Current == self ifTrue: [Current _ nil]! !
!WindowManagerMorph methodsFor: 'testing' stamp: 'len 5/19/2020 12:23:50'!
isSticky
^true! !
!WindowManagerMorph methodsFor: 'private' stamp: 'len 5/22/2020 08:41:44'!
addWindow: aSystemWindow
currentPage windowOpen: aSystemWindow! !
!WindowManagerMorph methodsFor: 'private' stamp: 'len 5/22/2020 07:53:35'!
defaultHeight
^ self font lineSpacing! !
!WindowManagerMorph methodsFor: 'private' stamp: 'len 6/6/2023 08:39:35'!
defaultWidth
^ self defaultHeight * 8 + 2! !
!WindowManagerMorph methodsFor: 'private' stamp: 'len 6/6/2023 12:57:48'!
font
^ (FontFamily familyNamed: FontFamily defaultFamilyName) atPointSize: 16! !
!WindowManagerMorph methodsFor: 'private' stamp: 'len 6/6/2023 08:40:39'!
updateBounds
| world newPosition area |
world := self world ifNil: [^ self].
newPosition := world morphWidth - self defaultWidth @ (world morphHeight - self defaultHeight).
self morphPosition rounded = newPosition rounded ifTrue: [^ self].
self morphPosition: newPosition extent: self defaultWidth @ self defaultHeight.
area := self windowsArea.
pages do: [:each| each updateBounds: area]! !
!WindowManagerMorph methodsFor: 'private' stamp: 'len 5/25/2020 08:07:35'!
windowsArea
| allowedArea |
allowedArea _ Display boundingBox.
self world ifNotNil: [:w| allowedArea _ allowedArea intersect: w viewBox].
^allowedArea! !
!WindowManagerMorph class methodsFor: 'as yet unclassified' stamp: 'len 5/22/2020 08:33:15'!
current
^ Current! !
!DWMTheme methodsFor: 'colors' stamp: 'len 6/9/2016 17:58'!
acceptButton
^ self successColor! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/13/2015 18:23'!
background
^ Color black! !
!DWMTheme methodsFor: 'colors' stamp: 'len 5/25/2023 19:12:09'!
buttonColorFrom: paneColor
^ paneColor adjustSaturation: -0.03 brightness: -0.1! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/17/2015 23:45'!
buttonLabel
^ Color black! !
!DWMTheme methodsFor: 'colors' stamp: 'len 6/9/2016 17:58'!
cancelButton
^ self errorColor! !
!DWMTheme methodsFor: 'colors' stamp: 'len 6/9/2016 17:51'!
errorColor
^ Color lightRed! !
!DWMTheme methodsFor: 'colors' stamp: 'len 6/9/2016 18:01'!
failureColor
^ Color yellow duller! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/17/2015 23:11'!
focusIndicator
^ self textHighlight lighter! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/17/2015 03:55'!
listMultiHighlightFocused: aBoolean
^ (self listHighlightFocused: aBoolean)
adjustSaturation: 0.0 brightness: 0.15! !
!DWMTheme methodsFor: 'colors' stamp: 'len 12/27/2022 12:28:29'!
paneBackgroundFrom: aColor
" ^ aColor adjustSaturation: 0 brightness: -0.7"
^ aColor alphaMixed: 0.14 with: Color black! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/14/2015 02:39'!
scrollbarButtonColor
^Color black! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/17/2015 23:58'!
scrollbarColor
^ Color black! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/14/2015 02:36'!
scrollbarSliderShadowColor
^Color black! !
!DWMTheme methodsFor: 'colors' stamp: 'len 6/14/2023 13:06:53'!
shout
"
SHTextStylerST80 releaseClassCachedState
"
| green yellow pink blue lilac |
"fav:"
yellow := '#F6FA70'.
blue := '#80DAFF'.
" blue := '#62CDFF'."
green := '#B4FF9F'.
pink := '#FF8AAE'.
" orange := '#FFCBA3'."
lilac := '#ACBCFF'.
"classic:"
" yellow := '#FFFE82'.
blue := '#9ED6FF'.
green := '#ADFFD3'.
purple := '#FF709C'."
"fluo:"
" green := '#A3F307'.
yellow := '#e2f9e2'.
purple := '#f50b86'.
blue := '#05f9e2'."
"neon:"
" yellow := '#F6FA70'.
blue := '#0079FF'.
green := '#00DFA2'.
purple := '#FF0060'."
^ {
#selector -> nil.
#defaults -> #white.
#undefined -> #white. "#(lightRed lighter lighter lighter lighter)."
#comment -> #(lightGray lighter).
#literals -> blue.
#pseudoVariables -> pink. "and bold"
#messages -> #(white).
#incompleteMessages -> #(white).
#arguments -> yellow.
#instVar -> lilac.
#tempBar -> #(white darker).
" #tempVars -> '#F0FFC4'."
" #tempVars -> '#ADFFD3'."
#tempVars -> green.
" #blockTemps -> '#5CFFA7'."
#blockTemps -> green.
" #block -> #(white)."
#blockLevelZero -> #(white).
#blockLevelOne -> #(red muchLighter).
#blockLevelTwo -> #(yellow muchLighter).
#blockLevelThree -> #(green muchLighter).
#blockLevelFour -> #(blue muchLighter).
#blockLevelFive -> #(white darker).
#blockLevelSix -> #(white darker).
#blockLevelSeven -> #(white darker).
#methodTags -> #(lightGray lighter). "#(hotPink)"
}
"
SHTextStylerST80 initialize
"
! !
!DWMTheme methodsFor: 'colors' stamp: 'len 6/9/2016 17:57'!
successColor
^ Color lightGreen duller! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/17/2015 03:57'!
text
^ Color white! !
!DWMTheme methodsFor: 'colors' stamp: 'len 6/14/2023 13:37:17'!
textAutoHighlight
self flag: #fixme. "this needs to change SHTextStylerST80>>#privateConvert to call it."
^ (Color colorFrom: '#FF005C') alpha: 0.5
" ^ (Color colorFrom: '#ff2f8e') alpha: 0.5"
" ^ (Color colorFrom: '#F0FF42') alpha: 0.3"! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/17/2015 23:10'!
textCursor
^ Color white! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/17/2015 22:41'!
textHighlight
^ Color darkGray "Color r: 0.2 g: 0.35 b: 0.45"! !
!DWMTheme methodsFor: 'colors' stamp: 'len 11/13/2015 18:34'!
unfocusedTextHighlightFrom: aColor
^aColor adjustSaturation: 0.0 brightness: -0.15! !
!DWMTheme methodsFor: 'colors' stamp: 'len 3/26/2021 18:09:44'!
windowLabel
^ `Color gray: 0.2`! !
!DWMTheme methodsFor: 'icons' stamp: 'len 3/27/2021 06:02:22'!
closeIcon
^ self cancelIcon! !
!DWMTheme methodsFor: 'initialization' stamp: 'len 7/5/2023 19:57:39'!
initialize
super initialize.
"
TTFontReader smalltalkAssignmentArrowGlyphCodePoint: 16r21E6.
TTFontReader smalltalkReturnArrowGlyphCodePoint: 16r21E7.
TTFontReader smalltalkAssignmentArrowGlyphCodePoint: 16r2B05.
TTFontReader smalltalkReturnArrowGlyphCodePoint: 16r2B06.
TrueTypeFontFamily readAllTrueTypeFontsIn: DirectoryEntry smalltalkImageDirectory / 'TrueTypeFonts' / 'DejaVu' / 'DejaVuSans'.
PreferenceSet
setDefaultFont: 'DejaVu Sans'
spec: #(
(standardListFont 15)
(standardMenuFont 15)
(windowTitleFont 13)
(standardCodeFont 15)
(standardButtonFont 15)).
DisplayScreen runningWorld ifNotNil: [ :world | world fontPreferenceChanged ].
"
Preferences
at: #biggerCursors put: false;
at: #dismissAllOnOptionClose put: true;
at: #subPixelRenderColorFonts put: true;
at: #italicsInShout put: true;
at: #shoutInWorkspaces put: true;
at: #optionalButtons put: false;
at: #showAnnotations put: true;
at: #usePreDebugWindow put: false.
SHTextStylerST80 initialize.
Smalltalk garbageCollect.
UISupervisor ui borderWidth: 0.
WindowManagerMorph new openInWorld startStepping! !
!DWMTheme methodsFor: 'menu colors' stamp: 'len 11/17/2015 03:58'!
menu
^ Color darkGray darker darker! !
!DWMTheme methodsFor: 'menu colors' stamp: 'len 11/17/2015 03:58'!
menuText
^ Color white! !
!DWMTheme methodsFor: 'menu colors' stamp: 'len 11/17/2015 03:59'!
menuTitleBar
^ self menu darker! !
!DWMTheme methodsFor: 'other options' stamp: 'len 5/24/2023 23:33:07'!
buttonBorderWidth
^ 1! !
!DWMTheme methodsFor: 'other options' stamp: 'len 8/5/2022 08:26:40'!
buttonPaneHeight
"Answer the user's preferred default height for button panes."
^(Preferences at: #standardButtonFont) lineSpacing * 10 // 8! !
!DWMTheme methodsFor: 'other options' stamp: 'len 5/24/2023 17:18:00'!
embossedButtonLabels
^ false! !
!DWMTheme methodsFor: 'other options' stamp: 'len 5/24/2023 17:27:46'!
embossedTitles
^ false! !
!DWMTheme methodsFor: 'other options' stamp: 'len 11/16/2015 01:23'!
fullScreenDeskMargin
^ 0! !
!DWMTheme methodsFor: 'other options' stamp: 'len 3/24/2021 15:19:57'!
layoutAdjusterThickness
^ 2! !
!DWMTheme methodsFor: 'other options' stamp: 'len 5/24/2023 23:23:46'!
roundButtons
^ true! !
!DWMTheme methodsFor: 'other options' stamp: 'len 5/24/2023 17:26:06'!
roundWindowCorners
^ true! !
!DWMTheme methodsFor: 'other options' stamp: 'len 5/24/2023 23:51:17'!
roundedButtonRadius
^ 4! !
!DWMTheme methodsFor: 'other options' stamp: 'len 5/24/2023 17:26:43'!
roundedWindowRadius
^6! !
!DWMTheme methodsFor: 'other options' stamp: 'len 5/24/2023 17:19:14'!
scrollbarShowButtons
^ false! !
!DWMTheme methodsFor: 'other options' stamp: 'len 5/24/2023 23:49:27'!
scrollbarThickness
^ 16! !
!DWMTheme methodsFor: 'other options' stamp: 'len 11/16/2015 00:10'!
useTaskbar
^false! !
!DWMTheme methodsFor: 'other options' stamp: 'len 11/17/2015 22:36'!
useUniformColors
^false! !
!DWMTheme methodsFor: 'other options' stamp: 'len 5/24/2023 17:09:29'!
windowBorderWidth
^ 6! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 19:56:15'!
browser
^ Color lightGreen duller! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 19:47:12'!
changeList
^ Color lightCyan duller! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 19:26:06'!
changeSorter
^ Color lightCyan duller! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/22/2020 18:08:30'!
debugger
^ Color lightRed darker! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 11/16/2015 02:16'!
defaultWindowColor
^ Color gray darker! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 20:03:55'!
fileContentsBrowser
^ Color tan! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 19:21:54'!
fileList
^ Color lightMagenta duller! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 19:56:27'!
messageNames
^ Color lightBlue duller! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 19:56:35'!
messageSet
^ Color lightBlue duller! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 20:03:15'!
packageList
^ Color tan! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 20:06:47'!
testRunner
^ Color blue quiteWhiter duller! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 6/25/2016 20:25'!
transcript
^ Color lightOrange! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 19:35:48'!
versionsBrowser
^ Color pink whiter duller! !
!DWMTheme methodsFor: 'tool colors' stamp: 'len 5/26/2020 19:42:16'!
workspace
^ Color lightYellow duller! !
!DWMTheme methodsFor: 'widget colors' stamp: 'len 11/13/2015 19:11'!
textPane
^ Color black! !
!DWMTheme methodsFor: 'private - shout mappings' stamp: 'len 12/18/2022 09:57:31'!
generateShoutConfig
| styles colors |
styles := OrderedCollection new.
colors := self shout as: Dictionary.
{
{self undefined. colors at: #undefined}.
{self defaults . colors at: #defaults}.
{self pseudoVariables . colors at: #pseudoVariables. #bold}.
{self literals . colors at: #literals}.
{self instVar . colors at: #instVar}.
{self messages . colors at: #messages}.
{self blockLevelZero . colors at: #blockLevelZero}.
{self blockLevelOne . colors at: #blockLevelOne}.
{self blockLevelTwo . colors at: #blockLevelTwo}.
{self blockLevelThree . colors at: #blockLevelThree}.
{self blockLevelFour . colors at: #blockLevelFour}.
{self blockLevelFive . colors at: #blockLevelFive}.
{self blockLevelSix . colors at: #blockLevelSix}.
{self blockLevelSeven . colors at: #blockLevelSeven}.
{self tempBar . colors at: #tempBar}.
{self methodTags . colors at: #methodTags . #bold}.
{self globals . colors at: #defaults . #bold}.
{self incompleteMessages . colors at: #incompleteMessages . #underlined}.
{self argumentTypes . colors at: #arguments . self italic}.
{self symbols . colors at: #messages . #bold}.
{self pattern . colors at: #selector . #bold}.
{self ansiAssignment . nil . #bold}.
{self assignment . nil . #bold}.
{self return . nil . #bold}.
{self tempVars . colors at: #tempVars . self italic}.
{self blockTemps . colors at: #blockTemps . self italic}
} do: [ :style |
styles addAll:
(style first
collect: [ :category | | elements |
elements _ style asOrderedCollection.
elements at: 1 put: category.
Array withAll: elements ])].
"Miscellaneous remainder after factoring out commonality:"
styles addAll: {
{#unfinishedString . colors at: #undefined . #normal}.
{#undefinedIdentifier . colors at: #undefined .#bold}.
{#unfinishedComment . colors at: #undefined . self italic}.
{#comment . colors at: #comment . self italic}.
{#string . colors at: #literals . #normal}.
{#literal . nil . self italic}.
{#incompleteIdentifier . colors at: #incompleteMessages . {#italic. #underlined}}.
{#classVar . colors at: #instVar . #bold}.
}.
^ styles! !
!WindowManagerPage methodsFor: 'actions' stamp: 'len 5/5/2018 19:08:29'!
flash
tilingMorph ifNotNil: [:aMorph| aMorph world ifNotNil: [:aWorld| aWorld flash. ^ self]].
windows do: [:each| each world ifNotNil: [:aWorld| aWorld flash. ^ self]]! !
!WindowManagerPage methodsFor: 'actions' stamp: 'len 7/10/2016 08:52'!
hide
tilingMorph notNil ifTrue: [tilingMorph visible: false].
windows do: [:each | (each owner notNil and: [each isReallyVisible]) ifTrue: [each removeHalo; visible: false]]! !
!WindowManagerPage methodsFor: 'actions' stamp: 'len 11/17/2015 02:50'!
show
tilingMorph notNil ifTrue: [tilingMorph visible: true].
windows do: [:each | each visible ifFalse: [each visible: true]]! !
!WindowManagerPage methodsFor: 'actions' stamp: 'len 3/24/2021 13:46:04'!
windowToggleTiling: aSystemWindow windowsArea: windowsArea
| possibleBounds |
aSystemWindow isInWorld ifFalse: [^ self].
aSystemWindow removeHalo.
tilingMorph isNil
ifTrue:
[tilingMorph _ WindowTilingMorph newRow.
aSystemWindow world addMorphBack: tilingMorph.
self updateBounds: windowsArea].
aSystemWindow owner == aSystemWindow world
ifTrue:
[aSystemWindow setProperty: #floatingBounds toValue: aSystemWindow displayBounds.
tilingMorph addWindow: aSystemWindow]
ifFalse:
[aSystemWindow world addMorphFront: aSystemWindow.
possibleBounds _ aSystemWindow valueOfProperty: #floatingBounds.
aSystemWindow removeProperty: #floatingBounds.
aSystemWindow morphPosition: possibleBounds topLeft extent: possibleBounds extent].
tilingMorph refresh.
tilingMorph hasSubmorphs ifFalse: [tilingMorph delete. tilingMorph _ nil]! !
!WindowManagerPage methodsFor: 'events' stamp: 'len 11/17/2015 23:05'!
windowClosed: aSystemWindow
windows remove: aSystemWindow ifAbsent: [].
self refresh! !
!WindowManagerPage methodsFor: 'events' stamp: 'len 11/17/2015 02:28'!
windowOpen: aSystemWindow
windows add: aSystemWindow.
self refresh! !
!WindowManagerPage methodsFor: 'initialization' stamp: 'len 5/22/2020 09:15:31'!
delete
tilingMorph ifNotNil: [tilingMorph delete. tilingMorph _ nil]! !
!WindowManagerPage methodsFor: 'initialization' stamp: 'len 11/16/2015 15:00'!
initialize
windows _ OrderedCollection new! !
!WindowManagerPage methodsFor: 'printing' stamp: 'len 11/16/2015 15:36'!
printOn: aStream
aStream nextPut: $[.
windows do: [:each | aStream print: each] separatedBy: [aStream nextPutAll: '; '].
aStream nextPut: $]! !
!WindowManagerPage methodsFor: 'testing' stamp: 'len 5/3/2018 21:06:42'!
isEmpty
^ windows isEmpty! !
!WindowManagerPage methodsFor: 'private' stamp: 'len 11/17/2015 02:30'!
refresh
tilingMorph isNil ifTrue: [^ self].
tilingMorph refresh.
tilingMorph hasSubmorphs ifFalse: [tilingMorph delete].
tilingMorph isInWorld ifFalse: [tilingMorph _ nil]! !
!WindowManagerPage methodsFor: 'private' stamp: 'len 5/22/2020 09:02:53'!
updateBounds
self runningWorld submorphs do: [:one| (one isKindOf: WindowManagerMorph) ifTrue: [^ self updateBounds: one windowsArea]]! !
!WindowManagerPage methodsFor: 'private' stamp: 'len 5/26/2020 11:42:44'!
updateBounds: windowsArea
tilingMorph ifNotNil: [tilingMorph morphPosition: windowsArea topLeft extent: windowsArea extent].
windows do: [:each| (each hasProperty: #originalBounds) ifTrue: [each morphPosition: windowsArea topLeft extent: windowsArea extent]]
! !
!SystemDictionary methodsFor: '*Morphic-DWM' stamp: 'jmv 8/18/2021 19:52:01'!
quit
"Just quit. No questions asked. No validations done.
Smalltalk quit.
"
self snapshot: false andQuit: true embedded: false clearAllClassState: false! !
!SystemDictionary methodsFor: '*Morphic-DWM' stamp: 'len 1/28/2022 08:37:54'!
save
^ self snapshot: true andQuit: false embedded: false clearAllClassState: false! !
!SystemDictionary methodsFor: '*Morphic-DWM' stamp: 'jmv 8/18/2021 21:03:40'!
saveAndQuit
"Save image and quit. No questions asked.
Smalltalk saveAndQuit.
"
ChangeSet zapAllChangeSets.
^ self
snapshot: true
andQuit: true
embedded: false
clearAllClassState: false.! !
!SmalltalkEditor methodsFor: '*morphic-dwm' stamp: 'len 6/21/2023 13:34:16'!
printIt
"Treat the current text selection as an expression; evaluate it. Insert the
description of the result of evaluation after the selection and then make
this description the new text selection."
self
evaluateSelectionAndDo: [ :result |
| text |
text := model fullPrintIt
ifTrue: [result printText]
ifFalse: [result printTextLimitedTo: 10000].
text := text copyReplaceAll: String lfString with: String lfString, ' '.
text := ' ', text asText shoutDisableEmphasis, '.'.
self afterSelectionInsertAndSelect: (text initialFontFrom: emphasisHere)]
ifFail: [ morph flash ]
profiled: false! !
!RealEstateAgent class methodsFor: '*morphic-dwm' stamp: 'len 5/30/2020 16:27:52'!
screenTopSetback
^ 16! !
!Morph methodsFor: '*morphic-dwm' stamp: 'jmv 12/21/2018 09:21:39'!
focusKeyboardFor: aKeyboardEvent
"If aKeyboardEvent ctrl-tab or shift-ctrl-tab use it to navigate keyboard focus.
Warning: This doesn't work on Windows... the event is not sent"
(aKeyboardEvent keyValue = 9 and: [ aKeyboardEvent controlKeyPressed and: [ aKeyboardEvent rawMacOptionKeyPressed not ]])
ifTrue: [
aKeyboardEvent shiftPressed
ifTrue: [ aKeyboardEvent hand keyboardFocusPrevious ]
ifFalse: [ aKeyboardEvent hand keyboardFocusNext ].
^ true ].
"On Windows use at least some keystroke to navigate morphs... even shift-Tab that should navigate backwards"
"
(aKeyboardEvent keyValue = 9 and: [ aKeyboardEvent shiftPressed and: [ aKeyboardEvent rawMacOptionKeyPressed not ]])
ifTrue: [
aKeyboardEvent hand keyboardFocusNext.
^ true ].
"
"Cycle through windows with cmdAlt + < and cmdAlt + >.
VM and platform peculiarities are hidden in #isCmdAltLessThan and #isCmdAltGreaterThan"
"This was done as an attempt to mimic the Mac OSX keystrokes for 'Move focus to next window in active application'. Unfortunately, it only works if OS X is set to use any other keys for this. If (as for example, with German defaults), OS-X uses these keystrokes, then they are not sent to the VM. This is a long standing issues in Chromium and PhotoShop, for example..."
self disableCode: [
aKeyboardEvent isCmdAltLessThan ifTrue: [
aKeyboardEvent hand activatePreviousWindow.
^true ].
aKeyboardEvent isCmdAltGreaterThan ifTrue: [
aKeyboardEvent hand activateNextWindow.
^true ]].
"Alternative for Mac OS-X: option-Tab and option-shift-Tab"
(aKeyboardEvent keyValue = 9 and: [ aKeyboardEvent rawMacOptionKeyPressed ])
ifTrue: [
aKeyboardEvent shiftPressed
ifTrue: [ aKeyboardEvent hand activatePreviousWindow ]
ifFalse: [ aKeyboardEvent hand activateNextWindow ].
^ true ].
"Alternative for non-Mac OS-X: alt-< and alt->"
(aKeyboardEvent commandAltKeyPressed and: [ aKeyboardEvent keyCharacter = $< ]) ifTrue: [
aKeyboardEvent hand activatePreviousWindow.
^true ].
(aKeyboardEvent commandAltKeyPressed and: [ aKeyboardEvent keyCharacter = $> ]) ifTrue: [
aKeyboardEvent hand activateNextWindow.
^true ].
^false! !
!SystemWindow methodsFor: '*morphic-dwm' stamp: 'len 6/6/2023 08:23:07'!
addWindowControlTo: aMenu
aMenu
add: 'send to back' action: #sendToBack icon: #goBottomIcon;
add: 'make next-to-topmost' action: #makeSecondTopmost icon: #goUpIcon;
addLine;
add: (self isSticky ifTrue: [ 'make draggable' ] ifFalse: [ 'make undraggable' ])
action: #toggleStickiness icon: (self isSticky ifFalse: [#pushPinIcon]);
addLine;
add: 'close (w)' action: #delete icon: #closeIcon;
add: 'tille / untile (t)' action: #toggleTiling icon: #collapseIcon;
add: 'expand / contract (esc)' action: #expandBoxHit icon: #expandIcon;
addLine;
add: 'resize...' action: #resize.
^aMenu! !
!SystemWindow methodsFor: '*morphic-dwm' stamp: 'len 6/6/2023 08:10:30'!
buildWindowMenu
| aMenu |
aMenu := MenuMorph new defaultTarget: self.
aMenu
add: 'change title...' action: #relabel icon: #saveAsIcon;
add: 'window color...' action: #setWindowColor icon: #graphicsIcon.
self hasSaveAs
ifTrue: [ aMenu add: 'Save as ...' action: #saveContents icon: #saveAsIcon ].
aMenu
addLine.
self addWindowControlTo: aMenu.
" self addTileResizerMenuTo: aMenu."
^ aMenu! !
!SystemWindow methodsFor: '*morphic-dwm' stamp: 'len 6/6/2023 08:24:07'!
createCloseButton
^ (PluggableButtonMorph model: self action: #closeBoxHit)
iconDrawSelector: #drawCloseIcon;
setBalloonText: 'close this window (w)';
morphExtent: Theme current titleBarButtonsExtent;
color: Color transparent;
borderWidth: 0! !
!SystemWindow methodsFor: '*morphic-dwm' stamp: 'len 6/6/2023 08:25:07'!
createExpandButton
^ (PluggableButtonMorph model: self action: #expandBoxHit)
iconDrawSelector: #drawExpandIcon;
setBalloonText: 'expand / contract this window (f)';
morphExtent: Theme current titleBarButtonsExtent;
color: Color transparent;
borderWidth: 0! !
!SystemWindow methodsFor: '*morphic-dwm' stamp: 'len 6/6/2023 08:25:17'!
createTileButton
^(PluggableButtonMorph model: self action: #toggleTiling)
iconDrawSelector: #drawCollapseIcon;
setBalloonText: 'tile / untile this window (t)';
morphExtent: Theme current titleBarButtonsExtent;
color: Color transparent;
borderWidth: 0! !
!SystemWindow methodsFor: '*morphic-dwm' stamp: 'len 5/22/2020 08:59:41'!
delete
| thisWorld |
self okToChange ifFalse: [^self].
thisWorld _ self world.
SystemWindow noteTopWindowIn: thisWorld but: self.
self sendToBack.
self removeHalo.
super delete.