diff options
author | John Ankarström <john@ankarstrom.se> | 2022-02-14 23:09:50 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-02-14 23:09:50 +0100 |
commit | f39d414332e15c6406951f7684ef4b5ada7e7414 (patch) | |
tree | a6bc69e77c571c31dcc04e9261ba57666270c4a7 | |
parent | 40cc4394cd21052447b012ee4cdf6d8fdca23493 (diff) | |
download | EpisodeBrowser-f39d414332e15c6406951f7684ef4b5ada7e7414.tar.gz |
Finish implementation of UpdateName.
-rw-r--r-- | win.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -22,7 +22,7 @@ static void SetupFonts(); static TCHAR *TSZFromSZ(char *, int); static int Attach(void); -static void UpdateName(HWND, int); +static void UpdateName(HWND, NMLISTVIEW *); static void UpdateList(HWND); static void ShowEpisode(HWND, int); static int Watched(int); @@ -264,7 +264,7 @@ HandleListViewNotify(HWND hWnd, LPARAM lParam) if ((pNmLv->uChanged & LVIF_STATE) && (pNmLv->uNewState & LVIS_FOCUSED)) { g_SelectedItem = pNmLv->iItem; - UpdateName(hWnd, pNmLv->lParam); + UpdateName(hWnd, pNmLv); //ShowEpisode(hWnd, pNmLv->lParam); } break; @@ -415,13 +415,15 @@ ShowEpisode(HWND hWnd, int iEpisode) /* Update episode name. */ void -UpdateName(HWND hWnd, int iEpisode) +UpdateName(HWND hWnd, NMLISTVIEW *pNmLv) { char *szName; + HWND hListView; + TCHAR *tszName; term_t t; t = PL_new_term_refs(3); - if (!PL_put_integer(t+0, iEpisode)) + if (!PL_put_integer(t+0, pNmLv->lParam)) return; PL_call_predicate(NULL, PL_Q_NORMAL, @@ -431,7 +433,12 @@ UpdateName(HWND hWnd, int iEpisode) if (!PL_get_atom_chars(t+1, &szName)) return; - printf("%s\n", szName); + tszName = TSZFromSZ(szName, CP_UTF8); + if (!tszName) + return; + + hListView = GetDlgItem(hWnd, IDC_LISTVIEW); + ListView_SetItemText(hListView, pNmLv->iItem, 1, tszName); } /* Update episode list. */ |