|
@@ -50,7 +50,11 @@ laOperator *DEB;
|
|
|
|
|
|
laColumn *DEBUG_C;
|
|
|
|
|
|
+#ifdef _WIN32
|
|
|
+#define LA_GUI_WNDCLASS_NAME L"NUL4_GUI_CLASS"
|
|
|
+#else
|
|
|
#define LA_GUI_WNDCLASS_NAME "NUL4_GUI_CLASS"
|
|
|
+#endif
|
|
|
|
|
|
#ifdef __linux__
|
|
|
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
|
|
@@ -382,8 +386,13 @@ void laRenameWindow(laWindow* wnd, char* name){
|
|
|
#ifdef __linux__
|
|
|
XStoreName(MAIN.dpy, wnd->win, name);
|
|
|
#endif
|
|
|
+#ifdef _WIN32
|
|
|
+ //wchar_t buf[128]; MultiByteToWideChar(CP_UTF8, 0, name, -1, buf, 128);
|
|
|
+ SetWindowTextW(wnd->win, name);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
+#ifdef __linux__
|
|
|
const char* la_ConvertCursorID(int id){
|
|
|
switch (id) {
|
|
|
case LA_ARROW: return "arrow";
|
|
@@ -396,6 +405,21 @@ const char* la_ConvertCursorID(int id){
|
|
|
}
|
|
|
return "arrow";
|
|
|
}
|
|
|
+#endif
|
|
|
+#ifdef _WIN32
|
|
|
+HCURSOR la_ConvertCursorID(int id){
|
|
|
+ switch (id){
|
|
|
+ case LA_ARROW: return LoadCursor(0,IDC_ARROW);
|
|
|
+ case LA_CROSS: return LoadCursor(0,IDC_CROSS);
|
|
|
+ case LA_LEFT_AND_RIGHT: return LoadCursor(0,IDC_SIZEWE);
|
|
|
+ case LA_UP_AND_DOWN: return LoadCursor(0, IDC_SIZENS);
|
|
|
+ case LA_MOVE: return LoadCursor(0, IDC_SIZEALL);
|
|
|
+ case LA_HAND: return LoadCursor(0, IDC_HAND);
|
|
|
+ case LA_CORNER: return LoadCursor(0, IDC_SIZENWSE);
|
|
|
+ }
|
|
|
+ return LoadCursor(0, IDC_ARROW);;
|
|
|
+}
|
|
|
+#endif
|
|
|
|
|
|
void la_InitThreadEnviornment(){
|
|
|
//pthread_spin_init(&MAIN.csNotifier, //pthread_PROCESS_PRIVATE);
|
|
@@ -608,15 +632,17 @@ int laGetReadyWith(int GLMajor, int GLMinor, int BufferSamples){
|
|
|
MAIN.wmfullscroff=XInternAtom(MAIN.dpy,"_NET_WM_STATE_FULLSCREEN",0);
|
|
|
#endif //linux
|
|
|
#ifdef _WIN32
|
|
|
+ setlocale(LC_ALL, "zh_CN.utf8");
|
|
|
+
|
|
|
MAIN.hinstance = GetModuleHandle(NULL);
|
|
|
|
|
|
HINSTANCE* hInst = &MAIN.hinstance;
|
|
|
- WNDCLASSEX wt;
|
|
|
- wt.cbSize = sizeof(WNDCLASSEX);
|
|
|
+ WNDCLASSEXW wt;
|
|
|
+ wt.cbSize = sizeof(WNDCLASSEXW);
|
|
|
wt.cbClsExtra = 0;
|
|
|
wt.cbWndExtra = 0;
|
|
|
wt.hbrBackground = 0;
|
|
|
- wt.hCursor = LoadCursor(*hInst, IDC_ARROW);
|
|
|
+ wt.hCursor = LoadCursor(0, IDC_ARROW);
|
|
|
wt.hIcon = LoadIcon(*hInst, IDI_WINLOGO);
|
|
|
wt.hIconSm = LoadIcon(*hInst, IDI_WINLOGO);
|
|
|
wt.hInstance = *hInst;
|
|
@@ -2125,6 +2151,9 @@ void laSetWindowCursor(int id){
|
|
|
Cursor c = XcursorLibraryLoadCursor(MAIN.dpy, la_ConvertCursorID(id));
|
|
|
XDefineCursor(MAIN.dpy, MAIN.CurrentWindow->win, c);
|
|
|
#endif
|
|
|
+#ifdef _WIN32
|
|
|
+ SetCursor(la_ConvertCursorID(id));
|
|
|
+#endif
|
|
|
};
|
|
|
void la_AssignBlockPP(laBlock* b){
|
|
|
b->PP.EndInstance = b;
|
|
@@ -2676,7 +2705,7 @@ void laDestroySinglePanel(laPanel *p, int immediate){
|
|
|
|
|
|
la_DestroyUiList(&p->UI, 1, 1, 0);
|
|
|
la_DestroyUiList(&p->TitleBar, 1, 1, 0);
|
|
|
- la_DestroyUiList(p->MenuRefer, 0, 1, 1);
|
|
|
+ //la_DestroyUiList(p->MenuRefer, 0, 1, 1);
|
|
|
|
|
|
if (p->Mode){
|
|
|
p->AnimationMode = LA_PANEL_ANIMATION_DISSOVE; laRefreshWindow();
|
|
@@ -6516,6 +6545,9 @@ LRESULT CALLBACK LA_WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
|
|
|
char mbuf[10] = { 0 }; uint32_t uchar=0;
|
|
|
short wheelmark = 0;
|
|
|
int WheelDir = 0;
|
|
|
+ UINT32 pointerId; POINTER_INPUT_TYPE pointerType;
|
|
|
+ POINTER_PEN_INFO penInfo; POINTER_TOUCH_INFO touchInfo;
|
|
|
+ POINT point;
|
|
|
if (!hwnd) return DefWindowProc(hwnd, message, wparam, lparam);
|
|
|
switch (message) {
|
|
|
case WM_PAINT:
|
|
@@ -6523,6 +6555,7 @@ LRESULT CALLBACK LA_WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
|
|
|
break;
|
|
|
case WM_MOUSEMOVE:
|
|
|
la_SendMouseEvent(hwnd, LA_MOUSEMOVE, PARAM_2_FROM(lparam));
|
|
|
+ MAIN.IsPen = 0; MAIN.PointerIsEraser = 0;
|
|
|
break;
|
|
|
|
|
|
case WM_LBUTTONDOWN:
|
|
@@ -6559,8 +6592,32 @@ LRESULT CALLBACK LA_WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
|
|
|
}
|
|
|
break;
|
|
|
case WM_SIZE:
|
|
|
+ if (wparam == SIZE_MINIMIZED) break;
|
|
|
la_CommandResizeWindow(hwnd, 0, 0, LOWORD(lparam), HIWORD(lparam));
|
|
|
break;
|
|
|
+ case WM_POINTERUPDATE:
|
|
|
+ pointerId = GET_POINTERID_WPARAM(wparam);
|
|
|
+ pointerType = PT_POINTER;
|
|
|
+
|
|
|
+ if(!GetPointerType(pointerId, &pointerType)){
|
|
|
+ pointerType = PT_POINTER;
|
|
|
+ printf("is pointer\n");
|
|
|
+ }
|
|
|
+ if(pointerType == PT_PEN){
|
|
|
+ if(GetPointerPenInfo(pointerId, &penInfo)){
|
|
|
+ point.x = penInfo.pointerInfo.ptPixelLocation.x; point.y = penInfo.pointerInfo.ptPixelLocation.y;
|
|
|
+ ScreenToClient(hwnd, &point);
|
|
|
+ MAIN.IsPen = 1; MAIN.StylusPressure = (real)penInfo.pressure / 1024; MAIN.PointerIsEraser = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (pointerType == PT_TOUCH){
|
|
|
+ if (GetPointerTouchInfo(pointerId, &touchInfo)) {
|
|
|
+ point.x = touchInfo.pointerInfo.ptPixelLocation.x; point.y = touchInfo.pointerInfo.ptPixelLocation.y;
|
|
|
+ ScreenToClient(hwnd, &point);
|
|
|
+ MAIN.IsPen = 1; MAIN.StylusPressure = (real)touchInfo.pressure / 1024; MAIN.PointerIsEraser = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
|
|
|
//case WM_SYSKEYDOWN:
|
|
|
// if (lparam & 0x40000000) break;
|
|
@@ -6759,6 +6816,9 @@ int laCopyToClipboard(unsigned char * text){
|
|
|
#endif
|
|
|
}
|
|
|
int la_ProcessSysMessage(){
|
|
|
+ int SendDelay = 0, SendIdle = 0;
|
|
|
+ if (!MAIN.DelayTriggered && MAIN.TimeAccum - MAIN.DelayStart > MAIN.DelayTime) SendDelay = 1;
|
|
|
+ if (!MAIN.IdleTriggered && MAIN.TimeAccum - MAIN.IdleStart > MAIN.IdleTime) SendIdle = 1;
|
|
|
#ifdef __linux__
|
|
|
XEvent e;
|
|
|
int type;
|
|
@@ -6768,10 +6828,6 @@ int la_ProcessSysMessage(){
|
|
|
Status InputStatus = 0;
|
|
|
laWindow* wnd ;
|
|
|
|
|
|
- int SendDelay=0,SendIdle=0;
|
|
|
- if(!MAIN.DelayTriggered && MAIN.TimeAccum-MAIN.DelayStart>MAIN.DelayTime) SendDelay=1;
|
|
|
- if(!MAIN.IdleTriggered && MAIN.TimeAccum-MAIN.IdleStart>MAIN.IdleTime) SendIdle=1;
|
|
|
-
|
|
|
while(XPending(MAIN.dpy)){
|
|
|
XGenericEventCookie *cookie = &e.xcookie;
|
|
|
XNextEvent(MAIN.dpy, &e);
|
|
@@ -6878,13 +6934,6 @@ int la_ProcessSysMessage(){
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- for(laWindow* w=MAIN.Windows.pFirst;w;w=w->Item.pNext){
|
|
|
- if(SendDelay) { la_SendTimerEvent(w->win, LA_TIME_DELAY); MAIN.DelayTriggered=1; }
|
|
|
- if(SendIdle) { la_SendTimerEvent(w->win, LA_TIME_IDLE); MAIN.IdleTriggered=1; }
|
|
|
- }
|
|
|
-
|
|
|
- return 1;
|
|
|
#endif //linux
|
|
|
#ifdef _WIN32
|
|
|
MSG msg; int Processed = 0;
|
|
@@ -6892,8 +6941,15 @@ int la_ProcessSysMessage(){
|
|
|
|
|
|
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
|
|
|
TranslateMessage(&msg); DispatchMessage(&msg);
|
|
|
+ SendIdle = 0; MAIN.IdleStart = MAIN.TimeAccum; MAIN.IdleTriggered = 0;
|
|
|
};
|
|
|
#endif
|
|
|
+
|
|
|
+ for(laWindow* w=MAIN.Windows.pFirst;w;w=w->Item.pNext){
|
|
|
+ if(SendDelay) { la_SendTimerEvent(w->win, LA_TIME_DELAY); MAIN.DelayTriggered=1; }
|
|
|
+ if(SendIdle) { la_SendTimerEvent(w->win, LA_TIME_IDLE); MAIN.IdleTriggered=1; }
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
};
|
|
|
|
|
|
void la_PrintOperatorStack(){
|