From 4b852b3bade276506da19dddcad943e7e5b3ad46 Mon Sep 17 00:00:00 2001 From: bryce Date: Sat, 18 Nov 2006 23:46:55 +0000 Subject: [PATCH] Cleanup work for markers - adding some documentation to areas of code dealing with markers, and removing some marker debug stuff. --- src/display/nr-arena-shape.cpp | 29 +++++++++++++++++++++++++++++ src/doxygen-main.cpp | 2 +- src/sp-shape.cpp | 4 ---- src/style.cpp | 7 ------- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 8c4b42577..d3f04a075 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -92,6 +92,10 @@ nr_arena_shape_class_init(NRArenaShapeClass *klass) item_class->pick = nr_arena_shape_pick; } +/** + * Initializes the arena shape, setting all parameters to null, 0, false, + * or other defaults + */ static void nr_arena_shape_init(NRArenaShape *shape) { @@ -138,6 +142,9 @@ nr_arena_shape_finalize(NRObject *object) ((NRObjectClass *) shape_parent_class)->finalize(object); } +/** + * Retrieves the markers from the item + */ static NRArenaItem * nr_arena_shape_children(NRArenaItem *item) { @@ -146,6 +153,11 @@ nr_arena_shape_children(NRArenaItem *item) return shape->markers; } +/** + * Attaches child to item, and if ref is not NULL, sets it and ref->next as + * the prev and next items. If ref is NULL, then it sets the item's markers + * as the next items. + */ static void nr_arena_shape_add_child(NRArenaItem *item, NRArenaItem *child, NRArenaItem *ref) { @@ -160,6 +172,10 @@ nr_arena_shape_add_child(NRArenaItem *item, NRArenaItem *child, NRArenaItem *ref nr_arena_item_request_update(item, NR_ARENA_ITEM_STATE_ALL, FALSE); } +/** + * Removes child from the shape. If there are no prev items in + * the child, it sets items' markers to the next item in the child. + */ static void nr_arena_shape_remove_child(NRArenaItem *item, NRArenaItem *child) { @@ -174,6 +190,12 @@ nr_arena_shape_remove_child(NRArenaItem *item, NRArenaItem *child) nr_arena_item_request_update(item, NR_ARENA_ITEM_STATE_ALL, FALSE); } +/** + * Detaches child from item, and if there are no previous items in child, it + * sets item's markers to the child. It then attaches the child back onto the item. + * If ref is null, it sets the markers to be the next item, otherwise it uses + * the next/prev items in ref. + */ static void nr_arena_shape_set_child_position(NRArenaItem *item, NRArenaItem *child, NRArenaItem *ref) { @@ -198,6 +220,9 @@ void nr_arena_shape_update_stroke(NRArenaShape *shape, NRGC* gc, NRRectL *area); void nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool force_shape = false); void nr_arena_shape_add_bboxes(NRArenaShape* shape,NRRect &bbox); +/** + * Updates the arena shape 'item' and all of its children, including the markers. + */ static guint nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, guint reset) { @@ -687,6 +712,10 @@ nr_arena_shape_add_bboxes(NRArenaShape* shape, NRRect &bbox) } } } + +/** + * Renders the item. Markers are just composed into the parent buffer. + */ static unsigned int nr_arena_shape_render(NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags) { diff --git a/src/doxygen-main.cpp b/src/doxygen-main.cpp index f6d5e81f8..679706288 100644 --- a/src/doxygen-main.cpp +++ b/src/doxygen-main.cpp @@ -82,7 +82,7 @@ * - SPRoot [\ref sp-root.cpp, \ref sp-root.h] * - SPSymbol [\ref sp-symbol.cpp, \ref sp-symbol.h] * - SPImage [\ref sp-image.cpp, \ref sp-image.h] - * - SPShape [\ref sp-shape.cpp, \ref sp-shape.h, \ref marker-status.cpp] + * - SPShape [\ref sp-shape.cpp, \ref sp-shape.h] * - SPGenericEllipse [\ref sp-ellipse.cpp, \ref sp-ellipse.h] * - SPArc * - SPCircle diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index f72a0da34..53f161470 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -31,7 +31,6 @@ #include "display/nr-arena-shape.h" #include "print.h" #include "document.h" -#include "marker-status.h" #include "style.h" #include "sp-marker.h" #include "sp-path.h" @@ -559,8 +558,6 @@ sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai) { SPStyle *style = ((SPObject *) shape)->style; - marker_status("sp_shape_update_marker_view: Updating views of markers"); - for (int i = SP_MARKER_LOC_START; i < SP_MARKER_LOC_QTY; i++) { if (shape->marker[i] == NULL) { continue; @@ -861,7 +858,6 @@ sp_shape_marker_release (SPObject *marker, SPShape *shape) item = (SPItem *) shape; - marker_status("sp_shape_marker_release: Releasing markers"); for (i = SP_MARKER_LOC_START; i < SP_MARKER_LOC_QTY; i++) { if (marker == shape->marker[i]) { SPItemView *v; diff --git a/src/style.cpp b/src/style.cpp index 8530e2bd4..3fcc5a338 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -30,7 +30,6 @@ #include "attributes.h" #include "document.h" #include "extract-uri.h" -#include "marker-status.h" #include "uri-references.h" #include "sp-paint-server.h" #include "streq.h" @@ -990,7 +989,6 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) case SP_PROP_MARKER: /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ /* style->marker[SP_MARKER_LOC] = g_quark_from_string(val); */ - marker_status("Setting SP_PROP_MARKER"); if (!style->marker[SP_MARKER_LOC].set) { g_free(style->marker[SP_MARKER_LOC].value); style->marker[SP_MARKER_LOC].value = g_strdup(val); @@ -1001,7 +999,6 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) case SP_PROP_MARKER_START: /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ - marker_status("Setting SP_PROP_MARKER_START"); if (!style->marker[SP_MARKER_LOC_START].set) { g_free(style->marker[SP_MARKER_LOC_START].value); style->marker[SP_MARKER_LOC_START].value = g_strdup(val); @@ -1011,7 +1008,6 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) break; case SP_PROP_MARKER_MID: /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ - marker_status("Setting SP_PROP_MARKER_MID"); if (!style->marker[SP_MARKER_LOC_MID].set) { g_free(style->marker[SP_MARKER_LOC_MID].value); style->marker[SP_MARKER_LOC_MID].value = g_strdup(val); @@ -1021,7 +1017,6 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) break; case SP_PROP_MARKER_END: /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ - marker_status("Setting SP_PROP_MARKER_END"); if (!style->marker[SP_MARKER_LOC_END].set) { g_free(style->marker[SP_MARKER_LOC_END].value); style->marker[SP_MARKER_LOC_END].value = g_strdup(val); @@ -2238,7 +2233,6 @@ sp_style_write_string(SPStyle const *const style, guint const flags) p += sp_style_write_ienum(p, c + BMAX - p, "stroke-linecap", enum_stroke_linecap, &style->stroke_linecap, NULL, flags); p += sp_style_write_ienum(p, c + BMAX - p, "stroke-linejoin", enum_stroke_linejoin, &style->stroke_linejoin, NULL, flags); - marker_status("sp_style_write_string: Writing markers"); if (style->marker[SP_MARKER_LOC].set) { p += g_snprintf(p, c + BMAX - p, "marker:%s;", style->marker[SP_MARKER_LOC].value); } else if (flags == SP_STYLE_FLAG_ALWAYS) { @@ -2403,7 +2397,6 @@ sp_style_write_difference(SPStyle const *const from, SPStyle const *const to) p += sp_style_write_iscale24(p, c + BMAX - p, "stroke-opacity", &from->stroke_opacity, &to->stroke_opacity, SP_STYLE_FLAG_IFDIFF); /* markers */ - marker_status("sp_style_write_difference: Writing markers"); if (from->marker[SP_MARKER_LOC].value != NULL) { p += g_snprintf(p, c + BMAX - p, "marker:%s;", from->marker[SP_MARKER_LOC].value); } -- 2.30.2