aboutsummaryrefslogtreecommitdiff
path: root/c/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/main.c')
-rw-r--r--c/main.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/c/main.c b/c/main.c
index 921b391..ef3877a 100644
--- a/c/main.c
+++ b/c/main.c
@@ -6,6 +6,7 @@
#include "resource.h"
#include "defs.h"
+atom_t AThread;
char SzLimitScreenwriter[64] = {0};
HFONT HfNormal;
HFONT HfBold;
@@ -15,6 +16,7 @@ HWND HWnd;
HWND HWndStatus;
int BViewTVOriginal = 1;
int BViewWatched = 1;
+int BThread = 0;
int IDPI = -1;
static int BThemes;
static int CxVScroll;
@@ -203,6 +205,27 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return ElvHandleNotify(lParam);
}
break;
+ case WM_TIMER:
+ switch (wParam) {
+ case IDT_TIMER:
+ {
+ static int i = 0;
+ if (Pl("episode_data","thread_running","A",AThread)) {
+ i = (i+1)%4;
+ SendMessage(HWndStatus, SB_SETTEXT, MAKEWPARAM(1,0),
+ (LPARAM)(i==0? TEXT("."):
+ i==1? TEXT(".."):
+ i==2? TEXT("..."):
+ TEXT("")));
+ } else {
+ i = 0;
+ KillTimer(hWnd, IDT_TIMER);
+ ElvUpdate();
+ }
+ break;
+ }
+ }
+ break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDM_FILE_EXIT:
@@ -212,12 +235,16 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
ElvUpdate();
break;
case IDM_FILE_FETCH_DATA:
- Pl("episode_data","update_episode_data","");
- ElvUpdate();
- break;
+ if (BThread) break;
+ Pl("episode_data","thread_create","Sa","update_episode_data",&AThread);
+ goto t;
case IDM_FILE_FETCH_SCREENWRITERS:
- Pl("episode_data","update_screenwriters","");
- ElvUpdate();
+ if (BThread) break;
+ Pl("episode_data","thread_create","Sa","update_screenwriters",&AThread);
+ t: KillTimer(hWnd, IDT_TIMER);
+ SetTimer(hWnd, IDT_TIMER, 500, NULL);
+ SendMessage(HWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), (LPARAM)TEXT("."));
+ BThread = 1;
break;
case IDM_FILE_ABOUT:
DialogBox(
@@ -514,7 +541,7 @@ UpdateLayout()
/* Resize status bar parts. */
{
- int aParts[] = {rc.right-Dpi(100), rc.right-Dpi(50), rc.right};
+ int aParts[] = {rc.right-Dpi(55), rc.right};
SendMessage(HWndStatus, SB_SETPARTS,
(WPARAM)sizeof(aParts), (LPARAM)aParts);
}