From 3aced935196342faa186d2211738d002809e8923 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Tue, 3 Mar 2009 21:51:55 +0000 Subject: [PATCH] add mouse-over helperpath for rects --- src/nodepath.cpp | 4 ++++ src/sp-rect.cpp | 9 +++++++++ src/sp-rect.h | 2 ++ 3 files changed, 15 insertions(+) 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 #include #include +#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); -- 2.30.2