diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-02-26 15:37:03 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-02-26 15:37:03 +0100 |
| commit | e5aa5be42cbf93a31d3be387f24b3413f2983898 (patch) | |
| tree | 480627e83413cb5b300be954bb0e8f3b1833df99 /src/game_tab/editor | |
| parent | 2068f8c6c3d3faa842bb9920591aa2ef30bc157c (diff) | |
Prepare GUI for engines
Diffstat (limited to 'src/game_tab/editor')
| -rw-r--r-- | src/game_tab/editor/EditorPanel.cpp | 58 | ||||
| -rw-r--r-- | src/game_tab/editor/EditorPanel.hpp | 9 | ||||
| -rw-r--r-- | src/game_tab/editor/EditorPanelBF.cpp | 109 | ||||
| -rw-r--r-- | src/game_tab/editor/EditorPanelBF.h | 69 |
4 files changed, 185 insertions, 60 deletions
diff --git a/src/game_tab/editor/EditorPanel.cpp b/src/game_tab/editor/EditorPanel.cpp index ffc5499..641448e 100644 --- a/src/game_tab/editor/EditorPanel.cpp +++ b/src/game_tab/editor/EditorPanel.cpp @@ -8,62 +8,14 @@ wxDEFINE_EVENT(PREVIOUS_MOVE_EVENT, wxCommandEvent); wxDEFINE_EVENT(NEXT_MOVE_EVENT, wxCommandEvent); EditorPanel::EditorPanel(wxFrame *parent, Game *game) - : wxPanel(parent), game(game), selected_item(-1) { - - // ----- Init ----- - wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - wxNotebook *notebook = new wxNotebook(this, wxID_ANY); - - //----- CGEditor Page ----- - wxPanel *cgeditor_panel = new wxPanel(notebook, wxID_ANY); - wxBoxSizer *cgeditor_panel_sizer = new wxBoxSizer(wxVERTICAL); - editor_canvas = new EditorCanvas((wxFrame *)cgeditor_panel); - cgeditor_panel_sizer->Add(editor_canvas, 1, wxEXPAND); - // Comment box - wxStaticBox *commentBox = - new wxStaticBox(cgeditor_panel, wxID_ANY, "Move Comment"); - wxBoxSizer *commentBoxSizer = new wxBoxSizer(wxVERTICAL); - comment_input = new wxTextCtrl( - commentBox, COMMENT_INPUT_BOX, wxEmptyString, // Use right ID - wxDefaultPosition, wxSize(0, 150), wxTE_MULTILINE); - commentBoxSizer->Add(comment_input, 0, wxEXPAND); - commentBox->SetSizer(commentBoxSizer); - cgeditor_panel_sizer->Add(commentBox, 0, wxEXPAND); - cgeditor_panel->SetSizer(cgeditor_panel_sizer); - - //----- Tags Page ----- - wxPanel *tag_panel = new wxPanel(notebook, wxID_ANY); - wxBoxSizer *tag_panel_sizer = new wxBoxSizer(wxVERTICAL); - wxPanel *tag_edit_panel = new wxPanel(tag_panel, wxID_ANY); - wxBoxSizer *tag_edit_panel_sizer = new wxBoxSizer(wxVERTICAL); - tagTextCtrl = new wxTextCtrl(tag_edit_panel, wxID_ANY); - tagTextCtrl->SetHint(wxString("Name")); - tag_edit_panel_sizer->Add(tagTextCtrl, 1, wxEXPAND); - valueTextCtrl = new wxTextCtrl(tag_edit_panel, wxID_ANY); - valueTextCtrl->SetHint(wxString("Value")); - tag_edit_panel_sizer->Add(valueTextCtrl, 1, wxEXPAND); - tag_edit_panel_sizer->Add(new wxButton(tag_edit_panel, UPDATE_BTN, L"Update"), - 1, wxEXPAND); - tag_edit_panel->SetSizer(tag_edit_panel_sizer); - tag_panel_sizer->Add(tag_edit_panel, 0, wxEXPAND); - tags_list = new wxListCtrl(tag_panel, wxID_ANY, wxDefaultPosition, - wxDefaultSize, wxLC_REPORT); + : EditorPanelBF(parent), game(game), selected_item(-1) { + editor_canvas = new EditorCanvas((wxFrame *)editor_page); + editor_canvas_sizer->Add(editor_canvas, 1, wxEXPAND); tags_list->InsertColumn(0, L"Name", wxLIST_FORMAT_LEFT, 200); tags_list->InsertColumn(1, L"Value", wxLIST_FORMAT_LEFT, 500); + tagTextCtrl->SetHint("Tag"); + valueTextCtrl->SetHint("Value"); RefreshTagsList(); - tag_panel_sizer->Add(tags_list, 1, wxEXPAND); - delete_button = new wxButton(tag_panel, DELETE_BTN, L"Delete"); - delete_button->Enable(false); - tag_panel_sizer->Add(delete_button, 0, wxEXPAND); - tag_panel->SetSizer(tag_panel_sizer); - - //----- Notebook ----- - notebook->AddPage(cgeditor_panel, L"Editor"); - notebook->AddPage(tag_panel, L"Tags"); - sizer->Add(notebook, 1, wxEXPAND); - - //----- Sizer ----- - this->SetSizer(sizer); // Bind events this->Bind(wxEVT_TEXT, &EditorPanel::OnCommentChange, this, diff --git a/src/game_tab/editor/EditorPanel.hpp b/src/game_tab/editor/EditorPanel.hpp index 0a7c0d0..36d57f1 100644 --- a/src/game_tab/editor/EditorPanel.hpp +++ b/src/game_tab/editor/EditorPanel.hpp @@ -3,6 +3,7 @@ #include "ochess.hpp" #include <wx/listctrl.h> #include <wx/notebook.h> +#include "EditorPanelBF.h" // Local events wxDECLARE_EVENT(GOTO_MOVE_EVENT, wxCommandEvent); @@ -14,15 +15,9 @@ wxDECLARE_EVENT(REFRESH_TAB_TITLE, wxCommandEvent); // Foreign events wxDECLARE_EVENT(GAME_CHANGE, wxCommandEvent); -enum { COMMENT_INPUT_BOX = wxID_HIGHEST + 100, UPDATE_BTN, DELETE_BTN }; - -class EditorPanel : public wxPanel { +class EditorPanel : public EditorPanelBF { Game *game; EditorCanvas *editor_canvas; - wxTextCtrl *comment_input; - wxListCtrl *tags_list; - wxTextCtrl *tagTextCtrl, *valueTextCtrl; - wxButton *delete_button; long selected_item; public: diff --git a/src/game_tab/editor/EditorPanelBF.cpp b/src/game_tab/editor/EditorPanelBF.cpp new file mode 100644 index 0000000..f74ef64 --- /dev/null +++ b/src/game_tab/editor/EditorPanelBF.cpp @@ -0,0 +1,109 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 3.10.1-40-g8042f487) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "EditorPanelBF.h" + +/////////////////////////////////////////////////////////////////////////// + +EditorPanelBF::EditorPanelBF( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + wxBoxSizer* main_sizer; + main_sizer = new wxBoxSizer( wxVERTICAL ); + + notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + editor_page = new wxPanel( notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + editor_page_sizer = new wxBoxSizer( wxVERTICAL ); + + editor_canvas_sizer = new wxBoxSizer( wxVERTICAL ); + + + editor_page_sizer->Add( editor_canvas_sizer, 1, wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( editor_page, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + editor_page_sizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + comment_label = new wxStaticText( editor_page, wxID_ANY, wxT("Comment:"), wxDefaultPosition, wxDefaultSize, 0 ); + comment_label->Wrap( -1 ); + editor_page_sizer->Add( comment_label, 0, wxALL|wxEXPAND, 5 ); + + 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 ); + + + editor_page->SetSizer( editor_page_sizer ); + editor_page->Layout(); + editor_page_sizer->Fit( editor_page ); + notebook->AddPage( editor_page, wxT("Editor"), false ); + tags_page = new wxPanel( notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* tags_page_sizer; + tags_page_sizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* tags_list_control_sizer; + tags_list_control_sizer = new wxBoxSizer( wxVERTICAL ); + + tagTextCtrl = new wxTextCtrl( tags_page, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + tags_list_control_sizer->Add( tagTextCtrl, 0, wxALL|wxEXPAND, 5 ); + + valueTextCtrl = new wxTextCtrl( tags_page, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + tags_list_control_sizer->Add( valueTextCtrl, 0, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer7; + bSizer7 = new wxBoxSizer( wxHORIZONTAL ); + + update_button = new wxButton( tags_page, UPDATE_BTN, wxT("Update"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer7->Add( update_button, 1, wxALL, 5 ); + + + tags_list_control_sizer->Add( bSizer7, 1, wxEXPAND, 5 ); + + + tags_page_sizer->Add( tags_list_control_sizer, 0, wxEXPAND, 5 ); + + tags_list = new wxListCtrl( tags_page, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT ); + tags_page_sizer->Add( tags_list, 1, wxALL|wxEXPAND, 5 ); + + delete_button = new wxButton( tags_page, DELETE_BTN, wxT("Delete selection"), wxDefaultPosition, wxDefaultSize, 0 ); + tags_page_sizer->Add( delete_button, 0, wxALL|wxEXPAND, 5 ); + + + tags_page->SetSizer( tags_page_sizer ); + tags_page->Layout(); + tags_page_sizer->Fit( tags_page ); + notebook->AddPage( tags_page, wxT("Tags"), false ); + engine_page = new wxPanel( notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* engine_page_sizer; + engine_page_sizer = new wxBoxSizer( wxVERTICAL ); + + engine_list_label = new wxStaticText( engine_page, wxID_ANY, wxT("Choose the engine to use:"), wxDefaultPosition, wxDefaultSize, 0 ); + engine_list_label->Wrap( -1 ); + engine_page_sizer->Add( engine_list_label, 0, wxALL, 5 ); + + engine_list = new wxListCtrl( engine_page, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); + engine_page_sizer->Add( engine_list, 1, wxALL|wxEXPAND, 5 ); + + analyze_game_button = new wxButton( engine_page, wxID_ANY, wxT("Analyze game"), wxDefaultPosition, wxDefaultSize, 0 ); + engine_page_sizer->Add( analyze_game_button, 0, wxALL|wxEXPAND, 5 ); + + live_analysis_button = new wxButton( engine_page, wxID_ANY, wxT("Live analysis"), wxDefaultPosition, wxDefaultSize, 0 ); + engine_page_sizer->Add( live_analysis_button, 0, wxALL|wxEXPAND, 5 ); + + + engine_page->SetSizer( engine_page_sizer ); + engine_page->Layout(); + engine_page_sizer->Fit( engine_page ); + notebook->AddPage( engine_page, wxT("Engine"), false ); + + main_sizer->Add( notebook, 1, wxEXPAND | wxALL, 5 ); + + + this->SetSizer( main_sizer ); + this->Layout(); +} + +EditorPanelBF::~EditorPanelBF() +{ +} diff --git a/src/game_tab/editor/EditorPanelBF.h b/src/game_tab/editor/EditorPanelBF.h new file mode 100644 index 0000000..092d750 --- /dev/null +++ b/src/game_tab/editor/EditorPanelBF.h @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 3.10.1-40-g8042f487) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include <wx/artprov.h> +#include <wx/xrc/xmlres.h> +#include <wx/sizer.h> +#include <wx/gdicmn.h> +#include <wx/statline.h> +#include <wx/font.h> +#include <wx/colour.h> +#include <wx/settings.h> +#include <wx/string.h> +#include <wx/stattext.h> +#include <wx/textctrl.h> +#include <wx/panel.h> +#include <wx/bitmap.h> +#include <wx/image.h> +#include <wx/icon.h> +#include <wx/button.h> +#include <wx/listctrl.h> +#include <wx/notebook.h> + +/////////////////////////////////////////////////////////////////////////// + +#define COMMENT_INPUT_BOX 1000 +#define UPDATE_BTN 1001 +#define DELETE_BTN 1002 + +/////////////////////////////////////////////////////////////////////////////// +/// Class EditorPanelBF +/////////////////////////////////////////////////////////////////////////////// +class EditorPanelBF : public wxPanel +{ + private: + + protected: + wxNotebook* notebook; + wxPanel* editor_page; + wxBoxSizer* editor_page_sizer; + wxBoxSizer* editor_canvas_sizer; + wxStaticLine* m_staticline1; + wxStaticText* comment_label; + wxTextCtrl* comment_input; + wxPanel* tags_page; + wxTextCtrl* tagTextCtrl; + wxTextCtrl* valueTextCtrl; + wxButton* update_button; + wxListCtrl* tags_list; + wxButton* delete_button; + wxPanel* engine_page; + wxStaticText* engine_list_label; + wxListCtrl* engine_list; + wxButton* analyze_game_button; + wxButton* live_analysis_button; + + public: + + EditorPanelBF( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 525,485 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + ~EditorPanelBF(); + +}; + |
