new i18n class using overloaded operator() instead of getMessage()

This commit is contained in:
Dana Jansens 2002-05-16 22:35:59 +00:00
parent 30136ab3e9
commit ae3dc273c4
18 changed files with 4153 additions and 4156 deletions

View file

@ -104,8 +104,9 @@ static int handleXErrors(Display *d, XErrorEvent *e) {
char errtxt[128]; char errtxt[128];
XGetErrorText(d, e->error_code, errtxt, 128); XGetErrorText(d, e->error_code, errtxt, 128);
fprintf(stderr, i18n->getMessage(BaseDisplaySet, BaseDisplayXError, fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayXError,
"%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n"), "%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n"
),
base_display->getApplicationName(), errtxt, e->error_code, base_display->getApplicationName(), errtxt, e->error_code,
e->request_code, e->minor_code, e->resourceid); e->request_code, e->minor_code, e->resourceid);
#endif // DEBUG #endif // DEBUG
@ -150,7 +151,7 @@ static void signalhandler(int sig) {
return; return;
} }
fprintf(stderr, i18n->getMessage(BaseDisplaySet, BaseDisplaySignalCaught, fprintf(stderr, i18n(BaseDisplaySet, BaseDisplaySignalCaught,
"%s: signal %d caught\n"), "%s: signal %d caught\n"),
base_display->getApplicationName(), sig); base_display->getApplicationName(), sig);
@ -158,13 +159,13 @@ static void signalhandler(int sig) {
internal_error = True; internal_error = True;
re_enter = 1; re_enter = 1;
fprintf(stderr, i18n->getMessage(BaseDisplaySet, BaseDisplayShuttingDown, fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayShuttingDown,
"shutting down\n")); "shutting down\n"));
base_display->shutdown(); base_display->shutdown();
} }
if (sig != SIGTERM && sig != SIGINT) { if (sig != SIGTERM && sig != SIGINT) {
fprintf(stderr, i18n->getMessage(BaseDisplaySet, BaseDisplayAborting, fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayAborting,
"aborting... dumping core\n")); "aborting... dumping core\n"));
abort(); abort();
} }
@ -234,12 +235,12 @@ BaseDisplay::BaseDisplay(const char *app_name, char *dpy_name) {
#endif // HAVE_SIGACTION #endif // HAVE_SIGACTION
if (! (display = XOpenDisplay(dpy_name))) { if (! (display = XOpenDisplay(dpy_name))) {
fprintf(stderr, i18n->getMessage(BaseDisplaySet, BaseDisplayXConnectFail, fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayXConnectFail,
"BaseDisplay::BaseDisplay: connection to X server failed.\n")); "BaseDisplay::BaseDisplay: connection to X server failed.\n"));
::exit(2); ::exit(2);
} else if (fcntl(ConnectionNumber(display), F_SETFD, 1) == -1) { } else if (fcntl(ConnectionNumber(display), F_SETFD, 1) == -1) {
fprintf(stderr, fprintf(stderr,
i18n->getMessage(BaseDisplaySet, BaseDisplayCloseOnExecFail, i18n(BaseDisplaySet, BaseDisplayCloseOnExecFail,
"BaseDisplay::BaseDisplay: couldn't mark display connection " "BaseDisplay::BaseDisplay: couldn't mark display connection "
"as close-on-exec\n")); "as close-on-exec\n"));
::exit(2); ::exit(2);
@ -409,7 +410,7 @@ void BaseDisplay::eventLoop(void) {
if (last_bad_window != None && e.xany.window == last_bad_window) { if (last_bad_window != None && e.xany.window == last_bad_window) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, i18n->getMessage(BaseDisplaySet, fprintf(stderr, i18n(BaseDisplaySet,
BaseDisplayBadWindowRemove, BaseDisplayBadWindowRemove,
"BaseDisplay::eventLoop(): removing bad window " "BaseDisplay::eventLoop(): removing bad window "
"from event queue\n")); "from event queue\n"));

View file

@ -87,7 +87,7 @@ Basemenu::Basemenu(BScreen &scrn) : openbox(scrn.getOpenbox()), screen(scrn) {
menu.bevel_w = screen.getBevelWidth(); menu.bevel_w = screen.getBevelWidth();
if (i18n->multibyte()) if (i18n.multibyte())
menu.width = menu.title_h = menu.item_w = menu.frame_h = menu.width = menu.title_h = menu.item_w = menu.frame_h =
screen.getMenuStyle()->t_fontset_extents->max_ink_extent.height + screen.getMenuStyle()->t_fontset_extents->max_ink_extent.height +
(menu.bevel_w * 2); (menu.bevel_w * 2);
@ -103,7 +103,7 @@ Basemenu::Basemenu(BScreen &scrn) : openbox(scrn.getOpenbox()), screen(scrn) {
menu.minsub = 0; menu.minsub = 0;
MenuStyle *style = screen.getMenuStyle(); MenuStyle *style = screen.getMenuStyle();
if (i18n->multibyte()) { if (i18n.multibyte()) {
menu.item_h = style->f_fontset_extents->max_ink_extent.height + menu.item_h = style->f_fontset_extents->max_ink_extent.height +
(menu.bevel_w); (menu.bevel_w);
} else { } else {
@ -269,7 +269,7 @@ int Basemenu::remove(int index) {
void Basemenu::update(void) { void Basemenu::update(void) {
MenuStyle *style = screen.getMenuStyle(); MenuStyle *style = screen.getMenuStyle();
if (i18n->multibyte()) { if (i18n.multibyte()) {
menu.item_h = style->f_fontset_extents->max_ink_extent.height + menu.item_h = style->f_fontset_extents->max_ink_extent.height +
menu.bevel_w; menu.bevel_w;
menu.title_h = style->t_fontset_extents->max_ink_extent.height + menu.title_h = style->t_fontset_extents->max_ink_extent.height +
@ -283,12 +283,12 @@ void Basemenu::update(void) {
if (title_vis) { if (title_vis) {
const char *s = (menu.label) ? menu.label : const char *s = (menu.label) ? menu.label :
i18n->getMessage(BasemenuSet, BasemenuOpenboxMenu, i18n(BasemenuSet, BasemenuOpenboxMenu,
"Openbox Menu"); "Openbox Menu");
int l = strlen(s); int l = strlen(s);
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getMenuStyle()->t_fontset, s, l, &ink, &logical); XmbTextExtents(screen.getMenuStyle()->t_fontset, s, l, &ink, &logical);
menu.item_w = logical.width; menu.item_w = logical.width;
@ -308,7 +308,7 @@ void Basemenu::update(void) {
(((*it)->l) ? (*it)->l : (const char *) 0)); (((*it)->l) ? (*it)->l : (const char *) 0));
int l = strlen(s); int l = strlen(s);
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getMenuStyle()->f_fontset, s, l, &ink, &logical); XmbTextExtents(screen.getMenuStyle()->f_fontset, s, l, &ink, &logical);
ii = logical.width; ii = logical.width;
@ -487,12 +487,12 @@ void Basemenu::move(int x, int y) {
void Basemenu::redrawTitle(void) { void Basemenu::redrawTitle(void) {
char *text = (char *) ((menu.label) ? menu.label : char *text = (char *) ((menu.label) ? menu.label :
i18n->getMessage(BasemenuSet, BasemenuOpenboxMenu, i18n(BasemenuSet, BasemenuOpenboxMenu,
"Openbox Menu")); "Openbox Menu"));
int dx = menu.bevel_w, len = strlen(text); int dx = menu.bevel_w, len = strlen(text);
unsigned int l; unsigned int l;
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getMenuStyle()->t_fontset, text, len, &ink, &logical); XmbTextExtents(screen.getMenuStyle()->t_fontset, text, len, &ink, &logical);
l = logical.width; l = logical.width;
@ -513,7 +513,7 @@ void Basemenu::redrawTitle(void) {
} }
MenuStyle *style = screen.getMenuStyle(); MenuStyle *style = screen.getMenuStyle();
if (i18n->multibyte()) if (i18n.multibyte())
XmbDrawString(display, menu.title, style->t_fontset, style->t_text_gc, dx, XmbDrawString(display, menu.title, style->t_fontset, style->t_text_gc, dx,
(menu.bevel_w - style->t_fontset_extents->max_ink_extent.y), (menu.bevel_w - style->t_fontset_extents->max_ink_extent.y),
text, len); text, len);
@ -610,7 +610,7 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear,
unsigned int half_w = menu.item_h / 2, quarter_w = menu.item_h / 4; unsigned int half_w = menu.item_h / 2, quarter_w = menu.item_h / 4;
if (text) { if (text) {
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getMenuStyle()->f_fontset, XmbTextExtents(screen.getMenuStyle()->f_fontset,
text, len, &ink, &logical); text, len, &ink, &logical);
@ -706,7 +706,7 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear,
} }
if (dotext && text) { if (dotext && text) {
if (i18n->multibyte()) if (i18n.multibyte())
XmbDrawString(display, menu.frame, screen.getMenuStyle()->f_fontset, XmbDrawString(display, menu.frame, screen.getMenuStyle()->f_fontset,
tgc, text_x, text_y, text, len); tgc, text_x, text_y, text, len);
else else

View file

@ -39,28 +39,28 @@
Configmenu::Configmenu(BScreen &scr) : Basemenu(scr), screen(scr) Configmenu::Configmenu(BScreen &scr) : Basemenu(scr), screen(scr)
{ {
setLabel(i18n->getMessage(ConfigmenuSet, ConfigmenuConfigOptions, setLabel(i18n(ConfigmenuSet, ConfigmenuConfigOptions,
"Config options")); "Config options"));
setInternalMenu(); setInternalMenu();
focusmenu = new Focusmenu(this); focusmenu = new Focusmenu(this);
placementmenu = new Placementmenu(this); placementmenu = new Placementmenu(this);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuFocusModel, insert(i18n(ConfigmenuSet, ConfigmenuFocusModel,
"Focus Model"), focusmenu); "Focus Model"), focusmenu);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuWindowPlacement, insert(i18n(ConfigmenuSet, ConfigmenuWindowPlacement,
"Window Placement"), placementmenu); "Window Placement"), placementmenu);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuImageDithering, insert(i18n(ConfigmenuSet, ConfigmenuImageDithering,
"Image Dithering"), 1); "Image Dithering"), 1);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuOpaqueMove, insert(i18n(ConfigmenuSet, ConfigmenuOpaqueMove,
"Opaque Window Moving"), 2); "Opaque Window Moving"), 2);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuFullMax, insert(i18n(ConfigmenuSet, ConfigmenuFullMax,
"Full Maximization"), 3); "Full Maximization"), 3);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuFocusNew, insert(i18n(ConfigmenuSet, ConfigmenuFocusNew,
"Focus New Windows"), 4); "Focus New Windows"), 4);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuFocusLast, insert(i18n(ConfigmenuSet, ConfigmenuFocusLast,
"Focus Last Window on Workspace"), 5); "Focus Last Window on Workspace"), 5);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuHideToolbar, insert(i18n(ConfigmenuSet, ConfigmenuHideToolbar,
"Hide toolbar"), 6); "Hide toolbar"), 6);
update(); update();
@ -145,15 +145,15 @@ void Configmenu::reconfigure() {
Configmenu::Focusmenu::Focusmenu(Configmenu *cm) : Basemenu(cm->screen) { Configmenu::Focusmenu::Focusmenu(Configmenu *cm) : Basemenu(cm->screen) {
configmenu = cm; configmenu = cm;
setLabel(i18n->getMessage(ConfigmenuSet, ConfigmenuFocusModel, setLabel(i18n(ConfigmenuSet, ConfigmenuFocusModel,
"Focus Model")); "Focus Model"));
setInternalMenu(); setInternalMenu();
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuClickToFocus, insert(i18n(ConfigmenuSet, ConfigmenuClickToFocus,
"Click To Focus"), 1); "Click To Focus"), 1);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuSloppyFocus, insert(i18n(ConfigmenuSet, ConfigmenuSloppyFocus,
"Sloppy Focus"), 2); "Sloppy Focus"), 2);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuAutoRaise, insert(i18n(ConfigmenuSet, ConfigmenuAutoRaise,
"Auto Raise"), 3); "Auto Raise"), 3);
update(); update();
@ -210,33 +210,33 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
Basemenu(cm->screen) { Basemenu(cm->screen) {
configmenu = cm; configmenu = cm;
setLabel(i18n->getMessage(ConfigmenuSet, ConfigmenuWindowPlacement, setLabel(i18n(ConfigmenuSet, ConfigmenuWindowPlacement,
"Window Placement")); "Window Placement"));
setInternalMenu(); setInternalMenu();
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuSmartRows, insert(i18n(ConfigmenuSet, ConfigmenuSmartRows,
"Smart Placement (Rows)"), "Smart Placement (Rows)"),
BScreen::RowSmartPlacement); BScreen::RowSmartPlacement);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuSmartCols, insert(i18n(ConfigmenuSet, ConfigmenuSmartCols,
"Smart Placement (Columns)"), "Smart Placement (Columns)"),
BScreen::ColSmartPlacement); BScreen::ColSmartPlacement);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuCascade, insert(i18n(ConfigmenuSet, ConfigmenuCascade,
"Cascade Placement"), BScreen::CascadePlacement); "Cascade Placement"), BScreen::CascadePlacement);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuBestFit, insert(i18n(ConfigmenuSet, ConfigmenuBestFit,
"Best Fit Placement"), BScreen::BestFitPlacement); "Best Fit Placement"), BScreen::BestFitPlacement);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuUnderMouse, insert(i18n(ConfigmenuSet, ConfigmenuUnderMouse,
"Under Mouse Placement"), "Under Mouse Placement"),
BScreen::UnderMousePlacement); BScreen::UnderMousePlacement);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuClickMouse, insert(i18n(ConfigmenuSet, ConfigmenuClickMouse,
"Click Mouse Placement"), "Click Mouse Placement"),
BScreen::ClickMousePlacement); BScreen::ClickMousePlacement);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuLeftRight, insert(i18n(ConfigmenuSet, ConfigmenuLeftRight,
"Left to Right"), BScreen::LeftRight); "Left to Right"), BScreen::LeftRight);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuRightLeft, insert(i18n(ConfigmenuSet, ConfigmenuRightLeft,
"Right to Left"), BScreen::RightLeft); "Right to Left"), BScreen::RightLeft);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuTopBottom, insert(i18n(ConfigmenuSet, ConfigmenuTopBottom,
"Top to Bottom"), BScreen::TopBottom); "Top to Bottom"), BScreen::TopBottom);
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuBottomTop, insert(i18n(ConfigmenuSet, ConfigmenuBottomTop,
"Bottom to Top"), BScreen::BottomTop); "Bottom to Top"), BScreen::BottomTop);
update(); update();

