Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtappbuilder / src / ab / pal_textp.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_textp.c /main/7 1996/10/29 15:21:02 mustafa $
26  *
27  * @(#)pal_textp.c      1.31 14 Feb 1994      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_textp.c - Implements Palette TextPane object functionality
46  */
47 #include <stdio.h>
48 #include <Xm/Xm.h>
49 #include <ab_private/util.h>
50 #include <ab_private/ab.h>
51 #include <ab_private/pal.h>
52 #include <ab_private/prop.h>
53 #include <ab_private/abobj.h>
54 #include <ab_private/abobj_set.h>
55 #include <ab_private/ui_util.h>
56 #include "textp_ui.h"
57
58 const    int    textp_init_height = 80;
59 const    int    textp_init_width  = 80;
60
61 typedef struct  PROP_TEXTP_SETTINGS
62 {
63     Widget                      prop_sheet;
64     PropFieldSettingRec         name;
65     PropRadioSettingRec         scrolling;
66     PropGeometrySettingRec      pos;
67     PropGeometrySettingRec      size;
68     PropOptionsSettingRec       size_metric;
69     PropCheckboxSettingRec      wrap;
70     PropRadioSettingRec         op;
71     PropFieldSettingRec         init_value;
72     PropCheckboxSettingRec      init_state;
73     PropOptionsSettingRec       frame;
74     PropColorSettingRec         bg_color;
75     PropColorSettingRec         fg_color;
76     PropMenunameSettingRec      menuname;
77     PropFieldSettingRec         menu_title;
78     ABObj                       current_obj;
79 } PropTextpSettingsRec, *PropTextpSettings;
80
81 /*************************************************************************
82 **                                                                      **
83 **       Private Function Declarations                                  **
84 **                                                                      **
85 **************************************************************************/
86 /*
87  * Methods
88  */
89 static int      textp_initialize(
90                     ABObj   obj
91                 );
92 static Widget   textp_prop_init(
93                     Widget  parent,
94                     AB_PROP_TYPE type
95                 );
96 static int      textp_prop_activate(
97                     AB_PROP_TYPE type,
98                     BOOL         active
99                 );
100 static int      textp_prop_clear(
101                     AB_PROP_TYPE type
102                 );
103 static int      textp_prop_load(
104                     ABObj        obj,
105                     AB_PROP_TYPE type,
106                     unsigned long loadkey
107                 );
108 static int      textp_prop_apply(
109                     AB_PROP_TYPE type
110                 );
111 static BOOL     textp_prop_pending(
112                     AB_PROP_TYPE type
113                 );
114
115 static BOOL     verify_props(
116                     AB_PROP_TYPE type
117                 );
118 static void     turnoff_changebars(
119                     AB_PROP_TYPE type
120                 );
121
122
123 /*************************************************************************
124 **                                                                      **
125 **       Data                                                           **
126 **                                                                      **
127 **************************************************************************/
128 PalItemInfo textp_palitem_rec = {
129
130     /* type             */  AB_TYPE_TEXT_PANE,
131     /* name             */  "Text Pane",
132     /* animation pixmaps*/  NULL,
133     /* number of pixmaps*/  0,
134     /* rev_prop_frame   */  NULL,
135     /* fix_prop_dialog  */  NULL,
136     /* initialize       */  textp_initialize,
137     /* is_a_test        */  obj_is_text_pane,
138     /* prop_initialize  */  textp_prop_init,
139     /* prop_activate    */  textp_prop_activate,
140     /* prop_clear       */  textp_prop_clear,
141     /* prop_load        */  textp_prop_load,
142     /* prop_apply       */  textp_prop_apply,
143     /* prop_pending     */  textp_prop_pending
144
145 };
146
147 PalItemInfo *ab_textp_palitem = &textp_palitem_rec;
148 PropTextpSettingsRec prop_textp_settings_rec[AB_PROP_TYPE_NUM_VALUES];
149
150
151 /*************************************************************************
152 **                                                                      **
153 **       Function Definitions                                           **
154 **                                                                      **
155 **************************************************************************/
156
157 static int
158 textp_initialize(
159     ABObj     obj
160 )
161 {
162     ABObj       parent = obj_get_root(obj_get_parent(obj));
163
164     obj_set_unique_name(obj, "textpane");
165
166     if (obj_is_layers(parent)) /* Size already defined in pixels */
167     {
168         obj_set_num_rows(obj, -1);
169         obj_set_num_columns(obj, -1);
170     }
171     else  /* Default Size should be in chars */
172     {
173         obj_set_num_rows(obj, 4);
174         obj_set_num_columns(obj, 8);
175
176         obj_set_textpane_width(obj, 400);
177         obj_set_textpane_height(obj, 400);
178     }
179     obj_set_vscrollbar_policy(obj, AB_SCROLLBAR_ALWAYS);
180     obj_set_word_wrap(obj, True);
181     obj_set_hscrollbar_policy(obj, AB_SCROLLBAR_NEVER);
182
183     abobj_init_pane_position(obj);
184
185     return OK;
186
187 }
188
189 static Widget
190 textp_prop_init(
191     Widget parent,
192     AB_PROP_TYPE type
193 )
194 {
195     DtbTextpPropDialogInfoRec   rev_textp_prop_dialog; /* Revolving Props */
196     DtbTextpPropDialogInfo      cgen = &dtb_textp_prop_dialog; /* Codegen structure */
197     DtbRevolvPropDialogInfo     rpd = &(dtb_revolv_prop_dialog);
198     PropTextpSettingsRec        *pts = &(prop_textp_settings_rec[type]);
199     Widget                      item[10];
200     int                         item_val[10];
201     int                         n;
202
203     if (type == AB_PROP_REVOLVING)
204     {
205         /* Cloning Trick:
206          * Only the Attributes ControlPanel needs to be created within
207          * the existing Revolving Prop dialog, so fill out all other
208          * fields with the Revolving Prop dialog equivelents, so the
209          * dtb initialize proc will skip those non-NULL fields...
210          */
211         dtbTextpPropDialogInfo_clear(&rev_textp_prop_dialog);
212
213         cgen = &(rev_textp_prop_dialog);
214         cgen->prop_dialog = rpd->prop_dialog;
215         cgen->prop_dialog_shellform = rpd->prop_dialog_shellform;
216         cgen->prop_dialog_panedwin = rpd->prop_dialog_panedwin;
217         cgen->prop_dialog_form = rpd->prop_dialog_form;
218         cgen->objlist_panel = rpd->objlist_panel;
219         cgen->objlist_label = rpd->objlist_label2;
220         cgen->objlist_scrolledwin = rpd->objlist_scrolledwin;
221         cgen->objlist = rpd->objlist;
222         cgen->attrs_ctrlpanel_frame = rpd->attrs_ctrlpanel_frame;
223         cgen->activate_panel = rpd->activate_panel;
224         cgen->apply_button = rpd->apply_button;
225         cgen->ok_button = rpd->ok_button;
226         cgen->cancel_button = rpd->cancel_button;
227         cgen->reset_button = rpd->reset_button;
228         cgen->help_button = rpd->help_button;
229
230     }
231     else /* AB_PROP_FIXED */
232         cgen = &dtb_textp_prop_dialog;
233
234     if (dtb_textp_prop_dialog_initialize(cgen, parent) == 0)
235     {
236         pts->prop_sheet = cgen->attrs_ctrlpanel;
237         pts->current_obj = NULL;
238
239         if (type == AB_PROP_REVOLVING)
240                 XtVaSetValues(parent,
241                         XmNuserData, pts->current_obj,
242                         NULL);
243
244         /* Dialog/Object List */
245         if (type == AB_PROP_FIXED)
246         {
247             prop_fixed_dialog_init(ab_textp_palitem,
248                         cgen->prop_dialog_shellform, cgen->objlist);
249             prop_activate_panel_init(type, ab_textp_palitem,
250                         cgen->ok_button, cgen->apply_button,
251                         cgen->reset_button, cgen->cancel_button,
252                         cgen->help_button);
253         }
254
255         /* Alternate Editor Buttons */
256         prop_editors_panel_init(type, ab_textp_palitem,
257                     cgen->attach_button, cgen->conn_button, cgen->helptxt_button);
258
259         /*
260           * Prop Sheet Settings....
261          */
262
263         /* Name */
264         prop_field_init(&(pts->name), cgen->name_field_label,
265                             cgen->name_field, cgen->name_cb);
266
267         /* Scrolling */
268         n = 0;
269         item[n] = cgen->scroll_rbox_items.Never_item;
270         item_val[n] = AB_SCROLLBAR_NEVER; n++;
271         item[n] = cgen->scroll_rbox_items.Always_item;
272         item_val[n] = AB_SCROLLBAR_ALWAYS; n++;
273         prop_radiobox_init(&(pts->scrolling), cgen->scroll_rbox_label,
274                 cgen->scroll_rbox, n, item, (XtPointer*)item_val,
275                 cgen->scroll_cb);
276
277         /* Border Frame */
278         n = 0;
279         item[n] = cgen->bframe_opmenu_items.None_item;
280         item_val[n] = AB_LINE_NONE; n++;
281         item[n] = cgen->bframe_opmenu_items.Shadow_Out_item;
282         item_val[n] = AB_LINE_SHADOW_OUT; n++;
283         item[n] = cgen->bframe_opmenu_items.Shadow_In_item;
284         item_val[n] = AB_LINE_SHADOW_IN; n++;
285         item[n] = cgen->bframe_opmenu_items.Etched_Out_item;
286         item_val[n] = AB_LINE_ETCHED_OUT; n++;
287         item[n] = cgen->bframe_opmenu_items.Etched_In_item;
288         item_val[n] = AB_LINE_ETCHED_IN; n++;
289         prop_options_init(&(pts->frame), cgen->bframe_opmenu_label,
290                             cgen->bframe_opmenu, cgen->bframe_opmenu_menu,
291                             n, item, (XtPointer*)item_val,
292                             cgen->bframe_cb);
293
294         /* Operation */
295         n = 0;
296         item[n] = cgen->op_rbox_items.Editable_item;
297         item_val[n] = False; n++;
298         item[n] = cgen->op_rbox_items.Read_Only_item;
299         item_val[n] = True; n++;
300         prop_radiobox_init(&(pts->op), cgen->op_rbox_label,
301                 cgen->op_rbox, n, item, (XtPointer*)item_val,
302                 cgen->op_cb);
303
304         /* Wrap */
305         n = 0;
306         item[n] = cgen->wordwrap_ckbox_items.nolabel_item;
307         item_val[n] = True; n++;
308         prop_checkbox_init(&(pts->wrap), cgen->wordwrap_ckbox_label,
309                             cgen->wordwrap_ckbox, n, item, item_val,
310                             cgen->wordwrap_cb);
311
312         /* Menu Title */
313         prop_field_init(&(pts->menu_title), cgen->menutitle_field_label,
314                             cgen->menutitle_field, cgen->menutitle_cb);
315
316         /* Menu Name */
317         prop_menuname_init(&(pts->menuname), type, cgen->menu_label,
318                         cgen->menu_mbutton, cgen->menu_field,
319                         cgen->name_field, cgen->menu_cb,
320                         &(pts->menu_title),
321                         &(pts->current_obj), True);
322
323         /* Initial Value */
324         prop_field_init(&(pts->init_value), cgen->ivalue_label,
325                             cgen->ivalue_textpane, cgen->ivalue_cb);
326
327         /* Position */
328         prop_geomfield_init(&(pts->pos), cgen->pos_label,
329                             cgen->x_field_label, cgen->x_field,
330                             cgen->y_field_label, cgen->y_field,
331                             NULL, NULL, NULL, NULL,
332                             cgen->pos_cb);
333
334         /* Size */
335         prop_geomfield_init(&(pts->size), cgen->size_opmenu_label,
336                             NULL, NULL, NULL, NULL,
337                             cgen->width_field_label, cgen->width_field,
338                             cgen->height_field_label, cgen->height_field,
339                             cgen->size_cb);
340
341         n = 0;
342         item[n] = cgen->size_opmenu_items.Characters_item;
343         item_val[n] = SIZE_IN_CHARS_KEY; n++;
344         item[n] = cgen->size_opmenu_items.Pixels_item;
345         item_val[n] = SIZE_IN_PIXELS_KEY; n++;
346         prop_options_init(&(pts->size_metric), cgen->size_opmenu_label,
347                            cgen->size_opmenu,
348                            cgen->size_opmenu_menu,
349                            n, item, (XtPointer*)item_val,
350                            cgen->size_cb);
351
352         /* Initial State */
353         n = 0;
354         item[n] = cgen->istate_ckbox_items.Visible_item;
355         item_val[n] = AB_STATE_VISIBLE; n++;
356         item[n] = cgen->istate_ckbox_items.Active_item;
357         item_val[n] = AB_STATE_ACTIVE; n++;
358         prop_checkbox_init(&(pts->init_state), cgen->istate_ckbox_label,
359                             cgen->istate_ckbox, n, item, item_val,
360                             cgen->istate_cb);
361
362         /* Color */
363         prop_colorfield_init(&(pts->bg_color), cgen->bg_mbutton,
364                 cgen->bg_mbutton_bg_mbutton_menu_items.None_item,
365                 cgen->bg_mbutton_bg_mbutton_menu_items.Color_Chooser_item,
366                 cgen->bg_swatch, cgen->bg_field, cgen->bg_cb);
367
368         prop_colorfield_init(&(pts->fg_color), cgen->fg_mbutton,
369                 cgen->fg_mbutton_fg_mbutton_menu_items.None_item,
370                 cgen->fg_mbutton_fg_mbutton_menu_items.Color_Chooser_item,
371                 cgen->fg_swatch, cgen->fg_field, cgen->fg_cb);
372
373         prop_changebars_cleared(pts->prop_sheet);
374
375         return (cgen->prop_dialog_shellform);
376     }
377     else
378         return NULL;
379 }
380
381 static int
382 textp_prop_activate(
383     AB_PROP_TYPE type,
384     BOOL         active
385 )
386 {
387     ui_set_active(prop_textp_settings_rec[type].prop_sheet, active);
388
389     return OK;
390 }
391
392 static int
393 textp_prop_clear(
394     AB_PROP_TYPE type
395 )
396 {
397     PropTextpSettingsRec        *pts = &(prop_textp_settings_rec[type]);
398
399     if (pts->current_obj == NULL)
400         return OK;
401
402     /* Clear Name */
403     prop_field_set_value(&(pts->name), "", False);
404
405     /* Clear Scrolling */
406     prop_radiobox_set_value(&(pts->scrolling),
407                             (XtPointer)AB_SCROLLBAR_NEVER, False);
408
409     /* Clear Border Frame */
410     prop_options_set_value(&(pts->frame), (XtPointer)AB_LINE_NONE, False);
411
412     /* Clear Operation */
413     prop_radiobox_set_value(&(pts->op), (XtPointer)False, False);
414
415     /* Clear Wrap */
416     prop_checkbox_set_value(&(pts->wrap), True, True, False);
417
418     /* Clear Menu Name/Title */
419     prop_menuname_set_value(&(pts->menuname), "", False);
420     prop_field_set_value(&(pts->menu_title), "", False);
421
422     /* Clear Initial Value*/
423     prop_field_set_value(&(pts->init_value), "", False);
424
425     /* Clear Position */
426     prop_geomfield_clear(&(pts->pos), GEOM_X);
427     prop_geomfield_clear(&(pts->pos), GEOM_Y);
428
429     /* Clear Size */
430     prop_geomfield_clear(&(pts->size), GEOM_WIDTH);
431     prop_geomfield_clear(&(pts->size), GEOM_HEIGHT);
432
433     /* Clear Initial State */
434     prop_checkbox_set_value(&(pts->init_state), AB_STATE_VISIBLE, True, False);
435     prop_checkbox_set_value(&(pts->init_state), AB_STATE_ACTIVE, True, False);
436
437     /* Clear Color */
438     prop_colorfield_set_value(&(pts->bg_color), "", False);
439     prop_colorfield_set_value(&(pts->fg_color), "", False);
440
441     pts->current_obj = NULL;
442
443     turnoff_changebars(type);
444
445     return 0;
446 }
447
448
449 static int
450 textp_prop_load(
451     ABObj        obj,
452     AB_PROP_TYPE type,
453     unsigned long loadkey
454 )
455 {
456     PropTextpSettingsRec        *pts = &(prop_textp_settings_rec[type]);
457     int                         width, height;
458     BOOL                        load_all = (loadkey & LoadAll);
459
460     if (obj == NULL)
461     {
462         if (pts->current_obj != NULL)
463             obj = pts->current_obj;
464         else
465             return ERROR;
466     }
467     else if (!obj_is_text_pane(obj))
468         return ERROR;
469     else
470         pts->current_obj = obj;
471
472     /* Load Name */
473     if (load_all || loadkey & LoadName)
474         prop_field_set_value(&(pts->name), obj_get_name(obj), False);
475
476     if (load_all)
477     {
478         /* Load Scrolling */
479         prop_radiobox_set_value(&(pts->scrolling),
480                 (XtPointer)obj_get_vscrollbar_policy(obj), False);
481
482         /* Load Border Frame */
483         prop_options_set_value(&(pts->frame), (XtPointer)obj_get_border_frame(obj), False);
484
485         /* Load Word Wrap */
486         prop_checkbox_set_value(&(pts->wrap), True,
487                                 obj->info.text.word_wrap, False);
488
489         /* Load Operation */
490         prop_radiobox_set_value(&(pts->op),
491                                 (XtPointer)obj_get_read_only(obj), False);
492
493         /* Load Menu Name/Title */
494         prop_menuname_set_value(&(pts->menuname), obj_get_menu_name(obj), False);
495         prop_field_set_value(&(pts->menu_title), obj_get_menu_title(obj), False);
496
497         /* Load Initial Value */
498         prop_field_set_value(&(pts->init_value), obj_get_initial_value_string(obj), False);
499
500         /* Load Initial State */
501         prop_checkbox_set_value(&(pts->init_state), AB_STATE_VISIBLE,
502                 obj_is_initially_visible(obj), False);
503         prop_checkbox_set_value(&(pts->init_state), AB_STATE_ACTIVE,
504                 obj_is_initially_active(obj), False);
505
506         /* Load Color */
507         prop_colorfield_set_value(&(pts->bg_color), obj_get_bg_color(obj), False);
508         prop_colorfield_set_value(&(pts->fg_color), obj_get_fg_color(obj), False);
509
510         turnoff_changebars(type);
511     }
512
513     /* Load Position */
514     if (load_all || loadkey & LoadPosition)
515         prop_load_obj_position(obj, &(pts->pos));
516
517     /* Load Size */
518     if (load_all || loadkey & LoadSize)
519     {
520         if (obj_get_num_columns(obj) == -1) /* Size in Pixels */
521         {
522             prop_options_set_value(&(pts->size_metric), (XtPointer)SIZE_IN_PIXELS_KEY, False);
523             width = abobj_get_comp_width(obj);
524             height = abobj_get_comp_height(obj);
525         }
526         else /* Size in Chars */
527         {
528             prop_options_set_value(&(pts->size_metric), (XtPointer)SIZE_IN_CHARS_KEY, False);
529             width = obj_get_num_columns(obj);
530             height = obj_get_num_rows(obj);
531         }
532         prop_geomfield_set_value(&(pts->size), GEOM_WIDTH, width, False);
533         prop_geomfield_set_value(&(pts->size), GEOM_HEIGHT,height, False);
534     }
535
536     return OK;
537 }
538
539 int
540 textp_prop_apply(
541     AB_PROP_TYPE   type
542 )
543 {
544     PropTextpSettingsRec        *pts = &(prop_textp_settings_rec[type]);
545     ABObj                       chg_root = pts->current_obj;
546     ABObj                       pobj;
547     STRING                      value;
548     int                         border, metric, new_w, new_h;
549     BOOL                        size_chg = False;
550     BOOL                        reset_bg = False;
551     BOOL                        reset_fg = False;
552
553     if (!verify_props(type))
554         return ERROR;
555
556     if (prop_changed(pts->name.changebar))
557     {
558         value = prop_field_get_value(&(pts->name));
559         abobj_set_name(pts->current_obj, value);
560         util_free(value);
561     }
562     if (prop_changed(pts->scrolling.changebar))
563     {
564         abobj_set_scrollbar_state(pts->current_obj,
565             (AB_SCROLLBAR_POLICY)prop_radiobox_get_value(&(pts->scrolling)));
566
567         size_chg = True;
568     }
569
570     pobj = obj_get_root(obj_get_parent(pts->current_obj));
571
572     if (prop_changed(pts->pos.changebar))
573     {
574         if (obj_is_layers(pobj))
575             chg_root = pobj;
576
577         if (abobj_is_movable(pts->current_obj))
578             abobj_set_xy(chg_root,
579                 prop_geomfield_get_value(&(pts->pos), GEOM_X),
580                 prop_geomfield_get_value(&(pts->pos), GEOM_Y));
581     }
582     if (prop_changed(pts->size.changebar))
583     {
584         metric = (int)prop_options_get_value(&(pts->size_metric));
585         new_w = prop_geomfield_get_value(&(pts->size), GEOM_WIDTH);
586         new_h = prop_geomfield_get_value(&(pts->size), GEOM_HEIGHT);
587
588         border = /* assumption! */
589             ((prop_options_get_value(&(pts->frame)) != (XtPointer)AB_LINE_NONE)? 4 : 0);
590
591         if (obj_is_layers(pobj))
592         {
593             if (metric == SIZE_IN_PIXELS_KEY)
594                 abobj_layer_set_size(pobj, new_w, new_h);
595             chg_root = pobj;
596         }
597         else
598         {
599             abobj_set_num_rows(pts->current_obj,
600                 metric == SIZE_IN_CHARS_KEY? new_h : -1);
601             abobj_set_num_columns(pts->current_obj,
602                 metric == SIZE_IN_CHARS_KEY? new_w : -1);
603
604             abobj_set_pixel_width(pts->current_obj,
605                 metric == SIZE_IN_PIXELS_KEY? new_w : -1, border);
606             abobj_set_pixel_height(pts->current_obj,
607                 metric == SIZE_IN_PIXELS_KEY? new_h : -1, border);
608         }
609         size_chg = True;
610     }
611     if (prop_changed(pts->wrap.changebar))
612     {
613         abobj_set_word_wrap(pts->current_obj,
614                 prop_checkbox_get_value(&(pts->wrap),True));
615     }
616     if (prop_changed(pts->op.changebar))
617     {
618         abobj_set_read_only(pts->current_obj,
619                 prop_radiobox_get_value(&(pts->op)));
620
621     }
622     if (prop_changed(pts->init_value.changebar))
623     {
624         value = prop_field_get_value(&(pts->init_value));
625         abobj_set_initial_value(pts->current_obj, value, 0);
626         util_free(value);
627     }
628     if (prop_changed(pts->init_state.changebar))
629     {
630         abobj_set_visible(pts->current_obj,
631                 prop_checkbox_get_value(&(pts->init_state), AB_STATE_VISIBLE));
632         abobj_set_active(pts->current_obj,
633                 prop_checkbox_get_value(&(pts->init_state), AB_STATE_ACTIVE));
634     }
635     if (prop_changed(pts->frame.changebar))
636     {
637         abobj_set_border_frame(pts->current_obj,
638                 (AB_LINE_TYPE)prop_options_get_value(&(pts->frame)));
639     }
640     if (prop_changed(pts->fg_color.changebar))
641     {
642         value = prop_colorfield_get_value(&(pts->fg_color));
643         abobj_set_foreground_color(pts->current_obj, value);
644         if (util_strempty(value))
645             reset_fg = True;
646         util_free(value);
647         prop_colorfield_set_value(&(pts->fg_color),
648                 obj_get_fg_color(pts->current_obj), False);
649     }
650     if (prop_changed(pts->bg_color.changebar))
651     {
652         value = prop_colorfield_get_value(&(pts->bg_color));
653         abobj_set_background_color(pts->current_obj, value);
654         if (util_strempty(value))
655             reset_bg = True;
656         util_free(value);
657         prop_colorfield_set_value(&(pts->bg_color),
658                 obj_get_bg_color(pts->current_obj), False);
659     }
660     if (prop_changed(pts->menuname.changebar))
661     {
662         value = prop_menuname_get_value(&(pts->menuname));
663         abobj_set_menu_name(pts->current_obj, value);
664         util_free(value);
665         prop_menuname_set_value(&(pts->menuname),
666                 obj_get_menu_name(pts->current_obj), False);
667     }
668     if (prop_changed(pts->menu_title.changebar))
669     {
670         value = prop_field_get_value(&(pts->menu_title));
671         abobj_set_menu_title(pts->current_obj, value);
672         util_free(value);
673     }
674     abobj_instantiate_changes(pts->current_obj);
675     if (chg_root != pts->current_obj)
676         abobj_tree_instantiate_changes(chg_root);
677
678     if (reset_bg || reset_fg) /* Set back to No Color */
679         abobj_reset_colors(pts->current_obj, reset_bg, reset_fg);
680     if (size_chg)
681         abobj_force_dang_form_resize(pts->current_obj);
682
683     turnoff_changebars(type);
684
685     return OK;
686
687 }
688
689 static BOOL
690 textp_prop_pending(
691     AB_PROP_TYPE type
692 )
693 {
694     return(prop_changebars_pending(prop_textp_settings_rec[type].prop_sheet));
695 }
696
697 static BOOL
698 verify_props(
699     AB_PROP_TYPE type
700 )
701 {
702     PropTextpSettingsRec *pts = &(prop_textp_settings_rec[type]);
703
704     if (prop_changed(pts->name.changebar) &&
705         !prop_name_ok(pts->current_obj, pts->name.field))
706         return False;
707
708     if (prop_changed(pts->pos.changebar) &&
709         (!prop_number_ok(pts->pos.x_field,(STRING)XFieldStr, -SHRT_MAX, SHRT_MAX) ||
710          !prop_number_ok(pts->pos.y_field,(STRING)YFieldStr, -SHRT_MAX, SHRT_MAX)))
711         return False;
712
713     if (prop_changed(pts->size.changebar) &&
714         (!prop_number_ok(pts->size.w_field, (STRING)WFieldStr, 1, SHRT_MAX) ||
715          !prop_number_ok(pts->size.h_field, (STRING)HFieldStr, 1, SHRT_MAX)))
716         return False;
717
718     if (prop_changed(pts->fg_color.changebar) && !prop_color_ok(pts->fg_color.field))
719         return False;
720
721     if (prop_changed(pts->bg_color.changebar) && !prop_color_ok(pts->bg_color.field))
722         return False;
723
724     if (prop_changed(pts->menuname.changebar) && !prop_obj_name_ok(pts->menuname.field,
725                         obj_get_module(pts->current_obj), AB_TYPE_MENU, "Menu"))
726         return False;
727
728     return True;
729 }
730
731 static void
732 turnoff_changebars(
733     AB_PROP_TYPE type
734 )
735 {
736     PropTextpSettingsRec *pts = &(prop_textp_settings_rec[type]);
737
738     prop_set_changebar(pts->name.changebar,             PROP_CB_OFF);
739     prop_set_changebar(pts->scrolling.changebar,        PROP_CB_OFF);
740     prop_set_changebar(pts->pos.changebar,              PROP_CB_OFF);
741     prop_set_changebar(pts->size.changebar,             PROP_CB_OFF);
742     prop_set_changebar(pts->wrap.changebar,             PROP_CB_OFF);
743     prop_set_changebar(pts->op.changebar,               PROP_CB_OFF);
744     prop_set_changebar(pts->init_value.changebar,       PROP_CB_OFF);
745     prop_set_changebar(pts->init_state.changebar,       PROP_CB_OFF);
746     prop_set_changebar(pts->frame.changebar,            PROP_CB_OFF);
747     prop_set_changebar(pts->bg_color.changebar,         PROP_CB_OFF);
748     prop_set_changebar(pts->fg_color.changebar,         PROP_CB_OFF);
749     prop_set_changebar(pts->menuname.changebar,         PROP_CB_OFF);
750     prop_set_changebar(pts->menu_title.changebar,       PROP_CB_OFF);
751
752     prop_changebars_cleared(pts->prop_sheet);
753
754 }