TimelineViewMetrics.h header

#include <ew/app/TimelineViewMetrics.h>

Namespace ew::app

TimelineLaneRow struct

struct ew::app::TimelineLaneRow

One lane's vertical slot when collapse is in play (TL-46): its top edge and height, plus whether it is the collapsed (thin) kind. Keeping the vertical layout here – pure and tested – is what lets the panel place a mix of full and collapsed lanes without any sizing logic in paintEvent.

Members

int ew::app::TimelineLaneRow::top = 0

The y of the lane's top edge (the caller passes plotTop as the first lane's top).

int ew::app::TimelineLaneRow::height = 0

The lane's height in pixels.

bool ew::app::TimelineLaneRow::collapsed = false

Whether this lane is a collapsed thin strip (as opposed to a full lane).

bool operator==(const TimelineLaneRow &, const TimelineLaneRow &)=default

Value equality, for tests.

TimelineViewMetrics struct

struct ew::app::TimelineViewMetrics

The concrete pixel metrics the timeline panel draws a lane with, resolved from the user's ew::core::TimelineViewSettings against the live geometry. Keeping the settings->pixels mapping here – pure and unit-tested – is what lets the panel's paint path stay a thin consumer (no sizing logic in paintEvent, per the plan's DoD).

Members

int ew::app::TimelineViewMetrics::laneHeight = 0

The height of one lane, in pixels.

int ew::app::TimelineViewMetrics::markHeight = 0

The height of an event mark, in pixels.

int ew::app::TimelineViewMetrics::spineGap = 0

The clearance between the spine line and a mark.

int ew::app::TimelineViewMetrics::rowPitch = 0

The vertical pitch between stacked coincident marks.

int ew::app::TimelineViewMetrics::minLaneHeight = 0

The floor a lane is never auto-packed below (the even-split minimum).

bool operator==(const TimelineViewMetrics &, const TimelineViewMetrics &)=default

Value equality, for tests.

Functions

TimelineViewMetrics ew::app::resolveTimelineViewMetrics(const ew::core::TimelineViewSettings &settings, int availableHeight, int laneCount)

Resolves settings into concrete metrics for a plot availableHeight pixels tall showing laneCount lanes. Comfortable is the roomy default; Compact tightens the floors and marks so more fits at once. ew::core::TimelineViewSettings::rowHeight overrides the even auto-split (0 = auto, the T3.7 fill-the-dock look); ew::core::TimelineViewSettings::eventSize overrides the mark height (0 = the density default). Every override is clamped to a legible range, so a hostile or fat-fingered value from a hand-edited project or a spin box cannot produce a zero-height lane or one that blows out the dock.

QString ew::app::timelineEventLabelText(const QString &title, const QString &yearLabel, const QString &fullDateLabel, ew::core::TimelineLabelFormat format)

Builds the text a shown event label carries, honouring format (TL-80). title is the event name; yearLabel and fullDateLabel are the event's own date already formatted in the project's calendar by the caller (this stays UI/calendar-free and testable). TitleOnly is the T3 look; the others append the date in parentheses, falling back to the bare title when the caller has no date to show (a still-undated ordinal event).

std::vector< TimelineLaneRow > ew::app::timelineLaneRows(const ew::core::TimelineViewSettings &settings, int plotTop, int availableHeight, const std::vector< bool > &collapsed, int collapsedHeight)

Lays out the lanes vertically in a plot of availableHeight pixels starting at plotTop, given which lanes are collapsed (TL-46). collapsed carries, per lane in draw order, whether that lane is collapsed; a collapsed lane gets the fixed collapsedHeight, and the remaining (full) lanes share what is left using the SAME policy as resolveTimelineViewMetrics (the rowHeight override or the even fill-the-dock split, clamped legible) – so collapsing a lane reclaims its space for the others. Rows are returned in order with cumulative, non-overlapping tops. With nothing collapsed the result matches the uniform even split exactly, so the default look is unchanged. An empty collapsed yields no rows.