From 1713142670d10a387371c92e8d28df9247bff4f8 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 10 Jun 2020 11:02:54 +0200 Subject: [PATCH] Imperial units selection is added to the ConfigWizard --- src/slic3r/GUI/AppConfig.cpp | 3 +++ src/slic3r/GUI/ConfigWizard.cpp | 9 +++++++++ src/slic3r/GUI/ConfigWizard_private.hpp | 2 ++ 3 files changed, 14 insertions(+) diff --git a/src/slic3r/GUI/AppConfig.cpp b/src/slic3r/GUI/AppConfig.cpp index c9d4c026f..93589e536 100644 --- a/src/slic3r/GUI/AppConfig.cpp +++ b/src/slic3r/GUI/AppConfig.cpp @@ -98,6 +98,9 @@ void AppConfig::set_defaults() set("use_environment_map", "0"); #endif // ENABLE_ENVIRONMENT_MAP + if (get("use_inches").empty()) + set("use_inches", "0"); + // Remove legacy window positions/sizes erase("", "main_frame_maximized"); erase("", "main_frame_pos"); diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 18d8bb312..60323976c 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -29,6 +29,7 @@ #include "GUI.hpp" #include "GUI_App.hpp" #include "GUI_Utils.hpp" +#include "GUI_ObjectManipulation.hpp" #include "slic3r/Config/Snapshot.hpp" #include "slic3r/Utils/PresetUpdater.hpp" @@ -840,6 +841,10 @@ PageMode::PageMode(ConfigWizard *parent) append(radio_simple); append(radio_advanced); append(radio_expert); + + append_text("\n" + _L("The size of the object can be specified in inches")); + check_inch = new wxCheckBox(this, wxID_ANY, _L("Use inches")); + append(check_inch); } void PageMode::on_activate() @@ -850,6 +855,8 @@ void PageMode::on_activate() if (mode == "advanced") { radio_advanced->SetValue(true); } else if (mode == "expert") { radio_expert->SetValue(true); } else { radio_simple->SetValue(true); } + + check_inch->SetValue(wxGetApp().app_config->get("use_inches") == "1"); } void PageMode::serialize_mode(AppConfig *app_config) const @@ -866,6 +873,7 @@ void PageMode::serialize_mode(AppConfig *app_config) const return; app_config->set("view_mode", mode); + app_config->set("use_inches", check_inch->GetValue() ? "1" : "0"); } PageVendors::PageVendors(ConfigWizard *parent) @@ -2179,6 +2187,7 @@ bool ConfigWizard::run(RunReason reason, StartPage start_page) p->apply_config(app.app_config, app.preset_bundle, app.preset_updater); app.app_config->set_legacy_datadir(false); app.update_mode(); + app.obj_manipul()->update_ui_from_settings(); BOOST_LOG_TRIVIAL(info) << "ConfigWizard applied"; return true; } else { diff --git a/src/slic3r/GUI/ConfigWizard_private.hpp b/src/slic3r/GUI/ConfigWizard_private.hpp index 4fa9c472f..c99c5952b 100644 --- a/src/slic3r/GUI/ConfigWizard_private.hpp +++ b/src/slic3r/GUI/ConfigWizard_private.hpp @@ -316,6 +316,8 @@ struct PageMode: ConfigWizardPage wxRadioButton *radio_advanced; wxRadioButton *radio_expert; + wxCheckBox *check_inch; + PageMode(ConfigWizard *parent); void serialize_mode(AppConfig *app_config) const;