#include "onemoment.h"
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
}
}
-
-
Duckmatic::GuideList::iterator
Duckmatic::find_guide_x(synfig::Point pos, float radius)
{
select_duck(duck);
}
-
void
Duckmatic::translate_selected_ducks(const synfig::Vector& vector)
{
for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++)
{
- if((*iter)->get_type()!=Duck::TYPE_VERTEX&&(*iter)->get_type()!=Duck::TYPE_POSITION)continue;
+ if((*iter)->get_type()!=Duck::TYPE_VERTEX &&
+ (*iter)->get_type()!=Duck::TYPE_POSITION)
+ continue;
(*iter)->set_trans_point(positions[i]+vect);
}
for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++)
{
- if((*iter)->get_type()==Duck::TYPE_VERTEX||(*iter)->get_type()==Duck::TYPE_POSITION)continue;
+ if((*iter)->get_type()==Duck::TYPE_VERTEX ||
+ (*iter)->get_type()==Duck::TYPE_POSITION)
+ continue;
(*iter)->set_trans_point(positions[i]+vect);
}
last_translate_=vect;
}
-
-
-
-
-
-
-
-
-
void
Duckmatic::signal_edited_selected_ducks()
{
// Go ahead and call everyone's signals
for(iter=ducks.begin();iter!=ducks.end();++iter)
{
- if(!(*iter)->signal_edited()((*iter)->get_point()))
+ if ((*iter)->get_type() == Duck::TYPE_ANGLE)
{
- selected_ducks=old_set;
- throw String("Bad edit");
+ if(!(*iter)->signal_edited_angle()((*iter)->get_rotations()))
+ {
+ selected_ducks=old_set;
+ throw String("Bad edit");
+ }
+ }
+ else
+ {
+ if(!(*iter)->signal_edited()((*iter)->get_point()))
+ {
+ selected_ducks=old_set;
+ throw String("Bad edit");
+ }
}
}
selected_ducks=old_set;
}
}
-
-
-
-
void
Duckmatic::add_duck(const etl::handle<Duck> &duck)
{
return bezier_list_.back();
}
-
etl::handle<Duckmatic::Duck>
Duckmatic::find_duck(synfig::Point point, synfig::Real radius, Duck::Type type)
{
return 0;
}
-
-
bool
Duckmatic::save_sketch(const synfig::String& filename)const
{
+ ChangeLocale change_locale(LC_NUMERIC, "C");
std::ofstream file(filename.c_str());
if(!file)return false;
bool
Duckmatic::load_sketch(const synfig::String& filename)
{
+ ChangeLocale change_locale(LC_NUMERIC, "C");
std::ifstream file(filename.c_str());
if(!file)
return false;
}
-
etl::smart_ptr<std::list<synfig::Point> > stroke_data;
while(file)
return true;
}
-
-
-
-
-
-
-
Duckmatic::Push::Push(Duckmatic *duckmatic_):
duckmatic_(duckmatic_)
{
needs_restore=false;
}
-
-
-
-
-
-
-
-
inline String guid_string(const synfigapp::ValueDesc& x)
{
if(x.parent_is_layer_param())
duck->set_scalar(param_desc->get_scalar());
}
- duck->signal_edited().clear();
+ duck->signal_edited().clear(); // value_desc.get_value_type() == ValueBase::TYPE_REAL:
duck->signal_edited().connect(
sigc::bind(
sigc::mem_fun(
duck->set_scalar(param_desc->get_scalar());
}
- duck->signal_edited().clear();
- duck->signal_edited().connect(
+ duck->signal_edited().clear(); // value_desc.get_value_type() == ValueBase::TYPE_ANGLE:
+ duck->signal_edited_angle().clear();
+ duck->signal_edited_angle().connect(
sigc::bind(
sigc::mem_fun(
*canvas_view,
- &studio::CanvasView::on_duck_changed
+ &studio::CanvasView::on_duck_angle_changed
),
value_desc
)
else
duck->set_type(Duck::TYPE_POSITION);
-
- duck->signal_edited().clear();
+ duck->signal_edited().clear(); // value_desc.get_value_type() == ValueBase::TYPE_VECTOR:
duck->signal_edited().connect(
sigc::bind(
sigc::mem_fun(
bezier->c1->set_scalar(TANGENT_BEZIER_SCALE);
bezier->c1->set_tangent(true);
-
if(!add_to_ducks(synfigapp::ValueDesc(value_node,2),canvas_view,transform_stack))
return false;
bezier->p2=last_duck();
ValueNode_Composite::Handle value_node;
value_node=ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node());
-
if(!add_to_ducks(synfigapp::ValueDesc(value_node,0),canvas_view,transform_stack))
return false;
etl::handle<Duck> vertex_duck(last_duck());
return true;
}
-
break;
default:
break;