diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 18eac2747..816e9d499 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -116,7 +116,7 @@ void ObjectList::create_objects_ctrl() SetMinSize(wxSize(-1, 3000)); // #ys_FIXME m_sizer = new wxBoxSizer(wxVERTICAL); - m_sizer->Add(this, 1, wxGROW | wxLEFT, 20); + m_sizer->Add(this, 1, wxGROW); m_objects_model = new PrusaObjectDataViewModel; AssociateModel(m_objects_model); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 9e5d94ca7..b63f434f0 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -113,7 +113,6 @@ void OptionsGroup::add_undo_buttuns_to_sizer(wxSizer* sizer, const t_field& fiel } void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = nullptr*/) { -//! if (line.sizer != nullptr || (line.widget != nullptr && line.full_width > 0)) { if ( (line.sizer != nullptr || line.widget != nullptr) && line.full_width) { if (line.sizer != nullptr) { sizer->Add(line.sizer, 0, wxEXPAND | wxALL, wxOSX ? 0 : 15); @@ -135,6 +134,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n // if we have a single option with no label, no sidetext just add it directly to sizer if (option_set.size() == 1 && label_width == 0 && option_set.front().opt.full_width && + option_set.front().opt.label.empty() && option_set.front().opt.sidetext.size() == 0 && option_set.front().side_widget == nullptr && line.get_extra_widgets().size() == 0) { wxSizer* tmp_sizer; @@ -179,12 +179,12 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n // Text is properly aligned only when Ellipsize is checked. label_style |= staticbox ? 0 : wxST_ELLIPSIZE_END; #endif /* __WXGTK__ */ - label = new wxStaticText(parent(), wxID_ANY, line.label + (line.label.IsEmpty() ? "" : ":"), + label = new wxStaticText(parent(), wxID_ANY, line.label + (line.label.IsEmpty() ? "" : ": "), wxDefaultPosition, wxSize(label_width, -1), label_style); label->SetFont(label_font); label->Wrap(label_width); // avoid a Linux/GTK bug if (!line.near_label_widget) - grid_sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, 5); + grid_sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, line.label.IsEmpty() ? 0 : 5); else { // If we're here, we have some widget near the label // so we need a horizontal sizer to arrange these things @@ -213,6 +213,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n grid_sizer->Add(sizer, 0, wxEXPAND | (staticbox ? wxALL : wxBOTTOM | wxTOP | wxLEFT), staticbox ? 0 : 1); // If we have a single option with no sidetext just add it directly to the grid sizer if (option_set.size() == 1 && option_set.front().opt.sidetext.size() == 0 && + option_set.front().opt.label.empty() && option_set.front().side_widget == nullptr && line.get_extra_widgets().size() == 0) { const auto& option = option_set.front(); const auto& field = build_field(option, label); @@ -236,7 +237,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n wxString str_label = (option.label == "Top" || option.label == "Bottom") ? _CTX(option.label, "Layers") : _(option.label); - label = new wxStaticText(parent(), wxID_ANY, str_label + ":", wxDefaultPosition, wxDefaultSize); + label = new wxStaticText(parent(), wxID_ANY, str_label + ": ", wxDefaultPosition, wxDefaultSize); label->SetFont(label_font); sizer_tmp->Add(label, 0, /*wxALIGN_RIGHT |*/ wxALIGN_CENTER_VERTICAL, 0); } @@ -245,6 +246,16 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n const Option& opt_ref = opt; auto& field = build_field(opt_ref, label); add_undo_buttuns_to_sizer(sizer_tmp, field); + if (option_set.size() == 1 && option_set.front().opt.full_width) + { + const auto v_sizer = new wxBoxSizer(wxVERTICAL); + sizer_tmp->Add(v_sizer, 1, wxEXPAND); + is_sizer_field(field) ? + v_sizer->Add(field->getSizer(), 0, wxEXPAND) : + v_sizer->Add(field->getWindow(), 0, wxEXPAND); + return; + } + is_sizer_field(field) ? sizer_tmp->Add(field->getSizer(), 0, wxALIGN_CENTER_VERTICAL, 0) : sizer_tmp->Add(field->getWindow(), 0, wxALIGN_CENTER_VERTICAL, 0); @@ -269,7 +280,17 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n } } // add extra sizers if any - for (auto extra_widget : line.get_extra_widgets()) { + for (auto extra_widget : line.get_extra_widgets()) + { + if (line.get_extra_widgets().size() == 1 && !staticbox) + { + // extra widget for non-staticbox option group (like for the frequently used parameters on the sidebar) should be wxALIGN_RIGHT + const auto v_sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(v_sizer, 1, wxEXPAND); + v_sizer->Add(extra_widget(parent()), 0, wxALIGN_RIGHT); + return; + } + sizer->Add(extra_widget(parent())/*!.target()*/, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4); //! requires verification } } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index fa26b95f1..89c315976 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -306,7 +306,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : // Frequently changed parameters for FFF_technology m_og->set_config(config); - m_og->label_width = label_width; + m_og->label_width = label_width == 0 ? 1 : label_width; m_og->m_on_change = [config, this](t_config_option_key opt_key, boost::any value) { Tab* tab_print = wxGetApp().get_tab(Preset::TYPE_PRINT); @@ -351,29 +351,35 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : tab_print->update_dirty(); }; - Option option = m_og->get_option("fill_density"); - option.opt.sidetext = ""; - option.opt.full_width = true; - m_og->append_single_option_line(option); + + Line line = Line { "", "" }; ConfigOptionDef def; - - def.label = L("Support"); + def.label = L("Supports"); def.type = coStrings; def.gui_type = "select_open"; def.tooltip = L("Select what kind of support do you need"); def.enum_labels.push_back(L("None")); def.enum_labels.push_back(L("Support on build plate only")); def.enum_labels.push_back(L("Everywhere")); - std::string selection = !config->opt_bool("support_material") ? - "None" : - config->opt_bool("support_material_buildplate_only") ? - "Support on build plate only" : - "Everywhere"; + const std::string selection = !config->opt_bool("support_material") ? + "None" : config->opt_bool("support_material_buildplate_only") ? + "Support on build plate only" : + "Everywhere"; def.default_value = new ConfigOptionStrings{ selection }; - option = Option(def, "support"); + Option option = Option(def, "support"); option.opt.full_width = true; - m_og->append_single_option_line(option); + line.append_option(option); + m_og->append_line(line); + + + line = Line { "", "" }; + + option = m_og->get_option("fill_density"); + option.opt.label = L("Infill"); + option.opt.width = 7 * wxGetApp().em_unit(); + option.opt.sidetext = " "; + line.append_option(option); m_brim_width = config->opt_float("brim_width"); def.label = L("Brim"); @@ -382,11 +388,10 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : def.gui_type = ""; def.default_value = new ConfigOptionBool{ m_brim_width > 0.0 ? true : false }; option = Option(def, "brim"); - m_og->append_single_option_line(option); + option.opt.sidetext = " "; + line.append_option(option); - - Line line = { "", "" }; - line.widget = [config, this](wxWindow* parent) { + auto wiping_dialog_btn = [config, this](wxWindow* parent) { m_wiping_dialog_button = new wxButton(parent, wxID_ANY, _(L("Purging volumes")) + dots, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(m_wiping_dialog_button); @@ -403,19 +408,20 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : std::vector extruders = dlg.get_extruders(); (config.option("wiping_volumes_matrix"))->values = std::vector(matrix.begin(), matrix.end()); (config.option("wiping_volumes_extruders"))->values = std::vector(extruders.begin(), extruders.end()); - wxPostEvent(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent)); + wxPostEvent(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent)); } })); return sizer; }; - m_og->append_line(line); + line.append_widget(wiping_dialog_btn); + m_og->append_line(line); // Frequently changed parameters for SLA_technology m_og_sla = std::make_shared(parent, ""); DynamicPrintConfig* config_sla = &wxGetApp().preset_bundle->sla_prints.get_edited_preset().config; m_og_sla->set_config(config_sla); - m_og_sla->label_width = label_width*2; + m_og_sla->label_width = label_width == 0 ? 1 : label_width; m_og_sla->m_on_change = [config_sla, this](t_config_option_key opt_key, boost::any value) { Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT); @@ -429,12 +435,22 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : tab->update_dirty(); }; - m_og_sla->append_single_option_line("supports_enable"); - m_og_sla->append_single_option_line("pad_enable"); + + line = Line{ "", "" }; + + option = m_og_sla->get_option("supports_enable"); + option.opt.sidetext = " "; + line.append_option(option); + + option = m_og_sla->get_option("pad_enable"); + option.opt.sidetext = " "; + line.append_option(option); + + m_og_sla->append_line(line); m_sizer = new wxBoxSizer(wxVERTICAL); m_sizer->Add(m_og->sizer, 0, wxEXPAND); - m_sizer->Add(m_og_sla->sizer, 0, wxEXPAND | wxTOP, 5); + m_sizer->Add(m_og_sla->sizer, 0, wxEXPAND); } @@ -530,23 +546,23 @@ Sidebar::Sidebar(Plater *parent) p->mode_sizer = new PrusaModeSizer(p->scrolled); // The preset chooser - p->sizer_presets = new wxFlexGridSizer(5, 2, 1, 2); - p->sizer_presets->AddGrowableCol(1, 1); + p->sizer_presets = new wxFlexGridSizer(10, 1, 1, 2); + p->sizer_presets->AddGrowableCol(0, 1); p->sizer_presets->SetFlexibleDirection(wxBOTH); p->sizer_filaments = new wxBoxSizer(wxVERTICAL); auto init_combo = [this](PresetComboBox **combo, wxString label, Preset::Type preset_type, bool filament) { - auto *text = new wxStaticText(p->scrolled, wxID_ANY, label); + auto *text = new wxStaticText(p->scrolled, wxID_ANY, label+" :"); text->SetFont(wxGetApp().small_font()); *combo = new PresetComboBox(p->scrolled, preset_type); auto *sizer_presets = this->p->sizer_presets; auto *sizer_filaments = this->p->sizer_filaments; - sizer_presets->Add(text, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxRIGHT, 4); + sizer_presets->Add(text, 0, wxALIGN_LEFT | wxEXPAND | wxRIGHT, 4); if (! filament) { - sizer_presets->Add(*combo, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxBOTTOM, 1); + sizer_presets->Add(*combo, 0, wxEXPAND | wxBOTTOM, 1); } else { - sizer_filaments->Add(*combo, 1, wxEXPAND | wxBOTTOM, 1); + sizer_filaments->Add(*combo, 0, wxEXPAND | wxBOTTOM, 1); (*combo)->set_extruder_idx(0); sizer_presets->Add(sizer_filaments, 1, wxEXPAND); } @@ -560,29 +576,32 @@ Sidebar::Sidebar(Plater *parent) init_combo(&p->combo_printer, _(L("Printer")), Preset::TYPE_PRINTER, false); // calculate width of the preset labels - p->sizer_presets->Layout(); - const wxArrayInt& ar = p->sizer_presets->GetColWidths(); - const int label_width = ar.IsEmpty() ? 10*wxGetApp().em_unit() : ar.front()-4; +// p->sizer_presets->Layout(); +// const wxArrayInt& ar = p->sizer_presets->GetColWidths(); +// const int label_width = ar.IsEmpty() ? 10*wxGetApp().em_unit() : ar.front()-4; + + const int margin_5 = int(0.5*wxGetApp().em_unit());// 5; + const int margin_10 = int(1.5*wxGetApp().em_unit());// 15; p->sizer_params = new wxBoxSizer(wxVERTICAL); // Frequently changed parameters - p->frequently_changed_parameters = new FreqChangedParams(p->scrolled, label_width); - p->sizer_params->Add(p->frequently_changed_parameters->get_sizer(), 0, wxEXPAND | wxBOTTOM | wxLEFT, 2); + p->frequently_changed_parameters = new FreqChangedParams(p->scrolled, 0/*label_width*/); + p->sizer_params->Add(p->frequently_changed_parameters->get_sizer(), 0, wxEXPAND | wxTOP | wxBOTTOM, margin_10); // Object List p->object_list = new ObjectList(p->scrolled); - p->sizer_params->Add(p->object_list->get_sizer(), 1, wxEXPAND | wxTOP, 20); + p->sizer_params->Add(p->object_list->get_sizer(), 1, wxEXPAND); // Object Manipulations p->object_manipulation = new ObjectManipulation(p->scrolled); p->object_manipulation->Hide(); - p->sizer_params->Add(p->object_manipulation->get_sizer(), 0, wxEXPAND | wxLEFT | wxTOP, 20); + p->sizer_params->Add(p->object_manipulation->get_sizer(), 0, wxEXPAND | wxTOP, margin_5); // Frequently Object Settings p->object_settings = new ObjectSettings(p->scrolled); p->object_settings->Hide(); - p->sizer_params->Add(p->object_settings->get_sizer(), 0, wxEXPAND | wxLEFT | wxTOP, 20); + p->sizer_params->Add(p->object_settings->get_sizer(), 0, wxEXPAND | wxTOP, margin_5); wxBitmap arrow_up(GUI::from_u8(Slic3r::var("brick_go.png")), wxBITMAP_TYPE_PNG); p->btn_send_gcode = new wxButton(this, wxID_ANY, _(L("Send to printer"))); @@ -595,11 +614,11 @@ Sidebar::Sidebar(Plater *parent) p->sliced_info = new SlicedInfo(p->scrolled); // Sizer in the scrolled area - scrolled_sizer->Add(p->mode_sizer, 0, wxALIGN_RIGHT/*CENTER_HORIZONTAL*/ | wxBOTTOM | wxRIGHT, 5); - scrolled_sizer->Add(p->sizer_presets, 0, wxEXPAND | wxLEFT, 2); - scrolled_sizer->Add(p->sizer_params, 1, wxEXPAND); - scrolled_sizer->Add(p->object_info, 0, wxEXPAND | wxTOP | wxLEFT, 20); - scrolled_sizer->Add(p->sliced_info, 0, wxEXPAND | wxTOP | wxLEFT, 20); + scrolled_sizer->Add(p->mode_sizer, 0, wxALIGN_CENTER_HORIZONTAL/*RIGHT | wxBOTTOM | wxRIGHT, 5*/); + scrolled_sizer->Add(p->sizer_presets, 0, wxEXPAND | wxLEFT, margin_5); + scrolled_sizer->Add(p->sizer_params, 1, wxEXPAND | wxLEFT, margin_5); + scrolled_sizer->Add(p->object_info, 0, wxEXPAND | wxTOP | wxLEFT, margin_5); + scrolled_sizer->Add(p->sliced_info, 0, wxEXPAND | wxTOP | wxLEFT, margin_5); // Buttons underneath the scrolled area p->btn_export_gcode = new wxButton(this, wxID_ANY, _(L("Export G-code")) + dots); @@ -609,13 +628,13 @@ Sidebar::Sidebar(Plater *parent) enable_buttons(false); auto *btns_sizer = new wxBoxSizer(wxVERTICAL); - btns_sizer->Add(p->btn_reslice, 0, wxEXPAND | wxTOP, 5); - btns_sizer->Add(p->btn_send_gcode, 0, wxEXPAND | wxTOP, 5); - btns_sizer->Add(p->btn_export_gcode, 0, wxEXPAND | wxTOP, 5); + btns_sizer->Add(p->btn_reslice, 0, wxEXPAND | wxTOP, margin_5); + btns_sizer->Add(p->btn_send_gcode, 0, wxEXPAND | wxTOP, margin_5); + btns_sizer->Add(p->btn_export_gcode, 0, wxEXPAND | wxTOP, margin_5); auto *sizer = new wxBoxSizer(wxVERTICAL); - sizer->Add(p->scrolled, 1, wxEXPAND | wxTOP, 5); - sizer->Add(btns_sizer, 0, wxEXPAND | wxLEFT, 20); + sizer->Add(p->scrolled, 1, wxEXPAND | wxTOP, margin_5); + sizer->Add(btns_sizer, 0, wxEXPAND | wxLEFT, margin_5); SetSizer(sizer); // Events diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index db989bdca..356cba684 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -213,7 +213,7 @@ void Tab::create_preset_tab() m_hsizer->Add(m_left_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 3); // tree - m_treectrl = new wxTreeCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(15 * m_em_unit, -1), + m_treectrl = new wxTreeCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(20 * m_em_unit, -1), wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_SUNKEN | wxWANTS_CHARS); m_left_sizer->Add(m_treectrl, 1, wxEXPAND); m_icons = new wxImageList(int(16 * scale_factor), int(16 * scale_factor), true, 1); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index fee394db1..06c283b6a 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2375,8 +2375,8 @@ void PrusaModeButton::SetState(const bool state) void PrusaModeButton::focus_button(const bool focus) { - const wxBitmap& bmp = focus ? m_bmp_on : m_bmp_off; - SetBitmap(bmp); +// const wxBitmap& bmp = focus ? m_bmp_on : m_bmp_off; +// SetBitmap(bmp); const wxFont& new_font = focus ? Slic3r::GUI::wxGetApp().bold_font() : Slic3r::GUI::wxGetApp().small_font(); SetFont(new_font); @@ -2390,7 +2390,7 @@ void PrusaModeButton::focus_button(const bool focus) // ---------------------------------------------------------------------------- PrusaModeSizer::PrusaModeSizer(wxWindow *parent) : - wxFlexGridSizer(3, 0, 5) + wxFlexGridSizer(3, 0, 2* Slic3r::GUI::wxGetApp().em_unit()/*5*/) { SetFlexibleDirection(wxHORIZONTAL);