Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / loadcanvas.h
index f27ace1..888e1d7 100644 (file)
@@ -1,28 +1,31 @@
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
 /*!    \file loadcanvas.h
 **     \brief writeme
 **
-**     $Id: loadcanvas.h,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
+**     $Id$
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007, 2008 Chris Moore
+**     Copyright (c) 2009 Carlos A. Sosa Navarro
 **
-**     This software and associated documentation
-**     are CONFIDENTIAL and PROPRIETARY property of
-**     the above-mentioned copyright holder.
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
 **
-**     You may not copy, print, publish, or in any
-**     other way distribute this software without
-**     a prior written agreement with
-**     the copyright holder.
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
 **     \endlegal
 */
 /* ========================================================================= */
 
 /* === S T A R T =========================================================== */
 
-#ifndef __SINFG_LOADCANVAS_H
-#define __SINFG_LOADCANVAS_H
+#ifndef __SYNFIG_LOADCANVAS_H
+#define __SYNFIG_LOADCANVAS_H
 
 /* === H E A D E R S ======================================================= */
 
 #include "valuenode_subtract.h"
 #include "valuenode_animated.h"
 #include "valuenode_composite.h"
-#include "valuenode_const.h"
-#include "valuenode_linear.h"
 #include "valuenode_dynamiclist.h"
-#include "valuenode_reference.h"
-#include "valuenode_timedswap.h"
 #include "keyframe.h"
 #include "guid.h"
 
@@ -50,7 +49,7 @@
 
 namespace xmlpp { class Node; class Element; };
 
-namespace sinfg {
+namespace synfig {
 
 /*!    \class CanvasParser
 **     \todo writeme
@@ -75,6 +74,9 @@ private:
 
        String path;
 
+       String errors_text;
+       String warnings_text;
+
        GUID guid_;
 
        /*
@@ -111,17 +113,24 @@ public:
        //! Returns the number of warnings in the last parse
        int warning_count()const { return total_warnings_; }
 
-       void set_path(const sinfg::String& x) { path=x; }
+       void set_path(const synfig::String& x) { path=x; }
 
-       const sinfg::String& get_path()const { return path; }
-       
-       //! \todo writeme
-       Canvas::Handle parse_from_file(const String &filename);
+       const synfig::String& get_path()const { return path; }
+
+       const synfig::String& get_errors_text()const { return errors_text; }
+       const synfig::String& get_warnings_text()const { return warnings_text; }
 
-       Canvas::Handle parse_from_file_as(const String &filename,const String &as);
+       static void register_canvas_in_map(Canvas::Handle canvas, String as);
+
+#ifdef _DEBUG
+       static void show_canvas_map(String file, int line, String text);
+#endif // _DEBUG
 
        //! \todo writeme
-       Canvas::Handle parse_from_string(const String &data);
+       Canvas::Handle parse_from_file_as(const String &filename,const String &as,String &errors);
+       Canvas::Handle parse_as(xmlpp::Element* node,String &errors);
+
+       static std::set<String> loading_;
 
 private:
 
@@ -143,18 +152,18 @@ private:
 
        // ValueBase Parsing Functions
 
-       Real parse_real(xmlpp::Element *node,Canvas::Handle canvas);
+       Real parse_real(xmlpp::Element *node);
        Time parse_time(xmlpp::Element *node,Canvas::Handle canvas);
-       int parse_integer(xmlpp::Element *node,Canvas::Handle canvas);
-       Vector parse_vector(xmlpp::Element *node,Canvas::Handle canvas);
-       Color parse_color(xmlpp::Element *node,Canvas::Handle canvas);
-       Angle parse_angle(xmlpp::Element *node,Canvas::Handle canvas);
-       String parse_string(xmlpp::Element *node,Canvas::Handle canvas);
-       bool parse_bool(xmlpp::Element *node,Canvas::Handle canvas);
-       Segment parse_segment(xmlpp::Element *node,Canvas::Handle canvas);
+       int parse_integer(xmlpp::Element *node);
+       Vector parse_vector(xmlpp::Element *node);
+       Color parse_color(xmlpp::Element *node);
+       Angle parse_angle(xmlpp::Element *node);
+       String parse_string(xmlpp::Element *node);
+       bool parse_bool(xmlpp::Element *node);
+       Segment parse_segment(xmlpp::Element *node);
        ValueBase parse_list(xmlpp::Element *node,Canvas::Handle canvas);
-       Gradient parse_gradient(xmlpp::Element *node,Canvas::Handle canvas);
-       BLinePoint parse_bline_point(xmlpp::Element *node,Canvas::Handle canvas);
+       Gradient parse_gradient(xmlpp::Element *node);
+       BLinePoint parse_bline_point(xmlpp::Element *node);
 
        Keyframe parse_keyframe(xmlpp::Element *node,Canvas::Handle canvas);
 
@@ -162,9 +171,7 @@ private:
 
        etl::handle<ValueNode_Animated> parse_animated(xmlpp::Element *node,Canvas::Handle canvas);
        etl::handle<ValueNode_Subtract> parse_subtract(xmlpp::Element *node,Canvas::Handle canvas);
-       etl::handle<ValueNode_Animated> parse_timedswap(xmlpp::Element *node,Canvas::Handle canvas);
        etl::handle<LinkableValueNode> parse_linkable_value_node(xmlpp::Element *node,Canvas::Handle canvas);
-       etl::handle<ValueNode_Composite> parse_composite(xmlpp::Element *node,Canvas::Handle canvas);
        etl::handle<ValueNode_DynamicList> parse_dynamic_list(xmlpp::Element *node,Canvas::Handle canvas);
 
 }; // END of CanvasParser
@@ -173,15 +180,13 @@ private:
 
 //!    Loads a canvas from \a filename
 /*!    \return The Canvas's handle on success, an empty handle on failure */
-extern Canvas::Handle open_canvas(const String &filename);
-extern Canvas::Handle open_canvas_as(const String &filename,const String &as);
-
-//! Retrieves a Canvas from a string in XML format
-extern Canvas::Handle string_to_canvas(const String &data);
+extern Canvas::Handle open_canvas(xmlpp::Element* node,String &errors,String &warnings);
+extern Canvas::Handle open_canvas(const String &filename,String &errors,String &warnings);
+extern Canvas::Handle open_canvas_as(const String &filename,const String &as,String &errors,String &warnings);
 
-std::map<sinfg::String, etl::loose_handle<Canvas> >& get_open_canvas_map();
+std::map<synfig::String, etl::loose_handle<Canvas> >& get_open_canvas_map();
 
-}; // END of namespace sinfg
+}; // END of namespace synfig
 
 /* === E N D =============================================================== */