27 #ifndef __SYNFIG_STUDIO_DUCKMATIC_H
28 #define __SYNFIG_STUDIO_DUCKMATIC_H
36 #include <ETL/smart_ptr>
39 #include <synfig/vector.h>
40 #include <synfig/string.h>
41 #include <synfig/real.h>
42 #include <sigc++/signal.h>
43 #include <sigc++/object.h>
44 #include <synfig/time.h>
45 #include <synfig/color.h>
46 #include <ETL/smart_ptr>
49 #include <synfig/color.h>
50 #include <synfig/guidset.h>
58 #ifndef __STRING_HASH__
59 #define __STRING_HASH__
62 # ifdef FUNCTIONAL_HASH_ON_STRING
63 HASH_MAP_NAMESPACE::hash<synfig::String> hasher_;
64 # else // FUNCTIONAL_HASH_ON_STRING
65 HASH_MAP_NAMESPACE::hash<const char*> hasher_;
66 # endif // FUNCTIONAL_HASH_ON_STRING
68 size_t operator()(
const synfig::String& x)
const
70 # ifdef FUNCTIONAL_HASH_ON_STRING
72 # else // FUNCTIONAL_HASH_ON_STRING
73 return hasher_(x.c_str());
74 # endif // FUNCTIONAL_HASH_ON_STRING
86 namespace synfigapp {
class ValueDesc;
class CanvasInterface; }
87 namespace synfig {
class ParamDesc; }
105 synfig::Vector last_translate_;
106 synfig::Vector drag_offset_;
108 std::vector<synfig::Vector> positions;
127 synfig::Vector last_translate_;
128 synfig::Vector drag_offset_;
130 synfig::Vector c1_initial;
131 synfig::Vector c2_initial;
164 typedef HASH_MAP_CLASS<synfig::GUID,etl::smart_ptr<synfig::Point>,synfig::GUIDHash>
DuckDataMap;
166 typedef std::map<synfig::GUID,etl::smart_ptr<synfig::Point> >
DuckDataMap;
191 etl::loose_handle<synfigapp::CanvasInterface> canvas_interface;
199 std::list<etl::handle<Stroke> > stroke_list_;
201 std::list<etl::handle<Stroke> > persistent_stroke_list_;
203 synfig::GUIDSet selected_ducks;
205 synfig::GUID last_duck_guid;
207 std::list<etl::handle<Bezier> > bezier_list_;
212 etl::handle<DuckDrag_Base> duck_dragger_;
214 etl::handle<BezierDrag_Base> bezier_dragger_;
216 sigc::signal<void> signal_duck_selection_changed_;
218 sigc::signal<void> signal_strokes_changed_;
220 sigc::signal<void> signal_grid_changed_;
222 mutable sigc::signal<void> signal_sketch_saved_;
227 mutable synfig::String sketch_filename_;
229 synfig::TransformStack curr_transform_stack;
230 bool curr_transform_stack_set;
231 std::list<sigc::connection> duck_changed_connections;
233 bool alternative_mode_;
234 bool lock_animation_mode_;
274 synfig::Vector last_translate_;
275 synfig::Vector drag_offset_;
287 Duckmatic(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface);
353 const std::list<etl::handle<Bezier> >&
bezier_list()
const {
return bezier_list_; }
355 const std::list<etl::handle<Stroke> >&
stroke_list()
const {
return stroke_list_; }
478 void add_stroke(etl::smart_ptr<std::list<synfig::Point> > stroke_point_list,
const synfig::Color& color=synfig::Color(0,0,0));
480 void add_persistent_stroke(etl::smart_ptr<std::list<synfig::Point> > stroke_point_list,
const synfig::Color& color=synfig::Color(0,0,0));
484 void add_duck(
const etl::handle<Duck> &duck);
486 void add_bezier(
const etl::handle<Bezier> &bezier);
488 void erase_duck(
const etl::handle<Duck> &duck);
501 GuideList::iterator
find_guide_x(synfig::Point pos,
float radius=0.1);
502 GuideList::iterator
find_guide_y(synfig::Point pos,
float radius=0.1);
512 etl::handle<Bezier>
find_bezier(synfig::Point pos, synfig::Real radius=0,
float* location=0);
514 etl::handle<Bezier>
find_bezier(synfig::Point pos, synfig::Real scale, synfig::Real radius,
float* location=0);
518 bool add_to_ducks(
const synfigapp::ValueDesc& value_desc,etl::handle<CanvasView> canvas_view,
const synfig::TransformStack& transform_stack_, synfig::ParamDesc *param_desc=0);
531 bool save_sketch(
const synfig::String& filename)
const;
552 std::list<etl::handle<Bezier> > bezier_list_;
553 std::list<etl::handle<Stroke> > stroke_list_;
555 etl::handle<DuckDrag_Base> duck_dragger_;
570 sigc::signal<void,float> signal_user_click_[5];
576 sigc::signal<void,float> &
signal_user_click(
int i=0) { assert(i>=0); assert(i<5);
return signal_user_click_[i]; }
584 sigc::signal<void,float> signal_user_click_[5];
593 sigc::signal<void,float> &
signal_user_click(
int i=0) { assert(i>=0); assert(i<5);
return signal_user_click_[i]; }