Compare commits
No commits in common. "d68e64931b37d7d8bbaff7b43bf131c7acf2aa97" and "500b93562c946576f16938e49301746d8ed9f8a5" have entirely different histories.
d68e64931b
...
500b93562c
@ -443,16 +443,6 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept {
|
||||
if (ig::ComboBox("Palette", files, m_selectedPaletteIdx)) {
|
||||
oxLogError(m_model.setPalette(files[m_selectedPaletteIdx]));
|
||||
}
|
||||
if (ig::DragDropTarget const dragDropTarget; dragDropTarget) {
|
||||
auto const [ref, err] = ig::getDragDropPayload<studio::FileRef>("FileRef");
|
||||
if (!err) {
|
||||
auto const oldVal = m_selectedPaletteIdx;
|
||||
std::ignore = ox::findIdx(files.begin(), files.end(), ref.path).moveTo(m_selectedPaletteIdx);
|
||||
if (oldVal != m_selectedPaletteIdx) {
|
||||
oxLogError(m_model.setPalette(files[m_selectedPaletteIdx]));
|
||||
}
|
||||
}
|
||||
}
|
||||
auto const pages = m_model.pal().pages.size();
|
||||
if (pages > 1) {
|
||||
ig::IndentStackItem const indentStackItem{20};
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <studio/dragdrop.hpp>
|
||||
#include <studio/imguiutil.hpp>
|
||||
|
||||
#include "projectexplorer.hpp"
|
||||
@ -55,9 +54,8 @@ void ProjectTreeModel::draw(turbine::Context &tctx) const noexcept {
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
std::ignore = ig::dragDropSource([this] {
|
||||
ig::dragDropSource([this] {
|
||||
ImGui::Text("%s", m_name.c_str());
|
||||
return ig::setDragDropPayload("FileRef", FileRef{fullPath<ox::String>()});
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -82,4 +80,11 @@ void ProjectTreeModel::drawDirContextMenu() const noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
ox::BasicString<255> ProjectTreeModel::fullPath() const noexcept {
|
||||
if (m_parent) {
|
||||
return m_parent->fullPath() + "/" + m_name;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,14 +32,8 @@ class ProjectTreeModel {
|
||||
private:
|
||||
void drawDirContextMenu() const noexcept;
|
||||
|
||||
template<typename Str = ox::BasicString<255>>
|
||||
[[nodiscard]]
|
||||
Str fullPath() const noexcept {
|
||||
if (m_parent) {
|
||||
return m_parent->fullPath<Str>() + "/" + m_name;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
ox::BasicString<255> fullPath() const noexcept;
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/std/string.hpp>
|
||||
#include <ox/model/def.hpp>
|
||||
|
||||
namespace studio {
|
||||
|
||||
struct FileRef {
|
||||
static constexpr auto TypeName = "net.drinkingtea.studio.FileRef";
|
||||
static constexpr auto TypeVersion = 1;
|
||||
ox::String path;
|
||||
};
|
||||
|
||||
OX_MODEL_BEGIN(FileRef)
|
||||
OX_MODEL_FIELD(path)
|
||||
OX_MODEL_END()
|
||||
|
||||
}
|
@ -63,7 +63,6 @@ auto dragDropSource(auto const&cb) noexcept {
|
||||
if (ig::DragDropSource const tgt; tgt) [[unlikely]] {
|
||||
return cb();
|
||||
}
|
||||
return ox::Error{};
|
||||
} else {
|
||||
if (ig::DragDropSource const tgt; tgt) [[unlikely]] {
|
||||
cb();
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include <studio/configio.hpp>
|
||||
#include <studio/context.hpp>
|
||||
#include <studio/dragdrop.hpp>
|
||||
#include <studio/editor.hpp>
|
||||
#include <studio/filedialog.hpp>
|
||||
#include <studio/imguiutil.hpp>
|
||||
|
Loading…
Reference in New Issue
Block a user