From 584a33408bda46b0a1a6f2a668cced8bf1ddfc8b Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 12 Apr 2008 21:15:07 +0100 Subject: [PATCH] Added GDL docking framework, and some placeholder panels --- gui/src/Makefile.am | 12 +++++-- gui/src/panels/assets.cpp | 38 ++++++++++++++++++++ gui/src/panels/assets.hpp | 48 +++++++++++++++++++++++++ gui/src/panels/panel.cpp | 49 +++++++++++++++++++++++++ gui/src/panels/panel.hpp | 59 ++++++++++++++++++++++++++++++ gui/src/panels/timeline.cpp | 38 ++++++++++++++++++++ gui/src/panels/timeline.hpp | 48 +++++++++++++++++++++++++ gui/src/panels/viewer.cpp | 38 ++++++++++++++++++++ gui/src/panels/viewer.hpp | 48 +++++++++++++++++++++++++ gui/src/workspace/mainwindow.cpp | 61 +++++++++++++++++++++++--------- gui/src/workspace/mainwindow.hpp | 29 ++++++++++++--- 11 files changed, 445 insertions(+), 23 deletions(-) create mode 100644 gui/src/panels/assets.cpp create mode 100644 gui/src/panels/assets.hpp create mode 100644 gui/src/panels/panel.cpp create mode 100644 gui/src/panels/panel.hpp create mode 100644 gui/src/panels/timeline.cpp create mode 100644 gui/src/panels/timeline.hpp create mode 100644 gui/src/panels/viewer.cpp create mode 100644 gui/src/panels/viewer.hpp diff --git a/gui/src/Makefile.am b/gui/src/Makefile.am index 0cef35d54..0d149d8de 100644 --- a/gui/src/Makefile.am +++ b/gui/src/Makefile.am @@ -16,14 +16,22 @@ AM_CFLAGS =\ bin_PROGRAMS = gtk-lumiera gtk_lumiera_SOURCES = \ - gtk-lumiera.cpp \ + gtk-lumiera.cpp \ gtk-lumiera.hpp \ workspace/actions.cpp \ workspace/actions.hpp \ workspace/mainwindow.cpp \ workspace/mainwindow.hpp \ dialogs/render.cpp \ - dialogs/render.hpp + dialogs/render.hpp \ + panels/panel.cpp \ + panels/panel.hpp \ + panels/timeline.cpp \ + panels/timeline.hpp \ + panels/viewer.cpp \ + panels/viewer.hpp \ + panels/assets.cpp \ + panels/assets.hpp gtk_lumiera_LDFLAGS = diff --git a/gui/src/panels/assets.cpp b/gui/src/panels/assets.cpp new file mode 100644 index 000000000..daaa0f363 --- /dev/null +++ b/gui/src/panels/assets.cpp @@ -0,0 +1,38 @@ +/* + assets.cpp - Implementation of the assets panel + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + +#include "assets.hpp" + +namespace lumiera { +namespace gui { +namespace panels { + +Assets::Assets() : + Panel("assets", "Assets"), + placeholder("Placeholder label. Is this supposed to be titled assets\nas in the proc layer? or resources\nas in cinelerra?") + { + pack_start(placeholder); + } + +} // namespace panels +} // namespace gui +} // namespace lumiera diff --git a/gui/src/panels/assets.hpp b/gui/src/panels/assets.hpp new file mode 100644 index 000000000..1a11107d9 --- /dev/null +++ b/gui/src/panels/assets.hpp @@ -0,0 +1,48 @@ +/* + assets.hpp - Definition of the assets panel + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ +/** @file timeline.hpp + ** This file contains the definition of the assets panel + */ + +#ifndef ASSETS_H +#define ASSETS_H + +#include "panel.hpp" + +namespace lumiera { +namespace gui { +namespace panels { + + class Assets : public Panel + { + public: + Assets(); + + protected: + Gtk::Label placeholder; + }; + +} // namespace panels +} // namespace gui +} // namespace lumiera + +#endif // ASSETS_H diff --git a/gui/src/panels/panel.cpp b/gui/src/panels/panel.cpp new file mode 100644 index 000000000..67ac1fd3f --- /dev/null +++ b/gui/src/panels/panel.cpp @@ -0,0 +1,49 @@ +/* + panel.cpp - Implementation of Panel, the base class for docking panels + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + +#include "panel.hpp" + +namespace lumiera { +namespace gui { +namespace panels { + +Panel::Panel(const gchar *name, const gchar *long_name, GdlDockItemBehavior behavior) +{ + dock_item = (GdlDockItem*)gdl_dock_item_new (name, long_name, behavior); + gtk_container_add ((GtkContainer*)dock_item, (GtkWidget*)gobj()); + gtk_widget_show ((GtkWidget*)dock_item); +} + +Panel::~Panel() +{ + +} + +GdlDockItem* Panel::get_dock_item() const +{ + return dock_item; +} + +} // namespace panels +} // namespace gui +} // namespace lumiera + diff --git a/gui/src/panels/panel.hpp b/gui/src/panels/panel.hpp new file mode 100644 index 000000000..fdb7296cf --- /dev/null +++ b/gui/src/panels/panel.hpp @@ -0,0 +1,59 @@ +/* + panel.hpp - Definition of Panel, the base class for docking panels + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ +/** @file panel.hpp + ** This file contains the definition of Panel; the base class + ** for all docking panels + */ + +#ifndef PANEL_H +#define PANEL_H + +#include +#include + +namespace lumiera { +namespace gui { +namespace panels { + + /** + * The main lumiera workspace window + */ + class Panel : public Gtk::VBox + { + protected: + Panel(const gchar *name, const gchar *long_name, + GdlDockItemBehavior behavior = GDL_DOCK_ITEM_BEH_NORMAL); + ~Panel(); + + public: + GdlDockItem* get_dock_item() const; + + + protected: + GdlDockItem* dock_item; + }; + +} // namespace panels +} // namespace gui +} // namespace lumiera + +#endif // PANEL_H diff --git a/gui/src/panels/timeline.cpp b/gui/src/panels/timeline.cpp new file mode 100644 index 000000000..1e5086fd7 --- /dev/null +++ b/gui/src/panels/timeline.cpp @@ -0,0 +1,38 @@ +/* + timeline.cpp - Implementation of the timeline panel + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + +#include "timeline.hpp" + +namespace lumiera { +namespace gui { +namespace panels { + +Timeline::Timeline() : + Panel("timeline", "Timeline"), + placeholder("Placeholder label. Is Timeline the correct title for this panel?") + { + pack_start(placeholder); + } + +} // namespace panels +} // namespace gui +} // namespace lumiera diff --git a/gui/src/panels/timeline.hpp b/gui/src/panels/timeline.hpp new file mode 100644 index 000000000..54c6afe1e --- /dev/null +++ b/gui/src/panels/timeline.hpp @@ -0,0 +1,48 @@ +/* + timeline.hpp - Definition of the timeline panel + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ +/** @file timeline.hpp + ** This file contains the definition of the timeline panel + */ + +#ifndef TIMELINE_H +#define TIMELINE_H + +#include "panel.hpp" + +namespace lumiera { +namespace gui { +namespace panels { + + class Timeline : public Panel + { + public: + Timeline(); + + protected: + Gtk::Label placeholder; + }; + +} // namespace panels +} // namespace gui +} // namespace lumiera + +#endif // TIMELINE_H diff --git a/gui/src/panels/viewer.cpp b/gui/src/panels/viewer.cpp new file mode 100644 index 000000000..991bb7457 --- /dev/null +++ b/gui/src/panels/viewer.cpp @@ -0,0 +1,38 @@ +/* + viewer.cpp - Implementation of the viewer panel + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + +#include "viewer.hpp" + +namespace lumiera { +namespace gui { +namespace panels { + +Viewer::Viewer() : + Panel("viewer", "Viewer"), + placeholder("Placeholder: XVideo in here!!!") + { + pack_start(placeholder); + } + +} // namespace panels +} // namespace gui +} // namespace lumiera diff --git a/gui/src/panels/viewer.hpp b/gui/src/panels/viewer.hpp new file mode 100644 index 000000000..8090f01c4 --- /dev/null +++ b/gui/src/panels/viewer.hpp @@ -0,0 +1,48 @@ +/* + viewer.hpp - Definition of the viewer panel + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ +/** @file viewer.hpp + ** This file contains the definition of the viewer panel + */ + +#ifndef VIEWER_H +#define VIEWER_H + +#include "panel.hpp" + +namespace lumiera { +namespace gui { +namespace panels { + + class Viewer : public Panel + { + public: + Viewer(); + + protected: + Gtk::Button placeholder; + }; + +} // namespace panels +} // namespace gui +} // namespace lumiera + +#endif // VIEWER_H diff --git a/gui/src/workspace/mainwindow.cpp b/gui/src/workspace/mainwindow.cpp index 8b2c13074..bbff0aa6d 100644 --- a/gui/src/workspace/mainwindow.cpp +++ b/gui/src/workspace/mainwindow.cpp @@ -26,9 +26,20 @@ # include #endif +#include + +#include +#include +#include +#include +#include +#include + #include "gtk-lumiera.hpp" #include "mainwindow.hpp" +using namespace Gtk; + namespace lumiera { namespace gui { namespace workspace { @@ -51,7 +62,7 @@ namespace workspace { set_default_size(1024, 768); // The UI will be nested within a VBOX - add(box); + add(base_container); uiManager = Gtk::UIManager::create(); uiManager->insert_action_group(actions.actionGroup); @@ -91,34 +102,52 @@ namespace workspace { " " ""; -#ifdef GLIBMM_EXCEPTIONS_ENABLED try { uiManager->add_ui_from_string(ui_info); } catch(const Glib::Error& ex) { - g_error("building menus failed: "); + g_error("building menus failed: %s", ex.what().data()); return; } -#else - std::auto_ptr ex; - uiManager->add_ui_from_string(ui_info, ex); - if(ex.get()) - { - g_error("building menus failed: "); - return; - } -#endif //GLIBMM_EXCEPTIONS_ENABLED // Get the menubar and toolbar widgets, and add them to a container widget: Gtk::Widget* menu_bar = uiManager->get_widget("/MenuBar"); - if(menu_bar) box.pack_start(*menu_bar, Gtk::PACK_SHRINK); - + g_assert(menu_bar); + base_container.pack_start(*menu_bar, Gtk::PACK_SHRINK); + Gtk::Widget* toolbar = uiManager->get_widget("/ToolBar") ; - if(toolbar) box.pack_start(*toolbar, Gtk::PACK_SHRINK); + g_assert(toolbar); + base_container.pack_start(*toolbar, Gtk::PACK_SHRINK); - show_all_children(); + //----- Create the dock -----// + dock = Glib::wrap(gdl_dock_new()); + + layout = gdl_dock_layout_new((GdlDock*)dock->gobj()); + + dockbar = Glib::wrap(gdl_dock_bar_new ((GdlDock*)dock->gobj())); + gdl_dock_bar_set_style((GdlDockBar*)dockbar->gobj(), GDL_DOCK_BAR_TEXT); + + dock_container.pack_start(*dockbar, PACK_SHRINK); + dock_container.pack_end(*dock, PACK_EXPAND_WIDGET); + base_container.pack_start(dock_container, PACK_EXPAND_WIDGET); + + gdl_dock_add_item ((GdlDock*)dock->gobj(), assets.get_dock_item(), GDL_DOCK_LEFT); + gdl_dock_add_item ((GdlDock*)dock->gobj(), viewer.get_dock_item(), GDL_DOCK_RIGHT); + gdl_dock_add_item ((GdlDock*)dock->gobj(), timeline.get_dock_item(), GDL_DOCK_BOTTOM); + + // Manually dock and move around some of the items + gdl_dock_item_dock_to (timeline.get_dock_item(), assets.get_dock_item(), + GDL_DOCK_BOTTOM, -1); + gdl_dock_item_dock_to (viewer.get_dock_item(), assets.get_dock_item(), + GDL_DOCK_RIGHT, -1); + show_all_children(); + + gdl_dock_placeholder_new ("ph1", (GdlDockObject*)dock->gobj(), GDL_DOCK_TOP, FALSE); + gdl_dock_placeholder_new ("ph2", (GdlDockObject*)dock->gobj(), GDL_DOCK_BOTTOM, FALSE); + gdl_dock_placeholder_new ("ph3", (GdlDockObject*)dock->gobj(), GDL_DOCK_LEFT, FALSE); + gdl_dock_placeholder_new ("ph4", (GdlDockObject*)dock->gobj(), GDL_DOCK_RIGHT, FALSE); } } // namespace workspace diff --git a/gui/src/workspace/mainwindow.hpp b/gui/src/workspace/mainwindow.hpp index 541646c29..3913533cc 100644 --- a/gui/src/workspace/mainwindow.hpp +++ b/gui/src/workspace/mainwindow.hpp @@ -26,12 +26,20 @@ ** @see actions.hpp */ -#ifndef MAIN_WINDOW_H -#define MAIN_WINDOW_H +#ifndef MAINWINDOW_H +#define MAINWINDOW_H #include +#include + #include "actions.hpp" +#include "../panels/assets.hpp" +#include "../panels/viewer.hpp" +#include "../panels/timeline.hpp" + +using namespace lumiera::gui::panels; + namespace lumiera { namespace gui { namespace workspace { @@ -42,17 +50,28 @@ namespace workspace { class MainWindow : public Gtk::Window { public: - MainWindow(); - virtual ~MainWindow(); + MainWindow(); + virtual ~MainWindow(); protected: void create_ui(); /* ===== UI ===== */ protected: - Gtk::VBox box; Glib::RefPtr uiManager; + Gtk::VBox base_container; + Gtk::HBox dock_container; + Gtk::Widget *dock; + Gtk::Widget *dockbar; + GdlDockLayout *layout; + + /* ===== Panels ===== */ + protected: + Assets assets; + Viewer viewer; + Timeline timeline; + /* ===== Helpers ===== */ protected: /**