diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index 8313f3bda..2ec5028f5 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -119,11 +119,6 @@ void break_to_debugger() // #ys_FIXME_for_delete std::vector g_tabs_list; -std::vector > m_optgroups; -double m_brim_width = 0.0; -size_t m_label_width = 100; -wxButton* g_wiping_dialog_button = nullptr; - //showed/hided controls according to the view mode wxWindow *g_right_panel = nullptr; wxBoxSizer *g_frequently_changed_parameters_sizer = nullptr; @@ -192,8 +187,6 @@ void set_objects_list_sizer(wxBoxSizer *objects_list_sizer){ g_object_list_sizer = objects_list_sizer; } -static wxString dots("…", wxConvUTF8); - void open_model(wxWindow *parent, wxArrayString& input_files){ auto dialog = new wxFileDialog(parent /*? parent : GetTopWindow()*/, _(L("Choose one or more files (STL/OBJ/AMF/3MF/PRUSA):")), @@ -432,11 +425,6 @@ void set_print_callback_event(Print *print, int id) wxWindow* get_right_panel(){ return g_right_panel; } - -const size_t& label_width(){ - return m_label_width; -} - void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string items, bool initial_value) { if (comboCtrl == nullptr) @@ -531,16 +519,18 @@ void set_model_events_from_perl(Model &model, // add_collapsible_panes(parent, sizer); } -void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFlexGridSizer* preset_sizer) +void Sidebar::add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer/*, wxFlexGridSizer* preset_sizer*/) { DynamicPrintConfig* config = &wxGetApp().preset_bundle->prints.get_edited_preset().config; std::shared_ptr optgroup = std::make_shared(parent, "", config); - const wxArrayInt& ar = preset_sizer->GetColWidths(); - m_label_width = ar.IsEmpty() ? 100 : ar.front()-4; - optgroup->label_width = m_label_width; +// const wxArrayInt& ar = preset_sizer->GetColWidths(); +// m_label_width = ar.IsEmpty() ? 100 : ar.front()-4; + optgroup->label_width = 100;// m_label_width; + + auto m_optgroups = get_optgroups(); //Frequently changed parameters - optgroup->m_on_change = [config](t_config_option_key opt_key, boost::any value){ + optgroup->m_on_change = [config, m_optgroups](t_config_option_key opt_key, boost::any value){ TabPrint* tab_print = nullptr; for (size_t i = 0; i < wxGetApp().tab_panel()->GetPageCount(); ++i) { Tab *tab = dynamic_cast(wxGetApp().tab_panel()->GetPage(i)); @@ -566,12 +556,12 @@ void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFl double brim_width = config->opt_float("brim_width"); if (boost::any_cast(value) == true) { - new_val = m_brim_width == 0.0 ? 10 : - m_brim_width < 0.0 ? m_brim_width * (-1) : - m_brim_width; + new_val = 10;// m_brim_width == 0.0 ? 10 : +// m_brim_width < 0.0 ? m_brim_width * (-1) : +// m_brim_width; } else{ - m_brim_width = brim_width * (-1); +// m_brim_width = brim_width * (-1); new_val = 0; } new_conf.set_key_value("brim_width", new ConfigOptionFloat(new_val)); @@ -617,7 +607,7 @@ void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFl option.opt.full_width = true; optgroup->append_single_option_line(option); - m_brim_width = config->opt_float("brim_width"); + auto m_brim_width = config->opt_float("brim_width"); def.label = L("Brim"); def.type = coBool; def.tooltip = L("This flag enables the brim that will be printed around each object on the first layer."); @@ -628,7 +618,8 @@ void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFl Line line = { "", "" }; - line.widget = [config](wxWindow* parent){ + line.widget = [config, this](wxWindow* parent){ + auto g_wiping_dialog_button = get_wiping_dialog_button(); g_wiping_dialog_button = new wxButton(parent, wxID_ANY, _(L("Purging volumes")) + dots, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(g_wiping_dialog_button); @@ -655,26 +646,6 @@ void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFl sizer->Add(optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT, 2); m_optgroups.push_back(optgroup);// ogFrequentlyChangingParameters - - // Object List - add_objects_list(parent, sizer); - - // Frequently Object Settings - add_object_settings(parent, sizer); -} - -void show_frequently_changed_parameters(bool show) -{ - g_frequently_changed_parameters_sizer->Show(show); - if (!show) return; - - for (size_t i = 0; i < wxGetApp().tab_panel()->GetPageCount(); ++i) { - Tab *tab = dynamic_cast(wxGetApp().tab_panel()->GetPage(i)); - if (!tab) - continue; - tab->update_wiping_button_visibility(); - break; - } } void show_buttons(bool show) @@ -706,42 +677,14 @@ void show_object_name(bool show) grid_sizer->Show(static_cast(1), show); } -void update_mode() -{ - wxWindowUpdateLocker noUpdates(g_right_panel->GetParent()); - - ConfigMenuIDs mode = wxGetApp().get_view_mode(); - - g_object_list_sizer->Show(mode == ConfigMenuModeExpert); - show_info_sizer(mode == ConfigMenuModeExpert); - show_buttons(mode == ConfigMenuModeExpert); - show_object_name(mode == ConfigMenuModeSimple); - show_manipulation_sizer(mode == ConfigMenuModeSimple); - - // TODO There is a not the best place of it! - // *** Update showing of the collpane_settings -// show_collpane_settings(mode == ConfigMenuModeExpert); - // ************************* - g_right_panel->Layout(); - g_right_panel->GetParent()->Layout(); -} - -bool is_expert_mode(){ - return wxGetApp().get_view_mode() == ConfigMenuModeExpert; -} - ConfigOptionsGroup* get_optgroup(size_t i) { - return m_optgroups.empty() ? nullptr : m_optgroups[i].get(); + return wxGetApp().mainframe->m_plater->sidebar().get_optgroup(i); +// return m_optgroups.empty() ? nullptr : m_optgroups[i].get(); } std::vector >& get_optgroups() { - return m_optgroups; -} - -wxButton* get_wiping_dialog_button() -{ - return g_wiping_dialog_button; + return wxGetApp().mainframe->m_plater->sidebar().get_optgroups();//m_optgroups; } wxWindow* export_option_creator(wxWindow* parent) diff --git a/src/slic3r/GUI/GUI.hpp b/src/slic3r/GUI/GUI.hpp index 215a72b60..de17ff7a2 100644 --- a/src/slic3r/GUI/GUI.hpp +++ b/src/slic3r/GUI/GUI.hpp @@ -117,7 +117,6 @@ void set_gui_appctl(); void open_model(wxWindow *parent, wxArrayString& input_files); wxWindow* get_right_panel(); -const size_t& label_width(); Tab* get_tab(const std::string& name); std::vector* get_preset_tabs(); @@ -150,9 +149,6 @@ void warning_catcher(wxWindow* parent, const wxString& message); // to deliver a progress status message. void set_print_callback_event(Print *print, int id); -// update right panel of the Plater according to view mode -void update_mode(); - void show_info_sizer(const bool show); // Creates a wxCheckListBoxComboPopup inside the given wxComboCtrl, filled with the given text and items. @@ -177,16 +173,12 @@ void set_model_events_from_perl(Model &model, int event_remove_object, int event_update_scene); void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFlexGridSizer* preset_sizer); -// Update view mode according to selected menu -void update_mode(); -bool is_expert_mode(); // Callback to trigger a configuration update timer on the Plater. static PerlCallback g_on_request_update_callback; ConfigOptionsGroup* get_optgroup(size_t i); std::vector >& get_optgroups(); -wxButton* get_wiping_dialog_button(); void add_export_option(wxFileDialog* dlg, const std::string& format); int get_export_option(wxFileDialog* dlg); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 4407c44c1..00071f01d 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -26,6 +26,7 @@ #include "Preferences.hpp" #include "Tab.hpp" #include +#include namespace Slic3r { namespace GUI { @@ -488,7 +489,22 @@ ConfigMenuIDs GUI_App::get_view_mode() return mode == "expert" ? ConfigMenuModeExpert : ConfigMenuModeSimple; } -static wxString dots("…", wxConvUTF8); +// Update view mode according to selected menu +void GUI_App::update_mode() +{ + wxWindowUpdateLocker noUpdates(/*g_right_panel->GetParent()*/mainframe); + + ConfigMenuIDs mode = wxGetApp().get_view_mode(); + +// g_object_list_sizer->Show(mode == ConfigMenuModeExpert); + show_info_sizer(mode == ConfigMenuModeExpert); +// show_buttons(mode == ConfigMenuModeExpert); +// show_object_name(mode == ConfigMenuModeSimple); + show_manipulation_sizer(mode == ConfigMenuModeSimple); + + /*g_right_panel*/mainframe->m_plater->Layout(); + /*g_right_panel->GetParent()*/mainframe->Layout(); +} void GUI_App::add_config_menu(wxMenuBar *menu) { diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index d6d085166..e084481dd 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -42,6 +42,8 @@ enum ConfigMenuIDs { class Tab; +static wxString dots("…", wxConvUTF8); + class GUI_App : public wxApp { bool no_plater{ false }; @@ -112,6 +114,7 @@ public: void get_installed_languages(wxArrayString & names, wxArrayLong & identifiers); ConfigMenuIDs get_view_mode(); + void update_mode(); void add_config_menu(wxMenuBar *menu); bool check_unsaved_changes(); diff --git a/src/slic3r/GUI/GUI_ObjectParts.cpp b/src/slic3r/GUI/GUI_ObjectParts.cpp index fc36e7fdb..6e6b1cf98 100644 --- a/src/slic3r/GUI/GUI_ObjectParts.cpp +++ b/src/slic3r/GUI/GUI_ObjectParts.cpp @@ -158,8 +158,6 @@ void init_mesh_icons(){ bool is_parts_changed(){return m_parts_changed;} bool is_part_settings_changed(){ return m_part_settings_changed; } -static wxString dots("…", wxConvUTF8); - void set_tooltip_for_item(const wxPoint& pt) { wxDataViewItem item; @@ -452,34 +450,7 @@ wxSizer* object_movers(wxWindow *win) return optgroup->sizer; } -wxBoxSizer* content_settings(wxWindow *win) -{ - DynamicPrintConfig* config = &wxGetApp().preset_bundle->/*full_config();//*/printers.get_edited_preset().config; // TODO get config from Model_volume - std::shared_ptr optgroup = std::make_shared(win, "Extruders", config); - optgroup->label_width = label_width(); - - Option option = optgroup->get_option("extruder"); - option.opt.default_value = new ConfigOptionInt(1); - optgroup->append_single_option_line(option); - - get_optgroups().push_back(optgroup); // ogObjectSettings - - auto sizer = new wxBoxSizer(wxVERTICAL); - sizer->Add(create_edit_object_buttons(win), 0, wxEXPAND, 0); // *** Edit Object Buttons*** - - sizer->Add(optgroup->sizer, 1, wxEXPAND | wxLEFT, 20); - - auto add_btn = new wxButton(win, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); - if (wxMSW) add_btn->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - add_btn->SetBitmap(wxBitmap(from_u8(Slic3r::var("add.png")), wxBITMAP_TYPE_PNG)); - sizer->Add(add_btn, 0, wxALIGN_LEFT | wxLEFT, 20); - - sizer->Add(object_movers(win), 0, wxEXPAND | wxLEFT, 20); - - return sizer; -} - -void add_objects_list(wxWindow* parent, wxBoxSizer* sizer) +void Sidebar::add_objects_list(wxWindow* parent, wxBoxSizer* sizer) { const auto ol_sizer = create_objects_list(parent); sizer->Add(ol_sizer, 1, wxEXPAND | wxTOP, 20); @@ -535,13 +506,13 @@ Line add_og_to_object_settings(const std::string& option_name, const std::string return line; } -void add_object_settings(wxWindow* parent, wxBoxSizer* sizer) +void Sidebar::add_object_settings(wxWindow* parent, wxBoxSizer* sizer, t_optgroups& optgroups) { auto optgroup = std::make_shared(parent, _(L("Object Settings"))); optgroup->label_width = 100; optgroup->set_grid_vgap(5); - optgroup->m_on_change = [](t_config_option_key opt_key, boost::any value){ + optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value){ if (opt_key == "scale_unit"){ const wxString& selection = boost::any_cast(value); std::vector axes{ "x", "y", "z" }; @@ -566,7 +537,6 @@ void add_object_settings(wxWindow* parent, wxBoxSizer* sizer) def.default_value = new ConfigOptionString{ " " }; optgroup->append_single_option_line(Option(def, "object_name")); - // Legend for object modification auto line = Line{ "", "" }; def.label = ""; @@ -604,54 +574,7 @@ void add_object_settings(wxWindow* parent, wxBoxSizer* sizer) optgroup->disable(); - get_optgroups().push_back(optgroup); // ogFrequentlyObjectSettings -} - - -// add Collapsible Pane to sizer -wxCollapsiblePane* add_collapsible_pane(wxWindow* parent, wxBoxSizer* sizer_parent, const wxString& name, std::function content_function) -{ -#ifdef __WXMSW__ - auto *collpane = new PrusaCollapsiblePaneMSW(parent, wxID_ANY, name); -#else - auto *collpane = new PrusaCollapsiblePane/*wxCollapsiblePane*/(parent, wxID_ANY, name); -#endif // __WXMSW__ - // add the pane with a zero proportion value to the sizer which contains it - sizer_parent->Add(collpane, 0, wxGROW | wxALL, 0); - - wxWindow *win = collpane->GetPane(); - - wxSizer *sizer = content_function(win); - - wxSizer *sizer_pane = new wxBoxSizer(wxVERTICAL); - sizer_pane->Add(sizer, 1, wxGROW | wxEXPAND | wxBOTTOM, 2); - win->SetSizer(sizer_pane); - // sizer_pane->SetSizeHints(win); - return collpane; -} - -void add_collapsible_panes(wxWindow* parent, wxBoxSizer* sizer) -{ - // *** Objects List *** - auto collpane = add_collapsible_pane(parent, sizer, "Objects List:", create_objects_list); - collpane->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, ([collpane](wxCommandEvent& e){ - // wxWindowUpdateLocker noUpdates(g_right_panel); - if (collpane->IsCollapsed()) { - m_sizer_object_buttons->Show(false); - m_sizer_part_buttons->Show(false); - m_sizer_object_movers->Show(false); - if (!m_objects_ctrl->HasSelection()) - m_collpane_settings->Show(false); - } - })); - - // *** Object/Part Settings *** - m_collpane_settings = add_collapsible_pane(parent, sizer, "Object Settings", content_settings); -} - -void show_collpane_settings(bool expert_mode) -{ - m_collpane_settings->Show(expert_mode && !m_objects_model->IsEmpty()); + optgroups.push_back(optgroup); // ogFrequentlyObjectSettings } void add_object_to_list(const std::string &name, ModelObject* model_object) @@ -695,17 +618,12 @@ void delete_object_from_list() m_objects_model->Delete(item); part_selection_changed(); - -// if (m_objects_model->IsEmpty()) -// m_collpane_settings->Show(false); } void delete_all_objects_from_list() { m_objects_model->DeleteAll(); - part_selection_changed(); -// m_collpane_settings->Show(false); } void set_object_count(int idx, int count) @@ -1629,100 +1547,6 @@ void part_selection_changed() m_selected_object_id = obj_idx; update_settings_value(); - -/* wxWindowUpdateLocker noUpdates(get_right_panel()); - - m_move_options = Point3(0, 0, 0); - m_last_coords = Point3(0, 0, 0); - // reset move sliders - std::vector opt_keys = {"x", "y", "z"}; - auto og = get_optgroup(ogObjectMovers); - for (auto opt_key: opt_keys) - og->set_value(opt_key, int(0)); - -// if (!item || m_selected_object_id < 0){ - if (m_selected_object_id < 0){ - m_sizer_object_buttons->Show(false); - m_sizer_part_buttons->Show(false); - m_sizer_object_movers->Show(false); - m_collpane_settings->Show(false); - return; - } - - m_collpane_settings->Show(true); - - auto volume_id = m_objects_model->GetVolumeIdByItem(item); - if (volume_id < 0){ - m_sizer_object_buttons->Show(true); - m_sizer_part_buttons->Show(false); - m_sizer_object_movers->Show(false); - m_collpane_settings->SetLabelText(_(L("Object Settings")) + ":"); - -// elsif($itemData->{type} eq 'object') { -// # select nothing in 3D preview -// -// # attach object config to settings panel -// $self->{optgroup_movers}->disable; -// $self->{staticbox}->SetLabel('Object Settings'); -// @opt_keys = (map @{$_->get_keys}, Slic3r::Config::PrintObject->new, Slic3r::Config::PrintRegion->new); -// $config = $self->{model_object}->config; -// } - - return; - } - - m_collpane_settings->SetLabelText(_(L("Part Settings")) + ":"); - - m_sizer_object_buttons->Show(false); - m_sizer_part_buttons->Show(true); - m_sizer_object_movers->Show(true); - - auto bb_size = m_objects[m_selected_object_id]->bounding_box().size(); - int scale = 10; //?? - - m_mover_x->SetMin(-bb_size.x * 4 * scale); - m_mover_x->SetMax(bb_size.x * 4 * scale); - - m_mover_y->SetMin(-bb_size.y * 4 * scale); - m_mover_y->SetMax(bb_size.y * 4 * scale); - - m_mover_z->SetMin(-bb_size.z * 4 * scale); - m_mover_z->SetMax(bb_size.z * 4 * scale); - - - -// my ($config, @opt_keys); - m_btn_move_up->Enable(volume_id > 0); - m_btn_move_down->Enable(volume_id + 1 < m_objects[m_selected_object_id]->volumes.size()); - - // attach volume config to settings panel - auto volume = m_objects[m_selected_object_id]->volumes[volume_id]; - - if (volume->modifier) - og->enable(); - else - og->disable(); - -// auto config = volume->config; - - // get default values -// @opt_keys = @{Slic3r::Config::PrintRegion->new->get_keys}; -// } -/* - # get default values - my $default_config = Slic3r::Config::new_from_defaults_keys(\@opt_keys); - - # append default extruder - push @opt_keys, 'extruder'; - $default_config->set('extruder', 0); - $config->set_ifndef('extruder', 0); - $self->{settings_panel}->set_default_config($default_config); - $self->{settings_panel}->set_config($config); - $self->{settings_panel}->set_opt_keys(\@opt_keys); - $self->{settings_panel}->set_fixed_options([qw(extruder)]); - $self->{settings_panel}->enable; - } - */ } void set_extruder_column_hidden(bool hide) diff --git a/src/slic3r/GUI/GUI_ObjectParts.hpp b/src/slic3r/GUI/GUI_ObjectParts.hpp index 8189238f0..01011d2c4 100644 --- a/src/slic3r/GUI/GUI_ObjectParts.hpp +++ b/src/slic3r/GUI/GUI_ObjectParts.hpp @@ -1,5 +1,6 @@ #ifndef slic3r_GUI_ObjectParts_hpp_ #define slic3r_GUI_ObjectParts_hpp_ +// #include "OptionsGroup.hpp" class wxWindow; class wxSizer; @@ -17,15 +18,13 @@ class ModelObject; class Model; namespace GUI { -//class wxGLCanvas; +class ConfigOptionsGroup; +using t_optgroups = std::vector >; enum ogGroup{ ogFrequentlyChangingParameters, ogFrequentlyObjectSettings, - ogCurrentSettings -// ogObjectSettings, -// ogObjectMovers, -// ogPartSettings + ogObjectSettings }; enum LambdaTypeIDs{ @@ -49,10 +48,8 @@ struct OBJECT_PARAMETERS typedef std::map t_category_icon; inline t_category_icon& get_category_icon(); -void add_collapsible_panes(wxWindow* parent, wxBoxSizer* sizer); void add_objects_list(wxWindow* parent, wxBoxSizer* sizer); -void add_object_settings(wxWindow* parent, wxBoxSizer* sizer); -void show_collpane_settings(bool expert_mode); +void add_object_settings(wxWindow* parent, wxBoxSizer* sizer, t_optgroups& optgroups); wxMenu *create_add_settings_popupmenu(bool is_part); wxMenu *create_add_part_popupmenu(); diff --git a/src/slic3r/GUI/LambdaObjectDialog.cpp b/src/slic3r/GUI/LambdaObjectDialog.cpp index 7d741be7f..d1d8e6046 100644 --- a/src/slic3r/GUI/LambdaObjectDialog.cpp +++ b/src/slic3r/GUI/LambdaObjectDialog.cpp @@ -8,7 +8,6 @@ namespace Slic3r { namespace GUI { -static wxString dots("…", wxConvUTF8); LambdaObjectDialog::LambdaObjectDialog(wxWindow* parent, const wxString type_name): diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 23e7e0793..502394aca 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -23,8 +23,6 @@ namespace Slic3r { namespace GUI { -static wxString dots("…", wxConvUTF8); - MainFrame::MainFrame(const bool no_plater, const bool loaded) : wxFrame(NULL, wxID_ANY, SLIC3R_BUILD, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE), m_no_plater(no_plater), diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index b13b5b65d..241fda0c0 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -40,6 +40,7 @@ #include "slic3r/Utils/ASCIIFolding.hpp" #include // Needs to be last because reasons :-/ +#include "WipeTowerDialog.hpp" namespace fs = boost::filesystem; using Slic3r::_3DScene; @@ -222,6 +223,12 @@ struct Sidebar::priv wxButton *btn_reslice; // wxButton *btn_print; // XXX: remove wxButton *btn_send_gcode; + + std::vector > optgroups {}; + double brim_width = 0.0; + size_t label_width = 100; + wxButton* btn_wiping_dialog {nullptr}; + }; @@ -265,7 +272,12 @@ Sidebar::Sidebar(wxWindow *parent) // Frequently changed parameters p->sizer_params = new wxBoxSizer(wxVERTICAL); - GUI::add_frequently_changed_parameters(p->scrolled, p->sizer_params, p->sizer_presets); + add_frequently_changed_parameters(p->scrolled, p->sizer_params/*, p->sizer_presets*/); + + // Object List + add_objects_list(p->scrolled, p->sizer_params); + // Frequently Object Settings + add_object_settings(p->scrolled, p->sizer_params, p->optgroups); // Buttons in the scrolled area wxBitmap arrow_up(GUI::from_u8(Slic3r::var("brick_go.png")), wxBITMAP_TYPE_PNG); @@ -356,6 +368,20 @@ void Sidebar::update_presets(Preset::Type preset_type) // wxTheApp->{preset_bundle}->export_selections(wxTheApp->{app_config}); } +ConfigOptionsGroup* Sidebar::get_optgroup(size_t i) +{ + return p->optgroups.empty() ? nullptr : p->optgroups[i].get(); +} + +t_optgroups& Sidebar::get_optgroups() { + return p->optgroups; +} + +wxButton* Sidebar::get_wiping_dialog_button() +{ + return p->btn_wiping_dialog; +} + // Plater::Object diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 415e9faab..14de62674 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -8,11 +8,15 @@ #include "Preset.hpp" +class wxBoxSizer; namespace Slic3r { namespace GUI { class MainFrame; +class ConfigOptionsGroup; + +using t_optgroups = std::vector >; class Sidebar : public wxPanel { @@ -25,6 +29,15 @@ public: ~Sidebar(); void update_presets(Slic3r::Preset::Type preset_type); + + void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer); + void add_objects_list(wxWindow* parent, wxBoxSizer* sizer); + void add_object_settings(wxWindow* parent, wxBoxSizer* sizer, t_optgroups& optgroups); + + + ConfigOptionsGroup* get_optgroup(size_t i); + t_optgroups& get_optgroups(); + wxButton* get_wiping_dialog_button(); private: struct priv; std::unique_ptr p; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index c83fd6df5..07063a6bb 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -33,9 +33,6 @@ namespace Slic3r { namespace GUI { -static wxString dots("…", wxConvUTF8); - -// sub new void Tab::create_preset_tab(PresetBundle *preset_bundle) { m_preset_bundle = preset_bundle; @@ -720,9 +717,12 @@ void Tab::update_wiping_button_visibility() { bool multiple_extruders = dynamic_cast((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1; bool single_extruder_mm = dynamic_cast( (m_preset_bundle->printers.get_edited_preset().config).option("single_extruder_multi_material"))->value; - if (get_wiping_dialog_button()) { - get_wiping_dialog_button()->Show(wipe_tower_enabled && multiple_extruders && single_extruder_mm); - (get_wiping_dialog_button()->GetParent())->Layout(); + if (!wxGetApp().mainframe) + return; + auto wiping_dialog_button = wxGetApp().mainframe->m_plater->sidebar().get_wiping_dialog_button(); + if (wiping_dialog_button) { + wiping_dialog_button->Show(wipe_tower_enabled && multiple_extruders && single_extruder_mm); + wiping_dialog_button->GetParent()->Layout(); } }