1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998 Alexander Larsson
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #include "connectionpoint.h"
30 #include "diarenderer.h"
31 #include "attributes.h"
34 #include "properties.h"
36 #include "tool-icons.h"
38 #define DEFAULT_WIDTH 2.0
39 #define DEFAULT_HEIGHT 1.0
40 #define DEFAULT_BORDER 0.15
48 typedef struct _Ellipse Ellipse
;
53 ConnectionPoint connections
[9];
59 gboolean show_background
;
65 static struct _EllipseProperties
{
67 gboolean show_background
;
68 } default_properties
= { FREE_ASPECT
, TRUE
};
70 static real
ellipse_distance_from(Ellipse
*ellipse
, Point
*point
);
71 static void ellipse_select(Ellipse
*ellipse
, Point
*clicked_point
,
72 DiaRenderer
*interactive_renderer
);
73 static ObjectChange
* ellipse_move_handle(Ellipse
*ellipse
, Handle
*handle
,
74 Point
*to
, ConnectionPoint
*cp
,
75 HandleMoveReason reason
, ModifierKeys modifiers
);
76 static ObjectChange
* ellipse_move(Ellipse
*ellipse
, Point
*to
);
77 static void ellipse_draw(Ellipse
*ellipse
, DiaRenderer
*renderer
);
78 static void ellipse_update_data(Ellipse
*ellipse
);
79 static DiaObject
*ellipse_create(Point
*startpoint
,
83 static void ellipse_destroy(Ellipse
*ellipse
);
84 static DiaObject
*ellipse_copy(Ellipse
*ellipse
);
86 static PropDescription
*ellipse_describe_props(Ellipse
*ellipse
);
87 static void ellipse_get_props(Ellipse
*ellipse
, GPtrArray
*props
);
88 static void ellipse_set_props(Ellipse
*ellipse
, GPtrArray
*props
);
90 static void ellipse_save(Ellipse
*ellipse
, ObjectNode obj_node
, const char *filename
);
91 static DiaObject
*ellipse_load(ObjectNode obj_node
, int version
, const char *filename
);
92 static DiaMenu
*ellipse_get_object_menu(Ellipse
*ellipse
, Point
*clickedpoint
);
94 static ObjectTypeOps ellipse_type_ops
=
96 (CreateFunc
) ellipse_create
,
97 (LoadFunc
) ellipse_load
,
98 (SaveFunc
) ellipse_save
,
99 (GetDefaultsFunc
) NULL
,
100 (ApplyDefaultsFunc
) NULL
103 DiaObjectType ellipse_type
=
105 "Standard - Ellipse", /* name */
107 (char **) ellipse_icon
, /* pixmap */
109 &ellipse_type_ops
/* ops */
112 DiaObjectType
*_ellipse_type
= (DiaObjectType
*) &ellipse_type
;
114 static ObjectOps ellipse_ops
= {
115 (DestroyFunc
) ellipse_destroy
,
116 (DrawFunc
) ellipse_draw
,
117 (DistanceFunc
) ellipse_distance_from
,
118 (SelectFunc
) ellipse_select
,
119 (CopyFunc
) ellipse_copy
,
120 (MoveFunc
) ellipse_move
,
121 (MoveHandleFunc
) ellipse_move_handle
,
122 (GetPropertiesFunc
) object_create_props_dialog
,
123 (ApplyPropertiesFunc
) object_apply_props_from_dialog
,
124 (ObjectMenuFunc
) ellipse_get_object_menu
,
125 (DescribePropsFunc
) ellipse_describe_props
,
126 (GetPropsFunc
) ellipse_get_props
,
127 (SetPropsFunc
) ellipse_set_props
,
130 static PropEnumData prop_aspect_data
[] = {
131 { N_("Free"), FREE_ASPECT
},
132 { N_("Fixed"), FIXED_ASPECT
},
133 { N_("Circle"), CIRCLE_ASPECT
},
136 static PropDescription ellipse_props
[] = {
137 ELEMENT_COMMON_PROPERTIES
,
139 PROP_STD_LINE_COLOUR
,
140 PROP_STD_FILL_COLOUR
,
141 PROP_STD_SHOW_BACKGROUND
,
143 { "aspect", PROP_TYPE_ENUM
, PROP_FLAG_VISIBLE
,
144 N_("Aspect ratio"), NULL
, prop_aspect_data
},
148 static PropDescription
*
149 ellipse_describe_props(Ellipse
*ellipse
)
151 if (ellipse_props
[0].quark
== 0)
152 prop_desc_list_calculate_quarks(ellipse_props
);
153 return ellipse_props
;
156 static PropOffset ellipse_offsets
[] = {
157 ELEMENT_COMMON_PROPERTIES_OFFSETS
,
158 { "line_width", PROP_TYPE_REAL
, offsetof(Ellipse
, border_width
) },
159 { "line_colour", PROP_TYPE_COLOUR
, offsetof(Ellipse
, border_color
) },
160 { "fill_colour", PROP_TYPE_COLOUR
, offsetof(Ellipse
, inner_color
) },
161 { "show_background", PROP_TYPE_BOOL
, offsetof(Ellipse
, show_background
) },
162 { "aspect", PROP_TYPE_ENUM
, offsetof(Ellipse
, aspect
) },
163 { "line_style", PROP_TYPE_LINESTYLE
,
164 offsetof(Ellipse
, line_style
), offsetof(Ellipse
, dashlength
) },
169 ellipse_get_props(Ellipse
*ellipse
, GPtrArray
*props
)
171 object_get_props_from_offsets(&ellipse
->element
.object
,
172 ellipse_offsets
, props
);
176 ellipse_set_props(Ellipse
*ellipse
, GPtrArray
*props
)
179 object_set_props_from_offsets(&ellipse
->element
.object
,
180 ellipse_offsets
, props
);
182 ellipse_update_data(ellipse
);
186 ellipse_distance_from(Ellipse
*ellipse
, Point
*point
)
188 Element
*elem
= &ellipse
->element
;
191 center
.x
= elem
->corner
.x
+elem
->width
/2;
192 center
.y
= elem
->corner
.y
+elem
->height
/2;
194 return distance_ellipse_point(¢er
, elem
->width
, elem
->height
,
195 ellipse
->border_width
, point
);
199 ellipse_select(Ellipse
*ellipse
, Point
*clicked_point
,
200 DiaRenderer
*interactive_renderer
)
202 element_update_handles(&ellipse
->element
);
206 ellipse_move_handle(Ellipse
*ellipse
, Handle
*handle
,
207 Point
*to
, ConnectionPoint
*cp
,
208 HandleMoveReason reason
, ModifierKeys modifiers
)
210 Element
*elem
= &ellipse
->element
;
213 assert(ellipse
!=NULL
);
214 assert(handle
!=NULL
);
217 assert(handle
->id
< 8 || handle
->id
== HANDLE_CUSTOM1
);
218 if (handle
->id
== HANDLE_CUSTOM1
) {
219 Point delta
, corner_to
;
220 delta
.x
= to
->x
- (elem
->corner
.x
+ elem
->width
/2);
221 delta
.y
= to
->y
- (elem
->corner
.y
+ elem
->height
/2);
222 corner_to
.x
= elem
->corner
.x
+ delta
.x
;
223 corner_to
.y
= elem
->corner
.y
+ delta
.y
;
224 return ellipse_move(ellipse
, &corner_to
);
226 if (ellipse
->aspect
!= FREE_ASPECT
){
228 float new_width
, new_height
;
229 float to_width
, aspect_width
;
232 width
= ellipse
->element
.width
;
233 height
= ellipse
->element
.height
;
234 center
.x
= elem
->corner
.x
+ width
/2;
235 center
.y
= elem
->corner
.y
+ height
/2;
236 switch (handle
->id
) {
237 case HANDLE_RESIZE_E
:
238 case HANDLE_RESIZE_W
:
239 new_width
= 2 * fabs(to
->x
- center
.x
);
240 new_height
= new_width
/ width
* height
;
242 case HANDLE_RESIZE_N
:
243 case HANDLE_RESIZE_S
:
244 new_height
= 2 * fabs(to
->y
- center
.y
);
245 new_width
= new_height
/ height
* width
;
247 case HANDLE_RESIZE_NW
:
248 case HANDLE_RESIZE_NE
:
249 case HANDLE_RESIZE_SW
:
250 case HANDLE_RESIZE_SE
:
251 to_width
= 2 * fabs(to
->x
- center
.x
);
252 aspect_width
= 2 * fabs(to
->y
- center
.y
) / height
* width
;
253 new_width
= to_width
< aspect_width
? to_width
: aspect_width
;
254 new_height
= new_width
/ width
* height
;
262 nw_to
.x
= center
.x
- new_width
/2;
263 nw_to
.y
= center
.y
- new_height
/2;
264 se_to
.x
= center
.x
+ new_width
/2;
265 se_to
.y
= center
.y
+ new_height
/2;
267 element_move_handle(&ellipse
->element
, HANDLE_RESIZE_NW
, &nw_to
, cp
, reason
, modifiers
);
268 element_move_handle(&ellipse
->element
, HANDLE_RESIZE_SE
, &se_to
, cp
, reason
, modifiers
);
272 center
.x
= elem
->corner
.x
+ elem
->width
/2;
273 center
.y
= elem
->corner
.y
+ elem
->height
/2;
274 opposite_to
.x
= center
.x
- (to
->x
-center
.x
);
275 opposite_to
.y
= center
.y
- (to
->y
-center
.y
);
277 element_move_handle(&ellipse
->element
, handle
->id
, to
, cp
, reason
, modifiers
);
278 element_move_handle(&ellipse
->element
, 7-handle
->id
, &opposite_to
, cp
, reason
, modifiers
);
281 ellipse_update_data(ellipse
);
288 ellipse_move(Ellipse
*ellipse
, Point
*to
)
290 ellipse
->element
.corner
= *to
;
291 ellipse_update_data(ellipse
);
297 ellipse_draw(Ellipse
*ellipse
, DiaRenderer
*renderer
)
299 DiaRendererClass
*renderer_ops
= DIA_RENDERER_GET_CLASS (renderer
);
303 assert(ellipse
!= NULL
);
304 assert(renderer
!= NULL
);
306 elem
= &ellipse
->element
;
308 center
.x
= elem
->corner
.x
+ elem
->width
/2;
309 center
.y
= elem
->corner
.y
+ elem
->height
/2;
311 if (ellipse
->show_background
) {
312 renderer_ops
->set_fillstyle(renderer
, FILLSTYLE_SOLID
);
314 renderer_ops
->fill_ellipse(renderer
,
316 elem
->width
, elem
->height
,
317 &ellipse
->inner_color
);
320 renderer_ops
->set_linewidth(renderer
, ellipse
->border_width
);
321 renderer_ops
->set_linestyle(renderer
, ellipse
->line_style
);
322 renderer_ops
->set_dashlength(renderer
, ellipse
->dashlength
);
324 renderer_ops
->draw_ellipse(renderer
,
326 elem
->width
, elem
->height
,
327 &ellipse
->border_color
);
331 ellipse_update_data(Ellipse
*ellipse
)
333 Element
*elem
= &ellipse
->element
;
334 ElementBBExtras
*extra
= &elem
->extra_spacing
;
335 DiaObject
*obj
= &elem
->object
;
339 /* handle circle implies height=width */
340 if (ellipse
->aspect
== CIRCLE_ASPECT
){
341 float size
= elem
->height
< elem
->width
? elem
->height
: elem
->width
;
342 elem
->height
= elem
->width
= size
;
345 center
.x
= elem
->corner
.x
+ elem
->width
/ 2.0;
346 center
.y
= elem
->corner
.y
+ elem
->height
/ 2.0;
348 half_x
= elem
->width
* M_SQRT1_2
/ 2.0;
349 half_y
= elem
->height
* M_SQRT1_2
/ 2.0;
351 /* Update connections: */
352 ellipse
->connections
[0].pos
.x
= center
.x
- half_x
;
353 ellipse
->connections
[0].pos
.y
= center
.y
- half_y
;
354 ellipse
->connections
[1].pos
.x
= center
.x
;
355 ellipse
->connections
[1].pos
.y
= elem
->corner
.y
;
356 ellipse
->connections
[2].pos
.x
= center
.x
+ half_x
;
357 ellipse
->connections
[2].pos
.y
= center
.y
- half_y
;
358 ellipse
->connections
[3].pos
.x
= elem
->corner
.x
;
359 ellipse
->connections
[3].pos
.y
= center
.y
;
360 ellipse
->connections
[4].pos
.x
= elem
->corner
.x
+ elem
->width
;
361 ellipse
->connections
[4].pos
.y
= elem
->corner
.y
+ elem
->height
/ 2.0;
362 ellipse
->connections
[5].pos
.x
= center
.x
- half_x
;
363 ellipse
->connections
[5].pos
.y
= center
.y
+ half_y
;
364 ellipse
->connections
[6].pos
.x
= elem
->corner
.x
+ elem
->width
/ 2.0;
365 ellipse
->connections
[6].pos
.y
= elem
->corner
.y
+ elem
->height
;
366 ellipse
->connections
[7].pos
.x
= center
.x
+ half_x
;
367 ellipse
->connections
[7].pos
.y
= center
.y
+ half_y
;
368 ellipse
->connections
[8].pos
.x
= center
.x
;
369 ellipse
->connections
[8].pos
.y
= center
.y
;
371 /* Update directions -- if the ellipse is very thin, these may not be good */
372 ellipse
->connections
[0].directions
= DIR_NORTH
|DIR_WEST
;
373 ellipse
->connections
[1].directions
= DIR_NORTH
;
374 ellipse
->connections
[2].directions
= DIR_NORTH
|DIR_EAST
;
375 ellipse
->connections
[3].directions
= DIR_WEST
;
376 ellipse
->connections
[4].directions
= DIR_EAST
;
377 ellipse
->connections
[5].directions
= DIR_SOUTH
|DIR_WEST
;
378 ellipse
->connections
[6].directions
= DIR_SOUTH
;
379 ellipse
->connections
[7].directions
= DIR_SOUTH
|DIR_EAST
;
380 ellipse
->connections
[8].directions
= DIR_ALL
;
382 extra
->border_trans
= ellipse
->border_width
/ 2.0;
383 element_update_boundingbox(elem
);
385 obj
->position
= elem
->corner
;
387 element_update_handles(elem
);
389 obj
->handles
[8]->pos
.x
= center
.x
;
390 obj
->handles
[8]->pos
.y
= center
.y
;
394 ellipse_create(Point
*startpoint
,
404 ellipse
= g_malloc0(sizeof(Ellipse
));
405 elem
= &ellipse
->element
;
408 obj
->type
= &ellipse_type
;
410 obj
->ops
= &ellipse_ops
;
412 elem
->corner
= *startpoint
;
413 elem
->width
= DEFAULT_WIDTH
;
414 elem
->height
= DEFAULT_HEIGHT
;
416 ellipse
->border_width
= attributes_get_default_linewidth();
417 ellipse
->border_color
= attributes_get_foreground();
418 ellipse
->inner_color
= attributes_get_background();
419 attributes_get_default_line_style(&ellipse
->line_style
,
420 &ellipse
->dashlength
);
421 ellipse
->show_background
= default_properties
.show_background
;
422 ellipse
->aspect
= default_properties
.aspect
;
424 element_init(elem
, 9, 9);
426 obj
->handles
[8] = &ellipse
->center_handle
;
427 obj
->handles
[8]->id
= HANDLE_CUSTOM1
;
428 obj
->handles
[8]->type
= HANDLE_MAJOR_CONTROL
;
429 obj
->handles
[8]->connected_to
= NULL
;
430 obj
->handles
[8]->connect_type
= HANDLE_NONCONNECTABLE
;
433 obj
->connections
[i
] = &ellipse
->connections
[i
];
434 ellipse
->connections
[i
].object
= obj
;
435 ellipse
->connections
[i
].connected
= NULL
;
437 ellipse
->connections
[8].flags
= CP_FLAGS_MAIN
;
438 ellipse_update_data(ellipse
);
441 *handle2
= obj
->handles
[7];
442 return &ellipse
->element
.object
;
446 ellipse_destroy(Ellipse
*ellipse
)
448 element_destroy(&ellipse
->element
);
452 ellipse_copy(Ellipse
*ellipse
)
456 Element
*elem
, *newelem
;
459 elem
= &ellipse
->element
;
461 newellipse
= g_malloc0(sizeof(Ellipse
));
462 newelem
= &newellipse
->element
;
463 newobj
= &newelem
->object
;
465 element_copy(elem
, newelem
);
467 newellipse
->border_width
= ellipse
->border_width
;
468 newellipse
->border_color
= ellipse
->border_color
;
469 newellipse
->inner_color
= ellipse
->inner_color
;
470 newellipse
->dashlength
= ellipse
->dashlength
;
471 newellipse
->show_background
= ellipse
->show_background
;
472 newellipse
->aspect
= ellipse
->aspect
;
473 newellipse
->line_style
= ellipse
->line_style
;
475 newellipse
->center_handle
= ellipse
->center_handle
;
476 newellipse
->center_handle
.connected_to
= NULL
;
477 newobj
->handles
[8] = &newellipse
->center_handle
;
480 newobj
->connections
[i
] = &newellipse
->connections
[i
];
481 newellipse
->connections
[i
].object
= newobj
;
482 newellipse
->connections
[i
].connected
= NULL
;
483 newellipse
->connections
[i
].pos
= ellipse
->connections
[i
].pos
;
484 newellipse
->connections
[i
].last_pos
= ellipse
->connections
[i
].last_pos
;
485 newellipse
->connections
[i
].flags
= ellipse
->connections
[i
].flags
;
488 return &newellipse
->element
.object
;
493 ellipse_save(Ellipse
*ellipse
, ObjectNode obj_node
, const char *filename
)
495 element_save(&ellipse
->element
, obj_node
);
497 if (ellipse
->border_width
!= 0.1)
498 data_add_real(new_attribute(obj_node
, "border_width"),
499 ellipse
->border_width
);
501 if (!color_equals(&ellipse
->border_color
, &color_black
))
502 data_add_color(new_attribute(obj_node
, "border_color"),
503 &ellipse
->border_color
);
505 if (!color_equals(&ellipse
->inner_color
, &color_white
))
506 data_add_color(new_attribute(obj_node
, "inner_color"),
507 &ellipse
->inner_color
);
509 if (!ellipse
->show_background
)
510 data_add_boolean(new_attribute(obj_node
, "show_background"),
511 ellipse
->show_background
);
513 if (ellipse
->aspect
!= FREE_ASPECT
)
514 data_add_enum(new_attribute(obj_node
, "aspect"),
517 if (ellipse
->line_style
!= LINESTYLE_SOLID
) {
518 data_add_enum(new_attribute(obj_node
, "line_style"),
519 ellipse
->line_style
);
521 if (ellipse
->dashlength
!= DEFAULT_LINESTYLE_DASHLEN
)
522 data_add_real(new_attribute(obj_node
, "dashlength"),
523 ellipse
->dashlength
);
527 static DiaObject
*ellipse_load(ObjectNode obj_node
, int version
, const char *filename
)
535 ellipse
= g_malloc0(sizeof(Ellipse
));
536 elem
= &ellipse
->element
;
539 obj
->type
= &ellipse_type
;
540 obj
->ops
= &ellipse_ops
;
542 element_load(elem
, obj_node
);
544 ellipse
->border_width
= 0.1;
545 attr
= object_find_attribute(obj_node
, "border_width");
547 ellipse
->border_width
= data_real( attribute_first_data(attr
) );
549 ellipse
->border_color
= color_black
;
550 attr
= object_find_attribute(obj_node
, "border_color");
552 data_color(attribute_first_data(attr
), &ellipse
->border_color
);
554 ellipse
->inner_color
= color_white
;
555 attr
= object_find_attribute(obj_node
, "inner_color");
557 data_color(attribute_first_data(attr
), &ellipse
->inner_color
);
559 ellipse
->show_background
= TRUE
;
560 attr
= object_find_attribute(obj_node
, "show_background");
562 ellipse
->show_background
= data_boolean(attribute_first_data(attr
));
564 ellipse
->aspect
= FREE_ASPECT
;
565 attr
= object_find_attribute(obj_node
, "aspect");
567 ellipse
->aspect
= data_enum(attribute_first_data(attr
));
569 ellipse
->line_style
= LINESTYLE_SOLID
;
570 attr
= object_find_attribute(obj_node
, "line_style");
572 ellipse
->line_style
= data_enum( attribute_first_data(attr
) );
574 ellipse
->dashlength
= DEFAULT_LINESTYLE_DASHLEN
;
575 attr
= object_find_attribute(obj_node
, "dashlength");
577 ellipse
->dashlength
= data_real(attribute_first_data(attr
));
579 element_init(elem
, 9, 9);
581 obj
->handles
[8] = &ellipse
->center_handle
;
582 obj
->handles
[8]->id
= HANDLE_CUSTOM1
;
583 obj
->handles
[8]->type
= HANDLE_MAJOR_CONTROL
;
584 obj
->handles
[8]->connected_to
= NULL
;
585 obj
->handles
[8]->connect_type
= HANDLE_NONCONNECTABLE
;
588 obj
->connections
[i
] = &ellipse
->connections
[i
];
589 ellipse
->connections
[i
].object
= obj
;
590 ellipse
->connections
[i
].connected
= NULL
;
592 ellipse
->connections
[8].flags
= CP_FLAGS_MAIN
;
594 ellipse_update_data(ellipse
);
596 return &ellipse
->element
.object
;
599 struct AspectChange
{
600 ObjectChange obj_change
;
601 AspectType old_type
, new_type
;
602 /* The points before this got applied. Afterwards, all points can be
610 aspect_change_free(struct AspectChange
*change
)
615 aspect_change_apply(struct AspectChange
*change
, DiaObject
*obj
)
617 Ellipse
*ellipse
= (Ellipse
*)obj
;
619 ellipse
->aspect
= change
->new_type
;
620 ellipse_update_data(ellipse
);
624 aspect_change_revert(struct AspectChange
*change
, DiaObject
*obj
)
626 Ellipse
*ellipse
= (Ellipse
*)obj
;
628 ellipse
->aspect
= change
->old_type
;
629 ellipse
->element
.corner
= change
->topleft
;
630 ellipse
->element
.width
= change
->width
;
631 ellipse
->element
.height
= change
->height
;
632 ellipse_update_data(ellipse
);
635 static ObjectChange
*
636 aspect_create_change(Ellipse
*ellipse
, AspectType aspect
)
638 struct AspectChange
*change
;
640 change
= g_new0(struct AspectChange
, 1);
642 change
->obj_change
.apply
= (ObjectChangeApplyFunc
) aspect_change_apply
;
643 change
->obj_change
.revert
= (ObjectChangeRevertFunc
) aspect_change_revert
;
644 change
->obj_change
.free
= (ObjectChangeFreeFunc
) aspect_change_free
;
646 change
->old_type
= ellipse
->aspect
;
647 change
->new_type
= aspect
;
648 change
->topleft
= ellipse
->element
.corner
;
649 change
->width
= ellipse
->element
.width
;
650 change
->height
= ellipse
->element
.height
;
652 return (ObjectChange
*)change
;
656 static ObjectChange
*
657 ellipse_set_aspect_callback (DiaObject
* obj
, Point
* clicked
, gpointer data
)
659 ObjectChange
*change
;
661 change
= aspect_create_change((Ellipse
*)obj
, (AspectType
)data
);
662 change
->apply(change
, obj
);
667 static DiaMenuItem ellipse_menu_items
[] = {
668 { N_("Free aspect"), ellipse_set_aspect_callback
, (void*)FREE_ASPECT
,
669 DIAMENU_ACTIVE
|DIAMENU_TOGGLE
},
670 { N_("Fixed aspect"), ellipse_set_aspect_callback
, (void*)FIXED_ASPECT
,
671 DIAMENU_ACTIVE
|DIAMENU_TOGGLE
},
672 { N_("Circle"), ellipse_set_aspect_callback
, (void*)CIRCLE_ASPECT
,
673 DIAMENU_ACTIVE
|DIAMENU_TOGGLE
},
676 static DiaMenu ellipse_menu
= {
678 sizeof(ellipse_menu_items
)/sizeof(DiaMenuItem
),
684 ellipse_get_object_menu(Ellipse
*ellipse
, Point
*clickedpoint
)
686 /* Set entries sensitive/selected etc here */
687 ellipse_menu_items
[0].active
= DIAMENU_ACTIVE
|DIAMENU_TOGGLE
;
688 ellipse_menu_items
[1].active
= DIAMENU_ACTIVE
|DIAMENU_TOGGLE
;
689 ellipse_menu_items
[2].active
= DIAMENU_ACTIVE
|DIAMENU_TOGGLE
;
691 ellipse_menu_items
[ellipse
->aspect
].active
=
692 DIAMENU_ACTIVE
|DIAMENU_TOGGLE
|DIAMENU_TOGGLE_ON
;
694 return &ellipse_menu
;