diff options
Diffstat (limited to 'c/datalistview.c')
-rw-r--r-- | c/datalistview.c | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/c/datalistview.c b/c/datalistview.c deleted file mode 100644 index fbb46d0..0000000 --- a/c/datalistview.c +++ /dev/null @@ -1,89 +0,0 @@ -#include <stdio.h> -#include <windows.h> -#include <commctrl.h> -#include <SWI-Prolog.h> - -#include "resource.h" -#include "defs.h" - -HWND HDlv; - -HWND -DlvCreate() -{ - LVCOLUMN lvc; - - HDlv = LvCreate((HMENU)IDC_DATALISTVIEW, LVS_NOCOLUMNHEADER); - - lvc.mask = LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM; - lvc.iSubItem = DLVSIKEY; - lvc.pszText = TEXT("Key"); - - lvc.cx = Dpi(42); - ListView_InsertColumn(HDlv, DLVSIKEY, &lvc); - - lvc.iSubItem = DLVSIVALUE; - lvc.pszText = TEXT("Value"); - lvc.cx = 500; - ListView_InsertColumn(HDlv, DLVSIVALUE, &lvc); - - return HDlv; -} - -/* Show episode data. */ -void -DlvShowEpisode(int iEpisode) -{ - int i, iItem; - LVFINDINFO lvfi; - LVITEM lviKey, lviValue; - term_t t; - qid_t q; - extern HWND HElv; - - ListView_DeleteAllItems(HDlv); - - lviKey.mask = LVIF_TEXT; - lviValue.mask = LVIF_TEXT; - - t = PL_new_term_refs(3); - if (!Plp(t,"I",iEpisode)) return; - q = PL_open_query(NULL, PL_Q_NORMAL, - PL_predicate("episode_datum", 3, "episode_data"), t); - - for (i = 0; PL_next_solution(q); i++) { - char *szKey; - char *szValue; - TCHAR *tszKey, *tszValue; - - if (!Plg(t+1,"ss",&szKey,&szValue)) continue; - - tszKey = TszFromSz(szKey, CP_UTF8); - if (!tszKey) continue; - tszValue = TszFromSz(szValue, CP_UTF8); - if (!tszValue) goto c; - - lviKey.mask = LVIF_TEXT; - lviKey.iItem = i; - lviKey.iSubItem = 0; - lviKey.pszText = tszKey; - ListView_InsertItem(HDlv, &lviKey); - - lviValue.iItem = i; - lviValue.iSubItem = 1; - lviValue.pszText = tszValue; - ListView_SetItem(HDlv, &lviValue); - - free(tszValue); - c: free(tszKey); - } - - PL_cut_query(q); - UpdateLayout(); - - lvfi.flags = LVFI_PARAM; - lvfi.lParam = iEpisode; - iItem = ListView_FindItem(HElv, -1, &lvfi); - if (iItem != -1) - ListView_EnsureVisible(HElv, iItem, TRUE); -} |