diff --git a/src/UUPAssistant/AppDlg.cpp b/src/UUPAssistant/AppDlg.cpp index 31f208e..68bb0e2 100644 --- a/src/UUPAssistant/AppDlg.cpp +++ b/src/UUPAssistant/AppDlg.cpp @@ -11,7 +11,7 @@ using namespace std; using namespace Lourdle::UIFramework; AppDlg::AppDlg(WindowBase* Parent, SessionContext& ctx) - : DialogEx2(Parent, GetFontSize() * 60, GetFontSize() * 35, WS_CAPTION | WS_SYSMENU | DS_FIXEDSYS | DS_MODALFRAME, GetString(String_InstallApps)), + : DialogEx2(Parent, GetFontSize() * 60, GetFontSize() * 35, WS_CAPTION | WS_SYSMENU | DS_FIXEDSYS | DS_MODALFRAME | WS_SIZEBOX, GetString(String_InstallApps)), ctx(ctx), Browse(this, &AppDlg::BrowseFiles), ViewAppxFeatures(this, &AppDlg::ViewFeatures), Remove(this, &AppDlg::RemoveItems), Add(this, &AppDlg::AddFiles), InstallEdge(this, 0, ButtonStyle::AutoCheckbox), AppList(this, 0, WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_SINGLESEL), Path(this, 0), hRemoveOptionMenu(CreatePopupMenu()) @@ -214,12 +214,14 @@ struct AppxFeatureDlg : DialogEx2 bool bPreventCheck = false; void Init(); + void OnSize(BYTE type, int nClientWidth, int nClientHeight, WindowBatchPositioner wbp); + void OnGetMinMaxInfo(PMINMAXINFO pMinMaxInfo); bool OnClose(); void OnDraw(HDC hdc, RECT rect); LRESULT OnNotify(LPNMHDR pnmhdr); }; -AppxFeatureDlg::AppxFeatureDlg(AppDlg* Parent) : DialogEx2(Parent, GetFontSize() * 40, GetFontSize() * 40, WS_CAPTION | WS_BORDER | WS_SYSMENU | DS_FIXEDSYS | DS_MODALFRAME, GetString(String_ViewAppxFeatures)), +AppxFeatureDlg::AppxFeatureDlg(AppDlg* Parent) : DialogEx2(Parent, GetFontSize() * 40, GetFontSize() * 40, WS_CAPTION | WS_BORDER | WS_SYSMENU | DS_FIXEDSYS | DS_MODALFRAME | WS_SIZEBOX, GetString(String_ViewAppxFeatures)), bPreventCheck(!Parent->Remove.IsWindowEnabled()), AppxFeatureList(this, 0, WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_SINGLESEL), StubOption(this, 0, !Parent->Remove.IsWindowEnabled() ? ButtonStyle::Checkbox : ButtonStyle::AutoCheckbox) { } @@ -241,13 +243,8 @@ void AppxFeatureDlg::Init() AppxFeatureList.SetCheckState(index, true); } - AppxFeatureList.MoveWindow(pxUnit * 2, pxUnit * 5, pxUnit * 36, pxUnit * 31); - StubOption.SetWindowText(GetString(String_StubOptionInstallFull)); StubOption.SetCheck(GetParent()->ctx.bStubOptionInstallFull); - SIZE size; - StubOption.GetIdealSize(&size); - StubOption.MoveWindow(pxUnit * 39 - size.cx, pxUnit * 38 - size.cy / 2, size.cx, size.cy); String TipText = GetString(String_StubOptionTip); TTTOOLINFOW ti = { @@ -261,6 +258,21 @@ void AppxFeatureDlg::Init() StubOptionTip.SetMaxTipWidth(pxUnit * 30); } +void AppxFeatureDlg::OnSize(BYTE, int nClientWidth, int nClientHeight, WindowBatchPositioner wbp) +{ + int pxUnit = GetFontSize(); + wbp.MoveWindow(AppxFeatureList, pxUnit * 2, pxUnit * 5, nClientWidth - pxUnit * 4, nClientHeight - pxUnit * 9); + SIZE size; + StubOption.GetIdealSize(&size); + wbp.MoveWindow(StubOption, nClientWidth - pxUnit - size.cx, nClientHeight - pxUnit * 2 - size.cy / 2, size.cx, size.cy); +} + +void AppxFeatureDlg::OnGetMinMaxInfo(PMINMAXINFO pMinMaxInfo) +{ + pMinMaxInfo->ptMinTrackSize.x = GetFontSize() * 40; + pMinMaxInfo->ptMinTrackSize.y = GetFontSize() * 40; +} + void AppxFeatureDlg::OnDraw(HDC hdc, RECT rect) { rect.left = GetFontSize(); @@ -400,23 +412,32 @@ void AppDlg::Init() Remove.SetWindowText(GetString(String_Remove)); ViewAppxFeatures.SetWindowText(GetString(String_ViewAppxFeatures)); InstallEdge.SetWindowText(GetString(String_InstallEdge)); +} +void AppDlg::OnSize(BYTE, int nClientWidth, int nClientHeight, WindowBatchPositioner wbp) +{ int pxUnit = GetFontSize(); + wbp.MoveWindow(AppList, pxUnit, pxUnit, nClientWidth - pxUnit * 2, nClientHeight - pxUnit * 15); + wbp.MoveWindow(ViewAppxFeatures, pxUnit, nClientHeight - pxUnit * 13, pxUnit * 12, pxUnit * 2); + wbp.MoveWindow(Remove, nClientWidth - pxUnit * 6, nClientHeight - pxUnit * 13, pxUnit * 5, pxUnit * 2); + wbp.MoveWindow(Path, pxUnit, nClientHeight - pxUnit * 6, nClientWidth - pxUnit * 8, pxUnit * 2); + wbp.MoveWindow(Browse, nClientWidth - pxUnit * 6, nClientHeight - pxUnit * 6, pxUnit * 5, pxUnit * 2); + wbp.MoveWindow(Add, pxUnit, nClientHeight - pxUnit * 3, pxUnit * 5, pxUnit * 2); SIZE size; InstallEdge.GetIdealSize(&size); - InstallEdge.MoveWindow(pxUnit * 59 - size.cx, pxUnit * 33 - size.cy / 2, size.cx, size.cy); - AppList.MoveWindow(pxUnit, pxUnit, pxUnit * 58, pxUnit * 20); - Path.MoveWindow(pxUnit, pxUnit * 29, pxUnit * 52, pxUnit * 2); - Browse.MoveWindow(pxUnit * 54, pxUnit * 29, pxUnit * 5, pxUnit * 2); - Add.MoveWindow(pxUnit, pxUnit * 32, pxUnit * 5, pxUnit * 2); - Remove.MoveWindow(pxUnit * 54, pxUnit * 22, pxUnit * 5, pxUnit * 2); - ViewAppxFeatures.MoveWindow(pxUnit, pxUnit * 22, pxUnit * 12, pxUnit * 2); + wbp.MoveWindow(InstallEdge, nClientWidth - pxUnit - size.cx, nClientHeight - pxUnit * 2 - size.cy / 2, size.cx, size.cy); +} + +void AppDlg::OnGetMinMaxInfo(PMINMAXINFO pMinMaxInfo) +{ + pMinMaxInfo->ptMinTrackSize.x = GetFontSize() * 60; + pMinMaxInfo->ptMinTrackSize.y = GetFontSize() * 35; } void AppDlg::OnDraw(HDC hdc, RECT rect) { rect.left = GetFontSize(); - rect.top = rect.left * 25; + rect.top = rect.bottom - rect.left * 10; rect.right -= rect.left; int n = 0; diff --git a/src/UUPAssistant/DriverDlg.cpp b/src/UUPAssistant/DriverDlg.cpp index 5799fb8..1fdda8c 100644 --- a/src/UUPAssistant/DriverDlg.cpp +++ b/src/UUPAssistant/DriverDlg.cpp @@ -21,7 +21,7 @@ import Constants; constexpr int BaseDpi = 96; -DriverDlg::DriverDlg(WindowBase* Parent, SessionContext& ctx) : DialogEx2(Parent, GetFontSize() * 60, GetFontSize() * 49, WS_CAPTION | WS_BORDER | WS_SYSMENU | DS_FIXEDSYS | DS_MODALFRAME | WS_CLIPCHILDREN, GetString(String_AddDrivers)), +DriverDlg::DriverDlg(WindowBase* Parent, SessionContext& ctx) : DialogEx2(Parent, GetFontSize() * 60, GetFontSize() * 49, WS_CAPTION | WS_BORDER | WS_SYSMENU | DS_FIXEDSYS | DS_MODALFRAME | WS_CLIPCHILDREN | WS_SIZEBOX, GetString(String_AddDrivers)), ctx(ctx), DriverList(this, 0, WS_CHILD | WS_BORDER | WS_VISIBLE | LVS_SINGLESEL), BrowseDir(this, &DriverDlg::Browse), Path(this, 0), BrowseFiles(this, &DriverDlg::FileBrowse), Recurse(this, 0, ButtonStyle::AutoCheckbox), ForceUnsigned(this, 0, ButtonStyle::AutoCheckbox), AddDriverFromInstalledOS(this, &DriverDlg::ScanInstalledDrivers), Add(this, &DriverDlg::AddItems), Remove(this, &DriverDlg::PopMenu), hRemoveOptionMenu(CreatePopupMenu()) @@ -66,29 +66,40 @@ void DriverDlg::Init() AddDriverFromInstalledOS.SetWindowText(GetString(String_AddDriverFromInstalledOS)); ForceUnsigned.SetCheck(ctx.bForceUnsigned); Recurse.SetCheck(BST_CHECKED); + CenterWindow(Parent); +} +void DriverDlg::OnSize(BYTE, int nClientWidth, int nClientHeight, WindowBatchPositioner wbp) +{ int pxUnit = GetFontSize(); - DriverList.MoveWindow(pxUnit, pxUnit, pxUnit * 58, pxUnit * 30); - Remove.MoveWindow(pxUnit, pxUnit * 32, pxUnit * 5, pxUnit * 2); - AddDriverFromInstalledOS.MoveWindow(pxUnit * 47, pxUnit * 32, pxUnit * 12, pxUnit * 2); + wbp.MoveWindow(DriverList, pxUnit, pxUnit, nClientWidth - pxUnit * 2, nClientHeight - pxUnit * 19); + wbp.MoveWindow(Remove, pxUnit, nClientHeight - pxUnit * 17, pxUnit * 5, pxUnit * 2); + wbp.MoveWindow(AddDriverFromInstalledOS, nClientWidth - pxUnit * 13, nClientHeight - pxUnit * 17, pxUnit * 12, pxUnit * 2); SIZE size; ForceUnsigned.GetIdealSize(&size); - ForceUnsigned.MoveWindow(pxUnit, pxUnit * 35, size.cx, size.cy); + wbp.MoveWindow(ForceUnsigned, pxUnit, nClientHeight - pxUnit * 14, size.cx, size.cy); + int nForceUnsignedHeight = size.cy; Recurse.GetIdealSize(&size); - Recurse.MoveWindow(pxUnit, pxUnit * 35 + size.cy, size.cx, size.cy); - Path.MoveWindow(pxUnit, pxUnit * 43, pxUnit * 50, pxUnit * 2); - BrowseDir.MoveWindow(pxUnit * 52, pxUnit * 43, pxUnit * 7, pxUnit * 2); - BrowseFiles.MoveWindow(pxUnit * 54, pxUnit * 46, pxUnit * 5, pxUnit * 2); - Add.MoveWindow(pxUnit, pxUnit * 46, pxUnit * 5, pxUnit * 2); - Ring->MoveWindow(pxUnit * 7, pxUnit * 46, pxUnit * 2, pxUnit * 2); - CenterWindow(Parent); + wbp.MoveWindow(Recurse, pxUnit, nClientHeight - pxUnit * 14 + nForceUnsignedHeight, size.cx, size.cy); + wbp.MoveWindow(Path, pxUnit, nClientHeight - pxUnit * 6, nClientWidth - pxUnit * 10, pxUnit * 2); + wbp.MoveWindow(BrowseDir, nClientWidth - pxUnit * 8, nClientHeight - pxUnit * 6, pxUnit * 7, pxUnit * 2); + wbp.MoveWindow(BrowseFiles, nClientWidth - pxUnit * 6, nClientHeight - pxUnit * 3, pxUnit * 5, pxUnit * 2); + wbp.MoveWindow(Add, pxUnit, nClientHeight - pxUnit * 3, pxUnit * 5, pxUnit * 2); + if (Ring) + wbp.MoveWindow(*Ring, pxUnit * 7, nClientHeight - pxUnit * 3, pxUnit * 2, pxUnit * 2); +} + +void DriverDlg::OnGetMinMaxInfo(PMINMAXINFO pMinMaxInfo) +{ + pMinMaxInfo->ptMinTrackSize.x = GetFontSize() * 60; + pMinMaxInfo->ptMinTrackSize.y = GetFontSize() * 49; } void DriverDlg::OnDraw(HDC hdc, RECT rect) { rect.left = GetFontSize(); rect.right -= rect.left; - rect.bottom = static_cast(rect.left * 42.5); + rect.bottom -= static_cast(rect.left * 6.5); DrawText(hdc, ResStrFormat(String_AddDrv, DriverList.GetItemCount()), @@ -892,9 +903,9 @@ void DriverDlg::ScanInstalledDrivers() std::vector InstalledDrivers; - ScanDrivers(DriverDlg* Parent) : DialogEx2(Parent, GetFontSize() * 30, GetFontSize() * 40, WS_CAPTION | WS_BORDER | WS_SYSMENU | DS_FIXEDSYS | DS_MODALFRAME, GetString(String_AddDrivers)), + ScanDrivers(DriverDlg* Parent) : DialogEx2(Parent, GetFontSize() * 30, GetFontSize() * 40, WS_CAPTION | WS_BORDER | WS_SYSMENU | DS_FIXEDSYS | DS_MODALFRAME | WS_SIZEBOX, GetString(String_AddDrivers)), Drivers(this), Add(this, &ScanDrivers::AddDrivers, ButtonStyle::SplitButton), SelectAll(this, &ScanDrivers::SelectAllClicked), SelectInvert(this, &ScanDrivers::SelectInvertClicked), - Export(this, &ScanDrivers::ExportDrivers), DriverDetail(this, 0, DWORD(WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL)), hAddMenu(CreatePopupMenu()) + Export(this, &ScanDrivers::ExportDrivers), DriverDetail(this, 0, DWORD(WS_CHILD | ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL)), hAddMenu(CreatePopupMenu()) { WORD id = Random(); AppendMenuW(hAddMenu, 0, id, GetString(String_ExportToTempDirAndAdd)); @@ -1009,8 +1020,9 @@ void DriverDlg::ScanInstalledDrivers() Ring.reset(); - Drivers.MoveWindow(GetFontSize(), GetFontSize(), GetFontSize() * 28, GetFontSize() * 24); - DriverDetail.MoveWindow(GetFontSize(), GetFontSize() * 26, GetFontSize() * 28, GetFontSize() * 10); + Drivers.ShowWindow(SW_SHOW); + DriverDetail.ShowWindow(SW_SHOW); + Add.EnableWindow(true); SelectAll.EnableWindow(true); SelectInvert.EnableWindow(true); @@ -1050,6 +1062,10 @@ void DriverDlg::ScanInstalledDrivers() List.reset(); Ring->MoveWindow(GetFontSize() * 13, GetFontSize() * 14, GetFontSize() * 4, GetFontSize() * 4); Ring->Start(); + Add.ShowWindow(SW_SHOW); + SelectAll.ShowWindow(SW_SHOW); + SelectInvert.ShowWindow(SW_SHOW); + Export.ShowWindow(SW_SHOW); Scan(pPath->c_str()); Invalidate(); } @@ -1068,6 +1084,12 @@ void DriverDlg::ScanInstalledDrivers() SelectInvert.SetWindowText(GetString(String_SelectInvert)); Export.SetWindowText(GetString(String_Export)); + Add.ShowWindow(SW_HIDE); + SelectAll.ShowWindow(SW_HIDE); + SelectInvert.ShowWindow(SW_HIDE); + Export.ShowWindow(SW_HIDE); + Drivers.ShowWindow(SW_HIDE); + List = std::make_unique(this, GetFontSize(), GetFontSize() * 5, GetFontSize() * 28, GetFontSize() * 33); Ring = std::make_unique(this, true); @@ -1097,17 +1119,38 @@ void DriverDlg::ScanInstalledDrivers() CenterWindow(Parent); } + void OnSize(BYTE, int nClientWidth, int nClientHeight, WindowBatchPositioner wbp) + { + int pxUnit = GetFontSize(); + wbp.MoveWindow(Drivers, pxUnit, pxUnit, nClientWidth - pxUnit * 2, nClientHeight - pxUnit * 16); + wbp.MoveWindow(DriverDetail, pxUnit, nClientHeight - pxUnit * 14, nClientWidth - pxUnit * 2, pxUnit * 10); + wbp.MoveWindow(SelectAll, pxUnit, nClientHeight - pxUnit * 3, pxUnit * 5, pxUnit * 2); + wbp.MoveWindow(SelectInvert, pxUnit * 7, nClientHeight - pxUnit * 3, pxUnit * 5, pxUnit * 2); + wbp.MoveWindow(Export, pxUnit * 13, nClientHeight - pxUnit * 3, pxUnit * 5, pxUnit * 2); + wbp.MoveWindow(Add, nClientWidth - pxUnit * 7, nClientHeight - pxUnit * 3, pxUnit * 6, pxUnit * 2); + if (List) + { + RECT rect; + GetClientRect(&rect); + wbp.MoveWindow(*List, pxUnit, pxUnit * 5, rect.right - pxUnit * 2, rect.bottom - pxUnit * 7); + } + if (Ring && Ring->IsWindowVisible()) + wbp.MoveWindow(*Ring, nClientWidth / 2 - pxUnit * 2, nClientHeight / 2 - pxUnit * 2, pxUnit * 4, pxUnit * 4); + } + + void OnGetMinMaxInfo(PMINMAXINFO pMinMaxInfo) + { + pMinMaxInfo->ptMinTrackSize.x = GetFontSize() * 30; + pMinMaxInfo->ptMinTrackSize.y = GetFontSize() * 40; + } + void Scan(PCWSTR pszImagePath) { Add.EnableWindow(false); SelectAll.EnableWindow(false); SelectInvert.EnableWindow(false); Export.EnableWindow(false); - Add.MoveWindow(GetFontSize() * 23, GetFontSize() * 37, GetFontSize() * 6, GetFontSize() * 2); - SelectAll.MoveWindow(GetFontSize(), GetFontSize() * 37, GetFontSize() * 5, GetFontSize() * 2); - SelectInvert.MoveWindow(GetFontSize() * 7, GetFontSize() * 37, GetFontSize() * 5, GetFontSize() * 2); - Export.MoveWindow(GetFontSize() * 13, GetFontSize() * 37, GetFontSize() * 5, GetFontSize() * 2); - + PROCESS_INFORMATION pi; STARTUPINFOW si = { sizeof(si) }; WCHAR szPath[MAX_PATH]; diff --git a/src/UUPAssistant/UUPAssistant.h b/src/UUPAssistant/UUPAssistant.h index 0d68ec2..4a5b307 100644 --- a/src/UUPAssistant/UUPAssistant.h +++ b/src/UUPAssistant/UUPAssistant.h @@ -152,6 +152,8 @@ struct AppDlg : Lourdle::UIFramework::DialogEx2ptMinTrackSize.x = GetFontSize(nullptr) * 45; + pMinMaxInfo->ptMinTrackSize.y = GetFontSize(nullptr) * 50; +} + void UpdateDlg::OnDraw(HDC hdc, RECT rect) { - rect.top = GetFontSize(nullptr) * 35; - rect.left = rect.top / 35; + rect.left = GetFontSize(nullptr); + rect.top = rect.bottom - rect.left * 15; rect.right -= rect.left; - rect.bottom = rect.left * 43; + rect.bottom -= rect.left * 7; DrawText(hdc, ResStrFormat(String_AddUpdates, ctx.UpdateVector.size()), -1, &rect, DT_WORDBREAK | DT_BOTTOM); }