/*
* Copyright (C) Theodore Janeczko 2012 <flutterguy317@gmail.com>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "live_effects/parameter/originalpatharray.h"
#include <gtkmm/icontheme.h>
#include <gtkmm/imagemenuitem.h>
#include <gtkmm/separatormenuitem.h>
#include <gtkmm/scrolledwindow.h>
#include "inkscape.h"
#include "icon-size.h"
#include "ui/clipboard.h"
#include "svg/stringstream.h"
#include "originalpath.h"
#include "uri.h"
#include "sp-shape.h"
#include "sp-text.h"
#include "live_effects/effect.h"
#include "verbs.h"
#include "document-undo.h"
#include "document.h"
namespace Inkscape {
namespace LivePathEffect {
{
public:
{
}
virtual ~ModelColumns() {}
};
_vector(),
_tree(),
{
_model = new ModelColumns();
_tree.set_reorderable(true);
_toggle_renderer->set_activatable(true);
_toggle_renderer->signal_toggled().connect(sigc::mem_fun(*this, &OriginalPathArrayParam::on_reverse_toggled));
//quick little hack -- newer versions of gtk gave the item zero space allotment
//_scroller.set_shadow_type(Gtk::SHADOW_IN);
oncanvas_editable = true;
}
{
unlink(w);
delete w;
}
delete _model;
}
{
_("Link path parameter to path"));
}
{
}
{
{ // Paste path to link button
pButton->signal_clicked().connect(sigc::mem_fun(*this, &OriginalPathArrayParam::on_link_button_click));
}
{ // Remove linked path
pButton->signal_clicked().connect(sigc::mem_fun(*this, &OriginalPathArrayParam::on_remove_button_click));
}
{ // Move Down
pButton->signal_clicked().connect(sigc::mem_fun(*this, &OriginalPathArrayParam::on_down_button_click));
}
{ // Move Down
pButton->signal_clicked().connect(sigc::mem_fun(*this, &OriginalPathArrayParam::on_up_button_click));
}
vbox->show_all_children(true);
return vbox;
}
{
if ((*i)-- <= 0) {
return true;
}
return false;
}
{
if (iter) {
int i = -1;
for (std::vector<PathAndDirection*>::iterator iter = _vector.begin(); iter != _vector.end(); piter = iter, i++, ++iter) {
break;
}
}
_("Move path up"));
_store->foreach_iter(sigc::bind<int*>(sigc::mem_fun(*this, &OriginalPathArrayParam::_selectIndex), &i));
}
}
{
if (iter) {
int i = 0;
for (std::vector<PathAndDirection*>::iterator iter = _vector.begin(); iter != _vector.end(); i++, ++iter) {
++niter;
i++;
}
break;
}
}
_("Move path down"));
_store->foreach_iter(sigc::bind<int*>(sigc::mem_fun(*this, &OriginalPathArrayParam::_selectIndex), &i));
}
}
{
if (iter) {
_("Remove path"));
}
}
void
{
if (pathid == "") {
return;
}
// add '#' at start to make it an uri.
bool foundOne = false;
for (std::vector<PathAndDirection*>::const_iterator iter = _vector.begin(); iter != _vector.end(); ++iter) {
if (foundOne) {
os << "|";
} else {
foundOne = true;
}
}
if (foundOne) {
os << "|";
}
_("Link path parameter to path"));
}
{
}
}
{
for (std::vector<PathAndDirection*>::iterator iter = _vector.begin(); iter != _vector.end(); ++iter) {
PathAndDirection *w = *iter;
delete w;
return;
}
}
}
{
//remove_link(to);
}
{
row[_model->_colLabel] = obj && obj->getId() ? ( obj->label() ? obj->label() : obj->getId() ) : pd->href;
return true;
}
return false;
}
void OriginalPathArrayParam::linked_changed(SPObject */*old_obj*/, SPObject *new_obj, PathAndDirection* to)
{
to->linked_delete_connection = new_obj->connectDelete(sigc::bind<PathAndDirection*>(sigc::mem_fun(*this, &OriginalPathArrayParam::linked_delete), to));
to->linked_modified_connection = new_obj->connectModified(sigc::bind<PathAndDirection*>(sigc::mem_fun(*this, &OriginalPathArrayParam::linked_modified), to));
to->linked_transformed_connection = SP_ITEM(new_obj)->connectTransformed(sigc::bind<PathAndDirection*>(sigc::mem_fun(*this, &OriginalPathArrayParam::linked_transformed), to));
} else {
_store->foreach_iter(sigc::bind<PathAndDirection*>(sigc::mem_fun(*this, &OriginalPathArrayParam::_updateLink), to));
}
}
void OriginalPathArrayParam::setPathVector(SPObject *linked_obj, guint /*flags*/, PathAndDirection* to)
{
if (!to) {
return;
}
if (SP_IS_SHAPE(linked_obj)) {
}
if (SP_IS_TEXT(linked_obj)) {
}
// curve invalid, set empty pathvector
} else {
}
}
void OriginalPathArrayParam::linked_modified(SPObject *linked_obj, guint flags, PathAndDirection* to)
{
if (!to) {
return;
}
_store->foreach_iter(sigc::bind<PathAndDirection*>(sigc::mem_fun(*this, &OriginalPathArrayParam::_updateLink), to));
}
{
if (strvalue) {
unlink(w);
delete w;
}
if ((*iter)[0] == '#') {
w->linked_changed_connection = w->ref.changedSignal().connect(sigc::bind<PathAndDirection *>(sigc::mem_fun(*this, &OriginalPathArrayParam::linked_changed), w));
}
}
return true;
}
return false;
}
{
bool foundOne = false;
for (std::vector<PathAndDirection*>::const_iterator iter = _vector.begin(); iter != _vector.end(); ++iter) {
if (foundOne) {
os << "|";
} else {
foundOne = true;
}
}
return str;
}
} /* 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 :