~ubuntu-branches/ubuntu/breezy/gimp/breezy

« back to all changes in this revision

Viewing changes to plug-ins/imagemap/imap_rectangle.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-10-04 19:04:46 UTC
  • Revision ID: james.westby@ubuntu.com-20051004190446-ukh32kwk56s4sjhu
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This is a plug-in for the GIMP.
 
3
 *
 
4
 * Generates clickable image maps.
 
5
 *
 
6
 * Copyright (C) 1998-2004 Maurits Rijk  m.rijk@chello.nl
 
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
 
 
24
#include "config.h"
 
25
 
 
26
#include <stdlib.h> /* abs */
 
27
 
 
28
#include <gtk/gtk.h>
 
29
 
 
30
#include <libgimp/gimp.h>
 
31
#include <libgimp/gimpui.h>
 
32
 
 
33
#include "imap_main.h"
 
34
#include "imap_misc.h"
 
35
#include "imap_object_popup.h"
 
36
#include "imap_rectangle.h"
 
37
#include "imap_stock.h"
 
38
#include "imap_table.h"
 
39
 
 
40
#include "libgimp/stdplugins-intl.h"
 
41
 
 
42
 
 
43
static gboolean rectangle_is_valid(Object_t *obj);
 
44
static Object_t *rectangle_clone(Object_t *obj);
 
45
static void rectangle_assign(Object_t *obj, Object_t *des);
 
46
static void rectangle_normalize(Object_t *obj);
 
47
static void rectangle_draw(Object_t *obj, GdkWindow *window, GdkGC* gc);
 
48
static void rectangle_draw_sashes(Object_t *obj, GdkWindow *window, GdkGC* gc);
 
49
static MoveSashFunc_t rectangle_near_sash(Object_t *obj, gint x, gint y);
 
50
static gboolean rectangle_point_is_on(Object_t *obj, gint x, gint y);
 
51
static void rectangle_get_dimensions(Object_t *obj, gint *x, gint *y,
 
52
                                     gint *width, gint *height);
 
53
static void rectangle_resize(Object_t *obj, gint percentage_x,
 
54
                             gint percentage_y);
 
55
static void rectangle_move(Object_t *obj, gint dx, gint dy);
 
56
static gpointer rectangle_create_info_widget(GtkWidget *frame);
 
57
static void rectangle_fill_info_tab(Object_t *obj, gpointer data);
 
58
static void rectangle_set_initial_focus(Object_t *obj, gpointer data);
 
59
static void rectangle_update(Object_t *obj, gpointer data);
 
60
static void rectangle_write_csim(Object_t *obj, gpointer param,
 
61
                                 OutputFunc_t output);
 
62
static void rectangle_write_cern(Object_t *obj, gpointer param,
 
63
                                 OutputFunc_t output);
 
64
static void rectangle_write_ncsa(Object_t *obj, gpointer param,
 
65
                                 OutputFunc_t output);
 
66
static const gchar* rectangle_get_stock_icon_name(void);
 
67
 
 
68
static ObjectClass_t rectangle_class = {
 
69
   N_("_Rectangle"),
 
70
   NULL,                        /* info_dialog */
 
71
   NULL,                        /* icon */
 
72
   NULL,                        /* mask */
 
73
 
 
74
   rectangle_is_valid,
 
75
   NULL,                        /* rectangle_destruct */
 
76
   rectangle_clone,
 
77
   rectangle_assign,
 
78
   rectangle_normalize,
 
79
   rectangle_draw,
 
80
   rectangle_draw_sashes,
 
81
   rectangle_near_sash,
 
82
   rectangle_point_is_on,
 
83
   rectangle_get_dimensions,
 
84
   rectangle_resize,
 
85
   rectangle_move,
 
86
   rectangle_create_info_widget,
 
87
   rectangle_fill_info_tab,     /* rectangle_update_info_widget */
 
88
   rectangle_fill_info_tab,
 
89
   rectangle_set_initial_focus,
 
90
   rectangle_update,
 
91
   rectangle_write_csim,
 
92
   rectangle_write_cern,
 
93
   rectangle_write_ncsa,
 
94
   object_do_popup,
 
95
   rectangle_get_stock_icon_name
 
96
};
 
97
 
 
98
Object_t*
 
99
create_rectangle(gint x, gint y, gint width, gint height)
 
