annotate lisp/oobr/tree-x/intf.c @ 14:9ee227acff29 r19-15b90

Import from CVS: tag r19-15b90
author cvs
date Mon, 13 Aug 2007 08:48:42 +0200
parents 376386a54a3c
children 4103f0995bd7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 * File : intf.c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 * Purpose : X11/Athena interface code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 #define GLOBALS 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 #include <stdio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 #include <string.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 #include <fcntl.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 #include "X11/IntrinsicP.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 #include <X11/ShellP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 #include <X11/Intrinsic.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 #include <X11/StringDefs.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 #include <X11/Xaw/Box.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 #include <X11/Xaw/Simple.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 #include <X11/Xaw/MenuButton.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 #include <X11/Xaw/SimpleMenu.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 #include <X11/Xaw/SmeBSB.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #include <X11/Xaw/SmeLine.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #include <X11/Xaw/Form.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #include <X11/Xaw/Label.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #include <X11/Xaw/Dialog.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #include <X11/Xaw/AsciiText.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #include <X11/Xaw/AsciiSrc.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #include <X11/Xaw/Viewport.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include <X11/Xaw/Scrollbar.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include <X11/Xaw/Paned.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include <X11/Xaw/Panner.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include <X11/Xaw/Reports.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "defs.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "tree.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include "dbl.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #include "intf.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include "rsrc.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #include "input.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #include "help.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #include <X11/cursorfont.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 /* Global Variables */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 extern char *EnvNm; /* Stores name of current Envir file */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 Atom wm_delete_window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 Widget TreeTopLevel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 Widget TreeDrawingArea;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 Display *TreeDisplay;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 XtAppContext app;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 int TreeScreen;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 int TreeContourWidth;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 int TreeBorderSize = BORDER_SIZE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 int TreeParentDistance = PARENT_DISTANCE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 XFontStruct *TreeLabelFont;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 DoubleBuffer *TreeDrawingAreaDB;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ContourOption TreeShowContourOption = NoContours;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 DensityOption TreeLayoutDensity = Fixed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 char TreeShowSteps = FALSE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 char TreeAlignNodes = FALSE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 char PauseAfterStep = FALSE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 /* Local Variables */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 static Tree *PopupNode; /* node selected for popup */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 static NodePosition NodePos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 static Widget mainWindow;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 static Widget topForm;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 static Widget statusLabel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 static Widget statusText;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 static Widget scrolledWindow;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 static Widget helpShell;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 static Widget helpForm;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 static Widget helpScrollWindow;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 static Widget helpText;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 static Widget helpDoneButton;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 static Widget helpTitle;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 static Widget helpFrame;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 static Widget treeMenubar;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 static Widget treeMenus[NUM_MENUS];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 static Widget treeMenuBtns[NUM_MENUS - 1]; /* don't need button for */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 /* node popup menu */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 static Widget treeMenuItems[TREE_MENU_ITEMS];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 static Widget layoutMenuItems[LAYOUT_MENU_ITEMS];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 static Widget nodeMenuItems[NODE_MENU_ITEMS];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 static Widget helpBtn;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 static String labelStr[NUM_MENU_STRS];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 static String errStr[NUM_ERRS];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 static Widget dialog[NUM_DLG];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 /* globals used for state values */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 static Widget dlgLevelScale, dlgLevelValuator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 dlgSiblingValuator, dlgSiblingScale;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 static int dlgLevelValue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 static int dlgSiblingValue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 static int loading_file = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 static Pixmap check_pixmap, slider_pixmap;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 static Boolean nodeFound;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 static int PauseTime = ANIMATION_SPEED_FAST;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 static Cursor PauseCursor;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 static XtResource applRsrcsDesc[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 TrNbackgroundColor, TrCBackgroundColor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 XtRPixel, sizeof(Pixel),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 XtOffset(ApplRsrcDataPtr, background_color),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 XtRString, TrDefaultBackgroundColor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 TrNtreeColor, TrCTreeColor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 XtRPixel, sizeof(Pixel),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 XtOffset(ApplRsrcDataPtr, tree_color),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 XtRString, TrDefaultTreeColor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 TrNcontourColor, TrCContourColor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 XtRPixel, sizeof(Pixel),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 XtOffset(ApplRsrcDataPtr, contour_color),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 XtRString, TrDefaultContourColor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 TrNsplitColor, TrCSplitColor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 XtRPixel, sizeof(Pixel),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 XtOffset(ApplRsrcDataPtr, split_color),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 XtRString, TrDefaultSplitColor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 TrNhighlightColor, TrCHighlightColor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 XtRPixel, sizeof(Pixel),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 XtOffset(ApplRsrcDataPtr, highlight_color),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 XtRString, TrDefaultHighlightColor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 TrNactionColor, TrCActionColor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 XtRPixel, sizeof(Pixel),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 XtOffset(ApplRsrcDataPtr, action_color),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 XtRString, TrDefaultActionColor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 TrNcontourWidth, TrCContourWidth,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 XtRInt, sizeof(int),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 XtOffset(ApplRsrcDataPtr, contour_width),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 XtRImmediate, (XtPointer) TrDefaultContourWidth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 static void popdown_action();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 static void activate_action();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 static void quit_action();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 static void Action();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 static void select_action();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 static void button_action();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 static void menu_popup_action();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 static void set_levelscale_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 static void levelscale_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 static void set_siblingscale_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 static void siblingscale_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 static void set_levelvalue_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 static void set_siblingvalue_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 static void levelvalue_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 static void siblingvalue_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 static void center_widget();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 static XtActionsRec local_actions[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 {"wmpopdown", popdown_action},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 {"dlg_activate", activate_action},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 {"node_select", select_action},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 {"node_menu_prepare", button_action},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 {"maybe_menu_popup", menu_popup_action},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 {"quit", quit_action},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 String fallback_resources[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 "*statusText.width: 310",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 "*treeDrawingArea.width: 310",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 "*treeDrawingArea.height: 400",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 "*Text.Font: -*-lucidatypewriter-medium-r-*-*-12-*-*-*-*-*-iso8859-1",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 "*Label.Font: -*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 "*Command.Font: -*-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 "*SimpleMenu.Font: -*-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 "*SmeBSB.Font: -*-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 "*MenuButton.Font: -*-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 "*List.Font: -*-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 "*treeMenuBtn.label: Tree",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 "*layoutMenuBtn.label: Layout",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 "*helpBtn.label: Help...",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 "*treeMenu*treeMenuNew.label: New Tree",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 "*treeMenu*treeMenuLoad.label: Load Tree",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 "*treeMenu*treeMenuSave.label: Save Tree",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 "*treeMenu*treeMenuQuit.label: Quit",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 "*layoutMenu*layoutMenuFixed.label: Fixed",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 "*layoutMenu*layoutMenuVariable.label: Variable",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 "*layoutMenu*layoutMenuSpacing.label: Spacing...",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 "*layoutMenu*layoutMenuAlignNodes.label: Align Nodes on Level",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 "*dlgNewTree.title: New Tree",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 "*dlgNodeName.title: Node Name",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 "*dlgInfo.title: Information",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 "*dlgError.title: Error!",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 "*dlgSpacing.title: Tree Node Spacing",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 "*helpShell.title: Help",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 "*dlgNewTreeForm.label: Enter name of root node:",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 "*dlgNodeNameForm.label: Enter name of new node:",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 "*dlgFileForm.label: Enter name of file:",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 "*dlgInfoForm.label: Information:",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 "*dlgErrorForm.label: Error:",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 "*dlgSpacing.label: Spacing Dialog",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 "*dlgLevelLabel.label: Level spacing:",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 "*dlgSiblingLabel.label: Sibling spacing:",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 "*dlgLevelValuator.width: 40",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 "*dlgLevelValuator.width: 40",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 "*dlgNewTreeOk.label: Ok",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 "*dlgNewTreeCancel.label: Cancel",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 "*dlgFileOk.label: Ok",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 "*dlgFileCancel.label: Cancel",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 "*dlgInfoButton.label: Acknowledged",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 "*dlgErrorButton.label: Acknowledged",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 "*dlgOkButton.label: Ok",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 "*dlgCancelButton.label: Cancel",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 "*dlgNodeNameOk.label: Ok",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 "*dlgNodeNameCancel.label: Cancel",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 "*helpDoneButton.label: Dismiss",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 "*helpTitle.label: Help for Drawing Dynamic Trees",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 "*treeDrawingArea.Translations: #override \\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 <Btn1Down>: node_select(EDIT)\\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 <Btn2Down>: node_select(VIEW)\\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 <Btn3Down>: XawPositionSimpleMenu(nodeMenu)node_menu_prepare()XtMenuPopup(nodeMenu)\\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 static ApplRsrcData applRsrcs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 static ApplRsrcDataPtr applRsrcsPtr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 /* included bitmaps */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 #define gray_width 8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 #define gray_height 8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 static unsigned char gray_bits[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 /* This is a check mark stolen from the xmh application. :) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 #define check_width 9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 #define check_height 8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 static unsigned char check_bits[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x60, 0x00,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 0x31, 0x00, 0x1b, 0x00, 0x0e, 0x00, 0x04, 0x00
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 #define slider_pixmap_width 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 #define slider_pixmap_height 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 static char slider_pixmap_bits[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 0x05, 0x0a, 0x05, 0x0a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 /* Forward Function Declarations */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 static void popup_dialog();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 static void Quit_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 static void Contours_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 static void ShowContours_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 static void Pause_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 static void Speed_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 static void Help_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 static void HelpDone_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 static void Scale_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 static void TreeMenu_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 static void LayoutMenu_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 static void NodeMenu_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 static void NodeLabel_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 static void NewTree_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 static void File_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 static void Popdown_CB();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 static void ButtonHandler();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 extern void ExposeHandler();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 /* Functions */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 * Status() displays the specified text in the status area.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 * 'urgent' overrides the value of TreeShowSteps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 StatusMsg(msg, urgent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 char *msg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 int urgent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 if (TreeShowSteps || urgent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 XtVaSetValues(statusText, XtNlabel, msg, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 * Pause is a trivial function, for the benefit of interface-dependent code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 * inside tree.c. This avoids having to include X11 stuff inside that file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 * PauseTime is expected to contain an integer indicating 1/10ths of a sec.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 Pause()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 XEvent event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 if (PauseAfterStep) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 XGrabKeyboard(TreeDisplay, XtWindow(TreeTopLevel), False,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 GrabModeAsync, GrabModeAsync, CurrentTime);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 XGrabPointer(TreeDisplay, XtWindow(TreeTopLevel), False,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ButtonPressMask | ButtonReleaseMask,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 GrabModeAsync, GrabModeAsync, None,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 PauseCursor, CurrentTime);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 XMaskEvent(TreeDisplay, ButtonPressMask | KeyPress, &event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 XUngrabPointer(TreeDisplay, CurrentTime);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 XUngrabKeyboard(TreeDisplay, CurrentTime);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 else if (TreeShowSteps) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 XSync(TreeDisplay, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 usleep(PauseTime * 100000);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 * BuildPopupMenus() builds the popup menus for use in the application
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 * window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 BuildPopupMenus(parent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 Widget parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 Arg args[2];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 String xstr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 labelStr[STR_NODE_COLLAPSE] = "Collapse Node";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 labelStr[STR_NODE_EXPAND] = "Expand Node";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 treeMenus[NODE_MENU] = XtVaCreatePopupShell("nodeMenu",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 simpleMenuWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 parent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 XtNlabel, " ",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (void) XtVaCreateManagedWidget("nodeMenuAddChild", smeLineObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 treeMenus[NODE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 nodeMenuItems[NODE_MENU_ADD_CHILD] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 XtVaCreateManagedWidget("nodeMenuAddChild", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 treeMenus[NODE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 XtNlabel, "Add Child",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 XtAddCallback(nodeMenuItems[NODE_MENU_ADD_CHILD],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 XtNcallback, NodeMenu_CB, (XtPointer) NODE_MENU_ADD_CHILD);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 nodeMenuItems[NODE_MENU_ADD_BEFORE] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 XtVaCreateManagedWidget("nodeMenuAddSiblingBefore", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 treeMenus[NODE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 XtNlabel, "Add Sibling Before",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 XtAddCallback(nodeMenuItems[NODE_MENU_ADD_BEFORE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 XtNcallback, NodeMenu_CB, (XtPointer) NODE_MENU_ADD_BEFORE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 nodeMenuItems[NODE_MENU_ADD_AFTER] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 XtVaCreateManagedWidget("nodeMenuAddSiblingAfter", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 treeMenus[NODE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 XtNlabel, "Add Sibling After",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 XtAddCallback(nodeMenuItems[NODE_MENU_ADD_AFTER],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 XtNcallback, NodeMenu_CB, (XtPointer) NODE_MENU_ADD_AFTER);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 nodeMenuItems[NODE_MENU_ELISION] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 XtVaCreateManagedWidget("nodeMenuElision", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 treeMenus[NODE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 XtNlabel, labelStr[STR_NODE_COLLAPSE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 XtAddCallback(nodeMenuItems[NODE_MENU_ELISION],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 XtNcallback, NodeMenu_CB, (XtPointer) NODE_MENU_ELISION);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 nodeMenuItems[NODE_MENU_DELETE] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 XtVaCreateManagedWidget("nodeMenuDeleteNode", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 treeMenus[NODE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 XtNlabel, "Delete Node",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 XtAddCallback(nodeMenuItems[NODE_MENU_DELETE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 XtNcallback, NodeMenu_CB, (XtPointer) NODE_MENU_DELETE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 * BuildMenubar() builds the menubar that appears in the main window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 BuildMenubar(parent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 Widget parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 Arg args[4];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 Widget box;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 box = XtVaCreateManagedWidget("menuBox",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 boxWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 parent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 XtNshowGrip, FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 XtNborderWidth, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 /* menu button widgets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 treeMenuBtns[TREE_MENU] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 XtVaCreateManagedWidget("treeMenuBtn",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 menuButtonWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 box,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 XtNmenuName, "treeMenu",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 treeMenuBtns[LAYOUT_MENU] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 XtVaCreateManagedWidget("layoutMenuBtn",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 menuButtonWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 box,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 XtNmenuName, "layoutMenu",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 helpBtn = XtVaCreateManagedWidget("helpBtn",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 commandWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 box,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 XtAddCallback(helpBtn, XtNcallback, Help_CB, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 /* create pulldwon menus */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 treeMenus[TREE_MENU] = XtVaCreatePopupShell("treeMenu",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 simpleMenuWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 treeMenuBtns[TREE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 NULL, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 treeMenus[LAYOUT_MENU] = XtVaCreatePopupShell("layoutMenu",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 simpleMenuWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 treeMenuBtns[LAYOUT_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 NULL, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 /* adding menu entries */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 /* Tree menu */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 treeMenuItems[TREE_MENU_NEW] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 XtVaCreateManagedWidget("treeMenuNew", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 treeMenus[TREE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 XtAddCallback(treeMenuItems[TREE_MENU_NEW],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 XtNcallback, TreeMenu_CB, TREE_MENU_NEW);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 treeMenuItems[TREE_MENU_LOAD] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 XtVaCreateManagedWidget("treeMenuLoad", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 treeMenus[TREE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 XtAddCallback(treeMenuItems[TREE_MENU_LOAD],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 XtNcallback, TreeMenu_CB, (XtPointer) TREE_MENU_LOAD);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 treeMenuItems[TREE_MENU_SAVE] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 XtVaCreateManagedWidget("treeMenuSave", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 treeMenus[TREE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 XtAddCallback(treeMenuItems[TREE_MENU_SAVE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 XtNcallback, TreeMenu_CB, (XtPointer) TREE_MENU_SAVE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 treeMenuItems[TREE_MENU_SEP1] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 XtVaCreateManagedWidget("treeMenuSep1", smeLineObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 treeMenus[TREE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 #ifdef COMMENT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 treeMenuItems[TREE_MENU_STATS] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 XtVaCreateManagedWidget("treeMenuStats", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 treeMenus[TREE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 XtNlabel, labelStr[STR_SHOW_STATS],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 XtAddCallback(treeMenuItems[TREE_MENU_STATS],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 XtNcallback, TreeMenu_CB, (XtPointer) TREE_MENU_STATS);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 XtSetSensitive(treeMenuItems[TREE_MENU_STATS], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 treeMenuItems[TREE_MENU_SEP2] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 XtVaCreateManagedWidget("treeMenuSep2", smeLineObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 treeMenus[TREE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 #endif /* COMMENT */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 treeMenuItems[TREE_MENU_QUIT] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 XtVaCreateManagedWidget("treeMenuQuit", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 treeMenus[TREE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 XtAddCallback(treeMenuItems[TREE_MENU_QUIT],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 XtNcallback, TreeMenu_CB, (XtPointer) TREE_MENU_QUIT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 /* Layout menu */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 #ifdef COMMENT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 treeMenuItems[LAYOUT_MENU_FIXED] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 XtVaCreateManagedWidget("layoutMenuFixed", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 treeMenus[LAYOUT_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 XtNleftMargin, 18,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 XtAddCallback(treeMenuItems[LAYOUT_MENU_FIXED],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 XtNcallback, LayoutMenu_CB, (XtPointer) LAYOUT_MENU_FIXED);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 treeMenuItems[LAYOUT_MENU_VARIABLE] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 XtVaCreateManagedWidget("layoutMenuVariable", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 treeMenus[LAYOUT_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 XtNleftMargin, 18,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 XtAddCallback(treeMenuItems[LAYOUT_MENU_VARIABLE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 XtNcallback, LayoutMenu_CB, (XtPointer) LAYOUT_MENU_VARIABLE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 treeMenuItems[LAYOUT_MENU_SEP1] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 XtVaCreateManagedWidget("layoutSep1", smeLineObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 treeMenus[LAYOUT_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 #endif /* COMMENT */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 treeMenuItems[LAYOUT_MENU_SPACING] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 XtVaCreateManagedWidget("layoutMenuSpacing", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 treeMenus[LAYOUT_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 XtNleftMargin, 18,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 XtAddCallback(treeMenuItems[LAYOUT_MENU_SPACING],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 XtNcallback, LayoutMenu_CB, (XtPointer) LAYOUT_MENU_SPACING);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 treeMenuItems[LAYOUT_MENU_SEP2] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 XtVaCreateManagedWidget("layoutMenuSep2", smeLineObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 treeMenus[LAYOUT_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 /* the following is a toggle button - we hack it using a bitmap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 treeMenuItems[LAYOUT_MENU_ALIGN_NODES] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 XtVaCreateManagedWidget("layoutMenuAlignNodes", smeBSBObjectClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 treeMenus[LAYOUT_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 XtNleftMargin, 18,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 XtAddCallback(treeMenuItems[LAYOUT_MENU_ALIGN_NODES],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 XtNcallback, LayoutMenu_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (XtPointer) LAYOUT_MENU_ALIGN_NODES);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 * BuildDialogs() builds all the dialogs used in this application.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 BuildDialogs(parent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 Widget parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 tmpwidget, dlgForm, dlgValue,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 dlgLevelLabel, dlgSiblingLabel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 dlgOkButton, dlgCancelButton;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 labelStr[STR_LOAD_FILE] = "Name of file to load:";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 labelStr[STR_SAVE_FILE] = "Name of file to save:";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 errStr[ERR_OPENFAIL] = "Failed to open file.";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 errStr[ERR_EMPTYFILE] = "Input file is empty.";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 errStr[ERR_MEMALLOC] = "Memory allocation failed.";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 errStr[ERR_NOBEGIN] = "End of list does not have a matching beginning.";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 errStr[ERR_NOEND] = "Beginning of list does not have a matching end.";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 errStr[ERR_NOROOT] = "Input file does not have a root label.";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 errStr[ERR_MANYROOT] = "Input file has more than one root label.";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 dialog[DLG_NEW] = XtVaCreatePopupShell("dlgNewTree",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 transientShellWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 parent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 XtNresizable, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 tmpwidget = XtVaCreateManagedWidget("dlgNewTreeForm",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 dialogWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 dialog[DLG_NEW],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 XtNresizable, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 XtNvalue, "",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 XawDialogAddButton(tmpwidget, "dlgNewTreeOk", NewTree_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (XtPointer) TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 XawDialogAddButton(tmpwidget, "dlgNewTreeCancel", NewTree_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (XtPointer) FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 dlgValue = XtNameToWidget(tmpwidget, "value");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 XtOverrideTranslations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (dlgValue, XtParseTranslationTable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 ("<Key>Return:dlg_activate(dlgNewTreeOk)\n"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 dialog[DLG_NODE_NAME] = XtVaCreatePopupShell("dlgNodeName",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 transientShellWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 TreeTopLevel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 XtNresizable, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 tmpwidget= XtVaCreateManagedWidget("dlgNodeNameForm",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 dialogWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 dialog[DLG_NODE_NAME],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 XtNresizable, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 XtNvalue, "",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 XawDialogAddButton(tmpwidget, "dlgNodeNameOk", NodeLabel_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (XtPointer) TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 XawDialogAddButton(tmpwidget, "dlgNodeNameCancel", NodeLabel_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (XtPointer) FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 dlgValue = XtNameToWidget(tmpwidget, "value");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 XtOverrideTranslations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (dlgValue, XtParseTranslationTable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 ("<Key>Return: dlg_activate(dlgNodeNameOk)\n"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 dialog[DLG_FILE] = XtVaCreatePopupShell("dlgFile",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 transientShellWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 TreeTopLevel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 XtNresizable, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 tmpwidget = XtVaCreateManagedWidget("dlgFileForm",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 dialogWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 dialog[DLG_FILE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 XtNresizable, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 XtNvalue, "",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 XawDialogAddButton(tmpwidget, "dlgFileOk", File_CB, (XtPointer) TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 XawDialogAddButton(tmpwidget, "dlgFileCancel", File_CB, (XtPointer) FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 dlgValue = XtNameToWidget(tmpwidget, "value");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 XtOverrideTranslations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (dlgValue, XtParseTranslationTable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 ("<Key>Return:dlg_activate(dlgFileOk)\n"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 dialog[DLG_INFO] = XtVaCreatePopupShell("dlgInfo",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 transientShellWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 TreeTopLevel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 XtNresizable, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 tmpwidget = XtVaCreatePopupShell("dlgInfoForm",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 dialogWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 dialog[DLG_INFO],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 XtNresizable, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 XtNvalue, "",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 XawDialogAddButton(tmpwidget, "dlgInfoButton", Popdown_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (XtPointer) dialog[DLG_INFO]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 dialog[DLG_ERROR] = XtVaCreatePopupShell("dlgError",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 transientShellWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 TreeTopLevel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 XtNresizable, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 tmpwidget = XtVaCreateManagedWidget("dlgErrorForm",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 dialogWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 dialog[DLG_ERROR],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 XtNresizable, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 XtNvalue, "",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 XawDialogAddButton(tmpwidget, "dlgErrorButton", Popdown_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (XtPointer) dialog[DLG_ERROR]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 dialog[DLG_SPACING] = XtVaCreatePopupShell("dlgSpacing",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 transientShellWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 TreeTopLevel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 XtNresizable, FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 dlgForm = XtVaCreateManagedWidget("dlgSpacingForm",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 formWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 dialog[DLG_SPACING],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 XtNresizable, FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 dlgLevelLabel = XtVaCreateManagedWidget("dlgLevelLabel",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 labelWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 dlgForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 XtNfromVert, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 XtNfromHoriz, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 XtNbottom, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 XtNright, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 XtNborderWidth, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 dlgLevelValuator = XtVaCreateManagedWidget("dlgLevelValuator",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 labelWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 dlgForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 XtNfromVert, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 XtNfromHoriz, dlgLevelLabel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 XtNbottom, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 XtNright, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 XtNlabel, " ",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 dlgLevelScale = XtVaCreateManagedWidget("dlgLevelScale",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 pannerWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 dlgForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 XtNfromVert, dlgLevelLabel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 XtNfromHoriz, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 XtNbottom, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 XtNright, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 XtNcanvasWidth, 110,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 XtNdefaultScale, 1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 XtNinternalSpace, 1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 XtNrubberBand, FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 XtNshadowThickness, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 XtNallowOff, FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 XtNwidth, 200,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 XtNsliderWidth, 10,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 XtNheight, 15,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 XtOverrideTranslations(dlgLevelScale, XtParseTranslationTable("\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 <Btn2Down>: start()\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 <Btn2Motion>: move()\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 <Btn2Up>: notify()stop()\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 <Btn3Down>: abort()\n"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 XtAddCallback(dlgLevelScale, XtNreportCallback, levelscale_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (XtPointer) dlgLevelValuator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 XtAddCallback(dlgLevelScale, XtNreportCallback, levelvalue_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (XtPointer) &dlgLevelValue);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 dlgSiblingLabel = XtVaCreateManagedWidget("dlgSiblingLabel",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 labelWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 dlgForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 XtNfromVert, dlgLevelScale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 XtNfromHoriz, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 XtNbottom, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 XtNright, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 XtNborderWidth, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 dlgSiblingValuator = XtVaCreateManagedWidget("dlgLevelValuator",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 labelWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 dlgForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 XtNfromVert, dlgLevelScale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 XtNfromHoriz, dlgSiblingLabel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 XtNbottom, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 XtNright, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 XtNlabel, " ",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 dlgSiblingScale = XtVaCreateManagedWidget("dlgSiblingScale",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 pannerWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 dlgForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 XtNfromVert, dlgSiblingLabel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 XtNfromHoriz, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 XtNbottom, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 XtNright, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 XtNcanvasWidth, 110,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 XtNdefaultScale, 1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 XtNinternalSpace, 1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 XtNrubberBand, FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 XtNshadowThickness, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 XtNallowOff, FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 XtNwidth, 200,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 XtNsliderWidth, 10,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 XtNheight, 15,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 XtOverrideTranslations(dlgSiblingScale, XtParseTranslationTable("\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 <Btn2Down>: start()\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 <Btn2Motion>: move()\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 <Btn2Up>: notify()stop()\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 <Btn3Down>: abort()\n"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 XtAddCallback(dlgSiblingScale, XtNreportCallback, siblingscale_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (XtPointer) dlgSiblingValuator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 XtAddCallback(dlgSiblingScale, XtNreportCallback, siblingvalue_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (XtPointer) &dlgSiblingValue);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 dlgOkButton = XtVaCreateManagedWidget("dlgOkButton",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 commandWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 dlgForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 XtNfromVert, dlgSiblingScale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 XtNfromHoriz, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 XtNbottom, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 XtNright, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 dlgCancelButton = XtVaCreateManagedWidget("dlgCancelButton",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 commandWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 dlgForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 XtNfromVert, dlgSiblingScale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 XtNfromHoriz, dlgOkButton,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 XtNbottom, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 XtNright, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 XtAddCallback(dlgOkButton, XtNcallback, Scale_CB, (XtPointer) TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 XtAddCallback(dlgCancelButton, XtNcallback, Scale_CB, (XtPointer) FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 * BuildHelpWindow() builds the help window that is displayed when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 * Help button on the application main window is pressed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 BuildHelpWindow(parent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 Widget parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 helpShell = XtVaCreatePopupShell("helpShell", transientShellWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 parent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 helpForm = XtVaCreateManagedWidget("helpForm",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 formWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 helpShell,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 helpDoneButton = XtVaCreateManagedWidget("helpDoneButton",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 commandWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 helpForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 XtNfromVert, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 XtNfromHoriz, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 XtNbottom, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 XtNright, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 XtAddCallback(helpDoneButton, XtNcallback, Popdown_CB,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (XtPointer) helpShell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 helpTitle = XtVaCreateManagedWidget("helpTitle",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 labelWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 helpForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 XtNfromVert, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 XtNfromHoriz, helpDoneButton,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 XtNbottom, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 XtNright, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 XtNborderWidth, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 XtNlabel, "",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 helpText = XtVaCreateManagedWidget("helpText",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 asciiTextWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 helpForm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 XtNfromVert, helpDoneButton,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 XtNfromHoriz, NULL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 XtNtop, XawChainTop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 XtNbottom, XawChainBottom,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 XtNleft, XawChainLeft,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 XtNright, XawChainRight,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 XtNeditType, XawtextRead,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 XtNdisplayCaret, FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 XtNscrollVertical, XawtextScrollAlways,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 XtNscrollHorizontal,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 XawtextScrollWhenNeeded,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 XtNuseStringInPlace, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 XtNstring, help_text,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 XtNwidth, 530,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 XtNheight, 650,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 * BuildApplicationWindow() assumes that TreeTopLevel has been initialized
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 * by XtInitialize(). TreeDrawingArea is set to the drawing area in this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 * application window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 BuildApplicationWindow(parent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 Widget parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 Widget topPane, box;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 topPane = XtVaCreateManagedWidget("topPane",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 panedWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 parent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 XtNorientation, XtorientVertical,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 BuildMenubar(topPane);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 statusText = XtVaCreateManagedWidget("statusText",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 labelWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 topPane,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 XtNborderWidth, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 scrolledWindow = XtVaCreateManagedWidget("scrolledWindow",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 viewportWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 topPane,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 XtNshowGrip, FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 XtNallowHoriz, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 XtNallowVert, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 XtNuseBottom, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 XtNuseRight, TRUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 TreeDrawingArea = XtVaCreateManagedWidget("treeDrawingArea",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 simpleWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 scrolledWindow,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 * HandleError() is used when ReadTreeFromFile() or SaveTreeToFile() returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 * an error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 HandleError(error, tree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 ErrCode error;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 Tree *tree;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 Widget dlg, text;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 if (tree) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 dlg = XtNameToWidget(dialog[DLG_INFO], "dlgInfoForm");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 if (dlg) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 XtVaSetValues(dlg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 XtNvalue, errStr[error],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 XtNwidth, 200,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 text = XtNameToWidget(dlg, "value");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 if (text) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 XtVaSetValues(text, XtNdisplayCaret, FALSE, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 XtVaSetValues(XawTextGetSource(text), XtNeditType, XawtextRead, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 popup_dialog(dialog[DLG_INFO], XtGrabExclusive);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 dlg = XtNameToWidget(dialog[DLG_ERROR], "dlgErrorForm");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 if (dlg) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 XtVaSetValues(dlg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 XtNvalue, errStr[error],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 XtNwidth, 200,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 text = XtNameToWidget(dlg, "value");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 if (text) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 XtVaSetValues(text, XtNdisplayCaret, FALSE, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 XtVaSetValues(XawTextGetSource(text), XtNeditType, XawtextRead, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 popup_dialog(dialog[DLG_ERROR], XtGrabExclusive);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 * InitializeInterface() initializes the environment for displaying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 * the tree and creates the necessary supporting structures for interaction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 * and display. This function should be called only once.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 InitializeInterface(argc, argv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 int *argc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 char *argv[];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 XrmValue rmvalue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 char *rmtype;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 Window win;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 Pixel background;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 XColor colors[NUM_COLORS];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 Colormap cmap;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 Pixmap gray_pixmap;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 Atom wm_delete_window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 /* XtSetLanguageProc is broken on some systems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 The symptom is an error of the form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 Warning: X locale modifiers not supported, using default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 so don't use this call:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 XtSetLanguageProc(NULL, NULL, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 TreeTopLevel = XtVaAppInitialize(&app, "Xoobr",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 NULL, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 argc, argv,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 fallback_resources,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 ASSERT(TreeTopLevel, "failed to open connection to X server");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 TreeDisplay = XtDisplay(TreeTopLevel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 TreeScreen = DefaultScreen(TreeDisplay);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 /* set up color resources */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 applRsrcsPtr = &applRsrcs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 XtGetApplicationResources(TreeTopLevel, applRsrcsPtr,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 applRsrcsDesc, XtNumber(applRsrcsDesc),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 NULL, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 /* add actions */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 XtAppAddActions(app, local_actions, 6);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 XawSimpleMenuAddGlobalActions(app);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 TreeContourWidth = applRsrcsPtr->contour_width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 /* set up label font info */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 if (XrmGetResource(XtDatabase(TreeDisplay),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 X11_FONT_RESOURCE, X11_FONT_CLASS_RESOURCE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 &rmtype, &rmvalue)) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 if (! (TreeLabelFont = XLoadQueryFont(TreeDisplay, rmvalue.addr)) ) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 WARN_4("cannot load user-specified font:", rmvalue.addr,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 "using font:", X11_DEFAULT_FONT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 TreeLabelFont = XLoadQueryFont(TreeDisplay, X11_DEFAULT_FONT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 TreeLabelFont = XLoadQueryFont(TreeDisplay, X11_DEFAULT_FONT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 TreeLabelFont = XLoadQueryFont(TreeDisplay, "fixed");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 check_pixmap =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 XCreateBitmapFromData(TreeDisplay, RootWindow(TreeDisplay, TreeScreen),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 check_bits, check_width, check_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 slider_pixmap =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 XCreateBitmapFromData(TreeDisplay, RootWindow(TreeDisplay, TreeScreen),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 slider_pixmap_bits, slider_pixmap_width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 slider_pixmap_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 BuildApplicationWindow(TreeTopLevel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 BuildHelpWindow(TreeTopLevel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 BuildPopupMenus(TreeTopLevel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 BuildDialogs(TreeTopLevel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 XtAddEventHandler(TreeDrawingArea, ExposureMask, FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 ExposeHandler, (XtPointer) NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 XtVaSetValues(TreeDrawingArea,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 XtNbackground, applRsrcsPtr->background_color,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 XtRealizeWidget(TreeTopLevel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 XtOverrideTranslations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 (TreeTopLevel,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 XtParseTranslationTable("<Message>WM_PROTOCOLS: quit()"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 wm_delete_window = XInternAtom(TreeDisplay, "WM_DELETE_WINDOW", FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 (void) XSetWMProtocols(TreeDisplay, XtWindow(TreeTopLevel),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 &wm_delete_window, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 win = XtWindow(TreeDrawingArea);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 cmap = DefaultColormap(TreeDisplay, TreeScreen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 /* set up double buffer */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 colors[BACKGROUND_COLOR].pixel = applRsrcsPtr->background_color;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 XQueryColor(TreeDisplay, cmap, &(colors[BACKGROUND_COLOR]));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 colors[TREE_COLOR].pixel = applRsrcsPtr->tree_color;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 XQueryColor(TreeDisplay, cmap, &(colors[TREE_COLOR]));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 colors[CONTOUR_COLOR].pixel = applRsrcsPtr->contour_color;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 XQueryColor(TreeDisplay, cmap, &(colors[CONTOUR_COLOR]));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 colors[HIGHLIGHT_COLOR].pixel = applRsrcsPtr->highlight_color;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 XQueryColor(TreeDisplay, cmap, &(colors[HIGHLIGHT_COLOR]));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 colors[SPLIT_COLOR].pixel = applRsrcsPtr->split_color;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 XQueryColor(TreeDisplay, cmap, &(colors[SPLIT_COLOR]));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 colors[ACTION_COLOR].pixel = applRsrcsPtr->action_color;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 XQueryColor(TreeDisplay, cmap, &(colors[ACTION_COLOR]));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 TreeDrawingAreaDB =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 DBLcreate_double_buffer(TreeDisplay,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 XtWindow(TreeDrawingArea), FALSE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 colors, NUM_COLORS);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 ASSERT(TreeDrawingAreaDB, "could not create double buffer");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 background = DBLinq_background(TreeDrawingAreaDB);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 XtVaSetValues(TreeDrawingArea, XtNbackground, background, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 /* also set the scrolledWindow background to same color */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 XtVaSetValues(XtParent(TreeDrawingArea), XtNbackground, background, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 XSetFont(TreeDrawingAreaDB->display, TreeDrawingAreaDB->gc,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 TreeLabelFont->fid);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 gray_pixmap =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 XCreatePixmapFromBitmapData(TreeDisplay, XtWindow(TreeDrawingArea),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 gray_bits, gray_width, gray_height,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 TreeDrawingAreaDB->colors[TREE_COLOR],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 background,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 DefaultDepth(TreeDisplay, TreeScreen));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 #ifdef COMMENT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 XtVaSetValues(treeMenuItems[LAYOUT_MENU_VARIABLE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 XtNleftBitmap, check_pixmap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 XSetTile(TreeDrawingAreaDB->display, TreeDrawingAreaDB->gc, gray_pixmap);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 SetDrawColor(TREE_COLOR);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 InitializeDissolveEffect(TreeDisplay, XtWindow(TreeDrawingArea),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 TreeDrawingAreaDB->colors[TREE_COLOR], background);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 PauseCursor = XCreateFontCursor(TreeDisplay, XC_watch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 StatusMsg("Ready", TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 * UserEventLoop() is called after InitializeInterface() to handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 * processing of events.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 UserEventLoop()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 XtAppMainLoop(app);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 /* Callback Routines */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 TreeMenu_CB(w, client_data, call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 XtPointer client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 XtPointer call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 long menuItem = (long) client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 Widget dlgFileForm;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 switch (menuItem) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 case TREE_MENU_NEW:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 popup_dialog(dialog[DLG_NEW], XtGrabExclusive);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 case TREE_MENU_LOAD:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 loading_file = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 XtVaSetValues(dialog[DLG_FILE], XtNtitle, "Load File", NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 dlgFileForm = XtNameToWidget(dialog[DLG_FILE], "dlgFileForm");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 XtVaSetValues(dlgFileForm, XtNvalue, "", NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 popup_dialog(dialog[DLG_FILE], XtGrabExclusive);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 case TREE_MENU_SAVE:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 loading_file = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 XtVaSetValues(dialog[DLG_FILE], XtNtitle, "Save File", NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 dlgFileForm = XtNameToWidget(dialog[DLG_FILE], "dlgFileForm");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 XtVaSetValues(dlgFileForm, XtNvalue, "", NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 popup_dialog(dialog[DLG_FILE], XtGrabExclusive);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 case TREE_MENU_QUIT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 exit(0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 WARN("unknown menu item in TreeMenu_CB");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 LayoutMenu_CB(w, client_data, call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 XtPointer client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 XtPointer call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 long menuItem = (long) client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 char tmpstr[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 switch (menuItem) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 #ifdef COMMENT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 case LAYOUT_MENU_FIXED:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 XtVaSetValues(layoutMenuItems[LAYOUT_MENU_VARIABLE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 XtNleftBitmap, None, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 XtVaSetValues(layoutMenuItems[LAYOUT_MENU_FIXED],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 XtNleftBitmap, check_pixmap, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 if (TreeLayoutDensity != Fixed) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 TreeLayoutDensity = Fixed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 DeleteTree(TheTree, TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 SetupTree(TheTree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 case LAYOUT_MENU_VARIABLE:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 XtVaSetValues(layoutMenuItems[LAYOUT_MENU_VARIABLE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 XtNleftBitmap, check_pixmap, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 XtVaSetValues(layoutMenuItems[LAYOUT_MENU_FIXED],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 XtNleftBitmap, None, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 if (TreeLayoutDensity != Variable) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 TreeLayoutDensity = Variable;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 DeleteTree(TheTree, TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 SetupTree(TheTree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 #endif COMMENT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 case LAYOUT_MENU_SPACING:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 dlgLevelValue = TreeParentDistance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 dlgSiblingValue = TreeBorderSize;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 sprintf(tmpstr, "%d ", dlgLevelValue);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 XtVaSetValues(dlgLevelValuator, XtNlabel, tmpstr, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 /* These setvalues need some adjustments... */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 XtVaSetValues(dlgLevelScale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 XtNsliderX, (dlgLevelValue * 2),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 sprintf(tmpstr, "%d ", dlgSiblingValue);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 XtVaSetValues(dlgSiblingValuator, XtNlabel, tmpstr, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 XtVaSetValues(dlgSiblingScale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 XtNsliderX, (dlgSiblingValue * 4),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 popup_dialog(dialog[DLG_SPACING], XtGrabNone);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 case LAYOUT_MENU_ALIGN_NODES:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 TreeAlignNodes = !TreeAlignNodes;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 XtVaSetValues(treeMenuItems[LAYOUT_MENU_ALIGN_NODES],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 XtNleftBitmap, TreeAlignNodes ? check_pixmap : None,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 DeleteTree(TheTree, TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 ResetLabels(TheTree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 SetupTree(TheTree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 WARN("unknown menu item in LayoutMenu_CB");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 NodeMenu_CB(w, client_data, call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 XtPointer client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 XtPointer call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 long menuItem = (long) client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 switch (menuItem) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 case NODE_MENU_ADD_CHILD:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 NodePos = Child;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 popup_dialog(dialog[DLG_NODE_NAME], XtGrabExclusive);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 case NODE_MENU_ADD_BEFORE:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 NodePos = Before;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 popup_dialog(dialog[DLG_NODE_NAME], XtGrabExclusive);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 case NODE_MENU_ADD_AFTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 NodePos = After;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 popup_dialog(dialog[DLG_NODE_NAME], XtGrabExclusive);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 case NODE_MENU_ELISION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 ExpandCollapseNode(PopupNode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 case NODE_MENU_DELETE:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 DeleteNode(PopupNode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 if (TheTree == NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 XtSetSensitive(treeMenuItems[TREE_MENU_SAVE], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 WARN("unknown menu item in NodeMenu_CB");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 Help_CB(w, client_data, call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 XtPointer client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 XtPointer call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 popup_dialog(helpShell, XtGrabNone);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 HelpDone_CB(w, client_data, call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 XtPointer client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 XtPointer call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 XtPopdown(helpShell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 NodeLabel_CB(w, client_data, call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 XtPointer client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 XtPointer call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 char *node_label;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 XtPopdown(dialog[DLG_NODE_NAME]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 if (client_data == (XtPointer) TRUE) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 node_label = XtMalloc(strlen(XawDialogGetValueString(XtParent(w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 * sizeof(char));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 node_label = strcpy(node_label, XawDialogGetValueString(XtParent(w)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 if (*node_label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 InsertNode(PopupNode, NodePos, node_label);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 NewTree_CB(w, client_data, call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 XtPointer client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 XtPointer call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 char *node_label;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 Tree *tree;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 XtPopdown(dialog[DLG_NEW]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 if (client_data == (XtPointer) TRUE) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 node_label = XtMalloc((strlen(XawDialogGetValueString(XtParent(w))) + 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 * sizeof(char));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 node_label = strcpy(node_label, XawDialogGetValueString(XtParent(w)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 if (*node_label) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 if (TheTree) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 Delete(TheTree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 XtSetSensitive(treeMenuItems[TREE_MENU_SAVE], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 tree = MakeNode();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 SetNodeLabel(tree, node_label);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 SetupTree(tree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 XtSetSensitive(treeMenuItems[TREE_MENU_SAVE], TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 XSync(TreeDisplay, FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 File_CB(w, client_data, call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 XtPointer client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 XtPointer call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 char *fname;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 Tree *tree;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 ErrCode error;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 Arg args[1];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 int menuItem;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 if (client_data == (XtPointer) TRUE) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 fname = XawDialogGetValueString(XtParent(w));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 if (*fname) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 if (loading_file == 1) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 if (TheTree) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 Delete(TheTree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 XtSetSensitive(treeMenuItems[TREE_MENU_SAVE], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 tree = ReadTreeFromFile(fname, &error);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 XtPopdown(dialog[DLG_FILE]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 if (error != ERR_NONE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 HandleError(error, tree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 XSync(TreeDisplay, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 if (tree) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 SetupTree(tree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 XtSetSensitive(treeMenuItems[TREE_MENU_SAVE], TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 SetDrawingTree(NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 BeginFrame();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 EndFrame();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 } else if (menuItem == TREE_MENU_SAVE) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 if (!SaveTreeToFile(TheTree, fname)) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 XtPopdown(dialog[DLG_FILE]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 HandleError(ERR_OPENFAIL, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 } else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 XtPopdown(dialog[DLG_FILE]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 } else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 XtPopdown(dialog[DLG_FILE]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 } else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 XtPopdown(dialog[DLG_FILE]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 Scale_CB(w, client_data, call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 XtPointer client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 XtPointer call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 int level_value, sibling_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 float tmp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 XtPopdown(dialog[DLG_SPACING]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 /* check if OK button was selected */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 if (client_data) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 level_value = dlgLevelValue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 sibling_value = dlgSiblingValue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 if (level_value != TreeParentDistance ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 sibling_value != TreeBorderSize) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 TreeParentDistance = level_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 TreeBorderSize = sibling_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 XSync(TreeDisplay, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 if (TheTree) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 DeleteTree(TheTree, TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 if (TreeAlignNodes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 ResetLabels(TheTree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 SetupTree(TheTree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 /* */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 /* Auxilary actions and callback functions */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 /* */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 Popdown_CB(w, client_data, call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 XtPointer client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 XtPointer call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 Widget widget = (Widget) client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 XtPopdown(widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 activate_action(w, event, params, num_params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 XButtonEvent *event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 String *params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 Cardinal *num_params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 Widget button;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 if (*num_params == 1) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 button = XtNameToWidget(XtParent(w), params[0]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 if (button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 XtCallCallbacks(button, XtNcallback, (XtPointer) TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 quit_action(w, event, params, num_params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 XButtonEvent *event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 String *params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 Cardinal *num_params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 exit(0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 select_action(w, event, params, num_params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 XButtonEvent *event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 String *params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 Cardinal *num_params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 Tree *node;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 int height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 Boolean edit = FALSE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 if ((*num_params > 0) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 (!strcmp(params[0], "EDIT") ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 !strcmp(params[0], "edit")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 edit = TRUE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 if (SearchTree(TheTree, event->x, event->y, &node)) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 static Tree *PrevNode = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 Tree *ParNode = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 PopupNode = node;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 if (PrevNode != NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 DrawNode(PrevNode, New);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 PrevNode = PopupNode;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 printf("%s^^%s^^%s\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 EnvNm,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 edit ? "br-edit" : "br-view",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 (PopupNode->value) ? PopupNode->value : PopupNode->label.text);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 StatusMsg(PopupNode->label.text, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 ParNode = PopupNode->parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 PopupNode->parent = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 HiliteNode(PopupNode, New);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 PopupNode->parent = ParNode;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 menu_popup_action(w, event, params, num_params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 XEvent *event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 String *params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 Cardinal *num_params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 Widget menu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 Boolean popup;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 ShellWidget shell_widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 char *strargs[] = {"nodeMenu", NULL};
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 menu = XtNameToWidget(TreeTopLevel, params[0]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 shell_widget = (ShellWidget) menu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 if (nodeFound) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 /* This is giving me a headache.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 * Why does popup menus come up unselectable?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 XtCallActionProc(TreeDrawingArea,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 "XtMenuPopup",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 strargs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 XtSetSensitive(menu, TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 XtPopupSpringLoaded(menu);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 /* if (!XtIsShell(menu)) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 printf("error: not shell widget!\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 if (! shell_widget->shell.popped_up) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 XtGrabKind call_data = XtGrabExclusive;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662 XtCallCallbacks(menu, XtNpopupCallback, (XtPointer) &call_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 shell_widget->shell.popped_up = TRUE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 shell_widget->shell.grab_kind = XtGrabExclusive;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 shell_widget->shell.spring_loaded = TRUE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 if (shell_widget->shell.create_popup_child_proc != NULL) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 (*(shell_widget->shell.create_popup_child_proc))(menu);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 XtAddGrab(menu, TRUE, TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 XtRealizeWidget(menu);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 XMapRaised(XtDisplay(menu), XtWindow(menu));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 } else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 XRaiseWindow(XtDisplay(menu), XtWindow(menu));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 button_action(w, event, params, num_params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 XEvent *event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 String *params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 Cardinal *num_params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 Tree *node;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 if (SearchTree(TheTree, event->xbutton.x, event->xbutton.y, &node)) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 nodeFound = TRUE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 XtSetSensitive(nodeMenuItems[NODE_MENU_DELETE], TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 XtVaSetValues(treeMenus[NODE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 XtNlabel, node->label.text,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 PopupNode = node;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 if (IS_LEAF(node)) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 XtSetSensitive(nodeMenuItems[NODE_MENU_ELISION], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 XtVaSetValues(nodeMenuItems[NODE_MENU_ELISION],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 XtNlabel, labelStr[STR_NODE_COLLAPSE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 XtSetSensitive(nodeMenuItems[NODE_MENU_ELISION], TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 if (node->elision) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 XtVaSetValues(nodeMenuItems[NODE_MENU_ELISION],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 XtNlabel, labelStr[STR_NODE_EXPAND],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 XtVaSetValues(nodeMenuItems[NODE_MENU_ELISION],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 XtNlabel, labelStr[STR_NODE_COLLAPSE],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 if (node->parent) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 XtSetSensitive(nodeMenuItems[NODE_MENU_ADD_BEFORE], TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 XtSetSensitive(nodeMenuItems[NODE_MENU_ADD_AFTER], TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 XtSetSensitive(nodeMenuItems[NODE_MENU_ADD_BEFORE], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 XtSetSensitive(nodeMenuItems[NODE_MENU_ADD_AFTER], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 if (node->elision) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 XtSetSensitive(nodeMenuItems[NODE_MENU_ADD_CHILD], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 XtSetSensitive(nodeMenuItems[NODE_MENU_ADD_CHILD], TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 nodeFound = FALSE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 XtVaSetValues(treeMenus[NODE_MENU],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 XtNlabel, " ",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 XtSetSensitive(nodeMenuItems[NODE_MENU_ADD_BEFORE], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 XtSetSensitive(nodeMenuItems[NODE_MENU_ADD_AFTER], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 XtSetSensitive(nodeMenuItems[NODE_MENU_ADD_CHILD], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 XtSetSensitive(nodeMenuItems[NODE_MENU_ELISION], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 XtSetSensitive(nodeMenuItems[NODE_MENU_DELETE], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 /* */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 /* General purpose popdown widget callback (for dialog popdown buttons) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 /* */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 static void center_widget(w, x, y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 Widget w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 int x, y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 Dimension width, height, border;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 Position max_x, max_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 XtVaGetValues(w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 XtNwidth, &width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 XtNheight, &height,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 XtNborderWidth, &border,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 width += 2 * border;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 height += 2 * border;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 x -= ((Position) width / 2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 y -= ((Position) height / 2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 if (x < 0) x = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 if (y < 0) y = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 if (x > (max_x = (Position) (XtScreen(w)->width - width)) )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 x = max_x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 if (y > (max_y = (Position) (XtScreen(w)->height - height)) )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 y = max_y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 XtVaSetValues(w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 XtNx, x,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 XtNy, y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 #define shell_translations "<Message>WM_PROTOCOLS: wmpopdown()\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 popup_dialog(shell, grab_kind)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 Widget shell;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 XtGrabKind grab_kind;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 int idummy, x, y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 Window wdummy;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 XtOverrideTranslations(shell, XtParseTranslationTable(shell_translations));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 XtRealizeWidget(shell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 wm_delete_window = XInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 (void) XSetWMProtocols(XtDisplay(shell), XtWindow(shell),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 &wm_delete_window, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 XQueryPointer(TreeDisplay, DefaultRootWindow(TreeDisplay),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 &wdummy, &wdummy,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 &x, &y, &idummy, &idummy, &idummy);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 center_widget(shell, x, y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 XtPopup(shell, grab_kind);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 popdown_action(widget, event, params, num_params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 XEvent *event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 String *params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 Cardinal *num_params;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 XtPopdown(widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 set_siblingscale_CB(widget, w, percent_ptr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 XtPointer w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 XtPointer percent_ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 char tmpstr[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 sprintf(tmpstr, "%d ", (int) (*(float*) percent_ptr*MAX_BORDER_SIZE));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 XtVaSetValues((Widget) w, XtNlabel, tmpstr, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 siblingscale_CB(widget, w, report)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 XtPointer w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 XawPannerReport *report;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 char tmpstr[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 sprintf(tmpstr, "%d ", (int)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 ((float) report->slider_x / report->slider_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 * MAX_BORDER_SIZE / 10));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 XtVaSetValues((Widget) w, XtNlabel, tmpstr, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 set_levelscale_CB(widget, w, percent_ptr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 XtPointer w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 XtPointer percent_ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 char tmpstr[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 sprintf(tmpstr, "%d ", (int) (*(float*) percent_ptr*MAX_PARENT_DISTANCE));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 XtVaSetValues((Widget) w, XtNlabel, tmpstr, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 levelscale_CB(widget, w, report)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 XtPointer w;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 XawPannerReport *report;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 char tmpstr[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 sprintf(tmpstr, "%d ", (int)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 ((float) report->slider_x / report->slider_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 * MAX_PARENT_DISTANCE / 10));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 XtVaSetValues((Widget) w, XtNlabel, tmpstr, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 set_siblingvalue_CB(widget, var_ptr, percent_ptr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 XtPointer var_ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 XtPointer percent_ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 * (int *)var_ptr = (int) (*(float*) percent_ptr*MAX_BORDER_SIZE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 set_levelvalue_CB(widget, var_ptr, percent_ptr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 XtPointer var_ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 XtPointer percent_ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 * (int *)var_ptr = (int) (*(float*) percent_ptr*MAX_PARENT_DISTANCE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 siblingvalue_CB(widget, var_ptr, report)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 XtPointer var_ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912 XawPannerReport *report;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914 * (int *) var_ptr = (int)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 ((float) report->slider_x / report->slider_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 * MAX_BORDER_SIZE / 10);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 levelvalue_CB(widget, var_ptr, report)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 XtPointer var_ptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 XawPannerReport *report;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 * (int *) var_ptr = (int)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 ((float) report->slider_x / report->slider_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 * MAX_PARENT_DISTANCE / 10);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 /* ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 * Main routine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 * ----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 main(argc, argv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 int argc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 char *argv[];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 Tree *tree = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 ErrCode error = ERR_NONE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 ProgramName = strdup(argv[0]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 if (ProgramName == NULL) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 fprintf(stderr, "%s: insufficient memory available\n", argv[0]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 exit(0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 InitializeInterface(&argc, argv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 XSync(TreeDisplay, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 if (argc >= 2) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 tree = ReadTreeFromFile(argv[1], &error);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 if (tree) StatusMsg(argv[1], TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 if (argc > 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 WARN("extraneous arguments ignored");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 if (tree) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 SetupTree(tree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 XtSetSensitive(treeMenuItems[TREE_MENU_SAVE], TRUE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 SetDrawingTree(NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 XtSetSensitive(treeMenuItems[TREE_MENU_SAVE], FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 if (error != ERR_NONE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 HandleError(error, tree);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 StatusMsg("Left = Edit Node; Mid = View Node; Right = Node Menu", 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 UserEventLoop();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 /* End of File */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 /* ------------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984