Skip to content

Commit

Permalink
Merge origin/tmm-dev into tmm-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jostja committed Jul 12, 2024
2 parents 9b437db + 672af24 commit f74d0b8
Show file tree
Hide file tree
Showing 8 changed files with 314 additions and 69 deletions.
30 changes: 24 additions & 6 deletions source/GM-TE/GMTEButtonGroup.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : #GMTEButtonGroup,
#superclass : #Set,
#superclass : #Dictionary,
#category : #'GM-TE-Core'
}

Expand All @@ -19,19 +19,37 @@ GMTEButtonGroup >> deselectAllExcept: aButton [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'TW 7/9/2024 18:17'
#'squeak_changestamp' : 'tw 7/12/2024 17:18'
}
GMTEButtonGroup >> register: aButton [
GMTEButtonGroup >> deselectAllExceptNamed: aName [

self add: aButton
self deselectAllExcept: (self at: aName)
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'TW 7/9/2024 19:04'
#'squeak_changestamp' : 'tw 7/12/2024 16:57'
}
GMTEButtonGroup >> register: aButton as: aString [

self at: aString put: aButton
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'tw 7/12/2024 17:18'
}
GMTEButtonGroup >> singleSelect: aButton [

aButton selected: true.
aButton select.
self deselectAllExcept: aButton
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'tw 7/12/2024 17:18'
}
GMTEButtonGroup >> singleSelectNamed: aName [

self singleSelect: (self at: aName)
]
49 changes: 26 additions & 23 deletions source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ GMTEEditor class >> hLayoutFrame: intI ofN: intN vUp: aFloat down: anotherFloat
^ LayoutFrame fractions: ((intI - 1 / intN @ aFloat) corner: (intI / intN @ (1 - anotherFloat)))
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'tw 7/12/2024 16:21'
}
GMTEEditor class >> initialize [

super initialize.
self register
]

