aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.c
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-04-25 14:10:02 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-04-25 14:10:02 +0200
commitc884c09ac88c0d22a21f839593d77c7173c41b60 (patch)
tree5aa03981fcc2196443993d691f792c14d0435872 /c/episodelistview.c
parent45133f2f99dc2e6f0e786909a68f1cfd93b7f01d (diff)
downloadEpisodeBrowser-c884c09ac88c0d22a21f839593d77c7173c41b60.tar.gz
Flip title and rating columns.
Diffstat (limited to 'c/episodelistview.c')
-rw-r--r--c/episodelistview.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c
index 601f2b7..eaa7e1b 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -20,20 +20,20 @@ ElvCreate()
HElv = LvCreate((HMENU)IDC_EPISODELISTVIEW, 0);
lvc.mask = LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
- lvc.iSubItem = 0;
+ lvc.iSubItem = ELVSIEPISODE;
lvc.pszText = TEXT("#");
lvc.cx = Dpi(42);
- ListView_InsertColumn(HElv, 0, &lvc);
+ ListView_InsertColumn(HElv, ELVSIEPISODE, &lvc);
- lvc.iSubItem = 1;
- lvc.pszText = TEXT("/");
- lvc.cx = Dpi(30);
- ListView_InsertColumn(HElv, 1, &lvc);
-
- lvc.iSubItem = 2;
+ lvc.iSubItem = ELVSITITLE;
lvc.pszText = TEXT("Title");
lvc.cx = 500;
- ListView_InsertColumn(HElv, 2, &lvc);
+ ListView_InsertColumn(HElv, ELVSITITLE, &lvc);
+
+ lvc.iSubItem = ELVSIRATING;
+ lvc.pszText = TEXT("/");
+ lvc.cx = Dpi(30);
+ ListView_InsertColumn(HElv, ELVSIRATING, &lvc);
t = T(1);
P("cfg","get_sort",1,t);
@@ -201,11 +201,11 @@ ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM iSort)
if (!ListView_GetItem(HElv, &lvi1)) return 0;
if (!ListView_GetItem(HElv, &lvi2)) return 0;
iOrder = Cmp(iSort, 0);
- switch (abs(iSort)) {
- case 1: /* Sort by episode number. */
+ switch (abs(iSort)-1) {
+ case ELVSIEPISODE:
return iOrder*Cmp(lvi1.lParam, lvi2.lParam);
break;
- case 2: /* Sort by rating. */
+ case ELVSIRATING:
{
int iRating1, iRating2;
term_t t, t2;
@@ -224,7 +224,7 @@ ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM iSort)
return iOrder*Cmp(iRating1, iRating2);
break;
}
- case 3: /* Sort by title. */
+ case ELVSITITLE:
{
char *sz1, *sz2;
int cch, cch1, cch2;
@@ -319,7 +319,7 @@ ElvUpdate()
/* Insert item. */
lviEpisode.iItem = iItem++;
- lviEpisode.iSubItem = 0;
+ lviEpisode.iSubItem = ELVSIEPISODE;
lviEpisode.pszText = tszEpisode;
lviEpisode.lParam = iEp;
ListView_InsertItem(HElv, &lviEpisode);
@@ -389,18 +389,18 @@ ElvUpdateItem(LPLVITEM lpLvi)
GAC(t+1,&szName) goto r;
tszName = TszFromSz(szName, CP_UTF8);
if (tszName)
- ListView_SetItemText(HElv, lpLvi->iItem, 2, tszName);
+ ListView_SetItemText(HElv, lpLvi->iItem, ELVSITITLE, tszName);
r: t2 = T(2);
PI(t2,lpLvi->lParam) goto f;
P("episode_data","episode_rating",2,t2) {
- ListView_SetItemText(HElv, lpLvi->iItem, 1, TEXT(""));
+ ListView_SetItemText(HElv, lpLvi->iItem, ELVSIRATING, TEXT(""));
goto f;
}
GI(t2+1,&iRating) goto f;
_stprintf_s(tszRating, sizeof(tszRating), TEXT("%d"), iRating);
- ListView_SetItemText(HElv, lpLvi->iItem, 1, tszRating);
+ ListView_SetItemText(HElv, lpLvi->iItem, ELVSIRATING, tszRating);
f: if (tszName) free(tszName);
}