synfig-studio  1.0.3
Classes | Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
studio::Duckmatic Class Reference

#include <duckmatic.h>

Inheritance diagram for studio::Duckmatic:
studio::WorkArea

Classes

struct  Bezier
class  Push
struct  Stroke

Public Types

typedef std::map< synfig::GUID,
etl::smart_ptr< synfig::Point > > 
DuckDataMap
typedef studio::DuckMap DuckMap
typedef studio::Duck Duck
typedef Duck::Type Type
typedef std::list< float > GuideList

Public Member Functions

 Duckmatic (etl::loose_handle< synfigapp::CanvasInterface > canvas_interface)
virtual ~Duckmatic ()
void set_alternative_mode (bool x)
bool get_alternative_mode () const
void set_lock_animation_mode (bool x)
bool get_lock_animation_mode () const
sigc::signal< void > & signal_duck_selection_changed ()
sigc::signal< void > & signal_strokes_changed ()
sigc::signal< void > & signal_grid_changed ()
sigc::signal< void > & signal_sketch_saved ()
GuideListget_guide_list_x ()
GuideListget_guide_list_y ()
const GuideListget_guide_list_x () const
const GuideListget_guide_list_y () const
void set_guide_snap (bool x=true)
bool get_guide_snap () const
void toggle_guide_snap ()
void set_guides_color (const synfig::Color &c)
 Sets the color of the guides.
const synfig::Color & get_guides_color () const
 Returns the color of the guides.
void set_grid_snap (bool x=true)
 Sets the state of the grid snap flag.
bool get_grid_snap () const
 Gets the state of the grid snap flag.
void enable_grid_snap ()
void disable_grid_snap ()
void toggle_grid_snap ()
synfig::Point snap_point_to_grid (const synfig::Point &x) const
bool get_show_persistent_strokes () const
void set_show_persistent_strokes (bool x)
void set_grid_size (const synfig::Vector &s)
 Sets the size of the grid.
void set_grid_color (const synfig::Color &c)
 Sets the color of the grid.
const synfig::Vector & get_grid_size () const
 Returns the size of the grid.
const synfig::Color & get_grid_color () const
 Returns the color of the grid.
const synfig::Time & get_time () const
bool get_axis_lock () const
void set_axis_lock (bool x)
void set_time (synfig::Time x)
bool is_duck_group_selectable (const etl::handle< Duck > &x) const
DuckList get_duck_list () const
const std::list< etl::handle
< Bezier > > & 
bezier_list () const
const std::list< etl::handle
< Stroke > > & 
stroke_list () const
const std::list< etl::handle
< Stroke > > & 
persistent_stroke_list () const
std::list< etl::handle< Stroke > > & persistent_stroke_list ()
etl::handle< Duckget_selected_duck () const
 Return first selected duck (handle) has const Duck etl::handle.
DuckList get_selected_ducks () const
 Return list of selected ducks (handles)
DuckList get_ducks_in_box (const synfig::Vector &tl, const synfig::Vector &br) const
 Return list of box contained ducks (handles). The box is defined by a vector's pair.
void refresh_selected_ducks ()
void clear_selected_ducks ()
 Clear all selected ducks.
int count_selected_ducks () const
 Return the number of selected ducks.
bool duck_is_selected (const etl::handle< Duck > &duck) const
 Give the selection status of a duck.
void toggle_select_duck (const etl::handle< Duck > &duck)
 Toggle the duck (handle)
void select_duck (const etl::handle< Duck > &duck)
 Select the duck (handle)
void unselect_duck (const etl::handle< Duck > &duck)
 Unselect the duck (handle)
void toggle_select_ducks_in_box (const synfig::Vector &tl, const synfig::Vector &br)
 Toggle the ducks (handles) contained in the box defined by a pair of vectors.
void select_ducks_in_box (const synfig::Vector &tl, const synfig::Vector &br)
 Select the ducks (handles) contained in the box defined by a pair of vectors.
const synfig::TransformStack & get_curr_transform_stack () const
void clear_curr_transform_stack ()
etl::handle< Bezierget_selected_bezier () const
void start_duck_drag (const synfig::Vector &offset)
 Begin dragging ducks.
