-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file canvas.cpp
** \brief Canvas Class Member Definitions
**
** $Id: canvas.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
**
** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
-** 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
*/
/* ========================================================================= */
/* === H E A D E R S ======================================================= */
-#define SINFG_NO_ANGLE
+#define SYNFIG_NO_ANGLE
#ifdef USING_PCH
# include "pch.h"
#endif
-using namespace sinfg;
+using namespace synfig;
using namespace etl;
using namespace std;
-namespace sinfg { extern Canvas::Handle open_canvas(const String &filename); };
+namespace synfig { extern Canvas::Handle open_canvas(const String &filename); };
/* === M A C R O S ========================================================= */
~_CanvasCounter()
{
if(counter)
- sinfg::error("%d canvases not yet deleted!",counter);
+ synfig::error("%d canvases not yet deleted!",counter);
}
} _canvas_counter;
while(!empty())
{
Layer::Handle layer(front());
- //if(layer->count()>2)sinfg::info("before layer->count()=%d",layer->count());
+ //if(layer->count()>2)synfig::info("before layer->count()=%d",layer->count());
erase(begin());
- //if(layer->count()>1)sinfg::info("after layer->count()=%d",layer->count());
+ //if(layer->count()>1)synfig::info("after layer->count()=%d",layer->count());
}
//CanvasBase::clear();
#if 0
if(is_root())
{
- sinfg::info("is_dirty_=%d",is_dirty_);
- sinfg::info("get_time()=%f",(float)get_time());
- sinfg::info("t=%f",(float)t);
+ synfig::info("is_dirty_=%d",is_dirty_);
+ synfig::info("get_time()=%f",(float)get_time());
+ synfig::info("t=%f",(float)t);
}
#endif
Canvas::LooseHandle
Canvas::get_root()const
{
- return parent_?parent_->get_root().get():const_cast<sinfg::Canvas *>(this);
+ return parent_?parent_->get_root().get():const_cast<synfig::Canvas *>(this);
}
int
String value_node_id(id,id.rfind(':')+1);
if(canvas_id.empty())
canvas_id=':';
- //sinfg::warning("constfind:value_node_id: "+value_node_id);
- //sinfg::warning("constfind:canvas_id: "+canvas_id);
+ //synfig::warning("constfind:value_node_id: "+value_node_id);
+ //synfig::warning("constfind:canvas_id: "+canvas_id);
return find_canvas(canvas_id)->value_node_list_.find(value_node_id);
}
if(!value_node_list_.add(x))
{
- sinfg::error("Unable to add ValueNode");
+ synfig::error("Unable to add ValueNode");
throw std::runtime_error("Unable to add ValueNode");
}
//DEBUGPOINT();
//! \todo This needs alot more optimization
String file_name(id,0,id.find_first_of('#'));
String external_id(id,id.find_first_of('#')+1);
+
+ file_name=unix_to_local_path(file_name);
Canvas::Handle external_canvas;
if(is_absolute_path(file_name))
external_canvas=open_canvas(file_name);
else
- external_canvas=open_canvas(get_file_path()+'/'+file_name);
+ external_canvas=open_canvas(get_file_path()+ETL_DIRECTORY_SEPERATOR+file_name);
if(!external_canvas)
throw Exception::FileNotFound(file_name);
return *iter;
// Create a new canvas and return it
- //sinfg::warning("Implicitly creating canvas named "+id);
+ //synfig::warning("Implicitly creating canvas named "+id);
return new_child_canvas(id);
}
String file_name(id,0,id.find_first_of('#'));
String external_id(id,id.find_first_of('#')+1);
+ file_name=unix_to_local_path(file_name);
+
Canvas::Handle external_canvas;
// If the composition is already open, then use it.
if(is_absolute_path(file_name))
external_canvas=open_canvas(file_name);
else
- external_canvas=open_canvas(get_file_path()+'/'+file_name);
+ external_canvas=open_canvas(get_file_path()+ETL_DIRECTORY_SEPERATOR+file_name);
if(!external_canvas)
throw Exception::FileNotFound(file_name);
// DEBUGPOINT();
// int i(x->count());
insert(end(),x);
- //if(x->count()!=i+1)sinfg::info("push_back before %d, after %d",i,x->count());
+ //if(x->count()!=i+1)synfig::info("push_back before %d, after %d",i,x->count());
}
void
// DEBUGPOINT();
// int i(x->count());
insert(begin(),x);
- //if(x->count()!=i+1)sinfg::error("push_front before %d, after %d",i,x->count());
+ //if(x->count()!=i+1)synfig::error("push_front before %d, after %d",i,x->count());
}
void
/*if(x->count()!=i+1)
{
- sinfg::error(__FILE__":%d: Canvas::insert(): ***FAILURE*** before %d, after %d",__LINE__,i,x->count());
+ synfig::error(__FILE__":%d: Canvas::insert(): ***FAILURE*** before %d, after %d",__LINE__,i,x->count());
return;
//throw runtime_error("Canvas Insertion Failed");
}*/
Canvas::Handle
Canvas::clone(const GUID& deriv_guid)const
{
- sinfg::String name;
+ synfig::String name;
if(is_inline())
name="inline";
else
canvas->push_back(layer);
if(!(layer.count()>1))
{
- sinfg::error("Canvas::clone(): Cloned layer insertion failure!");
- sinfg::error("Canvas::clone(): \tlayer.count()=%d",layer.count());
- sinfg::error("Canvas::clone(): \tlayer->get_name()=%s",layer->get_name().c_str());
- sinfg::error("Canvas::clone(): \tbefore size()=%d",presize);
- sinfg::error("Canvas::clone(): \tafter size()=%d",size());
+ synfig::error("Canvas::clone(): Cloned layer insertion failure!");
+ synfig::error("Canvas::clone(): \tlayer.count()=%d",layer.count());
+ synfig::error("Canvas::clone(): \tlayer->get_name()=%s",layer->get_name().c_str());
+ synfig::error("Canvas::clone(): \tbefore size()=%d",presize);
+ synfig::error("Canvas::clone(): \tafter size()=%d",size());
}
assert(layer.count()>1);
}
else
{
- sinfg::error("Unable to clone layer");
+ synfig::error("Unable to clone layer");
}
}
}
Canvas::Handle
-Canvas::add_child_canvas(Canvas::Handle child_canvas, const sinfg::String& id)
+Canvas::add_child_canvas(Canvas::Handle child_canvas, const synfig::String& id)
{
if(is_inline() && parent_)
return parent_->add_child_canvas(child_canvas,id);
}
void
-sinfg::optimize_layers(Context context, Canvas::Handle op_canvas)
+synfig::optimize_layers(Context context, Canvas::Handle op_canvas)
{
Context iter;
{
Canvas::Handle sub_canvas(Canvas::create_inline(op_canvas));
optimize_layers(paste_canvas->get_sub_canvas()->get_context(),sub_canvas);
-//#define SINFG_OPTIMIZE_PASTE_CANVAS 1
+//#define SYNFIG_OPTIMIZE_PASTE_CANVAS 1
-#ifdef SINFG_OPTIMIZE_PASTE_CANVAS
+#ifdef SYNFIG_OPTIMIZE_PASTE_CANVAS
Canvas::iterator sub_iter;
// Determine if we can just remove the paste canvas
// altogether