diff --git a/aegisub/dialog_style_manager.cpp b/aegisub/dialog_style_manager.cpp index ca64da996..3d10ea506 100644 --- a/aegisub/dialog_style_manager.cpp +++ b/aegisub/dialog_style_manager.cpp @@ -54,6 +54,11 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid) : wxDialog (parent,-1,_("Styles Manager"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE,_T("DialogStylesManager")) { + // Set icon + wxIcon ico; + ico.CopyFromBitmap(wxBITMAP(style_toolbutton)); + SetIcon(ico); + // Vars grid = _grid; @@ -67,7 +72,7 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid) CatalogBox->Add(CatalogDelete,0,0,0); // Storage styles list - StorageList = new wxListBox(this, LIST_STORAGE, wxDefaultPosition, wxSize(205,250), 0, NULL, wxLB_EXTENDED); + StorageList = new wxListBox(this, LIST_STORAGE, wxDefaultPosition, wxSize(260,250), 0, NULL, wxLB_EXTENDED); wxSizer *StorageBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Storage")); wxSizer *StorageButtons = new wxBoxSizer(wxHORIZONTAL); wxSizer *StorageButtonsLow = new wxBoxSizer(wxHORIZONTAL); @@ -100,7 +105,7 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid) StorageDelete->Disable(); // Local styles list - CurrentList = new wxListBox(this, LIST_CURRENT, wxDefaultPosition, wxSize(205,250), 0, NULL, wxLB_EXTENDED); + CurrentList = new wxListBox(this, LIST_CURRENT, wxDefaultPosition, wxSize(260,250), 0, NULL, wxLB_EXTENDED); wxSizer *CurrentBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Current script")); wxSizer *CurrentButtons = new wxBoxSizer(wxHORIZONTAL); wxSizer *CurrentButtonsLow = new wxBoxSizer(wxHORIZONTAL); diff --git a/aegisub/subs_grid.cpp b/aegisub/subs_grid.cpp index d6951cc70..7f3daa1d1 100644 --- a/aegisub/subs_grid.cpp +++ b/aegisub/subs_grid.cpp @@ -758,6 +758,9 @@ void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModif Clear(); if (keepSelection) yPos = oldPos; + // Clear from video + VideoContext::Get()->curLine = NULL; + // Get subtitles if (_ass) ass = _ass; else { diff --git a/aegisub/video_context.cpp b/aegisub/video_context.cpp index bffee042a..8597e1589 100644 --- a/aegisub/video_context.cpp +++ b/aegisub/video_context.cpp @@ -116,7 +116,8 @@ VideoContext::VideoContext() { keepAudioSync = true; // Threads - threaded = Options.AsBool(_T("Threaded Video")); + //threaded = Options.AsBool(_T("Threaded Video")); + threaded = false; threadLocked = false; threadNextFrame = -1; } @@ -182,6 +183,7 @@ void VideoContext::Reset() { overKeyFramesLoaded = false; isPlaying = false; nextFrame = -1; + curLine = NULL; // Update displays UpdateDisplays(true); diff --git a/aegisub/video_display.cpp b/aegisub/video_display.cpp index c637f7ad8..ed805e2ea 100644 --- a/aegisub/video_display.cpp +++ b/aegisub/video_display.cpp @@ -67,6 +67,7 @@ #include "main.h" #include "video_slider.h" #include "video_box.h" +#include "gl_wrap.h" /////// @@ -218,6 +219,7 @@ void VideoDisplay::Render() { glOrtho(0.0f,sw,sh,0.0f,-1000.0f,1000.0f); glMatrixMode(GL_MODELVIEW); if (glGetError()) throw _T("Error setting up matrices (wtf?)."); + glShadeModel(GL_FLAT); // Texture mode if (w != pw || h != ph) { @@ -267,6 +269,10 @@ void VideoDisplay::Render() { glVertex2f(sw,0); glEnd(); context->SetShader(false); + glDisable(GL_TEXTURE_2D); + + // TV effects + DrawTVEffects(); // Draw overlay wxASSERT(visual); @@ -279,6 +285,58 @@ void VideoDisplay::Render() { } +/////////////////////////////////// +// TV effects (overscan and so on) +void VideoDisplay::DrawTVEffects() { + // Get coordinates + int sw,sh; + VideoContext *context = VideoContext::Get(); + context->GetScriptSize(sw,sh); + bool drawOverscan = false; + + // Draw overscan mask + if (drawOverscan) { + // Parameters + DrawOverscanMask(int(sw * 0.067),int(sh * 0.05),wxColour(30,70,200),0.5); + DrawOverscanMask(int(sw * 0.033),int(sh * 0.035),wxColour(30,70,200),0.5); + } +} + + +////////////////////// +// Draw overscan mask +void VideoDisplay::DrawOverscanMask(int sizeH,int sizeV,wxColour colour,double alpha) { + // Parameters + int sw,sh; + VideoContext *context = VideoContext::Get(); + context->GetScriptSize(sw,sh); + int rad1 = 24; + int gapH = sizeH+rad1; + int gapV = sizeV+rad1; + int rad2 = (int)sqrt(double(gapH*gapH + gapV*gapV))+1; + + // Set up GL wrapper + OpenGLWrapper gl; + gl.SetFillColour(colour,alpha); + gl.SetLineColour(wxColour(0,0,0),0.0,1); + + // Draw rectangles + gl.DrawRectangle(gapH,0,sw-gapH,sizeV); // Top + gl.DrawRectangle(sw-sizeH,gapV,sw,sh-gapV); // Right + gl.DrawRectangle(gapH,sh-sizeV,sw-gapH,sh); // Bottom + gl.DrawRectangle(0,gapV,sizeH,sh-gapV); // Left + + // Draw corners + gl.DrawRing(gapH,gapV,rad1,rad2,1.0,180.0,270.0); // Top-left + gl.DrawRing(sw-gapH,gapV,rad1,rad2,1.0,90.0,180.0); // Top-right + gl.DrawRing(sw-gapH,sh-gapV,rad1,rad2,1.0,0.0,90.0); // Bottom-right + gl.DrawRing(gapH,sh-gapV,rad1,rad2,1.0,270.0,360.0); // Bottom-left + + // Done + glDisable(GL_BLEND); +} + + /////////////// // Update size void VideoDisplay::UpdateSize() { diff --git a/aegisub/video_display.h b/aegisub/video_display.h index 39861fd9e..218090794 100644 --- a/aegisub/video_display.h +++ b/aegisub/video_display.h @@ -72,6 +72,9 @@ private: int dx1,dx2,dy1,dy2; bool locked; + void DrawTVEffects(); + void DrawOverscanMask(int sizeH,int sizeV,wxColour color,double alpha=0.5); + void OnPaint(wxPaintEvent& event); void OnKey(wxKeyEvent &event); void OnMouseEvent(wxMouseEvent& event);