void translate_selected_ducks (const synfig::Vector &vector)
 Continue dragging the selected ducks.
void update_ducks ()
 Update the coordinates of tangents and linked-to-bline ducks.
bool end_duck_drag ()
 Ends the duck drag.
void start_bezier_drag (const synfig::Vector &offset, float bezier_click_pos)
void translate_selected_bezier (const synfig::Vector &vector)
bool end_bezier_drag ()
void signal_user_click_selected_ducks (int button)
 Signals to each selected duck that it has been clicked.
void signal_edited_duck (const etl::handle< Duck > &duck, bool moving=false)
 Calls a single duck's edited signal.
void signal_edited_selected_ducks (bool moving=false)
 Calls all of the ducks' edited signals.
bool on_duck_changed (const studio::Duck &duck, const synfigapp::ValueDesc &value_desc)
etl::handle< Duckfind_similar_duck (etl::handle< Duck > duck)
etl::handle< Duckadd_similar_duck (etl::handle< Duck > duck)
void add_stroke (etl::smart_ptr< std::list< synfig::Point > > stroke_point_list, const synfig::Color &color=synfig::Color(0, 0, 0))
void add_persistent_stroke (etl::smart_ptr< std::list< synfig::Point > > stroke_point_list, const synfig::Color &color=synfig::Color(0, 0, 0))
void clear_persistent_strokes ()
void add_duck (const etl::handle< Duck > &duck)
void add_bezier (const etl::handle< Bezier > &bezier)
void erase_duck (const etl::handle< Duck > &duck)
void erase_bezier (const etl::handle< Bezier > &bezier)
etl::handle< Ducklast_duck () const
 Returns the last duck added.
etl::handle< Bezierlast_bezier () const
etl::handle< Duckfind_duck (synfig::Point pos, synfig::Real radius=0, Duck::Type type=Duck::TYPE_DEFAULT)
GuideList::iterator find_guide_x (synfig::Point pos, float radius=0.1)
GuideList::iterator find_guide_y (synfig::Point pos, float radius=0.1)
GuideList::const_iterator find_guide_x (synfig::Point pos, float radius=0.1) const
GuideList::const_iterator find_guide_y (synfig::Point pos, float radius=0.1) const
etl::handle< Bezierfind_bezier (synfig::Point pos, synfig::Real radius=0, float *location=0)
etl::handle< Bezierfind_bezier (synfig::Point pos, synfig::Real scale, synfig::Real radius, float *location=0)
void add_ducks_layers (synfig::Canvas::Handle canvas, std::set< synfig::Layer::Handle > &selected_layer_set, etl::handle< CanvasView > canvas_view, synfig::TransformStack &transform_stack)
bool add_to_ducks (const synfigapp::ValueDesc &value_desc, etl::handle< CanvasView > canvas_view, const synfig::TransformStack &transform_stack_, synfig::ParamDesc *param_desc=0)
void set_type_mask (Type x)
 Set the type mask, which determines what types of ducks are shown.
Type get_type_mask () const
 Get the type mask, which determines what types of ducks are shown.
void select_all_ducks ()
void unselect_all_ducks ()
void clear_ducks ()
bool save_sketch (const synfig::String &filename) const
bool load_sketch (const synfig::String &filename)
const synfig::String & get_sketch_filename () const
void set_duck_dragger (etl::handle< DuckDrag_Base > x)
etl::handle< DuckDrag_Baseget_duck_dragger () const
void clear_duck_dragger ()
void set_bezier_dragger (etl::handle< BezierDrag_Base > x)
etl::handle< BezierDrag_Baseget_bezier_dragger () const
void clear_bezier_dragger ()

Protected Attributes

etl::handle< Bezierselected_bezier
synfig::Time cur_time
bool grid_snap
 This flag is set if operations should snap to the grid.
bool guide_snap
synfig::Vector grid_size
 This vector describes the grid size.
synfig::Color grid_color
 Hold the grid color.
synfig::Color guides_color
 Hold the guides color.
float zoom
 Zoom factor.
float prev_zoom
 Previous Zoom factor.
bool show_persistent_strokes
bool axis_lock

Friends

class DuckDrag_Base
class DuckDrag_Translate
class Push

