Merge branch 'gui' of git://git.lumiera.org/LUMIERA into doxygen_fixes
This commit is contained in:
commit
a605f15ecd
9 changed files with 429 additions and 256 deletions
|
|
@ -24,25 +24,54 @@
|
|||
#include "timeline-panel.hpp"
|
||||
|
||||
using namespace Gtk;
|
||||
using namespace sigc;
|
||||
|
||||
namespace lumiera {
|
||||
namespace gui {
|
||||
namespace panels {
|
||||
|
||||
const int TimelinePanel::ZoomToolSteps = 2; // 2 seems comfortable
|
||||
|
||||
TimelinePanel::TimelinePanel() :
|
||||
Panel("timeline", _("Timeline"), "timeline_panel"),
|
||||
button(Stock::OK)
|
||||
{
|
||||
// Setup the toolbar
|
||||
toolbar.append(button);
|
||||
|
||||
toolbar.set_icon_size(IconSize(ICON_SIZE_MENU));
|
||||
toolbar.set_toolbar_style(TOOLBAR_ICONS);
|
||||
|
||||
// Add the toolbar
|
||||
pack_start(toolbar, PACK_SHRINK);
|
||||
pack_start(timeline_widget, PACK_EXPAND_WIDGET);
|
||||
}
|
||||
zoomIn(Stock::ZOOM_IN),
|
||||
zoomOut(Stock::ZOOM_OUT)
|
||||
{
|
||||
// Setup the toolbar
|
||||
toolbar.append(zoomIn, mem_fun(this, &TimelinePanel::on_zoom_in));
|
||||
toolbar.append(zoomOut, mem_fun(this, &TimelinePanel::on_zoom_out));
|
||||
|
||||
toolbar.set_icon_size(IconSize(ICON_SIZE_SMALL_TOOLBAR));
|
||||
toolbar.set_toolbar_style(TOOLBAR_ICONS);
|
||||
|
||||
// Add the toolbar
|
||||
pack_start(toolbar, PACK_SHRINK);
|
||||
pack_start(timelineWidget, PACK_EXPAND_WIDGET);
|
||||
|
||||
update_zoom_buttons();
|
||||
}
|
||||
|
||||
void
|
||||
TimelinePanel::on_zoom_in()
|
||||
{
|
||||
timelineWidget.zoom_view(ZoomToolSteps);
|
||||
update_zoom_buttons();
|
||||
}
|
||||
|
||||
void
|
||||
TimelinePanel::on_zoom_out()
|
||||
{
|
||||
timelineWidget.zoom_view(-ZoomToolSteps);
|
||||
update_zoom_buttons();
|
||||
}
|
||||
|
||||
void
|
||||
TimelinePanel::update_zoom_buttons()
|
||||
{
|
||||
zoomIn.set_sensitive(timelineWidget.get_time_scale() != 1);
|
||||
zoomOut.set_sensitive(timelineWidget.get_time_scale() !=
|
||||
TimelineWidget::MaxScale);
|
||||
}
|
||||
|
||||
} // namespace panels
|
||||
} // namespace gui
|
||||
|
|
|
|||
|
|
@ -35,20 +35,34 @@ namespace lumiera {
|
|||
namespace gui {
|
||||
namespace panels {
|
||||
|
||||
class TimelinePanel : public Panel
|
||||
{
|
||||
public:
|
||||
TimelinePanel();
|
||||
class TimelinePanel : public Panel
|
||||
{
|
||||
public:
|
||||
TimelinePanel();
|
||||
|
||||
protected:
|
||||
|
||||
// Widgets
|
||||
Gtk::Toolbar toolbar;
|
||||
TimelineWidget timeline_widget;
|
||||
|
||||
// Toolbar Widgets
|
||||
Gtk::ToolButton button;
|
||||
};
|
||||
private:
|
||||
//----- Event Handlers -----//
|
||||
void on_zoom_in();
|
||||
void on_zoom_out();
|
||||
|
||||
private:
|
||||
void update_zoom_buttons();
|
||||
|
||||
private:
|
||||
|
||||
//----- Data -----//
|
||||
|
||||
// Widgets
|
||||
Gtk::Toolbar toolbar;
|
||||
TimelineWidget timelineWidget;
|
||||
|
||||
// Toolbar Widgets
|
||||
Gtk::ToolButton zoomIn;
|
||||
Gtk::ToolButton zoomOut;
|
||||
|
||||
//----- Constants -----//
|
||||
static const int ZoomToolSteps;
|
||||
};
|
||||
|
||||
} // namespace panels
|
||||
} // namespace gui
|
||||
|
|
|
|||
|
|
@ -52,10 +52,12 @@ TimelineWidget::TimelineWidget() :
|
|||
headerContainer = new HeaderContainer(this);
|
||||
ENSURE(headerContainer != NULL);
|
||||
|
||||
horizontalAdjustment.signal_value_changed().connect(
|
||||
sigc::mem_fun(this, &TimelineWidget::on_scroll) );
|
||||
verticalAdjustment.signal_value_changed().connect(
|
||||
sigc::mem_fun(this, &TimelineWidget::on_scroll) );
|
||||
horizontalAdjustment.signal_value_changed().connect( sigc::mem_fun(
|
||||
this, &TimelineWidget::on_scroll) );
|
||||
verticalAdjustment.signal_value_changed().connect( sigc::mem_fun(
|
||||
this, &TimelineWidget::on_scroll) );
|
||||
body->signal_motion_notify_event().connect( sigc::mem_fun(
|
||||
this, &TimelineWidget::on_motion_in_body_notify_event) );
|
||||
|
||||
set_time_scale(GAVL_TIME_SCALE / 200);
|
||||
|
||||
|
|
@ -106,6 +108,46 @@ TimelineWidget::set_time_scale(int64_t time_scale)
|
|||
ruler.set_time_scale(time_scale);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineWidget::shift_view(int shift_size)
|
||||
{
|
||||
const int view_width = body->get_allocation().get_width();
|
||||
|
||||
set_time_offset(get_time_offset() +
|
||||
shift_size * timeScale * view_width / 16);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineWidget::zoom_view(int zoom_size)
|
||||
{
|
||||
const Allocation allocation = body->get_allocation();
|
||||
zoom_view(allocation.get_width() / 2, zoom_size);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineWidget::zoom_view(int point, int zoom_size)
|
||||
{
|
||||
int64_t new_time_scale = (double)timeScale * pow(1.25, -zoom_size);
|
||||
|
||||
// Limit zooming in too close
|
||||
if(new_time_scale < 1) new_time_scale = 1;
|
||||
|
||||
// Nudge zoom problems caused by integer rounding
|
||||
if(new_time_scale == timeScale && zoom_size < 0)
|
||||
new_time_scale++;
|
||||
|
||||
// Limit zooming out too far
|
||||
if(new_time_scale > MaxScale)
|
||||
new_time_scale = MaxScale;
|
||||
|
||||
// The view must be shifted so that the zoom is centred on the cursor
|
||||
set_time_offset(get_time_offset() +
|
||||
(timeScale - new_time_scale) * point);
|
||||
|
||||
// Apply the new scale
|
||||
set_time_scale(new_time_scale);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineWidget::on_scroll()
|
||||
{
|
||||
|
|
@ -174,43 +216,12 @@ TimelineWidget::get_y_scroll_offset() const
|
|||
return (int)verticalAdjustment.get_value();
|
||||
}
|
||||
|
||||
void
|
||||
TimelineWidget::shift_view(int shift_size)
|
||||
bool
|
||||
TimelineWidget::on_motion_in_body_notify_event(GdkEventMotion *event)
|
||||
{
|
||||
const int view_width = body->get_allocation().get_width();
|
||||
|
||||
set_time_offset(get_time_offset() +
|
||||
shift_size * timeScale * view_width / 16);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineWidget::zoom_view(int point, int zoom_size)
|
||||
{
|
||||
int64_t new_time_scale = (double)timeScale * pow(1.25, -zoom_size);
|
||||
|
||||
// Limit zooming in too close
|
||||
if(new_time_scale < 1) new_time_scale = 1;
|
||||
|
||||
// Nudge zoom problems caused by integer rounding
|
||||
if(new_time_scale == timeScale && zoom_size < 0)
|
||||
new_time_scale++;
|
||||
|
||||
// Limit zooming out too far
|
||||
if(new_time_scale > MaxScale)
|
||||
new_time_scale = MaxScale;
|
||||
|
||||
// The view must be shifted so that the zoom is centred on the cursor
|
||||
set_time_offset(get_time_offset() +
|
||||
(timeScale - new_time_scale) * point);
|
||||
|
||||
// Apply the new scale
|
||||
set_time_scale(new_time_scale);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineWidget::on_mouse_move_in_body(int x, int y)
|
||||
{
|
||||
ruler.set_mouse_chevron_offset(x);
|
||||
REQUIRE(event != NULL);
|
||||
ruler.set_mouse_chevron_offset(event->x);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace widgets
|
||||
|
|
|
|||
|
|
@ -72,7 +72,30 @@ public:
|
|||
* zero
|
||||
*/
|
||||
void set_time_scale(int64_t time_scale);
|
||||
|
||||
|
||||
/**
|
||||
* Zooms the view in or out as by a number of steps while keeping
|
||||
* centre of the view still.
|
||||
* @param zoom_size The number of steps to zoom by. The scale factor
|
||||
* is 1.25^(-zoom_size).
|
||||
**/
|
||||
void zoom_view(int zoom_size);
|
||||
|
||||
/**
|
||||
* Zooms the view in or out as by a number of steps while keeping a
|
||||
* given point on the timeline still.
|
||||
* @param zoom_size The number of steps to zoom by. The scale factor
|
||||
* is 1.25^(-zoom_size).
|
||||
**/
|
||||
void zoom_view(int point, int zoom_size);
|
||||
|
||||
/**
|
||||
* Scrolls the view horizontally as a proportion of the view area.
|
||||
* @param shift_size The size of the shift in 1/16ths of the view
|
||||
* width.
|
||||
**/
|
||||
void shift_view(int shift_size);
|
||||
|
||||
/* ===== Events ===== */
|
||||
protected:
|
||||
void on_scroll();
|
||||
|
|
@ -88,16 +111,7 @@ protected:
|
|||
|
||||
int get_y_scroll_offset() const;
|
||||
|
||||
/**
|
||||
* Scrolls the view horizontally as a proportion of the view area.
|
||||
* @param shift_size The size of the shift in 1/16ths of the view
|
||||
* width.
|
||||
**/
|
||||
void shift_view(int shift_size);
|
||||
|
||||
void zoom_view(int point, int zoom_size);
|
||||
|
||||
void on_mouse_move_in_body(int x, int y);
|
||||
bool on_motion_in_body_notify_event(GdkEventMotion *event);
|
||||
|
||||
protected:
|
||||
gavl_time_t timeOffset;
|
||||
|
|
@ -118,11 +132,13 @@ protected:
|
|||
Gtk::VScrollbar verticalScroll;
|
||||
|
||||
/* ===== Constants ===== */
|
||||
public:
|
||||
static const int64_t MaxScale;
|
||||
|
||||
protected:
|
||||
static const int TrackPadding;
|
||||
static const int HeaderWidth;
|
||||
static const double ZoomIncrement;
|
||||
static const int64_t MaxScale;
|
||||
|
||||
friend class timeline::TimelineBody;
|
||||
friend class timeline::HeaderContainer;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ namespace timeline {
|
|||
|
||||
TimelineBody::TimelineBody(lumiera::gui::widgets::TimelineWidget *timeline_widget) :
|
||||
Glib::ObjectBase("TimelineBody"),
|
||||
dragType(None),
|
||||
mouseDownX(0),
|
||||
mouseDownY(0),
|
||||
beginShiftTimeOffset(0),
|
||||
timelineWidget(timeline_widget)
|
||||
{
|
||||
REQUIRE(timelineWidget != NULL);
|
||||
|
|
@ -66,7 +70,11 @@ TimelineBody::on_realize()
|
|||
Widget::on_realize();
|
||||
|
||||
// We wish to receive all event notifications
|
||||
add_events(Gdk::POINTER_MOTION_MASK | Gdk::SCROLL_MASK);
|
||||
add_events(
|
||||
Gdk::POINTER_MOTION_MASK |
|
||||
Gdk::SCROLL_MASK |
|
||||
Gdk::BUTTON_PRESS_MASK |
|
||||
Gdk::BUTTON_RELEASE_MASK);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -114,14 +122,52 @@ TimelineBody::on_scroll_event (GdkEventScroll* event)
|
|||
}
|
||||
|
||||
bool
|
||||
TimelineBody::on_motion_notify_event(GdkEventMotion *event)
|
||||
TimelineBody::on_button_press_event(GdkEventButton* event)
|
||||
{
|
||||
mouseDownX = event->x;
|
||||
mouseDownY = event->y;
|
||||
|
||||
switch(event->button)
|
||||
{
|
||||
case 2:
|
||||
begin_shift_drag();
|
||||
break;
|
||||
|
||||
default:
|
||||
dragType = None;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
TimelineBody::on_button_release_event(GdkEventButton* event)
|
||||
{
|
||||
// Terminate any drags
|
||||
dragType = None;
|
||||
}
|
||||
|
||||
bool
|
||||
TimelineBody::on_motion_notify_event(GdkEventMotion *event)
|
||||
{
|
||||
REQUIRE(event != NULL);
|
||||
REQUIRE(timelineWidget != NULL);
|
||||
|
||||
switch(dragType)
|
||||
{
|
||||
case Shift:
|
||||
{
|
||||
const int64_t scale = timelineWidget->get_time_scale();
|
||||
gavl_time_t offset = beginShiftTimeOffset +
|
||||
(int64_t)(mouseDownX - event->x) * scale;
|
||||
timelineWidget->set_time_offset(offset);
|
||||
|
||||
set_vertical_offset((int)(mouseDownY - event->y) +
|
||||
beginShiftVerticalOffset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
timelineWidget->on_mouse_move_in_body(event->x, event->y);
|
||||
|
||||
return true;
|
||||
// false so that the message is passed up to the owner TimelineWidget
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -147,8 +193,7 @@ TimelineBody::on_expose_event(GdkEventExpose* event)
|
|||
REQUIRE(cairo);
|
||||
|
||||
// Translate the view by the scroll distance
|
||||
cairo->translate(0,
|
||||
-(int)timelineWidget->verticalAdjustment.get_value());
|
||||
cairo->translate(0, -get_vertical_offset());
|
||||
|
||||
// Interate drawing each track
|
||||
BOOST_FOREACH( Track* track, timelineWidget->tracks )
|
||||
|
|
@ -174,6 +219,26 @@ TimelineBody::on_expose_event(GdkEventExpose* event)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
TimelineBody::begin_shift_drag()
|
||||
{
|
||||
dragType = Shift;
|
||||
beginShiftTimeOffset = timelineWidget->get_time_offset();
|
||||
beginShiftVerticalOffset = get_vertical_offset();
|
||||
}
|
||||
|
||||
int
|
||||
TimelineBody::get_vertical_offset() const
|
||||
{
|
||||
return (int)timelineWidget->verticalAdjustment.get_value();
|
||||
}
|
||||
|
||||
void
|
||||
TimelineBody::set_vertical_offset(int offset)
|
||||
{
|
||||
timelineWidget->verticalAdjustment.set_value(offset);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineBody::read_styles()
|
||||
|
|
|
|||
|
|
@ -37,31 +37,55 @@ class TimelineWidget;
|
|||
namespace timeline {
|
||||
|
||||
class TimelineBody : public Gtk::DrawingArea
|
||||
{
|
||||
public:
|
||||
TimelineBody(lumiera::gui::widgets::TimelineWidget *timeline_widget);
|
||||
{
|
||||
public:
|
||||
TimelineBody(lumiera::gui::widgets::TimelineWidget *timeline_widget);
|
||||
|
||||
/* ===== Events ===== */
|
||||
protected:
|
||||
void on_realize();
|
||||
/* ===== Events ===== */
|
||||
protected:
|
||||
void on_realize();
|
||||
|
||||
void on_scroll();
|
||||
|
||||
void on_scroll();
|
||||
|
||||
bool on_scroll_event(GdkEventScroll* event);
|
||||
|
||||
bool on_motion_notify_event(GdkEventMotion *event);
|
||||
|
||||
bool on_expose_event(GdkEventExpose* event);
|
||||
|
||||
/* ===== Internals ===== */
|
||||
private:
|
||||
void read_styles();
|
||||
|
||||
private:
|
||||
GdkColor background;
|
||||
|
||||
lumiera::gui::widgets::TimelineWidget *timelineWidget;
|
||||
bool on_scroll_event(GdkEventScroll* event);
|
||||
|
||||
bool on_button_press_event (GdkEventButton* event);
|
||||
|
||||
bool on_button_release_event (GdkEventButton* event);
|
||||
|
||||
bool on_motion_notify_event(GdkEventMotion *event);
|
||||
|
||||
bool on_expose_event(GdkEventExpose* event);
|
||||
|
||||
/* ===== Internals ===== */
|
||||
private:
|
||||
void begin_shift_drag();
|
||||
|
||||
int get_vertical_offset() const;
|
||||
|
||||
void set_vertical_offset(int offset);
|
||||
|
||||
void read_styles();
|
||||
|
||||
private:
|
||||
|
||||
// Internal structures
|
||||
enum DragType
|
||||
{
|
||||
None,
|
||||
Shift
|
||||
};
|
||||
|
||||
// UI State Data
|
||||
DragType dragType;
|
||||
double mouseDownX, mouseDownY;
|
||||
gavl_time_t beginShiftTimeOffset;
|
||||
int beginShiftVerticalOffset;
|
||||
|
||||
GdkColor background;
|
||||
|
||||
lumiera::gui::widgets::TimelineWidget *timelineWidget;
|
||||
};
|
||||
|
||||
} // namespace timeline
|
||||
} // namespace widgets
|
||||
|
|
|
|||
|
|
@ -108,14 +108,14 @@ Actions::add_stock_item(const Glib::RefPtr<IconFactory>& factory,
|
|||
{
|
||||
Gtk::IconSource source;
|
||||
try
|
||||
{
|
||||
//This throws an exception if the file is not found:
|
||||
source.set_pixbuf( Gdk::Pixbuf::create_from_file(filepath) );
|
||||
}
|
||||
{
|
||||
//This throws an exception if the file is not found:
|
||||
source.set_pixbuf( Gdk::Pixbuf::create_from_file(filepath) );
|
||||
}
|
||||
catch(const Glib::Exception& ex)
|
||||
{
|
||||
g_message(ex.what().c_str());
|
||||
}
|
||||
{
|
||||
g_message(ex.what().c_str());
|
||||
}
|
||||
|
||||
source.set_size(Gtk::ICON_SIZE_SMALL_TOOLBAR);
|
||||
source.set_size_wildcarded(); //Icon may be scaled.
|
||||
|
|
@ -131,9 +131,9 @@ Actions::add_stock_item(const Glib::RefPtr<IconFactory>& factory,
|
|||
void
|
||||
Actions::update_action_state()
|
||||
{
|
||||
REQUIRE(workspaceWindow.assets_panel);
|
||||
REQUIRE(workspaceWindow.timeline_panel);
|
||||
REQUIRE(workspaceWindow.viewer_panel);
|
||||
REQUIRE(workspaceWindow.assets_panel != NULL);
|
||||
REQUIRE(workspaceWindow.timeline_panel != NULL);
|
||||
REQUIRE(workspaceWindow.viewer_panel != NULL);
|
||||
|
||||
is_updating_action_state = true;
|
||||
assetsPanelAction->set_active(workspaceWindow.assets_panel->is_shown());
|
||||
|
|
|
|||
|
|
@ -45,126 +45,140 @@ namespace workspace {
|
|||
WorkspaceWindow::WorkspaceWindow(Project *source_project) :
|
||||
project(source_project),
|
||||
actions(*this)
|
||||
{
|
||||
REQUIRE(source_project != NULL);
|
||||
|
||||
layout = NULL;
|
||||
{
|
||||
REQUIRE(source_project != NULL);
|
||||
|
||||
layout = NULL;
|
||||
assets_panel = NULL;
|
||||
viewer_panel = NULL;
|
||||
timeline_panel = NULL;
|
||||
|
||||
create_ui();
|
||||
}
|
||||
create_ui();
|
||||
}
|
||||
|
||||
WorkspaceWindow::~WorkspaceWindow()
|
||||
{
|
||||
if(layout != NULL) g_object_unref(layout);
|
||||
}
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
void
|
||||
WorkspaceWindow::create_ui()
|
||||
{
|
||||
//----- Configure the Window -----//
|
||||
set_title(AppTitle);
|
||||
set_default_size(1024, 768);
|
||||
{
|
||||
//----- Configure the Window -----//
|
||||
set_title(AppTitle);
|
||||
set_default_size(1024, 768);
|
||||
|
||||
//----- Set up the UI Manager -----//
|
||||
// The UI will be nested within a VBox
|
||||
add(base_container);
|
||||
//----- Set up the UI Manager -----//
|
||||
// The UI will be nested within a VBox
|
||||
add(base_container);
|
||||
|
||||
uiManager = Gtk::UIManager::create();
|
||||
uiManager->insert_action_group(actions.actionGroup);
|
||||
uiManager = Gtk::UIManager::create();
|
||||
uiManager->insert_action_group(actions.actionGroup);
|
||||
|
||||
add_accel_group(uiManager->get_accel_group());
|
||||
add_accel_group(uiManager->get_accel_group());
|
||||
|
||||
//Layout the actions in a menubar and toolbar:
|
||||
Glib::ustring ui_info =
|
||||
"<ui>"
|
||||
" <menubar name='MenuBar'>"
|
||||
" <menu action='FileMenu'>"
|
||||
" <menuitem action='FileNewProject'/>"
|
||||
" <menuitem action='FileOpenProject'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='FileRender'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='FileQuit'/>"
|
||||
" </menu>"
|
||||
" <menu action='EditMenu'>"
|
||||
" <menuitem action='EditCopy'/>"
|
||||
" <menuitem action='EditPaste'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='EditPreferences'/>"
|
||||
" </menu>"
|
||||
" <menu action='ViewMenu'>"
|
||||
" <menuitem action='ViewAssets'/>"
|
||||
" <menuitem action='ViewTimeline'/>"
|
||||
" <menuitem action='ViewViewer'/>"
|
||||
" </menu>"
|
||||
" <menu action='HelpMenu'>"
|
||||
" <menuitem action='HelpAbout'/>"
|
||||
" </menu>"
|
||||
" </menubar>"
|
||||
" <toolbar name='ToolBar'>"
|
||||
" <toolitem action='FileNewProject'/>"
|
||||
" <toolitem action='FileOpenProject'/>"
|
||||
" </toolbar>"
|
||||
"</ui>";
|
||||
//Layout the actions in a menubar and toolbar:
|
||||
Glib::ustring ui_info =
|
||||
"<ui>"
|
||||
" <menubar name='MenuBar'>"
|
||||
" <menu action='FileMenu'>"
|
||||
" <menuitem action='FileNewProject'/>"
|
||||
" <menuitem action='FileOpenProject'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='FileRender'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='FileQuit'/>"
|
||||
" </menu>"
|
||||
" <menu action='EditMenu'>"
|
||||
" <menuitem action='EditCopy'/>"
|
||||
" <menuitem action='EditPaste'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='EditPreferences'/>"
|
||||
" </menu>"
|
||||
" <menu action='ViewMenu'>"
|
||||
" <menuitem action='ViewAssets'/>"
|
||||
" <menuitem action='ViewTimeline'/>"
|
||||
" <menuitem action='ViewViewer'/>"
|
||||
" </menu>"
|
||||
" <menu action='HelpMenu'>"
|
||||
" <menuitem action='HelpAbout'/>"
|
||||
" </menu>"
|
||||
" </menubar>"
|
||||
" <toolbar name='ToolBar'>"
|
||||
" <toolitem action='FileNewProject'/>"
|
||||
" <toolitem action='FileOpenProject'/>"
|
||||
" </toolbar>"
|
||||
"</ui>";
|
||||
|
||||
try
|
||||
{
|
||||
uiManager->add_ui_from_string(ui_info);
|
||||
}
|
||||
catch(const Glib::Error& ex)
|
||||
{
|
||||
ERROR(gui, "Building menus failed: %s", ex.what().data());
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
uiManager->add_ui_from_string(ui_info);
|
||||
}
|
||||
catch(const Glib::Error& ex)
|
||||
{
|
||||
ERROR(gui, "Building menus failed: %s", ex.what().data());
|
||||
return;
|
||||
}
|
||||
|
||||
//----- 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);
|
||||
|
||||
//----- Set up the Tool Bar -----//
|
||||
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);
|
||||
|
||||
//----- Create the Panels -----//
|
||||
assets_panel = Glib::RefPtr<AssetsPanel>(new AssetsPanel());
|
||||
viewer_panel = Glib::RefPtr<ViewerPanel>(new ViewerPanel());
|
||||
timeline_panel = Glib::RefPtr<TimelinePanel>(new TimelinePanel());
|
||||
//----- 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);
|
||||
|
||||
//----- Set up the Tool Bar -----//
|
||||
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);
|
||||
|
||||
//----- 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);
|
||||
|
||||
//----- 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()));
|
||||
//----- 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()));
|
||||
|
||||
dock_container.pack_start(*dockbar, PACK_SHRINK);
|
||||
dock_container.pack_end(*dock, PACK_EXPAND_WIDGET);
|
||||
base_container.pack_start(dock_container, PACK_EXPAND_WIDGET);
|
||||
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_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(), 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);
|
||||
|
||||
// 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);
|
||||
// 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();
|
||||
show_all_children();
|
||||
|
||||
gchar ph1[] = "ph1";
|
||||
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);
|
||||
gchar ph3[] = "ph3";
|
||||
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);
|
||||
}
|
||||
gchar ph1[] = "ph1";
|
||||
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);
|
||||
gchar ph3[] = "ph3";
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace workspace
|
||||
} // namespace gui
|
||||
|
|
|
|||
|
|
@ -49,47 +49,47 @@ namespace model {
|
|||
|
||||
namespace workspace {
|
||||
|
||||
/**
|
||||
* The main lumiera workspace window
|
||||
*/
|
||||
class WorkspaceWindow : public Gtk::Window
|
||||
{
|
||||
public:
|
||||
WorkspaceWindow(lumiera::gui::model::Project *source_project);
|
||||
virtual ~WorkspaceWindow();
|
||||
|
||||
private:
|
||||
void create_ui();
|
||||
/**
|
||||
* The main lumiera workspace window
|
||||
*/
|
||||
class WorkspaceWindow : public Gtk::Window
|
||||
{
|
||||
public:
|
||||
WorkspaceWindow(lumiera::gui::model::Project *source_project);
|
||||
virtual ~WorkspaceWindow();
|
||||
|
||||
/* ===== Model ===== */
|
||||
private:
|
||||
lumiera::gui::model::Project *project;
|
||||
private:
|
||||
void create_ui();
|
||||
|
||||
/* ===== UI ===== */
|
||||
private:
|
||||
Glib::RefPtr<Gtk::UIManager> uiManager;
|
||||
Gtk::VBox base_container;
|
||||
Gtk::HBox dock_container;
|
||||
|
||||
Gtk::Widget *dock;
|
||||
Gtk::Widget *dockbar;
|
||||
GdlDockLayout *layout;
|
||||
/* ===== Model ===== */
|
||||
private:
|
||||
lumiera::gui::model::Project *project;
|
||||
|
||||
/* ===== Panels ===== */
|
||||
private:
|
||||
Glib::RefPtr<AssetsPanel> assets_panel;
|
||||
Glib::RefPtr<ViewerPanel> viewer_panel;
|
||||
Glib::RefPtr<TimelinePanel> timeline_panel;
|
||||
|
||||
/* ===== Helpers ===== */
|
||||
private:
|
||||
/**
|
||||
* The instantiation of the actions helper class, which
|
||||
* registers and handles user action events */
|
||||
Actions actions;
|
||||
/* ===== UI ===== */
|
||||
private:
|
||||
Glib::RefPtr<Gtk::UIManager> uiManager;
|
||||
Gtk::VBox base_container;
|
||||
Gtk::HBox dock_container;
|
||||
|
||||
Gtk::Widget *dock;
|
||||
Gtk::Widget *dockbar;
|
||||
GdlDockLayout *layout;
|
||||
|
||||
friend class Actions;
|
||||
};
|
||||
/* ===== Panels ===== */
|
||||
private:
|
||||
AssetsPanel *assets_panel;
|
||||
ViewerPanel *viewer_panel;
|
||||
TimelinePanel *timeline_panel;
|
||||
|
||||
/* ===== Helpers ===== */
|
||||
private:
|
||||
/**
|
||||
* The instantiation of the actions helper class, which
|
||||
* registers and handles user action events */
|
||||
Actions actions;
|
||||
|
||||
friend class Actions;
|
||||
};
|
||||
|
||||
} // namespace workspace
|
||||
} // namespace gui
|
||||
|
|
|
|||
Loading…
Reference in a new issue