mirror of https://github.com/odrling/Aegisub
Early operation visual typesetting.
Originally committed to SVN as r746.
This commit is contained in:
parent
6ea8475941
commit
d0c0e2a318
|
@ -69,6 +69,7 @@ aegisub_SOURCES = \
|
||||||
export_clean_info.cpp \
|
export_clean_info.cpp \
|
||||||
export_fixstyle.cpp \
|
export_fixstyle.cpp \
|
||||||
export_framerate.cpp \
|
export_framerate.cpp \
|
||||||
|
export_visible_lines.cpp \
|
||||||
fft.cpp \
|
fft.cpp \
|
||||||
frame_main.cpp \
|
frame_main.cpp \
|
||||||
frame_main_events.cpp \
|
frame_main_events.cpp \
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
AssExportFilter::AssExportFilter() {
|
AssExportFilter::AssExportFilter() {
|
||||||
|
hidden = false;
|
||||||
autoExporter = false;
|
autoExporter = false;
|
||||||
initialized = false;
|
initialized = false;
|
||||||
FilterList *fil = AssExportFilterChain::GetUnpreparedFilterList();
|
FilterList *fil = AssExportFilterChain::GetUnpreparedFilterList();
|
||||||
|
|
|
@ -87,6 +87,7 @@ private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool autoExporter;
|
bool autoExporter;
|
||||||
|
bool hidden;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
wxString description;
|
wxString description;
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ wxArrayString AssExporter::GetAllFilterNames() {
|
||||||
FilterList::iterator begin = AssExportFilterChain::GetFilterList()->begin();
|
FilterList::iterator begin = AssExportFilterChain::GetFilterList()->begin();
|
||||||
FilterList::iterator end = AssExportFilterChain::GetFilterList()->end();
|
FilterList::iterator end = AssExportFilterChain::GetFilterList()->end();
|
||||||
for (FilterList::iterator cur=begin;cur!=end;cur++) {
|
for (FilterList::iterator cur=begin;cur!=end;cur++) {
|
||||||
names.Add((*cur)->RegisterName);
|
if (!(*cur)->hidden) names.Add((*cur)->RegisterName);
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,7 @@ Please visit http://aegisub.net to download latest version
|
||||||
- Plain-text export (jfs)
|
- Plain-text export (jfs)
|
||||||
- The style of the current line is automatically selected when opening the Style Manager (jfs)
|
- The style of the current line is automatically selected when opening the Style Manager (jfs)
|
||||||
- Added long-missing Edit buttons in Style Manager (jfs)
|
- Added long-missing Edit buttons in Style Manager (jfs)
|
||||||
- Various fixes to better handle paths/file names with non-ANSI characters on Windows (jfs)
|
- Various fixes to better handle paths/file names with non-ANSI characters on Windows (jfs/AMZ)
|
||||||
o Note that this (unfortunately) doesn't affect video/audio loading, since those still depend on Avisynth, which doesn't support Unicode at all
|
|
||||||
- Video display fixed on Linux and maybe also Mac (Azzy)
|
- Video display fixed on Linux and maybe also Mac (Azzy)
|
||||||
- Misc. fixes for building on Linux (Azzy)
|
- Misc. fixes for building on Linux (Azzy)
|
||||||
- libass support for subtitles on UNIX (Azzy)
|
- libass support for subtitles on UNIX (Azzy)
|
||||||
|
|
|
@ -128,6 +128,7 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetInt(_T("Video Default Zoom"), 7);
|
SetInt(_T("Video Default Zoom"), 7);
|
||||||
SetInt(_T("Video Fast Jump Step"), 10);
|
SetInt(_T("Video Fast Jump Step"), 10);
|
||||||
SetText(_T("Video Screenshot Path"),_T("?video"));
|
SetText(_T("Video Screenshot Path"),_T("?video"));
|
||||||
|
SetBool(_T("Video Visual Realtime"),false);
|
||||||
SetModificationType(MOD_VIDEO);
|
SetModificationType(MOD_VIDEO);
|
||||||
SetBool(_T("Show keyframes on video slider"),true);
|
SetBool(_T("Show keyframes on video slider"),true);
|
||||||
|
|
||||||
|
|
|
@ -185,6 +185,8 @@ wxArrayString HunspellSpellChecker::GetLanguageList() {
|
||||||
// Get dir name
|
// Get dir name
|
||||||
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),AegisubApp::folderName) + _T("/");
|
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),AegisubApp::folderName) + _T("/");
|
||||||
wxArrayString list;
|
wxArrayString list;
|
||||||
|
wxFileName folder(path);
|
||||||
|
if (!folder.DirExists()) return list;
|
||||||
|
|
||||||
// Get file lists
|
// Get file lists
|
||||||
wxArrayString dic;
|
wxArrayString dic;
|
||||||
|
|
|
@ -932,7 +932,7 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
||||||
bool isPos = false;
|
bool isPos = false;
|
||||||
bool isFlag = false;
|
bool isFlag = false;
|
||||||
bool state = false;
|
bool state = false;
|
||||||
AssStyle *style = AssFile::top->GetStyle(grid->GetDialogue(linen)->Style);
|
AssStyle *style = grid->ass->GetStyle(grid->GetDialogue(linen)->Style);
|
||||||
AssStyle defStyle;
|
AssStyle defStyle;
|
||||||
if (style == NULL) style = &defStyle;
|
if (style == NULL) style = &defStyle;
|
||||||
if (tagname == _T("\\b")) {
|
if (tagname == _T("\\b")) {
|
||||||
|
|
|
@ -96,6 +96,8 @@ wxArrayString MySpellThesaurus::GetLanguageList() {
|
||||||
// Get dir name
|
// Get dir name
|
||||||
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),AegisubApp::folderName) + _T("/");
|
wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),AegisubApp::folderName) + _T("/");
|
||||||
wxArrayString list;
|
wxArrayString list;
|
||||||
|
wxFileName folder(path);
|
||||||
|
if (!folder.DirExists()) return list;
|
||||||
|
|
||||||
// Get file lists
|
// Get file lists
|
||||||
wxArrayString idx;
|
wxArrayString idx;
|
||||||
|
|
|
@ -80,6 +80,7 @@ enum {
|
||||||
// Event table
|
// Event table
|
||||||
BEGIN_EVENT_TABLE(VideoDisplay, wxWindow)
|
BEGIN_EVENT_TABLE(VideoDisplay, wxWindow)
|
||||||
EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent)
|
EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent)
|
||||||
|
EVT_KEY_DOWN(VideoDisplay::OnKey)
|
||||||
EVT_LEAVE_WINDOW(VideoDisplay::OnMouseLeave)
|
EVT_LEAVE_WINDOW(VideoDisplay::OnMouseLeave)
|
||||||
EVT_PAINT(VideoDisplay::OnPaint)
|
EVT_PAINT(VideoDisplay::OnPaint)
|
||||||
|
|
||||||
|
@ -112,16 +113,6 @@ VideoDisplay::VideoDisplay(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
||||||
nextFrame = -1;
|
nextFrame = -1;
|
||||||
zoomValue = 0.5;
|
zoomValue = 0.5;
|
||||||
visual = new VideoDisplayVisual(this);
|
visual = new VideoDisplayVisual(this);
|
||||||
|
|
||||||
// Set cursor
|
|
||||||
// Bleeeh! Hate this 'solution':
|
|
||||||
#if __WXGTK__
|
|
||||||
static char cursor_image[] = {0};
|
|
||||||
wxCursor cursor(cursor_image, 8, 1, -1, -1, cursor_image);
|
|
||||||
#else
|
|
||||||
wxCursor cursor(wxCURSOR_BLANK);
|
|
||||||
#endif // __WXGTK__
|
|
||||||
SetCursor(cursor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -316,11 +307,24 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Click?
|
||||||
|
if (event.ButtonDown(wxMOUSE_BTN_ANY)) {
|
||||||
|
SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
// Send to visual
|
// Send to visual
|
||||||
visual->OnMouseEvent(event);
|
visual->OnMouseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////
|
||||||
|
// Key event
|
||||||
|
void VideoDisplay::OnKey(wxKeyEvent &event) {
|
||||||
|
visual->OnKeyEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
// Mouse left display
|
// Mouse left display
|
||||||
void VideoDisplay::OnMouseLeave(wxMouseEvent& event) {
|
void VideoDisplay::OnMouseLeave(wxMouseEvent& event) {
|
||||||
|
|
|
@ -95,6 +95,7 @@ private:
|
||||||
void SaveSnapshot();
|
void SaveSnapshot();
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
|
void OnKey(wxKeyEvent &event);
|
||||||
void OnMouseEvent(wxMouseEvent& event);
|
void OnMouseEvent(wxMouseEvent& event);
|
||||||
void OnMouseLeave(wxMouseEvent& event);
|
void OnMouseLeave(wxMouseEvent& event);
|
||||||
void OnCopyToClipboard(wxCommandEvent &event);
|
void OnCopyToClipboard(wxCommandEvent &event);
|
||||||
|
|
|
@ -47,10 +47,12 @@
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_time.h"
|
#include "ass_time.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
|
#include "ass_override.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
|
#include "export_visible_lines.h"
|
||||||
#if USE_FEXTRACKER == 1
|
#if USE_FEXTRACKER == 1
|
||||||
#include "../FexTrackerSource/FexTracker.h"
|
#include "../FexTrackerSource/FexTracker.h"
|
||||||
#include "../FexTrackerSource/FexTrackingFeature.h"
|
#include "../FexTrackerSource/FexTrackingFeature.h"
|
||||||
|
@ -63,7 +65,10 @@
|
||||||
VideoDisplayVisual::VideoDisplayVisual(VideoDisplay *par) {
|
VideoDisplayVisual::VideoDisplayVisual(VideoDisplay *par) {
|
||||||
parent = par;
|
parent = par;
|
||||||
backbuffer = NULL;
|
backbuffer = NULL;
|
||||||
|
curSelection = NULL;
|
||||||
holding = false;
|
holding = false;
|
||||||
|
mode = -1;
|
||||||
|
SetMode(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +79,31 @@ VideoDisplayVisual::~VideoDisplayVisual() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////
|
||||||
|
// Set mode
|
||||||
|
void VideoDisplayVisual::SetMode(int _mode) {
|
||||||
|
// Set mode
|
||||||
|
mode = _mode;
|
||||||
|
|
||||||
|
// Hide cursor
|
||||||
|
if (mode == 0) {
|
||||||
|
// Bleeeh! Hate this 'solution':
|
||||||
|
#if __WXGTK__
|
||||||
|
static char cursor_image[] = {0};
|
||||||
|
wxCursor cursor(cursor_image, 8, 1, -1, -1, cursor_image);
|
||||||
|
#else
|
||||||
|
wxCursor cursor(wxCURSOR_BLANK);
|
||||||
|
#endif // __WXGTK__
|
||||||
|
parent->SetCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show cursor
|
||||||
|
else {
|
||||||
|
parent->SetCursor(wxNullCursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
// Draw overlay
|
// Draw overlay
|
||||||
void VideoDisplayVisual::DrawOverlay() {
|
void VideoDisplayVisual::DrawOverlay() {
|
||||||
|
@ -83,6 +113,8 @@ void VideoDisplayVisual::DrawOverlay() {
|
||||||
int w = parent->w;
|
int w = parent->w;
|
||||||
int h = parent->h;
|
int h = parent->h;
|
||||||
int frame_n = parent->frame_n;
|
int frame_n = parent->frame_n;
|
||||||
|
int sw,sh;
|
||||||
|
parent->GetScriptSize(sw,sh);
|
||||||
|
|
||||||
// Create backbuffer if needed
|
// Create backbuffer if needed
|
||||||
bool needCreate = false;
|
bool needCreate = false;
|
||||||
|
@ -101,27 +133,58 @@ void VideoDisplayVisual::DrawOverlay() {
|
||||||
dc.DrawBitmap(parent->GetFrame(frame_n),0,0);
|
dc.DrawBitmap(parent->GetFrame(frame_n),0,0);
|
||||||
|
|
||||||
// Draw the control points for FexTracker
|
// Draw the control points for FexTracker
|
||||||
DrawTrackingOverlay( dc );
|
DrawTrackingOverlay(dc);
|
||||||
|
|
||||||
// Draw pivot points of visible lines
|
// Draw pivot points of visible lines
|
||||||
int numRows = parent->grid->GetRows();
|
if (mode == 1) {
|
||||||
int curMs = VFR_Output.GetTimeAtFrame(frame_n);
|
int numRows = parent->grid->GetRows();
|
||||||
AssDialogue *diag;
|
int startMs = VFR_Output.GetTimeAtFrame(frame_n,true);
|
||||||
dc.SetPen(wxPen(wxColour(255,0,0),1));
|
int endMs = VFR_Output.GetTimeAtFrame(frame_n,false);
|
||||||
for (int i=0;i<numRows;i++) {
|
AssDialogue *diag;
|
||||||
diag = parent->grid->GetDialogue(i);
|
dc.SetPen(wxPen(wxColour(255,0,0),1));
|
||||||
if (diag) {
|
|
||||||
if (diag->Start.GetMS() <= curMs && diag->End.GetMS() >= curMs) {
|
// For each line
|
||||||
int lineX,lineY;
|
for (int i=0;i<numRows;i++) {
|
||||||
GetLinePosition(diag,lineX,lineY);
|
diag = parent->grid->GetDialogue(i);
|
||||||
dc.DrawLine(lineX,lineY-5,lineX,lineY+5);
|
if (diag) {
|
||||||
dc.DrawLine(lineX-5,lineY,lineX+5,lineY);
|
// Draw?
|
||||||
|
bool draw = false;
|
||||||
|
int dx = -1;
|
||||||
|
int dy = -1;
|
||||||
|
|
||||||
|
// Selected line
|
||||||
|
if (diag == curSelection) {
|
||||||
|
draw = true;
|
||||||
|
dx = cur_x * w / sw;
|
||||||
|
dy = cur_y * h / sh;
|
||||||
|
dc.SetBrush(wxBrush(wxColour(255,255,255)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Line visible?
|
||||||
|
else if (diag->Start.GetMS() <= startMs && diag->End.GetMS() >= endMs) {
|
||||||
|
// Get position
|
||||||
|
GetLinePosition(diag,dx,dy);
|
||||||
|
dx = dx * w / sw;
|
||||||
|
dy = dy * h / sh;
|
||||||
|
|
||||||
|
// Mouse over?
|
||||||
|
if (x >= dx-5 && x <= dx+5 && y >= dy-5 && y <= dy+5) dc.SetBrush(wxBrush(wxColour(255,255,255)));
|
||||||
|
else dc.SetBrush(wxBrush(wxColour(255,255,0)));
|
||||||
|
draw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
if (draw) {
|
||||||
|
dc.DrawRectangle(dx-5,dy-5,11,11);
|
||||||
|
dc.DrawLine(dx,dy-10,dx,dy+10);
|
||||||
|
dc.DrawLine(dx-10,dy,dx+10,dy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current position info
|
// Current position info
|
||||||
if (x >= 0 && x < w && y >= 0 && y < h) {
|
if (mode == 0 && x >= 0 && x < w && y >= 0 && y < h) {
|
||||||
// Draw cross
|
// Draw cross
|
||||||
dc.SetPen(wxPen(wxColour(255,255,255),1));
|
dc.SetPen(wxPen(wxColour(255,255,255),1));
|
||||||
dc.SetLogicalFunction(wxINVERT);
|
dc.SetLogicalFunction(wxINVERT);
|
||||||
|
@ -165,6 +228,13 @@ void VideoDisplayVisual::DrawOverlay() {
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Get position of line
|
// Get position of line
|
||||||
void VideoDisplayVisual::GetLinePosition(AssDialogue *diag,int &x, int &y) {
|
void VideoDisplayVisual::GetLinePosition(AssDialogue *diag,int &x, int &y) {
|
||||||
|
// No dialogue
|
||||||
|
if (!diag) {
|
||||||
|
x = -1;
|
||||||
|
y = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Default values
|
// Default values
|
||||||
int margin[4];
|
int margin[4];
|
||||||
for (int i=0;i<4;i++) margin[i] = diag->Margin[i];
|
for (int i=0;i<4;i++) margin[i] = diag->Margin[i];
|
||||||
|
@ -188,8 +258,35 @@ void VideoDisplayVisual::GetLinePosition(AssDialogue *diag,int &x, int &y) {
|
||||||
margin[1] = sw - margin[1];
|
margin[1] = sw - margin[1];
|
||||||
margin[3] = sh - margin[3];
|
margin[3] = sh - margin[3];
|
||||||
|
|
||||||
|
// Position
|
||||||
|
int posx = -1;
|
||||||
|
int posy = -1;
|
||||||
|
|
||||||
// Overrides processing
|
// Overrides processing
|
||||||
// TODO
|
diag->ParseASSTags();
|
||||||
|
AssDialogueBlockOverride *override;
|
||||||
|
AssOverrideTag *tag;
|
||||||
|
size_t blockn = diag->Blocks.size();
|
||||||
|
for (size_t i=0;i<blockn;i++) {
|
||||||
|
override = AssDialogueBlock::GetAsOverride(diag->Blocks.at(i));
|
||||||
|
if (override) {
|
||||||
|
for (size_t j=0;j<override->Tags.size();j++) {
|
||||||
|
tag = override->Tags.at(j);
|
||||||
|
if ((tag->Name == _T("\\pos") || tag->Name == _("\\move")) && tag->Params.size() >= 2) {
|
||||||
|
posx = tag->Params[0]->AsInt();
|
||||||
|
posy = tag->Params[1]->AsInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diag->ClearBlocks();
|
||||||
|
|
||||||
|
// Got position
|
||||||
|
if (posx != -1) {
|
||||||
|
x = posx;
|
||||||
|
y = posy;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Alignment type
|
// Alignment type
|
||||||
int hor = (align - 1) % 3;
|
int hor = (align - 1) % 3;
|
||||||
|
@ -303,11 +400,16 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
|
||||||
int y = event.GetY();
|
int y = event.GetY();
|
||||||
int w = parent->w;
|
int w = parent->w;
|
||||||
int h = parent->h;
|
int h = parent->h;
|
||||||
|
int sw,sh;
|
||||||
|
parent->GetScriptSize(sw,sh);
|
||||||
int frame_n = parent->frame_n;
|
int frame_n = parent->frame_n;
|
||||||
VideoProvider *provider = parent->provider;
|
VideoProvider *provider = parent->provider;
|
||||||
SubtitlesGrid *grid = parent->grid;
|
SubtitlesGrid *grid = parent->grid;
|
||||||
|
bool hasOverlay = false;
|
||||||
|
bool realTime = Options.AsBool(_T("Video Visual Realtime"));
|
||||||
|
|
||||||
#if USE_FEXTRACKER == 1
|
// FexTracker
|
||||||
|
#if USE_FEXTRACKER == 1
|
||||||
if( event.ButtonDown(wxMOUSE_BTN_LEFT) ) {
|
if( event.ButtonDown(wxMOUSE_BTN_LEFT) ) {
|
||||||
parent->MouseDownX = x;
|
parent->MouseDownX = x;
|
||||||
parent->MouseDownY = y;
|
parent->MouseDownY = y;
|
||||||
|
@ -350,55 +452,103 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
|
||||||
parent->MouseDownY = y;
|
parent->MouseDownY = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Text of current coords
|
// Text of current coords
|
||||||
int sw,sh;
|
|
||||||
parent->GetScriptSize(sw,sh);
|
|
||||||
int vx = (sw * x + w/2) / w;
|
int vx = (sw * x + w/2) / w;
|
||||||
int vy = (sh * y + h/2) / h;
|
int vy = (sh * y + h/2) / h;
|
||||||
if (!event.ShiftDown()) mouseText = wxString::Format(_T("%i,%i"),vx,vy);
|
if (!event.ShiftDown()) mouseText = wxString::Format(_T("%i,%i"),vx,vy);
|
||||||
else mouseText = wxString::Format(_T("%i,%i"),vx - sw,vy - sh);
|
else mouseText = wxString::Format(_T("%i,%i"),vx - sw,vy - sh);
|
||||||
|
|
||||||
// Start dragging
|
// Start dragging
|
||||||
if (event.LeftIsDown() && !holding) {
|
if (mode == 1 && event.LeftIsDown() && !holding) {
|
||||||
holding = true;
|
// For each line
|
||||||
hold = 0;
|
int numRows = parent->grid->GetRows();
|
||||||
parent->CaptureMouse();
|
int startMs = VFR_Output.GetTimeAtFrame(frame_n,true);
|
||||||
|
int endMs = VFR_Output.GetTimeAtFrame(frame_n,false);
|
||||||
|
AssDialogue *diag;
|
||||||
|
AssDialogue *gotDiag = NULL;
|
||||||
|
for (int i=0;i<numRows;i++) {
|
||||||
|
diag = parent->grid->GetDialogue(i);
|
||||||
|
if (diag) {
|
||||||
|
// Line visible?
|
||||||
|
if (diag->Start.GetMS() <= startMs && diag->End.GetMS() >= endMs) {
|
||||||
|
// Get position
|
||||||
|
int lineX,lineY;
|
||||||
|
GetLinePosition(diag,lineX,lineY);
|
||||||
|
lineX = lineX * w / sw;
|
||||||
|
lineY = lineY * h / sh;
|
||||||
|
|
||||||
|
// Mouse over?
|
||||||
|
if (x >= lineX-5 && x <= lineX+5 && y >= lineY-5 && y <= lineY+5) {
|
||||||
|
gotDiag = diag;
|
||||||
|
orig_x = lineX;
|
||||||
|
orig_y = lineY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Got a line?
|
||||||
|
if (gotDiag) {
|
||||||
|
// Set dialogue
|
||||||
|
curSelection = gotDiag;
|
||||||
|
start_x = x;
|
||||||
|
start_y = y;
|
||||||
|
|
||||||
|
// Hold it
|
||||||
|
holding = true;
|
||||||
|
hold = 1;
|
||||||
|
parent->CaptureMouse();
|
||||||
|
hasOverlay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drag
|
// Drag
|
||||||
if (hold == 1) {
|
if (hold == 1) {
|
||||||
//grid->editBox->SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),vx,vy),0);
|
cur_x = (x - start_x + orig_x) * sw / w;
|
||||||
//grid->editBox->CommitText(true);
|
cur_y = (y - start_y + orig_y) * sh / h;
|
||||||
//grid->CommitChanges(false,true);
|
if (realTime) {
|
||||||
|
AssLimitToVisibleFilter::SetFrame(frame_n);
|
||||||
|
grid->editBox->SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),cur_x,cur_y),0);
|
||||||
|
grid->editBox->CommitText(true);
|
||||||
|
grid->CommitChanges(false,true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End dragging
|
// End dragging
|
||||||
if (holding && !event.LeftIsDown()) {
|
if (holding && !event.LeftIsDown()) {
|
||||||
|
// Disable limiting
|
||||||
|
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
||||||
|
|
||||||
// Finished dragging subtitles
|
// Finished dragging subtitles
|
||||||
if (hold == 1) {
|
if (hold == 1) {
|
||||||
|
grid->editBox->SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),cur_x,cur_y),0);
|
||||||
grid->editBox->CommitText();
|
grid->editBox->CommitText();
|
||||||
grid->ass->FlagAsModified();
|
grid->ass->FlagAsModified();
|
||||||
grid->CommitChanges(false,true);
|
grid->CommitChanges(false,true);
|
||||||
|
curSelection = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set flags
|
// Set flags
|
||||||
holding = false;
|
|
||||||
hold = 0;
|
hold = 0;
|
||||||
|
holding = false;
|
||||||
|
hasOverlay = true;
|
||||||
parent->ReleaseMouse();
|
parent->ReleaseMouse();
|
||||||
|
parent->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double click
|
// Double click
|
||||||
if (event.LeftDClick()) {
|
if (mode == 0 && event.LeftDClick()) {
|
||||||
grid->editBox->SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),vx,vy),0);
|
grid->editBox->SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),vx,vy),0);
|
||||||
grid->editBox->CommitText();
|
grid->editBox->CommitText();
|
||||||
grid->ass->FlagAsModified();
|
grid->ass->FlagAsModified();
|
||||||
grid->CommitChanges(false,true);
|
grid->CommitChanges(false,true);
|
||||||
|
parent->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hover
|
// Hover
|
||||||
bool hasOverlay = false;
|
|
||||||
if (x != mouse_x || y != mouse_y) {
|
if (x != mouse_x || y != mouse_y) {
|
||||||
// Set coords
|
// Set coords
|
||||||
mouse_x = x;
|
mouse_x = x;
|
||||||
|
@ -411,3 +561,11 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
|
||||||
DrawOverlay();
|
DrawOverlay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////
|
||||||
|
// Key event
|
||||||
|
void VideoDisplayVisual::OnKeyEvent(wxKeyEvent &event) {
|
||||||
|
if (event.GetKeyCode() == 'A') SetMode(0);
|
||||||
|
if (event.GetKeyCode() == 'S') SetMode(1);
|
||||||
|
}
|
||||||
|
|
|
@ -50,17 +50,26 @@ class VideoDisplayVisual {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mouse_x,mouse_y;
|
int mouse_x,mouse_y;
|
||||||
wxBitmap *backbuffer;
|
int start_x,start_y;
|
||||||
wxString mouseText;
|
int cur_x,cur_y;
|
||||||
|
int orig_x,orig_y;
|
||||||
|
|
||||||
|
int mode;
|
||||||
bool holding;
|
bool holding;
|
||||||
int hold;
|
int hold;
|
||||||
|
|
||||||
|
wxBitmap *backbuffer;
|
||||||
|
wxString mouseText;
|
||||||
|
AssDialogue *curSelection;
|
||||||
|
|
||||||
VideoDisplay *parent;
|
VideoDisplay *parent;
|
||||||
|
|
||||||
void GetLinePosition(AssDialogue *diag,int &x,int &y);
|
void GetLinePosition(AssDialogue *diag,int &x,int &y);
|
||||||
void DrawTrackingOverlay(wxDC &dc);
|
void DrawTrackingOverlay(wxDC &dc);
|
||||||
void DrawOverlay();
|
void DrawOverlay();
|
||||||
|
void SetMode(int mode);
|
||||||
void OnMouseEvent(wxMouseEvent &event);
|
void OnMouseEvent(wxMouseEvent &event);
|
||||||
|
void OnKeyEvent(wxKeyEvent &event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VideoDisplayVisual(VideoDisplay *parent);
|
VideoDisplayVisual(VideoDisplay *parent);
|
||||||
|
|
Loading…
Reference in New Issue