16#include <gtkmm/adjustment.h>
17#include <gtkmm/spinbutton.h>
55Glib::ustring build_lines(
Geom::Rect bounding_area,
59 std::cerr <<
"Building lines" << std::endl;
63 SVG::PathString path_data;
66 point_offset[axis] =
offset[axis];
69 start_point[axis] +
offset[axis] <= (bounding_area.
max())[axis];
70 start_point[axis] += spacing[axis]) {
72 end_point[1-axis] = (bounding_area.
max())[1-axis];
74 path_data.moveTo(start_point + point_offset)
75 .lineTo(end_point + point_offset);
78 std::cerr <<
"Path data:" << path_data.c_str() << std::endl;
93 std::cerr <<
"Executing effect" << std::endl;
108 gdouble doc_height = (
desktop->
doc())->getHeight().value(
"px");
112 bounding_area = temprec;
120 gdouble line_width =
scale *
module->get_param_float("lineWidth");
124 Glib::ustring path_data(
"");
126 path_data = build_lines(bounding_area, offsets, spacings);
135 std::ostringstream stringstream;
136 stringstream <<
"fill:none;stroke:#000000;stroke-width:" << line_width <<
"px";
144class PrefAdjustment :
public Gtk::Adjustment {
153 Gtk::Adjustment(0.0, 0.0, 10.0, 0.1), _ext(ext), _pref(pref) {
155 this->signal_value_changed().connect(sigc::mem_fun(*
this, &PrefAdjustment::val_changed));
169PrefAdjustment::val_changed ()
189 if (!selected.empty()) {
190 first_select = selected.front()->getRepr();
193 return module->autogui(current_document, first_select, changeSignal);
Various geometrical calculations.
CPoint min() const
Get the corner of the rectangle with smallest coordinate values.
CPoint max() const
Get the corner of the rectangle with largest coordinate values.
Axis-aligned rectangle that can be empty.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
Effects are extensions that take a document and do something to it in place.
The object that is the basis for the Extension system.
double set_param_float(char const *name, double value)
Sets a parameter identified by name with the double in the parameter value.
double get_param_float(char const *name) const
Gets a float parameter identified by name with the double placed in value.
A cache for the document and this implementation.
void effect(Inkscape::Extension::Effect *module, ExecutionEnv *executionEnv, SPDesktop *desktop, Inkscape::Extension::Implementation::ImplementationDocumentCache *docCache) override
This actually draws the grid.
bool load(Inkscape::Extension::Extension *module) override
A function to allocated anything – just an example here.
Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, SPDesktop *desktop, sigc::signal< void()> *changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache *docCache) override
A function to get the preferences for the grid.
SPGroup * currentLayer() const
Returns current top layer.
SPItemRange items()
Returns a range of selected SPItems.
bool isEmpty()
Returns true if no items are selected.
Geom::OptRect visualBounds() const
The set of selected SPObjects for a given document and layer model.
Interface for refcounted XML nodes.
virtual void appendChild(Node *child)=0
Append a node as the last child of this node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
To do: update description of desktop.
Inkscape::Selection * getSelection() const
Inkscape::LayerManager & layerManager()
Typed SVG document implementation.
Geom::OptRect preferredBounds() const
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
Geom::Scale getDocumentScale(bool computed=true) const
Returns document scale as defined by width/height (in pixels) and viewBox (real world to user-units).
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
Editable view implementation.
static R & release(R &r)
Decrements the reference count of a anchored object.
Helper class to stream background task notifications as a series of messages.
Inkscape::SVG::PathString - builder for SVG path strings.
Interface for XML documents.
virtual Node * createElement(char const *name)=0