aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c/datalistview.c6
-rw-r--r--c/episodelistview.c12
-rw-r--r--c/listview.c37
-rw-r--r--c/main.c56
4 files changed, 53 insertions, 58 deletions
diff --git a/c/datalistview.c b/c/datalistview.c
index 385b384..9911887 100644
--- a/c/datalistview.c
+++ b/c/datalistview.c
@@ -46,8 +46,10 @@ DlvShowEpisode(int iEpisode)
PI(t,iEpisode) goto e;
P("episode_data","lookup_episode_local",3,t) goto e;
- /* The episode data is a list of unary compounds,
- * whose functor is the key and whose argument is the value. */
+ /* The episode data is a list of unary compounds,
+ * whose functor is the key and whose argument is the value.
+ * (Perhaps this should really be implemented in Prolog.)
+ */
{
term_t tHead, tList;
diff --git a/c/episodelistview.c b/c/episodelistview.c
index ea1d627..9aa73ef 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -45,7 +45,7 @@ ElvHandleNotify(LPARAM lParam)
switch (lpNmLv->hdr.code) {
case LVN_ITEMCHANGED:
if ((lpNmLv->uChanged & LVIF_STATE)
- && (lpNmLv->uNewState & LVIS_FOCUSED)) {
+ && (lpNmLv->uNewState & LVIS_FOCUSED)) {
LpLviElvSelection->iItem = lpNmLv->iItem;
LpLviElvSelection->lParam = lpNmLv->lParam;
ElvUpdateName(LpLviElvSelection);
@@ -87,8 +87,8 @@ b: Fd(f);
extern HMENU HPopupMenu;
dwPos = GetMessagePos();
TrackPopupMenu(HPopupMenu, TPM_RIGHTBUTTON,
- LOWORD(dwPos), HIWORD(dwPos), 0,
- HWnd, NULL);
+ LOWORD(dwPos), HIWORD(dwPos), 0,
+ HWnd, NULL);
break;
}
}
@@ -99,7 +99,7 @@ void
ElvRedraw()
{
RedrawWindow(HElv, NULL, NULL,
- RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_ALLCHILDREN);
+ RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_ALLCHILDREN);
}
void
@@ -134,7 +134,7 @@ ElvSelectRecent()
if (iItem > 5)
ElvSetTop(iItem-5);
ListView_SetItemState(HElv, iItem,
- LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
+ LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
LpLviElvSelection->iItem = iItem;
LpLviElvSelection->lParam = iEpisode;
ElvUpdateName(LpLviElvSelection);
@@ -215,7 +215,7 @@ e: Fd(f2);
ElvSetTop(iTop);
if (LpLviElvSelection)
ListView_SetItemState(HElv, LpLviElvSelection->iItem,
- LVIS_SELECTED, LVIS_SELECTED);
+ LVIS_SELECTED, LVIS_SELECTED);
SendMessage(HElv, WM_SETREDRAW, TRUE, 0);
ElvRedraw();
diff --git a/c/listview.c b/c/listview.c
index 2c24048..40c3108 100644
--- a/c/listview.c
+++ b/c/listview.c
@@ -16,22 +16,21 @@ LvCreate(HMENU hMenu)
HWND hLv;
hLv = CreateWindowEx(
- WS_EX_CLIENTEDGE,
- WC_LISTVIEW,
- TEXT(""),
- WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP
- |LVS_REPORT|LVS_NOSORTHEADER,
- 0, 0, 0, 0,
- HWnd, hMenu, GetModuleHandle(NULL), NULL
+ WS_EX_CLIENTEDGE,
+ WC_LISTVIEW,
+ TEXT(""),
+ WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP
+ |LVS_REPORT|LVS_NOSORTHEADER,
+ 0, 0, 0, 0,
+ HWnd, hMenu, GetModuleHandle(NULL), NULL
);
LvPrevProc = (WNDPROC)SetWindowLongPtr(hLv,
- GWLP_WNDPROC, (LONG_PTR)LvProc);
+ GWLP_WNDPROC, (LONG_PTR)LvProc);
ListView_SetExtendedListViewStyle(hLv, LVS_EX_FULLROWSELECT);
- SendMessage(hLv, WM_SETFONT,
- (WPARAM)HfNormal, MAKELPARAM(FALSE, 0));
+ SendMessage(hLv, WM_SETFONT, (WPARAM)HfNormal, MAKELPARAM(FALSE, 0));
return hLv;
}
@@ -53,16 +52,16 @@ LvProc(HWND hLv, UINT uMsg, WPARAM wParam, LPARAM lParam)
extern HWND HElv;
extern LPLVITEM LpLviElvSelection;
- /* For the episode list view, the Enter key should not
- * be handled by the dialog manager, but instead be sent
- * along to the main window procedure, so that it may be
- * handled by the NM_RETURN case in ElvHandleNotify.
- */
+ /* For the episode list view, the Enter key should not
+ * be handled by the dialog manager, but instead be sent
+ * along to the main window procedure, so that it may be
+ * handled by the NM_RETURN case in ElvHandleNotify.
+ */
if (hLv != HElv) break;
lResult = CallWindowProc(LvPrevProc, hLv, uMsg, wParam, lParam);
if (lParam && ((MSG *)lParam)->message == WM_KEYDOWN
- && ((MSG *)lParam)->wParam == VK_RETURN)
+ && ((MSG *)lParam)->wParam == VK_RETURN)
return DLGC_WANTMESSAGE;
return lResult;
}
@@ -75,10 +74,8 @@ void
LvSetTheme(HWND hLv, int bUseTheme)
{
ListView_SetExtendedListViewStyleEx(hLv,
- LVS_EX_DOUBLEBUFFER,
- bUseTheme ? LVS_EX_DOUBLEBUFFER : 0);
+ LVS_EX_DOUBLEBUFFER, bUseTheme ? LVS_EX_DOUBLEBUFFER : 0);
SendMessage(hLv, WM_CHANGEUISTATE,
- MAKEWPARAM(bUseTheme ? UIS_SET : UIS_CLEAR,
- UISF_HIDEFOCUS), 0);
+ MAKEWPARAM(bUseTheme ? UIS_SET : UIS_CLEAR, UISF_HIDEFOCUS), 0);
SetWindowTheme(hLv, bUseTheme ? TEXT("Explorer") : NULL, NULL);
}
diff --git a/c/main.c b/c/main.c
index 3dd5eb7..4fc5999 100644
--- a/c/main.c
+++ b/c/main.c
@@ -43,30 +43,29 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
tszErr = TEXT("Could not initialize common controls.");
if (!InitCommonControlsEx(&icc)) goto f;
- HPopupMenu = LoadMenu(NULL,
- MAKEINTRESOURCE(IDR_POPUPMENU));
+ HPopupMenu = LoadMenu(NULL, MAKEINTRESOURCE(IDR_POPUPMENU));
HPopupMenu = GetSubMenu(HPopupMenu, 0);
memset(&wc, 0, sizeof(WNDCLASSEX));
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.lpfnWndProc = WndProc;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU);
- wc.lpszClassName = TEXT("EpisodeBrowser");
- wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.lpfnWndProc = WndProc;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU);
+ wc.lpszClassName = TEXT("EpisodeBrowser");
+ wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
tszErr = TEXT("Could not register window class.");
if (!RegisterClassEx(&wc)) goto f;
hWnd = CreateWindowEx(
- 0,
- TEXT("EpisodeBrowser"),
- TEXT("Episode Browser"),
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT, 510, 400,
- NULL, NULL, hInstance, NULL
+ 0,
+ TEXT("EpisodeBrowser"),
+ TEXT("Episode Browser"),
+ WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT, CW_USEDEFAULT, 510, 400,
+ NULL, NULL, hInstance, NULL
);
tszErr = TEXT("Could not create main window.");
if (!hWnd) goto f;
@@ -121,7 +120,7 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case WA_ACTIVE:
SetFocus(HElv);
- /* no break */
+ /* FALLTHROUGH */
case WA_CLICKACTIVE:
F(f);
t = T(0);
@@ -146,10 +145,10 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case ID_FILE_ABOUT:
DialogBox(
- GetModuleHandle(NULL),
- MAKEINTRESOURCE(IDD_ABOUT),
- hWnd,
- AboutDlgProc
+ GetModuleHandle(NULL),
+ MAKEINTRESOURCE(IDD_ABOUT),
+ hWnd,
+ AboutDlgProc
);
break;
case ID_WATCH:
@@ -253,11 +252,10 @@ SetupFonts()
NONCLIENTMETRICS m;
m.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
- sizeof(NONCLIENTMETRICS), &m, 0);
+ sizeof(NONCLIENTMETRICS), &m, 0);
HfNormal = CreateFontIndirect(&m.lfMessageFont);
- } else {
+ } else
HfNormal = GetStockObject(DEFAULT_GUI_FONT);
- }
GetObject(HfNormal, sizeof(LOGFONT), &lf);
lf.lfWeight = FW_BOLD;
@@ -287,8 +285,7 @@ UpdateLayout()
MoveWindow(hDlv, 0, cyDlv, rc.right, rc.bottom, TRUE);
cxColumn = ListView_GetColumnWidth(hDlv, 0);
- ListView_SetColumnWidth(hDlv, 1,
- rc.right-cxColumn-cxVScroll-4);
+ ListView_SetColumnWidth(hDlv, 1, rc.right-cxColumn-cxVScroll-4);
/* Resize episode list view. */
@@ -296,8 +293,7 @@ UpdateLayout()
MoveWindow(hElv, 0, 0, rc.right, cyDlv+1, TRUE);
cxColumn = ListView_GetColumnWidth(hElv, 0);
- ListView_SetColumnWidth(hElv, 1,
- rc.right-cxColumn-cxVScroll-4);
+ ListView_SetColumnWidth(hElv, 1, rc.right-cxColumn-cxVScroll-4);
}
void
@@ -310,7 +306,7 @@ UpdateTheme()
if (bTheming == -1) {
HMODULE hModule;
hModule = LoadLibrary(TEXT("uxtheme.dll"));
- bTheming = hModule && GetProcAddress(hModule, "SetWindowTheme");
+ bTheming = hModule && GetProcAddress(hModule,"SetWindowTheme");
}
if (!bTheming) return;
bThemeActive = IsThemeActive();