{
#category : #constants,
#'squeak_changestamp' : 'TW 7/9/2024 11:28'
Expand Down Expand Up @@ -148,13 +158,13 @@ GMTEEditor class >> privateGetEditorTileMapFromFilePath: aFilePath [

{
#category : #squeakutils,
#'squeak_changestamp' : 'Alex M 7/10/2024 03:13'
#'squeak_changestamp' : 'tw 7/12/2024 16:20'
}
GMTEEditor class >> register [
"adds the tile editor to app menu"

"Maybe call this on new?"
TheWorldMenu registerOpenCommand: {'TileMap Editor'. {GMTEEditor. #startup}}
TheWorldMenu registerOpenCommand: {'TileMap Editor'. {self. #startup}}
]

{
Expand Down Expand Up @@ -815,7 +825,7 @@ GMTEEditor >> createTilestoreSpecWithBuilder: aBuilder [

{
#category : #building,
#'squeak_changestamp' : 'tw 7/11/2024 17:05'
#'squeak_changestamp' : 'tw 7/12/2024 17:08'
}
GMTEEditor >> createToolBarSpecWithBuilder: aBuilder [
"creates the spec for the tool bar"
Expand Down Expand Up @@ -844,7 +854,7 @@ GMTEEditor >> createToolBarSpecWithBuilder: aBuilder [
path: '/GMTEIcons/redo.png'.

(aBuilder pluggableImageButtonSpec new)
name: 'radiusBrush';
groupName: 'radiusBrush';
description: 'Brush';
model: self;
frame: (GMTEEditor hLayoutFrame: 3 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace);
Expand All @@ -854,7 +864,7 @@ GMTEEditor >> createToolBarSpecWithBuilder: aBuilder [
path: '/GMTEIcons/brush.png'.

(aBuilder pluggableImageButtonSpec new)
name: 'lineBrush';
groupName: 'lineBrush';
description: 'Line Tool';
model: self;
frame: (GMTEEditor hLayoutFrame: 4 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace);
Expand All @@ -864,7 +874,7 @@ GMTEEditor >> createToolBarSpecWithBuilder: aBuilder [
path: '/GMTEIcons/line.png'.

(aBuilder pluggableImageButtonSpec new)
name: 'fillBrush';
groupName: 'fillBrush';
description: 'Fill Tool';
model: self;
frame: (GMTEEditor hLayoutFrame: 5 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace);
Expand All @@ -874,7 +884,7 @@ GMTEEditor >> createToolBarSpecWithBuilder: aBuilder [
path: '/GMTEIcons/fill.png'.

(aBuilder pluggableImageButtonSpec new)
name: 'rectangleBrush';
groupName: 'rectangleBrush';
description: 'Rectangle Tool';
model: self;
frame: (GMTEEditor hLayoutFrame: 6 ofN: 7 vSymmetric: GMTEEditor toolBarVSpace);
Expand Down Expand Up @@ -1336,28 +1346,17 @@ GMTEEditor >> initialize [

{
#category : #initialization,
#'squeak_changestamp' : 'Valentin Teutschbein 7/9/2024 22:40'
#'squeak_changestamp' : 'tw 7/12/2024 17:27'
}
GMTEEditor >> initializeBrush [
"starts the tile editor"

self
brush: GMTEBrush new;
selectRadiusBrush;
initializeBrushButton;
setBrushRadius: 1
]

{
#category : #initialization,
#'squeak_changestamp' : 'TW 7/9/2024 19:42'
}
GMTEEditor >> initializeBrushButton [
"highlights the radius button at the start"

(self associatedMorph deepSubpartNamed: 'radiusBrush') select
]

{
#category : #initialization,
#'squeak_changestamp' : 'jj 6/23/2024 17:27'
Expand Down Expand Up @@ -1843,10 +1842,11 @@ GMTEEditor >> selectAllLayers [

{
#category : #'menu button functions',
#'squeak_changestamp' : 'TW 7/9/2024 11:16'
#'squeak_changestamp' : 'tw 7/12/2024 17:13'
}
GMTEEditor >> selectFillBrush [

self brushButtons singleSelectNamed: 'fillBrush'.
self brush selectFillBrush
]

Expand All @@ -1867,10 +1867,11 @@ GMTEEditor >> selectLayer: anIndex [

{
#category : #'menu button functions',
#'squeak_changestamp' : 'tw 7/11/2024 16:23'
#'squeak_changestamp' : 'tw 7/12/2024 17:13'
}
GMTEEditor >> selectLineBrush [

self brushButtons singleSelectNamed: 'lineBrush'.
self brush selectLineBrush
]

Expand All @@ -1889,19 +1890,21 @@ GMTEEditor >> selectOnlyLayer: anIndex [

{
#category : #'menu button functions',
#'squeak_changestamp' : 'TW 7/9/2024 19:18'
#'squeak_changestamp' : 'tw 7/12/2024 17:12'
}
GMTEEditor >> selectRadiusBrush [

self brushButtons singleSelectNamed: 'radiusBrush'.
self brush selectRadiusBrush
]

{
#category : #'menu button functions',
#'squeak_changestamp' : 'TW 7/9/2024 11:15'
#'squeak_changestamp' : 'tw 7/12/2024 17:23'
}
GMTEEditor >> selectRectangleBrush [

self brushButtons singleSelectNamed: 'rectangleBrush'.
self brush selectRectangleBrush
]

Expand Down
10 changes: 7 additions & 3 deletions source/GM-TE/GMTEEditorTileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,16 @@ GMTEEditorTileMap >> highlightTilesFromIndices: anIndexSet [

{
#category : #initialization,
#'squeak_changestamp' : 'Alex M 6/28/2024 20:24'
#'squeak_changestamp' : 'Ivo Zilkenat 7/12/2024 17:04'
}
GMTEEditorTileMap >> initialize [

super initialize.
self
tileSelectionSet: (GMTETileSelectionSet new);
previousTileStates: Dictionary new;
currentTileChanges: Dictionary new
currentTileChanges: Dictionary new;
hasStaticView: false
]

{
Expand Down Expand Up @@ -174,12 +175,15 @@ GMTEEditorTileMap >> mouseLeave: anEvent [

{
#category : #'event handling',
#'squeak_changestamp' : 'Valentin Teutschbein 7/12/2024 17:07'
#'squeak_changestamp' : 'Ivo Zilkenat 7/12/2024 17:20'
}
GMTEEditorTileMap >> mouseMove: anEvent [
"implements highlighting of tiles when hovering"

| activeLayer selectedIndices currentIndex |
super mouseMove: anEvent.
anEvent shiftPressed ifTrue: [^ nil].

self model singleLayerSelected ifFalse: [^ nil].

activeLayer := self tileMatrixStack layer: self model selectedLayers anyOne.
Expand Down
40 changes: 34 additions & 6 deletions source/GM-TE/GMTEImageButton.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Class {
'stateSprites',
'enabled',
'selected',
'buttonGroup'
'buttonGroup',
'groupName'
],
#category : #'GM-TE-UI',
#'squeak_changestamp' : '<historical>'
Expand Down Expand Up @@ -87,12 +88,12 @@ GMTEImageButton >> buttonGroup [

{
#category : #accessing,
#'squeak_changestamp' : 'TW 7/9/2024 18:30'
#'squeak_changestamp' : 'tw 7/12/2024 17:08'
}
GMTEImageButton >> buttonGroup: aCollection [

self basicButtonGroup: aCollection.
aCollection add: self
aCollection register: self as: self groupName
]

{
Expand Down Expand Up @@ -168,6 +169,24 @@ GMTEImageButton >> enabled: aBoolean [

]

{
#category : #accessing,
#'squeak_changestamp' : 'tw 7/12/2024 17:03'
}
GMTEImageButton >> groupName [

^ groupName
]

{
#category : #accessing,
#'squeak_changestamp' : 'tw 7/12/2024 17:03'
}
GMTEImageButton >> groupName: anObject [

groupName := anObject.
]

{
#category : #'event handling',
#'squeak_changestamp' : 'jj 6/22/2024 16:48'
Expand Down Expand Up @@ -260,12 +279,21 @@ GMTEImageButton >> mouseUp: anEvent [

{
#category : #accessing,
#'squeak_changestamp' : 'TW 7/9/2024 19:41'
#'squeak_changestamp' : 'tw 7/12/2024 17:21'
}
GMTEImageButton >> select [
GMTEImageButton >> onlySelect [

self buttonGroup ifNotNil: [self buttonGroup singleSelect: self].
self doButtonAction.

]

{
#category : #accessing,
#'squeak_changestamp' : 'tw 7/12/2024 17:23'
}
GMTEImageButton >> select [

self selected: true.
self setImageMode: 'pressed'
]

Expand Down
Loading

0 comments on commit f74d0b8

Please sign in to comment.