Merge branch '1.0' into 1.0-seek
authorCarl Hetherington <cth@carlh.net>
Sun, 29 Dec 2013 19:30:59 +0000 (19:30 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 29 Dec 2013 19:30:59 +0000 (19:30 +0000)
1  2 
src/wx/film_editor.cc
src/wx/timeline.cc

diff --combined src/wx/film_editor.cc
index 1818fb451452233c196c534a7f996827d7a3b27d,cd159189cc15a3a909324998205f94b2594049dd..e5cb5371c533c62ed755bc736199150ef41d1847
@@@ -72,7 -72,7 +72,7 @@@ using boost::lexical_cast
  /** @param f Film to edit */
  FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
        : wxPanel (parent)
-       , _menu (f, this)
+       , _menu (this)
        , _generally_sensitive (true)
        , _timeline_dialog (0)
  {
@@@ -284,7 -284,7 +284,7 @@@ FilmEditor::make_content_panel (
  
                s->Add (b, 0, wxALL, 4);
  
-               _content_sizer->Add (s, 1, wxEXPAND | wxALL, 6);
+               _content_sizer->Add (s, 0, wxEXPAND | wxALL, 6);
        }
  
        _sequence_video = new wxCheckBox (_content_panel, wxID_ANY, _("Keep video in sequence"));
@@@ -936,7 -936,7 +936,7 @@@ FilmEditor::content_timeline_clicked (
                _timeline_dialog = 0;
        }
        
 -      _timeline_dialog = new TimelineDialog (this, _film);
 +      _timeline_dialog = new DCPTimelineDialog (this, _film);
        _timeline_dialog->Show ();
  }
  
@@@ -966,7 -966,7 +966,7 @@@ FilmEditor::sequence_video_changed (
  void
  FilmEditor::content_right_click (wxListEvent& ev)
  {
-       _menu.popup (selected_content (), ev.GetPoint ());
+       _menu.popup (_film, selected_content (), ev.GetPoint ());
  }
  
  void
diff --combined src/wx/timeline.cc
index 9d2aee76c00f7660d424a5ef9c5275e5514a1cd2,6cc1f79d93dd23c9d0b089648f36edcf1892c893..2119e781322f2cedae4e3083ffd20b7ead4ffda2
@@@ -39,7 -39,7 +39,7 @@@ using boost::optional
  class View : public boost::noncopyable
  {
  public:
 -      View (Timeline& t)
 +      View (DCPTimeline& t)
                : _timeline (t)
        {
  
  protected:
        virtual void do_paint (wxGraphicsContext *) = 0;
        
 -      int time_x (Time t) const
 +      int time_x (DCPTime t) const
        {
                return _timeline.tracks_position().x + t * _timeline.pixels_per_time_unit();
        }
        
 -      Timeline& _timeline;
 +      DCPTimeline& _timeline;
  
  private:
        dcpomatic::Rect<int> _last_paint_bbox;
@@@ -80,7 -80,7 +80,7 @@@
  class ContentView : public View
  {
  public:
 -      ContentView (Timeline& tl, shared_ptr<Content> c)
 +      ContentView (DCPTimeline& tl, shared_ptr<Content> c)
                : View (tl)
                , _content (c)
                , _track (0)
@@@ -139,8 -139,8 +139,8 @@@ private
                        return;
                }
  
 -              Time const position = cont->position ();
 -              Time const len = cont->length_after_trim ();
 +              DCPTime const position = cont->position ();
 +              DCPTime const len = cont->length_after_trim ();
  
                wxColour selected (colour().Red() / 2, colour().Green() / 2, colour().Blue() / 2);
  
  class AudioContentView : public ContentView
  {
  public:
 -      AudioContentView (Timeline& tl, shared_ptr<Content> c)
 +      AudioContentView (DCPTimeline& tl, shared_ptr<Content> c)
                : ContentView (tl, c)
        {}
        
@@@ -222,7 -222,7 +222,7 @@@ private
  class VideoContentView : public ContentView
  {
  public:
 -      VideoContentView (Timeline& tl, shared_ptr<Content> c)
 +      VideoContentView (DCPTimeline& tl, shared_ptr<Content> c)
                : ContentView (tl, c)
        {}
  
@@@ -243,10 -243,10 +243,10 @@@ private
        }
  };
  
 -class TimeAxisView : public View
 +class DCPTimeAxisView : public View
  {
  public:
 -      TimeAxisView (Timeline& tl, int y)
 +      DCPTimeAxisView (DCPTimeline& tl, int y)
                : View (tl)
                , _y (y)
        {}
@@@ -291,7 -291,7 +291,7 @@@ private
                path.AddLineToPoint (_timeline.width(), _y);
                gc->StrokePath (path);
  
 -              Time t = 0;
 +              DCPTime t = 0;
                while ((t * _timeline.pixels_per_time_unit()) < _timeline.width()) {
                        wxGraphicsPath path = gc->CreatePath ();
                        path.MoveToPoint (time_x (t), _y - 4);
@@@ -326,39 -326,39 +326,39 @@@ private
  };
  
  
 -Timeline::Timeline (wxWindow* parent, FilmEditor* ed, shared_ptr<Film> film)
 +DCPTimeline::DCPTimeline (wxWindow* parent, FilmEditor* ed, shared_ptr<Film> film)
        : wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)
        , _film_editor (ed)
        , _film (film)
 -      , _time_axis_view (new TimeAxisView (*this, 32))
 +      , _time_axis_view (new DCPTimeAxisView (*this, 32))
        , _tracks (0)
        , _pixels_per_time_unit (0)
        , _left_down (false)
        , _down_view_position (0)
        , _first_move (false)
-       , _menu (film, this)
+       , _menu (this)
        , _snap (true)
  {
  #ifndef __WXOSX__
        SetDoubleBuffered (true);
  #endif        
  
 -      Bind (wxEVT_PAINT,      boost::bind (&Timeline::paint,       this));
 -      Bind (wxEVT_LEFT_DOWN,  boost::bind (&Timeline::left_down,   this, _1));
 -      Bind (wxEVT_LEFT_UP,    boost::bind (&Timeline::left_up,     this, _1));
 -      Bind (wxEVT_RIGHT_DOWN, boost::bind (&Timeline::right_down,  this, _1));
 -      Bind (wxEVT_MOTION,     boost::bind (&Timeline::mouse_moved, this, _1));
 -      Bind (wxEVT_SIZE,       boost::bind (&Timeline::resized,     this));
 +      Bind (wxEVT_PAINT,      boost::bind (&DCPTimeline::paint,       this));
 +      Bind (wxEVT_LEFT_DOWN,  boost::bind (&DCPTimeline::left_down,   this, _1));
 +      Bind (wxEVT_LEFT_UP,    boost::bind (&DCPTimeline::left_up,     this, _1));
 +      Bind (wxEVT_RIGHT_DOWN, boost::bind (&DCPTimeline::right_down,  this, _1));
 +      Bind (wxEVT_MOTION,     boost::bind (&DCPTimeline::mouse_moved, this, _1));
 +      Bind (wxEVT_SIZE,       boost::bind (&DCPTimeline::resized,     this));
  
        playlist_changed ();
  
        SetMinSize (wxSize (640, tracks() * track_height() + 96));
  
 -      _playlist_connection = film->playlist()->Changed.connect (bind (&Timeline::playlist_changed, this));
 +      _playlist_connection = film->playlist()->Changed.connect (bind (&DCPTimeline::playlist_changed, this));
  }
  
  void
 -Timeline::paint ()
 +DCPTimeline::paint ()
  {
        wxPaintDC dc (this);
  
  }
  
  void
 -Timeline::playlist_changed ()
 +DCPTimeline::playlist_changed ()
  {
        ensure_ui_thread ();
        
  }
  
  void
 -Timeline::assign_tracks ()
 +DCPTimeline::assign_tracks ()
  {
        for (ViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
                shared_ptr<ContentView> cv = dynamic_pointer_cast<ContentView> (*i);
  }
  
  int
 -Timeline::tracks () const
 +DCPTimeline::tracks () const
  {
        return _tracks;
  }
  
  void
 -Timeline::setup_pixels_per_time_unit ()
 +DCPTimeline::setup_pixels_per_time_unit ()
  {
        shared_ptr<const Film> film = _film.lock ();
        if (!film) {
  }
  
  shared_ptr<View>
 -Timeline::event_to_view (wxMouseEvent& ev)
 +DCPTimeline::event_to_view (wxMouseEvent& ev)
  {
        ViewList::iterator i = _views.begin();
        Position<int> const p (ev.GetX(), ev.GetY());
  }
  
  void
 -Timeline::left_down (wxMouseEvent& ev)
 +DCPTimeline::left_down (wxMouseEvent& ev)
  {
        shared_ptr<View> view = event_to_view (ev);
        shared_ptr<ContentView> content_view = dynamic_pointer_cast<ContentView> (view);
  }
  
  void
 -Timeline::left_up (wxMouseEvent& ev)
 +DCPTimeline::left_up (wxMouseEvent& ev)
  {
        _left_down = false;
  
  }
  
  void
 -Timeline::mouse_moved (wxMouseEvent& ev)
 +DCPTimeline::mouse_moved (wxMouseEvent& ev)
  {
        if (!_left_down) {
                return;
  }
  
  void
 -Timeline::right_down (wxMouseEvent& ev)
 +DCPTimeline::right_down (wxMouseEvent& ev)
  {
        shared_ptr<View> view = event_to_view (ev);
        shared_ptr<ContentView> cv = dynamic_pointer_cast<ContentView> (view);
                cv->set_selected (true);
        }
  
-       _menu.popup (selected_content (), ev.GetPosition ());
+       _menu.popup (_film, selected_content (), ev.GetPosition ());
  }
  
  void
 -Timeline::set_position_from_event (wxMouseEvent& ev)
 +DCPTimeline::set_position_from_event (wxMouseEvent& ev)
  {
        wxPoint const p = ev.GetPosition();
  
                return;
        }
        
 -      Time new_position = _down_view_position + (p.x - _down_point.x) / _pixels_per_time_unit;
 +      DCPTime new_position = _down_view_position + (p.x - _down_point.x) / _pixels_per_time_unit;
        
        if (_snap) {
                
                bool first = true;
 -              Time nearest_distance = TIME_MAX;
 -              Time nearest_new_position = TIME_MAX;
 +              DCPTime nearest_distance = TIME_MAX;
 +              DCPTime nearest_new_position = TIME_MAX;
                
                /* Find the nearest content edge; this is inefficient */
                for (ViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
                        
                        {
                                /* Snap starts to ends */
 -                              Time const d = abs (cv->content()->end() - new_position);
 +                              DCPTime const d = abs (cv->content()->end() - new_position);
                                if (first || d < nearest_distance) {
                                        nearest_distance = d;
                                        nearest_new_position = cv->content()->end();
                        
                        {
                                /* Snap ends to starts */
 -                              Time const d = abs (cv->content()->position() - (new_position + _down_view->content()->length_after_trim()));
 +                              DCPTime const d = abs (cv->content()->position() - (new_position + _down_view->content()->length_after_trim()));
                                if (d < nearest_distance) {
                                        nearest_distance = d;
                                        nearest_new_position = cv->content()->position() - _down_view->content()->length_after_trim ();
  }
  
  void
 -Timeline::force_redraw (dcpomatic::Rect<int> const & r)
 +DCPTimeline::force_redraw (dcpomatic::Rect<int> const & r)
  {
        RefreshRect (wxRect (r.x, r.y, r.width, r.height), false);
  }
  
  shared_ptr<const Film>
 -Timeline::film () const
 +DCPTimeline::film () const
  {
        return _film.lock ();
  }
  
  void
 -Timeline::resized ()
 +DCPTimeline::resized ()
  {
        setup_pixels_per_time_unit ();
  }
  
  void
 -Timeline::clear_selection ()
 +DCPTimeline::clear_selection ()
  {
        for (ViewList::iterator i = _views.begin(); i != _views.end(); ++i) {
                shared_ptr<ContentView> cv = dynamic_pointer_cast<ContentView> (*i);
        }
  }
  
 -Timeline::ContentViewList
 -Timeline::selected_views () const
 +DCPTimeline::ContentViewList
 +DCPTimeline::selected_views () const
  {
        ContentViewList sel;
        
  }
  
  ContentList
 -Timeline::selected_content () const
 +DCPTimeline::selected_content () const
  {
        ContentList sel;
        ContentViewList views = selected_views ();