]> git.sur5r.net Git - glabels/blob - glabels2/src/view.h
Print dialog is now a full-fledged object, with a unique instance attached to a view...
[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
98         /* Default object line properties */
99         gdouble            default_line_width;
100         guint              default_line_color;
101         
102         /* Default object fill properties */
103         guint             default_fill_color;
104 };
105
106 struct _glViewClass {
107         GtkVBoxClass      parent_class;
108
109         /* Selection changed signal */
110         void (*selection_changed) (glView   *view,
111                                    gpointer  user_data);
112
113         /* Signals to support a status bar */
114         void (*zoom_changed)      (glView   *view,
115                                    gdouble   zoom,
116                                    gpointer  user_data);
117         void (*pointer_moved)     (glView   *view,
118                                    gdouble   x,
119                                    gdouble   y,
120                                    gpointer  user_data);
121         void (*pointer_exit)      (glView   *view,
122                                    gpointer  user_data);
123         void (*mode_changed)      (glView   *view,
124                                    gpointer  user_data);
125 };
126
127 G_BEGIN_DECLS
128
129 guint      gl_view_get_type                (void);
130
131 GtkWidget *gl_view_new                     (glLabel           *label);
132
133
134 void       gl_view_show_grid               (glView            *view);
135
136 void       gl_view_hide_grid               (glView            *view);
137
138 void       gl_view_set_grid_spacing        (glView            *view,
139                                             gdouble            spacing);
140
141 void       gl_view_show_markup             (glView            *view);
142
143 void       gl_view_hide_markup             (glView            *view);
144
145 void       gl_view_arrow_mode              (glView            *view);
146
147 void       gl_view_object_create_mode      (glView            *view,
148                                             glLabelObjectType  type);
149
150
151 void       gl_view_select_object           (glView            *view,
152                                             glViewObject      *view_object);
153
154 void       gl_view_unselect_object         (glView            *view,
155                                             glViewObject      *view_object);
156
157 void       gl_view_select_all              (glView            *view);
158
159 void       gl_view_unselect_all            (glView            *view);
160
161 void       gl_view_select_region           (glView            *view,
162                                             gdouble            x1,
163                                             gdouble            y1,
164                                             gdouble            x2,
165                                             gdouble            y2);
166
167 gboolean   gl_view_is_object_selected      (glView            *view,
168                                             glViewObject      *view_object);
169
170 gboolean   gl_view_is_selection_empty      (glView            *view);
171
172 gboolean   gl_view_is_selection_atomic     (glView            *view);
173
174 void       gl_view_delete_selection        (glView            *view);
175
176 GtkWidget *gl_view_get_editor              (glView            *view);
177
178 void       gl_view_raise_selection         (glView            *view);
179
180 void       gl_view_lower_selection         (glView            *view);
181
182 void       gl_view_rotate_selection        (glView            *view,
183                                             gdouble            theta_degs);
184
185 void       gl_view_rotate_selection_left   (glView            *view);
186
187 void       gl_view_rotate_selection_right  (glView            *view);
188
189 void       gl_view_flip_selection_horiz    (glView            *view);
190
191 void       gl_view_flip_selection_vert     (glView            *view);
192
193 void       gl_view_align_selection_left    (glView            *view);
194
195 void       gl_view_align_selection_right   (glView            *view);
196
197 void       gl_view_align_selection_hcenter (glView            *view);
198
199 void       gl_view_align_selection_top     (glView            *view);
200
201 void       gl_view_align_selection_bottom  (glView            *view);
202
203 void       gl_view_align_selection_vcenter (glView            *view);
204
205 void       gl_view_center_selection_horiz  (glView            *view);
206
207 void       gl_view_center_selection_vert   (glView            *view);
208
209 void       gl_view_move_selection          (glView            *view,
210                                             gdouble            dx,
211                                             gdouble            dy);
212
213 gboolean   gl_view_can_selection_text             (glView           *view);
214
215 void       gl_view_set_selection_font_family      (glView           *view,
216                                                    const gchar      *font_family);
217
218 void       gl_view_set_selection_font_size        (glView           *view,
219                                                    gdouble           font_size);
220
221 void       gl_view_set_selection_font_weight      (glView           *view,
222                                                    GnomeFontWeight   font_weight);
223
224 void       gl_view_set_selection_font_italic_flag (glView           *view,
225                                                    gboolean          font_italic_flag);
226
227 void       gl_view_set_selection_text_alignment   (glView           *view,
228                                                    GtkJustification  text_alignment);
229
230 void       gl_view_set_selection_text_color       (glView           *view,
231                                                    guint             text_color);
232
233 gboolean   gl_view_can_selection_fill             (glView           *view);
234
235 void       gl_view_set_selection_fill_color       (glView           *view,
236                                                    guint             fill_color);
237
238 gboolean   gl_view_can_selection_line_color       (glView           *view);
239
240 void       gl_view_set_selection_line_color       (glView           *view,
241                                                    guint             line_color);
242
243 gboolean   gl_view_can_selection_line_width       (glView           *view);
244
245 void       gl_view_set_selection_line_width       (glView           *view,
246                                                    gdouble           line_width);
247
248
249 void       gl_view_cut                     (glView            *view);
250
251 void       gl_view_copy                    (glView            *view);
252
253 void       gl_view_paste                   (glView            *view);
254
255
256 void       gl_view_zoom_in                 (glView            *view);
257
258 void       gl_view_zoom_out                (glView            *view);
259
260 void       gl_view_zoom_to_fit             (glView            *view);
261
262 void       gl_view_set_zoom                (glView            *view,
263                                             gdouble            zoom);
264
265 gdouble    gl_view_get_zoom                (glView            *view);
266
267 gboolean   gl_view_is_zoom_max             (glView            *view);
268
269 gboolean   gl_view_is_zoom_min             (glView            *view);
270
271
272 void       gl_view_popup_menu              (glView            *view,
273                                             GdkEvent          *event);
274
275 void       gl_view_edit_merge_props        (glView            *view);
276
277
278 void       gl_view_set_default_font_family      (glView            *view,
279                                                  const gchar       *font_family);
280
281 void       gl_view_set_default_font_size        (glView            *view,
282                                                  gdouble            font_size);
283
284 void       gl_view_set_default_font_weight      (glView            *view,
285                                                  GnomeFontWeight    font_weight);
286
287 void       gl_view_set_default_font_italic_flag (glView            *view,
288                                                  gboolean           font_italic_flag);
289
290 void       gl_view_set_default_text_color       (glView            *view,
291                                                  guint              text_color);
292
293 void       gl_view_set_default_text_alignment   (glView            *view,
294                                                  GtkJustification   text_alignment);
295
296 void       gl_view_set_default_line_width       (glView            *view,
297                                                  gdouble            line_width);
298
299 void       gl_view_set_default_line_color       (glView            *view,
300                                                  guint              line_color);
301
302 void       gl_view_set_default_fill_color       (glView            *view,
303                                                  guint              fill_color);
304
305
306 gchar           *gl_view_get_default_font_family      (glView            *view);
307
308 gdouble          gl_view_get_default_font_size        (glView            *view);
309
310 GnomeFontWeight  gl_view_get_default_font_weight      (glView            *view);
311
312 gboolean         gl_view_get_default_font_italic_flag (glView            *view);
313
314 guint            gl_view_get_default_text_color       (glView            *view);
315
316 GtkJustification gl_view_get_default_text_alignment   (glView            *view);
317
318 gdouble          gl_view_get_default_line_width       (glView            *view);
319
320 guint            gl_view_get_default_line_color       (glView            *view);
321
322 guint            gl_view_get_default_fill_color       (glView            *view);
323
324
325
326 G_END_DECLS
327
328 #endif