fix multiple deco presets being able to be selected at once, fix "Decorations: Enable" coming up every time you open the deco editor, presets deselected when you leave editor

This commit is contained in:
jacob1 2013-07-16 11:24:11 -04:00
parent e0d982367b
commit 5773e6afb5
2 changed files with 13 additions and 15 deletions

View File

@ -798,6 +798,8 @@ bool GameModel::GetPaused()
} }
void GameModel::SetDecoration(bool decorationState) void GameModel::SetDecoration(bool decorationState)
{
if (ren->decorations_enable != decorationState)
{ {
ren->decorations_enable = decorationState?1:0; ren->decorations_enable = decorationState?1:0;
notifyDecorationChanged(); notifyDecorationChanged();
@ -807,6 +809,7 @@ void GameModel::SetDecoration(bool decorationState)
else else
SetInfoTip("Decorations Layer: Off"); SetInfoTip("Decorations Layer: Off");
} }
}
bool GameModel::GetDecoration() bool GameModel::GetDecoration()
{ {

View File

@ -741,6 +741,7 @@ void GameView::NotifyColourSelectorVisibilityChanged(GameModel * sender)
AddComponent(button); AddComponent(button);
} }
AddComponent(colourPicker); AddComponent(colourPicker);
c->SetActiveColourPreset(-1);
} }
} }
@ -753,15 +754,9 @@ void GameView::NotifyColourPresetsChanged(GameModel * sender)
int preset; int preset;
ColourPresetAction(GameView * _v, int preset) : preset(preset) { v = _v; } ColourPresetAction(GameView * _v, int preset) : preset(preset) { v = _v; }
void ActionCallback(ui::Button * sender_) void ActionCallback(ui::Button * sender_)
{
ToolButton *sender = (ToolButton*)sender_;
if(sender->GetSelectionState() == 0)
{ {
v->c->SetActiveColourPreset(preset); v->c->SetActiveColourPreset(preset);
v->c->SetColour(sender->Appearance.BackgroundInactive); v->c->SetColour(sender_->Appearance.BackgroundInactive);
}
else
sender->SetSelectionState(0);
} }
}; };