synfig-core
1.0.3
|
Canvas is a double ended queue of Layers. It is the base class for a Synfig document. More...
#include <canvas.h>
Public Types | |
typedef etl::handle< Canvas > | Handle |
typedef etl::loose_handle< Canvas > | LooseHandle |
typedef etl::handle< const Canvas > | ConstHandle |
typedef std::list< Handle > | Children |
Public Types inherited from synfig::Node | |
typedef TimePointSet | time_set |
Public Member Functions | |
sigc::signal< void, String, etl::handle< synfig::Layer > > & | signal_group_pair_added () |
sigc::signal< void, String, etl::handle< synfig::Layer > > & | signal_group_pair_removed () |
sigc::signal< void, String > & | signal_group_added () |
Group Added. | |
sigc::signal< void, String > & | signal_group_removed () |
Group Removed. | |
sigc::signal< void, String > & | signal_group_changed () |
Group Changed. | |
sigc::signal< void, int * > & | signal_layers_reordered () |
Layers Reordered. | |
sigc::signal< void > & | signal_rend_desc_changed () |
RendDesc Changed. | |
sigc::signal< void > & | signal_id_changed () |
ID Changed. | |
sigc::signal< void > & | signal_file_name_changed () |
File name Changed. | |
sigc::signal< void, String > & | signal_meta_data_changed () |
Metadata Changed. | |
sigc::signal< void > & | signal_meta_data_changed (const String &key) |
Metadata Changed. | |
sigc::signal< void, etl::handle< ValueNode > > & | signal_value_node_changed () |
Value Node Changed. | |
sigc::signal< void, etl::handle< ValueNode > > & | signal_value_node_renamed () |
Value Node Renamed. | |
sigc::signal< void > & | signal_dirty () |
Dirty. | |
sigc::signal< void, etl::handle< ValueNode > , etl::handle< ValueNode > > & | signal_value_node_child_added () |
Child Value Node Added. | |
sigc::signal< void, etl::handle< ValueNode > , etl::handle< ValueNode > > & | signal_value_node_child_removed () |
Child Value Node Removed. | |
void | invoke_signal_value_node_child_removed (etl::handle< ValueNode >, etl::handle< ValueNode >) |
~Canvas () | |
std::set< etl::handle< Layer > > | get_layers_in_group (const String &group) |
Returns the set of layers in group. | |
std::set< String > | get_groups () const |
Gets all the groups. | |
int | get_group_count () const |
Gets the number of groups in this canvas. | |
void | rename_group (const String &old_name, const String &new_name) |
Renames the given group. | |
bool | is_inline () const |
Returns true if the Canvas is in line. | |
RendDesc & | rend_desc () |
Returns a handle to the RendDesc for this Canvas. | |
const RendDesc & | rend_desc () const |
Returns a handle to the RendDesc for this Canvas. | |
const String & | get_name () const |
Gets the name of the canvas. | |
void | set_name (const String &x) |
Sets the name of the canvas. | |
const String | get_version () const |
Gets the version string of the canvas. | |
void | set_version (const String &x) |
Sets the version string of the canvas. | |
const String & | get_author () const |
Gets the author of the canvas. | |
void | set_author (const String &x) |
Sets the author of the canvas. | |
const String & | get_description () const |
Gets the description of the canvas. | |
String | get_string () const |
void | set_description (const String &x) |
Sets the name of the canvas. | |
const String & | get_id () const |
Gets the ID of the canvas. | |
void | set_id (const String &x) |
Sets the ID of the canvas. | |
String | get_meta_data (const String &key) const |
Returns the data string for the given meta data key. | |
std::list< String > | get_meta_data_keys () const |
Returns a list of meta data keys. | |
void | set_meta_data (const String &key, const String &data) |
Sets a meta data key to a specific string. | |
void | erase_meta_data (const String &key) |
Removes a meta data key. | |
String | get_relative_id (etl::loose_handle< const Canvas > x) const |
Gets the relative ID string for an ancestor Canvas. | |
String | _get_relative_id (etl::loose_handle< const Canvas > x) const |
Gets the relative ID string for an ancestor Canvas. Don't call it directly. | |
bool | is_root () const |
Returns true if the Canvas is a root Canvas. false otherwise. | |
LooseHandle | parent () const |
Returns a handle to the parent Canvas. | |
LooseHandle | get_root () const |
Returns a handle to the root Canvas. | |
LooseHandle | get_non_inline_ancestor () const |
std::list< Handle > & | children () |
Returns a list of all child canvases in this canvas. | |
const std::list< Handle > & | children () const |
Returns a list of all child canvases in this canvas. | |
void | set_time (Time t) const |
Gets the color at the specified point. | |
Time | get_time () const |
Returns the current time of the Canvas. | |
int | size () const |
Returns the number of layers in the canvas. | |
void | clear () |
Removes all the layers from the canvas. | |
bool | empty () const |
Returns true if the canvas has no layers. | |
const ValueNodeList & | value_node_list () const |
Returns a reference to the ValueNodeList for this Canvas. | |
KeyframeList & | keyframe_list () |
Returns a reference to the KeyframeList for this Canvas. | |
const KeyframeList & | keyframe_list () const |
Returns a reference to the KeyframeList for this Canvas. | |
ValueNode::Handle | find_value_node (const String &id, bool might_fail) |
Finds the ValueNode in the Canvas with the given id. | |
ValueNode::Handle | surefind_value_node (const String &id) |
ValueNode::ConstHandle | find_value_node (const String &id, bool might_fail) const |
Finds the ValueNode in the Canvas with the given id. | |
void | add_value_node (ValueNode::Handle x, const String &id) |
Adds a Value node by its Id. | |
void | remove_value_node (ValueNode::Handle x, bool might_fail) |
writeme | |
void | remove_value_node (const String &id, bool might_fail) |
Removes a Value Node from the Canvas by its Id. | |
Handle | surefind_canvas (const String &id, String &warnings) |
Finds a child Canvas in the Canvas with the given name. | |
Handle | find_canvas (const String &id, String &warnings) |
Finds a child Canvas in the Canvas with the given id. | |
ConstHandle | find_canvas (const String &id, String &warnings) const |
Finds a child Canvas in the Canvas with the given id. | |
String | get_file_path () const |
Sets the file path for the Canvas. | |
void | set_file_name (const String &) |
Sets the filename (with path) | |
String | get_file_name () const |
Gets the filename (with path) | |
void | set_identifier (const FileSystem::Identifier &) |
Sets the file identifier. | |
const FileSystem::Identifier & | get_identifier () const |
Gets the file identifier. | |
Handle | new_child_canvas () |
Creates a new child canvas, and returns its handle. | |
Handle | new_child_canvas (const String &id) |
Creates a new child canvas with an ID of id, and returns its handle. | |
Handle | add_child_canvas (Handle child_canvas, const String &id) |
Adds the given canvas as a child. | |
void | remove_child_canvas (Handle child_canvas) |
etl::handle< Layer > | find_layer (const ContextParams &context_params, const Point &pos) |
int | get_depth (etl::handle< Layer >) const |
Gets the depth of a particular Layer by its handle. | |
IndependentContext | get_independent_context () const |
Retireves the first layer of the double queue of Layers. | |
Context | get_context (const ContextParams ¶ms) const |
Retireves the first layer of the double queue of Layers assigned with rendering parameters. | |
Context | get_context (const Context &parent_context) const |
Retireves the first layer of the double queue of Layers assigned with rendering parameters. | |
iterator | end () |
Returns the last Canvas layer queue iterator. Notice that it. | |
const_iterator | end () const |
Returns the last Canvas layer queue const_iterator. Notice that it. | |
reverse_iterator | rbegin () |
Returns the last Canvas layer queue reverse iterator. Notice that it. | |
const_reverse_iterator | rbegin () const |
Returns the last Canvas layer queue reverse const iterator. Notice that it. | |
etl::handle< Layer > & | back () |
Returns last layer in Canvas layer stack. | |
const etl::handle< Layer > & | back () const |
Returns last layer in Canvas layer stack. | |
void | push_back (etl::handle< Layer > x) |
void | push_front (etl::handle< Layer > x) |
Inserts a layer just at the beggining of the Canvas layer dqueue. | |
void | push_back_simple (etl::handle< Layer > x) |
void | insert (iterator iter, etl::handle< Layer > x) |
void | erase (iterator iter) |
void | set_inline (LooseHandle parent) |
Handle | clone (const GUID &deriv_guid=GUID(), bool for_export=false) const |
Clones (copies) the Canvas. | |
void | register_external_canvas (String file, Handle canvas) |
Stores the external canvas by its file name and the Canvas handle. | |
Real | get_grow_value () const |
Set/Get members for the grow value. | |
void | set_grow_value (Real x) |
void | fill_sound_processor (SoundProcessor &soundProcessor) const |
Public Member Functions inherited from synfig::Node | |
sigc::signal< void > & | signal_deleted () |
sigc::signal< void > & | signal_changed () |
sigc::signal< void, GUID > & | signal_guid_changed () |
GUID Changed. | |
virtual | ~Node () |
void | changed () |
const GUID & | get_guid () const |
Gets the GUID for this Node. | |
virtual void | set_guid (const GUID &x) |
Sets the GUID for this Node. | |
int | get_time_last_changed () const |
Gets the time when the Node was changed. | |
void | add_child (Node *x) |
Adds the parameter as the child of the current Node. | |
void | remove_child (Node *x) |
Removes the parameter as a child of the current Node. | |
int | parent_count () const |
Returns how many parenst has the current Node. | |
const time_set & | get_times () const |
Returns the cached times values for all the children. | |
RWLock & | get_rw_lock () const |
Writeme! |
Static Public Member Functions | |
static Handle | create () |
Returns a Canvas handle with "Untitled" as ID. | |
static Handle | create_inline (Handle parent) |
Creates an inline Canvas for a given Canvas . |
Protected Member Functions | |
Canvas (const String &name) | |
Canvas constructor by Canvas name. | |
virtual void | on_changed () |
Sets the Canvas to dirty and calls Node::on_changed() | |
virtual void | get_times_vfunc (Node::time_set &set) const |
Protected Member Functions inherited from synfig::Node | |
Node () | |
void | begin_delete () |
virtual void | on_guid_changed (GUID guid) |
Friends | |
void | synfig::optimize_layers (Time, Context, Canvas::Handle, bool seen_motion_blur) |
Additional Inherited Members | |
Public Attributes inherited from synfig::Node | |
std::set< Node * > | parent_set |
Canvas is a double ended queue of Layers. It is the base class for a Synfig document.
As a node it inherits all the parent child relationship and the GUID methods. As a double queue it allows insertion and deletion of Layers and can access to the layers on the queue easily.
typedef etl::handle<Canvas> synfig::Canvas::Handle |
typedef etl::loose_handle<Canvas> synfig::Canvas::LooseHandle |
typedef etl::handle<const Canvas> synfig::Canvas::ConstHandle |
typedef std::list<Handle> synfig::Canvas::Children |
|
protected |
Canvas constructor by Canvas name.
References clear(), synfig::FileSystem::Identifier::file_system, and synfig::FileSystemNative::instance().
Referenced by clone(), create(), and create_inline().
Canvas::~Canvas | ( | ) |
|
inline |
|
inline |
|
inline |
Group Added.
|
inline |
Group Removed.
|
inline |
Group Changed.
|
inline |
Layers Reordered.
|
inline |
RendDesc Changed.
|
inline |
ID Changed.
sigc::signal< void > & Canvas::signal_file_name_changed | ( | ) |
File name Changed.
References parent().
|
inline |
Metadata Changed.
Referenced by erase_meta_data(), set_author(), set_description(), set_meta_data(), and set_name().
|
inline |
Metadata Changed.
|
inline |
|
inline |
|
inline |
Dirty.
References synfig::Node::signal_changed().
|
inline |
Referenced by invoke_signal_value_node_child_removed().
std::set< String > Canvas::get_groups | ( | ) | const |
Gets all the groups.
References is_inline().
int Canvas::get_group_count | ( | ) | const |
Gets the number of groups in this canvas.
References is_inline().
Renames the given group.
References get_layers_in_group(), and is_inline().
|
inline |
Returns true if the Canvas is in line.
Referenced by _get_relative_id(), add_child_canvas(), add_value_node(), clone(), find_canvas(), find_value_node(), get_group_count(), get_groups(), get_layers_in_group(), get_non_inline_ancestor(), get_relative_id(), keyframe_list(), new_child_canvas(), remove_child_canvas(), remove_value_node(), rename_group(), set_id(), surefind_canvas(), surefind_value_node(), and value_node_list().
|
inline |
Returns a handle to the RendDesc for this Canvas.
Referenced by clone(), new_child_canvas(), and set_inline().
|
inline |
|
inline |
Gets the name of the canvas.
void Canvas::set_name | ( | const String & | x | ) |
Sets the name of the canvas.
References signal_meta_data_changed().
|
inline |
Gets the version string of the canvas.
|
inline |
Sets the version string of the canvas.
|
inline |
Gets the author of the canvas.
void Canvas::set_author | ( | const String & | x | ) |
Sets the author of the canvas.
References signal_meta_data_changed().
|
inline |
Gets the description of the canvas.
Referenced by get_string().
|
virtual |
Implements synfig::Node.
References get_description().
void Canvas::set_description | ( | const String & | x | ) |
Sets the name of the canvas.
References signal_meta_data_changed().
|
inline |
Gets the ID of the canvas.
Referenced by _get_relative_id(), and clone().
void Canvas::set_id | ( | const String & | x | ) |
Sets the ID of the canvas.
References is_inline(), and valid_id().
Returns the data string for the given meta data key.
std::list< String > Canvas::get_meta_data_keys | ( | ) | const |
Returns a list of meta data keys.
Sets a meta data key to a specific string.
References signal_meta_data_changed().
void Canvas::erase_meta_data | ( | const String & | key | ) |
Removes a meta data key.
References signal_meta_data_changed().
Gets the relative ID string for an ancestor Canvas.
References _get_relative_id(), and is_inline().
Gets the relative ID string for an ancestor Canvas. Don't call it directly.
References get_file_name(), get_id(), get_root(), is_inline(), is_root(), and parent().
Referenced by get_relative_id().
|
inline |
Returns true
if the Canvas is a root Canvas. false
otherwise.
Referenced by _get_relative_id(), and set_time().
|
inline |
Returns a handle to the parent Canvas.
The returned handle will be empty if this is a root canvas
Referenced by _get_relative_id(), clone(), get_file_name(), get_file_path(), get_identifier(), set_file_name(), set_inline(), and signal_file_name_changed().
Canvas::LooseHandle Canvas::get_root | ( | ) | const |
Returns a handle to the root Canvas.
Referenced by _get_relative_id(), find_canvas(), and surefind_canvas().
Canvas::LooseHandle Canvas::get_non_inline_ancestor | ( | ) | const |
References is_inline().
Referenced by invoke_signal_value_node_child_removed().
|
inline |
Returns a list of all child canvases in this canvas.
Referenced by add_child_canvas(), find_canvas(), new_child_canvas(), remove_child_canvas(), and surefind_canvas().
|
inline |
Returns a list of all child canvases in this canvas.
void Canvas::set_time | ( | Time | t | ) | const |
Gets the color at the specified point.
Sets the time for all the layers in the canvas
References get_independent_context(), get_time(), synfig::info(), is_root(), and synfig::IndependentContext::set_time().
|
inline |
Returns the current time of the Canvas.
Referenced by set_time().
int Canvas::size | ( | ) | const |
void Canvas::clear | ( | ) |
Removes all the layers from the canvas.
References synfig::Node::changed(), empty(), erase(), and push_back().
bool Canvas::empty | ( | ) | const |
Returns true if the canvas has no layers.
References size().
Referenced by add_value_node(), clear(), find_canvas(), find_value_node(), surefind_canvas(), and surefind_value_node().
const ValueNodeList & Canvas::value_node_list | ( | ) | const |
Returns a reference to the ValueNodeList for this Canvas.
Returns a reference to the ValueNodeList for this Canvas
References is_inline().
KeyframeList & Canvas::keyframe_list | ( | ) |
Returns a reference to the KeyframeList for this Canvas.
References is_inline().
const KeyframeList & Canvas::keyframe_list | ( | ) | const |
Returns a reference to the KeyframeList for this Canvas.
References is_inline().
ValueNode::Handle Canvas::find_value_node | ( | const String & | id, |
bool | might_fail | ||
) |
Finds the ValueNode in the Canvas with the given id.
Referenced by remove_value_node().
ValueNode::Handle Canvas::surefind_value_node | ( | const String & | id | ) |
References empty(), is_inline(), synfig::ValueNodeList::surefind(), and surefind_canvas().
ValueNode::ConstHandle Canvas::find_value_node | ( | const String & | id, |
bool | might_fail | ||
) | const |
Finds the ValueNode in the Canvas with the given id.
References synfig::ValueNode::breakpoint(), empty(), synfig::ValueNodeList::find(), find_canvas(), and is_inline().
void Canvas::add_value_node | ( | ValueNode::Handle | x, |
const String & | id | ||
) |
Adds a Value node by its Id.
Throws an error if the Id is not ! correct or the Value node is already exported
References synfig::ValueNodeList::add(), empty(), synfig::error(), synfig::ValueNodeList::find(), and is_inline().
void Canvas::remove_value_node | ( | ValueNode::Handle | x, |
bool | might_fail | ||
) |
writeme
Removes a Value Node from the Canvas by its Handle
References synfig::ValueNode::breakpoint(), synfig::ValueNodeList::erase(), and is_inline().
|
inline |
Removes a Value Node from the Canvas by its Id.
References find_value_node(), and remove_value_node().
Referenced by remove_value_node().
Canvas::Handle Canvas::surefind_canvas | ( | const String & | id, |
String & | warnings | ||
) |
Finds a child Canvas in the Canvas with the given name.
References children(), empty(), get_file_name(), get_file_path(), get_identifier(), get_root(), is_inline(), new_child_canvas(), and synfig::open_canvas_as().
Referenced by surefind_value_node().
Canvas::Handle Canvas::find_canvas | ( | const String & | id, |
String & | warnings | ||
) |
Finds a child Canvas in the Canvas with the given id.
Referenced by add_child_canvas(), find_canvas(), and find_value_node().
Canvas::ConstHandle Canvas::find_canvas | ( | const String & | id, |
String & | warnings | ||
) | const |
Finds a child Canvas in the Canvas with the given id.
References children(), empty(), find_canvas(), get_file_path(), get_identifier(), get_root(), is_inline(), and synfig::open_canvas_as().
String Canvas::get_file_path | ( | ) | const |
Sets the file path for the Canvas.
Returns the file path from the file name
References parent().
Referenced by find_canvas(), register_external_canvas(), and surefind_canvas().
void Canvas::set_file_name | ( | const String & | file_name_orig | ) |
Sets the filename (with path)
References synfig::FileSystem::fix_slashes(), synfig::get_open_canvas_map(), parent(), and synfig::CanvasParser::register_canvas_in_map().
String Canvas::get_file_name | ( | ) | const |
Gets the filename (with path)
References parent().
Referenced by _canvas_file_name_changed(), _get_relative_id(), _remove_from_open_canvas_map(), clone(), and surefind_canvas().
void Canvas::set_identifier | ( | const FileSystem::Identifier & | identifier | ) |
Sets the file identifier.
const FileSystem::Identifier & Canvas::get_identifier | ( | ) | const |
Canvas::Handle Canvas::new_child_canvas | ( | ) |
Creates a new child canvas, and returns its handle.
References back(), children(), create(), is_inline(), and rend_desc().
Referenced by surefind_canvas().
Canvas::Handle Canvas::new_child_canvas | ( | const String & | id | ) |
Creates a new child canvas with an ID of id, and returns its handle.
References back(), children(), create(), is_inline(), and rend_desc().
Canvas::Handle Canvas::add_child_canvas | ( | Canvas::Handle | child_canvas, |
const String & | id | ||
) |
Adds the given canvas as a child.
References children(), find_canvas(), is_inline(), and valid_id().
void Canvas::remove_child_canvas | ( | Canvas::Handle | child_canvas | ) |
Remove Child Canvas by its handle. If Current canvas is a child of a parent it ask to the parent to remove the Child canvas.
References children(), end(), and is_inline().
etl::handle< Layer > Canvas::find_layer | ( | const ContextParams & | context_params, |
const Point & | pos | ||
) |
Finds a Layer by its position.
References get_context(), and synfig::Context::hit_check().
int Canvas::get_depth | ( | etl::handle< Layer > | layer | ) | const |
IndependentContext Canvas::get_independent_context | ( | ) | const |
Retireves the first layer of the double queue of Layers.
Referenced by get_context(), set_grow_value(), and set_time().
Context Canvas::get_context | ( | const ContextParams & | params | ) | const |
Retireves the first layer of the double queue of Layers assigned with rendering parameters.
References get_independent_context().
Referenced by find_layer(), and get_context().
Retireves the first layer of the double queue of Layers assigned with rendering parameters.
References get_context(), and synfig::Context::get_params().
Canvas::iterator Canvas::end | ( | ) |
Returns the last Canvas layer queue iterator. Notice that it.
overrides the std::end() member that would return an interator just past the last element of the queue.
Referenced by back(), clone(), end(), get_depth(), get_times_vfunc(), push_back(), push_back_simple(), and remove_child_canvas().
Canvas::const_iterator Canvas::end | ( | ) | const |
Canvas::reverse_iterator Canvas::rbegin | ( | ) |
Canvas::const_reverse_iterator Canvas::rbegin | ( | ) | const |
Layer::Handle & Canvas::back | ( | ) |
const Layer::Handle & Canvas::back | ( | ) | const |
void Canvas::push_back | ( | etl::handle< Layer > | x | ) |
void Canvas::push_front | ( | etl::handle< Layer > | x | ) |
void Canvas::push_back_simple | ( | etl::handle< Layer > | x | ) |
Inserts a layer in the last position of the Canvas layer dqueue Uses the standard methods and doesn't perform any parentship or signal update
References synfig::Node::changed(), end(), and insert().
void Canvas::insert | ( | iterator | iter, |
etl::handle< Layer > | x | ||
) |
Inserts a layer before the given position by and performs the proper child parent relationships and signals update
References synfig::Node::add_child(), and synfig::Node::changed().
Referenced by push_back(), push_back_simple(), and push_front().
void Canvas::erase | ( | iterator | iter | ) |
Removes a layer from the Canvas layer dqueue and its group and parent relatioship. Although it is not already used, it clears the connections see connections_
References synfig::Node::changed(), and synfig::Node::remove_child().
Referenced by clear().
void Canvas::set_inline | ( | LooseHandle | parent | ) |
Sets to be a inline canvas of a given Canvas . The inline Canvas inherits the groups and the render description.
References _, parent(), and rend_desc().
|
static |
Returns a Canvas handle with "Untitled" as ID.
References Canvas().
Referenced by new_child_canvas(), synfig::Target_Scanline::render(), synfig::Target_Tile::render(), and synfig::Target_Cairo_Tile::render().
|
static |
Creates an inline Canvas for a given Canvas .
Referenced by synfig::optimize_layers().
Canvas::Handle Canvas::clone | ( | const GUID & | deriv_guid = GUID() , |
bool | for_export = false |
||
) | const |
Clones (copies) the Canvas.
References _, Canvas(), end(), synfig::error(), get_file_name(), synfig::Node::get_guid(), get_id(), is_inline(), parent(), rend_desc(), and size().
Stores the external canvas by its file name and the Canvas handle.
References get_file_path().
Real Canvas::get_grow_value | ( | ) | const |
Set/Get members for the grow value.
void Canvas::set_grow_value | ( | Real | x | ) |
|
protectedvirtual |
Sets the Canvas to dirty and calls Node::on_changed()
Reimplemented from synfig::Node.
|
protectedvirtual |
Collects the times (TimePoints) of the Layers of the Canvas and stores it in the passed Time Set
Implements synfig::Node.
References end(), and synfig::TimePointSet::insert().
void Canvas::fill_sound_processor | ( | SoundProcessor & | soundProcessor | ) | const |
|
friend |