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>(
 | 
							std::ignore = pushCommand<ApplyColorAllPagesCommand>(
 | 
				
			||||||
				m_pal, m_page, m_selectedColorRow);
 | 
									m_pal, m_page, m_selectedColorRow);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!inputFocused && !m_pageRenameDlg.isOpen()) {
 | 
						if (ig::mainWinHasFocus()) {
 | 
				
			||||||
		if (!ImGui::IsKeyDown(ImGuiKey_ModAlt)) {
 | 
							if (!ImGui::IsKeyDown(ImGuiKey_ModAlt)) {
 | 
				
			||||||
			numShortcuts(m_selectedColorRow, largestPage(m_pal));
 | 
								numShortcuts(m_selectedColorRow, largestPage(m_pal));
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -445,7 +445,7 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	if (ig::DragDropTarget const dragDropTarget; dragDropTarget) {
 | 
						if (ig::DragDropTarget const dragDropTarget; dragDropTarget) {
 | 
				
			||||||
		auto const [ref, err] = ig::getDragDropPayload<studio::FileRef>("FileRef");
 | 
							auto const [ref, err] = ig::getDragDropPayload<studio::FileRef>("FileRef");
 | 
				
			||||||
		if (!err) {
 | 
							if (!err && endsWith(ref.path, FileExt_npal)) {
 | 
				
			||||||
			if (ref.path != m_selectedPalette) {
 | 
								if (ref.path != m_selectedPalette) {
 | 
				
			||||||
				oxLogError(m_model.setPalette(ref.path));
 | 
									oxLogError(m_model.setPalette(ref.path));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,13 +39,15 @@ void NewDir::draw(StudioContext &ctx) noexcept {
 | 
				
			|||||||
		case Stage::Opening:
 | 
							case Stage::Opening:
 | 
				
			||||||
			ImGui::OpenPopup(title().c_str());
 | 
								ImGui::OpenPopup(title().c_str());
 | 
				
			||||||
			m_open = true;
 | 
								m_open = true;
 | 
				
			||||||
 | 
								m_stage = Stage::Open;
 | 
				
			||||||
		[[fallthrough]];
 | 
							[[fallthrough]];
 | 
				
			||||||
		case Stage::Open:
 | 
							case Stage::Open:
 | 
				
			||||||
			drawWindow(ctx.tctx, m_open, [this] {
 | 
								drawWindow(ctx.tctx, m_open, [this] {
 | 
				
			||||||
				if (m_stage == Stage::Opening) {
 | 
									if (ImGui::IsWindowAppearing()) {
 | 
				
			||||||
					ImGui::SetKeyboardFocusHere();
 | 
										ImGui::SetKeyboardFocusHere();
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				ig::InputText("Name", m_str);
 | 
									ig::InputText("Name", m_str);
 | 
				
			||||||
 | 
									ImGui::SetItemDefaultFocus();
 | 
				
			||||||
				if (ImGui::IsItemFocused() && ImGui::IsKeyPressed(ImGuiKey_Enter)) {
 | 
									if (ImGui::IsItemFocused() && ImGui::IsKeyPressed(ImGuiKey_Enter)) {
 | 
				
			||||||
					newDir.emit(m_path + "/" + m_str);
 | 
										newDir.emit(m_path + "/" + m_str);
 | 
				
			||||||
					close();
 | 
										close();
 | 
				
			||||||
@@ -55,7 +57,6 @@ void NewDir::draw(StudioContext &ctx) noexcept {
 | 
				
			|||||||
					close();
 | 
										close();
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
			m_stage = Stage::Open;
 | 
					 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace studio {
 | 
					namespace studio {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace ig {
 | 
				
			||||||
 | 
					extern bool s_mainWinHasFocus;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
static ox::Vector<Module const*> modules;
 | 
					static ox::Vector<Module const*> modules;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void registerModule(Module const*mod) noexcept {
 | 
					void registerModule(Module const*mod) noexcept {
 | 
				
			||||||
@@ -102,23 +105,26 @@ void StudioUI::handleKeyEvent(turbine::Key const key, bool const down) noexcept
 | 
				
			|||||||
void StudioUI::draw() noexcept {
 | 
					void StudioUI::draw() noexcept {
 | 
				
			||||||
	glutils::clearScreen();
 | 
						glutils::clearScreen();
 | 
				
			||||||
	drawMenu();
 | 
						drawMenu();
 | 
				
			||||||
	auto const viewport = ImGui::GetMainViewport();
 | 
						auto const&viewport = *ImGui::GetMainViewport();
 | 
				
			||||||
	constexpr auto menuHeight = 18;
 | 
						ImGui::SetNextWindowPos(viewport.WorkPos);
 | 
				
			||||||
	ImGui::SetNextWindowPos(ImVec2(viewport->Pos.x, viewport->Pos.y + menuHeight));
 | 
						ImGui::SetNextWindowSize(viewport.WorkSize);
 | 
				
			||||||
	ImGui::SetNextWindowSize(ImVec2(viewport->Size.x, viewport->Size.y - menuHeight));
 | 
						ImGui::SetNextWindowViewport(viewport.ID);
 | 
				
			||||||
	constexpr auto windowFlags = ImGuiWindowFlags_NoTitleBar
 | 
						auto constexpr windowFlags =
 | 
				
			||||||
	                           | ImGuiWindowFlags_NoResize
 | 
							ImGuiWindowFlags_NoTitleBar |
 | 
				
			||||||
	                           | ImGuiWindowFlags_NoMove
 | 
							ImGuiWindowFlags_NoResize |
 | 
				
			||||||
	                           | ImGuiWindowFlags_NoScrollbar
 | 
							ImGuiWindowFlags_NoMove |
 | 
				
			||||||
	                           | ImGuiWindowFlags_NoSavedSettings;
 | 
							ImGuiWindowFlags_NoScrollbar |
 | 
				
			||||||
 | 
							ImGuiWindowFlags_NoSavedSettings;
 | 
				
			||||||
	ImGui::Begin("MainWindow##Studio", nullptr, windowFlags);
 | 
						ImGui::Begin("MainWindow##Studio", nullptr, windowFlags);
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							ig::s_mainWinHasFocus = ImGui::IsWindowFocused(
 | 
				
			||||||
 | 
								ImGuiFocusedFlags_RootAndChildWindows | ImGuiFocusedFlags_NoPopupHierarchy);
 | 
				
			||||||
		if (m_showProjectExplorer) {
 | 
							if (m_showProjectExplorer) {
 | 
				
			||||||
			m_projectExplorer.draw(m_sctx);
 | 
								m_projectExplorer.draw(m_sctx);
 | 
				
			||||||
			ImGui::SameLine();
 | 
								ImGui::SameLine();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		drawTabBar();
 | 
							drawTabBar();
 | 
				
			||||||
		for (auto &w: m_widgets) {
 | 
							for (auto const&w : m_widgets) {
 | 
				
			||||||
			w->draw(m_sctx);
 | 
								w->draw(m_sctx);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		for (auto const p : m_popups) {
 | 
							for (auto const p : m_popups) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -256,4 +256,7 @@ class FilePicker {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[nodiscard]]
 | 
				
			||||||
 | 
					bool mainWinHasFocus() noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -208,4 +208,9 @@ void FilePicker::show() noexcept {
 | 
				
			|||||||
	m_show = true;
 | 
						m_show = true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool s_mainWinHasFocus{};
 | 
				
			||||||
 | 
					bool mainWinHasFocus() noexcept {
 | 
				
			||||||
 | 
						return s_mainWinHasFocus;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user