2 * xedittags.c -- Tags edit window, part of X front end for XBoard
4 * Copyright 1995,2009 Free Software Foundation, Inc.
6 * ------------------------------------------------------------------------
8 * GNU XBoard is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or (at
11 * your option) any later version.
13 * GNU XBoard is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see http://www.gnu.org/licenses/. *
21 *------------------------------------------------------------------------
22 ** See the file ChangeLog for a revision history. */
29 #include <sys/types.h>
34 #else /* not STDC_HEADERS */
35 extern char *getenv();
38 # else /* not HAVE_STRING_H */
40 # endif /* not HAVE_STRING_H */
41 #endif /* not STDC_HEADERS */
47 #include <X11/Intrinsic.h>
48 #include <X11/StringDefs.h>
49 #include <X11/Shell.h>
50 #include <X11/cursorfont.h>
52 #include <X11/Xaw3d/Dialog.h>
53 #include <X11/Xaw3d/Form.h>
54 #include <X11/Xaw3d/List.h>
55 #include <X11/Xaw3d/Label.h>
56 #include <X11/Xaw3d/SimpleMenu.h>
57 #include <X11/Xaw3d/SmeBSB.h>
58 #include <X11/Xaw3d/SmeLine.h>
59 #include <X11/Xaw3d/Box.h>
60 #include <X11/Xaw3d/MenuButton.h>
61 #include <X11/Xaw3d/Text.h>
62 #include <X11/Xaw3d/AsciiText.h>
63 #include <X11/Xaw3d/Viewport.h>
65 #include <X11/Xaw/Dialog.h>
66 #include <X11/Xaw/Form.h>
67 #include <X11/Xaw/List.h>
68 #include <X11/Xaw/Label.h>
69 #include <X11/Xaw/SimpleMenu.h>
70 #include <X11/Xaw/SmeBSB.h>
71 #include <X11/Xaw/SmeLine.h>
72 #include <X11/Xaw/Box.h>
73 #include <X11/Xaw/MenuButton.h>
74 #include <X11/Xaw/Text.h>
75 #include <X11/Xaw/AsciiText.h>
76 #include <X11/Xaw/Viewport.h>
83 #include "xedittags.h"
87 # define _(s) gettext (s)
88 # define N_(s) gettext_noop (s)
94 extern Widget formWidget, shellWidget, boardWidget, menuBarWidget;
95 extern Display *xDisplay;
96 extern int squareSize;
97 extern Pixmap xMarkPixmap;
98 extern char *layoutName;
100 Position tagsX = -1, tagsY = -1;
101 int tagsUp = False, editTagsUp = False;
102 Widget tagsShell, editTagsShell;
104 static Arg layoutArgs[] = {
105 { XtNborderWidth, 0 },
106 { XtNdefaultDistance, 0 }
109 void TagsCallback(w, client_data, call_data)
111 XtPointer client_data, call_data;
118 XtSetArg(args[j], XtNlabel, &name); j++;
119 XtGetValues(w, args, j);
121 if (strcmp(name, _("close")) == 0) {
123 } else if (strcmp(name, _("edit")) == 0) {
130 void EditTagsCallback(w, client_data, call_data)
132 XtPointer client_data, call_data;
140 XtSetArg(args[j], XtNlabel, &name); j++;
141 XtGetValues(w, args, j);
143 if (strcmp(name, _("ok")) == 0) {
144 textw = XtNameToWidget(editTagsShell, "*form.text");
146 XtSetArg(args[j], XtNstring, &val); j++;
147 XtGetValues(textw, args, j);
148 ReplaceTags(val, &gameInfo);
150 } else if (strcmp(name, _("cancel")) == 0) {
152 } else if (strcmp(name, _("clear")) == 0) {
153 textw = XtNameToWidget(editTagsShell, "*form.text");
154 XtCallActionProc(textw, "select-all", NULL, NULL, 0);
155 XtCallActionProc(textw, "kill-selection", NULL, NULL, 0);
159 Widget TagsCreate(name, text, msg, mutable, callback)
160 char *name, *text, *msg;
161 int /*Boolean*/ mutable;
162 XtCallbackProc callback;
165 Widget shell, form, textw, msgw, layout;
166 Widget b_ok, b_cancel, b_close, b_edit, b;
167 Dimension bw_width, pw_width;
173 XtSetArg(args[j], XtNwidth, &bw_width); j++;
174 XtGetValues(boardWidget, args, j);
177 XtSetArg(args[j], XtNresizable, True); j++;
180 XtCreatePopupShell(name, topLevelShellWidgetClass,
181 shellWidget, args, j);