Пример #1
0
static void
set_up_user_type_variables(GenCodeInfo genCodeInfo, ABObj toObj)
{
    File                codeFile = genCodeInfo->code_file;
    ABObj               structObj = abmfP_obj_get_struct_obj(toObj);
    ABObj		winParent = NULL;
    char		winParentName[1024];
    *winParentName = 0;

    /*
     * Determine window parent of this popup
     */
    winParent = obj_get_win_parent(structObj);
    if (winParent == NULL)
    {
        sprintf(winParentName, "%s()", abmfP_lib_get_toplevel_widget->name);
    }
    else
    {
        strcpy(winParentName, abmfP_get_c_name(genCodeInfo, winParent));
    }

    /*
     * REMIND: This is obsolete and should be removed!
     */
    if (cwd_is_dtbuilder_src_dir())
    {
        write_instance_ptr_var(genCodeInfo, toObj,
                               instanceVarName, abmfP_client_data_var_name, TRUE, NULL);
        abio_puts(genCodeInfo->code_file, nlstr);
    }
    else
    {
        write_instance_ptr_var(genCodeInfo, toObj,
                               toVarName, abmfP_client_data_var_name, TRUE, NULL);
        write_instance_ptr_var(genCodeInfo, toObj,
                               instanceVarName, toVarName, FALSE, "/* obsolete */");
        abio_puts(genCodeInfo->code_file, nlstr);
    }
    abio_printf(codeFile, "if (!(%s->initialized))\n", get_to_var_name());
    abmfP_write_c_block_begin(genCodeInfo);
    abio_printf(codeFile, "%s(%s, %s);\n",
                abmfP_get_init_proc_name(structObj),
                get_to_var_name(),
                winParentName);
    abmfP_write_c_block_end(genCodeInfo);
}
Пример #2
0
static int
write_map_window(
			GenCodeInfo	genCodeInfo, 
			ABObj 		window,
			BOOL		show
)
{
    File	codeFile = genCodeInfo->code_file;
    ABObj	project = obj_get_project(window);
    ABObj	proj_root_window = abmfP_get_root_window(project);
    ABObjRec	showActionRec;
    ABObj	showAction = &showActionRec;
    ABObj	winParent = NULL;
    char	winParentName[1024];
    obj_construct(showAction, AB_TYPE_ACTION, NULL);
    *winParentName = 0;

    obj_set_from(showAction, NULL);
    obj_set_to(showAction, window);
    obj_set_func_type(showAction, AB_FUNC_BUILTIN);
    obj_set_func_builtin(showAction, AB_STDACT_SHOW);

    winParent = obj_get_win_parent(window);
    if (winParent == NULL)
    {
	sprintf(winParentName, "%s()", abmfP_lib_get_toplevel_widget->name);
    }
    else
    {
        strcpy(winParentName, abmfP_get_c_name(genCodeInfo, winParent));
    }
    abio_printf(codeFile, "%s(%s, %s);\n",
	abmfP_get_init_proc_name(window),
	abmfP_get_c_struct_ptr_name(genCodeInfo, window),
	winParentName);

    if (show)
    	abmfP_write_builtin_action(genCodeInfo, showAction, FALSE);

    obj_destruct(showAction);
    return 0;
}
Пример #3
0
int
abmfP_get_connect_includes(StringList includeFiles, ABObj projOrModule)
{
    AB_TRAVERSAL	trav;
    BOOL		actionIsCrossModule = FALSE;
    ABObj		project = obj_get_project(projOrModule);
    ABObj		action = NULL;
    ABObj		toObj = NULL;
    ABObj		compRoot = NULL;
    ABObj		toModule = NULL;
    ABObj		win_parent = NULL;
    ABObj		popup_win = NULL;
    char		headerFilename[MAXPATHLEN+1];
    *headerFilename = 0;

    strlist_set_is_unique(includeFiles, TRUE);
    assert(project != NULL);
    if (project == NULL)
    {
	return 0;
    }

    for (trav_open(&trav, projOrModule, AB_TRAV_ACTIONS_FOR_OBJ);
	(action = trav_next(&trav)) != NULL; )
    {
	actionIsCrossModule = obj_is_cross_module(action);
	toObj = obj_get_to(action);
	if (toObj == NULL)
	{
	    continue;
	}

	toModule = obj_get_module(toObj);

	if (actionIsCrossModule)
	{
	    sprintf(headerFilename, "\"%s\"", 
	        abmfP_get_ui_header_file_name(toModule));
            strlist_add_str(includeFiles,  headerFilename, NULL);
  	}

	/*
	 * Check to see if the popup's window parent is in another module
	 */
	compRoot = obj_get_root(toObj);
	popup_win = NULL;
	if (obj_is_popup_win(compRoot))
	{
	    popup_win = compRoot;
	}
	if (popup_win == NULL) 
	{
	    popup_win = obj_get_parent_of_type(compRoot, AB_TYPE_DIALOG);
	}
	if (popup_win == NULL)
	{
	    popup_win = obj_get_parent_of_type(compRoot, AB_TYPE_BASE_WINDOW);
	}

	if (popup_win != NULL)
	{
	    win_parent= obj_get_win_parent(popup_win);
	    if (win_parent != NULL)
	    {
	       toModule = obj_get_module(win_parent);
	       if (toModule != NULL)
	       {
		   sprintf(headerFilename, "\"%s\"", 
			abmfP_get_ui_header_file_name(toModule));
	           strlist_add_str(includeFiles, headerFilename, NULL);
	       }
 	    }
        }

	/*
	 * For some actions, we need widget-specific convenience
	 * functions and resource strings that exist in the header files.
	 */
	if (obj_get_func_type(action) == AB_FUNC_BUILTIN)
	{
	    switch (obj_get_func_builtin(action))
	    {
		case AB_STDACT_SET_LABEL:
		case AB_STDACT_SET_TEXT:
		case AB_STDACT_SET_VALUE:
	            abmfP_comp_get_widget_specific_includes(
			includeFiles, obj_get_root(toObj));
		break;
	    }
	}
    }
    trav_close(&trav);

    return 0;
}
Пример #4
0
static int
custdlg_prop_load(
    ABObj    	 obj,
    AB_PROP_TYPE type,
    unsigned long loadkey
)
{
    ABObj			area;
    PropCustdlgSettingsRec 	*pcs = &(prop_custdlg_settings_rec[type]);
    BOOL                        load_all = (loadkey & LoadAll);

    if (obj == NULL)
    {
        if (pcs->current_obj != NULL)
            obj = pcs->current_obj;
        else
            return ERROR;
    }
    else if (!obj_is_popup_win(obj))
        return ERROR;
    else
        pcs->current_obj = obj;

    /* Load Name */
    if (load_all || loadkey & LoadName)
    	prop_field_set_value(&(pcs->name), obj_get_name(obj), False);

    if (load_all)
    {
	/* Load Window Parent */
	prop_obj_options_load(&(pcs->win_parent), proj_get_project());
	prop_obj_options_set_value(&(pcs->win_parent),
	obj_get_win_parent(obj), False);

	/* Load Title */
	prop_field_set_value(&(pcs->title), obj_get_label(obj), False);

	/* Load Resize Mode */
	prop_radiobox_set_value(&(pcs->resize_mode),
                                (XtPointer)obj_get_resizable(obj), False);

	/* Load Window Areas */
	area = objxm_comp_custdlg_get_area(obj, AB_CONT_BUTTON_PANEL);
	prop_checkbox_set_value(&(pcs->areas), AB_CONT_BUTTON_PANEL,
	area != NULL, False);

	area = objxm_comp_custdlg_get_area(obj, AB_CONT_FOOTER);
	prop_checkbox_set_value(&(pcs->areas), AB_CONT_FOOTER,
		area != NULL, False);

	/* Load Default Button */
	prop_obj_options_load(&(pcs->default_but),
	objxm_comp_custdlg_get_area(obj, AB_CONT_BUTTON_PANEL));
	prop_obj_options_set_value(&(pcs->default_but),
	obj_get_default_act_button(obj), False);

	/* Load Help Button */
	prop_obj_options_load(&(pcs->help_but),
	objxm_comp_custdlg_get_area(obj, AB_CONT_BUTTON_PANEL));
	prop_obj_options_set_value(&(pcs->help_but),
	obj_get_help_act_button(obj), False);

	/* Load Size Policy */
	prop_radiobox_set_value(&(pcs->size_policy),
				abobj_width_resizable(obj)?
                                (XtPointer)SIZE_FIXED_KEY :
                                (XtPointer)SIZE_OF_CONTENTS_KEY, False);

	/* Load Initial State */
	prop_checkbox_set_value(&(pcs->init_state), AB_STATE_VISIBLE,
		obj_is_initially_visible(obj), False);

	/* Load Color */
	prop_colorfield_set_value(&(pcs->bg_color), obj_get_bg_color(obj), False);
	prop_colorfield_set_value(&(pcs->fg_color), obj_get_fg_color(obj), False);

    	turnoff_changebars(type);
    }

    /* Load Size */
    if (load_all || loadkey & LoadSize)
        prop_load_obj_size(obj, &(pcs->geometry));

    return OK;
}