Detailed Description

This class helps organize any of the devices displayed in the work area that the user may want to interact with. This includes ducks, beziers, and strokes

Member Typedef Documentation

typedef std::map<synfig::GUID,etl::smart_ptr<synfig::Point> > studio::Duckmatic::DuckDataMap
typedef std::list<float> studio::Duckmatic::GuideList

Constructor & Destructor Documentation

Duckmatic::Duckmatic ( etl::loose_handle< synfigapp::CanvasInterface canvas_interface)
Duckmatic::~Duckmatic ( )
virtual

References clear_ducks().

Member Function Documentation

void studio::Duckmatic::set_alternative_mode ( bool  x)
inline
bool studio::Duckmatic::get_alternative_mode ( ) const
inline

Referenced by on_duck_changed().

void studio::Duckmatic::set_lock_animation_mode ( bool  x)
inline
bool studio::Duckmatic::get_lock_animation_mode ( ) const
inline

Referenced by on_duck_changed().

sigc::signal<void>& studio::Duckmatic::signal_duck_selection_changed ( )
inline
sigc::signal<void>& studio::Duckmatic::signal_strokes_changed ( )
inline
sigc::signal<void>& studio::Duckmatic::signal_grid_changed ( )
inline
sigc::signal<void>& studio::Duckmatic::signal_sketch_saved ( )
inline
GuideList& studio::Duckmatic::get_guide_list_x ( )
inline
GuideList& studio::Duckmatic::get_guide_list_y ( )
inline
const GuideList& studio::Duckmatic::get_guide_list_x ( ) const
inline
const GuideList& studio::Duckmatic::get_guide_list_y ( ) const
inline
void Duckmatic::set_guide_snap ( bool  x = true)
bool studio::Duckmatic::get_guide_snap ( ) const
inline
void studio::Duckmatic::toggle_guide_snap ( )
inline

Reimplemented in studio::WorkArea.

References get_guide_snap(), and set_guide_snap().

void Duckmatic::set_guides_color ( const synfig::Color &  c)

Sets the color of the guides.

Reimplemented in studio::WorkArea.

References guides_color, and signal_grid_changed().

const synfig::Color& studio::Duckmatic::get_guides_color ( ) const
inline

Returns the color of the guides.

Reimplemented in studio::WorkArea.

References guides_color.

void Duckmatic::set_grid_snap ( bool  x = true)

Sets the state of the grid snap flag.

References grid_snap, and signal_grid_changed().

Referenced by disable_grid_snap(), enable_grid_snap(), studio::WorkArea::load_meta_data(), and toggle_grid_snap().

bool studio::Duckmatic::get_grid_snap ( ) const
inline

Gets the state of the grid snap flag.

References grid_snap.

Referenced by studio::WorkArea::save_meta_data(), and snap_point_to_grid().

void studio::Duckmatic::enable_grid_snap ( )
inline

References set_grid_snap().

void studio::Duckmatic::disable_grid_snap ( )
inline

References set_grid_snap().

void studio::Duckmatic::toggle_grid_snap ( )
inline

Reimplemented in studio::WorkArea.

References grid_snap, and set_grid_snap().

Point Duckmatic::snap_point_to_grid ( const synfig::Point &  x) const
bool studio::Duckmatic::get_show_persistent_strokes ( ) const
inline
void Duckmatic::set_show_persistent_strokes ( bool  x)
void Duckmatic::set_grid_size ( const synfig::Vector &  s)

Sets the size of the grid.

Reimplemented in studio::WorkArea.

References grid_size, and signal_grid_changed().

void Duckmatic::set_grid_color ( const synfig::Color &  c)

Sets the color of the grid.

Reimplemented in studio::WorkArea.

References grid_color, and signal_grid_changed().

const synfig::Vector& studio::Duckmatic::get_grid_size ( ) const
inline
const synfig::Color& studio::Duckmatic::get_grid_color ( ) const
inline

Returns the color of the grid.

Reimplemented in studio::WorkArea.

References grid_color.

const synfig::Time& studio::Duckmatic::get_time ( ) const
inline
bool studio::Duckmatic::get_axis_lock ( ) const
inline

References axis_lock.

