]> git.sur5r.net Git - glabels/blob - glabels2/src/view.h
2005-05-14 Jim Evins <evins@snaught.com>
[glabels] / glabels2 / src / view.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 /*
4  *  (GLABELS) Label and Business Card Creation program for GNOME
5  *
6  *  view.h:  GLabels View module header file
7  *
8  *  Copyright (C) 2001-2005  Jim Evins <evins@snaught.com>.
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23  */
24
25 #ifndef __VIEW_H__
26 #define __VIEW_H__
27
28 #include <gtk/gtkvbox.h>
29 #include <gtk/gtkenums.h>
30 #include <libgnomecanvas/libgnomecanvas.h>
31 #include <libgnomeprint/gnome-font.h>
32
33 #include "label-object.h"
34
35 typedef enum {
36         GL_VIEW_STATE_ARROW,
37         GL_VIEW_STATE_OBJECT_CREATE
38 } glViewState;
39
40 #define GL_TYPE_VIEW            (gl_view_get_type ())
41 #define GL_VIEW(obj)            (GTK_CHECK_CAST((obj), GL_TYPE_VIEW, glView ))
42 #define GL_VIEW_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW, glViewClass))
43 #define GL_IS_VIEW(obj)         (GTK_CHECK_TYPE ((obj), GL_TYPE_VIEW))
44 #define GL_IS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW))
45
46 typedef struct _glView      glView;
47 typedef struct _glViewClass glViewClass;
48
49 #include "view-object.h"
50 #include "color.h"
51
52 struct _glView {
53         GtkVBox           parent_widget;
54
55         glLabel          *label;
56
57         GtkWidget        *canvas;
58         gdouble           zoom;
59         gboolean          zoom_to_fit_flag;
60         gdouble           home_scale;
61
62         GnomeCanvasGroup *bg_group;              /* Background layer */
63         GnomeCanvasGroup *grid_group;            /* Grid layer */
64         GnomeCanvasGroup *markup_group;          /* Markup layer */
65         GnomeCanvasGroup *label_group;           /* Label layer (user objects) */
66         GnomeCanvasGroup *fg_group;              /* Foreground layer */
67         GnomeCanvasGroup *highlight_group;       /* Highlight layer */
68
69         gdouble           grid_spacing;
70
71         glViewState       state;
72         glLabelObjectType create_type;
73
74         GList             *object_list;           /* glViewObjects */
75         GList             *selected_object_list;  /* glViewObjects */
76
77         /* Clipboard selection stuff */
78         gint              have_selection;
79         glLabel           *selection_data;
80         GtkWidget         *invisible;
81
82         /* Default object text properties */
83         gchar             *default_font_family;
84         gdouble            default_font_size;
85         GnomeFontWeight    default_font_weight;
86         gboolean           default_font_italic_flag;
87         guint              default_text_color;
88         GtkJustification   default_text_alignment;
89         gdouble            default_text_line_spacing;
90
91         /* Default object line properties */
92         gdouble            default_line_width;
93         guint              default_line_color;
94         
95         /* Default object fill properties */
96         guint             default_fill_color;
97 };
98
99 struct _glViewClass {
100         GtkVBoxClass      parent_class;
101
102         /* Selection changed signal */
103         void (*selection_changed) (glView   *view,
104                                    gpointer  user_data);
105
106         /* Signal to launch a context menu */
107         void (*context_menu_activate) (glView   *view,
108                                        gint      button,
109                                        guint32   activate_time,
110                                        gpointer  user_data);
111
112         /* Signals to support a status bar */
113         void (*zoom_changed)      (glView   *view,
114                                    gdouble   zoom,
115                                    gpointer  user_data);
116         void (*pointer_moved)     (glView   *view,
117                                    gdouble   x,
118                                    gdouble   y,
119                                    gpointer  user_data);
120         void (*pointer_exit)      (glView   *view,
121                                    gpointer  user_data);
122         void (*mode_changed)      (glView   *view,
123                                    gpointer  user_data);
124 };
125
126 G_BEGIN_DECLS
127
128 GType      gl_view_get_type                (void) G_GNUC_CONST;
129
130 GtkWidget *gl_view_new                     (glLabel           *label);
131
132
133 void       gl_view_show_grid               (glView            *view);
134
135 void       gl_view_hide_grid               (glView            *view);
136
137 void       gl_view_set_grid_spacing        (glView            *view,
138                                             gdouble            spacing);
139
140 void       gl_view_show_markup             (glView            *view);
141
142 void       gl_view_hide_markup             (glView            *view);
143
144 void       gl_view_arrow_mode              (glView            *view);
145
146 void       gl_view_object_create_mode      (glView            *view,
147                                             glLabelObjectType  type);
148
149
150 void       gl_view_select_object           (glView            *view,
151                                             glViewObject      *view_object);
152
153 void       gl_view_unselect_object         (glView            *view,
154                                             glViewObject      *view_object);
155
156 void       gl_view_select_all              (glView            *view);
157
158 void       gl_view_unselect_all            (glView            *view);
159
160 void       gl_view_select_region           (glView            *view,
161                                             gdouble            x1,
162                                             gdouble            y1,
163                                             gdouble            x2,
164                                             gdouble            y2);
165
166 gboolean   gl_view_is_object_selected      (glView            *view,
167                                             glViewObject      *view_object);
168
169 gboolean   gl_view_is_selection_empty      (glView            *view);
170
171 gboolean   gl_view_is_selection_atomic     (glView            *view);
172
173 void       gl_view_delete_selection        (glView            *view);
174
175 GtkWidget *gl_view_get_editor              (glView            *view);
176
177 void       gl_view_raise_selection         (glView            *view);
178
179 void       gl_view_lower_selection         (glView            *view);
180
181 void       gl_view_rotate_selection        (glView            *view,
182                                             gdouble            theta_degs);
183
184 void       gl_view_rotate_selection_left   (glView            *view);
185
186 void       gl_view_rotate_selection_right  (glView            *view);
187
188 void       gl_view_flip_selection_horiz    (glView            *view);
189
190 void       gl_view_flip_selection_vert     (glView            *view);
191
192 void       gl_view_align_selection_left    (glView            *view);
193
194 void       gl_view_align_selection_right   (glView            *view);
195
196 void       gl_view_align_selection_hcenter (glView            *view);
197
198 void       gl_view_align_selection_top     (glView            *view);
199
200 void       gl_view_align_selection_bottom  (glView            *view);
201
202 void       gl_view_align_selection_vcenter (glView            *view);
203
204 void       gl_view_center_selection_horiz  (glView            *view);
205
206 void       gl_view_center_selection_vert   (glView            *view);
207
208 void       gl_view_move_selection          (glView            *view,
209                                             gdouble            dx,
210                                             gdouble            dy);
211
212 gboolean   gl_view_can_selection_text             (glView           *view);
213
214 void       gl_view_set_selection_font_family      (glView           *view,
215                                                    const gchar      *font_family);
216
217 void       gl_view_set_selection_font_size        (glView           *view,
218                                                    gdouble           font_size);
219
220 void       gl_view_set_selection_font_weight      (glView           *view,
221                                                    GnomeFontWeight   font_weight);
222
223 void       gl_view_set_selection_text_line_spacing (glView           *view,
224                                                    gdouble           text_line_spacing);
225
226 void       gl_view_set_selection_font_italic_flag (glView           *view,
227                                                    gboolean          font_italic_flag);
228
229 void       gl_view_set_selection_text_alignment   (glView           *view,
230                                                    GtkJustification  text_alignment);
231
232 void       gl_view_set_selection_text_color       (glView           *view,
233                                                    glColorNode      *text_color_node);
234
235 gboolean   gl_view_can_selection_fill             (glView           *view);
236
237 void       gl_view_set_selection_fill_color       (glView           *view,
238                                                    glColorNode      *fill_color);
239
240 gboolean   gl_view_can_selection_line_color       (glView           *view);
241
242 void       gl_view_set_selection_line_color       (glView           *view,
243                                                    glColorNode      *line_color_node);
244
245 gboolean   gl_view_can_selection_line_width       (glView           *view);
246
247 void       gl_view_set_selection_line_width       (glView           *view,
248                                                    gdouble           line_width);
249
250
251 void       gl_view_cut                     (glView            *view);
252
253 void       gl_view_copy                    (glView            *view);
254
255 void       gl_view_paste                   (glView            *view);
256
257
258 void       gl_view_zoom_in                 (glView            *view);
259
260 void       gl_view_zoom_out                (glView            *view);
261
262 void       gl_view_zoom_to_fit             (glView            *view);
263
264 void       gl_view_set_zoom                (glView            *view,
265                                             gdouble            zoom);
266
267 gdouble    gl_view_get_zoom                (glView            *view);
268
269 gboolean   gl_view_is_zoom_max             (glView            *view);
270
271 gboolean   gl_view_is_zoom_min             (glView            *view);
272
273
274 void       gl_view_set_default_font_family      (glView            *view,
275                                                  const gchar       *font_family);
276
277 void       gl_view_set_default_font_size        (glView            *view,
278                                                  gdouble            font_size);
279
280 void       gl_view_set_default_font_weight      (glView            *view,
281                                                  GnomeFontWeight    font_weight);
282
283 void       gl_view_set_default_font_italic_flag (glView            *view,
284                                                  gboolean           font_italic_flag);
285
286 void       gl_view_set_default_text_color       (glView            *view,
287                                                  guint              text_color);
288
289 void       gl_view_set_default_text_alignment   (glView            *view,
290                                                  GtkJustification   text_alignment);
291
292 void       gl_view_set_default_line_width       (glView            *view,
293                                                  gdouble            line_width);
294
295 void       gl_view_set_default_line_color       (glView            *view,
296                                                  guint              line_color);
297
298 void       gl_view_set_default_fill_color       (glView            *view,
299                                                  guint              fill_color);
300 void       gl_view_set_default_text_line_spacing (glView            *view,
301                                                  gdouble            text_line_spacing);
302
303
304
305 gchar           *gl_view_get_default_font_family      (glView            *view);
306
307 gdouble          gl_view_get_default_font_size        (glView            *view);
308
309 GnomeFontWeight  gl_view_get_default_font_weight      (glView            *view);
310
311 gboolean         gl_view_get_default_font_italic_flag (glView            *view);
312
313 guint            gl_view_get_default_text_color       (glView            *view);
314
315 GtkJustification gl_view_get_default_text_alignment   (glView            *view);
316
317 gdouble          gl_view_get_default_text_line_spacing (glView            *view);
318
319 gdouble          gl_view_get_default_line_width       (glView            *view);
320
321 guint            gl_view_get_default_line_color       (glView            *view);
322
323 guint            gl_view_get_default_fill_color       (glView            *view);
324
325
326
327 G_END_DECLS
328
329 #endif