mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-07-04 19:27:40 +00:00
Prompt the user before closing dirty tabs
This commit is contained in:
parent
f1a54fd165
commit
e686937ce9
9 changed files with 28 additions and 9 deletions
|
@ -11,6 +11,7 @@ GameTab::GameTab(wxFrame *parent, std::shared_ptr<Game> game)
|
|||
// Panels
|
||||
game->BuildAndVerify();
|
||||
board_panel = new GameTabLeftPanel((wxFrame *)splitter, game);
|
||||
board_panel->SetSaveToolEnable(false);
|
||||
editor_panel = new GameTabRightPanel((wxFrame *)splitter, game);
|
||||
splitter->SplitVertically(board_panel, editor_panel);
|
||||
|
||||
|
@ -59,6 +60,11 @@ void GameTab::OnGameChange(wxCommandEvent &event) {
|
|||
board_panel->Notify();
|
||||
RefreshTabTitle();
|
||||
}
|
||||
// Update dirty flag
|
||||
if(!is_linked){
|
||||
is_dirty=true;
|
||||
board_panel->SetSaveToolEnable(true);
|
||||
}
|
||||
}
|
||||
|
||||
void GameTab::RefreshTabTitle() {
|
||||
|
|
|
@ -29,5 +29,5 @@ public:
|
|||
std::shared_ptr<Game> GetGame() { return (std::shared_ptr<Game>(game)); }
|
||||
std::shared_ptr<GameBase> GetBase() { return nullptr; };
|
||||
void OnToolClick(wxCommandEvent &event);
|
||||
void OnLink(){board_panel->DisableSaveTool();};
|
||||
void OnLink(){board_panel->SetSaveToolEnable(false);};
|
||||
};
|
||||
|
|
|
@ -21,5 +21,5 @@ public:
|
|||
void OnGotoMove(wxCommandEvent &event);
|
||||
void OnRefreshBoard(wxCommandEvent &event);
|
||||
void ApplyPreferences();
|
||||
void DisableSaveTool(){game_toolbar->EnableTool(0,false);};
|
||||
void SetSaveToolEnable(bool state){game_toolbar->EnableTool(0,state);};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue