From 1d78e106adf4cc5894f299d597c02a9b7e508173 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 26 Dec 2022 12:51:48 +0100 Subject: [PATCH] Debug database tab --- src/MainWindow.cpp | 4 +- src/base_tab/BaseGameTab.cpp | 125 +++---- src/base_tab/BaseGameTab.hpp | 13 +- src/base_tab/BaseManageTab.cpp | 22 +- src/base_tab/BaseManageTab.hpp | 11 +- src/base_tab/BaseTab.cpp | 52 ++- src/base_tab/BaseTab.hpp | 16 +- src/base_tab/GameListManager.cpp | 1 + src/base_tab/GameListManager.hpp | 5 +- src/base_tab/gamebase/GameBase.hpp | 2 + src/base_tab/gamebase/PGNGameBase.hpp | 2 + src/gui.cpp | 52 +-- src/gui.h | 22 +- src/ochess.hpp | 2 +- tools/wxFrameBuilder.fbp | 514 +++++++------------------- 15 files changed, 315 insertions(+), 528 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 5ac3d0a..dfc100c 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -59,8 +59,8 @@ MainWindow::MainWindow() NewGame(std::shared_ptr(new Game())); // Temporary TO REMOVE JUST FOR TESTS: - BaseTab *bt = new BaseTab((wxFrame *)notebook, "/home/loic/pgn/twic1467.pgn"); - this->AddPage(bt,bt); + //BaseTab *bt = new BaseTab((wxFrame *)notebook, "/home/loic/pgn/twic1467.pgn"); + //this->AddPage(bt,bt); } void MainWindow::AddPage(wxWindow* window, TabInfos* infos){ diff --git a/src/base_tab/BaseGameTab.cpp b/src/base_tab/BaseGameTab.cpp index 29729c4..4d16562 100644 --- a/src/base_tab/BaseGameTab.cpp +++ b/src/base_tab/BaseGameTab.cpp @@ -5,23 +5,19 @@ wxDEFINE_EVENT(OPEN_GAME_EVENT, wxCommandEvent); -BaseGameTab::BaseGameTab(wxFrame *parent, std::string base_file, TabInfos *main_tab) - : TabBase_TabGames(parent), base_file(base_file), - base(NULL),main_tab(main_tab) { +BaseGameTab::BaseGameTab(wxFrame *parent, std::shared_ptr base, TabInfos *main_tab) + : TabBase_TabGames(parent), main_tab(main_tab),base(base) { + + glm=std::make_shared(game_list); + Reset(base); - glm=new GameListManager(game_list); this->Bind(wxEVT_BUTTON, &BaseGameTab::OnDelete, this, ID_DELETE_BUTTON); - this->Bind(wxEVT_BUTTON, &BaseGameTab::OnSave, this, ID_SAVE_BUTTON); - this->Bind(wxEVT_BUTTON, &BaseGameTab::OnExport, this, ID_EXPORT_BUTTON); this->Bind(wxEVT_LIST_ITEM_ACTIVATED, &BaseGameTab::OnOpenGame, this, wxID_ANY); - this->Bind(wxEVT_BUTTON, &BaseGameTab::OnImport, this, ID_IMPORT_BUTTON); this->Bind(wxEVT_BUTTON, &BaseGameTab::OnApplyFilter, this, ID_APPLY_FILTER_BUTTON); this->Bind(wxEVT_TEXT_ENTER, &BaseGameTab::OnApplyFilter, this, ID_SEARCH_TERMS); - current_base->SetLabel(base_file); search_terms->SetHint("e.g: Paul Morphy"); - LoadFile(); } void BaseGameTab::OnApplyFilter(wxCommandEvent &event){ @@ -34,12 +30,12 @@ void BaseGameTab::OnApplyFilter(wxCommandEvent &event){ } void BaseGameTab::OnImport(wxCommandEvent &event) { - AppendGameDialog *dia = new AppendGameDialog(this, base); - dia->ShowModal(); - glm->Clear(); - deleted.clear(); - edited.clear(); - LoadFile(); + // AppendGameDialog *dia = new AppendGameDialog(this, base); + // dia->ShowModal(); + // glm->Clear(); + // deleted.clear(); + // edited.clear(); + // LoadFile(); } void BaseGameTab::OnDelete(wxCommandEvent &event) { @@ -50,35 +46,37 @@ void BaseGameTab::OnDelete(wxCommandEvent &event) { } void BaseGameTab::OnSave(wxCommandEvent &event) { - std::vector> new_games_bases; + // std::vector> new_games_bases; - // Build edited games vector - std::vector> edited_games; - for (auto itr = edited.begin(); itr != edited.end(); itr++) { - edited_games.push_back(itr->second); - } + // // Build edited games vector + // std::vector> edited_games; + // for (auto itr = edited.begin(); itr != edited.end(); itr++) { + // edited_games.push_back(itr->second); + // } - // Combine new_games and edited games - std::vector> new_games; - new_games.insert( - new_games.end(), edited_games.begin(), - edited_games.end()); // Add edited game (since they are also deleted) - base->Save(deleted, new_games_bases, new_games); + // // Combine new_games and edited games + // std::vector> new_games; + // new_games.insert( + // new_games.end(), edited_games.begin(), + // edited_games.end()); // Add edited game (since they are also deleted) + // base->Save(deleted, new_games_bases, new_games); - // Close all opened games in this database - wxCommandEvent closeLinkedTabEvent(CLOSE_LINKED_TAB, GetId()); - closeLinkedTabEvent.SetClientData(main_tab); - ProcessEvent(closeLinkedTabEvent); + // // Close all opened games in this database + // wxCommandEvent closeLinkedTabEvent(CLOSE_LINKED_TAB, GetId()); + // closeLinkedTabEvent.SetClientData(main_tab); + // ProcessEvent(closeLinkedTabEvent); - glm->Clear(); - edited.clear(); - deleted.clear(); - LoadFile(); + // glm->Clear(); + // edited.clear(); + // deleted.clear(); + // LoadFile(); } void BaseGameTab::OnOpenGame(wxListEvent &event) { long id = std::stoi(event.GetItem().GetText().ToStdString()); std::shared_ptr *g = new std::shared_ptr(base->GetGame(id)); + wxLogDebug("kjkj"); + if (g != NULL) { if(edited.find(id) != edited.end()){ // TODO: Focus on the game tab and if close reopen it @@ -97,33 +95,21 @@ void BaseGameTab::OnOpenGame(wxListEvent &event) { } } -void BaseGameTab::ApplyPreferences() {} - -void BaseGameTab::OnExport(wxCommandEvent &event) { - wxFileDialog openFileDialog(this, _("Export database"), "", "", - "Database files (*.pgn)|*.pgn", - wxFD_SAVE | wxFD_OVERWRITE_PROMPT); - if (openFileDialog.ShowModal() != wxID_CANCEL) { - std::string path = openFileDialog.GetPath().ToStdString(); - wxFileName file(base_file); - wxString ext = file.GetExt().Lower(); - GameBase *base; - if (ext == "pgn") { - base = new PGNGameBase(path); - base->Export(this->base); - delete base; - } +std::vector> BaseGameTab::GetEditedGames(){ + std::vector> games; + for(auto it = edited.begin(); it != edited.end(); it++){ + games.push_back(it->second); } + return(games); } -void BaseGameTab::LoadFile() { - wxFileName file(base_file); - wxString ext = file.GetExt().Lower(); - if (ext == "pgn") { - base = std::shared_ptr(new PGNGameBase(base_file)); - SetLabel(file.GetName() + "(PGN)"); - } +void BaseGameTab::Reset(std::shared_ptr base){ + glm->Clear(); + edited.clear(); + deleted.clear(); + // Load all games (for now :) + this->base=base; if (base != NULL) { while (base->NextGame()) { glm->AddGame( @@ -135,8 +121,23 @@ void BaseGameTab::LoadFile() { base->GetTag("ECO")); } } - - wxCommandEvent event(REFRESH_TAB_TITLE, GetId()); - event.SetEventObject(this); - ProcessEvent(event); } + +void BaseGameTab::OnExport(wxCommandEvent &event) { + // wxFileDialog openFileDialog(this, _("Export database"), "", "", + // "Database files (*.pgn)|*.pgn", + // wxFD_SAVE | wxFD_OVERWRITE_PROMPT); + // if (openFileDialog.ShowModal() != wxID_CANCEL) { + // std::string path = openFileDialog.GetPath().ToStdString(); + // wxFileName file(base_file); + // wxString ext = file.GetExt().Lower(); + // GameBase *base; + // if (ext == "pgn") { + // base = new PGNGameBase(path); + // base->Export(this->base); + // delete base; + // } + // } +} + + diff --git a/src/base_tab/BaseGameTab.hpp b/src/base_tab/BaseGameTab.hpp index c9be350..b634148 100644 --- a/src/base_tab/BaseGameTab.hpp +++ b/src/base_tab/BaseGameTab.hpp @@ -5,29 +5,28 @@ // Foreign events wxDECLARE_EVENT(OPEN_GAME_EVENT, wxCommandEvent); -wxDECLARE_EVENT(REFRESH_TAB_TITLE, wxCommandEvent); wxDECLARE_EVENT(CLOSE_LINKED_TAB, wxCommandEvent); class BaseGameTab : public TabBase_TabGames { std::shared_ptr base; std::vector deleted; std::unordered_map> edited; - std::string base_file; TabInfos *main_tab; - GameListManager *glm; public: - BaseGameTab(wxFrame *parent, std::string base_file, TabInfos *main_tab); - ~BaseGameTab() {delete(glm);}; + std::shared_ptr glm; - void ApplyPreferences(); - void LoadFile(); + BaseGameTab(wxFrame *parent, std::shared_ptr base, TabInfos *main_tab); + + void Reset(std::shared_ptr base); void OnDelete(wxCommandEvent &event); void OnSave(wxCommandEvent &event); void OnExport(wxCommandEvent &event); void OnOpenGame(wxListEvent &event); void OnImport(wxCommandEvent &event); void OnApplyFilter(wxCommandEvent &event); + std::vector> GetEditedGames(); + std::vector GetDeletedGameIds() {return(deleted);}; std::shared_ptr GetGame() { return (std::shared_ptr(NULL)); } std::shared_ptr GetBase() { return (std::shared_ptr(base)); }; }; \ No newline at end of file diff --git a/src/base_tab/BaseManageTab.cpp b/src/base_tab/BaseManageTab.cpp index db42b8b..f4e6649 100644 --- a/src/base_tab/BaseManageTab.cpp +++ b/src/base_tab/BaseManageTab.cpp @@ -1,9 +1,25 @@ #include "BaseManageTab.hpp" +#define ADD_INFO(text) {informations->WriteText(text);informations->WriteText("\n");} -BaseManageTab::BaseManageTab(wxFrame *parent): -TabBase_TabManage(parent) + +BaseManageTab::BaseManageTab(wxFrame *parent, std::shared_ptr db, std::shared_ptr glm): +TabBase_TabManage(parent), glm(glm), base(db) { - + RefreshInformations(); } +void BaseManageTab::RefreshInformations(){ + informations->Clear(); + wxFileName base_path(base->GetFilePath()); + ADD_INFO("Database Path: "+base_path.GetFullPath()); + ADD_INFO("File Size: "+base_path.GetHumanReadableSize()); + ADD_INFO("Last Modified: "+base_path.GetModificationTime().Format()); + ADD_INFO("Database Format: "+base->GetFormat()); + ADD_INFO("Total Number of Games: "+std::to_string(glm->rows.size())); +} + +void BaseManageTab::Reset(std::shared_ptr db) { + this->base=db; + RefreshInformations(); +} diff --git a/src/base_tab/BaseManageTab.hpp b/src/base_tab/BaseManageTab.hpp index 870cd74..39ef4bb 100644 --- a/src/base_tab/BaseManageTab.hpp +++ b/src/base_tab/BaseManageTab.hpp @@ -1,10 +1,15 @@ #include "ochess.hpp" - - +#include "GameListManager.hpp" +#include "gamebase/GameBase.hpp" class BaseManageTab : public TabBase_TabManage { + /// @brief Never free the following pointer in that class + std::shared_ptr glm; + std::shared_ptr base; public: - BaseManageTab(wxFrame *parent); + BaseManageTab(wxFrame *parent, std::shared_ptr db, std::shared_ptr glm); + void RefreshInformations(); + void Reset(std::shared_ptr db); }; \ No newline at end of file diff --git a/src/base_tab/BaseTab.cpp b/src/base_tab/BaseTab.cpp index 78b546e..05ff907 100644 --- a/src/base_tab/BaseTab.cpp +++ b/src/base_tab/BaseTab.cpp @@ -3,34 +3,68 @@ #include BaseTab::BaseTab(wxFrame *parent, std::string base_file) - : TabBase(parent), TabInfos(TabInfos::BASE){ + : TabBase(parent), TabInfos(TabInfos::BASE), base_file(base_file){ + + // First open the database + OpenDatabase(base_file); // Games tab - games_tab=new BaseGameTab((wxFrame *)notebook,base_file,this); + games_tab=new BaseGameTab((wxFrame *)notebook,base,this); notebook->AddPage(games_tab, "Games list",true); // true for selecting the tab // Import tab import_tab=new BaseImportTab((wxFrame *)notebook,this); notebook->AddPage(import_tab, "Import games"); // Manage tab - manage_tab=new BaseManageTab((wxFrame *)notebook); + manage_tab=new BaseManageTab((wxFrame *)notebook, base, games_tab->glm); notebook->AddPage(manage_tab, "Manage database"); - RefreshLabel(); - this->Bind(OPEN_GAME_EVENT, &BaseTab::OnNewGame, this, wxID_ANY); + // Refresh dynamic elements of the database (tab title, available db for import etc.) + Refresh(); + + // Bindings + this->Bind(OPEN_GAME_EVENT, &BaseTab::OnOpenGame, this, wxID_ANY); + this->Bind(wxEVT_BUTTON, &BaseTab::OnSave, this, ID_SAVE_BUTTON); + } -void BaseTab::OnNewGame(wxCommandEvent &event){ +void BaseTab::OnOpenGame(wxCommandEvent &event){ std::shared_ptr *g = (std::shared_ptr*)event.GetClientData(); this->game=*g; + + // Ask MainFrame to open a new game + // TODO: Simplify that is, use wxWidget main app to do it wxCommandEvent newGameEvent(NEW_GAME_EVENT, GetId()); newGameEvent.SetEventObject(this); newGameEvent.SetClientData((TabInfos*)this); ProcessEvent(newGameEvent); } -void BaseTab::ApplyPreferences() {} +void BaseTab::Refresh(){ + import_tab->RefreshImportLists(); + SetLabel(wxFileName(base->GetFilePath()).GetName()+" [DB]"); // Propagated to MainWindow tab title automatically by wxWidget +} -void BaseTab::RefreshLabel(){ - SetLabel("Database XX"); +void BaseTab::OpenDatabase(std::string dbpath) { + wxFileName file(dbpath); + wxString ext = file.GetExt().Lower(); + if (ext == "pgn") { + base.reset(); + base = std::shared_ptr(new PGNGameBase(dbpath)); + } +} + +void BaseTab::OnSave(wxCommandEvent &event) { + std::vector> dummy_empty_base; + base->Save(games_tab->GetDeletedGameIds(), dummy_empty_base, games_tab->GetEditedGames()); + + // Close all opened games in this database + wxCommandEvent closeLinkedTabEvent(CLOSE_LINKED_TAB, GetId()); + closeLinkedTabEvent.SetClientData((TabInfos*)this); + ProcessEvent(closeLinkedTabEvent); + + // Reopen the saved database + OpenDatabase(base_file); + games_tab->Reset(base); + manage_tab->Reset(base); } \ No newline at end of file diff --git a/src/base_tab/BaseTab.hpp b/src/base_tab/BaseTab.hpp index da70af4..c8efd11 100644 --- a/src/base_tab/BaseTab.hpp +++ b/src/base_tab/BaseTab.hpp @@ -7,21 +7,27 @@ wxDECLARE_EVENT(NEW_GAME_EVENT, wxCommandEvent); - class BaseTab : public TabBase, public TabInfos { + /// @brief The opened database std::shared_ptr base; + /// @brief The last opened game std::shared_ptr game; + + /// All sub tabs BaseGameTab *games_tab; BaseImportTab *import_tab; BaseManageTab *manage_tab; - void OnNewGame(wxCommandEvent &event); + std::string base_file; + + void OnOpenGame(wxCommandEvent &event); + void OnSave(wxCommandEvent &event); + void OpenDatabase(std::string dbpath); + public: BaseTab(wxFrame *parent, std::string base_file); - void ApplyPreferences(); - void RefreshLabel(); + void Refresh(); std::shared_ptr GetGame() { return (std::shared_ptr(game)); } std::shared_ptr GetBase() { return (std::shared_ptr(base)); }; - void Refresh() {import_tab->RefreshImportLists();}; }; \ No newline at end of file diff --git a/src/base_tab/GameListManager.cpp b/src/base_tab/GameListManager.cpp index 07c9feb..4ff2f85 100644 --- a/src/base_tab/GameListManager.cpp +++ b/src/base_tab/GameListManager.cpp @@ -41,6 +41,7 @@ void GameListManager::Clear(){ deleted_games.clear(); opened_games.clear(); rows.clear(); + game_counter=0; } void GameListManager::ClearDisplayedRow(){ diff --git a/src/base_tab/GameListManager.hpp b/src/base_tab/GameListManager.hpp index e97ff8a..3145297 100644 --- a/src/base_tab/GameListManager.hpp +++ b/src/base_tab/GameListManager.hpp @@ -22,14 +22,15 @@ typedef struct Item { } RType; class GameListManager { - wxListCtrl *game_list; long game_counter; - std::vector rows; + wxListCtrl *game_list; std::vector deleted_games, opened_games; void DisplayRow(long id); void ClearDisplayedRow(); public: + std::vector rows; + GameListManager(wxListCtrl *game_list); void AddGame(CType White,CType Black,CType Event,CType Round, CType Result, CType Eco); void Clear(); diff --git a/src/base_tab/gamebase/GameBase.hpp b/src/base_tab/gamebase/GameBase.hpp index efd531f..c39d714 100644 --- a/src/base_tab/gamebase/GameBase.hpp +++ b/src/base_tab/gamebase/GameBase.hpp @@ -14,6 +14,8 @@ public: virtual bool NextGame() = 0; virtual std::string GetTag(std::string tag) = 0; virtual void Reset() = 0; + virtual std::string GetFormat() = 0; + virtual std::string GetFilePath() = 0; /** * @brief Save the given base into current base format (export) * diff --git a/src/base_tab/gamebase/PGNGameBase.hpp b/src/base_tab/gamebase/PGNGameBase.hpp index ee1c99b..72b7302 100644 --- a/src/base_tab/gamebase/PGNGameBase.hpp +++ b/src/base_tab/gamebase/PGNGameBase.hpp @@ -18,6 +18,8 @@ public: std::vector> new_games); void Reset(); void Export(std::shared_ptr base); + std::string GetFormat() {return("PGN");}; + std::string GetFilePath() {return(file);}; static std::string GetMovesPGN(HalfMove *m, bool needDots); static std::string GetPGN(std::shared_ptr g); }; \ No newline at end of file diff --git a/src/gui.cpp b/src/gui.cpp index c4c3a29..507eca0 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -526,47 +526,25 @@ TabBase_TabGames::TabBase_TabGames( wxWindow* parent, wxWindowID id, const wxPoi wxBoxSizer* top_sizer; top_sizer = new wxBoxSizer( wxHORIZONTAL ); - current_base = new wxStaticText( this, wxID_ANY, wxT("unknown"), wxDefaultPosition, wxDefaultSize, 0 ); - current_base->Wrap( -1 ); - top_sizer->Add( current_base, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_staticText28 = new wxStaticText( this, wxID_ANY, wxT("Filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText28->Wrap( -1 ); + top_sizer->Add( m_staticText28, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - save_button = new wxButton( this, ID_SAVE_BUTTON, wxT("Save"), wxDefaultPosition, wxDefaultSize, 0 ); - top_sizer->Add( save_button, 0, wxALL, 5 ); + search_terms = new wxTextCtrl( this, ID_SEARCH_TERMS, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); + top_sizer->Add( search_terms, 1, wxALL|wxEXPAND, 5 ); - export_button = new wxButton( this, ID_EXPORT_BUTTON, wxT("Export"), wxDefaultPosition, wxDefaultSize, 0 ); - top_sizer->Add( export_button, 0, wxALL, 5 ); + apply_filter_button = new wxButton( this, ID_APPLY_FILTER_BUTTON, wxT("Apply"), wxDefaultPosition, wxDefaultSize, 0 ); + top_sizer->Add( apply_filter_button, 0, wxALL, 5 ); main_sizer->Add( top_sizer, 0, wxEXPAND, 5 ); - separator_1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - main_sizer->Add( separator_1, 0, wxEXPAND | wxALL, 5 ); - - wxBoxSizer* bSizer34; - bSizer34 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText28 = new wxStaticText( this, wxID_ANY, wxT("Filter:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText28->Wrap( -1 ); - bSizer34->Add( m_staticText28, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - search_terms = new wxTextCtrl( this, ID_SEARCH_TERMS, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); - bSizer34->Add( search_terms, 1, wxALL|wxEXPAND, 5 ); - - apply_filter_button = new wxButton( this, ID_APPLY_FILTER_BUTTON, wxT("Apply"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer34->Add( apply_filter_button, 0, wxALL, 5 ); - - - main_sizer->Add( bSizer34, 0, wxEXPAND, 5 ); - game_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxLC_REPORT ); main_sizer->Add( game_list, 1, wxALL|wxEXPAND, 5 ); wxBoxSizer* bottom_sizer; bottom_sizer = new wxBoxSizer( wxHORIZONTAL ); - import_button = new wxButton( this, ID_IMPORT_BUTTON, wxT("Import games"), wxDefaultPosition, wxDefaultSize, 0 ); - bottom_sizer->Add( import_button, 1, wxALL|wxEXPAND, 5 ); - delete_button = new wxButton( this, ID_DELETE_BUTTON, wxT("Mark as deleted"), wxDefaultPosition, wxDefaultSize, 0 ); bottom_sizer->Add( delete_button, 1, wxALL|wxEXPAND, 5 ); @@ -654,9 +632,19 @@ TabBase_TabManage::TabBase_TabManage( wxWindow* parent, wxWindowID id, const wxP wxBoxSizer* main_sizer; main_sizer = new wxBoxSizer( wxVERTICAL ); - m_staticText27 = new wxStaticText( this, wxID_ANY, wxT("TODO"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText27->Wrap( -1 ); - main_sizer->Add( m_staticText27, 0, wxALL, 5 ); + informations = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); + informations->SetBackgroundColour( wxColour( 235, 235, 235 ) ); + + main_sizer->Add( informations, 100, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bottom_sizer; + bottom_sizer = new wxBoxSizer( wxVERTICAL ); + + save_button = new wxButton( this, ID_SAVE_BUTTON, wxT("Save All Changes"), wxDefaultPosition, wxDefaultSize, 0 ); + bottom_sizer->Add( save_button, 0, wxALL|wxEXPAND, 5 ); + + + main_sizer->Add( bottom_sizer, 1, wxEXPAND, 5 ); this->SetSizer( main_sizer ); diff --git a/src/gui.h b/src/gui.h index 232b3e7..91de89e 100644 --- a/src/gui.h +++ b/src/gui.h @@ -55,13 +55,11 @@ #define UPDATE_BTN 1010 #define DELETE_BTN 1011 #define LIVE_ANALYSIS_GAME_BUTTON 1012 -#define ID_SAVE_BUTTON 1013 -#define ID_EXPORT_BUTTON 1014 -#define ID_SEARCH_TERMS 1015 -#define ID_APPLY_FILTER_BUTTON 1016 -#define ID_IMPORT_BUTTON 1017 -#define ID_DELETE_BUTTON 1018 -#define ID_LOAD_BUTTON 1019 +#define ID_SEARCH_TERMS 1013 +#define ID_APPLY_FILTER_BUTTON 1014 +#define ID_DELETE_BUTTON 1015 +#define ID_LOAD_BUTTON 1016 +#define ID_SAVE_BUTTON 1017 /////////////////////////////////////////////////////////////////////////////// /// Class MainFrame @@ -311,20 +309,15 @@ class TabBase_TabGames : public wxPanel private: protected: - wxStaticText* current_base; - wxButton* save_button; - wxButton* export_button; - wxStaticLine* separator_1; wxStaticText* m_staticText28; wxTextCtrl* search_terms; wxButton* apply_filter_button; wxListCtrl* game_list; - wxButton* import_button; wxButton* delete_button; public: - TabBase_TabGames( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + TabBase_TabGames( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 559,522 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); ~TabBase_TabGames(); @@ -365,7 +358,8 @@ class TabBase_TabManage : public wxPanel private: protected: - wxStaticText* m_staticText27; + wxTextCtrl* informations; + wxButton* save_button; public: diff --git a/src/ochess.hpp b/src/ochess.hpp index da9107b..7f94fe1 100644 --- a/src/ochess.hpp +++ b/src/ochess.hpp @@ -53,7 +53,7 @@ public: 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 void ApplyPreferences() {}; virtual std::shared_ptr GetGame() = 0; virtual std::shared_ptr GetBase() = 0; }; diff --git a/tools/wxFrameBuilder.fbp b/tools/wxFrameBuilder.fbp index b25560c..c442080 100644 --- a/tools/wxFrameBuilder.fbp +++ b/tools/wxFrameBuilder.fbp @@ -3622,7 +3622,7 @@ - + 0 wxAUI_MGR_DEFAULT @@ -3645,16 +3645,16 @@ wxTAB_TRAVERSAL - + main_sizer wxVERTICAL none - + 5 wxEXPAND | wxALL 1 - + 1 1 1 @@ -5135,7 +5135,7 @@ - + 0 wxAUI_MGR_DEFAULT @@ -5151,14 +5151,14 @@ TabBase_TabGames - 500,300 + 559,522 ; ; forward_declare 0 wxTAB_TRAVERSAL - + main_sizer wxVERTICAL @@ -5175,284 +5175,8 @@ 5 wxALIGN_CENTER_VERTICAL|wxALL - 1 + 0 - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - unknown - 0 - - 0 - - - 0 - - 1 - current_base - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - ID_SAVE_BUTTON - Save - - 0 - - 0 - - - 0 - - 1 - save_button - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - ID_EXPORT_BUTTON - Export - - 0 - - 0 - - - 0 - - 1 - export_button - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - separator_1 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - ; ; forward_declare - 0 - - - - - - - - 5 - wxEXPAND - 0 - - - bSizer34 - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - 1 1 1 @@ -5509,11 +5233,11 @@ -1 - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -5573,11 +5297,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -5710,88 +5434,15 @@ - + 5 wxEXPAND 0 - + bottom_sizer wxHORIZONTAL none - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - ID_IMPORT_BUTTON - Import games - - 0 - - 0 - - - 0 - - 1 - import_button - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - 5 wxALL|wxEXPAND @@ -5869,7 +5520,7 @@ - + 0 wxAUI_MGR_DEFAULT @@ -5892,7 +5543,7 @@ wxTAB_TRAVERSAL - + main_sizer wxVERTICAL @@ -5958,11 +5609,11 @@ -1 - + 5 wxALIGN_TOP|wxEXPAND 1 - + top_sizer wxHORIZONTAL @@ -6226,29 +5877,29 @@ -1 - + 5 wxEXPAND 100 - + bottom_sizer wxVERTICAL none - + 5 wxEXPAND 1 - + bSizer33 wxHORIZONTAL none - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -6305,11 +5956,11 @@ -1 - + 5 wxALL|wxEXPAND 100 - + 1 1 1 @@ -6370,11 +6021,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -6507,11 +6158,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -6614,9 +6265,9 @@ none 5 - wxALL - 0 - + wxALL|wxEXPAND + 100 + 1 1 1 @@ -6626,7 +6277,7 @@ - + 235,235,235 1 0 @@ -6644,16 +6295,15 @@ 0 0 wxID_ANY - TODO - 0 0 + 0 1 - m_staticText27 + informations 1 @@ -6663,14 +6313,102 @@ Resizable 1 - + wxTE_MULTILINE|wxTE_READONLY ; ; forward_declare 0 + + wxFILTER_NONE + wxDefaultValidator + + - -1 + + + + 5 + wxEXPAND + 1 + + + bottom_sizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + ID_SAVE_BUTTON + Save All Changes + + 0 + + 0 + + + 0 + + 1 + save_button + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + +