Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtappbuilder / src / ab / pal_label.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
23
24 /*
25  *      $XConsortium: pal_label.c /main/5 1996/08/08 18:01:43 mustafa $
26  *
27  * @(#)pal_label.c      1.74 11 Aug 1995      cde_app_builder/src/ab
28  *
29  *      RESTRICTED CONFIDENTIAL INFORMATION:
30  *
31  *      The information in this document is subject to special
32  *      restrictions in a confidential disclosure agreement between
33  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
34  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
35  *      Sun's specific written approval.  This document and all copies
36  *      and derivative works thereof must be returned or destroyed at
37  *      Sun's request.
38  *
39  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
40  *
41  */
42
43
44 /*
45  * pal_label.c - Implements Palette Label object functionality
46  */
47 #include <stdio.h>
48 #include <Xm/Xm.h>
49 #include <ab_private/ab.h>
50 #include <ab_private/abobj.h>
51 #include <ab_private/abobj_set.h>
52 #include <ab_private/pal.h>
53 #include <ab_private/prop.h>
54 #include <ab_private/ui_util.h>
55 #include "label_ui.h"
56
57
58 typedef struct  PROP_LABEL_SETTINGS
59 {
60     Widget                      prop_sheet;
61     PropFieldSettingRec         name;
62     PropOptionsSettingRec       label_type;
63     PropFieldSettingRec         label;
64     PropOptionsSettingRec       label_align;
65     PropRadioSettingRec         size_policy;
66     PropGeometrySettingRec      geometry;
67     PropCheckboxSettingRec      init_state;
68     PropColorSettingRec         bg_color;
69     PropColorSettingRec         fg_color;
70     ABObj                       current_obj;
71 } PropLabelSettingsRec, *PropLabelSettings;
72
73 /*************************************************************************
74 **                                                                      **
75 **       Private Function Declarations                                  **
76 **                                                                      **
77 **************************************************************************/
78 /*
79  * Methods
80  */
81 static int      label_initialize(
82                     ABObj   obj
83                 );
84 static Widget   label_prop_init(
85                     Widget  parent,
86                     AB_PROP_TYPE type
87                 );
88 static int      label_prop_activate(
89                     AB_PROP_TYPE type,
90                     BOOL         active
91                 );
92 static int      label_prop_clear(
93                     AB_PROP_TYPE type
94                 );
95 static int      label_prop_load(
96                     ABObj        obj,
97                     AB_PROP_TYPE type,
98                     unsigned long loadkey
99                 );
100 static int      label_prop_apply(
101                     AB_PROP_TYPE type
102                 );
103 static BOOL     label_prop_pending(
104                     AB_PROP_TYPE type
105                 );
106
107 static BOOL     verify_props(
108                     AB_PROP_TYPE type
109                 );
110 static void     turnoff_changebars(
111                     AB_PROP_TYPE type
112                 );
113
114 /*
115  * Xt Callbacks
116  */
117 static void     size_policyCB(
118                     Widget      widget,
119                     XtPointer   clientdata,
120                     XmToggleButtonCallbackStruct *state
121                 );
122
123
124 /*************************************************************************
125 **                                                                      **
126 **       Data                                                            **
127 **                                                                      **
128 **************************************************************************/
129 PalItemInfo label_palitem_rec = {
130
131     /* type             */  AB_TYPE_LABEL,
132     /* name             */  "Label",
133     /* animation pixmaps*/  NULL,
134     /* number of pixmaps*/  0,
135     /* rev_prop_frame   */  NULL,
136     /* fix_prop_dialog  */  NULL,
137     /* initialize       */  label_initialize,
138     /* is_a_test        */  obj_is_label,
139     /* prop_initialize  */  label_prop_init,
140     /* prop_activate    */  label_prop_activate,
141     /* prop_clear       */  label_prop_clear,
142     /* prop_load        */  label_prop_load,
143     /* prop_apply       */  label_prop_apply,
144     /* prop_pending     */  label_prop_pending
145
146 };
147
148 PalItemInfo *ab_label_palitem = &label_palitem_rec;
149 PropLabelSettingsRec prop_label_settings_rec[AB_PROP_TYPE_NUM_VALUES];
150
151
152 /*************************************************************************
153 **                                                                      **
154 **       Function Definitions                                           **
155 **                                                                      **
156 **************************************************************************/
157 static int
158 label_initialize(
159     ABObj    obj
160 )
161 {
162     obj_set_unique_name(obj, "label");
163
164     obj_set_label(obj, catgets(Dtb_project_catd, 6, 69, "Label"));
165     obj_set_is_initially_visible(obj, True);
166     obj_set_is_initially_active(obj, True);
167
168     obj_set_attachment(obj, AB_CP_NORTH, AB_ATTACH_POINT, NULL, obj->y);
169     obj_set_attachment(obj, AB_CP_WEST,  AB_ATTACH_POINT, NULL, obj->x);
170
171     return OK;
172
173 }
174
175 static Widget
176 label_prop_init(
177     Widget parent,
178     AB_PROP_TYPE type
179 )
180 {
181     DtbLabelPropDialogInfoRec   rev_label_prop_dialog; /* Revolving Props */
182     DtbLabelPropDialogInfo      cgen = &dtb_label_prop_dialog; /* Codegen structure */
183     DtbRevolvPropDialogInfo     rpd = &(dtb_revolv_prop_dialog);
184     PropLabelSettingsRec        *pls = &(prop_label_settings_rec[type]);
185     Widget                      item[6];
186     int                         item_val[6];
187     int                         n;
188     int                         i;
189
190     if (type == AB_PROP_REVOLVING)
191     {
192         /* Cloning Trick:
193          * Only the Attributes ControlPanel needs to be created within
194          * the existing Revolving Prop dialog, so fill out all other
195          * fields with the Revolving Prop dialog equivelents, so the
196          * dtb initialize proc will skip those non-NULL fields...
197          */
198         dtbLabelPropDialogInfo_clear(&rev_label_prop_dialog);
199
200         cgen = &(rev_label_prop_dialog);
201         cgen->prop_dialog = rpd->prop_dialog;
202         cgen->prop_dialog_shellform = rpd->prop_dialog_shellform;
203         cgen->prop_dialog_panedwin = rpd->prop_dialog_panedwin;
204         cgen->prop_dialog_form = rpd->prop_dialog_form;
205         cgen->objlist_panel = rpd->objlist_panel;
206         cgen->objlist_label = rpd->objlist_label2;
207         cgen->objlist_scrolledwin = rpd->objlist_scrolledwin;
208         cgen->objlist = rpd->objlist;
209         cgen->attrs_ctrlpanel_frame = rpd->attrs_ctrlpanel_frame;
210         cgen->activate_panel = rpd->activate_panel;
211         cgen->apply_button = rpd->apply_button;
212         cgen->ok_button = rpd->ok_button;
213         cgen->cancel_button = rpd->cancel_button;
214         cgen->reset_button = rpd->reset_button;
215         cgen->help_button = rpd->help_button;
216
217     }
218     else /* AB_PROP_FIXED - create entire dialog */
219         cgen = &dtb_label_prop_dialog;
220
221
222     if (dtb_label_prop_dialog_initialize(cgen, parent) == 0)
223     {
224         pls->prop_sheet = cgen->attrs_ctrlpanel;
225         pls->current_obj = NULL;
226
227         if (type == AB_PROP_REVOLVING)
228                 XtVaSetValues(parent,
229                         XmNuserData, pls->current_obj,
230                         NULL);
231
232         /* Dialog/Object List */
233         if (type == AB_PROP_FIXED)
234         {
235             prop_fixed_dialog_init(ab_label_palitem,
236                         cgen->prop_dialog_shellform, cgen->objlist);
237             prop_activate_panel_init(type, ab_label_palitem,
238                         cgen->ok_button, cgen->apply_button,
239                         cgen->reset_button, cgen->cancel_button,
240                         cgen->help_button);
241         }
242
243         /* Alternate Editor Buttons */
244         prop_editors_panel_init(type, ab_label_palitem,
245             cgen->attach_button, cgen->conn_button, cgen->helptxt_button);
246
247         /*
248           * Prop Sheet Settings....
249          */
250
251         /* Name */
252         prop_field_init(&(pls->name), cgen->name_field_label,
253                 cgen->name_field, cgen->name_cb);
254
255         /* Label Type */
256         n = 0;
257         item[n] = cgen->labeltype_rbox_items.String_item;
258         item_val[n] = AB_LABEL_STRING; n++;
259         item[n] = cgen->labeltype_rbox_items.Graphic_item;
260         item_val[n] = AB_LABEL_GLYPH; n++;
261         prop_options_init(&(pls->label_type), cgen->labeltype_rbox_label,
262                         cgen->labeltype_rbox, cgen->labeltype_rbox_menu,
263                         n, item, (XtPointer*)item_val,
264                         cgen->labeltype_cb);
265
266         /* Label */
267         prop_field_init(&(pls->label), cgen->label_label, cgen->label_textpane,
268                 cgen->label_cb);
269
270         prop_label_field_init(&(pls->label), cgen->graphic_hint, item, n);
271
272         /* Label Align */
273         n = 0;
274         item[n] = cgen->labelalign_opmenu_items.Left_item;
275         item_val[n] = AB_ALIGN_LEFT; n++;
276         item[n] = cgen->labelalign_opmenu_items.Centered_item;
277         item_val[n] = AB_ALIGN_CENTER; n++;
278         item[n] = cgen->labelalign_opmenu_items.Right_item;
279         item_val[n] = AB_ALIGN_RIGHT; n++;
280         prop_options_init(&(pls->label_align), cgen->labelalign_opmenu_label,
281                 cgen->labelalign_opmenu, cgen->labelalign_opmenu_menu,
282                 n, item, (XtPointer*)item_val,
283                 cgen->labelalign_cb);
284
285         /* Size Policy */
286         n = 0;
287         item[n] = cgen->szpolicy_rbox_items.Size_of_Label_item;
288         item_val[n] = SIZE_OF_CONTENTS_KEY; n++;
289         item[n] = cgen->szpolicy_rbox_items.Fixed_item;
290         item_val[n] = SIZE_FIXED_KEY; n++;
291         prop_radiobox_init(&(pls->size_policy), cgen->szpolicy_rbox_label,
292                 cgen->szpolicy_rbox, n, item, (XtPointer*)item_val,
293                 cgen->szpolicy_cb);
294
295         for(i=0; i < n; i++)
296             XtAddCallback(item[i], XmNvalueChangedCallback,
297                         (XtCallbackProc)prop_size_policyCB, (XtPointer)&(pls->geometry));
298
299
300         /* Geometry */
301         prop_geomfield_init(&(pls->geometry), cgen->geom_label,
302                 cgen->x_field_label, cgen->x_field,
303                 cgen->y_field_label, cgen->y_field,
304                 cgen->width_field_label, cgen->width_field,
305                 cgen->height_field_label, cgen->height_field,
306                 cgen->geom_cb);
307
308         /* Initial State */
309         n = 0;
310         item[n] = cgen->istate_ckbox_items.Visible_item;
311         item_val[n] = AB_STATE_VISIBLE; n++;
312         item[n] = cgen->istate_ckbox_items.Active_item;
313         item_val[n] = AB_STATE_ACTIVE; n++;
314         prop_checkbox_init(&(pls->init_state), cgen->istate_ckbox_label,
315                 cgen->istate_ckbox, n, item, item_val,
316                 cgen->istate_cb);
317
318         /* Background */
319         prop_colorfield_init(&(pls->bg_color), cgen->bg_mbutton,
320                 cgen->bg_mbutton_bg_mbutton_menu_items.None_item,
321                 cgen->bg_mbutton_bg_mbutton_menu_items.Color_Chooser_item,
322                 cgen->bg_swatch, cgen->bg_field, cgen->bg_cb);
323
324         /* Foreground */
325         prop_colorfield_init(&(pls->fg_color), cgen->fg_mbutton,
326                 cgen->fg_mbutton_fg_mbutton_menu_items.None_item,
327                 cgen->fg_mbutton_fg_mbutton_menu_items.Color_Chooser_item,
328                 cgen->fg_swatch, cgen->fg_field, cgen->fg_cb);
329
330         prop_changebars_cleared(pls->prop_sheet);
331
332         return (cgen->prop_dialog_shellform);
333     }
334     else
335         return NULL;
336
337 }
338
339 static int
340 label_prop_activate(
341     AB_PROP_TYPE type,
342     BOOL         active
343 )
344 {
345     ui_set_active(prop_label_settings_rec[type].prop_sheet, active);
346
347     return OK;
348 }
349
350
351 static int
352 label_prop_clear(
353     AB_PROP_TYPE type
354 )
355 {
356     PropLabelSettingsRec        *pls = &(prop_label_settings_rec[type]);
357
358     if (pls->current_obj == NULL)
359         return OK;
360
361     /* Clear Name */
362     prop_field_set_value(&(pls->name), "", False);
363
364     /* Clear LabelType */
365     prop_options_set_value(&(pls->label_type), (XtPointer)AB_LABEL_STRING, False);
366     ui_set_active(pls->label.field, True);
367     ui_set_active(pls->label.label, True);
368
369     /* Clear Label */
370     ui_set_label_string(pls->label.label, (STRING)LabelForString);
371     prop_field_set_value(&(pls->label), "", False);
372
373     /* Clear Label Alignment */
374     prop_options_set_value(&(pls->label_align), (XtPointer)AB_ALIGN_CENTER, False);
375
376     /* Clear Geometry */
377     prop_geomfield_clear(&(pls->geometry), GEOM_X);
378     prop_geomfield_clear(&(pls->geometry), GEOM_Y);
379     prop_geomfield_clear(&(pls->geometry), GEOM_WIDTH);
380     prop_geomfield_clear(&(pls->geometry), GEOM_HEIGHT);
381
382     /* Clear Size Policy */
383     prop_radiobox_set_value(&(pls->size_policy),
384                             (XtPointer)SIZE_OF_CONTENTS_KEY, False);
385
386     /* Clear Initial State */
387     prop_checkbox_set_value(&(pls->init_state), AB_STATE_VISIBLE, True, False);
388     prop_checkbox_set_value(&(pls->init_state), AB_STATE_ACTIVE, True, False);
389
390     /* Clear Background Color */
391     prop_colorfield_set_value(&(pls->bg_color), "", False);
392
393     /* Clear Foreground Color */
394     prop_colorfield_set_value(&(pls->fg_color), "", False);
395
396     pls->current_obj = NULL;
397
398     turnoff_changebars(type);
399
400     return OK;
401
402 }
403
404 static int
405 label_prop_load(
406     ABObjPtr     obj,
407     AB_PROP_TYPE type,
408     unsigned long loadkey
409 )
410 {
411     PropLabelSettingsRec        *pls = &(prop_label_settings_rec[type]);
412     BOOL                        load_all = (loadkey & LoadAll);
413
414     if (obj == NULL)
415     {
416         if (pls->current_obj != NULL)
417             obj = pls->current_obj;
418         else
419             return ERROR;
420     }
421     else if (!obj_is_label(obj))
422         return ERROR;
423     else
424         pls->current_obj = obj;
425
426     /* Load Name */
427     if (load_all || loadkey & LoadName)
428         prop_field_set_value(&(pls->name), obj_get_name(obj), False);
429
430     if (load_all)
431     {
432         /* Load Label */
433         prop_options_set_value(&(pls->label_type), (XtPointer)obj->label_type, False);
434         prop_setup_label_field(&(pls->label), NULL,
435                                 obj->label_type, obj_get_label(obj), AB_LINE_UNDEF);
436
437         /* Load Label Alignment */
438         prop_options_set_value(&(pls->label_align), (XtPointer)obj_get_label_alignment(obj), False);
439
440         /* Load Size Policy */
441         prop_radiobox_set_value(&(pls->size_policy),
442                                 abobj_width_resizable(obj)?
443                                 (XtPointer)SIZE_FIXED_KEY :
444                                 (XtPointer)SIZE_OF_CONTENTS_KEY, False);
445
446         /* Load Initial State */
447         prop_checkbox_set_value(&(pls->init_state), AB_STATE_VISIBLE,
448                 obj_is_initially_visible(obj), False);
449         prop_checkbox_set_value(&(pls->init_state), AB_STATE_ACTIVE,
450                 obj_is_initially_active(obj), False);
451
452         /* Load Color */
453         prop_colorfield_set_value(&(pls->bg_color), obj_get_bg_color(obj), False);
454         prop_colorfield_set_value(&(pls->fg_color), obj_get_fg_color(obj), False);
455
456         turnoff_changebars(type);
457     }
458
459     /* Load Geometry */
460     if (load_all || loadkey & LoadPosition)
461         prop_load_obj_position(obj, &(pls->geometry));
462
463     if (load_all || loadkey & LoadSize)
464         prop_load_obj_size(obj, &(pls->geometry));
465
466     return OK;
467 }
468
469 int
470 label_prop_apply(
471     AB_PROP_TYPE   type
472 )
473 {
474     PropLabelSettingsRec        *pls = &(prop_label_settings_rec[type]);
475     STRING                      value;
476     BOOL                        size_chg = False;
477     BOOL                        reset_bg = False;
478     BOOL                        reset_fg = False;
479     int                         new_w, new_h;
480
481     if (!verify_props(type))
482         return ERROR;
483
484     if (prop_changed(pls->name.changebar))
485     {
486         value = prop_field_get_value(&(pls->name));
487         abobj_set_name(pls->current_obj, value);
488         util_free(value);
489     }
490     if (prop_changed(pls->label.changebar) || prop_changed(pls->label_type.changebar))
491     {
492         value = prop_field_get_value(&(pls->label));
493         abobj_set_label(pls->current_obj,
494             (AB_LABEL_TYPE)prop_options_get_value(&(pls->label_type)),
495             value);
496         util_free(value);
497         size_chg = True;
498     }
499     if (prop_changed(pls->size_policy.changebar))
500     {
501         BOOL    fixed_size = prop_radiobox_get_value(
502                                 &(pls->size_policy)) == SIZE_FIXED_KEY;
503         /* If the label or label type hasn't changed and the
504          * label's size was set to "Fixed" and now is being
505          * changed to "Size of Label", then we have to re-
506          * instantiate the label along with setting the
507          * XmNrecomputeSize resource back to True, so that the
508          * label will resize itself correctly.  Otherwise, the
509          * resize won't take place.
510          */
511         if (!prop_changed(pls->label.changebar) &&
512             !prop_changed(pls->label_type.changebar) &&
513             (obj_get_width(pls->current_obj) != -1) && !fixed_size)
514         {
515             obj_clear_flag(pls->current_obj, InstantiatedFlag);
516         }
517
518         abobj_set_size_policy(pls->current_obj, fixed_size);
519         size_chg = True;
520     }
521     if (prop_changed(pls->geometry.changebar))
522     {
523         if (abobj_width_resizable(pls->current_obj))
524         {
525             new_w = prop_geomfield_get_value(&(pls->geometry), GEOM_WIDTH);
526             abobj_set_pixel_width(pls->current_obj, new_w, 0);
527         }
528         if (abobj_height_resizable(pls->current_obj))
529         {
530             new_h = prop_geomfield_get_value(&(pls->geometry), GEOM_HEIGHT);
531             abobj_set_pixel_height(pls->current_obj, new_h, 0);
532         }
533         if (abobj_is_movable(pls->current_obj))
534             abobj_set_xy(pls->current_obj,
535                 prop_geomfield_get_value(&(pls->geometry), GEOM_X),
536                 prop_geomfield_get_value(&(pls->geometry), GEOM_Y));
537
538         size_chg = True;
539     }
540     if (prop_changed(pls->init_state.changebar))
541     {
542         abobj_set_visible(pls->current_obj,
543                 prop_checkbox_get_value(&(pls->init_state), AB_STATE_VISIBLE));
544         abobj_set_active(pls->current_obj,
545                 prop_checkbox_get_value(&(pls->init_state), AB_STATE_ACTIVE));
546     }
547     if (prop_changed(pls->label_align.changebar))
548     {
549         abobj_set_label_alignment(pls->current_obj,
550                 (AB_ALIGNMENT)prop_options_get_value(&(pls->label_align)));
551         size_chg = True;
552     }
553     if (prop_changed(pls->fg_color.changebar))
554     {
555         value = prop_colorfield_get_value(&(pls->fg_color));
556         abobj_set_foreground_color(pls->current_obj, value);
557         if (util_strempty(value))
558             reset_fg = True;
559         util_free(value);
560         prop_colorfield_set_value(&(pls->fg_color), obj_get_fg_color(pls->current_obj), False);
561     }
562     if (prop_changed(pls->bg_color.changebar))
563     {
564         value = prop_colorfield_get_value(&(pls->bg_color));
565         abobj_set_background_color(pls->current_obj, value);
566         if (util_strempty(value))
567             reset_bg = True;
568         util_free(value);
569         prop_colorfield_set_value(&(pls->bg_color), obj_get_bg_color(pls->current_obj), False);
570     }
571
572     abobj_instantiate_changes(pls->current_obj);
573
574     if (reset_bg || reset_fg) /* Set back to No Color */
575         abobj_reset_colors(pls->current_obj, reset_bg, reset_fg);
576     if (size_chg)
577         abobj_force_dang_form_resize(pls->current_obj);
578
579     /* Label may have changed Size as a result...*/
580     prop_geomfield_set_value(&(pls->geometry), GEOM_WIDTH,
581                 abobj_get_comp_width(pls->current_obj), False);
582     prop_geomfield_set_value(&(pls->geometry), GEOM_HEIGHT,
583                 abobj_get_comp_height(pls->current_obj), False);
584
585     turnoff_changebars(type);
586
587     return OK;
588
589 }
590
591 static BOOL
592 label_prop_pending(
593     AB_PROP_TYPE type
594 )
595 {
596     return(prop_changebars_pending(prop_label_settings_rec[type].prop_sheet));
597 }
598
599 static BOOL
600 verify_props(
601     AB_PROP_TYPE type
602 )
603 {
604     PropLabelSettingsRec *pls = &(prop_label_settings_rec[type]);
605
606     if (prop_changed(pls->name.changebar) && !prop_name_ok(pls->current_obj, pls->name.field))
607         return False;
608
609     if ((prop_changed(pls->label_type.changebar) || prop_changed(pls->label.changebar)) &&
610         prop_options_get_value(&(pls->label_type)) == (XtPointer)AB_LABEL_GLYPH &&
611         !prop_graphic_filename_ok(pls->label.field, False))
612         return False;
613
614     if (prop_changed(pls->geometry.changebar) &&
615         (!prop_number_ok(pls->geometry.x_field, (STRING)XFieldStr,-SHRT_MAX, SHRT_MAX) ||
616          !prop_number_ok(pls->geometry.y_field, (STRING)YFieldStr,-SHRT_MAX, SHRT_MAX) ||
617          !prop_number_ok(pls->geometry.w_field, (STRING)WFieldStr, 1, SHRT_MAX) ||
618          !prop_number_ok(pls->geometry.h_field, (STRING)HFieldStr, 1, SHRT_MAX)))
619         return False;
620
621     if (prop_changed(pls->fg_color.changebar) && !prop_color_ok(pls->fg_color.field))
622         return False;
623
624     if (prop_changed(pls->bg_color.changebar) && !prop_color_ok(pls->bg_color.field))
625         return False;
626
627     return True;
628 }
629
630 static void
631 turnoff_changebars(
632     AB_PROP_TYPE type
633 )
634 {
635     PropLabelSettingsRec *pls = &(prop_label_settings_rec[type]);
636
637     prop_set_changebar(pls->name.changebar,     PROP_CB_OFF);
638     prop_set_changebar(pls->label_type.changebar,PROP_CB_OFF);
639     prop_set_changebar(pls->label.changebar,     PROP_CB_OFF);
640     prop_set_changebar(pls->label_align.changebar,PROP_CB_OFF);
641     prop_set_changebar(pls->geometry.changebar,         PROP_CB_OFF);
642     prop_set_changebar(pls->size_policy.changebar,      PROP_CB_OFF);
643     prop_set_changebar(pls->init_state.changebar,PROP_CB_OFF);
644     prop_set_changebar(pls->bg_color.changebar,  PROP_CB_OFF);
645     prop_set_changebar(pls->fg_color.changebar,  PROP_CB_OFF);
646
647     prop_changebars_cleared(pls->prop_sheet);
648
649 }
650
651 static void
652 size_policyCB(
653     Widget      w,
654     XtPointer   clientdata,
655     XmToggleButtonCallbackStruct *state
656 )
657 {
658     AB_PROP_TYPE                type = (AB_PROP_TYPE)clientdata;
659     PropLabelSettingsRec        *pls = &(prop_label_settings_rec[type]);
660     XtArgVal                    value;
661
662     /* Width/Height fields should ONLY be editable if Size Policy
663      * is "Fixed"
664      */
665     if (state->set)
666     {
667         XtVaGetValues(w, XmNuserData, &value, NULL);
668         ui_field_set_editable(pls->geometry.w_field, value == SIZE_FIXED_KEY);
669         ui_field_set_editable(pls->geometry.h_field, value == SIZE_FIXED_KEY);
670     }
671 }