Skip to content

Editor → User Interface → start_screen.h

ui::start_screen

Syntax

class CONJURE_API start_screen final

Constructors

AccessSignatureDescription
publicstart_screen();

Important

Additional constructor overloads have been deleted.

Destructors

AccessSignatureDescription
public~start_screen();

Variables

AccessNameTypeDefaultDescription
publicCREATE_KEYstatic constexpr std::string_view"create_project"
privatemEntriesstd::vector<start_screen_entry>{}
privatemListedboolfalse
privatemListedFromstd::vector<recent_project>{}
privatemNewFolderstd::string""
privatemNewNamestd::string""
privatemNewProblemstd::string""
privatemOpenPathstd::string""
privatemOpenProblemstd::string""
privatemRecentProblemstd::string""
privatemStartupProblemTakenboolfalse
publicNEW_FOLDER_KEYstatic constexpr std::string_view"new_folder"
publicNEW_NAME_KEYstatic constexpr std::string_view"new_name"
publicOPEN_KEYstatic constexpr std::string_view"open_project"
publicOPEN_PATH_KEYstatic constexpr std::string_view"open_path"The kit keys of the screen's fields and buttons, as the frame record lists them (a field's key is its hidden label, "##open_path"). A recent project's Open and Remove are RECENT_OPEN_KEY and RECENT_REMOVE_KEY under the id scope of its index (kit::id_scope).
publicRECENT_OPEN_KEYstatic constexpr std::string_view"open"
publicRECENT_REMOVE_KEYstatic constexpr std::string_view"remove"
publicWINDOW_NAMEstatic constexpr const char *"Start###conjure_start_screen"The ImGui window name of the screen.

Functions

Public

create_project

[[nodiscard]] core::result<void> create_project(
    editor_context &context,
    std::string_view parentFolder,
    std::string_view name);

What New does: checks the name and the folder to create the project in, sends project.create for <parentFolder>/<name>, then project.open. On failure the sentence is kept (new_problem()) and the error returned: INVALID_ARGUMENT, NOT_FOUND or ALREADY_EXISTS from the check, or the failing command's error.

draw

void draw(
    editor_context &context);

Draws the screen over the main viewport's work area (between the menu bar and the status bar). Does nothing outside an ImGui frame. The first draw in a frame takes the host's startup problem (why --project could not be opened) as the Open problem, so the screen says it until the next Open attempt; drawing needs a current kit context, without which nothing is drawn.

entries

[[nodiscard]] std::span<const start_screen_entry> entries() const noexcept;

The recent projects as listed (refresh() or the last draw()).

new_problem

[[nodiscard]] const std::string &new_problem() const noexcept;

open_problem

[[nodiscard]] const std::string &open_problem() const noexcept;

The last problem of Open, New and the recent list ("" when the last attempt worked).

open_project

[[nodiscard]] core::result<void> open_project(
    editor_context &context,
    std::string_view folder);

What Open does: checks the typed folder (a project's folder, or its project.json; quotes around it are dropped) and sends project.open. On failure the sentence for the user is kept (open_problem()) and the error returned: INVALID_ARGUMENT or NOT_FOUND from the check, or the command's error.

open_recent

[[nodiscard]] core::result<void> open_recent(
    editor_context &context,
    usize index);

Opens the recent project at index of entries() as open_project() does. OUT_OF_RANGE for an index past the list; NOT_FOUND, and the problem kept (recent_problem()), for a project that is missing.

recent_problem

[[nodiscard]] const std::string &recent_problem() const noexcept;

refresh

void refresh(
    editor_context &context);

Rebuilds the list from the context's recent projects and checks again which folders still hold a project. The list is also rebuilt by itself whenever the recent projects change; the disk is read only then, never every frame.

remove_recent

[[nodiscard]] core::result<void> remove_recent(
    editor_context &context,
    const std::filesystem::path &root);

Removes a project from the recent list: from the context's settings and, when the editor has a user configuration folder, from editor_settings.json (a read-modify-write, update_user_settings, so the lists of other editors are kept). NOT_FOUND when the root is not listed; the file's error when it cannot be written (the project then leaves this session's list only, and the problem is kept).

Private

draw_new

void draw_new(
    editor_context &context,
    bool busy);

draw_open

void draw_open(
    editor_context &context,
    bool busy);

draw_recent

void draw_recent(
    editor_context &context);

sync_entries

void sync_entries(
    editor_context &context);

take_startup_problem

void take_startup_problem(
    editor_context &context);