100
{
 
101
   Rectangle_t *rectangle = g_new(Rectangle_t, 1);
 
102
   rectangle->x = x;
 
103
   rectangle->y = y;
 
104
   rectangle->width = width;
 
105
   rectangle->height = height;
 
106
   return object_init(&rectangle->obj, &rectangle_class);
 
107
}
 
108
 
 
109
static void
 
110
draw_any_rectangle(GdkWindow *window, GdkGC *gc, gint x, gint y, gint w,
 
111
                   gint h)
 
112
{
 
113
   if (w < 0) {
 
114
      x += w;
 
115
      w = -w;
 
116
   }
 
117
   if (h < 0) {
 
118
      y += h;
 
119
      h = -h;
 
120
   }
 
121
   draw_rectangle(window, gc, FALSE, x, y, w, h);
 
122
}
 
123
 
 
124
static gboolean
 
125
rectangle_is_valid(Object_t *obj)
 
126
{
 
127
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
128
   return rectangle->width && rectangle->height;
 
129
}
 
130
 
 
131
static Object_t*
 
132
rectangle_clone(Object_t *obj)
 
133
{
 
134
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
135
   Rectangle_t *clone = g_new(Rectangle_t, 1);
 
136
 
 
137
   clone->x = rectangle->x;
 
138
   clone->y = rectangle->y;
 
139
   clone->width = rectangle->width;
 
140
   clone->height = rectangle->height;
 
141
   return &clone->obj;
 
142
}
 
143
 
 
144
static void
 
145
rectangle_assign(Object_t *obj, Object_t *des)
 
146
{
 
147
   Rectangle_t *src_rectangle = ObjectToRectangle(obj);
 
148
   Rectangle_t *des_rectangle = ObjectToRectangle(des);
 
149
   des_rectangle->x = src_rectangle->x;
 
150
   des_rectangle->y = src_rectangle->y;
 
151
   des_rectangle->width = src_rectangle->width;
 
152
   des_rectangle->height = src_rectangle->height;
 
153
}
 
154
 
 
155
static void
 
156
rectangle_normalize(Object_t *obj)
 
157
{
 
158
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
159
   if (rectangle->width < 0) {
 
160
      rectangle->x += rectangle->width;
 
161
      rectangle->width = -rectangle->width;
 
162
   }
 
163
   if (rectangle->height < 0) {
 
164
      rectangle->y += rectangle->height;
 
165
      rectangle->height = -rectangle->height;
 
166
   }
 
167
}
 
168
 
 
169
static void
 
170
rectangle_draw(Object_t *obj, GdkWindow *window, GdkGC *gc)
 
171
{
 
172
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
173
   draw_any_rectangle(window, gc, rectangle->x, rectangle->y,
 
174
                      rectangle->width, rectangle->height);
 
175
}
 
176
 
 
177
static void
 
178
rectangle_draw_sashes(Object_t *obj, GdkWindow *window, GdkGC *gc)
 
179
{
 
180
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
181
   draw_sash(window, gc, rectangle->x, rectangle->y);
 
182
   draw_sash(window, gc, rectangle->x + rectangle->width / 2, rectangle->y);
 
183
   draw_sash(window, gc, rectangle->x + rectangle->width, rectangle->y);
 
184
   draw_sash(window, gc, rectangle->x, rectangle->y + rectangle->height / 2);
 
185
   draw_sash(window, gc, rectangle->x + rectangle->width,
 
186
             rectangle->y + rectangle->height / 2);
 
187
   draw_sash(window, gc, rectangle->x, rectangle->y + rectangle->height);
 
188
   draw_sash(window, gc, rectangle->x + rectangle->width / 2,
 
189
             rectangle->y + rectangle->height);
 
190
   draw_sash(window, gc, rectangle->x + rectangle->width,
 
191
             rectangle->y + rectangle->height);
 
192
}
 
193
 
 
194
static void
 
195
MoveUpperSash(Object_t *obj, gint dx, gint dy)
 
196
{
 
197
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
198
   rectangle->y += dy;
 
199
   rectangle->height -= dy;
 
200
}
 
201
 
 
202
static void
 
203
MoveLeftSash(Object_t *obj, gint dx, gint dy)
 
204
{
 
205
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
206
   rectangle->x += dx;
 
207
   rectangle->width -= dx;
 
208
}
 
209
 
 
210
static void
 
211
MoveRightSash(Object_t *obj, gint dx, gint dy)
 
212
{
 
213
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
214
   rectangle->width += dx;
 
215
}
 
216
 
 
217
static void
 
218
MoveLowerSash(Object_t *obj, gint dx, gint dy)
 
