Added GDL docking framework, and some placeholder panels

This commit is contained in:
Joel Holdsworth 2008-04-12 21:15:07 +01:00
parent 4698998d43
commit 584a33408b
11 changed files with 445 additions and 23 deletions

View file

@ -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 =

38
gui/src/panels/assets.cpp Normal file
View file

@ -0,0 +1,38 @@
/*
assets.cpp - Implementation of the assets panel
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
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

48
gui/src/panels/assets.hpp Normal file
View file

@ -0,0 +1,48 @@
/*
assets.hpp - Definition of the assets panel
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
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

49
gui/src/panels/panel.cpp Normal file
View file

@ -0,0 +1,49 @@
/*
panel.cpp - Implementation of Panel, the base class for docking panels
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
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

59
gui/src/panels/panel.hpp Normal file
View file

@ -0,0 +1,59 @@
/*
panel.hpp - Definition of Panel, the base class for docking panels
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
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 <gtkmm.h>
#include <libgdl-1.0/gdl/gdl-dock-item.h>
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

View file

@ -0,0 +1,38 @@
/*
timeline.cpp - Implementation of the timeline panel
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
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

View file

@ -0,0 +1,48 @@
/*
timeline.hpp - Definition of the timeline panel
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
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

38
gui/src/panels/viewer.cpp Normal file
View file

@ -0,0 +1,38 @@
/*
viewer.cpp - Implementation of the viewer panel
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
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

48
gui/src/panels/viewer.hpp Normal file
View file

@ -0,0 +1,48 @@
/*
viewer.hpp - Definition of the viewer panel
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
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

View file

@ -26,9 +26,20 @@
# include <libintl.h>
#endif
#include <libgdl-1.0/gdl/gdl-tools.h>
#include <libgdl-1.0/gdl/gdl-dock.h>
#include <libgdl-1.0/gdl/gdl-dock-item.h>
#include <libgdl-1.0/gdl/gdl-dock-notebook.h>
#include <libgdl-1.0/gdl/gdl-dock-placeholder.h>
#include <libgdl-1.0/gdl/gdl-dock-bar.h>
#include <libgdl-1.0/gdl/gdl-switcher.h>
#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 {
" </toolbar>"
"</ui>";
#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<Glib::Error> 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

View file

@ -26,12 +26,20 @@
** @see actions.hpp
*/
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <gtkmm.h>
#include <libgdl-1.0/gdl/gdl-dock-layout.h>
#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<Gtk::UIManager> 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:
/**