Fix wxSTC compilation without precompilead headers
Get and release the HDC, instead of using WindowHDC. Because stc.cpp is used on all platforms, don't include wxMSW specific wx/msw/private.h. Also use const int for the variables.
This commit is contained in:
@@ -241,12 +241,14 @@ bool wxStyledTextCtrl::Create(wxWindow *parent,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// Set zoom for DPI
|
// Set initial zoom for active DPI
|
||||||
double baseDPI = ::GetDeviceCaps(WindowHDC(parent->GetHWND()), LOGPIXELSY);
|
const HDC hdc = ::GetDC(parent->GetHWND());
|
||||||
double activeDPI = parent->GetDPI().y;
|
const int baseDPI = ::GetDeviceCaps(hdc, LOGPIXELSY);
|
||||||
|
const int activeDPI = parent->GetDPI().y;
|
||||||
|
::ReleaseDC(parent->GetHWND(), hdc);
|
||||||
|
|
||||||
int ptSizeOld = StyleGetSize(wxSTC_STYLE_DEFAULT);
|
const int ptSizeOld = StyleGetSize(wxSTC_STYLE_DEFAULT);
|
||||||
int ptSizeNew = (int)wxMulDivInt32(ptSizeOld, activeDPI, baseDPI);
|
const int ptSizeNew = (int)wxMulDivInt32(ptSizeOld, activeDPI, baseDPI);
|
||||||
SetZoom(GetZoom() + (ptSizeNew - ptSizeOld));
|
SetZoom(GetZoom() + (ptSizeNew - ptSizeOld));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -241,12 +241,14 @@ bool wxStyledTextCtrl::Create(wxWindow *parent,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// Set zoom for DPI
|
// Set initial zoom for active DPI
|
||||||
double baseDPI = ::GetDeviceCaps(WindowHDC(parent->GetHWND()), LOGPIXELSY);
|
const HDC hdc = ::GetDC(parent->GetHWND());
|
||||||
double activeDPI = parent->GetDPI().y;
|
const int baseDPI = ::GetDeviceCaps(hdc, LOGPIXELSY);
|
||||||
|
const int activeDPI = parent->GetDPI().y;
|
||||||
|
::ReleaseDC(parent->GetHWND(), hdc);
|
||||||
|
|
||||||
int ptSizeOld = StyleGetSize(wxSTC_STYLE_DEFAULT);
|
const int ptSizeOld = StyleGetSize(wxSTC_STYLE_DEFAULT);
|
||||||
int ptSizeNew = (int)wxMulDivInt32(ptSizeOld, activeDPI, baseDPI);
|
const int ptSizeNew = (int)wxMulDivInt32(ptSizeOld, activeDPI, baseDPI);
|
||||||
SetZoom(GetZoom() + (ptSizeNew - ptSizeOld));
|
SetZoom(GetZoom() + (ptSizeNew - ptSizeOld));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user