2015-02-12 23:16:25 +08:00
|
|
|
// Aseprite
|
2024-02-21 23:47:27 +08:00
|
|
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
2018-02-21 21:39:30 +08:00
|
|
|
// Copyright (C) 2001-2018 David Capello
|
2015-02-12 23:16:25 +08:00
|
|
|
//
|
2016-08-27 04:02:58 +08:00
|
|
|
// This program is distributed under the terms of
|
|
|
|
// the End-User License Agreement for Aseprite.
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
#ifndef APP_APP_H_INCLUDED
|
|
|
|
#define APP_APP_H_INCLUDED
|
2014-03-30 06:40:17 +08:00
|
|
|
#pragma once
|
2013-08-06 08:20:19 +08:00
|
|
|
|
2015-12-16 04:12:11 +08:00
|
|
|
#include "app/app_brushes.h"
|
2018-02-21 21:39:30 +08:00
|
|
|
#include "base/paths.h"
|
2014-10-21 09:21:31 +08:00
|
|
|
#include "doc/pixel_format.h"
|
2016-09-14 02:02:00 +08:00
|
|
|
#include "obs/signal.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
|
2018-08-09 04:27:26 +08:00
|
|
|
#include <memory>
|
2014-04-21 06:53:27 +08:00
|
|
|
#include <string>
|
2013-08-06 08:20:19 +08:00
|
|
|
#include <vector>
|
|
|
|
|
2014-10-21 09:21:31 +08:00
|
|
|
namespace doc {
|
2024-12-17 01:52:19 +08:00
|
|
|
class Layer;
|
2013-08-06 08:20:19 +08:00
|
|
|
}
|
|
|
|
|
2014-12-01 08:01:54 +08:00
|
|
|
namespace ui {
|
2024-12-17 01:52:19 +08:00
|
|
|
class UISystem;
|
2014-12-01 08:01:54 +08:00
|
|
|
}
|
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
namespace app {
|
2014-08-20 11:11:19 +08:00
|
|
|
|
2018-09-01 01:30:32 +08:00
|
|
|
#ifdef ENABLE_SCRIPTING
|
2024-12-17 01:52:19 +08:00
|
|
|
namespace script {
|
|
|
|
class Engine;
|
|
|
|
}
|
2018-09-01 01:30:32 +08:00
|
|
|
#endif
|
|
|
|
|
2024-12-17 01:52:19 +08:00
|
|
|
class AppMenus;
|
|
|
|
class AppMod;
|
|
|
|
class AppOptions;
|
|
|
|
class BackupIndicator;
|
|
|
|
class Context;
|
|
|
|
class ContextBar;
|
|
|
|
class Doc;
|
|
|
|
class Extensions;
|
|
|
|
class INotificationDelegate;
|
|
|
|
class InputChain;
|
|
|
|
class LegacyModules;
|
|
|
|
class LoggerModule;
|
|
|
|
class MainWindow;
|
|
|
|
class Preferences;
|
|
|
|
class RecentFiles;
|
|
|
|
class Timeline;
|
|
|
|
class Workspace;
|
|
|
|
|
|
|
|
namespace crash {
|
|
|
|
class DataRecovery;
|
|
|
|
}
|
2016-11-08 04:47:53 +08:00
|
|
|
|
2024-12-17 01:52:19 +08:00
|
|
|
namespace tools {
|
|
|
|
class ActiveToolManager;
|
|
|
|
class Tool;
|
|
|
|
class ToolBox;
|
|
|
|
} // namespace tools
|
|
|
|
|
|
|
|
using namespace doc;
|
|
|
|
|
|
|
|
class App {
|
|
|
|
public:
|
|
|
|
App(AppMod* mod = nullptr);
|
|
|
|
~App();
|
|
|
|
|
|
|
|
static App* instance() { return m_instance; }
|
|
|
|
|
|
|
|
Context* context();
|
|
|
|
|
|
|
|
// Returns true if Aseprite is running with GUI available.
|
|
|
|
bool isGui() const { return m_isGui; }
|
|
|
|
|
|
|
|
// Returns true if the application is running in portable mode.
|
|
|
|
bool isPortable();
|
|
|
|
|
|
|
|
// Runs the Aseprite application. In GUI mode it's the top-level
|
|
|
|
// window, in console/scripting it just runs the specified
|
|
|
|
// scripts.
|
|
|
|
int initialize(const AppOptions& options);
|
|
|
|
void run();
|
|
|
|
void close();
|
|
|
|
|
|
|
|
AppMod* mod() const { return m_mod; }
|
|
|
|
tools::ToolBox* toolBox() const;
|
|
|
|
tools::Tool* activeTool() const;
|
|
|
|
tools::ActiveToolManager* activeToolManager() const;
|
|
|
|
RecentFiles* recentFiles() const;
|
|
|
|
MainWindow* mainWindow() const { return m_mainWindow.get(); }
|
|
|
|
Workspace* workspace() const;
|
|
|
|
ContextBar* contextBar() const;
|
|
|
|
Timeline* timeline() const;
|
|
|
|
Preferences& preferences() const;
|
|
|
|
Extensions& extensions() const;
|
|
|
|
crash::DataRecovery* dataRecovery() const;
|
|
|
|
|
|
|
|
AppBrushes& brushes()
|
|
|
|
{
|
|
|
|
ASSERT(m_brushes.get());
|
|
|
|
return *m_brushes;
|
2013-08-06 08:20:19 +08:00
|
|
|
}
|
|
|
|
|
2024-12-17 01:52:19 +08:00
|
|
|
void showNotification(INotificationDelegate* del);
|
|
|
|
void showBackupNotification(bool state);
|
|
|
|
void updateDisplayTitleBar();
|
2014-05-25 22:21:10 +08:00
|
|
|
|
2024-12-17 01:52:19 +08:00
|
|
|
InputChain& inputChain();
|
2015-05-10 06:55:33 +08:00
|
|
|
|
2018-09-01 01:30:32 +08:00
|
|
|
#ifdef ENABLE_SCRIPTING
|
2024-12-17 01:52:19 +08:00
|
|
|
script::Engine* scriptEngine() { return m_engine.get(); }
|
2018-09-01 01:30:32 +08:00
|
|
|
#endif
|
|
|
|
|
2024-12-17 01:52:19 +08:00
|
|
|
const std::string& memoryDumpFilename() const { return m_memoryDumpFilename; }
|
|
|
|
void memoryDumpFilename(const std::string& fn) { m_memoryDumpFilename = fn; }
|
|
|
|
|
|
|
|
// App Signals
|
|
|
|
obs::signal<void()> Exit;
|
|
|
|
obs::signal<void()> ExitGui;
|
|
|
|
obs::signal<void()> PaletteChange;
|
|
|
|
obs::signal<void()> ColorSpaceChange;
|
|
|
|
obs::signal<void()> PalettePresetsChange;
|
|
|
|
|
|
|
|
private:
|
|
|
|
class CoreModules;
|
|
|
|
class LoadLanguage;
|
|
|
|
class Modules;
|
|
|
|
|
|
|
|
static App* m_instance;
|
|
|
|
|
|
|
|
AppMod* m_mod;
|
|
|
|
std::unique_ptr<ui::UISystem> m_uiSystem;
|
|
|
|
std::unique_ptr<CoreModules> m_coreModules;
|
|
|
|
std::unique_ptr<Modules> m_modules;
|
|
|
|
std::unique_ptr<LegacyModules> m_legacy;
|
|
|
|
std::unique_ptr<AppMenus> m_appMenus;
|
|
|
|
bool m_isGui;
|
|
|
|
bool m_isShell;
|
2024-12-07 23:28:46 +08:00
|
|
|
#if !LAF_SKIA
|
2024-12-17 01:52:19 +08:00
|
|
|
bool m_showCliOnlyWarning = false;
|
2024-12-07 23:28:46 +08:00
|
|
|
#endif
|
2024-02-21 23:47:27 +08:00
|
|
|
#ifdef ENABLE_STEAM
|
2024-12-17 01:52:19 +08:00
|
|
|
bool m_inAppSteam = true;
|
2024-02-21 23:47:27 +08:00
|
|
|
#endif
|
2024-12-17 01:52:19 +08:00
|
|
|
std::unique_ptr<MainWindow> m_mainWindow;
|
|
|
|
base::paths m_files;
|
|
|
|
std::unique_ptr<AppBrushes> m_brushes;
|
|
|
|
std::unique_ptr<BackupIndicator> m_backupIndicator;
|
2018-09-01 01:30:32 +08:00
|
|
|
#ifdef ENABLE_SCRIPTING
|
2024-12-17 01:52:19 +08:00
|
|
|
std::unique_ptr<script::Engine> m_engine;
|
2018-09-01 01:30:32 +08:00
|
|
|
#endif
|
2020-03-07 01:45:13 +08:00
|
|
|
|
2024-12-17 01:52:19 +08:00
|
|
|
// Set the memory dump filename to show in the Preferences dialog
|
|
|
|
// or the "send crash" dialog. It's set by the SendCrash class.
|
|
|
|
std::string m_memoryDumpFilename;
|
|
|
|
};
|
2013-08-06 08:20:19 +08:00
|
|
|
|
2024-12-17 01:52:19 +08:00
|
|
|
void app_refresh_screen();
|
|
|
|
void app_rebuild_documents_tabs();
|
|
|
|
PixelFormat app_get_current_pixel_format();
|
|
|
|
int app_get_color_to_clear_layer(doc::Layer* layer);
|
|
|
|
void app_configure_drm();
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
} // namespace app
|
|
|
|
|
|
|
|
#endif
|