(Tricky?) questions about GTK widget hierarchy and GNOME canvas




Hello, dear GTK/GNOME developers!

I'm trying to put together a simple VLSI layout editor using GTK and
GNOME (GPLed, of course :) ) and I've run into some problems and would
like to hear your opinions.

Let me tell you that I'd accept the suggestion to "Read the Source",
but I hate to rely on "undocumented" (whatever that means at the
present state of documentation ;) ) behavior or on tricks which go
against the intend of library writers.

So, the first question. Let's say I want to build a Notebook with
couple pages (corresponding to different drawing modes) and they might
have a common block of widgets + whatever is specific for a given
page. Imagine I've packed this common block into, say, a VerticalBox
and have a pointer to that. Can I pack this Box into different pages
on my notebook (providing the same pointer all the time) or do I have
to create a new one for each page?  It seems that GTK API allows that,
but will the widget behave as expected (e.g., can I have two "views"
of that widget on the screen simultaneously).

It boils down to the question if a GTK child maintains the parent
identity within itself or the parent-child relationship is maintaned
on the parent side. 

(BTW, if I actually can re-use one widget in several others, it would
be great to teach GLADE how to exploit this feature :)).

The second question is related and deals with
GnomeCanvas/GnomeCanvasGroup relationship (though GNOME API does not
seem to allow it that easily!).

In my library I have cells (what they call "cell masters" in CAD) and
they can be used in definitions of other cells (each such use is a
"cell instance"). I thought about reading each cell into its own
GnomeCanvasGroup (with natural instantiating of a sub-cell's Group
within a higher-level cell). For cell editing I want to flatten a
Group one level into a Canvas (with all sub-cells/Groups visible while
only sub-Group as a whole is manipulated).

This possibility seems to be mentioned in GnomeCanvas.h:

 * Consider a circuit editor application that uses the canvas for its schematic
 * display.  Hierarchically, there would be canvas groups that contain all the
 * components needed for an "adder", for example -- this includes some logic
 * gates as well as wires.  You can move stuff around in a convenient way by
 * doing a gnome_canvas_item_move() of the hierarchical groups -- to move an
 * adder, simply move the group that represents the adder.

BUT: Can we have several identical adders on one canvas? 
     Can we have several identical adders on several canvases?
     Can they be rotated/mirrowed/etc. independently?

... and 

    How do I create a CanvasGroup without a parent then attach it to
whatever parent(s) it is instantiated in? 

I do not expect that this will work (from the same header file: "The
only information a GnomeCanvasItem contains is its parent canvas,
etc."), but then how it was intended to implement that "schematic
display"? ;-)

And, finally the last easy one: How to I walk through all objects
attached to a Canvas?

Thank you for your time, hope to get some answers !

P.S. I'd appreciate a 
     Cc: paul@pbunyk.physics.sunysb.edu

Yours,

Paul

-- 
  ("`-''-/").___..--''"`-._   UNIX *is* user-friendly, he is just very 
   `6_ 6  )   `-.  (     ).`-.__.`) picky about who his friends are...
   (_Y_.)'  ._   )  `._ `. ``-..-'      Paul Bunyk, Research Scientist
 _..`--'_..-_/  /--'_.' ,'art by           (and part-time UN*X sysadm)
(il),-''  (li),'  ((!.-' F. Lee http://pbunyk.physics.sunysb.edu/~paul



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