From 637e36780dacfed78c322064e322f247bd764fd1 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Sat, 18 Jun 2011 05:51:28 -0300 Subject: user interface for selecting colors of guidelines (bzr r10315) --- src/sp-guide.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/sp-guide.cpp') diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 584a6a366..19b64eb1a 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -412,6 +412,23 @@ void sp_guide_set_normal(SPGuide &guide, Geom::Point const normal_to_line, bool */ } +void sp_guide_set_color(SPGuide &guide, const unsigned char r, const unsigned char g, const unsigned char b, bool const commit) +{ + g_assert(SP_IS_GUIDE(&guide)); + guide.color = (r << 24) | (g << 16) | (b << 8) | 0x7f; + + if (guide.views){ + sp_guideline_set_color(SP_GUIDELINE(guide.views->data), guide.color); + } + + if (commit){ + std::ostringstream os; + os << "rgb(" << r << "," << g << "," << b << ")"; + //XML Tree being used directly while it shouldn't be + guide.getRepr()->setAttribute("inkscape:color", os.str().c_str()); + } +} + void sp_guide_set_label(SPGuide &guide, const char* label, bool const commit) { g_assert(SP_IS_GUIDE(&guide)); -- cgit v1.2.3