aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-17 17:49:43 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-17 17:49:43 +0200
commitbb22bc506676fd268ded3b3d6c7b7acea5dc2db9 (patch)
treef3df0eca434f86ddc70aab0410a5a4bcd4559b2a
parentcd5ff302d1b03edb6fe81254c585e0e88c8e71ee (diff)
downloadEpisodeBrowser-bb22bc506676fd268ded3b3d6c7b7acea5dc2db9.tar.gz
Update type names and variable prefixes.
-rw-r--r--README62
-rw-r--r--c/common.cpp2
-rw-r--r--c/datalistview.cpp6
-rw-r--r--c/episodelistview.cpp60
-rw-r--r--c/episodelistview.h2
-rw-r--r--c/listview.cpp10
-rw-r--r--c/listview.h2
-rw-r--r--c/main.cpp114
-rw-r--r--c/pl.cpp6
-rw-r--r--c/pl.h2
10 files changed, 147 insertions, 119 deletions
diff --git a/README b/README
index 8aeed8d..77e46d6 100644
--- a/README
+++ b/README
@@ -56,20 +56,48 @@ the project.
Hacking
~~~~~~~
-Like many Windows programs, Episode Browser uses Hungarian notation.
-Following is a list of prefixes commonly used in the code base:
-
- lp = pointer ("long/far pointer")
- b = boolean (BOOL, int)
- i = integer
- siz = size (size_t)
- h = handle
- l = long
- w = "word" (WPARAM)
- dw = "double word" (DWORD)
- sz = zero-terminated string (char *)
- wsz = ... wide string (wchar_t *)
- tsz = ... tstring (TCHAR *)
- sm = ... managed string (std::string)
- wsm = ... (std::wstring)
- tsm = ... (std::basic_string<TCHAR>)
+Following is a summary of some coding conventions used in the project.
+
+ ... HUNGARIAN NOTATION ...
+
+ - p = pointer
+ - b = bool, BOOL, int (boolean value)
+ - i = integer
+ - h = handle
+ - hX = X handle (e.g., hWnd = HWND)
+ - l = long, LPARAM
+ - w = WORD, WPARAM
+ - dw = DWORD
+ - lvi = LVITEM
+ - sz = unmangaged, zero-terminated string (char *)
+ - wsz = ... wide string (wchar_t *)
+ - tsz = ... tstring (TCHAR *)
+ - str = ... managed string (std::string)
+ - wstr = ... (std::wstring)
+ - tstr = ... (std::basic_string<TCHAR>)
+
+ ... TYPES ...
+
+Here are some general guidelines for choosing what types to use:
+
+1) Don't use Windows-specific types that "hide" pointers.
+2) Where there is a Windows-specific type with the same name and
+ function as a standard type (e.g., CHAR = char), prefer the
+ standard type.
+3) Otherwise, prefer the Windows-specific type when interacting with
+ the Windows API.
+
+For example, prefer...
+
+ - char* over LPSTR
+ - char const* over LPCSTR
+ - LVITEM* over LPLVITEM
+ - int over INT
+ - DWORD over unsigned long
+ (when interacting with the Windows API)
+
+Note...
+
+ - that the second rule above does not apply to BOOL, which should not
+ be replaced with bool, as BOOL is an integer that may have other
+ values than 1 and 0.
diff --git a/c/common.cpp b/c/common.cpp
index d109081..c485f5d 100644
--- a/c/common.cpp
+++ b/c/common.cpp
@@ -10,7 +10,7 @@ Win32Error::Win32Error(const DWORD dwErr)
NULL,
m_dwErr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPSTR)&m_szMsg,
+ (char*)&m_szMsg,
0, NULL
);
}
diff --git a/c/datalistview.cpp b/c/datalistview.cpp
index 855fd03..6262c41 100644
--- a/c/datalistview.cpp
+++ b/c/datalistview.cpp
@@ -11,7 +11,7 @@
#include "main.h"
#include "pl.h"
-extern EpisodeListView* const g_lpElv;
+extern EpisodeListView* const g_pElv;
DataListView::DataListView(const HWND hWndParent)
: ListView(hWndParent, (HMENU)IDC_DATALISTVIEW, LVS_NOCOLUMNHEADER)
@@ -69,7 +69,7 @@ void DataListView::ShowEpisode(const int iEpisode)
LVFINDINFO lvfi;
lvfi.flags = LVFI_PARAM;
lvfi.lParam = iEpisode;
- int iItem = ListView_FindItem(g_lpElv->Handle(), -1, &lvfi);
+ int iItem = ListView_FindItem(g_pElv->Handle(), -1, &lvfi);
if (iItem != -1)
- ListView_EnsureVisible(g_lpElv->Handle(), iItem, TRUE);
+ ListView_EnsureVisible(g_pElv->Handle(), iItem, TRUE);
}
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp
index e1119b4..706c51a 100644
--- a/c/episodelistview.cpp
+++ b/c/episodelistview.cpp
@@ -10,7 +10,7 @@
#include "listview.h"
#include "pl.h"
-extern DataListView* const g_lpDlv;
+extern DataListView* const g_pDlv;
int CALLBACK ElvSort(LPARAM, LPARAM, LPARAM);
EpisodeListView::EpisodeListView(const HWND hWndParent)
@@ -52,21 +52,21 @@ void EpisodeListView::EnsureFocusVisible()
LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
{
- const LPNMLISTVIEW lpNmLv = (LPNMLISTVIEW)lParam;
+ const NMLISTVIEW* const pNmLv = (NMLISTVIEW*)lParam;
- switch (lpNmLv->hdr.code) {
+ switch (pNmLv->hdr.code) {
case LVN_ITEMCHANGED: /* Select/focus episode. */
- if ((lpNmLv->uChanged & LVIF_STATE) &&
- (lpNmLv->uNewState & LVIS_FOCUSED)) {
- m_lviFocus.iItem = lpNmLv->iItem;
- m_lviFocus.lParam = lpNmLv->lParam;
+ if ((pNmLv->uChanged & LVIF_STATE) &&
+ (pNmLv->uNewState & LVIS_FOCUSED)) {
+ m_lviFocus.iItem = pNmLv->iItem;
+ m_lviFocus.lParam = pNmLv->lParam;
UpdateItem(&m_lviFocus);
- g_lpDlv->ShowEpisode(lpNmLv->lParam);
+ g_pDlv->ShowEpisode(pNmLv->lParam);
}
break;
case LVN_COLUMNCLICK: /* Sort by column. */
{
- const int iColumn = lpNmLv->iSubItem+1;
+ const int iColumn = pNmLv->iSubItem+1;
m_iSort = abs(m_iSort) == iColumn? -m_iSort: iColumn;
Pl("cfg","set_sort",m_iSort);
DoSort();
@@ -75,8 +75,8 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
}
case LVN_KEYDOWN: /* Navigate episodes by keyboard. */
{
- const LPNMLVKEYDOWN lpNmLvKd = (LPNMLVKEYDOWN)lParam;
- switch (lpNmLvKd->wVKey) {
+ const NMLVKEYDOWN *const pNmLvKd = (NMLVKEYDOWN*)lParam;
+ switch (pNmLvKd->wVKey) {
case VK_LEFT:
SelectUnwatched(-1);
break;
@@ -88,16 +88,16 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
}
case NM_CUSTOMDRAW: /* Make unwatched episodes bold. */
{
- const LPNMLVCUSTOMDRAW lpLvCd = (LPNMLVCUSTOMDRAW)lParam;
- switch (lpLvCd->nmcd.dwDrawStage) {
+ const NMLVCUSTOMDRAW* const pLvCd = (NMLVCUSTOMDRAW*)lParam;
+ switch (pLvCd->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
return CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:
{
extern HFONT g_fBold;
- if (!Pl("track_episodes","watched",lpLvCd->nmcd.lItemlParam)) {
- SelectObject(lpLvCd->nmcd.hdc, g_fBold);
+ if (!Pl("track_episodes","watched",pLvCd->nmcd.lItemlParam)) {
+ SelectObject(pLvCd->nmcd.hdc, g_fBold);
return CDRF_NEWFONT;
}
break;
@@ -195,7 +195,7 @@ s: ListView_SetItemState(m_hWnd, -1, LVIF_STATE, LVIS_SELECTED);
m_lviFocus.iItem = iItem;
m_lviFocus.lParam = iEpisode;
UpdateItem(&m_lviFocus);
- g_lpDlv->ShowEpisode(iEpisode);
+ g_pDlv->ShowEpisode(iEpisode);
}
/* Select next/previous unwatched episode. */
@@ -353,26 +353,26 @@ void EpisodeListView::Update()
}
/* Update episode name and rating. */
-void EpisodeListView::UpdateItem(const LPLVITEM lpLvi)
+void EpisodeListView::UpdateItem(const LVITEM* const pLvi)
{
TCHAR* tszName;
int iRating;
static TCHAR tszRating[3];
- if (!Pl("episode_data","episode_title",lpLvi->lParam,&tszName)) {
+ if (!Pl("episode_data","episode_title",pLvi->lParam,&tszName)) {
if (!Pl("episode_data","update_episode_data")) goto r;
- if (!Pl("episode_data","episode_title",lpLvi->lParam,&tszName))
+ if (!Pl("episode_data","episode_title",pLvi->lParam,&tszName))
goto r;
}
- ListView_SetItemText(m_hWnd, lpLvi->iItem, ELVSITITLE, tszName);
+ ListView_SetItemText(m_hWnd, pLvi->iItem, ELVSITITLE, tszName);
-r: if (!Pl("episode_data","episode_rating",lpLvi->lParam,&iRating)) {
- ListView_SetItemText(m_hWnd, lpLvi->iItem, ELVSIRATING, TEXT(""));
+r: if (!Pl("episode_data","episode_rating",pLvi->lParam,&iRating)) {
+ ListView_SetItemText(m_hWnd, pLvi->iItem, ELVSIRATING, TEXT(""));
return;
}
_stprintf_s(tszRating, sizeof(tszRating), TEXT("%d"), iRating);
- ListView_SetItemText(m_hWnd, lpLvi->iItem, ELVSIRATING, tszRating);
+ ListView_SetItemText(m_hWnd, pLvi->iItem, ELVSIRATING, tszRating);
}
LRESULT CALLBACK EpisodeListView::WndProc(const HWND hWnd, const UINT uMsg,
@@ -399,26 +399,26 @@ LRESULT CALLBACK EpisodeListView::WndProc(const HWND hWnd, const UINT uMsg,
int CALLBACK ElvSort(const LPARAM iItem1, const LPARAM iItem2, const LPARAM lExtra)
{
- EpisodeListView* const lpElv = (EpisodeListView*)lExtra;
+ EpisodeListView* const pElv = (EpisodeListView*)lExtra;
LVITEM lvi1, lvi2;
lvi1.mask = lvi2.mask = LVIF_PARAM;
lvi1.iItem = iItem1; lvi2.iItem = iItem2;
- if (!ListView_GetItem(lpElv->Handle(), &lvi1)) return 0;
- if (!ListView_GetItem(lpElv->Handle(), &lvi2)) return 0;
+ if (!ListView_GetItem(pElv->Handle(), &lvi1)) return 0;
+ if (!ListView_GetItem(pElv->Handle(), &lvi2)) return 0;
/* abs(m_iSort) is the 1-based index of the column to sort by.
* If m_iSort is negative, the order is descending. */
- const int iOrder = Cmp(lpElv->m_iSort, 0);
+ const int iOrder = Cmp(pElv->m_iSort, 0);
- switch (abs(lpElv->m_iSort)-1) {
+ switch (abs(pElv->m_iSort)-1) {
case ELVSIEPISODE:
return iOrder*Cmp(lvi1.lParam, lvi2.lParam);
case ELVSIRATING:
{
int iRating1, iRating2;
- iRating1 = lpElv->m_iSort > 0? 99: -1;
- iRating2 = lpElv->m_iSort > 0? 99: -1;
+ iRating1 = pElv->m_iSort > 0? 99: -1;
+ iRating2 = pElv->m_iSort > 0? 99: -1;
Pl("episode_data","episode_rating",lvi1.lParam,&iRating1);
Pl("episode_data","episode_rating",lvi2.lParam,&iRating2);
if (iRating1 == iRating2)
diff --git a/c/episodelistview.h b/c/episodelistview.h
index 45146e6..960f5a5 100644
--- a/c/episodelistview.h
+++ b/c/episodelistview.h
@@ -24,7 +24,7 @@ struct EpisodeListView : public ListView
void SelectUnwatched(int iDir);
void ShowFocus(void);
void Update(void);
- void UpdateItem(LPLVITEM lpLvi);
+ void UpdateItem(const LVITEM* pLvi);
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
private:
int m_iSort;
diff --git a/c/listview.cpp b/c/listview.cpp
index 3bec5ab..f70abe5 100644
--- a/c/listview.cpp
+++ b/c/listview.cpp
@@ -43,10 +43,10 @@ HWND ListView::Handle() const
return m_hWnd;
}
-void ListView::UpdateTheme(const int bThemeActive)
+void ListView::UpdateTheme(const BOOL bThemeActive)
{
DWORD dwStyle;
- LPTSTR tszTheme;
+ const TCHAR* tszTheme;
WORD wAction;
extern int g_bThemes;
@@ -76,7 +76,7 @@ LRESULT CALLBACK ListView::WndProc(const HWND hWnd, const UINT uMsg,
{
switch (uMsg) {
case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code) {
+ switch (((NMHDR*)lParam)->code) {
case HDN_ENDTRACK:
UpdateLayout();
return TRUE;
@@ -90,10 +90,10 @@ LRESULT CALLBACK ListView::WndProc(const HWND hWnd, const UINT uMsg,
LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
const LPARAM lParam)
{
- ListView* const lpLv = (ListView*)GetProp(hWnd, TEXT("this"));
+ ListView* const pLv = (ListView*)GetProp(hWnd, TEXT("this"));
if (uMsg == WM_DESTROY)
RemoveProp(hWnd, TEXT("this"));
- return lpLv? lpLv->WndProc(hWnd, uMsg, wParam, lParam): FALSE;
+ return pLv? pLv->WndProc(hWnd, uMsg, wParam, lParam): FALSE;
}
diff --git a/c/listview.h b/c/listview.h
index 08511d1..41b7613 100644
--- a/c/listview.h
+++ b/c/listview.h
@@ -8,7 +8,7 @@ struct ListView
ListView(HWND hWndParent, HMENU hMenu, DWORD dwStyle);
int Height(int bHeader = -1);
HWND Handle(void) const;
- virtual void UpdateTheme(int bThemeActive);
+ virtual void UpdateTheme(BOOL bThemeActive);
virtual LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
protected:
int m_bHeader = 1;
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);
}
diff --git a/c/pl.cpp b/c/pl.cpp
index dcabd78..fe65714 100644
--- a/c/pl.cpp
+++ b/c/pl.cpp
@@ -34,15 +34,15 @@ int Query::NextSolution()
return 0;
}
-int PL_get_tchars(const term_t t, TCHAR** const lpTsz, const int iFlags)
+int PL_get_tchars(const term_t t, TCHAR** const pTsz, const int iFlags)
{
#ifdef UNICODE
size_t len;
- if (!PL_get_wchars(t, &len, lpTsz, iFlags))
+ if (!PL_get_wchars(t, &len, pTsz, iFlags))
return 0;
return len;
#else
- if (!PL_get_chars(t, lpTsz, iFlags))
+ if (!PL_get_chars(t, pTsz, iFlags))
return 0;
return -1;
#endif
diff --git a/c/pl.h b/c/pl.h
index 14f6c43..c4694a9 100644
--- a/c/pl.h
+++ b/c/pl.h
@@ -4,7 +4,7 @@
#include <windows.h>
#include <SWI-Prolog.h>
-int PL_get_tchars(term_t t, TCHAR** lpTsz, int iFlags);
+int PL_get_tchars(term_t t, TCHAR** pTsz, int iFlags);
int Plx(const char* szMod, const char* szPred);
struct Query