[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: Please test new grids for GTK PCB
2011/3/3 jpka <jopka@xxxxxxxxx>:
>> 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...
Okay, I missed that part :)
I would decouple changing the grid from editing the grid settings.
The editing callbacks can query the path in the model and update
PCB->Grid directly.
The ultimate (but also most time consuming) would be to provide a
custom implementation of GtkTreeModel that would map operations on the
PCB->Grid and vice-versa.
> 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:
> ...
> Sorry for this long text.
Each signal handler has its required signature. This can be found in
the GTK docs.
Same for the function passed to gtk_tree_view_foreach() etc.
>> 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.
I was asking why in the model you keep strings and not ints/floats?
--
Krzysztof KoÅciuszkiewicz
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user