Project: join GTK-3 and GDLmm port

This commit is contained in:
Michael Fisher 2012-08-15 01:51:57 -05:00 committed by Ichthyostega
commit ac3ef9f469
14 changed files with 131 additions and 165 deletions

View file

@ -120,12 +120,17 @@ def configure(env):
if not conf.CheckPkgConfig('cairomm-1.0', 0.6):
problems.append('Unable to configure Cairo--')
verGDL = '3.0.0'
if not conf.CheckPkgConfig('gdl-3.0', verGDL, alias='gdl'):
print 'No sufficiently recent (>=%s) version of GDL found. Maybe use custom package gdl-lum?' % verGDL
if not conf.CheckPkgConfig('gdl-lum', verGDL, alias='gdl'):
problems.append('GNOME Docking Library not found. We either need a sufficiently recent GDL '
'version (>=%s), or the custom package "gdl-lum" from Lumiera.org.' % verGDL)
verGDL = '3.12'
verGDLmm = '3.7.3'
urlGDLmm = 'http://ftp.gnome.org/pub/GNOME/sources/gdlmm/'
urlGDLmmDEB = 'http://lumiera.org/debian/'
if not conf.CheckPkgConfig('gdl-3.0', verGDL):
problems.append('GNOME Docking Library not found. We need at least GDL %s '
'and suitable C++ ("mm")-bindings (GDLmm >=%s)' % (verGDL, verGDLmm))
if not conf.CheckPkgConfig('gdlmm-3.0', verGDLmm, alias='gdl'):
problems.append('We need the C++ bindings for GDL by Fabien Parent: GDLmm >=%s '
'(either from GNOME %s or use the debian package from %s)' %
(verGDLmm, urlGDLmm, urlGDLmmDEB))
if not conf.CheckPkgConfig('librsvg-2.0', '2.18.1'):
problems.append('Need rsvg Library for rendering icons.')

View file

