X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xedittags.c;h=63be84e6e74b4861de4aa52449ab752fb28c2fd5;hb=c9602f20e9cee39ec2a7dddee3e2c12719c25ef0;hp=9e07bf0a2d67a11ff8111a6baed0b66ed1ae5907;hpb=05bc30b15e31c427ce208495a889e9ff36e6642b;p=xboard.git diff --git a/xedittags.c b/xedittags.c index 9e07bf0..63be84e 100644 --- a/xedittags.c +++ b/xedittags.c @@ -1,29 +1,25 @@ /* * xedittags.c -- Tags edit window, part of X front end for XBoard - * $Id$ * - * Copyright 1995 Free Software Foundation, Inc. + * Copyright 1995,2009 Free Software Foundation, Inc. * - * The following terms apply to the enhanced version of XBoard distributed - * by the Free Software Foundation: * ------------------------------------------------------------------------ - * This program is free software; you can redistribute it and/or modify + * + * GNU XBoard is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU XBoard is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ------------------------------------------------------------------------ + * along with this program. If not, see http://www.gnu.org/licenses/. * * - * See the file ChangeLog for a revision history. - */ + *------------------------------------------------------------------------ + ** See the file ChangeLog for a revision history. */ #include "config.h" @@ -85,6 +81,15 @@ extern char *getenv(); #include "backend.h" #include "xboard.h" #include "xedittags.h" +#include "gettext.h" + +#ifdef ENABLE_NLS +# define _(s) gettext (s) +# define N_(s) gettext_noop (s) +#else +# define _(s) (s) +# define N_(s) s +#endif extern Widget formWidget, shellWidget, boardWidget, menuBarWidget; extern Display *xDisplay; @@ -113,9 +118,9 @@ void TagsCallback(w, client_data, call_data) XtSetArg(args[j], XtNlabel, &name); j++; XtGetValues(w, args, j); - if (strcmp(name, "close") == 0) { + if (strcmp(name, _("close")) == 0) { TagsPopDown(); - } else if (strcmp(name, "edit") == 0) { + } else if (strcmp(name, _("edit")) == 0) { TagsPopDown(); EditTagsEvent(); } @@ -135,16 +140,16 @@ void EditTagsCallback(w, client_data, call_data) XtSetArg(args[j], XtNlabel, &name); j++; XtGetValues(w, args, j); - if (strcmp(name, "ok") == 0) { + if (strcmp(name, _("ok")) == 0) { textw = XtNameToWidget(editTagsShell, "*form.text"); j = 0; XtSetArg(args[j], XtNstring, &val); j++; XtGetValues(textw, args, j); ReplaceTags(val, &gameInfo); TagsPopDown(); - } else if (strcmp(name, "cancel") == 0) { + } else if (strcmp(name, _("cancel")) == 0) { TagsPopDown(); - } else if (strcmp(name, "clear") == 0) { + } else if (strcmp(name, _("clear")) == 0) { textw = XtNameToWidget(editTagsShell, "*form.text"); XtCallActionProc(textw, "select-all", NULL, NULL, 0); XtCallActionProc(textw, "kill-selection", NULL, NULL, 0); @@ -200,12 +205,8 @@ Widget TagsCreate(name, text, msg, mutable, callback) XtSetArg(args[j], XtNresizable, True); j++; XtSetArg(args[j], XtNwidth, bw_width/2); j++; XtSetArg(args[j], XtNheight, bw_width/3); j++; -#if 0 - XtSetArg(args[j], XtNscrollVertical, XawtextScrollWhenNeeded); j++; -#else /* !!Work around an apparent bug in XFree86 4.0.1 (X11R6.4.3) */ XtSetArg(args[j], XtNscrollVertical, XawtextScrollAlways); j++; -#endif XtSetArg(args[j], XtNautoFill, False); j++; textw = XtCreateManagedWidget("text", asciiTextWidgetClass, form, args, j); @@ -233,7 +234,7 @@ Widget TagsCreate(name, text, msg, mutable, callback) XtSetArg(args[j], XtNleft, XtChainLeft); j++; XtSetArg(args[j], XtNright, XtChainLeft); j++; b_ok = b = - XtCreateManagedWidget("ok", commandWidgetClass, form, args, j); + XtCreateManagedWidget(_("ok"), commandWidgetClass, form, args, j); XtAddCallback(b_ok, XtNcallback, callback, (XtPointer) 0); j = 0; @@ -244,21 +245,9 @@ Widget TagsCreate(name, text, msg, mutable, callback) XtSetArg(args[j], XtNleft, XtChainLeft); j++; XtSetArg(args[j], XtNright, XtChainLeft); j++; b_cancel = b = - XtCreateManagedWidget("cancel", commandWidgetClass, form, args, j); + XtCreateManagedWidget(_("cancel"), commandWidgetClass, form, args, j); XtAddCallback(b_cancel, XtNcallback, callback, (XtPointer) 0); -#if 0 - j = 0; - XtSetArg(args[j], XtNfromVert, msgw); j++; - XtSetArg(args[j], XtNfromHoriz, b); j++; - XtSetArg(args[j], XtNtop, XtChainBottom); j++; - XtSetArg(args[j], XtNbottom, XtChainBottom); j++; - XtSetArg(args[j], XtNleft, XtChainLeft); j++; - XtSetArg(args[j], XtNright, XtChainLeft); j++; - b_clear = b = - XtCreateManagedWidget("clear", commandWidgetClass, form, args, j); - XtAddCallback(b_clear, XtNcallback, callback, (XtPointer) 0); -#endif } else { j = 0; XtSetArg(args[j], XtNfromVert, msgw); j++; @@ -267,7 +256,7 @@ Widget TagsCreate(name, text, msg, mutable, callback) XtSetArg(args[j], XtNleft, XtChainLeft); j++; XtSetArg(args[j], XtNright, XtChainLeft); j++; b_close = b = - XtCreateManagedWidget("close", commandWidgetClass, form, args, j); + XtCreateManagedWidget(_("close"), commandWidgetClass, form, args, j); XtAddCallback(b_close, XtNcallback, callback, (XtPointer) 0); j = 0; @@ -278,7 +267,7 @@ Widget TagsCreate(name, text, msg, mutable, callback) XtSetArg(args[j], XtNleft, XtChainLeft); j++; XtSetArg(args[j], XtNright, XtChainLeft); j++; b_edit = b = - XtCreateManagedWidget("edit", commandWidgetClass, form, args, j); + XtCreateManagedWidget(_("edit"), commandWidgetClass, form, args, j); XtAddCallback(b_edit, XtNcallback, callback, (XtPointer) 0); } @@ -331,7 +320,7 @@ void TagsPopUp(tags, msg) if (editTagsUp) TagsPopDown(); if (tagsShell == NULL) { tagsShell = - TagsCreate("Tags", tags, msg, False, TagsCallback); + TagsCreate(_("Tags"), tags, msg, False, TagsCallback); } else { textw = XtNameToWidget(tagsShell, "*form.text"); j = 0; @@ -339,7 +328,7 @@ void TagsPopUp(tags, msg) XtSetValues(textw, args, j); j = 0; XtSetArg(args[j], XtNiconName, (XtArgVal) "Tags"); j++; - XtSetArg(args[j], XtNtitle, (XtArgVal) "Tags"); j++; + XtSetArg(args[j], XtNtitle, (XtArgVal) _("Tags")); j++; XtSetValues(tagsShell, args, j); msgw = XtNameToWidget(tagsShell, "*form.msg"); if (msgw) { @@ -370,7 +359,7 @@ void EditTagsPopUp(tags) if (tagsUp) TagsPopDown(); if (editTagsShell == NULL) { editTagsShell = - TagsCreate("Edit tags", tags, NULL, True, EditTagsCallback); + TagsCreate(_("Edit tags"), tags, NULL, True, EditTagsCallback); } else { textw = XtNameToWidget(editTagsShell, "*form.text"); j = 0; @@ -378,7 +367,7 @@ void EditTagsPopUp(tags) XtSetValues(textw, args, j); j = 0; XtSetArg(args[j], XtNiconName, (XtArgVal) "Edit Tags"); j++; - XtSetArg(args[j], XtNtitle, (XtArgVal) "Edit Tags"); j++; + XtSetArg(args[j], XtNtitle, (XtArgVal) _("Edit Tags")); j++; XtSetValues(editTagsShell, args, j); }