diff --git a/source/GM-TE/GMTEEditor.class.st b/source/GM-TE/GMTEEditor.class.st index 590656ff..89bb7df1 100644 --- a/source/GM-TE/GMTEEditor.class.st +++ b/source/GM-TE/GMTEEditor.class.st @@ -2,24 +2,21 @@ Class { #name : #GMTEEditor, #superclass : #Model, #instVars : [ - 'commandBar', 'tileStore', - 'tileViewer', - 'layerViewer', - 'trayViewer', 'selectedLayers', 'selectedTile', 'ratio', 'savedSinceModified', 'inspector', - 'morphBuilders', 'backgroundTile', 'tileMap', 'associatedMorph', 'commands', 'currentCommand', 'brush', - 'brushButtons' + 'brushButtons', + 'mapViewer', + 'tileTray' ], #category : #'GM-TE-UI' } @@ -371,9 +368,10 @@ GMTEEditor >> anyLayerSelected [ { #category : #accessing, - #'squeak_changestamp' : 'TW 6/25/2024 15:55' + #'squeak_changestamp' : 'tw 7/12/2024 21:49' } GMTEEditor >> associatedMorph [ + "The morph associated with the model" ^ associatedMorph ] @@ -389,20 +387,21 @@ GMTEEditor >> associatedMorph: anObject [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:51' + #'squeak_changestamp' : 'tw 7/12/2024 21:49' } GMTEEditor >> backgroundTile [ - "the tile used to dynamically fill the background of the map, if the user wishes so" + "The tile used to dynamically fill the background of the map, if the user wishes so" ^ backgroundTile ] { #category : #accessing, - #'squeak_changestamp' : 'Alex M 7/9/2024 15:41' + #'squeak_changestamp' : 'tw 7/12/2024 21:51' } GMTEEditor >> backgroundTile: anObject [ + self flag: 'cursed'. (backgroundTile = anObject) ifTrue: [backgroundTile := GMTETile checkerBoardTile] ifFalse: [backgroundTile := anObject]. @@ -442,17 +441,19 @@ GMTEEditor >> blendSelectedLayers [ { #category : #accessing, - #'squeak_changestamp' : 'Valentin Teutschbein 7/6/2024 12:54' + #'squeak_changestamp' : 'tw 7/12/2024 21:49' } GMTEEditor >> brush [ + ^ brush ] { #category : #accessing, - #'squeak_changestamp' : 'Valentin Teutschbein 7/6/2024 12:54' + #'squeak_changestamp' : 'tw 7/12/2024 21:51' } GMTEEditor >> brush: anObject [ + brush := anObject ] @@ -476,7 +477,7 @@ GMTEEditor >> brushButtons: anObject [ { #category : #building, - #'squeak_changestamp' : 'tw 7/12/2024 20:35' + #'squeak_changestamp' : 'tw 7/12/2024 22:10' } GMTEEditor >> buildWith: builder [ "builds the editor with ToolBuilder" @@ -500,21 +501,18 @@ GMTEEditor >> buildWith: builder [ newMorph addKeyboardCaptureFilter: self. - self commandBar: (newMorph submorphNamed: 'command bar'). "self commandBar vResizing: #rigid." self tileStore: (newMorph submorphNamed: 'tile store'). - self tileViewer: ((newMorph submorphNamed: 'main panel') submorphNamed: 'tile viewer'). - self layerViewer: (newMorph submorphNamed: 'layer viewer'). - self trayViewer: (newMorph submorphNamed: 'tray'). - self inspector: (newMorph submorphNamed: 'inspector'). - self tileViewer clipSubmorphs: true. + self mapViewer: ((newMorph submorphNamed: 'main panel') submorphNamed: 'tile viewer'). + self tileTray: (newMorph submorphNamed: 'tray'). + self mapViewer clipSubmorphs: true. panel := GMTETileContainer withParent: self tileStore. self tileStore morph: panel. self placeSelectedTileIntoTileTray. - self tileViewer + self mapViewer borderWidth: 2; borderColor: tileStore borderColor. @@ -537,36 +535,20 @@ GMTEEditor >> calculateAttributeContainerWidth: aString [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 20:39' -} -GMTEEditor >> commandBar [ - "panel that contains menu button functions" - - ^ commandBar -] - -{ - #category : #accessing, - #'squeak_changestamp' : 'TW 6/22/2024 01:14' -} -GMTEEditor >> commandBar: anObject [ - - commandBar := anObject -] - -{ - #category : #accessing, - #'squeak_changestamp' : 'Alex M 6/28/2024 19:48' + #'squeak_changestamp' : 'tw 7/12/2024 21:52' } GMTEEditor >> commands [ + "List of recent commands, used for undo/redo" + ^ commands ] { #category : #accessing, - #'squeak_changestamp' : 'Alex M 6/28/2024 19:48' + #'squeak_changestamp' : 'tw 7/12/2024 21:52' } GMTEEditor >> commands: anObject [ + commands := anObject ] @@ -968,17 +950,20 @@ GMTEEditor >> createTraySpecWithBuilder: aBuilder [ { #category : #accessing, - #'squeak_changestamp' : 'Alex M 6/28/2024 19:48' + #'squeak_changestamp' : 'tw 7/12/2024 21:53' } GMTEEditor >> currentCommand [ + "Index of the command whose state the editor is currently in" + ^ currentCommand ] { #category : #accessing, - #'squeak_changestamp' : 'Alex M 6/28/2024 19:48' + #'squeak_changestamp' : 'tw 7/12/2024 21:52' } GMTEEditor >> currentCommand: anObject [ + currentCommand := anObject ] @@ -1009,11 +994,11 @@ GMTEEditor >> deleteTilemapLayers: aLayerList [ ] { - #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 20:47' + #category : #'as yet unclassified', + #'squeak_changestamp' : 'tw 7/12/2024 21:53' } GMTEEditor >> deselectAllLayers [ - "empties the selected layers set" + "Empties the selected layers set" self selectedLayers: Set new; @@ -1022,7 +1007,7 @@ GMTEEditor >> deselectAllLayers [ ] { - #category : #accessing, + #category : #'as yet unclassified', #'squeak_changestamp' : 'TW 6/25/2024 17:50' } GMTEEditor >> deselectLayer: anIndex [ @@ -1041,7 +1026,7 @@ GMTEEditor >> deselectLayer: anIndex [ ] { - #category : #accessing, + #category : #'as yet unclassified', #'squeak_changestamp' : 'jj 6/22/2024 20:48' } GMTEEditor >> deselectTile [ @@ -1162,7 +1147,7 @@ GMTEEditor >> filterEvent: aKeyboardEvent for: anObject [ { #category : #accessing, - #'squeak_changestamp' : 'TW 7/9/2024 17:14' + #'squeak_changestamp' : 'tw 7/12/2024 21:58' } GMTEEditor >> getBrushRadius [ @@ -1192,10 +1177,10 @@ GMTEEditor >> getFileWithFileChooser [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 20:51' + #'squeak_changestamp' : 'tw 7/12/2024 21:54' } GMTEEditor >> getGridHeight [ - "returns the height (in tiles) of the tileMap" + "Returns the height (in tiles) of the tileMap" self tileMap ifNotNil: [^ self tileMap mapTileHeight] @@ -1214,10 +1199,10 @@ GMTEEditor >> getGridHeightAsString [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 20:52' + #'squeak_changestamp' : 'tw 7/12/2024 21:54' } GMTEEditor >> getGridWidth [ - "returns the width (in tiles) of the tileMap" + "Returns the width (in tiles) of the tileMap" self tileMap ifNotNil: [^ self tileMap mapTileWidth] @@ -1257,10 +1242,10 @@ GMTEEditor >> getMaximalSizeOfStrings: anOrderedCollection [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 20:54' + #'squeak_changestamp' : 'tw 7/12/2024 21:54' } GMTEEditor >> getPadding [ - "returns the padding of the tileMap" + "Returns the padding of the tileMap" self tileMap ifNotNil: [^ self tileMap mapPadding] @@ -1297,31 +1282,9 @@ GMTEEditor >> getSizeOfString: aString [ ^ TextStyle defaultFont approxWidthOfText: aString asText ] -{ - #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 20:56' -} -GMTEEditor >> getTileRatio [ - "returns the tileSizeRatio of the tileMap" - - self tileMap - ifNotNil: [^ self tileMap tileSizeRatio] - ifNil: [^ nil] -] - -{ - #category : #inspector, - #'squeak_changestamp' : 'jj 6/22/2024 20:56' -} -GMTEEditor >> getTileRatioAsString [ - "returns the tileSizeRatio of the tileMap as a string" - - ^ self getTileRatio asString -] - { #category : #'menu button functions', - #'squeak_changestamp' : 'TW 6/23/2024 20:09' + #'squeak_changestamp' : 'tw 7/12/2024 21:54' } GMTEEditor >> importFromMorph [ "import tilemap into editor from a .morph file" @@ -1334,7 +1297,6 @@ GMTEEditor >> importFromMorph [ self openTileMapInEditor: tileMap. self changed: #getPaddingAsString; - changed: #getTileRatioAsString; changed: #getGridWidthAsString; changed: #getGridHeightAsString; changed: #getLayerList @@ -1342,7 +1304,7 @@ GMTEEditor >> importFromMorph [ { #category : #'menu button functions', - #'squeak_changestamp' : 'jj 6/22/2024 20:57' + #'squeak_changestamp' : 'tw 7/12/2024 22:05' } GMTEEditor >> importFromTileset [ "loads a tileset into the tile store" @@ -1355,7 +1317,7 @@ GMTEEditor >> importFromTileset [ ifTrue: [^ nil] ifFalse:[tileHeight := tileHeight asInteger]. - dimensions := (tileHeight @ (tileHeight * self ratio)). + dimensions := (tileHeight @ tileHeight). tiles := self loadTileSetWithDimensions: dimensions. tiles ifNil: [^ nil]. @@ -1392,7 +1354,7 @@ GMTEEditor >> importMenu [ { #category : #initialization, - #'squeak_changestamp' : 'TW 7/9/2024 19:42' + #'squeak_changestamp' : 'tw 7/12/2024 22:02' } GMTEEditor >> initialize [ "starts the tile editor" @@ -1404,9 +1366,7 @@ GMTEEditor >> initialize [ selectedLayers: Set new; selectLayer: 1; brushButtons: GMTEButtonGroup new; - morphBuilders: Dictionary new; open; - ratio: 1; savedSinceModified: true; updateButtonEnabled; changed: #getLayerList; @@ -1438,44 +1398,24 @@ GMTEEditor >> initializeDefaultTileMapMatrix [ { #category : #initialization, - #'squeak_changestamp' : 'jj 6/22/2024 20:59' + #'squeak_changestamp' : 'tw 7/12/2024 22:09' } GMTEEditor >> initializeTileMapMatrixWithHeight: aHeight width: aWidth [ "initializes the tileMap with a tile map with a certain height and width" self tileMap: (GMTEEditorTileMap tileWidth: aWidth tileHeight: aHeight padding: 0.15 sizeRatio: 1 model: self). - self tileViewer addMorph: self tileMap. + self mapViewer addMorph: self tileMap. self tileMap position: (self tileMap owner position); hResizing: #spaceFill; vResizing: #spaceFill; updateMap. self - changed: #getTileRatioAsString; changed: #getGridWidthAsString; changed: #getGridHeightAsString; changed: #getPaddingAsString ] -{ - #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:02' -} -GMTEEditor >> inspector [ - "the inspector tab that allows to adjust the attributes of the tileMap" - - ^ inspector -] - -{ - #category : #accessing, - #'squeak_changestamp' : 'TW 6/22/2024 01:32' -} -GMTEEditor >> inspector: anObject [ - - inspector := anObject -] - { #category : #'layer manipulation', #'squeak_changestamp' : 'jj 6/22/2024 21:04' @@ -1513,25 +1453,6 @@ GMTEEditor >> layerCount [ ^ self tileMap tileMatrixStack layerCount ] -{ - #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:07' -} -GMTEEditor >> layerViewer [ - "panel that allows for manipulation of the tileMap layers" - - ^ layerViewer -] - -{ - #category : #accessing, - #'squeak_changestamp' : 'TW 6/22/2024 01:31' -} -GMTEEditor >> layerViewer: anObject [ - - layerViewer := anObject -] - { #category : #'file loading', #'squeak_changestamp' : 'jj 6/23/2024 17:31' @@ -1583,21 +1504,21 @@ GMTEEditor >> loadTileSetWithDimensions: aPoint [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:11' + #'squeak_changestamp' : 'tw 7/12/2024 22:09' } -GMTEEditor >> morphBuilders [ - "collection that contains the morph builders" +GMTEEditor >> mapViewer [ + "The panel that contains the tileMap" - ^ morphBuilders + ^ mapViewer ] { #category : #accessing, - #'squeak_changestamp' : 'TW 6/22/2024 01:31' + #'squeak_changestamp' : 'tw 7/12/2024 22:09' } -GMTEEditor >> morphBuilders: anObject [ +GMTEEditor >> mapViewer: anObject [ - morphBuilders := anObject + mapViewer := anObject ] { @@ -1644,7 +1565,7 @@ GMTEEditor >> onClose [ { #category : #initialization, - #'squeak_changestamp' : 'jj 6/22/2024 21:14' + #'squeak_changestamp' : 'tw 7/12/2024 22:09' } GMTEEditor >> open [ "builds the window" @@ -1652,13 +1573,13 @@ GMTEEditor >> open [ | newMorph | newMorph := ToolBuilder default build: self. newMorph openInWorld. - self tileViewer submorphs first updateMap. + self mapViewer submorphs first updateMap. ^ newMorph ] { #category : #helper, - #'squeak_changestamp' : 'Alex M 7/3/2024 23:57' + #'squeak_changestamp' : 'tw 7/12/2024 22:09' } GMTEEditor >> openTileMapInEditor: aTileMap [ "loads a tileMap into the editor" @@ -1666,7 +1587,7 @@ GMTEEditor >> openTileMapInEditor: aTileMap [ aTileMap tileSelectionSet highlightImage: nil. self tileMap: aTileMap. aTileMap model: self. - self tileViewer + self mapViewer removeAllMorphs; addMorph: aTileMap. self resetCommands. @@ -1740,7 +1661,7 @@ GMTEEditor >> parseSize: aText [ { #category : #building, - #'squeak_changestamp' : 'JS 7/12/2024 18:20' + #'squeak_changestamp' : 'tw 7/12/2024 22:09' } GMTEEditor >> placeSelectedTileIntoTileTray [ @@ -1751,30 +1672,11 @@ GMTEEditor >> placeSelectedTileIntoTileTray [ model: self; yourself. - self trayViewer morph + self tileTray morph color: Color transparent; addMorph: selectedTile ] -{ - #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:27' -} -GMTEEditor >> ratio [ - "the ratio of height to width of tiles" - - ^ ratio -] - -{ - #category : #accessing, - #'squeak_changestamp' : 'Alex M 6/22/2024 15:47' -} -GMTEEditor >> ratio: anObject [ - - ratio := anObject -] - { #category : #'command processing', #'squeak_changestamp' : 'Alex M 7/10/2024 14:17' @@ -1790,17 +1692,6 @@ GMTEEditor >> redo [ self savedSinceModified: false] ] -{ - #category : #TODO, - #'squeak_changestamp' : 'Alex M 7/2/2024 16:35' -} -GMTEEditor >> redoAllCommandsUntil: aValue [ - - "TODO: This is used for workarounds, better solutions required." - aValue to: 1 by: -1 do: [:i | (commands at: i) undo]. - 1 to: aValue do: [:i | (commands at: i) do] -] - { #category : #'layer button functions', #'squeak_changestamp' : 'TW 6/23/2024 21:50' @@ -1896,7 +1787,7 @@ GMTEEditor >> resetSelectedLayers [ ] { - #category : #TODO, + #category : #'menu button functions', #'squeak_changestamp' : 'tw 7/12/2024 17:46' } GMTEEditor >> resetView [ @@ -1905,23 +1796,24 @@ GMTEEditor >> resetView [ ] { - #category : #TODO, - #'squeak_changestamp' : 'mcjj 7/11/2024 17:52' + #category : #'as yet unclassified', + #'squeak_changestamp' : 'tw 7/12/2024 21:48' } GMTEEditor >> rotateSelectedTile [ self selectedTile: (self selectedTile rotateBy: #right centerAt: (self selectedTile extent / 2)). - self tileMap tileSelectionSet removeAllHighlightings. - self tileMap tileSelectionSet highlightImage: self selectedTile. - self tileMap tileSelectionSet applyAllHighlightings + self tileMap tileSelectionSet + removeAllHighlightings; + highlightImage: self selectedTile; + applyAllHighlightings ] { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:31' + #'squeak_changestamp' : 'tw 7/12/2024 21:59' } GMTEEditor >> savedSinceModified [ - "whether the tileMap has been modified since the last save" + "Whether the tileMap has been modified since the last save" ^ savedSinceModified ] @@ -1936,7 +1828,7 @@ GMTEEditor >> savedSinceModified: anObject [ ] { - #category : #accessing, + #category : #'as yet unclassified', #'squeak_changestamp' : 'jj 6/22/2024 21:33' } GMTEEditor >> selectAllLayers [ @@ -1957,7 +1849,7 @@ GMTEEditor >> selectFillBrush [ ] { - #category : #accessing, + #category : #'as yet unclassified', #'squeak_changestamp' : 'TW 6/25/2024 17:50' } GMTEEditor >> selectLayer: anIndex [ @@ -1982,7 +1874,7 @@ GMTEEditor >> selectLineBrush [ ] { - #category : #accessing, + #category : #'as yet unclassified', #'squeak_changestamp' : 'jj 6/22/2024 21:35' } GMTEEditor >> selectOnlyLayer: anIndex [ @@ -2015,8 +1907,8 @@ GMTEEditor >> selectRectangleBrush [ ] { - #category : #accessing, - #'squeak_changestamp' : 'JS 7/12/2024 18:12' + #category : #'as yet unclassified', + #'squeak_changestamp' : 'tw 7/12/2024 22:09' } GMTEEditor >> selectTile: anObject [ "selects a tile from the tile store" @@ -2027,7 +1919,7 @@ GMTEEditor >> selectTile: anObject [ ifFalse: [ self selectedTile: anObject fullResolutionSprite. self tileMap tileSelectionSet highlightImage: anObject fullResolutionSprite. - (self trayViewer morph submorphNamed: 'selectedTile') + (self tileTray morph submorphNamed: 'selectedTile') visible: true; updateSprite: anObject fullResolutionSprite; extent: 75@75] @@ -2035,10 +1927,10 @@ GMTEEditor >> selectTile: anObject [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:41' + #'squeak_changestamp' : 'tw 7/12/2024 22:00' } GMTEEditor >> selectedLayers [ - "set that contains the selected layers" + "Set that contains the user selected layers" ^ selectedLayers ] @@ -2054,10 +1946,10 @@ GMTEEditor >> selectedLayers: anObject [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:41' + #'squeak_changestamp' : 'tw 7/12/2024 22:06' } GMTEEditor >> selectedTile [ - "selected tile that is placed on the map" + "Currently selected form for painting the map" ^ selectedTile ] @@ -2103,10 +1995,10 @@ GMTEEditor >> setBrushRadiusFromText: aText [ { #category : #tilemap, - #'squeak_changestamp' : 'Alex M 7/12/2024 20:03' + #'squeak_changestamp' : 'tw 7/12/2024 21:44' } GMTEEditor >> setGridHeight: aText [ - "adjusts the grid height" + "If text is a valid size, adjust grid height" | oldSize newHeight | oldSize := self getGridWidth @ self getGridHeight. @@ -2122,10 +2014,10 @@ GMTEEditor >> setGridHeight: aText [ { #category : #tilemap, - #'squeak_changestamp' : 'Alex M 7/12/2024 20:06' + #'squeak_changestamp' : 'tw 7/12/2024 21:44' } GMTEEditor >> setGridWidth: aText [ - "adjusts the grid width" + "If text is a valid size, adjust grid width" | oldSize newWidth | oldSize := self getGridWidth @ self getGridHeight. @@ -2140,10 +2032,10 @@ GMTEEditor >> setGridWidth: aText [ { #category : #tilemap, - #'squeak_changestamp' : 'jj 6/22/2024 21:42' + #'squeak_changestamp' : 'tw 7/12/2024 21:44' } GMTEEditor >> setPadding: aText [ - "adjusts the map padding" + "If text is a valid size, adjust map padding" | newSize | newSize := self parsePaddingSize: aText. @@ -2221,10 +2113,10 @@ GMTEEditor >> swapLayer: anIndex with: anotherIndex [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:49' + #'squeak_changestamp' : 'tw 7/12/2024 22:06' } GMTEEditor >> tileMap [ - "the tileMap that the editor works on" + "The tileMap that the editor works on" ^ tileMap ] @@ -2240,10 +2132,10 @@ GMTEEditor >> tileMap: anObject [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:49' + #'squeak_changestamp' : 'tw 7/12/2024 22:07' } GMTEEditor >> tileStore [ - "the panel that shows the imported tilesets" + "Panel where the user can select tiles" ^ tileStore ] @@ -2259,21 +2151,21 @@ GMTEEditor >> tileStore: anObject [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:50' + #'squeak_changestamp' : 'tw 7/12/2024 22:10' } -GMTEEditor >> tileViewer [ - "the panel that contains the tileMap" +GMTEEditor >> tileTray [ + "Lower panel. Shows selected tile, and could be expanded for more utility" - ^ tileViewer + ^ tileTray ] { #category : #accessing, - #'squeak_changestamp' : 'TW 6/22/2024 01:30' + #'squeak_changestamp' : 'tw 7/12/2024 22:10' } -GMTEEditor >> tileViewer: anObject [ +GMTEEditor >> tileTray: anObject [ - tileViewer := anObject + tileTray := anObject ] { @@ -2307,25 +2199,6 @@ GMTEEditor >> toggleSelectedLayerVisibility [ self changed: #getLayerList ] -{ - #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:52' -} -GMTEEditor >> trayViewer [ - "the panel that contains the selected tile" - - ^ trayViewer -] - -{ - #category : #accessing, - #'squeak_changestamp' : 'TW 6/22/2024 01:30' -} -GMTEEditor >> trayViewer: anObject [ - - trayViewer := anObject -] - { #category : #'command processing', #'squeak_changestamp' : 'Alex M 7/12/2024 19:52' @@ -2342,15 +2215,15 @@ GMTEEditor >> undo [ ] { - #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:52' + #category : #'as yet unclassified', + #'squeak_changestamp' : 'tw 7/12/2024 22:09' } GMTEEditor >> unselectTile [ "unselects the currently selected tile" self selectedTile: nil. self tileMap tileSelectionSet highlightImage: nil. - self trayViewer morph submorphs first visible: false + self tileTray morph submorphs first visible: false ] { diff --git a/source/GM-TE/GMTEImageButton.class.st b/source/GM-TE/GMTEImageButton.class.st index 5bbcab24..436b3efa 100644 --- a/source/GM-TE/GMTEImageButton.class.st +++ b/source/GM-TE/GMTEImageButton.class.st @@ -32,11 +32,11 @@ GMTEImageButton >> actionSelector [ { #category : #accessing, - #'squeak_changestamp' : 'jannis 2/8/2024 18:31' + #'squeak_changestamp' : 'tw 7/12/2024 21:25' } -GMTEImageButton >> actionSelector: aSymbolOrString [ +GMTEImageButton >> actionSelector: anObject [ - actionSelector := aSymbolOrString asSymbol + actionSelector := anObject asSymbol ] { @@ -51,20 +51,20 @@ GMTEImageButton >> arguments [ { #category : #accessing, - #'squeak_changestamp' : 'Thomas Wolf 2/4/2024 23:10' + #'squeak_changestamp' : 'tw 7/12/2024 21:25' } -GMTEImageButton >> arguments: aCollection [ +GMTEImageButton >> arguments: anObject [ - arguments := aCollection asArray copy + arguments := anObject asArray copy ] { #category : #accessing, - #'squeak_changestamp' : 'TW 7/9/2024 18:24' + #'squeak_changestamp' : 'tw 7/12/2024 21:10' } -GMTEImageButton >> basicButtonGroup: aCollection [ +GMTEImageButton >> basicButtonGroup: anObject [ - buttonGroup := aCollection + buttonGroup := anObject ] { @@ -88,16 +88,16 @@ GMTEImageButton >> buttonGroup [ { #category : #accessing, - #'squeak_changestamp' : 'tw 7/12/2024 17:08' + #'squeak_changestamp' : 'tw 7/12/2024 21:11' } -GMTEImageButton >> buttonGroup: aCollection [ +GMTEImageButton >> buttonGroup: anObject [ - self basicButtonGroup: aCollection. - aCollection register: self as: self groupName + self basicButtonGroup: anObject. + anObject register: self as: self groupName ] { - #category : #accessing, + #category : #'visual properties', #'squeak_changestamp' : 'jj 6/22/2024 16:48' } GMTEImageButton >> createStateImagesFrom: anImage [ @@ -115,7 +115,7 @@ GMTEImageButton >> createStateImagesFrom: anImage [ ] { - #category : #button, + #category : #logic, #'squeak_changestamp' : 'TW 7/9/2024 18:22' } GMTEImageButton >> doButtonAction [ @@ -132,15 +132,13 @@ GMTEImageButton >> doButtonAction [ ] { - #category : #accessing, - #'squeak_changestamp' : 'Alex M 7/6/2024 23:07' + #category : #'visual properties', + #'squeak_changestamp' : 'tw 7/12/2024 21:14' } GMTEImageButton >> dyeSprite: anImage with: aColor [ ^ anImage copy replaceColor: Color white withColor: Color transparent; - "replaceColor: Color black withColor: aColor; - yourself" dyed: aColor ] @@ -171,10 +169,11 @@ GMTEImageButton >> enabled: aBoolean [ { #category : #accessing, - #'squeak_changestamp' : 'tw 7/12/2024 17:03' + #'squeak_changestamp' : 'tw 7/12/2024 21:27' } GMTEImageButton >> groupName [ - + "How this button is identified in its group" + ^ groupName ] @@ -278,17 +277,7 @@ GMTEImageButton >> mouseUp: anEvent [ ] { - #category : #accessing, - #'squeak_changestamp' : 'tw 7/12/2024 17:21' -} -GMTEImageButton >> onlySelect [ - - self buttonGroup ifNotNil: [self buttonGroup singleSelect: self]. - -] - -{ - #category : #accessing, + #category : #logic, #'squeak_changestamp' : 'tw 7/12/2024 17:23' } GMTEImageButton >> select [ @@ -299,10 +288,11 @@ GMTEImageButton >> select [ { #category : #accessing, - #'squeak_changestamp' : 'TW 7/9/2024 19:01' + #'squeak_changestamp' : 'tw 7/12/2024 21:27' } GMTEImageButton >> selected [ - + "Is this button in a group currently selected" + ^ selected ] @@ -316,7 +306,7 @@ GMTEImageButton >> selected: anObject [ ] { - #category : #accessing, + #category : #'visual properties', #'squeak_changestamp' : 'TW 6/25/2024 15:39' } GMTEImageButton >> setImageMode: aString [ @@ -327,9 +317,10 @@ GMTEImageButton >> setImageMode: aString [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 16:49' + #'squeak_changestamp' : 'tw 7/12/2024 21:27' } GMTEImageButton >> stateSprites [ + "The sprites for the various states the button can assume, preferably in different colours" ^ stateSprites ] @@ -364,29 +355,46 @@ GMTEImageButton >> target: anObject [ { #category : #'visual properties', - #'squeak_changestamp' : 'tw 7/12/2024 18:39' + #'squeak_changestamp' : 'tw 7/12/2024 21:27' } GMTEImageButton >> updateVisualState: anEvent [ - + "Guard to check whether this button is allowed to react to mouse input" self enabled ifFalse: [ self setImageMode: 'disabled'. ^ nil]. self buttonGroup - ifNil: [ + ifNil: [self updateVisualStateUngrouped: anEvent] + ifNotNil: [self updateVisualStateGrouped: anEvent] +] + +{ + #category : #'visual properties', + #'squeak_changestamp' : 'tw 7/12/2024 21:17' +} +GMTEImageButton >> updateVisualStateGrouped: anEvent [ + + self selected + ifFalse: [ (self containsPoint: Sensor cursorPoint) ifTrue: [anEvent redButtonPressed ifTrue: [self setImageMode: 'pressed'] ifFalse:[self setImageMode: 'hovered']] ifFalse: [self setImageMode: 'unpressed']] - ifNotNil: [ - self selected - ifFalse: [ - (self containsPoint: Sensor cursorPoint) - ifTrue: [anEvent redButtonPressed - ifTrue: [self setImageMode: 'pressed'] - ifFalse:[self setImageMode: 'hovered']] - ifFalse: [self setImageMode: 'unpressed']]] +] + +{ + #category : #'visual properties', + #'squeak_changestamp' : 'tw 7/12/2024 21:18' +} +GMTEImageButton >> updateVisualStateUngrouped: anEvent [ + + (self containsPoint: Sensor cursorPoint) + ifTrue: [anEvent redButtonPressed + ifTrue: [self setImageMode: 'pressed'] + ifFalse:[self setImageMode: 'hovered']] + ifFalse: [self setImageMode: 'unpressed'] + ] diff --git a/source/GM-TE/GMTETileContainer.class.st b/source/GM-TE/GMTETileContainer.class.st index 3685388e..40aa41fb 100644 --- a/source/GM-TE/GMTETileContainer.class.st +++ b/source/GM-TE/GMTETileContainer.class.st @@ -13,16 +13,16 @@ Class { { #category : #constants, - #'squeak_changestamp' : 'jj 6/23/2024 17:13' + #'squeak_changestamp' : 'tw 7/12/2024 21:38' } GMTETileContainer class >> minTileSize [ - "TODO: comment" + "Minimal size of tile" - ^ 40 + ^ 40 * RealEstateAgent scaleFactor ] { - #category : #'as yet unclassified', + #category : #'instance creation', #'squeak_changestamp' : 'jj 6/22/2024 16:50' } GMTETileContainer class >> withParent: aParent [ @@ -54,11 +54,12 @@ GMTETileContainer >> parent: anObject [ ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'jj 6/23/2024 17:13' + #category : #updating, + #'squeak_changestamp' : 'tw 7/12/2024 21:33' } GMTETileContainer >> step [ - + "Workaround since ScrollPane doesn't resize it's submorphs. This is to ensure our TileContainer rearranges itself" + | n gap minTileSize | (self parent isNil or: [self parent extent = self extent]) ifTrue: [^ nil]. @@ -67,11 +68,11 @@ GMTETileContainer >> step [ minTileSize := GMTETileContainer minTileSize. n := self width / minTileSize. gap := self width - (n floor * minTileSize) / n. - self submorphs do: [:tile| tile extent: (minTileSize + gap - 2)] "TODO: magic number" + self submorphs do: [:tile| tile extent: (minTileSize + gap - 2)] "Edge has a width of 1" ] { - #category : #'as yet unclassified', + #category : #accessing, #'squeak_changestamp' : 'jj 6/22/2024 16:50' } GMTETileContainer >> stepTime [