File ▸ New. Modelled on DoOpenDocumentLocale() below, which is the working sibling: canvas
replaces the document, and this side refreshes the page bar, which does not watch for it.
The new document's size, type and page colour come from the page preference — canvas reads
page_defaults inside new_document() and page creation, so there is nothing to pass here and
nothing to ask the user. An unset preference still gives a single A4 page, because the fields
arrive as undefined and NewDocument's own parameter defaults stand.
Unsaved changes are deliberately not handled here. Auto-save is being built separately and is
where "is this document safe to discard" belongs; a prompt added now would be thrown away, and
until then two mechanisms would disagree about the answer.
File ▸ New. Modelled on DoOpenDocumentLocale() below, which is the working sibling: canvas replaces the document, and this side refreshes the page bar, which does not watch for it.
The new document's size, type and page colour come from the page preference — canvas reads page_defaults inside new_document() and page creation, so there is nothing to pass here and nothing to ask the user. An unset preference still gives a single A4 page, because the fields arrive as undefined and NewDocument's own parameter defaults stand.
Unsaved changes are deliberately not handled here. Auto-save is being built separately and is where "is this document safe to discard" belongs; a prompt added now would be thrown away, and until then two mechanisms would disagree about the answer.