Some more fixes to detached video display, but I don't know how well it's working, as there are several GL issues here.

Originally committed to SVN as r1687.
This commit is contained in:
Rodrigo Braz Monteiro 2008-01-11 05:44:00 +00:00
parent 777f74d394
commit 22032bc7da
4 changed files with 19 additions and 9 deletions

View File

@ -54,6 +54,9 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *par)
// Set parent // Set parent
parent = par; parent = par;
// Set obscure stuff
SetExtraStyle(GetExtraStyle() & (~wxWS_EX_BLOCK_EVENTS) | wxWS_EX_PROCESS_UI_UPDATES);
// Set title // Set title
wxFileName fn(VideoContext::Get()->videoName); wxFileName fn(VideoContext::Get()->videoName);
SetTitle(wxString::Format(_("Video: %s"),fn.GetFullName().c_str())); SetTitle(wxString::Format(_("Video: %s"),fn.GetFullName().c_str()));

View File

@ -63,11 +63,10 @@
/////////////// ///////////////
// Constructor // Constructor
VideoBox::VideoBox(wxWindow *parent) VideoBox::VideoBox(wxWindow *parent)
: wxPanel (parent,5000) : wxPanel (parent,-1)
{ {
// Parent // Parent
videoPage = this; videoPage = this;
frame = AegisubApp::Get()->frame;
// Visual controls sub-toolbar // Visual controls sub-toolbar
visualSubToolBar = new wxToolBar(videoPage,-1,wxDefaultPosition,wxDefaultSize,wxTB_HORIZONTAL | wxTB_BOTTOM | wxTB_FLAT); visualSubToolBar = new wxToolBar(videoPage,-1,wxDefaultPosition,wxDefaultSize,wxTB_HORIZONTAL | wxTB_BOTTOM | wxTB_FLAT);
@ -96,7 +95,7 @@ VideoBox::VideoBox(wxWindow *parent)
VideoSubsPos->SetToolTip(_("Time of this frame relative to start and end of current subs.")); VideoSubsPos->SetToolTip(_("Time of this frame relative to start and end of current subs."));
// Display // Display
videoDisplay = new VideoDisplay(videoPage,-1,wxDefaultPosition,wxDefaultSize,wxSUNKEN_BORDER,_T("VideoBox")); videoDisplay = new VideoDisplay(videoPage,-1,wxDefaultPosition,wxDefaultSize,wxSUNKEN_BORDER);
videoDisplay->ControlSlider = videoSlider; videoDisplay->ControlSlider = videoSlider;
videoDisplay->PositionDisplay = VideoPosition; videoDisplay->PositionDisplay = VideoPosition;
videoDisplay->SubsPosition = VideoSubsPos; videoDisplay->SubsPosition = VideoSubsPos;

View File

@ -81,7 +81,6 @@ public:
wxTextCtrl *VideoSubsPos; wxTextCtrl *VideoSubsPos;
VideoDisplay *videoDisplay; VideoDisplay *videoDisplay;
VideoSlider *videoSlider; VideoSlider *videoSlider;
FrameMain *frame;
VideoBox (wxWindow *parent); VideoBox (wxWindow *parent);

View File

@ -235,6 +235,7 @@ void VideoDisplay::Render() {
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
glViewport(dx1,dy1,dx2,dy2); glViewport(dx1,dy1,dx2,dy2);
if (glGetError()) throw _T("Error setting GL viewport.");
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
glOrtho(0.0f,sw,sh,0.0f,-1000.0f,1000.0f); glOrtho(0.0f,sw,sh,0.0f,-1000.0f,1000.0f);
@ -372,8 +373,8 @@ void VideoDisplay::DrawOverscanMask(int sizeH,int sizeV,wxColour colour,double a
/////////////// ///////////////
// Update size // Update size
void VideoDisplay::UpdateSize() { void VideoDisplay::UpdateSize() {
// Free size? // Don't do anything if it's a free sizing display
if (freeSize) return; //if (freeSize) return;
// Loaded? // Loaded?
VideoContext *con = VideoContext::Get(); VideoContext *con = VideoContext::Get();
@ -382,9 +383,14 @@ void VideoDisplay::UpdateSize() {
if (!IsShownOnScreen()) return; if (!IsShownOnScreen()) return;
// Get size // Get size
if (freeSize) {
GetClientSize(&w,&h);
}
else {
if (con->GetAspectRatioType() == 0) w = int(con->GetWidth() * zoomValue); if (con->GetAspectRatioType() == 0) w = int(con->GetWidth() * zoomValue);
else w = int(con->GetHeight() * zoomValue * con->GetAspectRatioValue()); else w = int(con->GetHeight() * zoomValue * con->GetAspectRatioValue());
h = int(con->GetHeight() * zoomValue); h = int(con->GetHeight() * zoomValue);
}
int _w,_h; int _w,_h;
if (w <= 1 || h <= 1) return; if (w <= 1 || h <= 1) return;
locked = true; locked = true;
@ -438,6 +444,9 @@ void VideoDisplay::OnPaint(wxPaintEvent& event) {
// Size Event // Size Event
void VideoDisplay::OnSizeEvent(wxSizeEvent &event) { void VideoDisplay::OnSizeEvent(wxSizeEvent &event) {
//Refresh(false); //Refresh(false);
if (freeSize) {
UpdateSize();
}
event.Skip(); event.Skip();
} }