aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-15 02:03:30 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-15 02:03:30 +0200
commit2f6bd216d1411bd6ec96eaebf815dc3d5ab5a2f4 (patch)
treef4ab4b455502c558a3c855f0ea7e164b1e246e04 /c/episodelistview.cpp
parent095954fe8c0d1a64d8696d0ad0cd0ed395dd6c54 (diff)
downloadEpisodeBrowser-2f6bd216d1411bd6ec96eaebf815dc3d5ab5a2f4.tar.gz
Reimplement Pl with variadic templates
This is a bit safer and about as complex.
Diffstat (limited to 'c/episodelistview.cpp')
-rw-r--r--c/episodelistview.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp
index 8273e08..6430b17 100644
--- a/c/episodelistview.cpp
+++ b/c/episodelistview.cpp
@@ -29,7 +29,7 @@ EpisodeListView::EpisodeListView() : ListView((HMENU)IDC_EPISODELISTVIEW, 0)
lvc.cx = Dpi(30);
ListView_InsertColumn(m_hWnd, ELVSIRATING, &lvc);
- if (!Pl("cfg","get_sort","i",&m_iSort))
+ if (!Pl("cfg","get_sort",&m_iSort))
m_iSort = 1;
}
@@ -63,7 +63,7 @@ LRESULT EpisodeListView::HandleNotify(LPARAM lParam)
{
int iColumn = lpNmLv->iSubItem+1;
m_iSort = abs(m_iSort) == iColumn? -m_iSort: iColumn;
- Pl("cfg","set_sort","I",m_iSort);
+ Pl("cfg","set_sort",m_iSort);
DoSort();
ShowFocus();
break;
@@ -91,7 +91,7 @@ LRESULT EpisodeListView::HandleNotify(LPARAM lParam)
case CDDS_ITEMPREPAINT:
{
extern HFONT g_fBold;
- if (!Pl("track_episodes","watched","I",lpLvCd->nmcd.lItemlParam)) {
+ if (!Pl("track_episodes","watched",lpLvCd->nmcd.lItemlParam)) {
SelectObject(lpLvCd->nmcd.hdc, g_fBold);
return CDRF_NEWFONT;
}
@@ -102,9 +102,9 @@ LRESULT EpisodeListView::HandleNotify(LPARAM lParam)
}
case NM_DBLCLK: /* Open clicked episode. */
{
- if (!Pl("local_episodes","open_episode_locally","I",
+ if (!Pl("local_episodes","open_episode_locally",
m_lviFocus.lParam))
- Pl("local_episodes","open_episode_online","I",
+ Pl("local_episodes","open_episode_online",
m_lviFocus.lParam);
break;
}
@@ -116,9 +116,9 @@ LRESULT EpisodeListView::HandleNotify(LPARAM lParam)
while ((lvi.iItem = ListView_GetNextItem(
m_hWnd, lvi.iItem, LVNI_SELECTED)) != -1) {
if (!ListView_GetItem(m_hWnd, &lvi)) goto b;
- if (!Pl("local_episodes","open_episode_locally","I",
+ if (!Pl("local_episodes","open_episode_locally",
lvi.lParam))
- Pl("local_episodes","open_episode_online","I",
+ Pl("local_episodes","open_episode_online",
lvi.lParam);
}
b: break;
@@ -150,7 +150,7 @@ void EpisodeListView::SaveFocus()
lvi.mask = LVIF_PARAM;
if ((lvi.iItem = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED)) != -1
&& ListView_GetItem(m_hWnd, &lvi))
- Pl("cfg","set_focus","I",lvi.lParam);
+ Pl("cfg","set_focus",lvi.lParam);
}
void EpisodeListView::SetTop(int iItem)
@@ -167,7 +167,7 @@ void EpisodeListView::RestoreFocus()
LVFINDINFO lvfi;
iItem = 0;
- if (!Pl("cfg","get_focus","i",&iEpisode)) return;
+ if (!Pl("cfg","get_focus",&iEpisode)) return;
lvfi.flags = LVFI_PARAM;
lvfi.lParam = iEpisode;
@@ -214,7 +214,7 @@ void EpisodeListView::SelectUnwatched(int iDir)
do {
if (!Pl("track_episodes",iDir > 0? "next_unwatched": "previous_unwatched",
- "Ii",lvfi.lParam,&iEpNew))
+ lvfi.lParam,&iEpNew))
return;
lvfi.lParam = iEpNew;
@@ -276,23 +276,23 @@ void EpisodeListView::Update()
SendMessage(m_hWnd, WM_SETREDRAW, FALSE, 0);
ListView_DeleteAllItems(m_hWnd);
- if (!Pl("episode_data","ensure_episode_data","")) return;
- if (!Pl("episode_data","episode_count","i",&cEp)) return;
+ if (!Pl("episode_data","ensure_episode_data")) return;
+ if (!Pl("episode_data","episode_count",&cEp)) return;
for (iEp = 1, iItem = 0; iEp <= cEp; iEp++) {
extern char g_szLimitScreenwriter[];
extern int g_bViewTVOriginal, g_bViewWatched;
if (g_szLimitScreenwriter[0])
- if (!Pl("episode_data","episode_datum","ISS",
+ if (!Pl("episode_data","episode_datum",
iEp,"Screenwriter",g_szLimitScreenwriter))
continue;
if (!g_bViewWatched)
- if (Pl("track_episodes","watched","I",iEp)) continue;
+ if (Pl("track_episodes","watched",iEp)) continue;
if (!g_bViewTVOriginal)
- if (Pl("episode_data","tv_original","I",iEp)) continue;
+ if (Pl("episode_data","tv_original",iEp)) continue;
/* Format episode number string. */
_stprintf_s(tszEpisode, sizeof(tszEpisode), TEXT("%d"), iEp);
@@ -358,16 +358,16 @@ void EpisodeListView::UpdateItem(LPLVITEM lpLvi)
static TCHAR tszRating[3];
tszName = NULL;
- if (!Pl("episode_data","episode_title","Is",lpLvi->lParam,&szName)) {
- if (!Pl("episode_data","update_episode_data","")) goto r;
- if (!Pl("episode_data","episode_title","Is",lpLvi->lParam,&szName))
+ if (!Pl("episode_data","episode_title",lpLvi->lParam,&szName)) {
+ if (!Pl("episode_data","update_episode_data")) goto r;
+ if (!Pl("episode_data","episode_title",lpLvi->lParam,&szName))
goto r;
}
tszName = TszFromSz(szName, CP_UTF8);
if (tszName)
ListView_SetItemText(m_hWnd, lpLvi->iItem, ELVSITITLE, tszName);
-r: if (!Pl("episode_data","episode_rating","Ii",lpLvi->lParam,&iRating)) {
+r: if (!Pl("episode_data","episode_rating",lpLvi->lParam,&iRating)) {
ListView_SetItemText(m_hWnd, lpLvi->iItem, ELVSIRATING, TEXT(""));
goto f;
}
@@ -423,8 +423,8 @@ int CALLBACK ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM lExtra)
int iRating1, iRating2;
iRating1 = lpElv->m_iSort > 0? 99: -1;
iRating2 = lpElv->m_iSort > 0? 99: -1;
- Pl("episode_data","episode_rating","Ii",lvi1.lParam,&iRating1);
- Pl("episode_data","episode_rating","Ii",lvi2.lParam,&iRating2);
+ Pl("episode_data","episode_rating",lvi1.lParam,&iRating1);
+ Pl("episode_data","episode_rating",lvi2.lParam,&iRating2);
if (iRating1 == iRating2)
return Cmp(lvi1.lParam, lvi2.lParam);
return iOrder*Cmp(iRating1, iRating2);
@@ -433,9 +433,9 @@ int CALLBACK ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM lExtra)
{
char *sz1, *sz2;
int cch, cch1, cch2;
- if (!Pl("episode_data","episode_title","Is",lvi1.lParam,&sz1))
+ if (!Pl("episode_data","episode_title",lvi1.lParam,&sz1))
return 0;
- if (!Pl("episode_data","episode_title","Is",lvi2.lParam,&sz2))
+ if (!Pl("episode_data","episode_title",lvi2.lParam,&sz2))
return 0;
cch1 = strlen(sz1);
cch2 = strlen(sz2);