mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 12:44:53 +00:00
Update to new laf API (os::System::instance()/make())
This commit is contained in:
parent
66313e540f
commit
571b4ec9f2
2
laf
2
laf
@ -1 +1 @@
|
|||||||
Subproject commit a2bc68cd98d881c00fd7a376161b85e36c02bc76
|
Subproject commit 3bea53125ccafce878d17fcf8d9d192ad69fafb4
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -263,7 +263,7 @@ App::App(AppMod* mod)
|
|||||||
|
|
||||||
int App::initialize(const AppOptions& options)
|
int App::initialize(const AppOptions& options)
|
||||||
{
|
{
|
||||||
os::System* system = os::instance();
|
const os::SystemRef system = os::System::instance();
|
||||||
|
|
||||||
#ifdef ENABLE_UI
|
#ifdef ENABLE_UI
|
||||||
m_isGui = options.startUI() && !options.previewCLI();
|
m_isGui = options.startUI() && !options.previewCLI();
|
||||||
@ -485,14 +485,15 @@ void App::run()
|
|||||||
#if LAF_LINUX
|
#if LAF_LINUX
|
||||||
// Setup app icon for Linux window managers
|
// Setup app icon for Linux window managers
|
||||||
try {
|
try {
|
||||||
os::Window* window = os::instance()->defaultWindow();
|
os::Window* window = os::System::instance()->defaultWindow();
|
||||||
os::SurfaceList icons;
|
os::SurfaceList icons;
|
||||||
|
|
||||||
for (const int size : { 32, 64, 128 }) {
|
for (const int size : { 32, 64, 128 }) {
|
||||||
ResourceFinder rf;
|
ResourceFinder rf;
|
||||||
rf.includeDataDir(fmt::format("icons/ase{0}.png", size).c_str());
|
rf.includeDataDir(fmt::format("icons/ase{0}.png", size).c_str());
|
||||||
if (rf.findFirst()) {
|
if (rf.findFirst()) {
|
||||||
os::SurfaceRef surf = os::instance()->loadRgbaSurface(rf.filename().c_str());
|
os::SurfaceRef surf = os::System::instance()
|
||||||
|
->loadRgbaSurface(rf.filename().c_str());
|
||||||
if (surf) {
|
if (surf) {
|
||||||
surf->setImmutable();
|
surf->setImmutable();
|
||||||
icons.push_back(surf);
|
icons.push_back(surf);
|
||||||
@ -512,14 +513,14 @@ void App::run()
|
|||||||
#ifdef ENABLE_STEAM
|
#ifdef ENABLE_STEAM
|
||||||
steam::SteamAPI steam;
|
steam::SteamAPI steam;
|
||||||
if (steam.initialized())
|
if (steam.initialized())
|
||||||
os::instance()->activateApp();
|
os::System::instance()->activateApp();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(ENABLE_DEVMODE)
|
#if defined(_DEBUG) || defined(ENABLE_DEVMODE)
|
||||||
// On OS X, when we compile Aseprite on devmode, we're using it
|
// On OS X, when we compile Aseprite on devmode, we're using it
|
||||||
// outside an app bundle, so we must active the app explicitly.
|
// outside an app bundle, so we must active the app explicitly.
|
||||||
if (isGui())
|
if (isGui())
|
||||||
os::instance()->activateApp();
|
os::System::instance()->activateApp();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_UPDATER
|
#ifdef ENABLE_UPDATER
|
||||||
@ -804,7 +805,7 @@ void App::updateDisplayTitleBar()
|
|||||||
}
|
}
|
||||||
|
|
||||||
title += defaultTitle;
|
title += defaultTitle;
|
||||||
os::instance()->defaultWindow()->setTitle(title);
|
os::System::instance()->defaultWindow()->setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
InputChain& App::inputChain()
|
InputChain& App::inputChain()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2023 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -597,7 +597,7 @@ bool AppMenus::rebuildRecentList()
|
|||||||
// Sync native menus
|
// Sync native menus
|
||||||
if (owner->native() &&
|
if (owner->native() &&
|
||||||
owner->native()->menuItem) {
|
owner->native()->menuItem) {
|
||||||
auto menus = os::instance()->menus();
|
auto menus = os::System::instance()->menus();
|
||||||
os::MenuRef osMenu = (menus ? menus->makeMenu(): nullptr);
|
os::MenuRef osMenu = (menus ? menus->makeMenu(): nullptr);
|
||||||
if (osMenu) {
|
if (osMenu) {
|
||||||
createNativeSubmenus(osMenu.get(), menu);
|
createNativeSubmenus(osMenu.get(), menu);
|
||||||
@ -923,7 +923,7 @@ void AppMenus::updateMenusList()
|
|||||||
|
|
||||||
void AppMenus::createNativeMenus()
|
void AppMenus::createNativeMenus()
|
||||||
{
|
{
|
||||||
os::Menus* menus = os::instance()->menus();
|
os::Menus* menus = os::System::instance()->menus();
|
||||||
if (!menus) // This platform doesn't support native menu items
|
if (!menus) // This platform doesn't support native menu items
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1021,7 +1021,7 @@ void AppMenus::createNativeMenus()
|
|||||||
void AppMenus::createNativeSubmenus(os::Menu* osMenu,
|
void AppMenus::createNativeSubmenus(os::Menu* osMenu,
|
||||||
const ui::Menu* uiMenu)
|
const ui::Menu* uiMenu)
|
||||||
{
|
{
|
||||||
os::Menus* menus = os::instance()->menus();
|
os::Menus* menus = os::System::instance()->menus();
|
||||||
|
|
||||||
for (const auto& child : uiMenu->children()) {
|
for (const auto& child : uiMenu->children()) {
|
||||||
os::MenuItemInfo info;
|
os::MenuItemInfo info;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -661,7 +661,7 @@ bool CliProcessor::openFile(Context* ctx, CliOpenFile& cof)
|
|||||||
auto fn = base::normalize_path(usedFn);
|
auto fn = base::normalize_path(usedFn);
|
||||||
m_usedFiles.insert(fn);
|
m_usedFiles.insert(fn);
|
||||||
|
|
||||||
os::instance()->markCliFileAsProcessed(fn);
|
os::System::instance()->markCliFileAsProcessed(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
Doc* doc = ctx->activeDocument();
|
Doc* doc = ctx->activeDocument();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2021 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
@ -76,7 +76,7 @@ void convert_color_profile(doc::Sprite* sprite,
|
|||||||
ASSERT(sprite->colorSpace());
|
ASSERT(sprite->colorSpace());
|
||||||
ASSERT(newCS);
|
ASSERT(newCS);
|
||||||
|
|
||||||
os::System* system = os::instance();
|
const os::SystemRef system = os::System::instance();
|
||||||
auto srcOCS = system->makeColorSpace(sprite->colorSpace());
|
auto srcOCS = system->makeColorSpace(sprite->colorSpace());
|
||||||
auto dstOCS = system->makeColorSpace(newCS);
|
auto dstOCS = system->makeColorSpace(newCS);
|
||||||
ASSERT(srcOCS);
|
ASSERT(srcOCS);
|
||||||
@ -131,7 +131,7 @@ void convert_color_profile(doc::Image* image,
|
|||||||
ASSERT(oldCS);
|
ASSERT(oldCS);
|
||||||
ASSERT(newCS);
|
ASSERT(newCS);
|
||||||
|
|
||||||
os::System* system = os::instance();
|
const os::SystemRef system = os::System::instance();
|
||||||
auto srcOCS = system->makeColorSpace(oldCS);
|
auto srcOCS = system->makeColorSpace(oldCS);
|
||||||
auto dstOCS = system->makeColorSpace(newCS);
|
auto dstOCS = system->makeColorSpace(newCS);
|
||||||
ASSERT(srcOCS);
|
ASSERT(srcOCS);
|
||||||
@ -166,7 +166,7 @@ void convert_color_profile(doc::Image* image,
|
|||||||
ConvertColorProfile::ConvertColorProfile(doc::Sprite* sprite, const gfx::ColorSpaceRef& newCS)
|
ConvertColorProfile::ConvertColorProfile(doc::Sprite* sprite, const gfx::ColorSpaceRef& newCS)
|
||||||
: WithSprite(sprite)
|
: WithSprite(sprite)
|
||||||
{
|
{
|
||||||
os::System* system = os::instance();
|
const os::SystemRef system = os::System::instance();
|
||||||
|
|
||||||
ASSERT(sprite->colorSpace());
|
ASSERT(sprite->colorSpace());
|
||||||
ASSERT(newCS);
|
ASSERT(newCS);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
@ -34,7 +34,7 @@ void initialize_color_spaces(Preferences& pref)
|
|||||||
|
|
||||||
os::ColorSpaceRef get_screen_color_space()
|
os::ColorSpaceRef get_screen_color_space()
|
||||||
{
|
{
|
||||||
return os::instance()->defaultWindow()->colorSpace();
|
return os::System::instance()->defaultWindow()->colorSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
os::ColorSpaceRef get_current_color_space()
|
os::ColorSpaceRef get_current_color_space()
|
||||||
@ -55,7 +55,7 @@ gfx::ColorSpaceRef get_working_rgb_space_from_preferences()
|
|||||||
return gfx::ColorSpace::MakeSRGB();
|
return gfx::ColorSpace::MakeSRGB();
|
||||||
|
|
||||||
std::vector<os::ColorSpaceRef> colorSpaces;
|
std::vector<os::ColorSpaceRef> colorSpaces;
|
||||||
os::instance()->listColorSpaces(colorSpaces);
|
os::System::instance()->listColorSpaces(colorSpaces);
|
||||||
for (auto& cs : colorSpaces) {
|
for (auto& cs : colorSpaces) {
|
||||||
if (cs->gfxColorSpace()->name() == name)
|
if (cs->gfxColorSpace()->name() == name)
|
||||||
return cs->gfxColorSpace();
|
return cs->gfxColorSpace();
|
||||||
@ -73,7 +73,8 @@ ConvertCS::ConvertCS()
|
|||||||
auto srcCS = get_current_color_space();
|
auto srcCS = get_current_color_space();
|
||||||
auto dstCS = get_screen_color_space();
|
auto dstCS = get_screen_color_space();
|
||||||
if (srcCS && dstCS)
|
if (srcCS && dstCS)
|
||||||
m_conversion = os::instance()->convertBetweenColorSpace(srcCS, dstCS);
|
m_conversion = os::System::instance()
|
||||||
|
->convertBetweenColorSpace(srcCS, dstCS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +82,8 @@ ConvertCS::ConvertCS(const os::ColorSpaceRef& srcCS,
|
|||||||
const os::ColorSpaceRef& dstCS)
|
const os::ColorSpaceRef& dstCS)
|
||||||
{
|
{
|
||||||
if (g_manage) {
|
if (g_manage) {
|
||||||
m_conversion = os::instance()->convertBetweenColorSpace(srcCS, dstCS);
|
m_conversion = os::System::instance()
|
||||||
|
->convertBetweenColorSpace(srcCS, dstCS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +112,8 @@ ConvertCS convert_from_current_to_screen_color_space()
|
|||||||
ConvertCS convert_from_custom_to_srgb(const os::ColorSpaceRef& from)
|
ConvertCS convert_from_custom_to_srgb(const os::ColorSpaceRef& from)
|
||||||
{
|
{
|
||||||
return ConvertCS(from,
|
return ConvertCS(from,
|
||||||
os::instance()->makeColorSpace(gfx::ColorSpace::MakeSRGB()));
|
os::System::instance()
|
||||||
|
->makeColorSpace(gfx::ColorSpace::MakeSRGB()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -184,8 +184,8 @@ protected:
|
|||||||
|
|
||||||
// Render sprite and leave the result in 'm_render' variable
|
// Render sprite and leave the result in 'm_render' variable
|
||||||
if (m_render == nullptr) {
|
if (m_render == nullptr) {
|
||||||
m_render = os::instance()->makeRgbaSurface(m_sprite->width(),
|
m_render = os::System::instance()->makeRgbaSurface(m_sprite->width(),
|
||||||
m_sprite->height());
|
m_sprite->height());
|
||||||
|
|
||||||
#if LAF_SKIA
|
#if LAF_SKIA
|
||||||
// The SimpleRenderer renders unpremultiplied surfaces when
|
// The SimpleRenderer renders unpremultiplied surfaces when
|
||||||
|
@ -256,7 +256,8 @@ class OptionsWindow : public app::gen::Options {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
OptionsWindow(Context* context, int& curSection)
|
OptionsWindow(Context* context, int& curSection)
|
||||||
: m_context(context)
|
: m_system(os::System::instance())
|
||||||
|
, m_context(context)
|
||||||
, m_pref(Preferences::instance())
|
, m_pref(Preferences::instance())
|
||||||
, m_globPref(m_pref.document(nullptr))
|
, m_globPref(m_pref.document(nullptr))
|
||||||
, m_docPref(m_pref.document(context->activeDocument()))
|
, m_docPref(m_pref.document(context->activeDocument()))
|
||||||
@ -289,7 +290,7 @@ public:
|
|||||||
resetColorManagement()->Click.connect([this]{ onResetColorManagement(); });
|
resetColorManagement()->Click.connect([this]{ onResetColorManagement(); });
|
||||||
colorManagement()->Click.connect([this]{ onColorManagement(); });
|
colorManagement()->Click.connect([this]{ onColorManagement(); });
|
||||||
{
|
{
|
||||||
os::instance()->listColorSpaces(m_colorSpaces);
|
m_system->listColorSpaces(m_colorSpaces);
|
||||||
for (auto& cs : m_colorSpaces) {
|
for (auto& cs : m_colorSpaces) {
|
||||||
if (cs->gfxColorSpace()->type() != gfx::ColorSpace::None)
|
if (cs->gfxColorSpace()->type() != gfx::ColorSpace::None)
|
||||||
workingRgbCs()->addItem(new ColorSpaceItem(cs));
|
workingRgbCs()->addItem(new ColorSpaceItem(cs));
|
||||||
@ -400,8 +401,7 @@ public:
|
|||||||
moveOnAddMode()->setSelected(true);
|
moveOnAddMode()->setSelected(true);
|
||||||
|
|
||||||
// If the platform supports native cursors...
|
// If the platform supports native cursors...
|
||||||
if ((int(os::instance()->capabilities()) &
|
if (m_system->hasCapability(os::Capabilities::CustomMouseCursor)) {
|
||||||
int(os::Capabilities::CustomMouseCursor)) != 0) {
|
|
||||||
if (m_pref.cursor.useNativeCursor())
|
if (m_pref.cursor.useNativeCursor())
|
||||||
nativeCursor()->setSelected(true);
|
nativeCursor()->setSelected(true);
|
||||||
nativeCursor()->Click.connect([this]{ onNativeCursorChange(); });
|
nativeCursor()->Click.connect([this]{ onNativeCursorChange(); });
|
||||||
@ -431,7 +431,7 @@ public:
|
|||||||
|
|
||||||
#ifdef _WIN32 // Show Tablet section on Windows
|
#ifdef _WIN32 // Show Tablet section on Windows
|
||||||
{
|
{
|
||||||
os::TabletAPI tabletAPI = os::instance()->tabletAPI();
|
os::TabletAPI tabletAPI = m_system->tabletAPI();
|
||||||
|
|
||||||
if (tabletAPI == os::TabletAPI::Wintab) {
|
if (tabletAPI == os::TabletAPI::Wintab) {
|
||||||
tabletApiWintabSystem()->setSelected(true);
|
tabletApiWintabSystem()->setSelected(true);
|
||||||
@ -521,7 +521,7 @@ public:
|
|||||||
|
|
||||||
#ifdef ENABLE_DEVMODE // TODO enable this on Release when Aseprite supports
|
#ifdef ENABLE_DEVMODE // TODO enable this on Release when Aseprite supports
|
||||||
// GPU-acceleration properly
|
// GPU-acceleration properly
|
||||||
if (os::instance()->hasCapability(os::Capabilities::GpuAccelerationSwitch)) {
|
if (m_system->hasCapability(os::Capabilities::GpuAccelerationSwitch)) {
|
||||||
gpuAcceleration()->setSelected(m_pref.general.gpuAcceleration());
|
gpuAcceleration()->setSelected(m_pref.general.gpuAcceleration());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -532,7 +532,7 @@ public:
|
|||||||
|
|
||||||
// If the platform does support native menus, we show the option,
|
// If the platform does support native menus, we show the option,
|
||||||
// in other case, the option doesn't make sense for this platform.
|
// in other case, the option doesn't make sense for this platform.
|
||||||
if (os::instance()->menus())
|
if (m_system->menus())
|
||||||
showMenuBar()->setSelected(m_pref.general.showMenuBar());
|
showMenuBar()->setSelected(m_pref.general.showMenuBar());
|
||||||
else
|
else
|
||||||
showMenuBar()->setVisible(false);
|
showMenuBar()->setVisible(false);
|
||||||
@ -855,7 +855,7 @@ public:
|
|||||||
->setInterpretOneFingerGestureAsMouseMovement(
|
->setInterpretOneFingerGestureAsMouseMovement(
|
||||||
oneFingerAsMouseMovement()->isSelected());
|
oneFingerAsMouseMovement()->isSelected());
|
||||||
|
|
||||||
os::instance()->setTabletAPI(tabletAPI);
|
os::System::instance()->setTabletAPI(tabletAPI);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -883,7 +883,7 @@ public:
|
|||||||
reset_screen = true;
|
reset_screen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (os::instance()->menus() &&
|
if (m_system->menus() &&
|
||||||
m_pref.general.showMenuBar() != showMenuBar()->isSelected()) {
|
m_pref.general.showMenuBar() != showMenuBar()->isSelected()) {
|
||||||
m_pref.general.showMenuBar(showMenuBar()->isSelected());
|
m_pref.general.showMenuBar(showMenuBar()->isSelected());
|
||||||
}
|
}
|
||||||
@ -1013,7 +1013,7 @@ private:
|
|||||||
|
|
||||||
void updateScreenScaling() {
|
void updateScreenScaling() {
|
||||||
ui::Manager* manager = ui::Manager::getDefault();
|
ui::Manager* manager = ui::Manager::getDefault();
|
||||||
os::instance()->setGpuAcceleration(m_pref.general.gpuAcceleration());
|
m_system->setGpuAcceleration(m_pref.general.gpuAcceleration());
|
||||||
manager->updateAllDisplaysWithNewScale(m_pref.general.screenScale());
|
manager->updateAllDisplaysWithNewScale(m_pref.general.screenScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,8 +1027,7 @@ private:
|
|||||||
void onNativeCursorChange() {
|
void onNativeCursorChange() {
|
||||||
bool state =
|
bool state =
|
||||||
// If the platform supports custom cursors...
|
// If the platform supports custom cursors...
|
||||||
(((int(os::instance()->capabilities()) &
|
((m_system->hasCapability(os::Capabilities::CustomMouseCursor)) &&
|
||||||
int(os::Capabilities::CustomMouseCursor)) != 0) &&
|
|
||||||
// If the native cursor option is not selec
|
// If the native cursor option is not selec
|
||||||
!nativeCursor()->isSelected());
|
!nativeCursor()->isSelected());
|
||||||
|
|
||||||
@ -1789,6 +1788,7 @@ private:
|
|||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
os::SystemRef m_system;
|
||||||
Context* m_context;
|
Context* m_context;
|
||||||
Preferences& m_pref;
|
Preferences& m_pref;
|
||||||
DocumentPreferences& m_globPref;
|
DocumentPreferences& m_globPref;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -244,8 +244,9 @@ void SpritePropertiesCommand::onExecute(Context* context)
|
|||||||
ColorButton* color_button = nullptr;
|
ColorButton* color_button = nullptr;
|
||||||
|
|
||||||
// List of available color profiles
|
// List of available color profiles
|
||||||
|
const os::SystemRef system = os::System::instance();
|
||||||
std::vector<os::ColorSpaceRef> colorSpaces;
|
std::vector<os::ColorSpaceRef> colorSpaces;
|
||||||
os::instance()->listColorSpaces(colorSpaces);
|
system->listColorSpaces(colorSpaces);
|
||||||
|
|
||||||
// Load the window widget
|
// Load the window widget
|
||||||
SpritePropertiesWindow window(context->activeDocument()->sprite());
|
SpritePropertiesWindow window(context->activeDocument()->sprite());
|
||||||
@ -335,7 +336,7 @@ void SpritePropertiesCommand::onExecute(Context* context)
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if (selectedColorProfile < 0) {
|
if (selectedColorProfile < 0) {
|
||||||
colorSpaces.push_back(os::instance()->makeColorSpace(sprite->colorSpace()));
|
colorSpaces.push_back(system->makeColorSpace(sprite->colorSpace()));
|
||||||
selectedColorProfile = colorSpaces.size()-1;
|
selectedColorProfile = colorSpaces.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -671,8 +671,7 @@ void Doc::removeFromContext()
|
|||||||
|
|
||||||
void Doc::updateOSColorSpace(bool appWideSignal)
|
void Doc::updateOSColorSpace(bool appWideSignal)
|
||||||
{
|
{
|
||||||
auto system = os::instance();
|
if (const os::SystemRef system = os::System::instance()) {
|
||||||
if (system) {
|
|
||||||
m_osColorSpace = system->makeColorSpace(sprite()->colorSpace());
|
m_osColorSpace = system->makeColorSpace(sprite()->colorSpace());
|
||||||
if (!m_osColorSpace && system->defaultWindow())
|
if (!m_osColorSpace && system->defaultWindow())
|
||||||
m_osColorSpace = system->defaultWindow()->colorSpace();
|
m_osColorSpace = system->defaultWindow()->colorSpace();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2022 Igara Studio S.A.
|
// Copyright (C) 2022-2024 Igara Studio S.A.
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
@ -134,7 +134,7 @@ BENCHMARK(BM_ZoomEditor)
|
|||||||
|
|
||||||
int app_main(int argc, char* argv[])
|
int app_main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
os::SystemRef system(os::make_system());
|
os::SystemRef system = os::System::make();
|
||||||
App app;
|
App app;
|
||||||
const char* argv2[] = { argv[0] };
|
const char* argv2[] = { argv[0] };
|
||||||
app.initialize(AppOptions(1, { argv2 }));
|
app.initialize(AppOptions(1, { argv2 }));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2020-2023 Igara Studio S.A.
|
// Copyright (C) 2020-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -28,13 +28,14 @@ bool show_file_selector(
|
|||||||
FileSelectorType type,
|
FileSelectorType type,
|
||||||
base::paths& output)
|
base::paths& output)
|
||||||
{
|
{
|
||||||
|
const os::SystemRef system = os::System::instance();
|
||||||
const std::string defExtension =
|
const std::string defExtension =
|
||||||
Preferences::instance().saveFile.defaultExtension();
|
Preferences::instance().saveFile.defaultExtension();
|
||||||
|
|
||||||
if (Preferences::instance().experimental.useNativeFileDialog() &&
|
if (Preferences::instance().experimental.useNativeFileDialog() &&
|
||||||
os::instance()->nativeDialogs()) {
|
system->nativeDialogs()) {
|
||||||
os::FileDialogRef dlg =
|
os::FileDialogRef dlg =
|
||||||
os::instance()->nativeDialogs()->makeFileDialog();
|
system->nativeDialogs()->makeFileDialog();
|
||||||
|
|
||||||
if (dlg) {
|
if (dlg) {
|
||||||
dlg->setTitle(title);
|
dlg->setTitle(title);
|
||||||
@ -71,7 +72,7 @@ bool show_file_selector(
|
|||||||
for (const auto& ext : extensions)
|
for (const auto& ext : extensions)
|
||||||
dlg->addFilter(ext, ext + " files (*." + ext + ")");
|
dlg->addFilter(ext, ext + " files (*." + ext + ")");
|
||||||
|
|
||||||
auto res = dlg->show(os::instance()->defaultWindow());
|
auto res = dlg->show(system->defaultWindow());
|
||||||
if (res != os::FileDialog::Result::Error) {
|
if (res != os::FileDialog::Result::Error) {
|
||||||
if (res == os::FileDialog::Result::OK) {
|
if (res == os::FileDialog::Result::OK) {
|
||||||
if (type == FileSelectorType::OpenMultiple)
|
if (type == FileSelectorType::OpenMultiple)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2022 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -464,7 +464,8 @@ const FileItemList& FileItem::children()
|
|||||||
|
|
||||||
// Get the interface to enumerate subitems
|
// Get the interface to enumerate subitems
|
||||||
hr = pFolder->EnumObjects(
|
hr = pFolder->EnumObjects(
|
||||||
reinterpret_cast<HWND>(os::instance()->defaultWindow()->nativeHandle()),
|
reinterpret_cast<HWND>(os::System::instance()
|
||||||
|
->defaultWindow()->nativeHandle()),
|
||||||
SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &pEnum);
|
SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &pEnum);
|
||||||
|
|
||||||
if (hr == S_OK && pEnum) {
|
if (hr == S_OK && pEnum) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -73,7 +73,7 @@ ConfigModule::ConfigModule()
|
|||||||
std::string err = "Error in configuration migration: ";
|
std::string err = "Error in configuration migration: ";
|
||||||
err += ex.what();
|
err += ex.what();
|
||||||
|
|
||||||
auto system = os::instance();
|
const os::SystemRef system = os::System::instance();
|
||||||
if (system && system->logger())
|
if (system && system->logger())
|
||||||
system->logger()->logError(err.c_str());
|
system->logger()->logError(err.c_str());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -228,7 +228,8 @@ void draw_tile(ui::Graphics* g,
|
|||||||
|
|
||||||
int w = tileImage->width();
|
int w = tileImage->width();
|
||||||
int h = tileImage->height();
|
int h = tileImage->height();
|
||||||
os::SurfaceRef surface = os::instance()->makeRgbaSurface(w, h);
|
|
||||||
|
os::SurfaceRef surface = os::System::instance()->makeRgbaSurface(w, h);
|
||||||
convert_image_to_surface(tileImage.get(), get_current_palette(),
|
convert_image_to_surface(tileImage.get(), get_current_palette(),
|
||||||
surface.get(), 0, 0, 0, 0, w, h);
|
surface.get(), 0, 0, 0, 0, w, h);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -127,13 +127,14 @@ static bool create_main_window(bool gpuAccel,
|
|||||||
// executed.
|
// executed.
|
||||||
int scale = Preferences::instance().general.screenScale();
|
int scale = Preferences::instance().general.screenScale();
|
||||||
|
|
||||||
os::instance()->setGpuAcceleration(gpuAccel);
|
const os::SystemRef system = os::System::instance();
|
||||||
|
system->setGpuAcceleration(gpuAccel);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!spec.frame().isEmpty() ||
|
if (!spec.frame().isEmpty() ||
|
||||||
!spec.contentRect().isEmpty()) {
|
!spec.contentRect().isEmpty()) {
|
||||||
spec.scale(scale == 0 ? 2: std::clamp(scale, 1, 4));
|
spec.scale(scale == 0 ? 2: std::clamp(scale, 1, 4));
|
||||||
main_window = os::instance()->makeWindow(spec);
|
main_window = system->makeWindow(spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const os::WindowCreationException& e) {
|
catch (const os::WindowCreationException& e) {
|
||||||
@ -149,7 +150,7 @@ static bool create_main_window(bool gpuAccel,
|
|||||||
spec.contentRect(gfx::Rect(0, 0,
|
spec.contentRect(gfx::Rect(0, 0,
|
||||||
try_resolutions[c].width * spec.scale(),
|
try_resolutions[c].width * spec.scale(),
|
||||||
try_resolutions[c].height * spec.scale()));
|
try_resolutions[c].height * spec.scale()));
|
||||||
main_window = os::instance()->makeWindow(spec);
|
main_window = system->makeWindow(spec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (const os::WindowCreationException& e) {
|
catch (const os::WindowCreationException& e) {
|
||||||
@ -174,6 +175,7 @@ static bool create_main_window(bool gpuAccel,
|
|||||||
// Initializes GUI.
|
// Initializes GUI.
|
||||||
int init_module_gui()
|
int init_module_gui()
|
||||||
{
|
{
|
||||||
|
const os::SystemRef system = os::System::instance();
|
||||||
auto& pref = Preferences::instance();
|
auto& pref = Preferences::instance();
|
||||||
bool maximized = false;
|
bool maximized = false;
|
||||||
std::string lastError = "Unknown error";
|
std::string lastError = "Unknown error";
|
||||||
@ -183,7 +185,7 @@ int init_module_gui()
|
|||||||
// If we've created the native window with hardware acceleration,
|
// If we've created the native window with hardware acceleration,
|
||||||
// now we try to do it without hardware acceleration.
|
// now we try to do it without hardware acceleration.
|
||||||
if (gpuAccel &&
|
if (gpuAccel &&
|
||||||
os::instance()->hasCapability(os::Capabilities::GpuAccelerationSwitch)) {
|
system->hasCapability(os::Capabilities::GpuAccelerationSwitch)) {
|
||||||
if (create_main_window(false, maximized, lastError)) {
|
if (create_main_window(false, maximized, lastError)) {
|
||||||
// Disable hardware acceleration
|
// Disable hardware acceleration
|
||||||
pref.general.gpuAcceleration(false);
|
pref.general.gpuAcceleration(false);
|
||||||
@ -209,7 +211,7 @@ int init_module_gui()
|
|||||||
|
|
||||||
// Handle live resize too redraw the entire manager, dispatch the UI
|
// Handle live resize too redraw the entire manager, dispatch the UI
|
||||||
// messages, and flip the window.
|
// messages, and flip the window.
|
||||||
os::instance()->handleWindowResize =
|
system->handleWindowResize =
|
||||||
[](os::Window* window) {
|
[](os::Window* window) {
|
||||||
Display* display = Manager::getDisplayFromNativeWindow(window);
|
Display* display = Manager::getDisplayFromNativeWindow(window);
|
||||||
if (!display)
|
if (!display)
|
||||||
@ -250,7 +252,7 @@ void exit_module_gui()
|
|||||||
|
|
||||||
void update_windows_color_profile_from_preferences()
|
void update_windows_color_profile_from_preferences()
|
||||||
{
|
{
|
||||||
auto system = os::instance();
|
const os::SystemRef system = os::System::instance();
|
||||||
|
|
||||||
gen::WindowColorProfile windowProfile;
|
gen::WindowColorProfile windowProfile;
|
||||||
if (Preferences::instance().color.manage())
|
if (Preferences::instance().color.manage())
|
||||||
@ -303,7 +305,8 @@ void update_windows_color_profile_from_preferences()
|
|||||||
|
|
||||||
static bool load_gui_config(os::WindowSpec& spec, bool& maximized)
|
static bool load_gui_config(os::WindowSpec& spec, bool& maximized)
|
||||||
{
|
{
|
||||||
os::ScreenRef screen = os::instance()->mainScreen();
|
const os::SystemRef system = os::System::instance();
|
||||||
|
os::ScreenRef screen = system->mainScreen();
|
||||||
#ifdef LAF_SKIA
|
#ifdef LAF_SKIA
|
||||||
ASSERT(screen);
|
ASSERT(screen);
|
||||||
#else
|
#else
|
||||||
@ -333,7 +336,7 @@ static bool load_gui_config(os::WindowSpec& spec, bool& maximized)
|
|||||||
// 2nd monitor that then unplugged and start Aseprite again.
|
// 2nd monitor that then unplugged and start Aseprite again.
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
os::ScreenList screens;
|
os::ScreenList screens;
|
||||||
os::instance()->listScreens(screens);
|
os::System::instance()->listScreens(screens);
|
||||||
for (const auto& screen : screens) {
|
for (const auto& screen : screens) {
|
||||||
gfx::Rect wa = screen->workarea();
|
gfx::Rect wa = screen->workarea();
|
||||||
gfx::Rect intersection = (frame & wa);
|
gfx::Rect intersection = (frame & wa);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -95,10 +95,10 @@ Preferences::Preferences()
|
|||||||
// Hide the menu bar depending on:
|
// Hide the menu bar depending on:
|
||||||
// 1. this is the first run of the program
|
// 1. this is the first run of the program
|
||||||
// 2. the native menu bar is available
|
// 2. the native menu bar is available
|
||||||
if (firstTime &&
|
if (firstTime) {
|
||||||
os::instance() &&
|
const os::SystemRef system = os::System::instance();
|
||||||
os::instance()->menus()) {
|
if (system && system->menus())
|
||||||
general.showMenuBar(false);
|
general.showMenuBar(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (c) 2022-2023 Igara Studio S.A.
|
// Copyright (c) 2022-2024 Igara Studio S.A.
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
@ -183,7 +183,9 @@ bool Canvas::onProcessMessage(ui::Message* msg)
|
|||||||
void Canvas::onResize(ui::ResizeEvent& ev)
|
void Canvas::onResize(ui::ResizeEvent& ev)
|
||||||
{
|
{
|
||||||
Widget::onResize(ev);
|
Widget::onResize(ev);
|
||||||
if (os::instance() && !ev.bounds().isEmpty()) {
|
|
||||||
|
const os::SystemRef system = os::System::instance();
|
||||||
|
if (system && !ev.bounds().isEmpty()) {
|
||||||
int w = ev.bounds().w;
|
int w = ev.bounds().w;
|
||||||
int h = ev.bounds().h;
|
int h = ev.bounds().h;
|
||||||
|
|
||||||
@ -195,7 +197,7 @@ void Canvas::onResize(ui::ResizeEvent& ev)
|
|||||||
if (!m_surface ||
|
if (!m_surface ||
|
||||||
m_surface->width() != w ||
|
m_surface->width() != w ||
|
||||||
m_surface->height() != h) {
|
m_surface->height() != h) {
|
||||||
m_surface = os::instance()->makeSurface(w, h);
|
m_surface = system->makeSurface(w, h);
|
||||||
callPaint();
|
callPaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ void GraphicsContext::drawImage(const doc::Image* img,
|
|||||||
if (!tmpSurface ||
|
if (!tmpSurface ||
|
||||||
tmpSurface->width() < srcRc.w ||
|
tmpSurface->width() < srcRc.w ||
|
||||||
tmpSurface->height() < srcRc.h) {
|
tmpSurface->height() < srcRc.h) {
|
||||||
tmpSurface = os::instance()->makeRgbaSurface(
|
tmpSurface = os::System::instance()->makeRgbaSurface(
|
||||||
std::max(srcRc.w, (tmpSurface ? tmpSurface->width(): 0)),
|
std::max(srcRc.w, (tmpSurface ? tmpSurface->width(): 0)),
|
||||||
std::max(srcRc.h, (tmpSurface ? tmpSurface->height(): 0)));
|
std::max(srcRc.h, (tmpSurface ? tmpSurface->height(): 0)));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2023 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -158,7 +158,7 @@ private:
|
|||||||
// Set the thumbnail of the file-item.
|
// Set the thumbnail of the file-item.
|
||||||
if (thumbnailImage) {
|
if (thumbnailImage) {
|
||||||
os::SurfaceRef thumbnail =
|
os::SurfaceRef thumbnail =
|
||||||
os::instance()->makeRgbaSurface(
|
os::System::instance()->makeRgbaSurface(
|
||||||
thumbnailImage->width(),
|
thumbnailImage->width(),
|
||||||
thumbnailImage->height());
|
thumbnailImage->height());
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2018 David Capello
|
// Copyright (C) 2018 David Capello
|
||||||
// Copyright (C) 2016 Carlo Caputo
|
// Copyright (C) 2016 Carlo Caputo
|
||||||
//
|
//
|
||||||
@ -58,7 +58,7 @@ os::SurfaceRef get_cel_thumbnail(const doc::Cel* cel,
|
|||||||
gfx::Clip(gfx::Rect(gfx::Point(0, 0), newSize)),
|
gfx::Clip(gfx::Rect(gfx::Point(0, 0), newSize)),
|
||||||
255, doc::BlendMode::NORMAL);
|
255, doc::BlendMode::NORMAL);
|
||||||
|
|
||||||
if (os::SurfaceRef thumbnail = os::instance()->makeRgbaSurface(
|
if (os::SurfaceRef thumbnail = os::System::instance()->makeRgbaSurface(
|
||||||
thumbnailImage->width(),
|
thumbnailImage->width(),
|
||||||
thumbnailImage->height())) {
|
thumbnailImage->height())) {
|
||||||
convert_image_to_surface(
|
convert_image_to_surface(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -478,7 +478,7 @@ os::SurfaceRef BrushPopup::createSurfaceForBrush(const BrushRef& origBrush,
|
|||||||
image = brush->image();
|
image = brush->image();
|
||||||
}
|
}
|
||||||
|
|
||||||
os::SurfaceRef surface = os::instance()->makeRgbaSurface(
|
os::SurfaceRef surface = os::System::instance()->makeRgbaSurface(
|
||||||
std::min(kMaxSize, (image ? image->width(): 4)),
|
std::min(kMaxSize, (image ? image->width(): 4)),
|
||||||
std::min(kMaxSize, (image ? image->height(): 4)));
|
std::min(kMaxSize, (image ? image->height(): 4)));
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2020-2023 Igara Studio S.A.
|
// Copyright (C) 2020-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -187,7 +187,7 @@ bool ColorButton::onProcessMessage(Message* msg)
|
|||||||
|
|
||||||
// Or get the color from the screen
|
// Or get the color from the screen
|
||||||
if (gfxColor == gfx::ColorNone) {
|
if (gfxColor == gfx::ColorNone) {
|
||||||
gfxColor = os::instance()->getColorFromScreen(screenPos);
|
gfxColor = os::System::instance()->getColorFromScreen(screenPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
color = app::Color::fromRgb(gfx::getr(gfxColor),
|
color = app::Color::fromRgb(gfx::getr(gfxColor),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2016-2018 David Capello
|
// Copyright (C) 2016-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -121,7 +121,7 @@ public:
|
|||||||
stopCurrentPainting(lock);
|
stopCurrentPainting(lock);
|
||||||
|
|
||||||
os::SurfaceRef oldCanvas = m_canvas;
|
os::SurfaceRef oldCanvas = m_canvas;
|
||||||
m_canvas = os::instance()->makeSurface(w, h, activeCS);
|
m_canvas = os::System::instance()->makeSurface(w, h, activeCS);
|
||||||
os::Paint paint;
|
os::Paint paint;
|
||||||
paint.color(bgColor);
|
paint.color(bgColor);
|
||||||
paint.style(os::Paint::Fill);
|
paint.style(os::Paint::Fill);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2023 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2017 David Capello
|
// Copyright (C) 2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -112,7 +112,7 @@ private:
|
|||||||
m_dithering, nullptr, palette, true, -1, nullptr);
|
m_dithering, nullptr, palette, true, -1, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_preview = os::instance()->makeRgbaSurface(w, h);
|
m_preview = os::System::instance()->makeRgbaSurface(w, h);
|
||||||
convert_image_to_surface(image2.get(), palette, m_preview.get(),
|
convert_image_to_surface(image2.get(), palette, m_preview.get(),
|
||||||
0, 0, 0, 0, w, h);
|
0, 0, 0, 0, w, h);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
@ -143,7 +143,7 @@ private:
|
|||||||
gfx::Size sz = getFloatingOverlaySize();
|
gfx::Size sz = getFloatingOverlaySize();
|
||||||
sz.w = std::max(1, sz.w);
|
sz.w = std::max(1, sz.w);
|
||||||
sz.h = std::max(1, sz.h);
|
sz.h = std::max(1, sz.h);
|
||||||
os::SurfaceRef surface = os::instance()->makeRgbaSurface(sz.w, sz.h);
|
os::SurfaceRef surface = os::System::instance()->makeRgbaSurface(sz.w, sz.h);
|
||||||
|
|
||||||
{
|
{
|
||||||
os::SurfaceLock lock(surface.get());
|
os::SurfaceLock lock(surface.get());
|
||||||
|
@ -673,8 +673,8 @@ void BrushPreview::createCrosshairCursor(ui::Graphics* g,
|
|||||||
const gfx::Color black = gfx::rgba(0, 0, 0);
|
const gfx::Color black = gfx::rgba(0, 0, 0);
|
||||||
const gfx::Color white = gfx::rgba(255, 255, 255);
|
const gfx::Color white = gfx::rgba(255, 255, 255);
|
||||||
os::SurfaceRef cursorSurface =
|
os::SurfaceRef cursorSurface =
|
||||||
os::instance()->makeRgbaSurface(cursorBounds.w,
|
os::System::instance()->makeRgbaSurface(cursorBounds.w,
|
||||||
cursorBounds.h);
|
cursorBounds.h);
|
||||||
cursorSurface->clear();
|
cursorSurface->clear();
|
||||||
int bit = 0;
|
int bit = 0;
|
||||||
if (m_type & CROSSHAIR) {
|
if (m_type & CROSSHAIR) {
|
||||||
@ -704,7 +704,7 @@ void BrushPreview::createCrosshairCursor(ui::Graphics* g,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cursor = g_bwCursors[k] =
|
cursor = g_bwCursors[k] =
|
||||||
os::instance()->makeCursor(
|
os::System::instance()->makeCursor(
|
||||||
cursorSurface.get(),
|
cursorSurface.get(),
|
||||||
cursorCenter,
|
cursorCenter,
|
||||||
scale);
|
scale);
|
||||||
@ -733,8 +733,8 @@ void BrushPreview::createCrosshairCursor(ui::Graphics* g,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
os::SurfaceRef cursorSurface =
|
os::SurfaceRef cursorSurface =
|
||||||
os::instance()->makeRgbaSurface(cursorBounds.w,
|
os::System::instance()->makeRgbaSurface(cursorBounds.w,
|
||||||
cursorBounds.h);
|
cursorBounds.h);
|
||||||
cursorSurface->clear();
|
cursorSurface->clear();
|
||||||
if (m_type & CROSSHAIR) {
|
if (m_type & CROSSHAIR) {
|
||||||
for (int v=0; v<7; v++)
|
for (int v=0; v<7; v++)
|
||||||
@ -746,7 +746,7 @@ void BrushPreview::createCrosshairCursor(ui::Graphics* g,
|
|||||||
cursorSurface->putPixel(cursorColor, cursorBounds.w/2, cursorBounds.h/2);
|
cursorSurface->putPixel(cursorColor, cursorBounds.w/2, cursorBounds.h/2);
|
||||||
|
|
||||||
cursor = g_solidCursors[k] =
|
cursor = g_solidCursors[k] =
|
||||||
os::instance()->makeCursor(
|
os::System::instance()->makeCursor(
|
||||||
cursorSurface.get(),
|
cursorSurface.get(),
|
||||||
cursorCenter,
|
cursorCenter,
|
||||||
scale);
|
scale);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -733,7 +733,7 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
|
|||||||
rendered->colorSpace() != m_document->osColorSpace()) {
|
rendered->colorSpace() != m_document->osColorSpace()) {
|
||||||
const int maxw = std::max(rc2.w, rendered ? rendered->width(): 0);
|
const int maxw = std::max(rc2.w, rendered ? rendered->width(): 0);
|
||||||
const int maxh = std::max(rc2.h, rendered ? rendered->height(): 0);
|
const int maxh = std::max(rc2.h, rendered ? rendered->height(): 0);
|
||||||
rendered = os::instance()->makeRgbaSurface(
|
rendered = os::System::instance()->makeRgbaSurface(
|
||||||
maxw, maxh, m_document->osColorSpace());
|
maxw, maxh, m_document->osColorSpace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -926,7 +926,7 @@ bool StandbyState::Decorator::onSetCursor(tools::Ink* ink, Editor* editor, const
|
|||||||
ink->isSelection() &&
|
ink->isSelection() &&
|
||||||
editor->document()->isMaskVisible() &&
|
editor->document()->isMaskVisible() &&
|
||||||
(!Preferences::instance().selection.modifiersDisableHandles() ||
|
(!Preferences::instance().selection.modifiersDisableHandles() ||
|
||||||
os::instance()->keyModifiers() == kKeyNoneModifier)) {
|
os::System::instance()->keyModifiers() == kKeyNoneModifier)) {
|
||||||
auto theme = skin::SkinTheme::get(editor);
|
auto theme = skin::SkinTheme::get(editor);
|
||||||
const Transformation transformation(m_standbyState->getTransformation(editor));
|
const Transformation transformation(m_standbyState->getTransformation(editor));
|
||||||
TransformHandles* tr = getTransformHandles(editor);
|
TransformHandles* tr = getTransformHandles(editor);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2020-2022 Igara Studio S.A.
|
// Copyright (C) 2020-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -73,8 +73,9 @@ private:
|
|||||||
|
|
||||||
if (m_image) {
|
if (m_image) {
|
||||||
Graphics* g = ev.graphics();
|
Graphics* g = ev.graphics();
|
||||||
os::SurfaceRef sur = os::instance()->makeRgbaSurface(m_image->width(),
|
os::SurfaceRef sur = os::System::instance()
|
||||||
m_image->height());
|
->makeRgbaSurface(m_image->width(),
|
||||||
|
m_image->height());
|
||||||
|
|
||||||
convert_image_to_surface(
|
convert_image_to_surface(
|
||||||
m_image.get(), nullptr, sur.get(),
|
m_image.get(), nullptr, sur.get(),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -587,7 +587,7 @@ void MainWindow::configureWorkspaceLayout()
|
|||||||
bool normal = (m_mode == NormalMode);
|
bool normal = (m_mode == NormalMode);
|
||||||
bool isDoc = (getDocView() != nullptr);
|
bool isDoc = (getDocView() != nullptr);
|
||||||
|
|
||||||
if (os::instance()->menus() == nullptr ||
|
if (os::System::instance()->menus() == nullptr ||
|
||||||
pref.general.showMenuBar()) {
|
pref.general.showMenuBar()) {
|
||||||
m_menuBar->resetMaxSize();
|
m_menuBar->resetMaxSize();
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ public:
|
|||||||
if (tileImage) {
|
if (tileImage) {
|
||||||
int w = tileImage->width();
|
int w = tileImage->width();
|
||||||
int h = tileImage->height();
|
int h = tileImage->height();
|
||||||
os::SurfaceRef surface = os::instance()->makeRgbaSurface(w, h);
|
os::SurfaceRef surface = os::System::instance()->makeRgbaSurface(w, h);
|
||||||
convert_image_to_surface(tileImage.get(), get_current_palette(),
|
convert_image_to_surface(tileImage.get(), get_current_palette(),
|
||||||
surface.get(), 0, 0, 0, 0, w, h);
|
surface.get(), 0, 0, 0, 0, w, h);
|
||||||
|
|
||||||
|
@ -376,11 +376,13 @@ void SkinTheme::loadAll(const std::string& themeId,
|
|||||||
|
|
||||||
void SkinTheme::loadSheet()
|
void SkinTheme::loadSheet()
|
||||||
{
|
{
|
||||||
|
os::SystemRef system = os::System::instance();
|
||||||
|
|
||||||
// Load the skin sheet
|
// Load the skin sheet
|
||||||
std::string sheet_filename(base::join_path(m_path, "sheet.png"));
|
std::string sheet_filename(base::join_path(m_path, "sheet.png"));
|
||||||
os::SurfaceRef newSheet;
|
os::SurfaceRef newSheet;
|
||||||
try {
|
try {
|
||||||
newSheet = os::instance()->loadRgbaSurface(sheet_filename.c_str());
|
newSheet = os::System::instance()->loadRgbaSurface(sheet_filename.c_str());
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
// Ignore the error, newSheet is nullptr and we will throw our own
|
// Ignore the error, newSheet is nullptr and we will throw our own
|
||||||
@ -393,7 +395,7 @@ void SkinTheme::loadSheet()
|
|||||||
// avoid loading two times the same file (even more, if there
|
// avoid loading two times the same file (even more, if there
|
||||||
// is no scale to apply, m_unscaledSheet must reference the
|
// is no scale to apply, m_unscaledSheet must reference the
|
||||||
// same m_sheet).
|
// same m_sheet).
|
||||||
m_unscaledSheet = os::instance()->loadRgbaSurface(sheet_filename.c_str());
|
m_unscaledSheet = system->loadRgbaSurface(sheet_filename.c_str());
|
||||||
|
|
||||||
// Replace the sprite sheet
|
// Replace the sprite sheet
|
||||||
if (m_sheet)
|
if (m_sheet)
|
||||||
@ -886,7 +888,7 @@ static os::SurfaceRef sliceSheet(os::SurfaceRef sheet, os::SurfaceRef sur, const
|
|||||||
|
|
||||||
if (!bounds.isEmpty()) {
|
if (!bounds.isEmpty()) {
|
||||||
if (!sur)
|
if (!sur)
|
||||||
sur = os::instance()->makeRgbaSurface(bounds.w, bounds.h);
|
sur = os::System::instance()->makeRgbaSurface(bounds.w, bounds.h);
|
||||||
|
|
||||||
os::SurfaceLock lockSrc(sheet.get());
|
os::SurfaceLock lockSrc(sheet.get());
|
||||||
os::SurfaceLock lockDst(sur.get());
|
os::SurfaceLock lockDst(sur.get());
|
||||||
|
@ -970,8 +970,8 @@ void Tabs::createFloatingOverlay(Tab* tab)
|
|||||||
ASSERT(!m_floatingOverlay);
|
ASSERT(!m_floatingOverlay);
|
||||||
|
|
||||||
ui::Display* display = this->display();
|
ui::Display* display = this->display();
|
||||||
os::SurfaceRef surface = os::instance()->makeRgbaSurface(
|
os::SurfaceRef surface = os::System::instance()
|
||||||
tab->width, m_tabsHeight);
|
->makeRgbaSurface(tab->width, m_tabsHeight);
|
||||||
|
|
||||||
// Fill the surface with pink color
|
// Fill the surface with pink color
|
||||||
{
|
{
|
||||||
|
@ -660,7 +660,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (mouseMsg->middle() ||
|
if (mouseMsg->middle() ||
|
||||||
os::instance()->isKeyPressed(kKeySpace)) {
|
os::System::instance()->isKeyPressed(kKeySpace)) {
|
||||||
captureMouse();
|
captureMouse();
|
||||||
m_state = STATE_SCROLLING;
|
m_state = STATE_SCROLLING;
|
||||||
m_oldPos = static_cast<MouseMessage*>(msg)->position();
|
m_oldPos = static_cast<MouseMessage*>(msg)->position();
|
||||||
|
@ -53,7 +53,7 @@ namespace {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void* native_window_handle() {
|
void* native_window_handle() {
|
||||||
return os::instance()->defaultWindow()->nativeHandle();
|
return os::System::instance()->defaultWindow()->nativeHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void custom_error_handler(clip::ErrorCode code) {
|
void custom_error_handler(clip::ErrorCode code) {
|
||||||
|
@ -511,7 +511,8 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
|||||||
throw base::Exception("File %s not found", file);
|
throw base::Exception("File %s not found", file);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
os::SurfaceRef sur = os::instance()->loadRgbaSurface(rf.filename().c_str());
|
os::SurfaceRef sur = os::System::instance()
|
||||||
|
->loadRgbaSurface(rf.filename().c_str());
|
||||||
if (sur) {
|
if (sur) {
|
||||||
sur->setImmutable();
|
sur->setImmutable();
|
||||||
widget = new ImageView(sur, 0);
|
widget = new ImageView(sur, 0);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2023 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -78,10 +78,10 @@ namespace {
|
|||||||
bool m_done = false;
|
bool m_done = false;
|
||||||
public:
|
public:
|
||||||
WintabApiDelegate() {
|
WintabApiDelegate() {
|
||||||
os::instance()->setWintabDelegate(this);
|
os::System::instance()->setWintabDelegate(this);
|
||||||
}
|
}
|
||||||
~WintabApiDelegate() {
|
~WintabApiDelegate() {
|
||||||
os::instance()->setWintabDelegate(nullptr);
|
os::System::instance()->setWintabDelegate(nullptr);
|
||||||
}
|
}
|
||||||
void onWintabID(const std::string& id) override {
|
void onWintabID(const std::string& id) override {
|
||||||
if (!m_done) {
|
if (!m_done) {
|
||||||
@ -125,7 +125,7 @@ int app_main(int argc, char* argv[])
|
|||||||
MemLeak memleak;
|
MemLeak memleak;
|
||||||
base::SystemConsole systemConsole;
|
base::SystemConsole systemConsole;
|
||||||
app::AppOptions options(argc, const_cast<const char**>(argv));
|
app::AppOptions options(argc, const_cast<const char**>(argv));
|
||||||
os::SystemRef system(os::make_system());
|
os::SystemRef system = os::System::make();
|
||||||
doc::Palette::initBestfit();
|
doc::Palette::initBestfit();
|
||||||
app::App app;
|
app::App app;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -37,7 +38,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
#ifdef TEST_GUI
|
#ifdef TEST_GUI
|
||||||
{
|
{
|
||||||
os::SystemRef system(os::make_system());
|
os::SystemRef system = os::System::make();
|
||||||
ui::UISystem uiSystem;
|
ui::UISystem uiSystem;
|
||||||
ui::Manager uiManager(nullptr);
|
ui::Manager uiManager(nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2020 Igara Studio S.A.
|
// Copyright (C) 2020-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -335,7 +335,7 @@ bool Accelerator::isPressed(KeyModifiers modifiers, KeyScancode scancode, int un
|
|||||||
|
|
||||||
bool Accelerator::isPressed() const
|
bool Accelerator::isPressed() const
|
||||||
{
|
{
|
||||||
os::System* sys = os::instance();
|
os::SystemRef sys = os::System::instance();
|
||||||
if (!sys)
|
if (!sys)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ bool Accelerator::isPressed() const
|
|||||||
|
|
||||||
bool Accelerator::isLooselyPressed() const
|
bool Accelerator::isLooselyPressed() const
|
||||||
{
|
{
|
||||||
os::System* sys = os::instance();
|
os::SystemRef sys = os::System::instance();
|
||||||
if (!sys)
|
if (!sys)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2020-2021 Igara Studio S.A.
|
// Copyright (C) 2020-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -38,7 +38,7 @@ os::CursorRef Cursor::nativeCursor(const int scale) const
|
|||||||
if (m_cursor && m_scale == scale)
|
if (m_cursor && m_scale == scale)
|
||||||
return m_cursor;
|
return m_cursor;
|
||||||
|
|
||||||
m_cursor = os::instance()->makeCursor(
|
m_cursor = os::System::instance()->makeCursor(
|
||||||
m_surface.get(),
|
m_surface.get(),
|
||||||
m_focus,
|
m_focus,
|
||||||
m_scale = scale);
|
m_scale = scale);
|
||||||
|
@ -264,7 +264,7 @@ bool Entry::onProcessMessage(Message* msg)
|
|||||||
|
|
||||||
// Start processing dead keys
|
// Start processing dead keys
|
||||||
if (m_translate_dead_keys)
|
if (m_translate_dead_keys)
|
||||||
os::instance()->setTranslateDeadKeys(true);
|
os::System::instance()->setTranslateDeadKeys(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFocusLeaveMessage:
|
case kFocusLeaveMessage:
|
||||||
@ -279,7 +279,7 @@ bool Entry::onProcessMessage(Message* msg)
|
|||||||
|
|
||||||
// Stop processing dead keys
|
// Stop processing dead keys
|
||||||
if (m_translate_dead_keys)
|
if (m_translate_dead_keys)
|
||||||
os::instance()->setTranslateDeadKeys(false);
|
os::System::instance()->setTranslateDeadKeys(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kKeyDownMessage:
|
case kKeyDownMessage:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2019-2023 Igara Studio S.A.
|
// Copyright (C) 2019-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -29,7 +29,7 @@ static gfx::Region get_workarea_region()
|
|||||||
// Returns the union of the workarea of all available screens
|
// Returns the union of the workarea of all available screens
|
||||||
gfx::Region wa;
|
gfx::Region wa;
|
||||||
os::ScreenList screens;
|
os::ScreenList screens;
|
||||||
os::instance()->listScreens(screens);
|
os::System::instance()->listScreens(screens);
|
||||||
for (const auto& screen : screens)
|
for (const auto& screen : screens)
|
||||||
wa |= gfx::Region(screen->workarea());
|
wa |= gfx::Region(screen->workarea());
|
||||||
return wa;
|
return wa;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -200,7 +200,7 @@ bool Manager::widgetAssociatedToManager(Widget* widget)
|
|||||||
Manager::Manager(const os::WindowRef& nativeWindow)
|
Manager::Manager(const os::WindowRef& nativeWindow)
|
||||||
: Widget(kManagerWidget)
|
: Widget(kManagerWidget)
|
||||||
, m_display(nullptr, nativeWindow, this)
|
, m_display(nullptr, nativeWindow, this)
|
||||||
, m_eventQueue(os::instance()->eventQueue())
|
, m_eventQueue(os::System::instance()->eventQueue())
|
||||||
, m_lockedWindow(nullptr)
|
, m_lockedWindow(nullptr)
|
||||||
, m_mouseButton(kButtonNone)
|
, m_mouseButton(kButtonNone)
|
||||||
{
|
{
|
||||||
@ -1428,7 +1428,7 @@ void Manager::_openWindow(Window* window, bool center)
|
|||||||
spec.parent(parentDisplay->nativeWindow());
|
spec.parent(parentDisplay->nativeWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
os::WindowRef newNativeWindow = os::instance()->makeWindow(spec);
|
os::WindowRef newNativeWindow = os::System::instance()->makeWindow(spec);
|
||||||
ui::Display* newDisplay = new ui::Display(parentDisplay, newNativeWindow, window);
|
ui::Display* newDisplay = new ui::Display(parentDisplay, newNativeWindow, window);
|
||||||
|
|
||||||
newNativeWindow->setUserData(newDisplay);
|
newNativeWindow->setUserData(newDisplay);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2018-2021 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -27,8 +27,9 @@ Message::Message(MessageType type, KeyModifiers modifiers)
|
|||||||
, m_recipient(nullptr)
|
, m_recipient(nullptr)
|
||||||
, m_commonAncestor(nullptr)
|
, m_commonAncestor(nullptr)
|
||||||
{
|
{
|
||||||
if (modifiers == kKeyUninitializedModifier && os::instance())
|
const os::SystemRef system = os::System::instance();
|
||||||
m_modifiers = os::instance()->keyModifiers();
|
if (modifiers == kKeyUninitializedModifier && system)
|
||||||
|
m_modifiers = system->keyModifiers();
|
||||||
else
|
else
|
||||||
m_modifiers = modifiers;
|
m_modifiers = modifiers;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -93,9 +93,10 @@ void Overlay::captureOverlappedArea()
|
|||||||
|
|
||||||
if (!m_overlap) {
|
if (!m_overlap) {
|
||||||
// Use the same color space for the overlay as in the screen
|
// Use the same color space for the overlay as in the screen
|
||||||
m_overlap = os::instance()->makeSurface(m_surface->width(),
|
m_overlap = os::System::instance()
|
||||||
m_surface->height(),
|
->makeSurface(m_surface->width(),
|
||||||
displaySurface->colorSpace());
|
m_surface->height(),
|
||||||
|
displaySurface->colorSpace());
|
||||||
}
|
}
|
||||||
|
|
||||||
os::SurfaceLock lock(m_overlap.get());
|
os::SurfaceLock lock(m_overlap.get());
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -219,13 +219,13 @@ UISystem::UISystem()
|
|||||||
ASSERT(!g_instance);
|
ASSERT(!g_instance);
|
||||||
g_instance = this;
|
g_instance = this;
|
||||||
|
|
||||||
|
os::SystemRef system = os::System::instance();
|
||||||
|
|
||||||
main_gui_thread = std::this_thread::get_id();
|
main_gui_thread = std::this_thread::get_id();
|
||||||
mouse_cursor_type = kOutsideDisplay;
|
mouse_cursor_type = kOutsideDisplay;
|
||||||
support_native_custom_cursor =
|
support_native_custom_cursor =
|
||||||
((os::instance() &&
|
(system &&
|
||||||
(int(os::instance()->capabilities()) &
|
system->hasCapability(os::Capabilities::CustomMouseCursor));
|
||||||
int(os::Capabilities::CustomMouseCursor))) ?
|
|
||||||
true: false);
|
|
||||||
|
|
||||||
details::initWidgets();
|
details::initWidgets();
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ void _internal_no_mouse_position()
|
|||||||
|
|
||||||
gfx::Point get_mouse_position()
|
gfx::Point get_mouse_position()
|
||||||
{
|
{
|
||||||
return os::instance()->mousePosition();
|
return os::System::instance()->mousePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_mouse_position(const gfx::Point& newPos,
|
void set_mouse_position(const gfx::Point& newPos,
|
||||||
@ -366,7 +366,7 @@ void set_mouse_position(const gfx::Point& newPos,
|
|||||||
if (display)
|
if (display)
|
||||||
display->nativeWindow()->setMousePosition(newPos);
|
display->nativeWindow()->setMousePosition(newPos);
|
||||||
else
|
else
|
||||||
os::instance()->setMousePosition(newPos);
|
os::System::instance()->setMousePosition(newPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_from_ui_thread(std::function<void()>&& func)
|
void execute_from_ui_thread(std::function<void()>&& func)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite UI Library
|
// Aseprite UI Library
|
||||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
@ -1314,7 +1314,7 @@ GraphicsPtr Widget::getGraphics(const gfx::Rect& clip)
|
|||||||
// buffer only if the default surface is the screen.
|
// buffer only if the default surface is the screen.
|
||||||
if (isDoubleBuffered() && dstSurface->isDirectToScreen()) {
|
if (isDoubleBuffered() && dstSurface->isDirectToScreen()) {
|
||||||
os::SurfaceRef surface =
|
os::SurfaceRef surface =
|
||||||
os::instance()->makeSurface(clip.w, clip.h);
|
os::System::instance()->makeSurface(clip.w, clip.h);
|
||||||
graphics.reset(new Graphics(display, surface, -clip.x, -clip.y),
|
graphics.reset(new Graphics(display, surface, -clip.x, -clip.y),
|
||||||
DeleteGraphicsAndSurface(clip, surface,
|
DeleteGraphicsAndSurface(clip, surface,
|
||||||
dstSurface));
|
dstSurface));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user