On Tue, Aug 5, 2008 at 12:32 AM, Hans Breuer <[EMAIL PROTECTED]> wrote: > Am 04.08.2008 23:05, Fred Morcos schrieb: >> >> On Mon, Aug 4, 2008 at 10:19 PM, Hans Breuer <[EMAIL PROTECTED]> wrote: >>> >>> Am 04.08.2008 01:08, Fred Morcos schrieb: > > [...] > >>>> The other problem is that I can't >>>> figure out a way for the "Undo" feature to revert "all" of the changes >>>> made by the algorithm in one step. >>> >>> If you have partial undo working maybe there is just an >>> undo_set_transactionpoint() missing? >>> >> >> Well, I tried with undo_move_objects, but I can't really figure out >> what Point *orig_pos and Point *dest_pos are for. Also, >> undo_set_transactionpoint(diagram->undo) won't do it either. >> >> Basically, what I want to happen when the user chooses to undo, is not >> to undo each step made by the algorithm, but to undo all what the >> algorithm changed (to revert back to what the user had before he ran >> automatic layouting). >> >> I guess it would be something like: >> >> 1. save current state of diagram into stack >> 2. make changes to the graph (aka run the algorithm on the graph) >> 3. save new state of diagram into stack >> > Currently I have problems understanding what I see in the video. Is it shows > just one invocation of the algortihm but visualizing the internal > iterations?
The videos show multiple invocations of Ctrl+Alt+F but right now (I changed some stuff) and you only need to press Ctrl+Alt+F once, while still having the internal iterations visualized (repainted). Due to some changes I also made, it is pretty quick that it doesn't "animate" anymore although I am still repainting after every iteration. > >> basically, I guess it would be 1 OR 3 to exist, as other functions >> will either save the current state and run, or just run based on that >> the last state was saved from another function, then save the state >> after running. >> > The basic idea - as far as I've understood - is just storing the 'diff' of > original state and destiantion state. For moving it handle this is just the > position before the move and afterwards. For your algorithm this could be > all positions before modification and the final ones. > This allows not only to undo but also to redo the modification if there was > undone too much. > You got my point right. But I was actually asking how to achieve that :) >>>> We can discuss these problems in detail when I send out the patch. >>>> >>> Yes, show us the source ;) >>> >> >> I just have some minor things to finish. Actually now it is way way >> way faster than what is shown in the videos, it now takes less than a >> breeze ;) to get to the final layout (from the same graph shown in the >> videos). >> > How many invocations are shown in the video? (-: A couple of hundred I would guess (I just kept Ctrl+Alt+F pressed down), before the changes I made (mentioned above). > >> One (the only?) thing is that I want to write a small UI with two >> sliders, one for the distance between "connected/related" objects and >> one for the spacing between non-connected objects. As these two slides >> move, the diagram reflects the changes on the fly. >> >> I'm pretty familiar with Gtk+, but one question. Where should the UI >> code go? In commands.c? Or is there another place for that? And what >> about the callback functions from this UI? should they go into >> commands.c even if the UI code is elsewhere? >> > Please put the new dialog in it's own file, commands.c should only include > the bare minimum to map from GtkAction* callback to the Dia functions. > See the recently added find-and-replace.c if you want an example. (Ooops, no > traces of that in commands.c at all;)) Will do that. > > Regards, > Hans > -------- Hans "at" Breuer "dot" Org ----------- > Tell me what you need, and I'll tell you how to > get along without it. -- Dilbert > _______________________________________________ > Dia-list mailing list > [email protected] > http://mail.gnome.org/mailman/listinfo/dia-list > FAQ at http://live.gnome.org/Dia/Faq > Main page at http://live.gnome.org/Dia > > -- Fred Morcos http://fredmorcos.blogspot.com/ http://fredmorcos.googlecode.com/ _______________________________________________ Dia-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/dia-list FAQ at http://live.gnome.org/Dia/Faq Main page at http://live.gnome.org/Dia
