Skip to content

Commit

Permalink
trash button now grey when layer 1 selected
Browse files Browse the repository at this point in the history
  • Loading branch information
RedToxyl committed Jun 25, 2024
1 parent 2712457 commit 76ca066
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ GMTEEditor >> deselectAllLayers [

{
#category : #accessing,
#'squeak_changestamp' : 'TW 6/25/2024 16:02'
#'squeak_changestamp' : 'TW 6/25/2024 17:50'
}
GMTEEditor >> deselectLayer: anIndex [
"deletes the layer with the provided index"
Expand All @@ -674,7 +674,7 @@ GMTEEditor >> deselectLayer: anIndex [
(self selectedLayers includes: anIndex)
ifTrue: [
self selectedLayers remove: anIndex.
self singleLayerSelected ifTrue: [self enableSingleLayerButtons].
self updateButtonEnabled.
self
changed: #selectedLayers;
changed: #layerAt:]
Expand All @@ -695,23 +695,19 @@ GMTEEditor >> deselectTile [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'TW 6/25/2024 17:44'
#'squeak_changestamp' : 'TW 6/25/2024 17:51'
}
GMTEEditor >> disableSingleLayerButtons [

self associatedMorph ifNil: [^ nil].

GMTEEditor singleLayerActionNames do: [:aString | (self associatedMorph submorphNamed: aString) enabled: false ]
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'TW 6/25/2024 17:43'
#'squeak_changestamp' : 'TW 6/25/2024 17:51'
}
GMTEEditor >> enableSingleLayerButtons [

self associatedMorph ifNil: [^ nil].

GMTEEditor singleLayerActionNames do: [:aString | (self associatedMorph submorphNamed: aString) enabled: true ]
]

Expand Down Expand Up @@ -955,7 +951,7 @@ GMTEEditor >> importMenu [

{
#category : #initialization,
#'squeak_changestamp' : 'TW 6/25/2024 17:39'
#'squeak_changestamp' : 'TW 6/25/2024 17:51'
}
GMTEEditor >> initialize [
"starts the tile editor"
Expand All @@ -968,6 +964,7 @@ GMTEEditor >> initialize [
open;
ratio: 1;
savedSinceModified: true;
updateButtonEnabled;
changed: #getLayerList
]

Expand Down Expand Up @@ -1370,15 +1367,13 @@ GMTEEditor >> selectAllLayers [

{
#category : #accessing,
#'squeak_changestamp' : 'TW 6/25/2024 17:01'
#'squeak_changestamp' : 'TW 6/25/2024 17:50'
}
GMTEEditor >> selectLayer: anIndex [
"select the layer with anIndex"

self selectedLayers add: anIndex.
self singleLayerSelected
ifTrue: [self enableSingleLayerButtons]
ifFalse: [self disableSingleLayerButtons].
self updateButtonEnabled.
self
changed: #selectedLayers;
changed: #layerAt:
Expand Down Expand Up @@ -1682,6 +1677,23 @@ GMTEEditor >> unselectTile [
self trayViewer morph submorphs first visible: false
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'TW 6/25/2024 17:51'
}
GMTEEditor >> updateButtonEnabled [

self associatedMorph ifNil: [^ nil].

self singleLayerSelected
ifTrue: [self enableSingleLayerButtons]
ifFalse: [self disableSingleLayerButtons].

(self layerAt: 1)
ifTrue: [(self associatedMorph submorphNamed: 'buttonDeleteLayers') enabled: false]
ifFalse: [(self associatedMorph submorphNamed: 'buttonDeleteLayers') enabled: true]
]

{
#category : #building,
#'squeak_changestamp' : 'jj 6/23/2024 13:45'
Expand Down

0 comments on commit 76ca066

Please sign in to comment.