From 8867de5daf309e4cdd3fce177b408618490be4f3 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Tue, 29 Jun 2010 23:35:42 +0530 Subject: This is the first c++ification commit from me. It handles sp-line, sp-polyline, sp-item and marks the onset of document c++ification as well. Users can check performace increase with [/usr/bin/time -v inkscape_binary_with_commandline_options]. (bzr r9546.1.1) --- src/svg-view.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/svg-view.cpp') diff --git a/src/svg-view.cpp b/src/svg-view.cpp index bd46dd17a..31b54b36d 100644 --- a/src/svg-view.cpp +++ b/src/svg-view.cpp @@ -41,7 +41,7 @@ SPSVGView::~SPSVGView() { if (doc() && _drawing) { - sp_item_invoke_hide (SP_ITEM (sp_document_root (doc())), _dkey); + SP_ITEM (sp_document_root (doc()))->invoke_hide (_dkey); _drawing = NULL; } } @@ -152,7 +152,7 @@ arena_handler (SPCanvasArena */*arena*/, NRArenaItem *ai, GdkEvent *event, SPSVG spev.type = SP_EVENT_ACTIVATE; if ( spitem != 0 ) { - sp_item_event (spitem, &spev); + spitem->emitEvent (spev); } } } @@ -166,7 +166,7 @@ arena_handler (SPCanvasArena */*arena*/, NRArenaItem *ai, GdkEvent *event, SPSVG spev.data = svgview; if ( spitem != 0 ) { - sp_item_event (spitem, &spev); + spitem->emitEvent (spev); } break; case GDK_LEAVE_NOTIFY: @@ -174,7 +174,7 @@ arena_handler (SPCanvasArena */*arena*/, NRArenaItem *ai, GdkEvent *event, SPSVG spev.data = svgview; if ( spitem != 0 ) { - sp_item_event (spitem, &spev); + spitem->emitEvent (spev); } break; default: @@ -191,7 +191,7 @@ void SPSVGView::setDocument (SPDocument *document) { if (doc()) { - sp_item_invoke_hide (SP_ITEM (sp_document_root (doc())), _dkey); + SP_ITEM (sp_document_root (doc()))->invoke_hide (_dkey); } if (!_drawing) { @@ -200,8 +200,7 @@ SPSVGView::setDocument (SPDocument *document) } if (document) { - NRArenaItem *ai = sp_item_invoke_show ( - SP_ITEM (sp_document_root (document)), + NRArenaItem *ai = SP_ITEM (sp_document_root (document))->invoke_show ( SP_CANVAS_ARENA (_drawing)->arena, _dkey, SP_ITEM_SHOW_DISPLAY); -- cgit v1.2.3 From 121815791be2d24cb745663520b111ee914fbc09 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Thu, 1 Jul 2010 15:36:56 +0530 Subject: C++fied SPDocument added (bzr r9546.1.2) --- src/svg-view.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/svg-view.cpp') diff --git a/src/svg-view.cpp b/src/svg-view.cpp index 31b54b36d..6d989a8f5 100644 --- a/src/svg-view.cpp +++ b/src/svg-view.cpp @@ -84,12 +84,12 @@ void SPSVGView::doRescale (bool event) { if (!doc()) return; - if (sp_document_width (doc()) < 1e-9) return; - if (sp_document_height (doc()) < 1e-9) return; + if (doc()->getWidth () < 1e-9) return; + if (doc()->getHeight () < 1e-9) return; if (_rescale) { - _hscale = _width / sp_document_width (doc()); - _vscale = _height / sp_document_height (doc()); + _hscale = _width / doc()->getWidth (); + _vscale = _height / doc()->getHeight (); if (_keepaspect) { if (_hscale > _vscale) { _hscale = _vscale; @@ -104,8 +104,8 @@ SPSVGView::doRescale (bool event) } if (event) { - emitResized (sp_document_width (doc()) * _hscale, - sp_document_height (doc()) * _vscale); + emitResized (doc()->getWidth () * _hscale, + doc()->getHeight () * _vscale); } } -- cgit v1.2.3