X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fextension%2Finternal%2Fgrid.cpp;h=d4b35b261baec5cb49bb89bbdac225bb8bd07179;hb=da58597f9f9ecb17c4f545c4483a844a363bcc27;hp=0992681766e9b38320d51251cc432e892356ae53;hpb=70ca1c6d6d56358edcb0762fabaf27943da42ab3;p=inkscape.git diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 099268176..d4b35b261 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -1,6 +1,6 @@ /** \file grid.cpp - + A plug-in to add a grid creation effect into Inkscape. */ /* @@ -38,7 +38,7 @@ namespace Internal { \return Whether the load was sucessful */ bool -Grid::load (Inkscape::Extension::Extension *module) +Grid::load (Inkscape::Extension::Extension */*module*/) { // std::cout << "Hey, I'm Grid, I'm loading!" << std::endl; return TRUE; @@ -46,17 +46,17 @@ Grid::load (Inkscape::Extension::Extension *module) namespace { -Glib::ustring build_lines(int axis, NR::Rect bounding_area, +Glib::ustring build_lines(int axis, Geom::Rect bounding_area, float offset, float spacing) { - NR::Point point_offset(0.0, 0.0); + Geom::Point point_offset(0.0, 0.0); point_offset[axis] = offset; SVG::PathString path_data; - for (NR::Point start_point = bounding_area.min(); + for (Geom::Point start_point = bounding_area.min(); start_point[axis] + offset <= (bounding_area.max())[axis]; start_point[axis] += spacing) { - NR::Point end_point = start_point; + Geom::Point end_point = start_point; end_point[1-axis] = (bounding_area.max())[1-axis]; path_data.moveTo(start_point + point_offset) @@ -74,26 +74,25 @@ Glib::ustring build_lines(int axis, NR::Rect bounding_area, \param document What should be edited. */ void -Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document) +Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { Inkscape::Selection * selection = ((SPDesktop *)document)->selection; - NR::Rect bounding_area = NR::Rect(NR::Point(0,0), NR::Point(100,100)); + Geom::Rect bounding_area = Geom::Rect(Geom::Point(0,0), Geom::Point(100,100)); if (selection->isEmpty()) { /* get page size */ SPDocument * doc = document->doc(); - bounding_area = NR::Rect(NR::Point(0,0), - NR::Point(sp_document_width(doc), - sp_document_height(doc))); + bounding_area = Geom::Rect( Geom::Point(0,0), + Geom::Point(sp_document_width(doc), sp_document_height(doc)) ); } else { - NR::Maybe bounds = selection->bounds(); + Geom::OptRect bounds = selection->bounds(); if (bounds) { bounding_area = *bounds; } gdouble doc_height = sp_document_height(document->doc()); - NR::Rect temprec = NR::Rect(NR::Point(bounding_area.min()[NR::X], doc_height - bounding_area.min()[NR::Y]), - NR::Point(bounding_area.max()[NR::X], doc_height - bounding_area.max()[NR::Y])); + Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], doc_height - bounding_area.min()[Geom::Y]), + Geom::Point(bounding_area.max()[Geom::X], doc_height - bounding_area.max()[Geom::Y])); bounding_area = temprec; } @@ -125,6 +124,7 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc path->setAttribute("style", style.c_str()); current_layer->appendChild(path); + Inkscape::GC::release(path); return; } @@ -140,7 +140,7 @@ public: describing the parameter. */ PrefAdjustment(Inkscape::Extension::Extension * ext, char * pref) : Gtk::Adjustment(0.0, 0.0, 10.0, 0.1), _ext(ext), _pref(pref) { - this->set_value(_ext->get_param_float(_pref)); + this->set_value(_ext->get_param_float(_pref)); this->signal_value_changed().connect(sigc::mem_fun(this, &PrefAdjustment::val_changed)); return; }; @@ -169,14 +169,14 @@ PrefAdjustment::val_changed (void) Uses AutoGUI for creating the GUI. */ Gtk::Widget * -Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, Glib::SignalProxy0 * changeSignal) +Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { SPDocument * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; GSListConstIterator selected = sp_desktop_selection((SPDesktop *)view)->itemList(); Inkscape::XML::Node * first_select = NULL; - if (selected != NULL) + if (selected != NULL) first_select = SP_OBJECT_REPR(*selected); return module->autogui(current_document, first_select, changeSignal); @@ -188,7 +188,7 @@ void Grid::init (void) { Inkscape::Extension::build_from_mem( - "\n" + "\n" "" N_("Grid") "\n" "org.inkscape.effect.grid\n" "1.0\n"