diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 3b81a41bd4..7cde5f1c93 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -168,8 +168,10 @@ wxDEFINE_EVENT(EVT_SYNC_CLOUD_PRESET, SimpleEvent); #ifdef __APPLE__ static const wxString ctrl = ("Ctrl+"); +static const std::string ctrl_t = "⌘"; #else static const wxString ctrl = _L("Ctrl+"); +static const wxString ctrl_t = ctrl; #endif MainFrame::MainFrame() : @@ -2183,14 +2185,13 @@ void MainFrame::on_sys_color_changed() this->Refresh(); } -#ifdef _MSC_VER - // \xA0 is a non-breaking space. It is entered here to spoil the automatic accelerators, - // as the simple numeric accelerators spoil all numeric data entry. -static const wxString sep = "\t\xA0"; -static const wxString sep_space = "\xA0"; -#else +// On macOS, we use system menu bar, which handles the key accelerators automatically and breaks key handling in normal typing +// See https://github.com/SoftFever/OrcaSlicer/issues/8152 +// So we disable some of the accelerators on macOS, by replacing the accelerator seperator to a hyphen. +#ifdef __APPLE__ static const wxString sep = " - "; -static const wxString sep_space = ""; +#else +static const wxString sep = "\t"; #endif static wxMenu* generate_help_menu() @@ -2503,7 +2504,7 @@ void MainFrame::init_menubar_as_editor() editMenu->AppendSeparator(); #else // BBS undo - append_menu_item(editMenu, wxID_ANY, _L("Undo") + "\t" + ctrl + "Z", + append_menu_item(editMenu, wxID_ANY, _L("Undo") + sep + ctrl_t + "Z", _L("Undo"), [this, handle_key_event](wxCommandEvent&) { wxKeyEvent e; e.SetEventType(wxEVT_KEY_DOWN); @@ -2515,7 +2516,7 @@ void MainFrame::init_menubar_as_editor() m_plater->undo(); }, "", nullptr, [this](){return m_plater->can_undo(); }, this); // BBS redo - append_menu_item(editMenu, wxID_ANY, _L("Redo") + "\t" + ctrl + "Y", + append_menu_item(editMenu, wxID_ANY, _L("Redo") + sep + ctrl_t + "Y", _L("Redo"), [this, handle_key_event](wxCommandEvent&) { wxKeyEvent e; e.SetEventType(wxEVT_KEY_DOWN); @@ -2528,7 +2529,7 @@ void MainFrame::init_menubar_as_editor() "", nullptr, [this](){return m_plater->can_redo(); }, this); editMenu->AppendSeparator(); // BBS Cut TODO - append_menu_item(editMenu, wxID_ANY, _L("Cut") + "\t" + ctrl + "X", + append_menu_item(editMenu, wxID_ANY, _L("Cut") + sep + ctrl_t + "X", _L("Cut selection to clipboard"), [this, handle_key_event](wxCommandEvent&) { wxKeyEvent e; e.SetEventType(wxEVT_KEY_DOWN); @@ -2540,7 +2541,7 @@ void MainFrame::init_menubar_as_editor() m_plater->cut_selection_to_clipboard(); }, "", nullptr, [this]() {return m_plater->can_copy_to_clipboard(); }, this); // BBS Copy - append_menu_item(editMenu, wxID_ANY, _L("Copy") + "\t" + ctrl + "C", + append_menu_item(editMenu, wxID_ANY, _L("Copy") + sep + ctrl_t + "C", _L("Copy selection to clipboard"), [this, handle_key_event](wxCommandEvent&) { wxKeyEvent e; e.SetEventType(wxEVT_KEY_DOWN); @@ -2552,7 +2553,7 @@ void MainFrame::init_menubar_as_editor() m_plater->copy_selection_to_clipboard(); }, "", nullptr, [this](){return m_plater->can_copy_to_clipboard(); }, this); // BBS Paste - append_menu_item(editMenu, wxID_ANY, _L("Paste") + "\t" + ctrl + "V", + append_menu_item(editMenu, wxID_ANY, _L("Paste") + sep + ctrl_t + "V", _L("Paste clipboard"), [this, handle_key_event](wxCommandEvent&) { wxKeyEvent e; e.SetEventType(wxEVT_KEY_DOWN); @@ -2608,7 +2609,7 @@ void MainFrame::init_menubar_as_editor() #endif // BBS Select All - append_menu_item(editMenu, wxID_ANY, _L("Select all") + "\t" + ctrl + "A", + append_menu_item(editMenu, wxID_ANY, _L("Select all") + sep + ctrl_t + "A", _L("Selects all objects"), [this, handle_key_event](wxCommandEvent&) { wxKeyEvent e; e.SetEventType(wxEVT_KEY_DOWN); @@ -2620,7 +2621,7 @@ void MainFrame::init_menubar_as_editor() m_plater->select_all(); }, "", nullptr, [this](){return can_select(); }, this); // BBS Deslect All - append_menu_item(editMenu, wxID_ANY, _L("Deselect all") + "\tEsc", + append_menu_item(editMenu, wxID_ANY, _L("Deselect all") + sep + "Esc", _L("Deselects all objects"), [this, handle_key_event](wxCommandEvent&) { wxKeyEvent e; e.SetEventType(wxEVT_KEY_DOWN); @@ -2691,7 +2692,7 @@ void MainFrame::init_menubar_as_editor() [this]() { return wxGetApp().app_config->get_bool("auto_perspective"); }, this); viewMenu->AppendSeparator(); - append_menu_check_item(viewMenu, wxID_ANY, _L("Show &G-code Window") + "\tC", _L("Show g-code window in Preview scene"), + append_menu_check_item(viewMenu, wxID_ANY, _L("Show &G-code Window") + sep + "C", _L("Show g-code window in Preview scene"), [this](wxCommandEvent &) { wxGetApp().toggle_show_gcode_window(); m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));