Make move/pos toggle modify all selected lines

Originally committed to SVN as r4364.
This commit is contained in:
Thomas Goyne 2010-05-26 07:17:46 +00:00
parent 877eabdce7
commit e120ecc190
3 changed files with 12 additions and 15 deletions

View File

@ -111,8 +111,6 @@ void VisualTool<FeatureType>::OnMouseEvent (wxMouseEvent &event) {
}
externalChange = false;
VideoContext* con = VideoContext::Get();
leftClick = event.ButtonDown(wxMOUSE_BTN_LEFT);
leftDClick = event.LeftDClick();
shiftDown = event.m_shiftDown;

View File

@ -36,7 +36,7 @@
#pragma once
#ifndef AGI_PRE
#include <deque>
#include <vector>
#include <set>
#include <wx/log.h>

View File

@ -93,29 +93,28 @@ void VisualToolDrag::UpdateToggleButtons() {
/// @brief Toggle button pressed
/// @param event
void VisualToolDrag::OnSubTool(wxCommandEvent &event) {
// Get line
AssDialogue *line = GetActiveDialogueLine();
if (!line) return;
void VisualToolDrag::OnSubTool(wxCommandEvent &) {
BaseGrid* grid = VideoContext::Get()->grid;
wxArrayInt sel = GetSelection();
// Toggle \move <-> \pos
if (event.GetId() == BUTTON_TOGGLE_MOVE) {
// Get coordinates
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
int x1,y1,x2,y2,t1,t2;
bool hasMove;
AssDialogue *line = grid->GetDialogue(*cur);
if (!line) continue;
GetLinePosition(line,x1,y1);
GetLineMove(line,hasMove,x1,y1,x2,y2,t1,t2);
parent->ToScriptCoords(&x1, &y1);
parent->ToScriptCoords(&x2, &y2);
// Replace tag
if (hasMove) SetOverride(line, L"\\pos",wxString::Format(L"(%i,%i)",x1,y1));
else SetOverride(line, L"\\move",wxString::Format(L"(%i,%i,%i,%i,%i,%i)",x1,y1,x1,y1,0,line->End.GetMS() - line->Start.GetMS()));
Commit(true);
// Update display
Refresh();
}
Commit(true);
Refresh();
}
void VisualToolDrag::DoRefresh() {