|
wxMaxima
|
The pure scroll-synchronization geometry for the diff viewer. More...
#include <vector>Go to the source code of this file.
Functions | |
| int | ComputeSyncedScrollY (const std::vector< int > &srcCellTops, const std::vector< int > &otherCellTops, int srcViewportTop) |
| Compute where the "other" worksheet must scroll to stay aligned with the scrolled ("source") worksheet. | |
Variables | |
| constexpr int | DIFFSYNC_NO_CELL = -1 |
| A diff-entry cell that has no counterpart in a given worksheet is marked with this top coordinate. | |
The pure scroll-synchronization geometry for the diff viewer.
Kept deliberately free of any GUI/wxWidgets dependency so the alignment math (which has historically been a source of bugs) can be unit-tested in isolation. DiffFrame::SyncScrollFrom() feeds it the cell positions read from the live worksheets and applies the result with Worksheet::Scroll().
| int ComputeSyncedScrollY | ( | const std::vector< int > & | srcCellTops, |
| const std::vector< int > & | otherCellTops, | ||
| int | srcViewportTop | ||
| ) |
Compute where the "other" worksheet must scroll to stay aligned with the scrolled ("source") worksheet.
A single top-anchored rule is used for both scroll directions: find the first diff entry whose source cell starts at or below the source viewport top, and scroll the other worksheet so its matching cell sits at the same offset below the viewport top.
| srcCellTops | For each diff entry, the top y-coordinate of the source worksheet's cell, or DIFFSYNC_NO_CELL if that entry has no cell in the source worksheet. |
| otherCellTops | The same, for the other worksheet. Must be the same length as srcCellTops (indexed by diff entry). |
| srcViewportTop | The source worksheet's new viewport-top, in pixels. |