[nostalgia/core/studio] Reduce indent for Subsheet editor
This commit is contained in:
		@@ -191,7 +191,7 @@ void TileSheetEditorImGui::draw(turbine::Context&) noexcept {
 | 
				
			|||||||
			ImGui::SameLine();
 | 
								ImGui::SameLine();
 | 
				
			||||||
			if (ImGui::Button("-", btnSize)) {
 | 
								if (ImGui::Button("-", btnSize)) {
 | 
				
			||||||
				const auto &activeSubsheetIdx = m_model.activeSubSheetIdx();
 | 
									const auto &activeSubsheetIdx = m_model.activeSubSheetIdx();
 | 
				
			||||||
				if (activeSubsheetIdx.size() > 0) {
 | 
									if (!activeSubsheetIdx.empty()) {
 | 
				
			||||||
					m_model.rmSubsheet(activeSubsheetIdx);
 | 
										m_model.rmSubsheet(activeSubsheetIdx);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -207,9 +207,9 @@ void TileSheetEditorImGui::draw(turbine::Context&) noexcept {
 | 
				
			|||||||
			static constexpr auto flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody;
 | 
								static constexpr auto flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody;
 | 
				
			||||||
			if (ImGui::BeginTable("Subsheets", 4, flags)) {
 | 
								if (ImGui::BeginTable("Subsheets", 4, flags)) {
 | 
				
			||||||
				ImGui::TableSetupColumn("Subsheet", ImGuiTableColumnFlags_NoHide);
 | 
									ImGui::TableSetupColumn("Subsheet", ImGuiTableColumnFlags_NoHide);
 | 
				
			||||||
 | 
									ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_WidthFixed, 25);
 | 
				
			||||||
				ImGui::TableSetupColumn("Columns", ImGuiTableColumnFlags_WidthFixed, 50);
 | 
									ImGui::TableSetupColumn("Columns", ImGuiTableColumnFlags_WidthFixed, 50);
 | 
				
			||||||
				ImGui::TableSetupColumn("Rows", ImGuiTableColumnFlags_WidthFixed, 50);
 | 
									ImGui::TableSetupColumn("Rows", ImGuiTableColumnFlags_WidthFixed, 50);
 | 
				
			||||||
				ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_NoHide);
 | 
					 | 
				
			||||||
				ImGui::TableHeadersRow();
 | 
									ImGui::TableHeadersRow();
 | 
				
			||||||
				drawSubsheetSelector(m_view.img().subsheet, path);
 | 
									drawSubsheetSelector(m_view.img().subsheet, path);
 | 
				
			||||||
				ImGui::EndTable();
 | 
									ImGui::EndTable();
 | 
				
			||||||
@@ -223,6 +223,7 @@ void TileSheetEditorImGui::draw(turbine::Context&) noexcept {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TileSheetEditorImGui::drawSubsheetSelector(TileSheet::SubSheet &subsheet, TileSheet::SubSheetIdx &path) {
 | 
					void TileSheetEditorImGui::drawSubsheetSelector(TileSheet::SubSheet &subsheet, TileSheet::SubSheetIdx &path) {
 | 
				
			||||||
 | 
						constexpr auto indentReduce = 14;
 | 
				
			||||||
	ImGui::TableNextRow(0, 5);
 | 
						ImGui::TableNextRow(0, 5);
 | 
				
			||||||
	using Str = ox::BasicString<100>;
 | 
						using Str = ox::BasicString<100>;
 | 
				
			||||||
	auto pathStr = ox::join<Str>("##", path).value;
 | 
						auto pathStr = ox::join<Str>("##", path).value;
 | 
				
			||||||
@@ -242,6 +243,8 @@ void TileSheetEditorImGui::drawSubsheetSelector(TileSheet::SubSheet &subsheet, T
 | 
				
			|||||||
	if (ImGui::IsMouseDoubleClicked(0) && ImGui::IsItemHovered()) {
 | 
						if (ImGui::IsMouseDoubleClicked(0) && ImGui::IsItemHovered()) {
 | 
				
			||||||
		showSubsheetEditor();
 | 
							showSubsheetEditor();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						ImGui::TableNextColumn();
 | 
				
			||||||
 | 
						ImGui::Text("%d", subsheet.id);
 | 
				
			||||||
	if (subsheet.subsheets.empty()) {
 | 
						if (subsheet.subsheets.empty()) {
 | 
				
			||||||
		ImGui::TableNextColumn();
 | 
							ImGui::TableNextColumn();
 | 
				
			||||||
		ImGui::Text("%d", subsheet.columns);
 | 
							ImGui::Text("%d", subsheet.columns);
 | 
				
			||||||
@@ -253,13 +256,13 @@ void TileSheetEditorImGui::drawSubsheetSelector(TileSheet::SubSheet &subsheet, T
 | 
				
			|||||||
		ImGui::TableNextColumn();
 | 
							ImGui::TableNextColumn();
 | 
				
			||||||
		ImGui::Text("--");
 | 
							ImGui::Text("--");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	ImGui::TableNextColumn();
 | 
					 | 
				
			||||||
	ImGui::Text("%d", subsheet.id);
 | 
					 | 
				
			||||||
	if (open) {
 | 
						if (open) {
 | 
				
			||||||
		for (auto i = 0ul; auto &child : subsheet.subsheets) {
 | 
							for (auto i = 0ul; auto &child : subsheet.subsheets) {
 | 
				
			||||||
			path.push_back(i);
 | 
								path.push_back(i);
 | 
				
			||||||
			ImGui::PushID(static_cast<int>(i));
 | 
								ImGui::PushID(static_cast<int>(i));
 | 
				
			||||||
 | 
								ImGui::Indent(-indentReduce);
 | 
				
			||||||
			drawSubsheetSelector(child, path);
 | 
								drawSubsheetSelector(child, path);
 | 
				
			||||||
 | 
								ImGui::Indent(indentReduce);
 | 
				
			||||||
			ImGui::PopID();
 | 
								ImGui::PopID();
 | 
				
			||||||
			path.pop_back();
 | 
								path.pop_back();
 | 
				
			||||||
			++i;
 | 
								++i;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -213,7 +213,7 @@ bool TileSheetEditorModel::updated() const noexcept {
 | 
				
			|||||||
	return m_updated;
 | 
						return m_updated;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ox::Error TileSheetEditorModel::markUpdatedCmdId(const studio::UndoCommand *cmd) noexcept {
 | 
					ox::Error TileSheetEditorModel::markUpdatedCmdId(studio::UndoCommand const*cmd) noexcept {
 | 
				
			||||||
	m_updated = true;
 | 
						m_updated = true;
 | 
				
			||||||
	const auto cmdId = cmd->commandId();
 | 
						const auto cmdId = cmd->commandId();
 | 
				
			||||||
	if (static_cast<CommandId>(cmdId) == CommandId::PaletteChange) {
 | 
						if (static_cast<CommandId>(cmdId) == CommandId::PaletteChange) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -105,7 +105,7 @@ class TileSheetEditorModel: public ox::SignalHandler {
 | 
				
			|||||||
		[[nodiscard]]
 | 
							[[nodiscard]]
 | 
				
			||||||
		bool updated() const noexcept;
 | 
							bool updated() const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ox::Error markUpdatedCmdId(const studio::UndoCommand *cmd) noexcept;
 | 
							ox::Error markUpdatedCmdId(studio::UndoCommand const*cmd) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ox::Error markUpdated() noexcept;
 | 
							ox::Error markUpdated() noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -118,10 +118,9 @@ class TileSheetEditorModel: public ox::SignalHandler {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		bool pixelSelected(std::size_t idx) const noexcept;
 | 
							bool pixelSelected(std::size_t idx) const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected:
 | 
						private:
 | 
				
			||||||
		void getFillPixels(bool *pixels, ox::Point const&pt, int oldColor) const noexcept;
 | 
							void getFillPixels(bool *pixels, ox::Point const&pt, int oldColor) const noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private:
 | 
					 | 
				
			||||||
		void pushCommand(studio::UndoCommand *cmd) noexcept;
 | 
							void pushCommand(studio::UndoCommand *cmd) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user