mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-24 09:11:23 -06:00
Correct show_preset_comboboxes
This commit is contained in:
parent
709b898eba
commit
da16b28c14
6 changed files with 80 additions and 22 deletions
|
|
@ -38,6 +38,7 @@ wxString double_to_string(double const value);
|
|||
|
||||
class MyButton : public wxButton
|
||||
{
|
||||
bool hidden = false; // never show button if it's hidden ones
|
||||
public:
|
||||
MyButton() {}
|
||||
MyButton(wxWindow* parent, wxWindowID id, const wxString& label = wxEmptyString,
|
||||
|
|
@ -52,6 +53,12 @@ public:
|
|||
// overridden from wxWindow base class
|
||||
virtual bool
|
||||
AcceptsFocusFromKeyboard() const { return false; }
|
||||
|
||||
virtual bool Show(bool show = true) override {
|
||||
if (!show)
|
||||
hidden = true;
|
||||
return wxButton::Show(!hidden);
|
||||
}
|
||||
};
|
||||
|
||||
class Field {
|
||||
|
|
|
|||
|
|
@ -507,8 +507,7 @@ void create_preset_tabs(bool no_controller, int event_value_change, int event_pr
|
|||
add_created_tab(new TabPrinter (g_wxTabPanel, no_controller));
|
||||
for (size_t i = 0; i < g_wxTabPanel->GetPageCount(); ++ i) {
|
||||
Tab *tab = dynamic_cast<Tab*>(g_wxTabPanel->GetPage(i));
|
||||
if (! tab ||
|
||||
tab->GetName() == "sla_material")// ys_FIXME don't set event till doesn't exist material_preset combobox on plater
|
||||
if (! tab )
|
||||
continue;
|
||||
tab->set_event_value_change(wxEventType(event_value_change));
|
||||
tab->set_event_presets_changed(wxEventType(event_presets_changed));
|
||||
|
|
@ -654,7 +653,7 @@ void add_created_tab(Tab* panel)
|
|||
g_FilamentTab = panel;
|
||||
add_panel = g_PresetBundle->printers.get_edited_preset().printer_technology() == ptFFF;
|
||||
}
|
||||
else if (tab_name == "sla_material") {
|
||||
else if (tab_name == "material") {
|
||||
g_MaterialTab = panel;
|
||||
add_panel = g_PresetBundle->printers.get_edited_preset().printer_technology() == ptSLA;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -567,6 +567,8 @@ void Tab::update_dirty(){
|
|||
|
||||
void Tab::update_tab_ui()
|
||||
{
|
||||
// if (this == nullptr)
|
||||
// return; // ys_FIXME
|
||||
m_selected_preset_item = m_presets->update_tab_ui(m_presets_choice, m_show_incompatible_presets);
|
||||
// update_tab_presets(m_cc_presets_choice, m_show_incompatible_presets);
|
||||
// update_presetsctrl(m_presetctrl, m_show_incompatible_presets);
|
||||
|
|
@ -576,6 +578,8 @@ void Tab::update_tab_ui()
|
|||
// This could be used for example by setting a Wipe Tower position by interactive manipulation in the 3D view.
|
||||
void Tab::load_config(const DynamicPrintConfig& config)
|
||||
{
|
||||
// if (this == nullptr)
|
||||
// return; // ys_FIXME
|
||||
bool modified = 0;
|
||||
for(auto opt_key : m_config->diff(config)) {
|
||||
m_config->set_key_value(opt_key, config.option(opt_key)->clone());
|
||||
|
|
@ -650,6 +654,15 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
int val = boost::any_cast<size_t>(value);
|
||||
event.SetInt(val);
|
||||
}
|
||||
|
||||
if (opt_key == "printer_technology")
|
||||
{
|
||||
int val = boost::any_cast<PrinterTechnology>(value);
|
||||
event.SetInt(val);
|
||||
g_wxMainFrame->ProcessWindowEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
g_wxMainFrame->ProcessWindowEvent(event);
|
||||
}
|
||||
if (opt_key == "fill_density")
|
||||
|
|
@ -701,9 +714,11 @@ void Tab::update_wiping_button_visibility() {
|
|||
// to uddate number of "filament" selection boxes when the number of extruders change.
|
||||
void Tab::on_presets_changed()
|
||||
{
|
||||
if (get_preset_bundle()->printers.get_selected_preset().printer_technology() == ptSLA)
|
||||
return; // ys_FIXME
|
||||
if (m_event_presets_changed > 0) {
|
||||
// if (get_preset_bundle()->printers.get_selected_preset().printer_technology() == ptSLA)
|
||||
// return;
|
||||
if (m_event_presets_changed > 0
|
||||
&& get_preset_bundle()->printers.get_selected_preset().printer_technology() != ptSLA // ys_FIXME
|
||||
) {
|
||||
wxCommandEvent event(m_event_presets_changed);
|
||||
event.SetString(m_name);
|
||||
g_wxMainFrame->ProcessWindowEvent(event);
|
||||
|
|
@ -1420,6 +1435,8 @@ void TabPrinter::build()
|
|||
m_printer_technology = m_presets->get_selected_preset().printer_technology();
|
||||
|
||||
m_presets->get_selected_preset().printer_technology() == ptSLA ? build_sla() : build_fff();
|
||||
|
||||
// on_value_change("printer_technology", m_printer_technology); // to update show/hide preset ComboBoxes
|
||||
}
|
||||
|
||||
void TabPrinter::build_fff()
|
||||
|
|
@ -1987,6 +2004,8 @@ void TabPrinter::update_pages()
|
|||
m_pages_sla.empty() ? build_sla() : m_pages.swap(m_pages_sla);
|
||||
|
||||
rebuild_page_tree(true);
|
||||
|
||||
on_value_change("printer_technology", m_presets->get_edited_preset().printer_technology()); // to update show/hide preset ComboBoxes
|
||||
}
|
||||
|
||||
void TabPrinter::update()
|
||||
|
|
@ -2112,7 +2131,7 @@ void Tab::load_current_preset()
|
|||
|
||||
m_bmp_non_system = m_presets->get_selected_preset_parent() ? &m_bmp_value_unlock : &m_bmp_white_bullet;
|
||||
m_ttg_non_system = m_presets->get_selected_preset_parent() ? &m_ttg_value_unlock : &m_ttg_white_bullet_ns;
|
||||
m_tt_non_system = m_presets->get_selected_preset_parent() ? &m_tt_value_unlock : &m_ttg_white_bullet_ns;
|
||||
m_tt_non_system = m_presets->get_selected_preset_parent() ? &m_tt_value_unlock : &m_ttg_white_bullet_ns;
|
||||
|
||||
m_undo_to_sys_btn->Enable(!preset.is_default);
|
||||
|
||||
|
|
@ -2235,7 +2254,8 @@ void Tab::select_preset(std::string preset_name /*= ""*/)
|
|||
std::vector<PresetUpdate> updates = {
|
||||
{ "print", &m_preset_bundle->prints, ptFFF },
|
||||
{ "filament", &m_preset_bundle->filaments, ptFFF },
|
||||
{ "sla_materials", &m_preset_bundle->sla_materials, ptSLA }
|
||||
{ "sla_materials", &m_preset_bundle->sla_materials, ptSLA }
|
||||
// { "material", &m_preset_bundle->sla_materials, ptSLA }
|
||||
};
|
||||
for (PresetUpdate &pu : updates) {
|
||||
pu.old_preset_dirty = (old_printer_technology == pu.technology) && pu.presets->current_is_dirty();
|
||||
|
|
@ -2974,7 +2994,8 @@ void TabSLAMaterial::build()
|
|||
|
||||
void TabSLAMaterial::update()
|
||||
{
|
||||
|
||||
if (get_preset_bundle()->printers.get_selected_preset().printer_technology() == ptFFF)
|
||||
return; // ys_FIXME
|
||||
}
|
||||
|
||||
} // GUI
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ class TabSLAMaterial : public Tab
|
|||
public:
|
||||
TabSLAMaterial() {}
|
||||
TabSLAMaterial(wxNotebook* parent, bool no_controller) :
|
||||
Tab(parent, _(L("SLA Material Settings")), "sla_material", no_controller) {}
|
||||
Tab(parent, _(L("SLA Material Settings")), "material", no_controller) {}
|
||||
~TabSLAMaterial(){}
|
||||
|
||||
void build() override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue