Skip to content

Commit

Permalink
(Somewhat) Big UI update: inspector textColor, onClose fixed, right s…
Browse files Browse the repository at this point in the history
…ide fixed size
  • Loading branch information
Aleksander Morgensterns committed Jun 13, 2024
1 parent 74ed34f commit 6e60ebd
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 24 deletions.
14 changes: 10 additions & 4 deletions source/GM-TE/GMTEEditableTileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,25 @@ 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.
tileIdx ifNil: [^nil].
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: [
Expand All @@ -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)]
]
37 changes: 20 additions & 17 deletions source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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.
Expand Down Expand Up @@ -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';
Expand All @@ -330,16 +333,16 @@ 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 [

^aBuilder pluggablePanelSpec new
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';
Expand All @@ -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: {

Expand Down Expand Up @@ -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
]
Expand Down
20 changes: 20 additions & 0 deletions source/GM-TE/GMTETileTray.class.st
Original file line number Diff line number Diff line change
@@ -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
]
13 changes: 10 additions & 3 deletions source/ToolBuilder-Morphic/MorphicToolBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down

0 comments on commit 6e60ebd

Please sign in to comment.