diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 1eb52e92e..e77a6a324 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2205,9 +2205,19 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) #ifdef _WIN32 if (wxGetApp().app_config->get("use_legacy_3DConnexion") == "1") { #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(); controller.show_settings_dialog(!controller.is_settings_dialog_shown()); m_dirty = true; +#ifdef __APPLE__ + } + else + // and Cmd+M to minimize application + wxGetApp().mainframe->Iconize(); +#endif // __APPLE__ #ifdef _WIN32 } #endif //_WIN32 diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index c969b95da..f27623b09 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -146,18 +146,28 @@ ObjectList::ObjectList(wxWindow* parent) : // Bind(wxEVT_KEY_DOWN, &ObjectList::OnChar, this); { // Accelerators - wxAcceleratorEntry entries[10]; - entries[0].Set(wxACCEL_CTRL, (int) 'C', wxID_COPY); - entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_CUT); - entries[2].Set(wxACCEL_CTRL, (int) 'V', wxID_PASTE); - entries[3].Set(wxACCEL_CTRL, (int) 'A', wxID_SELECTALL); - entries[4].Set(wxACCEL_CTRL, (int) 'Z', wxID_UNDO); - entries[5].Set(wxACCEL_CTRL, (int) 'Y', wxID_REDO); + wxAcceleratorEntry entries[33]; + entries[0].Set(wxACCEL_CTRL, (int)'C', wxID_COPY); + entries[1].Set(wxACCEL_CTRL, (int)'X', wxID_CUT); + entries[2].Set(wxACCEL_CTRL, (int)'V', wxID_PASTE); + entries[3].Set(wxACCEL_CTRL, (int)'A', wxID_SELECTALL); + entries[4].Set(wxACCEL_CTRL, (int)'Z', wxID_UNDO); + entries[5].Set(wxACCEL_CTRL, (int)'Y', wxID_REDO); entries[6].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_DELETE); - entries[7].Set(wxACCEL_NORMAL, WXK_BACK, wxID_DELETE); - entries[8].Set(wxACCEL_NORMAL, int('+'), wxID_ADD); - entries[9].Set(wxACCEL_NORMAL, int('-'), wxID_REMOVE); - wxAcceleratorTable accel(10, entries); + entries[7].Set(wxACCEL_NORMAL, WXK_BACK, wxID_DELETE); + entries[8].Set(wxACCEL_NORMAL, int('+'), wxID_ADD); + entries[9].Set(wxACCEL_NORMAL, WXK_NUMPAD_ADD, wxID_ADD); + 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); 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->increase_instances(); }, wxID_ADD); 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__ 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(); else if (event.GetUnicodeKey() == '-') decrease_instances(); + else if (event.GetUnicodeKey() == 'p') + toggle_printable_state(); + else if (extruders_count() > 1) { + std::vector 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 event.Skip(); } @@ -3790,33 +3821,6 @@ void ObjectList::OnEditingDone(wxDataViewEvent &event) 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 { wxDataViewItemArray sels; @@ -3923,10 +3927,10 @@ void ObjectList::toggle_printable_state() int inst_idx = type == itObject ? 0 : m_objects_model->GetInstanceIdByItem(frst_item); 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")) : - object(obj_idx)->instances.size() == 1 ? from_u8((boost::format("%1% %2%") - % (printable ? _L("Set Printable") : _L("Set Unprintable")) - % object(obj_idx)->name).str()) : + const wxString snapshot_text = sels.Count() > 1 ? + (printable ? _L("Set Printable group") : _L("Set Unprintable group")) : + object(obj_idx)->instances.size() == 1 ? + 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")); take_snapshot(snapshot_text); diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index 8bcfec11c..b378b00af 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -390,7 +390,6 @@ private: void OnEditingStarted(wxDataViewEvent &event); #endif /* __WXMSW__ */ void OnEditingDone(wxDataViewEvent &event); - void extruder_selection(); }; diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 1c451672c..d766ff5fd 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -109,7 +109,11 @@ void KBShortcutsDialog::fill_shortcuts() { "0-6", L("Camera view") }, { "E", L("Show/Hide object/instance labels") }, // Configuration +#ifdef __APPLE__ + { ctrl + ",", L("Preferences") }, +#else { ctrl + "P", L("Preferences") }, +#endif // Help { "?", L("Show keyboard shortcuts list") } }; @@ -149,8 +153,13 @@ void KBShortcutsDialog::fill_shortcuts() { "Shift+Tab", L("Collapse/Expand the sidebar") }, #ifdef _WIN32 { 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 { ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") }, +#endif // __APPLE__ #endif // _WIN32 #if ENABLE_RENDER_PICKING_PASS // 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 }); + + 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 { Shortcuts commands_shortcuts = { diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 24d32b116..f7fbb6395 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -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.")); 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, 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")); diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index 9ff4e82a1..21373cc89 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -7,6 +7,7 @@ #include #include "wx/dataview.h" +#include "wx/numformatter.h" #include "libslic3r/PrintConfig.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 { *label_ = marked_label.c_str(); diff --git a/src/slic3r/GUI/Search.hpp b/src/slic3r/GUI/Search.hpp index a9ced75dd..a942a89f8 100644 --- a/src/slic3r/GUI/Search.hpp +++ b/src/slic3r/GUI/Search.hpp @@ -53,7 +53,7 @@ struct Option { std::wstring category; std::wstring category_local; - std::string opt_key() const { return boost::nowide::narrow(key).substr(2); } + std::string opt_key() const; }; struct FoundOption {