void studio::Duckmatic::set_axis_lock ( bool  x)
inline

References axis_lock.

void studio::Duckmatic::set_time ( synfig::Time  x)
inline

References cur_time.

bool Duckmatic::is_duck_group_selectable ( const etl::handle< Duck > &  x) const
DuckList Duckmatic::get_duck_list ( ) const
const std::list<etl::handle<Bezier> >& studio::Duckmatic::bezier_list ( ) const
inline

Referenced by find_bezier().

const std::list<etl::handle<Stroke> >& studio::Duckmatic::stroke_list ( ) const
inline
const std::list<etl::handle<Stroke> >& studio::Duckmatic::persistent_stroke_list ( ) const
inline
std::list<etl::handle<Stroke> >& studio::Duckmatic::persistent_stroke_list ( )
inline
etl::handle< Duckmatic::Duck > Duckmatic::get_selected_duck ( ) const

Return first selected duck (handle) has const Duck etl::handle.

DuckList Duckmatic::get_selected_ducks ( ) const
DuckList Duckmatic::get_ducks_in_box ( const synfig::Vector &  tl,
const synfig::Vector &  br 
) const

Return list of box contained ducks (handles). The box is defined by a vector's pair.

Parameters
tlThe top left canvas coordinate has const synfig::Vector
brThe bottom right canvas coordinate has const synfig::Vector
Returns
ducks (handles) has const DuckList
See Also
toggle_select_ducks_in_box, select_ducks_in_box, find_duck
void Duckmatic::refresh_selected_ducks ( )
void Duckmatic::clear_selected_ducks ( )

Clear all selected ducks.

int Duckmatic::count_selected_ducks ( ) const

Return the number of selected ducks.

Returns
the number of selected ducks (handles) has int
bool Duckmatic::duck_is_selected ( const etl::handle< Duck > &  duck) const

Give the selection status of a duck.

Returns
true if the given duck (handle) is currently selected

Referenced by toggle_select_duck().

void Duckmatic::toggle_select_duck ( const etl::handle< Duck > &  duck)

Toggle the duck (handle)

Parameters
duckThe duck (handle) to toggle has etl::handle parameter

References duck_is_selected(), select_duck(), and unselect_duck().

Referenced by toggle_select_ducks_in_box().

void Duckmatic::select_duck ( const etl::handle< Duck > &  duck)

Select the duck (handle)

Parameters
duckThe duck (handle) to select has etl::handle parameter

Referenced by select_all_ducks(), select_ducks_in_box(), and toggle_select_duck().

void Duckmatic::unselect_duck ( const etl::handle< Duck > &  duck)

Unselect the duck (handle)

Parameters
duckThe duck (handle) to unselect has etl::handle parameter

Referenced by select_all_ducks(), toggle_select_duck(), and unselect_all_ducks().

void Duckmatic::toggle_select_ducks_in_box ( const synfig::Vector &  tl,
const synfig::Vector &  br 
)

Toggle the ducks (handles) contained in the box defined by a pair of vectors.

Parameters
tlThe top left canvas coordinate has const synfig::Vector
brThe bottom right canvas coordinate has const synfig::Vector
See Also
toggle_select_duck, select_ducks_in_box, get_ducks_in_box

References is_duck_group_selectable(), and toggle_select_duck().

void Duckmatic::select_ducks_in_box ( const synfig::Vector &  tl,
const synfig::Vector &  br 
)

Select the ducks (handles) contained in the box defined by a pair of vectors.

Parameters
tlThe top left canvas coordinate has const synfig::Vector
brThe bottom right canvas coordinate has const synfig::Vector
See Also
toggle_select_ducks_in_box, select_ducks_in_box, clear_selected_ducks

References is_duck_group_selectable(), and select_duck().

const synfig::TransformStack& studio::Duckmatic::get_curr_transform_stack ( ) const
inline
void studio::Duckmatic::clear_curr_transform_stack ( )
inline
etl::handle< Duckmatic::Bezier > Duckmatic::get_selected_bezier ( ) const
void Duckmatic::start_duck_drag ( const synfig::Vector &  offset)

Begin dragging ducks.

Parameters
offsetCanvas coordinates of the mouse when the drag began

