1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-11 11:15:55 +01:00

- s/sprintf/snprintf

- updated some po's
- fixed crash bug when removing WINDOWS_MENU or WORKSPACE_MENU from rootmenu
- some other stuff i forgot
This commit is contained in:
kojima
2001-07-23 20:31:32 +00:00
parent 0931e14a5a
commit 882b9a8e1c
61 changed files with 3188 additions and 2346 deletions

View File

@@ -1195,7 +1195,7 @@ static void handleResize(W_ViewDelegate *self, WMView *view)
vh = WMIN(size.height, height);
W_MoveView(table->tableView, 21, 1+table->headerHeight+1);
W_ResizeView(table->tableView, WMAX(vw, 1), WMAX(vh, 1));
W_ResizeView(table->tableView, WMAX(vw, 1), WMAX(vh, 1)+1);
adjustScrollers(table);

View File

@@ -2,7 +2,7 @@
AUTOMAKE_OPTIONS = no-dependencies
SUBDIRS = WINGs . Documentation Resources Examples Extras Tests
SUBDIRS = WINGs . po Documentation Resources Examples Extras Tests
@@ -13,7 +13,7 @@ bin_SCRIPTS = get-wings-flags get-wutil-flags
lib_LIBRARIES = libWINGs.a libWUtil.a
LDADD= libWINGs.a $(top_builddir)/wrlib/libwraster.la @LIBPL@
LDADD= libWINGs.a $(top_builddir)/wrlib/libwraster.la @LIBPL@ @INTLIBS@
EXTRA_DIST = BUGS
@@ -50,6 +50,7 @@ libWINGs_a_SOURCES = \
wcolor.c \
wcolorpanel.c \
wcolorwell.c \
wconfig.h \
wevent.c \
wfilepanel.c \
wframe.c \
@@ -95,8 +96,10 @@ libWUtil_a_SOURCES = \
userdefaults.c \
usleep.c \
wapplication.c \
wconfig.h \
wutil.c
CPPFLAGS = @CPPFLAGS@ -DLOCALEDIR=\"$(NLSDIR)\"
INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG

View File

@@ -29,6 +29,7 @@
#include "../src/config.h"
#include "wconfig.h"
#include <unistd.h>
#include <fcntl.h>
@@ -351,6 +352,12 @@ getSocketAddress(char* name, char* service, char* protocol) /*FOLD00*/
return &socketaddr;
}
static void
handle_sigpipe(int signum)
{
if (0) signum=0; /* To avoid a gcc warning */
return;
}
static WMConnection*
createConnectionWithSocket(int sock, Bool closeOnRelease) /*FOLD00*/
@@ -377,7 +384,12 @@ createConnectionWithSocket(int sock, Bool closeOnRelease) /*FOLD00*/
/* ignore dead pipe */
if (!SigInitialized) {
sig_action.sa_handler = SIG_IGN;
sig_action.sa_handler = &handle_sigpipe;
/* Because POSIX mandates that only signal with handlers are reset
accross an exec*(), we do not want to propagate ignoring SIGPIPEs
to children. Hence the dummy handler.
Philippe Troin <phil@fifi.org>
*/
sig_action.sa_flags = SA_RESTART;
sigaction(SIGPIPE, &sig_action, NULL);
SigInitialized = True;
@@ -448,7 +460,7 @@ WMCreateConnectionAsServerAtAddress(char *host, char *service, char *protocol) /
WCErrorCode = 0;
if ((socketaddr = getSocketAddress(host, service, protocol)) == NULL) {
wwarning("Bad address-service-protocol combination");
wwarning(_("Bad address-service-protocol combination"));
return NULL;
}
@@ -513,7 +525,7 @@ WMCreateConnectionToAddress(char *host, char *service, char *protocol) /*FOLD00*
host = "localhost";
if ((socketaddr = getSocketAddress(host, service, protocol)) == NULL) {
wwarning("Bad address-service-protocol combination");
wwarning(_("Bad address-service-protocol combination"));
return NULL;
}
@@ -556,7 +568,7 @@ WMCreateConnectionToAddressAndNotify(char *host, char *service, char *protocol)
host = "localhost";
if ((socketaddr = getSocketAddress(host, service, protocol)) == NULL) {
wwarning("Bad address-service-protocol combination");
wwarning(_("Bad address-service-protocol combination"));
return NULL;
}

View File

@@ -21,6 +21,8 @@
#include "../src/config.h"
#include "wconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -51,12 +53,12 @@ wstrerror(int errnum)
if (errno < sys_nerr)
return sys_errlist[errnum];
sprintf (buf, "Unknown error %d", errnum);
sprintf (buf, _("Unknown error %d"), errnum);
return buf;
#else /* no strerror() and no sys_errlist[] */
static char buf[] = "Error 12345678901234567890";
sprintf(buf, "Error %d", errnum);
sprintf(buf, _("Error %d"), errnum);
return buf;
#endif
}
@@ -107,7 +109,7 @@ wwarning(const char *msg, ...)
strcat(buf,"\n");
fflush(stdout);
fputs(_WINGS_progname, stderr);
fputs(" warning: ",stderr);
fputs(_(" warning: "),stderr);
fputs(buf, stderr);
fflush(stdout);
fflush(stderr);
@@ -134,7 +136,7 @@ wfatal(const char *msg, ...)
strcat(buf,"\n");
fflush(stdout);
fputs(_WINGS_progname, stderr);
fputs(" fatal error: ",stderr);
fputs(_(" fatal error: "),stderr);
fputs(buf, stderr);
fflush(stdout);
fflush(stderr);
@@ -160,7 +162,7 @@ wsyserror(const char *msg, ...)
vsnprintf(buf, MAXLINE-3, msg, args);
fflush(stdout);
fputs(_WINGS_progname, stderr);
fputs(" error: ", stderr);
fputs(_(" error: "), stderr);
fputs(buf, stderr);
fputs(": ", stderr);
fputs(wstrerror(error), stderr);
@@ -189,7 +191,7 @@ wsyserrorwithcode(int error, const char *msg, ...)
vsnprintf(buf, MAXLINE-3, msg, args);
fflush(stdout);
fputs(_WINGS_progname, stderr);
fputs(" error: ", stderr);
fputs(_(" error: "), stderr);
fputs(buf, stderr);
fputs(": ", stderr);
fputs(wstrerror(error), stderr);

View File

