[REGEDIT] Code formatting

This commit is contained in:
Katayama Hirofumi MZ 2018-10-15 23:13:06 +09:00 committed by Mark Jansen
parent 3849426432
commit b3231e0bf5
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B

View file

@ -43,6 +43,7 @@ extern void ResizeWnd(int cx, int cy)
HDWP hdwp = BeginDeferWindowPos(4); HDWP hdwp = BeginDeferWindowPos(4);
RECT rt, rs, rb; RECT rt, rs, rb;
const int tHeight = 22; const int tHeight = 22;
const UINT uFlags = SWP_NOZORDER | SWP_NOACTIVATE;
SetRect(&rt, 0, 0, cx, cy); SetRect(&rt, 0, 0, cx, cy);
cy = 0; cy = 0;
if (hStatusBar != NULL) if (hStatusBar != NULL)
@ -51,12 +52,29 @@ extern void ResizeWnd(int cx, int cy)
cy = rs.bottom - rs.top; cy = rs.bottom - rs.top;
} }
GetWindowRect(g_pChildWnd->hAddressBtnWnd, &rb); GetWindowRect(g_pChildWnd->hAddressBtnWnd, &rb);
cx = g_pChildWnd->nSplitPos + SPLIT_WIDTH/2; cx = g_pChildWnd->nSplitPos + SPLIT_WIDTH / 2;
if (hdwp) hdwp = DeferWindowPos(hdwp, g_pChildWnd->hAddressBarWnd, 0, rt.left, rt.top, rt.right-rt.left - 2*tHeight, tHeight, SWP_NOZORDER|SWP_NOACTIVATE); if (hdwp)
if (hdwp) hdwp = DeferWindowPos(hdwp, g_pChildWnd->hAddressBtnWnd, 0, rt.right - 2*tHeight, rt.top, 2*tHeight, tHeight, SWP_NOZORDER|SWP_NOACTIVATE); hdwp = DeferWindowPos(hdwp, g_pChildWnd->hAddressBarWnd, NULL,
if (hdwp) hdwp = DeferWindowPos(hdwp, g_pChildWnd->hTreeWnd, 0, rt.left, rt.top + tHeight+2, g_pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top-cy, SWP_NOZORDER|SWP_NOACTIVATE); rt.left, rt.top,
if (hdwp) hdwp = DeferWindowPos(hdwp, g_pChildWnd->hListWnd, 0, rt.left+cx, rt.top + tHeight+2, rt.right-cx, rt.bottom-rt.top-cy, SWP_NOZORDER|SWP_NOACTIVATE); rt.right - rt.left - 2*tHeight, tHeight,
if (hdwp) EndDeferWindowPos(hdwp); uFlags);
if (hdwp)
hdwp = DeferWindowPos(hdwp, g_pChildWnd->hAddressBtnWnd, NULL,
rt.right - 2*tHeight, rt.top,
2*tHeight, tHeight,
uFlags);
if (hdwp)
hdwp = DeferWindowPos(hdwp, g_pChildWnd->hTreeWnd, NULL,
rt.left, rt.top + tHeight + 2,
g_pChildWnd->nSplitPos - SPLIT_WIDTH/2 - rt.left, rt.bottom - rt.top - cy,
uFlags);
if (hdwp)
hdwp = DeferWindowPos(hdwp, g_pChildWnd->hListWnd, NULL,
rt.left + cx, rt.top + tHeight + 2,
rt.right - cx, rt.bottom - rt.top - cy,
uFlags);
if (hdwp)
EndDeferWindowPos(hdwp);
} }
/******************************************************************************* /*******************************************************************************
@ -143,14 +161,14 @@ static BOOL ChildWnd_CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
/* TODO */ /* TODO */
break; break;
case ID_TREE_EXPANDBRANCH: case ID_TREE_EXPANDBRANCH:
(void)TreeView_Expand(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_EXPAND); TreeView_Expand(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_EXPAND);
break; break;
case ID_TREE_COLLAPSEBRANCH: case ID_TREE_COLLAPSEBRANCH:
(void)TreeView_Expand(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_COLLAPSE); TreeView_Expand(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_COLLAPSE);
break; break;
case ID_TREE_RENAME: case ID_TREE_RENAME:
SetFocus(g_pChildWnd->hTreeWnd); SetFocus(g_pChildWnd->hTreeWnd);
(void)TreeView_EditLabel(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd)); TreeView_EditLabel(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd));
break; break;
case ID_TREE_DELETE: case ID_TREE_DELETE:
hSelection = TreeView_GetSelection(g_pChildWnd->hTreeWnd); hSelection = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
@ -312,7 +330,7 @@ UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath)
/* Wipe the listview, the status bar and the address bar if the root key was selected */ /* Wipe the listview, the status bar and the address bar if the root key was selected */
if (TreeView_GetParent(g_pChildWnd->hTreeWnd, hItem) == NULL) if (TreeView_GetParent(g_pChildWnd->hTreeWnd, hItem) == NULL)
{ {
(void)ListView_DeleteAllItems(g_pChildWnd->hListWnd); ListView_DeleteAllItems(g_pChildWnd->hListWnd);
SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)NULL); SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)NULL);
SendMessageW(g_pChildWnd->hAddressBarWnd, WM_SETTEXT, 0, (LPARAM)NULL); SendMessageW(g_pChildWnd->hAddressBarWnd, WM_SETTEXT, 0, (LPARAM)NULL);
return; return;
@ -610,7 +628,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
lResult = FALSE; lResult = FALSE;
RegCloseKey(hKey); RegCloseKey(hKey);
(void)TreeView_EditLabel(g_pChildWnd->hTreeWnd, ptvdi->item.hItem); TreeView_EditLabel(g_pChildWnd->hTreeWnd, ptvdi->item.hItem);
} }
else else
{ {
@ -728,18 +746,18 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
hti.pt.x = pt.x; hti.pt.x = pt.x;
hti.pt.y = pt.y; hti.pt.y = pt.y;
ScreenToClient(g_pChildWnd->hTreeWnd, &hti.pt); ScreenToClient(g_pChildWnd->hTreeWnd, &hti.pt);
(void)TreeView_HitTest(g_pChildWnd->hTreeWnd, &hti); TreeView_HitTest(g_pChildWnd->hTreeWnd, &hti);
} }
if (hti.flags & TVHT_ONITEM) if (hti.flags & TVHT_ONITEM)
{ {
hContextMenu = GetSubMenu(hPopupMenus, PM_TREECONTEXT); hContextMenu = GetSubMenu(hPopupMenus, PM_TREECONTEXT);
(void)TreeView_SelectItem(g_pChildWnd->hTreeWnd, hti.hItem); TreeView_SelectItem(g_pChildWnd->hTreeWnd, hti.hItem);
memset(&item, 0, sizeof(item)); memset(&item, 0, sizeof(item));
item.mask = TVIF_STATE | TVIF_CHILDREN; item.mask = TVIF_STATE | TVIF_CHILDREN;
item.hItem = hti.hItem; item.hItem = hti.hItem;
(void)TreeView_GetItem(g_pChildWnd->hTreeWnd, &item); TreeView_GetItem(g_pChildWnd->hTreeWnd, &item);
/* Set the Expand/Collapse menu item appropriately */ /* Set the Expand/Collapse menu item appropriately */
LoadStringW(hInst, (item.state & TVIS_EXPANDED) ? IDS_COLLAPSE : IDS_EXPAND, buffer, COUNT_OF(buffer)); LoadStringW(hInst, (item.state & TVIS_EXPANDED) ? IDS_COLLAPSE : IDS_EXPAND, buffer, COUNT_OF(buffer));