From babbd4c9c26d997683280ac663e03b04910b2826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 30 Jul 2022 00:01:49 +0200 Subject: Formatting. This style is more compact and quicker to read once you know what the first two member in LVITEM are (mask and iItem). --- c/datalistview.cpp | 7 ++----- c/episodelistview.cpp | 13 +++++-------- c/main.cpp | 4 +--- 3 files changed, 8 insertions(+), 16 deletions(-) (limited to 'c') diff --git a/c/datalistview.cpp b/c/datalistview.cpp index a091ace..fd37791 100644 --- a/c/datalistview.cpp +++ b/c/datalistview.cpp @@ -44,16 +44,14 @@ void DataListView::ShowEpisode(const int iEpisode) ListView_DeleteAllItems(hWnd); - LVITEM lviKey, lviValue; - lviKey.mask = LVIF_TEXT; - lviValue.mask = LVIF_TEXT; - Frame f; const int iArity = 3; const term_t t = PL_new_term_refs(iArity); if (!PlPut(t, iEpisode)) return; Query q (NULL, PL_predicate("episode_datum", iArity, "episode_data"), t); + LVITEM lviKey = {LVIF_TEXT}; + LVITEM lviValue = {LVIF_TEXT}; for (int i = 0; q.NextSolution(); i++) { std::wstring wsKey; @@ -62,7 +60,6 @@ void DataListView::ShowEpisode(const int iEpisode) if (!(PlGet(t+1, &wsKey) && PlGet(t+2, &wsValue))) continue; - lviKey.mask = LVIF_TEXT; lviKey.iItem = i; lviKey.iSubItem = 0; lviKey.pszText = wsKey.data(); diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index e23e5d8..b3ee02f 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -245,10 +245,10 @@ int CALLBACK EpisodeListView::SortProc(const LPARAM iItem1, const LPARAM iItem2, { EpisodeListView* const pElv = (EpisodeListView*)lExtra; - LVITEM lvi1, lvi2; - lvi1.mask = lvi2.mask = LVIF_PARAM; - lvi1.iItem = iItem1; lvi2.iItem = iItem2; + LVITEM lvi1 = {LVIF_PARAM, (int)iItem1}; if (!ListView_GetItem(pElv->hWnd, &lvi1)) return 0; + + LVITEM lvi2 = {LVIF_PARAM, (int)iItem2}; if (!ListView_GetItem(pElv->hWnd, &lvi2)) return 0; /* abs(m_iSort) is the 1-based index of the column to sort by. @@ -296,9 +296,7 @@ void EpisodeListView::Update() /* Save scrolling position. */ int iEpTop = 0; { - LVITEM lviTop; - lviTop.iItem = ListView_GetTopIndex(hWnd); - lviTop.mask = LVIF_PARAM; + LVITEM lviTop = {LVIF_PARAM, ListView_GetTopIndex(hWnd)}; ListView_GetItem(hWnd, &lviTop); iEpTop = lviTop.lParam; } @@ -331,8 +329,7 @@ void EpisodeListView::Update() int cItem = 0; { wchar_t wszEpisode[16]; - LVITEM lviEpisode; - lviEpisode.mask = LVIF_TEXT|LVIF_PARAM; + LVITEM lviEpisode = {LVIF_TEXT|LVIF_PARAM}; for (int iEp = 1; iEp <= cEp; iEp++) { extern char g_szLimitScreenwriter[]; extern int g_bViewTVOriginal, g_bViewWatched; diff --git a/c/main.cpp b/c/main.cpp index 7fef22e..c9be01d 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -383,9 +383,7 @@ void WndProcMainMenu(const HWND hWnd, unsigned short wCommand) const int iEpFocus = ListView_GetNextItem(g_pElv->hWnd, -1, LVNI_FOCUSED); if (iEpFocus == -1) break; - LVITEM lvi; - lvi.iItem = iEpFocus; - lvi.mask = LVIF_PARAM; + LVITEM lvi = {LVIF_PARAM, iEpFocus}; if (!ListView_GetItem(g_pElv->hWnd, &lvi)) break; char* sz; -- cgit v1.2.3