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 // start hold
else { else {
if (!altDown) ClearSelection();
curDiag = GetActiveDialogueLine(); curDiag = GetActiveDialogueLine();
if (curDiag && InitializeHold()) { if (curDiag && InitializeHold()) {
holding = true; holding = true;

View file

@ -53,17 +53,35 @@ VisualToolCross::~VisualToolCross() { }
/// @brief Update /// @brief Update
void VisualToolCross::Update() { void VisualToolCross::Update() {
// Position if (!leftDClick) return;
if (leftDClick) {
int vx = video.x; AssDialogue* line = GetActiveDialogueLine();
int vy = video.y; if (!line) return;
parent->ToScriptCoords(&vx, &vy);
SubtitlesGrid *grid = VideoContext::Get()->grid;
SetOverride(GetActiveDialogueLine(), L"\\pos",wxString::Format(L"(%i,%i)",vx,vy)); int dx, dy;
grid->ass->FlagAsModified(_("positioning")); int vx = video.x;
grid->CommitChanges(false,true); int vy = video.y;
grid->editBox->Update(false, true, false); GetLinePosition(line, dx, dy);
parent->ToScriptCoords(&vx, &vy);
parent->ToScriptCoords(&dx, &dy);
dx -= vx;
dy -= vy;
SubtitlesGrid *grid = VideoContext::Get()->grid;
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 /// @brief Draw