@ -88,7 +88,7 @@ void
GtkLumiera::main (int argc, char *argv[])
{
Glib::thread_init();
Gdl::init();
Main kit(argc, argv);
Glib::set_application_name (getAppTitle());

View file

@ -27,7 +27,7 @@ namespace gui {
namespace panels {
AssetsPanel::AssetsPanel(workspace::PanelManager &panel_manager,
GdlDockItem *dock_item) :
Gdl::DockItem &dock_item) :
Panel(panel_manager, dock_item, get_title(), get_stock_id())
{
notebook.append_page(media, _("Media"));

View file

@ -41,7 +41,7 @@ public:
* @param dock_item The GdlDockItem that will host this panel.
*/
AssetsPanel(workspace::PanelManager &panel_manager,
GdlDockItem *dock_item);
Gdl::DockItem &dock_item);
/**
* Get the title of the panel.

View file

@ -34,60 +34,50 @@ namespace gui {
namespace panels {
Panel::Panel(workspace::PanelManager &panel_manager,
GdlDockItem *dock_item, const gchar* long_name,
Gdl::DockItem &dock_item, const gchar* long_name,
const gchar *stock_id) :
panelManager(panel_manager),
dockItem(dock_item),
hide_panel_handler_id(0),
panelBar(*this, stock_id)
{
REQUIRE(dockItem);
g_object_ref(dockItem);
// Set dockItems long-name property
Glib::Value<std::string> val;
val.init(val.value_type());
val.set(long_name);
g_object_set_property (G_OBJECT (dockItem), "long-name", val.gobj());
g_object_set_property (G_OBJECT (dockItem.gobj()), "long-name", val.gobj());
// Set the grip handle
/* Set the grip handle */
GdlDockItemGrip *grip = GDL_DOCK_ITEM_GRIP(
gdl_dock_item_get_grip(dockItem));
gdl_dock_item_get_grip(dockItem.gobj()));
gdl_dock_item_grip_show_handle(grip);
gdl_dock_item_grip_set_label(grip, ((Widget&)panelBar).gobj());
// Set up the panel body
gtk_container_add (GTK_CONTAINER(dockItem), GTK_WIDGET(gobj()));
gtk_widget_show (GTK_WIDGET(dockItem));
// Connect the signals
hide_panel_handler_id = g_signal_connect (GTK_WIDGET(dockItem),
"hide", G_CALLBACK(on_item_hidden), this);
//gdl_dock_item_grip_set_cursor_type(grip, GDK_LEFT_PTR);
/* Set up the panel body */
// Add this panel's container to the DockItem
dockItem.add((Gtk::Widget&)*this);
/* Connect the signals */
dockItem.signal_hide().connect(
sigc::mem_fun(*this, &Panel::on_item_hidden));
dockItem.show();
}
Panel::~Panel()
{
REQUIRE(dockItem != NULL);
// Detach the panel bar
/* Detach the panel bar */
GdlDockItemGrip *grip = GDL_DOCK_ITEM_GRIP(
gdl_dock_item_get_grip(dockItem));
gdl_dock_item_get_grip(dockItem.gobj()));
gtk_container_remove (GTK_CONTAINER(grip),
((Widget&)panelBar).gobj());
gtk_container_remove (GTK_CONTAINER(dockItem), GTK_WIDGET(gobj()));
// Detach the signals
g_signal_handler_disconnect(
GTK_WIDGET(dockItem), hide_panel_handler_id);
// Unref the dock item
g_object_unref(dockItem);
dockItem = NULL;
/* Remove this panel's container from the DockItem */
dockItem.remove((Gtk::Widget&)*this);
}
GdlDockItem*
Panel::get_dock_item() const
Gdl::DockItem&
Panel::get_dock_item()
{
return dockItem;
}
@ -95,45 +85,48 @@ Panel::get_dock_item() const
void
Panel::show(bool show)
{
REQUIRE(dockItem != NULL);
if(show) gdl_dock_item_show_item (dockItem);
else gdl_dock_item_hide_item (dockItem);
//REQUIRE(dockItem != NULL);
if(show) dockItem.show_item();
else dockItem.hide_item();
}
bool
Panel::is_shown() const
{
REQUIRE(dockItem != NULL);
return gtk_widget_get_visible((GtkWidget*)dockItem);
//REQUIRE(dockItem != NULL);
return dockItem.is_visible();
}
void
Panel::iconify()
{
REQUIRE(dockItem != NULL);
gdl_dock_item_iconify_item(dockItem);
dockItem.iconify_item();
}
bool
Panel::is_iconified() const
{
REQUIRE(dockItem != NULL);
return GDL_DOCK_ITEM_ICONIFIED(dockItem);
/** Gdlmm as of v1.30.0 does not have
* a facility for checking the whether
* a dock item is iconified or not
*/
GdlDockItem *item = dockItem.gobj();
REQUIRE(item != NULL);
return GDL_DOCK_ITEM_ICONIFIED (item);
}
void
Panel::lock(bool lock)
{
REQUIRE(dockItem != NULL);
if(lock) gdl_dock_item_lock (dockItem);
else gdl_dock_item_unlock (dockItem);
if(lock) dockItem.lock();
else dockItem.unlock();
}
bool
Panel::is_locked() const
{
REQUIRE(dockItem != NULL);
return !GDL_DOCK_ITEM_NOT_LOCKED(dockItem);
REQUIRE(dockItem.gobj() != NULL);
return !GDL_DOCK_ITEM_NOT_LOCKED(dockItem.gobj());
}
workspace::PanelManager&
@ -167,10 +160,9 @@ Panel::signal_hide_panel()
}
void
Panel::on_item_hidden(GdlDockItem*, Panel *panel)
Panel::on_item_hidden()
{
REQUIRE(panel);
panel->hidePanelSignal();
hidePanelSignal.emit();
}
} // namespace panels

View file

