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:
Thomas Goyne 2010-05-26 07:17:15 +00:00
parent 2d57debd49
commit 5283c1527b
2 changed files with 29 additions and 10 deletions

View file

@ -250,6 +250,7 @@ void VisualTool<FeatureType>::OnMouseEvent (wxMouseEvent &event) {
}
// start hold
else {
if (!altDown) ClearSelection();
curDiag = GetActiveDialogueLine();
if (curDiag && InitializeHold()) {
holding = true;

View file

@ -53,18 +53,36 @@ VisualToolCross::~VisualToolCross() { }
/// @brief Update
void VisualToolCross::Update() {
// Position
if (leftDClick) {
if (!leftDClick) return;
AssDialogue* line = GetActiveDialogueLine();
if (!line) return;
int dx, dy;
int vx = video.x;
int vy = video.y;
GetLinePosition(line, dx, dy);
parent->ToScriptCoords(&vx, &vy);
parent->ToScriptCoords(&dx, &dy);
dx -= vx;
dy -= vy;
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->CommitChanges(false,true);
grid->editBox->Update(false, true, false);
}
}
/// @brief Draw
void VisualToolCross::Draw() {