[studio,nostalgia/gfx] Add system for adding sub-commands in Modules, add export-tilesheet command
All checks were successful
Build / build (push) Successful in 1m16s
All checks were successful
Build / build (push) Successful in 1m16s
This commit is contained in:
@@ -23,15 +23,34 @@ struct EditorMaker {
|
||||
Func make;
|
||||
};
|
||||
|
||||
struct Command {
|
||||
ox::String name;
|
||||
std::function<ox::Error(Project&, ox::SpanView<ox::CString>)> func;
|
||||
Command(
|
||||
ox::StringParam name,
|
||||
std::function<ox::Error(Project&, ox::SpanView<ox::CString>)> func) noexcept:
|
||||
name(std::move(name)),
|
||||
func(std::move(func)) {}
|
||||
};
|
||||
|
||||
class Module {
|
||||
public:
|
||||
virtual ~Module() noexcept = default;
|
||||
|
||||
virtual ox::Vector<EditorMaker> editors(studio::Context &ctx) const;
|
||||
[[nodiscard]]
|
||||
virtual ox::String id() const noexcept = 0;
|
||||
|
||||
virtual ox::Vector<ox::UPtr<ItemMaker>> itemMakers(studio::Context&) const;
|
||||
[[nodiscard]]
|
||||
virtual ox::Vector<Command> commands() const;
|
||||
|
||||
virtual ox::Vector<ox::UPtr<ItemTemplate>> itemTemplates(studio::Context&) const;
|
||||
[[nodiscard]]
|
||||
virtual ox::Vector<EditorMaker> editors(Context &ctx) const;
|
||||
|
||||
[[nodiscard]]
|
||||
virtual ox::Vector<ox::UPtr<ItemMaker>> itemMakers(Context&) const;
|
||||
|
||||
[[nodiscard]]
|
||||
virtual ox::Vector<ox::UPtr<ItemTemplate>> itemTemplates(Context&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class Project: public ox::SignalHandler {
|
||||
ox::HashMap<ox::String, ox::Vector<ox::String>> m_fileExtFileMap;
|
||||
|
||||
public:
|
||||
explicit Project(keel::Context &ctx, ox::String path, ox::StringViewCR projectDataDir);
|
||||
explicit Project(keel::Context &ctx, ox::StringParam path, ox::StringViewCR projectDataDir);
|
||||
|
||||
ox::Error create() noexcept;
|
||||
|
||||
@@ -101,6 +101,16 @@ class Project: public ox::SignalHandler {
|
||||
|
||||
ox::Error deleteItem(ox::StringViewCR path) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
keel::Context &kctx() noexcept {
|
||||
return m_kctx;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
keel::Context const &kctx() const noexcept {
|
||||
return m_kctx;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool exists(ox::StringViewCR path) const noexcept;
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
|
||||
namespace studio {
|
||||
|
||||
ox::Vector<Command> Module::commands() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
ox::Vector<EditorMaker> Module::editors(Context&) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ static constexpr bool isParentOf(ox::StringViewCR parent, ox::StringViewCR child
|
||||
return beginsWith(sfmt("{}/", child), parent);
|
||||
}
|
||||
|
||||
Project::Project(keel::Context &ctx, ox::String path, ox::StringViewCR projectDataDir):
|
||||
Project::Project(keel::Context &ctx, ox::StringParam path, ox::StringViewCR projectDataDir):
|
||||
m_kctx(ctx),
|
||||
m_path(std::move(path)),
|
||||
m_projectDataDir(projectDataDir),
|
||||
|
||||
Reference in New Issue
Block a user