Re: Multiple documents



First of all let me describe what I am doing. My program is a 3D modeler used as a front end for engineering computations, such as Computational Fluid Dynamics and Finite Element Analysis, etc.. This means it is real similar to what you would expect to find in a typical CAD package.

I am using a notebook widget to display multiple views of the object. Typically I would have front view, side view, top view, and isometric. Each view has a seperate notebook page. I am not doing WiW, because on a typical monitor, the image within the window is too small to do anything useful.

The current model will be displayed in all the notebook pages that were created. Opened but non-current models will not be displayed and will be pointed to by my linked list of struts. In other words, only one model is displayed at a time, but several may be opened and in memory. Changes to any view are automagically updated in all other views with an expose_event call.

Now I hope you understand why I designed my program they way I did. BTW, I am using OpenGL for the display engine, and this will affect the my choice of variables in the struct, but it typically includes stuff like scale, rotation angles, drawing primative lists, layers, parts, etc.

I also have a global struct where I keep my program wide variables. This is where I store the address of the current model. So a typical call would look like:

        gtkcad->current_model->some_variable

I use a dialog box to switch models. The workings behind this are just a simple search using the GTK+ API, then putting the returned address in the above mentioned variable and redrawing the window(s).

Like I said it works for small numbers of open drawings, but I can see performance issues if hundreds of drawings were opened.

Let me know if you need more details. I will be off-line some because I am moving, but will try to answer your questions as soon as possible.

cheers,
Jim Parker



On 2003.08.26 11:15 Chris Garrett wrote:
Hi,

That is pretty much the way I thought I would have to do it. However, I am experiencing some confusion about how to ensure that callbacks from the canvas end up resulting in changes on the correct image. I havent written any code for multiple documents yet, since I am still thinking about the design of the structures etc.

I also need to consider a way for multiple views of the same document to be updated whenever changes are made... I think the structs will have a lot of links in them so it is easy to pull out the ones needed in any given circumstance!

Is there any chance you could point me in the direction of your code so I can see how the callbacks are working? This is the area I am having difficulty with (probably because I am still new to GTK). I am making a pixel-based drawing program myself, but I dont intend it to compete with the GIMP - it would have more of a focus on image creation rather than image manipulation.

As far as the type of MDI I aim to use, it will be pretty-much like the GIMP in style - ie. no tabs and no WiW. Ideology aside, I find WiW claustrophopic and I am not 100% sure that tabs are suitable for images.

Best regards,

Chris.


From: Jim Parker <hopeye cfl rr com>
To: Chris Garrett <garrett91 hotmail com>
CC: gtk-app-devel-list gnome org
Subject: Re: Multiple documents
Date: Mon, 25 Aug 2003 15:00:19 -0400

G'Day !

I do not know if this is the best way, but I am using a linked list of struts, with each strut containing the information needed by each document (BTW I'm doing a vector drawing program).

Works well for small numbers of documents, never tested for large sets ...

cheers,
Jim Parker


On 2003.08.25 14:22 Chris Garrett wrote:
Hi all,

Is there a standard / recommended way to write an application that can open more than one document at a time, and that allows more than one view of each document (ala GIMP)?

If so, is there a nice, small, simple example I can look at to get started? The source code to the GIMP is too large for my tired brain at the moment :o(

BTW, I am using GTK2.2

Best regards,

Chris.

_________________________________________________________________
Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger http://www.msn.co.uk/messenger




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