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: cgen_props_stubs.c /main/4 1996/04/18 13:17:49 drk $
27 * @(#)cgen_props_stubs.c 1.24 21 Mar 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: cgen_props_stubs.c
47 * Contains: Module callbacks and connection functions
49 * This file was generated by dtcodegen, from module cgen_props
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 "cgen_props_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.
78 #include <Xm/RowColumn.h>
80 #include "dtbuilder.h"
81 #include "cgen_props_ui.h"
82 #include "palette_ui.h"
84 #include <ab_private/objxm.h>
85 #include <ab_private/proj.h>
86 #include <ab_private/util.h>
87 #include <ab_private/cgen.h>
88 #include <ab_private/strlist.h>
89 #include "dtb_utils.h"
92 * Definition of global widgets used by callbacks.
94 CGenOptions CodeGenOptions = {
101 CG_GEN_FLAG CodeGenCmd = CG_GEN_PROJ_FLAG;
102 CG_VERBOSITY CodeGenVerbosityLevel = CG_VERBOSITY_NORMAL;
106 cgenP_update_mod_listCB(
108 XtPointer clientData,
112 STRING module_name = NULL;
114 XmListCallbackStruct *list_info = (XmListCallbackStruct *)callData;
116 module_name = objxm_xmstr_to_str(list_info->item);
117 pos = XmListItemPos(widget, list_info->item);
119 /* Check if the list item has been selected or de-selected */
120 if (XmListPosSelected(widget, pos))
122 /* If it has been selected, add it to the module_list */
123 strlist_add_str(module_list, module_name, (void *)NULL);
127 /* If it has been de-selected, remove it from the module_list */
128 strlist_remove_str(module_list, module_name);
134 /*** DTB_USER_CODE_END
136 *** End of user code section
138 **************************************************************************/
143 cgenP_set_gen_projCB(
145 XtPointer clientData,
149 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
151 DtbCgenPropsCgenPropsDlgInfo props_dlg =
152 (DtbCgenPropsCgenPropsDlgInfo)clientData;
154 CodeGenCmd = CG_GEN_PROJ_FLAG;
155 if (XtIsSensitive(props_dlg->module_list))
157 XtSetSensitive(props_dlg->module_list, False);
158 XtSetSensitive(props_dlg->module_list_scrolledwin, False);
161 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
163 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
164 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
169 cgenP_set_gen_mainCB(
171 XtPointer clientData,
175 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
177 DtbCgenPropsCgenPropsDlgInfo props_dlg =
178 (DtbCgenPropsCgenPropsDlgInfo)clientData;
180 CodeGenCmd = CG_GEN_MAIN_FLAG;
181 if (XtIsSensitive(props_dlg->module_list))
183 XtSetSensitive(props_dlg->module_list, False);
184 XtSetSensitive(props_dlg->module_list_scrolledwin, False);
187 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
189 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
190 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
195 cgenP_set_gen_specificCB(
197 XtPointer clientData,
201 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
203 DtbCgenPropsCgenPropsDlgInfo props_dlg =
204 (DtbCgenPropsCgenPropsDlgInfo)clientData;
206 CodeGenCmd = CG_GEN_SPECIFIC_FILES_FLAG;
207 if (!XtIsSensitive(props_dlg->module_list))
209 XtSetSensitive(props_dlg->module_list, True);
210 XtSetSensitive(props_dlg->module_list_scrolledwin, True);
213 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
215 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
216 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
221 cgenP_set_gen_specific_and_mainCB(
223 XtPointer clientData,
227 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
229 DtbCgenPropsCgenPropsDlgInfo props_dlg =
230 (DtbCgenPropsCgenPropsDlgInfo)clientData;
232 CodeGenCmd = CG_GEN_SPECIFIC_FILES_AND_MAIN_FLAG;
233 if (!XtIsSensitive(props_dlg->module_list))
235 XtSetSensitive(props_dlg->module_list, True);
236 XtSetSensitive(props_dlg->module_list_scrolledwin, True);
239 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
241 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
242 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
247 cgenP_set_normal_verbosityCB(
249 XtPointer clientData,
253 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
255 CodeGenVerbosityLevel = CG_VERBOSITY_NORMAL;
257 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
259 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
260 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
265 cgenP_set_silent_verbosityCB(
267 XtPointer clientData,
271 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
273 CodeGenVerbosityLevel = CG_VERBOSITY_SILENT;
275 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
277 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
278 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
283 cgenP_set_verbose_verbosityCB(
285 XtPointer clientData,
289 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
291 CodeGenVerbosityLevel = CG_VERBOSITY_VERBOSE;
293 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
295 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
296 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
301 cgenP_reset_default_propsCB(
303 XtPointer clientData,
307 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
308 DtbCgenPropsCgenPropsDlgInfo props_dlg =
309 (DtbCgenPropsCgenPropsDlgInfo)clientData;
310 int num_selected_mods = 0, i;
311 XmStringTable gen_module_list = NULL;
312 Widget opmenu_label = NULL;
313 XmString lbl_str = NULL;
316 /* set the code generation flag */
317 CodeGenCmd = CG_GEN_PROJ_FLAG;
318 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Entire_Project_item,
320 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Main_Only_item,
321 XmNset, False, NULL);
322 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Specific_Modules_Only_item,
323 XmNset, False, NULL);
324 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Specific_Modules_and_Main_item,
325 XmNset, False, NULL);
327 /* set the merge flag */
328 XtVaSetValues(props_dlg->merge_checkbox_items.Don_t_Merge_item,
329 XmNset, False, NULL);
331 /* set the verbosity */
332 CodeGenVerbosityLevel = CG_VERBOSITY_NORMAL;
333 XtVaSetValues(props_dlg->verbosity_opmenu_items.Report_Normal_Messages_item,
335 XtVaSetValues(props_dlg->verbosity_opmenu_items.Be_Silent_item,
336 XmNset, False, NULL);
337 XtVaSetValues(props_dlg->verbosity_opmenu_items.Be_Verbose_item,
338 XmNset, False, NULL);
339 opmenu_label = XmOptionButtonGadget(props_dlg->verbosity_opmenu);
340 XtVaGetValues(props_dlg->verbosity_opmenu_items.Report_Normal_Messages_item,
341 XmNlabelString, &lbl_str, NULL);
342 XtVaSetValues(opmenu_label, XmNlabelString, lbl_str, NULL);
344 /* deselect all in the module list */
345 XmListDeselectAllItems(props_dlg->module_list);
346 if (module_list != NULL)
348 strlist_destroy(module_list);
349 module_list = strlist_create();
352 /* clear the make args */
353 XmTextFieldSetString(props_dlg->make_textf, NULL);
355 /* clear the run time args */
356 XmTextFieldSetString(props_dlg->run_time_textf, NULL);
358 /* set the sensitivity */
359 if (XtIsSensitive(props_dlg->module_list))
361 XtSetSensitive(props_dlg->module_list, False);
362 XtSetSensitive(props_dlg->module_list_scrolledwin, False);
365 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
367 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
368 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
375 XtPointer clientData,
379 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
381 DtbCgenPropsCgenPropsDlgInfo props_dlg =
382 (DtbCgenPropsCgenPropsDlgInfo)clientData;
384 int num_selected_mods = 0;
386 Boolean no_merge = False;
387 STRING make_args = NULL;
388 STRING run_args = NULL;
391 if (CodeGenOptions.make_args != NULL)
393 free(CodeGenOptions.make_args);
394 CodeGenOptions.make_args = NULL;
397 if (CodeGenOptions.run_args != NULL)
399 free(CodeGenOptions.run_args);
400 CodeGenOptions.run_args = NULL;
403 if (CodeGenOptions.module_list != NULL)
405 strlist_destroy(CodeGenOptions.module_list);
406 CodeGenOptions.module_list = NULL;
409 merge_toggle = props_dlg->merge_checkbox_items.Don_t_Merge_item;
410 XtVaGetValues(merge_toggle, XmNset, &no_merge, NULL);
412 CodeGenOptions.cmd_flag = CodeGenCmd;
413 CodeGenOptions.no_merge = no_merge;
414 CodeGenOptions.verbosity = CodeGenVerbosityLevel;
416 make_args = XmTextFieldGetString(props_dlg->make_textf);
417 if (!util_strempty(make_args))
418 CodeGenOptions.make_args = strdup(make_args);
420 run_args = XmTextFieldGetString(props_dlg->run_time_textf);
421 if (!util_strempty(run_args))
422 CodeGenOptions.run_args = strdup(run_args);
424 if (CodeGenCmd == CG_GEN_SPECIFIC_FILES_FLAG ||
425 CodeGenCmd == CG_GEN_SPECIFIC_FILES_AND_MAIN_FLAG)
427 XtVaGetValues(props_dlg->module_list,
428 XmNselectedItemCount, &num_selected_mods,
430 if (num_selected_mods == 0)
432 dtb_cgen_props_no_sel_mod_msg_initialize(
433 &dtb_cgen_props_no_sel_mod_msg);
434 (void)dtb_show_modal_message(
435 dtb_cgen_props_cgen_props_dlg.cgen_props_dlg_shellform,
436 &dtb_cgen_props_no_sel_mod_msg, NULL, NULL,NULL);
440 CodeGenOptions.module_list = strlist_dup(module_list);
443 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
445 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
446 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
453 XtPointer clientData,
457 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
458 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
460 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
461 cgenP_apply_propsCB(widget, clientData, callData);
462 ui_win_show(dtb_cgen_props_cgen_props_dlg.cgen_props_dlg_shellform,False,NULL);
463 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
470 XtPointer clientData,
474 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
476 DtbCgenPropsCgenPropsDlgInfo props_dlg =
477 (DtbCgenPropsCgenPropsDlgInfo)clientData;
478 int num_selected_mods = 0, i, pos;
479 XmStringTable gen_module_list = NULL;
481 Widget opmenu_label = NULL;
482 XmString lbl_str = NULL;
484 /* undo the user's generate code modifications */
487 case CG_GEN_PROJ_FLAG:
488 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Entire_Project_item,
489 XmNset, False, NULL);
492 case CG_GEN_MAIN_FLAG:
493 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Main_Only_item,
494 XmNset, False, NULL);
497 case CG_GEN_SPECIFIC_FILES_FLAG:
498 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Specific_Modules_Only_item,
499 XmNset, False, NULL);
500 XmListDeselectAllItems(props_dlg->module_list);
503 case CG_GEN_SPECIFIC_FILES_AND_MAIN_FLAG:
504 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Specific_Modules_and_Main_item,
505 XmNset, False, NULL);
506 XmListDeselectAllItems(props_dlg->module_list);
513 /* set the generate code options back + field sensitivity */
514 switch (CodeGenOptions.cmd_flag)
516 case CG_GEN_PROJ_FLAG:
517 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Entire_Project_item,
519 CodeGenCmd = CG_GEN_PROJ_FLAG;
520 if (XtIsSensitive(props_dlg->module_list))
522 XtSetSensitive(props_dlg->module_list, False);
523 XtSetSensitive(props_dlg->module_list_scrolledwin, False);
527 case CG_GEN_MAIN_FLAG:
528 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Main_Only_item,
530 CodeGenCmd = CG_GEN_MAIN_FLAG;
531 if (XtIsSensitive(props_dlg->module_list))
533 XtSetSensitive(props_dlg->module_list, False);
534 XtSetSensitive(props_dlg->module_list_scrolledwin, False);
538 case CG_GEN_SPECIFIC_FILES_FLAG:
539 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Specific_Modules_Only_item,
541 CodeGenCmd = CG_GEN_SPECIFIC_FILES_FLAG;
542 /* Select items that should be selected */
543 if (CodeGenOptions.module_list != NULL)
545 XmListDeselectAllItems(props_dlg->module_list);
546 for (i=0; i<strlist_get_num_strs(CodeGenOptions.module_list); i++)
548 mod = objxm_str_to_xmstr(props_dlg->module_list,
549 strlist_get_str(CodeGenOptions.module_list, i, (void **)NULL));
550 pos = XmListItemPos(props_dlg->module_list, mod);
551 if (!XmListPosSelected(props_dlg->module_list, pos))
553 XmListSelectItem(props_dlg->module_list,
558 if (!XtIsSensitive(props_dlg->module_list))
560 XtSetSensitive(props_dlg->module_list, True);
561 XtSetSensitive(props_dlg->module_list_scrolledwin, True);
565 case CG_GEN_SPECIFIC_FILES_AND_MAIN_FLAG:
566 XtVaSetValues(props_dlg->cgen_flags_radiobox_items.Specific_Modules_and_Main_item,
568 CodeGenCmd = CG_GEN_SPECIFIC_FILES_AND_MAIN_FLAG;
569 /* Select items that should be selected */
570 if (CodeGenOptions.module_list != NULL)
572 XmListDeselectAllItems(props_dlg->module_list);
573 for (i=0; i<strlist_get_num_strs(CodeGenOptions.module_list); i++)
575 mod = objxm_str_to_xmstr(props_dlg->module_list,
576 strlist_get_str(CodeGenOptions.module_list, i, (void **)NULL));
577 pos = XmListItemPos(props_dlg->module_list, mod);
578 if (!XmListPosSelected(props_dlg->module_list, pos))
580 XmListSelectItem(props_dlg->module_list,
585 if (!XtIsSensitive(props_dlg->module_list))
587 XtSetSensitive(props_dlg->module_list, True);
588 XtSetSensitive(props_dlg->module_list_scrolledwin, True);
596 /* undo the user's verbosity changes */
597 switch (CodeGenVerbosityLevel)
599 case CG_VERBOSITY_NORMAL:
600 XtVaSetValues(props_dlg->verbosity_opmenu_items.Report_Normal_Messages_item,
601 XmNset, False, NULL);
604 case CG_VERBOSITY_SILENT:
605 XtVaSetValues(props_dlg->verbosity_opmenu_items.Be_Silent_item,
606 XmNset, False, NULL);
609 case CG_VERBOSITY_VERBOSE:
610 XtVaSetValues(props_dlg->verbosity_opmenu_items.Be_Verbose_item,
611 XmNset, False, NULL);
618 /* set the verbosity back */
619 switch (CodeGenOptions.verbosity)
621 case CG_VERBOSITY_NORMAL:
622 CodeGenVerbosityLevel = CG_VERBOSITY_NORMAL;
623 XtVaSetValues(props_dlg->verbosity_opmenu_items.Report_Normal_Messages_item,
626 /* set the option menu label string */
627 opmenu_label = XmOptionButtonGadget(props_dlg->verbosity_opmenu);
628 XtVaGetValues(props_dlg->verbosity_opmenu_items.Report_Normal_Messages_item,
629 XmNlabelString, &lbl_str, NULL);
630 XtVaSetValues(opmenu_label, XmNlabelString, lbl_str, NULL);
633 case CG_VERBOSITY_SILENT:
634 CodeGenVerbosityLevel = CG_VERBOSITY_SILENT;
635 XtVaSetValues(props_dlg->verbosity_opmenu_items.Be_Silent_item,
638 /* set the option menu label string */
639 opmenu_label = XmOptionButtonGadget(props_dlg->verbosity_opmenu);
640 XtVaGetValues(props_dlg->verbosity_opmenu_items.Be_Silent_item,
641 XmNlabelString, &lbl_str, NULL);
642 XtVaSetValues(opmenu_label, XmNlabelString, lbl_str, NULL);
645 case CG_VERBOSITY_VERBOSE:
646 CodeGenVerbosityLevel = CG_VERBOSITY_VERBOSE;
647 XtVaSetValues(props_dlg->verbosity_opmenu_items.Be_Verbose_item,
650 /* set the option menu label string */
651 opmenu_label = XmOptionButtonGadget(props_dlg->verbosity_opmenu);
652 XtVaGetValues(props_dlg->verbosity_opmenu_items.Be_Verbose_item,
653 XmNlabelString, &lbl_str, NULL);
654 XtVaSetValues(opmenu_label, XmNlabelString, lbl_str, NULL);
661 /* reset the merge option */
662 if (CodeGenOptions.no_merge)
663 XtVaSetValues(props_dlg->merge_checkbox_items.Don_t_Merge_item,
666 XtVaSetValues(props_dlg->merge_checkbox_items.Don_t_Merge_item,
667 XmNset, False, NULL);
669 /* reset the argument values */
670 XmTextFieldSetString(props_dlg->make_textf, CodeGenOptions.make_args);
671 XmTextFieldSetString(props_dlg->run_time_textf, CodeGenOptions.run_args);
673 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
675 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
676 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
681 cgenP_add_update_list_cb(
683 XtPointer clientData,
687 DtbCgenPropsCgenPropsDlgInfo dtbSource = (DtbCgenPropsCgenPropsDlgInfo)callData;
689 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
691 /* Work-around for not being able to add a ":select" callback
694 XtAddCallback(dtbSource->module_list,
695 XmNmultipleSelectionCallback, cgenP_update_mod_listCB,
698 /* Initialize module_list global variable */
699 module_list = strlist_create();
701 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
703 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
704 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
709 cgenP_cancel_propsCB(
711 XtPointer clientData,
715 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
717 cgenP_reset_default_propsCB(widget, clientData, callData);
718 XtPopdown(dtb_cgen_props_cgen_props_dlg.cgen_props_dlg);
720 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
722 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
723 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
728 /**************************************************************************
729 *** DTB_USER_CODE_START
731 *** All automatically-generated data and functions have been defined.
733 *** Add new functions here, or at the top of the file.
735 /*** DTB_USER_CODE_END
737 *** End of user code section
739 **************************************************************************/