Esempio n. 1
0
static int 	
write_main_register_save_yourself(
			GenCodeInfo	genCodeInfo, 
			ABObj		project, 
			char		*atom_name
)
{
    File	codeFile;

    if (!genCodeInfo || !project)
	return (0);

    if (!atom_name)
	atom_name = "save_yourself_atom";

    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile,"\n");

    /*
     * Set client save session callback
     */
    if (abmfP_proj_needs_session_save(project))
    {
        AB_TRAVERSAL	trav;
	ABObj		action;
	char		*ss_save_CB_name = NULL;

	/*
	 * Search for session save callback in project
	 * action list
	 */
    	for (trav_open(&trav, project, AB_TRAV_ACTIONS);
             (action = trav_next(&trav)) != NULL;)
    	{
	    switch(obj_get_when(action))
	    {
		case AB_WHEN_SESSION_SAVE:
		    /*
		     * Remember session save callback if found
		     */
		    ss_save_CB_name = obj_get_func_name(action);
		    break;
		default:
		    break;
	    }
	}
	trav_close(&trav);

	abio_printf(codeFile, 
	    "dtb_set_client_session_saveCB((DtbClientSessionSaveCB)%s);\n",
		ss_save_CB_name ? ss_save_CB_name : "NULL");

	abio_puts(codeFile, "\n");
    }

    abio_printf(codeFile,"XmAddWMProtocolCallback(toplevel, %s,\n", atom_name);
    abio_puts(codeFile,"\tdtb_session_save, (XtPointer)NULL);\n");

    abio_puts(codeFile,"\n");

    return (0);
}
Esempio n. 2
0
static int
write_all_lib_funcs(GenCodeInfo genCodeInfo, ABObj project)
{
    File	codeFile= genCodeInfo->code_file;

    abio_puts(codeFile, "\n");
    abmfP_write_c_comment(genCodeInfo, FALSE,
		"Application Builder utility funcs");

    write_lib_func(genCodeInfo, abmfP_lib_cvt_file_to_pixmap);
    write_lib_func(genCodeInfo, abmfP_lib_set_label_from_bitmap_data);
    write_lib_func(genCodeInfo, abmfP_lib_set_label_pixmaps);
    write_lib_func(genCodeInfo, abmfP_lib_file_has_extension);
    write_lib_func(genCodeInfo, abmfP_lib_cvt_filebase_to_pixmap);
    write_lib_func(genCodeInfo, abmfP_lib_cvt_image_file_to_pixmap);
    write_lib_func(genCodeInfo, abmfP_lib_set_label_from_image_file);
    write_lib_func(genCodeInfo, abmfP_lib_cvt_resource_from_string);
    write_lib_func(genCodeInfo, abmfP_lib_create_greyed_pixmap);

    write_lib_func(genCodeInfo, abmfP_lib_save_toplevel_widget);
    write_lib_func(genCodeInfo, abmfP_lib_get_toplevel_widget);

    write_lib_func(genCodeInfo, abmfP_lib_remove_sash_focus);

    write_lib_func(genCodeInfo, abmfP_lib_save_command);
    write_lib_func(genCodeInfo, abmfP_lib_get_command);


    write_lib_func(genCodeInfo, abmfP_lib_help_dispatch);
    write_lib_func(genCodeInfo, abmfP_lib_more_help_dispatch);
    write_lib_func(genCodeInfo, abmfP_lib_help_back_hdlr);
    write_lib_func(genCodeInfo, abmfP_lib_do_onitem_help);
    write_lib_func(genCodeInfo, abmfP_lib_show_help_volume_info);
    write_lib_func(genCodeInfo, abmfP_lib_call_help_callback);

    /*
     * The session save callback is written out always
     */
    write_lib_func(genCodeInfo, abmfP_lib_session_save);
    write_lib_func(genCodeInfo, abmfP_lib_get_client_session_saveCB);

    if (abmfP_proj_needs_session_save(project))
    {
        write_lib_func(genCodeInfo, abmfP_lib_set_client_session_saveCB);
    }

    if (abmfP_proj_needs_session_restore(project))
    {
        write_lib_func(genCodeInfo, abmfP_lib_session_restore);
        write_lib_func(genCodeInfo, abmfP_lib_set_client_session_restoreCB);
        write_lib_func(genCodeInfo, abmfP_lib_get_client_session_restoreCB);
    }

    /*
     * Write out ToolTalk functions if needed
     */
    switch(obj_get_tooltalk_level(project))
    {
        case AB_TOOLTALK_DESKTOP_ADVANCED:
            write_lib_func(genCodeInfo, abmfP_lib_set_tt_msg_quitCB);
            write_lib_func(genCodeInfo, abmfP_lib_get_tt_msg_quitCB);
            write_lib_func(genCodeInfo, abmfP_lib_tt_msg_quit);
            write_lib_func(genCodeInfo, abmfP_lib_set_tt_msg_do_commandCB);
            write_lib_func(genCodeInfo, abmfP_lib_get_tt_msg_do_commandCB);
            write_lib_func(genCodeInfo, abmfP_lib_tt_msg_do_command);
            write_lib_func(genCodeInfo, abmfP_lib_set_tt_msg_get_statusCB);
            write_lib_func(genCodeInfo, abmfP_lib_get_tt_msg_get_statusCB);
            write_lib_func(genCodeInfo, abmfP_lib_tt_msg_get_status);
            write_lib_func(genCodeInfo, abmfP_lib_set_tt_msg_pause_resumeCB);
            write_lib_func(genCodeInfo, abmfP_lib_get_tt_msg_pause_resumeCB);
            write_lib_func(genCodeInfo, abmfP_lib_tt_msg_pause_resume);
            write_lib_func(genCodeInfo, abmfP_lib_tt_contractCB);
            /* fall through */
        case AB_TOOLTALK_DESKTOP_BASIC:
            write_lib_func(genCodeInfo, abmfP_lib_tt_close);
            break;
        default:
            break;
    }
	    

    /* Write out Message posting utilities */
    if (abmfP_proj_has_message(project))
    {
	write_lib_func(genCodeInfo, abmfP_lib_create_message_dlg);
	write_lib_func(genCodeInfo, abmfP_lib_destroyCB);
	write_lib_func(genCodeInfo, abmfP_lib_MessageBoxGetActionButton);
	write_lib_func(genCodeInfo, abmfP_lib_show_message);
	write_lib_func(genCodeInfo, abmfP_lib_show_modal_message);
	write_lib_func(genCodeInfo, abmfP_lib_modal_dlgCB);
    }

    /* Write out centering routines */
    write_lib_func(genCodeInfo, abmfP_lib_children_center);
    write_lib_func(genCodeInfo, abmfP_lib_children_uncenter);
    write_lib_func(genCodeInfo, abmfP_lib_center);
    write_lib_func(genCodeInfo, abmfP_lib_uncenter);
    write_lib_func(genCodeInfo, abmfP_lib_center_widget);
    write_lib_func(genCodeInfo, abmfP_lib_uncenter_widget);
    write_lib_func(genCodeInfo, abmfP_lib_centering_handler);

    /* Write out align routines */
    write_lib_func(genCodeInfo, abmfP_lib_get_label_widget);
    write_lib_func(genCodeInfo, abmfP_lib_get_offset_from_ancestor);
    write_lib_func(genCodeInfo, abmfP_lib_get_label_width);
    write_lib_func(genCodeInfo, abmfP_lib_get_widest_label);
    write_lib_func(genCodeInfo, abmfP_lib_get_widest_value);
    write_lib_func(genCodeInfo, abmfP_lib_get_widget_rect);
    write_lib_func(genCodeInfo, abmfP_lib_get_greatest_size);
    write_lib_func(genCodeInfo, abmfP_lib_get_group_cell_size);
    write_lib_func(genCodeInfo, abmfP_lib_get_group_row_col);
    write_lib_func(genCodeInfo, abmfP_lib_get_group_child);
    write_lib_func(genCodeInfo, abmfP_lib_children_align);
    write_lib_func(genCodeInfo, abmfP_lib_align_children);
    write_lib_func(genCodeInfo, abmfP_lib_align_handler);
    write_lib_func(genCodeInfo, abmfP_lib_expose_handler);
    write_lib_func(genCodeInfo, abmfP_lib_free_group_info);
    write_lib_func(genCodeInfo, abmfP_lib_align_rows);
    write_lib_func(genCodeInfo, abmfP_lib_align_cols);
    write_lib_func(genCodeInfo, abmfP_lib_align_left);
    write_lib_func(genCodeInfo, abmfP_lib_align_right);
    write_lib_func(genCodeInfo, abmfP_lib_align_labels);
    write_lib_func(genCodeInfo, abmfP_lib_align_vcenter);
    write_lib_func(genCodeInfo, abmfP_lib_align_top);
    write_lib_func(genCodeInfo, abmfP_lib_align_bottom);
    write_lib_func(genCodeInfo, abmfP_lib_align_hcenter);

    /* Write out path-finding routines */
    write_lib_func(genCodeInfo, abmfP_lib_get_exe_dir);
    write_lib_func(genCodeInfo, abmfP_lib_determine_exe_dir);
    write_lib_func(genCodeInfo, abmfP_lib_determine_exe_dir_from_argv);
    write_lib_func(genCodeInfo, abmfP_lib_determine_exe_dir_from_path);
    write_lib_func(genCodeInfo, abmfP_lib_path_is_executable);

    /* write out popup menu routines */
    write_lib_func(genCodeInfo, abmfP_lib_popup_menu_register);
    write_lib_func(genCodeInfo, abmfP_lib_popup_menu);
    write_lib_func(genCodeInfo, abmfP_lib_popup_menu_destroyCB);

    /* Write out drag and drop routines */
    write_lib_func(genCodeInfo, abmfP_lib_drag_site_register);
    write_lib_func(genCodeInfo, abmfP_lib_drop_site_register);
    write_lib_func(genCodeInfo, abmfP_lib_drag_terminate);
    write_lib_func(genCodeInfo, abmfP_lib_drag_button1_motion_handler);
    write_lib_func(genCodeInfo, abmfP_lib_drag_start);
    write_lib_func(genCodeInfo, abmfP_lib_drag_convertCB);
    write_lib_func(genCodeInfo, abmfP_lib_drag_to_rootCB);
    write_lib_func(genCodeInfo, abmfP_lib_drag_finishCB);
    write_lib_func(genCodeInfo, abmfP_lib_drop_animateCB);
    write_lib_func(genCodeInfo, abmfP_lib_drop_transferCB);

    return 0;
}
Esempio n. 3
0
static int
write_includes(GenCodeInfo genCodeInfo, ABObj project)
{
    File	 codeFile = genCodeInfo->code_file;
    STRING	 *p       = NULL;
    AB_TRAVERSAL trav;
    ABObj	 module   = NULL;
    StringList   includes = strlist_create();
    char         buf[MAXPATHLEN+1];
    int          i;
    
    strlist_set_is_unique(includes, TRUE);
    *buf = 0;

    /* standard system includes */
    for (p = Includes; *p; p++)
    {
	strlist_add_str(includes, *p, NULL);
    }

    /*
     * Includes for sessioning.
     * These include files are needed only if sessioning
     * is used.
     */
    if (abmfP_proj_needs_session_save(project) || 
	abmfP_proj_needs_session_restore(project))
    {
        for (p = Session_Includes; *p; p++)
        {
	    strlist_add_str(includes, *p, NULL);
        }
    }

    /*
     * Includes for i18n.
     * These include files are needed only if i18n
     * is enabled.
     */
    if (genCodeInfo->i18n_method == ABMF_I18N_XPG4_API)
    {
        for (p = I18n_Includes; *p; p++)
        {
	    strlist_add_str(includes, *p, NULL);
        }
    }

    /* module includes */
    for (trav_open(&trav, project, AB_TRAV_MODULES);
	(module = trav_next(&trav)) != NULL; )
    {
	if (!obj_is_defined(module))
	{
	    continue;
	}
	sprintf(buf, "\"%s\"", abmfP_get_ui_header_file_name(module));
	strlist_add_str(includes, buf, NULL);
    }
    trav_close(&trav);

    /* project include */
    sprintf(buf, "\"%s\"", abmfP_get_project_header_file_name(project));
    strlist_add_str(includes, buf, NULL);

    sprintf(buf, "\"%s\"", abmfP_get_utils_header_file_name(project));
    strlist_add_str(includes, buf, NULL);

    abmfP_get_connect_includes(includes, project);

    /* Write the includes */
    for (i = 0; i < strlist_get_num_strs(includes); ++i)
    {
	abio_printf(codeFile, "#include %s\n",
	    strlist_get_str(includes, i, NULL));
    }
    
    abio_puts(codeFile, nlstr);

    strlist_destroy(includes);
    return 0;
}