summaryrefslogtreecommitdiffstats
path: root/src/display/guideline.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2011-05-26 21:17:37 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2011-05-26 21:17:37 +0000
commitd08f8e9ed468767cc64766eb80ea134bb5edb197 (patch)
tree5ef0aa6763dc38420a0479469d4c2c8b352af65d /src/display/guideline.cpp
parentrename "set width" and "units per em" to "Em-size" (diff)
downloadinkscape-d08f8e9ed468767cc64766eb80ea134bb5edb197.tar.gz
inkscape-d08f8e9ed468767cc64766eb80ea134bb5edb197.zip
add entry widget to guideline dialog to change guide's label
(and fix some label xml writing and rendering bugs) (bzr r10234)
Diffstat (limited to 'src/display/guideline.cpp')
-rw-r--r--src/display/guideline.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp
index f0e1c7724..dddf1f30e 100644
--- a/src/display/guideline.cpp
+++ b/src/display/guideline.cpp
@@ -21,6 +21,7 @@
#include "guideline.h"
#include "cairo.h"
#include "inkscape-cairo.h"
+#include "color.h"
static void sp_guideline_class_init(SPGuideLineClass *c);
static void sp_guideline_init(SPGuideLine *guideline);
@@ -112,7 +113,8 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf)
cairo_t* ctx = nr_create_cairo_context_canvasbuf (NULL /*area*/, buf); //this function ignores the "area" parameter
cairo_set_font_size (ctx, 10);
cairo_set_line_width (ctx, 10);
- cairo_set_source_rgb (ctx, 0, 0, 0);
+ /// @todo uh??! why must the order of these arguments be reversed? bgra instead of rgba!
+ cairo_set_source_rgba (ctx, SP_RGBA32_B_F(gl->rgba), SP_RGBA32_G_F(gl->rgba), SP_RGBA32_R_F(gl->rgba), SP_RGBA32_A_F(gl->rgba));
unsigned int const r = NR_RGBA32_R (gl->rgba);
unsigned int const g = NR_RGBA32_G (gl->rgba);
@@ -274,9 +276,12 @@ SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, char* label, Geom::Point p
return item;
}
-void sp_guideline_set_label(SPGuideLine *gl, char* label)
+void sp_guideline_set_label(SPGuideLine *gl, const char* label)
{
- gl->label = label;
+ if (gl->label) {
+ g_free(gl->label);
+ }
+ gl->label = g_strdup(label);
sp_canvas_item_request_update(SP_CANVAS_ITEM (gl));
}