index 39bca52d837fcc7b7f7b284bb4950334c8a8d22c..a19ab75388c49e36a1d4ab0a44f63d4487481752 100644 (file)
/*
* Copyright (C) 2004-2005 Ted Gould <ted@gould.cx>
* Copyright (C) 2007 MenTaLguY <mental@rydia.net>
+ * Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -87,14 +88,14 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
/* get page size */
SPDocument * doc = document->doc();
bounding_area = Geom::Rect( Geom::Point(0,0),
- Geom::Point(sp_document_width(doc), sp_document_height(doc)) );
+ Geom::Point(doc->getWidth(), doc->getHeight()) );
} else {
Geom::OptRect bounds = selection->bounds();
if (bounds) {
bounding_area = *bounds;
}
- gdouble doc_height = sp_document_height(document->doc());
+ gdouble doc_height = (document->doc())->getHeight();
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]));
@@ -111,8 +112,10 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
path_data = build_lines(bounding_area,
offsets, spacings);
- Inkscape::XML::Document * xml_doc = sp_document_repr_doc(document->doc());
- Inkscape::XML::Node * current_layer = static_cast<SPDesktop *>(document)->currentLayer()->repr;
+ Inkscape::XML::Document * xml_doc = document->doc()->getReprDoc();
+
+ //XML Tree being used directly here while it shouldn't be.
+ Inkscape::XML::Node * current_layer = static_cast<SPDesktop *>(document)->currentLayer()->getRepr();
Inkscape::XML::Node * path = xml_doc->createElement("svg:path");
path->setAttribute("d", path_data.c_str());
@@ -120,7 +123,9 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
Glib::ustring style("fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000");
style += ";stroke-width:";
gchar floatstring[64];
- sprintf(floatstring, "%f", line_width);
+ std::ostringstream stringstream;
+ stringstream << line_width;
+ sprintf(floatstring, "%s", stringstream.str().c_str());
style += floatstring;
style += "pt";
path->setAttribute("style", style.c_str());
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
"<name>" N_("Grid") "</name>\n"
"<id>org.inkscape.effect.grid</id>\n"
- "<param name=\"lineWidth\" gui-text=\"" N_("Line Width") "\" type=\"float\">1.0</param>\n"
- "<param name=\"xspacing\" gui-text=\"" N_("Horizontal Spacing") "\" type=\"float\" min=\"0.1\" max=\"1000\">10.0</param>\n"
- "<param name=\"yspacing\" gui-text=\"" N_("Vertical Spacing") "\" type=\"float\" min=\"0.1\" max=\"1000\">10.0</param>\n"
- "<param name=\"xoffset\" gui-text=\"" N_("Horizontal Offset") "\" type=\"float\" min=\"0.0\" max=\"1000\">0.0</param>\n"
- "<param name=\"yoffset\" gui-text=\"" N_("Vertical Offset") "\" type=\"float\" min=\"0.0\" max=\"1000\">0.0</param>\n"
+ "<param name=\"lineWidth\" gui-text=\"" N_("Line Width:") "\" type=\"float\">1.0</param>\n"
+ "<param name=\"xspacing\" gui-text=\"" N_("Horizontal Spacing:") "\" type=\"float\" min=\"0.1\" max=\"1000\">10.0</param>\n"
+ "<param name=\"yspacing\" gui-text=\"" N_("Vertical Spacing:") "\" type=\"float\" min=\"0.1\" max=\"1000\">10.0</param>\n"
+ "<param name=\"xoffset\" gui-text=\"" N_("Horizontal Offset:") "\" type=\"float\" min=\"0.0\" max=\"1000\">0.0</param>\n"
+ "<param name=\"yoffset\" gui-text=\"" N_("Vertical Offset:") "\" type=\"float\" min=\"0.0\" max=\"1000\">0.0</param>\n"
"<effect>\n"
"<object-type>all</object-type>\n"
"<effects-menu>\n"