mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Remove #if/endif ENABLE_UI conditional directives (fix #4619)
This was originated for #1279 (CLI-only Aseprite) which can be achieved with LAF_BACKEND=none anyway. In this way we simplify the development process, and checking for the availability of the GUI can be done in run-time through App::isGui() or Context::isUIAvailable().
This commit is contained in:
parent
c4526cf709
commit
bf0a47545c
@ -95,10 +95,6 @@ add_definitions(-DLIBARCHIVE_STATIC)
|
|||||||
|
|
||||||
add_library(app-lib ${generated_files})
|
add_library(app-lib ${generated_files})
|
||||||
|
|
||||||
# ENABLE_UI is always defined because there are still #ifdef/endif
|
|
||||||
# using it, but we should remove it.
|
|
||||||
target_compile_definitions(app-lib PUBLIC -DENABLE_UI)
|
|
||||||
|
|
||||||
# These specific-platform files should be in an external library
|
# These specific-platform files should be in an external library
|
||||||
# (e.g. "base" or "os").
|
# (e.g. "base" or "os").
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -120,14 +120,8 @@ private:
|
|||||||
|
|
||||||
class App::CoreModules {
|
class App::CoreModules {
|
||||||
public:
|
public:
|
||||||
#ifdef ENABLE_UI
|
|
||||||
typedef app::UIContext ContextT;
|
|
||||||
#else
|
|
||||||
typedef app::Context ContextT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ConfigModule m_configModule;
|
ConfigModule m_configModule;
|
||||||
ContextT m_context;
|
app::UIContext m_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
class App::LoadLanguage {
|
class App::LoadLanguage {
|
||||||
@ -148,11 +142,9 @@ public:
|
|||||||
tools::ToolBox m_toolbox;
|
tools::ToolBox m_toolbox;
|
||||||
tools::ActiveToolManager m_activeToolManager;
|
tools::ActiveToolManager m_activeToolManager;
|
||||||
Commands m_commands;
|
Commands m_commands;
|
||||||
#ifdef ENABLE_UI
|
|
||||||
RecentFiles m_recent_files;
|
RecentFiles m_recent_files;
|
||||||
InputChain m_inputChain;
|
InputChain m_inputChain;
|
||||||
Clipboard m_clipboard;
|
Clipboard m_clipboard;
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DATA_RECOVERY
|
#ifdef ENABLE_DATA_RECOVERY
|
||||||
// This is a raw pointer because we want to delete it explicitly.
|
// This is a raw pointer because we want to delete it explicitly.
|
||||||
// (e.g. if an exception occurs, the ~Modules() doesn't have to
|
// (e.g. if an exception occurs, the ~Modules() doesn't have to
|
||||||
@ -165,9 +157,7 @@ public:
|
|||||||
: m_loggerModule(createLogInDesktop)
|
: m_loggerModule(createLogInDesktop)
|
||||||
, m_loadLanguage(pref, m_extensions)
|
, m_loadLanguage(pref, m_extensions)
|
||||||
, m_activeToolManager(&m_toolbox)
|
, m_activeToolManager(&m_toolbox)
|
||||||
#ifdef ENABLE_UI
|
|
||||||
, m_recent_files(pref.general.recentItems())
|
, m_recent_files(pref.general.recentItems())
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_DATA_RECOVERY
|
#ifdef ENABLE_DATA_RECOVERY
|
||||||
, m_recovery(nullptr)
|
, m_recovery(nullptr)
|
||||||
#endif
|
#endif
|
||||||
@ -250,9 +240,7 @@ App::App(AppMod* mod)
|
|||||||
, m_legacy(nullptr)
|
, m_legacy(nullptr)
|
||||||
, m_isGui(false)
|
, m_isGui(false)
|
||||||
, m_isShell(false)
|
, m_isShell(false)
|
||||||
#ifdef ENABLE_UI
|
|
||||||
, m_backupIndicator(nullptr)
|
, m_backupIndicator(nullptr)
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
, m_engine(new script::Engine)
|
, m_engine(new script::Engine)
|
||||||
#endif
|
#endif
|
||||||
@ -265,19 +253,15 @@ int App::initialize(const AppOptions& options)
|
|||||||
{
|
{
|
||||||
os::System* system = os::instance();
|
os::System* system = os::instance();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
m_isGui = options.startUI() && !options.previewCLI();
|
m_isGui = options.startUI() && !options.previewCLI();
|
||||||
|
|
||||||
// Notify the scripting engine that we're going to enter to GUI
|
// Notify the scripting engine that we're going to enter to GUI
|
||||||
// mode, this is useful so we can mark the stdin file handle as
|
// mode, this is useful so we can mark the stdin file handle as
|
||||||
// closed so no script can hang the program if it tries to read from
|
// closed so no script can hang the program if it tries to read from
|
||||||
// stdin when the GUI is running.
|
// stdin when the GUI is running.
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
if (m_isGui)
|
if (m_isGui)
|
||||||
m_engine->notifyRunningGui();
|
m_engine->notifyRunningGui();
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
m_isGui = false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_isShell = options.startShell();
|
m_isShell = options.startShell();
|
||||||
@ -350,9 +334,7 @@ int App::initialize(const AppOptions& options)
|
|||||||
// Load modules
|
// Load modules
|
||||||
m_modules = std::make_unique<Modules>(createLogInDesktop, pref);
|
m_modules = std::make_unique<Modules>(createLogInDesktop, pref);
|
||||||
m_legacy = std::make_unique<LegacyModules>(isGui() ? REQUIRE_INTERFACE: 0);
|
m_legacy = std::make_unique<LegacyModules>(isGui() ? REQUIRE_INTERFACE: 0);
|
||||||
#ifdef ENABLE_UI
|
|
||||||
m_brushes = std::make_unique<AppBrushes>();
|
m_brushes = std::make_unique<AppBrushes>();
|
||||||
#endif
|
|
||||||
|
|
||||||
// Data recovery is enabled only in GUI mode
|
// Data recovery is enabled only in GUI mode
|
||||||
if (isGui() && pref.general.dataRecovery())
|
if (isGui() && pref.general.dataRecovery())
|
||||||
@ -365,7 +347,6 @@ int App::initialize(const AppOptions& options)
|
|||||||
// palette from an old format palette to the new one, etc.
|
// palette from an old format palette to the new one, etc.
|
||||||
load_default_palette();
|
load_default_palette();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Initialize GUI interface
|
// Initialize GUI interface
|
||||||
if (isGui()) {
|
if (isGui()) {
|
||||||
LOG("APP: GUI mode\n");
|
LOG("APP: GUI mode\n");
|
||||||
@ -416,7 +397,6 @@ int App::initialize(const AppOptions& options)
|
|||||||
manager->updateAllDisplays(scale, gpu);
|
manager->updateAllDisplays(scale, gpu);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
// Call the init() function from all plugins
|
// Call the init() function from all plugins
|
||||||
@ -445,25 +425,30 @@ int App::initialize(const AppOptions& options)
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
struct CloseMainWindow {
|
struct CloseMainWindow {
|
||||||
std::unique_ptr<MainWindow>& m_win;
|
std::unique_ptr<MainWindow>& m_win;
|
||||||
CloseMainWindow(std::unique_ptr<MainWindow>& win) : m_win(win) { }
|
CloseMainWindow(std::unique_ptr<MainWindow>& win) : m_win(win) { }
|
||||||
~CloseMainWindow() { m_win.reset(nullptr); }
|
~CloseMainWindow() { m_win.reset(nullptr); }
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
struct CloseAllDocs {
|
// Deletes all docs.
|
||||||
|
struct DeleteAllDocs {
|
||||||
Context* m_ctx;
|
Context* m_ctx;
|
||||||
CloseAllDocs(Context* ctx) : m_ctx(ctx) { }
|
DeleteAllDocs(Context* ctx) : m_ctx(ctx) { }
|
||||||
~CloseAllDocs() {
|
~DeleteAllDocs() {
|
||||||
std::vector<Doc*> docs;
|
std::vector<Doc*> docs;
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
// Add all documents that were closed in the past, these docs
|
||||||
|
// are not part of any context and they are just temporarily in
|
||||||
|
// memory just in case the user wants to recover them.
|
||||||
for (Doc* doc : static_cast<UIContext*>(m_ctx)->getAndRemoveAllClosedDocs())
|
for (Doc* doc : static_cast<UIContext*>(m_ctx)->getAndRemoveAllClosedDocs())
|
||||||
docs.push_back(doc);
|
docs.push_back(doc);
|
||||||
#endif
|
|
||||||
|
// Add documents that are currently opened/in tabs/in the
|
||||||
|
// context.
|
||||||
for (Doc* doc : m_ctx->documents())
|
for (Doc* doc : m_ctx->documents())
|
||||||
docs.push_back(doc);
|
docs.push_back(doc);
|
||||||
|
|
||||||
for (Doc* doc : docs) {
|
for (Doc* doc : docs) {
|
||||||
// First we close the document. In this way we receive recent
|
// First we close the document. In this way we receive recent
|
||||||
// notifications related to the document as a app::Doc. If
|
// notifications related to the document as a app::Doc. If
|
||||||
@ -486,12 +471,9 @@ namespace {
|
|||||||
|
|
||||||
void App::run()
|
void App::run()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
CloseMainWindow closeMainWindow(m_mainWindow);
|
CloseMainWindow closeMainWindow(m_mainWindow);
|
||||||
#endif
|
DeleteAllDocs deleteAllDocsAtExit(context());
|
||||||
CloseAllDocs closeAllDocsAtExit(context());
|
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Run the GUI
|
// Run the GUI
|
||||||
if (isGui()) {
|
if (isGui()) {
|
||||||
auto manager = ui::Manager::getDefault();
|
auto manager = ui::Manager::getDefault();
|
||||||
@ -582,7 +564,6 @@ void App::run()
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
// Start shell to execute scripts.
|
// Start shell to execute scripts.
|
||||||
@ -605,7 +586,6 @@ void App::run()
|
|||||||
|
|
||||||
void App::close()
|
void App::close()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (isGui()) {
|
if (isGui()) {
|
||||||
ExitGui();
|
ExitGui();
|
||||||
|
|
||||||
@ -616,7 +596,6 @@ void App::close()
|
|||||||
// exceptions, and we are not in a destructor).
|
// exceptions, and we are not in a destructor).
|
||||||
m_modules->deleteDataRecovery();
|
m_modules->deleteDataRecovery();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finishes the Aseprite application.
|
// Finishes the Aseprite application.
|
||||||
@ -645,7 +624,6 @@ App::~App()
|
|||||||
// Fire App Exit signal.
|
// Fire App Exit signal.
|
||||||
App::instance()->Exit();
|
App::instance()->Exit();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Finalize modules, configuration and core.
|
// Finalize modules, configuration and core.
|
||||||
Editor::destroyEditorSharedInternals();
|
Editor::destroyEditorSharedInternals();
|
||||||
|
|
||||||
@ -653,7 +631,6 @@ App::~App()
|
|||||||
|
|
||||||
// Save brushes
|
// Save brushes
|
||||||
m_brushes.reset();
|
m_brushes.reset();
|
||||||
#endif
|
|
||||||
|
|
||||||
m_legacy.reset();
|
m_legacy.reset();
|
||||||
m_modules.reset();
|
m_modules.reset();
|
||||||
@ -667,11 +644,9 @@ App::~App()
|
|||||||
|
|
||||||
m_coreModules.reset();
|
m_coreModules.reset();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Destroy the loaded gui.xml data.
|
// Destroy the loaded gui.xml data.
|
||||||
KeyboardShortcuts::destroyInstance();
|
KeyboardShortcuts::destroyInstance();
|
||||||
GuiXml::destroyInstance();
|
GuiXml::destroyInstance();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
catch (const std::exception& e) {
|
catch (const std::exception& e) {
|
||||||
LOG(ERROR, "APP: Error: %s\n", e.what());
|
LOG(ERROR, "APP: Error: %s\n", e.what());
|
||||||
@ -723,12 +698,8 @@ tools::ActiveToolManager* App::activeToolManager() const
|
|||||||
|
|
||||||
RecentFiles* App::recentFiles() const
|
RecentFiles* App::recentFiles() const
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
ASSERT(m_modules != nullptr);
|
||||||
ASSERT(m_modules != NULL);
|
|
||||||
return &m_modules->m_recent_files;
|
return &m_modules->m_recent_files;
|
||||||
#else
|
|
||||||
return nullptr;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Workspace* App::workspace() const
|
Workspace* App::workspace() const
|
||||||
@ -767,7 +738,6 @@ crash::DataRecovery* App::dataRecovery() const
|
|||||||
return m_modules->recovery();
|
return m_modules->recovery();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
void App::showNotification(INotificationDelegate* del)
|
void App::showNotification(INotificationDelegate* del)
|
||||||
{
|
{
|
||||||
if (m_mainWindow)
|
if (m_mainWindow)
|
||||||
@ -837,14 +807,14 @@ InputChain& App::inputChain()
|
|||||||
{
|
{
|
||||||
return m_modules->m_inputChain;
|
return m_modules->m_inputChain;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Updates palette and redraw the screen.
|
// Updates palette and redraw the screen.
|
||||||
void app_refresh_screen()
|
void app_refresh_screen()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
Context* ctx = UIContext::instance();
|
Context* ctx = UIContext::instance();
|
||||||
ASSERT(ctx != NULL);
|
ASSERT(ctx != nullptr);
|
||||||
|
if (!ctx)
|
||||||
|
return;
|
||||||
|
|
||||||
Site site = ctx->activeSite();
|
Site site = ctx->activeSite();
|
||||||
if (Palette* pal = site.palette())
|
if (Palette* pal = site.palette())
|
||||||
@ -853,8 +823,8 @@ void app_refresh_screen()
|
|||||||
set_current_palette(nullptr, false);
|
set_current_palette(nullptr, false);
|
||||||
|
|
||||||
// Invalidate the whole screen.
|
// Invalidate the whole screen.
|
||||||
ui::Manager::getDefault()->invalidate();
|
if (auto* man = ui::Manager::getDefault())
|
||||||
#endif // ENABLE_UI
|
man->invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO remove app_rebuild_documents_tabs() and replace it by
|
// TODO remove app_rebuild_documents_tabs() and replace it by
|
||||||
@ -862,12 +832,10 @@ void app_refresh_screen()
|
|||||||
// document is modified).
|
// document is modified).
|
||||||
void app_rebuild_documents_tabs()
|
void app_rebuild_documents_tabs()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
if (auto* app = App::instance(); app->isGui()) {
|
||||||
if (App::instance()->isGui()) {
|
app->workspace()->updateTabs();
|
||||||
App::instance()->workspace()->updateTabs();
|
app->updateDisplayTitleBar();
|
||||||
App::instance()->updateDisplayTitleBar();
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PixelFormat app_get_current_pixel_format()
|
PixelFormat app_get_current_pixel_format()
|
||||||
@ -883,21 +851,20 @@ PixelFormat app_get_current_pixel_format()
|
|||||||
|
|
||||||
int app_get_color_to_clear_layer(Layer* layer)
|
int app_get_color_to_clear_layer(Layer* layer)
|
||||||
{
|
{
|
||||||
ASSERT(layer != NULL);
|
ASSERT(layer != nullptr);
|
||||||
|
|
||||||
app::Color color;
|
app::Color color;
|
||||||
|
|
||||||
// The `Background' is erased with the `Background Color'
|
// The `Background' is erased with the `Background Color'
|
||||||
if (layer->isBackground()) {
|
if (layer->isBackground()) {
|
||||||
#ifdef ENABLE_UI
|
if (auto* colorBar = ColorBar::instance())
|
||||||
if (ColorBar::instance())
|
color = colorBar->getBgColor();
|
||||||
color = ColorBar::instance()->getBgColor();
|
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
color = app::Color::fromRgb(0, 0, 0); // TODO get background color color from doc::Settings
|
color = app::Color::fromRgb(0, 0, 0); // TODO get background color color from doc::Settings
|
||||||
}
|
}
|
||||||
else // All transparent layers are cleared with the mask color
|
else { // All transparent layers are cleared with the mask color
|
||||||
color = app::Color::fromMask();
|
color = app::Color::fromMask();
|
||||||
|
}
|
||||||
|
|
||||||
return color_utils::color_for_layer(color, layer);
|
return color_utils::color_for_layer(color, layer);
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,7 @@
|
|||||||
#define APP_APP_H_INCLUDED
|
#define APP_APP_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
#include "app/app_brushes.h"
|
#include "app/app_brushes.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "base/paths.h"
|
#include "base/paths.h"
|
||||||
#include "doc/pixel_format.h"
|
#include "doc/pixel_format.h"
|
||||||
#include "obs/signal.h"
|
#include "obs/signal.h"
|
||||||
@ -101,7 +98,6 @@ namespace app {
|
|||||||
Extensions& extensions() const;
|
Extensions& extensions() const;
|
||||||
crash::DataRecovery* dataRecovery() const;
|
crash::DataRecovery* dataRecovery() const;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
AppBrushes& brushes() {
|
AppBrushes& brushes() {
|
||||||
ASSERT(m_brushes.get());
|
ASSERT(m_brushes.get());
|
||||||
return *m_brushes;
|
return *m_brushes;
|
||||||
@ -112,7 +108,6 @@ namespace app {
|
|||||||
void updateDisplayTitleBar();
|
void updateDisplayTitleBar();
|
||||||
|
|
||||||
InputChain& inputChain();
|
InputChain& inputChain();
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
script::Engine* scriptEngine() { return m_engine.get(); }
|
script::Engine* scriptEngine() { return m_engine.get(); }
|
||||||
@ -147,10 +142,8 @@ namespace app {
|
|||||||
#endif
|
#endif
|
||||||
std::unique_ptr<MainWindow> m_mainWindow;
|
std::unique_ptr<MainWindow> m_mainWindow;
|
||||||
base::paths m_files;
|
base::paths m_files;
|
||||||
#ifdef ENABLE_UI
|
|
||||||
std::unique_ptr<AppBrushes> m_brushes;
|
std::unique_ptr<AppBrushes> m_brushes;
|
||||||
std::unique_ptr<BackupIndicator> m_backupIndicator;
|
std::unique_ptr<BackupIndicator> m_backupIndicator;
|
||||||
#endif // ENABLE_UI
|
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
std::unique_ptr<script::Engine> m_engine;
|
std::unique_ptr<script::Engine> m_engine;
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,13 +11,10 @@
|
|||||||
|
|
||||||
#include "app/cmd_transaction.h"
|
#include "app/cmd_transaction.h"
|
||||||
|
|
||||||
|
#include "app/app.h"
|
||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
#include "app/site.h"
|
#include "app/site.h"
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
#include "app/app.h"
|
|
||||||
#include "app/ui/timeline/timeline.h"
|
#include "app/ui/timeline/timeline.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
@ -45,10 +42,8 @@ CmdTransaction* CmdTransaction::moveToEmptyCopy()
|
|||||||
|
|
||||||
void CmdTransaction::setNewDocRange(const DocRange& range)
|
void CmdTransaction::setNewDocRange(const DocRange& range)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (m_ranges)
|
if (m_ranges)
|
||||||
range.write(m_ranges->m_after);
|
range.write(m_ranges->m_after);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CmdTransaction::updateSpritePositionAfter()
|
void CmdTransaction::updateSpritePositionAfter()
|
||||||
@ -87,12 +82,10 @@ void CmdTransaction::onExecute()
|
|||||||
{
|
{
|
||||||
// Save the current site and doc range
|
// Save the current site and doc range
|
||||||
m_spritePositionBefore = calcSpritePosition();
|
m_spritePositionBefore = calcSpritePosition();
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (isDocRangeEnabled()) {
|
if (isDocRangeEnabled()) {
|
||||||
m_ranges.reset(new Ranges);
|
m_ranges.reset(new Ranges);
|
||||||
calcDocRange().write(m_ranges->m_before);
|
calcDocRange().write(m_ranges->m_before);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Execute the sequence of "cmds"
|
// Execute the sequence of "cmds"
|
||||||
CmdSequence::onExecute();
|
CmdSequence::onExecute();
|
||||||
@ -131,28 +124,23 @@ SpritePosition CmdTransaction::calcSpritePosition() const
|
|||||||
|
|
||||||
bool CmdTransaction::isDocRangeEnabled() const
|
bool CmdTransaction::isDocRangeEnabled() const
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (App::instance()) {
|
if (App::instance()) {
|
||||||
Timeline* timeline = App::instance()->timeline();
|
Timeline* timeline = App::instance()->timeline();
|
||||||
if (timeline && timeline->range().enabled())
|
if (timeline && timeline->range().enabled())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DocRange CmdTransaction::calcDocRange() const
|
DocRange CmdTransaction::calcDocRange() const
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// TODO We cannot use Context::activeSite() because it losts
|
// TODO We cannot use Context::activeSite() because it losts
|
||||||
// important information about the DocRange() (type and
|
// important information about the DocRange() (type and
|
||||||
// flags).
|
// flags).
|
||||||
if (App::instance()) {
|
if (App* app = App::instance()) {
|
||||||
Timeline* timeline = App::instance()->timeline();
|
if (Timeline* timeline = app->timeline())
|
||||||
if (timeline)
|
|
||||||
return timeline->range();
|
return timeline->range();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return DocRange();
|
return DocRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,11 +39,9 @@ os::ColorSpaceRef get_screen_color_space()
|
|||||||
|
|
||||||
os::ColorSpaceRef get_current_color_space()
|
os::ColorSpaceRef get_current_color_space()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
if (auto* editor = Editor::activeEditor())
|
||||||
if (auto editor = Editor::activeEditor())
|
|
||||||
return editor->document()->osColorSpace();
|
return editor->document()->osColorSpace();
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return get_screen_color_space();
|
return get_screen_color_space();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,10 +60,7 @@ void BackgroundFromLayerCommand::onExecute(Context* context)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(document);
|
||||||
if (context->isUIAvailable())
|
|
||||||
update_screen_for_document(document);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createBackgroundFromLayerCommand()
|
Command* CommandFactory::createBackgroundFromLayerCommand()
|
||||||
|
@ -48,8 +48,6 @@ struct CanvasSizeParams : public NewParams {
|
|||||||
Param<bool> trimOutside { this, false, "trimOutside" };
|
Param<bool> trimOutside { this, false, "trimOutside" };
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
// Window used to show canvas parameters.
|
// Window used to show canvas parameters.
|
||||||
class CanvasSizeWindow : public app::gen::CanvasSize
|
class CanvasSizeWindow : public app::gen::CanvasSize
|
||||||
, public SelectBoxDelegate
|
, public SelectBoxDelegate
|
||||||
@ -285,8 +283,6 @@ private:
|
|||||||
EditorStatePtr m_selectBoxState;
|
EditorStatePtr m_selectBoxState;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
class CanvasSizeCommand : public CommandWithNewParams<CanvasSizeParams> {
|
class CanvasSizeCommand : public CommandWithNewParams<CanvasSizeParams> {
|
||||||
public:
|
public:
|
||||||
CanvasSizeCommand();
|
CanvasSizeCommand();
|
||||||
@ -309,9 +305,7 @@ bool CanvasSizeCommand::onEnabled(Context* context)
|
|||||||
|
|
||||||
void CanvasSizeCommand::onExecute(Context* context)
|
void CanvasSizeCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
const bool ui = (params().ui() && context->isUIAvailable());
|
const bool ui = (params().ui() && context->isUIAvailable());
|
||||||
#endif
|
|
||||||
const ContextReader reader(context);
|
const ContextReader reader(context);
|
||||||
const Sprite* sprite(reader.sprite());
|
const Sprite* sprite(reader.sprite());
|
||||||
auto& params = this->params();
|
auto& params = this->params();
|
||||||
@ -326,7 +320,6 @@ void CanvasSizeCommand::onExecute(Context* context)
|
|||||||
params.right(), params.bottom()));
|
params.right(), params.bottom()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
if (!params.trimOutside.isSet()) {
|
if (!params.trimOutside.isSet()) {
|
||||||
params.trimOutside(Preferences::instance().canvasSize.trimOutside());
|
params.trimOutside(Preferences::instance().canvasSize.trimOutside());
|
||||||
@ -376,7 +369,6 @@ void CanvasSizeCommand::onExecute(Context* context)
|
|||||||
params.right(), params.bottom()));
|
params.right(), params.bottom()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (bounds.w < 1) bounds.w = 1;
|
if (bounds.w < 1) bounds.w = 1;
|
||||||
if (bounds.h < 1) bounds.h = 1;
|
if (bounds.h < 1) bounds.h = 1;
|
||||||
@ -390,10 +382,7 @@ void CanvasSizeCommand::onExecute(Context* context)
|
|||||||
api.cropSprite(sprite, bounds, params.trimOutside());
|
api.cropSprite(sprite, bounds, params.trimOutside());
|
||||||
tx.commit();
|
tx.commit();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(doc);
|
||||||
if (context->isUIAvailable())
|
|
||||||
update_screen_for_document(doc);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +77,8 @@ void CelOpacityCommand::onExecute(Context* context)
|
|||||||
// TODO the range of selected cels should be in app::Site.
|
// TODO the range of selected cels should be in app::Site.
|
||||||
DocRange range;
|
DocRange range;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable())
|
if (context->isUIAvailable())
|
||||||
range = App::instance()->timeline()->range();
|
range = App::instance()->timeline()->range();
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!range.enabled()) {
|
if (!range.enabled()) {
|
||||||
range.startRange(layer, cel->frame(), DocRange::kCels);
|
range.startRange(layer, cel->frame(), DocRange::kCels);
|
||||||
@ -100,10 +98,7 @@ void CelOpacityCommand::onExecute(Context* context)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(writer.document());
|
||||||
if (context->isUIAvailable())
|
|
||||||
update_screen_for_document(writer.document());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CelOpacityCommand::onGetFriendlyName() const
|
std::string CelOpacityCommand::onGetFriendlyName() const
|
||||||
|
@ -166,8 +166,6 @@ private:
|
|||||||
std::thread m_thread;
|
std::thread m_thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
class ConversionItem : public ListItem {
|
class ConversionItem : public ListItem {
|
||||||
public:
|
public:
|
||||||
ConversionItem(const doc::PixelFormat pixelFormat)
|
ConversionItem(const doc::PixelFormat pixelFormat)
|
||||||
@ -468,8 +466,6 @@ private:
|
|||||||
bool m_imageJustCreated;
|
bool m_imageJustCreated;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
class ChangePixelFormatCommand : public Command {
|
class ChangePixelFormatCommand : public Command {
|
||||||
@ -628,7 +624,6 @@ void ChangePixelFormatCommand::onExecute(Context* context)
|
|||||||
{
|
{
|
||||||
bool flatten = false;
|
bool flatten = false;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable() && m_showDlg) {
|
if (context->isUIAvailable() && m_showDlg) {
|
||||||
ColorModeWindow window(Editor::activeEditor());
|
ColorModeWindow window(Editor::activeEditor());
|
||||||
|
|
||||||
@ -650,7 +645,6 @@ void ChangePixelFormatCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
window.saveOptions();
|
window.saveOptions();
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
// No conversion needed
|
// No conversion needed
|
||||||
Doc* doc = context->activeDocument();
|
Doc* doc = context->activeDocument();
|
||||||
|
@ -41,8 +41,6 @@ struct ColorQuantizationParams : public NewParams {
|
|||||||
Param<RgbMapAlgorithm> algorithm { this, RgbMapAlgorithm::DEFAULT, "algorithm" };
|
Param<RgbMapAlgorithm> algorithm { this, RgbMapAlgorithm::DEFAULT, "algorithm" };
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_UI
|
|
||||||
|
|
||||||
class PaletteFromSpriteWindow : public app::gen::PaletteFromSprite {
|
class PaletteFromSpriteWindow : public app::gen::PaletteFromSprite {
|
||||||
public:
|
public:
|
||||||
PaletteFromSpriteWindow() {
|
PaletteFromSpriteWindow() {
|
||||||
@ -68,8 +66,6 @@ private:
|
|||||||
RgbMapAlgorithmSelector m_algoSelector;
|
RgbMapAlgorithmSelector m_algoSelector;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ColorQuantizationCommand : public CommandWithNewParams<ColorQuantizationParams> {
|
class ColorQuantizationCommand : public CommandWithNewParams<ColorQuantizationParams> {
|
||||||
public:
|
public:
|
||||||
ColorQuantizationCommand();
|
ColorQuantizationCommand();
|
||||||
@ -103,7 +99,6 @@ void ColorQuantizationCommand::onExecute(Context* ctx)
|
|||||||
Site site = ctx->activeSite();
|
Site site = ctx->activeSite();
|
||||||
PalettePicks entries = site.selectedColors();
|
PalettePicks entries = site.selectedColors();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
PaletteFromSpriteWindow window;
|
PaletteFromSpriteWindow window;
|
||||||
{
|
{
|
||||||
@ -160,9 +155,7 @@ void ColorQuantizationCommand::onExecute(Context* ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
createPal = (!params().useRange());
|
createPal = (!params().useRange());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +77,7 @@ void CropSpriteCommand::onExecute(Context* context)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(document);
|
||||||
if (context->isUIAvailable())
|
|
||||||
update_screen_for_document(document);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class AutocropSpriteCommand : public Command {
|
class AutocropSpriteCommand : public Command {
|
||||||
@ -124,10 +121,7 @@ void AutocropSpriteCommand::onExecute(Context* context)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(document);
|
||||||
if (context->isUIAvailable())
|
|
||||||
update_screen_for_document(document);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AutocropSpriteCommand::onGetFriendlyName() const
|
std::string AutocropSpriteCommand::onGetFriendlyName() const
|
||||||
|
@ -49,10 +49,7 @@ void DeselectMaskCommand::onExecute(Context* context)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(document);
|
||||||
if (context->isUIAvailable())
|
|
||||||
update_screen_for_document(document);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createDeselectMaskCommand()
|
Command* CommandFactory::createDeselectMaskCommand()
|
||||||
|
@ -56,8 +56,6 @@ using namespace ui;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
enum Section {
|
enum Section {
|
||||||
kSectionLayout,
|
kSectionLayout,
|
||||||
kSectionSprite,
|
kSectionSprite,
|
||||||
@ -139,8 +137,6 @@ ConstraintType constraint_type_from_params(const ExportSpriteSheetParams& params
|
|||||||
return kConstraintType_None;
|
return kConstraintType_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
void destroy_doc(Context* ctx, Doc* doc)
|
void destroy_doc(Context* ctx, Doc* doc)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -304,8 +300,6 @@ std::unique_ptr<Doc> generate_sprite_sheet(
|
|||||||
return newDocument;
|
return newDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_UI
|
|
||||||
|
|
||||||
class ExportSpriteSheetWindow : public app::gen::ExportSpriteSheet {
|
class ExportSpriteSheetWindow : public app::gen::ExportSpriteSheet {
|
||||||
public:
|
public:
|
||||||
ExportSpriteSheetWindow(DocExporter& exporter,
|
ExportSpriteSheetWindow(DocExporter& exporter,
|
||||||
@ -1230,8 +1224,6 @@ private:
|
|||||||
std::unique_ptr<Doc> m_doc;
|
std::unique_ptr<Doc> m_doc;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
ExportSpriteSheetCommand::ExportSpriteSheetCommand(const char* id)
|
ExportSpriteSheetCommand::ExportSpriteSheetCommand(const char* id)
|
||||||
@ -1250,14 +1242,6 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
|||||||
auto& params = this->params();
|
auto& params = this->params();
|
||||||
DocExporter exporter;
|
DocExporter exporter;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// TODO if we use this line when !ENABLE_UI,
|
|
||||||
// Preferences::~Preferences() crashes on Linux when it wants to
|
|
||||||
// save the document preferences. It looks like
|
|
||||||
// Preferences::onRemoveDocument() is not called for some documents
|
|
||||||
// and when the Preferences::m_docs collection is iterated to save
|
|
||||||
// all DocumentPreferences, it accesses an invalid Doc* pointer (an
|
|
||||||
// already removed/deleted document).
|
|
||||||
Doc* document = site.document();
|
Doc* document = site.document();
|
||||||
DocumentPreferences& docPref(Preferences::instance().document(document));
|
DocumentPreferences& docPref(Preferences::instance().document(document));
|
||||||
|
|
||||||
@ -1367,11 +1351,9 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
|||||||
true, params.dataFilename()))
|
true, params.dataFilename()))
|
||||||
return; // Do not overwrite
|
return; // Do not overwrite
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
exporter.setDocImageBuffer(std::make_shared<doc::ImageBuffer>());
|
exporter.setDocImageBuffer(std::make_shared<doc::ImageBuffer>());
|
||||||
std::unique_ptr<Doc> newDocument;
|
std::unique_ptr<Doc> newDocument;
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable()) {
|
if (context->isUIAvailable()) {
|
||||||
ExportSpriteSheetJob job(exporter, site, params,
|
ExportSpriteSheetJob job(exporter, site, params,
|
||||||
// Progress bar can be disabled with ui=false
|
// Progress bar can be disabled with ui=false
|
||||||
@ -1401,9 +1383,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
|||||||
newDocPref.pixelGrid = docPref.pixelGrid;
|
newDocPref.pixelGrid = docPref.pixelGrid;
|
||||||
Preferences::instance().removeDocument(newDocument.get());
|
Preferences::instance().removeDocument(newDocument.get());
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
base::task_token token;
|
base::task_token token;
|
||||||
newDocument = generate_sprite_sheet(
|
newDocument = generate_sprite_sheet(
|
||||||
exporter, context, site, params, true, token);
|
exporter, context, site, params, true, token);
|
||||||
|
@ -51,12 +51,10 @@ bool FillCommand::onEnabled(Context* ctx)
|
|||||||
ContextFlags::ActiveLayerIsImage)) {
|
ContextFlags::ActiveLayerIsImage)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#if ENABLE_UI
|
auto* editor = Editor::activeEditor();
|
||||||
auto editor = Editor::activeEditor();
|
|
||||||
if (editor && editor->isMovingPixels()) {
|
if (editor && editor->isMovingPixels()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,10 +68,8 @@ void FlattenLayersCommand::onExecute(Context* context)
|
|||||||
range.selectLayer(layer);
|
range.selectLayer(layer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable())
|
if (context->isUIAvailable())
|
||||||
range = App::instance()->timeline()->range();
|
range = App::instance()->timeline()->range();
|
||||||
#endif
|
|
||||||
|
|
||||||
// If the range is not selected or we have only one image layer
|
// If the range is not selected or we have only one image layer
|
||||||
// selected, we'll flatten all layers.
|
// selected, we'll flatten all layers.
|
||||||
@ -89,9 +87,7 @@ void FlattenLayersCommand::onExecute(Context* context)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
update_screen_for_document(writer.document());
|
update_screen_for_document(writer.document());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FlattenLayersCommand::onGetFriendlyName() const
|
std::string FlattenLayersCommand::onGetFriendlyName() const
|
||||||
|
@ -73,7 +73,6 @@ void FlipCommand::onExecute(Context* ctx)
|
|||||||
|
|
||||||
CelList cels;
|
CelList cels;
|
||||||
if (m_flipMask) {
|
if (m_flipMask) {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// If we want to flip the visible mask we can go to
|
// If we want to flip the visible mask we can go to
|
||||||
// MovingPixelsState (even when the range is enabled, because now
|
// MovingPixelsState (even when the range is enabled, because now
|
||||||
// PixelsMovement support ranges).
|
// PixelsMovement support ranges).
|
||||||
@ -88,7 +87,6 @@ void FlipCommand::onExecute(Context* ctx)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
auto range = site.range();
|
auto range = site.range();
|
||||||
if (range.enabled()) {
|
if (range.enabled()) {
|
||||||
@ -101,12 +99,10 @@ void FlipCommand::onExecute(Context* ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cels.empty()) {
|
if (cels.empty()) {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ctx->isUIAvailable()) {
|
if (ctx->isUIAvailable()) {
|
||||||
StatusBar::instance()->showTip(
|
StatusBar::instance()->showTip(
|
||||||
1000, Strings::statusbar_tips_all_layers_are_locked());
|
1000, Strings::statusbar_tips_all_layers_are_locked());
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,10 +230,7 @@ void FlipCommand::onExecute(Context* ctx)
|
|||||||
|
|
||||||
tx.commit();
|
tx.commit();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(document);
|
||||||
if (ctx->isUIAvailable())
|
|
||||||
update_screen_for_document(document);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FlipCommand::onGetFriendlyName() const
|
std::string FlipCommand::onGetFriendlyName() const
|
||||||
|
@ -416,7 +416,6 @@ void ImportSpriteSheetCommand::onExecute(Context* context)
|
|||||||
Doc* document;
|
Doc* document;
|
||||||
auto& params = this->params();
|
auto& params = this->params();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable() && params.ui()) {
|
if (context->isUIAvailable() && params.ui()) {
|
||||||
// TODO use params as input values for the ImportSpriteSheetWindow
|
// TODO use params as input values for the ImportSpriteSheetWindow
|
||||||
|
|
||||||
@ -438,9 +437,9 @@ void ImportSpriteSheetCommand::onExecute(Context* context)
|
|||||||
docPref->importSpriteSheet.paddingBounds(params.padding());
|
docPref->importSpriteSheet.paddingBounds(params.padding());
|
||||||
docPref->importSpriteSheet.paddingEnabled(window.paddingEnabledValue());
|
docPref->importSpriteSheet.paddingEnabled(window.paddingEnabledValue());
|
||||||
}
|
}
|
||||||
else // We import the sprite sheet from the active document if there is no UI
|
// We import the sprite sheet from the active document if there is
|
||||||
#endif
|
// no UI.
|
||||||
{
|
else {
|
||||||
document = context->activeDocument();
|
document = context->activeDocument();
|
||||||
if (!document)
|
if (!document)
|
||||||
return;
|
return;
|
||||||
@ -558,10 +557,7 @@ void ImportSpriteSheetCommand::onExecute(Context* context)
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(document);
|
||||||
if (context->isUIAvailable())
|
|
||||||
update_screen_for_document(document);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createImportSpriteSheetCommand()
|
Command* CommandFactory::createImportSpriteSheetCommand()
|
||||||
|
@ -55,10 +55,7 @@ void LayerFromBackgroundCommand::onExecute(Context* context)
|
|||||||
tx(new cmd::LayerFromBackground(writer.layer()));
|
tx(new cmd::LayerFromBackground(writer.layer()));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(document);
|
||||||
if (context->isUIAvailable())
|
|
||||||
update_screen_for_document(document);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createLayerFromBackgroundCommand()
|
Command* CommandFactory::createLayerFromBackgroundCommand()
|
||||||
|
@ -61,7 +61,6 @@ void LoadPaletteCommand::onExecute(Context* context)
|
|||||||
else if (!m_filename.empty()) {
|
else if (!m_filename.empty()) {
|
||||||
filename = m_filename;
|
filename = m_filename;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_UI
|
|
||||||
else if (context->isUIAvailable()) {
|
else if (context->isUIAvailable()) {
|
||||||
base::paths exts = get_readable_palette_extensions();
|
base::paths exts = get_readable_palette_extensions();
|
||||||
base::paths filenames;
|
base::paths filenames;
|
||||||
@ -71,7 +70,6 @@ void LoadPaletteCommand::onExecute(Context* context)
|
|||||||
filename = filenames.front();
|
filename = filenames.front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
// Do nothing
|
// Do nothing
|
||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
|
@ -59,10 +59,7 @@ void MaskAllCommand::onExecute(Context* context)
|
|||||||
docPref.show.selectionEdges(true);
|
docPref.show.selectionEdges(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(document);
|
||||||
if (context->isUIAvailable())
|
|
||||||
update_screen_for_document(document);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createMaskAllCommand()
|
Command* CommandFactory::createMaskAllCommand()
|
||||||
|
@ -163,10 +163,7 @@ void MergeDownLayerCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
tx.commit();
|
tx.commit();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(document);
|
||||||
if (context->isUIAvailable())
|
|
||||||
update_screen_for_document(document);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createMergeDownLayerCommand()
|
Command* CommandFactory::createMergeDownLayerCommand()
|
||||||
|
@ -72,10 +72,7 @@ bool NewFileCommand::onEnabled(Context* ctx)
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
(!params().fromClipboard()
|
(!params().fromClipboard()
|
||||||
#ifdef ENABLE_UI
|
|| (ctx->clipboard()->format() == ClipboardFormat::Image));
|
||||||
|| (ctx->clipboard()->format() == ClipboardFormat::Image)
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewFileCommand::onExecute(Context* ctx)
|
void NewFileCommand::onExecute(Context* ctx)
|
||||||
@ -85,13 +82,10 @@ void NewFileCommand::onExecute(Context* ctx)
|
|||||||
doc::ColorMode colorMode = params().colorMode();
|
doc::ColorMode colorMode = params().colorMode();
|
||||||
app::Color bgColor = app::Color::fromMask();
|
app::Color bgColor = app::Color::fromMask();
|
||||||
doc::PixelRatio pixelRatio(1, 1);
|
doc::PixelRatio pixelRatio(1, 1);
|
||||||
#ifdef ENABLE_UI
|
|
||||||
doc::ImageRef clipboardImage;
|
doc::ImageRef clipboardImage;
|
||||||
doc::Palette clipboardPalette(0, 256);
|
doc::Palette clipboardPalette(0, 256);
|
||||||
#endif
|
|
||||||
const int ncolors = get_default_palette()->size();
|
const int ncolors = get_default_palette()->size();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (params().fromClipboard()) {
|
if (params().fromClipboard()) {
|
||||||
clipboardImage = ctx->clipboard()->getImage(&clipboardPalette);
|
clipboardImage = ctx->clipboard()->getImage(&clipboardPalette);
|
||||||
if (!clipboardImage)
|
if (!clipboardImage)
|
||||||
@ -205,7 +199,6 @@ void NewFileCommand::onExecute(Context* ctx)
|
|||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
ASSERT(colorMode == ColorMode::RGB ||
|
ASSERT(colorMode == ColorMode::RGB ||
|
||||||
colorMode == ColorMode::GRAYSCALE ||
|
colorMode == ColorMode::GRAYSCALE ||
|
||||||
@ -249,7 +242,6 @@ void NewFileCommand::onExecute(Context* ctx)
|
|||||||
|
|
||||||
set_current_palette(&oldPal, false);
|
set_current_palette(&oldPal, false);
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_UI
|
|
||||||
else if (clipboardImage) {
|
else if (clipboardImage) {
|
||||||
LayerImage* layerImage = static_cast<LayerImage*>(layer);
|
LayerImage* layerImage = static_cast<LayerImage*>(layer);
|
||||||
// layerImage->configureAsBackground();
|
// layerImage->configureAsBackground();
|
||||||
@ -265,7 +257,6 @@ void NewFileCommand::onExecute(Context* ctx)
|
|||||||
}
|
}
|
||||||
sprite->setPalette(&clipboardPalette, false);
|
sprite->setPalette(&clipboardPalette, false);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
if (layer->isBackground())
|
if (layer->isBackground())
|
||||||
layer->setName(Strings::commands_NewFile_BackgroundLayer());
|
layer->setName(Strings::commands_NewFile_BackgroundLayer());
|
||||||
|
@ -93,12 +93,10 @@ void NewFrameCommand::onExecute(Context* context)
|
|||||||
Doc* document(writer.document());
|
Doc* document(writer.document());
|
||||||
Sprite* sprite(writer.sprite());
|
Sprite* sprite(writer.sprite());
|
||||||
|
|
||||||
#if ENABLE_UI
|
|
||||||
// Show the tooltip feedback only if we are not inside a transaction
|
// Show the tooltip feedback only if we are not inside a transaction
|
||||||
// (e.g. we can be already in a transaction if we are running in a
|
// (e.g. we can be already in a transaction if we are running in a
|
||||||
// Lua script app.transaction()).
|
// Lua script app.transaction()).
|
||||||
const bool showTooltip = (document->transaction() == nullptr);
|
const bool showTooltip = (document->transaction() == nullptr);
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Tx tx(writer, friendlyName());
|
Tx tx(writer, friendlyName());
|
||||||
@ -127,11 +125,9 @@ void NewFrameCommand::onExecute(Context* context)
|
|||||||
if (site->inTimeline() &&
|
if (site->inTimeline() &&
|
||||||
!site->selectedLayers().empty() &&
|
!site->selectedLayers().empty() &&
|
||||||
!site->selectedFrames().empty()) {
|
!site->selectedFrames().empty()) {
|
||||||
#if ENABLE_UI
|
|
||||||
auto timeline = App::instance()->timeline();
|
auto timeline = App::instance()->timeline();
|
||||||
timeline->prepareToMoveRange();
|
timeline->prepareToMoveRange();
|
||||||
DocRange range = timeline->range();
|
DocRange range = timeline->range();
|
||||||
#endif
|
|
||||||
|
|
||||||
SelectedLayers selLayers;
|
SelectedLayers selLayers;
|
||||||
if (site->inFrames())
|
if (site->inFrames())
|
||||||
@ -156,10 +152,8 @@ void NewFrameCommand::onExecute(Context* context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI // TODO the range should be part of the Site
|
|
||||||
range.displace(0, frameRange);
|
range.displace(0, frameRange);
|
||||||
timeline->moveRange(range);
|
timeline->moveRange(range);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (auto layer = static_cast<LayerImage*>(writer.layer())) {
|
else if (auto layer = static_cast<LayerImage*>(writer.layer())) {
|
||||||
api.copyCel(
|
api.copyCel(
|
||||||
@ -175,7 +169,6 @@ void NewFrameCommand::onExecute(Context* context)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable() && showTooltip) {
|
if (context->isUIAvailable() && showTooltip) {
|
||||||
update_screen_for_document(document);
|
update_screen_for_document(document);
|
||||||
|
|
||||||
@ -186,7 +179,6 @@ void NewFrameCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
App::instance()->mainWindow()->popTimeline();
|
App::instance()->mainWindow()->popTimeline();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string NewFrameCommand::onGetFriendlyName() const
|
std::string NewFrameCommand::onGetFriendlyName() const
|
||||||
|
@ -128,11 +128,9 @@ bool NewLayerCommand::onEnabled(Context* ctx)
|
|||||||
ContextFlags::HasActiveSprite))
|
ContextFlags::HasActiveSprite))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (params().fromClipboard() &&
|
if (params().fromClipboard() &&
|
||||||
ctx->clipboard()->format() != ClipboardFormat::Image)
|
ctx->clipboard()->format() != ClipboardFormat::Image)
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((params().viaCut() ||
|
if ((params().viaCut() ||
|
||||||
params().viaCopy()) &&
|
params().viaCopy()) &&
|
||||||
@ -160,12 +158,10 @@ void NewLayerCommand::onExecute(Context* context)
|
|||||||
Sprite* sprite(reader.sprite());
|
Sprite* sprite(reader.sprite());
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
#if ENABLE_UI
|
|
||||||
// Show the tooltip feedback only if we are not inside a transaction
|
// Show the tooltip feedback only if we are not inside a transaction
|
||||||
// (e.g. we can be already in a transaction if we are running in a
|
// (e.g. we can be already in a transaction if we are running in a
|
||||||
// Lua script app.transaction()).
|
// Lua script app.transaction()).
|
||||||
const bool showTooltip = (document->transaction() == nullptr);
|
const bool showTooltip = (document->transaction() == nullptr);
|
||||||
#endif
|
|
||||||
|
|
||||||
Doc* pasteDoc = nullptr;
|
Doc* pasteDoc = nullptr;
|
||||||
Scoped destroyPasteDoc(
|
Scoped destroyPasteDoc(
|
||||||
@ -220,7 +216,6 @@ void NewLayerCommand::onExecute(Context* context)
|
|||||||
tilesetInfo.baseIndex = 1;
|
tilesetInfo.baseIndex = 1;
|
||||||
tilesetInfo.matchFlags = 0; // TODO default flags?
|
tilesetInfo.matchFlags = 0; // TODO default flags?
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// If params specify to ask the user about the name...
|
// If params specify to ask the user about the name...
|
||||||
if (params().ask() && context->isUIAvailable()) {
|
if (params().ask() && context->isUIAvailable()) {
|
||||||
auto& pref = Preferences::instance();
|
auto& pref = Preferences::instance();
|
||||||
@ -254,7 +249,6 @@ void NewLayerCommand::onExecute(Context* context)
|
|||||||
tilesetSelector->saveAdvancedPreferences();
|
tilesetSelector->saveAdvancedPreferences();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
LayerGroup* parent = sprite->root();
|
LayerGroup* parent = sprite->root();
|
||||||
Layer* activeLayer = reader.layer();
|
Layer* activeLayer = reader.layer();
|
||||||
@ -423,7 +417,6 @@ void NewLayerCommand::onExecute(Context* context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Paste new layer from clipboard
|
// Paste new layer from clipboard
|
||||||
else if (params().fromClipboard() && layer->isImage()) {
|
else if (params().fromClipboard() && layer->isImage()) {
|
||||||
context->clipboard()->paste(context, false);
|
context->clipboard()->paste(context, false);
|
||||||
@ -435,7 +428,6 @@ void NewLayerCommand::onExecute(Context* context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
// Paste new layer from selection
|
// Paste new layer from selection
|
||||||
else if ((params().viaCut() || params().viaCopy())
|
else if ((params().viaCut() || params().viaCopy())
|
||||||
&& document->isMaskVisible()) {
|
&& document->isMaskVisible()) {
|
||||||
@ -494,7 +486,6 @@ void NewLayerCommand::onExecute(Context* context)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable() && showTooltip) {
|
if (context->isUIAvailable() && showTooltip) {
|
||||||
update_screen_for_document(document);
|
update_screen_for_document(document);
|
||||||
|
|
||||||
@ -505,7 +496,6 @@ void NewLayerCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
App::instance()->mainWindow()->popTimeline();
|
App::instance()->mainWindow()->popTimeline();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string NewLayerCommand::onGetFriendlyName() const
|
std::string NewLayerCommand::onGetFriendlyName() const
|
||||||
|
@ -120,7 +120,6 @@ void OpenFileCommand::onExecute(Context* context)
|
|||||||
base::paths filenames;
|
base::paths filenames;
|
||||||
|
|
||||||
// interactive
|
// interactive
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable() && m_filename.empty()) {
|
if (context->isUIAvailable() && m_filename.empty()) {
|
||||||
base::paths exts = get_readable_extensions();
|
base::paths exts = get_readable_extensions();
|
||||||
|
|
||||||
@ -142,9 +141,7 @@ void OpenFileCommand::onExecute(Context* context)
|
|||||||
if (filenames.size() > 1)
|
if (filenames.size() > 1)
|
||||||
m_repeatCheckbox = true;
|
m_repeatCheckbox = true;
|
||||||
}
|
}
|
||||||
else
|
else if (!m_filename.empty()) {
|
||||||
#endif // ENABLE_UI
|
|
||||||
if (!m_filename.empty()) {
|
|
||||||
filenames.push_back(m_filename);
|
filenames.push_back(m_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ void PaletteSizeCommand::onExecute(Context* context)
|
|||||||
Palette palette(*reader.palette());
|
Palette palette(*reader.palette());
|
||||||
int ncolors = (m_size != 0 ? m_size: palette.size());
|
int ncolors = (m_size != 0 ? m_size: palette.size());
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (m_size == 0 && context->isUIAvailable()) {
|
if (m_size == 0 && context->isUIAvailable()) {
|
||||||
app::gen::PaletteSize window;
|
app::gen::PaletteSize window;
|
||||||
window.colors()->setTextf("%d", ncolors);
|
window.colors()->setTextf("%d", ncolors);
|
||||||
@ -70,7 +69,6 @@ void PaletteSizeCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
ncolors = window.colors()->textInt();
|
ncolors = window.colors()->textInt();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ncolors == palette.size())
|
if (ncolors == palette.size())
|
||||||
return;
|
return;
|
||||||
|
@ -38,11 +38,9 @@ static bool deleting_all_layers(Context* ctx, Sprite* sprite, int topLevelLayers
|
|||||||
{
|
{
|
||||||
const bool deletingAll = (topLevelLayersToDelete == sprite->root()->layersCount());
|
const bool deletingAll = (topLevelLayersToDelete == sprite->root()->layersCount());
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ctx->isUIAvailable() && deletingAll) {
|
if (ctx->isUIAvailable() && deletingAll) {
|
||||||
ui::Alert::show(Strings::alerts_cannot_delete_all_layers());
|
ui::Alert::show(Strings::alerts_cannot_delete_all_layers());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return deletingAll;
|
return deletingAll;
|
||||||
}
|
}
|
||||||
@ -77,7 +75,6 @@ static bool continue_deleting_unused_tilesets(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Just continue if UI is not available.
|
// Just continue if UI is not available.
|
||||||
if (!ctx->isUIAvailable())
|
if (!ctx->isUIAvailable())
|
||||||
return true;
|
return true;
|
||||||
@ -94,9 +91,6 @@ static bool continue_deleting_unused_tilesets(
|
|||||||
return tsiToDelete.empty() ||
|
return tsiToDelete.empty() ||
|
||||||
app::OptionalAlert::show(
|
app::OptionalAlert::show(
|
||||||
Preferences::instance().tilemap.showDeleteUnusedTilesetAlert, 1, message) == 1;
|
Preferences::instance().tilemap.showDeleteUnusedTilesetAlert, 1, message) == 1;
|
||||||
#else
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class RemoveLayerCommand : public Command {
|
class RemoveLayerCommand : public Command {
|
||||||
@ -199,7 +193,6 @@ void RemoveLayerCommand::onExecute(Context* context)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable()) {
|
if (context->isUIAvailable()) {
|
||||||
update_screen_for_document(document);
|
update_screen_for_document(document);
|
||||||
|
|
||||||
@ -213,7 +206,6 @@ void RemoveLayerCommand::onExecute(Context* context)
|
|||||||
1000, Strings::remove_layer_layers_removed());
|
1000, Strings::remove_layer_layers_removed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createRemoveLayerCommand()
|
Command* CommandFactory::createRemoveLayerCommand()
|
||||||
|
@ -65,7 +65,6 @@ void RunScriptCommand::onLoadParams(const Params& params)
|
|||||||
|
|
||||||
void RunScriptCommand::onExecute(Context* context)
|
void RunScriptCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
#if ENABLE_UI
|
|
||||||
if (context->isUIAvailable()) {
|
if (context->isUIAvailable()) {
|
||||||
int ret = OptionalAlert::show(
|
int ret = OptionalAlert::show(
|
||||||
Preferences::instance().scripts.showRunScriptAlert,
|
Preferences::instance().scripts.showRunScriptAlert,
|
||||||
@ -74,16 +73,13 @@ void RunScriptCommand::onExecute(Context* context)
|
|||||||
if (ret != 1)
|
if (ret != 1)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
App::instance()
|
App::instance()
|
||||||
->scriptEngine()
|
->scriptEngine()
|
||||||
->evalUserFile(m_filename, m_params);
|
->evalUserFile(m_filename, m_params);
|
||||||
|
|
||||||
#if ENABLE_UI
|
|
||||||
if (context->isUIAvailable())
|
if (context->isUIAvailable())
|
||||||
ui::Manager::getDefault()->invalidate();
|
ui::Manager::getDefault()->invalidate();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RunScriptCommand::onGetFriendlyName() const
|
std::string RunScriptCommand::onGetFriendlyName() const
|
||||||
|
@ -136,7 +136,6 @@ std::string SaveFileBaseCommand::saveAsDialog(
|
|||||||
base::paths exts = get_writable_extensions();
|
base::paths exts = get_writable_extensions();
|
||||||
filename = initialFilename;
|
filename = initialFilename;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable()) {
|
if (context->isUIAvailable()) {
|
||||||
again:;
|
again:;
|
||||||
base::paths newfilename;
|
base::paths newfilename;
|
||||||
@ -156,7 +155,6 @@ std::string SaveFileBaseCommand::saveAsDialog(
|
|||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
@ -200,7 +198,6 @@ void SaveFileBaseCommand::saveDocumentInBackground(
|
|||||||
const ResizeOnTheFly resizeOnTheFly,
|
const ResizeOnTheFly resizeOnTheFly,
|
||||||
const gfx::PointF& scale)
|
const gfx::PointF& scale)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// If the document is read only, we cannot save it directly (we have
|
// If the document is read only, we cannot save it directly (we have
|
||||||
// to use File > Save As)
|
// to use File > Save As)
|
||||||
if (document->isReadOnly() &&
|
if (document->isReadOnly() &&
|
||||||
@ -209,7 +206,6 @@ void SaveFileBaseCommand::saveDocumentInBackground(
|
|||||||
window.show();
|
window.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
gfx::Rect bounds;
|
gfx::Rect bounds;
|
||||||
if (params().bounds.isSet()) {
|
if (params().bounds.isSet()) {
|
||||||
@ -265,12 +261,10 @@ void SaveFileBaseCommand::saveDocumentInBackground(
|
|||||||
document->incrementVersion();
|
document->incrementVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context->isUIAvailable() && params().ui()) {
|
if (context->isUIAvailable() && params().ui()) {
|
||||||
StatusBar::instance()->setStatusText(
|
StatusBar::instance()->setStatusText(
|
||||||
2000, Strings::save_file_saved(base::get_file_name(filename)));
|
2000, Strings::save_file_saved(base::get_file_name(filename)));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +365,6 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
|
|||||||
bool isPlaySubtags = params().playSubtags();
|
bool isPlaySubtags = params().playSubtags();
|
||||||
bool isForTwitter = false;
|
bool isForTwitter = false;
|
||||||
|
|
||||||
#if ENABLE_UI
|
|
||||||
if (params().ui() && context->isUIAvailable()) {
|
if (params().ui() && context->isUIAvailable()) {
|
||||||
ExportFileWindow win(doc);
|
ExportFileWindow win(doc);
|
||||||
bool askOverwrite = true;
|
bool askOverwrite = true;
|
||||||
@ -447,7 +440,6 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
|
|||||||
isForTwitter = win.isForTwitter();
|
isForTwitter = win.isForTwitter();
|
||||||
isPlaySubtags = win.isPlaySubtags();
|
isPlaySubtags = win.isPlaySubtags();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
gfx::PointF scaleXY(scale, scale);
|
gfx::PointF scaleXY(scale, scale);
|
||||||
|
|
||||||
|
@ -141,12 +141,10 @@ protected:
|
|||||||
DocumentPreferences& docPref = Preferences::instance().document(ctx->activeDocument());
|
DocumentPreferences& docPref = Preferences::instance().document(ctx->activeDocument());
|
||||||
docPref.show.brushPreview(!docPref.show.brushPreview());
|
docPref.show.brushPreview(!docPref.show.brushPreview());
|
||||||
|
|
||||||
#if ENABLE_UI
|
|
||||||
// TODO we shouldn't need this, but it happens to be that the
|
// TODO we shouldn't need this, but it happens to be that the
|
||||||
// Preview editor isn't being updated correctly when we change the
|
// Preview editor isn't being updated correctly when we change the
|
||||||
// brush preview state.
|
// brush preview state.
|
||||||
update_screen_for_document(ctx->activeDocument());
|
update_screen_for_document(ctx->activeDocument());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -253,8 +253,6 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
class SpriteSizeWindow : public app::gen::SpriteSize {
|
class SpriteSizeWindow : public app::gen::SpriteSize {
|
||||||
public:
|
public:
|
||||||
SpriteSizeWindow(Context* ctx, const SpriteSizeParams& params) : m_ctx(ctx) {
|
SpriteSizeWindow(Context* ctx, const SpriteSizeParams& params) : m_ctx(ctx) {
|
||||||
@ -350,7 +348,6 @@ private:
|
|||||||
|
|
||||||
Context* m_ctx;
|
Context* m_ctx;
|
||||||
};
|
};
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
class SpriteSizeCommand : public CommandWithNewParams<SpriteSizeParams> {
|
class SpriteSizeCommand : public CommandWithNewParams<SpriteSizeParams> {
|
||||||
public:
|
public:
|
||||||
@ -437,7 +434,6 @@ void SpriteSizeCommand::onExecute(Context* context)
|
|||||||
int new_height = params.height();
|
int new_height = params.height();
|
||||||
ResizeMethod resize_method = params.method();
|
ResizeMethod resize_method = params.method();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
SpriteSizeWindow window(context, params);
|
SpriteSizeWindow window(context, params);
|
||||||
window.remapWindow();
|
window.remapWindow();
|
||||||
@ -458,7 +454,6 @@ void SpriteSizeCommand::onExecute(Context* context)
|
|||||||
set_config_int("SpriteSize", "Method", resize_method);
|
set_config_int("SpriteSize", "Method", resize_method);
|
||||||
set_config_bool("SpriteSize", "LockRatio", window.lockRatio()->isSelected());
|
set_config_bool("SpriteSize", "LockRatio", window.lockRatio()->isSelected());
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
new_width = std::clamp(new_width, 1, DOC_SPRITE_MAX_WIDTH);
|
new_width = std::clamp(new_width, 1, DOC_SPRITE_MAX_WIDTH);
|
||||||
new_height = std::clamp(new_height, 1, DOC_SPRITE_MAX_HEIGHT);
|
new_height = std::clamp(new_height, 1, DOC_SPRITE_MAX_HEIGHT);
|
||||||
@ -469,9 +464,7 @@ void SpriteSizeCommand::onExecute(Context* context)
|
|||||||
job.waitJob();
|
job.waitJob();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
update_screen_for_document(doc);
|
update_screen_for_document(doc);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createSpriteSizeCommand()
|
Command* CommandFactory::createSpriteSizeCommand()
|
||||||
|
@ -19,15 +19,12 @@
|
|||||||
#include "app/pref/preferences.h"
|
#include "app/pref/preferences.h"
|
||||||
#include "app/ui/editor/editor.h"
|
#include "app/ui/editor/editor.h"
|
||||||
#include "app/ui/status_bar.h"
|
#include "app/ui/status_bar.h"
|
||||||
|
#include "app/ui/timeline/timeline.h"
|
||||||
#include "base/thread.h"
|
#include "base/thread.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
#include "ui/manager.h"
|
#include "ui/manager.h"
|
||||||
#include "ui/system.h"
|
#include "ui/system.h"
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
#include "app/ui/timeline/timeline.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
class UndoCommand : public Command {
|
class UndoCommand : public Command {
|
||||||
@ -67,7 +64,6 @@ void UndoCommand::onExecute(Context* context)
|
|||||||
Doc* document(writer.document());
|
Doc* document(writer.document());
|
||||||
DocUndo* undo = document->undoHistory();
|
DocUndo* undo = document->undoHistory();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
auto editor = Editor::activeEditor();
|
auto editor = Editor::activeEditor();
|
||||||
Sprite* sprite = document->sprite();
|
Sprite* sprite = document->sprite();
|
||||||
SpritePosition spritePosition;
|
SpritePosition spritePosition;
|
||||||
@ -120,7 +116,6 @@ void UndoCommand::onExecute(Context* context)
|
|||||||
else
|
else
|
||||||
statusbar->setStatusText(0, msg);
|
statusbar->setStatusText(0, msg);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
// Effectively undo/redo.
|
// Effectively undo/redo.
|
||||||
if (m_type == Undo)
|
if (m_type == Undo)
|
||||||
@ -128,7 +123,6 @@ void UndoCommand::onExecute(Context* context)
|
|||||||
else
|
else
|
||||||
undo->redo();
|
undo->redo();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// After redo/undo, we retry to change the current SpritePosition
|
// After redo/undo, we retry to change the current SpritePosition
|
||||||
// (because new frames/layers could be added, positions that we
|
// (because new frames/layers could be added, positions that we
|
||||||
// weren't able to reach before the undo).
|
// weren't able to reach before the undo).
|
||||||
@ -157,14 +151,11 @@ void UndoCommand::onExecute(Context* context)
|
|||||||
timeline->setRange(docRange);
|
timeline->setRange(docRange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
document->generateMaskBoundaries();
|
document->generateMaskBoundaries();
|
||||||
document->setExtraCel(ExtraCelRef(nullptr));
|
document->setExtraCel(ExtraCelRef(nullptr));
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
update_screen_for_document(document);
|
update_screen_for_document(document);
|
||||||
#endif
|
|
||||||
set_current_palette(writer.palette(), false);
|
set_current_palette(writer.palette(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,86 +5,51 @@
|
|||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
|
FOR_EACH_COMMAND(About)
|
||||||
FOR_EACH_COMMAND(AddColor)
|
FOR_EACH_COMMAND(AddColor)
|
||||||
|
FOR_EACH_COMMAND(AdvancedMode)
|
||||||
FOR_EACH_COMMAND(AutocropSprite)
|
FOR_EACH_COMMAND(AutocropSprite)
|
||||||
FOR_EACH_COMMAND(BackgroundFromLayer)
|
FOR_EACH_COMMAND(BackgroundFromLayer)
|
||||||
FOR_EACH_COMMAND(BrightnessContrast)
|
FOR_EACH_COMMAND(BrightnessContrast)
|
||||||
|
FOR_EACH_COMMAND(Cancel)
|
||||||
FOR_EACH_COMMAND(CanvasSize)
|
FOR_EACH_COMMAND(CanvasSize)
|
||||||
FOR_EACH_COMMAND(CelOpacity)
|
FOR_EACH_COMMAND(CelOpacity)
|
||||||
FOR_EACH_COMMAND(ChangePixelFormat)
|
|
||||||
FOR_EACH_COMMAND(ColorCurve)
|
|
||||||
FOR_EACH_COMMAND(ColorQuantization)
|
|
||||||
FOR_EACH_COMMAND(ConvertLayer)
|
|
||||||
FOR_EACH_COMMAND(ConvolutionMatrix)
|
|
||||||
FOR_EACH_COMMAND(CopyColors)
|
|
||||||
FOR_EACH_COMMAND(CopyPath)
|
|
||||||
FOR_EACH_COMMAND(CopyTiles)
|
|
||||||
FOR_EACH_COMMAND(CropSprite)
|
|
||||||
FOR_EACH_COMMAND(DeselectMask)
|
|
||||||
FOR_EACH_COMMAND(Despeckle)
|
|
||||||
FOR_EACH_COMMAND(ExportSpriteSheet)
|
|
||||||
FOR_EACH_COMMAND(ExportTileset)
|
|
||||||
FOR_EACH_COMMAND(Fill)
|
|
||||||
FOR_EACH_COMMAND(FlattenLayers)
|
|
||||||
FOR_EACH_COMMAND(Flip)
|
|
||||||
FOR_EACH_COMMAND(HueSaturation)
|
|
||||||
FOR_EACH_COMMAND(ImportSpriteSheet)
|
|
||||||
FOR_EACH_COMMAND(InvertColor)
|
|
||||||
FOR_EACH_COMMAND(LayerFromBackground)
|
|
||||||
FOR_EACH_COMMAND(LoadPalette)
|
|
||||||
FOR_EACH_COMMAND(MaskAll)
|
|
||||||
FOR_EACH_COMMAND(MergeDownLayer)
|
|
||||||
FOR_EACH_COMMAND(MoveColors)
|
|
||||||
FOR_EACH_COMMAND(MoveTiles)
|
|
||||||
FOR_EACH_COMMAND(NewFile)
|
|
||||||
FOR_EACH_COMMAND(NewFrame)
|
|
||||||
FOR_EACH_COMMAND(NewLayer)
|
|
||||||
FOR_EACH_COMMAND(OpenFile)
|
|
||||||
FOR_EACH_COMMAND(Outline)
|
|
||||||
FOR_EACH_COMMAND(PaletteSize)
|
|
||||||
FOR_EACH_COMMAND(Redo)
|
|
||||||
FOR_EACH_COMMAND(RemoveLayer)
|
|
||||||
FOR_EACH_COMMAND(ReplaceColor)
|
|
||||||
FOR_EACH_COMMAND(SaveFile)
|
|
||||||
FOR_EACH_COMMAND(SaveFileAs)
|
|
||||||
FOR_EACH_COMMAND(SaveFileCopyAs)
|
|
||||||
FOR_EACH_COMMAND(ShowAutoGuides)
|
|
||||||
FOR_EACH_COMMAND(ShowBrushPreview)
|
|
||||||
FOR_EACH_COMMAND(ShowExtras)
|
|
||||||
FOR_EACH_COMMAND(ShowGrid)
|
|
||||||
FOR_EACH_COMMAND(ShowLayerEdges)
|
|
||||||
FOR_EACH_COMMAND(ShowPixelGrid)
|
|
||||||
FOR_EACH_COMMAND(ShowSelectionEdges)
|
|
||||||
FOR_EACH_COMMAND(ShowSlices)
|
|
||||||
FOR_EACH_COMMAND(ShowTileNumbers)
|
|
||||||
FOR_EACH_COMMAND(SpriteSize)
|
|
||||||
FOR_EACH_COMMAND(Stroke)
|
|
||||||
FOR_EACH_COMMAND(Undo)
|
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
FOR_EACH_COMMAND(About)
|
|
||||||
FOR_EACH_COMMAND(AdvancedMode)
|
|
||||||
FOR_EACH_COMMAND(Cancel)
|
|
||||||
FOR_EACH_COMMAND(CelProperties)
|
FOR_EACH_COMMAND(CelProperties)
|
||||||
FOR_EACH_COMMAND(ChangeBrush)
|
FOR_EACH_COMMAND(ChangeBrush)
|
||||||
FOR_EACH_COMMAND(ChangeColor)
|
FOR_EACH_COMMAND(ChangeColor)
|
||||||
|
FOR_EACH_COMMAND(ChangePixelFormat)
|
||||||
FOR_EACH_COMMAND(Clear)
|
FOR_EACH_COMMAND(Clear)
|
||||||
FOR_EACH_COMMAND(ClearCel)
|
FOR_EACH_COMMAND(ClearCel)
|
||||||
FOR_EACH_COMMAND(ClearRecentFiles)
|
FOR_EACH_COMMAND(ClearRecentFiles)
|
||||||
FOR_EACH_COMMAND(CloseAllFiles)
|
FOR_EACH_COMMAND(CloseAllFiles)
|
||||||
FOR_EACH_COMMAND(CloseFile)
|
FOR_EACH_COMMAND(CloseFile)
|
||||||
|
FOR_EACH_COMMAND(ColorCurve)
|
||||||
|
FOR_EACH_COMMAND(ColorQuantization)
|
||||||
FOR_EACH_COMMAND(ContiguousFill)
|
FOR_EACH_COMMAND(ContiguousFill)
|
||||||
|
FOR_EACH_COMMAND(ConvertLayer)
|
||||||
|
FOR_EACH_COMMAND(ConvolutionMatrix)
|
||||||
FOR_EACH_COMMAND(Copy)
|
FOR_EACH_COMMAND(Copy)
|
||||||
FOR_EACH_COMMAND(CopyCel)
|
FOR_EACH_COMMAND(CopyCel)
|
||||||
|
FOR_EACH_COMMAND(CopyColors)
|
||||||
FOR_EACH_COMMAND(CopyMerged)
|
FOR_EACH_COMMAND(CopyMerged)
|
||||||
|
FOR_EACH_COMMAND(CopyPath)
|
||||||
|
FOR_EACH_COMMAND(CopyTiles)
|
||||||
|
FOR_EACH_COMMAND(CropSprite)
|
||||||
FOR_EACH_COMMAND(Cut)
|
FOR_EACH_COMMAND(Cut)
|
||||||
|
FOR_EACH_COMMAND(DeselectMask)
|
||||||
|
FOR_EACH_COMMAND(Despeckle)
|
||||||
FOR_EACH_COMMAND(DiscardBrush)
|
FOR_EACH_COMMAND(DiscardBrush)
|
||||||
FOR_EACH_COMMAND(DuplicateLayer)
|
FOR_EACH_COMMAND(DuplicateLayer)
|
||||||
FOR_EACH_COMMAND(DuplicateSprite)
|
FOR_EACH_COMMAND(DuplicateSprite)
|
||||||
FOR_EACH_COMMAND(DuplicateView)
|
FOR_EACH_COMMAND(DuplicateView)
|
||||||
FOR_EACH_COMMAND(Exit)
|
FOR_EACH_COMMAND(Exit)
|
||||||
|
FOR_EACH_COMMAND(ExportSpriteSheet)
|
||||||
|
FOR_EACH_COMMAND(ExportTileset)
|
||||||
FOR_EACH_COMMAND(Eyedropper)
|
FOR_EACH_COMMAND(Eyedropper)
|
||||||
|
FOR_EACH_COMMAND(Fill)
|
||||||
FOR_EACH_COMMAND(FitScreen)
|
FOR_EACH_COMMAND(FitScreen)
|
||||||
|
FOR_EACH_COMMAND(FlattenLayers)
|
||||||
|
FOR_EACH_COMMAND(Flip)
|
||||||
FOR_EACH_COMMAND(FrameProperties)
|
FOR_EACH_COMMAND(FrameProperties)
|
||||||
FOR_EACH_COMMAND(FrameTagProperties)
|
FOR_EACH_COMMAND(FrameTagProperties)
|
||||||
FOR_EACH_COMMAND(FullscreenMode)
|
FOR_EACH_COMMAND(FullscreenMode)
|
||||||
@ -104,50 +69,71 @@ FOR_EACH_COMMAND(GotoPreviousLayer)
|
|||||||
FOR_EACH_COMMAND(GotoPreviousTab)
|
FOR_EACH_COMMAND(GotoPreviousTab)
|
||||||
FOR_EACH_COMMAND(GridSettings)
|
FOR_EACH_COMMAND(GridSettings)
|
||||||
FOR_EACH_COMMAND(Home)
|
FOR_EACH_COMMAND(Home)
|
||||||
|
FOR_EACH_COMMAND(HueSaturation)
|
||||||
|
FOR_EACH_COMMAND(ImportSpriteSheet)
|
||||||
|
FOR_EACH_COMMAND(InvertColor)
|
||||||
FOR_EACH_COMMAND(InvertMask)
|
FOR_EACH_COMMAND(InvertMask)
|
||||||
FOR_EACH_COMMAND(KeyboardShortcuts)
|
FOR_EACH_COMMAND(KeyboardShortcuts)
|
||||||
FOR_EACH_COMMAND(Launch)
|
FOR_EACH_COMMAND(Launch)
|
||||||
|
FOR_EACH_COMMAND(LayerFromBackground)
|
||||||
FOR_EACH_COMMAND(LayerLock)
|
FOR_EACH_COMMAND(LayerLock)
|
||||||
FOR_EACH_COMMAND(LayerOpacity)
|
FOR_EACH_COMMAND(LayerOpacity)
|
||||||
FOR_EACH_COMMAND(LayerProperties)
|
FOR_EACH_COMMAND(LayerProperties)
|
||||||
FOR_EACH_COMMAND(LayerVisibility)
|
FOR_EACH_COMMAND(LayerVisibility)
|
||||||
FOR_EACH_COMMAND(LinkCels)
|
FOR_EACH_COMMAND(LinkCels)
|
||||||
FOR_EACH_COMMAND(LoadMask)
|
FOR_EACH_COMMAND(LoadMask)
|
||||||
|
FOR_EACH_COMMAND(LoadPalette)
|
||||||
|
FOR_EACH_COMMAND(MaskAll)
|
||||||
FOR_EACH_COMMAND(MaskByColor)
|
FOR_EACH_COMMAND(MaskByColor)
|
||||||
FOR_EACH_COMMAND(MaskContent)
|
FOR_EACH_COMMAND(MaskContent)
|
||||||
|
FOR_EACH_COMMAND(MergeDownLayer)
|
||||||
FOR_EACH_COMMAND(ModifySelection)
|
FOR_EACH_COMMAND(ModifySelection)
|
||||||
FOR_EACH_COMMAND(MoveCel)
|
FOR_EACH_COMMAND(MoveCel)
|
||||||
|
FOR_EACH_COMMAND(MoveColors)
|
||||||
FOR_EACH_COMMAND(MoveMask)
|
FOR_EACH_COMMAND(MoveMask)
|
||||||
|
FOR_EACH_COMMAND(MoveTiles)
|
||||||
FOR_EACH_COMMAND(NewBrush)
|
FOR_EACH_COMMAND(NewBrush)
|
||||||
|
FOR_EACH_COMMAND(NewFile)
|
||||||
|
FOR_EACH_COMMAND(NewFrame)
|
||||||
FOR_EACH_COMMAND(NewFrameTag)
|
FOR_EACH_COMMAND(NewFrameTag)
|
||||||
|
FOR_EACH_COMMAND(NewLayer)
|
||||||
FOR_EACH_COMMAND(NewSpriteFromSelection)
|
FOR_EACH_COMMAND(NewSpriteFromSelection)
|
||||||
FOR_EACH_COMMAND(OpenBrowser)
|
FOR_EACH_COMMAND(OpenBrowser)
|
||||||
|
FOR_EACH_COMMAND(OpenFile)
|
||||||
FOR_EACH_COMMAND(OpenGroup)
|
FOR_EACH_COMMAND(OpenGroup)
|
||||||
FOR_EACH_COMMAND(OpenInFolder)
|
FOR_EACH_COMMAND(OpenInFolder)
|
||||||
FOR_EACH_COMMAND(OpenWithApp)
|
FOR_EACH_COMMAND(OpenWithApp)
|
||||||
FOR_EACH_COMMAND(Options)
|
FOR_EACH_COMMAND(Options)
|
||||||
|
FOR_EACH_COMMAND(Outline)
|
||||||
FOR_EACH_COMMAND(PaletteEditor)
|
FOR_EACH_COMMAND(PaletteEditor)
|
||||||
|
FOR_EACH_COMMAND(PaletteSize)
|
||||||
FOR_EACH_COMMAND(Paste)
|
FOR_EACH_COMMAND(Paste)
|
||||||
FOR_EACH_COMMAND(PasteText)
|
FOR_EACH_COMMAND(PasteText)
|
||||||
FOR_EACH_COMMAND(PixelPerfectMode)
|
FOR_EACH_COMMAND(PixelPerfectMode)
|
||||||
FOR_EACH_COMMAND(PlayAnimation)
|
FOR_EACH_COMMAND(PlayAnimation)
|
||||||
FOR_EACH_COMMAND(PlayPreviewAnimation)
|
FOR_EACH_COMMAND(PlayPreviewAnimation)
|
||||||
|
FOR_EACH_COMMAND(Redo)
|
||||||
FOR_EACH_COMMAND(Refresh)
|
FOR_EACH_COMMAND(Refresh)
|
||||||
FOR_EACH_COMMAND(Register)
|
FOR_EACH_COMMAND(Register)
|
||||||
FOR_EACH_COMMAND(RemoveFrame)
|
FOR_EACH_COMMAND(RemoveFrame)
|
||||||
FOR_EACH_COMMAND(RemoveFrameTag)
|
FOR_EACH_COMMAND(RemoveFrameTag)
|
||||||
|
FOR_EACH_COMMAND(RemoveLayer)
|
||||||
FOR_EACH_COMMAND(RemoveSlice)
|
FOR_EACH_COMMAND(RemoveSlice)
|
||||||
FOR_EACH_COMMAND(ReopenClosedFile)
|
FOR_EACH_COMMAND(ReopenClosedFile)
|
||||||
FOR_EACH_COMMAND(RepeatLastExport)
|
FOR_EACH_COMMAND(RepeatLastExport)
|
||||||
|
FOR_EACH_COMMAND(ReplaceColor)
|
||||||
FOR_EACH_COMMAND(ReselectMask)
|
FOR_EACH_COMMAND(ReselectMask)
|
||||||
FOR_EACH_COMMAND(ReverseFrames)
|
FOR_EACH_COMMAND(ReverseFrames)
|
||||||
FOR_EACH_COMMAND(Rotate)
|
FOR_EACH_COMMAND(Rotate)
|
||||||
|
FOR_EACH_COMMAND(SaveFile)
|
||||||
|
FOR_EACH_COMMAND(SaveFileAs)
|
||||||
|
FOR_EACH_COMMAND(SaveFileCopyAs)
|
||||||
FOR_EACH_COMMAND(SaveMask)
|
FOR_EACH_COMMAND(SaveMask)
|
||||||
FOR_EACH_COMMAND(SavePalette)
|
FOR_EACH_COMMAND(SavePalette)
|
||||||
FOR_EACH_COMMAND(SelectPaletteColors)
|
|
||||||
FOR_EACH_COMMAND(Screenshot)
|
FOR_EACH_COMMAND(Screenshot)
|
||||||
FOR_EACH_COMMAND(Scroll)
|
FOR_EACH_COMMAND(Scroll)
|
||||||
FOR_EACH_COMMAND(ScrollCenter)
|
FOR_EACH_COMMAND(ScrollCenter)
|
||||||
|
FOR_EACH_COMMAND(SelectPaletteColors)
|
||||||
FOR_EACH_COMMAND(SelectTile)
|
FOR_EACH_COMMAND(SelectTile)
|
||||||
FOR_EACH_COMMAND(SelectionAsGrid)
|
FOR_EACH_COMMAND(SelectionAsGrid)
|
||||||
FOR_EACH_COMMAND(SetColorSelector)
|
FOR_EACH_COMMAND(SetColorSelector)
|
||||||
@ -157,11 +143,22 @@ FOR_EACH_COMMAND(SetPalette)
|
|||||||
FOR_EACH_COMMAND(SetPaletteEntrySize)
|
FOR_EACH_COMMAND(SetPaletteEntrySize)
|
||||||
FOR_EACH_COMMAND(SetPlaybackSpeed)
|
FOR_EACH_COMMAND(SetPlaybackSpeed)
|
||||||
FOR_EACH_COMMAND(SetSameInk)
|
FOR_EACH_COMMAND(SetSameInk)
|
||||||
|
FOR_EACH_COMMAND(ShowAutoGuides)
|
||||||
|
FOR_EACH_COMMAND(ShowBrushPreview)
|
||||||
|
FOR_EACH_COMMAND(ShowExtras)
|
||||||
|
FOR_EACH_COMMAND(ShowGrid)
|
||||||
|
FOR_EACH_COMMAND(ShowLayerEdges)
|
||||||
FOR_EACH_COMMAND(ShowMenu)
|
FOR_EACH_COMMAND(ShowMenu)
|
||||||
FOR_EACH_COMMAND(ShowOnionSkin)
|
FOR_EACH_COMMAND(ShowOnionSkin)
|
||||||
|
FOR_EACH_COMMAND(ShowPixelGrid)
|
||||||
|
FOR_EACH_COMMAND(ShowSelectionEdges)
|
||||||
|
FOR_EACH_COMMAND(ShowSlices)
|
||||||
|
FOR_EACH_COMMAND(ShowTileNumbers)
|
||||||
FOR_EACH_COMMAND(SliceProperties)
|
FOR_EACH_COMMAND(SliceProperties)
|
||||||
FOR_EACH_COMMAND(SnapToGrid)
|
FOR_EACH_COMMAND(SnapToGrid)
|
||||||
FOR_EACH_COMMAND(SpriteProperties)
|
FOR_EACH_COMMAND(SpriteProperties)
|
||||||
|
FOR_EACH_COMMAND(SpriteSize)
|
||||||
|
FOR_EACH_COMMAND(Stroke)
|
||||||
FOR_EACH_COMMAND(SwapCheckerboardColors)
|
FOR_EACH_COMMAND(SwapCheckerboardColors)
|
||||||
FOR_EACH_COMMAND(SwitchColors)
|
FOR_EACH_COMMAND(SwitchColors)
|
||||||
FOR_EACH_COMMAND(SymmetryMode)
|
FOR_EACH_COMMAND(SymmetryMode)
|
||||||
@ -176,16 +173,14 @@ FOR_EACH_COMMAND(TogglePreview)
|
|||||||
FOR_EACH_COMMAND(ToggleRewindOnStop)
|
FOR_EACH_COMMAND(ToggleRewindOnStop)
|
||||||
FOR_EACH_COMMAND(ToggleTilesMode)
|
FOR_EACH_COMMAND(ToggleTilesMode)
|
||||||
FOR_EACH_COMMAND(ToggleTimelineThumbnails)
|
FOR_EACH_COMMAND(ToggleTimelineThumbnails)
|
||||||
|
FOR_EACH_COMMAND(Undo)
|
||||||
FOR_EACH_COMMAND(UndoHistory)
|
FOR_EACH_COMMAND(UndoHistory)
|
||||||
FOR_EACH_COMMAND(UnlinkCel)
|
FOR_EACH_COMMAND(UnlinkCel)
|
||||||
FOR_EACH_COMMAND(Zoom)
|
FOR_EACH_COMMAND(Zoom)
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
#ifdef ENABLE_UI
|
FOR_EACH_COMMAND(Debugger)
|
||||||
FOR_EACH_COMMAND(Debugger)
|
FOR_EACH_COMMAND(DeveloperConsole)
|
||||||
FOR_EACH_COMMAND(DeveloperConsole)
|
FOR_EACH_COMMAND(OpenScriptFolder)
|
||||||
FOR_EACH_COMMAND(OpenScriptFolder)
|
|
||||||
#endif
|
|
||||||
FOR_EACH_COMMAND(RunScript)
|
FOR_EACH_COMMAND(RunScript)
|
||||||
#endif // ENABLE_SCRIPTING
|
#endif // ENABLE_SCRIPTING
|
||||||
|
@ -146,7 +146,6 @@ void ConvertLayerCommand::onExecute(Context* ctx)
|
|||||||
Grid grid0 = site.grid();
|
Grid grid0 = site.grid();
|
||||||
grid0.origin(gfx::Point(0, 0));
|
grid0.origin(gfx::Point(0, 0));
|
||||||
|
|
||||||
#if ENABLE_UI
|
|
||||||
if (params().to() == ConvertLayerParam::Tilemap &&
|
if (params().to() == ConvertLayerParam::Tilemap &&
|
||||||
ctx->isUIAvailable() &&
|
ctx->isUIAvailable() &&
|
||||||
params().ui() &&
|
params().ui() &&
|
||||||
@ -175,7 +174,6 @@ void ConvertLayerCommand::onExecute(Context* ctx)
|
|||||||
baseIndex = tilesetInfo.baseIndex;
|
baseIndex = tilesetInfo.baseIndex;
|
||||||
matchFlags = tilesetInfo.matchFlags;
|
matchFlags = tilesetInfo.matchFlags;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
ContextWriter writer(ctx);
|
ContextWriter writer(ctx);
|
||||||
Doc* document(writer.document());
|
Doc* document(writer.document());
|
||||||
@ -261,10 +259,7 @@ void ConvertLayerCommand::onExecute(Context* ctx)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
update_screen_for_document(document);
|
||||||
if (ctx->isUIAvailable())
|
|
||||||
update_screen_for_document(document);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConvertLayerCommand::copyCels(Tx& tx,
|
void ConvertLayerCommand::copyCels(Tx& tx,
|
||||||
|
@ -40,8 +40,6 @@ struct BrightnessContrastParams : public NewParams {
|
|||||||
Param<double> contrast { this, 0.0, "contrast" };
|
Param<double> contrast { this, 0.0, "contrast" };
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
static const char* ConfigSection = "BrightnessContrast";
|
static const char* ConfigSection = "BrightnessContrast";
|
||||||
|
|
||||||
class BrightnessContrastWindow : public FilterWindow {
|
class BrightnessContrastWindow : public FilterWindow {
|
||||||
@ -81,8 +79,6 @@ private:
|
|||||||
BrightnessContrastFilter& m_filter;
|
BrightnessContrastFilter& m_filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
class BrightnessContrastCommand : public CommandWithNewParams<BrightnessContrastParams> {
|
class BrightnessContrastCommand : public CommandWithNewParams<BrightnessContrastParams> {
|
||||||
public:
|
public:
|
||||||
BrightnessContrastCommand();
|
BrightnessContrastCommand();
|
||||||
@ -105,9 +101,7 @@ bool BrightnessContrastCommand::onEnabled(Context* context)
|
|||||||
|
|
||||||
void BrightnessContrastCommand::onExecute(Context* context)
|
void BrightnessContrastCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
const bool ui = (params().ui() && context->isUIAvailable());
|
const bool ui = (params().ui() && context->isUIAvailable());
|
||||||
#endif
|
|
||||||
|
|
||||||
BrightnessContrastFilter filter;
|
BrightnessContrastFilter filter;
|
||||||
FilterManagerImpl filterMgr(context, &filter);
|
FilterManagerImpl filterMgr(context, &filter);
|
||||||
@ -121,14 +115,11 @@ void BrightnessContrastCommand::onExecute(Context* context)
|
|||||||
if (params().brightness.isSet()) filter.setBrightness(params().brightness() / 100.0);
|
if (params().brightness.isSet()) filter.setBrightness(params().brightness() / 100.0);
|
||||||
if (params().contrast.isSet()) filter.setContrast(params().contrast() / 100.0);
|
if (params().contrast.isSet()) filter.setContrast(params().contrast() / 100.0);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
BrightnessContrastWindow window(filter, filterMgr);
|
BrightnessContrastWindow window(filter, filterMgr);
|
||||||
window.doModal();
|
window.doModal();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
start_filter_worker(&filterMgr);
|
start_filter_worker(&filterMgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,6 @@ struct ColorCurveParams : public NewParams {
|
|||||||
Param<filters::ColorCurve> curve { this, filters::ColorCurve(), "curve" };
|
Param<filters::ColorCurve> curve { this, filters::ColorCurve(), "curve" };
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
class ColorCurveWindow : public FilterWindow {
|
class ColorCurveWindow : public FilterWindow {
|
||||||
public:
|
public:
|
||||||
ColorCurveWindow(ColorCurveFilter& filter, FilterManagerImpl& filterMgr)
|
ColorCurveWindow(ColorCurveFilter& filter, FilterManagerImpl& filterMgr)
|
||||||
@ -72,8 +70,6 @@ private:
|
|||||||
ColorCurveEditor m_editor;
|
ColorCurveEditor m_editor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
class ColorCurveCommand : public CommandWithNewParams<ColorCurveParams> {
|
class ColorCurveCommand : public CommandWithNewParams<ColorCurveParams> {
|
||||||
public:
|
public:
|
||||||
ColorCurveCommand();
|
ColorCurveCommand();
|
||||||
@ -99,7 +95,6 @@ void ColorCurveCommand::onExecute(Context* context)
|
|||||||
const bool ui = (params().ui() && context->isUIAvailable());
|
const bool ui = (params().ui() && context->isUIAvailable());
|
||||||
ColorCurveFilter filter;
|
ColorCurveFilter filter;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Default curve
|
// Default curve
|
||||||
if (ui) {
|
if (ui) {
|
||||||
static std::unique_ptr<ColorCurve> the_curve;
|
static std::unique_ptr<ColorCurve> the_curve;
|
||||||
@ -110,7 +105,6 @@ void ColorCurveCommand::onExecute(Context* context)
|
|||||||
}
|
}
|
||||||
filter.setCurve(*the_curve.get());
|
filter.setCurve(*the_curve.get());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
FilterManagerImpl filterMgr(context, &filter);
|
FilterManagerImpl filterMgr(context, &filter);
|
||||||
|
|
||||||
@ -129,16 +123,13 @@ void ColorCurveCommand::onExecute(Context* context)
|
|||||||
filter.setCurve(curve);
|
filter.setCurve(curve);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
ColorCurveWindow window(filter, filterMgr);
|
ColorCurveWindow window(filter, filterMgr);
|
||||||
if (window.doModal()) {
|
if (window.doModal()) {
|
||||||
// TODO save the curve?
|
// TODO save the curve?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
start_filter_worker(&filterMgr);
|
start_filter_worker(&filterMgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,6 @@ struct ConvolutionMatrixParams : public NewParams {
|
|||||||
Param<std::string> fromResource { this, std::string(), "fromResource" };
|
Param<std::string> fromResource { this, std::string(), "fromResource" };
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
static const char* ConfigSection = "ConvolutionMatrix";
|
static const char* ConfigSection = "ConvolutionMatrix";
|
||||||
|
|
||||||
class ConvolutionMatrixWindow : public FilterWindow {
|
class ConvolutionMatrixWindow : public FilterWindow {
|
||||||
@ -153,8 +151,6 @@ private:
|
|||||||
Button* m_reloadButton;
|
Button* m_reloadButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
class ConvolutionMatrixCommand : public CommandWithNewParams<ConvolutionMatrixParams> {
|
class ConvolutionMatrixCommand : public CommandWithNewParams<ConvolutionMatrixParams> {
|
||||||
public:
|
public:
|
||||||
ConvolutionMatrixCommand();
|
ConvolutionMatrixCommand();
|
||||||
@ -177,15 +173,12 @@ bool ConvolutionMatrixCommand::onEnabled(Context* context)
|
|||||||
|
|
||||||
void ConvolutionMatrixCommand::onExecute(Context* context)
|
void ConvolutionMatrixCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
const bool ui = (params().ui() && context->isUIAvailable());
|
const bool ui = (params().ui() && context->isUIAvailable());
|
||||||
#endif
|
|
||||||
|
|
||||||
static ConvolutionMatrixStock stock; // Load stock
|
static ConvolutionMatrixStock stock; // Load stock
|
||||||
ConvolutionMatrixFilter filter; // Create the filter and setup initial settings
|
ConvolutionMatrixFilter filter; // Create the filter and setup initial settings
|
||||||
|
|
||||||
std::shared_ptr<ConvolutionMatrix> matrix;
|
std::shared_ptr<ConvolutionMatrix> matrix;
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
// Get last used (selected) matrix
|
// Get last used (selected) matrix
|
||||||
matrix = stock.getByName(get_config_string(ConfigSection, "Selected", ""));
|
matrix = stock.getByName(get_config_string(ConfigSection, "Selected", ""));
|
||||||
@ -194,7 +187,6 @@ void ConvolutionMatrixCommand::onExecute(Context* context)
|
|||||||
.document(context->activeDocument());
|
.document(context->activeDocument());
|
||||||
filter.setTiledMode(docPref.tiled.mode());
|
filter.setTiledMode(docPref.tiled.mode());
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
if (params().tiledMode.isSet()) filter.setTiledMode(params().tiledMode());
|
if (params().tiledMode.isSet()) filter.setTiledMode(params().tiledMode());
|
||||||
if (params().fromResource.isSet()) matrix = stock.getByName(params().fromResource().c_str());
|
if (params().fromResource.isSet()) matrix = stock.getByName(params().fromResource().c_str());
|
||||||
@ -202,7 +194,6 @@ void ConvolutionMatrixCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
FilterManagerImpl filterMgr(context, &filter);
|
FilterManagerImpl filterMgr(context, &filter);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
ConvolutionMatrixWindow window(filter, filterMgr, stock);
|
ConvolutionMatrixWindow window(filter, filterMgr, stock);
|
||||||
if (window.doModal()) {
|
if (window.doModal()) {
|
||||||
@ -210,9 +201,7 @@ void ConvolutionMatrixCommand::onExecute(Context* context)
|
|||||||
set_config_string(ConfigSection, "Selected", filter.getMatrix()->getName());
|
set_config_string(ConfigSection, "Selected", filter.getMatrix()->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
start_filter_worker(&filterMgr);
|
start_filter_worker(&filterMgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,6 @@ struct DespeckleParams : public NewParams {
|
|||||||
Param<filters::TiledMode> tiledMode { this, filters::TiledMode::NONE, "tiledMode" };
|
Param<filters::TiledMode> tiledMode { this, filters::TiledMode::NONE, "tiledMode" };
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
static const char* ConfigSection = "Despeckle";
|
static const char* ConfigSection = "Despeckle";
|
||||||
|
|
||||||
class DespeckleWindow : public FilterWindow {
|
class DespeckleWindow : public FilterWindow {
|
||||||
@ -100,8 +98,6 @@ private:
|
|||||||
ExprEntry* m_heightEntry;
|
ExprEntry* m_heightEntry;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
class DespeckleCommand : public CommandWithNewParams<DespeckleParams> {
|
class DespeckleCommand : public CommandWithNewParams<DespeckleParams> {
|
||||||
public:
|
public:
|
||||||
DespeckleCommand();
|
DespeckleCommand();
|
||||||
@ -124,9 +120,7 @@ bool DespeckleCommand::onEnabled(Context* context)
|
|||||||
|
|
||||||
void DespeckleCommand::onExecute(Context* context)
|
void DespeckleCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
const bool ui = (params().ui() && context->isUIAvailable());
|
const bool ui = (params().ui() && context->isUIAvailable());
|
||||||
#endif
|
|
||||||
|
|
||||||
MedianFilter filter;
|
MedianFilter filter;
|
||||||
filter.setSize(3, 3); // Default size
|
filter.setSize(3, 3); // Default size
|
||||||
@ -137,7 +131,6 @@ void DespeckleCommand::onExecute(Context* context)
|
|||||||
TARGET_BLUE_CHANNEL |
|
TARGET_BLUE_CHANNEL |
|
||||||
TARGET_GRAY_CHANNEL);
|
TARGET_GRAY_CHANNEL);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
DocumentPreferences& docPref = Preferences::instance()
|
DocumentPreferences& docPref = Preferences::instance()
|
||||||
.document(context->activeDocument());
|
.document(context->activeDocument());
|
||||||
@ -145,14 +138,12 @@ void DespeckleCommand::onExecute(Context* context)
|
|||||||
filter.setSize(get_config_int(ConfigSection, "Width", 3),
|
filter.setSize(get_config_int(ConfigSection, "Width", 3),
|
||||||
get_config_int(ConfigSection, "Height", 3));
|
get_config_int(ConfigSection, "Height", 3));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (params().width.isSet()) filter.setSize(params().width(), filter.getHeight());
|
if (params().width.isSet()) filter.setSize(params().width(), filter.getHeight());
|
||||||
if (params().height.isSet()) filter.setSize(filter.getWidth(), params().height());
|
if (params().height.isSet()) filter.setSize(filter.getWidth(), params().height());
|
||||||
if (params().channels.isSet()) filterMgr.setTarget(params().channels());
|
if (params().channels.isSet()) filterMgr.setTarget(params().channels());
|
||||||
if (params().tiledMode.isSet()) filter.setTiledMode(params().tiledMode());
|
if (params().tiledMode.isSet()) filter.setTiledMode(params().tiledMode());
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
DespeckleWindow window(filter, filterMgr);
|
DespeckleWindow window(filter, filterMgr);
|
||||||
if (window.doModal()) {
|
if (window.doModal()) {
|
||||||
@ -160,9 +151,7 @@ void DespeckleCommand::onExecute(Context* context)
|
|||||||
set_config_int(ConfigSection, "Height", filter.getHeight());
|
set_config_int(ConfigSection, "Height", filter.getHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
start_filter_worker(&filterMgr);
|
start_filter_worker(&filterMgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,6 @@ struct HueSaturationParams : public NewParams {
|
|||||||
Param<double> alpha { this, 0.0, "alpha" };
|
Param<double> alpha { this, 0.0, "alpha" };
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
static const char* ConfigSection = "HueSaturation";
|
static const char* ConfigSection = "HueSaturation";
|
||||||
|
|
||||||
class HueSaturationWindow : public FilterWindow {
|
class HueSaturationWindow : public FilterWindow {
|
||||||
@ -139,8 +137,6 @@ private:
|
|||||||
ColorSliders m_sliders;
|
ColorSliders m_sliders;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
class HueSaturationCommand : public CommandWithNewParams<HueSaturationParams> {
|
class HueSaturationCommand : public CommandWithNewParams<HueSaturationParams> {
|
||||||
public:
|
public:
|
||||||
HueSaturationCommand();
|
HueSaturationCommand();
|
||||||
@ -163,9 +159,7 @@ bool HueSaturationCommand::onEnabled(Context* ctx)
|
|||||||
|
|
||||||
void HueSaturationCommand::onExecute(Context* ctx)
|
void HueSaturationCommand::onExecute(Context* ctx)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
const bool ui = (params().ui() && ctx->isUIAvailable());
|
const bool ui = (params().ui() && ctx->isUIAvailable());
|
||||||
#endif
|
|
||||||
|
|
||||||
HueSaturationFilter filter;
|
HueSaturationFilter filter;
|
||||||
FilterManagerImpl filterMgr(ctx, &filter);
|
FilterManagerImpl filterMgr(ctx, &filter);
|
||||||
@ -184,14 +178,11 @@ void HueSaturationCommand::onExecute(Context* ctx)
|
|||||||
if (params().channels.isSet()) channels = params().channels();
|
if (params().channels.isSet()) channels = params().channels();
|
||||||
filterMgr.setTarget(channels);
|
filterMgr.setTarget(channels);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
HueSaturationWindow window(filter, filterMgr);
|
HueSaturationWindow window(filter, filterMgr);
|
||||||
window.doModal();
|
window.doModal();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
start_filter_worker(&filterMgr);
|
start_filter_worker(&filterMgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,6 @@ struct InvertColorParams : public NewParams {
|
|||||||
Param<filters::Target> channels { this, 0, "channels" };
|
Param<filters::Target> channels { this, 0, "channels" };
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
static const char* ConfigSection = "InvertColor";
|
static const char* ConfigSection = "InvertColor";
|
||||||
|
|
||||||
class InvertColorWindow : public FilterWindow {
|
class InvertColorWindow : public FilterWindow {
|
||||||
@ -49,8 +47,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
class InvertColorCommand : public CommandWithNewParams<InvertColorParams> {
|
class InvertColorCommand : public CommandWithNewParams<InvertColorParams> {
|
||||||
public:
|
public:
|
||||||
InvertColorCommand();
|
InvertColorCommand();
|
||||||
@ -73,9 +69,7 @@ bool InvertColorCommand::onEnabled(Context* context)
|
|||||||
|
|
||||||
void InvertColorCommand::onExecute(Context* context)
|
void InvertColorCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
const bool ui = (params().ui() && context->isUIAvailable());
|
const bool ui = (params().ui() && context->isUIAvailable());
|
||||||
#endif
|
|
||||||
|
|
||||||
InvertColorFilter filter;
|
InvertColorFilter filter;
|
||||||
FilterManagerImpl filterMgr(context, &filter);
|
FilterManagerImpl filterMgr(context, &filter);
|
||||||
@ -86,14 +80,11 @@ void InvertColorCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
if (params().channels.isSet()) filterMgr.setTarget(params().channels());
|
if (params().channels.isSet()) filterMgr.setTarget(params().channels());
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
InvertColorWindow window(filterMgr);
|
InvertColorWindow window(filterMgr);
|
||||||
window.doModal();
|
window.doModal();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
start_filter_worker(&filterMgr);
|
start_filter_worker(&filterMgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,6 @@ private:
|
|||||||
app::Color m_bgColor;
|
app::Color m_bgColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
static const char* ConfigSection = "Outline";
|
static const char* ConfigSection = "Outline";
|
||||||
|
|
||||||
class OutlineWindow : public FilterWindow {
|
class OutlineWindow : public FilterWindow {
|
||||||
@ -187,8 +185,6 @@ private:
|
|||||||
gen::Outline m_panel;
|
gen::Outline m_panel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
class OutlineCommand : public CommandWithNewParams<OutlineParams> {
|
class OutlineCommand : public CommandWithNewParams<OutlineParams> {
|
||||||
public:
|
public:
|
||||||
OutlineCommand();
|
OutlineCommand();
|
||||||
@ -211,9 +207,7 @@ bool OutlineCommand::onEnabled(Context* context)
|
|||||||
|
|
||||||
void OutlineCommand::onExecute(Context* context)
|
void OutlineCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
const bool ui = (params().ui() && context->isUIAvailable());
|
const bool ui = (params().ui() && context->isUIAvailable());
|
||||||
#endif
|
|
||||||
|
|
||||||
Site site = context->activeSite();
|
Site site = context->activeSite();
|
||||||
|
|
||||||
@ -227,7 +221,6 @@ void OutlineCommand::onExecute(Context* context)
|
|||||||
filter.bgColor(app::Color::fromMask());
|
filter.bgColor(app::Color::fromMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
filter.place((OutlineFilter::Place)get_config_int(ConfigSection, "Place", int(OutlineFilter::Place::Outside)));
|
filter.place((OutlineFilter::Place)get_config_int(ConfigSection, "Place", int(OutlineFilter::Place::Outside)));
|
||||||
filter.matrix((OutlineFilter::Matrix)get_config_int(ConfigSection, "Matrix", int(OutlineFilter::Matrix::Circle)));
|
filter.matrix((OutlineFilter::Matrix)get_config_int(ConfigSection, "Matrix", int(OutlineFilter::Matrix::Circle)));
|
||||||
@ -237,7 +230,6 @@ void OutlineCommand::onExecute(Context* context)
|
|||||||
.document(site.document());
|
.document(site.document());
|
||||||
filter.tiledMode(docPref.tiled.mode());
|
filter.tiledMode(docPref.tiled.mode());
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
if (params().place.isSet()) filter.place(params().place());
|
if (params().place.isSet()) filter.place(params().place());
|
||||||
if (params().matrix.isSet()) filter.matrix(params().matrix());
|
if (params().matrix.isSet()) filter.matrix(params().matrix());
|
||||||
@ -257,7 +249,6 @@ void OutlineCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
if (params().channels.isSet()) filterMgr.setTarget(params().channels());
|
if (params().channels.isSet()) filterMgr.setTarget(params().channels());
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
OutlineWindow window(filter, filterMgr);
|
OutlineWindow window(filter, filterMgr);
|
||||||
if (window.doModal()) {
|
if (window.doModal()) {
|
||||||
@ -265,9 +256,7 @@ void OutlineCommand::onExecute(Context* context)
|
|||||||
set_config_int(ConfigSection, "Matrix", int(filter.matrix()));
|
set_config_int(ConfigSection, "Matrix", int(filter.matrix()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
start_filter_worker(&filterMgr);
|
start_filter_worker(&filterMgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,6 @@ private:
|
|||||||
app::Color m_to;
|
app::Color m_to;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
static const char* ConfigSection = "ReplaceColor";
|
static const char* ConfigSection = "ReplaceColor";
|
||||||
|
|
||||||
class ReplaceColorWindow : public FilterWindow {
|
class ReplaceColorWindow : public FilterWindow {
|
||||||
@ -146,8 +144,6 @@ private:
|
|||||||
ui::Slider* m_toleranceSlider;
|
ui::Slider* m_toleranceSlider;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
class ReplaceColorCommand : public CommandWithNewParams<ReplaceColorParams> {
|
class ReplaceColorCommand : public CommandWithNewParams<ReplaceColorParams> {
|
||||||
public:
|
public:
|
||||||
ReplaceColorCommand();
|
ReplaceColorCommand();
|
||||||
@ -170,9 +166,7 @@ bool ReplaceColorCommand::onEnabled(Context* context)
|
|||||||
|
|
||||||
void ReplaceColorCommand::onExecute(Context* context)
|
void ReplaceColorCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
const bool ui = (params().ui() && context->isUIAvailable());
|
const bool ui = (params().ui() && context->isUIAvailable());
|
||||||
#endif
|
|
||||||
Site site = context->activeSite();
|
Site site = context->activeSite();
|
||||||
|
|
||||||
ReplaceColorFilterWrapper filter(site.layer());
|
ReplaceColorFilterWrapper filter(site.layer());
|
||||||
@ -188,25 +182,20 @@ void ReplaceColorCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
filter.setFrom(Preferences::instance().colorBar.fgColor());
|
filter.setFrom(Preferences::instance().colorBar.fgColor());
|
||||||
filter.setTo(Preferences::instance().colorBar.bgColor());
|
filter.setTo(Preferences::instance().colorBar.bgColor());
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui)
|
if (ui)
|
||||||
filter.setTolerance(get_config_int(ConfigSection, "Tolerance", 0));
|
filter.setTolerance(get_config_int(ConfigSection, "Tolerance", 0));
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
if (params().from.isSet()) filter.setFrom(params().from());
|
if (params().from.isSet()) filter.setFrom(params().from());
|
||||||
if (params().to.isSet()) filter.setTo(params().to());
|
if (params().to.isSet()) filter.setTo(params().to());
|
||||||
if (params().tolerance.isSet()) filter.setTolerance(params().tolerance());
|
if (params().tolerance.isSet()) filter.setTolerance(params().tolerance());
|
||||||
if (params().channels.isSet()) filterMgr.setTarget(params().channels());
|
if (params().channels.isSet()) filterMgr.setTarget(params().channels());
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
ReplaceColorWindow window(filter, filterMgr);
|
ReplaceColorWindow window(filter, filterMgr);
|
||||||
if (window.doModal())
|
if (window.doModal())
|
||||||
set_config_int(ConfigSection, "Tolerance", filter.getTolerance());
|
set_config_int(ConfigSection, "Tolerance", filter.getTolerance());
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
start_filter_worker(&filterMgr);
|
start_filter_worker(&filterMgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,8 +126,6 @@ void FilterManagerImpl::begin()
|
|||||||
updateBounds(m_mask);
|
updateBounds(m_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
void FilterManagerImpl::beginForPreview()
|
void FilterManagerImpl::beginForPreview()
|
||||||
{
|
{
|
||||||
Doc* document = m_site.document();
|
Doc* document = m_site.document();
|
||||||
@ -166,8 +164,6 @@ void FilterManagerImpl::beginForPreview()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
void FilterManagerImpl::end()
|
void FilterManagerImpl::end()
|
||||||
{
|
{
|
||||||
m_maskBits.unlock();
|
m_maskBits.unlock();
|
||||||
@ -372,8 +368,6 @@ void FilterManagerImpl::commitTransaction()
|
|||||||
m_writer.reset();
|
m_writer.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
void FilterManagerImpl::flush()
|
void FilterManagerImpl::flush()
|
||||||
{
|
{
|
||||||
int h = m_row - m_nextRowToFlush;
|
int h = m_row - m_nextRowToFlush;
|
||||||
@ -424,8 +418,6 @@ void FilterManagerImpl::disablePreview()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
const void* FilterManagerImpl::getSourceAddress()
|
const void* FilterManagerImpl::getSourceAddress()
|
||||||
{
|
{
|
||||||
return m_src->getPixelAddress(m_bounds.x, m_bounds.y+m_row);
|
return m_src->getPixelAddress(m_bounds.x, m_bounds.y+m_row);
|
||||||
@ -537,16 +529,12 @@ void FilterManagerImpl::applyToPaletteIfNeeded()
|
|||||||
m_filter->applyToPalette(this);
|
m_filter->applyToPalette(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
void FilterManagerImpl::redrawColorPalette()
|
void FilterManagerImpl::redrawColorPalette()
|
||||||
{
|
{
|
||||||
set_current_palette(getNewPalette(), false);
|
set_current_palette(getNewPalette(), false);
|
||||||
ColorBar::instance()->invalidate();
|
ColorBar::instance()->invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
bool FilterManagerImpl::isMaskActive() const
|
bool FilterManagerImpl::isMaskActive() const
|
||||||
{
|
{
|
||||||
return m_site.document()->isMaskVisible();
|
return m_site.document()->isMaskVisible();
|
||||||
|
@ -83,9 +83,7 @@ namespace app {
|
|||||||
void setCelsTarget(CelsTarget celsTarget);
|
void setCelsTarget(CelsTarget celsTarget);
|
||||||
|
|
||||||
void begin();
|
void begin();
|
||||||
#ifdef ENABLE_UI
|
|
||||||
void beginForPreview();
|
void beginForPreview();
|
||||||
#endif
|
|
||||||
void end();
|
void end();
|
||||||
bool applyStep();
|
bool applyStep();
|
||||||
void applyToTarget();
|
void applyToTarget();
|
||||||
@ -101,11 +99,9 @@ namespace app {
|
|||||||
doc::Image* destinationImage() const { return m_dst.get(); }
|
doc::Image* destinationImage() const { return m_dst.get(); }
|
||||||
gfx::Point position() const { return gfx::Point(0, 0); }
|
gfx::Point position() const { return gfx::Point(0, 0); }
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Updates the current editor to show the progress of the preview.
|
// Updates the current editor to show the progress of the preview.
|
||||||
void flush();
|
void flush();
|
||||||
void disablePreview();
|
void disablePreview();
|
||||||
#endif
|
|
||||||
void setTaskToken(base::task_token& token);
|
void setTaskToken(base::task_token& token);
|
||||||
|
|
||||||
// FilterManager implementation
|
// FilterManager implementation
|
||||||
@ -141,9 +137,7 @@ namespace app {
|
|||||||
void restoreSpritePalette();
|
void restoreSpritePalette();
|
||||||
void applyToPaletteIfNeeded();
|
void applyToPaletteIfNeeded();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
void redrawColorPalette();
|
void redrawColorPalette();
|
||||||
#endif
|
|
||||||
|
|
||||||
ContextReader m_reader;
|
ContextReader m_reader;
|
||||||
std::unique_ptr<ContextWriter> m_writer;
|
std::unique_ptr<ContextWriter> m_writer;
|
||||||
@ -153,9 +147,7 @@ namespace app {
|
|||||||
doc::ImageRef m_src;
|
doc::ImageRef m_src;
|
||||||
doc::ImageRef m_dst;
|
doc::ImageRef m_dst;
|
||||||
int m_row;
|
int m_row;
|
||||||
#ifdef ENABLE_UI
|
|
||||||
int m_nextRowToFlush;
|
int m_nextRowToFlush;
|
||||||
#endif
|
|
||||||
gfx::Rect m_bounds;
|
gfx::Rect m_bounds;
|
||||||
doc::Mask* m_mask;
|
doc::Mask* m_mask;
|
||||||
std::unique_ptr<doc::Mask> m_previewMask;
|
std::unique_ptr<doc::Mask> m_previewMask;
|
||||||
|
@ -32,8 +32,6 @@ namespace app {
|
|||||||
using namespace base;
|
using namespace base;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const int kMonitoringPeriod = 100;
|
const int kMonitoringPeriod = 100;
|
||||||
@ -71,8 +69,6 @@ private:
|
|||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
// Applies filters in two threads: a background worker thread to
|
// Applies filters in two threads: a background worker thread to
|
||||||
// modify the sprite, and the main thread to monitoring the progress
|
// modify the sprite, and the main thread to monitoring the progress
|
||||||
// (and given to the user the possibility to cancel the process).
|
// (and given to the user the possibility to cancel the process).
|
||||||
@ -90,9 +86,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void applyFilterInBackground();
|
void applyFilterInBackground();
|
||||||
#ifdef ENABLE_UI
|
|
||||||
void onMonitoringTick();
|
void onMonitoringTick();
|
||||||
#endif
|
|
||||||
|
|
||||||
FilterManagerImpl* m_filterMgr; // Effect to be applied.
|
FilterManagerImpl* m_filterMgr; // Effect to be applied.
|
||||||
std::mutex m_mutex; // Mutex to access to 'pos', 'done' and 'cancelled' fields in different threads.
|
std::mutex m_mutex; // Mutex to access to 'pos', 'done' and 'cancelled' fields in different threads.
|
||||||
@ -101,9 +95,7 @@ private:
|
|||||||
bool m_cancelled; // Was the effect cancelled by the user?
|
bool m_cancelled; // Was the effect cancelled by the user?
|
||||||
bool m_abort; // An exception was thrown
|
bool m_abort; // An exception was thrown
|
||||||
std::string m_error;
|
std::string m_error;
|
||||||
#ifdef ENABLE_UI
|
|
||||||
std::unique_ptr<FilterWorkerAlert> m_alert;
|
std::unique_ptr<FilterWorkerAlert> m_alert;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
FilterWorker::FilterWorker(FilterManagerImpl* filterMgr)
|
FilterWorker::FilterWorker(FilterManagerImpl* filterMgr)
|
||||||
@ -116,18 +108,14 @@ FilterWorker::FilterWorker(FilterManagerImpl* filterMgr)
|
|||||||
m_cancelled = false;
|
m_cancelled = false;
|
||||||
m_abort = false;
|
m_abort = false;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (Manager::getDefault())
|
if (Manager::getDefault())
|
||||||
m_alert.reset(new FilterWorkerAlert([this]{ onMonitoringTick(); }));
|
m_alert.reset(new FilterWorkerAlert([this]{ onMonitoringTick(); }));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterWorker::~FilterWorker()
|
FilterWorker::~FilterWorker()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (m_alert)
|
if (m_alert)
|
||||||
m_alert->close();
|
m_alert->close();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterWorker::run()
|
void FilterWorker::run()
|
||||||
@ -135,7 +123,6 @@ void FilterWorker::run()
|
|||||||
// Initialize writting transaction
|
// Initialize writting transaction
|
||||||
m_filterMgr->initTransaction();
|
m_filterMgr->initTransaction();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
std::thread thread;
|
std::thread thread;
|
||||||
// Open the alert window in foreground (this is modal, locks the main thread)
|
// Open the alert window in foreground (this is modal, locks the main thread)
|
||||||
if (m_alert) {
|
if (m_alert) {
|
||||||
@ -143,9 +130,7 @@ void FilterWorker::run()
|
|||||||
thread = std::thread([this]{ applyFilterInBackground(); });
|
thread = std::thread([this]{ applyFilterInBackground(); });
|
||||||
m_alert->openAndWait();
|
m_alert->openAndWait();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
// Without UI? Apply filter from the main thread
|
// Without UI? Apply filter from the main thread
|
||||||
applyFilterInBackground();
|
applyFilterInBackground();
|
||||||
}
|
}
|
||||||
@ -158,7 +143,6 @@ void FilterWorker::run()
|
|||||||
m_cancelled = true;
|
m_cancelled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Wait the `effect_bg' thread
|
// Wait the `effect_bg' thread
|
||||||
if (thread.joinable())
|
if (thread.joinable())
|
||||||
thread.join();
|
thread.join();
|
||||||
@ -171,7 +155,6 @@ void FilterWorker::run()
|
|||||||
StatusBar::instance()->showTip(2500,
|
StatusBar::instance()->showTip(2500,
|
||||||
Strings::statusbar_tips_filter_no_unlocked_layer());
|
Strings::statusbar_tips_filter_no_unlocked_layer());
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by FilterManagerImpl to informate the progress of the filter.
|
// Called by FilterManagerImpl to informate the progress of the filter.
|
||||||
@ -218,8 +201,6 @@ void FilterWorker::applyFilterInBackground()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
// Called by the GUI monitor (a timer in the gui module that is called
|
// Called by the GUI monitor (a timer in the gui module that is called
|
||||||
// every 100 milliseconds).
|
// every 100 milliseconds).
|
||||||
void FilterWorker::onMonitoringTick()
|
void FilterWorker::onMonitoringTick()
|
||||||
@ -234,8 +215,6 @@ void FilterWorker::onMonitoringTick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Applies the filter in a background thread meanwhile a progress bar
|
// Applies the filter in a background thread meanwhile a progress bar
|
||||||
// is shown to the user.
|
// is shown to the user.
|
||||||
//
|
//
|
||||||
|
@ -59,13 +59,11 @@ protected:
|
|||||||
const int beforeIndex = params().before();
|
const int beforeIndex = params().before();
|
||||||
int currentEntry = picks.firstPick();
|
int currentEntry = picks.firstPick();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ctx->isUIAvailable()) {
|
if (ctx->isUIAvailable()) {
|
||||||
auto& fgColor = Preferences::instance().colorBar.fgColor;
|
auto& fgColor = Preferences::instance().colorBar.fgColor;
|
||||||
if (fgColor().getType() == app::Color::IndexType)
|
if (fgColor().getType() == app::Color::IndexType)
|
||||||
currentEntry = fgColor().getIndex();
|
currentEntry = fgColor().getIndex();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
doc::Palette palette(*writer.palette());
|
doc::Palette palette(*writer.palette());
|
||||||
doc::Palette newPalette(palette);
|
doc::Palette newPalette(palette);
|
||||||
@ -79,13 +77,11 @@ protected:
|
|||||||
|
|
||||||
ctx->setSelectedColors(picks);
|
ctx->setSelectedColors(picks);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (ctx->isUIAvailable()) {
|
if (ctx->isUIAvailable()) {
|
||||||
auto& fgColor = Preferences::instance().colorBar.fgColor;
|
auto& fgColor = Preferences::instance().colorBar.fgColor;
|
||||||
if (fgColor().getType() == app::Color::IndexType)
|
if (fgColor().getType() == app::Color::IndexType)
|
||||||
fgColor(Color::fromIndex(currentEntry));
|
fgColor(Color::fromIndex(currentEntry));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,7 @@ Preferences& Context::preferences() const
|
|||||||
|
|
||||||
Clipboard* Context::clipboard() const
|
Clipboard* Context::clipboard() const
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
return Clipboard::instance();
|
return Clipboard::instance();
|
||||||
#else
|
|
||||||
// TODO support clipboard when !ENABLE_UI
|
|
||||||
throw std::runtime_error("Clipboard not supported");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::sendDocumentToTop(Doc* document)
|
void Context::sendDocumentToTop(Doc* document)
|
||||||
|
@ -51,7 +51,6 @@ void ContextFlags::update(Context* context)
|
|||||||
document->unlock(res);
|
document->unlock(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// TODO this is a hack, try to find a better design to handle this
|
// TODO this is a hack, try to find a better design to handle this
|
||||||
// "moving pixels" state.
|
// "moving pixels" state.
|
||||||
auto editor = Editor::activeEditor();
|
auto editor = Editor::activeEditor();
|
||||||
@ -66,7 +65,6 @@ void ContextFlags::update(Context* context)
|
|||||||
|
|
||||||
updateFlagsFromSite(editor->getSite());
|
updateFlagsFromSite(editor->getSite());
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,10 +743,8 @@ void Extension::exitScripts()
|
|||||||
auto cmd = cmds->byId(item.id.c_str());
|
auto cmd = cmds->byId(item.id.c_str());
|
||||||
ASSERT(cmd);
|
ASSERT(cmd);
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// TODO use a signal
|
// TODO use a signal
|
||||||
AppMenus::instance()->removeMenuItemFromGroup(cmd);
|
AppMenus::instance()->removeMenuItemFromGroup(cmd);
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
cmds->remove(cmd);
|
cmds->remove(cmd);
|
||||||
|
|
||||||
@ -757,8 +755,6 @@ void Extension::exitScripts()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
case PluginItem::MenuSeparator:
|
case PluginItem::MenuSeparator:
|
||||||
ASSERT(item.widget);
|
ASSERT(item.widget);
|
||||||
ASSERT(item.widget->parent());
|
ASSERT(item.widget->parent());
|
||||||
@ -776,8 +772,6 @@ void Extension::exitScripts()
|
|||||||
AppMenus::instance()->removeMenuGroup(item.id);
|
AppMenus::instance()->removeMenuGroup(item.id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,8 +254,8 @@ FormatOptionsPtr CssFormat::onAskUserForFormatOptions(FileOp* fop)
|
|||||||
{
|
{
|
||||||
auto opts = fop->formatOptionsOfDocument<CssOptions>();
|
auto opts = fop->formatOptionsOfDocument<CssOptions>();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
if (fop->context() &&
|
||||||
if (fop->context() && fop->context()->isUIAvailable()) {
|
fop->context()->isUIAvailable()) {
|
||||||
try {
|
try {
|
||||||
auto &pref = Preferences::instance();
|
auto &pref = Preferences::instance();
|
||||||
|
|
||||||
@ -296,7 +296,6 @@ FormatOptionsPtr CssFormat::onAskUserForFormatOptions(FileOp* fop)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,7 +433,6 @@ FileOp* FileOp::createLoadDocumentOperation(Context* context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// TODO add a better dialog to edit file-names
|
// TODO add a better dialog to edit file-names
|
||||||
if ((flags & FILE_LOAD_SEQUENCE_ASK) &&
|
if ((flags & FILE_LOAD_SEQUENCE_ASK) &&
|
||||||
context &&
|
context &&
|
||||||
@ -514,7 +513,6 @@ FileOp* FileOp::createLoadDocumentOperation(Context* context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -695,7 +693,6 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
|
|||||||
|
|
||||||
// Show the confirmation alert
|
// Show the confirmation alert
|
||||||
if (!warnings.empty()) {
|
if (!warnings.empty()) {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Interative
|
// Interative
|
||||||
if (context && context->isUIAvailable()) {
|
if (context && context->isUIAvailable()) {
|
||||||
int ret;
|
int ret;
|
||||||
@ -724,9 +721,7 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
// No interactive & fatal error?
|
// No interactive & fatal error?
|
||||||
else
|
else if (fatal) {
|
||||||
#endif // ENABLE_UI
|
|
||||||
if (fatal) {
|
|
||||||
// Return nullptr as the operation cannot be done because a
|
// Return nullptr as the operation cannot be done because a
|
||||||
// fatal error/conversion was found, e.g. the format doesn't
|
// fatal error/conversion was found, e.g. the format doesn't
|
||||||
// support the color mode of the sprite.
|
// support the color mode of the sprite.
|
||||||
@ -777,7 +772,6 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
|
|||||||
++outputFrame;
|
++outputFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (context && context->isUIAvailable() &&
|
if (context && context->isUIAvailable() &&
|
||||||
fop->m_seq.filename_list.size() > 1 &&
|
fop->m_seq.filename_list.size() > 1 &&
|
||||||
OptionalAlert::show(
|
OptionalAlert::show(
|
||||||
@ -789,7 +783,6 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
|
|||||||
base::get_file_name(fop->m_seq.filename_list[1]))) != 1) {
|
base::get_file_name(fop->m_seq.filename_list[1]))) != 1) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fop->m_filename = filename;
|
fop->m_filename = filename;
|
||||||
@ -1192,7 +1185,6 @@ void FileOp::postLoad()
|
|||||||
if (this->hasEmbeddedColorProfile()) {
|
if (this->hasEmbeddedColorProfile()) {
|
||||||
behavior = m_config.filesWithProfile;
|
behavior = m_config.filesWithProfile;
|
||||||
if (behavior == app::gen::ColorProfileBehavior::ASK) {
|
if (behavior == app::gen::ColorProfileBehavior::ASK) {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (m_context && m_context->isUIAvailable()) {
|
if (m_context && m_context->isUIAvailable()) {
|
||||||
app::gen::AskForColorProfile window;
|
app::gen::AskForColorProfile window;
|
||||||
window.spriteWithoutProfile()->setVisible(false);
|
window.spriteWithoutProfile()->setVisible(false);
|
||||||
@ -1207,9 +1199,7 @@ void FileOp::postLoad()
|
|||||||
else
|
else
|
||||||
behavior = app::gen::ColorProfileBehavior::DISABLE;
|
behavior = app::gen::ColorProfileBehavior::DISABLE;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
behavior = app::gen::ColorProfileBehavior::EMBEDDED;
|
behavior = app::gen::ColorProfileBehavior::EMBEDDED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1218,7 +1208,6 @@ void FileOp::postLoad()
|
|||||||
else {
|
else {
|
||||||
behavior = m_config.missingProfile;
|
behavior = m_config.missingProfile;
|
||||||
if (behavior == app::gen::ColorProfileBehavior::ASK) {
|
if (behavior == app::gen::ColorProfileBehavior::ASK) {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (m_context && m_context->isUIAvailable()) {
|
if (m_context && m_context->isUIAvailable()) {
|
||||||
app::gen::AskForColorProfile window;
|
app::gen::AskForColorProfile window;
|
||||||
window.spriteWithProfile()->setVisible(false);
|
window.spriteWithProfile()->setVisible(false);
|
||||||
@ -1232,9 +1221,7 @@ void FileOp::postLoad()
|
|||||||
behavior = app::gen::ColorProfileBehavior::DISABLE;
|
behavior = app::gen::ColorProfileBehavior::DISABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
behavior = app::gen::ColorProfileBehavior::ASSIGN;
|
behavior = app::gen::ColorProfileBehavior::ASSIGN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1283,14 +1270,11 @@ void FileOp::postLoad()
|
|||||||
// disk state.
|
// disk state.
|
||||||
m_document->impossibleToBackToSavedState();
|
m_document->impossibleToBackToSavedState();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (m_context && m_context->isUIAvailable()) {
|
if (m_context && m_context->isUIAvailable()) {
|
||||||
IncompatFileWindow window;
|
IncompatFileWindow window;
|
||||||
window.show(m_incompatibilityError);
|
window.show(m_incompatibilityError);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif // ENABLE_UI
|
|
||||||
{
|
|
||||||
setError(m_incompatibilityError.c_str());
|
setError(m_incompatibilityError.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1637,7 +1637,6 @@ bool GifFormat::onSave(FileOp* fop)
|
|||||||
FormatOptionsPtr GifFormat::onAskUserForFormatOptions(FileOp* fop)
|
FormatOptionsPtr GifFormat::onAskUserForFormatOptions(FileOp* fop)
|
||||||
{
|
{
|
||||||
auto opts = fop->formatOptionsOfDocument<GifOptions>();
|
auto opts = fop->formatOptionsOfDocument<GifOptions>();
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (fop->context() && fop->context()->isUIAvailable()) {
|
if (fop->context() && fop->context()->isUIAvailable()) {
|
||||||
try {
|
try {
|
||||||
auto& pref = Preferences::instance();
|
auto& pref = Preferences::instance();
|
||||||
@ -1688,7 +1687,6 @@ FormatOptionsPtr GifFormat::onAskUserForFormatOptions(FileOp* fop)
|
|||||||
return std::shared_ptr<GifOptions>(nullptr);
|
return std::shared_ptr<GifOptions>(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +528,6 @@ void JpegFormat::saveColorSpace(FileOp* fop, jpeg_compress_struct* cinfo,
|
|||||||
FormatOptionsPtr JpegFormat::onAskUserForFormatOptions(FileOp* fop)
|
FormatOptionsPtr JpegFormat::onAskUserForFormatOptions(FileOp* fop)
|
||||||
{
|
{
|
||||||
auto opts = fop->formatOptionsOfDocument<JpegOptions>();
|
auto opts = fop->formatOptionsOfDocument<JpegOptions>();
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (fop->context() && fop->context()->isUIAvailable()) {
|
if (fop->context() && fop->context()->isUIAvailable()) {
|
||||||
try {
|
try {
|
||||||
auto& pref = Preferences::instance();
|
auto& pref = Preferences::instance();
|
||||||
@ -557,7 +556,6 @@ FormatOptionsPtr JpegFormat::onAskUserForFormatOptions(FileOp* fop)
|
|||||||
return std::shared_ptr<JpegOptions>(0);
|
return std::shared_ptr<JpegOptions>(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,6 @@ bool SvgFormat::onSave(FileOp* fop)
|
|||||||
FormatOptionsPtr SvgFormat::onAskUserForFormatOptions(FileOp* fop)
|
FormatOptionsPtr SvgFormat::onAskUserForFormatOptions(FileOp* fop)
|
||||||
{
|
{
|
||||||
auto opts = fop->formatOptionsOfDocument<SvgOptions>();
|
auto opts = fop->formatOptionsOfDocument<SvgOptions>();
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (fop->context() && fop->context()->isUIAvailable()) {
|
if (fop->context() && fop->context()->isUIAvailable()) {
|
||||||
try {
|
try {
|
||||||
auto& pref = Preferences::instance();
|
auto& pref = Preferences::instance();
|
||||||
@ -199,7 +198,6 @@ FormatOptionsPtr SvgFormat::onAskUserForFormatOptions(FileOp* fop)
|
|||||||
return std::shared_ptr<SvgOptions>(nullptr);
|
return std::shared_ptr<SvgOptions>(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +334,6 @@ FormatOptionsPtr TgaFormat::onAskUserForFormatOptions(FileOp* fop)
|
|||||||
{
|
{
|
||||||
const bool origOpts = fop->hasFormatOptionsOfDocument();
|
const bool origOpts = fop->hasFormatOptionsOfDocument();
|
||||||
auto opts = fop->formatOptionsOfDocument<TgaOptions>();
|
auto opts = fop->formatOptionsOfDocument<TgaOptions>();
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (fop->context() && fop->context()->isUIAvailable()) {
|
if (fop->context() && fop->context()->isUIAvailable()) {
|
||||||
try {
|
try {
|
||||||
auto& pref = Preferences::instance();
|
auto& pref = Preferences::instance();
|
||||||
@ -398,7 +397,6 @@ FormatOptionsPtr TgaFormat::onAskUserForFormatOptions(FileOp* fop)
|
|||||||
return std::shared_ptr<TgaOptions>(nullptr);
|
return std::shared_ptr<TgaOptions>(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,6 @@ bool WebPFormat::onSave(FileOp* fop)
|
|||||||
FormatOptionsPtr WebPFormat::onAskUserForFormatOptions(FileOp* fop)
|
FormatOptionsPtr WebPFormat::onAskUserForFormatOptions(FileOp* fop)
|
||||||
{
|
{
|
||||||
auto opts = fop->formatOptionsOfDocument<WebPOptions>();
|
auto opts = fop->formatOptionsOfDocument<WebPOptions>();
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (fop->context() && fop->context()->isUIAvailable()) {
|
if (fop->context() && fop->context()->isUIAvailable()) {
|
||||||
try {
|
try {
|
||||||
auto& pref = Preferences::instance();
|
auto& pref = Preferences::instance();
|
||||||
@ -457,7 +456,6 @@ FormatOptionsPtr WebPFormat::onAskUserForFormatOptions(FileOp* fop)
|
|||||||
return std::shared_ptr<WebPOptions>(nullptr);
|
return std::shared_ptr<WebPOptions>(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,9 +32,7 @@ static Module module[] =
|
|||||||
// first ones.
|
// first ones.
|
||||||
|
|
||||||
DEF_MODULE(palette, 0),
|
DEF_MODULE(palette, 0),
|
||||||
#ifdef ENABLE_UI
|
|
||||||
DEF_MODULE(gui, REQUIRE_INTERFACE),
|
DEF_MODULE(gui, REQUIRE_INTERFACE),
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int modules = sizeof(module) / sizeof(Module);
|
static int modules = sizeof(module) / sizeof(Module);
|
||||||
|
@ -382,6 +382,10 @@ static void save_gui_config()
|
|||||||
|
|
||||||
void update_screen_for_document(const Doc* document)
|
void update_screen_for_document(const Doc* document)
|
||||||
{
|
{
|
||||||
|
auto* ctx = UIContext::instance();
|
||||||
|
if (!ctx || !ctx->isUIAvailable())
|
||||||
|
return;
|
||||||
|
|
||||||
// Without document.
|
// Without document.
|
||||||
if (!document) {
|
if (!document) {
|
||||||
// Well, change to the default palette.
|
// Well, change to the default palette.
|
||||||
|
@ -122,20 +122,8 @@ void load_default_palette()
|
|||||||
set_current_palette(nullptr, true);
|
set_current_palette(nullptr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO This palette isn't synced with the current sprite palette when
|
|
||||||
// ENABLE_UI=0 and we are running scripts, we should remove this
|
|
||||||
// function and use the active Site palette.
|
|
||||||
Palette* get_current_palette()
|
Palette* get_current_palette()
|
||||||
{
|
{
|
||||||
#if !ENABLE_UI
|
|
||||||
if (auto* app = App::instance()) {
|
|
||||||
if (auto* ctx = app->context()) {
|
|
||||||
Site site = ctx->activeSite();
|
|
||||||
if (site.sprite())
|
|
||||||
return site.palette();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return ase_current_palette;
|
return ase_current_palette;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,6 @@ int App_redo(lua_State* L)
|
|||||||
|
|
||||||
int App_alert(lua_State* L)
|
int App_alert(lua_State* L)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
app::Context* ctx = App::instance()->context();
|
app::Context* ctx = App::instance()->context();
|
||||||
if (!ctx || !ctx->isUIAvailable())
|
if (!ctx || !ctx->isUIAvailable())
|
||||||
return 0; // No UI to show the alert
|
return 0; // No UI to show the alert
|
||||||
@ -261,17 +260,14 @@ int App_alert(lua_State* L)
|
|||||||
lua_pushinteger(L, alert->show());
|
lua_pushinteger(L, alert->show());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int App_refresh(lua_State* L)
|
int App_refresh(lua_State* L)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
app::Context* ctx = App::instance()->context();
|
app::Context* ctx = App::instance()->context();
|
||||||
if (ctx && ctx->isUIAvailable())
|
if (ctx && ctx->isUIAvailable())
|
||||||
app_refresh_screen();
|
app_refresh_screen();
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,14 +378,12 @@ int App_useTool(lua_State* L)
|
|||||||
params.brush = get_brush_from_arg(L, -1);
|
params.brush = get_brush_from_arg(L, -1);
|
||||||
else {
|
else {
|
||||||
// Default brush is the active brush in the context bar
|
// Default brush is the active brush in the context bar
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (App::instance()->isGui() &&
|
if (App::instance()->isGui() &&
|
||||||
App::instance()->contextBar()) {
|
App::instance()->contextBar()) {
|
||||||
params.brush = App::instance()
|
params.brush = App::instance()
|
||||||
->contextBar()->activeBrush(params.tool,
|
->contextBar()->activeBrush(params.tool,
|
||||||
params.ink);
|
params.ink);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
if (!params.brush) {
|
if (!params.brush) {
|
||||||
@ -526,13 +520,11 @@ int App_get_uiScale(lua_State* L)
|
|||||||
|
|
||||||
int App_get_editor(lua_State* L)
|
int App_get_editor(lua_State* L)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
auto ctx = UIContext::instance();
|
auto ctx = UIContext::instance();
|
||||||
if (Editor* editor = ctx->activeEditor()) {
|
if (Editor* editor = ctx->activeEditor()) {
|
||||||
push_editor(L, editor);
|
push_editor(L, editor);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,13 +590,10 @@ int App_get_tag(lua_State* L)
|
|||||||
app::Context* ctx = App::instance()->context();
|
app::Context* ctx = App::instance()->context();
|
||||||
Site site = ctx->activeSite();
|
Site site = ctx->activeSite();
|
||||||
if (site.sprite()) {
|
if (site.sprite()) {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (App::instance()->timeline()) {
|
if (App::instance()->timeline()) {
|
||||||
tag = App::instance()->timeline()->getTagByFrame(site.frame(), false);
|
tag = App::instance()->timeline()->getTagByFrame(site.frame(), false);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
tag = get_animation_tag(site.sprite(), site.frame());
|
tag = get_animation_tag(site.sprite(), site.frame());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -692,14 +681,12 @@ int App_get_tool(lua_State* L)
|
|||||||
|
|
||||||
int App_get_brush(lua_State* L)
|
int App_get_brush(lua_State* L)
|
||||||
{
|
{
|
||||||
#if ENABLE_UI
|
|
||||||
App* app = App::instance();
|
App* app = App::instance();
|
||||||
if (app->isGui()) {
|
if (app->isGui()) {
|
||||||
doc::BrushRef brush = app->contextBar()->activeBrush();
|
doc::BrushRef brush = app->contextBar()->activeBrush();
|
||||||
push_brush(L, brush);
|
push_brush(L, brush);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
push_brush(L, doc::BrushRef(new doc::Brush()));
|
push_brush(L, doc::BrushRef(new doc::Brush()));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -716,14 +703,11 @@ int App_get_defaultPalette(lua_State* L)
|
|||||||
|
|
||||||
int App_get_window(lua_State* L)
|
int App_get_window(lua_State* L)
|
||||||
{
|
{
|
||||||
#if ENABLE_UI
|
|
||||||
App* app = App::instance();
|
App* app = App::instance();
|
||||||
if (app && app->mainWindow()) {
|
if (app && app->mainWindow()) {
|
||||||
push_ptr(L, (ui::Window*)app->mainWindow());
|
push_ptr(L, (ui::Window*)app->mainWindow());
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -784,13 +768,11 @@ int App_set_tool(lua_State* L)
|
|||||||
|
|
||||||
int App_set_brush(lua_State* L)
|
int App_set_brush(lua_State* L)
|
||||||
{
|
{
|
||||||
#if ENABLE_UI
|
|
||||||
if (auto brush = get_brush_from_arg(L, 2)) {
|
if (auto brush = get_brush_from_arg(L, 2)) {
|
||||||
App* app = App::instance();
|
App* app = App::instance();
|
||||||
if (app->isGui())
|
if (app->isGui())
|
||||||
app->contextBar()->setActiveBrush(brush);
|
app->contextBar()->setActiveBrush(brush);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ struct ThemeDimension {
|
|||||||
|
|
||||||
struct ThemeColor { };
|
struct ThemeColor { };
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
void push_border_as_table(lua_State* L, const gfx::Border& border)
|
void push_border_as_table(lua_State* L, const gfx::Border& border)
|
||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
@ -73,23 +72,17 @@ void push_border_as_table(lua_State* L, const gfx::Border& border)
|
|||||||
}
|
}
|
||||||
lua_setfield(L, -2, "border");
|
lua_setfield(L, -2, "border");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int ThemeDimension_index(lua_State* L)
|
int ThemeDimension_index(lua_State* L)
|
||||||
{
|
{
|
||||||
[[maybe_unused]]
|
|
||||||
auto themeDimension = get_obj<ThemeDimension>(L, 1);
|
auto themeDimension = get_obj<ThemeDimension>(L, 1);
|
||||||
|
|
||||||
const char* id = lua_tostring(L, 2);
|
const char* id = lua_tostring(L, 2);
|
||||||
if (!id)
|
if (!id)
|
||||||
return luaL_error(L, "id in app.theme.dimension.id must be a string");
|
return luaL_error(L, "id in app.theme.dimension.id must be a string");
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
const int value = themeDimension->getById(id);
|
const int value = themeDimension->getById(id);
|
||||||
lua_pushinteger(L, value);
|
lua_pushinteger(L, value);
|
||||||
#else
|
|
||||||
lua_pushinteger(L, 0);
|
|
||||||
#endif
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,31 +92,27 @@ int ThemeColor_index(lua_State* L)
|
|||||||
if (!id)
|
if (!id)
|
||||||
return luaL_error(L, "id in app.theme.color.id must be a string");
|
return luaL_error(L, "id in app.theme.color.id must be a string");
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
if (auto* theme = skin::SkinTheme::instance()) {
|
||||||
const gfx::Color uiColor = skin::SkinTheme::instance()->getColorById(id);
|
const gfx::Color uiColor = theme->getColorById(id);
|
||||||
push_obj<app::Color>(L, color_utils::color_from_ui(uiColor));
|
push_obj<app::Color>(L, color_utils::color_from_ui(uiColor));
|
||||||
#else
|
}
|
||||||
push_obj<app::Color>(L, app::Color::fromMask());
|
else {
|
||||||
#endif
|
push_obj<app::Color>(L, app::Color::fromMask());
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Theme_styleMetrics(lua_State* L)
|
int Theme_styleMetrics(lua_State* L)
|
||||||
{
|
{
|
||||||
[[maybe_unused]]
|
|
||||||
auto theme = get_obj<Theme>(L, 1);
|
auto theme = get_obj<Theme>(L, 1);
|
||||||
|
|
||||||
const char* id = lua_tostring(L, 2);
|
const char* id = lua_tostring(L, 2);
|
||||||
if (!id)
|
if (!id)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
gfx::Border border = theme->styleMetrics(id);
|
gfx::Border border = theme->styleMetrics(id);
|
||||||
push_border_as_table(L, border);
|
push_border_as_table(L, border);
|
||||||
return 1;
|
return 1;
|
||||||
#else // ENABLE_UI
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Theme_get_dimension(lua_State* L)
|
int Theme_get_dimension(lua_State* L)
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
#include "ui/size_hint_event.h"
|
#include "ui/size_hint_event.h"
|
||||||
#include "ui/system.h"
|
#include "ui/system.h"
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace script {
|
namespace script {
|
||||||
|
|
||||||
@ -218,5 +216,3 @@ void Canvas::onPaint(ui::PaintEvent& ev)
|
|||||||
|
|
||||||
} // namespace script
|
} // namespace script
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
@ -50,8 +50,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
#define TRACE_DIALOG(...) // TRACEARGS(__VA_ARGS__)
|
#define TRACE_DIALOG(...) // TRACEARGS(__VA_ARGS__)
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
@ -1909,5 +1907,3 @@ void close_all_dialogs()
|
|||||||
|
|
||||||
} // namespace script
|
} // namespace script
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
#include "app/ui/editor/select_box_state.h"
|
#include "app/ui/editor/select_box_state.h"
|
||||||
#include "ui/display.h"
|
#include "ui/display.h"
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace script {
|
namespace script {
|
||||||
|
|
||||||
@ -348,5 +346,3 @@ void push_editor(lua_State* L, Editor* editor)
|
|||||||
|
|
||||||
} // namespace script
|
} // namespace script
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
@ -182,12 +182,10 @@ void register_cel_class(lua_State* L);
|
|||||||
void register_cels_class(lua_State* L);
|
void register_cels_class(lua_State* L);
|
||||||
void register_color_class(lua_State* L);
|
void register_color_class(lua_State* L);
|
||||||
void register_color_space_class(lua_State* L);
|
void register_color_space_class(lua_State* L);
|
||||||
#ifdef ENABLE_UI
|
|
||||||
void register_dialog_class(lua_State* L);
|
void register_dialog_class(lua_State* L);
|
||||||
void register_editor_class(lua_State* L);
|
void register_editor_class(lua_State* L);
|
||||||
void register_graphics_context_class(lua_State* L);
|
void register_graphics_context_class(lua_State* L);
|
||||||
void register_window_class(lua_State* L);
|
void register_window_class(lua_State* L);
|
||||||
#endif
|
|
||||||
void register_events_class(lua_State* L);
|
void register_events_class(lua_State* L);
|
||||||
void register_frame_class(lua_State* L);
|
void register_frame_class(lua_State* L);
|
||||||
void register_frames_class(lua_State* L);
|
void register_frames_class(lua_State* L);
|
||||||
@ -484,12 +482,10 @@ Engine::Engine()
|
|||||||
register_cels_class(L);
|
register_cels_class(L);
|
||||||
register_color_class(L);
|
register_color_class(L);
|
||||||
register_color_space_class(L);
|
register_color_space_class(L);
|
||||||
#ifdef ENABLE_UI
|
|
||||||
register_dialog_class(L);
|
register_dialog_class(L);
|
||||||
register_editor_class(L);
|
register_editor_class(L);
|
||||||
register_graphics_context_class(L);
|
register_graphics_context_class(L);
|
||||||
register_window_class(L);
|
register_window_class(L);
|
||||||
#endif
|
|
||||||
register_events_class(L);
|
register_events_class(L);
|
||||||
register_frame_class(L);
|
register_frame_class(L);
|
||||||
register_frames_class(L);
|
register_frames_class(L);
|
||||||
@ -539,9 +535,7 @@ Engine::~Engine()
|
|||||||
|
|
||||||
void Engine::destroy()
|
void Engine::destroy()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
close_all_dialogs();
|
close_all_dialogs();
|
||||||
#endif
|
|
||||||
lua_close(L);
|
lua_close(L);
|
||||||
L = nullptr;
|
L = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -185,9 +185,7 @@ namespace app {
|
|||||||
void push_tilesets(lua_State* L, doc::Tilesets* tilesets);
|
void push_tilesets(lua_State* L, doc::Tilesets* tilesets);
|
||||||
void push_tool(lua_State* L, app::tools::Tool* tool);
|
void push_tool(lua_State* L, app::tools::Tool* tool);
|
||||||
void push_version(lua_State* L, const base::Version& ver);
|
void push_version(lua_State* L, const base::Version& ver);
|
||||||
#ifdef ENABLE_UI
|
|
||||||
void push_window_events(lua_State* L, ui::Window* window);
|
void push_window_events(lua_State* L, ui::Window* window);
|
||||||
#endif
|
|
||||||
|
|
||||||
gfx::Point convert_args_into_point(lua_State* L, int index);
|
gfx::Point convert_args_into_point(lua_State* L, int index);
|
||||||
gfx::Rect convert_args_into_rect(lua_State* L, int index);
|
gfx::Rect convert_args_into_rect(lua_State* L, int index);
|
||||||
@ -214,10 +212,8 @@ namespace app {
|
|||||||
int load_sprite_from_file(lua_State* L, const char* filename,
|
int load_sprite_from_file(lua_State* L, const char* filename,
|
||||||
const LoadSpriteFromFileParam param);
|
const LoadSpriteFromFileParam param);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// close all opened Dialogs before closing the UI
|
// close all opened Dialogs before closing the UI
|
||||||
void close_all_dialogs();
|
void close_all_dialogs();
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace script
|
} // namespace script
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
@ -571,8 +571,6 @@ void push_sprite_events(lua_State* L, Sprite* sprite)
|
|||||||
push_ptr<Events>(L, spriteEvents);
|
push_ptr<Events>(L, spriteEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
void push_window_events(lua_State* L, ui::Window* window)
|
void push_window_events(lua_State* L, ui::Window* window)
|
||||||
{
|
{
|
||||||
if (!g_windowEvents) {
|
if (!g_windowEvents) {
|
||||||
@ -585,7 +583,5 @@ void push_window_events(lua_State* L, ui::Window* window)
|
|||||||
push_ptr<Events>(L, g_windowEvents.get());
|
push_ptr<Events>(L, g_windowEvents.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
} // namespace script
|
} // namespace script
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace script {
|
namespace script {
|
||||||
|
|
||||||
@ -549,5 +547,3 @@ void register_graphics_context_class(lua_State* L)
|
|||||||
|
|
||||||
} // namespace script
|
} // namespace script
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
#define APP_SCRIPT_GRAPHICS_CONTEXT_H_INCLUDED
|
#define APP_SCRIPT_GRAPHICS_CONTEXT_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
#include "gfx/path.h"
|
#include "gfx/path.h"
|
||||||
#include "os/font.h"
|
#include "os/font.h"
|
||||||
@ -150,5 +148,3 @@ private:
|
|||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -110,10 +110,8 @@ void deleteCommandIfExistent(Extension* ext, const std::string& id)
|
|||||||
|
|
||||||
void deleteMenuGroupIfExistent(Extension* ext, const std::string& id)
|
void deleteMenuGroupIfExistent(Extension* ext, const std::string& id)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
if (auto* appMenus = AppMenus::instance())
|
||||||
if (auto appMenus = AppMenus::instance())
|
|
||||||
appMenus->removeMenuGroup(id);
|
appMenus->removeMenuGroup(id);
|
||||||
#endif
|
|
||||||
|
|
||||||
ext->removeMenuGroup(id);
|
ext->removeMenuGroup(id);
|
||||||
}
|
}
|
||||||
@ -172,7 +170,6 @@ int Plugin_newCommand(lua_State* L)
|
|||||||
Commands::instance()->add(cmd);
|
Commands::instance()->add(cmd);
|
||||||
plugin->ext->addCommand(id);
|
plugin->ext->addCommand(id);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Add a new menu option if the "group" is defined
|
// Add a new menu option if the "group" is defined
|
||||||
if (!group.empty() &&
|
if (!group.empty() &&
|
||||||
App::instance()->isGui()) { // On CLI menus do not make sense
|
App::instance()->isGui()) { // On CLI menus do not make sense
|
||||||
@ -181,7 +178,6 @@ int Plugin_newCommand(lua_State* L)
|
|||||||
appMenus->addMenuItemIntoGroup(group, std::move(menuItem));
|
appMenus->addMenuItemIntoGroup(group, std::move(menuItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
@ -247,7 +243,6 @@ int Plugin_newMenuGroup(lua_State* L)
|
|||||||
|
|
||||||
plugin->ext->addMenuGroup(id);
|
plugin->ext->addMenuGroup(id);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Add a new menu option if the "group" is defined
|
// Add a new menu option if the "group" is defined
|
||||||
if (!group.empty() &&
|
if (!group.empty() &&
|
||||||
App::instance()->isGui()) { // On CLI menus do not make sense
|
App::instance()->isGui()) { // On CLI menus do not make sense
|
||||||
@ -258,7 +253,6 @@ int Plugin_newMenuGroup(lua_State* L)
|
|||||||
appMenus->addMenuItemIntoGroup(group, std::move(menuItem));
|
appMenus->addMenuItemIntoGroup(group, std::move(menuItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -288,7 +282,7 @@ int Plugin_deleteMenuGroup(lua_State* L)
|
|||||||
|
|
||||||
int Plugin_newMenuSeparator(lua_State* L)
|
int Plugin_newMenuSeparator(lua_State* L)
|
||||||
{
|
{
|
||||||
auto plugin = get_obj<Plugin>(L, 1);
|
auto* plugin = get_obj<Plugin>(L, 1);
|
||||||
if (lua_istable(L, 2)) {
|
if (lua_istable(L, 2)) {
|
||||||
std::string group;
|
std::string group;
|
||||||
|
|
||||||
@ -298,7 +292,6 @@ int Plugin_newMenuSeparator(lua_State* L)
|
|||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Add a new separator if the "group" is defined
|
// Add a new separator if the "group" is defined
|
||||||
if (!group.empty() &&
|
if (!group.empty() &&
|
||||||
App::instance()->isGui()) { // On CLI menus do not make sense
|
App::instance()->isGui()) { // On CLI menus do not make sense
|
||||||
@ -308,7 +301,6 @@ int Plugin_newMenuSeparator(lua_State* L)
|
|||||||
appMenus->addMenuItemIntoGroup(group, std::move(menuItem));
|
appMenus->addMenuItemIntoGroup(group, std::move(menuItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -188,12 +188,10 @@ int Range_clear(lua_State* L)
|
|||||||
doc::PalettePicks picks;
|
doc::PalettePicks picks;
|
||||||
ctx->setSelectedColors(picks);
|
ctx->setSelectedColors(picks);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Empty selected slices in the current editor
|
// Empty selected slices in the current editor
|
||||||
// TODO add a new function to Context class for this
|
// TODO add a new function to Context class for this
|
||||||
if (auto editor = Editor::activeEditor())
|
if (auto editor = Editor::activeEditor())
|
||||||
editor->clearSlicesSelection();
|
editor->clearSlicesSelection();
|
||||||
#endif
|
|
||||||
|
|
||||||
obj->updateFromSite(ctx->activeSite());
|
obj->updateFromSite(ctx->activeSite());
|
||||||
return 0;
|
return 0;
|
||||||
@ -397,7 +395,6 @@ int Range_set_slices(lua_State* L)
|
|||||||
app::Context* ctx = App::instance()->context();
|
app::Context* ctx = App::instance()->context();
|
||||||
|
|
||||||
// TODO we should add support to CLI scripts
|
// TODO we should add support to CLI scripts
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (auto editor = Editor::activeEditor()) {
|
if (auto editor = Editor::activeEditor()) {
|
||||||
editor->clearSlicesSelection();
|
editor->clearSlicesSelection();
|
||||||
const int len = luaL_len(L, 2);
|
const int len = luaL_len(L, 2);
|
||||||
@ -407,7 +404,6 @@ int Range_set_slices(lua_State* L)
|
|||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
obj->updateFromSite(ctx->activeSite());
|
obj->updateFromSite(ctx->activeSite());
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -67,8 +67,6 @@ static struct {
|
|||||||
{ "package", "loadlib", secure_package_loadlib },
|
{ "package", "loadlib", secure_package_loadlib },
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
// Map from .lua file name -> sha1
|
// Map from .lua file name -> sha1
|
||||||
std::unordered_map<std::string, std::string> g_keys;
|
std::unordered_map<std::string, std::string> g_keys;
|
||||||
|
|
||||||
@ -100,8 +98,6 @@ std::string get_script_filename(lua_State* L)
|
|||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
int unsupported(lua_State* L)
|
int unsupported(lua_State* L)
|
||||||
{
|
{
|
||||||
// debug.getinfo(1, "n").name
|
// debug.getinfo(1, "n").name
|
||||||
@ -242,7 +238,6 @@ bool ask_access(lua_State* L,
|
|||||||
const FileAccessMode mode,
|
const FileAccessMode mode,
|
||||||
const ResourceType resourceType)
|
const ResourceType resourceType)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// Ask for permission to open the file
|
// Ask for permission to open the file
|
||||||
if (App::instance()->context()->isUIAvailable()) {
|
if (App::instance()->context()->isUIAvailable()) {
|
||||||
std::string script = get_script_filename(L);
|
std::string script = get_script_filename(L);
|
||||||
@ -334,7 +329,6 @@ bool ask_access(lua_State* L,
|
|||||||
if (!allow)
|
if (!allow)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
#define TAB_CONTENT_ID(tabid) (tabid + "_content")
|
#define TAB_CONTENT_ID(tabid) (tabid + "_content")
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
@ -191,5 +189,3 @@ void Tab::onClick()
|
|||||||
|
|
||||||
} // namespace script
|
} // namespace script
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
@ -194,12 +194,10 @@ int WebSocket_connect(lua_State* L)
|
|||||||
ws->start();
|
ws->start();
|
||||||
|
|
||||||
if (g_connections.empty()) {
|
if (g_connections.empty()) {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (App::instance()->isGui()) {
|
if (App::instance()->isGui()) {
|
||||||
g_timer = std::make_unique<ui::Timer>(33, ui::Manager::getDefault());
|
g_timer = std::make_unique<ui::Timer>(33, ui::Manager::getDefault());
|
||||||
g_timer->start();
|
g_timer->start();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
g_connections.insert(ws);
|
g_connections.insert(ws);
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
#include "app/script/luacpp.h"
|
#include "app/script/luacpp.h"
|
||||||
#include "ui/window.h"
|
#include "ui/window.h"
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace script {
|
namespace script {
|
||||||
|
|
||||||
@ -64,5 +62,3 @@ void register_window_class(lua_State* L)
|
|||||||
|
|
||||||
} // namespace script
|
} // namespace script
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
@ -62,9 +62,7 @@ void SendCrash::search()
|
|||||||
base::is_file(m_dumpFilename)) {
|
base::is_file(m_dumpFilename)) {
|
||||||
auto app = App::instance();
|
auto app = App::instance();
|
||||||
app->memoryDumpFilename(m_dumpFilename);
|
app->memoryDumpFilename(m_dumpFilename);
|
||||||
#ifdef ENABLE_UI
|
|
||||||
app->showNotification(this);
|
app->showNotification(this);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
@ -98,9 +96,7 @@ void SendCrash::search()
|
|||||||
m_dumpFilename = fn;
|
m_dumpFilename = fn;
|
||||||
if (auto app = App::instance()) {
|
if (auto app = App::instance()) {
|
||||||
app->memoryDumpFilename(fn);
|
app->memoryDumpFilename(fn);
|
||||||
#ifdef ENABLE_UI
|
|
||||||
app->showNotification(this);
|
app->showNotification(this);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -111,8 +107,6 @@ void SendCrash::search()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
std::string SendCrash::notificationText()
|
std::string SendCrash::notificationText()
|
||||||
{
|
{
|
||||||
return "Report last crash";
|
return "Report last crash";
|
||||||
@ -172,6 +166,4 @@ void SendCrash::onClickDevFilename()
|
|||||||
base::launcher::open_file(m_dumpFilename);
|
base::launcher::open_file(m_dumpFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
@ -18,11 +18,7 @@ namespace app {
|
|||||||
|
|
||||||
#if !ENABLE_SENTRY
|
#if !ENABLE_SENTRY
|
||||||
|
|
||||||
class SendCrash
|
class SendCrash : public INotificationDelegate {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
: public INotificationDelegate
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
static std::string DefaultMemoryDumpFilename();
|
static std::string DefaultMemoryDumpFilename();
|
||||||
|
|
||||||
@ -30,7 +26,6 @@ namespace app {
|
|||||||
|
|
||||||
void search();
|
void search();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
public: // INotificationDelegate impl
|
public: // INotificationDelegate impl
|
||||||
virtual std::string notificationText() override;
|
virtual std::string notificationText() override;
|
||||||
virtual void notificationClick() override;
|
virtual void notificationClick() override;
|
||||||
@ -38,7 +33,6 @@ namespace app {
|
|||||||
private:
|
private:
|
||||||
void onClickFilename();
|
void onClickFilename();
|
||||||
void onClickDevFilename();
|
void onClickDevFilename();
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Task m_task;
|
Task m_task;
|
||||||
|
@ -81,11 +81,10 @@ Ink* ActiveToolManager::activeInk() const
|
|||||||
if (ink->isPaint() && !ink->isEffect()) {
|
if (ink->isPaint() && !ink->isEffect()) {
|
||||||
const tools::InkType inkType = Preferences::instance().tool(tool).ink();
|
const tools::InkType inkType = Preferences::instance().tool(tool).ink();
|
||||||
app::Color color;
|
app::Color color;
|
||||||
#ifdef ENABLE_UI
|
if (ColorBar* colorbar = ColorBar::instance()) {
|
||||||
ColorBar* colorbar = ColorBar::instance();
|
color = (m_rightClick ? colorbar->getBgColor():
|
||||||
color = (m_rightClick ? colorbar->getBgColor():
|
colorbar->getFgColor());
|
||||||
colorbar->getFgColor());
|
}
|
||||||
#endif
|
|
||||||
ink = adjustToolInkDependingOnSelectedInkType(ink, inkType, color);
|
ink = adjustToolInkDependingOnSelectedInkType(ink, inkType, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,13 +237,15 @@ void ActiveToolManager::setSelectedTool(Tool* tool)
|
|||||||
// static
|
// static
|
||||||
bool ActiveToolManager::isToolAffectedByRightClickMode(Tool* tool)
|
bool ActiveToolManager::isToolAffectedByRightClickMode(Tool* tool)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if ENABLE_UI
|
|
||||||
bool shadingMode = ((Preferences::instance().tool(tool).ink() == InkType::SHADING) &&
|
|
||||||
(App::instance()->contextBar()->getShade().size() >= 2));
|
|
||||||
#else
|
|
||||||
bool shadingMode = (Preferences::instance().tool(tool).ink() == InkType::SHADING);
|
bool shadingMode = (Preferences::instance().tool(tool).ink() == InkType::SHADING);
|
||||||
#endif
|
if (shadingMode) {
|
||||||
|
if (auto* contextBar = App::instance()->contextBar()) {
|
||||||
|
// Shading ink is only enabled if we have a shade of two or more
|
||||||
|
// colors selected, in other case we disable it so a right-click
|
||||||
|
// can be used for its configured action.
|
||||||
|
shadingMode = (contextBar->getShade().size() >= 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
((tool->getInk(0)->isPaint() && !shadingMode) ||
|
((tool->getInk(0)->isPaint() && !shadingMode) ||
|
||||||
|
@ -95,9 +95,7 @@ void Transaction::commit()
|
|||||||
TX_TRACE("TX: Commit <%s>\n", m_cmds->label().c_str());
|
TX_TRACE("TX: Commit <%s>\n", m_cmds->label().c_str());
|
||||||
|
|
||||||
m_cmds->updateSpritePositionAfter();
|
m_cmds->updateSpritePositionAfter();
|
||||||
#ifdef ENABLE_UI
|
|
||||||
const SpritePosition sprPos = m_cmds->spritePositionAfterExecute();
|
const SpritePosition sprPos = m_cmds->spritePositionAfterExecute();
|
||||||
#endif
|
|
||||||
|
|
||||||
m_undo->add(m_cmds);
|
m_undo->add(m_cmds);
|
||||||
m_cmds = nullptr;
|
m_cmds = nullptr;
|
||||||
@ -108,7 +106,6 @@ void Transaction::commit()
|
|||||||
m_doc->generateMaskBoundaries();
|
m_doc->generateMaskBoundaries();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (int(m_changes) & int(Changes::kColorChange)) {
|
if (int(m_changes) & int(Changes::kColorChange)) {
|
||||||
ASSERT(m_doc);
|
ASSERT(m_doc);
|
||||||
ASSERT(m_doc->sprite());
|
ASSERT(m_doc->sprite());
|
||||||
@ -123,7 +120,6 @@ void Transaction::commit()
|
|||||||
if (m_ctx->isUIAvailable())
|
if (m_ctx->isUIAvailable())
|
||||||
ui::Manager::getDefault()->invalidate();
|
ui::Manager::getDefault()->invalidate();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::rollbackAndStartAgain()
|
void Transaction::rollbackAndStartAgain()
|
||||||
|
@ -68,8 +68,6 @@ namespace app {
|
|||||||
|
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
static void fill_toolloop_params_from_tool_preferences(ToolLoopParams& params)
|
static void fill_toolloop_params_from_tool_preferences(ToolLoopParams& params)
|
||||||
{
|
{
|
||||||
ToolPreferences& toolPref =
|
ToolPreferences& toolPref =
|
||||||
@ -82,8 +80,6 @@ static void fill_toolloop_params_from_tool_preferences(ToolLoopParams& params)
|
|||||||
params.freehandAlgorithm = toolPref.freehandAlgorithm();
|
params.freehandAlgorithm = toolPref.freehandAlgorithm();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Common properties between drawing/preview ToolLoop impl
|
// Common properties between drawing/preview ToolLoop impl
|
||||||
|
|
||||||
@ -162,9 +158,7 @@ public:
|
|||||||
, m_isSelectingTiles(false)
|
, m_isSelectingTiles(false)
|
||||||
, m_grid(grid)
|
, m_grid(grid)
|
||||||
, m_gridBounds(grid.origin(), grid.tileSize())
|
, m_gridBounds(grid.origin(), grid.tileSize())
|
||||||
#ifdef ENABLE_UI
|
|
||||||
, m_mainTilePos(editor ? -editor->mainTilePosition(): gfx::Point(0, 0))
|
, m_mainTilePos(editor ? -editor->mainTilePosition(): gfx::Point(0, 0))
|
||||||
#endif
|
|
||||||
, m_button(params.button)
|
, m_button(params.button)
|
||||||
, m_ink(params.ink->clone())
|
, m_ink(params.ink->clone())
|
||||||
, m_controller(params.controller)
|
, m_controller(params.controller)
|
||||||
@ -236,13 +230,12 @@ public:
|
|||||||
site.tilemapMode(TilemapMode::Pixels);
|
site.tilemapMode(TilemapMode::Pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI // TODO add dynamics support when UI is not enabled
|
|
||||||
if (m_controller->isFreehand() &&
|
if (m_controller->isFreehand() &&
|
||||||
!m_pointShape->isFloodFill() &&
|
!m_pointShape->isFloodFill() &&
|
||||||
|
// TODO add dynamics support when UI is not enabled
|
||||||
App::instance()->contextBar()) {
|
App::instance()->contextBar()) {
|
||||||
m_dynamics = App::instance()->contextBar()->getDynamics();
|
m_dynamics = App::instance()->contextBar()->getDynamics();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (m_tracePolicy == tools::TracePolicy::Accumulate) {
|
if (m_tracePolicy == tools::TracePolicy::Accumulate) {
|
||||||
tools::ToolBox* toolbox = App::instance()->toolBox();
|
tools::ToolBox* toolbox = App::instance()->toolBox();
|
||||||
@ -287,18 +280,15 @@ public:
|
|||||||
m_opacity = 255;
|
m_opacity = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI // TODO add support when UI is not enabled
|
|
||||||
if (params.inkType == tools::InkType::SHADING) {
|
if (params.inkType == tools::InkType::SHADING) {
|
||||||
|
// TODO add shading support when UI is not enabled
|
||||||
m_shade = App::instance()->contextBar()->getShade();
|
m_shade = App::instance()->contextBar()->getShade();
|
||||||
m_shadingRemap.reset(
|
m_shadingRemap.reset(
|
||||||
App::instance()->contextBar()->createShadeRemap(
|
App::instance()->contextBar()->createShadeRemap(
|
||||||
m_button == tools::ToolLoop::Left));
|
m_button == tools::ToolLoop::Left));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
updateAllVisibleRegion();
|
updateAllVisibleRegion();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~ToolLoopBase() {
|
~ToolLoopBase() {
|
||||||
@ -391,33 +381,27 @@ public:
|
|||||||
doc::Remap* getShadingRemap() override { return m_shadingRemap.get(); }
|
doc::Remap* getShadingRemap() override { return m_shadingRemap.get(); }
|
||||||
|
|
||||||
void limitDirtyAreaToViewport(gfx::Region& rgn) override {
|
void limitDirtyAreaToViewport(gfx::Region& rgn) override {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
rgn &= m_allVisibleRgn;
|
rgn &= m_allVisibleRgn;
|
||||||
#endif // ENABLE_UI
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateDirtyArea(const gfx::Region& dirtyArea) override {
|
void updateDirtyArea(const gfx::Region& dirtyArea) override {
|
||||||
if (!m_editor)
|
if (!m_editor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// This is necessary here so the "on sprite crosshair" is hidden,
|
// This is necessary here so the "on sprite crosshair" is hidden,
|
||||||
// we update screen pixels with the new sprite, and then we show
|
// we update screen pixels with the new sprite, and then we show
|
||||||
// the crosshair saving the updated pixels. It fixes problems with
|
// the crosshair saving the updated pixels. It fixes problems with
|
||||||
// filled shape tools when we release the button, or paint-bucket
|
// filled shape tools when we release the button, or paint-bucket
|
||||||
// when we press the button.
|
// when we press the button.
|
||||||
HideBrushPreview hide(m_editor->brushPreview());
|
HideBrushPreview hide(m_editor->brushPreview());
|
||||||
#endif
|
|
||||||
|
|
||||||
m_document->notifySpritePixelsModified(
|
m_document->notifySpritePixelsModified(
|
||||||
m_sprite, dirtyArea, m_frame);
|
m_sprite, dirtyArea, m_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateStatusBar(const char* text) override {
|
void updateStatusBar(const char* text) override {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (auto statusBar = StatusBar::instance())
|
if (auto statusBar = StatusBar::instance())
|
||||||
statusBar->setStatusText(0, text);
|
statusBar->setStatusText(0, text);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Point statusBarPositionOffset() override {
|
gfx::Point statusBarPositionOffset() override {
|
||||||
@ -425,27 +409,18 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
render::DitheringMatrix getDitheringMatrix() override {
|
render::DitheringMatrix getDitheringMatrix() override {
|
||||||
#ifdef ENABLE_UI // TODO add support when UI is not enabled
|
// TODO add support when UI is not enabled
|
||||||
return App::instance()->contextBar()->ditheringMatrix();
|
return App::instance()->contextBar()->ditheringMatrix();
|
||||||
#else
|
|
||||||
return render::DitheringMatrix();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render::DitheringAlgorithmBase* getDitheringAlgorithm() override {
|
render::DitheringAlgorithmBase* getDitheringAlgorithm() override {
|
||||||
#ifdef ENABLE_UI // TODO add support when UI is not enabled
|
// TODO add support when UI is not enabled
|
||||||
return App::instance()->contextBar()->ditheringAlgorithm();
|
return App::instance()->contextBar()->ditheringAlgorithm();
|
||||||
#else
|
|
||||||
return nullptr;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render::GradientType getGradientType() override {
|
render::GradientType getGradientType() override {
|
||||||
#ifdef ENABLE_UI // TODO add support when UI is not enabled
|
// TODO add support when UI is not enabled
|
||||||
return App::instance()->contextBar()->gradientType();
|
return App::instance()->contextBar()->gradientType();
|
||||||
#else
|
|
||||||
return render::GradientType::Linear;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tools::DynamicsOptions getDynamics() override {
|
tools::DynamicsOptions getDynamics() override {
|
||||||
@ -458,7 +433,6 @@ public:
|
|||||||
return m_tiledModeHelper;
|
return m_tiledModeHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
protected:
|
protected:
|
||||||
void updateAllVisibleRegion() {
|
void updateAllVisibleRegion() {
|
||||||
m_allVisibleRgn.clear();
|
m_allVisibleRgn.clear();
|
||||||
@ -473,7 +447,6 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -611,17 +584,13 @@ public:
|
|||||||
m_mask->bounds().y-m_celOrigin.y):
|
m_mask->bounds().y-m_celOrigin.y):
|
||||||
gfx::Point(0, 0));
|
gfx::Point(0, 0));
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (m_editor)
|
if (m_editor)
|
||||||
m_editor->add_observer(this);
|
m_editor->add_observer(this);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~ToolLoopImpl() {
|
~ToolLoopImpl() {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (m_editor)
|
if (m_editor)
|
||||||
m_editor->remove_observer(this);
|
m_editor->remove_observer(this);
|
||||||
#endif
|
|
||||||
|
|
||||||
// getSrcImage() is a virtual member function but ToolLoopImpl is
|
// getSrcImage() is a virtual member function but ToolLoopImpl is
|
||||||
// marked as final to avoid not calling a derived version from
|
// marked as final to avoid not calling a derived version from
|
||||||
@ -683,12 +652,8 @@ public:
|
|||||||
rollback();
|
rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (redraw)
|
if (redraw)
|
||||||
update_screen_for_document(m_document);
|
update_screen_for_document(m_document);
|
||||||
#else
|
|
||||||
(void)redraw; // To avoid warning about unused variable
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rollback() override {
|
void rollback() override {
|
||||||
@ -700,9 +665,7 @@ public:
|
|||||||
catch (const LockedDocException& ex) {
|
catch (const LockedDocException& ex) {
|
||||||
Console::showException(ex);
|
Console::showException(ex);
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_UI
|
|
||||||
update_screen_for_document(m_document);
|
update_screen_for_document(m_document);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Cel* getCel() override { return m_expandCelCanvas->getCel(); }
|
const Cel* getCel() override { return m_expandCelCanvas->getCel(); }
|
||||||
@ -742,7 +705,7 @@ public:
|
|||||||
int getSpraySpeed() override { return m_spraySpeed; }
|
int getSpraySpeed() override { return m_spraySpeed; }
|
||||||
|
|
||||||
void onSliceRect(const gfx::Rect& bounds) override {
|
void onSliceRect(const gfx::Rect& bounds) override {
|
||||||
#ifdef ENABLE_UI // TODO add support for slice tool from batch scripts without UI?
|
// TODO add support for slice tool from batch scripts without UI?
|
||||||
if (m_editor && getMouseButton() == ToolLoop::Left) {
|
if (m_editor && getMouseButton() == ToolLoop::Left) {
|
||||||
// Try to select slices, but if it returns false, it means that
|
// Try to select slices, but if it returns false, it means that
|
||||||
// there are no slices in the box to be selected, so we show a
|
// there are no slices in the box to be selected, so we show a
|
||||||
@ -766,7 +729,6 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Cancel the operation (do not create a new transaction for this
|
// Cancel the operation (do not create a new transaction for this
|
||||||
// no-op, e.g. just change the set of selected slices).
|
// no-op, e.g. just change the set of selected slices).
|
||||||
@ -775,7 +737,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// EditorObserver impl
|
// EditorObserver impl
|
||||||
void onScrollChanged(Editor* editor) override { updateAllVisibleRegion(); }
|
void onScrollChanged(Editor* editor) override { updateAllVisibleRegion(); }
|
||||||
void onZoomChanged(Editor* editor) override { updateAllVisibleRegion(); }
|
void onZoomChanged(Editor* editor) override { updateAllVisibleRegion(); }
|
||||||
@ -790,15 +751,12 @@ private:
|
|||||||
|
|
||||||
return fmt::format("{} {}", prefix, max+1);
|
return fmt::format("{} {}", prefix, max+1);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// For user UI painting
|
// For user UI painting
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
// TODO add inks for tilemaps
|
// TODO add inks for tilemaps
|
||||||
static void adjust_ink_for_tilemaps(const Site& site,
|
static void adjust_ink_for_tilemaps(const Site& site,
|
||||||
ToolLoopParams& params)
|
ToolLoopParams& params)
|
||||||
@ -943,8 +901,6 @@ tools::ToolLoop* create_tool_loop(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// For scripting
|
// For scripting
|
||||||
|
|
||||||
@ -983,8 +939,6 @@ tools::ToolLoop* create_tool_loop_for_script(
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// For UI preview
|
// For UI preview
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
class PreviewToolLoopImpl final : public ToolLoopBase {
|
class PreviewToolLoopImpl final : public ToolLoopBase {
|
||||||
Image* m_image;
|
Image* m_image;
|
||||||
|
|
||||||
@ -1112,8 +1066,6 @@ tools::ToolLoop* create_tool_loop_preview(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
@ -54,8 +54,6 @@ namespace app {
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// For UI
|
// For UI
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
|
|
||||||
tools::ToolLoop* create_tool_loop(
|
tools::ToolLoop* create_tool_loop(
|
||||||
Editor* editor,
|
Editor* editor,
|
||||||
Context* context,
|
Context* context,
|
||||||
@ -69,8 +67,6 @@ namespace app {
|
|||||||
doc::Image* image,
|
doc::Image* image,
|
||||||
const gfx::Point& celOrigin);
|
const gfx::Point& celOrigin);
|
||||||
|
|
||||||
#endif // ENABLE_UI
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// For scripting
|
// For scripting
|
||||||
|
|
||||||
|
@ -482,7 +482,6 @@ namespace app {
|
|||||||
} m_resizeTagData;
|
} m_resizeTagData;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
class LockTimelineRange {
|
class LockTimelineRange {
|
||||||
public:
|
public:
|
||||||
LockTimelineRange(Timeline* timeline)
|
LockTimelineRange(Timeline* timeline)
|
||||||
@ -497,12 +496,6 @@ namespace app {
|
|||||||
private:
|
private:
|
||||||
Timeline* m_timeline;
|
Timeline* m_timeline;
|
||||||
};
|
};
|
||||||
#else // !ENABLE_UI
|
|
||||||
class LockTimelineRange {
|
|
||||||
public:
|
|
||||||
LockTimelineRange(Timeline* timeline) { }
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
|
@ -58,15 +58,11 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void observeUIContext() {
|
void observeUIContext() {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
UIContext::instance()->documents().add_observer(this);
|
UIContext::instance()->documents().add_observer(this);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void unobserveUIContext() {
|
void unobserveUIContext() {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
UIContext::instance()->documents().remove_observer(this);
|
UIContext::instance()->documents().remove_observer(this);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool valid() const {
|
bool valid() const {
|
||||||
@ -379,9 +375,7 @@ void Clipboard::cut(ContextWriter& writer)
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
writer.document()->generateMaskBoundaries();
|
writer.document()->generateMaskBoundaries();
|
||||||
#ifdef ENABLE_UI
|
|
||||||
update_screen_for_document(writer.document());
|
update_screen_for_document(writer.document());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,11 +406,13 @@ void Clipboard::copyRange(const ContextReader& reader, const DocRange& range)
|
|||||||
clearContent();
|
clearContent();
|
||||||
m_data->range.setRange(writer.document(), range);
|
m_data->range.setRange(writer.document(), range);
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
// TODO Replace this with a signal, because here the timeline
|
// TODO Replace this with a signal, because here the timeline
|
||||||
// depends on the clipboard and the clipboard on the timeline.
|
// depends on the clipboard and the clipboard on the timeline.
|
||||||
App::instance()->timeline()->activateClipboardRange();
|
if (App* app = App::instance()) {
|
||||||
#endif
|
if (Timeline* timeline = app->timeline()) {
|
||||||
|
timeline->activateClipboardRange();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clipboard::copyImage(const Image* image,
|
void Clipboard::copyImage(const Image* image,
|
||||||
@ -478,9 +474,7 @@ void Clipboard::paste(Context* ctx,
|
|||||||
if (!dstSpr)
|
if (!dstSpr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
Editor* editor = Editor::activeEditor();
|
Editor* editor = Editor::activeEditor();
|
||||||
#endif
|
|
||||||
bool updateDstDoc = false;
|
bool updateDstDoc = false;
|
||||||
|
|
||||||
switch (format()) {
|
switch (format()) {
|
||||||
@ -516,7 +510,6 @@ void Clipboard::paste(Context* ctx,
|
|||||||
0));
|
0));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (editor && interactive) {
|
if (editor && interactive) {
|
||||||
// TODO we don't support pasting in multiple cels at the
|
// TODO we don't support pasting in multiple cels at the
|
||||||
// moment, so we clear the range here (same as in
|
// moment, so we clear the range here (same as in
|
||||||
@ -527,9 +520,7 @@ void Clipboard::paste(Context* ctx,
|
|||||||
editor->pasteImage(src_image.get(),
|
editor->pasteImage(src_image.get(),
|
||||||
m_data->mask.get());
|
m_data->mask.get());
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// Non-interactive version (just copy the image to the cel)
|
// Non-interactive version (just copy the image to the cel)
|
||||||
Layer* dstLayer = site.layer();
|
Layer* dstLayer = site.layer();
|
||||||
ASSERT(dstLayer);
|
ASSERT(dstLayer);
|
||||||
@ -565,7 +556,6 @@ void Clipboard::paste(Context* ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
case ClipboardFormat::Tilemap: {
|
case ClipboardFormat::Tilemap: {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (editor && interactive) {
|
if (editor && interactive) {
|
||||||
// TODO match both tilesets?
|
// TODO match both tilesets?
|
||||||
// TODO add post-command parameters (issue #2324)
|
// TODO add post-command parameters (issue #2324)
|
||||||
@ -574,9 +564,7 @@ void Clipboard::paste(Context* ctx,
|
|||||||
editor->pasteImage(m_data->tilemap.get(),
|
editor->pasteImage(m_data->tilemap.get(),
|
||||||
m_data->mask.get());
|
m_data->mask.get());
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// TODO non-interactive version (for scripts)
|
// TODO non-interactive version (for scripts)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -48,27 +48,21 @@ bool layer_is_locked(Editor* editor)
|
|||||||
if (!layer)
|
if (!layer)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
auto* statusBar = StatusBar::instance();
|
||||||
auto statusBar = StatusBar::instance();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!layer->isVisibleHierarchy()) {
|
if (!layer->isVisibleHierarchy()) {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (statusBar) {
|
if (statusBar) {
|
||||||
statusBar->showTip(
|
statusBar->showTip(
|
||||||
1000, Strings::statusbar_tips_layer_x_is_hidden(layer->name()));
|
1000, Strings::statusbar_tips_layer_x_is_hidden(layer->name()));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!layer->isEditableHierarchy()) {
|
if (!layer->isEditableHierarchy()) {
|
||||||
#ifdef ENABLE_UI
|
|
||||||
if (statusBar) {
|
if (statusBar) {
|
||||||
statusBar->showTip(
|
statusBar->showTip(
|
||||||
1000, Strings::statusbar_tips_layer_locked(layer->name()));
|
1000, Strings::statusbar_tips_layer_locked(layer->name()));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user