aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/episodelistview.c2
-rw-r--r--c/main.c39
-rw-r--r--c/pl.c20
3 files changed, 53 insertions, 8 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c
index 1fb20e2..a1973f8 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -401,8 +401,6 @@ ElvUpdate()
_stprintf_s(tszDisp, sizeof(tszDisp), TEXT("%d"), iItem);
SendMessage(HWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), (LPARAM)tszDisp);
- _stprintf_s(tszTotal, sizeof(tszTotal), TEXT("%d"), cEp);
- SendMessage(HWndStatus, SB_SETTEXT, MAKEWPARAM(2,0), (LPARAM)tszTotal);
SendMessage(HElv, WM_SETREDRAW, TRUE, 0);
}
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);
}
diff --git a/c/pl.c b/c/pl.c
index acb6ba3..50f5429 100644
--- a/c/pl.c
+++ b/c/pl.c
@@ -58,6 +58,13 @@ Plpv(term_t t, char *szFmt, va_list vl)
if (!PL_put_integer(t+i, x)) return 0;
break;
}
+ case 'A':
+ {
+ atom_t x;
+ x = va_arg(vl, atom_t);
+ if (!PL_put_atom(t+i, x)) return 0;
+ break;
+ }
case 'S':
{
atom_t a;
@@ -70,6 +77,9 @@ Plpv(term_t t, char *szFmt, va_list vl)
case 'i':
va_arg(vl, int *);
break;
+ case 'a':
+ va_arg(vl, atom_t *);
+ break;
case 's':
va_arg(vl, char **);
break;
@@ -102,6 +112,13 @@ Plgv(term_t t, char *szFmt, va_list vl)
if (!PL_get_integer(t+i, lp)) return 0;
break;
}
+ case 'a':
+ {
+ atom_t *lp;
+ lp = va_arg(vl, atom_t *);
+ if (!PL_get_atom(t+i, lp)) return 0;
+ break;
+ }
case 's':
{
char **lp;
@@ -112,6 +129,9 @@ Plgv(term_t t, char *szFmt, va_list vl)
case 'I':
va_arg(vl, int);
break;
+ case 'A':
+ va_arg(vl, atom_t);
+ break;
case 'S':
va_arg(vl, char *);
break;