Rename she -> os

master
David Capello 2018-08-09 12:58:43 -03:00
parent f9c1c68012
commit 5cb2d984f0
201 changed files with 1471 additions and 1472 deletions

View File

@ -89,7 +89,7 @@ This program is distributed under three different licenses:
are distributed under the MIT license
(e.g. [laf](https://github.com/aseprite/laf),
[clip](https://github.com/aseprite/clip),
[she](https://github.com/aseprite/aseprite/tree/master/src/she),
[os](https://github.com/aseprite/aseprite/tree/master/src/os),
[gfx](src/gfx), [ui](src/ui), etc.).
2. You can request a special
[educational license](http://www.aseprite.org/faq/#is-there-an-educational-license)

View File

@ -8,10 +8,10 @@ function(find_tests dir dependencies)
# Add gtest include directory so we can #include <gtest/gtest.h> in tests source code
include_directories(${CMAKE_SOURCE_DIR}/third_party/gtest/include)
# See if the test is linked with "she" library.
list(FIND dependencies she link_with_she)
if(link_with_she)
set(extra_definitions -DLINKED_WITH_SHE)
# See if the test is linked with "os-lib" library.
list(FIND dependencies os-lib link_with_os)
if(link_with_os)
set(extra_definitions -DLINKED_WITH_OS_LIBRARY)
endif()
foreach(testsourcefile ${tests})

View File

@ -107,7 +107,7 @@ add_subdirectory(net)
add_subdirectory(render)
add_subdirectory(dio)
add_subdirectory(ft)
add_subdirectory(she)
add_subdirectory(os)
add_subdirectory(ui)
if(ENABLE_SCRIPTING)

View File

@ -34,13 +34,13 @@ because they don't depend on any other component.
## Level 2
* [doc](doc/) (base, fixmath, gfx): Document model library.
* [she](she/) (base, gfx, wacom): OS input/output.
* [os](os/) (base, gfx, wacom): OS input/output.
## Level 3
* [filters](filters/) (base, doc, gfx): Effects for images.
* [render](render/) (base, doc, gfx): Library to render documents.
* [ui](ui/) (base, gfx, she): Portable UI library (buttons, windows, text fields, etc.)
* [ui](ui/) (base, gfx, os): Portable UI library (buttons, windows, text fields, etc.)
* [updater](updater/) (base, cfg, net): Component to check for updates.
## Level 4
@ -49,11 +49,11 @@ because they don't depend on any other component.
## Level 5
* [app](app/) (base, doc, dio, filters, fixmath, flic, gfx, pen, render, scripting, she, ui, undo, updater, webserver)
* [app](app/) (base, doc, dio, filters, fixmath, flic, gfx, pen, render, scripting, os, ui, undo, updater, webserver)
## Level 6
* [main](main/) (app, base, she, ui)
* [main](main/) (app, base, os, ui)
* [desktop](desktop/) (base, doc, dio, render): Integration with the desktop (Windows Explorer, Finder, GNOME, KDE, etc.)
# Debugging Tricks

View File

@ -100,7 +100,7 @@ add_definitions(-DLIBARCHIVE_STATIC)
# app-lib target
# These specific-platform files should be in an external library
# (e.g. "base" or "she").
# (e.g. "base" or "os").
set(app_platform_files)
if(WIN32)
set(app_platform_files
@ -578,7 +578,7 @@ target_link_libraries(app-lib
gfx-lib
net-lib
render-lib
she
os-lib
ui-lib
undo
${CMARK_LIBRARIES}

View File

@ -59,10 +59,10 @@
#include "doc/sprite.h"
#include "fmt/format.h"
#include "render/render.h"
#include "she/display.h"
#include "she/error.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/display.h"
#include "os/error.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/intern.h"
#include "ui/ui.h"
@ -187,7 +187,7 @@ void App::initialize(const AppOptions& options)
#ifdef _WIN32
if (options.disableWintab() ||
!preferences().experimental.loadWintabDriver()) {
she::instance()->useWintabAPI(false);
os::instance()->useWintabAPI(false);
}
#endif
@ -273,7 +273,7 @@ void App::initialize(const AppOptions& options)
cli.process(&m_modules->m_context);
}
she::instance()->finishLaunching();
os::instance()->finishLaunching();
}
void App::run()
@ -291,14 +291,14 @@ void App::run()
#if !defined(_WIN32) && !defined(__APPLE__)
// Setup app icon for Linux window managers
try {
she::Display* display = she::instance()->defaultDisplay();
she::SurfaceList icons;
os::Display* display = os::instance()->defaultDisplay();
os::SurfaceList icons;
for (const int size : { 32, 64, 128 }) {
ResourceFinder rf;
rf.includeDataDir(fmt::format("icons/ase{0}.png", size).c_str());
if (rf.findFirst()) {
she::Surface* surf = she::instance()->loadRgbaSurface(rf.filename().c_str());
os::Surface* surf = os::instance()->loadRgbaSurface(rf.filename().c_str());
if (surf)
icons.push_back(surf);
}
@ -319,13 +319,13 @@ void App::run()
#ifdef ENABLE_STEAM
steam::SteamAPI steam;
if (steam.initialized())
she::instance()->activateApp();
os::instance()->activateApp();
#endif
#if ENABLE_DEVMODE
// On OS X, when we compile Aseprite on devmode, we're using it
// outside an app bundle, so we must active the app explicitly.
she::instance()->activateApp();
os::instance()->activateApp();
#endif
#ifdef ENABLE_UPDATER
@ -432,12 +432,12 @@ App::~App()
}
catch (const std::exception& e) {
LOG(ERROR) << "APP: Error: " << e.what() << "\n";
she::error_message(e.what());
os::error_message(e.what());
// no re-throw
}
catch (...) {
she::error_message("Error closing " PACKAGE ".\n(uncaught exception)");
os::error_message("Error closing " PACKAGE ".\n(uncaught exception)");
// no re-throw
}
@ -571,7 +571,7 @@ void App::updateDisplayTitleBar()
}
title += defaultTitle;
she::instance()->defaultDisplay()->setTitleBar(title);
os::instance()->defaultDisplay()->setTitleBar(title);
}
InputChain& App::inputChain()

View File

@ -28,8 +28,8 @@
#include "base/bind.h"
#include "base/fs.h"
#include "base/string.h"
#include "she/menus.h"
#include "she/system.h"
#include "os/menus.h"
#include "os/system.h"
#include "ui/ui.h"
#include "tinyxml.h"
@ -44,7 +44,7 @@ using namespace ui;
namespace {
// TODO Move this to she layer
// TODO Move this to "os" layer
const int kUnicodeEsc = 27;
const int kUnicodeEnter = '\r'; // 10
const int kUnicodeInsert = 0xF727; // NSInsertFunctionKey
@ -63,19 +63,19 @@ void destroy_instance(AppMenus* instance)
delete instance;
}
bool is_text_entry_shortcut(const she::Shortcut& shortcut)
bool is_text_entry_shortcut(const os::Shortcut& shortcut)
{
const she::KeyModifiers mod = shortcut.modifiers();
const os::KeyModifiers mod = shortcut.modifiers();
const int chr = shortcut.unicode();
const int lchr = std::tolower(chr);
bool result =
((mod == she::KeyModifiers::kKeyNoneModifier ||
mod == she::KeyModifiers::kKeyShiftModifier) &&
((mod == os::KeyModifiers::kKeyNoneModifier ||
mod == os::KeyModifiers::kKeyShiftModifier) &&
chr >= 32 && chr < 0xF000)
||
((mod == she::KeyModifiers::kKeyCmdModifier ||
mod == she::KeyModifiers::kKeyCtrlModifier) &&
((mod == os::KeyModifiers::kKeyCmdModifier ||
mod == os::KeyModifiers::kKeyCtrlModifier) &&
(lchr == 'a' || lchr == 'c' || lchr == 'v' || lchr == 'x'))
||
(chr == kUnicodeInsert ||
@ -123,7 +123,7 @@ bool can_call_global_shortcut(const AppMenuItem::Native* native)
}
// TODO this should be on "she" library (or we should use
// she::Shortcut instead of ui::Accelerators)
// os::Shortcut instead of ui::Accelerators)
int from_scancode_to_unicode(KeyScancode scancode)
{
static int map[] = {
@ -276,17 +276,17 @@ AppMenuItem::Native get_native_shortcut_for_command(
} // anonymous namespace
she::Shortcut get_os_shortcut_from_key(const Key* key)
os::Shortcut get_os_shortcut_from_key(const Key* key)
{
if (key && !key->accels().empty()) {
const ui::Accelerator& accel = key->accels().front();
return she::Shortcut(
return os::Shortcut(
(accel.unicodeChar() ? accel.unicodeChar():
from_scancode_to_unicode(accel.scancode())),
accel.modifiers());
}
else
return she::Shortcut();
return os::Shortcut();
}
// static
@ -429,8 +429,8 @@ bool AppMenus::rebuildRecentList()
// Sync native menus
if (list_menuitem->native() &&
list_menuitem->native()->menuItem) {
she::Menus* menus = she::instance()->menus();
she::Menu* osMenu = (menus ? menus->createMenu(): nullptr);
os::Menus* menus = os::instance()->menus();
os::Menu* osMenu = (menus ? menus->createMenu(): nullptr);
if (osMenu) {
createNativeSubmenus(osMenu, submenu);
list_menuitem->native()->menuItem->setSubmenu(osMenu);
@ -631,7 +631,7 @@ void AppMenus::updateMenusList()
void AppMenus::createNativeMenus()
{
she::Menus* menus = she::instance()->menus();
os::Menus* menus = os::instance()->menus();
if (!menus) // This platform doesn't support native menu items
return;
@ -641,7 +641,7 @@ void AppMenus::createNativeMenus()
#ifdef __APPLE__ // Create default macOS app menus (App ... Window)
{
she::MenuItemInfo about("About " PACKAGE);
os::MenuItemInfo about("About " PACKAGE);
auto native = get_native_shortcut_for_command(CommandId::About());
about.shortcut = native.shortcut;
about.execute = [native]{
@ -651,7 +651,7 @@ void AppMenus::createNativeMenus()
}
};
she::MenuItemInfo preferences("Preferences...");
os::MenuItemInfo preferences("Preferences...");
native = get_native_shortcut_for_command(CommandId::Options());
preferences.shortcut = native.shortcut;
preferences.execute = [native]{
@ -661,24 +661,24 @@ void AppMenus::createNativeMenus()
}
};
she::MenuItemInfo hide("Hide " PACKAGE, she::MenuItemInfo::Hide);
hide.shortcut = she::Shortcut('h', she::kKeyCmdModifier);
os::MenuItemInfo hide("Hide " PACKAGE, os::MenuItemInfo::Hide);
hide.shortcut = os::Shortcut('h', os::kKeyCmdModifier);
she::MenuItemInfo quit("Quit " PACKAGE, she::MenuItemInfo::Quit);
quit.shortcut = she::Shortcut('q', she::kKeyCmdModifier);
os::MenuItemInfo quit("Quit " PACKAGE, os::MenuItemInfo::Quit);
quit.shortcut = os::Shortcut('q', os::kKeyCmdModifier);
she::Menu* appMenu = menus->createMenu();
os::Menu* appMenu = menus->createMenu();
appMenu->addItem(menus->createMenuItem(about));
appMenu->addItem(menus->createMenuItem(she::MenuItemInfo(she::MenuItemInfo::Separator)));
appMenu->addItem(menus->createMenuItem(os::MenuItemInfo(os::MenuItemInfo::Separator)));
appMenu->addItem(menus->createMenuItem(preferences));
appMenu->addItem(menus->createMenuItem(she::MenuItemInfo(she::MenuItemInfo::Separator)));
appMenu->addItem(menus->createMenuItem(os::MenuItemInfo(os::MenuItemInfo::Separator)));
appMenu->addItem(menus->createMenuItem(hide));
appMenu->addItem(menus->createMenuItem(she::MenuItemInfo("Hide Others", she::MenuItemInfo::HideOthers)));
appMenu->addItem(menus->createMenuItem(she::MenuItemInfo("Show All", she::MenuItemInfo::ShowAll)));
appMenu->addItem(menus->createMenuItem(she::MenuItemInfo(she::MenuItemInfo::Separator)));
appMenu->addItem(menus->createMenuItem(os::MenuItemInfo("Hide Others", os::MenuItemInfo::HideOthers)));
appMenu->addItem(menus->createMenuItem(os::MenuItemInfo("Show All", os::MenuItemInfo::ShowAll)));
appMenu->addItem(menus->createMenuItem(os::MenuItemInfo(os::MenuItemInfo::Separator)));
appMenu->addItem(menus->createMenuItem(quit));
she::MenuItem* appItem = menus->createMenuItem(she::MenuItemInfo("App"));
os::MenuItem* appItem = menus->createMenuItem(os::MenuItemInfo("App"));
appItem->setSubmenu(appMenu);
m_osMenu->addItem(appItem);
}
@ -699,14 +699,14 @@ void AppMenus::createNativeMenus()
++i;
}
she::MenuItemInfo minimize("Minimize", she::MenuItemInfo::Minimize);
minimize.shortcut = she::Shortcut('m', she::kKeyCmdModifier);
os::MenuItemInfo minimize("Minimize", os::MenuItemInfo::Minimize);
minimize.shortcut = os::Shortcut('m', os::kKeyCmdModifier);
she::Menu* windowMenu = menus->createMenu();
os::Menu* windowMenu = menus->createMenu();
windowMenu->addItem(menus->createMenuItem(minimize));
windowMenu->addItem(menus->createMenuItem(she::MenuItemInfo("Zoom", she::MenuItemInfo::Zoom)));
windowMenu->addItem(menus->createMenuItem(os::MenuItemInfo("Zoom", os::MenuItemInfo::Zoom)));
she::MenuItem* windowItem = menus->createMenuItem(she::MenuItemInfo("Window"));
os::MenuItem* windowItem = menus->createMenuItem(os::MenuItemInfo("Window"));
windowItem->setSubmenu(windowMenu);
// We use helpIndex+1 because the first index in m_osMenu is the
@ -718,17 +718,17 @@ void AppMenus::createNativeMenus()
menus->setAppMenu(m_osMenu);
}
void AppMenus::createNativeSubmenus(she::Menu* osMenu, const ui::Menu* uiMenu)
void AppMenus::createNativeSubmenus(os::Menu* osMenu, const ui::Menu* uiMenu)
{
she::Menus* menus = she::instance()->menus();
os::Menus* menus = os::instance()->menus();
for (const auto& child : uiMenu->children()) {
she::MenuItemInfo info;
os::MenuItemInfo info;
AppMenuItem* appMenuItem = dynamic_cast<AppMenuItem*>(child);
AppMenuItem::Native native;
if (child->type() == kSeparatorWidget) {
info.type = she::MenuItemInfo::Separator;
info.type = os::MenuItemInfo::Separator;
}
else if (child->type() == kMenuItemWidget) {
if (appMenuItem &&
@ -738,14 +738,14 @@ void AppMenus::createNativeSubmenus(she::Menu* osMenu, const ui::Menu* uiMenu)
appMenuItem->getParams());
}
info.type = she::MenuItemInfo::Normal;
info.type = os::MenuItemInfo::Normal;
info.text = child->text();
info.shortcut = native.shortcut;
info.execute = [appMenuItem]{
if (can_call_global_shortcut(appMenuItem->native()))
appMenuItem->executeClick();
};
info.validate = [appMenuItem](she::MenuItem* osItem) {
info.validate = [appMenuItem](os::MenuItem* osItem) {
if (can_call_global_shortcut(appMenuItem->native())) {
appMenuItem->validateItem();
osItem->setEnabled(appMenuItem->isEnabled());
@ -762,7 +762,7 @@ void AppMenus::createNativeSubmenus(she::Menu* osMenu, const ui::Menu* uiMenu)
continue;
}
she::MenuItem* osItem = menus->createMenuItem(info);
os::MenuItem* osItem = menus->createMenuItem(info);
if (osItem) {
osMenu->addItem(osItem);
if (appMenuItem) {
@ -772,7 +772,7 @@ void AppMenus::createNativeSubmenus(she::Menu* osMenu, const ui::Menu* uiMenu)
if (child->type() == ui::kMenuItemWidget &&
((ui::MenuItem*)child)->hasSubmenu()) {
she::Menu* osSubmenu = menus->createMenu();
os::Menu* osSubmenu = menus->createMenu();
createNativeSubmenus(osSubmenu, ((ui::MenuItem*)child)->getSubmenu());
osItem->setSubmenu(osSubmenu);
}

View File

@ -21,7 +21,7 @@
class TiXmlElement;
class TiXmlHandle;
namespace she {
namespace os {
class Menu;
class Shortcut;
}
@ -75,7 +75,7 @@ namespace app {
void syncNativeMenuItemKeyShortcuts(Menu* menu);
void updateMenusList();
void createNativeMenus();
void createNativeSubmenus(she::Menu* osMenu, const ui::Menu* uiMenu);
void createNativeSubmenus(os::Menu* osMenu, const ui::Menu* uiMenu);
std::unique_ptr<Menu> m_rootMenu;
MenuItem* m_recentListMenuitem;
@ -92,11 +92,11 @@ namespace app {
std::unique_ptr<Menu> m_inkPopupMenu;
obs::scoped_connection m_recentFilesConn;
std::vector<Menu*> m_menus;
she::Menu* m_osMenu;
os::Menu* m_osMenu;
XmlTranslator m_xmlTranslator;
};
she::Shortcut get_os_shortcut_from_key(const Key* key);
os::Shortcut get_os_shortcut_from_key(const Key* key);
} // namespace app

View File

@ -21,14 +21,14 @@
#include "app/ui/editor/editor_render.h"
#include "app/ui/keyboard_shortcuts.h"
#include "app/ui/status_bar.h"
#include "doc/conversion_she.h"
#include "doc/conversion_to_surface.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "doc/primitives.h"
#include "doc/sprite.h"
#include "she/scoped_handle.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/scoped_handle.h"
#include "os/surface.h"
#include "os/system.h"
#include <cstring>
@ -53,7 +53,7 @@ public:
, m_proj(editor->projection())
, m_index_bg_color(-1)
, m_doublebuf(Image::create(IMAGE_RGB, ui::display_w(), ui::display_h()))
, m_doublesur(she::instance()->createRgbaSurface(ui::display_w(), ui::display_h())) {
, m_doublesur(os::instance()->createRgbaSurface(ui::display_w(), ui::display_h())) {
// Do not use DocWriter (do not lock the document) because we
// will call other sub-commands (e.g. previous frame, next frame,
// etc.).
@ -249,7 +249,7 @@ private:
int m_index_bg_color;
std::unique_ptr<Image> m_render;
std::unique_ptr<Image> m_doublebuf;
she::ScopedHandle<she::Surface> m_doublesur;
os::ScopedHandle<os::Surface> m_doublesur;
filters::TiledMode m_tiled;
};

View File

@ -33,8 +33,8 @@
#include "doc/image.h"
#include "fmt/format.h"
#include "render/render.h"
#include "she/display.h"
#include "she/system.h"
#include "os/display.h"
#include "os/system.h"
#include "ui/ui.h"
#include "options.xml.h"
@ -222,8 +222,8 @@ public:
moveOnAddMode()->setSelected(true);
// If the platform supports native cursors...
if ((int(she::instance()->capabilities()) &
int(she::Capabilities::CustomNativeMouseCursor)) != 0) {
if ((int(os::instance()->capabilities()) &
int(os::Capabilities::CustomNativeMouseCursor)) != 0) {
if (m_pref.cursor.useNativeCursor())
nativeCursor()->setSelected(true);
nativeCursor()->Click.connect(base::Bind<void>(&OptionsWindow::onNativeCursorChange, this));
@ -281,8 +281,8 @@ public:
selectScalingItems();
if ((int(she::instance()->capabilities()) &
int(she::Capabilities::GpuAccelerationSwitch)) == int(she::Capabilities::GpuAccelerationSwitch)) {
if ((int(os::instance()->capabilities()) &
int(os::Capabilities::GpuAccelerationSwitch)) == int(os::Capabilities::GpuAccelerationSwitch)) {
gpuAcceleration()->setSelected(m_pref.general.gpuAcceleration());
}
else {
@ -291,7 +291,7 @@ public:
// If the platform does support native menus, we show the option,
// in other case, the option doesn't make sense for this platform.
if (she::instance()->menus())
if (os::instance()->menus())
showMenuBar()->setSelected(m_pref.general.showMenuBar());
else
showMenuBar()->setVisible(false);
@ -504,7 +504,7 @@ public:
reset_screen = true;
}
if (she::instance()->menus() &&
if (os::instance()->menus() &&
m_pref.general.showMenuBar() != showMenuBar()->isSelected()) {
m_pref.general.showMenuBar(showMenuBar()->isSelected());
}
@ -573,8 +573,8 @@ private:
void updateScreenScaling() {
ui::Manager* manager = ui::Manager::getDefault();
she::Display* display = manager->getDisplay();
she::instance()->setGpuAcceleration(m_pref.general.gpuAcceleration());
os::Display* display = manager->getDisplay();
os::instance()->setGpuAcceleration(m_pref.general.gpuAcceleration());
display->setScale(m_pref.general.screenScale());
manager->setDisplay(display);
}
@ -589,8 +589,8 @@ private:
void onNativeCursorChange() {
bool state =
// If the platform supports native cursors...
(((int(she::instance()->capabilities()) &
int(she::Capabilities::CustomNativeMouseCursor)) != 0) &&
(((int(os::instance()->capabilities()) &
int(os::Capabilities::CustomNativeMouseCursor)) != 0) &&
// If the native cursor option is not selec
!nativeCursor()->isSelected());

View File

@ -13,9 +13,9 @@
#include "app/app.h"
#include "app/pref/preferences.h"
#include "app/ui/file_selector.h"
#include "she/display.h"
#include "she/native_dialogs.h"
#include "she/system.h"
#include "os/display.h"
#include "os/native_dialogs.h"
#include "os/system.h"
namespace app {
@ -30,24 +30,24 @@ bool show_file_selector(
Preferences::instance().saveFile.defaultExtension();
if (Preferences::instance().experimental.useNativeFileDialog() &&
she::instance()->nativeDialogs()) {
she::FileDialog* dlg =
she::instance()->nativeDialogs()->createFileDialog();
os::instance()->nativeDialogs()) {
os::FileDialog* dlg =
os::instance()->nativeDialogs()->createFileDialog();
if (dlg) {
dlg->setTitle(title);
dlg->setFileName(initialPath);
she::FileDialog::Type nativeType = she::FileDialog::Type::OpenFile;
os::FileDialog::Type nativeType = os::FileDialog::Type::OpenFile;
switch (type) {
case FileSelectorType::Open:
nativeType = she::FileDialog::Type::OpenFile;
nativeType = os::FileDialog::Type::OpenFile;
break;
case FileSelectorType::OpenMultiple:
nativeType = she::FileDialog::Type::OpenFiles;
nativeType = os::FileDialog::Type::OpenFiles;
break;
case FileSelectorType::Save:
nativeType = she::FileDialog::Type::SaveFile;
nativeType = os::FileDialog::Type::SaveFile;
break;
}
dlg->setType(nativeType);
@ -58,7 +58,7 @@ bool show_file_selector(
if (!defExtension.empty())
dlg->setDefaultExtension(defExtension);
bool res = dlg->show(she::instance()->defaultDisplay());
bool res = dlg->show(os::instance()->defaultDisplay());
if (res) {
if (type == FileSelectorType::OpenMultiple)
dlg->getMultipleFileNames(output);

View File

@ -18,9 +18,9 @@
#include "base/fs.h"
#include "base/string.h"
#include "she/display.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/display.h"
#include "os/surface.h"
#include "os/system.h"
#include <algorithm>
#include <cstdio>
@ -96,13 +96,13 @@ public:
bool hasExtension(const base::paths& extensions);
she::Surface* getThumbnail();
void setThumbnail(she::Surface* thumbnail);
os::Surface* getThumbnail();
void setThumbnail(os::Surface* thumbnail);
};
typedef std::map<std::string, FileItem*> FileItemMap;
typedef std::map<std::string, she::Surface*> ThumbnailMap;
typedef std::map<std::string, os::Surface*> ThumbnailMap;
// the root of the file-system
static FileItem* rootitem = NULL;
@ -392,7 +392,7 @@ const FileItemList& FileItem::children()
ULONG c, fetched;
/* get the interface to enumerate subitems */
hr = pFolder->EnumObjects(reinterpret_cast<HWND>(she::instance()->defaultDisplay()->nativeHandle()),
hr = pFolder->EnumObjects(reinterpret_cast<HWND>(os::instance()->defaultDisplay()->nativeHandle()),
SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &pEnum);
if (hr == S_OK && pEnum != NULL) {
@ -520,7 +520,7 @@ bool FileItem::hasExtension(const base::paths& extensions)
return base::has_file_extension(m_filename, extensions);
}
she::Surface* FileItem::getThumbnail()
os::Surface* FileItem::getThumbnail()
{
ThumbnailMap::iterator it = thumbnail_map->find(m_filename);
if (it != thumbnail_map->end())
@ -529,7 +529,7 @@ she::Surface* FileItem::getThumbnail()
return NULL;
}
void FileItem::setThumbnail(she::Surface* thumbnail)
void FileItem::setThumbnail(os::Surface* thumbnail)
{
// destroy the current thumbnail of the file (if exists)
ThumbnailMap::iterator it = thumbnail_map->find(m_filename);

View File

@ -14,7 +14,7 @@
#include <string>
#include <vector>
namespace she {
namespace os {
class Surface;
}
@ -80,8 +80,8 @@ namespace app {
virtual bool hasExtension(const base::paths& extensions) = 0;
virtual she::Surface* getThumbnail() = 0;
virtual void setThumbnail(she::Surface* thumbnail) = 0;
virtual os::Surface* getThumbnail() = 0;
virtual void setThumbnail(os::Surface* thumbnail) = 0;
};
} // namespace app

View File

@ -17,8 +17,8 @@
#include "cfg/cfg.h"
#ifdef __APPLE__
#include "she/logger.h"
#include "she/system.h"
#include "os/logger.h"
#include "os/system.h"
#endif
#ifndef _WIN32
@ -71,7 +71,7 @@ ConfigModule::ConfigModule()
std::string err = "Error in configuration migration: ";
err += ex.what();
auto system = she::instance();
auto system = os::instance();
if (system && system->logger())
system->logger()->logError(err.c_str());
}

View File

@ -23,7 +23,7 @@
#include "gfx/color.h"
#include "gfx/point.h"
#include "gfx/rect.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/intern.h"
#include "ui/system.h"
#include "ui/theme.h"
@ -183,7 +183,7 @@ void draw_alpha_slider(ui::Graphics* g,
}
// TODO this code is exactly the same as draw_alpha_slider() with a ui::Graphics
void draw_alpha_slider(she::Surface* s,
void draw_alpha_slider(os::Surface* s,
const gfx::Rect& rc,
const app::Color& color)
{

View File

@ -14,7 +14,7 @@
#include "gfx/rect.h"
#include "ui/base.h"
namespace she {
namespace os {
class Surface;
}
@ -41,7 +41,7 @@ namespace app {
const gfx::Rect& rc,
const app::Color& color);
void draw_alpha_slider(she::Surface* s,
void draw_alpha_slider(os::Surface* s,
const gfx::Rect& rc,
const app::Color& color);

View File

@ -38,10 +38,10 @@
#include "base/memory.h"
#include "base/shared_ptr.h"
#include "doc/sprite.h"
#include "she/display.h"
#include "she/error.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/display.h"
#include "os/error.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/intern.h"
#include "ui/ui.h"
@ -89,7 +89,7 @@ protected:
void saveLayout(Widget* widget, const std::string& str) override;
};
static she::Display* main_display = NULL;
static os::Display* main_display = NULL;
static CustomizedGuiManager* manager = NULL;
static Theme* gui_theme = NULL;
@ -113,15 +113,15 @@ static bool create_main_display(bool gpuAccel,
// executed.
int scale = Preferences::instance().general.screenScale();
she::instance()->setGpuAcceleration(gpuAccel);
os::instance()->setGpuAcceleration(gpuAccel);
try {
if (w > 0 && h > 0) {
main_display = she::instance()->createDisplay(
main_display = os::instance()->createDisplay(
w, h, (scale == 0 ? 2: MID(1, scale, 4)));
}
}
catch (const she::DisplayCreationException& e) {
catch (const os::DisplayCreationException& e) {
lastError = e.what();
}
@ -129,13 +129,13 @@ static bool create_main_display(bool gpuAccel,
for (int c=0; try_resolutions[c].width; ++c) {
try {
main_display =
she::instance()->createDisplay(
os::instance()->createDisplay(
try_resolutions[c].width,
try_resolutions[c].height,
(scale == 0 ? try_resolutions[c].scale: scale));
break;
}
catch (const she::DisplayCreationException& e) {
catch (const os::DisplayCreationException& e) {
lastError = e.what();
}
}
@ -169,8 +169,8 @@ int init_module_gui()
// If we've created the display with hardware acceleration,
// now we try to do it without hardware acceleration.
if (gpuAccel &&
(int(she::instance()->capabilities()) &
int(she::Capabilities::GpuAccelerationSwitch)) == int(she::Capabilities::GpuAccelerationSwitch)) {
(int(os::instance()->capabilities()) &
int(os::Capabilities::GpuAccelerationSwitch)) == int(os::Capabilities::GpuAccelerationSwitch)) {
if (create_main_display(false, maximized, lastError)) {
// Disable hardware acceleration
pref.general.gpuAcceleration(false);
@ -179,7 +179,7 @@ int init_module_gui()
}
if (!main_display) {
she::error_message(
os::error_message(
("Unable to create a user-interface display.\nDetails: "+lastError+"\n").c_str());
return -1;
}
@ -218,7 +218,7 @@ void exit_module_gui()
static void load_gui_config(int& w, int& h, bool& maximized,
std::string& windowLayout)
{
gfx::Size defSize = she::instance()->defaultNewDisplaySize();
gfx::Size defSize = os::instance()->defaultNewDisplaySize();
w = get_config_int("GfxMode", "Width", defSize.w);
h = get_config_int("GfxMode", "Height", defSize.h);
@ -228,7 +228,7 @@ static void load_gui_config(int& w, int& h, bool& maximized,
static void save_gui_config()
{
she::Display* display = manager->getDisplay();
os::Display* display = manager->getDisplay();
if (display) {
set_config_bool("GfxMode", "Maximized", display->isMaximized());
set_config_int("GfxMode", "Width", display->originalWidth());
@ -482,7 +482,7 @@ bool CustomizedGuiManager::onProcessDevModeKeyDown(KeyMessage* msg)
if (msg->ctrlPressed() &&
msg->scancode() == kKeyF1) {
try {
she::Display* display = getDisplay();
os::Display* display = getDisplay();
int screenScale = display->scale();
int uiScale = ui::guiscale();

View File

@ -15,7 +15,7 @@
#include "app/tools/ink.h"
#include "app/tools/tool.h"
#include "doc/sprite.h"
#include "she/system.h"
#include "os/system.h"
namespace app {
@ -39,7 +39,7 @@ Preferences::Preferences()
// Hide the menu bar depending on:
// 1. the native menu bar is available
// 2. this is the first run of the program
if (she::instance()->menus() &&
if (os::instance()->menus() &&
updater.uuid().empty()) {
general.showMenuBar(false);
}

View File

@ -19,12 +19,12 @@
#include "base/scoped_lock.h"
#include "base/thread.h"
#include "doc/algorithm/rotate.h"
#include "doc/conversion_she.h"
#include "doc/conversion_to_surface.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "doc/primitives.h"
#include "doc/sprite.h"
#include "she/system.h"
#include "os/system.h"
#include <memory>
@ -59,7 +59,7 @@ private:
// Post load
m_fop->postLoad();
// Convert the loaded document into the she::Surface.
// Convert the loaded document into the os::Surface.
const Sprite* sprite =
(m_fop->document() &&
m_fop->document()->sprite() ?
@ -100,7 +100,7 @@ private:
// Set the thumbnail of the file-item.
if (m_thumbnail) {
she::Surface* thumbnail = she::instance()->createRgbaSurface(
os::Surface* thumbnail = os::instance()->createRgbaSurface(
m_thumbnail->width(),
m_thumbnail->height());

View File

@ -11,19 +11,19 @@
#include "app/thumbnails.h"
#include "doc/algorithm/resize_image.h"
#include "doc/cel.h"
#include "doc/conversion_she.h"
#include "doc/conversion_to_surface.h"
#include "doc/doc.h"
#include "doc/frame.h"
#include "doc/object.h"
#include "doc/object_id.h"
#include "render/render.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/surface.h"
#include "os/system.h"
namespace app {
namespace thumb {
she::Surface* get_cel_thumbnail(const doc::Cel* cel,
os::Surface* get_cel_thumbnail(const doc::Cel* cel,
const gfx::Size& thumb_size,
gfx::Rect cel_image_on_thumb)
{
@ -88,7 +88,7 @@ she::Surface* get_cel_thumbnail(const doc::Cel* cel,
cel_image_on_thumb.y,
255, BlendMode::NORMAL);
she::Surface* thumb_surf = she::instance()->createRgbaSurface(
os::Surface* thumb_surf = os::instance()->createRgbaSurface(
thumb_img->width(), thumb_img->height());
convert_image_to_surface(thumb_img.get(), sprite->palette(frame), thumb_surf,

View File

@ -15,14 +15,14 @@ namespace doc {
class Cel;
}
namespace she {
namespace os {
class Surface;
}
namespace app {
namespace thumb {
she::Surface* get_cel_thumbnail(const doc::Cel* cel,
os::Surface* get_cel_thumbnail(const doc::Cel* cel,
const gfx::Size& thumb_size,
gfx::Rect cel_image_on_thumb = gfx::Rect());

View File

@ -16,7 +16,7 @@
#include "app/modules/gui.h"
#include "app/ui/keyboard_shortcuts.h"
#include "app/ui_context.h"
#include "she/menus.h"
#include "os/menus.h"
#include "ui/accelerator.h"
#include "ui/menu.h"
#include "ui/message.h"
@ -66,7 +66,7 @@ void AppMenuItem::setNative(const Native& native)
void AppMenuItem::syncNativeMenuItemKeyShortcut()
{
if (m_native) {
she::Shortcut shortcut = get_os_shortcut_from_key(m_key.get());
os::Shortcut shortcut = get_os_shortcut_from_key(m_key.get());
m_native->shortcut = shortcut;
m_native->menuItem->setShortcut(shortcut);

View File

@ -10,10 +10,10 @@
#include "app/commands/params.h"
#include "app/ui/key.h"
#include "she/shortcut.h"
#include "os/shortcut.h"
#include "ui/menu.h"
namespace she {
namespace os {
class MenuItem;
}
@ -28,8 +28,8 @@ namespace app {
class AppMenuItem : public ui::MenuItem {
public:
struct Native {
she::MenuItem* menuItem = nullptr;
she::Shortcut shortcut;
os::MenuItem* menuItem = nullptr;
os::Shortcut shortcut;
app::KeyContext keyContext = app::KeyContext::Any;
};

View File

@ -19,7 +19,7 @@
#include "base/file_handle.h"
#include "base/fs.h"
#include "base/split_string.h"
#include "she/font.h"
#include "os/font.h"
#include "ui/alert.h"
#include "ui/link_label.h"
#include "ui/menu.h"

View File

@ -28,13 +28,13 @@
#include "base/bind.h"
#include "base/convert_to.h"
#include "doc/brush.h"
#include "doc/conversion_she.h"
#include "doc/conversion_to_surface.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "gfx/border.h"
#include "gfx/region.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/button.h"
#include "ui/link_label.h"
#include "ui/listitem.h"
@ -444,7 +444,7 @@ void BrushPopup::onBrushChanges()
}
// static
she::Surface* BrushPopup::createSurfaceForBrush(const BrushRef& origBrush)
os::Surface* BrushPopup::createSurfaceForBrush(const BrushRef& origBrush)
{
Image* image = nullptr;
BrushRef brush = origBrush;
@ -456,7 +456,7 @@ she::Surface* BrushPopup::createSurfaceForBrush(const BrushRef& origBrush)
image = brush->image();
}
she::Surface* surface = she::instance()->createRgbaSurface(
os::Surface* surface = os::instance()->createRgbaSurface(
std::min(10, image ? image->width(): 4),
std::min(10, image ? image->height(): 4));

View File

@ -28,7 +28,7 @@ namespace app {
m_tooltipManager = tooltipManager;
}
static she::Surface* createSurfaceForBrush(const doc::BrushRef& brush);
static os::Surface* createSurfaceForBrush(const doc::BrushRef& brush);
private:
void onStandardBrush();

View File

@ -14,7 +14,7 @@
#include "app/ui/skin/skin_theme.h"
#include "base/bind.h"
#include "gfx/color.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/box.h"
#include "ui/button.h"
#include "ui/graphics.h"
@ -145,7 +145,7 @@ void ButtonSet::Item::onPaint(ui::PaintEvent& ev)
}
if (m_icon) {
she::Surface* bmp = m_icon->bitmap(0);
os::Surface* bmp = m_icon->bitmap(0);
if (isSelected() && hasCapture())
g->drawColoredRgbaSurface(bmp, theme->colors.buttonSelectedText(),

View File

@ -61,7 +61,7 @@
#include "doc/rgbmap.h"
#include "doc/sort_palette.h"
#include "doc/sprite.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/alert.h"
#include "ui/graphics.h"
#include "ui/menu.h"

View File

@ -19,8 +19,8 @@
#include "base/concurrent_queue.h"
#include "base/scoped_value.h"
#include "base/thread.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/manager.h"
#include "ui/message.h"
#include "ui/paint_event.h"
@ -96,7 +96,7 @@ public:
}
}
she::Surface* getCanvas(int w, int h, gfx::Color bgColor) {
os::Surface* getCanvas(int w, int h, gfx::Color bgColor) {
assert_ui_thread();
if (!m_canvas ||
@ -106,7 +106,7 @@ public:
stopCurrentPainting(lock);
auto oldCanvas = m_canvas;
m_canvas = she::instance()->createSurface(w, h);
m_canvas = os::instance()->createSurface(w, h);
m_canvas->fillRect(bgColor, gfx::Rect(0, 0, w, h));
if (oldCanvas) {
m_canvas->drawSurface(oldCanvas, 0, 0);
@ -200,7 +200,7 @@ private:
std::mutex m_mutex;
std::condition_variable m_paintingCV;
std::condition_variable m_waitStopCV;
she::Surface* m_canvas;
os::Surface* m_canvas;
ColorSelector* m_colorSelector;
ui::Manager* m_manager;
gfx::Rect m_mainBounds;
@ -440,7 +440,7 @@ void ColorSelector::onPaintAlphaBar(ui::Graphics* g, const gfx::Rect& rc)
}
void ColorSelector::onPaintSurfaceInBgThread(
she::Surface* s,
os::Surface* s,
const gfx::Rect& main,
const gfx::Rect& bottom,
const gfx::Rect& alpha,
@ -466,7 +466,7 @@ void ColorSelector::paintColorIndicator(ui::Graphics* g,
const bool white)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
she::Surface* icon = theme->parts.colorWheelIndicator()->bitmap(0);
os::Surface* icon = theme->parts.colorWheelIndicator()->bitmap(0);
g->drawColoredRgbaSurface(
icon,

View File

@ -11,7 +11,7 @@
#include "app/color.h"
#include "app/ui/color_source.h"
#include "obs/signal.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/mouse_buttons.h"
#include "ui/timer.h"
#include "ui/widget.h"
@ -64,7 +64,7 @@ namespace app {
virtual app::Color getBottomBarColor(const int u, const int umax) = 0;
virtual void onPaintMainArea(ui::Graphics* g, const gfx::Rect& rc) = 0;
virtual void onPaintBottomBar(ui::Graphics* g, const gfx::Rect& rc) = 0;
virtual void onPaintSurfaceInBgThread(she::Surface* s,
virtual void onPaintSurfaceInBgThread(os::Surface* s,
const gfx::Rect& main,
const gfx::Rect& bottom,
const gfx::Rect& alpha,

View File

@ -13,7 +13,7 @@
#include "app/color_utils.h"
#include "app/ui/skin/skin_theme.h"
#include "app/ui/status_bar.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/graphics.h"
#include "ui/message.h"
#include "ui/paint_event.h"
@ -78,7 +78,7 @@ void ColorSpectrum::onPaintBottomBar(ui::Graphics* g, const gfx::Rect& rc)
}
void ColorSpectrum::onPaintSurfaceInBgThread(
she::Surface* s,
os::Surface* s,
const gfx::Rect& main,
const gfx::Rect& bottom,
const gfx::Rect& alpha,

View File

@ -22,7 +22,7 @@ namespace app {
app::Color getBottomBarColor(const int u, const int umax) override;
void onPaintMainArea(ui::Graphics* g, const gfx::Rect& rc) override;
void onPaintBottomBar(ui::Graphics* g, const gfx::Rect& rc) override;
void onPaintSurfaceInBgThread(she::Surface* s,
void onPaintSurfaceInBgThread(os::Surface* s,
const gfx::Rect& main,
const gfx::Rect& bottom,
const gfx::Rect& alpha,

View File

@ -69,7 +69,7 @@ void ColorTintShadeTone::onPaintBottomBar(ui::Graphics* g, const gfx::Rect& rc)
}
void ColorTintShadeTone::onPaintSurfaceInBgThread(
she::Surface* s,
os::Surface* s,
const gfx::Rect& main,
const gfx::Rect& bottom,
const gfx::Rect& alpha,

View File

@ -23,7 +23,7 @@ namespace app {
app::Color getBottomBarColor(const int u, const int umax) override;
void onPaintMainArea(ui::Graphics* g, const gfx::Rect& rc) override;
void onPaintBottomBar(ui::Graphics* g, const gfx::Rect& rc) override;
void onPaintSurfaceInBgThread(she::Surface* s,
void onPaintSurfaceInBgThread(os::Surface* s,
const gfx::Rect& main,
const gfx::Rect& bottom,
const gfx::Rect& alpha,

View File

@ -17,7 +17,7 @@
#include "base/bind.h"
#include "base/pi.h"
#include "filters/color_curve.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/graphics.h"
#include "ui/menu.h"
#include "ui/message.h"
@ -239,7 +239,7 @@ void ColorWheel::onPaintBottomBar(ui::Graphics* g, const gfx::Rect& rc)
}
}
void ColorWheel::onPaintSurfaceInBgThread(she::Surface* s,
void ColorWheel::onPaintSurfaceInBgThread(os::Surface* s,
const gfx::Rect& main,
const gfx::Rect& bottom,
const gfx::Rect& alpha,

View File

@ -47,7 +47,7 @@ namespace app {
app::Color getBottomBarColor(const int u, const int umax) override;
void onPaintMainArea(ui::Graphics* g, const gfx::Rect& rc) override;
void onPaintBottomBar(ui::Graphics* g, const gfx::Rect& rc) override;
void onPaintSurfaceInBgThread(she::Surface* s,
void onPaintSurfaceInBgThread(os::Surface* s,
const gfx::Rect& main,
const gfx::Rect& bottom,
const gfx::Rect& alpha,

View File

@ -40,14 +40,14 @@
#include "base/bind.h"
#include "base/scoped_value.h"
#include "doc/brush.h"
#include "doc/conversion_she.h"
#include "doc/conversion_to_surface.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "doc/remap.h"
#include "obs/connection.h"
#include "render/dithering.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/button.h"
#include "ui/combobox.h"
#include "ui/int_entry.h"

View File

@ -15,14 +15,14 @@
#include "app/modules/palettes.h"
#include "app/ui/skin/skin_theme.h"
#include "base/bind.h"
#include "doc/conversion_she.h"
#include "doc/conversion_to_surface.h"
#include "doc/image.h"
#include "doc/image_ref.h"
#include "doc/primitives.h"
#include "render/gradient.h"
#include "render/quantization.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/graphics.h"
#include "ui/listitem.h"
#include "ui/paint_event.h"
@ -66,7 +66,7 @@ public:
render::DitheringMatrix matrix() const { return m_matrix; }
private:
she::Surface* preview() {
os::Surface* preview() {
const doc::Palette* palette = get_current_palette();
ASSERT(palette);
@ -104,7 +104,7 @@ private:
m_algo, m_matrix, nullptr, palette, true, -1, nullptr);
}
m_preview = she::instance()->createRgbaSurface(w, h);
m_preview = os::instance()->createRgbaSurface(w, h);
doc::convert_image_to_surface(image2.get(), palette, m_preview,
0, 0, 0, 0, w, h);
@ -152,7 +152,7 @@ private:
bool m_matrixOnly;
render::DitheringAlgorithm m_algo;
render::DitheringMatrix m_matrix;
she::Surface* m_preview;
os::Surface* m_preview;
doc::ObjectId m_palId;
int m_palMods;
};

View File

@ -34,7 +34,7 @@
#include "doc/layer.h"
#include "doc/primitives.h"
#include "render/render.h"
#include "she/display.h"
#include "os/display.h"
#include "ui/manager.h"
#include "ui/system.h"

View File

@ -52,12 +52,12 @@
#include "base/bind.h"
#include "base/chrono.h"
#include "base/convert_to.h"
#include "doc/conversion_she.h"
#include "doc/conversion_to_surface.h"
#include "doc/doc.h"
#include "doc/mask_boundaries.h"
#include "doc/slice.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/ui.h"
#include <algorithm>
@ -641,14 +641,14 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
}
if (rendered) {
// Convert the render to a she::Surface
static she::Surface* tmp = nullptr; // TODO move this to other centralized place
// Convert the render to a os::Surface
static os::Surface* tmp = nullptr; // TODO move this to other centralized place
if (!tmp || tmp->width() < rc2.w || tmp->height() < rc2.h) {
const int maxw = std::max(rc2.w, tmp ? tmp->width(): 0);
const int maxh = std::max(rc2.h, tmp ? tmp->height(): 0);
if (tmp)
tmp->dispose();
tmp = she::instance()->createSurface(maxw, maxh);
tmp = os::instance()->createSurface(maxw, maxh);
}
if (tmp->nativeHandle()) {
if (newEngine)

View File

@ -17,7 +17,7 @@
#include "app/ui/editor/editor.h"
#include "app/ui/skin/skin_theme.h"
#include "base/bind.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/paint_event.h"
#include "ui/resize_event.h"
#include "ui/scroll_region_event.h"

View File

@ -56,8 +56,8 @@
#include "doc/sprite.h"
#include "fixmath/fixmath.h"
#include "gfx/rect.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/alert.h"
#include "ui/message.h"
#include "ui/system.h"
@ -845,7 +845,7 @@ bool StandbyState::Decorator::onSetCursor(tools::Ink* ink, Editor* editor, const
ink->isSelection() &&
editor->document()->isMaskVisible() &&
(!Preferences::instance().selection.modifiersDisableHandles() ||
she::instance()->keyModifiers() == kKeyNoneModifier)) {
os::instance()->keyModifiers() == kKeyNoneModifier)) {
auto theme = skin::SkinTheme::instance();
const Transformation transformation(m_standbyState->getTransformation(editor));
TransformHandles* tr = getTransformHandles(editor);
@ -967,7 +967,7 @@ void StandbyState::Decorator::postRenderDecorator(EditorPostRender* render)
Handles handles;
if (StandbyState::Decorator::getSymmetryHandles(editor, handles)) {
skin::SkinTheme* theme = static_cast<skin::SkinTheme*>(ui::get_theme());
she::Surface* part = theme->parts.transformationHandle()->bitmap(0);
os::Surface* part = theme->parts.transformationHandle()->bitmap(0);
ScreenGraphics g;
for (const auto& handle : handles)
g.drawRgbaSurface(part, handle.bounds.x, handle.bounds.y);
@ -998,7 +998,7 @@ bool StandbyState::Decorator::getSymmetryHandles(Editor* editor, Handles& handle
editor->canvasSize());
gfx::RectF editorViewport(View::getView(editor)->viewportBounds());
skin::SkinTheme* theme = static_cast<skin::SkinTheme*>(ui::get_theme());
she::Surface* part = theme->parts.transformationHandle()->bitmap(0);
os::Surface* part = theme->parts.transformationHandle()->bitmap(0);
if (int(mode) & int(app::gen::SymmetryMode::HORIZONTAL)) {
double pos = symmetry.xAxis();

View File

@ -14,7 +14,7 @@
#include "app/ui/editor/editor.h"
#include "app/ui/skin/skin_theme.h"
#include "base/pi.h"
#include "she/surface.h"
#include "os/surface.h"
namespace app {
@ -54,7 +54,7 @@ static struct HandlesInfo {
HandleType TransformHandles::getHandleAtPoint(Editor* editor, const gfx::Point& pt, const Transformation& transform)
{
SkinTheme* theme = SkinTheme::instance();
she::Surface* gfx = theme->parts.transformationHandle()->bitmap(0);
os::Surface* gfx = theme->parts.transformationHandle()->bitmap(0);
fixmath::fixed angle = fixmath::ftofix(128.0 * transform.angle() / PI);
Transformation::Corners corners;
@ -125,7 +125,7 @@ void TransformHandles::drawHandles(Editor* editor, const Transformation& transfo
if (visiblePivot(angle)) {
gfx::Rect pivotBounds = getPivotHandleBounds(editor, transform, corners);
SkinTheme* theme = SkinTheme::instance();
she::Surface* part = theme->parts.pivotHandle()->bitmap(0);
os::Surface* part = theme->parts.pivotHandle()->bitmap(0);
g.drawRgbaSurface(part, pivotBounds.x, pivotBounds.y);
}
@ -144,7 +144,7 @@ void TransformHandles::invalidateHandles(Editor* editor, const Transformation& t
// Invalidate each corner handle.
for (size_t c=0; c<HANDLES; ++c) {
she::Surface* part = theme->parts.transformationHandle()->bitmap(0);
os::Surface* part = theme->parts.transformationHandle()->bitmap(0);
int u = (screenPoints[handles_info[c].i1].x+screenPoints[handles_info[c].i2].x)/2;
int v = (screenPoints[handles_info[c].i1].y+screenPoints[handles_info[c].i2].y)/2;
@ -156,7 +156,7 @@ void TransformHandles::invalidateHandles(Editor* editor, const Transformation& t
// Invalidate area where the pivot is.
if (visiblePivot(angle)) {
gfx::Rect pivotBounds = getPivotHandleBounds(editor, transform, corners);
she::Surface* part = theme->parts.pivotHandle()->bitmap(0);
os::Surface* part = theme->parts.pivotHandle()->bitmap(0);
editor->invalidateRect(
gfx::Rect(pivotBounds.x, pivotBounds.y,
@ -193,7 +193,7 @@ bool TransformHandles::inHandle(const gfx::Point& pt, int x, int y, int gfx_w, i
void TransformHandles::drawHandle(Graphics* g, int x, int y, fixmath::fixed angle)
{
SkinTheme* theme = SkinTheme::instance();
she::Surface* part = theme->parts.transformationHandle()->bitmap(0);
os::Surface* part = theme->parts.transformationHandle()->bitmap(0);
adjustHandle(x, y, part->width(), part->height(), angle);

View File

@ -16,7 +16,7 @@
#include "app/ui/status_bar.h"
#include "doc/sprite.h"
#include "gfx/rect.h"
#include "she/display.h"
#include "os/display.h"
#include "ui/manager.h"
#include "ui/message.h"
#include "ui/system.h"

View File

@ -15,8 +15,8 @@
#include "app/ui/skin/skin_theme.h"
#include "base/string.h"
#include "base/time.h"
#include "she/font.h"
#include "she/surface.h"
#include "os/font.h"
#include "os/surface.h"
#include "ui/ui.h"
#include <algorithm>
@ -472,7 +472,7 @@ gfx::Rect FileList::thumbnailBounds()
!m_selected->getThumbnail())
return gfx::Rect();
she::Surface* thumbnail = m_selected->getThumbnail();
os::Surface* thumbnail = m_selected->getThumbnail();
View* view = View::getView(this);
gfx::Rect vp = view->viewportBounds();
int x = vp.x+vp.w - 2*guiscale() - thumbnail->width();

View File

@ -18,7 +18,7 @@
#include <string>
#include <vector>
namespace she {
namespace os {
class Surface;
}
@ -94,7 +94,7 @@ namespace app {
// thumbnail to generate when the m_generateThumbnailTimer ticks.
IFileItem* m_itemToGenerateThumbnail;
she::Surface* m_thumbnail;
os::Surface* m_thumbnail;
// True if this listbox accepts selecting multiple items at the
// same time.

View File

@ -22,11 +22,11 @@
#include "base/bind.h"
#include "base/fs.h"
#include "base/string.h"
#include "doc/conversion_she.h"
#include "doc/conversion_to_surface.h"
#include "doc/image.h"
#include "doc/image_ref.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/box.h"
#include "ui/button.h"
#include "ui/graphics.h"
@ -69,7 +69,7 @@ private:
if (m_image) {
Graphics* g = ev.graphics();
she::Surface* sur = she::instance()->createRgbaSurface(m_image->width(),
os::Surface* sur = os::instance()->createRgbaSurface(m_image->width(),
m_image->height());
convert_image_to_surface(

View File

@ -11,7 +11,7 @@
#include "app/ui/icon_button.h"
#include "app/ui/skin/skin_theme.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/message.h"
#include "ui/paint_event.h"
#include "ui/size_hint_event.h"
@ -37,7 +37,7 @@ void IconButton::onInitTheme(InitThemeEvent& ev)
void IconButton::onSizeHint(SizeHintEvent& ev)
{
she::Surface* icon = m_part->bitmap(0);
os::Surface* icon = m_part->bitmap(0);
ev.setSizeHint(
gfx::Size(icon->width(),
icon->height()) + 4*guiscale());
@ -65,7 +65,7 @@ void IconButton::onPaint(PaintEvent& ev)
g->fillRect(bg, g->getClipBounds());
gfx::Rect bounds = clientBounds();
she::Surface* icon = m_part->bitmap(0);
os::Surface* icon = m_part->bitmap(0);
g->drawColoredRgbaSurface(
icon, fg,
bounds.x+bounds.w/2-icon->width()/2,

View File

@ -38,8 +38,8 @@
#include "app/ui_context.h"
#include "base/bind.h"
#include "base/fs.h"
#include "she/display.h"
#include "she/system.h"
#include "os/display.h"
#include "os/system.h"
#include "ui/message.h"
#include "ui/splitter.h"
#include "ui/system.h"
@ -76,7 +76,7 @@ public:
ui::set_theme(ui::get_theme(), newUIScale);
Manager* manager = Manager::getDefault();
she::Display* display = manager->getDisplay();
os::Display* display = manager->getDisplay();
display->setScale(newScreenScale);
manager->setDisplay(display);
}
@ -352,7 +352,7 @@ void MainWindow::onResize(ui::ResizeEvent& ev)
{
app::gen::MainWindow::onResize(ev);
she::Display* display = manager()->getDisplay();
os::Display* display = manager()->getDisplay();
if ((display) &&
(display->scale()*ui::guiscale() > 2) &&
(!m_scalePanic) &&
@ -514,7 +514,7 @@ void MainWindow::configureWorkspaceLayout()
bool normal = (m_mode == NormalMode);
bool isDoc = (getDocView() != nullptr);
if (she::instance()->menus() == nullptr ||
if (os::instance()->menus() == nullptr ||
pref.general.showMenuBar()) {
if (!m_menuBar->parent())
menuBarPlaceholder()->insertChild(0, m_menuBar);

View File

@ -27,8 +27,8 @@
#include "doc/remap.h"
#include "gfx/color.h"
#include "gfx/point.h"
#include "she/font.h"
#include "she/surface.h"
#include "os/font.h"
#include "os/surface.h"
#include "ui/graphics.h"
#include "ui/manager.h"
#include "ui/message.h"
@ -525,7 +525,7 @@ void PaletteView::onPaint(ui::PaintEvent& ev)
// Handle to resize palette
if (m_editable && !dragging) {
she::Surface* handle = theme->parts.palResize()->bitmap(0);
os::Surface* handle = theme->parts.palResize()->bitmap(0);
gfx::Rect box = getPaletteEntryBounds(palSize);
g->drawRgbaSurface(handle,
box.x+box.w/2-handle->width()/2,
@ -563,7 +563,7 @@ void PaletteView::onPaint(ui::PaintEvent& ev)
gfx::Color gfxColor = drawEntry(g, box2, i); // Draw color entry
gfx::Color neg = color_utils::blackandwhite_neg(gfxColor);
she::Font* minifont = theme->getMiniFont();
os::Font* minifont = theme->getMiniFont();
std::string text = base::convert_to<std::string>(k);
g->setFont(minifont);
g->drawText(text, neg, gfx::ColorNone,

View File

@ -25,7 +25,7 @@
#include "base/launcher.h"
#include "doc/palette.h"
#include "doc/sprite.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/graphics.h"
#include "ui/listitem.h"
#include "ui/message.h"

View File

@ -11,7 +11,7 @@
#include "app/ui/search_entry.h"
#include "app/ui/skin/skin_theme.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/graphics.h"
#include "ui/message.h"
#include "ui/paint_event.h"

View File

@ -10,8 +10,8 @@
#include "app/ui/skin/font_data.h"
#include "she/font.h"
#include "she/system.h"
#include "os/font.h"
#include "os/system.h"
#include "ui/scale.h"
#include <set>
@ -19,7 +19,7 @@
namespace app {
namespace skin {
FontData::FontData(she::FontType type)
FontData::FontData(os::FontType type)
: m_type(type)
, m_antialias(false)
, m_fallback(nullptr)
@ -30,12 +30,12 @@ FontData::FontData(she::FontType type)
FontData::~FontData()
{
#if _DEBUG
static std::set<she::Font*> deletedFonts;
static std::set<os::Font*> deletedFonts;
#endif
// Destroy all fonts
for (auto& it : m_fonts) {
she::Font* font = it.second;
os::Font* font = it.second;
if (font) {
#if _DEBUG // Check that there are not double-cached fonts
auto it2 = deletedFonts.find(font);
@ -49,9 +49,9 @@ FontData::~FontData()
m_fonts.clear();
}
she::Font* FontData::getFont(int size)
os::Font* FontData::getFont(int size)
{
if (m_type == she::FontType::kSpriteSheet)
if (m_type == os::FontType::kSpriteSheet)
size = 1; // Same size always
// Use cache
@ -60,14 +60,14 @@ she::Font* FontData::getFont(int size)
if (it != m_fonts.end())
return it->second;
she::Font* font = nullptr;
os::Font* font = nullptr;
switch (m_type) {
case she::FontType::kSpriteSheet:
font = she::instance()->loadSpriteSheetFont(m_filename.c_str(), size);
case os::FontType::kSpriteSheet:
font = os::instance()->loadSpriteSheetFont(m_filename.c_str(), size);
break;
case she::FontType::kTrueType: {
font = she::instance()->loadTrueTypeFont(m_filename.c_str(), size);
case os::FontType::kTrueType: {
font = os::instance()->loadTrueTypeFont(m_filename.c_str(), size);
if (font)
font->setAntialias(m_antialias);
break;
@ -75,7 +75,7 @@ she::Font* FontData::getFont(int size)
}
if (m_fallback) {
she::Font* fallback = m_fallback->getFont(m_fallbackSize);
os::Font* fallback = m_fallback->getFont(m_fallbackSize);
if (font)
font->setFallback(fallback);
else

View File

@ -9,7 +9,7 @@
#pragma once
#include "base/disable_copying.h"
#include "she/font.h"
#include "os/font.h"
#include <map>
@ -18,7 +18,7 @@ namespace skin {
class FontData {
public:
FontData(she::FontType type);
FontData(os::FontType type);
~FontData();
void setFilename(const std::string& filename) { m_filename = filename; }
@ -28,13 +28,13 @@ namespace skin {
m_fallbackSize = fallbackSize;
}
she::Font* getFont(int size);
os::Font* getFont(int size);
private:
she::FontType m_type;
os::FontType m_type;
std::string m_filename;
bool m_antialias;
std::map<int, she::Font*> m_fonts; // key=font size, value=real font
std::map<int, os::Font*> m_fonts; // key=font size, value=real font
FontData* m_fallback;
int m_fallbackSize;

View File

@ -10,7 +10,7 @@
#include "app/ui/skin/skin_part.h"
#include "she/surface.h"
#include "os/surface.h"
namespace app {
namespace skin {
@ -34,7 +34,7 @@ void SkinPart::clear()
}
}
void SkinPart::setBitmap(std::size_t index, she::Surface* bitmap)
void SkinPart::setBitmap(std::size_t index, os::Surface* bitmap)
{
if (index >= m_bitmaps.size())
m_bitmaps.resize(index+1, nullptr);

View File

@ -14,7 +14,7 @@
#include <vector>
namespace she {
namespace os {
class Surface;
}
@ -23,7 +23,7 @@ namespace app {
class SkinPart {
public:
typedef std::vector<she::Surface*> Bitmaps;
typedef std::vector<os::Surface*> Bitmaps;
SkinPart();
~SkinPart();
@ -34,22 +34,22 @@ namespace app {
void clear();
// It doesn't destroy the previous bitmap in the given "index".
void setBitmap(std::size_t index, she::Surface* bitmap);
void setBitmap(std::size_t index, os::Surface* bitmap);
void setSpriteBounds(const gfx::Rect& bounds);
void setSlicesBounds(const gfx::Rect& bounds);
she::Surface* bitmap(std::size_t index) const {
os::Surface* bitmap(std::size_t index) const {
return (index < m_bitmaps.size() ? m_bitmaps[index]: nullptr);
}
she::Surface* bitmapNW() const { return bitmap(0); }
she::Surface* bitmapN() const { return bitmap(1); }
she::Surface* bitmapNE() const { return bitmap(2); }
she::Surface* bitmapE() const { return bitmap(3); }
she::Surface* bitmapSE() const { return bitmap(4); }
she::Surface* bitmapS() const { return bitmap(5); }
she::Surface* bitmapSW() const { return bitmap(6); }
she::Surface* bitmapW() const { return bitmap(7); }
os::Surface* bitmapNW() const { return bitmap(0); }
os::Surface* bitmapN() const { return bitmap(1); }
os::Surface* bitmapNE() const { return bitmap(2); }
os::Surface* bitmapE() const { return bitmap(3); }
os::Surface* bitmapSE() const { return bitmap(4); }
os::Surface* bitmapS() const { return bitmap(5); }
os::Surface* bitmapSW() const { return bitmap(6); }
os::Surface* bitmapW() const { return bitmap(7); }
gfx::Size size() const;

View File

@ -33,10 +33,10 @@
#include "gfx/point.h"
#include "gfx/rect.h"
#include "gfx/size.h"
#include "she/draw_text.h"
#include "she/font.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/draw_text.h"
#include "os/font.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/intern.h"
#include "ui/ui.h"
@ -113,7 +113,7 @@ static FontData* load_font(std::map<std::string, FontData*>& fonts,
if (type == "spritesheet") {
const char* fileStr = xmlFont->Attribute("file");
if (fileStr) {
font.reset(new FontData(she::FontType::kSpriteSheet));
font.reset(new FontData(os::FontType::kSpriteSheet));
font->setFilename(base::join_path(xmlDir, fileStr));
}
}
@ -143,7 +143,7 @@ static FontData* load_font(std::map<std::string, FontData*>& fonts,
// The filename can be empty if the font was not found, anyway we
// want to keep the font information (e.g. to use the fallback
// information of this font).
font.reset(new FontData(she::FontType::kTrueType));
font.reset(new FontData(os::FontType::kTrueType));
font->setFilename(fontFilename);
font->setAntialias(antialias);
@ -282,9 +282,9 @@ void SkinTheme::loadSheet()
{
// Load the skin sheet
std::string sheet_filename(base::join_path(m_path, "sheet.png"));
she::Surface* newSheet = nullptr;
os::Surface* newSheet = nullptr;
try {
newSheet = she::instance()->loadRgbaSurface(sheet_filename.c_str());
newSheet = os::instance()->loadRgbaSurface(sheet_filename.c_str());
}
catch (...) {
// Ignore the error, newSheet is nullptr and we will throw our own
@ -303,7 +303,7 @@ void SkinTheme::loadSheet()
m_sheet->applyScale(guiscale());
// Reset sprite sheet and font of all layer styles (to avoid
// dangling pointers to she::Surface or she::Font).
// dangling pointers to os::Surface or os::Font).
for (auto& it : m_styles) {
for (auto& layer : it.second->layers()) {
layer.setIcon(nullptr);
@ -357,7 +357,7 @@ void SkinTheme::loadXml()
if (sizeStr)
size = std::strtol(sizeStr, nullptr, 10);
she::Font* font = fontData->getFont(size);
os::Font* font = fontData->getFont(size);
m_themeFonts[idStr] = font;
if (id == "default")
@ -474,7 +474,7 @@ void SkinTheme::loadXml()
}
// TODO share the Surface with the SkinPart
she::Surface* slice = sliceSheet(nullptr, gfx::Rect(x, y, w, h));
os::Surface* slice = sliceSheet(nullptr, gfx::Rect(x, y, w, h));
Cursor* cursor =
new Cursor(slice, gfx::Point(focusx, focusy));
m_cursors[cursorName] = cursor;
@ -571,7 +571,7 @@ void SkinTheme::loadXml()
{
const char* fontId = xmlStyle->Attribute("font");
if (fontId) {
she::Font* font = m_themeFonts[fontId];
os::Font* font = m_themeFonts[fontId];
style->setFont(font);
}
}
@ -700,7 +700,7 @@ void SkinTheme::loadXml()
ThemeFile<SkinTheme>::updateInternals();
}
she::Surface* SkinTheme::sliceSheet(she::Surface* sur, const gfx::Rect& bounds)
os::Surface* SkinTheme::sliceSheet(os::Surface* sur, const gfx::Rect& bounds)
{
if (sur && (sur->width() != bounds.w ||
sur->height() != bounds.h)) {
@ -710,10 +710,10 @@ she::Surface* SkinTheme::sliceSheet(she::Surface* sur, const gfx::Rect& bounds)
if (!bounds.isEmpty()) {
if (!sur)
sur = she::instance()->createRgbaSurface(bounds.w, bounds.h);
sur = os::instance()->createRgbaSurface(bounds.w, bounds.h);
she::SurfaceLock lockSrc(m_sheet);
she::SurfaceLock lockDst(sur);
os::SurfaceLock lockSrc(m_sheet);
os::SurfaceLock lockDst(sur);
m_sheet->blitTo(sur, bounds.x, bounds.y, 0, 0, bounds.w, bounds.h);
}
else {
@ -723,7 +723,7 @@ she::Surface* SkinTheme::sliceSheet(she::Surface* sur, const gfx::Rect& bounds)
return sur;
}
she::Font* SkinTheme::getWidgetFont(const Widget* widget) const
os::Font* SkinTheme::getWidgetFont(const Widget* widget) const
{
SkinPropertyPtr skinPropery = widget->getProperty(SkinProperty::Name);
if (skinPropery && skinPropery->hasMiniFont())
@ -934,7 +934,7 @@ int SkinTheme::getScrollbarSize()
gfx::Size SkinTheme::getEntryCaretSize(Widget* widget)
{
if (widget->font()->type() == she::FontType::kTrueType)
if (widget->font()->type() == os::FontType::kTrueType)
return gfx::Size(2*guiscale(), widget->textHeight());
else
return gfx::Size(2*guiscale(), widget->textHeight()+2*guiscale());
@ -964,7 +964,7 @@ void SkinTheme::paintEntry(PaintEvent& ev)
namespace {
class DrawEntryTextDelegate : public she::DrawTextDelegate {
class DrawEntryTextDelegate : public os::DrawTextDelegate {
public:
DrawEntryTextDelegate(Entry* widget, Graphics* graphics,
const gfx::Point& pos, const int h)
@ -1165,7 +1165,7 @@ void SkinTheme::paintMenuItem(ui::PaintEvent& ev)
// Draw an indicator for selected items
if (widget->isSelected()) {
she::Surface* icon =
os::Surface* icon =
(widget->isEnabled() ?
parts.checkSelected()->bitmap(0):
parts.checkDisabled()->bitmap(0));
@ -1270,7 +1270,7 @@ void SkinTheme::paintSlider(PaintEvent& ev)
// Draw customized background
if (bgPainter) {
SkinPartPtr nw = parts.miniSliderEmpty();
she::Surface* thumb =
os::Surface* thumb =
(widget->hasFocus() ? parts.miniSliderThumbFocused()->bitmap(0):
parts.miniSliderThumb()->bitmap(0));
@ -1487,7 +1487,7 @@ SkinPartPtr SkinTheme::getToolPart(const char* toolId) const
return getPartById(std::string("tool_") + toolId);
}
she::Surface* SkinTheme::getToolIcon(const char* toolId) const
os::Surface* SkinTheme::getToolIcon(const char* toolId) const
{
SkinPartPtr part = getToolPart(toolId);
if (part)
@ -1497,9 +1497,9 @@ she::Surface* SkinTheme::getToolIcon(const char* toolId) const
}
void SkinTheme::drawRect(Graphics* g, const Rect& rc,
she::Surface* nw, she::Surface* n, she::Surface* ne,
she::Surface* e, she::Surface* se, she::Surface* s,
she::Surface* sw, she::Surface* w)
os::Surface* nw, os::Surface* n, os::Surface* ne,
os::Surface* e, os::Surface* se, os::Surface* s,
os::Surface* sw, os::Surface* w)
{
int x, y;

View File

@ -26,7 +26,7 @@ namespace ui {
class Graphics;
}
namespace she {
namespace os {
class Surface;
}
@ -51,9 +51,9 @@ namespace app {
int preferredScreenScaling() { return m_preferredScreenScaling; }
int preferredUIScaling() { return m_preferredUIScaling; }
she::Font* getDefaultFont() const override { return m_defaultFont; }
she::Font* getWidgetFont(const ui::Widget* widget) const override;
she::Font* getMiniFont() const { return m_miniFont; }
os::Font* getDefaultFont() const override { return m_defaultFont; }
os::Font* getWidgetFont(const ui::Widget* widget) const override;
os::Font* getMiniFont() const { return m_miniFont; }
ui::Cursor* getStandardCursor(ui::CursorType type) override;
void initWidget(ui::Widget* widget) override;
@ -73,13 +73,13 @@ namespace app {
int get_button_selected_offset() const { return 0; } // TODO Configurable in xml
SkinPartPtr getToolPart(const char* toolId) const;
she::Surface* getToolIcon(const char* toolId) const;
os::Surface* getToolIcon(const char* toolId) const;
// Helper functions to draw bounds/hlines with sheet parts
void drawRect(ui::Graphics* g, const gfx::Rect& rc,
she::Surface* nw, she::Surface* n, she::Surface* ne,
she::Surface* e, she::Surface* se, she::Surface* s,
she::Surface* sw, she::Surface* w);
os::Surface* nw, os::Surface* n, os::Surface* ne,
os::Surface* e, os::Surface* se, os::Surface* s,
os::Surface* sw, os::Surface* w);
void drawRect(ui::Graphics* g, const gfx::Rect& rc, SkinPart* skinPart, const bool drawCenter = true);
void drawRect2(ui::Graphics* g, const gfx::Rect& rc, int x_mid, SkinPart* nw1, SkinPart* nw2);
void drawHline(ui::Graphics* g, const gfx::Rect& rc, SkinPart* skinPart);
@ -137,7 +137,7 @@ namespace app {
void loadSheet();
void loadXml();
she::Surface* sliceSheet(she::Surface* sur, const gfx::Rect& bounds);
os::Surface* sliceSheet(os::Surface* sur, const gfx::Rect& bounds);
gfx::Color getWidgetBgColor(ui::Widget* widget);
void drawText(ui::Graphics* g, const char *t, gfx::Color fg_color, gfx::Color bg_color,
ui::Widget* widget, const gfx::Rect& rc,
@ -147,7 +147,7 @@ namespace app {
std::string findThemePath(const std::string& themeId) const;
std::string m_path;
she::Surface* m_sheet;
os::Surface* m_sheet;
std::map<std::string, SkinPartPtr> m_parts_by_id;
std::map<std::string, gfx::Color> m_colors_by_id;
std::map<std::string, int> m_dimensions_by_id;
@ -155,9 +155,9 @@ namespace app {
std::vector<ui::Cursor*> m_standardCursors;
std::map<std::string, ui::Style*> m_styles;
std::map<std::string, FontData*> m_fonts;
std::map<std::string, she::Font*> m_themeFonts;
she::Font* m_defaultFont;
she::Font* m_miniFont;
std::map<std::string, os::Font*> m_themeFonts;
os::Font* m_defaultFont;
os::Font* m_miniFont;
int m_preferredScreenScaling;
int m_preferredUIScaling;
};

View File

@ -40,8 +40,8 @@
#include "doc/layer.h"
#include "doc/sprite.h"
#include "gfx/size.h"
#include "she/font.h"
#include "she/surface.h"
#include "os/font.h"
#include "os/surface.h"
#include "ui/ui.h"
#include <algorithm>
@ -144,7 +144,7 @@ class StatusBar::Indicators : public HBox {
gfx::Color textColor = theme->colors.statusBarText();
Rect rc = clientBounds();
Graphics* g = ev.graphics();
she::Surface* icon = m_part->bitmap(0);
os::Surface* icon = m_part->bitmap(0);
g->fillRect(bgColor(), rc);
if (m_colored)

View File

@ -14,9 +14,9 @@
#include "app/modules/gui.h"
#include "app/ui/editor/editor_view.h"
#include "app/ui/skin/skin_theme.h"
#include "she/font.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/font.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/intern.h"
#include "ui/ui.h"
@ -921,12 +921,12 @@ void Tabs::createFloatingOverlay(Tab* tab)
{
ASSERT(!m_floatingOverlay);
she::Surface* surface = she::instance()->createRgbaSurface(
os::Surface* surface = os::instance()->createRgbaSurface(
tab->width, m_tabsHeight);
// Fill the surface with pink color
{
she::SurfaceLock lock(surface);
os::SurfaceLock lock(surface);
surface->fillRect(gfx::rgba(0, 0, 0, 0), gfx::Rect(0, 0, surface->width(), surface->height()));
}
{

View File

@ -49,9 +49,9 @@
#include "doc/frame_tag.h"
#include "gfx/point.h"
#include "gfx/rect.h"
#include "she/font.h"
#include "she/surface.h"
#include "she/system.h"
#include "os/font.h"
#include "os/surface.h"
#include "os/system.h"
#include "ui/scroll_helper.h"
#include "ui/ui.h"
@ -624,7 +624,7 @@ bool Timeline::onProcessMessage(Message* msg)
break;
if (mouseMsg->middle() ||
she::instance()->isKeyPressed(kKeySpace)) {
os::instance()->isKeyPressed(kKeySpace)) {
captureMouse();
m_state = STATE_SCROLLING;
m_oldPos = static_cast<MouseMessage*>(msg)->position();
@ -2201,7 +2201,7 @@ void Timeline::drawCel(ui::Graphics* g, layer_t layerIndex, frame_t frame, Cel*
skinTheme()->calcBorder(this, style));
if (!thumb_bounds.isEmpty()) {
she::Surface* thumb_surf = thumb::get_cel_thumbnail(cel, thumb_bounds.size());
os::Surface* thumb_surf = thumb::get_cel_thumbnail(cel, thumb_bounds.size());
if (thumb_surf) {
g->drawRgbaSurface(thumb_surf, thumb_bounds.x, thumb_bounds.y);
thumb_surf->dispose();
@ -2311,7 +2311,7 @@ void Timeline::drawCelOverlay(ui::Graphics* g)
(int)(image->height() * scale)
);
she::Surface* overlay_surf = thumb::get_cel_thumbnail(cel, overlay_size, cel_image_on_overlay);
os::Surface* overlay_surf = thumb::get_cel_thumbnail(cel, overlay_size, cel_image_on_overlay);
g->drawRgbaSurface(overlay_surf,
m_thumbnailsOverlayInner.x, m_thumbnailsOverlayInner.y);

View File

@ -28,7 +28,7 @@
#include "fmt/format.h"
#include "gfx/size.h"
#include "obs/signal.h"
#include "she/surface.h"
#include "os/surface.h"
#include "ui/ui.h"
#include <string>
@ -67,7 +67,7 @@ private:
static Size getToolIconSize(Widget* widget)
{
SkinTheme* theme = static_cast<SkinTheme*>(widget->theme());
she::Surface* icon = theme->getToolIcon("configuration");
os::Surface* icon = theme->getToolIcon("configuration");
if (icon)
return Size(icon->width(), icon->height());
else
@ -321,7 +321,7 @@ void ToolBar::onPaint(ui::PaintEvent& ev)
theme->drawRect(g, toolrc, nw.get());
// Draw the tool icon
she::Surface* icon = theme->getToolIcon(tool->getId().c_str());
os::Surface* icon = theme->getToolIcon(tool->getId().c_str());
if (icon) {
g->drawRgbaSurface(icon,
toolrc.x+toolrc.w/2-icon->width()/2,
@ -340,7 +340,7 @@ void ToolBar::onPaint(ui::PaintEvent& ev)
(isHot ? theme->parts.toolbuttonHot().get():
theme->parts.toolbuttonLast().get()));
she::Surface* icon = theme->getToolIcon("minieditor");
os::Surface* icon = theme->getToolIcon("minieditor");
if (icon) {
g->drawRgbaSurface(icon,
toolrc.x+toolrc.w/2-icon->width()/2,
@ -722,7 +722,7 @@ void ToolBar::ToolStrip::onPaint(PaintEvent& ev)
theme->drawRect(g, toolrc, nw.get());
// Draw the tool icon
she::Surface* icon = theme->getToolIcon(tool->getId().c_str());
os::Surface* icon = theme->getToolIcon(tool->getId().c_str());
if (icon) {
g->drawRgbaSurface(
icon,

View File

@ -36,7 +36,7 @@ namespace app {
ClipboardPaletteEntries,
};
// TODO Horrible API: refactor it (maybe a merge with she::clipboard).
// TODO Horrible API: refactor it (maybe a merge with os::clipboard).
class ClipboardManager : public ui::ClipboardDelegate {
public:

View File

@ -20,8 +20,8 @@
#include "doc/mask_io.h"
#include "doc/palette_io.h"
#include "gfx/size.h"
#include "she/display.h"
#include "she/system.h"
#include "os/display.h"
#include "os/system.h"
#include "ui/alert.h"
#include <sstream>
@ -37,7 +37,7 @@ namespace {
clip::format custom_image_format = 0;
void* native_display_handle() {
return she::instance()->defaultDisplay()->nativeHandle();
return os::instance()->defaultDisplay()->nativeHandle();
}
void custom_error_handler(clip::ErrorCode code) {

View File

@ -30,7 +30,7 @@
#include "base/exception.h"
#include "base/fs.h"
#include "base/memory.h"
#include "she/system.h"
#include "os/system.h"
#include "ui/ui.h"
#include "tinyxml.h"
@ -494,7 +494,7 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
throw base::Exception("File %s not found", file);
try {
she::Surface* sur = she::instance()->loadRgbaSurface(rf.filename().c_str());
os::Surface* sur = os::instance()->loadRgbaSurface(rf.filename().c_str());
widget = new ImageView(sur, 0, true);
}
catch (...) {

View File

@ -29,7 +29,7 @@ add_library(doc-lib
cel_io.cpp
cels_range.cpp
compressed_image.cpp
conversion_she.cpp
conversion_to_surface.cpp
document.cpp
file/col_file.cpp
file/gpl_file.cpp
@ -67,10 +67,10 @@ add_library(doc-lib
subobjects_io.cpp
user_data_io.cpp)
# TODO Remove 'she' as dependency and move conversion_she.cpp/h files
# TODO Remove 'os' as dependency and move conversion_to_surface.cpp/h files
# to other library/layer (render-lib? new conversion-lib?)
target_link_libraries(doc-lib
she
os-lib
gfx-lib
fixmath-lib
laf-base)

View File

@ -8,7 +8,7 @@
#include "config.h"
#endif
#include "doc/conversion_she.h"
#include "doc/conversion_to_surface.h"
#include "base/24bits.h"
#include "doc/algo.h"
@ -16,8 +16,8 @@
#include "doc/image_impl.h"
#include "doc/palette.h"
#include "doc/rgbmap.h"
#include "she/surface.h"
#include "she/surface_format.h"
#include "os/surface.h"
#include "os/surface_format.h"
#include <algorithm>
#include <stdexcept>
@ -26,14 +26,14 @@ namespace doc {
namespace {
template<typename ImageTraits, she::SurfaceFormat format>
uint32_t convert_color_to_surface(color_t color, const Palette* palette, const she::SurfaceFormatData* fd) {
template<typename ImageTraits, os::SurfaceFormat format>
uint32_t convert_color_to_surface(color_t color, const Palette* palette, const os::SurfaceFormatData* fd) {
static_assert(false && sizeof(ImageTraits), "Invalid color conversion");
return 0;
}
template<>
uint32_t convert_color_to_surface<RgbTraits, she::kRgbaSurfaceFormat>(color_t c, const Palette* palette, const she::SurfaceFormatData* fd) {
uint32_t convert_color_to_surface<RgbTraits, os::kRgbaSurfaceFormat>(color_t c, const Palette* palette, const os::SurfaceFormatData* fd) {
return
((rgba_getr(c) << fd->redShift ) & fd->redMask ) |
((rgba_getg(c) << fd->greenShift) & fd->greenMask) |
@ -42,7 +42,7 @@ uint32_t convert_color_to_surface<RgbTraits, she::kRgbaSurfaceFormat>(color_t c,
}
template<>
uint32_t convert_color_to_surface<GrayscaleTraits, she::kRgbaSurfaceFormat>(color_t c, const Palette* palette, const she::SurfaceFormatData* fd) {
uint32_t convert_color_to_surface<GrayscaleTraits, os::kRgbaSurfaceFormat>(color_t c, const Palette* palette, const os::SurfaceFormatData* fd) {
return
((graya_getv(c) << fd->redShift ) & fd->redMask ) |
((graya_getv(c) << fd->greenShift) & fd->greenMask) |
@ -51,7 +51,7 @@ uint32_t convert_color_to_surface<GrayscaleTraits, she::kRgbaSurfaceFormat>(colo
}
template<>
uint32_t convert_color_to_surface<IndexedTraits, she::kRgbaSurfaceFormat>(color_t c0, const Palette* palette, const she::SurfaceFormatData* fd) {
uint32_t convert_color_to_surface<IndexedTraits, os::kRgbaSurfaceFormat>(color_t c0, const Palette* palette, const os::SurfaceFormatData* fd) {
color_t c = palette->getEntry(c0);
return
((rgba_getr(c) << fd->redShift ) & fd->redMask ) |
@ -61,7 +61,7 @@ uint32_t convert_color_to_surface<IndexedTraits, she::kRgbaSurfaceFormat>(color_
}
template<>
uint32_t convert_color_to_surface<BitmapTraits, she::kRgbaSurfaceFormat>(color_t c0, const Palette* palette, const she::SurfaceFormatData* fd) {
uint32_t convert_color_to_surface<BitmapTraits, os::kRgbaSurfaceFormat>(color_t c0, const Palette* palette, const os::SurfaceFormatData* fd) {
color_t c = palette->getEntry(c0);
return
((rgba_getr(c) << fd->redShift ) & fd->redMask ) |
@ -71,8 +71,8 @@ uint32_t convert_color_to_surface<BitmapTraits, she::kRgbaSurfaceFormat>(color_t
}
template<typename ImageTraits, typename AddressType>
void convert_image_to_surface_templ(const Image* image, she::Surface* dst,
int src_x, int src_y, int dst_x, int dst_y, int w, int h, const Palette* palette, const she::SurfaceFormatData* fd)
void convert_image_to_surface_templ(const Image* image, os::Surface* dst,
int src_x, int src_y, int dst_x, int dst_y, int w, int h, const Palette* palette, const os::SurfaceFormatData* fd)
{
const LockImageBits<ImageTraits> bits(image, gfx::Rect(src_x, src_y, w, h));
typename LockImageBits<ImageTraits>::const_iterator src_it = bits.begin();
@ -85,7 +85,7 @@ void convert_image_to_surface_templ(const Image* image, she::Surface* dst,
for (int u=0; u<w; ++u) {
ASSERT(src_it != src_end);
*dst_address = convert_color_to_surface<ImageTraits, she::kRgbaSurfaceFormat>(*src_it, palette, fd);
*dst_address = convert_color_to_surface<ImageTraits, os::kRgbaSurfaceFormat>(*src_it, palette, fd);
++dst_address;
++src_it;
}
@ -105,8 +105,8 @@ struct Address24bpp
};
template<typename ImageTraits>
void convert_image_to_surface_selector(const Image* image, she::Surface* surface,
int src_x, int src_y, int dst_x, int dst_y, int w, int h, const Palette* palette, const she::SurfaceFormatData* fd)
void convert_image_to_surface_selector(const Image* image, os::Surface* surface,
int src_x, int src_y, int dst_x, int dst_y, int w, int h, const Palette* palette, const os::SurfaceFormatData* fd)
{
switch (fd->bitsPerPixel) {
@ -132,7 +132,7 @@ void convert_image_to_surface_selector(const Image* image, she::Surface* surface
} // anonymous namespace
void convert_image_to_surface(const Image* image, const Palette* palette,
she::Surface* surface, int src_x, int src_y, int dst_x, int dst_y, int w, int h)
os::Surface* surface, int src_x, int src_y, int dst_x, int dst_y, int w, int h)
{
gfx::Rect srcBounds(src_x, src_y, w, h);
srcBounds = srcBounds.createIntersection(image->bounds());
@ -156,8 +156,8 @@ void convert_image_to_surface(const Image* image, const Palette* palette,
w = dstBounds.w;
h = dstBounds.h;
she::SurfaceLock lockDst(surface);
she::SurfaceFormatData fd;
os::SurfaceLock lockDst(surface);
os::SurfaceFormatData fd;
surface->getFormat(&fd);
switch (image->pixelFormat()) {

View File

@ -4,11 +4,11 @@
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef DOC_CONVERSION_SHE_H_INCLUDED
#define DOC_CONVERSION_SHE_H_INCLUDED
#ifndef DOC_CONVERSION_TO_SURFACE_H_INCLUDED
#define DOC_CONVERSION_TO_SURFACE_H_INCLUDED
#pragma once
namespace she {
namespace os {
class Surface;
}
@ -17,7 +17,7 @@ namespace doc {
class Palette;
void convert_image_to_surface(const Image* image, const Palette* palette,
she::Surface* surface,
os::Surface* surface,
int src_x, int src_y, int dst_x, int dst_y, int w, int h);
} // namespace doc

View File

@ -17,9 +17,9 @@
#include "base/memory.h"
#include "base/memory_dump.h"
#include "base/system_console.h"
#include "she/error.h"
#include "she/scoped_handle.h"
#include "she/system.h"
#include "os/error.h"
#include "os/scoped_handle.h"
#include "os/system.h"
#include <clocale>
#include <cstdlib>
@ -45,7 +45,7 @@ namespace {
}
// Aseprite entry point. (Called from she library.)
// Aseprite entry point. (Called from "os" library.)
int app_main(int argc, char* argv[])
{
// Initialize the locale. Aseprite isn't ready to handle numeric
@ -66,7 +66,7 @@ int app_main(int argc, char* argv[])
MemLeak memleak;
base::SystemConsole systemConsole;
app::AppOptions options(argc, const_cast<const char**>(argv));
she::ScopedHandle<she::System> system(she::create_system());
os::ScopedHandle<os::System> system(os::create_system());
app::App app;
// Change the name of the memory dump file
@ -86,7 +86,7 @@ int app_main(int argc, char* argv[])
}
catch (std::exception& e) {
std::cerr << e.what() << '\n';
she::error_message(e.what());
os::error_message(e.what());
return 1;
}
}

View File

@ -1,4 +1,4 @@
# SHE
# LAF OS
# Copyright (C) 2012-2018 David Capello
# TODO the following variables should be available through options
@ -7,7 +7,7 @@
# - USE_SKIA_BACKEND
# - WITH_GTK_FILE_DIALOG_SUPPORT
set(SHE_SOURCES
set(OS_SOURCES
common/freetype_font.cpp
draw_text.cpp
system.cpp)
@ -85,13 +85,13 @@ if(USE_SKIA_BACKEND)
${SKIA_OPENGL_LIBRARY}
CACHE INTERNAL "Skia libraries")
list(APPEND SHE_SOURCES
list(APPEND OS_SOURCES
skia/skia_display.cpp
skia/skia_surface.cpp
skia/she.cpp)
skia/os.cpp)
if(WIN32)
list(APPEND SHE_SOURCES
list(APPEND OS_SOURCES
skia/skia_window_win.cpp
win/keys.cpp
win/pen.cpp
@ -99,7 +99,7 @@ if(USE_SKIA_BACKEND)
win/window.cpp
win/window_dde.cpp)
elseif(APPLE)
list(APPEND SHE_SOURCES
list(APPEND OS_SOURCES
osx/app.mm
osx/app_delegate.mm
osx/event_queue.mm
@ -108,7 +108,7 @@ if(USE_SKIA_BACKEND)
osx/window.mm
skia/skia_window_osx.mm)
else()
list(APPEND SHE_SOURCES
list(APPEND OS_SOURCES
skia/skia_window_x11.cpp
x11/event_queue.cpp
x11/keys.cpp
@ -121,19 +121,19 @@ endif()
# None backend
if(USE_NONE_BACKEND)
list(APPEND SHE_SOURCES
none/she.cpp)
list(APPEND OS_SOURCES
none/os.cpp)
endif()
######################################################################
if(WIN32)
list(APPEND SHE_SOURCES
list(APPEND OS_SOURCES
win/native_dialogs.cpp)
endif()
if(APPLE)
list(APPEND SHE_SOURCES
list(APPEND OS_SOURCES
osx/logger.mm
osx/menus.mm
osx/native_dialogs.mm)
@ -147,29 +147,29 @@ if(WITH_GTK_FILE_DIALOG_SUPPORT AND UNIX AND NOT APPLE AND NOT BEOS)
link_directories(${GTK_LIBRARY_DIRS})
add_definitions(-DASEPRITE_WITH_GTK_FILE_DIALOG_SUPPORT)
list(APPEND SHE_SOURCES
list(APPEND OS_SOURCES
gtk/native_dialogs.cpp)
endif()
add_library(she ${SHE_SOURCES})
add_library(os-lib ${OS_SOURCES})
target_link_libraries(she
target_link_libraries(os-lib
ft-lib
gfx-lib
laf-base
${FREETYPE_LIBRARIES})
if(USE_SKIA_BACKEND)
target_link_libraries(she
target_link_libraries(os-lib
${SKIA_LIBRARIES}
${X11_LIBRARIES})
if(UNIX AND NOT APPLE)
target_link_libraries(she fontconfig Xcursor)
target_link_libraries(os-lib fontconfig Xcursor)
endif()
endif()
if(WITH_GTK_FILE_DIALOG_SUPPORT)
target_link_libraries(she
target_link_libraries(os-lib
${GTKMM_LIBRARIES})
endif()

View File

@ -1,4 +1,4 @@
Copyright (c) 2012-2017 David Capello
Copyright (c) 2012-2018 David Capello
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

8
src/os/README.md Normal file
View File

@ -0,0 +1,8 @@
# LAF OS Library
`os` is an abstraction layer to access in different way the Operating
System graphics interface. We have our own implementation to create
windows and handle mouse/keyboard input. The graphics are rendered
using the [Skia](https://skia.org/) library.
* Minimum Windows platform: Windows Vista

View File

@ -1,14 +1,14 @@
// SHE library
// Copyright (C) 2012-2013, 2015 David Capello
// LAF OS Library
// Copyright (C) 2012-2015 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_CAPABILITIES_H_INCLUDED
#define SHE_CAPABILITIES_H_INCLUDED
#ifndef OS_CAPABILITIES_H_INCLUDED
#define OS_CAPABILITIES_H_INCLUDED
#pragma once
namespace she {
namespace os {
enum class Capabilities {
MultipleDisplays = 1,
@ -18,6 +18,6 @@ namespace she {
GpuAccelerationSwitch = 16
};
} // namespace she
} // namespace os
#endif

View File

@ -1,16 +1,16 @@
// SHE library
// LAF OS Library
// Copyright (C) 2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_COMMON_FILE_DIALOG_H
#define SHE_COMMON_FILE_DIALOG_H
#ifndef OS_COMMON_FILE_DIALOG_H
#define OS_COMMON_FILE_DIALOG_H
#pragma once
#include "she/native_dialogs.h"
#include "os/native_dialogs.h"
namespace she {
namespace os {
class CommonFileDialog : public FileDialog {
public:
@ -48,6 +48,6 @@ protected:
std::vector<std::pair<std::string, std::string>> m_filters;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,4 +1,4 @@
// SHE library
// LAF OS Library
// Copyright (C) 2016-2017 David Capello
//
// This file is released under the terms of the MIT license.
@ -8,14 +8,14 @@
#include "config.h"
#endif
#include "she/common/freetype_font.h"
#include "os/common/freetype_font.h"
#include "base/string.h"
#include "ft/algorithm.h"
#include "gfx/point.h"
#include "gfx/size.h"
namespace she {
namespace os {
FreeTypeFont::FreeTypeFont(ft::Lib& lib,
const char* filename,
@ -87,4 +87,4 @@ FreeTypeFont* load_free_type_font(ft::Lib& lib,
return font;
}
} // namespace she
} // namespace os

View File

@ -1,18 +1,18 @@
// SHE library
// LAF OS Library
// Copyright (C) 2016-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_COMMON_FREETYPE_FONT_H_INCLUDED
#define SHE_COMMON_FREETYPE_FONT_H_INCLUDED
#ifndef OS_COMMON_FREETYPE_FONT_H_INCLUDED
#define OS_COMMON_FREETYPE_FONT_H_INCLUDED
#pragma once
#include "ft/hb_face.h"
#include "ft/lib.h"
#include "she/font.h"
#include "os/font.h"
namespace she {
namespace os {
class Font;
class FreeTypeFont : public Font {
@ -44,6 +44,6 @@ namespace she {
const char* filename,
const int height);
} // namespace she
} // namespace os
#endif

View File

@ -1,18 +1,18 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_COMMON_GENERIC_SURFACE_H
#define SHE_COMMON_GENERIC_SURFACE_H
#ifndef OS_COMMON_GENERIC_SURFACE_H
#define OS_COMMON_GENERIC_SURFACE_H
#pragma once
#include "gfx/clip.h"
#include "gfx/color.h"
#include "she/surface.h"
#include "os/surface.h"
namespace she {
namespace os {
namespace {
@ -92,6 +92,6 @@ public:
}
};
} // namespace she
} // namespace os
#endif

View File

@ -1,22 +1,22 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_SPRITE_SHEET_FONT_H
#define SHE_SPRITE_SHEET_FONT_H
#ifndef OS_SPRITE_SHEET_FONT_H
#define OS_SPRITE_SHEET_FONT_H
#pragma once
#include "base/debug.h"
#include "base/string.h"
#include "gfx/rect.h"
#include "she/font.h"
#include "she/surface.h"
#include "os/font.h"
#include "os/surface.h"
#include <vector>
namespace she {
namespace os {
class SpriteSheetFont : public Font {
public:
@ -133,6 +133,6 @@ private:
std::vector<gfx::Rect> m_chars;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,33 +1,33 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2018 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_COMMON_SYSTEM_H
#define SHE_COMMON_SYSTEM_H
#ifndef OS_COMMON_SYSTEM_H
#define OS_COMMON_SYSTEM_H
#pragma once
#ifdef _WIN32
#include "she/win/native_dialogs.h"
#include "os/win/native_dialogs.h"
#elif defined(__APPLE__)
#include "she/osx/menus.h"
#include "she/osx/native_dialogs.h"
#include "os/osx/menus.h"
#include "os/osx/native_dialogs.h"
#elif defined(ASEPRITE_WITH_GTK_FILE_DIALOG_SUPPORT) && defined(__linux__)
#include "she/gtk/native_dialogs.h"
#include "os/gtk/native_dialogs.h"
#else
#include "she/native_dialogs.h"
#include "os/native_dialogs.h"
#endif
#include "ft/lib.h"
#include "she/common/freetype_font.h"
#include "she/common/sprite_sheet_font.h"
#include "she/menus.h"
#include "she/system.h"
#include "os/common/freetype_font.h"
#include "os/common/sprite_sheet_font.h"
#include "os/menus.h"
#include "os/system.h"
#include <memory>
namespace she {
namespace os {
#ifdef __APPLE__
Logger* getOsxLogger();
@ -134,6 +134,6 @@ private:
std::unique_ptr<ft::Lib> m_ft;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,21 +1,21 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2018 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_DISPLAY_H_INCLUDED
#define SHE_DISPLAY_H_INCLUDED
#ifndef OS_DISPLAY_H_INCLUDED
#define OS_DISPLAY_H_INCLUDED
#pragma once
#include "gfx/point.h"
#include "she/display_handle.h"
#include "she/native_cursor.h"
#include "she/surface_list.h"
#include "os/display_handle.h"
#include "os/native_cursor.h"
#include "os/surface_list.h"
#include <string>
namespace she {
namespace os {
class Surface;
@ -59,7 +59,7 @@ namespace she {
virtual NativeCursor nativeMouseCursor() = 0;
virtual bool setNativeMouseCursor(NativeCursor cursor) = 0;
virtual bool setNativeMouseCursor(const she::Surface* cursor,
virtual bool setNativeMouseCursor(const os::Surface* cursor,
const gfx::Point& focus,
const int scale) = 0;
virtual void setMousePosition(const gfx::Point& position) = 0;
@ -81,6 +81,6 @@ namespace she {
virtual DisplayHandle nativeHandle() = 0;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,17 +1,17 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2015 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_DISPLAY_HANDLE_H_INCLUDED
#define SHE_DISPLAY_HANDLE_H_INCLUDED
#ifndef OS_DISPLAY_HANDLE_H_INCLUDED
#define OS_DISPLAY_HANDLE_H_INCLUDED
#pragma once
namespace she {
namespace os {
typedef void* DisplayHandle;
} // namespace she
} // namespace os
#endif

View File

@ -1,4 +1,4 @@
// SHE library
// LAF OS Library
// Copyright (C) 2017 David Capello
//
// This file is released under the terms of the MIT license.
@ -8,16 +8,16 @@
#include "config.h"
#endif
#include "she/draw_text.h"
#include "os/draw_text.h"
#include "ft/algorithm.h"
#include "ft/hb_shaper.h"
#include "gfx/clip.h"
#include "she/common/freetype_font.h"
#include "she/common/generic_surface.h"
#include "she/common/sprite_sheet_font.h"
#include "os/common/freetype_font.h"
#include "os/common/generic_surface.h"
#include "os/common/sprite_sheet_font.h"
namespace she {
namespace os {
gfx::Rect draw_text(Surface* surface, Font* font,
const base::utf8_const_iterator& begin,
@ -103,7 +103,7 @@ retry:;
int fg_alpha = gfx::geta(fg);
gfx::Rect clipBounds;
she::SurfaceFormatData fd;
os::SurfaceFormatData fd;
if (surface) {
clipBounds = surface->getClipBounds();
surface->getFormat(&fd);
@ -225,4 +225,4 @@ retry:;
return textBounds;
}
} // namespace she
} // namespace os

View File

@ -1,18 +1,18 @@
// SHE library
// LAF OS Library
// Copyright (C) 2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_DRAW_TEXT_H_INCLUDED
#define SHE_DRAW_TEXT_H_INCLUDED
#ifndef OS_DRAW_TEXT_H_INCLUDED
#define OS_DRAW_TEXT_H_INCLUDED
#pragma once
#include "base/string.h"
#include "gfx/color.h"
#include "gfx/fwd.h"
namespace she {
namespace os {
class Font;
class Surface;
@ -49,6 +49,6 @@ namespace she {
int x, int y,
DrawTextDelegate* delegate);
} // namespace she
} // namespace os
#endif

View File

@ -1,17 +1,17 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2014 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_ERROR_H_INCLUDED
#define SHE_ERROR_H_INCLUDED
#ifndef OS_ERROR_H_INCLUDED
#define OS_ERROR_H_INCLUDED
#pragma once
namespace she {
namespace os {
void error_message(const char* msg);
} // namespace she
} // namespace os
#endif

View File

@ -1,23 +1,23 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2018 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_EVENT_H_INCLUDED
#define SHE_EVENT_H_INCLUDED
#ifndef OS_EVENT_H_INCLUDED
#define OS_EVENT_H_INCLUDED
#pragma once
#include "base/paths.h"
#include "gfx/point.h"
#include "gfx/size.h"
#include "she/keys.h"
#include "she/pointer_type.h"
#include "os/keys.h"
#include "os/pointer_type.h"
#pragma push_macro("None")
#undef None // Undefine the X11 None macro
namespace she {
namespace os {
class Display;
@ -128,7 +128,7 @@ namespace she {
double m_pressure;
};
} // namespace she
} // namespace os
#pragma pop_macro("None")

View File

@ -1,14 +1,14 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2018 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_EVENT_QUEUE_H_INCLUDED
#define SHE_EVENT_QUEUE_H_INCLUDED
#ifndef OS_EVENT_QUEUE_H_INCLUDED
#define OS_EVENT_QUEUE_H_INCLUDED
#pragma once
namespace she {
namespace os {
class Event;
@ -29,6 +29,6 @@ namespace she {
EventQueue::instance()->queueEvent(ev);
}
} // namespace she
} // namespace os
#endif

View File

@ -1,16 +1,16 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_FONT_H_INCLUDED
#define SHE_FONT_H_INCLUDED
#ifndef OS_FONT_H_INCLUDED
#define OS_FONT_H_INCLUDED
#pragma once
#include <string>
namespace she {
namespace os {
enum class FontType {
kUnknown,
@ -31,17 +31,17 @@ namespace she {
virtual void setAntialias(bool antialias) = 0;
virtual bool hasCodePoint(int codepoint) const = 0;
she::Font* fallback() const {
os::Font* fallback() const {
return m_fallback;
}
void setFallback(she::Font* font) {
void setFallback(os::Font* font) {
m_fallback = font;
}
private:
she::Font* m_fallback;
os::Font* m_fallback;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,14 +1,14 @@
// SHE library
// Copyright (C) 2015, 2016 David Capello
// LAF OS Library
// Copyright (C) 2015-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_GL_CONTEXT_INCLUDED
#define SHE_GL_CONTEXT_INCLUDED
#ifndef OS_GL_CONTEXT_INCLUDED
#define OS_GL_CONTEXT_INCLUDED
#pragma once
namespace she {
namespace os {
class GLContext {
public:
@ -20,6 +20,6 @@ public:
virtual void swapBuffers() { }
};
} // namespace she
} // namespace os
#endif

View File

@ -1,19 +1,19 @@
// SHE library
// Copyright (C) 2015, 2016 David Capello
// LAF OS Library
// Copyright (C) 2015-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_GL_CONTEXT_CGL_INCLUDED
#define SHE_GL_CONTEXT_CGL_INCLUDED
#ifndef OS_GL_CONTEXT_CGL_INCLUDED
#define OS_GL_CONTEXT_CGL_INCLUDED
#pragma once
#include "she/gl/gl_context.h"
#include "os/gl/gl_context.h"
#include <OpenGL/OpenGL.h>
#include <dlfcn.h>
namespace she {
namespace os {
class GLContextCGL : public GLContext {
public:
@ -78,6 +78,6 @@ private:
int m_sampleCount;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,19 +1,19 @@
// SHE library
// LAF OS Library
// Copyright (C) 2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_GL_CONTEXT_EGL_INCLUDED
#define SHE_GL_CONTEXT_EGL_INCLUDED
#ifndef OS_GL_CONTEXT_EGL_INCLUDED
#define OS_GL_CONTEXT_EGL_INCLUDED
#pragma once
#include "she/gl/gl_context.h"
#include "os/gl/gl_context.h"
#include <EGL/egl.h>
#include <EGL/eglext.h>
namespace she {
namespace os {
class GLContextEGL : public GLContext {
public:
@ -160,6 +160,6 @@ private:
EGLint m_sampleCount;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,18 +1,18 @@
// SHE library
// LAF OS Library
// Copyright (C) 2015-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_GL_CONTEXT_WGL_INCLUDED
#define SHE_GL_CONTEXT_WGL_INCLUDED
#ifndef OS_GL_CONTEXT_WGL_INCLUDED
#define OS_GL_CONTEXT_WGL_INCLUDED
#pragma once
#include "she/gl/gl_context.h"
#include "os/gl/gl_context.h"
#include <windows.h>
namespace she {
namespace os {
class GLContextWGL : public GLContext {
public:
@ -87,6 +87,6 @@ private:
HGLRC m_glrc;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,4 +1,4 @@
// SHE library - GTK dialogs
// LAF OS Library
// Copyright (C) 2017-2018 David Capello
// Copyright (C) 2016 Gabriel Rauter
//
@ -9,19 +9,19 @@
#include "config.h"
#endif
#include "she/gtk/native_dialogs.h"
#include "os/gtk/native_dialogs.h"
#include "base/fs.h"
#include "base/string.h"
#include "she/common/file_dialog.h"
#include "she/display.h"
#include "she/error.h"
#include "os/common/file_dialog.h"
#include "os/display.h"
#include "os/error.h"
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
namespace she {
namespace os {
class FileDialogGTK : public CommonFileDialog {
public:
@ -255,4 +255,4 @@ FileDialog* NativeDialogsGTK::createFileDialog()
return new FileDialogGTK;
}
} // namespace she
} // namespace os

View File

@ -1,19 +1,19 @@
// SHE library - GTK dialogs
// LAF OS Library
// Copyright (C) 2017 David Capello
// Copyright (C) 2016 Gabriel Rauter
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_GTK_NATIVE_DIALOGS_H_INCLUDED
#define SHE_GTK_NATIVE_DIALOGS_H_INCLUDED
#ifndef OS_GTK_NATIVE_DIALOGS_H_INCLUDED
#define OS_GTK_NATIVE_DIALOGS_H_INCLUDED
#pragma once
#include "she/native_dialogs.h"
#include "os/native_dialogs.h"
extern "C" struct _GtkApplication;
namespace she {
namespace os {
class NativeDialogsGTK : public NativeDialogs {
public:
@ -24,6 +24,6 @@ namespace she {
_GtkApplication* m_gtkApp;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,14 +1,14 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_KEYS_H_INCLUDED
#define SHE_KEYS_H_INCLUDED
#ifndef OS_KEYS_H_INCLUDED
#define OS_KEYS_H_INCLUDED
#pragma once
namespace she {
namespace os {
enum KeyModifiers {
kKeyNoneModifier = 0,
@ -160,6 +160,6 @@ namespace she {
kKeyScancodes = 127
};
} // namespace she
} // namespace os
#endif

View File

@ -1,14 +1,14 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2014 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_LOGGER_H_INCLUDED
#define SHE_LOGGER_H_INCLUDED
#ifndef OS_LOGGER_H_INCLUDED
#define OS_LOGGER_H_INCLUDED
#pragma once
namespace she {
namespace os {
class Logger {
public:
@ -16,6 +16,6 @@ namespace she {
virtual void logError(const char* error) = 0;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,20 +1,20 @@
// SHE library
// LAF OS Library
// Copyright (C) 2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_MENUS_H_INCLUDED
#define SHE_MENUS_H_INCLUDED
#ifndef OS_MENUS_H_INCLUDED
#define OS_MENUS_H_INCLUDED
#pragma once
#include "she/keys.h"
#include "she/shortcut.h"
#include "os/keys.h"
#include "os/shortcut.h"
#include <functional>
#include <string>
namespace she {
namespace os {
class MenuItem;
struct MenuItemInfo {
@ -40,7 +40,7 @@ namespace she {
std::string text;
Shortcut shortcut;
std::function<void()> execute;
std::function<void(she::MenuItem*)> validate;
std::function<void(os::MenuItem*)> validate;
explicit MenuItemInfo(const Type type = Normal,
const Action action = UserDefined)
@ -87,6 +87,6 @@ namespace she {
virtual void setAppMenu(Menu* menu) = 0;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,16 +1,16 @@
// SHE library
// LAF OS Library
// Copyright (C) 2012-2014 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_NATIVE_CURSOR_H_INCLUDED
#define SHE_NATIVE_CURSOR_H_INCLUDED
#ifndef OS_NATIVE_CURSOR_H_INCLUDED
#define OS_NATIVE_CURSOR_H_INCLUDED
#pragma once
#include "gfx/fwd.h"
namespace she {
namespace os {
enum NativeCursor {
kNoCursor,
@ -34,6 +34,6 @@ namespace she {
kSizeNWCursor,
};
} // namespace she
} // namespace os
#endif

View File

@ -1,18 +1,18 @@
// SHE library
// LAF OS Library
// Copyright (C) 2015-2018 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_NATIVE_DIALOGS_H_INCLUDED
#define SHE_NATIVE_DIALOGS_H_INCLUDED
#ifndef OS_NATIVE_DIALOGS_H_INCLUDED
#define OS_NATIVE_DIALOGS_H_INCLUDED
#pragma once
#include "base/paths.h"
#include <string>
namespace she {
namespace os {
class Display;
class FileDialog {
@ -42,6 +42,6 @@ namespace she {
virtual FileDialog* createFileDialog() = 0;
};
} // namespace she
} // namespace os
#endif

View File

@ -1,4 +1,4 @@
// SHE library
// LAF OS Library
// Copyright (C) 2018 David Capello
//
// This file is released under the terms of the MIT license.
@ -9,9 +9,9 @@
#endif
#include "base/memory.h"
#include "she/she.h"
#include "os/system.h"
namespace she {
namespace os {
class NoneSystem : public System {
public:
@ -51,7 +51,7 @@ void error_message(const char* msg)
// TODO
}
} // namespace she
} // namespace os
extern int app_main(int argc, char* argv[]);

31
src/os/os.h Normal file
View File

@ -0,0 +1,31 @@
// LAF OS Library
// Copyright (C) 2012-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef OS_H_INCLUDED
#define OS_H_INCLUDED
#pragma once
#include "os/capabilities.h"
#include "os/display.h"
#include "os/display_handle.h"
#include "os/draw_text.h"
#include "os/error.h"
#include "os/event.h"
#include "os/event_queue.h"
#include "os/font.h"
#include "os/keys.h"
#include "os/logger.h"
#include "os/menus.h"
#include "os/native_cursor.h"
#include "os/native_dialogs.h"
#include "os/pointer_type.h"
#include "os/scoped_handle.h"
#include "os/shortcut.h"
#include "os/surface.h"
#include "os/surface_format.h"
#include "os/system.h"
#endif

Some files were not shown because too many files have changed in this diff Show More