1
'From Cuis 6.0 [latest update: #5213] on 3 June 2022 at 10:29:35 pm'!
1
'From Cuis 6.0 [latest update: #5214] on 4 June 2022 at 11:01:03 pm'!
3
!provides: 'DrGeo' 1 397!
3
!provides: 'DrGeo' 1 400!
4
4
!requires: 'Gettext' 1 17 nil!
5
5
!requires: 'SVG' 1 16 nil!
6
6
!requires: 'YAXO' 1 19 nil!
868
868
DrGeoScriptTestResource class
869
869
instanceVariableNames: ''!
871
!classDefinition: #DrGTypeColor category: 'DrGeo-System'!
872
PreferenceType subclass: #DrGTypeColor
873
instanceVariableNames: ''
874
classVariableNames: ''
876
category: 'DrGeo-System'!
877
!classDefinition: 'DrGTypeColor class' category: 'DrGeo-System'!
879
instanceVariableNames: ''!
881
!classDefinition: #DrGTypePointSize category: 'DrGeo-System'!
882
PreferenceType subclass: #DrGTypePointSize
883
instanceVariableNames: ''
884
classVariableNames: ''
886
category: 'DrGeo-System'!
887
!classDefinition: 'DrGTypePointSize class' category: 'DrGeo-System'!
888
DrGTypePointSize class
889
instanceVariableNames: ''!
871
891
!classDefinition: #DrGeo category: 'DrGeo-Main'!
872
892
Object subclass: #DrGeo
873
893
instanceVariableNames: 'view domain presenter morphs undoneMorphs lastMorph notInteractive saved'
2928
2948
DrGeoTree class
2929
2949
instanceVariableNames: ''!
2931
!classDefinition: #DrGTypeColor category: 'DrGeo-System'!
2932
PreferenceType subclass: #DrGTypeColor
2933
instanceVariableNames: ''
2934
classVariableNames: ''
2935
poolDictionaries: ''
2936
category: 'DrGeo-System'!
2937
!classDefinition: 'DrGTypeColor class' category: 'DrGeo-System'!
2939
instanceVariableNames: ''!
2942
2952
!DrGeoDomain commentStamp: '<historical>' prior: 0!
2943
2953
This is the domain object for DrGeo, aka the top level Model instance for one DrGeo instance.
3138
3148
!DrGeoScriptTestResource commentStamp: '' prior: 0!
3139
3149
I set up a canvas to use.!
3151
!DrGTypeColor commentStamp: '<historical>' prior: 0!
3152
A preference type for the colors used in a sketch.!
3154
!DrGTypePointSize commentStamp: '<historical>' prior: 0!
3155
A preference type for the size of the point in a sketch.!
3141
3157
!DrGeo commentStamp: '<historical>' prior: 0!
3142
3158
This is the DrGeo application model. It holds references to:
3143
3159
- domain: the geometric items constituting the sketch
10978
10994
^ sketch notNil! !
10996
!DrGTypeColor methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 22:05:04'!
10998
^ self class colorIndexOf: self value! !
11000
!DrGTypeColor methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 22:06:22'!
11002
self value: (self class colorFor: index).
11003
self changed: #colorIndex:! !
11005
!DrGTypeColor methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 22:02:11'!
11006
colorMorphCollection
11007
^ self class colorMorphCollection! !
11009
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:00'!
11011
^Color lightGray lighter lighter! !
11013
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:08'!
11015
^ Color perform: (self colorSymbols at: index)! !
11017
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:14'!
11018
colorIndexOf: aColor
11019
^self colors indexOf: (aColor alpha: 1)! !
11021
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:21'!
11022
colorMorphCollection
11023
^ self colors collect: [:aColor |
11024
ImageMorph new image: (DrGIcons colorForm: aColor )]! !
11026
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:29'!
11028
^#(#black #blue #brown #green #magenta #orange #red #yellow #white)! !
11030
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:35'!
11032
^ self colorSymbols collect: [:symbol | Color perform: symbol]! !
11034
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:40'!
11036
^Color lightGray lighter lighter lighter! !
11038
!DrGTypePointSize methodsFor: 'accessing' stamp: 'hlsf 6/4/2022 22:15:22'!
11040
^ self class pointSizeIndexOf: self value! !
11042
!DrGTypePointSize methodsFor: 'accessing' stamp: 'hlsf 6/4/2022 22:38:08'!
11043
pointSizeIndex: anIndex
11044
self value: (self class pointSizeFor: anIndex).
11045
self changed: #pointSizeIndex:! !
11047
!DrGTypePointSize methodsFor: 'accessing' stamp: 'hlsf 6/4/2022 22:35:07'!
11048
sizeMorphCollection
11049
^ self class sizeMorphCollection: #square! !
11051
!DrGTypePointSize class methodsFor: 'accessing' stamp: 'hlsf 6/4/2022 14:55:59'!
11052
pointSizeFor: index
11053
^ self pointSizeSymbols at: index! !
11055
!DrGTypePointSize class methodsFor: 'accessing' stamp: 'hlsf 6/4/2022 14:51:12'!
11056
pointSizeIndexOf: aSize
11057
^ self pointSizeSymbols indexOf: aSize! !
11059
!DrGTypePointSize class methodsFor: 'accessing' stamp: 'hlsf 6/4/2022 14:48:04'!
11061
^ #(#small #medium #large)! !
11063
!DrGTypePointSize class methodsFor: 'accessing' stamp: 'hlsf 6/4/2022 14:49:50'!
11064
sizeMorphCollection: aShape
11065
^ self pointSizeSymbols collect: [:symbol |
11066
ImageMorph new image: (DrGIcons point: symbol color: Color black shape: aShape)].
10980
11069
!DrGeo methodsFor: 'canvas' stamp: 'hlsf 3/27/2022 14:34:01'!
10982
11071
"Return a form preview"
19982
20071
named: 'Shape' translated
19983
20072
help: 'Set the shape of the point.' translated! !
19985
!DrGPointStyle methodsFor: 'widget' stamp: 'hlsf 2/14/2022 09:04:05'!
20074
!DrGPointStyle methodsFor: 'widget' stamp: 'hlsf 6/4/2022 14:50:31'!
19986
20075
sizeMorphCollection
19987
^ DrGStylePreference sizeMorphCollection: shape! !
20076
^ DrGTypePointSize sizeMorphCollection: shape! !
19989
20078
!DrGPointStyle methodsFor: 'widget' stamp: 'hlsf 3/24/2022 11:14:49'!
20069
20158
morph redrawNeeded
20072
!DrGPointStyle methodsFor: 'accessing'!
20161
!DrGPointStyle methodsFor: 'accessing' stamp: 'hlsf 6/4/2022 14:51:28'!
20073
20162
pointSizeIndex
20074
20163
"Answer the index of thickness"
20075
^DrGStylePreference pointSizeIndexOf: pointSize! !
20164
^DrGTypePointSize pointSizeIndexOf: pointSize! !
20077
!DrGPointStyle methodsFor: 'accessing' stamp: 'hlsf 2/13/2022 10:28:22'!
20166
!DrGPointStyle methodsFor: 'accessing' stamp: 'hlsf 6/4/2022 14:55:37'!
20078
20167
pointSizeIndex: index
20079
20168
"Set the value of thickness"
20080
self pointSize: (DrGStylePreference pointSizeFor: index).
20169
self pointSize: (DrGTypePointSize pointSizeFor: index).
20081
20170
self changed: #pointSizeIndex:! !
20083
20172
!DrGPointStyle methodsFor: 'accessing'!
22558
22647
^ self current pointColor: (self colorFor: anIndex)! !
22560
22649
!DrGStylePreference class methodsFor: 'point'!
22562
^ self colorWidget: #pointColorIndex! !
22564
!DrGStylePreference class methodsFor: 'point'!
22565
22650
pointExtentFor: pointSize
22566
22651
pointSize == #small ifTrue: [^ 6@6].
22567
22652
pointSize == #large ifTrue: [^ 10@10].
22618
22699
pointSizeIndex: anIndex
22619
22700
^ self current pointSize: (self pointSizeFor: anIndex)! !
22621
!DrGStylePreference class methodsFor: 'point'!
22622
pointSizeIndexOf: aSize
22623
^ self pointSizeSymbols indexOf: aSize! !
22625
!DrGStylePreference class methodsFor: 'point'!
22627
^ #(#small #medium #large)! !
22629
!DrGStylePreference class methodsFor: 'point'!
22632
newMorphDropListFor: self
22633
list: #sizeMorphCollection
22634
getSelected: #pointSizeIndex
22635
setSelected: #pointSizeIndex:
22638
22702
!DrGStylePreference class methodsFor: 'point' stamp: 'hlsf 2/13/2022 00:07:32'!
22639
22703
shapeMorphCollection
22640
22704
^ self pointShapeSymbols collect: [:symbol |
22641
22705
ImageMorph new image: (DrGIcons point: (self pointExtentFor: #medium) color: Color black shape: symbol)].
22644
!DrGStylePreference class methodsFor: 'point' stamp: 'hlsf 2/14/2022 09:03:51'!
22645
sizeMorphCollection: aShape
22646
^ self pointSizeSymbols collect: [:symbol |
22647
ImageMorph new image: (DrGIcons point: symbol color: Color black shape: aShape)].
22650
22708
!DrGStylePreference class methodsFor: 'ray'!
22652
22710
"respond the singleton, widget build up set later"
23305
23363
mySketchResources
23306
23364
^ DrGDirectoryLocal new location: DrGeoSystem mySketchesPath pathString.! !
23308
!DrGeoSystem class methodsFor: 'preferences' stamp: 'hlsf 6/3/2022 22:26:58'!
23366
!DrGeoSystem class methodsFor: 'preferences' stamp: 'hlsf 6/4/2022 22:16:06'!
23309
23367
initPointPreferences
23311
23369
name: #DrGeoPointColor
23312
23370
description: 'Default colour of a point.' translated
23313
23371
category: #DrGeoPoint
23314
23372
type: (DrGTypeColor with: #DrGeoPointColor)
23315
value: Color red! !
23375
name: #DrGeoPointSize
23376
description: 'Default size of a point.' translated
23377
category: #DrGeoPoint
23378
type: (DrGTypePointSize with: #DrGeoPointSize)
23317
23381
!DrGeoSystem class methodsFor: 'preferences' stamp: 'hlsf 6/3/2022 11:42:23'!
23318
23382
initPreferences
34224
!DrGTypeColor methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 22:05:04'!
34226
^ self class colorIndexOf: self value! !
34228
!DrGTypeColor methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 22:06:22'!
34230
self value: (self class colorFor: index).
34231
self changed: #colorIndex:! !
34233
!DrGTypeColor methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 22:02:11'!
34234
colorMorphCollection
34235
^ self class colorMorphCollection! !
34237
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:00'!
34239
^Color lightGray lighter lighter! !
34241
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:08'!
34243
^ Color perform: (self colorSymbols at: index)! !
34245
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:14'!
34246
colorIndexOf: aColor
34247
^self colors indexOf: (aColor alpha: 1)! !
34249
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:21'!
34250
colorMorphCollection
34251
^ self colors collect: [:aColor |
34252
ImageMorph new image: (DrGIcons colorForm: aColor )]! !
34254
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:29'!
34256
^#(#black #blue #brown #green #magenta #orange #red #yellow #white)! !
34258
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:35'!
34260
^ self colorSymbols collect: [:symbol | Color perform: symbol]! !
34262
!DrGTypeColor class methodsFor: 'accessing' stamp: 'hlsf 6/3/2022 11:36:40'!
34264
^Color lightGray lighter lighter lighter! !
34266
34288
!Object methodsFor: '*DrGeo' stamp: 'hlsf 6/20/2021 11:37:54'!
34544
34566
autoDeselect: false;
34545
34567
setBalloonText: aPref description.
34546
34568
views at: aPref name capitalized put: listMorph! !
34570
!PreferenceBrowserVisitor methodsFor: '*DrGeo' stamp: 'hlsf 6/4/2022 22:34:16'!
34571
visitDrGTypePointSizePreference: aPref
34573
listMorph _ DropDownButtonMorph
34575
listGetter: #sizeMorphCollection
34576
indexGetter: #pointSizeIndex
34577
indexSetter: #pointSizeIndex: ::
34578
autoDeselect: false;
34579
setBalloonText: aPref description.
34580
views at: aPref name capitalized put: listMorph! !
34547
34581
DrGDirectionItem initialize!