summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2009-03-03 21:51:55 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2009-03-03 21:51:55 +0000
commit6d4dc88ce489961bd3c4f810bf355901ffddeeed (patch)
tree2f0efc6e9113471edb80214c3c45b29f66f378d5
parentimprove helperpath generation on mouse-over (diff)
downloadinkscape-6d4dc88ce489961bd3c4f810bf355901ffddeeed.tar.gz
inkscape-6d4dc88ce489961bd3c4f810bf355901ffddeeed.zip
add mouse-over helperpath for rects
(bzr r7407)
-rw-r--r--src/nodepath.cpp4
-rw-r--r--src/sp-rect.cpp9
-rw-r--r--src/sp-rect.h2
3 files changed, 15 insertions, 0 deletions
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index dfd06b660..a880baba2 100644
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -45,6 +45,7 @@
#include "preferences.h"
#include "sp-metrics.h"
#include "sp-path.h"
+#include "sp-rect.h"
#include "libnr/nr-matrix-ops.h"
#include "svg/svg.h"
#include "verbs.h"
@@ -5059,6 +5060,9 @@ sp_nodepath_generate_helperpath(SPDesktop *desktop, SPItem *item) {
SPCurve *curve = NULL;
if (SP_IS_PATH(item)) {
curve = sp_path_get_curve_for_edit(SP_PATH(item));
+ } else if (SP_IS_RECT(item)) {
+ Geom::Rect rect = sp_rect_get_rect(SP_RECT(item));
+ curve = SPCurve::new_from_rect(rect);
} else {
g_warning ("-----> sp_nodepath_generate_helperpath(SPDesktop *desktop, SPItem *item): TODO: generate the helper path for this item type!\n");
return NULL;
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index f59a02853..aa026abb3 100644
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
@@ -19,6 +19,7 @@
#include <display/curve.h>
#include <libnr/nr-matrix-ops.h>
#include <libnr/nr-matrix-fns.h>
+#include <2geom/rect.h>
#include "inkscape.h"
#include "document.h"
@@ -458,6 +459,14 @@ sp_rect_get_visible_ry(SPRect *rect)
SP_ITEM(rect)->transform);
}
+Geom::Rect
+sp_rect_get_rect (SPRect *rect)
+{
+ Geom::Point p0 = Geom::Point(rect->x.computed, rect->y.computed);
+ Geom::Point p2 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed);
+ return Geom::Rect(p0, p2);
+}
+
void
sp_rect_compensate_rxry(SPRect *rect, Geom::Matrix xform)
{
diff --git a/src/sp-rect.h b/src/sp-rect.h
index 5c6fafab5..9a97bc217 100644
--- a/src/sp-rect.h
+++ b/src/sp-rect.h
@@ -15,6 +15,7 @@
#include "svg/svg-length.h"
#include "sp-shape.h"
+#include <2geom/forward.h>
@@ -54,6 +55,7 @@ void sp_rect_set_visible_rx (SPRect *rect, gdouble rx);
void sp_rect_set_visible_ry (SPRect *rect, gdouble ry);
gdouble sp_rect_get_visible_rx (SPRect *rect);
gdouble sp_rect_get_visible_ry (SPRect *rect);
+Geom::Rect sp_rect_get_rect (SPRect *rect);
void sp_rect_set_visible_width (SPRect *rect, gdouble rx);
void sp_rect_set_visible_height (SPRect *rect, gdouble ry);