diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 6296dcb375..e701fdfd3a 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2410,6 +2410,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; size_t filament_count = p->combos_filament.size() - 1; @@ -2452,6 +2453,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() >= MAXIMUM_EXTRUDER_NUMBER) return; int filament_count = p->combos_filament.size() + 1; @@ -2464,6 +2466,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 @@ -7448,6 +7471,7 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice) // BBS void Plater::priv::on_combobox_select(wxCommandEvent &evt) { + 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 337df26945..847bcfacae 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -161,6 +161,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 71480fe649..98c943733e 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -1360,6 +1360,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(); }