From 091c8170f2580691701d435ae2f9f5de9fc68caa Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 23 Jan 2011 07:47:59 +0000 Subject: [PATCH] Make several of VideoDisplay's members private Originally committed to SVN as r5265. --- aegisub/src/dialog_detached_video.cpp | 1 - aegisub/src/video_box.cpp | 2 +- aegisub/src/video_display.cpp | 19 +++++++++---------- aegisub/src/video_display.h | 17 +++++++---------- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/aegisub/src/dialog_detached_video.cpp b/aegisub/src/dialog_detached_video.cpp index 452059839..d131b2683 100644 --- a/aegisub/src/dialog_detached_video.cpp +++ b/aegisub/src/dialog_detached_video.cpp @@ -77,7 +77,6 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *parent, agi::Context *contex // Video area; videoBox = new VideoBox(panel, true, NULL, context); - videoBox->videoDisplay->freeSize = true; videoBox->videoDisplay->SetClientSize(initialDisplaySize); // Set sizer diff --git a/aegisub/src/video_box.cpp b/aegisub/src/video_box.cpp index 1d6de281e..b53a19a47 100644 --- a/aegisub/src/video_box.cpp +++ b/aegisub/src/video_box.cpp @@ -118,7 +118,7 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox, agi:: visualToolBar->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); // Display - videoDisplay = new VideoDisplay(this,VideoPosition,VideoSubsPos,zoomBox,this,context); + videoDisplay = new VideoDisplay(this,isDetached,VideoPosition,VideoSubsPos,zoomBox,this,context); // Top sizer // Detached and attached video needs different flags, see bugs #742 and #853 diff --git a/aegisub/src/video_display.cpp b/aegisub/src/video_display.cpp index a982a0c52..62747c9d3 100644 --- a/aegisub/src/video_display.cpp +++ b/aegisub/src/video_display.cpp @@ -97,9 +97,6 @@ enum { BEGIN_EVENT_TABLE(VideoDisplay, wxGLCanvas) EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent) EVT_KEY_DOWN(VideoDisplay::OnKeyDown) - EVT_PAINT(VideoDisplay::OnPaint) - EVT_SIZE(VideoDisplay::OnSizeEvent) - EVT_ERASE_BACKGROUND(VideoDisplay::OnEraseBackground) EVT_MENU(VIDEO_MENU_COPY_COORDS,VideoDisplay::OnCopyCoords) EVT_MENU(VIDEO_MENU_COPY_TO_CLIPBOARD,VideoDisplay::OnCopyToClipboard) @@ -127,6 +124,7 @@ public: VideoDisplay::VideoDisplay( VideoBox *box, + bool freeSize, wxTextCtrl *PositionDisplay, wxTextCtrl *SubsPosition, wxComboBox *zoomBox, @@ -147,7 +145,7 @@ VideoDisplay::VideoDisplay( , scriptH(INT_MIN) , zoomBox(zoomBox) , box(box) -, freeSize(false) +, freeSize(freeSize) { assert(box); @@ -160,6 +158,11 @@ VideoDisplay::VideoDisplay( slots.push_back(con->videoController->AddARChangeListener(&VideoDisplay::UpdateSize, this)); slots.push_back(con->ass->AddCommitListener(&VideoDisplay::OnCommit, this)); + Bind(wxEVT_PAINT, std::tr1::bind(&VideoDisplay::Render, this)); + if (freeSize) { + Bind(wxEVT_SIZE, &VideoDisplay::OnSizeEvent, this); + } + SetCursor(wxNullCursor); } @@ -443,15 +446,11 @@ void VideoDisplay::UpdateSize(int arType, double arValue) { if (tool.get()) tool->Refresh(); - wxGLCanvas::Refresh(false); -} - -void VideoDisplay::OnPaint(wxPaintEvent&) { - Render(); + Refresh(false); } void VideoDisplay::OnSizeEvent(wxSizeEvent &event) { - if (freeSize) UpdateSize(); + UpdateSize(); event.Skip(); } diff --git a/aegisub/src/video_display.h b/aegisub/src/video_display.h index eb231f849..203a94b3d 100644 --- a/aegisub/src/video_display.h +++ b/aegisub/src/video_display.h @@ -106,8 +106,6 @@ class VideoDisplay : public wxGLCanvas { /// Upload the image for the current frame to the video card void UploadFrameData(FrameReadyEvent&); - /// @brief Paint event - void OnPaint(wxPaintEvent& event); /// @brief Key event handler /// @param event void OnKeyDown(wxKeyEvent &event); @@ -115,8 +113,6 @@ class VideoDisplay : public wxGLCanvas { /// @param event void OnMouseEvent(wxMouseEvent& event); - /// @brief NOP event handler - void OnEraseBackground(wxEraseEvent &) {} /// @brief Recalculate video positioning and scaling when the available area or zoom changes /// @param event void OnSizeEvent(wxSizeEvent &event); @@ -185,16 +181,22 @@ class VideoDisplay : public wxGLCanvas { /// The dropdown box for selecting zoom levels wxComboBox *zoomBox; -public: /// The VideoBox this display is contained in VideoBox *box; /// Whether the display can be freely resized by the user bool freeSize; + /// @brief Set the cursor to either default or blank + /// @param show Whether or not the cursor should be visible + 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.); +public: /// @brief Constructor VideoDisplay( VideoBox *box, + bool isDetached, wxTextCtrl *PositionDisplay, wxTextCtrl *SubsPosition, wxComboBox *zoomBox, @@ -205,11 +207,6 @@ public: /// @brief Render the currently visible frame void Render(); - /// @brief Set the cursor to either default or blank - /// @param show Whether or not the cursor should be visible - 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 /// @param value The new zoom level void SetZoom(double value);