From 416ab7635d74f04797c067c185df35f8476d87c1 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 25 Feb 2022 08:49:57 +0100 Subject: [PATCH] Update GUI --- src/MainWindow.cpp | 15 +++++++++++---- src/base_tab/BasePanelBF.cpp | 12 +++++++----- src/base_tab/BasePanelBF.h | 4 ++-- tools/wxframebuilder/BasePanel.fbp | 10 +++++----- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index e831d89..5c1a87f 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -19,25 +19,32 @@ MainWindow::MainWindow() wxMenu *menuFile = new wxMenu; menuFile->Append(1, "Open", "Open file"); Bind(wxEVT_MENU, &MainWindow::OnOpen, this, 1); + menuFile->AppendSeparator(); + menuFile->Append(10, "Save", "Save current game"); + menuFile->Append(11, "Save As", "Save current game as"); + menuFile->AppendSeparator(); menuFile->Append(4, "Settings", "Configure OChess"); Bind(wxEVT_MENU, &MainWindow::OnSettings, this, 4); menuFile->AppendSeparator(); menuFile->Append(wxID_EXIT); Bind(wxEVT_MENU, &MainWindow::OnExit, this, wxID_EXIT); + // Game menu menuGame = new wxMenu; menuGame->Append(2, "New", "Create new game"); Bind(wxEVT_MENU, &MainWindow::OnMenuNewGame, this, 2); menuGame->Append(3, "New from FEN", "Create new game using FEN"); Bind(wxEVT_MENU, &MainWindow::OnMenuNewGame, this, 3); - menuGame->AppendSeparator(); - menuGame->Append(10, "Save", "Save current game"); - menuGame->Append(11, "Save As", "Save current game as"); + + // Game base menu + wxMenu *menuBase = new wxMenu; + menuBase->Append(5, "New", "Create new database"); /// Menu bar menuBar = new wxMenuBar; menuBar->Append(menuFile, "&File"); menuBar->Append(menuGame, "&Game"); + menuBar->Append(menuBase, "&Database"); SetMenuBar(menuBar); // Create the wxNotebook widget @@ -145,7 +152,7 @@ void MainWindow::OnMenuNewGame(wxCommandEvent &event) { } void MainWindow::OnNewGame(wxCommandEvent &event) { - Game *g=(Game*)event.GetClientData(); + Game *g = (Game *)event.GetClientData(); NewGame(g); } diff --git a/src/base_tab/BasePanelBF.cpp b/src/base_tab/BasePanelBF.cpp index e7a5dfb..c6b8381 100644 --- a/src/base_tab/BasePanelBF.cpp +++ b/src/base_tab/BasePanelBF.cpp @@ -22,13 +22,15 @@ BasePanelBF::BasePanelBF( wxWindow* parent, wxWindowID id, const wxPoint& pos, c top_sizer->Add( current_base_label, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); current_base = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + current_base->Enable( false ); + top_sizer->Add( current_base, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - open_button = new wxButton( this, wxID_ANY, wxT("Open"), wxDefaultPosition, wxDefaultSize, 0 ); - top_sizer->Add( open_button, 0, wxALL, 5 ); + save_button = new wxButton( this, wxID_ANY, wxT("Save"), wxDefaultPosition, wxDefaultSize, 0 ); + top_sizer->Add( save_button, 0, wxALL, 5 ); - save_as_button = new wxButton( this, wxID_ANY, wxT("Save as"), wxDefaultPosition, wxDefaultSize, 0 ); - top_sizer->Add( save_as_button, 0, wxALL, 5 ); + export_button = new wxButton( this, wxID_ANY, wxT("Export"), wxDefaultPosition, wxDefaultSize, 0 ); + top_sizer->Add( export_button, 0, wxALL, 5 ); main_sizer->Add( top_sizer, 0, wxEXPAND, 5 ); @@ -39,7 +41,7 @@ BasePanelBF::BasePanelBF( wxWindow* parent, wxWindowID id, const wxPoint& pos, c wxBoxSizer* bottom_sizer; bottom_sizer = new wxBoxSizer( wxHORIZONTAL ); - delete_button = new wxButton( this, wxID_ANY, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); + delete_button = new wxButton( this, wxID_ANY, wxT("Delete selection"), wxDefaultPosition, wxDefaultSize, 0 ); bottom_sizer->Add( delete_button, 0, wxALL, 5 ); diff --git a/src/base_tab/BasePanelBF.h b/src/base_tab/BasePanelBF.h index 4e0e107..63c4939 100644 --- a/src/base_tab/BasePanelBF.h +++ b/src/base_tab/BasePanelBF.h @@ -37,8 +37,8 @@ class BasePanelBF : public wxPanel protected: wxStaticText* current_base_label; wxTextCtrl* current_base; - wxButton* open_button; - wxButton* save_as_button; + wxButton* save_button; + wxButton* export_button; wxListCtrl* game_list; wxButton* delete_button; diff --git a/tools/wxframebuilder/BasePanel.fbp b/tools/wxframebuilder/BasePanel.fbp index 619984a..14d0031 100644 --- a/tools/wxframebuilder/BasePanel.fbp +++ b/tools/wxframebuilder/BasePanel.fbp @@ -152,7 +152,7 @@ Dock 0 Left - 1 + 0 1 @@ -229,7 +229,7 @@ 0 0 wxID_ANY - Open + Save 0 @@ -239,7 +239,7 @@ 0 1 - open_button + save_button 1 @@ -302,7 +302,7 @@ 0 0 wxID_ANY - Save as + Export 0 @@ -312,7 +312,7 @@ 0 1 - save_as_button + export_button 1