Squashed 'deps/nostalgia/' changes from 5f10edd3..0daf938f

0daf938f [nostalgia/core/studio] Cleanup, make all number keys after num colors jump to last
b90ab27a [nostalgia/core/studio] Fix Palette Color Name input to properly take focus
c711f435 [nostalgia/core/studio] Fix PaletteEditor 0 key shortcut
84cb03d8 [nostalgia/core/studio] Cleanup
945a55f9 [studio] Fix Project to cut off correct end of OC data
2173b12c [nostalgia/core/studio] Give PaletteEditor keyboard shortcuts
aa970b1f [keel,studio] Cleanup
6ad79b30 [ox] Cleanup
a7cf2673 [studio] Remove null terminator from OC output
1a9f0d49 [ox] Rename CRString to StringCR
a1b5b565 [olympic,nostalgia] Rename CRStringView to StringViewCR
256be6da [glutils] Rename CRStringView to StringViewCR
cc10631b [ox] Rename CRStringView to StringViewCR
829dc029 [keel] Fix Linux build
e8a1ff06 [ox/oc] Fix Linux build
bdfb5e97 [nostalgia/core] Cleanup
396fecab [ox/oc] Add option for writeOC to return a string
5373b63c [keel,studio] Removing null terminator from JSON file output
8b655c40 [ox/std] Add HashMap::values
92d85d11 Merge commit '9f5f3e26efed6cd27f2a8ff0746f018d75986934'
118fef61 [buildcore] Remove python -m prefix from mypy command
8769305d [nostalgia] Allow disabling of BUILD_SHARED_LIBS
c5999050 [nostalgia] Add support for partial tilesheet loading
da23c930 [ox/std] Add oxModelFwdDecl macro for broken Apple Clang
3ae1d6c8 [ox/std] Make operator[] in Array and Vector nodiscard
a7af6c66 [keel] Cleanup
0cc6757c [keel] Add manifest to pack output
3b8eaef3 [keel] Move vald and repair funcs to their own file, make conversion to validation
b7990ed2 [keel] Make pack file copy logging nest for dir level
71313ed8 [ox/std] Cleanup
10531b6e [keel] Cleanup
dfbc298d [keel] Add pack file copy status to logging
76760daf [ox/std] Cleanup Defer
5834b9c9 [ox/std] Cleanup logging output
2a584905 [ox/fs] More cleanup and bug fix from previous cleanup
702b166b [ox/fs] Cleanup
8dd837b3 [nostalgia/core] Add a valid function for CompactTileSheet
1d262597 [keel] Make default repair return a no repair error
712299fa [studio] Cleanup
c45efa60 [ox/std] Make Result copyTo and moveTo able to convert

git-subtree-dir: deps/nostalgia
git-subtree-split: 0daf938f765b3a3ce8ba7fb292572a6a5a004634
This commit is contained in:
2024-09-28 23:44:24 -05:00
parent 9f5f3e26ef
commit 511548a2ee
99 changed files with 932 additions and 681 deletions

View File

