Compare commits
8 Commits
830f8fe3e4
...
d141154a45
Author | SHA1 | Date | |
---|---|---|---|
d141154a45 | |||
6170647c0c | |||
48e45c7dd6 | |||
5d3d9229b7 | |||
d54e93d836 | |||
7b638538aa | |||
240effd305 | |||
f6f2acd67b |
@ -258,7 +258,7 @@ void PaletteEditorImGui::drawColorEditor() noexcept {
|
||||
std::ignore = pushCommand<ApplyColorAllPagesCommand>(
|
||||
m_pal, m_page, m_selectedColorRow);
|
||||
}
|
||||
if (!inputFocused && !m_pageRenameDlg.isOpen()) {
|
||||
if (ig::mainWinHasFocus()) {
|
||||
if (!ImGui::IsKeyDown(ImGuiKey_ModAlt)) {
|
||||
numShortcuts(m_selectedColorRow, largestPage(m_pal));
|
||||
} else {
|
||||
|
@ -445,7 +445,7 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept {
|
||||
}
|
||||
if (ig::DragDropTarget const dragDropTarget; dragDropTarget) {
|
||||
auto const [ref, err] = ig::getDragDropPayload<studio::FileRef>("FileRef");
|
||||
if (!err) {
|
||||
if (!err && endsWith(ref.path, FileExt_npal)) {
|
||||
if (ref.path != m_selectedPalette) {
|
||||
oxLogError(m_model.setPalette(ref.path));
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user