Delete in timeline removes content (#2370).
authorCarl Hetherington <cth@carlh.net>
Sun, 5 Feb 2023 12:50:52 +0000 (13:50 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 5 Feb 2023 12:50:52 +0000 (13:50 +0100)
src/wx/timeline.cc
src/wx/timeline.h
src/wx/timeline_dialog.cc
src/wx/timeline_dialog.h

index 604a00f39cd60ed482719c789af534c11bc2aadc..d2443c8a974690c1b8b57163dde2bddecafaca56 100644 (file)
@@ -950,3 +950,14 @@ Timeline::zoom_all ()
        _labels_canvas->Scroll (0, 0);
        Refresh ();
 }
+
+
+void
+Timeline::keypress(wxKeyEvent const& event)
+{
+       if (event.GetKeyCode() == WXK_DELETE) {
+               auto film = _film.lock();
+               film->remove_content(selected_content());
+       }
+}
+
index a2c4f0f2fda7d56fe5be086c2323db1e07ccbc0c..184a5d9ee743e95b7f95e575108be7fc4a72879c 100644 (file)
@@ -82,6 +82,8 @@ public:
 
        int tracks_y_offset () const;
 
+       void keypress(wxKeyEvent const &);
+
 private:
        void paint_labels ();
        void paint_main ();
index 0d05e66d694d5e46a0b788e28034ad85c8e03bc1..d6c784387435111edb560b68667b03aa292a80bc 100644 (file)
@@ -95,6 +95,8 @@ TimelineDialog::TimelineDialog(ContentPanel* cp, shared_ptr<Film> film, FilmView
        sizer->Layout ();
        sizer->SetSizeHints (this);
 
+       Bind(wxEVT_CHAR_HOOK, boost::bind(&TimelineDialog::keypress, this, _1));
+
         _toolbar->ToggleTool ((int) Timeline::SNAP, _timeline.snap ());
        film_change (ChangeType::DONE, Film::Property::SEQUENCE);
 
@@ -141,3 +143,10 @@ TimelineDialog::tool_clicked (wxCommandEvent& ev)
                }
        }
 }
+
+
+void
+TimelineDialog::keypress(wxKeyEvent const& event)
+{
+       _timeline.keypress(event);
+}
index f5dea4eef3c54ab2eae034282f9fb91de281e274..155d51fac4b0289d134f4459e26cea905e9d5b7c 100644 (file)
@@ -39,6 +39,7 @@ public:
 private:
        void film_change (ChangeType type, Film::Property);
        void tool_clicked (wxCommandEvent& id);
+       void keypress(wxKeyEvent const& event);
 
        std::weak_ptr<Film> _film;
        Timeline _timeline;