ManuscriptTree.h header
#include <ew/core/ManuscriptTree.h>
Namespace ew::core
Functions
ContentId ew::core::corkboardContainer(const Project &project, ContentId selected)
The container whose children a corkboard should show for the current selection: the selected document if it has children, otherwise the selected document's parent (so a leaf shows its siblings). A null selection – or a leaf with no parent – yields a null id, meaning the top level.
int ew::core::dropInsertionIndex(const Project &project, ContentId documentId, ContentId newParentId, int row)
The insertion index to pass to MoveDocumentCommand for a drag that drops documentId under newParentId at visual position row (or -1 to append). When the document stays under the same parent it is removed from the list before reinsertion, so a drop below its current position is shifted up by one; cross-parent drops are used as given.
ContentId ew::core::findChildDocumentByTitle(const Project &project, ContentId parentId, const QString &title)
The id of the child document of parentId (top-level if it is null) whose title is exactly title, or a null id if none matches. Used to find-or-create well-known documents such as the daily-notes folder and a given day's note.
std::vector< ContentId > ew::core::orderedChildDocumentIds(const Project &project, ContentId parentId)
The ids of the documents whose parent is parentId (top-level documents if it is null), in manuscript-tree order: ascending sort index, then title, then id. This is the single source of truth for sibling order, shared by the document tree model and the commands that reorder documents, so a manuscript reads the same everywhere.