OSX specific: The Command short keys over the 3D scene toolbars

are now shown with the OSX "Command" symbols, not as "Ctrl+"
This commit is contained in:
bubnikv 2019-02-03 11:10:25 +01:00
parent a56f7d60e5
commit f050d91239
5 changed files with 36 additions and 13 deletions

View File

@ -6073,7 +6073,7 @@ bool GLCanvas3D::_init_toolbar()
GLToolbarItem::Data item;
item.name = "add";
item.tooltip = GUI::L_str("Add... [Ctrl+I]");
item.tooltip = GUI::L_str("Add...") + " [" + GUI::shortkey_ctrl_prefix() + "I]";
item.sprite_id = 0;
item.is_toggable = false;
item.action_event = EVT_GLTOOLBAR_ADD;
@ -6081,7 +6081,7 @@ bool GLCanvas3D::_init_toolbar()
return false;
item.name = "delete";
item.tooltip = GUI::L_str("Delete [Del]");
item.tooltip = GUI::L_str("Delete") + " [Del]";
item.sprite_id = 1;
item.is_toggable = false;
item.action_event = EVT_GLTOOLBAR_DELETE;
@ -6089,7 +6089,7 @@ bool GLCanvas3D::_init_toolbar()
return false;
item.name = "deleteall";
item.tooltip = GUI::L_str("Delete all [Ctrl+Del]");
item.tooltip = GUI::L_str("Delete all") + " [" + GUI::shortkey_ctrl_prefix() + "Del]";
item.sprite_id = 2;
item.is_toggable = false;
item.action_event = EVT_GLTOOLBAR_DELETE_ALL;

View File

@ -75,6 +75,30 @@ void break_to_debugger()
#endif /* _WIN32 */
}
const std::string& shortkey_ctrl_prefix()
{
static const std::string str =
#ifdef __APPLE__
""
#else
"Ctrl+"
#endif
;
return str;
}
const std::string& shortkey_alt_prefix()
{
static const std::string str =
#ifdef __APPLE__
""
#else
"Alt+"
#endif
;
return str;
}
bool config_wizard_startup(bool app_config_exists)
{
if (!app_config_exists || wxGetApp().preset_bundle->printers.size() <= 1) {

View File

@ -27,7 +27,11 @@ void enable_screensaver();
bool debugged();
void break_to_debugger();
AppConfig* get_app_config();
// Platform specific Ctrl+/Alt+ (Windows, Linux) vs. ⌘/⌥ (OSX) prefixes
extern const std::string& shortkey_ctrl_prefix();
extern const std::string& shortkey_alt_prefix();
extern AppConfig* get_app_config();
extern void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_language_change);

View File

@ -88,13 +88,8 @@ KBShortcutsDialog::KBShortcutsDialog()
void KBShortcutsDialog::fill_shortcuts()
{
#ifdef __WXOSX__
const std::string ctrl = "";
const std::string alt = "";
#else
const std::string ctrl = "Ctrl+";
const std::string alt = "Alt+";
#endif // __WXOSX__
const std::string &ctrl = GUI::shortkey_ctrl_prefix();
const std::string &alt = GUI::shortkey_alt_prefix();
m_full_shortcuts.reserve(4);

View File

@ -2555,7 +2555,7 @@ void Plater::priv::init_view_toolbar()
GLToolbarItem::Data item;
item.name = "3D";
item.tooltip = GUI::L_str("3D editor view [Ctrl+5]");
item.tooltip = GUI::L_str("3D editor view") + " [" + GUI::shortkey_ctrl_prefix() + "5]";
item.sprite_id = 0;
item.action_event = EVT_GLVIEWTOOLBAR_3D;
item.is_toggable = false;
@ -2563,7 +2563,7 @@ void Plater::priv::init_view_toolbar()
return;
item.name = "Preview";
item.tooltip = GUI::L_str("Preview [Ctrl+6]");
item.tooltip = GUI::L_str("Preview") + " [" + GUI::shortkey_ctrl_prefix() + "6]";
item.sprite_id = 1;
item.action_event = EVT_GLVIEWTOOLBAR_PREVIEW;
item.is_toggable = false;