]> git.sur5r.net Git - glabels/blob - glabels2/src/view.h
Merge property dialog now a widget.
[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
29 #include "label-object.h"
30
31 typedef enum {
32         GL_VIEW_STATE_ARROW,
33         GL_VIEW_STATE_OBJECT_CREATE
34 } glViewState;
35
36 #define GL_TYPE_VIEW            (gl_view_get_type ())
37 #define GL_VIEW(obj)            (GTK_CHECK_CAST((obj), GL_TYPE_VIEW, glView ))
38 #define GL_VIEW_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW, glViewClass))
39 #define GL_IS_VIEW(obj)         (GTK_CHECK_TYPE ((obj), GL_TYPE_VIEW))
40 #define GL_IS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW))
41
42 typedef struct _glView      glView;
43 typedef struct _glViewClass glViewClass;
44
45 #include "view-object.h"
46
47 struct _glView {
48         GtkVBox           parent_widget;
49
50         glLabel          *label;
51
52         GtkWidget        *canvas;
53         gdouble           scale;
54
55         GnomeCanvasGroup *bg_group;              /* Background layer */
56         GnomeCanvasGroup *grid_group;            /* Grid layer */
57         GnomeCanvasGroup *markup_group;          /* Markup layer */
58         GnomeCanvasGroup *label_group;           /* Label layer (user objects) */
59         GnomeCanvasGroup *fg_group;              /* Foreground layer */
60         GnomeCanvasGroup *highlight_group;       /* Highlight layer */
61
62         gdouble           grid_spacing;
63
64         glViewState       state;
65         glLabelObjectType create_type;
66
67         GList             *object_list;           /* glViewObjects */
68         GList             *selected_object_list;  /* glViewObjects */
69
70         /* Clipboard selection stuff */
71         gint              have_selection;
72         glLabel           *selection_data;
73         GtkWidget         *invisible;
74
75         /* Menus */
76         GList             *atomic_selection_items;
77         GList             *multi_selection_items;
78         GtkWidget         *selection_menu;
79         GtkWidget         *empty_selection_menu;
80
81         /* Merge Properties Dialog */
82         GtkWidget         *merge_props_dialog;
83 };
84
85 struct _glViewClass {
86         GtkVBoxClass      parent_class;
87
88         /* Selection changed signal */
89         void (*selection_changed) (glView   *view,
90                                    gpointer  user_data);
91
92         /* Signals to support a status bar */
93         void (*zoom_changed)      (glView   *view,
94                                    gdouble   zoom,
95                                    gpointer  user_data);
96         void (*pointer_moved)     (glView   *view,
97                                    gdouble   x,
98                                    gdouble   y,
99                                    gpointer  user_data);
100         void (*pointer_exit)      (glView   *view,
101                                    gpointer  user_data);
102         void (*mode_changed)      (glView   *view,
103                                    gpointer  user_data);
104 };
105
106 G_BEGIN_DECLS
107
108 guint      gl_view_get_type                (void);
109
110 GtkWidget *gl_view_new                     (glLabel           *label);
111
112
113 void       gl_view_show_grid               (glView            *view);
114
115 void       gl_view_hide_grid               (glView            *view);
116
117 void       gl_view_set_grid_spacing        (glView            *view,
118                                             gdouble            spacing);
119
120 void       gl_view_show_markup             (glView            *view);
121
122 void       gl_view_hide_markup             (glView            *view);
123
124 void       gl_view_arrow_mode              (glView            *view);
125
126 void       gl_view_object_create_mode      (glView            *view,
127                                             glLabelObjectType  type);
128
129
130 void       gl_view_select_object           (glView            *view,
131                                             glViewObject      *view_object);
132
133 void       gl_view_unselect_object         (glView            *view,
134                                             glViewObject      *view_object);
135
136 void       gl_view_select_all              (glView            *view);
137
138 void       gl_view_unselect_all            (glView            *view);
139
140 void       gl_view_select_region           (glView            *view,
141                                             gdouble            x1,
142                                             gdouble            y1,
143                                             gdouble            x2,
144                                             gdouble            y2);
145
146 gboolean   gl_view_is_selection_empty      (glView            *view);
147
148 gboolean   gl_view_is_selection_atomic     (glView            *view);
149
150 void       gl_view_delete_selection        (glView            *view);
151
152 void       gl_view_edit_object_props       (glView            *view);
153
154 void       gl_view_raise_selection         (glView            *view);
155
156 void       gl_view_lower_selection         (glView            *view);
157
158 void       gl_view_rotate_selection        (glView            *view,
159                                             gdouble            theta_degs);
160
161 void       gl_view_rotate_selection_left   (glView            *view);
162
163 void       gl_view_rotate_selection_right  (glView            *view);
164
165 void       gl_view_flip_selection_horiz    (glView            *view);
166
167 void       gl_view_flip_selection_vert     (glView            *view);
168
169 void       gl_view_align_selection_left    (glView            *view);
170
171 void       gl_view_align_selection_right   (glView            *view);
172
173 void       gl_view_align_selection_hcenter (glView            *view);
174
175 void       gl_view_align_selection_top     (glView            *view);
176
177 void       gl_view_align_selection_bottom  (glView            *view);
178
179 void       gl_view_align_selection_vcenter (glView            *view);
180
181 void       gl_view_center_selection_horiz  (glView            *view);
182
183 void       gl_view_center_selection_vert   (glView            *view);
184
185 void       gl_view_cut                     (glView            *view);
186
187 void       gl_view_copy                    (glView            *view);
188
189 void       gl_view_paste                   (glView            *view);
190
191
192 void       gl_view_zoom_in                 (glView            *view);
193
194 void       gl_view_zoom_out                (glView            *view);
195
196 void       gl_view_set_zoom                (glView            *view,
197                                             gdouble            scale);
198
199 gdouble    gl_view_get_zoom                (glView            *view);
200
201 gboolean   gl_view_is_zoom_max             (glView            *view);
202
203 gboolean   gl_view_is_zoom_min             (glView            *view);
204
205
206 void       gl_view_edit_merge_props        (glView            *view);
207
208
209 int        gl_view_item_event_handler      (GnomeCanvasItem   *item,
210                                             GdkEvent          *event,
211                                             glViewObject      *view_object);
212
213 G_END_DECLS
214
215 #endif