summaryrefslogtreecommitdiff
path: root/wx+
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2016-03-16 21:34:59 +0100
committerDaniel Wilhelm <daniel@wili.li>2016-03-16 21:34:59 +0100
commit339ed7f63798fb5ccab05fa7fb9d0d95743c9c89 (patch)
tree214819f601b69bfd32507ca59047dd4d68ed5632 /wx+
parent7.9 (diff)
downloadFreeFileSync-339ed7f63798fb5ccab05fa7fb9d0d95743c9c89.tar.gz
FreeFileSync-339ed7f63798fb5ccab05fa7fb9d0d95743c9c89.tar.bz2
FreeFileSync-339ed7f63798fb5ccab05fa7fb9d0d95743c9c89.zip
8.0
Diffstat (limited to 'wx+')
-rw-r--r--wx+/dc.h30
-rw-r--r--wx+/font_size.h43
-rw-r--r--wx+/graph.cpp2
-rw-r--r--wx+/grid.cpp2
-rw-r--r--wx+/image_resources.cpp12
-rw-r--r--wx+/image_tools.h5
-rw-r--r--wx+/popup_dlg_generated.cpp8
-rw-r--r--wx+/popup_dlg_generated.h2
8 files changed, 53 insertions, 51 deletions
diff --git a/wx+/dc.h b/wx+/dc.h
index 568da47b..278d3458 100644
--- a/wx+/dc.h
+++ b/wx+/dc.h
@@ -98,25 +98,33 @@ public:
BufferedPaintDC(wxWindow& wnd, Opt<wxBitmap>& buffer) : buffer_(buffer), paintDc(&wnd)
{
const wxSize clientSize = wnd.GetClientSize();
- if (!buffer_ || clientSize != wxSize(buffer->GetWidth(), buffer->GetHeight()))
- buffer = wxBitmap(clientSize.GetWidth(), clientSize.GetHeight());
+ if (clientSize.GetWidth() > 0 && clientSize.GetHeight() > 0) //wxBitmap asserts this!! width may be 0; test case "Grid::CornerWin": compare both sides, then change config
+ {
+ if (!buffer_ || clientSize != wxSize(buffer->GetWidth(), buffer->GetHeight()))
+ buffer = wxBitmap(clientSize.GetWidth(), clientSize.GetHeight());
- SelectObject(*buffer);
+ SelectObject(*buffer);
- if (paintDc.IsOk() && paintDc.GetLayoutDirection() == wxLayout_RightToLeft)
- SetLayoutDirection(wxLayout_RightToLeft);
+ if (paintDc.IsOk() && paintDc.GetLayoutDirection() == wxLayout_RightToLeft)
+ SetLayoutDirection(wxLayout_RightToLeft);
+ }
+ else
+ buffer = NoValue();
}
~BufferedPaintDC()
{
- if (GetLayoutDirection() == wxLayout_RightToLeft)
+ if (buffer_)
{
- paintDc.SetLayoutDirection(wxLayout_LeftToRight); //workaround bug in wxDC::Blit()
- SetLayoutDirection(wxLayout_LeftToRight); //
+ if (GetLayoutDirection() == wxLayout_RightToLeft)
+ {
+ paintDc.SetLayoutDirection(wxLayout_LeftToRight); //workaround bug in wxDC::Blit()
+ SetLayoutDirection(wxLayout_LeftToRight); //
+ }
+
+ const wxPoint origin = GetDeviceOrigin();
+ paintDc.Blit(0, 0, buffer_->GetWidth(), buffer_->GetHeight(), this, -origin.x, -origin.y);
}
-
- const wxPoint origin = GetDeviceOrigin();
- paintDc.Blit(0, 0, buffer_->GetWidth(), buffer_->GetHeight(), this, -origin.x, -origin.y);
}
private:
diff --git a/wx+/font_size.h b/wx+/font_size.h
index 2858afb6..03f3c62b 100644
--- a/wx+/font_size.h
+++ b/wx+/font_size.h
@@ -9,11 +9,12 @@
#include <zen/basic_math.h>
#include <wx/window.h>
-#ifdef ZEN_WIN
- #include <zen/dll.h>
+#include <zen/scope_guard.h>
+#ifdef ZEN_WIN_VISTA_AND_LATER
+ #include <zen/win.h>
#include <Uxtheme.h>
#include <vsstyle.h> //TEXT_MAININSTRUCTION
- #include <vssym32.h> //TMT_COLOR
+ #include <vssym32.h> //TMT_TEXTCOLOR
#endif
@@ -49,28 +50,22 @@ void setMainInstructionFont(wxWindow& control)
#ifdef ZEN_WIN //http://msdn.microsoft.com/de-DE/library/windows/desktop/aa974176#fonts
font.SetPointSize(wxNORMAL_FONT->GetPointSize() * 4 / 3); //integer round down
+#ifdef ZEN_WIN_VISTA_AND_LATER
//get main instruction color: don't hard-code, respect accessibility!
- typedef HTHEME (WINAPI* OpenThemeDataFun )(HWND hwnd, LPCWSTR pszClassList);
- typedef HRESULT (WINAPI* CloseThemeDataFun)(HTHEME hTheme);
- typedef HRESULT (WINAPI* GetThemeColorFun )(HTHEME hTheme, int iPartId, int iStateId, int iPropId, COLORREF *pColor);
-
- const SysDllFun<OpenThemeDataFun> openThemeData (L"UxTheme.dll", "OpenThemeData"); //available with Windows XP and later
- const SysDllFun<CloseThemeDataFun> closeThemeData(L"UxTheme.dll", "CloseThemeData");
- const SysDllFun<GetThemeColorFun> getThemeColor (L"UxTheme.dll", "GetThemeColor");
- if (openThemeData && closeThemeData && getThemeColor)
- if (HTHEME hTheme = openThemeData(NULL, //__in HWND hwnd,
- L"TEXTSTYLE")) //__in LPCWSTR pszClassList
- {
- ZEN_ON_SCOPE_EXIT(closeThemeData(hTheme));
-
- COLORREF cr = {};
- if (getThemeColor(hTheme, //_In_ HTHEME hTheme,
- TEXT_MAININSTRUCTION, // _In_ int iPartId,
- 0, // _In_ int iStateId,
- TMT_TEXTCOLOR, // _In_ int iPropId,
- &cr) == S_OK) // _Out_ COLORREF *pColor
- control.SetForegroundColour(wxColor(cr));
- }
+ if (HTHEME hTheme = ::OpenThemeData(NULL, //__in HWND hwnd,
+ L"TEXTSTYLE")) //__in LPCWSTR pszClassList
+ {
+ ZEN_ON_SCOPE_EXIT(::CloseThemeData(hTheme));
+
+ COLORREF cr = {};
+ if (::GetThemeColor(hTheme, //_In_ HTHEME hTheme,
+ TEXT_MAININSTRUCTION, // _In_ int iPartId,
+ 0, // _In_ int iStateId,
+ TMT_TEXTCOLOR, // _In_ int iPropId,
+ &cr) == S_OK) // _Out_ COLORREF *pColor
+ control.SetForegroundColour(wxColor(cr));
+ }
+#endif
#elif defined ZEN_LINUX //https://developer.gnome.org/hig-book/3.2/hig-book.html#alert-text
font.SetPointSize(numeric::round(wxNORMAL_FONT->GetPointSize() * 12.0 / 11));
diff --git a/wx+/graph.cpp b/wx+/graph.cpp
index f39d29f5..95a6955b 100644
--- a/wx+/graph.cpp
+++ b/wx+/graph.cpp
@@ -45,7 +45,7 @@ wxColor getDefaultColor(size_t pos)
switch (pos % 10)
{
case 0:
- return { 0, 69, 134 }; //blue
+ return { 0, 69, 134 }; //blue
case 1:
return { 255, 66, 14 }; //red
case 2:
diff --git a/wx+/grid.cpp b/wx+/grid.cpp
index a6c71600..f80c9c73 100644
--- a/wx+/grid.cpp
+++ b/wx+/grid.cpp
@@ -235,7 +235,7 @@ void GridData::drawColumnLabelText(wxDC& dc, const wxRect& rect, const std::wstr
/|\
|
-----------------------------------
- | | | |
+ | | | |
CornerWin RowLabelWin ColLabelWin MainWin
*/
diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp
index 4ba62bb9..7c6de43f 100644
--- a/wx+/image_resources.cpp
+++ b/wx+/image_resources.cpp
@@ -50,18 +50,18 @@ public:
}
void init(const Zstring& filepath);
- void cleanup()
- {
- bitmaps.clear();
- anims.clear();
- }
+ void cleanup()
+ {
+ bitmaps.clear();
+ anims.clear();
+ }
const wxBitmap& getImage (const wxString& name) const;
const wxAnimation& getAnimation(const wxString& name) const;
private:
GlobalResources() {}
- ~GlobalResources() { assert(bitmaps.empty() && anims.empty()); } //don't leave wxWidgets objects for static destruction!
+ ~GlobalResources() { assert(bitmaps.empty() && anims.empty()); } //don't leave wxWidgets objects for static destruction!
GlobalResources (const GlobalResources&) = delete;
GlobalResources& operator=(const GlobalResources&) = delete;
diff --git a/wx+/image_tools.h b/wx+/image_tools.h
index 554e7b49..c8077aa4 100644
--- a/wx+/image_tools.h
+++ b/wx+/image_tools.h
@@ -127,10 +127,9 @@ double getAvgBrightness(const wxImage& img)
inline
void brighten(wxImage& img, int level)
{
- const int pixelCount = img.GetWidth() * img.GetHeight();
- auto pixBegin = img.GetData();
- if (pixBegin)
+ if (auto pixBegin = img.GetData())
{
+ const int pixelCount = img.GetWidth() * img.GetHeight();
auto pixEnd = pixBegin + 3 * pixelCount; //RGB
if (level > 0)
std::for_each(pixBegin, pixEnd, [&](unsigned char& c) { c = static_cast<unsigned char>(std::min(255, c + level)); });
diff --git a/wx+/popup_dlg_generated.cpp b/wx+/popup_dlg_generated.cpp
index c3d50a70..dfddbc8e 100644
--- a/wx+/popup_dlg_generated.cpp
+++ b/wx+/popup_dlg_generated.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun 5 2014)
+// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -43,10 +43,10 @@ PopupDialogGenerated::PopupDialogGenerated( wxWindow* parent, wxWindowID id, con
m_panel33->SetSizer( bSizer165 );
m_panel33->Layout();
bSizer165->Fit( m_panel33 );
- bSizer24->Add( m_panel33, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
+ bSizer24->Add( m_panel33, 1, wxEXPAND, 5 );
m_staticline6 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
- bSizer24->Add( m_staticline6, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
+ bSizer24->Add( m_staticline6, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer25;
bSizer25 = new wxBoxSizer( wxVERTICAL );
@@ -69,7 +69,7 @@ PopupDialogGenerated::PopupDialogGenerated( wxWindow* parent, wxWindowID id, con
bSizer25->Add( bSizerStdButtons, 0, wxALIGN_RIGHT, 5 );
- bSizer24->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
+ bSizer24->Add( bSizer25, 0, wxEXPAND, 5 );
this->SetSizer( bSizer24 );
diff --git a/wx+/popup_dlg_generated.h b/wx+/popup_dlg_generated.h
index b0397f1e..bef871c7 100644
--- a/wx+/popup_dlg_generated.h
+++ b/wx+/popup_dlg_generated.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun 5 2014)
+// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
bgstack15