diff options
Diffstat (limited to 'c')
-rw-r--r-- | c/defs.h | 1 | ||||
-rw-r--r-- | c/episodelistview.c | 17 | ||||
-rw-r--r-- | c/main.c | 16 |
3 files changed, 28 insertions, 6 deletions
@@ -16,6 +16,7 @@ int LvHeight(HWND, int); /* episodelistview.c */ HWND ElvCreate(); +void ElvDoSort(void); LRESULT ElvHandleNotify(LPARAM); void ElvRedraw(void); void ElvSetTop(int); diff --git a/c/episodelistview.c b/c/episodelistview.c index eaa7e1b..08bd0db 100644 --- a/c/episodelistview.c +++ b/c/episodelistview.c @@ -42,6 +42,16 @@ ElvCreate() return HElv; } +void +ElvDoSort() +{ + int iEpFocus; + ListView_SortItemsEx(HElv, ElvSort, ISort); + iEpFocus = ListView_GetNextItem(HElv, -1, LVNI_FOCUSED); + if (iEpFocus == -1) return; + ListView_EnsureVisible(HElv, iEpFocus, TRUE); +} + LRESULT ElvHandleNotify(LPARAM lParam) { @@ -60,17 +70,14 @@ ElvHandleNotify(LPARAM lParam) break; case LVN_COLUMNCLICK: /* Sort by column. */ { - int iColumn, iEpFocus; + int iColumn; term_t t; t = T(1); iColumn = lpNmLv->iSubItem+1; ISort = abs(ISort) == iColumn? -ISort: iColumn; PI(t,ISort) goto s; P("cfg","set_sort",1,t); - s: ListView_SortItemsEx(HElv, ElvSort, ISort); - iEpFocus = ListView_GetNextItem(HElv, -1, LVNI_FOCUSED); - if (iEpFocus == -1) break; - ListView_EnsureVisible(HElv, iEpFocus, TRUE); + s: ElvDoSort(); break; } case NM_CUSTOMDRAW: /* Make unwatched episodes bold. */ @@ -346,10 +346,24 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) PI(t+1,0) break; r: P("episode_data","rate_episode",2,t); ElvUpdateItem(&lvi); - ElvRedraw(); break; } } + switch (LOWORD(wParam)) { + case IDM_RATE10: + case IDM_RATE9: + case IDM_RATE8: + case IDM_RATE7: + case IDM_RATE6: + case IDM_RATE5: + case IDM_RATE4: + case IDM_RATE3: + case IDM_RATE2: + case IDM_RATE1: + case IDM_RATE0: + ElvRedraw(); + ElvDoSort(); + } b: break; } } |