References find_duck().

void Duckmatic::translate_selected_ducks ( const synfig::Vector &  vector)

Continue dragging the selected ducks.

The overall vector of the drag is vector-offset (where offset was given in start_duck_drag)

Parameters
vectorCanvas coordinates of the mouse at this moment
void Duckmatic::update_ducks ( )
bool Duckmatic::end_duck_drag ( )

Ends the duck drag.

void Duckmatic::start_bezier_drag ( const synfig::Vector &  offset,
float  bezier_click_pos 
)
Todo:
writeme
void Duckmatic::translate_selected_bezier ( const synfig::Vector &  vector)
bool Duckmatic::end_bezier_drag ( )
void Duckmatic::signal_user_click_selected_ducks ( int  button)

Signals to each selected duck that it has been clicked.

References get_selected_ducks().

Referenced by studio::DuckDrag_Translate::end_duck_drag().

void Duckmatic::signal_edited_duck ( const etl::handle< Duck > &  duck,
bool  moving = false 
)

Calls a single duck's edited signal.

Updates the corresponding valuenodes after a drag

References studio::App::restrict_radius_ducks, and studio::Duck::TYPE_ANGLE.

Referenced by studio::BezierDrag_Default::bezier_drag(), studio::BezierDrag_Default::end_bezier_drag(), and signal_edited_selected_ducks().

void Duckmatic::signal_edited_selected_ducks ( bool  moving = false)

Calls all of the ducks' edited signals.

Updates corresponding valuenodes after a drag

References get_selected_ducks(), and signal_edited_duck().

Referenced by studio::DuckDrag_Translate::duck_drag(), and studio::DuckDrag_Translate::end_duck_drag().

bool Duckmatic::on_duck_changed ( const studio::Duck duck,
const synfigapp::ValueDesc value_desc 
)
etl::handle< Duckmatic::Duck > Duckmatic::find_similar_duck ( etl::handle< Duck duck)

Referenced by add_similar_duck().

etl::handle< Duckmatic::Duck > Duckmatic::add_similar_duck ( etl::handle< Duck duck)

References add_duck(), and find_similar_duck().

Referenced by add_to_ducks().

void Duckmatic::add_stroke ( etl::smart_ptr< std::list< synfig::Point > >  stroke_point_list,
const synfig::Color &  color = synfig::Color(0,0,0) 
)

Referenced by add_persistent_stroke().

void Duckmatic::add_persistent_stroke ( etl::smart_ptr< std::list< synfig::Point > >  stroke_point_list,
const synfig::Color &  color = synfig::Color(0,0,0) 
)

References add_stroke().

Referenced by load_sketch().

void Duckmatic::clear_persistent_strokes ( )
void Duckmatic::add_duck ( const etl::handle< Duck > &  duck)
void Duckmatic::add_bezier ( const etl::handle< Bezier > &  bezier)

Referenced by add_to_ducks().

void Duckmatic::erase_duck ( const etl::handle< Duck > &  duck)
void Duckmatic::erase_bezier ( const etl::handle< Bezier > &  bezier)
etl::handle< Duckmatic::Duck > Duckmatic::last_duck ( ) const

Returns the last duck added.

Referenced by add_to_ducks().

etl::handle< Duckmatic::Bezier > Duckmatic::last_bezier ( ) const

Referenced by add_to_ducks().

etl::handle< Duckmatic::Duck > Duckmatic::find_duck ( synfig::Point  pos,
synfig::Real  radius = 0,
Duck::Type  type = Duck::TYPE_DEFAULT 
)
Duckmatic::GuideList::iterator Duckmatic::find_guide_x ( synfig::Point  pos,
float  radius = 0.1 
)

Referenced by snap_point_to_grid().

Duckmatic::GuideList::iterator Duckmatic::find_guide_y ( synfig::Point  pos,
float  radius = 0.1 
)

Referenced by snap_point_to_grid().

GuideList::const_iterator studio::Duckmatic::find_guide_x ( synfig::Point  pos,
float  radius = 0.1 
) const
inline

References find_guide_x().

Referenced by find_guide_x().

GuideList::const_iterator studio::Duckmatic::find_guide_y ( synfig::Point  pos,
float  radius = 0.1 
) const
inline

