Added menu item for the "Fix through the Netfabb"

This commit is contained in:
YuSanka 2019-01-30 16:27:07 +01:00
parent eec289961a
commit a5ec951180
4 changed files with 42 additions and 8 deletions

View File

@ -952,10 +952,20 @@ wxMenuItem* ObjectList::append_menu_item_instance_to_object(wxMenu* menu)
[this](wxCommandEvent&) { split_instances(); }, "", menu);
}
wxMenuItem* ObjectList::append_menu_item_rename(wxMenu* menu)
void ObjectList::append_menu_item_rename(wxMenu* menu)
{
return append_menu_item(menu, wxID_ANY, _(L("Rename")), "",
append_menu_item(menu, wxID_ANY, _(L("Rename")), "",
[this](wxCommandEvent&) { rename_item(); }, "", menu);
menu->AppendSeparator();
}
void ObjectList::append_menu_item_fix_through_netfabb(wxMenu* menu)
{
if (!is_windows10())
return;
append_menu_item(menu, wxID_ANY, _(L("Fix through the Netfabb")), "",
[this](wxCommandEvent&) { fix_through_netfabb(); }, "", menu);
menu->AppendSeparator();
}
void ObjectList::create_object_popupmenu(wxMenu *menu)
@ -964,6 +974,8 @@ void ObjectList::create_object_popupmenu(wxMenu *menu)
append_menu_item_rename(menu);
#endif // __WXOSX__
append_menu_item_fix_through_netfabb(menu);
// Split object to parts
m_menu_item_split = append_menu_item_split(menu);
menu->AppendSeparator();
@ -981,6 +993,8 @@ void ObjectList::create_sla_object_popupmenu(wxMenu *menu)
#ifdef __WXOSX__
append_menu_item_rename(menu);
#endif // __WXOSX__
append_menu_item_fix_through_netfabb(menu);
// rest of a object_sla_menu will be added later in:
// - append_menu_item_settings() -> for "Add (settings)"
}
@ -991,6 +1005,8 @@ void ObjectList::create_part_popupmenu(wxMenu *menu)
append_menu_item_rename(menu);
#endif // __WXOSX__
append_menu_item_fix_through_netfabb(menu);
m_menu_item_split_part = append_menu_item_split(menu);
// Append change part type
@ -2111,6 +2127,21 @@ void ObjectList::rename_item()
update_name_in_model(item);
}
void ObjectList::fix_through_netfabb() const
{
const wxDataViewItem item = GetSelection();
if (!item)
return;
ItemType type = m_objects_model->GetItemType(item);
if (type & itObject)
wxGetApp().plater()->fix_through_netfabb(m_objects_model->GetIdByItem(item));
else if (type & itVolume)
wxGetApp().plater()->fix_through_netfabb(m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item)),
m_objects_model->GetVolumeIdByItem(item));
}
void ObjectList::ItemValueChanged(wxDataViewEvent &event)
{
if (event.GetColumn() == 0)

View File

@ -179,7 +179,8 @@ public:
wxMenuItem* append_menu_item_settings(wxMenu* menu);
wxMenuItem* append_menu_item_change_type(wxMenu* menu);
wxMenuItem* append_menu_item_instance_to_object(wxMenu* menu);
wxMenuItem* append_menu_item_rename(wxMenu* menu);
void append_menu_item_rename(wxMenu* menu);
void append_menu_item_fix_through_netfabb(wxMenu* menu);
void create_object_popupmenu(wxMenu *menu);
void create_sla_object_popupmenu(wxMenu*menu);
void create_part_popupmenu(wxMenu*menu);
@ -262,7 +263,7 @@ public:
void instances_to_separated_object(const int obj_idx, const std::set<int>& inst_idx);
void split_instances();
void rename_item();
void fix_through_netfabb() const;
private:
void OnChar(wxKeyEvent& event);
void OnContextMenu(wxDataViewEvent &event);

View File

@ -1031,7 +1031,7 @@ struct Plater::priv
void update_restart_background_process(bool force_scene_update, bool force_preview_update);
void export_gcode(fs::path output_path, PrintHostJob upload_job);
void reload_from_disk();
void fix_through_netfabb(const int obj_idx);
void fix_through_netfabb(const int obj_idx, const int vol_idx = -1);
void set_current_panel(wxPanel* panel);
@ -2106,7 +2106,7 @@ void Plater::priv::reload_from_disk()
remove(obj_orig_idx);
}
void Plater::priv::fix_through_netfabb(const int obj_idx)
void Plater::priv::fix_through_netfabb(const int obj_idx, const int vol_idx/* = -1*/)
{
if (obj_idx < 0)
return;
@ -2440,6 +2440,8 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/
}
menu->AppendSeparator();
sidebar->obj_list()->append_menu_item_fix_through_netfabb(menu);
wxMenu* mirror_menu = new wxMenu();
if (mirror_menu == nullptr)
return false;
@ -3150,7 +3152,7 @@ void Plater::changed_object(int obj_idx)
this->p->schedule_background_process();
}
void Plater::fix_through_netfabb(const int obj_idx) { p->fix_through_netfabb(obj_idx); }
void Plater::fix_through_netfabb(const int obj_idx, const int vol_idx/* = -1*/) { p->fix_through_netfabb(obj_idx, vol_idx); }
void Plater::update_object_menu() { p->update_object_menu(); }

View File

@ -147,7 +147,7 @@ public:
void export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path());
void reslice();
void changed_object(int obj_idx);
void fix_through_netfabb(const int obj_idx);
void fix_through_netfabb(const int obj_idx, const int vol_idx = -1);
void send_gcode();
void on_extruders_change(int extruders_count);