forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.h
164 lines (132 loc) · 3.69 KB
/
app.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// Aseprite
// Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifndef APP_APP_H_INCLUDED
#define APP_APP_H_INCLUDED
#pragma once
#ifdef ENABLE_UI
#include "app/app_brushes.h"
#endif
#include "base/paths.h"
#include "doc/pixel_format.h"
#include "obs/signal.h"
#include <memory>
#include <string>
#include <vector>
namespace doc {
class Layer;
}
namespace ui {
class UISystem;
}
namespace app {
#ifdef ENABLE_SCRIPTING
namespace script {
class Engine;
}
#endif
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;
}
namespace tools {
class ActiveToolManager;
class Tool;
class ToolBox;
}
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();
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;
#ifdef ENABLE_UI
AppBrushes& brushes() {
ASSERT(m_brushes.get());
return *m_brushes;
}
void showNotification(INotificationDelegate* del);
void showBackupNotification(bool state);
void updateDisplayTitleBar();
InputChain& inputChain();
#endif
#ifdef ENABLE_SCRIPTING
script::Engine* scriptEngine() { return m_engine.get(); }
#endif
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()> PaletteChange;
obs::signal<void()> ColorSpaceChange;
private:
class CoreModules;
class LoadLanguage;
class Modules;
static App* m_instance;
AppMod* m_mod;
std::unique_ptr<ui::UISystem> m_uiSystem;
CoreModules* m_coreModules;
Modules* m_modules;
LegacyModules* m_legacy;
bool m_isGui;
bool m_isShell;
std::unique_ptr<MainWindow> m_mainWindow;
base::paths m_files;
#ifdef ENABLE_UI
std::unique_ptr<AppBrushes> m_brushes;
BackupIndicator* m_backupIndicator;
#endif // ENABLE_UI
#ifdef ENABLE_SCRIPTING
std::unique_ptr<script::Engine> m_engine;
#endif
// 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;
};
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);
} // namespace app
#endif