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