2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: MainWin.c /main/8 1996/03/25 00:52:54 pascale $ */
24 /************************************<+>*************************************
25 ****************************************************************************
31 ** Description: Controls the main Dtstyle dialog
34 ****************************************************************************
35 ************************************<+>*************************************/
37 * (c) Copyright 1996 Digital Equipment Corporation.
38 * (c) Copyright 1990, 1996 Hewlett-Packard Company.
39 * (c) Copyright 1996 International Business Machines Corp.
40 * (c) Copyright 1996 Sun Microsystems, Inc.
41 * (c) Copyright 1996 Novell, Inc.
42 * (c) Copyright 1996 FUJITSU LIMITED.
43 * (c) Copyright 1996 Hitachi.
46 /*+++++++++++++++++++++++++++++++++++++++*/
48 /*+++++++++++++++++++++++++++++++++++++++*/
51 #include <Xm/MwmUtil.h>
56 #include <Xm/CascadeB.h>
57 #include <Xm/ColorObjP.h>
61 #include <Xm/RowColumn.h>
62 #include <Xm/SeparatoG.h>
67 #include <Dt/Control.h>
68 #include <Dt/DialogBox.h>
70 #include <Dt/IconFile.h>
72 #include <Dt/HourGlass.h>
73 #include <Dt/UserMsg.h>
77 #include "SaveRestore.h"
79 /*+++++++++++++++++++++++++++++++++++++++*/
80 /* include extern functions */
81 /*+++++++++++++++++++++++++++++++++++++++*/
84 /*+++++++++++++++++++++++++++++++++++++++*/
86 /*+++++++++++++++++++++++++++++++++++++++*/
88 /*+++++++++++++++++++++++++++++++++++++++*/
89 /* Internal Functions */
90 /*+++++++++++++++++++++++++++++++++++++++*/
94 XtPointer client_data,
95 XtPointer call_data) ;
96 static void build_mainWindow( Widget shell) ;
97 static void activateCB(
99 XtPointer client_data,
100 XtPointer call_data) ;
101 static void ProcessComponentList(
106 /*+++++++++++++++++++++++++++++++++++++++*/
107 /* Internal variables */
108 /*+++++++++++++++++++++++++++++++++++++++*/
110 static int colorUse = XmCO_BLACK_WHITE;
111 static saveRestore save = {FALSE, 0, };
114 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
115 /* init_mainWindow */
117 /* build if needed, otherwise just manage the mainWindow. */
118 /* Assumes shell has been created */
119 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
121 init_mainWindow( Widget shell )
123 if (style.mainWindow == NULL) {
124 build_mainWindow(shell);
125 if (save.restoreFlag)
126 XtAddCallback (shell, XtNpopupCallback, _DtMapCB, NULL);
127 XtManageChild(style.mainWindow);
128 XtPopup(shell, XtGrabNone);
130 else /* fix Shouldn't ever happen */
131 XtManageChild(style.mainWindow);
134 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
136 /* first time only, set correct sizing in case font */
137 /* size has changed (if so, saved size is wrong) */
138 /* remove callback after first time */
139 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
143 XtPointer client_data,
144 XtPointer call_data )
148 if (save.restoreFlag)
150 hints.min_width = XtWidth(w);
151 hints.min_height = XtHeight(w);
152 hints.max_width = XtWidth(w);
153 hints.max_height = XtHeight(w);
154 hints.flags = PMinSize | PMaxSize;
155 XSetWMNormalHints (style.display, XtWindow(w), &hints);
158 XtRemoveCallback(style.shell, XtNpopupCallback, _DtMapCB, NULL);
161 /*+++++++++++++++++++++++++++++++++++++++++++++*/
162 /* build_mainWindow */
164 /* build the main window, but don't manage it. */
165 /*+++++++++++++++++++++++++++++++++++++++++++++*/
182 XmString labelString;
184 XmPixelSet pixelSet[XmCO_NUM_COLORS];
190 * Note that save.poscnt has been initialized elsewhere.
191 * save.posArgs may contain information from restoreAudio().*/
193 XtSetArg(save.posArgs[save.poscnt], XmNnoResize, True); save.poscnt++;
194 XtSetArg(save.posArgs[save.poscnt], XmNresizePolicy, XmRESIZE_NONE); save.poscnt++;
195 style.mainWindow= XmCreateMainWindow(shell,"mainWindow", save.posArgs, save.poscnt);
196 XtAddCallback(style.mainWindow, XmNhelpCallback,
197 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_MAIN_WINDOW);
200 tmpStr = (char *)XtMalloc(strlen(GETMESSAGE(4, 1, "Style Manager"))+1);
201 sprintf(tmpStr, GETMESSAGE(4, 1, "Style Manager"));
202 XtSetArg(args[n], XmNtitle, tmpStr); n++;
203 XtSetArg(args[n], XmNiconName,
204 (char *)GETMESSAGE(4, 37, "Style")); n++;
205 XtSetValues(XtParent(style.mainWindow), args, n);
209 mainMenu= XmCreateMenuBar(style.mainWindow,"mainMenu", args, n);
210 XtAddCallback(mainMenu, XmNhelpCallback,
211 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_MENUBAR);
212 XtManageChild(mainMenu);
214 /* create the pulldown widgets */
216 filePulldown= XmCreatePulldownMenu(mainMenu,"fileMenu", args, n );
217 XtAddCallback(filePulldown, XmNhelpCallback,
218 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FILE_MENU);
221 helpPulldown= XmCreatePulldownMenu(mainMenu, "helpMenu" , args, n );
222 XtAddCallback(helpPulldown, XmNhelpCallback,
223 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_HELP_MENU);
225 /* create the cascade butons */
229 mnemonic = ((char *)GETMESSAGE(4, 2, "F"));
230 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
231 labelString = CMPSTR((char *)GETMESSAGE(4, 3, "File"));
232 XtSetArg(args[n], XmNlabelString, labelString); n++;
233 XtSetArg(args[n], XmNsubMenuId, filePulldown); n++;
234 XtSetArg (args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++;
236 XmCreateCascadeButton(mainMenu, "fileCascadeButton", args, n );
237 XtAddCallback(WidgList[count-1], XmNhelpCallback,
238 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FILE_MENU);
239 XmStringFree(labelString);
242 mnemonic = ((char *)GETMESSAGE(4, 4, "H"));
243 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
244 labelString = CMPSTR((char *)GETMESSAGE(4, 5, "Help"));
245 XtSetArg(args[n], XmNlabelString, labelString); n++;
246 XtSetArg(args[n], XmNsubMenuId, helpPulldown); n++;
247 XtSetArg (args[n], XmNmarginWidth, 6); n++;
249 XmCreateCascadeButton(mainMenu, "helpCascadeButton", args, n );
250 XtAddCallback(WidgList[count-1], XmNhelpCallback,
251 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_HELP_MENU);
252 XmStringFree(labelString);
255 XtSetArg(args[n], XmNmenuHelpWidget, WidgList[count-1]); n++;
256 XtSetValues (mainMenu, args, n);
258 XtManageChildren (WidgList, count);
260 /* create the File menu pane's buttons */
262 mnemonic = ((char *)GETMESSAGE(4, 53, "x"));
263 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
264 labelString = CMPSTR((char *)GETMESSAGE(4, 7, "Exit"));
265 XtSetArg(args[n], XmNlabelString, labelString); n++;
266 exitBtn= XmCreatePushButton(filePulldown, "exit", args, n );
267 XtAddCallback(exitBtn, XmNactivateCallback, activateCB_exitBtn, NULL);
268 XtAddCallback(exitBtn, XmNhelpCallback,
269 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_EXIT);
270 XtManageChild(exitBtn);
271 XmStringFree(labelString);
273 /* create the Help menu pane's buttons */
277 mnemonic = ((char *)GETMESSAGE(4, 54, "v"));
278 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
279 labelString = CMPSTR((char *)GETMESSAGE(4, 55, "Overview"));
280 XtSetArg(args[n], XmNlabelString, labelString); n++;
282 XmCreatePushButton(helpPulldown, "overview", args, n );
283 XtAddCallback(WidgList[count-1], XmNactivateCallback,
284 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_INTRODUCTION);
285 XmStringFree(labelString);
289 XmCreateSeparatorGadget(helpPulldown,"separator",args,n);
292 mnemonic = ((char *)GETMESSAGE(4, 43, "T"));
293 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
294 labelString = CMPSTR((char *)GETMESSAGE(4, 56, "Tasks"));
295 XtSetArg(args[n], XmNlabelString, labelString); n++;
296 WidgList[count++]= XmCreatePushButton(helpPulldown, "tasks", args, n );
297 XtAddCallback(WidgList[count-1], XmNactivateCallback,
298 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_TASKS);
299 XmStringFree(labelString);
302 mnemonic = ((char *)GETMESSAGE(4, 45, "R"));
303 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
304 labelString = CMPSTR((char *)GETMESSAGE(4, 57, "Reference"));
305 XtSetArg(args[n], XmNlabelString, labelString); n++;
306 WidgList[count++]= XmCreatePushButton(helpPulldown, "reference", args, n );
307 XtAddCallback(WidgList[count-1], XmNactivateCallback,
308 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_REFERENCE);
309 XmStringFree(labelString);
312 mnemonic = ((char *)GETMESSAGE(4, 47, "O"));
313 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
314 labelString = CMPSTR((char *)GETMESSAGE(4, 48, "On Item"));
315 XtSetArg(args[n], XmNlabelString, labelString); n++;
316 WidgList[count++]= XmCreatePushButton(helpPulldown, "onItem", args, n );
317 XtAddCallback(WidgList[count-1], XmNactivateCallback,
318 (XtCallbackProc)HelpModeCB, (XtPointer)NULL);
319 XmStringFree(labelString);
323 XmCreateSeparatorGadget(helpPulldown,"separator",args,n);
326 mnemonic = ((char *)GETMESSAGE(4, 49, "U"));
327 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
328 labelString = CMPSTR((char *)GETMESSAGE(4, 58, "Using Help"));
329 XtSetArg(args[n], XmNlabelString, labelString); n++;
331 XmCreatePushButton(helpPulldown, "usingHelp", args, n );
332 XtAddCallback(WidgList[count-1], XmNactivateCallback,
333 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_USING);
334 XmStringFree(labelString);
338 XmCreateSeparatorGadget(helpPulldown,"separator",args,n);
341 mnemonic = ((char *)GETMESSAGE(4, 59, "A"));
342 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
343 labelString = CMPSTR((char *)GETMESSAGE(4, 60, "About Style Manager"));
344 XtSetArg(args[n], XmNlabelString, labelString); n++;
345 WidgList[count++]= XmCreatePushButton(helpPulldown, "stylemanager", args, n );
346 XtAddCallback(WidgList[count-1], XmNactivateCallback,
347 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_VERSION);
348 XmStringFree(labelString);
350 XtManageChildren(WidgList, count);
352 /* create frame and row column for icon gadgets */
354 XtSetArg(args[n], XmNresizePolicy, XmRESIZE_NONE); n++;
355 XtSetArg(args[n], XmNshadowType, XmSHADOW_OUT); n++;
356 XtSetArg(args[n], XmNshadowThickness, 1); n++;
357 frame = XmCreateFrame(style.mainWindow, "frame", args, n);
358 XtManageChild(frame);
360 /* Save pixels for later use */
361 /* primary top/bottom shadow -> fg/bg for pixmaps in primary areas */
362 /* secondary top/bottom shadow -> fg/bg for pixmaps in secondary areas */
363 /* secondary select color -> backgrounds of editable text areas */
364 /* secondary foreground -> fill color on toggle indicators */
366 /* Get the primary colors to be used later */
368 XtSetArg(args[n], XmNbackground, &bg); n++;
369 XtGetValues(style.mainWindow, args, n);
371 XmGetColors (style.screen, style.colormap, bg,
377 /* Get the secondary colors to be used later */
379 XtSetArg(args[n], XmNbackground, &style.secBgCol); n++;
380 XtGetValues(exitBtn, args, n);
382 XmGetColors (style.screen, style.colormap, style.secBgCol,
383 &style.tgSelectColor,
386 &style.secSelectColor);
388 if ((style.secTSCol == style.secBSCol) || /* B_W or shadowPixmaps==True */
389 (!style.useMultiColorIcons)) /* multiColorIcons turned off */
391 /* force TS = White, BS = Black */
392 style.secTSCol = style.primTSCol = WhitePixelOfScreen(style.screen);
393 style.secBSCol = style.primBSCol = BlackPixelOfScreen(style.screen);
396 XmeGetPixelData(style.screenNum, &colorUse, pixelSet, &a, &i, &p, &s);
399 if (colorUse == XmCO_BLACK_WHITE)
401 ditherPix = XmGetPixmap (style.screen, "50_foreground",
402 style.primBSCol,style.primTSCol);
403 XtSetArg(args[n], XmNbackgroundPixmap, ditherPix); n++;
405 XtSetArg(args[n], XmNallowOverlap, False); n++;
406 XtSetArg(args[n], XmNadjustLast, False); n++;
407 XtSetArg(args[n], XmNpacking, XmPACK_TIGHT); n++;
408 XtSetArg(args[n], XmNspacing, style.horizontalSpacing); n++;
409 mainRC = XmCreateRowColumn(frame, "mainRC", args, n);
410 XtManageChild(mainRC);
413 XtSetArg(args[n], XmNmenuBar, mainMenu); n++;
414 XtSetArg(args[n], XmNcommandWindow, NULL); n++;
415 XtSetArg(args[n], XmNworkWindow, frame); n++;
416 XtSetValues (style.mainWindow, args, n);
418 ProcessComponentList (shell, mainRC);
422 /*+++++++++++++++++++++++++++++++++++++++
423 * ProcessComponentList();
425 *+++++++++++++++++++++++++++++++++++++++*/
428 ProcessComponentList(
436 Widget componentWidget;
439 char *resString, *resString2;
445 style.workProcs = False;
446 if (style.xrdb.componentList == NULL) return;
449 XtSetArg(args[n], XmNalignment, XmALIGNMENT_CENTER); n++;
450 XtSetArg(args[n], XmNpixmapPosition, XmPIXMAP_TOP); n++;
451 XtSetArg(args[n], XmNshadowType, XmSHADOW_OUT); n++;
452 n2 = 3; /* number of preset args for creating Icons */
454 resString = strdup (style.xrdb.componentList);
455 resString2 = resString;
456 len = strlen(resString);
457 string = strtok(resString, " ");
459 while (string != NULL)
461 /* check for valid name, duplicate name *** */
463 /* create Icon in Dtstyle main window */
466 XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
467 if (colorUse == XmCO_BLACK_WHITE)
469 XtSetArg(args[n], XmNuseEmbossedText, False); n++;
471 XtSetArg(args[n], XmNpixmapForeground, style.primBSCol); n++;
472 XtSetArg(args[n], XmNpixmapBackground, style.primTSCol); n++;
473 if (strcmp(string, COLOR) == 0)
475 cmp_string = CMPSTR(GETMESSAGE(4, 27, "Color"));
476 helpTag = HELP_COLOR_BUTTON;
477 dtIcon = _DtGetIconFileName(style.screen, COLOR_ICON, NULL, NULL, NULL);
478 style.workProcs = True;
480 else if (strcmp(string, FONT) == 0)
482 cmp_string = CMPSTR(GETMESSAGE(4, 28, "Font"));
483 dtIcon = _DtGetIconFileName(style.screen, FONT_ICON, NULL, NULL, NULL);
484 helpTag = HELP_FONT_BUTTON;
487 else if (strcmp(string, BACKDROP) == 0)
489 cmp_string = CMPSTR(GETMESSAGE(4, 29, "Backdrop"));
490 dtIcon = _DtGetIconFileName(style.screen, BACKDROP_ICON, NULL, NULL, NULL);
491 helpTag = HELP_BACKDROP_BUTTON;
494 else if (strcmp(string, KEYBOARD) == 0)
496 cmp_string = CMPSTR(GETMESSAGE(4, 30, "Keyboard"));
497 dtIcon = _DtGetIconFileName(style.screen, KEYBOARD_ICON, NULL, NULL, NULL);
498 helpTag = HELP_KEYBOARD_BUTTON;
501 else if (strcmp(string, MOUSE) == 0)
503 cmp_string = CMPSTR(GETMESSAGE(4, 31, "Mouse"));
504 dtIcon = _DtGetIconFileName(style.screen, MOUSE_ICON, NULL, NULL, NULL);
505 helpTag = HELP_MOUSE_BUTTON;
508 else if (strcmp(string, BEEP) == 0)
510 cmp_string = CMPSTR(GETMESSAGE(4, 32, "Beep"));
511 dtIcon = _DtGetIconFileName(style.screen, BEEP_ICON, NULL, NULL, NULL);
512 helpTag = HELP_AUDIO_BUTTON;
515 else if (strcmp(string, SCREEN) == 0)
517 cmp_string = CMPSTR(GETMESSAGE(4, 33, "Screen"));
518 dtIcon = _DtGetIconFileName(style.screen, SCREEN_ICON, NULL, NULL, NULL);
519 helpTag = HELP_SCREEN_BUTTON;
522 else if (strcmp(string, DTWM) == 0)
524 cmp_string = CMPSTR(GETMESSAGE(4, 38, "Window"));
525 dtIcon = _DtGetIconFileName(style.screen, DTWM_ICON, NULL, NULL, NULL);
526 helpTag = HELP_DTWM_BUTTON;
529 else if (strcmp(string, STARTUP) == 0)
531 cmp_string = CMPSTR(GETMESSAGE(4, 35, "Startup"));
532 dtIcon = _DtGetIconFileName(style.screen, STARTUP_ICON, NULL, NULL, NULL);
533 helpTag = HELP_STARTUP_BUTTON;
535 else if (strcmp(string, I18N) == 0)
537 cmp_string = CMPSTR(GETMESSAGE(4, 34, "Intl'"));
538 dtIcon = _DtGetIconFileName(style.screen, I18N_ICON, NULL, NULL, NULL);
539 helpTag = HELP_I18N_BUTTON;
543 s += strlen(string) +1;
544 if (resString+s >= resString2 + len)
547 string = strtok(resString+s, " ");
550 XtSetArg(args[n], XmNimageName, dtIcon); n++;
551 XtSetArg(args[n], XmNstring, cmp_string); n++;
552 componentWidget = _DtCreateControl(mainRC, string, args, n);
553 XtManageChild (componentWidget);
554 XtAddCallback(componentWidget, XmNcallback, activateCB, string);
555 XtAddCallback(componentWidget, XmNhelpCallback,
556 (XtCallbackProc)HelpRequestCB, (XtPointer)helpTag);
557 XmStringFree(cmp_string);
560 s += strlen(string) +1;
561 if (resString+s >= resString2 + len)
564 string = strtok(resString+s, " ");
570 /*+++++++++++++++++++++++++++++++++++++++*/
571 /* cancel all the dialogs (for exit) */
572 /*+++++++++++++++++++++++++++++++++++++++*/
576 DtDialogBoxCallbackStruct CancelBut;
577 char dialogStates[60];
578 static Boolean calledAlready = False;
580 if (!calledAlready) {
581 dialogStates[0] = '\0';
583 if(style.colorDialog != NULL && XtIsManaged(style.colorDialog)) {
584 CancelBut.button_position = CANCEL_BUTTON;
585 XtCallCallbacks(style.colorDialog, XmNcallback, &CancelBut);
588 if(style.fontDialog != NULL && XtIsManaged(style.fontDialog)) {
589 CancelBut.button_position = CANCEL_BUTTON;
590 XtCallCallbacks(style.fontDialog, XmNcallback, &CancelBut);
593 if(style.audioDialog != NULL && XtIsManaged(style.audioDialog)) {
594 CancelBut.button_position = CANCEL_BUTTON;
595 XtCallCallbacks(style.audioDialog, XmNcallback, &CancelBut);
598 if(style.kbdDialog != NULL && XtIsManaged(style.kbdDialog)) {
599 CancelBut.button_position = CANCEL_BUTTON;
600 XtCallCallbacks(style.kbdDialog, XmNcallback, &CancelBut);
603 if(style.mouseDialog != NULL && XtIsManaged(style.mouseDialog)) {
604 CancelBut.button_position = CANCEL_BUTTON;
605 XtCallCallbacks(style.mouseDialog, XmNcallback, &CancelBut);
608 if(style.screenDialog != NULL && XtIsManaged(style.screenDialog)) {
609 CancelBut.button_position = CANCEL_BUTTON;
610 XtCallCallbacks(style.screenDialog, XmNcallback, &CancelBut);
613 if(style.startupDialog != NULL && XtIsManaged(style.startupDialog)) {
614 CancelBut.button_position = CANCEL_BUTTON;
615 XtCallCallbacks(style.startupDialog, XmNcallback, &CancelBut);
619 _DtAddToResource(style.display, dialogStates);
621 calledAlready = True;
625 /*+++++++++++++++++++++++++++++++++++++++*/
627 /*+++++++++++++++++++++++++++++++++++++++*/
632 XtPointer client_data,
633 XtPointer call_data )
635 /*callCancels() remembers whether its been called so it won't get called*/
639 XSync(style.display, 0);
643 /*+++++++++++++++++++++++++++++++++++++++*/
644 /* PushButton CallBacks */
645 /*+++++++++++++++++++++++++++++++++++++++*/
647 /*+++++++++++++++++++++++++++++++++++++++*/
649 /*+++++++++++++++++++++++++++++++++++++++*/
654 XtPointer client_data,
655 XtPointer call_data )
658 DtControlCallbackStruct *cbs =
659 (DtControlCallbackStruct *) call_data;
661 cd = (char *) client_data;
663 /* if any other event besides an activate
664 event invokes this callback, don't invoke
665 any dialogs. Just ignore the event.
667 if (cbs->reason != XmCR_ACTIVATE) return;
669 if (strcmp(cd, COLOR) == 0)
670 Customize(style.shell);
672 else if (strcmp(cd, FONT) == 0)
673 popup_fontBB(style.shell);
675 else if (strcmp(cd, BACKDROP) == 0)
676 BackdropDialog (style.shell);
678 else if (strcmp(cd, KEYBOARD) == 0)
679 popup_keyboardBB(style.shell);
681 else if (strcmp(cd, MOUSE) == 0)
682 popup_mouseBB(style.shell);
684 else if (strcmp(cd, BEEP) == 0)
685 popup_audioBB(style.shell);
687 else if (strcmp(cd, SCREEN) == 0)
688 popup_screenBB(style.shell);
690 else if (strcmp(cd, DTWM) == 0)
691 popup_dtwmBB(style.shell);
693 else if (strcmp(cd, STARTUP) == 0)
694 popup_startupBB(style.shell);
696 else if (strcmp(cd, I18N) == 0)
697 popup_i18nBB(style.shell);
702 /************************************************************************
705 * restore any state information saved with saveMain.
706 * This is called from restoreSession with the application
707 * shell and the special xrm database retrieved for restore.
708 ************************************************************************/
715 XrmRepresentation rep_type;
718 xrm_name [0] = XrmStringToQuark ("mainWindow");
719 xrm_name [1] = XrmStringToQuark ("ismapped");
722 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) {
723 /* Are we supposed to be mapped? */
724 if (strcmp(value.addr, "True") == 0) {
728 xrm_name [1] = XrmStringToQuark ("x");
729 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) {
730 XtSetArg (save.posArgs[save.poscnt], XmNx, atoi((char *)value.addr));
735 xrm_name [1] = XrmStringToQuark ("y");
736 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) {
737 XtSetArg (save.posArgs[save.poscnt], XmNy, atoi((char *)value.addr));
741 save.restoreFlag = True;
742 init_mainWindow(shell);
746 _DtSimpleError (progName, DtWarning, NULL, ((char *)GETMESSAGE(4,36,
747 "No Dtstyle restore information available for current session")), NULL);
750 /************************************************************************
753 * This routine will write out to the passed file descriptor any state
754 * information this dialog needs. It is called from saveSessionCB with the
755 * file already opened.
756 * All information is saved in xrm format. There is no restriction
757 * on what can be saved. It doesn't have to be defined or be part of any
758 * widget or Xt definition. Just name and save it here and recover it in
759 * restoreMain. The suggested minimum is whether you are mapped, and your
761 ************************************************************************/
767 char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */
769 if (style.mainWindow != NULL) {
770 if (XtIsRealized(style.mainWindow))
771 sprintf(bufr, "*mainWindow.ismapped: True\n");
773 /* Get and write out the geometry info for our Window */
774 x = XtX(XtParent(style.mainWindow));
775 y = XtY(XtParent(style.mainWindow));
776 sprintf(bufr, "%s*mainWindow.x: %d\n", bufr, x);
777 sprintf(bufr, "%s*mainWindow.y: %d\n", bufr, y);
779 write (fd, bufr, strlen(bufr));