GUI Enhancement: Plugins Admin dialog

- add key accelerators
- remove unused define
- add initializers
- fix override warnings
- optimize dark mode
- resize listview controls based on other child controls

Fix #13622, close #13623
This commit is contained in:
ozone10 2023-05-05 18:30:09 +02:00 committed by Don Ho
parent 571c815b1e
commit 4e0f50416d
7 changed files with 104 additions and 186 deletions

View File

@ -547,12 +547,12 @@ Translation note:
<PluginsAdminDlg title="Plugins Admin" titleAvailable="Available" titleUpdates="Updates" titleInstalled="Installed" titleIncompatible="Incompatible"> <PluginsAdminDlg title="Plugins Admin" titleAvailable="Available" titleUpdates="Updates" titleInstalled="Installed" titleIncompatible="Incompatible">
<ColumnPlugin name="Plugin"/> <ColumnPlugin name="Plugin"/>
<ColumnVersion name="Version"/> <ColumnVersion name="Version"/>
<Item id="5501" name="Search:"/> <Item id="5501" name="&amp;Search:"/>
<Item id="5503" name="Install"/> <Item id="5503" name="&amp;Install"/>
<Item id="5504" name="Update"/> <Item id="5504" name="&amp;Update"/>
<Item id="5505" name="Remove"/> <Item id="5505" name="&amp;Remove"/>
<Item id="5508" name="Next"/> <Item id="5508" name="&amp;Next"/>
<Item id="5509" name="Plugin list version: "/> <Item id="5509" name="Plugin list version:"/>
<Item id="5511" name="Plugin list repository"/> <Item id="5511" name="Plugin list repository"/>
<Item id="2" name="Close"/> <Item id="2" name="Close"/>
</PluginsAdminDlg> </PluginsAdminDlg>

View File

@ -547,12 +547,12 @@ Translation note:
<PluginsAdminDlg title="Plugins Admin" titleAvailable="Available" titleUpdates="Updates" titleInstalled="Installed" titleIncompatible="Incompatible"> <PluginsAdminDlg title="Plugins Admin" titleAvailable="Available" titleUpdates="Updates" titleInstalled="Installed" titleIncompatible="Incompatible">
<ColumnPlugin name="Plugin"/> <ColumnPlugin name="Plugin"/>
<ColumnVersion name="Version"/> <ColumnVersion name="Version"/>
<Item id="5501" name="Search:"/> <Item id="5501" name="&amp;Search:"/>
<Item id="5503" name="Install"/> <Item id="5503" name="&amp;Install"/>
<Item id="5504" name="Update"/> <Item id="5504" name="&amp;Update"/>
<Item id="5505" name="Remove"/> <Item id="5505" name="&amp;Remove"/>
<Item id="5508" name="Next"/> <Item id="5508" name="&amp;Next"/>
<Item id="5509" name="Plugin list version: "/> <Item id="5509" name="Plugin list version:"/>
<Item id="5511" name="Plugin list repository"/> <Item id="5511" name="Plugin list repository"/>
<Item id="2" name="Close"/> <Item id="2" name="Close"/>
</PluginsAdminDlg> </PluginsAdminDlg>

View File

