mirror of https://github.com/odrling/Aegisub
Visual typesetting fixes.
Originally committed to SVN as r1330.
This commit is contained in:
parent
c498c3a0b7
commit
5b1a326804
|
@ -408,3 +408,10 @@ void VisualTool::GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2)
|
|||
}
|
||||
diag->ClearBlocks();
|
||||
}
|
||||
|
||||
|
||||
////////////////
|
||||
// Set override
|
||||
void VisualTool::SetOverride(wxString tag,wxString value) {
|
||||
VideoContext::Get()->grid->editBox->SetOverride(tag,value,0,false);
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ protected:
|
|||
void GetLineScale(AssDialogue *diag,float &scalX,float &scalY);
|
||||
void GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2);
|
||||
void FillPositionData();
|
||||
void SetOverride(wxString tag,wxString value);
|
||||
|
||||
VideoDisplay *GetParent() { return parent; }
|
||||
|
||||
|
|
|
@ -67,7 +67,12 @@ void VisualToolClip::Update() {
|
|||
////////
|
||||
// Draw
|
||||
void VisualToolClip::Draw() {
|
||||
// Get current line
|
||||
AssDialogue *line = GetActiveDialogueLine();
|
||||
if (!line) return;
|
||||
|
||||
// Get position
|
||||
if (line != curDiag) GetLineClip(line,curX1,curY1,curX2,curY2);
|
||||
int dx1 = curX1;
|
||||
int dy1 = curY1;
|
||||
int dx2 = curX2;
|
||||
|
@ -116,13 +121,21 @@ void VisualToolClip::UpdateHold() {
|
|||
curY1 = startY * sh / h;
|
||||
curX2 = mouseX * sw / w;
|
||||
curY2 = mouseY * sh / h;
|
||||
|
||||
// Make sure 1 is smaller than 2
|
||||
if (curX1 > curX2) IntSwap(curX1,curX2);
|
||||
if (curY1 > curY2) IntSwap(curY1,curY2);
|
||||
|
||||
// Limit to video area
|
||||
curX1 = MID(0,curX1,sw);
|
||||
curX2 = MID(0,curX2,sw);
|
||||
curY1 = MID(0,curY1,sh);
|
||||
curY2 = MID(0,curY2,sh);
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
// Commit hold
|
||||
void VisualToolClip::CommitHold() {
|
||||
VideoContext::Get()->grid->editBox->SetOverride(_T("\\clip"),wxString::Format(_T("(%i,%i,%i,%i)"),curX1,curY1,curX2,curY2),0,false);
|
||||
SetOverride(_T("\\clip"),wxString::Format(_T("(%i,%i,%i,%i)"),curX1,curY1,curX2,curY2));
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ void VisualToolCross::Update() {
|
|||
int vx = (sw * mouseX + w/2) / w;
|
||||
int vy = (sh * mouseY + h/2) / h;
|
||||
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
||||
grid->editBox->SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),vx,vy),0,false);
|
||||
SetOverride(_T("\\pos"),wxString::Format(_T("(%i,%i)"),vx,vy));
|
||||
grid->editBox->CommitText();
|
||||
grid->ass->FlagAsModified(_("positioning"));
|
||||
grid->CommitChanges(false,true);
|
||||
|
|
|
@ -219,6 +219,6 @@ void VisualToolRotateXY::UpdateHold() {
|
|||
///////////////
|
||||
// Commit hold
|
||||
void VisualToolRotateXY::CommitHold() {
|
||||
VideoContext::Get()->grid->editBox->SetOverride(_T("\\frx"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngleX)),0,false);
|
||||
VideoContext::Get()->grid->editBox->SetOverride(_T("\\fry"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngleY)),0,false);
|
||||
SetOverride(_T("\\frx"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngleX)));
|
||||
SetOverride(_T("\\fry"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngleY)));
|
||||
}
|
||||
|
|
|
@ -194,6 +194,5 @@ void VisualToolRotateZ::UpdateHold() {
|
|||
///////////////
|
||||
// Commit hold
|
||||
void VisualToolRotateZ::CommitHold() {
|
||||
wxString param = PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngle));
|
||||
VideoContext::Get()->grid->editBox->SetOverride(_T("\\frz"),param,0,false);
|
||||
SetOverride(_T("\\frz"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngle)));
|
||||
}
|
||||
|
|
|
@ -71,6 +71,9 @@ void VisualToolScale::Draw() {
|
|||
AssDialogue *line = GetActiveDialogueLine();
|
||||
if (!line) return;
|
||||
|
||||
// Get scale
|
||||
if (line != curDiag) GetLineScale(line,curScaleX,curScaleY);
|
||||
|
||||
// Get line position and rotation
|
||||
int dx,dy;
|
||||
float rx,ry,rz;
|
||||
|
@ -165,6 +168,6 @@ void VisualToolScale::UpdateHold() {
|
|||
///////////////
|
||||
// Commit hold
|
||||
void VisualToolScale::CommitHold() {
|
||||
VideoContext::Get()->grid->editBox->SetOverride(_T("\\fscx"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curScaleX)),0,false);
|
||||
VideoContext::Get()->grid->editBox->SetOverride(_T("\\fscy"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curScaleY)),0,false);
|
||||
SetOverride(_T("\\fscx"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curScaleX)));
|
||||
SetOverride(_T("\\fscy"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curScaleY)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue