Updated view mode for object_list and object_menu
This commit is contained in:
parent
dbcf800353
commit
9b8cdb95dc
5 changed files with 51 additions and 35 deletions
|
@ -159,7 +159,7 @@ bool GUI_App::OnInit()
|
|||
|
||||
// ! Temporary workaround for the correct behavior of the Scrolled sidebar panel
|
||||
// Do this "manipulations" only once ( after (re)create of the application )
|
||||
if (sidebar().obj_list()->GetMinHeight() > 200)
|
||||
if (plater_ && sidebar().obj_list()->GetMinHeight() > 200)
|
||||
{
|
||||
wxWindowUpdateLocker noUpdates_sidebar(&sidebar());
|
||||
sidebar().obj_list()->SetMinSize(wxSize(-1, 200));
|
||||
|
@ -273,6 +273,11 @@ void GUI_App::recreate_GUI()
|
|||
std::cerr << "recreate_GUI" << std::endl;
|
||||
|
||||
clear_tabs_list();
|
||||
if (plater_) {
|
||||
// before creating a new plater let's delete old one
|
||||
plater_->Destroy();
|
||||
plater_ = nullptr;
|
||||
}
|
||||
|
||||
MainFrame* topwindow = dynamic_cast<MainFrame*>(GetTopWindow());
|
||||
mainframe = new MainFrame();
|
||||
|
@ -531,10 +536,11 @@ void GUI_App::update_mode()
|
|||
|
||||
const ConfigOptionMode mode = wxGetApp().get_mode();
|
||||
|
||||
obj_list()->get_sizer()->Show(mode == comExpert);
|
||||
obj_list()->get_sizer()->Show(mode > comSimple);
|
||||
sidebar().set_mode_value(mode);
|
||||
// sidebar().show_buttons(mode == comExpert);
|
||||
obj_list()->update_selections();
|
||||
obj_list()->update_object_menu();
|
||||
|
||||
sidebar().update_mode_sizer(mode);
|
||||
|
||||
|
|
|
@ -696,9 +696,11 @@ void ObjectList::get_settings_choice(const wxString& category_name)
|
|||
void ObjectList::append_menu_item_add_generic(wxMenuItem* menu, const int type) {
|
||||
auto sub_menu = new wxMenu;
|
||||
|
||||
if (wxGetApp().get_mode() == comExpert) {
|
||||
append_menu_item(sub_menu, wxID_ANY, _(L("Load")) + " " + dots, "",
|
||||
[this, type](wxCommandEvent&) { load_subobject(type); }, "", menu->GetMenu());
|
||||
sub_menu->AppendSeparator();
|
||||
}
|
||||
|
||||
std::vector<std::string> menu_items = { L("Box"), L("Cylinder"), L("Sphere"), L("Slab") };
|
||||
for (auto& item : menu_items) {
|
||||
|
@ -709,7 +711,7 @@ void ObjectList::append_menu_item_add_generic(wxMenuItem* menu, const int type)
|
|||
menu->SetSubMenu(sub_menu);
|
||||
}
|
||||
|
||||
void ObjectList::append_menu_items_add_volume(wxMenu* menu)
|
||||
void ObjectList::append_menu_items_add_volume(wxMenu* menu, wxMenuItem* *item_separator)
|
||||
{
|
||||
// Note: id accords to type of the sub-object, so sequence of the menu items is important
|
||||
std::vector<std::string> menu_object_types_items = {L("Add part"), // ~ModelVolume::MODEL_PART
|
||||
|
@ -723,22 +725,30 @@ void ObjectList::append_menu_items_add_volume(wxMenu* menu)
|
|||
if (settings_id != wxNOT_FOUND)
|
||||
menu->Destroy(settings_id);
|
||||
}
|
||||
if (*item_separator)
|
||||
menu->Destroy(*item_separator);
|
||||
|
||||
if (wxGetApp().get_mode() == comSimple)
|
||||
const ConfigOptionMode mode = wxGetApp().get_mode();
|
||||
|
||||
if (mode < comExpert)
|
||||
{
|
||||
append_menu_item(menu, wxID_ANY, _(L("Add part")), "",
|
||||
[this](wxCommandEvent&) { load_subobject(ModelVolume::MODEL_PART); }, *m_bmp_vector[ModelVolume::MODEL_PART]);
|
||||
}
|
||||
if (mode == comSimple) {
|
||||
append_menu_item(menu, wxID_ANY, _(L("Add support enforcer")), "",
|
||||
[this](wxCommandEvent&) { load_generic_subobject(_(L("Box")).ToUTF8().data(), ModelVolume::SUPPORT_ENFORCER); },
|
||||
[this](wxCommandEvent&) { load_generic_subobject(_(L("Box")).ToUTF8().data(), ModelVolume::SUPPORT_ENFORCER); },
|
||||
*m_bmp_vector[ModelVolume::SUPPORT_ENFORCER]);
|
||||
append_menu_item(menu, wxID_ANY, _(L("Add support blocker")), "",
|
||||
[this](wxCommandEvent&) { load_generic_subobject(_(L("Box")).ToUTF8().data(), ModelVolume::SUPPORT_BLOCKER); },
|
||||
[this](wxCommandEvent&) { load_generic_subobject(_(L("Box")).ToUTF8().data(), ModelVolume::SUPPORT_BLOCKER); },
|
||||
*m_bmp_vector[ModelVolume::SUPPORT_BLOCKER]);
|
||||
|
||||
*item_separator = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (int type = 0; type < menu_object_types_items.size(); type++)
|
||||
|
||||
for (int type = mode == comExpert ? 0 : 1 ; type < menu_object_types_items.size(); type++)
|
||||
{
|
||||
auto& item = menu_object_types_items[type];
|
||||
|
||||
|
@ -748,6 +758,8 @@ void ObjectList::append_menu_items_add_volume(wxMenu* menu)
|
|||
|
||||
menu->Append(menu_item);
|
||||
}
|
||||
|
||||
*item_separator = menu->AppendSeparator();
|
||||
}
|
||||
|
||||
wxMenuItem* ObjectList::append_menu_item_split(wxMenu* menu)
|
||||
|
@ -793,18 +805,19 @@ wxMenuItem* ObjectList::append_menu_item_instance_to_object(wxMenu* menu)
|
|||
|
||||
void ObjectList::create_object_popupmenu(wxMenu *menu)
|
||||
{
|
||||
append_menu_items_add_volume(menu);
|
||||
|
||||
// Split object to parts
|
||||
menu->AppendSeparator();
|
||||
m_menu_item_split = append_menu_item_split(menu);
|
||||
|
||||
// Settings
|
||||
menu->AppendSeparator();
|
||||
|
||||
// rest of a object_menu will be added later in:
|
||||
// - append_menu_items_add_volume() -> for "Add (volumes)"
|
||||
// - append_menu_item_settings() -> for "Add (settings)"
|
||||
}
|
||||
|
||||
void ObjectList::create_sla_object_popupmenu(wxMenu *menu)
|
||||
{
|
||||
// rest of a object_sla_menu will be added later in:
|
||||
// - append_menu_item_settings() -> for "Add (settings)"
|
||||
}
|
||||
|
||||
void ObjectList::create_part_popupmenu(wxMenu *menu)
|
||||
|
@ -1805,6 +1818,11 @@ void ObjectList::update_settings_items()
|
|||
UnselectAll();
|
||||
}
|
||||
|
||||
void ObjectList::update_object_menu()
|
||||
{
|
||||
append_menu_items_add_volume(&m_menu_object, &m_mi_volumes_settings_separator);
|
||||
}
|
||||
|
||||
void ObjectList::instances_to_separated_object(const int obj_idx, const std::set<int>& inst_idxs)
|
||||
{
|
||||
// create new object from selected instance
|
||||
|
|
|
@ -112,6 +112,7 @@ class ObjectList : public wxDataViewCtrl
|
|||
wxMenuItem* m_menu_item_split_part { nullptr };
|
||||
wxMenuItem* m_menu_item_settings { nullptr };
|
||||
wxMenuItem* m_menu_item_split_instances { nullptr };
|
||||
wxMenuItem* m_mi_volumes_settings_separator { nullptr };
|
||||
|
||||
std::vector<wxBitmap*> m_bmp_vector;
|
||||
|
||||
|
@ -162,7 +163,7 @@ public:
|
|||
|
||||
void get_settings_choice(const wxString& category_name);
|
||||
void append_menu_item_add_generic(wxMenuItem* menu, const int type);
|
||||
void append_menu_items_add_volume(wxMenu* menu);
|
||||
void append_menu_items_add_volume(wxMenu* menu, wxMenuItem* *item_separator);
|
||||
wxMenuItem* append_menu_item_split(wxMenu* menu);
|
||||
wxMenuItem* append_menu_item_settings(wxMenu* menu);
|
||||
wxMenuItem* append_menu_item_change_type(wxMenu* menu);
|
||||
|
@ -243,6 +244,7 @@ public:
|
|||
void last_volume_is_deleted(const int obj_idx);
|
||||
bool has_multi_part_objects();
|
||||
void update_settings_items();
|
||||
void update_object_menu();
|
||||
|
||||
void instances_to_separated_object(const int obj_idx, const std::set<int>& inst_idx);
|
||||
void split_instances();
|
||||
|
|
|
@ -121,11 +121,6 @@ void MainFrame::init_tabpanel()
|
|||
}
|
||||
});
|
||||
|
||||
if (wxGetApp().plater_) {
|
||||
// before creating a new plater let's delete old one
|
||||
wxGetApp().plater_->Destroy();
|
||||
wxGetApp().plater_ = nullptr;
|
||||
}
|
||||
m_plater = new Slic3r::GUI::Plater(m_tabpanel, this);
|
||||
wxGetApp().plater_ = m_plater;
|
||||
m_tabpanel->AddPage(m_plater, _(L("Plater")));
|
||||
|
|
|
@ -940,6 +940,8 @@ struct Plater::priv
|
|||
// SLA-Object popup menu
|
||||
wxMenu sla_object_menu;
|
||||
|
||||
wxMenuItem* separator_volumes_settings{ nullptr };
|
||||
|
||||
// Data
|
||||
Slic3r::DynamicPrintConfig *config; // FIXME: leak?
|
||||
Slic3r::Print fff_print;
|
||||
|
@ -2312,7 +2314,7 @@ void Plater::priv::on_right_click(Vec2dEvent& evt)
|
|||
return;
|
||||
|
||||
wxMenu* menu = printer_technology == ptSLA ? &sla_object_menu :
|
||||
get_selection().is_single_full_instance/*object*/() ? // show "Object menu" for each FullInstance instead of FullObject
|
||||
get_selection().is_single_full_instance() ? // show "Object menu" for each FullInstance instead of FullObject
|
||||
&object_menu : &part_menu;
|
||||
|
||||
sidebar->obj_list()->append_menu_item_settings(menu);
|
||||
|
@ -2425,18 +2427,9 @@ bool Plater::priv::complit_init_object_menu()
|
|||
[this](wxCommandEvent&) { split_volume(); }, "shape_ungroup_p.png", &object_menu);
|
||||
|
||||
wxMenuItem* item_split = append_submenu(&object_menu, split_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object")), "shape_ungroup.png");
|
||||
|
||||
// append_menu_item(&object_menu, wxID_ANY, _(L("Reload from Disk")), _(L("Reload the selected file from Disk")),
|
||||
// [this](wxCommandEvent&) { reload_from_disk(); });
|
||||
//
|
||||
// append_menu_item(&object_menu, wxID_ANY, _(L("Export object as STL")) + dots, _(L("Export this single object as STL file")),
|
||||
// [this](wxCommandEvent&) { q->export_stl(true); });
|
||||
|
||||
// Append "Add..." popupmenu
|
||||
object_menu.AppendSeparator();
|
||||
sidebar->obj_list()->append_menu_items_add_volume(&object_menu);
|
||||
|
||||
// object_menu.AppendSeparator();
|
||||
// "Add (volumes)" popupmenu will be added later in append_menu_items_add_volume()
|
||||
|
||||
// ui updates needs to be binded to the parent panel
|
||||
if (q != nullptr)
|
||||
|
@ -2453,11 +2446,13 @@ bool Plater::priv::complit_init_sla_object_menu()
|
|||
wxMenuItem* item_split = append_menu_item(&sla_object_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object into individual objects")),
|
||||
[this](wxCommandEvent&) { split_object(); }, "shape_ungroup_o.png");
|
||||
|
||||
sla_object_menu.AppendSeparator();
|
||||
|
||||
// Add the automatic rotation sub-menu
|
||||
append_menu_item(&sla_object_menu, wxID_ANY, _(L("Optimize orientation")), _(L("Optimize the rotation of the object for better print results.")),
|
||||
[this](wxCommandEvent&) { sla_optimize_rotation(); });
|
||||
|
||||
// sla_object_menu.AppendSeparator();
|
||||
sla_object_menu.AppendSeparator();
|
||||
|
||||
// ui updates needs to be binded to the parent panel
|
||||
if (q != nullptr)
|
||||
|
@ -2473,10 +2468,12 @@ bool Plater::priv::complit_init_part_menu()
|
|||
wxMenuItem* item_split = append_menu_item(&part_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object into individual sub-parts")),
|
||||
[this](wxCommandEvent&) { split_volume(); }, "shape_ungroup_p.png");
|
||||
|
||||
part_menu.AppendSeparator();
|
||||
|
||||
auto obj_list = sidebar->obj_list();
|
||||
obj_list->append_menu_item_change_type(&part_menu);
|
||||
|
||||
// part_menu.AppendSeparator();
|
||||
part_menu.AppendSeparator();
|
||||
|
||||
// ui updates needs to be binded to the parent panel
|
||||
if (q != nullptr)
|
||||
|
@ -2578,8 +2575,6 @@ bool Plater::priv::can_split_to_volumes() const
|
|||
|
||||
bool Plater::priv::can_split() const
|
||||
{
|
||||
if (printer_technology == ptSLA)
|
||||
return false;
|
||||
return sidebar->obj_list()->is_splittable();
|
||||
}
|
||||
|
||||
|
@ -2606,7 +2601,7 @@ bool Plater::priv::can_mirror() const
|
|||
|
||||
void Plater::priv::update_object_menu()
|
||||
{
|
||||
sidebar->obj_list()->append_menu_items_add_volume(&object_menu);
|
||||
sidebar->obj_list()->append_menu_items_add_volume(&object_menu, &separator_volumes_settings);
|
||||
}
|
||||
|
||||
// Plater / Public
|
||||
|
|
Loading…
Reference in a new issue