diff options
| author | Felipe Corr??a da Silva Sanches <juca@members.fsf.org> | 2011-05-18 20:04:33 +0000 |
|---|---|---|
| committer | Felipe C. da S. Sanches <juca@members.fsf.org> | 2011-05-18 20:04:33 +0000 |
| commit | 7239afff554c14388dd6e930d903beb7bbd8b2ca (patch) | |
| tree | 84ca0c787e616da36bef10425cc04c3f633a6a37 /src/sp-guide.cpp | |
| parent | Made dependencies explicit and bumped versions. (diff) | |
| download | inkscape-7239afff554c14388dd6e930d903beb7bbd8b2ca.tar.gz inkscape-7239afff554c14388dd6e930d903beb7bbd8b2ca.zip | |
Adding inkscape:label parameter to guidelines so that our guidelanes can display labels (we still dont have a user interface, but files with that parameter will render correctly)
(bzr r10209)
Diffstat (limited to 'src/sp-guide.cpp')
| -rw-r--r-- | src/sp-guide.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 7d36df4a3..1e51ee4d5 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -160,6 +160,7 @@ static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML (* ((SPObjectClass *) (parent_class))->build)(object, document, repr); } + object->readAttr( "inkscape:label" ); object->readAttr( "orientation" ); object->readAttr( "position" ); } @@ -183,6 +184,15 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value) SPGuide *guide = SP_GUIDE(object); switch (key) { + case SP_ATTR_INKSCAPE_LABEL: + if (value) { + guide->label = g_strdup(value); + } else { + guide->label = NULL; + } + + sp_guide_set_label(*guide, guide->label, false); + break; case SP_ATTR_ORIENTATION: { if (value && !strcmp(value, "horizontal")) { @@ -291,7 +301,7 @@ sp_guide_create_guides_around_page(SPDesktop *dt) { void SPGuide::showSPGuide(SPCanvasGroup *group, GCallback handler) { - SPCanvasItem *item = sp_guideline_new(group, point_on_line, normal_to_line); + SPCanvasItem *item = sp_guideline_new(group, label, point_on_line, normal_to_line); sp_guideline_set_color(SP_GUIDELINE(item), color); g_signal_connect(G_OBJECT(item), "event", G_CALLBACK(handler), this); @@ -402,6 +412,19 @@ void sp_guide_set_normal(SPGuide &guide, Geom::Point const normal_to_line, bool */ } +void sp_guide_set_label(SPGuide &guide, char* label, bool const commit) +{ + g_assert(SP_IS_GUIDE(&guide)); + if (guide.views){ + sp_guideline_set_label(SP_GUIDELINE(guide.views->data), label); + } + + if (commit){ + //XML Tree being used directly while it shouldn't be + guide.getRepr()->setAttribute("label", label); + } +} + /** * Returns a human-readable description of the guideline for use in dialog boxes and status bar. * If verbose is false, only positioning information is included (useful for dialogs). |
