Make several of VideoDisplay's members private

Originally committed to SVN as r5265.
This commit is contained in:
Thomas Goyne 2011-01-23 07:47:59 +00:00
parent 14420102e4
commit 091c8170f2
4 changed files with 17 additions and 22 deletions

View file

@ -77,7 +77,6 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *parent, agi::Context *contex
// Video area; // Video area;
videoBox = new VideoBox(panel, true, NULL, context); videoBox = new VideoBox(panel, true, NULL, context);
videoBox->videoDisplay->freeSize = true;
videoBox->videoDisplay->SetClientSize(initialDisplaySize); videoBox->videoDisplay->SetClientSize(initialDisplaySize);
// Set sizer // Set sizer

View file

@ -118,7 +118,7 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached, wxComboBox *zoomBox, agi::
visualToolBar->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); visualToolBar->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
// Display // Display
videoDisplay = new VideoDisplay(this,VideoPosition,VideoSubsPos,zoomBox,this,context); videoDisplay = new VideoDisplay(this,isDetached,VideoPosition,VideoSubsPos,zoomBox,this,context);
// Top sizer // Top sizer
// Detached and attached video needs different flags, see bugs #742 and #853 // Detached and attached video needs different flags, see bugs #742 and #853

View file

@ -97,9 +97,6 @@ enum {
BEGIN_EVENT_TABLE(VideoDisplay, wxGLCanvas) BEGIN_EVENT_TABLE(VideoDisplay, wxGLCanvas)
EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent) EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent)
EVT_KEY_DOWN(VideoDisplay::OnKeyDown) 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_COORDS,VideoDisplay::OnCopyCoords)
EVT_MENU(VIDEO_MENU_COPY_TO_CLIPBOARD,VideoDisplay::OnCopyToClipboard) EVT_MENU(VIDEO_MENU_COPY_TO_CLIPBOARD,VideoDisplay::OnCopyToClipboard)
@ -127,6 +124,7 @@ public:
VideoDisplay::VideoDisplay( VideoDisplay::VideoDisplay(
VideoBox *box, VideoBox *box,
bool freeSize,
wxTextCtrl *PositionDisplay, wxTextCtrl *PositionDisplay,
wxTextCtrl *SubsPosition, wxTextCtrl *SubsPosition,
wxComboBox *zoomBox, wxComboBox *zoomBox,
@ -147,7 +145,7 @@ VideoDisplay::VideoDisplay(
, scriptH(INT_MIN) , scriptH(INT_MIN)
, zoomBox(zoomBox) , zoomBox(zoomBox)
, box(box) , box(box)
, freeSize(false) , freeSize(freeSize)
{ {
assert(box); assert(box);
@ -160,6 +158,11 @@ VideoDisplay::VideoDisplay(
slots.push_back(con->videoController->AddARChangeListener(&VideoDisplay::UpdateSize, this)); slots.push_back(con->videoController->AddARChangeListener(&VideoDisplay::UpdateSize, this));
slots.push_back(con->ass->AddCommitListener(&VideoDisplay::OnCommit, 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); SetCursor(wxNullCursor);
} }
@ -443,15 +446,11 @@ void VideoDisplay::UpdateSize(int arType, double arValue) {
if (tool.get()) tool->Refresh(); if (tool.get()) tool->Refresh();
wxGLCanvas::Refresh(false); Refresh(false);
}
void VideoDisplay::OnPaint(wxPaintEvent&) {
Render();
} }
void VideoDisplay::OnSizeEvent(wxSizeEvent &event) { void VideoDisplay::OnSizeEvent(wxSizeEvent &event) {
if (freeSize) UpdateSize(); UpdateSize();
event.Skip(); event.Skip();
} }

View file

@ -106,8 +106,6 @@ class VideoDisplay : public wxGLCanvas {
/// Upload the image for the current frame to the video card /// Upload the image for the current frame to the video card
void UploadFrameData(FrameReadyEvent&); void UploadFrameData(FrameReadyEvent&);
/// @brief Paint event
void OnPaint(wxPaintEvent& event);
/// @brief Key event handler /// @brief Key event handler
/// @param event /// @param event
void OnKeyDown(wxKeyEvent &event); void OnKeyDown(wxKeyEvent &event);
@ -115,8 +113,6 @@ class VideoDisplay : public wxGLCanvas {
/// @param event /// @param event
void OnMouseEvent(wxMouseEvent& 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 /// @brief Recalculate video positioning and scaling when the available area or zoom changes
/// @param event /// @param event
void OnSizeEvent(wxSizeEvent &event); void OnSizeEvent(wxSizeEvent &event);
@ -185,16 +181,22 @@ class VideoDisplay : public wxGLCanvas {
/// The dropdown box for selecting zoom levels /// The dropdown box for selecting zoom levels
wxComboBox *zoomBox; wxComboBox *zoomBox;
public:
/// The VideoBox this display is contained in /// The VideoBox this display is contained in
VideoBox *box; VideoBox *box;
/// Whether the display can be freely resized by the user /// Whether the display can be freely resized by the user
bool freeSize; 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 /// @brief Constructor
VideoDisplay( VideoDisplay(
VideoBox *box, VideoBox *box,
bool isDetached,
wxTextCtrl *PositionDisplay, wxTextCtrl *PositionDisplay,
wxTextCtrl *SubsPosition, wxTextCtrl *SubsPosition,
wxComboBox *zoomBox, wxComboBox *zoomBox,
@ -205,11 +207,6 @@ public:
/// @brief Render the currently visible frame /// @brief Render the currently visible frame
void Render(); 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 /// @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);