mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-29 12:32:52 +00:00
Fix platform specific flags
* Replace ALLEGRO_WINDOWS and WIN32 with _WIN32 * Replace ALLEGRO_MACOSX with __APPLE__
This commit is contained in:
parent
2c6067f7e4
commit
7785199899
@ -121,7 +121,7 @@ public:
|
||||
|
||||
// Links
|
||||
locateFile()->Click.connect(Bind<void>(&OptionsWindow::onLocateConfigFile, this));
|
||||
#if WIN32
|
||||
#if _WIN32
|
||||
locateCrashFolder()->Click.connect(Bind<void>(&OptionsWindow::onLocateCrashFolder, this));
|
||||
#else
|
||||
locateCrashFolder()->setVisible(false);
|
||||
|
@ -51,7 +51,7 @@ void RefreshCommand::onExecute(Context* context)
|
||||
app_refresh_screen();
|
||||
|
||||
// Print memory information
|
||||
#if defined WIN32 && defined _DEBUG
|
||||
#if defined _WIN32 && defined _DEBUG
|
||||
{
|
||||
PROCESS_MEMORY_COUNTERS pmc;
|
||||
if (::GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
#include <shlobj.h>
|
||||
@ -62,7 +62,7 @@ public:
|
||||
unsigned int version;
|
||||
bool removed;
|
||||
bool is_folder;
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
LPITEMIDLIST pidl; // relative to parent
|
||||
LPITEMIDLIST fullpidl; // relative to the Desktop folder
|
||||
// (like a full path-name, because the
|
||||
@ -109,13 +109,13 @@ static FileItemMap* fileitems_map;
|
||||
static ThumbnailMap* thumbnail_map;
|
||||
static unsigned int current_file_system_version = 0;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
static IMalloc* shl_imalloc = NULL;
|
||||
static IShellFolder* shl_idesktop = NULL;
|
||||
#endif
|
||||
|
||||
/* a more easy PIDLs interface (without using the SH* & IL* routines of W2K) */
|
||||
#ifdef WIN32
|
||||
// A more easy PIDLs interface (without using the SH* & IL* routines of W2K)
|
||||
#ifdef _WIN32
|
||||
static bool is_sfgaof_folder(SFGAOF attrib);
|
||||
static void update_by_pidl(FileItem* fileitem, SFGAOF attrib);
|
||||
static LPITEMIDLIST concat_pidl(LPITEMIDLIST pidlHead, LPITEMIDLIST pidlTail);
|
||||
@ -146,7 +146,7 @@ FileSystemModule::FileSystemModule()
|
||||
fileitems_map = new FileItemMap;
|
||||
thumbnail_map = new ThumbnailMap;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
/* get the IMalloc interface */
|
||||
HRESULT hr = SHGetMalloc(&shl_imalloc);
|
||||
if (hr != S_OK)
|
||||
@ -185,7 +185,7 @@ FileSystemModule::~FileSystemModule()
|
||||
}
|
||||
thumbnail_map->clear();
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
// relase desktop IShellFolder interface
|
||||
shl_idesktop->Release();
|
||||
|
||||
@ -223,7 +223,7 @@ IFileItem* FileSystemModule::getRootFileItem()
|
||||
|
||||
//PRINTF("FS: Creating root fileitem %p\n", rootitem);
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
{
|
||||
// get the desktop PIDL
|
||||
LPITEMIDLIST pidl = NULL;
|
||||
@ -262,7 +262,7 @@ IFileItem* FileSystemModule::getFileItemFromPath(const std::string& path)
|
||||
|
||||
//PRINTF("FS: get_fileitem_from_path(%s)\n", path.c_str());
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
{
|
||||
ULONG cbEaten = 0UL;
|
||||
LPITEMIDLIST fullpidl = NULL;
|
||||
@ -364,7 +364,7 @@ const FileItemList& FileItem::getChildren()
|
||||
}
|
||||
|
||||
//PRINTF("FS: Loading files for %p (%s)\n", fileitem, fileitem->displayname);
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
{
|
||||
IShellFolder* pFolder = NULL;
|
||||
HRESULT hr;
|
||||
@ -537,7 +537,7 @@ FileItem::FileItem(FileItem* parent)
|
||||
this->version = current_file_system_version;
|
||||
this->removed = false;
|
||||
this->is_folder = false;
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
this->pidl = NULL;
|
||||
this->fullpidl = NULL;
|
||||
#endif
|
||||
@ -547,7 +547,7 @@ FileItem::~FileItem()
|
||||
{
|
||||
PRINTF("FS: Destroying FileItem() with parent %p\n", parent);
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (this->fullpidl && this->fullpidl != this->pidl) {
|
||||
free_pidl(this->fullpidl);
|
||||
this->fullpidl = NULL;
|
||||
@ -596,7 +596,7 @@ int FileItem::compare(const FileItem& that) const
|
||||
// PIDLS: Only for Win32
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
static bool calc_is_folder(std::string filename, SFGAOF attrib)
|
||||
{
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "base/string.h"
|
||||
#include "cfg/cfg.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include "base/fs.h"
|
||||
#ifndef _WIN32
|
||||
#include "base/fs.h"
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
@ -35,7 +35,7 @@ ConfigModule::ConfigModule()
|
||||
rf.includeUserDir("aseprite.ini");
|
||||
std::string fn = rf.getFirstOrCreateDefault();
|
||||
|
||||
#ifndef WIN32 // Migrate the configuration file to the new location in Unix-like systems
|
||||
#ifndef _WIN32 // Migrate the configuration file to the new location in Unix-like systems
|
||||
{
|
||||
ResourceFinder old_rf;
|
||||
old_rf.includeHomeDir(".asepriterc");
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
@ -82,7 +82,7 @@ void ResourceFinder::includeDataDir(const char* filename)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
// $BINDIR/data/filename
|
||||
sprintf(buf, "data/%s", filename);
|
||||
@ -113,7 +113,7 @@ void ResourceFinder::includeDataDir(const char* filename)
|
||||
|
||||
void ResourceFinder::includeHomeDir(const char* filename)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
// %AppData%/Aseprite/filename
|
||||
wchar_t* env = _wgetenv(L"AppData");
|
||||
@ -144,7 +144,7 @@ void ResourceFinder::includeHomeDir(const char* filename)
|
||||
|
||||
void ResourceFinder::includeUserDir(const char* filename)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
if (App::instance()->isPortable()) {
|
||||
// $BINDIR/filename
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
namespace app {
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
static const char* kDefaultCrashName = "Aseprite-crash.dmp";
|
||||
#endif
|
||||
|
||||
std::string memory_dump_filename()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
app::ResourceFinder rf;
|
||||
rf.includeUserDir(kDefaultCrashName);
|
||||
@ -40,7 +40,7 @@ std::string memory_dump_filename()
|
||||
|
||||
void SendCrash::search()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
m_dumpFilename = memory_dump_filename();
|
||||
|
||||
if (base::is_file(m_dumpFilename)) {
|
||||
|
@ -34,11 +34,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef WIN32
|
||||
#undef max
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
namespace app {
|
||||
|
||||
using namespace ui;
|
||||
|
@ -789,7 +789,7 @@ gfx::Point Editor::autoScroll(MouseMessage* msg, AutoScroll dir, bool blit_valid
|
||||
}
|
||||
setEditorScroll(scroll, blit_valid_rgn);
|
||||
|
||||
#if defined(WIN32) || defined(__APPLE__)
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
mousePos -= delta;
|
||||
ui::set_mouse_position(mousePos);
|
||||
#endif
|
||||
|
@ -53,7 +53,7 @@ bool ScrollingState::onMouseMove(Editor* editor, MouseMessage* msg)
|
||||
gfx::Point scroll = view->getViewScroll();
|
||||
gfx::Point newPos = msg->position();
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (newPos != editor->autoScroll(msg, AutoScroll::ScrollDir, true)) {
|
||||
m_oldPos = newPos;
|
||||
return true;
|
||||
|
@ -361,14 +361,14 @@ again:
|
||||
const FileItemList& children = m_fileList->getFileList();
|
||||
|
||||
std::string fn2 = fn;
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
fn2 = base::string_to_lower(fn2);
|
||||
#endif
|
||||
|
||||
for (IFileItem* child : children) {
|
||||
std::string child_name = child->getDisplayName();
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
child_name = base::string_to_lower(child_name);
|
||||
#endif
|
||||
if (child_name == fn2) {
|
||||
@ -381,7 +381,7 @@ again:
|
||||
if (!enter_folder) {
|
||||
// does the file-name entry have separators?
|
||||
if (base::is_path_separator(*fn.begin())) { // absolute path (UNIX style)
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
// get the drive of the current folder
|
||||
std::string drive = folder->getFileName();
|
||||
if (drive.size() >= 2 && drive[1] == ':') {
|
||||
@ -395,7 +395,7 @@ again:
|
||||
buf = fn;
|
||||
#endif
|
||||
}
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
// does the file-name entry have colon?
|
||||
else if (fn.find(':') != std::string::npos) { // absolute path on Windows
|
||||
if (fn.size() == 2 && fn[1] == ':') {
|
||||
|
@ -54,11 +54,11 @@ namespace {
|
||||
{
|
||||
const char* shortcut = NULL;
|
||||
|
||||
#if defined ALLEGRO_WINDOWS
|
||||
#ifdef _WIN32
|
||||
if (!shortcut) shortcut = elem->Attribute("win");
|
||||
#elif defined ALLEGRO_MACOSX
|
||||
#elif defined __APPLE__
|
||||
if (!shortcut) shortcut = elem->Attribute("mac");
|
||||
#elif defined ALLEGRO_UNIX
|
||||
#else
|
||||
if (!shortcut) shortcut = elem->Attribute("linux");
|
||||
#endif
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "doc/doc.h"
|
||||
#include "render/quantization.h"
|
||||
|
||||
#if defined WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
#include "app/util/clipboard_win32.h"
|
||||
@ -108,7 +108,7 @@ static void set_clipboard_image(Image* image, Palette* palette, bool set_system_
|
||||
clipboard_image = image;
|
||||
|
||||
// copy to the Windows clipboard
|
||||
#ifdef ALLEGRO_WINDOWS
|
||||
#ifdef _WIN32
|
||||
if (set_system_clipboard)
|
||||
set_win32_clipboard_bitmap(image, palette);
|
||||
#endif
|
||||
@ -136,7 +136,7 @@ static bool copy_from_document(const DocumentLocation& location)
|
||||
|
||||
clipboard::ClipboardFormat clipboard::get_current_format()
|
||||
{
|
||||
#ifdef ALLEGRO_WINDOWS
|
||||
#ifdef _WIN32
|
||||
if (win32_clipboard_contains_bitmap())
|
||||
return ClipboardImage;
|
||||
#endif
|
||||
@ -233,7 +233,7 @@ void clipboard::paste()
|
||||
switch (get_current_format()) {
|
||||
|
||||
case clipboard::ClipboardImage: {
|
||||
#ifdef ALLEGRO_WINDOWS
|
||||
#ifdef _WIN32
|
||||
// Get the image from the clipboard.
|
||||
{
|
||||
Image* win32_image = NULL;
|
||||
@ -399,7 +399,7 @@ void clipboard::paste()
|
||||
|
||||
bool clipboard::get_image_size(gfx::Size& size)
|
||||
{
|
||||
#ifdef ALLEGRO_WINDOWS
|
||||
#ifdef _WIN32
|
||||
// Get the image from the clipboard.
|
||||
return get_win32_clipboard_bitmap_size(size);
|
||||
#else
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -20,13 +20,13 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
int base_assert(const char* condition, const char* file, int lineNum)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
std::vector<wchar_t> buf(MAX_PATH);
|
||||
GetModuleFileNameW(NULL, &buf[0], MAX_PATH);
|
||||
@ -61,7 +61,7 @@ void base_trace(const char* msg, ...)
|
||||
vsprintf(buf, msg, ap);
|
||||
va_end(ap);
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
_CrtDbgReport(_CRT_WARN, NULL, 0, NULL, buf);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -15,7 +15,7 @@ void base_trace(const char* msg, ...);
|
||||
#undef TRACE
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <crtdbg.h>
|
||||
#define base_break() _CrtDbgBreak()
|
||||
#else
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <sys/stat.h>
|
||||
#include <io.h>
|
||||
@ -32,7 +32,7 @@ namespace base {
|
||||
|
||||
FILE* open_file_raw(const string& filename, const string& mode)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
return _wfopen(from_utf8(filename).c_str(),
|
||||
from_utf8(mode).c_str());
|
||||
#else
|
||||
@ -61,7 +61,7 @@ int open_file_descriptor_with_exception(const string& filename, const string& mo
|
||||
if (mode.find('b') != string::npos) flags |= O_BINARY;
|
||||
|
||||
int fd;
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
fd = _wopen(from_utf8(filename).c_str(), flags, _S_IREAD | _S_IWRITE);
|
||||
#else
|
||||
fd = open(filename.c_str(), flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -42,7 +42,7 @@ TEST(FileSystem, MakeAllDirectories)
|
||||
remove_directory("a");
|
||||
EXPECT_FALSE(is_directory("a"));
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
EXPECT_FALSE(is_directory("/Users/david/.config/aseprite/"));
|
||||
make_all_directories("/Users/david/.config/aseprite/");
|
||||
EXPECT_TRUE(is_directory("/Users/david/.config/aseprite/"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -13,7 +13,7 @@
|
||||
#include "base/launcher.h"
|
||||
#include "base/string.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#ifndef SEE_MASK_DEFAULT
|
||||
#define SEE_MASK_DEFAULT 0x00000000
|
||||
@ -56,7 +56,7 @@ static int win32_shell_execute(const wchar_t* verb, const wchar_t* file, const w
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif // WIN32
|
||||
#endif // _WIN32
|
||||
|
||||
namespace base {
|
||||
namespace launcher {
|
||||
@ -70,7 +70,7 @@ bool open_file(const std::string& file)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
ret = win32_shell_execute(L"open",
|
||||
base::from_utf8(file).c_str(), NULL);
|
||||
@ -90,7 +90,7 @@ bool open_file(const std::string& file)
|
||||
|
||||
bool open_folder(const std::string& file)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
int ret;
|
||||
if (base::is_directory(file)) {
|
||||
@ -123,7 +123,7 @@ bool open_folder(const std::string& file)
|
||||
|
||||
bool support_open_folder()
|
||||
{
|
||||
#if defined(WIN32) || defined(__APPLE__)
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#include "base/memory_dump.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include "base/memory_dump_win32.h"
|
||||
#else
|
||||
#include "base/memory_dump_none.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -8,9 +8,9 @@
|
||||
#define BASE_MEMORY_DUMP_WIN32_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
#endif
|
||||
|
||||
#include "base/string.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#include "base/mutex.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include "base/mutex_win32.h"
|
||||
#else
|
||||
#include "base/mutex_pthread.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
namespace base {
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
const std::string::value_type path_separator = '\\';
|
||||
#else
|
||||
const std::string::value_type path_separator = '/';
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -13,8 +13,8 @@
|
||||
#include <cctype>
|
||||
#include <vector>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
@ -39,7 +39,7 @@ std::string string_to_upper(const std::string& original)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
std::string to_utf8(const std::wstring& src)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -10,10 +10,10 @@
|
||||
|
||||
#include "base/system_console.h"
|
||||
|
||||
#ifdef WIN32 // Windows needs some adjustments to the console if the
|
||||
// process is linked with /subsystem:windows. These
|
||||
// adjustments are not great but are good enough.
|
||||
// See system_console.h for more information.
|
||||
#ifdef _WIN32 // Windows needs some adjustments to the console if the
|
||||
// process is linked with /subsystem:windows. These
|
||||
// adjustments are not great but are good enough.
|
||||
// See system_console.h for more information.
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -10,21 +10,21 @@
|
||||
|
||||
#include "base/thread.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#else
|
||||
#include <pthread.h> // Use pthread library in Unix-like systems
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32)
|
||||
#if !defined(_WIN32)
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
static DWORD WINAPI win32_thread_proxy(LPVOID data)
|
||||
{
|
||||
@ -63,7 +63,7 @@ bool base::thread::joinable() const
|
||||
void base::thread::join()
|
||||
{
|
||||
if (joinable()) {
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
::WaitForSingleObject(m_native_handle, INFINITE);
|
||||
#else
|
||||
::pthread_join((pthread_t)m_native_handle, NULL);
|
||||
@ -75,7 +75,7 @@ void base::thread::join()
|
||||
void base::thread::detach()
|
||||
{
|
||||
if (joinable()) {
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
::CloseHandle(m_native_handle);
|
||||
m_native_handle = (native_handle_type)0;
|
||||
#else
|
||||
@ -93,7 +93,7 @@ void base::thread::launch_thread(func_wrapper* f)
|
||||
{
|
||||
m_native_handle = (native_handle_type)0;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
DWORD native_id;
|
||||
m_native_handle = ::CreateThread(NULL, 0, win32_thread_proxy, (LPVOID)f,
|
||||
@ -122,7 +122,7 @@ void base::thread::details::thread_proxy(void* data)
|
||||
|
||||
void base::this_thread::yield()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
::Sleep(0);
|
||||
|
||||
@ -142,7 +142,7 @@ void base::this_thread::yield()
|
||||
|
||||
void base::this_thread::sleep_for(double seconds)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
::Sleep(seconds * 1000.0);
|
||||
|
||||
|
@ -26,8 +26,8 @@
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
@ -51,7 +51,7 @@ int app_main(int argc, char* argv[])
|
||||
// Initialize the random seed.
|
||||
std::srand(static_cast<unsigned int>(std::time(NULL)));
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
::CoInitialize(NULL);
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// SHE library
|
||||
// Copyright (C) 2012-2014 David Capello
|
||||
// Copyright (C) 2012-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include <allegro.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <winalleg.h>
|
||||
#endif
|
||||
|
||||
@ -164,7 +164,7 @@ void osx_mouser_leave_she_callback()
|
||||
|
||||
}
|
||||
|
||||
namespace she {
|
||||
namespace she {
|
||||
|
||||
void mouse_poller_init()
|
||||
{
|
||||
@ -215,4 +215,3 @@ void mouse_poller_generate_events()
|
||||
}
|
||||
|
||||
} // namespace she
|
||||
|
||||
|
@ -20,11 +20,11 @@
|
||||
#include <allegro/internal/aintern.h>
|
||||
|
||||
#define USE_KEY_POLLER
|
||||
#ifndef WIN32 // On Windows we generated events from the HWND procedure
|
||||
#ifndef _WIN32 // On Windows we generated events from the HWND procedure
|
||||
#define USE_MOUSE_POLLER
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <winalleg.h>
|
||||
|
||||
#include <windowsx.h>
|
||||
@ -51,7 +51,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include "she/clipboard_win.h"
|
||||
#else
|
||||
#include "she/clipboard_simple.h"
|
||||
@ -169,7 +169,7 @@ void queue_event(const Event& ev)
|
||||
|
||||
namespace {
|
||||
|
||||
#if WIN32
|
||||
#if _WIN32
|
||||
|
||||
wndproc_t base_wndproc = NULL;
|
||||
bool display_has_mouse = false;
|
||||
@ -449,8 +449,8 @@ void unsubclass_hwnd(HWND hwnd)
|
||||
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)base_wndproc);
|
||||
base_wndproc = NULL;
|
||||
}
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
@ -503,7 +503,7 @@ public:
|
||||
set_resize_callback(resize_callback);
|
||||
#endif
|
||||
|
||||
#if WIN32
|
||||
#if _WIN32
|
||||
subclass_hwnd((HWND)nativeHandle());
|
||||
#endif
|
||||
}
|
||||
@ -516,7 +516,7 @@ public:
|
||||
unique_display = NULL;
|
||||
}
|
||||
|
||||
#if WIN32
|
||||
#if _WIN32
|
||||
unsubclass_hwnd((HWND)nativeHandle());
|
||||
#endif
|
||||
|
||||
@ -598,13 +598,13 @@ public:
|
||||
}
|
||||
|
||||
void maximize() override {
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
::ShowWindow(win_get_window(), SW_MAXIMIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isMaximized() const override {
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
return (::GetWindowLong(win_get_window(), GWL_STYLE) & WS_MAXIMIZE ? true: false);
|
||||
#else
|
||||
return false;
|
||||
@ -647,7 +647,7 @@ public:
|
||||
case kSizeNCursor: newCursor = MOUSE_CURSOR_SIZE_N; break;
|
||||
case kSizeNECursor: newCursor = MOUSE_CURSOR_SIZE_NE; break;
|
||||
case kSizeECursor: newCursor = MOUSE_CURSOR_SIZE_E; break;
|
||||
case kSizeSECursor: newCursor = MOUSE_CURSOR_SIZE_SE; break;
|
||||
case kSizeSECursor: newCursor = MOUSE_CURSOR_SIZE_SE; break;
|
||||
case kSizeSCursor: newCursor = MOUSE_CURSOR_SIZE_S; break;
|
||||
case kSizeSWCursor: newCursor = MOUSE_CURSOR_SIZE_SW; break;
|
||||
case kSizeWCursor: newCursor = MOUSE_CURSOR_SIZE_W; break;
|
||||
@ -667,7 +667,7 @@ public:
|
||||
}
|
||||
|
||||
void captureMouse() {
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
capture_mouse = true;
|
||||
|
||||
@ -682,7 +682,7 @@ public:
|
||||
}
|
||||
|
||||
void releaseMouse() {
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
capture_mouse = false;
|
||||
|
||||
@ -694,7 +694,7 @@ public:
|
||||
}
|
||||
|
||||
void* nativeHandle() override {
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
return reinterpret_cast<void*>(win_get_window());
|
||||
#else
|
||||
return NULL;
|
||||
@ -806,7 +806,7 @@ void error_message(const char* msg)
|
||||
if (g_instance && g_instance->logger())
|
||||
g_instance->logger()->logError(msg);
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
std::wstring wmsg = base::from_utf8(msg);
|
||||
std::wstring title = base::from_utf8(PACKAGE);
|
||||
::MessageBoxW(NULL, wmsg.c_str(), title.c_str(), MB_OK | MB_ICONERROR);
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#ifdef LINKED_WITH_SHE
|
||||
#undef main
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
int main(int argc, char* argv[]) {
|
||||
extern int app_main(int argc, char* argv[]);
|
||||
return app_main(argc, argv);
|
||||
|
Loading…
x
Reference in New Issue
Block a user