]> git.sur5r.net Git - glabels/blob - glabels2/src/view.h
2003-12-30 Wayne Schuller <k_wayne@linuxpower.org>
[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           zoom;
55         gboolean          zoom_to_fit_flag;
56         gdouble           home_scale;
57
58         GnomeCanvasGroup *bg_group;              /* Background layer */
59         GnomeCanvasGroup *grid_group;            /* Grid layer */
60         GnomeCanvasGroup *markup_group;          /* Markup layer */
61         GnomeCanvasGroup *label_group;           /* Label layer (user objects) */
62         GnomeCanvasGroup *fg_group;              /* Foreground layer */
63         GnomeCanvasGroup *highlight_group;       /* Highlight layer */
64
65         gdouble           grid_spacing;
66
67         glViewState       state;
68         glLabelObjectType create_type;
69
70         GList             *object_list;           /* glViewObjects */
71         GList             *selected_object_list;  /* glViewObjects */
72
73         /* Clipboard selection stuff */
74         gint              have_selection;
75         glLabel           *selection_data;
76         GtkWidget         *invisible;
77
78         /* Menus */
79         GList             *atomic_selection_items;
80         GList             *multi_selection_items;
81         GtkWidget         *selection_menu;
82         GtkWidget         *empty_selection_menu;
83
84         /* Merge Properties Dialog */
85         GtkWidget         *merge_props_dialog;
86
87         /* Print Dialog */
88         GtkWidget         *print_dialog;
89
90         /* Default object text properties */
91         gchar             *default_font_family;
92         gdouble            default_font_size;
93         GnomeFontWeight    default_font_weight;
94         gboolean           default_font_italic_flag;
95         guint              default_text_color;
96         GtkJustification   default_text_alignment;
97         gdouble            default_text_line_spacing;
98
99         /* Default object line properties */
100         gdouble            default_line_width;
101         guint              default_line_color;
102         
103         /* Default object fill properties */
104         guint             default_fill_color;
105 };
106
107 struct _glViewClass {
108         GtkVBoxClass      parent_class;
109
110         /* Selection changed signal */
111         void (*selection_changed) (glView   *view,
112                                    gpointer  user_data);
113
114         /* Signals to support a status bar */
115         void (*zoom_changed)      (glView   *view,
116                                    gdouble   zoom,
117                                    gpointer  user_data);
118         void (*pointer_moved)     (glView   *view,
119                                    gdouble   x,
120                                    gdouble   y,
121                                    gpointer  user_data);
122         void (*pointer_exit)      (glView   *view,
123                                    gpointer  user_data);
124         void (*mode_changed)      (glView   *view,
125                                    gpointer  user_data);
126 };
127
128 G_BEGIN_DECLS
129
130 guint      gl_view_get_type                (void);
131
132 GtkWidget *gl_view_new                     (glLabel           *label);
133
134
135 void       gl_view_show_grid               (glView            *view);
136
137 void       gl_view_hide_grid               (glView            *view);
138
139 void       gl_view_set_grid_spacing        (glView            *view,
140                                             gdouble            spacing);
141
142 void       gl_view_show_markup             (glView            *view);
143
144 void       gl_view_hide_markup             (glView            *view);
145
146 void       gl_view_arrow_mode              (glView            *view);
147
148 void       gl_view_object_create_mode      (glView            *view,
149                                             glLabelObjectType  type);
150
151
152 void       gl_view_select_object           (glView            *view,
153                                             glViewObject      *view_object);
154
155 void       gl_view_unselect_object         (glView            *view,
156                                             glViewObject      *view_object);
157
158 void       gl_view_select_all              (glView            *view);
159
160 void       gl_view_unselect_all            (glView            *view);
161
162 void       gl_view_select_region           (glView            *view,
163                                             gdouble            x1,
164                                             gdouble            y1,
165                                             gdouble            x2,
166                                             gdouble            y2);
167
168 gboolean   gl_view_is_object_selected      (glView            *view,
169                                             glViewObject      *view_object);
170
171 gboolean   gl_view_is_selection_empty      (glView            *view);
172
173 gboolean   gl_view_is_selection_atomic     (glView            *view);
174
175 void       gl_view_delete_selection        (glView            *view);
176
177 GtkWidget *gl_view_get_editor              (glView            *view);
178
179 void       gl_view_raise_selection         (glView            *view);
180
181 void       gl_view_lower_selection         (glView            *view);
182
183 void       gl_view_rotate_selection        (glView            *view,
184                                             gdouble            theta_degs);
185
186 void       gl_view_rotate_selection_left   (glView            *view);
187
188 void       gl_view_rotate_selection_right  (glView            *view);
189
190 void       gl_view_flip_selection_horiz    (glView            *view);
191
192 void       gl_view_flip_selection_vert     (glView            *view);
193
194 void       gl_view_align_selection_left    (glView            *view);
195
196 void       gl_view_align_selection_right   (glView            *view);
197
198 void       gl_view_align_selection_hcenter (glView            *view);
199
200 void       gl_view_align_selection_top     (glView            *view);
201
202 void       gl_view_align_selection_bottom  (glView            *view);
203
204 void       gl_view_align_selection_vcenter (glView            *view);
205
206 void       gl_view_center_selection_horiz  (glView            *view);
207
208 void       gl_view_center_selection_vert   (glView            *view);
209
210 void       gl_view_move_selection          (glView            *view,
211                                             gdouble            dx,
212                                             gdouble            dy);
213
214 gboolean   gl_view_can_selection_text             (glView           *view);
215
216 void       gl_view_set_selection_font_family      (glView           *view,
217                                                    const gchar      *font_family);
218
219 void       gl_view_set_selection_font_size        (glView           *view,
220                                                    gdouble           font_size);
221
222 void       gl_view_set_selection_font_weight      (glView           *view,
223                                                    GnomeFontWeight   font_weight);
224
225 void       gl_view_set_selection_text_line_spacing (glView           *view,
226                                                    gdouble           text_line_spacing);
227
228 void       gl_view_set_selection_font_italic_flag (glView           *view,
229                                                    gboolean          font_italic_flag);
230
231 void       gl_view_set_selection_text_alignment   (glView           *view,
232                                                    GtkJustification  text_alignment);
233
234 void       gl_view_set_selection_text_color       (glView           *view,
235                                                    guint             text_color);
236
237 gboolean   gl_view_can_selection_fill             (glView           *view);
238
239 void       gl_view_set_selection_fill_color       (glView           *view,
240                                                    guint             fill_color);
241
242 gboolean   gl_view_can_selection_line_color       (glView           *view);
243
244 void       gl_view_set_selection_line_color       (glView           *view,
245                                                    guint             line_color);
246
247 gboolean   gl_view_can_selection_line_width       (glView           *view);
248
249 void       gl_view_set_selection_line_width       (glView           *view,
250                                                    gdouble           line_width);
251
252
253 void       gl_view_cut                     (glView            *view);
254
255 void       gl_view_copy                    (glView            *view);
256
257 void       gl_view_paste                   (glView            *view);
258
259
260 void       gl_view_zoom_in                 (glView            *view);
261
262 void       gl_view_zoom_out                (glView            *view);
263
264 void       gl_view_zoom_to_fit             (glView            *view);
265
266 void       gl_view_set_zoom                (glView            *view,
267                                             gdouble            zoom);
268
269 gdouble    gl_view_get_zoom                (glView            *view);
270
271 gboolean   gl_view_is_zoom_max             (glView            *view);
272
273 gboolean   gl_view_is_zoom_min             (glView            *view);
274
275
276 void       gl_view_popup_menu              (glView            *view,
277                                             GdkEvent          *event);
278
279 void       gl_view_edit_merge_props        (glView            *view);
280
281
282 void       gl_view_set_default_font_family      (glView            *view,
283                                                  const gchar       *font_family);
284
285 void       gl_view_set_default_font_size        (glView            *view,
286                                                  gdouble            font_size);
287
288 void       gl_view_set_default_font_weight      (glView            *view,
289                                                  GnomeFontWeight    font_weight);
290
291 void       gl_view_set_default_font_italic_flag (glView            *view,
292                                                  gboolean           font_italic_flag);
293
294 void       gl_view_set_default_text_color       (glView            *view,
295                                                  guint              text_color);
296
297 void       gl_view_set_default_text_alignment   (glView            *view,
298                                                  GtkJustification   text_alignment);
299
300 void       gl_view_set_default_line_width       (glView            *view,
301                                                  gdouble            line_width);
302
303 void       gl_view_set_default_line_color       (glView            *view,
304                                                  guint              line_color);
305
306 void       gl_view_set_default_fill_color       (glView            *view,
307                                                  guint              fill_color);
308 void       gl_view_set_default_text_line_spacing (glView            *view,
309                                                  gdouble            text_line_spacing);
310
311
312
313 gchar           *gl_view_get_default_font_family      (glView            *view);
314
315 gdouble          gl_view_get_default_font_size        (glView            *view);
316
317 GnomeFontWeight  gl_view_get_default_font_weight      (glView            *view);
318
319 gboolean         gl_view_get_default_font_italic_flag (glView            *view);
320
321 guint            gl_view_get_default_text_color       (glView            *view);
322
323 GtkJustification gl_view_get_default_text_alignment   (glView            *view);
324
325 gdouble          gl_view_get_default_text_line_spacing (glView            *view);
326
327 gdouble          gl_view_get_default_line_width       (glView            *view);
328
329 guint            gl_view_get_default_line_color       (glView            *view);
330
331 guint            gl_view_get_default_fill_color       (glView            *view);
332
333
334
335 G_END_DECLS
336
337 #endif