Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
116
cde/programs/dtappbuilder/src/libABobj/Imakefile
Normal file
116
cde/programs/dtappbuilder/src/libABobj/Imakefile
Normal file
@@ -0,0 +1,116 @@
|
||||
XCOMM $XConsortium: Imakefile /main/8 1996/10/09 14:03:41 drk $
|
||||
#define DoNormalLib YES
|
||||
#define DoSharedLib NO
|
||||
#define DoDebugLib NO
|
||||
#define DoProfileLib NO
|
||||
#define LibName ABobj
|
||||
#define LibHeaders NO
|
||||
#define LibInstall NO
|
||||
|
||||
#include "../ab.tmpl"
|
||||
#include "../ab.rules"
|
||||
|
||||
INCLUDES = -I. -I$(ABINCLUDES)
|
||||
|
||||
LINTLIBS = $(LINTXLIB) $(LINTXTOOL)
|
||||
|
||||
DEFINES =
|
||||
|
||||
SOURCES.h.shipped =
|
||||
|
||||
SOURCES.h.shared =\
|
||||
obj.h \
|
||||
obj_list.h \
|
||||
obj_notify.h \
|
||||
trav.h
|
||||
|
||||
SOURCES.h.unshared = \
|
||||
objP.h \
|
||||
obj_names_listP.h \
|
||||
obj_notifyP.h \
|
||||
obj_utils.h \
|
||||
travP.h
|
||||
|
||||
SRCS = \
|
||||
obj.c \
|
||||
obj_action.c \
|
||||
obj_alloc.c \
|
||||
obj_fields.c \
|
||||
obj_geometry.c \
|
||||
obj_init.c \
|
||||
obj_isa.c \
|
||||
obj_names_list.c \
|
||||
obj_list.c \
|
||||
obj_lists.c \
|
||||
obj_notify.c \
|
||||
obj_release.c \
|
||||
obj_scoped.c \
|
||||
obj_select.c \
|
||||
obj_tree.c \
|
||||
obj_utils.c \
|
||||
trav.c \
|
||||
travP.c \
|
||||
trav_public.c \
|
||||
trav_safe.c
|
||||
|
||||
OBJS = \
|
||||
obj.o \
|
||||
obj_action.o \
|
||||
obj_alloc.o \
|
||||
obj_fields.o \
|
||||
obj_geometry.o \
|
||||
obj_init.o \
|
||||
obj_isa.o \
|
||||
obj_list.o \
|
||||
obj_lists.o \
|
||||
obj_names_list.o \
|
||||
obj_notify.o \
|
||||
obj_release.o \
|
||||
obj_scoped.o \
|
||||
obj_select.o \
|
||||
obj_tree.o \
|
||||
obj_utils.o \
|
||||
trav.o \
|
||||
travP.o \
|
||||
trav_public.o \
|
||||
trav_safe.o
|
||||
|
||||
SYS_LIBRARIES = -lm
|
||||
|
||||
#ifdef RsArchitecture
|
||||
SYS_LIBRARIES = -lm -liconv
|
||||
#endif
|
||||
|
||||
#ifdef SunArchitecture
|
||||
SYS_LIBRARIES = -lm -ldl -lgen
|
||||
WAITTARGET = .WAIT
|
||||
#endif /* SunArchitecture */
|
||||
|
||||
LINTLIBS = $(XINPUTLIB) $(DTHELPLIB) $(DTSVCLIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
|
||||
LOCAL_LIBRARIES = $(XINPUTLIB) $(DTHELPLIB) $(DTSVCLIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
|
||||
|
||||
#include <Library.tmpl>
|
||||
|
||||
PROGRAMS = test test_notify
|
||||
|
||||
SRCS2 = test.c
|
||||
OBJS2 = test.o
|
||||
DEPLIBS2 = ../libAButil/libAButil.a libABobj.a
|
||||
ComplexProgramTarget_2(test,$(DEPLIB2),$(SYS_LIBRARIES))
|
||||
|
||||
SRCS3 = test_notify.c
|
||||
OBJS3 = test_notify.o
|
||||
DEPLIBS3 = ../libAButil/libAButil.a libABobj.a
|
||||
ComplexProgramTarget_3(test_notify,$(DEPLIBS3),$(SYS_LIBRARIES))
|
||||
|
||||
DependTarget3($(SRCS),$(SRCS2),$(SRCS3))
|
||||
|
||||
clean::
|
||||
RemoveFiles($(PROGRAMS))
|
||||
|
||||
LinkFileList(shared_includes,$(SOURCES.h.shared),../include/ab_private,../../libABobj)
|
||||
|
||||
includes:: shared_includes $(WAITTARGET)
|
||||
sdtgilcvt: libABobj.a
|
||||
dtcodegen: libABobj.a
|
||||
|
||||
13
cde/programs/dtappbuilder/src/libABobj/README.src
Normal file
13
cde/programs/dtappbuilder/src/libABobj/README.src
Normal file
@@ -0,0 +1,13 @@
|
||||
XCOMM $XConsortium: README.src /main/3 1996/04/23 20:03:52 drk $
|
||||
|
||||
Library: libABobj
|
||||
|
||||
Description:
|
||||
|
||||
-------------------------------------------------------
|
||||
-------------------------------------------------------
|
||||
|
||||
Module Prefix Description
|
||||
------ ------ -----------------------
|
||||
AB Object obj_
|
||||
AB Traversal trav_
|
||||
162
cde/programs/dtappbuilder/src/libABobj/gil.h
Normal file
162
cde/programs/dtappbuilder/src/libABobj/gil.h
Normal file
@@ -0,0 +1,162 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: gil.h /main/3 1995/11/06 18:32:09 rswiston $
|
||||
*
|
||||
* %W% %G% cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* gil.h - gil file defines, et cetera.
|
||||
*/
|
||||
#ifndef _ABOBJ_GIL_H_
|
||||
#define _ABOBJ_GIL_H_
|
||||
|
||||
/*
|
||||
* GIL file attributes
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
AB_GIL_UNDEF,
|
||||
AB_GIL_ABBREVIATED,
|
||||
AB_GIL_ACTION, /* actions - one action "type"*/
|
||||
AB_GIL_ACTIONS, /* actions - list of actions */
|
||||
AB_GIL_ANCHOR_OBJECT,
|
||||
AB_GIL_ANCHOR_POINT,
|
||||
AB_GIL_ARG_TYPE, /* actions */
|
||||
AB_GIL_BACKGROUND_COLOR,
|
||||
AB_GIL_BUSY_DROP_GLYPH,
|
||||
AB_GIL_BUTTON_TYPE,
|
||||
AB_GIL_CHOICES,
|
||||
AB_GIL_CHOICE_DEFAULTS,
|
||||
AB_GIL_CHOICE_LABEL_TYPES,
|
||||
AB_GIL_CHOICE_COLORS,
|
||||
AB_GIL_COLUMNS,
|
||||
AB_GIL_COL_ALIGNMENT,
|
||||
AB_GIL_CONNECTIONS,
|
||||
AB_GIL_CONSTANT_WIDTH,
|
||||
AB_GIL_DEFAULT_DROP_SITE,
|
||||
AB_GIL_DND_ACCEPT_CURSOR,
|
||||
AB_GIL_DND_ACCEPT_CURSOR_XHOT,
|
||||
AB_GIL_DND_ACCEPT_CURSOR_YHOT,
|
||||
AB_GIL_DND_CURSOR,
|
||||
AB_GIL_DND_CURSOR_XHOT,
|
||||
AB_GIL_DND_CURSOR_YHOT,
|
||||
AB_GIL_DRAGGABLE,
|
||||
AB_GIL_DONE_HANDLER,
|
||||
AB_GIL_DROPPABLE,
|
||||
AB_GIL_DROP_TARGET_WIDTH,
|
||||
AB_GIL_DRAWING_MODEL,
|
||||
AB_GIL_EVENTS,
|
||||
AB_GIL_EVENT_HANDLER,
|
||||
AB_GIL_FILE_CHOOSER_FILTER_PATTERN,
|
||||
AB_GIL_FILE_CHOOSER_MATCH_GLYPH,
|
||||
AB_GIL_FILE_CHOOSER_MATCH_GLYPH_MASK,
|
||||
AB_GIL_FILE_CHOOSER_TYPE,
|
||||
AB_GIL_FOREGROUND_COLOR,
|
||||
AB_GIL_FROM, /* actions */
|
||||
AB_GIL_FUNC_TYPE, /* actions */
|
||||
AB_GIL_GROUP_TYPE,
|
||||
AB_GIL_HEIGHT,
|
||||
AB_GIL_HELP,
|
||||
AB_GIL_HOFFSET,
|
||||
AB_GIL_HSCROLL,
|
||||
AB_GIL_HSPACING,
|
||||
AB_GIL_ICON,
|
||||
AB_GIL_ICON_LABEL,
|
||||
AB_GIL_ICON_MASK,
|
||||
AB_GIL_INITIAL_LIST_GLYPHS,
|
||||
AB_GIL_INITIAL_LIST_VALUES,
|
||||
AB_GIL_INITIAL_SELECTIONS,
|
||||
AB_GIL_INITIAL_STATE,
|
||||
AB_GIL_INITIAL_VALUE,
|
||||
AB_GIL_INTERFACES,
|
||||
AB_GIL_INTERNATIONAL_DB_BEGIN,
|
||||
AB_GIL_INTERNATIONAL_DB_END,
|
||||
AB_GIL_LABEL,
|
||||
AB_GIL_LABEL_TYPE,
|
||||
AB_GIL_LABEL_BOLD,
|
||||
AB_GIL_LAYOUT_TYPE,
|
||||
AB_GIL_MAPPED,
|
||||
AB_GIL_MAX_TICK_STRING,
|
||||
AB_GIL_MAX_VALUE,
|
||||
AB_GIL_MAX_VALUE_STRING,
|
||||
AB_GIL_MEMBERS,
|
||||
AB_GIL_MENU_HANDLER,
|
||||
AB_GIL_MENU_ITEM_ACCELERATORS,
|
||||
AB_GIL_MENU_ITEM_COLORS,
|
||||
AB_GIL_MENU_ITEM_DEFAULTS,
|
||||
AB_GIL_MENU_ITEM_HANDLERS,
|
||||
AB_GIL_MENU_ITEM_LABELS,
|
||||
AB_GIL_MENU_ITEM_LABEL_TYPES,
|
||||
AB_GIL_MENU_ITEM_MENUS,
|
||||
AB_GIL_MENU_ITEM_STATES,
|
||||
AB_GIL_MENU_NAME,
|
||||
AB_GIL_MENU_TITLE,
|
||||
AB_GIL_MENU_TYPE,
|
||||
AB_GIL_MIN_TICK_STRING,
|
||||
AB_GIL_MIN_VALUE,
|
||||
AB_GIL_MIN_VALUE_STRING,
|
||||
AB_GIL_MULTIPLE_SELECTIONS,
|
||||
AB_GIL_NAME,
|
||||
AB_GIL_NORMAL,
|
||||
AB_GIL_NORMAL_DROP_GLYPH,
|
||||
AB_GIL_NOTIFY_HANDLER,
|
||||
AB_GIL_ORIENTATION,
|
||||
AB_GIL_OWNER,
|
||||
AB_GIL_PINNABLE,
|
||||
AB_GIL_PINNED,
|
||||
AB_GIL_READ_ONLY,
|
||||
AB_GIL_REFERENCE_POINT,
|
||||
AB_GIL_REPAINT_PROC,
|
||||
AB_GIL_RESIZABLE,
|
||||
AB_GIL_ATT_ROOT_WINDOW,
|
||||
AB_GIL_ROWS,
|
||||
AB_GIL_ROW_ALIGNMENT,
|
||||
AB_GIL_SCROLLABLE_HEIGHT,
|
||||
AB_GIL_SCROLLABLE_WIDTH,
|
||||
AB_GIL_SELECTION_REQUIRED,
|
||||
AB_GIL_SETTING_TYPE,
|
||||
AB_GIL_SHOW_BORDER,
|
||||
AB_GIL_SHOW_ENDBOXES,
|
||||
AB_GIL_SHOW_FOOTER,
|
||||
AB_GIL_SHOW_RANGE,
|
||||
AB_GIL_SHOW_VALUE,
|
||||
AB_GIL_SLIDER_WIDTH,
|
||||
AB_GIL_STORED_LENGTH,
|
||||
AB_GIL_TEXT_TYPE,
|
||||
AB_GIL_TICKS,
|
||||
AB_GIL_TITLE,
|
||||
AB_GIL_TO, /* actions */
|
||||
AB_GIL_TYPE,
|
||||
AB_GIL_USER_DATA,
|
||||
AB_GIL_VALUE_LENGTH,
|
||||
AB_GIL_VALUE_UNDERLINED,
|
||||
AB_GIL_VALUE_X,
|
||||
AB_GIL_VALUE_Y,
|
||||
AB_GIL_VOFFSET,
|
||||
AB_GIL_VSCROLL,
|
||||
AB_GIL_VSPACING,
|
||||
AB_GIL_WHEN, /* actions */
|
||||
AB_GIL_WIDTH,
|
||||
AB_GIL_X,
|
||||
AB_GIL_Y,
|
||||
AB_GIL_ATTRIBUTE_NUM_VALUES /* must be last */
|
||||
} AB_GIL_ATTRIBUTE;
|
||||
|
||||
AB_GIL_ATTRIBUTE ab_string_to_gil_att(STRING att);
|
||||
STRING ab_gil_att_to_string(AB_GIL_ATTRIBUTE att);
|
||||
|
||||
#endif /* _ABOBJ_GIL_H_ */
|
||||
769
cde/programs/dtappbuilder/src/libABobj/obj.c
Normal file
769
cde/programs/dtappbuilder/src/libABobj/obj.c
Normal file
@@ -0,0 +1,769 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj.c /main/4 1996/10/02 16:11:56 drk $
|
||||
*
|
||||
* @(#)obj.c 3.46 11 Feb 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special restrictions in a
|
||||
* confidential disclosure agreement between HP, IBM, Sun, USL, SCO and
|
||||
* Univel. Do not distribute this document outside HP, IBM, Sun, USL, SCO,
|
||||
* or Univel without Sun's specific written approval. This document and all
|
||||
* copies and derivative works thereof must be returned or destroyed at Sun's
|
||||
* request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* ABObj.c - manipulations of one gobj structure
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <values.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include "objP.h" /* include first! */
|
||||
#include <ab_private/trav.h>
|
||||
#include <ab_private/util.h>
|
||||
#include "obj_names_listP.h"
|
||||
#include "obj_notifyP.h"
|
||||
|
||||
static int
|
||||
objP_or_tree_update_clients_with_data(
|
||||
ABObj obj,
|
||||
BOOL update_subtree,
|
||||
int update_code,
|
||||
void *update_data,
|
||||
UpdateDataFreeFunc free_func
|
||||
);
|
||||
|
||||
/*
|
||||
* Gets the item for this object with index which_item
|
||||
*/
|
||||
ABObj
|
||||
obj_get_item(ABObj obj, int which_item)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj item = NULL;
|
||||
int item_num = -1; /* must be -1 */
|
||||
|
||||
for (trav_open(&trav, obj, AB_TRAV_ITEMS_FOR_OBJ);
|
||||
(item = trav_next(&trav)) != NULL;)
|
||||
{
|
||||
++item_num;
|
||||
if (item_num == which_item)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
return item;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the Help Item for a given menubar
|
||||
*/
|
||||
ABObj
|
||||
obj_get_menubar_help_item(
|
||||
ABObj obj
|
||||
)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj help_item = NULL;
|
||||
ABObj item;
|
||||
|
||||
if (!obj_is_menubar(obj))
|
||||
return NULL;
|
||||
|
||||
for (trav_open(&trav, obj, AB_TRAV_ITEMS_FOR_OBJ);
|
||||
(item = trav_next(&trav)) != NULL;)
|
||||
{
|
||||
if (obj_is_help_item(item) == TRUE)
|
||||
{
|
||||
help_item = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
return help_item;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the number of this object, as a child of it's parent.
|
||||
*/
|
||||
int
|
||||
obj_get_child_num(ABObj obj)
|
||||
{
|
||||
int child_num = -1;
|
||||
ABObj child;
|
||||
|
||||
if (obj->parent == NULL)
|
||||
{
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
for (child = obj->parent->first_child;
|
||||
child != NULL; child = child->next_sibling)
|
||||
{
|
||||
++child_num;
|
||||
if (obj == child)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
epilogue:
|
||||
return child_num;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
obj_get_container_child(ABObj obj)
|
||||
{
|
||||
ABObj child;
|
||||
for (child = obj->first_child; child != NULL;
|
||||
child = child->next_sibling)
|
||||
{
|
||||
if (obj_is_container(child))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the item number of this object, with reference to it's parent
|
||||
*/
|
||||
int
|
||||
obj_get_item_num(ABObj obj)
|
||||
{
|
||||
int item_num = -1;
|
||||
ABObj item;
|
||||
for (item = obj->parent->first_child;
|
||||
item != NULL; item = item->next_sibling)
|
||||
{
|
||||
if (!obj_is_item(item))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
++item_num;
|
||||
if (item == obj)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return item_num;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
obj_get_menu(ABObj obj)
|
||||
{
|
||||
ABObj child = NULL;
|
||||
for (child = obj->first_child; child != NULL; child = child->next_sibling)
|
||||
{
|
||||
if (obj_is_menu(child))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
obj_get_pane_child(ABObj obj)
|
||||
{
|
||||
ABObj child;
|
||||
for (child = obj->first_child; child != NULL;
|
||||
child = child->next_sibling)
|
||||
{
|
||||
if (obj_is_pane(child))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
obj_has_menu(ABObj obj)
|
||||
{
|
||||
if (!util_strempty(obj_get_menu_name(obj)))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Moves the children only if *all* the children can be moved.
|
||||
*/
|
||||
int
|
||||
obj_move_children(ABObj to, ABObj from)
|
||||
{
|
||||
int iReturn = 0;
|
||||
int iRC = 0;/* return code */
|
||||
ABObj child = NULL;
|
||||
|
||||
/*
|
||||
* Get permission for all children
|
||||
*/
|
||||
for (child = from->first_child;
|
||||
child != NULL; child = child->next_sibling)
|
||||
{
|
||||
if ((iRC = objP_notify_send_allow_reparent(child, to)) < 0)
|
||||
{
|
||||
iReturn = iRC;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
|
||||
while ((child = from->first_child) != NULL)
|
||||
{
|
||||
|
||||
/*
|
||||
* Don't send reparent to NULL
|
||||
*/
|
||||
|
||||
objP_notify_push_mode();
|
||||
objP_notify_clear_mode(OBJEV_MODE_SEND_NOTIFY_EVS);
|
||||
obj_unparent(child);
|
||||
obj_append_child(to, child);
|
||||
objP_notify_pop_mode();
|
||||
|
||||
objP_notify_send_reparent(child, from);
|
||||
}
|
||||
|
||||
epilogue:
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/*
|
||||
* maxlen < 1 means no max.
|
||||
*/
|
||||
int
|
||||
obj_ensure_unique_name(ABObj obj, ABObj root, int maxlen)
|
||||
{
|
||||
BOOL unique = FALSE;
|
||||
BOOL error = FALSE;
|
||||
BOOL name_changed = FALSE;
|
||||
char mod_name[256];
|
||||
char obj_name[2048];
|
||||
int oldlen;
|
||||
int modlen;
|
||||
int newlen;
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj other_obj = NULL;
|
||||
int modifier = 0;
|
||||
unsigned trav_type;
|
||||
|
||||
if (obj->name == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (maxlen < 1)
|
||||
{
|
||||
maxlen = 2048;
|
||||
}
|
||||
strncpy(obj_name, istr_string(obj->name), maxlen);
|
||||
obj_name[2047] = 0;
|
||||
modifier = 0;
|
||||
unique = FALSE;
|
||||
if (obj_is_module(obj))
|
||||
{
|
||||
trav_type = AB_TRAV_MODULES;
|
||||
}
|
||||
else
|
||||
{
|
||||
trav_type = AB_TRAV_UI;
|
||||
}
|
||||
while ((!unique) && (!error))
|
||||
{
|
||||
unique = TRUE;
|
||||
for (trav_open(&trav, root, trav_type);
|
||||
(other_obj = trav_next(&trav)) != NULL;)
|
||||
{
|
||||
if ((other_obj != obj)
|
||||
&& (other_obj->name != NULL)
|
||||
&& (strncmp(istr_string(other_obj->name), obj_name, maxlen)
|
||||
== 0))
|
||||
{
|
||||
unique = FALSE;
|
||||
name_changed = TRUE;
|
||||
sprintf(mod_name, "%d", ++modifier);
|
||||
if ((strlen(mod_name) + 1) > (unsigned) maxlen)
|
||||
{
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
oldlen = istr_len(obj->name);
|
||||
modlen = strlen(mod_name);
|
||||
newlen = oldlen + modlen;
|
||||
if (newlen > maxlen)
|
||||
{
|
||||
newlen = maxlen;
|
||||
oldlen = newlen - modlen;
|
||||
}
|
||||
strncpy(obj_name, istr_string(obj->name),
|
||||
oldlen);
|
||||
obj_name[oldlen] = 0;
|
||||
strcat(obj_name, mod_name);
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
}
|
||||
if (name_changed && (!error))
|
||||
{
|
||||
/* printf("CHANGED %s -> %s\n", obj->name, obj_name); */
|
||||
|
||||
/*
|
||||
* REMIND: CHANGE ALL BY-NAME REFS TO THIS OBJECT!
|
||||
*/
|
||||
obj_set_name(obj, obj_name);
|
||||
}
|
||||
|
||||
return error ? -1 : 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Munges name, as necessary to get uniqueness
|
||||
*/
|
||||
int
|
||||
obj_set_unique_name_istr(ABObj obj, ISTRING name)
|
||||
{
|
||||
int rc = 0; /* return code */
|
||||
ISTRING newName = obj_alloc_unique_name_istr(obj, name, -1);
|
||||
rc = obj_set_name_istr(obj, newName);
|
||||
istr_destroy(newName);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_set_unique_name(ABObj obj, STRING strName)
|
||||
{
|
||||
int return_value = 0;
|
||||
ISTRING name = istr_create(strName);
|
||||
|
||||
return_value = obj_set_unique_name_istr(obj, name);
|
||||
|
||||
istr_destroy(name);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
STRING
|
||||
obj_alloc_unique_name(
|
||||
ABObj obj,
|
||||
STRING name,
|
||||
int maxNameLen
|
||||
)
|
||||
{
|
||||
ABObj parent = obj->parent;
|
||||
if ( (parent == NULL)
|
||||
|| (obj_find_by_name(parent, name) == obj) )
|
||||
{
|
||||
return strdup(name);
|
||||
}
|
||||
return obj_alloc_unique_name_for_child(parent, name, maxNameLen);
|
||||
}
|
||||
|
||||
|
||||
ISTRING
|
||||
obj_alloc_unique_name_istr(
|
||||
ABObj obj,
|
||||
ISTRING name,
|
||||
int maxNameLen
|
||||
)
|
||||
{
|
||||
ABObj parent = obj->parent;
|
||||
if ( (parent == NULL)
|
||||
|| (obj_find_by_name(parent, istr_string(name)) == obj) )
|
||||
{
|
||||
return istr_dup(name);
|
||||
}
|
||||
return obj_alloc_unique_name_istr_for_child(parent, name, maxNameLen);
|
||||
}
|
||||
|
||||
|
||||
STRING
|
||||
obj_get_unique_name(
|
||||
ABObj obj,
|
||||
STRING name,
|
||||
int maxNameLen,
|
||||
STRING nameOutBuf
|
||||
)
|
||||
{
|
||||
ABObj parent = obj->parent;
|
||||
if ( (parent == NULL)
|
||||
|| (obj_find_by_name(parent, name) == obj) )
|
||||
{
|
||||
return name;
|
||||
}
|
||||
return obj_get_unique_name_for_child(parent, name, maxNameLen-1, nameOutBuf);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* maxlen < 1 means no max.
|
||||
*/
|
||||
STRING
|
||||
obj_alloc_unique_name_for_child(
|
||||
ABObj obj,
|
||||
STRING name,
|
||||
int maxlen
|
||||
)
|
||||
{
|
||||
char nameBuf[8192];
|
||||
STRING unique_name = NULL;
|
||||
*nameBuf = 0;
|
||||
|
||||
if (maxlen < 0)
|
||||
{
|
||||
maxlen = 8192;
|
||||
}
|
||||
#if defined (USL) || defined(__uxp__)
|
||||
/*
|
||||
* The USL specific changes were added ifdef due to time constraints
|
||||
* They should be removed in the next release
|
||||
*/
|
||||
maxlen = util_min(8191,maxlen); /* don't overrun buf */
|
||||
#else
|
||||
maxlen = util_min(8192,maxlen); /* don't overrun buf */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Alloc space and copy-in the unique name
|
||||
*/
|
||||
unique_name = strdup(
|
||||
obj_get_unique_name_for_child(obj, name, maxlen-1, nameBuf));
|
||||
|
||||
return unique_name;
|
||||
}
|
||||
|
||||
|
||||
ISTRING
|
||||
obj_alloc_unique_name_istr_for_child(
|
||||
ABObj obj,
|
||||
ISTRING name,
|
||||
int maxlen
|
||||
)
|
||||
{
|
||||
char nameBuf[8192];
|
||||
ISTRING unique_name = NULL;
|
||||
*nameBuf = 0;
|
||||
|
||||
if (maxlen < 0)
|
||||
{
|
||||
maxlen = 8192;
|
||||
}
|
||||
#if defined (USL) || defined(__uxp__)
|
||||
maxlen = util_min(8191,maxlen);
|
||||
#else
|
||||
maxlen = util_min(8192,maxlen);
|
||||
#endif
|
||||
unique_name = istr_create(
|
||||
obj_get_unique_name_for_child(obj, istr_string(name), maxlen-1, nameBuf));
|
||||
|
||||
return unique_name;
|
||||
}
|
||||
|
||||
|
||||
STRING
|
||||
obj_get_unique_name_for_child(
|
||||
ABObj obj,
|
||||
STRING name,
|
||||
int maxlen,
|
||||
STRING nameOutBuf
|
||||
)
|
||||
{
|
||||
STRING returnName = NULL;
|
||||
int nameOutBufSize = maxlen+1;
|
||||
StringList namesList = NULL;
|
||||
BOOL done = FALSE;
|
||||
BOOL unique = FALSE;
|
||||
int nameLen = 0;
|
||||
int i = 0;
|
||||
int objNumberStart = 0;
|
||||
int objNumber = 0;
|
||||
|
||||
namesList = objP_get_names_scope_for_children(obj);
|
||||
if (namesList == NULL)
|
||||
{
|
||||
returnName = name;
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
unique = !strlist_str_exists(namesList, name);
|
||||
if (unique)
|
||||
{
|
||||
returnName = name;
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine trailing number
|
||||
*/
|
||||
util_strncpy(nameOutBuf, name, nameOutBufSize);
|
||||
nameLen = strlen(nameOutBuf);
|
||||
for (i = nameLen-1; i >= 0; --i)
|
||||
{
|
||||
if (!isdigit(nameOutBuf[i]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
objNumberStart = i + 1;
|
||||
objNumber = atoi(&(nameOutBuf[objNumberStart]));
|
||||
|
||||
/*
|
||||
* Search for a unique name by incrementing trailing #
|
||||
*/
|
||||
unique = FALSE;
|
||||
done = FALSE;
|
||||
while (!done)
|
||||
{
|
||||
if (++objNumber == 1)
|
||||
{
|
||||
/* skip 1 - name w/no # is implied 1 */
|
||||
objNumber = 2;
|
||||
}
|
||||
sprintf(&(nameOutBuf[objNumberStart]), "%d", objNumber);
|
||||
unique = !strlist_str_exists(namesList, nameOutBuf);
|
||||
done = unique;
|
||||
}
|
||||
if (unique)
|
||||
{
|
||||
returnName = nameOutBuf;
|
||||
}
|
||||
|
||||
epilogue:
|
||||
return returnName;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Don't run this on a project!!! It's a severe dog, and can take many
|
||||
* seconds to complete.
|
||||
*
|
||||
* Run it on each module (root = an module) instead.
|
||||
*/
|
||||
int
|
||||
obj_tree_ensure_unique_names(ABObj root, int maxnamelen)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj obj;
|
||||
|
||||
for (trav_open(&trav, root, AB_TRAV_UI);
|
||||
(obj = trav_next(&trav)) != NULL;)
|
||||
{
|
||||
obj_ensure_unique_name(obj, root, maxnamelen);
|
||||
}
|
||||
trav_close(&trav);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Calls obj_tree_ensure_unique_names on each module in the given tree.
|
||||
*/
|
||||
int
|
||||
obj_tree_ensure_unique_names_in_modules(ABObj root, int maxnamelen)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj module;
|
||||
|
||||
for (trav_open(&trav, root, AB_TRAV_MODULES);
|
||||
(module = trav_next(&trav)) != NULL;)
|
||||
{
|
||||
obj_tree_ensure_unique_names(module, maxnamelen);
|
||||
}
|
||||
trav_close(&trav);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gives an object a name by munging it's parent's name with it's own label.
|
||||
* Used for item children, which aren't given names directly.
|
||||
*
|
||||
* actual_parent overrides the parent of the object. If actual_parent is NULL,
|
||||
* the "normal" parent of the object is used.
|
||||
*/
|
||||
int
|
||||
obj_set_name_from_label(ABObj obj, STRING parent_name_in)
|
||||
{
|
||||
STRING parent_name = NULL;
|
||||
STRING item_label = NULL;
|
||||
STRING new_name = NULL;
|
||||
|
||||
parent_name =
|
||||
(parent_name_in == NULL ?
|
||||
(obj->parent == NULL ?
|
||||
NULL
|
||||
:
|
||||
istr_string(obj->parent->name)
|
||||
)
|
||||
:
|
||||
parent_name
|
||||
);
|
||||
if (parent_name == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (istr_len(obj->label) > 0)
|
||||
{
|
||||
item_label = istr_string(obj->label);
|
||||
}
|
||||
else
|
||||
{
|
||||
item_label = "item";
|
||||
}
|
||||
|
||||
obj_set_unique_name(obj,
|
||||
ab_ident_from_name_and_label(parent_name, item_label));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
obj_set_name_from_parent(ABObj obj, STRING suffix)
|
||||
{
|
||||
STRING parent_name;
|
||||
STRING new_name = NULL;
|
||||
|
||||
parent_name = (obj->parent == NULL ?
|
||||
NULL
|
||||
:
|
||||
istr_string(obj->parent->name)
|
||||
);
|
||||
|
||||
if (parent_name == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
obj_set_unique_name(obj,
|
||||
ab_ident_from_name_and_label(parent_name,
|
||||
suffix));
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets a name for an object. Object may be NULL, or have a NULL name
|
||||
*
|
||||
* Copies name into passed-in buffer name, guarantees 0 termination. returns
|
||||
* parameter string
|
||||
*/
|
||||
STRING
|
||||
obj_get_safe_name(ABObj obj, STRING name, int name_size)
|
||||
{
|
||||
if (name_size < 1)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
if (obj == NULL)
|
||||
{
|
||||
strncpy(name, "(nil ABObj)", name_size);
|
||||
}
|
||||
else if (obj_get_name(obj) == NULL)
|
||||
{
|
||||
char buf[256];
|
||||
sprintf(buf, "(ABObj:0x%08lx)", obj);
|
||||
strncpy(name, buf, name_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(name, obj_get_name(obj), name_size);
|
||||
}
|
||||
|
||||
name[name_size - 1] = 0;
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** UPDATE_CLIENTS METHODS **
|
||||
** **
|
||||
*************************************************************************/
|
||||
|
||||
int
|
||||
obj_update_clients(ABObj obj)
|
||||
{
|
||||
return objP_notify_send_update(obj, FALSE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_tree_update_clients(ABObj tree)
|
||||
|
||||
{
|
||||
return objP_notify_send_update(tree, TRUE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_update_clients_with_data(
|
||||
ABObj obj,
|
||||
int update_code,
|
||||
void *update_data,
|
||||
UpdateDataFreeFunc free_func)
|
||||
{
|
||||
return objP_or_tree_update_clients_with_data(
|
||||
obj, FALSE, update_code, update_data, free_func);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_tree_update_clients_with_data(ABObj obj,
|
||||
int update_code,
|
||||
void *update_data,
|
||||
UpdateDataFreeFunc free_func)
|
||||
{
|
||||
return objP_or_tree_update_clients_with_data(
|
||||
obj, TRUE, update_code, update_data, free_func);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
objP_or_tree_update_clients_with_data(
|
||||
ABObj obj,
|
||||
BOOL update_subtree,
|
||||
int update_code,
|
||||
void *update_data,
|
||||
UpdateDataFreeFunc free_func
|
||||
)
|
||||
{
|
||||
int iReturn = 0;
|
||||
|
||||
/*
|
||||
* event notification will only free the data if the notify events are
|
||||
* batched. It's pretty smart about it, so we're going to go to batch
|
||||
* mode and let it handle it.
|
||||
*/
|
||||
objP_notify_push_mode();
|
||||
objP_notify_set_mode(OBJEV_MODE_BATCH_NOTIFY_EVS);
|
||||
|
||||
iReturn = objP_notify_send_update_with_data(
|
||||
obj, update_subtree, update_code, update_data, free_func);
|
||||
|
||||
objP_notify_pop_mode();
|
||||
return iReturn;
|
||||
}
|
||||
1331
cde/programs/dtappbuilder/src/libABobj/obj.h
Normal file
1331
cde/programs/dtappbuilder/src/libABobj/obj.h
Normal file
File diff suppressed because it is too large
Load Diff
174
cde/programs/dtappbuilder/src/libABobj/objP.h
Normal file
174
cde/programs/dtappbuilder/src/libABobj/objP.h
Normal file
@@ -0,0 +1,174 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: objP.h /main/3 1995/11/06 18:33:04 rswiston $
|
||||
*
|
||||
* @(#)objP.h 3.23 11 Feb 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* ABObjP.h - private declarations for libABobj
|
||||
*
|
||||
* Private file! Not to be used by library clients!
|
||||
*
|
||||
* NB - THIS FILE MUST BE INCLUDED BY EVERY FILE IN libABobj.
|
||||
* IT MUST BE INCLUDE *BEFORE* <obj.h> OR ANY OTHER INCLUDE
|
||||
* FILE THAT MAY INCLUDE <obj.h>
|
||||
*
|
||||
*/
|
||||
#ifndef _ABOBJ_ABOBJP_H_
|
||||
#define _ABOBJ_ABOBJP_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ab_private/AB.h>
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Include obj.h **
|
||||
** **
|
||||
** *BEFORE* include obj.h, map Private field names from ugly **
|
||||
** public names to something we can use internally. **
|
||||
** **
|
||||
*************************************************************************/
|
||||
#define arg_type_ABOBJPRIVDDDD4810638710 arg_type
|
||||
#define arg_value_ABOBJPRIVDDDD8231879567 arg_value
|
||||
#define builtin_ABOBJPRIVDDDD6250806957 builtin
|
||||
#define func_name_ABOBJPRIVDDDD7560862490 func_name
|
||||
#define func_type_ABOBJPRIVDDDD7651983840 func_type
|
||||
#define func_value_ABOBJPRIVDDDD4857490328 func_value
|
||||
#define code_frag_ABOBJPRIVDDDD9845797105 code_frag
|
||||
#define sval_ABOBJPRIVDDDD8534647380 sval
|
||||
#define func_name_suffix_ABOBJPRIVDDDD2467925683 func_name_suffix
|
||||
#define busy_drop_glyph_ABOBJPRIVDDDD9052574293 busy_drop_glyph
|
||||
#define filter_pattern_ABOBJPRIVDDDD3579039821 filter_pattern
|
||||
#define match_glyph_ABOBJPRIVDDDD8495326869 match_glyph
|
||||
#define match_glyph_mask_ABOBJPRIVDDDD1538296450 match_glyph_mask
|
||||
#define file_ABOBJPRIVDDDD2382601347 file
|
||||
#define stubs_file_ABOBJPRIVDDDD6123725490 stubs_file
|
||||
#define ui_file_ABOBJPRIVDDDD8421231863 ui_file
|
||||
#define accelerator_ABOBJPRIVDDDD0256230318 accelerator
|
||||
#define mnemonic_ABOBJPRIVDDDD0903052253 mnemonic
|
||||
#define file_ABOBJPRIVDDDD2192049045 file
|
||||
#define stubs_file_ABOBJPRIVDDDD1280681372 stubs_file
|
||||
#define initial_value_string_ABOBJPRIVDDDD2521740590 initial_value_string
|
||||
#define process_string_ABOBJPRIVDDDD3271493068 process_string
|
||||
#define icon_ABOBJPRIVDDDD3403707469 icon
|
||||
#define icon_mask_ABOBJPRIVDDD93883729879 icon_mask
|
||||
#define icon_label_ABOBJPRIVDDDD4898216273 icon_label
|
||||
#define name_ABOBJPRIVDDDD6281986324 name
|
||||
#define impl_flags_ABOBJPRIVDDDD5707803418 impl_flags
|
||||
#define impl_dnd_flags_ABOBJPRIVDDD7849439167 impl_dnd_flags
|
||||
#define user_data_ABOBJPRIVDDDD1031984606 user_data
|
||||
#define help_volume_ABOBJPRIVDDDD3479759502 help_volume
|
||||
#define help_location_ABOBJPRIVDDDD1652183835 help_location
|
||||
#define help_text_ABOBJPRIVDDDD3129281507 help_text
|
||||
#define drag_cursor_ABOBJPRIVDDDD9147148353 drag_cursor
|
||||
#define drag_cursor_mask_ABOBJPRIVDDDD7624768024 drag_cursor_mask
|
||||
|
||||
#define bg_color_ABOBJPRIVDDDD7609528164 bg_color
|
||||
#define fg_color_ABOBJPRIVDDDD6392057630 fg_color
|
||||
#define label_ABOBJPRIVDDDD8127856367 label
|
||||
#define menu_name_ABOBJPRIVDDDD8412670921 menu_name
|
||||
#define class_name_ABOBJPRIVDDDD9513018430 class_name
|
||||
|
||||
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** impl_flags flags **
|
||||
** **
|
||||
** NOT TO BE USED OUTSIDE libABobj! **
|
||||
** **
|
||||
*************************************************************************/
|
||||
typedef unsigned int IMPL_FLAGS;
|
||||
#define ObjFlagAlreadyFreedValue ((IMPL_FLAGS)(0xa5a5a5a5))
|
||||
#define ObjFlagNone ((IMPL_FLAGS)((0x00U)))
|
||||
#define ObjFlagIsReadOnly ((IMPL_FLAGS)((0x01U)<< 1))
|
||||
#define ObjFlagBeingDestroyed ((IMPL_FLAGS)((0x01U)<< 2))
|
||||
#define ObjFlagDestroyed ((IMPL_FLAGS)((0x01U)<< 3))
|
||||
#define ObjFlagWriteMe ((IMPL_FLAGS)((0x01U)<< 4))
|
||||
#define ObjFlagHeightIsResizable ((IMPL_FLAGS)((0x01U)<< 5))
|
||||
#define ObjFlagIsDefined ((IMPL_FLAGS)((0x01U)<< 6))
|
||||
#define ObjFlagIsInitiallyActive ((IMPL_FLAGS)((0x01U)<< 7))
|
||||
#define ObjFlagIsInitiallyVisible ((IMPL_FLAGS)((0x01U)<< 8))
|
||||
#define ObjFlagIsSelected ((IMPL_FLAGS)((0x01U)<< 9))
|
||||
#define ObjFlagWasWritten ((IMPL_FLAGS)((0x01U)<<10))
|
||||
#define ObjFlagWidthIsResizable ((IMPL_FLAGS)((0x01U)<<11))
|
||||
|
||||
/*
|
||||
* Internal lists of objects
|
||||
*/
|
||||
extern ABObjList objP_all_objs_list; /* all existing objs */
|
||||
int objP_lists_add(ABObj obj);
|
||||
int objP_lists_remove(ABObj obj);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Private functions for this code module **
|
||||
** **
|
||||
*************************************************************************/
|
||||
int obj_construct_type_specific_info(ABObj obj);
|
||||
int obj_destruct_type_specific_info(ABObj obj);
|
||||
int abo_error(STRING message);
|
||||
int obj_set_impl_flags(ABObj, IMPL_FLAGS flagsToAdd);
|
||||
int obj_clear_impl_flags(ABObj, IMPL_FLAGS flagsToClear);
|
||||
int obj_has_impl_flags(ABObj, IMPL_FLAGS flagsToTest);
|
||||
int objP_actually_destroy_one(ABObj obj);
|
||||
int objP_free_mem(ABObj obj); /* frees memory */
|
||||
int objP_update_verify(ABObj obj); /* "sometimes" verifies */
|
||||
int objP_set_parent(ABObj obj, ABObj newParent);
|
||||
|
||||
|
||||
#define do_return_if_err(_return_code, _return_value) \
|
||||
if ((_return_code) < 0) \
|
||||
{ \
|
||||
return_value= (_return_value); \
|
||||
goto epilogue; \
|
||||
}
|
||||
|
||||
#define do_return() \
|
||||
goto epilogue
|
||||
|
||||
#define do_return_code(_return_code) \
|
||||
{return_value= (_return_code); goto epilogue;}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** inline implementation **
|
||||
** **
|
||||
** **
|
||||
*************************************************************************/
|
||||
#define obj_set_impl_flags(obj, flags) ((obj)->impl_flags |= (flags))
|
||||
#define obj_clear_impl_flags(obj, flags) ((obj)->impl_flags &= ~(flags))
|
||||
#define obj_has_impl_flags(obj, flags) (((obj)->impl_flags & (flags)) != 0)
|
||||
|
||||
/*
|
||||
* Pass-by-reference func
|
||||
*/
|
||||
int objP_actually_destroy_one_impl(ABObj *objPtr);
|
||||
#define objP_actually_destroy_one(obj) (objP_actually_destroy_one_impl(&(obj)))
|
||||
|
||||
int objP_free_mem_impl(ABObj *objPtr);
|
||||
#define objP_free_mem(obj) (objP_free_mem_impl(&(obj)))
|
||||
|
||||
|
||||
#endif /* _ABOBJ_ABOBJP_H_ */
|
||||
|
||||
137
cde/programs/dtappbuilder/src/libABobj/obj_action.c
Normal file
137
cde/programs/dtappbuilder/src/libABobj/obj_action.c
Normal file
@@ -0,0 +1,137 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_action.c /main/3 1995/11/06 18:33:18 rswiston $
|
||||
*
|
||||
* @(#)obj_action.c 3.14 13 Feb 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* action.c - action stuff for gobjs
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "objP.h" /* include before other ab includes! */
|
||||
#include <ab_private/util.h>
|
||||
#include <ab_private/trav.h>
|
||||
|
||||
static BOOL actions_equal(ABObj action1, ABObj action2);
|
||||
|
||||
/*
|
||||
* Adds an action to a module, adding an action list, if necessary.
|
||||
* Will only add an action to a project, module, or actionlist.
|
||||
*/
|
||||
int
|
||||
obj_add_action(ABObj obj, ABObj action)
|
||||
{
|
||||
int retval= 0;
|
||||
ABObj child= NULL;
|
||||
ABObj actionlist= NULL;
|
||||
|
||||
if ( (!obj_is_module(obj))
|
||||
&& (!obj_is_project(obj))
|
||||
&& (!obj_is_action_list(obj)) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (obj_is_action_list(obj))
|
||||
{
|
||||
actionlist= obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* find the action list for this node */
|
||||
for (child= obj->first_child;
|
||||
child != NULL; child= child->next_sibling)
|
||||
{
|
||||
if (child->type == AB_TYPE_ACTION_LIST)
|
||||
{
|
||||
actionlist= child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (actionlist == NULL)
|
||||
{
|
||||
/* there BE no action list - create one */
|
||||
actionlist= obj_create(AB_TYPE_ACTION_LIST, NULL);
|
||||
obj_prepend_child(obj, actionlist);
|
||||
}
|
||||
|
||||
retval= obj_append_child(actionlist, action);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ABObj
|
||||
obj_find_action(ABObj root, ABObj action_template)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj action= NULL;
|
||||
for (trav_open(&trav, root, AB_TRAV_ACTIONS);
|
||||
(action= trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if (actions_equal(action, action_template))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
return action;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
actions_equal(ABObj action1, ABObj action2)
|
||||
{
|
||||
BOOL equal= FALSE;
|
||||
AB_ACTION_INFO *act1= &(action1->info.action);
|
||||
AB_ACTION_INFO *act2= &(action2->info.action);
|
||||
|
||||
if (action1 == action2)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
equal= FALSE;
|
||||
if ( (act1->func_type == act2->func_type)
|
||||
&& (act1->to == act2->to) )
|
||||
{
|
||||
equal= TRUE;
|
||||
}
|
||||
if (equal)
|
||||
{
|
||||
switch (act1->func_type)
|
||||
{
|
||||
case AB_FUNC_BUILTIN:
|
||||
equal= (act1->func_value.builtin ==
|
||||
act2->func_value.builtin);
|
||||
break;
|
||||
|
||||
case AB_FUNC_USER_DEF:
|
||||
equal= istr_equal(act1->func_value.func_name,
|
||||
act2->func_value.func_name);
|
||||
break;
|
||||
|
||||
case AB_FUNC_CODE_FRAG:
|
||||
equal= istr_equal(act1->func_value.code_frag,
|
||||
act2->func_value.code_frag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
|
||||
504
cde/programs/dtappbuilder/src/libABobj/obj_alloc.c
Normal file
504
cde/programs/dtappbuilder/src/libABobj/obj_alloc.c
Normal file
@@ -0,0 +1,504 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_alloc.c /main/3 1995/11/06 18:33:33 rswiston $
|
||||
*
|
||||
* @(#)obj_alloc.c 3.55 30 Jan 1995
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* alloc.c - allocation and deallocation of AB_OBJ structures
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "objP.h" /* put objP.h first! */
|
||||
#include "obj_names_listP.h"
|
||||
#include "obj_notifyP.h"
|
||||
#include <ab_private/util.h>
|
||||
#include <ab_private/trav.h>
|
||||
|
||||
static int objP_tree_do_destroy(ABObj obj);
|
||||
static ABObj objP_create_dup_or_ref(ABObj obj, BOOL createRef);
|
||||
static ABObj objP_tree_create_dup_or_ref(ABObj tree, BOOL createRef);
|
||||
static int objP_dup_or_ref_child_trees(
|
||||
ABObj dupRoot,
|
||||
ABObj orgRoot,
|
||||
BOOL createRef
|
||||
);
|
||||
|
||||
static int objP_remove_all_refs_to(ABObj obj);
|
||||
|
||||
|
||||
ABObj
|
||||
obj_create(AB_OBJECT_TYPE obj_type, ABObj parent)
|
||||
{
|
||||
ABObj obj= (ABObj)util_malloc(sizeof(AB_OBJ));
|
||||
if (obj == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't send reparent
|
||||
*/
|
||||
objP_notify_push_mode();
|
||||
objP_notify_clear_mode(OBJEV_MODE_SEND_ALLOW_EVS);
|
||||
objP_notify_clear_mode(OBJEV_MODE_SEND_NOTIFY_EVS);
|
||||
obj_construct(obj, obj_type, parent);
|
||||
objP_notify_pop_mode();
|
||||
|
||||
objP_notify_send_create(obj);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Creates an ABObj that is a duplicates of the given object, but does
|
||||
* NOT duplicate parent, siblings, children, et cetera.
|
||||
*
|
||||
* Most references to other objects or dynamic data are set to NULL.
|
||||
* ISTRINGS are duplicated
|
||||
*/
|
||||
static ABObj
|
||||
objP_create_dup_or_ref(ABObj obj, BOOL createRef)
|
||||
{
|
||||
ABObj newObj= (ABObj)util_malloc(sizeof(AB_OBJ));
|
||||
if (newObj == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*newObj= *obj;
|
||||
newObj->parent= NULL;
|
||||
newObj->next_sibling= NULL;
|
||||
newObj->prev_sibling= NULL;
|
||||
newObj->first_child= NULL;
|
||||
|
||||
newObj->name= istr_dup(obj->name);
|
||||
#ifdef DEBUG
|
||||
newObj->debug_name = obj->debug_name;
|
||||
#endif
|
||||
newObj->user_data= istr_dup(obj->user_data);
|
||||
newObj->bg_color= istr_dup(obj->bg_color);
|
||||
newObj->fg_color= istr_dup(obj->fg_color);
|
||||
newObj->label= istr_dup(obj->label);
|
||||
newObj->menu_name= istr_dup(obj->menu_name);
|
||||
newObj->attachments= NULL;
|
||||
newObj->part_of= NULL;
|
||||
newObj->ref_to = (createRef? obj : obj->ref_to);
|
||||
|
||||
newObj->ui_handle= NULL;
|
||||
newObj->class_name= istr_dup(obj->class_name);
|
||||
newObj->ui_args= NULL;
|
||||
obj_set_is_selected(newObj, FALSE);
|
||||
newObj->browser_data= NULL;
|
||||
newObj->projwin_data= NULL;
|
||||
|
||||
if (obj_is_action(newObj))
|
||||
{
|
||||
newObj->info.action.func_name_suffix=
|
||||
istr_dup(obj->info.action.func_name_suffix);
|
||||
}
|
||||
else if (obj_is_file_chooser(newObj))
|
||||
{
|
||||
newObj->info.file_chooser.filter_pattern=
|
||||
istr_dup(obj->info.file_chooser.filter_pattern);
|
||||
newObj->info.file_chooser.ok_label=
|
||||
istr_dup(obj->info.file_chooser.ok_label);
|
||||
newObj->info.file_chooser.directory=
|
||||
istr_dup(obj->info.file_chooser.directory);
|
||||
}
|
||||
else if (obj_is_menu(newObj))
|
||||
{
|
||||
newObj->info.menu.tear_off = obj->info.menu.tear_off;
|
||||
}
|
||||
else if (obj_is_message(newObj))
|
||||
{
|
||||
newObj->info.message.msg_string =
|
||||
istr_dup(obj->info.message.msg_string);
|
||||
newObj->info.message.action1_label =
|
||||
istr_dup(obj->info.message.action1_label);
|
||||
newObj->info.message.action2_label =
|
||||
istr_dup(obj->info.message.action2_label);
|
||||
}
|
||||
else if (obj_is_module(newObj))
|
||||
{
|
||||
newObj->info.module.file= istr_dup(obj->info.module.file);
|
||||
newObj->info.module.stubs_file= istr_dup(obj->info.module.stubs_file);
|
||||
newObj->info.module.ui_file= istr_dup(obj->info.module.ui_file);
|
||||
}
|
||||
else if (obj_is_item(newObj))
|
||||
{
|
||||
newObj->info.item.accelerator= istr_dup(newObj->info.item.accelerator);
|
||||
newObj->info.item.mnemonic= istr_dup(newObj->info.item.mnemonic);
|
||||
}
|
||||
else if (obj_is_project(newObj))
|
||||
{
|
||||
newObj->info.project.file= istr_dup(obj->info.project.file);
|
||||
newObj->info.project.stubs_file= istr_dup(obj->info.project.stubs_file);
|
||||
newObj->info.project.root_window= obj->info.project.root_window;
|
||||
}
|
||||
else if (obj_is_text(newObj))
|
||||
{
|
||||
newObj->info.text.initial_value_string=
|
||||
istr_dup(obj->info.text.initial_value_string);
|
||||
}
|
||||
else if (obj_is_term_pane(newObj))
|
||||
{
|
||||
newObj->info.term.process_string=
|
||||
istr_dup(obj->info.term.process_string);
|
||||
}
|
||||
else if (obj_is_window(newObj) && !obj_is_file_chooser(newObj))
|
||||
{
|
||||
newObj->info.window.icon= istr_dup(obj->info.window.icon);
|
||||
newObj->info.window.icon_label= istr_dup(obj->info.window.icon_label);
|
||||
}
|
||||
|
||||
objP_notify_send_create(obj);
|
||||
return newObj;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ABObj
|
||||
objP_tree_create_dup_or_ref(ABObj tree, BOOL createRef)
|
||||
{
|
||||
ABObj dupTree = NULL;
|
||||
|
||||
dupTree = objP_create_dup_or_ref(tree, createRef);
|
||||
if (dupTree != NULL)
|
||||
{
|
||||
objP_dup_or_ref_child_trees(dupTree, tree, createRef);
|
||||
}
|
||||
return dupTree;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
objP_dup_or_ref_child_trees(ABObj dupRoot, ABObj orgRoot, BOOL createRef)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* return code */
|
||||
ABObj orgChild = NULL;
|
||||
ABObj dupChild = NULL;
|
||||
|
||||
for (orgChild = orgRoot->first_child;
|
||||
orgChild != NULL; orgChild = orgChild->next_sibling)
|
||||
{
|
||||
dupChild = objP_create_dup_or_ref(orgChild, createRef);
|
||||
if (dupChild == NULL)
|
||||
{
|
||||
return_value = -1;
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
rc = obj_append_child(dupRoot, dupChild);
|
||||
do_return_if_err(rc, rc);
|
||||
|
||||
}
|
||||
|
||||
for (orgChild = orgRoot->first_child, dupChild = dupRoot->first_child;
|
||||
(orgChild != NULL) && (dupChild != NULL);
|
||||
orgChild = orgChild->next_sibling, dupChild= dupChild->next_sibling)
|
||||
{
|
||||
rc = objP_dup_or_ref_child_trees(dupChild, orgChild, createRef);
|
||||
do_return_if_err(rc,rc);
|
||||
}
|
||||
|
||||
epilogue:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Non-reference objects **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
ABObj
|
||||
obj_dup(ABObj obj)
|
||||
{
|
||||
return objP_create_dup_or_ref(obj, FALSE);
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
obj_tree_dup(ABObj tree)
|
||||
{
|
||||
return objP_tree_create_dup_or_ref(tree, FALSE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_dup_child_trees(ABObj to_root, ABObj from_root)
|
||||
{
|
||||
return objP_dup_or_ref_child_trees(to_root, from_root, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Reference objects **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
ABObj
|
||||
obj_create_ref(ABObj obj)
|
||||
{
|
||||
return objP_create_dup_or_ref(obj, TRUE);
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
obj_tree_create_ref(ABObj tree)
|
||||
{
|
||||
return objP_tree_create_dup_or_ref(tree, TRUE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_create_ref_subtrees(ABObj to_root, ABObj from_root)
|
||||
{
|
||||
return objP_dup_or_ref_child_trees(to_root, from_root, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Destroys only one object. Children of object being destroyed go to
|
||||
* destroyed object's parent
|
||||
*/
|
||||
int
|
||||
obj_destroy_one_impl(ABObj *objPtr)
|
||||
{
|
||||
#define obj (*objPtr)
|
||||
int return_value= 0;
|
||||
int iRC= 0; /* return code */
|
||||
BOOL bDestroyNotifyBatched= FALSE;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debugging())
|
||||
{
|
||||
if (obj_verify(obj) < 0)
|
||||
{
|
||||
util_dprintf(0, "WARNING: Corrupt obj detected in obj_destroy (%s:d).\n",
|
||||
__FILE__, __LINE__);
|
||||
if (debug_level() >= 3)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
/*be sure to verify if anybody accesses this now-invalid hunk o' mem*/
|
||||
obj->debug_last_verify_time = 0;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
if ( (obj_has_impl_flags(obj, ObjFlagDestroyed))
|
||||
|| (obj_has_impl_flags(obj, ObjFlagBeingDestroyed)) )
|
||||
{
|
||||
return_value = (ERR_MULTIPLE_FREE);
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send notify while parents still in tact
|
||||
*/
|
||||
obj_set_impl_flags(obj, ObjFlagBeingDestroyed); /* before notifying! */
|
||||
iRC= objP_notify_send_destroy(obj);
|
||||
bDestroyNotifyBatched= (iRC == OBJ_NOTIFY_BATCHED);
|
||||
|
||||
/*
|
||||
* If the notify batched, we don't actually destroy the object
|
||||
* until *after* the clients have been notified
|
||||
*/
|
||||
if (bDestroyNotifyBatched)
|
||||
{
|
||||
/*
|
||||
* we need to make sure a name search does not find this object.
|
||||
*/
|
||||
objP_remove_from_names_list(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return_value = objP_actually_destroy_one(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* It's officially destroyed, at this point. It just doesn't know it, yet.
|
||||
* It won't show up in traversal, find_by_name(), et cetera
|
||||
*/
|
||||
if (obj != NULL)
|
||||
{
|
||||
obj_clear_impl_flags(obj, ObjFlagBeingDestroyed);
|
||||
obj_set_impl_flags(obj, ObjFlagDestroyed);
|
||||
}
|
||||
|
||||
epilogue:
|
||||
obj = NULL; /* it's always set to NULL */
|
||||
return return_value;
|
||||
#undef obj
|
||||
}
|
||||
|
||||
|
||||
/* Destroys an entire subtree from bottom to top.
|
||||
*
|
||||
* All notifications are sent in one batch, in order to avoid actually
|
||||
* destroying object during all this business and traversals.
|
||||
*/
|
||||
int
|
||||
obj_destroy_impl(ABObj *treePtr)
|
||||
{
|
||||
#define tree (*treePtr)
|
||||
int iReturn= 0;
|
||||
|
||||
objP_notify_push_mode();
|
||||
objP_notify_set_mode(OBJEV_MODE_BATCH_NOTIFY_EVS);
|
||||
|
||||
iReturn= objP_tree_do_destroy(tree);
|
||||
|
||||
objP_notify_pop_mode();
|
||||
|
||||
tree = NULL; /* it's toast! */
|
||||
return iReturn;
|
||||
#undef tree
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Destroys an entire subtree, from bottom to top
|
||||
*/
|
||||
static int
|
||||
objP_tree_do_destroy(ABObj obj)
|
||||
{
|
||||
int iReturn= 0;
|
||||
int iRC= 0; /* return code */
|
||||
ABObj doomedChild = NULL;
|
||||
|
||||
if (obj == NULL)
|
||||
{
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Queue all the events, because destroying as we go
|
||||
* can get messy.
|
||||
*/
|
||||
while (obj_has_child(obj))
|
||||
{
|
||||
doomedChild = obj_get_child(obj, 0);
|
||||
if ((iRC= obj_destroy(doomedChild)) < 0)
|
||||
{
|
||||
iReturn= iRC;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* we have no children at this point
|
||||
*/
|
||||
iRC= obj_destroy_one(obj);
|
||||
if ((iRC < 0) && (iRC != ERR_MULTIPLE_FREE))
|
||||
{
|
||||
iReturn= iRC;
|
||||
}
|
||||
|
||||
epilogue:
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Effects: Actually performs the destroy of one object.
|
||||
*
|
||||
* DOESN'T SEND ANY EVENTS OR GET PERMISSION, OR NUTHIN!
|
||||
*
|
||||
*/
|
||||
int
|
||||
objP_actually_destroy_one_impl(ABObj *objPtr)
|
||||
{
|
||||
#define obj (*objPtr)
|
||||
int iReturn= 0;
|
||||
int iRC= 0; /* return code */
|
||||
ABObj parent= NULL;
|
||||
|
||||
/*
|
||||
* don't send events!
|
||||
*/
|
||||
objP_notify_push_mode();
|
||||
objP_notify_clear_mode(OBJEV_MODE_SEND_ALLOW_EVS);
|
||||
objP_notify_clear_mode(OBJEV_MODE_SEND_NOTIFY_EVS);
|
||||
|
||||
if ((parent= obj_get_parent(obj)) != NULL)
|
||||
{
|
||||
if ((iRC = obj_move_children(parent, obj)) < 0)
|
||||
{
|
||||
iReturn= iRC;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove any references to this object
|
||||
*/
|
||||
objP_remove_all_refs_to(obj);
|
||||
|
||||
/*
|
||||
* actually deallocate the space!
|
||||
*
|
||||
* We set the flags to AlreadyFreedValue in case an attempt is made to
|
||||
* accessed the freed data - we can check.
|
||||
*/
|
||||
obj->impl_flags= ObjFlagAlreadyFreedValue;
|
||||
objP_free_mem(obj); /* actually destroy it! */
|
||||
obj = NULL; /* objP_free_mem() does this, but I'm going to set */
|
||||
/* it to NULL, again. */
|
||||
|
||||
objP_notify_pop_mode();
|
||||
|
||||
epilogue:
|
||||
obj = NULL; /* forget we ever saw it... */
|
||||
return iReturn;
|
||||
#undef obj
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
objP_remove_all_refs_to(ABObj obj)
|
||||
{
|
||||
return obj_replace(obj, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Here, we (finally), actually free the memory associated with an object
|
||||
*/
|
||||
int
|
||||
objP_free_mem_impl(ABObj *objPtr)
|
||||
{
|
||||
#define obj (*objPtr)
|
||||
|
||||
obj_destruct(obj);
|
||||
util_free(obj);
|
||||
obj= NULL;
|
||||
|
||||
return 0;
|
||||
#undef obj
|
||||
}
|
||||
420
cde/programs/dtappbuilder/src/libABobj/obj_args.c
Normal file
420
cde/programs/dtappbuilder/src/libABobj/obj_args.c
Normal file
@@ -0,0 +1,420 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_args.c /main/3 1995/11/06 18:33:49 rswiston $
|
||||
*
|
||||
* @(#)obj_args.c 3.23 17 Feb 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* args.c - handles arguments
|
||||
*/
|
||||
|
||||
#ifdef BOGUS /* we don't use ABArgs, any more. The front end uses */
|
||||
/* Xt args, independent from us */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ab_private/util.h>
|
||||
#include "objP.h"
|
||||
|
||||
#undef obj_set_arg
|
||||
#define obj_set_arg obj_priv_set_arg
|
||||
|
||||
#undef obj_set_arg_if_new
|
||||
#define obj_set_arg_if_new obj_priv_set_arg_if_new
|
||||
|
||||
|
||||
static ABArgList MergeArgLists(ABArgList args1, int num_args1,
|
||||
ABArgList args2, int num_args2);
|
||||
static ABTypedArg MergeTypedArgLists(ABTypedArg args1, int num_args1,
|
||||
ABTypedArg args2, int num_args2);
|
||||
|
||||
/*
|
||||
* To this routine just pass in 'Arg *' and the obj of type ABObj.
|
||||
* it will merge with existing args for obj and stick it back in
|
||||
* obj->args.
|
||||
*
|
||||
*/
|
||||
int
|
||||
obj_set_arg(ABObj obj, AB_ARG_TYPE type, STRING name, void *value)
|
||||
{
|
||||
ABArgList merged_list= NULL;
|
||||
int nargs= 0;
|
||||
ABArg oldarg;
|
||||
AB_ARG newarg;
|
||||
|
||||
if ((type == AB_ARG_STRING) ||
|
||||
(type == AB_ARG_XMSTRING) ||
|
||||
(type == AB_ARG_LITERAL))
|
||||
{
|
||||
ABSetArg(&newarg, type, istr_create(name),
|
||||
istr_create((STRING)(value)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ABSetArg(&newarg, type, istr_create(name), value);
|
||||
}
|
||||
|
||||
if ((oldarg= obj_get_arg(obj, name)) != NULL)
|
||||
{
|
||||
/* replace existing arg */
|
||||
*oldarg= newarg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Doesn't exist - create and add it
|
||||
*/
|
||||
if ((nargs = obj_get_num_args(obj)) == 0)
|
||||
{ /* first time ever */
|
||||
merged_list= MergeArgLists(&newarg, 1, (ABArgList)NULL, 0);
|
||||
obj->args = merged_list;
|
||||
}
|
||||
else
|
||||
{ /* merge with existing args */
|
||||
merged_list= MergeArgLists(&newarg, 1, obj->args, nargs);
|
||||
(void) free(obj->args);
|
||||
obj->args = merged_list;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* sets the argument only if it doesn't already exist in the object
|
||||
* returns 0 if the arg is set, negative if not
|
||||
*/
|
||||
int
|
||||
obj_set_arg_if_new(ABObj obj, AB_ARG_TYPE type, STRING name, void *value)
|
||||
{
|
||||
ABArg old_arg= obj_get_arg(obj, name);
|
||||
if (old_arg != NULL)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return obj_set_arg(obj, type, name, value);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
obj_remove_all_args(ABObj obj)
|
||||
{
|
||||
util_free(obj->args);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
obj_remove_all_typed_args(ABObj obj)
|
||||
{
|
||||
util_free(obj->typed_args);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* To this routine just pass in 'XtTypedArg *' and the obj of type ABObj,
|
||||
* it will merge with existing args for obj and stick it back in
|
||||
* obj->typed_args
|
||||
*
|
||||
*/
|
||||
int
|
||||
obj_set_typed_arg(
|
||||
ABObj obj,
|
||||
AB_ARG_TYPE type,
|
||||
STRING name,
|
||||
STRING value_type,
|
||||
int value_size,
|
||||
void *value
|
||||
)
|
||||
{
|
||||
AB_TYPED_ARG newarg;
|
||||
ABTypedArg merged_list= NULL;
|
||||
int nargs= 0;
|
||||
|
||||
ABSetTypedArg(&newarg, type, istr_create(name),
|
||||
istr_create(value_type), value_size, value);
|
||||
|
||||
if ((nargs= obj_get_num_args(obj)) == 0)
|
||||
{ /* first time ever */
|
||||
merged_list= MergeTypedArgLists(&newarg, 1, NULL, 0);
|
||||
obj->typed_args = merged_list;
|
||||
}
|
||||
else
|
||||
{ /* merge with existing args */
|
||||
merged_list= MergeTypedArgLists(&newarg, 1,
|
||||
obj->typed_args, nargs);
|
||||
(void) free((STRING )obj->typed_args);
|
||||
obj->typed_args = merged_list;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* sets the typed argument only if it doesn't already exist in the object
|
||||
* returns 0 if the arg is set, negative if not.
|
||||
*/
|
||||
int
|
||||
obj_set_typed_arg_if_new(
|
||||
ABObj obj,
|
||||
AB_ARG_TYPE type,
|
||||
STRING name,
|
||||
STRING value_type,
|
||||
int value_size,
|
||||
void *value
|
||||
)
|
||||
{
|
||||
ABTypedArg old_targ= obj_get_typed_arg(obj, name);
|
||||
if (old_targ != NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return obj_set_typed_arg(obj,
|
||||
type, name, value_type, value_size, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine finds the named arg from the given obj's typed_args and
|
||||
* returns an index to it. If unable to find it returns ERROR(-1).
|
||||
*/
|
||||
ABTypedArg
|
||||
obj_get_typed_arg(ABObj obj, char *name)
|
||||
{
|
||||
register int num_args;
|
||||
register int i;
|
||||
register ABTypedArg arg_list= NULL;
|
||||
ABTypedArg arg= NULL;
|
||||
ISTRING iname= istr_get_existing(name);
|
||||
|
||||
if ((num_args= obj_get_num_args(obj)) > 0)
|
||||
{
|
||||
arg_list = obj->typed_args;
|
||||
for ( i = 0; i < num_args; i++)
|
||||
{
|
||||
if (istr_equal(arg_list[i].name, iname))
|
||||
{
|
||||
arg= &(arg_list[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
istr_destroy(iname);
|
||||
return arg;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This routine finds the named arg from the given obj's args and
|
||||
* returns an index to it. If unable to find it returns ERROR(-1).
|
||||
*/
|
||||
ABArg
|
||||
obj_get_arg(ABObj obj, char *name)
|
||||
{
|
||||
register int num_args;
|
||||
register int i;
|
||||
register ABArg arg_list;
|
||||
ABArg arg= NULL;
|
||||
ISTRING iname= istr_get_existing(name);
|
||||
|
||||
if ((num_args= obj_get_num_args(obj)) > 0)
|
||||
{
|
||||
arg_list = obj->args;
|
||||
for ( i = 0; i < num_args; i++)
|
||||
{
|
||||
if (istr_equal(arg_list[i].name, iname))
|
||||
{
|
||||
arg= &(arg_list[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
istr_destroy(iname);
|
||||
return arg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
obj_remove_typed_arg(ABObj obj, STRING targ_name)
|
||||
{
|
||||
fprintf(stderr, "WARNING: obj_remove_typed_arg unimplemented!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This routine merges two argss - allocates dynamic memory.
|
||||
*/
|
||||
static ABArgList
|
||||
MergeArgLists(ABArgList args1, int num_args1, ABArgList args2, int num_args2)
|
||||
{
|
||||
ABArgList result, args;
|
||||
|
||||
result= (ABArg)calloc((unsigned) (num_args1 + num_args2 + 1),
|
||||
sizeof(AB_ARG));
|
||||
for (args = result; num_args1 != 0; num_args1--)
|
||||
*args++ = *args1++;
|
||||
for ( ; num_args2 != 0; num_args2--)
|
||||
*args++ = *args2++;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This routine merges two typed(vararg) argss - allocated dynamic
|
||||
* memory.
|
||||
*/
|
||||
static ABTypedArg
|
||||
MergeTypedArgLists(ABTypedArg args1, int num_args1,
|
||||
ABTypedArg args2, int num_args2)
|
||||
{
|
||||
ABTypedArg result, args;
|
||||
|
||||
result= (ABTypedArg )calloc((size_t) (num_args1 + num_args2 + 1),
|
||||
(size_t) sizeof(AB_TYPED_ARG));
|
||||
|
||||
for (args = result; num_args1 != 0; num_args1--)
|
||||
*args++ = *args1++;
|
||||
for ( ; num_args2 != 0; num_args2--)
|
||||
*args++ = *args2++;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the specified arg from the args and re-arrange
|
||||
*/
|
||||
int
|
||||
obj_remove_arg(ABObj obj, STRING name)
|
||||
{
|
||||
register int i;
|
||||
register ABArgList args;
|
||||
register int nargs;
|
||||
ISTRING iname= istr_get_existing(name);
|
||||
|
||||
if ((obj == NULL) || (obj->args == NULL) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
nargs= obj_get_num_args(obj);
|
||||
if (nargs > 0)
|
||||
{
|
||||
args = obj->args;
|
||||
obj->args = (ABArgList)NULL;
|
||||
for (i = 0; i < nargs ; i++)
|
||||
{
|
||||
if (args[i].name && (istr_equal(args[i].name, iname)))
|
||||
continue;
|
||||
obj_merge_arglist(obj, &args[i]);
|
||||
}
|
||||
/** LOA (void)free((STRING )args); **/
|
||||
}
|
||||
|
||||
istr_destroy(iname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* To this routine just pass in 'Arg *' and the obj of type ABObj,
|
||||
* it will merge with existing args for obj and stick it back in obj->args
|
||||
*
|
||||
*/
|
||||
int
|
||||
obj_merge_arglist(ABObj obj, ABArg arg)
|
||||
{
|
||||
ABArgList result;
|
||||
int nargs= 0;
|
||||
|
||||
if ((nargs= obj_get_num_args(obj)) == 0)
|
||||
{ /* first time ever */
|
||||
result = MergeArgLists(arg, 1, (ABArgList)NULL, 0);
|
||||
obj->args= result;
|
||||
}
|
||||
else
|
||||
{ /* merge with existing args */
|
||||
result = MergeArgLists(arg, 1, obj->args, nargs);
|
||||
(void) free((STRING ) obj->args);
|
||||
obj->args = result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* To this routine just pass in 'XtTypedArg *' and the obj of type ABObj,
|
||||
* it will merge with existing args for obj and stick it back in
|
||||
* obj->typed_args
|
||||
*
|
||||
*/
|
||||
int
|
||||
abo_merge_typed_args(ABObj obj, ABTypedArg arg)
|
||||
{
|
||||
ABTypedArg result ;
|
||||
int nargs= 0;
|
||||
|
||||
|
||||
if ((nargs= obj_get_num_typed_args(obj)) == 0)
|
||||
{ /* first time ever */
|
||||
result = MergeTypedArgLists(arg, 1, (ABTypedArgList) NULL, 0);
|
||||
obj->typed_args = result;
|
||||
}
|
||||
else
|
||||
{ /* merge with existing args */
|
||||
result = MergeTypedArgLists(arg, 1,
|
||||
obj->typed_args, nargs);
|
||||
(void) free((STRING )obj->typed_args);
|
||||
obj->typed_args = result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the number of args in the given ABObj
|
||||
*/
|
||||
int
|
||||
obj_get_num_args(ABObj obj)
|
||||
{
|
||||
register ABArgList args= obj->args;
|
||||
register int n = 0;
|
||||
|
||||
for ( ; (args != (ABArgList)NULL) && (args->name != NULL);
|
||||
args++, n++)
|
||||
;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Count number of args in a typed arg list
|
||||
*/
|
||||
int
|
||||
obj_get_num_typed_args(ABObj obj)
|
||||
{
|
||||
register ABTypedArg args = obj->typed_args;
|
||||
register int n = 0;
|
||||
|
||||
for ( ; (args != NULL) && (args->name != NULL); args++, n++)
|
||||
{
|
||||
}
|
||||
|
||||
return (n);
|
||||
}
|
||||
|
||||
#endif /* BOGUS */
|
||||
27
cde/programs/dtappbuilder/src/libABobj/obj_destroy.c
Normal file
27
cde/programs/dtappbuilder/src/libABobj/obj_destroy.c
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_destroy.c /main/3 1995/11/06 18:34:03 rswiston $
|
||||
*
|
||||
* %W% %G%
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* skeleton.c - skeleton c file.
|
||||
*/
|
||||
|
||||
#include "skeleton.h"
|
||||
|
||||
4288
cde/programs/dtappbuilder/src/libABobj/obj_fields.c
Normal file
4288
cde/programs/dtappbuilder/src/libABobj/obj_fields.c
Normal file
File diff suppressed because it is too large
Load Diff
188
cde/programs/dtappbuilder/src/libABobj/obj_geometry.c
Normal file
188
cde/programs/dtappbuilder/src/libABobj/obj_geometry.c
Normal file
@@ -0,0 +1,188 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_geometry.c /main/3 1995/11/06 18:34:59 rswiston $
|
||||
*
|
||||
* @(#)obj_geometry.c 1.10 08 Mar 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* obj_geometry.c - geometry management
|
||||
*/
|
||||
|
||||
#include "objP.h"
|
||||
#include "obj_notifyP.h"
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Constants (#define and const) **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Private Functions (C declarations and macros) **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Data **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Function Definitions **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Get values **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
int
|
||||
obj_get_geometry(ABObj obj, int *x, int *y, int *width, int *height)
|
||||
{
|
||||
*x= obj->x;
|
||||
*y= obj->y;
|
||||
*width= obj->width;
|
||||
*height= obj->height;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_get_position(ABObj obj, int *x, int *y)
|
||||
{
|
||||
*x= obj->x;
|
||||
*y= obj->y;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_get_size(ABObj obj, int *width, int *height)
|
||||
{
|
||||
*width= obj->width;
|
||||
*height= obj->height;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Set values **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
int
|
||||
obj_set_geometry(ABObj obj, int newX, int newY, int newWidth, int newHeight)
|
||||
{
|
||||
int iReturn= 0;
|
||||
int iRC= 0; /* return code */
|
||||
int oldX= obj->x;
|
||||
int oldY= obj->y;
|
||||
int oldWidth= obj->width;
|
||||
int oldHeight= obj->height;
|
||||
BOOL changed= ( (oldX != newX)
|
||||
|| (oldY != newY)
|
||||
|| (oldWidth != newWidth)
|
||||
|| (oldHeight != newHeight) );
|
||||
|
||||
if (!changed)
|
||||
{
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
iRC= objP_notify_send_allow_geometry_change(obj,
|
||||
newX, newY, newWidth, newHeight);
|
||||
if (iRC < 0)
|
||||
{
|
||||
iReturn= iRC;
|
||||
goto epilogue;
|
||||
}
|
||||
oldX = obj->x;
|
||||
oldY = obj->y;
|
||||
oldWidth = obj->width;
|
||||
oldHeight = obj->height;
|
||||
obj->x= newX;
|
||||
obj->y= newY;
|
||||
obj->width= newWidth;
|
||||
obj->height= newHeight;
|
||||
|
||||
iReturn= objP_notify_send_geometry_change(
|
||||
obj, oldX, oldY, oldWidth, oldHeight);
|
||||
|
||||
epilogue:
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_move(ABObj obj, int newX, int newY)
|
||||
{
|
||||
return obj_set_geometry(obj, newX, newY, obj->width, obj->height);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_resize(ABObj obj, int newWidth, int newHeight)
|
||||
{
|
||||
return obj_set_geometry(obj, obj->x, obj->y, newWidth, newHeight);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Tests **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
int
|
||||
obj_test_set_geometry(ABObj obj,
|
||||
int newX, int newY, int newHeight, int newWidth)
|
||||
{
|
||||
int iReturn= 0;
|
||||
objP_notify_push_mode();
|
||||
objP_notify_clear_mode(OBJEV_MODE_DISALLOW_ALL_EVS);
|
||||
|
||||
iReturn= objP_notify_send_allow_geometry_change(obj,
|
||||
newX, newY, newHeight, newWidth);
|
||||
|
||||
objP_notify_pop_mode();
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_test_move(ABObj obj, int newX, int newY)
|
||||
{
|
||||
return obj_test_set_geometry(obj, newX, newY, obj->width, obj->height);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_test_resize(ABObj obj, int newWidth, int newHeight)
|
||||
{
|
||||
return obj_test_set_geometry(obj, obj->x, obj->y, newWidth, newHeight);
|
||||
}
|
||||
|
||||
532
cde/programs/dtappbuilder/src/libABobj/obj_init.c
Normal file
532
cde/programs/dtappbuilder/src/libABobj/obj_init.c
Normal file
@@ -0,0 +1,532 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_init.c /main/3 1995/11/06 18:35:13 rswiston $
|
||||
*
|
||||
* @(#)obj_init.c 3.114 03 Feb 1995
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* init.c - initialize gobj structures
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "objP.h"
|
||||
|
||||
#ifndef abo_attachments_create
|
||||
#define abo_attachments_create(o) (o)->attachments = \
|
||||
(ABAttachListPtr)util_malloc(sizeof(ABAttachmentList))
|
||||
#endif
|
||||
#ifndef abo_attachments_destroy
|
||||
#define abo_attachments_destroy(o) util_free((o)->attachments)
|
||||
#endif
|
||||
|
||||
int
|
||||
obj_init_attachments(
|
||||
ABObj obj
|
||||
)
|
||||
{
|
||||
if (obj->attachments == NULL)
|
||||
abo_attachments_create(obj);
|
||||
|
||||
obj->attachments->north.type = AB_ATTACH_NONE;
|
||||
obj->attachments->north.value = (void*)NULL;
|
||||
obj->attachments->north.offset = 0;
|
||||
|
||||
obj->attachments->south.type = AB_ATTACH_NONE;
|
||||
obj->attachments->south.value = (void*)NULL;
|
||||
obj->attachments->south.offset = 0;
|
||||
|
||||
obj->attachments->east.type = AB_ATTACH_NONE;
|
||||
obj->attachments->east.value = (void*)NULL;
|
||||
obj->attachments->east.offset = 0;
|
||||
|
||||
obj->attachments->west.type = AB_ATTACH_NONE;
|
||||
obj->attachments->west.value = (void*)NULL;
|
||||
obj->attachments->west.offset = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_construct(ABObj obj, AB_OBJECT_TYPE type, ABObj parent)
|
||||
{
|
||||
/* Assume 0 is: NULL, 0, FALSE */
|
||||
memset((void*)obj, 0, sizeof(ABObjRec));
|
||||
|
||||
obj->type = type;
|
||||
#ifdef DEBUG
|
||||
obj->debug_name = istr_string(obj->name);
|
||||
obj->debug_last_verify_time = 0;
|
||||
#endif
|
||||
obj->flags= NoFlags;
|
||||
obj->impl_flags = ObjFlagIsDefined | ObjFlagIsInitiallyVisible | ObjFlagIsInitiallyActive;
|
||||
obj->x= -1;
|
||||
obj->y= -1;
|
||||
obj->width= -1;
|
||||
obj->width_max= -1;
|
||||
obj->height= -1;
|
||||
obj->height_max= -1;
|
||||
obj->label_type = AB_LABEL_STRING;
|
||||
obj->border_frame = AB_LINE_NONE;
|
||||
|
||||
/*
|
||||
* type is set appropriately above
|
||||
*/
|
||||
obj_construct_type_specific_info(obj);
|
||||
|
||||
obj_set_parent(obj, parent);
|
||||
|
||||
objP_lists_add(obj);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
obj_construct_action(ABObj obj)
|
||||
{
|
||||
AB_ACTION_INFO *info= &(obj->info.action);
|
||||
|
||||
/* Assume 0 is: NULL, 0, FALSE */
|
||||
memset((void*)info, 0, sizeof(AB_ACTION_INFO));
|
||||
info->func_type = AB_FUNC_BUILTIN;
|
||||
info->func_value.builtin= AB_STDACT_UNDEF;
|
||||
info->arg_type = AB_ARG_VOID_PTR;
|
||||
info->arg_value.fval = (double)0.0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
obj_construct_action_list(ABObj obj)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_button(ABObj obj)
|
||||
{
|
||||
AB_BUTTON_INFO *info= &(obj->info.button);
|
||||
|
||||
info->type = AB_BUT_PUSH;
|
||||
info->label_alignment = AB_ALIGN_CENTER;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_drawing_area(ABObj obj)
|
||||
{
|
||||
AB_DRAWING_AREA_INFO *info= &(obj->info.drawing_area);
|
||||
|
||||
info->drawarea_width = 0;
|
||||
info->drawarea_height = 0;
|
||||
info->hscrollbar = AB_SCROLLBAR_ALWAYS;
|
||||
info->vscrollbar = AB_SCROLLBAR_ALWAYS;
|
||||
info->pane_min = 1;
|
||||
info->pane_max = 1000;
|
||||
info->menu_title = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_combo_box(ABObj obj)
|
||||
{
|
||||
AB_COMBO_BOX_INFO *info= &(obj->info.combo_box);
|
||||
obj_set_impl_flags(obj, ObjFlagIsReadOnly);
|
||||
info->label_position = AB_CP_WEST;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_container(ABObj obj)
|
||||
{
|
||||
AB_CONTAINER_INFO *info= &(obj->info.container);
|
||||
|
||||
info->type = AB_CONT_ABSOLUTE;
|
||||
info->has_border= FALSE;
|
||||
info->packing= AB_PACK_NONE;
|
||||
info->group_type = AB_GROUP_IGNORE;
|
||||
info->col_align= AB_ALIGN_TOP;
|
||||
info->num_columns= 0;
|
||||
info->hoffset= 0;
|
||||
info->hspacing= 0;
|
||||
info->row_align= AB_ALIGN_LEFT;
|
||||
info->num_rows= 1;
|
||||
info->voffset= 0;
|
||||
info->vspacing= 0;
|
||||
info->pane_min = 1;
|
||||
info->pane_max = 1000;
|
||||
info->menu_title = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
obj_construct_file_chooser(ABObj obj)
|
||||
{
|
||||
AB_FILE_CHOOSER_INFO *info= &(obj->info.file_chooser);
|
||||
|
||||
/* A file chooser should never be mapped upon
|
||||
* application start-up.
|
||||
*/
|
||||
obj_set_is_initially_visible(obj, FALSE);
|
||||
|
||||
info->win_parent = NULL;
|
||||
info->filter_pattern= NULL;
|
||||
info->ok_label = NULL;
|
||||
info->auto_dismiss = TRUE;
|
||||
info->directory = NULL;
|
||||
info->file_type_mask = AB_FILE_REGULAR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_msg(ABObj obj)
|
||||
{
|
||||
AB_MESSAGE_INFO *info = &(obj->info.message);
|
||||
|
||||
info->type = AB_MSG_UNDEF;
|
||||
info->msg_string = NULL;
|
||||
info->action1_label = NULL;
|
||||
info->action2_label = NULL;
|
||||
info->action3_label = NULL;
|
||||
info->cancel_button = TRUE;
|
||||
info->help_button = TRUE;
|
||||
info->default_btn = AB_DEFAULT_BTN_UNDEF;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_module(ABObj obj)
|
||||
{
|
||||
AB_MODULE_INFO *info= &(obj->info.module);
|
||||
|
||||
info->file = NULL;
|
||||
info->stubs_file = NULL;
|
||||
info->ui_file = NULL;
|
||||
info->obj_names_list = strlist_create();
|
||||
strlist_set_sort_order(info->obj_names_list, STRLIST_SORT_BEST);
|
||||
info->write_me = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_item(ABObj obj)
|
||||
{
|
||||
AB_ITEM_INFO *info= &(obj->info.item);
|
||||
|
||||
info->type = AB_ITEM_FOR_UNDEF;
|
||||
info->is_initially_selected= FALSE;
|
||||
info->is_help_item= FALSE;
|
||||
info->accelerator= NULL;
|
||||
info->mnemonic = NULL;
|
||||
info->line_style = AB_LINE_UNDEF;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_label(ABObj obj)
|
||||
{
|
||||
AB_LABEL_INFO *info= &(obj->info.label);
|
||||
|
||||
info->label_alignment= AB_ALIGN_CENTER;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_layers(ABObj obj)
|
||||
{
|
||||
AB_LAYER_INFO *info = &(obj->info.layer);
|
||||
|
||||
info->pane_min = 1;
|
||||
info->pane_max = 1000;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_menu(ABObj obj)
|
||||
{
|
||||
AB_MENU_INFO *info= &(obj->info.menu);
|
||||
|
||||
info->type = AB_MENU_PULLDOWN;
|
||||
info->tear_off= FALSE;
|
||||
info->exclusive = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_project(ABObj obj)
|
||||
{
|
||||
AB_PROJECT_INFO *info= &(obj->info.project);
|
||||
|
||||
info->file = NULL;
|
||||
info->stubs_file = NULL;
|
||||
info->vendor= NULL;
|
||||
info->version= NULL;
|
||||
info->root_window= NULL;
|
||||
info->obj_names_list = strlist_create();
|
||||
strlist_set_sort_order(info->obj_names_list, STRLIST_SORT_BEST);
|
||||
info->is_default= FALSE;
|
||||
info->res_file_arg_classes = AB_ARG_CLASS_FLAGS_NONE;
|
||||
info->browsers= NULL;
|
||||
info->session_mgmt.sessioning_method= AB_SESSIONING_NONE;
|
||||
info->tooltalk.level= AB_TOOLTALK_NONE;
|
||||
info->session_mgmt.sessioning_method= AB_SESSIONING_NONE;
|
||||
info->i18n.enabled= FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_choice(ABObj obj)
|
||||
{
|
||||
AB_CHOICE_INFO *info= &(obj->info.choice);
|
||||
|
||||
info->type = AB_CHOICE_EXCLUSIVE;
|
||||
info->orientation= AB_ORIENT_HORIZONTAL;
|
||||
info->label_position = AB_CP_WEST;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_separator(ABObj obj)
|
||||
{
|
||||
AB_SEPARATOR_INFO *info= &(obj->info.separator);
|
||||
|
||||
info->orientation = AB_ORIENT_HORIZONTAL;
|
||||
info->line_style = AB_LINE_NONE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_scale(ABObj obj)
|
||||
{
|
||||
AB_SCALE_INFO *info= &(obj->info.scale);
|
||||
|
||||
info->initial_value = 0;
|
||||
info->orientation= AB_ORIENT_HORIZONTAL;
|
||||
info->direction= AB_DIR_LEFT_TO_RIGHT;
|
||||
info->min_value = 0;
|
||||
info->max_value = 0;
|
||||
info->increment= 0;
|
||||
info->decimal_points= 0;
|
||||
info->show_value = FALSE;
|
||||
info->label_position = AB_CP_WEST;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_spin_box(ABObj obj)
|
||||
{
|
||||
AB_SPIN_BOX_INFO *info= &(obj->info.spin_box);
|
||||
info->type = AB_TEXT_NUMERIC;
|
||||
info->arrow_style = AB_ARROW_END;
|
||||
info->label_position = AB_CP_WEST;
|
||||
info->min_value = 0;
|
||||
info->max_value = 0;
|
||||
info->initial_value = 0;
|
||||
info->increment= 1;
|
||||
info->decimal_points = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_list(ABObj obj)
|
||||
{
|
||||
AB_LIST_INFO *info= &(obj->info.list);
|
||||
|
||||
info->selection_mode = AB_SELECT_SINGLE;
|
||||
info->selection_required= FALSE;
|
||||
info->num_rows= -1;
|
||||
info->vscrollbar = AB_SCROLLBAR_ALWAYS;
|
||||
info->hscrollbar = AB_SCROLLBAR_NEVER;
|
||||
info->label_position = AB_CP_WEST;
|
||||
info->menu_title = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_term_pane(
|
||||
ABObj obj
|
||||
)
|
||||
{
|
||||
AB_TERM_INFO *info= &(obj->info.term);
|
||||
|
||||
info->num_rows = 1;
|
||||
info->num_columns = 0;
|
||||
info->vscrollbar = AB_SCROLLBAR_NEVER;
|
||||
info->process_string = NULL;
|
||||
info->pane_min = 1;
|
||||
info->pane_max = 1000;
|
||||
info->menu_title = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_text(ABObj obj)
|
||||
{
|
||||
AB_TEXT_INFO *info= &(obj->info.text);
|
||||
|
||||
info->type = AB_TEXT_ALPHANUMERIC;
|
||||
info->num_rows= 1;
|
||||
info->num_columns= 0;
|
||||
info->max_length= 0;
|
||||
info->initial_value_string= NULL;
|
||||
info->initial_value_int= 0;
|
||||
info->word_wrap=FALSE;
|
||||
info->has_border= FALSE;
|
||||
info->label_position = AB_CP_WEST;
|
||||
info->vscrollbar = AB_SCROLLBAR_ALWAYS;
|
||||
info->hscrollbar = AB_SCROLLBAR_NEVER;
|
||||
info->pane_min = 1;
|
||||
info->pane_max = 1000;
|
||||
info->menu_title = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_construct_window(ABObj obj)
|
||||
{
|
||||
AB_WINDOW_INFO *info= &(obj->info.window);
|
||||
|
||||
info->win_parent = NULL;
|
||||
info->default_act_button = NULL;
|
||||
info->help_act_button = NULL;
|
||||
info->resizable = TRUE;
|
||||
info->is_initially_iconic = FALSE;
|
||||
info->icon = NULL;
|
||||
info->icon_mask = NULL;
|
||||
info->icon_label = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_construct_type_specific_info(ABObj obj)
|
||||
{
|
||||
int (*func)(ABObj obj)= NULL;
|
||||
int retval= 0;
|
||||
|
||||
if (obj_is_item(obj))
|
||||
{
|
||||
func = obj_construct_item;
|
||||
}
|
||||
else if (obj_is_window(obj) && !obj_is_file_chooser(obj))
|
||||
{
|
||||
func = obj_construct_window;
|
||||
}
|
||||
if (func == NULL)
|
||||
{
|
||||
switch (obj->type)
|
||||
{
|
||||
case AB_TYPE_ACTION:
|
||||
func = obj_construct_action;
|
||||
break;
|
||||
|
||||
case AB_TYPE_ACTION_LIST:
|
||||
func = obj_construct_action_list;
|
||||
break;
|
||||
|
||||
case AB_TYPE_BUTTON:
|
||||
func = obj_construct_button;
|
||||
break;
|
||||
|
||||
case AB_TYPE_CHOICE:
|
||||
func = obj_construct_choice;
|
||||
break;
|
||||
|
||||
case AB_TYPE_COMBO_BOX:
|
||||
func = obj_construct_combo_box;
|
||||
break;
|
||||
|
||||
case AB_TYPE_FILE_CHOOSER:
|
||||
func = obj_construct_file_chooser;
|
||||
break;
|
||||
|
||||
case AB_TYPE_MESSAGE:
|
||||
func = obj_construct_msg;
|
||||
break;
|
||||
|
||||
case AB_TYPE_CONTAINER:
|
||||
func = obj_construct_container;
|
||||
break;
|
||||
|
||||
case AB_TYPE_DRAWING_AREA:
|
||||
func = obj_construct_drawing_area;
|
||||
break;
|
||||
|
||||
case AB_TYPE_MODULE:
|
||||
func = obj_construct_module;
|
||||
break;
|
||||
|
||||
case AB_TYPE_LABEL:
|
||||
func = obj_construct_label;
|
||||
break;
|
||||
|
||||
case AB_TYPE_LAYERS:
|
||||
func = obj_construct_layers;
|
||||
break;
|
||||
|
||||
case AB_TYPE_LIST:
|
||||
func = obj_construct_list;
|
||||
break;
|
||||
|
||||
case AB_TYPE_MENU:
|
||||
func = obj_construct_menu;
|
||||
break;
|
||||
|
||||
case AB_TYPE_PROJECT:
|
||||
func = obj_construct_project;
|
||||
break;
|
||||
|
||||
case AB_TYPE_SEPARATOR:
|
||||
func = obj_construct_separator;
|
||||
break;
|
||||
|
||||
case AB_TYPE_SCALE:
|
||||
func = obj_construct_scale;
|
||||
break;
|
||||
|
||||
case AB_TYPE_SPIN_BOX:
|
||||
func = obj_construct_spin_box;
|
||||
break;
|
||||
|
||||
case AB_TYPE_TERM_PANE:
|
||||
func = obj_construct_term_pane;
|
||||
break;
|
||||
case AB_TYPE_TEXT_FIELD:
|
||||
case AB_TYPE_TEXT_PANE:
|
||||
func = obj_construct_text;
|
||||
break;
|
||||
|
||||
case AB_TYPE_UNKNOWN:
|
||||
break;
|
||||
|
||||
default:
|
||||
retval= -1;
|
||||
break;
|
||||
} /* switch */
|
||||
} /* if func */
|
||||
|
||||
if ((retval >= 0) && (func != NULL))
|
||||
{
|
||||
retval= func(obj);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
667
cde/programs/dtappbuilder/src/libABobj/obj_isa.c
Normal file
667
cde/programs/dtappbuilder/src/libABobj/obj_isa.c
Normal file
@@ -0,0 +1,667 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_isa.c /main/4 1996/08/28 14:01:31 mustafa $
|
||||
*
|
||||
* @(#)obj_isa.c 1.46 15 Feb 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special restrictions in a
|
||||
* confidential disclosure agreement between HP, IBM, Sun, USL, SCO and
|
||||
* Univel. Do not distribute this document outside HP, IBM, Sun, USL, SCO,
|
||||
* or Univel without Sun's specific written approval. This document and all
|
||||
* copies and derivative works thereof must be returned or destroyed at Sun's
|
||||
* request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* isa.c - isa relationships for AB_OBJ objects
|
||||
*/
|
||||
|
||||
#include "objP.h"
|
||||
|
||||
/*
|
||||
* Returns whether or not an object can be manipulated directly by the user.
|
||||
* For example, with a system-defined composite object, the root node is
|
||||
* salient and visible, but the subobjects are not.
|
||||
*/
|
||||
BOOL
|
||||
obj_is_salient(ABObj obj)
|
||||
{
|
||||
|
||||
/*
|
||||
* Check type first
|
||||
*/
|
||||
BOOL itIs =
|
||||
(obj_is_ui(obj)
|
||||
|| (obj->type == AB_TYPE_MODULE)
|
||||
|| (obj->type == AB_TYPE_PROJECT)
|
||||
|| (obj->type == AB_TYPE_ACTION)
|
||||
);
|
||||
|
||||
/*
|
||||
* regardless of the type, composite subobjs and menu references are not
|
||||
* salient
|
||||
*/
|
||||
if (itIs &&
|
||||
((obj_is_ref(obj)) ||
|
||||
(!obj_is_root(obj)))
|
||||
)
|
||||
{
|
||||
itIs = FALSE;
|
||||
}
|
||||
|
||||
return itIs;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return whether object is virtual - that is, it doesn't exist directly in
|
||||
* the compiled code (e.g. layered panes, an interface node)
|
||||
*
|
||||
* Note: "virtual" objects often have non-virtual children that must be written!
|
||||
*/
|
||||
BOOL
|
||||
obj_is_virtual(ABObj obj)
|
||||
{
|
||||
if (obj == NULL)
|
||||
return FALSE;
|
||||
|
||||
switch (obj->type)
|
||||
{
|
||||
case AB_TYPE_MODULE:
|
||||
case AB_TYPE_PROJECT:
|
||||
case AB_TYPE_MENU:
|
||||
case AB_TYPE_UNKNOWN:
|
||||
case AB_TYPE_MESSAGE:
|
||||
return TRUE;
|
||||
case AB_TYPE_ITEM:
|
||||
if (obj->info.item.type == AB_ITEM_FOR_MENU)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return whether the object is the composite "root"obj of a subhierarchy of
|
||||
* ABObjs which make up one UI object
|
||||
*/
|
||||
BOOL
|
||||
obj_is_root(ABObj obj)
|
||||
{
|
||||
ABObj croot = obj_get_root(obj);;
|
||||
return (croot == obj);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return whether the object is a composite subobj of a subhierarchy of
|
||||
* ABObjs which make up one UI object
|
||||
*/
|
||||
BOOL
|
||||
obj_is_sub(ABObj obj)
|
||||
{
|
||||
ABObj vroot;
|
||||
|
||||
vroot = obj->part_of;
|
||||
|
||||
if (vroot == NULL || vroot == obj)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* TRUE if the object is an item of some sort (list, choice, menu)
|
||||
*/
|
||||
BOOL
|
||||
obj_is_item(ABObj obj)
|
||||
{
|
||||
|
||||
return (obj->type == AB_TYPE_ITEM);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns whether an object is a numeric field.
|
||||
*/
|
||||
BOOL
|
||||
obj_is_numeric_field(ABObj obj)
|
||||
{
|
||||
return ((obj->type == AB_TYPE_TEXT_FIELD)
|
||||
&& (obj->info.text.type == AB_TEXT_NUMERIC));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether an object is a top-level object.
|
||||
*/
|
||||
BOOL
|
||||
obj_is_top_level(ABObj obj)
|
||||
{
|
||||
return obj_is_window(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a button
|
||||
*/
|
||||
BOOL
|
||||
obj_is_button(ABObj obj)
|
||||
{
|
||||
if (obj->type == AB_TYPE_BUTTON)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* An option menu is a type of choice. It is *not* considered a menu (it just
|
||||
* sorta looks like one)
|
||||
*/
|
||||
BOOL
|
||||
obj_is_option_menu(ABObj obj)
|
||||
{
|
||||
return (obj_is_choice(obj)
|
||||
&& (obj_get_choice_type(obj) == AB_CHOICE_OPTION_MENU));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return whether a type is a pushbutton
|
||||
*/
|
||||
BOOL
|
||||
obj_is_push_button(ABObj obj)
|
||||
{
|
||||
if (obj->type == AB_TYPE_BUTTON &&
|
||||
obj->info.button.type == AB_BUT_PUSH)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a menubutton
|
||||
*/
|
||||
BOOL
|
||||
obj_is_menu_button(ABObj obj)
|
||||
{
|
||||
if (obj->type == AB_TYPE_BUTTON &&
|
||||
obj->info.button.type == AB_BUT_MENU)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a label
|
||||
*/
|
||||
BOOL
|
||||
obj_is_label(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_LABEL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Does the object affect more than one module?
|
||||
*/
|
||||
BOOL
|
||||
obj_is_cross_module(ABObj obj)
|
||||
{
|
||||
return !obj_is_intra_module(obj);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Does the object affect only one module?
|
||||
*/
|
||||
BOOL
|
||||
obj_is_intra_module(ABObj obj)
|
||||
{
|
||||
/*
|
||||
*
|
||||
*/
|
||||
BOOL isIt = TRUE;
|
||||
|
||||
switch (obj->type)
|
||||
{
|
||||
/*
|
||||
* dialog windows can have window parents in other modules.
|
||||
*/
|
||||
case AB_TYPE_DIALOG:
|
||||
{
|
||||
ABObj winParent = obj_get_win_parent(obj);
|
||||
if ( (winParent != NULL)
|
||||
&& (obj_get_module(winParent) != obj_get_module(obj)) )
|
||||
{
|
||||
isIt = FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
* Actions can be cross-module connections
|
||||
*/
|
||||
case AB_TYPE_ACTION:
|
||||
{
|
||||
ABObj from = obj_get_from(obj);
|
||||
ABObj to = obj_get_to(obj);
|
||||
if ((from != NULL) && (to != NULL))
|
||||
{
|
||||
if (obj_get_module(from) != obj_get_module(to))
|
||||
{
|
||||
isIt = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isIt;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return whether a type is a drawing_area
|
||||
*/
|
||||
BOOL
|
||||
obj_is_drawing_area(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_DRAWING_AREA);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a term pane
|
||||
*/
|
||||
BOOL
|
||||
obj_is_term_pane(
|
||||
ABObj obj
|
||||
)
|
||||
{
|
||||
return (obj->type == AB_TYPE_TERM_PANE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a text pane
|
||||
*/
|
||||
BOOL
|
||||
obj_is_text_pane(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_TEXT_PANE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return whether a type is a canvas
|
||||
*/
|
||||
BOOL
|
||||
obj_is_container(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_CONTAINER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a control-area
|
||||
*/
|
||||
BOOL
|
||||
obj_is_control_panel(ABObj obj)
|
||||
{
|
||||
|
||||
return (obj->type == AB_TYPE_CONTAINER &&
|
||||
(obj->info.container.type == AB_CONT_ABSOLUTE ||
|
||||
obj->info.container.type == AB_CONT_RELATIVE ||
|
||||
obj->info.container.type == AB_CONT_BUTTON_PANEL ||
|
||||
obj->info.container.type == AB_CONT_TOOL_BAR ||
|
||||
obj->info.container.type == AB_CONT_FOOTER ||
|
||||
obj->info.container.type == AB_CONT_ROW_COLUMN));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a scrolling list
|
||||
*/
|
||||
BOOL
|
||||
obj_is_list(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_LIST);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a paned window
|
||||
*/
|
||||
BOOL
|
||||
obj_is_paned_win(ABObj obj)
|
||||
{
|
||||
return ((obj->type == AB_TYPE_CONTAINER)
|
||||
&& (obj->info.container.type == AB_CONT_PANED));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a menu
|
||||
*/
|
||||
BOOL
|
||||
obj_is_menu(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_MENU);
|
||||
}
|
||||
|
||||
/*
|
||||
* All functions dealing with references must allow NULL params
|
||||
*/
|
||||
BOOL
|
||||
obj_is_ref(ABObj obj)
|
||||
{
|
||||
return ((obj == NULL)? FALSE:(obj->ref_to != NULL));
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_menubar(ABObj obj)
|
||||
{
|
||||
return ((obj->type == AB_TYPE_CONTAINER)
|
||||
&& (obj->info.container.type == AB_CONT_MENU_BAR));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return whether a type is a separator
|
||||
*/
|
||||
BOOL
|
||||
obj_is_separator(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_SEPARATOR);
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_scale(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_SCALE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a combo box
|
||||
*/
|
||||
BOOL
|
||||
obj_is_combo_box(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_COMBO_BOX);
|
||||
}
|
||||
/*
|
||||
* Return whether a type is a spin box
|
||||
*/
|
||||
BOOL
|
||||
obj_is_spin_box(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_SPIN_BOX);
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_text(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_TEXT_FIELD ||
|
||||
obj->type == AB_TYPE_TEXT_PANE);
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_text_field(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_TEXT_FIELD);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return whether an object is a pane.
|
||||
*/
|
||||
BOOL
|
||||
obj_is_pane(ABObj obj)
|
||||
{
|
||||
switch (obj->type)
|
||||
{
|
||||
/* case AB_CANVAS_PANE: REMIND: do we need this? */
|
||||
case AB_TYPE_CONTAINER:
|
||||
{
|
||||
AB_CONTAINER_TYPE ctype = obj_get_container_type(obj);
|
||||
|
||||
switch (ctype)
|
||||
{
|
||||
case AB_CONT_ABSOLUTE:
|
||||
case AB_CONT_RELATIVE:
|
||||
case AB_CONT_ROW_COLUMN:
|
||||
case AB_CONT_TOOL_BAR:
|
||||
case AB_CONT_FOOTER:
|
||||
case AB_CONT_BUTTON_PANEL:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
case AB_TYPE_TEXT_PANE:
|
||||
case AB_TYPE_TERM_PANE:
|
||||
case AB_TYPE_DRAWING_AREA:
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_popup(ABObj obj)
|
||||
{
|
||||
BOOL is_popup = FALSE;
|
||||
|
||||
switch (obj->type)
|
||||
{
|
||||
case AB_TYPE_DIALOG:
|
||||
is_popup = TRUE;
|
||||
break;
|
||||
case AB_TYPE_MENU:
|
||||
is_popup = obj_is_pane(obj->parent) ||
|
||||
obj_is_list(obj->parent);
|
||||
break;
|
||||
}
|
||||
return is_popup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a menu
|
||||
*/
|
||||
BOOL
|
||||
obj_is_choice(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_CHOICE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether a type is a control.
|
||||
*/
|
||||
BOOL
|
||||
obj_is_control(ABObj obj)
|
||||
{
|
||||
switch (obj->type)
|
||||
{
|
||||
case AB_TYPE_BUTTON:
|
||||
case AB_TYPE_LABEL:
|
||||
case AB_TYPE_LIST:
|
||||
case AB_TYPE_CHOICE:
|
||||
case AB_TYPE_COMBO_BOX:
|
||||
case AB_TYPE_SCALE:
|
||||
case AB_TYPE_SEPARATOR:
|
||||
case AB_TYPE_SPIN_BOX:
|
||||
case AB_TYPE_TEXT_FIELD:
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
obj_is_layers(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_LAYERS);
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_base_win(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_BASE_WINDOW);
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_popup_win(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_DIALOG);
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_file_chooser(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_FILE_CHOOSER);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether an object is a message box
|
||||
*/
|
||||
BOOL
|
||||
obj_is_message(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_MESSAGE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return whether an object is a window.
|
||||
*/
|
||||
BOOL
|
||||
obj_is_window(ABObj obj)
|
||||
{
|
||||
switch (obj->type)
|
||||
{
|
||||
case AB_TYPE_BASE_WINDOW:
|
||||
case AB_TYPE_DIALOG:
|
||||
case AB_TYPE_FILE_CHOOSER:
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return whether an object is a group
|
||||
*/
|
||||
BOOL
|
||||
obj_is_group(ABObj obj)
|
||||
{
|
||||
return ((obj->type == AB_TYPE_CONTAINER)
|
||||
&& (obj->info.container.type == AB_CONT_GROUP));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether an object is a group member
|
||||
*/
|
||||
BOOL
|
||||
obj_is_group_member(ABObj obj)
|
||||
{
|
||||
/* Need to get the root of the parent, because the
|
||||
* group could have a border frame, in which case
|
||||
* obj_get_parent() returns the border frame container,
|
||||
* NOT the group.
|
||||
*/
|
||||
return (obj_is_group(obj_get_root(obj_get_parent(obj))));
|
||||
}
|
||||
|
||||
#ifndef obj_is_action
|
||||
BOOL
|
||||
obj_is_action(ABObj obj)
|
||||
{
|
||||
return (obj->type == AB_TYPE_ACTION);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* A UI object is one that actually has a visual representation in the user's
|
||||
* application.
|
||||
*
|
||||
* HINT: THIS DOES *NOT* INCLUDE MODULES, PROJECT, OR ACTIONS
|
||||
*/
|
||||
BOOL
|
||||
obj_is_ui(ABObj obj)
|
||||
{
|
||||
BOOL isUI = FALSE;
|
||||
|
||||
switch (obj->type)
|
||||
{
|
||||
case AB_TYPE_BASE_WINDOW:
|
||||
case AB_TYPE_BUTTON:
|
||||
case AB_TYPE_CHOICE:
|
||||
case AB_TYPE_COMBO_BOX:
|
||||
case AB_TYPE_FILE_CHOOSER:
|
||||
case AB_TYPE_MESSAGE:
|
||||
case AB_TYPE_CONTAINER:
|
||||
case AB_TYPE_DIALOG:
|
||||
case AB_TYPE_DRAWING_AREA:
|
||||
case AB_TYPE_ITEM:
|
||||
case AB_TYPE_LABEL:
|
||||
case AB_TYPE_LAYERS:
|
||||
case AB_TYPE_LIST:
|
||||
case AB_TYPE_MENU:
|
||||
case AB_TYPE_SEPARATOR:
|
||||
case AB_TYPE_SPIN_BOX:
|
||||
case AB_TYPE_SCALE:
|
||||
case AB_TYPE_TERM_PANE:
|
||||
case AB_TYPE_TEXT_FIELD:
|
||||
case AB_TYPE_TEXT_PANE:
|
||||
isUI = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
return isUI;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
obj_is_xmconfiged(ABObj obj)
|
||||
{
|
||||
return
|
||||
(obj_is_sub(obj) || (obj_has_flag(obj, XmConfiguredFlag)));
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_descendant_of(ABObj obj, ABObj ancestor)
|
||||
{
|
||||
if (!obj || !ancestor)
|
||||
return (FALSE);
|
||||
|
||||
while (obj = obj_get_parent(obj))
|
||||
{
|
||||
if (obj == ancestor)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_sibling(ABObj obj, ABObj sibling)
|
||||
{
|
||||
if (!obj || !sibling || (obj == sibling))
|
||||
return (FALSE);
|
||||
|
||||
return (obj_get_parent(obj) == obj_get_parent(sibling));
|
||||
}
|
||||
|
||||
BOOL
|
||||
obj_is_defined_module(
|
||||
ABObj obj
|
||||
)
|
||||
{
|
||||
BOOL IsDefinedMod = FALSE;
|
||||
|
||||
if (obj_is_module(obj) && obj_is_defined(obj))
|
||||
{
|
||||
IsDefinedMod = TRUE;
|
||||
}
|
||||
|
||||
return(IsDefinedMod);
|
||||
}
|
||||
668
cde/programs/dtappbuilder/src/libABobj/obj_list.c
Normal file
668
cde/programs/dtappbuilder/src/libABobj/obj_list.c
Normal file
@@ -0,0 +1,668 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_list.c /main/4 1996/10/02 16:09:05 drk $
|
||||
*
|
||||
* @(#)obj_list.c 1.8 03 Feb 1995 cde_app_builder/src/libAButil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not dobjibute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* File: objlist.c
|
||||
*/
|
||||
|
||||
#ifdef _POSIX_SOURCE
|
||||
#define _POSIX_SOURCE 1
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ab_private/obj_list.h>
|
||||
|
||||
/*****************************************************************
|
||||
** **
|
||||
** ABObjList **
|
||||
** **
|
||||
*****************************************************************/
|
||||
|
||||
static int objlistP_grow_array(ABObjList list, int sizeDiff);
|
||||
static int objlistP_shrink_array(ABObjList list, int sizeDiff);
|
||||
static int objlistP_build_user_data_array(
|
||||
ABObjList list,
|
||||
int index,
|
||||
void *data
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
#define objlistP_add_user_data(_list,_index,_data) \
|
||||
((((_list)->user_datas == NULL) && ((_data) != NULL))? \
|
||||
objlistP_build_user_data_array(_list, _index, _data) \
|
||||
: \
|
||||
((int)((_list)->user_datas[(_index)] = (_data))) \
|
||||
)
|
||||
*/
|
||||
|
||||
#define objlistP_add_user_data(_list,_index,_data) \
|
||||
(((_list)->user_datas == NULL)? \
|
||||
(((_data) == NULL)? \
|
||||
0 \
|
||||
: \
|
||||
objlistP_build_user_data_array(_list, _index, _data)) \
|
||||
: \
|
||||
((int)((_list)->user_datas[(_index)] = (_data))) \
|
||||
)
|
||||
|
||||
#define objlistP_get_user_data(_list,_index) \
|
||||
(((_list)->user_datas) == NULL? \
|
||||
NULL:((_list)->user_datas[(_index)]))
|
||||
|
||||
ABObjList
|
||||
objlist_create(void)
|
||||
{
|
||||
ABObjList list = (ABObjList) util_malloc(sizeof(ABObjListRec));
|
||||
if (list == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
objlist_construct(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_construct(ABObjList list)
|
||||
{
|
||||
list->num_objs = 0;
|
||||
list->objs_size = 0;
|
||||
list->objs = NULL;
|
||||
list->user_datas = NULL;
|
||||
list->unique = TRUE;
|
||||
list->sort_order = OBJLIST_SORT_CLIENT_DEF;
|
||||
list->indexes_dirty = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Frees the obj list and all it's associated memory.
|
||||
*/
|
||||
int
|
||||
objlist_destroy_impl(ABObjList *listInOut)
|
||||
{
|
||||
ABObjList list = (*listInOut);
|
||||
if (list != NULL)
|
||||
{
|
||||
objlist_destruct(list);
|
||||
util_free(list);
|
||||
}
|
||||
(*listInOut) = list;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_destruct(ABObjList list)
|
||||
{
|
||||
return objlist_make_empty(list);
|
||||
}
|
||||
|
||||
|
||||
OBJLIST_SORT_ORDER
|
||||
objlist_get_sort_order(ABObjList list)
|
||||
{
|
||||
return list->sort_order;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_set_sort_order(ABObjList list, OBJLIST_SORT_ORDER new_order)
|
||||
{
|
||||
int return_value = 0;
|
||||
|
||||
if (list->sort_order != new_order)
|
||||
{
|
||||
list->indexes_dirty = TRUE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_make_empty(ABObjList list)
|
||||
{
|
||||
int return_value = 0;
|
||||
|
||||
if (list->objs != NULL)
|
||||
{
|
||||
return_value = objlistP_shrink_array(list, list->objs_size);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_is_empty(ABObjList list)
|
||||
{
|
||||
return (list->num_objs < 1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_set_is_unique(ABObjList list, BOOL unique)
|
||||
{
|
||||
list->unique = unique;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
objlist_get_is_unique(ABObjList list)
|
||||
{
|
||||
return list->unique;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Searches the list for a match.
|
||||
*
|
||||
* returns: true, if the obj exists. false, if it isn't in the lisT
|
||||
*/
|
||||
BOOL
|
||||
objlist_obj_exists(ABObjList list, ABObj obj)
|
||||
{
|
||||
return (objlist_get_obj_index(list, obj) >= 0);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
objlist_get_obj_data(ABObjList list, ABObj obj)
|
||||
{
|
||||
int index = objlist_get_obj_index(list, obj);
|
||||
return objlistP_get_user_data(list, index);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the index of the given obj, or -1 if it doesn't exist
|
||||
*/
|
||||
int
|
||||
objlist_get_obj_index(ABObjList list, ABObj obj)
|
||||
{
|
||||
int index = -1;
|
||||
int i = 0;
|
||||
int num_objs = list->num_objs;
|
||||
|
||||
for (i = 0; i < num_objs; ++i)
|
||||
{
|
||||
if (list->objs[i] == obj)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add an obj
|
||||
*
|
||||
* returns: 0 if item added successfully
|
||||
* ERR_DUPLICATE_KEY if item is already in list
|
||||
*/
|
||||
int
|
||||
objlist_add_obj(ABObjList list, ABObj obj, void *clientData)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0;
|
||||
|
||||
/*
|
||||
* look for it
|
||||
*/
|
||||
if (list->unique)
|
||||
{
|
||||
int index = objlist_get_obj_index(list, obj);
|
||||
if (index >= 0)
|
||||
{
|
||||
objlistP_add_user_data(list, index, clientData);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate more space
|
||||
*/
|
||||
if (list->num_objs >= list->objs_size)
|
||||
{
|
||||
/* grow the array by 50% (the "opposite" of a binary search) */
|
||||
int new_size = (list->objs_size * 3)/2;
|
||||
int size_inc = new_size - list->objs_size;
|
||||
size_inc = util_max(5,size_inc);
|
||||
rc = objlistP_grow_array(list, size_inc);
|
||||
if (rc < 0)
|
||||
{
|
||||
return_value = rc;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* save the obj (and data)
|
||||
*/
|
||||
list->objs[list->num_objs] = obj;
|
||||
objlistP_add_user_data(list, list->num_objs, clientData);
|
||||
++(list->num_objs);
|
||||
|
||||
epilogue:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_remove_obj(ABObjList list, ABObj obj)
|
||||
{
|
||||
int index = objlist_get_obj_index(list, obj);
|
||||
if (index < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return objlist_remove_index(list, index);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_remove_index(ABObjList list, int doomedIndex)
|
||||
{
|
||||
#define num_objs (list->num_objs)
|
||||
ABObj *objs = list->objs;
|
||||
void **user_datas = list->user_datas;
|
||||
int index = 0;
|
||||
int numToMove = 0;
|
||||
|
||||
if ((doomedIndex < 0) || (doomedIndex >= num_objs))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
numToMove = (num_objs - doomedIndex - 1);
|
||||
|
||||
/*
|
||||
* Remove this obj and collapse the list
|
||||
*/
|
||||
objs[doomedIndex] = NULL;
|
||||
if (numToMove > 0)
|
||||
{
|
||||
memmove((void *)(&(objs[doomedIndex])),
|
||||
(void *)&(objs[doomedIndex+1]),
|
||||
sizeof(ABObj) * numToMove);
|
||||
objs[num_objs-1] = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroy user data and collapse list
|
||||
*/
|
||||
if (user_datas != NULL)
|
||||
{
|
||||
user_datas[doomedIndex] = NULL;
|
||||
if (numToMove > 0)
|
||||
{
|
||||
memmove((void *)(&(user_datas[doomedIndex])),
|
||||
(void *)&(user_datas[doomedIndex+1]),
|
||||
sizeof(void*) * numToMove);
|
||||
user_datas[num_objs-1] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Actually shorten list
|
||||
*/
|
||||
--num_objs;
|
||||
|
||||
return 0;
|
||||
#undef num_objs
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_get_num_objs(ABObjList list)
|
||||
{
|
||||
if (list == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return list->num_objs;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
objlist_get_obj(ABObjList list, int whichObj, void **clientDataOut)
|
||||
{
|
||||
if ((list == NULL) || (whichObj >= list->num_objs) ||
|
||||
(whichObj < 0))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (clientDataOut != NULL)
|
||||
{
|
||||
*clientDataOut = objlistP_get_user_data(list, whichObj);
|
||||
}
|
||||
return list->objs[whichObj];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Only "soft" limit is supported, now
|
||||
*/
|
||||
BOOL
|
||||
objlist_max_size_is_soft(ABObjList list)
|
||||
{
|
||||
list = list; /* avoid cc warning */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_set_max_size_soft(ABObjList list, int maxSize)
|
||||
{
|
||||
int return_value = 0;
|
||||
int sizeDiff = (maxSize - list->objs_size);
|
||||
|
||||
if (sizeDiff < 0)
|
||||
{
|
||||
return_value = objlistP_shrink_array(list, -1 * sizeDiff);
|
||||
}
|
||||
else if (sizeDiff > 0)
|
||||
{
|
||||
return_value = objlistP_grow_array(list, sizeDiff);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_get_max_size(ABObjList list)
|
||||
{
|
||||
return list->objs_size;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Frees any extra memory that may not be needed (multiple obj ptrs are
|
||||
* allocated at once, to reduce the number of realloc calls).
|
||||
*/
|
||||
int
|
||||
objlist_shrink_mem_to_fit(ABObjList list)
|
||||
{
|
||||
int return_value = 0;
|
||||
int diff = list->objs_size - list->num_objs;
|
||||
|
||||
if (diff > 0)
|
||||
{
|
||||
return_value = objlistP_shrink_array(list, diff);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objlist_iterate(
|
||||
ABObjList list,
|
||||
ABObjListIterFn fn
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!list)
|
||||
return -1;
|
||||
|
||||
for (i=0; i<list->num_objs; i++)
|
||||
{
|
||||
(*fn)(list->objs[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ABObjList
|
||||
objlist_dup(ABObjList list)
|
||||
{
|
||||
int i;
|
||||
ABObjList new_list = NULL;
|
||||
|
||||
new_list = objlist_create();
|
||||
new_list->unique = list->unique;
|
||||
new_list->sort_order = list->sort_order;
|
||||
new_list->indexes_dirty = list->indexes_dirty;
|
||||
for (i=0; i<list->num_objs; i++)
|
||||
{
|
||||
objlist_add_obj(
|
||||
new_list, list->objs[i], objlistP_get_user_data(list,i));
|
||||
}
|
||||
return(new_list);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** PRIVATE FUNCTIONS **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
objlistP_shrink_array(ABObjList list, int sizeDiff)
|
||||
{
|
||||
int return_value = 0;
|
||||
int new_objs_size = util_max(0, list->objs_size - sizeDiff);
|
||||
ABObj *new_objs = NULL;
|
||||
void **new_user_datas = NULL;
|
||||
int i = 0;
|
||||
|
||||
for (i= new_objs_size; i < list->objs_size; ++i)
|
||||
{
|
||||
list->objs[i] = NULL;
|
||||
if (list->user_datas != NULL)
|
||||
{
|
||||
list->user_datas[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (new_objs_size > 0)
|
||||
{
|
||||
new_objs = (ABObj*) realloc(
|
||||
list->objs, new_objs_size * sizeof(ABObj));
|
||||
if (new_user_datas != NULL)
|
||||
{
|
||||
new_user_datas = (void **) realloc(
|
||||
list->user_datas, new_objs_size * sizeof(void*));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
util_free(list->objs); list->objs = NULL;
|
||||
util_free(list->user_datas); list->user_datas= NULL;
|
||||
}
|
||||
|
||||
if ( (new_objs_size > 0)
|
||||
&& ((new_objs == NULL) || (new_user_datas == NULL)) )
|
||||
{
|
||||
return_value = ERR_NO_MEMORY;
|
||||
goto epilogue;
|
||||
}
|
||||
else
|
||||
{
|
||||
list->objs = new_objs;
|
||||
list->user_datas = new_user_datas;
|
||||
list->objs_size = new_objs_size;
|
||||
if (list->num_objs > list->objs_size)
|
||||
{
|
||||
list->num_objs = util_max(0, list->objs_size);
|
||||
}
|
||||
}
|
||||
|
||||
epilogue:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
objlistP_grow_array(ABObjList list, int sizeDiff)
|
||||
{
|
||||
int return_value = 0;
|
||||
int old_objs_size = list->objs_size;
|
||||
int new_objs_size = list->objs_size + sizeDiff;
|
||||
ABObj *new_objs = NULL;
|
||||
void **new_user_datas = NULL;
|
||||
int i = 0;
|
||||
BOOL user_datas_valid = (list->user_datas != NULL);
|
||||
|
||||
new_objs = (ABObj*)realloc(
|
||||
list->objs, new_objs_size * sizeof(ABObj));
|
||||
if (user_datas_valid)
|
||||
{
|
||||
new_user_datas = (void **)realloc(
|
||||
list->user_datas, new_objs_size * sizeof(void *));
|
||||
}
|
||||
if ( (new_objs == NULL)
|
||||
|| (user_datas_valid && (new_user_datas == NULL)) )
|
||||
{
|
||||
return_value = ERR_NO_MEMORY;
|
||||
goto epilogue;
|
||||
}
|
||||
else
|
||||
{
|
||||
list->objs = new_objs;
|
||||
list->user_datas = new_user_datas;
|
||||
list->objs_size = new_objs_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Init the new entries to NULL;
|
||||
*/
|
||||
for (i = old_objs_size; i < new_objs_size; ++i)
|
||||
{
|
||||
list->objs[i] = NULL;
|
||||
if (user_datas_valid)
|
||||
{
|
||||
list->user_datas[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
epilogue:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
objlistP_build_user_data_array(ABObjList list, int index, void *data)
|
||||
{
|
||||
if (list->user_datas != NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
list->user_datas = (void **)calloc(sizeof(void*), list->objs_size);
|
||||
if (list->user_datas == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
list->user_datas[index] = data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
/*************************************************************************
|
||||
** **
|
||||
** **
|
||||
** DEBUGGING ROUTINES **
|
||||
** **
|
||||
** **
|
||||
*************************************************************************/
|
||||
|
||||
#include <stdio.h> /* needed only for debug output */
|
||||
|
||||
/*
|
||||
* debugging output
|
||||
*/
|
||||
int
|
||||
objlist_dump(ABObjList list)
|
||||
{
|
||||
int i = 0;
|
||||
ABObj obj = NULL;
|
||||
BOOL entryUsed = FALSE;
|
||||
BOOL entryValid = FALSE;
|
||||
char objName[1024];
|
||||
*objName = 0;
|
||||
|
||||
if (list == NULL)
|
||||
{
|
||||
util_printf(0, "NULL obj list\n");
|
||||
return 0;
|
||||
}
|
||||
if (list->objs_size == 0)
|
||||
{
|
||||
util_dprintf(0, "empty obj list\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i= 0; i < list->objs_size; ++i)
|
||||
{
|
||||
entryUsed = (i < list->num_objs);
|
||||
entryValid = FALSE;
|
||||
|
||||
if (entryUsed)
|
||||
{
|
||||
obj = list->objs[i];
|
||||
entryValid = (obj_verify(obj) >= 0);
|
||||
|
||||
if (entryValid)
|
||||
{
|
||||
objName[0] = '\'';
|
||||
obj_get_safe_name(obj, objName+1, 1023);
|
||||
strcat(objName, "'");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(objName, "** Invalid ABObj **");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(objName, "** Unused Entry **");
|
||||
}
|
||||
|
||||
util_dprintf(0, "%d[%s]: %s",
|
||||
i,
|
||||
(i >= list->num_objs? " ":"X"),
|
||||
objName);
|
||||
|
||||
if (list->user_datas != NULL)
|
||||
{
|
||||
util_dprintf(0, " 0x%08lx", objlistP_get_user_data(list,i));
|
||||
}
|
||||
util_dprintf(0, "\n");
|
||||
}
|
||||
util_dprintf(0, "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
122
cde/programs/dtappbuilder/src/libABobj/obj_list.h
Normal file
122
cde/programs/dtappbuilder/src/libABobj/obj_list.h
Normal file
@@ -0,0 +1,122 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_list.h /main/3 1995/11/06 18:36:04 rswiston $
|
||||
*
|
||||
* @(#)template.h 1.6 11 Feb 1994 cde_app_builder/src/libAButil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ABOBJ_OBJ_LIST_H_
|
||||
#define _ABOBJ_OBJ_LIST_H_
|
||||
|
||||
/*
|
||||
* obj_list.h - define ABObjList data type
|
||||
*/
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define _POSIX_SOURCE 1 /* we want to be POSIX-compliant */
|
||||
#endif
|
||||
|
||||
#include <ab_private/AB.h> /* everybody must include this first! */
|
||||
#include <ab/util_types.h>
|
||||
|
||||
extern struct _AB_OBJ;
|
||||
#define ABObj struct _AB_OBJ *
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OBJLIST_SORT_UNDEF = 0,
|
||||
OBJLIST_SORT_ALPHANUMERIC,
|
||||
OBJLIST_SORT_BEST,
|
||||
OBJLIST_SORT_CLIENT_DEF,
|
||||
OBJLIST_SORT_ORDER_NUM_VALUES /* must be last */
|
||||
} OBJLIST_SORT_ORDER;
|
||||
|
||||
typedef void (*ABObjListIterFn)(ABObj obj);
|
||||
|
||||
/*
|
||||
* obj list structure.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int num_objs;
|
||||
int objs_size;
|
||||
ABObj *objs;
|
||||
void **user_datas;
|
||||
BOOL unique;
|
||||
OBJLIST_SORT_ORDER sort_order;
|
||||
BOOL indexes_dirty;
|
||||
} ABObjListRec, *ABObjList;
|
||||
|
||||
#undef ABObj
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
/*
|
||||
* ABObjList - lifecycle methods
|
||||
*/
|
||||
ABObjList objlist_create(void);
|
||||
int objlist_destroy(ABObjList);
|
||||
int objlist_construct(ABObjList);
|
||||
int objlist_destruct(ABObjList);
|
||||
ABObjList objlist_dup(ABObjList);
|
||||
|
||||
/*
|
||||
* ABObjList - methods dealing with entire list
|
||||
*/
|
||||
int objlist_set_sort_order(ABObjList, OBJLIST_SORT_ORDER);
|
||||
OBJLIST_SORT_ORDER objlist_get_sort_order(ABObjList);
|
||||
int objlist_set_is_unique(ABObjList, BOOL unique);
|
||||
BOOL objlist_is_unique(ABObjList);
|
||||
int objlist_make_empty(ABObjList);
|
||||
int objlist_is_empty(ABObjList);
|
||||
int objlist_set_num_objs(ABObjList, int numABObjs);
|
||||
int objlist_get_num_objs(ABObjList);
|
||||
int objlist_set_max_size_soft(ABObjList, int maxNumObjs);
|
||||
int objlist_get_max_size(ABObjList);
|
||||
BOOL objlist_max_size_is_soft(ABObjList);
|
||||
int objlist_shrink_mem_to_fit(ABObjList);
|
||||
int objlist_iterate(ABObjList, ABObjListIterFn);
|
||||
|
||||
/*
|
||||
* Methods dealing with individual objects
|
||||
*/
|
||||
int objlist_remove_obj(ABObjList, ABObj obj);
|
||||
int objlist_remove_index(ABObjList, int index);
|
||||
int objlist_add_obj(ABObjList, ABObj obj, void *userData);
|
||||
int objlist_add_index(ABObjList,
|
||||
int index, ABObj obj, void *userData);
|
||||
BOOL objlist_obj_exists(ABObjList list, ABObj obj);
|
||||
int objlist_get_obj_index(ABObjList list, ABObj obj);
|
||||
ABObj objlist_get_obj(ABObjList, int whichObj, void **userDataOut);
|
||||
void *objlist_get_obj_data(ABObjList, ABObj obj);
|
||||
|
||||
/*
|
||||
* Debugging methods
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
int objlist_dump(ABObjList list);
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
**************************************************************************
|
||||
** **
|
||||
** Inline definitions **
|
||||
** **
|
||||
**************************************************************************
|
||||
*************************************************************************/
|
||||
int objlist_destroy_impl(ABObjList *listInOut);
|
||||
#define objlist_destroy(list) (objlist_destroy_impl(&(list)))
|
||||
|
||||
#endif /* _ABOBJ_OBJ_LIST_H_ */
|
||||
93
cde/programs/dtappbuilder/src/libABobj/obj_lists.c
Normal file
93
cde/programs/dtappbuilder/src/libABobj/obj_lists.c
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_lists.c /main/3 1995/11/06 18:36:17 rswiston $
|
||||
*
|
||||
* @(#)obj_lists.c 1.3 09 Sep 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* obj_lists.c
|
||||
*
|
||||
* Handles internal lists of objects
|
||||
*/
|
||||
|
||||
#include "objP.h"
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Constants (#define and const) **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Private Functions (C declarations and macros) **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
static ABObj find_obj_in_list(ABObj *list, ABObj obj);
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Data **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
ABObjList objP_all_objs_list = NULL;
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Function Definitions **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
int
|
||||
objP_lists_add(ABObj obj)
|
||||
{
|
||||
int return_value = 0;
|
||||
|
||||
if (objP_all_objs_list == NULL)
|
||||
{
|
||||
objP_all_objs_list = objlist_create();
|
||||
objlist_set_is_unique(objP_all_objs_list, TRUE);
|
||||
if (objP_all_objs_list == NULL)
|
||||
{
|
||||
return ERR_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
return_value = objlist_add_obj(objP_all_objs_list, obj, NULL);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objP_lists_remove(ABObj obj)
|
||||
{
|
||||
int return_value = 0;
|
||||
|
||||
if (objP_all_objs_list == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return_value = objlist_remove_obj(objP_all_objs_list, obj);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
41
cde/programs/dtappbuilder/src/libABobj/obj_motif.c
Normal file
41
cde/programs/dtappbuilder/src/libABobj/obj_motif.c
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_motif.c /main/3 1995/11/06 18:36:33 rswiston $
|
||||
*
|
||||
* @(#)obj_motif.c 3.80 13 Feb 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* motif.c - Handles motif stuff
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <macros.h>
|
||||
#include <ab_private/util.h>
|
||||
#include <ab_private/trav.h>
|
||||
#include "objP.h"
|
||||
#include "obj_motifdefs.h"
|
||||
|
||||
/*
|
||||
* This file is now obsolete - all this is in libABobjXm
|
||||
*/
|
||||
|
||||
|
||||
876
cde/programs/dtappbuilder/src/libABobj/obj_motifdefs.h
Normal file
876
cde/programs/dtappbuilder/src/libABobj/obj_motifdefs.h
Normal file
@@ -0,0 +1,876 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_motifdefs.h /main/3 1995/11/06 18:36:48 rswiston $
|
||||
*
|
||||
* %W% %G% cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* motifdefs.h - motif defines and stuff
|
||||
*/
|
||||
#ifndef _ABOBJ_MOTIFDEFS_H_
|
||||
#define _ABOBJ_MOTIFDEFS_H_
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Automatically generated widgets **
|
||||
** **
|
||||
*************************************************************************/
|
||||
#define AB_WRAP_TOP_LEVEL "AB_Toplevel"
|
||||
#define AB_WRAP_SCR_WIN "AB_Scr_Win"
|
||||
#define AB_WRAP_FOOTER "AB_Footer"
|
||||
#define AB_WRAP_FOOTER_CH "AB_Footer_ch"
|
||||
#define AB_WRAP_RUBBER "AB_Rubber"
|
||||
#define AB_WRAP_ABBREV "AB_Abbrev"
|
||||
#define AB_WRAP_LABEL "AB_Label"
|
||||
#define AB_WRAP_MAIN_WINDOW "AB_Mainwin"
|
||||
#define AB_WRAP_MENU_BAR "AB_Menubar"
|
||||
#define AB_WRAP_TEXT "AB_Text"
|
||||
#define AB_WRAP_EXCL "AB_Excl"
|
||||
#define AB_WRAP_NONEXCL "AB_Nonexcl"
|
||||
#define AB_WRAP_NUMERIC_FLD "AB_Numfield"
|
||||
#define AB_WRAP_CTL_AREA "AB_Ctlarea"
|
||||
#define AB_WRAP_BULLETIN "AB_Bulletin"
|
||||
#define AB_WRAP_PULLDOWN "AB_Pulldown"
|
||||
#define AB_WRAP_ROWCOL "AB_Rowcol"
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Class Names **
|
||||
** **
|
||||
*************************************************************************/
|
||||
#define _applicationShell "applicationShellWidgetClass"
|
||||
#define _group "groupWidgetClass"
|
||||
#define _topLevelShell "topLevelShellWidgetClass"
|
||||
#define _xmArrowButton "xmArrowButtonWidgetClass"
|
||||
#define _xmBulletinBoard "xmBulletinBoardWidgetClass"
|
||||
#define _xmCascadeButton "xmCascadeButtonWidgetClass"
|
||||
#define _xmCommand "xmCommandWidgetClass"
|
||||
#define _xmDialogShell "xmDialogShellWidgetClass"
|
||||
#define _xmDrawingArea "xmDrawingAreaWidgetClass"
|
||||
#define _xmDrawnButton "xmDrawButtonWidgetClass"
|
||||
#define _xmFileSelectionBox "xmFileSelectionBoxWidgetClass"
|
||||
#define _xmForm "xmFormWidgetClass"
|
||||
#define _xmFrame "xmFrameWidgetClass"
|
||||
#define _xmLabel "xmLabelWidgetClass"
|
||||
#define _xmLabelGadget "xmLabelGadgetWidgetClass"
|
||||
#define _xmList "xmListWidgetClass"
|
||||
#define _xmMainWindow "xmMainWindowWidgetClass"
|
||||
#define _xmManager "xmManagerWidgetClass"
|
||||
#define _xmMenuShell "xmMenuShellWidgetClass"
|
||||
#define _xmMessageBox "xmMessageBoxWidgetClass"
|
||||
#define _xmPanedWindow "xmPanedWindowWidgetClass"
|
||||
#define _xmPrimitive "xmPrimitiveWidgetClass"
|
||||
#define _xmPushButton "xmPushButtonWidgetClass"
|
||||
#define _xmRowColumn "xmRowColumnWidgetClass"
|
||||
#define _xmScale "xmScaleWidgetClass"
|
||||
#define _xmScrollBar "xmScrollBarWidgetClass"
|
||||
#define _xmScrolledWindow "xmScrolledWindowWidgetClass"
|
||||
#define _xmSelectionBox "xmSelectionBoxWidgetClass"
|
||||
#define _xmSeparator "xmSeparatorWidgetClass"
|
||||
#define _xmSeparatorGadget "xmSeparatorGadgetWidgetClass"
|
||||
#define _xmText "xmTextWidgetClass"
|
||||
#define _xmTextField "xmTextFieldWidgetClass"
|
||||
#define _xmToggleButton "xmToggleButtonWidgetClass"
|
||||
#define _xmToggleButtonGadget "xmToggleButtonGadgetWidgetClass"
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Resources **
|
||||
** **
|
||||
*************************************************************************/
|
||||
|
||||
/*
|
||||
* Undefine a few commonly used strings that are defined in the
|
||||
* Xt files, so that we use the single-copy version.
|
||||
*
|
||||
* NOTE: Doing this can be dangerous, as the names have an opportunity
|
||||
* to get out of synch. with the Xt versions.
|
||||
*/
|
||||
#undef XmNeditType
|
||||
#undef XmNfile
|
||||
#undef XmNfont
|
||||
#undef XmNjustify
|
||||
#undef XmNlabel
|
||||
#undef XmNorientation
|
||||
#undef XmNresize
|
||||
#undef XmNselection
|
||||
#undef XmNselectionArray
|
||||
#undef XmNtextSource
|
||||
|
||||
#define XmNaccelerator "XmNaccelerator"
|
||||
#define XmNaccelerators "XmNaccelerators"
|
||||
#define XmNactivateCallback "XmNactivateCallback"
|
||||
#define XmNarmCallback "XmNarmCallback"
|
||||
#define XmNbackground "XmNbackground"
|
||||
#define XmNbackgroundPixmap "XmNbackgroundPixmap"
|
||||
#define XmNborderWidth "XmNborderWidth"
|
||||
#define XmNcolumns "XmNcolumns"
|
||||
#define XmNdestroyCallback "XmNdestroyCallback"
|
||||
#define XmNdisarmCallback "XmNdisarmCallback"
|
||||
#define XmNdragCallback "XmNdragCallback"
|
||||
#define XmNeditMode "XmNeditMode"
|
||||
#define XmNeditable "XmNeditable"
|
||||
#define XmNentryVerticalAlignment "XmNentryVerticalAlignment"
|
||||
#define XmNexposeCallback "XmNexposeCallback"
|
||||
#define XmNforeground "XmNforeground"
|
||||
#define XmNheight "XmNheight"
|
||||
#define XmNhighlightThickness "XmNhighlightThickness"
|
||||
#define XmNhorizontalSpacing "XmNhorizontalSpacing"
|
||||
#define XmNitemCount "XmNitemCount"
|
||||
#define XmNmaximum "XmNmaximum"
|
||||
#define XmNmaxLength "XmNmaxLength"
|
||||
#define XmNmenuHistory "XmNmenuHistory"
|
||||
#define XmNminimum "XmNminimum"
|
||||
#define XmNmodifyVerifyCallback "XmNmodifyVerifyCallback"
|
||||
#define XmNnoResize "XmNnoResize"
|
||||
#define XmNnumColumns "XmNnumColumns"
|
||||
#define XmNorientation "XmNorientation"
|
||||
#define XmNpattern "XmNpattern"
|
||||
#define XmNpopupCallback "XmNpopupCallback"
|
||||
#define XmNpopdownCallback "XmNpopdownCallback"
|
||||
#define XmNresizeCallback "XmNresizeCallback"
|
||||
#define XmNresizePolicy "XmNresizePolicy"
|
||||
#define XmNrows "XmNrows"
|
||||
#define XmNrowColumnType "XmNrowColumnType"
|
||||
#define XmNselectionPolicy "XmNselectionPolicy"
|
||||
#define XmNshadowThickness "XmNshadowThickness"
|
||||
#define XmNshadowType "XmNshadowType"
|
||||
#define XmNlabelPixmap "XmNlabelPixmap"
|
||||
#define XmNtearOffModel "XmNtearOffModel"
|
||||
#define XmNvalue "XmNvalue"
|
||||
#define XmNvalueChangedCallback "XmNvalueChangedCallback"
|
||||
#define XmNvisibleItemCount "XmNvisibleItemCount"
|
||||
#define XmNvisualPolicy "XmNvisualPolicy"
|
||||
#define XmNverticalSpacing "XmNverticalSpacing"
|
||||
#define XmNwidth "XmNwidth"
|
||||
#define XmNx "XmNx"
|
||||
#define XmNy "XmNy"
|
||||
#define XmNiconName "XmNiconName"
|
||||
#define XmNiconPixmap "XmNiconPixmap"
|
||||
#define XmNiconWindow "XmNiconWindow"
|
||||
#define XmNiconMask "XmNiconMask"
|
||||
#define XmNiconNameEncoding "XmNiconNameEncoding"
|
||||
#define XmNiconX "XmNiconX"
|
||||
#define XmNiconY "XmNiconY"
|
||||
#define XmNiconic "XmNiconic"
|
||||
#define XmNwindowGroup "XmNwindowGroup"
|
||||
#define XtNvisual "XtNvisual"
|
||||
#define XtNsaveUnder "XtNsaveUnder"
|
||||
#define XmNtransient "XmNtransient"
|
||||
#define XtNoverrideRedirect "XtNoverrideRedirect"
|
||||
#define XtNtransientFor "XtNtransientFor"
|
||||
#define XmNallowShellResize "XmNallowShellResize"
|
||||
#define XtNcreatePopupChildProc "XtNcreatePopupChildProc"
|
||||
#define XmNtitle "XmNtitle"
|
||||
#define XmNtitleString "XmNtitleString"
|
||||
#define XmNtitleEncoding "XmNtitleEncoding"
|
||||
#define XtNargc "XtNargc"
|
||||
#define XtNargv "XtNargv"
|
||||
#define XtNinput "XtNinput"
|
||||
#define XtNinitialState "XtNinitialState"
|
||||
#define XtNgeometry "XtNgeometry"
|
||||
#define XtNbaseWidth "XtNbaseWidth"
|
||||
#define XtNbaseHeight "XtNbaseHeight"
|
||||
#define XtNwinGravity "XtNwinGravity"
|
||||
#define XtNminWidth "XtNminWidth"
|
||||
#define XtNminHeight "XtNminHeight"
|
||||
#define XtNmaxWidth "XtNmaxWidth"
|
||||
#define XtNmaxHeight "XtNmaxHeight"
|
||||
#define XtNwidthInc "XtNwidthInc"
|
||||
#define XtNheightInc "XtNheightInc"
|
||||
#define XtNminAspectY "XtNminAspectY"
|
||||
#define XtNmaxAspectY "XtNmaxAspectY"
|
||||
#define XtNminAspectX "XtNminAspectX"
|
||||
#define XtNmaxAspectX "XtNmaxAspectX"
|
||||
#define XtNwmTimeout "XtNwmTimeout"
|
||||
#define XtNwaitForWm "XtNwaitforwm"
|
||||
#define XtNacceleratorsDoGrab "XtNacceleratorsDoGrab"
|
||||
#define XmNacceleratorText "XmNacceleratorText"
|
||||
#define XtNacceptFocusFunc "XtNacceptFocusFunc"
|
||||
#define XtNactivateFunc "XtNactivateFunc"
|
||||
#define XtNadjustBtn "XtNadjustBtn"
|
||||
#define XtNadjustKey "XtNadjustKey"
|
||||
#define XtNalign "XtNalign"
|
||||
#define XtNalignCaptions "XtNalignCaptions"
|
||||
#define XtNalignHorizontal "XtNalignHorizontal"
|
||||
#define XtNalignVertical "XtNalignVertical"
|
||||
#define XtNalignment "XtNalignment"
|
||||
#define XtNallowRootHelp "XtNallowRootHelp"
|
||||
#define XtNapplAddItem "XtNapplAddItem"
|
||||
#define XtNapplDeleteItem "XtNapplDeleteItem"
|
||||
#define XtNapplEditClose "XtNapplEditClose"
|
||||
#define XtNapplEditOpen "XtNapplEditOpen"
|
||||
#define XtNapplTouchItem "XtNapplTouchItem"
|
||||
#define XtNapplUpdateView "XtNapplUpdateView"
|
||||
#define XtNapplViewItem "XtNapplViewItem"
|
||||
#define XtNapply "XtNapply"
|
||||
#define XtNautoAssertDropsiteRegistry "XtNautoAssertDropsiteRegistry"
|
||||
#define XtNautoPopup "XtNautoPopup"
|
||||
#define XtNbeep "XtNbeep"
|
||||
#define XtNbeepVolume "XtNbeepVolume"
|
||||
#define XtNblinkRate "XtNblinkRate"
|
||||
#define XtNborderVisible "XtNborderVisible"
|
||||
#define XtNbottomMargin "XtNbottomMargin"
|
||||
#define XtNbtnDown "XtNbtnDown"
|
||||
#define XtNbtnMotion "XtNbtnMotion"
|
||||
#define XtNbtnUp "XtNbtnUp"
|
||||
#define XtNbusy "XtNbusy"
|
||||
#define XtNbuttonType "XtNbuttonType"
|
||||
#define XtNbuttons "XtNbuttons"
|
||||
#define XtNcancelKey "XtNcancelKey"
|
||||
#define XtNcaption "XtNcaption"
|
||||
#define XtNcaptionWidth "XtNcaptionWidth"
|
||||
#define XtNcaptionLabel "XtNcaptionLabel"
|
||||
#define XtNdeltaState "XtNdeltaState"
|
||||
#define XtNcenter "XtNcenter"
|
||||
#define XtNcenterLine "XtNcenterLine"
|
||||
#define XtNcharBakKey "XtNcharBakKey"
|
||||
#define XtNcharFwdKey "XtNcharFwdKey"
|
||||
#define XtNcharsVisible "XtNcharsVisible"
|
||||
#define XtNclientData "XtNclientData"
|
||||
#define XtNcompression "XtNcompression"
|
||||
#define XtNcomputeGeometries "XtNcomputeGeometries"
|
||||
#define XtNconstrainBtn "XtNconstrainBtn"
|
||||
#define XtNconsumeEvent "XtNconsumeEvent"
|
||||
#define XtNcontainerType "XtNcontainerType"
|
||||
#define XtNcontrolArea "XtNcontrolArea"
|
||||
#define XtNcontrolName "XtNcontrolName"
|
||||
#define XtNcopyKey "XtNcopyKey"
|
||||
#define XtNcornerColor "XtNcornerColor"
|
||||
#define XtNcurrentPage "XtNcurrentPage"
|
||||
#define XtNcursorPosition "XtNcursorPosition"
|
||||
#define XtNcutKey "XtNcutKey"
|
||||
#define XtNdampingFactor "XtNdampingFactor"
|
||||
#define XtNdata "XtNdata"
|
||||
#define XtNdefault "XtNdefault"
|
||||
#define XtNdefaultActionKey "XtNdefaultActionKey"
|
||||
#define XtNdefaultData "XtNdefaultData"
|
||||
#define XtNdefaultDropSiteID "XtNdefaultDropSiteID"
|
||||
#define XtNdefaultProc "XtNdefaultProc"
|
||||
#define XtNdelCharBakKey "XtNdelCharBakKey"
|
||||
#define XtNdelCharFwdKey "XtNdelCharFwdKey"
|
||||
#define XtNdelLineKey "XtNdelLineKey"
|
||||
#define XtNdelLineBakKey "XtNdelLineBakKey"
|
||||
#define XtNdelLineFwdKey "XtNdelLineFwdKey"
|
||||
#define XtNdelWordBakKey "XtNdelWordBakKey"
|
||||
#define XtNdelWordFwdKey "XtNdelWordFwdKey"
|
||||
#define XtNdestroy "XtNdestroy"
|
||||
#define XtNdim "XtNdim"
|
||||
#define XtNdirectManipulation "XtNdirectManipulation"
|
||||
#define XtNdirection "XtNdirection"
|
||||
#define XtNdirty "XtNdirty"
|
||||
#define XtNdiskSrc "XtNdiskSrc"
|
||||
#define XtNdismiss "XtNdismiss"
|
||||
#define XtNdisplayPosition "XtNdisplayPosition"
|
||||
#define XtNdocEndKey "XtNdocEndKey"
|
||||
#define XtNdocStartKey "XtNdocStartKey"
|
||||
#define XtNdoingDrag "XtNdoingDrag"
|
||||
#define XtNdontCare "XtNdontCare"
|
||||
#define XtNdownKey "XtNdownKey"
|
||||
#define XtNdragCBType "XtNdragCBType"
|
||||
#define XtNdragCursor "XtNdragCursor"
|
||||
#define XtNdragKey "XtNdragKey"
|
||||
#define XtNdragRightDistance "XtNdragRightDistance"
|
||||
#define XtNdropKey "XtNdropKey"
|
||||
#define XtNdropSiteID "XtNdropSiteID"
|
||||
#define XtNdsdmPresent "XtNdsdmPresent"
|
||||
#define XtNduplicateBtn "XtNduplicateBtn"
|
||||
#define XtNduplicateKey "XtNduplicateKey"
|
||||
#define XtNeditMode "XtNeditMode"
|
||||
#define XmNeditType "XmNeditType"
|
||||
#define XtNemanateWidget "XtNemanateWidget"
|
||||
#define XtNexecute "XtNexecute"
|
||||
#define XtNexpose "XtNexpose"
|
||||
#define XtNexposeCallback "XtNexposeCallback"
|
||||
#define XmNfile "XmNfile"
|
||||
#define XtNcurrentFolder "XtNcurrentFolder"
|
||||
#define XtNlastDocumentName "XtNlastDocumentName"
|
||||
#define XtNshowGlyphs "XtNshowGlyphs"
|
||||
#define XtNfilterString "XtNfilterString"
|
||||
#define XmNfilterLabelString "XmNfilterLabelString"
|
||||
#define XtNfilterProc "XtNfilterProc"
|
||||
#define XtNshowInactive "XtNshowInactive"
|
||||
#define XtNhideDotFiles "XtNhideDotFiles"
|
||||
#define XtNopenFolderCallback "XtNopenFolderCallback"
|
||||
#define XtNinputDocumentCallback "XtNinputDocumentCallback"
|
||||
#define XtNoutputDocumentCallback "XtNoutputDocumentCallback"
|
||||
#define XtNhomeFolder "XtNhomeFolder"
|
||||
#define XtNapplicationFoldersMaxCount "XtNapplicationFoldersMaxCount"
|
||||
#define XtNapplicationFolders "XtNapplicationFolders"
|
||||
#define XtNuserFoldersMaxCount "XtNuserFoldersMaxCount"
|
||||
#define XtNuserFolders "XtNuserFolders"
|
||||
#define XtNhistoryFoldersMinCount "XtNhistoryFoldersMinCount"
|
||||
#define XtNhistoryFoldersMaxCount "XtNhistoryFoldersMaxCount"
|
||||
#define XtNhistoryFolders "XtNhistoryFolders"
|
||||
#define XtNexpandTilde "XtNexpandTilde"
|
||||
#define XtNsubstituteShellVariables "XtNsubstituteShellVariables"
|
||||
#define XmNsubMenuId "XmNsubMenuId"
|
||||
#define XtNcomparisonFunc "XtNcomparisonFunc"
|
||||
#define XtNfocusModel "XtNfocusModel"
|
||||
#define XtNfocusWidget "XtNfocusWidget"
|
||||
#define XtNfont "XtNfont"
|
||||
#define XtNfontColor "XtNfontColor"
|
||||
#define XtNfontName "XtNfontName"
|
||||
|
||||
#define XtNgetValuesHook "XtNgetValuesHook"
|
||||
#define XtNgrabPointer "XtNgrabPointer"
|
||||
#define XtNgrabServer "XtNgrabServer"
|
||||
#define XtNgranularity "XtNgranularity"
|
||||
#define XtNgraphicsExposeCallback "XtNgraphicsExposeCallback"
|
||||
#define XtNgravity "XtNgravity"
|
||||
#define XtNgrow "XtNgrow"
|
||||
#define XtNhAutoScroll "XtNhAutoScroll"
|
||||
#define XtNhInitialDelay "XtNhInitialDelay"
|
||||
#define XtNhMenuPane "XtNhMenuPane"
|
||||
#define XtNhPad "XtNhPad"
|
||||
#define XtNhRepeatRate "XtNhRepeatRate"
|
||||
#define XtNhScrollbar "XtNhScrollbar"
|
||||
#define XtNhSliderMoved "XtNhSliderMoved"
|
||||
#define XtNhStepSize "XtNhStepSize"
|
||||
#define XtNhelpInfo "XtNhelpInfo"
|
||||
#define XtNhelpModel "XtNhelpModel"
|
||||
#define XtNhelpKey "XtNhelpKey"
|
||||
#define XtNhighlightHandlerProc "XtNhighlightHandlerProc"
|
||||
#define XtNhorizSBMenuKey "XtNhorizSBMenuKey"
|
||||
#define XtNhorizontalSB "XtNhorizontalSB"
|
||||
#define XtNiconBorder "XtNiconBorder"
|
||||
#define XtNiconGravity "XtNiconGravity"
|
||||
#define XtNiconParking "XtNiconParking"
|
||||
#define XtNimPreeditStyle "XtNimPreeditStyle"
|
||||
#define XtNinitialDelay "XtNinitialDelay"
|
||||
#define XtNinitialX "XtNinitialX"
|
||||
#define XtNinitialY "XtNinitialY"
|
||||
#define XtNinitialize "XtNinitialize"
|
||||
#define XtNinitializeHook "XtNinitializeHook"
|
||||
#define XtNinputFocusColor "XtNinputFocusColor"
|
||||
#define XtNinsertReturn "XtNinsertReturn"
|
||||
#define XtNinsertTab "XtNinsertTab"
|
||||
#define XtNinterpolatePointSize "XtNinterpolatePointSize"
|
||||
#define XtNitemCount "XtNitemCount"
|
||||
#define XtNitemFields "XtNitemFields"
|
||||
#define XtNitemGravity "XtNitemGravity"
|
||||
#define XtNitemHeight "XtNitemHeight"
|
||||
#define XtNitemMaxHeight "XtNitemMaxHeight"
|
||||
#define XtNitemMaxWidth "XtNitemMaxWidth"
|
||||
#define XtNitemMinHeight "XtNitemMinHeight"
|
||||
#define XtNitemMinWidth "XtNitemMinWidth"
|
||||
#define XtNitemState "XtNitemState"
|
||||
#define XtNitemWidth "XtNitemWidth"
|
||||
#define XtNitems "XtNitems"
|
||||
#define XtNitemsTouched "XtNitemsTouched"
|
||||
#define XtNitemsVisible "XtNitemsVisible"
|
||||
#define XtNjustify "XtNjustify"
|
||||
#define XtNkeys "XtNkeys"
|
||||
#define XtNkeyRemapTimeOut "XtNkeyRemapTimeOut"
|
||||
#define XtNlabelJustify "XtNlabelJustify"
|
||||
#define XtNlabelPixmap "XtNlabelPixmap"
|
||||
#define XtNlabelProc "XtNlabelProc"
|
||||
#define XmNlabelString "XmNlabelString"
|
||||
#define XtNlabelTile "XtNlabelTile"
|
||||
#define XmNlabelType "XmNlabelType"
|
||||
#define XtNlayout "XtNlayout"
|
||||
#define XtNlayoutHeight "XtNlayoutHeight"
|
||||
#define XtNlayoutType "XtNlayoutType"
|
||||
#define XtNlayoutWidth "XtNlayoutWidth"
|
||||
#define XtNleaveVerification "XtNleaveVerification"
|
||||
#define XtNleftKey "XtNleftKey"
|
||||
#define XtNleftMargin "XtNleftMargin"
|
||||
#define XtNlineEndKey "XtNlineEndKey"
|
||||
#define XtNlineStartKey "XtNlineStartKey"
|
||||
#define XtNlineSpace "XtNlineSpace"
|
||||
#define XtNlinesVisible "XtNlinesVisible"
|
||||
#define XtNlockName "XtNlockName"
|
||||
#define XtNlowerControlArea "XtNlowerControlArea"
|
||||
#define XtNmanaged "XtNmanaged"
|
||||
#define XtNmargin "XtNmargin"
|
||||
#define XmNmarginHeight "XmNmarginHeight"
|
||||
#define XmNmarginRight "XmNmarginRight"
|
||||
#define XmNmarginTop "XmNmarginTop"
|
||||
#define XmNmarginWidth "XmNmarginWidth"
|
||||
#define XtNmaxLabel "XtNmaxLabel"
|
||||
#define XtNmaximumChars "XtNmaximumChars"
|
||||
#define XtNmenuAugment "XtNmenuAugment"
|
||||
#define XtNmenuBtn "XtNmenuBtn"
|
||||
#define XtNmenuButton "XtNmenuButton"
|
||||
#define XtNmenuDefaultBtn "XtNmenuDefaultBtn"
|
||||
#define XtNmenuDefaultKey "XtNmenuDefaultKey"
|
||||
#define XtNmenuKey "XtNmenuKey"
|
||||
#define XtNmenuMark "XtNmenuMark"
|
||||
#define XtNmenuMarkRegion "XtNmenuMarkRegion"
|
||||
#define XtNmenuName "XtNmenuName"
|
||||
#define XtNmenuPane "XtNmenuPane"
|
||||
#define XtNmenuPositioner "XtNmenuPositioner"
|
||||
#define XtNmenuType "XtNmenuType"
|
||||
#define XtNminLabel "XtNminLabel"
|
||||
#define XtNmnemonic "XtNmnemonic"
|
||||
#define XtNmnemonicPrefix "XtNmnemonicPrefix"
|
||||
#define XtNmaxValue "XtNmaxValue"
|
||||
#define XtNminValue "XtNminValue"
|
||||
#define XtNmod1Name "XtNmod1Name"
|
||||
#define XtNmod2Name "XtNmod2Name"
|
||||
#define XtNmod3Name "XtNmod3Name"
|
||||
#define XtNmod4Name "XtNmod4Name"
|
||||
#define XtNmod5Name "XtNmod5Name"
|
||||
#define XtNmodifyVerification "XtNmodifyVerification"
|
||||
#define XtNmotionVerification "XtNmotionVerification"
|
||||
#define XtNmouseDampingFactor "XtNmouseDampingFactor"
|
||||
#define XtNmouseStatus "XtNmouseStatus"
|
||||
#define XtNmouseX "XtNmouseX"
|
||||
#define XtNmouseY "XtNmouseY"
|
||||
#define XtNmultiClickTimeout "XtNmultiClickTimeout"
|
||||
#define XtNmultiDownKey "XtNmultiDownKey"
|
||||
#define XtNmultiLeftKey "XtNmultiLeftKey"
|
||||
#define XtNmultiObjectCount "XtNmultiObjectCount"
|
||||
#define XtNmultiRightKey "XtNmultiRightKey"
|
||||
#define XtNmultiUpKey "XtNmultiUpKey"
|
||||
#define XmNmwmMenu "XmNmwmMenu"
|
||||
#define XtNnextAppKey "XtNnextAppKey"
|
||||
#define XtNnextFieldKey "XtNnextFieldKey"
|
||||
#define XtNnextWinKey "XtNnextWinKey"
|
||||
#define XtNnoneSet "XtNnoneSet"
|
||||
#define XtNnumItemFields "XtNnumItemFields"
|
||||
#define XtNnumItems "XtNnumItems"
|
||||
#define XtNnumberOfDropSites "XtNnumberOfDropSites"
|
||||
#define XtNorientation "XtNorientation"
|
||||
#define XmNpacking "XmNpacking"
|
||||
#define XtNpackedWidget "XtNpackedWidget"
|
||||
#define XtNpackedWidgetList "XtNpackedWidgetList"
|
||||
#define XtNpageDownKey "XtNpageDownKey"
|
||||
#define XtNpageLeftKey "XtNpageLeftKey"
|
||||
#define XtNpageRightKey "XtNpageRightKey"
|
||||
#define XtNpageUpKey "XtNpageUpKey"
|
||||
#define XtNpanBtn "XtNpanBtn"
|
||||
#define XtNpaneBackground "XtNpaneBackground"
|
||||
#define XtNpaneEndKey "XtNpaneEndKey"
|
||||
#define XtNpaneForeground "XtNpaneForeground"
|
||||
#define XtNpaneName "XtNpaneName"
|
||||
#define XtNpaneStartKey "XtNpaneStartKey"
|
||||
#define XtNparentReset "XtNparentReset"
|
||||
#define XtNpasteKey "XtNpasteKey"
|
||||
#define XtNpendingActionKey "XtNpendingActionKey"
|
||||
#define XtNpendingDSDMInfo "XtNpendingDSDMInfo"
|
||||
#define XtNpointerWarping "XtNpointerWarping"
|
||||
#define XtNposition "XtNposition"
|
||||
#define XtNpostModifyNotification "XtNpostModifyNotification"
|
||||
#define XtNpostSelect "XtNpostSelect"
|
||||
#define XtNprefMaxWidth "XtNprefMaxWidth"
|
||||
#define XtNprefMinWidth "XtNprefMinWidth"
|
||||
#define XtNprevAppKey "XtNprevAppKey"
|
||||
#define XtNprevFieldKey "XtNprevFieldKey"
|
||||
#define XtNprevWinKey "XtNprevWinKey"
|
||||
#define XtNpreview "XtNpreview"
|
||||
#define XtNpreviewItem "XtNpreviewItem"
|
||||
#define XtNpreviewWidget "XtNpreviewWidget"
|
||||
#define XtNpropertiesKey "XtNpropertiesKey"
|
||||
#define XtNpropertyChange "XtNpropertyChange"
|
||||
#define XtNproportionLength "XtNproportionLength"
|
||||
#define XtNqueryGeometry "XtNqueryGeometry"
|
||||
#define XtNrealize "XtNrealize"
|
||||
#define XmNrecomputeSize "XmNrecomputeSize"
|
||||
#define XtNredrawKey "XtNredrawKey"
|
||||
#define XtNreferenceName "XtNreferenceName"
|
||||
#define XtNreferenceStub "XtNreferenceStub"
|
||||
#define XtNreferenceWidget "XtNreferenceWidget"
|
||||
#define XtNrefresh "XtNrefresh"
|
||||
#define XtNregisterFocusFunc "XtNregisterFocusFunc"
|
||||
#define XtNregistryUpdateTimestamp "XtNregistryUpdateTimestamp"
|
||||
#define XtNrepeatRate "XtNrepeatRate"
|
||||
#define XtNreset "XtNreset"
|
||||
#define XtNresetDefault "XtNresetDefault"
|
||||
#define XtNresetFactory "XtNresetFactory"
|
||||
#define XtNresetSet "XtNresetSet"
|
||||
#define XtNresize "XtNresize"
|
||||
#define XtNresizeCallback "XtNresizeCallback"
|
||||
#define XtNresizeCorners "XtNresizeCorners"
|
||||
#define XtNreturnKey "XtNreturnKey"
|
||||
#define XtNrevertButton "XtNrevertButton"
|
||||
#define XtNrightKey "XtNrightKey"
|
||||
#define XtNrightMargin "XtNrightMargin"
|
||||
#define XtNrootX "XtNrootX"
|
||||
#define XtNrootY "XtNrootY"
|
||||
#define XtNrowDownKey "XtNrowDownKey"
|
||||
#define XtNrowUpKey "XtNrowUpKey"
|
||||
#define XtNsameHeight "XtNsameHeight"
|
||||
#define XtNsameSize "XtNsameSize"
|
||||
#define XtNsameWidth "XtNsameWidth"
|
||||
#define XtNscale "XtNscale"
|
||||
#define XtNscaleMap "XtNscaleMap"
|
||||
#define XmNscrollBarPlacement "XmNscrollBarPlacement"
|
||||
#define XmNhorizontalScrollBar "XmNhorizontalScrollBar"
|
||||
#define XmNverticalScrollBar "XmNverticalScrollBar"
|
||||
#define XtNscroll "XtNscroll"
|
||||
#define XtNscrollBottomKey "XtNscrollBottomKey"
|
||||
#define XtNscrollDocStart "XtNscrollDocStart"
|
||||
#define XtNscrollDocEnd "XtNscrollDocEnd"
|
||||
#define XtNscrollDownKey "XtNscrollDownKey"
|
||||
#define XtNscrollLeftKey "XtNscrollLeftKey"
|
||||
#define XtNscrollLeftEdgeKey "XtNscrollLeftEdgeKey"
|
||||
#define XtNscrollRightKey "XtNscrollRightKey"
|
||||
#define XtNscrollRightEdgeKey "XtNscrollRightEdgeKey"
|
||||
#define XtNscrollTopKey "XtNscrollTopKey"
|
||||
#define XtNscrollUpKey "XtNscrollUpKey"
|
||||
#define XtNselCharBakKey "XtNselCharBakKey"
|
||||
#define XtNselCharFwdKey "XtNselCharFwdKey"
|
||||
#define XtNselFlipEndsKey "XtNselFlipEndsKey"
|
||||
#define XtNselLineKey "XtNselLineKey"
|
||||
#define XtNselLineBakKey "XtNselLineBakKey"
|
||||
#define XtNselLineFwdKey "XtNselLineFwdKey"
|
||||
#define XtNselWordBakKey "XtNselWordBakKey"
|
||||
#define XtNselWordFwdKey "XtNselWordFwdKey"
|
||||
#define XtNselectBtn "XtNselectBtn"
|
||||
#define XtNselectKey "XtNselectKey"
|
||||
#define XtNselectDoesPreview "XtNselectDoesPreview"
|
||||
#define XtNselectEnd "XtNselectEnd"
|
||||
#define XtNselectProc "XtNselectProc"
|
||||
#define XtNselectStart "XtNselectStart"
|
||||
#define XtNselectable "XtNselectable"
|
||||
#define XtNselection "XtNselection"
|
||||
#define XmNselectionArray "XmNselectionArray"
|
||||
#define XtNselectionColor "XtNselectionColor"
|
||||
#define XtNset "XtNset"
|
||||
#define XtNsetDefaults "XtNsetDefaults"
|
||||
#define XtNsetValues "XtNsetValues"
|
||||
#define XtNsetValuesAlmost "XtNsetValuesAlmost"
|
||||
#define XtNsetValuesHook "XtNsetValuesHook"
|
||||
#define XtNshellBehavior "XtNshellBehavior"
|
||||
#define XtNshiftName "XtNshiftName"
|
||||
#define XtNshowAccelerators "XtNshowAccelerators"
|
||||
#define XtNshowMnemonics "XtNshowMnemonics"
|
||||
#define XtNshowPage "XtNshowPage"
|
||||
#define XtNsliderMax "XtNsliderMax"
|
||||
#define XtNsliderMin "XtNsliderMin"
|
||||
#define XtNsliderMoved "XtNsliderMoved"
|
||||
#define XtNsliderValue "XtNsliderValue"
|
||||
#define XtNsource "XtNsource"
|
||||
#define XtNsourceType "XtNsourceType"
|
||||
#define XtNspan "XtNspan"
|
||||
#define XtNstateChange "XtNstateChange"
|
||||
#define XtNstopKey "XtNstopKey"
|
||||
#define XtNstopPosition "XtNstopPosition"
|
||||
#define XmNstring "XmNstring"
|
||||
#define XtNstrip "XtNstrip"
|
||||
#define XtNtabTable "XtNtabTable"
|
||||
#define XtNtextArea "XtNtextArea"
|
||||
#define XtNtextClearBuffer "XtNtextClearBuffer"
|
||||
#define XtNtextCopyBuffer "XtNtextCopyBuffer"
|
||||
#define XtNtextEditBackground "XtNtextEditBackground"
|
||||
#define XtNtextEditFontColor "XtNtextEditFontColor"
|
||||
#define XtNtextEditWidget "XtNtextEditWidget"
|
||||
#define XtNtextField "XtNtextField"
|
||||
#define XtNtextFormat "XtNtextFormat"
|
||||
#define XtNtextGetInsertPoint "XtNtextGetInsertPoint"
|
||||
#define XtNtextGetLastPos "XtNtextGetLastPos"
|
||||
#define XtNtextInsert "XtNtextInsert"
|
||||
#define XtNtextReadSubStr "XtNtextReadSubStr"
|
||||
#define XtNtextRedraw "XtNtextRedraw"
|
||||
#define XtNtextReplace "XtNtextReplace"
|
||||
#define XtNtextSetInsertPoint "XtNtextSetInsertPoint"
|
||||
#define XtNtextSetSource "XtNtextSetSource"
|
||||
#define XtNtextSource "XtNtextSource"
|
||||
#define XtNtextUpdate "XtNtextUpdate"
|
||||
#define XtNthreeD "XtNthreeD"
|
||||
#define XtNtickUnit "XtNtickUnit"
|
||||
#define XtNticks "XtNticks"
|
||||
#define XtNtogglePushpinKey "XtNtogglePushpinKey"
|
||||
#define XtNtoggleState "XtNtoggleState"
|
||||
#define XtNtopMargin "XtNtopMargin"
|
||||
#define XtNtouchItems "XtNtouchItems"
|
||||
#define XtNtraversalHandlerFunc "XtNtraversalHandlerFunc"
|
||||
#define XtNtraversalManager "XtNtraversalManager"
|
||||
#define XtNtraversalOn "XtNtraversalOn"
|
||||
#define XtNtrigger "XtNtrigger"
|
||||
#define XtNtype "XtNtype"
|
||||
#define XtNunderline "XtNunderline"
|
||||
#define XtNundoKey "XtNundoKey"
|
||||
#define XtNunitType "XtNunitType"
|
||||
#define XtNunselect "XtNunselect"
|
||||
#define XtNunselectProc "XtNunselectProc"
|
||||
#define XtNupKey "XtNupKey"
|
||||
#define XtNupdateView "XtNupdateView"
|
||||
#define XtNupperControlArea "XtNupperControlArea"
|
||||
#define XtNuseSetValCallback "XtNuseSetValCallback"
|
||||
#define XtNuseShortOLWinAttr "XtNuseShortOLWinAttr"
|
||||
#define XtNuserAddItems "XtNuserAddItems"
|
||||
#define XtNuserData "XtNuserData"
|
||||
#define XtNuserDeleteItems "XtNuserDeleteItems"
|
||||
#define XtNuserMakeCurrent "XtNuserMakeCurrent"
|
||||
#define XtNvAutoScroll "XtNvAutoScroll"
|
||||
#define XtNvInitialDelay "XtNvInitialDelay"
|
||||
#define XtNvMenuPane "XtNvMenuPane"
|
||||
#define XtNvPad "XtNvPad"
|
||||
#define XtNvRepeatRate "XtNvRepeatRate"
|
||||
#define XtNvScrollbar "XtNvScrollbar"
|
||||
#define XtNvSliderMoved "XtNvSliderMoved"
|
||||
#define XtNvStepSize "XtNvStepSize"
|
||||
#define XtNverification "XtNverification"
|
||||
#define XtNverify "XtNverify"
|
||||
#define XtNvertSBMenuKey "XtNvertSBMenuKey"
|
||||
#define XtNverticalSB "XtNverticalSB"
|
||||
#define XtNverticalSBWidget "XtNverticalSBWidget"
|
||||
#define XtNviewHeight "XtNviewHeight"
|
||||
#define XtNviewWidth "XtNviewWidth"
|
||||
#define XtNvisibleChildren "XtNvisibleChildren"
|
||||
#define XtNvsb "XtNvsb"
|
||||
#define XtNwinType "XtNwinType"
|
||||
#define XtNwindowBackground "XtNwindowBackground"
|
||||
#define XtNwindowForeground "XtNwindowForeground"
|
||||
#define XtNwindowHeader "XtNwindowHeader"
|
||||
#define XtNwindowLayering "XtNwindowLayering"
|
||||
#define XtNwindowMenuKey "XtNwindowMenuKey"
|
||||
#define XtNwmProtocol "XtNwmProtocol"
|
||||
#define XtNwmProtocolInterested "XtNwmProtocolInterested"
|
||||
#define XtNwordBakKey "XtNwordBakKey"
|
||||
#define XtNwordFwdKey "XtNwordFwdKey"
|
||||
#define XtNworkspaceMenuKey "XtNworkspaceMenuKey"
|
||||
#define XtNwrap "XtNwrap"
|
||||
#define XtNwrapBreak "XtNwrapBreak"
|
||||
#define XtNwrapForm "XtNwrapForm"
|
||||
#define XtNwrapMode "XtNwrapMode"
|
||||
#define XtNxAddWidth "XtNxAddWidth"
|
||||
#define XtNxAttachOffset "XtNxAttachOffset"
|
||||
#define XtNxAttachRight "XtNxAttachRight"
|
||||
#define XtNxOffset "XtNxOffset"
|
||||
#define XtNxRefName "XtNxRefName"
|
||||
#define XtNxRefWidget "XtNxRefWidget"
|
||||
#define XtNxResizable "XtNxResizable"
|
||||
#define XtNxVaryOffset "XtNxVaryOffset"
|
||||
#define XtNyAddHeight "XtNyAddHeight"
|
||||
#define XtNyAttachBottom "XtNyAttachBottom"
|
||||
#define XtNyAttachOffset "XtNyAttachOffset"
|
||||
#define XtNyOffset "XtNyOffset"
|
||||
#define XtNyRefName "XtNyRefName"
|
||||
#define XtNyRefWidget "XtNyRefWidget"
|
||||
#define XtNyResizable "XtNyResizable"
|
||||
#define XtNyVaryOffset "XtNyVaryOffset"
|
||||
#define XtRAcceleratorTable "XtRAcceleratorTable"
|
||||
#define XtRAtom "XtRAtom"
|
||||
#define XtRBitmap "XtRBitmap"
|
||||
#define XtRBool "XtRBool"
|
||||
#define XtRBoolean "XtRBoolean"
|
||||
#define XtRCallback "XtRCallback"
|
||||
#define XtRCallProc "XtRCallProc"
|
||||
#define XtRCardinal "XtRCardinal"
|
||||
#define XtRColor "XtRColor"
|
||||
#define XtRColormap "XtRColormap"
|
||||
#define XtRCursor "XtRCursor"
|
||||
#define XtRDimension "XtRDimension"
|
||||
#define XtRDisplay "XtRDisplay"
|
||||
#define XtREditMode "XtREditMode"
|
||||
#define XtREnum "XtREnum"
|
||||
#define XtRFile "XtRFile"
|
||||
#define XtRFloat "XtRFloat"
|
||||
#define XtRFont "XtRFont"
|
||||
#define XtRFontStruct "XtRFontStruct"
|
||||
#define XtRFunction "XtRFunction"
|
||||
#define XtRGeometry "XtRGeometry"
|
||||
#define XtRImmediate "XtRImmediate"
|
||||
#define XtRInitialState "XtRInitialState"
|
||||
#define XtRInt "XtRInt"
|
||||
#define XtRJustify "XtRJustify"
|
||||
#define XtRLongBoolean XtRBool
|
||||
#define XtRObject "XtRObject"
|
||||
#define XtROlStr "XtROlStr"
|
||||
#define XtROrientation "XtROrientation"
|
||||
#define XtRPixel "XtRPixel"
|
||||
#define XtRPixmap "XtRPixmap"
|
||||
#define XtRPointer "XtRPointer"
|
||||
#define XtRPosition "XtRPosition"
|
||||
#define XtRScreen "XtRScreen"
|
||||
#define XtRShort "XtRShort"
|
||||
#define XtRString "XtRString"
|
||||
#define XtRStringArray "XtRStringArray"
|
||||
#define XtRStringTable "XtRStringTable"
|
||||
#define XtRUnsignedChar "XtRUnsignedChar"
|
||||
#define XtRTranslationTable "XtRTranslationTable"
|
||||
#define XtRVisual "XtRVisual"
|
||||
#define XtRWidget "XtRWidget"
|
||||
#define XtRWidgetClass "XtRWidgetClass"
|
||||
#define XtRWidgetList "XtRWidgetList"
|
||||
#define XtRWindow "XtRWindow"
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
#define XmTEAR_OFF_ENABLED "XmTEAR_OFF_ENABLED"
|
||||
#define XmTEAR_OFF_DISABLED "XmTEAR_OFF_DISABLED"
|
||||
#define XmWORK_AREA "XmWORK_AREA"
|
||||
#define XmMENU_BAR "XmMENU_BAR"
|
||||
#define XmMENU_PULLDOWN "XmMENU_PULLDOWN"
|
||||
#define XmMENU_POPUP "XmMENU_POPUP"
|
||||
#define XmMENU_OPTION "XmMENU_OPTION"
|
||||
#define XmCR_ACTIVATE "XmCR_ACTIVATE"
|
||||
#define XmCR_ARM "XmCR_ARM"
|
||||
#define XmCR_DISARM "XmCR_DISARM"
|
||||
#define XmRES_PIXMAP "XmPIXMAP"
|
||||
#define XmSHADOW_IN "XmSHADOW_IN"
|
||||
#define XmSHADOW_OUT "XmSHADOW_OUT"
|
||||
#define XmSHADOW_ETCHED_IN "XmSHADOW_ETCHED_IN"
|
||||
#define XmSHADOW_ETCHED_OUT "XmSHADOW_ETCHED_OUT"
|
||||
#define XmRES_STRING "XmSTRING"
|
||||
#define XmRESIZE_ANY "XmRESIZE_ANY"
|
||||
#define XmVERTICAL "XmVERTICAL"
|
||||
#define XmHORIZONTAL "XmHORIZONTAL"
|
||||
#define XmSINGLE_SELECT "XmSINGLE_SELECT"
|
||||
#define XmMULTIPLE_SELECT "XmMULTIPLE_SELECT"
|
||||
#define XmEXTENDED_SELECT "XmEXTENDED_SELECT"
|
||||
#define XmBROWSE_SELECT "XmBROWSE_SELECT"
|
||||
#define XmMULTI_LINE_EDIT "XmMULTI_LINE_EDIT"
|
||||
#define XmTOP_LEFT "XmTOP_LEFT"
|
||||
#define XmBOTTOM_LEFT "XmBOTTOM_LEFT"
|
||||
#define XmTOP_RIGHT "XmTOP_RIGHT"
|
||||
#define XmBOTTOM_RIGHT "XmBOTTOM_RIGHT"
|
||||
#define XmVARIABLE "XmVARIABLE"
|
||||
#define XmCONSTANT "XmCONSTANT"
|
||||
#define XmSTRING "XmSTRING"
|
||||
#define XmPIXMAP "XmPIXMAP"
|
||||
#define XmALIGNMENT_BASELINE_BOTTOM "XmALIGNMENT_BASELINE_BOTTOM"
|
||||
#define XmALIGNMENT_BASELINE_TOP "XmALIGNMENT_BASELINE_TOP"
|
||||
#define XmALIGNMENT_CONTENTS_BOTTOM "XmALIGNMENT_CONTENTS_BOTTOM"
|
||||
#define XmALIGNMENT_CONTENTS_TOP "XmALIGNMENT_CONTENTS_TOP"
|
||||
#define XmALIGNMENT_CENTER "XmALIGNMENT_CENTER"
|
||||
#define XmPACK_COLUMN "XmPACK_COLUMN"
|
||||
#define XmPACK_NONE "XmPACK_NONE"
|
||||
#define XmPACK_TIGHT "XmPACK_TIGHT"
|
||||
|
||||
/*
|
||||
************** GMF group widget ***********
|
||||
*/
|
||||
#define XmNgroupType "XmNgroupType"
|
||||
#define XmNgroupUseConstraints "XmNgroupUseConstraints"
|
||||
#define XmNgroupColumnAlignment "XmNgroupColumnAlignment"
|
||||
#define XmNgroupRowAlignment "XmNgroupRowAlignment"
|
||||
#define XmNgroupMinX "XmNgroupMinX"
|
||||
#define XmNgroupMinY "XmNgroupMinY"
|
||||
#define XmNgroupDenominator "XmNgroupDenominator"
|
||||
#define XmNgroupVOffset "XmNgroupVOffset"
|
||||
#define XmNgroupHOffset "XmNgroupHOffset"
|
||||
#define XmNgroupColumns "XmNgroupColumns"
|
||||
#define XmNgroupRows "XmNgroupRows"
|
||||
#define XmNgroupColumn "XmNgroupColumn"
|
||||
#define XmNgroupRow "XmNgroupRow"
|
||||
#define XmNgroupAnchor "XmNgroupAnchor"
|
||||
#define XmNgroupAnchorName "XmNgroupAnchorName"
|
||||
#define XmNgroupAnchorPoint "XmNgroupAnchorPoint"
|
||||
#define XmNgroupReferencePoint "XmNgroupReferencePoint"
|
||||
#define XmNgroupColumnAlignment "XmNgroupColumnAlignment"
|
||||
#define XmNgroupRowAlignment "XmNgroupRowAlignment"
|
||||
|
||||
#define XmGROUP_NONE "XmGROUP_NONE"
|
||||
#define XmGROUP_ROWS "XmGROUP_ROWS"
|
||||
#define XmGROUP_COLUMNS "XmGROUP_COLUMNS"
|
||||
#define XmGROUP_ROWCOLUMN "XmGROUP_ROWCOLUMN"
|
||||
|
||||
/* column alignments */
|
||||
|
||||
#define XmGROUP_COLUMN_ALIGN_V_CENTER "XmGROUP_COLUMN_ALIGN_V_CENTER"
|
||||
#define XmGROUP_COLUMN_ALIGN_LEFT "XmGROUP_COLUMN_ALIGN_LEFT"
|
||||
#define XmGROUP_COLUMN_ALIGN_RIGHT "XmGROUP_COLUMN_ALIGN_RIGHT"
|
||||
#define XmGROUP_COLUMN_ALIGN_LABELS "XmGROUP_COLUMN_ALIGN_LABELS"
|
||||
|
||||
/* row alignments */
|
||||
|
||||
#define XmGROUP_ROW_ALIGN_TOP_EDGES "XmGROUP_ROW_ALIGN_TOP_EDGES"
|
||||
#define XmGROUP_ROW_ALIGN_BOTTOM_EDGES "XmGROUP_ROW_ALIGN_BOTTOM_EDGES"
|
||||
#define XmGROUP_ROW_ALIGN_H_CENTER "XmGROUP_ROW_ALIGN_H_CENTER"
|
||||
|
||||
/* compass points */
|
||||
|
||||
#define XmGROUP_CENTER "XmGROUP_CENTER"
|
||||
#define XmGROUP_NORTH "XmGROUP_NORTH"
|
||||
#define XmGROUP_NORTHEAST "XmGROUP_NORTHEAST"
|
||||
#define XmGROUP_EAST "XmGROUP_EAST"
|
||||
#define XmGROUP_SOUTHEAST "XmGROUP_SOUTHEAST"
|
||||
#define XmGROUP_SOUTH "XmGROUP_SOUTH"
|
||||
#define XmGROUP_SOUTHWEST "XmGROUP_SOUTHWEST"
|
||||
#define XmGROUP_WEST "XmGROUP_WEST"
|
||||
#define XmGROUP_NORTHWEST "XmGROUP_NORTHWEST"
|
||||
|
||||
/*
|
||||
* XtN stuff
|
||||
*/
|
||||
|
||||
#define XtNallowHoriz "XtNallowHoriz"
|
||||
#define XtNNallowVert "XtNallowVert"
|
||||
#define XtNancestorSensitive "XtNancestorSensitive"
|
||||
#define XtNbitmap "XtNbitmap"
|
||||
#define XtNborderColor "XtNborderColor"
|
||||
#define XtNborder "XtNborderColor"
|
||||
#define XtNborderPixmap "XtNborderPixmap"
|
||||
#define XtNcallback "XtNcallback"
|
||||
#define XtNchildren "XtNchildren"
|
||||
#define XtNcolormap "XtNcolormap"
|
||||
#define XtNdepth "XtNdepth"
|
||||
#define XtNfont "XtNfont"
|
||||
#define XtNforceBars "XtNforceBars"
|
||||
#define XtNfunction "XtNfunction"
|
||||
#define XtNhighlight "XtNhighlight"
|
||||
#define XtNindex "XtNindex"
|
||||
#define XtNinitialResourcesPersistent "XtNinitialResourcesPersistent"
|
||||
#define XtNinnerHeight "XtNinnerHeight"
|
||||
#define XtNinnerWidth "XtNinnerWidth"
|
||||
#define XtNinnerWindow "XtNinnerWindow"
|
||||
#define XtNinsertPosition "XtNinsertPosition"
|
||||
#define XtNinternalHeight "XtNinternalHeight"
|
||||
#define XtNinternalWidth "XtNinternalWidth"
|
||||
#define XtNjumpProc "XtNjumpProc"
|
||||
#define XtNjustify "XtNjustify"
|
||||
#define XtNknobHeight "XtNknobHeight"
|
||||
#define XtNknobIndent "XtNknobIndent"
|
||||
#define XtNknobPixel "XtNknobPixel"
|
||||
#define XtNknobWidth "XtNknobWidth"
|
||||
#define XtNlength "XtNlength"
|
||||
#define XtNlowerRight "XtNlowerRight"
|
||||
#define XtNmappedWhenManaged "XtNmappedWhenManaged"
|
||||
#define XtNmenuEntry "XtNmenuEntry"
|
||||
#define XtNname "XtNname"
|
||||
#define XtNnotify "XtNnotify"
|
||||
#define XtNnumChildren "XtNnumChildren"
|
||||
#define XtNparameter "XtNparameter"
|
||||
#define XtNpixmap "XtNpixmap"
|
||||
#define XtNresize "XtNresize"
|
||||
#define XtNreverseVideo "XtNreverseVideo"
|
||||
#define XtNscreen "XtNscreen"
|
||||
#define XtNscrollingListMode "XtNscrollingListMode"
|
||||
#define XtNscrollProc "XtNscrollProc"
|
||||
#define XtNscrollDCursor "XtNscrollDCursor"
|
||||
#define XtNscrollHCursor "XtNscrollHCursor"
|
||||
#define XtNscrollLCursor "XtNscrollLCursor"
|
||||
#define XtNscrollRCursor "XtNscrollRCursor"
|
||||
#define XtNscrollUCursor "XtNscrollUCursor"
|
||||
#define XtNscrollVCursor "XtNscrollVCursor"
|
||||
#define XtNselection "XtNselection"
|
||||
#define XtNsensitive "XtNsensitive"
|
||||
#define XtNshown "XtNshown"
|
||||
#define XtNspace "XtNspace"
|
||||
#define XtNtextOptions "XtNtextOptions"
|
||||
#define XtNtextSink "XtNtextSink"
|
||||
#define XtNtextSource "XtNtextSource"
|
||||
#define XtNthickness "XtNthickness"
|
||||
#define XtNthumb "XtNthumb"
|
||||
#define XtNthumbProc "XtNthumbProc"
|
||||
#define XtNtop "XtNtop"
|
||||
#define XtNtranslations "XtNtranslations"
|
||||
#define XtNunrealizeCallback "XtNunrealizeCallback"
|
||||
#define XtNupdate "XtNupdate"
|
||||
#define XtNuseBottom "XtNuseBottom"
|
||||
#define XtNuseRight "XtNuseRight"
|
||||
#define XtNvalue "XtNvalue"
|
||||
#define XmNwindow "XmNwindow"
|
||||
|
||||
#endif /* _ABOBJ_MOTIFDEFS_H_ */
|
||||
|
||||
204
cde/programs/dtappbuilder/src/libABobj/obj_names_list.c
Normal file
204
cde/programs/dtappbuilder/src/libABobj/obj_names_list.c
Normal file
@@ -0,0 +1,204 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_names_list.c /main/3 1995/11/06 18:37:04 rswiston $
|
||||
*
|
||||
* @(#)obj_names_list.c 1.1 26 May 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* template.c - template c file.
|
||||
*/
|
||||
|
||||
#include "objP.h"
|
||||
#include <ab_private/trav.h>
|
||||
#include "obj_names_listP.h"
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Constants (#define and const) **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Private Functions (C declarations and macros) **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Function Definitions **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
ABObj
|
||||
objP_get_names_scope_obj(ABObj obj)
|
||||
{
|
||||
ABObj namesObj = obj_get_module(obj);
|
||||
|
||||
if (obj_is_project(obj))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else if ((namesObj == NULL) || obj_is_module(obj))
|
||||
{
|
||||
/* module names go in project */
|
||||
namesObj = obj_get_project(obj);
|
||||
}
|
||||
return namesObj;
|
||||
}
|
||||
|
||||
|
||||
StringList
|
||||
objP_get_names_scope(ABObj obj)
|
||||
{
|
||||
ABObj nameScopeObj = objP_get_names_scope_obj(obj);
|
||||
if (nameScopeObj != NULL)
|
||||
{
|
||||
return objP_get_names_list(nameScopeObj);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
objP_get_names_scope_obj_for_children(ABObj parent)
|
||||
{
|
||||
ABObj scopeObj = obj_get_module(parent);
|
||||
if (scopeObj == NULL)
|
||||
{
|
||||
scopeObj = obj_get_project(parent);
|
||||
}
|
||||
return scopeObj;
|
||||
}
|
||||
|
||||
|
||||
StringList
|
||||
objP_get_names_scope_for_children(ABObj parent)
|
||||
{
|
||||
ABObj scopeObj = objP_get_names_scope_obj_for_children(parent);
|
||||
if (scopeObj != NULL)
|
||||
{
|
||||
return objP_get_names_list(scopeObj);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
StringList
|
||||
objP_get_names_list(ABObj obj)
|
||||
{
|
||||
switch (obj->type)
|
||||
{
|
||||
case AB_TYPE_MODULE:
|
||||
return obj->info.module.obj_names_list;
|
||||
case AB_TYPE_PROJECT:
|
||||
return obj->info.project.obj_names_list;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objP_add_to_names_list(ABObj obj)
|
||||
{
|
||||
StringList names = NULL;
|
||||
|
||||
names = objP_get_names_scope(obj);
|
||||
if (names != NULL)
|
||||
{
|
||||
strlist_add_istr(names, obj->name, obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objP_remove_from_names_list(ABObj obj)
|
||||
{
|
||||
StringList names = objP_get_names_scope(obj);
|
||||
if (names != NULL)
|
||||
{
|
||||
strlist_remove_istr(names, obj->name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objP_tree_add_to_names_list(ABObj tree)
|
||||
{
|
||||
ABObj scopeObj = objP_get_names_scope_obj(tree);
|
||||
StringList names = NULL;
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj obj = NULL;
|
||||
|
||||
if (scopeObj != NULL)
|
||||
{
|
||||
names = objP_get_names_list(scopeObj);
|
||||
}
|
||||
if (names == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (trav_open(&trav, tree, AB_TRAV_ALL);
|
||||
(obj = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if (objP_get_names_scope_obj(obj) == scopeObj)
|
||||
{
|
||||
strlist_add_istr(names, obj->name, obj);
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
objP_tree_remove_from_names_list(ABObj tree)
|
||||
{
|
||||
ABObj scopeObj = objP_get_names_scope_obj(tree);
|
||||
StringList names = NULL;
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj obj = NULL;
|
||||
|
||||
if (scopeObj != NULL)
|
||||
{
|
||||
names = objP_get_names_list(scopeObj);
|
||||
}
|
||||
if (names == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (trav_open(&trav, tree, AB_TRAV_ALL);
|
||||
(obj = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if (objP_get_names_scope_obj(obj) == scopeObj)
|
||||
{
|
||||
strlist_remove_istr(names, obj->name);
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
40
cde/programs/dtappbuilder/src/libABobj/obj_names_listP.h
Normal file
40
cde/programs/dtappbuilder/src/libABobj/obj_names_listP.h
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_names_listP.h /main/3 1995/11/06 18:37:17 rswiston $
|
||||
*
|
||||
* @(#)obj_names_listP.h 1.1 26 May 1994
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* obj_names_listP.h - handles lists of object names
|
||||
*/
|
||||
#ifndef _ABOBJ_NAMES_LISTP_H_
|
||||
#define _ABOBJ_NAMES_LISTP_H_
|
||||
|
||||
#include "objP.h"
|
||||
|
||||
ABObj objP_get_names_scope_obj(ABObj obj);
|
||||
StringList objP_get_names_scope(ABObj obj);
|
||||
ABObj objP_get_names_scope_obj_for_children(ABObj obj);
|
||||
StringList objP_get_names_scope_for_children(ABObj obj);
|
||||
StringList objP_get_names_list(ABObj obj);
|
||||
int objP_remove_from_names_list(ABObj obj);
|
||||
int objP_add_to_names_list(ABObj obj);
|
||||
int objP_tree_remove_from_names_list(ABObj obj);
|
||||
int objP_tree_add_to_names_list(ABObj obj);
|
||||
|
||||
#endif /* _ABOBJ_NAMES_LISTP_H_ */
|
||||
|
||||
1251
cde/programs/dtappbuilder/src/libABobj/obj_notify.c
Normal file
1251
cde/programs/dtappbuilder/src/libABobj/obj_notify.c
Normal file
File diff suppressed because it is too large
Load Diff
159
cde/programs/dtappbuilder/src/libABobj/obj_notify.h
Normal file
159
cde/programs/dtappbuilder/src/libABobj/obj_notify.h
Normal file
@@ -0,0 +1,159 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_notify.h /main/3 1995/11/06 18:37:49 rswiston $
|
||||
*
|
||||
* @(#)obj_notify.h 1.14 02 Feb 1995
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* obj_notify.h - object change notification
|
||||
*/
|
||||
#ifndef _ABOBJ_NOTIFY_H_
|
||||
#define _ABOBJ_NOTIFY_H_
|
||||
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
typedef unsigned char OBJEV_ATT_FLAGS;
|
||||
#define OBJEV_ATT_UNDEF ((OBJEV_ATT_FLAGS)0x00)
|
||||
#define OBJEV_ATT_NONE ((OBJEV_ATT_FLAGS)0x00)
|
||||
#define OBJEV_ATT_GEOMETRY ((OBJEV_ATT_FLAGS)0x01)
|
||||
#define OBJEV_ATT_HSCROLL ((OBJEV_ATT_FLAGS)0x02)
|
||||
#define OBJEV_ATT_LABEL ((OBJEV_ATT_FLAGS)0x04)
|
||||
#define OBJEV_ATT_NAME ((OBJEV_ATT_FLAGS)0x08)
|
||||
#define OBJEV_ATT_POSITION ((OBJEV_ATT_FLAGS)0x10)
|
||||
#define OBJEV_ATT_SELECTED ((OBJEV_ATT_FLAGS)0x20)
|
||||
#define OBJEV_ATT_SIZE ((OBJEV_ATT_FLAGS)0x40)
|
||||
#define OBJEV_ATT_VSCROLL ((OBJEV_ATT_FLAGS)0x80)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ABObj obj;
|
||||
} OBJEV_STANDARD_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ABObj obj;
|
||||
int new_x, new_y, new_width, new_height;
|
||||
} OBJEV_ALLOW_GEOMETRY_CHANGE_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ABObj obj;
|
||||
ABObj new_parent;
|
||||
} OBJEV_ALLOW_REPARENT_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ABObj obj;
|
||||
OBJEV_ATT_FLAGS atts;
|
||||
ISTRING old_name;
|
||||
} OBJEV_ATT_CHANGE_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ABObj obj;
|
||||
ABObj old_parent;
|
||||
} OBJEV_REPARENT_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ABObj obj;
|
||||
BOOL update_subtree;
|
||||
} OBJEV_UPDATE_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ABObj obj;
|
||||
BOOL update_subtree;
|
||||
int update_code;
|
||||
void *update_data;
|
||||
UpdateDataFreeFunc update_data_free_func;
|
||||
} OBJEV_UPDATE_WITH_DATA_INFO;
|
||||
|
||||
typedef OBJEV_STANDARD_INFO OBJEV_CREATE_INFO;
|
||||
typedef OBJEV_STANDARD_INFO OBJEV_DESTROY_INFO;
|
||||
|
||||
typedef OBJEV_ALLOW_GEOMETRY_CHANGE_INFO *ObjEvAllowGeometryChangeInfo;
|
||||
typedef OBJEV_ALLOW_REPARENT_INFO *ObjEvAllowReparentInfo;
|
||||
typedef OBJEV_ATT_CHANGE_INFO *ObjEvAttChangeInfo;
|
||||
typedef OBJEV_CREATE_INFO *ObjEvCreateInfo;
|
||||
typedef OBJEV_DESTROY_INFO *ObjEvDestroyInfo;
|
||||
typedef OBJEV_REPARENT_INFO *ObjEvReparentInfo;
|
||||
typedef OBJEV_UPDATE_INFO *ObjEvUpdateInfo;
|
||||
typedef OBJEV_UPDATE_WITH_DATA_INFO *ObjEvUpdateWithDataInfo;
|
||||
|
||||
|
||||
/*
|
||||
* Callback function types.
|
||||
* Must return >= 0 for success, or value from util_err.h
|
||||
*/
|
||||
typedef int (*ObjAllowGeometryChangeCallback) (ObjEvAllowGeometryChangeInfo);
|
||||
typedef int (*ObjAllowReparentCallback) (ObjEvAllowReparentInfo);
|
||||
typedef int (*ObjAttChangeCallback) (ObjEvAttChangeInfo);
|
||||
typedef int (*ObjCreateCallback) (ObjEvCreateInfo);
|
||||
typedef int (*ObjDestroyCallback) (ObjEvDestroyInfo);
|
||||
typedef int (*ObjReparentCallback) (ObjEvReparentInfo);
|
||||
typedef int (*ObjUpdateCallback) (ObjEvUpdateInfo);
|
||||
typedef int (*ObjUpdateWithDataCallback) (ObjEvUpdateWithDataInfo);
|
||||
|
||||
|
||||
/*
|
||||
* The debug_name parameter is used for error reporting, and may
|
||||
* be NULL.
|
||||
*/
|
||||
int obj_add_allow_geometry_change_callback(
|
||||
ObjAllowGeometryChangeCallback,
|
||||
STRING debug_name
|
||||
);
|
||||
int obj_add_allow_reparent_callback(
|
||||
ObjAllowReparentCallback,
|
||||
STRING debug_name
|
||||
);
|
||||
int obj_add_create_callback(
|
||||
ObjCreateCallback,
|
||||
STRING debug_name
|
||||
);
|
||||
int obj_add_destroy_callback(
|
||||
ObjDestroyCallback,
|
||||
STRING debug_name
|
||||
);
|
||||
int obj_add_geometry_change_callback(
|
||||
ObjAttChangeCallback,
|
||||
STRING debug_name
|
||||
);
|
||||
int obj_add_rename_callback(
|
||||
ObjAttChangeCallback,
|
||||
STRING debug_name
|
||||
);
|
||||
int obj_add_reparent_callback(
|
||||
ObjReparentCallback,
|
||||
STRING debug_name
|
||||
);
|
||||
int obj_add_selected_change_callback(
|
||||
ObjAttChangeCallback,
|
||||
STRING debug_name
|
||||
);
|
||||
int obj_add_update_callback(
|
||||
ObjUpdateCallback,
|
||||
STRING debug_name
|
||||
);
|
||||
int obj_add_update_with_data_callback(
|
||||
ObjUpdateWithDataCallback,
|
||||
STRING debug_name
|
||||
);
|
||||
|
||||
#endif /* _ABOBJ_NOTIFY_H_ */
|
||||
|
||||
126
cde/programs/dtappbuilder/src/libABobj/obj_notifyP.h
Normal file
126
cde/programs/dtappbuilder/src/libABobj/obj_notifyP.h
Normal file
@@ -0,0 +1,126 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_notifyP.h /main/3 1995/11/06 18:38:04 rswiston $
|
||||
*
|
||||
* @(#)obj_notifyP.h 1.24 02 Feb 1995
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* obj_notifyP.h - object change notification
|
||||
*
|
||||
* Internal files - defines internal data structures, et cetera
|
||||
*/
|
||||
#ifndef _ABOBJ_NOTIFYP_H
|
||||
#define _ABOBJ_NOTIFYP_H_
|
||||
|
||||
#include "objP.h" /* include before obj.h! */
|
||||
#include <ab_private/obj.h>
|
||||
#include <ab_private/obj_notify.h>
|
||||
|
||||
/*
|
||||
* return codes (supplement to util_err.h)
|
||||
*/
|
||||
#define OBJ_NOTIFY_BATCHED (100) /* not an error! */
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OBJEV_UNDEF= 0,
|
||||
OBJEV_ALLOW_GEOMETRY_CHANGE,
|
||||
OBJEV_ATT_CHANGE,
|
||||
OBJEV_ALLOW_REPARENT,
|
||||
OBJEV_CREATE,
|
||||
OBJEV_DESTROY,
|
||||
OBJEV_REPARENT,
|
||||
OBJEV_UPDATE,
|
||||
OBJEV_UPDATE_WITH_DATA,
|
||||
OBJ_EVENT_TYPE_NUM_VALUES
|
||||
} OBJ_EVENT_TYPE;
|
||||
|
||||
|
||||
typedef BYTE OBJ_EVENT_MODE;
|
||||
#define OBJEV_MODE_SEND_NOTIFY_EVS ((OBJ_EVENT_MODE)0x01)
|
||||
#define OBJEV_MODE_SEND_ALLOW_EVS ((OBJ_EVENT_MODE)0x02)
|
||||
#define OBJEV_MODE_BATCH_NOTIFY_EVS ((OBJ_EVENT_MODE)0x04)
|
||||
#define OBJEV_MODE_DISALLOW_ALL_EVS ((OBJ_EVENT_MODE)0x08)
|
||||
#define OBJEV_MODE_NORMAL \
|
||||
(OBJEV_MODE_SEND_NOTIFY_EVS | OBJEV_MODE_SEND_ALLOW_EVS)
|
||||
|
||||
typedef union
|
||||
{
|
||||
OBJEV_ALLOW_GEOMETRY_CHANGE_INFO allow_geometry_change;
|
||||
OBJEV_ALLOW_REPARENT_INFO allow_reparent;
|
||||
OBJEV_ATT_CHANGE_INFO att_change;
|
||||
OBJEV_CREATE_INFO create;
|
||||
OBJEV_DESTROY_INFO destroy_info; /* destroy is C++ key*/
|
||||
OBJEV_REPARENT_INFO reparent;
|
||||
OBJEV_UPDATE_INFO update;
|
||||
OBJEV_UPDATE_WITH_DATA_INFO update_with_data;
|
||||
} OBJ_EVENT_EXTRA_INFO;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
OBJ_EVENT_TYPE type;
|
||||
OBJ_EVENT_EXTRA_INFO info;
|
||||
} OBJ_EVENT, *ObjEvent;
|
||||
|
||||
|
||||
int objP_notify_push_mode(void); /* push current set of modes */
|
||||
int objP_notify_set_mode(OBJ_EVENT_MODE); /* set a mode */
|
||||
int objP_notify_clear_mode(OBJ_EVENT_MODE); /* clear a mode */
|
||||
BOOL objP_notify_mode_is_set(OBJ_EVENT_MODE); /* query mode */
|
||||
int objP_notify_pop_mode(void); /*pop to most-recently pushed*/
|
||||
OBJ_EVENT_MODE objP_notify_get_mode(void);
|
||||
int objP_notify_get_num_queued(void);
|
||||
BOOL objP_notify_event_will_queue(void);
|
||||
|
||||
/*
|
||||
* These functions send or queue an event to be sent
|
||||
*/
|
||||
int objP_notify_send_create(ABObj);
|
||||
int objP_notify_send_destroy(ABObj);
|
||||
int objP_notify_send_allow_geometry_change(ABObj,
|
||||
int new_x, int new_y, int new_width, int new_height);
|
||||
int objP_notify_send_allow_reparent(ABObj, ABObj new_parent);
|
||||
int objP_notify_send_att_change(ABObj, OBJEV_ATT_FLAGS atts);
|
||||
int objP_notify_send_geometry_change(ABObj,
|
||||
int old_x, int old_y, int old_width, int old_height);
|
||||
int objP_notify_send_rc_geometry_change(ABObj);
|
||||
int objP_notify_send_name_change(ABObj, ISTRING old_name);
|
||||
int objP_notify_send_reparent(ABObj, ABObj old_parent);
|
||||
int objP_notify_send_selected_change(ABObj);
|
||||
int objP_notify_send_update(ABObj, BOOL update_subtree);
|
||||
|
||||
int objP_notify_send_update_with_data(
|
||||
ABObj obj,
|
||||
BOOL update_subtree,
|
||||
int update_code,
|
||||
void *update_data,
|
||||
UpdateDataFreeFunc update_data_free_func
|
||||
);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Inline implementation **
|
||||
** **
|
||||
*************************************************************************/
|
||||
|
||||
#define objP_notify_mode_is_set(mode) ((objP_notify_get_mode() & (mode)) != 0)
|
||||
|
||||
#endif /* _ABOBJ_NOTIFYP_H_ */
|
||||
|
||||
333
cde/programs/dtappbuilder/src/libABobj/obj_release.c
Normal file
333
cde/programs/dtappbuilder/src/libABobj/obj_release.c
Normal file
@@ -0,0 +1,333 @@
|
||||
/*
|
||||
* $XConsortium: obj_release.c /main/3 1995/11/06 18:38:18 rswiston $
|
||||
*
|
||||
* @(#)obj_release.c 3.49 26 Jan 1995
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special restrictions in a
|
||||
* confidential disclosure agreement between HP, IBM, Sun, USL, SCO and
|
||||
* Univel. Do not distribute this document outside HP, IBM, Sun, USL, SCO,
|
||||
* or Univel without Sun's specific written approval. This document and all
|
||||
* copies and derivative works thereof must be returned or destroyed at Sun's
|
||||
* request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* obj_release.c - release gobj structures (free any resources a gobj may be
|
||||
* holding - e.g., strings).
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ab_private/util.h>
|
||||
#include "objP.h"
|
||||
|
||||
int
|
||||
obj_destruct(ABObj obj)
|
||||
{
|
||||
istr_destroy(obj->name);
|
||||
istr_destroy(obj->class_name);
|
||||
util_free(obj->attachments);
|
||||
istr_destroy(obj->user_data);
|
||||
istr_destroy(obj->bg_color);
|
||||
istr_destroy(obj->fg_color);
|
||||
istr_destroy(obj->label);
|
||||
istr_destroy(obj->menu_name);
|
||||
|
||||
obj_destruct_type_specific_info(obj);
|
||||
|
||||
objP_lists_remove(obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
obj_destruct_action(ABObj obj)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
obj_destruct_action_list(ABObj obj)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_button(ABObj obj)
|
||||
{
|
||||
AB_BUTTON_INFO *info = &(obj->info.button);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_drawing_area(ABObj obj)
|
||||
{
|
||||
AB_DRAWING_AREA_INFO *info= &(obj->info.drawing_area);
|
||||
istr_destroy(info->menu_title);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_combo_box(ABObj obj)
|
||||
{
|
||||
AB_COMBO_BOX_INFO *info = &(obj->info.combo_box);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_container(ABObj obj)
|
||||
{
|
||||
AB_CONTAINER_INFO *info= &(obj->info.container);
|
||||
istr_destroy(info->menu_title);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_file_chooser(ABObj obj)
|
||||
{
|
||||
AB_FILE_CHOOSER_INFO *info = &(obj->info.file_chooser);
|
||||
istr_destroy(info->filter_pattern);
|
||||
istr_destroy(info->ok_label);
|
||||
istr_destroy(info->directory);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_msg(ABObj obj)
|
||||
{
|
||||
AB_MESSAGE_INFO *info = &(obj->info.message);
|
||||
istr_destroy(info->msg_string);
|
||||
istr_destroy(info->action1_label);
|
||||
istr_destroy(info->action2_label);
|
||||
istr_destroy(info->action3_label);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_module(ABObj obj)
|
||||
{
|
||||
AB_MODULE_INFO *info = &(obj->info.module);
|
||||
istr_destroy(info->file);
|
||||
istr_destroy(info->stubs_file);
|
||||
istr_destroy(info->ui_file);
|
||||
strlist_destroy(info->obj_names_list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_item(ABObj obj)
|
||||
{
|
||||
AB_ITEM_INFO *info= &(obj->info.item);
|
||||
istr_destroy(info->accelerator);
|
||||
istr_destroy(info->mnemonic);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_layers(ABObj obj)
|
||||
{
|
||||
obj = obj; /* avoid warnings */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_menu(ABObj obj)
|
||||
{
|
||||
AB_MENU_INFO *info = &(obj->info.menu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_project(ABObj obj)
|
||||
{
|
||||
AB_PROJECT_INFO *info = &(obj->info.project);
|
||||
istr_destroy(info->file);
|
||||
istr_destroy(info->stubs_file);
|
||||
istr_destroy(info->vendor);
|
||||
istr_destroy(info->version);
|
||||
strlist_destroy(info->obj_names_list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_choice(ABObj obj)
|
||||
{
|
||||
AB_CHOICE_INFO *info = &(obj->info.choice);
|
||||
info = info; /* avoid warnings */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_separator(ABObj obj)
|
||||
{
|
||||
AB_SEPARATOR_INFO *info = &(obj->info.separator);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_scale(ABObj obj)
|
||||
{
|
||||
AB_SCALE_INFO *info = &(obj->info.scale);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_spin_box(ABObj obj)
|
||||
{
|
||||
AB_SPIN_BOX_INFO *info = &(obj->info.spin_box);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_list(ABObj obj)
|
||||
{
|
||||
AB_LIST_INFO *info= &(obj->info.list);
|
||||
istr_destroy(info->menu_title);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_term_pane(ABObj obj)
|
||||
{
|
||||
istr_destroy(obj->info.term.process_string);
|
||||
istr_destroy(obj->info.term.menu_title);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_text(ABObj obj)
|
||||
{
|
||||
AB_TEXT_INFO *info= &(obj->info.text);
|
||||
istr_destroy(info->initial_value_string);
|
||||
istr_destroy(info->menu_title);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obj_destruct_window(ABObj obj)
|
||||
{
|
||||
AB_WINDOW_INFO *info = &(obj->info.window);
|
||||
|
||||
istr_destroy(info->icon);
|
||||
istr_destroy(info->icon_mask);
|
||||
istr_destroy(info->icon_label);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
obj_destruct_type_specific_info(ABObj obj)
|
||||
{
|
||||
int (*func) (ABObj obj) = NULL;
|
||||
int retval = 0;
|
||||
|
||||
switch (obj->type)
|
||||
{
|
||||
case AB_TYPE_ACTION:
|
||||
func = obj_destruct_action;
|
||||
break;
|
||||
|
||||
case AB_TYPE_ACTION_LIST:
|
||||
func = obj_destruct_action_list;
|
||||
break;
|
||||
|
||||
case AB_TYPE_BASE_WINDOW:
|
||||
case AB_TYPE_DIALOG:
|
||||
func = obj_destruct_window;
|
||||
break;
|
||||
|
||||
case AB_TYPE_BUTTON:
|
||||
func = obj_destruct_button;
|
||||
break;
|
||||
|
||||
case AB_TYPE_CHOICE:
|
||||
func = obj_destruct_choice;
|
||||
break;
|
||||
|
||||
case AB_TYPE_COMBO_BOX:
|
||||
func = obj_destruct_combo_box;
|
||||
break;
|
||||
|
||||
case AB_TYPE_FILE_CHOOSER:
|
||||
func = obj_destruct_file_chooser;
|
||||
break;
|
||||
|
||||
case AB_TYPE_MESSAGE:
|
||||
func = obj_destruct_msg;
|
||||
break;
|
||||
|
||||
case AB_TYPE_CONTAINER:
|
||||
func = obj_destruct_container;
|
||||
break;
|
||||
|
||||
case AB_TYPE_DRAWING_AREA:
|
||||
func = obj_destruct_drawing_area;
|
||||
break;
|
||||
|
||||
case AB_TYPE_MODULE:
|
||||
func = obj_destruct_module;
|
||||
break;
|
||||
|
||||
case AB_TYPE_ITEM:
|
||||
func = obj_destruct_item;
|
||||
break;
|
||||
|
||||
case AB_TYPE_LAYERS:
|
||||
func = obj_destruct_layers;
|
||||
break;
|
||||
|
||||
case AB_TYPE_LIST:
|
||||
func = obj_destruct_list;
|
||||
break;
|
||||
|
||||
case AB_TYPE_MENU:
|
||||
func = obj_destruct_menu;
|
||||
break;
|
||||
|
||||
case AB_TYPE_PROJECT:
|
||||
func = obj_destruct_project;
|
||||
break;
|
||||
|
||||
case AB_TYPE_SEPARATOR:
|
||||
func = obj_destruct_separator;
|
||||
break;
|
||||
|
||||
case AB_TYPE_SCALE:
|
||||
func = obj_destruct_scale;
|
||||
break;
|
||||
|
||||
case AB_TYPE_SPIN_BOX:
|
||||
func = obj_destruct_spin_box;
|
||||
break;
|
||||
|
||||
case AB_TYPE_TERM_PANE:
|
||||
func = obj_destruct_term_pane;
|
||||
break;
|
||||
|
||||
case AB_TYPE_TEXT_FIELD:
|
||||
case AB_TYPE_TEXT_PANE:
|
||||
func = obj_destruct_text;
|
||||
break;
|
||||
|
||||
case AB_TYPE_LABEL:
|
||||
case AB_TYPE_UNKNOWN:
|
||||
func = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
retval = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((retval >= 0) && (func != NULL))
|
||||
{
|
||||
retval = func(obj);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
149
cde/programs/dtappbuilder/src/libABobj/obj_scoped.c
Normal file
149
cde/programs/dtappbuilder/src/libABobj/obj_scoped.c
Normal file
@@ -0,0 +1,149 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_scoped.c /main/3 1995/11/06 18:38:33 rswiston $
|
||||
*
|
||||
* @(#)obj_scoped.c 1.10 13 Feb 1994
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* scoped.c - handled scoped naming and objects
|
||||
*
|
||||
* A scoped name has the form <name>, <module-name>.<name>, or
|
||||
* <module-name>::<name>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
/*
|
||||
* The objName parameter can be a simple name, or can be of the form
|
||||
* module.name or module::name. The separator can have an arbitrary
|
||||
* amount of white space on either side of it. For example, these are
|
||||
* all legal names:
|
||||
*
|
||||
* "my_object"
|
||||
* "my_module::your_object"
|
||||
* "your_module.your_object
|
||||
* "your_module . her_object"
|
||||
* "his_module :: that_object"
|
||||
*
|
||||
* If the object name is simple (without "." or "::"), searchFirstObj
|
||||
* is searched, and then the module is searched for an object with the
|
||||
* given name.
|
||||
*
|
||||
* If the name is complex, the module and object name
|
||||
* are found, relative to the project.
|
||||
*/
|
||||
ABObj
|
||||
obj_scoped_find_by_name(ABObj searchFirstObj, STRING objName)
|
||||
{
|
||||
ABObj obj= NULL;
|
||||
char *dotPtr= NULL;
|
||||
char *moduleNamePtr= NULL;
|
||||
char *objNamePtr= objName;
|
||||
char *moduleNameEndPtr = NULL;
|
||||
int moduleNameEndChar = -1;
|
||||
char nameBuf[1024];
|
||||
/* printf("obj_scoped_find_by_name(%s[%s])\n",
|
||||
obj_get_safe_name(searchFirstObj, nameBuf, 1024),
|
||||
util_strsafe(objName)); */
|
||||
|
||||
if ((dotPtr= strchr(objName, '.')) != NULL)
|
||||
{
|
||||
moduleNamePtr= objName;
|
||||
objNamePtr= dotPtr+1;
|
||||
}
|
||||
else if ((dotPtr= strstr(objName, "::")) != NULL)
|
||||
{
|
||||
moduleNamePtr= objName;
|
||||
objNamePtr= dotPtr+2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove white space on either side of the separator
|
||||
*/
|
||||
if (dotPtr != NULL)
|
||||
{
|
||||
/* put a 0 at the end of the module name */
|
||||
for (moduleNameEndPtr = dotPtr-1;
|
||||
((moduleNameEndPtr > objName) && isspace(*moduleNameEndPtr)); )
|
||||
{
|
||||
--moduleNameEndPtr;
|
||||
}
|
||||
if (moduleNameEndPtr < dotPtr)
|
||||
{
|
||||
++moduleNameEndPtr; /* point one *after* last char in name */
|
||||
}
|
||||
moduleNameEndChar = *moduleNameEndPtr;
|
||||
*moduleNameEndPtr = 0;
|
||||
}
|
||||
while (((*objNamePtr) != NULL) && (isspace(*objNamePtr)))
|
||||
{
|
||||
++objNamePtr;
|
||||
}
|
||||
|
||||
/*
|
||||
* We now have the module and object name, so find the object.
|
||||
*/
|
||||
if (moduleNamePtr == NULL)
|
||||
{
|
||||
/*
|
||||
* This is a simple name
|
||||
*/
|
||||
obj= obj_find_by_name(searchFirstObj, objNamePtr);
|
||||
|
||||
/*
|
||||
* It doesn't exist in the scoping object, so look at the module
|
||||
*/
|
||||
if ((obj == NULL) && (!obj_is_module(searchFirstObj)))
|
||||
{
|
||||
ABObj module = obj_get_module(searchFirstObj);
|
||||
if (module != NULL)
|
||||
{
|
||||
obj = obj_find_by_name(module, objNamePtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Module name has been specified
|
||||
*/
|
||||
ABObj objProject= obj_get_project(searchFirstObj);
|
||||
ABObj objModule= NULL;
|
||||
|
||||
if (objProject != NULL)
|
||||
{
|
||||
objModule = obj_find_module_by_name(objProject, moduleNamePtr);
|
||||
}
|
||||
if (objModule != NULL)
|
||||
{
|
||||
obj= obj_find_by_name(objModule, objNamePtr);
|
||||
}
|
||||
}
|
||||
|
||||
epilogue:
|
||||
/* replace the 0 we inserted with the char that was there */
|
||||
if (moduleNameEndPtr != NULL)
|
||||
{
|
||||
*moduleNameEndPtr= moduleNameEndChar;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
112
cde/programs/dtappbuilder/src/libABobj/obj_select.c
Normal file
112
cde/programs/dtappbuilder/src/libABobj/obj_select.c
Normal file
@@ -0,0 +1,112 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_select.c /main/3 1995/11/06 18:38:49 rswiston $
|
||||
*
|
||||
* @(#)obj_select.c 1.10 11 Feb 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* obj_select.c - object selection
|
||||
*/
|
||||
|
||||
#include "objP.h" /* must put private includes first! */
|
||||
#include "obj_notifyP.h"
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Constants (#define and const) **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Private Functions (C declarations and macros) **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/* logical exclusive or */
|
||||
#ifndef util_xor
|
||||
#define util_xor(a,b) ( ((a) && (!(b))) || ((!(a)) && (b)) )
|
||||
#endif
|
||||
|
||||
static int obj_set_selected_false(ABObj obj);
|
||||
static int obj_set_selected_true(ABObj obj);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Data **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Function Definitions **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
int
|
||||
obj_set_is_selected(ABObj obj, BOOL new_is_selected)
|
||||
{
|
||||
return (new_is_selected?
|
||||
obj_set_selected_true(obj) : obj_set_selected_false(obj));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sends notification only if the object's state changes
|
||||
*/
|
||||
static int
|
||||
obj_set_selected_true(ABObj obj)
|
||||
{
|
||||
BOOL changed= !obj_is_selected(obj);
|
||||
|
||||
obj_set_impl_flags(obj, ObjFlagIsSelected);
|
||||
|
||||
if (changed)
|
||||
{
|
||||
objP_notify_send_selected_change(obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sends notification only if the object's state changes
|
||||
*/
|
||||
static int
|
||||
obj_set_selected_false(ABObj obj)
|
||||
{
|
||||
BOOL changed= obj_is_selected(obj);
|
||||
|
||||
obj_clear_impl_flags(obj, ObjFlagIsSelected);
|
||||
|
||||
if (changed)
|
||||
{
|
||||
objP_notify_send_selected_change(obj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
obj_is_selected(ABObj obj)
|
||||
{
|
||||
return obj_has_impl_flags(obj, ObjFlagIsSelected);
|
||||
}
|
||||
|
||||
1170
cde/programs/dtappbuilder/src/libABobj/obj_tree.c
Normal file
1170
cde/programs/dtappbuilder/src/libABobj/obj_tree.c
Normal file
File diff suppressed because it is too large
Load Diff
92
cde/programs/dtappbuilder/src/libABobj/obj_trigger.c
Normal file
92
cde/programs/dtappbuilder/src/libABobj/obj_trigger.c
Normal file
@@ -0,0 +1,92 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: obj_trigger.c /main/3 1995/11/06 18:39:23 rswiston $
|
||||
*
|
||||
* %W% %G% cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* trigger.c - Action triggers
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ab_private/util.h>
|
||||
#include "objP.h"
|
||||
|
||||
/*
|
||||
* Creates and inits a trigger.
|
||||
*/
|
||||
ABTrigger
|
||||
trigger_create(void)
|
||||
{
|
||||
ABTrigger trigger= NULL;
|
||||
|
||||
trigger= (ABTrigger)malloc(sizeof(*trigger));
|
||||
trigger_init(trigger);
|
||||
return trigger;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
trigger_destroy(ABTrigger trigger)
|
||||
{
|
||||
trigger_release(trigger);
|
||||
util_free(trigger);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sets default values for all the fields
|
||||
*/
|
||||
int
|
||||
trigger_init(ABTrigger trigger)
|
||||
{
|
||||
trigger->next= NULL;
|
||||
trigger->prev= NULL;
|
||||
trigger->owner= NULL;
|
||||
trigger->from= NULL;
|
||||
trigger->when= AB_WHEN_UNDEF;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Releases all resources and links the trigger may have. It is safe
|
||||
* to delete the object after it is released.
|
||||
*/
|
||||
int
|
||||
trigger_release(ABTrigger trigger)
|
||||
{
|
||||
return trigger_unlink(trigger);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Removes the trigger completely from the network of data structures.
|
||||
*/
|
||||
int
|
||||
trigger_unlink(ABTrigger trigger)
|
||||
{
|
||||
if (trigger->owner != NULL)
|
||||
{
|
||||
obj_action_remove_trigger(trigger->owner, trigger);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
1843
cde/programs/dtappbuilder/src/libABobj/obj_utils.c
Normal file
1843
cde/programs/dtappbuilder/src/libABobj/obj_utils.c
Normal file
File diff suppressed because it is too large
Load Diff
36
cde/programs/dtappbuilder/src/libABobj/obj_utils.h
Normal file
36
cde/programs/dtappbuilder/src/libABobj/obj_utils.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* $XConsortium: obj_utils.h /main/3 1995/11/06 18:40:03 rswiston $
|
||||
*
|
||||
* %W% %G% cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* utils.h - PRIVATE UTILS FOR LIBAB_OBJ
|
||||
*/
|
||||
|
||||
#ifndef _AB_OBJ_UTILS_
|
||||
#define _AB_OBJ_UTILS_
|
||||
|
||||
#include <ab/util_types.h>
|
||||
|
||||
#define str_safe(str) ((str) == NULL? abo_null_string : (str))
|
||||
|
||||
extern char *abo_empty_string;
|
||||
extern char *abo_null_string;
|
||||
|
||||
#define nullstr(s) ((s) == NULL? "<<NULL>>":(s))
|
||||
|
||||
#endif /* _AB_OBJ_UTILS_ */
|
||||
64
cde/programs/dtappbuilder/src/libABobj/sizeof.c
Normal file
64
cde/programs/dtappbuilder/src/libABobj/sizeof.c
Normal file
@@ -0,0 +1,64 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: sizeof.c /main/4 1996/10/02 15:41:55 drk $
|
||||
*
|
||||
* @(#)sizeof.c 3.5 11 Feb 1994
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* sizeof.c
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
main ()
|
||||
{
|
||||
{
|
||||
AB_OBJ obj;
|
||||
AB_OBJ_EXTRA_INFO *info= &(obj.info);
|
||||
printf("sizeof:\n");
|
||||
printf(" ABObj:%ld (%ld + %ld)\n",
|
||||
(long)sizeof(obj),
|
||||
(long)sizeof(obj)-(long)sizeof(obj.info),
|
||||
(long)sizeof(obj.info));
|
||||
printf(" info:%ld\n", (long)sizeof(obj.info));
|
||||
printf(" action:%ld\n", (long)sizeof(info->action));
|
||||
printf(" action_list:%ld\n", (long)sizeof(info->action_list));
|
||||
printf(" button:%ld\n", (long)sizeof(info->button));
|
||||
printf(" choice:%ld\n", (long)sizeof(info->choice));
|
||||
printf(" file_chooser:%ld\n", (long)sizeof(info->file_chooser));
|
||||
/* printf(" message_box:%ld\n", (long)sizeof(info->msg_box)); */
|
||||
printf(" container:%ld\n", (long)sizeof(info->container));
|
||||
printf(" drawing_area:%ld\n", (long)sizeof(info->drawing_area));
|
||||
/* printf(" drop_target:%ld\n", (long)sizeof(info->drop_target)); */
|
||||
/*printf(" glyph:%ld\n", (long)sizeof(info->glyph)); */
|
||||
printf(" item:%ld\n", (long)sizeof(info->item));
|
||||
printf(" label:%ld\n", (long)sizeof(info->label));
|
||||
printf(" list:%ld\n", (long)sizeof(info->list));
|
||||
printf(" menu:%ld\n", (long)sizeof(info->menu));
|
||||
/* printf(" menu_ref:%ld\n", (long)sizeof(info->menu_ref)); */
|
||||
printf(" module:%ld\n", (long)sizeof(info->module));
|
||||
printf(" project:%ld\n", (long)sizeof(info->project));
|
||||
printf(" slider:%ld\n", (long)sizeof(info->scale));
|
||||
printf(" term:%ld\n", (long)sizeof(info->term));
|
||||
printf(" text:%ld\n", (long)sizeof(info->text));
|
||||
printf(" window:%ld\n", (long)sizeof(info->window));
|
||||
/* printf(" :%ld\n", (long)sizeof()); */
|
||||
}
|
||||
}
|
||||
|
||||
80
cde/programs/dtappbuilder/src/libABobj/template.c
Normal file
80
cde/programs/dtappbuilder/src/libABobj/template.c
Normal file
@@ -0,0 +1,80 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: template.c /main/3 1995/11/06 18:40:30 rswiston $
|
||||
*
|
||||
* %W% %G% cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* template.c - template c file.
|
||||
*/
|
||||
|
||||
#include "template.h"
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Constants (#define and const) **
|
||||
** **
|
||||
**************************************************************************/
|
||||
#define FOO_DEFINES "here"
|
||||
|
||||
const char *foo_consts = "also here";
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Private Functions (C declarations and macros) **
|
||||
** **
|
||||
**************************************************************************/
|
||||
#define foo_macro(x) ((x) + 1)
|
||||
|
||||
static int foo_me(
|
||||
int foo_int,
|
||||
char *foo_char
|
||||
);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Data **
|
||||
** **
|
||||
**************************************************************************/
|
||||
static int foo_private= 0;
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Function Definitions **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
int
|
||||
foo_func(
|
||||
char *foo_char
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
foo_me(
|
||||
int foo_int,
|
||||
char *foo_char
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
29
cde/programs/dtappbuilder/src/libABobj/template.h
Normal file
29
cde/programs/dtappbuilder/src/libABobj/template.h
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: template.h /main/3 1995/11/06 18:40:44 rswiston $
|
||||
*
|
||||
* %W% %G%
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* template.h - template header file
|
||||
*/
|
||||
#ifndef _ABOBJ_TEMPLATE_H_
|
||||
#define _ABOBJ_TEMPLATE_H_
|
||||
|
||||
|
||||
#endif /* _ABOBJ_TEMPLATE_H_ */
|
||||
|
||||
593
cde/programs/dtappbuilder/src/libABobj/test.c
Normal file
593
cde/programs/dtappbuilder/src/libABobj/test.c
Normal file
@@ -0,0 +1,593 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: test.c /main/4 1996/10/02 15:40:27 drk $
|
||||
*
|
||||
* @(#)test.c 3.30 13 Feb 1994
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* test.c - test driver for libABobj
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ab_private/obj.h>
|
||||
#include <ab_private/trav.h>
|
||||
|
||||
static ABObj *objArray= NULL;
|
||||
static int objArraySize= 0;
|
||||
|
||||
static int print_sizeof(void);
|
||||
static ABObj build_test_project(void);
|
||||
static ABObj build_test_module(ABObj project);
|
||||
static int add_to_array(ABObj obj);
|
||||
static ABObj create_one(ABObj parent,
|
||||
AB_OBJECT_TYPE type, ABObj compositeRoot);
|
||||
static int set_name(ABObj obj);
|
||||
static int show_salient_ui(ABObj root);
|
||||
static int show_salient_ui_tree(ABObj root);
|
||||
static int check_obj_verify(void);
|
||||
static int check_scoped_searches(ABObj root);
|
||||
static int check_parents_first(ABObj root);
|
||||
static int obj_print_salient_tree(ABObj root);
|
||||
static int obj_print_salient_tree_indented(ABObj obj,
|
||||
int spaces, int verbosity, int numPrinted);
|
||||
|
||||
static unsigned travMod= 0;
|
||||
|
||||
|
||||
int
|
||||
main (int argc, STRING argv[])
|
||||
{
|
||||
ABObj tree= NULL;
|
||||
ABObj module1= NULL;
|
||||
ABObj module2= NULL;
|
||||
ABObj module3= NULL;
|
||||
ABObj obj= NULL;
|
||||
int objCount= 0;
|
||||
|
||||
util_init(&argc, &argv);
|
||||
travMod= AB_TRAV_MOD_SAFE; /* use for all traversals */
|
||||
|
||||
/*
|
||||
{
|
||||
STRING h1= NULL, h2= NULL, h3= NULL;
|
||||
h1= "h1"; h2= "h2"; h3= "h3";
|
||||
obj= obj_create(AB_TYPE_UNDEF, NULL);
|
||||
obj_set_help_data(obj, h1, h2, h3);
|
||||
h1= h2= h3= NULL;
|
||||
obj_get_help_data(obj, &h1, &h2, &h3);
|
||||
printf("'%s', '%s', '%s'\n", h1, h2, h3);
|
||||
exit(0);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* print_sizeof(); */
|
||||
if (util_get_verbosity() < 3)
|
||||
{
|
||||
util_set_verbosity(3);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test the obj_verify() method
|
||||
*/
|
||||
check_obj_verify();
|
||||
|
||||
tree= build_test_project();
|
||||
if (obj_tree_verify(tree) < 0)
|
||||
{
|
||||
printf("tree corrupt! %s:%d\n", __FILE__, __LINE__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check scoped searches
|
||||
*/
|
||||
check_scoped_searches(tree);
|
||||
|
||||
/*
|
||||
* Check object counts...
|
||||
*/
|
||||
objCount= trav_count(tree, AB_TRAV_ALL);
|
||||
if (objCount != objArraySize)
|
||||
{
|
||||
printf("object count incorrect! %s:%d\n", __FILE__, __LINE__);
|
||||
exit(1);
|
||||
}
|
||||
printf("Objects in tree: %d\n", objArraySize);
|
||||
|
||||
/*
|
||||
* Make sure parents first works
|
||||
*/
|
||||
check_parents_first(tree);
|
||||
|
||||
/*
|
||||
* get modules - check find_by_name
|
||||
*/
|
||||
module1= obj_find_module_by_name(tree, "module1");
|
||||
module2= obj_find_module_by_name(tree, "module2");
|
||||
module3= obj_find_module_by_name(tree, "module3");
|
||||
if ( ((module1 == NULL) || (!util_streq(obj_get_name(module1), "module1")))
|
||||
|| ((module2 == NULL) || (!util_streq(obj_get_name(module2), "module2")))
|
||||
|| ((module3 == NULL) || (!util_streq(obj_get_name(module3), "module3")))
|
||||
)
|
||||
{
|
||||
printf("error %s:%d\n", __FILE__, __LINE__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
obj_tree_print(tree);
|
||||
|
||||
/** test salients */
|
||||
show_salient_ui(tree);
|
||||
show_salient_ui_tree(tree);
|
||||
|
||||
if (obj_tree_verify(tree) >= 0)
|
||||
{
|
||||
util_printf("Tree is OK\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
util_printf("*** TREE IS CORRUPT ***\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
check_obj_verify(void)
|
||||
{
|
||||
#define bg_color bg_color_ABOBJPRIVDDDD7609528164
|
||||
#define name name_ABOBJPRIVDDDD6281986324
|
||||
|
||||
int rc = 0; /* return code */
|
||||
ABObj badObjRef = (ABObj)0x01;
|
||||
ABObj obj = NULL;
|
||||
|
||||
rc = obj_verify(badObjRef);
|
||||
printf("obj_verify(badObjRef):%d\n", rc);
|
||||
|
||||
obj = obj_create(AB_TYPE_UNDEF, NULL);
|
||||
rc = obj_verify(obj);
|
||||
printf ("obj_verify(obj): %d\n", rc);
|
||||
|
||||
obj->next_sibling = (ABObj)-1;
|
||||
rc = obj_verify(obj);
|
||||
printf("obj_verify(badSib):%d\n", rc);
|
||||
|
||||
obj->name = (ISTRING)1000000;
|
||||
rc = obj_verify(obj);
|
||||
printf("obj_verify(badSibName):%d\n", rc);
|
||||
|
||||
obj->name = NULL;
|
||||
obj->next_sibling = NULL;
|
||||
obj_set_name(obj, "TEST OBJECT");
|
||||
obj->bg_color = (ISTRING)1000000;
|
||||
rc = obj_verify(obj);
|
||||
printf("obj_verify(objBadBgColor):%d\n", rc);
|
||||
obj->bg_color = NULL;
|
||||
|
||||
obj_destroy(obj); obj = NULL;
|
||||
|
||||
return 0;
|
||||
#undef bg_color
|
||||
#undef name
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
check_scoped_searches(ABObj root)
|
||||
{
|
||||
ABObj module1= NULL;
|
||||
ABObj module2= NULL;
|
||||
ABObj module3= NULL;
|
||||
ABObj slider2_parent= NULL;
|
||||
ABObj obj= NULL;
|
||||
char nameBuf[1024] = "";
|
||||
|
||||
module1= obj_find_module_by_name(root, "module1");
|
||||
module2= obj_find_module_by_name(root, "module2");
|
||||
module3= obj_find_module_by_name(root, "module3");
|
||||
|
||||
/* we know there is one slider in each module. */
|
||||
obj= obj_scoped_find_by_name(module1, "slider1");
|
||||
printf("(module1, slider1): "); obj_print(obj);
|
||||
|
||||
obj= obj_scoped_find_by_name(module1, "module2::slider2");
|
||||
printf("(module1, module2::slider2): "); obj_print(obj);
|
||||
if (obj == NULL)
|
||||
{
|
||||
fprintf(stderr, "SEARCH FAILED %s::%d\n", __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
slider2_parent = obj->parent;
|
||||
obj= obj_scoped_find_by_name(module3, "module2 :: slider2");
|
||||
printf("(module3, module2 :: slider2): "); obj_print(obj);
|
||||
|
||||
obj= obj_scoped_find_by_name(module3, "module2 ::slider2");
|
||||
printf("(module3, module2 ::slider2): "); obj_print(obj);
|
||||
|
||||
obj= obj_scoped_find_by_name(module3, "module2.slider2");
|
||||
printf("(module3, module2.slider2): "); obj_print(obj);
|
||||
|
||||
obj= obj_scoped_find_by_name(slider2_parent, "slider2");
|
||||
printf("(%s, slider2): ",
|
||||
obj_get_safe_name(slider2_parent, nameBuf, 1024));
|
||||
obj_print(obj);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
check_parents_first(ABObj root)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
AB_TRAVERSAL parentTrav;
|
||||
int i;
|
||||
ABObj obj= NULL;
|
||||
ABObj ancestor= NULL;
|
||||
int iRet= 0;
|
||||
BOOL *visited= NULL;
|
||||
|
||||
visited= (BOOL *)util_malloc(objArraySize * sizeof(BOOL));
|
||||
for (i= 0; i < objArraySize; ++i)
|
||||
{
|
||||
visited[i]= FALSE;
|
||||
}
|
||||
|
||||
for (trav_open(&trav, root, travMod|AB_TRAV_MOD_PARENTS_FIRST);
|
||||
(obj= trav_next(&trav)) != NULL; )
|
||||
{
|
||||
/*
|
||||
* mark object as visited
|
||||
*/
|
||||
for (i= 0; i < objArraySize; ++i)
|
||||
{
|
||||
if (objArray[i] == obj)
|
||||
{
|
||||
visited[i]= TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure all ancestors have been visited
|
||||
*/
|
||||
for (trav_open(&parentTrav, obj, travMod|AB_TRAV_PARENTS);
|
||||
(ancestor= trav_next(&parentTrav)) != NULL; )
|
||||
{
|
||||
for (i= 0; i < objArraySize; ++i)
|
||||
{
|
||||
if (objArray[i] == ancestor)
|
||||
{
|
||||
if (!visited[i])
|
||||
{
|
||||
/* this ancestor has not been visited!! */
|
||||
fprintf(stderr, "Not all ancestors visited %s:%d\n",
|
||||
__FILE__, __LINE__);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
trav_close(&parentTrav);
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
|
||||
for (i= 0; i < objArraySize; ++i)
|
||||
{
|
||||
if (!visited[i])
|
||||
{
|
||||
fprintf(stderr, "PARENTS_FIRST didn't visit all nodes! %s:%d\n",
|
||||
__FILE__, __LINE__);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
epilogue:
|
||||
util_free(visited);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
static int
|
||||
show_salient_ui(ABObj root)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj obj= NULL;
|
||||
int salientCount= 0;
|
||||
int printCount= 0;
|
||||
int i;
|
||||
|
||||
for (i= 0; i < objArraySize; ++i)
|
||||
{
|
||||
if (obj_is_salient_ui(objArray[i]))
|
||||
{
|
||||
++salientCount;
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n***** AB_TRAV_SALIENT_UI *****\n");
|
||||
printCount= 0;
|
||||
for (trav_open(&trav, root, travMod|AB_TRAV_SALIENT_UI);
|
||||
(obj= trav_next(&trav)) != NULL; )
|
||||
{
|
||||
++printCount;
|
||||
util_dprintf(0, "% 3d ", printCount);
|
||||
obj_print(obj);
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
if (printCount != salientCount)
|
||||
{
|
||||
fprintf(stderr, "Incorrect # salient objs returned. %s:%d\n",
|
||||
__FILE__, __LINE__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
show_salient_ui_tree(ABObj tree)
|
||||
{
|
||||
int salientCount= 0;
|
||||
int printCount= 0;
|
||||
int i= 0;
|
||||
|
||||
printf("\n***** AB_TRAV_SALIENT_UI_CHILDREN *****\n");
|
||||
|
||||
salientCount= 0;
|
||||
for (i= 0; i < objArraySize; ++i)
|
||||
{
|
||||
if (obj_is_salient_ui(objArray[i]))
|
||||
{
|
||||
++salientCount;
|
||||
}
|
||||
}
|
||||
|
||||
printCount= obj_print_salient_tree(tree);
|
||||
|
||||
if (printCount != salientCount)
|
||||
{
|
||||
fprintf(stderr, "salient counts don't match! %s:%d\n",
|
||||
__FILE__, __LINE__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return printCount;
|
||||
}
|
||||
|
||||
static ABObj
|
||||
build_test_project()
|
||||
{
|
||||
ABObj project= NULL;
|
||||
|
||||
util_free(objArray); objArraySize= 0;
|
||||
project= obj_create(AB_TYPE_PROJECT, NULL);
|
||||
add_to_array(project);
|
||||
set_name(project);
|
||||
|
||||
build_test_module(project);
|
||||
build_test_module(project);
|
||||
build_test_module(project);
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
static ABObj
|
||||
build_test_module(ABObj project)
|
||||
{
|
||||
ABObj root= NULL;
|
||||
ABObj compRoot= NULL;
|
||||
ABObj obj1= NULL;
|
||||
ABObj obj2= NULL;
|
||||
ABObj obj3= NULL;
|
||||
ABObj obj4= NULL;
|
||||
ABObj obj5= NULL;
|
||||
ABObj obj6= NULL;
|
||||
ABObj obj7= NULL;
|
||||
|
||||
root= project;
|
||||
/*
|
||||
* Interface
|
||||
*/
|
||||
obj1= create_one(root, AB_TYPE_MODULE, NULL);
|
||||
obj1->part_of= obj1;
|
||||
compRoot= obj1;
|
||||
|
||||
obj2= create_one(obj1, AB_TYPE_TEXT_FIELD, compRoot);
|
||||
obj3= create_one(obj2, AB_TYPE_CONTAINER, NULL);
|
||||
|
||||
obj2= create_one(obj1, AB_TYPE_LIST, compRoot);
|
||||
obj3= create_one(obj2, AB_TYPE_CONTAINER, compRoot);
|
||||
obj4= create_one(obj3, AB_TYPE_CONTAINER, compRoot);
|
||||
obj5= create_one(obj4, AB_TYPE_TEXT_FIELD, compRoot);
|
||||
|
||||
obj3= create_one(obj2, AB_TYPE_CONTAINER, compRoot);
|
||||
obj4= create_one(obj3, AB_TYPE_LIST, NULL);
|
||||
|
||||
obj4= create_one(obj3, AB_TYPE_CONTAINER, NULL);
|
||||
obj5= create_one(obj4, AB_TYPE_SLIDER, NULL);
|
||||
obj5->part_of= obj5;
|
||||
compRoot= obj5;
|
||||
|
||||
obj6= create_one(obj5, AB_TYPE_LIST, compRoot);
|
||||
obj7= create_one(obj6, AB_TYPE_ITEM, NULL);
|
||||
|
||||
obj6= create_one(obj5, AB_TYPE_ITEM, compRoot);
|
||||
|
||||
compRoot= obj1;
|
||||
|
||||
obj3= create_one(obj2, AB_TYPE_TEXT_FIELD, NULL);
|
||||
|
||||
obj2= create_one(obj1, AB_TYPE_LIST, compRoot);
|
||||
obj3= create_one(obj2, AB_TYPE_ITEM, NULL);
|
||||
|
||||
obj3= create_one(obj2, AB_TYPE_LIST, NULL);
|
||||
obj3->part_of= obj3;
|
||||
compRoot= obj3;
|
||||
|
||||
obj4= create_one(obj3, AB_TYPE_CONTAINER, compRoot);
|
||||
obj5= create_one(obj4, AB_TYPE_BUTTON, NULL);
|
||||
|
||||
if (obj_tree_verify(root) < 0)
|
||||
{
|
||||
fprintf(stderr, "Tree invalid in create_tree!\n");
|
||||
exit(1);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
static int
|
||||
set_name(ABObj obj)
|
||||
{
|
||||
static int typeCounts[AB_OBJECT_TYPE_NUM_VALUES];
|
||||
static BOOL typeCountsInited= FALSE;
|
||||
char name[256];
|
||||
|
||||
if (!typeCountsInited)
|
||||
{
|
||||
int i;
|
||||
typeCountsInited= TRUE;
|
||||
for (i= 0; i < AB_OBJECT_TYPE_NUM_VALUES; ++i)
|
||||
{
|
||||
typeCounts[i]= 0;
|
||||
}
|
||||
}
|
||||
|
||||
++(typeCounts[obj->type]);
|
||||
sprintf(name, "%s%d",
|
||||
util_object_type_to_string(obj->type)+1, typeCounts[obj->type]);
|
||||
obj_set_name(obj, name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ABObj
|
||||
create_one(ABObj parent, AB_OBJECT_TYPE type, ABObj compositeRoot)
|
||||
{
|
||||
ABObj obj= NULL;
|
||||
obj= obj_create(type, NULL);
|
||||
add_to_array(obj);
|
||||
set_name(obj);
|
||||
obj_append_child(parent, obj);
|
||||
obj->part_of= compositeRoot;
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns # of objects printed
|
||||
*/
|
||||
static int
|
||||
obj_print_salient_tree(ABObj obj)
|
||||
{
|
||||
int iRet= 0;
|
||||
int printCount= 0;
|
||||
|
||||
printf("***** Object tree *****\n");
|
||||
|
||||
printCount= obj_print_salient_tree_indented(obj,
|
||||
0, util_get_verbosity(), printCount);
|
||||
iRet= obj_tree_verify(obj);
|
||||
if (iRet < 0)
|
||||
{
|
||||
printf("\n***\n*** TREE IS CORRUPT!\n***");
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet= printCount;
|
||||
}
|
||||
printf("******* Tree End ******\n");
|
||||
printf("\n");
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns total number printed
|
||||
*/
|
||||
static int
|
||||
obj_print_salient_tree_indented(ABObj obj,
|
||||
int spaces, int verbosity, int numPrinted)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj child= NULL;
|
||||
int child_spaces = spaces;
|
||||
|
||||
if (obj == NULL)
|
||||
{
|
||||
printf("NULL Tree\n");
|
||||
return numPrinted;
|
||||
}
|
||||
util_dprintf(0, "% 3d ", numPrinted);
|
||||
if (obj_is_salient_ui(obj))
|
||||
{
|
||||
++numPrinted;
|
||||
obj_print_indented(obj, spaces, verbosity);
|
||||
child_spaces = spaces + 4;
|
||||
}
|
||||
for (trav_open(&trav, obj, travMod|AB_TRAV_SALIENT_CHILDREN);
|
||||
(child= trav_next(&trav)) != NULL; )
|
||||
{
|
||||
numPrinted= obj_print_salient_tree_indented(child,
|
||||
child_spaces, verbosity, numPrinted);
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
return numPrinted;
|
||||
}
|
||||
|
||||
static int
|
||||
print_sizeof(void)
|
||||
{
|
||||
AB_OBJ obj;
|
||||
AB_OBJ_EXTRA_INFO *info= &(obj.info);
|
||||
|
||||
printf("sizeof obj:%ld\n", (long)sizeof(obj));
|
||||
printf(" info:%ld\n", (long)sizeof(obj.info));
|
||||
printf(" action:%ld\n", (long)sizeof(info->action));
|
||||
printf(" action_list:%ld\n", (long)sizeof(info->action_list));
|
||||
printf(" button:%ld\n", (long)sizeof(info->button));
|
||||
printf(" drawing_area:%ld\n", (long)sizeof(info->drawing_area));
|
||||
printf(" choice:%ld\n", (long)sizeof(info->choice));
|
||||
printf(" container:%ld\n", (long)sizeof(info->container));
|
||||
printf(" file_chooser:%ld\n", (long)sizeof(info->file_chooser));
|
||||
printf(" message_box:%ld\n", (long)sizeof(info->msg_box));
|
||||
printf(" module:%ld\n", (long)sizeof(info->module));
|
||||
printf(" item:%ld\n", (long)sizeof(info->item));
|
||||
printf(" label:%ld\n", (long)sizeof(info->label));
|
||||
printf(" list:%ld\n", (long)sizeof(info->list));
|
||||
printf(" menu:%ld\n", (long)sizeof(info->menu));
|
||||
printf(" project:%ld\n", (long)sizeof(info->project));
|
||||
printf(" text:%ld\n", (long)sizeof(info->text));
|
||||
printf(" window:%ld\n", (long)sizeof(info->window));
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
add_to_array(ABObj obj)
|
||||
{
|
||||
++objArraySize;
|
||||
objArray= (ABObj *)realloc(objArray, objArraySize * sizeof(ABObj));
|
||||
objArray[objArraySize-1]= obj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
1469
cde/programs/dtappbuilder/src/libABobj/test_notify.c
Normal file
1469
cde/programs/dtappbuilder/src/libABobj/test_notify.c
Normal file
File diff suppressed because it is too large
Load Diff
633
cde/programs/dtappbuilder/src/libABobj/trav.c
Normal file
633
cde/programs/dtappbuilder/src/libABobj/trav.c
Normal file
@@ -0,0 +1,633 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: trav.c /main/3 1995/11/06 18:41:30 rswiston $
|
||||
*
|
||||
* @(#)trav.c 3.41 14 Feb 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* traversal.c - traversals of object trees
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "objP.h"
|
||||
#include "travP.h"
|
||||
|
||||
static int travP_find_first(ABTraversal trav);
|
||||
static int travP_find_next(ABTraversal trav);
|
||||
static int travP_find_next_parents_first(ABTraversal trav);
|
||||
static int travP_find_first_for_parents(ABTraversal trav);
|
||||
static int travP_find_next_for_parents(ABTraversal trav);
|
||||
static BOOL travP_qualifies(ABTraversal trav);
|
||||
static int travP_verify_type(ABTraversal travType, BOOL warn);
|
||||
static ABObj find_first_item(ABObj obj);
|
||||
static ABObj find_first_child_of_type(ABObj obj,
|
||||
ABTraversal trav, AB_OBJECT_TYPE type);
|
||||
static ABObj find_first_action(ABObj, ABTraversal);
|
||||
static ABObj find_first_sibling_child(ABObj obj, ABTraversal trav);
|
||||
static ABObj find_next_sibling_child(ABObj obj, ABTraversal trav);
|
||||
static ABObj find_first_ancestor_sibling_child(ABObj obj, ABTraversal trav);
|
||||
|
||||
|
||||
int
|
||||
travP_open(
|
||||
ABTraversal trav, ABObj root, unsigned travType,
|
||||
ABObjTestFunc testFunc)
|
||||
{
|
||||
travP_clean(trav);
|
||||
trav->travType= travType;
|
||||
trav->rootObj= root;
|
||||
trav->testFunc= testFunc;
|
||||
travP_reset(trav);
|
||||
travP_verify_type(trav, TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
travP_close(ABTraversal trav)
|
||||
{
|
||||
trav->rootObj= NULL;
|
||||
trav->travType= AB_TRAV_UNDEF;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Restarts the traversal from the beginning. With a safe traversal,
|
||||
* the list of objects is not recalculated.
|
||||
*/
|
||||
int
|
||||
travP_reset(ABTraversal trav)
|
||||
{
|
||||
trav->curObj= NULL;
|
||||
trav->done= FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Hint: travP_goto(trav, -1) is equivalent to travP_reset(trav).
|
||||
*/
|
||||
ABObj
|
||||
travP_goto(ABTraversal trav, int node_num)
|
||||
{
|
||||
int i;
|
||||
|
||||
travP_reset(trav);
|
||||
for (i= 0; i <= node_num; ++i)
|
||||
{
|
||||
travP_next(trav);
|
||||
}
|
||||
|
||||
return trav->curObj;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Effects: gets the next object in the traversal
|
||||
* Modifies: checks/sets done flag
|
||||
*/
|
||||
ABObj
|
||||
travP_next(ABTraversal trav)
|
||||
{
|
||||
BOOL found_next= FALSE;
|
||||
|
||||
if (trav->done)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else if (trav->curObj == NULL)
|
||||
{
|
||||
/* starting a new traversal */
|
||||
travP_find_first(trav);
|
||||
found_next= ((trav->curObj == NULL) || travP_qualifies(trav));
|
||||
}
|
||||
|
||||
while (!found_next)
|
||||
{
|
||||
travP_find_next(trav);
|
||||
if ( (trav->curObj == NULL)
|
||||
|| (travP_qualifies(trav)) )
|
||||
{
|
||||
found_next= TRUE;
|
||||
}
|
||||
} /* while !found_next */
|
||||
|
||||
if (trav->curObj == NULL)
|
||||
{
|
||||
trav->done= TRUE;
|
||||
}
|
||||
|
||||
return trav->curObj;
|
||||
} /* travP_next */
|
||||
|
||||
|
||||
/*
|
||||
* ASSUMES: rootObj is not NULL
|
||||
* - done is FALSE
|
||||
*/
|
||||
static int
|
||||
travP_find_first(ABTraversal trav)
|
||||
{
|
||||
#define rootObj (trav->rootObj)
|
||||
#define curObj (trav->curObj)
|
||||
curObj = NULL;
|
||||
|
||||
switch (travP_get_qualifier(trav))
|
||||
{
|
||||
case AB_TRAV_ACTIONS_FOR_OBJ:
|
||||
curObj= find_first_action(rootObj, trav);
|
||||
break;
|
||||
|
||||
case AB_TRAV_CHILDREN:
|
||||
case AB_TRAV_SALIENT_CHILDREN:
|
||||
case AB_TRAV_SALIENT_UI_CHILDREN:
|
||||
curObj= travP_obj_first_child(rootObj, trav);
|
||||
break;
|
||||
|
||||
case AB_TRAV_COMP_SUBOBJS:
|
||||
if (obj_is_root(rootObj))
|
||||
{
|
||||
curObj = rootObj;
|
||||
}
|
||||
break;
|
||||
|
||||
case AB_TRAV_ITEMS_FOR_OBJ:
|
||||
curObj= find_first_item(rootObj);
|
||||
break;
|
||||
|
||||
case AB_TRAV_MODULES:
|
||||
curObj= obj_is_module(rootObj)?
|
||||
rootObj
|
||||
:
|
||||
find_first_child_of_type(rootObj, trav, AB_TYPE_MODULE);
|
||||
break;
|
||||
|
||||
case AB_TRAV_PARENTS:
|
||||
travP_find_first_for_parents(trav);
|
||||
break;
|
||||
|
||||
case AB_TRAV_SIBLINGS:
|
||||
{
|
||||
ABObj prevSibling= NULL;
|
||||
curObj= rootObj;
|
||||
while ((prevSibling= travP_obj_prev_sibling(curObj, trav)) != NULL)
|
||||
{
|
||||
curObj= prevSibling;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
curObj= rootObj;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#undef rootObj
|
||||
#undef curObj
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Assumes: - traversal is not "done"
|
||||
* - curObj is not NULL
|
||||
*/
|
||||
static int
|
||||
travP_find_next(ABTraversal trav)
|
||||
{
|
||||
#define curObj (trav->curObj)
|
||||
switch (travP_get_qualifier(trav))
|
||||
{
|
||||
/*
|
||||
* Types that return only a set of siblings
|
||||
*/
|
||||
case AB_TRAV_ACTIONS_FOR_OBJ:
|
||||
case AB_TRAV_CHILDREN:
|
||||
case AB_TRAV_ITEMS_FOR_OBJ:
|
||||
case AB_TRAV_MODULES:
|
||||
case AB_TRAV_SALIENT_CHILDREN:
|
||||
case AB_TRAV_SALIENT_UI_CHILDREN:
|
||||
case AB_TRAV_SIBLINGS:
|
||||
curObj= travP_obj_next_sibling(curObj, trav);
|
||||
break;
|
||||
|
||||
/*
|
||||
* Types that return parents
|
||||
*/
|
||||
case AB_TRAV_PARENTS:
|
||||
travP_find_next_for_parents(trav);
|
||||
break;
|
||||
|
||||
/*
|
||||
* Traversals that return an entire tree
|
||||
*/
|
||||
default:
|
||||
travP_find_next_parents_first(trav);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#undef curObj
|
||||
} /* travP_find_next */
|
||||
|
||||
|
||||
static int
|
||||
travP_find_first_for_parents(ABTraversal trav)
|
||||
{
|
||||
#define curObj (trav->curObj)
|
||||
ABObj parent= NULL;
|
||||
|
||||
if (travP_is_parents_first(trav))
|
||||
{
|
||||
curObj= travP_obj_parent(trav->rootObj, trav);
|
||||
if (curObj != NULL)
|
||||
{
|
||||
while ((parent= travP_obj_parent(curObj, trav)) != NULL)
|
||||
{
|
||||
curObj= parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
curObj= travP_obj_parent(trav->rootObj, trav);
|
||||
}
|
||||
|
||||
return 0;
|
||||
#undef curObj
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
travP_find_next_for_parents(ABTraversal trav)
|
||||
{
|
||||
#define curObj (trav->curObj)
|
||||
|
||||
if (travP_is_parents_first(trav))
|
||||
{
|
||||
curObj= travP_obj_first_child(curObj, trav);
|
||||
if (curObj == trav->rootObj)
|
||||
{
|
||||
curObj= NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
curObj= travP_obj_parent(curObj, trav);
|
||||
}
|
||||
|
||||
return 0;
|
||||
#undef curObj
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
** **
|
||||
** PARENTS_FIRST TRAVERSAL **
|
||||
** **
|
||||
******************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Assumes: traversal is open and not done
|
||||
*/
|
||||
static int
|
||||
travP_find_next_parents_first(ABTraversal trav)
|
||||
{
|
||||
ABObj curObj= trav->curObj;
|
||||
ABObj tmpObj= NULL;
|
||||
|
||||
if (curObj == trav->rootObj)
|
||||
{
|
||||
curObj= travP_obj_first_child(curObj, trav);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((tmpObj= travP_obj_next_sibling(curObj, trav)) != NULL)
|
||||
{
|
||||
curObj= tmpObj;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpObj= find_first_sibling_child(curObj, trav);
|
||||
if (tmpObj == NULL)
|
||||
{
|
||||
tmpObj= find_first_ancestor_sibling_child(curObj, trav);
|
||||
}
|
||||
curObj= tmpObj;
|
||||
}
|
||||
}
|
||||
|
||||
trav->curObj= curObj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static ABObj
|
||||
find_first_item(ABObj obj)
|
||||
{
|
||||
ABObj compRoot= obj_get_root(obj);
|
||||
ABObj child= NULL;
|
||||
ABObj item= NULL;
|
||||
|
||||
for (child= obj->first_child; child != NULL; child= child->next_sibling)
|
||||
{
|
||||
if (obj_get_root(child) == compRoot)
|
||||
{
|
||||
/* it's a subobj - look at its children */
|
||||
item= find_first_item(child);
|
||||
if (item != NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (obj_is_item(child))
|
||||
{
|
||||
item= child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Finds the first sibling (from "left" to "right") of the object
|
||||
* that has a child. Returns the first child of that sibling.
|
||||
*/
|
||||
static ABObj
|
||||
find_first_sibling_child(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj sibling= obj;
|
||||
ABObj child= NULL;
|
||||
ABObj prevSibling= NULL;
|
||||
ABObj firstChild= NULL;
|
||||
|
||||
while ((prevSibling= travP_obj_prev_sibling(sibling, trav)) != NULL)
|
||||
{
|
||||
sibling= prevSibling;
|
||||
}
|
||||
|
||||
if ((firstChild= travP_obj_first_child(sibling, trav)) != NULL)
|
||||
{
|
||||
child= firstChild;
|
||||
}
|
||||
else
|
||||
{
|
||||
child= find_next_sibling_child(sibling, trav);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Finds the next sibling of the object that has a child.
|
||||
* Returns the first child of that sibling.
|
||||
*/
|
||||
static ABObj
|
||||
find_next_sibling_child(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj sibling= travP_obj_next_sibling(obj, trav);
|
||||
ABObj child= NULL;
|
||||
ABObj firstChild= NULL;
|
||||
|
||||
while ( (sibling != NULL)
|
||||
&& ((firstChild= travP_obj_first_child(sibling, trav)) == NULL) )
|
||||
{
|
||||
sibling= travP_obj_next_sibling(sibling, trav);
|
||||
}
|
||||
|
||||
if (sibling != NULL)
|
||||
{
|
||||
child= firstChild;
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Finds the first ancestor that has a sibling to its "right"
|
||||
* that has a child. Returns the child.
|
||||
*/
|
||||
static ABObj
|
||||
find_first_ancestor_sibling_child(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj ancestor= travP_obj_parent(obj, trav);
|
||||
ABObj child= NULL;
|
||||
|
||||
for (; ((ancestor != NULL) && (ancestor != trav->rootObj));
|
||||
ancestor= travP_obj_parent(ancestor, trav))
|
||||
{
|
||||
child= find_next_sibling_child(ancestor, trav);
|
||||
if (child != NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check the new current object to see if it qualifies for the traversal.
|
||||
*
|
||||
* Assumes: trav->curObj is not null
|
||||
*/
|
||||
static BOOL
|
||||
travP_qualifies(ABTraversal trav)
|
||||
{
|
||||
register ABObj curObj = trav->curObj;
|
||||
register BOOL qualifies= TRUE;
|
||||
|
||||
if (obj_has_impl_flags(curObj, ObjFlagDestroyed))
|
||||
{
|
||||
qualifies= FALSE;
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
switch (travP_get_qualifier(trav))
|
||||
{
|
||||
case AB_TRAV_ACTIONS:
|
||||
case AB_TRAV_ACTIONS_FOR_OBJ:
|
||||
qualifies= obj_is_action(curObj);
|
||||
break;
|
||||
|
||||
case AB_TRAV_COMP_SUBOBJS:
|
||||
qualifies = (obj_get_root(curObj) == trav->rootObj);
|
||||
break;
|
||||
|
||||
case AB_TRAV_FILES:
|
||||
qualifies= (curObj->type == AB_TYPE_FILE);
|
||||
break;
|
||||
|
||||
case AB_TRAV_GROUPS:
|
||||
qualifies= obj_is_group(curObj);
|
||||
break;
|
||||
|
||||
case AB_TRAV_ITEMS:
|
||||
case AB_TRAV_ITEMS_FOR_OBJ:
|
||||
qualifies= obj_is_item(curObj);
|
||||
break;
|
||||
|
||||
case AB_TRAV_MENUS:
|
||||
qualifies= obj_is_menu(curObj);
|
||||
break;
|
||||
|
||||
case AB_TRAV_MODULES:
|
||||
qualifies= obj_is_module(curObj);
|
||||
break;
|
||||
|
||||
case AB_TRAV_SALIENT:
|
||||
case AB_TRAV_SALIENT_CHILDREN:
|
||||
qualifies= obj_is_salient(curObj);
|
||||
break;
|
||||
|
||||
case AB_TRAV_SALIENT_UI:
|
||||
case AB_TRAV_SALIENT_UI_CHILDREN:
|
||||
qualifies= obj_is_salient_ui(curObj);
|
||||
break;
|
||||
|
||||
case AB_TRAV_UI:
|
||||
qualifies= obj_is_ui(curObj);
|
||||
break;
|
||||
|
||||
case AB_TRAV_WINDOWS:
|
||||
qualifies= obj_is_window(curObj);
|
||||
break;
|
||||
}
|
||||
|
||||
if ((qualifies) && (trav->testFunc != NULL))
|
||||
{
|
||||
qualifies = trav->testFunc(curObj);
|
||||
}
|
||||
|
||||
epilogue:
|
||||
return qualifies;
|
||||
} /* travP_qualifies */
|
||||
|
||||
|
||||
/*
|
||||
* Verifies that the traversal type is valid, and changes
|
||||
* it, if necessary.
|
||||
*/
|
||||
static int
|
||||
travP_verify_type(ABTraversal trav, BOOL warn)
|
||||
{
|
||||
int iRet= 0;
|
||||
unsigned travQualifier= travP_get_qualifier(trav);
|
||||
char errMsg[256];
|
||||
errMsg[0]= 0;
|
||||
|
||||
switch (travQualifier)
|
||||
{
|
||||
case AB_TRAV_ACTIONS:
|
||||
case AB_TRAV_ACTIONS_FOR_OBJ:
|
||||
case AB_TRAV_ALL:
|
||||
case AB_TRAV_CHILDREN:
|
||||
case AB_TRAV_COMP_SUBOBJS:
|
||||
case AB_TRAV_FILES:
|
||||
case AB_TRAV_GROUPS:
|
||||
case AB_TRAV_ITEMS:
|
||||
case AB_TRAV_ITEMS_FOR_OBJ:
|
||||
case AB_TRAV_MODULES:
|
||||
case AB_TRAV_MENUS:
|
||||
case AB_TRAV_SALIENT:
|
||||
case AB_TRAV_SALIENT_CHILDREN:
|
||||
case AB_TRAV_SALIENT_UI:
|
||||
case AB_TRAV_SALIENT_UI_CHILDREN:
|
||||
case AB_TRAV_SIBLINGS:
|
||||
case AB_TRAV_UI:
|
||||
case AB_TRAV_WINDOWS:
|
||||
/*
|
||||
* All supported
|
||||
*/
|
||||
break;
|
||||
|
||||
case AB_TRAV_PARENTS:
|
||||
if (travP_is_parents_first(trav) && debugging())
|
||||
{
|
||||
sprintf(errMsg,
|
||||
"WARNING: "
|
||||
"AB_TRAV_PARENTS - Ignoring unsupported modifier "
|
||||
"AB_TRAV_MOD_PARENTS_FIRST.");
|
||||
trav->travType &= ~AB_TRAV_MOD_PARENTS_FIRST;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (debugging())
|
||||
{
|
||||
sprintf(errMsg, "WARNING: travType %d unknown - "
|
||||
"Using AB_TRAV_ALL.",
|
||||
travQualifier);
|
||||
}
|
||||
travQualifier= AB_TRAV_ALL;
|
||||
trav->travType &= TRAV_MODIFIER_MASK;
|
||||
trav->travType |= travQualifier;
|
||||
break;
|
||||
}
|
||||
|
||||
if (warn && ((*errMsg) != 0))
|
||||
{
|
||||
fprintf(stderr, "%s\n", errMsg);
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If parent is NULL, returns NULL.
|
||||
*/
|
||||
static ABObj
|
||||
find_first_child_of_type(ABObj parent, ABTraversal trav, AB_OBJECT_TYPE type)
|
||||
{
|
||||
ABObj child= NULL;
|
||||
|
||||
if (parent == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
for (child= travP_obj_first_child(parent, trav);
|
||||
child != NULL; child= travP_obj_next_sibling(child, trav))
|
||||
{
|
||||
if (child->type == type)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
static ABObj
|
||||
find_first_action(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
obj= find_first_child_of_type(obj, trav, AB_TYPE_ACTION_LIST);
|
||||
if (obj != NULL)
|
||||
{
|
||||
obj= find_first_child_of_type(obj, trav, AB_TYPE_ACTION);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
194
cde/programs/dtappbuilder/src/libABobj/trav.h
Normal file
194
cde/programs/dtappbuilder/src/libABobj/trav.h
Normal file
@@ -0,0 +1,194 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: trav.h /main/3 1995/11/06 18:41:46 rswiston $
|
||||
*
|
||||
* @(#)trav.h 3.28 27 Apr 1994 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Traversal.h - Handles object tree traversal.
|
||||
*
|
||||
* The AB_TRAVERSAL data type allows the client to easily visit objects
|
||||
* in a tree of ABObjs. A great deal of flexibility is provided, with the
|
||||
* ability to select the types of objects to visit, the order they will be
|
||||
* visited in, and the ability to modify the tree while the traversal is
|
||||
* being performed.
|
||||
*
|
||||
* To traverse a tree, call trav_open with the root object of the tree to be
|
||||
* searched, along with a traversal specifier, which is a set of one or more
|
||||
* AB_TRAV_ constants. The specifier defines exactly what types of objects
|
||||
* you want returned, and in what order you want them returned. Note that
|
||||
* trav_open does not return an object - trav_next returns the first and all
|
||||
* successive objects. Calling trav_next until it returns NULL will get
|
||||
* all of the objects selected by the traversal. WHEN THE TRAVERSAL IS NO
|
||||
* LONGER NEEDED, YOU MUST USE trav_close() TO INVALIDATE IT.
|
||||
*
|
||||
* A traversal specifier is a bitwise-ored value, consisting of a traversal
|
||||
* type and zero or more modifiers. Without a modifier, the default order
|
||||
* of visitation is undefined, although each selected object will be returned
|
||||
* exactly once. Note that once a traversal is opened, the traversal specifier
|
||||
* cannot be changed.
|
||||
*
|
||||
* Traversal type
|
||||
* --------------
|
||||
* The traveral type defines the object selection (what types/classes of
|
||||
* objects are visited). Only one traversal type can be specified, and
|
||||
* if no traversal type is specified, AB_TRAV_ALL is assumed.
|
||||
* Commonly used types are AB_TRAV_UI, AB_TRAV_SALIENT and AB_TRAV_SALIENT_UI
|
||||
*
|
||||
* Traversal modifier
|
||||
* ------------------
|
||||
* Modifiers may be used in any combination to modify the behavior of a
|
||||
* traversal.
|
||||
*
|
||||
* AB_TRAV_MOD_PARENTS_FIRST returns the parents (ancestors) of an object
|
||||
* before returning the object itself. This does
|
||||
* not change the objects returned, only their
|
||||
* ordering.
|
||||
*
|
||||
* AB_TRAV_MOD_SAFE allows the tree to be modified while the
|
||||
* traversal is being performed. Note
|
||||
* that if an object is destroyed, an invalid
|
||||
* reference to it will be returned by the
|
||||
* traversal. However, since each object is
|
||||
* returned only once, destroying an object
|
||||
* after it is returned should avoid most
|
||||
* problems.
|
||||
*
|
||||
* Note that all of the calls to the trav_ functions require a first
|
||||
* parameter of type (AB_TRAVERSAL *). This must be a pointer to a
|
||||
* previously-allocated structure (e.g., the address of a local variable
|
||||
* of type AB_TRAVERSAL).
|
||||
*
|
||||
*
|
||||
* E.g.:
|
||||
*
|
||||
* int
|
||||
* show_objects(ABObj root)
|
||||
* {
|
||||
* AB_TRAVERSAL trav;
|
||||
* for (trav_open(&trav, root, AB_TRAV_SALIENT_UI | AB_TRAV_MOD_SAFE);
|
||||
* (obj= trav_next(&trav)) != NULL; )
|
||||
* {
|
||||
* -- operate on obj
|
||||
* }
|
||||
* trav_close(&trav); -- gotta close!
|
||||
* return 0;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* Other examples of opening a traversal:
|
||||
*
|
||||
* trav_open(&trav, rootObj, AB_TRAV_WINDOWS | AB_TRAV_MOD_SAFE);
|
||||
* trav_open(&trav, rootObj, AB_TRAV_UI | AB_TRAV_MOD_SAFE);
|
||||
* trav_open(&trav, rootObj, AB_TRAV_MOD_PARENT_FIRST);
|
||||
*
|
||||
*/
|
||||
#ifndef _ABOBJ_TRAVERSAL_H_
|
||||
#define _ABOBJ_TRAVERSAL_H_
|
||||
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
/*
|
||||
* Traversal types (see comment at top of this file)
|
||||
*/
|
||||
#define AB_TRAV_UNDEF (0U) /* invalid traversal type */
|
||||
#define AB_TRAV_ACTIONS (1U) /* actions only */
|
||||
#define AB_TRAV_ACTIONS_FOR_OBJ (2U) /* actions for root object only */
|
||||
#define AB_TRAV_ALL (3U)
|
||||
#define AB_TRAV_CHILDREN (4U) /* ONLY IMMEDIATE CHILDREN! */
|
||||
#define AB_TRAV_FILES (5U)
|
||||
#define AB_TRAV_GROUPS (6U)
|
||||
#define AB_TRAV_ITEMS (7U) /* all items in tree */
|
||||
#define AB_TRAV_ITEMS_FOR_OBJ (8U) /* items for object only */
|
||||
#define AB_TRAV_MENUS (9U) /* all types of menus */
|
||||
#define AB_TRAV_MODULES (10U)
|
||||
#define AB_TRAV_PARENTS (11U)
|
||||
#define AB_TRAV_SALIENT (12U) /*user-manipulatable objects*/
|
||||
#define AB_TRAV_SALIENT_UI (13U) /* salient && ui */
|
||||
#define AB_TRAV_SALIENT_CHILDREN (14U) /*user-manipulatable children*/
|
||||
#define AB_TRAV_SALIENT_UI_CHILDREN (15U)
|
||||
#define AB_TRAV_SIBLINGS (16U)
|
||||
#define AB_TRAV_UI (17U) /* all ui objs (no actions) */
|
||||
#define AB_TRAV_WINDOWS (18U) /* all windows */
|
||||
#define AB_TRAV_COMP_SUBOBJS (19U) /* subobjs of this comp. obj */
|
||||
|
||||
/*
|
||||
* Traversal modifiers (see comment at top of this file)
|
||||
*/
|
||||
#define AB_TRAV_MOD_PARENTS_FIRST (0x0100U)
|
||||
#define AB_TRAV_MOD_SAFE (0x0200U)
|
||||
|
||||
|
||||
/*
|
||||
* Traversal data structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned travType;
|
||||
ABObj rootObj;
|
||||
ABObj curObj;
|
||||
ABObj *objArray;
|
||||
int objArraySize;
|
||||
int objArrayIndex;
|
||||
BOOL done;
|
||||
ABObjTestFunc testFunc;
|
||||
} AB_TRAVERSAL;
|
||||
typedef AB_TRAVERSAL *ABTraversal;
|
||||
|
||||
/*
|
||||
* callback for trav_perform. return of negative value aborts traversal.
|
||||
*/
|
||||
typedef int (*AB_TRAVERSAL_CB)(ABObj obj);
|
||||
typedef AB_TRAVERSAL_CB ABTraversalCB;
|
||||
|
||||
int trav_open(ABTraversal trav, ABObj root, unsigned trav_type);
|
||||
int trav_open_cond(
|
||||
ABTraversal trav,
|
||||
ABObj root,
|
||||
unsigned trav_type,
|
||||
ABObjTestFunc cond_test_func
|
||||
);
|
||||
ABObj trav_obj(ABTraversal trav);
|
||||
ABObj trav_next(ABTraversal trav);
|
||||
ABObj trav_goto(ABTraversal trav, int which);
|
||||
int trav_close(ABTraversal trav);
|
||||
BOOL trav_is_open(ABTraversal trav);
|
||||
int trav_reset(ABTraversal trav);
|
||||
|
||||
/* Returns the # of objects that will be returned by the traversal.
|
||||
*/
|
||||
int trav_count(ABObj root, int trav_type);
|
||||
int trav_count_cond(ABObj root, int trav_type, ABObjTestFunc);
|
||||
|
||||
/*
|
||||
* Performs the traversal, calling clientfunc on each object. A negative
|
||||
* return from clientfunc aborts the traversal.
|
||||
*/
|
||||
int trav_perform(ABObj root, int trav_type,
|
||||
AB_TRAVERSAL_CB clientfunc);
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Inline implementations **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
#define trav_is_open(trav) ((trav)->rootObj != NULL)
|
||||
#define trav_obj(trav) ((trav)->curObj)
|
||||
|
||||
#endif /* _ABOBJ_TRAVERSAL_H_ */
|
||||
|
||||
414
cde/programs/dtappbuilder/src/libABobj/travP.c
Normal file
414
cde/programs/dtappbuilder/src/libABobj/travP.c
Normal file
@@ -0,0 +1,414 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: travP.c /main/3 1995/11/06 18:42:00 rswiston $
|
||||
*
|
||||
* @(#)travP.c 1.9 14 Feb 1994
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* TraversalP.c - functions used by traversal code. DO NOT USE OR MODIFY
|
||||
* THESE FUNCTIONS UNLESS YOU ARE WORKING ON TRAVERSALS!!!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "travP.h"
|
||||
|
||||
static ABObj travP_obj_salient_parent(ABObj obj, ABTraversal trav);
|
||||
static ABObj travP_obj_salient_first_child(ABObj obj, ABTraversal trav);
|
||||
static ABObj travP_obj_salient_next_sibling(ABObj obj, ABTraversal trav);
|
||||
static ABObj travP_obj_salient_prev_sibling(ABObj obj, ABTraversal trav);
|
||||
static ABObj find_first_non_subobj_child(ABObj obj, ABObj compRoot);
|
||||
static ABObj find_ancestor_prev_sibling(ABObj obj, ABObj searchRoot);
|
||||
static ABObj find_ancestor_next_sibling(ABObj obj, ABObj searchRoot);
|
||||
|
||||
|
||||
ABObj
|
||||
travP_obj_parent(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj parent= NULL;
|
||||
|
||||
switch (travP_get_qualifier(trav))
|
||||
{
|
||||
case AB_TRAV_SALIENT:
|
||||
case AB_TRAV_SALIENT_CHILDREN:
|
||||
case AB_TRAV_SALIENT_UI:
|
||||
case AB_TRAV_SALIENT_UI_CHILDREN:
|
||||
parent= travP_obj_salient_parent(obj, trav);
|
||||
break;
|
||||
|
||||
default:
|
||||
parent= obj->parent;
|
||||
break;
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
travP_obj_first_child(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj child= NULL;
|
||||
|
||||
switch (travP_get_qualifier(trav))
|
||||
{
|
||||
case AB_TRAV_SALIENT:
|
||||
case AB_TRAV_SALIENT_CHILDREN:
|
||||
case AB_TRAV_SALIENT_UI:
|
||||
case AB_TRAV_SALIENT_UI_CHILDREN:
|
||||
child= travP_obj_salient_first_child(obj, trav);
|
||||
break;
|
||||
|
||||
default:
|
||||
child= obj->first_child;
|
||||
break;
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
travP_obj_next_sibling(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj sib= NULL;
|
||||
|
||||
switch (travP_get_qualifier(trav))
|
||||
{
|
||||
case AB_TRAV_SALIENT:
|
||||
case AB_TRAV_SALIENT_CHILDREN:
|
||||
case AB_TRAV_SALIENT_UI:
|
||||
case AB_TRAV_SALIENT_UI_CHILDREN:
|
||||
sib= travP_obj_salient_next_sibling(obj, trav);
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* Don't go past the root node.
|
||||
*/
|
||||
if (obj != trav->rootObj)
|
||||
{
|
||||
sib= obj->next_sibling;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return sib;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
travP_obj_prev_sibling(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj sib= NULL;
|
||||
|
||||
switch (travP_get_qualifier(trav))
|
||||
{
|
||||
case AB_TRAV_SALIENT:
|
||||
case AB_TRAV_SALIENT_CHILDREN:
|
||||
case AB_TRAV_SALIENT_UI:
|
||||
case AB_TRAV_SALIENT_UI_CHILDREN:
|
||||
sib= travP_obj_salient_prev_sibling(obj, trav);
|
||||
break;
|
||||
|
||||
default:
|
||||
sib= obj->prev_sibling;
|
||||
break;
|
||||
}
|
||||
|
||||
return sib;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** SALIENTS **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
static ABObj
|
||||
travP_obj_salient_parent(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj parent= obj;
|
||||
|
||||
if (parent->part_of != NULL)
|
||||
{
|
||||
parent= parent->part_of;
|
||||
}
|
||||
parent= parent->parent;
|
||||
if ((parent != NULL) && (parent->part_of != NULL))
|
||||
{
|
||||
parent= parent->part_of;
|
||||
}
|
||||
|
||||
/*
|
||||
* Be sure to stay inside traversal bounds
|
||||
*/
|
||||
if (parent != NULL)
|
||||
{
|
||||
ABObj ancestor= NULL;
|
||||
for (ancestor= obj->parent;
|
||||
(ancestor != NULL) && (ancestor != parent);
|
||||
ancestor= ancestor->parent)
|
||||
{
|
||||
if (ancestor == trav->rootObj)
|
||||
{
|
||||
/* parent is above the traversal root. */
|
||||
parent= NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
static ABObj
|
||||
travP_obj_salient_first_child(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj child= NULL;
|
||||
trav= trav;
|
||||
|
||||
if (obj_is_sub(obj) || obj_is_root(obj))
|
||||
{
|
||||
child= find_first_non_subobj_child(obj, obj_get_root(obj));
|
||||
}
|
||||
else
|
||||
{
|
||||
child= obj->first_child;
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to find the leftmost child that is not part of this
|
||||
* composite object.
|
||||
*/
|
||||
static ABObj
|
||||
find_first_non_subobj_child(ABObj obj, ABObj compRoot)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj child= NULL;
|
||||
|
||||
/*
|
||||
* Mondo recursion!! - we're going to recurse back into ourselves,
|
||||
* as well as call trav_ functions. Can you say "no global variables?"
|
||||
*
|
||||
* Thought you could. :-)
|
||||
*/
|
||||
for (trav_open(&trav, obj, AB_TRAV_CHILDREN);
|
||||
(child= trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if (obj_get_root(child) != compRoot)
|
||||
{
|
||||
/*
|
||||
* This is the object we want!!
|
||||
*/
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this child is still part of the composite. */
|
||||
/* look at its children */
|
||||
child= find_first_non_subobj_child(child, compRoot);
|
||||
if (child != NULL)
|
||||
{
|
||||
/*
|
||||
* found it!!
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
static ABObj
|
||||
travP_obj_salient_prev_sibling(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj curObj= NULL;
|
||||
ABObj compRoot= NULL;
|
||||
BOOL firstTime= TRUE;
|
||||
|
||||
curObj= obj;
|
||||
compRoot= obj_get_root(curObj->parent);
|
||||
while ( (curObj != NULL)
|
||||
&& ((!obj_is_salient(curObj)) || (firstTime)) )
|
||||
{
|
||||
firstTime= FALSE;
|
||||
if (obj_is_root(curObj))
|
||||
{
|
||||
if (curObj->prev_sibling != NULL)
|
||||
{
|
||||
curObj= curObj->prev_sibling;
|
||||
}
|
||||
else
|
||||
{
|
||||
curObj= find_ancestor_prev_sibling(curObj, compRoot);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (curObj->first_child != NULL)
|
||||
{
|
||||
curObj= curObj->first_child;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (curObj->prev_sibling != NULL)
|
||||
{
|
||||
curObj= curObj->prev_sibling;
|
||||
}
|
||||
else
|
||||
{
|
||||
curObj= find_ancestor_prev_sibling(curObj, compRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* while curObj */
|
||||
|
||||
return curObj;
|
||||
} /* travP_obj_salient_prev_sibling */
|
||||
|
||||
|
||||
static ABObj
|
||||
travP_obj_salient_next_sibling(ABObj obj, ABTraversal trav)
|
||||
{
|
||||
ABObj curObj= NULL;
|
||||
ABObj compRoot= NULL;
|
||||
BOOL firstTime= TRUE;
|
||||
ABObj searchTop = NULL;
|
||||
|
||||
curObj= obj;
|
||||
compRoot= obj_get_root(curObj->parent);
|
||||
|
||||
/*
|
||||
* Be sure we don't go above the traversal root.
|
||||
*/
|
||||
searchTop =
|
||||
(obj_is_descendant_of(trav->rootObj, compRoot)?
|
||||
trav->rootObj /* compRoot is above traversal root */
|
||||
:
|
||||
compRoot);
|
||||
|
||||
while ( (curObj != NULL)
|
||||
&& ((!obj_is_salient(curObj)) || (firstTime)) )
|
||||
{
|
||||
firstTime= FALSE;
|
||||
|
||||
/* don't go past traversal root */
|
||||
if (curObj == trav->rootObj)
|
||||
{
|
||||
curObj = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (obj_is_root(curObj))
|
||||
{
|
||||
if (curObj->next_sibling != NULL)
|
||||
{
|
||||
curObj= curObj->next_sibling;
|
||||
}
|
||||
else
|
||||
{
|
||||
curObj= find_ancestor_next_sibling(curObj, searchTop);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (curObj->first_child != NULL)
|
||||
{
|
||||
curObj= curObj->first_child;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (curObj->next_sibling != NULL)
|
||||
{
|
||||
curObj= curObj->next_sibling;
|
||||
}
|
||||
else
|
||||
{
|
||||
curObj= find_ancestor_next_sibling(curObj, searchTop);
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* while curObj */
|
||||
|
||||
return curObj;
|
||||
} /* travP_obj_salient_next_sibling */
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** GENERAL UTITILITY FUNCTIONS **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Finds the first ancestor with a sibling to its left (prev_sibling).
|
||||
* Returns the sibling.
|
||||
*/
|
||||
static ABObj
|
||||
find_ancestor_prev_sibling(ABObj obj, ABObj searchRoot)
|
||||
{
|
||||
ABObj newObj= NULL;
|
||||
ABObj ancestor= NULL;
|
||||
|
||||
for (ancestor= obj->parent;
|
||||
(ancestor != NULL) && (ancestor != searchRoot);
|
||||
ancestor= ancestor->parent)
|
||||
{
|
||||
if (ancestor->prev_sibling != NULL)
|
||||
{
|
||||
newObj= ancestor->prev_sibling;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Finds the first ancestor with a sibling to its right (next_sibling).
|
||||
* Returns the sibling.
|
||||
*/
|
||||
static ABObj
|
||||
find_ancestor_next_sibling(ABObj obj, ABObj searchRoot)
|
||||
{
|
||||
ABObj newObj= NULL;
|
||||
ABObj ancestor;
|
||||
|
||||
for (ancestor= obj->parent;
|
||||
(ancestor != NULL) && (ancestor != searchRoot);
|
||||
ancestor= ancestor->parent)
|
||||
{
|
||||
if (ancestor->next_sibling != NULL)
|
||||
{
|
||||
newObj= ancestor->next_sibling;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
88
cde/programs/dtappbuilder/src/libABobj/travP.h
Normal file
88
cde/programs/dtappbuilder/src/libABobj/travP.h
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: travP.h /main/3 1995/11/06 18:42:14 rswiston $
|
||||
*
|
||||
* @(#)travP.h 1.9 27 Apr 1994
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* TraversalP.h - private functions to be used by Traversal.c ONLY!
|
||||
*/
|
||||
#ifndef _ABOBJ_TRAVERSALP_H_
|
||||
#define _ABOBJ_TRAVERSALP_H_
|
||||
|
||||
#include <ab_private/trav.h>
|
||||
|
||||
#define TRAV_TYPE_MASK ((unsigned)0xff)
|
||||
#define TRAV_MODIFIER_MASK ((unsigned)(~(TRAV_TYPE_MASK)))
|
||||
|
||||
#define travP_get_qualifier(trav) \
|
||||
((unsigned)((trav)->travType & TRAV_TYPE_MASK))
|
||||
|
||||
#define travP_is_safe(trav) ((((trav)->travType) & AB_TRAV_MOD_SAFE) != 0)
|
||||
|
||||
#define travP_is_parents_first(trav) \
|
||||
((((trav)->travType) & AB_TRAV_MOD_PARENTS_FIRST) != 0)
|
||||
|
||||
#define travP_clean(trav) \
|
||||
((trav)->travType= 0, \
|
||||
(trav)->rootObj= NULL, \
|
||||
(trav)->curObj= NULL, \
|
||||
(trav)->objArray= NULL, \
|
||||
(trav)->objArraySize= 0, \
|
||||
(trav)->objArrayIndex= -1, \
|
||||
(trav)->done= FALSE, \
|
||||
(trav)->testFunc= NULL \
|
||||
)
|
||||
|
||||
/*
|
||||
* "Normal" traversals
|
||||
*/
|
||||
int travP_open(
|
||||
ABTraversal trav,
|
||||
ABObj root,
|
||||
unsigned travType,
|
||||
ABObjTestFunc test_func
|
||||
);
|
||||
int travP_close(ABTraversal trav);
|
||||
ABObj travP_next(ABTraversal trav);
|
||||
int travP_reset(ABTraversal trav);
|
||||
ABObj travP_goto(ABTraversal trav, int nodeNum);
|
||||
|
||||
/*
|
||||
* Safe traversals
|
||||
*/
|
||||
int travP_open_safe(
|
||||
ABTraversal trav,
|
||||
ABObj root,
|
||||
unsigned travType,
|
||||
ABObjTestFunc testFunc
|
||||
);
|
||||
int travP_close_safe(ABTraversal trav);
|
||||
ABObj travP_next_safe(ABTraversal trav);
|
||||
int travP_reset_safe(ABTraversal trav);
|
||||
ABObj travP_goto_safe(ABTraversal trav, int nodeNum);
|
||||
|
||||
/*
|
||||
* Utility functions
|
||||
*/
|
||||
ABObj travP_obj_parent(ABObj obj, ABTraversal trav);
|
||||
ABObj travP_obj_first_child(ABObj obj, ABTraversal trav);
|
||||
ABObj travP_obj_next_sibling(ABObj obj, ABTraversal trav);
|
||||
ABObj travP_obj_prev_sibling(ABObj obj, ABTraversal trav);
|
||||
|
||||
#endif /* _ABOBJ_TRAVERSALP_H_ */
|
||||
|
||||
186
cde/programs/dtappbuilder/src/libABobj/trav_public.c
Normal file
186
cde/programs/dtappbuilder/src/libABobj/trav_public.c
Normal file
@@ -0,0 +1,186 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: trav_public.c /main/3 1995/11/06 18:42:28 rswiston $
|
||||
*
|
||||
* @(#)trav_public.c 1.7 27 Apr 1994
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* trav_public.c - contains all public traversal functions
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ab_private/trav.h>
|
||||
#include "travP.h"
|
||||
|
||||
int
|
||||
trav_open_cond(
|
||||
ABTraversal trav,
|
||||
ABObj root,
|
||||
unsigned travType,
|
||||
ABObjTestFunc testFunc
|
||||
)
|
||||
{
|
||||
int iRet= 0;
|
||||
|
||||
if ((travType & AB_TRAV_MOD_SAFE) != 0)
|
||||
{
|
||||
iRet= travP_open_safe(trav, root, travType, testFunc);
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet= travP_open(trav, root, travType, testFunc);
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
trav_open(
|
||||
ABTraversal trav,
|
||||
ABObj root,
|
||||
unsigned travType
|
||||
)
|
||||
{
|
||||
return trav_open_cond(trav, root, travType, NULL);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
trav_close(ABTraversal trav)
|
||||
{
|
||||
int iRet= 0;
|
||||
|
||||
if (travP_is_safe(trav))
|
||||
{
|
||||
iRet= travP_close_safe(trav);
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet= travP_close(trav);
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ABObj
|
||||
trav_next(ABTraversal trav)
|
||||
{
|
||||
ABObj obj= NULL;
|
||||
if (travP_is_safe(trav))
|
||||
{
|
||||
obj= travP_next_safe(trav);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj= travP_next(trav);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
trav_reset(ABTraversal trav)
|
||||
{
|
||||
int iRet= 0;
|
||||
if (travP_is_safe(trav))
|
||||
{
|
||||
iRet= travP_reset_safe(trav);
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet= travP_reset(trav);
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
trav_goto(ABTraversal trav, int nodeNum)
|
||||
{
|
||||
ABObj obj= NULL;
|
||||
if (travP_is_safe(trav))
|
||||
{
|
||||
obj= travP_goto_safe(trav, nodeNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj= travP_goto(trav, nodeNum);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Performs the traversal, calling clientfunc on each node. A negative
|
||||
* return from clientfunc aborts the traversal.
|
||||
*
|
||||
* returns the number of nodes visited.
|
||||
*/
|
||||
int
|
||||
trav_perform(ABObj root, int trav_type, ABTraversalCB clientfunc)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj obj;
|
||||
int retval= 0;
|
||||
|
||||
for (trav_open(&trav, root, trav_type);
|
||||
(obj= trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if ((retval= clientfunc(obj)) < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the # of nodes that will be returned by the traversal
|
||||
*/
|
||||
int
|
||||
trav_count_cond(ABObj root, int trav_type, ABObjTestFunc testFunc)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj obj= NULL;
|
||||
int objCount= 0;
|
||||
|
||||
for (trav_open_cond(&trav, root, trav_type, testFunc);
|
||||
(obj= trav_next(&trav)) != NULL; )
|
||||
{
|
||||
++objCount;
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
return objCount;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
trav_count(ABObj root, int trav_type)
|
||||
{
|
||||
return trav_count_cond(root, trav_type, NULL);
|
||||
}
|
||||
|
||||
|
||||
157
cde/programs/dtappbuilder/src/libABobj/trav_safe.c
Normal file
157
cde/programs/dtappbuilder/src/libABobj/trav_safe.c
Normal file
@@ -0,0 +1,157 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: trav_safe.c /main/3 1995/11/06 18:42:43 rswiston $
|
||||
*
|
||||
* @(#)trav_safe.c 1.12 27 Apr 1994
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* trav_safe.c - contains functions for "safe" traversals (see
|
||||
* Traversal.h for more info).
|
||||
*
|
||||
* Safe traversals allow the tree to be modified during the traversals
|
||||
* To accomplish this, when the traversal is opened, all the objects
|
||||
* selected by the traversal are stored into a dynamic array and returned
|
||||
* from the array.
|
||||
*
|
||||
* This implementation is done such that the safe traversals are layered
|
||||
* on top of the normal traversals. There is no code in the normal
|
||||
* traversal code that knows anything about safe traversals - they are
|
||||
* implemented completely in this file.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ab_private/trav.h>
|
||||
#include "travP.h"
|
||||
|
||||
int
|
||||
travP_open_safe(
|
||||
ABTraversal trav,
|
||||
ABObj root,
|
||||
unsigned travType,
|
||||
ABObjTestFunc testFunc
|
||||
)
|
||||
{
|
||||
int iRet= 0;
|
||||
unsigned unsafeTravType= travType & ~AB_TRAV_MOD_SAFE;
|
||||
ABObj *objArray= NULL;
|
||||
int objArraySize= 0;
|
||||
int objIndex= 0;
|
||||
ABObj obj= NULL;
|
||||
|
||||
/* if we use safe, we will end up back here! */
|
||||
objArraySize= trav_count_cond(root, unsafeTravType, testFunc);
|
||||
if (objArraySize > 0)
|
||||
{
|
||||
objArray= (ABObj *)util_malloc(objArraySize * sizeof(ABObj*));
|
||||
if (objArray == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* travP_open will set the data correctly */
|
||||
for (objIndex= 0, travP_open(trav, root, travType, testFunc);
|
||||
(obj= travP_next(trav)) != NULL; ++objIndex)
|
||||
{
|
||||
if (objIndex >= objArraySize)
|
||||
{
|
||||
iRet= -1;
|
||||
break;
|
||||
}
|
||||
objArray[objIndex]= obj;
|
||||
}
|
||||
/* don't call travP_close(trav) - keep the traversal open */
|
||||
if (iRet < 0)
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
trav->objArraySize= objArraySize;
|
||||
trav->objArray= objArray;
|
||||
iRet= travP_reset_safe(trav);
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
travP_close_safe(ABTraversal trav)
|
||||
{
|
||||
travP_close(trav);
|
||||
util_free(trav->objArray);
|
||||
trav->objArrayIndex= 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
travP_next_safe(ABTraversal trav)
|
||||
{
|
||||
if (trav->done)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
++(trav->objArrayIndex);
|
||||
if ((trav->objArrayIndex) >= (trav->objArraySize))
|
||||
{
|
||||
trav->curObj= NULL;
|
||||
trav->done= TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
trav->curObj= trav->objArray[trav->objArrayIndex];
|
||||
}
|
||||
|
||||
return trav->curObj;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
travP_reset_safe(ABTraversal trav)
|
||||
{
|
||||
trav->done= FALSE;
|
||||
trav->curObj= NULL;
|
||||
trav->objArrayIndex= -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ABObj
|
||||
travP_goto_safe(ABTraversal trav, int nodeNum)
|
||||
{
|
||||
if ((nodeNum < -1) || (nodeNum >= (trav->objArraySize)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else if (nodeNum == -1)
|
||||
{
|
||||
travP_reset_safe(trav);
|
||||
}
|
||||
else
|
||||
{
|
||||
trav->objArrayIndex= nodeNum;
|
||||
trav->curObj= trav->objArray[trav->objArrayIndex];
|
||||
}
|
||||
|
||||
return trav->curObj;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user