hugin: use command and panoramaChanged() [Re: hugin::Images]

Kai-Uwe Behrmann ku.b at gmx.de
Thu Jun 12 11:07:43 BST 2003


Am 12.06.03, 00:49 +0200 schrieb Pablo d'Angelo:

> A word on how the Panorama class and the GUI are supposed to work
> together (also read something about the command and observer patterns):
>
> 1. never change the Panorama directly (for example with
>    pano->AddImage()). Use the Commands from
>    PanoCommand.h to make changes to the panorama.
>    If one is missing, feel free to create a new one.
>
> 2. execute the command using the GlobalCmdHistory singleton.
>    This will ensure proper undo/redo.
>
> 3. never change the GUI view of the panorama (listviews, Control point
>    display...) directly from the function that issues the command.
>    You will not know what needs to be updated. Even if you know
>    everything, some other part of the program will issue the command
>    and that part will not (and does not want to) know exactly which
>    control depend on that change.

This is the case in initial view of CPEditor. I found no way yet to select
the first tab without selecting a second before. An EVT_TAB_SEL_CHANGED
event dont compile wich would help solve this. So this is only an - even
terrible - workarround.

> 4. update the GUI inside the panoramaChanged() and
>    friends. This way the sender of the command is completely
>    relieved from the responsibility of updating the GUI.
>    Panorama is resposible for calling these functions, since
>    it knows best what changed.
>
> This separation might look like overkill, but it makes everything
> flexible and easy to change even if one does not know every dark corner
> of the program. Think about adding some scripting etc. The scripting
> engine should never know which GUI elements need to be changed when
> an image is added.
>
> I'm going to change some of your stuff to make it fit into that scheme.
> but I do not have a lot of time right now, so it might be an incomplete
> change. But I will leave FIXME notes wherever something needs to be
> done.
>
> btw. I thougt about creating a class for every Tab, so that we do
> not end up with a monster 200 kB MainFrame.cpp

Can You lock the files via cvs to let me know there You are working?

> ciao
>   Pablo

Kai-Uwe



More information about the ptX mailing list