Пример #1
0
static int
write_tooltalk_CB_vars(GenCodeInfo genCodeInfo, ABObj project)
{
    File        codeFile;
 
    if (!genCodeInfo || !project ||
	obj_get_tooltalk_level(project) != AB_TOOLTALK_DESKTOP_ADVANCED)
        return (0);

    codeFile = genCodeInfo->code_file;
 
    abio_puts(codeFile, "\n");
 
    abio_puts(codeFile, "/*\n");
    abio_puts(codeFile, " * Variable for storing ToolTalk Message Quit callback\n");
    abio_puts(codeFile, " */\n");
    abio_puts(codeFile,
        "static DtbTTMsgHandlerCB\t\tdtb_tt_msg_quitCB = NULL;\n");

    abio_puts(codeFile, "/*\n"); 
    abio_puts(codeFile, " * Variable for storing ToolTalk Message Do Command callback\n"); 
    abio_puts(codeFile, " */\n"); 
    abio_puts(codeFile, 
        "static DtbTTMsgHandlerCB\t\tdtb_tt_msg_do_commandCB = NULL;\n");

    abio_puts(codeFile, "/*\n"); 
    abio_puts(codeFile, " * Variable for storing ToolTalk Message Get Status callback\n"); 
    abio_puts(codeFile, " */\n"); 
    abio_puts(codeFile, 
        "static DtbTTMsgHandlerCB\t\tdtb_tt_msg_get_statusCB = NULL;\n");

    abio_puts(codeFile, "/*\n"); 
    abio_puts(codeFile, " * Variable for storing ToolTalk Message Pause/Resume callback\n"); 
    abio_puts(codeFile, " */\n"); 
    abio_puts(codeFile, 
        "static DtbTTMsgHandlerCB\t\tdtb_tt_msg_pause_resumeCB = NULL;\n");
 
    return (0);
}
Пример #2
0
static int
write_main_tooltalk_local_vars(
    GenCodeInfo genCodeInfo,
    ABObj project
)
{
    File        codeFile;
    int         ret_val = 0;

    if (!genCodeInfo || !project ||
	obj_get_tooltalk_level(project) == AB_TOOLTALK_NONE)
        return 0;

    codeFile = genCodeInfo->code_file;

    abio_puts(codeFile, "char\t\t*tt_proc_id = NULL;\n");
    abio_puts(codeFile, "int\t\t\ttt_fd;\n");
    abio_puts(codeFile, "Tt_status\t\ttt_status;\n");
    abio_puts(codeFile, "Tt_pattern\t\t*tt_session_pattern;\n");
    abio_puts(codeFile, "char\t\t*ttenv;\n");
    abio_puts(codeFile, "char\t\t*session;\n");

    return 0;
}
Пример #3
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;
}
Пример #4
0
static int
write_main_tooltalk_init(
    GenCodeInfo genCodeInfo, 
    ABObj project 
) 
{ 
    AB_TOOLTALK_LEVEL	tt_level;
    AB_TRAVERSAL	trav;
    STRING		vendor, version;
    ABObj		action;
    File        	codeFile; 
    int         	ret_val = 0; 
 
    if (!genCodeInfo || !project ||
        (tt_level = obj_get_tooltalk_level(project)) == AB_TOOLTALK_NONE)
        return 0;
 
    codeFile = genCodeInfo->code_file; 

    abio_puts(codeFile, abmfP_comment_begin);
    abio_puts(codeFile, abmfP_comment_continue);
    abio_puts(codeFile, "Initialize ToolTalk to handle Desktop Message Protocol\n");
    abio_puts(codeFile, abmfP_comment_end);

    if (tt_level == AB_TOOLTALK_DESKTOP_ADVANCED)
    {
    	for (trav_open(&trav, project, AB_TRAV_ACTIONS);
             (action = trav_next(&trav)) != NULL;)
    	{
	    switch(obj_get_when(action))
	    {
		case AB_WHEN_TOOLTALK_QUIT:
		    abio_printf(codeFile, "dtb_set_tt_msg_quitCB((DtbTTMsgHandlerCB)%s);\n",
			obj_get_func_name(action));
		    break;
		case AB_WHEN_TOOLTALK_DO_COMMAND:
                    abio_printf(codeFile, "dtb_set_tt_msg_do_commandCB((DtbTTMsgHandlerCB)%s);\n", 
                        obj_get_func_name(action)); 
                    break; 
                case AB_WHEN_TOOLTALK_GET_STATUS: 
                    abio_printf(codeFile, "dtb_set_tt_msg_get_statusCB((DtbTTMsgHandlerCB)%s);\n",  
                        obj_get_func_name(action));  
                    break; 
                case AB_WHEN_TOOLTALK_PAUSE_RESUME:
                    abio_printf(codeFile, "dtb_set_tt_msg_pause_resumeCB((DtbTTMsgHandlerCB)%s);\n",  
                        obj_get_func_name(action));
                    break;
		default:
		    break;
	    }
	}
	trav_close(&trav);
	abio_puts(codeFile, "\n");
    }

    /* Write out tt init code to deal with possible remote display session */
    abio_puts(codeFile, "ttenv = getenv(\"TT_SESSION\");\n");
    abio_puts(codeFile, "if (!ttenv || strlen(ttenv) == 0)\n");
    abio_indent(codeFile);
    abio_puts(codeFile,"ttenv = getenv(\"_SUN_TT_SESSION\");\n");
    abio_outdent(codeFile);
    abio_puts(codeFile, "if (!ttenv || strlen(ttenv) == 0)\n");
    abmfP_write_c_block_begin(genCodeInfo);
    abio_puts(codeFile, "session = tt_X_session(XDisplayString(display));\n");
    abio_puts(codeFile, "tt_default_session_set(session);\n");
    abio_puts(codeFile, "tt_free(session);\n");
    abmfP_write_c_block_end(genCodeInfo);
    
    abio_printf(codeFile, "tt_proc_id = ttdt_open(&tt_fd, \"%s\", ",
	obj_get_name(project));
    vendor = obj_get_vendor(project);
    version = obj_get_version(project);
    abio_printf(codeFile, "\"%s\", \"%s\", 1);\n",
	vendor? vendor : "NULL", version? version : "NULL");
    abio_puts(codeFile, "tt_status = tt_ptr_error(tt_proc_id);\n");
    abio_puts(codeFile, "if (tt_status != TT_OK)\n");
/*
    abio_puts(codeFile, "{\n");
    abio_indent(codeFile);
*/
    abmfP_write_c_block_begin(genCodeInfo);
    abio_puts(codeFile, 
	"fprintf(stderr,\"ttdt_open(): %s\\n\", tt_status_message(tt_status));\n");
    abio_puts(codeFile, "tt_proc_id = NULL;\n");
/*
    abio_outdent(codeFile);
    abio_puts(codeFile, "}\n");
*/
    abmfP_write_c_block_end(genCodeInfo); 
    abio_puts(codeFile, "else\n");
/*
    abio_puts(codeFile, "{\n");
    abio_indent(codeFile);
*/
    abmfP_write_c_block_begin(genCodeInfo);
    abio_puts(codeFile, "XtAppAddInput(app, tt_fd, (XtPointer)XtInputReadMask,\n");
    abio_indent(codeFile);
    abio_puts(codeFile, "tttk_Xt_input_handler, tt_proc_id);\n\n");
    abio_outdent(codeFile); 
    abio_printf(codeFile, "tt_session_pattern = ttdt_session_join(NULL, %s,\n",
	tt_level == AB_TOOLTALK_DESKTOP_ADVANCED? "dtb_tt_contractCB" : "NULL");
    abio_indent(codeFile);
    abio_puts(codeFile, "toplevel, NULL, True);\n\n");
    abio_outdent(codeFile);
    abio_puts(codeFile, "atexit(dtb_tt_close);\n");
/*
    abio_outdent(codeFile); 
    abio_puts(codeFile, "}\n");
*/
    abmfP_write_c_block_end(genCodeInfo);  

    return 0;

}