Added copyright lines for files I've edited this year.
[synfig.git] / synfig-core / trunk / src / synfig / canvas.h
index 73a6193..faa0288 100644 (file)
@@ -2,10 +2,11 @@
 /*!    \file canvas.h
 **     \brief Canvas Class Implementation
 **
-**     $Id: canvas.h,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
+**     $Id$
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007, 2008 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
@@ -31,6 +32,7 @@
 #include <list>
 #include <ETL/handle>
 #include <sigc++/signal.h>
+#include <sigc++/connection.h>
 
 #include "vector.h"
 #include "string.h"
 
 /* === M A C R O S ========================================================= */
 
+/* version change history:
+ *
+ * 0.1: the original version
+ *
+ *      if a waypoint goes from -179 to 179 degrees, that is a 2
+ *      degree change.  there's no way to express a 720 degree
+ *      rotation with a single pair of waypoints
+ *
+ * 0.2: svn r1227
+ *
+ *      angles no longer wrap at -180 degrees back to 180 degrees; if
+ *      a waypoint goes from -179 to 179 degrees, that is a rotation
+ *      of 358 degrees.  loading a version 0.1 canvas will modify
+ *      constant angle waypoints to that they are within 180 degrees
+ *      of the previous waypoint's value
+ *
+ *      the 'straight' blend method didn't used to work properly.  it
+ *      didn't work at all on transparent pixels in layers other than
+ *      the PasteCanvas layer.  for example, the examples/japan.sifz
+ *      file has a red circle (straight, amount=1.0) on top of a
+ *      striped conical gradient.  if 'straight' was working, the
+ *      conical gradient would be entirely obscured by the circle
+ *      layer (even by its transparent pixels)
+ *
+ * 0.3: svn r1422
+ *
+ *      the 'straight' blend method was fixed.  loading a version 0.2
+ *      or older canvas will replace the 'straight' blend method in
+ *      non-pastecanvas layers with 'composite'
+ */
+
+#define CURRENT_CANVAS_VERSION "0.3"
+
 /* === T Y P E D E F S ===================================================== */
 
 /* === C L A S S E S & S T R U C T S ======================================= */
@@ -68,7 +103,7 @@ public:
 
        typedef std::list<Handle> Children;
 
-       friend void synfig::optimize_layers(Context, Canvas::Handle);
+       friend void synfig::optimize_layers(Time, Context, Canvas::Handle, bool seen_motion_blur);
 
        /*
  --    ** -- D A T A -------------------------------------------------------------
@@ -88,6 +123,10 @@ private:
        /*!     \see set_description(), get_description() */
        String description_;
 
+       //! Contains the canvas' version string
+       /*!     \see set_version(), get_version() */
+       String version_;
+
        //! Contains the author's name
        /*!     \see set_author(), get_author() */
        String author_;
@@ -141,6 +180,9 @@ private:
        //! Layer Group database
        std::map<String,std::set<etl::handle<Layer> > > group_db_;
 
+       //! Layer Connection database
+       std::map<etl::loose_handle<Layer>,std::vector<sigc::connection> > connections_;
+
        /*
  -- ** -- S I G N A L S -------------------------------------------------------
        */
@@ -184,6 +226,8 @@ private:
        //!     ValueBasenode Changed
        sigc::signal<void, etl::handle<ValueNode> > signal_value_node_changed_;
 
+       sigc::signal<void, etl::handle<ValueNode> > signal_value_node_renamed_;
+
        sigc::signal<void, etl::handle<ValueNode>, etl::handle<ValueNode> > signal_value_node_child_added_;
 
        sigc::signal<void, etl::handle<ValueNode>, etl::handle<ValueNode> > signal_value_node_child_removed_;
@@ -227,6 +271,8 @@ public:
 
        sigc::signal<void, etl::handle<ValueNode> >& signal_value_node_changed() { return signal_value_node_changed_; }
 
+       sigc::signal<void, etl::handle<ValueNode> >& signal_value_node_renamed() { return signal_value_node_renamed_; }
+
        //!     Dirty
        sigc::signal<void>& signal_dirty() { return signal_changed();   }
 
@@ -281,6 +327,12 @@ public:
        //! Sets the name of the canvas
        void set_name(const String &x);
 
+       //! Gets the version string of the canvas
+       const String get_version()const { return version_; }
+
+       //! Sets the version string of the canvas
+       void set_version(const String &x) { version_ = x; }
+
        //! Gets the author of the canvas
        const String & get_author()const { return author_; }
 
@@ -380,7 +432,7 @@ public:
        //! \writeme
        void add_value_node(ValueNode::Handle x, const String &id);
 
-       //! \writeme
+       //! writeme
        //void rename_value_node(ValueNode::Handle x, const String &id);
 
        //! \writeme
@@ -423,7 +475,7 @@ public:
        //! Creates a new child canvas, and returns its handle
        Handle new_child_canvas();
 
-       //! Creates a new child canvas with an ID of \aid, and returns its handle
+       //! Creates a new child canvas with an ID of \a id, and returns its handle
        Handle new_child_canvas(const String &id);
 
        //! Adds the given canvas as a child
@@ -469,13 +521,15 @@ public:
 private:
        void add_group_pair(String group, etl::handle<Layer> layer);
        void remove_group_pair(String group, etl::handle<Layer> layer);
+       void add_connection(etl::loose_handle<Layer> layer, sigc::connection connection);
+       void disconnect_connections(etl::loose_handle<Layer> layer);
 
 protected:
        virtual void on_changed();
        virtual void get_times_vfunc(Node::time_set &set) const;
 }; // END of class Canvas
 
-void optimize_layers(Context context, Canvas::Handle op_canvas);
+void optimize_layers(Time time, Context context, Canvas::Handle op_canvas, bool seen_motion_blur=false);
 
 
 }; // END of namespace synfig