[Ardour-Dev] GTK+ (concepts and advice)

John Emmas johne53 at tiscali.co.uk
Mon Jun 16 01:01:15 PDT 2008


Hi all,

Earlier in the year I completed the functionality for an Ardour "session
merger" whereby two Ardour sessions can me merged together.  In fact, if one
of the sessions was non-existent, it could also provide a "Save As" feature
(allowing a session to be renamed) although I haven't got that far yet.

Being a Windows programmer, I haven't yet tackled a GUI for Ardour.  In
fact, the only step I've taken is to buy a book about GTK+ development and
I'm trying to get to grips with some of the concepts.  The book I bought is
called "Foundations of GTK+ Development" by Andrew Krause and although
it's well written and authoritative, I can't help noticing that some of its
concepts would be considered total herecy for a Windows programmer!!  ;-)
For example, under Windows, there's an underlying principle that you never
store (or pass around) pointers to window objects.  Because the OS can swap
these objects to disk and back, you should never assume that they'll be
swapped back to the same physical memory addresses from whence they came.

Of course, modern versions of Windows use a 'virtual machine' addressing
model which alleviates this problem to a great extent.  Nevertheless, it's
considered 'bad form' to assume that GUI object addresses will remain
persistent.  Windows maintains handles for objects (which DO remain
persistent).  Therefore, if you need the address of a GUI object, you find
it out from knowing its handle.  I just wondered if there was any similar
concept in GTK+.  I can't see anything from my book but I don't want to
start programming with a fundamental misconception as big as this.

Another thing I've noticed is that GTK+ seem to be remarkably 'non'
object-oriented.  There seems to be a heavy reliance on global functions
which get used to manipulate objects, rather than the objects knowing how to
manipulate themselves.  Even the most basic things like object placement,
or setting the text for an object - these actions seem to be unknown to the
objects themselves.  Is this a concept that I'll just have to get used to or
should I buy another book??

Thanks,

John 




More information about the Ardour-Dev mailing list