From 5a43d62920f82bac38490ac92dd9a49edd1d44de Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Wed, 23 Feb 2022 19:41:50 +0100 Subject: Debug and improve preferences editor --- src/preferences/BoardPrefs.hpp | 1 - src/preferences/EditorPrefs.hpp | 44 ++++++++++++++++++++++++++++++++++ src/preferences/EditorPrefsPanelBF.cpp | 18 ++++++++++++++ src/preferences/EditorPrefsPanelBF.h | 38 +++++++++++++++++++++++++++++ src/preferences/preferences.hpp | 3 ++- 5 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 src/preferences/EditorPrefs.hpp create mode 100644 src/preferences/EditorPrefsPanelBF.cpp create mode 100644 src/preferences/EditorPrefsPanelBF.h (limited to 'src/preferences') diff --git a/src/preferences/BoardPrefs.hpp b/src/preferences/BoardPrefs.hpp index eff3b58..21fe1ce 100644 --- a/src/preferences/BoardPrefs.hpp +++ b/src/preferences/BoardPrefs.hpp @@ -96,7 +96,6 @@ public: virtual bool TransferDataFromWindow() { ApplyPreferences(); - MAINWIN->ApplyPreferences(); return (true); } }; diff --git a/src/preferences/EditorPrefs.hpp b/src/preferences/EditorPrefs.hpp new file mode 100644 index 0000000..dab05ca --- /dev/null +++ b/src/preferences/EditorPrefs.hpp @@ -0,0 +1,44 @@ +#include "EditorPrefsPanelBF.h" +#include "game_tab/board/BoardCanvas.hpp" +#include "ochess.hpp" +#include +#include +#include +#include +#include +#include + +class EditorPrefsPanel : public EditorPrefsPanelBF { + +public: + EditorPrefsPanel(wxWindow *parent) : EditorPrefsPanelBF(parent) { + + // Bind(wxEVT_SPINCTRL, &BoardPrefsPanel::OnConfChange, this, wxID_ANY); + } + void OnConfChange(wxCommandEvent &event) { + } + + virtual bool TransferDataToWindow() { + return true; + } + + void ApplyPreferences() { + + } + + virtual bool TransferDataFromWindow() { + + return (true); + } +}; + +class EditorPrefs : public wxPreferencesPage { +public: + virtual wxString GetName() const { return "Editor"; } + virtual wxBitmap GetLargeIcon() { + return wxArtProvider::GetBitmap(wxART_HELP, wxART_TOOLBAR); + } + virtual wxWindow *CreateWindow(wxWindow *parent) { + return new EditorPrefsPanel(parent); + } +}; \ No newline at end of file diff --git a/src/preferences/EditorPrefsPanelBF.cpp b/src/preferences/EditorPrefsPanelBF.cpp new file mode 100644 index 0000000..08a1b50 --- /dev/null +++ b/src/preferences/EditorPrefsPanelBF.cpp @@ -0,0 +1,18 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 3.10.1-40-g8042f487) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "EditorPrefsPanelBF.h" + +/////////////////////////////////////////////////////////////////////////// + +EditorPrefsPanelBF::EditorPrefsPanelBF( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ +} + +EditorPrefsPanelBF::~EditorPrefsPanelBF() +{ +} diff --git a/src/preferences/EditorPrefsPanelBF.h b/src/preferences/EditorPrefsPanelBF.h new file mode 100644 index 0000000..8736a59 --- /dev/null +++ b/src/preferences/EditorPrefsPanelBF.h @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 3.10.1-40-g8042f487) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class EditorPrefsPanelBF +/////////////////////////////////////////////////////////////////////////////// +class EditorPrefsPanelBF : public wxPanel +{ + private: + + protected: + + public: + + EditorPrefsPanelBF( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + ~EditorPrefsPanelBF(); + +}; + diff --git a/src/preferences/preferences.hpp b/src/preferences/preferences.hpp index d5dd603..2566111 100644 --- a/src/preferences/preferences.hpp +++ b/src/preferences/preferences.hpp @@ -1,2 +1,3 @@ #pragma once -#include "BoardPrefs.hpp" \ No newline at end of file +#include "BoardPrefs.hpp" +#include "EditorPrefs.hpp" -- cgit v1.2.3