diff options
Diffstat (limited to 'c/episodelistview.cpp')
-rw-r--r-- | c/episodelistview.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index 5de5e2e..49e59d1 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -1,7 +1,6 @@ #include <vector> #include <windows.h> #include <commctrl.h> -#include <TCHAR.H> #include <SWI-Prolog.h> #include "resource.h" @@ -18,17 +17,17 @@ EpisodeListView::EpisodeListView(const HWND hWndParent) lvc.mask = LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM; lvc.iSubItem = ELVSIEPISODE; - lvc.pszText = (TCHAR*)TEXT("#"); + lvc.pszText = (wchar_t*)L"#"; lvc.cx = Dpi(42); ListView_InsertColumn(hWnd, ELVSIEPISODE, &lvc); lvc.iSubItem = ELVSITITLE; - lvc.pszText = (TCHAR*)TEXT("Title"); + lvc.pszText = (wchar_t*)L"Title"; lvc.cx = 500; ListView_InsertColumn(hWnd, ELVSITITLE, &lvc); lvc.iSubItem = ELVSIRATING; - lvc.pszText = (TCHAR*)TEXT("/"); + lvc.pszText = (wchar_t*)L"/"; lvc.cx = Dpi(30); ListView_InsertColumn(hWnd, ELVSIRATING, &lvc); @@ -345,7 +344,7 @@ void EpisodeListView::Update() int cItem = 0; { - TCHAR tszEpisode[16]; + wchar_t wszEpisode[16]; LVITEM lviEpisode; lviEpisode.mask = LVIF_TEXT|LVIF_PARAM; for (int iEp = 1; iEp <= cEp; iEp++) { @@ -363,12 +362,12 @@ void EpisodeListView::Update() if (!g_bViewTVOriginal) if (Pl("episode_data","tv_original",iEp)) continue; - _stprintf_s(tszEpisode, sizeof(tszEpisode), TEXT("%d"), iEp); + swprintf_s(wszEpisode, sizeof(wszEpisode), L"%d", iEp); /* Insert item. */ lviEpisode.iItem = cItem++; lviEpisode.iSubItem = ELVSIEPISODE; - lviEpisode.pszText = tszEpisode; + lviEpisode.pszText = wszEpisode; lviEpisode.lParam = iEp; ListView_InsertItem(hWnd, &lviEpisode); UpdateItem(&lviEpisode); @@ -420,9 +419,9 @@ void EpisodeListView::Update() /* Show number of displayed items in status bar. */ extern HWND g_hWndStatus; - TCHAR tszDisp[16]; - _stprintf_s(tszDisp, sizeof(tszDisp), TEXT("%d"), cItem); - SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), (LPARAM)tszDisp); + wchar_t wszDisp[16]; + swprintf_s(wszDisp, sizeof(wszDisp), L"%d", cItem); + SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), (LPARAM)wszDisp); SendMessage(hWnd, WM_SETREDRAW, TRUE, 0); } @@ -430,22 +429,22 @@ void EpisodeListView::Update() /* Update episode name and rating. */ void EpisodeListView::UpdateItem(const LVITEM* const pLvi) { - std::basic_string<TCHAR> tstrName; - if (!Pl("episode_data","episode_title",pLvi->lParam,&tstrName)) { + std::wstring wstrName; + if (!Pl("episode_data","episode_title",pLvi->lParam,&wstrName)) { if (!Pl("episode_data","update_episode_data")) goto r; - if (!Pl("episode_data","episode_title",pLvi->lParam,&tstrName)) goto r; + if (!Pl("episode_data","episode_title",pLvi->lParam,&wstrName)) goto r; } - ListView_SetItemText(hWnd, pLvi->iItem, ELVSITITLE, tstrName.data()); + ListView_SetItemText(hWnd, pLvi->iItem, ELVSITITLE, wstrName.data()); int iRating; r: if (!Pl("episode_data","episode_rating",pLvi->lParam,&iRating)) { - ListView_SetItemText(hWnd, pLvi->iItem, ELVSIRATING, (TCHAR*)TEXT("")); + ListView_SetItemText(hWnd, pLvi->iItem, ELVSIRATING, (wchar_t*)L""); return; } - TCHAR tszRating[3]; - _stprintf_s(tszRating, sizeof(tszRating), TEXT("%d"), iRating); - ListView_SetItemText(hWnd, pLvi->iItem, ELVSIRATING, tszRating); + wchar_t wszRating[3]; + swprintf_s(wszRating, sizeof(wszRating), L"%d", iRating); + ListView_SetItemText(hWnd, pLvi->iItem, ELVSIRATING, wszRating); } LRESULT CALLBACK EpisodeListView::WndProc(const HWND hWnd, const UINT uMsg, |