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
24 * $XConsortium: pal_choice.c /main/5 1996/08/08 17:51:22 mustafa $
26 * @(#)pal_choice.c 1.40 15 Feb 1994 cde_app_builder/src/ab
28 * RESTRICTED CONFIDENTIAL INFORMATION:
30 * The information in this document is subject to special
31 * restrictions in a confidential disclosure agreement between
32 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
33 * document outside HP, IBM, Sun, USL, SCO, or Univel without
34 * Sun's specific written approval. This document and all copies
35 * and derivative works thereof must be returned or destroyed at
38 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
44 * pal_choice.c - Implements Choice object functionality
48 #include <ab_private/trav.h>
49 #include <ab_private/pal.h>
50 #include <ab_private/ab.h>
51 #include <ab_private/prop.h>
52 #include <ab_private/obj_notify.h>
53 #include <ab_private/abobj.h>
54 #include <ab_private/abobj_set.h>
55 #include <ab_private/abobj_edit.h>
56 #include <ab_private/ui_util.h>
57 #include "choice_ui.h"
60 typedef struct PROP_CHOICE_SETTINGS
63 PropFieldSettingRec name;
64 PropOptionsSettingRec choice_type;
65 PropGeometrySettingRec pos;
66 PropOptionsSettingRec label_type;
67 PropFieldSettingRec label;
68 PropOptionsSettingRec label_pos;
69 PropRadioSettingRec row_col;
70 PropFieldSettingRec row_col_count;
71 PropCheckboxSettingRec init_state;
72 PropColorSettingRec bg_color;
73 PropColorSettingRec fg_color;
74 PropFieldSettingRec item_label;
75 PropOptionsSettingRec item_label_type;
76 PropCheckboxSettingRec item_state;
77 PropItemsSettingRec items;
79 } PropChoiceSettingsRec, *PropChoiceSettings;
81 /*************************************************************************
83 ** Private Function Declarations **
85 **************************************************************************/
89 static int choice_initialize(
92 static Widget choice_prop_init(
96 static int choice_prop_activate(
100 static int choice_prop_load(
103 unsigned long loadkey
105 static int choice_prop_clear(
108 static int choice_prop_apply(
111 static BOOL choice_prop_pending(
116 static BOOL verify_props(
119 static void turnoff_changebars(
124 static void load_item(
128 static ABObj init_new_item(
131 static void change_item(
136 static void setup_type_settings(
138 AB_CHOICE_TYPE choice_type
145 XtPointer clientdata,
151 static int prop_choice_install_obj_destroy_CB(void);
153 static int prop_choice_obj_destroy_CB(
154 ObjEvDestroyInfo destroyInfo
157 /*************************************************************************
161 **************************************************************************/
162 PalItemInfo choice_palitem_rec = {
164 /* type */ AB_TYPE_CHOICE,
166 /* animation pixmaps*/ NULL,
167 /* number of pixmaps*/ 0,
168 /* rev_prop_frame */ NULL,
169 /* fix_prop_dialog */ NULL,
170 /* initialize */ choice_initialize,
171 /* is_a_test */ obj_is_choice,
172 /* prop_initialize */ choice_prop_init,
173 /* prop_active */ choice_prop_activate,
174 /* prop_clear */ choice_prop_clear,
175 /* prop_load */ choice_prop_load,
176 /* prop_apply */ choice_prop_apply,
177 /* prop_pending */ choice_prop_pending
181 PalItemInfo *ab_choice_palitem = &choice_palitem_rec;
182 PropChoiceSettingsRec prop_choice_settings_rec[AB_PROP_TYPE_NUM_VALUES];
184 /*************************************************************************
186 ** Function Definitions **
188 **************************************************************************/
194 AB_CHOICE_TYPE choice_type;
195 ABObj module = obj_get_module(obj);
200 choice_type = obj->info.choice.type;
204 case AB_CHOICE_NONEXCLUSIVE:
205 obj_set_unique_name(obj, "checkbox");
206 obj_set_label(obj, catgets(Dtb_project_catd, 100, 253, "Choice:"));
208 case AB_CHOICE_OPTION_MENU:
209 obj_set_unique_name(obj, "optionmenu");
210 obj_set_label(obj, catgets(Dtb_project_catd, 100, 254, "Options:"));
212 case AB_CHOICE_EXCLUSIVE:
214 obj_set_unique_name(obj, "radiobox");
215 obj_set_label(obj, catgets(Dtb_project_catd, 100, 253, "Choice:"));
219 obj_set_is_initially_visible(obj, True);
220 obj_set_is_initially_active(obj, True);
222 if (choice_type == AB_CHOICE_EXCLUSIVE)
223 obj_set_orientation(obj, AB_ORIENT_HORIZONTAL);
225 obj_set_orientation(obj, AB_ORIENT_VERTICAL);
227 obj_set_num_columns(obj, 1);
229 /* Add initial items to Choice */
230 items[0] = catgets(Dtb_project_catd, 6, 70, "itemA");
231 items[1] = catgets(Dtb_project_catd, 6, 71, "itemB");
232 for (i=0; i < XtNumber(items); i++)
234 iobj = obj_create(AB_TYPE_ITEM, NULL);
235 obj_append_child(obj, iobj);
236 obj_set_subtype(iobj, AB_ITEM_FOR_CHOICE);
237 iobj->label_type = AB_LABEL_STRING;
240 obj_set_is_initially_selected(iobj, True);
242 obj_set_is_initially_selected(iobj, False);
244 obj_set_is_initially_active(iobj, True);
245 abobj_set_item_name(iobj, obj_get_module(obj), obj_get_name(obj), items[i]);
246 obj_set_label(iobj, items[i]);
249 obj_set_attachment(obj, AB_CP_NORTH, AB_ATTACH_POINT, NULL, obj->y);
250 obj_set_attachment(obj, AB_CP_WEST, AB_ATTACH_POINT, NULL, obj->x);
262 DtbChoicePropDialogInfoRec rev_choice_prop_dialog; /* Revolving Props */
263 DtbChoicePropDialogInfo cgen; /* Codegen structure */
264 DtbRevolvPropDialogInfo rpd = &(dtb_revolv_prop_dialog);
265 PropChoiceSettingsRec *pcs = &(prop_choice_settings_rec[type]);
273 if (type == AB_PROP_REVOLVING)
276 * Only the Attributes ControlPanel needs to be created within
277 * the existing Revolving Prop dialog, so fill out all other
278 * fields with the Revolving Prop dialog equivelents, so the
279 * dtb initialize proc will skip those non-NULL fields...
281 dtbChoicePropDialogInfo_clear(&rev_choice_prop_dialog);
283 cgen = &(rev_choice_prop_dialog);
284 cgen->prop_dialog = rpd->prop_dialog;
285 cgen->prop_dialog_shellform = rpd->prop_dialog_shellform;
286 cgen->prop_dialog_panedwin = rpd->prop_dialog_panedwin;
287 cgen->prop_dialog_form = rpd->prop_dialog_form;
288 cgen->objlist_panel = rpd->objlist_panel;
289 cgen->objlist_label = rpd->objlist_label2;
290 cgen->objlist_scrolledwin = rpd->objlist_scrolledwin;
291 cgen->objlist = rpd->objlist;
292 cgen->attrs_ctrlpanel_frame = rpd->attrs_ctrlpanel_frame;
293 cgen->activate_panel = rpd->activate_panel;
294 cgen->apply_button = rpd->apply_button;
295 cgen->ok_button = rpd->ok_button;
296 cgen->cancel_button = rpd->cancel_button;
297 cgen->reset_button = rpd->reset_button;
298 cgen->help_button = rpd->help_button;
301 * Get notification of object destruction!
303 prop_choice_install_obj_destroy_CB();
306 else /* AB_PROP_FIXED */
307 cgen = &dtb_choice_prop_dialog;
309 if (dtb_choice_prop_dialog_initialize(cgen, parent) == 0)
311 pcs->prop_sheet = cgen->attrs_ctrlpanel;
312 pcs->current_obj = NULL;
314 if (type == AB_PROP_REVOLVING)
315 XtVaSetValues(parent,
316 XmNuserData, pcs->current_obj,
319 /* Dialog/Object List */
320 if (type == AB_PROP_FIXED)
322 prop_fixed_dialog_init(ab_choice_palitem,
323 cgen->prop_dialog_shellform, cgen->objlist);
324 prop_activate_panel_init(type, ab_choice_palitem,
325 cgen->ok_button, cgen->apply_button,
326 cgen->reset_button, cgen->cancel_button,
329 /* Alternate Editor Buttons */
330 prop_editors_panel_init(type, ab_choice_palitem,
331 cgen->attach_button, cgen->conn_button, cgen->helptxt_button);
334 * Prop Sheet Settings....
338 prop_field_init(&(pcs->name), cgen->name_field_label,
339 cgen->name_field, cgen->name_cb);
341 /* Label, Type, Position */
343 item[n] = cgen->labeltype_rbox_items.String_item;
344 item_val[n] = AB_LABEL_STRING; n++;
345 item[n] = cgen->labeltype_rbox_items.Graphic_item;
346 item_val[n] = AB_LABEL_GLYPH; n++;
347 prop_options_init(&(pcs->label_type), cgen->labeltype_rbox_label,
348 cgen->labeltype_rbox, cgen->labeltype_rbox_menu,
349 n, item, (XtPointer*)item_val, cgen->labeltype_cb);
351 prop_field_init(&(pcs->label), cgen->label_field_label,
352 cgen->label_field, cgen->label_cb);
354 prop_label_field_init(&(pcs->label), cgen->graphic_hint, item, n);
357 item[n] = cgen->labelpos_rbox_items.Above_item;
358 item_val[n] = AB_CP_NORTH; n++;
359 item[n] = cgen->labelpos_rbox_items.Left_item;
360 item_val[n] = AB_CP_WEST; n++;
361 prop_options_init(&(pcs->label_pos), cgen->labelpos_rbox_label,
362 cgen->labelpos_rbox, cgen->labelpos_rbox_menu,
363 n, item, (XtPointer*)item_val, cgen->labeltype_cb);
368 item[n] = cgen->choicetype_rbox_items.Radio_Box_item;
369 item_val[n] = AB_CHOICE_EXCLUSIVE; n++;
370 item[n] = cgen->choicetype_rbox_items.Check_Box_item;
371 item_val[n] = AB_CHOICE_NONEXCLUSIVE; n++;
372 item[n] = cgen->choicetype_rbox_items.Option_Menu_item;
373 item_val[n] = AB_CHOICE_OPTION_MENU; n++;
374 prop_options_init(&(pcs->choice_type), cgen->choicetype_rbox_label,
375 cgen->choicetype_rbox, cgen->choicetype_rbox_menu,
376 n, item, (XtPointer*)item_val,
377 cgen->choicetype_cb);
379 for (i=0; i < n; i++)
380 XtAddCallback(item[i], XmNactivateCallback, typeCB, (XtPointer)type);
384 item[n] = cgen->layout_rbox_items.Columns_item;
385 item_val[n] = AB_ORIENT_VERTICAL; n++;
386 item[n] = cgen->layout_rbox_items.Rows_item;
387 item_val[n] = AB_ORIENT_HORIZONTAL; n++;
388 prop_radiobox_init(&(pcs->row_col), cgen->layout_rbox_label,
390 n, item, (XtPointer*)item_val,
393 prop_field_init(&(pcs->row_col_count), NULL,
394 cgen->layout_field, cgen->layout_cb);
397 prop_geomfield_init(&(pcs->pos), cgen->pos_label,
398 cgen->x_field_label, cgen->x_field,
399 cgen->y_field_label, cgen->y_field,
400 NULL, NULL, NULL, NULL,
405 item[n] = cgen->istate_ckbox_items.Visible_item;
406 item_val[n] = AB_STATE_VISIBLE; n++;
407 item[n] = cgen->istate_ckbox_items.Active_item;
408 item_val[n] = AB_STATE_ACTIVE; n++;
409 prop_checkbox_init(&(pcs->init_state), cgen->istate_ckbox_label,
410 cgen->istate_ckbox, n, item, item_val,
414 prop_colorfield_init(&(pcs->bg_color), cgen->bg_mbutton,
415 cgen->bg_mbutton_bg_mbutton_menu_items.None_item,
416 cgen->bg_mbutton_bg_mbutton_menu_items.Color_Chooser_item,
417 cgen->bg_swatch, cgen->bg_field, cgen->bg_cb);
419 prop_colorfield_init(&(pcs->fg_color), cgen->fg_mbutton,
420 cgen->fg_mbutton_fg_mbutton_menu_items.None_item,
421 cgen->fg_mbutton_fg_mbutton_menu_items.Color_Chooser_item,
422 cgen->fg_swatch, cgen->fg_field, cgen->fg_cb);
426 /* Item Label Type */
428 item[n] = cgen->itemlabel_opmenu_items.String_item;
429 item_val[n] = AB_LABEL_STRING; n++;
430 item[n] = cgen->itemlabel_opmenu_items.Graphic_item;
431 item_val[n] = AB_LABEL_GLYPH; n++;
432 prop_options_init(&(pcs->item_label_type), cgen->itemlabel_type_label,
433 cgen->itemlabel_opmenu, cgen->itemlabel_opmenu_menu,
434 n, item, (XtPointer*)item_val, cgen->itemlist_cb);
437 XtAddCallback(item[i], XmNactivateCallback,
438 (XtCallbackProc)prop_item_labeltypeCB, (XtPointer)&(pcs->items));
441 prop_field_init(&(pcs->item_label), cgen->itemlabel_label,
442 cgen->itemlabel_field, cgen->itemlist_cb);
446 item[n] = cgen->itemstate_ckbox_items.Active_item;
447 item_val[n] = AB_STATE_ACTIVE; n++;
448 item[n] = cgen->itemstate_ckbox_items.Selected_item;
449 item_val[n] = AB_STATE_SELECTED; n++;
450 prop_checkbox_init(&(pcs->item_state), cgen->itemstate_label,
451 cgen->itemstate_ckbox, n, item, item_val,
454 /* Store Items->Add menu items in array */
456 item[n] = cgen->item_edit_mbutton_editmenu_items.Add_Before_item;
457 item_val[n] = INSERT_BEFORE; n++;
458 item[n] = cgen->item_edit_mbutton_editmenu_items.Add_After_item;
459 item_val[n] = INSERT_AFTER; n++;
461 /* Store Items->Edit menu items in array */
463 item2[j] = cgen->item_edit_mbutton_editmenu_items.Cut_item;
464 item2_val[j] = AB_EDIT_CUT; j++;
465 item2[j] = cgen->item_edit_mbutton_editmenu_items.Copy_item;
466 item2_val[j] = AB_EDIT_COPY; j++;
467 item2[j] = cgen->item_edit_mbutton_editmenu_items.Paste_item;
468 item2_val[j] = AB_EDIT_PASTE; j++;
469 item2[j] = cgen->item_edit_mbutton_editmenu_items.Delete_item;
470 item2_val[j] = AB_EDIT_DELETE; j++;
471 item2[j] = cgen->item_edit_mbutton_editmenu_items.Change_item;
472 item2_val[j] = EDIT_CHANGE; j++;
474 /* Hook up Item Editing mechanism to Item List */
475 prop_item_editor_init(&(pcs->items), AB_ITEM_FOR_CHOICE,
476 cgen->itemlist, cgen->itemlist_cb,
477 cgen->item_add_button,
478 n, item, item_val, /* Insert */
479 j, item2, item2_val,/* Edit */
480 &(pcs->item_label), &(pcs->item_label_type),
482 NULL, NULL, NULL, &(pcs->item_state), NULL,
483 &(pcs->current_obj));
485 prop_changebars_cleared(pcs->prop_sheet);
487 return (cgen->prop_dialog_shellform);
494 choice_prop_activate(
499 ui_set_active(prop_choice_settings_rec[type].prop_sheet, active);
509 PropChoiceSettingsRec *pcs = &(prop_choice_settings_rec[type]);
511 if (pcs->current_obj == NULL)
515 prop_field_set_value(&(pcs->name), "", False);
517 /* Clear Label Type/Position */
518 prop_options_set_value(&(pcs->label_type), (XtPointer)AB_LABEL_STRING, False);
519 prop_options_set_value(&(pcs->label_pos), (XtPointer)AB_CP_WEST, False);
522 ui_set_label_string(pcs->label.label, "Label:");
523 prop_field_set_value(&(pcs->label), "", False);
525 /* Clear Choice Type*/
526 prop_options_set_value(&(pcs->choice_type), (XtPointer)AB_CHOICE_EXCLUSIVE, False);
528 /* Clear Row/Columns */
529 prop_radiobox_set_value(&(pcs->row_col), (XtPointer)AB_ORIENT_HORIZONTAL, False);
530 prop_field_set_value(&(pcs->row_col_count), "", False);
533 prop_geomfield_clear(&(pcs->pos), GEOM_X);
534 prop_geomfield_clear(&(pcs->pos), GEOM_Y);
536 /* Clear Initial State */
537 prop_checkbox_set_value(&(pcs->init_state), AB_STATE_VISIBLE, True, False);
538 prop_checkbox_set_value(&(pcs->init_state), AB_STATE_ACTIVE, True, False);
541 prop_colorfield_set_value(&(pcs->bg_color), "", False);
542 prop_colorfield_set_value(&(pcs->fg_color), "", False);
545 prop_item_editor_clear(&(pcs->items));
547 pcs->current_obj = NULL;
549 turnoff_changebars(type);
559 unsigned long loadkey
562 PropChoiceSettingsRec *pcs = &(prop_choice_settings_rec[type]);
563 AB_CHOICE_TYPE ctype;
564 BOOL load_all = (loadkey & LoadAll);
568 if (pcs->current_obj != NULL)
569 obj = pcs->current_obj;
573 else if (!obj_is_choice(obj))
576 pcs->current_obj = obj;
579 if (load_all || loadkey & LoadName)
580 prop_field_set_value(&(pcs->name), obj_get_name(obj), False);
584 /* Load Label Type/Position */
585 prop_options_set_value(&(pcs->label_type), (XtPointer)obj->label_type, False);
586 prop_options_set_value(&(pcs->label_pos), (XtPointer)obj_get_label_position(obj), False);
589 prop_setup_label_field(&(pcs->label), NULL,
590 obj->label_type, obj_get_label(obj), AB_LINE_UNDEF);
591 /* Load Choice Type */
592 ctype = obj_get_choice_type(obj);
593 prop_options_set_value(&(pcs->choice_type), (XtPointer)ctype, False);
594 setup_type_settings(type, ctype);
597 prop_radiobox_set_value(&(pcs->row_col), (XtPointer)obj_get_orientation(obj), False);
598 prop_field_set_numeric_value(&(pcs->row_col_count), obj_get_num_columns(obj), False);
600 /* Load Initial State */
601 prop_checkbox_set_value(&(pcs->init_state), AB_STATE_VISIBLE,
602 obj_is_initially_visible(obj), False);
603 prop_checkbox_set_value(&(pcs->init_state), AB_STATE_ACTIVE,
604 obj_is_initially_active(obj), False);
607 prop_colorfield_set_value(&(pcs->bg_color), obj_get_bg_color(obj), False);
608 prop_colorfield_set_value(&(pcs->fg_color), obj_get_fg_color(obj), False);
610 /* Load Choice Items */
611 prop_item_editor_load(&(pcs->items), obj);
613 turnoff_changebars(type);
617 if (load_all || loadkey & LoadPosition)
618 prop_load_obj_position(obj, &(pcs->pos));
629 PropChoiceSettingsRec *pcs = &(prop_choice_settings_rec[type]);
631 BOOL size_chg = False;
632 BOOL reset_bg = False;
633 BOOL reset_fg = False;
635 if (!verify_props(type))
638 if (prop_changed(pcs->name.changebar))
640 value = prop_field_get_value(&(pcs->name));
641 abobj_set_name(pcs->current_obj, value);
644 if (prop_changed(pcs->label.changebar) ||
645 prop_changed(pcs->label_type.changebar))
647 value = prop_field_get_value(&(pcs->label));
649 abobj_set_label(pcs->current_obj,
650 (AB_LABEL_TYPE)prop_options_get_value(&(pcs->label_type)),
654 abobj_set_label_position(pcs->current_obj,
655 (AB_COMPASS_POINT)prop_options_get_value(&(pcs->label_pos)));
660 if (prop_changed(pcs->choice_type.changebar))
662 abobj_set_choice_type(pcs->current_obj,
663 (AB_CHOICE_TYPE)prop_options_get_value(&(pcs->choice_type)));
667 if (prop_changed(pcs->row_col.changebar))
670 abobj_set_orientation(pcs->current_obj,
671 (AB_ORIENTATION)prop_radiobox_get_value(&(pcs->row_col)));
672 cols = prop_field_get_numeric_value(&(pcs->row_col_count));
673 abobj_set_num_columns(pcs->current_obj, cols);
676 if (prop_changed(pcs->pos.changebar))
678 if (abobj_is_movable(pcs->current_obj))
679 abobj_set_xy(pcs->current_obj,
680 prop_geomfield_get_value(&(pcs->pos), GEOM_X),
681 prop_geomfield_get_value(&(pcs->pos), GEOM_Y));
683 if (prop_changed(pcs->init_state.changebar))
685 abobj_set_visible(pcs->current_obj,
686 prop_checkbox_get_value(&(pcs->init_state), AB_STATE_VISIBLE));
687 abobj_set_active(pcs->current_obj,
688 prop_checkbox_get_value(&(pcs->init_state), AB_STATE_ACTIVE));
690 if (prop_changed(pcs->fg_color.changebar))
692 value = prop_colorfield_get_value(&(pcs->fg_color));
693 abobj_set_foreground_color(pcs->current_obj, value);
694 if (util_strempty(value))
697 prop_colorfield_set_value(&(pcs->fg_color),
698 obj_get_fg_color(pcs->current_obj), False);
700 if (prop_changed(pcs->bg_color.changebar))
702 value = prop_colorfield_get_value(&(pcs->bg_color));
703 abobj_set_background_color(pcs->current_obj, value);
704 if (util_strempty(value))
707 prop_colorfield_set_value(&(pcs->bg_color),
708 obj_get_bg_color(pcs->current_obj), False);
710 if (prop_changed(pcs->items.changebar))
712 /* Ensure edits to current item are saved before apply */
713 prop_item_change(&(pcs->items), False);
714 prop_item_editor_apply(&(pcs->items));
717 if (prop_changed(pcs->choice_type.changebar))
719 abobj_set_choice_type(pcs->current_obj,
720 (AB_CHOICE_TYPE)prop_options_get_value(&(pcs->choice_type)));
724 abobj_tree_instantiate_changes(pcs->current_obj);
726 if (reset_bg || reset_fg) /* Set back to No Color */
731 abobj_reset_colors(pcs->current_obj, reset_bg, reset_fg);
733 /* Need to also reset the Item's colors also */
734 for (trav_open(&trav, pcs->current_obj, AB_TRAV_ITEMS);
735 (item = trav_next(&trav)) != NULL; )
737 abobj_reset_colors(item, reset_bg, reset_fg);
742 abobj_force_dang_form_resize(pcs->current_obj);
744 turnoff_changebars(type);
754 return(prop_changebars_pending(prop_choice_settings_rec[type].prop_sheet));
762 PropChoiceSettingsRec *pcs = &(prop_choice_settings_rec[type]);
764 if (prop_changed(pcs->name.changebar) &&
765 !prop_name_ok(pcs->current_obj, pcs->name.field))
768 if ((prop_changed(pcs->label_type.changebar) || prop_changed(pcs->label.changebar)) &&
769 (AB_BUILTIN_ACTION)prop_options_get_value(&(pcs->label_type)) == AB_LABEL_GLYPH &&
770 !prop_graphic_filename_ok(pcs->label.field, False))
773 if (prop_changed(pcs->row_col.changebar) &&
774 !prop_number_ok(pcs->row_col_count.field, "Row/Column Field", 1, 99))
777 if (prop_changed(pcs->pos.changebar) &&
778 (!prop_number_ok(pcs->pos.x_field, (STRING)XFieldStr, -SHRT_MAX, SHRT_MAX) ||
779 !prop_number_ok(pcs->pos.y_field, (STRING)YFieldStr, -SHRT_MAX, SHRT_MAX)))
782 if (prop_changed(pcs->fg_color.changebar) && !prop_color_ok(pcs->fg_color.field))
785 if (prop_changed(pcs->bg_color.changebar) && !prop_color_ok(pcs->bg_color.field))
796 PropChoiceSettingsRec *pcs = &(prop_choice_settings_rec[type]);
798 prop_set_changebar(pcs->name.changebar, PROP_CB_OFF);
799 prop_set_changebar(pcs->choice_type.changebar, PROP_CB_OFF);
800 prop_set_changebar(pcs->pos.changebar, PROP_CB_OFF);
801 prop_set_changebar(pcs->label_type.changebar, PROP_CB_OFF);
802 prop_set_changebar(pcs->label.changebar, PROP_CB_OFF);
803 prop_set_changebar(pcs->row_col.changebar, PROP_CB_OFF);
804 prop_set_changebar(pcs->init_state.changebar, PROP_CB_OFF);
805 prop_set_changebar(pcs->bg_color.changebar, PROP_CB_OFF);
806 prop_set_changebar(pcs->fg_color.changebar, PROP_CB_OFF);
807 prop_set_changebar(pcs->items.changebar, PROP_CB_OFF);
809 prop_changebars_cleared(pcs->prop_sheet);
816 AB_CHOICE_TYPE choice_type
819 PropChoiceSettingsRec *pcs = &(prop_choice_settings_rec[type]);
822 active = (!(choice_type == AB_CHOICE_OPTION_MENU));
823 ui_set_active(pcs->row_col.label, active);
824 ui_set_active(pcs->row_col.radiobox, active);
825 ui_set_active(pcs->row_col_count.field, active);
831 XtPointer clientdata,
835 AB_PROP_TYPE type = (AB_PROP_TYPE)clientdata;
836 AB_CHOICE_TYPE choice_type = AB_CHOICE_UNDEF;
838 XtVaGetValues(item, XmNuserData, &choice_type, NULL);
839 setup_type_settings(type, choice_type);
843 * Object destroy callback
846 prop_choice_install_obj_destroy_CB()
848 static BOOL callback_installed = False;
850 if (callback_installed)
854 obj_add_destroy_callback(prop_choice_obj_destroy_CB, "Choice Props");
859 prop_choice_obj_destroy_CB(ObjEvDestroyInfo destroyInfo)
862 ABObj doomedObj = destroyInfo->obj;
863 PropChoiceSettings pcs;
865 if (!obj_is_choice_item(doomedObj))
870 for (i = 0; i < AB_PROP_TYPE_NUM_VALUES; ++i)
872 pcs = &(prop_choice_settings_rec[i]);
874 if (pcs->current_obj == doomedObj)
875 pcs->current_obj = NULL;
876 if (pcs->items.current_item == doomedObj)
877 pcs->items.current_item = NULL;
878 if (pcs->items.clipboard_item == doomedObj)
879 pcs->items.clipboard_item = NULL;