forked from mia/Aegisub
Fixed some video display bugs and added overscan mask drawing (disabled for now).
Originally committed to SVN as r1308.
This commit is contained in:
parent
907221c940
commit
726305faff
5 changed files with 74 additions and 3 deletions
|
@ -54,6 +54,11 @@
|
||||||
DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
: wxDialog (parent,-1,_("Styles Manager"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE,_T("DialogStylesManager"))
|
: wxDialog (parent,-1,_("Styles Manager"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE,_T("DialogStylesManager"))
|
||||||
{
|
{
|
||||||
|
// Set icon
|
||||||
|
wxIcon ico;
|
||||||
|
ico.CopyFromBitmap(wxBITMAP(style_toolbutton));
|
||||||
|
SetIcon(ico);
|
||||||
|
|
||||||
// Vars
|
// Vars
|
||||||
grid = _grid;
|
grid = _grid;
|
||||||
|
|
||||||
|
@ -67,7 +72,7 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
CatalogBox->Add(CatalogDelete,0,0,0);
|
CatalogBox->Add(CatalogDelete,0,0,0);
|
||||||
|
|
||||||
// Storage styles list
|
// 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 *StorageBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Storage"));
|
||||||
wxSizer *StorageButtons = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *StorageButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||||
wxSizer *StorageButtonsLow = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *StorageButtonsLow = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -100,7 +105,7 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
StorageDelete->Disable();
|
StorageDelete->Disable();
|
||||||
|
|
||||||
// Local styles list
|
// 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 *CurrentBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Current script"));
|
||||||
wxSizer *CurrentButtons = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *CurrentButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||||
wxSizer *CurrentButtonsLow = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *CurrentButtonsLow = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
|
@ -758,6 +758,9 @@ void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModif
|
||||||
Clear();
|
Clear();
|
||||||
if (keepSelection) yPos = oldPos;
|
if (keepSelection) yPos = oldPos;
|
||||||
|
|
||||||
|
// Clear from video
|
||||||
|
VideoContext::Get()->curLine = NULL;
|
||||||
|
|
||||||
// Get subtitles
|
// Get subtitles
|
||||||
if (_ass) ass = _ass;
|
if (_ass) ass = _ass;
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -116,7 +116,8 @@ VideoContext::VideoContext() {
|
||||||
keepAudioSync = true;
|
keepAudioSync = true;
|
||||||
|
|
||||||
// Threads
|
// Threads
|
||||||
threaded = Options.AsBool(_T("Threaded Video"));
|
//threaded = Options.AsBool(_T("Threaded Video"));
|
||||||
|
threaded = false;
|
||||||
threadLocked = false;
|
threadLocked = false;
|
||||||
threadNextFrame = -1;
|
threadNextFrame = -1;
|
||||||
}
|
}
|
||||||
|
@ -182,6 +183,7 @@ void VideoContext::Reset() {
|
||||||
overKeyFramesLoaded = false;
|
overKeyFramesLoaded = false;
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
nextFrame = -1;
|
nextFrame = -1;
|
||||||
|
curLine = NULL;
|
||||||
|
|
||||||
// Update displays
|
// Update displays
|
||||||
UpdateDisplays(true);
|
UpdateDisplays(true);
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "video_slider.h"
|
#include "video_slider.h"
|
||||||
#include "video_box.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);
|
glOrtho(0.0f,sw,sh,0.0f,-1000.0f,1000.0f);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
if (glGetError()) throw _T("Error setting up matrices (wtf?).");
|
if (glGetError()) throw _T("Error setting up matrices (wtf?).");
|
||||||
|
glShadeModel(GL_FLAT);
|
||||||
|
|
||||||
// Texture mode
|
// Texture mode
|
||||||
if (w != pw || h != ph) {
|
if (w != pw || h != ph) {
|
||||||
|
@ -267,6 +269,10 @@ void VideoDisplay::Render() {
|
||||||
glVertex2f(sw,0);
|
glVertex2f(sw,0);
|
||||||
glEnd();
|
glEnd();
|
||||||
context->SetShader(false);
|
context->SetShader(false);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
// TV effects
|
||||||
|
DrawTVEffects();
|
||||||
|
|
||||||
// Draw overlay
|
// Draw overlay
|
||||||
wxASSERT(visual);
|
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
|
// Update size
|
||||||
void VideoDisplay::UpdateSize() {
|
void VideoDisplay::UpdateSize() {
|
||||||
|
|
|
@ -72,6 +72,9 @@ private:
|
||||||
int dx1,dx2,dy1,dy2;
|
int dx1,dx2,dy1,dy2;
|
||||||
bool locked;
|
bool locked;
|
||||||
|
|
||||||
|
void DrawTVEffects();
|
||||||
|
void DrawOverscanMask(int sizeH,int sizeV,wxColour color,double alpha=0.5);
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnKey(wxKeyEvent &event);
|
void OnKey(wxKeyEvent &event);
|
||||||
void OnMouseEvent(wxMouseEvent& event);
|
void OnMouseEvent(wxMouseEvent& event);
|
||||||
|
|
Loading…
Reference in a new issue