From: cilix42 Date: Sun, 9 Mar 2008 14:49:33 +0000 (+0000) Subject: Move 3D box code out of sp-canvas.cpp X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3d70339a90b4e30cd065dc91f7334fcba9cf7df6;p=inkscape.git Move 3D box code out of sp-canvas.cpp --- diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index e03f7d184..9ee920c1b 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -670,6 +670,14 @@ static void sp_box3d_finish(Box3DContext *bc) bc->extruded = false; } +void sp_box3d_context_update_lines(SPEventContext *ec) { + /* update perspective lines if we are in the 3D box tool (so that infinite ones are shown correctly) */ + if (SP_IS_BOX3D_CONTEXT (ec)) { + Box3DContext *bc = SP_BOX3D_CONTEXT (ec); + bc->_vpdrag->updateLines(); + } +} + /* Local Variables: mode:c++ diff --git a/src/box3d-context.h b/src/box3d-context.h index 1817aa180..38058b1cb 100644 --- a/src/box3d-context.h +++ b/src/box3d-context.h @@ -69,6 +69,8 @@ struct Box3DContextClass { GtkType sp_box3d_context_get_type (void); +void sp_box3d_context_update_lines(SPEventContext *ec); + #endif /* __SP_BOX3D_CONTEXT_H__ */ /* diff --git a/src/desktop.cpp b/src/desktop.cpp index 3ff4bf2f5..f9d17b01a 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -88,6 +88,7 @@ #include "event-log.h" #include "display/canvas-grid.h" #include "widgets/desktop-widget.h" +#include "box3d-context.h" #include "display/sp-canvas.h" @@ -741,6 +742,9 @@ SPDesktop::set_display_area (double x0, double y0, double x1, double y1, double /* Scroll */ sp_canvas_scroll_to (canvas, x0 * newscale - border, y1 * -newscale - border, clear); + /* update perspective lines if we are in the 3D box tool (so that infinite ones are shown correctly) */ + sp_box3d_context_update_lines(event_context); + _widget->updateRulers(); _widget->updateScrollbars(expansion(_d2w)); _widget->updateZoom(); @@ -979,6 +983,9 @@ SPDesktop::scroll_world (double dx, double dy, bool is_scrolling) sp_canvas_scroll_to(canvas, viewbox.min()[NR::X] - dx, viewbox.min()[NR::Y] - dy, FALSE, is_scrolling); + /* update perspective lines if we are in the 3D box tool (so that infinite ones are shown correctly) */ + sp_box3d_context_update_lines(event_context); + _widget->updateRulers(); _widget->updateScrollbars(expansion(_d2w)); } diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index b042f0d68..86b1e9eab 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -34,7 +34,6 @@ #include #include #include "prefs-utils.h" -#include "box3d-context.h" #include "inkscape.h" #include "sodipodi-ctrlrect.h" #if ENABLE_LCMS @@ -2117,15 +2116,6 @@ sp_canvas_scroll_to (SPCanvas *canvas, double cx, double cy, unsigned int clear, } else { // scrolling as part of zoom; do nothing here - the next do_update will perform full redraw } - - /* update perspective lines if we are in the 3D box tool (so that infinite ones are shown correctly) */ - SPEventContext *ec = inkscape_active_event_context(); - if (SP_IS_BOX3D_CONTEXT (ec)) { - // We could avoid redraw during panning by checking the status of is_scrolling, but this is - // neither faster nor does it get rid of artefacts, so we update PLs unconditionally - Box3DContext *bc = SP_BOX3D_CONTEXT (ec); - bc->_vpdrag->updateLines(); - } } /** diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index bd329e336..b8e01eb6c 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -59,6 +59,7 @@ #include "ege-color-prof-tracker.h" #include "color-profile-fns.h" #include "xml/node-observer.h" +#include "box3d-context.h" #if defined (SOLARIS_2_8) #include "round.h" @@ -1425,6 +1426,9 @@ sp_desktop_widget_adjustment_value_changed (GtkAdjustment */*adj*/, SPDesktopWid sp_canvas_scroll_to (dtw->canvas, dtw->hadj->value, dtw->vadj->value, FALSE); sp_desktop_widget_update_rulers (dtw); + /* update perspective lines if we are in the 3D box tool (so that infinite ones are shown correctly) */ + sp_box3d_context_update_lines(dtw->desktop->event_context); + dtw->update = 0; }