2003-10-19 17:44:46 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2007-06-06 16:44:52 +08:00
|
|
|
* This is a plug-in for GIMP.
|
2003-10-19 17:44:46 +08:00
|
|
|
*
|
|
|
|
* Generates images containing vector type drawings.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2003-10-19 17:44:46 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-10-19 17:44:46 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2003-10-19 17:44:46 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GFIG_DOBJECT_H__
|
|
|
|
#define __GFIG_DOBJECT_H__
|
|
|
|
|
2004-11-01 20:03:32 +08:00
|
|
|
#include "gfig-types.h"
|
|
|
|
#include "gfig-style.h"
|
|
|
|
|
2012-02-17 00:56:52 +08:00
|
|
|
typedef void (*DobjDrawFunc) (GfigObject *, cairo_t *);
|
2004-11-16 22:10:20 +08:00
|
|
|
typedef void (*DobjFunc) (GfigObject *);
|
|
|
|
typedef GfigObject *(*DobjGenFunc) (GfigObject *);
|
2004-11-01 20:03:32 +08:00
|
|
|
|
|
|
|
typedef struct DobjPoints
|
|
|
|
{
|
|
|
|
struct DobjPoints *next;
|
|
|
|
GdkPoint pnt;
|
2004-11-15 05:16:06 +08:00
|
|
|
gboolean found_me;
|
2004-11-01 20:03:32 +08:00
|
|
|
} DobjPoints;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DobjType type; /* the object type for this class */
|
2008-09-04 22:20:58 +08:00
|
|
|
const gchar *name;
|
2004-12-05 01:33:54 +08:00
|
|
|
|
|
|
|
/* virtuals */
|
2012-02-17 00:56:52 +08:00
|
|
|
DobjDrawFunc drawfunc; /* How do I draw myself */
|
2004-11-01 20:03:32 +08:00
|
|
|
DobjFunc paintfunc; /* Draw me on canvas */
|
|
|
|
DobjGenFunc copyfunc; /* copy */
|
2004-12-05 01:33:54 +08:00
|
|
|
void (*update) (GdkPoint *pnt);
|
2004-11-16 22:10:20 +08:00
|
|
|
} GfigObjectClass;
|
2004-11-01 20:03:32 +08:00
|
|
|
|
2006-06-27 16:07:18 +08:00
|
|
|
extern GfigObjectClass dobj_class[10];
|
2004-11-01 20:03:32 +08:00
|
|
|
|
|
|
|
/* The object itself */
|
2004-11-16 22:10:20 +08:00
|
|
|
struct _GfigObject
|
2004-11-01 20:03:32 +08:00
|
|
|
{
|
2004-11-16 22:10:20 +08:00
|
|
|
DobjType type; /* What is the type? */
|
|
|
|
GfigObjectClass *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-02 07:58:43 +08:00
|
|
|
};
|
2004-11-01 20:03:32 +08:00
|
|
|
|
|
|
|
/* States of the object */
|
|
|
|
#define GFIG_OK 0x0
|
|
|
|
#define GFIG_MODIFIED 0x1
|
|
|
|
#define GFIG_READONLY 0x2
|
|
|
|
|
2004-11-16 22:10:20 +08:00
|
|
|
extern GfigObject *obj_creating;
|
|
|
|
extern GfigObject *tmp_line;
|
2004-11-01 20:03:32 +08:00
|
|
|
|
|
|
|
|
2004-11-14 23:55:10 +08:00
|
|
|
DobjPoints *new_dobjpoint (gint x,
|
|
|
|
gint y);
|
2004-11-16 22:10:20 +08:00
|
|
|
void do_save_obj (GfigObject *obj,
|
2004-11-14 23:55:10 +08:00
|
|
|
GString *to);
|
2004-11-01 20:03:32 +08:00
|
|
|
|
2004-11-14 23:55:10 +08:00
|
|
|
DobjPoints *d_copy_dobjpoints (DobjPoints *pnts);
|
2004-11-16 22:10:20 +08:00
|
|
|
void free_one_obj (GfigObject *obj);
|
2004-11-14 23:55:10 +08:00
|
|
|
void d_delete_dobjpoints (DobjPoints *pnts);
|
|
|
|
void object_update (GdkPoint *pnt);
|
|
|
|
GList *copy_all_objs (GList *objs);
|
|
|
|
void draw_objects (GList *objs,
|
2012-02-17 00:56:52 +08:00
|
|
|
gboolean show_single,
|
|
|
|
cairo_t *cr);
|
2004-07-08 01:52:16 +08:00
|
|
|
|
2004-11-16 22:10:20 +08:00
|
|
|
GfigObject *d_load_object (gchar *desc,
|
2004-11-14 23:55:10 +08:00
|
|
|
FILE *fp);
|
2004-07-08 01:52:16 +08:00
|
|
|
|
2004-11-16 22:10:20 +08:00
|
|
|
GfigObject *d_new_object (DobjType type,
|
2004-11-14 23:55:10 +08:00
|
|
|
gint x,
|
|
|
|
gint y);
|
2004-07-08 01:52:16 +08:00
|
|
|
|
2004-11-16 22:10:20 +08:00
|
|
|
void d_save_object (GfigObject *obj,
|
2004-11-14 23:55:10 +08:00
|
|
|
GString *string);
|
2004-07-08 01:52:16 +08:00
|
|
|
|
2004-11-14 23:55:10 +08:00
|
|
|
void free_all_objs (GList *objs);
|
2004-07-08 01:52:16 +08:00
|
|
|
|
2004-11-14 23:55:10 +08:00
|
|
|
void clear_undo (void);
|
2004-07-08 01:52:16 +08:00
|
|
|
|
2004-11-14 23:55:10 +08:00
|
|
|
void new_obj_2edit (GFigObj *obj);
|
2004-07-08 01:52:16 +08:00
|
|
|
|
2004-11-14 23:55:10 +08:00
|
|
|
void gfig_init_object_classes (void);
|
2003-10-19 17:44:46 +08:00
|
|
|
|
2004-12-05 01:33:54 +08:00
|
|
|
void d_pnt_add_line (GfigObject *obj,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint pos);
|
|
|
|
|
2003-10-19 17:44:46 +08:00
|
|
|
#endif /* __GFIG_DOBJECT_H__ */
|
|
|
|
|
|
|
|
|