]> git.sur5r.net Git - glabels/blob - glabels1/src/label.h
2009-09-22 Jim Evins <evins@snaught.com>
[glabels] / glabels1 / src / label.h
1 /*
2  *  (GLABELS) Label and Business Card Creation program for GNOME
3  *
4  *  label.h:  GLabels label module header file
5  *
6  *  Copyright (C) 2001-2002  Jim Evins <evins@snaught.com>.
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21  */
22 #ifndef __LABEL_H__
23 #define __LABEL_H__
24
25 #include <gtk/gtk.h>
26 #include <libgnomeprint/gnome-font.h>
27 #include <gdk-pixbuf/gdk-pixbuf.h>
28
29 #include "merge.h"
30 #include "text_node.h"
31 #include "template.h"
32 #include "bc.h"
33
34 typedef struct {
35
36         gchar *template_name;
37         glTemplate *template;
38         gboolean rotate_flag;
39
40         gdouble width, height;
41
42         GList *objects;
43
44         glMergeType merge_type;
45         gchar *merge_src;
46         GList *merge_fields;    /* Merge Field Definitions */
47
48 } glLabel;
49
50 typedef enum {
51         GL_LABEL_OBJECT_TEXT,
52         GL_LABEL_OBJECT_BOX,
53         GL_LABEL_OBJECT_LINE,
54         GL_LABEL_OBJECT_ELLIPSE,
55         GL_LABEL_OBJECT_IMAGE,
56         GL_LABEL_OBJECT_BARCODE,
57         GL_LABEL_OBJECT_N_TYPES
58 } glLabelObjectType;
59
60 typedef struct {
61
62         glLabel *parent;
63
64         glLabelObjectType type;
65         gdouble x, y;
66
67         union {
68
69                 struct {
70                         GList *lines;   /* list of glLabelTextNode lists */
71                         gchar *font_family;
72                         gdouble font_size;
73                         GnomeFontWeight font_weight;
74                         gboolean font_italic_flag;
75                         GtkJustification just;
76                         guint color;
77                 } text;
78
79                 struct {
80                         gdouble w, h;
81                         gdouble line_width;
82                         guint line_color;
83                         guint fill_color;
84                 } box;
85
86                 struct {
87                         gdouble dx, dy;
88                         gdouble line_width;
89                         guint line_color;
90                 } line;
91
92                 struct {
93                         gdouble w, h;
94                         gdouble line_width;
95                         guint line_color;
96                         guint fill_color;
97                 } ellipse;
98
99                 struct {
100                         gchar *filename;
101                         gdouble w, h;
102                         GdkPixbuf *image;
103                 } image;
104
105                 struct {
106                         glTextNode *text_node;
107                         glBarcodeStyle style;
108                         guint color;
109                         gboolean text_flag;
110                         gdouble scale;
111                 } barcode;
112
113         } arg;
114
115 } glLabelObject;
116 \f
117 typedef enum {
118         LABEL_UNKNOWN_MEDIA = 1,
119         LABEL_OK = 0,
120         LABEL_ERROR_OPEN_XML_PARSE = -10,
121         LABEL_ERROR_SAVE_XML_FILE = -20,
122 } glLabelStatus;
123
124 extern glLabel *gl_label_new (void);
125 extern glLabel *gl_label_new_with_template (const gchar * tmplt_name,
126                                             gboolean rotate_flag);
127 extern void gl_label_free (glLabel ** label);
128
129 extern glLabelStatus gl_label_open_xml (glLabel ** label,
130                                         const gchar * filename);
131 extern glLabelStatus gl_label_open_xml_buffer (glLabel ** label,
132                                                const gchar * buffer);
133
134 extern glLabelStatus gl_label_save_xml (glLabel * label,
135                                         const gchar * filename);
136
137 glLabelStatus gl_label_save_xml_buffer (glLabel * label,
138                                         gchar ** buffer);
139
140 extern glLabelObject *gl_label_object_new (glLabel * label,
141                                            glLabelObjectType type);
142
143 extern glLabelObject *gl_label_object_new_from_object (glLabel * label,
144                                                        glLabelObject * object);
145
146 extern void gl_label_object_free (glLabelObject ** object);
147
148 extern void gl_label_object_raise_to_front (glLabelObject * object);
149 extern void gl_label_object_lower_to_back (glLabelObject * object);
150
151 #endif