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
parent = par;
// Set obscure stuff
SetExtraStyle(GetExtraStyle() & (~wxWS_EX_BLOCK_EVENTS) | wxWS_EX_PROCESS_UI_UPDATES);
// Set title
wxFileName fn(VideoContext::Get()->videoName);
SetTitle(wxString::Format(_("Video: %s"),fn.GetFullName().c_str()));

View File

@ -63,11 +63,10 @@
///////////////
// Constructor
VideoBox::VideoBox(wxWindow *parent)
: wxPanel (parent,5000)
: wxPanel (parent,-1)
{
// Parent
videoPage = this;
frame = AegisubApp::Get()->frame;
// Visual controls sub-toolbar
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."));
// 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->PositionDisplay = VideoPosition;
videoDisplay->SubsPosition = VideoSubsPos;

View File

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

View File

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