From 0cb42343e0f0499ef21943c3ad1bda3dfb11173a Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 15 Jul 2011 04:03:54 +0000 Subject: [PATCH] Fix the video zoom dropdown Originally committed to SVN as r5446. --- aegisub/src/video_display.cpp | 10 ++++++++-- aegisub/src/video_display.h | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/aegisub/src/video_display.cpp b/aegisub/src/video_display.cpp index 85ff3a49c..daf03d087 100644 --- a/aegisub/src/video_display.cpp +++ b/aegisub/src/video_display.cpp @@ -144,7 +144,10 @@ VideoDisplay::VideoDisplay( { assert(box); - if (zoomBox) zoomBox->SetValue(wxString::Format("%g%%", zoomValue * 100.)); + if (zoomBox) { + zoomBox->SetValue(wxString::Format("%g%%", zoomValue * 100.)); + zoomBox->Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, &VideoDisplay::SetZoomFromBox, this); + } box->Bind(wxEVT_COMMAND_TOOL_CLICKED, &VideoDisplay::OnMode, this, Video_Mode_Standard, Video_Mode_Vector_Clip); con->videoController->Bind(EVT_FRAME_READY, &VideoDisplay::UploadFrameData, this); @@ -163,6 +166,9 @@ VideoDisplay::VideoDisplay( VideoDisplay::~VideoDisplay () { con->videoController->Unbind(EVT_FRAME_READY, &VideoDisplay::UploadFrameData, this); + if (zoomBox) { + zoomBox->Unbind(wxEVT_COMMAND_COMBOBOX_SELECTED, &VideoDisplay::SetZoomFromBox, this); + } } bool VideoDisplay::InitContext() { @@ -470,7 +476,7 @@ void VideoDisplay::SetZoom(double value) { if (zoomBox) zoomBox->SetValue(wxString::Format("%g%%", zoomValue * 100.)); UpdateSize(); } -void VideoDisplay::SetZoomFromBox() { +void VideoDisplay::SetZoomFromBox(wxCommandEvent &) { if (!zoomBox) return; wxString strValue = zoomBox->GetValue(); strValue.EndsWith(L"%", &strValue); diff --git a/aegisub/src/video_display.h b/aegisub/src/video_display.h index 81d98dfa3..ff2cd9946 100644 --- a/aegisub/src/video_display.h +++ b/aegisub/src/video_display.h @@ -182,6 +182,8 @@ class VideoDisplay : public wxGLCanvas { void ShowCursor(bool show); /// @brief Set the size of the display based on the current zoom and video resolution void UpdateSize(int arType = -1, double arValue = -1.); + /// @brief Set the zoom level to that indicated by the dropdown + void SetZoomFromBox(wxCommandEvent&); public: /// @brief Constructor VideoDisplay( @@ -198,8 +200,6 @@ public: /// @brief Set the zoom level /// @param value The new zoom level void SetZoom(double value); - /// @brief Set the zoom level to that indicated by the dropdown - void SetZoomFromBox(); /// @brief Get the current zoom level double GetZoom() const { return zoomValue; }