STRING abmfP_get_action_name(ABObj action) { static char name[256]; STRING parent_name = (STRING) NULL; ABObj from = NULL, parent = NULL; STRING tmpName = NULL; *name = 0; from = obj_get_from(action); if (action->info.action.auto_named && (from != NULL)) { /* If the source object is the project, * then this is an "Application" connection. * This probably won't happen because right * now "Application" connections can only be * of type AB_FUNC_USER_DEF (which means auto- * named is FALSE). */ if (obj_is_project(from)) { parent = obj_get_project(action); parent_name = (STRING) util_malloc( strlen(obj_get_name(parent)) + APP_PREFIX_LEN + 1); strcpy(parent_name, obj_get_name(parent)); strcat(parent_name, APP_PREFIX); } else { parent = obj_get_module(from); parent_name = obj_get_name(parent); } if (!util_strempty(parent_name) && !util_strempty(obj_get_name(from))) { sprintf(name, "%s_%s%s", parent_name, obj_get_name(from), obj_get_func_name_suffix(action)); } if (obj_is_project(from)) { util_free(parent_name); } } else { if ((tmpName = obj_get_func_name(action)) != NULL) { sprintf(name, "%s", tmpName); } } return (name[0] == 0 ? NULL : name); }
/* * Action: Update "Module Path:" in the project window * whenever the user moves the pointer over a * module icon. */ static void pointer_motion_proc( Widget widget, XEvent *event, String *params, int num_params ) { Vwr v = NULL; VNode node_under_pointer = NULL; ABObj obj = NULL; XMotionEvent *mevent = (XMotionEvent*)event; char mod_path[MAXPATHLEN] = ""; util_dprintf(2, "pointer_motion_proc:\n"); XtVaGetValues(widget, XmNuserData, &v, NULL); if (!v) return; node_under_pointer = vwr_locate_node(v, mevent->x, mevent->y); if (node_under_pointer != NULL) { /* USE METHODS !! */ obj = (AB_OBJ *)node_under_pointer->obj_data; if (!obj) return; util_dprintf(2, "\tmodule name is %s\n", obj_get_name(obj)); /* If the module has not been saved, file will be NULL */ if (obj_get_file(obj) != NULL) { util_get_dir_name_from_path(obj_get_file(obj), mod_path, MAXPATHLEN); } else { strcpy(mod_path, "."); } util_dprintf(2, "\tmodule path is %s\n", mod_path); if (!util_strempty(mod_path)) { util_dprintf(2, "\tupdating the project window status region\n"); proj_update_stat_region(PROJ_STATUS_MOD_PATH, mod_path); } } else { /* If we're not over a node, clear out the module * path status label in the project window. */ util_dprintf(2, "\tpointer is not positioned over a node\n"); proj_update_stat_region(PROJ_STATUS_MOD_PATH, NULL); } }
void cgenP_set_envCB( Widget widget, XtPointer clientData, XtPointer callData ) { /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/ DtbCgenEnvDialogInfo env_dlg = (DtbCgenEnvDialogInfo)clientData; STRING var_name = NULL; STRING var_value = NULL; STRING old_var_value = NULL; var_name = XmTextFieldGetString(env_dlg->name_textf); if (util_strempty(var_name)) return; var_value = XmTextGetString(env_dlg->textpane); if (strlist_str_exists(user_env_vars, var_name)) { /* the user has set this before - we need to deallocate * the string we allocated */ old_var_value = (STRING) strlist_get_str_data(user_env_vars, var_name); util_free(old_var_value); strlist_remove_str(user_env_vars, var_name); } if (!util_strempty(var_value)) strlist_add_str(user_env_vars, var_name, (void *)strdup(var_value)); else strlist_add_str(user_env_vars, var_name, (void *)NULL); /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/ /*** DTB_USER_CODE_START vvv Add C code below vvv ***/ /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/ }
void proj_open_proj_okCB( Widget widget, XtPointer client_data, XmSelectionBoxCallbackStruct *call_data ) { STRING proj_filename = (STRING) NULL; XmString xm_buf = (XmString) NULL; DtbObjectHelpData help_data = NULL; proj_filename = (STRING)objxm_xmstr_to_str(call_data->value); /* If the file chooser selection text field is empty, return */ if ( util_strempty(proj_filename) ) { dtb_proj_no_name_msg_initialize(&dtb_proj_no_name_msg); (void)dtb_show_modal_message(widget, &dtb_proj_no_name_msg, NULL, NULL, NULL); } else if (!util_file_exists(proj_filename)) { sprintf(Buf, catgets(Dtb_project_catd, 100, 8, "The file %s does not exist."), proj_filename); util_printf_err(Buf); } else if (!util_file_is_regular_file(proj_filename)) { sprintf(Buf, catgets(Dtb_project_catd, 100, 69, "Cannot open %s.\n%s is not a regular file."), proj_filename, proj_filename); xm_buf = XmStringCreateLocalized(Buf); dtb_proj_error_msg_initialize(&dtb_proj_error_msg); help_data = (DtbObjectHelpData) util_malloc(sizeof(DtbObjectHelpDataRec)); help_data->help_text = catgets(Dtb_project_catd, 100, 89, "The file you specified is a directory or\nanother special file."); help_data->help_volume = ""; help_data->help_locationID = ""; (void)dtb_show_modal_message(widget, &dtb_proj_error_msg, xm_buf, help_data, NULL); util_free(help_data); XmStringFree(xm_buf); } else { XtUnmanageChild(widget); /* pop down the chooser */ ab_check_and_open_bip(proj_filename); } }
/* ** Set the label glyph (ie graphic) on an object */ void ui_obj_set_label_glyph( ABObj obj, STRING fileName ) { ABObj labelObj = NULL; if (obj == NULL) return; if (util_strempty(fileName)) return; labelObj = objxm_comp_get_subobj(obj, AB_CFG_LABEL_OBJ); if (labelObj == NULL || objxm_get_widget(labelObj) == NULL) return; switch (obj_get_type(obj)) { case AB_TYPE_BUTTON: case AB_TYPE_CHOICE: case AB_TYPE_COMBO_BOX: case AB_TYPE_LABEL: case AB_TYPE_LIST: case AB_TYPE_SPIN_BOX: case AB_TYPE_SCALE: case AB_TYPE_TEXT_FIELD: ui_set_label_glyph(objxm_get_widget(labelObj), fileName); break; case AB_TYPE_ITEM: switch(obj_get_item_type(obj)) { case AB_ITEM_FOR_MENU: case AB_ITEM_FOR_MENUBAR: case AB_ITEM_FOR_CHOICE: ui_set_label_glyph(objxm_get_widget(labelObj), fileName); break; default: break; } break; default: break; } }
void cgenP_get_envCB( Widget widget, XtPointer clientData, XtPointer callData ) { /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/ DtbCgenEnvDialogInfo env_dlg = (DtbCgenEnvDialogInfo)clientData; STRING var_name = NULL; STRING var_value = NULL; int index = 0; var_name = XmTextFieldGetString(env_dlg->name_textf); if (util_strempty(var_name)) { /* clean out the value textpane */ XmTextSetString(env_dlg->textpane, NULL); } else { if (strlist_str_exists(user_env_vars, var_name)) { var_value = (STRING) strlist_get_str_data(user_env_vars, var_name); } else { /* not in list */ var_value = getenv(var_name); } if (var_value == NULL) { XmTextSetString(env_dlg->textpane, catgets(Dtb_project_catd, 100, 58, "*** Not Set ***")); } else { XmTextSetString(env_dlg->textpane, var_value); } } /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/ /*** DTB_USER_CODE_START vvv Add C code below vvv ***/ /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/ }
void cgenP_reset_envCB( Widget widget, XtPointer clientData, XtPointer callData ) { /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/ DtbCgenEnvDialogInfo env_dlg = (DtbCgenEnvDialogInfo)clientData; STRING var_name = NULL; STRING var_value = NULL; var_name = XmTextFieldGetString(env_dlg->name_textf); if (util_strempty(var_name)) return; if (strlist_str_exists(user_env_vars, var_name)) { /* the user has set this before - we need to deallocate * the string we allocated */ var_value = (STRING) strlist_get_str_data(user_env_vars, var_name); util_free(var_value); strlist_remove_str(user_env_vars, var_name); } var_value = getenv(var_name); if (var_value == NULL) { XmTextSetString(env_dlg->textpane, catgets(Dtb_project_catd, 100, 58, "*** Not Set ***")); } else { XmTextSetString(env_dlg->textpane, var_value); } /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/ /*** DTB_USER_CODE_START vvv Add C code below vvv ***/ /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/ }
static int choice_prop_apply( AB_PROP_TYPE type ) { PropChoiceSettingsRec *pcs = &(prop_choice_settings_rec[type]); STRING value; BOOL size_chg = False; BOOL reset_bg = False; BOOL reset_fg = False; if (!verify_props(type)) return ERROR; if (prop_changed(pcs->name.changebar)) { value = prop_field_get_value(&(pcs->name)); abobj_set_name(pcs->current_obj, value); util_free(value); } if (prop_changed(pcs->label.changebar) || prop_changed(pcs->label_type.changebar)) { value = prop_field_get_value(&(pcs->label)); abobj_set_label(pcs->current_obj, (AB_LABEL_TYPE)prop_options_get_value(&(pcs->label_type)), value); util_free(value); abobj_set_label_position(pcs->current_obj, (AB_COMPASS_POINT)prop_options_get_value(&(pcs->label_pos))); size_chg = True; } /* if (prop_changed(pcs->choice_type.changebar)) { abobj_set_choice_type(pcs->current_obj, (AB_CHOICE_TYPE)prop_options_get_value(&(pcs->choice_type))); size_chg = True; } */ if (prop_changed(pcs->row_col.changebar)) { int cols; abobj_set_orientation(pcs->current_obj, (AB_ORIENTATION)prop_radiobox_get_value(&(pcs->row_col))); cols = prop_field_get_numeric_value(&(pcs->row_col_count)); abobj_set_num_columns(pcs->current_obj, cols); size_chg = True; } if (prop_changed(pcs->pos.changebar)) { if (abobj_is_movable(pcs->current_obj)) abobj_set_xy(pcs->current_obj, prop_geomfield_get_value(&(pcs->pos), GEOM_X), prop_geomfield_get_value(&(pcs->pos), GEOM_Y)); } if (prop_changed(pcs->init_state.changebar)) { abobj_set_visible(pcs->current_obj, prop_checkbox_get_value(&(pcs->init_state), AB_STATE_VISIBLE)); abobj_set_active(pcs->current_obj, prop_checkbox_get_value(&(pcs->init_state), AB_STATE_ACTIVE)); } if (prop_changed(pcs->fg_color.changebar)) { value = prop_colorfield_get_value(&(pcs->fg_color)); abobj_set_foreground_color(pcs->current_obj, value); if (util_strempty(value)) reset_fg = True; util_free(value); prop_colorfield_set_value(&(pcs->fg_color), obj_get_fg_color(pcs->current_obj), False); } if (prop_changed(pcs->bg_color.changebar)) { value = prop_colorfield_get_value(&(pcs->bg_color)); abobj_set_background_color(pcs->current_obj, value); if (util_strempty(value)) reset_bg = True; util_free(value); prop_colorfield_set_value(&(pcs->bg_color), obj_get_bg_color(pcs->current_obj), False); } if (prop_changed(pcs->items.changebar)) { /* Ensure edits to current item are saved before apply */ prop_item_change(&(pcs->items), False); prop_item_editor_apply(&(pcs->items)); size_chg = True; } if (prop_changed(pcs->choice_type.changebar)) { abobj_set_choice_type(pcs->current_obj, (AB_CHOICE_TYPE)prop_options_get_value(&(pcs->choice_type))); size_chg = True; } abobj_tree_instantiate_changes(pcs->current_obj); if (reset_bg || reset_fg) /* Set back to No Color */ { ABObj item; AB_TRAVERSAL trav; abobj_reset_colors(pcs->current_obj, reset_bg, reset_fg); /* Need to also reset the Item's colors also */ for (trav_open(&trav, pcs->current_obj, AB_TRAV_ITEMS); (item = trav_next(&trav)) != NULL; ) { abobj_reset_colors(item, reset_bg, reset_fg); } trav_close(&trav); } if (size_chg) abobj_force_dang_form_resize(pcs->current_obj); turnoff_changebars(type); return OK; }
/* * Finds the target matching the given description, creating it if necessary. * * Assumes: strings are pointers to allocated space. Sets strings to NULL, if * the values are used. * * Assumes that obj may not be in the object tree yet, and may return it as the * target. */ static ABObj find_or_create_target( ABObj obj, ABObj module, ISTRING interface_name, ISTRING parent_name, ISTRING obj_name, ISTRING item_label ) { ABObj target = NULL; /* the real thing, baby! */ ABObj target_project = NULL; char target_interface_file[MAXPATHLEN+1]; char target_interface_name[GIL_MAX_NAME_SIZE]; ABObj target_module = NULL; char target_parent_name[GIL_MAX_NAME_SIZE]; ABObj target_parent = NULL; char target_obj_name[GIL_MAX_NAME_SIZE]; ABObj target_obj = NULL; char target_item_label[GIL_MAX_NAME_SIZE]; ABObj target_item = NULL; AB_TRAVERSAL trav; *target_interface_file = 0; *target_interface_name = 0; *target_parent_name = 0; *target_obj_name = 0; *target_item_label = 0; /* must have object name */ if (debugging()) { assert( (obj_name != NULL) && (obj_is_project(module) || obj_is_module(module))); } if (obj_is_project(module)) { /* The first string must be an interface file name */ if (interface_name != NULL) { util_strncpy(target_interface_file, istr_string(interface_name), GIL_MAX_NAME_SIZE); if (parent_name != NULL) { util_strncpy(target_parent_name, istr_string(parent_name), GIL_MAX_NAME_SIZE); } } else if (parent_name != NULL) { util_strncpy(target_interface_file, istr_string(parent_name), GIL_MAX_NAME_SIZE); } else { abil_print_load_err(ERR_WANT_FULL_NAME); goto epilogue; } /* derive the name from the file name */ strcpy(target_interface_name, target_interface_file); { int len = strlen(target_interface_name); if ( (len >= 2) && ( util_streq(&(target_interface_name[len-2]), ".G") || util_streq(&(target_interface_name[len-2]), ".P"))) { target_interface_name[len-2] = 0; } } util_strncpy(target_obj_name, istr_string(obj_name), GIL_MAX_NAME_SIZE); if (item_label != NULL) { util_strncpy(target_item_label, istr_string(item_label), GIL_MAX_NAME_SIZE); } } else /* ! obj_is_project() */ { if (parent_name != NULL) { /* we have parent name and object name */ util_strncpy(target_parent_name, istr_string(parent_name), GIL_MAX_NAME_SIZE); } util_strncpy(target_obj_name, istr_string(obj_name), GIL_MAX_NAME_SIZE); if (item_label != NULL) { /* we have object name and item_label */ util_strncpy(target_item_label, istr_string(item_label), GIL_MAX_NAME_SIZE); } } /* * We've got the name broken down into the appropriate pieces. * Now find the actual target. */ /*util_dprintf(3, "finding: module:'%s' parent:'%s' obj:'%s' item:'%s'\n", target_interface_name, target_parent_name, target_obj_name, target_item_label);*/ /* * Find target project */ target_project = obj_get_project(module); /* * Find target module */ if (util_strempty(target_interface_name)) { target_module = module; } else { /* find specified intefarce (module) */ for (trav_open(&trav, target_project, AB_TRAV_MODULES); (target_module = trav_next(&trav)) != NULL; ) { if ( (target_module != target_project) && (util_streq( obj_get_file(target_module), target_interface_file))) { break; } } trav_close(&trav); if (target_module == NULL) { target_module = obj_create(AB_TYPE_MODULE, target_project); obj_set_is_defined(target_module, FALSE); obj_set_file(target_module, target_interface_file); obj_set_name(target_module, target_interface_name); } } /* * Find target parent */ if (util_strempty(target_parent_name)) { target_parent = target_module; } else { for (trav_open(&trav, target_module, AB_TRAV_ALL | AB_TRAV_MOD_PARENTS_FIRST); (target_parent = trav_next(&trav)) != NULL; ) { if ( (target_parent != target_module) && (util_streq( obj_get_name(target_parent), target_parent_name))) { break; } } trav_close(&trav); if (target_parent == NULL) { target_parent = obj_create(AB_TYPE_UNDEF, target_module); obj_set_is_defined(target_parent, FALSE); obj_set_file(target_parent, target_interface_file); obj_set_name(target_parent, target_parent_name); } } /* * Find target obj */ for (trav_open(&trav, target_parent, AB_TRAV_ALL | AB_TRAV_MOD_PARENTS_FIRST); (target_obj = trav_next(&trav)) != NULL; ) { if ( (target_obj != target_parent) && util_streq(target_obj_name, obj_get_name(target_obj))) { break; } } trav_close(&trav); if (target_obj == NULL) { target_obj = obj_create(AB_TYPE_UNDEF, target_parent); obj_set_is_defined(target_obj, FALSE); obj_set_file(target_obj, target_interface_file); obj_set_name(target_obj, target_obj_name); } /* * Find item */ if (util_strempty(target_item_label)) { target_item = NULL; } else { for (trav_open(&trav, target_obj, AB_TRAV_ITEMS); (target_item = trav_next(&trav)) != NULL; ) { if ( (target_item != target_obj) && util_streq(obj_get_label(target_item), target_item_label)) { break; } } trav_close(&trav); if (target_item == NULL) { target_item = obj_create(AB_TYPE_ITEM, target_obj); obj_set_is_defined(target_item, FALSE); obj_set_file(target_item, target_interface_file); obj_set_label(target_item, target_item_label); obj_set_name_from_label(target_item, obj_get_name(obj_get_parent(target_item))); } } if (target_item != NULL) { target = target_item; } else { target = target_obj; } epilogue: return target; }
void proj_import_okCB( Widget widget, XtPointer client_data, XmSelectionBoxCallbackStruct *call_data ) { STRING file_name = (STRING) NULL; XmString xm_buf = (XmString) NULL; BOOL read_OK, write_OK; DtbObjectHelpData help_data = NULL; if (call_data->reason != XmCR_OK) { return; } file_name = (STRING)objxm_xmstr_to_str(call_data->value); /* If the file chooser selection text field is empty, * return, leaving the chooser up to give the user * another try. */ if (util_strempty(file_name)) { dtb_proj_no_name_msg_initialize(&dtb_proj_no_name_msg); (void)dtb_show_modal_message(widget, &dtb_proj_no_name_msg, NULL, NULL, NULL); } else if (!util_file_exists(file_name)) { /* If the file specified does not exist, keep up the file * chooser so that the user can specify another file. */ sprintf(Buf, catgets(Dtb_project_catd, 100, 8, "The file %s does not exist."), file_name); util_printf_err(Buf); } else if (!util_file_is_regular_file(file_name)) { sprintf(Buf, catgets(Dtb_project_catd, 100, 70, "Cannot import %s.\n%s is not a regular file."), file_name, file_name); xm_buf = XmStringCreateLocalized(Buf); dtb_proj_error_msg_initialize(&dtb_proj_error_msg); help_data = (DtbObjectHelpData) util_malloc(sizeof(DtbObjectHelpDataRec)); help_data->help_text = catgets(Dtb_project_catd, 100, 89, "The file you specified is a directory or\nanother special file."); help_data->help_volume = ""; help_data->help_locationID = ""; (void)dtb_show_modal_message(widget, &dtb_proj_error_msg, xm_buf, help_data, NULL); util_free(help_data); XmStringFree(xm_buf); } else { ChooserInfo info = NULL; XtVaGetValues(AB_generic_chooser, XmNuserData, &info, NULL); if (info->ImportAsBil) { /* Pop down the file chooser */ XtUnmanageChild(widget); ab_check_and_import_bil(file_name, info->ImportByCopy); } else /* Import as UIL */ { abio_access_file(file_name, &read_OK, &write_OK); if (read_OK) { /* Pop down the file chooser */ XtUnmanageChild(widget); import_uil(file_name); } else { sprintf(Buf, catgets(Dtb_project_catd, 100, 9, "%s does not have read permission."), file_name); util_printf_err(Buf); } } } }
int scale_prop_apply( AB_PROP_TYPE type ) { PropScaleSettingsRec *pss = &(prop_scale_settings_rec[type]); STRING value; int new_w, new_h; BOOL size_chg = False; BOOL reset_bg = False; BOOL reset_fg = False; if (!verify_props(type)) return ERROR; if (prop_changed(pss->name.changebar)) { value = prop_field_get_value(&(pss->name)); abobj_set_name(pss->current_obj, value); util_free(value); } if (prop_changed(pss->label.changebar) || prop_changed(pss->label_type.changebar)) { value = prop_field_get_value(&(pss->label)); abobj_set_label(pss->current_obj, (AB_LABEL_TYPE)prop_options_get_value(&(pss->label_type)), value); util_free(value); abobj_set_label_position(pss->current_obj, (AB_COMPASS_POINT)prop_options_get_value(&(pss->label_pos))); size_chg = True; } if (prop_changed(pss->scale_type.changebar)) { abobj_set_read_only(pss->current_obj, (BOOL)prop_radiobox_get_value(&(pss->scale_type))); size_chg = True; } if (prop_changed(pss->orient.changebar)) { abobj_set_orientation(pss->current_obj, (AB_ORIENTATION)prop_radiobox_get_value(&(pss->orient))); } if (prop_changed(pss->dir.changebar)) { abobj_set_direction(pss->current_obj, (AB_DIRECTION)prop_options_get_value(&(pss->dir))); } if (prop_changed(pss->min.changebar)) { abobj_set_min_max_values(pss->current_obj, prop_field_get_numeric_value(&(pss->min)), prop_field_get_numeric_value(&(pss->max))); abobj_set_increment(pss->current_obj, prop_field_get_numeric_value(&(pss->incr))); } if (prop_changed(pss->decimal.changebar)) { abobj_set_decimal_points(pss->current_obj, prop_field_get_numeric_value(&(pss->decimal))); } if (prop_changed(pss->ivalue.changebar)) { abobj_set_initial_value(pss->current_obj, NULL, prop_field_get_numeric_value(&(pss->ivalue))); abobj_set_show_value(pss->current_obj, prop_checkbox_get_value(&(pss->show_value), SHOW_VALUE_KEY)); } if (prop_changed(pss->geometry.changebar)) { if (abobj_width_resizable(pss->current_obj)) { new_w = prop_geomfield_get_value(&(pss->geometry), GEOM_WIDTH); abobj_set_pixel_width(pss->current_obj, new_w, 0); } if (abobj_height_resizable(pss->current_obj)) { new_h = prop_geomfield_get_value(&(pss->geometry), GEOM_HEIGHT); abobj_set_pixel_height(pss->current_obj, new_h, 0); } if (abobj_is_movable(pss->current_obj)) abobj_set_xy(pss->current_obj, prop_geomfield_get_value(&(pss->geometry), GEOM_X), prop_geomfield_get_value(&(pss->geometry), GEOM_Y)); size_chg = True; } if (prop_changed(pss->init_state.changebar)) { abobj_set_visible(pss->current_obj, prop_checkbox_get_value(&(pss->init_state), AB_STATE_VISIBLE)); abobj_set_active(pss->current_obj, prop_checkbox_get_value(&(pss->init_state), AB_STATE_ACTIVE)); } if (prop_changed(pss->fg_color.changebar)) { value = prop_colorfield_get_value(&(pss->fg_color)); abobj_set_foreground_color(pss->current_obj, value); if (util_strempty(value)) reset_fg = True; util_free(value); prop_colorfield_set_value(&(pss->fg_color), obj_get_fg_color(pss->current_obj), False); } if (prop_changed(pss->bg_color.changebar)) { value = prop_colorfield_get_value(&(pss->bg_color)); abobj_set_background_color(pss->current_obj, value); if (util_strempty(value)) reset_bg = True; util_free(value); prop_colorfield_set_value(&(pss->bg_color), obj_get_bg_color(pss->current_obj), False); } abobj_instantiate_changes(pss->current_obj); if (reset_bg || reset_fg) /* Set back to No Color */ abobj_reset_colors(pss->current_obj, reset_bg, reset_fg); if (size_chg) abobj_force_dang_form_resize(pss->current_obj); turnoff_changebars(type); return OK; }
int custdlg_prop_apply( AB_PROP_TYPE type ) { PropCustdlgSettingsRec *pcs = &(prop_custdlg_settings_rec[type]); ABObj module; ABObj area; STRING value; BOOL area_set; BOOL reset_bg = False; BOOL reset_fg = False; BOOL size_chg = False; int new_w, new_h; if (!verify_props(type)) return ERROR; if (prop_changed(pcs->name.changebar)) { value = prop_field_get_value(&(pcs->name)); abobj_set_name(pcs->current_obj, value); util_free(value); } if (prop_changed(pcs->win_parent.options.changebar)) { ABObj win_parent = (ABObj) NULL; win_parent = prop_obj_options_get_value(&(pcs->win_parent)); abobj_set_win_parent(pcs->current_obj, win_parent); } if (prop_changed(pcs->title.changebar)) { value = prop_field_get_value(&(pcs->title)); abobj_set_label(pcs->current_obj, pcs->current_obj->label_type, value); util_free(value); } if (prop_changed(pcs->resize_mode.changebar)) { abobj_set_resize_mode(pcs->current_obj, (BOOL)prop_radiobox_get_value(&(pcs->resize_mode))); } if (prop_changed(pcs->areas.changebar)) { module = obj_get_module(pcs->current_obj); /* Button Panel */ area = objxm_comp_custdlg_get_area(pcs->current_obj, AB_CONT_BUTTON_PANEL); area_set = prop_checkbox_get_value(&(pcs->areas), AB_CONT_BUTTON_PANEL); if (area != NULL && !area_set) /* Remove Button Panel */ custdlg_remove_area(pcs->current_obj, area); else if (area == NULL && area_set) /* Add Button Panel */ custdlg_create_area(pcs->current_obj, AB_CONT_BUTTON_PANEL); /* Footer */ area = objxm_comp_custdlg_get_area(pcs->current_obj, AB_CONT_FOOTER); area_set = prop_checkbox_get_value(&(pcs->areas), AB_CONT_FOOTER); if (area != NULL && !area_set) /* Remove Footer */ custdlg_remove_area(pcs->current_obj, area); else if (area == NULL && area_set) /* Add Footer */ custdlg_create_area(pcs->current_obj, AB_CONT_FOOTER); } if (prop_changed(pcs->default_but.options.changebar)) { abobj_set_default_act_button(pcs->current_obj, prop_obj_options_get_value(&(pcs->default_but))); } if (prop_changed(pcs->help_but.options.changebar)) { abobj_set_help_act_button(pcs->current_obj, prop_obj_options_get_value(&(pcs->help_but))); } if (prop_changed(pcs->size_policy.changebar)) { abobj_set_size_policy(pcs->current_obj, prop_radiobox_get_value(&(pcs->size_policy)) == SIZE_FIXED_KEY); size_chg = True; } if (prop_changed(pcs->geometry.changebar)) { if (abobj_width_resizable(pcs->current_obj)) { new_w = prop_geomfield_get_value(&(pcs->geometry), GEOM_WIDTH); abobj_set_pixel_width(pcs->current_obj, new_w, 0); } if (abobj_height_resizable(pcs->current_obj)) { new_h = prop_geomfield_get_value(&(pcs->geometry), GEOM_HEIGHT); abobj_set_pixel_height(pcs->current_obj, new_h, 0); } } if (prop_changed(pcs->init_state.changebar)) { abobj_set_visible(pcs->current_obj, prop_checkbox_get_value(&(pcs->init_state), AB_STATE_VISIBLE)); } if (prop_changed(pcs->fg_color.changebar)) { value = prop_colorfield_get_value(&(pcs->fg_color)); abobj_set_foreground_color(pcs->current_obj, value); if (util_strempty(value)) reset_fg = True; util_free(value); prop_colorfield_set_value(&(pcs->fg_color), obj_get_fg_color(pcs->current_obj), False); } if (prop_changed(pcs->bg_color.changebar)) { value = prop_colorfield_get_value(&(pcs->bg_color)); abobj_set_background_color(pcs->current_obj, value); if (util_strempty(value)) reset_bg = True; util_free(value); prop_colorfield_set_value(&(pcs->bg_color), obj_get_bg_color(pcs->current_obj), False); } abobj_tree_instantiate_changes(pcs->current_obj); if (reset_bg || reset_fg) /* Set back to No Color */ abobj_reset_colors(pcs->current_obj, reset_bg, reset_fg); turnoff_changebars(type); return OK; }