diff options
Diffstat (limited to 'src/slic3r/GUI')
-rw-r--r-- | src/slic3r/GUI/AppConfig.cpp | 4 | ||||
-rw-r--r-- | src/slic3r/GUI/Camera.cpp | 15 | ||||
-rw-r--r-- | src/slic3r/GUI/Camera.hpp | 1 | ||||
-rw-r--r-- | src/slic3r/GUI/GLCanvas3D.cpp | 3 | ||||
-rw-r--r-- | src/slic3r/GUI/GUI_Preview.cpp | 6 | ||||
-rw-r--r-- | src/slic3r/GUI/GUI_Preview.hpp | 2 | ||||
-rw-r--r-- | src/slic3r/GUI/Plater.cpp | 4 | ||||
-rw-r--r-- | src/slic3r/GUI/Preferences.cpp | 11 |
8 files changed, 30 insertions, 16 deletions
diff --git a/src/slic3r/GUI/AppConfig.cpp b/src/slic3r/GUI/AppConfig.cpp index edc9845a1..51bee9e75 100644 --- a/src/slic3r/GUI/AppConfig.cpp +++ b/src/slic3r/GUI/AppConfig.cpp @@ -73,8 +73,8 @@ void AppConfig::set_defaults() if (get("custom_toolbar_size").empty()) set("custom_toolbar_size", "100"); - if (get("camera_type").empty()) - set("camera_type", "1"); + if (get("use_perspective_camera").empty()) + set("use_perspective_camera", "1"); // Remove legacy window positions/sizes erase("", "main_frame_maximized"); diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 1f8513ac2..6cb8ff520 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -31,7 +31,7 @@ Camera::Camera() : phi(45.0f) , requires_zoom_to_bed(false) , inverted_phi(false) - , m_type(Ortho) + , m_type(Perspective) , m_target(Vec3d::Zero()) , m_theta(45.0f) , m_zoom(1.0) @@ -61,20 +61,17 @@ void Camera::set_type(EType type) if (m_type != type) { m_type = type; - - wxGetApp().app_config->set("camera_type", std::to_string(m_type)); + wxGetApp().app_config->set("use_perspective_camera", (m_type == Perspective) ? "1" : "0"); wxGetApp().app_config->save(); } } void Camera::set_type(const std::string& type) { - if (!type.empty() && (type != "1")) - { - unsigned char type_id = atoi(type.c_str()); - if (((unsigned char)Ortho < type_id) && (type_id < (unsigned char)Num_types)) - set_type((Camera::EType)type_id); - } + if (type == "1") + set_type(Perspective); + else + set_type(Ortho); } void Camera::select_next_type() diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index bd2541ce2..79e87c726 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -49,6 +49,7 @@ public: EType get_type() const { return m_type; } std::string get_type_as_string() const; void set_type(EType type); + // valid values for type: "0" -> ortho, "1" -> perspective void set_type(const std::string& type); void select_next_type(); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 25319e9ce..2f265eb92 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3312,6 +3312,9 @@ void GLCanvas3D::handle_sidebar_focus_event(const std::string& opt_key, bool foc void GLCanvas3D::update_ui_from_settings() { + m_camera.set_type(wxGetApp().app_config->get("use_perspective_camera")); + m_dirty = true; + #if ENABLE_RETINA_GL const float orig_scaling = m_retina_helper->get_scale_factor(); diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 2f5e10962..671c49eef 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -313,6 +313,12 @@ Preview::~Preview() } } +void Preview::set_as_dirty() +{ + if (m_canvas != nullptr) + m_canvas->set_as_dirty(); +} + void Preview::set_number_extruders(unsigned int number_extruders) { if (m_number_extruders != number_extruders) diff --git a/src/slic3r/GUI/GUI_Preview.hpp b/src/slic3r/GUI/GUI_Preview.hpp index 93038b0e5..993e260e4 100644 --- a/src/slic3r/GUI/GUI_Preview.hpp +++ b/src/slic3r/GUI/GUI_Preview.hpp @@ -110,6 +110,8 @@ public: wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; } GLCanvas3D* get_canvas3d() { return m_canvas; } + void set_as_dirty(); + void set_number_extruders(unsigned int number_extruders); void set_canvas_as_dirty(); void set_enabled(bool enabled); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f68267cef..9d0c979b6 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1774,7 +1774,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) set_current_panel(view3D); // updates camera type from .ini file - camera.set_type(get_config("camera_type")); + camera.set_type(get_config("use_perspective_camera")); } void Plater::priv::update(bool force_full_scene_refresh) @@ -1842,10 +1842,8 @@ void Plater::priv::update_ui_from_settings() // $self->{buttons_sizer}->Layout; // } -#if ENABLE_RETINA_GL view3D->get_canvas3d()->update_ui_from_settings(); preview->get_canvas3d()->update_ui_from_settings(); -#endif } ProgressStatusBar* Plater::priv::statusbar() diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 52cbdbb1d..7b3187012 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -28,7 +28,7 @@ void PreferencesDialog::build() m_icon_size_sizer->ShowItems(boost::any_cast<bool>(value)); this->layout(); } - }; + }; // TODO // $optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new( @@ -97,7 +97,7 @@ void PreferencesDialog::build() option = Option (def,"show_incompatible_presets"); m_optgroup->append_single_option_line(option); - // TODO: remove? + // TODO: remove? def.label = L("Use legacy OpenGL 1.1 rendering"); def.type = coBool; def.tooltip = L("If you have rendering issues caused by a buggy OpenGL 2.0 driver, " @@ -117,6 +117,13 @@ void PreferencesDialog::build() m_optgroup->append_single_option_line(option); #endif + def.label = L("Use perspective camera"); + def.type = coBool; + def.tooltip = L("If enabled, use perspective camera. If not enabled, use orthographic camera."); + def.set_default_value(new ConfigOptionBool{ app_config->get("use_perspective_camera") == "1" }); + option = Option(def, "use_perspective_camera"); + m_optgroup->append_single_option_line(option); + def.label = L("Use custom size for toolbar icons"); def.type = coBool; def.tooltip = L("If enabled, you can change size of toolbar icons manually."); |