219
{
 
220
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
221
   rectangle->height += dy;
 
222
}
 
223
 
 
224
static void
 
225
MoveUpperLeftSash(Object_t *obj, gint dx, gint dy)
 
226
{
 
227
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
228
   rectangle->x += dx;
 
229
   rectangle->y += dy;
 
230
   rectangle->width -= dx;
 
231
   rectangle->height -= dy;
 
232
}
 
233
 
 
234
static void
 
235
MoveUpperRightSash(Object_t *obj, gint dx, gint dy)
 
236
{
 
237
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
238
   rectangle->y += dy;
 
239
   rectangle->width += dx;
 
240
   rectangle->height -= dy;
 
241
}
 
242
 
 
243
static void
 
244
MoveLowerLeftSash(Object_t *obj, gint dx, gint dy)
 
245
{
 
246
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
247
   rectangle->x += dx;
 
248
   rectangle->width -= dx;
 
249
   rectangle->height += dy;
 
250
}
 
251
 
 
252
static void
 
253
MoveLowerRightSash(Object_t *obj, gint dx, gint dy)
 
254
{
 
255
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
256
   rectangle->width += dx;
 
257
   rectangle->height += dy;
 
258
}
 
259
 
 
260
static MoveSashFunc_t
 
261
rectangle_near_sash(Object_t *obj, gint x, gint y)
 
262
{
 
263
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
264
   if (near_sash(rectangle->x, rectangle->y, x, y))
 
265
      return MoveUpperLeftSash;
 
266
   else if (near_sash(rectangle->x + rectangle->width / 2, rectangle->y, x, y))
 
267
      return MoveUpperSash;
 
268
   else if (near_sash(rectangle->x + rectangle->width, rectangle->y, x, y))
 
269
      return MoveUpperRightSash;
 
270
   else if (near_sash(rectangle->x, rectangle->y + rectangle->height / 2,
 
271
                      x, y))
 
272
      return MoveLeftSash;
 
273
   else if (near_sash(rectangle->x + rectangle->width,
 
274
                      rectangle->y + rectangle->height / 2, x, y))
 
275
      return MoveRightSash;
 
276
   else if (near_sash(rectangle->x, rectangle->y + rectangle->height, x, y))
 
277
      return MoveLowerLeftSash;
 
278
   else if (near_sash(rectangle->x + rectangle->width / 2,
 
279
                      rectangle->y + rectangle->height, x, y))
 
280
      return MoveLowerSash;
 
281
   else if (near_sash(rectangle->x + rectangle->width,
 
282
                      rectangle->y + rectangle->height, x, y))
 
283
      return MoveLowerRightSash;
 
284
   return NULL;
 
285
}
 
286
 
 
287
static gboolean
 
288
rectangle_point_is_on(Object_t *obj, gint x, gint y)
 
289
{
 
290
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
291
   return x >= rectangle->x && x <= rectangle->x + rectangle->width &&
 
292
      y >= rectangle->y && y <= rectangle->y + rectangle->height;
 
293
}
 
294
 
 
295
static void
 
296
rectangle_get_dimensions(Object_t *obj, gint *x, gint *y,
 
297
                         gint *width, gint *height)
 
298
{
 
299
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
300
   *x = rectangle->x;
 
301
   *y = rectangle->y;
 
302
   *width = rectangle->width;
 
303
   *height = rectangle->height;
 
304
}
 
305
 
 
306
static void
 
307
rectangle_resize(Object_t *obj, gint percentage_x, gint percentage_y)
 
308
{
 
309
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
310
   rectangle->x = rectangle->x * percentage_x / 100;
 
311
   rectangle->y = rectangle->y * percentage_y / 100;
 
312
   rectangle->width = rectangle->width * percentage_x / 100;
 
313
   rectangle->height = rectangle->height * percentage_y / 100;
 
314
}
 
315
 
 
316
static void
 
317
rectangle_move(Object_t *obj, gint dx, gint dy)
 
318
{
 
319
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
320
   rectangle->x += dx;
 
321
   rectangle->y += dy;
 
322
}
 
323
 
 
324
typedef struct {
 
325
   Object_t  *obj;
 
326
   GtkWidget *x;
 
327
   GtkWidget *y;
 
328
   GtkWidget *width;
 
329
   GtkWidget *height;
 
330
   GtkWidget *chain_button;
 
331
} RectangleProperties_t;
 
332
 
 
333
static void
 
334
x_changed_cb(GtkWidget *widget, gpointer data)
 
