Merge pull request #1165 from manongjohn/reset_selection_size_on_move

Reset cell selection size on navigation
This commit is contained in:
manongjohn 2023-06-07 07:19:12 -04:00 committed by GitHub
commit 923d34cb7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 45 deletions

View file

@ -51,13 +51,10 @@ public:
return;
int row = TApp::instance()->getCurrentFrame()->getFrame();
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection) {
int r0, r1, c0, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
cellSelection->selectCells(row, c0, r1 + (row - r0), c1);
}
if (cellSelection) cellSelection->selectCells(row, col, row, col);
}
}
};
@ -85,11 +82,7 @@ public:
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection) {
int r0, r1, c0, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
cellSelection->selectCells(row, c0, r1 + (row - r0), c1);
}
if (cellSelection) cellSelection->selectCells(row, col, row, col);
break;
}
}
@ -128,11 +121,7 @@ public:
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection) {
int r0, r1, c0, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
cellSelection->selectCells(row, c0, r1 + (row - r0), c1);
}
if (cellSelection) cellSelection->selectCells(row, col, row, col);
}
}
};
@ -145,17 +134,15 @@ public:
void execute() override {
int row = TApp::instance()->getCurrentFrame()->getFrame();
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
int step = Preferences::instance()->getXsheetStep();
TApp::instance()->getCurrentFrame()->setFrame(row + step);
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection) {
int r0, r1, c0, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
cellSelection->selectCells(r0 + step, c0, r1 + step, c1);
}
if (cellSelection)
cellSelection->selectCells(row + step, col, row + step, col);
}
};
@ -167,17 +154,15 @@ public:
void execute() override {
int row = TApp::instance()->getCurrentFrame()->getFrame();
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
int step = Preferences::instance()->getXsheetStep();
TApp::instance()->getCurrentFrame()->setFrame(std::max(row - step, 0));
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection) {
int r0, r1, c0, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
cellSelection->selectCells(r0 - step, c0, r1 - step, c1);
}
if (cellSelection)
cellSelection->selectCells(row - step, col, row - step, col);
}
};
@ -230,13 +215,10 @@ public:
TApp::instance()->getCurrentFrame()->emitTriggerNextKeyframe(panel);
int row = TApp::instance()->getCurrentFrame()->getFrame();
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection) {
int r0, r1, c0, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
cellSelection->selectCells(row, c0, r1 + (row - r0), c1);
}
if (cellSelection) cellSelection->selectCells(row, col, row, col);
break;
} else
panel = TApp::instance()->getActiveViewer()->parentWidget();
@ -268,13 +250,10 @@ public:
TApp::instance()->getCurrentFrame()->emitTriggerPrevKeyframe(panel);
int row = TApp::instance()->getCurrentFrame()->getFrame();
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection) {
int r0, r1, c0, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
cellSelection->selectCells(row, c0, r1 + (row - r0), c1);
}
if (cellSelection) cellSelection->selectCells(row, col, row, col);
break;
} else
panel = TApp::instance()->getActiveViewer()->parentWidget();

View file

@ -2801,6 +2801,7 @@ public:
void execute() override {
TApp *app = TApp::instance();
int frame = app->getCurrentFrame()->getFrame();
int col = app->getCurrentColumn()->getColumnIndex();
assert(frame >= 0);
TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
@ -2810,11 +2811,8 @@ public:
app->getCurrentXsheetViewer()->setCurrentRow(nextFrame);
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection) {
int r0, r1, c0, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
cellSelection->selectCells(nextFrame, c0, r1 + (nextFrame - r0), c1);
}
if (cellSelection)
cellSelection->selectCells(nextFrame, col, nextFrame, col);
}
}
} NextTaggedFrame;
@ -2827,6 +2825,7 @@ public:
void execute() override {
TApp *app = TApp::instance();
int frame = app->getCurrentFrame()->getFrame();
int col = app->getCurrentColumn()->getColumnIndex();
assert(frame >= 0);
TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
@ -2836,11 +2835,8 @@ public:
app->getCurrentXsheetViewer()->setCurrentRow(prevFrame);
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection) {
int r0, r1, c0, c1;
cellSelection->getSelectedCells(r0, c0, r1, c1);
cellSelection->selectCells(prevFrame, c0, r1 + (prevFrame - r0), c1);
}
if (cellSelection)
cellSelection->selectCells(prevFrame, col, prevFrame, col);
}
}
} PrevTaggedFrame;