forked from mia/Aegisub
Add updating multiple lines at once to the cross visual tool and make it only happen if alt is held down in both cross and drag. Updates #513.
Originally committed to SVN as r4360.
This commit is contained in:
parent
2d57debd49
commit
5283c1527b
2 changed files with 29 additions and 10 deletions
|
@ -250,6 +250,7 @@ void VisualTool<FeatureType>::OnMouseEvent (wxMouseEvent &event) {
|
||||||
}
|
}
|
||||||
// start hold
|
// start hold
|
||||||
else {
|
else {
|
||||||
|
if (!altDown) ClearSelection();
|
||||||
curDiag = GetActiveDialogueLine();
|
curDiag = GetActiveDialogueLine();
|
||||||
if (curDiag && InitializeHold()) {
|
if (curDiag && InitializeHold()) {
|
||||||
holding = true;
|
holding = true;
|
||||||
|
|
|
@ -53,17 +53,35 @@ VisualToolCross::~VisualToolCross() { }
|
||||||
|
|
||||||
/// @brief Update
|
/// @brief Update
|
||||||
void VisualToolCross::Update() {
|
void VisualToolCross::Update() {
|
||||||
// Position
|
if (!leftDClick) return;
|
||||||
if (leftDClick) {
|
|
||||||
|
AssDialogue* line = GetActiveDialogueLine();
|
||||||
|
if (!line) return;
|
||||||
|
|
||||||
|
|
||||||
|
int dx, dy;
|
||||||
int vx = video.x;
|
int vx = video.x;
|
||||||
int vy = video.y;
|
int vy = video.y;
|
||||||
|
GetLinePosition(line, dx, dy);
|
||||||
parent->ToScriptCoords(&vx, &vy);
|
parent->ToScriptCoords(&vx, &vy);
|
||||||
|
parent->ToScriptCoords(&dx, &dy);
|
||||||
|
dx -= vx;
|
||||||
|
dy -= vy;
|
||||||
|
|
||||||
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
||||||
SetOverride(GetActiveDialogueLine(), L"\\pos",wxString::Format(L"(%i,%i)",vx,vy));
|
wxArrayInt sel = grid->GetSelection();
|
||||||
|
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||||
|
AssDialogue* line = grid->GetDialogue(*cur);
|
||||||
|
if (!line) continue;
|
||||||
|
int x1, y1;
|
||||||
|
GetLinePosition(line, x1, y1);
|
||||||
|
parent->ToScriptCoords(&x1, &y1);
|
||||||
|
SetOverride(line, L"\\pos", wxString::Format(L"(%i,%i)", x1 - dx, y1 - dy));
|
||||||
|
}
|
||||||
|
|
||||||
grid->ass->FlagAsModified(_("positioning"));
|
grid->ass->FlagAsModified(_("positioning"));
|
||||||
grid->CommitChanges(false,true);
|
grid->CommitChanges(false,true);
|
||||||
grid->editBox->Update(false, true, false);
|
grid->editBox->Update(false, true, false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Draw
|
/// @brief Draw
|
||||||
|
|
Loading…
Reference in a new issue