Make sure that crop preview rectangle is properly hidden when we close the auto crop...
[dcpomatic.git] / src / wx / content_menu.cc
index 7e465947999b802782c54bf374bcc6e29326ce35..93bcc0a6d4042f05a4980e96f1212ea49ebfc27f 100644 (file)
@@ -555,7 +555,7 @@ ContentMenu::auto_crop ()
                auto const content = _content.front();
                auto const current_crop = content->video->actual_crop();
                viewer->set_crop_guess (
-                       Rect<float>(
+                       dcpomatic::Rect<float>(
                                static_cast<float>(std::max(0, crop.left - current_crop.left)) / content->video->size().width,
                                static_cast<float>(std::max(0, crop.top - current_crop.top)) / content->video->size().height,
                                1.0f - (static_cast<float>(std::max(0, crop.left - current_crop.left + crop.right - current_crop.right)) / content->video->size().width),
@@ -602,13 +602,13 @@ ContentMenu::auto_crop ()
 
        /* Handle the user closing the dialog (with OK or cancel) */
        _auto_crop_dialog->Bind (wxEVT_BUTTON, [this, viewer](wxCommandEvent& ev) {
+               _auto_crop_config_connection.disconnect ();
+               _auto_crop_viewer_connection.disconnect ();
                if (ev.GetId() == wxID_OK) {
                        _content.front()->video->set_crop(_auto_crop_dialog->get());
                }
                _auto_crop_dialog->Show (false);
                viewer->unset_crop_guess ();
-               _auto_crop_config_connection.disconnect ();
-               _auto_crop_viewer_connection.disconnect ();
        });
 
        /* Update the view when something in the dialog is changed */