fixed some resizing bugs

svn path=/trunk/; revision=19560
This commit is contained in:
Thomas Bluemel 2005-11-25 16:30:41 +00:00
parent 8cef988efb
commit e383ee91cc

View file

@ -58,6 +58,7 @@ typedef struct _HARDWARE_PAGE_DATA
HWND hWnd; HWND hWnd;
HWND hWndDevList; HWND hWndDevList;
HINSTANCE hComCtl32; /* only save this to keep track of the references */ HINSTANCE hComCtl32; /* only save this to keep track of the references */
INT DevListViewHeight;
SP_CLASSIMAGELIST_DATA ClassImageListData; SP_CLASSIMAGELIST_DATA ClassImageListData;
HWPAGE_DISPLAYMODE DisplayMode; HWPAGE_DISPLAYMODE DisplayMode;
@ -188,8 +189,6 @@ FillDevicesList(IN PHARDWARE_PAGE_DATA hpd)
if (HwNewDevInfo != NULL) if (HwNewDevInfo != NULL)
{ {
DevInfo->HwDevInfo = HwNewDevInfo; DevInfo->HwDevInfo = HwNewDevInfo;
DevInfo->HwDevInfo[DevInfo->ItemCount].ClassDevInfo = DevInfo;
DevInfo->HwDevInfo[DevInfo->ItemCount++].DevInfoData = DevInfoData;
} }
else else
{ {
@ -203,18 +202,16 @@ FillDevicesList(IN PHARDWARE_PAGE_DATA hpd)
DevInfo->HwDevInfo = HeapAlloc(GetProcessHeap(), DevInfo->HwDevInfo = HeapAlloc(GetProcessHeap(),
0, 0,
sizeof(HWDEVINFO)); sizeof(HWDEVINFO));
if (DevInfo->HwDevInfo != NULL) if (DevInfo->HwDevInfo == NULL)
{
DevInfo->HwDevInfo[DevInfo->ItemCount].ClassDevInfo = DevInfo;
DevInfo->HwDevInfo[DevInfo->ItemCount++].DevInfoData = DevInfoData;
}
else
{ {
DPRINT1("Unable to allocate memory for a SP_DEVINFO_DATA structures!\n"); DPRINT1("Unable to allocate memory for a SP_DEVINFO_DATA structures!\n");
break; break;
} }
} }
DevInfo->HwDevInfo[DevInfo->ItemCount].ClassDevInfo = DevInfo;
DevInfo->HwDevInfo[DevInfo->ItemCount++].DevInfoData = DevInfoData;
if ((SetupDiGetDeviceRegistryProperty(DevInfo->hDevInfo, if ((SetupDiGetDeviceRegistryProperty(DevInfo->hDevInfo,
&DevInfoData, &DevInfoData,
SPDRP_FRIENDLYNAME, SPDRP_FRIENDLYNAME,
@ -327,7 +324,7 @@ HardwareDlgResize(IN PHARDWARE_PAGE_DATA hpd,
{ {
HDWP dwp; HDWP dwp;
HWND hControl, hButton; HWND hControl, hButton;
INT Width, x, y, TopBias = 0; INT Width, x, y;
RECT rc, rcButton; RECT rc, rcButton;
POINT pt = {0}; POINT pt = {0};
POINT ptMargin = {0}; POINT ptMargin = {0};
@ -368,19 +365,14 @@ HardwareDlgResize(IN PHARDWARE_PAGE_DATA hpd,
hpd->hWnd, hpd->hWnd,
&pt, &pt,
1); 1);
if (hpd->DisplayMode == HWPD_LARGELIST) y = pt.y + hpd->DevListViewHeight + ptMargin.y;
{
/* increase the size of the list view control by 2/3 */
TopBias = ((rc.bottom - rc.top) * 2) / 3;
}
y = pt.y + TopBias + rc.bottom - rc.top + ptMargin.y;
if (!(dwp = DeferWindowPos(dwp, if (!(dwp = DeferWindowPos(dwp,
hpd->hWndDevList, hpd->hWndDevList,
NULL, NULL,
0, 0,
0, 0,
Width, Width,
rc.bottom - rc.top + TopBias, hpd->DevListViewHeight,
SWP_NOMOVE | SWP_NOZORDER))) SWP_NOMOVE | SWP_NOZORDER)))
{ {
return; return;
@ -572,8 +564,21 @@ HardwareDlgProc(IN HWND hwndDlg,
SetupDiGetClassImageList(&hpd->ClassImageListData); SetupDiGetClassImageList(&hpd->ClassImageListData);
/* calculate the size of the devices list view control */
hpd->hWndDevList = GetDlgItem(hwndDlg, hpd->hWndDevList = GetDlgItem(hwndDlg,
IDC_LV_DEVICES); IDC_LV_DEVICES);
if (hpd->hWndDevList != NULL)
{
RECT rcClient;
GetClientRect(hpd->hWndDevList,
&rcClient);
hpd->DevListViewHeight = rcClient.bottom;
if (hpd->DisplayMode == HWPD_LARGELIST)
{
hpd->DevListViewHeight = (hpd->DevListViewHeight * 3) / 2;
}
}
/* subclass the parent window */ /* subclass the parent window */
hWndParent = GetAncestor(hwndDlg, hWndParent = GetAncestor(hwndDlg,
@ -790,7 +795,6 @@ Cleanup:
* NOTE * NOTE
* *
*/ */
HWND HWND
WINAPI WINAPI
DeviceCreateHardwarePage(IN HWND hWndParent, DeviceCreateHardwarePage(IN HWND hWndParent,