605cfcfef13fcc7fb64a98ded10a451850a2369f
[oweals/cde.git] / cde / programs / dtappbuilder / src / ab / pal_glyph.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  *      $XConsortium: pal_glyph.c /main/3 1995/11/06 17:38:34 rswiston $
25  *
26  * @(#)pal_glyph.c      1.3 21 Feb 1994      cde_app_builder/src/ab
27  *
28  *      RESTRICTED CONFIDENTIAL INFORMATION:
29  *
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
36  *      Sun's request.
37  *
38  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
39  *
40  */
41
42
43 /*
44  * pal_glyph.c - Implements Palette Glyph object functionality
45  */
46 #include <stdio.h>
47 #include <Xm/Xm.h>
48 #include <Xm/Form.h>
49 #include <Xm/Label.h>
50 #include <Xm/PushB.h>
51 #include <Xm/RowColumn.h>
52 #include <Xm/TextF.h>
53 #include <Xm/ToggleB.h>
54 #include <Xm/Separator.h>
55 #include <ab_private/pal.h>
56 #include <ab_private/prop.h>
57 #include <ab_private/abobj_set.h>
58 #include <ab_private/ui_util.h>
59
60 const int    glyph_init_height = 175;
61 const int    glyph_init_width  = 400;
62
63 /*************************************************************************
64 **                                                                      **
65 **       Private Function Declarations                                  **
66 **                                                                      **
67 **************************************************************************/
68 /*
69  * Methods
70  */
71 static int      glyph_initialize(
72                     ABObj   obj
73                 );
74 static Widget   glyph_prop_init(
75                     Widget  parent,
76                     AB_PROP_TYPE type
77                 );
78 static int      glyph_prop_activate(
79                     AB_PROP_TYPE type,
80                     BOOL         active
81                 );
82 static int      glyph_prop_clear(
83                     AB_PROP_TYPE type
84                 );
85 static int      glyph_prop_load(
86                     ABObj   obj,
87                     AB_PROP_TYPE type
88                 );
89 static int      glyph_prop_apply(
90                     AB_PROP_TYPE type
91                 );
92
93 static BOOL     glyph_prop_pending(
94                     AB_PROP_TYPE type
95                 );
96
97 static BOOL     verify_props(
98                     AB_PROP_TYPE type
99                 );
100 static void     turnoff_changebars(
101                     AB_PROP_TYPE type
102                 );
103
104
105 /*************************************************************************
106 **                                                                      **
107 **       Data                                                           **
108 **                                                                      **
109 **************************************************************************/
110
111 PalItemInfo glyph_palitem_rec = {
112
113     /* type             */  AB_TYPE_GLYPH,
114     /* name             */  "Glyph",
115     /* animation pixmaps*/  NULL,
116     /* number of pixmaps*/  0,
117     /* rev_prop_frame   */  NULL,
118     /* fix_prop_dialog  */  NULL,
119     /* initialize       */  glyph_initialize,
120     /* is_a_test        */  obj_is_glyph,
121     /* prop_initialize  */  glyph_prop_init,
122     /* prop_active      */  glyph_prop_activate,
123     /* prop_clear       */  glyph_prop_clear,
124     /* prop_load        */  glyph_prop_load,
125     /* prop_apply       */  glyph_prop_apply,
126     /* prop_pending     */  glyph_prop_pending
127
128 };
129 PalItemInfo *ab_glyph_palitem = &glyph_palitem_rec;
130
131 static ABObj current_obj[AB_PROP_TYPE_NUM_VALUES];
132
133 static Widget   prop_form[AB_PROP_TYPE_NUM_VALUES];
134
135 static Widget   name_label[AB_PROP_TYPE_NUM_VALUES],
136                 name_field[AB_PROP_TYPE_NUM_VALUES],
137                 name_cb[AB_PROP_TYPE_NUM_VALUES],
138
139                 colorf_label[AB_PROP_TYPE_NUM_VALUES],
140                 colorf_field[AB_PROP_TYPE_NUM_VALUES],
141                 colorf_cb[AB_PROP_TYPE_NUM_VALUES],
142
143                 monof_label[AB_PROP_TYPE_NUM_VALUES],
144                 monof_field[AB_PROP_TYPE_NUM_VALUES],
145                 monof_cb[AB_PROP_TYPE_NUM_VALUES],
146
147                 fg_label[AB_PROP_TYPE_NUM_VALUES],
148                 fg_button[AB_PROP_TYPE_NUM_VALUES],
149                 fg_field[AB_PROP_TYPE_NUM_VALUES],
150                 fg_cb[AB_PROP_TYPE_NUM_VALUES],
151                 fg_glyph[AB_PROP_TYPE_NUM_VALUES],
152
153                 bg_label[AB_PROP_TYPE_NUM_VALUES],
154                 bg_button[AB_PROP_TYPE_NUM_VALUES],
155                 bg_field[AB_PROP_TYPE_NUM_VALUES],
156                 bg_cb[AB_PROP_TYPE_NUM_VALUES],
157                 bg_glyph[AB_PROP_TYPE_NUM_VALUES];
158
159
160 /*************************************************************************
161 **                                                                      **
162 **       Function Definitions                                           **
163 **                                                                      **
164 **************************************************************************/
165 static int
166 glyph_initialize(
167     ABObj     obj
168 )
169 {
170     STRING name;
171
172     name = obj_alloc_unique_name(obj_get_module(obj), "glyph", -1);
173     obj_set_name(obj, name);
174     util_free(name);
175
176     return OK;
177
178 }
179
180 static Widget
181 glyph_prop_init(
182     Widget       parent,
183     AB_PROP_TYPE type
184 )
185 {
186     Widget  prop_pane,
187             setting,
188             label,
189             button;
190     Arg     args[20];
191     int     i;
192     Pixel   parent_bg;
193     XmString xmlabel;
194
195     prop_form[type] = prop_pane = XtVaCreateManagedWidget("glyph_prop_pane",
196                         xmFormWidgetClass,
197                         parent,
198                         XmNresizePolicy, XmRESIZE_ANY,
199                         NULL);
200
201     /* Set record of changebars currently "ON" to 0 */
202     prop_init_change_count(prop_pane);
203
204     XtVaGetValues(prop_pane,
205                         XmNbackground,  &parent_bg,
206                         NULL);
207
208     /********************************************************************
209      *  Create Name Setting                                             *
210      ********************************************************************/
211     name_field[type] = XtVaCreateManagedWidget("namefield",
212                         xmTextFieldWidgetClass,
213                         prop_pane,
214                         XmNshadowThickness,     1,
215                         XmNhighlightThickness,  1,
216                         XmNmaxLength,           80,
217                         XmNleftAttachment,      XmATTACH_POSITION,
218                         XmNleftPosition,        prop_setting_anchor,
219                         XmNleftOffset,          prop_offset_from_lbl,
220                         XmNrightAttachment,     XmATTACH_POSITION, 
221                         XmNrightPosition,       prop_setting_end, 
222                         XmNtopAttachment,       XmATTACH_FORM,
223                         XmNtopOffset,           prop_setting_offset,
224                         NULL);
225     setting = name_field[type];
226
227     xmlabel = XmStringCreateLocalized("Object Name:");
228     name_label[type] = label = XtVaCreateManagedWidget("prop_label",
229                         xmLabelWidgetClass, 
230                         prop_pane, 
231                         XmNlabelString,         xmlabel, 
232                         XmNalignment,           XmALIGNMENT_END,
233                         XmNrightAttachment,     XmATTACH_POSITION,
234                         XmNrightPosition,       prop_setting_anchor,
235                         XmNleftAttachment,      XmATTACH_POSITION,
236                         XmNleftPosition,        prop_label_anchor,
237                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
238                         XmNtopWidget,           setting,  
239                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
240                         XmNbottomWidget,        setting,
241                         NULL);
242     XmStringFree(xmlabel);
243
244     name_cb[type] = XtVaCreateManagedWidget("changebar",
245                         xmSeparatorWidgetClass,
246                         prop_pane,
247                         XmNorientation,         XmVERTICAL,
248                         XmNseparatorType,       XmSINGLE_LINE,
249                         XmNwidth,               prop_cb_width, 
250                         XmNbackground,          parent_bg,
251                         XmNforeground,          parent_bg,
252                         XmNleftAttachment,      XmATTACH_POSITION,
253                         XmNleftPosition,        prop_cb_anchor,
254                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
255                         XmNtopWidget,           setting,
256                         XmNrightAttachment,     XmATTACH_POSITION,
257                         XmNrightPosition,       prop_label_anchor,
258                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
259                         XmNbottomWidget,        setting,
260                         XmNuserData,            PROP_CB_OFF,
261                         NULL);
262     XtAddCallback(name_field[type], XmNvalueChangedCallback, prop_field_chgCB, name_cb[type]); 
263     XtVaSetValues(name_field[type], XmNuserData, PROP_EDIT, NULL);
264
265
266     /******************************************************************** 
267      *  Create Color Filename Setting                                   *   
268      ********************************************************************/
269     colorf_field[type] = XtVaCreateManagedWidget("field",
270                         xmTextFieldWidgetClass,
271                         prop_pane,
272                         XmNshadowThickness,     1,
273                         XmNhighlightThickness,  1,
274                         XmNmaxLength,           80,
275                         XmNleftAttachment,      XmATTACH_POSITION,
276                         XmNleftPosition,        prop_setting_anchor,
277                         XmNleftOffset,          prop_offset_from_lbl, 
278                         XmNtopAttachment,       XmATTACH_WIDGET,
279                         XmNtopWidget,           setting,
280                         XmNtopOffset,           prop_setting_offset,
281                         XmNrightAttachment,     XmATTACH_POSITION,
282                         XmNrightPosition,       prop_setting_end,
283                         NULL);
284
285     setting = colorf_field[type];
286     xmlabel = XmStringCreateLocalized("Color Filename:");
287     colorf_label[type] = XtVaCreateManagedWidget("prop_label",
288                         xmLabelWidgetClass,
289                         prop_pane,
290                         XmNlabelString,         xmlabel,
291                         XmNalignment,           XmALIGNMENT_END,
292                         XmNrightAttachment,     XmATTACH_POSITION,
293                         XmNrightPosition,       prop_setting_anchor,
294                         XmNleftAttachment,      XmATTACH_POSITION,
295                         XmNleftPosition,        prop_label_anchor,
296                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
297                         XmNtopWidget,           setting,
298                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
299                         XmNbottomWidget,        setting,
300                         NULL);
301     XmStringFree(xmlabel); 
302
303     colorf_cb[type] = XtVaCreateManagedWidget("changebar",
304                         xmSeparatorWidgetClass,
305                         prop_pane,
306                         XmNorientation,         XmVERTICAL,
307                         XmNseparatorType,       XmSINGLE_LINE,
308                         XmNwidth,               prop_cb_width, 
309                         XmNbackground,          parent_bg,
310                         XmNforeground,          parent_bg,
311                         XmNleftAttachment,      XmATTACH_POSITION,
312                         XmNleftPosition,        prop_cb_anchor,
313                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
314                         XmNtopWidget,           setting,
315                         XmNrightAttachment,     XmATTACH_POSITION,
316                         XmNrightPosition,       prop_label_anchor,
317                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
318                         XmNbottomWidget,        setting,
319                         XmNuserData,            PROP_CB_OFF,
320                         NULL);
321     XtAddCallback(colorf_field[type], XmNvalueChangedCallback, prop_field_chgCB, colorf_cb[type]);  
322     XtVaSetValues(colorf_field[type], XmNuserData,      PROP_EDIT, NULL); 
323
324
325     /********************************************************************
326      *  Create Mono Filename Setting                                    *
327      ********************************************************************/
328     monof_field[type] = XtVaCreateManagedWidget("field",
329                         xmTextFieldWidgetClass,
330                         prop_pane,
331                         XmNshadowThickness,     1,
332                         XmNhighlightThickness,  1,
333                         XmNmaxLength,           80,
334                         XmNleftAttachment,      XmATTACH_POSITION,
335                         XmNleftPosition,        prop_setting_anchor,
336                         XmNleftOffset,          prop_offset_from_lbl,
337                         XmNtopAttachment,       XmATTACH_WIDGET,
338                         XmNtopWidget,           setting,
339                         XmNtopOffset,           prop_setting_offset,
340                         XmNrightAttachment,     XmATTACH_POSITION,
341                         XmNrightPosition,       prop_setting_end,
342                         NULL);
343
344     setting = monof_field[type];
345     xmlabel = XmStringCreateLocalized("Color Filename:");
346     monof_label[type] = XtVaCreateManagedWidget("prop_label",
347                         xmLabelWidgetClass,
348                         prop_pane,
349                         XmNlabelString,         xmlabel,
350                         XmNalignment,           XmALIGNMENT_END,
351                         XmNrightAttachment,     XmATTACH_POSITION,
352                         XmNrightPosition,       prop_setting_anchor,
353                         XmNleftAttachment,      XmATTACH_POSITION,
354                         XmNleftPosition,        prop_label_anchor,
355                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
356                         XmNtopWidget,           setting,
357                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
358                         XmNbottomWidget,        setting,
359                         NULL);
360     XmStringFree(xmlabel);
361
362     monof_cb[type] = XtVaCreateManagedWidget("changebar",
363                         xmSeparatorWidgetClass,
364                         prop_pane,
365                         XmNorientation,         XmVERTICAL,
366                         XmNseparatorType,       XmSINGLE_LINE,
367                         XmNwidth,               prop_cb_width, 
368                         XmNbackground,          parent_bg,
369                         XmNforeground,          parent_bg,
370                         XmNleftAttachment,      XmATTACH_POSITION,
371                         XmNleftPosition,        prop_cb_anchor,
372                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
373                         XmNtopWidget,           setting,
374                         XmNrightAttachment,     XmATTACH_POSITION,
375                         XmNrightPosition,       prop_label_anchor,
376                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
377                         XmNbottomWidget,        setting,
378                         XmNuserData,            PROP_CB_OFF,
379                         NULL);
380     XtAddCallback(monof_field[type], XmNvalueChangedCallback, prop_field_chgCB,
381                         monof_cb[type]);
382     XtVaSetValues(monof_field[type], XmNuserData,      PROP_EDIT, NULL);
383
384
385
386     /********************************************************************
387      *  Create Background Color Setting                                 *
388      ********************************************************************/
389  
390 /*
391     xmlabel = XmStringCreateLocalized("ColorChooser...");
392     bg_button[type] = button = XtVaCreateManagedWidget("color_button",
393                         xmPushButtonWidgetClass,
394                         prop_pane,
395                         XmNlabelString,         xmlabel,
396                         XmNleftAttachment,      XmATTACH_POSITION,
397                         XmNleftPosition,        prop_setting_anchor,
398                         XmNleftOffset,          prop_offset_from_lbl,
399                         XmNtopAttachment,       XmATTACH_WIDGET,
400                         XmNtopWidget,           setting,
401                         XmNtopOffset,           prop_setting_offset,
402                         NULL);
403     XmStringFree(xmlabel); 
404
405
406     xmlabel = XmStringCreateLocalized("   ");
407     bg_glyph[type] =
408                 XtVaCreateManagedWidget("color_glyph[type]",
409                         xmLabelWidgetClass,
410                         prop_pane,
411                         XmNlabelString,         xmlabel,
412                         XmNborderWidth,         1,
413                         XmNleftAttachment,      XmATTACH_WIDGET,
414                         XmNleftWidget,          button,
415                         XmNleftOffset,          4,
416                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
417                         XmNtopWidget,           button,
418                         XmNtopOffset,           2,
419                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
420                         XmNbottomWidget,        button,
421                         XmNbottomOffset,        2,
422                         NULL);
423     XmStringFree(xmlabel); 
424
425     bg_field[type] =
426                 XtVaCreateManagedWidget("color_field",
427                         xmTextFieldWidgetClass,
428                         prop_pane,
429                         XmNshadowThickness,     1,
430                         XmNhighlightThickness,  1,
431                         XmNcolumns,             14,
432                         XmNleftAttachment,      XmATTACH_WIDGET,
433                         XmNleftWidget,          bg_glyph[type],
434                         XmNleftOffset,          4,
435                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
436                         XmNtopWidget,           button,
437                         XmNtopOffset,           -1,
438                         XmNrightAttachment,     XmATTACH_POSITION,
439                         XmNrightPosition,       prop_setting_end,
440                         NULL);
441     setting = button;
442
443     xmlabel = XmStringCreateLocalized("Background:");
444     bg_label[type] = label = XtVaCreateManagedWidget("prop_label",
445                         xmLabelWidgetClass,
446                         prop_pane,
447                         XmNlabelString,         xmlabel,
448                         XmNalignment,           XmALIGNMENT_END,
449                         XmNrightAttachment,     XmATTACH_POSITION,
450                         XmNrightPosition,       prop_setting_anchor,
451                         XmNleftAttachment,      XmATTACH_POSITION,
452                         XmNleftPosition,        prop_label_anchor,
453                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
454                         XmNtopWidget,           setting,
455                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
456                         XmNbottomWidget,        setting,
457                         NULL);
458     XmStringFree(xmlabel); 
459
460     bg_cb[type] = XtVaCreateManagedWidget("changebar",
461                         xmSeparatorWidgetClass,
462                         prop_pane,
463                         XmNorientation,         XmVERTICAL,
464                         XmNseparatorType,       XmSINGLE_LINE,
465                         XmNwidth,               prop_cb_width, 
466                         XmNbackground,          parent_bg,
467                         XmNforeground,          parent_bg,
468                         XmNleftAttachment,      XmATTACH_POSITION,
469                         XmNleftPosition,        prop_cb_anchor,
470                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
471                         XmNtopWidget,           setting,
472                         XmNrightAttachment,     XmATTACH_POSITION,
473                         XmNrightPosition,       prop_label_anchor,
474                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
475                         XmNbottomWidget,        setting,
476                         XmNuserData,            PROP_CB_OFF,
477                         NULL);
478     XtAddCallback(bg_field[type], XmNvalueChangedCallback, prop_field_chgCB, bg_cb[type]);
479     XtVaSetValues(bg_field[type], XmNuserData,      PROP_EDIT, NULL);
480
481     /* Install color chooser */
482     prop_add_color_chooser(bg_button[type],bg_glyph[type],bg_field[type]);
483
484 */
485
486     /********************************************************************
487      *  Create Foreground Color Setting                                 *
488      ********************************************************************/
489
490 /*
491     xmlabel = XmStringCreateLocalized("ColorChooser...");
492     fg_button[type] = button = XtVaCreateManagedWidget("color_button",
493                         xmPushButtonWidgetClass,
494                         prop_pane,
495                         XmNlabelString,         xmlabel,
496                         XmNleftAttachment,      XmATTACH_POSITION,
497                         XmNleftPosition,        prop_setting_anchor,
498                         XmNleftOffset,          prop_offset_from_lbl,
499                         XmNtopAttachment,       XmATTACH_WIDGET,
500                         XmNtopWidget,           setting,
501                         XmNtopOffset,           prop_setting_offset,
502                         NULL);
503     XmStringFree(xmlabel); 
504
505
506     xmlabel = XmStringCreateLocalized("   ");
507     fg_glyph[type] =
508                 XtVaCreateManagedWidget("color_glyph",
509                         xmLabelWidgetClass,
510                         prop_pane,
511                         XmNlabelString,         xmlabel,
512                         XmNborderWidth,         1,
513                         XmNleftAttachment,      XmATTACH_WIDGET,
514                         XmNleftWidget,          button,
515                         XmNleftOffset,          4,
516                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
517                         XmNtopWidget,           button,
518                         XmNtopOffset,           2,
519                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
520                         XmNbottomWidget,        button,
521                         XmNbottomOffset,        2,
522                         NULL);
523     XmStringFree(xmlabel); 
524
525     fg_field[type] =
526                 XtVaCreateManagedWidget("color_field[type]",
527                         xmTextFieldWidgetClass,
528                         prop_pane,
529                         XmNshadowThickness,     1,
530                         XmNhighlightThickness,  1,
531                         XmNcolumns,             14,
532                         XmNleftAttachment,      XmATTACH_WIDGET, 
533                         XmNleftWidget,          fg_glyph[type], 
534                         XmNleftOffset,          4,
535                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
536                         XmNtopWidget,           button,
537                         XmNtopOffset,           -1,
538                         XmNrightAttachment,     XmATTACH_POSITION,
539                         XmNrightPosition,       prop_setting_end,
540                         NULL);
541     setting = button;
542
543     xmlabel = XmStringCreateLocalized("Foreground:");
544     fg_label[type] = label = XtVaCreateManagedWidget("prop_label",
545                         xmLabelWidgetClass,
546                         prop_pane,
547                         XmNlabelString,         xmlabel,
548                         XmNalignment,           XmALIGNMENT_END,
549                         XmNrightAttachment,     XmATTACH_POSITION,
550                         XmNrightPosition,       prop_setting_anchor,
551                         XmNleftAttachment,      XmATTACH_POSITION,
552                         XmNleftPosition,        prop_label_anchor,
553                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
554                         XmNtopWidget,           setting,
555                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
556                         XmNbottomWidget,        setting,
557                         NULL);
558     XmStringFree(xmlabel); 
559
560     fg_cb[type] = XtVaCreateManagedWidget("changebar",
561                         xmSeparatorWidgetClass,
562                         prop_pane,
563                         XmNorientation,         XmVERTICAL,
564                         XmNseparatorType,       XmSINGLE_LINE,
565                         XmNwidth,               prop_cb_width, 
566                         XmNbackground,          parent_bg,
567                         XmNforeground,          parent_bg,
568                         XmNleftAttachment,      XmATTACH_POSITION,
569                         XmNleftPosition,        prop_cb_anchor,
570                         XmNtopAttachment,       XmATTACH_OPPOSITE_WIDGET,
571                         XmNtopWidget,           setting,
572                         XmNrightAttachment,     XmATTACH_POSITION,
573                         XmNrightPosition,       prop_label_anchor,
574                         XmNbottomAttachment,    XmATTACH_OPPOSITE_WIDGET,
575                         XmNbottomWidget,        setting,
576                         XmNuserData,            PROP_CB_OFF,
577                         NULL);
578     XtAddCallback(fg_field[type], XmNvalueChangedCallback, prop_field_chgCB, fg_cb[type]);
579     XtVaSetValues(fg_field[type], XmNuserData,      PROP_EDIT, NULL);
580
581     /* Install color chooser */
582     prop_add_color_chooser(fg_button[type],fg_glyph[type],fg_field[type]);
583
584 */
585
586     /*
587      * Prop Init done.
588      */
589
590     current_obj[type] = NULL;
591     if (type == AB_PROP_REVOLVING)
592         XtVaSetValues(parent, 
593                         XmNuserData, current_obj[type], 
594                         NULL);
595
596     return(prop_pane);
597
598 }
599
600 static int
601 glyph_prop_activate(
602     AB_PROP_TYPE type,
603     BOOL         active
604 )
605 {
606     /* 
607      * Set sensitivity of each Prop Sheet setting
608      */
609     ui_set_active(name_label[type], active);
610     ui_set_active(name_field[type], active);
611
612     ui_set_active(colorf_label[type], active);
613     ui_set_active(colorf_field[type], active);
614
615     ui_set_active(monof_label[type], active);
616     ui_set_active(monof_field[type], active);
617
618 /*
619     ui_set_active(fg_label[type], active);
620     ui_set_active(fg_button[type], active);
621     ui_set_active(fg_field[type], active);
622 */
623
624     return OK;
625 }
626
627 static int
628 glyph_prop_clear(
629     AB_PROP_TYPE type
630 )
631 {
632     if (current_obj[type] == NULL)
633         return OK;
634
635     /* Clear Name */
636     prop_set_field(name_field[type], "");
637  
638     /* Clear Color Filename */
639     prop_set_field(colorf_field[type], "");
640
641     /* Clear Mono Filename */
642     prop_set_field(monof_field[type], "");
643  
644     /* Clear Background Color */
645 /*
646     prop_set_field(bg_field[type], "");
647     prop_set_color_glyph(bg_glyph[type], NULL);
648 */
649  
650     /* Clear Foreground Color */
651 /*
652     prop_set_field(fg_field[type], "");
653     prop_set_color_glyph(fg_glyph[type], NULL);
654 */
655     turnoff_changebars(type);
656
657     current_obj[type] = NULL;
658     if (type == AB_PROP_REVOLVING)
659         XtVaSetValues(ab_glyph_palitem->rev_prop_frame, 
660                         XmNuserData, current_obj[type], 
661                         NULL);
662
663     return OK;
664
665 }
666
667 static int
668 glyph_prop_load(
669     ABObj        obj,
670     AB_PROP_TYPE type
671 )
672 {
673     BOOL           reset = FALSE;
674
675     if (obj == NULL) 
676     {
677         if (current_obj[type] != NULL) 
678         {
679             /* Reset props for current object */
680             obj = current_obj[type];
681             reset = TRUE;
682         }
683         else
684             return ERROR;
685     }
686     else if (!obj_is_base_win(obj))
687         return ERROR;
688     else
689     {
690         /* Load props for new object */
691         current_obj[type] = obj;
692         if (type == AB_PROP_REVOLVING)
693             XtVaSetValues(ab_glyph_palitem->rev_prop_frame, 
694                         XmNuserData, current_obj[type], 
695                         NULL);
696     }
697
698     /* Load Name */
699     prop_set_field(name_field[type], obj_get_name(obj));
700
701     /* Load Color Filename */
702 /*
703     prop_set_field(colorf_field[type], obj_get_color_filename(obj));
704 */
705
706     /* Load Mono Filename */
707 /*
708     prop_set_field(monof_field[type], obj_get_mono_filename(obj));
709 */
710
711     /* Load Background Color */ 
712 /*
713     prop_set_field(bg_field[type], obj_get_bg_color(obj)); 
714     prop_set_color_glyph(bg_glyph[type], obj_get_bg_color(obj));
715 */
716  
717     /* Load Foreground Color */ 
718 /*
719     prop_set_field(fg_field[type], obj_get_fg_color(obj)); 
720     prop_set_color_glyph(fg_glyph[type], obj_get_fg_color(obj)); 
721 */
722
723     /* Turn off changebars */
724     turnoff_changebars(type);
725
726     return OK;
727 }
728
729 int
730 glyph_prop_apply(
731     AB_PROP_TYPE   type
732 )
733 {
734     STRING              value;
735
736     if (current_obj[type] == NULL)
737         return ERROR;
738
739     if (!verify_props(type))
740         return ERROR;
741
742     if (prop_changed(name_cb[type]))
743     {
744         value = ui_get_field_string(name_field[type]);
745         abobj_set_name(current_obj[type], value);
746         XtFree(value);
747     }
748     if (prop_changed(colorf_cb[type]))
749     {
750 /*
751         value = ui_get_field_string(label_field[type]);
752         abobj_set_label(current_obj[type], current_obj[type]->label_type, value);
753         XtFree(value);
754 */
755     }
756 /*
757     if (prop_changed(fg_cb[type]))
758     {
759         value = ui_get_field_string(fg_field[type]);
760         abobj_set_foreground_color(current_obj[type], value);
761         XtFree(value);
762         prop_set_color_glyph(fg_glyph[type], obj_get_fg_color(current_obj[type]));
763     }
764     if (prop_changed(bg_cb[type])) 
765     {
766         value = ui_get_field_string(bg_field[type]);
767         abobj_set_background_color(current_obj[type], value); 
768         XtFree(value); 
769         prop_set_color_glyph(bg_glyph[type], obj_get_bg_color(current_obj[type]));
770     }
771 */
772
773     turnoff_changebars(type);
774
775     return OK;
776
777 }
778
779 static BOOL
780 glyph_prop_pending(
781     AB_PROP_TYPE type
782 )
783 {
784     if (prop_get_change_count(prop_form[type]) > 0)
785         return TRUE; /* Changes pending */
786     else
787         return FALSE;/* No Changes pending */
788 }
789
790 static BOOL
791 verify_props(
792     AB_PROP_TYPE type
793 )
794 {
795
796     if (prop_changed(name_cb[type]) && !prop_name_ok(current_obj[type], name_field[type]))
797         return FALSE;
798
799 /*
800     if (prop_changed(fg_cb[type]) && !prop_color_ok(fg_field[type]))
801         return FALSE;
802
803     if (prop_changed(bg_cb[type]) && !prop_color_ok(bg_field[type]))
804         return FALSE;
805 */
806
807     return TRUE;
808 }
809
810 static void
811 turnoff_changebars(
812     AB_PROP_TYPE type
813 )
814 {
815     /* Ensure all Changebars are OFF and change_count is 0
816      */
817     prop_set_changebar(name_cb[type],           PROP_CB_OFF);
818     prop_set_changebar(colorf_cb[type],         PROP_CB_OFF);
819     prop_set_changebar(monof_cb[type],          PROP_CB_OFF);
820 /*
821     prop_set_changebar(bg_cb[type],             PROP_CB_OFF);
822     prop_set_changebar(fg_cb[type],             PROP_CB_OFF);
823 */
824
825     prop_init_change_count(prop_form[type]);
826
827 }