Merge commit 'df22a1e51b411329184b3fe33cfc0b665b7b87b6'

This commit is contained in:
2024-05-03 21:15:51 -05:00
32 changed files with 318 additions and 283 deletions

View File

@ -29,7 +29,7 @@ static ox::Error pathToInode(
return {};
}
if (beginsWith(path, "uuid://")) {
auto const uuid = substr<ox::StringView>(path, 7);
auto const uuid = ox::substr(path, 7);
oxReturnError(keel::uuidToPath(ctx, uuid).moveTo(path));
}
oxRequire(s, dest.stat(path));

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);