aboutsummaryrefslogtreecommitdiff
path: root/c/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c/main.cpp')
-rw-r--r--c/main.cpp114
1 files changed, 57 insertions, 57 deletions
diff --git a/c/main.cpp b/c/main.cpp
index 36738c5..1950295 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -11,8 +11,8 @@
#include "main.h"
#include "pl.h"
-DataListView* g_lpDlv = nullptr;
-EpisodeListView* g_lpElv = nullptr;
+DataListView* g_pDlv = nullptr;
+EpisodeListView* g_pElv = nullptr;
atom_t g_aThread;
char g_szLimitScreenwriter[64] = {0};
@@ -35,7 +35,7 @@ static INT_PTR CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM);
static HWND CreateStatusBar(HWND, HINSTANCE);
static void UpdateTheme(void);
-int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, const LPSTR lpCmdLine, const INT nCmdShow)
+int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, const int nCmdShow)
{
/* Exit gracefully on uncaught exception. */
std::set_terminate(OnTerminate);
@@ -111,8 +111,8 @@ int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, const LPSTR lpCmd
/* Populate episode list view. */
Pl("track_episodes","update_tracked_episodes");
- g_lpElv->Update();
- g_lpElv->RestoreFocus();
+ g_pElv->Update();
+ g_pElv->RestoreFocus();
MSG msg;
while (GetMessage(&msg, NULL, 0, 0) > 0) {
@@ -162,8 +162,8 @@ static LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)
g_iDPI = GetDpiForWindow(g_hWnd);
/* Create child windows. */
- g_lpDlv = new DataListView(g_hWnd);
- g_lpElv = new EpisodeListView(g_hWnd);
+ g_pDlv = new DataListView(g_hWnd);
+ g_pElv = new EpisodeListView(g_hWnd);
/* Get saved view settings. */
char* sz;
@@ -181,7 +181,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
{
UpdateTheme();
SetWindowPos(hWnd, NULL, -1, -1, Dpi(510), Dpi(400), SWP_NOMOVE);
- SetFocus(g_lpElv->Handle());
+ SetFocus(g_pElv->Handle());
/* Set menu item checkmarks according to saved settings. */
CheckMenuItem(GetMenu(hWnd), IDM_VIEW_WATCHED,
@@ -196,7 +196,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
DestroyWindow(hWnd);
break;
case WM_DESTROY:
- g_lpElv->SaveFocus();
+ g_pElv->SaveFocus();
PostQuitMessage(0);
break;
case WM_SIZE:
@@ -205,9 +205,9 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
break;
case WM_GETMINMAXINFO:
{
- LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
- lpMMI->ptMinTrackSize.x = Dpi(220);
- lpMMI->ptMinTrackSize.y = Dpi(220);
+ MINMAXINFO* const pMMI = (MINMAXINFO*)lParam;
+ pMMI->ptMinTrackSize.x = Dpi(220);
+ pMMI->ptMinTrackSize.y = Dpi(220);
break;
}
case WM_THEMECHANGED:
@@ -215,7 +215,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
break;
case 0x02E0: /* WM_DPICHANGED */
{
- const LPRECT lpr = (LPRECT)lParam;
+ const RECT* const lpr = (RECT*)lParam;
g_iDPI = HIWORD(wParam);
SetWindowPos(hWnd, NULL,
lpr->left, lpr->top,
@@ -234,13 +234,13 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
case WA_CLICKACTIVE:
SetFocus(g_hFocus);
Pl("track_episodes","update_tracked_episodes");
- g_lpElv->Redraw();
+ g_pElv->Redraw();
}
break;
case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
+ switch (((NMHDR*)lParam)->idFrom) {
case IDC_EPISODELISTVIEW:
- return g_lpElv->HandleNotify(lParam);
+ return g_pElv->HandleNotify(lParam);
}
break;
case WM_TIMER:
@@ -261,7 +261,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
} else {
i = 0;
KillTimer(hWnd, IDT_TIMER);
- g_lpElv->Update();
+ g_pElv->Update();
}
break;
}
@@ -273,7 +273,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
PostMessage(hWnd, WM_CLOSE, 0, 0);
break;
case IDM_FILE_REFRESH:
- g_lpElv->Update();
+ g_pElv->Update();
break;
case IDM_FILE_FETCH_DATA:
if (g_bThread) break;
@@ -300,16 +300,16 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
g_bViewWatched? MF_UNCHECKED: MF_CHECKED);
g_bViewWatched = !g_bViewWatched;
Pl("cfg","set_view_watched",g_bViewWatched);
- g_lpElv->Update();
- g_lpElv->EnsureFocusVisible();
+ g_pElv->Update();
+ g_pElv->EnsureFocusVisible();
break;
case IDM_VIEW_TV_ORIGINAL:
CheckMenuItem(GetMenu(hWnd), IDM_VIEW_TV_ORIGINAL,
g_bViewTVOriginal? MF_UNCHECKED: MF_CHECKED);
g_bViewTVOriginal = !g_bViewTVOriginal;
Pl("cfg","set_view_tv_original",g_bViewTVOriginal);
- g_lpElv->Update();
- g_lpElv->EnsureFocusVisible();
+ g_pElv->Update();
+ g_pElv->EnsureFocusVisible();
break;
case IDM_VIEW_OTHERS: /* Show/hide other screenwriters. */
if (g_szLimitScreenwriter[0]) {
@@ -317,13 +317,13 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
MF_CHECKED);
g_szLimitScreenwriter[0] = 0;
} else {
- const int iEpFocus = ListView_GetNextItem(g_lpElv->Handle(), -1, LVNI_FOCUSED);
+ const int iEpFocus = ListView_GetNextItem(g_pElv->Handle(), -1, LVNI_FOCUSED);
if (iEpFocus == -1) break;
LVITEM lvi;
lvi.iItem = iEpFocus;
lvi.mask = LVIF_PARAM;
- if (!ListView_GetItem(g_lpElv->Handle(), &lvi)) break;
+ if (!ListView_GetItem(g_pElv->Handle(), &lvi)) break;
char* sz;
if (!Pl("episode_data","episode_datum",lvi.lParam,"Screenwriter",&sz))
@@ -334,8 +334,8 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
MF_UNCHECKED);
}
Pl("cfg","set_limit_screenwriter",g_szLimitScreenwriter);
- g_lpElv->Update();
- g_lpElv->EnsureFocusVisible();
+ g_pElv->Update();
+ g_pElv->EnsureFocusVisible();
break;
case IDM_WATCH_LOCALLY:
case IDM_WATCH_ONLINE:
@@ -364,8 +364,8 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
lvi.mask = LVIF_PARAM;
lvi.iItem = -1;
while ((lvi.iItem = ListView_GetNextItem(
- g_lpElv->Handle(), lvi.iItem, LVNI_SELECTED)) != -1) {
- if (!ListView_GetItem(g_lpElv->Handle(), &lvi)) goto b;
+ g_pElv->Handle(), lvi.iItem, LVNI_SELECTED)) != -1) {
+ if (!ListView_GetItem(g_pElv->Handle(), &lvi)) goto b;
switch (LOWORD(wParam)) {
case IDM_WATCH_LOCALLY:
@@ -376,18 +376,18 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
break;
case IDM_TOGGLE:
Pl("track_episodes","toggle_episode",lvi.lParam);
- g_lpElv->Redraw();
+ g_pElv->Redraw();
break;
case IDM_FORGET:
Pl("track_episodes","forget_episode",lvi.lParam);
Pl("track_episodes","update_tracked_episodes");
- g_lpElv->Redraw();
+ g_pElv->Redraw();
break;
case IDM_LOOKUP:
Pl("episode_data","retract_episode",lvi.lParam);
- g_lpElv->UpdateItem(&lvi);
- g_lpElv->Redraw();
- g_lpDlv->ShowEpisode(lvi.lParam);
+ g_pElv->UpdateItem(&lvi);
+ g_pElv->Redraw();
+ g_pDlv->ShowEpisode(lvi.lParam);
break;
case IDM_WIKI:
Pl("episode_data","open_episode_wiki",lvi.lParam);
@@ -425,7 +425,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
case IDM_RATE0:
iRating = 0;
r: Pl("episode_data","rate_episode",lvi.lParam,iRating);
- g_lpElv->UpdateItem(&lvi);
+ g_pElv->UpdateItem(&lvi);
break;
}
}
@@ -441,9 +441,9 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
case IDM_RATE2:
case IDM_RATE1:
case IDM_RATE0:
- g_lpElv->Redraw();
- g_lpElv->DoSort();
- g_lpElv->ShowFocus();
+ g_pElv->Redraw();
+ g_pElv->DoSort();
+ g_pElv->ShowFocus();
}
b: break;
}
@@ -481,7 +481,7 @@ HWND CreateStatusBar(const HWND hWndParent, const HINSTANCE hInstance)
return CreateWindowEx(
0,
STATUSCLASSNAME,
- (LPCTSTR) NULL,
+ (const TCHAR*)NULL,
WS_CHILD|WS_VISIBLE|SBARS_SIZEGRIP,
0, 0, 0, 0,
hWndParent,
@@ -503,24 +503,24 @@ void UpdateLayout()
yStatus = rcStatus.bottom-rcStatus.top;
/* Resize data list view. */
- SendMessage(g_lpDlv->Handle(), WM_SETREDRAW, FALSE, 0);
- SendMessage(g_lpElv->Handle(), WM_SETREDRAW, FALSE, 0);
- cyDlv = rc.bottom-yStatus-g_lpDlv->Height();
- MoveWindow(g_lpDlv->Handle(), 0, cyDlv, rc.right, rc.bottom-yStatus-cyDlv, TRUE);
- ListView_SetColumnWidth(g_lpDlv->Handle(), DLVSIKEY, LVSCW_AUTOSIZE);
- cxColumn = ListView_GetColumnWidth(g_lpDlv->Handle(), 0)+4;
- ListView_SetColumnWidth(g_lpDlv->Handle(), DLVSIKEY, cxColumn);
- ListView_SetColumnWidth(g_lpDlv->Handle(), DLVSIVALUE, rc.right-cxColumn-g_cxVScroll-4);
+ SendMessage(g_pDlv->Handle(), WM_SETREDRAW, FALSE, 0);
+ SendMessage(g_pElv->Handle(), WM_SETREDRAW, FALSE, 0);
+ cyDlv = rc.bottom-yStatus-g_pDlv->Height();
+ MoveWindow(g_pDlv->Handle(), 0, cyDlv, rc.right, rc.bottom-yStatus-cyDlv, TRUE);
+ ListView_SetColumnWidth(g_pDlv->Handle(), DLVSIKEY, LVSCW_AUTOSIZE);
+ cxColumn = ListView_GetColumnWidth(g_pDlv->Handle(), 0)+4;
+ ListView_SetColumnWidth(g_pDlv->Handle(), DLVSIKEY, cxColumn);
+ ListView_SetColumnWidth(g_pDlv->Handle(), DLVSIVALUE, rc.right-cxColumn-g_cxVScroll-4);
/* Resize episode list view. */
- MoveWindow(g_lpElv->Handle(), 0, 0, rc.right, cyDlv+1, TRUE);
- ListView_SetColumnWidth(g_lpElv->Handle(), ELVSIEPISODE, LVSCW_AUTOSIZE);
- cxColumn = ListView_GetColumnWidth(g_lpElv->Handle(), ELVSIEPISODE)+4;
- ListView_SetColumnWidth(g_lpElv->Handle(), ELVSIEPISODE, cxColumn);
- cxColumn += ListView_GetColumnWidth(g_lpElv->Handle(), ELVSIRATING);
- ListView_SetColumnWidth(g_lpElv->Handle(), ELVSITITLE, rc.right-cxColumn-g_cxVScroll-4);
- SendMessage(g_lpElv->Handle(), WM_SETREDRAW, TRUE, 0);
- SendMessage(g_lpDlv->Handle(), WM_SETREDRAW, TRUE, 0);
+ MoveWindow(g_pElv->Handle(), 0, 0, rc.right, cyDlv+1, TRUE);
+ ListView_SetColumnWidth(g_pElv->Handle(), ELVSIEPISODE, LVSCW_AUTOSIZE);
+ cxColumn = ListView_GetColumnWidth(g_pElv->Handle(), ELVSIEPISODE)+4;
+ ListView_SetColumnWidth(g_pElv->Handle(), ELVSIEPISODE, cxColumn);
+ cxColumn += ListView_GetColumnWidth(g_pElv->Handle(), ELVSIRATING);
+ ListView_SetColumnWidth(g_pElv->Handle(), ELVSITITLE, rc.right-cxColumn-g_cxVScroll-4);
+ SendMessage(g_pElv->Handle(), WM_SETREDRAW, TRUE, 0);
+ SendMessage(g_pDlv->Handle(), WM_SETREDRAW, TRUE, 0);
/* Resize status bar parts. */
const int aParts[] = {rc.right-Dpi(55), rc.right};
@@ -531,7 +531,7 @@ void UpdateLayout()
void UpdateTheme()
{
if (!g_bThemes) return;
- const int bThemeActive = IsThemeActive();
- g_lpDlv->UpdateTheme(bThemeActive);
- g_lpElv->UpdateTheme(bThemeActive);
+ const BOOL bThemeActive = IsThemeActive();
+ g_pDlv->UpdateTheme(bThemeActive);
+ g_pElv->UpdateTheme(bThemeActive);
}