aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c/episodelistview.c4
-rw-r--r--c/main.c27
2 files changed, 11 insertions, 20 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c
index 1389f53..5909f54 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -186,7 +186,6 @@ ElvUpdate()
term_t t;
/* Format name string. */
-
t = T(2);
PI(t,i+1) return;
tszName = NULL;
@@ -196,14 +195,12 @@ ElvUpdate()
if (!tszName) return;
/* Format episode number string. */
-
ep: cb = 100;
tszEpisode = malloc(cb*sizeof(TCHAR));
if (!tszEpisode) goto e;
_stprintf_s(tszEpisode, cb, TEXT("%d"), i+1);
/* Insert item. */
-
lviEpisode.iItem = i;
lviEpisode.iSubItem = 0;
lviEpisode.pszText = tszEpisode;
@@ -222,7 +219,6 @@ ElvUpdate()
}
/* Reset selection and scrolling position. */
-
ElvSetTop(iTop);
if (LpLviElvSelection)
ListView_SetItemState(HElv, LpLviElvSelection->iItem,
diff --git a/c/main.c b/c/main.c
index 2c69d70..b40bb83 100644
--- a/c/main.c
+++ b/c/main.c
@@ -12,6 +12,8 @@ HMENU HPopupMenu;
HWND HFocus;
HWND HWnd;
int IDPI = -1;
+static int BThemes;
+static int CxVScroll;
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static INT_PTR CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM);
static int Attach(void);
@@ -23,14 +25,20 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, INT nCmdShow)
{
char *argv[2];
+ HMODULE hModule;
HWND hWnd;
LPTSTR tszErr;
MSG msg;
INITCOMMONCONTROLSEX icc;
WNDCLASSEX wc;
- /* Initialize Prolog. */
+ /* Set constant globals. */
+ hModule = LoadLibrary(TEXT("uxtheme.dll"));
+ BThemes = hModule && GetProcAddress(hModule,"SetWindowTheme");
+ if (hModule) FreeLibrary(hModule);
+ CxVScroll = GetSystemMetrics(SM_CXVSCROLL);
+ /* Initialize Prolog. */
argv[0] = "EpisodeBrowser";
argv[1] = NULL;
tszErr = TEXT("Could not initialize Prolog.");
@@ -39,7 +47,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
if (!Attach()) goto f;
/* Initialize common controls, load menu and register window class. */
-
icc.dwSize = sizeof(icc);
icc.dwICC = ICC_WIN95_CLASSES;
tszErr = TEXT("Could not initialize common controls.");
@@ -62,7 +69,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
if (!RegisterClassEx(&wc)) goto f;
/* Create window. */
-
hWnd = CreateWindowEx(
0,
TEXT("Episode Browser"),
@@ -305,17 +311,14 @@ UpdateLayout()
int cxColumn, cyDlv;
RECT rc;
extern HWND HDlv, HElv;
- static int cxVScroll = 0;
GetClientRect(HWnd, &rc);
- if (!cxVScroll)
- cxVScroll = GetSystemMetrics(SM_CXVSCROLL);
#define SETCOLW(lv) \
ListView_SetColumnWidth(lv, 0, LVSCW_AUTOSIZE); \
cxColumn = ListView_GetColumnWidth(lv, 0)+4; \
ListView_SetColumnWidth(lv, 0, cxColumn); \
- ListView_SetColumnWidth(lv, 1, rc.right-cxColumn-cxVScroll-4);
+ ListView_SetColumnWidth(lv, 1, rc.right-cxColumn-CxVScroll-4);
/* Resize data list view. */
SendMessage(HDlv, WM_SETREDRAW, FALSE, 0);
@@ -341,16 +344,8 @@ UpdateTheme()
LPTSTR tszTheme;
WORD wAction;
extern HWND HElv, HDlv;
- static int bThemes = -1;
-
- if (bThemes == -1) {
- HMODULE hModule;
- hModule = LoadLibrary(TEXT("uxtheme.dll"));
- bThemes = hModule && GetProcAddress(hModule,"SetWindowTheme");
- if (hModule) FreeLibrary(hModule);
- }
- if (!bThemes) return;
+ if (!BThemes) return;
if (IsThemeActive()) {
dwStyle = LVS_EX_DOUBLEBUFFER;
tszTheme = TEXT("Explorer");