@ -127,7 +127,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
StaticDialog::create(dialogID, isRTL, msgDestParent); StaticDialog::create(dialogID, isRTL, msgDestParent);
RECT rect; RECT rect{};
getClientRect(rect); getClientRect(rect);
_tab.init(_hInst, _hSelf, false, true); _tab.init(_hInst, _hSelf, false, true);
NppDarkMode::subclassTabControl(_tab.getHSelf()); NppDarkMode::subclassTabControl(_tab.getHSelf());
@ -146,124 +146,53 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
_tab.insertAtEnd(installed); _tab.insertAtEnd(installed);
_tab.insertAtEnd(incompatible); _tab.insertAtEnd(incompatible);
rect.bottom -= dpiManager.scaleY(105); RECT rcDesc{};
getMappedChildRect(IDC_PLUGINADM_EDIT, rcDesc);
const long margeX = ::GetSystemMetrics(SM_CXEDGE);
const long margeY = tabDpiDynamicalHeight;
rect.bottom = rcDesc.bottom + margeY;
_tab.reSizeTo(rect); _tab.reSizeTo(rect);
_tab.display(); _tab.display();
const long marge = dpiManager.scaleX(10); RECT rcSearch{};
const int topMarge = dpiManager.scaleY(42); getMappedChildRect(IDC_PLUGINADM_SEARCH_EDIT, rcSearch);
HWND hResearchLabel = ::GetDlgItem(_hSelf, IDC_PLUGINADM_SEARCH_STATIC); RECT listRect{
RECT researchLabelRect; rcDesc.left - margeX,
::GetClientRect(hResearchLabel, &researchLabelRect); rcSearch.bottom + margeY,
researchLabelRect.left = rect.left + marge; rcDesc.right + ::GetSystemMetrics(SM_CXVSCROLL) + margeX,
long leftCusor = researchLabelRect.left + researchLabelRect.right; rcDesc.top - margeY
researchLabelRect.top = topMarge + dpiManager.scaleY(4); };
::MoveWindow(hResearchLabel, researchLabelRect.left, researchLabelRect.top, researchLabelRect.right, researchLabelRect.bottom, TRUE);
::InvalidateRect(hResearchLabel, nullptr, TRUE);
HWND hResearchEdit = ::GetDlgItem(_hSelf, IDC_PLUGINADM_SEARCH_EDIT);
RECT researchEditRect;
::GetClientRect(hResearchEdit, &researchEditRect);
researchEditRect.left = leftCusor;
leftCusor += researchEditRect.right;
researchEditRect.top = topMarge + dpiManager.scaleX(1);
::MoveWindow(hResearchEdit, researchEditRect.left, researchEditRect.top, researchEditRect.right, researchEditRect.bottom, TRUE);
::InvalidateRect(hResearchEdit, nullptr, TRUE);
HWND hNextButton = ::GetDlgItem(_hSelf, IDC_PLUGINADM_RESEARCH_NEXT);
RECT researchNextRect;
::GetClientRect(hNextButton, &researchNextRect);
researchNextRect.left = leftCusor + marge;
leftCusor = researchNextRect.left + researchNextRect.right;
researchNextRect.top = topMarge;
::MoveWindow(hNextButton, researchNextRect.left, researchNextRect.top, researchNextRect.right, researchNextRect.bottom, TRUE);
::InvalidateRect(hNextButton, nullptr, TRUE);
HWND hActionButton = ::GetDlgItem(_hSelf, IDC_PLUGINADM_INSTALL);
RECT actionRect;
::GetClientRect(hActionButton, &actionRect);
long w = actionRect.right - actionRect.left;
actionRect.left = rect.right - w - marge;
actionRect.top = topMarge;
::MoveWindow(hActionButton, actionRect.left, actionRect.top, actionRect.right, actionRect.bottom, TRUE);
::InvalidateRect(hActionButton, nullptr, TRUE);
hActionButton = ::GetDlgItem(_hSelf, IDC_PLUGINADM_UPDATE);
::MoveWindow(hActionButton, actionRect.left, actionRect.top, actionRect.right, actionRect.bottom, TRUE);
::InvalidateRect(hActionButton, nullptr, TRUE);
hActionButton = ::GetDlgItem(_hSelf, IDC_PLUGINADM_REMOVE);
::MoveWindow(hActionButton, actionRect.left, actionRect.top, actionRect.right, actionRect.bottom, TRUE);
::InvalidateRect(hActionButton, nullptr, TRUE);
long actionZoneHeight = dpiManager.scaleY(50);
rect.top += actionZoneHeight;
rect.bottom -= actionZoneHeight;
RECT listRect = rect;
RECT descRect = rect;
long descHeight = rect.bottom / 3 - marge;
long listHeight = (rect.bottom / 3) * 2 - marge * 3;
listRect.top += marge;
listRect.bottom = listHeight;
listRect.left += marge;
listRect.right -= marge * 2;
descRect.top += listHeight + marge * 3;
descRect.bottom = descHeight;
descRect.left += marge;
descRect.right -= marge * 2;
NppParameters& nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
generic_string pluginStr = pNativeSpeaker->getAttrNameStr(TEXT("Plugin"), "PluginAdmin", "Plugin"); generic_string pluginStr = pNativeSpeaker->getAttrNameStr(TEXT("Plugin"), "PluginAdmin", "Plugin");
generic_string vesionStr = pNativeSpeaker->getAttrNameStr(TEXT("Version"), "PluginAdmin", "Version"); generic_string vesionStr = pNativeSpeaker->getAttrNameStr(TEXT("Version"), "PluginAdmin", "Version");
COLORREF fgColor = (NppParameters::getInstance()).getCurrentDefaultFgColor(); const COLORREF fgColor = nppParam.getCurrentDefaultFgColor();
COLORREF bgColor = (NppParameters::getInstance()).getCurrentDefaultBgColor(); const COLORREF bgColor = nppParam.getCurrentDefaultBgColor();
_availableList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200))); const size_t szColVer = dpiManager.scaleX(100);
_availableList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100))); const size_t szColName = szColVer * 2;
_availableList.setViewStyleOption(LVS_EX_CHECKBOXES);
_availableList.initView(_hInst, _hSelf);
ListView_SetBkColor(_availableList.getViewHwnd(), bgColor);
ListView_SetTextBkColor(_availableList.getViewHwnd(), bgColor);
ListView_SetTextColor(_availableList.getViewHwnd(), fgColor);
_availableList.reSizeView(listRect);
_updateList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200)));
_updateList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100)));
_updateList.setViewStyleOption(LVS_EX_CHECKBOXES);
_updateList.initView(_hInst, _hSelf);
ListView_SetBkColor(_updateList.getViewHwnd(), bgColor);
ListView_SetTextBkColor(_updateList.getViewHwnd(), bgColor);
ListView_SetTextColor(_updateList.getViewHwnd(), fgColor);
_updateList.reSizeView(listRect);
_installedList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200))); auto initListView = [&](PluginViewList& list) -> void {
_installedList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100))); list.addColumn(columnInfo(pluginStr, szColName));
_installedList.setViewStyleOption(LVS_EX_CHECKBOXES); list.addColumn(columnInfo(vesionStr, szColVer));
_installedList.initView(_hInst, _hSelf); list.setViewStyleOption(LVS_EX_CHECKBOXES);
ListView_SetBkColor(_installedList.getViewHwnd(), bgColor); list.initView(_hInst, _hSelf);
ListView_SetTextBkColor(_installedList.getViewHwnd(), bgColor); const HWND hList = list.getViewHwnd();
ListView_SetTextColor(_installedList.getViewHwnd(), fgColor); ListView_SetBkColor(hList, bgColor);
_installedList.reSizeView(listRect); ListView_SetTextBkColor(hList, bgColor);
ListView_SetTextColor(hList, fgColor);
list.reSizeView(listRect);
};
_incompatibleList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200))); initListView(_availableList);
_incompatibleList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100))); initListView(_updateList);
_incompatibleList.initView(_hInst, _hSelf); initListView(_installedList);
ListView_SetBkColor(_incompatibleList.getViewHwnd(), bgColor); initListView(_incompatibleList);
ListView_SetTextBkColor(_incompatibleList.getViewHwnd(), bgColor);
ListView_SetTextColor(_incompatibleList.getViewHwnd(), fgColor);
_incompatibleList.reSizeView(listRect);
HWND hDesc = ::GetDlgItem(_hSelf, IDC_PLUGINADM_EDIT);
::MoveWindow(hDesc, descRect.left, descRect.top, descRect.right, descRect.bottom, TRUE);
::InvalidateRect(hDesc, nullptr, TRUE);
switchDialog(0); switchDialog(0);
@ -276,7 +205,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
_repoLink.init(_hInst, _hSelf); _repoLink.init(_hInst, _hSelf);
_repoLink.create(::GetDlgItem(_hSelf, IDC_PLUGINLIST_ADDR), TEXT("https://github.com/notepad-plus-plus/nppPluginList")); _repoLink.create(::GetDlgItem(_hSelf, IDC_PLUGINLIST_ADDR), TEXT("https://github.com/notepad-plus-plus/nppPluginList"));
goToCenter(); goToCenter(SWP_SHOWWINDOW | SWP_NOSIZE);
} }
void PluginsAdminDlg::collectNppCurrentStatusInfos() void PluginsAdminDlg::collectNppCurrentStatusInfos()
@ -296,7 +225,7 @@ vector<PluginUpdateInfo*> PluginViewList::fromUiIndexesToPluginInfos(const std::
std::vector<PluginUpdateInfo*> r; std::vector<PluginUpdateInfo*> r;
size_t nb = _ui.nbItem(); size_t nb = _ui.nbItem();
for (auto i : uiIndexes) for (const auto &i : uiIndexes)
{ {
if (i < nb) if (i < nb)
{ {
@ -353,7 +282,7 @@ bool PluginsAdminDlg::exitToInstallRemovePlugins(Operation op, const vector<Plug
generic_string updaterParams = opStr; generic_string updaterParams = opStr;
TCHAR nppFullPath[MAX_PATH]; TCHAR nppFullPath[MAX_PATH]{};
::GetModuleFileName(NULL, nppFullPath, MAX_PATH); ::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
updaterParams += TEXT("\""); updaterParams += TEXT("\"");
updaterParams += nppFullPath; updaterParams += nppFullPath;
@ -363,7 +292,7 @@ bool PluginsAdminDlg::exitToInstallRemovePlugins(Operation op, const vector<Plug
updaterParams += nppParameters.getPluginRootDir(); updaterParams += nppParameters.getPluginRootDir();
updaterParams += TEXT("\""); updaterParams += TEXT("\"");
for (auto i : puis) for (const auto &i : puis)
{ {
if (op == pa_install || op == pa_update) if (op == pa_install || op == pa_update)
{ {
@ -458,12 +387,12 @@ bool PluginsAdminDlg::removePlugins()
void PluginsAdminDlg::changeTabName(LIST_TYPE index, const TCHAR *name2change) void PluginsAdminDlg::changeTabName(LIST_TYPE index, const TCHAR *name2change)
{ {
TCITEM tie; TCITEM tie{};
tie.mask = TCIF_TEXT; tie.mask = TCIF_TEXT;
tie.pszText = (TCHAR *)name2change; tie.pszText = (TCHAR *)name2change;
TabCtrl_SetItem(_tab.getHSelf(), index, &tie); TabCtrl_SetItem(_tab.getHSelf(), index, &tie);
TCHAR label[MAX_PATH]; TCHAR label[MAX_PATH]{};
_tab.getCurrentTitle(label, MAX_PATH); _tab.getCurrentTitle(label, MAX_PATH);
::SetWindowText(_hSelf, label); ::SetWindowText(_hSelf, label);
} }
@ -815,7 +744,7 @@ bool PluginsAdminDlg::updateList()
bool PluginsAdminDlg::initAvailablePluginsViewFromList() bool PluginsAdminDlg::initAvailablePluginsViewFromList()
{ {
TCHAR nppFullPathName[MAX_PATH]; TCHAR nppFullPathName[MAX_PATH]{};
GetModuleFileName(NULL, nppFullPathName, MAX_PATH); GetModuleFileName(NULL, nppFullPathName, MAX_PATH);
Version nppVer; Version nppVer;
@ -844,7 +773,7 @@ bool PluginsAdminDlg::initAvailablePluginsViewFromList()
bool PluginsAdminDlg::initIncompatiblePluginList() bool PluginsAdminDlg::initIncompatiblePluginList()
{ {
TCHAR nppFullPathName[MAX_PATH]; TCHAR nppFullPathName[MAX_PATH]{};
GetModuleFileName(NULL, nppFullPathName, MAX_PATH); GetModuleFileName(NULL, nppFullPathName, MAX_PATH);
Version nppVer; Version nppVer;
@ -878,7 +807,7 @@ bool PluginsAdminDlg::loadFromPluginInfos()
continue; continue;
// user file name (without ext. to find whole info in available list // user file name (without ext. to find whole info in available list
TCHAR fnNoExt[MAX_PATH]; TCHAR fnNoExt[MAX_PATH]{};
wcscpy_s(fnNoExt, i._fileName.c_str()); wcscpy_s(fnNoExt, i._fileName.c_str());
::PathRemoveExtension(fnNoExt); ::PathRemoveExtension(fnNoExt);
@ -1020,7 +949,7 @@ bool PluginViewList::hideFromPluginInfoPtr(PluginUpdateInfo* pluginInfo2hide)
bool PluginViewList::restore(const generic_string& folderName) bool PluginViewList::restore(const generic_string& folderName)
{ {
for (auto i : _list) for (const auto &i : _list)
{ {
if (i->_folderName == folderName) if (i->_folderName == folderName)
{ {
@ -1066,8 +995,8 @@ bool PluginsAdminDlg::checkUpdates()
// begin insentive-case search from the second key-in character // begin insentive-case search from the second key-in character
bool PluginsAdminDlg::searchInPlugins(bool isNextMode) const bool PluginsAdminDlg::searchInPlugins(bool isNextMode) const
{ {
const int maxLen = 256; constexpr int maxLen = 256;
TCHAR txt2search[maxLen]; TCHAR txt2search[maxLen]{};
::GetDlgItemText(_hSelf, IDC_PLUGINADM_SEARCH_EDIT, txt2search, maxLen); ::GetDlgItemText(_hSelf, IDC_PLUGINADM_SEARCH_EDIT, txt2search, maxLen);
if (lstrlen(txt2search) < 2) if (lstrlen(txt2search) < 2)
return false; return false;
@ -1210,35 +1139,24 @@ intptr_t CALLBACK PluginsAdminDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
{ {
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{ {
if (NppDarkMode::isEnabled()) return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
{
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
}
break;
} }
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
{ {
if (NppDarkMode::isEnabled()) return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
break;
} }
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{ {
if (NppDarkMode::isEnabled()) if (NppDarkMode::isEnabled())
{ {
HWND hwnd = reinterpret_cast<HWND>(lParam); const int dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast<HWND>(lParam));
if (hwnd == ::GetDlgItem(_hSelf, IDC_PLUGINADM_EDIT)) if (dlgCtrlID == IDC_PLUGINADM_EDIT)
{ {
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
} }
else return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
} }
break; break;
} }
@ -1319,13 +1237,13 @@ intptr_t CALLBACK PluginsAdminDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
switchDialog(indexClicked); switchDialog(indexClicked);
} }
} }
else if (pnmh->hwndFrom == _availableList.getViewHwnd() || else if (pnmh->hwndFrom == _availableList.getViewHwnd() ||
pnmh->hwndFrom == _updateList.getViewHwnd() || pnmh->hwndFrom == _updateList.getViewHwnd() ||
pnmh->hwndFrom == _installedList.getViewHwnd() || pnmh->hwndFrom == _installedList.getViewHwnd() ||
pnmh->hwndFrom == _incompatibleList.getViewHwnd()) pnmh->hwndFrom == _incompatibleList.getViewHwnd())
{ {
PluginViewList* pViewList; PluginViewList* pViewList = nullptr;
int buttonID; int buttonID = 0;
if (pnmh->hwndFrom == _availableList.getViewHwnd()) if (pnmh->hwndFrom == _availableList.getViewHwnd())
{ {

View File

@ -99,7 +99,7 @@ public:
PluginViewList() = default; PluginViewList() = default;
~PluginViewList() { ~PluginViewList() {
_ui.destroy(); _ui.destroy();
for (auto i : _list) for (auto& i : _list)
{ {
delete i; delete i;
} }
@ -114,7 +114,7 @@ public:
void setSelection(int index) const { _ui.setSelection(index); }; void setSelection(int index) const { _ui.setSelection(index); };
void initView(HINSTANCE hInst, HWND parent) { _ui.init(hInst, parent); }; void initView(HINSTANCE hInst, HWND parent) { _ui.init(hInst, parent); };
void addColumn(const columnInfo & column2Add) { _ui.addColumn(column2Add); }; void addColumn(const columnInfo & column2Add) { _ui.addColumn(column2Add); };
void reSizeView(RECT & rc) { _ui.reSizeTo(rc); } void reSizeView(RECT & rc) { _ui.reSizeToWH(rc); }
void setViewStyleOption(int32_t extraStyle) { _ui.setStyleOption(extraStyle); }; void setViewStyleOption(int32_t extraStyle) { _ui.setStyleOption(extraStyle); };
size_t nbItem() const { return _ui.nbItem(); }; size_t nbItem() const { return _ui.nbItem(); };
PluginUpdateInfo* getPluginInfoFromUiIndex(size_t index) const { return reinterpret_cast<PluginUpdateInfo*>(_ui.getLParamFromIndex(static_cast<int>(index))); }; PluginUpdateInfo* getPluginInfoFromUiIndex(size_t index) const { return reinterpret_cast<PluginUpdateInfo*>(_ui.getLParamFromIndex(static_cast<int>(index))); };
@ -145,24 +145,15 @@ public :
PluginsAdminDlg(); PluginsAdminDlg();
~PluginsAdminDlg() = default; ~PluginsAdminDlg() = default;
void init(HINSTANCE hInst, HWND parent) { void create(int dialogID, bool isRTL = false, bool msgDestParent = true) override;
Window::init(hInst, parent);
};
virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true); void doDialog(bool isRTL = false) {
if (!isCreated())
void doDialog(bool isRTL = false) {
if (!isCreated())
{ {
create(IDD_PLUGINSADMIN_DLG, isRTL); create(IDD_PLUGINSADMIN_DLG, isRTL);
} }
display();
if (!::IsWindowVisible(_hSelf)) };
{
}
display();
};
bool initFromJson(); bool initFromJson();
@ -188,7 +179,7 @@ public :
}; };
protected: protected:
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
private : private :
generic_string _updaterDir; generic_string _updaterDir;

View File

@ -18,25 +18,21 @@
#include "windows.h" #include "windows.h"
#include "pluginsAdminRes.h" #include "pluginsAdminRes.h"
#ifndef IDC_STATIC IDD_PLUGINSADMIN_DLG DIALOGEX 0, 0, 500, 265
#define IDC_STATIC -1
#endif
IDD_PLUGINSADMIN_DLG DIALOGEX 36, 44, 500, 300
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
CAPTION "Plugins Admin" CAPTION "Plugins Admin"
FONT 8, "MS Shell Dlg", 0, 0, 0x0 FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN BEGIN
RTEXT "Search: ",IDC_PLUGINADM_SEARCH_STATIC,50,38,50,8 RTEXT "&Search:",IDC_PLUGINADM_SEARCH_STATIC,16,20,50,8
EDITTEXT IDC_PLUGINADM_SEARCH_EDIT,160,35,150,14,ES_AUTOHSCROLL EDITTEXT IDC_PLUGINADM_SEARCH_EDIT,69,19,150,12,ES_AUTOHSCROLL
PUSHBUTTON "Next", IDC_PLUGINADM_RESEARCH_NEXT,332,35,57,14 PUSHBUTTON "&Next",IDC_PLUGINADM_RESEARCH_NEXT,222,18,60,14
PUSHBUTTON "Install", IDC_PLUGINADM_INSTALL,432,35,57,14 PUSHBUTTON "&Install",IDC_PLUGINADM_INSTALL,432,18,60,14
PUSHBUTTON "Update", IDC_PLUGINADM_UPDATE,432,35,57,14 PUSHBUTTON "&Update",IDC_PLUGINADM_UPDATE,432,18,60,14
PUSHBUTTON "Remove", IDC_PLUGINADM_REMOVE,432,35,57,14 PUSHBUTTON "&Remove",IDC_PLUGINADM_REMOVE,432,18,60,14
EDITTEXT IDC_PLUGINADM_EDIT,30,160,220,80,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_BORDER | WS_VSCROLL EDITTEXT IDC_PLUGINADM_EDIT,8,167,484,60,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
RTEXT "Plugin list version: ", IDC_PLUGINLIST_VERSION_STATIC,350,242,120,14 RTEXT "Plugin list version:",IDC_PLUGINLIST_VERSION_STATIC,348,234,120,8
RTEXT "", IDC_PLUGINLIST_VERSIONNUMBER_STATIC,467,242,22,14 RTEXT "",IDC_PLUGINLIST_VERSIONNUMBER_STATIC,467,234,22,8
RTEXT "Plugin list repository",IDC_PLUGINLIST_ADDR,369,257,120,14 RTEXT "Plugin list repository",IDC_PLUGINLIST_ADDR,369,247,120,14
PUSHBUTTON "Close", IDCANCEL, 225, 270, 57, 14 PUSHBUTTON "Close",IDCANCEL,220,245,60,14
END END

View File

@ -36,12 +36,23 @@ void StaticDialog::destroy()
::DestroyWindow(_hSelf); ::DestroyWindow(_hSelf);
} }
void StaticDialog::getMappedChildRect(HWND hChild, RECT& rcChild) const
{
::GetClientRect(hChild, &rcChild);
::MapWindowPoints(hChild, _hSelf, reinterpret_cast<LPPOINT>(&rcChild), 2);
}
void StaticDialog::getMappedChildRect(int idChild, RECT& rcChild) const
{
const HWND hChild = ::GetDlgItem(_hSelf, idChild);
getMappedChildRect(hChild, rcChild);
}
void StaticDialog::redrawDlgItem(const int nIDDlgItem, bool forceUpdate) const void StaticDialog::redrawDlgItem(const int nIDDlgItem, bool forceUpdate) const
{ {
RECT rcDlgItem{}; RECT rcDlgItem{};
const HWND hDlgItem = ::GetDlgItem(_hSelf, nIDDlgItem); const HWND hDlgItem = ::GetDlgItem(_hSelf, nIDDlgItem);
::GetClientRect(hDlgItem, &rcDlgItem); getMappedChildRect(hDlgItem, rcDlgItem);
::MapWindowPoints(hDlgItem, _hSelf, reinterpret_cast<LPPOINT>(&rcDlgItem), 2);
::InvalidateRect(_hSelf, &rcDlgItem, TRUE); ::InvalidateRect(_hSelf, &rcDlgItem, TRUE);
if (forceUpdate) if (forceUpdate)

View File

@ -43,10 +43,12 @@ public :
virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true); virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true);
virtual bool isCreated() const { virtual bool isCreated() const {
return (_hSelf != NULL); return (_hSelf != nullptr);
} }
void getMappedChildRect(HWND hChild, RECT& rcChild) const;
void getMappedChildRect(int idChild, RECT& rcChild) const;
void redrawDlgItem(const int nIDDlgItem, bool forceUpdate = false) const; void redrawDlgItem(const int nIDDlgItem, bool forceUpdate = false) const;
void goToCenter(UINT swpFlags = SWP_SHOWWINDOW); void goToCenter(UINT swpFlags = SWP_SHOWWINDOW);