diff --git a/source/GM-TE/GMTEEditableTileMap.class.st b/source/GM-TE/GMTEEditableTileMap.class.st index 4e6b6db0..8b47506e 100644 --- a/source/GM-TE/GMTEEditableTileMap.class.st +++ b/source/GM-TE/GMTEEditableTileMap.class.st @@ -144,14 +144,17 @@ GMTEEditableTileMap >> tileSelectionSet: anObject [ { #category : #updating, - #'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 22:14' + #'squeak_changestamp' : 'Alex M 6/14/2024 01:43' } GMTEEditableTileMap >> updateTile: aTile inLayer: aLayer FromEvent: anEvent [ | tileIdx hoveredTile | hoveredTile := aTile. - (anEvent redButtonPressed) + Transcript show: hoveredTile. + Transcript show: self model selectedTile. + + (anEvent redButtonPressed and: [self model selectedTile notNil]) ifTrue: [hoveredTile ifNil: [ tileIdx := self tileIdxFromPosition: anEvent position. @@ -159,6 +162,7 @@ GMTEEditableTileMap >> updateTile: aTile inLayer: aLayer FromEvent: anEvent [ hoveredTile := self generateTileAtlayer: aLayer x: tileIdx x y: tileIdx y stack: self tileMatrixStack tileType: GMTETile.]. self updateTileSprite: hoveredTile. self model savedSinceModified: false]. + ((anEvent yellowButtonPressed) and: [hoveredTile notNil]) ifTrue: [aLayer ifNotNil: [ @@ -170,9 +174,11 @@ GMTEEditableTileMap >> updateTile: aTile inLayer: aLayer FromEvent: anEvent [ { #category : #updating, - #'squeak_changestamp' : 'Alex M 5/23/2024 10:14' + #'squeak_changestamp' : 'Alex M 6/14/2024 01:43' } GMTEEditableTileMap >> updateTileSprite: aTile [ - self model selectedTile ifNotNil: [aTile updateSprite: (self model selectedTile image)]. + self model selectedTile + ifNotNil: + [aTile updateSprite: (self model selectedTile image)] ] diff --git a/source/GM-TE/GMTEEditor.class.st b/source/GM-TE/GMTEEditor.class.st index 3376ca44..f420f49f 100644 --- a/source/GM-TE/GMTEEditor.class.st +++ b/source/GM-TE/GMTEEditor.class.st @@ -171,12 +171,13 @@ GMTEEditor >> addLayer [ { #category : #building, - #'squeak_changestamp' : 'Alex M 6/11/2024 14:33' + #'squeak_changestamp' : 'Alex M 6/14/2024 01:29' } GMTEEditor >> buildWith: builder [ "called it builder instead of aBuilder since every other implementation does that" | newMorph selectedTile panel | + "TODO: Build process contains a lot of magic numbers regarding relative/absolute positioning" newMorph := builder build: (builder pluggableWindowSpec new model: self; label: 'GM Tile Editor'; @@ -202,14 +203,15 @@ GMTEEditor >> buildWith: builder [ panel := GMTETileContainer withParent: self tileStore. self tileStore morph: panel. - selectedTile := ImageMorph new + selectedTile := GMTETileSelector new visible: false; yourself. - "TODO: Make this nicer." - self trayViewer morph - beTransparent; + + "TODO: Work in progress." + self trayViewer morph: GMTETileTray new. + self trayViewer morph addMorph: selectedTile. - + self tileViewer borderWidth: 2; borderColor: tileStore borderColor. @@ -304,13 +306,14 @@ GMTEEditor >> createCommandBarSpecWithBuilder: aBuilder [ { #category : #building, - #'squeak_changestamp' : 'TW 6/11/2024 19:15' + #'squeak_changestamp' : 'Alex M 6/14/2024 00:56' } GMTEEditor >> createInspectorSpecWithBuilder: aBuilder [ ^aBuilder pluggableScrollPaneSpec new - frame: (LayoutFrame fractions: (0.8 @ 0 corner: 1 @ 0.25) - offsets: (0@ 30 corner: 0@30)); + frame: (LayoutFrame fractions: (1 @ 0 corner: 1 @ 0.25) + offsets: (-175@ 30 corner: 0@30)); + padding: (Rectangle left: 3 right: 0 top: 0 bottom: 0); hScrollBarPolicy: #never; layout: #vertical; name: 'inspector'; @@ -330,7 +333,7 @@ GMTEEditor >> createInspectorSpecWithBuilder: aBuilder [ { #category : #building, - #'squeak_changestamp' : 'TW 6/10/2024 17:10' + #'squeak_changestamp' : 'Alex M 6/14/2024 00:54' } GMTEEditor >> createLayersSpecWithBuilder: aBuilder [ @@ -338,8 +341,8 @@ GMTEEditor >> createLayersSpecWithBuilder: aBuilder [ name: 'layer viewer'; model: self; frame: (LayoutFrame - fractions: (0.8@0.25 corner: 1@1) - offsets: (0@30 corner: 0@0)); + fractions: (1@0.25 corner: 1@1) + offsets: (-175@30 corner: 0@0)); children: {aBuilder pluggableButtonSpec new name: 'addLayer'; label: 'add Layer'; @@ -361,15 +364,15 @@ GMTEEditor >> createLayersSpecWithBuilder: aBuilder [ { #category : #building, - #'squeak_changestamp' : 'TW 6/9/2024 18:12' + #'squeak_changestamp' : 'Alex M 6/14/2024 00:48' } GMTEEditor >> createTileViewerSpecWithBuilder: aBuilder [ "TODO: Maybe rename function to something more appropriate?" ^aBuilder pluggablePanelSpec new name: 'main panel'; model:self; - frame: (LayoutFrame fractions: (0.2 @ 0 corner: 0.8 @ 0.8) - offsets: (0@ 30 corner: 0@0)); + frame: (LayoutFrame fractions: (0.2 @ 0 corner: 1 @ 0.8) + offsets: (0@ 30 corner: -175@0)); "layout: #vertical;" children: { @@ -447,12 +450,12 @@ GMTEEditor >> createToolBarSpecWithBuilder: aBuilder [ { #category : #building, - #'squeak_changestamp' : 'TW 6/9/2024 18:12' + #'squeak_changestamp' : 'Alex M 6/14/2024 00:49' } GMTEEditor >> createTraySpecWithBuilder: aBuilder [ ^aBuilder pluggableScrollPaneSpec new name: 'tray'; - frame: (LayoutFrame fractions: (0.2 @ 0.8 corner: 0.8 @ 1) offsets: nil); + frame: (LayoutFrame fractions: (0.2 @ 0.8 corner: 1 @ 1) offsets: (0 @ 0 corner: -175 @ 0)); minimumHeight:75; yourself ] diff --git a/source/GM-TE/GMTETileTray.class.st b/source/GM-TE/GMTETileTray.class.st new file mode 100644 index 00000000..6efa6d1a --- /dev/null +++ b/source/GM-TE/GMTETileTray.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GMTETileTray, + #superclass : #AlignmentMorph, + #category : #'GM-TE' +} + +{ + #category : #'as yet unclassified', + #'squeak_changestamp' : 'Alex M 6/14/2024 01:19' +} +GMTETileTray >> initialize [ + super initialize. + self + layoutInset: (10@10); + cellInset: (10@10); + listDirection: #leftToRight; + wrapCentering: #center; + hResizing: #spaceFill; vResizing: #spaceFill; + color: Color transparent +] diff --git a/source/ToolBuilder-Morphic/MorphicToolBuilder.class.st b/source/ToolBuilder-Morphic/MorphicToolBuilder.class.st index 0f7ef431..6339db80 100644 --- a/source/ToolBuilder-Morphic/MorphicToolBuilder.class.st +++ b/source/ToolBuilder-Morphic/MorphicToolBuilder.class.st @@ -611,10 +611,10 @@ MorphicToolBuilder >> buildPluggableSpacer: spec [ { #category : #'widgets optional', - #'squeak_changestamp' : 'TW 6/11/2024 15:53' + #'squeak_changestamp' : 'Alex M 6/14/2024 00:40' } MorphicToolBuilder >> buildPluggableStaticText: aSpec [ - | widget | + | widget defaultTextColor | widget := StringMorph new contents: aSpec text. "aSpec textStyle @@ -630,8 +630,15 @@ MorphicToolBuilder >> buildPluggableStaticText: aSpec [ self register: widget id: aSpec name. + defaultTextColor := UserInterfaceTheme current get: #textColor for: MenuItemMorph. + defaultTextColor + ifNil: [defaultTextColor := Color black]. + aSpec color - ifNotNil: [widget color: aSpec color]. + ifNil: + [widget color: defaultTextColor] + ifNotNil: + [widget color: aSpec color]. self buildHelpFor: widget spec: aSpec.