static int item_tab_init() { #define it item_tab item_tab_inited= TRUE; convert_fill_table(it, ARRAY_SIZE(it), istr_const(NULL)); it[AB_ITEM_FOR_CHOICE]= istr_const(":choice_item"); it[AB_ITEM_FOR_LIST]= istr_const(":list_item"); it[AB_ITEM_FOR_MENU]= istr_const(":menu_item"); return 0; #undef it }
STRING util_alignment_to_string(AB_ALIGNMENT align) { align_tab_check_init(); return convert_int_to_string(align, align_tab, ARRAY_SIZE(align_tab), istr_const(NULL)); }
STRING util_when_to_string(AB_WHEN when) { check_when_table_init(); return convert_int_to_string(when, when_table, AB_WHEN_NUM_VALUES, istr_const("?when?")); }
STRING util_container_type_to_string(AB_CONTAINER_TYPE type) { container_tab_check_init(); return convert_int_to_string(type, container_tab, ARRAY_SIZE(container_tab), istr_const(NULL)); }
STRING util_item_type_to_string(AB_ITEM_TYPE type) { item_tab_check_init(); return convert_int_to_string(type, item_tab, ARRAY_SIZE(item_tab), istr_const(NULL)); }
STRING util_object_type_to_browser_string(AB_OBJECT_TYPE type) { check_browser_obj_type_table_init(); return convert_int_to_string(type, browser_obj_type_table, AB_OBJECT_TYPE_NUM_VALUES, istr_const("?type?")); }
STRING util_builtin_action_to_string(AB_BUILTIN_ACTION action) { check_builtin_action_table_init(); return convert_int_to_string(action, builtin_action_table, AB_BUILTIN_ACTION_NUM_VALUES, istr_const("?action?")); }
static int button_type_tab_init() { #define btt button_type_tab button_type_tab_inited= TRUE; btt[AB_BUT_PUSH]= istr_const(":normal"); return 0; #undef btt }
static int container_tab_init() { #define cont container_tab container_tab_inited= TRUE; convert_fill_table(cont, ARRAY_SIZE(cont), istr_const(NULL)); cont[AB_CONT_ABSOLUTE]= istr_const(":absolute"); cont[AB_CONT_GROUP]= istr_const(":group"); cont[AB_CONT_MAIN_WINDOW]= istr_const(":main_window"); cont[AB_CONT_MENU_BAR]= istr_const(":menu_bar"); cont[AB_CONT_PANED]= istr_const(":paned"); cont[AB_CONT_RELATIVE]= istr_const(":relative"); cont[AB_CONT_SCROLLED_WINDOW]= istr_const(":scrolled_window"); cont[AB_CONT_ROW_COLUMN]= istr_const(":row_column"); return 0; #undef cont }
static int arg_class_tab_init() { #define att arg_class_tab arg_class_tab_inited= TRUE; att[AB_ARG_CLASS_UNDEF]= istr_const(":undef"); att[AB_ARG_CLASS_ACCELERATOR]= istr_const(":attachment"); att[AB_ARG_CLASS_COLOR]= istr_const(":color"); att[AB_ARG_CLASS_GEOMETRY]= istr_const(":geometry"); att[AB_ARG_CLASS_GLYPH]= istr_const(":value"); att[AB_ARG_CLASS_NON_GLYPH_LABEL]= istr_const(":label-alignment"); att[AB_ARG_CLASS_OTHER_STRING]= istr_const(":label-glyph"); att[AB_ARG_CLASS_OTHER]= istr_const(":other"); att[AB_ARG_CLASS_OTHER]= istr_const(":other"); return 0; #undef att }
static int builtin_action_table_init() { #define bat builtin_action_table builtin_action_table_inited= TRUE; convert_fill_table(builtin_action_table, AB_BUILTIN_ACTION_NUM_VALUES, istr_const("?when?")); bat[AB_STDACT_UNDEF]= istr_const("Undef"); bat[AB_STDACT_DISABLE]= istr_const("Disable"); bat[AB_STDACT_ENABLE]= istr_const("Enable"); bat[AB_STDACT_HIDE]= istr_const("Hide"); bat[AB_STDACT_SET_LABEL]= istr_const("SetLabel"); bat[AB_STDACT_SET_TEXT]= istr_const("SetText"); bat[AB_STDACT_SET_VALUE]= istr_const("SetValue"); bat[AB_STDACT_SHOW]= istr_const("Show"); return 0; #undef bat }
static int label_type_tab_init() { #define ltt label_type_tab label_type_tab_inited= TRUE; ltt[AB_LABEL_ARROW_DOWN]= istr_const(":arrow-down"); ltt[AB_LABEL_ARROW_LEFT]= istr_const(":arrow-left"); ltt[AB_LABEL_ARROW_RIGHT]= istr_const(":arrow-right"); ltt[AB_LABEL_ARROW_UP]= istr_const(":arrow_up"); ltt[AB_LABEL_DRAWN]= istr_const(":drawn"); ltt[AB_LABEL_GLYPH]= istr_const(":glyph"); ltt[AB_LABEL_STRING]= istr_const(":string"); return 0; #undef ltt }
static int align_tab_init() { #define at align_tab align_tab_inited= TRUE; convert_fill_table(at, ARRAY_SIZE(at), istr_const(NULL)); at[AB_ALIGN_TOP]= istr_const(":top"); at[AB_ALIGN_LEFT]= istr_const(":left"); at[AB_ALIGN_RIGHT]= istr_const(":right"); at[AB_ALIGN_BOTTOM]= istr_const(":bottom"); at[AB_ALIGN_CENTER]= istr_const(":centers"); at[AB_ALIGN_LABELS]= istr_const(":labels"); return 0; #undef at }
static int arg_type_tab_init() { #define att arg_type_tab arg_type_tab_inited= TRUE; att[AB_ARG_BOOLEAN]= istr_const(":boolean"); att[AB_ARG_CALLBACK]= istr_const(":callback"); att[AB_ARG_FLOAT]= istr_const(":float"); att[AB_ARG_INT]= istr_const(":integer"); att[AB_ARG_LITERAL]= istr_const(":literal"); att[AB_ARG_STRING]= istr_const(":string"); att[AB_ARG_VOID_PTR]= istr_const(":void"); return 0; #undef att }
int abmfP_write_create_proc_begin_or_decl( GenCodeInfo genCodeInfo, ABObj obj, BOOL declaration ) { #define MAX_CREATE_PARAMS 11 /* need lots for widget return params*/ int return_value = 0; STRING param_types[MAX_CREATE_PARAMS]; STRING param_names[MAX_CREATE_PARAMS]; int num_params = 0; int i = 0; int num_widgets = 0; int first_widget_return_param = -1; int num_submenu_params = 0; int first_submenu_param = -1; for (num_params = 0; num_params < MAX_CREATE_PARAMS; ++num_params) { param_types[num_params] = NULL; param_names[num_params] = NULL; } /* * Set up parameters, in order : instance, name, parent, widget* */ num_params = 0; /* * Instance pointer */ if (abmfP_obj_create_proc_has_instance_param(obj)) { param_types[num_params]= abmfP_obj_get_create_proc_instance_param_type(obj); param_names[num_params]= abmfP_instance_ptr_var_name; ++num_params; if (!declaration) { /* The ipObj field is set, so we don't need to save the var. */ } } /* * Name */ if (abmfP_obj_create_proc_has_name_param(obj)) { param_types[num_params] = abmfP_str_string; param_names[num_params] = "name"; ++num_params; if (!declaration) { abmfP_name_param(genCodeInfo)= istr_const("name"); abmfP_name_param_has_value(genCodeInfo)= TRUE; } } /* * Parent */ if (abmfP_obj_create_proc_has_parent_param(obj)) { param_types[num_params]= abmfP_str_widget; param_names[num_params]= "parent"; ++num_params; if (!declaration) { abmfP_name_param(genCodeInfo)= istr_const("parent"); abmfP_name_param_has_value(genCodeInfo)= TRUE; } } /* * Widget* for returning widget values */ num_widgets = abmfP_obj_get_num_create_proc_return_widgets(obj); if (num_widgets > 0) { first_widget_return_param = num_params; for (i = 0; (i < num_widgets) && (num_params < MAX_CREATE_PARAMS); ++i) { param_types[num_params]= "Widget *"; param_names[num_params]= strdup(abmfP_obj_get_create_proc_return_widget_name(obj, i)); ++num_params; } } /* * submenu id params */ num_submenu_params = abmfP_get_num_cp_submenu_params(obj); if (num_submenu_params > 0) { StringList submenu_param_list = &(abmfP_submenu_params(genCodeInfo)); StringList submenu_param_type_list = &(abmfP_submenu_param_types(genCodeInfo)); int num_strings = 0; strlist_make_empty(submenu_param_list); strlist_make_empty(submenu_param_type_list); for (i = 0; i < num_submenu_params; ++i) { strlist_add_str(submenu_param_type_list, abmfP_get_cp_submenu_param_type_name(obj, i), NULL); strlist_add_str(submenu_param_list, abmfP_get_cp_submenu_param_name(obj, i), NULL); } num_strings = strlist_get_num_strs(submenu_param_list); for (i = 0; (i < num_strings) && (num_params < MAX_CREATE_PARAMS); ++i) { param_types[num_params] = strlist_get_str(submenu_param_type_list, i, NULL); param_names[num_params] = strlist_get_str(submenu_param_list, i, NULL); ++num_params; } } /* * Check for max # params */ assert(num_params < MAX_CREATE_PARAMS); if (declaration) { return_value = abmfP_write_c_func_decl( genCodeInfo, TRUE, abmfP_str_int, abmfP_get_create_proc_name(obj), param_types[0], param_names[0], param_types[1], param_names[1], param_types[2], param_names[2], param_types[3], param_names[3], param_types[4], param_names[4], param_types[5], param_names[5], param_types[6], param_names[6], param_types[7], param_names[7], param_types[8], param_names[8], param_types[9], param_names[9], NULL ); } else { return_value = abmfP_write_c_func_begin( genCodeInfo, TRUE, abmfP_str_int, abmfP_get_create_proc_name(obj), param_types[0], param_names[0], param_types[1], param_names[1], param_types[2], param_names[2], param_types[3], param_names[3], param_types[4], param_names[4], param_types[5], param_names[5], param_types[6], param_names[6], param_types[7], param_names[7], param_types[8], param_names[8], param_types[9], param_names[9], NULL ); } if (first_widget_return_param >= 0) { for (i= first_widget_return_param; i < MAX_CREATE_PARAMS; ++i) { if (param_names[i] != NULL) { util_free(param_names[i]); param_names[i] = NULL; } } } return return_value; #undef MAX_CREATE_PARAMS }
static int obj_type_table_init() { #define ott obj_type_table obj_type_table_inited= TRUE; convert_fill_table(obj_type_table, AB_OBJECT_TYPE_NUM_VALUES, istr_const("?type?")); ott[AB_TYPE_ACTION]= istr_const(":action"); ott[AB_TYPE_ACTION_LIST]= istr_const(":action-list"); ott[AB_TYPE_BASE_WINDOW]= istr_const(":base-window"); ott[AB_TYPE_BUTTON]= istr_const(":button"); ott[AB_TYPE_CHOICE]= istr_const(":choice"); ott[AB_TYPE_COMBO_BOX]= istr_const(":combobox"); ott[AB_TYPE_FILE_CHOOSER]= istr_const(":file-chooser"); ott[AB_TYPE_MESSAGE]= istr_const(":message"); ott[AB_TYPE_CONTAINER]= istr_const(":container"); ott[AB_TYPE_DIALOG]= istr_const(":dialog"); ott[AB_TYPE_DRAWING_AREA]= istr_const(":drawing-area"); ott[AB_TYPE_FILE]= istr_const(":file"); ott[AB_TYPE_MODULE]= istr_const(":module"); ott[AB_TYPE_ITEM]= istr_const(":item"); ott[AB_TYPE_LABEL]= istr_const(":label"); ott[AB_TYPE_LAYERS]= istr_const(":layers"); ott[AB_TYPE_LIST]= istr_const(":list"); ott[AB_TYPE_MENU]= istr_const(":menu"); ott[AB_TYPE_PROJECT]= istr_const(":project"); ott[AB_TYPE_SEPARATOR]= istr_const(":separator"); ott[AB_TYPE_SPIN_BOX]= istr_const(":spinbox"); ott[AB_TYPE_SCALE]= istr_const(":scale"); ott[AB_TYPE_TERM_PANE]= istr_const(":term-pane"); ott[AB_TYPE_TEXT_FIELD]= istr_const(":text-field"); ott[AB_TYPE_TEXT_PANE]= istr_const(":text-pane"); ott[AB_TYPE_UNKNOWN]= istr_const(":unknown-type"); return 0; #undef ott }
static int browser_obj_type_table_init() { #define bott browser_obj_type_table browser_obj_type_table_inited= TRUE; convert_fill_table(browser_obj_type_table, AB_OBJECT_TYPE_NUM_VALUES, istr_const("?type?")); bott[AB_TYPE_ACTION]= istr_const("ACTION"); bott[AB_TYPE_ACTION_LIST]= istr_const("ACTION-LIST"); bott[AB_TYPE_BASE_WINDOW]= istr_const("BASE-WINDOW"); bott[AB_TYPE_BUTTON]= istr_const("BUTTON"); bott[AB_TYPE_CHOICE]= istr_const("CHOICE"); bott[AB_TYPE_COMBO_BOX]= istr_const("COMBO-BOX"); bott[AB_TYPE_FILE_CHOOSER]= istr_const("file-chooser"); bott[AB_TYPE_MESSAGE]= istr_const("message"); bott[AB_TYPE_CONTAINER]= istr_const("CONTAINER"); bott[AB_TYPE_DIALOG]= istr_const("DIALOG"); bott[AB_TYPE_DRAWING_AREA]= istr_const("DRAWING-AREA"); bott[AB_TYPE_MODULE]= istr_const("MODULE"); bott[AB_TYPE_ITEM]= istr_const("ITEM"); bott[AB_TYPE_LABEL]= istr_const("LABEL"); bott[AB_TYPE_LAYERS]= istr_const("LAYERS"); bott[AB_TYPE_LIST]= istr_const("LIST"); bott[AB_TYPE_MENU]= istr_const("MENU"); bott[AB_TYPE_PROJECT]= istr_const("PROJECT"); bott[AB_TYPE_SEPARATOR]= istr_const("SEPARATOR"); bott[AB_TYPE_SPIN_BOX]= istr_const("SPIN-BOX"); bott[AB_TYPE_SCALE]= istr_const("SCALE"); bott[AB_TYPE_TERM_PANE]= istr_const("TERM-PANE"); bott[AB_TYPE_TEXT_FIELD]= istr_const("TEXT-FIELD"); bott[AB_TYPE_TEXT_PANE]= istr_const("TEXT-PANE"); bott[AB_TYPE_UNKNOWN]= istr_const("UNKNOWN-TYPE"); return 0; #undef bott }
static int when_table_init() { #define wt when_table int i= 0; when_table_inited= TRUE; convert_fill_table(when_table, AB_WHEN_NUM_VALUES, istr_const("?when?")); wt[AB_WHEN_ACTION1]= istr_const("Action1Activated"); wt[AB_WHEN_ACTION2]= istr_const("Action2Activated"); wt[AB_WHEN_ACTION3]= istr_const("Action3Activated"); wt[AB_WHEN_ACTIVATED]= istr_const("Activate"); wt[AB_WHEN_AFTER_CREATED]= istr_const("AfterCreate"); wt[AB_WHEN_AFTER_RESIZED]= istr_const("AfterResize"); wt[AB_WHEN_BEFORE_POST_MENU]= istr_const("BeforePostMenu"); wt[AB_WHEN_BEFORE_TEXT_CHANGED]=istr_const("BeforeTextChanged"); wt[AB_WHEN_CANCEL]= istr_const("CancelActivated"); wt[AB_WHEN_DESTROYED]= istr_const("Destroy"); wt[AB_WHEN_DRAGGED]= istr_const("Dragged"); wt[AB_WHEN_DRAGGED_FROM]= istr_const("DraggedFrom"); wt[AB_WHEN_DOUBLE_CLICKED_ON]= istr_const("DoubleClick"); wt[AB_WHEN_DROPPED_ON]= istr_const("DroppedOn"); wt[AB_WHEN_HIDDEN]= istr_const("Hidden"); wt[AB_WHEN_ITEM_SELECTED]= istr_const("ItemSelected"); wt[AB_WHEN_OK]= istr_const("OkActivated"); wt[AB_WHEN_REPAINT_NEEDED]= istr_const("NeedRepaint"); wt[AB_WHEN_POPPED_DOWN]= istr_const("Popdown"); wt[AB_WHEN_POPPED_UP]= istr_const("Popup"); wt[AB_WHEN_SESSION_RESTORE]= istr_const("SessionRestore"); wt[AB_WHEN_SESSION_SAVE]= istr_const("SessionSave"); wt[AB_WHEN_SHOWN]= istr_const("Shown"); wt[AB_WHEN_TEXT_CHANGED]= istr_const("TextChanged"); wt[AB_WHEN_TOOLTALK_DO_COMMAND]=istr_const("ToolTalkDoCommand"); wt[AB_WHEN_TOOLTALK_GET_STATUS]=istr_const("ToolTalkGetStatus"); wt[AB_WHEN_TOOLTALK_PAUSE_RESUME]=istr_const("ToolTalkPauseResume"); wt[AB_WHEN_TOOLTALK_QUIT]=istr_const("ToolTalkQuit"); wt[AB_WHEN_VALUE_CHANGED]=istr_const("ValueChanged"); wt[AB_WHEN_UNDEF]= istr_const("Undef"); return 0; #undef wt }
/* * Write main() for the given project. */ static int write_main(GenCodeInfo genCodeInfo, ABObj project) { int returnValue = 0; File codeFile = genCodeInfo->code_file; ABObj window = NULL; int initialized = FALSE; ABObj main_window= NULL; AB_TRAVERSAL trav; BOOL mainWindowHasIcon = FALSE; abmfP_gencode_enter_func(genCodeInfo); main_window = abmfP_get_root_window(project); if (main_window != NULL) { mfobj_set_flags(main_window, CGenFlagTreatAsAppShell); } mainWindowHasIcon = ( (main_window != NULL) && ( (obj_get_icon(main_window) != NULL) || (obj_get_icon_mask(main_window) != NULL)) ); abio_puts(codeFile, "\n\n"); abio_puts(codeFile, abmfP_comment_begin); abio_puts(codeFile, abmfP_comment_continue); abio_printf(codeFile, "main for application %s\n", obj_get_name(project)); abio_puts(codeFile, abmfP_comment_end); /* * Write func declaration. */ abio_puts(codeFile, "int\n"); if (genCodeInfo->prototype_funcs) { abio_puts(codeFile, "main(int argc, char **argv)\n"); } else { abio_puts(codeFile, "main(argc, argv)\n"); abio_indent(codeFile); abio_puts(codeFile, "int\t\targc;\n"); abio_puts(codeFile, "char\t\t**argv;\n"); abio_outdent(codeFile); } abio_puts(codeFile, "{\n"); abio_set_indent(codeFile, 1); /* * Local variables */ abio_puts(codeFile, "Widget\t\ttoplevel = (Widget)NULL;\n"); abio_puts(codeFile, "Display\t\t*display = (Display*)NULL;\n"); abio_puts(codeFile, "XtAppContext\tapp = (XtAppContext)NULL;\n"); abio_puts(codeFile, "String\t\t*fallback_resources = (String*)NULL;\n"); abio_puts(codeFile, "ArgList\t\tinit_args = (ArgList)NULL;\n"); abio_puts(codeFile, "Cardinal\t\tnum_init_args = (Cardinal)0;\n"); abio_puts(codeFile, "ArgList\t\tget_resources_args = (ArgList)NULL;\n"); abio_puts(codeFile, "Cardinal\t\tnum_get_resources_args = (Cardinal)0;\n"); abio_puts(codeFile, "Atom\t\tsave_yourself_atom = (Atom)NULL;\n"); write_main_i18n_local_vars(genCodeInfo, project); write_main_tooltalk_local_vars(genCodeInfo, project); abio_puts(codeFile, nlstr); if (mainWindowHasIcon) { abmfP_icon_pixmap_var(genCodeInfo) = istr_const("icon_pixmap"); abmfP_icon_mask_pixmap_var(genCodeInfo) = istr_const("icon_mask_pixmap"); abio_puts(codeFile, "Pixmap\ticon_pixmap = NULL;\n"); abio_puts(codeFile, "Pixmap\ticon_mask_pixmap = NULL;\n"); } abmfP_write_user_long_seg(genCodeInfo, " No initialization has been done.\n" " ***\n" " *** Add local variables and code." ); if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API) write_main_xt_i18n(genCodeInfo, project); /* * Create a parent shell for every other shell and don't realize it. This * way, we can be consistent with our hierarchy. */ abio_printf(codeFile,"toplevel = XtAppInitialize(&app, \"%s\",\n", abmfP_capitalize_first_char(obj_get_name(project))); abio_indent(codeFile); abio_puts(codeFile, "optionDescList, XtNumber(optionDescList),\n"); abio_puts(codeFile, "&argc, argv, fallback_resources,\n"); abio_puts(codeFile, "init_args, num_init_args);\n\n"); abio_outdent(codeFile); abmfP_write_c_comment(genCodeInfo, FALSE, "Get display and verify initialization was successful."); abio_puts(codeFile, "if (toplevel != NULL)\n"); abmfP_write_c_block_begin(genCodeInfo); abio_puts(codeFile, "display = XtDisplayOfObject(toplevel);\n"); abmfP_write_c_block_end(genCodeInfo); if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API) write_main_msg_i18n(genCodeInfo, project); abio_puts(codeFile, "if (display == NULL)\n"); abmfP_write_c_block_begin(genCodeInfo); abio_puts(codeFile, "fprintf(stderr, \"Could not open display.\");\n"); abio_puts(codeFile, "exit(1);\n"); abmfP_write_c_block_end(genCodeInfo); /* Save the toplevel widget so it can be fetched later as needed */ abio_puts(codeFile,"\n"); abmfP_write_c_comment(genCodeInfo, FALSE, "Save the toplevel widget so it can be fetched later as needed."); abio_puts(codeFile, "dtb_save_toplevel_widget(toplevel);\n"); /* Save the command used to invoke the application */ abio_puts(codeFile,"\n"); abmfP_write_c_comment(genCodeInfo, FALSE, "Save the command used to invoke the application."); abio_puts(codeFile, "dtb_save_command(argv[0]);\n"); /* * Get application resources */ abio_puts(codeFile,"\n"); abio_puts(codeFile, "XtGetApplicationResources(toplevel, (XtPointer)&dtb_app_resource_rec,\n"); abio_indent(codeFile); abio_puts(codeFile, "resources, XtNumber(resources),\n"); abio_puts(codeFile, "get_resources_args, num_get_resources_args);\n"); abio_outdent(codeFile); abio_puts(codeFile, nlstr); /* * User segment after initialization */ abmfP_write_user_long_seg(genCodeInfo, " A connection to the X server has been established, and all\n" " *** initialization has been done.\n" " ***\n" " *** Add extra initialization code after this comment." ); /* * Call session restore callback (if needed) */ write_main_session_restore(genCodeInfo, project); /* * Initialize all global variables */ abio_puts(codeFile, nlstr); abmfP_write_c_comment(genCodeInfo, FALSE, "Initialize all global variables."); for (trav_open(&trav, project, AB_TRAV_SALIENT_UI); (window= trav_next(&trav)) != NULL; ) { if (!obj_is_defined(window)) { continue; } if (obj_is_message(window)) { abio_printf(codeFile, "%s(&%s);\n", abmfP_get_msg_clear_proc_name(window), abmfP_get_c_struct_global_name(window)); } else if (obj_is_window(window)) { abio_printf(codeFile, "%s(&%s);\n", abmfP_get_clear_proc_name(window), abmfP_get_c_struct_global_name(window)); } } trav_close(&trav); abio_puts(codeFile, "\n"); if (main_window != NULL) { abmfP_write_c_comment(genCodeInfo, FALSE, "Set up the application's root window."); abio_printf(codeFile, "%s = toplevel;\n", abmfP_get_c_name_global(main_window)); if (obj_get_icon(main_window) != NULL) { abio_printf(codeFile, "%s(%s,\n", abmfP_lib_cvt_image_file_to_pixmap->name, abmfP_get_c_name_global(main_window)); abio_indent(codeFile); abio_put_string(codeFile, obj_get_icon(main_window)); abio_printf(codeFile, ", &%s);\n", istr_string(abmfP_icon_pixmap_var(genCodeInfo))); abio_outdent(codeFile); abmfP_icon_pixmap_var_has_value(genCodeInfo) = TRUE; } if (obj_get_icon_mask(main_window) != NULL) { abio_printf(codeFile, "%s(%s,\n", abmfP_lib_cvt_image_file_to_pixmap->name, abmfP_get_c_name_global(main_window)); abio_indent(codeFile); abio_put_string(codeFile, obj_get_icon_mask(main_window)); abio_printf(codeFile, ", &%s);\n", istr_string(abmfP_icon_mask_pixmap_var(genCodeInfo))); abio_outdent(codeFile); abmfP_icon_mask_pixmap_var_has_value(genCodeInfo) = TRUE; } if (abmfP_get_num_args_of_classes(main_window, ABMF_ARGCLASS_ALL) > 0) { abmfP_xt_va_list_open_setvalues(genCodeInfo, main_window); abmfP_obj_spew_args(genCodeInfo, main_window, ABMF_ARGCLASS_ALL, ABMF_ARGFMT_VA_LIST); if (!obj_get_resizable(main_window)) { abio_printf(codeFile, "XmNmwmDecorations, MWM_DECOR_ALL | MWM_DECOR_RESIZEH,\n"); abio_printf(codeFile, "XmNmwmFunctions, MWM_FUNC_ALL | MWM_FUNC_RESIZE,\n"); } abmfP_xt_va_list_close(genCodeInfo); } } abio_puts(codeFile, nlstr); if ((main_window != NULL) && (obj_is_initially_visible(main_window))) { /* ApplicationShell doesn't require "show" action for mapping */ write_map_window(genCodeInfo, main_window, False); } /* * Display any initially mapped windows */ abio_puts(codeFile, nlstr); abmfP_write_c_comment(genCodeInfo, FALSE, "Map any initially-visible windows"); for (trav_open(&trav, project, AB_TRAV_WINDOWS); (window = trav_next(&trav)) != NULL;) { if ( (window != main_window) && (obj_is_initially_visible(window)) && obj_is_defined(window) ) { write_map_window(genCodeInfo, window, True); } } trav_close(&trav); /* * Get WM_SAVE_YOURSELF atom */ abio_puts(codeFile, "\n"); abio_puts(codeFile, "save_yourself_atom = XmInternAtom(XtDisplay(toplevel),\n"); abio_puts(codeFile, "\t\"WM_SAVE_YOURSELF\", False);\n"); /* * Register callback for WM_SAVE_YOURSELF */ write_main_register_save_yourself(genCodeInfo, project, "save_yourself_atom"); /* * User seg before realize */ abmfP_write_user_long_seg(genCodeInfo, " All initially-mapped widgets have been created, but not\n" " *** realized. Set resources on widgets, or perform other operations\n" " *** that must be completed before the toplevel widget is\n" " *** realized." ); /* * Realize the widget hierarchy */ abio_puts(codeFile, "XtRealizeWidget(toplevel);\n\n"); /* * Write ToolTalk Initialization if needed */ write_main_tooltalk_init(genCodeInfo, project); /* * User seg before event loop */ abmfP_write_user_long_seg(genCodeInfo, " The initially-mapped widgets have all been realized, and\n" " *** the Xt main loop is about to be entered." ); abio_puts(codeFile, nlstr); abmfP_write_c_comment(genCodeInfo, FALSE, "Enter event loop"); abio_puts(codeFile, "XtAppMainLoop(app);\n"); /* * Write func footer. */ abio_printf(codeFile, "return 0;\n"); abio_set_indent(codeFile, 0); abio_puts(codeFile, "}\n\n"); abmfP_gencode_exit_func(genCodeInfo); return returnValue; }