33#ifndef WORKSHEETSIZEMATH_H
34#define WORKSHEETSIZEMATH_H
52 const std::vector<int> &cellWidthsWithMargins,
int baseIndent) {
53 int width = baseIndent;
54 for (
int cellWidth : cellWidthsWithMargins)
55 width = std::max(width, cellWidth);
90 const std::vector<TrailingGroupGeometry> &trailing,
int groupSkip,
94 if (cell.sizeIsStale && cell.currentY >= 0)
97 return cell.currentY + cell.maxDrop + extraHeight;
100 extraHeight += cell.maxDrop + groupSkip;
103 extraHeight += groupSkip + 20;
105 return baseIndent + extraHeight;
142 int currentScrollPixelY) {
144 int scrollUnitBasisHeight = 40;
146 result.
width = maxPointWidth;
148 int height = maxPointHeight + clientHeight - clientHeight / 8;
150 result.
height = std::max(clientHeight + 10, height);
153 std::max(result.
height, currentScrollPixelY + clientHeight + 10);
154 scrollUnitBasisHeight = clientHeight;
156 result.
scrollUnit = std::max(scrollUnitBasisHeight / 30, 10);
211 int maxWidth,
int maxHeight,
214 int clientWidth, clientHeight;
217 int currentScrollPixelY = 0;
222 hasTree, maxWidth, maxHeight, clientHeight, currentScrollPixelY);
224 if ((cache.lastWidth != vs.
width || cache.lastHeight != vs.
height) &&
226 cache.lastWidth = vs.
width;
227 cache.lastHeight = vs.
height;
void ApplyWorksheetVirtualSize(WorksheetView &view, bool hasTree, int maxWidth, int maxHeight, WorksheetVirtualSizeCache &cache, int &scrollUnit)
Measure the view, compute the virtual size and apply it, skipping no-ops.
Definition: WorksheetSizeMath.h:210
WorksheetVirtualSize ComputeWorksheetVirtualSize(bool hasTree, int maxPointWidth, int maxPointHeight, int clientHeight, int currentScrollPixelY)
Compute a worksheet's virtual size and scroll unit.
Definition: WorksheetSizeMath.h:138
int ComputeWorksheetContentWidth(const std::vector< int > &cellWidthsWithMargins, int baseIndent)
Compute the worksheet's content width.
Definition: WorksheetSizeMath.h:51
int ComputeWorksheetContentHeight(const std::vector< TrailingGroupGeometry > &trailing, int groupSkip, int baseIndent)
Compute the worksheet's content height from its trailing cells' geometry.
Definition: WorksheetSizeMath.h:89
The narrow view surface the worksheet's layout pipeline needs.
Definition: WorksheetSizeMath.h:172
virtual void SetViewScrollRate(int rate)=0
Set the scroll granularity (device pixels per scroll unit) on both axes.
virtual int GetViewScrollUnitY() const =0
The current vertical scroll position, in scroll units (not pixels).
virtual void GetViewPosition(int *x, int *y) const =0
The view's position within its parent, in device pixels (wxWindow::GetPosition).
virtual void GetViewClientSize(int *width, int *height) const =0
The visible client area, in device pixels.
virtual void SetViewVirtualSize(int width, int height)=0
Set the scrollable (virtual) area, in device pixels.
One trailing group cell's geometry, as GetMaxPoint's height walk needs it.
Definition: WorksheetSizeMath.h:60
bool sizeIsStale
Whether the cell's size still needs recomputing (GroupCell::HasStaleSize).
Definition: WorksheetSizeMath.h:62
int maxDrop
The cell's extent below its baseline (GetMaxDrop()).
Definition: WorksheetSizeMath.h:66
int currentY
The cell's laid-out top position (GetCurrentPoint().y); < 0 = not yet set.
Definition: WorksheetSizeMath.h:64
Remembers the last virtual size applied, so an unchanged size is a no-op.
Definition: WorksheetSizeMath.h:188
The scrollable size + scroll granularity computed for a worksheet.
Definition: WorksheetSizeMath.h:110
int height
The virtual (scrollable) height (device px).
Definition: WorksheetSizeMath.h:114
int scrollUnit
The scroll rate (device px per scroll unit).
Definition: WorksheetSizeMath.h:116
int width
The virtual width (device px).
Definition: WorksheetSizeMath.h:112