Tweaks and fixes to visual typesetting and fixed keyframe unloading.

Originally committed to SVN as r773.
This commit is contained in:
Rodrigo Braz Monteiro 2007-01-11 17:14:25 +00:00
parent 907a4a0045
commit a310231d83
4 changed files with 53 additions and 15 deletions

View file

@ -5,10 +5,15 @@ Please visit http://aegisub.net to download latest version
- New Aegisub logo. (AMZ) - New Aegisub logo. (AMZ)
- Automation 4 has replaced Automation 3, see the help file for more details (jfs) - 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 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 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) - Support reading SSA/ASS files with intermixed V4 and V4+ Styles sections. (jfs)
- Fixed loading of sections with unexpected cases. (AMZ) - Fixed loading of sections with unexpected cases. (AMZ)
- Changes to Audio Spectrum: (jfs) - Changes to Audio Spectrum: (jfs)

View file

@ -1093,8 +1093,8 @@ void FrameMain::LoadKeyframes(wxString filename) {
if (filename.IsEmpty()) { if (filename.IsEmpty()) {
wxArrayInt keyFrames; wxArrayInt keyFrames;
keyFrames.Empty(); keyFrames.Empty();
videoBox->videoDisplay->SetOverKeyFrames(keyFrames); videoBox->videoDisplay->CloseOverKeyFrames();
videoBox->videoDisplay->SetKeyFramesName(filename); videoBox->videoSlider->Refresh();
Refresh(); Refresh();
return; return;
} }

View file

@ -775,7 +775,7 @@ void FrameMain::OnOpenKeyframes (wxCommandEvent &event) {
/////////////////// ///////////////////
// Close keyframes // Close keyframes
void FrameMain::OnCloseKeyframes (wxCommandEvent &event) { void FrameMain::OnCloseKeyframes (wxCommandEvent &event) {
videoBox->videoDisplay->CloseOverKeyFrames(); LoadKeyframes(_T(""));
} }

View file

@ -137,12 +137,27 @@ void VideoDisplayVisual::DrawOverlay() {
// Draw the control points for FexTracker // Draw the control points for FexTracker
DrawTrackingOverlay(dc); DrawTrackingOverlay(dc);
// Draw pivot points of visible lines // Draw lines
if (mode != 0) { if (mode != 0) {
int numRows = parent->grid->GetRows(); int numRows = parent->grid->GetRows();
int startMs = VFR_Output.GetTimeAtFrame(frame_n,true);
int endMs = VFR_Output.GetTimeAtFrame(frame_n,false);
AssDialogue *diag; AssDialogue *diag;
AssDialogue *diagHigh = NULL;
// Find where the highlight is
if (mode == 1) {
int dx,dy;
for (int i=0;i<numRows;i++) {
diag = parent->grid->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 each line
for (int i=0;i<numRows;i++) { for (int i=0;i<numRows;i++) {
@ -152,6 +167,13 @@ void VideoDisplayVisual::DrawOverlay() {
bool draw = false; bool draw = false;
bool high = false; bool high = false;
bool isCur = diag == curSelection; bool isCur = diag == curSelection;
bool timeVisible = VFR_Output.GetFrameAtTime(diag->Start.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 dx = -1;
int dy = -1; int dy = -1;
int orgx = -1; int orgx = -1;
@ -165,7 +187,7 @@ void VideoDisplayVisual::DrawOverlay() {
int deltay = 0; int deltay = 0;
// Line visible? // Line visible?
if (isCur || (diag->Start.GetMS() <= startMs && diag->End.GetMS() >= endMs)) { if (show) {
// Get position // Get position
if (isCur && mode == 1) { if (isCur && mode == 1) {
dx = curX; dx = curX;
@ -175,7 +197,7 @@ void VideoDisplayVisual::DrawOverlay() {
else GetLinePosition(diag,dx,dy,orgx,orgy); else GetLinePosition(diag,dx,dy,orgx,orgy);
// Mouse over? // Mouse over?
if (mode == 1 && (x >= dx-8 && x <= dx+8 && y >= dy-8 && y <= dy+8)) { if (diag == diagHigh) {
high = true; high = true;
} }
@ -353,7 +375,13 @@ void VideoDisplayVisual::DrawOverlay() {
dx2 = x; dx2 = x;
dy2 = y; 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 // Draw rectangle
dc.SetPen(wxPen(colour[3],1)); dc.SetPen(wxPen(colour[3],1));
@ -815,7 +843,9 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
int startMs = VFR_Output.GetTimeAtFrame(frame_n,true); int startMs = VFR_Output.GetTimeAtFrame(frame_n,true);
int endMs = VFR_Output.GetTimeAtFrame(frame_n,false); int endMs = VFR_Output.GetTimeAtFrame(frame_n,false);
AssDialogue *diag; AssDialogue *diag;
for (int i=0;i<numRows;i++) {
// Don't uninvert this loop or selection will break
for (int i=numRows;--i>=0;) {
diag = parent->grid->GetDialogue(i); diag = parent->grid->GetDialogue(i);
if (diag) { if (diag) {
// Line visible? // Line visible?
@ -944,7 +974,8 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
// Update // Update
curAngle = screenAngle - startAngle + origAngle; 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) { if (realTime) {
AssLimitToVisibleFilter::SetFrame(frame_n); AssLimitToVisibleFilter::SetFrame(frame_n);
grid->editBox->SetOverride(_T("\\frz"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngle)),0); grid->editBox->SetOverride(_T("\\frz"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngle)),0);
@ -962,8 +993,10 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
// Calculate // Calculate
curAngle = screenAngle - startAngle + origAngle; curAngle = screenAngle - startAngle + origAngle;
curAngle2 = screenAngle2 - startAngle2 + origAngle2; curAngle2 = screenAngle2 - startAngle2 + origAngle2;
if (curAngle < 0.0) curAngle += 360.0; while (curAngle < 0.0) curAngle += 360.0;
if (curAngle2 < 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 // Update
if (realTime) { if (realTime) {