2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*** DTB_USER_CODE_START vvv Add file header below vvv ***/
25 * $XConsortium: attch_ed_stubs.c /main/7 1996/10/24 18:00:09 mustafa $
27 * @(#)attch_ed_stubs.c 1.32 27 Apr 1995 cde_app_builder/src/ab
29 * RESTRICTED CONFIDENTIAL INFORMATION:
31 * The information in this document is subject to special
32 * restrictions in a confidential disclosure agreement between
33 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
34 * document outside HP, IBM, Sun, USL, SCO, or Univel without
35 * Sun's specific written approval. This document and all copies
36 * and derivative works thereof must be returned or destroyed at
39 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
43 /*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
46 * File: attch_ed_stubs.c
47 * Contains: Module callbacks and connection functions
49 * This file was generated by dtcodegen, from module attch_ed
51 * Any text may be added between the DTB_USER_CODE_START and
52 * DTB_USER_CODE_END comments (even non-C code). Descriptive comments
53 * are provided only as an aid.
55 * ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
56 * ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
57 * ** DELETE THE GENERATED COMMENTS! **
62 #include "dtb_utils.h"
63 #include "dtbuilder.h"
64 #include "attch_ed_ui.h"
67 /**************************************************************************
68 *** DTB_USER_CODE_START
70 *** All necessary header files have been included.
72 *** Add include files, types, macros, externs, and user functions here.
77 #include <Xm/RowColumn.h>
80 #include <Xm/Separator.h>
81 #include <ab_private/ab.h>
82 #include <ab_private/trav.h>
83 #include <ab_private/abobj_set.h>
84 #include <ab_private/abobj_list.h>
85 #include <ab_private/obj_notify.h>
86 #include <ab_private/pal.h>
87 #include <ab_private/prop.h>
88 #include <ab_private/proj.h>
89 #include <ab_private/attch_ed.h>
90 #include <ab_private/ui_util.h>
91 #include <ab_private/abobj_list.h>
92 #include "dtb_utils.h"
93 #include "dtbuilder.h"
94 #include "attch_ed_ui.h"
96 typedef struct ATTCH_ED_OBJ_TYPE_INFO_REC {
99 } AttchEdObjTypeInfoRec;
101 static AttchEdObjTypeInfoRec AttchEdObjTypeInfo;
105 * Declarations of global widgets used by callbacks.
108 * End declarations of global widgets
111 static Widget attch_editor_props_init(
112 DtbAttchEdAttchEdDialogInfo attch_ed_cgen,
116 static int attch_editor_load(
120 static int attch_editor_apply(
124 static BOOL attch_edP_pending(
127 static int attch_editor_activate(
131 static BOOL editable_obj_test(
132 PalEditableObjInfo *ed_obj_info
135 static void load_attch_obj(
140 static void create_children_list(
144 static void update_attch_obj_parent(
148 static void update_obj_type(
152 static void update_objlist(
156 static void create_obj_menu_dir(
161 static void create_obj_menu(
165 static void delete_from_obj_menu(
170 static void select_objlist(
174 static void turnoff_changebars(
177 static void get_attach_info(
179 ABAttachment *attachment,
180 ATTCH_ED_ATTACH_TYPE *type,
186 static void set_attach_info(
188 ABAttachment *attachment,
189 ATTCH_ED_ATTACH_TYPE type,
195 static void attch_ed_select_itemCB(
197 XtPointer client_data,
201 static void populate_obj_menu(
204 AB_COMPASS_POINT dir,
206 XtPointer **item_val,
210 static void attch_change_objecttypePalCB(
212 XtPointer client_data,
216 static BOOL attch_objlist_test_func(
220 static BOOL attch_childrenlist_test_func(
224 static void attch_objlist_selectCB(
226 XtPointer client_data,
227 XmListCallbackStruct *listdata
230 static int attch_obj_geom_changedCB(
231 ObjEvAttChangeInfo evInfo
234 static int attch_obj_renameCB(
235 ObjEvAttChangeInfo evInfo
238 static int attch_obj_destroyCB(
239 ObjEvDestroyInfo evInfo
242 static int attch_obj_reparentCB(
243 ObjEvReparentInfo info
246 static void handle_prop_sheet_obj_destroy(
247 ObjEvDestroyInfo evInfo
250 static void handle_actual_obj_destroy(
251 ObjEvDestroyInfo evInfo
254 static void handle_prop_sheet_obj_reparent(
255 ObjEvReparentInfo evInfo
258 static void handle_actual_obj_reparent(
259 ObjEvReparentInfo evInfo
262 static void set_widget_state(
263 ATTCH_ED_ATTACH_TYPE attach_type,
269 static void enable_attach_types(
273 static void set_attach_values(
274 ATTCH_ED_ATTACH_TYPE attach_type,
275 PropFieldSetting offset_setting,
276 PropFieldSetting position_setting,
277 PropOptionsSetting objlist_setting,
283 static void change_attach_type(
285 AB_COMPASS_POINT dir,
286 ATTCH_ED_ATTACH_TYPE attach_type
289 static void change_opp_attach_type(
291 AB_COMPASS_POINT dir,
292 ATTCH_ED_ATTACH_TYPE attach_type
295 static void get_attach_values(
296 ATTCH_ED_ATTACH_TYPE attach_type,
297 PropFieldSetting offset_setting,
298 PropFieldSetting position_setting,
299 PropOptionsSetting objlist_setting,
302 XtPointer *objlist_value
305 static void convert_offset_position(
308 AB_COMPASS_POINT dir,
309 ATTCH_ED_ATTACH_TYPE attach_type,
314 static void attach_obj_changed(
316 XtPointer client_data,
320 static void print_attach_type(
321 ATTCH_ED_ATTACH_TYPE attach_type
324 static BOOL attch_ed_obj_is_target_type(
328 static void attch_ed_change_objecttype(
333 static ABObj attch_ed_get_parent(
337 static void attch_ed_view_child_attachments(
340 static void attch_ed_view_parent_attachments(
343 static void attch_ed_activate_parent_child_button(
346 static void attch_edP_prevent_closeCB(
348 XtPointer client_data,
352 static void change_attype_from_sib_to_point(
355 AB_COMPASS_POINT dir,
359 static DTB_MODAL_ANSWER get_wrn_response(
361 ATTCH_ED_WRN_TYPE wrn_type,
365 static BOOL attch_ed_verify_props(
368 static BOOL verify_one_attach(
369 ATTCH_ED_ATTACH_TYPE attach_type,
370 PropFieldSetting offset_setting,
371 PropFieldSetting position_setting
374 static ABObj attch_cur_parent = NULL;
375 static AB_OBJECT_TYPE cur_type = AB_TYPE_UNDEF;
376 static int cur_subtype;
379 AttchEditorSettingsRec attch_editor_settings_rec;
382 * Declarations of global widgets used by callbacks.
385 * End declarations of global widgets
395 if (!obj || !(obj_has_flag(obj, XmConfiguredFlag)))
398 if (!(tmp = obj_get_parent(obj)))
403 return(objxm_comp_get_subobj(tmp, AB_CFG_PARENT_OBJ));
411 obj_add_destroy_callback(attch_obj_destroyCB, "ATTCH_ED");
412 obj_add_reparent_callback(attch_obj_reparentCB, "ATTCH_ED");
416 attch_ed_show_dialog(
423 ab_set_busy_cursor(TRUE);
426 * If there is no Attachment Editor, create it
428 if (AB_attch_ed_dialog == (Widget)NULL)
430 AB_attch_ed_dialog = attch_editor_props_init(&dtb_attch_ed_attch_ed_dialog,
434 if (AB_attch_ed_dialog != NULL)
436 DTB_MODAL_ANSWER answer = DTB_ANSWER_ACTION1;
437 PalEditableObjInfo *ed_obj_info;
439 /* Check to make sure cur_obj is an object that can be edited
440 * by the Attachments editor...
444 if (ed_obj_info = pal_get_editable_obj_info(cur_obj))
446 if (!editable_obj_test(ed_obj_info))
447 cur_obj = NULL; /* can't edit current obj */
453 if (cur_obj && attch_edP_pending())
455 answer = get_wrn_response(AB_attch_ed_dialog, ATTCH_ED_WRN_LOAD,
459 if (answer == DTB_ANSWER_ACTION1)
462 attch_editor_load(cur_obj);
464 else if (AttchEdObjTypeInfo.type == AB_TYPE_UNDEF)
465 /* First time - start with First object type in menu */
466 attch_ed_change_objecttype(AB_TYPE_BUTTON, AB_NO_SUBTYPE);
468 ab_show_window(AB_attch_ed_dialog);
475 ab_set_busy_cursor(FALSE);
481 PalEditableObjInfo *ed_obj_info
486 switch(ed_obj_info->type)
488 case AB_TYPE_BASE_WINDOW:
490 case AB_TYPE_FILE_CHOOSER:
493 case AB_TYPE_MESSAGE:
494 case AB_TYPE_PROJECT:
497 case AB_TYPE_CONTAINER:
498 if (ed_obj_info->subtype == AB_CONT_MENU_BAR)
507 attch_editor_props_init(
508 DtbAttchEdAttchEdDialogInfo attch_ed_cgen,
512 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
513 Widget item[20], ret_value;
514 XtArgVal item_val[20];
518 * Create Dialog widgets...
520 dtbAttchEdAttchEdDialogInfo_clear(attch_ed_cgen);
522 if (dtb_attch_ed_attch_ed_dialog_initialize(attch_ed_cgen, parent) == 0)
525 * Setup object type menu
531 XtDestroyWidget(attch_ed_cgen->obj_type_opmenu_items.Button_item);
534 * Add choice items for every palette object type
536 pal_add_editable_obj_menu_items(attch_ed_cgen->obj_type_opmenu_menu,
537 attch_change_objecttypePalCB, editable_obj_test);
539 AttchEdObjTypeInfo.type = AB_TYPE_UNDEF;
540 AttchEdObjTypeInfo.subtype = AB_NO_SUBTYPE;
543 XtAddCallback(attch_ed_cgen->objlist, XmNbrowseSelectionCallback,
544 (XtCallbackProc)attch_objlist_selectCB, (XtPointer)NULL);
547 * Hook widgets up to Attachment Editor
550 ats->prop_sheet = attch_ed_cgen->attachments_panel;
552 ats->prop_sheet = attch_ed_cgen->attach_grp;
554 ats->cur_object = (ABObj)NULL;
556 /**********************
558 **********************/
560 * Attachment type option menu
563 item[n] = attch_ed_cgen->top_attach_items.bitmaps_attach_top_form_xbm_item;
564 item_val[n] = ATTCH_ED_PARENT; n++;
565 item[n] = attch_ed_cgen->top_attach_items.bitmaps_attach_top_opposite_form_xbm_item;
566 item_val[n] = ATTCH_ED_OPPOSITE_PARENT; n++;
567 item[n] = attch_ed_cgen->top_attach_items.bitmaps_attach_top_widget_xbm_item;
568 item_val[n] = ATTCH_ED_SIBLING; n++;
569 item[n] = attch_ed_cgen->top_attach_items.bitmaps_attach_top_opposite_widget_xbm_item;
570 item_val[n] = ATTCH_ED_OPPOSITE_SIBLING; n++;
571 item[n] = attch_ed_cgen->top_attach_items.bitmaps_attach_top_position_xbm_item;
572 item_val[n] = ATTCH_ED_GRIDLINE; n++;
574 item[n] = attch_ed_cgen->top_attach_items.bitmaps_attach_top_center_position_xbm_item;
575 item_val[n] = ATTCH_ED_CENTER_GRIDLINE; n++;
577 item[n] = attch_ed_cgen->top_attach_items.bitmaps_attach_none_xbm_item;
578 item_val[n] = ATTCH_ED_NONE; n++;
579 prop_options_init(&(ats->top_attach_type), NULL,
580 attch_ed_cgen->top_attach, attch_ed_cgen->top_attach_menu,
581 n, item, (XtPointer*)item_val,
582 attch_ed_cgen->top_attach_cb);
584 * Top offset text field
586 prop_field_init(&(ats->top_attach_offset), attch_ed_cgen->top_offset_label,
587 attch_ed_cgen->top_offset,
588 attch_ed_cgen->top_attach_cb);
591 * Top position text field
593 prop_field_init(&(ats->top_attach_position), attch_ed_cgen->top_position_label,
594 attch_ed_cgen->top_position,
595 attch_ed_cgen->top_attach_cb);
598 /**********************
599 * Bottom Attachments *
600 **********************/
602 item[n] = attch_ed_cgen->bottom_attach_items.bitmaps_attach_bottom_form_xbm_item;
603 item_val[n] = ATTCH_ED_PARENT; n++;
604 item[n] = attch_ed_cgen->bottom_attach_items.bitmaps_attach_bottom_opposite_form_xbm_item;
605 item_val[n] = ATTCH_ED_OPPOSITE_PARENT; n++;
606 item[n] = attch_ed_cgen->bottom_attach_items.bitmaps_attach_bottom_widget_xbm_item;
607 item_val[n] = ATTCH_ED_SIBLING; n++;
608 item[n] = attch_ed_cgen->bottom_attach_items.bitmaps_attach_bottom_opposite_widget_xbm_item;
609 item_val[n] = ATTCH_ED_OPPOSITE_SIBLING; n++;
610 item[n] = attch_ed_cgen->bottom_attach_items.bitmaps_attach_bottom_position_xbm_item;
611 item_val[n] = ATTCH_ED_GRIDLINE; n++;
613 item[n] = attch_ed_cgen->bottom_attach_items.bitmaps_attach_bottom_center_position_xbm_item;
614 item_val[n] = ATTCH_ED_CENTER_GRIDLINE; n++;
616 item[n] = attch_ed_cgen->bottom_attach_items.bitmaps_attach_none_xbm_item;
617 item_val[n] = ATTCH_ED_NONE; n++;
618 prop_options_init(&(ats->bottom_attach_type), NULL,
619 attch_ed_cgen->bottom_attach, attch_ed_cgen->bottom_attach_menu,
620 n, item, (XtPointer*)item_val,
621 attch_ed_cgen->bottom_attach_cb);
624 * Bottom offset text field
626 prop_field_init(&(ats->bottom_attach_offset), attch_ed_cgen->bottom_offset_label,
627 attch_ed_cgen->bottom_offset,
628 attch_ed_cgen->bottom_attach_cb);
631 * Bottom position text field
633 prop_field_init(&(ats->bottom_attach_position), attch_ed_cgen->bottom_position_label,
634 attch_ed_cgen->bottom_position,
635 attch_ed_cgen->bottom_attach_cb);
639 /**********************
641 **********************/
643 item[n] = attch_ed_cgen->left_attach_items.bitmaps_attach_left_form_xbm_item;
644 item_val[n] = ATTCH_ED_PARENT; n++;
645 item[n] = attch_ed_cgen->left_attach_items.bitmaps_attach_left_opposite_form_xbm_item;
646 item_val[n] = ATTCH_ED_OPPOSITE_PARENT; n++;
647 item[n] = attch_ed_cgen->left_attach_items.bitmaps_attach_left_widget_xbm_item;
648 item_val[n] = ATTCH_ED_SIBLING; n++;
649 item[n] = attch_ed_cgen->left_attach_items.bitmaps_attach_left_opposite_widget_xbm_item;
650 item_val[n] = ATTCH_ED_OPPOSITE_SIBLING; n++;
651 item[n] = attch_ed_cgen->left_attach_items.bitmaps_attach_left_position_xbm_item;
652 item_val[n] = ATTCH_ED_GRIDLINE; n++;
653 item[n] = attch_ed_cgen->left_attach_items.bitmaps_attach_left_center_position_xbm_item;
654 item_val[n] = ATTCH_ED_CENTER_GRIDLINE; n++;
655 item[n] = attch_ed_cgen->left_attach_items.bitmaps_attach_none_xbm_item;
656 item_val[n] = ATTCH_ED_NONE; n++;
657 prop_options_init(&(ats->left_attach_type), NULL,
658 attch_ed_cgen->left_attach, attch_ed_cgen->left_attach_menu,
659 n, item, (XtPointer*)item_val,
660 attch_ed_cgen->left_attach_cb);
663 * Left offset text field
665 prop_field_init(&(ats->left_attach_offset), attch_ed_cgen->left_offset_label,
666 attch_ed_cgen->left_offset,
667 attch_ed_cgen->left_attach_cb);
671 * Left position text field
673 prop_field_init(&(ats->left_attach_position), attch_ed_cgen->left_position_label,
674 attch_ed_cgen->left_position,
675 attch_ed_cgen->left_attach_cb);
678 /**********************
679 * Right Attachments *
680 **********************/
682 item[n] = attch_ed_cgen->right_attach_items.bitmaps_attach_right_form_xbm_item;
683 item_val[n] = ATTCH_ED_PARENT; n++;
684 item[n] = attch_ed_cgen->right_attach_items.bitmaps_attach_right_opposite_form_xbm_item;
685 item_val[n] = ATTCH_ED_OPPOSITE_PARENT; n++;
686 item[n] = attch_ed_cgen->right_attach_items.bitmaps_attach_right_widget_xbm_item;
687 item_val[n] = ATTCH_ED_SIBLING; n++;
688 item[n] = attch_ed_cgen->right_attach_items.bitmaps_attach_right_opposite_widget_xbm_item;
689 item_val[n] = ATTCH_ED_OPPOSITE_SIBLING; n++;
690 item[n] = attch_ed_cgen->right_attach_items.bitmaps_attach_right_position_xbm_item;
691 item_val[n] = ATTCH_ED_GRIDLINE; n++;
692 item[n] = attch_ed_cgen->right_attach_items.bitmaps_attach_right_center_position_xbm_item;
693 item_val[n] = ATTCH_ED_CENTER_GRIDLINE; n++;
694 item[n] = attch_ed_cgen->right_attach_items.bitmaps_attach_none_xbm_item;
695 item_val[n] = ATTCH_ED_NONE; n++;
696 prop_options_init(&(ats->right_attach_type), NULL,
697 attch_ed_cgen->right_attach, attch_ed_cgen->right_attach_menu,
698 n, item, (XtPointer*)item_val,
699 attch_ed_cgen->left_attach_cb);
702 * Right offset text field
704 prop_field_init(&(ats->right_attach_offset), attch_ed_cgen->right_offset_label,
705 attch_ed_cgen->right_offset,
706 attch_ed_cgen->left_attach_cb);
709 * Right position text field
711 prop_field_init(&(ats->right_attach_position), attch_ed_cgen->right_position_label,
712 attch_ed_cgen->right_position,
713 attch_ed_cgen->left_attach_cb);
716 * Setup dialog to participate in dtbuilder window protocol
718 ab_register_window(attch_ed_cgen->attch_ed_dialog_shellform,
719 AB_WIN_DIALOG, WindowHidden, AB_toplevel, AB_WPOS_TILE_HORIZONTAL,
720 attch_edP_prevent_closeCB, NULL);
722 ret_value = dtb_attch_ed_attch_ed_dialog.attch_ed_dialog_shellform;
725 * Add callback to detect change in geometry
727 obj_add_geometry_change_callback(attch_obj_geom_changedCB, "ATTCH_ED");
729 obj_add_rename_callback(attch_obj_renameCB, "ATTCH_ED");
734 util_dprintf(3, "attch_editor_props_init: could not initialize Attachment Editor\n");
747 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
749 load_attch_obj(object, TRUE);
751 create_children_list(object);
752 update_attch_obj_parent(object);
753 update_obj_type(object);
754 update_objlist(object);
755 select_objlist(object);
766 DtbAttchEdAttchEdDialogInfo attch_ed_cgen = &dtb_attch_ed_attch_ed_dialog;
767 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
768 ABAttachment *top_attachment,
772 ATTCH_ED_ATTACH_TYPE top_attach_type = ATTCH_ED_NONE,
773 bottom_attach_type = ATTCH_ED_NONE,
774 left_attach_type = ATTCH_ED_NONE,
775 right_attach_type = ATTCH_ED_NONE;
787 ABObj top_obj = NULL,
796 if (!attch_ed_can_edit_attachments(object))
798 ats->cur_object = NULL;
799 attch_editor_activate(FALSE);
803 attch_editor_activate(TRUE);
806 * Get attachment info from ABObj
808 top_attachment = obj_get_attachment(object, AB_CP_NORTH);
809 bottom_attachment = obj_get_attachment(object, AB_CP_SOUTH);
810 left_attachment = obj_get_attachment(object, AB_CP_WEST);
811 right_attachment = obj_get_attachment(object, AB_CP_EAST);
814 * Get ATTCH_ED_ATTACH_TYPE, offset, position, attached object
816 get_attach_info(object, top_attachment,
817 &top_attach_type, &top_offset, &top_position, &top_obj);
818 get_attach_info(object, bottom_attachment,
819 &bottom_attach_type, &bottom_offset, &bottom_position, &bottom_obj);
820 get_attach_info(object, right_attachment,
821 &right_attach_type, &right_offset, &right_position, &right_obj);
822 get_attach_info(object, left_attachment,
823 &left_attach_type, &left_offset, &left_position, &left_obj);
826 * (Re)Create option menu that lists which objects this
827 * object can attach to.
829 create_obj_menu(object);
832 * Set attachment types
834 prop_options_set_value(&(ats->top_attach_type), (XtPointer)top_attach_type, False);
835 prop_options_set_value(&(ats->bottom_attach_type), (XtPointer)bottom_attach_type, False);
836 prop_options_set_value(&(ats->right_attach_type), (XtPointer)right_attach_type, False);
837 prop_options_set_value(&(ats->left_attach_type), (XtPointer)left_attach_type, False);
839 enable_attach_types(object);
842 * Activate position/offset/objmenu depending on type of attachment
844 set_widget_state(left_attach_type,
845 attch_ed_cgen->left_attach_objmenu,
846 attch_ed_cgen->left_offset_rowcolumn,
847 attch_ed_cgen->left_position_rowcolumn);
849 set_widget_state(right_attach_type,
850 attch_ed_cgen->right_attach_objmenu,
851 attch_ed_cgen->right_offset_rowcolumn,
852 attch_ed_cgen->right_position_rowcolumn);
854 set_widget_state(top_attach_type,
855 attch_ed_cgen->top_attach_objmenu,
856 attch_ed_cgen->top_offset_rowcolumn,
857 attch_ed_cgen->top_position_rowcolumn);
859 set_widget_state(bottom_attach_type,
860 attch_ed_cgen->bottom_attach_objmenu,
861 attch_ed_cgen->bottom_offset_rowcolumn,
862 attch_ed_cgen->bottom_position_rowcolumn);
865 * Set values for position/offset/objmenu depending on type of attachment
866 * i.e. if attachment is of type ATTCH_ED_PARENT, don't set the position
869 set_attach_values(left_attach_type,
870 &(ats->left_attach_offset),
871 &(ats->left_attach_position),
872 &(ats->left_attach_obj),
877 set_attach_values(right_attach_type,
878 &(ats->right_attach_offset),
879 &(ats->right_attach_position),
880 &(ats->right_attach_obj),
885 set_attach_values(top_attach_type,
886 &(ats->top_attach_offset),
887 &(ats->top_attach_position),
888 &(ats->top_attach_obj),
893 set_attach_values(bottom_attach_type,
894 &(ats->bottom_attach_offset),
895 &(ats->bottom_attach_position),
896 &(ats->bottom_attach_obj),
904 ats->cur_object = object;
905 ui_set_label_string(attch_ed_cgen->obj_label, obj_get_name(object));
906 attch_ed_activate_parent_child_button();
909 turnoff_changebars();
913 * Update list containing siblings of object that is currently edited
916 create_children_list(
920 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
921 = &dtb_attch_ed_attch_ed_dialog;
922 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
934 parent = attch_ed_get_parent(obj);
940 * Populate siblings list
941 if ((!ats->cur_object) || (obj_get_parent(ats->cur_object) != parent))
946 * Get array of child objects on list widget
948 XtVaGetValues(attch_ed_cgen->childrenlist,
949 XmNuserData, &child_list,
953 * List of child objects:
955 * Nullify XmNuserData
959 util_free(child_list);
960 XtVaSetValues(attch_ed_cgen->childrenlist, XmNuserData, NULL, NULL);
966 child_count = trav_count(parent, AB_TRAV_SALIENT_CHILDREN);
969 * Delete all current items in list
971 XmListDeleteAllItems(attch_ed_cgen->childrenlist);
974 * Return if no children to insert in list
976 if (child_count <= 0)
980 * Alloc new array to store child objects. This will be stored
981 * as user data on the list.
983 child_list = (ABObj *)util_malloc(child_count*sizeof(ABObj));
986 * For all direct children of 'parent'.:
987 * add to XmList object
989 * remember position of 'object' in list
991 for (i = 1, trav_open(&trav, parent, AB_TRAV_SALIENT_CHILDREN);
992 (cur_child = trav_next(&trav)) != NULL; ++i)
994 if (cur_child == obj)
998 child_list[i-1] = cur_child;
999 ui_list_add_item(attch_ed_cgen->childrenlist, obj_get_name(cur_child), 0);
1003 * Make current object selected, and visible in list
1005 ui_list_select_pos(attch_ed_cgen->childrenlist, cur_position, False);
1008 * Store ABObj list on XmList object
1010 XtVaSetValues(attch_ed_cgen->childrenlist, XmNuserData, child_list, NULL);
1013 * Register callback on list that will load selected object
1015 XtAddCallback(attch_ed_cgen->childrenlist, XmNbrowseSelectionCallback,
1016 attch_ed_select_itemCB, (XtPointer)NULL);
1021 update_attch_obj_parent(
1025 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
1026 = &dtb_attch_ed_attch_ed_dialog;
1027 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
1033 parent = attch_ed_get_parent(obj);
1035 parent = obj_get_root(parent);
1038 * Set object parent's name
1041 ui_set_label_string(attch_ed_cgen->parent_obj_name,
1042 obj_get_name(parent));
1050 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
1051 = &dtb_attch_ed_attch_ed_dialog;
1052 PalEditableObjInfo *ed_obj_info;
1057 AttchEdObjTypeInfo.type = obj_get_type(obj);
1058 AttchEdObjTypeInfo.subtype = obj_get_subtype(obj);
1060 if ((ed_obj_info = pal_get_editable_obj_info(obj)) &&
1061 editable_obj_test(ed_obj_info))
1063 ui_optionmenu_change_label(attch_ed_cgen->obj_type_opmenu,
1064 istr_string(ed_obj_info->name));
1074 DtbAttchEdAttchEdDialogInfo attch_ed_cgen = &dtb_attch_ed_attch_ed_dialog;
1075 ABObj proj = proj_get_project();
1081 num_items = abobj_list_load(attch_ed_cgen->objlist,
1083 attch_objlist_test_func);
1091 DtbAttchEdAttchEdDialogInfo attch_ed_cgen = &dtb_attch_ed_attch_ed_dialog;
1092 char *modname = NULL;
1097 modname = abobj_get_moduled_name(obj);
1101 ui_list_select_item(attch_ed_cgen->objlist, modname, FALSE);
1111 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
1112 ABAttachment attachment;
1113 ATTCH_ED_ATTACH_TYPE attach_type = ATTCH_ED_NONE;
1121 if (!attch_ed_verify_props())
1127 if (prop_changed(ats->top_attach_type.changebar))
1130 (ATTCH_ED_ATTACH_TYPE)prop_options_get_value(&(ats->top_attach_type));
1132 get_attach_values(attach_type,
1133 &(ats->top_attach_offset),
1134 &(ats->top_attach_position),
1135 &(ats->top_attach_obj),
1136 &offset, &position, (XtPointer *)&obj);
1138 set_attach_info(object,
1139 &attachment, attach_type, offset, position, obj);
1141 abobj_set_attachment(object, AB_CP_NORTH, &attachment);
1147 if (prop_changed(ats->bottom_attach_type.changebar))
1149 attach_type = (ATTCH_ED_ATTACH_TYPE)prop_options_get_value(&(ats->bottom_attach_type));
1151 get_attach_values(attach_type,
1152 &(ats->bottom_attach_offset),
1153 &(ats->bottom_attach_position),
1154 &(ats->bottom_attach_obj),
1155 &offset, &position, (XtPointer *)&obj);
1157 set_attach_info(object,
1158 &attachment, attach_type, offset, position, obj);
1160 abobj_set_attachment(object, AB_CP_SOUTH, &attachment);
1166 if (prop_changed(ats->left_attach_type.changebar))
1168 attach_type = (ATTCH_ED_ATTACH_TYPE)prop_options_get_value(&(ats->left_attach_type));
1170 get_attach_values(attach_type,
1171 &(ats->left_attach_offset),
1172 &(ats->left_attach_position),
1173 &(ats->left_attach_obj),
1174 &offset, &position, (XtPointer *)&obj);
1176 set_attach_info(object,
1177 &attachment, attach_type, offset, position, obj);
1179 abobj_set_attachment(object, AB_CP_WEST, &attachment);
1183 * Right attachment - shares changebar with left attachment
1185 if (prop_changed(ats->left_attach_type.changebar))
1187 attach_type = (ATTCH_ED_ATTACH_TYPE)prop_options_get_value(&(ats->right_attach_type));
1189 get_attach_values(attach_type,
1190 &(ats->right_attach_offset),
1191 &(ats->right_attach_position),
1192 &(ats->right_attach_obj),
1193 &offset, &position, (XtPointer *)&obj);
1195 set_attach_info(object,
1196 &attachment, attach_type, offset, position, obj);
1198 abobj_set_attachment(object, AB_CP_EAST, &attachment);
1201 abobj_instantiate_changes(object);
1203 turnoff_changebars();
1213 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
1215 if (ats && ats->cur_object && prop_changebars_pending(ats->prop_sheet))
1222 attch_editor_activate(
1226 DtbAttchEdAttchEdDialogInfo attch_ed_cgen = &dtb_attch_ed_attch_ed_dialog;
1229 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
1230 ui_set_active(ats->prop_sheet, active);
1233 ui_set_active(attch_ed_cgen->attachments_panel, active);
1242 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
1244 prop_set_changebar(ats->top_attach_type.changebar, PROP_CB_OFF);
1245 prop_set_changebar(ats->bottom_attach_type.changebar, PROP_CB_OFF);
1246 prop_set_changebar(ats->left_attach_type.changebar, PROP_CB_OFF);
1248 prop_changebars_cleared(ats->prop_sheet);
1255 ABAttachment *attachment,
1256 ATTCH_ED_ATTACH_TYPE *type,
1263 if (!obj || !attachment)
1269 switch (attachment->type)
1271 case AB_ATTACH_POINT:
1272 *type = ATTCH_ED_PARENT;
1273 *offset = attachment->offset;
1277 *attach_obj = (ABObj)attachment->value;
1279 if (*attach_obj == attch_ed_get_parent(obj))
1280 *type = ATTCH_ED_PARENT;
1282 *type = ATTCH_ED_SIBLING;
1284 *offset = attachment->offset;
1288 case AB_ATTACH_ALIGN_OBJ_EDGE:
1289 *attach_obj = (ABObj)attachment->value;
1291 if (*attach_obj == attch_ed_get_parent(obj))
1292 *type = ATTCH_ED_OPPOSITE_PARENT;
1294 *type = ATTCH_ED_OPPOSITE_SIBLING;
1296 *offset = attachment->offset;
1300 case AB_ATTACH_GRIDLINE:
1301 *type = ATTCH_ED_GRIDLINE;
1302 *offset = attachment->offset;
1303 *position = (int)attachment->value;
1306 case AB_ATTACH_CENTER_GRIDLINE:
1307 *type = ATTCH_ED_CENTER_GRIDLINE;
1308 *position = (int)attachment->value;
1312 case AB_ATTACH_NONE:
1313 *type = ATTCH_ED_NONE;
1317 fprintf(stderr, "get_attach_info: attachment is unresolved\n");
1326 ABAttachment *attachment,
1327 ATTCH_ED_ATTACH_TYPE type,
1336 case ATTCH_ED_PARENT:
1338 attachment->value = (void *)attach_obj;
1339 attachment->value = (void *)attch_ed_get_parent(obj);
1341 attachment->type = AB_ATTACH_POINT;
1342 attachment->offset = offset;
1345 case ATTCH_ED_SIBLING:
1346 attachment->value = (void *)attach_obj;
1347 attachment->type = AB_ATTACH_OBJ;
1348 attachment->offset = offset;
1351 case ATTCH_ED_OPPOSITE_PARENT:
1352 attachment->value = (void *)attch_ed_get_parent(obj);
1353 attachment->type = AB_ATTACH_ALIGN_OBJ_EDGE;
1354 attachment->offset = offset;
1357 case ATTCH_ED_OPPOSITE_SIBLING:
1358 attachment->value = (void *)attach_obj;
1359 attachment->type = AB_ATTACH_ALIGN_OBJ_EDGE;
1360 attachment->offset = offset;
1363 case ATTCH_ED_GRIDLINE:
1364 attachment->type = AB_ATTACH_GRIDLINE;
1365 attachment->value = (void *)position;
1366 attachment->offset = offset;
1369 case ATTCH_ED_CENTER_GRIDLINE:
1370 attachment->type = AB_ATTACH_CENTER_GRIDLINE;
1371 attachment->value = (void *)position;
1372 attachment->offset = 0;
1377 attachment->type = AB_ATTACH_NONE;
1381 fprintf(stderr, "set_attach_info: attachment is unresolved\n");
1388 attch_ed_select_itemCB(
1390 XtPointer client_data,
1394 XmListCallbackStruct *listdata = (XmListCallbackStruct *)call_data;
1395 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
1396 ABObj *child_list = NULL,
1398 int num_items = 0, pos;
1400 XtVaGetValues(widget,
1401 XmNuserData, &child_list,
1402 XmNitemCount, &num_items,
1408 pos = ui_list_get_selected_pos(widget);
1410 new_obj = child_list[pos-1];
1412 if (new_obj != ats->cur_object)
1414 ABObj old_obj = ats->cur_object;
1415 DTB_MODAL_ANSWER answer = DTB_ANSWER_ACTION1;
1417 if (attch_edP_pending())
1419 answer = get_wrn_response(AB_attch_ed_dialog, ATTCH_ED_WRN_LOAD,
1422 if (answer == DTB_ANSWER_CANCEL)
1426 name = obj_get_name(old_obj);
1427 ui_list_select_item(widget, name, FALSE);
1431 if (answer != DTB_ANSWER_ACTION1)
1434 load_attch_obj(new_obj, TRUE);
1435 update_obj_type(new_obj);
1438 * Update object list
1439 * If type of object did not change just select new object in list
1440 * otherwise, reload the list
1443 (pal_get_item_info(old_obj) == pal_get_item_info(new_obj)))
1445 select_objlist(new_obj);
1449 update_objlist(new_obj);
1450 select_objlist(new_obj);
1458 * Updates the sibling option menu for all attachments of
1459 * 'object'. This is necessary only for attachments that
1460 * need 'which sibling?' info.
1467 ABAttachment *attachment;
1468 ATTCH_ED_ATTACH_TYPE attach_type = ATTCH_ED_NONE;
1476 attachment = obj_get_attachment(object, AB_CP_NORTH);
1477 get_attach_info(object, attachment,
1478 &attach_type, &offset, &position, &obj);
1479 if (attch_ed_need_obj_menu(attach_type))
1480 create_obj_menu_dir(object, AB_CP_NORTH);
1485 attachment = obj_get_attachment(object, AB_CP_SOUTH);
1486 get_attach_info(object, attachment,
1487 &attach_type, &offset, &position, &obj);
1488 if (attch_ed_need_obj_menu(attach_type))
1489 create_obj_menu_dir(object, AB_CP_SOUTH);
1494 attachment = obj_get_attachment(object, AB_CP_WEST);
1495 get_attach_info(object, attachment,
1496 &attach_type, &offset, &position, &obj);
1497 if (attch_ed_need_obj_menu(attach_type))
1498 create_obj_menu_dir(object, AB_CP_WEST);
1503 attachment = obj_get_attachment(object, AB_CP_EAST);
1504 get_attach_info(object, attachment,
1505 &attach_type, &offset, &position, &obj);
1506 if (attch_ed_need_obj_menu(attach_type))
1507 create_obj_menu_dir(object, AB_CP_EAST);
1512 * delete_from_obj_menu()
1513 * Deletes the passed object from the object menu setting on the
1517 delete_from_obj_menu(
1522 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
1523 ABAttachment *attachment;
1524 ATTCH_ED_ATTACH_TYPE attach_type = ATTCH_ED_NONE;
1529 if (!cur_obj || !deleted_obj)
1535 attachment = obj_get_attachment(cur_obj, AB_CP_NORTH);
1536 get_attach_info(cur_obj, attachment,
1537 &attach_type, &offset, &position, &obj);
1538 if (attch_ed_need_obj_menu(attach_type))
1539 prop_options_remove_value(&(ats->top_attach_obj),
1540 (XtPointer)deleted_obj, False);
1545 attachment = obj_get_attachment(cur_obj, AB_CP_SOUTH);
1546 get_attach_info(cur_obj, attachment,
1547 &attach_type, &offset, &position, &obj);
1548 if (attch_ed_need_obj_menu(attach_type))
1549 prop_options_remove_value(&(ats->bottom_attach_obj),
1550 (XtPointer)deleted_obj, False);
1555 attachment = obj_get_attachment(cur_obj, AB_CP_WEST);
1556 get_attach_info(cur_obj, attachment,
1557 &attach_type, &offset, &position, &obj);
1558 if (attch_ed_need_obj_menu(attach_type))
1559 prop_options_remove_value(&(ats->left_attach_obj),
1560 (XtPointer)deleted_obj, False);
1565 attachment = obj_get_attachment(cur_obj, AB_CP_EAST);
1566 get_attach_info(cur_obj, attachment,
1567 &attach_type, &offset, &position, &obj);
1568 if (attch_ed_need_obj_menu(attach_type))
1569 prop_options_remove_value(&(ats->right_attach_obj),
1570 (XtPointer)deleted_obj, False);
1574 * create_obj_menu_dir()
1575 * Updates the sibling option menu for one attachment of
1576 * 'object' as specified by 'dir'.
1577 * The option menu is also initialized to have the first
1578 * entry of the menu as it's initial value.
1581 create_obj_menu_dir(
1583 AB_COMPASS_POINT dir
1586 DtbAttchEdAttchEdDialogInfo attch_ed_cgen = &dtb_attch_ed_attch_ed_dialog;
1587 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
1588 PropOptionsSetting option_setting;
1589 Widget label = NULL,
1594 int item_values = NULL,
1599 * Return immediately if bad params
1605 * Depending on what direction, remember what widgets/settings
1611 option_setting = &(ats->top_attach_obj);
1612 optionbox = attch_ed_cgen->top_attach_objmenu;
1613 menu = attch_ed_cgen->top_attach_objmenu_menu;
1614 changebar = attch_ed_cgen->top_attach_cb;
1618 option_setting = &(ats->bottom_attach_obj);
1619 optionbox = attch_ed_cgen->bottom_attach_objmenu;
1620 menu = attch_ed_cgen->bottom_attach_objmenu_menu;
1621 changebar = attch_ed_cgen->bottom_attach_cb;
1625 option_setting = &(ats->left_attach_obj);
1626 optionbox = attch_ed_cgen->left_attach_objmenu;
1627 menu = attch_ed_cgen->left_attach_objmenu_menu;
1628 changebar = attch_ed_cgen->left_attach_cb;
1632 option_setting = &(ats->right_attach_obj);
1633 optionbox = attch_ed_cgen->right_attach_objmenu;
1634 menu = attch_ed_cgen->right_attach_objmenu_menu;
1635 /* right/left menus share changebars */
1636 changebar = attch_ed_cgen->left_attach_cb;
1641 * If widgets/prop setting is NULL, return immediately
1643 if (!option_setting || !optionbox || !menu || !changebar)
1646 populate_obj_menu(menu, object, dir, &item, (XtPointer **)&item_val, &n);
1647 prop_options_init(option_setting, NULL,
1650 n, item, (XtPointer*)item_val,
1654 * If there were items, set the value of the setting to be the
1658 prop_options_set_value(option_setting, (XtPointer)item_val[0], False);
1664 util_free(item_val);
1668 * populate_obj_menu()
1669 * Inserts/Modifies the children of 'widget' to contain items
1670 * that have, as labels, the names of the sibling objects of
1672 * The list of widget items is returned in 'ret_item'.
1673 * The list of ABObj pointers (siblings of 'object') is returned in
1675 * The number of items is returned in 'n'.
1676 * The lists returned are allocated in this function. It is up to
1677 * the caller to free them.
1683 AB_COMPASS_POINT dir,
1685 XtPointer **ret_item_val,
1692 Widget *item_list = NULL;
1693 WidgetList menu_children;
1694 XtPointer *item_val_list = NULL;
1699 static BOOL first_time = TRUE;
1701 if (!widget || !object)
1704 parent = attch_ed_get_parent(object);
1711 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
1712 = &dtb_attch_ed_attch_ed_dialog;
1715 * Set up callabcks for menu items created in _ui.c file
1717 XtAddCallback(attch_ed_cgen->left_attach_objmenu_items.Object1_item,
1718 XmNactivateCallback,
1719 attach_obj_changed, (XtPointer)AB_CP_WEST);
1721 XtAddCallback(attch_ed_cgen->right_attach_objmenu_items.Object1_item,
1722 XmNactivateCallback,
1723 attach_obj_changed, (XtPointer)AB_CP_EAST);
1725 XtAddCallback(attch_ed_cgen->top_attach_objmenu_items.Object1_item,
1726 XmNactivateCallback,
1727 attach_obj_changed, (XtPointer)AB_CP_NORTH);
1729 XtAddCallback(attch_ed_cgen->bottom_attach_objmenu_items.Object1_item,
1730 XmNactivateCallback,
1731 attach_obj_changed, (XtPointer)AB_CP_SOUTH);
1736 num_trav_children = trav_count(parent, AB_TRAV_SALIENT_CHILDREN);
1739 * The number of menu items we need is one less that the total child
1742 num_items_needed = (num_trav_children > 0)
1743 ? num_trav_children - 1
1747 * Allocate lists to store widget id's and ABObj pointers
1749 if (num_items_needed > 0)
1751 item_list = (Widget *)util_malloc(num_items_needed * sizeof(Widget));
1752 item_val_list = (XtPointer *)
1753 util_malloc(num_items_needed * sizeof(XtPointer));
1757 * Get current list of menu items
1759 XtVaGetValues(widget,
1760 XmNnumChildren, &num_menu_children,
1761 XmNchildren, &menu_children,
1764 if (num_items_needed > num_menu_children)
1767 * Create more menu items if needed
1769 for (i = num_menu_children; i < num_items_needed; ++i)
1773 menu_item = XtVaCreateWidget("attach_obj_menu",
1774 xmPushButtonWidgetClass,
1778 XtAddCallback(menu_item, XmNactivateCallback,
1779 attach_obj_changed, (XtPointer)dir);
1783 * Re-fetch list of menu items
1785 XtVaGetValues(widget,
1786 XmNnumChildren, &num_menu_children,
1787 XmNchildren, &menu_children,
1792 * Set the label of the menu items to be the names of the ABObj's
1794 for (i = 0, trav_open(&trav, parent, AB_TRAV_SALIENT_CHILDREN);
1795 i < num_items_needed, (cur_obj = trav_next(&trav)) != NULL; )
1800 * Skip the passed object.
1801 * We are only interested in the siblings of 'object'
1803 if (cur_obj == object)
1807 * Get label of ABObj
1809 label = obj_get_name(cur_obj);
1812 * Store the widget id of current menu item
1814 item_list[i] = menu_children[i];
1817 * If label exists, set it on the menu item
1820 XtVaSetValues(item_list[i],
1821 XtVaTypedArg, XmNlabelString, XtRString,
1822 label, strlen(label)+1,
1828 item_val_list[i] = (XtPointer)cur_obj;
1834 * Manage only the needed menu items; hide/unmanage the rest
1836 if (num_items_needed > 0)
1838 for (i = 0; i < num_items_needed; ++i)
1839 XtManageChild(menu_children[i]);
1841 for (i = num_items_needed; i < num_menu_children; ++i)
1842 XtUnmanageChild(menu_children[i]);
1847 * If no siblings, create/manage one item with "None" label.
1849 if (num_items_needed == 0)
1853 if (num_menu_children == 0)
1855 none_item = XtVaCreateWidget("attach_obj_menu",
1856 xmPushButtonWidgetClass,
1862 none_item = menu_children[0];
1865 XtVaSetValues(none_item,
1866 XtVaTypedArg, XmNlabelString, XtRString,
1867 "None", strlen("None")+1,
1871 XtManageChild(none_item);
1874 *ret_item = item_list;
1875 *ret_item_val = item_val_list;
1876 *n = num_items_needed;
1881 attch_objlist_test_func(
1888 if (!test_obj || !obj_is_defined(test_obj))
1891 module = obj_get_module(test_obj);
1893 if ((module != NULL) &&
1894 obj_is_salient_ui(test_obj) &&
1895 obj_has_flag(module, MappedFlag))
1897 b = attch_ed_obj_is_target_type(test_obj);
1904 attch_ed_obj_is_target_type(
1908 PalItemInfo *palitem;
1909 AB_OBJECT_TYPE type;
1915 type = obj_get_type(obj);
1916 subtype = obj_get_subtype(obj);
1918 palitem = pal_get_type_item_info(AttchEdObjTypeInfo.type,
1919 AttchEdObjTypeInfo.subtype);
1921 if (palitem && palitem->is_a_test)
1922 return ((*palitem->is_a_test)(obj));
1924 switch (AttchEdObjTypeInfo.type)
1927 case AB_TYPE_CONTAINER:
1928 if (type == AttchEdObjTypeInfo.type &&
1929 subtype == AttchEdObjTypeInfo.subtype)
1937 * Otherwise we only need to check object type, and in fact
1938 * don't want to check subtype because it might confuse things
1939 * (e.g. we're looking for any Button palette item, which
1940 * includes several subtypes of type AB_TYPE_BUTTON).
1942 if(type == AttchEdObjTypeInfo.type)
1950 /* Should never get here - every test above returns True or False */
1954 attch_childrenlist_test_func(
1958 if (!test_obj || !attch_cur_parent)
1961 if (attch_ed_get_parent(test_obj) == attch_cur_parent)
1968 * Callback: a new object type has been selected off object type menu
1969 * This is for 'regular' palette objects
1972 attch_change_objecttypePalCB(
1974 XtPointer client_data,
1978 PalEditableObjInfo *ed_obj_info = (PalEditableObjInfo*)client_data;
1980 attch_ed_change_objecttype(ed_obj_info->type, ed_obj_info->subtype);
1985 attch_ed_change_objecttype(
1986 AB_OBJECT_TYPE type,
1990 DtbAttchEdAttchEdDialogInfo attch_ed_cgen = &dtb_attch_ed_attch_ed_dialog;
1991 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
1992 ABObj proj = proj_get_project();
1994 char *modname = NULL;
1995 DTB_MODAL_ANSWER answer = DTB_ANSWER_ACTION1;
1997 if (!proj || !attch_ed_cgen->objlist)
2000 if (attch_edP_pending())
2002 answer = get_wrn_response(AB_attch_ed_dialog, ATTCH_ED_WRN_CHANGE_OBJTYPE,
2005 if (answer == DTB_ANSWER_CANCEL)
2006 update_obj_type(ats->cur_object);
2009 if (answer != DTB_ANSWER_ACTION1)
2013 * Reset current object
2015 ats->cur_object = NULL;
2017 AttchEdObjTypeInfo.type = type;
2018 AttchEdObjTypeInfo.subtype = subtype;
2020 num_items = abobj_list_load(attch_ed_cgen->objlist, proj, attch_objlist_test_func);
2023 * If number of items in object list is > 0,
2024 * make attachment editor active and edit the
2025 * first object in list the current one.
2026 * Otherwise, make editor inactive.
2030 attch_editor_activate(TRUE);
2031 ui_list_select_pos(attch_ed_cgen->objlist, 1, TRUE);
2035 attch_editor_activate(FALSE);
2040 attch_objlist_selectCB(
2042 XtPointer client_data,
2043 XmListCallbackStruct *listdata
2050 name = objxm_xmstr_to_str(listdata->item);
2053 abobj_moduled_name_extract(name, &module, &selected_obj);
2058 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
2059 DTB_MODAL_ANSWER answer = DTB_ANSWER_ACTION1;
2061 Widget parent_widget;
2062 char *name = obj_get_name(selected_obj);
2064 if (attch_edP_pending())
2066 answer = get_wrn_response(AB_attch_ed_dialog,
2067 ATTCH_ED_WRN_LOAD, selected_obj);
2069 if (answer == DTB_ANSWER_CANCEL)
2070 select_objlist(ats->cur_object);
2073 if (answer != DTB_ANSWER_ACTION1)
2077 * Load selected object
2079 load_attch_obj(selected_obj, TRUE);
2082 * If load succeeded, create new children list,
2083 * and update parent label
2084 if (ats->cur_object) {
2086 create_children_list(selected_obj);
2087 update_attch_obj_parent(selected_obj);
2096 attch_obj_geom_changedCB(
2097 ObjEvAttChangeInfo evInfo
2100 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
2101 ABObj obj = evInfo->obj;
2107 * Do only if position or size changed
2109 if ((evInfo->atts & OBJEV_ATT_POSITION) ||
2110 (evInfo->atts & OBJEV_ATT_SIZE))
2112 if (ats->cur_object == obj)
2115 * Reload attachments of object into attachments editor,
2116 * keep changebars state as-is
2118 load_attch_obj(obj, FALSE);
2127 attch_obj_destroyCB(
2128 ObjEvDestroyInfo info
2131 handle_actual_obj_destroy(info);
2132 handle_prop_sheet_obj_destroy(info);
2138 attch_obj_reparentCB(
2139 ObjEvReparentInfo info
2142 handle_actual_obj_reparent(info);
2143 handle_prop_sheet_obj_reparent(info);
2150 handle_prop_sheet_obj_destroy(
2151 ObjEvDestroyInfo info
2154 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
2155 = &dtb_attch_ed_attch_ed_dialog;
2156 AttchEditorSettingsRec *ats
2157 = &attch_editor_settings_rec;
2158 ABObj obj = info->obj;
2159 int num_items, first_viz, last_viz;
2161 if (!AB_attch_ed_dialog ||
2162 !obj_is_salient(obj) || obj_is_item(obj) || !ats->cur_object)
2166 * Update object list only if the renamed object is the same
2167 * type as the one that is currently visible.
2169 abobj_list_obj_destroyed(attch_ed_cgen->objlist, obj,
2170 attch_objlist_test_func);
2172 ui_list_get_info(attch_ed_cgen->objlist, &num_items, &first_viz, &last_viz);
2178 * Reset current object and inactivate editor
2180 ats->cur_object = NULL;
2181 attch_editor_activate(FALSE);
2183 else if (obj == ats->cur_object)
2186 * Delete current object
2187 * Select 1st item in list, and make it the edited object
2189 ui_list_select_pos(attch_ed_cgen->objlist, 1, TRUE);
2191 else if (obj_is_sibling(obj, ats->cur_object))
2194 * Sibling of current object deleted
2195 * Update attached object - to keep the sibling list option menu
2197 * Update children list.
2198 * enable/disable sibling attachment types
2200 * NOTE: should check if the object deleted is an 'attached-to' object.
2202 * REMIND: create_children_list() loads the list
2203 * Should manipulate the children list with the abobj_list_obj_destroyed()
2204 * API. Currently, it is loaded directly using the trav API.
2205 load_attch_obj(ats->cur_object, TRUE);
2207 delete_from_obj_menu(ats->cur_object, obj);
2208 create_children_list(ats->cur_object);
2209 enable_attach_types(ats->cur_object);
2215 handle_actual_obj_destroy(
2216 ObjEvDestroyInfo info
2223 void *voidRefType = NULL;
2224 AB_OBJ_REF_TYPE refType = AB_REF_UNDEF;
2225 ABAttachment *attachment;
2226 ATTCH_ED_ATTACH_TYPE attach_type;
2227 AB_COMPASS_POINT dir;
2238 if (!(project = obj_get_project(obj)))
2242 * If the entire project is curently being destroyed,
2245 if (obj_has_flag(project, BeingDestroyedFlag))
2248 if (!attch_ed_can_edit_attachments(obj))
2251 refList = obj_get_refs_to(obj);
2256 numRefs = objlist_get_num_objs(refList);
2257 for (i = 0; i < numRefs; ++i)
2261 refObj = objlist_get_obj(refList, i, &voidRefType);
2263 if (!refObj || obj_is_descendant_of(refObj, obj))
2266 refType = (AB_OBJ_REF_TYPE)voidRefType;
2271 * The ref object may have different attachments to
2274 case AB_REF_ATTACH_EAST:
2275 case AB_REF_ATTACH_NORTH:
2276 case AB_REF_ATTACH_SOUTH:
2277 case AB_REF_ATTACH_WEST:
2288 * If there are any attachments from this object that involve
2289 * 'obj', change them to AB_ATTACH_POINT
2291 change_attype_from_sib_to_point(refObj, obj, AB_CP_NORTH, FALSE);
2292 change_attype_from_sib_to_point(refObj, obj, AB_CP_SOUTH, FALSE);
2293 change_attype_from_sib_to_point(refObj, obj, AB_CP_EAST, FALSE);
2294 change_attype_from_sib_to_point(refObj, obj, AB_CP_WEST, FALSE);
2302 handle_prop_sheet_obj_reparent(
2303 ObjEvReparentInfo info
2306 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
2307 = &dtb_attch_ed_attch_ed_dialog;
2308 AttchEditorSettingsRec *ats
2309 = &attch_editor_settings_rec;
2310 ABObj obj = info->obj;
2311 int num_items, first_viz, last_viz;
2313 if (!AB_attch_ed_dialog ||
2314 !obj_is_salient(obj) || obj_is_item(obj) || !ats->cur_object)
2319 change_attype_from_sib_to_point(
2321 ABObj attach_to_sib,
2322 AB_COMPASS_POINT dir,
2326 ABAttachment *attachment;
2327 AB_ATTACH_TYPE attach_type;
2329 attachment = obj_get_attachment(obj, dir);
2334 attach_type = obj_get_attach_type(obj, dir);
2336 if ((attach_type == AB_ATTACH_OBJ) ||
2337 (attach_type == AB_ATTACH_ALIGN_OBJ_EDGE))
2344 * Get sibling obj that this object is attached to
2346 attach_obj = (ABObj)obj_get_attach_value(obj, dir);
2349 * Do not convert attachment type if:
2350 * attach_obj == object (attach to itself)
2353 if (!attach_obj || (obj == attach_obj))
2357 * If the triggering event was a reparent, and
2358 * obj and attach_obj are still siblings, do not
2361 if (reparent && obj_is_sibling(obj, attach_obj))
2365 * If a specific sibling was passed in, make sure
2366 * attach_obj matches it. If not, do not convert.
2368 if (attach_to_sib && (attach_to_sib != attach_obj))
2371 convert_offset_position(obj, NULL, dir, ATTCH_ED_PARENT,
2372 &offset, &position);
2374 obj_set_attachment(obj, dir, AB_ATTACH_POINT,
2375 (void *)position, offset);
2376 objxm_obj_set_attachment_args(obj, OBJXM_CONFIG_BUILD);
2381 handle_actual_obj_reparent(
2382 ObjEvReparentInfo info
2389 void *voidRefType = NULL;
2390 AB_OBJ_REF_TYPE refType = AB_REF_UNDEF;
2391 ABAttachment *attachment;
2392 ATTCH_ED_ATTACH_TYPE attach_type;
2393 AB_COMPASS_POINT dir;
2406 * -> New object dragged off from palette
2407 * Don't need to worry about attachments here
2409 if (obj_get_name(obj) == NULL)
2413 * The old parent is NULL
2414 * Don't need to worry about attachments here
2416 if (!info->old_parent)
2419 if (!attch_ed_can_edit_attachments(obj))
2423 * If there are any attachments from this object that involve
2424 * sibling objects, change them to AB_ATTACH_POINT
2426 change_attype_from_sib_to_point(obj, NULL, AB_CP_NORTH, TRUE);
2427 change_attype_from_sib_to_point(obj, NULL, AB_CP_SOUTH, TRUE);
2428 change_attype_from_sib_to_point(obj, NULL, AB_CP_EAST, TRUE);
2429 change_attype_from_sib_to_point(obj, NULL, AB_CP_WEST, TRUE);
2432 * If there are attachments *to* this object, change them
2433 * to AB_ATTACH_POINT
2435 refList = obj_get_refs_to(obj);
2440 numRefs = objlist_get_num_objs(refList);
2441 for (i = 0; i < numRefs; ++i)
2445 refObj = objlist_get_obj(refList, i, &voidRefType);
2447 if (!refObj || obj_is_descendant_of(refObj, obj))
2450 refType = (AB_OBJ_REF_TYPE)voidRefType;
2455 * The ref object may have different attachments to
2458 case AB_REF_ATTACH_EAST:
2459 case AB_REF_ATTACH_NORTH:
2460 case AB_REF_ATTACH_SOUTH:
2461 case AB_REF_ATTACH_WEST:
2472 * If there are any attachments from this object that involve
2473 * 'obj', change them to AB_ATTACH_POINT
2475 change_attype_from_sib_to_point(refObj, obj, AB_CP_NORTH, TRUE);
2476 change_attype_from_sib_to_point(refObj, obj, AB_CP_SOUTH, TRUE);
2477 change_attype_from_sib_to_point(refObj, obj, AB_CP_EAST, TRUE);
2478 change_attype_from_sib_to_point(refObj, obj, AB_CP_WEST, TRUE);
2486 ObjEvAttChangeInfo info
2489 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
2490 = &dtb_attch_ed_attch_ed_dialog;
2491 AttchEditorSettingsRec *ats
2492 = &attch_editor_settings_rec;
2493 ABObj obj = info->obj,
2496 if (!AB_attch_ed_dialog ||
2497 !obj_is_salient(obj) || obj_is_item(obj) || !ats->cur_object)
2500 if (obj_is_module(obj))
2502 if ((obj_get_module(ats->cur_object) == obj_get_module(obj)))
2504 abobj_list_obj_renamed(attch_ed_cgen->objlist,
2506 istr_string(info->old_name),
2507 attch_objlist_test_func);
2513 * Update object list only if the renamed object is the same
2514 * type as the one that is currently visible.
2516 abobj_list_obj_renamed(attch_ed_cgen->objlist,
2518 istr_string(info->old_name),
2519 attch_objlist_test_func);
2522 * Update/reload attached object if:
2523 * the attached object was renamed
2524 * any of the attached object's siblings got renamed
2526 if ((obj == ats->cur_object) || obj_is_sibling(obj, ats->cur_object))
2529 * REMIND: load_attch_obj() loads the list
2530 * Should manipulate the children list with the
2531 * abobj_list_obj_renamed() API. Currently, it is loaded
2532 * directly using the trav API.
2534 load_attch_obj(ats->cur_object, TRUE);
2535 create_children_list(ats->cur_object);
2536 enable_attach_types(ats->cur_object);
2539 root_parent = attch_ed_get_parent(ats->cur_object);
2541 root_parent = obj_get_root(root_parent);
2544 * If current object's parent is renamed, update
2545 * parent object label
2547 if (obj == root_parent)
2549 update_attch_obj_parent(ats->cur_object);
2558 ATTCH_ED_ATTACH_TYPE attach_type,
2564 if (!objlist || !offset || !position)
2569 case ATTCH_ED_PARENT:
2570 case ATTCH_ED_OPPOSITE_PARENT:
2571 ui_set_active(objlist, False);
2572 ui_set_active(offset, True);
2573 ui_set_active(position, False);
2576 case ATTCH_ED_SIBLING:
2577 case ATTCH_ED_OPPOSITE_SIBLING:
2578 ui_set_active(objlist, True);
2579 ui_set_active(offset, True);
2580 ui_set_active(position, False);
2583 case ATTCH_ED_GRIDLINE:
2584 ui_set_active(objlist, False);
2585 ui_set_active(offset, True);
2586 ui_set_active(position, True);
2589 case ATTCH_ED_CENTER_GRIDLINE:
2590 ui_set_active(objlist, False);
2591 ui_set_active(offset, False);
2592 ui_set_active(position, True);
2596 ui_set_active(objlist, False);
2597 ui_set_active(offset, False);
2598 ui_set_active(position, False);
2605 enable_attach_types(
2609 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
2610 = &dtb_attch_ed_attch_ed_dialog;
2611 AttchEditorSettingsRec *ats
2612 = &attch_editor_settings_rec;
2620 parent = attch_ed_get_parent(obj);
2621 child_count = parent ? trav_count(parent, AB_TRAV_SALIENT_CHILDREN)
2625 * If this object has siblings, enable attach sibling
2628 if (child_count > 1)
2631 /* left attachment */
2632 ui_set_active(attch_ed_cgen->left_attach_items.bitmaps_attach_left_widget_xbm_item,
2634 ui_set_active(attch_ed_cgen->left_attach_items.bitmaps_attach_left_opposite_widget_xbm_item,
2637 /* right attachment */
2638 ui_set_active(attch_ed_cgen->right_attach_items.bitmaps_attach_right_widget_xbm_item,
2640 ui_set_active(attch_ed_cgen->right_attach_items.bitmaps_attach_right_opposite_widget_xbm_item,
2643 /* top attachment */
2644 ui_set_active(attch_ed_cgen->top_attach_items.bitmaps_attach_top_widget_xbm_item,
2646 ui_set_active(attch_ed_cgen->top_attach_items.bitmaps_attach_top_opposite_widget_xbm_item,
2649 /* bottom attachment */
2650 ui_set_active(attch_ed_cgen->bottom_attach_items.bitmaps_attach_bottom_widget_xbm_item,
2652 ui_set_active(attch_ed_cgen->bottom_attach_items.bitmaps_attach_bottom_opposite_widget_xbm_item,
2658 ATTCH_ED_ATTACH_TYPE attach_type,
2659 PropFieldSetting offset_setting,
2660 PropFieldSetting position_setting,
2661 PropOptionsSetting objlist_setting,
2667 switch (attach_type)
2669 case ATTCH_ED_PARENT:
2670 prop_field_set_numeric_value(offset_setting, offset_value, False);
2673 case ATTCH_ED_OPPOSITE_PARENT:
2674 prop_field_set_numeric_value(offset_setting, offset_value, False);
2677 case ATTCH_ED_SIBLING:
2678 prop_field_set_numeric_value(offset_setting, offset_value, False);
2679 prop_options_set_value(objlist_setting, (XtPointer)objlist_value, False);
2682 case ATTCH_ED_OPPOSITE_SIBLING:
2683 prop_field_set_numeric_value(offset_setting, offset_value, False);
2684 prop_options_set_value(objlist_setting, (XtPointer)objlist_value, False);
2687 case ATTCH_ED_GRIDLINE:
2688 prop_field_set_numeric_value(offset_setting, offset_value, False);
2689 prop_field_set_numeric_value(position_setting, position_value, False);
2692 case ATTCH_ED_CENTER_GRIDLINE:
2693 prop_field_set_numeric_value(position_setting, position_value, False);
2703 ATTCH_ED_ATTACH_TYPE attach_type,
2704 PropFieldSetting offset_setting,
2705 PropFieldSetting position_setting,
2706 PropOptionsSetting objlist_setting,
2708 int *position_value,
2709 XtPointer *objlist_value
2712 switch (attach_type)
2714 case ATTCH_ED_PARENT:
2715 *offset_value = prop_field_get_numeric_value(offset_setting);
2718 case ATTCH_ED_OPPOSITE_PARENT:
2719 *offset_value = prop_field_get_numeric_value(offset_setting);
2722 case ATTCH_ED_SIBLING:
2723 *offset_value = prop_field_get_numeric_value(offset_setting);
2724 *objlist_value = prop_options_get_value(objlist_setting);
2727 case ATTCH_ED_OPPOSITE_SIBLING:
2728 *offset_value = prop_field_get_numeric_value(offset_setting);
2729 *objlist_value = prop_options_get_value(objlist_setting);
2732 case ATTCH_ED_GRIDLINE:
2733 *offset_value = prop_field_get_numeric_value(offset_setting);
2734 *position_value = prop_field_get_numeric_value(position_setting);
2737 case ATTCH_ED_CENTER_GRIDLINE:
2738 *position_value = prop_field_get_numeric_value(position_setting);
2748 convert_offset_position(
2751 AB_COMPASS_POINT dir,
2752 ATTCH_ED_ATTACH_TYPE attach_type,
2767 Dimension width = 0,
2773 int fraction_base = 100,
2777 if (!cur_obj || !ret_offset || !ret_position)
2781 parent_obj = attch_ed_get_parent(cur_obj);
2783 parent_obj = obj_get_parent(cur_obj);
2785 *ret_offset = *ret_position = 0;
2790 cur_widget = objxm_get_widget(cur_obj);
2791 parent_widget = objxm_get_widget(parent_obj);
2793 if (!cur_widget || !parent_widget)
2796 XtVaGetValues(cur_widget,
2803 XtVaGetValues(parent_widget,
2807 XmNheight, &p_height,
2808 XmNfractionBase,&fraction_base,
2811 if (attch_ed_need_obj_menu(attach_type))
2816 sibling_widget = objxm_get_widget(sibling_obj);
2818 if (!sibling_widget)
2821 XtVaGetValues(sibling_widget,
2825 XmNheight, &s_height,
2834 case ATTCH_ED_PARENT:
2835 offset_value = (int)x;
2838 case ATTCH_ED_OPPOSITE_PARENT:
2839 offset_value = (int)(- ((int)p_width - (int)x));
2842 case ATTCH_ED_SIBLING:
2843 offset_value = (int)((int)x - ((int)s_x + (int)s_width));
2846 case ATTCH_ED_OPPOSITE_SIBLING:
2847 offset_value = (int)x - (int)s_x;
2850 case ATTCH_ED_GRIDLINE:
2851 position_value = (fraction_base * (int)x)/(int)p_width;
2854 case ATTCH_ED_CENTER_GRIDLINE:
2856 (fraction_base * ((int)x + ((int)width/2)))/(int)p_width;
2867 case ATTCH_ED_PARENT:
2868 offset_value = (int)p_width - ((int)x + (int)width);
2871 case ATTCH_ED_OPPOSITE_PARENT:
2872 offset_value = (int)(- ((int)p_width - ((int)x + (int)width)));
2875 case ATTCH_ED_SIBLING:
2876 offset_value = (int)s_x - ((int)x + (int)width);
2879 case ATTCH_ED_OPPOSITE_SIBLING:
2880 offset_value = ((int)s_x + (int)s_width) - ((int)x + (int)width);
2883 case ATTCH_ED_GRIDLINE:
2884 position_value = (fraction_base * ((int)x + (int)width))/(int)p_width;
2887 case ATTCH_ED_CENTER_GRIDLINE:
2889 (fraction_base * ((int)x + ((int)width/2)))/(int)p_width;
2900 case ATTCH_ED_PARENT:
2901 offset_value = (int)y;
2904 case ATTCH_ED_OPPOSITE_PARENT:
2905 offset_value = (int)(- ((int)p_height - (int)y));
2908 case ATTCH_ED_SIBLING:
2909 offset_value = (int)y - ((int)s_y + (int)s_height);
2912 case ATTCH_ED_OPPOSITE_SIBLING:
2913 offset_value = (int)y - (int)s_y;
2916 case ATTCH_ED_GRIDLINE:
2917 position_value = (fraction_base * (int)y)/(int)p_height;
2920 case ATTCH_ED_CENTER_GRIDLINE:
2922 (fraction_base * ((int)y + ((int)height/2)))/(int)p_height;
2933 case ATTCH_ED_PARENT:
2934 offset_value = (int)p_height - ((int)y + (int)height);
2937 case ATTCH_ED_OPPOSITE_PARENT:
2938 offset_value = - ((int)y + (int)height);
2941 case ATTCH_ED_SIBLING:
2942 offset_value = (int)s_y - ((int)y + (int)height);
2945 case ATTCH_ED_OPPOSITE_SIBLING:
2946 offset_value = ((int)s_y + (int)s_height) - ((int)y + (int)height);
2949 case ATTCH_ED_GRIDLINE:
2950 position_value = (fraction_base * ((int)y + (int)height))/(int)p_height;
2953 case ATTCH_ED_CENTER_GRIDLINE:
2955 (fraction_base * ((int)y + ((int)height/2)))/(int)p_height;
2965 set_attach_values(attach_type,
2966 offset_setting, position_setting, objlist_setting,
2967 offset_value, position_value, (int)sibling_obj);
2970 *ret_offset = offset_value;
2971 *ret_position = position_value;
2976 * Attachment type has changed. Figure out (and set) the
2977 * new 'fields' of this attachment i.e.
2985 AB_COMPASS_POINT dir,
2986 ATTCH_ED_ATTACH_TYPE attach_type
2989 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
2990 = &dtb_attch_ed_attch_ed_dialog;
2991 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
2992 ABAttachment *attachment;
2995 ABObj attach_obj = NULL;
2996 PropOptionsSetting objlist_setting = NULL;
2997 PropFieldSetting offset_setting = NULL,
2998 position_setting = NULL;
2999 Widget objlist_w = NULL,
3004 * Based on 'dir', figure out which setting structures and
3005 * widgets are relevant.
3010 offset_setting = &(ats->left_attach_offset);
3011 position_setting = &(ats->left_attach_position);
3012 objlist_setting = &(ats->left_attach_obj);
3014 objlist_w = attch_ed_cgen->left_attach_objmenu;
3015 offset_w = attch_ed_cgen->left_offset_rowcolumn;
3016 position_w = attch_ed_cgen->left_position_rowcolumn;
3020 offset_setting = &(ats->right_attach_offset);
3021 position_setting = &(ats->right_attach_position);
3022 objlist_setting = &(ats->right_attach_obj);
3024 objlist_w = attch_ed_cgen->right_attach_objmenu;
3025 offset_w = attch_ed_cgen->right_offset_rowcolumn;
3026 position_w = attch_ed_cgen->right_position_rowcolumn;
3030 offset_setting = &(ats->top_attach_offset);
3031 position_setting = &(ats->top_attach_position);
3032 objlist_setting = &(ats->top_attach_obj);
3034 objlist_w = attch_ed_cgen->top_attach_objmenu;
3035 offset_w = attch_ed_cgen->top_offset_rowcolumn;
3036 position_w = attch_ed_cgen->top_position_rowcolumn;
3040 offset_setting = &(ats->bottom_attach_offset);
3041 position_setting = &(ats->bottom_attach_position);
3042 objlist_setting = &(ats->bottom_attach_obj);
3044 objlist_w = attch_ed_cgen->bottom_attach_objmenu;
3045 offset_w = attch_ed_cgen->bottom_offset_rowcolumn;
3046 position_w = attch_ed_cgen->bottom_position_rowcolumn;
3051 * If any of the settings/widgets cannot be determined, return
3054 if (!offset_setting || !position_setting || !objlist_setting ||
3055 !objlist_w || !offset_w || !position_w)
3059 * Set the (in)active state of the fields:
3060 * object option menu
3062 * percentage/position
3063 * depending on what the attachment type is
3065 set_widget_state(attach_type,
3066 objlist_w, offset_w, position_w);
3069 * If the attachment type requires a sibling object,
3070 * make sure object option menu is current. Get
3071 * default/first sibling object.
3073 if (attch_ed_need_obj_menu(attach_type))
3075 create_obj_menu_dir(obj, dir);
3076 attach_obj = (ABObj)prop_options_get_value(objlist_setting);
3080 * Figure out offset/position based on (new) attachment type
3082 convert_offset_position(obj, attach_obj, dir, attach_type,
3083 &offset, &position);
3086 * Set the new offset/position/sibling object values
3088 set_attach_values(attach_type,
3089 offset_setting, position_setting, objlist_setting,
3090 offset, position, (int)attach_obj);
3095 * Attachment type has changed. Figure out (and set) the
3096 * new 'fields' of the attachment of the OPPOSITE side.
3099 change_opp_attach_type(
3101 AB_COMPASS_POINT dir,
3102 ATTCH_ED_ATTACH_TYPE attach_type
3105 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
3106 = &dtb_attch_ed_attch_ed_dialog;
3107 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3110 ABObj attach_obj = NULL;
3111 AB_COMPASS_POINT opp_dir;
3112 ATTCH_ED_ATTACH_TYPE opp_attach_type;
3113 PropOptionsSetting opp_attach_type_setting,
3114 opp_objlist_setting;
3115 PropFieldSetting opp_offset_setting,
3116 opp_position_setting;
3117 Widget opp_objlist_w,
3120 BOOL set_opp_attach = FALSE;
3123 * Based on 'dir', figure out which setting structures and
3124 * widgets are relevant for opposite side attachments.
3129 opp_dir = AB_CP_EAST;
3131 opp_attach_type_setting = &(ats->right_attach_type);
3133 opp_offset_setting = &(ats->right_attach_offset);
3134 opp_position_setting = &(ats->right_attach_position);
3135 opp_objlist_setting = &(ats->right_attach_obj);
3137 opp_objlist_w = attch_ed_cgen->right_attach_objmenu;
3138 opp_offset_w = attch_ed_cgen->right_offset_rowcolumn;
3139 opp_position_w = attch_ed_cgen->right_position_rowcolumn;
3143 opp_dir = AB_CP_WEST;
3145 opp_attach_type_setting = &(ats->left_attach_type);
3147 opp_offset_setting = &(ats->left_attach_offset);
3148 opp_position_setting = &(ats->left_attach_position);
3149 opp_objlist_setting = &(ats->left_attach_obj);
3151 opp_objlist_w = attch_ed_cgen->left_attach_objmenu;
3152 opp_offset_w = attch_ed_cgen->left_offset_rowcolumn;
3153 opp_position_w = attch_ed_cgen->left_position_rowcolumn;
3157 opp_dir = AB_CP_SOUTH;
3159 opp_attach_type_setting = &(ats->bottom_attach_type);
3161 opp_offset_setting = &(ats->bottom_attach_offset);
3162 opp_position_setting = &(ats->bottom_attach_position);
3163 opp_objlist_setting = &(ats->bottom_attach_obj);
3165 opp_objlist_w = attch_ed_cgen->bottom_attach_objmenu;
3166 opp_offset_w = attch_ed_cgen->bottom_offset_rowcolumn;
3167 opp_position_w = attch_ed_cgen->bottom_position_rowcolumn;
3171 opp_dir = AB_CP_NORTH;
3173 opp_attach_type_setting = &(ats->top_attach_type);
3175 opp_offset_setting = &(ats->top_attach_offset);
3176 opp_position_setting = &(ats->top_attach_position);
3177 opp_objlist_setting = &(ats->top_attach_obj);
3179 opp_objlist_w = attch_ed_cgen->top_attach_objmenu;
3180 opp_offset_w = attch_ed_cgen->top_offset_rowcolumn;
3181 opp_position_w = attch_ed_cgen->top_position_rowcolumn;
3186 * If any of the settings/widgets cannot be determined, return
3189 if (!opp_attach_type_setting ||
3190 !opp_offset_setting || !opp_position_setting || !opp_objlist_setting ||
3191 !opp_objlist_w || !opp_offset_w || !opp_position_w)
3196 * Get opposite side attachment type
3199 (ATTCH_ED_ATTACH_TYPE)prop_options_get_value(opp_attach_type_setting);
3202 * Check if opposite side attachment needs to be changed
3204 if ((attach_type == ATTCH_ED_CENTER_GRIDLINE) &&
3205 (opp_attach_type != ATTCH_ED_NONE))
3208 * If attachment type is now ATTCH_ED_CENTER_GRIDLINE,
3209 * make the opposite side's attachment type ATTCH_ED_NONE.
3210 * ATTCH_ED_CENTER_GRIDLINE is an attachment type that
3211 * does not really apply to an edge. It affects the
3212 * object either vertically or horizontally.
3214 opp_attach_type = ATTCH_ED_NONE;
3215 set_opp_attach = TRUE;
3217 else if ((attach_type == ATTCH_ED_NONE) &&
3218 (opp_attach_type == ATTCH_ED_NONE))
3221 * If attachment type is now ATTCH_ED_NONE and the opposite side's
3222 * attachment type is also ATTCH_ED_NONE, make the opposite side's
3223 * attachment type ATTCH_ED_PARENT. You cannot set both the
3224 * opposite sides to ATTCH_ED_NONE.
3226 opp_attach_type = ATTCH_ED_PARENT;
3227 set_opp_attach = TRUE;
3229 else if ((attach_type != ATTCH_ED_NONE) &&
3230 (opp_attach_type == ATTCH_ED_CENTER_GRIDLINE))
3233 * If the attachment type is NOT ATTCH_ED_NONE, and
3234 * the opposite side's attachment type is ATTCH_ED_CENTER_GRIDLINE,
3235 * make the opposite side's attachment type ATTCH_ED_NONE.
3236 * ATTCH_ED_CENTER_GRIDLINE cannot be set on a side, if the
3237 * opposite side is not ATTCH_ED_NONE.
3239 opp_attach_type = ATTCH_ED_NONE;
3240 set_opp_attach = TRUE;
3244 * Was a change to the opposite side's attachment necessary ?
3249 * Set the (in)active state of the fields:
3250 * object option menu
3252 * percentage/position
3253 * depending on what the new attachment type is
3255 set_widget_state(opp_attach_type,
3256 opp_objlist_w, opp_offset_w, opp_position_w);
3259 * If the attachment type requires a sibling object,
3260 * make sure that the object option menu is current. Get
3261 * default/first sibling object.
3263 if (attch_ed_need_obj_menu(opp_attach_type))
3265 create_obj_menu_dir(obj, opp_dir);
3266 attach_obj = (ABObj)prop_options_get_value(opp_objlist_setting);
3270 * Set the new attachment type
3272 prop_options_set_value(opp_attach_type_setting, (XtPointer)opp_attach_type, True);
3275 * Figure out offset/position based on (new) attachment type
3277 convert_offset_position(obj, attach_obj, opp_dir, opp_attach_type,
3278 &offset, &position);
3281 * Set the new offset/position/sibling object values
3283 set_attach_values(opp_attach_type,
3284 opp_offset_setting, opp_position_setting, opp_objlist_setting,
3285 offset, position, (int)attach_obj);
3293 XtPointer client_data,
3297 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
3298 = &dtb_attch_ed_attch_ed_dialog;
3299 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3300 PropFieldSetting offset_setting,
3302 PropOptionsSetting objlist_setting,
3303 attach_type_setting;
3304 AB_COMPASS_POINT dir = (AB_COMPASS_POINT)client_data;
3305 ATTCH_ED_ATTACH_TYPE attach_type = ATTCH_ED_NONE;
3306 ABObj attach_obj = NULL;
3309 XtVaGetValues(widget, XmNuserData, &value, NULL);
3310 attach_obj = (ABObj)value;
3318 attach_type_setting = &(ats->left_attach_type);
3319 offset_setting = &(ats->left_attach_offset);
3320 position_setting = &(ats->left_attach_position);
3321 objlist_setting = &(ats->left_attach_obj);
3325 attach_type_setting = &(ats->right_attach_type);
3326 offset_setting = &(ats->right_attach_offset);
3327 position_setting = &(ats->right_attach_position);
3328 objlist_setting = &(ats->right_attach_obj);
3332 attach_type_setting = &(ats->top_attach_type);
3333 offset_setting = &(ats->top_attach_offset);
3334 position_setting = &(ats->top_attach_position);
3335 objlist_setting = &(ats->top_attach_obj);
3339 attach_type_setting = &(ats->bottom_attach_type);
3340 offset_setting = &(ats->bottom_attach_offset);
3341 position_setting = &(ats->bottom_attach_position);
3342 objlist_setting = &(ats->bottom_attach_obj);
3347 attach_type = (ATTCH_ED_ATTACH_TYPE)prop_options_get_value(attach_type_setting);
3349 if (attch_ed_need_obj_menu(attach_type))
3351 int offset, position;
3353 convert_offset_position(ats->cur_object, attach_obj, dir, attach_type,
3354 &offset, &position);
3355 set_attach_values(attach_type,
3356 offset_setting, position_setting, objlist_setting,
3357 offset, position, (int)attach_obj);
3363 attch_ed_view_child_attachments(
3366 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3369 DTB_MODAL_ANSWER answer = DTB_ANSWER_ACTION1;
3371 cur_obj = ats->cur_object;
3376 child = obj_get_salient_child(cur_obj, 0);
3381 if (attch_edP_pending())
3383 answer = get_wrn_response(AB_attch_ed_dialog,
3384 ATTCH_ED_WRN_LOAD, child);
3387 if (answer != DTB_ANSWER_ACTION1)
3390 attch_editor_load(child);
3395 attch_ed_view_parent_attachments(
3398 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3401 DTB_MODAL_ANSWER answer = DTB_ANSWER_ACTION1;
3403 cur_obj = ats->cur_object;
3408 parent = attch_ed_get_parent(cur_obj);
3413 parent = obj_get_root(parent);
3415 if (attch_edP_pending())
3417 answer = get_wrn_response(AB_attch_ed_dialog,
3418 ATTCH_ED_WRN_LOAD, parent);
3421 if (answer != DTB_ANSWER_ACTION1)
3424 attch_editor_load(parent);
3428 attch_ed_activate_parent_child_button(
3431 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3432 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
3433 = &dtb_attch_ed_attch_ed_dialog;
3436 BOOL child_state = FALSE,
3437 parent_state = FALSE;
3439 cur_obj = ats->cur_object;
3444 parent = attch_ed_get_parent(cur_obj);
3447 parent = obj_get_root(parent);
3449 if (obj_is_container(cur_obj) || obj_is_layers(cur_obj))
3452 if (parent && !obj_is_window(parent))
3453 parent_state = TRUE;
3455 ui_set_active(attch_ed_cgen->parent_attach_button, parent_state);
3456 ui_set_active(attch_ed_cgen->child_attach_button, child_state);
3461 * Called when the user attempts to dismiss the Attachments Editor
3462 * via the Motif window menu.
3465 attch_edP_prevent_closeCB(
3467 XtPointer client_data,
3471 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3472 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
3473 = &dtb_attch_ed_attch_ed_dialog;
3474 DTB_MODAL_ANSWER answer = DTB_ANSWER_ACTION1;
3477 * If there are pending changes for the current object, handle the
3478 * implied auto-apply.
3480 if (attch_edP_pending())
3482 answer = get_wrn_response(widget,
3483 ATTCH_ED_WRN_CLOSE, NULL);
3486 if (answer != DTB_ANSWER_ACTION1)
3490 * No pending changes OR applied existing changes, so just
3491 * dismiss the Attachments Editor
3493 ui_win_show(AB_attch_ed_dialog, False, NULL);
3496 static DTB_MODAL_ANSWER
3499 ATTCH_ED_WRN_TYPE wrn_type,
3503 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3504 DTB_MODAL_ANSWER answer;
3506 DtbObjectHelpData help_data = NULL;
3507 char wrn_string[512],
3511 if (dtb_app_resource_rec.implied_apply == True)
3512 answer = DTB_ANSWER_ACTION1;
3515 if (ats->cur_object)
3517 cur_name = obj_get_name(ats->cur_object);
3525 new_name = obj_get_name(new_obj);
3531 help_data = (DtbObjectHelpData) util_malloc(sizeof(DtbObjectHelpDataRec));
3532 help_data->help_text = help_data->help_volume = help_data->help_locationID = NULL;
3535 * Determine message and help text for each
3540 case ATTCH_ED_WRN_LOAD:
3541 help_data->help_text = XtNewString(catgets(Dtb_project_catd, 100, 93, "Click Apply Changes to apply the changes to the\ncurrent object and load the selected object.\n\nClick Cancel if you don't want to apply the\nchanges to the current object. You can then\nclick Reset to undo the changes before loading\nthe selected object."));
3543 catgets(Dtb_project_catd, 100, 43,
3544 "Attachments for \"%s\"\n\
3545 have been modified but not Applied.\n\n\
3546 You can Apply the Changes or Cancel the\n\
3547 Load operation for \"%s\"."),
3548 cur_name, new_name);
3551 case ATTCH_ED_WRN_CHANGE_OBJTYPE:
3552 help_data->help_text = XtNewString(catgets(Dtb_project_catd, 100, 95, "Click Apply Changes to apply the changes to the\ncurrent object and display the new object type.\n\nClick Cancel if you don't want to apply the\nchanges to the current object. You can then\nclick Reset to undo the changes before changing\nto a different object type."));
3554 catgets(Dtb_project_catd, 100, 44,
3555 "Attachments for \"%s\"\n\
3556 have been modified but not Applied.\n\n\
3557 You can Apply the Changes or Cancel the\n\
3558 'Change Object-Type' operation."),
3562 case ATTCH_ED_WRN_CLOSE:
3563 help_data->help_text = XtNewString(catgets(Dtb_project_catd, 100, 247, "Click Apply Changes to apply the changes to the\ncurrent object and close the Attachments Editor.\n\nClick Cancel if you don't want to apply the\nchanges to the current object and want the\nAttachments Editor to remain displayed. You can\nthen click Reset to undo the changes before\nclosing the Attachments Editor."));
3565 catgets(Dtb_project_catd, 100, 45,
3566 "Attachments for \"%s\"\n\
3567 have been modified but not Applied.\n\n\
3568 You can Apply the Changes or Cancel the\n\
3574 sprintf(wrn_string, "Attachments Editor warning!!");
3578 xm_buf = XmStringCreateLocalized(wrn_string);
3579 dtb_attch_ed_wrn_msg_initialize(&dtb_attch_ed_wrn_msg);
3581 answer = dtb_show_modal_message(w, &dtb_attch_ed_wrn_msg,
3582 xm_buf, help_data, NULL);
3584 XmStringFree(xm_buf);
3586 if (help_data->help_text)
3587 XtFree(help_data->help_text);
3588 util_free(help_data);
3593 case DTB_ANSWER_ACTION1: /* Apply Changes */
3594 attch_editor_apply(ats->cur_object);
3597 default: /* Let caller do the rest */
3605 attch_ed_can_edit_attachments(
3616 module = obj_get_module(obj);
3618 if (module && (!obj_has_flag(module, MappedFlag) || !obj_is_defined(module)))
3621 if (!obj_is_ui(obj) || obj_is_window(obj) ||
3622 obj_is_menubar(obj) || obj_is_item(obj) ||
3626 parent = attch_ed_get_parent(obj);
3631 parent_w = objxm_get_widget(parent);
3636 if (!XtIsSubclass(parent_w, xmFormWidgetClass))
3644 ATTCH_ED_ATTACH_TYPE attach_type
3647 fprintf(stderr, "Attach type = ");
3648 switch (attach_type)
3650 case ATTCH_ED_PARENT:
3651 fprintf(stderr, "ATTCH_ED_PARENT\n");
3654 case ATTCH_ED_OPPOSITE_PARENT:
3655 fprintf(stderr, "ATTCH_ED_OPPOSITE_PARENT\n");
3658 case ATTCH_ED_SIBLING:
3659 fprintf(stderr, "ATTCH_ED_SIBLING\n");
3662 case ATTCH_ED_OPPOSITE_SIBLING:
3663 fprintf(stderr, "ATTCH_ED_OPPOSITE_SIBLING\n");
3666 case ATTCH_ED_GRIDLINE:
3667 fprintf(stderr, "ATTCH_ED_GRIDLINE\n");
3670 case ATTCH_ED_CENTER_GRIDLINE:
3671 fprintf(stderr, "ATTCH_ED_CENTER_GRIDLINE\n");
3675 fprintf(stderr, "ATTCH_ED_NONE\n");
3681 attch_ed_verify_props(
3684 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3685 ATTCH_ED_ATTACH_TYPE attach_type = ATTCH_ED_NONE;
3688 if (ats->cur_object == NULL)
3692 * Get parent of current object
3694 parent = obj_get_parent(ats->cur_object);
3696 parent = obj_get_root(parent);
3699 * If parent is a group with layout type NOT "As Is"
3701 if (parent && obj_is_group(parent) &&
3702 (obj_get_group_type(parent) != AB_GROUP_IGNORE))
3704 DTB_MODAL_ANSWER answer;
3705 DtbObjectHelpData help_data;
3713 * Get the object and it's parent's names
3715 obj_name = obj_get_name(ats->cur_object);
3716 parent_name = obj_get_name(parent);
3718 if (!obj_name || !parent_name)
3722 * Initialize message object if necessary
3724 dtb_attch_ed_grp_member_wrn_initialize(&dtb_attch_ed_grp_member_wrn);
3727 * Fetch format string
3729 format_str = XtNewString(catgets(Dtb_project_catd, 100, 245,
3730 "Attachments for \"%s\"\ncannot be modified because it is\na member of the group \"%s\"."));
3733 * Malloc space for warning message. It's length is:
3736 * object parent name len +
3737 * <some padding> (paranoia)
3739 msg_buf = (STRING)util_malloc(strlen(format_str) +
3741 strlen(parent_name) +
3745 * Construct warning message
3747 sprintf(msg_buf, format_str, obj_name, parent_name);
3750 * Create XmString for warning message
3752 xm_buf = XmStringCreateLocalized(msg_buf);
3755 * Malloc/setup struct for help text
3757 help_data = (DtbObjectHelpData) util_malloc(sizeof(DtbObjectHelpDataRec));
3758 help_data->help_text = catgets(Dtb_project_catd, 100, 246,
3759 "Group objects have attributes that determine what\nattachments their members will have, therefore setting\nattachments for group members is not allowed. This only\napplies to group objects that have layout type Vertical,\nHorizontal, or Row-column. Click Cancel or Reset to\nundo your changes on the Attachments Editor.");
3760 help_data->help_volume = NULL;
3761 help_data->help_locationID = NULL;
3764 * Show warning message dialog
3766 answer = dtb_show_modal_message(AB_attch_ed_dialog, &dtb_attch_ed_grp_member_wrn,
3767 xm_buf, help_data, NULL);
3770 * Free message/format strings
3776 XmStringFree(xm_buf);
3777 util_free(help_data);
3785 if (prop_changed(ats->top_attach_type.changebar))
3788 (ATTCH_ED_ATTACH_TYPE)prop_options_get_value(&(ats->top_attach_type));
3790 if (!verify_one_attach(attach_type,
3791 &(ats->top_attach_offset), &(ats->top_attach_position)))
3798 if (prop_changed(ats->bottom_attach_type.changebar))
3801 (ATTCH_ED_ATTACH_TYPE)prop_options_get_value(&(ats->bottom_attach_type));
3803 if (!verify_one_attach(attach_type,
3804 &(ats->bottom_attach_offset), &(ats->bottom_attach_position)))
3811 if (prop_changed(ats->left_attach_type.changebar))
3814 (ATTCH_ED_ATTACH_TYPE)prop_options_get_value(&(ats->left_attach_type));
3816 if (!verify_one_attach(attach_type,
3817 &(ats->left_attach_offset), &(ats->left_attach_position)))
3822 * Right attachment - shares changebar with left attachment
3824 if (prop_changed(ats->left_attach_type.changebar))
3827 (ATTCH_ED_ATTACH_TYPE)prop_options_get_value(&(ats->right_attach_type));
3829 if (!verify_one_attach(attach_type,
3830 &(ats->right_attach_offset), &(ats->right_attach_position)))
3839 ATTCH_ED_ATTACH_TYPE attach_type,
3840 PropFieldSetting offset_setting,
3841 PropFieldSetting position_setting
3844 switch (attach_type)
3846 case ATTCH_ED_PARENT:
3847 case ATTCH_ED_OPPOSITE_PARENT:
3848 case ATTCH_ED_SIBLING:
3849 case ATTCH_ED_OPPOSITE_SIBLING:
3850 if (!prop_number_ok(offset_setting->field,
3851 (STRING)OffsetFieldStr, -SHRT_MAX, SHRT_MAX))
3855 case ATTCH_ED_GRIDLINE:
3856 if (!prop_number_ok(offset_setting->field,
3857 (STRING)OffsetFieldStr, -SHRT_MAX, SHRT_MAX) ||
3858 !prop_number_ok(position_setting->field,
3859 (STRING)PercentageFieldStr, -SHRT_MAX, SHRT_MAX))
3863 case ATTCH_ED_CENTER_GRIDLINE:
3864 if (!prop_number_ok(position_setting->field,
3865 (STRING)PercentageFieldStr, -SHRT_MAX, SHRT_MAX))
3877 /*** DTB_USER_CODE_END
3879 *** End of user code section
3881 **************************************************************************/
3888 XtPointer clientData,
3892 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3894 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3896 attch_editor_apply(ats->cur_object);
3898 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3900 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3901 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3908 XtPointer clientData,
3912 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3914 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3916 attch_editor_load(ats->cur_object);
3918 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3920 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3921 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3928 XtPointer clientData,
3932 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3933 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3935 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3936 printf("action: attch_ed_helpCB\n");
3937 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3944 XtPointer clientData,
3948 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3950 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3952 attch_editor_apply(ats->cur_object);
3953 ui_win_show(AB_attch_ed_dialog, False, NULL);
3955 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3957 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3958 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3965 XtPointer clientData,
3969 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3971 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3973 attch_editor_load(ats->cur_object);
3974 ui_win_show(AB_attch_ed_dialog, False, NULL);
3976 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3978 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3979 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3984 top_attach_type_changed(
3986 XtPointer clientData,
3990 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3992 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
3993 = &dtb_attch_ed_attch_ed_dialog;
3994 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
3995 ATTCH_ED_ATTACH_TYPE attach_type = ATTCH_ED_NONE;
3998 XtVaGetValues(widget, XmNuserData, &value, NULL);
3999 attach_type = (ATTCH_ED_ATTACH_TYPE)value;
4002 print_attach_type(attach_type);
4005 change_attach_type(ats->cur_object, AB_CP_NORTH, attach_type);
4006 change_opp_attach_type(ats->cur_object, AB_CP_NORTH, attach_type);
4008 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
4010 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
4011 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
4016 right_attach_type_changed(
4018 XtPointer clientData,
4022 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
4024 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
4025 = &dtb_attch_ed_attch_ed_dialog;
4026 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
4027 ATTCH_ED_ATTACH_TYPE attach_type = ATTCH_ED_NONE;
4030 XtVaGetValues(widget, XmNuserData, &value, NULL);
4031 attach_type = (ATTCH_ED_ATTACH_TYPE)value;
4034 print_attach_type(attach_type);
4037 change_attach_type(ats->cur_object, AB_CP_EAST, attach_type);
4038 change_opp_attach_type(ats->cur_object, AB_CP_EAST, attach_type);
4040 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
4042 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
4043 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
4048 bottom_attach_type_changed(
4050 XtPointer clientData,
4054 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
4056 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
4057 = &dtb_attch_ed_attch_ed_dialog;
4058 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
4059 ATTCH_ED_ATTACH_TYPE attach_type = ATTCH_ED_NONE;
4062 XtVaGetValues(widget, XmNuserData, &value, NULL);
4063 attach_type = (ATTCH_ED_ATTACH_TYPE)value;
4066 print_attach_type(attach_type);
4069 change_attach_type(ats->cur_object, AB_CP_SOUTH, attach_type);
4070 change_opp_attach_type(ats->cur_object, AB_CP_SOUTH, attach_type);
4072 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
4074 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
4075 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
4080 left_attach_type_changed(
4082 XtPointer clientData,
4086 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
4088 DtbAttchEdAttchEdDialogInfo attch_ed_cgen
4089 = &dtb_attch_ed_attch_ed_dialog;
4090 AttchEditorSettingsRec *ats = &attch_editor_settings_rec;
4091 ATTCH_ED_ATTACH_TYPE attach_type = ATTCH_ED_NONE;
4094 XtVaGetValues(widget, XmNuserData, &value, NULL);
4095 attach_type = (ATTCH_ED_ATTACH_TYPE)value;
4098 print_attach_type(attach_type);
4101 change_attach_type(ats->cur_object, AB_CP_WEST, attach_type);
4102 change_opp_attach_type(ats->cur_object, AB_CP_WEST, attach_type);
4104 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
4106 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
4107 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
4114 XtPointer clientData,
4118 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
4119 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
4121 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
4122 attch_ed_view_parent_attachments();
4123 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
4130 XtPointer clientData,
4134 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
4135 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
4137 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
4138 attch_ed_view_child_attachments();
4139 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
4144 /**************************************************************************
4145 *** DTB_USER_CODE_START
4147 *** All automatically-generated data and functions have been defined.
4149 *** Add new functions here, or at the top of the file.
4152 /*** DTB_USER_CODE_END
4154 *** End of user code section
4156 **************************************************************************/