Only scroll the grid to the active line if the row has actually changed

Makes it so that undo/redo only scrolls to the active line if it's
different in the two versions of the file.
This commit is contained in:
Thomas Goyne 2014-06-12 07:35:49 -07:00
parent f24a72d8fc
commit 2508dd9c6e
2 changed files with 7 additions and 3 deletions

View File

@ -237,11 +237,13 @@ void BaseGrid::UpdateMaps() {
void BaseGrid::OnActiveLineChanged(AssDialogue *new_active) { void BaseGrid::OnActiveLineChanged(AssDialogue *new_active) {
if (new_active) { if (new_active) {
int row = new_active->Row; if (new_active->Row != active_row)
MakeRowVisible(row); MakeRowVisible(new_active->Row);
extendRow = row; extendRow = active_row = new_active->Row;
Refresh(false); Refresh(false);
} }
else
active_row = -1;
} }
void BaseGrid::MakeRowVisible(int row) { void BaseGrid::MakeRowVisible(int row) {

View File

@ -55,6 +55,8 @@ class BaseGrid final : public wxWindow {
/// First row that is visible at the current scroll position /// First row that is visible at the current scroll position
int yPos = 0; int yPos = 0;
int active_row = -1;
agi::Context *context; ///< Associated project context agi::Context *context; ///< Associated project context
std::vector<std::unique_ptr<GridColumn>> columns; std::vector<std::unique_ptr<GridColumn>> columns;