diff options
author | John Ankarström <john@ankarstrom.se> | 2022-04-05 04:15:20 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-04-05 04:15:20 +0200 |
commit | 4d6cbcdc97fd79befca82ed9ddc0d96ce86f744f (patch) | |
tree | 07c4cb66a4914c4cd38b723928c69d39b507c451 /c/main.c | |
parent | ec4bf0b3d1fac134793dd4cccff24e42ce682f09 (diff) | |
download | EpisodeBrowser-4d6cbcdc97fd79befca82ed9ddc0d96ce86f744f.tar.gz |
Add episode ratings.
Diffstat (limited to 'c/main.c')
-rw-r--r-- | c/main.c | 50 |
1 files changed, 37 insertions, 13 deletions
@@ -188,12 +188,8 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ElvUpdate(); break; case ID_FILE_RESET: - { - extern HWND HElv; - ListView_SetItemState(HElv, -1, LVIF_STATE, LVIS_SELECTED); ElvSelectRecent(); break; - } case ID_FILE_ABOUT: DialogBox( GetModuleHandle(NULL), @@ -206,6 +202,12 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case ID_TOGGLE: case ID_FORGET: case ID_LOOKUP: + case ID_RATE5: + case ID_RATE4: + case ID_RATE3: + case ID_RATE2: + case ID_RATE1: + case ID_RATE0: { LVITEM lvi; term_t t; @@ -216,7 +218,7 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) lvi.mask = LVIF_PARAM; lvi.iItem = -1; - t = T(1); + t = T(2); while ((lvi.iItem = ListView_GetNextItem( HElv, lvi.iItem, LVNI_SELECTED)) != -1) { if (!ListView_GetItem(HElv, &lvi)) goto b; @@ -241,6 +243,27 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ElvRedraw(); DlvShowEpisode(lvi.lParam); break; + case ID_RATE5: + PI(t+1,5) break; + goto r; + case ID_RATE4: + PI(t+1,4) break; + goto r; + case ID_RATE3: + PI(t+1,3) break; + goto r; + case ID_RATE2: + PI(t+1,2) break; + goto r; + case ID_RATE1: + PI(t+1,1) break; + goto r; + case ID_RATE0: + PI(t+1,0) break; + r: P("episode_data","rate_episode",2,t); + ElvUpdateName(&lvi); + ElvRedraw(); + break; } } b: break; @@ -321,23 +344,24 @@ UpdateLayout() GetClientRect(HWnd, &rc); -#define SETCOLW(lv) \ - ListView_SetColumnWidth(lv, 0, LVSCW_AUTOSIZE); \ - cxColumn = ListView_GetColumnWidth(lv, 0)+4; \ - ListView_SetColumnWidth(lv, 0, cxColumn); \ - ListView_SetColumnWidth(lv, 1, rc.right-cxColumn-CxVScroll-4); - /* Resize data list view. */ SendMessage(HDlv, WM_SETREDRAW, FALSE, 0); cyDlv = rc.bottom - LvHeight(HDlv, 0); MoveWindow(HDlv, 0, cyDlv, rc.right, rc.bottom, TRUE); - SETCOLW(HDlv); + ListView_SetColumnWidth(HDlv, 0, LVSCW_AUTOSIZE); + cxColumn = ListView_GetColumnWidth(HDlv, 0)+4; + ListView_SetColumnWidth(HDlv, 0, cxColumn); + ListView_SetColumnWidth(HDlv, 1, rc.right-cxColumn-CxVScroll-4); SendMessage(HDlv, WM_SETREDRAW, TRUE, 0); /* Resize episode list view. */ SendMessage(HElv, WM_SETREDRAW, FALSE, 0); MoveWindow(HElv, 0, 0, rc.right, cyDlv+1, TRUE); - SETCOLW(HElv); + ListView_SetColumnWidth(HElv, 0, LVSCW_AUTOSIZE); + cxColumn = ListView_GetColumnWidth(HElv, 0)+4; + ListView_SetColumnWidth(HElv, 0, cxColumn); + cxColumn += ListView_GetColumnWidth(HElv, 1); + ListView_SetColumnWidth(HElv, 2, rc.right-cxColumn-CxVScroll-4); SendMessage(HElv, WM_SETREDRAW, TRUE, 0); #undef SETCOLW |