X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fduckmatic.cpp;h=62e70fc16c8df0c6146a673cfdb2e0744345567c;hb=30c296530bbb095e51fc78535b5396a239c16aa7;hp=a2cc733c993a83938b7fa1517d0843ddbddc68d6;hpb=d2f84aebee06cd05129fc4dadb706e856efde9bb;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/duckmatic.cpp b/synfig-studio/trunk/src/gtkmm/duckmatic.cpp index a2cc733..62e70fc 100644 --- a/synfig-studio/trunk/src/gtkmm/duckmatic.cpp +++ b/synfig-studio/trunk/src/gtkmm/duckmatic.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 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 @@ -86,7 +87,7 @@ Duckmatic::Duckmatic(): grid_snap(false), guide_snap(false), grid_size(1.0/4.0,1.0/4.0), - show_persistant_strokes(true) + show_persistent_strokes(true) { axis_lock=false; drag_offset_=Point(0,0); @@ -109,8 +110,8 @@ Duckmatic::clear_ducks() bezier_list_.clear(); stroke_list_.clear(); - if(show_persistant_strokes) - stroke_list_=persistant_stroke_list_; + if(show_persistent_strokes) + stroke_list_=persistent_stroke_list_; } //! Returns \a true if the given duck is currently selected @@ -256,11 +257,8 @@ Duckmatic::is_duck_group_selectable(const etl::handle& x)const layer_name=="curve_gradient" ) return false; - if( - (layer_name=="PasteCanvas"|| - layer_name=="paste_canvas") - && !layer->get_param("children_lock").get(bool()) - ) + if((layer_name=="PasteCanvas"|| layer_name=="paste_canvas") && + !layer->get_param("children_lock").get(bool())) return false; } return true; @@ -276,6 +274,25 @@ Duckmatic::select_all_ducks() } void +Duckmatic::toggle_select_ducks_in_box(const synfig::Vector& tl,const synfig::Vector& br) +{ + Vector vmin, vmax; + vmin[0]=std::min(tl[0],br[0]); + vmin[1]=std::min(tl[1],br[1]); + vmax[0]=std::max(tl[0],br[0]); + vmax[1]=std::max(tl[1],br[1]); + + DuckMap::const_iterator iter; + for(iter=duck_map.begin();iter!=duck_map.end();++iter) + { + Point p(iter->second->get_trans_point()); + if(p[0]<=vmax[0] && p[0]>=vmin[0] && p[1]<=vmax[1] && p[1]>=vmin[1] && + is_duck_group_selectable(iter->second)) + toggle_select_duck(iter->second); + } +} + +void Duckmatic::select_ducks_in_box(const synfig::Vector& tl,const synfig::Vector& br) { Vector vmin, vmax; @@ -598,26 +615,26 @@ Duckmatic::add_stroke(etl::smart_ptr > stroke_point_lis } void -Duckmatic::add_persistant_stroke(etl::smart_ptr > stroke_point_list, const synfig::Color& color) +Duckmatic::add_persistent_stroke(etl::smart_ptr > stroke_point_list, const synfig::Color& color) { add_stroke(stroke_point_list,color); - persistant_stroke_list_.push_back(stroke_list_.back()); + persistent_stroke_list_.push_back(stroke_list_.back()); } void -Duckmatic::clear_persistant_strokes() +Duckmatic::clear_persistent_strokes() { - persistant_stroke_list_.clear(); + persistent_stroke_list_.clear(); } void -Duckmatic::set_show_persistant_strokes(bool x) +Duckmatic::set_show_persistent_strokes(bool x) { - if(x!=show_persistant_strokes) + if(x!=show_persistent_strokes) { - show_persistant_strokes=x; + show_persistent_strokes=x; if(x) - stroke_list_=persistant_stroke_list_; + stroke_list_=persistent_stroke_list_; else stroke_list_.clear(); } @@ -810,7 +827,7 @@ Duckmatic::save_sketch(const synfig::String& filename)const std::list >::const_iterator iter; - for(iter=persistant_stroke_list_.begin();iter!=persistant_stroke_list_.end();++iter) + for(iter=persistent_stroke_list_.begin();iter!=persistent_stroke_list_.end();++iter) { file<<"C " <<(*iter)->color.get_r()<<' ' @@ -871,7 +888,7 @@ Duckmatic::load_sketch(const synfig::String& filename) synfig::warning("Bad color line \"%s\"",line.c_str()); r=0;g=0;b=0; } - add_persistant_stroke(stroke_data, synfig::Color(r,g,b)); + add_persistent_stroke(stroke_data, synfig::Color(r,g,b)); } break; case 'V': @@ -879,7 +896,7 @@ Duckmatic::load_sketch(const synfig::String& filename) if(!stroke_data) { stroke_data.spawn(); - add_persistant_stroke(stroke_data, synfig::Color(0,0,0)); + add_persistent_stroke(stroke_data, synfig::Color(0,0,0)); } float x,y; if(!strscanf(line,"V %f %f",&x, &y)) @@ -1436,7 +1453,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handleset_origin(last_duck()); /* ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time())); - if(value.same_as(synfig::Point())) + if(value.same_type_as(synfig::Point())) duck->set_origin(value.get(synfig::Point())); */ } @@ -1465,7 +1482,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handleset_origin(last_duck()); /* ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time())); - if(value.same_as(synfig::Point())) + if(value.same_type_as(synfig::Point())) duck->set_origin(value.get(synfig::Point())); */ } @@ -1487,7 +1504,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handleset_name(guid_string(synfigapp::ValueDesc(value_node,i))+".w"); { ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_hint()).get_value(get_time())); - if(value.same_as(synfig::Real())) + if(value.same_type_as(synfig::Real())) width->set_scalar(value.get(synfig::Real())*0.5f); } } @@ -1593,7 +1610,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handleset_origin(last_duck()); /* ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time())); - if(value.same_as(synfig::Point())) + if(value.same_type_as(synfig::Point())) duck->set_origin(value.get(synfig::Point())); */ // if(!param_desc->get_origin().empty()) @@ -1748,7 +1765,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handleset_origin(last_duck()); /* ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time())); - if(value.same_as(synfig::Point())) + if(value.same_type_as(synfig::Point())) duck->set_origin(value.get(synfig::Point())); */ // if(!param_desc->get_origin().empty())