From: Pierre Ossman Date: Wed, 23 Sep 2015 14:39:54 +0000 (+0200) Subject: Give context for strings used in menus X-Git-Tag: v1.5.90~27 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ff626f823ad627b694e6f4c99717f4d32e637b1d;p=tigervnc.git Give context for strings used in menus Makes it easier to see which hot-keys might conflict with each other, and allow some variation in translation in the future. --- diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index ee74e9d6..a7881bc7 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -787,46 +787,49 @@ void Viewport::initContextMenu() { contextMenu->clear(); - fltk_menu_add(contextMenu, _("E&xit viewer"), 0, NULL, - (void*)ID_EXIT, FL_MENU_DIVIDER); + fltk_menu_add(contextMenu, p_("ContextMenu|", "E&xit viewer"), + 0, NULL, (void*)ID_EXIT, FL_MENU_DIVIDER); - fltk_menu_add(contextMenu, _("&Full screen"), 0, NULL, (void*)ID_FULLSCREEN, + fltk_menu_add(contextMenu, p_("ContextMenu|", "&Full screen"), + 0, NULL, (void*)ID_FULLSCREEN, FL_MENU_TOGGLE | (window()->fullscreen_active()?FL_MENU_VALUE:0)); - fltk_menu_add(contextMenu, _("Minimi&ze"), 0, NULL, - (void*)ID_MINIMIZE, 0); - fltk_menu_add(contextMenu, _("Resize &window to session"), 0, NULL, - (void*)ID_RESIZE, + fltk_menu_add(contextMenu, p_("ContextMenu|", "Minimi&ze"), + 0, NULL, (void*)ID_MINIMIZE, 0); + fltk_menu_add(contextMenu, p_("ContextMenu|", "Resize &window to session"), + 0, NULL, (void*)ID_RESIZE, (window()->fullscreen_active()?FL_MENU_INACTIVE:0) | FL_MENU_DIVIDER); - fltk_menu_add(contextMenu, _("&Ctrl"), 0, NULL, (void*)ID_CTRL, + fltk_menu_add(contextMenu, p_("ContextMenu|", "&Ctrl"), + 0, NULL, (void*)ID_CTRL, FL_MENU_TOGGLE | (menuCtrlKey?FL_MENU_VALUE:0)); - fltk_menu_add(contextMenu, _("&Alt"), 0, NULL, (void*)ID_ALT, + fltk_menu_add(contextMenu, p_("ContextMenu|", "&Alt"), + 0, NULL, (void*)ID_ALT, FL_MENU_TOGGLE | (menuAltKey?FL_MENU_VALUE:0)); if (menuKeySym) { char sendMenuKey[64]; - snprintf(sendMenuKey, 64, _("Send %s"), (const char *)menuKey); + snprintf(sendMenuKey, 64, p_("ContextMenu|", "Send %s"), (const char *)menuKey); fltk_menu_add(contextMenu, sendMenuKey, 0, NULL, (void*)ID_MENUKEY, 0); fltk_menu_add(contextMenu, "Secret shortcut menu key", menuKeyCode, NULL, (void*)ID_MENUKEY, FL_MENU_INVISIBLE); } - fltk_menu_add(contextMenu, _("Send Ctrl-Alt-&Del"), 0, NULL, - (void*)ID_CTRLALTDEL, FL_MENU_DIVIDER); + fltk_menu_add(contextMenu, p_("ContextMenu|", "Send Ctrl-Alt-&Del"), + 0, NULL, (void*)ID_CTRLALTDEL, FL_MENU_DIVIDER); - fltk_menu_add(contextMenu, _("&Refresh screen"), 0, NULL, - (void*)ID_REFRESH, FL_MENU_DIVIDER); + fltk_menu_add(contextMenu, p_("ContextMenu|", "&Refresh screen"), + 0, NULL, (void*)ID_REFRESH, FL_MENU_DIVIDER); - fltk_menu_add(contextMenu, _("&Options..."), 0, NULL, - (void*)ID_OPTIONS, 0); - fltk_menu_add(contextMenu, _("Connection &info..."), 0, NULL, - (void*)ID_INFO, 0); - fltk_menu_add(contextMenu, _("About &TigerVNC viewer..."), 0, NULL, - (void*)ID_ABOUT, FL_MENU_DIVIDER); + fltk_menu_add(contextMenu, p_("ContextMenu|", "&Options..."), + 0, NULL, (void*)ID_OPTIONS, 0); + fltk_menu_add(contextMenu, p_("ContextMenu|", "Connection &info..."), + 0, NULL, (void*)ID_INFO, 0); + fltk_menu_add(contextMenu, p_("ContextMenu|", "About &TigerVNC viewer..."), + 0, NULL, (void*)ID_ABOUT, FL_MENU_DIVIDER); - fltk_menu_add(contextMenu, _("Dismiss &menu"), 0, NULL, - (void*)ID_DISMISS, 0); + fltk_menu_add(contextMenu, p_("ContextMenu|", "Dismiss &menu"), + 0, NULL, (void*)ID_DISMISS, 0); } diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index f9258b90..230cc25a 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -292,9 +292,11 @@ static void init_fltk() menubar = new Fl_Sys_Menu_Bar(0, 0, 500, 25); // Fl_Sys_Menu_Bar overrides methods without them being virtual, // which means we cannot use our generic Fl_Menu_ helpers. - if (fltk_menu_escape(_("&File"), buffer, sizeof(buffer)) < sizeof(buffer)) + if (fltk_menu_escape(p_("SysMenu|", "&File"), + buffer, sizeof(buffer)) < sizeof(buffer)) menubar->add(buffer, 0, 0, 0, FL_SUBMENU); - if (fltk_menu_escape(_("&New Connection"), buffer, sizeof(buffer)) < sizeof(buffer)) + if (fltk_menu_escape(p_("SysMenu|File|", "&New Connection"), + buffer, sizeof(buffer)) < sizeof(buffer)) menubar->insert(1, buffer, FL_COMMAND | 'n', new_connection_cb); #endif }