summaryrefslogtreecommitdiffstats
path: root/src/lpe-tool-context.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-08-18 00:47:13 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-08-18 00:47:13 +0000
commit890556d030ed1c2877f15709807ce5e9178fe793 (patch)
tree320fd56a67afc55dcb98ce129b2c509fd46adf26 /src/lpe-tool-context.cpp
parentSome debugging messages (diff)
downloadinkscape-890556d030ed1c2877f15709807ce5e9178fe793.tar.gz
inkscape-890556d030ed1c2877f15709807ce5e9178fe793.zip
Toggle button in geometry toolbar to set limiting bounding box for LPELineSegment
(bzr r6685)
Diffstat (limited to 'src/lpe-tool-context.cpp')
-rw-r--r--src/lpe-tool-context.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp
index 0b3fb25bf..af92074b0 100644
--- a/src/lpe-tool-context.cpp
+++ b/src/lpe-tool-context.cpp
@@ -374,6 +374,20 @@ lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::Effe
}
}
+void
+lpetool_get_limiting_bbox_corners(SPDocument *document, Geom::Point &A, Geom::Point &B) {
+ Geom::Coord w = sp_document_width(document);
+ Geom::Coord h = sp_document_height(document);
+
+ double ulx = prefs_get_double_attribute ("tools.lpetool", "bbox_upperleftx", 0);
+ double uly = prefs_get_double_attribute ("tools.lpetool", "bbox_upperlefty", 0);
+ double lrx = prefs_get_double_attribute ("tools.lpetool", "bbox_lowerrightx", w);
+ double lry = prefs_get_double_attribute ("tools.lpetool", "bbox_lowerrighty", h);
+
+ A = Geom::Point(ulx, uly);
+ B = Geom::Point(lrx, lry);
+}
+
/*
* Reads the limiting bounding box from preferences and draws it on the screen
*/
@@ -390,11 +404,12 @@ lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc)
return;
SPDocument *document = sp_desktop_document(lc->desktop);
- Geom::Coord w = sp_document_width(document);
- Geom::Coord h = sp_document_height(document);
- Geom::Point A(0,0);
- Geom::Point B(w,h);
+ Geom::Point A, B;
+ lpetool_get_limiting_bbox_corners(document, A, B);
+ NR::Matrix doc2dt(lc->desktop->doc2dt());
+ A *= doc2dt;
+ B *= doc2dt;
Geom::Rect rect(A, B);
SPCurve *curve = SPCurve::new_from_rect(rect);