Fix the video zoom dropdown

Originally committed to SVN as r5446.
This commit is contained in:
Thomas Goyne 2011-07-15 04:03:54 +00:00
parent 9c97544fc5
commit 0cb42343e0
2 changed files with 10 additions and 4 deletions

View file

@ -144,7 +144,10 @@ VideoDisplay::VideoDisplay(
{ {
assert(box); 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); 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); con->videoController->Bind(EVT_FRAME_READY, &VideoDisplay::UploadFrameData, this);
@ -163,6 +166,9 @@ VideoDisplay::VideoDisplay(
VideoDisplay::~VideoDisplay () { VideoDisplay::~VideoDisplay () {
con->videoController->Unbind(EVT_FRAME_READY, &VideoDisplay::UploadFrameData, this); con->videoController->Unbind(EVT_FRAME_READY, &VideoDisplay::UploadFrameData, this);
if (zoomBox) {
zoomBox->Unbind(wxEVT_COMMAND_COMBOBOX_SELECTED, &VideoDisplay::SetZoomFromBox, this);
}
} }
bool VideoDisplay::InitContext() { bool VideoDisplay::InitContext() {
@ -470,7 +476,7 @@ void VideoDisplay::SetZoom(double value) {
if (zoomBox) zoomBox->SetValue(wxString::Format("%g%%", zoomValue * 100.)); if (zoomBox) zoomBox->SetValue(wxString::Format("%g%%", zoomValue * 100.));
UpdateSize(); UpdateSize();
} }
void VideoDisplay::SetZoomFromBox() { void VideoDisplay::SetZoomFromBox(wxCommandEvent &) {
if (!zoomBox) return; if (!zoomBox) return;
wxString strValue = zoomBox->GetValue(); wxString strValue = zoomBox->GetValue();
strValue.EndsWith(L"%", &strValue); strValue.EndsWith(L"%", &strValue);

View file

@ -182,6 +182,8 @@ class VideoDisplay : public wxGLCanvas {
void ShowCursor(bool show); void ShowCursor(bool show);
/// @brief Set the size of the display based on the current zoom and video resolution /// @brief Set the size of the display based on the current zoom and video resolution
void UpdateSize(int arType = -1, double arValue = -1.); void UpdateSize(int arType = -1, double arValue = -1.);
/// @brief Set the zoom level to that indicated by the dropdown
void SetZoomFromBox(wxCommandEvent&);
public: public:
/// @brief Constructor /// @brief Constructor
VideoDisplay( VideoDisplay(
@ -198,8 +200,6 @@ public:
/// @brief Set the zoom level /// @brief Set the zoom level
/// @param value The new zoom level /// @param value The new zoom level
void SetZoom(double value); void SetZoom(double value);
/// @brief Set the zoom level to that indicated by the dropdown
void SetZoomFromBox();
/// @brief Get the current zoom level /// @brief Get the current zoom level
double GetZoom() const { return zoomValue; } double GetZoom() const { return zoomValue; }