335
{
 
336
   RectangleProperties_t *props = (RectangleProperties_t*) data;
 
337
   Object_t *obj = props->obj;
 
338
   gint x = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
 
339
 
 
340
   if (gimp_chain_button_get_active(GIMP_CHAIN_BUTTON(props->chain_button)))
 
341
      gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->y), x);
 
342
 
 
343
   ObjectToRectangle(obj)->x = x;
 
344
   edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
 
345
}
 
346
 
 
347
static void
 
348
y_changed_cb(GtkWidget *widget, gpointer data)
 
349
{
 
350
   Object_t *obj = ((RectangleProperties_t*) data)->obj;
 
351
   gint y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
 
352
   ObjectToRectangle(obj)->y = y;
 
353
   edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
 
354
}
 
355
 
 
356
static void
 
357
width_changed_cb(GtkWidget *widget, gpointer data)
 
358
{
 
359
   Object_t *obj = ((RectangleProperties_t*) data)->obj;
 
360
   gint width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
 
361
   ObjectToRectangle(obj)->width = width;
 
362
   edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
 
363
}
 
364
 
 
365
static void
 
366
height_changed_cb(GtkWidget *widget, gpointer data)
 
367
{
 
368
   Object_t *obj = ((RectangleProperties_t*) data)->obj;
 
369
   gint height = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
 
370
   ObjectToRectangle(obj)->height = height;
 
371
   edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
 
372
}
 
373
 
 
374
static gpointer
 
375
rectangle_create_info_widget(GtkWidget *frame)
 
376
{
 
377
   RectangleProperties_t *props = g_new(RectangleProperties_t, 1);
 
378
   GtkWidget *table, *label, *chain_button;
 
379
   gint max_width = get_image_width();
 
380
   gint max_height = get_image_height();
 
381
 
 
382
   table = gtk_table_new(4, 4, FALSE);
 
383
   gtk_container_add(GTK_CONTAINER(frame), table);
 
384
 
 
385
   gtk_table_set_row_spacings(GTK_TABLE(table), 6);
 
386
   gtk_table_set_col_spacings(GTK_TABLE(table), 6);
 
387
   gtk_widget_show(table);
 
388
 
 
389
   label = create_label_in_table(table, 0, 0, _("Upper left _x:"));
 
390
   props->x = create_spin_button_in_table(table, label, 0, 1, 1, 0,
 
391
                                          max_width - 1);
 
392
   g_signal_connect(props->x, "value_changed",
 
393
                    G_CALLBACK(x_changed_cb), (gpointer) props);
 
394
   create_label_in_table(table, 0, 3, _("pixels"));
 
395
 
 
396
   label = create_label_in_table(table, 1, 0, _("Upper left _y:"));
 
397
   props->y = create_spin_button_in_table(table, label, 1, 1, 1, 0,
 
398
                                          max_height - 1);
 
399
   g_signal_connect(props->y, "value_changed",
 
400
                    G_CALLBACK(y_changed_cb), (gpointer) props);
 
401
   create_label_in_table(table, 1, 3, _("pixels"));
 
402
 
 
403
   label = create_label_in_table(table, 2, 0, _("_Width:"));
 
404
   props->width = create_spin_button_in_table(table, label, 2, 1, 1, 1,
 
405
                                              max_width);
 
406
   g_signal_connect(props->width, "value_changed",
 
407
                    G_CALLBACK(width_changed_cb), (gpointer) props);
 
408
   create_label_in_table(table, 2, 3, _("pixels"));
 
409
 
 
410
   label = create_label_in_table(table, 3, 0, _("_Height:"));
 
411
   props->height = create_spin_button_in_table(table, label, 3, 1, 1, 1,
 
412
                                               max_height);
 
413
   g_signal_connect(props->height, "value_changed",
 
414
                    G_CALLBACK(height_changed_cb), (gpointer) props);
 
415
   create_label_in_table(table, 3, 3, _("pixels"));
 
416
 
 
417
   chain_button = gimp_chain_button_new(GIMP_CHAIN_RIGHT);
 
418
   props->chain_button = chain_button;
 
419
   gtk_table_attach_defaults(GTK_TABLE(table), chain_button, 2, 3, 2, 4);
 
420
   gtk_widget_show(chain_button);
 
421
 
 
422
   return props;
 
423
}
 
424
 
 
425
static void
 
426
rectangle_fill_info_tab(Object_t *obj, gpointer data)
 
