Skip to content

Commit

Permalink
broke everything
Browse files Browse the repository at this point in the history
  • Loading branch information
RedToxyl committed Jun 23, 2024
1 parent 6221daf commit 8247c34
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 108 deletions.
119 changes: 27 additions & 92 deletions source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Class {
'savedSinceModified',
'inspector',
'morphBuilders',
'layerData',
'backgroundTile',
'tileMap'
],
Expand Down Expand Up @@ -60,6 +59,17 @@ GMTEEditor class >> getTileMapFromProjectName: aName withPath: aPath [
^ GMTEEditor getTileMapFromFileBinary: ((GitAssetLoader for: aName) loadAsset: aPath)
]

{
#category : #constants,
#'squeak_changestamp' : 'TW 6/23/2024 19:59'
}
GMTEEditor class >> getVisibilityIndicator: aBoolean [

aBoolean
ifTrue: [^ '(h)']
ifFalse: [^ '(v)']
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'jj 6/23/2024 14:09'
Expand Down Expand Up @@ -257,19 +267,6 @@ GMTEEditor >> buildWith: builder [
^ newMorph
]

{
#category : #'layer manipulation',
#'squeak_changestamp' : 'jj 6/22/2024 21:45'
}
GMTEEditor >> collectLayerData [
"transfers layer data from an imported tileMap to update the layerViewer"

self layerData: OrderedCollection new.
1 to: self layerCount do: [ :i |
self storeLayerN: i withVisibility: (self tileMap tileMatrixStack layerVisible: i)]

]

{
#category : #accessing,
#'squeak_changestamp' : 'jj 6/22/2024 20:39'
Expand Down Expand Up @@ -703,19 +700,6 @@ GMTEEditor >> exportMenu [
builder open: aMenuSpec
]

{
#category : #'layer manipulation',
#'squeak_changestamp' : 'jj 6/22/2024 20:50'
}
GMTEEditor >> forgetLayers: aSet [
"TODO: comment"

| toBeForgotten |
toBeForgotten := self selectedLayers asSortedCollection reversed.
toBeForgotten do: [:i | self layerData removeAt: i].
self changed: #getLayerList
]

{
#category : #helper,
#'squeak_changestamp' : 'jj 6/22/2024 20:51'
Expand Down Expand Up @@ -772,15 +756,14 @@ GMTEEditor >> getGridWidthAsString [

{
#category : #'layer manipulation',
#'squeak_changestamp' : 'jj 6/22/2024 20:54'
#'squeak_changestamp' : 'TW 6/23/2024 20:13'
}
GMTEEditor >> getLayerList [
"returns the layer list"

^ self layerData collect: [ :layerData |
layerData second
ifTrue: [layerData first, ' (v)']
ifFalse: [layerData first, ' (h)']]
self tileMap ifNil: [^ OrderedCollection new].

^ self tileMap tileMatrixStack matrixLayers collect: [:aLayer | aLayer displayName, (GMTEEditor getVisibilityIndicator: aLayer visible)]
]

{
Expand Down Expand Up @@ -840,7 +823,7 @@ GMTEEditor >> getTileRatioAsString [

{
#category : #'menu button functions',
#'squeak_changestamp' : 'jj 6/23/2024 14:05'
#'squeak_changestamp' : 'TW 6/23/2024 20:09'
}
GMTEEditor >> importFromMorph [
"import tilemap into editor from a .morph file"
Expand All @@ -856,7 +839,7 @@ GMTEEditor >> importFromMorph [
changed: #getTileRatioAsString;
changed: #getGridWidthAsString;
changed: #getGridHeightAsString;
collectLayerData
changed: #getLayerList
]

{
Expand Down Expand Up @@ -911,21 +894,20 @@ GMTEEditor >> importMenu [

{
#category : #initialisation,
#'squeak_changestamp' : 'jj 6/22/2024 20:57'
#'squeak_changestamp' : 'TW 6/23/2024 20:14'
}
GMTEEditor >> initialize [
"starts the tile editor"

super initialize.
self
layerData: OrderedCollection new;
selectedLayers: Set new;
storeLayerN: 1;
selectLayer: 1;
morphBuilders: Dictionary new;
open;
ratio: 1;
savedSinceModified: true
savedSinceModified: true;
changed: #getLayerList
]

{
Expand Down Expand Up @@ -1015,26 +997,6 @@ GMTEEditor >> layerCount [
^ self tileMap tileMatrixStack layerCount
]

{
#category : #accessing,
#'squeak_changestamp' : 'jj 6/22/2024 21:06'
}
GMTEEditor >> layerData [
"TODO: comment, what is this"

^ layerData

]

{
#category : #accessing,
#'squeak_changestamp' : 'TW 6/22/2024 01:31'
}
GMTEEditor >> layerData: anObject [

layerData := anObject
]

{
#category : #accessing,
#'squeak_changestamp' : 'jj 6/22/2024 21:07'
Expand Down Expand Up @@ -1264,7 +1226,7 @@ GMTEEditor >> ratio: anObject [

{
#category : #'layer button functions',
#'squeak_changestamp' : 'jj 6/22/2024 21:28'
#'squeak_changestamp' : 'TW 6/23/2024 20:07'
}
GMTEEditor >> renameLayer [
"renames the selected layer with a user chosen name"
Expand All @@ -1274,9 +1236,10 @@ GMTEEditor >> renameLayer [
ifTrue: [
selectedLayer := self getSelectedLayer.
newName := FillInTheBlankMorph
request: 'New Name:' initialAnswer: (self layerData at: selectedLayer) first.
request: 'New Name:' initialAnswer: (self tileMap layerNameOf: selectedLayer).
(newName isNil or: newName isEmpty)
ifFalse: [self updateLayerNameOf: selectedLayer to: newName]]
ifFalse: [self tileMap setLayerNameOf: selectedLayer to: newName]].
self changed: #getLayerList


]
Expand Down Expand Up @@ -1521,24 +1484,12 @@ GMTEEditor >> storeLayerN: aNumber [

{
#category : #'layer manipulation',
#'squeak_changestamp' : 'jj 6/22/2024 21:46'
}
GMTEEditor >> storeLayerN: aNumber withVisibility: aBoolean [
"TODO: comment"

self layerData add: {'Layer ', aNumber . aBoolean}.
self changed: #getLayerList
]

{
#category : #'layer manipulation',
#'squeak_changestamp' : 'jj 6/22/2024 21:49'
#'squeak_changestamp' : 'TW 6/23/2024 20:05'
}
GMTEEditor >> swapLayer: anIndex with: anotherIndex [
"swaps two layers"

| selectionOfA |
self layerData swap: anIndex with: anotherIndex.
self tileMap tileMatrixStack swapLayer: anIndex with: anotherIndex.
selectionOfA := self layerAt: anIndex.
self
Expand Down Expand Up @@ -1627,14 +1578,12 @@ GMTEEditor >> toggleGrid [

{
#category : #'layer button functions',
#'squeak_changestamp' : 'jj 6/22/2024 21:52'
#'squeak_changestamp' : 'TW 6/23/2024 20:05'
}
GMTEEditor >> toggleSelectedLayerVisibility [
"toggles the visibility of the selected layers"

self selectedLayers do: [:i |
self tileMap tileMatrixStack toggleLayerVisibility: i.
self layerData at: i put: {(self layerData at: i) first . (self layerData at: i) second not}].
self selectedLayers do: [:i |self tileMap tileMatrixStack toggleLayerVisibility: i].
self changed: #getLayerList
]

Expand Down Expand Up @@ -1669,20 +1618,6 @@ GMTEEditor >> unselectTile [
self trayViewer morph submorphs first visible: false
]

{
#category : #building,
#'squeak_changestamp' : 'jj 6/22/2024 21:52'
}
GMTEEditor >> updateLayerNameOf: anIndex to: aString [
"updates the name of a layer"

| visibility |
visibility := (self layerData at: anIndex) second.

self layerData at: anIndex put: {aString. visibility}.
self changed: #getLayerList
]

{
#category : #building,
#'squeak_changestamp' : 'jj 6/23/2024 13:45'
Expand Down
18 changes: 18 additions & 0 deletions source/GM-TE/GMTETileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,15 @@ GMTETileMap >> initialize [

]

{
#category : #accessing,
#'squeak_changestamp' : 'TW 6/23/2024 20:01'
}
GMTETileMap >> layerNameOf: anIndex [

^ self tileMatrixStack layerNameOf: anIndex
]

{
#category : #'dev-api',
#'squeak_changestamp' : 'Ivo Zilkenat 6/19/2024 22:53'
Expand Down Expand Up @@ -717,6 +726,15 @@ GMTETileMap >> setDimensionsWidth: aWidth height: aHeigth padding: aPadding [
mapPadding: aPadding
]

{
#category : #accessing,
#'squeak_changestamp' : 'TW 6/23/2024 20:03'
}
GMTETileMap >> setLayerNameOf: anIndex to: aString [

^ self tileMatrixStack setLayerNameOf: anIndex to: aString
]

{
#category : #'dev-api',
#'squeak_changestamp' : 'Ivo Zilkenat 6/19/2024 23:11'
Expand Down
32 changes: 20 additions & 12 deletions source/GM-TE/GMTETileMatrixLayer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Class {
#superclass : #GMTEStaticCoordinateMatrix,
#instVars : [
'layerIdx',
'visible'
'visible',
'displayName'
],
#category : #'GM-TE-Core'
}
Expand Down Expand Up @@ -69,6 +70,24 @@ GMTETileMatrixLayer >> belowLayer: aLayer [
^ (self aboveLayer: aLayer) not
]

{
#category : #accessing,
#'squeak_changestamp' : 'TW 6/23/2024 19:53'
}
GMTETileMatrixLayer >> displayName [

^ displayName
]

{
#category : #accessing,
#'squeak_changestamp' : 'TW 6/23/2024 19:53'
}
GMTETileMatrixLayer >> displayName: anObject [

displayName := anObject
]

{
#category : #enumerating,
#'squeak_changestamp' : 'jj 6/23/2024 13:56'
Expand All @@ -92,17 +111,6 @@ GMTETileMatrixLayer >> free [
self setNil
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Ivo Zilkenat 6/18/2024 10:25'
}
GMTETileMatrixLayer >> initialize [

super initialize.

self visible: true
]

{
#category : #accessing,
#'squeak_changestamp' : 'jj 6/22/2024 16:24'
Expand Down
20 changes: 19 additions & 1 deletion source/GM-TE/GMTETileMatrixStack.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,16 @@ GMTETileMatrixStack >> layerCount [
]

{
#category : #'as yet unclassified',
#category : #accessing,
#'squeak_changestamp' : 'TW 6/23/2024 20:01'
}
GMTETileMatrixStack >> layerNameOf: anIdx [

^ (self layer: anIdx) displayName
]

{
#category : #accessing,
#'squeak_changestamp' : 'jj 6/22/2024 16:29'
}
GMTETileMatrixStack >> layerVisible: anIdx [
Expand Down Expand Up @@ -390,6 +399,15 @@ GMTETileMatrixStack >> resetLayers: aSet [
self resetLayer: layerIdx]
]

{
#category : #accessing,
#'squeak_changestamp' : 'TW 6/23/2024 20:02'
}
GMTETileMatrixStack >> setLayerNameOf: anIdx to: aString [

^ (self layer: anIdx) displayName: aString
]

{
#category : #updating,
#'squeak_changestamp' : 'Ivo Zilkenat 6/18/2024 10:09'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ layerTests
testAddLayerButton
"tests the addLayer button function"

self assert: editor layerData size = 1.
self assert: editor layerCount = 1.
self assert: (editor selectedLayers includes: 1).
self clickButton: (editor layerViewer submorphNamed: 'addLayer').
self assert: editor layerData size = 2
self assert: editor layerCount = 2
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"loadTestMapFileToFileDirectory" : "JS 6/23/2024 18:18",
"setUp" : "jj 6/23/2024 18:55",
"tearDown" : "jj 6/22/2024 20:24",
"testAddLayerButton" : "JS 6/23/2024 18:29",
"testAddLayerButton" : "TW 6/23/2024 20:08",
"testDeleteLayer" : "jj 6/22/2024 20:25",
"testDirectImport" : "jj 6/22/2024 20:30",
"testDirectImportFromAssetbrowser" : "jj 6/22/2024 20:30",
Expand Down

0 comments on commit 8247c34

Please sign in to comment.