This commit is contained in:
@@ -45,11 +45,11 @@ OX_MODEL_BEGIN(PageDragDrop)
|
||||
OX_MODEL_FIELD(page)
|
||||
OX_MODEL_END()
|
||||
|
||||
void PaletteEditorImGui::PageRenameDialog::draw(turbine::Context &tctx) noexcept {
|
||||
void PaletteEditorImGui::PageRenameDialog::draw() noexcept {
|
||||
if (!m_show) {
|
||||
return;
|
||||
}
|
||||
if (ig::BeginPopup(tctx, "Rename Page", m_show)) {
|
||||
if (ig::BeginPopup("Rename Page", m_show)) {
|
||||
if (ImGui::IsWindowAppearing()) {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
}
|
||||
@@ -91,7 +91,7 @@ void PaletteEditorImGui::draw(studio::Context&) noexcept {
|
||||
drawColorsEditor();
|
||||
ImGui::EndChild();
|
||||
}
|
||||
m_pageRenameDlg.draw(m_tctx);
|
||||
m_pageRenameDlg.draw();
|
||||
}
|
||||
|
||||
ox::Error PaletteEditorImGui::saveItem() noexcept {
|
||||
|
||||
@@ -29,7 +29,7 @@ class PaletteEditorImGui: public studio::Editor {
|
||||
}
|
||||
[[nodiscard]]
|
||||
constexpr bool isOpen() const noexcept { return m_show; }
|
||||
void draw(turbine::Context &tctx) noexcept;
|
||||
void draw() noexcept;
|
||||
} m_pageRenameDlg;
|
||||
studio::Context &m_sctx;
|
||||
turbine::Context &m_tctx;
|
||||
|
||||
@@ -268,8 +268,8 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept {
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
m_subsheetEditor.draw(m_tctx);
|
||||
m_exportMenu.draw(m_tctx);
|
||||
m_subsheetEditor.draw();
|
||||
m_exportMenu.draw();
|
||||
if (auto pal = m_palPicker.draw(m_sctx)) {
|
||||
if (*pal != m_model.palPath()) {
|
||||
oxLogError(m_model.setPalette(*pal));
|
||||
@@ -560,7 +560,7 @@ void TileSheetEditorImGui::SubSheetEditor::show(ox::StringViewCR name, int const
|
||||
m_rows = rows;
|
||||
}
|
||||
|
||||
void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &tctx) noexcept {
|
||||
void TileSheetEditorImGui::SubSheetEditor::draw() noexcept {
|
||||
constexpr auto popupName = "Edit Subsheet";
|
||||
if (!m_show) {
|
||||
return;
|
||||
@@ -569,7 +569,7 @@ void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &tctx) noexcept
|
||||
auto constexpr popupWidth = 235.f;
|
||||
auto const popupHeight = modSize ? 130.f : 85.f;
|
||||
auto const popupSz = ImVec2{popupWidth, popupHeight};
|
||||
if (ig::BeginPopup(tctx, popupName, m_show, popupSz)) {
|
||||
if (ig::BeginPopup(popupName, m_show, popupSz)) {
|
||||
ig::InputText("Name", m_name);
|
||||
if (modSize) {
|
||||
ImGui::InputInt("Columns", &m_cols);
|
||||
@@ -592,7 +592,7 @@ void TileSheetEditorImGui::ExportMenu::show() noexcept {
|
||||
m_scale = 5;
|
||||
}
|
||||
|
||||
void TileSheetEditorImGui::ExportMenu::draw(turbine::Context &tctx) noexcept {
|
||||
void TileSheetEditorImGui::ExportMenu::draw() noexcept {
|
||||
constexpr auto popupName = "Export Tile Sheet";
|
||||
if (!m_show) {
|
||||
return;
|
||||
@@ -600,7 +600,7 @@ void TileSheetEditorImGui::ExportMenu::draw(turbine::Context &tctx) noexcept {
|
||||
auto constexpr popupWidth = 235.f;
|
||||
auto constexpr popupHeight = 85.f;
|
||||
auto constexpr popupSz = ImVec2{popupWidth, popupHeight};
|
||||
if (ig::BeginPopup(tctx, popupName, m_show, popupSz)) {
|
||||
if (ig::BeginPopup(popupName, m_show, popupSz)) {
|
||||
ImGui::InputInt("Scale", &m_scale);
|
||||
m_scale = ox::clamp(m_scale, 1, 135);
|
||||
if (ig::PopupControlsOkCancel(m_show) == ig::PopupResponse::OK) {
|
||||
|
||||
@@ -27,7 +27,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
||||
public:
|
||||
ox::Signal<ox::Error(ox::StringViewCR name, int cols, int rows)> inputSubmitted;
|
||||
void show(ox::StringViewCR name, int cols, int rows) noexcept;
|
||||
void draw(turbine::Context &tctx) noexcept;
|
||||
void draw() noexcept;
|
||||
void close() noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr bool isOpen() const noexcept { return m_show; }
|
||||
@@ -39,7 +39,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
||||
public:
|
||||
ox::Signal<ox::Error(int scale)> inputSubmitted;
|
||||
void show() noexcept;
|
||||
void draw(turbine::Context &tctx) noexcept;
|
||||
void draw() noexcept;
|
||||
void close() noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr bool isOpen() const noexcept { return m_show; }
|
||||
|
||||
@@ -22,7 +22,7 @@ AboutPopup::AboutPopup(turbine::Context &ctx) noexcept:
|
||||
#endif
|
||||
}
|
||||
|
||||
void AboutPopup::draw(Context &sctx) noexcept {
|
||||
void AboutPopup::draw(Context&) noexcept {
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
||||
close();
|
||||
return;
|
||||
@@ -37,7 +37,7 @@ void AboutPopup::draw(Context &sctx) noexcept {
|
||||
case Stage::Open: {
|
||||
constexpr auto modalFlags =
|
||||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
ig::centerNextWindow(sctx.tctx);
|
||||
ig::centerNextWindow();
|
||||
auto open = true;
|
||||
if (ImGui::BeginPopupModal("About", &open, modalFlags)) {
|
||||
ImGui::Text("%s\n\nBuild date: %s", m_text.c_str(), __DATE__);
|
||||
|
||||
@@ -37,7 +37,7 @@ ox::Error FileInfo::open(ox::StringParam filePath) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
void FileInfo::draw(Context &sctx) noexcept {
|
||||
void FileInfo::draw(Context&) noexcept {
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
||||
close();
|
||||
return;
|
||||
@@ -52,7 +52,7 @@ void FileInfo::draw(Context &sctx) noexcept {
|
||||
case Stage::Open: {
|
||||
constexpr auto modalFlags =
|
||||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
ig::centerNextWindow(sctx.tctx);
|
||||
ig::centerNextWindow();
|
||||
auto open = true;
|
||||
if (ImGui::BeginPopupModal(m_title.c_str(), &open, modalFlags)) {
|
||||
drawTable();
|
||||
|
||||
@@ -39,7 +39,7 @@ void MakeCopyPopup::draw(Context &ctx) noexcept {
|
||||
[[fallthrough]];
|
||||
case Stage::Open: {
|
||||
auto const scale = ig::dpiScale();
|
||||
ig::centerNextWindow(ctx.tctx);
|
||||
ig::centerNextWindow();
|
||||
ImGui::SetNextWindowSize({250 * scale, 0});
|
||||
constexpr auto modalFlags =
|
||||
ImGuiWindowFlags_NoCollapse |
|
||||
|
||||
@@ -157,7 +157,7 @@ class IndentStackItem {
|
||||
~IndentStackItem() noexcept;
|
||||
};
|
||||
|
||||
void centerNextWindow(turbine::Context &ctx) noexcept;
|
||||
void centerNextWindow() noexcept;
|
||||
|
||||
inline void Dummy(ImVec2 const &sz) noexcept {
|
||||
auto const scale = dpiScale();
|
||||
@@ -252,7 +252,7 @@ PopupResponse PopupControlsOk(
|
||||
ox::CStringViewCR ok);
|
||||
|
||||
[[nodiscard]]
|
||||
bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show, ImVec2 sz = {285, 0});
|
||||
bool BeginPopup(ox::CStringViewCR popupName, bool &show, ImVec2 sz = {285, 0});
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -86,7 +86,7 @@ ox::Optional<ox::String> FilePickerPopup::draw(Context &ctx) noexcept {
|
||||
return out;
|
||||
}
|
||||
auto const scale = turbine::scale(ctx.tctx);
|
||||
if (ig::BeginPopup(ctx.tctx, m_name, m_open, {380, 340})) {
|
||||
if (ig::BeginPopup(m_name, m_open, {380, 340})) {
|
||||
auto const vp = ImGui::GetContentRegionAvail();
|
||||
m_explorer.draw(ctx, {vp.x, vp.y - 30 * scale});
|
||||
if (ig::PopupControlsOkCancel(m_open) == ig::PopupResponse::OK || m_explorer.opened) {
|
||||
|
||||
@@ -60,7 +60,7 @@ IndentStackItem::~IndentStackItem() noexcept {
|
||||
}
|
||||
|
||||
|
||||
void centerNextWindow(turbine::Context&) noexcept {
|
||||
void centerNextWindow() noexcept {
|
||||
auto const &io = ImGui::GetIO();
|
||||
auto const sz = io.DisplaySize;
|
||||
ImGui::SetNextWindowPos(
|
||||
@@ -124,10 +124,10 @@ PopupResponse PopupControlsOk(
|
||||
return out;
|
||||
}
|
||||
|
||||
bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show, ImVec2 sz) {
|
||||
bool BeginPopup(ox::CStringViewCR popupName, bool &show, ImVec2 sz) {
|
||||
scaleSz(sz);
|
||||
constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
centerNextWindow(ctx);
|
||||
centerNextWindow();
|
||||
ImGui::OpenPopup(popupName.c_str());
|
||||
ImGui::SetNextWindowSize(sz);
|
||||
return ImGui::BeginPopupModal(popupName.c_str(), &show, modalFlags);
|
||||
@@ -255,7 +255,7 @@ void FilePicker::draw() noexcept {
|
||||
}
|
||||
auto constexpr popupSz = ImVec2{450.f, 0};
|
||||
IDStackItem const idStackItem(m_title);
|
||||
if (BeginPopup(m_sctx.tctx, m_title, m_show, popupSz)) {
|
||||
if (BeginPopup(m_title, m_show, popupSz)) {
|
||||
auto const &list = m_sctx.project->fileList(m_fileExt);
|
||||
size_t selIdx{};
|
||||
ComboBox(m_title, list, selIdx);
|
||||
@@ -310,7 +310,7 @@ void QuestionPopup::draw(Context &ctx) noexcept {
|
||||
turbine::requireRefreshFor(ctx.tctx, 1000);
|
||||
[[fallthrough]];
|
||||
case Stage::Open:
|
||||
centerNextWindow(ctx.tctx);
|
||||
centerNextWindow();
|
||||
ImGui::SetNextWindowSize({});
|
||||
constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
if (ImGui::BeginPopupModal(m_title.c_str(), &m_open, modalFlags)) {
|
||||
@@ -345,7 +345,7 @@ void MessagePopup::show(ox::StringParam msg) noexcept {
|
||||
open();
|
||||
}
|
||||
|
||||
void MessagePopup::draw(Context &ctx) noexcept {
|
||||
void MessagePopup::draw(Context&) noexcept {
|
||||
switch (m_stage) {
|
||||
case Stage::Closed:
|
||||
break;
|
||||
@@ -355,7 +355,7 @@ void MessagePopup::draw(Context &ctx) noexcept {
|
||||
m_open = true;
|
||||
[[fallthrough]];
|
||||
case Stage::Open:
|
||||
centerNextWindow(ctx.tctx);
|
||||
centerNextWindow();
|
||||
ImGui::SetNextWindowSize({});
|
||||
constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
if (ImGui::BeginPopupModal(m_title.c_str(), &m_open, modalFlags)) {
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
namespace studio {
|
||||
|
||||
void Popup::drawWindow(turbine::Context &ctx, bool &open, std::function<void()> const &drawContents) {
|
||||
ig::centerNextWindow(ctx);
|
||||
void Popup::drawWindow(turbine::Context&, bool &open, std::function<void()> const &drawContents) {
|
||||
ig::centerNextWindow();
|
||||
ImGui::SetNextWindowSize(static_cast<ImVec2>(m_size * ig::dpiScale()));
|
||||
constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
if (ImGui::BeginPopupModal(m_title.c_str(), &open, modalFlags)) {
|
||||
|
||||
Reference in New Issue
Block a user