2007-01-08 22:11:06 +01:00
|
|
|
// Copyright (c) 2005-2007, Rodrigo Braz Monteiro
|
2006-01-16 22:02:54 +01:00
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// AEGISUB
|
|
|
|
//
|
|
|
|
// Website: http://aegisub.cellosoft.com
|
|
|
|
// Contact: mailto:zeratul@cellosoft.com
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
////////////
|
|
|
|
// Includes
|
2006-12-23 04:55:00 +01:00
|
|
|
#include "setup.h"
|
2007-01-06 22:07:51 +01:00
|
|
|
#include <wx/image.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <wx/clipbrd.h>
|
|
|
|
#include <wx/filename.h>
|
|
|
|
#include <wx/config.h>
|
2007-01-21 07:30:19 +01:00
|
|
|
#include <GL/glu.h>
|
2007-01-06 22:07:51 +01:00
|
|
|
#include "utils.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "video_display.h"
|
2007-01-08 22:11:06 +01:00
|
|
|
#include "video_display_visual.h"
|
2006-02-24 09:30:08 +01:00
|
|
|
#include "video_provider.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "vfr.h"
|
|
|
|
#include "ass_file.h"
|
|
|
|
#include "ass_time.h"
|
|
|
|
#include "ass_dialogue.h"
|
2007-01-08 22:11:06 +01:00
|
|
|
#include "ass_style.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "subs_grid.h"
|
|
|
|
#include "vfw_wrap.h"
|
2006-02-23 02:44:48 +01:00
|
|
|
#include "mkv_wrap.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "options.h"
|
|
|
|
#include "subs_edit_box.h"
|
|
|
|
#include "audio_display.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "video_slider.h"
|
2007-01-11 04:53:20 +01:00
|
|
|
#include "video_box.h"
|
2007-01-21 07:30:19 +01:00
|
|
|
#include "video_display_fextracker.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
///////
|
|
|
|
// IDs
|
|
|
|
enum {
|
|
|
|
VIDEO_MENU_COPY_TO_CLIPBOARD = 1230,
|
|
|
|
VIDEO_MENU_COPY_COORDS,
|
|
|
|
VIDEO_MENU_SAVE_SNAPSHOT,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
// Event table
|
2007-01-21 07:30:19 +01:00
|
|
|
BEGIN_EVENT_TABLE(VideoDisplay, wxGLCanvas)
|
|
|
|
EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent)
|
2007-01-09 02:52:30 +01:00
|
|
|
EVT_KEY_DOWN(VideoDisplay::OnKey)
|
2006-01-16 22:02:54 +01:00
|
|
|
EVT_LEAVE_WINDOW(VideoDisplay::OnMouseLeave)
|
2007-01-21 07:30:19 +01:00
|
|
|
EVT_PAINT(VideoDisplay::OnPaint)
|
|
|
|
EVT_ERASE_BACKGROUND(VideoDisplay::OnEraseBackground)
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
EVT_MENU(VIDEO_MENU_COPY_TO_CLIPBOARD,VideoDisplay::OnCopyToClipboard)
|
|
|
|
EVT_MENU(VIDEO_MENU_SAVE_SNAPSHOT,VideoDisplay::OnSaveSnapshot)
|
|
|
|
EVT_MENU(VIDEO_MENU_COPY_COORDS,VideoDisplay::OnCopyCoords)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
// Constructor
|
|
|
|
VideoDisplay::VideoDisplay(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
2007-01-21 07:30:19 +01:00
|
|
|
: wxGLCanvas (parent, id, NULL, pos, size, style, name)
|
2006-01-16 22:02:54 +01:00
|
|
|
{
|
2007-01-21 07:30:19 +01:00
|
|
|
// Set options
|
2006-01-16 22:02:54 +01:00
|
|
|
ControlSlider = NULL;
|
|
|
|
PositionDisplay = NULL;
|
|
|
|
origSize = size;
|
|
|
|
arType = 0;
|
2007-01-21 07:30:19 +01:00
|
|
|
arValue = 1.0;
|
|
|
|
zoomValue = 1.0;
|
2007-01-08 22:11:06 +01:00
|
|
|
visual = new VideoDisplayVisual(this);
|
2007-01-21 07:30:19 +01:00
|
|
|
tracker = NULL;
|
|
|
|
#if USE_FEXTRACKER == 1
|
|
|
|
tracker = new VideoDisplayFexTracker(this);
|
|
|
|
#endif
|
|
|
|
SetCursor(wxNullCursor);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//////////////
|
|
|
|
// Destructor
|
|
|
|
VideoDisplay::~VideoDisplay () {
|
2007-01-08 22:11:06 +01:00
|
|
|
delete visual;
|
2007-01-21 07:30:19 +01:00
|
|
|
#if USE_FEXTRACKER == 1
|
|
|
|
delete tracker;
|
|
|
|
#endif
|
|
|
|
VideoContext::Get()->RemoveDisplay(this);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
//////////
|
|
|
|
// Render
|
|
|
|
void VideoDisplay::Render() {
|
|
|
|
// Is shown?
|
|
|
|
if (!GetParent()->IsShown()) return;
|
|
|
|
|
|
|
|
// Set GL context
|
|
|
|
VideoContext *context = VideoContext::Get();
|
|
|
|
SetCurrent(*context->GetGLContext(this));
|
|
|
|
|
|
|
|
// Get sizes
|
|
|
|
int w,h,sw,sh,pw,ph;
|
|
|
|
GetClientSize(&w,&h);
|
|
|
|
context->GetScriptSize(sw,sh);
|
|
|
|
pw = context->GetWidth();
|
|
|
|
ph = context->GetHeight();
|
|
|
|
|
|
|
|
// Set viewport
|
|
|
|
glEnable(GL_TEXTURE_2D);
|
|
|
|
glMatrixMode(GL_PROJECTION);
|
|
|
|
glLoadIdentity();
|
|
|
|
glViewport(0,0,w,h);
|
|
|
|
glOrtho(0.0f,sw,sh,0.0f,-1000.0f,1000.0f);
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
|
|
|
|
|
// Texture mode
|
|
|
|
if (w != pw || h != ph) {
|
|
|
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
// Texture coordinates
|
|
|
|
float top = 0.0f;
|
|
|
|
float bot = context->GetTexH();
|
|
|
|
if (context->IsInverted()) {
|
|
|
|
top = context->GetTexH();
|
|
|
|
bot = 0.0f;
|
|
|
|
}
|
|
|
|
float left = 0.0;
|
|
|
|
float right = context->GetTexW();
|
|
|
|
|
|
|
|
// Draw interleaved frame or luma of YV12
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
glColor4f(1.0f,1.0f,1.0f,1.0f);
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
// Top-left
|
|
|
|
glTexCoord2f(left,top);
|
|
|
|
glVertex2f(0,0);
|
|
|
|
// Top-right
|
|
|
|
glTexCoord2f(right,top);
|
|
|
|
glVertex2f(sw,0);
|
|
|
|
// Bottom-right
|
|
|
|
glTexCoord2f(right,bot);
|
|
|
|
glVertex2f(sw,sh);
|
|
|
|
// Bottom-left
|
|
|
|
glTexCoord2f(left,bot);
|
|
|
|
glVertex2f(0,sh);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
// Draw UV planes
|
|
|
|
if (context->GetFormat() == FORMAT_YV12) {
|
2006-04-19 23:55:02 +02:00
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
}
|
2007-01-02 21:07:52 +01:00
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
// Draw overlay
|
|
|
|
visual->DrawOverlay();
|
2007-01-02 21:07:52 +01:00
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
// Swap buffers
|
|
|
|
SwapBuffers();
|
2007-01-02 21:07:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
///////////////
|
|
|
|
// Update size
|
|
|
|
void VideoDisplay::UpdateSize() {
|
2007-01-22 00:16:03 +01:00
|
|
|
// Loaded?
|
2007-01-22 00:26:49 +01:00
|
|
|
if (!VideoContext::Get()->IsLoaded()) return;
|
2007-01-22 00:16:03 +01:00
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
// Get size
|
|
|
|
if (arType == 0) w = VideoContext::Get()->GetWidth() * zoomValue;
|
|
|
|
else w = VideoContext::Get()->GetHeight() * zoomValue * arValue;
|
|
|
|
h = VideoContext::Get()->GetHeight() * zoomValue;
|
|
|
|
int _w,_h;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
// Set the size for this control
|
|
|
|
SetSizeHints(w,h,w,h);
|
|
|
|
SetClientSize(w,h);
|
|
|
|
GetSize(&_w,&_h);
|
|
|
|
SetSizeHints(_w,_h,_w,_h);
|
|
|
|
box->VideoSizer->Fit(box);
|
|
|
|
|
|
|
|
// Layout
|
|
|
|
box->GetParent()->Layout();
|
|
|
|
SetClientSize(w,h);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
// Refresh
|
|
|
|
Refresh(false);
|
2006-01-22 13:44:53 +01:00
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
//////////
|
|
|
|
// Resets
|
|
|
|
void VideoDisplay::Reset() {
|
|
|
|
int w = origSize.GetX();
|
|
|
|
int h = origSize.GetY();
|
|
|
|
SetClientSize(w,h);
|
|
|
|
int _w,_h;
|
|
|
|
GetSize(&_w,&_h);
|
|
|
|
SetSizeHints(_w,_h,_w,_h);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////
|
|
|
|
// OnPaint event
|
|
|
|
void VideoDisplay::OnPaint(wxPaintEvent& event) {
|
|
|
|
wxPaintDC dc(this);
|
|
|
|
|
|
|
|
// Draw frame
|
2007-01-21 07:30:19 +01:00
|
|
|
Render();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
// Mouse stuff
|
|
|
|
void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
|
|
|
// Disable when playing
|
2007-01-21 07:30:19 +01:00
|
|
|
if (VideoContext::Get()->IsPlaying()) return;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-02-01 23:15:21 +01:00
|
|
|
if (event.Leaving()) {
|
|
|
|
// OnMouseLeave isn't called as long as we have an OnMouseEvent
|
|
|
|
// Just check for it and call it manually instead
|
|
|
|
OnMouseLeave(event);
|
|
|
|
event.Skip(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// Right click
|
|
|
|
if (event.ButtonUp(wxMOUSE_BTN_RIGHT)) {
|
|
|
|
wxMenu menu;
|
|
|
|
menu.Append(VIDEO_MENU_SAVE_SNAPSHOT,_("Save PNG snapshot"));
|
|
|
|
menu.Append(VIDEO_MENU_COPY_TO_CLIPBOARD,_("Copy image to Clipboard"));
|
|
|
|
menu.Append(VIDEO_MENU_COPY_COORDS,_("Copy coordinates to Clipboard"));
|
|
|
|
PopupMenu(&menu);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-01-09 02:52:30 +01:00
|
|
|
// Click?
|
|
|
|
if (event.ButtonDown(wxMOUSE_BTN_ANY)) {
|
|
|
|
SetFocus();
|
|
|
|
}
|
|
|
|
|
2007-01-08 22:11:06 +01:00
|
|
|
// Send to visual
|
|
|
|
visual->OnMouseEvent(event);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-09 02:52:30 +01:00
|
|
|
/////////////
|
|
|
|
// Key event
|
|
|
|
void VideoDisplay::OnKey(wxKeyEvent &event) {
|
|
|
|
visual->OnKeyEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
//////////////////////
|
|
|
|
// Mouse left display
|
|
|
|
void VideoDisplay::OnMouseLeave(wxMouseEvent& event) {
|
2007-01-21 07:30:19 +01:00
|
|
|
if (VideoContext::Get()->IsPlaying()) return;
|
|
|
|
visual->OnMouseEvent(event);
|
|
|
|
tracker->bTrackerEditing = 0;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////
|
|
|
|
// Sets zoom level
|
|
|
|
void VideoDisplay::SetZoom(double value) {
|
2006-02-19 03:31:25 +01:00
|
|
|
zoomValue = value;
|
2007-01-21 07:30:19 +01:00
|
|
|
UpdateSize();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
// Sets zoom position
|
|
|
|
void VideoDisplay::SetZoomPos(int value) {
|
|
|
|
if (value < 0) value = 0;
|
|
|
|
if (value > 15) value = 15;
|
|
|
|
SetZoom(double(value+1)/8.0);
|
|
|
|
if (zoomBox->GetSelection() != value) zoomBox->SetSelection(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-24 09:43:44 +01:00
|
|
|
//////////////////////////
|
|
|
|
// Calculate aspect ratio
|
|
|
|
double VideoDisplay::GetARFromType(int type) {
|
2007-01-21 07:30:19 +01:00
|
|
|
if (type == 0) return (double)VideoContext::Get()->GetWidth()/(double)VideoContext::Get()->GetHeight();
|
2006-02-24 09:43:44 +01:00
|
|
|
if (type == 1) return 4.0/3.0;
|
|
|
|
if (type == 2) return 16.0/9.0;
|
2006-05-16 01:44:53 +02:00
|
|
|
if (type == 3) return 2.35;
|
|
|
|
return 1.0; //error
|
2006-02-24 09:43:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////
|
|
|
|
// Sets aspect ratio
|
2006-05-16 01:44:53 +02:00
|
|
|
void VideoDisplay::SetAspectRatio(int _type, double value) {
|
2007-01-21 07:30:19 +01:00
|
|
|
// Get value
|
|
|
|
if (_type != 4) value = GetARFromType(_type);
|
|
|
|
if (value < 0.5) value = 0.5;
|
|
|
|
if (value > 5.0) value = 5.0;
|
|
|
|
|
|
|
|
// Set
|
|
|
|
arType = _type;
|
|
|
|
arValue = value;
|
|
|
|
UpdateSize();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////
|
|
|
|
// Updates position display
|
|
|
|
void VideoDisplay::UpdatePositionDisplay() {
|
|
|
|
// Update position display control
|
|
|
|
if (!PositionDisplay) {
|
|
|
|
throw _T("Position Display not set!");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get time
|
2007-01-21 07:30:19 +01:00
|
|
|
int frame_n = VideoContext::Get()->GetFrameN();
|
2006-02-25 00:07:30 +01:00
|
|
|
int time = VFR_Output.GetTimeAtFrame(frame_n,true,true);
|
2006-01-16 22:02:54 +01:00
|
|
|
int temp = time;
|
|
|
|
int h=0, m=0, s=0, ms=0;
|
|
|
|
while (temp >= 3600000) {
|
|
|
|
temp -= 3600000;
|
|
|
|
h++;
|
|
|
|
}
|
|
|
|
while (temp >= 60000) {
|
|
|
|
temp -= 60000;
|
|
|
|
m++;
|
|
|
|
}
|
|
|
|
while (temp >= 1000) {
|
|
|
|
temp -= 1000;
|
|
|
|
s++;
|
|
|
|
}
|
|
|
|
ms = temp;
|
|
|
|
|
|
|
|
// Position display update
|
|
|
|
PositionDisplay->SetValue(wxString::Format(_T("%01i:%02i:%02i.%03i - %i"),h,m,s,ms,frame_n));
|
2007-01-21 07:30:19 +01:00
|
|
|
if (VideoContext::Get()->GetKeyFrames().Index(frame_n) != wxNOT_FOUND) {
|
2006-01-16 22:02:54 +01:00
|
|
|
PositionDisplay->SetBackgroundColour(Options.AsColour(_T("Grid selection background")));
|
|
|
|
PositionDisplay->SetForegroundColour(Options.AsColour(_T("Grid selection foreground")));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
PositionDisplay->SetBackgroundColour(wxNullColour);
|
|
|
|
PositionDisplay->SetForegroundColour(wxNullColour);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Subs position display update
|
|
|
|
UpdateSubsRelativeTime();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////
|
|
|
|
// Updates box with subs position relative to frame
|
|
|
|
void VideoDisplay::UpdateSubsRelativeTime() {
|
|
|
|
// Set variables
|
|
|
|
wxString startSign;
|
|
|
|
wxString endSign;
|
|
|
|
int startOff,endOff;
|
2007-01-21 07:30:19 +01:00
|
|
|
int frame_n = VideoContext::Get()->GetFrameN();
|
|
|
|
AssDialogue *curLine = VideoContext::Get()->curLine;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Set start/end
|
|
|
|
if (curLine) {
|
2006-02-25 00:07:30 +01:00
|
|
|
int time = VFR_Output.GetTimeAtFrame(frame_n,true,true);
|
2006-01-16 22:02:54 +01:00
|
|
|
startOff = time - curLine->Start.GetMS();
|
|
|
|
endOff = time - curLine->End.GetMS();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fallback to zero
|
|
|
|
else {
|
|
|
|
startOff = 0;
|
|
|
|
endOff = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Positive signs
|
|
|
|
if (startOff > 0) startSign = _T("+");
|
|
|
|
if (endOff > 0) endSign = _T("+");
|
|
|
|
|
|
|
|
// Update line
|
|
|
|
SubsPosition->SetValue(wxString::Format(_T("%s%ims; %s%ims"),startSign.c_str(),startOff,endSign.c_str(),endOff));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////
|
|
|
|
// Copy to clipboard
|
|
|
|
void VideoDisplay::OnCopyToClipboard(wxCommandEvent &event) {
|
|
|
|
if (wxTheClipboard->Open()) {
|
2007-01-21 07:30:19 +01:00
|
|
|
wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(VideoContext::Get()->GetFrame(-1).GetImage(),24)));
|
2006-01-16 22:02:54 +01:00
|
|
|
wxTheClipboard->Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////
|
|
|
|
// Save snapshot
|
|
|
|
void VideoDisplay::OnSaveSnapshot(wxCommandEvent &event) {
|
2007-01-21 07:30:19 +01:00
|
|
|
VideoContext::Get()->SaveSnapshot();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////
|
|
|
|
// Copy coordinates
|
|
|
|
void VideoDisplay::OnCopyCoords(wxCommandEvent &event) {
|
|
|
|
if (wxTheClipboard->Open()) {
|
|
|
|
int sw,sh;
|
2007-01-21 07:30:19 +01:00
|
|
|
VideoContext::Get()->GetScriptSize(sw,sh);
|
2007-01-10 22:01:47 +01:00
|
|
|
int vx = (sw * visual->mouseX + w/2) / w;
|
|
|
|
int vy = (sh * visual->mouseY + h/2) / h;
|
2006-01-16 22:02:54 +01:00
|
|
|
wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%i,%i"),vx,vy)));
|
|
|
|
wxTheClipboard->Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-28 20:48:35 +01:00
|
|
|
//////////////////
|
|
|
|
// DrawVideoWithOverlay
|
|
|
|
void VideoDisplay::DrawText( wxPoint Pos, wxString text ) {
|
2007-01-21 07:30:19 +01:00
|
|
|
//// Draw frame
|
|
|
|
//wxClientDC dc(this);
|
|
|
|
//dc.SetBrush(wxBrush(wxColour(128,128,128),wxSOLID));
|
|
|
|
//dc.DrawRectangle( 0,0, provider->GetWidth(), provider->GetHeight() );
|
|
|
|
//dc.SetTextForeground(wxColour(64,64,64));
|
|
|
|
//dc.DrawText(text,Pos.x+1,Pos.y-1);
|
|
|
|
//dc.DrawText(text,Pos.x+1,Pos.y+1);
|
|
|
|
//dc.DrawText(text,Pos.x-1,Pos.y-1);
|
|
|
|
//dc.DrawText(text,Pos.x-1,Pos.y+1);
|
|
|
|
//dc.SetTextForeground(wxColour(255,255,255));
|
|
|
|
//dc.DrawText(text,Pos.x,Pos.y);
|
2006-12-18 05:53:40 +01:00
|
|
|
}
|
|
|
|
|