forked from mia/Aegisub
Switch visual tools over to using GetSelectedSet for everything
Originally committed to SVN as r4632.
This commit is contained in:
parent
5588cda268
commit
a3ff2cc746
7 changed files with 26 additions and 48 deletions
|
@ -414,11 +414,6 @@ void VisualTool<FeatureType>::RemoveSelection(unsigned i) {
|
|||
}
|
||||
}
|
||||
|
||||
template<class FeatureType>
|
||||
wxArrayInt VisualTool<FeatureType>::GetSelection() {
|
||||
return grid->GetSelection();
|
||||
}
|
||||
|
||||
template<class FeatureType>
|
||||
void VisualTool<FeatureType>::ClearSelection() {
|
||||
selFeatures.clear();
|
||||
|
|
|
@ -192,8 +192,6 @@ protected:
|
|||
|
||||
/// @brief Clear the selection
|
||||
void ClearSelection();
|
||||
/// @brief Get the currently selected lines
|
||||
wxArrayInt GetSelection();
|
||||
|
||||
typedef typename std::vector<FeatureType>::iterator feature_iterator;
|
||||
typedef typename std::vector<FeatureType>::const_iterator feature_const_iterator;
|
||||
|
|
|
@ -61,15 +61,12 @@ bool VisualToolCross::Update() {
|
|||
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;
|
||||
Selection sel = grid->GetSelectedSet();
|
||||
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||
int x1, y1;
|
||||
GetLinePosition(line, x1, y1);
|
||||
GetLinePosition(*cur, x1, y1);
|
||||
parent->ToScriptCoords(&x1, &y1);
|
||||
SetOverride(line, L"\\pos", wxString::Format(L"(%i,%i)", x1 - dx, y1 - dy));
|
||||
SetOverride(*cur, L"\\pos", wxString::Format(L"(%i,%i)", x1 - dx, y1 - dy));
|
||||
}
|
||||
|
||||
Commit(true, _("positioning"));
|
||||
|
|
|
@ -93,16 +93,13 @@ void VisualToolDrag::UpdateToggleButtons() {
|
|||
/// @brief Toggle button pressed
|
||||
/// @param event
|
||||
void VisualToolDrag::OnSubTool(wxCommandEvent &) {
|
||||
BaseGrid* grid = VideoContext::Get()->grid;
|
||||
wxArrayInt sel = GetSelection();
|
||||
Selection sel = grid->GetSelectedSet();
|
||||
// Toggle \move <-> \pos
|
||||
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||
AssDialogue *line = *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);
|
||||
|
@ -335,31 +332,28 @@ bool VisualToolDrag::Update() {
|
|||
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;
|
||||
Selection sel = grid->GetSelectedSet();
|
||||
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||
int x1 = 0, y1 = 0, x2 = 0, y2 = 0, t1 = INT_MIN, t2 = INT_MIN, orgx, orgy;
|
||||
bool isMove;
|
||||
|
||||
GetLinePosition(line, x1, y1, orgx, orgy);
|
||||
GetLineMove(line, isMove, x1, y1, x2, y2, t1, t2);
|
||||
GetLinePosition(*cur, x1, y1, orgx, orgy);
|
||||
GetLineMove(*cur, isMove, x1, y1, x2, y2, t1, t2);
|
||||
parent->ToScriptCoords(&x1, &y1);
|
||||
parent->ToScriptCoords(&x2, &y2);
|
||||
parent->ToScriptCoords(&orgx, &orgy);
|
||||
|
||||
if (isMove) {
|
||||
if (t1 > INT_MIN && t2 > INT_MIN)
|
||||
SetOverride(line, L"\\move", wxString::Format(L"(%i,%i,%i,%i,%i,%i)", x1 - dx, y1 - dy, x2 - dx, y2 - dy, t1, t2));
|
||||
SetOverride(*cur, L"\\move", wxString::Format(L"(%i,%i,%i,%i,%i,%i)", x1 - dx, y1 - dy, x2 - dx, y2 - dy, t1, t2));
|
||||
else
|
||||
SetOverride(line, L"\\move", wxString::Format(L"(%i,%i,%i,%i)", x1, y1, x2, y2));
|
||||
SetOverride(*cur, L"\\move", wxString::Format(L"(%i,%i,%i,%i)", x1, y1, x2, y2));
|
||||
}
|
||||
else {
|
||||
SetOverride(line, L"\\pos", wxString::Format(L"(%i,%i)", x1 - dx, y1 - dy));
|
||||
SetOverride(*cur, L"\\pos", wxString::Format(L"(%i,%i)", x1 - dx, y1 - dy));
|
||||
}
|
||||
if (orgx != x1 || orgy != y1) {
|
||||
SetOverride(line, L"\\org", wxString::Format(L"(%i,%i)", orgx - dx, orgy - dy));
|
||||
SetOverride(*cur, L"\\org", wxString::Format(L"(%i,%i)", orgx - dx, orgy - dy));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -186,12 +186,10 @@ void VisualToolRotateXY::UpdateHold() {
|
|||
}
|
||||
|
||||
void VisualToolRotateXY::CommitHold() {
|
||||
wxArrayInt sel = grid->GetSelection();
|
||||
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||
AssDialogue* line = grid->GetDialogue(*cur);
|
||||
assert(line);
|
||||
SetOverride(line, L"\\frx",wxString::Format(L"(%0.3g)",curAngleX));
|
||||
SetOverride(line, L"\\fry",wxString::Format(L"(%0.3g)",curAngleY));
|
||||
Selection sel = grid->GetSelectedSet();
|
||||
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||
SetOverride(*cur, L"\\frx",wxString::Format(L"(%0.3g)",curAngleX));
|
||||
SetOverride(*cur, L"\\fry",wxString::Format(L"(%0.3g)",curAngleY));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -148,11 +148,9 @@ void VisualToolRotateZ::UpdateHold() {
|
|||
}
|
||||
|
||||
void VisualToolRotateZ::CommitHold() {
|
||||
wxArrayInt sel = grid->GetSelection();
|
||||
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||
AssDialogue* line = grid->GetDialogue(*cur);
|
||||
assert(line);
|
||||
SetOverride(line, L"\\frz",wxString::Format(L"(%0.3g)",curAngle));
|
||||
Selection sel = grid->GetSelectedSet();
|
||||
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||
SetOverride(*cur, L"\\frz",wxString::Format(L"(%0.3g)",curAngle));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,12 +147,10 @@ void VisualToolScale::UpdateHold() {
|
|||
}
|
||||
|
||||
void VisualToolScale::CommitHold() {
|
||||
wxArrayInt sel = grid->GetSelection();
|
||||
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||
AssDialogue* line = grid->GetDialogue(*cur);
|
||||
assert(line);
|
||||
SetOverride(line, L"\\fscx",wxString::Format(L"(%0.3g)",curScaleX));
|
||||
SetOverride(line, L"\\fscy",wxString::Format(L"(%0.3g)",curScaleY));
|
||||
Selection sel = grid->GetSelectedSet();
|
||||
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||
SetOverride(*cur, L"\\fscx",wxString::Format(L"(%0.3g)",curScaleX));
|
||||
SetOverride(*cur, L"\\fscy",wxString::Format(L"(%0.3g)",curScaleY));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue