aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab
diff options
context:
space:
mode:
Diffstat (limited to 'src/game_tab')
-rw-r--r--src/game_tab/left_panel/GameTabLeftPanel.cpp11
-rw-r--r--src/game_tab/left_panel/GameTabLeftPanel.hpp1
2 files changed, 10 insertions, 2 deletions
diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp
index c5bf8ae..4f09bdd 100644
--- a/src/game_tab/left_panel/GameTabLeftPanel.cpp
+++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp
@@ -32,9 +32,16 @@ GameTabLeftPanel::GameTabLeftPanel(wxFrame *parent, std::shared_ptr<Game> game)
void GameTabLeftPanel::OnToolClick(wxCommandEvent &event){
short id=event.GetId();
if(id==0){
- if(related_file.size()>0){
- // Todo implement save file
+ if(!related_file.size()>0){
+ wxFileDialog
+ newFileDialog(this, _("Save Game"), "", "",
+ "PGN files (*.pgn)|*.pgn", wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
+ if (newFileDialog.ShowModal() == wxID_CANCEL)
+ return;
+ // Create and open new db
+ related_file = newFileDialog.GetPath().ToStdString();
}
+ SaveGame(related_file,game);
}
}
diff --git a/src/game_tab/left_panel/GameTabLeftPanel.hpp b/src/game_tab/left_panel/GameTabLeftPanel.hpp
index 25cbcf0..d9995e4 100644
--- a/src/game_tab/left_panel/GameTabLeftPanel.hpp
+++ b/src/game_tab/left_panel/GameTabLeftPanel.hpp
@@ -3,6 +3,7 @@
#include "../Game.hpp"
#include "board/BoardCanvas.hpp"
#include "ochess.hpp"
+#include "base_tab/gamebase/GameBase.hpp"
// Foreign events
wxDECLARE_EVENT(GAME_CHANGE, wxCommandEvent);