[nostalgia] Split PaletteEditor into Imgui and general files, other cleanup
This commit is contained in:
@@ -16,7 +16,6 @@ add_library(
|
||||
task.cpp
|
||||
undostack.cpp
|
||||
widget.cpp
|
||||
window.cpp
|
||||
filedialog_gtk.cpp
|
||||
$<$<BOOL:${APPLE}>:filedialog_mac.mm>
|
||||
)
|
||||
@@ -59,7 +58,6 @@ install(
|
||||
task.hpp
|
||||
undostack.hpp
|
||||
widget.hpp
|
||||
window.hpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/nostalgiastudio_export.h
|
||||
DESTINATION
|
||||
include/nostalgia/studio/lib
|
||||
|
@@ -28,9 +28,13 @@ void Editor::close() {
|
||||
this->closed.emit(itemName());
|
||||
}
|
||||
|
||||
void Editor::save() {
|
||||
saveItem();
|
||||
setUnsavedChanges(false);
|
||||
void Editor::save() noexcept {
|
||||
const auto err = saveItem();
|
||||
if (!err) {
|
||||
setUnsavedChanges(false);
|
||||
} else {
|
||||
oxErrorf("Could not save file {}: {}", itemName(), toStr(err));
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::setUnsavedChanges(bool uc) {
|
||||
@@ -78,7 +82,8 @@ bool Editor::pasteEnabled() const {
|
||||
return m_pasteEnabled;
|
||||
}
|
||||
|
||||
void Editor::saveItem() {
|
||||
ox::Error Editor::saveItem() noexcept {
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,12 +11,17 @@
|
||||
|
||||
#include "nostalgiastudio_export.h"
|
||||
|
||||
namespace nostalgia {
|
||||
class StudioUI;
|
||||
}
|
||||
|
||||
namespace nostalgia::studio {
|
||||
|
||||
class NOSTALGIASTUDIO_EXPORT Editor: public Widget {
|
||||
|
||||
friend StudioUI;
|
||||
|
||||
private:
|
||||
UndoStack m_cmdStack;
|
||||
bool m_unsavedChanges = false;
|
||||
bool m_exportable = false;
|
||||
bool m_cutEnabled = false;
|
||||
@@ -43,20 +48,12 @@ class NOSTALGIASTUDIO_EXPORT Editor: public Widget {
|
||||
|
||||
virtual void exportFile();
|
||||
|
||||
/**
|
||||
* Returns the undo stack holding changes to the item being edited.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
virtual UndoStack *undoStack() noexcept {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void close();
|
||||
|
||||
/**
|
||||
* Save changes to item being edited.
|
||||
*/
|
||||
void save();
|
||||
void save() noexcept;
|
||||
|
||||
/**
|
||||
* Sets indication of item being edited has unsaved changes. Also emits
|
||||
@@ -91,7 +88,15 @@ class NOSTALGIASTUDIO_EXPORT Editor: public Widget {
|
||||
/**
|
||||
* Save changes to item being edited.
|
||||
*/
|
||||
virtual void saveItem();
|
||||
virtual ox::Error saveItem() noexcept;
|
||||
|
||||
/**
|
||||
* Returns the undo stack holding changes to the item being edited.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
virtual UndoStack *undoStack() noexcept {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// signals
|
||||
public:
|
||||
|
@@ -4,8 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <ox/claw/read.hpp>
|
||||
#include <ox/claw/write.hpp>
|
||||
#include <ox/event/signal.hpp>
|
||||
|
@@ -1,9 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "window.hpp"
|
||||
|
||||
|
||||
|
||||
|
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "widget.hpp"
|
||||
|
||||
namespace nostalgia::studio {
|
||||
|
||||
class Window: public Widget {
|
||||
|
||||
};
|
||||
|
||||
}
|
@@ -42,6 +42,7 @@ class StudioUI: public ox::SignalHandler {
|
||||
|
||||
void handleKeyEvent(core::Key, bool down) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr auto project() noexcept {
|
||||
return m_project.get();
|
||||
}
|
||||
|
Reference in New Issue
Block a user