aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/episodelistview.c')
-rw-r--r--c/episodelistview.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c
index f533d4f..14fc6b9 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -170,7 +170,9 @@ ElvUpdate()
LVITEM lvi, lviEpisode, lviTop;
LVFINDINFO lvfi;
term_t t;
- static int rgEpSel[2048];
+ extern HWND HWndStatus;
+ static TCHAR tszDisp[16], tszEpisode[16], tszTotal[16];
+ static int aEpSel[2048];
lviEpisode.mask = LVIF_TEXT|LVIF_PARAM;
@@ -187,9 +189,9 @@ ElvUpdate()
HElv, lvi.iItem, LVNI_SELECTED)) != -1
&& i < 2048) {
if (!ListView_GetItem(HElv, &lvi)) continue;
- rgEpSel[i++] = lvi.lParam;
+ aEpSel[i++] = lvi.lParam;
}
- rgEpSel[i] = 0;
+ aEpSel[i] = 0;
/* Save focus. */
iEpFocus = 0;
@@ -208,8 +210,6 @@ ElvUpdate()
GI(t,&cEp) return;
for (iEp = 1, iItem = 0; iEp <= cEp; iEp++) {
- int cb;
- TCHAR *tszEpisode;
extern int BViewTVOriginal, BViewWatched;
if (!BViewWatched) {
@@ -229,10 +229,7 @@ ElvUpdate()
}
/* Format episode number string. */
- ep: cb = 100;
- tszEpisode = malloc(cb*sizeof(TCHAR));
- if (!tszEpisode) continue;
- _stprintf_s(tszEpisode, cb, TEXT("%d"), iEp);
+ ep: _stprintf_s(tszEpisode, sizeof(tszEpisode), TEXT("%d"), iEp);
/* Insert item. */
lviEpisode.iItem = iItem++;
@@ -241,8 +238,6 @@ ElvUpdate()
lviEpisode.lParam = iEp;
ListView_InsertItem(HElv, &lviEpisode);
ElvUpdateItem(&lviEpisode);
-
- free(tszEpisode);
}
lvfi.flags = LVFI_PARAM;
@@ -257,9 +252,9 @@ ElvUpdate()
ElvSetTop(iItemTopNew);
/* Reset selection. */
- for (i = 0; rgEpSel[i]; i++) {
+ for (i = 0; aEpSel[i]; i++) {
int iSel;
- lvfi.lParam = rgEpSel[i];
+ lvfi.lParam = aEpSel[i];
if ((iSel = ListView_FindItem(HElv, -1, &lvfi)) != -1)
ListView_SetItemState(HElv, iSel,
LVIS_SELECTED, LVIS_SELECTED);
@@ -278,6 +273,10 @@ ElvUpdate()
LVIS_FOCUSED, LVIS_FOCUSED);
}
+ _stprintf_s(tszDisp, sizeof(tszDisp), TEXT("%d"), iItem);
+ SendMessage(HWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), (LPARAM)tszDisp);
+ _stprintf_s(tszTotal, sizeof(tszTotal), TEXT("%d"), cEp);
+ SendMessage(HWndStatus, SB_SETTEXT, MAKEWPARAM(2,0), (LPARAM)tszTotal);
SendMessage(HElv, WM_SETREDRAW, TRUE, 0);
ElvRedraw();
}