summaryrefslogtreecommitdiffstats
path: root/src/ui/control-manager.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2012-05-09 07:54:48 +0000
committerJon A. Cruz <jon@joncruz.org>2012-05-09 07:54:48 +0000
commit0459094999e0298341ecad677464043528d1036f (patch)
treeb3645de4ef972c8a65910c4890bc6e2d55fdbab9 /src/ui/control-manager.cpp
parentUnified variable names as scoping now makes the code safe. (diff)
downloadinkscape-0459094999e0298341ecad677464043528d1036f.tar.gz
inkscape-0459094999e0298341ecad677464043528d1036f.zip
Centralized line creation and enhanced visibility.
(bzr r11350)
Diffstat (limited to 'src/ui/control-manager.cpp')
-rw-r--r--src/ui/control-manager.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp
index ea9cf175d..d19c4a877 100644
--- a/src/ui/control-manager.cpp
+++ b/src/ui/control-manager.cpp
@@ -16,6 +16,7 @@
#include <glib-object.h>
#include "display/sodipodi-ctrl.h" // for SP_TYPE_CTRL
+#include "display/sp-ctrlline.h"
#include "display/sp-ctrlpoint.h"
#include "preferences.h"
@@ -28,6 +29,11 @@ std::map<Inkscape::ControlType, std::vector<int> > sizeTable;
#define FILL_COLOR_NORMAL 0xffffff7f
#define FILL_COLOR_MOUSEOVER 0xff0000ff
+// Default color for line:
+#define LINE_COLOR_PRIMARY 0x0000ff7f
+#define LINE_COLOR_SECONDARY 0xff00007f
+#define LINE_COLOR_TERTIARY 0xffff007f
+
namespace Inkscape {
class ControlManagerImpl
@@ -231,6 +237,27 @@ SPCanvasItem *ControlManager::createControl(SPCanvasGroup *parent, ControlType t
return item;
}
+SPCtrlLine *ControlManager::createControlLine(SPCanvasGroup *parent, CtrlLineType type)
+{
+ SPCtrlLine *line = SP_CTRLLINE(sp_canvas_item_new(parent, SP_TYPE_CTRLLINE, NULL));
+ if (line) {
+ line->ctrlType = CTRL_TYPE_LINE;
+
+ line->setRgba32((type == CTLINE_PRIMARY) ? LINE_COLOR_PRIMARY :
+ (type == CTLINE_SECONDARY) ? LINE_COLOR_SECONDARY : LINE_COLOR_TERTIARY);
+ }
+ return line;
+}
+
+SPCtrlLine *ControlManager::createControlLine(SPCanvasGroup *parent, Geom::Point const &p1, Geom::Point const &p2, CtrlLineType type)
+{
+ SPCtrlLine *line = createControlLine(parent, type);
+ if (line) {
+ line->setCoords(p1, p2);
+ }
+ return line;
+}
+
void ControlManager::track(SPCanvasItem *item)
{
_impl->track(item);