This commit is contained in:
Joel Holdsworth 2008-08-16 20:02:46 +01:00
parent 51161f1e56
commit 071e332f04
3 changed files with 71 additions and 51 deletions

View file

@ -95,14 +95,17 @@ Actions::Actions(WorkspaceWindow &workspace_window) :
void
Actions::update_action_state()
{
REQUIRE(workspaceWindow.assets_panel != NULL);
REQUIRE(workspaceWindow.timeline_panel != NULL);
REQUIRE(workspaceWindow.viewer_panel != NULL);
REQUIRE(workspaceWindow.assetsPanel != NULL);
REQUIRE(workspaceWindow.timelinePanel != NULL);
REQUIRE(workspaceWindow.viewerPanel != NULL);
is_updating_action_state = true;
assetsPanelAction->set_active(workspaceWindow.assets_panel->is_shown());
timelinePanelAction->set_active(workspaceWindow.timeline_panel->is_shown());
viewerPanelAction->set_active(workspaceWindow.viewer_panel->is_shown());
assetsPanelAction->set_active(
workspaceWindow.assetsPanel->is_shown());
timelinePanelAction->set_active(
workspaceWindow.timelinePanel->is_shown());
viewerPanelAction->set_active(
workspaceWindow.viewerPanel->is_shown());
is_updating_action_state = false;
}
@ -148,21 +151,21 @@ void
Actions::on_menu_view_assets()
{
if(!is_updating_action_state)
workspaceWindow.assets_panel->show(assetsPanelAction->get_active());
workspaceWindow.assetsPanel->show(assetsPanelAction->get_active());
}
void
Actions::on_menu_view_timeline()
{
if(!is_updating_action_state)
workspaceWindow.timeline_panel->show(timelinePanelAction->get_active());
workspaceWindow.timelinePanel->show(timelinePanelAction->get_active());
}
void
Actions::on_menu_view_viewer()
{
if(!is_updating_action_state)
workspaceWindow.viewer_panel->show(viewerPanelAction->get_active());
workspaceWindow.viewerPanel->show(viewerPanelAction->get_active());
}
void

View file

