Skip to content

Commit

Permalink
Modify project if wxWidgets preference is changed
Browse files Browse the repository at this point in the history
If the wxWidgets version is changed, then modify the currently loaded project
to match.
  • Loading branch information
Randalphwa committed Dec 1, 2023
1 parent 84be7bd commit 804a357
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/ui/preferences_dlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ bool PreferencesDlg::Create(wxWindow* parent, wxWindowID id, const wxString& tit
// clang-format on
// ***********************************************

#include "mainframe.h" // CMainFrame -- Main window frame
#include "preferences.h" // Set/Get wxUiEditor preferences
#include "mainframe.h" // CMainFrame -- Main window frame
#include "preferences.h" // Set/Get wxUiEditor preferences
#include "project_handler.h" // ProjectHandler class

void PreferencesDlg::OnInit(wxInitDialogEvent& event)
{
Expand Down Expand Up @@ -257,6 +258,7 @@ void PreferencesDlg::OnOK(wxCommandEvent& WXUNUSED(event))
bool is_prop_grid_changed = false;
bool is_dark_changed = false;
bool is_fullpath_changed = false;
bool is_cpp_preferences_changed = false;

if (m_colour_cpp->GetColour() != UserPrefs.get_CppColour())
is_color_changed = true;
Expand All @@ -275,6 +277,9 @@ void PreferencesDlg::OnOK(wxCommandEvent& WXUNUSED(event))
if (m_check_fullpath->GetValue() != UserPrefs.is_FullPathTitle())
is_fullpath_changed = true;

if (m_choice_cpp_version->GetStringSelection().ToStdString() != UserPrefs.get_CppWidgetsVersion())
is_cpp_preferences_changed = true;

UserPrefs.set_DarkModePending(
Prefs::PENDING_DARK_MODE_ENABLE |
(m_check_dark_mode->GetValue() ? Prefs::PENDING_DARK_MODE_ON : Prefs::PENDING_DARK_MODE_OFF));
Expand All @@ -287,6 +292,11 @@ void PreferencesDlg::OnOK(wxCommandEvent& WXUNUSED(event))
UserPrefs.set_WakaTimeEnabled(m_isWakaTimeEnabled);

UserPrefs.set_CppWidgetsVersion(m_choice_cpp_version->GetStringSelection().ToStdString());
if (is_cpp_preferences_changed)
{
// Project.getProjectNode()->set_value(prop_wxWidgets_version, UserPrefs.get_CppWidgetsVersion());
Project.getProjectNode()->modifyProperty(prop_wxWidgets_version, UserPrefs.get_CppWidgetsVersion());
}

UserPrefs.set_CppColour(m_colour_cpp->GetColour());
UserPrefs.set_PythonColour(m_colour_python->GetColour());
Expand Down

0 comments on commit 804a357

Please # to comment.