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>
|
template<class FeatureType>
|
||||||
void VisualTool<FeatureType>::ClearSelection() {
|
void VisualTool<FeatureType>::ClearSelection() {
|
||||||
selFeatures.clear();
|
selFeatures.clear();
|
||||||
|
|
|
@ -192,8 +192,6 @@ protected:
|
||||||
|
|
||||||
/// @brief Clear the selection
|
/// @brief Clear the selection
|
||||||
void ClearSelection();
|
void ClearSelection();
|
||||||
/// @brief Get the currently selected lines
|
|
||||||
wxArrayInt GetSelection();
|
|
||||||
|
|
||||||
typedef typename std::vector<FeatureType>::iterator feature_iterator;
|
typedef typename std::vector<FeatureType>::iterator feature_iterator;
|
||||||
typedef typename std::vector<FeatureType>::const_iterator feature_const_iterator;
|
typedef typename std::vector<FeatureType>::const_iterator feature_const_iterator;
|
||||||
|
|
|
@ -61,15 +61,12 @@ bool VisualToolCross::Update() {
|
||||||
dx -= vx;
|
dx -= vx;
|
||||||
dy -= vy;
|
dy -= vy;
|
||||||
|
|
||||||
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
Selection sel = grid->GetSelectedSet();
|
||||||
wxArrayInt sel = grid->GetSelection();
|
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||||
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
|
||||||
AssDialogue *line = grid->GetDialogue(*cur);
|
|
||||||
if (!line) continue;
|
|
||||||
int x1, y1;
|
int x1, y1;
|
||||||
GetLinePosition(line, x1, y1);
|
GetLinePosition(*cur, x1, y1);
|
||||||
parent->ToScriptCoords(&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"));
|
Commit(true, _("positioning"));
|
||||||
|
|
|
@ -93,16 +93,13 @@ void VisualToolDrag::UpdateToggleButtons() {
|
||||||
/// @brief Toggle button pressed
|
/// @brief Toggle button pressed
|
||||||
/// @param event
|
/// @param event
|
||||||
void VisualToolDrag::OnSubTool(wxCommandEvent &) {
|
void VisualToolDrag::OnSubTool(wxCommandEvent &) {
|
||||||
BaseGrid* grid = VideoContext::Get()->grid;
|
Selection sel = grid->GetSelectedSet();
|
||||||
wxArrayInt sel = GetSelection();
|
|
||||||
// Toggle \move <-> \pos
|
// 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;
|
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);
|
||||||
|
@ -335,31 +332,28 @@ bool VisualToolDrag::Update() {
|
||||||
dx -= vx;
|
dx -= vx;
|
||||||
dy -= vy;
|
dy -= vy;
|
||||||
|
|
||||||
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
Selection sel = grid->GetSelectedSet();
|
||||||
wxArrayInt sel = grid->GetSelection();
|
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||||
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
|
||||||
AssDialogue* line = grid->GetDialogue(*cur);
|
|
||||||
if (!line) continue;
|
|
||||||
int x1 = 0, y1 = 0, x2 = 0, y2 = 0, t1 = INT_MIN, t2 = INT_MIN, orgx, orgy;
|
int x1 = 0, y1 = 0, x2 = 0, y2 = 0, t1 = INT_MIN, t2 = INT_MIN, orgx, orgy;
|
||||||
bool isMove;
|
bool isMove;
|
||||||
|
|
||||||
GetLinePosition(line, x1, y1, orgx, orgy);
|
GetLinePosition(*cur, x1, y1, orgx, orgy);
|
||||||
GetLineMove(line, isMove, x1, y1, x2, y2, t1, t2);
|
GetLineMove(*cur, isMove, x1, y1, x2, y2, t1, t2);
|
||||||
parent->ToScriptCoords(&x1, &y1);
|
parent->ToScriptCoords(&x1, &y1);
|
||||||
parent->ToScriptCoords(&x2, &y2);
|
parent->ToScriptCoords(&x2, &y2);
|
||||||
parent->ToScriptCoords(&orgx, &orgy);
|
parent->ToScriptCoords(&orgx, &orgy);
|
||||||
|
|
||||||
if (isMove) {
|
if (isMove) {
|
||||||
if (t1 > INT_MIN && t2 > INT_MIN)
|
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
|
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 {
|
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) {
|
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() {
|
void VisualToolRotateXY::CommitHold() {
|
||||||
wxArrayInt sel = grid->GetSelection();
|
Selection sel = grid->GetSelectedSet();
|
||||||
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||||
AssDialogue* line = grid->GetDialogue(*cur);
|
SetOverride(*cur, L"\\frx",wxString::Format(L"(%0.3g)",curAngleX));
|
||||||
assert(line);
|
SetOverride(*cur, L"\\fry",wxString::Format(L"(%0.3g)",curAngleY));
|
||||||
SetOverride(line, L"\\frx",wxString::Format(L"(%0.3g)",curAngleX));
|
|
||||||
SetOverride(line, L"\\fry",wxString::Format(L"(%0.3g)",curAngleY));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,11 +148,9 @@ void VisualToolRotateZ::UpdateHold() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualToolRotateZ::CommitHold() {
|
void VisualToolRotateZ::CommitHold() {
|
||||||
wxArrayInt sel = grid->GetSelection();
|
Selection sel = grid->GetSelectedSet();
|
||||||
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||||
AssDialogue* line = grid->GetDialogue(*cur);
|
SetOverride(*cur, L"\\frz",wxString::Format(L"(%0.3g)",curAngle));
|
||||||
assert(line);
|
|
||||||
SetOverride(line, L"\\frz",wxString::Format(L"(%0.3g)",curAngle));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,12 +147,10 @@ void VisualToolScale::UpdateHold() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualToolScale::CommitHold() {
|
void VisualToolScale::CommitHold() {
|
||||||
wxArrayInt sel = grid->GetSelection();
|
Selection sel = grid->GetSelectedSet();
|
||||||
for (wxArrayInt::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
for (Selection::const_iterator cur = sel.begin(); cur != sel.end(); ++cur) {
|
||||||
AssDialogue* line = grid->GetDialogue(*cur);
|
SetOverride(*cur, L"\\fscx",wxString::Format(L"(%0.3g)",curScaleX));
|
||||||
assert(line);
|
SetOverride(*cur, L"\\fscy",wxString::Format(L"(%0.3g)",curScaleY));
|
||||||
SetOverride(line, L"\\fscx",wxString::Format(L"(%0.3g)",curScaleX));
|
|
||||||
SetOverride(line, L"\\fscy",wxString::Format(L"(%0.3g)",curScaleY));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue