From be3aa4b102205b58c33d7bdfbfee743b5f6a5255 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 6 May 2013 14:21:21 +0100 Subject: [PATCH] Make timeline non-modal. --- src/wx/film_editor.cc | 11 ++++++++--- src/wx/film_editor.h | 2 ++ src/wx/timeline.cc | 9 +++++++++ src/wx/timeline.h | 1 + 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index c50782452..a4afb6d69 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -73,6 +73,7 @@ FilmEditor::FilmEditor (shared_ptr f, wxWindow* parent) : wxPanel (parent) , _generally_sensitive (true) , _audio_dialog (0) + , _timeline_dialog (0) { wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); _notebook = new wxNotebook (this, wxID_ANY); @@ -1458,7 +1459,11 @@ FilmEditor::setup_playlist_description () void FilmEditor::timeline_clicked (wxCommandEvent &) { - TimelineDialog* d = new TimelineDialog (this, _film->playlist ()); - d->ShowModal (); - d->Destroy (); + if (_timeline_dialog) { + _timeline_dialog->Destroy (); + _timeline_dialog = 0; + } + + _timeline_dialog = new TimelineDialog (this, _film->playlist ()); + _timeline_dialog->Show (); } diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index fddd213b9..9e9cfb831 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -34,6 +34,7 @@ class wxListEvent; class Film; class AudioDialog; class AudioMappingView; +class TimelineDialog; /** @class FilmEditor * @brief A wx widget to edit a film's metadata, and perform various functions. @@ -188,4 +189,5 @@ private: bool _generally_sensitive; AudioDialog* _audio_dialog; + TimelineDialog* _timeline_dialog; }; diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 828756362..52707e45c 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -27,6 +27,7 @@ using std::list; using std::cout; using std::max; using boost::shared_ptr; +using boost::bind; int const Timeline::_track_height = 64; @@ -43,6 +44,9 @@ Timeline::Timeline (wxWindow* parent, shared_ptr pl) } else { SetMinSize (wxSize (640, _track_height * (max (1UL, pl->audio().size()) + 1) + 96)); } + + pl->Changed.connect (bind (&Timeline::playlist_changed, this)); + pl->ContentChanged.connect (bind (&Timeline::playlist_changed, this)); } template @@ -189,3 +193,8 @@ Timeline::paint (wxPaintEvent &) delete gc; } +void +Timeline::playlist_changed () +{ + Refresh (); +} diff --git a/src/wx/timeline.h b/src/wx/timeline.h index 48aebc637..1993eb9c2 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -30,6 +30,7 @@ public: private: void paint (wxPaintEvent &); + void playlist_changed (); static int const _track_height; -- 2.30.2