aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-06-07 11:46:05 (GMT)
committerrathnor <rathnor>2004-06-07 11:46:05 (GMT)
commitfff4456dee29e675d7f2ed3490db39bcb7e10e53 (patch)
tree2d2dbf386551773cbdc8231b2a93b493187bd733 /src/Screen.cc
parent073065ac56b388db1169108d44f37d32f1d19c67 (diff)
downloadfluxbox-fff4456dee29e675d7f2ed3490db39bcb7e10e53.zip
fluxbox-fff4456dee29e675d7f2ed3490db39bcb7e10e53.tar.bz2
update NLS string handling...
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc143
1 files changed, 76 insertions, 67 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 3497f7d..3fce3a6 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,12 +22,11 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.278 2004/05/13 01:48:17 rathnor Exp $ 25// $Id: Screen.cc,v 1.279 2004/06/07 11:46:04 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
29 29
30#include "I18n.hh"
31#include "fluxbox.hh" 30#include "fluxbox.hh"
32#include "Window.hh" 31#include "Window.hh"
33#include "Workspace.hh" 32#include "Workspace.hh"
@@ -58,6 +57,7 @@
58#include "AtomHandler.hh" 57#include "AtomHandler.hh"
59 58
60 59
60#include "FbTk/I18n.hh"
61#include "FbTk/Subject.hh" 61#include "FbTk/Subject.hh"
62#include "FbTk/FbWindow.hh" 62#include "FbTk/FbWindow.hh"
63#include "FbTk/SimpleCommand.hh" 63#include "FbTk/SimpleCommand.hh"
@@ -135,10 +135,12 @@ static bool running = true;
135namespace { 135namespace {
136 136
137int anotherWMRunning(Display *display, XErrorEvent *) { 137int anotherWMRunning(Display *display, XErrorEvent *) {
138 cerr<<I18n::instance()-> 138 _FB_USES_NLS;
139 getMessage(FBNLS::ScreenSet, FBNLS::ScreenAnotherWMRunning, 139 cerr<<_FBTEXT(Screen, AnotherWMRunning,
140 "BScreen::BScreen: an error occured while querying the X server.\n" 140 "BScreen::BScreen: an error occured while querying the X server.\n"
141 " another window manager already running on display ")<<DisplayString(display)<<endl; 141 " another window manager already running on display ",
142 "Message when another WM is found already active on all screens")
143 <<DisplayString(display)<<endl;
142 144
143 running = false; 145 running = false;
144 146
@@ -248,11 +250,12 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
248 if (! managed) 250 if (! managed)
249 return; 251 return;
250 252
251 I18n *i18n = I18n::instance(); 253 _FB_USES_NLS;
252 254
253 fprintf(stderr, i18n->getMessage(FBNLS::ScreenSet, FBNLS::ScreenManagingScreen, 255 fprintf(stderr, _FBTEXT(Screen, ManagingScreen,
254 "BScreen::BScreen: managing screen %d " 256 "BScreen::BScreen: managing screen %d "
255 "using visual 0x%lx, depth %d\n"), 257 "using visual 0x%lx, depth %d\n",
258 "informational message saying screen number (%d), visual (%lx), and colour depth (%d)"),
256 screenNumber(), XVisualIDFromVisual(rootWindow().visual()), 259 screenNumber(), XVisualIDFromVisual(rootWindow().visual()),
257 rootWindow().depth()); 260 rootWindow().depth());
258 261
@@ -362,8 +365,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
362 // own resources we must do this. 365 // own resources we must do this.
363 fluxbox->load_rc(*this); 366 fluxbox->load_rc(*this);
364 367
365 // TODO: nls 368 m_configmenu.reset(createMenu(_FBTEXT(Menu, Configuration, "Configuration", "Title of configuration menu")));
366 m_configmenu.reset(createMenu("Configuration"));
367 setupConfigmenu(*m_configmenu.get()); 369 setupConfigmenu(*m_configmenu.get());
368 m_configmenu->setInternalMenu(); 370 m_configmenu->setInternalMenu();
369 371
@@ -1646,7 +1648,6 @@ void BScreen::initMenus() {
1646} 1648}
1647 1649
1648void BScreen::initMenu() { 1650void BScreen::initMenu() {
1649 I18n *i18n = I18n::instance();
1650 1651
1651 if (m_rootmenu.get()) { 1652 if (m_rootmenu.get()) {
1652 // since all menus in root is submenus in m_rootmenu 1653 // since all menus in root is submenus in m_rootmenu
@@ -1668,19 +1669,17 @@ void BScreen::initMenu() {
1668 1669
1669 1670
1670 if (m_rootmenu.get() == 0) { 1671 if (m_rootmenu.get() == 0) {
1671 m_rootmenu.reset(createMenu("Fluxbox default menu")); 1672 _FB_USES_NLS;
1673 m_rootmenu.reset(createMenu(_FBTEXT(Menu, DefaultRootMenu, "Fluxbox default menu", "Title of fallback root menu")));
1672 FbTk::RefCount<FbTk::Command> restart_fb(CommandParser::instance().parseLine("restart")); 1674 FbTk::RefCount<FbTk::Command> restart_fb(CommandParser::instance().parseLine("restart"));
1673 FbTk::RefCount<FbTk::Command> exit_fb(CommandParser::instance().parseLine("exit")); 1675 FbTk::RefCount<FbTk::Command> exit_fb(CommandParser::instance().parseLine("exit"));
1674 FbTk::RefCount<FbTk::Command> execute_xterm(CommandParser::instance().parseLine("exec xterm")); 1676 FbTk::RefCount<FbTk::Command> execute_xterm(CommandParser::instance().parseLine("exec xterm"));
1675 m_rootmenu->setInternalMenu(); 1677 m_rootmenu->setInternalMenu();
1676 m_rootmenu->insert(i18n->getMessage(FBNLS::ScreenSet, FBNLS::Screenxterm, 1678 m_rootmenu->insert(_FBTEXT(Menu, xterm, "xterm", "xterm - in fallback menu"),
1677 "xterm"),
1678 execute_xterm); 1679 execute_xterm);
1679 m_rootmenu->insert(i18n->getMessage(FBNLS::ScreenSet, FBNLS::ScreenRestart, 1680 m_rootmenu->insert(_FBTEXT(Menu, Restart, "Restart", "Restart command"),
1680 "Restart"),
1681 restart_fb); 1681 restart_fb);
1682 m_rootmenu->insert(i18n->getMessage(FBNLS::ScreenSet, FBNLS::ScreenExit, 1682 m_rootmenu->insert(_FBTEXT(Menu, Exit, "Exit", "Exit command"),
1683 "Exit"),
1684 exit_fb); 1683 exit_fb);
1685 } 1684 }
1686 1685
@@ -1705,8 +1704,7 @@ void BScreen::removeConfigMenu(FbTk::Menu &menu) {
1705} 1704}
1706 1705
1707void BScreen::setupConfigmenu(FbTk::Menu &menu) { 1706void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1708 I18n *i18n = I18n::instance(); 1707 _FB_USES_NLS;
1709 using namespace FBNLS;
1710 1708
1711 menu.removeAll(); 1709 menu.removeAll();
1712 1710
@@ -1720,26 +1718,27 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1720 // create focus menu 1718 // create focus menu
1721 // we don't set this to internal menu so will 1719 // we don't set this to internal menu so will
1722 // be deleted toghether with the parent 1720 // be deleted toghether with the parent
1723 const char *focusmenu_label = i18n->getMessage(ConfigmenuSet, ConfigmenuFocusModel, 1721 const char *focusmenu_label = _FBTEXT(Configmenu, FocusModel,
1724 "Focus Model"); 1722 "Focus Model", "Method used to give focus to windows");
1725 FbTk::Menu *focus_menu = createMenu(focusmenu_label ? focusmenu_label : ""); 1723 FbTk::Menu *focus_menu = createMenu(focusmenu_label ? focusmenu_label : "");
1726 1724
1727#define _FOCUSITEM(a, b, c, d) focus_menu->insert(new FocusModelMenuItem(i18n->getMessage(a, b, c), *this, d, save_and_reconfigure)) 1725#define _FOCUSITEM(a, b, c, d, e) focus_menu->insert(new FocusModelMenuItem(_FBTEXT(a, b, c, d), *this, e, save_and_reconfigure))
1728 1726
1729 _FOCUSITEM(ConfigmenuSet, ConfigmenuClickToFocus, 1727 _FOCUSITEM(Configmenu, ClickToFocus,
1730 "Click To Focus", 1728 "Click To Focus", "Click to focus",
1731 CLICKTOFOCUS); 1729 CLICKTOFOCUS);
1732 _FOCUSITEM(ConfigmenuSet, ConfigmenuSloppyFocus, 1730 _FOCUSITEM(Configmenu, SloppyFocus,
1733 "Sloppy Focus", 1731 "Sloppy Focus", "Sloppy Focus",
1734 SLOPPYFOCUS); 1732 SLOPPYFOCUS);
1735 _FOCUSITEM(ConfigmenuSet, ConfigmenuSemiSloppyFocus, 1733 _FOCUSITEM(Configmenu, SemiSloppyFocus,
1736 "Semi Sloppy Focus", 1734 "Semi Sloppy Focus", "Semi Sloppy Focus",
1737 SEMISLOPPYFOCUS); 1735 SEMISLOPPYFOCUS);
1738#undef _FOCUSITEM 1736#undef _FOCUSITEM
1739 1737
1740 focus_menu->insert(new BoolMenuItem(i18n->getMessage(ConfigmenuSet, 1738 focus_menu->insert(new BoolMenuItem(_FBTEXT(Configmenu,
1741 ConfigmenuAutoRaise, 1739 AutoRaise,
1742 "Auto Raise"), 1740 "Auto Raise",
1741 "Auto Raise windows on sloppy"),
1743 *resource.auto_raise, 1742 *resource.auto_raise,
1744 save_and_reconfigure)); 1743 save_and_reconfigure));
1745 1744
@@ -1758,38 +1757,38 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1758 for (; it != it_end; ++it) 1757 for (; it != it_end; ++it)
1759 menu.insert(it->first, it->second); 1758 menu.insert(it->first, it->second);
1760 1759
1761#define _BOOLITEM(a, b, c, d, e) menu.insert(new BoolMenuItem(i18n->getMessage(a, b, c), d, e)) 1760#define _BOOLITEM(a, b, c, d, e, f) menu.insert(new BoolMenuItem(_FBTEXT(a, b, c, d), e, f))
1762 1761
1763 _BOOLITEM(ConfigmenuSet, ConfigmenuImageDithering, 1762 _BOOLITEM(Configmenu, ImageDithering,
1764 "Image Dithering", 1763 "Image Dithering", "Image Dithering",
1765 *resource.image_dither, save_and_reconfigure); 1764 *resource.image_dither, save_and_reconfigure);
1766 _BOOLITEM(ConfigmenuSet, ConfigmenuOpaqueMove, 1765 _BOOLITEM(Configmenu, OpaqueMove,
1767 "Opaque Window Moving", 1766 "Opaque Window Moving", "Window Moving with whole window visible (as opposed to outline moving)",
1768 *resource.opaque_move, saverc_cmd); 1767 *resource.opaque_move, saverc_cmd);
1769 _BOOLITEM(ConfigmenuSet, ConfigmenuFullMax, 1768 _BOOLITEM(Configmenu, FullMax,
1770 "Full Maximization", 1769 "Full Maximization", "Maximise over slit, toolbar, etc",
1771 *resource.full_max, saverc_cmd); 1770 *resource.full_max, saverc_cmd);
1772 _BOOLITEM(ConfigmenuSet, ConfigmenuFocusNew, 1771 _BOOLITEM(Configmenu, FocusNew,
1773 "Focus New Windows", 1772 "Focus New Windows", "Focus newly created windows",
1774 *resource.focus_new, saverc_cmd); 1773 *resource.focus_new, saverc_cmd);
1775 _BOOLITEM(ConfigmenuSet, ConfigmenuFocusLast, 1774 _BOOLITEM(Configmenu, FocusLast,
1776 "Focus Last Window on Workspace", 1775 "Focus Last Window on Workspace", "Focus Last Window on Workspace",
1777 *resource.focus_last, saverc_cmd); 1776 *resource.focus_last, saverc_cmd);
1778 _BOOLITEM(ConfigmenuSet, ConfigmenuWorkspaceWarping, 1777 _BOOLITEM(Configmenu, WorkspaceWarping,
1779 "Workspace Warping", 1778 "Workspace Warping", "Workspace Warping - dragging windows to the edge and onto the next workspace",
1780 *resource.workspace_warping, saverc_cmd); 1779 *resource.workspace_warping, saverc_cmd);
1781 _BOOLITEM(ConfigmenuSet, ConfigmenuDesktopWheeling, 1780 _BOOLITEM(Configmenu, DesktopWheeling,
1782 "Desktop MouseWheel Switching", 1781 "Desktop MouseWheel Switching", "Workspace switching using mouse wheel",
1783 *resource.desktop_wheeling, saverc_cmd); 1782 *resource.desktop_wheeling, saverc_cmd);
1784 _BOOLITEM(ConfigmenuSet, ConfigmenuDecorateTransient, 1783 _BOOLITEM(Configmenu, DecorateTransient,
1785 "Decorate Transient Windows", 1784 "Decorate Transient Windows", "Decorate Transient Windows",
1786 *resource.decorate_transient, saverc_cmd); 1785 *resource.decorate_transient, saverc_cmd);
1787 _BOOLITEM(ConfigmenuSet, ConfigmenuClickRaises, 1786 _BOOLITEM(Configmenu, ClickRaises,
1788 "Click Raises", 1787 "Click Raises", "Click Raises",
1789 *resource.click_raises, saverc_cmd); 1788 *resource.click_raises, saverc_cmd);
1790 // setup antialias cmd to reload style and save resource on toggle 1789 // setup antialias cmd to reload style and save resource on toggle
1791 _BOOLITEM(ConfigmenuSet, ConfigmenuAntiAlias, 1790 _BOOLITEM(Configmenu, AntiAlias,
1792 "AntiAlias", 1791 "AntiAlias", "Use Anti-aliased fonts",
1793 *resource.antialias, save_and_reconfigure); 1792 *resource.antialias, save_and_reconfigure);
1794 1793
1795#undef _BOOLITEM 1794#undef _BOOLITEM
@@ -1819,7 +1818,7 @@ void BScreen::shutdown() {
1819 1818
1820 1819
1821void BScreen::showPosition(int x, int y) { 1820void BScreen::showPosition(int x, int y) {
1822 if (!doShowWindowPos()) 1821 if (!doShowWindowPos())
1823 return; 1822 return;
1824 1823
1825 if (! pos_visible) { 1824 if (! pos_visible) {
@@ -1839,10 +1838,13 @@ void BScreen::showPosition(int x, int y) {
1839 pos_visible = true; 1838 pos_visible = true;
1840 } 1839 }
1841 char label[256]; 1840 char label[256];
1842 1841
1842 _FB_USES_NLS;
1843
1843 sprintf(label, 1844 sprintf(label,
1844 I18n::instance()->getMessage(FBNLS::ScreenSet, FBNLS::ScreenPositionFormat, 1845 _FBTEXT(Screen, PositionFormat,
1845 "X: %4d x Y: %4d"), x, y); 1846 "X: %4d x Y: %4d",
1847 "Format for screen coordinates - %4d for X, and %4d for Y"), x, y);
1846 1848
1847 m_pos_window.clear(); 1849 m_pos_window.clear();
1848 1850
@@ -1886,10 +1888,13 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
1886 } 1888 }
1887 1889
1888 char label[256]; 1890 char label[256];
1891 _FB_USES_NLS;
1889 1892
1890 sprintf(label, 1893 sprintf(label,
1891 I18n::instance()->getMessage(FBNLS::ScreenSet, FBNLS::ScreenGeometryFormat, 1894 _FBTEXT(Screen, GeometryFormat,
1892 "W: %4d x H: %4d"), gx, gy); 1895 "W: %4d x H: %4d",
1896 "Format for width and height window, %4d for widht, and %4d for height"),
1897 gx, gy);
1893 1898
1894 m_geom_window.clear(); 1899 m_geom_window.clear();
1895 1900
@@ -1961,10 +1966,12 @@ bool BScreen::doSkipWindow(const WinClient &winclient, int opts) {
1961} 1966}
1962 1967
1963void BScreen::renderGeomWindow() { 1968void BScreen::renderGeomWindow() {
1969 _FB_USES_NLS;
1964 1970
1965 const char *s = I18n::instance()->getMessage(FBNLS::ScreenSet, 1971 const char *s = _FBTEXT(Screen,
1966 FBNLS::ScreenGeometryLength, 1972 GeometryLength,
1967 "W: 0000 x H: 0000"); 1973 "W: 0000 x H: 0000",
1974 "Representative maximum sized text for width and height dialog");
1968 int l = strlen(s); 1975 int l = strlen(s);
1969 1976
1970 int geom_h = winFrameTheme().font().height() + winFrameTheme().bevelWidth()*2; 1977 int geom_h = winFrameTheme().font().height() + winFrameTheme().bevelWidth()*2;
@@ -2004,10 +2011,12 @@ void BScreen::renderGeomWindow() {
2004 2011
2005 2012
2006void BScreen::renderPosWindow() { 2013void BScreen::renderPosWindow() {
2014 _FB_USES_NLS;
2007 2015
2008 const char *s = I18n::instance()->getMessage(FBNLS::ScreenSet, 2016 const char *s = _FBTEXT(Screen,
2009 FBNLS::ScreenPositionLength, 2017 PositionLength,
2010 "0: 0000 x 0: 0000"); 2018 "0: 0000 x 0: 0000",
2019 "Representative maximum sized text for X and Y dialog");
2011 int l = strlen(s); 2020 int l = strlen(s);
2012 2021
2013 int pos_h = winFrameTheme().font().height() + winFrameTheme().bevelWidth()*2; 2022 int pos_h = winFrameTheme().font().height() + winFrameTheme().bevelWidth()*2;