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
Ivo Zilkenat committed Jul 2, 2024
2 parents bce0011 + 6accca4 commit c332807
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 13 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
35 changes: 31 additions & 4 deletions source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ GMTEEditor class >> getVisibilityIndicator: aBoolean [
ifFalse: [^ ' (h)']
]

{
#category : #constants,
#'squeak_changestamp' : 'Alex M 7/2/2024 17:46'
}
GMTEEditor class >> maxNumberOfCommands [

^ 10
]

{
#category : #fileHandling,
#'squeak_changestamp' : 'jj 6/23/2024 14:09'
Expand Down Expand Up @@ -159,13 +168,16 @@ GMTEEditor class >> tileMapMinPaddingSize [

{
#category : #'command processing',
#'squeak_changestamp' : 'Alex M 6/28/2024 19:52'
#'squeak_changestamp' : 'Alex M 7/2/2024 17:50'
}
GMTEEditor >> addCommand: aCommand [

"when a new change is made, all timestamps from the 'future' are deleted"
[self commands size > self currentCommand] whileTrue: [self commands removeLast].

(self commands size > self class maxNumberOfCommands) ifTrue: [self commands removeFirst.
self currentCommand: self currentCommand - 1].

self commands add: aCommand.
self currentCommand: self currentCommand + 1
]
Expand Down Expand Up @@ -1355,6 +1367,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 +1804,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 c332807

Please sign in to comment.