@ -27,11 +27,10 @@
#ifndef PANEL_HPP
#define PANEL_HPP
#include "gui/gtk-lumiera.hpp"
#include "gui/widgets/panel-bar.hpp"
#include <gdl/gdl-dock-item.h>
#include <gdlmm.h>
namespace gui {
@ -56,7 +55,7 @@ protected:
* @param stock_id The stock_id of this panel.
*/
Panel(workspace::PanelManager &panel_manager,
GdlDockItem *dock_item, const gchar* long_name,
Gdl::DockItem &dock_item, const gchar* long_name,
const gchar *stock_id);
public:
@ -65,7 +64,7 @@ public:
/**
* Returns a pointer to the underlying GdlDockItem structure
*/
GdlDockItem* get_dock_item() const;
Gdl::DockItem& get_dock_item();
/**
* Shows or hides the panel.
@ -134,9 +133,8 @@ private:
/**
* An event handler for when dockItem is hidden.
* @param func_data A pointer to the panel that owns dock_item
*/
static void on_item_hidden(GdlDockItem*, Panel *panel);
void on_item_hidden();
protected:
@ -149,17 +147,12 @@ protected:
* The owner dock item widget that will host the widgets in this
* panel.
*/
GdlDockItem* dockItem;
Gdl::DockItem &dockItem;
/**
* A signal that fires when the dock item is hidden.
*/
sigc::signal<void> hidePanelSignal;
/**
* The id of the hide panel handler.
*/
gulong hide_panel_handler_id;
/**
* The panel bar to attach to the panel grip.

View file

@ -48,9 +48,8 @@ namespace panels {
const int TimelinePanel::ZoomToolSteps = 2; // 2 seems comfortable
TimelinePanel::TimelinePanel (workspace::PanelManager &panel_manager,
GdlDockItem *dock_item)
Gdl::DockItem &dock_item)
: Panel(panel_manager, dock_item, get_title(), get_stock_id())
, timeCode("sequence_clock", "timecode_widget", true)
, previousButton(Stock::MEDIA_PREVIOUS)

View file

@ -70,7 +70,7 @@ public:
* @param dock_item The GdlDockItem that will host this panel.
*/
TimelinePanel(workspace::PanelManager &panel_manager,
GdlDockItem *dock_item);
Gdl::DockItem &dock_item);
/**

View file

@ -37,7 +37,7 @@ namespace gui {
namespace panels {
ViewerPanel::ViewerPanel(workspace::PanelManager &panel_manager,
GdlDockItem *dock_item) :
Gdl::DockItem &dock_item) :
Panel(panel_manager, dock_item, get_title(), get_stock_id())
{
//----- Pack in the Widgets -----//

View file

@ -45,7 +45,7 @@ public:
* @param dock_item The GdlDockItem that will host this panel.
*/
ViewerPanel(workspace::PanelManager &panel_manager,
GdlDockItem *dock_item);
Gdl::DockItem &dock_item);
/**
* Get the title of the panel.

View file

@ -83,18 +83,25 @@ PanelBar::setup_panel_button()
**/
}
panelButton.appendSeparator();
FIXME("Update for gtk3");
#if 0
list.push_back( Menu_Helpers::SeparatorElem() );
#endif
// Add extra commands
slot<void> hide = mem_fun(*this, &PanelBar::on_hide);
panelButton.append("Hide","_Hide", hide);
slot<void> lock = mem_fun(*this, &PanelBar::on_lock);
panelButton.append("Lock", "_Lock", lock, true);
panelButton.append("Lock", "_Lock", lock);
lockItem = dynamic_cast<CheckMenuItem*>(panelButton.get("Lock"));
FIXME("Update for gtk3");
#if 0
lockItem = dynamic_cast<CheckMenuItem*>(&list.back());
ENSURE(lockItem);
lockItem->set_active(panel.is_locked());
#endif
slot<void> hfunc =
bind(mem_fun(*this, &PanelBar::on_split_panel),

View file

@ -46,23 +46,22 @@ unsigned short PanelManager::panelID = 0;
PanelManager::PanelManager(WorkspaceWindow &workspace_window) :
workspaceWindow(workspace_window),
dock(NULL),
dockBar(NULL),
dockLayout(NULL)
dock(),
dockBar(dock),
dockLayout()
{
/* Create the DockLayout */
dockLayout = Gdl::DockLayout::create(dock);
/* Setup the Switcher Style */
Glib::RefPtr<Gdl::DockMaster> dock_master = dock.property_master();
dock_master->property_switcher_style() = Gdl::SWITCHER_STYLE_ICON;
memset(&dockPlaceholders, 0, sizeof(dockPlaceholders));
}
PanelManager::~PanelManager()
{
if(dock)
g_object_unref(dock);
if(dockBar)
g_object_unref(dockBar);
if(dockLayout)
g_object_unref(dockLayout);
for(int i = 0; i < 4; i++)
if(dockPlaceholders[i])
@ -74,45 +73,31 @@ PanelManager::~PanelManager()
void
PanelManager::setup_dock()
{
REQUIRE(dock == NULL);
dock = GDL_DOCK(gdl_dock_new());
ENSURE(dock);
REQUIRE(dockBar == NULL);
dockBar = GDL_DOCK_BAR(gdl_dock_bar_new(dock));
ENSURE(dockBar);
REQUIRE(dockLayout == NULL);
dockLayout = GDL_DOCK_LAYOUT(gdl_dock_layout_new(dock));
ENSURE(dockLayout);
REQUIRE(dockPlaceholders[0] == NULL && dockPlaceholders[1] == NULL &&
dockPlaceholders[2] == NULL && dockPlaceholders[3] == NULL);
dockPlaceholders[0] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
"ph1", GDL_DOCK_OBJECT(dock), GDL_DOCK_TOP, FALSE));
"ph1", GDL_DOCK_OBJECT(dock.gobj()), GDL_DOCK_TOP, FALSE));
dockPlaceholders[1] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
"ph2", GDL_DOCK_OBJECT(dock), GDL_DOCK_BOTTOM, FALSE));
"ph2", GDL_DOCK_OBJECT(dock.gobj()), GDL_DOCK_BOTTOM, FALSE));
dockPlaceholders[2] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
"ph3", GDL_DOCK_OBJECT(dock), GDL_DOCK_LEFT, FALSE));
"ph3", GDL_DOCK_OBJECT(dock.gobj()), GDL_DOCK_LEFT, FALSE));
dockPlaceholders[3] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
"ph4", GDL_DOCK_OBJECT(dock), GDL_DOCK_RIGHT, FALSE));
"ph4", GDL_DOCK_OBJECT(dock.gobj()), GDL_DOCK_RIGHT, FALSE));
ENSURE(dockPlaceholders[0] && dockPlaceholders[1] &&
dockPlaceholders[2] && dockPlaceholders[3]);
create_panels();
}
GdlDock*
PanelManager::get_dock() const
Gdl::Dock&
PanelManager::get_dock()
{
ENSURE(dock);
return dock;
}
GdlDockBar*
PanelManager::get_dock_bar() const
Gdl::DockBar&
PanelManager::get_dock_bar()
{
ENSURE(dockBar);
return dockBar;
}
@ -135,9 +120,9 @@ PanelManager::show_panel(const int description_index)
if(!panel->is_shown())
panel->show();
GdlDockItem *dock_item = panel->get_dock_item();
ENSURE(dock_item);
gdl_dock_object_present(GDL_DOCK_OBJECT(dock_item), NULL);
Gdl::DockItem &dock_item = panel->get_dock_item();
// ENSURE(dock_item);
dock_item.present(dock);
return;
}
}
@ -146,8 +131,7 @@ PanelManager::show_panel(const int description_index)
panels::Panel *new_panel = create_panel_by_index(description_index);
// Dock the item
gdl_dock_add_item(dock, new_panel->get_dock_item(),
GDL_DOCK_FLOATING);
dock.add_item(new_panel->get_dock_item(), Gdl::DOCK_FLOATING);
}
void PanelManager::switch_panel(panels::Panel &old_panel,
@ -157,43 +141,43 @@ void PanelManager::switch_panel(panels::Panel &old_panel,
description_index < get_panel_description_count());
// Get the dock item
GdlDockItem *dock_item = old_panel.get_dock_item();
g_object_ref(dock_item);
Gdl::DockItem &dock_item = old_panel.get_dock_item();
// Release the old panel
remove_panel(&old_panel);
// Create the new panel
create_panel_by_index(description_index, dock_item);
g_object_unref(dock_item);
}
void
PanelManager::split_panel(panels::Panel &panel,
Gtk::Orientation split_direction)
{
// Create the new panel
const int index = get_panel_type(&panel);
panels::Panel *new_panel = create_panel_by_index(index);
// Dock the panel
GdlDockPlacement placement = GDL_DOCK_NONE;
Gdl::DockPlacement placement = Gdl::DOCK_NONE;
switch(split_direction)
{
case ORIENTATION_HORIZONTAL:
placement = GDL_DOCK_RIGHT;
placement = Gdl::DOCK_RIGHT;
break;
case ORIENTATION_VERTICAL:
placement = GDL_DOCK_BOTTOM;
placement = Gdl::DOCK_BOTTOM;
break;
default:
ERROR(gui, "Unrecognisized split_direction: %d", split_direction);
ERROR(gui, "Unrecognisized split_direction: %d",
split_direction);
return;
break;
}
gdl_dock_object_dock(GDL_DOCK_OBJECT(panel.get_dock_item()),
GDL_DOCK_OBJECT(new_panel->get_dock_item()), placement, NULL);
panel.get_dock_item().dock(
new_panel->get_dock_item(),placement);
}
int
@ -225,13 +209,11 @@ PanelManager::create_panels()
create_panel_by_name("ViewerPanel");
panels::Panel* timelinePanel =
create_panel_by_name("TimelinePanel");
gdl_dock_add_item(dock,
assetsPanel->get_dock_item(), GDL_DOCK_LEFT);
gdl_dock_add_item(dock,
timelinePanel->get_dock_item(), GDL_DOCK_BOTTOM);
gdl_dock_add_item(dock,
viewerPanel->get_dock_item(), GDL_DOCK_RIGHT);
dock.add_item(assetsPanel->get_dock_item(),Gdl::DOCK_LEFT);
dock.add_item(timelinePanel->get_dock_item(),Gdl::DOCK_BOTTOM);
dock.add_item(viewerPanel->get_dock_item(),Gdl::DOCK_RIGHT);
}
int
@ -261,15 +243,12 @@ PanelManager::create_panel_by_index(const int index)
snprintf(name, sizeof(name), "%X", panelID++);
// Create a dock item
GdlDockItem *dock_item = GDL_DOCK_ITEM(
gdl_dock_item_new(name, "", GDL_DOCK_ITEM_BEH_NORMAL));
return create_panel_by_index(index, dock_item);
return create_panel_by_index(index, *new Gdl::DockItem(name,"",Gdl::DOCK_ITEM_BEH_NORMAL));
}
panels::Panel*
PanelManager::create_panel_by_index(
const int index, GdlDockItem *dock_item)
const int index, Gdl::DockItem &dock_item)
{
// Create the panel object
panels::Panel *panel =
@ -278,8 +257,8 @@ PanelManager::create_panel_by_index(
panel->show_all();
// Connect event handlers
panel->signal_hide_panel().connect(bind(
mem_fun(*this, &PanelManager::on_panel_shown), panel));
panel->signal_hide_panel().connect(sigc::bind(
sigc::mem_fun(*this, &PanelManager::on_panel_shown), panel));
// Add the panel to the list
panels.push_back(panel);

View file

@ -30,7 +30,7 @@
#include "gui/panels/panel.hpp"
#include <gdl/gdl.h>
#include <gdlmm.h>
#include <typeinfo>
@ -70,13 +70,13 @@ public:
* Gets a pointer to the dock object.
* @remarks Note that this must not be called before setup_dock.
*/
GdlDock* get_dock() const;
Gdl::Dock& get_dock();
/**
* Gets a pointer to the dock bar.
* @remarks Note that this must not be called before setup_dock.
*/
GdlDockBar* get_dock_bar() const;
Gdl::DockBar& get_dock_bar();
/**
* Returns a reference to the owner workspace window.
@ -157,7 +157,7 @@ private:
* @return Returns a pointer to the new instantiated panel object.
*/
panels::Panel* create_panel_by_index(
const int index, GdlDockItem *dock_item);
const int index, Gdl::DockItem &dock_item);
/**
* Creates a panel by class name.
@ -204,19 +204,19 @@ private:
* The pointer to GDL dock widget.
* @remarks This value is NULL until setup_dock has been called.
*/
GdlDock *dock;
Gdl::Dock dock;
/**
* The pointer to GDL dock bar widget.
* @remarks This value is NULL until setup_dock has been called.
*/
GdlDockBar *dockBar;
Gdl::DockBar dockBar;
/**
* The pointer to GDL dock layout object.
* @remarks This value is NULL until setup_dock has been called.
*/
GdlDockLayout *dockLayout;
Glib::RefPtr<Gdl::DockLayout> dockLayout;
/**
* Pointers to the 4 root place holders.
@ -244,7 +244,7 @@ private:
protected:
typedef panels::Panel* (*const CreatePanelProc)(
PanelManager&, GdlDockItem*);
PanelManager&, Gdl::DockItem&);
protected:
/**
@ -309,7 +309,7 @@ private:
* @return Returns a pointer to the panel object.
*/
panels::Panel* create(
PanelManager &panel_manager, GdlDockItem* dock_item) const
PanelManager &panel_manager, Gdl::DockItem &dock_item) const
{
REQUIRE(createPanelProc);
return createPanelProc(panel_manager, dock_item);
@ -357,11 +357,11 @@ private:
/**
* A helper function that will create a panel of type P
* @param panel_manager The owner panel manager.
* @param dock_item The GdlDockItem that will host this panel.
* @param dock_item The Gdl::DockItem that will host this panel.
* @return Returns a pointer to the panel object.
*/
static panels::Panel* create_panel(
PanelManager &panel_manager, GdlDockItem* dock_item)
PanelManager &panel_manager, Gdl::DockItem &dock_item)
{
return new P(panel_manager, dock_item);
}

