[POWERCFG] Fix indentation and coding style. No code changes!

This commit is contained in:
Eric Kohl 2019-04-23 00:09:10 +02:00
parent 8fb2a2dd12
commit 22411ef223
2 changed files with 94 additions and 81 deletions

View file

@ -47,31 +47,32 @@ GetSystrayPowerIconState(VOID)
static VOID static VOID
AddItem(HWND hDlgCtrl, INT ResourceId, LPARAM lParam, POWER_ACTION * lpAction) AddItem(HWND hDlgCtrl, INT ResourceId, LPARAM lParam, POWER_ACTION * lpAction)
{ {
TCHAR szBuffer[MAX_PATH]; TCHAR szBuffer[MAX_PATH];
LRESULT Index; LRESULT Index;
if (LoadString(hApplet, ResourceId, szBuffer, MAX_PATH) < MAX_PATH)
{ if (LoadString(hApplet, ResourceId, szBuffer, MAX_PATH) < MAX_PATH)
Index = SendMessage(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)szBuffer);
if (Index != CB_ERR)
{ {
SendMessage(hDlgCtrl, CB_SETITEMDATA, (WPARAM)Index, lParam); Index = SendMessage(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)szBuffer);
lpAction[Index] = (POWER_ACTION)lParam; if (Index != CB_ERR)
{
SendMessage(hDlgCtrl, CB_SETITEMDATA, (WPARAM)Index, lParam);
lpAction[Index] = (POWER_ACTION)lParam;
}
} }
}
} }
static INT static INT
FindActionIndex(POWER_ACTION * lpAction, DWORD dwActionSize, POWER_ACTION poAction) FindActionIndex(POWER_ACTION * lpAction, DWORD dwActionSize, POWER_ACTION poAction)
{ {
INT Index; INT Index;
for (Index = 0; Index < (INT)dwActionSize; Index++) for (Index = 0; Index < (INT)dwActionSize; Index++)
{ {
if (lpAction[Index] == poAction) if (lpAction[Index] == poAction)
return Index; return Index;
} }
return -1; return -1;
} }
static BOOLEAN static BOOLEAN
@ -175,26 +176,31 @@ SaveCurrentPowerActionPolicy(IN HWND hDlgCtrl,
switch(ItemData) switch(ItemData)
{ {
case PowerActionNone: case PowerActionNone:
Policy->Action = PowerActionNone; Policy->Action = PowerActionNone;
Policy->EventCode = POWER_FORCE_TRIGGER_RESET; Policy->EventCode = POWER_FORCE_TRIGGER_RESET;
break; break;
case PowerActionWarmEject:
Policy->Action = PowerActionNone; case PowerActionWarmEject:
Policy->EventCode = POWER_USER_NOTIFY_BUTTON; Policy->Action = PowerActionNone;
break; Policy->EventCode = POWER_USER_NOTIFY_BUTTON;
case PowerActionShutdown: break;
Policy->Action = PowerActionNone;
Policy->EventCode = POWER_USER_NOTIFY_SHUTDOWN; case PowerActionShutdown:
break; Policy->Action = PowerActionNone;
case PowerActionSleep: Policy->EventCode = POWER_USER_NOTIFY_SHUTDOWN;
case PowerActionHibernate: break;
Policy->Action = (POWER_ACTION)ItemData;
Policy->EventCode = 0; case PowerActionSleep:
break; case PowerActionHibernate:
default: Policy->Action = (POWER_ACTION)ItemData;
return FALSE; Policy->EventCode = 0;
break;
default:
return FALSE;
} }
Policy->Flags = (POWER_ACTION_UI_ALLOWED | POWER_ACTION_QUERY_ALLOWED); Policy->Flags = (POWER_ACTION_UI_ALLOWED | POWER_ACTION_QUERY_ALLOWED);
return TRUE; return TRUE;
@ -372,8 +378,8 @@ Adv_InitDialog(VOID)
if (bHibernate) if (bHibernate)
{ {
AddItem(hList2, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate, g_PowerButton); AddItem(hList2, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate, g_PowerButton);
} }
if (bShutdown) if (bShutdown)
{ {
AddItem(hList2, IDS_PowerActionShutdown, (LPARAM)PowerActionShutdown, g_PowerButton); AddItem(hList2, IDS_PowerActionShutdown, (LPARAM)PowerActionShutdown, g_PowerButton);
@ -516,35 +522,37 @@ AdvancedDlgProc(HWND hwndDlg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
switch(uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
hAdv = hwndDlg; hAdv = hwndDlg;
Adv_InitDialog(); Adv_InitDialog();
return TRUE; return TRUE;
break;
case WM_COMMAND: case WM_COMMAND:
switch(LOWORD(wParam)) switch (LOWORD(wParam))
{
case IDC_SYSTRAYBATTERYMETER:
case IDC_PASSWORDLOGON:
case IDC_VIDEODIMDISPLAY:
if (HIWORD(wParam) == BN_CLICKED)
{ {
PropSheet_Changed(GetParent(hwndDlg), hwndDlg); case IDC_SYSTRAYBATTERYMETER:
case IDC_PASSWORDLOGON:
case IDC_VIDEODIMDISPLAY:
if (HIWORD(wParam) == BN_CLICKED)
{
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
case IDC_LIDCLOSE:
case IDC_POWERBUTTON:
case IDC_SLEEPBUTTON:
if (HIWORD(wParam) == CBN_SELCHANGE)
{
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
} }
break; break;
case IDC_LIDCLOSE:
case IDC_POWERBUTTON: case WM_NOTIFY:
case IDC_SLEEPBUTTON:
if (HIWORD(wParam) == CBN_SELCHANGE)
{
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
}
break;
case WM_NOTIFY:
{ {
LPNMHDR lpnm = (LPNMHDR)lParam; LPNMHDR lpnm = (LPNMHDR)lParam;
if (lpnm->code == (UINT)PSN_APPLY) if (lpnm->code == (UINT)PSN_APPLY)
@ -553,6 +561,7 @@ AdvancedDlgProc(HWND hwndDlg,
} }
return TRUE; return TRUE;
} }
} }
return FALSE;
return FALSE;
} }

View file

@ -73,7 +73,7 @@ Hib_SaveData(HWND hwndDlg)
bHibernate = (BOOLEAN)(IsDlgButtonChecked(hwndDlg, IDC_HIBERNATEFILE) == BST_CHECKED); bHibernate = (BOOLEAN)(IsDlgButtonChecked(hwndDlg, IDC_HIBERNATEFILE) == BST_CHECKED);
if (CallNtPowerInformation(SystemReserveHiberFile,&bHibernate, sizeof(bHibernate), NULL, 0) == STATUS_SUCCESS) if (CallNtPowerInformation(SystemReserveHiberFile, &bHibernate, sizeof(bHibernate), NULL, 0) == STATUS_SUCCESS)
{ {
Pos_InitData(); Pos_InitData();
Adv_InitDialog(); Adv_InitDialog();
@ -91,22 +91,25 @@ HibernateDlgProc(HWND hwndDlg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
switch(uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
Hib_InitDialog(hwndDlg); Hib_InitDialog(hwndDlg);
return TRUE; return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam)) case WM_COMMAND:
{ switch (LOWORD(wParam))
case IDC_HIBERNATEFILE:
if (HIWORD(wParam) == BN_CLICKED)
{ {
PropSheet_Changed(GetParent(hwndDlg), hwndDlg); case IDC_HIBERNATEFILE:
if (HIWORD(wParam) == BN_CLICKED)
{
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
} }
} break;
break;
case WM_NOTIFY: case WM_NOTIFY:
{ {
LPNMHDR lpnm = (LPNMHDR)lParam; LPNMHDR lpnm = (LPNMHDR)lParam;
if (lpnm->code == (UINT)PSN_APPLY) if (lpnm->code == (UINT)PSN_APPLY)
@ -114,6 +117,7 @@ HibernateDlgProc(HWND hwndDlg,
return Hib_SaveData(hwndDlg); return Hib_SaveData(hwndDlg);
} }
} }
} }
return FALSE;
return FALSE;
} }