Fix to video loading, but probably only for me...

Originally committed to SVN as r885.
This commit is contained in:
Rodrigo Braz Monteiro 2007-01-23 20:50:41 +00:00
parent 83cdb12457
commit 19ea57a544
4 changed files with 21 additions and 7 deletions

View File

@ -123,7 +123,9 @@ VideoContext::~VideoContext () {
////////////////
// Get Instance
VideoContext *VideoContext::Get() {
if (!instance) instance = new VideoContext;
if (!instance) {
instance = new VideoContext;
}
return instance;
}
@ -277,8 +279,8 @@ void VideoContext::SetVideo(const wxString &filename) {
Options.AddToRecentList(filename,_T("Recent vid"));
// Get frame
UpdateDisplays(true);
frame_n = 0;
//UpdateDisplays(true);
Refresh(true,true);
}

View File

@ -36,7 +36,7 @@
////////////
// Includes
#include "setup.h"
#include <wx/glcanvas.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <wx/image.h>
@ -78,8 +78,8 @@ enum {
// Event table
BEGIN_EVENT_TABLE(VideoDisplay, wxGLCanvas)
EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent)
EVT_KEY_DOWN(VideoDisplay::OnKey)
EVT_LEAVE_WINDOW(VideoDisplay::OnMouseLeave)
EVT_KEY_DOWN(VideoDisplay::OnKey)
EVT_PAINT(VideoDisplay::OnPaint)
EVT_SIZE(VideoDisplay::OnSizeEvent)
EVT_ERASE_BACKGROUND(VideoDisplay::OnEraseBackground)
@ -100,8 +100,11 @@ VideoDisplay::VideoDisplay(wxWindow* parent, wxWindowID id, const wxPoint& pos,
: wxGLCanvas (parent, id, attribList, pos, size, style, name)
{
// Set options
locked = false;
ControlSlider = NULL;
PositionDisplay = NULL;
w=h=dx2=dy2=8;
dx1=dy1=0;
origSize = size;
zoomValue = 1.0;
freeSize = false;
@ -242,12 +245,15 @@ void VideoDisplay::UpdateSize() {
// Loaded?
VideoContext *con = VideoContext::Get();
if (!con->IsLoaded()) return;
if (!IsShownOnScreen()) return;
// Get size
if (con->GetAspectRatioType() == 0) w = con->GetWidth() * zoomValue;
else w = con->GetHeight() * zoomValue * con->GetAspectRatioValue();
h = con->GetHeight() * zoomValue;
int _w,_h;
if (w <= 1 || h <= 1) return;
locked = true;
// Set the size for this control
SetSizeHints(w,h,w,h);
@ -261,6 +267,7 @@ void VideoDisplay::UpdateSize() {
SetClientSize(w,h);
// Refresh
locked = false;
Refresh(false);
}
@ -288,13 +295,17 @@ void VideoDisplay::OnPaint(wxPaintEvent& event) {
//////////////
// Size Event
void VideoDisplay::OnSizeEvent(wxSizeEvent &event) {
Refresh(false);
//Refresh(false);
event.Skip();
}
///////////////
// Mouse stuff
void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
// Locked?
if (locked) return;
// Disable when playing
if (VideoContext::Get()->IsPlaying()) return;
@ -339,7 +350,7 @@ void VideoDisplay::OnKey(wxKeyEvent &event) {
void VideoDisplay::OnMouseLeave(wxMouseEvent& event) {
if (VideoContext::Get()->IsPlaying()) return;
visual->OnMouseEvent(event);
tracker->bTrackerEditing = 0;
if (tracker) tracker->bTrackerEditing = 0;
}

View File

@ -70,6 +70,7 @@ private:
wxSize origSize;
int w,h;
int dx1,dx2,dy1,dy2;
bool locked;
void OnPaint(wxPaintEvent& event);
void OnKey(wxKeyEvent &event);

View File

@ -756,7 +756,7 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
SubtitlesGrid *grid = VideoContext::Get()->grid;
bool hasOverlay = false;
bool realTime = Options.AsBool(_T("Video Visual Realtime"));
parent->tracker->OnMouseEvent(event);
if (parent->tracker) parent->tracker->OnMouseEvent(event);
// Text of current coords
int vx = (sw * x + w/2) / w;