Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtappbuilder / src / ab / pal_textf.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_textf.c /main/5 1996/08/08 18:04:36 mustafa $
26  *
27  * @(#)pal_textf.c      1.62 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_textf.c - Implements Palette TextField object functionality
46  */
47 #include <stdio.h>
48 #include <Xm/Xm.h>
49 #include <ab_private/pal.h>
50 #include <ab_private/ab.h>
51 #include <ab_private/prop.h>
52 #include <ab_private/abobj.h>
53 #include <ab_private/abobj_set.h>
54 #include <ab_private/ui_util.h>
55 #include "textf_ui.h"
56
57 typedef struct  PROP_TEXTF_SETTINGS
58 {
59     Widget                      prop_sheet;
60     PropFieldSettingRec         name;
61     PropGeometrySettingRec      pos;
62     PropGeometrySettingRec      size;
63     PropOptionsSettingRec       size_metric;
64     PropOptionsSettingRec       label_type;
65     PropFieldSettingRec         label;
66     PropOptionsSettingRec       label_pos;
67     PropRadioSettingRec         op;
68     PropFieldSettingRec         max_chars;
69     PropFieldSettingRec         init_value;
70     PropCheckboxSettingRec      init_state;
71     PropColorSettingRec         bg_color;
72     PropColorSettingRec         fg_color;
73 /*
74     PropMenunameSettingRec      menuname;
75 */
76     ABObj                       current_obj;
77 } PropTextfSettingsRec, *PropTextfSettings;
78
79 /*************************************************************************
80 **                                                                      **
81 **       Private Function Declarations                                  **
82 **                                                                      **
83 **************************************************************************/
84 /*
85  * Methods
86  */
87 static int      textf_initialize(
88                     ABObj   obj
89                 );
90 static Widget   textf_prop_init(
91                     Widget  parent,
92                     AB_PROP_TYPE type
93                 );
94 static int      textf_prop_activate(
95                     AB_PROP_TYPE type,
96                     BOOL         active
97                 );
98 static int      textf_prop_clear(
99                     AB_PROP_TYPE type
100                 );
101 static int      textf_prop_load(
102                     ABObj        obj,
103                     AB_PROP_TYPE type,
104                     unsigned long loadkey
105                 );
106 static int      textf_prop_apply(
107                     AB_PROP_TYPE type
108                 );
109 static BOOL     textf_prop_pending(
110                     AB_PROP_TYPE type
111                 );
112
113 static BOOL     verify_props(
114                     AB_PROP_TYPE type
115                 );
116 static void     turnoff_changebars(
117                     AB_PROP_TYPE type
118                 );
119
120 /*
121  * Xt Callbacks
122  */
123
124 /*************************************************************************
125 **                                                                      **
126 **       Data                                                            **
127 **                                                                      **
128 **************************************************************************/
129 PalItemInfo textf_palitem_rec = {
130
131     /* type             */  AB_TYPE_TEXT_FIELD,
132     /* name             */  "Text Field",
133     /* animation pixmaps*/  NULL,
134     /* number of pixmaps*/  0,
135     /* rev_prop_frame   */  NULL,
136     /* fix_prop_dialog  */  NULL,
137     /* initialize       */  textf_initialize,
138     /* is_a_test        */  obj_is_text_field,
139     /* prop_initialize  */  textf_prop_init,
140     /* prop_activate    */  textf_prop_activate,
141     /* prop_clear       */  textf_prop_clear,
142     /* prop_load        */  textf_prop_load,
143     /* prop_apply       */  textf_prop_apply,
144     /* prop_pending     */  textf_prop_pending
145
146 };
147
148 PalItemInfo *ab_textf_palitem = &textf_palitem_rec;
149 PropTextfSettingsRec prop_textf_settings_rec[AB_PROP_TYPE_NUM_VALUES];
150
151 /*************************************************************************
152 **                                                                      **
153 **       Function Definitions                                           **
154 **                                                                      **
155 **************************************************************************/
156 static int
157 textf_initialize(
158     ABObj    obj
159 )
160 {
161     AB_TEXT_INFO *info = &(obj->info.text);
162
163     obj_set_unique_name(obj, "textfield");
164
165     obj_set_label(obj, catgets(Dtb_project_catd, 100, 263, "TextField:"));
166     obj_set_is_initially_visible(obj, True);
167     obj_set_is_initially_active(obj, True);
168     obj_set_num_columns(obj, 8);
169     obj_set_max_length(obj, 80);
170
171     obj_set_attachment(obj, AB_CP_NORTH, AB_ATTACH_POINT, NULL, obj->y);
172     obj_set_attachment(obj, AB_CP_WEST,  AB_ATTACH_POINT, NULL, obj->x);
173
174     return OK;
175
176 }
177
178 static Widget
179 textf_prop_init(
180     Widget    parent,
181     AB_PROP_TYPE type
182 )
183 {
184     DtbTextfPropDialogInfoRec   rev_textf_prop_dialog; /* Revolving Props */
185     DtbTextfPropDialogInfo      cgen = &dtb_textf_prop_dialog; /* Codegen structure */
186     DtbRevolvPropDialogInfo     rpd = &(dtb_revolv_prop_dialog);
187     PropTextfSettingsRec        *pts = &(prop_textf_settings_rec[type]);
188     Widget                      item[10];
189     int                         item_val[10];
190     int                         n;
191
192     if (type == AB_PROP_REVOLVING)
193     {
194         /* Cloning Trick:
195          * Only the Attributes ControlPanel needs to be created within
196          * the existing Revolving Prop dialog, so fill out all other
197          * fields with the Revolving Prop dialog equivelents, so the
198          * dtb initialize proc will skip those non-NULL fields...
199          */
200         dtbTextfPropDialogInfo_clear(&rev_textf_prop_dialog);
201
202         cgen = &(rev_textf_prop_dialog);
203         cgen->prop_dialog = rpd->prop_dialog;
204         cgen->prop_dialog_shellform = rpd->prop_dialog_shellform;
205         cgen->prop_dialog_panedwin = rpd->prop_dialog_panedwin;
206         cgen->prop_dialog_form = rpd->prop_dialog_form;
207         cgen->objlist_panel = rpd->objlist_panel;
208         cgen->objlist_label = rpd->objlist_label2;
209         cgen->objlist_scrolledwin = rpd->objlist_scrolledwin;
210         cgen->objlist = rpd->objlist;
211         cgen->attrs_ctrlpanel_frame = rpd->attrs_ctrlpanel_frame;
212         cgen->activate_panel = rpd->activate_panel;
213         cgen->apply_button = rpd->apply_button;
214         cgen->ok_button = rpd->ok_button;
215         cgen->cancel_button = rpd->cancel_button;
216         cgen->reset_button = rpd->reset_button;
217         cgen->help_button = rpd->help_button;
218
219     }
220     else /* AB_PROP_FIXED */
221         cgen = &dtb_textf_prop_dialog;
222
223     if (dtb_textf_prop_dialog_initialize(cgen, parent) == 0)
224     {
225         pts->prop_sheet = cgen->attrs_ctrlpanel;
226         pts->current_obj = NULL;
227
228         if (type == AB_PROP_REVOLVING)
229                 XtVaSetValues(parent,
230                         XmNuserData, pts->current_obj,
231                         NULL);
232
233         /* Dialog/Object List */
234         if (type == AB_PROP_FIXED)
235         {
236             prop_fixed_dialog_init(ab_textf_palitem,
237                         cgen->prop_dialog_shellform, cgen->objlist);
238             prop_activate_panel_init(type, ab_textf_palitem,
239                         cgen->ok_button, cgen->apply_button,
240                         cgen->reset_button, cgen->cancel_button,
241                         cgen->help_button);
242         }
243
244         /* Alternate Editor Buttons */
245         prop_editors_panel_init(type, ab_textf_palitem,
246                     cgen->attach_button, cgen->conn_button, cgen->helptxt_button);
247
248         /*
249           * Prop Sheet Settings....
250          */
251
252         /* Name */
253         prop_field_init(&(pts->name), cgen->name_field_label,
254                             cgen->name_field, cgen->name_cb);
255
256         /* Label, Type, Position */
257         n = 0;
258         item[n] = cgen->labeltype_rbox_items.String_item;
259         item_val[n] = AB_LABEL_STRING; n++;
260         item[n] = cgen->labeltype_rbox_items.Graphic_item;
261         item_val[n] = AB_LABEL_GLYPH; n++;
262         prop_options_init(&(pts->label_type), cgen->labeltype_rbox_label,
263                         cgen->labeltype_rbox, cgen->labeltype_rbox_menu,
264                         n, item, (XtPointer*)item_val,
265                         cgen->labeltype_cb);
266
267         prop_field_init(&(pts->label), cgen->label_field_label,
268                 cgen->label_field, cgen->label_cb);
269         prop_label_field_init(&(pts->label), cgen->graphic_hint, item, n);
270
271         n = 0;
272         item[n] = cgen->labelpos_rbox_items.Left_item;
273         item_val[n] = AB_CP_WEST; n++;
274         item[n] = cgen->labelpos_rbox_items.Above_item;
275         item_val[n] = AB_CP_NORTH; n++;
276         prop_options_init(&(pts->label_pos), cgen->labelpos_rbox_label,
277                         cgen->labelpos_rbox, cgen->labelpos_rbox_menu,
278                         n, item, (XtPointer*)item_val,
279                         cgen->labeltype_cb);
280
281         /* Menu Name */
282 /*
283         prop_menuname_init(&(pts->menuname), cgen->menu_mbutton, cgen->menu_field,
284                         cgen->name_field, cgen->menu_cb,
285                         &(pts->current_obj), True);
286 */
287
288         /* Operation */
289         n = 0;
290         item[n] = cgen->op_rbox_items.Editable_item;
291         item_val[n] = False; n++;
292         item[n] = cgen->op_rbox_items.Read_Only_item;
293         item_val[n] = True; n++;
294         prop_radiobox_init(&(pts->op), cgen->op_rbox_label,
295                 cgen->op_rbox, n, item, (XtPointer*)item_val,
296                 cgen->op_cb);
297
298         /* Maximum Chars */
299         prop_field_init(&(pts->max_chars), cgen->charsmax_field_label,
300                             cgen->charsmax_field, cgen->charsmax_cb);
301
302         /* Initial Value */
303         prop_field_init(&(pts->init_value), cgen->ivalue_field_label,
304                             cgen->ivalue_field, cgen->ivalue_cb);
305
306         /* Position */
307         prop_geomfield_init(&(pts->pos), cgen->pos_label,
308                             cgen->x_field_label, cgen->x_field,
309                             cgen->y_field_label, cgen->y_field,
310                             NULL, NULL, NULL, NULL,
311                             cgen->pos_cb);
312
313         /* Width */
314         prop_geomfield_init(&(pts->size), cgen->width_opmenu_label,
315                             NULL, NULL, NULL, NULL,
316                             cgen->w_field_label, cgen->w_field,
317                             NULL, NULL,
318                             cgen->width_cb);
319
320         n = 0;
321         item[n] = cgen->width_opmenu_items.Characters_item;
322         item_val[n] = SIZE_IN_CHARS_KEY; n++;
323         item[n] = cgen->width_opmenu_items.Pixels_item;
324         item_val[n] = SIZE_IN_PIXELS_KEY; n++;
325         prop_options_init(&(pts->size_metric), cgen->width_opmenu_label,
326                            cgen->width_opmenu,
327                            cgen->width_opmenu_menu,
328                            n, item, (XtPointer*)item_val,
329                            cgen->width_cb);
330
331         /* Initial State */
332         n = 0;
333         item[n] = cgen->istate_ckbox_items.Visible_item;
334         item_val[n] = AB_STATE_VISIBLE; n++;
335         item[n] = cgen->istate_ckbox_items.Active_item;
336         item_val[n] = AB_STATE_ACTIVE; n++;
337         prop_checkbox_init(&(pts->init_state), cgen->istate_ckbox_label,
338                             cgen->istate_ckbox, n, item, item_val,
339                             cgen->istate_cb);
340
341         /* Color */
342         prop_colorfield_init(&(pts->bg_color), cgen->bg_mbutton,
343                 cgen->bg_mbutton_bg_mbutton_menu_items.None_item,
344                 cgen->bg_mbutton_bg_mbutton_menu_items.Color_Chooser_item,
345                 cgen->bg_swatch, cgen->bg_field, cgen->bg_cb);
346
347         prop_colorfield_init(&(pts->fg_color), cgen->fg_mbutton,
348                 cgen->fg_mbutton_fg_mbutton_menu_items.None_item,
349                 cgen->fg_mbutton_fg_mbutton_menu_items.Color_Chooser_item,
350                 cgen->fg_swatch, cgen->fg_field, cgen->fg_cb);
351
352         prop_changebars_cleared(pts->prop_sheet);
353
354         return (cgen->prop_dialog_shellform);
355     }
356     else
357         return NULL;
358
359 }
360
361 static int
362 textf_prop_activate(
363     AB_PROP_TYPE type,
364     BOOL         active
365 )
366 {
367     ui_set_active(prop_textf_settings_rec[type].prop_sheet, active);
368
369     return OK;
370 }
371
372
373 static int
374 textf_prop_clear(
375     AB_PROP_TYPE type
376 )
377 {
378     PropTextfSettingsRec        *pts = &(prop_textf_settings_rec[type]);
379
380     if (pts->current_obj == NULL)
381         return OK;
382
383     /* Clear Name */
384     prop_field_set_value(&(pts->name), "", False);
385
386     /* Clear Label Type/Position */
387     prop_options_set_value(&(pts->label_type), (XtPointer)AB_LABEL_STRING, False);
388     prop_options_set_value(&(pts->label_pos), (XtPointer)AB_CP_WEST, False);
389
390     /* Clear Label */
391     ui_set_label_string(pts->label.label, "Label:");
392     prop_field_set_value(&(pts->label), "", False);
393
394     /* Clear Menu Name */
395 /*
396     prop_menuname_set_value(&(pts->menuname), "", False);
397 */
398
399     /* Clear Operation */
400     prop_radiobox_set_value(&(pts->op), (XtPointer)False, False);
401
402     /* Clear Maximum Chars */
403     prop_field_set_value(&(pts->max_chars), "", False);
404
405     /* Clear Initial Value*/
406     prop_field_set_value(&(pts->init_value), "", False);
407
408     /* Clear Position */
409     prop_geomfield_clear(&(pts->pos), GEOM_X);
410     prop_geomfield_clear(&(pts->pos), GEOM_Y);
411
412     /* Clear Size */
413     prop_geomfield_clear(&(pts->size), GEOM_WIDTH);
414
415     /* Clear Initial State */
416     prop_checkbox_set_value(&(pts->init_state), AB_STATE_VISIBLE, True, False);
417     prop_checkbox_set_value(&(pts->init_state), AB_STATE_ACTIVE, True, False);
418
419     /* Clear Color */
420     prop_colorfield_set_value(&(pts->bg_color), "", False);
421     prop_colorfield_set_value(&(pts->fg_color), "", False);
422
423     pts->current_obj = NULL;
424
425     turnoff_changebars(type);
426
427     return OK;
428
429 }
430
431 static int
432 textf_prop_load(
433     ABObjPtr     obj,
434     AB_PROP_TYPE type,
435     unsigned long loadkey
436 )
437 {
438     PropTextfSettingsRec        *pts = &(prop_textf_settings_rec[type]);
439     int                         width;
440     BOOL                        load_all = (loadkey & LoadAll);
441
442     if (obj == NULL)
443     {
444         if (pts->current_obj != NULL)
445             obj = pts->current_obj;
446         else
447             return ERROR;
448     }
449     else if (!obj_is_text_field(obj))
450         return ERROR;
451     else
452         pts->current_obj = obj;
453
454     /* Load Name */
455     if (load_all || loadkey & LoadName)
456         prop_field_set_value(&(pts->name), obj_get_name(obj), False);
457
458     if (load_all)
459     {
460         /* Load Label Type/Position */
461         prop_options_set_value(&(pts->label_type), (XtPointer)obj->label_type, False);
462         prop_options_set_value(&(pts->label_pos), (XtPointer)obj_get_label_position(obj), False);
463
464         /* Load Label */
465         prop_setup_label_field(&(pts->label), NULL,
466                                 obj->label_type, obj_get_label(obj), AB_LINE_UNDEF);
467         /* Load Operation */
468         prop_radiobox_set_value(&(pts->op),
469                                 (XtPointer)obj_get_read_only(obj), False);
470
471         /* Load Maximum Chars */
472         prop_field_set_numeric_value(&(pts->max_chars), obj_get_max_length(obj), False);
473
474         /* Load Initial Value */
475         prop_field_set_value(&(pts->init_value), obj_get_initial_value_string(obj), False);
476
477         /* Load Initial State */
478         prop_checkbox_set_value(&(pts->init_state), AB_STATE_VISIBLE,
479                 obj_is_initially_visible(obj), False);
480         prop_checkbox_set_value(&(pts->init_state), AB_STATE_ACTIVE,
481                 obj_is_initially_active(obj), False);
482
483         /* Load Color */
484         prop_colorfield_set_value(&(pts->bg_color), obj_get_bg_color(obj), False);
485         prop_colorfield_set_value(&(pts->fg_color), obj_get_fg_color(obj), False);
486
487         turnoff_changebars(type);
488     }
489
490     /* Load Position */
491     if (load_all || loadkey & LoadPosition)
492         prop_load_obj_position(obj, &(pts->pos));
493
494     /* Load Width */
495     if (load_all || loadkey & LoadSize)
496     {
497         if (obj_get_num_columns(obj) == -1) /* Size in Pixels */
498         {
499             prop_options_set_value(&(pts->size_metric), (XtPointer)SIZE_IN_PIXELS_KEY, False);
500             width = abobj_get_comp_width(obj);
501         }
502         else /* Size in Chars */
503         {
504             prop_options_set_value(&(pts->size_metric), (XtPointer)SIZE_IN_CHARS_KEY, False);
505             width = obj_get_num_columns(obj);
506         }
507         prop_geomfield_set_value(&(pts->size), GEOM_WIDTH, width, False);
508     }
509
510     return OK;
511 }
512
513 static int
514 textf_prop_apply(
515     AB_PROP_TYPE   type
516 )
517 {
518     PropTextfSettingsRec        *pts = &(prop_textf_settings_rec[type]);
519     STRING                      value;
520     int                         num, metric, new_w;
521     BOOL                        size_chg = False;
522     BOOL                        reset_bg = False;
523     BOOL                        reset_fg = False;
524
525     if (!verify_props(type))
526         return ERROR;
527
528     if (prop_changed(pts->name.changebar))
529     {
530         value = prop_field_get_value(&(pts->name));
531         abobj_set_name(pts->current_obj, value);
532         util_free(value);
533     }
534     if (prop_changed(pts->label.changebar) ||
535         prop_changed(pts->label_type.changebar))
536     {
537         value = prop_field_get_value(&(pts->label));
538         abobj_set_label(pts->current_obj,
539             (AB_LABEL_TYPE)prop_options_get_value(&(pts->label_type)),
540                         value);
541         util_free(value);
542
543         abobj_set_label_position(pts->current_obj,
544                 (AB_COMPASS_POINT)prop_options_get_value(&(pts->label_pos)));
545         size_chg = True;
546     }
547 /*
548     if (prop_changed(pts->menuname.changebar))
549     {
550         value = prop_menuname_get_value(&(pts->menuname));
551         abobj_set_menu_name(pts->current_obj, value);
552         util_free(value);
553         prop_menuname_set_value(&(pts->menuname),
554                 obj_get_menu_name(pts->current_obj), False);
555     }
556 */
557     if (prop_changed(pts->op.changebar))
558     {
559         abobj_set_read_only(pts->current_obj,
560                 prop_radiobox_get_value(&(pts->op)));
561
562     }
563     if (prop_changed(pts->max_chars.changebar))
564     {
565         num = prop_field_get_numeric_value(&(pts->max_chars));
566         abobj_set_max_length(pts->current_obj, num);
567     }
568     if (prop_changed(pts->init_value.changebar))
569     {
570         value = prop_field_get_value(&(pts->init_value));
571         abobj_set_initial_value(pts->current_obj, value, 0);
572         util_free(value);
573     }
574     if (prop_changed(pts->pos.changebar))
575     {
576         if (abobj_is_movable(pts->current_obj))
577             abobj_set_xy(pts->current_obj,
578                 prop_geomfield_get_value(&(pts->pos), GEOM_X),
579                 prop_geomfield_get_value(&(pts->pos), GEOM_Y));
580     }
581     if (prop_changed(pts->size.changebar))
582     {
583         metric = (int)prop_options_get_value(&(pts->size_metric));
584         new_w = prop_geomfield_get_value(&(pts->size), GEOM_WIDTH);
585
586         abobj_set_num_columns(pts->current_obj,
587                 metric == SIZE_IN_CHARS_KEY? new_w : -1);
588         abobj_set_pixel_width(pts->current_obj,
589                 metric == SIZE_IN_PIXELS_KEY? new_w : -1, 0);
590
591         size_chg = True;
592     }
593     if (prop_changed(pts->init_state.changebar))
594     {
595         abobj_set_visible(pts->current_obj,
596                 prop_checkbox_get_value(&(pts->init_state), AB_STATE_VISIBLE));
597         abobj_set_active(pts->current_obj,
598                 prop_checkbox_get_value(&(pts->init_state), AB_STATE_ACTIVE));
599     }
600     if (prop_changed(pts->fg_color.changebar))
601     {
602         value = prop_colorfield_get_value(&(pts->fg_color));
603         abobj_set_foreground_color(pts->current_obj, value);
604         if (util_strempty(value))
605             reset_fg = True;
606         util_free(value);
607         prop_colorfield_set_value(&(pts->fg_color), obj_get_fg_color(pts->current_obj), False);
608     }
609     if (prop_changed(pts->bg_color.changebar))
610     {
611         value = prop_colorfield_get_value(&(pts->bg_color));
612         abobj_set_background_color(pts->current_obj, value);
613         if (util_strempty(value))
614             reset_bg = True;
615         util_free(value);
616         prop_colorfield_set_value(&(pts->bg_color),
617                 obj_get_bg_color(pts->current_obj), False);
618     }
619     abobj_instantiate_changes(pts->current_obj);
620
621     if (reset_bg || reset_fg) /* Set back to No Color */
622         abobj_reset_colors(pts->current_obj, reset_bg, reset_fg);
623
624     if (size_chg)
625         abobj_force_dang_form_resize(pts->current_obj);
626
627     turnoff_changebars(type);
628
629     return OK;
630 }
631
632 static BOOL
633 textf_prop_pending(
634     AB_PROP_TYPE type
635 )
636 {
637     return(prop_changebars_pending(prop_textf_settings_rec[type].prop_sheet));
638 }
639
640 static BOOL
641 verify_props(
642     AB_PROP_TYPE type
643 )
644 {
645     PropTextfSettingsRec *pts = &(prop_textf_settings_rec[type]);
646
647     if (prop_changed(pts->name.changebar) && !prop_name_ok(pts->current_obj, pts->name.field))
648         return False;
649
650     if ((prop_changed(pts->label_type.changebar) || prop_changed(pts->label.changebar)) &&
651         prop_options_get_value(&(pts->label_type)) == (XtPointer)AB_LABEL_GLYPH &&
652         !prop_graphic_filename_ok(pts->label.field, False))
653         return False;
654
655     if (prop_changed(pts->pos.changebar) &&
656         (!prop_number_ok(pts->pos.x_field, (STRING)XFieldStr, -SHRT_MAX, SHRT_MAX) ||
657          !prop_number_ok(pts->pos.y_field, (STRING)YFieldStr, -SHRT_MAX, SHRT_MAX)))
658         return False;
659
660     if (prop_changed(pts->size.changebar) &&
661         !prop_number_ok(pts->size.w_field, (STRING)WFieldStr, 1, SHRT_MAX))
662         return False;
663
664     if (prop_changed(pts->max_chars.changebar) &&
665         !prop_number_ok(pts->max_chars.field, "Maximum Char Field", 1, 999))
666         return False;
667
668     if (prop_changed(pts->fg_color.changebar) && !prop_color_ok(pts->fg_color.field))
669         return False;
670
671     if (prop_changed(pts->bg_color.changebar) && !prop_color_ok(pts->bg_color.field))
672         return False;
673
674 /*
675     if (prop_changed(pts->menuname.changebar) && !prop_obj_name_ok(pts->menuname.field,
676                         obj_get_module(pts->current_obj), AB_TYPE_MENU, "Menu"))
677         return False;
678 */
679
680     return True;
681 }
682
683 static void
684 turnoff_changebars(
685     AB_PROP_TYPE type
686 )
687 {
688     PropTextfSettingsRec *pts = &(prop_textf_settings_rec[type]);
689
690     prop_set_changebar(pts->name.changebar,             PROP_CB_OFF);
691     prop_set_changebar(pts->pos.changebar,              PROP_CB_OFF);
692     prop_set_changebar(pts->size.changebar,             PROP_CB_OFF);
693     prop_set_changebar(pts->label_type.changebar,       PROP_CB_OFF);
694     prop_set_changebar(pts->label.changebar,            PROP_CB_OFF);
695     prop_set_changebar(pts->op.changebar,               PROP_CB_OFF);
696     prop_set_changebar(pts->max_chars.changebar,        PROP_CB_OFF);
697     prop_set_changebar(pts->init_value.changebar,       PROP_CB_OFF);
698     prop_set_changebar(pts->init_state.changebar,       PROP_CB_OFF);
699     prop_set_changebar(pts->bg_color.changebar,         PROP_CB_OFF);
700     prop_set_changebar(pts->fg_color.changebar,         PROP_CB_OFF);
701 /*
702     prop_set_changebar(pts->menuname.changebar,         PROP_CB_OFF);
703 */
704
705     prop_changebars_cleared(pts->prop_sheet);
706
707 }