mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-13 18:16:35 +01:00
Remove ancient/unused flowcanvas and libglademm from repository.
Update libraries to latest stable released version (except gnomecanvasmm, which is strangely packaged...). Fixes building (at least here). git-svn-id: svn://localhost/ardour2/trunk@2790 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0e31c56591
commit
35fc31a1de
1550 changed files with 362440 additions and 73136 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// -*- c++ -*-
|
||||
/* $Id: wrap.cc,v 1.3 2005/01/06 17:42:56 murrayc Exp $ */
|
||||
/* $Id: wrap.cc 447 2007-10-03 09:51:41Z murrayc $ */
|
||||
|
||||
/* wrap.cc
|
||||
*
|
||||
|
|
@ -45,36 +45,6 @@ typedef std::vector<Glib::WrapNewFunction> WrapFuncTable;
|
|||
|
||||
static WrapFuncTable* wrap_func_table = 0;
|
||||
|
||||
|
||||
static Glib::ObjectBase* create_new_wrapper(GObject* object)
|
||||
{
|
||||
g_return_val_if_fail(wrap_func_table != 0, 0);
|
||||
|
||||
bool gtkmm_wrapper_already_deleted = (bool)g_object_get_qdata((GObject*)object, Glib::quark_cpp_wrapper_deleted_);
|
||||
if(gtkmm_wrapper_already_deleted)
|
||||
{
|
||||
g_warning("Glib::create_new_wrapper: Attempted to create a 2nd C++ wrapper for a C instance whose C++ wrapper has been deleted.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Traverse upwards through the inheritance hierarchy
|
||||
// to find the most-specialized wrap_new() for this GType.
|
||||
//
|
||||
for(GType type = G_OBJECT_TYPE(object); type != 0; type = g_type_parent(type))
|
||||
{
|
||||
// Look up the wrap table index stored in the type's static data.
|
||||
// If a wrap_new() has been registered for the type then call it.
|
||||
//
|
||||
if(const gpointer idx = g_type_get_qdata(type, Glib::quark_))
|
||||
{
|
||||
const Glib::WrapNewFunction func = (*wrap_func_table)[GPOINTER_TO_UINT(idx)];
|
||||
return (*func)(object);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
|
|
@ -120,6 +90,85 @@ void wrap_register(GType type, WrapNewFunction func)
|
|||
g_type_set_qdata(type, Glib::quark_, GUINT_TO_POINTER(idx));
|
||||
}
|
||||
|
||||
|
||||
static Glib::ObjectBase* wrap_create_new_wrapper(GObject* object)
|
||||
{
|
||||
g_return_val_if_fail(wrap_func_table != 0, 0);
|
||||
|
||||
const bool gtkmm_wrapper_already_deleted = (bool)g_object_get_qdata((GObject*)object, Glib::quark_cpp_wrapper_deleted_);
|
||||
if(gtkmm_wrapper_already_deleted)
|
||||
{
|
||||
g_warning("Glib::wrap_create_new_wrapper: Attempted to create a 2nd C++ wrapper for a C instance whose C++ wrapper has been deleted.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Traverse upwards through the inheritance hierarchy
|
||||
// to find the most-specialized wrap_new() for this GType.
|
||||
//
|
||||
for(GType type = G_OBJECT_TYPE(object); type != 0; type = g_type_parent(type))
|
||||
{
|
||||
// Look up the wrap table index stored in the type's static data.
|
||||
// If a wrap_new() has been registered for the type then call it.
|
||||
//
|
||||
if(const gpointer idx = g_type_get_qdata(type, Glib::quark_))
|
||||
{
|
||||
const Glib::WrapNewFunction func = (*wrap_func_table)[GPOINTER_TO_UINT(idx)];
|
||||
return (*func)(object);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gboolean gtype_wraps_interface(GType implementer_type, GType interface_type)
|
||||
{
|
||||
guint n_ifaces = 0;
|
||||
GType *ifaces = g_type_interfaces (implementer_type, &n_ifaces);
|
||||
|
||||
gboolean found = FALSE;
|
||||
while (n_ifaces-- && !found)
|
||||
{
|
||||
found = (ifaces[n_ifaces] == interface_type);
|
||||
}
|
||||
|
||||
g_free (ifaces);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
Glib::ObjectBase* wrap_create_new_wrapper_for_interface(GObject* object, GType interface_gtype)
|
||||
{
|
||||
g_return_val_if_fail(wrap_func_table != 0, 0);
|
||||
|
||||
const bool gtkmm_wrapper_already_deleted = (bool)g_object_get_qdata((GObject*)object, Glib::quark_cpp_wrapper_deleted_);
|
||||
if(gtkmm_wrapper_already_deleted)
|
||||
{
|
||||
g_warning("Glib::wrap_create_new_wrapper: Attempted to create a 2nd C++ wrapper for a C instance whose C++ wrapper has been deleted.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Traverse upwards through the inheritance hierarchy
|
||||
// to find the most-specialized wrap_new() for this GType.
|
||||
//
|
||||
for(GType type = G_OBJECT_TYPE(object); type != 0; type = g_type_parent(type))
|
||||
{
|
||||
// Look up the wrap table index stored in the type's static data.
|
||||
// If a wrap_new() has been registered for the type then call it.
|
||||
// But only if the type implements the interface,
|
||||
// so that the C++ instance is likely to inherit from the appropriate class too.
|
||||
//
|
||||
const gpointer idx = g_type_get_qdata(type, Glib::quark_);
|
||||
if(idx && gtype_wraps_interface(type, interface_gtype))
|
||||
{
|
||||
const Glib::WrapNewFunction func = (*wrap_func_table)[GPOINTER_TO_UINT(idx)];
|
||||
return (*func)(object);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// This is a factory function that converts any type to
|
||||
// its C++ wrapper instance by looking up a wrap_new() function in a map.
|
||||
//
|
||||
|
|
@ -129,13 +178,12 @@ ObjectBase* wrap_auto(GObject* object, bool take_copy)
|
|||
return 0;
|
||||
|
||||
// Look up current C++ wrapper instance:
|
||||
ObjectBase* pCppObject =
|
||||
static_cast<ObjectBase*>(g_object_get_qdata(object, Glib::quark_));
|
||||
ObjectBase* pCppObject = ObjectBase::_get_current_wrapper(object);
|
||||
|
||||
if(!pCppObject)
|
||||
{
|
||||
// There's not already a wrapper: generate a new C++ instance.
|
||||
pCppObject = create_new_wrapper(object);
|
||||
pCppObject = wrap_create_new_wrapper(object);
|
||||
|
||||
if(!pCppObject)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue