diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 7914930f2..cadb3123f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2521,6 +2521,7 @@ void Sidebar::add_filament() { } void Sidebar::delete_filament(size_t filament_id, int replace_filament_id) { + if (is_new_project_in_gcode3mf()) { return; } if (p->combos_filament.size() <= 1) return; wxBusyCursor busy; size_t filament_count = p->combos_filament.size() - 1; @@ -2563,6 +2564,7 @@ void Sidebar::edit_filament() } void Sidebar::add_custom_filament(wxColour new_col) { + if (is_new_project_in_gcode3mf()) { return; } if (p->combos_filament.size() >= size_t(EnforcerBlockerType::ExtruderMax)) return; int filament_count = p->combos_filament.size() + 1; @@ -2575,6 +2577,27 @@ void Sidebar::add_custom_filament(wxColour new_col) { auto_calc_flushing_volumes(filament_count - 1); } +bool Sidebar::is_new_project_in_gcode3mf() +{ + if (p->plater->using_exported_file()) { + ConfirmBeforeSendDialog confirm_dlg(this, wxID_ANY, _L("Warning")); + bool is_cancle = true; + confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, &is_cancle](wxCommandEvent &e) { + is_cancle = false; + }); + confirm_dlg.update_btn_label(_L("Yes"), _L("No")); + auto filename = p->plater->get_preview_only_filename(); + + confirm_dlg.update_text(filename + " " + _L("will be closed before modify filament. Do you want to continue?")); + confirm_dlg.on_show(); + if (!is_cancle) { + p->plater->new_project(); + } + return is_cancle; + } + return false; +} + void Sidebar::on_bed_type_change(BedType bed_type) { // btDefault option is not included in global bed type setting @@ -7540,6 +7563,7 @@ void Plater::priv::on_combobox_select(wxCommandEvent &evt) if (combo && combo->is_drop_down()) { sidebar->update_soft_first_start_state(); } + if (q->sidebar().is_new_project_in_gcode3mf()) { return; } PlaterPresetComboBox* preset_combo_box = dynamic_cast(evt.GetEventObject()); if (preset_combo_box) { this->on_select_preset(evt); diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 582c62990..d7a75fb77 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -149,6 +149,7 @@ public: void change_filament(size_t from_id, size_t to_id); // 0 base void edit_filament(); void add_custom_filament(wxColour new_col); + bool is_new_project_in_gcode3mf(); // BBS void on_bed_type_change(BedType bed_type); void load_ams_list(std::string const & device, MachineObject* obj); diff --git a/src/slic3r/GUI/ReleaseNote.cpp b/src/slic3r/GUI/ReleaseNote.cpp index bfe1a26f4..c9ce330bc 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -1354,6 +1354,7 @@ void ConfirmBeforeSendDialog::on_show() m_button_ok->GetEventHandler()->ProcessEvent(evt_ok); wxMouseEvent evt_cancel(wxEVT_LEFT_UP); m_button_cancel->GetEventHandler()->ProcessEvent(evt_cancel); + CenterOnScreen(); this->ShowModal(); }