mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-10 08:17:51 -06:00
Fixes "Add instance" and "Remove instance" hotkeys don't work when object is selected via de object browser #5350
Captures the +- hotkeys in the object list to add / remove an instance.
This commit is contained in:
parent
a6dd6d617e
commit
6fe0b09a04
2 changed files with 22 additions and 2 deletions
|
@ -191,7 +191,7 @@ ObjectList::ObjectList(wxWindow* parent) :
|
||||||
// Bind(wxEVT_KEY_DOWN, &ObjectList::OnChar, this);
|
// Bind(wxEVT_KEY_DOWN, &ObjectList::OnChar, this);
|
||||||
{
|
{
|
||||||
// Accelerators
|
// Accelerators
|
||||||
wxAcceleratorEntry entries[8];
|
wxAcceleratorEntry entries[10];
|
||||||
entries[0].Set(wxACCEL_CTRL, (int) 'C', wxID_COPY);
|
entries[0].Set(wxACCEL_CTRL, (int) 'C', wxID_COPY);
|
||||||
entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_CUT);
|
entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_CUT);
|
||||||
entries[2].Set(wxACCEL_CTRL, (int) 'V', wxID_PASTE);
|
entries[2].Set(wxACCEL_CTRL, (int) 'V', wxID_PASTE);
|
||||||
|
@ -200,7 +200,9 @@ ObjectList::ObjectList(wxWindow* parent) :
|
||||||
entries[5].Set(wxACCEL_CTRL, (int) 'Y', wxID_REDO);
|
entries[5].Set(wxACCEL_CTRL, (int) 'Y', wxID_REDO);
|
||||||
entries[6].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_DELETE);
|
entries[6].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_DELETE);
|
||||||
entries[7].Set(wxACCEL_NORMAL, WXK_BACK, wxID_DELETE);
|
entries[7].Set(wxACCEL_NORMAL, WXK_BACK, wxID_DELETE);
|
||||||
wxAcceleratorTable accel(8, entries);
|
entries[8].Set(wxACCEL_NORMAL, int('+'), wxID_ADD);
|
||||||
|
entries[9].Set(wxACCEL_NORMAL, int('-'), wxID_REMOVE);
|
||||||
|
wxAcceleratorTable accel(10, entries);
|
||||||
SetAcceleratorTable(accel);
|
SetAcceleratorTable(accel);
|
||||||
|
|
||||||
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->copy(); }, wxID_COPY);
|
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->copy(); }, wxID_COPY);
|
||||||
|
@ -209,6 +211,8 @@ ObjectList::ObjectList(wxWindow* parent) :
|
||||||
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->remove(); }, wxID_DELETE);
|
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->remove(); }, wxID_DELETE);
|
||||||
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->undo(); }, wxID_UNDO);
|
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->undo(); }, wxID_UNDO);
|
||||||
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->redo(); }, wxID_REDO);
|
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->redo(); }, wxID_REDO);
|
||||||
|
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->increase_instance(); }, wxID_ADD);
|
||||||
|
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->decrease_instance(); }, wxID_REMOVE);
|
||||||
}
|
}
|
||||||
#else //__WXOSX__
|
#else //__WXOSX__
|
||||||
Bind(wxEVT_CHAR, [this](wxKeyEvent& event) { key_event(event); }); // doesn't work on OSX
|
Bind(wxEVT_CHAR, [this](wxKeyEvent& event) { key_event(event); }); // doesn't work on OSX
|
||||||
|
@ -1092,6 +1096,16 @@ void ObjectList::redo()
|
||||||
wxGetApp().plater()->redo();
|
wxGetApp().plater()->redo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectList::increase_instances()
|
||||||
|
{
|
||||||
|
wxGetApp().plater()->increase_instances(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectList::decrease_instances()
|
||||||
|
{
|
||||||
|
wxGetApp().plater()->decrease_instances(1);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef __WXOSX__
|
#ifndef __WXOSX__
|
||||||
void ObjectList::key_event(wxKeyEvent& event)
|
void ObjectList::key_event(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
|
@ -1116,6 +1130,10 @@ void ObjectList::key_event(wxKeyEvent& event)
|
||||||
redo();
|
redo();
|
||||||
else if (wxGetKeyState(wxKeyCode('Z')) && wxGetKeyState(WXK_CONTROL))
|
else if (wxGetKeyState(wxKeyCode('Z')) && wxGetKeyState(WXK_CONTROL))
|
||||||
undo();
|
undo();
|
||||||
|
else if (event.GetUnicodeKey() == '+')
|
||||||
|
increase_instances();
|
||||||
|
else if (event.GetUnicodeKey() == '-')
|
||||||
|
decrease_instances();
|
||||||
else
|
else
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,6 +257,8 @@ public:
|
||||||
bool paste_from_clipboard();
|
bool paste_from_clipboard();
|
||||||
void undo();
|
void undo();
|
||||||
void redo();
|
void redo();
|
||||||
|
void increase_instances();
|
||||||
|
void decrease_instances();
|
||||||
|
|
||||||
void get_settings_choice(const wxString& category_name);
|
void get_settings_choice(const wxString& category_name);
|
||||||
void get_freq_settings_choice(const wxString& bundle_name);
|
void get_freq_settings_choice(const wxString& bundle_name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue