SYNFIG_IMPORTER_SET_CVS_ID(bmp_mptr,"$Id$");
/* === M E T H O D S ======================================================= */
+namespace synfig {
struct BITMAPFILEHEADER
{
unsigned long biClrImportant;
};
+}
+
#ifdef WORDS_BIGENDIAN
inline long little_endian(const long &x)
{
return false;
}
- BITMAPFILEHEADER fileheader;
- BITMAPINFOHEADER infoheader;
+ synfig::BITMAPFILEHEADER fileheader;
+ synfig::BITMAPINFOHEADER infoheader;
char b_char=fgetc(file);
char m_char=fgetc(file);
return false;
}
- if(fread(&fileheader.bfSize, 1, sizeof(BITMAPFILEHEADER)-4, file)!=sizeof(BITMAPFILEHEADER)-4)
+ if(fread(&fileheader.bfSize, 1, sizeof(synfig::BITMAPFILEHEADER)-4, file)!=sizeof(synfig::BITMAPFILEHEADER)-4)
{
String str("bmp_mptr::get_frame(): "+strprintf(_("Failure while reading BITMAPFILEHEADER from %s"),filename.c_str()));
if(cb)cb->error(str);
return false;
}
- if(fread(&infoheader, 1, sizeof(BITMAPINFOHEADER), file)!=sizeof(BITMAPINFOHEADER))
+ if(fread(&infoheader, 1, sizeof(synfig::BITMAPINFOHEADER), file)!=sizeof(synfig::BITMAPINFOHEADER))
{
String str("bmp_mptr::get_frame(): "+strprintf(_("Failure while reading BITMAPINFOHEADER from %s"),filename.c_str()));
if(cb)cb->error(str);
int offset=little_endian(fileheader.bfOffsetBits);
- if(offset!=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)-2)
+ if(offset!=sizeof(synfig::BITMAPFILEHEADER)+sizeof(synfig::BITMAPINFOHEADER)-2)
{
- String str("bmp_mptr::get_frame(): "+strprintf(_("Bad BITMAPFILEHEADER in %s. (bfOffsetBits=%d, should be %d)"),filename.c_str(),offset,sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)-2));
+ String str("bmp_mptr::get_frame(): "+strprintf(_("Bad BITMAPFILEHEADER in %s. (bfOffsetBits=%d, should be %d)"),filename.c_str(),offset,sizeof(synfig::BITMAPFILEHEADER)+sizeof(synfig::BITMAPINFOHEADER)-2));
if(cb)cb->error(str);
else synfig::error(str);
return false;
SYNFIG_TARGET_SET_CVS_ID(bmp,"$Id$");
/* === C L A S S E S & S T R U C T S ======================================= */
-
+namespace synfig {
+
struct BITMAPFILEHEADER
{
unsigned char bfType[2];
unsigned long biClrImportant;
};
+}
/* === M E T H O D S ======================================================= */
#ifdef WORDS_BIGENDIAN
return false;
}
- BITMAPFILEHEADER fileheader;
- BITMAPINFOHEADER infoheader;
+ synfig::BITMAPFILEHEADER fileheader;
+ synfig::BITMAPINFOHEADER infoheader;
fileheader.bfType[0]='B';
fileheader.bfType[1]='M';
- fileheader.bfSize=little_endian(sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+rowspan*h);
+ fileheader.bfSize=little_endian(sizeof(synfig::BITMAPFILEHEADER)+sizeof(synfig::BITMAPINFOHEADER)+rowspan*h);
fileheader.bfReserved1=0;
fileheader.bfReserved2=0;
- fileheader.bfOffsetBits=little_endian(sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)-2);
+ fileheader.bfOffsetBits=little_endian(sizeof(synfig::BITMAPFILEHEADER)+sizeof(synfig::BITMAPINFOHEADER)-2);
infoheader.biSize=little_endian(40);
infoheader.biWidth=little_endian(w);
fprintf(file,"BM");
- if(!fwrite(&fileheader.bfSize,sizeof(BITMAPFILEHEADER)-4,1,file))
+ if(!fwrite(&fileheader.bfSize,sizeof(synfig::BITMAPFILEHEADER)-4,1,file))
{
if(callback)callback->error(_("Unable to write file header to file"));
else synfig::error(_("Unable to write file header to file"));
return false;
}
- if(!fwrite(&infoheader,sizeof(BITMAPINFOHEADER),1,file))
+ if(!fwrite(&infoheader,sizeof(synfig::BITMAPINFOHEADER),1,file))
{
if(callback)callback->error(_("Unable to write info header"));
else synfig::error(_("Unable to write info header"));
/* === G L O B A L S ======================================================= */
#ifdef HASH_MAP_H
-typedef HASH_MAP_CLASS<GUID,Node*,GUIDHash> GlobalNodeMap;
+typedef HASH_MAP_CLASS<synfig::GUID,Node*,GUIDHash> GlobalNodeMap;
#else
-typedef map<GUID,Node*> GlobalNodeMap;
+typedef map<synfig::GUID,Node*> GlobalNodeMap;
#endif
static GlobalNodeMap* global_node_map_;
/* === P R O C E D U R E S ================================================= */
synfig::Node*
-synfig::find_node(const GUID& guid)
+synfig::find_node(const synfig::GUID& guid)
{
if(global_node_map().count(guid)==0)
return 0;
}
static void
-refresh_node(synfig::Node* node, GUID old_guid)
+refresh_node(synfig::Node* node, synfig::GUID old_guid)
{
assert(global_node_map().count(old_guid));
global_node_map().erase(old_guid);
//! Gets the GUID for this value node
-const GUID&
+const synfig::GUID&
Node::get_guid()const
{
#ifdef BE_FRUGAL_WITH_GUIDS
if(!guid_)
{
- const_cast<GUID&>(guid_).make_unique();
+ const_cast<synfig::GUID&>(guid_).make_unique();
assert(guid_);
assert(!global_node_map().count(guid_));
global_node_map()[guid_]=const_cast<Node*>(this);
//! Sets the GUID for this value node
void
-Node::set_guid(const GUID& x)
+Node::set_guid(const synfig::GUID& x)
{
assert(x);
#endif
if(guid_!=x)
{
- GUID oldguid(guid_);
+ synfig::GUID oldguid(guid_);
guid_=x;
refresh_node(this, oldguid);
on_guid_changed(oldguid);
}
void
-Node::on_guid_changed(GUID guid)
+Node::on_guid_changed(synfig::GUID guid)
{
signal_guid_changed()(guid);
}
Time r,s;
public:
- ValueNode* clone(const GUID& deriv_guid)const
+ ValueNode* clone(const synfig::GUID& deriv_guid)const
{
{ ValueNode* x(find_value_node(get_guid()^deriv_guid).get()); if(x)return x; }
_Hermite<T>* ret(new _Hermite<T>());
Time r,s;
public:
- ValueNode* clone(const GUID& deriv_guid)const
+ ValueNode* clone(const synfig::GUID& deriv_guid)const
{
{ ValueNode* x(find_value_node(get_guid()^deriv_guid).get()); if(x)return x; }
_Constant<T>* ret(new _Constant<T>());
Time r,s;
public:
- ValueNode* clone(const GUID& deriv_guid)const
+ ValueNode* clone(const synfig::GUID& deriv_guid)const
{
{ ValueNode* x(find_value_node(get_guid()^deriv_guid).get()); if(x)return x; }
_AnimBool* ret(new _AnimBool());
# include <config.h>
#endif
+#ifdef WIN32
+#define WINVER 0x0500
+#include <windows.h>
+#endif
+
#include <fstream>
#include <iostream>
#include <locale>
#include <fmod.h>
#endif
-#ifdef WIN32
-#define _WIN32_WINNT 0x0500
-#include <windows.h>
-#endif
#include <gtkmm/accelmap.h>
#include <gtkmm/filechooser.h>
#include <gtkmm/filechooserdialog.h>
{
if(value_desc_.is_value_node())
return value_desc_.get_value_node()->get_guid();
- return GUID::hasher(get_name());
+ return synfig::GUID::hasher(get_name());
}
void
Duck::set_name(const synfig::String &x)
{
name=x;
- if(guid_==GUID::zero())
+ if(guid_==synfig::GUID::zero())
{
- guid_=GUID::hasher(name);
+ guid_=synfig::GUID::hasher(name);
}
}
return strprintf("%s",x.get_value_node()->get_guid().get_string().c_str());
}
-inline GUID calc_duck_guid(const synfigapp::ValueDesc& x,const synfig::TransformStack& transform_stack)
+inline synfig::GUID calc_duck_guid(const synfigapp::ValueDesc& x,const synfig::TransformStack& transform_stack)
{
- GUID ret(0);
+ synfig::GUID ret(0);
if(x.parent_is_layer_param())
{
- ret=x.get_layer()->get_guid()^GUID::hasher(x.get_param_name());
+ ret=x.get_layer()->get_guid()^synfig::GUID::hasher(x.get_param_name());
}
else
{
Duck::Handle
Duckmatic::create_duck_from(const synfigapp::ValueDesc& value_desc,etl::handle<CanvasView> canvas_view, const synfig::TransformStack& transform_stack, int modifier, synfig::ParamDesc *param_desc)
{
- GUID duck_guid(calc_duck_guid(value_desc,transform_stack)^GUID::hasher(modifier));
+ synfig::GUID duck_guid(calc_duck_guid(value_desc,transform_stack)^synfig::GUID::hasher(modifier));
etl::handle<Duck> duck=new Duck();
return duck;
0.0f),
value_desc));
- duck->set_guid(calc_duck_guid(value_desc,transform_stack)^GUID::hasher(multiple));
+ duck->set_guid(calc_duck_guid(value_desc,transform_stack)^synfig::GUID::hasher(multiple));
add_duck(duck);
&studio::CanvasView::popup_param_menu),
0.0f),
value_desc));
- duck->set_guid(calc_duck_guid(value_desc,transform_stack)^GUID::hasher(multiple));
+ duck->set_guid(calc_duck_guid(value_desc,transform_stack)^synfig::GUID::hasher(multiple));
add_duck(duck);
{
synfigapp::ValueDesc value_desc_origin(value_desc.get_layer(),param_desc->get_connect());
Duck::Handle connect_duck;
- if(duck_map.find(calc_duck_guid(value_desc_origin,transform_stack)^GUID::hasher(0))!=duck_map.end())
+ if(duck_map.find(calc_duck_guid(value_desc_origin,transform_stack)^synfig::GUID::hasher(0))!=duck_map.end())
{
- connect_duck=duck_map[calc_duck_guid(value_desc_origin,transform_stack)^GUID::hasher(0)];
+ connect_duck=duck_map[calc_duck_guid(value_desc_origin,transform_stack)^synfig::GUID::hasher(0)];
}
else
{
&studio::CanvasView::popup_param_menu),
1.0f),
value_desc));
- duck->set_guid(calc_duck_guid(value_desc,transform_stack)^GUID::hasher(multiple));
+ duck->set_guid(calc_duck_guid(value_desc,transform_stack)^synfig::GUID::hasher(multiple));
add_duck(duck);
return true;
*/
}
}
- duck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".v"));
+ duck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^synfig::GUID::hasher(".v"));
duck=add_similar_duck(duck);
// add_duck(duck);
}
tduck->set_editable(false);
tduck->set_name(guid_string(synfigapp::ValueDesc(value_node,i))+".t1");
// tduck->set_name(strprintf("%x-tangent1",value_node->get_link(i).get()));
- tduck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".t1"));
+ tduck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^synfig::GUID::hasher(".t1"));
tduck=add_similar_duck(tduck);
// add_duck(duck);
}
tduck->set_transform_stack(transform_stack);
tduck->set_name(guid_string(synfigapp::ValueDesc(value_node,i))+".t2");
- tduck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^GUID::hasher(".t2"));
+ tduck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,i),transform_stack)^synfig::GUID::hasher(".t2"));
tduck->set_editable(false);
tduck=add_similar_duck(tduck);
// add_duck(duck);
tduck->set_name(guid_string(synfigapp::ValueDesc(value_node,first))+".t1");
//tduck->set_name(strprintf("%x-tangent1",value_node->get_link(first).get()));
tduck=add_similar_duck(tduck);
- tduck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,first),transform_stack)^GUID::hasher(".t1"));
+ tduck->set_guid(calc_duck_guid(synfigapp::ValueDesc(value_node,first),transform_stack)^synfig::GUID::hasher(".t1"));
//add_duck(duck);
}
//return Gtk::Button().render_icon(value_icon(type),Gtk::ICON_SIZE_SMALL_TOOLBAR);
return _tree_pixbuf_table_value_type[int(type)];
}
-
+#define TEMPORARY_DELETE_MACRO DELETE
+#undef DELETE
Gtk::StockID
studio::get_action_stock_id(const synfigapp::Action::BookEntry& action)
{
action.task);
return stock_id;
}
+#define DELETE TEMPORARY_DELETE_MACRO
+#undef TEMPORARY_DELETE_MACRO
Gtk::StockID
studio::layer_icon(const synfig::String &layer)
duck->signal_user_click(2).connect(
sigc::bind(sigc::mem_fun(*this,&studio::StateBLine_Context::popup_vertex_menu),value_node)
);
- duck->set_guid(value_node->get_guid()^GUID::hasher(0));
+ duck->set_guid(value_node->get_guid()^synfig::GUID::hasher(0));
get_work_area()->add_duck(duck);
tduck->set_origin(duck);
tduck->set_scalar(-0.33333333333333333);
tduck->set_tangent(true);
- tduck->set_guid(value_node->get_guid()^GUID::hasher(3));
+ tduck->set_guid(value_node->get_guid()^synfig::GUID::hasher(3));
tduck->signal_edited().connect(
sigc::bind(sigc::mem_fun(*this,&studio::StateBLine_Context::on_tangent1_change),value_node)
);
sigc::bind(sigc::mem_fun(*this,&studio::StateBLine_Context::on_tangent1_change),value_node)
);
}
- tduck->set_guid(value_node->get_guid()^GUID::hasher(4));
+ tduck->set_guid(value_node->get_guid()^synfig::GUID::hasher(4));
tduck->signal_user_click(2).connect(
sigc::bind(sigc::mem_fun(*this,&studio::StateBLine_Context::popup_handle_menu),value_node)
);
//get_work_area()->add_duck(bezier->c2);
get_work_area()->add_bezier(bezier);
- duck->set_guid(GUID());
- tduck->set_guid(GUID());
+ duck->set_guid(synfig::GUID());
+ tduck->set_guid(synfig::GUID());
next_duck=duck;
}
void swap_guid(const ValueNode::Handle& a,const ValueNode::Handle& b)
{
- GUID old_a(a->get_guid());
- a->set_guid(GUID());
+ synfig::GUID old_a(a->get_guid());
+ a->set_guid(synfig::GUID());
- GUID old_b(b->get_guid());
- b->set_guid(GUID());
+ synfig::GUID old_b(b->get_guid());
+ b->set_guid(synfig::GUID());
a->set_guid(old_b);
b->set_guid(old_a);