Individual Panels initial Gdlmm port
This commit is contained in:
parent
eb4cdcd975
commit
68c6cef003
11 changed files with 76 additions and 77 deletions
|
|
@ -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"));
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -34,60 +34,59 @@ 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
|
||||
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_container_add (GTK_CONTAINER(dockItem.gobj()), GTK_WIDGET(gobj()));
|
||||
|
||||
gtk_widget_show (GTK_WIDGET(dockItem));
|
||||
gtk_widget_show (GTK_WIDGET(dockItem.gobj()));
|
||||
|
||||
// Connect the signals
|
||||
hide_panel_handler_id = g_signal_connect (GTK_OBJECT(dockItem),
|
||||
hide_panel_handler_id = g_signal_connect (GTK_OBJECT(dockItem.gobj()),
|
||||
"hide", G_CALLBACK(on_item_hidden), this);
|
||||
}
|
||||
|
||||
Panel::~Panel()
|
||||
{
|
||||
REQUIRE(dockItem != NULL);
|
||||
TODO("Fix for Gdlmm");
|
||||
//REQUIRE(dockItem != NULL);
|
||||
|
||||
// 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()));
|
||||
gtk_container_remove (GTK_CONTAINER(dockItem.gobj()), GTK_WIDGET(gobj()));
|
||||
|
||||
// Detach the signals
|
||||
g_signal_handler_disconnect(
|
||||
GTK_OBJECT(dockItem), hide_panel_handler_id);
|
||||
GTK_OBJECT(dockItem.gobj()), hide_panel_handler_id);
|
||||
|
||||
// Unref the dock item
|
||||
g_object_unref(dockItem);
|
||||
dockItem = NULL;
|
||||
// g_object_unref(dockItem);
|
||||
// dockItem = NULL;
|
||||
}
|
||||
|
||||
GdlDockItem*
|
||||
Panel::get_dock_item() const
|
||||
Gdl::DockItem&
|
||||
Panel::get_dock_item()
|
||||
{
|
||||
return dockItem;
|
||||
}
|
||||
|
|
@ -95,45 +94,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_VISIBLE((GtkWidget*)dockItem);
|
||||
//REQUIRE(dockItem != NULL);
|
||||
return dockItem.is_visible();
|
||||
}
|
||||
|
||||
void
|
||||
Panel::iconify()
|
||||
{
|
||||
REQUIRE(dockItem != NULL);
|
||||
gdl_dock_item_iconify_item(dockItem);
|
||||
// //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);
|
||||
// REQUIRE(dockItem);
|
||||
TODO("Port to Gdlmm");
|
||||
return GDL_DOCK_ITEM_ICONIFIED(dockItem.gobj());
|
||||
}
|
||||
|
||||
void
|
||||
Panel::lock(bool lock)
|
||||
{
|
||||
REQUIRE(dockItem != NULL);
|
||||
if(lock) gdl_dock_item_lock (dockItem);
|
||||
else gdl_dock_item_unlock (dockItem);
|
||||
// //REQUIRE(dockItem != NULL);
|
||||
|
||||
if(lock) dockItem.lock();
|
||||
else dockItem.unlock();
|
||||
}
|
||||
|
||||
bool
|
||||
Panel::is_locked() const
|
||||
{
|
||||
REQUIRE(dockItem != NULL);
|
||||
return !GDL_DOCK_ITEM_NOT_LOCKED(dockItem);
|
||||
////REQUIRE(dockItem != NULL);
|
||||
return !GDL_DOCK_ITEM_NOT_LOCKED(dockItem.gobj());
|
||||
}
|
||||
|
||||
workspace::PanelManager&
|
||||
|
|
|
|||
|
|
@ -57,7 +57,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:
|
||||
|
|
@ -66,7 +66,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.
|
||||
|
|
@ -150,7 +150,7 @@ 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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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 -----//
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -84,16 +84,16 @@ PanelManager::setup_dock()
|
|||
create_panels();
|
||||
}
|
||||
|
||||
GdlDock*
|
||||
Gdl::Dock&
|
||||
PanelManager::get_dock()
|
||||
{
|
||||
return dock.gobj();
|
||||
return dock;
|
||||
}
|
||||
|
||||
GdlDockBar*
|
||||
Gdl::DockBar&
|
||||
PanelManager::get_dock_bar()
|
||||
{
|
||||
return dockBar.gobj();
|
||||
return dockBar;
|
||||
}
|
||||
|
||||
WorkspaceWindow&
|
||||
|
|
@ -115,9 +115,10 @@ 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);
|
||||
// gdl_dock_object_present(GDL_DOCK_OBJECT(dock_item.gobj()), NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -126,9 +127,7 @@ PanelManager::show_panel(const int description_index)
|
|||
panels::Panel *new_panel = create_panel_by_index(description_index);
|
||||
|
||||
// Dock the item
|
||||
TODO("Port to Gdlmm.");
|
||||
gdl_dock_add_item(dock.gobj(), 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,
|
||||
|
|
@ -138,26 +137,27 @@ 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)
|
||||
{
|
||||
TODO("Port to Gdlmm");
|
||||
// Create the new panel
|
||||
const int index = get_panel_type(&panel);
|
||||
panels::Panel *new_panel = create_panel_by_index(index);
|
||||
|
||||
// Dock the panel
|
||||
// Gdl::DockPlacement placement = Gdl::DOCK_NONE;
|
||||
GdlDockPlacement placement = GDL_DOCK_NONE;
|
||||
switch(split_direction)
|
||||
{
|
||||
|
|
@ -172,9 +172,9 @@ PanelManager::split_panel(panels::Panel &panel,
|
|||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
gdl_dock_object_dock(GDL_DOCK_OBJECT(panel.get_dock_item()),
|
||||
GDL_DOCK_OBJECT(new_panel->get_dock_item()), placement, NULL);
|
||||
|
||||
gdl_dock_object_dock(GDL_DOCK_OBJECT(panel.get_dock_item().gobj()),
|
||||
GDL_DOCK_OBJECT(new_panel->get_dock_item().gobj()), placement, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -206,13 +206,11 @@ PanelManager::create_panels()
|
|||
create_panel_by_name("ViewerPanel");
|
||||
panels::Panel* timelinePanel =
|
||||
create_panel_by_name("TimelinePanel");
|
||||
|
||||
gdl_dock_add_item(dock.gobj(),
|
||||
assetsPanel->get_dock_item(), GDL_DOCK_LEFT);
|
||||
gdl_dock_add_item(dock.gobj(),
|
||||
timelinePanel->get_dock_item(), GDL_DOCK_BOTTOM);
|
||||
gdl_dock_add_item(dock.gobj(),
|
||||
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
|
||||
|
|
@ -242,15 +240,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 =
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
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();
|
||||
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.
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,13 +103,16 @@ 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 -----//
|
||||
|
|
|
|||
Loading…
Reference in a new issue