Squashed 'deps/nostalgia/' changes from 0c0ccd1a..227f3cd9

227f3cd9 [nostalgia/core/studio] Update itoa usages
20ff0f89 [ox/std] Rework itoa
4061b831 [ox/model] Remove broken global var
18bb5062 [ox/std] Add String::append(StringView), cleanup
6a4b4822 [nostalgia,studio] Fixes for Ox changes
d2a3cfa7 [ox/std] Remove append operators from IString
7c4e2a65 [ox/std] Cleanup IString
e30ebce4 [nostalgia] Add pyenv to .gitignore
7163947e [ox/std] Cleanup
0a0a6e30 [studio] Move UndoCommand implementation to its own file
97bc9332 [nostalgia/core] Fix TileSheetV1 to use PaletteV1
9caf7099 [keel] Fix for Ox change
fda1280d [ox/std] Make substr always take and return a StringView
59aa4ad2 [cityhash] Cleanup
1a8afa1a [nostalgia/sample_project] Add missing type descriptor
cdbc2d6c [olympic/studio] Move UndoCommand to its own file
acd93337 [ox/std] Fix Integer assignment operator return
cebd3b0a [ox/std] Fix Integer assignment operator return
43e2e215 [ox/std] Cleanup
be1f9095 [ox/std] Make safeDelete constexpr
0f2c18d5 [ox/std] Add std::string(_view) variant of MaybeView

git-subtree-dir: deps/nostalgia
git-subtree-split: 227f3cd9f584039cfddad75f1fe1275ad6cac000
This commit is contained in:
2024-05-03 21:15:51 -05:00
parent 22e6299e90
commit df22a1e51b
32 changed files with 318 additions and 283 deletions

View File

@@ -13,5 +13,6 @@
#include <studio/popup.hpp>
#include <studio/project.hpp>
#include <studio/task.hpp>
#include <studio/undocommand.hpp>
#include <studio/undostack.hpp>
#include <studio/widget.hpp>

View File

@@ -0,0 +1,19 @@
/*
* Copyright 2016 - 2024 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#pragma once
namespace studio {
class UndoCommand {
public:
virtual ~UndoCommand() noexcept = default;
virtual void redo() noexcept = 0;
virtual void undo() noexcept = 0;
[[nodiscard]]
virtual int commandId() const noexcept = 0;
virtual bool mergeWith(UndoCommand const*cmd) noexcept;
};
}

View File

@@ -9,17 +9,9 @@
#include <ox/std/memory.hpp>
#include <ox/std/vector.hpp>
namespace studio {
#include "undocommand.hpp"
class UndoCommand {
public:
virtual ~UndoCommand() noexcept = default;
virtual void redo() noexcept = 0;
virtual void undo() noexcept = 0;
[[nodiscard]]
virtual int commandId() const noexcept = 0;
virtual bool mergeWith(UndoCommand const*cmd) noexcept;
};
namespace studio {
class UndoStack {
private:

View File

@@ -7,6 +7,7 @@ add_library(
popup.cpp
project.cpp
task.cpp
undocommand.cpp
undostack.cpp
filedialog_nfd.cpp
)

View File

@@ -0,0 +1,10 @@
#include <studio/undocommand.hpp>
namespace studio {
bool UndoCommand::mergeWith(UndoCommand const*) noexcept {
return false;
}
}

View File

@@ -6,10 +6,6 @@
namespace studio {
bool UndoCommand::mergeWith(UndoCommand const*) noexcept {
return false;
}
void UndoStack::push(ox::UPtr<UndoCommand> &&cmd) noexcept {
for (auto const i = m_stackIdx; i < m_stack.size();) {
std::ignore = m_stack.erase(i);