From 5aea044961b18769f3a54693cdeb6a3bf0dfaa63 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 29 Dec 2022 16:34:14 +0100 Subject: [PATCH] Improve UI --- src/game_tab/left_panel/board/BoardCanvas.cpp | 2 +- src/gui.cpp | 48 +- src/gui.h | 20 +- tools/wxFrameBuilder.fbp | 968 ++++++++++++++++-- 4 files changed, 914 insertions(+), 124 deletions(-) diff --git a/src/game_tab/left_panel/board/BoardCanvas.cpp b/src/game_tab/left_panel/board/BoardCanvas.cpp index bf3e909..7338882 100644 --- a/src/game_tab/left_panel/board/BoardCanvas.cpp +++ b/src/game_tab/left_panel/board/BoardCanvas.cpp @@ -47,7 +47,7 @@ void BoardCanvas::OnPaint(wxPaintEvent &event) { // Setting up required attributes REFRESH_MOUSE_LOCATION(); square_width = t->GetSquaresSizes(); - canvas_size = dc.GetSize(); + canvas_size = this->GetSize(); boardX = (canvas_size.x - (8 * square_width)) / 2; boardY = (canvas_size.y - (8 * square_width)) / 2; if (boardX > canvas_size.x) diff --git a/src/gui.cpp b/src/gui.cpp index ed6941e..abad5b2 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -395,14 +395,14 @@ TabGameLeftPanel::TabGameLeftPanel( wxWindow* parent, wxWindowID id, const wxPoi wxBoxSizer* bar_sizer; bar_sizer = new wxBoxSizer( wxHORIZONTAL ); - swap_button = new wxBitmapButton( this, SWAP_BTN, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBORDER_NONE ); - bar_sizer->Add( swap_button, 0, wxALL|wxEXPAND, 3 ); - zoomin_button = new wxBitmapButton( this, ZOOM_IN_BTN, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBORDER_NONE ); - bar_sizer->Add( zoomin_button, 0, wxALL|wxEXPAND, 3 ); + bar_sizer->Add( zoomin_button, 0, wxALL|wxEXPAND, 5 ); zoomout_button = new wxBitmapButton( this, ZOOM_OUT_BTN, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBORDER_NONE ); - bar_sizer->Add( zoomout_button, 0, wxALL|wxEXPAND, 3 ); + bar_sizer->Add( zoomout_button, 0, wxALL|wxEXPAND, 5 ); + + swap_button = new wxBitmapButton( this, SWAP_BTN, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBORDER_NONE ); + bar_sizer->Add( swap_button, 0, wxALL|wxEXPAND, 5 ); fen_text_field = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_READONLY ); bar_sizer->Add( fen_text_field, 1, wxALL|wxEXPAND, 0 ); @@ -431,7 +431,7 @@ TabGameRightPanel::TabGameRightPanel( wxWindow* parent, wxWindowID id, const wxP editor_canvas_sizer = new wxBoxSizer( wxVERTICAL ); - editor_page_sizer->Add( editor_canvas_sizer, 1, wxEXPAND, 5 ); + editor_page_sizer->Add( editor_canvas_sizer, 100, wxEXPAND, 5 ); m_staticline1 = new wxStaticLine( editor_page, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); editor_page_sizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); @@ -443,6 +443,42 @@ TabGameRightPanel::TabGameRightPanel( wxWindow* parent, wxWindowID id, const wxP comment_input = new wxTextCtrl( editor_page, COMMENT_INPUT_BOX, wxEmptyString, wxDefaultPosition, wxSize( -1,200 ), wxTE_MULTILINE ); editor_page_sizer->Add( comment_input, 0, wxALL|wxEXPAND, 5 ); + wxGridSizer* nag_sizer; + nag_sizer = new wxGridSizer( 2, 8, 0, 0 ); + + nag_1 = new wxButton( editor_page, wxID_ANY, wxT("!"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + nag_sizer->Add( nag_1, 0, wxALL|wxEXPAND, 5 ); + + nag_2 = new wxButton( editor_page, wxID_ANY, wxT("?"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + nag_sizer->Add( nag_2, 0, wxALL|wxEXPAND, 5 ); + + nag_3 = new wxButton( editor_page, wxID_ANY, wxT("!!"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + nag_sizer->Add( nag_3, 0, wxALL|wxEXPAND, 5 ); + + nag_4 = new wxButton( editor_page, wxID_ANY, wxT("??"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + nag_sizer->Add( nag_4, 0, wxALL|wxEXPAND, 5 ); + + nag_5 = new wxButton( editor_page, wxID_ANY, wxT("!?"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + nag_sizer->Add( nag_5, 0, wxALL|wxEXPAND, 5 ); + + nag_6 = new wxButton( editor_page, wxID_ANY, wxT("?!"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + nag_sizer->Add( nag_6, 0, wxALL|wxEXPAND, 5 ); + + nag_10 = new wxButton( editor_page, wxID_ANY, wxT("="), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + nag_sizer->Add( nag_10, 0, wxALL|wxEXPAND, 5 ); + + nag_18 = new wxButton( editor_page, wxID_ANY, wxT("+-"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + nag_sizer->Add( nag_18, 0, wxALL|wxEXPAND, 5 ); + + nag_19 = new wxButton( editor_page, wxID_ANY, wxT("-+"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + nag_sizer->Add( nag_19, 0, wxALL|wxEXPAND, 5 ); + + nag_del = new wxButton( editor_page, wxID_ANY, wxT("DEL"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); + nag_sizer->Add( nag_del, 0, wxALL|wxEXPAND, 5 ); + + + editor_page_sizer->Add( nag_sizer, 1, wxEXPAND, 5 ); + editor_page->SetSizer( editor_page_sizer ); editor_page->Layout(); diff --git a/src/gui.h b/src/gui.h index 8ea4f21..f426772 100644 --- a/src/gui.h +++ b/src/gui.h @@ -48,9 +48,9 @@ #define ID_DIALOG_IMPORT_BUTTON 1003 #define ENGINE_SAVE_CONF_BUTTON 1004 #define ENGINE_DELETE_CONF_BUTTON 1005 -#define SWAP_BTN 1006 -#define ZOOM_IN_BTN 1007 -#define ZOOM_OUT_BTN 1008 +#define ZOOM_IN_BTN 1006 +#define ZOOM_OUT_BTN 1007 +#define SWAP_BTN 1008 #define COMMENT_INPUT_BOX 1009 #define UPDATE_BTN 1010 #define DELETE_BTN 1011 @@ -257,9 +257,9 @@ class TabGameLeftPanel : public wxPanel protected: wxBoxSizer* main_sizer; - wxBitmapButton* swap_button; wxBitmapButton* zoomin_button; wxBitmapButton* zoomout_button; + wxBitmapButton* swap_button; wxTextCtrl* fen_text_field; public: @@ -285,6 +285,16 @@ class TabGameRightPanel : public wxPanel wxStaticLine* m_staticline1; wxStaticText* comment_label; wxTextCtrl* comment_input; + wxButton* nag_1; + wxButton* nag_2; + wxButton* nag_3; + wxButton* nag_4; + wxButton* nag_5; + wxButton* nag_6; + wxButton* nag_10; + wxButton* nag_18; + wxButton* nag_19; + wxButton* nag_del; wxPanel* tags_page; wxTextCtrl* tagTextCtrl; wxTextCtrl* valueTextCtrl; @@ -299,7 +309,7 @@ class TabGameRightPanel : public wxPanel public: - TabGameRightPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + TabGameRightPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,379 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); ~TabGameRightPanel(); diff --git a/tools/wxFrameBuilder.fbp b/tools/wxFrameBuilder.fbp index 5b1ae05..ba5f979 100644 --- a/tools/wxFrameBuilder.fbp +++ b/tools/wxFrameBuilder.fbp @@ -29,7 +29,7 @@ 0 0 0 - + 0 wxAUI_MGR_DEFAULT @@ -122,7 +122,7 @@ - + main_sizer wxVERTICAL @@ -3622,7 +3622,7 @@ - + 0 wxAUI_MGR_DEFAULT @@ -3645,7 +3645,7 @@ wxTAB_TRAVERSAL - + main_sizer wxVERTICAL @@ -3711,7 +3711,7 @@ - + 0 wxAUI_MGR_DEFAULT @@ -3748,84 +3748,11 @@ bar_sizer wxHORIZONTAL none - - 3 + + 5 wxALL|wxEXPAND 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - SWAP_BTN - MyButton - - 0 - - 0 - - - 0 - - 1 - swap_button - 1 - - - protected - 1 - - - - Resizable - 1 - - wxBORDER_NONE - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 3 - wxALL|wxEXPAND - 0 - + 1 1 1 @@ -3894,11 +3821,11 @@ - - 3 + + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -3967,6 +3894,79 @@ + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + SWAP_BTN + MyButton + + 0 + + 0 + + + 0 + + 1 + swap_button + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBORDER_NONE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 0 wxALL|wxEXPAND @@ -4035,7 +4035,7 @@ - + 0 wxAUI_MGR_DEFAULT @@ -4051,23 +4051,23 @@ TabGameRightPanel - 500,300 + 500,379 ; ; forward_declare 0 wxTAB_TRAVERSAL - + main_sizer wxVERTICAL none - + 5 wxEXPAND | wxALL 1 - + 1 1 1 @@ -4120,11 +4120,11 @@ - + Editor 0 - + 1 1 1 @@ -4175,7 +4175,7 @@ wxTAB_TRAVERSAL - + editor_page_sizer wxVERTICAL @@ -4183,7 +4183,7 @@ 5 wxEXPAND - 1 + 100 editor_canvas_sizer @@ -4374,6 +4374,750 @@ + + 5 + wxEXPAND + 1 + + 8 + 0 + + nag_sizer + none + 2 + 0 + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + ! + + 0 + + 0 + + + 0 + + 1 + nag_1 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + ? + + 0 + + 0 + + + 0 + + 1 + nag_2 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + !! + + 0 + + 0 + + + 0 + + 1 + nag_3 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + ?? + + 0 + + 0 + + + 0 + + 1 + nag_4 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + !? + + 0 + + 0 + + + 0 + + 1 + nag_5 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + ?! + + 0 + + 0 + + + 0 + + 1 + nag_6 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + = + + 0 + + 0 + + + 0 + + 1 + nag_10 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + +- + + 0 + + 0 + + + 0 + + 1 + nag_18 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + -+ + + 0 + + 0 + + + 0 + + 1 + nag_19 + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + DEL + + 0 + + 0 + + + 0 + + 1 + nag_del + 1 + + + protected + 1 + + + + Resizable + 1 + + wxBU_EXACTFIT + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + @@ -5135,7 +5879,7 @@ - + 0 wxAUI_MGR_DEFAULT @@ -5158,7 +5902,7 @@ wxTAB_TRAVERSAL - + main_sizer wxVERTICAL @@ -5520,7 +6264,7 @@ - + 0 wxAUI_MGR_DEFAULT @@ -5543,16 +6287,16 @@ wxTAB_TRAVERSAL - + main_sizer wxVERTICAL none - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -5612,11 +6356,11 @@ - + 5 wxALIGN_TOP|wxEXPAND 0 - + games_sizer wxHORIZONTAL @@ -5880,16 +6624,16 @@ - + 5 wxEXPAND 80 - + databases_sizer wxVERTICAL none - + 5 wxEXPAND 0 @@ -6311,7 +7055,7 @@ - + 0 wxAUI_MGR_DEFAULT @@ -6334,16 +7078,16 @@ wxTAB_TRAVERSAL - + main_sizer wxVERTICAL none - + 5 wxALL|wxEXPAND 100 - + 1 1 1 @@ -6403,20 +7147,20 @@ - + 5 wxEXPAND 1 - + bottom_sizer wxVERTICAL none - + 5 wxALL|wxEXPAND 0 - + 1 1 1