Skip to content

Commit

Permalink
temporary solution for tile deletion by resize, changed organization
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander Morgensterns committed Jul 2, 2024
1 parent c4bb99e commit 41c5651
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion source/GM-TE/GMTECommand.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Class {
#name : #GMTECommand,
#superclass : #Object,
#category : #'GM-TE-CommandProcessor'
#category : #'GM-TE-UI'
}

{
Expand Down
2 changes: 1 addition & 1 deletion source/GM-TE/GMTEEditTilesCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Class {
'previousSprites',
'currentSprites'
],
#category : #'GM-TE-CommandProcessor'
#category : #'GM-TE-UI'
}

{
Expand Down
21 changes: 18 additions & 3 deletions source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,17 @@ 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'
Expand Down Expand Up @@ -1781,13 +1792,17 @@ GMTEEditor >> trayViewer: anObject [

{
#category : #'command processing',
#'squeak_changestamp' : 'Alex M 7/1/2024 20:24'
#'squeak_changestamp' : 'Alex M 7/2/2024 17:32'
}
GMTEEditor >> undo [

"A bit hacky, maybe fix later"
(self currentCommand > 1) ifTrue: [(self commands at: self currentCommand) undo.
self currentCommand: self currentCommand - 1.
self savedSinceModified: false]
((self commands at: self currentCommand + 1) class = GMTETilemapSizeCommand)
ifTrue: [self redoAllCommandsUntil: self currentCommand].
self savedSinceModified: false].


]

{
Expand Down
2 changes: 1 addition & 1 deletion source/GM-TE/GMTEPlaceHolderCommand.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Class {
#name : #GMTEPlaceHolderCommand,
#superclass : #GMTECommand,
#category : #'GM-TE-CommandProcessor'
#category : #'GM-TE-UI'
}

{
Expand Down
14 changes: 8 additions & 6 deletions source/GM-TE/GMTETilemapSizeCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Class {
'newSize',
'savedTiles'
],
#category : #'GM-TE-CommandProcessor'
#category : #'GM-TE-UI'
}

{
Expand All @@ -27,12 +27,11 @@ GMTETilemapSizeCommand class >> prevValue: aNumber1 newValue: aNumber2 method: a

{
#category : #execution,
#'squeak_changestamp' : 'Alex M 7/1/2024 18:52'
#'squeak_changestamp' : 'Alex M 7/2/2024 16:36'
}
GMTETilemapSizeCommand >> do [

self editor perform: self method with: self newSize.
self restoreTiles
self editor perform: self method with: self newSize
]

{
Expand Down Expand Up @@ -101,14 +100,17 @@ GMTETilemapSizeCommand >> prevSize: anObject [

{
#category : #execution,
#'squeak_changestamp' : 'Alex M 7/1/2024 18:23'
#'squeak_changestamp' : 'Alex M 7/2/2024 17:23'
}
GMTETilemapSizeCommand >> restoreTiles [
"TODO: Use function of tilemap"

"self editor redoAllCommandsUntil: self editor currentCommand - 1."
]

{
#category : #execution,
#'squeak_changestamp' : 'Alex M 7/1/2024 18:52'
#'squeak_changestamp' : 'Alex M 7/2/2024 17:22'
}
GMTETilemapSizeCommand >> undo [

Expand Down

0 comments on commit 41c5651

Please sign in to comment.