diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2021-10-30 10:08:11 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2021-10-30 10:08:11 -0400 |
commit | 12440b673f55eb4bfac5f553923de7ce9508a2a7 (patch) | |
tree | 3fdcace26104dd2b116774c385a23e724d245571 /source/file.cpp | |
parent | 41ae9b3b1b6a75d12c39f1186e6d6e644f834c6f (diff) |
new file on startup; styling; bug fixes
Diffstat (limited to 'source/file.cpp')
-rw-r--r-- | source/file.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/file.cpp b/source/file.cpp index 96dac0a..0f0015c 100644 --- a/source/file.cpp +++ b/source/file.cpp @@ -56,6 +56,12 @@ static void openCurrentFile() } } +void openNewFile() +{ + fileCurrentPath.clear(); + editor.SetText(stmdsp::file_content); +} + void fileScanTemplates() { auto path = std::filesystem::current_path() / "templates"; @@ -68,8 +74,7 @@ void fileRenderMenu() if (ImGui::BeginMenu("File")) { if (ImGui::MenuItem("New")) { // TODO modified? - fileCurrentPath.clear(); - editor.SetText(stmdsp::file_content); + openNewFile(); log("Ready."); } @@ -129,18 +134,13 @@ void fileRenderDialog() if (ImGuiFileDialog::Instance()->IsOk()) { std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName(); - switch (fileAction) { - case FileAction::None: - break; - case FileAction::Open: + if (fileAction == FileAction::Open) { fileCurrentPath = filePathName; openCurrentFile(); log("Ready."); - break; - case FileAction::SaveAs: + } else if (fileAction == FileAction::SaveAs) { fileCurrentPath = filePathName; saveCurrentFile(); - break; } } |