mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Take care of not using UI-related stuff on Clipboard class when ENABLE_UI=0
This commit is contained in:
parent
7a1d6aef21
commit
1ce3e8e392
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2023 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -58,11 +58,15 @@ namespace {
|
||||
}
|
||||
|
||||
void observeUIContext() {
|
||||
#ifdef ENABLE_UI
|
||||
UIContext::instance()->documents().add_observer(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void unobserveUIContext() {
|
||||
#ifdef ENABLE_UI
|
||||
UIContext::instance()->documents().remove_observer(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool valid() const {
|
||||
@ -375,7 +379,9 @@ void Clipboard::cut(ContextWriter& writer)
|
||||
tx.commit();
|
||||
}
|
||||
writer.document()->generateMaskBoundaries();
|
||||
#ifdef ENABLE_UI
|
||||
update_screen_for_document(writer.document());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,9 +412,11 @@ void Clipboard::copyRange(const ContextReader& reader, const DocRange& range)
|
||||
clearContent();
|
||||
m_data->range.setRange(writer.document(), range);
|
||||
|
||||
#ifdef ENABLE_UI
|
||||
// TODO Replace this with a signal, because here the timeline
|
||||
// depends on the clipboard and the clipboard on the timeline.
|
||||
App::instance()->timeline()->activateClipboardRange();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Clipboard::copyImage(const Image* image,
|
||||
@ -465,7 +473,9 @@ void Clipboard::paste(Context* ctx,
|
||||
if (!dstSpr)
|
||||
return;
|
||||
|
||||
auto editor = Editor::activeEditor();
|
||||
#ifdef ENABLE_UI
|
||||
Editor* editor = Editor::activeEditor();
|
||||
#endif
|
||||
bool updateDstDoc = false;
|
||||
|
||||
switch (format()) {
|
||||
@ -501,6 +511,7 @@ void Clipboard::paste(Context* ctx,
|
||||
0));
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UI
|
||||
if (editor && interactive) {
|
||||
// TODO we don't support pasting in multiple cels at the
|
||||
// moment, so we clear the range here (same as in
|
||||
@ -511,7 +522,9 @@ void Clipboard::paste(Context* ctx,
|
||||
editor->pasteImage(src_image.get(),
|
||||
m_data->mask.get());
|
||||
}
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// Non-interactive version (just copy the image to the cel)
|
||||
Layer* dstLayer = site.layer();
|
||||
ASSERT(dstLayer);
|
||||
@ -546,6 +559,7 @@ void Clipboard::paste(Context* ctx,
|
||||
}
|
||||
|
||||
case ClipboardFormat::Tilemap: {
|
||||
#ifdef ENABLE_UI
|
||||
if (editor && interactive) {
|
||||
// TODO match both tilesets?
|
||||
// TODO add post-command parameters (issue #2324)
|
||||
@ -554,7 +568,9 @@ void Clipboard::paste(Context* ctx,
|
||||
editor->pasteImage(m_data->tilemap.get(),
|
||||
m_data->mask.get());
|
||||
}
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// TODO non-interactive version (for scripts)
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user