aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/MainWindow.cpp10
-rw-r--r--src/MainWindow.hpp1
-rw-r--r--src/base_tab/BaseImportTab.cpp2
-rw-r--r--src/base_tab/BaseImportTab.hpp1
-rw-r--r--src/base_tab/BaseTab.hpp1
-rw-r--r--src/gui.cpp6
-rw-r--r--src/gui.h1
-rw-r--r--src/ochess.hpp1
8 files changed, 21 insertions, 2 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index a0e2ce6..7e50150 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -53,6 +53,7 @@ MainWindow::MainWindow()
Bind(wxEVT_MENU, &MainWindow::OnMenuItemClick, this, wxID_ANY);
Bind(REFRESH_ENGINE_LIST, &MainWindow::OnRefreshEngineList, this, wxID_ANY);
Bind(CLOSE_LINKED_TAB, &MainWindow::OnCloseTabLinkedTo, this, wxID_ANY);
+ Bind(wxEVT_AUINOTEBOOK_PAGE_CLOSED, &MainWindow::OnAuiNotebookPageClosed, this, wxID_ANY);
// Add new game tab by default
NewGame(std::shared_ptr<Game>(new Game()));
@@ -66,10 +67,19 @@ void MainWindow::AddPage(wxWindow* window, TabInfos* infos){
window->SetClientData(infos);
notebook->AddPage(window, window->GetLabel());
notebook->SetSelection(notebook->GetPageIndex(window));
+ // Refresh tab that require knowledge on other tabs
+ for(auto i: wxGetApp().ListTabInfos()){i->Refresh();}
+}
+
+void MainWindow::OnAuiNotebookPageClosed(wxAuiNotebookEvent& event){
+ // Refresh tab that require knowledge on other tabs
+ for(auto i: wxGetApp().ListTabInfos()){i->Refresh();}
}
void MainWindow::OnCloseTabEvent(wxCommandEvent &event) {
notebook->DeletePage(notebook->GetSelection());
+ // Refresh tab that require knowledge on other tabs
+ for(auto i: wxGetApp().ListTabInfos()){i->Refresh();}
}
void MainWindow::OnCloseTabLinkedTo(wxCommandEvent &event){
diff --git a/src/MainWindow.hpp b/src/MainWindow.hpp
index 5bff035..866a98b 100644
--- a/src/MainWindow.hpp
+++ b/src/MainWindow.hpp
@@ -29,6 +29,7 @@ class MainWindow : public MainFrame {
void OnCloseTabEvent(wxCommandEvent &event);
void OnRefreshEngineList(wxCommandEvent &event);
void OnMenuItemClick(wxCommandEvent &event);
+ void OnAuiNotebookPageClosed(wxAuiNotebookEvent& event);
void OnCloseTabLinkedTo(wxCommandEvent &event);
void AddPage(wxWindow* window, TabInfos* infos);
public:
diff --git a/src/base_tab/BaseImportTab.cpp b/src/base_tab/BaseImportTab.cpp
index 4fa9045..8396847 100644
--- a/src/base_tab/BaseImportTab.cpp
+++ b/src/base_tab/BaseImportTab.cpp
@@ -7,6 +7,8 @@ RefreshImportLists();
}
void BaseImportTab::RefreshImportLists(){
+ opened_game_list->Clear();
+ opened_db_list->Clear();
for (TabInfos *i : wxGetApp().ListTabInfos()) {
if (i->type == TabInfos::GAME) {
wxWindow *win = dynamic_cast<wxWindow *>(i);
diff --git a/src/base_tab/BaseImportTab.hpp b/src/base_tab/BaseImportTab.hpp
index 2076027..7a0237e 100644
--- a/src/base_tab/BaseImportTab.hpp
+++ b/src/base_tab/BaseImportTab.hpp
@@ -1,7 +1,6 @@
#include "ochess.hpp"
class BaseImportTab : public TabBase_TabImport {
-
TabInfos *main_tab;
public:
diff --git a/src/base_tab/BaseTab.hpp b/src/base_tab/BaseTab.hpp
index 788ba45..da70af4 100644
--- a/src/base_tab/BaseTab.hpp
+++ b/src/base_tab/BaseTab.hpp
@@ -23,4 +23,5 @@ public:
void RefreshLabel();
std::shared_ptr<Game> GetGame() { return (std::shared_ptr<Game>(game)); }
std::shared_ptr<GameBase> GetBase() { return (std::shared_ptr<GameBase>(base)); };
+ void Refresh() {import_tab->RefreshImportLists();};
}; \ No newline at end of file
diff --git a/src/gui.cpp b/src/gui.cpp
index ae717a5..b122cb1 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -616,10 +616,14 @@ TabBase_TabImport::TabBase_TabImport( wxWindow* parent, wxWindowID id, const wxP
wxBoxSizer* bSizer33;
bSizer33 = new wxBoxSizer( wxHORIZONTAL );
+ m_staticText29 = new wxStaticText( this, wxID_ANY, wxT("Database:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText29->Wrap( -1 );
+ bSizer33->Add( m_staticText29, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
opened_db_list = new wxComboBox( this, wxID_ANY, wxT("No other databases opened"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bSizer33->Add( opened_db_list, 100, wxALL|wxEXPAND, 5 );
- import_from_db_button = new wxButton( this, wxID_ANY, wxT("Import Selected Games"), wxDefaultPosition, wxDefaultSize, 0 );
+ import_from_db_button = new wxButton( this, wxID_ANY, wxT("Import Selection"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer33->Add( import_from_db_button, 0, wxALL, 5 );
diff --git a/src/gui.h b/src/gui.h
index 347cd89..ddf67e3 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -342,6 +342,7 @@ class TabBase_TabImport : public wxPanel
wxButton* import_from_game_button;
wxStaticLine* m_staticline4;
wxStaticText* from_db_label;
+ wxStaticText* m_staticText29;
wxComboBox* opened_db_list;
wxButton* import_from_db_button;
wxListCtrl* game_list;
diff --git a/src/ochess.hpp b/src/ochess.hpp
index 9b3bd3e..da9107b 100644
--- a/src/ochess.hpp
+++ b/src/ochess.hpp
@@ -52,6 +52,7 @@ public:
bool is_linked;
TabInfos(Type type_) : type(type_), id(tab_count), is_linked(false) { tab_count++; wxLogDebug("Tabid=%d",(int)id); }
void Link(TabInfos *tab);
+ virtual void Refresh(){};
virtual void ApplyPreferences() = 0;
virtual std::shared_ptr<Game> GetGame() = 0;
virtual std::shared_ptr<GameBase> GetBase() = 0;