Skip to content

Commit

Permalink
Update 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
makuke1234 committed Jan 24, 2022
1 parent ca7286c commit b9df9fb
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 37 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified images/screen1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> & edges) noexcept
{
// Number of edges can't be greater than 256
Expand All @@ -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
{
Expand Down
50 changes: 18 additions & 32 deletions src/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -212,51 +201,48 @@ namespace pdfv
*/
constexpr auto openWebPage{ openWeb };


auto GDIDeleter = []<concepts::pointer T>(T obj) noexcept
template<concepts::pointer T>
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<typename T>
using SafeGDI = w::Safeptr<T, decltype(w::GDIDeleter)>;
using SafeGDI = w::Safeptr<T, w::GDIDeleter<T> >;

/**
* @brief Safe wrapper for HWND
*
* @tparam T
*/
template<typename T>
using SafeWin = w::Safeptr<T, decltype(w::WindowDeleter)>;
using SafeWin = w::Safeptr<HWND, w::WindowDeleter>;

/**
* @brief Type alias for SafeWin
*
* @tparam T
*/
template<typename T>
using SafeWindow = SafeWin<T>;
using SafeWindow = SafeWin;

/**
* @brief Safe wrapper for HDC
*
* @tparam T
*/
template<typename T>
using SafeHDC = w::Safeptr<T, decltype(w::DCDeleter)>;
using SafeHDC = w::Safeptr<HDC, w::DCDeleter>;

namespace status
{
Expand Down Expand Up @@ -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<wchar_t **, decltype(ArgVecFree)>;
using ArgVecT = w::Safeptr<wchar_t **, ArgVecFree>;

/**
* @brief Get wide-stringed argument vector from command line wide-string
Expand Down
11 changes: 11 additions & 0 deletions src/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 2 additions & 0 deletions src/safeptr.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "concepts.hpp"
#include "debug.hpp"

namespace pdfv::w
{
Expand Down Expand Up @@ -39,6 +40,7 @@ namespace pdfv::w
}
~Safeptr() noexcept
{
DEBUGPRINT("~Safeptr<%s>()\n", typeid(T).name());
if (this->obj != nullptr)
{
auto temp{ this->obj };
Expand Down
2 changes: 1 addition & 1 deletion src/version.hpp
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit b9df9fb

Please sign in to comment.