diff --git a/src/desktop.cpp b/src/desktop.cpp
index d2547f5a60895fce146a486dcc1a286285d646d0..f9d17b01ad6bbc5e938c8c9c5df0e2b8007427ab 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
* Copyright (C) 2007 Jon A. Cruz
- * Copyright (C) 2006-2007 Johan Engelen
+ * Copyright (C) 2006-2008 Johan Engelen
* Copyright (C) 2006 John Bintz
* Copyright (C) 2004 MenTaLguY
* Copyright (C) 1999-2002 Lauris Kaplinski
#include "display/gnome-canvas-acetate.h"
#include "display/sodipodi-ctrlrect.h"
#include "display/sp-canvas-util.h"
+#include "display/canvas-temporary-item-list.h"
+#include "display/snap-indicator.h"
#include "libnr/nr-matrix-div.h"
#include "libnr/nr-rect-ops.h"
#include "ui/dialog/dialog-manager.h"
#include "event-log.h"
#include "display/canvas-grid.h"
#include "widgets/desktop-widget.h"
+#include "box3d-context.h"
#include "display/sp-canvas.h"
event_context( 0 ),
layer_manager( 0 ),
event_log( 0 ),
+ temporary_item_list( 0 ),
+ snapindicator( 0 ),
acetate( 0 ),
main( 0 ),
gridgroup( 0 ),
drawing( 0 ),
sketch( 0 ),
controls( 0 ),
+ tempgroup ( 0 ),
table( 0 ),
page( 0 ),
page_border( 0 ),
guides = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
sketch = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
controls = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
+ tempgroup = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
/* Push select tool to the bottom of stack */
/** \todo
layer_manager = new Inkscape::LayerManager( this );
showGrids(namedview->grids_visible, false);
+
+ temporary_item_list = new Inkscape::Display::TemporaryItemList( this );
+ snapindicator = new Inkscape::Display::SnapIndicator ( this );
}
void SPDesktop::destroy()
{
+ if (snapindicator) {
+ delete snapindicator;
+ snapindicator = NULL;
+ }
+ if (temporary_item_list) {
+ delete temporary_item_list;
+ temporary_item_list = NULL;
+ }
+
namedview->hide(this);
_activate_connection.disconnect();
//--------------------------------------------------------------------
/* Public methods */
+
+/** Note that lifetime is measured in milliseconds
+* it is perfectly safe to ignore the returned pointer: the object is deleted by itself, so don't delete it elsewhere!
+* The return value should only be used as argument for SPDesktop::remove_temporary_canvasitem, because the object might be deleted already.
+*/
+Inkscape::Display::TemporaryItem *
+SPDesktop::add_temporary_canvasitem (SPCanvasItem *item, guint lifetime)
+{
+ return temporary_item_list->add_item(item, lifetime);
+}
+
+/** It is perfectly safe to call this function while the object has already been deleted due to a timeout.
+*/
+void
+SPDesktop::remove_temporary_canvasitem (Inkscape::Display::TemporaryItem * tempitem)
+{
+ // check for non-null temporary_item_list, because during destruction of desktop, some destructor might try to access this list!
+ if (tempitem && temporary_item_list) {
+ temporary_item_list->delete_item(tempitem);
+ }
+}
+
void SPDesktop::setDisplayModeNormal()
{
SP_CANVAS_ARENA (drawing)->arena->rendermode = RENDERMODE_NORMAL;
/* 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();
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));
}