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>
57 #include <Xm/CascadeB.h>
58 #include <Xm/ColorObjP.h>
62 #include <Xm/RowColumn.h>
63 #include <Xm/SeparatoG.h>
68 #include <Dt/Control.h>
69 #include <Dt/DialogBox.h>
71 #include <Dt/IconFile.h>
73 #include <Dt/HourGlass.h>
74 #include <Dt/UserMsg.h>
78 #include "SaveRestore.h"
80 /*+++++++++++++++++++++++++++++++++++++++*/
81 /* include extern functions */
82 /*+++++++++++++++++++++++++++++++++++++++*/
85 /*+++++++++++++++++++++++++++++++++++++++*/
87 /*+++++++++++++++++++++++++++++++++++++++*/
89 /*+++++++++++++++++++++++++++++++++++++++*/
90 /* Internal Functions */
91 /*+++++++++++++++++++++++++++++++++++++++*/
95 XtPointer client_data,
96 XtPointer call_data) ;
97 static void build_mainWindow( Widget shell) ;
98 static void activateCB(
100 XtPointer client_data,
101 XtPointer call_data) ;
102 static void ProcessComponentList(
107 /*+++++++++++++++++++++++++++++++++++++++*/
108 /* Internal variables */
109 /*+++++++++++++++++++++++++++++++++++++++*/
111 static int colorUse = XmCO_BLACK_WHITE;
112 static saveRestore save = {FALSE, 0, };
115 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
116 /* init_mainWindow */
118 /* build if needed, otherwise just manage the mainWindow. */
119 /* Assumes shell has been created */
120 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
122 init_mainWindow( Widget shell )
124 if (style.mainWindow == NULL) {
125 build_mainWindow(shell);
126 if (save.restoreFlag)
127 XtAddCallback (shell, XtNpopupCallback, _DtMapCB, NULL);
128 XtManageChild(style.mainWindow);
129 XtPopup(shell, XtGrabNone);
131 else /* fix Shouldn't ever happen */
132 XtManageChild(style.mainWindow);
135 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
137 /* first time only, set correct sizing in case font */
138 /* size has changed (if so, saved size is wrong) */
139 /* remove callback after first time */
140 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
144 XtPointer client_data,
145 XtPointer call_data )
149 if (save.restoreFlag)
151 hints.min_width = XtWidth(w);
152 hints.min_height = XtHeight(w);
153 hints.max_width = XtWidth(w);
154 hints.max_height = XtHeight(w);
155 hints.flags = PMinSize | PMaxSize;
156 XSetWMNormalHints (style.display, XtWindow(w), &hints);
159 XtRemoveCallback(style.shell, XtNpopupCallback, _DtMapCB, NULL);
162 /*+++++++++++++++++++++++++++++++++++++++++++++*/
163 /* build_mainWindow */
165 /* build the main window, but don't manage it. */
166 /*+++++++++++++++++++++++++++++++++++++++++++++*/
183 XmString labelString;
185 XmPixelSet pixelSet[XmCO_NUM_COLORS];
191 * Note that save.poscnt has been initialized elsewhere.
192 * save.posArgs may contain information from restoreAudio().*/
194 XtSetArg(save.posArgs[save.poscnt], XmNnoResize, True); save.poscnt++;
195 XtSetArg(save.posArgs[save.poscnt], XmNresizePolicy, XmRESIZE_NONE); save.poscnt++;
196 style.mainWindow= XmCreateMainWindow(shell,"mainWindow", save.posArgs, save.poscnt);
197 XtAddCallback(style.mainWindow, XmNhelpCallback,
198 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_MAIN_WINDOW);
201 tmpStr = (char *)XtMalloc(strlen(GETMESSAGE(4, 1, "Style Manager"))+1);
202 sprintf(tmpStr, "%s", GETMESSAGE(4, 1, "Style Manager"));
203 XtSetArg(args[n], XmNtitle, tmpStr); n++;
204 XtSetArg(args[n], XmNiconName,
205 (char *)GETMESSAGE(4, 37, "Style")); n++;
206 XtSetValues(XtParent(style.mainWindow), args, n);
210 mainMenu= XmCreateMenuBar(style.mainWindow,"mainMenu", args, n);
211 XtAddCallback(mainMenu, XmNhelpCallback,
212 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_MENUBAR);
213 XtManageChild(mainMenu);
215 /* create the pulldown widgets */
217 filePulldown= XmCreatePulldownMenu(mainMenu,"fileMenu", args, n );
218 XtAddCallback(filePulldown, XmNhelpCallback,
219 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FILE_MENU);
222 helpPulldown= XmCreatePulldownMenu(mainMenu, "helpMenu" , args, n );
223 XtAddCallback(helpPulldown, XmNhelpCallback,
224 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_HELP_MENU);
226 /* create the cascade butons */
230 mnemonic = ((char *)GETMESSAGE(4, 2, "F"));
231 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
232 labelString = CMPSTR((char *)GETMESSAGE(4, 3, "File"));
233 XtSetArg(args[n], XmNlabelString, labelString); n++;
234 XtSetArg(args[n], XmNsubMenuId, filePulldown); n++;
235 XtSetArg (args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++;
237 XmCreateCascadeButton(mainMenu, "fileCascadeButton", args, n );
238 XtAddCallback(WidgList[count-1], XmNhelpCallback,
239 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FILE_MENU);
240 XmStringFree(labelString);
243 mnemonic = ((char *)GETMESSAGE(4, 4, "H"));
244 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
245 labelString = CMPSTR((char *)GETMESSAGE(4, 5, "Help"));
246 XtSetArg(args[n], XmNlabelString, labelString); n++;
247 XtSetArg(args[n], XmNsubMenuId, helpPulldown); n++;
248 XtSetArg (args[n], XmNmarginWidth, 6); n++;
250 XmCreateCascadeButton(mainMenu, "helpCascadeButton", args, n );
251 XtAddCallback(WidgList[count-1], XmNhelpCallback,
252 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_HELP_MENU);
253 XmStringFree(labelString);
256 XtSetArg(args[n], XmNmenuHelpWidget, WidgList[count-1]); n++;
257 XtSetValues (mainMenu, args, n);
259 XtManageChildren (WidgList, count);
261 /* create the File menu pane's buttons */
263 mnemonic = ((char *)GETMESSAGE(4, 53, "x"));
264 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
265 labelString = CMPSTR((char *)GETMESSAGE(4, 7, "Exit"));
266 XtSetArg(args[n], XmNlabelString, labelString); n++;
267 exitBtn= XmCreatePushButton(filePulldown, "exit", args, n );
268 XtAddCallback(exitBtn, XmNactivateCallback, activateCB_exitBtn, NULL);
269 XtAddCallback(exitBtn, XmNhelpCallback,
270 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_EXIT);
271 XtManageChild(exitBtn);
272 XmStringFree(labelString);
274 /* create the Help menu pane's buttons */
278 mnemonic = ((char *)GETMESSAGE(4, 54, "v"));
279 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
280 labelString = CMPSTR((char *)GETMESSAGE(4, 55, "Overview"));
281 XtSetArg(args[n], XmNlabelString, labelString); n++;
283 XmCreatePushButton(helpPulldown, "overview", args, n );
284 XtAddCallback(WidgList[count-1], XmNactivateCallback,
285 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_INTRODUCTION);
286 XmStringFree(labelString);
290 XmCreateSeparatorGadget(helpPulldown,"separator",args,n);
293 mnemonic = ((char *)GETMESSAGE(4, 43, "T"));
294 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
295 labelString = CMPSTR((char *)GETMESSAGE(4, 56, "Tasks"));
296 XtSetArg(args[n], XmNlabelString, labelString); n++;
297 WidgList[count++]= XmCreatePushButton(helpPulldown, "tasks", args, n );
298 XtAddCallback(WidgList[count-1], XmNactivateCallback,
299 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_TASKS);
300 XmStringFree(labelString);
303 mnemonic = ((char *)GETMESSAGE(4, 45, "R"));
304 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
305 labelString = CMPSTR((char *)GETMESSAGE(4, 57, "Reference"));
306 XtSetArg(args[n], XmNlabelString, labelString); n++;
307 WidgList[count++]= XmCreatePushButton(helpPulldown, "reference", args, n );
308 XtAddCallback(WidgList[count-1], XmNactivateCallback,
309 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_REFERENCE);
310 XmStringFree(labelString);
313 mnemonic = ((char *)GETMESSAGE(4, 47, "O"));
314 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
315 labelString = CMPSTR((char *)GETMESSAGE(4, 48, "On Item"));
316 XtSetArg(args[n], XmNlabelString, labelString); n++;
317 WidgList[count++]= XmCreatePushButton(helpPulldown, "onItem", args, n );
318 XtAddCallback(WidgList[count-1], XmNactivateCallback,
319 (XtCallbackProc)HelpModeCB, (XtPointer)NULL);
320 XmStringFree(labelString);
324 XmCreateSeparatorGadget(helpPulldown,"separator",args,n);
327 mnemonic = ((char *)GETMESSAGE(4, 49, "U"));
328 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
329 labelString = CMPSTR((char *)GETMESSAGE(4, 58, "Using Help"));
330 XtSetArg(args[n], XmNlabelString, labelString); n++;
332 XmCreatePushButton(helpPulldown, "usingHelp", args, n );
333 XtAddCallback(WidgList[count-1], XmNactivateCallback,
334 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_USING);
335 XmStringFree(labelString);
339 XmCreateSeparatorGadget(helpPulldown,"separator",args,n);
342 mnemonic = ((char *)GETMESSAGE(4, 59, "A"));
343 XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++;
344 labelString = CMPSTR((char *)GETMESSAGE(4, 60, "About Style Manager"));
345 XtSetArg(args[n], XmNlabelString, labelString); n++;
346 WidgList[count++]= XmCreatePushButton(helpPulldown, "stylemanager", args, n );
347 XtAddCallback(WidgList[count-1], XmNactivateCallback,
348 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_VERSION);
349 XmStringFree(labelString);
351 XtManageChildren(WidgList, count);
353 /* create frame and row column for icon gadgets */
355 XtSetArg(args[n], XmNresizePolicy, XmRESIZE_NONE); n++;
356 XtSetArg(args[n], XmNshadowType, XmSHADOW_OUT); n++;
357 XtSetArg(args[n], XmNshadowThickness, 1); n++;
358 frame = XmCreateFrame(style.mainWindow, "frame", args, n);
359 XtManageChild(frame);
361 /* Save pixels for later use */
362 /* primary top/bottom shadow -> fg/bg for pixmaps in primary areas */
363 /* secondary top/bottom shadow -> fg/bg for pixmaps in secondary areas */
364 /* secondary select color -> backgrounds of editable text areas */
365 /* secondary foreground -> fill color on toggle indicators */
367 /* Get the primary colors to be used later */
369 XtSetArg(args[n], XmNbackground, &bg); n++;
370 XtGetValues(style.mainWindow, args, n);
372 XmGetColors (style.screen, style.colormap, bg,
378 /* Get the secondary colors to be used later */
380 XtSetArg(args[n], XmNbackground, &style.secBgCol); n++;
381 XtGetValues(exitBtn, args, n);
383 XmGetColors (style.screen, style.colormap, style.secBgCol,
384 &style.tgSelectColor,
387 &style.secSelectColor);
389 if ((style.secTSCol == style.secBSCol) || /* B_W or shadowPixmaps==True */
390 (!style.useMultiColorIcons)) /* multiColorIcons turned off */
392 /* force TS = White, BS = Black */
393 style.secTSCol = style.primTSCol = WhitePixelOfScreen(style.screen);
394 style.secBSCol = style.primBSCol = BlackPixelOfScreen(style.screen);
397 XmeGetPixelData(style.screenNum, &colorUse, pixelSet, &a, &i, &p, &s);
400 if (colorUse == XmCO_BLACK_WHITE)
402 ditherPix = XmGetPixmap (style.screen, "50_foreground",
403 style.primBSCol,style.primTSCol);
404 XtSetArg(args[n], XmNbackgroundPixmap, ditherPix); n++;
406 XtSetArg(args[n], XmNallowOverlap, False); n++;
407 XtSetArg(args[n], XmNadjustLast, False); n++;
408 XtSetArg(args[n], XmNpacking, XmPACK_TIGHT); n++;
409 XtSetArg(args[n], XmNspacing, style.horizontalSpacing); n++;
410 mainRC = XmCreateRowColumn(frame, "mainRC", args, n);
411 XtManageChild(mainRC);
414 XtSetArg(args[n], XmNmenuBar, mainMenu); n++;
415 XtSetArg(args[n], XmNcommandWindow, NULL); n++;
416 XtSetArg(args[n], XmNworkWindow, frame); n++;
417 XtSetValues (style.mainWindow, args, n);
419 ProcessComponentList (shell, mainRC);
423 /*+++++++++++++++++++++++++++++++++++++++
424 * ProcessComponentList();
426 *+++++++++++++++++++++++++++++++++++++++*/
429 ProcessComponentList(
437 Widget componentWidget;
440 char *resString, *resString2;
446 style.workProcs = False;
447 if (style.xrdb.componentList == NULL) return;
450 XtSetArg(args[n], XmNalignment, XmALIGNMENT_CENTER); n++;
451 XtSetArg(args[n], XmNpixmapPosition, XmPIXMAP_TOP); n++;
452 XtSetArg(args[n], XmNshadowType, XmSHADOW_OUT); n++;
453 n2 = 3; /* number of preset args for creating Icons */
455 resString = strdup (style.xrdb.componentList);
456 resString2 = resString;
457 len = strlen(resString);
458 string = strtok(resString, " ");
460 while (string != NULL)
462 /* check for valid name, duplicate name *** */
464 /* create Icon in Dtstyle main window */
467 XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
468 if (colorUse == XmCO_BLACK_WHITE)
470 XtSetArg(args[n], XmNuseEmbossedText, False); n++;
472 XtSetArg(args[n], XmNpixmapForeground, style.primBSCol); n++;
473 XtSetArg(args[n], XmNpixmapBackground, style.primTSCol); n++;
474 if (strcmp(string, COLOR) == 0)
476 cmp_string = CMPSTR(GETMESSAGE(4, 27, "Color"));
477 helpTag = HELP_COLOR_BUTTON;
478 dtIcon = _DtGetIconFileName(style.screen, COLOR_ICON, NULL, NULL, 0);
479 style.workProcs = True;
481 else if (strcmp(string, FONT) == 0)
483 cmp_string = CMPSTR(GETMESSAGE(4, 28, "Font"));
484 dtIcon = _DtGetIconFileName(style.screen, FONT_ICON, NULL, NULL, 0);
485 helpTag = HELP_FONT_BUTTON;
488 else if (strcmp(string, BACKDROP) == 0)
490 cmp_string = CMPSTR(GETMESSAGE(4, 29, "Backdrop"));
491 dtIcon = _DtGetIconFileName(style.screen, BACKDROP_ICON, NULL, NULL, 0);
492 helpTag = HELP_BACKDROP_BUTTON;
495 else if (strcmp(string, KEYBOARD) == 0)
497 cmp_string = CMPSTR(GETMESSAGE(4, 30, "Keyboard"));
498 dtIcon = _DtGetIconFileName(style.screen, KEYBOARD_ICON, NULL, NULL, 0);
499 helpTag = HELP_KEYBOARD_BUTTON;
502 else if (strcmp(string, MOUSE) == 0)
504 cmp_string = CMPSTR(GETMESSAGE(4, 31, "Mouse"));
505 dtIcon = _DtGetIconFileName(style.screen, MOUSE_ICON, NULL, NULL, 0);
506 helpTag = HELP_MOUSE_BUTTON;
509 else if (strcmp(string, BEEP) == 0)
511 cmp_string = CMPSTR(GETMESSAGE(4, 32, "Beep"));
512 dtIcon = _DtGetIconFileName(style.screen, BEEP_ICON, NULL, NULL, 0);
513 helpTag = HELP_AUDIO_BUTTON;
516 else if (strcmp(string, SCREEN) == 0)
518 cmp_string = CMPSTR(GETMESSAGE(4, 33, "Screen"));
519 dtIcon = _DtGetIconFileName(style.screen, SCREEN_ICON, NULL, NULL, 0);
520 helpTag = HELP_SCREEN_BUTTON;
523 else if (strcmp(string, DTWM) == 0)
525 cmp_string = CMPSTR(GETMESSAGE(4, 38, "Window"));
526 dtIcon = _DtGetIconFileName(style.screen, DTWM_ICON, NULL, NULL, 0);
527 helpTag = HELP_DTWM_BUTTON;
530 else if (strcmp(string, STARTUP) == 0)
532 cmp_string = CMPSTR(GETMESSAGE(4, 35, "Startup"));
533 dtIcon = _DtGetIconFileName(style.screen, STARTUP_ICON, NULL, NULL, 0);
534 helpTag = HELP_STARTUP_BUTTON;
536 else if (strcmp(string, I18N) == 0)
538 cmp_string = CMPSTR(GETMESSAGE(4, 34, "Intl'"));
539 dtIcon = _DtGetIconFileName(style.screen, I18N_ICON, NULL, NULL, 0);
540 helpTag = HELP_I18N_BUTTON;
544 s += strlen(string) +1;
545 if (resString+s >= resString2 + len)
548 string = strtok(resString+s, " ");
551 XtSetArg(args[n], XmNimageName, dtIcon); n++;
552 XtSetArg(args[n], XmNstring, cmp_string); n++;
553 componentWidget = _DtCreateControl(mainRC, string, args, n);
554 XtManageChild (componentWidget);
555 XtAddCallback(componentWidget, XmNcallback, activateCB, string);
556 XtAddCallback(componentWidget, XmNhelpCallback,
557 (XtCallbackProc)HelpRequestCB, (XtPointer) (intptr_t) helpTag);
558 XmStringFree(cmp_string);
561 s += strlen(string) +1;
562 if (resString+s >= resString2 + len)
565 string = strtok(resString+s, " ");
571 /*+++++++++++++++++++++++++++++++++++++++*/
572 /* cancel all the dialogs (for exit) */
573 /*+++++++++++++++++++++++++++++++++++++++*/
577 DtDialogBoxCallbackStruct CancelBut;
578 char dialogStates[60];
579 static Boolean calledAlready = False;
581 if (!calledAlready) {
582 dialogStates[0] = '\0';
584 if(style.colorDialog != NULL && XtIsManaged(style.colorDialog)) {
585 CancelBut.button_position = CANCEL_BUTTON;
586 XtCallCallbacks(style.colorDialog, XmNcallback, &CancelBut);
589 if(style.fontDialog != NULL && XtIsManaged(style.fontDialog)) {
590 CancelBut.button_position = CANCEL_BUTTON;
591 XtCallCallbacks(style.fontDialog, XmNcallback, &CancelBut);
594 if(style.audioDialog != NULL && XtIsManaged(style.audioDialog)) {
595 CancelBut.button_position = CANCEL_BUTTON;
596 XtCallCallbacks(style.audioDialog, XmNcallback, &CancelBut);
599 if(style.kbdDialog != NULL && XtIsManaged(style.kbdDialog)) {
600 CancelBut.button_position = CANCEL_BUTTON;
601 XtCallCallbacks(style.kbdDialog, XmNcallback, &CancelBut);
604 if(style.mouseDialog != NULL && XtIsManaged(style.mouseDialog)) {
605 CancelBut.button_position = CANCEL_BUTTON;
606 XtCallCallbacks(style.mouseDialog, XmNcallback, &CancelBut);
609 if(style.screenDialog != NULL && XtIsManaged(style.screenDialog)) {
610 CancelBut.button_position = CANCEL_BUTTON;
611 XtCallCallbacks(style.screenDialog, XmNcallback, &CancelBut);
614 if(style.startupDialog != NULL && XtIsManaged(style.startupDialog)) {
615 CancelBut.button_position = CANCEL_BUTTON;
616 XtCallCallbacks(style.startupDialog, XmNcallback, &CancelBut);
620 _DtAddToResource(style.display, dialogStates);
622 calledAlready = True;
626 /*+++++++++++++++++++++++++++++++++++++++*/
628 /*+++++++++++++++++++++++++++++++++++++++*/
633 XtPointer client_data,
634 XtPointer call_data )
636 /*callCancels() remembers whether its been called so it won't get called*/
640 XSync(style.display, 0);
644 /*+++++++++++++++++++++++++++++++++++++++*/
645 /* PushButton CallBacks */
646 /*+++++++++++++++++++++++++++++++++++++++*/
648 /*+++++++++++++++++++++++++++++++++++++++*/
650 /*+++++++++++++++++++++++++++++++++++++++*/
655 XtPointer client_data,
656 XtPointer call_data )
659 DtControlCallbackStruct *cbs =
660 (DtControlCallbackStruct *) call_data;
662 cd = (char *) client_data;
664 /* if any other event besides an activate
665 event invokes this callback, don't invoke
666 any dialogs. Just ignore the event.
668 if (cbs->reason != XmCR_ACTIVATE) return;
670 if (strcmp(cd, COLOR) == 0)
671 Customize(style.shell);
673 else if (strcmp(cd, FONT) == 0)
674 popup_fontBB(style.shell);
676 else if (strcmp(cd, BACKDROP) == 0)
677 BackdropDialog (style.shell);
679 else if (strcmp(cd, KEYBOARD) == 0)
680 popup_keyboardBB(style.shell);
682 else if (strcmp(cd, MOUSE) == 0)
683 popup_mouseBB(style.shell);
685 else if (strcmp(cd, BEEP) == 0)
686 popup_audioBB(style.shell);
688 else if (strcmp(cd, SCREEN) == 0)
689 popup_screenBB(style.shell);
691 else if (strcmp(cd, DTWM) == 0)
692 popup_dtwmBB(style.shell);
694 else if (strcmp(cd, STARTUP) == 0)
695 popup_startupBB(style.shell);
697 else if (strcmp(cd, I18N) == 0)
698 popup_i18nBB(style.shell);
703 /************************************************************************
706 * restore any state information saved with saveMain.
707 * This is called from restoreSession with the application
708 * shell and the special xrm database retrieved for restore.
709 ************************************************************************/
716 XrmRepresentation rep_type;
719 xrm_name [0] = XrmStringToQuark ("mainWindow");
720 xrm_name [1] = XrmStringToQuark ("ismapped");
723 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) {
724 /* Are we supposed to be mapped? */
725 if (strcmp(value.addr, "True") == 0) {
729 xrm_name [1] = XrmStringToQuark ("x");
730 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) {
731 XtSetArg (save.posArgs[save.poscnt], XmNx, atoi((char *)value.addr));
736 xrm_name [1] = XrmStringToQuark ("y");
737 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) {
738 XtSetArg (save.posArgs[save.poscnt], XmNy, atoi((char *)value.addr));
742 save.restoreFlag = True;
743 init_mainWindow(shell);
747 _DtSimpleError (progName, DtWarning, NULL, ((char *)GETMESSAGE(4,36,
748 "No Dtstyle restore information available for current session")), NULL);
751 /************************************************************************
754 * This routine will write out to the passed file descriptor any state
755 * information this dialog needs. It is called from saveSessionCB with the
756 * file already opened.
757 * All information is saved in xrm format. There is no restriction
758 * on what can be saved. It doesn't have to be defined or be part of any
759 * widget or Xt definition. Just name and save it here and recover it in
760 * restoreMain. The suggested minimum is whether you are mapped, and your
762 ************************************************************************/
768 char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */
770 if (style.mainWindow != NULL) {
771 if (XtIsRealized(style.mainWindow))
772 sprintf(bufr, "*mainWindow.ismapped: True\n");
774 /* Get and write out the geometry info for our Window */
775 x = XtX(XtParent(style.mainWindow));
776 y = XtY(XtParent(style.mainWindow));
777 sprintf(bufr, "%s*mainWindow.x: %d\n", bufr, x);
778 sprintf(bufr, "%s*mainWindow.y: %d\n", bufr, y);
780 if(-1 == write (fd, bufr, strlen(bufr))) {
781 perror(strerror(errno));