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

UrShape definition Part II



Cyrille: Thanks for this enlighening answer. To anyone else:

> This is somewhat of a mess now, but it's also the way to integrate into the
> dia core without it really knowing the UrShapes are special (which it
> shouldn't, until the UrShape code is considered "core" like stdprop now is).
Yep. I think it will do us no harm to code the UrShapes around the
core, not vice-versa.

> Basically, ObjectOps is a pointer to the class' vtable (or interface method
> pointer table), and ObjectTypeOps can be viewed as the class factory's
> interface vtable (with ObjectType being a class descriptor bundled with a
> pointer to the default icon xbm [in case it's not overridden in the sheet]).
Ok. Now even I see where it goes.

> I'm not really sure every instance of every UrShape really needs a
> pointer to the ObjectTypeOps structure ; there's already a pointer
> to it in the ObjectType structure (which is pointed to in Object).
Ok, we don't need it.

> OTOH, every UrShape (if UrShape are really seen as objects by the
> core) should have at least an Object as their first member
> (usually named obj if it's an Object, elem if it's an Element, and
> so on).
In my opinion it will rather be an element (post if you disagree).

> Object already provides a number of minimum things the
> core expects from an object, in the format it expects ; see
> lib/object.h for reference. Of course this "first member" and
> "cast frenzy" thingy is just an excuse for the lack of proper
> inheritance in C.
Sin forgiven. ;) I've had a look at object.h and element.h, so I
decided it's time for the next Part of the UrShape definition process:

/* urshape.h : defining the generic UrShape */

#ifndef URSHAPE_H
#define URSHAPE_H

struct _UrShape {
  /* Element first, since this _is_ an element */
  Element element;
  /* The maximal amount of children UrShapes */
  int max_children;
  int last_children; /* optional */

  /* The miniDOM stuff */
  UrShape *parent_shape;
  UrShape*[] children_shapes;
  UrShape *first_child_shape;
  UrShape *last_child_shape;
  UrShape *previous_shape;
  UrShape *next_shape;
}

typedef struct _UrShape UrShape;

/* All functions (including DOM) go here */
#endif

/* END */

cu Andre
-- 
Tolerance rulez, everything else sux! -- Andre Kloss





[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