Add the AppMod to modify the main window

This commit is contained in:
David Capello 2019-01-03 09:07:56 -03:00
parent fed1b19050
commit 256a6bc2ea
3 changed files with 38 additions and 9 deletions

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018 Igara Studio S.A.
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -11,6 +11,7 @@
#include "app/app.h"
#include "app/app_mod.h"
#include "app/check_update.h"
#include "app/cli/app_options.h"
#include "app/cli/cli_processor.h"
@ -174,12 +175,13 @@ public:
};
App* App::m_instance = NULL;
App* App::m_instance = nullptr;
App::App()
: m_coreModules(NULL)
, m_modules(NULL)
, m_legacy(NULL)
App::App(AppMod* mod)
: m_mod(mod)
, m_coreModules(nullptr)
, m_modules(nullptr)
, m_legacy(nullptr)
, m_isGui(false)
, m_isShell(false)
#ifdef ENABLE_UI
@ -261,8 +263,10 @@ void App::initialize(const AppOptions& options)
ui::Manager::getDefault()->invalidate();
// Create the main window and show it.
// Create the main window.
m_mainWindow.reset(new MainWindow);
if (m_mod)
m_mod->modMainWindow(m_mainWindow.get());
// Default status of the main window.
app_rebuild_documents_tabs();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018 Igara Studio S.A.
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -37,6 +37,7 @@ namespace app {
}
#endif
class AppMod;
class AppOptions;
class BackupIndicator;
class Context;
@ -67,7 +68,7 @@ namespace app {
class App {
public:
App();
App(AppMod* mod = nullptr);
~App();
static App* instance() { return m_instance; }
@ -86,6 +87,7 @@ namespace app {
void initialize(const AppOptions& options);
void run();
AppMod* mod() const { return m_mod; }
tools::ToolBox* toolBox() const;
tools::Tool* activeTool() const;
tools::ActiveToolManager* activeToolManager() const;
@ -127,6 +129,7 @@ namespace app {
static App* m_instance;
AppMod* m_mod;
std::unique_ptr<ui::UISystem> m_uiSystem;
CoreModules* m_coreModules;
Modules* m_modules;

22
src/app/app_mod.h Normal file
View File

@ -0,0 +1,22 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifndef APP_APP_MOD_H_INCLUDED
#define APP_APP_MOD_H_INCLUDED
#pragma once
namespace app {
class MainWindow;
class AppMod {
public:
virtual ~AppMod() { }
virtual void modMainWindow(MainWindow* mainWindow) = 0;
};
} // namespace app
#endif