> ... But as a > starting point I have changed the string 'Yes' to these radio-buttons. > It is done by the following changes in src/gui-config.c:
and > There's no need to write a callback; default one will refresh the > GtkTreeView widget to include your changes to the model. > Please have a look at the attached patch. Thanks for help! Both codes work well in case of initial drawing radiobuttons instead of string, and result looks good. But in case of user input, when i apply this patch, i fall into several problems. 1. If i use patch 'as is', editing of grid values not work: my 'cb_edited_mm_or_mil' assumes PCB->CurrentGrid already changed to current before call: it uses PCB->Grid[PCB->CurrentGrid] = ..... , but when i use patch, editing value in table not switch PCB- >CurrentGrid: it was tied to treeview row selection before and was done before editing (it was when i place cursor on needed row), but now it's not true: when i select row but not touch toggle button, PCB->CurrentGrid not updates. And anyway i prefer use radiobuttons here only for display but not for callback. BUT... 2. If i try to restore my previous state when PCB->CurrentGrid updates not here g_signal_connect(renderer, "toggled", (GCallback) cb_toggled_active, treeview); but here g_signal_connect(select, "changed", G_CALLBACK(on_changed), select); (i.e. even work using cursor keys in treeview to select row) then i again and again fall into same hair-tearing problem as before this patch: i can't write procedure to change anything in treeview. the simplest way i try is place this piece of code gtk_tree_model_foreach (gtk_tree_view_get_model (view), refresh_gridcurrent, path); - it work from this original place in patch into my code: void on_changed { ... g_print("Row number %i selected.\n", i); - its work. ... gtk_tree_model_foreach (...) - its not work from here. } When i try to turn it to work, in good case i get tons of GTK-CRITICALS, and in worst case program shuts off silently. I dont have enough skills to write procedure headers like this void anything (GtkWidget *widget, gpointer treeview) or void anything (GtkWidget *widget, GtkCellRendererToggle *cell, gchar *path_string, GtkTreeView *view) i can't imagine how to write this headers, only i able is blind trial-and-errors, i do it now but still no success. Sorry for this long text. > BTW - selecting a grid that does have 0 spacing segfaults pcb. Thank you! My regression. Fixed now: diff -urw pcb.git.test/src/hid/gtk/gtkhid-gdk.c pcb/src/hid/gtk/gtkhid-gdk.c --- pcb.git.test/src/hid/gtk/gtkhid-gdk.c 2011-02-28 13:38:50.000000000 +0300 +++ pcb/src/hid/gtk/gtkhid-gdk.c 2011-03-03 11:11:51.000000000 +0300 @@ -132,6 +132,8 @@ if (d==0) { // static grid without any check to min distance, zooming, etc, // made by request + if (g==0) + return; gridmode = 1; pcbgrid = g; } else { > BTW2 - > why do you store grid mm and mil spacings as strings?? Sorry i don't precisely understand you. The only place for strings in my code is in display/editing routines. Spacing is double PCB->Grid[PCB->CurrentGrid]; int PCB->GridStep[PCB->CurrentGrid]; regardless of mil or mm mode. _______________________________________________ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user