@@ -26,12 +26,21 @@ Class {
2626
2727{
2828 #category : #constants ,
29- #' squeak_changestamp' : ' jj 6/23 /2024 17:15 '
29+ #' squeak_changestamp' : ' tw 7/12 /2024 20:36 '
3030}
3131GMTEEditor class >> editorMinimumExtent [
3232 " minimum extent of the tile editor"
3333
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)
3544]
3645
3746{
@@ -255,11 +264,11 @@ GMTEEditor class >> tileMapMinPaddingSize [
255264
256265{
257266 #category : #constants ,
258- #' squeak_changestamp' : ' tw 7/11 /2024 16:52 '
267+ #' squeak_changestamp' : ' tw 7/12 /2024 19:22 '
259268}
260269GMTEEditor class >> toolBarVSpace [
261270
262- ^ 0.1
271+ ^ 0.15
263272]
264273
265274{
@@ -450,7 +459,7 @@ GMTEEditor >> brushButtons: anObject [
450459
451460{
452461 #category : #building ,
453- #' squeak_changestamp' : ' JS 7/12/2024 18:20 '
462+ #' squeak_changestamp' : ' tw 7/12/2024 20:35 '
454463}
455464GMTEEditor >> buildWith: builder [
456465 " builds the editor with ToolBuilder"
@@ -467,7 +476,8 @@ GMTEEditor >> buildWith: builder [
467476 self createTilestoreSpecWithBuilder: builder.
468477 self createTraySpecWithBuilder: builder.
469478 self createLayersSpecWithBuilder: builder.
470- self createInspectorSpecWithBuilder: builder};
479+ self createInspectorSpecWithBuilder: builder.
480+ self createToolBarSpecWithBuilder: builder.};
471481 closeAction: #onClose ;
472482 minimumExtent: GMTEEditor editorMinimumExtent).
473483
@@ -498,6 +508,16 @@ GMTEEditor >> buildWith: builder [
498508 ^ newMorph
499509]
500510
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+
501521{
502522 #category : #accessing ,
503523 #' squeak_changestamp' : ' jj 6/22/2024 20:39'
@@ -576,42 +596,14 @@ GMTEEditor >> confirmPreviewOf: morphArray withDimensions: aPoint withTileSize:
576596
577597{
578598 #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'
608600}
609601GMTEEditor >> createAttributeSpecWithBuilder: aBuilder descriptor: aString getter: aSelector setter: anotherSelector model: aModel frame: aFrame [
610602 " a helper function to create attribute specs"
611603
612604 | 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 .
615607
616608 ^ (aBuilder pluggablePanelSpec new )
617609 name: ' attributeContainer' ;
@@ -684,7 +676,7 @@ GMTEEditor >> createCommandBarSpecWithBuilder: aBuilder [
684676
685677{
686678 #category : #building ,
687- #' squeak_changestamp' : ' tw 7/12/2024 19:01 '
679+ #' squeak_changestamp' : ' tw 7/12/2024 20:07 '
688680}
689681GMTEEditor >> createInspectorSpecWithBuilder: aBuilder [
690682 " creates the spec for the inspector tab"
@@ -700,7 +692,7 @@ GMTEEditor >> createInspectorSpecWithBuilder: aBuilder [
700692
701693 self createAttributeSpecWithBuilder: aBuilder descriptor: ' Grid Height:' getter: #getGridHeightAsString setter: #setGridHeight: model: self frame: (GMTEEditor vLayoutFrame: 3 ofN: 3 )
702694 };
703- minimumWidth: (self getMaximalLengthOfStrings : (OrderedCollection newFrom: {' Padding:' . ' Grid Width:' . ' Grid Height:' }));
695+ minimumWidth: (self getMaximalSizeOfStrings : (OrderedCollection newFrom: {' Padding:' . ' Grid Width:' . ' Grid Height:' }));
704696 yourself
705697]
706698
@@ -808,7 +800,7 @@ GMTEEditor >> createLayersSpecWithBuilder: aBuilder [
808800
809801{
810802 #category : #building ,
811- #' squeak_changestamp' : ' Alex M 7/11 /2024 18:04 '
803+ #' squeak_changestamp' : ' tw 7/12 /2024 19:19 '
812804}
813805GMTEEditor >> createTileViewerSpecWithBuilder: aBuilder [
814806 " creates the spec for the tile viewer"
@@ -817,18 +809,15 @@ GMTEEditor >> createTileViewerSpecWithBuilder: aBuilder [
817809 ^ aBuilder pluggablePanelSpec new
818810 name: ' main panel' ;
819811 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 )
821813 offsets: (0 @ 30 corner: 0 @0 ));
822- children: {
823-
824- self createToolBarSpecWithBuilder: aBuilder.
825-
814+ children: {
826815 (aBuilder pluggablePanelSpec new )
827816 name: ' tile viewer' ;
828817 layout: #horizontal ;
829818 model: self ;
830819 frame: (LayoutFrame
831- fractions: (0 @ 0 corner: 1 @ 0.9 ))
820+ fractions: (0 @ 0 corner: 1 @ 1 ))
832821 };
833822
834823 minimumExtent: 150 @ 150 ;
@@ -858,96 +847,104 @@ GMTEEditor >> createTilestoreSpecWithBuilder: aBuilder [
858847
859848{
860849 #category : #building ,
861- #' squeak_changestamp' : ' tw 7/12/2024 17:08 '
850+ #' squeak_changestamp' : ' tw 7/12/2024 20:38 '
862851}
863852GMTEEditor >> createToolBarSpecWithBuilder: aBuilder [
864853 " creates the spec for the tool bar"
865854
855+ | radiusLabel |
856+
857+ radiusLabel := ' radius:' .
858+
866859 ^ (aBuilder pluggablePanelSpec new )
867860 name: ' toolbar' ;
868861 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: {
929865 self createAttributeSpecWithBuilder: aBuilder
930- descriptor: ' Radius: '
866+ descriptor: radiusLabel
931867 getter: #getBrushRadiusAsString
932868 setter: #setBrushRadiusFromText:
933869 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' }};
936933
937934 verticalResizing: #shrinkWrap ;
938935 yourself
939936]
940937
941938{
942939 #category : #building ,
943- #' squeak_changestamp' : ' jj 6/22 /2024 20:45 '
940+ #' squeak_changestamp' : ' tw 7/12 /2024 19:14 '
944941}
945942GMTEEditor >> createTraySpecWithBuilder: aBuilder [
946943 " creates the spec for the tile tray"
947944
948945 ^ (aBuilder pluggableScrollPaneSpec new )
949946 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 ));
951948 minimumHeight: 75 ;
952949 yourself
953950]
@@ -1230,11 +1227,11 @@ GMTEEditor >> getLayerList [
12301227
12311228{
12321229 #category : #helper ,
1233- #' squeak_changestamp' : ' tw 7/12/2024 19:01 '
1230+ #' squeak_changestamp' : ' tw 7/12/2024 20:07 '
12341231}
1235- GMTEEditor >> getMaximalLengthOfStrings : anOrderedCollection [
1232+ GMTEEditor >> getMaximalSizeOfStrings : anOrderedCollection [
12361233
1237- ^ (anOrderedCollection collect: [:aString | TextStyle defaultFont approxWidthOfText : aString asText ]) max
1234+ ^ (anOrderedCollection collect: [:aString | self getSizeOfString : aString]) max
12381235]
12391236
12401237{
@@ -1270,6 +1267,15 @@ GMTEEditor >> getSelectedLayer [
12701267 ^ self selectedLayers anyOne
12711268]
12721269
1270+ {
1271+ #category : #helper ,
1272+ #' squeak_changestamp' : ' tw 7/12/2024 20:12'
1273+ }
1274+ GMTEEditor >> getSizeOfString: aString [
1275+
1276+ ^ TextStyle defaultFont approxWidthOfText: aString asText
1277+ ]
1278+
12731279{
12741280 #category : #accessing ,
12751281 #' squeak_changestamp' : ' jj 6/22/2024 20:56'
0 commit comments