References find_guide_y().

Referenced by find_guide_y().

etl::handle< Duckmatic::Bezier > Duckmatic::find_bezier ( synfig::Point  pos,
synfig::Real  radius = 0,
float *  location = 0 
)
Note
parameter is in canvas coordinates

A radius of "zero" will have an unlimited radius

Note
parameter is in canvas coordinates

A radius of "zero" will have an unlimited radius

etl::handle< Duckmatic::Bezier > Duckmatic::find_bezier ( synfig::Point  pos,
synfig::Real  scale,
synfig::Real  radius,
float *  location = 0 
)

References bezier_list().

void Duckmatic::add_ducks_layers ( synfig::Canvas::Handle  canvas,
std::set< synfig::Layer::Handle > &  selected_layer_set,
etl::handle< CanvasView canvas_view,
synfig::TransformStack &  transform_stack 
)
bool Duckmatic::add_to_ducks ( const synfigapp::ValueDesc value_desc,
etl::handle< CanvasView canvas_view,
const synfig::TransformStack &  transform_stack_,
synfig::ParamDesc *  param_desc = 0 
)
void studio::Duckmatic::set_type_mask ( Type  x)
inline

Set the type mask, which determines what types of ducks are shown.

Type studio::Duckmatic::get_type_mask ( ) const
inline

Get the type mask, which determines what types of ducks are shown.

Referenced by add_to_ducks(), find_duck(), get_selected_ducks(), is_duck_group_selectable(), and studio::WorkArea::PushState::PushState().

void Duckmatic::select_all_ducks ( )
void Duckmatic::unselect_all_ducks ( )

References unselect_duck().

void Duckmatic::clear_ducks ( )

References show_persistent_strokes.

Referenced by ~Duckmatic().

bool Duckmatic::save_sketch ( const synfig::String &  filename) const
bool Duckmatic::load_sketch ( const synfig::String &  filename)
const synfig::String& studio::Duckmatic::get_sketch_filename ( ) const
inline
void studio::Duckmatic::set_duck_dragger ( etl::handle< DuckDrag_Base x)
inline
etl::handle<DuckDrag_Base> studio::Duckmatic::get_duck_dragger ( ) const
inline
void studio::Duckmatic::clear_duck_dragger ( )
inline

References DuckDrag_Translate.

Referenced by Duckmatic().

void studio::Duckmatic::set_bezier_dragger ( etl::handle< BezierDrag_Base x)
inline
etl::handle<BezierDrag_Base> studio::Duckmatic::get_bezier_dragger ( ) const
inline
void studio::Duckmatic::clear_bezier_dragger ( )
inline

Referenced by Duckmatic().

Friends And Related Function Documentation

friend class DuckDrag_Base
friend
friend class DuckDrag_Translate
friend

Referenced by clear_duck_dragger().

friend class Push
friend

Member Data Documentation

etl::handle<Bezier> studio::Duckmatic::selected_bezier
protected

Referenced by get_selected_bezier().

synfig::Time studio::Duckmatic::cur_time
protected

Referenced by get_time(), and set_time().

bool studio::Duckmatic::grid_snap
protected

This flag is set if operations should snap to the grid.

Todo:
perhaps there should be two of these flags, one for each axis?
See Also
show_grid, grid_size

Referenced by get_grid_snap(), set_grid_snap(), and toggle_grid_snap().

bool studio::Duckmatic::guide_snap
protected
synfig::Vector studio::Duckmatic::grid_size
protected

This vector describes the grid size.

See Also
grid_snap, show_grid

Referenced by get_grid_size(), and set_grid_size().

synfig::Color studio::Duckmatic::grid_color
protected

Hold the grid color.

Referenced by get_grid_color(), and set_grid_color().

synfig::Color studio::Duckmatic::guides_color
protected

Hold the guides color.

Referenced by get_guides_color(), and set_guides_color().

float studio::Duckmatic::zoom
protected
float studio::Duckmatic::prev_zoom
protected

Previous Zoom factor.

bool studio::Duckmatic::show_persistent_strokes
protected
bool studio::Duckmatic::axis_lock
protected

The documentation for this class was generated from the following files: