grid.cpp revision a6988c83e9af8585b15319bf204be9382260b739
/**
\file grid.cpp
A plug-in to add a grid creation effect into Inkscape.
*/
/*
* Authors:
* Ted Gould <ted@gould.cx>
*
* Copyright (C) 2004-2005 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <gtkmm/adjustment.h>
#include <gtkmm/spinbutton.h>
#include "desktop.h"
#include "selection.h"
#include "sp-object.h"
#include "grid.h"
namespace Inkscape {
namespace Extension {
namespace Internal {
/**
\brief A function to allocated anything -- just an example here
\param module Unused
\return Whether the load was sucessful
*/
bool
{
// std::cout << "Hey, I'm Grid, I'm loading!" << std::endl;
return TRUE;
}
/**
\brief This actually draws the grid.
\param module The effect that was called (unused)
\param document What should be edited.
*/
void
{
/* get page size */
} else {
NR::Rect temprec = NR::Rect(NR::Point(bounding_area.min()[NR::X], doc_height - bounding_area.min()[NR::Y]),
}
// std::cout << "Spacing: " << spacing;
// std::cout << " Line Width: " << line_width;
// std::cout << " Offset: " << offset << std::endl;
path_data += "M ";
path_data += floatstring;
path_data += " ";
path_data += floatstring;
path_data += " L ";
path_data += floatstring;
path_data += " ";
path_data += floatstring;
path_data += " ";
}
path_data += "M ";
path_data += floatstring;
path_data += " ";
path_data += floatstring;
path_data += " L ";
path_data += floatstring;
path_data += " ";
path_data += floatstring;
path_data += " ";
}
// std::cout << "Path Data: " << path_data << std::endl;
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:";
style += floatstring;
style += "pt";
// Glib::ustring transform("scale(1.25 1.25)");
// path->setAttribute("transform", transform.c_str());
return;
}
/** \brief A class to make an adjustment that uses Extension params */
/** Extension that this relates to */
/** The string which represents the parameter */
char * _pref;
public:
/** \brief Make the adjustment using an extension and the string
describing the parameter. */
return;
};
void val_changed (void);
}; /* class PrefAdjustment */
/** \brief A function to respond to the value_changed signal from the
adjustment.
This function just grabs the value from the adjustment and writes
it to the parameter. Very simple, but yet beautiful.
*/
void
PrefAdjustment::val_changed (void)
{
// std::cout << "Value Changed to: " << this->get_value() << std::endl;
return;
}
/** \brief A function to get the prefences for the grid
\param moudule Module which holds the params
\param view Unused today - may get style information in the future.
This function builds a VBox, and puts it into a Gtk::Plug. This way
the native window pointer can be pulled out and returned up to be
stuck in a Gtk::Socket further up the call stack. In the Vbox there
are several Hboxes, each one being a spin button to adjust a particular
parameter. The names of the parameters and the labels are all
stored in the arrays in the middle of the function. This makes
the code very generic. This will probably have to change if someone
wants to make this dialog look nicer.
*/
{
#define NUM_PREFERENCES 5
N_("Horizontal Spacing"),
N_("Vertical Spacing"),
N_("Horizontal Offset"),
N_("Vertical Offset")};
"xspacing",
"yspacing",
"xoffset",
"yoffset"};
for (int i = 0; i < NUM_PREFERENCES; i++) {
}
return vbox;
}
#include "clear-n_.h"
void
{
"<inkscape-extension>\n"
"<id>org.inkscape.effect.grid</id>\n"
"<param name=\"lineWidth\" type=\"float\">1.0</param>\n"
"<param name=\"xspacing\" type=\"float\">10.0</param>\n"
"<param name=\"yspacing\" type=\"float\">10.0</param>\n"
"<param name=\"xoffset\" type=\"float\">5.0</param>\n"
"<param name=\"yoffset\" type=\"float\">5.0</param>\n"
"<effect>\n"
"<object-type>all</object-type>\n"
"<effects-menu>\n"
"</effects-menu>\n"
"</effect>\n"
"</inkscape-extension>\n", new Grid());
return;
}
}; /* namespace Internal */
}; /* namespace Extension */
}; /* namespace Inkscape */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :