作図ソフト dia の改良版
Revisão | ec0943877ba6b4adbe975f625380b983ec861ff9 (tree) |
---|---|
Hora | 2009-10-05 02:12:23 |
Autor | Hans Breuer <hans@breu...> |
Commiter | Hans Breuer |
Bug 576548 - Refactoring of highlighting in interactive rendering
The previous implementation was keeping the state in every object
(DiaObject::highlight_color) and in the renderer to support it: e.g.
DiaGdkRenderer::highlight_color. But the real highlighting state is managed by
the diagram (where it needs to be).
We got rid of the object knowing about highlight state; provide methods in
the InteractiveRenderer interface to perform highlighted rendering and have
something like a "highlighting selection" (similar to standard selection)
to manage which object should be rendered highlighted.
From: Heikki Paajanen <hepaajan@iki.fi>
Date: Thu, 28 May 2009 18:37:49 +0300
Subject: Refactoring of highlighting in interactive rendering
https://bugzilla.gnome.org/attachment.cgi?id=135703
From: Hans Breuer <hans@breuer.org>
Date: Sat, 30 May 2009 14:07:08 +0200
Subject: Bug 576548 - Highlighting cleanup second iteration
https://bugzilla.gnome.org/attachment.cgi?id=135704
* app/display.c : don't crash if the renderer does not support highligthing
* lib/diagramdata.[ch] : renamed some functions and more consistent format
* app/highlight.c app/object_ops.c : reflect renaming
* lib/libdia.def : export highlight accessors
* lib/plug-ins.h : increment API_VERSION, object size changed
@@ -233,7 +233,7 @@ create_object_motion(CreateObjectTool *tool, GdkEventMotion *event, | ||
233 | 233 | |
234 | 234 | if (connectionpoint != NULL) { |
235 | 235 | to = connectionpoint->pos; |
236 | - highlight_object(connectionpoint->object, NULL, ddisp->diagram); | |
236 | + highlight_object(connectionpoint->object, DIA_HIGHLIGHT_CONNECTIONPOINT, ddisp->diagram); | |
237 | 237 | ddisplay_set_all_cursor(get_cursor(CURSOR_CONNECT)); |
238 | 238 | } |
239 | 239 | } |
@@ -618,7 +618,15 @@ ddisplay_obj_render(DiaObject *obj, DiaRenderer *renderer, | ||
618 | 618 | DDisplay *ddisp = (DDisplay *)data; |
619 | 619 | int i; |
620 | 620 | |
621 | - DIA_RENDERER_GET_CLASS(renderer)->draw_object(renderer, obj); | |
621 | + DiaInteractiveRendererInterface *irenderer = | |
622 | + DIA_GET_INTERACTIVE_RENDERER_INTERFACE (renderer); | |
623 | + DiaHighlightType hltype = data_object_get_highlight(DIA_DIAGRAM_DATA(ddisp->diagram), obj); | |
624 | + | |
625 | + if (hltype != DIA_HIGHLIGHT_NONE && irenderer->draw_object_highlighted != NULL) | |
626 | + irenderer->draw_object_highlighted(renderer, obj, hltype); | |
627 | + else /* maybe the renderer does not support highlighting */ | |
628 | + DIA_RENDERER_GET_CLASS(renderer)->draw_object(renderer, obj); | |
629 | + | |
622 | 630 | if (ddisp->show_cx_pts && |
623 | 631 | obj->parent_layer != NULL && obj->parent_layer->connectable) { |
624 | 632 | for (i=0;i<obj->num_connections;i++) { |
@@ -40,15 +40,10 @@ | ||
40 | 40 | * as it knows about the conversion. |
41 | 41 | */ |
42 | 42 | |
43 | -static Color red = { 1.0, 0.0, 0.0 }; | |
44 | - | |
45 | 43 | void |
46 | -highlight_object(DiaObject *obj, Color *col, Diagram *dia) | |
44 | +highlight_object(DiaObject *obj, DiaHighlightType type, Diagram *dia) | |
47 | 45 | { |
48 | - if (col) | |
49 | - obj->highlight_color = col; | |
50 | - else | |
51 | - obj->highlight_color = &red; | |
46 | + data_highlight_add(dia->data, obj, type); | |
52 | 47 | |
53 | 48 | object_add_updates(obj, dia); |
54 | 49 | } |
@@ -56,11 +51,8 @@ highlight_object(DiaObject *obj, Color *col, Diagram *dia) | ||
56 | 51 | void |
57 | 52 | highlight_object_off(DiaObject *obj, Diagram *dia) |
58 | 53 | { |
59 | - if (obj->highlight_color != NULL) { | |
60 | - /* Must add updates first, so we get the border erased. */ | |
61 | - object_add_updates(obj, dia); | |
62 | - obj->highlight_color = NULL; | |
63 | - } | |
54 | + object_add_updates(obj, dia); | |
55 | + data_highlight_remove(dia->data, obj); | |
64 | 56 | } |
65 | 57 | |
66 | 58 | /** Resets all highlighting in this layer. Helper function for |
@@ -31,7 +31,7 @@ | ||
31 | 31 | * If color is NULL, a standard #FF0000 color (red) is used. |
32 | 32 | * The exact method used for highlighting depends on the renderer. |
33 | 33 | */ |
34 | -void highlight_object(DiaObject *obj, Color *col, Diagram *dia); | |
34 | +void highlight_object(DiaObject *obj, DiaHighlightType type, Diagram *dia); | |
35 | 35 | /** Remove highlighting from an object. |
36 | 36 | */ |
37 | 37 | void highlight_object_off(DiaObject *obj, Diagram *dia); |
@@ -414,11 +414,6 @@ modify_move_already(ModifyTool *tool, DDisplay *ddisp, Point *to) | ||
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
417 | -/** Used for highlighting mainpoint connections. */ | |
418 | -static Color mainpoint_color = { 1.0, 0.8, 0.0 }; | |
419 | -/** Used for highlighting normal connections. */ | |
420 | -static Color cp_color = { 1.0, 0.0, 0.0 }; | |
421 | - | |
422 | 417 | static void |
423 | 418 | modify_motion(ModifyTool *tool, GdkEventMotion *event, |
424 | 419 | DDisplay *ddisp) |
@@ -535,14 +530,14 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event, | ||
535 | 530 | connectionpoint = |
536 | 531 | object_find_connectpoint_display(ddisp, &to, tool->object, TRUE); |
537 | 532 | if (connectionpoint != NULL) { |
538 | - Color *hi_color; | |
533 | + DiaHighlightType type; | |
539 | 534 | to = connectionpoint->pos; |
540 | 535 | if (connectionpoint->flags & CP_FLAGS_MAIN) { |
541 | - hi_color = &mainpoint_color; | |
536 | + type = DIA_HIGHLIGHT_CONNECTIONPOINT_MAIN; | |
542 | 537 | } else { |
543 | - hi_color = &cp_color; | |
538 | + type = DIA_HIGHLIGHT_CONNECTIONPOINT; | |
544 | 539 | } |
545 | - highlight_object(connectionpoint->object, hi_color, ddisp->diagram); | |
540 | + highlight_object(connectionpoint->object, type, ddisp->diagram); | |
546 | 541 | ddisplay_set_all_cursor(get_cursor(CURSOR_CONNECT)); |
547 | 542 | } |
548 | 543 | } |
@@ -35,7 +35,7 @@ object_add_updates(DiaObject *obj, Diagram *dia) | ||
35 | 35 | int i; |
36 | 36 | |
37 | 37 | /* Bounding box */ |
38 | - if (obj->highlight_color != NULL) { | |
38 | + if (data_object_get_highlight(dia->data,obj) != DIA_HIGHLIGHT_NONE) { | |
39 | 39 | diagram_add_update_with_border(dia, &obj->bounding_box, 5); |
40 | 40 | } else { |
41 | 41 | diagram_add_update(dia, dia_object_get_enclosing_box (obj)); |
@@ -23,10 +23,20 @@ | ||
23 | 23 | #include <string.h> |
24 | 24 | #include <gdk/gdk.h> |
25 | 25 | |
26 | +#include "object.h" | |
26 | 27 | #include "message.h" |
27 | 28 | #include "render_gdk.h" |
28 | 29 | #include "diagdkrenderer.h" |
29 | 30 | |
31 | + | |
32 | +/** Used for highlighting mainpoint connections. */ | |
33 | +static Color cp_main_color = { 1.0, 0.8, 0.0 }; | |
34 | +/** Used for highlighting normal connections. */ | |
35 | +static Color cp_color = { 1.0, 0.0, 0.0 }; | |
36 | + | |
37 | +static Color text_edit_color = {1.0, 1.0, 0.0 }; | |
38 | + | |
39 | + | |
30 | 40 | static void clip_region_clear(DiaRenderer *renderer); |
31 | 41 | static void clip_region_add_rect(DiaRenderer *renderer, |
32 | 42 | Rectangle *rect); |
@@ -49,6 +59,9 @@ static void set_size (DiaRenderer *renderer, | ||
49 | 59 | static void copy_to_window (DiaRenderer *renderer, |
50 | 60 | gpointer window, |
51 | 61 | int x, int y, int width, int height); |
62 | +static void draw_object_highlighted (DiaRenderer *renderer, | |
63 | + DiaObject *object, | |
64 | + DiaHighlightType type); | |
52 | 65 | |
53 | 66 | static void dia_gdk_renderer_iface_init (DiaInteractiveRendererInterface* iface) |
54 | 67 | { |
@@ -59,6 +72,7 @@ static void dia_gdk_renderer_iface_init (DiaInteractiveRendererInterface* iface) | ||
59 | 72 | iface->fill_pixel_rect = fill_pixel_rect; |
60 | 73 | iface->copy_to_window = copy_to_window; |
61 | 74 | iface->set_size = set_size; |
75 | + iface->draw_object_highlighted = draw_object_highlighted; | |
62 | 76 | } |
63 | 77 | |
64 | 78 | DiaRenderer * |
@@ -246,3 +260,32 @@ fill_pixel_rect(DiaRenderer *object, | ||
246 | 260 | gdk_draw_rectangle (renderer->pixmap, gc, TRUE, |
247 | 261 | x, y, width, height); |
248 | 262 | } |
263 | + | |
264 | +static void | |
265 | +draw_object_highlighted (DiaRenderer *renderer, DiaObject *object, DiaHighlightType type) | |
266 | +{ | |
267 | + DiaGdkRenderer *gdk_rend = DIA_GDK_RENDERER(renderer); | |
268 | + Color *color = NULL; | |
269 | + switch (type) { | |
270 | + case DIA_HIGHLIGHT_CONNECTIONPOINT: | |
271 | + color = &cp_color; | |
272 | + break; | |
273 | + case DIA_HIGHLIGHT_CONNECTIONPOINT_MAIN: | |
274 | + color = &cp_main_color; | |
275 | + break; | |
276 | + case DIA_HIGHLIGHT_TEXT_EDIT: | |
277 | + color = &text_edit_color; | |
278 | + break; | |
279 | + case DIA_HIGHLIGHT_NONE: | |
280 | + color = NULL; | |
281 | + break; | |
282 | + } | |
283 | + if( color ) { | |
284 | + gdk_rend->highlight_color = color; | |
285 | + object->ops->draw(object, renderer); | |
286 | + gdk_rend->highlight_color = NULL; | |
287 | + } | |
288 | + | |
289 | + object->ops->draw(object, renderer); | |
290 | +} | |
291 | + |
@@ -124,14 +124,12 @@ textedit_exit(DDisplay *ddisp) | ||
124 | 124 | static void |
125 | 125 | textedit_begin_edit(DDisplay *ddisp, Focus *focus) |
126 | 126 | { |
127 | - Color *focus_col = color_new_rgb(1.0, 1.0, 0.0); | |
128 | - | |
129 | 127 | g_assert(dia_object_is_selected(focus_get_object(focus))); |
130 | 128 | if (!textedit_mode(ddisp)) { |
131 | 129 | textedit_enter(ddisp); |
132 | 130 | } |
133 | 131 | ddisplay_set_active_focus(ddisp, focus); |
134 | - highlight_object(focus->obj, focus_col, ddisp->diagram); | |
132 | + highlight_object(focus->obj, DIA_HIGHLIGHT_TEXT_EDIT, ddisp->diagram); | |
135 | 133 | object_add_updates(focus->obj, ddisp->diagram); |
136 | 134 | /* Undo not quite ready yet. |
137 | 135 | undo_push_change(ddisp->diagram->undo, text_edit_create_change(focus->text)); |
@@ -46,6 +46,7 @@ | ||
46 | 46 | #include <pango/pangoft2.h> |
47 | 47 | #endif |
48 | 48 | |
49 | + | |
49 | 50 | static int get_width_pixels (DiaRenderer *); |
50 | 51 | static int get_height_pixels (DiaRenderer *); |
51 | 52 |
@@ -1056,16 +1057,10 @@ fill_rounded_rect (DiaRenderer *self, | ||
1056 | 1057 | fill_rect (self, ul_corner, lr_corner, color); |
1057 | 1058 | } |
1058 | 1059 | |
1060 | + | |
1059 | 1061 | static void |
1060 | 1062 | draw_object (DiaRenderer *renderer, DiaObject *object) |
1061 | 1063 | { |
1062 | - if (renderer->is_interactive && | |
1063 | - object->highlight_color != NULL) { | |
1064 | - DiaGdkRenderer *gdk_rend = DIA_GDK_RENDERER(renderer); | |
1065 | - gdk_rend->highlight_color = object->highlight_color; | |
1066 | - object->ops->draw(object, renderer); | |
1067 | - gdk_rend->highlight_color = NULL; | |
1068 | - } | |
1069 | 1064 | object->ops->draw(object, renderer); |
1070 | 1065 | } |
1071 | 1066 |
@@ -45,6 +45,11 @@ enum { | ||
45 | 45 | LAST_SIGNAL |
46 | 46 | }; |
47 | 47 | |
48 | +typedef struct { | |
49 | + DiaObject *obj; | |
50 | + DiaHighlightType type; | |
51 | +} ObjectHighlight; | |
52 | + | |
48 | 53 | static guint diagram_data_signals[LAST_SIGNAL] = { 0, }; |
49 | 54 | |
50 | 55 | static gpointer parent_class = NULL; |
@@ -117,6 +122,8 @@ diagram_data_init(DiagramData *data) | ||
117 | 122 | |
118 | 123 | data->selected_count_private = 0; |
119 | 124 | data->selected = NULL; |
125 | + | |
126 | + data->highlighted = NULL; | |
120 | 127 | |
121 | 128 | data->is_compressed = compress; /* Overridden by doc */ |
122 | 129 |
@@ -327,6 +334,53 @@ data_delete_layer(DiagramData *data, Layer *layer) | ||
327 | 334 | } |
328 | 335 | } |
329 | 336 | |
337 | +static ObjectHighlight * | |
338 | +find_object_highlight(GList *list, DiaObject *obj) | |
339 | +{ | |
340 | + ObjectHighlight *oh=NULL; | |
341 | + while(list) { | |
342 | + oh = (ObjectHighlight*)list->data; | |
343 | + if (oh && oh->obj == obj) { | |
344 | + return oh; | |
345 | + } | |
346 | + list = g_list_next(list); | |
347 | + } | |
348 | + return NULL; | |
349 | +} | |
350 | + | |
351 | +void | |
352 | +data_highlight_add(DiagramData *data, DiaObject *obj, DiaHighlightType type) | |
353 | +{ | |
354 | + ObjectHighlight *oh; | |
355 | + if (find_object_highlight (data->highlighted, obj)) | |
356 | + return; /* should this be an error?`*/ | |
357 | + oh = g_malloc(sizeof(ObjectHighlight)); | |
358 | + oh->obj = obj; | |
359 | + oh->type = type; | |
360 | + data->highlighted = g_list_prepend(data->highlighted, oh); | |
361 | +} | |
362 | + | |
363 | +void | |
364 | +data_highlight_remove(DiagramData *data, DiaObject *obj) | |
365 | +{ | |
366 | + ObjectHighlight *oh; | |
367 | + if (!(oh = find_object_highlight (data->highlighted, obj))) | |
368 | + return; /* should this be an error?`*/ | |
369 | + data->highlighted = g_list_remove(data->highlighted, oh); | |
370 | + g_free(oh); | |
371 | +} | |
372 | + | |
373 | +DiaHighlightType | |
374 | +data_object_get_highlight(DiagramData *data, DiaObject *obj) | |
375 | +{ | |
376 | + ObjectHighlight *oh; | |
377 | + DiaHighlightType type = DIA_HIGHLIGHT_NONE; | |
378 | + if (oh = find_object_highlight (data->highlighted, obj)) { | |
379 | + type = oh->type; | |
380 | + } | |
381 | + return type; | |
382 | +} | |
383 | + | |
330 | 384 | /** Select an object in a diagram. Note that this does not unselect other |
331 | 385 | * objects currently selected in the diagram. |
332 | 386 | * @param data The diagram to select in. |
@@ -82,6 +82,9 @@ struct _DiagramData { | ||
82 | 82 | /** The focus (from text_edits) that's currently being edited, if any. |
83 | 83 | * Updated by focus.c */ |
84 | 84 | Focus *active_text_edit; |
85 | + | |
86 | + GList *highlighted; /*!< List of objects that are highlighted */ | |
87 | + | |
85 | 88 | }; |
86 | 89 | |
87 | 90 | /** |
@@ -120,6 +123,13 @@ struct _Layer { | ||
120 | 123 | layer_get_parent_diagram() */ |
121 | 124 | }; |
122 | 125 | |
126 | +typedef enum { | |
127 | + DIA_HIGHLIGHT_NONE, | |
128 | + DIA_HIGHLIGHT_CONNECTIONPOINT, | |
129 | + DIA_HIGHLIGHT_CONNECTIONPOINT_MAIN, | |
130 | + DIA_HIGHLIGHT_TEXT_EDIT | |
131 | +} DiaHighlightType; | |
132 | + | |
123 | 133 | Layer *new_layer (char *name, DiagramData *parent); |
124 | 134 | void layer_destroy(Layer *layer); |
125 | 135 |
@@ -134,6 +144,10 @@ int data_layer_get_index (const DiagramData *data, const Layer *layer); | ||
134 | 144 | int data_layer_count(const DiagramData *data); |
135 | 145 | Layer *data_layer_get_nth (const DiagramData *data, guint index); |
136 | 146 | |
147 | +void data_highlight_add(DiagramData *data, DiaObject *obj, DiaHighlightType type); | |
148 | +void data_highlight_remove(DiagramData *data, DiaObject *obj); | |
149 | +DiaHighlightType data_object_get_highlight(DiagramData *data, DiaObject *obj); | |
150 | + | |
137 | 151 | void data_select(DiagramData *data, DiaObject *obj); |
138 | 152 | void data_unselect(DiagramData *data, DiaObject *obj); |
139 | 153 | void data_remove_all_selected(DiagramData *data); |
@@ -33,6 +33,7 @@ dia_interactive_renderer_iface_init (DiaInteractiveRendererInterface *iface) | ||
33 | 33 | iface->fill_pixel_rect = NULL; |
34 | 34 | iface->copy_to_window = NULL; |
35 | 35 | iface->set_size = NULL; |
36 | + iface->draw_object_highlighted = NULL; | |
36 | 37 | } |
37 | 38 | |
38 | 39 | GType |
@@ -27,6 +27,8 @@ | ||
27 | 27 | #include "geometry.h" |
28 | 28 | #include "font.h" /* not strictly needed by this header, but needed in almost any plug-in/ */ |
29 | 29 | |
30 | +#include "diagramdata.h" | |
31 | + | |
30 | 32 | G_BEGIN_DECLS |
31 | 33 | |
32 | 34 | /*! GObject boiler plate, create runtime information */ |
@@ -289,6 +291,10 @@ struct _DiaInteractiveRendererInterface | ||
289 | 291 | void (*copy_to_window) (DiaRenderer *renderer, |
290 | 292 | gpointer window, |
291 | 293 | int x, int y, int width, int height); |
294 | + | |
295 | + void (*draw_object_highlighted) (DiaRenderer *renderer, | |
296 | + DiaObject *object, | |
297 | + DiaHighlightType type); | |
292 | 298 | }; |
293 | 299 | |
294 | 300 | GType dia_interactive_renderer_interface_get_type (void) G_GNUC_CONST; |
@@ -150,6 +150,9 @@ EXPORTS | ||
150 | 150 | data_foreach_object |
151 | 151 | data_get_sorted_selected |
152 | 152 | data_get_sorted_selected_remove |
153 | + data_highlight_add | |
154 | + data_highlight_remove | |
155 | + data_object_get_highlight | |
153 | 156 | data_int |
154 | 157 | data_layer_count |
155 | 158 | data_layer_get_index |
@@ -489,9 +489,6 @@ struct _DiaObject { | ||
489 | 489 | GList *children; /*!< In case this object is a parent of other object the children are listed here */ |
490 | 490 | gint flags; /*!< Various flags that can be set for this object, see defines above */ |
491 | 491 | |
492 | - Color *highlight_color; /*!< The color that this object is currently | |
493 | - highlighted with, or NULL if it is not | |
494 | - highlighted. */ | |
495 | 492 | /** The area that contains all parts rendered interactively, so includes |
496 | 493 | * handles, bezier controllers etc. Despite historical difference, this |
497 | 494 | * should not be accessed directly, but through dia_object_get_bounding_box(). |
@@ -48,7 +48,7 @@ G_BEGIN_DECLS | ||
48 | 48 | * The list is by no means complete. If in doubt about your change |
49 | 49 | * please ask on dia-list or alternative increment ;-) --hb |
50 | 50 | */ |
51 | -#define DIA_PLUGIN_API_VERSION 13 | |
51 | +#define DIA_PLUGIN_API_VERSION 14 | |
52 | 52 | |
53 | 53 | typedef enum { |
54 | 54 | DIA_PLUGIN_INIT_OK, |
@@ -1329,13 +1329,6 @@ draw_image(DiaRenderer *self, | ||
1329 | 1329 | static void |
1330 | 1330 | draw_object (DiaRenderer *renderer, DiaObject *object) |
1331 | 1331 | { |
1332 | - if (renderer->is_interactive && | |
1333 | - object->highlight_color != NULL) { | |
1334 | - DiaLibartRenderer *libart_rend = DIA_LIBART_RENDERER(renderer); | |
1335 | - libart_rend->highlight_color = object->highlight_color; | |
1336 | - object->ops->draw(object, renderer); | |
1337 | - libart_rend->highlight_color = NULL; | |
1338 | - } | |
1339 | 1332 | object->ops->draw(object, renderer); |
1340 | 1333 | } |
1341 | 1334 |
@@ -26,11 +26,20 @@ | ||
26 | 26 | |
27 | 27 | #ifdef HAVE_LIBART |
28 | 28 | |
29 | +#include "object.h" | |
29 | 30 | #include "dialibartrenderer.h" |
30 | 31 | #include <libart_lgpl/art_rgb.h> |
31 | 32 | #include "font.h" |
32 | 33 | #include "color.h" |
33 | 34 | |
35 | +/** Used for highlighting mainpoint connections. */ | |
36 | +static Color cp_main_color = { 1.0, 0.8, 0.0 }; | |
37 | +/** Used for highlighting normal connections. */ | |
38 | +static Color cp_color = { 1.0, 0.0, 0.0 }; | |
39 | + | |
40 | +static Color text_edit_color = {1.0, 1.0, 0.0 }; | |
41 | + | |
42 | + | |
34 | 43 | static void clip_region_clear(DiaRenderer *self); |
35 | 44 | static void clip_region_add_rect(DiaRenderer *self, |
36 | 45 | Rectangle *rect); |
@@ -51,6 +60,9 @@ static void set_size(DiaRenderer *self, gpointer window, | ||
51 | 60 | int width, int height); |
52 | 61 | static void copy_to_window (DiaRenderer *self, gpointer window, |
53 | 62 | int x, int y, int width, int height); |
63 | +static void draw_object_highlighted (DiaRenderer *renderer, | |
64 | + DiaObject *object, | |
65 | + DiaHighlightType type); | |
54 | 66 | |
55 | 67 | |
56 | 68 | void |
@@ -63,6 +75,7 @@ dia_libart_renderer_iface_init (DiaInteractiveRendererInterface* iface) | ||
63 | 75 | iface->fill_pixel_rect = fill_pixel_rect; |
64 | 76 | iface->copy_to_window = copy_to_window; |
65 | 77 | iface->set_size = set_size; |
78 | + iface->draw_object_highlighted = draw_object_highlighted; | |
66 | 79 | } |
67 | 80 | |
68 | 81 |
@@ -460,6 +473,35 @@ fill_pixel_rect(DiaRenderer *self, | ||
460 | 473 | } |
461 | 474 | } |
462 | 475 | |
476 | + | |
477 | +static void | |
478 | +draw_object_highlighted (DiaRenderer *renderer, DiaObject *object, DiaHighlightType type) | |
479 | +{ | |
480 | + DiaLibartRenderer *libart_rend = DIA_LIBART_RENDERER(renderer); | |
481 | + Color *color = NULL; | |
482 | + switch (type) { | |
483 | + case DIA_HIGHLIGHT_CONNECTIONPOINT: | |
484 | + color = &cp_color; | |
485 | + break; | |
486 | + case DIA_HIGHLIGHT_CONNECTIONPOINT_MAIN: | |
487 | + color = &cp_main_color; | |
488 | + break; | |
489 | + case DIA_HIGHLIGHT_TEXT_EDIT: | |
490 | + color = &text_edit_color; | |
491 | + break; | |
492 | + case DIA_HIGHLIGHT_NONE: | |
493 | + color = NULL; | |
494 | + break; | |
495 | + } | |
496 | + if( color ) { | |
497 | + libart_rend->highlight_color = color; | |
498 | + object->ops->draw(object, renderer); | |
499 | + libart_rend->highlight_color = NULL; | |
500 | + } | |
501 | + | |
502 | + object->ops->draw(object, renderer); | |
503 | +} | |
504 | + | |
463 | 505 | #else |
464 | 506 | |
465 | 507 | DiaRenderer * |