2003-10-19 09:44:46 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This is a plug-in for the GIMP.
|
|
|
|
*
|
|
|
|
* Generates images containing vector type drawings.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GFIG_DOBJECT_H__
|
|
|
|
#define __GFIG_DOBJECT_H__
|
|
|
|
|
2004-11-01 12:03:32 +00:00
|
|
|
#include "gfig-types.h"
|
|
|
|
#include "gfig-style.h"
|
|
|
|
|
2004-11-01 23:58:43 +00:00
|
|
|
typedef void (*DobjFunc) (Dobject *);
|
|
|
|
typedef Dobject *(*DobjGenFunc) (Dobject *);
|
|
|
|
typedef Dobject *(*DobjLoadFunc) (FILE *);
|
|
|
|
typedef void (*DobjSaveFunc) (Dobject *, GString *);
|
|
|
|
typedef Dobject *(*DobjCreateFunc) (gint, gint);
|
2004-11-01 12:03:32 +00:00
|
|
|
|
|
|
|
typedef struct DobjPoints
|
|
|
|
{
|
|
|
|
struct DobjPoints *next;
|
|
|
|
GdkPoint pnt;
|
|
|
|
gint found_me;
|
|
|
|
} DobjPoints;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DobjType type; /* the object type for this class */
|
|
|
|
gchar *name;
|
|
|
|
DobjFunc drawfunc; /* How do I draw myself */
|
|
|
|
DobjFunc paintfunc; /* Draw me on canvas */
|
|
|
|
DobjGenFunc copyfunc; /* copy */
|
|
|
|
} DobjClass;
|
|
|
|
|
|
|
|
DobjClass dobj_class[10];
|
|
|
|
|
|
|
|
/* The object itself */
|
2004-11-01 23:58:43 +00:00
|
|
|
struct _Dobject
|
2004-11-01 12:03:32 +00:00
|
|
|
{
|
|
|
|
DobjType type; /* What is the type? */
|
|
|
|
DobjClass *class; /* What class does it belong to? */
|
|
|
|
gint type_data; /* Extra data needed by the object */
|
|
|
|
DobjPoints *points; /* List of points */
|
|
|
|
Style style; /* this object's individual style settings */
|
|
|
|
gint style_no; /* style index of this specific object */
|
2004-11-01 23:58:43 +00:00
|
|
|
};
|
2004-11-01 12:03:32 +00:00
|
|
|
|
2004-11-01 23:58:43 +00:00
|
|
|
struct _DAllObjs
|
2004-11-01 12:03:32 +00:00
|
|
|
{
|
2004-11-01 23:58:43 +00:00
|
|
|
DAllObjs *next;
|
|
|
|
Dobject *obj; /* Object on list */
|
|
|
|
};
|
2004-11-01 12:03:32 +00:00
|
|
|
|
|
|
|
/* States of the object */
|
|
|
|
#define GFIG_OK 0x0
|
|
|
|
#define GFIG_MODIFIED 0x1
|
|
|
|
#define GFIG_READONLY 0x2
|
|
|
|
|
|
|
|
extern Dobject *obj_creating;
|
|
|
|
extern Dobject *tmp_line;
|
|
|
|
|
|
|
|
void d_pnt_add_line (Dobject *obj,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint pos);
|
|
|
|
|
|
|
|
DobjPoints *new_dobjpoint (gint x, gint y);
|
|
|
|
void do_save_obj (Dobject *obj,
|
|
|
|
GString *to);
|
|
|
|
|
|
|
|
DobjPoints *d_copy_dobjpoints (DobjPoints * pnts);
|
|
|
|
void free_one_obj (Dobject *obj);
|
|
|
|
void d_delete_dobjpoints (DobjPoints * pnts);
|
|
|
|
void object_update (GdkPoint *pnt);
|
|
|
|
DAllObjs *copy_all_objs (DAllObjs *objs);
|
|
|
|
void draw_objects (DAllObjs *objs, gint show_single);
|
|
|
|
|
2004-10-28 21:09:33 +00:00
|
|
|
Dobject *d_load_object (gchar *desc,
|
|
|
|
FILE *fp);
|
2004-07-07 17:52:16 +00:00
|
|
|
|
2004-10-28 21:09:33 +00:00
|
|
|
Dobject *d_new_object (DobjType type,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
2004-07-07 17:52:16 +00:00
|
|
|
|
2004-10-28 21:09:33 +00:00
|
|
|
void d_save_object (Dobject *obj,
|
|
|
|
GString *string);
|
2004-07-07 17:52:16 +00:00
|
|
|
|
2004-10-28 21:09:33 +00:00
|
|
|
void free_all_objs (DAllObjs *objs);
|
2004-07-07 17:52:16 +00:00
|
|
|
|
2004-10-28 21:09:33 +00:00
|
|
|
void clear_undo (void);
|
2004-07-07 17:52:16 +00:00
|
|
|
|
2004-10-28 21:09:33 +00:00
|
|
|
void new_obj_2edit (GFigObj *obj);
|
2004-07-07 17:52:16 +00:00
|
|
|
|
2004-10-28 21:09:33 +00:00
|
|
|
gint gfig_obj_counts (DAllObjs *objs);
|
2004-07-07 17:52:16 +00:00
|
|
|
|
2004-10-28 21:09:33 +00:00
|
|
|
void gfig_init_object_classes (void);
|
2003-10-19 09:44:46 +00:00
|
|
|
|
|
|
|
#endif /* __GFIG_DOBJECT_H__ */
|
|
|
|
|
|
|
|
|