{
public:
View (Timeline& t)
- : _timeline (t)
+ : _timeline (t)
{
}
_timeline.force_redraw (bbox ());
}
- virtual Rect bbox () const = 0;
+ virtual dcpomatic::Rect<int> bbox () const = 0;
protected:
virtual void do_paint (wxGraphicsContext *) = 0;
Timeline& _timeline;
private:
- Rect _last_paint_bbox;
+ dcpomatic::Rect<int> _last_paint_bbox;
};
class ContentView : public View
_content_connection = c->Changed.connect (bind (&ContentView::content_changed, this, _2));
}
- Rect bbox () const
+ dcpomatic::Rect<int> bbox () const
{
shared_ptr<const Film> film = _timeline.film ();
shared_ptr<const Content> content = _content.lock ();
if (!film || !content) {
- return Rect ();
+ return dcpomatic::Rect<int> ();
}
- return Rect (
+ return dcpomatic::Rect<int> (
time_x (content->start ()) - 8,
y_pos (_track) - 8,
content->length () * _timeline.pixels_per_time_unit() + 16,
gc->SetPen (*wxBLACK_PEN);
-#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 4, wxPENSTYLE_SOLID));
if (_selected) {
gc->SetBrush (*wxTheBrushList->FindOrCreateBrush (selected, wxBRUSHSTYLE_SOLID));
} else {
gc->SetBrush (*wxTheBrushList->FindOrCreateBrush (colour(), wxBRUSHSTYLE_SOLID));
}
-#else
- gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 4, wxSOLID));
- if (_selected) {
- gc->SetBrush (*wxTheBrushList->FindOrCreateBrush (selected, wxSOLID));
- } else {
- gc->SetBrush (*wxTheBrushList->FindOrCreateBrush (colour(), wxSOLID));
- }
-#endif
wxGraphicsPath path = gc->CreatePath ();
- path.MoveToPoint (time_x (start), y_pos (_track) + 4);
+ path.MoveToPoint (time_x (start), y_pos (_track) + 4);
path.AddLineToPoint (time_x (start + len), y_pos (_track) + 4);
path.AddLineToPoint (time_x (start + len), y_pos (_track + 1) - 4);
- path.AddLineToPoint (time_x (start), y_pos (_track + 1) - 4);
- path.AddLineToPoint (time_x (start), y_pos (_track) + 4);
+ path.AddLineToPoint (time_x (start), y_pos (_track + 1) - 4);
+ path.AddLineToPoint (time_x (start), y_pos (_track) + 4);
gc->StrokePath (path);
gc->FillPath (path);
{
public:
TimeAxisView (Timeline& tl, int y)
- : View (tl)
+ : View (tl)
, _y (y)
{}
- Rect bbox () const
+ dcpomatic::Rect<int> bbox () const
{
- return Rect (0, _y - 4, _timeline.width(), 24);
+ return dcpomatic::Rect<int> (0, _y - 4, _timeline.width(), 24);
}
void set_y (int y)
void do_paint (wxGraphicsContext* gc)
{
-#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID));
-#else
- gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxSOLID));
-#endif
int mark_interval = rint (128 / (TIME_HZ * _timeline.pixels_per_time_unit ()));
if (mark_interval > 5) {
, _down_view_start (0)
, _first_move (false)
{
+#ifndef __WXOSX__
SetDoubleBuffered (true);
+#endif
setup_pixels_per_time_unit ();
Timeline::left_down (wxMouseEvent& ev)
{
list<shared_ptr<View> >::iterator i = _views.begin();
- Position const p (ev.GetX(), ev.GetY());
+ Position<int> const p (ev.GetX(), ev.GetY());
while (i != _views.end() && !(*i)->bbox().contains (p)) {
++i;
}
_left_down = true;
_down_point = ev.GetPosition ();
_first_move = false;
+
+ if (_down_view) {
+ shared_ptr<Content> c = _down_view->content().lock ();
+ if (c) {
+ c->set_change_signals_frequent (true);
+ }
+ }
}
void
-Timeline::left_up (wxMouseEvent &)
+Timeline::left_up (wxMouseEvent& ev)
{
_left_down = false;
+
+ if (_down_view) {
+ shared_ptr<Content> c = _down_view->content().lock ();
+ if (c) {
+ c->set_change_signals_frequent (false);
+ }
+ }
+
+ set_start_from_event (ev);
}
void
return;
}
+ set_start_from_event (ev);
+}
+
+void
+Timeline::set_start_from_event (wxMouseEvent& ev)
+{
wxPoint const p = ev.GetPosition();
if (!_first_move) {
}
void
-Timeline::force_redraw (Rect const & r)
+Timeline::force_redraw (dcpomatic::Rect<int> const & r)
{
RefreshRect (wxRect (r.x, r.y, r.width, r.height), false);
}