diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 7547030b68..2e1d87d7a9 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -38,7 +38,6 @@ namespace Slic3r { static std::vector s_project_options { "colorprint_heights", - "wiping_volumes_extruders", "wiping_volumes_matrix" }; @@ -1732,18 +1731,10 @@ void PresetBundle::update_multi_material_filament_presets() // Now verify if wiping_volumes_matrix has proper size (it is used to deduce number of extruders in wipe tower generator): std::vector old_matrix = this->project_config.option("wiping_volumes_matrix")->values; - size_t old_number_of_extruders = size_t(sqrt(old_matrix.size())+EPSILON); + size_t old_number_of_extruders = size_t(std::sqrt(old_matrix.size())+EPSILON); if (num_extruders != old_number_of_extruders) { - // First verify if purging volumes presets for each extruder matches number of extruders - std::vector& extruders = this->project_config.option("wiping_volumes_extruders")->values; - while (extruders.size() < 2*num_extruders) { - extruders.push_back(extruders.size()>1 ? extruders[0] : 50.); // copy the values from the first extruder - extruders.push_back(extruders.size()>1 ? extruders[1] : 50.); - } - while (extruders.size() > 2*num_extruders) { - extruders.pop_back(); - extruders.pop_back(); - } + const double default_loading_purge = static_cast(printers.get_edited_preset().config.option("multimaterial_purging_for_load"))->value; + const double default_unloading_purge = static_cast(printers.get_edited_preset().config.option("multimaterial_purging_for_unload"))->value; std::vector new_matrix; for (unsigned int i=0;iproject_config.option("wiping_volumes_matrix")->values = new_matrix; } diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 938f217859..86273b921c 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3315,13 +3315,6 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionBool(false)); - def = this->add("wiping_volumes_extruders", coFloats); - def->label = L("Purging volumes - load/unload volumes"); - def->tooltip = L("This vector saves required volumes to change from/to each tool used on the " - "wipe tower. These values are used to simplify creation of the full purging " - "volumes below."); - def->set_default_value(new ConfigOptionFloats { 70., 70., 70., 70., 70., 70., 70., 70., 70., 70. }); - def = this->add("wiping_volumes_matrix", coFloats); def->label = L("Purging volumes - matrix"); def->tooltip = L("This matrix describes volumes (in cubic milimetres) required to purge the" @@ -4415,7 +4408,8 @@ static std::set PrintConfigDef_ignore = { "ensure_vertical_shell_thickness", // Disabled in 2.6.0-alpha6, this option is problematic "infill_only_where_needed", - "gcode_binary" // Introduced in 2.7.0-alpha1, removed in 2.7.1 (replaced by binary_gcode). + "gcode_binary", // Introduced in 2.7.0-alpha1, removed in 2.7.1 (replaced by binary_gcode). + "wiping_volumes_extruders" // Removed in 2.7.3-alpha1. }; void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &value) diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 2efbaaabd8..0e1778985e 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -885,7 +885,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionFloat, wipe_tower_bridging)) ((ConfigOptionInt, wipe_tower_extruder)) ((ConfigOptionFloats, wiping_volumes_matrix)) - ((ConfigOptionFloats, wiping_volumes_extruders)) ((ConfigOptionFloat, z_offset)) ) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index e74ba64cfc..3921c5c354 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -520,17 +520,14 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) : { auto &project_config = wxGetApp().preset_bundle->project_config; const std::vector &init_matrix = (project_config.option("wiping_volumes_matrix"))->values; - const std::vector &init_extruders = (project_config.option("wiping_volumes_extruders"))->values; const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); - WipingDialog dlg(parent, cast(init_matrix), cast(init_extruders), extruder_colours); + WipingDialog dlg(parent, cast(init_matrix), extruder_colours); if (dlg.ShowModal() == wxID_OK) { std::vector matrix = dlg.get_matrix(); - std::vector extruders = dlg.get_extruders(); (project_config.option("wiping_volumes_matrix"))->values = std::vector(matrix.begin(), matrix.end()); - (project_config.option("wiping_volumes_extruders"))->values = std::vector(extruders.begin(), extruders.end()); // Update Project dirty state, update application title bar. wxGetApp().plater()->update_project_dirty_from_presets(); wxPostEvent(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent)); diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index da56e2c305..7bf51fb027 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -72,14 +72,6 @@ RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters) } -#ifdef _WIN32 -#define style wxSP_ARROW_KEYS | wxBORDER_SIMPLE -#else -#define style wxSP_ARROW_KEYS -#endif - - - RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize/*,wxPoint(50,50), wxSize(800,350),wxBORDER_RAISED*/) { @@ -110,6 +102,12 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters) #endif sizer_chart->Add(m_chart, 0, wxALL, 5); +#ifdef _WIN32 + const long style = wxSP_ARROW_KEYS | wxBORDER_SIMPLE; +#else + const long style = wxSP_ARROW_KEYS; +#endif + m_widget_time = new ::SpinInputDouble(this,"", wxEmptyString, wxDefaultPosition, wxSize(ITEM_WIDTH(), -1), style, 0., 5., 3., 0.25); m_widget_time->SetDigits(2); m_widget_volume = new ::SpinInput(this,"",wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,0,10000,0); @@ -190,8 +188,8 @@ std::string RammingPanel::get_parameters() } -// Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button to toggle simple/advanced mode: -WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruders, const std::vector& extruder_colours) +// Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button. +WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours) : wxDialog(parent, wxID_ANY, _(L("Wipe tower - Purging volume adjustment")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/) { SetFont(wxGetApp().normal_font()); @@ -199,7 +197,7 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c auto widget_button = new wxButton(this,wxID_ANY,"-",wxPoint(0,0),wxDefaultSize); update_ui(widget_button); wxGetApp().SetWindowVariantForButton(widget_button); - m_panel_wiping = new WipingPanel(this,matrix,extruders, extruder_colours, widget_button); + m_panel_wiping = new WipingPanel(this,matrix, extruder_colours, widget_button); auto main_sizer = new wxBoxSizer(wxVERTICAL); @@ -223,14 +221,13 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c this->Bind(wxEVT_BUTTON,[this](wxCommandEvent&) { // if OK button is clicked.. m_output_matrix = m_panel_wiping->read_matrix_values(); // ..query wiping panel and save returned values - m_output_extruders = m_panel_wiping->read_extruders_values(); // so they can be recovered later by calling get_...() EndModal(wxID_OK); },wxID_OK); this->Show(); } -// This function allows to "play" with sizers parameters (like align or border) +// This function allows to "play" with sizrs parameters (like align or border) void WipingPanel::format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& info, const wxString& table_title, int table_lshift/*=0*/) { wxSize text_size = GetTextExtent(info); @@ -243,12 +240,12 @@ void WipingPanel::format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_ table_sizer->Add(grid_sizer, 0, wxALIGN_CENTER | wxTOP, 10); } -// This panel contains all control widgets for both simple and advanced mode (these reside in separate sizers) -WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruders, const std::vector& extruder_colours, wxButton* widget_button) + +WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, wxButton* widget_button) : wxPanel(parent,wxID_ANY, wxDefaultPosition, wxDefaultSize/*,wxBORDER_RAISED*/) { m_widget_button = widget_button; // pointer to the button in parent dialog - m_widget_button->Bind(wxEVT_BUTTON,[this](wxCommandEvent&){ toggle_advanced(true); }); + m_widget_button->Bind(wxEVT_BUTTON,[this](wxCommandEvent&){ }); m_number_of_extruders = (int)(sqrt(matrix.size())+0.001); @@ -259,17 +256,12 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, con } // Create two switched panels with their own sizers - m_sizer_simple = new wxBoxSizer(wxVERTICAL); m_sizer_advanced = new wxBoxSizer(wxVERTICAL); - m_page_simple = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); m_page_advanced = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); - m_page_simple->SetSizer(m_sizer_simple); m_page_advanced->SetSizer(m_sizer_advanced); - update_ui(m_page_simple); update_ui(m_page_advanced); - auto gridsizer_simple = new wxGridSizer(3, 5, 10); m_gridsizer_advanced = new wxGridSizer(m_number_of_extruders+1, 5, 1); // First create controls for advanced mode and assign them to m_page_advanced: @@ -326,53 +318,13 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, con _(L("Here you can adjust required purging volume (mm³) for any given pair of tools.")), _(L("Extruder changed to"))); - // Hide preview page before new page creating - // It allows to do that from a beginning of the main panel - m_page_advanced->Hide(); - - // Now the same for simple mode: - gridsizer_simple->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString("")), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - gridsizer_simple->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString(_(L("unloaded")))), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - gridsizer_simple->Add(new wxStaticText(m_page_simple,wxID_ANY,wxString(_(L("loaded")))), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); - - auto add_spin_ctrl = [this](std::vector<::SpinInput*>& vec, float initial) - { - ::SpinInput* spin_ctrl = new ::SpinInput(m_page_simple, "", wxEmptyString, wxDefaultPosition, wxSize(ITEM_WIDTH(), -1), style | wxALIGN_RIGHT, 0, 300, (int)initial); - update_ui(spin_ctrl); - vec.push_back(spin_ctrl); - }; - - for (unsigned int i=0;iSetCanFocus(false); - w->SetBackgroundColour(m_colours[i]); - hsizer->Add(w, wxALIGN_CENTER_VERTICAL); - hsizer->AddSpacer(10); - hsizer->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString(_(L("Tool #"))) << i + 1 << ": "), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - - gridsizer_simple->Add(hsizer, 1, wxEXPAND); - gridsizer_simple->Add(m_old.back(),0); - gridsizer_simple->Add(m_new.back(),0); - } - - // collect and format sizer - format_sizer(m_sizer_simple, m_page_simple, gridsizer_simple, - _(L("Total purging volume is calculated by summing two values below, depending on which tools are loaded/unloaded.")), - _(L("Volume to purge (mm³) when the filament is being")), 50); m_sizer = new wxBoxSizer(wxVERTICAL); - m_sizer->Add(m_page_simple, 0, wxEXPAND | wxALL, 25); m_sizer->Add(m_page_advanced, 0, wxEXPAND | wxALL, 25); m_sizer->SetSizeHints(this); SetSizer(m_sizer); - toggle_advanced(); // to show/hide what is appropriate - m_page_advanced->Bind(wxEVT_PAINT,[this](wxPaintEvent&) { wxPaintDC dc(m_page_advanced); int y_pos = 0.5 * (edit_boxes[0][0]->GetPosition().y + edit_boxes[0][edit_boxes.size()-1]->GetPosition().y + edit_boxes[0][edit_boxes.size()-1]->GetSize().y); @@ -390,8 +342,6 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector& matrix, con // Reads values from the (advanced) wiping matrix: std::vector WipingPanel::read_matrix_values() { - if (!m_advanced) - fill_in_matrix(); std::vector output; for (unsigned int i=0;i WipingPanel::read_matrix_values() { } return output; } - -// Reads values from simple mode to save them for next time: -std::vector WipingPanel::read_extruders_values() { - std::vector output; - for (unsigned int i=0;iGetValue()); - output.push_back(m_new[i]->GetValue()); - } - return output; -} - -// This updates the "advanced" matrix based on values from "simple" mode -void WipingPanel::fill_in_matrix() { - for (unsigned i=0;iSetValue(wxString("")<< (m_old[i]->GetValue() + m_new[j]->GetValue())); - } - } -} - - - -// Function to check if simple and advanced settings are matching -bool WipingPanel::advanced_matches_simple() { - for (unsigned i=0;iGetValue() != (wxString("")<< (m_old[i]->GetValue() + m_new[j]->GetValue()))) - return false; - } - } - return true; -} - - -// Switches the dialog from simple to advanced mode and vice versa -void WipingPanel::toggle_advanced(bool user_action) { - if (m_advanced && !advanced_matches_simple() && user_action) { - if (MessageDialog(this, _L("Switching to simple settings will discard changes done in the advanced mode!\n\nDo you want to proceed?"), - _L("Warning"),wxYES_NO|wxICON_EXCLAMATION).ShowModal() != wxID_YES) - return; - } - if (user_action) - m_advanced = !m_advanced; // user demands a change -> toggle - else - m_advanced = !advanced_matches_simple(); // if called from constructor, show what is appropriate - - (m_advanced ? m_page_advanced : m_page_simple)->Show(); - (!m_advanced ? m_page_advanced : m_page_simple)->Hide(); - - m_widget_button->SetLabel(m_advanced ? _(L("Show simplified settings")) : _(L("Show advanced settings"))); - if (m_advanced) - if (user_action) fill_in_matrix(); // otherwise keep values loaded from config - - m_sizer->Layout(); - Refresh(); -} diff --git a/src/slic3r/GUI/WipeTowerDialog.hpp b/src/slic3r/GUI/WipeTowerDialog.hpp index f6dd110262..ae71ff14e4 100644 --- a/src/slic3r/GUI/WipeTowerDialog.hpp +++ b/src/slic3r/GUI/WipeTowerDialog.hpp @@ -51,26 +51,16 @@ private: class WipingPanel : public wxPanel { public: - WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruders, const std::vector& extruder_colours, wxButton* widget_button); + WipingPanel(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours, wxButton* widget_button); std::vector read_matrix_values(); - std::vector read_extruders_values(); - void toggle_advanced(bool user_action = false); void format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& info, const wxString& table_title, int table_lshift=0); -private: - void fill_in_matrix(); - bool advanced_matches_simple(); - - std::vector<::SpinInput*> m_old; - std::vector<::SpinInput*> m_new; +private: std::vector> edit_boxes; std::vector m_colours; unsigned int m_number_of_extruders = 0; - bool m_advanced = false; - wxPanel* m_page_simple = nullptr; - wxPanel* m_page_advanced = nullptr; + wxPanel* m_page_advanced = nullptr; wxBoxSizer* m_sizer = nullptr; - wxBoxSizer* m_sizer_simple = nullptr; wxBoxSizer* m_sizer_advanced = nullptr; wxGridSizer* m_gridsizer_advanced = nullptr; wxButton* m_widget_button = nullptr; @@ -82,15 +72,13 @@ private: class WipingDialog : public wxDialog { public: - WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruders, const std::vector& extruder_colours); + WipingDialog(wxWindow* parent, const std::vector& matrix, const std::vector& extruder_colours); std::vector get_matrix() const { return m_output_matrix; } - std::vector get_extruders() const { return m_output_extruders; } private: WipingPanel* m_panel_wiping = nullptr; std::vector m_output_matrix; - std::vector m_output_extruders; }; #endif // _WIPE_TOWER_DIALOG_H_ \ No newline at end of file