Screenplay.h header
#include <ew/app/Screenplay.h>
Namespace ew::app
ScreenplayElement struct
struct ew::app::ScreenplayElement
One parsed screenplay element: its kind and its text (the visible content, with the Fountain markup that identifies the kind already stripped). Character and Dialogue elements carry the dual-dialogue flag so a side-by-side pair round-trips.
Members
ScreenplayElementType ew::app::ScreenplayElement::type =
The element kind.
QString ew::app::ScreenplayElement::text
The element's text (e.g. "INT. HOUSE - DAY", a character name, a line of dialogue).
bool ew::app::ScreenplayElement::dualDialogue = false
True when this element belongs to a dual (side-by-side) dialogue block: set on the second Character cue of the pair and on its Dialogue/Parenthetical lines.
int ew::app::ScreenplayElement::sectionLevel = 1
For a Section element, its Fountain outline depth: 1 for #, 2 for ##, 3 for ###, and so on (1 for every other element type). Preserved through parse/serialize so a section hierarchy survives a round trip (e.g. the Tidy-formatting command) instead of flattening to one level.
bool operator==(const ScreenplayElement &, const ScreenplayElement &)=default
Elements compare equal when every field matches.
TitlePageField struct
struct ew::app::TitlePageField
One title-page entry: a key ("Title", "Author", "Draft date", ...) and its value.
Members
QString ew::app::TitlePageField::key
The field key, as written (e.g. "Title").
QString ew::app::TitlePageField::value
The field value (multi-line values are joined with a space).
bool operator==(const TitlePageField &, const TitlePageField &)=default
Fields compare equal when both parts match.
Functions
QString ew::app::autoFormatFountain(const QString &text)
Tidies text to industry case convention: scene headings, character cues, and transitions are upper-cased in the Fountain source (so the change carries into the editor, saves, and .fdx / Fountain export – not only the on-screen preview). Action, dialogue, parentheticals, and any leading title page are left untouched, and the element structure is preserved. Backs the editor's "Tidy Screenplay Formatting" command.
QString ew::app::cycleScreenplayLine(const QString &line, bool forward)
Rewrites a single Fountain source line to the next element type in the industry Tab cycle (Action -> Scene Heading -> Character -> Transition -> Action), or the previous type when forward is false. The line's force marker (a leading '.', '@', '>', or '!') and any natural scene-heading/transition shape are read to find the current type; the bare text is preserved and re-emitted with just the markup the new type needs. Backs the editor's Tab / Shift+Tab element cycling for screenplay documents.
std::vector< ScreenplayElement > ew::app::parseFountain(const QString &text)
Parses Fountain-formatted screenplay text into a list of elements. A leading title-page block (see parseTitlePage) is skipped so the elements are the script body only. Recognizes scene headings (INT./EXT./EST. or a forced ".slug"), transitions (uppercase "... TO:" or a forced ">"), character cues (uppercase names or a forced "@name", with a trailing "^" marking dual dialogue), dialogue, parentheticals, centered text ("> ... <"), section headings ("#"), synopses ("="), forced page breaks ("==="), forced action ("!"), and action for everything else. Blank lines separate blocks.
std::vector< TitlePageField > ew::app::parseTitlePage(const QString &text)
Parses the Fountain title page – the leading "Key: Value" block at the top of text, present only when the first line's key is a recognized title-page key (Title, Credit, Author(s), Source, Draft date, Date, Contact, Copyright, Notes, Revision, ...). Returns the fields in order, or an empty list when there is no title page. Indented continuation lines extend the previous value.
std::vector< bool > ew::app::revisedElements(const std::vector< ScreenplayElement > ¤t, const std::vector< ScreenplayElement > &baseline)
Flags which of current's elements are revised relative to baseline (the script as of the last marked revision), via a longest-common-subsequence diff on element identity (type + text): the returned vector is parallel to current, true where an element is inserted or changed and false where it survives unchanged from the baseline. An empty baseline marks nothing (there is no prior draft to compare against). Backs the change marks ("*") shown on revised script lines.
QString ew::app::screenplayCastName(const QString &cue)
Returns a Character cue's cue text without a trailing cue extension such as "(V.O.)", "(O.S.)", or "(CONT'D)", so the same character is identified consistently whatever their cue modifier. Shared by the scene/character reports and the production breakdown so both agree on who a line belongs to.
QString ew::app::toFountain(const std::vector< ScreenplayElement > &elements)
Serializes elements back to Fountain text, forcing markup where an element would otherwise be misread on re-parse, so parseFountain(toFountain(x)) preserves the element structure.