Reset cell selection size on navigation

This commit is contained in:
manongjohn 2023-05-29 08:56:12 -04:00
parent 8861f5e46d
commit 808125fc8c
2 changed files with 20 additions and 45 deletions

View file

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

View file

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