@ -49,9 +49,9 @@ WorkspaceWindow::WorkspaceWindow(Project *source_project) :
REQUIRE(source_project != NULL);
layout = NULL;
assets_panel = NULL;
viewer_panel = NULL;
timeline_panel = NULL;
assetsPanel = NULL;
viewerPanel = NULL;
timelinePanel = NULL;
create_ui();
}
@ -61,12 +61,12 @@ WorkspaceWindow::~WorkspaceWindow()
REQUIRE(layout != NULL);
g_object_unref(layout);
REQUIRE(assets_panel != NULL);
assets_panel->unreference();
REQUIRE(viewer_panel != NULL);
viewer_panel->unreference();
REQUIRE(timeline_panel != NULL);
timeline_panel->unreference();
REQUIRE(assetsPanel != NULL);
assetsPanel->unreference();
REQUIRE(viewerPanel != NULL);
viewerPanel->unreference();
REQUIRE(timelinePanel != NULL);
timelinePanel->unreference();
}
void
@ -78,7 +78,7 @@ WorkspaceWindow::create_ui()
//----- Set up the UI Manager -----//
// The UI will be nested within a VBox
add(base_container);
add(baseContainer);
uiManager = Gtk::UIManager::create();
uiManager->insert_action_group(actions.actionGroup);
@ -131,21 +131,22 @@ WorkspaceWindow::create_ui()
//----- Set up the Menu Bar -----//
Gtk::Widget* menu_bar = uiManager->get_widget("/MenuBar");
ASSERT(menu_bar != NULL);
base_container.pack_start(*menu_bar, Gtk::PACK_SHRINK);
baseContainer.pack_start(*menu_bar, Gtk::PACK_SHRINK);
//----- Set up the Tool Bar -----//
Gtk::Toolbar* toolbar = dynamic_cast<Gtk::Toolbar*>(uiManager->get_widget("/ToolBar"));
Gtk::Toolbar* toolbar = dynamic_cast<Gtk::Toolbar*>(
uiManager->get_widget("/ToolBar"));
ASSERT(toolbar != NULL);
toolbar->set_toolbar_style(TOOLBAR_ICONS);
base_container.pack_start(*toolbar, Gtk::PACK_SHRINK);
baseContainer.pack_start(*toolbar, Gtk::PACK_SHRINK);
//----- Create the Panels -----//
assets_panel = new AssetsPanel();
ENSURE(assets_panel != NULL);
viewer_panel = new ViewerPanel();
ENSURE(viewer_panel != NULL);
timeline_panel = new TimelinePanel();
ENSURE(timeline_panel != NULL);
assetsPanel = new AssetsPanel();
ENSURE(assetsPanel != NULL);
viewerPanel = new ViewerPanel();
ENSURE(viewerPanel != NULL);
timelinePanel = new TimelinePanel();
ENSURE(timelinePanel != NULL);
//----- Create the Dock -----//
dock = Glib::wrap(gdl_dock_new());
@ -154,30 +155,41 @@ WorkspaceWindow::create_ui()
dockbar = Glib::wrap(gdl_dock_bar_new ((GdlDock*)dock->gobj()));
dock_container.pack_start(*dockbar, PACK_SHRINK);
dock_container.pack_end(*dock, PACK_EXPAND_WIDGET);
base_container.pack_start(dock_container, PACK_EXPAND_WIDGET);
dockContainer.pack_start(*dockbar, PACK_SHRINK);
dockContainer.pack_end(*dock, PACK_EXPAND_WIDGET);
baseContainer.pack_start(dockContainer, PACK_EXPAND_WIDGET);
gdl_dock_add_item ((GdlDock*)dock->gobj(), assets_panel->get_dock_item(), GDL_DOCK_LEFT);
gdl_dock_add_item ((GdlDock*)dock->gobj(), viewer_panel->get_dock_item(), GDL_DOCK_RIGHT);
gdl_dock_add_item ((GdlDock*)dock->gobj(), timeline_panel->get_dock_item(), GDL_DOCK_BOTTOM);
gdl_dock_add_item ((GdlDock*)dock->gobj(),
assetsPanel->get_dock_item(), GDL_DOCK_LEFT);
gdl_dock_add_item ((GdlDock*)dock->gobj(),
viewerPanel->get_dock_item(), GDL_DOCK_RIGHT);
gdl_dock_add_item ((GdlDock*)dock->gobj(),
timelinePanel->get_dock_item(), GDL_DOCK_BOTTOM);
// Manually dock and move around some of the items
gdl_dock_item_dock_to (timeline_panel->get_dock_item(),
assets_panel->get_dock_item(), GDL_DOCK_BOTTOM, -1);
gdl_dock_item_dock_to (viewer_panel->get_dock_item(),
assets_panel->get_dock_item(), GDL_DOCK_RIGHT, -1);
show_all_children();
gdl_dock_item_dock_to (timelinePanel->get_dock_item(),
assetsPanel->get_dock_item(), GDL_DOCK_BOTTOM, -1);
gdl_dock_item_dock_to (viewerPanel->get_dock_item(),
assetsPanel->get_dock_item(), GDL_DOCK_RIGHT, -1);
gchar ph1[] = "ph1";
gdl_dock_placeholder_new (ph1, (GdlDockObject*)dock->gobj(), GDL_DOCK_TOP, FALSE);
gdl_dock_placeholder_new (ph1, (GdlDockObject*)dock->gobj(),
GDL_DOCK_TOP, FALSE);
gchar ph2[] = "ph2";
gdl_dock_placeholder_new (ph2, (GdlDockObject*)dock->gobj(), GDL_DOCK_BOTTOM, FALSE);
gdl_dock_placeholder_new (ph2, (GdlDockObject*)dock->gobj(),
GDL_DOCK_BOTTOM, FALSE);
gchar ph3[] = "ph3";
gdl_dock_placeholder_new (ph3, (GdlDockObject*)dock->gobj(), GDL_DOCK_LEFT, FALSE);
gdl_dock_placeholder_new (ph3, (GdlDockObject*)dock->gobj(),
GDL_DOCK_LEFT, FALSE);
gchar ph4[] = "ph4";
gdl_dock_placeholder_new (ph4, (GdlDockObject*)dock->gobj(), GDL_DOCK_RIGHT, FALSE);
gdl_dock_placeholder_new (ph4, (GdlDockObject*)dock->gobj(),
GDL_DOCK_RIGHT, FALSE);
//----- Create the status bar -----//
statusBar.set_has_resize_grip();
baseContainer.pack_start(statusBar, PACK_SHRINK);
show_all_children();
}
} // namespace workspace

View file

@ -56,7 +56,8 @@ class WorkspaceWindow : public Gtk::Window
{
public:
WorkspaceWindow(lumiera::gui::model::Project *source_project);
virtual ~WorkspaceWindow();
~WorkspaceWindow();
private:
void create_ui();
@ -68,18 +69,22 @@ private:
/* ===== UI ===== */
private:
Glib::RefPtr<Gtk::UIManager> uiManager;
Gtk::VBox base_container;
Gtk::HBox dock_container;
Gtk::VBox baseContainer;
Gtk::HBox dockContainer;
//----- Dock Frame -----//
Gtk::Widget *dock;
Gtk::Widget *dockbar;
GdlDockLayout *layout;
//----- Status Bar -----//
Gtk::Statusbar statusBar;
/* ===== Panels ===== */
private:
AssetsPanel *assets_panel;
ViewerPanel *viewer_panel;
TimelinePanel *timeline_panel;
AssetsPanel *assetsPanel;
ViewerPanel *viewerPanel;
TimelinePanel *timelinePanel;
/* ===== Helpers ===== */
private: