Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add support for per-monitor DPI awareness #422

Draft
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

sdottaka
Copy link
Member

No description provided.

… Add support for per-monitor DPI awareness (9)
# Conflicts:
#	Externals/crystaledit/Sample/MainFrm.h
#	Externals/crystaledit/editlib/ccrystaltextview.h
#	Externals/crystaledit/editlib/dialogs/memcombo.cpp
#	Externals/crystaledit/editlib/renderers/ccrystalrenderergdi.cpp
#	Externals/crystaledit/editlib/utils/hqbitmap.cpp
#	Externals/crystaledit/editlib/utils/hqbitmap.h
#	Src/Common/BCMenu.cpp
#	Src/MainFrm.cpp
#	Src/Merge.h
#	Src/Merge.vs2017.vcxproj.filters
#	Src/Merge.vs2019.vcxproj.filters
#	Src/TrDialogs.h
# Conflicts:
#	Externals/crystaledit/Sample/SampleStatic.vcxproj
#	Externals/crystaledit/Sample/SampleStatic.vs2017.vcxproj
#	Externals/crystaledit/Sample/SampleStatic.vs2017.vcxproj.filters
#	Externals/crystaledit/Sample/SampleStatic.vs2019.vcxproj.filters
#	Externals/crystaledit/Sample/resource.h
#	Src/Common/BCMenu.cpp
#	Src/Common/MDITabBar.h
#	Src/Common/MessageBoxDialog.cpp
#	Src/DirView.cpp
#	Src/DirView.h
#	Src/EditorFilepathBar.cpp
#	Src/EditorFilepathBar.h
#	Src/LineFiltersDlg.cpp
#	Src/MainFrm.cpp
#	Src/MainFrm.h
#	Src/Merge.h
#	Src/Merge.vcxproj
#	Src/Merge.vcxproj.filters
#	Src/Merge.vs2017.vcxproj
#	Src/Merge.vs2017.vcxproj.filters
#	Src/MergeFrameCommon.cpp
#	Src/MergeFrameCommon.h
#	Src/MergeStatusBar.cpp
#	Src/MergeStatusBar.h
#	Src/OpenFrm.cpp
#	Src/OpenView.cpp
#	Src/PluginsListDlg.cpp

afx_msg LRESULT OnDpiChanged(WPARAM wParam, LPARAM lParam)
{
int olddpi = m_dpi;

Check notice

Code scanning / CodeQL

Unused local variable

Variable olddpi is not used.

afx_msg LRESULT OnDpiChanged(WPARAM wParam, LPARAM lParam)
{
int olddpi = m_dpi;

Check notice

Code scanning / CodeQL

Unused local variable

Variable olddpi is not used.
GetClientRect(m_hwndDlg, &rcClient);
const int newnonclientsx = rc.Width() - rcClient.Width();
const int newnonclientsy = rc.Height() - rcClient.Height();
const RECT* pRect = reinterpret_cast<RECT*>(lParam);

Check notice

Code scanning / CodeQL

Unused local variable

Variable pRect is not used.
Comment on lines +168 to +175
/*
CFont *pFont = GetFont();
LOGFONT lfFont;
pFont->GetLogFont(&lfFont);
CSize size = Dialog_GetSizeFromTemplate(m_lpszTemplateName, lfFont.lfFaceName, MulDiv(abs(lfFont.lfHeight), 72, m_dpi));
SetWindowPos(nullptr, 0, 0, size.cx, size.cy, SWP_NOMOVE | SWP_NOZORDER);
LoadDynamicLayoutResource(m_lpszTemplateName);
*/

Check notice

Code scanning / CodeQL

Commented-out code

This comment appears to contain commented-out code.
Comment on lines +157 to +161
// sizeMin = GetDynamicLayout()->GetMinSize();
// CRect rc = m_rcInit;
// AdjustWindowRectEx(&rc, GetStyle(), false, GetExStyle());
// SetWindowPos(nullptr, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
// GetDynamicLayout()->Adjust();

Check notice

Code scanning / CodeQL

Commented-out code

This comment appears to contain commented-out code.
Comment on lines +754 to +758
/*
int temp = DpiAware::GetSystemMetricsForDpi(SM_CYMENU, dpi);
int temp2 = MulDiv(m_iconY + BCMENU_PAD, dpi, USER_DEFAULT_SCREEN_DPI);
lpMIS->itemHeight = temp>temp2 ? temp : temp2;
*/

Check notice

Code scanning / CodeQL

Commented-out code

This comment appears to contain commented-out code.
@@ -37,7 +38,7 @@
* The bar looks like a statusBar (font, height). The control
* displays a tip for each path (as a tooltip).
*/
class CEditorFilePathBar : public CDialogBar, public IHeaderBar
class CEditorFilePathBar : public DpiAware::CDpiAwareWnd<CDialogBar>, public IHeaderBar

Check notice

Code scanning / CodeQL

Undisciplined multiple inheritance

Multiple inheritance should not be used with 1 interfaces, 0 private implementations, 0 protected implementations, and 1 public implementations.
Comment on lines +166 to +176
if (bDynamicLayoutEnabled)
{
/*
CFont *pFont = GetFont();
LOGFONT lfFont;
pFont->GetLogFont(&lfFont);
CSize size = Dialog_GetSizeFromTemplate(m_lpszTemplateName, lfFont.lfFaceName, MulDiv(abs(lfFont.lfHeight), 72, m_dpi));
SetWindowPos(nullptr, 0, 0, size.cx, size.cy, SWP_NOMOVE | SWP_NOZORDER);
LoadDynamicLayoutResource(m_lpszTemplateName);
*/
}

Check notice

Code scanning / CodeQL

Futile conditional

If-statement with an empty then-branch and no else-branch.
# Conflicts:
#	Src/Common/BCMenu.cpp
#	Src/Common/MessageBoxDialog.cpp
#	Src/Common/SuperComboBox.cpp
#	Src/OpenFrm.cpp
m_hTheme = DpiAware::OpenThemeDataForDpi(nullptr, _T("MENU"), dpi);
if (m_hTheme == nullptr)
return false;
const int dpi = CClientDC(CWnd::GetDesktopWindow()).GetDeviceCaps(LOGPIXELSX);

Check notice

Code scanning / CodeQL

Declaration hides parameter

Local variable 'dpi' hides a [parameter of the same name](1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant