summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3bfdbe9)
raw | patch | inline | side by side (parent: 3bfdbe9)
author | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 18 Aug 2008 00:42:15 +0000 (00:42 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 18 Aug 2008 00:42:15 +0000 (00:42 +0000) |
src/lpe-tool-context.cpp | patch | blob | history | |
src/lpe-tool-context.h | patch | blob | history |
index f9db815bcf5734928dd3e304ced4eb6b2e57f025..f9fc3ad71b0487967a1b4adc3e9fe87f4bbd8f85 100644 (file)
--- a/src/lpe-tool-context.cpp
+++ b/src/lpe-tool-context.cpp
#include "shape-editor.h"
#include "selection.h"
#include "desktop-handles.h"
+#include "document.h"
+#include "display/curve.h"
+#include "display/canvas-bpath.h"
#include "lpe-tool-context.h"
lc->hot_x = 7;
lc->hot_y = 7;
+ lc->canvas_bbox = NULL;
+
new (&lc->sel_changed_connection) sigc::connection();
}
SPLPEToolContext *lc = SP_LPETOOL_CONTEXT(object);
delete lc->shape_editor;
+ if (lc->canvas_bbox) {
+ gtk_object_destroy(GTK_OBJECT(lc->canvas_bbox));
+ lc->canvas_bbox = NULL;
+ }
+
lc->sel_changed_connection.disconnect();
lc->sel_changed_connection.~connection();
//lc->my_nc = new NodeContextCpp(lc->desktop, lc->prefs_repr, lc->key);
lc->shape_editor = new ShapeEditor(ec->desktop);
+ lpetool_context_reset_limiting_bbox(lc);
+
// TODO temp force:
ec->enableSelectionCue();
@@ -286,6 +298,27 @@ sp_lpetool_context_root_handler(SPEventContext *event_context, GdkEvent *event)
return ret;
}
+/*
+ * Reads the limiting bounding box from preferences and draws it on the screen
+ */
+// TODO: Note that currently the bbox is not user-settable; we simply use the page borders
+void
+lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc)
+{
+ 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::Rect rect(A, B);
+ SPCurve *curve = SPCurve::new_from_rect(rect);
+
+ lc->canvas_bbox = sp_canvas_bpath_new (sp_desktop_controls(lc->desktop), curve);
+ sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(lc->canvas_bbox), 0x0000ffff, 0.8, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT, 5, 5);
+}
+
/*
Local Variables:
mode:c++
diff --git a/src/lpe-tool-context.h b/src/lpe-tool-context.h
index 80906f1671dd23e757a7848b877ec356578a6589..86976442f05d1b064653da0f1110bbe7474ce65a 100644 (file)
--- a/src/lpe-tool-context.h
+++ b/src/lpe-tool-context.h
struct SPLPEToolContext : public SPPenContext {
ShapeEditor* shape_editor;
+ SPCanvasItem *canvas_bbox;
+
sigc::connection sel_changed_connection;
};
struct SPLPEToolContextClass : public SPEventContextClass{};
+void lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc);
+
GType sp_lpetool_context_get_type(void);
#endif // SP_LPETOOL_CONTEXT_H_SEEN