From fc9f6bd6a2cb86d42f4d3df87f128efa7501ea48 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 30 Dec 2022 16:24:44 +0100 Subject: [PATCH] Improve UI --- src/game_tab/GameTab.cpp | 2 ++ src/game_tab/left_panel/GameTabLeftPanel.cpp | 2 ++ src/ochess.cpp | 6 ++++++ src/ochess.hpp | 1 + 4 files changed, 11 insertions(+) diff --git a/src/game_tab/GameTab.cpp b/src/game_tab/GameTab.cpp index a9a12da..4657cb4 100644 --- a/src/game_tab/GameTab.cpp +++ b/src/game_tab/GameTab.cpp @@ -60,6 +60,8 @@ void GameTab::OnToolClick(wxCommandEvent &event){ related_file = newFileDialog.GetPath().ToStdString(); } SaveGame(related_file,game); + } else if(id==1){ + wxLogDebug("Not yet implemented"); } } diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp index 33383fd..71d44bf 100644 --- a/src/game_tab/left_panel/GameTabLeftPanel.cpp +++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp @@ -7,6 +7,8 @@ GameTabLeftPanel::GameTabLeftPanel(wxFrame *parent, std::shared_ptr game) // Configure toolbal game_toolbar->AddTool(0, wxT("Save As"), wxArtProvider::GetBitmap(wxART_FILE_SAVE, wxART_TOOLBAR)); + game_toolbar->AddTool(1, wxT("Duplicate Game"), + wxArtProvider::GetBitmap(wxART_COPY, wxART_TOOLBAR)); // Add board board_canvas = new BoardCanvas((wxFrame *)this); diff --git a/src/ochess.cpp b/src/ochess.cpp index 605c1a2..a7fb50b 100644 --- a/src/ochess.cpp +++ b/src/ochess.cpp @@ -25,6 +25,12 @@ void MyApp::NewGame(TabInfos *tabsrc,std::shared_ptr g){ i->Link(tabsrc); // Link opened game to tabsrc } +void MyApp::NewGame(std::shared_ptr g){ + MainWindow *w=((MainWindow *)this->GetTopWindow()); + w->NewGame(g); +} + + wxIMPLEMENT_APP(MyApp); diff --git a/src/ochess.hpp b/src/ochess.hpp index ca97d20..4b1b867 100644 --- a/src/ochess.hpp +++ b/src/ochess.hpp @@ -73,6 +73,7 @@ public: virtual bool OnInit(); std::vector ListTabInfos(); void NewGame(TabInfos *tabsrc,std::shared_ptr g); + void NewGame(std::shared_ptr g); }; wxDECLARE_APP(MyApp);