DoubleSliderForLayers: Added cog menu item "Sequential slider applied only to top layer"

This commit is contained in:
YuSanka 2025-02-12 12:49:07 +01:00 committed by Lukas Matena
parent fbfccc8116
commit 242c1a0415
4 changed files with 13 additions and 1 deletions

View File

@ -773,6 +773,11 @@ void DSForLayers::render_cog_menu()
if (m_cb_change_app_config)
m_cb_change_app_config("show_estimated_times_in_dbl_slider", m_show_estimated_times ? "1" : "0");
}
if (ImGuiPureWrap::menu_item_with_icon(_u8L("Sequential slider applied only to top layer").c_str(), "", icon_sz, 0, m_seq_top_layer_only)) {
m_seq_top_layer_only = !m_seq_top_layer_only;
if (m_cb_change_app_config)
m_cb_change_app_config("seq_top_layer_only", m_seq_top_layer_only ? "1" : "0");
}
if (m_mode == MultiAsSingle && m_draw_mode == dmRegular &&
ImGuiPureWrap::menu_item_with_icon(_u8L("Set extruder sequence for the entire print").c_str(), "")) {
if (m_ticks.edit_extruder_sequence(m_ctrl.GetMaxPos(), m_mode))

View File

@ -91,6 +91,7 @@ public:
void set_imgui_wrapper(Slic3r::GUI::ImGuiWrapper* imgui) { m_imgui = imgui; }
void show_estimated_times(bool show) { m_show_estimated_times = show; }
void show_ruler(bool show, bool show_bg) { m_show_ruler = show; m_show_ruler_bg = show_bg; }
void seq_top_layer_only(bool show) { m_seq_top_layer_only = show; }
// manipulation with slider from keyboard
@ -151,6 +152,7 @@ private:
bool m_show_ruler_bg { true };
bool m_show_cog_menu { false };
bool m_show_edit_menu { false };
bool m_seq_top_layer_only { false };
int m_pos_on_move { -1 };
DrawMode m_draw_mode { dmRegular };

View File

@ -301,6 +301,7 @@ void Preview::reload_print()
m_loaded = false;
load_print();
m_layers_slider->seq_top_layer_only(wxGetApp().app_config->get_bool("seq_top_layer_only"));
}
void Preview::msw_rescale()
@ -403,6 +404,7 @@ void Preview::create_sliders()
m_layers_slider->SetEmUnit(wxGetApp().em_unit());
m_layers_slider->set_imgui_wrapper(wxGetApp().imgui());
m_layers_slider->show_estimated_times(wxGetApp().app_config->get_bool("show_estimated_times_in_dbl_slider"));
m_layers_slider->seq_top_layer_only(wxGetApp().app_config->get_bool("seq_top_layer_only"));
m_layers_slider->show_ruler(wxGetApp().app_config->get_bool("show_ruler_in_dbl_slider"), wxGetApp().app_config->get_bool("show_ruler_bg_in_dbl_slider"));
m_layers_slider->SetDrawMode(wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA,
@ -410,8 +412,10 @@ void Preview::create_sliders()
m_layers_slider->set_callback_on_thumb_move( [this]() -> void { Preview::on_layers_slider_scroll_changed(); } );
m_layers_slider->set_callback_on_change_app_config([](const std::string& key, const std::string& val) -> void {
m_layers_slider->set_callback_on_change_app_config([this](const std::string& key, const std::string& val) -> void {
wxGetApp().app_config->set(key, val);
if (key == "seq_top_layer_only")
reload_print();
});
if (wxGetApp().is_editor()) {

View File

@ -146,6 +146,7 @@ void PreferencesDialog::show(const std::string& highlight_opt_key /*= std::strin
,"default_action_on_select_preset" })
m_optgroup_general->set_value(opt_key, app_config->get(opt_key) == "none");
m_optgroup_general->set_value("default_action_on_dirty_project", app_config->get("default_action_on_dirty_project").empty());
m_optgroup_gui->set_value("seq_top_layer_only", app_config->get_bool("seq_top_layer_only"));
// update colors for color pickers of the labels
update_color(m_sys_colour, wxGetApp().get_label_clr_sys());