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