From a310231d837cae8b907362a37f7adf07facac1bc Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Thu, 11 Jan 2007 17:14:25 +0000 Subject: [PATCH] Tweaks and fixes to visual typesetting and fixed keyframe unloading. Originally committed to SVN as r773. --- aegisub/changelog.txt | 9 ++++-- aegisub/frame_main.cpp | 4 +-- aegisub/frame_main_events.cpp | 2 +- aegisub/video_display_visual.cpp | 53 ++++++++++++++++++++++++++------ 4 files changed, 53 insertions(+), 15 deletions(-) diff --git a/aegisub/changelog.txt b/aegisub/changelog.txt index 5a28c5f5b..9455eaf17 100644 --- a/aegisub/changelog.txt +++ b/aegisub/changelog.txt @@ -5,10 +5,15 @@ Please visit http://aegisub.net to download latest version - New Aegisub logo. (AMZ) - Automation 4 has replaced Automation 3, see the help file for more details (jfs) - o Automation 4 Lua uses Lua 5.1 instead of 5.0, meaning some new language features + o Automation 4 Lua uses Lua 5.1 instead of 5.0, meaning some new language features: o It is now possible to write macros that manipulate subtitles directly o Scripts have full access to the entire subtitle file, not just the "Events" section -- Visual Typesetting functionality implemented, which should make typesetting much easier and faster. (AMZ) +- Visual Typesetting functionality implemented, which should make typesetting much easier and faster. It supports: (AMZ) + o Dragging; + o Rotation on Z axis; + o Rotation on X/Y axes; + o Scaling on X/Y axes; + o Clipping to a rectangle. - Support reading SSA/ASS files with intermixed V4 and V4+ Styles sections. (jfs) - Fixed loading of sections with unexpected cases. (AMZ) - Changes to Audio Spectrum: (jfs) diff --git a/aegisub/frame_main.cpp b/aegisub/frame_main.cpp index 1d469f13c..954bfe7ad 100644 --- a/aegisub/frame_main.cpp +++ b/aegisub/frame_main.cpp @@ -1093,8 +1093,8 @@ void FrameMain::LoadKeyframes(wxString filename) { if (filename.IsEmpty()) { wxArrayInt keyFrames; keyFrames.Empty(); - videoBox->videoDisplay->SetOverKeyFrames(keyFrames); - videoBox->videoDisplay->SetKeyFramesName(filename); + videoBox->videoDisplay->CloseOverKeyFrames(); + videoBox->videoSlider->Refresh(); Refresh(); return; } diff --git a/aegisub/frame_main_events.cpp b/aegisub/frame_main_events.cpp index 6801f7d9f..78a8a627a 100644 --- a/aegisub/frame_main_events.cpp +++ b/aegisub/frame_main_events.cpp @@ -775,7 +775,7 @@ void FrameMain::OnOpenKeyframes (wxCommandEvent &event) { /////////////////// // Close keyframes void FrameMain::OnCloseKeyframes (wxCommandEvent &event) { - videoBox->videoDisplay->CloseOverKeyFrames(); + LoadKeyframes(_T("")); } diff --git a/aegisub/video_display_visual.cpp b/aegisub/video_display_visual.cpp index a81098e3a..90b1e324e 100644 --- a/aegisub/video_display_visual.cpp +++ b/aegisub/video_display_visual.cpp @@ -137,12 +137,27 @@ void VideoDisplayVisual::DrawOverlay() { // Draw the control points for FexTracker DrawTrackingOverlay(dc); - // Draw pivot points of visible lines + // Draw lines if (mode != 0) { int numRows = parent->grid->GetRows(); - int startMs = VFR_Output.GetTimeAtFrame(frame_n,true); - int endMs = VFR_Output.GetTimeAtFrame(frame_n,false); AssDialogue *diag; + AssDialogue *diagHigh = NULL; + + // Find where the highlight is + if (mode == 1) { + int dx,dy; + for (int i=0;igrid->GetDialogue(i); + if (diag) { + if (VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true) <= frame_n && VFR_Output.GetFrameAtTime(diag->End.GetMS(),false) >= frame_n) { + GetLinePosition(diag,dx,dy); + if (x >= dx-8 && x <= dx+8 && y >= dy-8 && y <= dy+8) { + diagHigh = diag; + } + } + } + } + } // For each line for (int i=0;iStart.GetMS(),true) <= frame_n && VFR_Output.GetFrameAtTime(diag->End.GetMS(),false) >= frame_n; + bool show = timeVisible; + if (mode != 1) { + show = diag == parent->grid->GetDialogue(parent->grid->editBox->linen) && timeVisible; + } + + // Variables int dx = -1; int dy = -1; int orgx = -1; @@ -165,7 +187,7 @@ void VideoDisplayVisual::DrawOverlay() { int deltay = 0; // Line visible? - if (isCur || (diag->Start.GetMS() <= startMs && diag->End.GetMS() >= endMs)) { + if (show) { // Get position if (isCur && mode == 1) { dx = curX; @@ -175,7 +197,7 @@ void VideoDisplayVisual::DrawOverlay() { else GetLinePosition(diag,dx,dy,orgx,orgy); // Mouse over? - if (mode == 1 && (x >= dx-8 && x <= dx+8 && y >= dy-8 && y <= dy+8)) { + if (diag == diagHigh) { high = true; } @@ -353,7 +375,13 @@ void VideoDisplayVisual::DrawOverlay() { dx2 = x; dy2 = y; } - else GetLineClip(diag,dx1,dy1,dx2,dy2); + else { + GetLineClip(diag,dx1,dy1,dx2,dy2); + dx1 = dx1 * w / sw; + dx2 = dx2 * w / sw; + dy1 = dy1 * h / sh; + dy2 = dy2 * h / sh; + } // Draw rectangle dc.SetPen(wxPen(colour[3],1)); @@ -815,7 +843,9 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) { int startMs = VFR_Output.GetTimeAtFrame(frame_n,true); int endMs = VFR_Output.GetTimeAtFrame(frame_n,false); AssDialogue *diag; - for (int i=0;i=0;) { diag = parent->grid->GetDialogue(i); if (diag) { // Line visible? @@ -944,7 +974,8 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) { // Update curAngle = screenAngle - startAngle + origAngle; - if (curAngle < 0.0) curAngle += 360.0; + while (curAngle < 0.0) curAngle += 360.0; + while (curAngle >= 360.0) curAngle -= 360.0; if (realTime) { AssLimitToVisibleFilter::SetFrame(frame_n); grid->editBox->SetOverride(_T("\\frz"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngle)),0); @@ -962,8 +993,10 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) { // Calculate curAngle = screenAngle - startAngle + origAngle; curAngle2 = screenAngle2 - startAngle2 + origAngle2; - if (curAngle < 0.0) curAngle += 360.0; - if (curAngle2 < 0.0) curAngle += 360.0; + while (curAngle < 0.0) curAngle += 360.0; + while (curAngle >= 360.0) curAngle -= 360.0; + while (curAngle2 < 0.0) curAngle2 += 360.0; + while (curAngle2 >= 360.0) curAngle2 -= 360.0; // Update if (realTime) {