View file

@ -39,7 +39,7 @@
Iconmenu::Iconmenu(BScreen &scrn) : Basemenu(scrn), screen(scrn) { Iconmenu::Iconmenu(BScreen &scrn) : Basemenu(scrn), screen(scrn) {
setInternalMenu(); setInternalMenu();
setLabel(i18n->getMessage(IconSet, IconIcons, "Icons")); setLabel(i18n(IconSet, IconIcons, "Icons"));
update(); update();
} }

View file

@ -131,7 +131,7 @@ Pixmap BImage::render_solid(BTexture *texture) {
control.getDrawable(), width, control.getDrawable(), width,
height, control.getDepth()); height, control.getDepth());
if (pixmap == None) { if (pixmap == None) {
fprintf(stderr, i18n->getMessage(ImageSet, ImageErrorCreatingSolidPixmap, fprintf(stderr, i18n(ImageSet, ImageErrorCreatingSolidPixmap,
"BImage::render_solid: error creating pixmap\n")); "BImage::render_solid: error creating pixmap\n"));
return None; return None;
} }
@ -274,7 +274,7 @@ XImage *BImage::renderXImage(void) {
width, height, 32, 0); width, height, 32, 0);
if (! image) { if (! image) {
fprintf(stderr, i18n->getMessage(ImageSet, ImageErrorCreatingXImage, fprintf(stderr, i18n(ImageSet, ImageErrorCreatingXImage,
"BImage::renderXImage: error creating XImage\n")); "BImage::renderXImage: error creating XImage\n"));
return (XImage *) 0; return (XImage *) 0;
} }
@ -507,7 +507,7 @@ XImage *BImage::renderXImage(void) {
break; } break; }
default: default:
fprintf(stderr, i18n->getMessage(ImageSet, ImageUnsupVisual, fprintf(stderr, i18n(ImageSet, ImageUnsupVisual,
"BImage::renderXImage: unsupported visual\n")); "BImage::renderXImage: unsupported visual\n"));
delete [] d; delete [] d;
XDestroyImage(image); XDestroyImage(image);
@ -607,7 +607,7 @@ XImage *BImage::renderXImage(void) {
break; break;
default: default:
fprintf(stderr, i18n->getMessage(ImageSet, ImageUnsupVisual, fprintf(stderr, i18n(ImageSet, ImageUnsupVisual,
"BImage::renderXImage: unsupported visual\n")); "BImage::renderXImage: unsupported visual\n"));
delete [] d; delete [] d;
XDestroyImage(image); XDestroyImage(image);
@ -626,7 +626,7 @@ Pixmap BImage::renderPixmap(void) {
control.getDrawable(), width, height, control.getDepth()); control.getDrawable(), width, height, control.getDepth());
if (pixmap == None) { if (pixmap == None) {
fprintf(stderr, i18n->getMessage(ImageSet, ImageErrorCreatingPixmap, fprintf(stderr, i18n(ImageSet, ImageErrorCreatingPixmap,
"BImage::renderPixmap: error creating pixmap\n")); "BImage::renderPixmap: error creating pixmap\n"));
return None; return None;
} }
@ -1853,7 +1853,7 @@ BImageControl::BImageControl(BaseDisplay &dpy, ScreenInfo &scrn, Bool _dither,
} }
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) {
fprintf(stderr, i18n->getMessage(ImageSet, ImageInvalidColormapSize, fprintf(stderr, i18n(ImageSet, ImageInvalidColormapSize,
"BImageControl::BImageControl: invalid colormap size %d " "BImageControl::BImageControl: invalid colormap size %d "
"(%d/%d/%d) - reducing"), "(%d/%d/%d) - reducing"),
ncolors, colors_per_channel, colors_per_channel, ncolors, colors_per_channel, colors_per_channel,
@ -1864,7 +1864,7 @@ BImageControl::BImageControl(BaseDisplay &dpy, ScreenInfo &scrn, Bool _dither,
colors = new XColor[ncolors]; colors = new XColor[ncolors];
if (! colors) { if (! colors) {
fprintf(stderr, i18n->getMessage(ImageSet, fprintf(stderr, i18n(ImageSet,
ImageErrorAllocatingColormap, ImageErrorAllocatingColormap,
"BImageControl::BImageControl: error allocating " "BImageControl::BImageControl: error allocating "
"colormap\n")); "colormap\n"));
@ -1898,7 +1898,7 @@ BImageControl::BImageControl(BaseDisplay &dpy, ScreenInfo &scrn, Bool _dither,
for (i = 0; i < ncolors; i++) for (i = 0; i < ncolors; i++)
if (! XAllocColor(basedisplay.getXDisplay(), colormap, &colors[i])) { if (! XAllocColor(basedisplay.getXDisplay(), colormap, &colors[i])) {
fprintf(stderr, i18n->getMessage(ImageSet, ImageColorAllocFail, fprintf(stderr, i18n(ImageSet, ImageColorAllocFail,
"couldn't alloc color %i %i %i\n"), "couldn't alloc color %i %i %i\n"),
colors[i].red, colors[i].green, colors[i].blue); colors[i].red, colors[i].green, colors[i].blue);
colors[i].flags = 0; colors[i].flags = 0;
@ -1965,7 +1965,7 @@ BImageControl::BImageControl(BaseDisplay &dpy, ScreenInfo &scrn, Bool _dither,
} }
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) {
fprintf(stderr, i18n->getMessage(ImageSet, ImageInvalidColormapSize, fprintf(stderr, i18n(ImageSet, ImageInvalidColormapSize,
"BImageControl::BImageControl: invalid colormap size %d " "BImageControl::BImageControl: invalid colormap size %d "
"(%d/%d/%d) - reducing"), "(%d/%d/%d) - reducing"),
ncolors, colors_per_channel, colors_per_channel, ncolors, colors_per_channel, colors_per_channel,
@ -1976,7 +1976,7 @@ BImageControl::BImageControl(BaseDisplay &dpy, ScreenInfo &scrn, Bool _dither,
colors = new XColor[ncolors]; colors = new XColor[ncolors];
if (! colors) { if (! colors) {
fprintf(stderr, i18n->getMessage(ImageSet, fprintf(stderr, i18n(ImageSet,
ImageErrorAllocatingColormap, ImageErrorAllocatingColormap,
"BImageControl::BImageControl: error allocating " "BImageControl::BImageControl: error allocating "
"colormap\n")); "colormap\n"));
@ -1999,7 +1999,7 @@ BImageControl::BImageControl(BaseDisplay &dpy, ScreenInfo &scrn, Bool _dither,
if (! XAllocColor(basedisplay.getXDisplay(), colormap, if (! XAllocColor(basedisplay.getXDisplay(), colormap,
&colors[i])) { &colors[i])) {
fprintf(stderr, i18n->getMessage(ImageSet, ImageColorAllocFail, fprintf(stderr, i18n(ImageSet, ImageColorAllocFail,
"couldn't alloc color %i %i %i\n"), "couldn't alloc color %i %i %i\n"),
colors[i].red, colors[i].green, colors[i].blue); colors[i].red, colors[i].green, colors[i].blue);
colors[i].flags = 0; colors[i].flags = 0;
@ -2052,7 +2052,7 @@ BImageControl::BImageControl(BaseDisplay &dpy, ScreenInfo &scrn, Bool _dither,
} }
default: default:
fprintf(stderr, i18n->getMessage(ImageSet, ImageUnsupVisual, fprintf(stderr, i18n(ImageSet, ImageUnsupVisual,
"BImageControl::BImageControl: unsupported visual %d\n"), "BImageControl::BImageControl: unsupported visual %d\n"),
getVisual()->c_class); getVisual()->c_class);
exit(1); exit(1);
@ -2087,7 +2087,7 @@ BImageControl::~BImageControl(void) {
if (!cache.empty()) { if (!cache.empty()) {
int i, n = cache.size(); int i, n = cache.size();
fprintf(stderr, i18n->getMessage(ImageSet, ImagePixmapRelease, fprintf(stderr, i18n(ImageSet, ImagePixmapRelease,
"BImageContol::~BImageControl: pixmap cache - " "BImageContol::~BImageControl: pixmap cache - "
"releasing %d pixmaps\n"), n); "releasing %d pixmaps\n"), n);
@ -2164,7 +2164,7 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
if ((unsigned) cache.size() > cache_max) { if ((unsigned) cache.size() > cache_max) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, i18n->getMessage(ImageSet, ImagePixmapCacheLarge, fprintf(stderr, i18n(ImageSet, ImagePixmapCacheLarge,
"BImageControl::renderImage: cache is large, " "BImageControl::renderImage: cache is large, "
"forcing cleanout\n")); "forcing cleanout\n"));
#endif // DEBUG #endif // DEBUG

View file

@ -109,7 +109,7 @@ using std::ends;
static Bool running = True; static Bool running = True;
static int anotherWMRunning(Display *display, XErrorEvent *) { static int anotherWMRunning(Display *display, XErrorEvent *) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenAnotherWMRunning, fprintf(stderr, i18n(ScreenSet, ScreenAnotherWMRunning,
"BScreen::BScreen: an error occured while querying the X server.\n" "BScreen::BScreen: an error occured while querying the X server.\n"
" another window manager already running on display %s.\n"), " another window manager already running on display %s.\n"),
DisplayString(display)); DisplayString(display));
@ -204,7 +204,7 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
managed = running; managed = running;
if (! managed) return; if (! managed) return;
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenManagingScreen, fprintf(stderr, i18n(ScreenSet, ScreenManagingScreen,
"BScreen::BScreen: managing screen %d " "BScreen::BScreen: managing screen %d "
"using visual 0x%lx, depth %d\n"), "using visual 0x%lx, depth %d\n"),
getScreenNumber(), XVisualIDFromVisual(getVisual()), getScreenNumber(), XVisualIDFromVisual(getVisual()),
@ -250,7 +250,7 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
XGCValues gcv; XGCValues gcv;
unsigned long gc_value_mask = GCForeground; unsigned long gc_value_mask = GCForeground;
if (! i18n->multibyte()) gc_value_mask |= GCFont; if (! i18n.multibyte()) gc_value_mask |= GCFont;
gcv.foreground = WhitePixel(getBaseDisplay().getXDisplay(), gcv.foreground = WhitePixel(getBaseDisplay().getXDisplay(),
getScreenNumber()) getScreenNumber())
@ -336,11 +336,11 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(),
gc_value_mask, &gcv); gc_value_mask, &gcv);
const char *s = i18n->getMessage(ScreenSet, ScreenPositionLength, const char *s = i18n(ScreenSet, ScreenPositionLength,
"0: 0000 x 0: 0000"); "0: 0000 x 0: 0000");
int l = strlen(s); int l = strlen(s);
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(resource.wstyle.fontset, s, l, &ink, &logical); XmbTextExtents(resource.wstyle.fontset, s, l, &ink, &logical);
geom_w = logical.width; geom_w = logical.width;
@ -413,7 +413,7 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
} }
saveWorkspaceNames(); saveWorkspaceNames();
workspacemenu->insert(i18n->getMessage(IconSet, IconIcons, "Icons"), workspacemenu->insert(i18n(IconSet, IconIcons, "Icons"),
iconmenu); iconmenu);
workspacemenu->update(); workspacemenu->update();
@ -811,7 +811,7 @@ void BScreen::readDatabaseFontSet(const char *rname, const char *rclass,
*fontset = createFontSet(defaultFont); *fontset = createFontSet(defaultFont);
if (! *fontset) { if (! *fontset) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenDefaultFontLoadFail, fprintf(stderr, i18n(ScreenSet, ScreenDefaultFontLoadFail,
"BScreen::LoadStyle(): couldn't load default font.\n")); "BScreen::LoadStyle(): couldn't load default font.\n"));
exit(2); exit(2);
} }
@ -833,7 +833,7 @@ void BScreen::readDatabaseFont(const char *rname, const char *rclass,
if (resource.styleconfig.getValue(rname, rclass, s)) { if (resource.styleconfig.getValue(rname, rclass, s)) {
if ((*font = XLoadQueryFont(getBaseDisplay().getXDisplay(), if ((*font = XLoadQueryFont(getBaseDisplay().getXDisplay(),
s.c_str())) == NULL) { s.c_str())) == NULL) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenFontLoadFail, fprintf(stderr, i18n(ScreenSet, ScreenFontLoadFail,
"BScreen::LoadStyle(): couldn't load font '%s'\n"), "BScreen::LoadStyle(): couldn't load font '%s'\n"),
s.c_str()); s.c_str());
load_default = true; load_default = true;
@ -844,7 +844,7 @@ void BScreen::readDatabaseFont(const char *rname, const char *rclass,
if (load_default) { if (load_default) {
if ((*font = XLoadQueryFont(getBaseDisplay().getXDisplay(), if ((*font = XLoadQueryFont(getBaseDisplay().getXDisplay(),
defaultFont)) == NULL) { defaultFont)) == NULL) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenDefaultFontLoadFail, fprintf(stderr, i18n(ScreenSet, ScreenDefaultFontLoadFail,
"BScreen::LoadStyle(): couldn't load default font.\n")); "BScreen::LoadStyle(): couldn't load default font.\n"));
exit(2); exit(2);
} }
@ -1403,7 +1403,7 @@ void BScreen::reconfigure(void) {
XGCValues gcv; XGCValues gcv;
unsigned long gc_value_mask = GCForeground; unsigned long gc_value_mask = GCForeground;
if (! i18n->multibyte()) gc_value_mask |= GCFont; if (! i18n.multibyte()) gc_value_mask |= GCFont;
gcv.foreground = WhitePixel(getBaseDisplay().getXDisplay(), gcv.foreground = WhitePixel(getBaseDisplay().getXDisplay(),
getScreenNumber()); getScreenNumber());
@ -1472,11 +1472,11 @@ void BScreen::reconfigure(void) {
XChangeGC(getBaseDisplay().getXDisplay(), resource.tstyle.b_pic_gc, XChangeGC(getBaseDisplay().getXDisplay(), resource.tstyle.b_pic_gc,
gc_value_mask, &gcv); gc_value_mask, &gcv);
const char *s = i18n->getMessage(ScreenSet, ScreenPositionLength, const char *s = i18n(ScreenSet, ScreenPositionLength,
"0: 0000 x 0: 0000"); "0: 0000 x 0: 0000");
int l = strlen(s); int l = strlen(s);
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(resource.wstyle.fontset, s, l, &ink, &logical); XmbTextExtents(resource.wstyle.fontset, s, l, &ink, &logical);
geom_w = logical.width; geom_w = logical.width;
@ -1580,7 +1580,7 @@ void BScreen::LoadStyle(void) {
if (!loaded) { if (!loaded) {
conf.setFile(DEFAULTSTYLE); conf.setFile(DEFAULTSTYLE);
if (!conf.load()) { if (!conf.load()) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenDefaultStyleLoadFail, fprintf(stderr, i18n(ScreenSet, ScreenDefaultStyleLoadFail,
"BScreen::LoadStyle(): couldn't load " "BScreen::LoadStyle(): couldn't load "
"default style.\n")); "default style.\n"));
exit(2); exit(2);
@ -1592,7 +1592,7 @@ void BScreen::LoadStyle(void) {
// load fonts/fontsets // load fonts/fontsets
if (i18n->multibyte()) { if (i18n.multibyte()) {
readDatabaseFontSet("window.font", "Window.Font", readDatabaseFontSet("window.font", "Window.Font",
&resource.wstyle.fontset); &resource.wstyle.fontset);
readDatabaseFontSet("toolbar.font", "Toolbar.Font", readDatabaseFontSet("toolbar.font", "Toolbar.Font",
@ -2285,7 +2285,7 @@ void BScreen::InitMenu(void) {
if (menu_filename) { if (menu_filename) {
if (feof(menu_file)) { if (feof(menu_file)) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenEmptyMenuFile, fprintf(stderr, i18n(ScreenSet, ScreenEmptyMenuFile,
"%s: Empty menu file"), menu_filename); "%s: Empty menu file"), menu_filename);
menu_filename = (char *) 0; menu_filename = (char *) 0;
} else { } else {
@ -2335,12 +2335,12 @@ void BScreen::InitMenu(void) {
if (defaultMenu) { if (defaultMenu) {
rootmenu->setInternalMenu(); rootmenu->setInternalMenu();
rootmenu->insert(i18n->getMessage(ScreenSet, Screenxterm, "xterm"), rootmenu->insert(i18n(ScreenSet, Screenxterm, "xterm"),
BScreen::Execute, BScreen::Execute,
i18n->getMessage(ScreenSet, Screenxterm, "xterm")); i18n(ScreenSet, Screenxterm, "xterm"));
rootmenu->insert(i18n->getMessage(ScreenSet, ScreenRestart, "Restart"), rootmenu->insert(i18n(ScreenSet, ScreenRestart, "Restart"),
BScreen::Restart); BScreen::Restart);
rootmenu->insert(i18n->getMessage(ScreenSet, ScreenExit, "Exit"), rootmenu->insert(i18n(ScreenSet, ScreenExit, "Exit"),
BScreen::Exit); BScreen::Exit);
} }
} }
@ -2427,7 +2427,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
case 421: // exec case 421: // exec
if ((! *label) && (! *command)) { if ((! *label) && (! *command)) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenEXECError, fprintf(stderr, i18n(ScreenSet, ScreenEXECError,
"BScreen::parseMenuFile: [exec] error, " "BScreen::parseMenuFile: [exec] error, "
"no menu label and/or command defined\n")); "no menu label and/or command defined\n"));
continue; continue;
@ -2439,7 +2439,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
case 442: // exit case 442: // exit
if (! *label) { if (! *label) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenEXITError, fprintf(stderr, i18n(ScreenSet, ScreenEXITError,
"BScreen::parseMenuFile: [exit] error, " "BScreen::parseMenuFile: [exit] error, "
"no menu label defined\n")); "no menu label defined\n"));
continue; continue;
@ -2452,7 +2452,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
case 561: // style case 561: // style
{ {
if ((! *label) || (! *command)) { if ((! *label) || (! *command)) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenSTYLEError, fprintf(stderr, i18n(ScreenSet, ScreenSTYLEError,
"BScreen::parseMenuFile: [style] error, " "BScreen::parseMenuFile: [style] error, "
"no menu label and/or filename defined\n")); "no menu label and/or filename defined\n"));
continue; continue;
@ -2486,7 +2486,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
case 630: // config case 630: // config
if (! *label) { if (! *label) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenCONFIGError, fprintf(stderr, i18n(ScreenSet, ScreenCONFIGError,
"BScreen::parseMenufile: [config] error, " "BScreen::parseMenufile: [config] error, "
"no label defined")); "no label defined"));
continue; continue;
@ -2499,7 +2499,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
case 740: // include case 740: // include
{ {
if (! *label) { if (! *label) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenINCLUDEError, fprintf(stderr, i18n(ScreenSet, ScreenINCLUDEError,
"BScreen::parseMenuFile: [include] error, " "BScreen::parseMenuFile: [include] error, "
"no filename defined\n")); "no filename defined\n"));
continue; continue;
@ -2534,7 +2534,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
if (fstat(fileno(submenufile), &buf) || if (fstat(fileno(submenufile), &buf) ||
(! S_ISREG(buf.st_mode))) { (! S_ISREG(buf.st_mode))) {
fprintf(stderr, fprintf(stderr,
i18n->getMessage(ScreenSet, ScreenINCLUDEErrorReg, i18n(ScreenSet, ScreenINCLUDEErrorReg,
"BScreen::parseMenuFile: [include] error: " "BScreen::parseMenuFile: [include] error: "
"'%s' is not a regular file\n"), newfile); "'%s' is not a regular file\n"), newfile);
break; break;
@ -2555,7 +2555,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
case 767: // submenu case 767: // submenu
{ {
if (! *label) { if (! *label) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenSUBMENUError, fprintf(stderr, i18n(ScreenSet, ScreenSUBMENUError,
"BScreen::parseMenuFile: [submenu] error, " "BScreen::parseMenuFile: [submenu] error, "
"no menu label defined\n")); "no menu label defined\n"));
continue; continue;
@ -2579,7 +2579,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
case 773: // restart case 773: // restart
{ {
if (! *label) { if (! *label) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenRESTARTError, fprintf(stderr, i18n(ScreenSet, ScreenRESTARTError,
"BScreen::parseMenuFile: [restart] error, " "BScreen::parseMenuFile: [restart] error, "
"no menu label defined\n")); "no menu label defined\n"));
continue; continue;
@ -2596,7 +2596,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
case 845: // reconfig case 845: // reconfig
{ {
if (! *label) { if (! *label) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenRECONFIGError, fprintf(stderr, i18n(ScreenSet, ScreenRECONFIGError,
"BScreen::parseMenuFile: [reconfig] error, " "BScreen::parseMenuFile: [reconfig] error, "
"no menu label defined\n")); "no menu label defined\n"));
continue; continue;
@ -2614,7 +2614,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
if ((! *label) || ((! *command) && newmenu)) { if ((! *label) || ((! *command) && newmenu)) {
fprintf(stderr, fprintf(stderr,
i18n->getMessage(ScreenSet, ScreenSTYLESDIRError, i18n(ScreenSet, ScreenSTYLESDIRError,
"BScreen::parseMenuFile: [stylesdir/stylesmenu]" "BScreen::parseMenuFile: [stylesdir/stylesmenu]"
" error, no directory defined\n")); " error, no directory defined\n"));
continue; continue;
@ -2701,7 +2701,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
} }
openbox.addMenuTimestamp(stylesdir); openbox.addMenuTimestamp(stylesdir);
} else { } else {
fprintf(stderr, i18n->getMessage(ScreenSet, fprintf(stderr, i18n(ScreenSet,
ScreenSTYLESDIRErrorNotDir, ScreenSTYLESDIRErrorNotDir,
"BScreen::parseMenuFile:" "BScreen::parseMenuFile:"
" [stylesdir/stylesmenu] error, %s is not a" " [stylesdir/stylesmenu] error, %s is not a"
@ -2709,7 +2709,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
} }
} else { } else {
fprintf(stderr, fprintf(stderr,
i18n->getMessage(ScreenSet, ScreenSTYLESDIRErrorNoExist, i18n(ScreenSet, ScreenSTYLESDIRErrorNoExist,
"BScreen::parseMenuFile: [stylesdir/stylesmenu]" "BScreen::parseMenuFile: [stylesdir/stylesmenu]"
" error, %s does not exist\n"), stylesdir); " error, %s does not exist\n"), stylesdir);
} }
@ -2721,7 +2721,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
{ {
if (! *label) { if (! *label) {
fprintf(stderr, fprintf(stderr,
i18n->getMessage(ScreenSet, ScreenWORKSPACESError, i18n(ScreenSet, ScreenWORKSPACESError,
"BScreen:parseMenuFile: [workspaces] error, " "BScreen:parseMenuFile: [workspaces] error, "
"no menu label defined\n")); "no menu label defined\n"));
continue; continue;
@ -2773,12 +2773,12 @@ void BScreen::showPosition(int x, int y) {
char label[1024]; char label[1024];
sprintf(label, i18n->getMessage(ScreenSet, ScreenPositionFormat, sprintf(label, i18n(ScreenSet, ScreenPositionFormat,
"X: %4d x Y: %4d"), x, y); "X: %4d x Y: %4d"), x, y);
XClearWindow(getBaseDisplay().getXDisplay(), geom_window); XClearWindow(getBaseDisplay().getXDisplay(), geom_window);
if (i18n->multibyte()) { if (i18n.multibyte()) {
XmbDrawString(getBaseDisplay().getXDisplay(), geom_window, XmbDrawString(getBaseDisplay().getXDisplay(), geom_window,
resource.wstyle.fontset, resource.wstyle.l_text_focus_gc, resource.wstyle.fontset, resource.wstyle.l_text_focus_gc,
resource.bevel_width, resource.bevel_width - resource.bevel_width, resource.bevel_width -
@ -2807,12 +2807,12 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
char label[1024]; char label[1024];
sprintf(label, i18n->getMessage(ScreenSet, ScreenGeometryFormat, sprintf(label, i18n(ScreenSet, ScreenGeometryFormat,
"W: %4d x H: %4d"), gx, gy); "W: %4d x H: %4d"), gx, gy);
XClearWindow(getBaseDisplay().getXDisplay(), geom_window); XClearWindow(getBaseDisplay().getXDisplay(), geom_window);
if (i18n->multibyte()) { if (i18n.multibyte()) {
XmbDrawString(getBaseDisplay().getXDisplay(), geom_window, XmbDrawString(getBaseDisplay().getXDisplay(), geom_window,
resource.wstyle.fontset, resource.wstyle.l_text_focus_gc, resource.wstyle.fontset, resource.wstyle.l_text_focus_gc,
resource.bevel_width, resource.bevel_width - resource.bevel_width, resource.bevel_width -

View file

@ -703,18 +703,18 @@ void Slit::timeout(void) {
Slitmenu::Slitmenu(Slit &sl) : Basemenu(sl.screen), slit(sl) { Slitmenu::Slitmenu(Slit &sl) : Basemenu(sl.screen), slit(sl) {
setLabel(i18n->getMessage(SlitSet, SlitSlitTitle, "Slit")); setLabel(i18n(SlitSet, SlitSlitTitle, "Slit"));
setInternalMenu(); setInternalMenu();
directionmenu = new Directionmenu(*this); directionmenu = new Directionmenu(*this);
placementmenu = new Placementmenu(*this); placementmenu = new Placementmenu(*this);
insert(i18n->getMessage(CommonSet, CommonDirectionTitle, "Direction"), insert(i18n(CommonSet, CommonDirectionTitle, "Direction"),
directionmenu); directionmenu);
insert(i18n->getMessage(CommonSet, CommonPlacementTitle, "Placement"), insert(i18n(CommonSet, CommonPlacementTitle, "Placement"),
placementmenu); placementmenu);
insert(i18n->getMessage(CommonSet, CommonAlwaysOnTop, "Always on top"), 1); insert(i18n(CommonSet, CommonAlwaysOnTop, "Always on top"), 1);
insert(i18n->getMessage(CommonSet, CommonAutoHide, "Auto hide"), 2); insert(i18n(CommonSet, CommonAutoHide, "Auto hide"), 2);
update(); update();
@ -779,12 +779,12 @@ void Slitmenu::reconfigure(void) {
Slitmenu::Directionmenu::Directionmenu(Slitmenu &sm) Slitmenu::Directionmenu::Directionmenu(Slitmenu &sm)
: Basemenu(sm.slit.screen), slitmenu(sm) { : Basemenu(sm.slit.screen), slitmenu(sm) {
setLabel(i18n->getMessage(SlitSet, SlitSlitDirection, "Slit Direction")); setLabel(i18n(SlitSet, SlitSlitDirection, "Slit Direction"));
setInternalMenu(); setInternalMenu();
insert(i18n->getMessage(CommonSet, CommonDirectionHoriz, "Horizontal"), insert(i18n(CommonSet, CommonDirectionHoriz, "Horizontal"),
Slit::Horizontal); Slit::Horizontal);
insert(i18n->getMessage(CommonSet, CommonDirectionVert, "Vertical"), insert(i18n(CommonSet, CommonDirectionVert, "Vertical"),
Slit::Vertical); Slit::Vertical);
update(); update();
@ -831,28 +831,28 @@ void Slitmenu::Directionmenu::itemSelected(int button, int index) {
Slitmenu::Placementmenu::Placementmenu(Slitmenu &sm) Slitmenu::Placementmenu::Placementmenu(Slitmenu &sm)
: Basemenu(sm.slit.screen), slitmenu(sm) { : Basemenu(sm.slit.screen), slitmenu(sm) {
setLabel(i18n->getMessage(SlitSet, SlitSlitPlacement, "Slit Placement")); setLabel(i18n(SlitSet, SlitSlitPlacement, "Slit Placement"));
setMinimumSublevels(3); setMinimumSublevels(3);
setInternalMenu(); setInternalMenu();
insert(i18n->getMessage(CommonSet, CommonPlacementTopLeft, "Top Left"), insert(i18n(CommonSet, CommonPlacementTopLeft, "Top Left"),
Slit::TopLeft); Slit::TopLeft);
insert(i18n->getMessage(CommonSet, CommonPlacementCenterLeft, "Center Left"), insert(i18n(CommonSet, CommonPlacementCenterLeft, "Center Left"),
Slit::CenterLeft); Slit::CenterLeft);
insert(i18n->getMessage(CommonSet, CommonPlacementBottomLeft, "Bottom Left"), insert(i18n(CommonSet, CommonPlacementBottomLeft, "Bottom Left"),
Slit::BottomLeft); Slit::BottomLeft);
insert(i18n->getMessage(CommonSet, CommonPlacementTopCenter, "Top Center"), insert(i18n(CommonSet, CommonPlacementTopCenter, "Top Center"),
Slit::TopCenter); Slit::TopCenter);
insert(""); insert("");
insert(i18n->getMessage(CommonSet, CommonPlacementBottomCenter, insert(i18n(CommonSet, CommonPlacementBottomCenter,
"Bottom Center"), "Bottom Center"),
Slit::BottomCenter); Slit::BottomCenter);
insert(i18n->getMessage(CommonSet, CommonPlacementTopRight, "Top Right"), insert(i18n(CommonSet, CommonPlacementTopRight, "Top Right"),
Slit::TopRight); Slit::TopRight);
insert(i18n->getMessage(CommonSet, CommonPlacementCenterRight, insert(i18n(CommonSet, CommonPlacementCenterRight,
"Center Right"), "Center Right"),
Slit::CenterRight); Slit::CenterRight);
insert(i18n->getMessage(CommonSet, CommonPlacementBottomRight, insert(i18n(CommonSet, CommonPlacementBottomRight,
"Bottom Right"), "Bottom Right"),
Slit::BottomRight); Slit::BottomRight);

View file

@ -326,7 +326,7 @@ void Toolbar::reconfigure() {
frame.bevel_w = screen.getBevelWidth(); frame.bevel_w = screen.getBevelWidth();
frame.width = screen.size().w() * m_width_percent / 100; frame.width = screen.size().w() * m_width_percent / 100;
if (i18n->multibyte()) if (i18n.multibyte())
frame.height = frame.height =
screen.getToolbarStyle()->fontset_extents->max_ink_extent.height; screen.getToolbarStyle()->fontset_extents->max_ink_extent.height;
else else
@ -406,7 +406,7 @@ void Toolbar::reconfigure() {
t[len++] = 'A'; // add size to the string for padding t[len++] = 'A'; // add size to the string for padding
t[len] = '\0'; t[len] = '\0';
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getToolbarStyle()->fontset, t, len, &ink, XmbTextExtents(screen.getToolbarStyle()->fontset, t, len, &ink,
&logical); &logical);
@ -440,9 +440,9 @@ void Toolbar::reconfigure() {
#else // !HAVE_STRFTIME #else // !HAVE_STRFTIME
frame.clock_w = frame.clock_w =
XTextWidth(screen.getToolbarStyle()->font, XTextWidth(screen.getToolbarStyle()->font,
i18n->getMessage(ToolbarSet, ToolbarNoStrftimeLength, i18n(ToolbarSet, ToolbarNoStrftimeLength,
"00:00000"), "00:00000"),
strlen(i18n->getMessage(ToolbarSet, ToolbarNoStrftimeLength, strlen(i18n(ToolbarSet, ToolbarNoStrftimeLength,
"00:00000"))) + (frame.bevel_w * 4); "00:00000"))) + (frame.bevel_w * 4);
#endif // HAVE_STRFTIME #endif // HAVE_STRFTIME
@ -451,7 +451,7 @@ void Toolbar::reconfigure() {
frame.workspace_label_w = 0; frame.workspace_label_w = 0;
for (i = 0; i < screen.getWorkspaceCount(); i++) { for (i = 0; i < screen.getWorkspaceCount(); i++) {
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getToolbarStyle()->fontset, XmbTextExtents(screen.getToolbarStyle()->fontset,
screen.getWorkspace(i)->getName(), screen.getWorkspace(i)->getName(),
@ -651,24 +651,24 @@ void Toolbar::checkClock(Bool redraw, Bool date) {
tt->tm_mday, tt->tm_mon + 1, tt->tm_mday, tt->tm_mon + 1,
(tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year);
else else
sprintf(t, i18n->getMessage(ToolbarSet, ToolbarNoStrftimeDateFormat, sprintf(t, i18n(ToolbarSet, ToolbarNoStrftimeDateFormat,
"%02d/%02d/%02d"), "%02d/%02d/%02d"),
tt->tm_mon + 1, tt->tm_mday, tt->tm_mon + 1, tt->tm_mday,
(tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year);
} else { } else {
if (screen.isClock24Hour()) if (screen.isClock24Hour())
sprintf(t, i18n->getMessage(ToolbarSet, ToolbarNoStrftimeTimeFormat24, sprintf(t, i18n(ToolbarSet, ToolbarNoStrftimeTimeFormat24,
" %02d:%02d "), " %02d:%02d "),
frame.hour, frame.minute); frame.hour, frame.minute);
else else
sprintf(t, i18n->getMessage(ToolbarSet, ToolbarNoStrftimeTimeFormat12, sprintf(t, i18n(ToolbarSet, ToolbarNoStrftimeTimeFormat12,
"%02d:%02d %sm"), "%02d:%02d %sm"),
((frame.hour > 12) ? frame.hour - 12 : ((frame.hour > 12) ? frame.hour - 12 :
((frame.hour == 0) ? 12 : frame.hour)), frame.minute, ((frame.hour == 0) ? 12 : frame.hour)), frame.minute,
((frame.hour >= 12) ? ((frame.hour >= 12) ?
i18n->getMessage(ToolbarSet, i18n(ToolbarSet,
ToolbarNoStrftimeTimeFormatP, "p") : ToolbarNoStrftimeTimeFormatP, "p") :
i18n->getMessage(ToolbarSet, i18n(ToolbarSet,
ToolbarNoStrftimeTimeFormatA, "a"))); ToolbarNoStrftimeTimeFormatA, "a")));
} }
#endif // HAVE_STRFTIME #endif // HAVE_STRFTIME
@ -676,7 +676,7 @@ void Toolbar::checkClock(Bool redraw, Bool date) {
int dx = (frame.bevel_w * 2), dlen = strlen(t); int dx = (frame.bevel_w * 2), dlen = strlen(t);
unsigned int l; unsigned int l;
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getToolbarStyle()->fontset, XmbTextExtents(screen.getToolbarStyle()->fontset,
t, dlen, &ink, &logical); t, dlen, &ink, &logical);
@ -689,7 +689,7 @@ void Toolbar::checkClock(Bool redraw, Bool date) {
if (l > frame.clock_w) { if (l > frame.clock_w) {
for (; dlen >= 0; dlen--) { for (; dlen >= 0; dlen--) {
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getToolbarStyle()->fontset, XmbTextExtents(screen.getToolbarStyle()->fontset,
t, dlen, &ink, &logical); t, dlen, &ink, &logical);
@ -714,7 +714,7 @@ void Toolbar::checkClock(Bool redraw, Bool date) {
} }
ToolbarStyle *style = screen.getToolbarStyle(); ToolbarStyle *style = screen.getToolbarStyle();
if (i18n->multibyte()) if (i18n.multibyte())
XmbDrawString(display, frame.clock, style->fontset, style->c_text_gc, XmbDrawString(display, frame.clock, style->fontset, style->c_text_gc,
dx, (1 - style->fontset_extents->max_ink_extent.y), dx, (1 - style->fontset_extents->max_ink_extent.y),
t, dlen); t, dlen);
@ -738,7 +738,7 @@ void Toolbar::redrawWindowLabel(Bool redraw) {
int dx = (frame.bevel_w * 2), dlen = strlen(*foc->getTitle()); int dx = (frame.bevel_w * 2), dlen = strlen(*foc->getTitle());
unsigned int l; unsigned int l;
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getToolbarStyle()->fontset, *foc->getTitle(), XmbTextExtents(screen.getToolbarStyle()->fontset, *foc->getTitle(),
dlen, &ink, &logical); dlen, &ink, &logical);
@ -750,7 +750,7 @@ void Toolbar::redrawWindowLabel(Bool redraw) {
if (l > frame.window_label_w) { if (l > frame.window_label_w) {
for (; dlen >= 0; dlen--) { for (; dlen >= 0; dlen--) {
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getToolbarStyle()->fontset, XmbTextExtents(screen.getToolbarStyle()->fontset,
*foc->getTitle(), dlen, &ink, &logical); *foc->getTitle(), dlen, &ink, &logical);
@ -776,7 +776,7 @@ void Toolbar::redrawWindowLabel(Bool redraw) {
} }
ToolbarStyle *style = screen.getToolbarStyle(); ToolbarStyle *style = screen.getToolbarStyle();
if (i18n->multibyte()) if (i18n.multibyte())
XmbDrawString(display, frame.window_label, style->fontset, XmbDrawString(display, frame.window_label, style->fontset,
style->w_text_gc, dx, style->w_text_gc, dx,
(1 - style->fontset_extents->max_ink_extent.y), (1 - style->fontset_extents->max_ink_extent.y),
@ -797,7 +797,7 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) {
strlen(screen.getCurrentWorkspace()->getName()); strlen(screen.getCurrentWorkspace()->getName());
unsigned int l; unsigned int l;
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getToolbarStyle()->fontset, XmbTextExtents(screen.getToolbarStyle()->fontset,
screen.getCurrentWorkspace()->getName(), dlen, screen.getCurrentWorkspace()->getName(), dlen,
@ -811,7 +811,7 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) {
if (l > frame.workspace_label_w) { if (l > frame.workspace_label_w) {
for (; dlen >= 0; dlen--) { for (; dlen >= 0; dlen--) {
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getToolbarStyle()->fontset, XmbTextExtents(screen.getToolbarStyle()->fontset,
screen.getCurrentWorkspace()->getName(), dlen, screen.getCurrentWorkspace()->getName(), dlen,
@ -838,7 +838,7 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) {
} }
ToolbarStyle *style = screen.getToolbarStyle(); ToolbarStyle *style = screen.getToolbarStyle();
if (i18n->multibyte()) if (i18n.multibyte())
XmbDrawString(display, frame.workspace_label, style->fontset, XmbDrawString(display, frame.workspace_label, style->fontset,
style->l_text_gc, dx, style->l_text_gc, dx,
(1 - style->fontset_extents->max_ink_extent.y), (1 - style->fontset_extents->max_ink_extent.y),
@ -1217,7 +1217,7 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) {
XClearWindow(display, frame.workspace_label); XClearWindow(display, frame.workspace_label);
int l = strlen(new_workspace_name), tw, x; int l = strlen(new_workspace_name), tw, x;
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen.getToolbarStyle()->fontset, XmbTextExtents(screen.getToolbarStyle()->fontset,
new_workspace_name, l, &ink, &logical); new_workspace_name, l, &ink, &logical);
@ -1231,7 +1231,7 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) {
if (x < (signed) frame.bevel_w) x = frame.bevel_w; if (x < (signed) frame.bevel_w) x = frame.bevel_w;
WindowStyle *style = screen.getWindowStyle(); WindowStyle *style = screen.getWindowStyle();
if (i18n->multibyte()) if (i18n.multibyte())
XmbDrawString(display, frame.workspace_label, style->fontset, XmbDrawString(display, frame.workspace_label, style->fontset,
style->l_text_focus_gc, x, style->l_text_focus_gc, x,
(1 - style->fontset_extents->max_ink_extent.y), (1 - style->fontset_extents->max_ink_extent.y),
@ -1272,16 +1272,16 @@ void Toolbar::HideHandler::timeout() {
Toolbarmenu::Toolbarmenu(Toolbar &tb) : Basemenu(tb.screen), toolbar(tb) { Toolbarmenu::Toolbarmenu(Toolbar &tb) : Basemenu(tb.screen), toolbar(tb) {
setLabel(i18n->getMessage(ToolbarSet, ToolbarToolbarTitle, "Toolbar")); setLabel(i18n(ToolbarSet, ToolbarToolbarTitle, "Toolbar"));
setInternalMenu(); setInternalMenu();
placementmenu = new Placementmenu(*this); placementmenu = new Placementmenu(*this);
insert(i18n->getMessage(CommonSet, CommonPlacementTitle, "Placement"), insert(i18n(CommonSet, CommonPlacementTitle, "Placement"),
placementmenu); placementmenu);
insert(i18n->getMessage(CommonSet, CommonAlwaysOnTop, "Always on top"), 1); insert(i18n(CommonSet, CommonAlwaysOnTop, "Always on top"), 1);
insert(i18n->getMessage(CommonSet, CommonAutoHide, "Auto hide"), 2); insert(i18n(CommonSet, CommonAutoHide, "Auto hide"), 2);
insert(i18n->getMessage(ToolbarSet, ToolbarEditWkspcName, insert(i18n(ToolbarSet, ToolbarEditWkspcName,
"Edit current workspace name"), 3); "Edit current workspace name"), 3);
update(); update();
@ -1355,22 +1355,22 @@ void Toolbarmenu::reconfigure() {
Toolbarmenu::Placementmenu::Placementmenu(Toolbarmenu &tm) Toolbarmenu::Placementmenu::Placementmenu(Toolbarmenu &tm)
: Basemenu(tm.toolbar.screen), toolbarmenu(tm) { : Basemenu(tm.toolbar.screen), toolbarmenu(tm) {
setLabel(i18n->getMessage(ToolbarSet, ToolbarToolbarPlacement, setLabel(i18n(ToolbarSet, ToolbarToolbarPlacement,
"Toolbar Placement")); "Toolbar Placement"));
setInternalMenu(); setInternalMenu();
setMinimumSublevels(3); setMinimumSublevels(3);
insert(i18n->getMessage(CommonSet, CommonPlacementTopLeft, insert(i18n(CommonSet, CommonPlacementTopLeft,
"Top Left"), Toolbar::TopLeft); "Top Left"), Toolbar::TopLeft);
insert(i18n->getMessage(CommonSet, CommonPlacementBottomLeft, insert(i18n(CommonSet, CommonPlacementBottomLeft,
"Bottom Left"), Toolbar::BottomLeft); "Bottom Left"), Toolbar::BottomLeft);
insert(i18n->getMessage(CommonSet, CommonPlacementTopCenter, insert(i18n(CommonSet, CommonPlacementTopCenter,
"Top Center"), Toolbar::TopCenter); "Top Center"), Toolbar::TopCenter);
insert(i18n->getMessage(CommonSet, CommonPlacementBottomCenter, insert(i18n(CommonSet, CommonPlacementBottomCenter,
"Bottom Center"), Toolbar::BottomCenter); "Bottom Center"), Toolbar::BottomCenter);
insert(i18n->getMessage(CommonSet, CommonPlacementTopRight, insert(i18n(CommonSet, CommonPlacementTopRight,
"Top Right"), Toolbar::TopRight); "Top Right"), Toolbar::TopRight);
insert(i18n->getMessage(CommonSet, CommonPlacementBottomRight, insert(i18n(CommonSet, CommonPlacementBottomRight,
"Bottom Right"), Toolbar::BottomRight); "Bottom Right"), Toolbar::BottomRight);
update(); update();
} }

View file

@ -62,7 +62,7 @@
*/ */
OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) { OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, i18n->getMessage(WindowSet, WindowCreating, fprintf(stderr, i18n(WindowSet, WindowCreating,
"OpenboxWindow::OpenboxWindow(): creating 0x%lx\n"), "OpenboxWindow::OpenboxWindow(): creating 0x%lx\n"),
w); w);
#endif // DEBUG #endif // DEBUG
@ -79,7 +79,7 @@ OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) {
(! wattrib.screen) || wattrib.override_redirect) { (! wattrib.screen) || wattrib.override_redirect) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, fprintf(stderr,
i18n->getMessage(WindowSet, WindowXGetWindowAttributesFail, i18n(WindowSet, WindowXGetWindowAttributesFail,
"OpenboxWindow::OpenboxWindow(): XGetWindowAttributes " "OpenboxWindow::OpenboxWindow(): XGetWindowAttributes "
"failed\n")); "failed\n"));
#endif // DEBUG #endif // DEBUG
@ -94,7 +94,7 @@ OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) {
screen = openbox.searchScreen(RootWindowOfScreen(wattrib.screen)); screen = openbox.searchScreen(RootWindowOfScreen(wattrib.screen));
if (! screen) { if (! screen) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, i18n->getMessage(WindowSet, WindowCannotFindScreen, fprintf(stderr, i18n(WindowSet, WindowCannotFindScreen,
"OpenboxWindow::OpenboxWindow(): can't find screen\n" "OpenboxWindow::OpenboxWindow(): can't find screen\n"
"\tfor root window 0x%lx\n"), "\tfor root window 0x%lx\n"),
RootWindowOfScreen(wattrib.screen)); RootWindowOfScreen(wattrib.screen));
@ -815,7 +815,7 @@ void OpenboxWindow::reconfigure(void) {
frame.border_w; frame.border_w;
if (client.title) { if (client.title) {
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen->getWindowStyle()->fontset, XmbTextExtents(screen->getWindowStyle()->fontset,
client.title, client.title_len, &ink, &logical); client.title, client.title_len, &ink, &logical);
@ -917,16 +917,16 @@ void OpenboxWindow::getWMName(void) {
} }
XFree((char *) text_prop.value); XFree((char *) text_prop.value);
} else { } else {
client.title = bstrdup(i18n->getMessage(WindowSet, WindowUnnamed, client.title = bstrdup(i18n(WindowSet, WindowUnnamed,
"Unnamed")); "Unnamed"));
} }
} else { } else {
client.title = bstrdup(i18n->getMessage(WindowSet, WindowUnnamed, client.title = bstrdup(i18n(WindowSet, WindowUnnamed,
"Unnamed")); "Unnamed"));
} }
client.title_len = strlen(client.title); client.title_len = strlen(client.title);
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen->getWindowStyle()->fontset, XmbTextExtents(screen->getWindowStyle()->fontset,
client.title, client.title_len, &ink, &logical); client.title, client.title_len, &ink, &logical);
@ -2040,7 +2040,7 @@ void OpenboxWindow::redrawLabel(void) {
if (client.title_text_w > frame.label_w) { if (client.title_text_w > frame.label_w) {
for (; dlen >= 0; dlen--) { for (; dlen >= 0; dlen--) {
if (i18n->multibyte()) { if (i18n.multibyte()) {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents(screen->getWindowStyle()->fontset, client.title, dlen, XmbTextExtents(screen->getWindowStyle()->fontset, client.title, dlen,
&ink, &logical); &ink, &logical);
@ -2068,7 +2068,7 @@ void OpenboxWindow::redrawLabel(void) {
WindowStyle *style = screen->getWindowStyle(); WindowStyle *style = screen->getWindowStyle();
GC text_gc = (flags.focused) ? style->l_text_focus_gc : GC text_gc = (flags.focused) ? style->l_text_focus_gc :
style->l_text_unfocus_gc; style->l_text_unfocus_gc;
if (i18n->multibyte()) if (i18n.multibyte())
XmbDrawString(display, frame.label, style->fontset, text_gc, dx, XmbDrawString(display, frame.label, style->fontset, text_gc, dx,
(1 - style->fontset_extents->max_ink_extent.y), (1 - style->fontset_extents->max_ink_extent.y),
client.title, dlen); client.title, dlen);
@ -2195,7 +2195,7 @@ void OpenboxWindow::redrawCloseButton(Bool pressed) {
void OpenboxWindow::mapRequestEvent(XMapRequestEvent *re) { void OpenboxWindow::mapRequestEvent(XMapRequestEvent *re) {
if (re->window == client.window) { if (re->window == client.window) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, i18n->getMessage(WindowSet, WindowMapRequest, fprintf(stderr, i18n(WindowSet, WindowMapRequest,
"OpenboxWindow::mapRequestEvent() for 0x%lx\n"), "OpenboxWindow::mapRequestEvent() for 0x%lx\n"),
client.window); client.window);
#endif // DEBUG #endif // DEBUG
@ -2261,7 +2261,7 @@ void OpenboxWindow::mapNotifyEvent(XMapEvent *ne) {
void OpenboxWindow::unmapNotifyEvent(XUnmapEvent *ue) { void OpenboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
if (ue->window == client.window) { if (ue->window == client.window) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, i18n->getMessage(WindowSet, WindowUnmapNotify, fprintf(stderr, i18n(WindowSet, WindowUnmapNotify,
"OpenboxWindow::unmapNotifyEvent() for 0x%lx\n"), "OpenboxWindow::unmapNotifyEvent() for 0x%lx\n"),
client.window); client.window);
#endif // DEBUG #endif // DEBUG
@ -2286,7 +2286,7 @@ void OpenboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify, if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify,
&dummy)) { &dummy)) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, i18n->getMessage(WindowSet, WindowUnmapNotifyReparent, fprintf(stderr, i18n(WindowSet, WindowUnmapNotifyReparent,
"OpenboxWindow::unmapNotifyEvent(): reparent 0x%lx to " "OpenboxWindow::unmapNotifyEvent(): reparent 0x%lx to "
"root.\n"), client.window); "root.\n"), client.window);
#endif // DEBUG #endif // DEBUG
@ -3148,7 +3148,7 @@ void OpenboxWindow::upsize(void) {
// the height of the titlebar is based upon the height of the font being // the height of the titlebar is based upon the height of the font being
// used to display the window's title // used to display the window's title
WindowStyle *style = screen->getWindowStyle(); WindowStyle *style = screen->getWindowStyle();
if (i18n->multibyte()) if (i18n.multibyte())
frame.title_h = (style->fontset_extents->max_ink_extent.height + frame.title_h = (style->fontset_extents->max_ink_extent.height +
(frame.bevel_w * 2) + 2); (frame.bevel_w * 2) + 2);
else else

View file

@ -51,23 +51,23 @@ Windowmenu::Windowmenu(OpenboxWindow &win) : Basemenu(*win.getScreen()),
setInternalMenu(); setInternalMenu();
sendToMenu = new SendtoWorkspacemenu(*this); sendToMenu = new SendtoWorkspacemenu(*this);
insert(i18n->getMessage(WindowmenuSet, WindowmenuSendTo, "Send To ..."), insert(i18n(WindowmenuSet, WindowmenuSendTo, "Send To ..."),
sendToMenu); sendToMenu);
insert(i18n->getMessage(WindowmenuSet, WindowmenuShade, "Shade"), insert(i18n(WindowmenuSet, WindowmenuShade, "Shade"),
BScreen::WindowShade); BScreen::WindowShade);
insert(i18n->getMessage(WindowmenuSet, WindowmenuIconify, "Iconify"), insert(i18n(WindowmenuSet, WindowmenuIconify, "Iconify"),
BScreen::WindowIconify); BScreen::WindowIconify);
insert(i18n->getMessage(WindowmenuSet, WindowmenuMaximize, "Maximize"), insert(i18n(WindowmenuSet, WindowmenuMaximize, "Maximize"),
BScreen::WindowMaximize); BScreen::WindowMaximize);
insert(i18n->getMessage(WindowmenuSet, WindowmenuRaise,"Raise"), insert(i18n(WindowmenuSet, WindowmenuRaise,"Raise"),
BScreen::WindowRaise); BScreen::WindowRaise);
insert(i18n->getMessage(WindowmenuSet, WindowmenuLower, "Lower"), insert(i18n(WindowmenuSet, WindowmenuLower, "Lower"),
BScreen::WindowLower); BScreen::WindowLower);
insert(i18n->getMessage(WindowmenuSet, WindowmenuStick, "Stick"), insert(i18n(WindowmenuSet, WindowmenuStick, "Stick"),
BScreen::WindowStick); BScreen::WindowStick);
insert(i18n->getMessage(WindowmenuSet, WindowmenuKillClient, "Kill Client"), insert(i18n(WindowmenuSet, WindowmenuKillClient, "Kill Client"),
BScreen::WindowKill); BScreen::WindowKill);
insert(i18n->getMessage(WindowmenuSet, WindowmenuClose, "Close"), insert(i18n(WindowmenuSet, WindowmenuClose, "Close"),
BScreen::WindowClose); BScreen::WindowClose);
update(); update();

View file

@ -303,7 +303,7 @@ void Workspace::setName(const char *new_name) {
name = bstrdup(new_name); name = bstrdup(new_name);
} else { } else {
name = new char[128]; name = new char[128];
sprintf(name, i18n->getMessage(WorkspaceSet, WorkspaceDefaultNameFormat, sprintf(name, i18n(WorkspaceSet, WorkspaceDefaultNameFormat,
"Workspace %d"), id + 1); "Workspace %d"), id + 1);
} }

View file

@ -41,11 +41,11 @@
Workspacemenu::Workspacemenu(BScreen &scrn) : Basemenu(scrn), screen(scrn) { Workspacemenu::Workspacemenu(BScreen &scrn) : Basemenu(scrn), screen(scrn) {
setInternalMenu(); setInternalMenu();
setLabel(i18n->getMessage(WorkspacemenuSet, WorkspacemenuWorkspacesTitle, setLabel(i18n(WorkspacemenuSet, WorkspacemenuWorkspacesTitle,
"Workspaces")); "Workspaces"));
insert(i18n->getMessage(WorkspacemenuSet, WorkspacemenuNewWorkspace, insert(i18n(WorkspacemenuSet, WorkspacemenuNewWorkspace,
"New Workspace")); "New Workspace"));
insert(i18n->getMessage(WorkspacemenuSet, WorkspacemenuRemoveLast, insert(i18n(WorkspacemenuSet, WorkspacemenuRemoveLast,
"Remove Last")); "Remove Last"));
} }

View file

@ -42,14 +42,36 @@
#include <algorithm> #include <algorithm>
using std::cerr; using std::cerr;
using std::endl;
std::string XDisplay::_app_name;
Window XDisplay::_last_bad_window = None;
/*
* X error handler to handle all X errors while the application is
* running.
*/
int XDisplay::XErrorHandler(Display *d, XErrorEvent *e) { int XDisplay::XErrorHandler(Display *d, XErrorEvent *e) {
d=d;e=e; #ifdef DEBUG
return 0; char errtxt[128];
XGetErrorText(d, e->error_code, errtxt, sizeof(errtxt)/sizeof(char));
cerr << _app_name.c_str() << ": X error: " <<
errtxt << "(" << e->error_code << ") opcodes " <<
e->request_code << "/" << e->minor_code << endl;
cerr.flags(std::ios_base::hex);
cerr << " resource 0x" << e->resourceid << endl;
cerr.flags(std::ios_base::dec);
#endif
if (e->error_code == BadWindow)
_last_bad_window = e->resourceid;
return False;
} }
XDisplay::XDisplay(const char *dpyname) { XDisplay::XDisplay(const std::string &application_name, const char *dpyname) {
_app_name = application_name;
_grabs = 0; _grabs = 0;
_hasshape = false; _hasshape = false;

View file

@ -42,7 +42,10 @@ private:
typedef std::vector<XScreen*> XScreenList; typedef std::vector<XScreen*> XScreenList;
XScreenList _screens; XScreenList _screens;
// X error handling
static int XErrorHandler(Display *d, XErrorEvent *e); static int XErrorHandler(Display *d, XErrorEvent *e);
static std::string _app_name;
static Window _last_bad_window;
// no copying!! // no copying!!
XDisplay(const XDisplay &); XDisplay(const XDisplay &);
@ -52,7 +55,7 @@ protected:
virtual void process_event(XEvent *) = 0; virtual void process_event(XEvent *) = 0;
public: public:
XDisplay(const char *dpyname = 0); XDisplay(const std::string &application_name, const char *dpyname = 0);
virtual ~XDisplay(); virtual ~XDisplay();
XScreen *screen(unsigned int s) const; XScreen *screen(unsigned int s) const;

View file

@ -1,5 +1,6 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
// i18n.cc for Openbox // i18n.cc for Openbox
// Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org> // Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
@ -20,18 +21,11 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// stupid macros needed to access some functions in version 2 of the GNU C
// library
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif // _GNU_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "../config.h" # include "../config.h"
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#include "i18n.h" extern "C" {
#include <X11/Xlocale.h> #include <X11/Xlocale.h>
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
@ -49,23 +43,15 @@
#ifdef HAVE_LOCALE_H #ifdef HAVE_LOCALE_H
# include <locale.h> # include <locale.h>
#endif // HAVE_LOCALE_H #endif // HAVE_LOCALE_H
// the rest of bb source uses True and False from X, so we continue that
#define True true
#define False false
static I18n static_i18n;
I18n *i18n;
void NLSInit(const char *catalog) {
i18n = &static_i18n;
i18n->openCatalog(catalog);
} }
#include <string>
using std::string;
I18n::I18n(void) { #include "i18n.h"
mb = False;
I18n::I18n(const char *catalog) {
mb = false;
#ifdef HAVE_SETLOCALE #ifdef HAVE_SETLOCALE
locale = setlocale(LC_ALL, ""); locale = setlocale(LC_ALL, "");
if (! locale) { if (! locale) {
@ -76,7 +62,7 @@ I18n::I18n(void) {
} else { } else {
// MB_CUR_MAX returns the size of a char in the current locale // MB_CUR_MAX returns the size of a char in the current locale
if (MB_CUR_MAX > 1) if (MB_CUR_MAX > 1)
mb = True; mb = true;
// truncate any encoding off the end of the locale // truncate any encoding off the end of the locale
char *l = strchr(locale, '@'); char *l = strchr(locale, '@');
if (l) *l = '\0'; if (l) *l = '\0';
@ -88,14 +74,12 @@ I18n::I18n(void) {
catalog_fd = (nl_catd) -1; catalog_fd = (nl_catd) -1;
#endif #endif
#endif // HAVE_SETLOCALE #endif // HAVE_SETLOCALE
if (catalog)
catalog_filename = (char *) 0; openCatalog(catalog);
} }
I18n::~I18n(void) { I18n::~I18n() {
delete [] catalog_filename;
#if defined(NLS) && defined(HAVE_CATCLOSE) #if defined(NLS) && defined(HAVE_CATCLOSE)
if (catalog_fd != (nl_catd) -1) if (catalog_fd != (nl_catd) -1)
catclose(catalog_fd); catclose(catalog_fd);
@ -105,35 +89,27 @@ I18n::~I18n(void) {
void I18n::openCatalog(const char *catalog) { void I18n::openCatalog(const char *catalog) {
#if defined(NLS) && defined(HAVE_CATOPEN) #if defined(NLS) && defined(HAVE_CATOPEN)
int lp = strlen(LOCALEPATH), lc = strlen(locale), string catalog_filename = LOCALEPATH;
ct = strlen(catalog), len = lp + lc + ct + 3; catalog_filename += '/';
catalog_filename = new char[len]; catalog_filename += locale;
catalog_filename += '/';
strncpy(catalog_filename, LOCALEPATH, lp); catalog_filename += catalog;
*(catalog_filename + lp) = '/';
strncpy(catalog_filename + lp + 1, locale, lc);
*(catalog_filename + lp + lc + 1) = '/';
strncpy(catalog_filename + lp + lc + 2, catalog, ct + 1);
# ifdef MCLoadBySet # ifdef MCLoadBySet
catalog_fd = catopen(catalog_filename, MCLoadBySet); catalog_fd = catopen(catalog_filename.c_str(), MCLoadBySet);
# else // !MCLoadBySet # else // !MCLoadBySet
catalog_fd = catopen(catalog_filename, NL_CAT_LOCALE); catalog_fd = catopen(catalog_filename.c_str(), NL_CAT_LOCALE);
# endif // MCLoadBySet # endif // MCLoadBySet
if (catalog_fd == (nl_catd) -1) if (catalog_fd == (nl_catd) -1)
fprintf(stderr, "failed to open catalog, using default messages\n"); fprintf(stderr, "failed to open catalog, using default messages\n");
#else // !HAVE_CATOPEN
catalog_filename = (char *) 0;
#endif // HAVE_CATOPEN #endif // HAVE_CATOPEN
} }
const char* I18n::operator()(int set, int msg, const char *msgString) const {
const char *I18n::getMessage(int set, int msg, const char *msgString) const {
#if defined(NLS) && defined(HAVE_CATGETS) #if defined(NLS) && defined(HAVE_CATGETS)
if (catalog_fd != (nl_catd) -1) if (catalog_fd != (nl_catd) -1)
return (const char *) catgets(catalog_fd, set, msg, msgString); return catgets(catalog_fd, set, msg, msgString);
else else
#endif #endif
return msgString; return msgString;

View file

@ -1,5 +1,6 @@
// i18n.h for Openbox // -*- mode: C++; indent-tabs-mode: nil; -*-
// Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org> // i18n.hh for Openbox
// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
@ -28,39 +29,35 @@
// add ifdefs to every call to getMessage // add ifdefs to every call to getMessage
#include "../nls/openbox-nls.h" #include "../nls/openbox-nls.h"
extern "C" {
#ifdef HAVE_LOCALE_H #ifdef HAVE_LOCALE_H
# include <locale.h> # include <locale.h>
#endif // HAVE_LOCALE_H #endif // HAVE_LOCALE_H
#ifdef HAVE_NL_TYPES_H #ifdef HAVE_NL_TYPES_H
extern "C" {
# include <nl_types.h> # include <nl_types.h>
}
#endif // HAVE_NL_TYPES_H #endif // HAVE_NL_TYPES_H
}
class I18n { class I18n {
private: private:
char *locale, *catalog_filename; char *locale;
bool mb; bool mb;
#ifdef HAVE_NL_TYPES_H #ifdef HAVE_NL_TYPES_H
nl_catd catalog_fd; nl_catd catalog_fd;
#endif #endif
public: public:
I18n(void); I18n(const char *catalog = 0);
~I18n(void); ~I18n();
inline bool multibyte(void) const { return mb; } inline bool multibyte(void) const { return mb; }
const char *getMessage(int set, int msg, const char *msgString) const; const char* operator()(int set, int msg, const char *msgString) const;
void openCatalog(const char *catalog); void openCatalog(const char *catalog);
}; };
extern I18n i18n; // located in main.cc
extern I18n *i18n;
extern void NLSInit(const char *);
#endif // __i18n_h #endif // __i18n_h

View file

@ -32,9 +32,6 @@
# include "../config.h" # include "../config.h"
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#include "i18n.h"
#include "openbox.h"
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
# include <stdio.h> # include <stdio.h>
#endif // HAVE_STDIO_H #endif // HAVE_STDIO_H
@ -59,10 +56,14 @@
#define MAXPATHLEN 255 #define MAXPATHLEN 255
#endif // MAXPATHLEN #endif // MAXPATHLEN
#include "openbox.h"
#include "i18n.h"
I18n i18n("openbox.cat");
static void showHelp(int exitval) { static void showHelp(int exitval) {
// print program usage and command line options // print program usage and command line options
printf(i18n->getMessage(mainSet, mainUsage, printf(i18n(mainSet, mainUsage,
"Openbox %s : (c) 2002 - 2002 Ben Jansens\n" "Openbox %s : (c) 2002 - 2002 Ben Jansens\n"
"\t\t\t 2001 - 2002 Sean 'Shaleh' Perry\n\n" "\t\t\t 2001 - 2002 Sean 'Shaleh' Perry\n\n"
"\t\t\t 1997 - 2000 Brad Hughes\n\n" "\t\t\t 1997 - 2000 Brad Hughes\n\n"
@ -75,7 +76,7 @@ static void showHelp(int exitval) {
// some people have requested that we print out compile options // some people have requested that we print out compile options
// as well // as well
fprintf(stdout,i18n->getMessage(mainSet, mainCompileOptions, fprintf(stdout,i18n(mainSet, mainCompileOptions,
"Compile time options:\n" "Compile time options:\n"
" Debugging:\t\t\t%s\n" " Debugging:\t\t\t%s\n"
" Interlacing:\t\t\t%s\n" " Interlacing:\t\t\t%s\n"
@ -84,39 +85,39 @@ static void showHelp(int exitval) {
" 8bpp Ordered Dithering:\t%s\n" " 8bpp Ordered Dithering:\t%s\n"
" Event Clobbering:\t\t%s\n\n"), " Event Clobbering:\t\t%s\n\n"),
#ifdef DEBUG #ifdef DEBUG
i18n->getMessage(CommonSet, CommonYes, "yes"), i18n(CommonSet, CommonYes, "yes"),
#else // !DEBUG #else // !DEBUG
i18n->getMessage(CommonSet, CommonNo, "no"), i18n(CommonSet, CommonNo, "no"),
#endif // DEBUG #endif // DEBUG
#ifdef INTERLACE #ifdef INTERLACE
i18n->getMessage(CommonSet, CommonYes, "yes"), i18n(CommonSet, CommonYes, "yes"),
#else // !INTERLACE #else // !INTERLACE
i18n->getMessage(CommonSet, CommonNo, "no"), i18n(CommonSet, CommonNo, "no"),
#endif // INTERLACE #endif // INTERLACE
#ifdef SHAPE #ifdef SHAPE
i18n->getMessage(CommonSet, CommonYes, "yes"), i18n(CommonSet, CommonYes, "yes"),
#else // !SHAPE #else // !SHAPE
i18n->getMessage(CommonSet, CommonNo, "no"), i18n(CommonSet, CommonNo, "no"),
#endif // SHAPE #endif // SHAPE
#ifdef SLIT #ifdef SLIT
i18n->getMessage(CommonSet, CommonYes, "yes"), i18n(CommonSet, CommonYes, "yes"),
#else // !SLIT #else // !SLIT
i18n->getMessage(CommonSet, CommonNo, "no"), i18n(CommonSet, CommonNo, "no"),
#endif // SLIT #endif // SLIT
#ifdef ORDEREDPSEUDO #ifdef ORDEREDPSEUDO
i18n->getMessage(CommonSet, CommonYes, "yes"), i18n(CommonSet, CommonYes, "yes"),
#else // !ORDEREDPSEUDO #else // !ORDEREDPSEUDO
i18n->getMessage(CommonSet, CommonNo, "no"), i18n(CommonSet, CommonNo, "no"),
#endif // ORDEREDPSEUDO #endif // ORDEREDPSEUDO
#ifndef NOCLOBBER #ifndef NOCLOBBER
i18n->getMessage(CommonSet, CommonYes, "yes") i18n(CommonSet, CommonYes, "yes")
#else // !NOCLOBBER #else // !NOCLOBBER
i18n->getMessage(CommonSet, CommonNo, "no") i18n(CommonSet, CommonNo, "no")
#endif // NOCLOBBER #endif // NOCLOBBER
); );
@ -128,15 +129,13 @@ int main(int argc, char **argv) {
char *rc_file = (char *) 0; char *rc_file = (char *) 0;
char *menu_file = (char *) 0; char *menu_file = (char *) 0;
NLSInit("openbox.cat");
for (int i = 1; i < argc; ++i) { for (int i = 1; i < argc; ++i) {
if (! strcmp(argv[i], "-rc")) { if (! strcmp(argv[i], "-rc")) {
// look for alternative rc file to use // look for alternative rc file to use
if ((++i) >= argc) { if ((++i) >= argc) {
fprintf(stderr, fprintf(stderr,
i18n->getMessage(mainSet, mainRCRequiresArg, i18n(mainSet, mainRCRequiresArg,
"error: '-rc' requires and argument\n")); "error: '-rc' requires and argument\n"));
::exit(1); ::exit(1);
@ -148,7 +147,7 @@ int main(int argc, char **argv) {
if ((++i) >= argc) { if ((++i) >= argc) {
fprintf(stderr, fprintf(stderr,
i18n->getMessage(mainSet, mainMENURequiresArg, i18n(mainSet, mainMENURequiresArg,
"error: '-menu' requires and argument\n")); "error: '-menu' requires and argument\n"));
::exit(1); ::exit(1);
@ -161,7 +160,7 @@ int main(int argc, char **argv) {
if ((++i) >= argc) { if ((++i) >= argc) {
fprintf(stderr, fprintf(stderr,
i18n->getMessage(mainSet, mainDISPLAYRequiresArg, i18n(mainSet, mainDISPLAYRequiresArg,
"error: '-display' requires an argument\n")); "error: '-display' requires an argument\n"));
::exit(1); ::exit(1);
@ -173,8 +172,7 @@ int main(int argc, char **argv) {
if (putenv(dtmp)) { if (putenv(dtmp)) {
fprintf(stderr, fprintf(stderr,
i18n-> i18n(mainSet, mainWarnDisplaySet,
getMessage(mainSet, mainWarnDisplaySet,
"warning: couldn't set environment variable 'DISPLAY'\n")); "warning: couldn't set environment variable 'DISPLAY'\n"));
perror("putenv()"); perror("putenv()");
} }

View file

@ -219,7 +219,7 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc,
if (screenList.empty()) { if (screenList.empty()) {
fprintf(stderr, fprintf(stderr,
i18n->getMessage(openboxSet, openboxNoManagableScreens, i18n(openboxSet, openboxNoManagableScreens,
"Openbox::Openbox: no managable screens found, aborting.\n")); "Openbox::Openbox: no managable screens found, aborting.\n"));
::exit(3); ::exit(3);
} }
@ -449,7 +449,7 @@ void Openbox::process_event(XEvent *e) {
case MapRequest: { case MapRequest: {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, fprintf(stderr,
i18n->getMessage(openboxSet, openboxMapRequest, i18n(openboxSet, openboxMapRequest,
"Openbox::process_event(): MapRequest for 0x%lx\n"), "Openbox::process_event(): MapRequest for 0x%lx\n"),
e->xmaprequest.window); e->xmaprequest.window);
#endif // DEBUG #endif // DEBUG