Skip to content

Commit accd9a5

Browse files
committed
Disable save button if nothing is loaded
1 parent c48b0b2 commit accd9a5

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Bender.bmx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Repeat
5353
Select EventSource()
5454
'Loading
5555
Case g_UserInterface.m_LoadButton
56-
g_GraphicsOutput.LoadFile(g_FileIO.SetFileToLoad())
56+
g_UserInterface.SetSaveButtonEnabled(g_GraphicsOutput.LoadFile(g_FileIO.SetFileToLoad()))
5757
'Saving
5858
Case g_UserInterface.m_SaveButton
5959
If g_FileIO.GetSaveAsFrames() Then

types/GraphicsOutput.bmx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ Type GraphicsOutput
3535

3636
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3737

38-
Method LoadFile(fileToLoad:String)
38+
Method LoadFile:Int(fileToLoad:String)
3939
m_SourceImage = LoadImage(fileToLoad, 0)
4040

4141
If m_SourceImage <> Null Then
4242
m_SourceImageSize = New SVec2I(m_SourceImage.Width, m_SourceImage.Height)
4343
DrawImageRect(m_SourceImage, 0, 0, m_SourceImageSize[0] * m_InputZoom, m_SourceImageSize[1] * m_InputZoom) 'Draw the source image to the backbuffer so limb tiles can be created
4444
m_LimbManager.CreateLimbParts(m_InputZoom, m_TileSize)
45+
Return True
4546
EndIf
47+
Return False
4648
EndMethod
4749

4850
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

types/UserInterface.bmx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Type UserInterface
9292

9393
m_LoadButton = CreateButton("Load", horizMargin, 0, buttonSize[0], buttonSize[1], m_ButtonPanel, BUTTON_PUSH)
9494
m_SaveButton = CreateButton("Save", horizMargin + buttonSize[0] + vertMargin, 0, buttonSize[0], buttonSize[1], m_ButtonPanel, BUTTON_PUSH)
95+
DisableGadget(m_SaveButton)
9596

9697
m_SettingsPanel = CreatePanel(m_SettingsPanelAnchor[0], m_SettingsPanelAnchor[1], m_SettingsPanelSize[0], m_SettingsPanelSize[1], m_LeftColumn, PANEL_GROUP, " Settings : ")
9798
SetGadgetLayout(m_SettingsPanel, m_SettingsPanelAnchor[0], m_SettingsPanelSize[0], m_SettingsPanelAnchor[1], m_SettingsPanelSize[1])
@@ -208,4 +209,14 @@ Type UserInterface
208209
Method GetMaxWorkspaceWidth:Int()
209210
Return DesktopWidth() - m_LeftColumnSize[0]
210211
EndMethod
212+
213+
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
214+
215+
Method SetSaveButtonEnabled(enabledOrNot:Int)
216+
If enabledOrNot Then
217+
EnableGadget(m_SaveButton)
218+
Else
219+
DisableGadget(m_SaveButton)
220+
EndIf
221+
EndMethod
211222
EndType

0 commit comments

Comments
 (0)