|
@@ -466,7 +466,6 @@ void logClear(){
|
|
|
#define PROGRESSW (LA_RH*15)
|
|
|
|
|
|
void laShowProgress(real p1, real p2){
|
|
|
-#ifdef __linux__
|
|
|
laBoxedTheme *bt = _LA_THEME_TAB; real* fg=laThemeColor(bt,LA_BT_TEXT); real* bg=laThemeColor(bt,LA_BT_NORMAL);
|
|
|
if(!MAIN.Progress.Called){
|
|
|
laRecordTime(&MAIN.Progress.TimeCalled); MAIN.Progress.Called=1;
|
|
@@ -475,7 +474,9 @@ void laShowProgress(real p1, real p2){
|
|
|
real t=laTimeElapsedSecondsf(&tm,&MAIN.Progress.TimeCalled); if(t<0.1) return;
|
|
|
memcpy(&MAIN.Progress.TimeCalled,&tm,sizeof(laTimeRecorder));
|
|
|
if(!MAIN.Progress.Shown){
|
|
|
- int w=XDisplayWidth(MAIN.dpy, 0),h=XDisplayHeight(MAIN.dpy, 0); int ww=PROGRESSW+LA_RH*2;
|
|
|
+ int ww=PROGRESSW+LA_RH*2;
|
|
|
+#ifdef __linux__
|
|
|
+ int w=XDisplayWidth(MAIN.dpy, 0),h=XDisplayHeight(MAIN.dpy, 0);
|
|
|
XMoveResizeWindow(MAIN.dpy,MAIN.Progress.w,w/2-ww/2,h/2-LA_RH*2/2,ww,LA_RH*2);
|
|
|
long a=LA_COLOR3_TO_HEX(bg);
|
|
|
XSetForeground(MAIN.dpy,MAIN.Progress.gc,LA_COLOR3_TO_HEX(fg));
|
|
@@ -483,28 +484,58 @@ void laShowProgress(real p1, real p2){
|
|
|
XSetWindowBackground(MAIN.dpy,MAIN.Progress.w,LA_COLOR3_TO_HEX(bg));
|
|
|
if(MAIN.CurrentWindow) XSetTransientForHint(MAIN.dpy,MAIN.Progress.w,MAIN.CurrentWindow->win);
|
|
|
XMapWindow(MAIN.dpy,MAIN.Progress.w);
|
|
|
- MAIN.Progress.Shown=1;
|
|
|
+#endif
|
|
|
+#ifdef _WIN32
|
|
|
+ int w=GetSystemMetrics(SM_CXFULLSCREEN), h=GetSystemMetrics(SM_CYFULLSCREEN);
|
|
|
+ SetWindowPos(MAIN.Progress.w, MAIN.CurrentWindow->win,w/2-ww/2,h/2-LA_RH*2/2,ww,LA_RH*2,0);
|
|
|
+ ShowWindow(MAIN.Progress.w,SW_SHOW);
|
|
|
+#endif
|
|
|
+ MAIN.Progress.Shown = 1;
|
|
|
}
|
|
|
}
|
|
|
- XClearWindow(MAIN.dpy,MAIN.Progress.w);
|
|
|
if(p1>=0) MAIN.Progress.p1=p1; if(p2>=0) MAIN.Progress.p2=p2;
|
|
|
+#ifdef __linux__
|
|
|
+ XClearWindow(MAIN.dpy,MAIN.Progress.w);
|
|
|
XFillRectangle(MAIN.dpy,MAIN.Progress.w,MAIN.Progress.gc,LA_RH*2,0,PROGRESSW*MAIN.Progress.p1,LA_RH);
|
|
|
XFillRectangle(MAIN.dpy,MAIN.Progress.w,MAIN.Progress.gc,LA_RH*2,LA_RH,PROGRESSW*MAIN.Progress.p2,LA_RH);
|
|
|
- tnsDrawLCD7_ProgressX11(LA_RH*1.5,0,MAIN.Progress.p1);
|
|
|
- tnsDrawLCD7_ProgressX11(LA_RH*1.5,LA_RH,MAIN.Progress.p2);
|
|
|
+ tnsDrawLCD7_ProgressSystem(LA_RH*1.5,0,MAIN.Progress.p1);
|
|
|
+ tnsDrawLCD7_ProgressSystem(LA_RH*1.5,LA_RH,MAIN.Progress.p2);
|
|
|
XSync(MAIN.dpy, 1); XFlush(MAIN.dpy);
|
|
|
#endif
|
|
|
+#ifdef _WIN32
|
|
|
+ InvalidateRect(MAIN.Progress.w,0,1);
|
|
|
+ if(!MAIN.Progress.brush_bg){ MAIN.Progress.brush_bg=CreateSolidBrush(LA_COLOR3_TO_RGB(bg)); }
|
|
|
+ if(!MAIN.Progress.brush_fg){ MAIN.Progress.brush_fg=CreateSolidBrush(LA_COLOR3_TO_RGB(fg)); }
|
|
|
+ if(!MAIN.Progress.pen_fg){ MAIN.Progress.pen_fg=CreatePen(PS_SOLID, 2, LA_COLOR3_TO_RGB(fg)); }
|
|
|
+ RECT rect; GetClientRect(MAIN.Progress.w, &rect);
|
|
|
+ PAINTSTRUCT ps; BeginPaint(MAIN.Progress.w,&ps);
|
|
|
+ SelectObject(MAIN.Progress.hdc, MAIN.Progress.brush_bg);
|
|
|
+ Rectangle(MAIN.Progress.hdc, 0, 0, rect.right, rect.bottom);
|
|
|
+ SelectObject(MAIN.Progress.hdc, MAIN.Progress.brush_fg);
|
|
|
+ Rectangle(MAIN.Progress.hdc,LA_RH*2,0,LA_RH*2+PROGRESSW*MAIN.Progress.p1,LA_RH);
|
|
|
+ Rectangle(MAIN.Progress.hdc,LA_RH*2,LA_RH,LA_RH*2+PROGRESSW*MAIN.Progress.p2,LA_RH+LA_RH);
|
|
|
+ SelectObject(MAIN.Progress.hdc, MAIN.Progress.pen_fg);
|
|
|
+ tnsDrawLCD7_ProgressSystem(LA_RH*1.5,0,MAIN.Progress.p1);
|
|
|
+ tnsDrawLCD7_ProgressSystem(LA_RH*1.5,LA_RH,MAIN.Progress.p2);
|
|
|
+ EndPaint(MAIN.Progress.w,&ps);
|
|
|
+ MSG msg;
|
|
|
+ while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)){ TranslateMessage(&msg); DispatchMessage(&msg); };
|
|
|
+#endif
|
|
|
}
|
|
|
void laHideProgress(){
|
|
|
-#ifdef __linux__
|
|
|
if(!MAIN.Progress.Shown){
|
|
|
MAIN.Progress.Called=0; return;
|
|
|
}
|
|
|
laTimeRecorder tm; laRecordTime(&tm);
|
|
|
real t=laTimeElapsedSecondsf(&tm,&MAIN.Progress.TimeCalled);
|
|
|
if(t<0.2){ usleep((TNS_MIN2(0.2-t,0.2))*1000000); }
|
|
|
- XUnmapWindow(MAIN.dpy,MAIN.Progress.w); XSync(MAIN.dpy, 1); XFlush(MAIN.dpy);
|
|
|
MAIN.Progress.Called = MAIN.Progress.Shown = 0;
|
|
|
+#ifdef __linux__
|
|
|
+ XUnmapWindow(MAIN.dpy,MAIN.Progress.w); XSync(MAIN.dpy, 1); XFlush(MAIN.dpy);
|
|
|
+#endif
|
|
|
+#ifdef _WIN32
|
|
|
+ ShowWindow(MAIN.Progress.w,SW_HIDE);
|
|
|
+ if(MAIN.CurrentWindow) UpdateWindow(MAIN.CurrentWindow->win);
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -522,6 +553,26 @@ void la_InitProgressWindow(){
|
|
|
XSetLineAttributes(MAIN.dpy, MAIN.Progress.gc, 2, LineSolid, CapButt, JoinBevel);
|
|
|
XSync(MAIN.dpy,0);
|
|
|
#endif
|
|
|
+#ifdef _WIN32
|
|
|
+ WNDCLASSW wc;
|
|
|
+ wc.hInstance = MAIN.hinstance;
|
|
|
+ wc.lpfnWndProc = LA_ProgressWindowProc;
|
|
|
+ wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
|
|
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
|
|
+ wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
|
|
|
+ wc.cbWndExtra = 0;
|
|
|
+ wc.cbClsExtra = 0;
|
|
|
+ wc.lpszClassName = L"_LAGUIPROGRESS";
|
|
|
+ wc.lpszMenuName = NULL;
|
|
|
+ wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
|
|
+
|
|
|
+ if (!RegisterClassW(&wc)){ return; }
|
|
|
+
|
|
|
+ MAIN.Progress.w=CreateWindowW(L"_LAGUIPROGRESS",L"Progress", WS_POPUP, 0,0,PROGRESSW+LA_RH*2,LA_RH*2,0,0,MAIN.hinstance,0);
|
|
|
+
|
|
|
+ MAIN.Progress.hdc=GetDC(MAIN.Progress.w);
|
|
|
+
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
void laSetFontFolderPath(char* absolute){
|
|
@@ -6676,6 +6727,9 @@ LRESULT CALLBACK LA_WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
|
|
|
}
|
|
|
return DefWindowProc(hwnd, message, wparam, lparam);
|
|
|
}
|
|
|
+LRESULT CALLBACK LA_ProgressWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam){
|
|
|
+ return DefWindowProc(hwnd, message, wparam, lparam);
|
|
|
+}
|
|
|
#endif
|
|
|
|
|
|
int la_UpdateOperatorHints(laWindow* w){
|