View file

@ -30,11 +30,6 @@
# include <libintl.h>
#endif
//#include <gdl/gdl-tools.h>
#include <gdl/gdl-dock.h>
#include <gdl/gdl-dock-bar.h>
#include <gdl/gdl-dock-item.h>
#include <gdl/gdl-dock-placeholder.h>
using namespace Gtk;
@ -57,7 +52,7 @@ WorkspaceWindow::WorkspaceWindow(Project &source_project,
WorkspaceWindow::~WorkspaceWindow()
{
INFO (gui_dbg, "closing workspace window...");
INFO (gui_dbg, "Closing workspace window...");
}
Project&
@ -103,13 +98,8 @@ WorkspaceWindow::create_ui()
//----- Create the Docks -----//
panelManager.setup_dock();
GdlDock const *dock = panelManager.get_dock();
gtk_box_pack_start(GTK_BOX(dockContainer.gobj()),
GTK_WIDGET(panelManager.get_dock_bar()), FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(dockContainer.gobj()),
GTK_WIDGET(dock), TRUE, TRUE, 0);
dockContainer.pack_start(panelManager.get_dock_bar(),false,false,0);
dockContainer.pack_start(panelManager.get_dock(),true,true,0);
baseContainer.pack_start(dockContainer, PACK_EXPAND_WIDGET);
//----- Create the status bar -----//
@ -129,3 +119,4 @@ WorkspaceWindow::set_close_window_sensitive(bool enable)
} // namespace workspace
} // namespace gui