Added "Set number of copies…" to the context menu
This commit is contained in:
parent
965236a9d9
commit
cbb62142de
@ -20,6 +20,7 @@
|
||||
#include <wx/progdlg.h>
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/colordlg.h>
|
||||
#include <wx/numdlg.h>
|
||||
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
@ -2023,6 +2024,8 @@ bool Plater::priv::init_object_menu()
|
||||
[this](wxCommandEvent&){ q->increase_instances(); }, "add.png");
|
||||
wxMenuItem* item_decrease = append_menu_item(&object_menu, wxID_ANY, _(L("Decrease copies\t-")), _(L("Remove one copy of the selected object")),
|
||||
[this](wxCommandEvent&){ q->decrease_instances(); }, "delete.png");
|
||||
wxMenuItem* item_set_number_of_copies = append_menu_item(&object_menu, wxID_ANY, _(L("Set number of copies…")), _(L("Change the number of copies of the selected object")),
|
||||
[this](wxCommandEvent&){ q->set_number_of_copies(); }, "textfield.png");
|
||||
|
||||
object_menu.AppendSeparator();
|
||||
|
||||
@ -2062,6 +2065,7 @@ bool Plater::priv::init_object_menu()
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete_object()); }, item_delete->GetId());
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_increase->GetId());
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_decrease_instances()); }, item_decrease->GetId());
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_set_number_of_copies->GetId());
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_objects() || can_split_to_volumes()); }, item_split->GetId());
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_objects()); }, item_split_objects->GetId());
|
||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_volumes()); }, item_split_volumes->GetId());
|
||||
@ -2280,7 +2284,7 @@ void Plater::decrease_instances(size_t num)
|
||||
this->p->schedule_background_process();
|
||||
}
|
||||
|
||||
void Plater::set_number_of_copies(size_t num)
|
||||
void Plater::set_number_of_copies(/*size_t num*/)
|
||||
{
|
||||
#if ENABLE_EXTENDED_SELECTION
|
||||
int obj_idx = p->get_selected_object_idx();
|
||||
@ -2295,6 +2299,11 @@ void Plater::set_number_of_copies(size_t num)
|
||||
auto *model_object = p->model.objects[*obj_idx];
|
||||
#endif // ENABLE_EXTENDED_SELECTION
|
||||
|
||||
const auto num = wxGetNumberFromUser( " ", _("Enter the number of copies:"),
|
||||
_("Copies of the selected object"), model_object->instances.size(), 0, 1000, this );
|
||||
if (num < 0)
|
||||
return;
|
||||
|
||||
int diff = (int)num - (int)model_object->instances.size();
|
||||
if (diff > 0)
|
||||
increase_instances(diff);
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
void remove_selected();
|
||||
void increase_instances(size_t num = 1);
|
||||
void decrease_instances(size_t num = 1);
|
||||
void set_number_of_copies(size_t num);
|
||||
void set_number_of_copies(/*size_t num*/);
|
||||
|
||||
// Note: empty path means "use the default"
|
||||
void export_gcode(boost::filesystem::path output_path = boost::filesystem::path());
|
||||
|
@ -653,17 +653,6 @@ wxDataViewItem PrusaObjectDataViewModel::DeleteLastInstance(const wxDataViewItem
|
||||
ItemDeleted(inst_root_item, wxDataViewItem(last_instance_node));
|
||||
}
|
||||
|
||||
// for (int i = delete_inst_root_item ? 0 : inst_cnt - num; i < inst_cnt; ++i)
|
||||
// items.Add(wxDataViewItem(inst_root_node->GetNthChild(i)));
|
||||
//
|
||||
// if (delete_inst_root_item)
|
||||
// inst_root_node->GetChildren().RemoveAt(0, inst_cnt);
|
||||
// else {
|
||||
// ret_item = wxDataViewItem(inst_root_node->GetNthChild(inst_cnt - num - 1));
|
||||
// inst_root_node->GetChildren().RemoveAt(inst_cnt - num, num);
|
||||
// }
|
||||
|
||||
// ItemsDeleted(inst_root_item, items);
|
||||
if (delete_inst_root_item) {
|
||||
ret_item = parent_item;
|
||||
parent_node->GetChildren().Remove(inst_root_node);
|
||||
|
Loading…
Reference in New Issue
Block a user