Fix GCC reorder warning, use override, remove duplicated code

Fix gcc reorder warning
https://github.com/notepad-plus-plus/notepad-plus-plus/actions/runs/8963463099/job/24613797904#step:4:403

Close #15101
pull/15109/head
ozone10 2024-05-06 16:57:00 +02:00 committed by Don Ho
parent e53bb4c88f
commit c64d706871
4 changed files with 8 additions and 17 deletions

View File

@ -16,7 +16,7 @@
#pragma once #pragma once
#include "Notepad_plus.h" #include "Notepad_plus.h"
const int splitterSize = 8; constexpr int splitterSize = 8;
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\ const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
\r\ \r\
@ -82,7 +82,7 @@ public:
return _notepad_plus_plus_core.getPluginListVerStr(); return _notepad_plus_plus_core.getPluginListVerStr();
}; };
virtual void destroy() { void destroy() override {
if (_hIconAbsent) if (_hIconAbsent)
::DestroyIcon(_hIconAbsent); ::DestroyIcon(_hIconAbsent);
::DestroyWindow(_hSelf); ::DestroyWindow(_hSelf);
@ -100,17 +100,8 @@ public:
void setStartupBgColor(COLORREF BgColor); void setStartupBgColor(COLORREF BgColor);
static void loadIcon(HINSTANCE hinst, wchar_t* pszName, int cx, int cy, HICON* icon) static void loadTrayIcon(HINSTANCE hinst, HICON* icon) {
{ DPIManagerV2::loadIcon(hinst, MAKEINTRESOURCE(IDI_M30ICON), ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), icon);
if (::LoadIconWithScaleDown(hinst, pszName, cx, cy, icon) != S_OK)
{
*icon = static_cast<HICON>(::LoadImage(hinst, pszName, IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR));
}
}
static void loadTrayIcon(HINSTANCE hinst, HICON* icon)
{
loadIcon(hinst, MAKEINTRESOURCE(IDI_M30ICON), ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), icon);
} }
private: private:

View File

@ -77,9 +77,9 @@ protected:
LPOVERLAPPED lpOverlapped); // I/O information buffer LPOVERLAPPED lpOverlapped); // I/O information buffer
// Parameters from the caller for ReadDirectoryChangesW(). // Parameters from the caller for ReadDirectoryChangesW().
DWORD m_dwFilterFlags = 0;
BOOL m_bIncludeChildren = FALSE;
std::wstring m_wstrDirectory; std::wstring m_wstrDirectory;
BOOL m_bIncludeChildren = FALSE;
DWORD m_dwFilterFlags = 0;
// Result of calling CreateFile(). // Result of calling CreateFile().
HANDLE m_hDirectory = nullptr; HANDLE m_hDirectory = nullptr;

View File

@ -265,7 +265,7 @@ void DPIManagerV2::sendMessageToChildControls(HWND hwndParent, UINT msg, WPARAM
}, reinterpret_cast<LPARAM>(&p)); }, reinterpret_cast<LPARAM>(&p));
} }
void DPIManagerV2::loadIcon(HINSTANCE hinst, wchar_t* pszName, int cx, int cy, HICON* phico, UINT fuLoad) void DPIManagerV2::loadIcon(HINSTANCE hinst, const wchar_t* pszName, int cx, int cy, HICON* phico, UINT fuLoad)
{ {
if (::LoadIconWithScaleDown(hinst, pszName, cx, cy, phico) != S_OK) if (::LoadIconWithScaleDown(hinst, pszName, cx, cy, phico) != S_OK)
{ {

View File

@ -128,7 +128,7 @@ public:
} }
static void sendMessageToChildControls(HWND hwndParent, UINT msg, WPARAM wParam, LPARAM lParam); static void sendMessageToChildControls(HWND hwndParent, UINT msg, WPARAM wParam, LPARAM lParam);
static void loadIcon(HINSTANCE hinst, wchar_t* pszName, int cx, int cy, HICON* phico, UINT fuLoad = LR_DEFAULTCOLOR); static void loadIcon(HINSTANCE hinst, const wchar_t* pszName, int cx, int cy, HICON* phico, UINT fuLoad = LR_DEFAULTCOLOR);
private: private:
UINT _dpi = USER_DEFAULT_SCREEN_DPI; UINT _dpi = USER_DEFAULT_SCREEN_DPI;