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);
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);

View File

@ -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; }