diff --git a/src/README.md b/src/README.md index 8c503a7cb..6106cdc2b 100644 --- a/src/README.md +++ b/src/README.md @@ -29,13 +29,12 @@ because they don't depend on any other component. * [gen](gen/) (base): Helper utility to generate C++ files from different XMLs. * [gfx](gfx/) (fixmath): Abstract graphics structures like point, size, rectangle, region, color, etc. * [net](net/) (base): Networking library to send HTTP requests. - * [pen](pen/) (base, wacom): Library to handle graphics tablet input. * [webserver](webserver/) (base): HTTP web server ## Level 2 * [doc](doc/) (base, fixmath, gfx): Document model library. - * [she](she/) (allegro, base, gfx): A wrapper for the Allegro library. + * [she](she/) (allegro, base, gfx, wacom): A wrapper for the Allegro library. ## Level 3 diff --git a/src/pen/CMakeLists.txt b/src/pen/CMakeLists.txt deleted file mode 100644 index 52e21c94e..000000000 --- a/src/pen/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Aseprite Pen Library -# Copyright (C) 2016 David Capello - -add_library(pen-lib - pen.cpp) - -target_link_libraries(pen-lib - base-lib) diff --git a/src/pen/pen.cpp b/src/pen/pen.cpp deleted file mode 100644 index 21148a01c..000000000 --- a/src/pen/pen.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Aseprite Pen Library -// Copyright (c) 2016 David Capello -// -// This file is released under the terms of the MIT license. -// Read LICENSE.txt for more information. - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "pen/pen.h" - -#ifdef _WIN32 - #include "pen/pen_win.h" -#else - #include "pen/pen_none.h" -#endif - -namespace pen { - -PenAPI::PenAPI(void* nativeDisplayHandle) - : m_impl(new Impl(nativeDisplayHandle)) -{ -} - -PenAPI::~PenAPI() -{ - delete m_impl; -} - -} // namespace pen diff --git a/src/pen/pen.h b/src/pen/pen.h deleted file mode 100644 index 1308de541..000000000 --- a/src/pen/pen.h +++ /dev/null @@ -1,25 +0,0 @@ -// Aseprite Pen Library -// Copyright (c) 2016 David Capello -// -// This file is released under the terms of the MIT license. -// Read LICENSE.txt for more information. - -#ifndef PEN_PEN_H_INCLUDED -#define PEN_PEN_H_INCLUDED -#pragma once - -namespace pen { - -class PenAPI { -public: - PenAPI(void* nativeDisplayHandle); - ~PenAPI(); - -private: - class Impl; - Impl* m_impl; -}; - -} // namespace pen - -#endif diff --git a/src/pen/pen_none.h b/src/pen/pen_none.h deleted file mode 100644 index 5d23c667a..000000000 --- a/src/pen/pen_none.h +++ /dev/null @@ -1,15 +0,0 @@ -// Aseprite Pen Library -// Copyright (c) 2016 David Capello -// -// This file is released under the terms of the MIT license. -// Read LICENSE.txt for more information. - -namespace pen { - -class PenAPI::Impl { -public: - Impl(void*) { } - ~Impl() { } -}; - -} // namespace pen diff --git a/src/pen/pen_win.h b/src/pen/pen_win.h deleted file mode 100644 index 5314046ed..000000000 --- a/src/pen/pen_win.h +++ /dev/null @@ -1,68 +0,0 @@ -// Aseprite Pen Library -// Copyright (c) 2016 David Capello -// -// This file is released under the terms of the MIT license. -// Read LICENSE.txt for more information. - -#include "base/debug.h" -#include "base/dll.h" -#include "base/fs.h" -#include "base/log.h" -#include "base/path.h" -#include "base/string.h" - -#include -#include "wacom/wintab.h" - -typedef UINT (API* WTInfoW_Func)(UINT, UINT, LPVOID); -typedef HCTX (API* WTOpenW_Func)(HWND, LPLOGCONTEXTW, BOOL); -typedef BOOL (API* WTClose_Func)(HCTX); - -class pen::PenAPI::Impl { -public: - Impl(void* nativeDisplayHandle) : m_ctx(nullptr) { - m_wintabLib = base::load_dll("wintab32.dll"); - if (!m_wintabLib) - return; - - auto WTInfoW = base::get_dll_proc(m_wintabLib, "WTInfoW"); - auto WTOpenW = base::get_dll_proc(m_wintabLib, "WTOpenW"); - if (!WTInfoW || !WTOpenW) - return; - - LOGCONTEXTW logctx; - memset(&logctx, 0, sizeof(LOGCONTEXTW)); - logctx.lcOptions |= CXO_SYSTEM; - UINT infoRes = WTInfoW(WTI_DEFSYSCTX, 0, &logctx); - ASSERT(infoRes == sizeof(LOGCONTEXTW)); - ASSERT(logctx.lcOptions & CXO_SYSTEM); - - logctx.lcOptions |= CXO_SYSTEM; - m_ctx = WTOpenW((HWND)nativeDisplayHandle, &logctx, TRUE); - if (!m_ctx) { - LOG("Pen library is not initialized...\n"); - return; - } - - LOG("Pen initialized...\n"); - } - - ~Impl() { - if (!m_wintabLib) - return; - - if (m_ctx) { - auto WTClose = base::get_dll_proc(m_wintabLib, "WTClose"); - if (WTClose) { - LOG("Pen shutdown...\n"); - WTClose(m_ctx); - } - } - - base::unload_dll(m_wintabLib); - } - -private: - base::dll m_wintabLib; - HCTX m_ctx; -};