Re: Dia Automatic Layouting

Am 04.08.2008 23:05, Fred Morcos schrieb:
On Mon, Aug 4, 2008 at 10:19 PM, Hans Breuer <hans breuer org> 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?

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.

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

How many invocations are shown in the video? (-:

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;))

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]