From 10be5d1361b05a77cc7833fb5c277755c25b45f0 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 7 Dec 2020 08:39:43 +0100 Subject: [PATCH] Replace F5 with Ctrl+Shift+R as shortcut key for reload from disk commands on MAC --- src/slic3r/GUI/KBShortcutsDialog.cpp | 16 ++++++++++++++++ src/slic3r/GUI/MainFrame.cpp | 16 ++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index febaa0592..64696d6e2 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -118,7 +118,11 @@ void KBShortcutsDialog::fill_shortcuts() { ctrl + "Y", L("Redo") }, { ctrl + "C", L("Copy to clipboard") }, { ctrl + "V", L("Paste from clipboard") }, +#ifdef __APPLE__ + { ctrl + "Shift+" + "R", L("Reload plater from disk") }, +#else { "F5", L("Reload plater from disk") }, +#endif // __APPLE__ { ctrl + "F", L("Search") }, // Window { ctrl + "1", L("Select Plater Tab") }, @@ -201,6 +205,18 @@ void KBShortcutsDialog::fill_shortcuts() m_full_shortcuts.push_back(std::make_pair(_L("Gizmos"), gizmos_shortcuts)); } + else { + Shortcuts commands_shortcuts = { + { ctrl + "O", L("Open a G-code file") }, +#ifdef __APPLE__ + { ctrl + "Shift+" + "R", L("Reload the plater from disk") }, +#else + { "F5", L("Reload plater from disk") }, +#endif // __APPLE__ + }; + + m_full_shortcuts.push_back(std::make_pair(_L("Commands"), commands_shortcuts)); + } Shortcuts preview_shortcuts = { #if ENABLE_ARROW_KEYS_WITH_SLIDERS diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 5f5213d4b..27bdf0c89 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -1018,11 +1018,11 @@ void MainFrame::init_menubar_as_editor() append_submenu(fileMenu, import_menu, wxID_ANY, _L("&Import"), ""); wxMenu* export_menu = new wxMenu(); - wxMenuItem* item_export_gcode = append_menu_item(export_menu, wxID_ANY, _L("Export &G-code") + dots +"\tCtrl+G", _L("Export current plate as G-code"), + wxMenuItem* item_export_gcode = append_menu_item(export_menu, wxID_ANY, _L("Export &G-code") + dots + "\tCtrl+G", _L("Export current plate as G-code"), [this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(false); }, "export_gcode", nullptr, [this](){return can_export_gcode(); }, this); m_changeable_menu_items.push_back(item_export_gcode); - wxMenuItem* item_send_gcode = append_menu_item(export_menu, wxID_ANY, _L("S&end G-code") + dots +"\tCtrl+Shift+G", _L("Send to print current plate as G-code"), + wxMenuItem* item_send_gcode = append_menu_item(export_menu, wxID_ANY, _L("S&end G-code") + dots + "\tCtrl+Shift+G", _L("Send to print current plate as G-code"), [this](wxCommandEvent&) { if (m_plater) m_plater->send_gcode(); }, "export_gcode", nullptr, [this](){return can_send_gcode(); }, this); m_changeable_menu_items.push_back(item_send_gcode); @@ -1140,9 +1140,15 @@ void MainFrame::init_menubar_as_editor() "paste_menu", nullptr, [this](){return m_plater->can_paste_from_clipboard(); }, this); editMenu->AppendSeparator(); +#ifdef __APPLE__ + append_menu_item(editMenu, wxID_ANY, _L("Re&load from disk") + dots + "\tCtrl+Shift+R", + _L("Reload the plater from disk"), [this](wxCommandEvent&) { m_plater->reload_all_from_disk(); }, + "", nullptr, [this]() {return !m_plater->model().objects.empty(); }, this); +#else append_menu_item(editMenu, wxID_ANY, _L("Re&load from disk") + sep + "F5", _L("Reload the plater from disk"), [this](wxCommandEvent&) { m_plater->reload_all_from_disk(); }, "", nullptr, [this]() {return !m_plater->model().objects.empty(); }, this); +#endif // __APPLE__ editMenu->AppendSeparator(); append_menu_item(editMenu, wxID_ANY, _L("Searc&h") + "\tCtrl+F", @@ -1242,9 +1248,15 @@ void MainFrame::init_menubar_as_gcodeviewer() append_menu_item(fileMenu, wxID_ANY, _L("&Open G-code") + dots + "\tCtrl+O", _L("Open a G-code file"), [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->load_gcode(); }, "open", nullptr, [this]() {return m_plater != nullptr; }, this); +#ifdef __APPLE__ + append_menu_item(fileMenu, wxID_ANY, _L("Re&load from disk") + dots + "\tCtrl+Shift+R", + _L("Reload the plater from disk"), [this](wxCommandEvent&) { m_plater->reload_gcode_from_disk(); }, + "", nullptr, [this]() { return !m_plater->get_last_loaded_gcode().empty(); }, this); +#else append_menu_item(fileMenu, wxID_ANY, _L("Re&load from disk") + sep + "F5", _L("Reload the plater from disk"), [this](wxCommandEvent&) { m_plater->reload_gcode_from_disk(); }, "", nullptr, [this]() { return !m_plater->get_last_loaded_gcode().empty(); }, this); +#endif // __APPLE__ fileMenu->AppendSeparator(); append_menu_item(fileMenu, wxID_ANY, _L("Export &toolpaths as OBJ") + dots, _L("Export toolpaths as OBJ"), [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->export_toolpaths_to_obj(); }, "export_plater", nullptr,