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 libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $TOG: props_pu.c /main/22 1999/05/26 09:45:49 mgreess $ */
25 * (c) Copyright 1993, 1994 Hewlett-Packard Company
26 * (c) Copyright 1993, 1994 International Business Machines Corp.
27 * (c) Copyright 1993, 1994 Novell, Inc.
28 * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
31 #include <EUSCompat.h>
34 #include <sys/param.h>
37 #include <Xm/LabelG.h>
39 #include <Xm/DialogS.h>
40 #include <Xm/PushBG.h>
41 #include <Xm/RowColumn.h>
43 #include <Xm/SeparatoG.h>
46 #include <Xm/ToggleB.h>
47 #include <Xm/ToggleBG.h>
48 #include <Xm/ComboBox.h>
49 #include <Xm/SSpinB.h>
50 #include <Dt/HourGlass.h>
51 #include <Dt/PrintOptionsP.h>
56 #include "group_editor.h"
60 #include "dayglance.h"
67 static void p_gap_clear_toggles(Props_pu *p);
68 static void p_gap_center_cat_menu(Widget, Widget);
69 static void p_create_v4_group_access_pane(Props_pu *);
70 static Boolean valid_margin_str(Props_pu *, char *);
71 static void print_option_error(Props_pu *, int, int, char *);
73 static void activate_ui(Props_pu *p, PaneType item_no);
74 static void show_ui(Props_pu *p, PaneType item_no);
76 extern void p_create_v5_group_access_pane(Props_pu *);
77 extern void v5_gap_clear_pending_change(Props_pu *p);
78 extern Dimension ComputeMaxWidth(Widget, Widget, Widget, Widget);
80 extern void _i18n_HighestWidget( int num, Widget *ret, Dimension *dim, ... );
81 extern void _i18n_HighestWidgetAdjust( int num, Widget *ret, Dimension *dim, ... );
82 extern void _i18n_WidestWidget( int num, Widget *ret, Dimension *dim, ... );
86 /*******************************************************************************
90 *******************************************************************************/
92 #define PERMISSION_LEN 6
94 static XmString Pane_XmStrs[DATE_FORMAT_PANE + 1];
96 /*******************************************************************************
98 ** Functions static to props_pu.c
100 *******************************************************************************/
105 v4_gap_pending_change(Widget w, XtPointer data, XtPointer cbs) {
106 Props_pu *p = (Props_pu *) data;
108 if (p->v4_gap_pending_message_up == False) {
109 p->v4_gap_pending_message_up = True;
110 XtSetSensitive(p->gap_add_button, True);
115 v4_gap_clear_pending_change(Props_pu *p) {
117 if (p->v4_gap_pending_message_up == True) {
118 p->v4_gap_pending_message_up = False;
119 XtSetSensitive(p->gap_add_button, False);
124 p_set_change(Props_pu *p) {
129 p->changed_flag = True;
132 XtSetSensitive(p->ok_button, True);
134 XtSetSensitive(p->apply_button, True);
135 if (p->defaults_button)
136 XtSetSensitive(p->defaults_button, True);
137 if (p->base_form_mgr)
138 XtVaSetValues(p->base_form_mgr, XmNdefaultButton, p->apply_button, NULL);
142 p_clear_change(Props_pu *p) {
144 p->changed_flag = False;
146 XtSetSensitive(p->ok_button, False);
147 XtSetSensitive(p->apply_button, False);
148 XtSetSensitive(p->defaults_button, False);
149 if (p->cal->my_cal_version >= DATAVER4) {
151 if (*(str = (char *)XmTextGetString(p->gap_user_text))=='\0') {
152 v5_gap_clear_pending_change(p);
155 if (p->v5_gap_pending_message_up == False) {
156 p->v5_gap_pending_message_up = True;
157 XtSetSensitive(p->gap2_add_button, True);
160 XtSetSensitive(p->gap2_change_button, False);
162 v4_gap_clear_pending_change(p);
164 XtSetSensitive(p->gap_remove_button, False);
165 XtVaSetValues(p->base_form_mgr, XmNdefaultButton, p->close_button, NULL);
168 p_mark_change(Widget w, XtPointer data, XtPointer cbs) {
170 Props_pu *p = (Props_pu *)data;
176 set_menu_marker(Widget menu, Props_pu *p) {
182 XtVaGetValues(menu, XmNsubMenuId, &submenu, NULL);
183 XtVaGetValues(submenu,
184 XmNchildren, &children,
185 XmNnumChildren, &num_c,
189 XtAddCallback(children[--num_c], XmNactivateCallback, p_mark_change, p);
195 p_create_editor_pane(
200 char buf[MAXNAMELEN];
201 Props *p = (Props *)c->properties;
204 Props_pu *pu = (Props_pu *)c->properties_pu;
206 Dimension max_left_label_width;
208 Dimension widest, highest;
209 Dimension _toLabel, _toText, _toMenu, _toRC;
215 ep_form_mgr = XtVaCreateWidget("ep_form_mgr",
216 xmFormWidgetClass, pu->base_form_mgr,
217 XmNautoUnmanage, False,
218 XmNtopAttachment, XmATTACH_WIDGET,
219 XmNtopWidget, pu->separator1,
220 XmNleftAttachment, XmATTACH_FORM,
221 XmNrightAttachment, XmATTACH_FORM,
224 pu->pane_list[EDITOR_PANE] = ep_form_mgr;
227 ** Default start time and duration for appointments - use DSSW widget
228 ** for start time stuff.
230 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 644,
231 "Appointment Times:"));
232 pu->ep_appt_label = XtVaCreateWidget("apptTimes",
233 xmLabelGadgetClass, ep_form_mgr,
234 XmNlabelString, xmstr,
235 XmNtopAttachment, XmATTACH_FORM,
237 XmNleftAttachment, XmATTACH_FORM,
242 build_dssw(&pu->ep_dssw, c, ep_form_mgr, False, False);
246 XtUnmanageChild(pu->ep_dssw.what_scrollwindow);
248 widgets[0] = pu->ep_dssw.start_label;
249 widgets[1] = pu->ep_dssw.start_text;
250 widgets[2] = pu->ep_dssw.start_menu;
251 widgets[3] = pu->ep_dssw.start_ampm_rc_mgr;
253 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 645,
255 pu->ep_dur_label = widgets[4] = XtVaCreateWidget("duration",
256 xmLabelGadgetClass, pu->ep_dssw.dssw_form_mgr,
257 XmNlabelString, xmstr,
262 XtSetArg(args[ac], XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX); ++ac;
263 XtSetArg(args[ac], XmNvisibleItemCount, 5); ++ac;
264 XtSetArg(args[ac], XmNpositionMode, XmONE_BASED); ++ac;
265 pu->ep_dur_cb = widgets[5] = XmCreateComboBox(pu->ep_dssw.dssw_form_mgr,
266 "ep_dur_cb", args, ac);
267 XtManageChild(pu->ep_dur_cb);
268 XtVaSetValues(pu->ep_dur_cb, XmNwidth, 75, NULL);
270 for(ac = 15; ac <= 90; ac += 15) {
272 sprintf(buf, "%d", ac);
273 xmstr = XmStringCreateLocalized(buf);
274 XmComboBoxAddItem((Widget)pu->ep_dur_cb,
280 XtVaGetValues(pu->ep_dur_cb, XmNtextField, &text_field, NULL);
281 XtAddCallback(text_field, XmNvalueChangedCallback, p_mark_change, pu);
282 XtAddCallback(pu->ep_dur_cb, XmNselectionCallback, p_mark_change, pu);
284 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 646, "Minutes"));
285 pu->ep_dur_message = widgets[6] = XtVaCreateWidget("message",
286 xmLabelGadgetClass, pu->ep_dssw.dssw_form_mgr,
287 XmNlabelString, xmstr,
294 _i18n_WidestWidget( 2, &curr, &max_left_label_width, pu->ep_dur_label,
295 pu->ep_dssw.start_label );
296 _toText = max_left_label_width + 2 * GAP;
297 _i18n_WidestWidget( 1, &curr, &widest, pu->ep_dur_label );
298 _toLabel = _toText - GAP - widest;
299 _i18n_WidestWidget( 1, &curr, &widest, pu->ep_dur_cb );
300 _toMenu = _toText + widest + GAP;
303 * pu->ep_dur_label, pu->ep_dur_cb, pu->ep_dur_message
305 _i18n_HighestWidgetAdjust( 3, &curr, &highest, pu->ep_dur_label,
306 pu->ep_dur_cb, pu->ep_dur_message );
309 XmNtopAttachment, XmATTACH_FORM,
312 XtVaSetValues( pu->ep_dur_label,
313 XmNleftAttachment, XmATTACH_FORM,
314 XmNleftOffset, _toLabel,
316 XtVaSetValues( pu->ep_dur_cb,
317 XmNleftAttachment, XmATTACH_FORM,
318 XmNleftOffset, _toText,
320 XtVaSetValues( pu->ep_dur_message,
321 XmNleftAttachment, XmATTACH_FORM,
322 XmNleftOffset, _toMenu,
327 * pu->ep_dssw.start_label, pu->ep_dssw.start_text,
328 * pu->ep_dssw.start_menu, pu->ep_dssw.start_ampm_rc_mgr
330 _i18n_WidestWidget( 1, &curr, &widest, pu->ep_dssw.start_label );
331 _toLabel = _toText - GAP - widest;
332 _i18n_WidestWidget( 1, &curr, &widest, pu->ep_dssw.start_text );
333 _toMenu = _toText + widest + GAP;
334 _i18n_WidestWidget( 1, &curr, &widest, pu->ep_dssw.start_menu );
335 _toRC = _toMenu + widest + GAP;
336 _i18n_HighestWidgetAdjust( 4, &curr, &highest, pu->ep_dssw.start_label,
337 pu->ep_dssw.start_text,
338 pu->ep_dssw.start_menu,
339 pu->ep_dssw.start_ampm_rc_mgr );
341 XmNtopAttachment, XmATTACH_WIDGET,
345 XtVaSetValues( pu->ep_dssw.start_label,
346 XmNleftAttachment, XmATTACH_FORM,
347 XmNleftOffset, _toLabel,
349 XtVaSetValues( pu->ep_dssw.start_text,
350 XmNleftAttachment, XmATTACH_FORM,
351 XmNleftOffset, _toText,
353 XtVaSetValues( pu->ep_dssw.start_menu,
354 XmNleftAttachment, XmATTACH_FORM,
355 XmNleftOffset, _toMenu,
357 XtVaSetValues( pu->ep_dssw.start_ampm_rc_mgr,
358 XmNleftAttachment, XmATTACH_FORM,
359 XmNleftOffset, _toRC,
362 XtVaSetValues(pu->ep_dssw.dssw_form_mgr,
363 XmNtopAttachment, XmATTACH_WIDGET,
364 XmNtopWidget, pu->ep_appt_label,
366 XmNrightAttachment, XmATTACH_FORM,
367 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
368 XmNleftWidget, pu->ep_appt_label,
372 XtManageChildren(widgets, 7);
375 * Reminders widget (self contained)
377 build_reminders(&pu->ep_reminders, c, ep_form_mgr);
378 XtVaSetValues(pu->ep_reminders.bfpm_form_mgr,
379 XmNtopAttachment, XmATTACH_WIDGET,
380 XmNtopWidget, pu->ep_dssw.dssw_form_mgr,
382 XmNleftAttachment, XmATTACH_FORM,
386 ** Build the stuff for privacy ...
388 xmstr = XmStringCreateLocalized(
389 catgets(c->DT_catd, 1, 390, "Privacy:"));
390 pu->privacy_label = XtVaCreateWidget("privacy",
391 xmLabelGadgetClass, pu->ep_reminders.bfpm_form_mgr,
392 XmNlabelString, xmstr,
396 pu->privacy_menu = create_privacy_menu(pu->ep_reminders.bfpm_form_mgr);
397 XtVaSetValues(pu->privacy_menu,
400 ManageChildren(pu->ep_reminders.bfpm_form_mgr);
405 _i18n_WidestWidget( 1, &prev, &widest, pu->privacy_label );
406 _i18n_HighestWidget( 2, &prev, &highest, pu->ep_reminders.mailto_label,
407 pu->ep_reminders.mailto_text );
408 _i18n_HighestWidgetAdjust( 2, &curr, &highest,
409 pu->privacy_label, pu->privacy_menu );
411 XmNtopAttachment, XmATTACH_WIDGET,
414 XmNbottomAttachment, XmATTACH_FORM,
417 XtVaSetValues( pu->privacy_label,
418 XmNleftAttachment, XmATTACH_FORM,
419 XmNleftOffset, 15, /* See reminders.c l. 783 */
421 XtVaSetValues( pu->privacy_menu,
422 XmNleftAttachment, XmATTACH_FORM,
423 XmNleftOffset, 15 + widest + 5,
426 XtAddCallback(pu->privacy_menu, XmNselectionCallback, p_mark_change, pu);
428 XtAddCallback(pu->ep_dssw.start_text, XmNvalueChangedCallback, p_mark_change, pu);
429 XtAddCallback(pu->ep_dssw.start_am, XmNvalueChangedCallback, p_mark_change, pu);
430 XtAddCallback(pu->ep_dssw.start_pm, XmNvalueChangedCallback, p_mark_change, pu);
431 XtAddCallback(pu->ep_reminders.beep_text, XmNvalueChangedCallback, p_mark_change, pu);
432 XtAddCallback(pu->ep_reminders.beep_toggle, XmNvalueChangedCallback, p_mark_change, pu);
434 set_menu_marker(pu->ep_reminders.beep_menu, pu);
435 XtAddCallback(pu->ep_reminders.flash_text,
436 XmNvalueChangedCallback, p_mark_change, pu);
437 XtAddCallback(pu->ep_reminders.flash_toggle,
438 XmNvalueChangedCallback, p_mark_change, pu);
439 set_menu_marker(pu->ep_reminders.flash_menu, pu);
440 XtAddCallback(pu->ep_reminders.mail_text,
441 XmNvalueChangedCallback, p_mark_change, pu);
442 XtAddCallback(pu->ep_reminders.mail_toggle,
443 XmNvalueChangedCallback, p_mark_change, pu);
444 set_menu_marker(pu->ep_reminders.mail_menu, pu);
445 XtAddCallback(pu->ep_reminders.mailto_text,
446 XmNvalueChangedCallback, p_mark_change, pu);
447 XtAddCallback(pu->ep_reminders.popup_text,
448 XmNvalueChangedCallback, p_mark_change, pu);
449 XtAddCallback(pu->ep_reminders.popup_toggle,
450 XmNvalueChangedCallback, p_mark_change, pu);
451 set_menu_marker(pu->ep_reminders.popup_menu, pu);
453 ManageChildren(ep_form_mgr);
457 format_hour(char buffer[], int hour, DisplayType dt, Calendar *c)
461 if ((hour == 24) || (hour == 0))
462 cm_strcpy(buffer, catgets(c->DT_catd, 1, 758,"midnight"));
464 sprintf(buffer, "%2d:00 %s", hour-12,
465 catgets(c->DT_catd, 1, 3, "pm"));
467 sprintf(buffer, "%2d:00 %s", hour,
468 catgets(c->DT_catd, 1, 4, "am"));
471 sprintf(buffer, " %02d00", hour);
475 set_scale_value(Widget w, int val, Props_pu *p)
478 char label_buffer[50];
480 Calendar *c = p->cal;
481 Props *props = (Props *) c->properties;
483 format_hour(label_buffer, val, (DisplayType) get_int_prop(props, CP_DEFAULTDISP), c);
485 xmstr = XmStringCreateLocalized(label_buffer);
488 XmNlabelString, xmstr,
496 print_it(Widget w, XtPointer data, XtPointer cbs) {
498 Props_pu *p = (Props_pu *)data;
499 XmScaleCallbackStruct *scbs = (XmScaleCallbackStruct *)cbs;
503 ** Functions related to the display pane
506 p_dp_scale_mod_proc(Widget w, XtPointer data, XtPointer cbs) {
508 Props_pu *p = (Props_pu *)data;
509 XmScaleCallbackStruct *scbs = (XmScaleCallbackStruct *)cbs;
514 if (w == p->dp_beg_scale) {
515 XmScaleGetValue(p->dp_end_scale, &val);
516 if (val < scbs->value)
518 XmScaleSetValue(p->dp_end_scale, scbs->value + 1);
519 set_scale_value(p->dp_end_value, scbs->value + 1, p);
521 set_scale_value(p->dp_beg_value, scbs->value, p);
525 XmScaleGetValue(p->dp_beg_scale, &val);
526 if (val > scbs->value)
528 XmScaleSetValue(p->dp_beg_scale, scbs->value - 1);
529 set_scale_value(p->dp_beg_value, scbs->value - 1, p);
531 set_scale_value(p->dp_end_value, scbs->value, p);
539 p_create_display_pane(Props_pu *p) {
540 Calendar *c = calendar;
544 Dimension widest, highest;
546 Dimension _to1st, _to2nd, _to3rd;
551 dp_form_mgr = XtVaCreateWidget("dp_form_mgr",
552 xmFormWidgetClass, p->base_form_mgr,
553 XmNautoUnmanage, False,
554 XmNtopAttachment, XmATTACH_WIDGET,
555 XmNtopWidget, p->separator1,
556 XmNleftAttachment, XmATTACH_FORM,
557 XmNrightAttachment, XmATTACH_FORM,
558 XmNbottomAttachment, XmATTACH_WIDGET,
560 XmNbottomWidget, p->separator2,
562 p->pane_list[DISPLAY_PANE] = dp_form_mgr;
565 ** User Calendar Location label and text field
567 xmstr = XmStringCreateLocalized(
568 catgets(c->DT_catd, 1, 391, "User Calendar Location:"));
569 p->dp_loc_label = XtVaCreateWidget("location",
570 xmLabelGadgetClass, dp_form_mgr,
571 XmNlabelString, xmstr,
575 p->dp_loc_text = XtVaCreateWidget("dp_loc_text",
576 xmTextWidgetClass, dp_form_mgr,
579 XtAddCallback(p->dp_loc_text,
580 XmNvalueChangedCallback, p_mark_change, p);
583 ** Day Boundaries label and beginning/ending sliders
586 /* There is some additional, very odd layout stuff that
587 happens elsewhere. This is because sliders do not align
588 well with text widgets at all. We want to align the
589 centers of the text and slider widgets. This is done by
590 finding the relative heights of the widgets, and using half
591 the differenmce as a bottom offset. Why don't you see that
592 below? Well, it's because the stupid toolkit reports the
593 height of a slider as 0 unless that slider is mapped. Thus,
594 this bit of alignment cannot happen until the panel with these
595 items is mapped. Pretty stupid. Thus the positioning happens
596 just after the panel is mapped. */
597 xmstr = XmStringCreateLocalized(
598 catgets(c->DT_catd, 1, 392, "Day Boundaries:"));
599 p->dp_day_label = XtVaCreateWidget("dayBoundaries",
600 xmLabelGadgetClass, dp_form_mgr,
601 XmNlabelString, xmstr,
605 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 393, "Begin:"));
606 p->dp_beg_label = XtVaCreateWidget("begin",
607 xmLabelGadgetClass, dp_form_mgr,
608 XmNlabelString, xmstr,
612 p->dp_beg_scale = XtVaCreateWidget("dp_beg_scale",
613 xmScaleWidgetClass, dp_form_mgr,
614 XmNorientation, XmHORIZONTAL,
620 XtAddCallback(p->dp_beg_scale, XmNvalueChangedCallback,
621 p_dp_scale_mod_proc, p);
622 XtAddCallback(p->dp_beg_scale, XmNdragCallback,
623 p_dp_scale_mod_proc, p);
625 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 759, "value"));
626 p->dp_beg_value = XtVaCreateWidget("begin",
627 xmLabelGadgetClass, dp_form_mgr,
628 XmNlabelString, xmstr,
632 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 394, "End:"));
633 p->dp_end_label = XtVaCreateWidget("end",
634 xmLabelGadgetClass, dp_form_mgr,
635 XmNlabelString, xmstr,
639 p->dp_end_scale = XtVaCreateWidget("dp_end_scale",
640 xmScaleWidgetClass, dp_form_mgr,
641 XmNorientation, XmHORIZONTAL,
647 XtAddCallback(p->dp_end_scale, XmNvalueChangedCallback,
648 p_dp_scale_mod_proc, p);
649 XtAddCallback(p->dp_end_scale, XmNdragCallback,
650 p_dp_scale_mod_proc, p);
652 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 760, "value"));
653 p->dp_end_value = XtVaCreateWidget("begin",
654 xmLabelGadgetClass, dp_form_mgr,
655 XmNlabelString, xmstr,
660 ** 12/24 Hour Display label and toggle buttons
662 xmstr = XmStringCreateLocalized(
663 catgets(c->DT_catd, 1, 395, "Hour Display:"));
664 p->dp_hour_label = XtVaCreateWidget("hourDisplay",
665 xmLabelGadgetClass, dp_form_mgr,
666 XmNlabelString, xmstr,
670 p->dp_hour_rc_mgr = XtVaCreateWidget("dp_hour_rc_mgr",
671 xmRowColumnWidgetClass, dp_form_mgr,
672 XmNpacking, XmPACK_COLUMN,
673 XmNorientation, XmHORIZONTAL,
674 XmNradioBehavior, True,
675 XmNisHomogeneous, True,
676 XmNentryClass, xmToggleButtonGadgetClass,
679 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 396, "12 Hour"));
680 p->dp_hour12_toggle = widgets[0] = XtVaCreateWidget("twelveHour",
681 xmToggleButtonGadgetClass, p->dp_hour_rc_mgr,
682 XmNlabelString, xmstr,
686 XtAddCallback(p->dp_hour12_toggle,
687 XmNvalueChangedCallback, p_mark_change, p);
689 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 397, "24 Hour"));
690 p->dp_hour24_toggle = widgets[1] = XtVaCreateWidget("twentyFourHour",
691 xmToggleButtonGadgetClass, p->dp_hour_rc_mgr,
692 XmNlabelString, xmstr,
696 XtAddCallback(p->dp_hour24_toggle,
697 XmNvalueChangedCallback, p_mark_change, p);
699 XtManageChildren(widgets, 2);
702 ** Default view label and toggle buttons
704 xmstr = XmStringCreateLocalized(
705 catgets(c->DT_catd, 1, 398, "Default View:"));
706 p->dp_view_label = XtVaCreateWidget("defaultView:",
707 xmLabelGadgetClass, dp_form_mgr,
708 XmNlabelString, xmstr,
712 p->dp_view_rc_mgr = XtVaCreateWidget("dp_view_rc_mgr",
713 xmRowColumnWidgetClass, dp_form_mgr,
714 XmNpacking, XmPACK_COLUMN,
715 XmNorientation, XmHORIZONTAL,
716 XmNradioBehavior, True,
717 XmNisHomogeneous, True,
718 XmNentryClass, xmToggleButtonGadgetClass,
722 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 402, "Day"));
723 p->dp_view_day_toggle = XtVaCreateWidget("day",
724 xmToggleButtonGadgetClass, p->dp_view_rc_mgr,
725 XmNlabelString, xmstr,
729 XtAddCallback(p->dp_view_day_toggle,
730 XmNvalueChangedCallback, p_mark_change, p);
732 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 401, "Week"));
733 p->dp_view_week_toggle = XtVaCreateWidget("week",
734 xmToggleButtonGadgetClass, p->dp_view_rc_mgr,
735 XmNlabelString, xmstr,
739 XtAddCallback(p->dp_view_week_toggle,
740 XmNvalueChangedCallback, p_mark_change, p);
742 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 400, "Month"));
743 p->dp_view_month_toggle = XtVaCreateWidget("month",
744 xmToggleButtonGadgetClass, p->dp_view_rc_mgr,
745 XmNlabelString, xmstr,
749 XtAddCallback(p->dp_view_month_toggle,
750 XmNvalueChangedCallback, p_mark_change, p);
752 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 399, "Year"));
753 p->dp_view_year_toggle = XtVaCreateWidget("year",
754 xmToggleButtonGadgetClass, p->dp_view_rc_mgr,
755 XmNlabelString, xmstr,
759 XtAddCallback(p->dp_view_year_toggle,
760 XmNvalueChangedCallback, p_mark_change, p);
762 ManageChildren(p->dp_view_rc_mgr);
765 ** Initial Calendar View label and text field
767 xmstr = XmStringCreateLocalized(
768 catgets(c->DT_catd, 1, 403, "Initial Calendar View:"));
769 p->dp_init_view_label = XtVaCreateWidget("initialView",
770 xmLabelGadgetClass, dp_form_mgr,
771 XmNlabelString, xmstr,
775 p->dp_init_view_text = XtVaCreateWidget("dp_init_view_text",
776 xmTextWidgetClass, dp_form_mgr,
779 XtAddCallback(p->dp_init_view_text,
780 XmNvalueChangedCallback, p_mark_change, p);
785 _i18n_WidestWidget( 7, &curr, &widest, p->dp_loc_label,
786 p->dp_day_label, p->dp_beg_label,
787 p->dp_end_label, p->dp_hour_label,
788 p->dp_view_label, p->dp_init_view_label );
789 _to2nd = 5 + widest + 10;
792 * p->dp_loc_label, p->dp_loc_text
794 _i18n_WidestWidget( 1, &curr, &widest, p->dp_loc_label );
795 _to1st = _to2nd - 10 - widest;
796 _i18n_HighestWidgetAdjust( 2, &curr, &highest, p->dp_loc_label,
799 XmNtopAttachment, XmATTACH_FORM,
802 XtVaSetValues( p->dp_loc_label,
803 XmNleftAttachment, XmATTACH_FORM,
804 XmNleftOffset, _to1st,
806 XtVaSetValues( p->dp_loc_text,
807 XmNleftAttachment, XmATTACH_FORM,
808 XmNleftOffset, _to2nd,
815 _i18n_WidestWidget( 1, &curr, &widest, p->dp_day_label );
816 _to1st = _to2nd - 10 - widest;
817 XtVaSetValues( p->dp_day_label,
818 XmNtopAttachment, XmATTACH_WIDGET,
822 XtVaSetValues( p->dp_day_label,
823 XmNleftAttachment, XmATTACH_FORM,
824 XmNleftOffset, _to1st,
826 prev = p->dp_day_label;
829 * p->dp_beg_label, p->dp_beg_scale, p->dp_beg_value
831 _i18n_WidestWidget( 1, &curr, &widest, p->dp_beg_label );
832 _to1st = _to2nd - 10 - widest;
833 _i18n_WidestWidget( 1, &curr, &widest, p->dp_beg_scale );
834 _to3rd = _to2nd + widest + 5;
835 _i18n_HighestWidgetAdjust( 3, &curr, &highest, p->dp_beg_label,
836 p->dp_beg_scale, p->dp_beg_value );
838 XmNtopAttachment, XmATTACH_WIDGET,
842 XtVaSetValues( p->dp_beg_label,
843 XmNleftAttachment, XmATTACH_FORM,
844 XmNleftOffset, _to1st,
846 XtVaSetValues( p->dp_beg_scale,
847 XmNleftAttachment, XmATTACH_FORM,
848 XmNleftOffset, _to2nd,
850 XtVaSetValues( p->dp_beg_value,
851 XmNleftAttachment, XmATTACH_FORM,
852 XmNleftOffset, _to3rd,
857 * p->dp_end_label, p->dp_end_scale, p->dp_end_value
859 _i18n_WidestWidget( 1, &curr, &widest, p->dp_end_label );
860 _to1st = _to2nd - 10 - widest;
861 _i18n_WidestWidget( 1, &curr, &widest, p->dp_end_scale );
862 _to3rd = _to2nd + widest + 5;
863 _i18n_HighestWidgetAdjust( 3, &curr, &highest, p->dp_end_label,
864 p->dp_end_scale, p->dp_end_value );
866 XmNtopAttachment, XmATTACH_WIDGET,
870 XtVaSetValues( p->dp_end_label,
871 XmNleftAttachment, XmATTACH_FORM,
872 XmNleftOffset, _to1st,
874 XtVaSetValues( p->dp_end_scale,
875 XmNleftAttachment, XmATTACH_FORM,
876 XmNleftOffset, _to2nd,
878 XtVaSetValues( p->dp_end_value,
879 XmNleftAttachment, XmATTACH_FORM,
880 XmNleftOffset, _to3rd,
885 * p->dp_hour_label, p->dp_hour_rc_mgr
887 _i18n_WidestWidget( 1, &curr, &widest, p->dp_hour_label );
888 _to1st = _to2nd - 10 - widest;
889 _i18n_HighestWidgetAdjust( 2, &curr, &highest, p->dp_hour_label,
892 XmNtopAttachment, XmATTACH_WIDGET,
896 XtVaSetValues( p->dp_hour_label,
897 XmNleftAttachment, XmATTACH_FORM,
898 XmNleftOffset, _to1st,
900 XtVaSetValues( p->dp_hour_rc_mgr,
901 XmNleftAttachment, XmATTACH_FORM,
902 XmNleftOffset, _to2nd,
907 * p->dp_view_label, p->dp_view_rc_mgr
909 _i18n_WidestWidget( 1, &curr, &widest, p->dp_view_label );
910 _to1st = _to2nd - 10 - widest;
911 _i18n_HighestWidgetAdjust( 2, &curr, &highest, p->dp_view_label,
914 XmNtopAttachment, XmATTACH_WIDGET,
918 XtVaSetValues( p->dp_view_label,
919 XmNleftAttachment, XmATTACH_FORM,
920 XmNleftOffset, _to1st,
922 XtVaSetValues( p->dp_view_rc_mgr,
923 XmNleftAttachment, XmATTACH_FORM,
924 XmNleftOffset, _to2nd,
929 * p->dp_init_view_label, p->dp_init_view_text
931 _i18n_WidestWidget( 1, &curr, &widest, p->dp_init_view_label );
932 _to1st = _to2nd - 10 - widest;
933 _i18n_HighestWidgetAdjust( 2, &curr, &highest, p->dp_init_view_label,
934 p->dp_init_view_text );
936 XmNtopAttachment, XmATTACH_WIDGET,
940 XtVaSetValues( p->dp_init_view_label,
941 XmNleftAttachment, XmATTACH_FORM,
942 XmNleftOffset, _to1st,
944 XtVaSetValues( p->dp_init_view_text,
945 XmNleftAttachment, XmATTACH_FORM,
946 XmNleftOffset, _to2nd,
951 ManageChildren(dp_form_mgr);
955 p_gap_convert_permissions(
958 Calendar *c = calendar;
959 unsigned int perm_val = 0;
962 * V5DEP: If this is a V5 server w/V1 backing store probably should use
965 if (p->cal->my_cal_version >= DATAVER4) {
966 if (XmToggleButtonGadgetGetState(p->gap2_public_tog[GAP_VIEW]))
967 perm_val |= CSA_VIEW_PUBLIC_ENTRIES;
968 if (XmToggleButtonGadgetGetState(
969 p->gap2_public_tog[GAP_INSERT]))
970 perm_val |= CSA_INSERT_PUBLIC_ENTRIES;
971 if (XmToggleButtonGadgetGetState(
972 p->gap2_public_tog[GAP_CHANGE]))
973 perm_val |= CSA_CHANGE_PUBLIC_ENTRIES;
974 if (XmToggleButtonGadgetGetState(
975 p->gap2_semi_tog[GAP_VIEW]))
976 perm_val |= CSA_VIEW_CONFIDENTIAL_ENTRIES;
977 if (XmToggleButtonGadgetGetState(
978 p->gap2_semi_tog[GAP_INSERT]))
979 perm_val |= CSA_INSERT_CONFIDENTIAL_ENTRIES;
980 if (XmToggleButtonGadgetGetState(
981 p->gap2_semi_tog[GAP_CHANGE]))
982 perm_val |= CSA_CHANGE_CONFIDENTIAL_ENTRIES;
983 if (XmToggleButtonGadgetGetState(
984 p->gap2_private_tog[GAP_VIEW]))
985 perm_val |= CSA_VIEW_PRIVATE_ENTRIES;
986 if (XmToggleButtonGadgetGetState(
987 p->gap2_private_tog[GAP_INSERT]))
988 perm_val |= CSA_INSERT_PRIVATE_ENTRIES;
989 if (XmToggleButtonGadgetGetState(
990 p->gap2_private_tog[GAP_CHANGE]))
991 perm_val |= CSA_CHANGE_PRIVATE_ENTRIES;
993 perm_val |= CSA_ORGANIZER_RIGHTS;
995 if (XmToggleButtonGadgetGetState(p->gap_browse_toggle))
996 perm_val |= CSA_X_DT_BROWSE_ACCESS;
997 if (XmToggleButtonGadgetGetState(p->gap_insert_toggle))
998 perm_val |= CSA_X_DT_INSERT_ACCESS;
999 if (XmToggleButtonGadgetGetState(p->gap_delete_toggle))
1000 perm_val |= CSA_X_DT_DELETE_ACCESS;
1003 if (perm_val == 0) {
1004 char *title = XtNewString(catgets(c->DT_catd, 1, 750,
1005 "Calendar : Error - Access List and Permissions"));
1006 char *text = XtNewString(catgets(c->DT_catd, 1, 405,
1007 "Please select at least one permission. "));
1008 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95,
1010 dialog_popup(p->frame,
1011 DIALOG_TITLE, title,
1013 BUTTON_IDENT, 1, ident1,
1014 BUTTON_HELP, ACCESS_RIGHTS_ERROR_HELP,
1015 DIALOG_IMAGE, p->xm_error_pixmap,
1026 p_gap_create_perm_str(CSA_flags perm_val) {
1028 char c_value[PERMISSION_LEN + 1];
1030 if (perm_val & CSA_X_DT_BROWSE_ACCESS) {
1034 if (perm_val & CSA_X_DT_INSERT_ACCESS) {
1038 if (perm_val & CSA_X_DT_DELETE_ACCESS) {
1043 return cm_strdup(c_value);
1047 p_gap_create_entry_string(Props_pu *p, char *who, char *p_str, XmString *val) {
1050 buf = (char *)ckalloc(NAME_LEN + PERMISSION_LEN + 1);
1051 sprintf(buf, "%-*s%s", NAME_LEN, who, p_str);
1052 *val = XmStringCreateLocalized(buf);
1057 p_gap_add_proc(Widget w, XtPointer client_data, XtPointer callback_struct) {
1058 int *item_list = NULL, item_cnt = 0;
1061 Props_pu *p = (Props_pu *)client_data;
1063 CSA_access_list step = p->gap_list, last = NULL, new_e;
1066 ** First, get the necessary strings from the UI
1068 if (!(pt = p_gap_convert_permissions(p)))
1070 p_str = p_gap_create_perm_str(pt);
1071 who = (char *)XmTextGetString(p->gap_user_text);
1072 p_gap_create_entry_string(p, who, p_str, &xmstr);
1076 ** Either add or change the item on the UI and to the Access_Entry
1079 new_e = (CSA_access_list)ckalloc(sizeof(CSA_access_rights));
1080 new_e->user = (CSA_calendar_user *)ckalloc(sizeof(CSA_calendar_user));
1081 new_e->user->user_name = cm_strdup(who);
1086 if (XmListGetSelectedPos(p->gap_access_list, &item_list, &item_cnt)) {
1088 ** We're changing the value, find the item in the linked list
1091 while(item_cnt < *item_list) {
1099 p->gap_list = new_e;
1101 new_e->next = step->next;
1105 XmListReplaceItemsPos(p->gap_access_list, &xmstr, 1, *item_list);
1106 XtFree((XtPointer)item_list);
1109 ** Add the Access_Entry item to the end of the list
1112 p->gap_list = new_e;
1118 XmListAddItem(p->gap_access_list, xmstr, 0);
1120 XmStringFree(xmstr);
1125 p_gap_remove_proc(Widget w, XtPointer client_data, XtPointer callback_struct) {
1126 Calendar *c = calendar;
1127 int *item_list = NULL, item_cnt = 0;
1128 Props_pu *p = (Props_pu *)client_data;
1129 CSA_access_list step = p->gap_list, last = NULL;
1131 if (XmListGetSelectedPos(p->gap_access_list, &item_list, &item_cnt)) {
1133 ** Find and delete the Access_Entry from the list
1136 while(item_cnt < *item_list) {
1142 last->next = step->next;
1144 p->gap_list = step->next;
1149 XmListDeleteItemsPos(p->gap_access_list, 1, *item_list);
1150 XmTextSetString(p->gap_user_text, "\0");
1151 p_gap_clear_toggles(p);
1153 if (p->cal->my_cal_version >= DATAVER4) {
1154 v5_gap_clear_pending_change(p);
1155 XtSetSensitive(p->gap2_change_button, False);
1156 XtSetSensitive(p->gap_remove_button, False);
1158 v4_gap_clear_pending_change(p);
1159 XtFree((XtPointer)item_list);
1162 char *title = XtNewString(catgets(c->DT_catd, 1, 750, "Calendar : Error - Access List and Permissions"));
1163 char *text = XtNewString(catgets(c->DT_catd, 1, 408, "Please select a name first. "));
1164 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
1165 dialog_popup(p->frame,
1166 DIALOG_TITLE, title,
1168 BUTTON_IDENT, 1, ident1,
1169 DIALOG_IMAGE, p->xm_error_pixmap,
1178 gap_list_select_proc(Widget w, XtPointer client_data, XtPointer data) {
1179 int *item_list = NULL, item_cnt = 0;
1180 Props_pu *p = (Props_pu *)client_data;
1181 CSA_access_list step = p->gap_list;
1183 if (!XmListGetSelectedPos(p->gap_access_list, &item_list, &item_cnt))
1186 if (item_cnt <= 0) {
1187 if (p->cal->my_cal_version >= DATAVER4)
1188 XtSetSensitive(p->gap2_change_button, False);
1189 XtSetSensitive(p->gap_remove_button, False);
1191 if (p->cal->my_cal_version >= DATAVER4)
1192 XtSetSensitive(p->gap2_change_button, True);
1193 XtSetSensitive(p->gap_remove_button, True);
1197 while(step && item_cnt < *item_list) {
1201 XmTextSetString(p->gap_user_text, step->user->user_name);
1204 * V5DEP: If this is a V5 server w/V1 backing store probably
1205 * should use old access flags.
1207 if (p->cal->my_cal_version >= DATAVER4) {
1208 XmToggleButtonGadgetSetState(p->gap2_public_tog[GAP_VIEW],
1209 (step->rights & CSA_VIEW_PUBLIC_ENTRIES) ? True : False,
1211 XmToggleButtonGadgetSetState(p->gap2_public_tog[GAP_INSERT],
1212 (step->rights & CSA_INSERT_PUBLIC_ENTRIES) ?
1213 True : False, True);
1214 XmToggleButtonGadgetSetState(p->gap2_public_tog[GAP_CHANGE],
1215 (step->rights & CSA_CHANGE_PUBLIC_ENTRIES) ?
1216 True : False, True);
1217 XmToggleButtonGadgetSetState(p->gap2_semi_tog[GAP_VIEW],
1218 (step->rights & CSA_VIEW_CONFIDENTIAL_ENTRIES) ?
1219 True : False, True);
1220 XmToggleButtonGadgetSetState(p->gap2_semi_tog[GAP_INSERT],
1221 (step->rights & CSA_INSERT_CONFIDENTIAL_ENTRIES) ?
1222 True : False, True);
1223 XmToggleButtonGadgetSetState(p->gap2_semi_tog[GAP_CHANGE],
1224 (step->rights & CSA_CHANGE_CONFIDENTIAL_ENTRIES) ?
1225 True : False, True);
1226 XmToggleButtonGadgetSetState(p->gap2_private_tog[GAP_VIEW],
1227 (step->rights & CSA_VIEW_PRIVATE_ENTRIES) ?
1228 True : False, True);
1229 XmToggleButtonGadgetSetState(p->gap2_private_tog[GAP_INSERT],
1230 (step->rights & CSA_INSERT_PRIVATE_ENTRIES) ?
1231 True : False, True);
1232 XmToggleButtonGadgetSetState(p->gap2_private_tog[GAP_CHANGE],
1233 (step->rights & CSA_CHANGE_PRIVATE_ENTRIES) ?
1234 True : False, True);
1236 XmToggleButtonGadgetSetState(p->gap_browse_toggle,
1237 (step->rights & CSA_X_DT_BROWSE_ACCESS) ? True : False,
1239 XmToggleButtonGadgetSetState(p->gap_insert_toggle,
1240 (step->rights & CSA_X_DT_INSERT_ACCESS) ? True : False,
1242 XmToggleButtonGadgetSetState(p->gap_delete_toggle,
1243 (step->rights & CSA_X_DT_DELETE_ACCESS) ? True : False,
1247 XtFree((XtPointer)item_list);
1253 p_create_v4_group_access_pane(Props_pu *p) {
1254 Calendar *c = calendar;
1256 Widget gap_form_mgr;
1258 Dimension widest, highest, dmy;
1265 gap_form_mgr = XtVaCreateWidget("gap_form_mgr",
1266 xmFormWidgetClass, p->base_form_mgr,
1267 XmNautoUnmanage, False,
1268 XmNtopAttachment, XmATTACH_WIDGET,
1269 XmNtopWidget, p->separator1,
1270 XmNleftAttachment, XmATTACH_FORM,
1271 XmNrightAttachment, XmATTACH_FORM,
1272 XmNbottomAttachment, XmATTACH_WIDGET,
1273 XmNbottomOffset, 10,
1274 XmNbottomWidget, p->separator2,
1276 p->pane_list[GROUP_ACCESS_PANE] = gap_form_mgr;
1279 ** User Name label, text field, and add button
1281 xmstr = XmStringCreateLocalized(
1282 catgets(c->DT_catd, 1, 410, "User Name:"));
1283 p->gap_user_label = XtVaCreateWidget("userName",
1284 xmLabelGadgetClass, gap_form_mgr,
1285 XmNlabelString, xmstr,
1287 XmStringFree(xmstr);
1289 p->gap_user_text = XtVaCreateWidget("gap_user_text",
1290 xmTextWidgetClass, gap_form_mgr,
1293 XtAddCallback(p->gap_user_text,
1294 XmNvalueChangedCallback, v4_gap_pending_change,
1297 xmstr = XmStringCreateLocalized(
1298 catgets(c->DT_catd, 1, 411, "Add Name"));
1299 p->gap_add_button = XtVaCreateWidget("addName",
1300 xmPushButtonGadgetClass, gap_form_mgr,
1301 XmNlabelString, xmstr,
1302 XmNnavigationType, XmTAB_GROUP,
1303 XmNsensitive, False,
1305 XmStringFree(xmstr);
1306 XtAddCallback(p->gap_add_button,
1307 XmNactivateCallback, p_gap_add_proc, p);
1310 ** Access list stuff and remove button
1313 char *user = XtNewString(catgets(c->DT_catd, 1, 983, "User Name"));
1314 char *perm = XtNewString(catgets(c->DT_catd, 1, 413, "Permissions"));
1315 buf = (char *)ckalloc(cm_strlen(user) + cm_strlen(perm) + 10);
1316 sprintf(buf, "%-*s%s", NAME_LEN, user, perm);
1317 xmstr = XmStringCreateLocalized(buf);
1322 p->gap_access_header = XtVaCreateManagedWidget("gap_access_header",
1323 xmLabelGadgetClass, gap_form_mgr,
1324 XmNlabelString, xmstr,
1326 XmStringFree(xmstr);
1330 p->gap_access_list = (Widget)XmCreateScrolledList(gap_form_mgr,
1331 "gap_access_list", NULL, 0);
1332 p->gap_access_list_sw = XtParent(p->gap_access_list);
1333 XtVaSetValues(p->gap_access_list_sw,
1335 XtVaSetValues(p->gap_access_list,
1336 XmNvisibleItemCount, 10,
1337 XmNdoubleClickInterval, 5,
1339 XtAddCallback(p->gap_access_list,
1340 XmNbrowseSelectionCallback, gap_list_select_proc, p);
1341 XtManageChild(p->gap_access_list);
1343 xmstr = XmStringCreateLocalized(
1344 catgets(c->DT_catd, 1, 414, "Remove Name"));
1345 p->gap_remove_button = XtVaCreateWidget("removeName",
1346 xmPushButtonGadgetClass, gap_form_mgr,
1347 XmNlabelString, xmstr,
1348 XmNnavigationType, XmTAB_GROUP,
1349 XmNsensitive, False,
1351 XmStringFree(xmstr);
1352 XtAddCallback(p->gap_remove_button,
1353 XmNactivateCallback, p_gap_remove_proc, p);
1355 xmstr = XmStringCreateLocalized(
1356 catgets(c->DT_catd, 1, 415, "B = Browse I = Insert D = Delete"));
1357 p->gap_access_msg = XtVaCreateWidget("browseInsertDelete",
1358 xmLabelGadgetClass, gap_form_mgr,
1359 XmNlabelString, xmstr,
1361 XmStringFree(xmstr);
1364 ** Finally, permissions label and choice toggle list
1366 xmstr = XmStringCreateLocalized(
1367 catgets(c->DT_catd, 1, 416, "Permissions:"));
1368 p->gap_perm_label = XtVaCreateWidget("permissions",
1369 xmLabelGadgetClass, gap_form_mgr,
1370 XmNlabelString, xmstr,
1372 XmStringFree(xmstr);
1374 p->gap_perm_rc_mgr = XtVaCreateWidget("gap_perm_rc_mgr",
1375 xmRowColumnWidgetClass, gap_form_mgr,
1376 XmNpacking, XmPACK_COLUMN,
1377 XmNorientation, XmHORIZONTAL,
1378 XmNradioBehavior, False,
1379 XmNisHomogeneous, True,
1380 XmNindicatorType, XmN_OF_MANY,
1381 XmNentryClass, xmToggleButtonGadgetClass,
1384 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 417, "Browse"));
1385 p->gap_browse_toggle = XtVaCreateWidget("browse",
1386 xmToggleButtonGadgetClass, p->gap_perm_rc_mgr,
1387 XmNlabelString, xmstr,
1389 XmStringFree(xmstr);
1391 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 342, "Insert"));
1392 p->gap_insert_toggle = XtVaCreateWidget("insert",
1393 xmToggleButtonGadgetClass, p->gap_perm_rc_mgr,
1394 XmNlabelString, xmstr,
1396 XmStringFree(xmstr);
1398 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 419, "Delete"));
1399 p->gap_delete_toggle = XtVaCreateWidget("delete",
1400 xmToggleButtonGadgetClass, p->gap_perm_rc_mgr,
1401 XmNlabelString, xmstr,
1403 XmStringFree(xmstr);
1410 * p->gap_user_label, p->gap_user_text, p->gap_add_button
1412 _i18n_HighestWidgetAdjust( 3, &curr, &highest, p->gap_user_label,
1413 p->gap_user_text, p->gap_add_button );
1414 XtVaSetValues( curr,
1415 XmNtopAttachment, XmATTACH_FORM,
1419 XtVaSetValues( p->gap_user_label,
1420 XmNleftAttachment, XmATTACH_FORM,
1423 _i18n_WidestWidget( 1, &curr, &widest, p->gap_user_label );
1424 XtVaSetValues( p->gap_user_text,
1425 XmNleftAttachment, XmATTACH_FORM,
1426 XmNleftOffset, 5 + widest + 10,
1428 _i18n_WidestWidget( 1, &curr, &dmy, p->gap_user_text );
1429 _toEdge = 5 + widest + 10 + dmy;
1430 XtVaSetValues( p->gap_add_button,
1431 XmNleftAttachment, XmATTACH_FORM,
1432 XmNleftOffset, _toEdge + 10,
1436 * p->gap_access_header
1438 XtVaSetValues( p->gap_access_header,
1439 XmNleftAttachment, XmATTACH_FORM,
1441 XmNtopAttachment, XmATTACH_WIDGET,
1445 prev = p->gap_access_header;
1448 * p->gap_access_list_sw, p->gap_remove_button
1450 _i18n_HighestWidget( 2, &curr, &highest, p->gap_access_list_sw,
1451 p->gap_remove_button );
1452 XtVaSetValues( p->gap_access_list_sw,
1453 XmNleftAttachment, XmATTACH_FORM,
1455 XmNrightAttachment, XmATTACH_OPPOSITE_FORM,
1456 XmNrightOffset, -1 * _toEdge,
1457 XmNtopAttachment, XmATTACH_WIDGET,
1461 XtVaSetValues( p->gap_remove_button,
1462 XmNleftAttachment, XmATTACH_FORM,
1463 XmNleftOffset, _toEdge + 10,
1464 XmNtopAttachment, XmATTACH_WIDGET,
1473 XtVaSetValues( p->gap_access_msg,
1474 XmNleftAttachment, XmATTACH_FORM,
1476 XmNtopAttachment, XmATTACH_WIDGET,
1480 prev = p->gap_access_msg;
1483 * p->gap_perm_label, p->gap_perm_rc_mgr
1485 _i18n_HighestWidgetAdjust( 2, &curr, &highest, p->gap_perm_label,
1486 p->gap_perm_rc_mgr );
1487 XtVaSetValues( curr,
1488 XmNtopAttachment, XmATTACH_WIDGET,
1493 XtVaSetValues( p->gap_perm_label,
1494 XmNleftAttachment, XmATTACH_FORM,
1497 _i18n_WidestWidget( 1, &curr, &widest, p->gap_perm_label );
1498 XtVaSetValues( p->gap_perm_rc_mgr,
1499 XmNleftAttachment, XmATTACH_FORM,
1500 XmNleftOffset, 5 + widest + 5,
1503 ManageChildren(p->gap_perm_rc_mgr);
1504 ManageChildren(gap_form_mgr);
1508 ** Functions related to the printer ops pane
1511 static char *hdrDefaults[] =
1519 static char *hdrStrings[POP_HDR_NUM_CHOICES];
1522 p_create_printer_ops_pane(
1525 Calendar *c = calendar;
1526 Widget pop_form_mgr;
1534 pop_form_mgr = XtVaCreateWidget("pop_form_mgr",
1535 xmFormWidgetClass, p->base_form_mgr,
1536 XmNautoUnmanage, False,
1537 XmNtopAttachment, XmATTACH_WIDGET,
1538 XmNtopWidget, p->separator1,
1540 XmNleftAttachment, XmATTACH_FORM,
1542 XmNrightAttachment, XmATTACH_FORM,
1543 XmNrightOffset, GAP,
1544 XmNbottomAttachment, XmATTACH_WIDGET,
1545 XmNbottomWidget, p->separator2,
1546 XmNbottomOffset, GAP,
1548 p->pane_list[PRINTER_OPS_PANE] = pop_form_mgr;
1550 p->pop_margin_frame = _DtPrintCreateMarginFrame(pop_form_mgr);
1551 XtVaSetValues(p->pop_margin_frame,
1552 XmNtopAttachment, XmATTACH_FORM,
1554 XmNleftAttachment, XmATTACH_FORM,
1556 XmNrightAttachment, XmATTACH_FORM,
1560 _DtPrintMarginFrameEnumToWidget(p->pop_margin_frame,
1561 DTPRINT_OPTION_MARGIN_LEFT);
1562 XtAddCallback(p->pop_left_text, XmNvalueChangedCallback,
1563 p_mark_change, (XtPointer)p);
1565 _DtPrintMarginFrameEnumToWidget(p->pop_margin_frame,
1566 DTPRINT_OPTION_MARGIN_TOP);
1567 XtAddCallback(p->pop_top_text, XmNvalueChangedCallback,
1568 p_mark_change, (XtPointer)p);
1570 _DtPrintMarginFrameEnumToWidget(p->pop_margin_frame,
1571 DTPRINT_OPTION_MARGIN_RIGHT);
1572 XtAddCallback(p->pop_right_text, XmNvalueChangedCallback,
1573 p_mark_change, (XtPointer)p);
1574 p->pop_bottom_text =
1575 _DtPrintMarginFrameEnumToWidget(p->pop_margin_frame,
1576 DTPRINT_OPTION_MARGIN_BOTTOM);
1577 XtAddCallback(p->pop_bottom_text, XmNvalueChangedCallback,
1578 p_mark_change, (XtPointer)p);
1580 for (i = 0; i < POP_HDR_NUM_CHOICES; i++)
1581 hdrStrings[i] = XtNewString(catgets(c->DT_catd, 1, 1106 + i,
1584 p->pop_header_frame =
1585 _DtPrintCreateHdrFtrFrame(pop_form_mgr, POP_HDR_NUM_CHOICES,
1586 hdrStrings, (void **)NULL);
1587 XtVaSetValues(p->pop_header_frame,
1588 XmNtopAttachment, XmATTACH_WIDGET,
1589 XmNtopWidget, p->pop_margin_frame,
1591 XmNleftAttachment, XmATTACH_FORM,
1593 XmNrightAttachment, XmATTACH_FORM,
1596 _DtPrintHdrFtrFrameMenuWidgets(p->pop_header_frame,
1600 XtAddCallback(optionPane, XmNentryCallback,
1601 p_mark_change, (XtPointer)p);
1604 _DtPrintHdrFtrFrameEnumToWidget(p->pop_header_frame,
1605 DTPRINT_OPTION_HEADER_LEFT);
1608 _DtPrintHdrFtrFrameEnumToWidget(p->pop_header_frame,
1609 DTPRINT_OPTION_HEADER_RIGHT);
1612 _DtPrintHdrFtrFrameEnumToWidget(p->pop_header_frame,
1613 DTPRINT_OPTION_FOOTER_LEFT);
1616 _DtPrintHdrFtrFrameEnumToWidget(p->pop_header_frame,
1617 DTPRINT_OPTION_FOOTER_RIGHT);
1619 xmstr = XmStringCreateLocalized(
1620 catgets(c->DT_catd, 1, 434, "Include:"));
1621 p->pop_privacy_label = XtVaCreateWidget("include",
1622 xmLabelGadgetClass, pop_form_mgr,
1623 XmNlabelString, xmstr,
1624 XmNtopAttachment, XmATTACH_WIDGET,
1626 XmNtopWidget, p->pop_header_frame,
1627 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1629 XmNleftWidget, p->pop_margin_frame,
1631 XmStringFree(xmstr);
1634 ** Include label and toggle choice
1636 p->pop_privacy_rc_mgr = XtVaCreateWidget("pop_privacy_rc_mgr",
1637 xmRowColumnWidgetClass, pop_form_mgr,
1638 XmNpacking, XmPACK_COLUMN,
1639 XmNorientation, XmVERTICAL,
1640 XmNradioBehavior, False,
1641 XmNisHomogeneous, True,
1642 XmNindicatorType, XmN_OF_MANY,
1643 XmNentryClass, xmToggleButtonGadgetClass,
1646 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1648 XmNtopWidget, p->pop_privacy_label,
1649 XmNleftAttachment, XmATTACH_WIDGET,
1651 XmNleftWidget, p->pop_privacy_label,
1654 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 435,
1655 "Show Time and Text Appts"));
1656 p->pop_privacy_public_toggle = XtVaCreateWidget(
1658 xmToggleButtonGadgetClass, p->pop_privacy_rc_mgr,
1659 XmNlabelString, xmstr,
1661 XmStringFree(xmstr);
1663 XtAddCallback(p->pop_privacy_public_toggle,
1664 XmNvalueChangedCallback, p_mark_change, p);
1666 xmstr = XmStringCreateLocalized( catgets(c->DT_catd, 1, 436,
1667 "Show Time Only Appts"));
1668 p->pop_privacy_semi_toggle = XtVaCreateWidget(
1670 xmToggleButtonGadgetClass, p->pop_privacy_rc_mgr,
1671 XmNlabelString, xmstr,
1673 XmStringFree(xmstr);
1675 XtAddCallback(p->pop_privacy_semi_toggle,
1676 XmNvalueChangedCallback, p_mark_change, p);
1678 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 437,
1679 "Show Nothing Appts"));
1680 p->pop_privacy_private_toggle = XtVaCreateWidget(
1682 xmToggleButtonGadgetClass, p->pop_privacy_rc_mgr,
1683 XmNlabelString, xmstr,
1685 XmStringFree(xmstr);
1687 XtAddCallback(p->pop_privacy_private_toggle,
1688 XmNvalueChangedCallback, p_mark_change, p);
1690 ManageChildren(p->pop_privacy_rc_mgr);
1691 ManageChildren (pop_form_mgr);
1695 ** Functions related to the date format pane
1698 p_create_date_format_pane(
1701 Calendar *c = calendar;
1702 Widget dfp_form_mgr;
1704 Dimension max_left_label_width;
1709 dfp_form_mgr = XtVaCreateWidget("dfp_form_mgr",
1710 xmFormWidgetClass, p->base_form_mgr,
1711 XmNautoUnmanage, False,
1712 XmNtopAttachment, XmATTACH_WIDGET,
1713 XmNtopWidget, p->separator1,
1714 XmNleftAttachment, XmATTACH_FORM,
1715 XmNrightAttachment, XmATTACH_FORM,
1716 XmNbottomAttachment, XmATTACH_WIDGET,
1717 XmNbottomOffset, 10,
1718 XmNbottomWidget, p->separator2,
1720 p->pane_list[DATE_FORMAT_PANE] = dfp_form_mgr;
1723 ** Date ordering label and choice toggle widget
1725 xmstr = XmStringCreateLocalized(
1726 catgets(c->DT_catd, 1, 438, "Date Ordering:"));
1727 p->dfp_order_label = XtVaCreateWidget("dateOrdering",
1728 xmLabelGadgetClass, dfp_form_mgr,
1729 XmNlabelString, xmstr,
1731 XmStringFree(xmstr);
1733 xmstr = XmStringCreateLocalized(
1734 catgets(c->DT_catd, 1, 442, "Date Separator:"));
1735 p->dfp_sep_label = XtVaCreateWidget("dateSeparator",
1736 xmLabelGadgetClass, dfp_form_mgr,
1737 XmNlabelString, xmstr,
1739 XmStringFree(xmstr);
1741 max_left_label_width = ComputeMaxWidth(p->dfp_order_label,
1743 NULL, NULL) + 2 * GAP;
1745 p->dfp_order_rc_mgr = XtVaCreateWidget("dfp_order_rc_mgr",
1746 xmRowColumnWidgetClass, dfp_form_mgr,
1747 XmNpacking, XmPACK_COLUMN,
1748 XmNorientation, XmVERTICAL,
1749 XmNradioBehavior, True,
1750 XmNisHomogeneous, True,
1751 XmNentryClass, xmToggleButtonGadgetClass,
1752 XmNleftAttachment, XmATTACH_FORM,
1753 XmNleftOffset, max_left_label_width,
1754 XmNtopAttachment, XmATTACH_FORM,
1758 xmstr = XmStringCreateLocalized(
1759 catgets(c->DT_catd, 1, 439, "MM | DD | YY"));
1760 p->dfp_order_mmddyy_toggle = XtVaCreateWidget("mmddyy",
1761 xmToggleButtonGadgetClass, p->dfp_order_rc_mgr,
1762 XmNlabelString, xmstr,
1764 XmStringFree(xmstr);
1766 XtAddCallback(p->dfp_order_mmddyy_toggle,
1767 XmNvalueChangedCallback, p_mark_change, p);
1769 xmstr = XmStringCreateLocalized(
1770 catgets(c->DT_catd, 1, 440, "DD | MM | YY"));
1771 p->dfp_order_ddmmyy_toggle = XtVaCreateWidget("ddmmyy",
1772 xmToggleButtonGadgetClass, p->dfp_order_rc_mgr,
1773 XmNlabelString, xmstr,
1775 XmStringFree(xmstr);
1777 XtAddCallback(p->dfp_order_ddmmyy_toggle,
1778 XmNvalueChangedCallback, p_mark_change, p);
1780 xmstr = XmStringCreateLocalized(
1781 catgets(c->DT_catd, 1, 441, "YY | MM | DD"));
1782 p->dfp_order_yymmdd_toggle = XtVaCreateWidget("yymmdd",
1783 xmToggleButtonGadgetClass, p->dfp_order_rc_mgr,
1784 XmNlabelString, xmstr,
1786 XmStringFree(xmstr);
1788 XtAddCallback(p->dfp_order_yymmdd_toggle,
1789 XmNvalueChangedCallback, p_mark_change, p);
1791 ManageChildren(p->dfp_order_rc_mgr);
1794 ** Date separator label and choice toggle widget
1796 p->dfp_sep_rc_mgr = XtVaCreateWidget("dfp_sep_rc_mgr",
1797 xmRowColumnWidgetClass, dfp_form_mgr,
1798 XmNpacking, XmPACK_COLUMN,
1799 XmNorientation, XmVERTICAL,
1800 XmNradioBehavior, True,
1801 XmNisHomogeneous, True,
1802 XmNentryClass, xmToggleButtonGadgetClass,
1803 XmNleftAttachment, XmATTACH_FORM,
1804 XmNleftOffset, max_left_label_width,
1805 XmNtopAttachment, XmATTACH_WIDGET,
1806 XmNtopWidget, p->dfp_order_rc_mgr,
1810 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 443, "Blank"));
1811 p->dfp_sep_blank_toggle = XtVaCreateWidget("blank",
1812 xmToggleButtonGadgetClass, p->dfp_sep_rc_mgr,
1813 XmNlabelString, xmstr,
1815 XmStringFree(xmstr);
1817 XtAddCallback(p->dfp_sep_blank_toggle,
1818 XmNvalueChangedCallback, p_mark_change, p);
1820 xmstr = XmStringCreateLocalized("/");
1821 p->dfp_sep_slash_toggle = XtVaCreateWidget("oblique",
1822 xmToggleButtonGadgetClass, p->dfp_sep_rc_mgr,
1823 XmNlabelString, xmstr,
1825 XmStringFree(xmstr);
1827 XtAddCallback(p->dfp_sep_slash_toggle,
1828 XmNvalueChangedCallback, p_mark_change, p);
1830 xmstr = XmStringCreateLocalized(".");
1831 p->dfp_sep_period_toggle = XtVaCreateWidget("period",
1832 xmToggleButtonGadgetClass, p->dfp_sep_rc_mgr,
1833 XmNlabelString, xmstr,
1835 XmStringFree(xmstr);
1837 XtAddCallback(p->dfp_sep_period_toggle,
1838 XmNvalueChangedCallback, p_mark_change, p);
1840 xmstr = XmStringCreateLocalized("-");
1841 p->dfp_sep_dash_toggle = XtVaCreateWidget("hyphen",
1842 xmToggleButtonGadgetClass, p->dfp_sep_rc_mgr,
1843 XmNlabelString, xmstr,
1845 XmStringFree(xmstr);
1847 XtAddCallback(p->dfp_sep_dash_toggle,
1848 XmNvalueChangedCallback, p_mark_change, p);
1850 XtVaSetValues(p->dfp_order_label,
1851 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1852 XmNtopWidget, p->dfp_order_rc_mgr,
1854 XmNrightAttachment, XmATTACH_WIDGET,
1855 XmNrightWidget, p->dfp_order_rc_mgr,
1856 XmNrightOffset, GAP,
1859 XtVaSetValues(p->dfp_sep_label,
1860 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1861 XmNtopWidget, p->dfp_sep_rc_mgr,
1863 XmNrightAttachment, XmATTACH_WIDGET,
1864 XmNrightWidget, p->dfp_sep_rc_mgr,
1865 XmNrightOffset, GAP,
1868 ManageChildren(p->dfp_sep_rc_mgr);
1869 ManageChildren(dfp_form_mgr);
1873 ** Callback from the category option menu
1876 p_category_notify(Widget w, XtPointer client_data, XtPointer call_data)
1878 Widget base_form_mgr = XtParent(XtParent(XtParent(w)));
1879 PaneType item_no = (PaneType)client_data;
1880 Props_pu *p = (Props_pu *)NULL;
1883 ** Note this cheesy hack. The convenience functions allow you NO
1884 ** method which which to attach user data to the buttons on menus ...
1885 ** so the user data on the base form was set to contain a pointer to
1886 ** the Props_pu structure and we go up through the heirarchical levels
1887 ** using the widget parameter to retrieve this pointer.
1889 ** This sucks, but Motif sucks worse and I could find no other method.
1891 XtVaGetValues(base_form_mgr, XmNuserData, &p,
1894 show_ui(p, item_no);
1898 activate_ui(Props_pu *p, PaneType item_no)
1902 Widget optMenu = (Widget)NULL;
1903 WidgetList children;
1907 XtSetArg(args[nargs], XmNsubMenuId, &optMenu); nargs++;
1908 XtGetValues(p->category_menu, args, nargs);
1910 if (optMenu != (Widget)NULL)
1913 XtSetArg(args[nargs], XmNchildren, &children); nargs++;
1914 XtSetArg(args[nargs], XmNnumChildren, &nChildren); nargs++;
1915 XtGetValues(optMenu, args, nargs);
1917 if (item_no < nChildren)
1920 XtSetArg(args[nargs], XmNmenuHistory, children[item_no]); nargs++;
1921 XtSetValues(p->category_menu, args, nargs);
1923 show_ui(p, item_no);
1929 show_ui(Props_pu *p, PaneType item_no)
1932 Dimension label_height, slider_height;
1934 /* determine if there are uncommited changes in the property
1935 sheet that need to be flushed. */
1938 if (p_flush_changes(c) == False)
1940 Widget optMenu = (Widget)NULL;
1941 WidgetList children;
1944 XtVaGetValues(p->category_menu, XmNsubMenuId, &optMenu, NULL);
1945 XtVaGetValues(optMenu, XmNchildren, &children,
1946 XmNnumChildren, &nChildren, NULL);
1947 if (p->last_props_pane < nChildren)
1948 XtVaSetValues(p->category_menu, XmNmenuHistory,
1949 children[p->last_props_pane], NULL);
1954 ** Performance optimization - don't create each panel until it's
1955 ** asked for (except for the editor pane which is the first one ...).
1957 ** Motif, however, is not liking this optimization (bug in toolkit? I
1958 ** would guess yes ...). It's not resizing the pop-up correctly and
1959 ** it's leaving a number of fields blank ... it doesn't do this if the
1960 ** panes are all created before the window is poped up ... so all the
1961 ** panes are created before and this "if" statement will never evaluate
1962 ** to true. When (or if) this is fixed in the toolkit, remove the
1963 ** create statements from the p_make_props_pu function.
1965 if (!p->pane_list[item_no]) {
1968 p_create_display_pane(p);
1970 case GROUP_ACCESS_PANE:
1971 if (p->cal->my_cal_version < DATAVER4)
1972 p_create_v4_group_access_pane(p);
1974 p_create_v5_group_access_pane(p);
1976 case PRINTER_OPS_PANE:
1977 p_create_printer_ops_pane(p);
1979 case DATE_FORMAT_PANE:
1980 p_create_date_format_pane(p);
1987 if (!p->pane_list[item_no])
1990 XtUnmanageChild(p->pane_list[p->last_props_pane]);
1991 XtVaSetValues(p->separator2,
1992 XmNtopWidget, p->pane_list[item_no],
1994 XtManageChild(p->pane_list[item_no]);
1995 p->last_props_pane = item_no;
1998 /* code for display settings */
2000 XtVaGetValues(p->dp_beg_label, XmNheight, &label_height, NULL);
2001 XtVaGetValues(p->dp_beg_scale, XmNheight, &slider_height, NULL);
2002 XtVaSetValues(p->dp_beg_scale, XmNbottomOffset, ((int) label_height - (int) slider_height)/2, NULL);
2003 XtVaSetValues(p->dp_end_scale, XmNbottomOffset, ((int) label_height - (int) slider_height)/2, NULL);
2006 /* Center Category menu */
2007 p_gap_center_cat_menu(p->pane_list[p->last_props_pane],
2012 set_editor_defaults_later(XtPointer client_data, XtIntervalId *interval_id) {
2013 Calendar *c = (Calendar *)client_data;
2014 Props_pu *pu = (Props_pu *)c->properties_pu;
2016 _DtTurnOnHourGlass(c->frame);
2017 _DtTurnOnHourGlass(pu->frame);
2019 if (((Editor *) c->editor)->base_form_mgr) {
2020 Editor *e = (Editor *) c->editor;
2022 set_editor_defaults(e, 0, 0, False);
2025 if (((GEditor *) c->geditor)->base_form_mgr) {
2026 GEditor *ge = (GEditor *) c->geditor;
2028 set_geditor_defaults(ge, 0, 0);
2031 if (((ToDo *) c->todo)->base_form_mgr) {
2032 ToDo *t = (ToDo *)c->todo;
2034 set_todo_defaults(t);
2037 _DtTurnOffHourGlass(c->frame);
2038 _DtTurnOffHourGlass(pu->frame);
2042 p_save_changes(Calendar *c) {
2044 Props *p = (Props *)c->properties;
2045 Props_pu *pu = (Props_pu *)c->properties_pu;
2048 Tick current_mb_date = 0;
2052 Browser *b = (Browser*)c->browser;
2056 ot = get_int_prop(p, CP_DATEORDERING);
2057 st = get_int_prop(p, CP_DATESEPARATOR);
2059 date = get_date_from_widget(c->view->date, b->datetext, ot, st);
2062 current_mb_date = cm_getdate(date, NULL);
2065 if (get_props_from_ui(pu, p, &redisplay_mask) == True) {
2069 if (!save_props(p)) {
2070 char *title = XtNewString(catgets(c->DT_catd, 1, 454, "Calendar : Error - Options"));
2071 char *text = XtNewString(catgets(c->DT_catd, 1, 445, "An error occurred writing to ~/.desksetdefaults.\nMake sure you have permission to write to this file."));
2072 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2073 dialog_popup(pu->frame,
2074 DIALOG_TITLE, title,
2076 BUTTON_IDENT, 1, ident1,
2077 BUTTON_HELP, DESKSET_DEFAULTS_ERROR_HELP,
2078 DIALOG_IMAGE, pu->xm_error_pixmap,
2086 _DtTurnOnHourGlass(c->frame);
2087 _DtTurnOnHourGlass(pu->frame);
2089 if (redisplay_mask & PROPS_REDO_DISPLAY) {
2090 Dimension width, height;
2092 /* If this bit is set then it means that things controlling
2093 the day boundaries, or some detail of date representation
2094 has changed. All the things that paint get changed here.
2095 This is the main canvas, the multi-browse window, and
2096 the todo and appointment list dialogs. */
2098 XtVaGetValues(c->canvas,
2102 cache_dims(c, width, height);
2104 if (c->view->glance != yearGlance)
2105 paint_canvas(c, NULL, RENDER_CLEAR_FIRST);
2108 mb_refigure_chart(c);
2110 /* reformat the display values in the property sheet.
2111 The property sheet must exist is we have to refigure
2112 out the hour mode, so we don't need to check whether
2113 it exists or not. */
2115 XmScaleGetValue(pu->dp_end_scale, &val);
2116 set_scale_value(pu->dp_end_value, val, pu);
2117 XmScaleGetValue(pu->dp_beg_scale, &val);
2118 set_scale_value(pu->dp_beg_value, val, pu);
2120 if (c->editor && ((Editor *) c->editor)->view_list)
2121 build_editor_view((Editor *) c->editor, ((Editor *) (c->editor))->view_list_glance, True);
2123 if (c->todo && ((ToDo *) c->todo)->view_frame)
2124 build_todo_view((ToDo *) c->todo, ((ToDo *) (c->todo))->view_list_glance, True);
2127 /* redo date entry in the multi-browser */
2129 if (b && current_mb_date) {
2130 ot = get_int_prop(p, CP_DATEORDERING);
2131 st = get_int_prop(p, CP_DATESEPARATOR);
2132 format_tick(b->date, ot, st, buf);
2133 XmTextSetString(b->datetext, buf);
2137 if (redisplay_mask & PROPS_REDO_EDITORS) {
2139 if (c->editor && ((Editor *) c->editor)->base_form_mgr) {
2141 Editor *e = (Editor *) c->editor;
2142 DSSW *dssw = &((Editor *) c->editor)->dssw;
2144 set_dssw_menus(dssw, p);
2146 add_all_appt((Editor *) c->editor);
2151 if (((GEditor *) c->geditor)->base_form_mgr) {
2152 GEditor *ge = (GEditor *) c->geditor;
2153 DSSW *dssw = &((GEditor *) c->geditor)->dssw;
2155 set_dssw_menus(dssw, p);
2162 if (((ToDo *) c->todo)->base_form_mgr) {
2163 ToDo *t = (ToDo *)c->todo;
2164 DSSW *dssw = &((ToDo *) c->todo)->dssw;
2166 set_dssw_menus(dssw, p);
2168 add_all_todo((ToDo *) c->todo);
2171 set_dssw_menus(&pu->ep_dssw, p);
2173 XtVaSetValues(c->browse_button, XmNsubMenuId, NULL, NULL);
2174 update_browse_menu_names(c);
2175 XtVaSetValues(c->browse_button, XmNsubMenuId, c->browse_menu, NULL);
2177 browser_reset_list(c);
2179 /* This is really hateful. The deal is that something
2180 about the code that redefines the start and stop time
2181 menus has a timing hole in it. If I reset the values
2182 for these two menus before the application returns to
2183 the toolkit, the values will get clobbered later.
2184 There seems to be no way to force the toolkit to
2185 complete the restrucutring of the menus immediately,
2186 so I have to add a timer proc to reset the defaults on
2187 the dialog a little bit after returning to the notifier
2188 loop. Urk. This really needs to be fixed some day. */
2190 XtAppAddTimeOut(c->xcontext->app, 50, set_editor_defaults_later, c);
2195 _DtTurnOffHourGlass(pu->frame);
2196 _DtTurnOffHourGlass(c->frame);
2199 if (redisplay_mask & PROPS_REDO_PRINT_DIALOG) {}
2205 ** Button callback procs
2208 p_apply_proc(Widget w, XtPointer client_data, XtPointer data) {
2209 Calendar *c = (Calendar *)client_data;
2217 XtPointer client_data,
2220 Calendar *c = (Calendar *)client_data;
2221 Props_pu *pu = (Props_pu *)c->properties_pu;
2224 if (p_save_changes(c) == True)
2225 XtUnmanageChild(pu->base_form_mgr);
2229 p_defaults_proc(Widget w, XtPointer client_data, XtPointer data) {
2230 p_defaults_proc_helper(client_data);
2234 extern void p_defaults_proc_helper(XtPointer client_data){
2236 Calendar *c = (Calendar *)client_data;
2237 Props *p = (Props *)c->properties;
2238 Props_pu *pu = (Props_pu *)c->properties_pu;
2240 if (!read_props(p)) {
2241 char *title = XtNewString(catgets(c->DT_catd, 1, 454, "Calendar : Error - Options"));
2242 char *text = XtNewString(catgets(c->DT_catd, 1, 448, "An error occurred reading from ~/.desksetdefaults.\nMake sure you have permission to read this file."));
2243 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2244 dialog_popup(pu->frame,
2245 DIALOG_TITLE, title,
2247 BUTTON_IDENT, 1, ident1,
2248 BUTTON_HELP, DESKSET_DEFAULTS_ERROR_HELP,
2249 DIALOG_IMAGE, pu->xm_error_pixmap,
2255 if ((start = get_int_prop(p, CP_DAYBEGIN)) < 0)
2257 else if (start > 22)
2259 if ((stop = get_int_prop(p, CP_DAYEND)) <= start)
2263 set_int_prop(p, CP_DAYBEGIN, start);
2264 set_int_prop(p, CP_DAYEND, stop);
2266 set_props_on_ui(pu, p);
2271 p_close_proc(Widget w, XtPointer client_data, XtPointer data) {
2272 Props_pu *p = (Props_pu *)client_data;
2274 XtUnmanageChild(p->base_form_mgr);
2278 p_flush_changes(Calendar *c) {
2279 Props *p = (Props *)c->properties;
2280 Props_pu *pu = (Props_pu *)c->properties_pu;
2285 if (pu->changed_flag == True) {
2286 char *title = XtNewString(catgets(c->DT_catd, 1, 450, "Calendar : Options - Help"));
2287 char *text = XtNewString(catgets(c->DT_catd, 1, 451, "You have made unsaved changes.\nYou may save your changes, discard your changes, \nor return to your previous place in the dialog."));
2288 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 452, "Save"));
2289 char *ident2 = XtNewString(catgets(c->DT_catd, 1, 700, "Discard"));
2290 char *ident3 = XtNewString(catgets(c->DT_catd, 1, 923, "Cancel"));
2291 answer = dialog_popup(pu->frame,
2292 DIALOG_TITLE, title,
2294 BUTTON_IDENT, 1, ident1,
2295 BUTTON_IDENT, 2, ident2,
2296 BUTTON_IDENT, 3, ident3,
2297 DIALOG_IMAGE, pu->xm_warning_pixmap,
2306 return(p_save_changes(c));
2308 else if (answer == 2) {
2309 set_props_on_ui(pu, p);
2312 else if (answer == 3) {
2322 p_quit_handler(Widget w, XtPointer cdata, XtPointer data) {
2323 Calendar *c = (Calendar *)cdata;
2324 Props_pu *pu = (Props_pu *)c->properties_pu;
2326 if (p_flush_changes(c) == True)
2327 XtUnmanageChild(pu->base_form_mgr);
2331 p_make_props_pu(Calendar *c) {
2334 catgets(c->DT_catd, 1, 458, "Calendar : Options");
2336 Props_pu *p = (Props_pu *)c->properties_pu;
2342 ** An array of panes will be used to "flip" through the different
2343 ** property choice sheets
2346 p->pane_list = (Widget *)ckalloc(sizeof(Widget)*(DATE_FORMAT_PANE + 1));
2347 memset(p->pane_list, 0, sizeof(Widget)*(DATE_FORMAT_PANE + 1));
2350 ** Create the base frame and form manager
2352 buf = (char *)ckalloc(cm_strlen(popuplabel)
2353 + cm_strlen(c->calname) + 4);
2354 sprintf(buf, "%s - %s", popuplabel, c->calname);
2356 p->frame = XtVaCreatePopupShell("frame",
2357 xmDialogShellWidgetClass, c->frame,
2358 XmNdeleteResponse, XmDO_NOTHING,
2360 XmNallowShellResize, True,
2363 setup_quit_handler(p->frame, p_quit_handler, (caddr_t)c);
2365 p->base_form_mgr = XtVaCreateWidget("base_form_mgr",
2366 xmFormWidgetClass, p->frame,
2367 XmNautoUnmanage, False,
2368 XmNhorizontalSpacing, 1,
2369 XmNverticalSpacing, 1,
2371 XmNresizable, False,
2372 XmNfractionBase, 29,
2373 XmNtopAttachment, XmATTACH_FORM,
2375 XmNbottomAttachment, XmATTACH_FORM,
2377 XmNrightAttachment, XmATTACH_FORM,
2379 XmNleftAttachment, XmATTACH_FORM,
2384 ** Now the "top" portion - the category menu and the first separator
2387 Pane_XmStrs[EDITOR_PANE] =
2388 XmStringCreateLocalized(catgets(c->DT_catd, 1, 762,
2389 "Editor Defaults"));
2390 Pane_XmStrs[DISPLAY_PANE] =
2391 XmStringCreateLocalized(catgets(c->DT_catd, 1, 763,
2392 "Display Settings"));
2393 Pane_XmStrs[GROUP_ACCESS_PANE] =
2394 XmStringCreateLocalized(catgets(c->DT_catd, 1, 764,
2395 "Access List and Permissions"));
2396 Pane_XmStrs[PRINTER_OPS_PANE] =
2397 XmStringCreateLocalized(catgets(c->DT_catd, 1, 765,
2398 "Printer Settings"));
2399 Pane_XmStrs[DATE_FORMAT_PANE] =
2400 XmStringCreateLocalized(catgets(c->DT_catd, 1, 766,
2403 label = XmStringCreateLocalized(
2404 catgets(c->DT_catd, 1, 459, "Category:"));
2406 p->category_menu = widgets[0] =
2407 XmVaCreateSimpleOptionMenu(p->base_form_mgr,
2408 "category_menu", label, 0, 0, p_category_notify,
2409 XmVaPUSHBUTTON, Pane_XmStrs[EDITOR_PANE], NULL, NULL, NULL,
2410 XmVaPUSHBUTTON, Pane_XmStrs[DISPLAY_PANE], NULL, NULL, NULL,
2411 XmVaPUSHBUTTON, Pane_XmStrs[GROUP_ACCESS_PANE], NULL, NULL,NULL,
2412 XmVaPUSHBUTTON, Pane_XmStrs[PRINTER_OPS_PANE], NULL, NULL, NULL,
2413 XmVaPUSHBUTTON, Pane_XmStrs[DATE_FORMAT_PANE], NULL, NULL, NULL,
2414 XmNtopAttachment, XmATTACH_FORM,
2415 XmNleftAttachment, XmATTACH_FORM,
2416 XmNrightAttachment, XmATTACH_NONE,
2417 XmNnavigationType, XmTAB_GROUP,
2419 XmStringFree(label);
2421 p->separator1 = widgets[1] = XtVaCreateWidget("separator1",
2422 xmSeparatorGadgetClass, p->base_form_mgr,
2423 XmNleftAttachment, XmATTACH_FORM,
2424 XmNrightAttachment, XmATTACH_FORM,
2425 XmNtopAttachment, XmATTACH_WIDGET,
2426 XmNtopWidget, p->category_menu,
2430 ** Now create the "bottom" part - the separator and choice buttons
2432 p_create_editor_pane(c);
2434 p->separator2 = widgets[2] = XtVaCreateWidget("separator2",
2435 xmSeparatorGadgetClass, p->base_form_mgr,
2436 XmNleftAttachment, XmATTACH_FORM,
2437 XmNrightAttachment, XmATTACH_FORM,
2441 * To get the pane to resize instead of the buttons at the bottom
2442 * of the option sheet we attach the bottom of the pane to the
2443 * separator instead of the other way around.
2445 XtVaSetValues(p->pane_list[EDITOR_PANE],
2446 XmNbottomAttachment, XmATTACH_WIDGET,
2447 XmNbottomOffset, 10,
2448 XmNbottomWidget, p->separator2,
2451 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 655, "OK"));
2452 p->ok_button = widgets[3] = XtVaCreateWidget("ok",
2453 xmPushButtonGadgetClass, p->base_form_mgr,
2454 XmNlabelString, xmstr,
2455 XmNrecomputeSize, False,
2456 XmNbottomAttachment, XmATTACH_FORM,
2458 XmNleftAttachment, XmATTACH_POSITION,
2460 XmNrightAttachment, XmATTACH_POSITION,
2461 XmNrightPosition, 7,
2464 XmStringFree(xmstr);
2465 XtAddCallback(p->ok_button, XmNactivateCallback, p_ok_proc, c);
2467 XtVaSetValues(p->separator2,
2468 XmNbottomAttachment, XmATTACH_WIDGET,
2469 XmNbottomOffset, 10,
2470 XmNbottomWidget, p->ok_button,
2473 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 460, "Apply"));
2474 p->apply_button = widgets[4] = XtVaCreateWidget("apply",
2475 xmPushButtonGadgetClass, p->base_form_mgr,
2476 XmNlabelString, xmstr,
2477 XmNrecomputeSize, False,
2478 XmNbottomAttachment, XmATTACH_FORM,
2480 XmNtopWidget, p->separator2,
2481 XmNleftAttachment, XmATTACH_POSITION,
2483 XmNrightAttachment, XmATTACH_POSITION,
2484 XmNrightPosition, 12,
2487 XmStringFree(xmstr);
2488 XtAddCallback(p->apply_button, XmNactivateCallback, p_apply_proc, c);
2490 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 691, "Reset"));
2491 p->defaults_button = widgets[5] = XtVaCreateWidget("reset",
2492 xmPushButtonGadgetClass, p->base_form_mgr,
2493 XmNlabelString, xmstr,
2494 XmNrecomputeSize, False,
2495 XmNbottomAttachment, XmATTACH_FORM,
2497 XmNleftAttachment, XmATTACH_POSITION,
2498 XmNleftPosition, 12,
2499 XmNrightAttachment, XmATTACH_POSITION,
2500 XmNrightPosition, 17,
2503 XmStringFree(xmstr);
2504 XtAddCallback(p->defaults_button,
2505 XmNactivateCallback, p_defaults_proc, c);
2507 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 923, "Cancel"));
2508 p->close_button = widgets[6] = XtVaCreateWidget("close",
2509 xmPushButtonGadgetClass, p->base_form_mgr,
2510 XmNlabelString, xmstr,
2511 XmNbottomAttachment, XmATTACH_FORM,
2513 XmNtopWidget, p->separator2,
2514 XmNleftAttachment, XmATTACH_POSITION,
2515 XmNleftPosition, 17,
2516 XmNrightAttachment, XmATTACH_POSITION,
2517 XmNrightPosition, 22,
2520 XmStringFree(xmstr);
2521 XtAddCallback(p->close_button, XmNactivateCallback, p_close_proc, p);
2523 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 77, "Help"));
2524 p->help_button = widgets[7] = XtVaCreateWidget("help",
2525 xmPushButtonGadgetClass, p->base_form_mgr,
2526 XmNlabelString, xmstr,
2527 XmNbottomAttachment, XmATTACH_FORM,
2529 XmNtopWidget, p->separator2,
2530 XmNleftAttachment, XmATTACH_POSITION,
2531 XmNleftPosition, 22,
2532 XmNrightAttachment, XmATTACH_POSITION,
2533 XmNrightPosition, 27,
2535 XmStringFree(xmstr);
2536 XtAddCallback(p->help_button, XmNactivateCallback,
2537 (XtCallbackProc)help_cb, OPTIONS_HELP_BUTTON);
2538 XtAddCallback(p->base_form_mgr, XmNhelpCallback,
2539 (XtCallbackProc)help_cb, (XtPointer) OPTIONS_HELP_BUTTON);
2543 ** Last, create the remaining panes
2545 p_create_display_pane(p);
2546 if (p->cal->my_cal_version < DATAVER4)
2547 p_create_v4_group_access_pane(p);
2549 p_create_v5_group_access_pane(p);
2551 p_create_printer_ops_pane(p);
2552 p_create_date_format_pane(p);
2555 ** Manage the uppermost children (first pane is Editor Defaults)
2557 p->last_props_pane = EDITOR_PANE;
2558 widgets[8] = p->pane_list[p->last_props_pane];
2560 /* set default button */
2561 XtVaSetValues(p->base_form_mgr, XmNcancelButton,
2562 p->close_button, NULL);
2565 XtManageChildren(widgets, 9);
2569 string_is_number(char *str) {
2572 if (blank_buf(str)) {
2576 while (str && *str) {
2577 if (!isdigit(*str) && *str != ' ' && *str != '\t')
2587 string_is_time(char *str) {
2589 Boolean found_colon = False;
2590 int found_first_number = 0;
2591 int found_second_number = 0;
2593 if (blank_buf(str)) {
2597 /* a time is a pretty structured beast */
2600 if ((*str == ' ') || (*str == '\t')) {
2602 else if (*str == ':') {
2603 if (found_colon == True)
2605 else if (found_first_number == False)
2610 else if (isdigit(*str)) {
2611 if (found_colon == True)
2612 found_second_number++;
2614 found_first_number++;
2622 if ((found_colon == True) &&
2623 ((((found_first_number > 2) || (found_first_number < 1)) || (found_second_number != 2))))
2625 else if ((found_colon == False) && ((found_first_number > 4) || found_first_number < 3))
2632 /*******************************************************************************
2634 ** Functions external to props_pu.c
2636 *******************************************************************************/
2638 get_editor_vals_from_ui(Props_pu *pu, Props *p) {
2642 DisplayType dt = get_int_prop(p, CP_DEFAULTDISP);
2644 char *msg, *dur_txt;
2645 Reminder_val_op status;
2646 Calendar *c = pu->cal;
2648 XtVaGetValues(pu->ep_dur_cb, XmNtextField, &text, NULL);
2649 dur_txt = XmTextGetString(text);
2651 if (string_is_number(dur_txt) == False) {
2652 char *title = XtNewString(catgets(c->DT_catd, 1, 1079, "Calendar : Error - Editor Settings"));
2653 char *text = XtNewString(catgets(c->DT_catd, 1, 819, "The Duration value must be an integer with no sign.\nYour properties settings have not been saved."));
2654 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2657 dialog_popup(pu->frame,
2658 DIALOG_TITLE, title,
2660 BUTTON_IDENT, 1, ident1,
2661 BUTTON_HELP, DURATION_ERROR_HELP,
2662 DIALOG_IMAGE, pu->xm_error_pixmap,
2670 if (atoi(dur_txt) >= (60 *24)) {
2671 char *title = XtNewString(catgets(c->DT_catd, 1, 1079, "Calendar : Error - Editor Settings"));
2672 char *text = XtNewString(catgets(c->DT_catd, 1, 916, "The Duration value must be less than 24 hours.\nYour properties settings have not been saved."));
2673 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2676 dialog_popup(pu->frame,
2677 DIALOG_TITLE, title,
2679 BUTTON_IDENT, 1, ident1,
2680 BUTTON_HELP, DURATION_ERROR_HELP,
2681 DIALOG_IMAGE, pu->xm_error_pixmap,
2689 get_dssw_times(&pu->ep_dssw);
2691 if (string_is_time(pu->ep_dssw.start_val.val) == False) {
2692 char *title = XtNewString(catgets(c->DT_catd, 1, 1079, "Calendar : Error - Editor Settings"));
2693 char *text = XtNewString(catgets(c->DT_catd, 1, 820, "The start value must be a valid time.\nYour properties settings have not been saved."));
2694 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2695 dialog_popup(pu->frame,
2696 DIALOG_TITLE, title,
2698 BUTTON_IDENT, 1, ident1,
2699 BUTTON_HELP, START_ERROR_HELP,
2700 DIALOG_IMAGE, pu->xm_error_pixmap,
2709 strncpy(buf, pu->ep_dssw.start_val.val, 2);
2711 hr = atoi(buf) % 24;
2714 if (!XmToggleButtonGetState(pu->ep_dssw.start_am)) {
2717 } else if (hr == 12)
2719 strncpy(buf, &pu->ep_dssw.start_val.val[3], 2);
2722 strncpy(buf, &pu->ep_dssw.start_val.val[2], 2);
2725 min = atoi(buf) % 60;
2726 set_int_prop(p, CP_APPTBEGIN, (hr * minsec) + min);
2728 XtVaGetValues(pu->ep_dur_cb, XmNtextField, &text, NULL);
2730 min = atoi(XmTextGetString(text));
2731 set_int_prop(p, CP_APPTDURATION, min);
2734 if ((status = get_reminders_vals(&pu->ep_reminders, False)) != REMINDERS_OK) {
2735 char *title = XtNewString(catgets(c->DT_catd, 1, 1079, "Calendar : Error - Editor Settings"));
2737 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2740 case ADVANCE_BLANK : text = XtNewString(catgets(c->DT_catd, 1, 908, "You may not set a blank reminder value.\nYour properties settings have not been saved."));
2743 case ADVANCE_CONTAINS_BLANK : text = XtNewString(catgets(c->DT_catd, 1, 909, "You may not set a reminder value with an embedded blank.\nYour properties settings have not been saved."));
2746 case ADVANCE_NONNUMERIC : text = XtNewString(catgets(c->DT_catd, 1, 910, "Reminder values must be a number with an optional sign.\nYour properties settings have not been saved."));
2750 dialog_popup(pu->frame,
2751 DIALOG_TITLE, title,
2753 BUTTON_IDENT, 1, ident1,
2754 DIALOG_IMAGE, pu->xm_error_pixmap,
2755 BUTTON_HELP, ADVANCE_ERROR_HELP,
2763 val = &pu->ep_reminders.beep_val;
2764 set_char_prop(p, CP_BEEPON, boolean_str(val->selected));
2765 set_int_prop(p, CP_BEEPADV, val->scope_val);
2766 set_char_prop(p, CP_BEEPUNIT, (char *)time_scope_str(val->scope));
2768 val = &pu->ep_reminders.flash_val;
2769 set_char_prop(p, CP_FLASHON, boolean_str(val->selected));
2770 set_int_prop(p, CP_FLASHADV, val->scope_val);
2771 set_char_prop(p, CP_FLASHUNIT, (char *)time_scope_str(val->scope));
2773 val = &pu->ep_reminders.popup_val;
2774 set_char_prop(p, CP_OPENON, boolean_str(val->selected));
2775 set_int_prop(p, CP_OPENADV, val->scope_val);
2776 set_char_prop(p, CP_OPENUNIT, (char *)time_scope_str(val->scope));
2778 val = &pu->ep_reminders.mail_val;
2779 set_char_prop(p, CP_MAILON, boolean_str(val->selected));
2780 set_int_prop(p, CP_MAILADV, val->scope_val);
2781 set_char_prop(p, CP_MAILUNIT, (char *)time_scope_str(val->scope));
2782 set_char_prop(p, CP_MAILTO, pu->ep_reminders.mailto_val);
2784 XtVaGetValues(pu->privacy_menu, XmNselectedPosition, &i, NULL);
2786 set_char_prop(p, CP_PRIVACY, privacy_str(i));
2792 get_display_vals_from_ui(Props_pu *pu, Props *p) {
2795 Calendar *c = pu->cal;
2797 set_char_prop(p, CP_CALLOC, str = XmTextGetString(pu->dp_loc_text));
2798 if (blank_buf(str) || embedded_blank(str)) {
2799 char *title = XtNewString(catgets(c->DT_catd, 1, 1083, "Calendar : Error - Display Settings"));
2800 char *text = XtNewString(catgets(c->DT_catd, 1, 772, "You may not save a blank User Calendar Location\nor one that contains blanks.\nYour properties settings have not been saved."));
2801 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2802 dialog_popup(pu->frame,
2803 DIALOG_TITLE, title,
2805 BUTTON_IDENT, 1, ident1,
2806 BUTTON_HELP, CAL_LOCATION_ERROR_HELP,
2807 DIALOG_IMAGE, pu->xm_error_pixmap,
2818 XtVaGetValues(pu->dp_beg_scale, XmNvalue, &val,
2820 set_int_prop(p, CP_DAYBEGIN, val);
2821 XtVaGetValues(pu->dp_end_scale, XmNvalue, &val,
2823 set_int_prop(p, CP_DAYEND, val);
2825 set_int_prop(p, CP_DEFAULTDISP, XmToggleButtonGadgetGetState(
2826 pu->dp_hour24_toggle) ? HOUR24 : HOUR12);
2828 if (XmToggleButtonGadgetGetState(pu->dp_view_day_toggle))
2829 val = (int)DAY_VIEW;
2830 else if (XmToggleButtonGadgetGetState(pu->dp_view_month_toggle))
2831 val = (int)MONTH_VIEW;
2832 else if (XmToggleButtonGadgetGetState(pu->dp_view_week_toggle))
2833 val = (int)WEEK_VIEW;
2834 else if (XmToggleButtonGadgetGetState(pu->dp_view_year_toggle))
2835 val = (int)YEAR_VIEW;
2836 set_int_prop(p, CP_DEFAULTVIEW, val);
2838 set_char_prop(p, CP_DEFAULTCAL,
2839 str = XmTextGetString(pu->dp_init_view_text));
2841 if (blank_buf(str) || embedded_blank(str)) {
2842 char *title = XtNewString(catgets(c->DT_catd, 1, 1083, "Calendar : Error - Display Settings"));
2843 char *text = XtNewString(catgets(c->DT_catd, 1, 773, "You may not save a blank Initial Calendar View\nor one that contains blanks.\nYour properties settings have not been saved."));
2844 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2845 dialog_popup(pu->frame,
2846 DIALOG_TITLE, title,
2848 BUTTON_IDENT, 1, ident1,
2849 DIALOG_IMAGE, pu->xm_error_pixmap,
2864 get_gap_vals_from_ui(Props_pu *pu, Props *p) {
2865 CSA_return_code stat;
2868 cal = allocate_cal_struct(appt_write,
2869 pu->cal->my_cal_version,
2870 CSA_CAL_ATTR_ACCESS_LIST_I,
2872 cal->access_list->value->item.access_list_value = pu->gap_list;
2873 pu->gap_list = NULL;
2875 stat = csa_update_calendar_attributes(pu->cal->my_cal_handle, cal->count, cal->attrs, NULL);
2876 backend_err_msg(pu->frame, pu->cal->calname, stat, pu->xm_error_pixmap);
2877 free_cal_struct(&cal);
2878 set_gap_vals_on_ui(pu, p);
2883 print_option_error(Props_pu *pu, int setNum, int msgNum, char *str)
2885 Calendar *c = pu->cal;
2886 char *text = XtNewString(catgets(c->DT_catd, setNum, msgNum, str));
2887 static char *title = (char *)NULL;
2888 static char *ident1 = (char *)NULL;
2890 if (title == (char *)NULL)
2891 title = XtNewString(catgets(c->DT_catd, 1, 1085,
2892 "Calendar : Error - Printer Settings"));
2893 if (ident1 == (char *)NULL)
2894 ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2896 dialog_popup(pu->frame,
2897 DIALOG_TITLE, title,
2899 BUTTON_IDENT, 1, ident1,
2900 BUTTON_HELP, PRINT_HELP_BUTTON,
2901 DIALOG_IMAGE, pu->xm_error_pixmap,
2907 get_printer_vals_from_ui(Props_pu *pu, Props *p) {
2911 if ((str = _DtPrintGetMarginSpec(pu->pop_right_text)) != (char *)NULL)
2913 if (valid_margin_str(pu, str))
2915 set_char_prop(p, CP_PRINTRMARGIN, str);
2920 print_option_error(pu, 1, 821,
2921 "You have specified an illegal right margin value.\nYour properties settings have not been saved.");
2927 if ((str = _DtPrintGetMarginSpec(pu->pop_bottom_text)) != (char *)NULL)
2929 if (valid_margin_str(pu, str))
2931 set_char_prop(p, CP_PRINTBMARGIN, str);
2936 print_option_error(pu, 1, 822,
2937 "You have specified an illegal bottom margin value.\nYour properties settings have not been saved.");
2943 if ((str = _DtPrintGetMarginSpec(pu->pop_left_text)) != (char *)NULL)
2945 if (valid_margin_str(pu, str))
2947 set_char_prop(p, CP_PRINTLMARGIN, str);
2952 print_option_error(pu, 1, 911,
2953 "You have specified an illegal left margin value.\nYour properties settings have not been saved.");
2959 if ((str = _DtPrintGetMarginSpec(pu->pop_top_text)) != (char *)NULL)
2961 if (valid_margin_str(pu, str))
2963 set_char_prop(p, CP_PRINTTMARGIN, str);
2968 print_option_error(pu, 1, 912,
2969 "You have specified an illegal top margin value.\nYour properties settings have not been saved.");
2975 set_int_prop(p, CP_PRINTLHEADER,
2976 _DtPrintGetHdrFtrIndex(pu->pop_tl_option));
2977 set_int_prop(p, CP_PRINTRHEADER,
2978 _DtPrintGetHdrFtrIndex(pu->pop_tr_option));
2979 set_int_prop(p, CP_PRINTLFOOTER,
2980 _DtPrintGetHdrFtrIndex(pu->pop_bl_option));
2981 set_int_prop(p, CP_PRINTRFOOTER,
2982 _DtPrintGetHdrFtrIndex(pu->pop_br_option));
2985 ** For backward compatability with the XView toggles (which used or'd
2986 ** values) - we must continue ...
2988 if (XmToggleButtonGadgetGetState(pu->pop_privacy_public_toggle))
2989 plevel |= PRINT_PUBLIC;
2990 if (XmToggleButtonGadgetGetState(pu->pop_privacy_semi_toggle))
2991 plevel |= PRINT_SEMIPRIVATE;
2992 if (XmToggleButtonGadgetGetState(pu->pop_privacy_private_toggle))
2993 plevel |= PRINT_PRIVATE;
2994 set_int_prop(p, CP_PRINTPRIVACY, plevel);
3000 get_date_vals_from_ui(Props_pu *pu, Props *p) {
3001 if (XmToggleButtonGadgetGetState(pu->dfp_order_mmddyy_toggle))
3002 set_int_prop(p, CP_DATEORDERING, (int)ORDER_MDY);
3003 else if (XmToggleButtonGadgetGetState(pu->dfp_order_ddmmyy_toggle))
3004 set_int_prop(p, CP_DATEORDERING, (int)ORDER_DMY);
3005 else if (XmToggleButtonGadgetGetState(pu->dfp_order_yymmdd_toggle))
3006 set_int_prop(p, CP_DATEORDERING, (int)ORDER_YMD);
3008 if (XmToggleButtonGadgetGetState(pu->dfp_sep_blank_toggle))
3009 set_int_prop(p, CP_DATESEPARATOR, (int)SEPARATOR_BLANK);
3010 else if (XmToggleButtonGadgetGetState(pu->dfp_sep_slash_toggle))
3011 set_int_prop(p, CP_DATESEPARATOR, (int)SEPARATOR_SLASH);
3012 else if (XmToggleButtonGadgetGetState(pu->dfp_sep_period_toggle))
3013 set_int_prop(p, CP_DATESEPARATOR, (int)SEPARATOR_DOT);
3014 else if (XmToggleButtonGadgetGetState(pu->dfp_sep_dash_toggle))
3015 set_int_prop(p, CP_DATESEPARATOR, (int)SEPARATOR_DASH);
3021 get_props_from_ui(Props_pu *pu, Props *p, int *redisplay_mask) {
3023 *redisplay_mask = 0;
3025 /* we only ever have to get the values for one of the categories,
3026 as changing the nanes causes the values for the existing
3027 category to be flushed. */
3029 switch(pu->last_props_pane) {
3031 if (get_display_vals_from_ui(pu, p) == True)
3034 *redisplay_mask |= (PROPS_REDO_EDITORS | PROPS_REDO_DISPLAY);
3036 case GROUP_ACCESS_PANE:
3037 if (get_gap_vals_from_ui(pu, p) == True)
3040 case PRINTER_OPS_PANE:
3041 if (get_printer_vals_from_ui(pu, p) == True)
3044 *redisplay_mask |= PROPS_REDO_PRINT_DIALOG;
3046 case DATE_FORMAT_PANE:
3047 if (get_date_vals_from_ui(pu, p) == True)
3050 *redisplay_mask |= (PROPS_REDO_EDITORS | PROPS_REDO_DISPLAY);
3053 if (get_editor_vals_from_ui(pu, p) == True)
3056 *redisplay_mask |= PROPS_REDO_EDITORS;
3064 set_editor_vals_on_ui(Props_pu *pu, Props *p) {
3066 char buf[MAXNAMELEN];
3070 set_dssw_defaults(&pu->ep_dssw, now(), True);
3071 XtVaGetValues(pu->ep_dur_cb, XmNtextField, &text, NULL);
3073 sprintf(buf, "%d", get_int_prop(p, CP_APPTDURATION));
3074 XmTextSetString(text, buf);
3077 val = &pu->ep_reminders.beep_val;
3078 val->selected = convert_boolean_str(get_char_prop(p, CP_BEEPON));
3079 val->scope = convert_time_scope_str(get_char_prop(p, CP_BEEPUNIT));
3080 val->scope_val = get_int_prop(p, CP_BEEPADV);
3082 val = &pu->ep_reminders.flash_val;
3083 val->selected = convert_boolean_str(get_char_prop(p, CP_FLASHON));
3084 val->scope = convert_time_scope_str(get_char_prop(p, CP_FLASHUNIT));
3085 val->scope_val = get_int_prop(p, CP_FLASHADV);
3087 val = &pu->ep_reminders.popup_val;
3088 val->selected = convert_boolean_str(get_char_prop(p, CP_OPENON));
3089 val->scope = convert_time_scope_str(get_char_prop(p, CP_OPENUNIT));
3090 val->scope_val = get_int_prop(p, CP_OPENADV);
3092 val = &pu->ep_reminders.mail_val;
3093 val->selected = convert_boolean_str(get_char_prop(p, CP_MAILON));
3094 val->scope = convert_time_scope_str(get_char_prop(p, CP_MAILUNIT));
3095 val->scope_val = get_int_prop(p, CP_MAILADV);
3096 snprintf(pu->ep_reminders.mailto_val,
3097 sizeof(pu->ep_reminders.mailto_val),
3099 get_char_prop(p, CP_MAILTO));
3101 set_reminders_vals(&pu->ep_reminders, False);
3103 i = convert_privacy_str_to_op(get_char_prop(p, CP_PRIVACY));
3104 XtVaSetValues(pu->privacy_menu, XmNselectedPosition, i + 1, NULL);
3108 set_display_vals_on_ui(Props_pu *pu, Props *p) {
3109 XmTextSetString(pu->dp_loc_text, get_char_prop(p, CP_CALLOC));
3111 XtVaSetValues(pu->dp_beg_scale, XmNvalue, get_int_prop(p, CP_DAYBEGIN),
3113 set_scale_value(pu->dp_beg_value, get_int_prop(p, CP_DAYBEGIN), pu);
3115 XtVaSetValues(pu->dp_end_scale, XmNvalue, get_int_prop(p, CP_DAYEND),
3117 set_scale_value(pu->dp_end_value, get_int_prop(p, CP_DAYEND), pu);
3119 XmToggleButtonGadgetSetState((get_int_prop(p, CP_DEFAULTDISP) == HOUR12)
3120 ? pu->dp_hour12_toggle : pu->dp_hour24_toggle, True, True);
3122 switch(get_int_prop(p, CP_DEFAULTVIEW)) {
3124 XmToggleButtonGadgetSetState(pu->dp_view_day_toggle,
3128 XmToggleButtonGadgetSetState(pu->dp_view_week_toggle,
3132 XmToggleButtonGadgetSetState(pu->dp_view_year_toggle,
3137 XmToggleButtonGadgetSetState(pu->dp_view_month_toggle,
3142 XmTextSetString(pu->dp_init_view_text, get_char_prop(p, CP_DEFAULTCAL));
3146 set_gap_vals_on_ui(Props_pu *pu, Props *p) {
3149 CSA_return_code stat;
3151 CSA_access_list step = NULL, holder = NULL, last;
3153 cal = allocate_cal_struct(appt_read,
3154 pu->cal->my_cal_version,
3155 CSA_CAL_ATTR_ACCESS_LIST_I,
3157 stat = query_cal_struct(pu->cal->my_cal_handle, cal);
3158 backend_err_msg(pu->frame, pu->cal->calname, stat, pu->xm_error_pixmap);
3159 if (stat != CSA_SUCCESS) {
3160 free_cal_struct(&cal);
3163 pu->gap_list = cal->access_list->value->item.access_list_value;
3164 cal->access_list->value->item.access_list_value = NULL;
3166 XmListDeleteAllItems(pu->gap_access_list);
3167 step = pu->gap_list;
3169 if (pu->cal->my_cal_version < DATAVER4) {
3170 p_str = p_gap_create_perm_str(step->rights);
3171 p_gap_create_entry_string(pu, step->user->user_name,
3175 xmstr = XmStringCreateLocalized(step->user->user_name);
3177 XmListAddItem(pu->gap_access_list, xmstr, 0);
3178 XmStringFree(xmstr);
3181 free_cal_struct(&cal);
3185 valid_margin_str(Props_pu *pu, char *str)
3189 XmConvertStringToUnits(XtScreen(pu->pop_margin_frame),
3190 str, XmHORIZONTAL, XmINCHES, &badStr);
3192 return (Boolean)!badStr;
3196 set_printer_vals_on_ui(Props_pu *pu, Props *p) {
3199 _DtPrintSetMarginSpec(pu->pop_left_text,
3200 get_char_prop(p, CP_PRINTLMARGIN));
3202 _DtPrintSetMarginSpec(pu->pop_top_text,
3203 get_char_prop(p, CP_PRINTTMARGIN));
3205 _DtPrintSetMarginSpec(pu->pop_right_text,
3206 get_char_prop(p, CP_PRINTRMARGIN));
3208 _DtPrintSetMarginSpec(pu->pop_bottom_text,
3209 get_char_prop(p, CP_PRINTBMARGIN));
3211 _DtPrintSetHdrFtrByIndex(pu->pop_tl_option,
3212 get_int_prop(p, CP_PRINTLHEADER));
3214 _DtPrintSetHdrFtrByIndex(pu->pop_tr_option,
3215 get_int_prop(p, CP_PRINTRHEADER));
3217 _DtPrintSetHdrFtrByIndex(pu->pop_bl_option,
3218 get_int_prop(p, CP_PRINTLFOOTER));
3220 _DtPrintSetHdrFtrByIndex(pu->pop_br_option,
3221 get_int_prop(p, CP_PRINTRFOOTER));
3224 ** For backward compatability with the XView toggles (which used or'd
3225 ** values) - we must continue ...
3227 plevel = get_int_prop(p, CP_PRINTPRIVACY);
3228 if (plevel & PRINT_PUBLIC)
3229 XmToggleButtonGadgetSetState(pu->pop_privacy_public_toggle,
3231 if (plevel & PRINT_SEMIPRIVATE)
3232 XmToggleButtonGadgetSetState(pu->pop_privacy_semi_toggle,
3234 if (plevel & PRINT_PRIVATE)
3235 XmToggleButtonGadgetSetState(pu->pop_privacy_private_toggle,
3240 set_date_vals_on_ui(Props_pu *pu, Props *p) {
3241 SeparatorType st = get_int_prop(p, CP_DATESEPARATOR);
3242 OrderingType ot = get_int_prop(p, CP_DATEORDERING);
3246 XmToggleButtonGadgetSetState(pu->dfp_order_mmddyy_toggle,
3250 XmToggleButtonGadgetSetState(pu->dfp_order_ddmmyy_toggle,
3255 XmToggleButtonGadgetSetState(pu->dfp_order_yymmdd_toggle,
3261 case SEPARATOR_BLANK:
3262 XmToggleButtonGadgetSetState(pu->dfp_sep_blank_toggle,
3265 case SEPARATOR_SLASH:
3266 XmToggleButtonGadgetSetState(pu->dfp_sep_slash_toggle,
3270 XmToggleButtonGadgetSetState(pu->dfp_sep_period_toggle,
3273 case SEPARATOR_DASH:
3274 XmToggleButtonGadgetSetState(pu->dfp_sep_dash_toggle,
3281 set_props_on_ui(Props_pu *pu, Props *p) {
3282 set_editor_vals_on_ui(pu, p);
3283 set_display_vals_on_ui(pu, p);
3284 set_gap_vals_on_ui(pu, p);
3285 set_printer_vals_on_ui(pu, p);
3286 set_date_vals_on_ui(pu, p);
3293 show_props_pu(Calendar *c) {
3294 Props *p = (Props *)c->properties;
3295 Props_pu *pu = (Props_pu *)c->properties_pu;
3307 if (!props_pu_showing(pu))
3309 set_props_on_ui(pu, p);
3310 XtManageChild(pu->base_form_mgr);
3312 /* Center Category menu */
3313 p_gap_center_cat_menu(pu->pane_list[pu->last_props_pane],
3317 /* reset default values. takes care of 7:00/9:00 start problem */
3318 p_defaults_proc_helper(c);
3320 XtPopup(pu->frame, XtGrabNone);
3324 show_print_props_pu(Calendar *c)
3326 Props *p = (Props *)c->properties;
3327 Props_pu *pu = (Props_pu *)c->properties_pu;
3334 activate_ui(pu, PRINTER_OPS_PANE);
3336 if (!props_pu_showing(pu))
3338 set_props_on_ui(pu, p);
3339 XtManageChild(pu->base_form_mgr);
3341 /* Center Category menu */
3342 p_gap_center_cat_menu(pu->pane_list[pu->last_props_pane],
3348 props_pu_clean_up(Props_pu *p) {
3351 p->pane_list = NULL;
3355 props_pu_showing(Props_pu *p) {
3356 if (p && p->base_form_mgr)
3357 return XtIsManaged(p->base_form_mgr);
3362 p_gap_clear_toggles(Props_pu *p)
3366 * V5DEP: If this is a V5 server w/V1 backing store probably
3367 * should use old access flags.
3369 if (p->cal->my_cal_version >= DATAVER4) {
3370 XmToggleButtonGadgetSetState(p->gap2_public_tog[GAP_VIEW],
3372 XmToggleButtonGadgetSetState(p->gap2_public_tog[GAP_INSERT],
3374 XmToggleButtonGadgetSetState(p->gap2_public_tog[GAP_CHANGE],
3376 XmToggleButtonGadgetSetState(p->gap2_semi_tog[GAP_VIEW],
3378 XmToggleButtonGadgetSetState(p->gap2_semi_tog[GAP_INSERT],
3380 XmToggleButtonGadgetSetState(p->gap2_semi_tog[GAP_CHANGE],
3382 XmToggleButtonGadgetSetState(p->gap2_private_tog[GAP_VIEW],
3384 XmToggleButtonGadgetSetState(p->gap2_private_tog[GAP_INSERT],
3386 XmToggleButtonGadgetSetState(p->gap2_private_tog[GAP_CHANGE],
3389 XmToggleButtonGadgetSetState(p->gap_browse_toggle,
3391 XmToggleButtonGadgetSetState(p->gap_insert_toggle,
3393 XmToggleButtonGadgetSetState(p->gap_delete_toggle,
3399 p_gap_center_cat_menu(
3403 Dimension frame_width, menu_width;
3405 XtVaGetValues(frame, XmNwidth, &frame_width, NULL);
3406 XtVaGetValues(menu, XmNwidth, &menu_width, NULL);
3408 XtVaSetValues(menu, XmNleftOffset, frame_width/2 - menu_width/2,