diff options
Diffstat (limited to 'c/episodelistview.c')
-rw-r--r-- | c/episodelistview.c | 34 |
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); } |