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

UrShape definition Part IV: Full header (?)



Hi folks, especially John and Cyrille, since you two seem to give the
most constructive feedback.

As you may (or may not) know, time is of the essence for my purpose,
so I'm seeking help _fast_. The UrShape is now somehow defined, but
still far from implementation. 

What we need are the needed callbacks ready to implement. Then we can
try and implement them, so we see where the hooks and angles are.

NOTES: I have renamed the Container to UrContainer, since I found a
Container in dia/app/gtkwrapbox.h and I want to disambiguate. I added
a list of borders for the UrContainers, where the layout information
can be stored. In this scope, relative[width|height] become obsolete.

There are still some open Qs from the last proposal:

How can UrShapes interact? If a UrShape is dragged over a (free)
UrContainer, it should snap into it until dragged out again. Any
UrContainer that has means of containing another UrShape should resize
to make place for one if one's dragged over. How does a UrShape know
what UrContainer it is over? What _do_ we have to implement? In
element.h, I find the following:

void element_update_handles(Element *elem);
/* What does this do? */
void element_update_boundingbox(Element *elem);
/* What does that do? */
void element_init(Element *elem, int num_handles, 
                  int num_connections);
void element_destroy(Element *elem);
void element_copy(Element *from, Element *to);
void element_move_handle(Element *elem, HandleId id,
                         Point *to, HandleMoveReason reason);
/* Here goes much functionality. How to implement standard
   behaviour? (As described in Part III) */
void element_move_handle_aspect(Element *elem, HandleId id,
                                Point *to, real aspect_ratio);
/* Why this? Does this differ from move_handle? Do we need it? */

void element_save(Element *elem, ObjectNode obj_node);
void element_load(Element *elem, ObjectNode obj_node);
/* This certainly belongs to the parser, right? It seems that this
   relies on DOM to work. How to integrate SAX here? */

/* Do we have to implement more stuff? If so, what stuff? How much
   and what code can we C&P from custom shapes? */

I'm glad you've read this far. If you know some answers, please post.
I hope we can go into the implementation once these Qs are answered.
cu Andre

8<-----------------------------UrShape.h--------------------->8

/* urshape.h : defining the generic UrShape */
#ifndef URSHAPE_H
#define URSHAPE_H

#include "element.h"
/* What else has to be included? */

typedef enum _UrContainerType UrContainerType;
typedef struct _UrContainer UrContainer;
typedef struct _UrShape UrShape;

enum _UrContainerType {
  SINGLE,
  HORIZANTAL_ARRAY,
  VERTICAL_ARRAY,
  TABLE
};

struct _UrContainer {
  Point relative_position;
  UrContainerType type; /* This will define behaviour */
  GList *rows;		/* The left border of rows */
  GList *columns;	/* The upper border of columns */
}

struct _UrShape {
  Element element;      /* Inheritance (C sometimes sucks ;) */

  /* UrShape container stuff */
  UrContainer *embedding; /* NULL if free, 
                             "parent's" container else */
  int row,column; /* For all but SINGLE, it'll be nice to know in what
                     row/column the UrShape is embedded. */
  GList *childrenContainers; /* The containers I have */

  /* The miniDOM. Thanx to Cyrille, now it _is_ mini. */
  UrShape *parent_shape;
  GList *self; /* this->self->data == this */
  GList *children; /* (this->children->data->parent_shape == this ||
                       this->children == NULL) */
};

#endif








[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