diff --git a/README.md b/README.md index 6025982..ea44acd 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,15 @@ The x86 (32-bit) Windows binaries can be downloaded [here](https://github.com/ma # Changelog -* 0.6 (planned) - * Revamp tab system, everything rendered on the tab page itself - * *Improves the look n' feel* - * [ ] Fix individual file compiling/linking +* 0.7 (planned) * [ ] Add more status bar functionality * [ ] Add zooming capability +* 0.6 + * Revamp tab system, everything rendered on the tab page itself + * Improved the look n' feel + * Fix individual file compiling/linking + * 0.5 * Fix bug, when closing current tab, the next tab doesn't render * Show page numbers on status bar diff --git a/images/screen1.PNG b/images/screen1.PNG index 547677e..b10d8ec 100644 Binary files a/images/screen1.PNG and b/images/screen1.PNG differ diff --git a/src/common.cpp b/src/common.cpp index 54cd137..10b7bb9 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -109,6 +109,16 @@ void pdfv::w::openWeb(LPCWSTR url) noexcept ::ShellExecuteW(nullptr, L"open", url, nullptr, nullptr, SW_SHOWNORMAL); } +void pdfv::w::WindowDeleter::operator()(HWND obj) noexcept +{ + ::DestroyWindow(obj); +}; +void pdfv::w::DCDeleter::operator()(HDC obj) noexcept +{ + ::DeleteDC(obj); +}; + + bool pdfv::w::status::setParts(HWND statusbar, const std::vector & edges) noexcept { // Number of edges can't be greater than 256 @@ -125,6 +135,10 @@ bool pdfv::w::status::setText(HWND statusbar, int idx, DrawOp drawop, LPCWSTR st +void pdfv::ArgVecFree::operator()(wchar_t ** obj) noexcept +{ + ::LocalFree(obj); +}; [[nodiscard]] pdfv::ArgVecT pdfv::getArgs(LPWSTR cmdLine, int & argc) noexcept { diff --git a/src/common.hpp b/src/common.hpp index 15050a4..3509cd3 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -38,17 +38,6 @@ #endif -#ifdef _DEBUG - #include "debug.hpp" - #define DEBUGPRINT(...) pdfv::debug::printf(__VA_ARGS__) - - #define DEBUGFUNCTION(f) f() -#else - #define DEBUGPRINT(...) - - #define DEBUGFUNCTION(f) -#endif - namespace pdfv { @@ -212,51 +201,48 @@ namespace pdfv */ constexpr auto openWebPage{ openWeb }; - - auto GDIDeleter = [](T obj) noexcept + template + struct GDIDeleter { - ::DeleteObject(obj); + void operator()(T obj) noexcept + { + ::DeleteObject(obj); + } }; - auto WindowDeleter = [](HWND obj) noexcept + struct WindowDeleter { - ::DestroyWindow(obj); + void operator()(HWND obj) noexcept; }; - auto DCDeleter = [](HDC obj) noexcept + struct DCDeleter { - ::DeleteDC(obj); + void operator()(HDC obj) noexcept; }; - + /** * @brief Safe wrapper for GDI types * * @tparam T Any GDI type */ template - using SafeGDI = w::Safeptr; + using SafeGDI = w::Safeptr >; /** * @brief Safe wrapper for HWND * - * @tparam T */ - template - using SafeWin = w::Safeptr; + using SafeWin = w::Safeptr; /** * @brief Type alias for SafeWin * - * @tparam T */ - template - using SafeWindow = SafeWin; + using SafeWindow = SafeWin; /** * @brief Safe wrapper for HDC * - * @tparam T */ - template - using SafeHDC = w::Safeptr; + using SafeHDC = w::Safeptr; namespace status { @@ -284,12 +270,12 @@ namespace pdfv { }; - auto ArgVecFree = [](wchar_t ** obj) noexcept + struct ArgVecFree { - ::LocalFree(obj); + void operator()(wchar_t ** obj) noexcept; }; - using ArgVecT = w::Safeptr; + using ArgVecT = w::Safeptr; /** * @brief Get wide-stringed argument vector from command line wide-string diff --git a/src/debug.hpp b/src/debug.hpp index 2a4c68d..566fa67 100644 --- a/src/debug.hpp +++ b/src/debug.hpp @@ -19,5 +19,16 @@ namespace pdfv::debug int printf(const char * format, ...) noexcept; } +#endif + +#ifdef _DEBUG + #include "debug.hpp" + #define DEBUGPRINT(...) pdfv::debug::printf(__VA_ARGS__) + #define DEBUGFUNCTION(f) f() +#else + #define DEBUGPRINT(...) + + #define DEBUGFUNCTION(f) #endif + diff --git a/src/safeptr.hpp b/src/safeptr.hpp index 71120ba..5e01532 100644 --- a/src/safeptr.hpp +++ b/src/safeptr.hpp @@ -1,6 +1,7 @@ #pragma once #include "concepts.hpp" +#include "debug.hpp" namespace pdfv::w { @@ -39,6 +40,7 @@ namespace pdfv::w } ~Safeptr() noexcept { + DEBUGPRINT("~Safeptr<%s>()\n", typeid(T).name()); if (this->obj != nullptr) { auto temp{ this->obj }; diff --git a/src/version.hpp b/src/version.hpp index 706adea..0c6a4f8 100644 --- a/src/version.hpp +++ b/src/version.hpp @@ -1,7 +1,7 @@ #pragma once #define APP_CLASSNAME L"PdfiumViewCpp" -#define VERSION_STRING L"0.6b pre2" +#define VERSION_STRING L"0.6b" #define PRODUCT_NAME L"PdfiumView" #define APP_NAME PRODUCT_NAME L" v" VERSION_STRING