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

Re: New Shapeset -- What Will I Need To Do...?



On Tue, 3 Sep 2002, Tim Ellis wrote:
>> Then, that's the place !
> 
> StdProp... oh, where do I begin...?
> 
> I pulled up chrono*.c and looked at them, and I can see kind'f what needs
> to be done. I've begun a skeleton of StdProp docs after Lars' creation of
> the page: http://faemalia.org/wiki/view/Technical/StdProps.

I'll keep an eye on them to see that you don't make any horrible mistakes.

> Mainly, where I'm getting confused is ideology. I know we're using C
> which doesn't know Object Orientation (heh), but I see a lot of OOP
> concepts.  lib/object.h seems to define some... uh... pointers? Or
> pointer replacements...? 
[...]

Yes, we're doing OOP in C.  Since C doesn't understand inheritance, virtual
functions and 'this', we have to use a few conventions:

The first parameter to any OO style call is 'this', the object called on.
In objects, that will be the object itself, except in _draw, where a bunch
of renderer calls take place.

Inheritance is done by having the parent as the first part of the
structure.  Then we can always cast upwards.  GTK uses the same idea, but
has fancier macros.

There is one 'class' structure for each kind of OO object, of type
ObjectType.  It contains the name, pixmap and most importantly class
methods (create, load/save, get/set defaults).

The 'vtables' (ops structures) aren't automatically inherited by the
objects (renderers are slightly better at that).  Thus you see some slots
filled with object_* functions.

> (This chronoline_ops thing doesn't use CreateFunc???)

The CreateFunc is part of the class functions.

> So how should I begin? Should I just take the chrono*.c files and begin
> modifying them to create an ERD shapeset? I assume I *WILL* be coding C
> and not making little XML files, right?

Right.  The chrono*.c files are a good startingpoint -- chronoref.c is
slightly simpler.  The main thing they don't use is object menus, you can
look in standard/bezier.c for a good example of that.

> Obviously since I've only spent 20 minutes familiarising myself with
> StdProp so far, I don't know much. I guess I'm looking for a good
> starting point. Esp code that actually uses it currently (like chrono*.c)
> but which is uses every feature -- does chrono*.c do?

Not quite every feature, but enough that you should get up to speed.  Don't
try to code everything at once, start out with just a single property, say.
Once you have gotten a new object into Dia, however simple, you've done the
footwork, and the rest is the interesting part.

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| Hårdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK