include GUI work

Merge commit 'lumi/gui'
This commit is contained in:
Fischlurch 2009-10-11 05:46:46 +02:00
commit f313a0fb14
13 changed files with 58 additions and 58 deletions

View file

@ -39,6 +39,7 @@
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <boost/enable_shared_from_this.hpp> #include <boost/enable_shared_from_this.hpp>
#include "lib/util.hpp" #include "lib/util.hpp"
#include "lib/lumitime.hpp"
#include "window-manager.hpp" #include "window-manager.hpp"

View file

@ -30,6 +30,7 @@ using namespace std;
using namespace boost; using namespace boost;
using namespace util; using namespace util;
using namespace gui::widgets::timeline; using namespace gui::widgets::timeline;
using namespace lumiera;
namespace gui { namespace gui {
namespace widgets { namespace widgets {
@ -157,7 +158,7 @@ TimelineWidget::get_hovering_track() const
/* ===== Signals ===== */ /* ===== Signals ===== */
sigc::signal<void, gavl_time_t> sigc::signal<void, lumiera::Time>
TimelineWidget::mouse_hover_signal() const TimelineWidget::mouse_hover_signal() const
{ {
return mouseHoverSignal; return mouseHoverSignal;
@ -187,7 +188,7 @@ TimelineWidget::on_scroll()
{ {
if(state) if(state)
state->get_view_window().set_time_offset( state->get_view_window().set_time_offset(
horizontalAdjustment.get_value()); Time((gavl_time_t)horizontalAdjustment.get_value()));
} }
void void

View file

@ -106,7 +106,7 @@ public:
public: public:
/* ===== Signals ===== */ /* ===== Signals ===== */
sigc::signal<void, gavl_time_t> mouse_hover_signal() const; sigc::signal<void, lumiera::Time> mouse_hover_signal() const;
sigc::signal<void> playback_period_drag_released_signal() const; sigc::signal<void> playback_period_drag_released_signal() const;
@ -264,7 +264,7 @@ protected:
Gtk::VScrollbar verticalScroll; Gtk::VScrollbar verticalScroll;
// Signals // Signals
sigc::signal<void, gavl_time_t> mouseHoverSignal; sigc::signal<void, lumiera::Time> mouseHoverSignal;
sigc::signal<void> playbackPeriodDragReleasedSignal; sigc::signal<void> playbackPeriodDragReleasedSignal;
sigc::signal<void, boost::shared_ptr<timeline::Track> > sigc::signal<void, boost::shared_ptr<timeline::Track> >
hoveringTrackChangedSignal; hoveringTrackChangedSignal;
@ -277,7 +277,7 @@ public:
/** /**
* The maximum scale for timeline display. * The maximum scale for timeline display.
* @remarks At MaxScale, every pixel on the timeline is equivalent * @remarks At MaxScale, every pixel on the timeline is equivalent
* to 30000000 gavl_time_t increments. * to 30000000 lumiera::Time increments.
*/ */
static const int64_t MaxScale; static const int64_t MaxScale;

View file

@ -34,6 +34,7 @@
using namespace Gtk; using namespace Gtk;
using namespace std; using namespace std;
using namespace boost; using namespace boost;
using namespace lumiera;
namespace gui { namespace gui {
namespace widgets { namespace widgets {
@ -255,8 +256,8 @@ TimelineBody::on_motion_notify_event(GdkEventMotion *event)
TimelineViewWindow &window = view_window(); TimelineViewWindow &window = view_window();
const int64_t scale = window.get_time_scale(); const int64_t scale = window.get_time_scale();
gavl_time_t offset = beginShiftTimeOffset + Time offset(beginShiftTimeOffset +
(int64_t)(mouseDownX - event->x) * scale; (int64_t)(mouseDownX - event->x) * scale);
window.set_time_offset(offset); window.set_time_offset(offset);
set_vertical_offset((int)(mouseDownY - event->y) + set_vertical_offset((int)(mouseDownY - event->y) +

View file

@ -25,6 +25,7 @@
using namespace boost; using namespace boost;
using namespace gui::widgets; using namespace gui::widgets;
using namespace lumiera;
namespace gui { namespace gui {
namespace widgets { namespace widgets {
@ -95,7 +96,7 @@ IBeamTool::on_button_press_event(GdkEventButton* event)
if(event->button == 1) if(event->button == 1)
{ {
const gavl_time_t time = const Time time =
state->get_view_window().x_to_time(event->x); state->get_view_window().x_to_time(event->x);
if(is_mouse_in_start_drag_zone()) if(is_mouse_in_start_drag_zone())
@ -187,7 +188,7 @@ IBeamTool::set_leading_x(const int x)
shared_ptr<TimelineState> state = get_state(); shared_ptr<TimelineState> state = get_state();
const bool set_playback_period = dragType == Selection; const bool set_playback_period = dragType == Selection;
const gavl_time_t time = state->get_view_window().x_to_time(x); const Time time = state->get_view_window().x_to_time(x);
if(time > pinnedDragTime) if(time > pinnedDragTime)
state->set_selection(pinnedDragTime, time, set_playback_period); state->set_selection(pinnedDragTime, time, set_playback_period);
else else

View file

@ -164,7 +164,7 @@ private:
* the mouse, the other is pinned. pinnedDragTime specifies the time * the mouse, the other is pinned. pinnedDragTime specifies the time
* of that point. * of that point.
*/ */
gavl_time_t pinnedDragTime; lumiera::Time pinnedDragTime;
/** /**
* This connection is used to represent the timer which causes scroll * This connection is used to represent the timer which causes scroll

View file

@ -37,6 +37,7 @@ using namespace boost;
using namespace gui; using namespace gui;
using namespace gui::widgets; using namespace gui::widgets;
using namespace gui::widgets::timeline; using namespace gui::widgets::timeline;
using namespace lumiera;
namespace gui { namespace gui {
namespace widgets { namespace widgets {
@ -235,7 +236,7 @@ TimelineRuler::set_leading_x(const int x)
if(state) if(state)
{ {
const gavl_time_t time = view_window().x_to_time(x); const Time time = view_window().x_to_time(x);
if(time > pinnedDragTime) if(time > pinnedDragTime)
state->set_playback_period(pinnedDragTime, time); state->set_playback_period(pinnedDragTime, time);
else else

View file

@ -198,7 +198,7 @@ private:
* the mouse, the other is pinned. pinnedDragTime specifies the time * the mouse, the other is pinned. pinnedDragTime specifies the time
* of that point. * of that point.
*/ */
gavl_time_t pinnedDragTime; lumiera::Time pinnedDragTime;
// Indicated values // Indicated values
/** /**

View file

@ -25,6 +25,7 @@
using namespace boost; using namespace boost;
using namespace Gtk; using namespace Gtk;
using namespace sigc; using namespace sigc;
using namespace lumiera;
namespace gui { namespace gui {
namespace widgets { namespace widgets {
@ -33,17 +34,17 @@ namespace timeline {
TimelineState::TimelineState( TimelineState::TimelineState(
boost::shared_ptr<model::Sequence> source_sequence) : boost::shared_ptr<model::Sequence> source_sequence) :
sequence(source_sequence), sequence(source_sequence),
viewWindow(0, 1), viewWindow(Time(0), 1),
selectionStart(0), selectionStart(0),
selectionEnd(0), selectionEnd(0),
playbackPeriodStart(0), playbackPeriodStart(0),
playbackPeriodEnd(0), playbackPeriodEnd(0),
playbackPoint(GAVL_TIME_UNDEFINED) playbackPoint(Time(GAVL_TIME_UNDEFINED))
{ {
REQUIRE(sequence); REQUIRE(sequence);
viewWindow.set_time_scale(GAVL_TIME_SCALE / 200); viewWindow.set_time_scale(GAVL_TIME_SCALE / 200);
set_selection(2000000, 4000000); set_selection(Time(2000000), Time(4000000));
} }
boost::shared_ptr<model::Sequence> boost::shared_ptr<model::Sequence>
@ -58,20 +59,20 @@ TimelineState::get_view_window()
return viewWindow; return viewWindow;
} }
gavl_time_t Time
TimelineState::get_selection_start() const TimelineState::get_selection_start() const
{ {
return selectionStart; return selectionStart;
} }
gavl_time_t Time
TimelineState::get_selection_end() const TimelineState::get_selection_end() const
{ {
return selectionEnd; return selectionEnd;
} }
void void
TimelineState::set_selection(gavl_time_t start, gavl_time_t end, TimelineState::set_selection(Time start, Time end,
bool reset_playback_period) bool reset_playback_period)
{ {
if(start < end) if(start < end)
@ -95,20 +96,20 @@ TimelineState::set_selection(gavl_time_t start, gavl_time_t end,
selectionChangedSignal.emit(); selectionChangedSignal.emit();
} }
gavl_time_t Time
TimelineState::get_playback_period_start() const TimelineState::get_playback_period_start() const
{ {
return playbackPeriodStart; return playbackPeriodStart;
} }
gavl_time_t Time
TimelineState::get_playback_period_end() const TimelineState::get_playback_period_end() const
{ {
return playbackPeriodEnd; return playbackPeriodEnd;
} }
void void
TimelineState::set_playback_period(gavl_time_t start, gavl_time_t end) TimelineState::set_playback_period(Time start, Time end)
{ {
if(start < end) if(start < end)
@ -127,13 +128,13 @@ TimelineState::set_playback_period(gavl_time_t start, gavl_time_t end)
} }
void void
TimelineState::set_playback_point(gavl_time_t point) TimelineState::set_playback_point(Time point)
{ {
playbackPoint = point; playbackPoint = point;
playbackChangedSignal.emit(); playbackChangedSignal.emit();
} }
gavl_time_t Time
TimelineState::get_playback_point() const TimelineState::get_playback_point() const
{ {
return playbackPoint; return playbackPoint;

View file

@ -70,12 +70,12 @@ public:
/** /**
* Gets the time at which the selection begins. * Gets the time at which the selection begins.
*/ */
gavl_time_t get_selection_start() const; lumiera::Time get_selection_start() const;
/** /**
* Gets the time at which the selection begins. * Gets the time at which the selection begins.
*/ */
gavl_time_t get_selection_end() const; lumiera::Time get_selection_end() const;
/** /**
* Sets the period of the selection. * Sets the period of the selection.
@ -84,39 +84,39 @@ public:
* @param reset_playback_period Specifies whether to set the playback * @param reset_playback_period Specifies whether to set the playback
* period to the same as this new selection. * period to the same as this new selection.
*/ */
void set_selection(gavl_time_t start, gavl_time_t end, void set_selection(lumiera::Time start, lumiera::Time end,
bool reset_playback_period = true); bool reset_playback_period = true);
/** /**
* Gets the time at which the playback period begins. * Gets the time at which the playback period begins.
*/ */
gavl_time_t get_playback_period_start() const; lumiera::Time get_playback_period_start() const;
/** /**
* Gets the time at which the playback period ends. * Gets the time at which the playback period ends.
*/ */
gavl_time_t get_playback_period_end() const; lumiera::Time get_playback_period_end() const;
/** /**
* Sets the playback period. * Sets the playback period.
* @param start The start time. * @param start The start time.
* @param end The end time. * @param end The end time.
*/ */
void set_playback_period(gavl_time_t start, gavl_time_t end); void set_playback_period(lumiera::Time start, lumiera::Time end);
/** /**
* Sets the time which is currenty being played back. * Sets the time which is currenty being played back.
* @param point The time index being played. This value may be * @param point The time index being played. This value may be
* GAVL_TIME_UNDEFINED, if there is no playback point. * GAVL_TIME_UNDEFINED, if there is no playback point.
*/ */
void set_playback_point(gavl_time_t point); void set_playback_point(lumiera::Time point);
/** /**
* Gets the current playback point. * Gets the current playback point.
* @return The time index of the playback point. This value may be * @return The time index of the playback point. This value may be
* GAVL_TIME_UNDEFINED, if there is no playback point. * GAVL_TIME_UNDEFINED, if there is no playback point.
*/ */
gavl_time_t get_playback_point() const; lumiera::Time get_playback_point() const;
/** /**
* A signal to notify when the selected period has changed. * A signal to notify when the selected period has changed.
@ -150,27 +150,27 @@ private:
/** /**
* The start time of the selection period. * The start time of the selection period.
**/ **/
gavl_time_t selectionStart; lumiera::Time selectionStart;
/** /**
* The end time of the selection period. * The end time of the selection period.
**/ **/
gavl_time_t selectionEnd; lumiera::Time selectionEnd;
/** /**
* The start time of the playback period. * The start time of the playback period.
**/ **/
gavl_time_t playbackPeriodStart; lumiera::Time playbackPeriodStart;
/** /**
* The end time of the playback period. * The end time of the playback period.
**/ **/
gavl_time_t playbackPeriodEnd; lumiera::Time playbackPeriodEnd;
/** /**
* The time of the playback point. * The time of the playback point.
**/ **/
gavl_time_t playbackPoint; lumiera::Time playbackPoint;
// Signals // Signals

View file

@ -25,26 +25,27 @@
using namespace Gtk; using namespace Gtk;
using namespace gui::widgets; using namespace gui::widgets;
using namespace lumiera;
namespace gui { namespace gui {
namespace widgets { namespace widgets {
namespace timeline { namespace timeline {
TimelineViewWindow::TimelineViewWindow( TimelineViewWindow::TimelineViewWindow(
gavl_time_t offset, int64_t scale) : Time offset, int64_t scale) :
timeOffset(offset), timeOffset(offset),
timeScale(scale) timeScale(scale)
{ {
} }
gavl_time_t Time
TimelineViewWindow::get_time_offset() const TimelineViewWindow::get_time_offset() const
{ {
return timeOffset; return timeOffset;
} }
void void
TimelineViewWindow::set_time_offset(gavl_time_t offset) TimelineViewWindow::set_time_offset(Time offset)
{ {
timeOffset = offset; timeOffset = offset;
changedSignal.emit(); changedSignal.emit();
@ -80,8 +81,8 @@ TimelineViewWindow::zoom_view(int point, int zoom_size)
new_time_scale = TimelineWidget::MaxScale; new_time_scale = TimelineWidget::MaxScale;
// The view must be shifted so that the zoom is centred on the cursor // The view must be shifted so that the zoom is centred on the cursor
set_time_offset(get_time_offset() + set_time_offset(Time((gavl_time_t)get_time_offset() +
(timeScale - new_time_scale) * point); (timeScale - new_time_scale) * point));
// Apply the new scale // Apply the new scale
set_time_scale(new_time_scale); set_time_scale(new_time_scale);
@ -90,8 +91,8 @@ TimelineViewWindow::zoom_view(int point, int zoom_size)
void void
TimelineViewWindow::shift_view(int view_width, int shift_size) TimelineViewWindow::shift_view(int view_width, int shift_size)
{ {
set_time_offset(get_time_offset() + set_time_offset(Time((gavl_time_t)get_time_offset() +
shift_size * timeScale * view_width / 256); shift_size * timeScale * view_width / 256));
} }
int int
@ -100,10 +101,10 @@ TimelineViewWindow::time_to_x(gavl_time_t time) const
return (int)((time - timeOffset) / timeScale); return (int)((time - timeOffset) / timeScale);
} }
gavl_time_t Time
TimelineViewWindow::x_to_time(int x) const TimelineViewWindow::x_to_time(int x) const
{ {
return (gavl_time_t)((int64_t)x * timeScale + timeOffset); return Time((gavl_time_t)((int64_t)x * timeScale + timeOffset));
} }
sigc::signal<void> sigc::signal<void>

View file

@ -50,19 +50,19 @@ public:
* @param offset The initial view offset. * @param offset The initial view offset.
* @param scale The initial scale. * @param scale The initial scale.
**/ **/
TimelineViewWindow(gavl_time_t offset, int64_t scale); TimelineViewWindow(lumiera::Time offset, int64_t scale);
/** /**
* Gets the time offset. This is the time value displaid at the * Gets the time offset. This is the time value displaid at the
* left-hand edge of the timeline body area. * left-hand edge of the timeline body area.
*/ */
gavl_time_t get_time_offset() const; lumiera::Time get_time_offset() const;
/** /**
* Sets the time offset. This is the time value displaid at the * Sets the time offset. This is the time value displaid at the
* left-hand edge of the timeline body area. * left-hand edge of the timeline body area.
*/ */
void set_time_offset(gavl_time_t time_offset); void set_time_offset(lumiera::Time time_offset);
/** /**
* Gets the time scale value. * Gets the time scale value.
@ -108,7 +108,7 @@ public:
* the timeline body) to convert. * the timeline body) to convert.
* @return Returns the time at the coordinate. * @return Returns the time at the coordinate.
**/ **/
gavl_time_t x_to_time(int x) const; lumiera::Time x_to_time(int x) const;
/** /**
* A signal to indicate that the scale or offset have been changed. * A signal to indicate that the scale or offset have been changed.
@ -116,7 +116,7 @@ public:
sigc::signal<void> changed_signal() const; sigc::signal<void> changed_signal() const;
private: private:
gavl_time_t timeOffset; lumiera::Time timeOffset;
int64_t timeScale; int64_t timeScale;
sigc::signal<void> changedSignal; sigc::signal<void> changedSignal;

View file

@ -100,13 +100,6 @@ WorkspaceWindow::create_ui()
REQUIRE(menu_bar != NULL); REQUIRE(menu_bar != NULL);
baseContainer.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"));
REQUIRE(toolbar != NULL);
toolbar->set_toolbar_style(TOOLBAR_ICONS);
baseContainer.pack_start(*toolbar, Gtk::PACK_SHRINK);
//----- Create the Docks -----// //----- Create the Docks -----//
panelManager.setup_dock(); panelManager.setup_dock();