Implementation for #6216
* Implementation for #6216 - Make number keys select extruder when object treeview has focus + deleted unused extruder_selection() + Fixed notification after splitting of the solid object * Follow up85a10268b9
- OSX implementation + Added shortcuts description to the "Keyboard Shortcuts" dialog * Workaround to use "+/-" and numbers shortcuts on Linux + Fixed build on Linux * OSX specific: fixed a work of keyboard accelerators from numbers on NumPad keyboard * KBShortcutsDialog: fixed shortcuts for "Preferences" and "Show/Hide 3Dconnexion devices settings dialog, if enabled" under osx and "Set Printable/Unprintable" and "Set extruder" under Linux + OSX specific: Added minimize of the application on "Cmd+M" * Hot-fix for6efeb9d6b4
* Removed Linux specific workaround
This commit is contained in:
parent
13b0757b8b
commit
ab886e037b
7 changed files with 89 additions and 46 deletions
|
@ -2205,9 +2205,19 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (wxGetApp().app_config->get("use_legacy_3DConnexion") == "1") {
|
if (wxGetApp().app_config->get("use_legacy_3DConnexion") == "1") {
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
#ifdef __APPLE__
|
||||||
|
// On OSX use Cmd+Shift+M to "Show/Hide 3Dconnexion devices settings dialog"
|
||||||
|
if ((evt.GetModifiers() & shiftMask) != 0) {
|
||||||
|
#endif // __APPLE__
|
||||||
Mouse3DController& controller = wxGetApp().plater()->get_mouse3d_controller();
|
Mouse3DController& controller = wxGetApp().plater()->get_mouse3d_controller();
|
||||||
controller.show_settings_dialog(!controller.is_settings_dialog_shown());
|
controller.show_settings_dialog(!controller.is_settings_dialog_shown());
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
#ifdef __APPLE__
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// and Cmd+M to minimize application
|
||||||
|
wxGetApp().mainframe->Iconize();
|
||||||
|
#endif // __APPLE__
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
}
|
}
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
|
@ -146,7 +146,7 @@ ObjectList::ObjectList(wxWindow* parent) :
|
||||||
// Bind(wxEVT_KEY_DOWN, &ObjectList::OnChar, this);
|
// Bind(wxEVT_KEY_DOWN, &ObjectList::OnChar, this);
|
||||||
{
|
{
|
||||||
// Accelerators
|
// Accelerators
|
||||||
wxAcceleratorEntry entries[10];
|
wxAcceleratorEntry entries[33];
|
||||||
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);
|
||||||
|
@ -156,8 +156,18 @@ ObjectList::ObjectList(wxWindow* parent) :
|
||||||
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);
|
||||||
entries[8].Set(wxACCEL_NORMAL, int('+'), wxID_ADD);
|
entries[8].Set(wxACCEL_NORMAL, int('+'), wxID_ADD);
|
||||||
entries[9].Set(wxACCEL_NORMAL, int('-'), wxID_REMOVE);
|
entries[9].Set(wxACCEL_NORMAL, WXK_NUMPAD_ADD, wxID_ADD);
|
||||||
wxAcceleratorTable accel(10, entries);
|
entries[10].Set(wxACCEL_NORMAL, int('-'), wxID_REMOVE);
|
||||||
|
entries[11].Set(wxACCEL_NORMAL, WXK_NUMPAD_SUBTRACT, wxID_REMOVE);
|
||||||
|
entries[12].Set(wxACCEL_NORMAL, int('p'), wxID_PRINT);
|
||||||
|
|
||||||
|
int numbers_cnt = 1;
|
||||||
|
for (auto char_number : { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }) {
|
||||||
|
entries[12 + numbers_cnt].Set(wxACCEL_NORMAL, int(char_number), wxID_LAST + numbers_cnt);
|
||||||
|
entries[22 + numbers_cnt].Set(wxACCEL_NORMAL, WXK_NUMPAD0 + numbers_cnt - 1, wxID_LAST + numbers_cnt);
|
||||||
|
numbers_cnt++;
|
||||||
|
}
|
||||||
|
wxAcceleratorTable accel(33, 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);
|
||||||
|
@ -168,6 +178,13 @@ ObjectList::ObjectList(wxWindow* parent) :
|
||||||
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_instances(); }, wxID_ADD);
|
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->increase_instances(); }, wxID_ADD);
|
||||||
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->decrease_instances(); }, wxID_REMOVE);
|
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->decrease_instances(); }, wxID_REMOVE);
|
||||||
|
this->Bind(wxEVT_MENU, [this](wxCommandEvent &evt) { this->toggle_printable_state(); }, wxID_PRINT);
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
this->Bind(wxEVT_MENU, [this, i](wxCommandEvent &evt) {
|
||||||
|
if (extruders_count() > 1 && i <= extruders_count())
|
||||||
|
this->set_extruder_for_selected_items(i);
|
||||||
|
}, wxID_LAST+i+1);
|
||||||
}
|
}
|
||||||
#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
|
||||||
|
@ -1034,6 +1051,20 @@ void ObjectList::key_event(wxKeyEvent& event)
|
||||||
increase_instances();
|
increase_instances();
|
||||||
else if (event.GetUnicodeKey() == '-')
|
else if (event.GetUnicodeKey() == '-')
|
||||||
decrease_instances();
|
decrease_instances();
|
||||||
|
else if (event.GetUnicodeKey() == 'p')
|
||||||
|
toggle_printable_state();
|
||||||
|
else if (extruders_count() > 1) {
|
||||||
|
std::vector<wxChar> numbers = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||||
|
wxChar key_char = event.GetUnicodeKey();
|
||||||
|
if (std::find(numbers.begin(), numbers.end(), key_char) != numbers.end()) {
|
||||||
|
long extruder_number;
|
||||||
|
if (wxNumberFormatter::FromString(wxString(key_char), &extruder_number) &&
|
||||||
|
extruders_count() >= extruder_number)
|
||||||
|
set_extruder_for_selected_items(int(extruder_number));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
@ -3790,33 +3821,6 @@ void ObjectList::OnEditingDone(wxDataViewEvent &event)
|
||||||
plater->set_current_canvas_as_dirty();
|
plater->set_current_canvas_as_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectList::extruder_selection()
|
|
||||||
{
|
|
||||||
wxArrayString choices;
|
|
||||||
choices.Add(_(L("default")));
|
|
||||||
for (int i = 1; i <= extruders_count(); ++i)
|
|
||||||
choices.Add(wxString::Format("%d", i));
|
|
||||||
|
|
||||||
const wxString& selected_extruder = wxGetSingleChoice(_(L("Select extruder number:")),
|
|
||||||
_(L("This extruder will be set for selected items")),
|
|
||||||
choices, 0, this);
|
|
||||||
if (selected_extruder.IsEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
const int extruder_num = selected_extruder == _(L("default")) ? 0 : atoi(selected_extruder.c_str());
|
|
||||||
|
|
||||||
// /* Another variant for an extruder selection */
|
|
||||||
// extruder_num = wxGetNumberFromUser(_(L("Attention!!! \n"
|
|
||||||
// "It's a possibile to set an extruder number \n"
|
|
||||||
// "for whole Object(s) and/or object Part(s), \n"
|
|
||||||
// "not for an Instance. ")),
|
|
||||||
// _(L("Enter extruder number:")),
|
|
||||||
// _(L("This extruder will be set for selected items")),
|
|
||||||
// 1, 1, 5, this);
|
|
||||||
|
|
||||||
set_extruder_for_selected_items(extruder_num);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectList::set_extruder_for_selected_items(const int extruder) const
|
void ObjectList::set_extruder_for_selected_items(const int extruder) const
|
||||||
{
|
{
|
||||||
wxDataViewItemArray sels;
|
wxDataViewItemArray sels;
|
||||||
|
@ -3923,10 +3927,10 @@ void ObjectList::toggle_printable_state()
|
||||||
int inst_idx = type == itObject ? 0 : m_objects_model->GetInstanceIdByItem(frst_item);
|
int inst_idx = type == itObject ? 0 : m_objects_model->GetInstanceIdByItem(frst_item);
|
||||||
bool printable = !object(obj_idx)->instances[inst_idx]->printable;
|
bool printable = !object(obj_idx)->instances[inst_idx]->printable;
|
||||||
|
|
||||||
const wxString snapshot_text = sels.Count() > 1 ? (printable ? _L("Set Printable group") : _L("Set Unprintable group")) :
|
const wxString snapshot_text = sels.Count() > 1 ?
|
||||||
object(obj_idx)->instances.size() == 1 ? from_u8((boost::format("%1% %2%")
|
(printable ? _L("Set Printable group") : _L("Set Unprintable group")) :
|
||||||
% (printable ? _L("Set Printable") : _L("Set Unprintable"))
|
object(obj_idx)->instances.size() == 1 ?
|
||||||
% object(obj_idx)->name).str()) :
|
format_wxstr("%1% %2%", (printable ? _L("Set Printable") : _L("Set Unprintable")), from_u8(object(obj_idx)->name)) :
|
||||||
(printable ? _L("Set Printable Instance") : _L("Set Unprintable Instance"));
|
(printable ? _L("Set Printable Instance") : _L("Set Unprintable Instance"));
|
||||||
take_snapshot(snapshot_text);
|
take_snapshot(snapshot_text);
|
||||||
|
|
||||||
|
|
|
@ -390,7 +390,6 @@ private:
|
||||||
void OnEditingStarted(wxDataViewEvent &event);
|
void OnEditingStarted(wxDataViewEvent &event);
|
||||||
#endif /* __WXMSW__ */
|
#endif /* __WXMSW__ */
|
||||||
void OnEditingDone(wxDataViewEvent &event);
|
void OnEditingDone(wxDataViewEvent &event);
|
||||||
void extruder_selection();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,11 @@ void KBShortcutsDialog::fill_shortcuts()
|
||||||
{ "0-6", L("Camera view") },
|
{ "0-6", L("Camera view") },
|
||||||
{ "E", L("Show/Hide object/instance labels") },
|
{ "E", L("Show/Hide object/instance labels") },
|
||||||
// Configuration
|
// Configuration
|
||||||
|
#ifdef __APPLE__
|
||||||
|
{ ctrl + ",", L("Preferences") },
|
||||||
|
#else
|
||||||
{ ctrl + "P", L("Preferences") },
|
{ ctrl + "P", L("Preferences") },
|
||||||
|
#endif
|
||||||
// Help
|
// Help
|
||||||
{ "?", L("Show keyboard shortcuts list") }
|
{ "?", L("Show keyboard shortcuts list") }
|
||||||
};
|
};
|
||||||
|
@ -149,8 +153,13 @@ void KBShortcutsDialog::fill_shortcuts()
|
||||||
{ "Shift+Tab", L("Collapse/Expand the sidebar") },
|
{ "Shift+Tab", L("Collapse/Expand the sidebar") },
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
{ ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog, if enabled") },
|
{ ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog, if enabled") },
|
||||||
|
#else
|
||||||
|
#ifdef __APPLE__
|
||||||
|
{ ctrl + "Shift+M", L("Show/Hide 3Dconnexion devices settings dialog") },
|
||||||
|
{ ctrl + "M", L("Minimize application") },
|
||||||
#else
|
#else
|
||||||
{ ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") },
|
{ ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") },
|
||||||
|
#endif // __APPLE__
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#if ENABLE_RENDER_PICKING_PASS
|
#if ENABLE_RENDER_PICKING_PASS
|
||||||
// Don't localize debugging texts.
|
// Don't localize debugging texts.
|
||||||
|
@ -171,6 +180,20 @@ void KBShortcutsDialog::fill_shortcuts()
|
||||||
};
|
};
|
||||||
|
|
||||||
m_full_shortcuts.push_back({ { _L("Gizmos"), _L("The following shortcuts are applicable when the specified gizmo is active") }, gizmos_shortcuts });
|
m_full_shortcuts.push_back({ { _L("Gizmos"), _L("The following shortcuts are applicable when the specified gizmo is active") }, gizmos_shortcuts });
|
||||||
|
|
||||||
|
Shortcuts object_list_shortcuts = {
|
||||||
|
#if defined (__linux__)
|
||||||
|
{ alt + "P", L("Set selected items as Ptrintable/Unprintable") },
|
||||||
|
{ alt + "0", L("Set default extruder for the selected items") },
|
||||||
|
{ alt + "1-9", L("Set extruder number for the selected items") },
|
||||||
|
#else
|
||||||
|
{ "P", L("Set selected items as Ptrintable/Unprintable") },
|
||||||
|
{ "0", L("Set default extruder for the selected items") },
|
||||||
|
{ "1-9", L("Set extruder number for the selected items") },
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
m_full_shortcuts.push_back({ { _L("Objects List"), "" }, object_list_shortcuts });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Shortcuts commands_shortcuts = {
|
Shortcuts commands_shortcuts = {
|
||||||
|
|
|
@ -2797,10 +2797,11 @@ void Plater::priv::split_object()
|
||||||
Slic3r::GUI::warning_catcher(q, _L("The selected object couldn't be split because it contains only one solid part."));
|
Slic3r::GUI::warning_catcher(q, _L("The selected object couldn't be split because it contains only one solid part."));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (current_model_object->volumes.size() != new_objects.size())
|
// If we splited object which is contain some parts/modifiers then all non-solid parts (modifiers) were deleted
|
||||||
|
if (current_model_object->volumes.size() > 1 && current_model_object->volumes.size() != new_objects.size())
|
||||||
notification_manager->push_notification(NotificationType::CustomNotification,
|
notification_manager->push_notification(NotificationType::CustomNotification,
|
||||||
NotificationManager::NotificationLevel::RegularNotification,
|
NotificationManager::NotificationLevel::RegularNotification,
|
||||||
_u8L("All non-solid parts (modifiers) was deleted"));
|
_u8L("All non-solid parts (modifiers) were deleted"));
|
||||||
|
|
||||||
Plater::TakeSnapshot snapshot(q, _L("Split to Objects"));
|
Plater::TakeSnapshot snapshot(q, _L("Split to Objects"));
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <boost/nowide/convert.hpp>
|
#include <boost/nowide/convert.hpp>
|
||||||
|
|
||||||
#include "wx/dataview.h"
|
#include "wx/dataview.h"
|
||||||
|
#include "wx/numformatter.h"
|
||||||
|
|
||||||
#include "libslic3r/PrintConfig.hpp"
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
#include "libslic3r/PresetBundle.hpp"
|
#include "libslic3r/PresetBundle.hpp"
|
||||||
|
@ -45,6 +46,11 @@ static char marker_by_type(Preset::Type type, PrinterTechnology pt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Option::opt_key() const
|
||||||
|
{
|
||||||
|
return boost::nowide::narrow(key).substr(2);
|
||||||
|
}
|
||||||
|
|
||||||
void FoundOption::get_marked_label_and_tooltip(const char** label_, const char** tooltip_) const
|
void FoundOption::get_marked_label_and_tooltip(const char** label_, const char** tooltip_) const
|
||||||
{
|
{
|
||||||
*label_ = marked_label.c_str();
|
*label_ = marked_label.c_str();
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct Option {
|
||||||
std::wstring category;
|
std::wstring category;
|
||||||
std::wstring category_local;
|
std::wstring category_local;
|
||||||
|
|
||||||
std::string opt_key() const { return boost::nowide::narrow(key).substr(2); }
|
std::string opt_key() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FoundOption {
|
struct FoundOption {
|
||||||
|
|
Loading…
Reference in a new issue