@@ -21,6 +21,8 @@
#include "../src/config.h"
#include "wconfig.h"
#include "WUtil.h"
#include <stdlib.h>
@@ -45,7 +47,7 @@ wgethomedir()
user = getpwuid(getuid());
if (!user) {
wsyserror("could not get password entry for UID %i", getuid());
wsyserror(_("could not get password entry for UID %i"), getuid());
return "/";
}
if (!user->pw_dir) {
@@ -63,7 +65,7 @@ getuserhomedir(char *username)
user = getpwnam(username);
if (!user) {
wsyserror("could not get password entry for user %s", username);
wsyserror(_("could not get password entry for user %s"), username);
return NULL;
}
if (!user->pw_dir) {

View File

@@ -21,6 +21,8 @@
#include "../src/config.h"
#include "wconfig.h"
#include <unistd.h>
#include <string.h>
#include <netdb.h>
@@ -111,7 +113,7 @@ WMGetCurrentHost()
char name[W_MAXHOSTNAMELEN+1];
if (gethostname(name, W_MAXHOSTNAMELEN) < 0) {
wsyserror("Cannot get current host name");
wsyserror(_("Cannot get current host name"));
return NULL;
}

View File

@@ -4,6 +4,10 @@
#include "WINGsP.h"
#include "wconfig.h"
#include "X11/Xlocale.h"
extern void W_InitNotificationCenter(void);
@@ -26,11 +30,21 @@ void
WMInitializeApplication(char *applicationName, int *argc, char **argv)
{
int i;
assert(argc!=NULL);
assert(argv!=NULL);
assert(applicationName!=NULL);
setlocale(LC_ALL, "");
#ifdef I18N
if (getenv("NLSPATH"))
bindtextdomain("WINGs", getenv("NLSPATH"));
else
bindtextdomain("WINGs", LOCALEDIR);
#endif
_WINGS_progname = argv[0];
WMApplication.applicationName = wstrdup(applicationName);

View File

@@ -1,6 +1,8 @@
#include "WINGsP.h"
#include "wconfig.h"
#include <wraster.h>
#define LIGHT_STIPPLE_WIDTH 4
@@ -193,7 +195,7 @@ WMWhiteColor(WMScreen *scr)
if (!scr->white) {
scr->white = WMCreateRGBColor(scr, 0xffff, 0xffff, 0xffff, True);
if (!scr->white->flags.exact)
wwarning("could not allocate %s color", "white");
wwarning(_("could not allocate %s color"), _("white"));
}
return WMRetainColor(scr->white);
}
@@ -206,7 +208,7 @@ WMBlackColor(WMScreen *scr)
if (!scr->black) {
scr->black = WMCreateRGBColor(scr, 0, 0, 0, True);
if (!scr->black->flags.exact)
wwarning("could not allocate %s color", "black");
wwarning(_("could not allocate %s color"), _("black"));
}
return WMRetainColor(scr->black);
}
@@ -245,7 +247,7 @@ WMGrayColor(WMScreen *scr)
} else {
color = WMCreateRGBColor(scr, 0xaeba, 0xaaaa, 0xaeba, True);
if (!color->flags.exact)
wwarning("could not allocate %s color", "gray");
wwarning(_("could not allocate %s color"), _("gray"));
}
scr->gray = color;
}
@@ -286,7 +288,7 @@ WMDarkGrayColor(WMScreen *scr)
} else {
color = WMCreateRGBColor(scr, 0x5144, 0x5555, 0x5144, True);
if (!color->flags.exact)
wwarning("could not allocate %s color", "dark gray");
wwarning(_("could not allocate %s color"), _("dark gray"));
}
scr->darkGray = color;
}

View File

