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 /* $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 (((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) {
2321 p_quit_handler(Widget w, XtPointer cdata, XtPointer data) {
2322 Calendar *c = (Calendar *)cdata;
2323 Props_pu *pu = (Props_pu *)c->properties_pu;
2325 if (p_flush_changes(c) == True)
2326 XtUnmanageChild(pu->base_form_mgr);
2330 p_make_props_pu(Calendar *c) {
2333 catgets(c->DT_catd, 1, 458, "Calendar : Options");
2335 Props_pu *p = (Props_pu *)c->properties_pu;
2341 ** An array of panes will be used to "flip" through the different
2342 ** property choice sheets
2345 p->pane_list = (Widget *)ckalloc(sizeof(Widget)*(DATE_FORMAT_PANE + 1));
2346 memset(p->pane_list, 0, sizeof(Widget)*(DATE_FORMAT_PANE + 1));
2349 ** Create the base frame and form manager
2351 buf = (char *)ckalloc(cm_strlen(popuplabel)
2352 + cm_strlen(c->calname) + 4);
2353 sprintf(buf, "%s - %s", popuplabel, c->calname);
2355 p->frame = XtVaCreatePopupShell("frame",
2356 xmDialogShellWidgetClass, c->frame,
2357 XmNdeleteResponse, XmDO_NOTHING,
2359 XmNallowShellResize, True,
2362 setup_quit_handler(p->frame, p_quit_handler, (caddr_t)c);
2364 p->base_form_mgr = XtVaCreateWidget("base_form_mgr",
2365 xmFormWidgetClass, p->frame,
2366 XmNautoUnmanage, False,
2367 XmNhorizontalSpacing, 1,
2368 XmNverticalSpacing, 1,
2370 XmNresizable, False,
2371 XmNfractionBase, 29,
2372 XmNtopAttachment, XmATTACH_FORM,
2374 XmNbottomAttachment, XmATTACH_FORM,
2376 XmNrightAttachment, XmATTACH_FORM,
2378 XmNleftAttachment, XmATTACH_FORM,
2383 ** Now the "top" portion - the category menu and the first separator
2386 Pane_XmStrs[EDITOR_PANE] =
2387 XmStringCreateLocalized(catgets(c->DT_catd, 1, 762,
2388 "Editor Defaults"));
2389 Pane_XmStrs[DISPLAY_PANE] =
2390 XmStringCreateLocalized(catgets(c->DT_catd, 1, 763,
2391 "Display Settings"));
2392 Pane_XmStrs[GROUP_ACCESS_PANE] =
2393 XmStringCreateLocalized(catgets(c->DT_catd, 1, 764,
2394 "Access List and Permissions"));
2395 Pane_XmStrs[PRINTER_OPS_PANE] =
2396 XmStringCreateLocalized(catgets(c->DT_catd, 1, 765,
2397 "Printer Settings"));
2398 Pane_XmStrs[DATE_FORMAT_PANE] =
2399 XmStringCreateLocalized(catgets(c->DT_catd, 1, 766,
2402 label = XmStringCreateLocalized(
2403 catgets(c->DT_catd, 1, 459, "Category:"));
2405 p->category_menu = widgets[0] =
2406 XmVaCreateSimpleOptionMenu(p->base_form_mgr,
2407 "category_menu", label, NULL, 0, p_category_notify,
2408 XmVaPUSHBUTTON, Pane_XmStrs[EDITOR_PANE], NULL, NULL, NULL,
2409 XmVaPUSHBUTTON, Pane_XmStrs[DISPLAY_PANE], NULL, NULL, NULL,
2410 XmVaPUSHBUTTON, Pane_XmStrs[GROUP_ACCESS_PANE], NULL, NULL,NULL,
2411 XmVaPUSHBUTTON, Pane_XmStrs[PRINTER_OPS_PANE], NULL, NULL, NULL,
2412 XmVaPUSHBUTTON, Pane_XmStrs[DATE_FORMAT_PANE], NULL, NULL, NULL,
2413 XmNtopAttachment, XmATTACH_FORM,
2414 XmNleftAttachment, XmATTACH_FORM,
2415 XmNrightAttachment, XmATTACH_NONE,
2416 XmNnavigationType, XmTAB_GROUP,
2418 XmStringFree(label);
2420 p->separator1 = widgets[1] = XtVaCreateWidget("separator1",
2421 xmSeparatorGadgetClass, p->base_form_mgr,
2422 XmNleftAttachment, XmATTACH_FORM,
2423 XmNrightAttachment, XmATTACH_FORM,
2424 XmNtopAttachment, XmATTACH_WIDGET,
2425 XmNtopWidget, p->category_menu,
2429 ** Now create the "bottom" part - the separator and choice buttons
2431 p_create_editor_pane(c);
2433 p->separator2 = widgets[2] = XtVaCreateWidget("separator2",
2434 xmSeparatorGadgetClass, p->base_form_mgr,
2435 XmNleftAttachment, XmATTACH_FORM,
2436 XmNrightAttachment, XmATTACH_FORM,
2440 * To get the pane to resize instead of the buttons at the bottom
2441 * of the option sheet we attach the bottom of the pane to the
2442 * separator instead of the other way around.
2444 XtVaSetValues(p->pane_list[EDITOR_PANE],
2445 XmNbottomAttachment, XmATTACH_WIDGET,
2446 XmNbottomOffset, 10,
2447 XmNbottomWidget, p->separator2,
2450 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 655, "OK"));
2451 p->ok_button = widgets[3] = XtVaCreateWidget("ok",
2452 xmPushButtonGadgetClass, p->base_form_mgr,
2453 XmNlabelString, xmstr,
2454 XmNrecomputeSize, False,
2455 XmNbottomAttachment, XmATTACH_FORM,
2457 XmNleftAttachment, XmATTACH_POSITION,
2459 XmNrightAttachment, XmATTACH_POSITION,
2460 XmNrightPosition, 7,
2463 XmStringFree(xmstr);
2464 XtAddCallback(p->ok_button, XmNactivateCallback, p_ok_proc, c);
2466 XtVaSetValues(p->separator2,
2467 XmNbottomAttachment, XmATTACH_WIDGET,
2468 XmNbottomOffset, 10,
2469 XmNbottomWidget, p->ok_button,
2472 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 460, "Apply"));
2473 p->apply_button = widgets[4] = XtVaCreateWidget("apply",
2474 xmPushButtonGadgetClass, p->base_form_mgr,
2475 XmNlabelString, xmstr,
2476 XmNrecomputeSize, False,
2477 XmNbottomAttachment, XmATTACH_FORM,
2479 XmNtopWidget, p->separator2,
2480 XmNleftAttachment, XmATTACH_POSITION,
2482 XmNrightAttachment, XmATTACH_POSITION,
2483 XmNrightPosition, 12,
2486 XmStringFree(xmstr);
2487 XtAddCallback(p->apply_button, XmNactivateCallback, p_apply_proc, c);
2489 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 691, "Reset"));
2490 p->defaults_button = widgets[5] = XtVaCreateWidget("reset",
2491 xmPushButtonGadgetClass, p->base_form_mgr,
2492 XmNlabelString, xmstr,
2493 XmNrecomputeSize, False,
2494 XmNbottomAttachment, XmATTACH_FORM,
2496 XmNleftAttachment, XmATTACH_POSITION,
2497 XmNleftPosition, 12,
2498 XmNrightAttachment, XmATTACH_POSITION,
2499 XmNrightPosition, 17,
2502 XmStringFree(xmstr);
2503 XtAddCallback(p->defaults_button,
2504 XmNactivateCallback, p_defaults_proc, c);
2506 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 923, "Cancel"));
2507 p->close_button = widgets[6] = XtVaCreateWidget("close",
2508 xmPushButtonGadgetClass, p->base_form_mgr,
2509 XmNlabelString, xmstr,
2510 XmNbottomAttachment, XmATTACH_FORM,
2512 XmNtopWidget, p->separator2,
2513 XmNleftAttachment, XmATTACH_POSITION,
2514 XmNleftPosition, 17,
2515 XmNrightAttachment, XmATTACH_POSITION,
2516 XmNrightPosition, 22,
2519 XmStringFree(xmstr);
2520 XtAddCallback(p->close_button, XmNactivateCallback, p_close_proc, p);
2522 xmstr = XmStringCreateLocalized(catgets(c->DT_catd, 1, 77, "Help"));
2523 p->help_button = widgets[7] = XtVaCreateWidget("help",
2524 xmPushButtonGadgetClass, p->base_form_mgr,
2525 XmNlabelString, xmstr,
2526 XmNbottomAttachment, XmATTACH_FORM,
2528 XmNtopWidget, p->separator2,
2529 XmNleftAttachment, XmATTACH_POSITION,
2530 XmNleftPosition, 22,
2531 XmNrightAttachment, XmATTACH_POSITION,
2532 XmNrightPosition, 27,
2534 XmStringFree(xmstr);
2535 XtAddCallback(p->help_button, XmNactivateCallback,
2536 (XtCallbackProc)help_cb, OPTIONS_HELP_BUTTON);
2537 XtAddCallback(p->base_form_mgr, XmNhelpCallback,
2538 (XtCallbackProc)help_cb, (XtPointer) OPTIONS_HELP_BUTTON);
2542 ** Last, create the remaining panes
2544 p_create_display_pane(p);
2545 if (p->cal->my_cal_version < DATAVER4)
2546 p_create_v4_group_access_pane(p);
2548 p_create_v5_group_access_pane(p);
2550 p_create_printer_ops_pane(p);
2551 p_create_date_format_pane(p);
2554 ** Manage the uppermost children (first pane is Editor Defaults)
2556 p->last_props_pane = EDITOR_PANE;
2557 widgets[8] = p->pane_list[p->last_props_pane];
2559 /* set default button */
2560 XtVaSetValues(p->base_form_mgr, XmNcancelButton,
2561 p->close_button, NULL);
2564 XtManageChildren(widgets, 9);
2568 string_is_number(char *str) {
2571 if (blank_buf(str)) {
2575 while (str && *str) {
2576 if (!isdigit(*str) && *str != ' ' && *str != '\t')
2586 string_is_time(char *str) {
2588 Boolean found_colon = False;
2589 int found_first_number = 0;
2590 int found_second_number = 0;
2592 if (blank_buf(str)) {
2596 /* a time is a pretty structured beast */
2599 if ((*str == ' ') || (*str == '\t')) {
2601 else if (*str == ':') {
2602 if (found_colon == True)
2604 else if (found_first_number == False)
2609 else if (isdigit(*str)) {
2610 if (found_colon == True)
2611 found_second_number++;
2613 found_first_number++;
2621 if ((found_colon == True) &&
2622 ((((found_first_number > 2) || (found_first_number < 1)) || (found_second_number != 2))))
2624 else if ((found_colon == False) && ((found_first_number > 4) || found_first_number < 3))
2631 /*******************************************************************************
2633 ** Functions external to props_pu.c
2635 *******************************************************************************/
2637 get_editor_vals_from_ui(Props_pu *pu, Props *p) {
2641 DisplayType dt = get_int_prop(p, CP_DEFAULTDISP);
2643 char *msg, *dur_txt;
2644 Reminder_val_op status;
2645 Calendar *c = pu->cal;
2647 XtVaGetValues(pu->ep_dur_cb, XmNtextField, &text, NULL);
2648 dur_txt = XmTextGetString(text);
2650 if (string_is_number(dur_txt) == False) {
2651 char *title = XtNewString(catgets(c->DT_catd, 1, 1079, "Calendar : Error - Editor Settings"));
2652 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."));
2653 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2656 dialog_popup(pu->frame,
2657 DIALOG_TITLE, title,
2659 BUTTON_IDENT, 1, ident1,
2660 BUTTON_HELP, DURATION_ERROR_HELP,
2661 DIALOG_IMAGE, pu->xm_error_pixmap,
2669 if (atoi(dur_txt) >= (60 *24)) {
2670 char *title = XtNewString(catgets(c->DT_catd, 1, 1079, "Calendar : Error - Editor Settings"));
2671 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."));
2672 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2675 dialog_popup(pu->frame,
2676 DIALOG_TITLE, title,
2678 BUTTON_IDENT, 1, ident1,
2679 BUTTON_HELP, DURATION_ERROR_HELP,
2680 DIALOG_IMAGE, pu->xm_error_pixmap,
2688 get_dssw_times(&pu->ep_dssw);
2690 if (string_is_time(pu->ep_dssw.start_val.val) == False) {
2691 char *title = XtNewString(catgets(c->DT_catd, 1, 1079, "Calendar : Error - Editor Settings"));
2692 char *text = XtNewString(catgets(c->DT_catd, 1, 820, "The start value must be a valid time.\nYour properties settings have not been saved."));
2693 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2694 dialog_popup(pu->frame,
2695 DIALOG_TITLE, title,
2697 BUTTON_IDENT, 1, ident1,
2698 BUTTON_HELP, START_ERROR_HELP,
2699 DIALOG_IMAGE, pu->xm_error_pixmap,
2708 strncpy(buf, pu->ep_dssw.start_val.val, 2);
2710 hr = atoi(buf) % 24;
2713 if (!XmToggleButtonGetState(pu->ep_dssw.start_am)) {
2716 } else if (hr == 12)
2718 strncpy(buf, &pu->ep_dssw.start_val.val[3], 2);
2721 strncpy(buf, &pu->ep_dssw.start_val.val[2], 2);
2724 min = atoi(buf) % 60;
2725 set_int_prop(p, CP_APPTBEGIN, (hr * minsec) + min);
2727 XtVaGetValues(pu->ep_dur_cb, XmNtextField, &text, NULL);
2729 min = atoi(XmTextGetString(text));
2730 set_int_prop(p, CP_APPTDURATION, min);
2733 if ((status = get_reminders_vals(&pu->ep_reminders, False)) != REMINDERS_OK) {
2734 char *title = XtNewString(catgets(c->DT_catd, 1, 1079, "Calendar : Error - Editor Settings"));
2736 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2739 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."));
2742 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."));
2745 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."));
2749 dialog_popup(pu->frame,
2750 DIALOG_TITLE, title,
2752 BUTTON_IDENT, 1, ident1,
2753 DIALOG_IMAGE, pu->xm_error_pixmap,
2754 BUTTON_HELP, ADVANCE_ERROR_HELP,
2762 val = &pu->ep_reminders.beep_val;
2763 set_char_prop(p, CP_BEEPON, boolean_str(val->selected));
2764 set_int_prop(p, CP_BEEPADV, val->scope_val);
2765 set_char_prop(p, CP_BEEPUNIT, (char *)time_scope_str(val->scope));
2767 val = &pu->ep_reminders.flash_val;
2768 set_char_prop(p, CP_FLASHON, boolean_str(val->selected));
2769 set_int_prop(p, CP_FLASHADV, val->scope_val);
2770 set_char_prop(p, CP_FLASHUNIT, (char *)time_scope_str(val->scope));
2772 val = &pu->ep_reminders.popup_val;
2773 set_char_prop(p, CP_OPENON, boolean_str(val->selected));
2774 set_int_prop(p, CP_OPENADV, val->scope_val);
2775 set_char_prop(p, CP_OPENUNIT, (char *)time_scope_str(val->scope));
2777 val = &pu->ep_reminders.mail_val;
2778 set_char_prop(p, CP_MAILON, boolean_str(val->selected));
2779 set_int_prop(p, CP_MAILADV, val->scope_val);
2780 set_char_prop(p, CP_MAILUNIT, (char *)time_scope_str(val->scope));
2781 set_char_prop(p, CP_MAILTO, pu->ep_reminders.mailto_val);
2783 XtVaGetValues(pu->privacy_menu, XmNselectedPosition, &i, NULL);
2785 set_char_prop(p, CP_PRIVACY, privacy_str(i));
2791 get_display_vals_from_ui(Props_pu *pu, Props *p) {
2794 Calendar *c = pu->cal;
2796 set_char_prop(p, CP_CALLOC, str = XmTextGetString(pu->dp_loc_text));
2797 if (blank_buf(str) || embedded_blank(str)) {
2798 char *title = XtNewString(catgets(c->DT_catd, 1, 1083, "Calendar : Error - Display Settings"));
2799 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."));
2800 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2801 dialog_popup(pu->frame,
2802 DIALOG_TITLE, title,
2804 BUTTON_IDENT, 1, ident1,
2805 BUTTON_HELP, CAL_LOCATION_ERROR_HELP,
2806 DIALOG_IMAGE, pu->xm_error_pixmap,
2817 XtVaGetValues(pu->dp_beg_scale, XmNvalue, &val,
2819 set_int_prop(p, CP_DAYBEGIN, val);
2820 XtVaGetValues(pu->dp_end_scale, XmNvalue, &val,
2822 set_int_prop(p, CP_DAYEND, val);
2824 set_int_prop(p, CP_DEFAULTDISP, XmToggleButtonGadgetGetState(
2825 pu->dp_hour24_toggle) ? HOUR24 : HOUR12);
2827 if (XmToggleButtonGadgetGetState(pu->dp_view_day_toggle))
2828 val = (int)DAY_VIEW;
2829 else if (XmToggleButtonGadgetGetState(pu->dp_view_month_toggle))
2830 val = (int)MONTH_VIEW;
2831 else if (XmToggleButtonGadgetGetState(pu->dp_view_week_toggle))
2832 val = (int)WEEK_VIEW;
2833 else if (XmToggleButtonGadgetGetState(pu->dp_view_year_toggle))
2834 val = (int)YEAR_VIEW;
2835 set_int_prop(p, CP_DEFAULTVIEW, val);
2837 set_char_prop(p, CP_DEFAULTCAL,
2838 str = XmTextGetString(pu->dp_init_view_text));
2840 if (blank_buf(str) || embedded_blank(str)) {
2841 char *title = XtNewString(catgets(c->DT_catd, 1, 1083, "Calendar : Error - Display Settings"));
2842 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."));
2843 char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2844 dialog_popup(pu->frame,
2845 DIALOG_TITLE, title,
2847 BUTTON_IDENT, 1, ident1,
2848 DIALOG_IMAGE, pu->xm_error_pixmap,
2863 get_gap_vals_from_ui(Props_pu *pu, Props *p) {
2864 CSA_return_code stat;
2867 cal = allocate_cal_struct(appt_write,
2868 pu->cal->my_cal_version,
2869 CSA_CAL_ATTR_ACCESS_LIST_I,
2871 cal->access_list->value->item.access_list_value = pu->gap_list;
2872 pu->gap_list = NULL;
2874 stat = csa_update_calendar_attributes(pu->cal->my_cal_handle, cal->count, cal->attrs, NULL);
2875 backend_err_msg(pu->frame, pu->cal->calname, stat, pu->xm_error_pixmap);
2876 free_cal_struct(&cal);
2877 set_gap_vals_on_ui(pu, p);
2882 print_option_error(Props_pu *pu, int setNum, int msgNum, char *str)
2884 Calendar *c = pu->cal;
2885 char *text = XtNewString(catgets(c->DT_catd, setNum, msgNum, str));
2886 static char *title = (char *)NULL;
2887 static char *ident1 = (char *)NULL;
2889 if (title == (char *)NULL)
2890 title = XtNewString(catgets(c->DT_catd, 1, 1085,
2891 "Calendar : Error - Printer Settings"));
2892 if (ident1 == (char *)NULL)
2893 ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
2895 dialog_popup(pu->frame,
2896 DIALOG_TITLE, title,
2898 BUTTON_IDENT, 1, ident1,
2899 BUTTON_HELP, PRINT_HELP_BUTTON,
2900 DIALOG_IMAGE, pu->xm_error_pixmap,
2906 get_printer_vals_from_ui(Props_pu *pu, Props *p) {
2910 if ((str = _DtPrintGetMarginSpec(pu->pop_right_text)) != (char *)NULL)
2912 if (valid_margin_str(pu, str))
2914 set_char_prop(p, CP_PRINTRMARGIN, str);
2919 print_option_error(pu, 1, 821,
2920 "You have specified an illegal right margin value.\nYour properties settings have not been saved.");
2926 if ((str = _DtPrintGetMarginSpec(pu->pop_bottom_text)) != (char *)NULL)
2928 if (valid_margin_str(pu, str))
2930 set_char_prop(p, CP_PRINTBMARGIN, str);
2935 print_option_error(pu, 1, 822,
2936 "You have specified an illegal bottom margin value.\nYour properties settings have not been saved.");
2942 if ((str = _DtPrintGetMarginSpec(pu->pop_left_text)) != (char *)NULL)
2944 if (valid_margin_str(pu, str))
2946 set_char_prop(p, CP_PRINTLMARGIN, str);
2951 print_option_error(pu, 1, 911,
2952 "You have specified an illegal left margin value.\nYour properties settings have not been saved.");
2958 if ((str = _DtPrintGetMarginSpec(pu->pop_top_text)) != (char *)NULL)
2960 if (valid_margin_str(pu, str))
2962 set_char_prop(p, CP_PRINTTMARGIN, str);
2967 print_option_error(pu, 1, 912,
2968 "You have specified an illegal top margin value.\nYour properties settings have not been saved.");
2974 set_int_prop(p, CP_PRINTLHEADER,
2975 _DtPrintGetHdrFtrIndex(pu->pop_tl_option));
2976 set_int_prop(p, CP_PRINTRHEADER,
2977 _DtPrintGetHdrFtrIndex(pu->pop_tr_option));
2978 set_int_prop(p, CP_PRINTLFOOTER,
2979 _DtPrintGetHdrFtrIndex(pu->pop_bl_option));
2980 set_int_prop(p, CP_PRINTRFOOTER,
2981 _DtPrintGetHdrFtrIndex(pu->pop_br_option));
2984 ** For backward compatability with the XView toggles (which used or'd
2985 ** values) - we must continue ...
2987 if (XmToggleButtonGadgetGetState(pu->pop_privacy_public_toggle))
2988 plevel |= PRINT_PUBLIC;
2989 if (XmToggleButtonGadgetGetState(pu->pop_privacy_semi_toggle))
2990 plevel |= PRINT_SEMIPRIVATE;
2991 if (XmToggleButtonGadgetGetState(pu->pop_privacy_private_toggle))
2992 plevel |= PRINT_PRIVATE;
2993 set_int_prop(p, CP_PRINTPRIVACY, plevel);
2999 get_date_vals_from_ui(Props_pu *pu, Props *p) {
3000 if (XmToggleButtonGadgetGetState(pu->dfp_order_mmddyy_toggle))
3001 set_int_prop(p, CP_DATEORDERING, (int)ORDER_MDY);
3002 else if (XmToggleButtonGadgetGetState(pu->dfp_order_ddmmyy_toggle))
3003 set_int_prop(p, CP_DATEORDERING, (int)ORDER_DMY);
3004 else if (XmToggleButtonGadgetGetState(pu->dfp_order_yymmdd_toggle))
3005 set_int_prop(p, CP_DATEORDERING, (int)ORDER_YMD);
3007 if (XmToggleButtonGadgetGetState(pu->dfp_sep_blank_toggle))
3008 set_int_prop(p, CP_DATESEPARATOR, (int)SEPARATOR_BLANK);
3009 else if (XmToggleButtonGadgetGetState(pu->dfp_sep_slash_toggle))
3010 set_int_prop(p, CP_DATESEPARATOR, (int)SEPARATOR_SLASH);
3011 else if (XmToggleButtonGadgetGetState(pu->dfp_sep_period_toggle))
3012 set_int_prop(p, CP_DATESEPARATOR, (int)SEPARATOR_DOT);
3013 else if (XmToggleButtonGadgetGetState(pu->dfp_sep_dash_toggle))
3014 set_int_prop(p, CP_DATESEPARATOR, (int)SEPARATOR_DASH);
3020 get_props_from_ui(Props_pu *pu, Props *p, int *redisplay_mask) {
3022 *redisplay_mask = 0;
3024 /* we only ever have to get the values for one of the categories,
3025 as changing the nanes causes the values for the existing
3026 category to be flushed. */
3028 switch(pu->last_props_pane) {
3030 if (get_display_vals_from_ui(pu, p) == True)
3033 *redisplay_mask |= (PROPS_REDO_EDITORS | PROPS_REDO_DISPLAY);
3035 case GROUP_ACCESS_PANE:
3036 if (get_gap_vals_from_ui(pu, p) == True)
3039 case PRINTER_OPS_PANE:
3040 if (get_printer_vals_from_ui(pu, p) == True)
3043 *redisplay_mask |= PROPS_REDO_PRINT_DIALOG;
3045 case DATE_FORMAT_PANE:
3046 if (get_date_vals_from_ui(pu, p) == True)
3049 *redisplay_mask |= (PROPS_REDO_EDITORS | PROPS_REDO_DISPLAY);
3052 if (get_editor_vals_from_ui(pu, p) == True)
3055 *redisplay_mask |= PROPS_REDO_EDITORS;
3063 set_editor_vals_on_ui(Props_pu *pu, Props *p) {
3065 char buf[MAXNAMELEN];
3069 set_dssw_defaults(&pu->ep_dssw, now(), True);
3070 XtVaGetValues(pu->ep_dur_cb, XmNtextField, &text, NULL);
3072 sprintf(buf, "%d", get_int_prop(p, CP_APPTDURATION));
3073 XmTextSetString(text, buf);
3076 val = &pu->ep_reminders.beep_val;
3077 val->selected = convert_boolean_str(get_char_prop(p, CP_BEEPON));
3078 val->scope = convert_time_scope_str(get_char_prop(p, CP_BEEPUNIT));
3079 val->scope_val = get_int_prop(p, CP_BEEPADV);
3081 val = &pu->ep_reminders.flash_val;
3082 val->selected = convert_boolean_str(get_char_prop(p, CP_FLASHON));
3083 val->scope = convert_time_scope_str(get_char_prop(p, CP_FLASHUNIT));
3084 val->scope_val = get_int_prop(p, CP_FLASHADV);
3086 val = &pu->ep_reminders.popup_val;
3087 val->selected = convert_boolean_str(get_char_prop(p, CP_OPENON));
3088 val->scope = convert_time_scope_str(get_char_prop(p, CP_OPENUNIT));
3089 val->scope_val = get_int_prop(p, CP_OPENADV);
3091 val = &pu->ep_reminders.mail_val;
3092 val->selected = convert_boolean_str(get_char_prop(p, CP_MAILON));
3093 val->scope = convert_time_scope_str(get_char_prop(p, CP_MAILUNIT));
3094 val->scope_val = get_int_prop(p, CP_MAILADV);
3095 strcpy(pu->ep_reminders.mailto_val, get_char_prop(p, CP_MAILTO));
3097 set_reminders_vals(&pu->ep_reminders, False);
3099 i = convert_privacy_str_to_op(get_char_prop(p, CP_PRIVACY));
3100 XtVaSetValues(pu->privacy_menu, XmNselectedPosition, i + 1, NULL);
3104 set_display_vals_on_ui(Props_pu *pu, Props *p) {
3105 XmTextSetString(pu->dp_loc_text, get_char_prop(p, CP_CALLOC));
3107 XtVaSetValues(pu->dp_beg_scale, XmNvalue, get_int_prop(p, CP_DAYBEGIN),
3109 set_scale_value(pu->dp_beg_value, get_int_prop(p, CP_DAYBEGIN), pu);
3111 XtVaSetValues(pu->dp_end_scale, XmNvalue, get_int_prop(p, CP_DAYEND),
3113 set_scale_value(pu->dp_end_value, get_int_prop(p, CP_DAYEND), pu);
3115 XmToggleButtonGadgetSetState((get_int_prop(p, CP_DEFAULTDISP) == HOUR12)
3116 ? pu->dp_hour12_toggle : pu->dp_hour24_toggle, True, True);
3118 switch(get_int_prop(p, CP_DEFAULTVIEW)) {
3120 XmToggleButtonGadgetSetState(pu->dp_view_day_toggle,
3124 XmToggleButtonGadgetSetState(pu->dp_view_week_toggle,
3128 XmToggleButtonGadgetSetState(pu->dp_view_year_toggle,
3133 XmToggleButtonGadgetSetState(pu->dp_view_month_toggle,
3138 XmTextSetString(pu->dp_init_view_text, get_char_prop(p, CP_DEFAULTCAL));
3142 set_gap_vals_on_ui(Props_pu *pu, Props *p) {
3145 CSA_return_code stat;
3147 CSA_access_list step = NULL, holder = NULL, last;
3149 cal = allocate_cal_struct(appt_read,
3150 pu->cal->my_cal_version,
3151 CSA_CAL_ATTR_ACCESS_LIST_I,
3153 stat = query_cal_struct(pu->cal->my_cal_handle, cal);
3154 backend_err_msg(pu->frame, pu->cal->calname, stat, pu->xm_error_pixmap);
3155 if (stat != CSA_SUCCESS) {
3156 free_cal_struct(&cal);
3159 pu->gap_list = cal->access_list->value->item.access_list_value;
3160 cal->access_list->value->item.access_list_value = NULL;
3162 XmListDeleteAllItems(pu->gap_access_list);
3163 step = pu->gap_list;
3165 if (pu->cal->my_cal_version < DATAVER4) {
3166 p_str = p_gap_create_perm_str(step->rights);
3167 p_gap_create_entry_string(pu, step->user->user_name,
3171 xmstr = XmStringCreateLocalized(step->user->user_name);
3173 XmListAddItem(pu->gap_access_list, xmstr, 0);
3174 XmStringFree(xmstr);
3177 free_cal_struct(&cal);
3181 valid_margin_str(Props_pu *pu, char *str)
3185 XmConvertStringToUnits(XtScreen(pu->pop_margin_frame),
3186 str, XmHORIZONTAL, XmINCHES, &badStr);
3188 return (Boolean)!badStr;
3192 set_printer_vals_on_ui(Props_pu *pu, Props *p) {
3195 _DtPrintSetMarginSpec(pu->pop_left_text,
3196 get_char_prop(p, CP_PRINTLMARGIN));
3198 _DtPrintSetMarginSpec(pu->pop_top_text,
3199 get_char_prop(p, CP_PRINTTMARGIN));
3201 _DtPrintSetMarginSpec(pu->pop_right_text,
3202 get_char_prop(p, CP_PRINTRMARGIN));
3204 _DtPrintSetMarginSpec(pu->pop_bottom_text,
3205 get_char_prop(p, CP_PRINTBMARGIN));
3207 _DtPrintSetHdrFtrByIndex(pu->pop_tl_option,
3208 get_int_prop(p, CP_PRINTLHEADER));
3210 _DtPrintSetHdrFtrByIndex(pu->pop_tr_option,
3211 get_int_prop(p, CP_PRINTRHEADER));
3213 _DtPrintSetHdrFtrByIndex(pu->pop_bl_option,
3214 get_int_prop(p, CP_PRINTLFOOTER));
3216 _DtPrintSetHdrFtrByIndex(pu->pop_br_option,
3217 get_int_prop(p, CP_PRINTRFOOTER));
3220 ** For backward compatability with the XView toggles (which used or'd
3221 ** values) - we must continue ...
3223 plevel = get_int_prop(p, CP_PRINTPRIVACY);
3224 if (plevel & PRINT_PUBLIC)
3225 XmToggleButtonGadgetSetState(pu->pop_privacy_public_toggle,
3227 if (plevel & PRINT_SEMIPRIVATE)
3228 XmToggleButtonGadgetSetState(pu->pop_privacy_semi_toggle,
3230 if (plevel & PRINT_PRIVATE)
3231 XmToggleButtonGadgetSetState(pu->pop_privacy_private_toggle,
3236 set_date_vals_on_ui(Props_pu *pu, Props *p) {
3237 SeparatorType st = get_int_prop(p, CP_DATESEPARATOR);
3238 OrderingType ot = get_int_prop(p, CP_DATEORDERING);
3242 XmToggleButtonGadgetSetState(pu->dfp_order_mmddyy_toggle,
3246 XmToggleButtonGadgetSetState(pu->dfp_order_ddmmyy_toggle,
3251 XmToggleButtonGadgetSetState(pu->dfp_order_yymmdd_toggle,
3257 case SEPARATOR_BLANK:
3258 XmToggleButtonGadgetSetState(pu->dfp_sep_blank_toggle,
3261 case SEPARATOR_SLASH:
3262 XmToggleButtonGadgetSetState(pu->dfp_sep_slash_toggle,
3266 XmToggleButtonGadgetSetState(pu->dfp_sep_period_toggle,
3269 case SEPARATOR_DASH:
3270 XmToggleButtonGadgetSetState(pu->dfp_sep_dash_toggle,
3277 set_props_on_ui(Props_pu *pu, Props *p) {
3278 set_editor_vals_on_ui(pu, p);
3279 set_display_vals_on_ui(pu, p);
3280 set_gap_vals_on_ui(pu, p);
3281 set_printer_vals_on_ui(pu, p);
3282 set_date_vals_on_ui(pu, p);
3289 show_props_pu(Calendar *c) {
3290 Props *p = (Props *)c->properties;
3291 Props_pu *pu = (Props_pu *)c->properties_pu;
3303 if (!props_pu_showing(pu))
3305 set_props_on_ui(pu, p);
3306 XtManageChild(pu->base_form_mgr);
3308 /* Center Category menu */
3309 p_gap_center_cat_menu(pu->pane_list[pu->last_props_pane],
3313 /* reset default values. takes care of 7:00/9:00 start problem */
3314 p_defaults_proc_helper(c);
3316 XtPopup(pu->frame, XtGrabNone);
3320 show_print_props_pu(Calendar *c)
3322 Props *p = (Props *)c->properties;
3323 Props_pu *pu = (Props_pu *)c->properties_pu;
3330 activate_ui(pu, PRINTER_OPS_PANE);
3332 if (!props_pu_showing(pu))
3334 set_props_on_ui(pu, p);
3335 XtManageChild(pu->base_form_mgr);
3337 /* Center Category menu */
3338 p_gap_center_cat_menu(pu->pane_list[pu->last_props_pane],
3344 props_pu_clean_up(Props_pu *p) {
3347 p->pane_list = NULL;
3351 props_pu_showing(Props_pu *p) {
3352 if (p && p->base_form_mgr)
3353 return XtIsManaged(p->base_form_mgr);
3358 p_gap_clear_toggles(Props_pu *p)
3362 * V5DEP: If this is a V5 server w/V1 backing store probably
3363 * should use old access flags.
3365 if (p->cal->my_cal_version >= DATAVER4) {
3366 XmToggleButtonGadgetSetState(p->gap2_public_tog[GAP_VIEW],
3368 XmToggleButtonGadgetSetState(p->gap2_public_tog[GAP_INSERT],
3370 XmToggleButtonGadgetSetState(p->gap2_public_tog[GAP_CHANGE],
3372 XmToggleButtonGadgetSetState(p->gap2_semi_tog[GAP_VIEW],
3374 XmToggleButtonGadgetSetState(p->gap2_semi_tog[GAP_INSERT],
3376 XmToggleButtonGadgetSetState(p->gap2_semi_tog[GAP_CHANGE],
3378 XmToggleButtonGadgetSetState(p->gap2_private_tog[GAP_VIEW],
3380 XmToggleButtonGadgetSetState(p->gap2_private_tog[GAP_INSERT],
3382 XmToggleButtonGadgetSetState(p->gap2_private_tog[GAP_CHANGE],
3385 XmToggleButtonGadgetSetState(p->gap_browse_toggle,
3387 XmToggleButtonGadgetSetState(p->gap_insert_toggle,
3389 XmToggleButtonGadgetSetState(p->gap_delete_toggle,
3395 p_gap_center_cat_menu(
3399 Dimension frame_width, menu_width;
3401 XtVaGetValues(frame, XmNwidth, &frame_width, NULL);
3402 XtVaGetValues(menu, XmNwidth, &menu_width, NULL);
3404 XtVaSetValues(menu, XmNleftOffset, frame_width/2 - menu_width/2,