diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-27 22:24:18 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-27 22:24:18 +0100 |
| commit | f49d66270bff2577d39474a0c1c18a7a1b1f14f6 (patch) | |
| tree | e0e5a6561da5391e51daad271b6266391475df5e /src | |
| parent | bfd9b87675c4d0662e93639b446cb30182769afc (diff) | |
Fix time axis view position.
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/timeline.cc | 27 | ||||
| -rw-r--r-- | src/wx/timeline.h | 4 |
2 files changed, 22 insertions, 9 deletions
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 42f489c2f..902788bc9 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -242,6 +242,19 @@ public: : View (tl) , _y (y) {} + + Rect bbox () const + { + return Rect (0, _y - 4, _timeline.width(), 24); + } + + void set_y (int y) + { + _y = y; + force_redraw (); + } + +private: void do_paint (wxGraphicsContext* gc) { @@ -304,11 +317,6 @@ public: } } - Rect bbox () const - { - return Rect (0, _y - 4, _timeline.width(), 24); - } - private: int _y; }; @@ -317,6 +325,7 @@ Timeline::Timeline (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)) , _tracks (0) , _pixels_per_time_unit (0) , _left_down (false) @@ -338,6 +347,8 @@ Timeline::Timeline (wxWindow* parent, FilmEditor* ed, shared_ptr<Film> film) SetMinSize (wxSize (640, tracks() * track_height() + 96)); _playlist_connection = film->playlist()->Changed.connect (bind (&Timeline::playlist_changed, this)); + + _views.push_back (_time_axis_view); } void @@ -381,9 +392,6 @@ Timeline::playlist_changed () } assign_tracks (); - - _views.push_back (shared_ptr<View> (new TimeAxisView (*this, tracks() * track_height() + 32))); - Refresh (); } @@ -394,6 +402,7 @@ Timeline::assign_tracks () shared_ptr<ContentView> cv = dynamic_pointer_cast<ContentView> (*i); if (cv) { cv->set_track (0); + _tracks = 1; } } @@ -440,6 +449,8 @@ Timeline::assign_tracks () acv->set_track (t); _tracks = max (_tracks, t + 1); } + + _time_axis_view->set_y (tracks() * track_height() + 32); } int diff --git a/src/wx/timeline.h b/src/wx/timeline.h index 348286db8..a786e6a09 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -27,6 +27,7 @@ class Film; class View; class ContentView; class FilmEditor; +class TimeAxisView; class Timeline : public wxPanel { @@ -46,7 +47,7 @@ public: } int track_height () const { - return 64; + return 48; } double pixels_per_time_unit () const { @@ -72,6 +73,7 @@ private: FilmEditor* _film_editor; boost::weak_ptr<Film> _film; std::list<boost::shared_ptr<View> > _views; + boost::shared_ptr<TimeAxisView> _time_axis_view; int _tracks; double _pixels_per_time_unit; bool _left_down; |
