/*! \brief restore_all_ecu_settings() reads the filename passed and if all checks pass the file will be loaded and any values that differ from the values currently in the ECU will be replaced. \param filename (filename to read for ecu restoration WARNING: This function is not yet capable of handling CAN devices, and will always restore to can ID ZERO (which can be BAD!!), backup/restore needs to be rewritten.. */ G_MODULE_EXPORT void restore_all_ecu_settings(gchar *filename) { ConfigFile *cfgfile; /* GArray *pfuncs = NULL; PostFunction *pf = NULL; */ gchar * section = NULL; gchar * msgbuf = NULL; gint canID = 0; DataSize size = MTX_U08; gint page = 0; gint offset = 0; gint tmpi = 0; gint major = 0; gint minor = 0; gboolean restart = FALSE; gchar *tmpbuf = NULL; guint8 *data = NULL; gchar **keys = NULL; gint num_keys = 0; gint dload_val = 0; PostFunction *pf = NULL; GArray *pfuncs = NULL; extern gconstpointer *global_data; Firmware_Details *firmware = NULL; firmware = DATA_GET(global_data,"firmware"); g_return_if_fail(filename); g_return_if_fail(firmware); canID = firmware->canID; cfgfile = cfg_open_file(filename); if (!cfgfile) { update_logbar_f("tools_view","warning",g_strdup_printf(_(":restore_all_ecu_settings()\n\t Unable to open this file (%s)\n"),filename),FALSE,FALSE,TRUE); return; } if (cfgfile) { get_file_api_f(cfgfile,&major,&minor); if (major != BACKUP_MAJOR_API) { update_logbar_f("tools_view","warning",g_strdup_printf(_(":restore_all_ecu_settings()\n\tAPI MAJOR version mismatch: \"%i\" != \"%i\"\n can not load this file for restoration\n"),major,BACKUP_MAJOR_API),FALSE,FALSE,TRUE); cfg_free(cfgfile); return; } if (minor != BACKUP_MINOR_API) update_logbar_f("tools_view","warning",g_strdup_printf(_(": restore_all_ecu_settings()\n\tAPI MINOR version mismatch: \"%i\" != \"%i\"\n Will try to load this file for restoration, expect issues\n"),minor,BACKUP_MINOR_API),FALSE,FALSE,TRUE); cfg_read_string(cfgfile,"Firmware","name",&tmpbuf); if (g_ascii_strcasecmp(g_strdelimit(tmpbuf," ,",'_'),g_strdelimit(firmware->name," ,",'_')) != 0) { dbg_func_f(CRITICAL,g_strdup_printf(__FILE__": restore_all_ecu_settings()\nFirmware name mismatch:\n\"%s\" != \"%s\",\ncannot load this file for restoration\n",tmpbuf,firmware->name)); update_logbar_f("tools_view","warning",g_strdup_printf(_(": restore_all_ecu_settings()\nFirmware name mismatch: \"%s\" != \"%s\"\ncan NOT load this file for restoration!\n"),tmpbuf,firmware->name),FALSE,FALSE,TRUE); if (tmpbuf) g_free(tmpbuf); cfg_free(cfgfile); return; } g_free(tmpbuf); set_title_f(g_strdup(_("Restoring ECU settings from File"))); if (DATA_GET(global_data,"realtime_id")) { stop_tickler_f(RTV_TICKLER); restart = TRUE; } for (page=0;page<firmware->total_pages;page++) { if (!(firmware->page_params[page]->dl_by_default)) continue; section = g_strdup_printf("page_%i",page); if(cfg_read_int(cfgfile,section,"num_variables",&tmpi)) if (tmpi != firmware->page_params[page]->length) { update_logbar_f("tools_view","warning",g_strdup_printf(_(": restore_all_ecu_settings()\n\tNumber of variables in backup \"%i\" and firmware specification \"%i\" do NOT match,\n\tcorruption SHOULD be expected\n"),tmpi,firmware->page_params[page]->length),FALSE,FALSE,TRUE); dbg_func_f(CRITICAL,g_strdup_printf(_(": restore_all_ecu_settings()\n\tNumber of variables in backup \"%i\" and firmware specification \"%i\" do NOT match,\n\tcorruption SHOULD be expected\n"),tmpi,firmware->page_params[page]->length)); } if (cfg_read_string(cfgfile,section,"data",&tmpbuf)) { keys = parse_keys_f(tmpbuf,&num_keys,","); if (num_keys != firmware->page_params[page]->length) { update_logbar_f("tools_view","warning",g_strdup_printf(_(": restore_all_ecu_settings()\n\tNumber of variables in this backup \"%i\" does NOT match the length of the table \"%i\", expect a crash!!!\n"),num_keys,firmware->page_params[page]->length),FALSE,FALSE,TRUE); dbg_func_f(CRITICAL,g_strdup_printf(_(": restore_all_ecu_settings()\n\tNumber of variables in this backup \"%i\" does NOT match the length of the table \"%i\", expect a crash!!!\n"),num_keys,firmware->page_params[page]->length)); } if (firmware->chunk_support) { data = g_new0(guint8, firmware->page_params[page]->length); for (offset=0;offset<num_keys;offset++) data[offset]=(guint8)atoi(keys[offset]); if (DATA_GET(global_data,"offline")) ms_store_new_block(canID,page,0,data,num_keys); else ms_chunk_write(canID,page,0,num_keys,data); } else { if (DATA_GET(global_data,"offline")) { for (offset=0;offset<num_keys;offset++) { dload_val = atoi(keys[offset]); ms_set_ecu_data(canID,page,offset,size,dload_val); } } else { for (offset=0;offset<num_keys;offset++) { dload_val = atoi(keys[offset]); if (dload_val != ms_get_ecu_data_last(canID,page,offset,size)) { /*printf("writing data for page %i, offset %i\n",page,offset);*/ ms_send_to_ecu(canID,page,offset,size,dload_val, FALSE); } } queue_burn_ecu_flash(page); } } g_strfreev(keys); g_free(tmpbuf); } g_free(section); } start_restore_monitor(); cfg_free(cfgfile); } if (DATA_GET(global_data,"offline")) { pfuncs = g_array_new(FALSE,TRUE,sizeof(PostFunction *)); pf = g_new0(PostFunction,1); pf->name = g_strdup("update_ecu_controls_pf"); get_symbol_f(pf->name,(void *)&pf->function); pf->w_arg = FALSE; pfuncs = g_array_append_val(pfuncs,pf); pf = g_new0(PostFunction,1); pf->name = g_strdup("set_store_black_pf"); get_symbol_f(pf->name,(void *)&pf->function); pf->w_arg = FALSE; pfuncs = g_array_append_val(pfuncs,pf); io_cmd_f(NULL,pfuncs); } if (restart) start_tickler_f(RTV_TICKLER); }
/*! \brief Creates a group of 2D Table Editors packed into a GtkNotebook \param button is a pointer to the widget the user click on, which has bound to is a list of the TE Table ID's which we need to create on-screen representations for \returns TRUE on success, FALSE otherwise */ G_MODULE_EXPORT gboolean create_2d_table_editor_group(GtkWidget *button) { GladeXML *main_xml = NULL; GladeXML *xml = NULL; GtkWidget *widget = NULL; GtkWidget *window = NULL; GtkWidget *notebook = NULL; GtkWidget *curve = NULL; GtkWidget *x_parent = NULL; GtkWidget *y_parent = NULL; GtkWidget *x_table = NULL; GtkWidget *y_table = NULL; GtkWidget *label = NULL; GtkWidget *entry = NULL; GtkWidget *dummy = NULL; GtkWidget *gauge = NULL; GtkWidget *parent = NULL; GtkWidget *curve_parent = NULL; CurveData *cdata = NULL; GArray *x_entries = NULL; GArray *y_entries = NULL; GList *widget_list = NULL; GList *curve_list = NULL; GList *gauge_list = NULL; gchar * tmpbuf = NULL; gchar * filename = NULL; gchar **vector = NULL; GList ***ecu_widgets = NULL; gint num_tabs = 0; gint x_mult = 0; gint y_mult = 0; gint page = 0; gint offset = 0; gint i = 0; gint j = 0; gfloat tmpf = 0.0; guint32 id = 0; gint rows = 0; gint table_num = 0; Firmware_Details *firmware = NULL; firmware = DATA_GET(global_data,"firmware"); ecu_widgets = DATA_GET(global_data,"ecu_widgets"); main_xml = (GladeXML *)DATA_GET(global_data,"main_xml"); if (!main_xml) return FALSE; xml = glade_xml_new(main_xml->filename,"table_editor_window",NULL); window = glade_xml_get_widget(xml,"table_editor_window"); glade_xml_signal_autoconnect(xml); g_signal_connect(G_OBJECT(window),"destroy_event", G_CALLBACK(close_2d_editor),NULL); g_signal_connect(G_OBJECT(window),"delete_event", G_CALLBACK(close_2d_editor),NULL); gtk_window_set_title(GTK_WINDOW(window),_("2D Table Group Editor")); gtk_window_resize(GTK_WINDOW(window),800,530); widget = glade_xml_get_widget(xml,"2d_close_button"); g_signal_connect_swapped(G_OBJECT(widget),"clicked", G_CALLBACK(close_2d_editor),window); widget = glade_xml_get_widget(xml,"get_data_button"); OBJ_SET(widget,"handler",GINT_TO_POINTER(READ_VE_CONST)); OBJ_SET_FULL(widget,"bind_to_list",g_strdup("get_data_buttons"),g_free); bind_to_lists_f(widget,"get_data_buttons"); widget_list = g_list_prepend(widget_list,(gpointer)widget); widget = glade_xml_get_widget(xml,"burn_data_button"); OBJ_SET(widget,"handler",GINT_TO_POINTER(BURN_FLASH)); OBJ_SET_FULL(widget,"bind_to_list",g_strdup("burners"),g_free); bind_to_lists_f(widget,"burners"); widget_list = g_list_prepend(widget_list,(gpointer)widget); /* widget = glade_xml_get_widget(xml,"curve_editor_menuitem"); gtk_widget_set_sensitive(GTK_WIDGET(widget), FALSE); */ widget = glade_xml_get_widget(xml,"close_menuitem"); OBJ_SET(widget,"window",(gpointer)window); widget = glade_xml_get_widget(xml,"te_layout_hbox1"); gtk_widget_destroy(widget); widget = glade_xml_get_widget(xml,"te_layout_vbox"); tmpbuf = OBJ_GET(button,"te_tables"); vector = parse_keys_f(tmpbuf,&num_tabs,","); notebook = gtk_notebook_new(); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook),GTK_POS_LEFT); gtk_box_pack_start(GTK_BOX(widget),notebook,TRUE,TRUE,0); for (j = 0;j < num_tabs;j++) { table_num = (gint)strtod(vector[j],NULL); if (table_num >= firmware->total_te_tables) { warn_user_f("Requested to create 2D table editor window for an undefined (out of range) table ID"); return FALSE; } if (!firmware->te_params) { warn_user_f("No 2D table Editor tables (te_tables) defined in interrogation profile, yet told to create a graph for a table... BUG detected!"); continue; } if (!firmware->te_params[table_num]) { warn_user_f("Requested to create a 2D table editor window for an undefined table!"); continue; } xml = glade_xml_new(main_xml->filename,"te_layout_hbox1",NULL); widget = glade_xml_get_widget(xml,"te_layout_hbox1"); label = gtk_label_new(firmware->te_params[table_num]->title); gtk_misc_set_alignment(GTK_MISC(label),0,0.5); if (firmware->te_params[table_num]->bind_to_list) { OBJ_SET_FULL(widget,"bind_to_list", g_strdup(firmware->te_params[table_num]->bind_to_list),g_free); OBJ_SET(widget,"match_type", GINT_TO_POINTER(firmware->te_params[table_num]->match_type)); bind_to_lists_f(widget,firmware->te_params[table_num]->bind_to_list); widget_list = g_list_prepend(widget_list,(gpointer)widget); OBJ_SET_FULL(label,"bind_to_list", g_strdup(firmware->te_params[table_num]->bind_to_list),g_free); OBJ_SET(label,"match_type", GINT_TO_POINTER(firmware->te_params[table_num]->match_type)); bind_to_lists_f(label,firmware->te_params[table_num]->bind_to_list); widget_list = g_list_prepend(widget_list,(gpointer)label); } if (firmware->te_params[table_num]->gauge || firmware->te_params[table_num]->c_gauge || firmware->te_params[table_num]->f_gauge) { parent = glade_xml_get_widget(xml,"te_gaugeframe"); gauge = mtx_gauge_face_new(); gauge_list = g_list_prepend(gauge_list,(gpointer)gauge); OBJ_SET(window,"gauge",gauge); if (firmware->te_params[table_num]->gauge_temp_dep) { if ((GINT)DATA_GET(global_data,"mtx_temp_units") == CELSIUS) tmpbuf = g_strdelimit(firmware->te_params[table_num]->c_gauge,"\\",'/'); else if ((GINT)DATA_GET(global_data,"mtx_temp_units") == KELVIN) tmpbuf = g_strdelimit(firmware->te_params[table_num]->c_gauge,"\\",'/'); else tmpbuf = g_strdelimit(firmware->te_params[table_num]->f_gauge,"\\",'/'); } else tmpbuf = g_strdelimit(firmware->te_params[table_num]->gauge,"\\",'/'); filename = get_file(g_strconcat(GAUGES_DATA_DIR,PSEP,tmpbuf,NULL),NULL); mtx_gauge_face_import_xml(MTX_GAUGE_FACE(gauge),filename); lookup_current_value_f(firmware->te_params[table_num]->gauge_datasource, &tmpf); mtx_gauge_face_set_value(MTX_GAUGE_FACE(gauge),tmpf); g_free(filename); id = create_rtv_value_change_watch_f(firmware->te_params[table_num]->gauge_datasource,FALSE,"update_misc_gauge",(gpointer)gauge); OBJ_SET(gauge,"gauge_id",GINT_TO_POINTER(id)); gtk_container_add(GTK_CONTAINER(parent),gauge); } gtk_notebook_append_page(GTK_NOTEBOOK(notebook),widget,label); curve_parent = glade_xml_get_widget(xml,"te_right_frame"); curve = mtx_curve_new(); curve_list = g_list_prepend(curve_list,(gpointer)curve); mtx_curve_set_title(MTX_CURVE(curve),_(firmware->te_params[table_num]->title)); mtx_curve_set_x_axis_label(MTX_CURVE(curve),_(firmware->te_params[table_num]->x_axis_label)); mtx_curve_set_y_axis_label(MTX_CURVE(curve),_(firmware->te_params[table_num]->y_axis_label)); cdata = g_new0(CurveData, 1); cdata->curve = curve; cdata->axis = _X_; cdata->source = firmware->te_params[table_num]->x_source; id = create_rtv_value_change_watch_f(cdata->source,FALSE,"update_curve_marker",(gpointer)cdata); mtx_curve_set_show_x_marker(MTX_CURVE(curve),TRUE); OBJ_SET(curve,"cdata",(gpointer)cdata); OBJ_SET(curve,"marker_id",GINT_TO_POINTER(id)); mtx_curve_set_auto_hide_vertexes(MTX_CURVE(curve),TRUE); g_signal_connect(G_OBJECT(curve),"coords-changed", G_CALLBACK(coords_changed), NULL); g_signal_connect(G_OBJECT(curve),"vertex-proximity", G_CALLBACK(vertex_proximity), NULL); g_signal_connect(G_OBJECT(curve),"marker-proximity", G_CALLBACK(marker_proximity), NULL); label = glade_xml_get_widget(xml,"x_units"); gtk_label_set_markup(GTK_LABEL(label),firmware->te_params[table_num]->x_units); label = glade_xml_get_widget(xml,"y_units"); gtk_label_set_markup(GTK_LABEL(label),firmware->te_params[table_num]->y_units); label = glade_xml_get_widget(xml,"x_title"); gtk_label_set_markup(GTK_LABEL(label),firmware->te_params[table_num]->x_name); label = glade_xml_get_widget(xml,"y_title"); gtk_label_set_markup(GTK_LABEL(label),firmware->te_params[table_num]->y_name); rows = firmware->te_params[table_num]->bincount; mtx_curve_set_empty_array(MTX_CURVE(curve),rows); x_table = gtk_table_new(rows+1,1,FALSE); y_table = gtk_table_new(rows+1,1,FALSE); x_parent = glade_xml_get_widget(xml,"te_x_frame"); y_parent = glade_xml_get_widget(xml,"te_y_frame"); gtk_container_set_border_width(GTK_CONTAINER(x_table),5); gtk_container_set_border_width(GTK_CONTAINER(y_table),5); gtk_container_add(GTK_CONTAINER(x_parent),x_table); gtk_container_add(GTK_CONTAINER(y_parent),y_table); x_mult = get_multiplier_f(firmware->te_params[table_num]->x_size); y_mult = get_multiplier_f(firmware->te_params[table_num]->y_size); x_entries = g_array_new(FALSE,TRUE,sizeof(GtkWidget *)); y_entries = g_array_new(FALSE,TRUE,sizeof(GtkWidget *)); for (i=0;i<rows;i++) { /* X Column */ entry = gtk_entry_new(); OBJ_SET(entry,"last_value",GINT_TO_POINTER(-G_MAXINT)); gtk_entry_set_width_chars(GTK_ENTRY(entry),7); OBJ_SET(entry,"curve_index",GINT_TO_POINTER(i)); g_array_insert_val(x_entries,i,entry); OBJ_SET(entry,"curve_axis",GINT_TO_POINTER(_X_)); OBJ_SET(entry,"dl_type",GINT_TO_POINTER(IMMEDIATE)); OBJ_SET(entry,"handler",GINT_TO_POINTER(GENERIC)); OBJ_SET_FULL(entry,"raw_lower",g_strdup_printf("%i",(firmware->te_params[table_num]->x_raw_lower)),g_free); OBJ_SET_FULL(entry,"raw_upper",g_strdup_printf("%i",(firmware->te_params[table_num]->x_raw_upper)),g_free); OBJ_SET(entry,"fromecu_mult",firmware->te_params[table_num]->x_fromecu_mult); OBJ_SET(entry,"fromecu_add",firmware->te_params[table_num]->x_fromecu_add); OBJ_SET(entry,"precision",GINT_TO_POINTER(firmware->te_params[table_num]->x_precision)); OBJ_SET(entry,"size",GINT_TO_POINTER(firmware->te_params[table_num]->x_size)); OBJ_SET(entry,"page",GINT_TO_POINTER(firmware->te_params[table_num]->x_page)); OBJ_SET(entry,"temp_dep",GINT_TO_POINTER(firmware->te_params[table_num]->x_temp_dep)); OBJ_SET(entry,"use_color",GINT_TO_POINTER(firmware->te_params[table_num]->x_use_color)); if(firmware->te_params[table_num]->x_temp_dep) { OBJ_SET(entry,"widget_temp",DATA_GET(global_data,"mtx_temp_units")); OBJ_SET_FULL(entry,"bind_to_list", g_strdup("temperature"),g_free); bind_to_lists_f(entry,"temperature"); } offset = (i*x_mult) + firmware->te_params[table_num]->x_base; OBJ_SET(entry,"offset",GINT_TO_POINTER(offset)); g_signal_connect(G_OBJECT(entry),"changed", G_CALLBACK(update_2d_curve),curve); g_signal_connect(G_OBJECT(entry),"changed", G_CALLBACK(entry_changed_handler_f),NULL); g_signal_connect(G_OBJECT(entry),"key_press_event", G_CALLBACK(key_event_f),NULL); g_signal_connect(G_OBJECT(entry),"key_release_event", G_CALLBACK(key_event_f),NULL); g_signal_connect(G_OBJECT(entry),"focus_out_event", G_CALLBACK(focus_out_handler_f),NULL); g_signal_connect(G_OBJECT(entry),"activate", G_CALLBACK(std_entry_handler_f),NULL); if (firmware->te_params[table_num]->reversed) gtk_table_attach(GTK_TABLE(x_table),entry, 0,1,rows-i-1,rows-i, GTK_SHRINK,GTK_SHRINK,0,0); else gtk_table_attach(GTK_TABLE(x_table),entry, 0,1,i,i+1, GTK_SHRINK,GTK_SHRINK,0,0); page = firmware->te_params[table_num]->x_page; ecu_widgets[page][offset] = g_list_prepend(ecu_widgets[page][offset],(gpointer)entry); widget_list = g_list_prepend(widget_list,(gpointer)entry); update_widget(G_OBJECT(entry),NULL); /* Y Column */ entry = gtk_entry_new(); OBJ_SET(entry,"last_value",GINT_TO_POINTER(-G_MAXINT)); gtk_entry_set_width_chars(GTK_ENTRY(entry),7); OBJ_SET(entry,"curve_index",GINT_TO_POINTER(i)); g_array_insert_val(y_entries,i,entry); OBJ_SET(entry,"curve_axis",GINT_TO_POINTER(_Y_)); OBJ_SET(entry,"dl_type",GINT_TO_POINTER(IMMEDIATE)); OBJ_SET(entry,"handler",GINT_TO_POINTER(GENERIC)); OBJ_SET_FULL(entry,"raw_lower",g_strdup_printf("%i",(firmware->te_params[table_num]->y_raw_lower)),g_free); OBJ_SET_FULL(entry,"raw_upper",g_strdup_printf("%i",(firmware->te_params[table_num]->y_raw_upper)),g_free); OBJ_SET(entry,"fromecu_mult",firmware->te_params[table_num]->y_fromecu_mult); OBJ_SET(entry,"fromecu_add",firmware->te_params[table_num]->y_fromecu_add); OBJ_SET(entry,"precision",GINT_TO_POINTER(firmware->te_params[table_num]->y_precision)); OBJ_SET(entry,"size",GINT_TO_POINTER(firmware->te_params[table_num]->y_size)); OBJ_SET(entry,"page",GINT_TO_POINTER(firmware->te_params[table_num]->y_page)); OBJ_SET(entry,"temp_dep",GINT_TO_POINTER(firmware->te_params[table_num]->y_temp_dep)); OBJ_SET(entry,"use_color",GINT_TO_POINTER(firmware->te_params[table_num]->y_use_color)); if(firmware->te_params[table_num]->y_temp_dep) { OBJ_SET(entry,"widget_temp",DATA_GET(global_data,"mtx_temp_units")); OBJ_SET_FULL(entry,"bind_to_list", g_strdup("temperature"),g_free); bind_to_lists_f(entry,"temperature"); } offset = (i*y_mult) + firmware->te_params[table_num]->y_base; OBJ_SET(entry,"offset",GINT_TO_POINTER(offset)); g_signal_connect(G_OBJECT(entry),"changed", G_CALLBACK(update_2d_curve),curve); g_signal_connect(G_OBJECT(entry),"changed", G_CALLBACK(entry_changed_handler_f),NULL); g_signal_connect(G_OBJECT(entry),"key_press_event", G_CALLBACK(key_event_f),NULL); g_signal_connect(G_OBJECT(entry),"key_release_event", G_CALLBACK(key_event_f),NULL); g_signal_connect(G_OBJECT(entry),"focus_out_event", G_CALLBACK(focus_out_handler_f),NULL); g_signal_connect(G_OBJECT(entry),"activate", G_CALLBACK(std_entry_handler_f),NULL); if (firmware->te_params[table_num]->reversed) gtk_table_attach(GTK_TABLE(y_table),entry, 0,1,rows-i-1,rows-i, GTK_SHRINK,GTK_SHRINK,0,0); else gtk_table_attach(GTK_TABLE(y_table),entry, 0,1,i,i+1, GTK_SHRINK,GTK_SHRINK,0,0); page = firmware->te_params[table_num]->y_page; ecu_widgets[page][offset] = g_list_prepend(ecu_widgets[page][offset],(gpointer)entry); widget_list = g_list_prepend(widget_list,(gpointer)entry); update_widget(G_OBJECT(entry),NULL); } /* Create the "LOCK" buttons */ dummy = gtk_toggle_button_new_with_label("Unlocked"); OBJ_SET(dummy,"axis",GINT_TO_POINTER(_X_)); g_signal_connect(G_OBJECT(dummy),"toggled", G_CALLBACK(set_axis_locking),curve); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dummy),firmware->te_params[table_num]->x_lock); gtk_table_attach(GTK_TABLE(x_table),dummy, 0,1,i,i+1, GTK_EXPAND|GTK_FILL,0,0,0); dummy = gtk_toggle_button_new_with_label("Unlocked"); OBJ_SET(dummy,"axis",GINT_TO_POINTER(_Y_)); g_signal_connect(G_OBJECT(dummy),"toggled", G_CALLBACK(set_axis_locking),curve); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dummy),firmware->te_params[table_num]->y_lock); gtk_table_attach(GTK_TABLE(y_table),dummy, 0,1,i,i+1, GTK_EXPAND|GTK_FILL,0,0,0); mtx_curve_set_x_precision(MTX_CURVE(curve),firmware->te_params[table_num]->x_precision); mtx_curve_set_y_precision(MTX_CURVE(curve),firmware->te_params[table_num]->y_precision); mtx_curve_set_hard_limits(MTX_CURVE(curve), (gfloat)firmware->te_params[table_num]->x_raw_lower, (gfloat)firmware->te_params[table_num]->x_raw_upper, (gfloat)firmware->te_params[table_num]->y_raw_lower, (gfloat)firmware->te_params[table_num]->y_raw_upper); OBJ_SET(curve,"x_entries",x_entries); OBJ_SET(curve,"y_entries",y_entries); if (firmware->te_params[table_num]->bind_to_list) g_list_foreach(get_list_f(firmware->te_params[table_num]->bind_to_list),alter_widget_state_f,NULL); create_rtv_value_change_watch_f(cdata->source,TRUE,"update_curve_marker",(gpointer)cdata); gtk_container_add(GTK_CONTAINER(curve_parent),curve); } OBJ_SET(window,"widget_list",widget_list); OBJ_SET(window,"curve_list",curve_list); OBJ_SET(window,"gauge_list",gauge_list); gtk_widget_show_all(window); return TRUE; }