Squashed 'deps/nostalgia/' changes from 830f8fe3..672b92b3
672b92b3 [nostalgia/gfx/studio] Remove accidental version tag in default Palette 762a6517 [nostalgia] Rename core to gfx d141154a Merge commit '38777cfac8868b3628332090260710d5ac26aba0' 6170647c [nostalgia,studio] Proper fix for input filtering 48e45c7d [studio] Cleanup 5d3d9229 [nostalgia/core/studio/paletteeditor] Ignore keyboard input when popup is open d54e93d8 [studio] Cleanup 7b638538 Merge commit '8e0b6ffbabb10f8a6e9ad7e9f07e0ba1d039a02e' 240effd3 Merge commit '7e20f7200963cd0b22f84cc46e10db12b6c13806' f6f2acd6 [nostalgia/core/studio/tilesheeteditor] Add back file type check for palette drop git-subtree-dir: deps/nostalgia git-subtree-split: 672b92b363a2047c4c8ce93fb3d88001a76da35f
This commit is contained in:
@@ -39,13 +39,15 @@ void NewDir::draw(StudioContext &ctx) noexcept {
|
||||
case Stage::Opening:
|
||||
ImGui::OpenPopup(title().c_str());
|
||||
m_open = true;
|
||||
m_stage = Stage::Open;
|
||||
[[fallthrough]];
|
||||
case Stage::Open:
|
||||
drawWindow(ctx.tctx, m_open, [this] {
|
||||
if (m_stage == Stage::Opening) {
|
||||
if (ImGui::IsWindowAppearing()) {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
}
|
||||
ig::InputText("Name", m_str);
|
||||
ImGui::SetItemDefaultFocus();
|
||||
if (ImGui::IsItemFocused() && ImGui::IsKeyPressed(ImGuiKey_Enter)) {
|
||||
newDir.emit(m_path + "/" + m_str);
|
||||
close();
|
||||
@@ -55,7 +57,6 @@ void NewDir::draw(StudioContext &ctx) noexcept {
|
||||
close();
|
||||
}
|
||||
});
|
||||
m_stage = Stage::Open;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,9 @@
|
||||
|
||||
namespace studio {
|
||||
|
||||
namespace ig {
|
||||
extern bool s_mainWinHasFocus;
|
||||
}
|
||||
static ox::Vector<Module const*> modules;
|
||||
|
||||
void registerModule(Module const*mod) noexcept {
|
||||
@@ -102,26 +105,29 @@ void StudioUI::handleKeyEvent(turbine::Key const key, bool const down) noexcept
|
||||
void StudioUI::draw() noexcept {
|
||||
glutils::clearScreen();
|
||||
drawMenu();
|
||||
auto const viewport = ImGui::GetMainViewport();
|
||||
constexpr auto menuHeight = 18;
|
||||
ImGui::SetNextWindowPos(ImVec2(viewport->Pos.x, viewport->Pos.y + menuHeight));
|
||||
ImGui::SetNextWindowSize(ImVec2(viewport->Size.x, viewport->Size.y - menuHeight));
|
||||
constexpr auto windowFlags = ImGuiWindowFlags_NoTitleBar
|
||||
| ImGuiWindowFlags_NoResize
|
||||
| ImGuiWindowFlags_NoMove
|
||||
| ImGuiWindowFlags_NoScrollbar
|
||||
| ImGuiWindowFlags_NoSavedSettings;
|
||||
auto const&viewport = *ImGui::GetMainViewport();
|
||||
ImGui::SetNextWindowPos(viewport.WorkPos);
|
||||
ImGui::SetNextWindowSize(viewport.WorkSize);
|
||||
ImGui::SetNextWindowViewport(viewport.ID);
|
||||
auto constexpr windowFlags =
|
||||
ImGuiWindowFlags_NoTitleBar |
|
||||
ImGuiWindowFlags_NoResize |
|
||||
ImGuiWindowFlags_NoMove |
|
||||
ImGuiWindowFlags_NoScrollbar |
|
||||
ImGuiWindowFlags_NoSavedSettings;
|
||||
ImGui::Begin("MainWindow##Studio", nullptr, windowFlags);
|
||||
{
|
||||
ig::s_mainWinHasFocus = ImGui::IsWindowFocused(
|
||||
ImGuiFocusedFlags_RootAndChildWindows | ImGuiFocusedFlags_NoPopupHierarchy);
|
||||
if (m_showProjectExplorer) {
|
||||
m_projectExplorer.draw(m_sctx);
|
||||
ImGui::SameLine();
|
||||
}
|
||||
drawTabBar();
|
||||
for (auto &w: m_widgets) {
|
||||
for (auto const&w : m_widgets) {
|
||||
w->draw(m_sctx);
|
||||
}
|
||||
for (auto const p: m_popups) {
|
||||
for (auto const p : m_popups) {
|
||||
p->draw(m_sctx);
|
||||
}
|
||||
}
|
||||
|
@@ -256,4 +256,7 @@ class FilePicker {
|
||||
|
||||
};
|
||||
|
||||
[[nodiscard]]
|
||||
bool mainWinHasFocus() noexcept;
|
||||
|
||||
}
|
||||
|
@@ -208,4 +208,9 @@ void FilePicker::show() noexcept {
|
||||
m_show = true;
|
||||
}
|
||||
|
||||
bool s_mainWinHasFocus{};
|
||||
bool mainWinHasFocus() noexcept {
|
||||
return s_mainWinHasFocus;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user