[nostalgia/core/studio] Add acceptsClipboardPayload to TileSheetEditor
This commit is contained in:
parent
a138f60fea
commit
97dc027498
@ -105,6 +105,10 @@ void TileSheetEditorImGui::paste() {
|
|||||||
m_model.paste();
|
m_model.paste();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TileSheetEditorImGui::acceptsClipboardPayload() const noexcept {
|
||||||
|
return m_model.acceptsClipboardPayload();
|
||||||
|
}
|
||||||
|
|
||||||
void TileSheetEditorImGui::keyStateChanged(turbine::Key key, bool down) {
|
void TileSheetEditorImGui::keyStateChanged(turbine::Key key, bool down) {
|
||||||
if (!down) {
|
if (!down) {
|
||||||
return;
|
return;
|
||||||
|
@ -79,6 +79,9 @@ class TileSheetEditorImGui: public studio::Editor {
|
|||||||
|
|
||||||
void paste() override;
|
void paste() override;
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
bool acceptsClipboardPayload() const noexcept override;
|
||||||
|
|
||||||
void keyStateChanged(turbine::Key key, bool down) override;
|
void keyStateChanged(turbine::Key key, bool down) override;
|
||||||
|
|
||||||
void draw(studio::StudioContext&) noexcept override;
|
void draw(studio::StudioContext&) noexcept override;
|
||||||
|
@ -107,6 +107,11 @@ void TileSheetEditorModel::paste() {
|
|||||||
pushCommand(ox::make<CutPasteCommand>(CommandId::Paste, m_img, m_activeSubsSheetIdx, pt1, pt2, *cb));
|
pushCommand(ox::make<CutPasteCommand>(CommandId::Paste, m_img, m_activeSubsSheetIdx, pt1, pt2, *cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TileSheetEditorModel::acceptsClipboardPayload() const noexcept {
|
||||||
|
auto const cb = getClipboardObject<TileSheetClipboard>(m_tctx);
|
||||||
|
return cb.ok();
|
||||||
|
}
|
||||||
|
|
||||||
ox::StringView TileSheetEditorModel::palPath() const noexcept {
|
ox::StringView TileSheetEditorModel::palPath() const noexcept {
|
||||||
auto [path, err] = m_img.defaultPalette.getPath();
|
auto [path, err] = m_img.defaultPalette.getPath();
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -216,13 +221,15 @@ void TileSheetEditorModel::select(ox::Point const&pt) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorModel::completeSelection() noexcept {
|
void TileSheetEditorModel::completeSelection() noexcept {
|
||||||
auto &s = activeSubSheet();
|
if (m_selTracker.selectionOngoing()) {
|
||||||
m_selTracker.finishSelection();
|
m_selTracker.finishSelection();
|
||||||
m_selection.emplace(m_selTracker.selection());
|
m_selection.emplace(m_selTracker.selection());
|
||||||
auto&pt = m_selection->b;
|
auto&pt = m_selection->b;
|
||||||
|
auto&s = activeSubSheet();
|
||||||
pt.x = ox::min(s.columns * TileWidth - 1, pt.x);
|
pt.x = ox::min(s.columns * TileWidth - 1, pt.x);
|
||||||
pt.y = ox::min(s.rows * TileHeight - 1, pt.y);
|
pt.y = ox::min(s.rows * TileHeight - 1, pt.y);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TileSheetEditorModel::clearSelection() noexcept {
|
void TileSheetEditorModel::clearSelection() noexcept {
|
||||||
m_updated = true;
|
m_updated = true;
|
||||||
|
@ -48,6 +48,9 @@ class TileSheetEditorModel: public ox::SignalHandler {
|
|||||||
|
|
||||||
void paste();
|
void paste();
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
bool acceptsClipboardPayload() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr TileSheet const&img() const noexcept;
|
constexpr TileSheet const&img() const noexcept;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user