Fix non-working delete key.
authorCarl Hetherington <cth@carlh.net>
Tue, 26 Apr 2016 20:55:23 +0000 (21:55 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 26 Apr 2016 20:55:23 +0000 (21:55 +0100)
ChangeLog
src/tools/dcpomatic.cc
src/wx/content_panel.cc
src/wx/content_panel.h

index d9244bcf1376bae68a84ea208b55436d9a94fada..413efd79055e0ddaaa4076d5b4638fbf269a63d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2016-04-26  Carl Hetherington  <cth@carlh.net>
 
+       * Fix non-working delete key.
+
        * Updated ru_RU and uk_UA translations from Igor Voytovich.
 
        * Updated sv_SE translation from Adam Klotblixt.
index 5676e6e573620aed1e2a3fff2c2ef045e720bde8..6f5bdd6640a3f92a894302cafc648c214f94ae86 100644 (file)
@@ -249,7 +249,7 @@ public:
                accel[0].Set (wxACCEL_CTRL, static_cast<int>('A'), ID_add_file);
                accel[1].Set (wxACCEL_NORMAL, WXK_DELETE, ID_remove);
                Bind (wxEVT_MENU, boost::bind (&ContentPanel::add_file_clicked, _film_editor->content_panel()), ID_add_file);
-               Bind (wxEVT_MENU, boost::bind (&ContentPanel::remove_clicked, _film_editor->content_panel(), true), ID_remove);
+               Bind (wxEVT_MENU, boost::bind (&DOMFrame::remove_clicked, this, _1), ID_remove);
                wxAcceleratorTable accel_table (2, accel);
                SetAcceleratorTable (accel_table);
 
@@ -259,6 +259,13 @@ public:
                UpdateChecker::instance()->StateChanged.connect (boost::bind (&DOMFrame::update_checker_state_changed, this));
        }
 
+       void remove_clicked (wxCommandEvent& ev)
+       {
+               if (_film_editor->content_panel()->remove_clicked (true)) {
+                       ev.Skip ();
+               }
+       }
+
        void new_film (boost::filesystem::path path)
        {
                shared_ptr<Film> film (new Film (path));
index efc445bc905f36da2db2a597d7a0601176cdacd4..654378248b3f61433a505909b6788a14215a3e59 100644 (file)
@@ -343,14 +343,15 @@ ContentPanel::add_folder_clicked ()
        _film->examine_and_add_content (content);
 }
 
-void
+/** @return true if this remove "click" should be ignored */
+bool
 ContentPanel::remove_clicked (bool hotkey)
 {
        /* If the method was called because Delete was pressed check that our notebook page
           is visible and that the content list is focussed.
        */
        if (hotkey && (_parent->GetCurrentPage() != _panel || !_content->HasFocus())) {
-               return;
+               return true;
        }
 
        BOOST_FOREACH (shared_ptr<Content> i, selected ()) {
@@ -358,6 +359,7 @@ ContentPanel::remove_clicked (bool hotkey)
        }
 
        selection_changed ();
+       return false;
 }
 
 void
index e356b5a49ed24fc093c4b15e1b9c73e3ab97715d..9e6cf9f24b24a714c85b94a1e705d4942f3a1438 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -65,7 +65,7 @@ public:
        FFmpegContentList selected_ffmpeg ();
 
        void add_file_clicked ();
-       void remove_clicked (bool hotkey);
+       bool remove_clicked (bool hotkey);
 
 private:
        void selection_changed ();