From 0460509d84144f75baabb2bf0b069634ac02fc03 Mon Sep 17 00:00:00 2001 From: nicholasbishop Date: Mon, 16 Jul 2007 22:24:23 +0000 Subject: [PATCH] Filter effects dialog: * A coule bug fixes; attempting to connect the first filter primitive to another is no longer allowed, same for attempting to connect the input of a filter primitive to its own result. Still todo is preventing a connection to a later primitive. --- src/ui/dialog/filter-effects-dialog.cpp | 44 ++++++++++++++++--------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index f1da6395c..7263af448 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -511,13 +511,16 @@ bool FilterEffectsDialog::PrimitiveList::on_button_press_event(GdkEventButton* e int cx, cy; if(get_path_at_pos(x, y, path, col, cx, cy)) { - std::vector points; - if(do_connection_node(_model->get_iter(path), 0, points, x, y)) - _in_drag = 1; - else if(do_connection_node(_model->get_iter(path), 1, points, x, y)) - _in_drag = 2; - - queue_draw(); + Gtk::TreeIter iter = _model->get_iter(path); + if(iter != _model->children().begin()) { + std::vector points; + if(do_connection_node(_model->get_iter(path), 0, points, x, y)) + _in_drag = 1; + else if(do_connection_node(_model->get_iter(path), 1, points, x, y)) + _in_drag = 2; + + queue_draw(); + } } return Gtk::TreeView::on_button_press_event(e); @@ -540,20 +543,29 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton* int cx, cy; if(get_path_at_pos((int)e->x, (int)e->y, path, col, cx, cy)) { + const gchar *in_val; target = (*_model->get_iter(path))[_columns.primitive]; - Inkscape::XML::Node *repr = SP_OBJECT_REPR(target); - // Make sure the target has a result - const gchar *gres = repr->attribute("result"); - Glib::ustring result = gres ? gres : ""; - if(!gres) { - result = "result" + Glib::Ascii::dtostr(SP_FILTER(prim->parent)->_image_number_next); - repr->setAttribute("result", result.c_str()); + if(target == prim) { + in_val = 0; + } + else { + Inkscape::XML::Node *repr = SP_OBJECT_REPR(target); + // Make sure the target has a result + const gchar *gres = repr->attribute("result"); + if(!gres) { + const Glib::ustring result = "result" + + Glib::Ascii::dtostr(SP_FILTER(prim->parent)->_image_number_next); + repr->setAttribute("result", result.c_str()); + in_val = result.c_str(); + } + else + in_val = gres; } if(_in_drag == 1) - SP_OBJECT_REPR(prim)->setAttribute("in", result.c_str()); + SP_OBJECT_REPR(prim)->setAttribute("in", in_val); else if(_in_drag == 2) - SP_OBJECT_REPR(prim)->setAttribute("in2", result.c_str()); + SP_OBJECT_REPR(prim)->setAttribute("in2", in_val); } _in_drag = 0; -- 2.30.2