Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/slic3r/GUI/Tab.cpp')
-rw-r--r--src/slic3r/GUI/Tab.cpp105
1 files changed, 71 insertions, 34 deletions
diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp
index 76e8e8143..da88789c2 100644
--- a/src/slic3r/GUI/Tab.cpp
+++ b/src/slic3r/GUI/Tab.cpp
@@ -1,4 +1,4 @@
-#include "libslic3r/GCodeSender.hpp"
+// #include "libslic3r/GCodeSender.hpp"
#include "Tab.hpp"
#include "PresetBundle.hpp"
#include "PresetHints.hpp"
@@ -168,9 +168,12 @@ void Tab::create_preset_tab()
m_modified_label_clr = wxGetApp().get_label_clr_modified();
m_default_text_clr = wxGetApp().get_label_clr_default();
+ // Sizer with buttons for mode changing
+ m_mode_sizer = new PrusaModeSizer(panel);
+
m_hsizer = new wxBoxSizer(wxHORIZONTAL);
- sizer->Add(m_hsizer, 0, wxBOTTOM, 3);
- m_hsizer->Add(m_presets_choice, 1, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3);
+ sizer->Add(m_hsizer, 0, wxEXPAND | wxBOTTOM, 3);
+ m_hsizer->Add(m_presets_choice, 0, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3);
m_hsizer->AddSpacer(4);
m_hsizer->Add(m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->AddSpacer(4);
@@ -182,6 +185,12 @@ void Tab::create_preset_tab()
m_hsizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->AddSpacer(32);
m_hsizer->Add(m_question_btn, 0, wxALIGN_CENTER_VERTICAL);
+ // m_hsizer->AddStretchSpacer(32);
+ // StretchSpacer has a strange behavior under OSX, so
+ // There is used just additional sizer for m_mode_sizer with right alignment
+ auto mode_sizer = new wxBoxSizer(wxVERTICAL);
+ mode_sizer->Add(m_mode_sizer, 1, wxALIGN_RIGHT);
+ m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 5);
//Horizontal sizer to hold the tree and the selected page.
m_hsizer = new wxBoxSizer(wxHORIZONTAL);
@@ -236,9 +245,6 @@ void Tab::create_preset_tab()
// Initialize the DynamicPrintConfig by default keys/values.
build();
rebuild_page_tree();
-// update();
- // Load the currently selected preset into the GUI, update the preset selection box.
- load_current_preset();
}
void Tab::load_initial_data()
@@ -669,16 +675,17 @@ void Tab::reload_config()
void Tab::update_visibility()
{
- const ConfigOptionMode mode = wxGetApp().get_opt_mode();
+ const ConfigOptionMode mode = wxGetApp().get_mode();
Freeze();
for (auto page : m_pages)
page->update_visibility(mode);
update_page_tree_visibility();
- m_hsizer->Layout();
- Refresh();
+ // update mode for ModeSizer
+ m_mode_sizer->SetMode(mode);
+ Layout();
Thaw();
// to update tree items color
@@ -741,8 +748,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
wxPostEvent(this, event);
- auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params();
- if (opt_key == "fill_density")
+ ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF));
+ if (opt_key == "fill_density" || opt_key == "supports_enable" || opt_key == "pad_enable")
{
boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key);
og_freq_chng_params->set_value(opt_key, val);
@@ -871,8 +878,20 @@ void Tab::update_preset_description_line()
void Tab::update_frequently_changed_parameters()
{
- auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params();
+ auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF));
if (!og_freq_chng_params) return;
+
+ if (m_type == Preset::TYPE_SLA_PRINT)
+ {
+ for (auto opt_key : { "supports_enable", "pad_enable" })
+ {
+ boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key);
+ og_freq_chng_params->set_value(opt_key, val);
+ }
+ return;
+ }
+
+ // for m_type == Preset::TYPE_PRINT
boost::any value = og_freq_chng_params->get_config_value(*m_config, "fill_density");
og_freq_chng_params->set_value("fill_density", value);
@@ -1184,6 +1203,13 @@ void TabPrint::update()
if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA)
return; // ys_FIXME
+ //! Temporary workaround for the correct updates of the SpinCtrl (like "perimeters"):
+ // KillFocus() for the wxSpinCtrl use CallAfter function. So,
+ // to except the duplicate call of the update() after dialog->ShowModal(),
+ // let check if this process is already started.
+ if (is_msg_dlg_already_exist)
+ return;
+
Freeze();
double fill_density = m_config->option<ConfigOptionPercent>("fill_density")->value;
@@ -1206,6 +1232,7 @@ void TabPrint::update()
"- unchecked 'exact last layer height'\n"
"\nShall I adjust those settings in order to enable Spiral Vase?"));
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Spiral Vase")), wxICON_WARNING | wxYES | wxNO);
+ is_msg_dlg_already_exist = true;
DynamicPrintConfig new_conf = *m_config;
if (dialog->ShowModal() == wxID_YES) {
new_conf.set_key_value("perimeters", new ConfigOptionInt(1));
@@ -1222,6 +1249,7 @@ void TabPrint::update()
}
load_config(new_conf);
on_value_change("fill_density", fill_density);
+ is_msg_dlg_already_exist = false;
}
if (m_config->opt_bool("wipe_tower") && m_config->opt_bool("support_material") &&
@@ -2080,7 +2108,7 @@ PageShp TabPrinter::build_kinematics_page()
if (m_use_silent_mode) {
// Legend for OptionsGroups
- auto optgroup = page->new_optgroup(_(L("")));
+ auto optgroup = page->new_optgroup("");
optgroup->set_show_modified_btns_val(false);
optgroup->label_width = 230;
auto line = Line{ "", "" };
@@ -2383,16 +2411,18 @@ void TabPrinter::update_sla()
// Initialize the UI from the current preset
void Tab::load_current_preset()
{
- auto preset = m_presets->get_edited_preset();
+ const Preset& preset = m_presets->get_edited_preset();
(preset.is_default || preset.is_system) ? m_btn_delete_preset->Disable() : m_btn_delete_preset->Enable(true);
update();
- // For the printer profile, generate the extruder pages.
- if (preset.printer_technology() == ptFFF)
- on_preset_loaded();
- else
- wxGetApp().sidebar().update_objects_list_extruder_column(1);
+ if (m_name == "printer") {
+ // For the printer profile, generate the extruder pages.
+ if (preset.printer_technology() == ptFFF)
+ on_preset_loaded();
+ else
+ wxGetApp().sidebar().update_objects_list_extruder_column(1);
+ }
// Reload preset pages with the new configuration values.
reload_config();
@@ -2402,11 +2432,14 @@ void Tab::load_current_preset()
m_undo_to_sys_btn->Enable(!preset.is_default);
+#if 0
// use CallAfter because some field triggers schedule on_change calls using CallAfter,
// and we don't want them to be called after this update_dirty() as they would mark the
// preset dirty again
// (not sure this is true anymore now that update_dirty is idempotent)
- wxTheApp->CallAfter([this]{
+ wxTheApp->CallAfter([this]
+#endif
+ {
// checking out if this Tab exists till this moment
if (!wxGetApp().checked_tab(this))
return;
@@ -2414,7 +2447,7 @@ void Tab::load_current_preset()
// update show/hide tabs
if (m_name == "printer") {
- PrinterTechnology& printer_technology = m_presets->get_edited_preset().printer_technology();
+ const PrinterTechnology printer_technology = m_presets->get_edited_preset().printer_technology();
if (printer_technology != static_cast<TabPrinter*>(this)->m_printer_technology)
{
for (auto tab : wxGetApp().tabs_list) {
@@ -2446,7 +2479,7 @@ void Tab::load_current_preset()
}
else {
on_presets_changed();
- if (m_name == "print")
+ if (m_type == Preset::TYPE_SLA_PRINT || m_type == Preset::TYPE_PRINT)// if (m_name == "print")
update_frequently_changed_parameters();
}
@@ -2454,7 +2487,10 @@ void Tab::load_current_preset()
init_options_list();
update_visibility();
update_changed_ui();
- });
+ }
+#if 0
+ );
+#endif
}
//Regerenerate content of the page tree.
@@ -2528,7 +2564,6 @@ void Tab::select_preset(std::string preset_name)
bool print_tab = m_presets->type() == Preset::TYPE_PRINT || m_presets->type() == Preset::TYPE_SLA_PRINT;
bool printer_tab = m_presets->type() == Preset::TYPE_PRINTER;
bool canceled = false;
-// m_reload_dependent_tabs = {};
m_dependent_tabs = {};
if (current_dirty && !may_discard_current_dirty_preset()) {
canceled = true;
@@ -2624,19 +2659,20 @@ bool Tab::may_discard_current_dirty_preset(PresetCollection* presets /*= nullptr
std::string type_name = presets->name();
wxString tab = " ";
wxString name = old_preset.is_default ?
- _(L("Default ")) + type_name + _(L(" preset")) :
- (type_name + _(L(" preset\n")) + tab + old_preset.name);
+ wxString::Format(_(L("Default preset (%s)")), _(type_name)) : //_(L("Default ")) + type_name + _(L(" preset")) :
+ wxString::Format(_(L("Preset (%s)")), _(type_name)) + "\n" + tab + old_preset.name; //type_name + _(L(" preset\n")) + tab + old_preset.name;
+
// Collect descriptions of the dirty options.
wxString changes;
for (const std::string &opt_key : presets->current_dirty_options()) {
const ConfigOptionDef &opt = m_config->def()->options.at(opt_key);
- std::string name = "";
+ /*std::string*/wxString name = "";
if (! opt.category.empty())
- name += opt.category + " > ";
+ name += _(opt.category) + " > ";
name += !opt.full_label.empty() ?
- opt.full_label :
- opt.label;
- changes += tab + from_u8(name) + "\n";
+ _(opt.full_label) :
+ _(opt.label);
+ changes += tab + /*from_u8*/(name) + "\n";
}
// Show a confirmation dialog with the list of dirty options.
wxString message = name + "\n\n";
@@ -2650,7 +2686,7 @@ bool Tab::may_discard_current_dirty_preset(PresetCollection* presets /*= nullptr
message += _(L("and it has the following unsaved changes:"));
}
auto confirm = new wxMessageDialog(parent(),
- message + "\n" + changes + _(L("\n\nDiscard changes and continue anyway?")),
+ message + "\n" + changes + "\n\n" + _(L("Discard changes and continue anyway?")),
_(L("Unsaved Changes")), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
return confirm->ShowModal() == wxID_YES;
}
@@ -2662,8 +2698,8 @@ bool Tab::may_switch_to_SLA_preset()
if (wxGetApp().obj_list()->has_multi_part_objects())
{
show_info( parent(),
- _(L("It's impossible to print multi-part object(s) with SLA technology.")) +
- _(L("\n\nPlease check your object list before preset changing.")),
+ _(L("It's impossible to print multi-part object(s) with SLA technology.")) + "\n\n" +
+ _(L("Please check your object list before preset changing.")),
_(L("Attention!")) );
return false;
}
@@ -3248,6 +3284,7 @@ void TabSLAPrint::build()
optgroup = page->new_optgroup(_(L("Support pillar")));
optgroup->append_single_option_line("support_pillar_diameter");
+ optgroup->append_single_option_line("support_pillar_connection_mode");
optgroup->append_single_option_line("support_pillar_widening_factor");
optgroup->append_single_option_line("support_base_diameter");
optgroup->append_single_option_line("support_base_height");