@@ -25,6 +25,7 @@
*/
#include "../src/config.h"
#include "wconfig.h"
#include "WINGsP.h"
#include <math.h>
#include <unistd.h>
@@ -56,13 +57,6 @@
char *WMColorPanelColorChangedNotification = "WMColorPanelColorChangedNotification";
/*
* Error Messages
*/
#define NO_MEMORY_ERR "Color Panel: Could not allocate memory"
#define NO_FILE_ERR "Color Panel: Could not find file"
#define X_ERR "Color Panel: X failed request"
/*
* Bitmaps for magnifying glass cursor
@@ -419,7 +413,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
panel->win = WMCreateWindowWithStyle(scrPtr, name,
WMTitledWindowMask | WMClosableWindowMask | WMResizableWindowMask);
WMResizeWidget(panel->win, PWIDTH, PHEIGHT);
WMSetWindowTitle(panel->win, "Colors");
WMSetWindowTitle(panel->win, _("Colors"));
WMSetWindowCloseAction(panel->win, closeWindowCallback, panel);
@@ -609,9 +603,9 @@ makeColorPanel(WMScreen *scrPtr, char *name)
if (pixmap)
W_PaintText(W_VIEW(panel->grayBrightnessS), pixmap->pixmap,
panel->font12, 2, 0, 100, WALeft, WMColorGC(scrPtr->white),
False, "Brightness", strlen("Brightness"));
False, _("Brightness"), strlen(_("Brightness")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->grayBrightnessS, pixmap);
WMReleasePixmap(pixmap);
@@ -684,10 +678,10 @@ makeColorPanel(WMScreen *scrPtr, char *name)
if (pixmap)
W_PaintText(W_VIEW(panel->rgbRedS), pixmap->pixmap, panel->font12,
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, "Red",
strlen("Red"));
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, _("Red"),
strlen(_("Red")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->rgbRedS, pixmap);
WMReleasePixmap(pixmap);
@@ -717,10 +711,10 @@ makeColorPanel(WMScreen *scrPtr, char *name)
if (pixmap)
W_PaintText(W_VIEW(panel->rgbGreenS), pixmap->pixmap, panel->font12,
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, "Green",
strlen("Green"));
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, _("Green"),
strlen(_("Green")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->rgbGreenS, pixmap);
WMReleasePixmap(pixmap);
@@ -751,10 +745,10 @@ makeColorPanel(WMScreen *scrPtr, char *name)
if (pixmap)
W_PaintText(W_VIEW(panel->rgbBlueS), pixmap->pixmap, panel->font12,
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, "Blue",
strlen("Blue"));
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, _("Blue"),
strlen(_("Blue")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->rgbBlueS, pixmap);
WMReleasePixmap(pixmap);
@@ -811,10 +805,10 @@ makeColorPanel(WMScreen *scrPtr, char *name)
if (pixmap)
W_PaintText(W_VIEW(panel->cmykCyanS), pixmap->pixmap, panel->font12,
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Cyan",
strlen("Cyan"));
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, _("Cyan"),
strlen(_("Cyan")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->cmykCyanS, pixmap);
WMReleasePixmap(pixmap);
@@ -845,10 +839,10 @@ makeColorPanel(WMScreen *scrPtr, char *name)
if (pixmap)
W_PaintText(W_VIEW(panel->cmykMagentaS), pixmap->pixmap, panel->font12,
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Magenta",
strlen("Magenta"));
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, _("Magenta"),
strlen(_("Magenta")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->cmykMagentaS, pixmap);
WMReleasePixmap(pixmap);
@@ -879,10 +873,10 @@ makeColorPanel(WMScreen *scrPtr, char *name)
if (pixmap)
W_PaintText(W_VIEW(panel->cmykYellowS), pixmap->pixmap, panel->font12,
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Yellow",
strlen("Yellow"));
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, _("Yellow"),
strlen(_("Yellow")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->cmykYellowS, pixmap);
WMReleasePixmap(pixmap);
@@ -914,10 +908,10 @@ makeColorPanel(WMScreen *scrPtr, char *name)
if (pixmap)
W_PaintText(W_VIEW(panel->cmykBlackS), pixmap->pixmap, panel->font12,
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Black",
strlen("Black"));
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, _("Black"),
strlen(_("Black")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->cmykBlackS, pixmap);
WMReleasePixmap(pixmap);
@@ -995,7 +989,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
panel->customPaletteHistoryBtn = WMCreatePopUpButton(
panel->customPaletteFrm);
WMAddPopUpButtonItem(panel->customPaletteHistoryBtn, "Spectrum");
WMAddPopUpButtonItem(panel->customPaletteHistoryBtn, _("Spectrum"));
WMSetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn,
WMGetPopUpButtonNumberOfItems(panel->customPaletteHistoryBtn)-1);
WMSetPopUpButtonAction(panel->customPaletteHistoryBtn,
@@ -1025,17 +1019,17 @@ makeColorPanel(WMScreen *scrPtr, char *name)
panel->customPaletteMenuBtn = WMCreatePopUpButton(panel->customPaletteFrm);
WMSetPopUpButtonPullsDown(panel->customPaletteMenuBtn, 1);
WMSetPopUpButtonText(panel->customPaletteMenuBtn, "Palette");
WMSetPopUpButtonText(panel->customPaletteMenuBtn, _("Palette"));
WMSetPopUpButtonAction(panel->customPaletteMenuBtn,
customPaletteMenuCallback, panel);
WMResizeWidget(panel->customPaletteMenuBtn, PWIDTH - 8, 20);
WMMoveWidget(panel->customPaletteMenuBtn, 0, PHEIGHT - 130);
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "New from File...");
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "Rename...");
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "Remove");
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "Copy");
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "New from Clipboard");
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, _("New from File..."));
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, _("Rename..."));
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, _("Remove"));
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, _("Copy"));
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, _("New from Clipboard"));
WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuRename, 0);
WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuRemove, 0);
@@ -1056,7 +1050,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
WMMoveWidget(panel->colorListFrm, 5, 80);
panel->colorListHistoryBtn = WMCreatePopUpButton(panel->colorListFrm);
WMAddPopUpButtonItem(panel->colorListHistoryBtn, "X11-Colors");
WMAddPopUpButtonItem(panel->colorListHistoryBtn, _("X11-Colors"));
WMSetPopUpButtonSelectedItem(panel->colorListHistoryBtn,
WMGetPopUpButtonNumberOfItems(panel->colorListHistoryBtn)-1);
/* WMSetPopUpButtonAction(panel->colorListHistoryBtn,
@@ -1073,15 +1067,15 @@ makeColorPanel(WMScreen *scrPtr, char *name)
panel->colorListColorMenuBtn = WMCreatePopUpButton(panel->colorListFrm);
WMSetPopUpButtonPullsDown(panel->colorListColorMenuBtn, 1);
WMSetPopUpButtonText(panel->colorListColorMenuBtn, "Color");
WMSetPopUpButtonText(panel->colorListColorMenuBtn, _("Color"));
WMSetPopUpButtonAction(panel->colorListColorMenuBtn,
colorListColorMenuCallback, panel);
WMResizeWidget(panel->colorListColorMenuBtn, (PWIDTH - 16)/2, 20);
WMMoveWidget(panel->colorListColorMenuBtn, 0, PHEIGHT - 130);
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Add...");
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Rename...");
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Remove");
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, _("Add..."));
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, _("Rename..."));
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, _("Remove"));
WMSetPopUpButtonItemEnabled(panel->colorListColorMenuBtn, CLmenuAdd, 0);
WMSetPopUpButtonItemEnabled(panel->colorListColorMenuBtn, CLmenuRename, 0);
@@ -1089,16 +1083,16 @@ makeColorPanel(WMScreen *scrPtr, char *name)
panel->colorListListMenuBtn = WMCreatePopUpButton(panel->colorListFrm);
WMSetPopUpButtonPullsDown(panel->colorListListMenuBtn, 1);
WMSetPopUpButtonText(panel->colorListListMenuBtn, "List");
WMSetPopUpButtonText(panel->colorListListMenuBtn, _("List"));
WMSetPopUpButtonAction(panel->colorListListMenuBtn,
colorListListMenuCallback, panel);
WMResizeWidget(panel->colorListListMenuBtn, (PWIDTH - 16)/2, 20);
WMMoveWidget(panel->colorListListMenuBtn, (PWIDTH - 16)/2 + 8,
PHEIGHT - 130);
WMAddPopUpButtonItem(panel->colorListListMenuBtn, "New...");
WMAddPopUpButtonItem(panel->colorListListMenuBtn, "Rename...");
WMAddPopUpButtonItem(panel->colorListListMenuBtn, "Remove");
WMAddPopUpButtonItem(panel->colorListListMenuBtn, _("New..."));
WMAddPopUpButtonItem(panel->colorListListMenuBtn, _("Rename..."));
WMAddPopUpButtonItem(panel->colorListListMenuBtn, _("Remove"));
WMSetPopUpButtonItemEnabled(panel->colorListListMenuBtn, CLmenuAdd, 0);
WMSetPopUpButtonItemEnabled(panel->colorListListMenuBtn, CLmenuRename, 0);
@@ -1235,21 +1229,21 @@ readConfiguration(W_ColorPanel *panel)
if (stat(panel->configurationPath, &stat_buf)!=0) {
if (mkdir(panel->configurationPath,
S_IRWXU|S_IRGRP|S_IROTH|S_IXGRP|S_IXOTH)!=0) {
wsyserror("Color Panel: Could not create directory %s needed"
" to store configurations", panel->configurationPath);
wsyserror(_("Color Panel: Could not create directory %s needed"
" to store configurations"), panel->configurationPath);
WMSetPopUpButtonEnabled(panel->customPaletteMenuBtn, False);
WMSetPopUpButtonEnabled(panel->colorListColorMenuBtn, False);
WMSetPopUpButtonEnabled(panel->colorListListMenuBtn, False);
WMRunAlertPanel(WMWidgetScreen(panel->win), panel->win,
"File Error",
"Could not create ColorPanel configuration directory",
"OK", NULL, NULL);
_("File Error"),
_("Could not create ColorPanel configuration directory"),
_("OK"), NULL, NULL);
}
return;
}
if (!(dPtr = opendir(panel->configurationPath))) {
wwarning(NO_FILE_ERR, "%s", panel->configurationPath);
wwarning(_("Color Panel: Could not find file"), "%s", panel->configurationPath);
return;
}
@@ -1285,7 +1279,7 @@ readXColors(W_ColorPanel *panel)
WMListItem *item;
if (stat(RGBTXT, &stat_buf) != 0) {
wsyserror(NO_FILE_ERR, " %s", RGBTXT);
wsyserror(_("Color Panel: Could not find file"), " %s", RGBTXT);
return;
}
else {
@@ -1303,7 +1297,7 @@ readXColors(W_ColorPanel *panel)
fclose(rgbtxt);
}
else {
wsyserror(NO_FILE_ERR, "%s", RGBTXT);
wsyserror(_("Color Panel: Could not find file"), "%s", RGBTXT);
}
}
}
@@ -1490,7 +1484,7 @@ magnifyGetImage(WMScreen *scr, XImage *image, int x, int y, int w, int h)
x - Cursor_x_hot,
y - Cursor_y_hot,
w, h, AllPlanes, ZPixmap)))
wwarning(X_ERR);
wwarning(_("Color Panel: X failed request"));
return image;
}
@@ -1555,7 +1549,7 @@ magnifyGetImage(WMScreen *scr, XImage *image, int x, int y, int w, int h)
y - Cursor_y_hot + y0,
w0, h0, AllPlanes, ZPixmap,
image, x0, y0))
wwarning(X_ERR);
wwarning(_("Color Panel: X failed request"));
return NULL;
}
@@ -1619,7 +1613,7 @@ magnifyGetImageStored(WMColorPanel *panel, int x1, int y1, int x2, int y2)
panel->magnifyGlass->dirtyRect =
XSubImage(panel->magnifyGlass->image, xa, ya, width, height);
if (!panel->magnifyGlass->dirtyRect) {
wwarning(X_ERR);
wwarning(_("Color Panel: X failed request"));
return; /* X returned a NULL from XSubImage */
}
}
@@ -2168,7 +2162,7 @@ wheelRender(W_ColorPanel *panel)
image = RCreateImage(colorWheelSize+4, colorWheelSize+4, True);
if (!image) {
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
return;
}
@@ -2828,9 +2822,9 @@ hsbUpdateBrightnessGradient(W_ColorPanel *panel)
if (sliderPxmp)
W_PaintText(W_VIEW(panel->hsbBrightnessS), sliderPxmp->pixmap,
panel->font12, 2, 0, 100, WALeft, WMColorGC(scr->white),
False, "Brightness", strlen("Brightness"));
False, _("Brightness"), strlen(_("Brightness")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->hsbBrightnessS, sliderPxmp);
WMReleasePixmap(sliderPxmp);
@@ -2864,9 +2858,9 @@ hsbUpdateSaturationGradient(W_ColorPanel *panel)
W_PaintText(W_VIEW(panel->hsbSaturationS), sliderPxmp->pixmap,
panel->font12, 2, 0, 100, WALeft,
WMColorGC(from.hsv.value < 128 ? scr->white : scr->black), False,
"Saturation", strlen("Saturation"));
_("Saturation"), strlen(_("Saturation")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->hsbSaturationS, sliderPxmp);
WMReleasePixmap(sliderPxmp);
@@ -2900,9 +2894,9 @@ hsbUpdateHueGradient(W_ColorPanel *panel)
W_PaintText(W_VIEW(panel->hsbHueS), sliderPxmp->pixmap,
panel->font12, 2, 0, 100, WALeft,
WMColorGC(hsvcolor.value < 128 ? scr->white : scr->black), False,
"Hue", strlen("Hue"));
_("Hue"), strlen(_("Hue")));
else
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
WMSetSliderImage(panel->hsbHueS, sliderPxmp);
WMReleasePixmap(sliderPxmp);
@@ -3150,7 +3144,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
/* Get a filename */
if (WMRunModalFilePanelForDirectory(browseP, panel->win, spath,
"Open Palette", RSupportedFileFormats()) ) {
_("Open Palette"), RSupportedFileFormats()) ) {
filepath = WMGetFilePanelFileName(browseP);
/* Get seperation position between path and filename */
@@ -3211,13 +3205,13 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
tmp = wstrconcat(panel->configurationPath, filename);
i = remove(tmp); /* Delete the file, it doesn't belong here */
WMRunAlertPanel(scr, panel->win, "File Error",
"Invalid file format !", "OK", NULL, NULL);
WMRunAlertPanel(scr, panel->win, _("File Error"),
_("Invalid file format !"), _("OK"), NULL, NULL);
if (i != 0) {
wsyserror("can't remove file %s", tmp);
WMRunAlertPanel(scr, panel->win, "File Error",
"Couldn't remove file from Configuration Directory !",
"OK", NULL, NULL);
wsyserror(_("can't remove file %s"), tmp);
WMRunAlertPanel(scr, panel->win, _("File Error"),
_("Couldn't remove file from Configuration Directory !"),
_("OK"), NULL, NULL);
}
wfree(tmp);
}
@@ -3243,8 +3237,8 @@ customPaletteMenuRename(W_ColorPanel *panel)
item = WMGetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn);
fromName = WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item);
toName = WMRunInputPanel(scr, panel->win, "Rename", "Rename palette to:",
fromName, "OK", "Cancel");
toName = WMRunInputPanel(scr, panel->win, _("Rename"), _("Rename palette to:"),
fromName, _("OK"), _("Cancel"));
if (toName) {
@@ -3260,8 +3254,8 @@ customPaletteMenuRename(W_ColorPanel *panel)
if (access (toPath, F_OK) == 0) {
/* Careful, this palette exists already */
if (WMRunAlertPanel(scr, panel->win, "Warning",
"Palette already exists !\n\nOverwrite ?", "No", "Yes",
if (WMRunAlertPanel(scr, panel->win, _("Warning"),
_("Palette already exists !\n\nOverwrite ?"), _("No"), _("Yes"),
NULL) == 1) {
/* "No" = 0, "Yes" = 1 */
int items = WMGetPopUpButtonNumberOfItems(
@@ -3293,7 +3287,7 @@ customPaletteMenuRename(W_ColorPanel *panel)
}
if ( rename(fromPath, toPath) != 0)
wsyserror("Couldn't rename palette %s to %s\n", fromName, toName);
wsyserror(_("Couldn't rename palette %s to %s\n"), fromName, toName);
else {
WMRemovePopUpButtonItem(panel->customPaletteHistoryBtn, item);
WMInsertPopUpButtonItem(panel->customPaletteHistoryBtn, item,
@@ -3319,13 +3313,13 @@ customPaletteMenuRemove(W_ColorPanel *panel)
item = WMGetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn);
tmp = wstrconcat( "This will permanently remove the palette ",
tmp = wstrconcat( _("This will permanently remove the palette "),
WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item ));
text = wstrconcat( tmp,
".\n\nAre you sure you want to remove this palette ?");
_(".\n\nAre you sure you want to remove this palette ?"));
wfree(tmp);
choice = WMRunAlertPanel(scr, panel->win, "Remove", text, "Yes", "No",
choice = WMRunAlertPanel(scr, panel->win, _("Remove"), text, _("Yes"), _("No"),
NULL);
/* returns 0 (= "Yes") or 1 (="No") */
wfree(text);
@@ -3347,7 +3341,7 @@ customPaletteMenuRemove(W_ColorPanel *panel)
WMRemovePopUpButtonItem(panel->customPaletteHistoryBtn, item);
} else {
wsyserror("Couldn't remove palette %s\n", tmp);
wsyserror(_("Couldn't remove palette %s\n"), tmp);
}
wfree(tmp);
@@ -3652,14 +3646,14 @@ fetchFile(char *toPath, char *srcFile, char *destFile)
char buf[BUFSIZE];
if ((src = open(srcFile, O_RDONLY)) == 0) {
wsyserror("Could not open %s", srcFile);
wsyserror(_("Could not open %s"), srcFile);
return -1;
}
tmp = wstrconcat(toPath, destFile);
if ((dest = open( tmp, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))
== 0) {
wsyserror("Could not create %s", tmp);
wsyserror(_("Could not create %s"), tmp);
wfree(tmp);
return -1;
}
@@ -3670,7 +3664,7 @@ fetchFile(char *toPath, char *srcFile, char *destFile)
while ((n = read(src, buf, BUFSIZE)) > 0)
{
if (write (dest, buf, n) != n) {
wsyserror("Write error on file %s", destFile);
wsyserror(_("Write error on file %s"), destFile);
return -1;
}
}
@@ -3715,7 +3709,7 @@ convertCPColor(CPColor *color)
switch (color->set) {
case cpNone:
wwarning("Color Panel: Color unspecified");
wwarning(_("Color Panel: Color unspecified"));
return;
case cpRGB:
old_hue = color->hsv.hue;
@@ -3750,7 +3744,7 @@ ulongToRColor(WMScreen *scr, unsigned long value)
XColor *xcolor = NULL;
if (!(xcolor = wmalloc(sizeof(XColor)) )) {
wwarning(NO_MEMORY_ERR);
wwarning(_("Color Panel: Could not allocate memory"));
color.red = 0;
color.green = 0;
color.blue = 0;

View File

@@ -1,5 +1,6 @@
#include "WINGsP.h"
#include "wconfig.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -231,7 +232,7 @@ makeFilePanel(WMScreen *scrPtr, char *name, char *title)
fPtr->nameLabel = WMCreateLabel(fPtr->win);
WMMoveWidget(fPtr->nameLabel, 7, 282);
WMResizeWidget(fPtr->nameLabel, 55, 14);
WMSetLabelText(fPtr->nameLabel, "Name:");
WMSetLabelText(fPtr->nameLabel, _("Name:"));
fPtr->fileField = WMCreateTextField(fPtr->win);
WMMoveWidget(fPtr->fileField, 60, 278);
@@ -246,7 +247,7 @@ makeFilePanel(WMScreen *scrPtr, char *name, char *title)
fPtr->okButton = WMCreateCommandButton(fPtr->win);
WMMoveWidget(fPtr->okButton, 245, 325);
WMResizeWidget(fPtr->okButton, 75, 28);
WMSetButtonText(fPtr->okButton, "OK");
WMSetButtonText(fPtr->okButton, _("OK"));
WMSetButtonImage(fPtr->okButton, scrPtr->buttonArrow);
WMSetButtonAltImage(fPtr->okButton, scrPtr->pushedButtonArrow);
WMSetButtonImagePosition(fPtr->okButton, WIPRight);
@@ -255,7 +256,7 @@ makeFilePanel(WMScreen *scrPtr, char *name, char *title)
fPtr->cancelButton = WMCreateCommandButton(fPtr->win);
WMMoveWidget(fPtr->cancelButton, 165, 325);
WMResizeWidget(fPtr->cancelButton, 75, 28);
WMSetButtonText(fPtr->cancelButton, "Cancel");
WMSetButtonText(fPtr->cancelButton, _("Cancel"));
WMSetButtonAction(fPtr->cancelButton, buttonClick, fPtr);
fPtr->trashcanButton = WMCreateCommandButton(fPtr->win);
@@ -328,7 +329,7 @@ WMGetOpenPanel(WMScreen *scrPtr)
if (scrPtr->sharedOpenPanel)
return scrPtr->sharedOpenPanel;
panel = makeFilePanel(scrPtr, "openFilePanel", "Open");
panel = makeFilePanel(scrPtr, "openFilePanel", _("Open"));
panel->flags.fileMustExist = 1;
panel->flags.panelType = WP_OPEN;
@@ -346,7 +347,7 @@ WMGetSavePanel(WMScreen *scrPtr)
if (scrPtr->sharedSavePanel)
return scrPtr->sharedSavePanel;
panel = makeFilePanel(scrPtr, "saveFilePanel", "Save");
panel = makeFilePanel(scrPtr, "saveFilePanel", _("Save"));
panel->flags.fileMustExist = 0;
panel->flags.panelType = WP_SAVE;
@@ -392,13 +393,13 @@ WMRunModalFilePanelForDirectory(WMFilePanel *panel, WMWindow *owner,
panel->flags.filtered = 1;
panel->fileTypes = fileTypes;
if (name == NULL)
name = "Open";
name = _("Open");
break;
case WP_SAVE:
panel->fileTypes = NULL;
panel->flags.filtered = 0;
if (name == NULL)
name = "Save";
name = _("Save");
break;
default:
break;
@@ -558,7 +559,7 @@ listDirectoryOnColumn(WMFilePanel *panel, int column, char *path)
if (!dir) {
#ifdef VERBOSE
printf("WINGs: could not open directory %s\n", path);
printf(_("WINGs: could not open directory %s\n"), path);
#endif
return;
}
@@ -576,7 +577,7 @@ listDirectoryOnColumn(WMFilePanel *panel, int column, char *path)
if (stat(pbuf, &stat_buf)!=0) {
#ifdef VERBOSE
printf("WINGs: could not stat %s\n", pbuf);
printf(_("WINGs: could not stat %s\n"), pbuf);
#endif
continue;
} else {
@@ -643,7 +644,7 @@ showError(WMScreen *scr, WMWindow *owner, char *s, char *file)
} else {
errStr = wstrdup(s);
}
WMRunAlertPanel(scr, owner, "Error", errStr, "OK", NULL, NULL);
WMRunAlertPanel(scr, owner, _("Error"), errStr, _("OK"), NULL, NULL);
wfree(errStr);
}
@@ -654,8 +655,8 @@ createDir(WMButton *bPre, WMFilePanel *panel)
char *dirName, *directory, *file, *s;
WMScreen *scr = WMWidgetScreen(panel->win);
dirName = WMRunInputPanel(scr, panel->win, "Create Directory",
"Enter directory name", "", "OK", "Cancel");
dirName = WMRunInputPanel(scr, panel->win, _("Create Directory"),
_("Enter directory name"), "", _("OK"), _("Cancel"));
if (!dirName)
return;
@@ -680,7 +681,7 @@ createDir(WMButton *bPre, WMFilePanel *panel)
}
if ((s = strrchr(dirName, '/')) && !s[1]) s[0] = 0;
file = wmalloc(strlen(dirName)+strlen(directory)+1);
file = wmalloc(strlen(dirName)+strlen(directory)+4);
sprintf(file, "%s/%s", directory, dirName);
while ((s = strstr(file,"//"))) {
int i;
@@ -691,13 +692,13 @@ createDir(WMButton *bPre, WMFilePanel *panel)
if (mkdir(file,0xfff) != 0) {
switch (errno) {
case EACCES:
showError(scr, panel->win, "Permission denied.", NULL);
showError(scr, panel->win, _("Permission denied."), NULL);
break;
case EEXIST:
showError(scr, panel->win, "'%s' already existes.", file);
showError(scr, panel->win, _("'%s' already exists."), file);
break;
case ENOENT:
showError(scr, panel->win, "Path does not exist.", NULL);
showError(scr, panel->win, _("Path does not exist."), NULL);
}
}
else WMSetFilePanelDirectory(panel, file);
@@ -727,51 +728,53 @@ deleteFile(WMButton *bPre, WMFilePanel *panel)
if (stat(file,&filestat)) {
switch (errno) {
case ENOENT:
showError(scr, panel->win, "'%s' does not exist.", file);
showError(scr, panel->win, _("'%s' does not exist."), file);
break;
case EACCES:
showError(scr, panel->win, "Permission denied.", NULL);
showError(scr, panel->win, _("Permission denied."), NULL);
break;
case ENOMEM:
showError(scr, panel->win,
"Insufficient memory available.", NULL);
_("Insufficient memory available."), NULL);
break;
case EROFS:
showError(scr, panel->win,
"'%s' is on a read-only filesystem.", file);
_("'%s' is on a read-only filesystem."), file);
break;
default:
showError(scr, panel->win, "Can not delete '%s'.", file);
showError(scr, panel->win, _("Can not delete '%s'."), file);
}
wfree(file);
return;
} else if (S_ISDIR(filestat.st_mode)) {
buffer = wmalloc(strlen(file)+20);
sprintf(buffer,"Delete directory %s ?",file);
int len = strlen(file)+20;
buffer = wmalloc(len);
snprintf(buffer,len,_("Delete directory %s ?"),file);
} else {
buffer = wmalloc(strlen(file)+15);
sprintf(buffer,"Delete file %s ?",file);
int len = strlen(file)+15;
buffer = wmalloc(len);
snprintf(buffer,len,_("Delete file %s ?"),file);
}
if (!WMRunAlertPanel(WMWidgetScreen(panel->win), panel->win,
"Warning", buffer, "OK", "Cancel", NULL)) {
_("Warning"), buffer, _("OK"), _("Cancel"), NULL)) {
if (S_ISDIR(filestat.st_mode)) {
if (rmdir(file) != 0) {
switch (errno) {
case EACCES:
showError(scr, panel->win, "Permission denied.", NULL);
showError(scr, panel->win, _("Permission denied."), NULL);
break;
case ENOENT:
showError(scr, panel->win, "Directory '%s' does not exist.", file);
showError(scr, panel->win, _("Directory '%s' does not exist."), file);
break;
case ENOTEMPTY:
showError(scr, panel->win, "Directory '%s' is not empty.", file);
showError(scr, panel->win, _("Directory '%s' is not empty."), file);
break;
case EBUSY:
showError(scr, panel->win, "Directory '%s' is busy.", file);
showError(scr, panel->win, _("Directory '%s' is busy."), file);
break;
default:
showError(scr, panel->win, "Can not delete '%s'.", file);
showError(scr, panel->win, _("Can not delete '%s'."), file);
}
} else {
char *s = strrchr(file,'/');
@@ -781,24 +784,24 @@ deleteFile(WMButton *bPre, WMFilePanel *panel)
} else if (remove(file) != 0) {
switch (errno) {
case EISDIR:
showError(scr, panel->win, "'%s' is a directory.", file);
showError(scr, panel->win, _("'%s' is a directory."), file);
break;
case ENOENT:
showError(scr, panel->win, "'%s' does not exist.", file);
showError(scr, panel->win, _("'%s' does not exist."), file);
break;
case EACCES:
showError(scr, panel->win, "Permission denied.", NULL);
showError(scr, panel->win, _("Permission denied."), NULL);
break;
case ENOMEM:
showError(scr, panel->win,
"Insufficient memory available.", NULL);
_("Insufficient memory available."), NULL);
break;
case EROFS:
showError(scr, panel->win,
"'%s' is on a read-only filesystem.", file);
_("'%s' is on a read-only filesystem."), file);
break;
default:
showError(scr, panel->win, "Can not delete '%s'.", file);
showError(scr, panel->win, _("Can not delete '%s'."), file);
}
} else {
char *s = strrchr(file,'/');
@@ -823,11 +826,11 @@ goFloppy(WMButton *bPtr, WMFilePanel *panel)
WMScreen *scr = WMWidgetScreen(panel->win);
if (stat(WINGsConfiguration.floppyPath, &filestat)) {
showError(scr, panel->win, "An error occured browsing '%s'.",
showError(scr, panel->win, _("An error occured browsing '%s'."),
WINGsConfiguration.floppyPath);
return;
} else if (!S_ISDIR(filestat.st_mode)) {
showError(scr, panel->win, "'%s' is not a directory.",
showError(scr, panel->win, _("'%s' is not a directory."),
WINGsConfiguration.floppyPath);
return;
}
@@ -964,8 +967,8 @@ buttonClick(WMButton *bPtr, WMFilePanel *panel)
file = getCurrentFileName(panel);
if (access(file, F_OK)!=0) {
WMRunAlertPanel(WMWidgetScreen(panel->win), panel->win,
"Error", "File does not exist.",
"Ok", NULL, NULL);
_("Error"), _("File does not exist."),
_("OK"), NULL, NULL);
wfree(file);
return;
}

View File

@@ -1,5 +1,6 @@
#include "WINGsP.h"
#include "wconfig.h"
#include <wraster.h>
@@ -70,11 +71,10 @@ W_CreateFontSetWithGuess(Display *dpy, char *xlfd, char ***missing,
/* for non-iso8859-1 language and iso8859-1 specification
(this fontset is only for pattern analysis) */
if (fs == NULL) {
char *old_locale = setlocale(LC_CTYPE, NULL);
if (*nmissing != 0) XFreeStringList(*missing);
setlocale(LC_CTYPE, "C");
fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
setlocale(LC_CTYPE, old_locale);
setlocale(LC_CTYPE, "");
}
/* make XLFD font name for pattern analysis */
@@ -88,7 +88,7 @@ W_CreateFontSetWithGuess(Display *dpy, char *xlfd, char ***missing,
xlfd = generalize_xlfd (xlfd);
if (*nmissing != 0) XFreeStringList(*missing);
if (fs != 0) XFreeFontSet(dpy, fs);
if (fs != NULL) XFreeFontSet(dpy, fs);
fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
@@ -126,14 +126,14 @@ WMCreateFontSet(WMScreen *scrPtr, char *fontName)
if (nmissing > 0 && font->font.set) {
int i;
wwarning("the following character sets are missing in %s:",
wwarning(_("the following character sets are missing in %s:"),
fontName);
for (i = 0; i < nmissing; i++) {
wwarning(missing[i]);
}
XFreeStringList(missing);
if (defaultString)
wwarning("the string \"%s\" will be used in place of any characters from those sets.",
wwarning(_("the string \"%s\" will be used in place of any characters from those sets."),
defaultString);
}
if (!font->font.set) {
@@ -279,17 +279,17 @@ WMSystemFontOfSize(WMScreen *scrPtr, int size)
if (!font) {
if (scrPtr->useMultiByte) {
wwarning("could not load font set %s. Trying fixed.", fontSpec);
wwarning(_("could not load font set %s. Trying fixed."), fontSpec);
font = WMCreateFontSet(scrPtr, "fixed");
if (!font) {
font = WMCreateFontSet(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
}
} else {
wwarning("could not load font %s. Trying fixed.", fontSpec);
wwarning(_("could not load font %s. Trying fixed."), fontSpec);
font = WMCreateNormalFont(scrPtr, "fixed");
}
if (!font) {
wwarning("could not load fixed font!");
wwarning(_("could not load fixed font!"));
wfree(fontSpec);
return NULL;
}
@@ -315,17 +315,17 @@ WMBoldSystemFontOfSize(WMScreen *scrPtr, int size)
if (!font) {
if (scrPtr->useMultiByte) {
wwarning("could not load font set %s. Trying fixed.", fontSpec);
wwarning(_("could not load font set %s. Trying fixed."), fontSpec);
font = WMCreateFontSet(scrPtr, "fixed");
if (!font) {
font = WMCreateFontSet(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
}
} else {
wwarning("could not load font %s. Trying fixed.", fontSpec);
wwarning(_("could not load font %s. Trying fixed."), fontSpec);
font = WMCreateNormalFont(scrPtr, "fixed");
}
if (!font) {
wwarning("could not load fixed font!");
wwarning(_("could not load fixed font!"));
wfree(fontSpec);
return NULL;
}
@@ -420,7 +420,7 @@ makeFontSetOfSize(char *fontset, int size)
int count = ptr-fontset;
if (count > 255) {
wwarning("font description %s is too large.", fontset);
wwarning(_("font description %s is too large."), fontset);
} else {
memcpy(font, fontset, count);
font[count] = 0;

View File

@@ -4,6 +4,7 @@
#include "WINGsP.h"
#include "WUtil.h"
#include "wconfig.h"
#include <ctype.h>
#include <string.h>
@@ -70,7 +71,7 @@ static int scalableFontSizes[] = {
static void getSelectedFont(FontPanel *panel, char buffer[]);
static void getSelectedFont(FontPanel *panel, char buffer[], int bufsize);
static void arrangeLowerFrame(FontPanel *panel);
@@ -201,13 +202,13 @@ WMGetFontPanel(WMScreen *scr)
panel->sampleT = WMCreateTextField(panel->upperF);
WMResizeWidget(panel->sampleT, DEF_WIDTH - 20, 50);
WMMoveWidget(panel->sampleT, 10, 10);
WMSetTextFieldText(panel->sampleT, "Test!!!");
WMSetTextFieldText(panel->sampleT, _("Test!!!"));
font = WMBoldSystemFontOfSize(scr, 12);
panel->famL = WMCreateLabel(panel->lowerF);
WMSetWidgetBackgroundColor(panel->famL, dark);
WMSetLabelText(panel->famL, "Family");
WMSetLabelText(panel->famL, _("Family"));
WMSetLabelFont(panel->famL, font);
WMSetLabelTextColor(panel->famL, white);
WMSetLabelRelief(panel->famL, WRSunken);
@@ -218,7 +219,7 @@ WMGetFontPanel(WMScreen *scr)
panel->typL = WMCreateLabel(panel->lowerF);
WMSetWidgetBackgroundColor(panel->typL, dark);
WMSetLabelText(panel->typL, "Typeface");
WMSetLabelText(panel->typL, _("Typeface"));
WMSetLabelFont(panel->typL, font);
WMSetLabelTextColor(panel->typL, white);
WMSetLabelRelief(panel->typL, WRSunken);
@@ -229,7 +230,7 @@ WMGetFontPanel(WMScreen *scr)
panel->sizL = WMCreateLabel(panel->lowerF);
WMSetWidgetBackgroundColor(panel->sizL, dark);
WMSetLabelText(panel->sizL, "Size");
WMSetLabelText(panel->sizL, _("Size"));
WMSetLabelFont(panel->sizL, font);
WMSetLabelTextColor(panel->sizL, white);
WMSetLabelRelief(panel->sizL, WRSunken);
@@ -248,12 +249,12 @@ WMGetFontPanel(WMScreen *scr)
panel->setB = WMCreateCommandButton(panel->win);
WMResizeWidget(panel->setB, 70, 24);
WMMoveWidget(panel->setB, 240, DEF_HEIGHT - (BUTTON_SPACE_HEIGHT-5));
WMSetButtonText(panel->setB, "Set");
WMSetButtonText(panel->setB, _("Set"));
panel->revertB = WMCreateCommandButton(panel->win);
WMResizeWidget(panel->revertB, 70, 24);
WMMoveWidget(panel->revertB, 80, DEF_HEIGHT - (BUTTON_SPACE_HEIGHT-5));
WMSetButtonText(panel->revertB, "Revert");
WMSetButtonText(panel->revertB, _("Revert"));
WMRealizeWidget(panel->win);
@@ -340,9 +341,9 @@ WMGetFontPanelFont(WMFontPanel *panel)
char*
WMGetFontPanelFontName(WMFontPanel *panel)
{
char name[256];
char name[512];
getSelectedFont(panel, name);
getSelectedFont(panel, name, sizeof(name));
return wstrdup(name);
}
@@ -704,8 +705,8 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
fontList = XListFonts(scr->display, ALL_FONTS_MASK, MAX_FONTS_TO_RETRIEVE,
&count);
if (!fontList) {
WMRunAlertPanel(scr, panel->win, "Error",
"Could not retrieve font list", "OK", NULL, NULL);
WMRunAlertPanel(scr, panel->win, _("Error"),
_("Could not retrieve font list"), _("OK"), NULL, NULL);
return;
}
@@ -717,7 +718,7 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
continue;
}
if (fname_len > 255) {
wwarning("font name %s is longer than 256, which is invalid.",
wwarning(_("font name %s is longer than 256, which is invalid."),
fontList[i]);
*fontList[i] = '\0';
continue;
@@ -766,7 +767,7 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
static void
getSelectedFont(FontPanel *panel, char buffer[])
getSelectedFont(FontPanel *panel, char buffer[], int bufsize)
{
WMListItem *item;
Family *family;
@@ -786,7 +787,7 @@ getSelectedFont(FontPanel *panel, char buffer[])
size = WMGetTextFieldText(panel->sizT);
sprintf(buffer, "-%s-%s-%s-%s-%s-%s-%s-*-*-*-*-*-%s-%s",
snprintf(buffer, bufsize, "-%s-%s-%s-%s-%s-%s-%s-*-*-*-*-*-%s-%s",
family->foundry,
family->name,
face->weight,
@@ -803,10 +804,10 @@ getSelectedFont(FontPanel *panel, char buffer[])
static void
preview(FontPanel *panel)
{
char buffer[256];
char buffer[512];
WMFont *font;
getSelectedFont(panel, buffer);
getSelectedFont(panel, buffer, sizeof(buffer));
font = WMCreateFont(WMWidgetScreen(panel->win), buffer);
if (font) {
@@ -864,22 +865,22 @@ familyClick(WMWidget *w, void *data)
}
if (strcmp(face->slant, "r") == 0) {
strcat(buffer, "Roman");
strcat(buffer, _("Roman"));
top = 1;
} else if (strcmp(face->slant, "i") == 0) {
strcat(buffer, "Italic");
strcat(buffer, _("Italic"));
} else if (strcmp(face->slant, "o") == 0) {
strcat(buffer, "Oblique");
strcat(buffer, _("Oblique"));
} else if (strcmp(face->slant, "ri") == 0) {
strcat(buffer, "Rev Italic");
strcat(buffer, _("Rev Italic"));
} else if (strcmp(face->slant, "ro") == 0) {
strcat(buffer, "Rev Oblique");
strcat(buffer, _("Rev Oblique"));
} else {
strcat(buffer, face->slant);
}
if (buffer[0] == 0) {
strcpy(buffer, "Normal");
strcpy(buffer, _("Normal"));
}
if (top)

View File

@@ -1,6 +1,7 @@
#include "WINGsP.h"
#include "wconfig.h"
#include <X11/Xutil.h>
#include <X11/Xatom.h>
@@ -411,7 +412,7 @@ loadPixmaps(WMScreen *scr)
if (!image)
image = RLoadImage(scr->rcontext, X_WINGS_IMAGES_FILE, 0);
if (!image) {
wwarning("WINGs: could not load widget images file: %s",
wwarning(_("WINGs: could not load widget images file: %s"),
RMessageForError(RErrorCode));
return False;
}
@@ -753,8 +754,8 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
scrPtr->boldFont = scrPtr->normalFont;
if (!scrPtr->normalFont) {
wwarning("could not load any fonts. Make sure your font installation"
"and locale settings are correct.");
wwarning(_("could not load any fonts. Make sure your font installation"
"and locale settings are correct."));
return NULL;
}

View File

@@ -231,10 +231,10 @@ W_PaintTextAndImage(W_View *view, int wrap, GC textGC, W_Font *font,
w = view->size.width;
h = view->size.height;
} else {
x = 2;
y = 2;
w = view->size.width - 4;
h = view->size.height - 4;
x = 1;
y = 1;
w = view->size.width - 3;
h = view->size.height - 3;
}
/* calc. image alignment */

View File

@@ -20,6 +20,7 @@
#include "WINGsP.h"
#include "wconfig.h"
#define MIN_DOC_WIDTH 10
@@ -185,7 +186,7 @@ static void drawRulerOnPixmap(Ruler * rPtr)
rPtr->bg, 0, 0, rPtr->view->size.width, 40);
WMDrawString(rPtr->view->screen, rPtr->drawBuffer, rPtr->fg,
rPtr->font, rPtr->margins.left + 2, 26, "0 inches", 10);
rPtr->font, rPtr->margins.left + 2, 26, _("0 inches"), 10);
/* marker ticks */
i = j = m = 0;

View File

@@ -3,6 +3,7 @@
#include "WINGsP.h"
#include "wconfig.h"
#include <X11/keysym.h>
#include <X11/Xatom.h>
@@ -1002,15 +1003,13 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
Bool relay = True;
WMScreen *scr = tPtr->view->screen;
event->xkey.state &= ~scr->ignoredModifierMask;
/*printf("(%d,%d) -> ", tPtr->selection.position, tPtr->selection.count);*/
if (((XKeyEvent *) event)->state & WM_EMACSKEYMASK)
control_pressed = 1;
shifted = event->xkey.state & ShiftMask;
controled = event->xkey.state & ControlMask;
if ((event->xkey.state & ~(ShiftMask|ControlMask)) != 0) {
if ((event->xkey.state & (ShiftMask|ControlMask)) != 0) {
modified = True;
} else {
modified = False;
@@ -1065,9 +1064,10 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
break;
case WM_EMACSKEY_LEFT:
if (!control_pressed) {
if (!control_pressed)
goto normal_key;
}
else
modified = False;
#ifdef XK_KP_Left
case XK_KP_Left:
#endif
@@ -1099,9 +1099,11 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
break;
case WM_EMACSKEY_RIGHT:
if (!control_pressed) {
if (!control_pressed)
goto normal_key;
}
else
modified = False;
#ifdef XK_KP_Right
case XK_KP_Right:
#endif
@@ -1137,9 +1139,12 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
break;
case WM_EMACSKEY_HOME:
if (!control_pressed) {
if (!control_pressed)
goto normal_key;
}
else {
modified = False;
controled = False;
}
#ifdef XK_KP_Home
case XK_KP_Home:
#endif
@@ -1162,9 +1167,12 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
break;
case WM_EMACSKEY_END:
if (!control_pressed) {
if (!control_pressed)
goto normal_key;
}
else {
modified = False;
controled = False;
}
#ifdef XK_KP_End
case XK_KP_End:
#endif
@@ -1192,9 +1200,13 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
break;
case WM_EMACSKEY_BS:
if (!control_pressed) {
goto normal_key;
}
if (!control_pressed)
goto normal_key;
else {
modified = False;
controled = False;
shifted = False;
}
case XK_BackSpace:
if (!modified && !shifted && !controled) {
if (tPtr->selection.count) {
@@ -1215,8 +1227,12 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
break;
case WM_EMACSKEY_DEL:
if (!control_pressed) {
if (!control_pressed)
goto normal_key;
else {
modified = False;
controled = False;
shifted = False;
}
#ifdef XK_KP_Delete
case XK_KP_Delete:
@@ -1242,7 +1258,7 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
normal_key:
default:
if (!controled && !modified) {
if (!controled) {
if (count > 0 && isprint(buffer[0])) {
if (tPtr->selection.count)
WMDeleteTextFieldRange(tPtr, tPtr->selection);