a83e47b3c697251772db88f1500301fce0756214
[xboard.git] / xedittags.c
1 /*
2  * xedittags.c -- Tags edit window, part of X front end for XBoard
3  *
4  * Copyright 1995, 2009, 2010, 2011 Free Software Foundation, Inc.
5  *
6  * ------------------------------------------------------------------------
7  *
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.
12  *
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.
17  *
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/.  *
20  *
21  *------------------------------------------------------------------------
22  ** See the file ChangeLog for a revision history.  */
23
24 #include "config.h"
25
26 #include <stdio.h>
27 #include <ctype.h>
28 #include <errno.h>
29 #include <sys/types.h>
30
31 #if STDC_HEADERS
32 # include <stdlib.h>
33 # include <string.h>
34 #else /* not STDC_HEADERS */
35 extern char *getenv();
36 # if HAVE_STRING_H
37 #  include <string.h>
38 # else /* not HAVE_STRING_H */
39 #  include <strings.h>
40 # endif /* not HAVE_STRING_H */
41 #endif /* not STDC_HEADERS */
42
43 #if HAVE_UNISTD_H
44 # include <unistd.h>
45 #endif
46
47 #include <X11/Intrinsic.h>
48 #include <X11/StringDefs.h>
49 #include <X11/Shell.h>
50 #include <X11/cursorfont.h>
51 #if USE_XAW3D
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>
64 #else
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>
77 #endif
78
79 #include "common.h"
80 #include "frontend.h"
81 #include "backend.h"
82 #include "xboard.h"
83 #include "xedittags.h"
84 #include "gettext.h"
85
86 #ifdef ENABLE_NLS
87 # define  _(s) gettext (s)
88 # define N_(s) gettext_noop (s)
89 #else
90 # define  _(s) (s)
91 # define N_(s)  s
92 #endif
93
94 Position tagsX = -1, tagsY = -1;
95
96 void TagsPopUp(tags, msg)
97      char *tags, *msg;
98 {
99     NewTagsPopup(tags, cmailMsgLoaded ? msg : NULL);
100 }
101
102
103 void EditTagsPopUp(tags, dest)
104      char *tags;
105      char **dest;
106 {
107     NewTagsPopup(tags, NULL);
108 }
109
110 void TagsPopDown()
111 {
112     PopDown(2);
113     bookUp = False;
114 }
115
116 void
117 EditTagsProc(w, event, prms, nprms)
118      Widget w;
119      XEvent *event;
120      String *prms;
121      Cardinal *nprms;
122 {
123     Arg args[5];
124     int j;
125     if (!bookUp && PopDown(2)) {
126         j = 0;
127         XtSetArg(args[j], XtNleftBitmap, None); j++;
128         XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Tags"), args, j);
129     } else {
130         EditTagsEvent();
131     }
132 }