]> git.sur5r.net Git - glabels/blob - glabels2/src/tools.c
1b2716ffb9ed606e43d9e6f425b2dee306cf3f4d
[glabels] / glabels2 / src / tools.c
1 /*
2  *  (GLABELS) Label and Business Card Creation program for GNOME
3  *
4  *  tools.c:  implementation of drawing toolbar verbs
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 #include <config.h>
24
25 #include "tools.h"
26 #include "window.h"
27 #include "merge-properties.h"
28
29 /*===========================================*/
30 /* Private types.                            */
31 /*===========================================*/
32
33 /*===========================================*/
34 /* Private globals.                          */
35 /*===========================================*/
36
37 /*===========================================*/
38 /* Private function prototypes.              */
39 /*===========================================*/
40
41
42 \f
43 /*****************************************************************************/
44 /* arrow callback.                                                           */
45 /*****************************************************************************/
46 void
47 gl_tools_arrow (BonoboUIComponent *uic,
48                 gpointer           user_data,
49                 const gchar       *verbname)
50 {
51         glWindow *window;
52
53         window = GL_WINDOW (user_data);
54
55         if (window->view != NULL) {
56                 gl_view_arrow_mode (GL_VIEW(window->view));
57         }
58 }
59
60 /*****************************************************************************/
61 /* text callback.                                                            */
62 /*****************************************************************************/
63 void
64 gl_tools_text (BonoboUIComponent *uic,
65                gpointer           user_data,
66                const gchar       *verbname)
67
68 {
69         glWindow *window;
70
71         window = GL_WINDOW (user_data);
72
73         if (window->view != NULL) {
74                 gl_view_object_create_mode (GL_VIEW(window->view),
75                                             GL_LABEL_OBJECT_TEXT);
76         }
77 }
78
79 /*****************************************************************************/
80 /* box callback.                                                             */
81 /*****************************************************************************/
82 void
83 gl_tools_box (BonoboUIComponent *uic,
84               gpointer           user_data,
85               const gchar       *verbname)
86
87 {
88         glWindow *window;
89
90         window = GL_WINDOW (user_data);
91
92         if (window->view != NULL) {
93                 gl_view_object_create_mode (GL_VIEW(window->view),
94                                             GL_LABEL_OBJECT_BOX);
95         }
96 }
97
98 /*****************************************************************************/
99 /* line callback.                                                            */
100 /*****************************************************************************/
101 void
102 gl_tools_line (BonoboUIComponent *uic,
103                gpointer           user_data,
104                const gchar       *verbname)
105
106 {
107         glWindow *window;
108
109         window = GL_WINDOW (user_data);
110
111         if (window->view != NULL) {
112                 gl_view_object_create_mode (GL_VIEW(window->view),
113                                             GL_LABEL_OBJECT_LINE);
114         }
115 }
116
117 /*****************************************************************************/
118 /* ellipse callback.                                                         */
119 /*****************************************************************************/
120 void
121 gl_tools_ellipse (BonoboUIComponent *uic,
122                   gpointer           user_data,
123                   const gchar       *verbname)
124
125 {
126         glWindow *window;
127
128         window = GL_WINDOW (user_data);
129
130         if (window->view != NULL) {
131                 gl_view_object_create_mode (GL_VIEW(window->view),
132                                             GL_LABEL_OBJECT_ELLIPSE);
133         }
134 }
135
136 /*****************************************************************************/
137 /* image callback.                                                           */
138 /*****************************************************************************/
139 void
140 gl_tools_image (BonoboUIComponent *uic,
141                 gpointer           user_data,
142                 const gchar       *verbname)
143
144 {
145         glWindow *window;
146
147         window = GL_WINDOW (user_data);
148
149         if (window->view != NULL) {
150                 gl_view_object_create_mode (GL_VIEW(window->view),
151                                             GL_LABEL_OBJECT_IMAGE);
152         }
153 }
154
155 /*****************************************************************************/
156 /* barcode callback.                                                         */
157 /*****************************************************************************/
158 void
159 gl_tools_barcode (BonoboUIComponent *uic,
160                   gpointer           user_data,
161                   const gchar       *verbname)
162
163 {
164         glWindow *window;
165
166         window = GL_WINDOW (user_data);
167
168         if (window->view != NULL) {
169                 gl_view_object_create_mode (GL_VIEW(window->view),
170                                             GL_LABEL_OBJECT_BARCODE);
171         }
172 }
173
174 /*****************************************************************************/
175 /* zoom in callback.                                                         */
176 /*****************************************************************************/
177 void
178 gl_tools_zoomin (BonoboUIComponent *uic,
179                  gpointer           user_data,
180                  const gchar       *verbname)
181
182 {
183         glWindow *window;
184
185         window = GL_WINDOW (user_data);
186
187         if (window->view != NULL) {
188                 gl_view_zoom_in (GL_VIEW(window->view));
189         }
190 }
191
192 /*****************************************************************************/
193 /* zoom out callback.                                                        */
194 /*****************************************************************************/
195 void
196 gl_tools_zoomout (BonoboUIComponent *uic,
197                   gpointer           user_data,
198                   const gchar       *verbname)
199
200 {
201         glWindow *window;
202
203         window = GL_WINDOW (user_data);
204
205         if (window->view != NULL) {
206                 gl_view_zoom_out (GL_VIEW(window->view));
207         }
208 }
209
210 /*****************************************************************************/
211 /* zoom 1:1 callback.                                                        */
212 /*****************************************************************************/
213 void
214 gl_tools_zoom1to1 (BonoboUIComponent *uic,
215                    gpointer           user_data,
216                    const gchar       *verbname)
217
218 {
219         glWindow *window;
220
221         window = GL_WINDOW (user_data);
222
223         if (window->view != NULL) {
224                 gl_view_set_zoom (GL_VIEW(window->view), 1.0);
225         }
226 }
227
228 /*****************************************************************************/
229 /* edit merge properties callback.                                           */
230 /*****************************************************************************/
231 void
232 gl_tools_merge_properties (BonoboUIComponent *uic,
233                            gpointer           user_data,
234                            const gchar       *verbname)
235
236 {
237         glWindow *window;
238
239         window = GL_WINDOW (user_data);
240
241         if (window->view != NULL) {
242                 gl_merge_properties_dialog (GL_VIEW(window->view));
243         }
244 }
245
246 /*****************************************************************************/
247 /* edit object properties callback.                                          */
248 /*****************************************************************************/
249 void
250 gl_tools_object_properties (BonoboUIComponent *uic,
251                             gpointer           user_data,
252                             const gchar       *verbname)
253
254 {
255         glWindow *window;
256
257         window = GL_WINDOW (user_data);
258
259         if (window->view != NULL) {
260                 gl_view_edit_object_props (GL_VIEW(window->view));
261         }
262 }
263
264 /*****************************************************************************/
265 /* Raise objects to top callback.                                            */
266 /*****************************************************************************/
267 void
268 gl_tools_raise_objects (BonoboUIComponent *uic,
269                         gpointer           user_data,
270                         const gchar       *verbname)
271
272 {
273         glWindow *window;
274
275         window = GL_WINDOW (user_data);
276
277         if (window->view != NULL) {
278                 gl_view_raise_selection (GL_VIEW(window->view));
279         }
280 }
281
282 /*****************************************************************************/
283 /* Lower objects to bottom callback.                                         */
284 /*****************************************************************************/
285 void
286 gl_tools_lower_objects (BonoboUIComponent *uic,
287                         gpointer           user_data,
288                         const gchar       *verbname)
289
290 {
291         glWindow *window;
292
293         window = GL_WINDOW (user_data);
294
295         if (window->view != NULL) {
296                 gl_view_lower_selection (GL_VIEW(window->view));
297         }
298 }
299
300 /*****************************************************************************/
301 /* Rotate objects left 90 degrees.                                           */
302 /*****************************************************************************/
303 void
304 gl_tools_rotate_objects_left (BonoboUIComponent *uic,
305                               gpointer           user_data,
306                               const gchar       *verbname)
307
308 {
309         glWindow *window;
310
311         window = GL_WINDOW (user_data);
312
313         if (window->view != NULL) {
314                 gl_view_rotate_selection_left (GL_VIEW(window->view));
315         }
316 }
317
318 /*****************************************************************************/
319 /* Rotate objects right 90 degrees.                                          */
320 /*****************************************************************************/
321 void
322 gl_tools_rotate_objects_right (BonoboUIComponent *uic,
323                                gpointer           user_data,
324                                const gchar       *verbname)
325
326 {
327         glWindow *window;
328
329         window = GL_WINDOW (user_data);
330
331         if (window->view != NULL) {
332                 gl_view_rotate_selection_right (GL_VIEW(window->view));
333         }
334 }
335
336 /*****************************************************************************/
337 /* Flip objects horizontally callback.                                       */
338 /*****************************************************************************/
339 void
340 gl_tools_flip_objects_horiz (BonoboUIComponent *uic,
341                              gpointer           user_data,
342                              const gchar       *verbname)
343
344 {
345         glWindow *window;
346
347         window = GL_WINDOW (user_data);
348
349         if (window->view != NULL) {
350                 gl_view_flip_selection_horiz (GL_VIEW(window->view));
351         }
352 }
353
354 /*****************************************************************************/
355 /* Flip objects vertically callback.                                         */
356 /*****************************************************************************/
357 void
358 gl_tools_flip_objects_vert (BonoboUIComponent *uic,
359                             gpointer           user_data,
360                             const gchar       *verbname)
361
362 {
363         glWindow *window;
364
365         window = GL_WINDOW (user_data);
366
367         if (window->view != NULL) {
368                 gl_view_flip_selection_vert (GL_VIEW(window->view));
369         }
370 }
371
372 /*****************************************************************************/
373 /* Align objects left callback.                                              */
374 /*****************************************************************************/
375 void
376 gl_tools_align_objects_left (BonoboUIComponent *uic,
377                              gpointer           user_data,
378                              const gchar       *verbname)
379
380 {
381         glWindow *window;
382
383         window = GL_WINDOW (user_data);
384
385         if (window->view != NULL) {
386                 gl_view_align_selection_left (GL_VIEW(window->view));
387         }
388 }
389
390 /*****************************************************************************/
391 /* Align objects right callback.                                             */
392 /*****************************************************************************/
393 void
394 gl_tools_align_objects_right (BonoboUIComponent *uic,
395                               gpointer           user_data,
396                               const gchar       *verbname)
397
398 {
399         glWindow *window;
400
401         window = GL_WINDOW (user_data);
402
403         if (window->view != NULL) {
404                 gl_view_align_selection_right (GL_VIEW(window->view));
405         }
406 }
407
408 /*****************************************************************************/
409 /* Align objects horizontal center callback.                                 */
410 /*****************************************************************************/
411 void
412 gl_tools_align_objects_hcenter (BonoboUIComponent *uic,
413                                 gpointer           user_data,
414                                 const gchar       *verbname)
415
416 {
417         glWindow *window;
418
419         window = GL_WINDOW (user_data);
420
421         if (window->view != NULL) {
422                 gl_view_align_selection_hcenter (GL_VIEW(window->view));
423         }
424 }
425
426 /*****************************************************************************/
427 /* Align objects top callback.                                               */
428 /*****************************************************************************/
429 void
430 gl_tools_align_objects_top (BonoboUIComponent *uic,
431                             gpointer           user_data,
432                             const gchar       *verbname)
433
434 {
435         glWindow *window;
436
437         window = GL_WINDOW (user_data);
438
439         if (window->view != NULL) {
440                 gl_view_align_selection_top (GL_VIEW(window->view));
441         }
442 }
443
444 /*****************************************************************************/
445 /* Align objects bottom callback.                                            */
446 /*****************************************************************************/
447 void
448 gl_tools_align_objects_bottom (BonoboUIComponent *uic,
449                                gpointer           user_data,
450                                const gchar       *verbname)
451
452 {
453         glWindow *window;
454
455         window = GL_WINDOW (user_data);
456
457         if (window->view != NULL) {
458                 gl_view_align_selection_bottom (GL_VIEW(window->view));
459         }
460 }
461
462 /*****************************************************************************/
463 /* Align objects vertical center callback.                                   */
464 /*****************************************************************************/
465 void
466 gl_tools_align_objects_vcenter (BonoboUIComponent *uic,
467                                 gpointer           user_data,
468                                 const gchar       *verbname)
469
470 {
471         glWindow *window;
472
473         window = GL_WINDOW (user_data);
474
475         if (window->view != NULL) {
476                 gl_view_align_selection_vcenter (GL_VIEW(window->view));
477         }
478 }
479
480 /*****************************************************************************/
481 /* Center objects horizontally callback.                                     */
482 /*****************************************************************************/
483 void
484 gl_tools_center_objects_horiz (BonoboUIComponent *uic,
485                                gpointer           user_data,
486                                const gchar       *verbname)
487
488 {
489         glWindow *window;
490
491         window = GL_WINDOW (user_data);
492
493         if (window->view != NULL) {
494                 gl_view_center_selection_horiz (GL_VIEW(window->view));
495         }
496 }
497
498 /*****************************************************************************/
499 /* Center objects vertically callback.                                       */
500 /*****************************************************************************/
501 void
502 gl_tools_center_objects_vert (BonoboUIComponent *uic,
503                               gpointer           user_data,
504                               const gchar       *verbname)
505
506 {
507         glWindow *window;
508
509         window = GL_WINDOW (user_data);
510
511         if (window->view != NULL) {
512                 gl_view_center_selection_vert (GL_VIEW(window->view));
513         }
514 }
515