[studio] Cleanup
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <studio/imguiutil.hpp>
|
||||
|
||||
#include "makecopypopup.hpp"
|
||||
|
||||
namespace studio {
|
||||
@ -26,7 +28,7 @@ bool MakeCopyPopup::isOpen() const noexcept {
|
||||
return m_open;
|
||||
}
|
||||
|
||||
void MakeCopyPopup::draw(StudioContext const &ctx) noexcept {
|
||||
void MakeCopyPopup::draw(StudioContext &ctx) noexcept {
|
||||
switch (m_stage) {
|
||||
case Stage::Closed:
|
||||
break;
|
||||
|
@ -7,11 +7,12 @@
|
||||
#include <ox/std/string.hpp>
|
||||
|
||||
#include <studio/context.hpp>
|
||||
#include <studio/imguiutil.hpp>
|
||||
|
||||
#include <studio/widget.hpp>
|
||||
|
||||
namespace studio {
|
||||
|
||||
class MakeCopyPopup {
|
||||
class MakeCopyPopup: public Widget {
|
||||
private:
|
||||
enum class Stage {
|
||||
Closed,
|
||||
@ -36,7 +37,7 @@ class MakeCopyPopup {
|
||||
[[nodiscard]]
|
||||
bool isOpen() const noexcept;
|
||||
|
||||
void draw(StudioContext const &ctx) noexcept;
|
||||
void draw(StudioContext &ctx) noexcept override;
|
||||
|
||||
private:
|
||||
void accept(StudioContext const &ctx) noexcept;
|
||||
|
@ -159,15 +159,9 @@ void StudioUI::draw() noexcept {
|
||||
ImGui::SameLine();
|
||||
}
|
||||
drawTabBar();
|
||||
for (auto const&w : m_widgets) {
|
||||
for (auto const w : m_widgets) {
|
||||
w->draw(m_sctx);
|
||||
}
|
||||
for (auto const p : m_popups) {
|
||||
p->draw(m_sctx);
|
||||
}
|
||||
m_closeAppConfirm.draw(m_sctx);
|
||||
m_closeFileConfirm.draw(m_sctx);
|
||||
m_copyFilePopup.draw(m_sctx);
|
||||
}
|
||||
ImGui::End();
|
||||
handleKeyInput();
|
||||
@ -285,7 +279,6 @@ void StudioUI::drawTabs() noexcept {
|
||||
}
|
||||
if (!open) {
|
||||
if (e->unsavedChanges()) {
|
||||
m_closeAppConfirm.open();
|
||||
m_closeFileConfirm.open();
|
||||
++it;
|
||||
} else {
|
||||
@ -403,7 +396,6 @@ void StudioUI::handleKeyInput() noexcept {
|
||||
} else if (ImGui::IsKeyPressed(ImGuiKey_W)) {
|
||||
if (m_activeEditor) {
|
||||
if (m_activeEditor->unsavedChanges()) {
|
||||
m_closeAppConfirm.open();
|
||||
m_closeFileConfirm.open();
|
||||
} else {
|
||||
oxLogError(closeCurrentFile());
|
||||
|
@ -35,7 +35,6 @@ class StudioUI: public ox::SignalHandler {
|
||||
ox::UPtr<Project> m_project;
|
||||
TaskRunner m_taskRunner;
|
||||
ox::Vector<ox::UPtr<BaseEditor>> m_editors;
|
||||
ox::Vector<ox::UPtr<Widget>> m_widgets;
|
||||
ox::HashMap<ox::String, EditorMaker::Func> m_editorMakers;
|
||||
ProjectExplorer m_projectExplorer;
|
||||
ox::Vector<ox::String> m_openFiles;
|
||||
@ -57,6 +56,17 @@ class StudioUI: public ox::SignalHandler {
|
||||
RenameFile m_renameFile;
|
||||
NewProject m_newProject;
|
||||
AboutPopup m_aboutPopup;
|
||||
ox::Array<Widget*, 9> const m_widgets {
|
||||
&m_closeFileConfirm,
|
||||
&m_closeAppConfirm,
|
||||
&m_copyFilePopup,
|
||||
&m_newMenu,
|
||||
&m_newProject,
|
||||
&m_aboutPopup,
|
||||
&m_deleteConfirmation,
|
||||
&m_newDirDialog,
|
||||
&m_renameFile,
|
||||
};
|
||||
ox::Array<Popup*, 6> const m_popups = {
|
||||
&m_newMenu,
|
||||
&m_newProject,
|
||||
|
Reference in New Issue
Block a user