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: conn_stubs.c /main/4 1996/04/18 13:17:18 drk $
27 * @(#)conn_stubs.c 1.61 08 Jun 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 ^^^ ***/
47 * Contains: Module callbacks and connection functions
49 * This file was generated by dtcodegen, from module conn
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"
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.
76 #include <sys/param.h>
77 #include "dtbuilder.h"
80 #include "palette_ui.h"
83 #include <ab_private/connP.h>
86 #include <X11/Intrinsic.h>
87 #include <X11/cursorfont.h>
90 #include <Xm/RowColumn.h>
91 #include <Xm/ToggleB.h>
95 #include <ab_private/obj.h>
96 #include <ab_private/trav.h>
97 #include <ab_private/objxm.h>
99 #include <ab_private/abobj.h>
100 #include <ab_private/abobj_set.h>
101 #include <ab_private/abobj_list.h>
102 #include <ab_private/brws.h>
103 #include <ab_private/proj.h>
104 #include <ab_private/istr.h>
105 #include <ab_private/ab.h>
106 #include <ab_private/ui_util.h>
107 #include "dtb_utils.h"
110 * Declarations of global widgets used by callbacks.
113 static Widget src_menu = NULL;
114 static Widget target_menu = NULL;
115 static Widget when_menu = NULL;
116 static Widget action_menu = NULL;
117 static Widget view_menu = NULL;
119 static Widget when_pulldown = NULL;
120 static Widget action_pulldown = NULL;
122 static Widget src_list = NULL;
123 static Widget target_list = NULL;
124 static Widget connection_list = NULL;
126 static Widget arg_rowcol = NULL;
127 static Widget arg_label = NULL;
128 static Widget arg_field = NULL;
130 static Widget connect_button = NULL;
131 static Widget change_button = NULL;
132 static Widget cancel_button = NULL;
133 static Widget delete_button = NULL;
135 static Widget std_action_item = NULL;
136 static Widget call_function_item = NULL;
137 static Widget execute_code_item = NULL;
138 static Widget on_item_help_item = NULL;
139 static Widget help_volume_item = NULL;
141 static Widget location_rowcol = NULL;
142 static Widget location_field = NULL;
143 static Widget volume_rowcol = NULL;
144 static Widget volume_field = NULL;
145 static Widget action_type_opmenu = NULL;
147 static Widget exec_code_dialog = NULL;
148 static Widget exec_code_textpane = NULL;
150 static Widget ConnP_view_source_obj = NULL; /* View:'s "Source Object" PushButton */
151 static int ConnP_view_filter = -1;
153 static STRING CodeFragBuf = NULL;
154 static STRING action_type_labels[ACTION_TYPE_NUM_VALUES];
156 static AB_WHEN DefaultWhen = AB_WHEN_UNDEF;
157 static AB_FUNC_TYPE DefaultFuncType = AB_FUNC_UNDEF;
160 * End declarations of global widgets
163 static void init_exec_code_dialog(
164 DtbConnExecCodeDialogInfo instance
167 static void populate_src_menu(
169 XtPointer client_data,
172 static void populate_target_menu(
174 XtPointer client_data,
177 static void populate_when_menu(
179 XtPointer client_data,
182 static void populate_action_menu(
184 XtPointer client_data,
187 static void populate_view_menu(
189 XtPointer client_data,
192 static void populate_list(
197 static void populate_connection_list(
200 static void change_src_type(
202 XtPointer client_data,
205 static void change_target_type(
207 XtPointer client_data,
210 static void change_arg_sensitivity(
212 XtPointer client_data,
215 static void set_view_filter(
217 XtPointer client_data,
220 static BOOL is_action_type(
224 static void update_cur_src(
226 XtPointer client_data,
229 static void update_cur_target(
231 XtPointer client_data,
234 static void select_connection(
236 XtPointer client_data,
240 static void setup_source(
241 AB_OBJECT_TYPE source_type,
245 static void setup_target(
246 AB_OBJECT_TYPE target_type,
250 static int get_cur_when(
253 static AB_BUILTIN_ACTION get_cur_act(
256 static void set_cur_when(
259 static void set_cur_act(
260 AB_BUILTIN_ACTION new_act
262 static ABObj get_cur_connection(
265 static void set_standard_action_type(
268 static void set_call_function_action_type(
271 static void set_execute_code_action_type(
274 static void set_on_item_help_action_type(
277 static void set_access_help_vol_action_type(
281 static void set_conn_controls(
284 static void hide_execute_code_win(
287 static BOOL verify_builtin_arg_string(
288 AB_BUILTIN_ACTION c_act,
292 static void update_on_src_type_change(
293 AB_OBJECT_TYPE obj_type,
296 static void update_on_target_type_change(
297 AB_OBJECT_TYPE obj_type,
300 static void update_conn_ed_controls(void);
301 static AB_FUNC_TYPE get_cur_func_type(void);
303 static BOOL src_list_test(
306 static BOOL target_list_test(
309 static void set_ctrls_for_src(
312 static void set_ctrls_for_target(
323 obj_add_destroy_callback(connP_update_on_obj_destroy, NULL);
329 XtPointer client_data,
333 extern Widget AB_toplevel;
335 if (AB_conn_dialog == (Widget)NULL)
337 dtbConnConnDialogInfo_clear(&dtb_conn_conn_dialog);
338 (void)dtb_conn_conn_dialog_initialize(&dtb_conn_conn_dialog,
340 AB_conn_dialog = dtb_conn_conn_dialog.conn_dialog_shellform;
343 * Setup dialog to participate in dtbuilder window protocol
345 ab_register_window(AB_conn_dialog, AB_WIN_DIALOG,
346 WindowHidden, AB_toplevel, AB_WPOS_TILE_HORIZONTAL,
347 conn_cancelCB, (XtPointer)&dtb_conn_conn_dialog);
350 * These callbacks only operate on the Connections Editor dialog
353 * If any code is added to them that is independent of
354 * the Connections Editor, then the callback registration
355 * may have to be done in conn_init().
357 obj_add_rename_callback(connP_update_on_obj_rename, NULL);
358 obj_add_update_callback(connP_update_on_show_status, NULL);
360 XtManageChild(AB_conn_dialog);
361 ab_show_window(AB_conn_dialog);
362 update_conn_ed_controls();
366 init_exec_code_dialog(
367 DtbConnExecCodeDialogInfo instance
370 exec_code_dialog = instance->exec_code_dialog_shellform;
371 exec_code_textpane = instance->exec_code_textpane;
373 ab_register_window(exec_code_dialog, AB_WIN_DIALOG,
374 WindowHidden, AB_conn_dialog, AB_WPOS_STACK_CENTER,
381 XtPointer client_data,
387 for (i = 0; i < ConnP_num_conn_objs; i++)
391 w = XtVaCreateManagedWidget("src_menu_push",
392 xmPushButtonWidgetClass, widget,
393 XtVaTypedArg, XmNlabelString, XtRString,
394 ConnP_conn_objs[i].label, strlen(ConnP_conn_objs[i].label)+1,
396 XtAddCallback(w, XmNactivateCallback,
397 (XtCallbackProc)change_src_type,
398 (XtPointer)&(ConnP_conn_objs[i]));
403 populate_target_menu(
405 XtPointer client_data,
411 for (i = 0; i < ConnP_num_conn_objs; i++)
415 /* Application and Message objects can never be a
416 * target, so don't put them in the Target Object
419 if ( (ConnP_conn_objs[i].obj_type != AB_TYPE_MESSAGE) &&
420 (ConnP_conn_objs[i].obj_type != AB_TYPE_PROJECT) &&
421 (ConnP_conn_objs[i].obj_type != AB_TYPE_MENU)
424 w = XtVaCreateManagedWidget("target_menu_push",
425 xmPushButtonWidgetClass, widget,
426 XtVaTypedArg, XmNlabelString, XtRString,
427 ConnP_conn_objs[i].label,
428 strlen(ConnP_conn_objs[i].label)+1,
430 XtAddCallback(w, XmNactivateCallback,
431 (XtCallbackProc)change_target_type,
432 (XtPointer)&(ConnP_conn_objs[i]));
440 XtPointer client_data,
447 Widget *w_list = NULL;
449 when_pulldown = widget;
451 labels = connP_get_when_labels(&num_labels);
454 w_list = (Widget *)XtMalloc(sizeof(Widget) * (num_labels + 1));
455 for (i = 0; i < num_labels; i++)
459 w = XtVaCreateWidget("when_menu_push",
460 xmPushButtonWidgetClass, when_pulldown,
461 XtVaTypedArg, XmNlabelString, XtRString,
462 labels[i], strlen(labels[i])+1,
468 XtVaSetValues(when_pulldown, XmNuserData, (XtPointer)w_list, NULL);
469 connP_ui_source_type_update(connP_get_source_type(),
470 connP_get_source_subtype());
474 populate_action_menu(
476 XtPointer client_data,
483 Widget *w_list = NULL;
485 action_pulldown = widget;
487 labels = connP_get_act_labels(&num_labels);
490 w_list = (Widget *)XtMalloc(sizeof(Widget) * (num_labels + 1));
491 for (i = 0; i < num_labels; i++)
495 w = XtVaCreateWidget("action_menu_push",
496 xmPushButtonWidgetClass, action_pulldown,
497 XtVaTypedArg, XmNlabelString, XtRString,
498 labels[i], strlen(labels[i])+1,
500 XtAddCallback(w, XmNactivateCallback,
501 change_arg_sensitivity, (XtPointer)NULL);
506 XtVaSetValues(action_pulldown, XmNuserData, (XtPointer)w_list, NULL);
507 connP_ui_target_type_update(connP_get_target_type(),
508 connP_get_target_subtype());
514 XtPointer client_data,
522 w = XtVaCreateManagedWidget("view_menu_push",
523 xmPushButtonWidgetClass, widget,
524 XtVaTypedArg, XmNlabelString, XtRString,
525 "Source Object", sizeof("Source Object"),
527 XtAddCallback(w, XmNactivateCallback, set_view_filter, (XtPointer)-1);
528 ConnP_view_source_obj = w;
530 for (i = 0; i < ConnP_num_conn_objs; i++)
532 w = XtVaCreateManagedWidget("view_menu_push",
533 xmPushButtonWidgetClass, widget,
534 XtVaTypedArg, XmNlabelString, XtRString,
535 ConnP_conn_objs[i].label, strlen(ConnP_conn_objs[i].label)+1,
537 XtAddCallback(w, XmNactivateCallback, set_view_filter, (XtPointer)i);
543 AB_OBJECT_TYPE source_type,
548 int i = connP_get_obj_type_index(source_type, source_subtype);
552 XtVaSetValues(XmOptionButtonGadget(src_menu),
553 XtVaTypedArg, XmNlabelString, XtRString,
554 ConnP_conn_objs[i].label, strlen(ConnP_conn_objs[i].label)+1,
556 populate_list(src_list, source, FALSE);
561 AB_OBJECT_TYPE target_type,
566 int i = connP_get_obj_type_index(target_type, target_subtype);
570 XtVaSetValues(XmOptionButtonGadget(target_menu),
571 XtVaTypedArg, XmNlabelString, XtRString,
572 ConnP_conn_objs[i].label, strlen(ConnP_conn_objs[i].label)+1,
574 populate_list(target_list, target, FALSE);
584 ABObj project = proj_get_project();
585 STRING select_item = NULL;
588 if (list == NULL || project == NULL)
591 if (list == src_list)
592 abobj_list_load(list, project, src_list_test);
594 abobj_list_load(list, project, target_list_test);
596 /* If the current object is in the list, then select
597 * (highlight) it and call the callback associated
598 * with selecting a list item. If all the items remain
599 * deselected, then we have to make sure to make the
600 * appropriate things inactive.
604 select_item = abobj_get_moduled_name(cur_selection);
605 iRet = ui_list_select_item(list, select_item, invoke_cb);
608 /* If cur_selection is NOT in the list, grey out the
609 * the right controls.
611 if ((iRet < 0) || (cur_selection == NULL))
613 if (list == target_list)
615 if (get_cur_func_type() == AB_FUNC_BUILTIN)
616 set_ctrls_for_target(FALSE);
618 set_ctrls_for_target(TRUE);
620 else if (list == src_list)
621 set_ctrls_for_src(FALSE);
631 AB_OBJECT_TYPE obj_type = obj_get_type(test_obj);
632 int obj_subtype = obj_get_subtype(test_obj);
633 AB_OBJECT_TYPE cur_obj_type = connP_get_source_type();
634 int cur_obj_subtype = connP_get_source_subtype();
635 ABObj mod = obj_get_module(test_obj);
638 if ((cur_obj_type == AB_TYPE_PROJECT) &&
639 (obj_type == cur_obj_type))
643 else if ((mod != NULL) && obj_has_flag(mod, MappedFlag)
644 && obj_is_defined(mod))
646 if (connP_objtype_needs_subtype(cur_obj_type, cur_obj_subtype))
648 if (!obj_is_sub(test_obj) &&
649 obj_is_defined(test_obj) &&
650 (obj_type == cur_obj_type) &&
651 (obj_subtype == cur_obj_subtype))
658 /* If the object is not a container (i.e. group,
659 * menubar, panedwindow, etc.), and the object
660 * doesn't need a subtype, either because it
661 * doesn't have one (i.e. AB_TYPE_PROJECT) or
662 * because all object subtypes should appear
663 * under one catetory (i.e. AB_TYPE_CHOICE shows
664 * optionmenus, radioboxes, and checkboxes), then
665 * search for all those objects based solely on
666 * the object type - don't care about subtype.
667 * If the object is a container and it doesn't
668 * need a subtype, then its one of AB_CONT_FOOTER,
669 * AB_CONT_BUTTON_PANEL, AB_CONT_RELATIVE,
670 * AB_CONT_TOOL_BAR, so only count those objects.
672 if (!obj_is_container(test_obj) &&
673 !obj_is_sub(test_obj) &&
674 obj_is_defined(test_obj) &&
675 obj_type == cur_obj_type)
679 else if (obj_is_container(test_obj) &&
680 (cur_obj_type == AB_TYPE_CONTAINER)
681 && !obj_is_sub(test_obj) &&
682 obj_is_defined(test_obj) &&
683 ( (obj_subtype == AB_CONT_FOOTER) ||
684 (obj_subtype == AB_CONT_BUTTON_PANEL)||
685 (obj_subtype == AB_CONT_RELATIVE) ||
686 (obj_subtype == AB_CONT_TOOL_BAR)))
700 AB_OBJECT_TYPE obj_type = obj_get_type(test_obj);
701 int obj_subtype = obj_get_subtype(test_obj);
702 AB_OBJECT_TYPE cur_obj_type = connP_get_target_type();
703 int cur_obj_subtype = connP_get_target_subtype();
704 ABObj mod = obj_get_module(test_obj);
707 if ((mod != NULL) && obj_has_flag(mod, MappedFlag)
708 && obj_is_defined(mod))
710 if (connP_objtype_needs_subtype(cur_obj_type, cur_obj_subtype))
712 if (!obj_is_sub(test_obj) &&
713 obj_is_defined(test_obj) &&
714 (obj_type == cur_obj_type) &&
715 (obj_subtype == cur_obj_subtype))
722 /* If the object is not a container (i.e. group,
723 * menubar, panedwindow, etc.), and the object
724 * doesn't need a subtype, either because it
725 * doesn't have one (i.e. AB_TYPE_PROJECT) or
726 * because all object subtypes should appear
727 * under one catetory (i.e. AB_TYPE_CHOICE shows
728 * optionmenus, radioboxes, and checkboxes), then
729 * search for all those objects based solely on
730 * the object type - don't care about subtype.
731 * If the object is a container and it doesn't
732 * need a subtype, then it's one of AB_CONT_FOOTER,
733 * AB_CONT_BUTTON_PANEL, AB_CONT_RELATIVE,
734 * AB_CONT_TOOL_BAR, so only count those objects.
736 if (!obj_is_container(test_obj) &&
737 !obj_is_sub(test_obj) &&
738 obj_is_defined(test_obj) &&
739 obj_type == cur_obj_type)
743 else if (obj_is_container(test_obj) &&
744 (cur_obj_type == AB_TYPE_CONTAINER)
745 && !obj_is_sub(test_obj) &&
746 obj_is_defined(test_obj) &&
747 ( (obj_subtype == AB_CONT_FOOTER) ||
748 (obj_subtype == AB_CONT_BUTTON_PANEL)||
749 (obj_subtype == AB_CONT_RELATIVE) ||
750 (obj_subtype == AB_CONT_TOOL_BAR)))
760 populate_connection_list(
764 ABObj project = proj_get_project();
765 ABObj obj = NULL, selected_conn = NULL;
767 ABObj *obj_list = (ABObj *)NULL;
770 XtSetSensitive(change_button, FALSE);
771 XtSetSensitive(delete_button, FALSE);
773 if (connection_list == NULL || project == NULL)
776 /* Save the currently selected connection in the View list */
777 selected_conn = get_cur_connection();
779 XtVaGetValues(connection_list, XmNuserData, (XtPointer)&obj_list, NULL);
780 if (obj_list != NULL)
781 XtFree((char *)obj_list);
782 obj_list = (ABObj *)NULL;
783 XtVaSetValues(connection_list, XmNuserData, (XtPointer)obj_list, NULL);
785 XmListDeselectAllItems(connection_list);
786 XmListDeleteAllItems(connection_list);
789 if (connP_get_source() != NULL &&
790 obj_get_type(connP_get_source()) != connP_get_source_type())
795 for (trav_open(&trav, project, AB_TRAV_ACTIONS);
796 (obj = trav_next(&trav)) != NULL; )
798 if (!is_action_type(obj, ConnP_view_filter))
806 XtSetSensitive(connection_list, FALSE);
811 XtSetSensitive(connection_list, TRUE);
814 obj_list = (ABObj *)XtMalloc(sizeof(ABObj) * (count+1));
815 if (obj_list == (ABObj *)NULL)
819 for (trav_open(&trav, project, AB_TRAV_ACTIONS);
820 (obj = trav_next(&trav)) != NULL; )
822 register XmString xm_item_str;
824 if (is_action_type(obj, ConnP_view_filter))
826 STRING item_str = connP_make_conn_string(obj);
828 xm_item_str = XmStringCreateLocalized(item_str);
829 XmListAddItem(connection_list, xm_item_str, 0);
830 XmStringFree(xm_item_str);
831 if ((cur_action_obj == obj) ||
832 (selected_conn && (selected_conn == obj)))
834 ui_list_select_item(connection_list, item_str, FALSE);
835 XtSetSensitive(change_button, TRUE);
836 XtSetSensitive(delete_button, TRUE);
839 obj_list[count++] = obj;
843 obj_list[count] = (ABObj)NULL;
844 XtVaSetValues(connection_list, XmNuserData, (XtPointer)obj_list, NULL);
854 BOOL ret_val = (BOOL)FALSE;
857 if (!obj_is_project(obj->info.action.from))
859 mod = obj_get_module(obj->info.action.from);
861 if (mod == NULL || !obj_has_flag(mod, MappedFlag))
867 ret_val = obj->info.action.from == connP_get_source();
871 AB_OBJECT_TYPE obj_type = ConnP_conn_objs[filter].obj_type;
872 int obj_subtype = ConnP_conn_objs[filter].obj_subtype;
874 ret_val = obj_get_type(obj->info.action.from) == obj_type;
875 if (obj_subtype != -1)
876 ret_val &= (obj_get_subtype(obj->info.action.from) == obj_subtype);
885 XtPointer client_data,
889 ConnObj *objtype_desc = (ConnObj *)client_data;
891 if (objtype_desc == (ConnObj *)NULL)
894 update_on_src_type_change(objtype_desc->obj_type,
895 objtype_desc->obj_subtype);
897 /* Reset the current source to be NULL */
898 conn_set_source((ABObj) NULL);
900 /* Reset the connections list */
901 connP_set_connection(NULL);
902 populate_connection_list(connP_get_connection());
904 /* Make When option menu inactive */
905 set_ctrls_for_src(FALSE);
907 set_conn_controls(FALSE);
913 XtPointer client_data,
917 ConnObj *objtype_desc = (ConnObj *)client_data;
919 if (objtype_desc == (ConnObj *)NULL)
922 update_on_target_type_change(objtype_desc->obj_type,
923 objtype_desc->obj_subtype);
925 /* Reset the current target to be NULL */
926 conn_set_target((ABObj) NULL);
928 /* Make action option menu and argument field inactive */
929 set_ctrls_for_target(FALSE);
931 if (!connP_conn_is_possible())
932 set_conn_controls(FALSE);
936 change_arg_sensitivity(
938 XtPointer client_data,
942 int act_cand = get_cur_act();
943 AB_BUILTIN_ACTION act_type = AB_STDACT_UNDEF;
945 if (act_cand < 0 || act_cand >= AB_BUILTIN_ACTION_NUM_VALUES)
948 XmTextFieldSetString(arg_field, "");
950 act_type = (AB_BUILTIN_ACTION)act_cand;
951 if (connP_action_needs_arg(act_type))
953 XtSetSensitive(arg_label, TRUE);
954 XtSetSensitive(arg_field, TRUE);
955 XmProcessTraversal(arg_field, XmTRAVERSE_CURRENT);
959 XtSetSensitive(arg_label, FALSE);
960 XtSetSensitive(arg_field, FALSE);
967 XtPointer client_data,
971 if (ConnP_view_filter != (int)client_data)
973 ConnP_view_filter = (int)client_data;
974 populate_connection_list(NULL);
978 /* This is the browseSelect callback for the Source
984 XtPointer client_data,
988 XmListCallbackStruct *list_cl = (XmListCallbackStruct *)call_data;
989 ABObj module = (ABObj) NULL;
990 ABObj selected_obj = (ABObj) NULL;
993 if (list_cl->reason != XmCR_BROWSE_SELECT)
998 if (name = objxm_xmstr_to_str(list_cl->item))
1000 abobj_moduled_name_extract(name, &module, &selected_obj);
1001 if (selected_obj == NULL)
1002 abobj_project_name_extract(name, &selected_obj);
1007 conn_set_source(selected_obj);
1009 /* If the object is a message, then we have to do
1010 * some special processing for the "When" optionmenu.
1011 * The reason is that the "When" optionmenu can
1012 * change when different message objects are selected
1013 * from the Source Object List. If a particular
1014 * message does not have a certain button, then that
1015 * "when" (i.e. Click Action1) is made inactive, so
1016 * another "when" should be shown instead.
1018 if (obj_is_message(selected_obj))
1020 if (obj_has_action1_button(selected_obj))
1022 XtVaSetValues(XmOptionButtonGadget(when_menu),
1023 XtVaTypedArg, XmNlabelString, XtRString,
1024 ConnP_conn_whens[0].label,
1025 strlen(ConnP_conn_whens[0].label)+1, NULL);
1027 else if (obj_has_action2_button(selected_obj))
1029 XtVaSetValues(XmOptionButtonGadget(when_menu),
1030 XtVaTypedArg, XmNlabelString, XtRString,
1031 ConnP_conn_whens[1].label,
1032 strlen(ConnP_conn_whens[1].label)+1, NULL);
1034 else if (obj_has_action3_button(selected_obj))
1036 XtVaSetValues(XmOptionButtonGadget(when_menu),
1037 XtVaTypedArg, XmNlabelString, XtRString,
1038 ConnP_conn_whens[2].label,
1039 strlen(ConnP_conn_whens[2].label)+1, NULL);
1041 else if (obj_has_cancel_button(selected_obj))
1043 XtVaSetValues(XmOptionButtonGadget(when_menu),
1044 XtVaTypedArg, XmNlabelString, XtRString,
1045 ConnP_conn_whens[3].label,
1046 strlen(ConnP_conn_whens[3].label)+1, NULL);
1050 /* If the currently selected object is a choice item,
1051 * then we have to check if it is a radio/checkbox
1052 * item or an optionmenu item. If it's a radio/checkbox
1053 * item, then set the "When" to be "Toggled" ["Activated"
1054 * is made inactive in connP_update_when_menu()]. If the
1055 * the item is an optionmenu item, then make the "When"
1056 * ["Toggled" is made inactive in connP_update_when_menu()].
1058 if (obj_is_choice_item(selected_obj))
1060 if (obj_is_option_menu(obj_get_root(obj_get_parent(selected_obj))))
1061 XtVaSetValues(XmOptionButtonGadget(when_menu),
1062 XtVaTypedArg, XmNlabelString, XtRString,
1063 ConnP_conn_whens[2].label,
1064 strlen(ConnP_conn_whens[2].label)+1, NULL);
1066 XtVaSetValues(XmOptionButtonGadget(when_menu),
1067 XtVaTypedArg, XmNlabelString, XtRString,
1068 ConnP_conn_whens[3].label,
1069 strlen(ConnP_conn_whens[3].label)+1, NULL);
1071 connP_set_connection(NULL);
1072 populate_connection_list(connP_get_connection());
1074 set_ctrls_for_src(TRUE);
1076 if (connP_conn_is_possible())
1077 set_conn_controls(TRUE);
1079 set_conn_controls(FALSE);
1087 XtPointer client_data,
1091 XmListCallbackStruct *list_cl = (XmListCallbackStruct *)call_data;
1092 ABObj module = (ABObj) NULL;
1093 ABObj selected_obj = (ABObj) NULL;
1095 AB_WHEN g_when = AB_WHEN_UNDEF;
1096 AB_FUNC_TYPE g_func = AB_FUNC_UNDEF;
1097 AB_BUILTIN_ACTION g_act = AB_STDACT_UNDEF;
1099 if (list_cl->reason != XmCR_BROWSE_SELECT)
1102 if (name = objxm_xmstr_to_str(list_cl->item))
1104 abobj_moduled_name_extract(name, &module, &selected_obj);
1109 conn_set_target(selected_obj);
1111 /* Get the default action. It can change depending
1112 * upon the source and target objects.
1114 connP_guess_when_action(connP_get_source_type(),
1115 connP_get_source_subtype(),
1116 connP_get_target_type(),
1117 connP_get_target_subtype(),
1118 &g_when, &g_func, &g_act);
1120 if (g_act != get_cur_act())
1123 set_ctrls_for_target(TRUE);
1125 if (connP_conn_is_possible())
1126 set_conn_controls(TRUE);
1128 set_conn_controls(FALSE);
1136 XtPointer client_data,
1140 XmListCallbackStruct *list_cl = (XmListCallbackStruct *)call_data;
1141 ABObj *obj_list = (ABObj *)NULL;
1143 AB_ACTION_INFO *cur_info;
1145 if (list_cl->reason != XmCR_BROWSE_SELECT)
1148 XtVaGetValues(w, XmNuserData, &obj_list, NULL);
1149 if (obj_list == NULL)
1151 if (list_cl->item_position > 0)
1152 cur_action = obj_list[list_cl->item_position-1];
1154 if (cur_action == NULL || !obj_is_action(cur_action))
1157 cur_info = &(cur_action->info.action);
1159 if (cur_info->from == NULL)
1162 XtSetSensitive(change_button, TRUE);
1163 XtSetSensitive(delete_button, TRUE);
1165 if (connP_get_source_type() != obj_get_type(cur_info->from))
1167 if (connP_objtype_needs_subtype(obj_get_type(cur_info->from),
1168 obj_get_subtype(cur_info->from)))
1170 if (connP_get_source_subtype() != obj_get_subtype(cur_info->from))
1172 conn_set_source(cur_info->from);
1173 setup_source(connP_get_source_type(),
1174 connP_get_source_subtype(),
1175 connP_get_source());
1180 conn_set_source(cur_info->from);
1181 setup_source(connP_get_source_type(),
1182 connP_get_source_subtype(),
1183 connP_get_source());
1188 conn_set_source(cur_info->from);
1189 ui_list_select_item(src_list,
1190 abobj_get_moduled_name(cur_info->from), FALSE);
1193 set_cur_when(cur_info->when);
1194 set_ctrls_for_src(TRUE);
1196 switch (cur_info->func_type)
1198 case AB_FUNC_BUILTIN:
1199 if (cur_info->to == NULL)
1201 if (connP_get_target_type() != obj_get_type(cur_info->to))
1203 if (connP_objtype_needs_subtype(obj_get_type(cur_info->to),
1204 obj_get_subtype(cur_info->to)))
1206 if (connP_get_target_subtype() != obj_get_subtype(cur_info->to))
1208 conn_set_target(cur_info->to);
1209 setup_target(connP_get_target_type(),
1210 connP_get_target_subtype(),
1211 connP_get_target());
1216 conn_set_target(cur_info->to);
1217 setup_target(connP_get_target_type(),
1218 connP_get_target_subtype(),
1219 connP_get_target());
1224 conn_set_target(cur_info->to);
1225 ui_list_select_item(target_list,
1226 abobj_get_moduled_name(cur_info->to), FALSE);
1229 set_cur_act(cur_info->func_value.builtin);
1230 set_ctrls_for_target(TRUE);
1232 if (connP_get_action_type() != AB_FUNC_BUILTIN)
1234 ui_optionmenu_change_label(action_type_opmenu,
1235 action_type_labels[ACTION_TYPE_PREDEFINED]);
1236 set_standard_action_type();
1239 switch (connP_action_needs_arg(cur_info->func_value.builtin))
1245 istr_val = cur_info->arg_value.sval;
1247 * Populate arg entries
1249 if (istr_val != NULL)
1250 XtVaSetValues(arg_field, XmNvalue,
1251 istr_string(istr_val), NULL);
1253 XtVaSetValues(arg_field, XmNvalue, "", NULL);
1259 char str_val[MAXPATHLEN];
1262 sprintf(str_val, "%d", cur_info->arg_value.ival);
1263 XtVaSetValues(arg_field, XmNvalue, str_val, NULL);
1269 case AB_FUNC_USER_DEF:
1271 STRING cur_func_name = NULL;
1272 STRING func_name = obj_get_func_name(cur_action);
1274 XtVaGetValues(arg_field, XmNvalue, &cur_func_name, NULL);
1276 set_ctrls_for_target(TRUE);
1278 if (connP_get_action_type() != AB_FUNC_USER_DEF)
1280 ui_optionmenu_change_label(action_type_opmenu,
1281 action_type_labels[ACTION_TYPE_CALLFUNC]);
1282 set_call_function_action_type();
1284 if (strcmp(cur_func_name, func_name) != 0)
1286 if (func_name != (STRING) NULL)
1287 XtVaSetValues(arg_field, XmNvalue, func_name, NULL);
1292 case AB_FUNC_CODE_FRAG:
1294 STRING code_frag = obj_get_func_code(cur_action);
1296 set_ctrls_for_target(TRUE);
1298 if (connP_get_action_type() != AB_FUNC_CODE_FRAG)
1300 ui_optionmenu_change_label(action_type_opmenu,
1301 action_type_labels[ACTION_TYPE_EXECUTE_CODE]);
1302 set_execute_code_action_type();
1304 if (!util_strempty(code_frag))
1306 char *newline = NULL;
1307 STRING first_line = NULL;
1309 XmTextSetString(exec_code_textpane, code_frag);
1310 newline = strchr(code_frag, '\n');
1315 first_line = (STRING)util_malloc(strlen(code_frag) + 4);
1318 strcpy(first_line, code_frag);
1319 strcat(first_line, "...");
1320 XmTextFieldSetString(arg_field, first_line);
1321 util_free(first_line);
1324 /* Put back the newline character */
1325 if (newline) *newline = '\n';
1328 XmTextFieldSetString(arg_field, "");
1330 ab_show_window(exec_code_dialog);
1335 case AB_FUNC_ON_ITEM_HELP:
1336 if (connP_get_action_type() != AB_FUNC_ON_ITEM_HELP)
1338 ui_optionmenu_change_label(action_type_opmenu,
1339 action_type_labels[ACTION_TYPE_ON_ITEM_HELP]);
1340 set_on_item_help_action_type();
1344 case AB_FUNC_HELP_VOLUME:
1346 STRING help_loc = obj_get_func_help_location(cur_action);
1347 STRING help_vol = obj_get_func_help_volume(cur_action);
1349 if (connP_get_action_type() != AB_FUNC_HELP_VOLUME)
1351 ui_optionmenu_change_label(action_type_opmenu,
1352 action_type_labels[ACTION_TYPE_HELP_VOLUME]);
1354 set_access_help_vol_action_type();
1356 if (help_loc != (STRING) NULL)
1357 XmTextFieldSetString(location_field, help_loc);
1358 if (help_vol != (STRING) NULL)
1359 XmTextFieldSetString(volume_field, help_vol);
1372 Widget label_wid = XmOptionButtonGadget(when_menu);
1373 XmString xm_when_label = (XmString)NULL;
1377 XtVaGetValues(label_wid, XmNlabelString, &xm_when_label, NULL);
1378 if (xm_when_label != NULL)
1379 when_label = objxm_xmstr_to_str(xm_when_label);
1381 for (i = 0; i < ConnP_num_conn_whens; i++)
1382 if (!strcmp(when_label, ConnP_conn_whens[i].label))
1385 return((int)ConnP_conn_whens[i].when_type);
1389 * Should never happen
1395 static AB_BUILTIN_ACTION
1400 Widget label_wid = XmOptionButtonGadget(action_menu);
1401 XmString xm_act_label = (XmString)NULL;
1405 XtVaGetValues(label_wid, XmNlabelString, &xm_act_label, NULL);
1406 if (xm_act_label != NULL)
1407 act_label = objxm_xmstr_to_str(xm_act_label);
1409 for (i = 0; i < ConnP_num_conn_acts; i++)
1410 if (!strcmp(act_label, ConnP_conn_acts[i].label))
1413 return(ConnP_conn_acts[i].act_type);
1417 * Should never happen
1420 return((AB_BUILTIN_ACTION)-1);
1430 for (i = 0; i < ConnP_num_conn_whens; i++)
1432 if (new_when == ConnP_conn_whens[i].when_type)
1436 if (i < ConnP_num_conn_whens)
1438 XtVaSetValues(XmOptionButtonGadget(when_menu),
1439 XtVaTypedArg, XmNlabelString, XtRString,
1440 ConnP_conn_whens[i].label, strlen(ConnP_conn_whens[i].label)+1,
1447 AB_BUILTIN_ACTION new_act
1452 for (i = 0; i < ConnP_num_conn_acts; i++)
1453 if (new_act == ConnP_conn_acts[i].act_type)
1456 if (i < ConnP_num_conn_acts)
1458 XtVaSetValues(XmOptionButtonGadget(action_menu),
1459 XtVaTypedArg, XmNlabelString, XtRString,
1460 ConnP_conn_acts[i].label, strlen(ConnP_conn_acts[i].label)+1,
1462 change_arg_sensitivity(arg_field, (XtPointer)NULL, (XtPointer)NULL);
1468 connP_ui_source_type_update(
1469 AB_OBJECT_TYPE new_type,
1473 Widget *w_list = NULL;
1475 AB_WHEN g_when = AB_WHEN_UNDEF;
1476 AB_FUNC_TYPE g_func = AB_FUNC_UNDEF;
1477 AB_BUILTIN_ACTION g_act = AB_STDACT_UNDEF;
1479 if (when_pulldown == NULL)
1484 XtVaGetValues(when_pulldown,
1485 XmNuserData, &w_list,
1493 for (i = 0; w_list[i] != NULL; i++)
1495 XtUnmanageChild(w_list[i]);
1498 for (i = 0; i < ConnP_num_conn_whens; i++)
1500 XtManageChild(w_list[ConnP_conn_whens[i].when_type - 1]);
1505 connP_ui_target_type_update(
1506 AB_OBJECT_TYPE new_type,
1510 Widget *w_list = NULL;
1513 if (action_pulldown == NULL)
1516 XtVaGetValues(action_pulldown,
1517 XmNuserData, &w_list,
1523 for (i = 0; w_list[i] != NULL; i++)
1524 XtUnmanageChild(w_list[i]);
1526 for (i = 0; i < ConnP_num_conn_acts; i++)
1527 XtManageChild(w_list[ConnP_conn_acts[i].act_type - 1]);
1535 XmString *sel_items = NULL;
1537 ABObj *obj_list = (ABObj *) NULL;
1539 ABObj ab_action = NULL;
1541 if (connection_list == NULL)
1545 * Look for selected connection
1547 XtVaGetValues(connection_list,
1548 XmNselectedItemCount, &sel_count,
1549 XmNselectedItems, &sel_items,
1550 XmNuserData, &obj_list,
1553 if (sel_count != 1 || obj_list == NULL)
1558 pos = XmListItemPos(connection_list, sel_items[0]);
1563 ab_action = obj_list[pos-1];
1568 set_standard_action_type(
1572 XmString xm_label_str;
1576 connP_set_action_type(AB_FUNC_BUILTIN);
1578 XtSetSensitive(target_menu, TRUE);
1579 XtSetSensitive(target_list, TRUE);
1580 XtManageChild(action_menu);
1582 /* It's possible that the target list has a selected
1583 * item even though it is insensitive. That means
1584 * that when the Action Type is set back to Predefined
1585 * and the target list becomes active again, then the
1586 * action optionmenu has to have the right default
1587 * action showing for the target object type selected.
1589 if (ui_list_get_selected_pos(target_list) > 0)
1591 /* If the current predefined action is not appropriate
1592 * for the current target object type, then change
1593 * it to the default action. This shouldn't happen
1596 for (i = 0; i < ConnP_num_conn_acts; i++)
1597 if (get_cur_act() == ConnP_conn_acts[i].act_type)
1602 i = connP_get_obj_type_index(connP_get_target_type(),
1603 connP_get_target_subtype());
1605 set_cur_act(ConnP_conn_objs[i].default_act);
1607 set_ctrls_for_target(TRUE);
1609 else /* No target object selected */
1611 set_ctrls_for_target(FALSE);
1614 XtManageChild(arg_rowcol);
1615 XmTextFieldSetString(arg_field, "");
1616 XmTextFieldSetEditable(arg_field, True);
1617 XtUnmanageChild(location_rowcol);
1618 XtUnmanageChild(volume_rowcol);
1619 hide_execute_code_win();
1621 xm_label_str = XmStringCreateLocalized(catgets(Dtb_project_catd,
1622 100, 54, ARGUMENT_LABEL));
1623 XtVaSetValues(arg_label, XmNlabelString, xm_label_str, NULL);
1624 XmStringFree(xm_label_str);
1626 if (connP_conn_is_possible())
1627 set_conn_controls(TRUE);
1629 set_conn_controls(FALSE);
1633 set_call_function_action_type(
1637 XmString xm_label_str;
1639 connP_set_action_type(AB_FUNC_USER_DEF);
1641 XtSetSensitive(target_menu, FALSE);
1642 XtSetSensitive(target_list, FALSE);
1643 XtManageChild(arg_rowcol);
1644 XmTextFieldSetEditable(arg_field, True);
1645 XmTextFieldSetString(arg_field, "");
1646 XtUnmanageChild(action_menu);
1647 XtUnmanageChild(volume_rowcol);
1648 XtUnmanageChild(location_rowcol);
1649 hide_execute_code_win();
1651 xm_label_str = XmStringCreateLocalized(catgets(Dtb_project_catd,
1652 100, 55, FUNCTION_LABEL));
1653 XtVaSetValues(arg_label, XmNlabelString, xm_label_str, NULL);
1654 XmStringFree(xm_label_str);
1656 XtSetSensitive(arg_label, TRUE);
1657 XtSetSensitive(arg_field, TRUE);
1658 XmProcessTraversal(arg_field, XmTRAVERSE_CURRENT);
1660 if (connP_conn_is_possible())
1661 set_conn_controls(TRUE);
1663 set_conn_controls(FALSE);
1667 set_execute_code_action_type(
1671 XmString xm_label_str;
1673 connP_set_action_type(AB_FUNC_CODE_FRAG);
1675 XtSetSensitive(target_menu, FALSE);
1676 XtSetSensitive(target_list, FALSE);
1677 XtManageChild(arg_rowcol);
1678 XmTextFieldSetEditable(arg_field, False);
1679 XmTextFieldSetString(arg_field, "");
1680 XtUnmanageChild(action_menu);
1681 XtUnmanageChild(volume_rowcol);
1682 XtUnmanageChild(location_rowcol);
1684 xm_label_str = XmStringCreateLocalized(catgets(Dtb_project_catd,
1685 100, 56, CODE_LABEL));
1686 XtVaSetValues(arg_label, XmNlabelString, xm_label_str, NULL);
1687 XmStringFree(xm_label_str);
1689 XtSetSensitive(arg_label, TRUE);
1690 XtSetSensitive(arg_field, TRUE);
1691 XmProcessTraversal(arg_field, XmTRAVERSE_CURRENT);
1693 if (connP_conn_is_possible())
1694 set_conn_controls(TRUE);
1696 set_conn_controls(FALSE);
1700 set_on_item_help_action_type(
1704 connP_set_action_type(AB_FUNC_ON_ITEM_HELP);
1706 XtSetSensitive(target_menu, FALSE);
1707 XtSetSensitive(target_list, FALSE);
1708 XtUnmanageChild(action_menu);
1709 XtUnmanageChild(arg_rowcol);
1710 XtUnmanageChild(volume_rowcol);
1711 XtUnmanageChild(location_rowcol);
1712 hide_execute_code_win();
1714 if (connP_conn_is_possible())
1715 set_conn_controls(TRUE);
1717 set_conn_controls(FALSE);
1721 set_access_help_vol_action_type(
1725 connP_set_action_type(AB_FUNC_HELP_VOLUME);
1727 XtSetSensitive(target_menu, FALSE);
1728 XtSetSensitive(target_list, FALSE);
1729 XtUnmanageChild(action_menu);
1730 XtUnmanageChild(arg_rowcol);
1731 XtManageChild(volume_rowcol);
1732 XmTextFieldSetString(volume_field, "");
1733 XtManageChild(location_rowcol);
1734 XmTextFieldSetString(location_field, "");
1735 hide_execute_code_win();
1737 if (connP_conn_is_possible())
1738 set_conn_controls(TRUE);
1740 set_conn_controls(FALSE);
1744 connP_update_on_obj_destroy(
1745 ObjEvDestroyInfo info
1748 ABObj obj = info->obj,
1750 AB_OBJECT_TYPE ab_type;
1752 ab_type = obj_get_type(obj);
1753 if (ab_type == AB_TYPE_UNDEF || ab_type == AB_TYPE_UNKNOWN)
1756 project = obj_get_project(obj);
1762 * If entire project is being destroyed, skip the cleanup
1764 if (!obj_has_flag(project, BeingDestroyedFlag))
1765 connP_destroy_connections_for(obj);
1767 if (AB_conn_dialog != (Widget)NULL)
1769 if (obj == connP_get_source())
1771 conn_set_source(NULL);
1772 set_ctrls_for_src(FALSE);
1774 if (obj == connP_get_target())
1776 conn_set_target(NULL);
1777 set_ctrls_for_target(FALSE);
1779 if (connP_obj_part_of_conn(obj, connP_get_connection()))
1781 connP_set_connection(NULL);
1785 * If obj is salient and its type is the same as that of
1786 * the current source or target type in the conn-mgr,
1787 * update the manager window
1789 abobj_list_obj_destroyed(src_list, info->obj, src_list_test);
1790 abobj_list_obj_destroyed(target_list, info->obj, target_list_test);
1791 populate_connection_list(connP_get_connection());
1793 if (connP_conn_is_possible())
1794 set_conn_controls(TRUE);
1796 set_conn_controls(FALSE);
1803 connP_update_on_obj_rename(
1804 ObjEvAttChangeInfo info
1807 ABObj obj = info->obj;
1808 AB_OBJECT_TYPE ab_type = AB_TYPE_UNDEF;
1809 ABObj module = obj_get_module(obj);
1812 if ((obj != NULL) && (AB_conn_dialog != (Widget)NULL))
1814 ab_type = obj_get_type(obj);
1815 if ((ab_type != AB_TYPE_UNDEF) && (ab_type != AB_TYPE_UNKNOWN)
1816 && !obj_is_project(obj))
1818 /* Replace the items in the Source and Target lists
1819 * whose module name has changed or the object name
1822 abobj_list_obj_renamed(src_list, obj,
1823 istr_string(info->old_name), src_list_test);
1824 abobj_list_obj_renamed(target_list, obj,
1825 istr_string(info->old_name), target_list_test);
1827 /* Update the Connections list. An object's name
1828 * or an object's module name may have changed
1829 * and if it is part of a connection that is showing
1830 * in the list, it has to be replaced.
1832 populate_connection_list(connP_get_connection());
1839 /* Handles module show/hide and Undo of deleted object */
1841 connP_update_on_show_status(
1842 ObjEvUpdateInfo info
1845 ABObj obj = info->obj;
1846 ABObj conn = NULL, cur_conn_src_mod = NULL;
1847 ABObj cur_conn_target_mod = NULL;
1848 ABObj src_mod = NULL, target_mod = NULL;
1851 util_dprintf(3, "object updated: %s\n", obj_get_name(info->obj));
1853 if ((obj != NULL) && (AB_conn_dialog != (Widget) NULL))
1855 /* Update the Source, Target, and Connections lists */
1857 abobj_list_obj_updated(src_list, info, src_list_test);
1858 abobj_list_obj_updated(target_list, info, target_list_test);
1859 populate_connection_list(connP_get_connection());
1861 /* A module is being hidden */
1862 if (obj_is_module(obj) && !obj_has_flag(obj, MappedFlag))
1864 src_mod = obj_get_module(connP_get_source());
1867 conn_set_source(NULL);
1868 set_ctrls_for_src(FALSE);
1870 target_mod = obj_get_module(connP_get_target());
1871 if (target_mod == obj)
1873 conn_set_target(NULL);
1874 if (connP_get_action_type() == AB_FUNC_BUILTIN)
1875 set_ctrls_for_target(FALSE);
1877 set_ctrls_for_target(TRUE);
1880 if (conn = connP_get_connection())
1882 cur_conn_src_mod = obj_get_module(obj_get_from(conn));
1883 cur_conn_target_mod = obj_get_module(obj_get_to(conn));
1884 if ((obj == cur_conn_src_mod) ||
1885 (obj == cur_conn_target_mod))
1887 connP_set_connection(NULL);
1890 if (connP_conn_is_possible())
1891 set_conn_controls(TRUE);
1893 set_conn_controls(FALSE);
1902 connP_conn_is_possible()
1904 BOOL ConnIsPossible = FALSE;
1905 ABObj source = NULL,
1908 source = connP_get_source();
1909 target = connP_get_target();
1911 switch (connP_get_action_type())
1913 case AB_FUNC_BUILTIN:
1914 if ( (source != NULL) && (target != NULL) )
1916 /* If the source object is a message
1917 * but the message doesn't have an
1918 * Action1, Action2, Action3, or a
1919 * Cancel button, then a connection
1920 * cannot be made on that message.
1922 if (obj_is_message(source))
1924 if ( obj_has_action1_button(source) ||
1925 obj_has_action2_button(source) ||
1926 obj_has_action3_button(source) ||
1927 obj_has_cancel_button(source)
1930 ConnIsPossible = TRUE;
1935 ConnIsPossible = TRUE;
1940 case AB_FUNC_USER_DEF:
1941 case AB_FUNC_CODE_FRAG:
1944 if (obj_is_message(source))
1946 if ( obj_has_action1_button(source) ||
1947 obj_has_action2_button(source) ||
1948 obj_has_action3_button(source) ||
1949 obj_has_cancel_button(source)
1952 ConnIsPossible = TRUE;
1957 ConnIsPossible = TRUE;
1962 case AB_FUNC_ON_ITEM_HELP:
1963 case AB_FUNC_HELP_VOLUME:
1964 if ((source != NULL) && obj_is_menu_item(source))
1966 ConnIsPossible = TRUE;
1972 return (ConnIsPossible);
1980 XtSetSensitive(connect_button, state);
1984 ** validate a builtin connection's AB_ARG_STRING
1986 ** called from connP_make_connection()
1989 verify_builtin_arg_string(
1990 AB_BUILTIN_ACTION c_act,
1997 if (!c_act || !c_target || !field ||
1998 (connP_get_action_type() != AB_FUNC_BUILTIN) ||
1999 (connP_action_needs_arg(c_act) != AB_ARG_STRING))
2006 case AB_STDACT_DISABLE:
2007 case AB_STDACT_ENABLE:
2008 case AB_STDACT_HIDE:
2012 case AB_STDACT_SET_LABEL:
2014 ** cmvc 7896: set-label conn doesn't work on graphic
2016 switch (obj_get_label_type(c_target))
2018 case AB_LABEL_GLYPH:
2019 /* validate graphic filename */
2020 if (prop_graphic_filename_ok(field, False))
2024 case AB_LABEL_ARROW_DOWN: /* are these really valid? */
2025 case AB_LABEL_ARROW_LEFT:
2026 case AB_LABEL_ARROW_RIGHT:
2027 case AB_LABEL_ARROW_UP:
2028 case AB_LABEL_DRAWN:
2029 case AB_LABEL_SEPARATOR:
2033 case AB_LABEL_STRING:
2037 case AB_LABEL_UNDEF:
2038 case AB_LABEL_TYPE_NUM_VALUES:
2044 case AB_STDACT_SET_TEXT:
2045 case AB_STDACT_SET_VALUE:
2046 case AB_STDACT_SHOW:
2050 case AB_STDACT_UNDEF:
2051 case AB_BUILTIN_ACTION_NUM_VALUES:
2060 /*** DTB_USER_CODE_END
2062 *** End of user code section
2064 **************************************************************************/
2071 XtPointer clientData,
2075 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2076 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)clientData;
2077 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2079 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2081 /* If secondary Execute code dialog is open, close it also
2082 * to ensure correct window state tracking
2084 if (exec_code_dialog && ab_window_is_open(exec_code_dialog))
2085 ui_win_show(exec_code_dialog, False, XtGrabNone);
2087 ui_win_show(AB_conn_dialog, False, XtGrabNone);
2089 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2094 connP_make_connection(
2096 XtPointer clientData,
2100 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2102 char *str_value = (char *)NULL;
2103 ABObj ab_action = (ABObj)NULL;
2107 BOOL is_cross_module = (BOOL)FALSE;
2108 STRING vol_value = NULL,
2112 if ((c_source = connP_get_source()) == NULL ||
2113 connP_get_source_type() != obj_get_type(c_source))
2116 c_when = (AB_WHEN)get_cur_when();
2118 switch (connP_get_action_type())
2120 case AB_FUNC_BUILTIN:
2121 if ((c_target = connP_get_target()) != NULL &&
2122 connP_get_target_type() == obj_get_type(c_target))
2124 AB_BUILTIN_ACTION c_act = (AB_BUILTIN_ACTION)get_cur_act();
2126 ab_action = obj_create(AB_TYPE_ACTION, NULL);
2128 switch (connP_action_needs_arg(c_act))
2134 if (!verify_builtin_arg_string(c_act, c_target, arg_field))
2137 XtVaGetValues(arg_field, XmNvalue, &str_value, NULL);
2138 if (str_value != (char *)NULL)
2139 connP_set_conn_arg(ab_action, AB_ARG_STRING, str_value);
2143 if (!prop_number_ok(arg_field, "Argument Field",
2144 obj_get_min_value(c_target),
2145 obj_get_max_value(c_target)))
2149 XtVaGetValues(arg_field, XmNvalue, &str_value, NULL);
2150 if (str_value != (char *)NULL)
2151 connP_set_conn_arg(ab_action, AB_ARG_INT, str_value);
2157 connP_make_builtin_conn(ab_action, c_source, c_target, c_when,
2160 /* Set SaveNeeded flag */
2161 if (obj_get_module(c_source) == obj_get_module(c_target))
2163 abobj_set_save_needed(obj_get_module(c_source), TRUE);
2167 abobj_set_save_needed(obj_get_project(c_source), TRUE);
2168 is_cross_module = TRUE;
2173 case AB_FUNC_USER_DEF:
2175 * Populate function name
2177 XtVaGetValues(arg_field, XmNvalue, &str_value, NULL);
2178 if (!util_strempty(str_value))
2180 ab_action = obj_create(AB_TYPE_ACTION, NULL);
2181 connP_make_user_def_conn(ab_action, c_source, c_when, str_value);
2183 /* Set SaveNeeded flag */
2184 abobj_set_save_needed(obj_is_project(c_source)? c_source :
2185 obj_get_module(c_source), TRUE);
2189 dtb_conn_no_func_msg_initialize(&dtb_conn_no_func_msg);
2190 (void)dtb_show_modal_message(dtb_get_toplevel_widget(),
2191 &dtb_conn_no_func_msg, NULL, NULL, NULL);
2195 case AB_FUNC_CODE_FRAG:
2197 * Populate code fragment
2199 str_value = CodeFragBuf;
2200 if (!util_strempty(str_value))
2202 ab_action = obj_create(AB_TYPE_ACTION, NULL);
2203 connP_make_code_frag_conn(ab_action, c_source, c_when, str_value);
2205 /* Set SaveNeeded flag */
2206 abobj_set_save_needed(obj_is_project(c_source)? c_source :
2207 obj_get_module(c_source), TRUE);
2211 case AB_FUNC_ON_ITEM_HELP:
2212 ab_action = obj_create(AB_TYPE_ACTION, NULL);
2213 connP_make_on_item_help_conn(ab_action, c_source, c_when);
2215 /* Set SaveNeeded flag */
2216 abobj_set_save_needed(obj_get_module(c_source), TRUE);
2219 case AB_FUNC_HELP_VOLUME:
2220 XtVaGetValues(volume_field, XmNvalue, &vol_value, NULL);
2221 XtVaGetValues(location_field, XmNvalue, &loc_value, NULL);
2222 ab_action = obj_create(AB_TYPE_ACTION, NULL);
2223 connP_make_help_vol_conn(ab_action, c_source,
2224 c_when, vol_value, loc_value);
2226 /* Set SaveNeeded flag */
2227 abobj_set_save_needed(obj_get_module(c_source), TRUE);
2231 if (ab_action != (ABObj)NULL)
2233 if (is_cross_module)
2235 obj_add_action(obj_get_project(c_source), ab_action);
2239 obj_add_action(obj_is_project(c_source)? c_source :
2240 obj_get_module(c_source), ab_action);
2242 connP_set_connection(ab_action);
2244 * cmvc 4359 - make View: be Source Object, if it is not already or
2245 * if the View: is not the Source: connection being made.
2247 if (!((ConnP_view_filter == -1) ||
2248 (ConnP_view_filter == connP_get_obj_type_index(connP_get_source_type(), connP_get_source_subtype())))
2251 ConnP_view_filter = -1;
2252 XtVaSetValues(view_menu,
2253 XmNmenuHistory, ConnP_view_source_obj,
2256 populate_connection_list(connP_get_connection());
2259 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2261 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2262 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2267 connP_change_connection(
2269 XtPointer clientData,
2273 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2277 AB_BUILTIN_ACTION c_act;
2281 AB_FUNC_TYPE cur_func_type;
2282 char *str_value = (char *)NULL;
2283 STRING loc_value = (STRING) NULL,
2284 vol_value = (STRING) NULL;
2285 ISTRING istr_value = (ISTRING)NULL,
2286 istr_loc_value = (ISTRING)NULL,
2287 istr_vol_value = (ISTRING)NULL;
2289 if ((ab_action = get_cur_connection()) == NULL)
2291 if ((c_source = connP_get_source()) == NULL)
2293 if (connP_get_source_type() != obj_get_type(c_source))
2296 c_when = (AB_WHEN)get_cur_when();
2299 * Match contents of selected action with
2300 * current selections on the connections manager.
2304 cur_func_type = connP_get_action_type();
2305 switch (cur_func_type)
2307 /**************************************************
2308 * Switching the action (function) type to *
2309 * Predefined Action. *
2310 **************************************************/
2311 case AB_FUNC_BUILTIN:
2312 c_act = get_cur_act();
2313 if ((c_target = connP_get_target()) == NULL ||
2314 connP_get_target_type() != obj_get_type(c_target))
2317 switch (ab_action->info.action.func_type)
2319 /* Switching func type from predefined action
2320 * to predefined action.
2322 case AB_FUNC_BUILTIN:
2323 if (connP_action_needs_arg(c_act) == AB_ARG_INT)
2325 if (!prop_number_ok(arg_field, "Argument Field",
2326 obj_get_min_value(c_target),
2327 obj_get_max_value(c_target)))
2332 str_value = XmTextFieldGetString(arg_field);
2333 is_changed = connP_change_in_builtin(ab_action,
2334 c_source, c_target, c_when,
2335 get_cur_act(), str_value);
2336 if (!util_strempty(str_value))
2340 /* Switching func type from call-function to
2341 * predefined action.
2343 case AB_FUNC_USER_DEF:
2345 if (ab_action->info.action.func_value.func_name != (ISTRING)NULL)
2346 istr_destroy(ab_action->info.action.func_value.func_name);
2347 connP_make_builtin_conn(ab_action, c_source, c_target,
2351 /* Switching func type from execute-code to
2352 * predefined action.
2354 case AB_FUNC_CODE_FRAG:
2356 XmTextFieldSetString(arg_field, "");
2357 XmTextSetString(exec_code_textpane, "");
2358 if (ab_action->info.action.func_value.code_frag != (ISTRING)NULL)
2359 istr_destroy(ab_action->info.action.func_value.code_frag);
2360 connP_make_builtin_conn(ab_action, c_source, c_target,
2364 /* Switching func type from activate-on-item-help to
2365 * predefined action.
2367 case AB_FUNC_ON_ITEM_HELP:
2369 connP_make_builtin_conn(ab_action, c_source, c_target,
2373 /* Switching func type from access-help-volume to
2374 * predefined action.
2376 case AB_FUNC_HELP_VOLUME:
2378 if (ab_action->info.action.location != (ISTRING)NULL)
2379 istr_destroy(ab_action->info.action.location);
2380 if (ab_action->info.action.volume_id != (ISTRING)NULL)
2381 istr_destroy(ab_action->info.action.volume_id);
2382 connP_make_builtin_conn(ab_action, c_source, c_target,
2384 XmTextFieldSetString(location_field, "");
2385 XmTextFieldSetString(volume_field, "");
2388 if (is_changed == TRUE)
2390 if (obj_get_module(c_source) == obj_get_module(c_target))
2392 abobj_set_save_needed(obj_is_project(c_source)?
2393 c_source : obj_get_module(c_source), TRUE);
2395 else /* This is a cross-module connection */
2397 abobj_set_save_needed(obj_is_project(c_source)?
2398 c_source : obj_get_module(c_source), TRUE);
2403 /**************************************************
2404 * Switching the action (function) type to *
2406 **************************************************/
2407 case AB_FUNC_USER_DEF:
2408 str_value = XmTextFieldGetString(arg_field);
2409 if (str_value == (char *)NULL)
2412 switch (ab_action->info.action.func_type)
2414 /* Switching func type from call-function to
2417 case AB_FUNC_USER_DEF:
2418 istr_value = istr_create(str_value);
2419 if (ab_action->info.action.func_value.func_name != istr_value)
2422 istr_destroy(ab_action->info.action.func_value.func_name);
2424 if (c_when != obj_get_when(ab_action))
2429 connP_make_user_def_conn(ab_action, c_source, c_when, str_value);
2430 abobj_set_save_needed(obj_is_project(c_source)?
2431 c_source : obj_get_module(c_source), TRUE);
2435 /* Switching func type from Predefined-action to
2438 case AB_FUNC_BUILTIN:
2439 connP_builtin_remove_arg(ab_action);
2441 connP_make_user_def_conn(ab_action, c_source, c_when, str_value);
2442 abobj_set_save_needed(obj_is_project(c_source)? c_source :
2443 obj_get_module(c_source), TRUE);
2446 /* Switching func type from Execute-code to
2449 case AB_FUNC_CODE_FRAG:
2451 XmTextFieldSetString(arg_field, "");
2452 XmTextSetString(exec_code_textpane, "");
2453 if (ab_action->info.action.func_value.code_frag != (ISTRING)NULL)
2454 istr_destroy(ab_action->info.action.func_value.code_frag);
2455 connP_make_user_def_conn(ab_action, c_source, c_when, str_value);
2456 abobj_set_save_needed(obj_is_project(c_source)? c_source :
2457 obj_get_module(c_source), TRUE);
2460 /* Switching func type from activate-on-item-help to
2463 case AB_FUNC_ON_ITEM_HELP:
2465 connP_make_user_def_conn(ab_action, c_source, c_when, str_value);
2466 abobj_set_save_needed(obj_is_project(c_source)?
2467 c_source : obj_get_module(c_source), TRUE);
2470 /* Switching func type from access-help-volume to
2473 case AB_FUNC_HELP_VOLUME:
2475 if (ab_action->info.action.location != (ISTRING) NULL)
2476 istr_destroy(ab_action->info.action.location);
2477 if (ab_action->info.action.volume_id != (ISTRING) NULL)
2478 istr_destroy(ab_action->info.action.volume_id);
2479 connP_make_user_def_conn(ab_action, c_source, c_when, str_value);
2480 abobj_set_save_needed(obj_is_project(c_source)?
2481 c_source : obj_get_module(c_source), TRUE);
2482 XmTextFieldSetString(location_field, "");
2483 XmTextFieldSetString(volume_field, "");
2490 /**************************************************
2491 * Switching the action (function) type to *
2493 **************************************************/
2494 case AB_FUNC_CODE_FRAG:
2495 str_value = CodeFragBuf;
2496 if (str_value == (STRING) NULL)
2499 switch (ab_action->info.action.func_type)
2501 /* Switching func type from Predefined Action to
2504 case AB_FUNC_BUILTIN:
2505 connP_builtin_remove_arg(ab_action);
2507 connP_make_code_frag_conn(ab_action, c_source, c_when, str_value);
2508 abobj_set_save_needed(obj_is_project(c_source)? c_source :
2509 obj_get_module(c_source), TRUE);
2512 /* Switching func type from Call-Function to
2515 case AB_FUNC_USER_DEF:
2516 if (ab_action->info.action.func_value.func_name != (ISTRING)NULL)
2517 istr_destroy(ab_action->info.action.func_value.func_name);
2519 connP_make_code_frag_conn(ab_action, c_source, c_when, str_value);
2520 abobj_set_save_needed(obj_is_project(c_source)? c_source :
2521 obj_get_module(c_source), TRUE);
2524 /* Switching func type from Execute Code to
2527 case AB_FUNC_CODE_FRAG:
2528 istr_value = istr_create(str_value);
2529 if (ab_action->info.action.func_value.code_frag != istr_value)
2532 istr_destroy(ab_action->info.action.func_value.code_frag);
2534 if (c_when != obj_get_when(ab_action))
2539 connP_make_code_frag_conn(ab_action, c_source, c_when, str_value);
2540 abobj_set_save_needed(obj_is_project(c_source)?
2541 c_source : obj_get_module(c_source), TRUE);
2545 /* Switching func type from activate-on-item-help to
2548 case AB_FUNC_ON_ITEM_HELP:
2550 connP_make_code_frag_conn(ab_action, c_source, c_when, str_value);
2551 abobj_set_save_needed(obj_is_project(c_source)?
2552 c_source : obj_get_module(c_source), TRUE);
2555 /* Switching func type from access-help-volume to
2558 case AB_FUNC_HELP_VOLUME:
2560 if (ab_action->info.action.location != (ISTRING)NULL)
2561 istr_destroy(ab_action->info.action.location);
2562 if (ab_action->info.action.volume_id != (ISTRING)NULL)
2563 istr_destroy(ab_action->info.action.volume_id);
2564 connP_make_code_frag_conn(ab_action, c_source, c_when, str_value);
2565 abobj_set_save_needed(obj_is_project(c_source)?
2566 c_source : obj_get_module(c_source), TRUE);
2567 XmTextFieldSetString(location_field, "");
2568 XmTextFieldSetString(volume_field, "");
2575 /**************************************************
2576 * Switching the action (function) type to *
2577 * 'Activate On-Item Help'. *
2578 **************************************************/
2579 case AB_FUNC_ON_ITEM_HELP:
2580 switch (ab_action->info.action.func_type)
2582 /* Switching func type from activate-on-item-help
2583 * to activate-on-item-help.
2585 case AB_FUNC_ON_ITEM_HELP:
2586 if (c_when != obj_get_when(ab_action))
2589 connP_make_on_item_help_conn(ab_action, c_source, c_when);
2590 abobj_set_save_needed(obj_is_project(c_source)?
2591 c_source : obj_get_module(c_source), TRUE);
2595 /* Switching func type from call-function to
2596 * activate-on-item-help.
2598 case AB_FUNC_USER_DEF:
2600 if (ab_action->info.action.func_value.func_name != (ISTRING) NULL)
2601 istr_destroy(ab_action->info.action.func_value.func_name);
2602 connP_make_on_item_help_conn(ab_action, c_source, c_when);
2603 abobj_set_save_needed(obj_is_project(c_source)? c_source :
2604 obj_get_module(c_source), TRUE);
2605 XmTextFieldSetString(arg_field, "");
2608 /* Switching func type from predefined-action to
2609 * activate-on-item-help.
2611 case AB_FUNC_BUILTIN:
2613 connP_builtin_remove_arg(ab_action);
2614 connP_make_on_item_help_conn(ab_action, c_source, c_when);
2615 abobj_set_save_needed(obj_is_project(c_source)?
2616 c_source : obj_get_module(c_source), TRUE);
2617 XmTextFieldSetString(arg_field, "");
2620 /* Switching func type from execute-code to
2621 * activate-on-item-help.
2623 case AB_FUNC_CODE_FRAG:
2625 if (ab_action->info.action.func_value.code_frag != (ISTRING)NULL)
2626 istr_destroy(ab_action->info.action.func_value.code_frag);
2627 connP_make_on_item_help_conn(ab_action, c_source, c_when);
2628 abobj_set_save_needed(obj_is_project(c_source)?
2629 c_source : obj_get_module(c_source), TRUE);
2630 XmTextFieldSetString(arg_field, "");
2631 XmTextSetString(exec_code_textpane, "");
2634 /* Switching func type from access-help-volume to
2635 * activate-on-item-help.
2637 case AB_FUNC_HELP_VOLUME:
2639 if (ab_action->info.action.location != (ISTRING) NULL)
2640 istr_destroy(ab_action->info.action.location);
2641 if (ab_action->info.action.volume_id != (ISTRING) NULL)
2642 istr_destroy(ab_action->info.action.volume_id);
2643 connP_make_on_item_help_conn(ab_action, c_source, c_when);
2644 abobj_set_save_needed(obj_is_project(c_source)?
2645 c_source : obj_get_module(c_source), TRUE);
2646 XmTextFieldSetString(location_field, "");
2647 XmTextFieldSetString(volume_field, "");
2652 /**************************************************
2653 * Switching the action (function) type to *
2654 * 'Access Help Volume'. *
2655 **************************************************/
2656 case AB_FUNC_HELP_VOLUME:
2657 loc_value = XmTextFieldGetString(location_field);
2658 vol_value = XmTextFieldGetString(volume_field);
2659 if (loc_value == (STRING)NULL || (vol_value == (STRING)NULL))
2662 switch (ab_action->info.action.func_type)
2664 /* Switching func type from call-function to
2665 * access-help-volume.
2667 case AB_FUNC_USER_DEF:
2669 if (ab_action->info.action.func_value.func_name != (ISTRING) NULL)
2670 istr_destroy(ab_action->info.action.func_value.func_name);
2671 connP_make_help_vol_conn(ab_action, c_source, c_when,
2672 vol_value, loc_value);
2673 abobj_set_save_needed(obj_is_project(c_source)?
2674 c_source : obj_get_module(c_source), TRUE);
2675 XmTextFieldSetString(arg_field, "");
2678 /* Switching func type from predefined-action to
2679 * access-help-volume.
2681 case AB_FUNC_BUILTIN:
2683 connP_builtin_remove_arg(ab_action);
2684 connP_make_help_vol_conn(ab_action, c_source, c_when,
2685 vol_value, loc_value);
2686 abobj_set_save_needed(obj_is_project(c_source)?
2687 c_source : obj_get_module(c_source), TRUE);
2688 XmTextFieldSetString(arg_field, "");
2691 /* Switching func type from execute-code to
2692 * access-help-volume.
2694 case AB_FUNC_CODE_FRAG:
2696 if (ab_action->info.action.func_value.code_frag != (ISTRING)NULL)
2697 istr_destroy(ab_action->info.action.func_value.code_frag);
2698 connP_make_help_vol_conn(ab_action, c_source, c_when,
2699 vol_value, loc_value);
2700 abobj_set_save_needed(obj_is_project(c_source)?
2701 c_source : obj_get_module(c_source), TRUE);
2702 XmTextFieldSetString(arg_field, "");
2703 XmTextSetString(exec_code_textpane, "");
2706 /* Switching func type from access-help-volume to
2707 * access-help-volume.
2709 case AB_FUNC_HELP_VOLUME:
2710 istr_loc_value = istr_create(loc_value);
2711 istr_vol_value = istr_create(vol_value);
2712 if (ab_action->info.action.location != istr_loc_value)
2715 istr_destroy(ab_action->info.action.location);
2717 if (ab_action->info.action.volume_id != istr_vol_value)
2720 istr_destroy(ab_action->info.action.volume_id);
2722 if (c_when != obj_get_when(ab_action))
2727 connP_make_help_vol_conn(ab_action, c_source, c_when,
2728 vol_value, loc_value);
2729 abobj_set_save_needed(obj_is_project(c_source)?
2730 c_source : obj_get_module(c_source), TRUE);
2738 if (is_changed == TRUE)
2740 connP_set_connection(ab_action);
2741 populate_connection_list(connP_get_connection());
2744 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2746 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2747 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2752 connP_delete_connection(
2754 XtPointer clientData,
2758 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2761 ABObj source, target;
2763 if ((ab_action = get_cur_connection()) == NULL)
2766 source = ab_action->info.action.from;
2767 target = ab_action->info.action.to;
2769 /* Set the SaveNeededFlag on the module, if it is an
2770 * intra-module connection. Otherwise set it on the
2771 * project, since it is a cross-module connection which
2772 * is stored in the .bip file.
2774 if ( obj_get_module(source) == obj_get_module(target) )
2776 abobj_set_save_needed(obj_is_project(source)? source :
2777 obj_get_module(source), TRUE);
2779 else /* This is a cross-module connection */
2781 abobj_set_save_needed(obj_is_project(source)? source :
2782 obj_get_module(source), TRUE);
2785 obj_destroy(ab_action);
2786 connP_set_connection(NULL);
2787 populate_connection_list(connP_get_connection());
2789 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2791 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2792 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2797 connP_register_connect_button(
2799 XtPointer clientData,
2803 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
2805 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2807 /* Make Connect button initially inactive */
2808 XtSetSensitive(dtbSource->connect_button, FALSE);
2809 connect_button = dtbSource->connect_button;
2811 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2813 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2814 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2819 connP_register_change_button(
2821 XtPointer clientData,
2825 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
2827 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2828 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2830 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2832 /* Make Change button initially inactive */
2833 XtSetSensitive(dtbSource->change_button, FALSE);
2834 change_button = dtbSource->change_button;
2836 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2841 connP_register_cancel_button(
2843 XtPointer clientData,
2847 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
2849 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2850 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2852 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2854 cancel_button = dtbSource->cancel_button;
2856 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2861 connP_register_delete_button(
2863 XtPointer clientData,
2867 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
2869 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2871 /* Make Delete button initially inactive */
2872 XtSetSensitive(dtbSource->delete_button, FALSE);
2873 delete_button = dtbSource->delete_button;
2875 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2877 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2878 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2883 connP_register_source_choices(
2885 XtPointer clientData,
2889 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
2891 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2894 * jit - Workaround for dtcodegen bug:
2895 * does not set XmNsubMenuId if Option Menu has 0 items
2897 XtVaSetValues(widget, XmNsubMenuId, dtbSource->source_choices_menu, NULL);
2899 src_menu = dtbSource->source_choices;
2900 populate_src_menu(dtbSource->source_choices_menu, NULL, NULL);
2902 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2904 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2905 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2910 connP_register_target_choices(
2912 XtPointer clientData,
2916 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
2918 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2921 * jit - Workaround for dtcodegen bug:
2922 * does not set XmNsubMenuId if Option Menu has 0 items
2924 XtVaSetValues(widget, XmNsubMenuId, dtbSource->target_choices_menu, NULL);
2926 target_menu = dtbSource->target_choices;
2927 populate_target_menu(dtbSource->target_choices_menu, NULL, NULL);
2929 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2931 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2932 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2937 connP_register_when_choices(
2939 XtPointer clientData,
2943 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
2945 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2948 * jit - Workaround for dtcodegen bug:
2949 * does not set XmNsubMenuId if Option Menu has 0 items
2951 XtVaSetValues(widget, XmNsubMenuId, dtbSource->when_choices_menu, NULL);
2953 when_menu = dtbSource->when_choices;
2954 populate_when_menu(dtbSource->when_choices_menu, NULL, NULL);
2955 XtAddCallback(XtParent(dtbSource->when_choices_menu),
2956 XmNpopupCallback, connP_update_when_menu,
2959 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2961 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2962 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2967 connP_register_predef_act_choices(
2969 XtPointer clientData,
2973 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
2975 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2978 * jit - Workaround for dtcodegen bug:
2979 * does not set XmNsubMenuId if Option Menu has 0 items
2981 XtVaSetValues(widget, XmNsubMenuId, dtbSource->predef_act_choices_menu, NULL)
2984 action_menu = dtbSource->predef_act_choices;
2985 populate_action_menu(dtbSource->predef_act_choices_menu, NULL, NULL);
2986 XtAddCallback(XtParent(dtbSource->predef_act_choices_menu),
2987 XmNpopupCallback, connP_update_action_menu,
2990 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
2992 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2993 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
2998 connP_register_view_choices(
3000 XtPointer clientData,
3004 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3006 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3009 * jit - Workaround for dtcodegen bug:
3010 * does not set XmNsubMenuId if Option Menu has 0 items
3012 XtVaSetValues(widget, XmNsubMenuId, dtbSource->view_choices_menu, NULL);
3014 view_menu = dtbSource->view_choices;
3015 populate_view_menu(dtbSource->view_choices_menu, NULL, NULL);
3017 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3019 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3020 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3025 connP_register_source_list(
3027 XtPointer clientData,
3031 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3033 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3035 src_list = dtbSource->source_list;
3036 XtAddCallback(dtbSource->source_list, XmNbrowseSelectionCallback,
3037 update_cur_src, NULL);
3039 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3041 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3042 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3047 connP_register_target_list(
3049 XtPointer clientData,
3053 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3055 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3057 target_list = dtbSource->target_list;
3058 XtAddCallback(dtbSource->target_list, XmNbrowseSelectionCallback,
3059 update_cur_target, NULL);
3061 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3063 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3064 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3069 connP_register_conn_list(
3071 XtPointer clientData,
3075 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3077 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3079 connection_list = dtbSource->conn_list;
3080 XtAddCallback(dtbSource->conn_list, XmNbrowseSelectionCallback,
3081 select_connection, NULL);
3083 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3085 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3086 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3091 connP_register_arg_field(
3093 XtPointer clientData,
3097 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3099 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3101 arg_rowcol = dtbSource->arg_field_rowcolumn;
3102 arg_label = dtbSource->arg_field_label;
3103 arg_field = dtbSource->arg_field;
3105 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3107 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3108 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3113 connP_register_action_Predefined_item(
3115 XtPointer clientData,
3119 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3121 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3123 std_action_item = dtbSource->action_type_choices_items.Predefined_item;
3125 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3127 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3128 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3133 connP_register_action_Call_Function_item(
3135 XtPointer clientData,
3139 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3141 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3143 call_function_item =
3144 dtbSource->action_type_choices_items.Call_Function_item;
3146 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3148 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3149 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3154 connP_register_action_Execute_Code_item(
3156 XtPointer clientData,
3160 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3162 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3165 dtbSource->action_type_choices_items.Execute_Code_item;
3167 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3169 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3170 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3175 connP_show_execute_code(
3177 XtPointer clientData,
3181 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3183 DtbConnExecCodeDialogInfo dtbSource = &dtb_conn_exec_code_dialog;
3185 if (!(dtbSource->initialized))
3187 dtb_conn_exec_code_dialog_initialize(dtbSource, dtb_palette_ab_palette_main.ab_palette_main);
3188 init_exec_code_dialog(dtbSource);
3191 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3193 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3195 set_execute_code_action_type();
3196 ab_show_window(exec_code_dialog);
3198 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3203 connP_register_action_on_item_help_item(
3205 XtPointer clientData,
3209 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3211 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3212 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3214 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3216 on_item_help_item = widget;
3218 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3223 connP_register_action_help_vol_item(
3225 XtPointer clientData,
3229 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3231 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3232 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3234 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3236 help_volume_item = widget;
3238 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3243 connP_register_loc_textf(
3245 XtPointer clientData,
3249 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3251 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3252 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3254 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3256 location_rowcol = dtbSource->loc_textf_rowcolumn;
3257 location_field = dtbSource->loc_textf;
3259 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3264 connP_register_vol_textf(
3266 XtPointer clientData,
3270 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3272 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3273 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3275 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3277 volume_rowcol = dtbSource->vol_textf_rowcolumn;
3278 volume_field = dtbSource->vol_textf;
3280 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3285 connP_register_action_type_opmenu(
3287 XtPointer clientData,
3291 DtbConnConnDialogInfo dtbSource = (DtbConnConnDialogInfo)callData;
3293 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3295 XmString xmstr = NULL;
3296 STRING label = NULL;
3298 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3300 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3302 action_type_opmenu = widget;
3304 XtVaGetValues(std_action_item, XmNlabelString, &xmstr, NULL);
3305 action_type_labels[ACTION_TYPE_PREDEFINED] = objxm_xmstr_to_str(xmstr);
3308 XtVaGetValues(call_function_item, XmNlabelString, &xmstr, NULL);
3309 action_type_labels[ACTION_TYPE_CALLFUNC] = objxm_xmstr_to_str(xmstr);
3312 XtVaGetValues(execute_code_item, XmNlabelString, &xmstr, NULL);
3313 action_type_labels[ACTION_TYPE_EXECUTE_CODE] = objxm_xmstr_to_str(xmstr);
3316 XtVaGetValues(on_item_help_item, XmNlabelString, &xmstr, NULL);
3317 action_type_labels[ACTION_TYPE_ON_ITEM_HELP] = objxm_xmstr_to_str(xmstr);
3320 XtVaGetValues(help_volume_item, XmNlabelString, &xmstr, NULL);
3321 action_type_labels[ACTION_TYPE_HELP_VOLUME] = objxm_xmstr_to_str(xmstr);
3324 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3329 connP_enable_std_actions(
3331 XtPointer clientData,
3335 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3336 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3338 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3340 set_standard_action_type();
3342 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3347 connP_enable_call_function(
3349 XtPointer clientData,
3353 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3354 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3356 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3358 set_call_function_action_type();
3360 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3365 connP_enable_on_item_help(
3367 XtPointer clientData,
3371 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3372 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3374 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3376 set_on_item_help_action_type();
3377 if (connP_conn_is_possible())
3378 set_conn_controls(TRUE);
3380 set_conn_controls(FALSE);
3382 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3387 connP_enable_access_help_vol(
3389 XtPointer clientData,
3393 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3394 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3396 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3398 set_access_help_vol_action_type();
3399 if (connP_conn_is_possible())
3400 set_conn_controls(TRUE);
3402 set_conn_controls(FALSE);
3404 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3409 connP_exec_code_okCB(
3411 XtPointer clientData,
3415 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3417 STRING code_frag = NULL;
3418 STRING first_line = NULL;
3419 char *newline = NULL;
3420 DtbConnExecCodeDialogInfo dtbSource =
3421 (DtbConnExecCodeDialogInfo) clientData;
3423 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3425 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3427 code_frag = XmTextGetString(exec_code_textpane);
3428 if (!util_strempty(code_frag))
3431 util_free(CodeFragBuf);
3432 CodeFragBuf = strdup(code_frag);
3434 newline = strchr(code_frag, '\n');
3439 first_line = (STRING)util_malloc(strlen(code_frag) + 4);
3442 strcpy(first_line, code_frag);
3443 strcat(first_line, "...");
3444 XmTextFieldSetString(arg_field, first_line);
3445 util_free(first_line);
3451 util_free(CodeFragBuf);
3453 CodeFragBuf = strdup(code_frag);
3456 XmTextFieldSetString(arg_field, "");
3460 ui_win_show(exec_code_dialog, False, XtGrabNone);
3462 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3467 connP_exec_code_applyCB(
3469 XtPointer clientData,
3473 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3475 STRING code_frag = NULL;
3476 STRING first_line = NULL;
3477 char *newline = NULL;
3479 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3481 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3483 code_frag = XmTextGetString(exec_code_textpane);
3484 if (!util_strempty(code_frag))
3487 util_free(CodeFragBuf);
3488 CodeFragBuf = strdup(code_frag);
3490 newline = strchr(code_frag, '\n');
3495 first_line = (STRING)util_malloc(strlen(code_frag) + 4);
3498 strcpy(first_line, code_frag);
3499 strcat(first_line, "...");
3500 XmTextFieldSetString(arg_field, first_line);
3501 util_free(first_line);
3507 util_free(CodeFragBuf);
3509 CodeFragBuf = strdup(code_frag);
3512 XmTextFieldSetString(arg_field, "");
3517 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3524 XtPointer clientData,
3528 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3529 DtbConnExecCodeDialogInfo dtbSource = (DtbConnExecCodeDialogInfo)clientData;
3530 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3532 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3533 ui_win_show(exec_code_dialog, False, XtGrabNone);
3534 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3539 connP_clear_exec_dlg(
3541 XtPointer clientData,
3545 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
3546 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
3548 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
3550 XmTextSetString(exec_code_textpane, "");
3552 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
3557 /**************************************************************************
3558 *** DTB_USER_CODE_START
3560 *** All automatically-generated data and functions have been defined.
3562 *** Add new functions here, or at the top of the file.
3566 ** This function checks to see if a show-help connection can be allowed
3567 ** between any source/target object pair. The rule it implements is that
3568 ** the source object must be a push or drawn button that is a child of the
3572 allow_show_help_connection(
3577 AB_OBJECT_TYPE src_type;
3578 AB_OBJECT_TYPE target_type;
3581 if( (src_obj == (ABObj)NULL) || (target_obj == (ABObj)NULL)) return(FALSE);
3583 src_type = obj_get_type(src_obj);
3584 target_type = obj_get_type(target_obj);
3585 src_subtype = obj_get_subtype(src_obj);
3587 if( (target_type == AB_TYPE_DIALOG) &&
3588 (src_type == AB_TYPE_BUTTON) &&
3589 ((src_subtype == AB_BUT_PUSH) || (src_subtype == AB_BUT_DRAWN) ) &&
3590 (obj_get_parent_of_type(src_obj,AB_TYPE_DIALOG) == target_obj) ) {
3597 hide_execute_code_win(void)
3599 DtbConnExecCodeDialogInfo instance = &dtb_conn_exec_code_dialog;
3601 if (!(instance->initialized))
3603 dtb_conn_exec_code_dialog_initialize(instance, dtb_palette_ab_palette_main.ab_palette_main);
3604 init_exec_code_dialog(instance);
3606 ui_win_show(exec_code_dialog, False, XtGrabNone);
3609 /* This function is the popupCallback for the "When" optionmenu.
3610 * It makes certain "whens" active or inactive depending upon
3611 * the object type and the specific object selected in the list.
3614 connP_update_when_menu(
3616 XtPointer clientData,
3620 ABObj cur_obj = connP_get_source();
3621 Widget *w_list = NULL;
3623 XtVaGetValues(when_pulldown, XmNuserData, &w_list, NULL);
3630 switch (connP_get_source_type())
3632 /* If the current source object type is Choice Item,
3633 * then we have to check if the currently selected
3634 * object is a radiobox/checkbox item or if it is an
3635 * optionmenu item. If it is a radiobox/checkbox item
3636 * then "Toggled" should become active and "Activated"
3637 * should become inactive - vice versa if currently
3638 * selected object is an optionmenu item.
3641 if (obj_is_choice_item(cur_obj))
3643 if (obj_is_option_menu(obj_get_root(obj_get_parent(cur_obj))))
3645 XtSetSensitive(w_list[ConnP_conn_whens[2].when_type-1], True);
3646 XtSetSensitive(w_list[ConnP_conn_whens[3].when_type-1], False);
3650 XtSetSensitive(w_list[ConnP_conn_whens[2].when_type-1], False);
3651 XtSetSensitive(w_list[ConnP_conn_whens[3].when_type-1], True);
3656 case AB_TYPE_MESSAGE:
3657 if (cur_obj != NULL)
3659 if (!obj_has_action1_button(cur_obj))
3660 XtSetSensitive(w_list[ConnP_conn_whens[0].when_type-1],
3663 XtSetSensitive(w_list[ConnP_conn_whens[0].when_type-1],
3665 if (!obj_has_action2_button(cur_obj))
3666 XtSetSensitive(w_list[ConnP_conn_whens[1].when_type-1],
3669 XtSetSensitive(w_list[ConnP_conn_whens[1].when_type-1],
3671 if (!obj_has_action3_button(cur_obj))
3672 XtSetSensitive(w_list[ConnP_conn_whens[2].when_type-1],
3675 XtSetSensitive(w_list[ConnP_conn_whens[2].when_type-1],
3677 if (!obj_has_cancel_button(cur_obj))
3678 XtSetSensitive(w_list[ConnP_conn_whens[3].when_type-1],
3681 XtSetSensitive(w_list[ConnP_conn_whens[3].when_type-1],
3693 /* This function is the popupCallback for the "Action Type"
3697 connP_update_action_menu(
3699 XtPointer clientData,
3703 ABObj src_obj = connP_get_source();
3704 ABObj target_obj = connP_get_target();
3705 AB_OBJECT_TYPE target_type = connP_get_target_type();
3706 Widget *w_list = NULL;
3708 XtVaGetValues(action_pulldown, XmNuserData, &w_list, NULL);
3713 switch (target_type)
3715 /* If any target object of these types don't have
3716 * a label, then set "Set Label" action inactive.
3718 case AB_TYPE_CHOICE:
3719 case AB_TYPE_COMBO_BOX:
3721 case AB_TYPE_SPIN_BOX:
3723 case AB_TYPE_TEXT_FIELD:
3724 if (!obj_has_label(target_obj))
3725 XtSetSensitive(w_list[AB_STDACT_SET_LABEL-1], False);
3727 XtSetSensitive(w_list[AB_STDACT_SET_LABEL-1], True);
3734 conn_override_default_when(
3742 conn_reset_default_when(void)
3744 DefaultWhen = AB_WHEN_UNDEF;
3748 conn_override_default_action_type(
3749 AB_FUNC_TYPE func_type
3752 DefaultFuncType = func_type;
3756 conn_reset_default_action_type(void)
3758 DefaultFuncType = AB_FUNC_UNDEF;
3762 update_on_src_type_change(
3763 AB_OBJECT_TYPE obj_type,
3767 AB_WHEN g_when = AB_WHEN_UNDEF;
3768 AB_FUNC_TYPE g_func = AB_FUNC_UNDEF;
3769 AB_BUILTIN_ACTION g_act = AB_STDACT_UNDEF;
3771 if (obj_type == (AB_OBJECT_TYPE) NULL)
3774 /* Update the When option menu */
3775 connP_set_source_type(obj_type, obj_subtype);
3777 /* Get the default when and action type */
3778 (void)connP_guess_when_action(obj_type, obj_subtype,
3779 connP_get_target_type(),
3780 connP_get_target_subtype(),
3781 &g_when, &g_func, &g_act);
3783 /* Set the default when */
3784 if (DefaultWhen != AB_WHEN_UNDEF)
3785 g_when = DefaultWhen;
3787 if (g_when != get_cur_when())
3788 set_cur_when(g_when);
3790 /* Set the default Action Type */
3791 if (DefaultFuncType != AB_FUNC_UNDEF)
3792 g_func = DefaultFuncType;
3794 if (g_func == AB_FUNC_USER_DEF)
3796 ui_optionmenu_change_label(action_type_opmenu,
3797 action_type_labels[ACTION_TYPE_CALLFUNC]);
3798 set_call_function_action_type();
3802 ui_optionmenu_change_label(action_type_opmenu,
3803 action_type_labels[ACTION_TYPE_PREDEFINED]);
3804 set_standard_action_type();
3807 /* Update the Source object list and select the current
3808 * source object (if there is one) in the list.
3810 populate_list(src_list, connP_get_source(), TRUE);
3814 update_on_target_type_change(
3815 AB_OBJECT_TYPE obj_type,
3819 AB_WHEN g_when = AB_WHEN_UNDEF;
3820 AB_FUNC_TYPE g_func = AB_FUNC_UNDEF;
3821 AB_BUILTIN_ACTION g_act = AB_STDACT_UNDEF;
3823 if (obj_type == (AB_OBJECT_TYPE) NULL)
3826 /* Update the Action option menu */
3827 connP_set_target_type(obj_type, obj_subtype);
3829 /* Get the default pre-defined action */
3830 (void)connP_guess_when_action(connP_get_source_type(),
3831 connP_get_source_subtype(),
3832 obj_type, obj_subtype,
3833 &g_when, &g_func, &g_act);
3835 if (g_act != get_cur_act())
3838 /* Update the Target object list and select the current
3839 * source object (if there is one) in the list.
3841 populate_list(target_list, connP_get_target(), TRUE);
3845 update_conn_ed_controls(void)
3847 AB_WHEN g_when = AB_WHEN_UNDEF;
3848 AB_FUNC_TYPE g_func = AB_FUNC_UNDEF;
3849 AB_BUILTIN_ACTION g_act = AB_STDACT_UNDEF;
3850 AB_OBJECT_TYPE source_type = AB_TYPE_UNDEF;
3851 int source_subtype = -1;
3852 AB_OBJECT_TYPE target_type = AB_TYPE_UNDEF;
3853 int target_subtype = -1;
3856 source_type = connP_get_source_type();
3857 source_subtype = connP_get_source_subtype();
3858 i = connP_get_obj_type_index(source_type, source_subtype);
3860 target_type = connP_get_target_type();
3861 target_subtype = connP_get_target_subtype();
3862 j = connP_get_obj_type_index(target_type, target_subtype);
3864 if ((i < 0) || (j < 0)) return;
3866 /* Update the Source option menu */
3867 XtVaSetValues(XmOptionButtonGadget(src_menu),
3868 XtVaTypedArg, XmNlabelString, XtRString,
3869 ConnP_conn_objs[i].label, strlen(ConnP_conn_objs[i].label)+1,
3871 update_on_src_type_change(source_type, source_subtype);
3873 /* Update the Target option menu */
3874 XtVaSetValues(XmOptionButtonGadget(target_menu),
3875 XtVaTypedArg, XmNlabelString, XtRString,
3876 ConnP_conn_objs[j].label, strlen(ConnP_conn_objs[j].label)+1,
3878 update_on_target_type_change(target_type, target_subtype);
3880 if (connP_conn_is_possible())
3881 set_conn_controls(TRUE);
3883 set_conn_controls(FALSE);
3887 get_cur_func_type(void)
3889 Widget label_wid = XmOptionButtonGadget(action_type_opmenu);
3890 XmString xm_act_label = (XmString)NULL;
3893 AB_FUNC_TYPE func_type = AB_FUNC_UNDEF;
3895 XtVaGetValues(label_wid, XmNlabelString, &xm_act_label, NULL);
3896 if (xm_act_label != NULL)
3897 act_label = objxm_xmstr_to_str(xm_act_label);
3899 for (i = 0; i < ACTION_TYPE_NUM_VALUES; i++)
3900 if (!strcmp(act_label, action_type_labels[i]))
3905 case ACTION_TYPE_PREDEFINED:
3906 func_type = AB_FUNC_BUILTIN;
3908 case ACTION_TYPE_CALLFUNC:
3909 func_type = AB_FUNC_USER_DEF;
3911 case ACTION_TYPE_EXECUTE_CODE:
3912 func_type = AB_FUNC_CODE_FRAG;
3914 case ACTION_TYPE_ON_ITEM_HELP:
3915 func_type = AB_FUNC_ON_ITEM_HELP;
3917 case ACTION_TYPE_HELP_VOLUME:
3918 func_type = AB_FUNC_HELP_VOLUME;
3929 connP_obj_part_of_conn(
3936 if (obj && conn_obj)
3938 if (obj_get_from(conn_obj) == obj)
3940 else if (obj_get_to(conn_obj) == obj)
3951 Widget when_opmenu = XmOptionButtonGadget(when_menu);
3953 XtSetSensitive(when_opmenu, state);
3957 set_ctrls_for_target(
3961 Widget act_opmenu = XmOptionButtonGadget(action_menu);
3962 AB_FUNC_TYPE cat = connP_get_action_type();
3966 case AB_FUNC_BUILTIN:
3967 XtSetSensitive(act_opmenu, state);
3968 /* If setting the action option menu active,
3969 * then we have to look at the action to
3970 * determine if the argument field should
3971 * also become active.
3975 change_arg_sensitivity(arg_field,
3976 (XtPointer) NULL, (XtPointer) NULL);
3980 XtSetSensitive(arg_label, state);
3981 XtSetSensitive(arg_field, state);
3985 case AB_FUNC_USER_DEF:
3986 case AB_FUNC_CODE_FRAG:
3987 XtSetSensitive(arg_label, state);
3988 XtSetSensitive(arg_field, state);
3995 /*** DTB_USER_CODE_END
3997 *** End of user code section
3999 **************************************************************************/