-
Notifications
You must be signed in to change notification settings - Fork 7
/
StyledText.pck.st
4594 lines (3944 loc) · 186 KB
/
StyledText.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: #6032] on 17 September 2023 at 8:00:49 pm'!
'Description Please enter a description for this package.'!
!provides: 'StyledText' 1 62!
!requires: 'Cuis-Base' 60 5718 nil!
!requires: 'ExtendedClipboard' 1 15 nil!
!requires: 'RTFExporting' 1 nil nil!
!requires: 'RTFImporting' 1 nil nil!
!requires: 'UI-Entry' 1 35 nil!
!requires: 'RTFTests' 1 nil nil!
SystemOrganization addCategory: #StyledText!
SystemOrganization addCategory: #'StyledText-Morphic-Windows'!
SystemOrganization addCategory: #'StyledText-Morphic'!
SystemOrganization addCategory: #'StyledText-Themes'!
SystemOrganization addCategory: #'StyledText-Tests'!
SystemOrganization addCategory: #'StyledText-Completion'!
SystemOrganization addCategory: #'StyledText-RTF-importing'!
!classDefinition: #StyledTextModel category: #StyledText!
TextModel subclass: #StyledTextModel
instanceVariableNames: 'styleSet fileName'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText'!
!classDefinition: 'StyledTextModel class' category: #StyledText!
StyledTextModel class
instanceVariableNames: ''!
!classDefinition: #StyleSet category: #StyledText!
ActiveModel subclass: #StyleSet
instanceVariableNames: 'paragraphStyles characterStyles volatileParaStyles volatileCharStyles'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText'!
!classDefinition: 'StyleSet class' category: #StyledText!
StyleSet class
instanceVariableNames: ''!
!classDefinition: #StyledTextEditor category: #StyledText!
TextEditor subclass: #StyledTextEditor
instanceVariableNames: 'cmdShortcuts cmdActions'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText'!
!classDefinition: 'StyledTextEditor class' category: #StyledText!
StyledTextEditor class
instanceVariableNames: ''!
!classDefinition: #CharacterStyleReference category: #StyledText!
TextAttribute subclass: #CharacterStyleReference
instanceVariableNames: 'characterStyle'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText'!
!classDefinition: 'CharacterStyleReference class' category: #StyledText!
CharacterStyleReference class
instanceVariableNames: ''!
!classDefinition: #ParagraphStyleReference category: #StyledText!
TextAttribute subclass: #ParagraphStyleReference
instanceVariableNames: 'paragraphStyle'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText'!
!classDefinition: 'ParagraphStyleReference class' category: #StyledText!
ParagraphStyleReference class
instanceVariableNames: ''!
!classDefinition: #ToolbarMorph category: #'StyledText-Morphic-Windows'!
LayoutMorph subclass: #ToolbarMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Morphic-Windows'!
!classDefinition: 'ToolbarMorph class' category: #'StyledText-Morphic-Windows'!
ToolbarMorph class
instanceVariableNames: ''!
!classDefinition: #STEMainMorph category: #'StyledText-Morphic'!
LayoutMorph subclass: #STEMainMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Morphic'!
!classDefinition: 'STEMainMorph class' category: #'StyledText-Morphic'!
STEMainMorph class
instanceVariableNames: ''!
!classDefinition: #PluggableActOnReturnKeyListMorph category: #'StyledText-Morphic-Windows'!
PluggableListMorph subclass: #PluggableActOnReturnKeyListMorph
instanceVariableNames: 'currentIndex'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Morphic-Windows'!
!classDefinition: 'PluggableActOnReturnKeyListMorph class' category: #'StyledText-Morphic-Windows'!
PluggableActOnReturnKeyListMorph class
instanceVariableNames: ''!
!classDefinition: #PluggableStyledTextMorph category: #'StyledText-Morphic-Windows'!
TextModelMorph subclass: #PluggableStyledTextMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Morphic-Windows'!
!classDefinition: 'PluggableStyledTextMorph class' category: #'StyledText-Morphic-Windows'!
PluggableStyledTextMorph class
instanceVariableNames: ''!
!classDefinition: #STEPluggableDropDownListMorph category: #'StyledText-Morphic-Windows'!
PluggableMorph subclass: #STEPluggableDropDownListMorph
instanceVariableNames: 'listMorph getListSelector getIndexSelector setIndexSelector label downButton'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Morphic-Windows'!
!classDefinition: 'STEPluggableDropDownListMorph class' category: #'StyledText-Morphic-Windows'!
STEPluggableDropDownListMorph class
instanceVariableNames: ''!
!classDefinition: #PluggableFilteringDropDownListMorph category: #'StyledText-Morphic-Windows'!
STEPluggableDropDownListMorph subclass: #PluggableFilteringDropDownListMorph
instanceVariableNames: 'editorMorph'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Morphic-Windows'!
!classDefinition: 'PluggableFilteringDropDownListMorph class' category: #'StyledText-Morphic-Windows'!
PluggableFilteringDropDownListMorph class
instanceVariableNames: ''!
!classDefinition: #FilteringDDLEditorMorph category: #'StyledText-Morphic-Windows'!
TextEntryMorph subclass: #FilteringDDLEditorMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Morphic-Windows'!
!classDefinition: 'FilteringDDLEditorMorph class' category: #'StyledText-Morphic-Windows'!
FilteringDDLEditorMorph class
instanceVariableNames: ''!
!classDefinition: #STETheme category: #'StyledText-Themes'!
Theme subclass: #STETheme
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Themes'!
!classDefinition: 'STETheme class' category: #'StyledText-Themes'!
STETheme class
instanceVariableNames: ''!
!classDefinition: #StyledTextEditorTest category: #'StyledText-Tests'!
TestCase subclass: #StyledTextEditorTest
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Tests'!
!classDefinition: 'StyledTextEditorTest class' category: #'StyledText-Tests'!
StyledTextEditorTest class
instanceVariableNames: ''!
!classDefinition: #StyledTextModelTest category: #'StyledText-Tests'!
TestCase subclass: #StyledTextModelTest
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Tests'!
!classDefinition: 'StyledTextModelTest class' category: #'StyledText-Tests'!
StyledTextModelTest class
instanceVariableNames: ''!
!classDefinition: #StyledTextTest category: #'StyledText-Tests'!
TestCase subclass: #StyledTextTest
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Tests'!
!classDefinition: 'StyledTextTest class' category: #'StyledText-Tests'!
StyledTextTest class
instanceVariableNames: ''!
!classDefinition: #STECompleter category: #'StyledText-Completion'!
AutoCompleter subclass: #STECompleter
instanceVariableNames: 'words'
classVariableNames: 'EnglishDict'
poolDictionaries: ''
category: 'StyledText-Completion'!
!classDefinition: 'STECompleter class' category: #'StyledText-Completion'!
STECompleter class
instanceVariableNames: ''!
!classDefinition: #RTFStyledTextBuilder category: #'StyledText-RTF-importing'!
RTFTextBuilder subclass: #RTFStyledTextBuilder
instanceVariableNames: 'paragraphStyleInUse characterStyleInUse'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-RTF-importing'!
!classDefinition: 'RTFStyledTextBuilder class' category: #'StyledText-RTF-importing'!
RTFStyledTextBuilder class
instanceVariableNames: ''!
!classDefinition: #CharacterStyle category: #StyledText!
Object subclass: #CharacterStyle
instanceVariableNames: 'name familyName pointSize emphasis color'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText'!
!classDefinition: 'CharacterStyle class' category: #StyledText!
CharacterStyle class
instanceVariableNames: ''!
!classDefinition: #ParagraphStyle category: #StyledText!
CharacterStyle subclass: #ParagraphStyle
instanceVariableNames: 'alignment tabsArray firstIndent restIndent rightIndent spaceBefore spaceAfter listBulletPattern doesShout'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText'!
!classDefinition: 'ParagraphStyle class' category: #StyledText!
ParagraphStyle class
instanceVariableNames: ''!
!classDefinition: #StyledTextBuilder category: #StyledText!
Object subclass: #StyledTextBuilder
instanceVariableNames: 'styleDict text characterStyleStack textStream'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText'!
!classDefinition: 'StyledTextBuilder class' category: #StyledText!
StyledTextBuilder class
instanceVariableNames: ''!
!classDefinition: #SampleListModel category: #'StyledText-Tests'!
Object subclass: #SampleListModel
instanceVariableNames: 'sel'
classVariableNames: ''
poolDictionaries: ''
category: 'StyledText-Tests'!
!classDefinition: 'SampleListModel class' category: #'StyledText-Tests'!
SampleListModel class
instanceVariableNames: ''!
!StyledTextModel commentStamp: 'jmv 10/16/2013 21:43' prior: 0!
A StyledText is a Text where every character has a ParagraphStyle. All the characters in a Paragraph (including the ending Character newLineCharacter) share the same ParagraphStyle.!
!StyleSet commentStamp: '<historical>' prior: 0!
My instances know some styles (and the keyboard shortcuts to apply them).!
!CharacterStyleReference commentStamp: '<historical>' prior: 0!
A CharacterStyleReference encodes a CharacterStyle change applicable over a given range of text. Instances of CharacterStyleReference (and other TextAttributes) are usually volatile, and they are usually referenced only from the Text.!
!ParagraphStyleReference commentStamp: 'jmv 3/13/2012 11:45' prior: 0!
A ParagraphStyleReference encodes a ParagraphStyle change applicable over a given range of text. Instances of CharacterStyleReference (and other TextAttributes) are usually volatile, and they are usually referenced only from the Text.
Warning: TextAlignment and ParagraphStyleReference should always be applied to whole 'paragraphs' in the text. See #isParagraphAttribute
(
(Text string: 'THIS CLASS HAS NO COMMENT!!', String cStringr attribute: TextColor green),
(Text string: ('Heading of Level 1', String crString) attribute: (ParagraphStyleReference named: 'Heading 1')),
(Text string: ('Heading of Level 2', String crString) attribute: (ParagraphStyleReference named: 'Heading 2')),
(Text string: ('Heading of Level 3', String crString) attribute: (ParagraphStyleReference named: 'Heading 3')),
(Text string: ('This is some emphasized text. ', String crString) attribute: (ParagraphStyleReference named: 'Emphasized')),
(Text string: ('This is some normal text. ', String crString) attribute: (ParagraphStyleReference named: 'Normal')),
(Text string: ('This is some normal text. ', String crString) attribute: (ParagraphStyleReference named: 'Normal')),
(Text string: 'This text has no tyle set')
) edit
This example shows how attributes such as ParagraphStyleReference, that must be applied to whole paragraphs, are indeed done so when concatenating Texts
(
(Text string: 'This text has no style set', String crString),
(Text string: 'This is Heading 1', String crString attribute: (ParagraphStyleReference named: 'Heading 1')),
(Text string: 'no tyle set'),
(Text string: 'This is Heading 1', String crString attribute: (ParagraphStyleReference named: 'Heading 1')),
(Text string: 'no style set'),
(Text string: 'This is Heading 2', String crString attribute: (ParagraphStyleReference named: 'Heading 2')),
(Text string: 'This text has no tsyle set', String cStringr)
) edit!
!PluggableStyledTextMorph commentStamp: '<historical>' prior: 0!
To be used with StyledTextEditors!
!STEPluggableDropDownListMorph commentStamp: '<historical>' prior: 0!
A widget that shows the current value, and can open the full list for user selection.!
!PluggableFilteringDropDownListMorph commentStamp: '<historical>' prior: 0!
A DropDownList that allows typing in, to filter visible items in the list.!
!RTFStyledTextBuilder commentStamp: '<historical>' prior: 0!
Builds styled text!
!CharacterStyle commentStamp: '<historical>' prior: 0!
A CharacterStyle comprises a font and color, and can be applied to any part of a Text via a CharacterStyleReference.
Instances are usually shared. They are not modified often, and any change will affect the style's many users.
They should not be copied, but new instances might be created.!
!ParagraphStyle commentStamp: '<historical>' prior: 0!
A ParagraphStyle comprises the formatting information for composing and displaying a unit (usually a paragraph) of text.
ParagraphStyle instances are shared. They are not modified often, and any change will affect the style's many users.
They should not be copied, but new instances might be created.
Each of my instances consists of...
name If available for general use in the AvailableParagraphStyles dictionary, it is also the key for access
font The default font to use
alignment An integer; text alignment, see ParagraphStyle alignment:
tabsArray An array of integers giving tab offsets in pixels
color Color of the text
firstIndent Left indent (margin) of the first line of a paragraph
restIndent Left indent (margin) for the rest of the paragraph
rightIndent Right indent (margin) of the paragraph
paragraphSpacingBefore Additional vertical spacing to add before a paragraph
paragraphSpacingAfter Additional verital spacing to add after a paragraph
listBulletPattern String pattern for bulleted lists. See the comment at #privateListBulletPattern:
!
!StyledTextBuilder commentStamp: 'jmv 1/25/2011 14:28' prior: 0!
A StyledTextBuilder helps building StyledText instances (i.e. Texts whose only attributes are ParagraphStyles and CharacterStyles) in a convenient way with Smalltalk syntax. See class methods, class references and senders for examples.
Advantages of this approach:
- Text creation code is easy to read and write
- No need to explicitly reference StyledTextBuilder
- No need to add foreign protocol to String, Text or Array
- Supports nesting of character styles
- Takes advantage of Shout to make it easier to see the text and the format!
!SampleListModel commentStamp: 'jmv 9/17/2009 09:46' prior: 0!
(PluggableDropDownListMorph
model: SampleListModel new
listGetter: #list
indexGetter: #sel
indexSetter: #sel:) openInWorld!
!StyledTextModel methodsFor: 'accessing' stamp: 'jmv 8/11/2011 11:27'!
actualContents: aTextOrString
"Merge styles appropriately. Warning: modifies the argument."
super actualContents: (aTextOrString ifNotNil: [
aTextOrString
asText
beStyledTextWith: styleSet])! !
!StyledTextModel methodsFor: 'accessing' stamp: 'jmv 8/11/2011 11:27'!
basicActualContents: aTextOrString
"Merge styles appropriately. Warning: modifies the argument."
super basicActualContents: (aTextOrString ifNotNil: [
aTextOrString
asText
beStyledTextWith: styleSet])! !
!StyledTextModel methodsFor: 'accessing' stamp: 'KenD 4/1/2016 14:35'!
fileName
^fileName! !
!StyledTextModel methodsFor: 'accessing' stamp: 'jmv 4/30/2012 00:08'!
fileName: aString
fileName _ aString! !
!StyledTextModel methodsFor: 'accessing' stamp: 'jmv 8/9/2011 14:40'!
styleSet
^styleSet! !
!StyledTextModel methodsFor: 'accessing' stamp: 'jmv 8/11/2011 11:31'!
styleSet: aStyleSet
"All assignments to the styleSet ivar should call this method."
styleSet ifNotNil: [ styleSet removeActionsWithReceiver: self ].
styleSet _ aStyleSet.
styleSet ifNotNil: [ styleSet when: #stylesChanged send: #styleSetChanged to: self ]! !
!StyledTextModel methodsFor: 'user interface support' stamp: 'jmv 2/16/2016 16:29'!
autoCompleterClass
^STECompleter! !
!StyledTextModel methodsFor: 'user interface support' stamp: 'jmv 2/16/2016 16:29'!
editorClass
^StyledTextEditor! !
!StyledTextModel methodsFor: 'user interface support' stamp: 'jmv 11/3/2016 11:03:59'!
textStylerClass
^SHTextStylerST80! !
!StyledTextModel methodsFor: 'Shout Styling' stamp: 'jmv 9/9/2017 16:15:15'!
formatAndStyleIfNeededWith: anSHTextStyler
| toStyle |
anSHTextStyler ifNotNil: [
(self shouldStyle: self actualContents with: anSHTextStyler) ifTrue: [
self actualContents paragraphStyleChunksDo: [ :interval :paragraphStyle |
paragraphStyle ifNotNil: [ paragraphStyle doesShout ifTrue: [
toStyle _ actualContents copyFrom: interval first to: interval last.
anSHTextStyler formatAndStyle: toStyle allowBackgroundStyleProcess: false.
actualContents replaceFrom: interval first to: interval last with: anSHTextStyler formattedText ]]]]]! !
!StyledTextModel methodsFor: 'Shout Styling' stamp: 'jmv 9/9/2017 16:12:55'!
shouldStyle: text with: anSHTextStyler
"This is a notification that aSHTextStyler is about to re-style its text."
anSHTextStyler classOrMetaClass: nil.
^true! !
!StyledTextModel methodsFor: 'undoable commands' stamp: 'jmv 9/22/2011 15:06'!
logUndoAndRemoveCharacterStylesIn: anInterval
"Remove any char styles from selection"
"This is a user command, and generates undo"
| command |
command _ actualContents commandForRemoveCharacterStylesIn: anInterval.
undoRedoCommands
nextPut: command;
truncateAtPosition. "To disable redo of previous commands, now invalidated."
command doOn: self! !
!StyledTextModel methodsFor: 'undoable commands' stamp: 'jmv 12/29/2011 15:38'!
removeReferencesToCharacterStyle: oldCharacterStyle
"Replace in all contents. Both arguments must be of the same kind (either para or char style)."
"This is a user command, and generates undo"
"Undo not yet implemented. Reasons:
1) it would hold references to unused styles that we might want to die
2) it would require a slower implementation"
self flag: #jmv.
actualContents removeReferencesToCharacterStyle: oldCharacterStyle! !
!StyledTextModel methodsFor: 'undoable commands' stamp: 'jmv 9/21/2011 11:35'!
replaceReferencesToStyle: oldParagraphOrCharacterStyle with: newParagraphOrCharacterStyle
"Replace in all contents. Both arguments must be of the same kind (either para or char style)."
"This is a user command, and generates undo"
"Undo not yet implemented. Reasons:
1) it would hold references to unused styles that we might want to die
2) it would require a slower implementation"
self flag: #jmv.
actualContents replaceReferencesToStyle: oldParagraphOrCharacterStyle with: newParagraphOrCharacterStyle! !
!StyledTextModel methodsFor: 'file save' stamp: 'jmv 12/20/2012 12:21'!
save
"Answer wether save was successful."
"Note: to enable the use of StyledText in applications, where 'accept' or 'save' have other meanings than 'save to file', we need to merge this class with PluggableTextModel, and have the textProvider be the application."
fileName ifNil: [
fileName _ FillInTheBlankMorph
request: 'File name?'
initialAnswer: ''.
fileName isEmpty ifTrue: [ ^false ]].
self saveAs: fileName.
^true! !
!StyledTextModel methodsFor: 'file save' stamp: 'jmv 5/31/2016 11:24'!
saveAs: aName
| refStream |
fileName _ self class withExtension: aName.
self flushUndoRedoCommands.
fileName asFileEntry forceWriteStreamDo: [ :strm |
refStream _ SmartRefStream on: strm.
refStream nextPut: self
].! !
!StyledTextModel methodsFor: 'events' stamp: 'jmv 8/11/2011 11:33'!
styleSetChanged
"Our style set (or some style in it) changed.
Update text and any views."
actualContents beStyledTextWith: styleSet.
self triggerEvent: #stylesChanged! !
!StyledTextModel class methodsFor: 'as yet unclassified' stamp: 'jmv 5/31/2016 11:16'!
fromFileNamed: aFileName
| fileName model |
fileName _ self withExtension: aFileName.
fileName asFileEntry readStreamDo: [ :strm |
model _ (SmartRefStream on: strm) next
].
model fileName: fileName.
"Crude way to fix old Color subInstances in files"
"
Color allInstancesDo: [ :c | c fix ].
TranslucentColor allInstancesDo: [ :c | c fix ].
"
^model! !
!StyledTextModel class methodsFor: 'as yet unclassified' stamp: 'bp 12/21/2011 10:20'!
new
^self styleSet: StyleSet sample! !
!StyledTextModel class methodsFor: 'as yet unclassified' stamp: 'bp 12/21/2011 10:19'!
styleSet: aStyleSet
^super new
styleSet: aStyleSet;
yourself! !
!StyledTextModel class methodsFor: 'as yet unclassified' stamp: 'jmv 4/28/2012 19:10'!
withExtension: aName
| suffix |
suffix := '.object'.
^(aName endsWith: suffix)
ifTrue: [ aName ]
ifFalse: [ aName , suffix ]! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 8/9/2011 11:03'!
autoCompletedStyle
^self characterStyleNamed: 'Completed Text'! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 4/2/2016 23:07'!
characterStyleAt: index
| i ii |
index <= characterStyles size ifTrue: [
^(characterStyles at: index) second ].
volatileParaStyles ifNotNil: [
i _ index - characterStyles size.
ii _ 0.
volatileCharStyles withIndexDo: [ :each :iii |
each ifNotNil: [
ii _ ii + 1.
ii = i ifTrue: [ ^each ]]]].
^nil! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 12/30/2011 09:51'!
characterStyleForShortcut: aCharacter
characterStyles do: [ :pair |
pair first = aCharacter ifTrue: [ ^pair second ]].
^nil! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 4/2/2016 23:07'!
characterStyleIndexOf: aCharacterStyle
| index ii |
index _ characterStyles findFirst: [ :pair | pair second = aCharacterStyle ].
index = 0 ifFalse: [ ^index ].
volatileCharStyles ifNotNil: [
ii _ 0.
volatileCharStyles withIndexDo: [ :each :iii |
each ifNotNil: [
ii _ ii + 1.
each = aCharacterStyle ifTrue: [ ^characterStyles size + ii ]]]].
^0! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 8/11/2011 11:37'!
characterStyleNamed: aString
| style |
characterStyles ifNotNil: [
characterStyles do: [ :pair |
style _ pair second.
style name = aString ifTrue: [ ^style ]]].
^nil! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 8/11/2011 10:03'!
characterStyleNamedOrNew: aString
^(self characterStyleNamed: aString) ifNil: [
CharacterStyle new privateName: aString ]! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 12/19/2011 12:33'!
characterStyleNamesAndShortcuts
^Array streamContents: [ :strm |
characterStyles do: [ :pair |
strm nextPut: pair second name, ' (', pair first asString, ')' ].
volatileCharStyles ifNotNil: [
volatileCharStyles do: [ :styleOrNil |
styleOrNil ifNotNil: [
strm nextPut: styleOrNil name ]]]]! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 8/9/2011 14:38'!
characterStyles
^characterStyles! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 1/13/2012 14:05'!
defaultStyle
"Usually we include a 'Normal' style. If not, answer some style anyway.
We might refine this!!"
^(self paragraphStyleNamed: 'Normal') ifNil: [ self paragraphStyleAt: 1 ]! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 4/2/2016 23:07'!
paragraphStyleAt: index
| i ii |
index <= paragraphStyles size ifTrue: [
^(paragraphStyles at: index) second ].
volatileParaStyles ifNotNil: [
i _ index - paragraphStyles size.
ii _ 0.
volatileParaStyles withIndexDo: [ :each :iii |
each ifNotNil: [
ii _ ii + 1.
ii = i ifTrue: [ ^each ]]]].
^nil! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 12/30/2011 09:53'!
paragraphStyleForShortcut: aCharacter
paragraphStyles do: [ :pair |
pair first = aCharacter ifTrue: [ ^pair second ]].
^nil! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 4/2/2016 23:07'!
paragraphStyleIndexOf: aParagraphStyle
| index ii |
index _ paragraphStyles findFirst: [ :pair | pair second = aParagraphStyle ].
index = 0 ifFalse: [ ^index ].
volatileParaStyles ifNotNil: [
ii _ 0.
volatileParaStyles withIndexDo: [ :each :iii |
each ifNotNil: [
ii _ ii + 1.
each = aParagraphStyle ifTrue: [ ^paragraphStyles size + ii ]]]].
^0! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 8/11/2011 11:36'!
paragraphStyleNamed: aString
| style |
paragraphStyles ifNotNil: [
paragraphStyles do: [ :pair |
style _ pair second.
style name = aString ifTrue: [ ^style ]]].
^nil! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 8/11/2011 10:02'!
paragraphStyleNamedOrNew: aString
^(self paragraphStyleNamed: aString) ifNil: [
ParagraphStyle new privateName: aString ]! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 12/19/2011 12:33'!
paragraphStyleNamesAndShortcuts
^Array streamContents: [ :strm |
paragraphStyles do: [ :pair |
strm nextPut: pair second name, ' (', pair first asString, ')' ].
volatileParaStyles ifNotNil: [
volatileParaStyles do: [ :styleOrNil |
styleOrNil ifNotNil: [
strm nextPut: styleOrNil name ]]]]! !
!StyleSet methodsFor: 'accessing' stamp: 'jmv 8/9/2011 14:38'!
paragraphStyles
^paragraphStyles! !
!StyleSet methodsFor: 'initialization examples' stamp: 'jmv 6/11/2020 16:42:18'!
createDocumentationCharacterStyleSet
"Build one of the many possible sets of Styles. Maybe other methods like this will be added."
| emphasised className completedText nullStyle familyName |
familyName _ FontFamily defaultFamilyName.
emphasised _ self characterStyleNamedOrNew: 'Emphasized'.
emphasised privateFamilyName: familyName pointSize: 11 emphasis: 0 color: Color blue.
className _ self characterStyleNamedOrNew: 'Class Name'.
className privateFamilyName: familyName pointSize: 11 emphasis: 0 color: Color magenta.
completedText _ self characterStyleNamedOrNew: 'Completed Text'.
completedText privateFamilyName: familyName pointSize: 12 emphasis: 0 color: Color green.
nullStyle _ CharacterStyle nullStyle.
characterStyles _ {
{$e. emphasised}.
{$l. className}.
{$p. completedText}.
{$n. nullStyle}
}.
self triggerEvent: #stylesChanged! !
!StyleSet methodsFor: 'initialization examples' stamp: 'jmv 6/11/2020 16:35:44'!
createDocumentationParagraphStyleSet
"Build one of the many possible sets of Styles. Maybe other methods like this will be added."
| figure indent heading1 heading2 heading3 text familyName |
indent _ 10.
familyName _ FontFamily defaultFamilyName.
text _ self paragraphStyleNamedOrNew: 'Text'.
text privateFamilyName: familyName pointSize: 11 emphasis: 0 color: nil
alignment: CharacterScanner leftFlushCode firstIndent: indent + 20 restIndent: indent rightIndent: indent
spaceBefore: 2 spaceAfter: 2.
figure _ self paragraphStyleNamedOrNew: 'Figure'.
figure privateFamilyName: familyName pointSize: 5 emphasis: 0 color: nil
alignment: CharacterScanner leftFlushCode firstIndent: indent restIndent: indent rightIndent: indent
spaceBefore: 0 spaceAfter: 0.
heading1 _ self paragraphStyleNamedOrNew: 'Heading 1'.
heading1 privateFamilyName: familyName pointSize: 22 emphasis: AbstractFont boldCode color: nil
alignment: CharacterScanner leftFlushCode firstIndent: indent restIndent: indent rightIndent: indent
spaceBefore: 20 spaceAfter: 10.
heading2 _ self paragraphStyleNamedOrNew: 'Heading 2'.
heading2 privateFamilyName: familyName pointSize: 17 emphasis: AbstractFont boldCode color: Color red
alignment: CharacterScanner leftFlushCode firstIndent: indent restIndent: indent rightIndent: indent
spaceBefore: 24 spaceAfter: 10.
heading3 _ self paragraphStyleNamedOrNew: 'Heading 3'.
heading3 privateFamilyName: familyName pointSize: 11 emphasis: AbstractFont boldCode color: nil
alignment: CharacterScanner leftFlushCode firstIndent: indent restIndent: indent rightIndent: indent
spaceBefore: 22 spaceAfter: 3.
paragraphStyles _ {
{$0. text}.
{$1. heading1}.
{$2. heading2}.
{$3. heading3}.
}.
self triggerEvent: #stylesChanged! !
!StyleSet methodsFor: 'initialization examples' stamp: 'jmv 6/11/2020 16:36:00'!
createDramaCharacterStyleSet
"Build one of the many possible sets of Styles. Maybe other methods like this will be added."
| completedText nullStyle familyName |
familyName _ FontFamily defaultFamilyName.
completedText _ self characterStyleNamedOrNew: 'Completed Text'.
completedText privateFamilyName: familyName pointSize: 12 emphasis: 0 color: Color green.
nullStyle _ CharacterStyle nullStyle.
characterStyles _ {
{$p. completedText}.
{$n. nullStyle}
}.
self triggerEvent: #stylesChanged! !
!StyleSet methodsFor: 'initialization examples' stamp: 'jmv 6/11/2020 16:36:36'!
createDramaParagraphStyleSet
"Build one of the many possible sets of Styles. Maybe other methods like this will be added."
| figure leftIndent act scene sceneDescription sceneInstruction speaker text familyName |
leftIndent _ 20.
familyName _ FontFamily defaultFamilyName.
figure _ self paragraphStyleNamedOrNew: 'Figure'.
figure privateFamilyName: familyName pointSize: 5 emphasis: 0 color: nil
alignment: CharacterScanner leftFlushCode firstIndent: leftIndent restIndent: leftIndent rightIndent: 10
spaceBefore: 0 spaceAfter: 0.
act _ self paragraphStyleNamedOrNew: 'Act'.
act privateFamilyName: familyName pointSize: 22 emphasis: AbstractFont boldCode color: nil
alignment: CharacterScanner leftFlushCode firstIndent: leftIndent restIndent: leftIndent rightIndent: 0
spaceBefore: 20 spaceAfter: 10.
scene _ self paragraphStyleNamedOrNew: 'Scene'.
scene privateFamilyName: familyName pointSize: 17 emphasis: AbstractFont boldCode color: Color red
alignment: CharacterScanner leftFlushCode firstIndent: leftIndent restIndent: leftIndent rightIndent: 0
spaceBefore: 24 spaceAfter: 10.
sceneDescription _ self paragraphStyleNamedOrNew: 'Scene Description'.
sceneDescription privateFamilyName: familyName pointSize: 11 emphasis: AbstractFont boldCode color: Color blue
alignment: CharacterScanner leftFlushCode firstIndent: leftIndent restIndent: leftIndent rightIndent: 10
spaceBefore: 2 spaceAfter: 2.
sceneInstruction _ self paragraphStyleNamedOrNew: 'Scene Instruction'.
sceneInstruction privateFamilyName: familyName pointSize: 11 emphasis: AbstractFont italicCode color: Color blue
alignment: CharacterScanner leftFlushCode firstIndent: leftIndent restIndent: leftIndent rightIndent: 10
spaceBefore: 2 spaceAfter: 2.
speaker _ self paragraphStyleNamedOrNew: 'Speaker'.
speaker privateFamilyName: familyName pointSize: 11 emphasis: AbstractFont boldCode color: nil
alignment: CharacterScanner leftFlushCode firstIndent: leftIndent restIndent: leftIndent rightIndent: 10
spaceBefore: 22 spaceAfter: 3.
text _ self paragraphStyleNamedOrNew: 'Text'.
text privateFamilyName: familyName pointSize: 11 emphasis: AbstractFont italicCode color: nil
alignment: CharacterScanner leftFlushCode firstIndent: leftIndent + 20 restIndent: leftIndent +20 rightIndent: 10
spaceBefore: 2 spaceAfter: 2.
paragraphStyles _ {
{$f. figure}.
{$a. act}.
{$s. scene}.
{$d. sceneDescription}.
{$i. sceneInstruction}.
{$k. speaker}.
{$t. text}.
}.
self triggerEvent: #stylesChanged! !
!StyleSet methodsFor: 'initialization examples' stamp: 'jmv 6/11/2020 16:37:03'!
createFeaturesCharacterStyleSet
"Build one of the many possible sets of Styles. Maybe other methods like this will be added."
| title featureType nullStyle completedText familyName |
familyName _ FontFamily defaultFamilyName.
title _ self characterStyleNamedOrNew: 'Title'.
title privateFamilyName: familyName pointSize: 11 emphasis: 0 color: Color blue.
featureType _ self characterStyleNamedOrNew: 'Feature Type'.
featureType privateFamilyName: familyName pointSize: 10 emphasis: AbstractFont boldCode color: Color red.
completedText _ self characterStyleNamedOrNew: 'Completed Text'.
completedText privateFamilyName: familyName pointSize: 12 emphasis: 0 color: Color green.
nullStyle _ CharacterStyle nullStyle.
characterStyles _ {
{$t. title}.
{$y. featureType}.
{$p. completedText}.
{$n. nullStyle}
}.
self triggerEvent: #stylesChanged! !
!StyleSet methodsFor: 'initialization examples' stamp: 'jmv 6/11/2020 16:38:53'!
createFeaturesParagraphStyleSet
"Build one of the many possible sets of Styles. Maybe other methods like this will be added."
| heading1 heading2 heading3 emphasized normal numbered alphabetic bulleted smalltalkCode familyName |
familyName _ FontFamily defaultFamilyName.
normal _ self paragraphStyleNamedOrNew: 'Normal'.
normal privateFamilyName: familyName pointSize: 11 emphasis: 0 color: nil
alignment: CharacterScanner leftFlushCode firstIndent: 30 restIndent: 10 rightIndent: 10
spaceBefore: 8 spaceAfter: 2.
emphasized _ self paragraphStyleNamedOrNew: 'Emphasized'.
emphasized privateFamilyName: familyName pointSize: 10 emphasis: AbstractFont boldCode color: nil
alignment: CharacterScanner justifiedCode firstIndent: 60 restIndent: 60 rightIndent: 60
spaceBefore: 10 spaceAfter: 2.
heading1 _ self paragraphStyleNamedOrNew: 'Heading 1'.
heading1 privateFamilyName: familyName pointSize: 22 emphasis: 0 color: nil
alignment: CharacterScanner centeredCode firstIndent: 0 restIndent: 0 rightIndent: 0
spaceBefore: 34 spaceAfter: 18.
heading2 _ self paragraphStyleNamedOrNew: 'Heading 2'.
heading2 privateFamilyName: familyName pointSize: 17 emphasis: AbstractFont boldCode color: nil
alignment: CharacterScanner leftFlushCode firstIndent: 0 restIndent: 0 rightIndent: 0
spaceBefore: 24 spaceAfter: 8.
heading3 _ self paragraphStyleNamedOrNew: 'Heading 3'.
heading3 privateFamilyName: familyName pointSize: 14 emphasis: AbstractFont italicCode color: nil
alignment: CharacterScanner leftFlushCode firstIndent: 0 restIndent: 0 rightIndent: 0
spaceBefore: 18 spaceAfter: 4.
numbered _ self paragraphStyleNamedOrNew: 'Numbered List'.
numbered privateFamilyName: familyName pointSize: 11 emphasis: 0 color: nil
alignment: CharacterScanner justifiedCode firstIndent: 10 restIndent: 50 rightIndent: 10
spaceBefore: 8 spaceAfter: 2;
privateListBulletPattern: '%%%. '.
alphabetic _ self paragraphStyleNamedOrNew: 'Alphabetic List'.
alphabetic privateFamilyName: familyName pointSize: 11 emphasis: 0 color: nil
alignment: CharacterScanner justifiedCode firstIndent: 10 restIndent: 30 rightIndent: 10
spaceBefore: 8 spaceAfter: 2;
privateListBulletPattern: 'z) '.
bulleted _ self paragraphStyleNamedOrNew: 'Bulleted List'.
bulleted privateFamilyName: familyName pointSize: 11 emphasis: 0 color: nil
alignment: CharacterScanner justifiedCode firstIndent: 10 restIndent: 30 rightIndent: 10
spaceBefore: 8 spaceAfter: 2;
privateListBulletPattern: '° '.
smalltalkCode _ self paragraphStyleNamedOrNew: 'Smalltalk code'.
smalltalkCode privateFamilyName: familyName pointSize: 11 emphasis: 0 color: nil
alignment: CharacterScanner leftFlushCode firstIndent: 10 restIndent: 10 rightIndent: 10
spaceBefore: 0 spaceAfter: 0;
doShout.
paragraphStyles _ {
{$0. normal}.
{$e. emphasized}.
{$1. heading1}.
{$2. heading2}.
{$3. heading3}.
{$4. numbered}.
{$5. alphabetic}.
{$6. bulleted}.
{$7. smalltalkCode}
}.
self triggerEvent: #stylesChanged! !
!StyleSet methodsFor: 'initialization examples' stamp: 'jmv 1/30/2021 12:39:26'!
createSampleCharacterStyleSet
"Build one of the many possible sets of Styles. Maybe other methods like this will be added."
| greenItalic greenBig redBold nullStyle completedText basePointSize familyName |
familyName _ FontFamily defaultFamilyName.
basePointSize _ FontFamily defaultPointSize.
greenItalic _ self characterStyleNamedOrNew: 'Green Italic'.
greenItalic privateFamilyName: familyName pointSize: basePointSize emphasis: AbstractFont italicCode color: Color green.
greenBig _ self characterStyleNamedOrNew: 'Green Big'.
greenBig privateFamilyName: familyName pointSize: basePointSize * 14//10 emphasis: 0 color: Color green.
redBold _ self characterStyleNamedOrNew: 'Red Bold'.
redBold privateFamilyName: familyName pointSize: basePointSize emphasis: AbstractFont boldCode color: Color red.
completedText _ self characterStyleNamedOrNew: 'Completed Text'.
completedText privateFamilyName: familyName pointSize: basePointSize*12//10 emphasis: 0 color: Color green.
nullStyle _ CharacterStyle nullStyle.
characterStyles _ {
{$u. greenItalic}.
{$i. greenBig}.
{$o. redBold}.
{$p. completedText}.
{$n. nullStyle}
}.
self triggerEvent: #stylesChanged! !
!StyleSet methodsFor: 'initialization examples' stamp: 'jmv 9/3/2019 08:56:58'!
createSampleParagraphStyleSet
"Build one of the many possible sets of Styles. Maybe other methods like this will be added."
| heading1 heading2 heading3 emphasized normal numbered alphabetic bulleted smalltalkCode s familyName |
familyName _ FontFamily defaultFamilyName.
s _ FontFamily defaultPointSize.
normal _ self paragraphStyleNamedOrNew: 'Normal'.
normal privateFamilyName: familyName pointSize: s emphasis: 0 color: nil
alignment: CharacterScanner justifiedCode firstIndent: s*3 restIndent: s rightIndent: s
spaceBefore: s*8//10 spaceAfter: s*2//10.
emphasized _ self paragraphStyleNamedOrNew: 'Emphasized'.
emphasized privateFamilyName: familyName pointSize: s emphasis: AbstractFont boldCode color: nil
alignment: CharacterScanner justifiedCode firstIndent: s*6 restIndent: s*6 rightIndent: s*6
spaceBefore: s spaceAfter: s*2//10.
heading1 _ self paragraphStyleNamedOrNew: 'Heading 1'.
heading1 privateFamilyName: familyName pointSize: s*3 emphasis: 0 color: nil
alignment: CharacterScanner centeredCode firstIndent: 0 restIndent: 0 rightIndent: 0
spaceBefore: s*3 spaceAfter: s*2.
heading2 _ self paragraphStyleNamedOrNew: 'Heading 2'.
heading2 privateFamilyName: familyName pointSize: s*2 emphasis: AbstractFont boldCode color: nil
alignment: CharacterScanner centeredCode firstIndent: 0 restIndent: 0 rightIndent: 0
spaceBefore: s*2 spaceAfter: 2.
heading3 _ self paragraphStyleNamedOrNew: 'Heading 3'.
heading3 privateFamilyName: familyName pointSize: s*15//10 emphasis: AbstractFont italicCode color: nil
alignment: CharacterScanner centeredCode firstIndent: 0 restIndent: 0 rightIndent: 0
spaceBefore: s*15//10 spaceAfter: s//2.
numbered _ self paragraphStyleNamedOrNew: 'Numbered List'.
numbered privateFamilyName: familyName pointSize: s emphasis: 0 color: nil
alignment: CharacterScanner justifiedCode firstIndent: s restIndent: s*5 rightIndent: s
spaceBefore: s*8//10 spaceAfter: s*2//10;
privateListBulletPattern: '%%%. '.
alphabetic _ self paragraphStyleNamedOrNew: 'Alphabetic List'.
alphabetic privateFamilyName: familyName pointSize: s emphasis: 0 color: nil
alignment: CharacterScanner justifiedCode firstIndent: s restIndent: s*3 rightIndent: s
spaceBefore: s*8//10 spaceAfter: s*2//10;
privateListBulletPattern: 'z) '.
bulleted _ self paragraphStyleNamedOrNew: 'Bulleted List'.
bulleted privateFamilyName: familyName pointSize: s emphasis: 0 color: nil
alignment: CharacterScanner justifiedCode firstIndent: s restIndent: s*3 rightIndent: s
spaceBefore: s*8//10 spaceAfter: s*2//10;
privateListBulletPattern: '° '.
smalltalkCode _ self paragraphStyleNamedOrNew: 'Smalltalk code'.
smalltalkCode privateFamilyName: familyName pointSize: s emphasis: 0 color: nil
alignment: CharacterScanner leftFlushCode firstIndent: s restIndent: s rightIndent: s
spaceBefore: 0 spaceAfter: 0;
doShout.
paragraphStyles _ {
{$0. normal}.
{$e. emphasized}.
{$1. heading1}.
{$2. heading2}.
{$3. heading3}.
{$4. numbered}.
{$5. alphabetic}.
{$6. bulleted}.
{$7. smalltalkCode}
}.
self triggerEvent: #stylesChanged! !
!StyleSet methodsFor: 'initialization examples' stamp: 'jmv 8/9/2011 15:55'!
initializeEmpty
paragraphStyles _ #().
characterStyles _ #()! !
!StyleSet methodsFor: 'initialization examples' stamp: 'jmv 8/11/2011 11:41'!
makeStylesMuchSmaller
"Just an example
| model text |
model _ StyledTextModel new.
text _ Text string: 'Just a text' attribute: (ParagraphStyleReference for: (model styleSet paragraphStyleNamed: 'Normal')).
model contents: text.
model styleSet makeStylesMuchSmaller.
SystemWindow editFancierStyledText: model label: 'Styled Text Editor'
"
paragraphStyles do: [ :pair |
pair second privatePointSize: 8 ].
characterStyles do: [ :pair |
pair second pointSize ifNotNil: [ :ps |
pair second privatePointSize: 8]].
self triggerEvent: #stylesChanged! !