From fe01ebbbcde9f4f058b3967851ccf2f4718710c1 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 25 Aug 2014 11:41:37 -0400 Subject: [PATCH] Dropped checkboxImageList. This is the first of a multi-part commit stream becasue when I tried doing it alll at once the program broke in utterly mysterious ways. --- redo/imagelist_windows.c | 8 +++----- redo/table_windows.c | 3 +++ redo/uitask_windows.c | 5 ----- redo/winapi_windows.h | 3 +-- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/redo/imagelist_windows.c b/redo/imagelist_windows.c index 0f14180..6e21187 100644 --- a/redo/imagelist_windows.c +++ b/redo/imagelist_windows.c @@ -260,16 +260,14 @@ static HIMAGELIST newCheckboxImageList(HWND hwnddc, void (*sizefunc)(HDC, int *, return il; } -HIMAGELIST checkboxImageList = NULL; - -void makeCheckboxImageList(HWND hwnddc) +HIMAGELIST makeCheckboxImageList(HWND hwnddc) { if (theme == NULL) // try to open the theme openTheme(hwnddc); if (theme != NULL) { // use the theme - checkboxImageList = newCheckboxImageList(hwnddc, themeSize, themeImage); + return newCheckboxImageList(hwnddc, themeSize, themeImage); return; } // couldn't open; fall back - checkboxImageList = newCheckboxImageList(hwnddc, dfcSize, dfcImage); + return newCheckboxImageList(hwnddc, dfcSize, dfcImage); } diff --git a/redo/table_windows.c b/redo/table_windows.c index 939845e..be6e23c 100644 --- a/redo/table_windows.c +++ b/redo/table_windows.c @@ -139,6 +139,9 @@ void tableAutosizeColumns(HWND hwnd, int nColumns) void tableSetCheckboxImageList(HWND hwnd) { + HIMAGELIST checkboxImageList; + + checkboxImageList = makeCheckboxImageList(hwnd); if (SendMessageW(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM) checkboxImageList) == (LRESULT) NULL) ;//TODO xpanic("error setting image list", GetLastError()); // TODO free old one here if any/different diff --git a/redo/uitask_windows.c b/redo/uitask_windows.c index 25f7da9..e38a62f 100644 --- a/redo/uitask_windows.c +++ b/redo/uitask_windows.c @@ -133,11 +133,6 @@ static LRESULT CALLBACK msgwinproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l if (sharedWndProc(hwnd, uMsg, wParam, lParam, &shared)) return shared; switch (uMsg) { - case WM_CREATE: - // initial - makeCheckboxImageList(hwnd); - return 0; - // TODO respond to WM_THEMECHANGED case msgRequest: // in modal? if (!queueIfModal((void *) lParam)) diff --git a/redo/winapi_windows.h b/redo/winapi_windows.h index ed7caa0..1312747 100644 --- a/redo/winapi_windows.h +++ b/redo/winapi_windows.h @@ -144,8 +144,7 @@ enum { checkboxStatePushed = 1 << 2, checkboxnStates = 1 << 3, }; -extern HIMAGELIST checkboxImageList; -extern void makeCheckboxImageList(HWND); +extern HIMAGELIST makeCheckboxImageList(HWND); // dialog_windows.c extern WCHAR *openFile(void);