2015-02-12 23:16:25 +08:00
|
|
|
// Aseprite
|
|
|
|
// Copyright (C) 2001-2015 David Capello
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2 as
|
|
|
|
// published by the Free Software Foundation.
|
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
|
|
|
|
|
|
|
#include "base/signal.h"
|
|
|
|
#include "base/string.h"
|
|
|
|
#include "base/unique_ptr.h"
|
2014-10-21 09:21:31 +08:00
|
|
|
#include "doc/pixel_format.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
|
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 {
|
2013-08-06 08:20:19 +08:00
|
|
|
class Layer;
|
|
|
|
}
|
|
|
|
|
2014-12-01 08:01:54 +08:00
|
|
|
namespace ui {
|
|
|
|
class GuiSystem;
|
|
|
|
}
|
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
namespace app {
|
2014-08-20 11:11:19 +08:00
|
|
|
|
2014-12-01 08:01:54 +08:00
|
|
|
class AppOptions;
|
2013-08-06 08:20:19 +08:00
|
|
|
class Document;
|
2013-12-09 07:19:32 +08:00
|
|
|
class DocumentExporter;
|
2014-08-20 11:11:19 +08:00
|
|
|
class INotificationDelegate;
|
2013-08-06 08:20:19 +08:00
|
|
|
class LegacyModules;
|
|
|
|
class LoggerModule;
|
|
|
|
class MainWindow;
|
2014-12-15 07:19:31 +08:00
|
|
|
class Preferences;
|
2013-08-06 08:20:19 +08:00
|
|
|
class RecentFiles;
|
|
|
|
|
|
|
|
namespace tools {
|
|
|
|
class ToolBox;
|
|
|
|
}
|
|
|
|
|
2014-10-21 09:21:31 +08:00
|
|
|
using namespace doc;
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
class App {
|
|
|
|
public:
|
2014-11-06 20:42:09 +08:00
|
|
|
App();
|
2013-08-06 08:20:19 +08:00
|
|
|
~App();
|
|
|
|
|
|
|
|
static App* instance() { return m_instance; }
|
|
|
|
|
2013-08-09 08:01:20 +08:00
|
|
|
// Returns true if Aseprite is running with GUI available.
|
2013-08-06 08:20:19 +08:00
|
|
|
bool isGui() const { return m_isGui; }
|
|
|
|
|
2014-08-20 20:16:59 +08:00
|
|
|
// Returns true if the application is running in portable mode.
|
|
|
|
bool isPortable();
|
|
|
|
|
2013-08-09 08:01:20 +08:00
|
|
|
// Runs the Aseprite application. In GUI mode it's the top-level
|
2014-11-06 20:42:09 +08:00
|
|
|
// window, in console/scripting it just runs the specified
|
|
|
|
// scripts.
|
2014-12-01 08:01:54 +08:00
|
|
|
void initialize(const AppOptions& options);
|
2014-11-06 20:42:09 +08:00
|
|
|
void run();
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
tools::ToolBox* getToolBox() const;
|
|
|
|
RecentFiles* getRecentFiles() const;
|
|
|
|
MainWindow* getMainWindow() const { return m_mainWindow; }
|
2014-12-15 07:19:31 +08:00
|
|
|
Preferences& preferences() const;
|
2013-08-06 08:20:19 +08:00
|
|
|
|
2014-08-20 11:11:19 +08:00
|
|
|
void showNotification(INotificationDelegate* del);
|
2014-09-03 11:39:15 +08:00
|
|
|
void updateDisplayTitleBar();
|
2014-05-25 22:21:10 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
// App Signals
|
|
|
|
Signal0<void> Exit;
|
|
|
|
Signal0<void> PaletteChange;
|
2014-06-15 02:09:43 +08:00
|
|
|
Signal0<void> BrushSizeBeforeChange;
|
|
|
|
Signal0<void> BrushSizeAfterChange;
|
|
|
|
Signal0<void> BrushAngleBeforeChange;
|
|
|
|
Signal0<void> BrushAngleAfterChange;
|
2013-08-06 08:20:19 +08:00
|
|
|
Signal0<void> CurrentToolChange;
|
|
|
|
|
|
|
|
private:
|
2014-04-21 06:53:27 +08:00
|
|
|
typedef std::vector<std::string> FileList;
|
2014-12-15 07:19:31 +08:00
|
|
|
class CoreModules;
|
2013-08-06 08:20:19 +08:00
|
|
|
class Modules;
|
|
|
|
|
|
|
|
static App* m_instance;
|
|
|
|
|
2014-12-01 08:01:54 +08:00
|
|
|
base::UniquePtr<ui::GuiSystem> m_guiSystem;
|
2014-12-15 07:19:31 +08:00
|
|
|
CoreModules* m_coreModules;
|
2013-08-06 08:20:19 +08:00
|
|
|
Modules* m_modules;
|
|
|
|
LegacyModules* m_legacy;
|
|
|
|
bool m_isGui;
|
|
|
|
bool m_isShell;
|
|
|
|
base::UniquePtr<MainWindow> m_mainWindow;
|
|
|
|
FileList m_files;
|
2013-12-09 07:19:32 +08:00
|
|
|
base::UniquePtr<DocumentExporter> m_exporter;
|
2013-08-06 08:20:19 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void app_refresh_screen();
|
|
|
|
void app_rebuild_documents_tabs();
|
|
|
|
PixelFormat app_get_current_pixel_format();
|
|
|
|
void app_default_statusbar_message();
|
2014-10-30 12:06:27 +08:00
|
|
|
int app_get_color_to_clear_layer(doc::Layer* layer);
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
} // namespace app
|
|
|
|
|
|
|
|
#endif
|