filletchamferpointarray.cpp revision 60686db0a5208fa858942a7e9cf8318956dcd36e
/*
* Copyright (C) Jabiertxo Arraiza Cenoz <jabier.arraiza@marker.es>
* Special thanks to Johan Engelen for the base of the effect -powerstroke-
* Also to ScislaC for point me to the idea
* Also su_v for his construvtive feedback and time
* and finaly to Liam P. White for his big help on coding, that save me a lot of
* hours
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "ui/dialog/lpe-fillet-chamfer-properties.h"
#include "live_effects/parameter/filletchamferpointarray.h"
#include "live_effects/effect.h"
#include "svg/stringstream.h"
#include "knotholder.h"
#include "sp-lpe-item.h"
#include "selection.h"
// needed for on-canvas editting:
#include "desktop.h"
#include "live_effects/lpeobject.h"
#include "helper/geom-nodetype.h"
#include "helper/geom-curves.h"
#include "ui/tools/node-tool.h"
// TODO due to internal breakage in glibmm headers,
// this has to be included last.
using namespace Geom;
namespace Inkscape {
namespace LivePathEffect {
{
knot_color = 0x00ff0000;
}
{
return NULL;
/*
Inkscape::UI::Widget::RegisteredTransformedPoint * pointwdg =
Gtk::manage(
new Inkscape::UI::Widget::RegisteredTransformedPoint(
param_label,
param_tooltip,
param_key,
*param_wr,
param_effect->getRepr(),
param_effect->getSPDoc()
) );
// TODO: fix to get correct desktop (don't use SP_ACTIVE_DESKTOP)
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
Affine transf = desktop->doc2dt();
pointwdg->setTransform(transf);
pointwdg->setValue( *this );
pointwdg->clearProgrammatically();
pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Change point parameter"));
Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() );
static_cast<Gtk::HBox*>(hbox)->pack_start(*pointwdg, true, true);
static_cast<Gtk::HBox*>(hbox)->show_all_children();
return dynamic_cast<Gtk::Widget *> (hbox);
*/
}
void
bool /*set*/)
{
_vector[1][X] <= 0) {
Coord A =
}
}
// param_set_and_write_new_value( (*this) * postmul );
}
/** call this method to recalculate the controlpoints such that they stay at the
* the path.*/
{
PathVector const pathv =
unsigned long counter = 0;
unsigned long counterPaths = 0;
unsigned long counterCurves = 0;
long offset = 0;
long offsetPaths = 0;
counterPaths++;
counter++;
continue;
}
}
}
counterCurves = 0;
while (curve_it1 != curve_endit) {
//if start a path get node type
if (counterCurves == 0) {
} else {
}
} else {
}
} else {
//check node type also whith straight lines because get_nodetype
//return non cusp node in a node inserted inside a straight line
//todo: if the path remove some nodes whith the result of a straight
//line but with handles, the node inserted into dont fire the knot
// because is not handle as cusp node by get_nodetype function
bool this_is_line = true;
if (this_is_line || next_is_line) {
}
}
0.1))) {
} else {
offset = 0;
}
offsetPaths += offset;
for (unsigned long i =
if (tmp[i - 1][X] > 0) {
} else {
}
e++;
}
//delete temp vector
}
} else {
offset++;
offset--;
continue;
}
} else {
offset++;
}
}
double xPos = 0;
if (_vector[1][X] > 0) {
}
} else {
}
} else {
if (_vector[1][X] > 0) {
} else {
xPos = 0;
}
}
vectorY = 1;
}
} else {
if (_vector[1][X] < 0) {
xPos = 0;
}
}
}
++curve_it1;
if (curve_it2 != curve_endit) {
++curve_it2;
}
counter++;
}
counterPaths++;
}
write_to_SVG();
}
}
{
bool change = false;
int counter = 0;
int counterCurves = 0;
counter++;
continue;
}
}
}
counterCurves = 0;
while (curve_it1 != curve_endit) {
//if start a path get node type
if (counterCurves == 0) {
} else {
}
} else {
}
} else {
bool this_is_line = true;
if (this_is_line || next_is_line) {
}
}
if (vectorY == 0) {
vectorY = 1;
change = true;
}
} else {
if (_vector[1][X] < 0) {
xPos = 0;
}
if (vectorY != 0) {
change = true;
}
}
++curve_it1;
if (curve_it2 != curve_endit) {
++curve_it2;
}
counter++;
}
}
if (change) {
write_to_SVG();
}
}
}
{
}
{
helper_size = hs;
}
{
}
{
unsigned int i = 0;
if (Xvalue == i) {
i++;
continue;
}
i++;
}
}
{
}
{
double t = 0;
if (len != 0) {
u.push_cut(0);
t = t_roots[0];
}
} else {
double lenghtPart = 0;
}
}
}
}
t = double(index) + t;
} else {
}
return t;
}
{
double intpart;
double len = 0;
double lenghtPart = 0;
return len;
}
u.push_cut(0);
}
}
{
if (A > 0) {
return A;
} else {
return len_to_time(index, A);
}
}
{
if (A > 0) {
return time_to_len(index, A);
} else {
return A;
}
}
{
knot_shape = shape;
knot_color = color;
}
/*
class FilletChamferPointArrayParamKnotHolderEntity : public KnotHolderEntity {
public:
FilletChamferPointArrayParamKnotHolderEntity(FilletChamferPointArrayParam
*p, unsigned int index);
virtual ~FilletChamferPointArrayParamKnotHolderEntity() {}
virtual void knot_set(Point const &p, Point const &origin, guint state);
virtual Point knot_get() const;
virtual void knot_click(guint state);
virtual void knot_doubleclicked(guint state);
/Checks whether the index falls within the size of the parameter's vector/
bool valid_index(unsigned int index) const {
return (_pparam->_vector.size() > index);
};
private:
FilletChamferPointArrayParam *_pparam;
unsigned int _index;
};
/*/
FilletChamferPointArrayParam *p, unsigned int index)
{
using namespace Geom;
if (!valid_index(_index)) {
return;
}
/// @todo how about item transforms???
//todo: add snapping
//Geom::Point const s = snap_knot_position(p, state);
if (t == 1) {
t = 0.9999;
}
t += _index;
} else {
}
}
{
using namespace Geom;
if (!valid_index(_index)) {
}
return canvas_point;
}
{
if (state & GDK_CONTROL_MASK) {
if (state & GDK_MOD1_MASK) {
}else{
using namespace Geom;
if (type > 4) {
type = 1;
}
if (type == 3) {
tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else if (type == 2) {
tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else if (type == 1) {
tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else {
tip = _("<b>Double Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
}
}
}
}
void
{
//todo: fill the double click dialog whith this parameters in the added file
//My idea for when have enought time is:
//label whith radius in percent
//label whith radius in size -maybe handle units-
//entry whith actual radius -in flexible % mode or fixed -?px-
//2 radio options to switch entry from fixed or flexible, also update the
//entry
//Checkbox or two radios to swith fillet or chamfer
}
{
}
{
if (_vector[i][Y] <= 0) {
continue;
}
if (_vector[i][Y] == 3) {
tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else if (_vector[i][Y] == 2) {
tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else if (_vector[i][Y] == 1) {
tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
} else {
tip = _("<b>Double Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
"<b>Shift+Click</b> open dialog, "
"<b>Ctrl+Alt+Click</b> reset");
}
new FilletChamferPointArrayParamKnotHolderEntity(this, i);
knotholder->add(e);
}
}
} /* namespace LivePathEffect */
} /* 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 :