Compare commits
2 Commits
03d4a5736e
...
25a7873ea2
Author | SHA1 | Date | |
---|---|---|---|
25a7873ea2 | |||
d0a32e247e |
13
deps/ox/src/ox/std/vector.hpp
vendored
13
deps/ox/src/ox/std/vector.hpp
vendored
@ -311,6 +311,8 @@ class Vector: detail::VectorAllocator<T, Allocator, SmallVectorSize> {
|
|||||||
*/
|
*/
|
||||||
constexpr Error unordered_erase(std::size_t pos) noexcept(useNoexcept);
|
constexpr Error unordered_erase(std::size_t pos) noexcept(useNoexcept);
|
||||||
|
|
||||||
|
constexpr Error remove(T const &val);
|
||||||
|
|
||||||
constexpr void reserve(std::size_t cap) noexcept(useNoexcept);
|
constexpr void reserve(std::size_t cap) noexcept(useNoexcept);
|
||||||
|
|
||||||
constexpr void shrink_to_fit() noexcept(useNoexcept);
|
constexpr void shrink_to_fit() noexcept(useNoexcept);
|
||||||
@ -659,6 +661,17 @@ constexpr Error Vector<T, SmallVectorSize, Allocator>::unordered_erase(std::size
|
|||||||
return ox::Error(0);
|
return ox::Error(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T, std::size_t SmallVectorSize, typename Allocator>
|
||||||
|
constexpr ox::Error Vector<T, SmallVectorSize, Allocator>::remove(T const &val) {
|
||||||
|
for (size_t i{}; auto const &v : *this) {
|
||||||
|
if (v == val) {
|
||||||
|
return erase(i).error;
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
return ox::Error{1, "element not found"};
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T, std::size_t SmallVectorSize, typename Allocator>
|
template<typename T, std::size_t SmallVectorSize, typename Allocator>
|
||||||
constexpr void Vector<T, SmallVectorSize, Allocator>::reserve(std::size_t cap) noexcept(useNoexcept) {
|
constexpr void Vector<T, SmallVectorSize, Allocator>::reserve(std::size_t cap) noexcept(useNoexcept) {
|
||||||
if (cap <= m_cap) {
|
if (cap <= m_cap) {
|
||||||
|
@ -566,8 +566,10 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept {
|
|||||||
m_view.setPalIdx(i);
|
m_view.setPalIdx(i);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) {
|
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) {
|
||||||
auto const rqst = ox::sfmt<ox::BasicString<100>>("{};{}", i, m_model.palettePage());
|
studio::navigateTo(
|
||||||
oxLogError(studio::navigateTo(m_sctx, m_model.palPath(), rqst));
|
m_sctx,
|
||||||
|
m_model.palPath(),
|
||||||
|
ox::sfmt("{};{}", i, m_model.palettePage()));
|
||||||
}
|
}
|
||||||
// Column: color RGB
|
// Column: color RGB
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
|
|
||||||
ox::Error navigateTo(StudioContext &ctx, ox::StringViewCR filePath, ox::StringViewCR args) noexcept {
|
void navigateTo(StudioContext &ctx, ox::StringParam filePath, ox::StringParam navArgs) noexcept {
|
||||||
return ctx.ui.navigateTo(filePath, args);
|
ctx.ui.navigateTo(std::move(filePath), std::move(navArgs));
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ig {
|
namespace ig {
|
||||||
@ -111,10 +111,8 @@ void StudioUI::handleKeyEvent(turbine::Key const key, bool const down) noexcept
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error StudioUI::navigateTo(ox::StringViewCR path, ox::StringViewCR navArgs) noexcept {
|
void StudioUI::navigateTo(ox::StringParam path, ox::StringParam navArgs) noexcept {
|
||||||
OX_RETURN_ERROR(openFile(path));
|
m_navAction.emplace(std::move(path), std::move(navArgs));
|
||||||
m_activeEditor->navigateTo(navArgs);
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StudioUI::draw() noexcept {
|
void StudioUI::draw() noexcept {
|
||||||
@ -287,6 +285,11 @@ void StudioUI::drawTabs() noexcept {
|
|||||||
}
|
}
|
||||||
m_closeActiveTab = false;
|
m_closeActiveTab = false;
|
||||||
}
|
}
|
||||||
|
if (m_navAction) {
|
||||||
|
oxLogError(openFile(m_navAction->path));
|
||||||
|
m_activeEditor->navigateTo(m_navAction->args);
|
||||||
|
m_navAction.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StudioUI::loadEditorMaker(EditorMaker const&editorMaker) noexcept {
|
void StudioUI::loadEditorMaker(EditorMaker const&editorMaker) noexcept {
|
||||||
|
@ -62,13 +62,18 @@ class StudioUI: public ox::SignalHandler {
|
|||||||
&m_renameFile,
|
&m_renameFile,
|
||||||
};
|
};
|
||||||
bool m_showProjectExplorer = true;
|
bool m_showProjectExplorer = true;
|
||||||
|
struct NavAction {
|
||||||
|
ox::String path;
|
||||||
|
ox::String args;
|
||||||
|
};
|
||||||
|
ox::Optional<NavAction> m_navAction;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexcept;
|
explicit StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexcept;
|
||||||
|
|
||||||
void handleKeyEvent(turbine::Key, bool down) noexcept;
|
void handleKeyEvent(turbine::Key, bool down) noexcept;
|
||||||
|
|
||||||
ox::Error navigateTo(ox::StringViewCR path, ox::StringViewCR navArgs = {}) noexcept;
|
void navigateTo(ox::StringParam path, ox::StringParam navArgs) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr Project *project() noexcept {
|
constexpr Project *project() noexcept {
|
||||||
|
@ -27,6 +27,6 @@ inline keel::Context &keelCtx(StudioContext &ctx) noexcept {
|
|||||||
return keelCtx(ctx.tctx);
|
return keelCtx(ctx.tctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error navigateTo(StudioContext &ctx, ox::StringViewCR filePath, ox::StringViewCR args) noexcept;
|
void navigateTo(StudioContext &ctx, ox::StringParam filePath, ox::StringParam navArgs) noexcept;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user