mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-07 02:26:29 +02:00
Prepare GUI for engines
This commit is contained in:
parent
2068f8c6c3
commit
e5aa5be42c
9 changed files with 1328 additions and 62 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -7,3 +7,6 @@
|
||||||
[submodule "libs/pgnp"]
|
[submodule "libs/pgnp"]
|
||||||
path = libs/pgnp
|
path = libs/pgnp
|
||||||
url = https://gitlab.com/manzerbredes/pgnp.git
|
url = https://gitlab.com/manzerbredes/pgnp.git
|
||||||
|
[submodule "libs/uciadapter"]
|
||||||
|
path = libs/uciadapter
|
||||||
|
url = https://gitlab.com/manzerbredes/uciadapter.git
|
||||||
|
|
|
@ -26,6 +26,11 @@ add_subdirectory(libs/pgnp)
|
||||||
target_link_libraries(ochess pgnp)
|
target_link_libraries(ochess pgnp)
|
||||||
include_directories(${PGNP_INCLUDE_DIR})
|
include_directories(${PGNP_INCLUDE_DIR})
|
||||||
|
|
||||||
|
#uciadapter
|
||||||
|
add_subdirectory(libs/uciadapter)
|
||||||
|
target_link_libraries(ochess uciadapter)
|
||||||
|
include_directories(${UCIADAPTER_INCLUDE_DIR})
|
||||||
|
|
||||||
# Assets
|
# Assets
|
||||||
add_custom_command(TARGET ochess PRE_BUILD
|
add_custom_command(TARGET ochess PRE_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
|
|
1
libs/uciadapter
Submodule
1
libs/uciadapter
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 3b0556669ca6285090a36c12ad0b41953b81c368
|
|
@ -57,9 +57,9 @@ MainWindow::MainWindow()
|
||||||
Bind(NEW_GAME_EVENT, &MainWindow::OnNewGame, this, wxID_ANY);
|
Bind(NEW_GAME_EVENT, &MainWindow::OnNewGame, this, wxID_ANY);
|
||||||
Bind(wxEVT_CLOSE_WINDOW, &MainWindow::OnClose, this);
|
Bind(wxEVT_CLOSE_WINDOW, &MainWindow::OnClose, this);
|
||||||
|
|
||||||
BaseTab *bt = new BaseTab((wxFrame *)notebook, "/home/loic/hartwig_tests.pgn");
|
/*BaseTab *bt = new BaseTab((wxFrame *)notebook, "/home/loic/hartwig_tests.pgn");
|
||||||
notebook->AddPage(bt, bt->GetLabel());
|
notebook->AddPage(bt, bt->GetLabel());
|
||||||
notebook->SetSelection(notebook->GetPageIndex(bt));
|
notebook->SetSelection(notebook->GetPageIndex(bt));*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OnSettings(wxCommandEvent &event) {
|
void MainWindow::OnSettings(wxCommandEvent &event) {
|
||||||
|
|
|
@ -8,62 +8,14 @@ wxDEFINE_EVENT(PREVIOUS_MOVE_EVENT, wxCommandEvent);
|
||||||
wxDEFINE_EVENT(NEXT_MOVE_EVENT, wxCommandEvent);
|
wxDEFINE_EVENT(NEXT_MOVE_EVENT, wxCommandEvent);
|
||||||
|
|
||||||
EditorPanel::EditorPanel(wxFrame *parent, Game *game)
|
EditorPanel::EditorPanel(wxFrame *parent, Game *game)
|
||||||
: wxPanel(parent), game(game), selected_item(-1) {
|
: EditorPanelBF(parent), game(game), selected_item(-1) {
|
||||||
|
editor_canvas = new EditorCanvas((wxFrame *)editor_page);
|
||||||
// ----- Init -----
|
editor_canvas_sizer->Add(editor_canvas, 1, wxEXPAND);
|
||||||
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);
|
|
||||||
tags_list->InsertColumn(0, L"Name", wxLIST_FORMAT_LEFT, 200);
|
tags_list->InsertColumn(0, L"Name", wxLIST_FORMAT_LEFT, 200);
|
||||||
tags_list->InsertColumn(1, L"Value", wxLIST_FORMAT_LEFT, 500);
|
tags_list->InsertColumn(1, L"Value", wxLIST_FORMAT_LEFT, 500);
|
||||||
|
tagTextCtrl->SetHint("Tag");
|
||||||
|
valueTextCtrl->SetHint("Value");
|
||||||
RefreshTagsList();
|
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
|
// Bind events
|
||||||
this->Bind(wxEVT_TEXT, &EditorPanel::OnCommentChange, this,
|
this->Bind(wxEVT_TEXT, &EditorPanel::OnCommentChange, this,
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "ochess.hpp"
|
#include "ochess.hpp"
|
||||||
#include <wx/listctrl.h>
|
#include <wx/listctrl.h>
|
||||||
#include <wx/notebook.h>
|
#include <wx/notebook.h>
|
||||||
|
#include "EditorPanelBF.h"
|
||||||
|
|
||||||
// Local events
|
// Local events
|
||||||
wxDECLARE_EVENT(GOTO_MOVE_EVENT, wxCommandEvent);
|
wxDECLARE_EVENT(GOTO_MOVE_EVENT, wxCommandEvent);
|
||||||
|
@ -14,15 +15,9 @@ wxDECLARE_EVENT(REFRESH_TAB_TITLE, wxCommandEvent);
|
||||||
// Foreign events
|
// Foreign events
|
||||||
wxDECLARE_EVENT(GAME_CHANGE, wxCommandEvent);
|
wxDECLARE_EVENT(GAME_CHANGE, wxCommandEvent);
|
||||||
|
|
||||||
enum { COMMENT_INPUT_BOX = wxID_HIGHEST + 100, UPDATE_BTN, DELETE_BTN };
|
class EditorPanel : public EditorPanelBF {
|
||||||
|
|
||||||
class EditorPanel : public wxPanel {
|
|
||||||
Game *game;
|
Game *game;
|
||||||
EditorCanvas *editor_canvas;
|
EditorCanvas *editor_canvas;
|
||||||
wxTextCtrl *comment_input;
|
|
||||||
wxListCtrl *tags_list;
|
|
||||||
wxTextCtrl *tagTextCtrl, *valueTextCtrl;
|
|
||||||
wxButton *delete_button;
|
|
||||||
long selected_item;
|
long selected_item;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
109
src/game_tab/editor/EditorPanelBF.cpp
Normal file
109
src/game_tab/editor/EditorPanelBF.cpp
Normal file
|
@ -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()
|
||||||
|
{
|
||||||
|
}
|
69
src/game_tab/editor/EditorPanelBF.h
Normal file
69
src/game_tab/editor/EditorPanelBF.h
Normal file
|
@ -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();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
1132
tools/wxframebuilder/EditorPanel.fbp
Normal file
1132
tools/wxframebuilder/EditorPanel.fbp
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue