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 /************************************<+>*************************************
24 ****************************************************************************
30 ** Description: Controls the Dtstyle Audio dialog
33 ** (c) Copyright Hewlett-Packard Company, 1990.
37 ****************************************************************************
38 ************************************<+>*************************************/
39 /* $XConsortium: Audio.c /main/4 1995/10/30 13:07:24 rswiston $ */
40 /*+++++++++++++++++++++++++++++++++++++++*/
42 /*+++++++++++++++++++++++++++++++++++++++*/
46 #include <Xm/MwmUtil.h>
51 #include <Xm/PushBG.h>
53 #include <Xm/VendorSEP.h>
54 #include <Xm/LabelG.h>
56 #include <Dt/DialogBox.h>
59 #include <Dt/Message.h>
60 #include <Dt/HourGlass.h>
64 #include "SaveRestore.h"
67 /*+++++++++++++++++++++++++++++++++++++++*/
68 /* include extern functions */
69 /*+++++++++++++++++++++++++++++++++++++++*/
72 /*+++++++++++++++++++++++++++++++++++++++*/
74 /*+++++++++++++++++++++++++++++++++++++++*/
75 #define VOLUME_MAX 100
76 #define SCALE_WIDTH 200
78 /*+++++++++++++++++++++++++++++++++++++++*/
79 /* Internal Functions */
80 /*+++++++++++++++++++++++++++++++++++++++*/
82 static Widget build_audioDlg( Widget shell) ;
83 static void formLayoutCB ( Widget, XtPointer, XtPointer ) ;
84 static void _DtmapCB_audioDlg ( Widget, XtPointer, XtPointer ) ;
85 static int getValue ( Widget w) ;
86 static void valueChangedCB ( Widget, XtPointer, XtPointer ) ;
87 static void systemDefaultCB ( Widget, XtPointer, XtPointer ) ;
88 static void ButtonCB ( Widget, XtPointer, XtPointer ) ;
91 /*+++++++++++++++++++++++++++++++++++++++*/
92 /* Internal Variables */
93 /*+++++++++++++++++++++++++++++++++++++++*/
104 Boolean systemDefaultFlag;
105 XKeyboardState values;
109 static saveRestore save = {FALSE, 0, };
111 /*+++++++++++++++++++++++++++++++++++++++*/
113 /*+++++++++++++++++++++++++++++++++++++++*/
119 if (style.audioDialog == NULL) {
120 _DtTurnOnHourGlass(shell);
121 build_audioDlg(shell);
122 XtManageChild(style.audioDialog);
123 _DtTurnOffHourGlass(shell);
127 XtManageChild(style.audioDialog);
128 raiseWindow(XtWindow(XtParent(style.audioDialog)));
130 audio.systemDefaultFlag = False;
133 /*+++++++++++++++++++++++++++++++++++++++*/
134 /* build__audioDlg */
135 /*+++++++++++++++++++++++++++++++++++++++*/
142 XmString button_string[NUM_LABELS];
147 Widget widget_list[12];
149 /*get audio values for sliders*/
150 XGetKeyboardControl(style.display, &audio.values);
151 if(audio.values.bell_duration == 0)
152 audio.values.bell_duration = 1;
154 /* Set up DialogBoxDialog button labels */
155 button_string[0] = CMPSTR((String) _DtOkString);
156 button_string[1] = CMPSTR((String) _DtCancelString);
157 button_string[2] = CMPSTR((String) _DtHelpString);
159 /* Create toplevel DialogBox */
161 * Note that save.poscnt has been initialized elsewhere.
162 * save.posArgs may contain information from restoreBeep().*/
164 XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS); save.poscnt++;
165 XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string); save.poscnt++;
166 XtSetArg (save.posArgs[save.poscnt], XmNdefaultPosition, False);
169 __DtCreateDialogBoxDialog(shell, "AudioDialog", save.posArgs, save.poscnt);
170 XtAddCallback(style.audioDialog, XmNmapCallback, formLayoutCB, NULL);
171 XtAddCallback(style.audioDialog, XmNmapCallback, _DtmapCB_audioDlg, shell);
172 XtAddCallback(style.audioDialog, XmNcallback, ButtonCB, NULL);
173 XtAddCallback(style.audioDialog, XmNhelpCallback,
174 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_AUDIO_DIALOG);
176 XmStringFree(button_string[0]);
177 XmStringFree(button_string[1]);
178 XmStringFree(button_string[2]);
180 widget_list[0] = _DtDialogBoxGetButton(style.audioDialog,2);
182 XtSetArg(args[n], XmNautoUnmanage, False); n++;
183 XtSetArg(args[n], XmNcancelButton, widget_list[0]); n++;
184 XtSetValues (style.audioDialog, args, n);
187 XtSetArg(args[n], XmNtitle, ((char *)GETMESSAGE(6, 7, "Style Manager - Beep"))); n++;
188 XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
189 XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
190 XtSetValues (XtParent(style.audioDialog), args, n);
193 XtSetArg(args[n], XmNhorizontalSpacing, style.horizontalSpacing); n++;
194 XtSetArg(args[n], XmNverticalSpacing, style.verticalSpacing); n++;
195 XtSetArg(args[n], XmNallowOverlap, False); n++;
196 XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
197 form = XmCreateForm(style.audioDialog, "audioForm", args, n);
200 XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
201 XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
202 XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
203 XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
204 XtSetArg(args[n], XmNstring, NULL); n++;
205 XtSetArg(args[n], XmNshadowThickness, 0); n++;
206 XtSetArg(args[n], XmNimageName, BEEP_ICON); n++;
207 XtSetArg(args[n], XmNtraversalOn, False); n++;
208 widget_list[count++] =
209 audio.pictLabel = _DtCreateIcon(form, "audiopictLabel", args, n);
212 XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT); n++;
213 XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++;
214 string = CMPSTR(((char *)GETMESSAGE(6, 2, "Default")));
215 XtSetArg(args[n], XmNlabelString, string); n++;
216 widget_list[count++] =
217 audio.systemDefault = XmCreatePushButtonGadget(form, "systemDefault", args, n);
218 XmStringFree(string);
221 XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++;
222 string = CMPSTR(((char *)GETMESSAGE(6, 3, "Volume")));
223 XtSetArg(args[n], XmNlabelString, string); n++;
224 XtSetArg(args[n], XmNmarginHeight, 0); n++;
225 widget_list[count++] =
226 audio.volLabGad= XmCreateLabelGadget(form,"volLabGad", args, n);
227 XmStringFree(string);
230 XtSetArg(args[n], XmNmaximum, VOLUME_MAX); n++;
231 XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
232 XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
233 XtSetArg(args[n], XmNshowValue, True); n++;
234 XtSetArg(args[n], XmNvalue,audio.values.bell_percent); n++;
235 XtSetArg(args[n], XmNhighlightThickness, SCALE_HIGHLIGHT_THICKNESS); n++;
236 XtSetArg(args[n], XmNscaleWidth, SCALE_WIDTH); n++;
237 widget_list[count++] =
238 audio.volScale= XmCreateScale(form,"volScale", args, n);
241 XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++;
242 string = CMPSTR(((char *)GETMESSAGE(6, 4, "Tone")));
243 XtSetArg(args[n], XmNlabelString, string); n++;
244 XtSetArg(args[n], XmNmarginHeight, 0); n++;
245 widget_list[count++] =
246 audio.toneLabGad= XmCreateLabelGadget(form,"toneLabGad", args, n);
247 XmStringFree(string);
250 XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
251 XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
252 XtSetArg(args[n], XmNshowValue, True); n++;
253 XtSetArg(args[n], XmNhighlightThickness, SCALE_HIGHLIGHT_THICKNESS); n++;
254 XtSetArg(args[n], XmNscaleWidth, SCALE_WIDTH); n++;
255 XtSetArg(args[n], XmNvalue,audio.values.bell_pitch); n++;
256 widget_list[count++] =
257 audio.toneScale= XmCreateScale(form,"toneScale", args, n);
260 XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++;
261 string = CMPSTR(((char *)GETMESSAGE(6, 5, "Duration")));
262 XtSetArg(args[n], XmNlabelString, string); n++;
263 XtSetArg(args[n], XmNmarginHeight, 0); n++;
264 widget_list[count++] =
265 audio.durLabGad= XmCreateLabelGadget(form,"durLabGad", args, n);
266 XmStringFree(string);
269 XtSetArg(args[n], XmNdecimalPoints, (short)1); n++;
270 XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
271 XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
272 XtSetArg(args[n], XmNshowValue, True); n++;
273 XtSetArg(args[n], XmNminimum, 1); n++;
274 XtSetArg(args[n], XmNhighlightThickness, SCALE_HIGHLIGHT_THICKNESS); n++;
275 XtSetArg(args[n], XmNvalue,(int)audio.values.bell_duration/100); n++;
276 XtSetArg(args[n], XmNscaleWidth, SCALE_WIDTH); n++;
277 widget_list[count++] =
278 audio.durScale= XmCreateScale(form,"durationScale", args, n);
280 XtAddCallback(audio.systemDefault, XmNactivateCallback, systemDefaultCB, NULL);
281 XtAddCallback(audio.volScale, XmNvalueChangedCallback, valueChangedCB, NULL);
282 XtAddCallback(audio.toneScale, XmNvalueChangedCallback, valueChangedCB, NULL);
283 XtAddCallback(audio.durScale, XmNvalueChangedCallback, valueChangedCB, NULL);
286 XtManageChildren(widget_list,count);
288 return(style.audioDialog);
292 /*+++++++++++++++++++++++++++++++++++++++*/
294 /*+++++++++++++++++++++++++++++++++++++++*/
298 XtPointer client_data,
299 XtPointer call_data )
303 Dimension ScaleHeight;
304 Dimension LabelHeight;
305 Dimension volLabelWidth;
306 Dimension toneLabelWidth;
307 Dimension durLabelWidth;
308 Dimension MaxLabelWidth;
310 Dimension LeftOffset;
313 /* get component sizes */
315 ScaleHeight = XtHeight(audio.volScale);
316 LabelHeight = XtHeight(audio.volLabGad);
318 MaxLabelWidth = volLabelWidth = XtWidth(audio.volLabGad);
320 toneLabelWidth = XtWidth(audio.toneLabGad);
321 if (toneLabelWidth > MaxLabelWidth)
323 MaxLabelWidth = toneLabelWidth;
326 durLabelWidth = XtWidth(audio.durLabGad);
327 if (durLabelWidth > MaxLabelWidth)
329 MaxLabelWidth = durLabelWidth;
332 TopOffset = style.verticalSpacing + ScaleHeight - LabelHeight;
334 /* do form attachments */
338 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
339 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
340 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
341 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
342 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
343 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
344 XtSetValues (audio.pictLabel, args, n);
348 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
349 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
350 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
351 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
352 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
353 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
354 XtSetValues (audio.systemDefault, args, n);
358 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
359 XtSetArg(args[n], XmNtopWidget, audio.pictLabel); n++;
360 XtSetArg(args[n], XmNtopOffset, TopOffset); n++;
361 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
362 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
363 LeftOffset = style.horizontalSpacing + (MaxLabelWidth - volLabelWidth);
364 XtSetArg(args[n], XmNleftOffset, LeftOffset); n++;
365 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
366 XtSetValues (audio.volLabGad, args, n);
371 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
372 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
373 XtSetArg(args[n], XmNbottomWidget, audio.volLabGad); n++;
374 XtSetArg(args[n], XmNbottomOffset, 0); n++;
375 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
376 XtSetArg(args[n], XmNleftWidget, audio.volLabGad); n++;
377 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
378 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
379 XtSetValues (audio.volScale, args, n);
383 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
384 XtSetArg(args[n], XmNtopWidget, audio.volScale); n++;
385 XtSetArg(args[n], XmNtopOffset, TopOffset); n++;
386 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
387 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
388 LeftOffset = style.horizontalSpacing + (MaxLabelWidth - toneLabelWidth);
389 XtSetArg(args[n], XmNleftOffset, LeftOffset); n++;
390 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
391 XtSetValues (audio.toneLabGad, args, n);
396 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
397 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
398 XtSetArg(args[n], XmNbottomWidget, audio.toneLabGad); n++;
399 XtSetArg(args[n], XmNbottomOffset, 0); n++;
400 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
401 XtSetArg(args[n], XmNleftWidget, audio.toneLabGad); n++;
402 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
403 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
404 XtSetValues (audio.toneScale, args, n);
408 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
409 XtSetArg(args[n], XmNtopWidget, audio.toneScale); n++;
410 XtSetArg(args[n], XmNtopOffset, TopOffset); n++;
411 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
412 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
413 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
414 LeftOffset = style.horizontalSpacing + (MaxLabelWidth - durLabelWidth);
415 XtSetArg(args[n], XmNleftOffset, LeftOffset); n++;
416 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
417 XtSetValues (audio.durLabGad, args, n);
422 XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); n++;
423 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
424 XtSetArg(args[n], XmNbottomWidget, audio.durLabGad); n++;
425 XtSetArg(args[n], XmNbottomOffset, 0); n++;
426 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
427 XtSetArg(args[n], XmNleftWidget, audio.durLabGad); n++;
428 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
429 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
430 XtSetValues (audio.durScale, args, n);
432 XtRemoveCallback(style.audioDialog, XmNmapCallback, formLayoutCB, NULL);
435 /*+++++++++++++++++++++++++++++++++++++++*/
436 /* _DtmapCB_audioDlg */
437 /*+++++++++++++++++++++++++++++++++++++++*/
441 XtPointer client_data,
442 XtPointer call_data )
445 static int first_time = 1;
452 DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));
454 if (!save.restoreFlag)
455 putDialog ((Widget)client_data, w);
461 /*get audio values for sliders*/
462 XGetKeyboardControl(style.display, &audio.values);
463 if(audio.values.bell_duration == 0)
464 audio.values.bell_duration = 1;
467 XtSetArg(args[n], XmNvalue,audio.values.bell_percent); n++;
468 XtSetValues(audio.volScale, args, n);
471 XtSetArg(args[n], XmNvalue,audio.values.bell_pitch); n++;
472 XtSetValues(audio.toneScale, args, n);
475 XtSetArg(args[n], XmNvalue,(int)audio.values.bell_duration/100); n++;
476 XtSetValues(audio.durScale, args, n);
488 XtSetArg(args[n], XmNvalue, &value); n++;
489 XtGetValues(w, args, n);
494 /*+++++++++++++++++++++++++++++++++++++++*/
496 /*+++++++++++++++++++++++++++++++++++++++*/
500 XtPointer client_data,
501 XtPointer call_data )
505 XKeyboardControl kbdControl;
508 /*set audio parameters to val returned and ring audio*/
510 kbdControlMask = KBBellPercent | KBBellPitch | KBBellDuration;
511 kbdControl.bell_percent = getValue(audio.volScale);
512 kbdControl.bell_pitch = getValue(audio.toneScale);
513 kbdControl.bell_duration = getValue(audio.durScale)*100;
514 XChangeKeyboardControl(style.display, kbdControlMask, &kbdControl);
516 XBell(style.display,0);
518 audio.systemDefaultFlag = False;
521 /*+++++++++++++++++++++++++++++++++++++++*/
522 /* systemDefaultCB */
523 /*+++++++++++++++++++++++++++++++++++++++*/
527 XtPointer client_data,
528 XtPointer call_data )
532 XKeyboardControl kbdControl;
534 XKeyboardState kbdState;
536 /*set audio parameters to val returned and ring bell*/
538 kbdControlMask = KBBellPercent | KBBellPitch | KBBellDuration;
539 kbdControl.bell_percent = -1;
540 kbdControl.bell_pitch = -1;
541 kbdControl.bell_duration = -1;
542 XChangeKeyboardControl(style.display, kbdControlMask, &kbdControl);
544 /*get audio values for sliders*/
545 XGetKeyboardControl(style.display, &kbdState);
548 XtSetArg(args[n], XmNvalue,kbdState.bell_percent); n++;
549 XtSetValues(audio.volScale, args, n);
552 XtSetArg(args[n], XmNvalue,kbdState.bell_pitch); n++;
553 XtSetValues(audio.toneScale, args, n);
556 XtSetArg(args[n], XmNvalue,(int)kbdState.bell_duration/100); n++;
557 XtSetValues(audio.durScale, args, n);
559 XBell(style.display,0);
561 audio.systemDefaultFlag = True;
564 /*+++++++++++++++++++++++++++++++++++++++*/
566 /* callback for PushButtons in DialogBox */
567 /*+++++++++++++++++++++++++++++++++++++++*/
571 XtPointer client_data,
572 XtPointer call_data )
576 XKeyboardControl kbdControl;
578 DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data;
580 switch (cb->button_position)
585 /* if sendSetting is True send message to Session manager */
587 if(style.smState.smSendSettings)
589 if(audio.systemDefaultFlag)
591 SmDefaultAudioSettings();
595 SmNewAudioSettings(getValue(audio.volScale),
596 getValue(audio.toneScale),
597 getValue(audio.durScale) * 100);
603 /* reset to incoming audio values */
607 XtSetArg(args[n], XmNvalue,audio.values.bell_percent);
608 XtSetValues(audio.volScale, args, n);
611 XtSetArg(args[n], XmNvalue,audio.values.bell_pitch);
612 XtSetValues(audio.toneScale, args, n);
615 XtSetArg(args[n], XmNvalue,(int)audio.values.bell_duration/100);
616 XtSetValues(audio.durScale, args, n);
618 kbdControlMask = KBBellPercent | KBBellPitch | KBBellDuration;
619 kbdControl.bell_percent = audio.values.bell_percent;
620 kbdControl.bell_pitch = audio.values.bell_pitch;
621 kbdControl.bell_duration = audio.values.bell_duration;
622 XChangeKeyboardControl(style.display, kbdControlMask, &kbdControl);
624 XBell(style.display,0);
628 XtCallCallbacks(style.audioDialog, XmNhelpCallback, (XtPointer)NULL);
637 /************************************************************************
640 * restore any state information saved with saveAudio.
641 * This is called from restoreSession with the application
642 * shell and the special xrm database retrieved for restore.
643 ************************************************************************/
650 XrmRepresentation rep_type;
653 xrm_name [0] = XrmStringToQuark ("audioDlg");
657 xrm_name [1] = XrmStringToQuark ("x");
658 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
659 XtSetArg (save.posArgs[save.poscnt], XmNx, atoi((char *)value.addr)); save.poscnt++;
660 save.restoreFlag = True;
664 xrm_name [1] = XrmStringToQuark ("y");
665 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
666 XtSetArg (save.posArgs[save.poscnt], XmNy, atoi((char *)value.addr)); save.poscnt++;
669 xrm_name [1] = XrmStringToQuark ("ismapped");
670 XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value);
671 /* Are we supposed to be mapped? */
672 if (strcmp(value.addr, "True") == 0)
673 popup_audioBB(shell);
676 /************************************************************************
679 * This routine will write out to the passed file descriptor any state
680 * information this dialog needs. It is called from saveSessionCB with the
681 * file already opened.
682 * All information is saved in xrm format. There is no restriction
683 * on what can be saved. It doesn't have to be defined or be part of any
684 * widget or Xt definition. Just name and save it here and recover it in
685 * restoreBackdrop. The suggested minimum is whether you are mapped, and your
687 ************************************************************************/
693 char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */
694 XmVendorShellExtObject vendorExt;
695 XmWidgetExtData extData;
697 if (style.audioDialog != NULL)
699 if (XtIsManaged(style.audioDialog))
700 sprintf(bufr, "*audioDlg.ismapped: True\n");
702 sprintf(bufr, "*audioDlg.ismapped: False\n");
704 /* Get and write out the geometry info for our Window */
705 x = XtX(XtParent(style.audioDialog));
706 y = XtY(XtParent(style.audioDialog));
708 /* Modify x & y to take into account window mgr frames
709 * This is pretty bogus, but I don't know a better way to do it.
711 extData = _XmGetWidgetExtData(style.shell, XmSHELL_EXTENSION);
712 vendorExt = (XmVendorShellExtObject)extData->widget;
713 x -= vendorExt->vendor.xOffset;
714 y -= vendorExt->vendor.yOffset;
716 sprintf(bufr, "%s*audioDlg.x: %d\n", bufr, x);
717 sprintf(bufr, "%s*audioDlg.y: %d\n", bufr, y);
718 if(-1 == write (fd, bufr, strlen(bufr))) {
719 perror(strerror(errno));