427
{
 
428
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
429
   RectangleProperties_t *props = (RectangleProperties_t*) data;
 
430
 
 
431
   props->obj = obj;
 
432
   gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->x), rectangle->x);
 
433
   gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->y), rectangle->y);
 
434
   gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->width), rectangle->width);
 
435
   gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->height),
 
436
                             rectangle->height);
 
437
}
 
438
 
 
439
static void
 
440
rectangle_set_initial_focus(Object_t *obj, gpointer data)
 
441
{
 
442
   RectangleProperties_t *props = (RectangleProperties_t*) data;
 
443
   gtk_widget_grab_focus(props->x);
 
444
}
 
445
 
 
446
static void
 
447
rectangle_update(Object_t* obj, gpointer data)
 
448
{
 
449
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
450
   RectangleProperties_t *props = (RectangleProperties_t*) data;
 
451
 
 
452
   rectangle->x = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(props->x));
 
453
   rectangle->y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(props->y));
 
454
   rectangle->width = gtk_spin_button_get_value_as_int(
 
455
      GTK_SPIN_BUTTON(props->width));
 
456
   rectangle->height = gtk_spin_button_get_value_as_int(
 
457
      GTK_SPIN_BUTTON(props->height));
 
458
}
 
459
 
 
460
static void
 
461
rectangle_write_csim(Object_t *obj, gpointer param, OutputFunc_t output)
 
462
{
 
463
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
464
   output(param, "\"rect\" coords=\"%d,%d,%d,%d\"", rectangle->x, rectangle->y,
 
465
          rectangle->x + rectangle->width, rectangle->y + rectangle->height);
 
466
}
 
467
 
 
468
static void
 
469
rectangle_write_cern(Object_t *obj, gpointer param, OutputFunc_t output)
 
470
{
 
471
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
472
   output(param, "rect (%d,%d) (%d,%d)", rectangle->x, rectangle->y,
 
473
          rectangle->x + rectangle->width, rectangle->y + rectangle->height);
 
474
}
 
475
 
 
476
static void
 
477
rectangle_write_ncsa(Object_t *obj, gpointer param, OutputFunc_t output)
 
478
{
 
479
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
480
   output(param, "rect %s %d,%d %d,%d", obj->url,
 
481
          rectangle->x, rectangle->y,
 
482
          rectangle->x + rectangle->width, rectangle->y + rectangle->height);
 
483
}
 
484
 
 
485
static const gchar*
 
486
rectangle_get_stock_icon_name(void)
 
487
{
 
488
   return IMAP_STOCK_RECTANGLE;
 
489
}
 
490
 
 
491
static gboolean
 
492
rectangle_factory_finish(Object_t *obj, gint x, gint y)
 
493
{
 
494
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
495
 
 
496
   rectangle->width = x - rectangle->x;
 
497
   rectangle->height = y - rectangle->y;
 
498
 
 
499
   rectangle_normalize(obj);
 
500
 
 
501
   return TRUE;
 
502
}
 
503
 
 
504
static Object_t*
 
505
rectangle_factory_create_object(gint x, gint y)
 
506
{
 
507
   return create_rectangle(x, y, 0, 0);
 
508
}
 
509
 
 
510
static void
 
511
rectangle_factory_set_xy(Object_t *obj, guint state, gint x, gint y)
 
512
{
 
513
   Rectangle_t *rectangle = ObjectToRectangle(obj);
 
514
 
 
515
   rectangle->width = x - rectangle->x;
 
516
   rectangle->height = y - rectangle->y;
 
517
 
 
518
   if (state & GDK_SHIFT_MASK){
 
519
      gint width = abs(rectangle->width);
 
520
      gint height = abs(rectangle->height);
 
521
      if (width < height)
 
522
         rectangle->height = (rectangle->height < 0) ? -width : width;
 
523
      else
 
524
         rectangle->width = (rectangle->width < 0) ? -height : height;
 
525
   }
 
526
 
 
527
   main_set_dimension(rectangle->width, rectangle->height);
 
528
}
 
529
 
 
530
static ObjectFactory_t rectangle_factory = {
 
531
   NULL,                        /* Object pointer */
 
532
   rectangle_factory_finish,
 
533
   NULL,                        /* Cancel func */
 
534
   rectangle_factory_create_object,
 
535
   rectangle_factory_set_xy
 
536
};
 
537
 
 
538
ObjectFactory_t*
 
539
get_rectangle_factory(guint state)
 
540
{
 
541
   return &rectangle_factory;
 
542
}