TimelineOrdinal.h header
#include <ew/app/TimelineOrdinal.h>
Namespace ew::app
OrdinalKey struct
struct ew::app::OrdinalKey
One event's sorting key for ordinal mode: its authored sequence ordinal, its startMinute (the date-order tiebreak), and its id (the final stable tiebreak).
Members
int ew::app::OrdinalKey::ordinal = 0
The event's authored sequence position (0 for an event never ordered).
qint64 ew::app::OrdinalKey::startMinute = 0
The event's start instant, used to order events that share an ordinal by date.
ew::core::ContentId ew::app::OrdinalKey::id
The event's id – the stable final tiebreak, and the map key returned.
OrdinalSlotRange struct
struct ew::app::OrdinalSlotRange
An inclusive range of sequence slots [first, last]; last < first means "empty" (draw none).
Members
qint64 ew::app::OrdinalSlotRange::first = 0
The first (inclusive) sequence slot in the range.
qint64 ew::app::OrdinalSlotRange::last = -1
The last (inclusive) sequence slot; less than first means the range is empty.
Functions
OrdinalSlotRange ew::app::ordinalRulerSlotRange(qint64 firstVisibleSlot, qint64 lastVisibleSlot, int slotCount)
The sequence slots the ordinal ruler should draw (TL-09): the on-screen slots [firstVisibleSlot, lastVisibleSlot] intersected with the slots that actually EXIST (0 .. slotCount - 1). Capping at slotCount is what stops the ruler from walking every empty slot – and hanging the paint – when the view is still zoomed to a dated span far larger than the ordinal content occupies. slotCount <= 0 yields an empty range. Pure so the bound is testable without a view (it is the exact guard a live hang exposed).
std::map< ew::core::ContentId, int > ew::app::ordinalSequence(std::vector< OrdinalKey > keys)
Maps each event to its position in the sequence (TL-09): sort keys by (ordinal, then startMinute, then id) and assign 0, 1, 2, ... in that order. This is what lets ordinal mode show a sensible sequence even for a project whose events were never explicitly ordered – they all carry ordinal 0, so they fall into DATE order – while a project that HAS been ordered follows its ordinals. The (ordinal, date, id) order matches reorderedOrdinals's input order, so a display rank and a drag target index mean the same thing. Pure so the sequence is testable without a view.
std::map< ew::core::ContentId, int > ew::app::reorderedOrdinals(const std::vector< ew::core::ContentId > &orderedIds, const ew::core::ContentId &movedId, int targetIndex)
Reassigns contiguous sequence ordinals (0, 1, 2, ...) after the event movedId is dragged to sit at display index targetIndex within orderedIds (TL-09: reordering is drag-and-drop). orderedIds is the current display order (already sorted by ordinal); the result maps every id to its new ordinal. targetIndex is clamped to [0, size - 1]; a move that changes nothing (or a movedId not in the list) yields the identity assignment. Pure so the reorder is testable without the view.
qint64 ew::app::timelineOrdinalPosition(int ordinal, qint64 spacingMinutes)
The synthetic layout position of an event at sequence position ordinal, in the "layout
minute" units the timeline scale maps to pixels (TL-09). Ordinal / sequence mode lays events out evenly by their order rather than by date – each successive ordinal is spacingMinutes further along the axis – so a timeline is fully usable with zero dates entered. Computed in 64-bit so a large ordinal cannot overflow. Pure: no view is needed to test it.