@@ -26,12 +26,21 @@ Class {
26
26
27
27
{
28
28
#category : #constants ,
29
- #' squeak_changestamp' : ' jj 6/23 /2024 17:15 '
29
+ #' squeak_changestamp' : ' tw 7/12 /2024 20:36 '
30
30
}
31
31
GMTEEditor class >> editorMinimumExtent [
32
32
" minimum extent of the tile editor"
33
33
34
- ^ 550 @ 400
34
+ ^ RealEstateAgent scaleFactor * (700 @ 400 )
35
+ ]
36
+
37
+ {
38
+ #category : #constants ,
39
+ #' squeak_changestamp' : ' tw 7/12/2024 20:12'
40
+ }
41
+ GMTEEditor class >> getInputFieldSize [
42
+
43
+ ^ (TextStyle defaultFont approxWidthOfText: ' 1.00' asText)
35
44
]
36
45
37
46
{
@@ -255,11 +264,11 @@ GMTEEditor class >> tileMapMinPaddingSize [
255
264
256
265
{
257
266
#category : #constants ,
258
- #' squeak_changestamp' : ' tw 7/11 /2024 16:52 '
267
+ #' squeak_changestamp' : ' tw 7/12 /2024 19:22 '
259
268
}
260
269
GMTEEditor class >> toolBarVSpace [
261
270
262
- ^ 0.1
271
+ ^ 0.15
263
272
]
264
273
265
274
{
@@ -450,7 +459,7 @@ GMTEEditor >> brushButtons: anObject [
450
459
451
460
{
452
461
#category : #building ,
453
- #' squeak_changestamp' : ' JS 7/12/2024 18:20 '
462
+ #' squeak_changestamp' : ' tw 7/12/2024 20:35 '
454
463
}
455
464
GMTEEditor >> buildWith: builder [
456
465
" builds the editor with ToolBuilder"
@@ -467,7 +476,8 @@ GMTEEditor >> buildWith: builder [
467
476
self createTilestoreSpecWithBuilder: builder.
468
477
self createTraySpecWithBuilder: builder.
469
478
self createLayersSpecWithBuilder: builder.
470
- self createInspectorSpecWithBuilder: builder};
479
+ self createInspectorSpecWithBuilder: builder.
480
+ self createToolBarSpecWithBuilder: builder.};
471
481
closeAction: #onClose ;
472
482
minimumExtent: GMTEEditor editorMinimumExtent).
473
483
@@ -498,6 +508,16 @@ GMTEEditor >> buildWith: builder [
498
508
^ newMorph
499
509
]
500
510
511
+ {
512
+ #category : #helper ,
513
+ #' squeak_changestamp' : ' tw 7/12/2024 20:14'
514
+ }
515
+ GMTEEditor >> calculateAttributeContainerWidth: aString [
516
+
517
+ " calculates the minimum width of an attribute container with aString as label"
518
+ ^ (self getSizeOfString: aString) + GMTEEditor getInputFieldSize
519
+ ]
520
+
501
521
{
502
522
#category : #accessing ,
503
523
#' squeak_changestamp' : ' jj 6/22/2024 20:39'
@@ -576,42 +596,14 @@ GMTEEditor >> confirmPreviewOf: morphArray withDimensions: aPoint withTileSize:
576
596
577
597
{
578
598
#category : #building ,
579
- #' squeak_changestamp' : ' jj 6/22/2024 20:41'
580
- }
581
- GMTEEditor >> createAttributeSpecWithBuilder: aBuilder descriptor: aString getter: aSelector setter: anotherSelector model: aModel [
582
- " a helper function to create attribute specs"
583
-
584
- ^ self withMorphOf: ((aBuilder pluggablePanelSpec new )
585
- frame: (LayoutFrame
586
- fractions: (0 @ 0 corner: 1 @ 1 ));
587
- layout: #proportional ;
588
- children: {
589
- (aBuilder pluggableStaticTextSpec new )
590
- model: aModel;
591
- frame: (LayoutFrame offsets: (0 @ 0 corner: 120 @ 30 ));
592
- text: aString.
593
-
594
- (aBuilder pluggableInputFieldSpec new )
595
- model: aModel;
596
- indicateUnacceptedChanges: false ;
597
- frame: (LayoutFrame offsets: (120 @ 0 corner: 180 @ 30 ));
598
- getText: aSelector;
599
- setText: anotherSelector
600
- };
601
- yourself ) do: [:morph |
602
- morph layoutPolicy: TableLayout new ]
603
- ]
604
-
605
- {
606
- #category : #building ,
607
- #' squeak_changestamp' : ' tw 7/12/2024 18:57'
599
+ #' squeak_changestamp' : ' tw 7/12/2024 20:11'
608
600
}
609
601
GMTEEditor >> createAttributeSpecWithBuilder: aBuilder descriptor: aString getter: aSelector setter: anotherSelector model: aModel frame: aFrame [
610
602
" a helper function to create attribute specs"
611
603
612
604
| minTextWidth minInputWidth |
613
- minTextWidth := ( TextStyle defaultFont approxWidthOfText : aString asText) .
614
- minInputWidth := ( TextStyle defaultFont approxWidthOfText: ' 1234 ' asText) .
605
+ minTextWidth := self getSizeOfString : aString.
606
+ minInputWidth := GMTEEditor getInputFieldSize .
615
607
616
608
^ (aBuilder pluggablePanelSpec new )
617
609
name: ' attributeContainer' ;
@@ -684,7 +676,7 @@ GMTEEditor >> createCommandBarSpecWithBuilder: aBuilder [
684
676
685
677
{
686
678
#category : #building ,
687
- #' squeak_changestamp' : ' tw 7/12/2024 19:01 '
679
+ #' squeak_changestamp' : ' tw 7/12/2024 20:07 '
688
680
}
689
681
GMTEEditor >> createInspectorSpecWithBuilder: aBuilder [
690
682
" creates the spec for the inspector tab"
@@ -700,7 +692,7 @@ GMTEEditor >> createInspectorSpecWithBuilder: aBuilder [
700
692
701
693
self createAttributeSpecWithBuilder: aBuilder descriptor: ' Grid Height:' getter: #getGridHeightAsString setter: #setGridHeight: model: self frame: (GMTEEditor vLayoutFrame: 3 ofN: 3 )
702
694
};
703
- minimumWidth: (self getMaximalLengthOfStrings : (OrderedCollection newFrom: {' Padding:' . ' Grid Width:' . ' Grid Height:' }));
695
+ minimumWidth: (self getMaximalSizeOfStrings : (OrderedCollection newFrom: {' Padding:' . ' Grid Width:' . ' Grid Height:' }));
704
696
yourself
705
697
]
706
698
@@ -808,7 +800,7 @@ GMTEEditor >> createLayersSpecWithBuilder: aBuilder [
808
800
809
801
{
810
802
#category : #building ,
811
- #' squeak_changestamp' : ' Alex M 7/11 /2024 18:04 '
803
+ #' squeak_changestamp' : ' tw 7/12 /2024 19:19 '
812
804
}
813
805
GMTEEditor >> createTileViewerSpecWithBuilder: aBuilder [
814
806
" creates the spec for the tile viewer"
@@ -817,18 +809,15 @@ GMTEEditor >> createTileViewerSpecWithBuilder: aBuilder [
817
809
^ aBuilder pluggablePanelSpec new
818
810
name: ' main panel' ;
819
811
model: self ;
820
- frame: (LayoutFrame fractions: (0.2 @ 0 corner: 0.8 @ 0.8 )
812
+ frame: (LayoutFrame fractions: (0.2 @ 0 corner: 0.8 @ 0.7 )
821
813
offsets: (0 @ 30 corner: 0 @0 ));
822
- children: {
823
-
824
- self createToolBarSpecWithBuilder: aBuilder.
825
-
814
+ children: {
826
815
(aBuilder pluggablePanelSpec new )
827
816
name: ' tile viewer' ;
828
817
layout: #horizontal ;
829
818
model: self ;
830
819
frame: (LayoutFrame
831
- fractions: (0 @ 0 corner: 1 @ 0.9 ))
820
+ fractions: (0 @ 0 corner: 1 @ 1 ))
832
821
};
833
822
834
823
minimumExtent: 150 @ 150 ;
@@ -858,96 +847,104 @@ GMTEEditor >> createTilestoreSpecWithBuilder: aBuilder [
858
847
859
848
{
860
849
#category : #building ,
861
- #' squeak_changestamp' : ' tw 7/12/2024 17:08 '
850
+ #' squeak_changestamp' : ' tw 7/12/2024 20:38 '
862
851
}
863
852
GMTEEditor >> createToolBarSpecWithBuilder: aBuilder [
864
853
" creates the spec for the tool bar"
865
854
855
+ | radiusLabel |
856
+
857
+ radiusLabel := ' radius:' .
858
+
866
859
^ (aBuilder pluggablePanelSpec new )
867
860
name: ' toolbar' ;
868
861
model: self ;
869
- frame: (LayoutFrame fractions: (0.05 @0.9 corner: 0.95 @1 ));
870
- children: {
871
- (aBuilder pluggableImageButtonSpec new )
872
- name: ' undo' ;
873
- description: ' Undo' ;
874
- model: self ;
875
- frame: (GMTEEditor hLayoutFrame: 1 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace);
876
- action: #undo ;
877
- project: ' GameMecha' ;
878
- path: ' /GMTEIcons/undo.png' .
879
-
880
- (aBuilder pluggableImageButtonSpec new )
881
- name: ' redo' ;
882
- description: ' Redo' ;
883
- model: self ;
884
- frame: (GMTEEditor hLayoutFrame: 2 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace);
885
- action: #redo ;
886
- project: ' GameMecha' ;
887
- path: ' /GMTEIcons/redo.png' .
888
-
889
- (aBuilder pluggableImageButtonSpec new )
890
- groupName: ' radiusBrush' ;
891
- description: ' Brush' ;
892
- model: self ;
893
- frame: (GMTEEditor hLayoutFrame: 3 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace);
894
- action: #selectRadiusBrush ;
895
- project: ' GameMecha' ;
896
- buttonGroup: self brushButtons;
897
- path: ' /GMTEIcons/brush.png' .
898
-
899
- (aBuilder pluggableImageButtonSpec new )
900
- groupName: ' lineBrush' ;
901
- description: ' Line Tool' ;
902
- model: self ;
903
- frame: (GMTEEditor hLayoutFrame: 4 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace);
904
- action: #selectLineBrush ;
905
- project: ' GameMecha' ;
906
- buttonGroup: self brushButtons;
907
- path: ' /GMTEIcons/line.png' .
908
-
909
- (aBuilder pluggableImageButtonSpec new )
910
- groupName: ' fillBrush' ;
911
- description: ' Fill Tool' ;
912
- model: self ;
913
- frame: (GMTEEditor hLayoutFrame: 5 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace);
914
- action: #selectFillBrush ;
915
- project: ' GameMecha' ;
916
- buttonGroup: self brushButtons;
917
- path: ' /GMTEIcons/fill.png' .
918
-
919
- (aBuilder pluggableImageButtonSpec new )
920
- groupName: ' rectangleBrush' ;
921
- description: ' Rectangle Tool' ;
922
- model: self ;
923
- frame: (GMTEEditor hLayoutFrame: 6 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace);
924
- action: #selectRectangleBrush ;
925
- project: ' GameMecha' ;
926
- buttonGroup: self brushButtons;
927
- path: ' /GMTEIcons/rectangle.png' .
928
-
862
+ frame: (LayoutFrame fractions: (0.2 @0.7 corner: 0.8 @0.8 ));
863
+ minimumHeight: (35 * RealEstateAgent scaleFactor); " slightly magic number, in testing this was pretty. no time to fix until deadline"
864
+ children: {
929
865
self createAttributeSpecWithBuilder: aBuilder
930
- descriptor: ' Radius: '
866
+ descriptor: radiusLabel
931
867
getter: #getBrushRadiusAsString
932
868
setter: #setBrushRadiusFromText:
933
869
model: self
934
- frame: ((GMTEEditor hLayoutFrame: 7 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace)).
935
- };
870
+ frame: ((GMTEEditor hLayoutFrame: 1 ofN: 10 vSymmetric: GMTEEditor toolBarVSpace)).
871
+
872
+ (aBuilder pluggablePanelSpec new )
873
+ model: self ;
874
+ frame: (LayoutFrame fractions: (0.05 @ 0 corner: 1 @ 1 ) offsets: ((self calculateAttributeContainerWidth: radiusLabel) @ 0 corner: 0 @ 0 ));
875
+ children: {
876
+ (aBuilder pluggableImageButtonSpec new )
877
+ groupName: ' radiusBrush' ;
878
+ description: ' Brush' ;
879
+ model: self ;
880
+ frame: (GMTEEditor hLayoutFrame: 1 ofN: 6 vSymmetric: GMTEEditor toolBarVSpace);
881
+ action: #selectRadiusBrush ;
882
+ project: ' GameMecha' ;
883
+ buttonGroup: self brushButtons;
884
+ path: ' /GMTEIcons/brush.png' .
885
+
886
+ (aBuilder pluggableImageButtonSpec new )
887
+ groupName: ' lineBrush' ;
888
+ description: ' Line Tool' ;
889
+ model: self ;
890
+ frame: (GMTEEditor hLayoutFrame: 2 ofN: 6 vSymmetric: GMTEEditor toolBarVSpace);
891
+ action: #selectLineBrush ;
892
+ project: ' GameMecha' ;
893
+ buttonGroup: self brushButtons;
894
+ path: ' /GMTEIcons/line.png' .
895
+
896
+ (aBuilder pluggableImageButtonSpec new )
897
+ groupName: ' fillBrush' ;
898
+ description: ' Fill Tool' ;
899
+ model: self ;
900
+ frame: (GMTEEditor hLayoutFrame: 3 ofN: 6 vSymmetric: GMTEEditor toolBarVSpace);
901
+ action: #selectFillBrush ;
902
+ project: ' GameMecha' ;
903
+ buttonGroup: self brushButtons;
904
+ path: ' /GMTEIcons/fill.png' .
905
+
906
+ (aBuilder pluggableImageButtonSpec new )
907
+ groupName: ' rectangleBrush' ;
908
+ description: ' Rectangle Tool' ;
909
+ model: self ;
910
+ frame: (GMTEEditor hLayoutFrame: 4 ofN: 6 vSymmetric: GMTEEditor toolBarVSpace);
911
+ action: #selectRectangleBrush ;
912
+ project: ' GameMecha' ;
913
+ buttonGroup: self brushButtons;
914
+ path: ' /GMTEIcons/rectangle.png' .
915
+
916
+ (aBuilder pluggableImageButtonSpec new )
917
+ name: ' undo' ;
918
+ description: ' Undo' ;
919
+ model: self ;
920
+ frame: (GMTEEditor hLayoutFrame: 5 ofN: 6 vSymmetric: GMTEEditor toolBarVSpace);
921
+ action: #undo ;
922
+ project: ' GameMecha' ;
923
+ path: ' /GMTEIcons/undo.png' .
924
+
925
+ (aBuilder pluggableImageButtonSpec new )
926
+ name: ' redo' ;
927
+ description: ' Redo' ;
928
+ model: self ;
929
+ frame: (GMTEEditor hLayoutFrame: 6 ofN: 6 vSymmetric: GMTEEditor toolBarVSpace);
930
+ action: #redo ;
931
+ project: ' GameMecha' ;
932
+ path: ' /GMTEIcons/redo.png' }};
936
933
937
934
verticalResizing: #shrinkWrap ;
938
935
yourself
939
936
]
940
937
941
938
{
942
939
#category : #building ,
943
- #' squeak_changestamp' : ' jj 6/22 /2024 20:45 '
940
+ #' squeak_changestamp' : ' tw 7/12 /2024 19:14 '
944
941
}
945
942
GMTEEditor >> createTraySpecWithBuilder: aBuilder [
946
943
" creates the spec for the tile tray"
947
944
948
945
^ (aBuilder pluggableScrollPaneSpec new )
949
946
name: ' tray' ;
950
- frame: (LayoutFrame fractions: (0.2 @ 0.8 corner: 0.8 @ 1 ) offsets: nil );
947
+ frame: (LayoutFrame fractions: (0.2 @ 0.8 corner: 0.8 @ 1 ));
951
948
minimumHeight: 75 ;
952
949
yourself
953
950
]
@@ -1234,11 +1231,11 @@ GMTEEditor >> getLayerList [
1234
1231
1235
1232
{
1236
1233
#category : #helper ,
1237
- #' squeak_changestamp' : ' tw 7/12/2024 19:01 '
1234
+ #' squeak_changestamp' : ' tw 7/12/2024 20:07 '
1238
1235
}
1239
- GMTEEditor >> getMaximalLengthOfStrings : anOrderedCollection [
1236
+ GMTEEditor >> getMaximalSizeOfStrings : anOrderedCollection [
1240
1237
1241
- ^ (anOrderedCollection collect: [:aString | TextStyle defaultFont approxWidthOfText : aString asText ]) max
1238
+ ^ (anOrderedCollection collect: [:aString | self getSizeOfString : aString]) max
1242
1239
]
1243
1240
1244
1241
{
@@ -1274,6 +1271,15 @@ GMTEEditor >> getSelectedLayer [
1274
1271
^ self selectedLayers anyOne
1275
1272
]
1276
1273
1274
+ {
1275
+ #category : #helper ,
1276
+ #' squeak_changestamp' : ' tw 7/12/2024 20:12'
1277
+ }
1278
+ GMTEEditor >> getSizeOfString: aString [
1279
+
1280
+ ^ TextStyle defaultFont approxWidthOfText: aString asText
1281
+ ]
1282
+
1277
1283
{
1278
1284
#category : #accessing ,
1279
1285
#' squeak_changestamp' : ' jj 6/22/2024 20:56'
0 commit comments