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; externalChange = false;
VideoContext* con = VideoContext::Get();
leftClick = event.ButtonDown(wxMOUSE_BTN_LEFT); leftClick = event.ButtonDown(wxMOUSE_BTN_LEFT);
leftDClick = event.LeftDClick(); leftDClick = event.LeftDClick();
shiftDown = event.m_shiftDown; shiftDown = event.m_shiftDown;

View file

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

View file

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