]> git.sur5r.net Git - glabels/blob - glabels2/src/view.h
- Added mygal, a modified version of the gal library, to provide a sophisticated...
[glabels] / glabels2 / src / view.h
1 /*
2  *  (GLABELS) Label and Business Card Creation program for GNOME
3  *
4  *  view.h:  GLabels View 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
23 #ifndef __VIEW_H__
24 #define __VIEW_H__
25
26 #include <gtk/gtk.h>
27 #include <libgnomecanvas/libgnomecanvas.h>
28 #include <libgnomeprint/gnome-font.h>
29
30 #include "label-object.h"
31
32 typedef enum {
33         GL_VIEW_STATE_ARROW,
34         GL_VIEW_STATE_OBJECT_CREATE
35 } glViewState;
36
37 #define GL_TYPE_VIEW            (gl_view_get_type ())
38 #define GL_VIEW(obj)            (GTK_CHECK_CAST((obj), GL_TYPE_VIEW, glView ))
39 #define GL_VIEW_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW, glViewClass))
40 #define GL_IS_VIEW(obj)         (GTK_CHECK_TYPE ((obj), GL_TYPE_VIEW))
41 #define GL_IS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW))
42
43 typedef struct _glView      glView;
44 typedef struct _glViewClass glViewClass;
45
46 #include "view-object.h"
47
48 struct _glView {
49         GtkVBox           parent_widget;
50
51         glLabel          *label;
52
53         GtkWidget        *canvas;
54         gdouble           scale;
55
56         GnomeCanvasGroup *bg_group;              /* Background layer */
57         GnomeCanvasGroup *grid_group;            /* Grid layer */
58         GnomeCanvasGroup *markup_group;          /* Markup layer */
59         GnomeCanvasGroup *label_group;           /* Label layer (user objects) */
60         GnomeCanvasGroup *fg_group;              /* Foreground layer */
61         GnomeCanvasGroup *highlight_group;       /* Highlight layer */
62
63         gdouble           grid_spacing;
64
65         glViewState       state;
66         glLabelObjectType create_type;
67
68         GList             *object_list;           /* glViewObjects */
69         GList             *selected_object_list;  /* glViewObjects */
70
71         /* Clipboard selection stuff */
72         gint              have_selection;
73         glLabel           *selection_data;
74         GtkWidget         *invisible;
75
76         /* Menus */
77         GList             *atomic_selection_items;
78         GList             *multi_selection_items;
79         GtkWidget         *selection_menu;
80         GtkWidget         *empty_selection_menu;
81
82         /* Merge Properties Dialog */
83         GtkWidget         *merge_props_dialog;
84
85         /* Default object text properties */
86         gchar             *default_font_family;
87         gdouble            default_font_size;
88         GnomeFontWeight    default_font_weight;
89         gboolean           default_font_italic_flag;
90         guint              default_text_color;
91         GtkJustification   default_text_alignment;
92
93         /* Default object line properties */
94         gdouble            default_line_width;
95         guint              default_line_color;
96         
97         /* Default object fill properties */
98         guint             default_fill_color;
99 };
100
101 struct _glViewClass {
102         GtkVBoxClass      parent_class;
103
104         /* Selection changed signal */
105         void (*selection_changed) (glView   *view,
106                                    gpointer  user_data);
107
108         /* Signals to support a status bar */
109         void (*zoom_changed)      (glView   *view,
110                                    gdouble   zoom,
111                                    gpointer  user_data);
112         void (*pointer_moved)     (glView   *view,
113                                    gdouble   x,
114                                    gdouble   y,
115                                    gpointer  user_data);
116         void (*pointer_exit)      (glView   *view,
117                                    gpointer  user_data);
118         void (*mode_changed)      (glView   *view,
119                                    gpointer  user_data);
120 };
121
122 G_BEGIN_DECLS
123
124 guint      gl_view_get_type                (void);
125
126 GtkWidget *gl_view_new                     (glLabel           *label);
127
128
129 void       gl_view_show_grid               (glView            *view);
130
131 void       gl_view_hide_grid               (glView            *view);
132
133 void       gl_view_set_grid_spacing        (glView            *view,
134                                             gdouble            spacing);
135
136 void       gl_view_show_markup             (glView            *view);
137
138 void       gl_view_hide_markup             (glView            *view);
139
140 void       gl_view_arrow_mode              (glView            *view);
141
142 void       gl_view_object_create_mode      (glView            *view,
143                                             glLabelObjectType  type);
144
145
146 void       gl_view_select_object           (glView            *view,
147                                             glViewObject      *view_object);
148
149 void       gl_view_unselect_object         (glView            *view,
150                                             glViewObject      *view_object);
151
152 void       gl_view_select_all              (glView            *view);
153
154 void       gl_view_unselect_all            (glView            *view);
155
156 void       gl_view_select_region           (glView            *view,
157                                             gdouble            x1,
158                                             gdouble            y1,
159                                             gdouble            x2,
160                                             gdouble            y2);
161
162 gboolean   gl_view_is_object_selected      (glView            *view,
163                                             glViewObject      *view_object);
164
165 gboolean   gl_view_is_selection_empty      (glView            *view);
166
167 gboolean   gl_view_is_selection_atomic     (glView            *view);
168
169 void       gl_view_delete_selection        (glView            *view);
170
171 void       gl_view_edit_object_props       (glView            *view);
172
173 void       gl_view_raise_selection         (glView            *view);
174
175 void       gl_view_lower_selection         (glView            *view);
176
177 void       gl_view_rotate_selection        (glView            *view,
178                                             gdouble            theta_degs);
179
180 void       gl_view_rotate_selection_left   (glView            *view);
181
182 void       gl_view_rotate_selection_right  (glView            *view);
183
184 void       gl_view_flip_selection_horiz    (glView            *view);
185
186 void       gl_view_flip_selection_vert     (glView            *view);
187
188 void       gl_view_align_selection_left    (glView            *view);
189
190 void       gl_view_align_selection_right   (glView            *view);
191
192 void       gl_view_align_selection_hcenter (glView            *view);
193
194 void       gl_view_align_selection_top     (glView            *view);
195
196 void       gl_view_align_selection_bottom  (glView            *view);
197
198 void       gl_view_align_selection_vcenter (glView            *view);
199
200 void       gl_view_center_selection_horiz  (glView            *view);
201
202 void       gl_view_center_selection_vert   (glView            *view);
203
204 void       gl_view_move_selection          (glView            *view,
205                                             gdouble            dx,
206                                             gdouble            dy);
207
208 gboolean   gl_view_can_selection_text             (glView           *view);
209
210 void       gl_view_set_selection_font_family      (glView           *view,
211                                                    const gchar      *font_family);
212
213 void       gl_view_set_selection_font_size        (glView           *view,
214                                                    gdouble           font_size);
215
216 void       gl_view_set_selection_font_weight      (glView           *view,
217                                                    GnomeFontWeight   font_weight);
218
219 void       gl_view_set_selection_font_italic_flag (glView           *view,
220                                                    gboolean          font_italic_flag);
221
222 void       gl_view_set_selection_text_alignment   (glView           *view,
223                                                    GtkJustification  text_alignment);
224
225 void       gl_view_set_selection_text_color       (glView           *view,
226                                                    guint             text_color);
227
228 gboolean   gl_view_can_selection_fill             (glView           *view);
229
230 void       gl_view_set_selection_fill_color       (glView           *view,
231                                                    guint             fill_color);
232
233 gboolean   gl_view_can_selection_line_color       (glView           *view);
234
235 void       gl_view_set_selection_line_color       (glView           *view,
236                                                    guint             line_color);
237
238 gboolean   gl_view_can_selection_line_width       (glView           *view);
239
240 void       gl_view_set_selection_line_width       (glView           *view,
241                                                    gdouble           line_width);
242
243
244 void       gl_view_cut                     (glView            *view);
245
246 void       gl_view_copy                    (glView            *view);
247
248 void       gl_view_paste                   (glView            *view);
249
250
251 void       gl_view_zoom_in                 (glView            *view);
252
253 void       gl_view_zoom_out                (glView            *view);
254
255 void       gl_view_set_zoom                (glView            *view,
256                                             gdouble            scale);
257
258 gdouble    gl_view_get_zoom                (glView            *view);
259
260 gboolean   gl_view_is_zoom_max             (glView            *view);
261
262 gboolean   gl_view_is_zoom_min             (glView            *view);
263
264
265 void       gl_view_popup_menu              (glView            *view,
266                                             GdkEvent          *event);
267
268 void       gl_view_edit_merge_props        (glView            *view);
269
270
271 void       gl_view_set_default_font_family      (glView            *view,
272                                                  const gchar       *font_family);
273
274 void       gl_view_set_default_font_size        (glView            *view,
275                                                  gdouble            font_size);
276
277 void       gl_view_set_default_font_weight      (glView            *view,
278                                                  GnomeFontWeight    font_weight);
279
280 void       gl_view_set_default_font_italic_flag (glView            *view,
281                                                  gboolean           font_italic_flag);
282
283 void       gl_view_set_default_text_color       (glView            *view,
284                                                  guint              text_color);
285
286 void       gl_view_set_default_text_alignment   (glView            *view,
287                                                  GtkJustification   text_alignment);
288
289 void       gl_view_set_default_line_width       (glView            *view,
290                                                  gdouble            line_width);
291
292 void       gl_view_set_default_line_color       (glView            *view,
293                                                  guint              line_color);
294
295 void       gl_view_set_default_fill_color       (glView            *view,
296                                                  guint              fill_color);
297
298
299 gchar           *gl_view_get_default_font_family      (glView            *view);
300
301 gdouble          gl_view_get_default_font_size        (glView            *view);
302
303 GnomeFontWeight  gl_view_get_default_font_weight      (glView            *view);
304
305 gboolean         gl_view_get_default_font_italic_flag (glView            *view);
306
307 guint            gl_view_get_default_text_color       (glView            *view);
308
309 GtkJustification gl_view_get_default_text_alignment   (glView            *view);
310
311 gdouble          gl_view_get_default_line_width       (glView            *view);
312
313 guint            gl_view_get_default_line_color       (glView            *view);
314
315 guint            gl_view_get_default_fill_color       (glView            *view);
316
317
318
319 G_END_DECLS
320
321 #endif