Make timeline non-modal.
authorCarl Hetherington <cth@carlh.net>
Mon, 6 May 2013 13:21:21 +0000 (14:21 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 6 May 2013 13:21:21 +0000 (14:21 +0100)
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/timeline.cc
src/wx/timeline.h

index c50782452ce0af3393e6e3dd9a7cf1e0280a572e..a4afb6d69f2c597c7738bd3977134c56317a2cbe 100644 (file)
@@ -73,6 +73,7 @@ FilmEditor::FilmEditor (shared_ptr<Film> 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 ();
 }
index fddd213b988e069db08f815ae81ec0d5b39bca4a..9e9cfb831fbdf229a8389f01290faa231a0b0eb8 100644 (file)
@@ -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;
 };
index 828756362c6391d14e4c9145ceb60fc9f5769858..52707e45c725de3bbd3ffbc661eb445cef4137aa 100644 (file)
@@ -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<Playlist> 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 <class T>
@@ -189,3 +193,8 @@ Timeline::paint (wxPaintEvent &)
        delete gc;
 }
 
+void
+Timeline::playlist_changed ()
+{
+       Refresh ();
+}
index 48aebc6372821de90468597331c0b7668ef2d102..1993eb9c25342fdab566ae8deeee5e4e18c0b49f 100644 (file)
@@ -30,6 +30,7 @@ public:
 
 private:
        void paint (wxPaintEvent &);
+       void playlist_changed ();
 
        static int const _track_height;