X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fduckmatic.cpp;h=cd137cb536aa99fa7dbf4e516885d13d304ec94f;hb=f9b4e5524a9f481a890f9f60d5f9a414bde2211e;hp=118d33985249510f88b998b76481c9bed94c1b22;hpb=d8b000c637f56647d30a929b4fa4b7950c814c3b;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/duckmatic.cpp b/synfig-studio/trunk/src/gtkmm/duckmatic.cpp index 118d339..cd137cb 100644 --- a/synfig-studio/trunk/src/gtkmm/duckmatic.cpp +++ b/synfig-studio/trunk/src/gtkmm/duckmatic.cpp @@ -6,7 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007 Chris Moore +** Copyright (c) 2007, 2008 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -108,6 +108,18 @@ Duckmatic::~Duckmatic() } void +Duckmatic::set_flip_x(bool flip_x) +{ + flip_x_ = flip_x; +} + +void +Duckmatic::set_flip_y(bool flip_y) +{ + flip_y_ = flip_y; +} + +void Duckmatic::clear_ducks() { duck_data_share_map.clear(); @@ -544,6 +556,31 @@ Duckmatic::signal_edited_selected_ducks() throw String("Bad edit"); } } + else if (App::restrict_radius_ducks && + (*iter)->is_radius()) + { + Point point((*iter)->get_point()); + bool changed = false; + + if (point[0] * (flip_x_ ? -1 : 1) < 0) + { + point[0] = 0; + changed = true; + } + if (point[1] * (flip_y_ ? -1 : 1) < 0) + { + point[1] = 0; + changed = true; + } + + if (changed) (*iter)->set_point(point); + + if(!(*iter)->signal_edited()(point)) + { + selected_ducks=old_set; + throw String("Bad edit"); + } + } else { if(!(*iter)->signal_edited()((*iter)->get_point())) @@ -737,6 +774,8 @@ Duckmatic::find_duck(synfig::Point point, synfig::Real radius, Duck::Type type) if(duck->get_type()&Duck::TYPE_VERTEX) dist*=1.0001; + else if(duck->get_type()&Duck::TYPE_RADIUS) + dist*=0.9999; if(dist<=closest && !( duck->get_type() && (!(type & duck->get_type())) ) ) { @@ -995,7 +1034,8 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handleset_radius(true); duck->set_type(Duck::TYPE_RADIUS); - duck->set_point(Point(value_desc.get_value(get_time()).get(Real()),0)); + // put the duck on the right hand side of the center, whether the display is flipped or not + duck->set_point(Point(value_desc.get_value(get_time()).get(Real()) * (flip_x_ ? -1 : 1), 0)); duck->set_name(guid_string(value_desc)); if(value_desc.is_value_node()) {