@@ -8,12 +8,12 @@
namespace studio {
ClawEditor::ClawEditor(ox::CRStringView path, ox::ModelObject obj) noexcept:
Editor(path),
m_obj(std::move(obj)) {
ClawEditor::ClawEditor(StudioContext &sctx, ox::StringParam path):
Editor(std::move(path)),
m_obj(sctx.project->loadObj<ox::ModelObject>(itemPath()).unwrapThrow()) {
}
void ClawEditor::draw(studio::StudioContext&) noexcept {
void ClawEditor::draw(StudioContext&) noexcept {
ImGui::BeginChild("PaletteEditor");
static constexpr auto flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody;
if (ImGui::BeginTable("ObjTree", 3, flags)) {
@@ -93,7 +93,7 @@ void ClawEditor::drawRow(ox::ModelValue const&value) noexcept {
ImGui::Text("%s", val.c_str());
}
void ClawEditor::drawVar(ObjPath &path, ox::CRStringView name, ox::ModelValue const&value) noexcept {
void ClawEditor::drawVar(ObjPath &path, ox::StringViewCR name, ox::ModelValue const&value) noexcept {
using Str = ox::BasicString<100>;
path.push_back(name);
if (value.type() == ox::ModelValue::Type::Object) {

View File

@@ -11,19 +11,19 @@
namespace studio {
class ClawEditor: public studio::Editor {
class ClawEditor: public Editor {
private:
using ObjPath = ox::Vector<ox::StringView, 8>;
ox::ModelObject m_obj;
public:
ClawEditor(ox::CRStringView path, ox::ModelObject obj) noexcept;
ClawEditor(StudioContext &sctx, ox::StringParam path);
void draw(studio::StudioContext&) noexcept final;
void draw(StudioContext&) noexcept final;
private:
static void drawRow(ox::ModelValue const&value) noexcept;
void drawVar(ObjPath &path, ox::CRStringView name, ox::ModelValue const&value) noexcept;
void drawVar(ObjPath &path, ox::StringViewCR name, ox::ModelValue const&value) noexcept;
void drawTree(ObjPath &path, ox::ModelObject const&obj) noexcept;
};

View File

@@ -34,8 +34,8 @@ static void keyEventHandler(turbine::Context &ctx, turbine::Key key, bool down)
}
static ox::Error runApp(
ox::CRStringView appName,
ox::CRStringView projectDataDir,
ox::StringViewCR appName,
ox::StringViewCR projectDataDir,
ox::UPtr<ox::FileSystem> &&fs) noexcept {
oxRequireM(ctx, turbine::init(std::move(fs), appName));
turbine::setWindowTitle(*ctx, keelCtx(*ctx).appName);
@@ -50,8 +50,8 @@ static ox::Error runApp(
}
static ox::Error run(
ox::CRStringView appName,
ox::CRStringView projectDataDir,
ox::StringViewCR appName,
ox::StringViewCR projectDataDir,
int,
char const**) {
// seed UUID generator

View File

@@ -51,7 +51,7 @@ void ProjectExplorer::setModel(ox::UPtr<ProjectTreeModel> &&model) noexcept {
m_treeModel = std::move(model);
}
ox::Error ProjectExplorer::refreshProjectTreeModel(ox::CRStringView) noexcept {
ox::Error ProjectExplorer::refreshProjectTreeModel(ox::StringViewCR) noexcept {
oxRequireM(model, buildProjectTreeModel(*this, "Project", "/", nullptr));
setModel(std::move(model));
return OxError(0);

View File

@@ -23,7 +23,7 @@ class ProjectExplorer: public studio::Widget {
void setModel(ox::UPtr<ProjectTreeModel> &&model) noexcept;
ox::Error refreshProjectTreeModel(ox::CRStringView = {}) noexcept;
ox::Error refreshProjectTreeModel(ox::StringViewCR = {}) noexcept;
[[nodiscard]]
inline ox::FileSystem *romFs() noexcept {

View File

@@ -318,7 +318,7 @@ void StudioUI::handleKeyInput() noexcept {
}
}
ox::Error StudioUI::createOpenProject(ox::CRStringView path) noexcept {
ox::Error StudioUI::createOpenProject(ox::StringViewCR path) noexcept {
std::error_code ec;
std::filesystem::create_directories(toStdStringView(path), ec);
oxReturnError(OxError(ec.value() != 0, "Could not create project directory"));
@@ -346,11 +346,11 @@ ox::Error StudioUI::openProjectPath(ox::StringParam path) noexcept {
return m_projectExplorer.refreshProjectTreeModel();
}
ox::Error StudioUI::openFile(ox::CRStringView path) noexcept {
ox::Error StudioUI::openFile(ox::StringViewCR path) noexcept {
return openFileActiveTab(path, true);
}
ox::Error StudioUI::openFileActiveTab(ox::CRStringView path, bool makeActiveTab) noexcept {
ox::Error StudioUI::openFileActiveTab(ox::StringViewCR path, bool makeActiveTab) noexcept {
if (!m_project) {
return OxError(1, "No project open to open a file from");
}
@@ -366,23 +366,17 @@ ox::Error StudioUI::openFileActiveTab(ox::CRStringView path, bool makeActiveTab)
}
oxRequire(ext, studio::fileExt(path));
// create Editor
studio::BaseEditor *editor = nullptr;
if (!m_editorMakers.contains(ext)) {
auto [obj, err] = m_project->loadObj<ox::ModelObject>(path);
if (err) {
return OxError(1, "There is no editor for this file extension");
}
editor = ox::make<ClawEditor>(path, std::move(obj));
} else {
auto const err = m_editorMakers[ext](path).moveTo(editor);
if (err) {
if constexpr(!ox::defines::Debug) {
oxErrf("Could not open Editor: {}\n", toStr(err));
} else {
oxErrf("Could not open Editor: {} ({}:{})\n", err.errCode, err.file, err.line);
}
return err;
BaseEditor *editor = nullptr;
auto const err = m_editorMakers.contains(ext) ?
m_editorMakers[ext](path).moveTo(editor) :
ox::makeCatch<ClawEditor>(m_sctx, path).moveTo(editor);
if (err) {
if constexpr(!ox::defines::Debug) {
oxErrf("Could not open Editor: {}\n", toStr(err));
} else {
oxErrf("Could not open Editor: {} ({}:{})\n", err.errCode, err.file, err.line);
}
return err;
}
editor->closed.connect(this, &StudioUI::closeFile);
m_editors.emplace_back(editor);
@@ -400,7 +394,7 @@ ox::Error StudioUI::openFileActiveTab(ox::CRStringView path, bool makeActiveTab)
return {};
}
ox::Error StudioUI::closeFile(ox::CRStringView path) noexcept {
ox::Error StudioUI::closeFile(ox::StringViewCR path) noexcept {
if (!m_openFiles.contains(path)) {
return {};
}

View File

@@ -83,15 +83,15 @@ class StudioUI: public ox::SignalHandler {
void handleKeyInput() noexcept;
ox::Error createOpenProject(ox::CRStringView path) noexcept;
ox::Error createOpenProject(ox::StringViewCR path) noexcept;
ox::Error openProjectPath(ox::StringParam path) noexcept;
ox::Error openFile(ox::CRStringView path) noexcept;
ox::Error openFile(ox::StringViewCR path) noexcept;
ox::Error openFileActiveTab(ox::CRStringView path, bool makeActiveTab) noexcept;
ox::Error openFileActiveTab(ox::StringViewCR path, bool makeActiveTab) noexcept;
ox::Error closeFile(ox::CRStringView path) noexcept;
ox::Error closeFile(ox::StringViewCR path) noexcept;
};
}