aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--c/datalistview.c20
-rw-r--r--c/defs.h2
-rw-r--r--c/episodelistview.c1
-rw-r--r--c/listview.c2
-rw-r--r--c/main.c33
-rw-r--r--c/resource.h1
7 files changed, 48 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index cffc2bf..1a52d46 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ endif
all: episode_browser.exe
-episode_browser.exe: $(INPUTS) $(PROJECT_ROOT)Makefile
+episode_browser.exe: $(INPUTS) $(PROJECT_ROOT)c/defs.h $(PROJECT_ROOT)Makefile
swipl-ld -v $(CFLAGS) $(LDFLAGS) -goal true -o $@ $(INPUTS)
$(EXTRA_CMDS)
diff --git a/c/datalistview.c b/c/datalistview.c
index 43cfeb6..873befc 100644
--- a/c/datalistview.c
+++ b/c/datalistview.c
@@ -6,10 +6,28 @@
HWND gDlv_hWnd;
-void
+HWND
DlvCreate(HWND hWnd)
{
+ HWND hListView;
+ LVCOLUMN lvc;
+
gDlv_hWnd = hWnd;
+ hListView = LvCreate(hWnd, (HMENU)IDC_DATALISTVIEW);
+
+ lvc.mask = LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
+
+ lvc.iSubItem = 0;
+ lvc.pszText = TEXT("Key");
+ lvc.cx = 42;
+ ListView_InsertColumn(hListView, 0, &lvc);
+
+ lvc.iSubItem = 1;
+ lvc.pszText = TEXT("Value");
+ lvc.cx = 500;
+ ListView_InsertColumn(hListView, 1, &lvc);
+
+ return hListView;
}
/* Show episode data. */
diff --git a/c/defs.h b/c/defs.h
index 67f1d3e..d27d573 100644
--- a/c/defs.h
+++ b/c/defs.h
@@ -21,7 +21,7 @@ void ElvUpdate(void);
void ElvUpdateName(NMLISTVIEW *);
/* datalistview.c */
-void DlvCreate(HWND);
+HWND DlvCreate(HWND);
void DlvShowEpisode(int);
#endif
diff --git a/c/episodelistview.c b/c/episodelistview.c
index 64644fc..ab54f81 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -15,7 +15,6 @@ int g_SelectedItem = -1; /* Remembered after refresh. */
HWND
ElvCreate(HWND hWnd)
{
- HMODULE hModule;
HWND hListView;
LVCOLUMN lvc;
diff --git a/c/listview.c b/c/listview.c
index e38429b..66bcc29 100644
--- a/c/listview.c
+++ b/c/listview.c
@@ -18,7 +18,7 @@ LvCreate(HWND hWnd, HMENU hMenu)
HWND hListView;
hListView = CreateWindowEx(
- 0,
+ WS_EX_CLIENTEDGE,
WC_LISTVIEW,
TEXT(""),
WS_CHILD|WS_VISIBLE|WS_VSCROLL|LVS_REPORT,
diff --git a/c/main.c b/c/main.c
index 80578dc..40c25b4 100644
--- a/c/main.c
+++ b/c/main.c
@@ -12,8 +12,8 @@ HFONT g_GUIFontBold;
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static INT_PTR CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM);
-static void SetupFonts();
static int Attach(void);
+static void SetupFonts();
int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
@@ -114,6 +114,7 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case WM_CREATE:
ElvCreate(hWnd);
+ DlvCreate(hWnd);
break;
case WM_SIZE:
UpdateLayout(hWnd);
@@ -205,7 +206,7 @@ SetupFonts()
void
UpdateLayout(HWND hWnd)
{
- HWND hListView;
+ HWND hElv, hDlv;
int cxColumn;
RECT rc;
static int cxVScroll = 0;
@@ -215,14 +216,30 @@ UpdateLayout(HWND hWnd)
cxVScroll = GetSystemMetrics(SM_CXVSCROLL);
GetClientRect(hWnd, &rc);
- hListView = GetDlgItem(hWnd, IDC_EPISODELISTVIEW);
- MoveWindow(hListView, 0, 0,
+
+#define EDGE 4
+
+ /* Resize data list view. */
+
+ hDlv = GetDlgItem(hWnd, IDC_DATALISTVIEW);
+ MoveWindow(hDlv, 0, rc.bottom-100,
rc.right, rc.bottom,
TRUE);
- cxColumn = ListView_GetColumnWidth(hListView, 0);
- ListView_SetColumnWidth(hListView, 1,
- rc.right-cxColumn-cxVScroll);
+ cxColumn = ListView_GetColumnWidth(hDlv, 0);
+ ListView_SetColumnWidth(hDlv, 1,
+ rc.right-cxColumn-cxVScroll-EDGE);
+
+ /* Resize episode list view. */
+
+ hElv = GetDlgItem(hWnd, IDC_EPISODELISTVIEW);
+ MoveWindow(hElv, 0, 0,
+ rc.right, rc.bottom-100+1,
+ TRUE);
+
+ cxColumn = ListView_GetColumnWidth(hElv, 0);
+ ListView_SetColumnWidth(hElv, 1,
+ rc.right-cxColumn-cxVScroll-EDGE);
- ListView_EnsureVisible(hListView, g_SelectedItem, TRUE);
+ ListView_EnsureVisible(hElv, g_SelectedItem, TRUE);
}
diff --git a/c/resource.h b/c/resource.h
index 6cab078..16af73e 100644
--- a/c/resource.h
+++ b/c/resource.h
@@ -5,6 +5,7 @@
#define IDD_ABOUT 201
#define IDC_ABOUTTEXT 301
#define IDC_EPISODELISTVIEW 302
+#define IDC_DATALISTVIEW 303
#define ID_FILE_EXIT 4001
#define ID_FILE_REFRESH 4002
#define ID_FILE_ABOUT 4011