mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 16:45:53 +08:00
Plater refactoring:
* Sidebar and related classes are extracted to separate file. * Frequently changed parameters are extracted to separate file too.
This commit is contained in:
parent
fa86a3d047
commit
69650f703d
@ -114,6 +114,10 @@ set(SLIC3R_GUI_SOURCES
|
|||||||
GUI/IconManager.hpp
|
GUI/IconManager.hpp
|
||||||
GUI/MainFrame.cpp
|
GUI/MainFrame.cpp
|
||||||
GUI/MainFrame.hpp
|
GUI/MainFrame.hpp
|
||||||
|
GUI/FrequentlyChangedParameters.cpp
|
||||||
|
GUI/FrequentlyChangedParameters.hpp
|
||||||
|
GUI/Sidebar.cpp
|
||||||
|
GUI/Sidebar.hpp
|
||||||
GUI/Plater.cpp
|
GUI/Plater.cpp
|
||||||
GUI/Plater.hpp
|
GUI/Plater.hpp
|
||||||
GUI/PresetComboBoxes.hpp
|
GUI/PresetComboBoxes.hpp
|
||||||
|
331
src/slic3r/GUI/FrequentlyChangedParameters.cpp
Normal file
331
src/slic3r/GUI/FrequentlyChangedParameters.cpp
Normal file
@ -0,0 +1,331 @@
|
|||||||
|
///|/ Copyright (c) Prusa Research 2018 - 2023 Vojtěch Bubník @bubnikv, Lukáš Matěna @lukasmatena, Oleksandra Iushchenko @YuSanka, Enrico Turri @enricoturri1966, Tomáš Mészáros @tamasmeszaros, David Kocík @kocikdav, Lukáš Hejl @hejllukas, Pavel Mikuš @Godrak, Filip Sykala @Jony01, Vojtěch Král @vojtechkral
|
||||||
|
///|/ Copyright (c) 2022 Michael Kirsch
|
||||||
|
///|/ Copyright (c) 2021 Boleslaw Ciesielski
|
||||||
|
///|/ Copyright (c) 2019 John Drake @foxox
|
||||||
|
///|/
|
||||||
|
///|/ ported from lib/Slic3r/GUI/Plater.pm:
|
||||||
|
///|/ Copyright (c) Prusa Research 2016 - 2019 Vojtěch Bubník @bubnikv, Vojtěch Král @vojtechkral, Enrico Turri @enricoturri1966, Oleksandra Iushchenko @YuSanka, Lukáš Matěna @lukasmatena, Tomáš Mészáros @tamasmeszaros
|
||||||
|
///|/ Copyright (c) 2018 Martin Loidl @LoidlM
|
||||||
|
///|/ Copyright (c) 2017 Matthias Gazzari @qtux
|
||||||
|
///|/ Copyright (c) Slic3r 2012 - 2016 Alessandro Ranellucci @alranel
|
||||||
|
///|/ Copyright (c) 2017 Joseph Lenox @lordofhyphens
|
||||||
|
///|/ Copyright (c) 2015 Daren Schwenke
|
||||||
|
///|/ Copyright (c) 2014 Mark Hindess
|
||||||
|
///|/ Copyright (c) 2012 Mike Sheldrake @mesheldrake
|
||||||
|
///|/ Copyright (c) 2012 Henrik Brix Andersen @henrikbrixandersen
|
||||||
|
///|/ Copyright (c) 2012 Sam Wong
|
||||||
|
///|/
|
||||||
|
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
|
||||||
|
///|/
|
||||||
|
|
||||||
|
#include "FrequentlyChangedParameters.hpp"
|
||||||
|
#include "Plater.hpp"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <wx/sizer.h>
|
||||||
|
#include <wx/button.h>
|
||||||
|
|
||||||
|
#include "libslic3r/PresetBundle.hpp"
|
||||||
|
|
||||||
|
#include "GUI_App.hpp"
|
||||||
|
#include "wxExtensions.hpp"
|
||||||
|
#include "format.hpp"
|
||||||
|
#include "Tab.hpp"
|
||||||
|
#include "I18N.hpp"
|
||||||
|
|
||||||
|
#include "WipeTowerDialog.hpp"
|
||||||
|
|
||||||
|
using Slic3r::Preset;
|
||||||
|
using Slic3r::GUI::format_wxstr;
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
|
// Trigger Plater::schedule_background_process().
|
||||||
|
wxDEFINE_EVENT(EVT_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent);
|
||||||
|
|
||||||
|
FreqChangedParams::FreqChangedParams(wxWindow* parent)
|
||||||
|
{
|
||||||
|
DynamicPrintConfig* config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||||
|
|
||||||
|
// Frequently changed parameters for FFF_technology
|
||||||
|
|
||||||
|
m_og_fff = std::make_shared<ConfigOptionsGroup>(parent, "");
|
||||||
|
m_og_fff->set_config(config);
|
||||||
|
m_og_fff->hide_labels();
|
||||||
|
|
||||||
|
m_og_fff->on_change = [config, this](t_config_option_key opt_key, boost::any value) {
|
||||||
|
Tab* tab_print = wxGetApp().get_tab(Preset::TYPE_PRINT);
|
||||||
|
if (!tab_print) return;
|
||||||
|
|
||||||
|
if (opt_key == "fill_density") {
|
||||||
|
tab_print->update_dirty();
|
||||||
|
tab_print->reload_config();
|
||||||
|
tab_print->update();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DynamicPrintConfig new_conf = *config;
|
||||||
|
if (opt_key == "brim") {
|
||||||
|
double new_val;
|
||||||
|
double brim_width = config->opt_float("brim_width");
|
||||||
|
if (boost::any_cast<bool>(value) == true)
|
||||||
|
{
|
||||||
|
new_val = m_brim_width == 0.0 ? 5 :
|
||||||
|
m_brim_width < 0.0 ? m_brim_width * (-1) :
|
||||||
|
m_brim_width;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_brim_width = brim_width * (-1);
|
||||||
|
new_val = 0;
|
||||||
|
}
|
||||||
|
new_conf.set_key_value("brim_width", new ConfigOptionFloat(new_val));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
assert(opt_key == "support");
|
||||||
|
const wxString& selection = boost::any_cast<wxString>(value);
|
||||||
|
PrinterTechnology printer_technology = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology();
|
||||||
|
|
||||||
|
auto support_material = selection == _("None") ? false : true;
|
||||||
|
new_conf.set_key_value("support_material", new ConfigOptionBool(support_material));
|
||||||
|
|
||||||
|
if (selection == _("Everywhere")) {
|
||||||
|
new_conf.set_key_value("support_material_buildplate_only", new ConfigOptionBool(false));
|
||||||
|
if (printer_technology == ptFFF)
|
||||||
|
new_conf.set_key_value("support_material_auto", new ConfigOptionBool(true));
|
||||||
|
} else if (selection == _("Support on build plate only")) {
|
||||||
|
new_conf.set_key_value("support_material_buildplate_only", new ConfigOptionBool(true));
|
||||||
|
if (printer_technology == ptFFF)
|
||||||
|
new_conf.set_key_value("support_material_auto", new ConfigOptionBool(true));
|
||||||
|
} else if (selection == _("For support enforcers only")) {
|
||||||
|
assert(printer_technology == ptFFF);
|
||||||
|
new_conf.set_key_value("support_material_buildplate_only", new ConfigOptionBool(false));
|
||||||
|
new_conf.set_key_value("support_material_auto", new ConfigOptionBool(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tab_print->load_config(new_conf);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Line line = Line { "", "" };
|
||||||
|
|
||||||
|
ConfigOptionDef support_def;
|
||||||
|
support_def.label = L("Supports");
|
||||||
|
support_def.type = coStrings;
|
||||||
|
support_def.tooltip = L("Select what kind of support do you need");
|
||||||
|
support_def.set_enum_labels(ConfigOptionDef::GUIType::select_close, {
|
||||||
|
L("None"),
|
||||||
|
L("Support on build plate only"),
|
||||||
|
L("For support enforcers only"),
|
||||||
|
L("Everywhere")
|
||||||
|
});
|
||||||
|
support_def.set_default_value(new ConfigOptionStrings{ "None" });
|
||||||
|
Option option = Option(support_def, "support");
|
||||||
|
option.opt.full_width = true;
|
||||||
|
line.append_option(option);
|
||||||
|
|
||||||
|
/* Not a best solution, but
|
||||||
|
* Temporary workaround for right border alignment
|
||||||
|
*/
|
||||||
|
auto empty_widget = [this] (wxWindow* parent) {
|
||||||
|
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
auto btn = new ScalableButton(parent, wxID_ANY, "mirroring_transparent", wxEmptyString,
|
||||||
|
wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER | wxTRANSPARENT_WINDOW);
|
||||||
|
sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, int(0.3 * wxGetApp().em_unit()));
|
||||||
|
m_empty_buttons.push_back(btn);
|
||||||
|
return sizer;
|
||||||
|
};
|
||||||
|
line.append_widget(empty_widget);
|
||||||
|
|
||||||
|
m_og_fff->append_line(line);
|
||||||
|
|
||||||
|
|
||||||
|
line = Line { "", "" };
|
||||||
|
|
||||||
|
option = m_og_fff->get_option("fill_density");
|
||||||
|
option.opt.label = L("Infill");
|
||||||
|
option.opt.width = 8;
|
||||||
|
option.opt.sidetext = " ";
|
||||||
|
line.append_option(option);
|
||||||
|
|
||||||
|
m_brim_width = config->opt_float("brim_width");
|
||||||
|
ConfigOptionDef def;
|
||||||
|
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.");
|
||||||
|
def.gui_type = ConfigOptionDef::GUIType::undefined;
|
||||||
|
def.set_default_value(new ConfigOptionBool{ m_brim_width > 0.0 ? true : false });
|
||||||
|
option = Option(def, "brim");
|
||||||
|
option.opt.sidetext = "";
|
||||||
|
line.append_option(option);
|
||||||
|
|
||||||
|
auto wiping_dialog_btn = [this](wxWindow* parent) {
|
||||||
|
m_wiping_dialog_button = new wxButton(parent, wxID_ANY, _L("Purging volumes") + dots, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
|
||||||
|
wxGetApp().SetWindowVariantForButton(m_wiping_dialog_button);
|
||||||
|
wxGetApp().UpdateDarkUI(m_wiping_dialog_button, true);
|
||||||
|
|
||||||
|
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
sizer->Add(m_wiping_dialog_button, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
m_wiping_dialog_button->Bind(wxEVT_BUTTON, ([parent](wxCommandEvent& e)
|
||||||
|
{
|
||||||
|
auto &project_config = wxGetApp().preset_bundle->project_config;
|
||||||
|
const std::vector<double> &init_matrix = (project_config.option<ConfigOptionFloats>("wiping_volumes_matrix"))->values;
|
||||||
|
const std::vector<double> &init_extruders = (project_config.option<ConfigOptionFloats>("wiping_volumes_extruders"))->values;
|
||||||
|
|
||||||
|
const std::vector<std::string> extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config();
|
||||||
|
|
||||||
|
WipingDialog dlg(parent, cast<float>(init_matrix), cast<float>(init_extruders), extruder_colours);
|
||||||
|
|
||||||
|
if (dlg.ShowModal() == wxID_OK) {
|
||||||
|
std::vector<float> matrix = dlg.get_matrix();
|
||||||
|
std::vector<float> extruders = dlg.get_extruders();
|
||||||
|
(project_config.option<ConfigOptionFloats>("wiping_volumes_matrix"))->values = std::vector<double>(matrix.begin(), matrix.end());
|
||||||
|
(project_config.option<ConfigOptionFloats>("wiping_volumes_extruders"))->values = std::vector<double>(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));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
auto btn = new ScalableButton(parent, wxID_ANY, "mirroring_transparent", wxEmptyString,
|
||||||
|
wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER | wxTRANSPARENT_WINDOW);
|
||||||
|
sizer->Add(btn , 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
|
||||||
|
int(0.3 * wxGetApp().em_unit()));
|
||||||
|
m_empty_buttons.push_back(btn);
|
||||||
|
|
||||||
|
return sizer;
|
||||||
|
};
|
||||||
|
line.append_widget(wiping_dialog_btn);
|
||||||
|
m_og_fff->append_line(line);
|
||||||
|
|
||||||
|
m_og_fff->activate();
|
||||||
|
|
||||||
|
Choice* choice = dynamic_cast<Choice*>(m_og_fff->get_field("support"));
|
||||||
|
choice->suppress_scroll();
|
||||||
|
|
||||||
|
// Frequently changed parameters for SLA_technology
|
||||||
|
|
||||||
|
m_og_sla = std::make_shared<ConfigOptionsGroup>(parent, "");
|
||||||
|
m_og_sla->hide_labels();
|
||||||
|
DynamicPrintConfig* config_sla = &wxGetApp().preset_bundle->sla_prints.get_edited_preset().config;
|
||||||
|
m_og_sla->set_config(config_sla);
|
||||||
|
|
||||||
|
m_og_sla->on_change = [config_sla](t_config_option_key opt_key, boost::any value) {
|
||||||
|
Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT);
|
||||||
|
if (!tab) return;
|
||||||
|
|
||||||
|
DynamicPrintConfig new_conf = *config_sla;
|
||||||
|
if (opt_key == "pad") {
|
||||||
|
const wxString& selection = boost::any_cast<wxString>(value);
|
||||||
|
|
||||||
|
const bool pad_enable = selection == _("None") ? false : true;
|
||||||
|
new_conf.set_key_value("pad_enable", new ConfigOptionBool(pad_enable));
|
||||||
|
|
||||||
|
if (selection == _("Below object"))
|
||||||
|
new_conf.set_key_value("pad_around_object", new ConfigOptionBool(false));
|
||||||
|
else if (selection == _("Around object"))
|
||||||
|
new_conf.set_key_value("pad_around_object", new ConfigOptionBool(true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assert(opt_key == "support");
|
||||||
|
const wxString& selection = boost::any_cast<wxString>(value);
|
||||||
|
|
||||||
|
const bool supports_enable = selection == _("None") ? false : true;
|
||||||
|
new_conf.set_key_value("supports_enable", new ConfigOptionBool(supports_enable));
|
||||||
|
|
||||||
|
std::string treetype = get_sla_suptree_prefix(new_conf);
|
||||||
|
|
||||||
|
if (selection == _("Everywhere")) {
|
||||||
|
new_conf.set_key_value(treetype + "support_buildplate_only", new ConfigOptionBool(false));
|
||||||
|
new_conf.set_key_value("support_enforcers_only", new ConfigOptionBool(false));
|
||||||
|
}
|
||||||
|
else if (selection == _("Support on build plate only")) {
|
||||||
|
new_conf.set_key_value(treetype + "support_buildplate_only", new ConfigOptionBool(true));
|
||||||
|
new_conf.set_key_value("support_enforcers_only", new ConfigOptionBool(false));
|
||||||
|
}
|
||||||
|
else if (selection == _("For support enforcers only")) {
|
||||||
|
new_conf.set_key_value("support_enforcers_only", new ConfigOptionBool(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tab->load_config(new_conf);
|
||||||
|
tab->update_dirty();
|
||||||
|
};
|
||||||
|
|
||||||
|
line = Line{ "", "" };
|
||||||
|
|
||||||
|
ConfigOptionDef support_def_sla = support_def;
|
||||||
|
support_def_sla.set_default_value(new ConfigOptionStrings{ "None" });
|
||||||
|
option = Option(support_def_sla, "support");
|
||||||
|
option.opt.full_width = true;
|
||||||
|
line.append_option(option);
|
||||||
|
line.append_widget(empty_widget);
|
||||||
|
m_og_sla->append_line(line);
|
||||||
|
|
||||||
|
line = Line{ "", "" };
|
||||||
|
|
||||||
|
ConfigOptionDef pad_def;
|
||||||
|
pad_def.label = L("Pad");
|
||||||
|
pad_def.type = coStrings;
|
||||||
|
pad_def.tooltip = L("Select what kind of pad do you need");
|
||||||
|
pad_def.set_enum_labels(ConfigOptionDef::GUIType::select_close, {
|
||||||
|
L("None"),
|
||||||
|
L("Below object"),
|
||||||
|
L("Around object")
|
||||||
|
});
|
||||||
|
pad_def.set_default_value(new ConfigOptionStrings{ "Below object" });
|
||||||
|
option = Option(pad_def, "pad");
|
||||||
|
option.opt.full_width = true;
|
||||||
|
line.append_option(option);
|
||||||
|
line.append_widget(empty_widget);
|
||||||
|
|
||||||
|
m_og_sla->append_line(line);
|
||||||
|
|
||||||
|
m_og_sla->activate();
|
||||||
|
choice = dynamic_cast<Choice*>(m_og_sla->get_field("support"));
|
||||||
|
choice->suppress_scroll();
|
||||||
|
choice = dynamic_cast<Choice*>(m_og_sla->get_field("pad"));
|
||||||
|
choice->suppress_scroll();
|
||||||
|
|
||||||
|
m_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
m_sizer->Add(m_og_fff->sizer, 0, wxEXPAND);
|
||||||
|
m_sizer->Add(m_og_sla->sizer, 0, wxEXPAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreqChangedParams::msw_rescale()
|
||||||
|
{
|
||||||
|
m_og_fff->msw_rescale();
|
||||||
|
m_og_sla->msw_rescale();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreqChangedParams::sys_color_changed()
|
||||||
|
{
|
||||||
|
m_og_fff->sys_color_changed();
|
||||||
|
m_og_sla->sys_color_changed();
|
||||||
|
|
||||||
|
for (auto btn: m_empty_buttons)
|
||||||
|
btn->sys_color_changed();
|
||||||
|
|
||||||
|
wxGetApp().UpdateDarkUI(m_wiping_dialog_button, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreqChangedParams::Show(bool is_fff) const
|
||||||
|
{
|
||||||
|
const bool is_wdb_shown = m_wiping_dialog_button->IsShown();
|
||||||
|
m_og_fff->Show(is_fff);
|
||||||
|
m_og_sla->Show(!is_fff);
|
||||||
|
|
||||||
|
// correct showing of the FreqChangedParams sizer when m_wiping_dialog_button is hidden
|
||||||
|
if (is_fff && !is_wdb_shown)
|
||||||
|
m_wiping_dialog_button->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigOptionsGroup* FreqChangedParams::get_og(bool is_fff)
|
||||||
|
{
|
||||||
|
return is_fff ? m_og_fff.get() : m_og_sla.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
}} // namespace Slic3r::GUI
|
64
src/slic3r/GUI/FrequentlyChangedParameters.hpp
Normal file
64
src/slic3r/GUI/FrequentlyChangedParameters.hpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
///|/ Copyright (c) Prusa Research 2018 - 2023 Tomáš Mészáros @tamasmeszaros, Oleksandra Iushchenko @YuSanka, Enrico Turri @enricoturri1966, David Kocík @kocikdav, Lukáš Hejl @hejllukas, Vojtěch Bubník @bubnikv, Lukáš Matěna @lukasmatena, Pavel Mikuš @Godrak, Filip Sykala @Jony01, Vojtěch Král @vojtechkral
|
||||||
|
///|/
|
||||||
|
///|/ ported from lib/Slic3r/GUI/Plater.pm:
|
||||||
|
///|/ Copyright (c) Prusa Research 2016 - 2019 Vojtěch Bubník @bubnikv, Vojtěch Král @vojtechkral, Enrico Turri @enricoturri1966, Oleksandra Iushchenko @YuSanka, Lukáš Matěna @lukasmatena, Tomáš Mészáros @tamasmeszaros
|
||||||
|
///|/ Copyright (c) 2018 Martin Loidl @LoidlM
|
||||||
|
///|/ Copyright (c) 2017 Matthias Gazzari @qtux
|
||||||
|
///|/ Copyright (c) Slic3r 2012 - 2016 Alessandro Ranellucci @alranel
|
||||||
|
///|/ Copyright (c) 2017 Joseph Lenox @lordofhyphens
|
||||||
|
///|/ Copyright (c) 2015 Daren Schwenke
|
||||||
|
///|/ Copyright (c) 2014 Mark Hindess
|
||||||
|
///|/ Copyright (c) 2012 Mike Sheldrake @mesheldrake
|
||||||
|
///|/ Copyright (c) 2012 Henrik Brix Andersen @henrikbrixandersen
|
||||||
|
///|/ Copyright (c) 2012 Sam Wong
|
||||||
|
///|/
|
||||||
|
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
|
||||||
|
///|/
|
||||||
|
#ifndef slic3r_FreqChangedParams_hpp_
|
||||||
|
#define slic3r_FreqChangedParams_hpp_
|
||||||
|
|
||||||
|
#include "Event.hpp"
|
||||||
|
|
||||||
|
class wxButton;
|
||||||
|
class wxSizer;
|
||||||
|
class wxWindow;
|
||||||
|
class ScalableButton;
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
|
wxDECLARE_EVENT(EVT_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent);
|
||||||
|
|
||||||
|
class ConfigOptionsGroup;
|
||||||
|
|
||||||
|
class FreqChangedParams
|
||||||
|
{
|
||||||
|
double m_brim_width = 0.0;
|
||||||
|
wxButton* m_wiping_dialog_button{ nullptr };
|
||||||
|
wxSizer* m_sizer {nullptr};
|
||||||
|
|
||||||
|
std::shared_ptr<ConfigOptionsGroup> m_og_fff;
|
||||||
|
std::shared_ptr<ConfigOptionsGroup> m_og_sla;
|
||||||
|
|
||||||
|
std::vector<ScalableButton*> m_empty_buttons;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
FreqChangedParams(wxWindow* parent);
|
||||||
|
~FreqChangedParams() = default;
|
||||||
|
|
||||||
|
wxButton* get_wiping_dialog_button() noexcept { return m_wiping_dialog_button; }
|
||||||
|
wxSizer* get_sizer() noexcept { return m_sizer; }
|
||||||
|
void Show(bool is_fff) const;
|
||||||
|
|
||||||
|
ConfigOptionsGroup* get_og(bool is_fff);
|
||||||
|
|
||||||
|
void msw_rescale();
|
||||||
|
void sys_color_changed();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace GUI
|
||||||
|
} // namespace Slic3r
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
@ -23,20 +23,13 @@
|
|||||||
|
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
|
|
||||||
|
#include "Sidebar.hpp"
|
||||||
#include "Selection.hpp"
|
#include "Selection.hpp"
|
||||||
|
|
||||||
#include "libslic3r/enum_bitmask.hpp"
|
|
||||||
#include "libslic3r/Preset.hpp"
|
|
||||||
#include "libslic3r/BoundingBox.hpp"
|
|
||||||
#include "libslic3r/GCode/GCodeProcessor.hpp"
|
#include "libslic3r/GCode/GCodeProcessor.hpp"
|
||||||
#include "Jobs/Job.hpp"
|
#include "Jobs/Job.hpp"
|
||||||
#include "Jobs/Worker.hpp"
|
#include "Jobs/Worker.hpp"
|
||||||
#include "GUI.hpp"
|
|
||||||
#include "I18N.hpp"
|
|
||||||
|
|
||||||
class wxButton;
|
|
||||||
class ScalableButton;
|
|
||||||
class wxScrolledWindow;
|
|
||||||
class wxString;
|
class wxString;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
@ -62,82 +55,11 @@ namespace UndoRedo {
|
|||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
class MainFrame;
|
class MainFrame;
|
||||||
class ConfigOptionsGroup;
|
|
||||||
class ObjectManipulation;
|
|
||||||
class ObjectSettings;
|
|
||||||
class ObjectLayers;
|
|
||||||
class ObjectList;
|
|
||||||
class GLCanvas3D;
|
class GLCanvas3D;
|
||||||
class Mouse3DController;
|
class Mouse3DController;
|
||||||
class NotificationManager;
|
class NotificationManager;
|
||||||
struct Camera;
|
struct Camera;
|
||||||
class GLToolbar;
|
class GLToolbar;
|
||||||
class PlaterPresetComboBox;
|
|
||||||
|
|
||||||
using t_optgroups = std::vector <std::shared_ptr<ConfigOptionsGroup>>;
|
|
||||||
|
|
||||||
class Plater;
|
|
||||||
enum class ActionButtonType : int;
|
|
||||||
|
|
||||||
class Sidebar : public wxPanel
|
|
||||||
{
|
|
||||||
ConfigOptionMode m_mode{ConfigOptionMode::comSimple};
|
|
||||||
public:
|
|
||||||
Sidebar(Plater *parent);
|
|
||||||
Sidebar(Sidebar &&) = delete;
|
|
||||||
Sidebar(const Sidebar &) = delete;
|
|
||||||
Sidebar &operator=(Sidebar &&) = delete;
|
|
||||||
Sidebar &operator=(const Sidebar &) = delete;
|
|
||||||
~Sidebar();
|
|
||||||
|
|
||||||
void init_filament_combo(PlaterPresetComboBox **combo, const int extr_idx);
|
|
||||||
void remove_unused_filament_combos(const size_t current_extruder_count);
|
|
||||||
void update_all_preset_comboboxes();
|
|
||||||
void update_presets(Slic3r::Preset::Type preset_type);
|
|
||||||
void update_mode_sizer() const;
|
|
||||||
void change_top_border_for_mode_sizer(bool increase_border);
|
|
||||||
void update_reslice_btn_tooltip() const;
|
|
||||||
void msw_rescale();
|
|
||||||
void sys_color_changed();
|
|
||||||
void update_mode_markers();
|
|
||||||
|
|
||||||
ObjectManipulation* obj_manipul();
|
|
||||||
ObjectList* obj_list();
|
|
||||||
ObjectSettings* obj_settings();
|
|
||||||
ObjectLayers* obj_layers();
|
|
||||||
wxScrolledWindow* scrolled_panel();
|
|
||||||
wxPanel* presets_panel();
|
|
||||||
|
|
||||||
ConfigOptionsGroup* og_freq_chng_params(const bool is_fff);
|
|
||||||
wxButton* get_wiping_dialog_button();
|
|
||||||
void update_objects_list_extruder_column(size_t extruders_count);
|
|
||||||
void show_info_sizer();
|
|
||||||
void show_sliced_info_sizer(const bool show);
|
|
||||||
void update_sliced_info_sizer();
|
|
||||||
void enable_buttons(bool enable);
|
|
||||||
void set_btn_label(const ActionButtonType btn_type, const wxString& label) const;
|
|
||||||
bool show_reslice(bool show) const;
|
|
||||||
bool show_export(bool show) const;
|
|
||||||
bool show_send(bool show) const;
|
|
||||||
bool show_eject(bool show)const;
|
|
||||||
bool show_export_removable(bool show) const;
|
|
||||||
bool get_eject_shown() const;
|
|
||||||
bool is_multifilament();
|
|
||||||
void update_mode();
|
|
||||||
bool is_collapsed();
|
|
||||||
void collapse(bool collapse);
|
|
||||||
void update_ui_from_settings();
|
|
||||||
|
|
||||||
#ifdef _MSW_DARK_MODE
|
|
||||||
void show_mode_sizer(bool show);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::vector<PlaterPresetComboBox*>& combos_filament();
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct priv;
|
|
||||||
std::unique_ptr<priv> p;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Plater: public wxPanel
|
class Plater: public wxPanel
|
||||||
{
|
{
|
||||||
|
1141
src/slic3r/GUI/Sidebar.cpp
Normal file
1141
src/slic3r/GUI/Sidebar.cpp
Normal file
File diff suppressed because it is too large
Load Diff
115
src/slic3r/GUI/Sidebar.hpp
Normal file
115
src/slic3r/GUI/Sidebar.hpp
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
///|/ Copyright (c) Prusa Research 2018 - 2023 Tomáš Mészáros @tamasmeszaros, Oleksandra Iushchenko @YuSanka, Enrico Turri @enricoturri1966, David Kocík @kocikdav, Lukáš Hejl @hejllukas, Vojtěch Bubník @bubnikv, Lukáš Matěna @lukasmatena, Pavel Mikuš @Godrak, Filip Sykala @Jony01, Vojtěch Král @vojtechkral
|
||||||
|
///|/
|
||||||
|
///|/ ported from lib/Slic3r/GUI/Plater.pm:
|
||||||
|
///|/ Copyright (c) Prusa Research 2016 - 2019 Vojtěch Bubník @bubnikv, Vojtěch Král @vojtechkral, Enrico Turri @enricoturri1966, Oleksandra Iushchenko @YuSanka, Lukáš Matěna @lukasmatena, Tomáš Mészáros @tamasmeszaros
|
||||||
|
///|/ Copyright (c) 2018 Martin Loidl @LoidlM
|
||||||
|
///|/ Copyright (c) 2017 Matthias Gazzari @qtux
|
||||||
|
///|/ Copyright (c) Slic3r 2012 - 2016 Alessandro Ranellucci @alranel
|
||||||
|
///|/ Copyright (c) 2017 Joseph Lenox @lordofhyphens
|
||||||
|
///|/ Copyright (c) 2015 Daren Schwenke
|
||||||
|
///|/ Copyright (c) 2014 Mark Hindess
|
||||||
|
///|/ Copyright (c) 2012 Mike Sheldrake @mesheldrake
|
||||||
|
///|/ Copyright (c) 2012 Henrik Brix Andersen @henrikbrixandersen
|
||||||
|
///|/ Copyright (c) 2012 Sam Wong
|
||||||
|
///|/
|
||||||
|
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
|
||||||
|
///|/
|
||||||
|
#ifndef slic3r_Sidebar_hpp_
|
||||||
|
#define slic3r_Sidebar_hpp_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <wx/panel.h>
|
||||||
|
|
||||||
|
#include "libslic3r/Preset.hpp"
|
||||||
|
#include "GUI.hpp"
|
||||||
|
#include "Event.hpp"
|
||||||
|
|
||||||
|
class wxButton;
|
||||||
|
class wxScrolledWindow;
|
||||||
|
class wxString;
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
|
wxDECLARE_EVENT(EVT_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent);
|
||||||
|
|
||||||
|
class ConfigOptionsGroup;
|
||||||
|
class ObjectManipulation;
|
||||||
|
class ObjectSettings;
|
||||||
|
class ObjectLayers;
|
||||||
|
class ObjectList;
|
||||||
|
class PlaterPresetComboBox;
|
||||||
|
class Plater;
|
||||||
|
|
||||||
|
enum class ActionButtonType : int {
|
||||||
|
abReslice,
|
||||||
|
abExport,
|
||||||
|
abSendGCode
|
||||||
|
};
|
||||||
|
|
||||||
|
class Sidebar : public wxPanel
|
||||||
|
{
|
||||||
|
ConfigOptionMode m_mode{ConfigOptionMode::comSimple};
|
||||||
|
public:
|
||||||
|
Sidebar(Plater *parent);
|
||||||
|
Sidebar(Sidebar &&) = delete;
|
||||||
|
Sidebar(const Sidebar &) = delete;
|
||||||
|
Sidebar &operator=(Sidebar &&) = delete;
|
||||||
|
Sidebar &operator=(const Sidebar &) = delete;
|
||||||
|
~Sidebar();
|
||||||
|
|
||||||
|
void init_filament_combo(PlaterPresetComboBox **combo, const int extr_idx);
|
||||||
|
void remove_unused_filament_combos(const size_t current_extruder_count);
|
||||||
|
void update_all_preset_comboboxes();
|
||||||
|
void update_presets(Preset::Type preset_type);
|
||||||
|
void update_mode_sizer() const;
|
||||||
|
void change_top_border_for_mode_sizer(bool increase_border);
|
||||||
|
void update_reslice_btn_tooltip() const;
|
||||||
|
void msw_rescale();
|
||||||
|
void sys_color_changed();
|
||||||
|
void update_mode_markers();
|
||||||
|
|
||||||
|
ObjectManipulation* obj_manipul();
|
||||||
|
ObjectList* obj_list();
|
||||||
|
ObjectSettings* obj_settings();
|
||||||
|
ObjectLayers* obj_layers();
|
||||||
|
wxScrolledWindow* scrolled_panel();
|
||||||
|
wxPanel* presets_panel();
|
||||||
|
|
||||||
|
ConfigOptionsGroup* og_freq_chng_params(const bool is_fff);
|
||||||
|
wxButton* get_wiping_dialog_button();
|
||||||
|
void update_objects_list_extruder_column(size_t extruders_count);
|
||||||
|
void show_info_sizer();
|
||||||
|
void show_sliced_info_sizer(const bool show);
|
||||||
|
void update_sliced_info_sizer();
|
||||||
|
void enable_buttons(bool enable);
|
||||||
|
void set_btn_label(const ActionButtonType btn_type, const wxString& label) const;
|
||||||
|
bool show_reslice(bool show) const;
|
||||||
|
bool show_export(bool show) const;
|
||||||
|
bool show_send(bool show) const;
|
||||||
|
bool show_eject(bool show)const;
|
||||||
|
bool show_export_removable(bool show) const;
|
||||||
|
bool get_eject_shown() const;
|
||||||
|
bool is_multifilament();
|
||||||
|
void update_mode();
|
||||||
|
bool is_collapsed();
|
||||||
|
void collapse(bool collapse);
|
||||||
|
void update_ui_from_settings();
|
||||||
|
|
||||||
|
#ifdef _MSW_DARK_MODE
|
||||||
|
void show_mode_sizer(bool show);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::vector<PlaterPresetComboBox*>& combos_filament();
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct priv;
|
||||||
|
std::unique_ptr<priv> p;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace GUI
|
||||||
|
} // namespace Slic3r
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user