Mercurial > dwindows
comparison os2/dw.c @ 2623:d19652f760d7
OS/2: Standardize internal function name style...
This isn't as important on OS/2 and Windows since they use explicit exports...
But still think we should follow a consistent pattern, despite the history.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 26 Jul 2021 23:28:50 +0000 |
parents | d17e3fb76bde |
children | 42cacc1a1783 |
comparison
equal
deleted
inserted
replaced
2622:07c504257e42 | 2623:d19652f760d7 |
---|---|
58 #define API_FUNC * API | 58 #define API_FUNC * API |
59 #else | 59 #else |
60 #define API_FUNC API * | 60 #define API_FUNC API * |
61 #endif | 61 #endif |
62 | 62 |
63 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); | 63 MRESULT EXPENTRY _dw_run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); |
64 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); | 64 MRESULT EXPENTRY _dw_wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); |
65 MRESULT EXPENTRY _scrollwndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); | 65 MRESULT EXPENTRY _dw_scrollwndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); |
66 void _do_resize(Box *thisbox, int x, int y); | 66 void _dw_do_resize(Box *thisbox, int x, int y); |
67 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); | 67 void _dw_handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); |
68 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height, int *depth, unsigned long backrgb); | 68 int _dw_load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height, int *depth, unsigned long backrgb); |
69 void _free_menu_data(HWND menu); | 69 void _dw_free_menu_data(HWND menu); |
70 BOOL (API_FUNC _WinQueryDesktopWorkArea)(HWND hwndDesktop, PWRECT pwrcWorkArea) = 0; | 70 BOOL (API_FUNC _WinQueryDesktopWorkArea)(HWND hwndDesktop, PWRECT pwrcWorkArea) = 0; |
71 /* PMPrintf support for dw_debug() */ | 71 /* PMPrintf support for dw_debug() */ |
72 ULONG (API_FUNC _PmPrintfString)(char *String) = 0; | 72 ULONG (API_FUNC _PmPrintfString)(char *String) = 0; |
73 /* GBM (Generalize Bitmap Module) support for file loading */ | 73 /* GBM (Generalize Bitmap Module) support for file loading */ |
74 #pragma pack(4) | 74 #pragma pack(4) |
176 typedef struct | 176 typedef struct |
177 { | 177 { |
178 ULONG message; | 178 ULONG message; |
179 char name[30]; | 179 char name[30]; |
180 | 180 |
181 } SignalList; | 181 } DWSignalList; |
182 | 182 |
183 /* List of signals and their equivilent OS/2 message */ | 183 /* List of signals and their equivilent OS/2 message */ |
184 #define SIGNALMAX 16 | 184 #define SIGNALMAX 16 |
185 | 185 |
186 SignalList SignalTranslate[SIGNALMAX] = { | 186 DWSignalList DWSignalTranslate[SIGNALMAX] = { |
187 { WM_SIZE, DW_SIGNAL_CONFIGURE }, | 187 { WM_SIZE, DW_SIGNAL_CONFIGURE }, |
188 { WM_CHAR, DW_SIGNAL_KEY_PRESS }, | 188 { WM_CHAR, DW_SIGNAL_KEY_PRESS }, |
189 { WM_BUTTON1DOWN, DW_SIGNAL_BUTTON_PRESS }, | 189 { WM_BUTTON1DOWN, DW_SIGNAL_BUTTON_PRESS }, |
190 { WM_BUTTON1UP, DW_SIGNAL_BUTTON_RELEASE }, | 190 { WM_BUTTON1UP, DW_SIGNAL_BUTTON_RELEASE }, |
191 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY }, | 191 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY }, |
201 { BKN_PAGESELECTED,DW_SIGNAL_SWITCH_PAGE }, | 201 { BKN_PAGESELECTED,DW_SIGNAL_SWITCH_PAGE }, |
202 { CN_EXPANDTREE, DW_SIGNAL_TREE_EXPAND } | 202 { CN_EXPANDTREE, DW_SIGNAL_TREE_EXPAND } |
203 }; | 203 }; |
204 | 204 |
205 /* Internal function to keep a semi-unique ID within valid range */ | 205 /* Internal function to keep a semi-unique ID within valid range */ |
206 USHORT _GlobalID(void) | 206 USHORT _dw_global_id(void) |
207 { | 207 { |
208 static USHORT GlobalID = 9999; | 208 static USHORT GlobalID = 9999; |
209 | 209 |
210 GlobalID++; | 210 GlobalID++; |
211 if(GlobalID >= 65534) | 211 if(GlobalID >= 65534) |
215 return GlobalID; | 215 return GlobalID; |
216 } | 216 } |
217 | 217 |
218 /* This function adds a signal handler callback into the linked list. | 218 /* This function adds a signal handler callback into the linked list. |
219 */ | 219 */ |
220 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *discfunc, void *data) | 220 void _dw_new_signal(ULONG message, HWND window, int id, void *signalfunction, void *discfunc, void *data) |
221 { | 221 { |
222 SignalHandler *new = malloc(sizeof(SignalHandler)); | 222 SignalHandler *new = malloc(sizeof(SignalHandler)); |
223 | 223 |
224 new->message = message; | 224 new->message = message; |
225 new->window = window; | 225 new->window = window; |
254 Root = new; | 254 Root = new; |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 /* Finds the message number for a given signal name */ | 258 /* Finds the message number for a given signal name */ |
259 ULONG _findsigmessage(const char *signame) | 259 ULONG _dw_findsigmessage(const char *signame) |
260 { | 260 { |
261 int z; | 261 int z; |
262 | 262 |
263 for(z=0;z<SIGNALMAX;z++) | 263 for(z=0;z<SIGNALMAX;z++) |
264 { | 264 { |
265 if(stricmp(signame, SignalTranslate[z].name) == 0) | 265 if(stricmp(signame, DWSignalTranslate[z].name) == 0) |
266 return SignalTranslate[z].message; | 266 return DWSignalTranslate[z].message; |
267 } | 267 } |
268 return 0L; | 268 return 0L; |
269 } | 269 } |
270 | 270 |
271 typedef struct _CNRITEM | 271 typedef struct _CNRITEM |
276 HTREEITEM parent; | 276 HTREEITEM parent; |
277 | 277 |
278 } CNRITEM, *PCNRITEM; | 278 } CNRITEM, *PCNRITEM; |
279 | 279 |
280 | 280 |
281 int _null_key(HWND DW_UNUSED(window), int DW_UNUSED(key), void * DW_UNUSED(data)) | 281 int _dw_null_key(HWND DW_UNUSED(window), int DW_UNUSED(key), void * DW_UNUSED(data)) |
282 { | 282 { |
283 return TRUE; | 283 return TRUE; |
284 } | 284 } |
285 | 285 |
286 /* Internal function to queue a window redraw */ | 286 /* Internal function to queue a window redraw */ |
298 dw_window_redraw(redraw); | 298 dw_window_redraw(redraw); |
299 } | 299 } |
300 } | 300 } |
301 | 301 |
302 /* Find the desktop window handle */ | 302 /* Find the desktop window handle */ |
303 HWND _toplevel_window(HWND handle) | 303 HWND _dw_toplevel_window(HWND handle) |
304 { | 304 { |
305 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT); | 305 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT); |
306 | 306 |
307 if(lastbox == desktop) | 307 if(lastbox == desktop) |
308 return handle; | 308 return handle; |
323 return NULLHANDLE; | 323 return NULLHANDLE; |
324 } | 324 } |
325 | 325 |
326 | 326 |
327 /* Returns height of specified window. */ | 327 /* Returns height of specified window. */ |
328 int _get_height(HWND handle) | 328 int _dw_get_height(HWND handle) |
329 { | 329 { |
330 unsigned long height; | 330 unsigned long height; |
331 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height); | 331 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height); |
332 return (int)height; | 332 return (int)height; |
333 } | 333 } |
334 | 334 |
335 /* Find the height of the frame a desktop style window is sitting on */ | 335 /* Find the height of the frame a desktop style window is sitting on */ |
336 int _get_frame_height(HWND handle) | 336 int _dw_get_frame_height(HWND handle) |
337 { | 337 { |
338 while(handle) | 338 while(handle) |
339 { | 339 { |
340 HWND client; | 340 HWND client; |
341 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) | 341 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) |
342 { | 342 { |
343 return _get_height(WinQueryWindow(handle, QW_PARENT)); | 343 return _dw_get_height(WinQueryWindow(handle, QW_PARENT)); |
344 } | 344 } |
345 handle = WinQueryWindow(handle, QW_PARENT); | 345 handle = WinQueryWindow(handle, QW_PARENT); |
346 } | 346 } |
347 return dw_screen_height(); | 347 return dw_screen_height(); |
348 } | 348 } |
370 { | 370 { |
371 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); | 371 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); |
372 } | 372 } |
373 | 373 |
374 /* Return the entryfield child of a window */ | 374 /* Return the entryfield child of a window */ |
375 HWND _find_entryfield(HWND handle) | 375 HWND _dw_find_entryfield(HWND handle) |
376 { | 376 { |
377 HENUM henum; | 377 HENUM henum; |
378 HWND child, entry = 0; | 378 HWND child, entry = 0; |
379 | 379 |
380 henum = WinBeginEnumWindows(handle); | 380 henum = WinBeginEnumWindows(handle); |
395 } | 395 } |
396 | 396 |
397 /* This function changes the owner of buttons in to the | 397 /* This function changes the owner of buttons in to the |
398 * dynamicwindows handle to fix a problem in notebooks. | 398 * dynamicwindows handle to fix a problem in notebooks. |
399 */ | 399 */ |
400 void _fix_button_owner(HWND handle, HWND dw) | 400 void _dw_fix_button_owner(HWND handle, HWND dw) |
401 { | 401 { |
402 HENUM henum; | 402 HENUM henum; |
403 HWND child; | 403 HWND child; |
404 | 404 |
405 henum = WinBeginEnumWindows(handle); | 405 henum = WinBeginEnumWindows(handle); |
412 if(strncmp(tmpbuf, "#3", 3)==0 && dw) /* Button */ | 412 if(strncmp(tmpbuf, "#3", 3)==0 && dw) /* Button */ |
413 WinSetOwner(child, dw); | 413 WinSetOwner(child, dw); |
414 else if(strncmp(tmpbuf, "dynamicwindows", 14) == 0) | 414 else if(strncmp(tmpbuf, "dynamicwindows", 14) == 0) |
415 dw = child; | 415 dw = child; |
416 | 416 |
417 _fix_button_owner(child, dw); | 417 _dw_fix_button_owner(child, dw); |
418 } | 418 } |
419 WinEndEnumWindows(henum); | 419 WinEndEnumWindows(henum); |
420 return; | 420 return; |
421 } | 421 } |
422 | 422 |
423 /* Free bitmap data associated with a window */ | 423 /* Free bitmap data associated with a window */ |
424 void _free_bitmap(HWND handle) | 424 void _dw_free_bitmap(HWND handle) |
425 { | 425 { |
426 HBITMAP hbm = (HBITMAP)dw_window_get_data(handle, "_dw_bitmap"); | 426 HBITMAP hbm = (HBITMAP)dw_window_get_data(handle, "_dw_bitmap"); |
427 HPS hps = (HPS)dw_window_get_data(handle, "_dw_hps"); | 427 HPS hps = (HPS)dw_window_get_data(handle, "_dw_hps"); |
428 HDC hdc = (HDC)dw_window_get_data(handle, "_dw_hdc"); | 428 HDC hdc = (HDC)dw_window_get_data(handle, "_dw_hdc"); |
429 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap"); | 429 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap"); |
462 } | 462 } |
463 | 463 |
464 /* This function removes any handlers on windows and frees | 464 /* This function removes any handlers on windows and frees |
465 * the user memory allocated to it. | 465 * the user memory allocated to it. |
466 */ | 466 */ |
467 void _free_window_memory(HWND handle) | 467 void _dw_free_window_memory(HWND handle) |
468 { | 468 { |
469 HENUM henum; | 469 HENUM henum; |
470 HWND child; | 470 HWND child; |
471 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER); | 471 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER); |
472 | 472 |
473 dw_signal_disconnect_by_window(handle); | 473 dw_signal_disconnect_by_window(handle); |
474 | 474 |
475 if((child = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) | 475 if((child = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) |
476 _free_menu_data(child); | 476 _dw_free_menu_data(child); |
477 | 477 |
478 if((child = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) | 478 if((child = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) |
479 { | 479 { |
480 Box *box = (Box *)WinQueryWindowPtr(child, QWP_USER); | 480 Box *box = (Box *)WinQueryWindowPtr(child, QWP_USER); |
481 | 481 |
497 WinQueryClassName(handle, 99, (PCH)tmpbuf); | 497 WinQueryClassName(handle, 99, (PCH)tmpbuf); |
498 | 498 |
499 if(strncmp(tmpbuf, "ColorSelectClass", 17)!=0) | 499 if(strncmp(tmpbuf, "ColorSelectClass", 17)!=0) |
500 { | 500 { |
501 /* If this window has an associate bitmap destroy it. */ | 501 /* If this window has an associate bitmap destroy it. */ |
502 _free_bitmap(handle); | 502 _dw_free_bitmap(handle); |
503 | 503 |
504 if(strncmp(tmpbuf, "#1", 3)==0 && !WinWindowFromID(handle, FID_CLIENT)) | 504 if(strncmp(tmpbuf, "#1", 3)==0 && !WinWindowFromID(handle, FID_CLIENT)) |
505 { | 505 { |
506 Box *box = (Box *)ptr; | 506 Box *box = (Box *)ptr; |
507 | 507 |
547 } | 547 } |
548 } | 548 } |
549 | 549 |
550 henum = WinBeginEnumWindows(handle); | 550 henum = WinBeginEnumWindows(handle); |
551 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | 551 while((child = WinGetNextWindow(henum)) != NULLHANDLE) |
552 _free_window_memory(child); | 552 _dw_free_window_memory(child); |
553 | 553 |
554 WinEndEnumWindows(henum); | 554 WinEndEnumWindows(henum); |
555 return; | 555 return; |
556 } | 556 } |
557 | 557 |
558 void _free_menu_data(HWND menu) | 558 void _dw_free_menu_data(HWND menu) |
559 { | 559 { |
560 int i, count = (int)WinSendMsg(menu, MM_QUERYITEMCOUNT, 0, 0); | 560 int i, count = (int)WinSendMsg(menu, MM_QUERYITEMCOUNT, 0, 0); |
561 | 561 |
562 dw_signal_disconnect_by_name(menu, DW_SIGNAL_CLICKED); | 562 dw_signal_disconnect_by_name(menu, DW_SIGNAL_CLICKED); |
563 _free_window_memory(menu); | 563 _dw_free_window_memory(menu); |
564 | 564 |
565 for(i=0;i<count;i++) | 565 for(i=0;i<count;i++) |
566 { | 566 { |
567 SHORT menuid = (SHORT)(LONG)WinSendMsg(menu, MM_ITEMIDFROMPOSITION, MPFROMSHORT(i), 0); | 567 SHORT menuid = (SHORT)(LONG)WinSendMsg(menu, MM_ITEMIDFROMPOSITION, MPFROMSHORT(i), 0); |
568 MENUITEM mi; | 568 MENUITEM mi; |
583 } | 583 } |
584 | 584 |
585 /* Check any submenus */ | 585 /* Check any submenus */ |
586 if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi)) | 586 if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi)) |
587 && mi.hwndSubMenu) | 587 && mi.hwndSubMenu) |
588 _free_menu_data(mi.hwndSubMenu); | 588 _dw_free_menu_data(mi.hwndSubMenu); |
589 } | 589 } |
590 } | 590 } |
591 | 591 |
592 /* This function returns 1 if the window (widget) handle | 592 /* This function returns 1 if the window (widget) handle |
593 * passed to it is a valid window that can gain input focus. | 593 * passed to it is a valid window that can gain input focus. |
594 */ | 594 */ |
595 int _validate_focus(HWND handle) | 595 int _dw_validate_focus(HWND handle) |
596 { | 596 { |
597 char tmpbuf[100] = {0}; | 597 char tmpbuf[100] = {0}; |
598 | 598 |
599 if(!handle) | 599 if(!handle) |
600 return 0; | 600 return 0; |
623 } | 623 } |
624 | 624 |
625 #define _DW_DIRECTION_FORWARD -1 | 625 #define _DW_DIRECTION_FORWARD -1 |
626 #define _DW_DIRECTION_BACKWARD 1 | 626 #define _DW_DIRECTION_BACKWARD 1 |
627 | 627 |
628 int _focus_check_box(Box *box, HWND handle, int start, int direction, HWND defaultitem); | 628 int _dw_focus_check_box(Box *box, HWND handle, int start, int direction, HWND defaultitem); |
629 | 629 |
630 /* Internal comparision function */ | 630 /* Internal comparision function */ |
631 int _focus_comp(int direction, int z, int end) | 631 int _dw_focus_comp(int direction, int z, int end) |
632 { | 632 { |
633 if(direction == _DW_DIRECTION_FORWARD) | 633 if(direction == _DW_DIRECTION_FORWARD) |
634 return z > -1; | 634 return z > -1; |
635 return z < end; | 635 return z < end; |
636 } | 636 } |
637 int _focus_notebook(HWND hwnd, HWND handle, int start, int direction, HWND defaultitem) | 637 int _dw_focus_notebook(HWND hwnd, HWND handle, int start, int direction, HWND defaultitem) |
638 { | 638 { |
639 Box *notebox; | 639 Box *notebox; |
640 HWND page = (HWND)WinSendMsg(hwnd, BKM_QUERYPAGEWINDOWHWND, | 640 HWND page = (HWND)WinSendMsg(hwnd, BKM_QUERYPAGEWINDOWHWND, |
641 (MPARAM)dw_notebook_page_get(hwnd), 0); | 641 (MPARAM)dw_notebook_page_get(hwnd), 0); |
642 | 642 |
643 if(page) | 643 if(page) |
644 { | 644 { |
645 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); | 645 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); |
646 | 646 |
647 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, direction, defaultitem)) | 647 if(notebox && _dw_focus_check_box(notebox, handle, start == 3 ? 3 : 0, direction, defaultitem)) |
648 return 1; | 648 return 1; |
649 } | 649 } |
650 return 0; | 650 return 0; |
651 } | 651 } |
652 | 652 |
653 int _focus_check_box(Box *box, HWND handle, int start, int direction, HWND defaultitem) | 653 int _dw_focus_check_box(Box *box, HWND handle, int start, int direction, HWND defaultitem) |
654 { | 654 { |
655 int z; | 655 int z; |
656 static HWND lasthwnd, firsthwnd; | 656 static HWND lasthwnd, firsthwnd; |
657 static int finish_searching; | 657 static int finish_searching; |
658 int beg = (direction == _DW_DIRECTION_FORWARD) ? box->count-1 : 0; | 658 int beg = (direction == _DW_DIRECTION_FORWARD) ? box->count-1 : 0; |
678 lasthwnd = handle; | 678 lasthwnd = handle; |
679 finish_searching = 0; | 679 finish_searching = 0; |
680 firsthwnd = 0; | 680 firsthwnd = 0; |
681 } | 681 } |
682 | 682 |
683 for(z=beg;_focus_comp(direction, z, end);z+=direction) | 683 for(z=beg;_dw_focus_comp(direction, z, end);z+=direction) |
684 { | 684 { |
685 if(box->items[z].type == TYPEBOX) | 685 if(box->items[z].type == TYPEBOX) |
686 { | 686 { |
687 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); | 687 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); |
688 | 688 |
689 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, direction, defaultitem)) | 689 if(thisbox && _dw_focus_check_box(thisbox, handle, start == 3 ? 3 : 0, direction, defaultitem)) |
690 return 1; | 690 return 1; |
691 } | 691 } |
692 else | 692 else |
693 { | 693 { |
694 int type = _validate_focus(box->items[z].hwnd); | 694 int type = _dw_validate_focus(box->items[z].hwnd); |
695 | 695 |
696 /* Special case notebook, can focus and contains items */ | 696 /* Special case notebook, can focus and contains items */ |
697 if(type == 2 && direction == _DW_DIRECTION_FORWARD && _focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) | 697 if(type == 2 && direction == _DW_DIRECTION_FORWARD && _dw_focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) |
698 return 1; | 698 return 1; |
699 if(box->items[z].hwnd == handle) | 699 if(box->items[z].hwnd == handle) |
700 { | 700 { |
701 if(lasthwnd == handle && firsthwnd) | 701 if(lasthwnd == handle && firsthwnd) |
702 WinSetFocus(HWND_DESKTOP, firsthwnd); | 702 WinSetFocus(HWND_DESKTOP, firsthwnd); |
709 * return immediately. | 709 * return immediately. |
710 */ | 710 */ |
711 if(!finish_searching) | 711 if(!finish_searching) |
712 return 1; | 712 return 1; |
713 } | 713 } |
714 if(_validate_focus(box->items[z].hwnd)) | 714 if(_dw_validate_focus(box->items[z].hwnd)) |
715 { | 715 { |
716 /* Start is 3 when we are looking for the | 716 /* Start is 3 when we are looking for the |
717 * first valid item in the layout. | 717 * first valid item in the layout. |
718 */ | 718 */ |
719 if(start == 3) | 719 if(start == 3) |
742 | 742 |
743 if(mybox) | 743 if(mybox) |
744 { | 744 { |
745 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); | 745 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
746 | 746 |
747 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, direction, defaultitem)) | 747 if(splitbox && _dw_focus_check_box(splitbox, handle, start == 3 ? 3 : 0, direction, defaultitem)) |
748 return 1; | 748 return 1; |
749 } | 749 } |
750 | 750 |
751 /* Try the top or left box */ | 751 /* Try the top or left box */ |
752 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, (direction == _DW_DIRECTION_FORWARD) ? "_dw_topleft" : "_dw_bottomright"); | 752 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, (direction == _DW_DIRECTION_FORWARD) ? "_dw_topleft" : "_dw_bottomright"); |
753 | 753 |
754 if(mybox) | 754 if(mybox) |
755 { | 755 { |
756 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); | 756 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
757 | 757 |
758 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, direction, defaultitem)) | 758 if(splitbox && _dw_focus_check_box(splitbox, handle, start == 3 ? 3 : 0, direction, defaultitem)) |
759 return 1; | 759 return 1; |
760 } | 760 } |
761 } | 761 } |
762 else if(strncmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) /* Scrollbox */ | 762 else if(strncmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) /* Scrollbox */ |
763 { | 763 { |
766 | 766 |
767 if(mybox) | 767 if(mybox) |
768 { | 768 { |
769 Box *scrollbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); | 769 Box *scrollbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
770 | 770 |
771 if(scrollbox && _focus_check_box(scrollbox, handle, start == 3 ? 3 : 0, direction, defaultitem)) | 771 if(scrollbox && _dw_focus_check_box(scrollbox, handle, start == 3 ? 3 : 0, direction, defaultitem)) |
772 return 1; | 772 return 1; |
773 } | 773 } |
774 } | 774 } |
775 } | 775 } |
776 /* Special case notebook, can focus and contains items */ | 776 /* Special case notebook, can focus and contains items */ |
777 if(type == 2 && direction == _DW_DIRECTION_BACKWARD && _focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) | 777 if(type == 2 && direction == _DW_DIRECTION_BACKWARD && _dw_focus_notebook(box->items[z].hwnd, handle, start, direction, defaultitem)) |
778 return 1; | 778 return 1; |
779 } | 779 } |
780 } | 780 } |
781 return 0; | 781 return 0; |
782 } | 782 } |
783 | 783 |
784 /* This function finds the first widget in the | 784 /* This function finds the first widget in the |
785 * layout and moves the current focus to it. | 785 * layout and moves the current focus to it. |
786 */ | 786 */ |
787 int _initial_focus(HWND handle) | 787 int _dw_initial_focus(HWND handle) |
788 { | 788 { |
789 Box *thisbox = NULL; | 789 Box *thisbox = NULL; |
790 HWND box; | 790 HWND box; |
791 | 791 |
792 box = WinWindowFromID(handle, FID_CLIENT); | 792 box = WinWindowFromID(handle, FID_CLIENT); |
794 thisbox = WinQueryWindowPtr(box, QWP_USER); | 794 thisbox = WinQueryWindowPtr(box, QWP_USER); |
795 else | 795 else |
796 return 1; | 796 return 1; |
797 | 797 |
798 if(thisbox) | 798 if(thisbox) |
799 _focus_check_box(thisbox, handle, 3, _DW_DIRECTION_FORWARD, thisbox->defaultitem); | 799 _dw_focus_check_box(thisbox, handle, 3, _DW_DIRECTION_FORWARD, thisbox->defaultitem); |
800 return 0; | 800 return 0; |
801 } | 801 } |
802 | 802 |
803 /* This function finds the current widget in the | 803 /* This function finds the current widget in the |
804 * layout and moves the current focus to the next item. | 804 * layout and moves the current focus to the next item. |
805 */ | 805 */ |
806 void _shift_focus(HWND handle, int direction) | 806 void _dw_shift_focus(HWND handle, int direction) |
807 { | 807 { |
808 Box *thisbox; | 808 Box *thisbox; |
809 HWND box, lastbox = _toplevel_window(handle); | 809 HWND box, lastbox = _dw_toplevel_window(handle); |
810 | 810 |
811 box = WinWindowFromID(lastbox, FID_CLIENT); | 811 box = WinWindowFromID(lastbox, FID_CLIENT); |
812 if(box) | 812 if(box) |
813 thisbox = WinQueryWindowPtr(box, QWP_USER); | 813 thisbox = WinQueryWindowPtr(box, QWP_USER); |
814 else | 814 else |
815 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); | 815 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); |
816 | 816 |
817 if(thisbox) | 817 if(thisbox) |
818 { | 818 { |
819 if(_focus_check_box(thisbox, handle, 1, direction, 0) == 0) | 819 if(_dw_focus_check_box(thisbox, handle, 1, direction, 0) == 0) |
820 _focus_check_box(thisbox, handle, 2, direction, 0); | 820 _dw_focus_check_box(thisbox, handle, 2, direction, 0); |
821 } | 821 } |
822 } | 822 } |
823 | 823 |
824 /* This function will recursively search a box and add up the total height of it */ | 824 /* This function will recursively search a box and add up the total height of it */ |
825 void _count_size(HWND box, int type, int *xsize, int *xorigsize) | 825 void _dw_count_size(HWND box, int type, int *xsize, int *xorigsize) |
826 { | 826 { |
827 int size = 0, origsize = 0, z; | 827 int size = 0, origsize = 0, z; |
828 Box *tmp = WinQueryWindowPtr(box, QWP_USER); | 828 Box *tmp = WinQueryWindowPtr(box, QWP_USER); |
829 | 829 |
830 if(!tmp) | 830 if(!tmp) |
842 { | 842 { |
843 if(tmp->items[z].type == TYPEBOX) | 843 if(tmp->items[z].type == TYPEBOX) |
844 { | 844 { |
845 int s, os; | 845 int s, os; |
846 | 846 |
847 _count_size(tmp->items[z].hwnd, type, &s, &os); | 847 _dw_count_size(tmp->items[z].hwnd, type, &s, &os); |
848 size += s; | 848 size += s; |
849 origsize += os; | 849 origsize += os; |
850 } | 850 } |
851 else | 851 else |
852 { | 852 { |
863 int tmpsize = 0, tmporigsize = 0; | 863 int tmpsize = 0, tmporigsize = 0; |
864 | 864 |
865 for(z=0;z<tmp->count;z++) | 865 for(z=0;z<tmp->count;z++) |
866 { | 866 { |
867 if(tmp->items[z].type == TYPEBOX) | 867 if(tmp->items[z].type == TYPEBOX) |
868 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize); | 868 _dw_count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize); |
869 else | 869 else |
870 { | 870 { |
871 tmpsize = (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height); | 871 tmpsize = (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height); |
872 tmporigsize = (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); | 872 tmporigsize = (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); |
873 } | 873 } |
888 * If rclBounds is NULL, then track rectangle on entire desktop. | 888 * If rclBounds is NULL, then track rectangle on entire desktop. |
889 * rclTrack is in window coorditates and will be mapped to | 889 * rclTrack is in window coorditates and will be mapped to |
890 * desktop. | 890 * desktop. |
891 */ | 891 */ |
892 | 892 |
893 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds) | 893 BOOL _dw_track_rectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds) |
894 { | 894 { |
895 TRACKINFO track; | 895 TRACKINFO track; |
896 APIRET rc; | 896 APIRET rc; |
897 | 897 |
898 track.cxBorder = 1; | 898 track.cxBorder = 1; |
941 *rclTrack = track.rclTrack; | 941 *rclTrack = track.rclTrack; |
942 | 942 |
943 return rc; | 943 return rc; |
944 } | 944 } |
945 | 945 |
946 void _check_resize_notebook(HWND hwnd) | 946 void _dw_check_resize_notebook(HWND hwnd) |
947 { | 947 { |
948 char tmpbuf[100] = {0}; | 948 char tmpbuf[100] = {0}; |
949 | 949 |
950 WinQueryClassName(hwnd, 99, (PCH)tmpbuf); | 950 WinQueryClassName(hwnd, 99, (PCH)tmpbuf); |
951 | 951 |
971 rc.xRight = x + width; | 971 rc.xRight = x + width; |
972 rc.yTop = y + height; | 972 rc.yTop = y + height; |
973 | 973 |
974 WinSendMsg(hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); | 974 WinSendMsg(hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); |
975 | 975 |
976 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); | 976 _dw_do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); |
977 } | 977 } |
978 page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, (MPARAM)page, MPFROM2SHORT(BKA_NEXT, BKA_MAJOR)); | 978 page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, (MPARAM)page, MPFROM2SHORT(BKA_NEXT, BKA_MAJOR)); |
979 } | 979 } |
980 | 980 |
981 } | 981 } |
982 } | 982 } |
983 | 983 |
984 /* Return the OS/2 color from the DW color */ | 984 /* Return the OS/2 color from the DW color */ |
985 unsigned long _internal_color(unsigned long color) | 985 unsigned long _dw_internal_color(unsigned long color) |
986 { | 986 { |
987 if(color < 16) | 987 if(color < 16) |
988 return _colors[color]; | 988 return _colors[color]; |
989 return color; | 989 return color; |
990 } | 990 } |
991 | 991 |
992 unsigned long _os2_color(unsigned long color) | 992 unsigned long _dw_os2_color(unsigned long color) |
993 { | 993 { |
994 return DW_RED_VALUE(color) << 16 | DW_GREEN_VALUE(color) << 8 | DW_BLUE_VALUE(color); | 994 return DW_RED_VALUE(color) << 16 | DW_GREEN_VALUE(color) << 8 | DW_BLUE_VALUE(color); |
995 } | 995 } |
996 | 996 |
997 BOOL _MySetWindowPos(HWND hwnd, HWND parent, HWND behind, LONG x, LONG y, LONG cx, LONG cy, ULONG fl) | 997 BOOL _dw_set_window_pos(HWND hwnd, HWND parent, HWND behind, LONG x, LONG y, LONG cx, LONG cy, ULONG fl) |
998 { | 998 { |
999 int height = _get_height(parent); | 999 int height = _dw_get_height(parent); |
1000 | 1000 |
1001 return WinSetWindowPos(hwnd, behind, x, height - y - cy, cx, cy, fl); | 1001 return WinSetWindowPos(hwnd, behind, x, height - y - cy, cx, cy, fl); |
1002 } | 1002 } |
1003 | 1003 |
1004 #ifdef UNICODE | 1004 #ifdef UNICODE |
1005 #define MAX_CP_NAME 12 /* maximum length of a codepage name */ | 1005 #define MAX_CP_NAME 12 /* maximum length of a codepage name */ |
1006 #define MAX_CP_SPEC 64 /* maximum length of a UconvObject codepage specifier */ | 1006 #define MAX_CP_SPEC 64 /* maximum length of a UconvObject codepage specifier */ |
1007 | 1007 |
1008 char *_WideToUTF8(UniChar *unistr) | 1008 char *_dw_WideToUTF8(UniChar *unistr) |
1009 { | 1009 { |
1010 /* Convert text to UTF-8 codepage */ | 1010 /* Convert text to UTF-8 codepage */ |
1011 char *retval = NULL; | 1011 char *retval = NULL; |
1012 /* Now do the conversion */ | 1012 /* Now do the conversion */ |
1013 ULONG ulBufLen = (UniStrlen(unistr) * 4) + 1; | 1013 ULONG ulBufLen = (UniStrlen(unistr) * 4) + 1; |
1024 else if(pszLocalText) | 1024 else if(pszLocalText) |
1025 free(pszLocalText); | 1025 free(pszLocalText); |
1026 return retval; | 1026 return retval; |
1027 } | 1027 } |
1028 | 1028 |
1029 UniChar *_UTF8toWide(char *utf8str) | 1029 UniChar *_dw_UTF8toWide(char *utf8str) |
1030 { | 1030 { |
1031 /* Convert text to Unicode */ | 1031 /* Convert text to Unicode */ |
1032 UniChar *retval = NULL; | 1032 UniChar *retval = NULL; |
1033 /* Now do the conversion */ | 1033 /* Now do the conversion */ |
1034 UniChar *buf = calloc(strlen(utf8str) + 1, sizeof(UniChar)); | 1034 UniChar *buf = calloc(strlen(utf8str) + 1, sizeof(UniChar)); |
1046 #endif | 1046 #endif |
1047 | 1047 |
1048 /* This function calculates how much space the widgets and boxes require | 1048 /* This function calculates how much space the widgets and boxes require |
1049 * and does expansion as necessary. | 1049 * and does expansion as necessary. |
1050 */ | 1050 */ |
1051 static void _resize_box(Box *thisbox, int *depth, int x, int y, int pass) | 1051 static void _dw_resize_box(Box *thisbox, int *depth, int x, int y, int pass) |
1052 { | 1052 { |
1053 /* Current item position */ | 1053 /* Current item position */ |
1054 int z, currentx = thisbox->pad, currenty = thisbox->pad; | 1054 int z, currentx = thisbox->pad, currenty = thisbox->pad; |
1055 /* Used x, y and padding maximum values... | 1055 /* Used x, y and padding maximum values... |
1056 * These will be used to find the widest or | 1056 * These will be used to find the widest or |
1114 if(pass == 1) | 1114 if(pass == 1) |
1115 { | 1115 { |
1116 (*depth)++; | 1116 (*depth)++; |
1117 | 1117 |
1118 /* Save the newly calculated values on the box */ | 1118 /* Save the newly calculated values on the box */ |
1119 _resize_box(tmp, depth, x, y, pass); | 1119 _dw_resize_box(tmp, depth, x, y, pass); |
1120 | 1120 |
1121 /* Duplicate the values in the item list for use below */ | 1121 /* Duplicate the values in the item list for use below */ |
1122 thisbox->items[z].width = tmp->minwidth; | 1122 thisbox->items[z].width = tmp->minwidth; |
1123 thisbox->items[z].height = tmp->minheight; | 1123 thisbox->items[z].height = tmp->minheight; |
1124 | 1124 |
1246 { | 1246 { |
1247 HWND frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); | 1247 HWND frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); |
1248 /* Make the combobox big enough to drop down. :) */ | 1248 /* Make the combobox big enough to drop down. :) */ |
1249 WinSetWindowPos(handle, HWND_TOP, 0, -100, | 1249 WinSetWindowPos(handle, HWND_TOP, 0, -100, |
1250 width, height + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1250 width, height + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1251 _MySetWindowPos(frame, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, | 1251 _dw_set_window_pos(frame, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, |
1252 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1252 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1253 } | 1253 } |
1254 else if(strncmp(tmpbuf, "#6", 3)==0) | 1254 else if(strncmp(tmpbuf, "#6", 3)==0) |
1255 { | 1255 { |
1256 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */ | 1256 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */ |
1257 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3, | 1257 _dw_set_window_pos(handle, thisbox->hwnd, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3, |
1258 width - 6, height - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1258 width - 6, height - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1259 } | 1259 } |
1260 else if(strncmp(tmpbuf, "#40", 5)==0) | 1260 else if(strncmp(tmpbuf, "#40", 5)==0) |
1261 { | 1261 { |
1262 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, | 1262 _dw_set_window_pos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, |
1263 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1263 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1264 _check_resize_notebook(handle); | 1264 _dw_check_resize_notebook(handle); |
1265 } | 1265 } |
1266 else if(strncmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) | 1266 else if(strncmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) |
1267 { | 1267 { |
1268 /* Handle special case of scrollbox */ | 1268 /* Handle special case of scrollbox */ |
1269 int cx, cy, depth = 0; | 1269 int cx, cy, depth = 0; |
1275 int origx, origy; | 1275 int origx, origy; |
1276 unsigned int hpos = (unsigned int)WinSendMsg(hscroll, SBM_QUERYPOS, 0, 0); | 1276 unsigned int hpos = (unsigned int)WinSendMsg(hscroll, SBM_QUERYPOS, 0, 0); |
1277 unsigned int vpos = (unsigned int)WinSendMsg(vscroll, SBM_QUERYPOS, 0, 0); | 1277 unsigned int vpos = (unsigned int)WinSendMsg(vscroll, SBM_QUERYPOS, 0, 0); |
1278 | 1278 |
1279 /* Position the scrollbox parts */ | 1279 /* Position the scrollbox parts */ |
1280 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1280 _dw_set_window_pos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1281 WinSetWindowPos(client, HWND_TOP, 0, WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1281 WinSetWindowPos(client, HWND_TOP, 0, WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1282 WinSetWindowPos(hscroll, HWND_TOP, 0, 0, width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1282 WinSetWindowPos(hscroll, HWND_TOP, 0, 0, width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1283 WinSetWindowPos(vscroll, HWND_TOP, width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1283 WinSetWindowPos(vscroll, HWND_TOP, width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1284 | 1284 |
1285 origx = cx = width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL); | 1285 origx = cx = width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL); |
1286 origy = cy = height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL); | 1286 origy = cy = height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL); |
1287 | 1287 |
1288 /* Get the required space for the box */ | 1288 /* Get the required space for the box */ |
1289 _resize_box(contentbox, &depth, cx, cy, 1); | 1289 _dw_resize_box(contentbox, &depth, cx, cy, 1); |
1290 | 1290 |
1291 if(cx < contentbox->minwidth) | 1291 if(cx < contentbox->minwidth) |
1292 { | 1292 { |
1293 cx = contentbox->minwidth; | 1293 cx = contentbox->minwidth; |
1294 } | 1294 } |
1319 WinSetWindowPos(box, HWND_TOP, -hpos, -(cy - origy - vpos), cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1319 WinSetWindowPos(box, HWND_TOP, -hpos, -(cy - origy - vpos), cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1320 | 1320 |
1321 dw_window_set_data(handle, "_dw_cy", (void *)(cy - origy)); | 1321 dw_window_set_data(handle, "_dw_cy", (void *)(cy - origy)); |
1322 | 1322 |
1323 /* Layout the content of the scrollbox */ | 1323 /* Layout the content of the scrollbox */ |
1324 _do_resize(contentbox, cx, cy); | 1324 _dw_do_resize(contentbox, cx, cy); |
1325 } | 1325 } |
1326 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) | 1326 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
1327 { | 1327 { |
1328 /* Then try the bottom or right box */ | 1328 /* Then try the bottom or right box */ |
1329 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); | 1329 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); |
1330 int type = (int)dw_window_get_data(handle, "_dw_type"); | 1330 int type = (int)dw_window_get_data(handle, "_dw_type"); |
1331 | 1331 |
1332 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, | 1332 _dw_set_window_pos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, |
1333 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1333 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1334 | 1334 |
1335 if(percent) | 1335 if(percent) |
1336 _handle_splitbar_resize(handle, *percent, type, width, height); | 1336 _dw_handle_splitbar_resize(handle, *percent, type, width, height); |
1337 } | 1337 } |
1338 else | 1338 else |
1339 { | 1339 { |
1340 /* Everything else */ | 1340 /* Everything else */ |
1341 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, | 1341 _dw_set_window_pos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, |
1342 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1342 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1343 | 1343 |
1344 /* After placing a box... place its components */ | 1344 /* After placing a box... place its components */ |
1345 if(thisbox->items[z].type == TYPEBOX) | 1345 if(thisbox->items[z].type == TYPEBOX) |
1346 { | 1346 { |
1354 WinSetWindowPos(boxinfo->grouphwnd, HWND_TOP, 0, 0, | 1354 WinSetWindowPos(boxinfo->grouphwnd, HWND_TOP, 0, 0, |
1355 width, height, SWP_MOVE | SWP_SIZE); | 1355 width, height, SWP_MOVE | SWP_SIZE); |
1356 } | 1356 } |
1357 /* Dive into the box */ | 1357 /* Dive into the box */ |
1358 (*depth)++; | 1358 (*depth)++; |
1359 _resize_box(boxinfo, depth, width, height, pass); | 1359 _dw_resize_box(boxinfo, depth, width, height, pass); |
1360 (*depth)--; | 1360 (*depth)--; |
1361 } | 1361 } |
1362 } | 1362 } |
1363 } | 1363 } |
1364 | 1364 |
1370 } | 1370 } |
1371 } | 1371 } |
1372 } | 1372 } |
1373 } | 1373 } |
1374 | 1374 |
1375 void _do_resize(Box *thisbox, int x, int y) | 1375 void _dw_do_resize(Box *thisbox, int x, int y) |
1376 { | 1376 { |
1377 if(x != 0 && y != 0) | 1377 if(x != 0 && y != 0) |
1378 { | 1378 { |
1379 if(thisbox) | 1379 if(thisbox) |
1380 { | 1380 { |
1381 int depth = 0; | 1381 int depth = 0; |
1382 | 1382 |
1383 /* Calculate space requirements */ | 1383 /* Calculate space requirements */ |
1384 _resize_box(thisbox, &depth, x, y, 1); | 1384 _dw_resize_box(thisbox, &depth, x, y, 1); |
1385 | 1385 |
1386 /* Finally place all the boxes and controls */ | 1386 /* Finally place all the boxes and controls */ |
1387 _resize_box(thisbox, &depth, x, y, 2); | 1387 _dw_resize_box(thisbox, &depth, x, y, 2); |
1388 } | 1388 } |
1389 } | 1389 } |
1390 } | 1390 } |
1391 | 1391 |
1392 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */ | 1392 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */ |
1393 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 1393 MRESULT EXPENTRY _dw_sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
1394 { | 1394 { |
1395 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); | 1395 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
1396 Box *thisbox = NULL; | 1396 Box *thisbox = NULL; |
1397 HWND box; | 1397 HWND box; |
1398 | 1398 |
1431 } | 1431 } |
1432 | 1432 |
1433 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 1433 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
1434 } | 1434 } |
1435 | 1435 |
1436 void _Top(HPS hpsPaint, RECTL rclPaint) | 1436 void _dw_top(HPS hpsPaint, RECTL rclPaint) |
1437 { | 1437 { |
1438 POINTL ptl1, ptl2; | 1438 POINTL ptl1, ptl2; |
1439 | 1439 |
1440 ptl1.x = rclPaint.xLeft; | 1440 ptl1.x = rclPaint.xLeft; |
1441 ptl2.y = ptl1.y = rclPaint.yTop - 1; | 1441 ptl2.y = ptl1.y = rclPaint.yTop - 1; |
1443 GpiMove(hpsPaint, &ptl1); | 1443 GpiMove(hpsPaint, &ptl1); |
1444 GpiLine(hpsPaint, &ptl2); | 1444 GpiLine(hpsPaint, &ptl2); |
1445 } | 1445 } |
1446 | 1446 |
1447 /* Left hits the bottom */ | 1447 /* Left hits the bottom */ |
1448 void _Left(HPS hpsPaint, RECTL rclPaint) | 1448 void _dw_left(HPS hpsPaint, RECTL rclPaint) |
1449 { | 1449 { |
1450 POINTL ptl1, ptl2; | 1450 POINTL ptl1, ptl2; |
1451 | 1451 |
1452 ptl2.x = ptl1.x = rclPaint.xLeft; | 1452 ptl2.x = ptl1.x = rclPaint.xLeft; |
1453 ptl1.y = rclPaint.yTop - 1; | 1453 ptl1.y = rclPaint.yTop - 1; |
1454 ptl2.y = rclPaint.yBottom; | 1454 ptl2.y = rclPaint.yBottom; |
1455 GpiMove(hpsPaint, &ptl1); | 1455 GpiMove(hpsPaint, &ptl1); |
1456 GpiLine(hpsPaint, &ptl2); | 1456 GpiLine(hpsPaint, &ptl2); |
1457 } | 1457 } |
1458 | 1458 |
1459 void _Bottom(HPS hpsPaint, RECTL rclPaint) | 1459 void _dw_bottom(HPS hpsPaint, RECTL rclPaint) |
1460 { | 1460 { |
1461 POINTL ptl1, ptl2; | 1461 POINTL ptl1, ptl2; |
1462 | 1462 |
1463 ptl1.x = rclPaint.xRight - 1; | 1463 ptl1.x = rclPaint.xRight - 1; |
1464 ptl1.y = ptl2.y = rclPaint.yBottom; | 1464 ptl1.y = ptl2.y = rclPaint.yBottom; |
1466 GpiMove(hpsPaint, &ptl1); | 1466 GpiMove(hpsPaint, &ptl1); |
1467 GpiLine(hpsPaint, &ptl2); | 1467 GpiLine(hpsPaint, &ptl2); |
1468 } | 1468 } |
1469 | 1469 |
1470 /* Right hits the top */ | 1470 /* Right hits the top */ |
1471 void _Right(HPS hpsPaint, RECTL rclPaint) | 1471 void _dw_right(HPS hpsPaint, RECTL rclPaint) |
1472 { | 1472 { |
1473 POINTL ptl1, ptl2; | 1473 POINTL ptl1, ptl2; |
1474 | 1474 |
1475 ptl2.x = ptl1.x = rclPaint.xRight - 1; | 1475 ptl2.x = ptl1.x = rclPaint.xRight - 1; |
1476 ptl1.y = rclPaint.yBottom + 1; | 1476 ptl1.y = rclPaint.yBottom + 1; |
1477 ptl2.y = rclPaint.yTop - 1; | 1477 ptl2.y = rclPaint.yTop - 1; |
1478 GpiMove(hpsPaint, &ptl1); | 1478 GpiMove(hpsPaint, &ptl1); |
1479 GpiLine(hpsPaint, &ptl2); | 1479 GpiLine(hpsPaint, &ptl2); |
1480 } | 1480 } |
1481 | 1481 |
1482 void _drawtext(HWND hWnd, HPS hpsPaint) | 1482 void _dw_drawtext(HWND hWnd, HPS hpsPaint) |
1483 { | 1483 { |
1484 RECTL rclPaint; | 1484 RECTL rclPaint; |
1485 int len = WinQueryWindowTextLength(hWnd); | 1485 int len = WinQueryWindowTextLength(hWnd); |
1486 ULONG style = WinQueryWindowULong(hWnd, QWL_STYLE) & (DT_TOP|DT_VCENTER|DT_BOTTOM|DT_LEFT|DT_CENTER|DT_RIGHT|DT_WORDBREAK); | 1486 ULONG style = WinQueryWindowULong(hWnd, QWL_STYLE) & (DT_TOP|DT_VCENTER|DT_BOTTOM|DT_LEFT|DT_CENTER|DT_RIGHT|DT_WORDBREAK); |
1487 char *tempbuf = alloca(len + 2); | 1487 char *tempbuf = alloca(len + 2); |
1520 } | 1520 } |
1521 | 1521 |
1522 /* Function: BubbleProc | 1522 /* Function: BubbleProc |
1523 * Abstract: Subclass procedure for bubble help | 1523 * Abstract: Subclass procedure for bubble help |
1524 */ | 1524 */ |
1525 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 1525 MRESULT EXPENTRY _dw_bubbleproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
1526 { | 1526 { |
1527 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER); | 1527 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER); |
1528 | 1528 |
1529 if(msg == WM_PAINT) | 1529 if(msg == WM_PAINT) |
1530 { | 1530 { |
1538 width = rcl.xRight - rcl.xLeft - 1; | 1538 width = rcl.xRight - rcl.xLeft - 1; |
1539 | 1539 |
1540 /* Draw a border around the bubble help */ | 1540 /* Draw a border around the bubble help */ |
1541 hpsTemp = WinBeginPaint(hwnd, 0, 0); | 1541 hpsTemp = WinBeginPaint(hwnd, 0, 0); |
1542 | 1542 |
1543 _drawtext(hwnd, hpsTemp); | 1543 _dw_drawtext(hwnd, hpsTemp); |
1544 GpiSetColor(hpsTemp, CLR_BLACK); | 1544 GpiSetColor(hpsTemp, CLR_BLACK); |
1545 ptl.x = ptl.y = 0; | 1545 ptl.x = ptl.y = 0; |
1546 GpiMove(hpsTemp, &ptl); | 1546 GpiMove(hpsTemp, &ptl); |
1547 ptl.x = 0; | 1547 ptl.x = 0; |
1548 ptl.y = height; | 1548 ptl.y = height; |
1571 return proc(hwnd, msg, mp1, mp2); | 1571 return proc(hwnd, msg, mp1, mp2); |
1572 return WinDefWindowProc(hwnd, msg, mp1, mp2); | 1572 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
1573 } | 1573 } |
1574 | 1574 |
1575 /* Subclass WC_STATIC to draw a bitmap centered */ | 1575 /* Subclass WC_STATIC to draw a bitmap centered */ |
1576 MRESULT EXPENTRY _BitmapProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 1576 MRESULT EXPENTRY _dw_bitmapproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
1577 { | 1577 { |
1578 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWL_USER); | 1578 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWL_USER); |
1579 | 1579 |
1580 if(msg == WM_PAINT) | 1580 if(msg == WM_PAINT) |
1581 { | 1581 { |
1618 return blah->oldproc(hwnd, msg, mp1, mp2); | 1618 return blah->oldproc(hwnd, msg, mp1, mp2); |
1619 return WinDefWindowProc(hwnd, msg, mp1, mp2); | 1619 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
1620 } | 1620 } |
1621 | 1621 |
1622 /* Function to handle tooltip messages from a variety of procedures */ | 1622 /* Function to handle tooltip messages from a variety of procedures */ |
1623 MRESULT EXPENTRY _TooltipProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, WindowData *blah) | 1623 MRESULT EXPENTRY _dw_tooltipproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, WindowData *blah) |
1624 { | 1624 { |
1625 static HWND hstart, hend; | 1625 static HWND hstart, hend; |
1626 | 1626 |
1627 switch(msg) | 1627 switch(msg) |
1628 { | 1628 { |
1727 ptlWork.x = dw_screen_width() - lWidth; | 1727 ptlWork.x = dw_screen_width() - lWidth; |
1728 if(ptlWork.x < 0) | 1728 if(ptlWork.x < 0) |
1729 ptlWork.x = 0; | 1729 ptlWork.x = 0; |
1730 } | 1730 } |
1731 | 1731 |
1732 bubbleproc = (void *)WinSubclassWindow(hwndBubble, _BubbleProc); | 1732 bubbleproc = (void *)WinSubclassWindow(hwndBubble, _dw_bubbleproc); |
1733 | 1733 |
1734 if(bubbleproc) | 1734 if(bubbleproc) |
1735 WinSetWindowPtr(hwndBubble, QWP_USER, bubbleproc); | 1735 WinSetWindowPtr(hwndBubble, QWP_USER, bubbleproc); |
1736 | 1736 |
1737 WinSetWindowPos(hwndBubble, | 1737 WinSetWindowPos(hwndBubble, |
1754 | 1754 |
1755 #define CALENDAR_BORDER 3 | 1755 #define CALENDAR_BORDER 3 |
1756 #define CALENDAR_ARROW 8 | 1756 #define CALENDAR_ARROW 8 |
1757 | 1757 |
1758 /* Returns a rectangle for a single day on the calendar */ | 1758 /* Returns a rectangle for a single day on the calendar */ |
1759 RECTL _CalendarDayRect(int position, RECTL rclPaint) | 1759 RECTL _dw_calendar_day_rect(int position, RECTL rclPaint) |
1760 { | 1760 { |
1761 int height = rclPaint.yTop - rclPaint.yBottom - (CALENDAR_BORDER*2); | 1761 int height = rclPaint.yTop - rclPaint.yBottom - (CALENDAR_BORDER*2); |
1762 int width = rclPaint.xRight - rclPaint.xLeft - (CALENDAR_BORDER*2); | 1762 int width = rclPaint.xRight - rclPaint.xLeft - (CALENDAR_BORDER*2); |
1763 /* There are 7 rows... 5 for the day numbers... | 1763 /* There are 7 rows... 5 for the day numbers... |
1764 * 1 for the Month/Year and 1 for the day names. | 1764 * 1 for the Month/Year and 1 for the day names. |
1780 /* These will be filled in during dw_init() */ | 1780 /* These will be filled in during dw_init() */ |
1781 static char months[12][20]; | 1781 static char months[12][20]; |
1782 static char daysofweek[7][20]; | 1782 static char daysofweek[7][20]; |
1783 | 1783 |
1784 /* This procedure handles drawing of a status border */ | 1784 /* This procedure handles drawing of a status border */ |
1785 MRESULT EXPENTRY _calendarproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 1785 MRESULT EXPENTRY _dw_calendarproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
1786 { | 1786 { |
1787 /* How many days are in each month usually (not including leap years) */ | 1787 /* How many days are in each month usually (not including leap years) */ |
1788 static int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; | 1788 static int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; |
1789 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | 1789 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
1790 PFNWP oldproc = 0; | 1790 PFNWP oldproc = 0; |
1792 if(blah) | 1792 if(blah) |
1793 { | 1793 { |
1794 oldproc = blah->oldproc; | 1794 oldproc = blah->oldproc; |
1795 | 1795 |
1796 if(blah->bubbletext[0]) | 1796 if(blah->bubbletext[0]) |
1797 _TooltipProc(hWnd, msg, mp1, mp2, blah); | 1797 _dw_tooltipproc(hWnd, msg, mp1, mp2, blah); |
1798 | 1798 |
1799 switch(msg) | 1799 switch(msg) |
1800 { | 1800 { |
1801 case WM_BUTTON1DOWN: | 1801 case WM_BUTTON1DOWN: |
1802 case WM_BUTTON2DOWN: | 1802 case WM_BUTTON2DOWN: |
1882 } | 1882 } |
1883 | 1883 |
1884 /* Check all the valid days of the month */ | 1884 /* Check all the valid days of the month */ |
1885 for(x=dayofweek+7;x<(daysthismonth+dayofweek+7);x++) | 1885 for(x=dayofweek+7;x<(daysthismonth+dayofweek+7);x++) |
1886 { | 1886 { |
1887 RECTL rclThis = _CalendarDayRect(x, rclArea); | 1887 RECTL rclThis = _dw_calendar_day_rect(x, rclArea); |
1888 if(pts.x < rclThis.xRight && pts.x > rclThis.xLeft && pts.y < rclThis.yTop && pts.y > rclThis.yBottom) | 1888 if(pts.x < rclThis.xRight && pts.x > rclThis.xLeft && pts.y < rclThis.yTop && pts.y > rclThis.yBottom) |
1889 { | 1889 { |
1890 dw_window_set_data(hWnd, "_dw_day", DW_INT_TO_POINTER((x-(dayofweek+7)))); | 1890 dw_window_set_data(hWnd, "_dw_day", DW_INT_TO_POINTER((x-(dayofweek+7)))); |
1891 WinInvalidateRect(hWnd, &rclArea, FALSE); | 1891 WinInvalidateRect(hWnd, &rclArea, FALSE); |
1892 WinPostMsg(hWnd, WM_PAINT, 0, 0); | 1892 WinPostMsg(hWnd, WM_PAINT, 0, 0); |
1955 pptl[1].y = rclDraw.yTop - CALENDAR_BORDER - height; | 1955 pptl[1].y = rclDraw.yTop - CALENDAR_BORDER - height; |
1956 GpiPolyLine(hpsPaint, 3, pptl); | 1956 GpiPolyLine(hpsPaint, 3, pptl); |
1957 GpiEndArea(hpsPaint); | 1957 GpiEndArea(hpsPaint); |
1958 | 1958 |
1959 /* Draw a border around control */ | 1959 /* Draw a border around control */ |
1960 _Top(hpsPaint, rclPaint); | 1960 _dw_top(hpsPaint, rclPaint); |
1961 _Left(hpsPaint, rclPaint); | 1961 _dw_left(hpsPaint, rclPaint); |
1962 /* With shadow */ | 1962 /* With shadow */ |
1963 GpiSetColor(hpsPaint, CLR_WHITE); | 1963 GpiSetColor(hpsPaint, CLR_WHITE); |
1964 _Right(hpsPaint, rclPaint); | 1964 _dw_right(hpsPaint, rclPaint); |
1965 _Bottom(hpsPaint, rclPaint); | 1965 _dw_bottom(hpsPaint, rclPaint); |
1966 | 1966 |
1967 /* Draw the days of the week */ | 1967 /* Draw the days of the week */ |
1968 GpiSetColor(hpsPaint, CLR_BLACK); | 1968 GpiSetColor(hpsPaint, CLR_BLACK); |
1969 for(x=0;x<7;x++) | 1969 for(x=0;x<7;x++) |
1970 { | 1970 { |
1971 char *title = daysofweek[x]; | 1971 char *title = daysofweek[x]; |
1972 | 1972 |
1973 rclDraw = _CalendarDayRect(x, rclPaint); | 1973 rclDraw = _dw_calendar_day_rect(x, rclPaint); |
1974 | 1974 |
1975 if(rclDraw.xRight - rclDraw.xLeft < 60) | 1975 if(rclDraw.xRight - rclDraw.xLeft < 60) |
1976 { | 1976 { |
1977 buf[0] = daysofweek[x][0]; buf[1] = daysofweek[x][1]; buf[2] = 0; | 1977 buf[0] = daysofweek[x][0]; buf[1] = daysofweek[x][1]; buf[2] = 0; |
1978 title = buf; | 1978 title = buf; |
1984 for(x=0;x<42;x++) | 1984 for(x=0;x<42;x++) |
1985 { | 1985 { |
1986 int daysthismonth = days[month] + (isleapyear && month == 1); | 1986 int daysthismonth = days[month] + (isleapyear && month == 1); |
1987 int dayslastmonth = days[lastmonth] + (isleapyear && lastmonth == 1); | 1987 int dayslastmonth = days[lastmonth] + (isleapyear && lastmonth == 1); |
1988 | 1988 |
1989 rclDraw = _CalendarDayRect(x+7, rclPaint); | 1989 rclDraw = _dw_calendar_day_rect(x+7, rclPaint); |
1990 if(x < dayofweek) | 1990 if(x < dayofweek) |
1991 { | 1991 { |
1992 GpiSetColor(hpsPaint, CLR_DARKGRAY); | 1992 GpiSetColor(hpsPaint, CLR_DARKGRAY); |
1993 sprintf(buf, "%d", dayslastmonth - (dayofweek - x - 1)); | 1993 sprintf(buf, "%d", dayslastmonth - (dayofweek - x - 1)); |
1994 } | 1994 } |
2004 } | 2004 } |
2005 WinDrawText(hpsPaint, -1, (PCH)buf, &rclDraw, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_CENTER | DT_TEXTATTRS); | 2005 WinDrawText(hpsPaint, -1, (PCH)buf, &rclDraw, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_CENTER | DT_TEXTATTRS); |
2006 } | 2006 } |
2007 | 2007 |
2008 /* Draw a border around selected day */ | 2008 /* Draw a border around selected day */ |
2009 rclPaint = _CalendarDayRect(day + dayofweek + 7, rclPaint); | 2009 rclPaint = _dw_calendar_day_rect(day + dayofweek + 7, rclPaint); |
2010 GpiSetColor(hpsPaint, CLR_DARKGRAY); | 2010 GpiSetColor(hpsPaint, CLR_DARKGRAY); |
2011 _Top(hpsPaint, rclPaint); | 2011 _dw_top(hpsPaint, rclPaint); |
2012 _Left(hpsPaint, rclPaint); | 2012 _dw_left(hpsPaint, rclPaint); |
2013 /* With shadow */ | 2013 /* With shadow */ |
2014 GpiSetColor(hpsPaint, CLR_WHITE); | 2014 GpiSetColor(hpsPaint, CLR_WHITE); |
2015 _Right(hpsPaint, rclPaint); | 2015 _dw_right(hpsPaint, rclPaint); |
2016 _Bottom(hpsPaint, rclPaint); | 2016 _dw_bottom(hpsPaint, rclPaint); |
2017 | 2017 |
2018 WinEndPaint(hpsPaint); | 2018 WinEndPaint(hpsPaint); |
2019 | 2019 |
2020 return (MRESULT)TRUE; | 2020 return (MRESULT)TRUE; |
2021 } | 2021 } |
2027 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 2027 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
2028 } | 2028 } |
2029 | 2029 |
2030 | 2030 |
2031 /* This procedure handles drawing of a status border */ | 2031 /* This procedure handles drawing of a status border */ |
2032 MRESULT EXPENTRY _statusproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2032 MRESULT EXPENTRY _dw_statusproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2033 { | 2033 { |
2034 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | 2034 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
2035 PFNWP oldproc = 0; | 2035 PFNWP oldproc = 0; |
2036 | 2036 |
2037 if(msg == WM_MOUSEMOVE && _wndproc(hWnd, msg, mp1, mp2)) | 2037 if(msg == WM_MOUSEMOVE && _dw_wndproc(hWnd, msg, mp1, mp2)) |
2038 return MPFROMSHORT(FALSE); | 2038 return MPFROMSHORT(FALSE); |
2039 | 2039 |
2040 if(blah) | 2040 if(blah) |
2041 { | 2041 { |
2042 oldproc = blah->oldproc; | 2042 oldproc = blah->oldproc; |
2043 | 2043 |
2044 if(blah->bubbletext[0]) | 2044 if(blah->bubbletext[0]) |
2045 _TooltipProc(hWnd, msg, mp1, mp2, blah); | 2045 _dw_tooltipproc(hWnd, msg, mp1, mp2, blah); |
2046 | 2046 |
2047 if(blah->bubbletext[0]) | 2047 if(blah->bubbletext[0]) |
2048 _TooltipProc(hWnd, msg, mp1, mp2, blah); | 2048 _dw_tooltipproc(hWnd, msg, mp1, mp2, blah); |
2049 | 2049 |
2050 switch(msg) | 2050 switch(msg) |
2051 { | 2051 { |
2052 case WM_PAINT: | 2052 case WM_PAINT: |
2053 { | 2053 { |
2058 hpsPaint = WinBeginPaint(hWnd, 0, 0); | 2058 hpsPaint = WinBeginPaint(hWnd, 0, 0); |
2059 WinQueryWindowRect(hWnd, &rclPaint); | 2059 WinQueryWindowRect(hWnd, &rclPaint); |
2060 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY); | 2060 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY); |
2061 | 2061 |
2062 GpiSetColor(hpsPaint, CLR_DARKGRAY); | 2062 GpiSetColor(hpsPaint, CLR_DARKGRAY); |
2063 _Top(hpsPaint, rclPaint); | 2063 _dw_top(hpsPaint, rclPaint); |
2064 _Left(hpsPaint, rclPaint); | 2064 _dw_left(hpsPaint, rclPaint); |
2065 | 2065 |
2066 GpiSetColor(hpsPaint, CLR_WHITE); | 2066 GpiSetColor(hpsPaint, CLR_WHITE); |
2067 _Right(hpsPaint, rclPaint); | 2067 _dw_right(hpsPaint, rclPaint); |
2068 _Bottom(hpsPaint, rclPaint); | 2068 _dw_bottom(hpsPaint, rclPaint); |
2069 | 2069 |
2070 WinQueryWindowText(hWnd, 1024, (PSZ)buf); | 2070 WinQueryWindowText(hWnd, 1024, (PSZ)buf); |
2071 rclPaint.xLeft += 3; | 2071 rclPaint.xLeft += 3; |
2072 rclPaint.xRight--; | 2072 rclPaint.xRight--; |
2073 rclPaint.yTop--; | 2073 rclPaint.yTop--; |
2086 | 2086 |
2087 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 2087 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
2088 } | 2088 } |
2089 | 2089 |
2090 /* This procedure handles pointer changes */ | 2090 /* This procedure handles pointer changes */ |
2091 MRESULT EXPENTRY _textproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2091 MRESULT EXPENTRY _dw_textproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2092 { | 2092 { |
2093 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | 2093 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
2094 | 2094 |
2095 if(blah && blah->bubbletext[0]) | 2095 if(blah && blah->bubbletext[0]) |
2096 _TooltipProc(hWnd, msg, mp1, mp2, blah); | 2096 _dw_tooltipproc(hWnd, msg, mp1, mp2, blah); |
2097 | 2097 |
2098 if(msg == WM_MOUSEMOVE &&_wndproc(hWnd, msg, mp1, mp2)) | 2098 if(msg == WM_MOUSEMOVE &&_dw_wndproc(hWnd, msg, mp1, mp2)) |
2099 return MPFROMSHORT(FALSE); | 2099 return MPFROMSHORT(FALSE); |
2100 | 2100 |
2101 if(blah && blah->oldproc) | 2101 if(blah && blah->oldproc) |
2102 { | 2102 { |
2103 PFNWP myfunc = blah->oldproc; | 2103 PFNWP myfunc = blah->oldproc; |
2106 { | 2106 { |
2107 case WM_PAINT: | 2107 case WM_PAINT: |
2108 { | 2108 { |
2109 HPS hpsPaint = WinBeginPaint(hWnd, 0, 0); | 2109 HPS hpsPaint = WinBeginPaint(hWnd, 0, 0); |
2110 | 2110 |
2111 _drawtext(hWnd, hpsPaint); | 2111 _dw_drawtext(hWnd, hpsPaint); |
2112 WinEndPaint(hpsPaint); | 2112 WinEndPaint(hpsPaint); |
2113 return (MRESULT)TRUE; | 2113 return (MRESULT)TRUE; |
2114 } | 2114 } |
2115 default: | 2115 default: |
2116 return myfunc(hWnd, msg, mp1, mp2); | 2116 return myfunc(hWnd, msg, mp1, mp2); |
2119 | 2119 |
2120 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 2120 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
2121 } | 2121 } |
2122 | 2122 |
2123 /* This procedure handles scrollbox */ | 2123 /* This procedure handles scrollbox */ |
2124 MRESULT EXPENTRY _scrollwndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2124 MRESULT EXPENTRY _dw_scrollwndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2125 { | 2125 { |
2126 switch(msg) | 2126 switch(msg) |
2127 { | 2127 { |
2128 case WM_PAINT: | 2128 case WM_PAINT: |
2129 { | 2129 { |
2202 } | 2202 } |
2203 } | 2203 } |
2204 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 2204 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
2205 } | 2205 } |
2206 | 2206 |
2207 void _click_default(HWND handle) | 2207 void _dw_click_default(HWND handle) |
2208 { | 2208 { |
2209 char tmpbuf[100] = {0}; | 2209 char tmpbuf[100] = {0}; |
2210 | 2210 |
2211 WinQueryClassName(handle, 99, (PCH)tmpbuf); | 2211 WinQueryClassName(handle, 99, (PCH)tmpbuf); |
2212 | 2212 |
2246 #define ENTRY_DELETE 60904 | 2246 #define ENTRY_DELETE 60904 |
2247 #define ENTRY_UNDO 60905 | 2247 #define ENTRY_UNDO 60905 |
2248 #define ENTRY_SALL 60906 | 2248 #define ENTRY_SALL 60906 |
2249 | 2249 |
2250 #ifdef UNICODE | 2250 #ifdef UNICODE |
2251 void _combine_text(HWND handle, USHORT pos1, char *text, char *pastetext) | 2251 void _dw_combine_text(HWND handle, USHORT pos1, char *text, char *pastetext) |
2252 { | 2252 { |
2253 char *combined = calloc((text ? strlen(text) : 0) + strlen(pastetext) + 1, 1); | 2253 char *combined = calloc((text ? strlen(text) : 0) + strlen(pastetext) + 1, 1); |
2254 SHORT newsel = pos1 + strlen(pastetext); | 2254 SHORT newsel = pos1 + strlen(pastetext); |
2255 | 2255 |
2256 /* Combine the two strings into 1... or just use pastetext if no text */ | 2256 /* Combine the two strings into 1... or just use pastetext if no text */ |
2267 /* Free temporary memory */ | 2267 /* Free temporary memory */ |
2268 free(combined); | 2268 free(combined); |
2269 } | 2269 } |
2270 | 2270 |
2271 /* Internal function to handle Unicode enabled MLE cut, copy and paste */ | 2271 /* Internal function to handle Unicode enabled MLE cut, copy and paste */ |
2272 void _MleCopyPaste(HWND hWnd, int command) | 2272 void _dw_mle_copy_paste(HWND hWnd, int command) |
2273 { | 2273 { |
2274 /* MLE insertion points (for querying selection) */ | 2274 /* MLE insertion points (for querying selection) */ |
2275 IPT ipt1, ipt2; | 2275 IPT ipt1, ipt2; |
2276 | 2276 |
2277 /* Get the selected text */ | 2277 /* Get the selected text */ |
2301 } | 2301 } |
2302 } | 2302 } |
2303 } | 2303 } |
2304 | 2304 |
2305 /* Internal function to handle Unicode enabled Entryfield cut, copy and paste */ | 2305 /* Internal function to handle Unicode enabled Entryfield cut, copy and paste */ |
2306 void _EntryCopyPaste(HWND handle, int command) | 2306 void _dw_entry_copy_paste(HWND handle, int command) |
2307 { | 2307 { |
2308 /* Get the selected text */ | 2308 /* Get the selected text */ |
2309 char *text = dw_window_get_text(handle); | 2309 char *text = dw_window_get_text(handle); |
2310 ULONG sel = (ULONG)WinSendMsg(handle, EM_QUERYSEL, 0, 0); | 2310 ULONG sel = (ULONG)WinSendMsg(handle, EM_QUERYSEL, 0, 0); |
2311 SHORT pos1 = SHORT1FROMMP(sel), pos2 = SHORT2FROMMP(sel); | 2311 SHORT pos1 = SHORT1FROMMP(sel), pos2 = SHORT2FROMMP(sel); |
2332 { | 2332 { |
2333 char *pastetext = dw_clipboard_get_text(); | 2333 char *pastetext = dw_clipboard_get_text(); |
2334 | 2334 |
2335 if(pastetext) | 2335 if(pastetext) |
2336 { | 2336 { |
2337 _combine_text(handle, pos1, text, pastetext); | 2337 _dw_combine_text(handle, pos1, text, pastetext); |
2338 /* Free temporary memory */ | 2338 /* Free temporary memory */ |
2339 dw_free(pastetext); | 2339 dw_free(pastetext); |
2340 } | 2340 } |
2341 } | 2341 } |
2342 if(text) | 2342 if(text) |
2345 #endif | 2345 #endif |
2346 | 2346 |
2347 /* Originally just intended for entryfields, it now serves as a generic | 2347 /* Originally just intended for entryfields, it now serves as a generic |
2348 * procedure for handling TAB presses to change input focus on controls. | 2348 * procedure for handling TAB presses to change input focus on controls. |
2349 */ | 2349 */ |
2350 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2350 MRESULT EXPENTRY _dw_entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2351 { | 2351 { |
2352 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | 2352 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
2353 PFNWP oldproc = 0; | 2353 PFNWP oldproc = 0; |
2354 char tmpbuf[100] = {0}; | 2354 char tmpbuf[100] = {0}; |
2355 | 2355 |
2357 oldproc = blah->oldproc; | 2357 oldproc = blah->oldproc; |
2358 | 2358 |
2359 WinQueryClassName(hWnd, 99, (PCH)tmpbuf); | 2359 WinQueryClassName(hWnd, 99, (PCH)tmpbuf); |
2360 | 2360 |
2361 if(blah && blah->bubbletext[0]) | 2361 if(blah && blah->bubbletext[0]) |
2362 _TooltipProc(hWnd, msg, mp1, mp2, blah); | 2362 _dw_tooltipproc(hWnd, msg, mp1, mp2, blah); |
2363 | 2363 |
2364 /* These are the window classes which should get a menu */ | 2364 /* These are the window classes which should get a menu */ |
2365 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */ | 2365 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */ |
2366 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */ | 2366 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */ |
2367 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */ | 2367 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */ |
2369 { | 2369 { |
2370 switch(msg) | 2370 switch(msg) |
2371 { | 2371 { |
2372 #ifdef UNICODE | 2372 #ifdef UNICODE |
2373 case MLM_PASTE: | 2373 case MLM_PASTE: |
2374 _MleCopyPaste(hWnd, ENTRY_PASTE); | 2374 _dw_mle_copy_paste(hWnd, ENTRY_PASTE); |
2375 return (MRESULT)TRUE; | 2375 return (MRESULT)TRUE; |
2376 case MLM_CUT: | 2376 case MLM_CUT: |
2377 _MleCopyPaste(hWnd, ENTRY_CUT); | 2377 _dw_mle_copy_paste(hWnd, ENTRY_CUT); |
2378 return (MRESULT)TRUE; | 2378 return (MRESULT)TRUE; |
2379 case MLM_COPY: | 2379 case MLM_COPY: |
2380 _MleCopyPaste(hWnd, ENTRY_COPY); | 2380 _dw_mle_copy_paste(hWnd, ENTRY_COPY); |
2381 return (MRESULT)TRUE; | 2381 return (MRESULT)TRUE; |
2382 case EM_PASTE: | 2382 case EM_PASTE: |
2383 _EntryCopyPaste(hWnd, ENTRY_PASTE); | 2383 _dw_entry_copy_paste(hWnd, ENTRY_PASTE); |
2384 return (MRESULT)TRUE; | 2384 return (MRESULT)TRUE; |
2385 case EM_CUT: | 2385 case EM_CUT: |
2386 _EntryCopyPaste(hWnd, ENTRY_CUT); | 2386 _dw_entry_copy_paste(hWnd, ENTRY_CUT); |
2387 return (MRESULT)TRUE; | 2387 return (MRESULT)TRUE; |
2388 case EM_COPY: | 2388 case EM_COPY: |
2389 _EntryCopyPaste(hWnd, ENTRY_COPY); | 2389 _dw_entry_copy_paste(hWnd, ENTRY_COPY); |
2390 return (MRESULT)TRUE; | 2390 return (MRESULT)TRUE; |
2391 #endif | 2391 #endif |
2392 case WM_CONTEXTMENU: | 2392 case WM_CONTEXTMENU: |
2393 { | 2393 { |
2394 HMENUI hwndMenu = dw_menu_new(0L); | 2394 HMENUI hwndMenu = dw_menu_new(0L); |
2487 case WM_BUTTON1DOWN: | 2487 case WM_BUTTON1DOWN: |
2488 case WM_BUTTON2DOWN: | 2488 case WM_BUTTON2DOWN: |
2489 case WM_BUTTON3DOWN: | 2489 case WM_BUTTON3DOWN: |
2490 { | 2490 { |
2491 if(strncmp(tmpbuf, "#32", 4)==0) | 2491 if(strncmp(tmpbuf, "#32", 4)==0) |
2492 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE); | 2492 _dw_run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE); |
2493 } | 2493 } |
2494 break; | 2494 break; |
2495 case WM_CONTROL: | 2495 case WM_CONTROL: |
2496 { | 2496 { |
2497 if(strncmp(tmpbuf, "#38", 4)==0) | 2497 if(strncmp(tmpbuf, "#38", 4)==0) |
2498 _run_event(hWnd, msg, mp1, mp2); | 2498 _dw_run_event(hWnd, msg, mp1, mp2); |
2499 } | 2499 } |
2500 break; | 2500 break; |
2501 case WM_SETFOCUS: | 2501 case WM_SETFOCUS: |
2502 _run_event(hWnd, msg, mp1, mp2); | 2502 _dw_run_event(hWnd, msg, mp1, mp2); |
2503 break; | 2503 break; |
2504 case WM_CHAR: | 2504 case WM_CHAR: |
2505 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) | 2505 if(_dw_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) |
2506 return (MRESULT)TRUE; | 2506 return (MRESULT)TRUE; |
2507 if(SHORT1FROMMP(mp2) == '\t') | 2507 if(SHORT1FROMMP(mp2) == '\t') |
2508 { | 2508 { |
2509 if(CHARMSG(&msg)->fs & KC_SHIFT) | 2509 if(CHARMSG(&msg)->fs & KC_SHIFT) |
2510 _shift_focus(hWnd, _DW_DIRECTION_BACKWARD); | 2510 _dw_shift_focus(hWnd, _DW_DIRECTION_BACKWARD); |
2511 else | 2511 else |
2512 _shift_focus(hWnd, _DW_DIRECTION_FORWARD); | 2512 _dw_shift_focus(hWnd, _DW_DIRECTION_FORWARD); |
2513 return FALSE; | 2513 return FALSE; |
2514 } | 2514 } |
2515 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault) | 2515 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault) |
2516 _click_default(blah->clickdefault); | 2516 _dw_click_default(blah->clickdefault); |
2517 /* When you hit escape we get this value and the | 2517 /* When you hit escape we get this value and the |
2518 * window hangs for reasons unknown. (in an MLE) | 2518 * window hangs for reasons unknown. (in an MLE) |
2519 */ | 2519 */ |
2520 else if(SHORT1FROMMP(mp2) == 283) | 2520 else if(SHORT1FROMMP(mp2) == 283) |
2521 return (MRESULT)TRUE; | 2521 return (MRESULT)TRUE; |
2527 BYTE bscan; | 2527 BYTE bscan; |
2528 char *utf8; | 2528 char *utf8; |
2529 | 2529 |
2530 UniTranslateKey(Keyboard, SHORT1FROMMP(mp1) & KC_SHIFT ? 1 : 0, CHAR4FROMMP(mp1), uc, &vdk, &bscan); | 2530 UniTranslateKey(Keyboard, SHORT1FROMMP(mp1) & KC_SHIFT ? 1 : 0, CHAR4FROMMP(mp1), uc, &vdk, &bscan); |
2531 | 2531 |
2532 if((utf8 = _WideToUTF8(uc)) != NULL) | 2532 if((utf8 = _dw_WideToUTF8(uc)) != NULL) |
2533 { | 2533 { |
2534 if(*utf8) | 2534 if(*utf8) |
2535 { | 2535 { |
2536 /* MLE */ | 2536 /* MLE */ |
2537 if(strncmp(tmpbuf, "#10", 4)==0) | 2537 if(strncmp(tmpbuf, "#10", 4)==0) |
2551 char *text = dw_window_get_text(handle); | 2551 char *text = dw_window_get_text(handle); |
2552 ULONG sel = (ULONG)WinSendMsg(hWnd, EM_QUERYSEL, 0, 0); | 2552 ULONG sel = (ULONG)WinSendMsg(hWnd, EM_QUERYSEL, 0, 0); |
2553 SHORT pos1 = SHORT1FROMMP(sel); | 2553 SHORT pos1 = SHORT1FROMMP(sel); |
2554 | 2554 |
2555 WinSendMsg(handle, EM_CLEAR, 0, 0); | 2555 WinSendMsg(handle, EM_CLEAR, 0, 0); |
2556 _combine_text(handle, pos1, text, utf8); | 2556 _dw_combine_text(handle, pos1, text, utf8); |
2557 | 2557 |
2558 if(text) | 2558 if(text) |
2559 free(text); | 2559 free(text); |
2560 } | 2560 } |
2561 } | 2561 } |
2578 int pos = (int)dw_window_get_data(hWnd, "_dw_slider_value"); | 2578 int pos = (int)dw_window_get_data(hWnd, "_dw_slider_value"); |
2579 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), (MPARAM)pos); | 2579 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), (MPARAM)pos); |
2580 } | 2580 } |
2581 break; | 2581 break; |
2582 case WM_MOUSEMOVE: | 2582 case WM_MOUSEMOVE: |
2583 if(_wndproc(hWnd, msg, mp1, mp2)) | 2583 if(_dw_wndproc(hWnd, msg, mp1, mp2)) |
2584 return MPFROMSHORT(FALSE); | 2584 return MPFROMSHORT(FALSE); |
2585 break; | 2585 break; |
2586 } | 2586 } |
2587 | 2587 |
2588 if(oldproc) | 2588 if(oldproc) |
2590 | 2590 |
2591 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 2591 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
2592 } | 2592 } |
2593 | 2593 |
2594 /* Deal with combobox specifics and enhancements */ | 2594 /* Deal with combobox specifics and enhancements */ |
2595 MRESULT EXPENTRY _comboentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2595 MRESULT EXPENTRY _dw_comboentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2596 { | 2596 { |
2597 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | 2597 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
2598 | 2598 |
2599 if(blah && blah->bubbletext[0]) | 2599 if(blah && blah->bubbletext[0]) |
2600 _TooltipProc(hWnd, msg, mp1, mp2, blah); | 2600 _dw_tooltipproc(hWnd, msg, mp1, mp2, blah); |
2601 | 2601 |
2602 switch(msg) | 2602 switch(msg) |
2603 { | 2603 { |
2604 case WM_MOUSEMOVE: | 2604 case WM_MOUSEMOVE: |
2605 if(_wndproc(hWnd, msg, mp1, mp2)) | 2605 if(_dw_wndproc(hWnd, msg, mp1, mp2)) |
2606 return MPFROMSHORT(FALSE); | 2606 return MPFROMSHORT(FALSE); |
2607 break; | 2607 break; |
2608 case WM_CONTEXTMENU: | 2608 case WM_CONTEXTMENU: |
2609 case WM_COMMAND: | 2609 case WM_COMMAND: |
2610 #ifdef UNICODE | 2610 #ifdef UNICODE |
2611 case EM_PASTE: | 2611 case EM_PASTE: |
2612 case EM_CUT: | 2612 case EM_CUT: |
2613 case EM_COPY: | 2613 case EM_COPY: |
2614 #endif | 2614 #endif |
2615 return _entryproc(hWnd, msg, mp1, mp2); | 2615 return _dw_entryproc(hWnd, msg, mp1, mp2); |
2616 case WM_SETFOCUS: | 2616 case WM_SETFOCUS: |
2617 _run_event(hWnd, msg, mp1, mp2); | 2617 _dw_run_event(hWnd, msg, mp1, mp2); |
2618 break; | 2618 break; |
2619 case WM_CHAR: | 2619 case WM_CHAR: |
2620 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) | 2620 if(_dw_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) |
2621 return (MRESULT)TRUE; | 2621 return (MRESULT)TRUE; |
2622 /* A Similar problem to the MLE, if ESC just return */ | 2622 /* A Similar problem to the MLE, if ESC just return */ |
2623 if(SHORT1FROMMP(mp2) == 283) | 2623 if(SHORT1FROMMP(mp2) == 283) |
2624 return (MRESULT)TRUE; | 2624 return (MRESULT)TRUE; |
2625 break; | 2625 break; |
2630 | 2630 |
2631 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 2631 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
2632 } | 2632 } |
2633 | 2633 |
2634 /* Enhance the standard OS/2 MLE control */ | 2634 /* Enhance the standard OS/2 MLE control */ |
2635 MRESULT EXPENTRY _mleproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2635 MRESULT EXPENTRY _dw_mleproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2636 { | 2636 { |
2637 switch(msg) | 2637 switch(msg) |
2638 { | 2638 { |
2639 case WM_VSCROLL: | 2639 case WM_VSCROLL: |
2640 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK) | 2640 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK) |
2643 | 2643 |
2644 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION)); | 2644 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION)); |
2645 } | 2645 } |
2646 break; | 2646 break; |
2647 } | 2647 } |
2648 return _entryproc(hWnd, msg, mp1, mp2); | 2648 return _dw_entryproc(hWnd, msg, mp1, mp2); |
2649 } | 2649 } |
2650 | 2650 |
2651 /* Handle special messages for the spinbutton's entryfield */ | 2651 /* Handle special messages for the spinbutton's entryfield */ |
2652 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2652 MRESULT EXPENTRY _dw_spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2653 { | 2653 { |
2654 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | 2654 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
2655 PFNWP oldproc = 0; | 2655 PFNWP oldproc = 0; |
2656 | 2656 |
2657 if(blah) | 2657 if(blah) |
2658 oldproc = blah->oldproc; | 2658 oldproc = blah->oldproc; |
2659 | 2659 |
2660 if(blah && blah->bubbletext[0]) | 2660 if(blah && blah->bubbletext[0]) |
2661 _TooltipProc(hWnd, msg, mp1, mp2, blah); | 2661 _dw_tooltipproc(hWnd, msg, mp1, mp2, blah); |
2662 | 2662 |
2663 switch(msg) | 2663 switch(msg) |
2664 { | 2664 { |
2665 case WM_MOUSEMOVE: | 2665 case WM_MOUSEMOVE: |
2666 if(_wndproc(hWnd, msg, mp1, mp2)) | 2666 if(_dw_wndproc(hWnd, msg, mp1, mp2)) |
2667 return MPFROMSHORT(FALSE); | 2667 return MPFROMSHORT(FALSE); |
2668 break; | 2668 break; |
2669 case WM_CONTEXTMENU: | 2669 case WM_CONTEXTMENU: |
2670 case WM_COMMAND: | 2670 case WM_COMMAND: |
2671 #ifdef UNICODE | 2671 #ifdef UNICODE |
2672 case EM_PASTE: | 2672 case EM_PASTE: |
2673 case EM_CUT: | 2673 case EM_CUT: |
2674 case EM_COPY: | 2674 case EM_COPY: |
2675 #endif | 2675 #endif |
2676 return _entryproc(hWnd, msg, mp1, mp2); | 2676 return _dw_entryproc(hWnd, msg, mp1, mp2); |
2677 } | 2677 } |
2678 | 2678 |
2679 if(oldproc) | 2679 if(oldproc) |
2680 return oldproc(hWnd, msg, mp1, mp2); | 2680 return oldproc(hWnd, msg, mp1, mp2); |
2681 | 2681 |
2704 dw_window_set_data(hwnd, "_dw_percent_value", (void *)inew); | 2704 dw_window_set_data(hwnd, "_dw_percent_value", (void *)inew); |
2705 } | 2705 } |
2706 } | 2706 } |
2707 | 2707 |
2708 /* Handle size changes in the percent class */ | 2708 /* Handle size changes in the percent class */ |
2709 MRESULT EXPENTRY _percentproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2709 MRESULT EXPENTRY _dw_percentproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2710 { | 2710 { |
2711 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | 2711 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
2712 PFNWP oldproc = 0; | 2712 PFNWP oldproc = 0; |
2713 | 2713 |
2714 if(blah) | 2714 if(blah) |
2715 oldproc = blah->oldproc; | 2715 oldproc = blah->oldproc; |
2716 | 2716 |
2717 if(blah && blah->bubbletext[0]) | 2717 if(blah && blah->bubbletext[0]) |
2718 _TooltipProc(hWnd, msg, mp1, mp2, blah); | 2718 _dw_tooltipproc(hWnd, msg, mp1, mp2, blah); |
2719 | 2719 |
2720 switch(msg) | 2720 switch(msg) |
2721 { | 2721 { |
2722 case WM_MOUSEMOVE: | 2722 case WM_MOUSEMOVE: |
2723 if(_wndproc(hWnd, msg, mp1, mp2)) | 2723 if(_dw_wndproc(hWnd, msg, mp1, mp2)) |
2724 return MPFROMSHORT(FALSE); | 2724 return MPFROMSHORT(FALSE); |
2725 break; | 2725 break; |
2726 case WM_SIZE: | 2726 case WM_SIZE: |
2727 WinPostMsg(hWnd, WM_USER+7, 0, 0); | 2727 WinPostMsg(hWnd, WM_USER+7, 0, 0); |
2728 break; | 2728 break; |
2738 } | 2738 } |
2739 | 2739 |
2740 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN | 2740 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN |
2741 * flag enabled, and also handle TABs to switch input focus. | 2741 * flag enabled, and also handle TABs to switch input focus. |
2742 */ | 2742 */ |
2743 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2743 MRESULT EXPENTRY _dw_comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2744 { | 2744 { |
2745 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER); | 2745 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
2746 PFNWP oldproc = 0; | 2746 PFNWP oldproc = 0; |
2747 | 2747 |
2748 if(blah) | 2748 if(blah) |
2749 oldproc = blah->oldproc; | 2749 oldproc = blah->oldproc; |
2750 | 2750 |
2751 if(blah && blah->bubbletext[0]) | 2751 if(blah && blah->bubbletext[0]) |
2752 _TooltipProc(hWnd, msg, mp1, mp2, blah); | 2752 _dw_tooltipproc(hWnd, msg, mp1, mp2, blah); |
2753 | 2753 |
2754 switch(msg) | 2754 switch(msg) |
2755 { | 2755 { |
2756 case WM_MOUSEMOVE: | 2756 case WM_MOUSEMOVE: |
2757 if(_wndproc(hWnd, msg, mp1, mp2)) | 2757 if(_dw_wndproc(hWnd, msg, mp1, mp2)) |
2758 return MPFROMSHORT(FALSE); | 2758 return MPFROMSHORT(FALSE); |
2759 break; | 2759 break; |
2760 case WM_CHAR: | 2760 case WM_CHAR: |
2761 if(SHORT1FROMMP(mp2) == '\t') | 2761 if(SHORT1FROMMP(mp2) == '\t') |
2762 { | 2762 { |
2763 if(CHARMSG(&msg)->fs & KC_SHIFT) | 2763 if(CHARMSG(&msg)->fs & KC_SHIFT) |
2764 _shift_focus(hWnd, _DW_DIRECTION_BACKWARD); | 2764 _dw_shift_focus(hWnd, _DW_DIRECTION_BACKWARD); |
2765 else | 2765 else |
2766 _shift_focus(hWnd, _DW_DIRECTION_FORWARD); | 2766 _dw_shift_focus(hWnd, _DW_DIRECTION_FORWARD); |
2767 return FALSE; | 2767 return FALSE; |
2768 } | 2768 } |
2769 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault) | 2769 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault) |
2770 _click_default(blah->clickdefault); | 2770 _dw_click_default(blah->clickdefault); |
2771 break; | 2771 break; |
2772 case WM_BUTTON1DBLCLK: | 2772 case WM_BUTTON1DBLCLK: |
2773 case WM_BUTTON2DBLCLK: | 2773 case WM_BUTTON2DBLCLK: |
2774 case WM_BUTTON3DBLCLK: | 2774 case WM_BUTTON3DBLCLK: |
2775 if(dw_window_get_data(hWnd, "_dw_disabled")) | 2775 if(dw_window_get_data(hWnd, "_dw_disabled")) |
2776 return (MRESULT)TRUE; | 2776 return (MRESULT)TRUE; |
2777 break; | 2777 break; |
2778 case WM_BUTTON1DOWN: | 2778 case WM_BUTTON1DOWN: |
2779 case WM_BUTTON2DOWN: | 2779 case WM_BUTTON2DOWN: |
2780 case WM_BUTTON3DOWN: | 2780 case WM_BUTTON3DOWN: |
2781 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) | 2781 if(_dw_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) |
2782 return (MRESULT)TRUE; | 2782 return (MRESULT)TRUE; |
2783 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE); | 2783 _dw_run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE); |
2784 break; | 2784 break; |
2785 case WM_SETFOCUS: | 2785 case WM_SETFOCUS: |
2786 _run_event(hWnd, msg, mp1, mp2); | 2786 _dw_run_event(hWnd, msg, mp1, mp2); |
2787 break; | 2787 break; |
2788 case WM_PAINT: | 2788 case WM_PAINT: |
2789 { | 2789 { |
2790 HWND entry, frame = (HWND)dw_window_get_data(hWnd, "_dw_combo_box"), parent = WinQueryWindow(frame, QW_PARENT); | 2790 HWND entry, frame = (HWND)dw_window_get_data(hWnd, "_dw_combo_box"), parent = WinQueryWindow(frame, QW_PARENT); |
2791 HPS hpsPaint; | 2791 HPS hpsPaint; |
2807 | 2807 |
2808 if(height > thumbheight) | 2808 if(height > thumbheight) |
2809 { | 2809 { |
2810 hpsPaint = WinGetPS(hWnd); | 2810 hpsPaint = WinGetPS(hWnd); |
2811 if(color) | 2811 if(color) |
2812 GpiSetColor(hpsPaint, _internal_color(color-1)); | 2812 GpiSetColor(hpsPaint, _dw_internal_color(color-1)); |
2813 else | 2813 else |
2814 GpiSetColor(hpsPaint, CLR_PALEGRAY); | 2814 GpiSetColor(hpsPaint, CLR_PALEGRAY); |
2815 | 2815 |
2816 ptl.x = ptl.y = 0; | 2816 ptl.x = ptl.y = 0; |
2817 GpiMove(hpsPaint, &ptl); | 2817 GpiMove(hpsPaint, &ptl); |
2829 return oldproc(hWnd, msg, mp1, mp2); | 2829 return oldproc(hWnd, msg, mp1, mp2); |
2830 | 2830 |
2831 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 2831 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
2832 } | 2832 } |
2833 | 2833 |
2834 void _GetPPFont(HWND hwnd, char *buff) | 2834 void _dw_get_pp_font(HWND hwnd, char *buff) |
2835 { | 2835 { |
2836 ULONG AttrFound; | 2836 ULONG AttrFound; |
2837 BYTE AttrValue[128]; | 2837 BYTE AttrValue[128]; |
2838 ULONG cbRetLen; | 2838 ULONG cbRetLen; |
2839 | 2839 |
2849 { | 2849 { |
2850 memcpy(buff, AttrValue, cbRetLen); | 2850 memcpy(buff, AttrValue, cbRetLen); |
2851 } | 2851 } |
2852 } | 2852 } |
2853 | 2853 |
2854 int _HandleScroller(HWND handle, int pos, int which) | 2854 int _dw_handle_scroller(HWND handle, int pos, int which) |
2855 { | 2855 { |
2856 MPARAM res; | 2856 MPARAM res; |
2857 int min, max, page; | 2857 int min, max, page; |
2858 | 2858 |
2859 if(which == SB_SLIDERTRACK) | 2859 if(which == SB_SLIDERTRACK) |
2894 return pos; | 2894 return pos; |
2895 } | 2895 } |
2896 return -1; | 2896 return -1; |
2897 } | 2897 } |
2898 | 2898 |
2899 void _clear_emphasis(void) | 2899 void _dw_clear_emphasis(void) |
2900 { | 2900 { |
2901 if(hwndEmph && WinIsWindow(dwhab, hwndEmph) && pCoreEmph) | 2901 if(hwndEmph && WinIsWindow(dwhab, hwndEmph) && pCoreEmph) |
2902 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, CRA_SOURCE)); | 2902 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, CRA_SOURCE)); |
2903 hwndEmph = NULLHANDLE; | 2903 hwndEmph = NULLHANDLE; |
2904 pCoreEmph = NULL; | 2904 pCoreEmph = NULL; |
2905 } | 2905 } |
2906 | 2906 |
2907 /* Find the desktop window handle */ | 2907 /* Find the desktop window handle */ |
2908 HWND _menu_owner(HWND handle) | 2908 HWND _dw_menu_owner(HWND handle) |
2909 { | 2909 { |
2910 HWND menuowner = NULLHANDLE, lastowner = (HWND)dw_window_get_data(handle, "_dw_owner"); | 2910 HWND menuowner = NULLHANDLE, lastowner = (HWND)dw_window_get_data(handle, "_dw_owner"); |
2911 int menubar = (int)dw_window_get_data(handle, "_dw_menubar"); | 2911 int menubar = (int)dw_window_get_data(handle, "_dw_menubar"); |
2912 | 2912 |
2913 /* Find the toplevel window */ | 2913 /* Find the toplevel window */ |
2923 return client ? client : menuowner; | 2923 return client ? client : menuowner; |
2924 } | 2924 } |
2925 return NULLHANDLE; | 2925 return NULLHANDLE; |
2926 } | 2926 } |
2927 | 2927 |
2928 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2928 MRESULT EXPENTRY _dw_run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2929 { | 2929 { |
2930 int result = -1; | 2930 int result = -1; |
2931 SignalHandler *tmp = Root; | 2931 SignalHandler *tmp = Root; |
2932 ULONG origmsg = msg; | 2932 ULONG origmsg = msg; |
2933 | 2933 |
3002 case WM_BUTTON3DOWN: | 3002 case WM_BUTTON3DOWN: |
3003 button = 3; | 3003 button = 3; |
3004 break; | 3004 break; |
3005 } | 3005 } |
3006 | 3006 |
3007 result = buttonfunc(tmp->window, pts.x, WinQueryWindow(tmp->window, QW_PARENT) == HWND_DESKTOP ? dw_screen_height() - pts.y : _get_height(tmp->window) - pts.y, button, tmp->data); | 3007 result = buttonfunc(tmp->window, pts.x, WinQueryWindow(tmp->window, QW_PARENT) == HWND_DESKTOP ? dw_screen_height() - pts.y : _dw_get_height(tmp->window) - pts.y, button, tmp->data); |
3008 tmp = NULL; | 3008 tmp = NULL; |
3009 } | 3009 } |
3010 } | 3010 } |
3011 break; | 3011 break; |
3012 case WM_BUTTON1UP: | 3012 case WM_BUTTON1UP: |
3029 case WM_BUTTON3UP: | 3029 case WM_BUTTON3UP: |
3030 button = 3; | 3030 button = 3; |
3031 break; | 3031 break; |
3032 } | 3032 } |
3033 | 3033 |
3034 result = buttonfunc(tmp->window, pts.x, WinQueryWindow(tmp->window, QW_PARENT) == HWND_DESKTOP ? dw_screen_height() - pts.y : _get_height(tmp->window) - pts.y, button, tmp->data); | 3034 result = buttonfunc(tmp->window, pts.x, WinQueryWindow(tmp->window, QW_PARENT) == HWND_DESKTOP ? dw_screen_height() - pts.y : _dw_get_height(tmp->window) - pts.y, button, tmp->data); |
3035 tmp = NULL; | 3035 tmp = NULL; |
3036 } | 3036 } |
3037 } | 3037 } |
3038 break; | 3038 break; |
3039 case WM_MOUSEMOVE: | 3039 case WM_MOUSEMOVE: |
3050 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) | 3050 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) |
3051 keys |= DW_BUTTON2_MASK; | 3051 keys |= DW_BUTTON2_MASK; |
3052 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) | 3052 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) |
3053 keys |= DW_BUTTON3_MASK; | 3053 keys |= DW_BUTTON3_MASK; |
3054 | 3054 |
3055 result = motionfunc(tmp->window, x, _get_height(hWnd) - y, keys, tmp->data); | 3055 result = motionfunc(tmp->window, x, _dw_get_height(hWnd) - y, keys, tmp->data); |
3056 tmp = NULL; | 3056 tmp = NULL; |
3057 } | 3057 } |
3058 } | 3058 } |
3059 break; | 3059 break; |
3060 case WM_CHAR: | 3060 case WM_CHAR: |
3061 { | 3061 { |
3062 int (API_FUNC keypressfunc)(HWND, char, int, int, void *, char *) = (int (API_FUNC)(HWND, char, int, int, void *, char *))tmp->signalfunction; | 3062 int (API_FUNC keypressfunc)(HWND, char, int, int, void *, char *) = (int (API_FUNC)(HWND, char, int, int, void *, char *))tmp->signalfunction; |
3063 | 3063 |
3064 if((hWnd == tmp->window || _toplevel_window(hWnd) == tmp->window) && !(SHORT1FROMMP(mp1) & KC_KEYUP)) | 3064 if((hWnd == tmp->window || _dw_toplevel_window(hWnd) == tmp->window) && !(SHORT1FROMMP(mp1) & KC_KEYUP)) |
3065 { | 3065 { |
3066 int vk; | 3066 int vk; |
3067 char ch[2] = {0}; | 3067 char ch[2] = {0}; |
3068 char *utf8 = NULL; | 3068 char *utf8 = NULL; |
3069 #ifdef UNICODE | 3069 #ifdef UNICODE |
3070 UniChar uc[2] = {0}; | 3070 UniChar uc[2] = {0}; |
3071 VDKEY vdk; | 3071 VDKEY vdk; |
3072 BYTE bscan; | 3072 BYTE bscan; |
3073 UniTranslateKey(Keyboard, SHORT1FROMMP(mp1) & KC_SHIFT ? 1 : 0, CHAR4FROMMP(mp1), uc, &vdk, &bscan); | 3073 UniTranslateKey(Keyboard, SHORT1FROMMP(mp1) & KC_SHIFT ? 1 : 0, CHAR4FROMMP(mp1), uc, &vdk, &bscan); |
3074 utf8 = _WideToUTF8(uc); | 3074 utf8 = _dw_WideToUTF8(uc); |
3075 #endif | 3075 #endif |
3076 | 3076 |
3077 if(SHORT1FROMMP(mp1) & KC_CHAR) | 3077 if(SHORT1FROMMP(mp1) & KC_CHAR) |
3078 ch[0] = (char)SHORT1FROMMP(mp2); | 3078 ch[0] = (char)SHORT1FROMMP(mp2); |
3079 if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY) | 3079 if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY) |
3119 int (API_FUNC exposefunc)(HWND, DWExpose *, void *) = (int (API_FUNC)(HWND, DWExpose *, void *))tmp->signalfunction; | 3119 int (API_FUNC exposefunc)(HWND, DWExpose *, void *) = (int (API_FUNC)(HWND, DWExpose *, void *))tmp->signalfunction; |
3120 RECTL rc; | 3120 RECTL rc; |
3121 | 3121 |
3122 if(hWnd == tmp->window) | 3122 if(hWnd == tmp->window) |
3123 { | 3123 { |
3124 int height = _get_height(hWnd); | 3124 int height = _dw_get_height(hWnd); |
3125 | 3125 |
3126 hps = WinBeginPaint(hWnd, 0L, &rc); | 3126 hps = WinBeginPaint(hWnd, 0L, &rc); |
3127 exp.x = rc.xLeft; | 3127 exp.x = rc.xLeft; |
3128 exp.y = height - rc.yTop; | 3128 exp.y = height - rc.yTop; |
3129 exp.width = rc.xRight - rc. xLeft; | 3129 exp.width = rc.xRight - rc. xLeft; |
3138 int (API_FUNC clickfunc)(HWND, void *) = (int (API_FUNC)(HWND, void *))tmp->signalfunction; | 3138 int (API_FUNC clickfunc)(HWND, void *) = (int (API_FUNC)(HWND, void *))tmp->signalfunction; |
3139 ULONG command = COMMANDMSG(&msg)->cmd; | 3139 ULONG command = COMMANDMSG(&msg)->cmd; |
3140 | 3140 |
3141 if(tmp->id && command == tmp->id) | 3141 if(tmp->id && command == tmp->id) |
3142 { | 3142 { |
3143 HWND menuowner = _menu_owner(tmp->window); | 3143 HWND menuowner = _dw_menu_owner(tmp->window); |
3144 | 3144 |
3145 if(menuowner == hWnd || menuowner == NULLHANDLE) | 3145 if(menuowner == hWnd || menuowner == NULLHANDLE) |
3146 { | 3146 { |
3147 result = clickfunc((HWND)tmp->id, tmp->data); | 3147 result = clickfunc((HWND)tmp->id, tmp->data); |
3148 tmp = NULL; | 3148 tmp = NULL; |
3229 | 3229 |
3230 if(!container) | 3230 if(!container) |
3231 { | 3231 { |
3232 NOTIFYRECORDEMPHASIS pre; | 3232 NOTIFYRECORDEMPHASIS pre; |
3233 | 3233 |
3234 dw_tree_item_select(tmp->window, (HTREEITEM)mp2); | 3234 dw_tree_dw_item_select(tmp->window, (HTREEITEM)mp2); |
3235 pre.pRecord = mp2; | 3235 pre.pRecord = mp2; |
3236 pre.fEmphasisMask = CRA_CURSORED; | 3236 pre.fEmphasisMask = CRA_CURSORED; |
3237 pre.hwndCnr = tmp->window; | 3237 pre.hwndCnr = tmp->window; |
3238 _run_event(hWnd, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre); | 3238 _dw_run_event(hWnd, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre); |
3239 pre.pRecord->flRecordAttr |= CRA_CURSORED; | 3239 pre.pRecord->flRecordAttr |= CRA_CURSORED; |
3240 user = pci->user; | 3240 user = pci->user; |
3241 } | 3241 } |
3242 else | 3242 else |
3243 { | 3243 { |
3244 PRECORDCORE rc = (PRECORDCORE)mp2; | 3244 PRECORDCORE rc = (PRECORDCORE)mp2; |
3245 | 3245 |
3246 if(pCoreEmph) | 3246 if(pCoreEmph) |
3247 _clear_emphasis(); | 3247 _dw_clear_emphasis(); |
3248 hwndEmph = tmp->window; | 3248 hwndEmph = tmp->window; |
3249 pCoreEmph = mp2; | 3249 pCoreEmph = mp2; |
3250 WinSendMsg(tmp->window, CM_SETRECORDEMPHASIS, mp2, MPFROM2SHORT(TRUE, CRA_SOURCE)); | 3250 WinSendMsg(tmp->window, CM_SETRECORDEMPHASIS, mp2, MPFROM2SHORT(TRUE, CRA_SOURCE)); |
3251 user = rc->pszText; | 3251 user = rc->pszText; |
3252 } | 3252 } |
3406 else | 3406 else |
3407 { | 3407 { |
3408 /* Handle scrollbar control */ | 3408 /* Handle scrollbar control */ |
3409 if(tmp->window > 65535 && tmp->window == notifyhwnd) | 3409 if(tmp->window > 65535 && tmp->window == notifyhwnd) |
3410 { | 3410 { |
3411 int pos = _HandleScroller(tmp->window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));; | 3411 int pos = _dw_handle_scroller(tmp->window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));; |
3412 | 3412 |
3413 if(pos > -1) | 3413 if(pos > -1) |
3414 { | 3414 { |
3415 dw_window_set_data(tmp->window, "_dw_scrollbar_value", (void *)pos); | 3415 dw_window_set_data(tmp->window, "_dw_scrollbar_value", (void *)pos); |
3416 result = valuechangedfunc(tmp->window, pos, tmp->data); | 3416 result = valuechangedfunc(tmp->window, pos, tmp->data); |
3482 } | 3482 } |
3483 | 3483 |
3484 /* Sets the color selection control to be a DW_RGB value */ | 3484 /* Sets the color selection control to be a DW_RGB value */ |
3485 void _dw_col_set(HWND col, unsigned long value) | 3485 void _dw_col_set(HWND col, unsigned long value) |
3486 { | 3486 { |
3487 WinSendMsg(col, 0x0602, MPFROMLONG(_os2_color(value)), 0); | 3487 WinSendMsg(col, 0x0602, MPFROMLONG(_dw_os2_color(value)), 0); |
3488 if(!IS_WARP4()) | 3488 if(!IS_WARP4()) |
3489 WinSendMsg(col, 0x1384, MPFROMLONG(_os2_color(value)), 0); | 3489 WinSendMsg(col, 0x1384, MPFROMLONG(_dw_os2_color(value)), 0); |
3490 } | 3490 } |
3491 | 3491 |
3492 /* Handles control messages sent to the box (owner). */ | 3492 /* Handles control messages sent to the box (owner). */ |
3493 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 3493 MRESULT EXPENTRY _dw_controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
3494 { | 3494 { |
3495 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER); | 3495 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
3496 | 3496 |
3497 switch(msg) | 3497 switch(msg) |
3498 { | 3498 { |
3499 case WM_MOUSEMOVE: | 3499 case WM_MOUSEMOVE: |
3500 if(_wndproc(hWnd, msg, mp1, mp2)) | 3500 if(_dw_wndproc(hWnd, msg, mp1, mp2)) |
3501 return MPFROMSHORT(FALSE); | 3501 return MPFROMSHORT(FALSE); |
3502 break; | 3502 break; |
3503 case WM_VSCROLL: | 3503 case WM_VSCROLL: |
3504 case WM_HSCROLL: | 3504 case WM_HSCROLL: |
3505 if(_run_event(hWnd, msg, mp1, mp2)) | 3505 if(_dw_run_event(hWnd, msg, mp1, mp2)) |
3506 { | 3506 { |
3507 HWND window = WinWindowFromID(hWnd, (ULONG)mp1); | 3507 HWND window = WinWindowFromID(hWnd, (ULONG)mp1); |
3508 _HandleScroller(window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2)); | 3508 _dw_handle_scroller(window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2)); |
3509 } | 3509 } |
3510 break; | 3510 break; |
3511 /* Handles Color Selection control messages */ | 3511 /* Handles Color Selection control messages */ |
3512 case 0x0601: | 3512 case 0x0601: |
3513 case 0x130C: | 3513 case 0x130C: |
3518 if(window) | 3518 if(window) |
3519 _dw_color_spin_set(window, DW_RGB((val & 0xFF0000) >> 16, (val & 0xFF00) >> 8, val & 0xFF)); | 3519 _dw_color_spin_set(window, DW_RGB((val & 0xFF0000) >> 16, (val & 0xFF00) >> 8, val & 0xFF)); |
3520 } | 3520 } |
3521 break; | 3521 break; |
3522 case WM_USER: | 3522 case WM_USER: |
3523 _run_event(hWnd, WM_CONTROL, mp1, mp2); | 3523 _dw_run_event(hWnd, WM_CONTROL, mp1, mp2); |
3524 break; | 3524 break; |
3525 case WM_CONTROL: | 3525 case WM_CONTROL: |
3526 { | 3526 { |
3527 char tmpbuf[100]; | 3527 char tmpbuf[100]; |
3528 | 3528 |
3544 } | 3544 } |
3545 if(!dw_window_get_data((HWND)mp2, "_dw_updating")) | 3545 if(!dw_window_get_data((HWND)mp2, "_dw_updating")) |
3546 WinPostMsg(hWnd, WM_USER, mp1, mp2); | 3546 WinPostMsg(hWnd, WM_USER, mp1, mp2); |
3547 } | 3547 } |
3548 else | 3548 else |
3549 _run_event(hWnd, msg, mp1, mp2); | 3549 _dw_run_event(hWnd, msg, mp1, mp2); |
3550 } | 3550 } |
3551 break; | 3551 break; |
3552 } | 3552 } |
3553 | 3553 |
3554 if(blah && blah->oldproc) | 3554 if(blah && blah->oldproc) |
3556 | 3556 |
3557 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 3557 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
3558 } | 3558 } |
3559 | 3559 |
3560 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ | 3560 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ |
3561 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 3561 MRESULT EXPENTRY _dw_wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
3562 { | 3562 { |
3563 int result = -1; | 3563 int result = -1; |
3564 static int command_active = 0; | 3564 static int command_active = 0; |
3565 void (API_FUNC windowfunc)(PVOID) = 0L; | 3565 void (API_FUNC windowfunc)(PVOID) = 0L; |
3566 | 3566 |
3568 { | 3568 { |
3569 /* Make sure we don't end up in infinite recursion */ | 3569 /* Make sure we don't end up in infinite recursion */ |
3570 command_active = 1; | 3570 command_active = 1; |
3571 | 3571 |
3572 if(msg == WM_ACTIVATE) | 3572 if(msg == WM_ACTIVATE) |
3573 result = (int)_run_event((HWND)mp2, WM_SETFOCUS, 0, mp1); | 3573 result = (int)_dw_run_event((HWND)mp2, WM_SETFOCUS, 0, mp1); |
3574 else | 3574 else |
3575 result = (int)_run_event(hWnd, msg, mp1, mp2); | 3575 result = (int)_dw_run_event(hWnd, msg, mp1, mp2); |
3576 | 3576 |
3577 command_active = 0; | 3577 command_active = 0; |
3578 } | 3578 } |
3579 | 3579 |
3580 /* Now that any handlers are done... do normal processing */ | 3580 /* Now that any handlers are done... do normal processing */ |
3608 WinShowWindow(hWnd, FALSE); | 3608 WinShowWindow(hWnd, FALSE); |
3609 | 3609 |
3610 if(mybox->items) | 3610 if(mybox->items) |
3611 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SWP_MOVE | SWP_SIZE); | 3611 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SWP_MOVE | SWP_SIZE); |
3612 | 3612 |
3613 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); | 3613 _dw_do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); |
3614 | 3614 |
3615 WinShowWindow(hWnd, TRUE); | 3615 WinShowWindow(hWnd, TRUE); |
3616 } | 3616 } |
3617 } | 3617 } |
3618 break; | 3618 break; |
3646 /* Hide the window when recalculating to reduce | 3646 /* Hide the window when recalculating to reduce |
3647 * CPU load. | 3647 * CPU load. |
3648 */ | 3648 */ |
3649 WinShowWindow(hWnd, FALSE); | 3649 WinShowWindow(hWnd, FALSE); |
3650 | 3650 |
3651 _do_resize(mybox, swp->cx, swp->cy); | 3651 _dw_do_resize(mybox, swp->cx, swp->cy); |
3652 | 3652 |
3653 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX) | 3653 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX) |
3654 { | 3654 { |
3655 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER); | 3655 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER); |
3656 | 3656 |
3657 for(z=0;z<mybox->count;z++) | 3657 for(z=0;z<mybox->count;z++) |
3658 _check_resize_notebook(mybox->items[z].hwnd); | 3658 _dw_check_resize_notebook(mybox->items[z].hwnd); |
3659 | 3659 |
3660 } | 3660 } |
3661 | 3661 |
3662 WinShowWindow(hWnd, TRUE); | 3662 WinShowWindow(hWnd, TRUE); |
3663 } | 3663 } |
3684 rc.xRight = x + width; | 3684 rc.xRight = x + width; |
3685 rc.yTop = y + height; | 3685 rc.yTop = y + height; |
3686 | 3686 |
3687 WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); | 3687 WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); |
3688 | 3688 |
3689 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); | 3689 _dw_do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); |
3690 } | 3690 } |
3691 } | 3691 } |
3692 break; | 3692 break; |
3693 } | 3693 } |
3694 break; | 3694 break; |
3702 case WM_MOUSEMOVE: | 3702 case WM_MOUSEMOVE: |
3703 { | 3703 { |
3704 HPOINTER pointer; | 3704 HPOINTER pointer; |
3705 | 3705 |
3706 if((pointer = (HPOINTER)dw_window_get_data(hWnd, "_dw_pointer")) || | 3706 if((pointer = (HPOINTER)dw_window_get_data(hWnd, "_dw_pointer")) || |
3707 (pointer = (HPOINTER)dw_window_get_data(_toplevel_window(hWnd), "_dw_pointer"))) | 3707 (pointer = (HPOINTER)dw_window_get_data(_dw_toplevel_window(hWnd), "_dw_pointer"))) |
3708 { | 3708 { |
3709 WinSetPointer(HWND_DESKTOP, pointer); | 3709 WinSetPointer(HWND_DESKTOP, pointer); |
3710 return MRFROMSHORT(TRUE); | 3710 return MRFROMSHORT(TRUE); |
3711 } | 3711 } |
3712 } | 3712 } |
3719 break; | 3719 break; |
3720 case WM_CHAR: | 3720 case WM_CHAR: |
3721 if(SHORT1FROMMP(mp2) == '\t') | 3721 if(SHORT1FROMMP(mp2) == '\t') |
3722 { | 3722 { |
3723 if(CHARMSG(&msg)->fs & KC_SHIFT) | 3723 if(CHARMSG(&msg)->fs & KC_SHIFT) |
3724 _shift_focus(hWnd, _DW_DIRECTION_BACKWARD); | 3724 _dw_shift_focus(hWnd, _DW_DIRECTION_BACKWARD); |
3725 else | 3725 else |
3726 _shift_focus(hWnd, _DW_DIRECTION_FORWARD); | 3726 _dw_shift_focus(hWnd, _DW_DIRECTION_FORWARD); |
3727 return FALSE; | 3727 return FALSE; |
3728 } | 3728 } |
3729 break; | 3729 break; |
3730 case WM_DESTROY: | 3730 case WM_DESTROY: |
3731 { | 3731 { |
3732 HWND parent = WinQueryWindow(hWnd, QW_PARENT); | 3732 HWND parent = WinQueryWindow(hWnd, QW_PARENT); |
3733 | 3733 |
3734 /* Free memory before destroying */ | 3734 /* Free memory before destroying */ |
3735 if(parent && WinWindowFromID(parent, FID_CLIENT) == hWnd) | 3735 if(parent && WinWindowFromID(parent, FID_CLIENT) == hWnd) |
3736 _free_window_memory(parent); | 3736 _dw_free_window_memory(parent); |
3737 else | 3737 else |
3738 _free_window_memory(hWnd); | 3738 _dw_free_window_memory(hWnd); |
3739 } | 3739 } |
3740 break; | 3740 break; |
3741 case WM_MENUEND: | 3741 case WM_MENUEND: |
3742 /* Delay removing the signal until we've executed | 3742 /* Delay removing the signal until we've executed |
3743 * the signal handler. | 3743 * the signal handler. |
3753 case WM_BUTTON3DOWN | 0x2000: | 3753 case WM_BUTTON3DOWN | 0x2000: |
3754 case WM_BUTTON1UP | 0x2000: | 3754 case WM_BUTTON1UP | 0x2000: |
3755 case WM_BUTTON2UP | 0x2000: | 3755 case WM_BUTTON2UP | 0x2000: |
3756 case WM_BUTTON3UP | 0x2000: | 3756 case WM_BUTTON3UP | 0x2000: |
3757 if(hwndTaskBar) | 3757 if(hwndTaskBar) |
3758 result = (int)_run_event(hwndTaskBar, msg & ~0x2000, mp1, mp2); | 3758 result = (int)_dw_run_event(hwndTaskBar, msg & ~0x2000, mp1, mp2); |
3759 break; | 3759 break; |
3760 case WM_USER+2: | 3760 case WM_USER+2: |
3761 _clear_emphasis(); | 3761 _dw_clear_emphasis(); |
3762 if(dw_window_get_data((HWND)mp2, "_dw_popup")) | 3762 if(dw_window_get_data((HWND)mp2, "_dw_popup")) |
3763 _free_menu_data((HWND)mp2); | 3763 _dw_free_menu_data((HWND)mp2); |
3764 break; | 3764 break; |
3765 } | 3765 } |
3766 | 3766 |
3767 if(result != -1) | 3767 if(result != -1) |
3768 return (MRESULT)result; | 3768 return (MRESULT)result; |
3769 else | 3769 else |
3770 return WinDefWindowProc(hWnd, msg, mp1, mp2); | 3770 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
3771 } | 3771 } |
3772 | 3772 |
3773 void _changebox(Box *thisbox, int percent, int type) | 3773 void _dw_change_box(Box *thisbox, int percent, int type) |
3774 { | 3774 { |
3775 int z; | 3775 int z; |
3776 | 3776 |
3777 for(z=0;z<thisbox->count;z++) | 3777 for(z=0;z<thisbox->count;z++) |
3778 { | 3778 { |
3779 if(thisbox->items[z].type == TYPEBOX) | 3779 if(thisbox->items[z].type == TYPEBOX) |
3780 { | 3780 { |
3781 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | 3781 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); |
3782 _changebox(tmp, percent, type); | 3782 _dw_change_box(tmp, percent, type); |
3783 } | 3783 } |
3784 else | 3784 else |
3785 { | 3785 { |
3786 if(type == DW_HORZ) | 3786 if(type == DW_HORZ) |
3787 { | 3787 { |
3795 } | 3795 } |
3796 } | 3796 } |
3797 } | 3797 } |
3798 } | 3798 } |
3799 | 3799 |
3800 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) | 3800 void _dw_handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) |
3801 { | 3801 { |
3802 float ratio = (float)percent/(float)100.0; | 3802 float ratio = (float)percent/(float)100.0; |
3803 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); | 3803 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
3804 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); | 3804 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
3805 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER); | 3805 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER); |
3810 if(type == DW_HORZ) | 3810 if(type == DW_HORZ) |
3811 { | 3811 { |
3812 int newx = (int)((float)x * ratio) - (SPLITBAR_WIDTH/2); | 3812 int newx = (int)((float)x * ratio) - (SPLITBAR_WIDTH/2); |
3813 | 3813 |
3814 WinSetWindowPos(handle1, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE); | 3814 WinSetWindowPos(handle1, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE); |
3815 _do_resize(tmp, newx - 1, y - 1); | 3815 _dw_do_resize(tmp, newx - 1, y - 1); |
3816 | 3816 |
3817 dw_window_set_data(hwnd, "_dw_start", (void *)newx); | 3817 dw_window_set_data(hwnd, "_dw_start", (void *)newx); |
3818 | 3818 |
3819 tmp = WinQueryWindowPtr(handle2, QWP_USER); | 3819 tmp = WinQueryWindowPtr(handle2, QWP_USER); |
3820 | 3820 |
3821 newx = x - newx - SPLITBAR_WIDTH; | 3821 newx = x - newx - SPLITBAR_WIDTH; |
3822 | 3822 |
3823 WinSetWindowPos(handle2, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE); | 3823 WinSetWindowPos(handle2, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE); |
3824 _do_resize(tmp, newx - 1, y - 1); | 3824 _dw_do_resize(tmp, newx - 1, y - 1); |
3825 } | 3825 } |
3826 else | 3826 else |
3827 { | 3827 { |
3828 int newy = (int)((float)y * ratio) - (SPLITBAR_WIDTH/2); | 3828 int newy = (int)((float)y * ratio) - (SPLITBAR_WIDTH/2); |
3829 | 3829 |
3830 WinSetWindowPos(handle1, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE); | 3830 WinSetWindowPos(handle1, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE); |
3831 _do_resize(tmp, x - 1, newy - 1); | 3831 _dw_do_resize(tmp, x - 1, newy - 1); |
3832 | 3832 |
3833 tmp = WinQueryWindowPtr(handle2, QWP_USER); | 3833 tmp = WinQueryWindowPtr(handle2, QWP_USER); |
3834 | 3834 |
3835 newy = y - newy - SPLITBAR_WIDTH; | 3835 newy = y - newy - SPLITBAR_WIDTH; |
3836 | 3836 |
3837 WinSetWindowPos(handle2, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE); | 3837 WinSetWindowPos(handle2, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE); |
3838 _do_resize(tmp, x - 1, newy - 1); | 3838 _dw_do_resize(tmp, x - 1, newy - 1); |
3839 | 3839 |
3840 dw_window_set_data(hwnd, "_dw_start", (void *)newy); | 3840 dw_window_set_data(hwnd, "_dw_start", (void *)newy); |
3841 } | 3841 } |
3842 | 3842 |
3843 WinShowWindow(handle1, TRUE); | 3843 WinShowWindow(handle1, TRUE); |
3844 WinShowWindow(handle2, TRUE); | 3844 WinShowWindow(handle2, TRUE); |
3845 } | 3845 } |
3846 | 3846 |
3847 | 3847 |
3848 /* This handles any activity on the splitbars (sizers) */ | 3848 /* This handles any activity on the splitbars (sizers) */ |
3849 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 3849 MRESULT EXPENTRY _dw_splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
3850 { | 3850 { |
3851 switch (msg) | 3851 switch (msg) |
3852 { | 3852 { |
3853 case WM_ACTIVATE: | 3853 case WM_ACTIVATE: |
3854 case WM_SETFOCUS: | 3854 case WM_SETFOCUS: |
3932 rclFrame.yTop = start + SPLITBAR_WIDTH; | 3932 rclFrame.yTop = start + SPLITBAR_WIDTH; |
3933 } | 3933 } |
3934 | 3934 |
3935 if(percent) | 3935 if(percent) |
3936 { | 3936 { |
3937 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds); | 3937 rc = _dw_track_rectangle(hwnd, &rclFrame, &rclBounds); |
3938 | 3938 |
3939 if(rc == TRUE) | 3939 if(rc == TRUE) |
3940 { | 3940 { |
3941 int width = (rclBounds.xRight - rclBounds.xLeft); | 3941 int width = (rclBounds.xRight - rclBounds.xLeft); |
3942 int height = (rclBounds.yTop - rclBounds.yBottom); | 3942 int height = (rclBounds.yTop - rclBounds.yBottom); |
3951 { | 3951 { |
3952 start = rclFrame.yBottom - rclBounds.yBottom; | 3952 start = rclFrame.yBottom - rclBounds.yBottom; |
3953 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH) | 3953 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH) |
3954 *percent = 100.0 - (((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0); | 3954 *percent = 100.0 - (((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0); |
3955 } | 3955 } |
3956 _handle_splitbar_resize(hwnd, *percent, type, width, height); | 3956 _dw_handle_splitbar_resize(hwnd, *percent, type, width, height); |
3957 _handle_splitbar_resize(hwnd, *percent, type, width, height); | 3957 _dw_handle_splitbar_resize(hwnd, *percent, type, width, height); |
3958 } | 3958 } |
3959 } | 3959 } |
3960 } | 3960 } |
3961 return MRFROMSHORT(FALSE); | 3961 return MRFROMSHORT(FALSE); |
3962 } | 3962 } |
3963 return WinDefWindowProc(hwnd, msg, mp1, mp2); | 3963 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
3964 } | 3964 } |
3965 | 3965 |
3966 MRESULT EXPENTRY _button_draw(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, PFNWP oldproc, int indent) | 3966 MRESULT EXPENTRY _dw_button_draw(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, PFNWP oldproc, int indent) |
3967 { | 3967 { |
3968 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap"); | 3968 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap"); |
3969 HPIXMAP disable = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap_disabled"); | 3969 HPIXMAP disable = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap_disabled"); |
3970 HPOINTER icon = (HPOINTER)dw_window_get_data(hwnd, "_dw_button_icon"); | 3970 HPOINTER icon = (HPOINTER)dw_window_get_data(hwnd, "_dw_button_icon"); |
3971 MRESULT res; | 3971 MRESULT res; |
4066 | 4066 |
4067 /* Function: BtProc | 4067 /* Function: BtProc |
4068 * Abstract: Subclass procedure for buttons | 4068 * Abstract: Subclass procedure for buttons |
4069 */ | 4069 */ |
4070 | 4070 |
4071 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 4071 MRESULT EXPENTRY _dw_buttonproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
4072 { | 4072 { |
4073 WindowData *blah = WinQueryWindowPtr(hwnd, QWL_USER); | 4073 WindowData *blah = WinQueryWindowPtr(hwnd, QWL_USER); |
4074 PFNWP oldproc; | 4074 PFNWP oldproc; |
4075 int retval = -1; | 4075 int retval = -1; |
4076 | 4076 |
4078 return WinDefWindowProc(hwnd, msg, mp1, mp2); | 4078 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
4079 | 4079 |
4080 oldproc = blah->oldproc; | 4080 oldproc = blah->oldproc; |
4081 | 4081 |
4082 if(blah->bubbletext[0]) | 4082 if(blah->bubbletext[0]) |
4083 _TooltipProc(hwnd, msg, mp1, mp2, blah); | 4083 _dw_tooltipproc(hwnd, msg, mp1, mp2, blah); |
4084 | 4084 |
4085 switch(msg) | 4085 switch(msg) |
4086 { | 4086 { |
4087 case WM_MOUSEMOVE: | 4087 case WM_MOUSEMOVE: |
4088 if(_wndproc(hwnd, msg, mp1, mp2)) | 4088 if(_dw_wndproc(hwnd, msg, mp1, mp2)) |
4089 return MPFROMSHORT(FALSE); | 4089 return MPFROMSHORT(FALSE); |
4090 break; | 4090 break; |
4091 case WM_PAINT: | 4091 case WM_PAINT: |
4092 return _button_draw(hwnd, msg, mp1, mp2, oldproc, 0); | 4092 return _dw_button_draw(hwnd, msg, mp1, mp2, oldproc, 0); |
4093 case BM_SETHILITE: | 4093 case BM_SETHILITE: |
4094 return _button_draw(hwnd, msg, mp1, mp2, oldproc, (int)mp1); | 4094 return _dw_button_draw(hwnd, msg, mp1, mp2, oldproc, (int)mp1); |
4095 case WM_SETFOCUS: | 4095 case WM_SETFOCUS: |
4096 if(mp2) | 4096 if(mp2) |
4097 _run_event(hwnd, msg, mp1, mp2); | 4097 _dw_run_event(hwnd, msg, mp1, mp2); |
4098 else | 4098 else |
4099 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); | 4099 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); |
4100 /* FIX: Borderless buttons not displaying properly after gaining focus */ | 4100 /* FIX: Borderless buttons not displaying properly after gaining focus */ |
4101 if((WinQueryWindowULong(hwnd, QWL_STYLE) & BS_NOBORDER)) | 4101 if((WinQueryWindowULong(hwnd, QWL_STYLE) & BS_NOBORDER)) |
4102 { | 4102 { |
4186 } | 4186 } |
4187 } | 4187 } |
4188 if(SHORT1FROMMP(mp2) == '\t') | 4188 if(SHORT1FROMMP(mp2) == '\t') |
4189 { | 4189 { |
4190 if(CHARMSG(&msg)->fs & KC_SHIFT) | 4190 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4191 _shift_focus(hwnd, _DW_DIRECTION_BACKWARD); | 4191 _dw_shift_focus(hwnd, _DW_DIRECTION_BACKWARD); |
4192 else | 4192 else |
4193 _shift_focus(hwnd, _DW_DIRECTION_FORWARD); | 4193 _dw_shift_focus(hwnd, _DW_DIRECTION_FORWARD); |
4194 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); | 4194 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); |
4195 return FALSE; | 4195 return FALSE; |
4196 } | 4196 } |
4197 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_LEFT || CHARMSG(&msg)->vkey == VK_UP)) | 4197 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_LEFT || CHARMSG(&msg)->vkey == VK_UP)) |
4198 { | 4198 { |
4199 _shift_focus(hwnd, _DW_DIRECTION_BACKWARD); | 4199 _dw_shift_focus(hwnd, _DW_DIRECTION_BACKWARD); |
4200 return FALSE; | 4200 return FALSE; |
4201 } | 4201 } |
4202 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_RIGHT || CHARMSG(&msg)->vkey == VK_DOWN)) | 4202 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_RIGHT || CHARMSG(&msg)->vkey == VK_DOWN)) |
4203 { | 4203 { |
4204 _shift_focus(hwnd, _DW_DIRECTION_FORWARD); | 4204 _dw_shift_focus(hwnd, _DW_DIRECTION_FORWARD); |
4205 return FALSE; | 4205 return FALSE; |
4206 } | 4206 } |
4207 } | 4207 } |
4208 break; | 4208 break; |
4209 } | 4209 } |
4217 } | 4217 } |
4218 | 4218 |
4219 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 4219 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
4220 { | 4220 { |
4221 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); | 4221 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); |
4222 int res = (int)_run_event(hwnd, msg, mp1, mp2); | 4222 int res = (int)_dw_run_event(hwnd, msg, mp1, mp2); |
4223 | 4223 |
4224 if(blah && blah->bubbletext[0]) | 4224 if(blah && blah->bubbletext[0]) |
4225 _TooltipProc(hwnd, msg, mp1, mp2, blah); | 4225 _dw_tooltipproc(hwnd, msg, mp1, mp2, blah); |
4226 | 4226 |
4227 switch(msg) | 4227 switch(msg) |
4228 { | 4228 { |
4229 case WM_MOUSEMOVE: | 4229 case WM_MOUSEMOVE: |
4230 if(_wndproc(hwnd, msg, mp1, mp2)) | 4230 if(_dw_wndproc(hwnd, msg, mp1, mp2)) |
4231 return MPFROMSHORT(FALSE); | 4231 return MPFROMSHORT(FALSE); |
4232 break; | 4232 break; |
4233 case WM_BUTTON1DOWN: | 4233 case WM_BUTTON1DOWN: |
4234 case WM_BUTTON2DOWN: | 4234 case WM_BUTTON2DOWN: |
4235 case WM_BUTTON3DOWN: | 4235 case WM_BUTTON3DOWN: |
4239 return (MPARAM)TRUE; | 4239 return (MPARAM)TRUE; |
4240 } | 4240 } |
4241 return WinDefWindowProc(hwnd, msg, mp1, mp2); | 4241 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
4242 } | 4242 } |
4243 | 4243 |
4244 MRESULT EXPENTRY _TreeProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 4244 MRESULT EXPENTRY _dw_treeproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
4245 { | 4245 { |
4246 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); | 4246 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); |
4247 PFNWP oldproc = 0; | 4247 PFNWP oldproc = 0; |
4248 | 4248 |
4249 if(blah) | 4249 if(blah) |
4250 oldproc = blah->oldproc; | 4250 oldproc = blah->oldproc; |
4251 | 4251 |
4252 if(blah && blah->bubbletext[0]) | 4252 if(blah && blah->bubbletext[0]) |
4253 _TooltipProc(hwnd, msg, mp1, mp2, blah); | 4253 _dw_tooltipproc(hwnd, msg, mp1, mp2, blah); |
4254 | 4254 |
4255 switch(msg) | 4255 switch(msg) |
4256 { | 4256 { |
4257 case WM_MOUSEMOVE: | 4257 case WM_MOUSEMOVE: |
4258 if(_wndproc(hwnd, msg, mp1, mp2)) | 4258 if(_dw_wndproc(hwnd, msg, mp1, mp2)) |
4259 return MPFROMSHORT(FALSE); | 4259 return MPFROMSHORT(FALSE); |
4260 break; | 4260 break; |
4261 case WM_PAINT: | 4261 case WM_PAINT: |
4262 { | 4262 { |
4263 HPS hps; | 4263 HPS hps; |
4279 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0); | 4279 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0); |
4280 WinEndPaint(hps); | 4280 WinEndPaint(hps); |
4281 } | 4281 } |
4282 return MRFROMSHORT(FALSE); | 4282 return MRFROMSHORT(FALSE); |
4283 case WM_SETFOCUS: | 4283 case WM_SETFOCUS: |
4284 _run_event(hwnd, msg, mp1, mp2); | 4284 _dw_run_event(hwnd, msg, mp1, mp2); |
4285 break; | 4285 break; |
4286 case WM_CHAR: | 4286 case WM_CHAR: |
4287 if(SHORT1FROMMP(mp2) == '\t') | 4287 if(SHORT1FROMMP(mp2) == '\t') |
4288 { | 4288 { |
4289 if(CHARMSG(&msg)->fs & KC_SHIFT) | 4289 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4290 _shift_focus(hwnd, _DW_DIRECTION_BACKWARD); | 4290 _dw_shift_focus(hwnd, _DW_DIRECTION_BACKWARD); |
4291 else | 4291 else |
4292 _shift_focus(hwnd, _DW_DIRECTION_FORWARD); | 4292 _dw_shift_focus(hwnd, _DW_DIRECTION_FORWARD); |
4293 return FALSE; | 4293 return FALSE; |
4294 } | 4294 } |
4295 break; | 4295 break; |
4296 } | 4296 } |
4297 | 4297 |
4298 _run_event(hwnd, msg, mp1, mp2); | 4298 _dw_run_event(hwnd, msg, mp1, mp2); |
4299 | 4299 |
4300 if(oldproc) | 4300 if(oldproc) |
4301 return oldproc(hwnd, msg, mp1, mp2); | 4301 return oldproc(hwnd, msg, mp1, mp2); |
4302 | 4302 |
4303 return WinDefWindowProc(hwnd, msg, mp1, mp2); | 4303 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
4304 } | 4304 } |
4305 | 4305 |
4306 MRESULT EXPENTRY _NotebookProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 4306 MRESULT EXPENTRY _dw_notebookproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
4307 { | 4307 { |
4308 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); | 4308 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); |
4309 PFNWP oldproc = 0; | 4309 PFNWP oldproc = 0; |
4310 | 4310 |
4311 if(blah) | 4311 if(blah) |
4326 break; | 4326 break; |
4327 case WM_CHAR: | 4327 case WM_CHAR: |
4328 if(SHORT1FROMMP(mp2) == '\t') | 4328 if(SHORT1FROMMP(mp2) == '\t') |
4329 { | 4329 { |
4330 if(CHARMSG(&msg)->fs & KC_SHIFT) | 4330 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4331 _shift_focus(hwnd, _DW_DIRECTION_BACKWARD); | 4331 _dw_shift_focus(hwnd, _DW_DIRECTION_BACKWARD); |
4332 else | 4332 else |
4333 _shift_focus(hwnd, _DW_DIRECTION_FORWARD); | 4333 _dw_shift_focus(hwnd, _DW_DIRECTION_FORWARD); |
4334 return FALSE; | 4334 return FALSE; |
4335 } | 4335 } |
4336 break; | 4336 break; |
4337 } | 4337 } |
4338 | 4338 |
4342 return WinDefWindowProc(hwnd, msg, mp1, mp2); | 4342 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
4343 } | 4343 } |
4344 | 4344 |
4345 #ifdef UNICODE | 4345 #ifdef UNICODE |
4346 /* Internal function to detect the active keyboard layout */ | 4346 /* Internal function to detect the active keyboard layout */ |
4347 UniChar *_detect_keyb(void) | 4347 UniChar *_dw_detect_keyb(void) |
4348 { | 4348 { |
4349 HFILE handle; | 4349 HFILE handle; |
4350 struct | 4350 struct |
4351 { | 4351 { |
4352 USHORT length; | 4352 USHORT length; |
4368 if(DosDevIOCtl(handle, 4, 0x7b, NULL, plen, &plen, | 4368 if(DosDevIOCtl(handle, 4, 0x7b, NULL, plen, &plen, |
4369 &kd, dlen, &dlen) == 0 && strlen(kd.strings) > 0) | 4369 &kd, dlen, &dlen) == 0 && strlen(kd.strings) > 0) |
4370 { | 4370 { |
4371 | 4371 |
4372 /* Convert to Unicode */ | 4372 /* Convert to Unicode */ |
4373 buf = _UTF8toWide(kd.strings); | 4373 buf = _dw_UTF8toWide(kd.strings); |
4374 } | 4374 } |
4375 DosClose (handle); | 4375 DosClose (handle); |
4376 } | 4376 } |
4377 return buf; | 4377 return buf; |
4378 } | 4378 } |
4421 UniStrcat(suCodepage, (UniChar *) L"@map=cdra,path=no"); | 4421 UniStrcat(suCodepage, (UniChar *) L"@map=cdra,path=no"); |
4422 UniCreateUconvObject(suCodepage, &Uconv); | 4422 UniCreateUconvObject(suCodepage, &Uconv); |
4423 /* Create the Unicode atom for copy and paste */ | 4423 /* Create the Unicode atom for copy and paste */ |
4424 Unicode = WinAddAtom(WinQuerySystemAtomTable(), (PSZ)"text/unicode"); | 4424 Unicode = WinAddAtom(WinQuerySystemAtomTable(), (PSZ)"text/unicode"); |
4425 /* Figure out how to determine the correct keyboard here */ | 4425 /* Figure out how to determine the correct keyboard here */ |
4426 kbd = _detect_keyb(); | 4426 kbd = _dw_detect_keyb(); |
4427 /* Default to US if could not detect */ | 4427 /* Default to US if could not detect */ |
4428 UniCreateKeyboard(&Keyboard, (UniChar *)kbd ? kbd : L"us", 0); | 4428 UniCreateKeyboard(&Keyboard, (UniChar *)kbd ? kbd : L"us", 0); |
4429 /* Free temporary memory */ | 4429 /* Free temporary memory */ |
4430 if(kbd) | 4430 if(kbd) |
4431 free(kbd); | 4431 free(kbd); |
4432 /* Set the codepage to 1208 (UTF-8) */ | 4432 /* Set the codepage to 1208 (UTF-8) */ |
4433 WinSetCp(dwhmq, 1208); | 4433 WinSetCp(dwhmq, 1208); |
4434 #endif | 4434 #endif |
4435 } | 4435 } |
4436 | 4436 |
4437 rc = WinRegisterClass(dwhab, (PSZ)ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); | 4437 rc = WinRegisterClass(dwhab, (PSZ)ClassName, _dw_wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); |
4438 rc = WinRegisterClass(dwhab, (PSZ)SplitbarClassName, _splitwndproc, 0L, 32); | 4438 rc = WinRegisterClass(dwhab, (PSZ)SplitbarClassName, _dw_splitwndproc, 0L, 32); |
4439 rc = WinRegisterClass(dwhab, (PSZ)ScrollClassName, _scrollwndproc, 0L, 32); | 4439 rc = WinRegisterClass(dwhab, (PSZ)ScrollClassName, _dw_scrollwndproc, 0L, 32); |
4440 rc = WinRegisterClass(dwhab, (PSZ)CalendarClassName, _calendarproc, 0L, 32); | 4440 rc = WinRegisterClass(dwhab, (PSZ)CalendarClassName, _dw_calendarproc, 0L, 32); |
4441 | 4441 |
4442 /* Fill in the the calendar fields */ | 4442 /* Fill in the the calendar fields */ |
4443 for(x=0;x<7;x++) | 4443 for(x=0;x<7;x++) |
4444 { | 4444 { |
4445 thistm.tm_wday = x; | 4445 thistm.tm_wday = x; |
4515 | 4515 |
4516 /* Run the loop until the flag is unset... or error */ | 4516 /* Run the loop until the flag is unset... or error */ |
4517 while(_dw_main_running && WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | 4517 while(_dw_main_running && WinGetMsg(dwhab, &qmsg, 0, 0, 0)) |
4518 { | 4518 { |
4519 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) | 4519 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
4520 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); | 4520 _dw_run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
4521 WinDispatchMsg(dwhab, &qmsg); | 4521 WinDispatchMsg(dwhab, &qmsg); |
4522 } | 4522 } |
4523 } | 4523 } |
4524 | 4524 |
4525 /* | 4525 /* |
4548 { | 4548 { |
4549 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) | 4549 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) |
4550 { | 4550 { |
4551 WinGetMsg(dwhab, &qmsg, 0, 0, 0); | 4551 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
4552 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) | 4552 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
4553 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); | 4553 _dw_run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
4554 WinDispatchMsg(dwhab, &qmsg); | 4554 WinDispatchMsg(dwhab, &qmsg); |
4555 } | 4555 } |
4556 else | 4556 else |
4557 DosSleep(1); | 4557 DosSleep(1); |
4558 gettimeofday(&tv, NULL); | 4558 gettimeofday(&tv, NULL); |
4564 { | 4564 { |
4565 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) | 4565 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) |
4566 { | 4566 { |
4567 WinGetMsg(dwhab, &qmsg, 0, 0, 0); | 4567 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
4568 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) | 4568 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
4569 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); | 4569 _dw_run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
4570 WinDispatchMsg(dwhab, &qmsg); | 4570 WinDispatchMsg(dwhab, &qmsg); |
4571 } | 4571 } |
4572 else | 4572 else |
4573 DosSleep(1); | 4573 DosSleep(1); |
4574 } | 4574 } |
4585 _dwtid = dw_thread_id(); | 4585 _dwtid = dw_thread_id(); |
4586 | 4586 |
4587 if(WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | 4587 if(WinGetMsg(dwhab, &qmsg, 0, 0, 0)) |
4588 { | 4588 { |
4589 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) | 4589 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
4590 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); | 4590 _dw_run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
4591 WinDispatchMsg(dwhab, &qmsg); | 4591 WinDispatchMsg(dwhab, &qmsg); |
4592 } | 4592 } |
4593 } | 4593 } |
4594 | 4594 |
4595 /* | 4595 /* |
4651 return NULL; | 4651 return NULL; |
4652 | 4652 |
4653 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | 4653 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) |
4654 { | 4654 { |
4655 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) | 4655 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
4656 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); | 4656 _dw_run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
4657 WinDispatchMsg(dwhab, &qmsg); | 4657 WinDispatchMsg(dwhab, &qmsg); |
4658 if(dialog->done) | 4658 if(dialog->done) |
4659 break; | 4659 break; |
4660 } | 4660 } |
4661 dw_event_close(&dialog->eve); | 4661 dw_event_close(&dialog->eve); |
4759 { | 4759 { |
4760 int rc = WinShowWindow(handle, TRUE); | 4760 int rc = WinShowWindow(handle, TRUE); |
4761 HSWITCH hswitch; | 4761 HSWITCH hswitch; |
4762 SWCNTRL swcntrl; | 4762 SWCNTRL swcntrl; |
4763 | 4763 |
4764 _fix_button_owner(_toplevel_window(handle), 0); | 4764 _dw_fix_button_owner(_dw_toplevel_window(handle), 0); |
4765 WinSetFocus(HWND_DESKTOP, handle); | 4765 WinSetFocus(HWND_DESKTOP, handle); |
4766 _initial_focus(handle); | 4766 _dw_initial_focus(handle); |
4767 | 4767 |
4768 /* If this window has a switch list entry make sure it is visible */ | 4768 /* If this window has a switch list entry make sure it is visible */ |
4769 hswitch = WinQuerySwitchHandle(handle, 0); | 4769 hswitch = WinQuerySwitchHandle(handle, 0); |
4770 if(hswitch) | 4770 if(hswitch) |
4771 { | 4771 { |
4933 | 4933 |
4934 parent = WinQueryWindow(handle, QW_PARENT); | 4934 parent = WinQueryWindow(handle, QW_PARENT); |
4935 frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); | 4935 frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); |
4936 | 4936 |
4937 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) | 4937 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) |
4938 _free_menu_data(menu); | 4938 _dw_free_menu_data(menu); |
4939 | 4939 |
4940 /* If it is a desktop window let WM_DESTROY handle it */ | 4940 /* If it is a desktop window let WM_DESTROY handle it */ |
4941 if(parent != desktop) | 4941 if(parent != desktop) |
4942 { | 4942 { |
4943 dw_box_unpack(handle); | 4943 dw_box_unpack(handle); |
4944 _free_window_memory(frame ? frame : handle); | 4944 _dw_free_window_memory(frame ? frame : handle); |
4945 } | 4945 } |
4946 return WinDestroyWindow(frame ? frame : handle); | 4946 return WinDestroyWindow(frame ? frame : handle); |
4947 } | 4947 } |
4948 | 4948 |
4949 /* Causes entire window to be invalidated and redrawn. | 4949 /* Causes entire window to be invalidated and redrawn. |
4954 { | 4954 { |
4955 HWND client = WinWindowFromID(handle, FID_CLIENT); | 4955 HWND client = WinWindowFromID(handle, FID_CLIENT); |
4956 HWND window = client ? client : handle; | 4956 HWND window = client ? client : handle; |
4957 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER); | 4957 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER); |
4958 | 4958 |
4959 _fix_button_owner(_toplevel_window(handle), 0); | 4959 _dw_fix_button_owner(_dw_toplevel_window(handle), 0); |
4960 if(window && mybox) | 4960 if(window && mybox) |
4961 { | 4961 { |
4962 unsigned long width, height; | 4962 unsigned long width, height; |
4963 | 4963 |
4964 dw_window_get_pos_size(window, NULL, NULL, &width, &height); | 4964 dw_window_get_pos_size(window, NULL, NULL, &width, &height); |
4965 | 4965 |
4966 if(mybox->items) | 4966 if(mybox->items) |
4967 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, width, height, SWP_MOVE | SWP_SIZE); | 4967 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, width, height, SWP_MOVE | SWP_SIZE); |
4968 | 4968 |
4969 WinShowWindow(client && mybox->items ? mybox->items[0].hwnd : handle, FALSE); | 4969 WinShowWindow(client && mybox->items ? mybox->items[0].hwnd : handle, FALSE); |
4970 _do_resize(mybox, width, height); | 4970 _dw_do_resize(mybox, width, height); |
4971 WinShowWindow(client && mybox->items ? mybox->items[0].hwnd : handle, TRUE); | 4971 WinShowWindow(client && mybox->items ? mybox->items[0].hwnd : handle, TRUE); |
4972 } | 4972 } |
4973 } | 4973 } |
4974 | 4974 |
4975 /* | 4975 /* |
5070 } | 5070 } |
5071 | 5071 |
5072 /* Internal function to return a pointer to an item struct | 5072 /* Internal function to return a pointer to an item struct |
5073 * with information about the packing information regarding object. | 5073 * with information about the packing information regarding object. |
5074 */ | 5074 */ |
5075 Item *_box_item(HWND handle) | 5075 Item *_dw_box_item(HWND handle) |
5076 { | 5076 { |
5077 HWND parent = WinQueryWindow(handle, QW_PARENT); | 5077 HWND parent = WinQueryWindow(handle, QW_PARENT); |
5078 Box *thisbox = (Box *)WinQueryWindowPtr(parent, QWP_USER); | 5078 Box *thisbox = (Box *)WinQueryWindowPtr(parent, QWP_USER); |
5079 | 5079 |
5080 /* If it is a desktop window let WM_DESTROY handle it */ | 5080 /* If it is a desktop window let WM_DESTROY handle it */ |
5104 * Spinbutton: 50x(maxfontheight) | 5104 * Spinbutton: 50x(maxfontheight) |
5105 * Text/Status: (textwidth)x(textheight) | 5105 * Text/Status: (textwidth)x(textheight) |
5106 * Ranged: 100x14 or 14x100 for vertical. | 5106 * Ranged: 100x14 or 14x100 for vertical. |
5107 * Buttons/Bitmaps: Size of text or image and border. | 5107 * Buttons/Bitmaps: Size of text or image and border. |
5108 */ | 5108 */ |
5109 void _control_size(HWND handle, int *width, int *height) | 5109 void _dw_control_size(HWND handle, int *width, int *height) |
5110 { | 5110 { |
5111 int thiswidth = 1, thisheight = 1, extrawidth = 0, extraheight = 0; | 5111 int thiswidth = 1, thisheight = 1, extrawidth = 0, extraheight = 0; |
5112 char tmpbuf[100] = {0}, *buf = dw_window_get_text(handle); | 5112 char tmpbuf[100] = {0}, *buf = dw_window_get_text(handle); |
5113 static char testtext[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | 5113 static char testtext[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
5114 | 5114 |
5505 | 5505 |
5506 /* If we changed the font... */ | 5506 /* If we changed the font... */ |
5507 if((!font && WinRemovePresParam(group ? group : handle, PP_FONTNAMESIZE)) || | 5507 if((!font && WinRemovePresParam(group ? group : handle, PP_FONTNAMESIZE)) || |
5508 (font && WinSetPresParam(group ? group : handle, PP_FONTNAMESIZE, strlen(font)+1, (void *)font))) | 5508 (font && WinSetPresParam(group ? group : handle, PP_FONTNAMESIZE, strlen(font)+1, (void *)font))) |
5509 { | 5509 { |
5510 Item *item = _box_item(handle); | 5510 Item *item = _dw_box_item(handle); |
5511 | 5511 |
5512 /* Check to see if any of the sizes need to be recalculated */ | 5512 /* Check to see if any of the sizes need to be recalculated */ |
5513 if(item && (item->origwidth == -1 || item->origheight == -1)) | 5513 if(item && (item->origwidth == -1 || item->origheight == -1)) |
5514 { | 5514 { |
5515 _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); | 5515 _dw_control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); |
5516 /* Queue a redraw on the top-level window */ | 5516 /* Queue a redraw on the top-level window */ |
5517 _dw_redraw(_toplevel_window(handle), TRUE); | 5517 _dw_redraw(_dw_toplevel_window(handle), TRUE); |
5518 } | 5518 } |
5519 return DW_ERROR_NONE; | 5519 return DW_ERROR_NONE; |
5520 } | 5520 } |
5521 return DW_ERROR_UNKNOWN; | 5521 return DW_ERROR_UNKNOWN; |
5522 } | 5522 } |
5535 return strdup(str); | 5535 return strdup(str); |
5536 return NULL; | 5536 return NULL; |
5537 } | 5537 } |
5538 | 5538 |
5539 /* Internal function to handle transparent children */ | 5539 /* Internal function to handle transparent children */ |
5540 void _handle_transparent(HWND handle) | 5540 void _dw_handle_transparent(HWND handle) |
5541 { | 5541 { |
5542 ULONG pcolor, which = PP_BACKGROUNDCOLOR;; | 5542 ULONG pcolor, which = PP_BACKGROUNDCOLOR;; |
5543 | 5543 |
5544 | 5544 |
5545 if(!WinQueryPresParam(handle, which, 0, NULL, sizeof(pcolor), &pcolor, QPF_NOINHERIT)) | 5545 if(!WinQueryPresParam(handle, which, 0, NULL, sizeof(pcolor), &pcolor, QPF_NOINHERIT)) |
5578 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2); | 5578 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2); |
5579 | 5579 |
5580 } | 5580 } |
5581 else if(fore != DW_CLR_DEFAULT) | 5581 else if(fore != DW_CLR_DEFAULT) |
5582 { | 5582 { |
5583 fore = _internal_color(fore); | 5583 fore = _dw_internal_color(fore); |
5584 | 5584 |
5585 WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore); | 5585 WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore); |
5586 } | 5586 } |
5587 else if(fore == DW_CLR_DEFAULT) | 5587 else if(fore == DW_CLR_DEFAULT) |
5588 { | 5588 { |
5617 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2); | 5617 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2); |
5618 dw_window_set_data(handle, "_dw_transparent", NULL); | 5618 dw_window_set_data(handle, "_dw_transparent", NULL); |
5619 } | 5619 } |
5620 else if(back != DW_CLR_DEFAULT) | 5620 else if(back != DW_CLR_DEFAULT) |
5621 { | 5621 { |
5622 back = _internal_color(back); | 5622 back = _dw_internal_color(back); |
5623 | 5623 |
5624 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back); | 5624 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back); |
5625 dw_window_set_data(handle, "_dw_transparent", NULL); | 5625 dw_window_set_data(handle, "_dw_transparent", NULL); |
5626 } | 5626 } |
5627 else if(back == DW_CLR_DEFAULT) | 5627 else if(back == DW_CLR_DEFAULT) |
5628 { | 5628 { |
5629 WinRemovePresParam(handle, PP_BACKGROUNDCOLOR); | 5629 WinRemovePresParam(handle, PP_BACKGROUNDCOLOR); |
5630 WinRemovePresParam(handle, PP_BACKGROUNDCOLORINDEX); | 5630 WinRemovePresParam(handle, PP_BACKGROUNDCOLORINDEX); |
5631 } | 5631 } |
5632 /* If this is a box... check if any of the children are transparent */ | 5632 /* If this is a box... check if any of the children are transparent */ |
5633 _handle_transparent(handle); | 5633 _dw_handle_transparent(handle); |
5634 return DW_ERROR_NONE; | 5634 return DW_ERROR_NONE; |
5635 } | 5635 } |
5636 /* | 5636 /* |
5637 * Sets the colors used by a specified window (widget) handle. | 5637 * Sets the colors used by a specified window (widget) handle. |
5638 * Parameters: | 5638 * Parameters: |
5752 /* Default the window to a ridiculus place so it can't possibly be intentional */ | 5752 /* Default the window to a ridiculus place so it can't possibly be intentional */ |
5753 WinSetWindowPos(hwndframe, NULLHANDLE, -2000, -2000, 0, 0, SWP_MOVE); | 5753 WinSetWindowPos(hwndframe, NULLHANDLE, -2000, -2000, 0, 0, SWP_MOVE); |
5754 newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR); | 5754 newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR); |
5755 if(!newbox->titlebar && newbox->hwndtitle) | 5755 if(!newbox->titlebar && newbox->hwndtitle) |
5756 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE); | 5756 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE); |
5757 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc); | 5757 blah->oldproc = WinSubclassWindow(hwndframe, _dw_sizeproc); |
5758 WinSetWindowPtr(hwndframe, QWP_USER, blah); | 5758 WinSetWindowPtr(hwndframe, QWP_USER, blah); |
5759 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox); | 5759 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox); |
5760 return hwndframe; | 5760 return hwndframe; |
5761 } | 5761 } |
5762 | 5762 |
5785 HWND_TOP, | 5785 HWND_TOP, |
5786 0L, | 5786 0L, |
5787 NULL, | 5787 NULL, |
5788 NULL); | 5788 NULL); |
5789 | 5789 |
5790 newbox->oldproc = WinSubclassWindow(newbox->hwnd, _controlproc); | 5790 newbox->oldproc = WinSubclassWindow(newbox->hwnd, _dw_controlproc); |
5791 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox); | 5791 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox); |
5792 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | 5792 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); |
5793 return newbox->hwnd; | 5793 return newbox->hwnd; |
5794 } | 5794 } |
5795 | 5795 |
5952 NULLHANDLE, | 5952 NULLHANDLE, |
5953 HWND_TOP, | 5953 HWND_TOP, |
5954 id, | 5954 id, |
5955 NULL, | 5955 NULL, |
5956 NULL); | 5956 NULL); |
5957 blah->oldproc = WinSubclassWindow(tmp, _BitmapProc); | 5957 blah->oldproc = WinSubclassWindow(tmp, _dw_bitmapproc); |
5958 WinSetWindowPtr(tmp, QWP_USER, blah); | 5958 WinSetWindowPtr(tmp, QWP_USER, blah); |
5959 return tmp; | 5959 return tmp; |
5960 } | 5960 } |
5961 | 5961 |
5962 /* | 5962 /* |
5996 { | 5996 { |
5997 /* best sizes to be determined by trial and error */ | 5997 /* best sizes to be determined by trial and error */ |
5998 WinSendMsg(tmp, BKM_SETDIMENSIONS,MPFROM2SHORT(102, 28), MPFROMSHORT( BKA_MAJORTAB)); | 5998 WinSendMsg(tmp, BKM_SETDIMENSIONS,MPFROM2SHORT(102, 28), MPFROMSHORT( BKA_MAJORTAB)); |
5999 } | 5999 } |
6000 | 6000 |
6001 blah->oldproc = WinSubclassWindow(tmp, _NotebookProc); | 6001 blah->oldproc = WinSubclassWindow(tmp, _dw_notebookproc); |
6002 WinSetWindowPtr(tmp, QWP_USER, blah); | 6002 WinSetWindowPtr(tmp, QWP_USER, blah); |
6003 dw_window_set_font(tmp, DefaultFont); | 6003 dw_window_set_font(tmp, DefaultFont); |
6004 return tmp; | 6004 return tmp; |
6005 } | 6005 } |
6006 | 6006 |
6060 *menu = 0; | 6060 *menu = 0; |
6061 } | 6061 } |
6062 } | 6062 } |
6063 | 6063 |
6064 /* Internal function to make sure menu ID isn't in use */ | 6064 /* Internal function to make sure menu ID isn't in use */ |
6065 int _menuid_allocated(int id) | 6065 int _dw_menuid_allocated(int id) |
6066 { | 6066 { |
6067 SignalHandler *tmp = Root; | 6067 SignalHandler *tmp = Root; |
6068 | 6068 |
6069 while(tmp) | 6069 while(tmp) |
6070 { | 6070 { |
6140 { | 6140 { |
6141 menuid++; | 6141 menuid++; |
6142 if(menuid > 60000) | 6142 if(menuid > 60000) |
6143 menuid = 30000; | 6143 menuid = 30000; |
6144 } | 6144 } |
6145 while(_menuid_allocated(menuid)); | 6145 while(_dw_menuid_allocated(menuid)); |
6146 id = menuid; | 6146 id = menuid; |
6147 } | 6147 } |
6148 miSubMenu.afStyle = MIS_TEXT; | 6148 miSubMenu.afStyle = MIS_TEXT; |
6149 } | 6149 } |
6150 else | 6150 else |
6346 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) | | 6346 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) | |
6347 CCS_AUTOPOSITION, | 6347 CCS_AUTOPOSITION, |
6348 0,0,0,0, | 6348 0,0,0,0, |
6349 NULLHANDLE, | 6349 NULLHANDLE, |
6350 HWND_TOP, | 6350 HWND_TOP, |
6351 id ? id : _GlobalID(), | 6351 id ? id : _dw_global_id(), |
6352 NULL, | 6352 NULL, |
6353 NULL); | 6353 NULL); |
6354 blah->oldproc = WinSubclassWindow(tmp, _TreeProc); | 6354 blah->oldproc = WinSubclassWindow(tmp, _dw_treeproc); |
6355 WinSetWindowPtr(tmp, QWP_USER, blah); | 6355 WinSetWindowPtr(tmp, QWP_USER, blah); |
6356 dw_window_set_font(tmp, DefaultFont); | 6356 dw_window_set_font(tmp, DefaultFont); |
6357 dw_window_set_data(tmp, "_dw_container", (void *)1); | 6357 dw_window_set_data(tmp, "_dw_container", (void *)1); |
6358 return tmp; | 6358 return tmp; |
6359 } | 6359 } |
6374 WS_VISIBLE | CCS_READONLY | | 6374 WS_VISIBLE | CCS_READONLY | |
6375 CCS_SINGLESEL | CCS_AUTOPOSITION, | 6375 CCS_SINGLESEL | CCS_AUTOPOSITION, |
6376 0,0,2000,1000, | 6376 0,0,2000,1000, |
6377 NULLHANDLE, | 6377 NULLHANDLE, |
6378 HWND_TOP, | 6378 HWND_TOP, |
6379 id ? id : _GlobalID(), | 6379 id ? id : _dw_global_id(), |
6380 NULL, | 6380 NULL, |
6381 NULL); | 6381 NULL); |
6382 | 6382 |
6383 cnrinfo.flWindowAttr = CV_TREE | CA_TREELINE; | 6383 cnrinfo.flWindowAttr = CV_TREE | CA_TREELINE; |
6384 cnrinfo.slBitmapOrIcon.cx = 16; | 6384 cnrinfo.slBitmapOrIcon.cx = 16; |
6387 cnrinfo.cxTreeIndent = 16; | 6387 cnrinfo.cxTreeIndent = 16; |
6388 cnrinfo.cxTreeLine = 1; | 6388 cnrinfo.cxTreeLine = 1; |
6389 | 6389 |
6390 WinSendMsg(tmp, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON | | 6390 WinSendMsg(tmp, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON | |
6391 CMA_LINESPACING | CMA_CXTREEINDENT | CMA_CXTREELINE)); | 6391 CMA_LINESPACING | CMA_CXTREEINDENT | CMA_CXTREELINE)); |
6392 blah->oldproc = WinSubclassWindow(tmp, _TreeProc); | 6392 blah->oldproc = WinSubclassWindow(tmp, _dw_treeproc); |
6393 WinSetWindowPtr(tmp, QWP_USER, blah); | 6393 WinSetWindowPtr(tmp, QWP_USER, blah); |
6394 dw_window_set_font(tmp, DefaultFont); | 6394 dw_window_set_font(tmp, DefaultFont); |
6395 return tmp; | 6395 return tmp; |
6396 } | 6396 } |
6397 | 6397 |
6412 NULLHANDLE, | 6412 NULLHANDLE, |
6413 HWND_TOP, | 6413 HWND_TOP, |
6414 id, | 6414 id, |
6415 NULL, | 6415 NULL, |
6416 NULL); | 6416 NULL); |
6417 blah->oldproc = WinSubclassWindow(tmp, _textproc); | 6417 blah->oldproc = WinSubclassWindow(tmp, _dw_textproc); |
6418 WinSetWindowPtr(tmp, QWP_USER, blah); | 6418 WinSetWindowPtr(tmp, QWP_USER, blah); |
6419 dw_window_set_font(tmp, DefaultFont); | 6419 dw_window_set_font(tmp, DefaultFont); |
6420 dw_window_set_color(tmp, DW_CLR_BLACK, DW_RGB_TRANSPARENT); | 6420 dw_window_set_color(tmp, DW_CLR_BLACK, DW_RGB_TRANSPARENT); |
6421 return tmp; | 6421 return tmp; |
6422 } | 6422 } |
6438 NULLHANDLE, | 6438 NULLHANDLE, |
6439 HWND_TOP, | 6439 HWND_TOP, |
6440 id, | 6440 id, |
6441 NULL, | 6441 NULL, |
6442 NULL); | 6442 NULL); |
6443 blah->oldproc = WinSubclassWindow(tmp, _statusproc); | 6443 blah->oldproc = WinSubclassWindow(tmp, _dw_statusproc); |
6444 WinSetWindowPtr(tmp, QWP_USER, blah); | 6444 WinSetWindowPtr(tmp, QWP_USER, blah); |
6445 dw_window_set_font(tmp, DefaultFont); | 6445 dw_window_set_font(tmp, DefaultFont); |
6446 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | 6446 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
6447 dw_window_set_data(tmp, "_dw_status", DW_INT_TO_POINTER(1)); | 6447 dw_window_set_data(tmp, "_dw_status", DW_INT_TO_POINTER(1)); |
6448 return tmp; | 6448 return tmp; |
6471 HWND_TOP, | 6471 HWND_TOP, |
6472 id, | 6472 id, |
6473 NULL, | 6473 NULL, |
6474 NULL); | 6474 NULL); |
6475 WinSendMsg(tmp, MLM_FORMAT, (MPARAM)MLFIE_NOTRANS, 0); | 6475 WinSendMsg(tmp, MLM_FORMAT, (MPARAM)MLFIE_NOTRANS, 0); |
6476 blah->oldproc = WinSubclassWindow(tmp, _mleproc); | 6476 blah->oldproc = WinSubclassWindow(tmp, _dw_mleproc); |
6477 WinSetWindowPtr(tmp, QWP_USER, blah); | 6477 WinSetWindowPtr(tmp, QWP_USER, blah); |
6478 dw_window_set_font(tmp, DefaultFont); | 6478 dw_window_set_font(tmp, DefaultFont); |
6479 return tmp; | 6479 return tmp; |
6480 } | 6480 } |
6481 | 6481 |
6499 NULLHANDLE, | 6499 NULLHANDLE, |
6500 HWND_TOP, | 6500 HWND_TOP, |
6501 id, | 6501 id, |
6502 (PVOID)&efd, | 6502 (PVOID)&efd, |
6503 NULL); | 6503 NULL); |
6504 blah->oldproc = WinSubclassWindow(tmp, _entryproc); | 6504 blah->oldproc = WinSubclassWindow(tmp, _dw_entryproc); |
6505 WinSetWindowPtr(tmp, QWP_USER, blah); | 6505 WinSetWindowPtr(tmp, QWP_USER, blah); |
6506 dw_window_set_font(tmp, DefaultFont); | 6506 dw_window_set_font(tmp, DefaultFont); |
6507 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); | 6507 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
6508 return tmp; | 6508 return tmp; |
6509 } | 6509 } |
6526 NULLHANDLE, | 6526 NULLHANDLE, |
6527 HWND_TOP, | 6527 HWND_TOP, |
6528 id, | 6528 id, |
6529 NULL, | 6529 NULL, |
6530 NULL); | 6530 NULL); |
6531 blah->oldproc = WinSubclassWindow(tmp, _entryproc); | 6531 blah->oldproc = WinSubclassWindow(tmp, _dw_entryproc); |
6532 WinSetWindowPtr(tmp, QWP_USER, blah); | 6532 WinSetWindowPtr(tmp, QWP_USER, blah); |
6533 dw_window_set_font(tmp, DefaultFont); | 6533 dw_window_set_font(tmp, DefaultFont); |
6534 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); | 6534 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
6535 return tmp; | 6535 return tmp; |
6536 } | 6536 } |
6550 (PSZ)text, | 6550 (PSZ)text, |
6551 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP, | 6551 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP, |
6552 0,0,2000,1000, | 6552 0,0,2000,1000, |
6553 NULLHANDLE, | 6553 NULLHANDLE, |
6554 HWND_TOP, | 6554 HWND_TOP, |
6555 id ? id : _GlobalID(), | 6555 id ? id : _dw_global_id(), |
6556 NULL, | 6556 NULL, |
6557 NULL); | 6557 NULL); |
6558 HENUM henum = WinBeginEnumWindows(tmp); | 6558 HENUM henum = WinBeginEnumWindows(tmp); |
6559 HWND child, last = NULLHANDLE; | 6559 HWND child, last = NULLHANDLE; |
6560 | 6560 |
6561 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | 6561 while((child = WinGetNextWindow(henum)) != NULLHANDLE) |
6562 { | 6562 { |
6563 WindowData *moreblah = calloc(1, sizeof(WindowData)); | 6563 WindowData *moreblah = calloc(1, sizeof(WindowData)); |
6564 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc); | 6564 moreblah->oldproc = WinSubclassWindow(child, _dw_comboentryproc); |
6565 WinSetWindowPtr(child, QWP_USER, moreblah); | 6565 WinSetWindowPtr(child, QWP_USER, moreblah); |
6566 dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE); | 6566 dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE); |
6567 last = child; | 6567 last = child; |
6568 } | 6568 } |
6569 WinEndEnumWindows(henum); | 6569 WinEndEnumWindows(henum); |
6570 blah->oldproc = WinSubclassWindow(tmp, _comboproc); | 6570 blah->oldproc = WinSubclassWindow(tmp, _dw_comboproc); |
6571 WinSetWindowPtr(tmp, QWP_USER, blah); | 6571 WinSetWindowPtr(tmp, QWP_USER, blah); |
6572 dw_window_set_font(tmp, DefaultFont); | 6572 dw_window_set_font(tmp, DefaultFont); |
6573 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); | 6573 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
6574 dw_window_set_data(tmp, "_dw_comboentry", (void *)last); | 6574 dw_window_set_data(tmp, "_dw_comboentry", (void *)last); |
6575 dw_window_set_data(tmp, "_dw_combo_box", (void *)frame); | 6575 dw_window_set_data(tmp, "_dw_combo_box", (void *)frame); |
6595 HWND_TOP, | 6595 HWND_TOP, |
6596 id, | 6596 id, |
6597 NULL, | 6597 NULL, |
6598 NULL); | 6598 NULL); |
6599 | 6599 |
6600 blah->oldproc = WinSubclassWindow(tmp, _BtProc); | 6600 blah->oldproc = WinSubclassWindow(tmp, _dw_buttonproc); |
6601 | 6601 |
6602 WinSetWindowPtr(tmp, QWP_USER, blah); | 6602 WinSetWindowPtr(tmp, QWP_USER, blah); |
6603 dw_window_set_font(tmp, DefaultFont); | 6603 dw_window_set_font(tmp, DefaultFont); |
6604 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | 6604 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
6605 return tmp; | 6605 return tmp; |
6608 /* Function: GenResIDStr | 6608 /* Function: GenResIDStr |
6609 ** Abstract: Generate string '#nnnn' for a given ID for using with Button | 6609 ** Abstract: Generate string '#nnnn' for a given ID for using with Button |
6610 ** controls | 6610 ** controls |
6611 */ | 6611 */ |
6612 | 6612 |
6613 void _GenResIDStr(CHAR *buff, ULONG ulID) | 6613 void _dw_gen_res_id_str(CHAR *buff, ULONG ulID) |
6614 { | 6614 { |
6615 char *str; | 6615 char *str; |
6616 int slen = 0; | 6616 int slen = 0; |
6617 | 6617 |
6618 *buff++ = '#'; | 6618 *buff++ = '#'; |
6652 HPOINTER icon = WinLoadPointer(HWND_DESKTOP, 0L, id); | 6652 HPOINTER icon = WinLoadPointer(HWND_DESKTOP, 0L, id); |
6653 | 6653 |
6654 if(!icon) | 6654 if(!icon) |
6655 { | 6655 { |
6656 name = idbuf; | 6656 name = idbuf; |
6657 _GenResIDStr(idbuf, id); | 6657 _dw_gen_res_id_str(idbuf, id); |
6658 } | 6658 } |
6659 | 6659 |
6660 tmp = WinCreateWindow(HWND_OBJECT, | 6660 tmp = WinCreateWindow(HWND_OBJECT, |
6661 WC_BUTTON, | 6661 WC_BUTTON, |
6662 (PSZ)name, | 6662 (PSZ)name, |
6670 NULL, | 6670 NULL, |
6671 NULL); | 6671 NULL); |
6672 | 6672 |
6673 if(text) | 6673 if(text) |
6674 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); | 6674 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); |
6675 blah->oldproc = WinSubclassWindow(tmp, _BtProc); | 6675 blah->oldproc = WinSubclassWindow(tmp, _dw_buttonproc); |
6676 | 6676 |
6677 WinSetWindowPtr(tmp, QWP_USER, blah); | 6677 WinSetWindowPtr(tmp, QWP_USER, blah); |
6678 | 6678 |
6679 if(icon) | 6679 if(icon) |
6680 { | 6680 { |
6711 dw_window_set_data(tmp, "_dw_bitmapbutton", DW_INT_TO_POINTER(1)); | 6711 dw_window_set_data(tmp, "_dw_bitmapbutton", DW_INT_TO_POINTER(1)); |
6712 return tmp; | 6712 return tmp; |
6713 } | 6713 } |
6714 | 6714 |
6715 /* Internal function to create a disabled version of a pixmap */ | 6715 /* Internal function to create a disabled version of a pixmap */ |
6716 HPIXMAP _create_disabled(HWND handle, HPIXMAP pixmap) | 6716 HPIXMAP _dw_create_disabled(HWND handle, HPIXMAP pixmap) |
6717 { | 6717 { |
6718 /* Create a disabled style pixmap */ | 6718 /* Create a disabled style pixmap */ |
6719 HPIXMAP disabled = dw_pixmap_new(handle, pixmap->width, pixmap->height, dw_color_depth_get()); | 6719 HPIXMAP disabled = dw_pixmap_new(handle, pixmap->width, pixmap->height, dw_color_depth_get()); |
6720 LONG fore = _foreground; | 6720 LONG fore = _foreground; |
6721 int z, j, lim; | 6721 int z, j, lim; |
6775 if(len > 4) | 6775 if(len > 4) |
6776 { | 6776 { |
6777 if(stricmp(file + len - 4, ".ico") == 0) | 6777 if(stricmp(file + len - 4, ".ico") == 0) |
6778 icon = WinLoadFileIcon((PSZ)file, FALSE); | 6778 icon = WinLoadFileIcon((PSZ)file, FALSE); |
6779 else | 6779 else |
6780 _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT); | 6780 _dw_load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT); |
6781 } | 6781 } |
6782 } | 6782 } |
6783 else | 6783 else |
6784 { | 6784 { |
6785 /* Try with .ico extension first...*/ | 6785 /* Try with .ico extension first...*/ |
6791 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) | 6791 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) |
6792 { | 6792 { |
6793 strcpy(file, filename); | 6793 strcpy(file, filename); |
6794 strcat(file, image_exts[z]); | 6794 strcat(file, image_exts[z]); |
6795 if(access(file, 04) == 0 && | 6795 if(access(file, 04) == 0 && |
6796 _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) | 6796 _dw_load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) |
6797 break; | 6797 break; |
6798 } | 6798 } |
6799 } | 6799 } |
6800 } | 6800 } |
6801 | 6801 |
6804 free(pixmap); | 6804 free(pixmap); |
6805 pixmap = NULL; | 6805 pixmap = NULL; |
6806 } | 6806 } |
6807 else | 6807 else |
6808 { | 6808 { |
6809 disabled = _create_disabled(tmp, pixmap); | 6809 disabled = _dw_create_disabled(tmp, pixmap); |
6810 } | 6810 } |
6811 } | 6811 } |
6812 | 6812 |
6813 if(text) | 6813 if(text) |
6814 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); | 6814 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); |
6815 blah->oldproc = WinSubclassWindow(tmp, _BtProc); | 6815 blah->oldproc = WinSubclassWindow(tmp, _dw_buttonproc); |
6816 | 6816 |
6817 WinSetWindowPtr(tmp, QWP_USER, blah); | 6817 WinSetWindowPtr(tmp, QWP_USER, blah); |
6818 | 6818 |
6819 if(icon) | 6819 if(icon) |
6820 dw_window_set_data(tmp, "_dw_button_icon", (void *)icon); | 6820 dw_window_set_data(tmp, "_dw_button_icon", (void *)icon); |
6863 fp = fopen( file, "wb" ); | 6863 fp = fopen( file, "wb" ); |
6864 if ( fp != NULL ) | 6864 if ( fp != NULL ) |
6865 { | 6865 { |
6866 fwrite( data, 1, len, fp ); | 6866 fwrite( data, 1, len, fp ); |
6867 fclose( fp ); | 6867 fclose( fp ); |
6868 if(!_load_bitmap_file( file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) | 6868 if(!_dw_load_bitmap_file( file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) |
6869 { | 6869 { |
6870 icon = WinLoadFileIcon((PSZ)file, FALSE); | 6870 icon = WinLoadFileIcon((PSZ)file, FALSE); |
6871 } | 6871 } |
6872 } | 6872 } |
6873 else | 6873 else |
6883 free(pixmap); | 6883 free(pixmap); |
6884 pixmap = NULL; | 6884 pixmap = NULL; |
6885 } | 6885 } |
6886 else | 6886 else |
6887 { | 6887 { |
6888 disabled = _create_disabled(tmp, pixmap); | 6888 disabled = _dw_create_disabled(tmp, pixmap); |
6889 } | 6889 } |
6890 } | 6890 } |
6891 | 6891 |
6892 if(text) | 6892 if(text) |
6893 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); | 6893 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); |
6894 blah->oldproc = WinSubclassWindow(tmp, _BtProc); | 6894 blah->oldproc = WinSubclassWindow(tmp, _dw_buttonproc); |
6895 | 6895 |
6896 WinSetWindowPtr(tmp, QWP_USER, blah); | 6896 WinSetWindowPtr(tmp, QWP_USER, blah); |
6897 | 6897 |
6898 if(icon) | 6898 if(icon) |
6899 dw_window_set_data(tmp, "_dw_button_icon", (void *)icon); | 6899 dw_window_set_data(tmp, "_dw_button_icon", (void *)icon); |
6923 NULLHANDLE, | 6923 NULLHANDLE, |
6924 HWND_TOP, | 6924 HWND_TOP, |
6925 id, | 6925 id, |
6926 NULL, | 6926 NULL, |
6927 NULL); | 6927 NULL); |
6928 HWND entry = _find_entryfield(tmp); | 6928 HWND entry = _dw_find_entryfield(tmp); |
6929 WinSendMsg(tmp, SPBM_SETLIMITS, MPFROMLONG(65536), MPFROMLONG(-65536)); | 6929 WinSendMsg(tmp, SPBM_SETLIMITS, MPFROMLONG(65536), MPFROMLONG(-65536)); |
6930 WinSendMsg(tmp, SPBM_SETCURRENTVALUE, MPFROMLONG(atoi(text)), 0L); | 6930 WinSendMsg(tmp, SPBM_SETCURRENTVALUE, MPFROMLONG(atoi(text)), 0L); |
6931 blah->oldproc = WinSubclassWindow(tmp, _entryproc); | 6931 blah->oldproc = WinSubclassWindow(tmp, _dw_entryproc); |
6932 WinSetWindowPtr(tmp, QWP_USER, blah); | 6932 WinSetWindowPtr(tmp, QWP_USER, blah); |
6933 blah = calloc(sizeof(WindowData), 1); | 6933 blah = calloc(sizeof(WindowData), 1); |
6934 blah->oldproc = WinSubclassWindow(entry, _spinentryproc); | 6934 blah->oldproc = WinSubclassWindow(entry, _dw_spinentryproc); |
6935 WinSetWindowPtr(entry, QWP_USER, blah); | 6935 WinSetWindowPtr(entry, QWP_USER, blah); |
6936 dw_window_set_font(tmp, DefaultFont); | 6936 dw_window_set_font(tmp, DefaultFont); |
6937 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE); | 6937 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE); |
6938 dw_window_set_data(tmp, "_dw_buddy", (void *)entry); | 6938 dw_window_set_data(tmp, "_dw_buddy", (void *)entry); |
6939 return tmp; | 6939 return tmp; |
6957 NULLHANDLE, | 6957 NULLHANDLE, |
6958 HWND_TOP, | 6958 HWND_TOP, |
6959 id, | 6959 id, |
6960 NULL, | 6960 NULL, |
6961 NULL); | 6961 NULL); |
6962 blah->oldproc = WinSubclassWindow(tmp, _entryproc); | 6962 blah->oldproc = WinSubclassWindow(tmp, _dw_entryproc); |
6963 WinSetWindowPtr(tmp, QWP_USER, blah); | 6963 WinSetWindowPtr(tmp, QWP_USER, blah); |
6964 dw_window_set_font(tmp, DefaultFont); | 6964 dw_window_set_font(tmp, DefaultFont); |
6965 dw_window_set_color(tmp, DW_CLR_BLACK, DW_RGB_TRANSPARENT); | 6965 dw_window_set_color(tmp, DW_CLR_BLACK, DW_RGB_TRANSPARENT); |
6966 return tmp; | 6966 return tmp; |
6967 } | 6967 } |
6989 WS_VISIBLE | SLS_SNAPTOINCREMENT | | 6989 WS_VISIBLE | SLS_SNAPTOINCREMENT | |
6990 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL), | 6990 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL), |
6991 0,0,2000,1000, | 6991 0,0,2000,1000, |
6992 NULLHANDLE, | 6992 NULLHANDLE, |
6993 HWND_TOP, | 6993 HWND_TOP, |
6994 id ? id : _GlobalID(), | 6994 id ? id : _dw_global_id(), |
6995 &sldcData, | 6995 &sldcData, |
6996 NULL); | 6996 NULL); |
6997 | 6997 |
6998 blah->oldproc = WinSubclassWindow(tmp, _entryproc); | 6998 blah->oldproc = WinSubclassWindow(tmp, _dw_entryproc); |
6999 WinSetWindowPtr(tmp, QWP_USER, blah); | 6999 WinSetWindowPtr(tmp, QWP_USER, blah); |
7000 return tmp; | 7000 return tmp; |
7001 } | 7001 } |
7002 | 7002 |
7003 /* | 7003 /* |
7015 WS_VISIBLE | SBS_AUTOTRACK | | 7015 WS_VISIBLE | SBS_AUTOTRACK | |
7016 (vertical ? SBS_VERT : SBS_HORZ), | 7016 (vertical ? SBS_VERT : SBS_HORZ), |
7017 0,0,2000,1000, | 7017 0,0,2000,1000, |
7018 NULLHANDLE, | 7018 NULLHANDLE, |
7019 HWND_TOP, | 7019 HWND_TOP, |
7020 id ? id : _GlobalID(), | 7020 id ? id : _dw_global_id(), |
7021 NULL, | 7021 NULL, |
7022 NULL); | 7022 NULL); |
7023 } | 7023 } |
7024 | 7024 |
7025 /* | 7025 /* |
7036 WS_VISIBLE | SLS_READONLY | 7036 WS_VISIBLE | SLS_READONLY |
7037 | SLS_RIBBONSTRIP, | 7037 | SLS_RIBBONSTRIP, |
7038 0,0,2000,1000, | 7038 0,0,2000,1000, |
7039 NULLHANDLE, | 7039 NULLHANDLE, |
7040 HWND_TOP, | 7040 HWND_TOP, |
7041 id ? id : _GlobalID(), | 7041 id ? id : _dw_global_id(), |
7042 NULL, | 7042 NULL, |
7043 NULL); | 7043 NULL); |
7044 blah->oldproc = WinSubclassWindow(tmp, _percentproc); | 7044 blah->oldproc = WinSubclassWindow(tmp, _dw_percentproc); |
7045 WinSetWindowPtr(tmp, QWP_USER, blah); | 7045 WinSetWindowPtr(tmp, QWP_USER, blah); |
7046 dw_window_disable(tmp); | 7046 dw_window_disable(tmp); |
7047 return tmp; | 7047 return tmp; |
7048 } | 7048 } |
7049 | 7049 |
7064 NULLHANDLE, | 7064 NULLHANDLE, |
7065 HWND_TOP, | 7065 HWND_TOP, |
7066 id, | 7066 id, |
7067 NULL, | 7067 NULL, |
7068 NULL); | 7068 NULL); |
7069 blah->oldproc = WinSubclassWindow(tmp, _BtProc); | 7069 blah->oldproc = WinSubclassWindow(tmp, _dw_buttonproc); |
7070 WinSetWindowPtr(tmp, QWP_USER, blah); | 7070 WinSetWindowPtr(tmp, QWP_USER, blah); |
7071 dw_window_set_font(tmp, DefaultFont); | 7071 dw_window_set_font(tmp, DefaultFont); |
7072 dw_window_set_color(tmp, DW_CLR_BLACK, DW_RGB_TRANSPARENT); | 7072 dw_window_set_color(tmp, DW_CLR_BLACK, DW_RGB_TRANSPARENT); |
7073 return tmp; | 7073 return tmp; |
7074 } | 7074 } |
7088 WS_VISIBLE | LS_NOADJUSTPOS | | 7088 WS_VISIBLE | LS_NOADJUSTPOS | |
7089 (multi ? LS_MULTIPLESEL : 0), | 7089 (multi ? LS_MULTIPLESEL : 0), |
7090 0,0,2000,1000, | 7090 0,0,2000,1000, |
7091 NULLHANDLE, | 7091 NULLHANDLE, |
7092 HWND_TOP, | 7092 HWND_TOP, |
7093 id ? id : _GlobalID(), | 7093 id ? id : _dw_global_id(), |
7094 NULL, | 7094 NULL, |
7095 NULL); | 7095 NULL); |
7096 blah->oldproc = WinSubclassWindow(tmp, _entryproc); | 7096 blah->oldproc = WinSubclassWindow(tmp, _dw_entryproc); |
7097 WinSetWindowPtr(tmp, QWP_USER, blah); | 7097 WinSetWindowPtr(tmp, QWP_USER, blah); |
7098 dw_window_set_font(tmp, DefaultFont); | 7098 dw_window_set_font(tmp, DefaultFont); |
7099 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); | 7099 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
7100 return tmp; | 7100 return tmp; |
7101 } | 7101 } |
7208 #define GBM_O_RDONLY 0x00000004 | 7208 #define GBM_O_RDONLY 0x00000004 |
7209 | 7209 |
7210 /* Internal function to load a bitmap from a file and return handles | 7210 /* Internal function to load a bitmap from a file and return handles |
7211 * to the bitmap, presentation space etc. | 7211 * to the bitmap, presentation space etc. |
7212 */ | 7212 */ |
7213 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height, int *depth, unsigned long backrgb) | 7213 int _dw_load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height, int *depth, unsigned long backrgb) |
7214 { | 7214 { |
7215 PBITMAPINFOHEADER2 pBitmapInfoHeader; | 7215 PBITMAPINFOHEADER2 pBitmapInfoHeader; |
7216 /* pointer to the first byte of bitmap data */ | 7216 /* pointer to the first byte of bitmap data */ |
7217 PBYTE BitmapFileBegin, BitmapBits; | 7217 PBYTE BitmapFileBegin, BitmapBits; |
7218 ULONG ulFlags; | 7218 ULONG ulFlags; |
7474 pixmap->hbm = hbm; | 7474 pixmap->hbm = hbm; |
7475 pixmap->hdc = hdc; | 7475 pixmap->hdc = hdc; |
7476 pixmap->hps = hps; | 7476 pixmap->hps = hps; |
7477 pixmap->width = width; | 7477 pixmap->width = width; |
7478 pixmap->height = height; | 7478 pixmap->height = height; |
7479 disabled = _create_disabled(handle, pixmap); | 7479 disabled = _dw_create_disabled(handle, pixmap); |
7480 | 7480 |
7481 dw_window_set_data(handle, "_dw_hpixmap", DW_POINTER(pixmap)); | 7481 dw_window_set_data(handle, "_dw_hpixmap", DW_POINTER(pixmap)); |
7482 dw_window_set_data(handle, "_dw_hpixmap_disabled", DW_POINTER(disabled)); | 7482 dw_window_set_data(handle, "_dw_hpixmap_disabled", DW_POINTER(disabled)); |
7483 } | 7483 } |
7484 dw_window_set_data(handle, "_dw_bitmapbutton", DW_POINTER(1)); | 7484 dw_window_set_data(handle, "_dw_bitmapbutton", DW_POINTER(1)); |
7487 WinInvalidateRect(handle, &rect, TRUE); | 7487 WinInvalidateRect(handle, &rect, TRUE); |
7488 } | 7488 } |
7489 | 7489 |
7490 /* If we changed the bitmap... */ | 7490 /* If we changed the bitmap... */ |
7491 { | 7491 { |
7492 Item *item = _box_item(handle); | 7492 Item *item = _dw_box_item(handle); |
7493 | 7493 |
7494 /* Check to see if any of the sizes need to be recalculated */ | 7494 /* Check to see if any of the sizes need to be recalculated */ |
7495 if(item && (item->origwidth == -1 || item->origheight == -1)) | 7495 if(item && (item->origwidth == -1 || item->origheight == -1)) |
7496 { | 7496 { |
7497 _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); | 7497 _dw_control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); |
7498 /* Queue a redraw on the top-level window */ | 7498 /* Queue a redraw on the top-level window */ |
7499 _dw_redraw(_toplevel_window(handle), TRUE); | 7499 _dw_redraw(_dw_toplevel_window(handle), TRUE); |
7500 } | 7500 } |
7501 } | 7501 } |
7502 } | 7502 } |
7503 | 7503 |
7504 /* | 7504 /* |
7519 HPOINTER icon = 0; | 7519 HPOINTER icon = 0; |
7520 unsigned long width = 0, height = 0; | 7520 unsigned long width = 0, height = 0; |
7521 int depth = 0; | 7521 int depth = 0; |
7522 | 7522 |
7523 /* Destroy any old bitmap data */ | 7523 /* Destroy any old bitmap data */ |
7524 _free_bitmap(handle); | 7524 _dw_free_bitmap(handle); |
7525 | 7525 |
7526 /* If id is non-zero use the resource */ | 7526 /* If id is non-zero use the resource */ |
7527 if ( id ) | 7527 if ( id ) |
7528 { | 7528 { |
7529 hps = WinGetPS( handle ); | 7529 hps = WinGetPS( handle ); |
7554 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) | 7554 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) |
7555 { | 7555 { |
7556 strcpy(file, filename); | 7556 strcpy(file, filename); |
7557 strcat(file, image_exts[z]); | 7557 strcat(file, image_exts[z]); |
7558 if(access(file, 04) == 0 && | 7558 if(access(file, 04) == 0 && |
7559 _load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth, DW_CLR_DEFAULT)) | 7559 _dw_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth, DW_CLR_DEFAULT)) |
7560 break; | 7560 break; |
7561 } | 7561 } |
7562 } | 7562 } |
7563 } | 7563 } |
7564 else | 7564 else |
7567 if(len > 4) | 7567 if(len > 4) |
7568 { | 7568 { |
7569 if(stricmp(file + len - 4, ".ico") == 0) | 7569 if(stricmp(file + len - 4, ".ico") == 0) |
7570 icon = WinLoadFileIcon((PSZ)file, FALSE); | 7570 icon = WinLoadFileIcon((PSZ)file, FALSE); |
7571 else | 7571 else |
7572 _load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth, DW_CLR_DEFAULT); | 7572 _dw_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth, DW_CLR_DEFAULT); |
7573 } | 7573 } |
7574 } | 7574 } |
7575 | 7575 |
7576 if(!hdc && !icon) | 7576 if(!hdc && !icon) |
7577 return; | 7577 return; |
7608 char *file; | 7608 char *file; |
7609 FILE *fp; | 7609 FILE *fp; |
7610 int depth; | 7610 int depth; |
7611 | 7611 |
7612 /* Destroy any old bitmap data */ | 7612 /* Destroy any old bitmap data */ |
7613 _free_bitmap(handle); | 7613 _dw_free_bitmap(handle); |
7614 | 7614 |
7615 if ( data ) | 7615 if ( data ) |
7616 { | 7616 { |
7617 file = tmpnam( NULL ); | 7617 file = tmpnam( NULL ); |
7618 if ( file != NULL ) | 7618 if ( file != NULL ) |
7620 fp = fopen( file, "wb" ); | 7620 fp = fopen( file, "wb" ); |
7621 if ( fp != NULL ) | 7621 if ( fp != NULL ) |
7622 { | 7622 { |
7623 fwrite( data, 1, len, fp ); | 7623 fwrite( data, 1, len, fp ); |
7624 fclose( fp ); | 7624 fclose( fp ); |
7625 if(!_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth, DW_CLR_DEFAULT)) | 7625 if(!_dw_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth, DW_CLR_DEFAULT)) |
7626 { | 7626 { |
7627 /* can't use ICO ? */ | 7627 /* can't use ICO ? */ |
7628 unlink( file ); | 7628 unlink( file ); |
7629 return; | 7629 return; |
7630 } | 7630 } |
7667 { | 7667 { |
7668 HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_buddy"); | 7668 HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_buddy"); |
7669 WinSetWindowText(entryfield ? entryfield : handle, (PSZ)text); | 7669 WinSetWindowText(entryfield ? entryfield : handle, (PSZ)text); |
7670 /* If we changed the text... */ | 7670 /* If we changed the text... */ |
7671 { | 7671 { |
7672 Item *item = _box_item(handle); | 7672 Item *item = _dw_box_item(handle); |
7673 | 7673 |
7674 /* Check to see if any of the sizes need to be recalculated */ | 7674 /* Check to see if any of the sizes need to be recalculated */ |
7675 if(item && (item->origwidth == -1 || item->origheight == -1)) | 7675 if(item && (item->origwidth == -1 || item->origheight == -1)) |
7676 { | 7676 { |
7677 int newwidth, newheight; | 7677 int newwidth, newheight; |
7678 | 7678 |
7679 _control_size(handle, &newwidth, &newheight); | 7679 _dw_control_size(handle, &newwidth, &newheight); |
7680 | 7680 |
7681 /* Only update the item and redraw the window if it changed */ | 7681 /* Only update the item and redraw the window if it changed */ |
7682 if((item->origwidth == -1 && item->width != newwidth) || | 7682 if((item->origwidth == -1 && item->width != newwidth) || |
7683 (item->origheight == -1 && item->height != newheight)) | 7683 (item->origheight == -1 && item->height != newheight)) |
7684 { | 7684 { |
7685 if(item->origwidth == -1) | 7685 if(item->origwidth == -1) |
7686 item->width = newwidth; | 7686 item->width = newwidth; |
7687 if(item->origheight == -1) | 7687 if(item->origheight == -1) |
7688 item->height = newheight; | 7688 item->height = newheight; |
7689 /* Queue a redraw on the top-level window */ | 7689 /* Queue a redraw on the top-level window */ |
7690 _dw_redraw(_toplevel_window(handle), TRUE); | 7690 _dw_redraw(_dw_toplevel_window(handle), TRUE); |
7691 } | 7691 } |
7692 } | 7692 } |
7693 } | 7693 } |
7694 } | 7694 } |
7695 | 7695 |
7769 case 2: | 7769 case 2: |
7770 case 6: | 7770 case 6: |
7771 case 10: | 7771 case 10: |
7772 case 32: | 7772 case 32: |
7773 case 7: | 7773 case 7: |
7774 hwnd = _find_entryfield(handle); | 7774 hwnd = _dw_find_entryfield(handle); |
7775 _dw_window_set_color(hwnd ? hwnd : handle, DW_CLR_BLACK, DW_CLR_PALEGRAY); | 7775 _dw_window_set_color(hwnd ? hwnd : handle, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
7776 dw_signal_connect(hwnd ? hwnd : handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); | 7776 dw_signal_connect(hwnd ? hwnd : handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_dw_null_key), (void *)100); |
7777 if(val == 2) | 7777 if(val == 2) |
7778 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); | 7778 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_dw_null_key), (void *)100); |
7779 if(hwnd) | 7779 if(hwnd) |
7780 dw_window_set_data(hwnd, "_dw_disabled", (void *)1); | 7780 dw_window_set_data(hwnd, "_dw_disabled", (void *)1); |
7781 return; | 7781 return; |
7782 case 3: | 7782 case 3: |
7783 if(dw_window_get_data(handle, "_dw_bitmapbutton") && !dw_window_get_data(handle, "_dw_hpixmap")) | 7783 if(dw_window_get_data(handle, "_dw_bitmapbutton") && !dw_window_get_data(handle, "_dw_hpixmap")) |
7784 WinEnableWindow(handle, FALSE); | 7784 WinEnableWindow(handle, FALSE); |
7785 else if(dw_window_get_data(handle, "_dw_bitmapbutton") && dw_window_get_data(handle, "_dw_hpixmap_disabled")) | 7785 else if(dw_window_get_data(handle, "_dw_bitmapbutton") && dw_window_get_data(handle, "_dw_hpixmap_disabled")) |
7786 WinInvalidateRect(handle, NULL, FALSE); | 7786 WinInvalidateRect(handle, NULL, FALSE); |
7787 else | 7787 else |
7788 _dw_window_set_color(handle, DW_CLR_DARKGRAY, DW_CLR_PALEGRAY); | 7788 _dw_window_set_color(handle, DW_CLR_DARKGRAY, DW_CLR_PALEGRAY); |
7789 dw_signal_connect(handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); | 7789 dw_signal_connect(handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_dw_null_key), (void *)100); |
7790 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); | 7790 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_dw_null_key), (void *)100); |
7791 return; | 7791 return; |
7792 } | 7792 } |
7793 } | 7793 } |
7794 WinEnableWindow(handle, FALSE); | 7794 WinEnableWindow(handle, FALSE); |
7795 } | 7795 } |
7801 */ | 7801 */ |
7802 void API dw_window_enable(HWND handle) | 7802 void API dw_window_enable(HWND handle) |
7803 { | 7803 { |
7804 ULONG fore = (ULONG)dw_window_get_data(handle, "_dw_fore"); | 7804 ULONG fore = (ULONG)dw_window_get_data(handle, "_dw_fore"); |
7805 ULONG back = (ULONG)dw_window_get_data(handle, "_dw_back"); | 7805 ULONG back = (ULONG)dw_window_get_data(handle, "_dw_back"); |
7806 HWND hwnd = _find_entryfield(handle); | 7806 HWND hwnd = _dw_find_entryfield(handle); |
7807 | 7807 |
7808 if(handle < 65536) | 7808 if(handle < 65536) |
7809 { | 7809 { |
7810 char buffer[30]; | 7810 char buffer[30]; |
7811 HMENUI mymenu; | 7811 HMENUI mymenu; |
7945 tmpitem[index].hsize = hsize ? SIZEEXPAND : SIZESTATIC; | 7945 tmpitem[index].hsize = hsize ? SIZEEXPAND : SIZESTATIC; |
7946 tmpitem[index].vsize = vsize ? SIZEEXPAND : SIZESTATIC; | 7946 tmpitem[index].vsize = vsize ? SIZEEXPAND : SIZESTATIC; |
7947 | 7947 |
7948 /* If either of the parameters are -1 ... calculate the size */ | 7948 /* If either of the parameters are -1 ... calculate the size */ |
7949 if(width == -1 || height == -1) | 7949 if(width == -1 || height == -1) |
7950 _control_size(item, width == -1 ? &tmpitem[index].width : NULL, height == -1 ? &tmpitem[index].height : NULL); | 7950 _dw_control_size(item, width == -1 ? &tmpitem[index].width : NULL, height == -1 ? &tmpitem[index].height : NULL); |
7951 | 7951 |
7952 thisbox->items = tmpitem; | 7952 thisbox->items = tmpitem; |
7953 | 7953 |
7954 if(thisitem) | 7954 if(thisitem) |
7955 free(thisitem); | 7955 free(thisitem); |
7962 * from firing, so I removed it. If spinbuttons cause problems revisit this. | 7962 * from firing, so I removed it. If spinbuttons cause problems revisit this. |
7963 */ | 7963 */ |
7964 if(strncmp(tmpbuf, "#6", 3)!=0 && /*strncmp(tmpbuf, "#32", 4)!=0 &&*/ strncmp(tmpbuf, "#2", 3)!=0) | 7964 if(strncmp(tmpbuf, "#6", 3)!=0 && /*strncmp(tmpbuf, "#32", 4)!=0 &&*/ strncmp(tmpbuf, "#2", 3)!=0) |
7965 WinSetOwner(item, box); | 7965 WinSetOwner(item, box); |
7966 WinSetParent(frame ? frame : item, box, FALSE); | 7966 WinSetParent(frame ? frame : item, box, FALSE); |
7967 _handle_transparent(box); | 7967 _dw_handle_transparent(box); |
7968 /* Queue a redraw on the top-level window */ | 7968 /* Queue a redraw on the top-level window */ |
7969 _dw_redraw(_toplevel_window(box), TRUE); | 7969 _dw_redraw(_dw_toplevel_window(box), TRUE); |
7970 } | 7970 } |
7971 } | 7971 } |
7972 | 7972 |
7973 /* | 7973 /* |
7974 * Remove windows (widgets) from the box they are packed into. | 7974 * Remove windows (widgets) from the box they are packed into. |
8030 | 8030 |
8031 /* If it isn't padding, reset the parent */ | 8031 /* If it isn't padding, reset the parent */ |
8032 if(handle) | 8032 if(handle) |
8033 WinSetParent(handle, HWND_OBJECT, FALSE); | 8033 WinSetParent(handle, HWND_OBJECT, FALSE); |
8034 /* Queue a redraw on the top-level window */ | 8034 /* Queue a redraw on the top-level window */ |
8035 _dw_redraw(_toplevel_window(parent), TRUE); | 8035 _dw_redraw(_dw_toplevel_window(parent), TRUE); |
8036 return DW_ERROR_NONE; | 8036 return DW_ERROR_NONE; |
8037 } | 8037 } |
8038 } | 8038 } |
8039 return DW_ERROR_GENERAL; | 8039 return DW_ERROR_GENERAL; |
8040 } | 8040 } |
8083 | 8083 |
8084 /* If it isn't padding, reset the parent */ | 8084 /* If it isn't padding, reset the parent */ |
8085 if(handle) | 8085 if(handle) |
8086 WinSetParent(handle, HWND_OBJECT, FALSE); | 8086 WinSetParent(handle, HWND_OBJECT, FALSE); |
8087 /* Queue a redraw on the top-level window */ | 8087 /* Queue a redraw on the top-level window */ |
8088 _dw_redraw(_toplevel_window(box), TRUE); | 8088 _dw_redraw(_dw_toplevel_window(box), TRUE); |
8089 return handle; | 8089 return handle; |
8090 } | 8090 } |
8091 return 0; | 8091 return 0; |
8092 } | 8092 } |
8093 | 8093 |
8156 { | 8156 { |
8157 int depth = 0; | 8157 int depth = 0; |
8158 RECTL rect = { 0 }; | 8158 RECTL rect = { 0 }; |
8159 | 8159 |
8160 /* Calculate space requirements */ | 8160 /* Calculate space requirements */ |
8161 _resize_box(thisbox, &depth, *width, *height, 1); | 8161 _dw_resize_box(thisbox, &depth, *width, *height, 1); |
8162 | 8162 |
8163 rect.xRight = thisbox->minwidth; | 8163 rect.xRight = thisbox->minwidth; |
8164 rect.yTop = thisbox->minheight; | 8164 rect.yTop = thisbox->minheight; |
8165 | 8165 |
8166 /* Take into account the window border and menu here */ | 8166 /* Take into account the window border and menu here */ |
8223 if(thisbox) | 8223 if(thisbox) |
8224 { | 8224 { |
8225 int depth = 0; | 8225 int depth = 0; |
8226 | 8226 |
8227 /* Calculate space requirements */ | 8227 /* Calculate space requirements */ |
8228 _resize_box(thisbox, &depth, 0, 0, 1); | 8228 _dw_resize_box(thisbox, &depth, 0, 0, 1); |
8229 | 8229 |
8230 /* Return what was requested */ | 8230 /* Return what was requested */ |
8231 if(width) *width = thisbox->minwidth; | 8231 if(width) *width = thisbox->minwidth; |
8232 if(height) *height = thisbox->minheight; | 8232 if(height) *height = thisbox->minheight; |
8233 } | 8233 } |
8234 } | 8234 } |
8235 } | 8235 } |
8236 else | 8236 else |
8237 _control_size(handle, width, height); | 8237 _dw_control_size(handle, width, height); |
8238 } | 8238 } |
8239 | 8239 |
8240 /* | 8240 /* |
8241 * Returns the width of the screen. | 8241 * Returns the width of the screen. |
8242 */ | 8242 */ |
8277 dw_window_set_data(handle, "_dw_grav_horz", DW_INT_TO_POINTER(horz)); | 8277 dw_window_set_data(handle, "_dw_grav_horz", DW_INT_TO_POINTER(horz)); |
8278 dw_window_set_data(handle, "_dw_grav_vert", DW_INT_TO_POINTER(vert)); | 8278 dw_window_set_data(handle, "_dw_grav_vert", DW_INT_TO_POINTER(vert)); |
8279 } | 8279 } |
8280 | 8280 |
8281 /* Convert the coordinates based on gravity */ | 8281 /* Convert the coordinates based on gravity */ |
8282 void _handle_gravity(HWND handle, long *x, long *y, unsigned long width, unsigned long height) | 8282 void _dw_handle_gravity(HWND handle, long *x, long *y, unsigned long width, unsigned long height) |
8283 { | 8283 { |
8284 int horz = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_horz")); | 8284 int horz = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_horz")); |
8285 int vert = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_vert")); | 8285 int vert = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_vert")); |
8286 | 8286 |
8287 /* Do any gravity calculations */ | 8287 /* Do any gravity calculations */ |
8345 if(width == 0 || height == 0) | 8345 if(width == 0 || height == 0) |
8346 { | 8346 { |
8347 dw_window_set_size(handle, 0, 0); | 8347 dw_window_set_size(handle, 0, 0); |
8348 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); | 8348 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); |
8349 } | 8349 } |
8350 _handle_gravity(handle, &x, &y, width, height); | 8350 _dw_handle_gravity(handle, &x, &y, width, height); |
8351 WinSetWindowPos(handle, NULLHANDLE, x, y, 0, 0, SWP_MOVE); | 8351 WinSetWindowPos(handle, NULLHANDLE, x, y, 0, 0, SWP_MOVE); |
8352 } | 8352 } |
8353 | 8353 |
8354 /* | 8354 /* |
8355 * Sets the position and size of a given window (widget). | 8355 * Sets the position and size of a given window (widget). |
8364 { | 8364 { |
8365 /* Attempt to auto-size */ | 8365 /* Attempt to auto-size */ |
8366 if ( width < 1 || height < 1 ) | 8366 if ( width < 1 || height < 1 ) |
8367 _get_window_for_size(handle, &width, &height); | 8367 _get_window_for_size(handle, &width, &height); |
8368 | 8368 |
8369 _handle_gravity(handle, &x, &y, width, height); | 8369 _dw_handle_gravity(handle, &x, &y, width, height); |
8370 /* Finally set the size */ | 8370 /* Finally set the size */ |
8371 WinSetWindowPos(handle, NULLHANDLE, x, y, width, height, SWP_MOVE | SWP_SIZE); | 8371 WinSetWindowPos(handle, NULLHANDLE, x, y, width, height, SWP_MOVE | SWP_SIZE); |
8372 } | 8372 } |
8373 | 8373 |
8374 /* | 8374 /* |
8385 SWP swp; | 8385 SWP swp; |
8386 WinQueryWindowPos(handle, &swp); | 8386 WinQueryWindowPos(handle, &swp); |
8387 if(x) | 8387 if(x) |
8388 *x = swp.x; | 8388 *x = swp.x; |
8389 if(y) | 8389 if(y) |
8390 *y = _get_frame_height(handle) - (swp.y + swp.cy); | 8390 *y = _dw_get_frame_height(handle) - (swp.y + swp.cy); |
8391 if(width) | 8391 if(width) |
8392 *width = swp.cx; | 8392 *width = swp.cx; |
8393 if(height) | 8393 if(height) |
8394 *height = swp.cy; | 8394 *height = swp.cy; |
8395 } | 8395 } |
8511 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page) | 8511 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page) |
8512 { | 8512 { |
8513 HWND tmpbox = dw_box_new(DW_VERT, 0); | 8513 HWND tmpbox = dw_box_new(DW_VERT, 0); |
8514 | 8514 |
8515 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); | 8515 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); |
8516 WinSubclassWindow(tmpbox, _wndproc); | 8516 WinSubclassWindow(tmpbox, _dw_wndproc); |
8517 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND, | 8517 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND, |
8518 MPFROMLONG(pageid), MPFROMHWND(tmpbox)); | 8518 MPFROMLONG(pageid), MPFROMHWND(tmpbox)); |
8519 } | 8519 } |
8520 | 8520 |
8521 /* | 8521 /* |
8674 | 8674 |
8675 WinQueryClassName(handle, 99, (PCH)tmpbuf); | 8675 WinQueryClassName(handle, 99, (PCH)tmpbuf); |
8676 | 8676 |
8677 /* If we are setting a combobox call the event handler manually */ | 8677 /* If we are setting a combobox call the event handler manually */ |
8678 if(strncmp(tmpbuf, "#6", 3)==0) | 8678 if(strncmp(tmpbuf, "#6", 3)==0) |
8679 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle); | 8679 _dw_run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle); |
8680 } | 8680 } |
8681 | 8681 |
8682 /* | 8682 /* |
8683 * Deletes the item with given index from the list. | 8683 * Deletes the item with given index from the list. |
8684 * Parameters: | 8684 * Parameters: |
8920 void API dw_mle_thaw(HWND handle) | 8920 void API dw_mle_thaw(HWND handle) |
8921 { | 8921 { |
8922 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0); | 8922 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0); |
8923 } | 8923 } |
8924 | 8924 |
8925 /* Internal version that can be called from _percentthread */ | 8925 /* Internal version that can be called from _dw_percent_thread */ |
8926 void _dw_percent_set_pos(HWND handle, unsigned int position) | 8926 void _dw_percent_set_pos(HWND handle, unsigned int position) |
8927 { | 8927 { |
8928 int range = _dw_percent_get_range(handle); | 8928 int range = _dw_percent_get_range(handle); |
8929 | 8929 |
8930 if(range) | 8930 if(range) |
8938 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)mypos); | 8938 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)mypos); |
8939 } | 8939 } |
8940 } | 8940 } |
8941 | 8941 |
8942 /* Move the percentage bar backwards to simulate indeterminate */ | 8942 /* Move the percentage bar backwards to simulate indeterminate */ |
8943 void _percentthread(void *data) | 8943 void _dw_percent_thread(void *data) |
8944 { | 8944 { |
8945 HWND percent = (HWND)data; | 8945 HWND percent = (HWND)data; |
8946 | 8946 |
8947 if(percent) | 8947 if(percent) |
8948 { | 8948 { |
8979 { | 8979 { |
8980 if(!dw_window_get_data(handle, "_dw_ind")) | 8980 if(!dw_window_get_data(handle, "_dw_ind")) |
8981 { | 8981 { |
8982 /* So we fake it with a thread */ | 8982 /* So we fake it with a thread */ |
8983 dw_window_set_data(handle, "_dw_ind", (void *)1); | 8983 dw_window_set_data(handle, "_dw_ind", (void *)1); |
8984 _beginthread(_percentthread, NULL, 100, (void *)handle); | 8984 _beginthread(_dw_percent_thread, NULL, 100, (void *)handle); |
8985 } | 8985 } |
8986 } | 8986 } |
8987 else | 8987 else |
8988 { | 8988 { |
8989 /* Make sure we are no longer indeterminate */ | 8989 /* Make sure we are no longer indeterminate */ |
9288 * Sets this item as the active selection. | 9288 * Sets this item as the active selection. |
9289 * Parameters: | 9289 * Parameters: |
9290 * handle: Handle to the tree window (widget) to be selected. | 9290 * handle: Handle to the tree window (widget) to be selected. |
9291 * item: Handle to the item to be selected. | 9291 * item: Handle to the item to be selected. |
9292 */ | 9292 */ |
9293 void API dw_tree_item_select(HWND handle, HTREEITEM item) | 9293 void API dw_tree_dw_item_select(HWND handle, HTREEITEM item) |
9294 { | 9294 { |
9295 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | 9295 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
9296 | 9296 |
9297 while(pCore) | 9297 while(pCore) |
9298 { | 9298 { |
9358 | 9358 |
9359 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pci, MPFROM2SHORT(1, CMA_INVALIDATE | CMA_FREE)); | 9359 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pci, MPFROM2SHORT(1, CMA_INVALIDATE | CMA_FREE)); |
9360 } | 9360 } |
9361 | 9361 |
9362 /* Some OS/2 specific container structs */ | 9362 /* Some OS/2 specific container structs */ |
9363 typedef struct _containerinfo { | 9363 typedef struct _dwcontainerinfo { |
9364 int count; | 9364 int count; |
9365 void *data; | 9365 void *data; |
9366 HWND handle; | 9366 HWND handle; |
9367 } ContainerInfo; | 9367 } DWContainerInfo; |
9368 | 9368 |
9369 /* | 9369 /* |
9370 * Sets up the container columns. | 9370 * Sets up the container columns. |
9371 * Parameters: | 9371 * Parameters: |
9372 * handle: Handle to the container to be configured. | 9372 * handle: Handle to the container to be configured. |
9523 return WinLoadPointer(HWND_DESKTOP,module,id); | 9523 return WinLoadPointer(HWND_DESKTOP,module,id); |
9524 } | 9524 } |
9525 | 9525 |
9526 #if 0 | 9526 #if 0 |
9527 /* Internal function to create pointer/icon masks */ | 9527 /* Internal function to create pointer/icon masks */ |
9528 void _create_mask(HPIXMAP src, HPIXMAP mask, unsigned long backrgb) | 9528 void _dw_create_mask(HPIXMAP src, HPIXMAP mask, unsigned long backrgb) |
9529 { | 9529 { |
9530 LONG maskcolor = (DW_RED_VALUE(backrgb) << 16) | (DW_GREEN_VALUE(backrgb) << 8) | DW_BLUE_VALUE(backrgb); | 9530 LONG maskcolor = (DW_RED_VALUE(backrgb) << 16) | (DW_GREEN_VALUE(backrgb) << 8) | DW_BLUE_VALUE(backrgb); |
9531 int x, y; | 9531 int x, y; |
9532 | 9532 |
9533 for(x=0; x < src->width; x++) | 9533 for(x=0; x < src->width; x++) |
9549 } | 9549 } |
9550 } | 9550 } |
9551 #endif | 9551 #endif |
9552 | 9552 |
9553 /* Internal function to create an icon from an existing pixmap */ | 9553 /* Internal function to create an icon from an existing pixmap */ |
9554 HICN _create_icon(HPIXMAP src, unsigned long backrgb) | 9554 HICN _dw_create_icon(HPIXMAP src, unsigned long backrgb) |
9555 { | 9555 { |
9556 HPIXMAP pntr = dw_pixmap_new(hwndApp, WinQuerySysValue(HWND_DESKTOP, SV_CXICON), WinQuerySysValue(HWND_DESKTOP, SV_CYICON), src->depth); | 9556 HPIXMAP pntr = dw_pixmap_new(hwndApp, WinQuerySysValue(HWND_DESKTOP, SV_CXICON), WinQuerySysValue(HWND_DESKTOP, SV_CYICON), src->depth); |
9557 HPIXMAP mask = dw_pixmap_new(hwndApp, pntr->width, pntr->height*2, 1); | 9557 HPIXMAP mask = dw_pixmap_new(hwndApp, pntr->width, pntr->height*2, 1); |
9558 HPIXMAP minipntr = dw_pixmap_new(hwndApp, pntr->width/2, pntr->height/2, src->depth); | 9558 HPIXMAP minipntr = dw_pixmap_new(hwndApp, pntr->width/2, pntr->height/2, src->depth); |
9559 HPIXMAP minimask = dw_pixmap_new(hwndApp, minipntr->width, minipntr->height*2, 1); | 9559 HPIXMAP minimask = dw_pixmap_new(hwndApp, minipntr->width, minipntr->height*2, 1); |
9570 dw_draw_rect(0, minimask, DW_DRAW_FILL, 0, 0, minimask->width, minimask->height); | 9570 dw_draw_rect(0, minimask, DW_DRAW_FILL, 0, 0, minimask->width, minimask->height); |
9571 #if 0 | 9571 #if 0 |
9572 /* If we have a background color... create masks */ | 9572 /* If we have a background color... create masks */ |
9573 if(backrgb & DW_RGB_COLOR) | 9573 if(backrgb & DW_RGB_COLOR) |
9574 { | 9574 { |
9575 _create_mask(pntr, mask, backrgb); | 9575 _dw_create_mask(pntr, mask, backrgb); |
9576 _create_mask(minipntr, minimask, backrgb); | 9576 _dw_create_mask(minipntr, minimask, backrgb); |
9577 } | 9577 } |
9578 #endif | 9578 #endif |
9579 _foreground = oldcol; | 9579 _foreground = oldcol; |
9580 | 9580 |
9581 /* Assemble the Pointer Info structure */ | 9581 /* Assemble the Pointer Info structure */ |
9628 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) | 9628 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) |
9629 { | 9629 { |
9630 strcpy(file, filename); | 9630 strcpy(file, filename); |
9631 strcat(file, image_exts[z]); | 9631 strcat(file, image_exts[z]); |
9632 if(access(file, 04) == 0 && | 9632 if(access(file, 04) == 0 && |
9633 _load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth, defcol)) | 9633 _dw_load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth, defcol)) |
9634 { | 9634 { |
9635 icon = _create_icon(src, defcol); | 9635 icon = _dw_create_icon(src, defcol); |
9636 break; | 9636 break; |
9637 } | 9637 } |
9638 } | 9638 } |
9639 } | 9639 } |
9640 else if(_load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth, defcol)) | 9640 else if(_dw_load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth, defcol)) |
9641 icon = _create_icon(src, defcol); | 9641 icon = _dw_create_icon(src, defcol); |
9642 /* Free temporary resources if in use */ | 9642 /* Free temporary resources if in use */ |
9643 if(icon) | 9643 if(icon) |
9644 { | 9644 { |
9645 GpiSetBitmap(src->hps, NULLHANDLE); | 9645 GpiSetBitmap(src->hps, NULLHANDLE); |
9646 GpiDeleteBitmap(src->hbm); | 9646 GpiDeleteBitmap(src->hbm); |
9702 { | 9702 { |
9703 WindowData *wd = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); | 9703 WindowData *wd = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
9704 ULONG *flags = wd ? wd->data : 0; | 9704 ULONG *flags = wd ? wd->data : 0; |
9705 int z, size = 0, totalsize, count = 0; | 9705 int z, size = 0, totalsize, count = 0; |
9706 PRECORDCORE temp; | 9706 PRECORDCORE temp; |
9707 ContainerInfo *ci; | 9707 DWContainerInfo *ci; |
9708 void *blah = NULL; | 9708 void *blah = NULL; |
9709 | 9709 |
9710 if(!flags || rowcount < 1) | 9710 if(!flags || rowcount < 1) |
9711 return NULL; | 9711 return NULL; |
9712 | 9712 |
9741 { | 9741 { |
9742 temp->cb = totalsize; | 9742 temp->cb = totalsize; |
9743 temp = temp->preccNextRecord; | 9743 temp = temp->preccNextRecord; |
9744 } | 9744 } |
9745 | 9745 |
9746 ci = malloc(sizeof(struct _containerinfo)); | 9746 ci = malloc(sizeof(struct _dwcontainerinfo)); |
9747 | 9747 |
9748 ci->count = rowcount; | 9748 ci->count = rowcount; |
9749 ci->data = blah; | 9749 ci->data = blah; |
9750 ci->handle = handle; | 9750 ci->handle = handle; |
9751 | 9751 |
9890 * row: Zero based row of data being set. | 9890 * row: Zero based row of data being set. |
9891 * data: Pointer to the data to be added. | 9891 * data: Pointer to the data to be added. |
9892 */ | 9892 */ |
9893 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) | 9893 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) |
9894 { | 9894 { |
9895 ContainerInfo *ci = (ContainerInfo *)pointer; | 9895 DWContainerInfo *ci = (DWContainerInfo *)pointer; |
9896 | 9896 |
9897 if(!ci) | 9897 if(!ci) |
9898 return; | 9898 return; |
9899 | 9899 |
9900 _dw_container_set_item(handle, (PRECORDCORE)ci->data, column, row, data); | 9900 _dw_container_set_item(handle, (PRECORDCORE)ci->data, column, row, data); |
10056 * row: Zero based row of data being set. | 10056 * row: Zero based row of data being set. |
10057 * title: String title of the item. | 10057 * title: String title of the item. |
10058 */ | 10058 */ |
10059 void API dw_container_set_row_title(void *pointer, int row, const char *title) | 10059 void API dw_container_set_row_title(void *pointer, int row, const char *title) |
10060 { | 10060 { |
10061 ContainerInfo *ci = (ContainerInfo *)pointer; | 10061 DWContainerInfo *ci = DWContainerInfo *)pointer; |
10062 PRECORDCORE temp; | 10062 PRECORDCORE temp; |
10063 int z, currentcount; | 10063 int z, currentcount; |
10064 CNRINFO cnr; | 10064 CNRINFO cnr; |
10065 char *newtitle; | 10065 char *newtitle; |
10066 | 10066 |
10121 * row: Zero based row of data being set. | 10121 * row: Zero based row of data being set. |
10122 * data: Data pointer. | 10122 * data: Data pointer. |
10123 */ | 10123 */ |
10124 void API dw_container_set_row_data(void *pointer, int row, void *data) | 10124 void API dw_container_set_row_data(void *pointer, int row, void *data) |
10125 { | 10125 { |
10126 ContainerInfo *ci = (ContainerInfo *)pointer; | 10126 DWContainerInfo *ci = (DWContainerInfo *)pointer; |
10127 PRECORDCORE temp; | 10127 PRECORDCORE temp; |
10128 int z, currentcount; | 10128 int z, currentcount; |
10129 CNRINFO cnr; | 10129 CNRINFO cnr; |
10130 | 10130 |
10131 if(!ci) | 10131 if(!ci) |
10199 * rowcount: The number of rows to be inserted. | 10199 * rowcount: The number of rows to be inserted. |
10200 */ | 10200 */ |
10201 void API dw_container_insert(HWND handle, void *pointer, int rowcount) | 10201 void API dw_container_insert(HWND handle, void *pointer, int rowcount) |
10202 { | 10202 { |
10203 RECORDINSERT recin; | 10203 RECORDINSERT recin; |
10204 ContainerInfo *ci = (ContainerInfo *)pointer; | 10204 DWContainerInfo *ci = (DWContainerInfo *)pointer; |
10205 PRECORDCORE pCore; | 10205 PRECORDCORE pCore; |
10206 | 10206 |
10207 if(!ci) | 10207 if(!ci) |
10208 return; | 10208 return; |
10209 | 10209 |
10223 NOTIFYRECORDEMPHASIS pre; | 10223 NOTIFYRECORDEMPHASIS pre; |
10224 | 10224 |
10225 pre.pRecord = pCore; | 10225 pre.pRecord = pCore; |
10226 pre.fEmphasisMask = CRA_CURSORED; | 10226 pre.fEmphasisMask = CRA_CURSORED; |
10227 pre.hwndCnr = handle; | 10227 pre.hwndCnr = handle; |
10228 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre); | 10228 _dw_run_event(handle, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre); |
10229 pre.pRecord->flRecordAttr |= CRA_CURSORED; | 10229 pre.pRecord->flRecordAttr |= CRA_CURSORED; |
10230 } | 10230 } |
10231 } | 10231 } |
10232 | 10232 |
10233 /* | 10233 /* |
10240 { | 10240 { |
10241 PCNRITEM pCore; | 10241 PCNRITEM pCore; |
10242 int container = (int)dw_window_get_data(handle, "_dw_container"); | 10242 int container = (int)dw_window_get_data(handle, "_dw_container"); |
10243 | 10243 |
10244 if(hwndEmph == handle) | 10244 if(hwndEmph == handle) |
10245 _clear_emphasis(); | 10245 _dw_clear_emphasis(); |
10246 | 10246 |
10247 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | 10247 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
10248 | 10248 |
10249 while(pCore) | 10249 while(pCore) |
10250 { | 10250 { |
10761 dw_window_show(window); | 10761 dw_window_show(window); |
10762 | 10762 |
10763 return (unsigned long)dw_dialog_wait(dwwait); | 10763 return (unsigned long)dw_dialog_wait(dwwait); |
10764 } | 10764 } |
10765 | 10765 |
10766 HPS _set_hps(HPS hps) | 10766 HPS _dw_set_hps(HPS hps) |
10767 { | 10767 { |
10768 LONG alTable[2]; | 10768 LONG alTable[2]; |
10769 | 10769 |
10770 alTable[0] = DW_RED_VALUE(_foreground) << 16 | DW_GREEN_VALUE(_foreground) << 8 | DW_BLUE_VALUE(_foreground); | 10770 alTable[0] = DW_RED_VALUE(_foreground) << 16 | DW_GREEN_VALUE(_foreground) << 8 | DW_BLUE_VALUE(_foreground); |
10771 alTable[1] = DW_RED_VALUE(_background) << 16 | DW_GREEN_VALUE(_background) << 8 | DW_BLUE_VALUE(_background); | 10771 alTable[1] = DW_RED_VALUE(_background) << 16 | DW_GREEN_VALUE(_background) << 8 | DW_BLUE_VALUE(_background); |
10777 2, | 10777 2, |
10778 alTable); | 10778 alTable); |
10779 if(_foreground & DW_RGB_COLOR) | 10779 if(_foreground & DW_RGB_COLOR) |
10780 GpiSetColor(hps, 16); | 10780 GpiSetColor(hps, 16); |
10781 else | 10781 else |
10782 GpiSetColor(hps, _internal_color(_foreground)); | 10782 GpiSetColor(hps, _dw_internal_color(_foreground)); |
10783 if(_background & DW_RGB_COLOR) | 10783 if(_background & DW_RGB_COLOR) |
10784 GpiSetBackColor(hps, 17); | 10784 GpiSetBackColor(hps, 17); |
10785 else | 10785 else |
10786 GpiSetBackColor(hps, _internal_color(_background)); | 10786 GpiSetBackColor(hps, _dw_internal_color(_background)); |
10787 return hps; | 10787 return hps; |
10788 } | 10788 } |
10789 | 10789 |
10790 HPS _set_colors(HWND handle) | 10790 HPS _set_colors(HWND handle) |
10791 { | 10791 { |
10792 HPS hps = WinGetPS(handle); | 10792 HPS hps = WinGetPS(handle); |
10793 | 10793 |
10794 _set_hps(hps); | 10794 _dw_set_hps(hps); |
10795 return hps; | 10795 return hps; |
10796 } | 10796 } |
10797 | 10797 |
10798 /* Draw a point on a window (preferably a render window). | 10798 /* Draw a point on a window (preferably a render window). |
10799 * Parameters: | 10799 * Parameters: |
10809 POINTL ptl; | 10809 POINTL ptl; |
10810 | 10810 |
10811 if(handle) | 10811 if(handle) |
10812 { | 10812 { |
10813 hps = _set_colors(handle); | 10813 hps = _set_colors(handle); |
10814 height = _get_height(handle); | 10814 height = _dw_get_height(handle); |
10815 } | 10815 } |
10816 else if(pixmap) | 10816 else if(pixmap) |
10817 { | 10817 { |
10818 hps = _set_hps(pixmap->hps); | 10818 hps = _dw_set_hps(pixmap->hps); |
10819 height = pixmap->height; | 10819 height = pixmap->height; |
10820 } | 10820 } |
10821 else | 10821 else |
10822 return; | 10822 return; |
10823 | 10823 |
10845 POINTL ptl[2]; | 10845 POINTL ptl[2]; |
10846 | 10846 |
10847 if(handle) | 10847 if(handle) |
10848 { | 10848 { |
10849 hps = _set_colors(handle); | 10849 hps = _set_colors(handle); |
10850 height = _get_height(handle); | 10850 height = _dw_get_height(handle); |
10851 } | 10851 } |
10852 else if(pixmap) | 10852 else if(pixmap) |
10853 { | 10853 { |
10854 hps = _set_hps(pixmap->hps); | 10854 hps = _dw_set_hps(pixmap->hps); |
10855 height = pixmap->height; | 10855 height = pixmap->height; |
10856 } | 10856 } |
10857 else | 10857 else |
10858 return; | 10858 return; |
10859 | 10859 |
10868 if(handle) | 10868 if(handle) |
10869 WinReleasePS(hps); | 10869 WinReleasePS(hps); |
10870 } | 10870 } |
10871 | 10871 |
10872 | 10872 |
10873 void _CopyFontSettings(HPS hpsSrc, HPS hpsDst) | 10873 void _dw_copy_font_settings(HPS hpsSrc, HPS hpsDst) |
10874 { | 10874 { |
10875 FONTMETRICS fm; | 10875 FONTMETRICS fm; |
10876 FATTRS fat; | 10876 FATTRS fat; |
10877 SIZEF sizf; | 10877 SIZEF sizf; |
10878 | 10878 |
10912 POINTL aptl[TXTBOX_COUNT]; | 10912 POINTL aptl[TXTBOX_COUNT]; |
10913 | 10913 |
10914 if(handle) | 10914 if(handle) |
10915 { | 10915 { |
10916 hps = _set_colors(handle); | 10916 hps = _set_colors(handle); |
10917 height = _get_height(handle); | 10917 height = _dw_get_height(handle); |
10918 _GetPPFont(handle, fontname); | 10918 _dw_get_pp_font(handle, fontname); |
10919 } | 10919 } |
10920 else if(pixmap) | 10920 else if(pixmap) |
10921 { | 10921 { |
10922 HPS pixmaphps = WinGetPS(pixmap->font ? pixmap->font : pixmap->handle); | 10922 HPS pixmaphps = WinGetPS(pixmap->font ? pixmap->font : pixmap->handle); |
10923 | 10923 |
10924 hps = _set_hps(pixmap->hps); | 10924 hps = _dw_set_hps(pixmap->hps); |
10925 height = pixmap->height; | 10925 height = pixmap->height; |
10926 _GetPPFont(pixmap->font ? pixmap->font : pixmap->handle, fontname); | 10926 _dw_get_pp_font(pixmap->font ? pixmap->font : pixmap->handle, fontname); |
10927 _CopyFontSettings(pixmaphps, hps); | 10927 _dw_copy_font_settings(pixmaphps, hps); |
10928 WinReleasePS(pixmaphps); | 10928 WinReleasePS(pixmaphps); |
10929 } | 10929 } |
10930 else | 10930 else |
10931 return; | 10931 return; |
10932 | 10932 |
10944 rcl.xRight = rcl.xLeft + (aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x); | 10944 rcl.xRight = rcl.xLeft + (aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x); |
10945 | 10945 |
10946 if(_background == DW_CLR_DEFAULT) | 10946 if(_background == DW_CLR_DEFAULT) |
10947 WinDrawText(hps, -1, (PCH)text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); | 10947 WinDrawText(hps, -1, (PCH)text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); |
10948 else | 10948 else |
10949 WinDrawText(hps, -1, (PCH)text, &rcl, _internal_color(_foreground), _internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); | 10949 WinDrawText(hps, -1, (PCH)text, &rcl, _dw_internal_color(_foreground), _dw_internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); |
10950 | 10950 |
10951 if(handle) | 10951 if(handle) |
10952 WinReleasePS(hps); | 10952 WinReleasePS(hps); |
10953 } | 10953 } |
10954 | 10954 |
10971 } | 10971 } |
10972 else if(pixmap) | 10972 else if(pixmap) |
10973 { | 10973 { |
10974 HPS pixmaphps = WinGetPS(pixmap->font ? pixmap->font : pixmap->handle); | 10974 HPS pixmaphps = WinGetPS(pixmap->font ? pixmap->font : pixmap->handle); |
10975 | 10975 |
10976 hps = _set_hps(pixmap->hps); | 10976 hps = _dw_set_hps(pixmap->hps); |
10977 _CopyFontSettings(pixmaphps, hps); | 10977 _dw_copy_font_settings(pixmaphps, hps); |
10978 WinReleasePS(pixmaphps); | 10978 WinReleasePS(pixmaphps); |
10979 } | 10979 } |
10980 else | 10980 else |
10981 return; | 10981 return; |
10982 | 10982 |
11011 int i; | 11011 int i; |
11012 | 11012 |
11013 if(handle) | 11013 if(handle) |
11014 { | 11014 { |
11015 hps = _set_colors(handle); | 11015 hps = _set_colors(handle); |
11016 thisheight = _get_height(handle); | 11016 thisheight = _dw_get_height(handle); |
11017 } | 11017 } |
11018 else if(pixmap) | 11018 else if(pixmap) |
11019 { | 11019 { |
11020 hps = _set_hps(pixmap->hps); | 11020 hps = _dw_set_hps(pixmap->hps); |
11021 thisheight = pixmap->height; | 11021 thisheight = pixmap->height; |
11022 } | 11022 } |
11023 else | 11023 else |
11024 return; | 11024 return; |
11025 if ( npoints == 0 ) | 11025 if ( npoints == 0 ) |
11075 POINTL ptl[2]; | 11075 POINTL ptl[2]; |
11076 | 11076 |
11077 if(handle) | 11077 if(handle) |
11078 { | 11078 { |
11079 hps = _set_colors(handle); | 11079 hps = _set_colors(handle); |
11080 thisheight = _get_height(handle); | 11080 thisheight = _dw_get_height(handle); |
11081 } | 11081 } |
11082 else if(pixmap) | 11082 else if(pixmap) |
11083 { | 11083 { |
11084 hps = _set_hps(pixmap->hps); | 11084 hps = _dw_set_hps(pixmap->hps); |
11085 thisheight = pixmap->height; | 11085 thisheight = pixmap->height; |
11086 } | 11086 } |
11087 else | 11087 else |
11088 return; | 11088 return; |
11089 | 11089 |
11126 double r, a1, a2, a; | 11126 double r, a1, a2, a; |
11127 | 11127 |
11128 if(handle) | 11128 if(handle) |
11129 { | 11129 { |
11130 hps = _set_colors(handle); | 11130 hps = _set_colors(handle); |
11131 thisheight = _get_height(handle); | 11131 thisheight = _dw_get_height(handle); |
11132 } | 11132 } |
11133 else if(pixmap) | 11133 else if(pixmap) |
11134 { | 11134 { |
11135 hps = _set_hps(pixmap->hps); | 11135 hps = _dw_set_hps(pixmap->hps); |
11136 thisheight = pixmap->height; | 11136 thisheight = pixmap->height; |
11137 } | 11137 } |
11138 else | 11138 else |
11139 return; | 11139 return; |
11140 | 11140 |
11283 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) | 11283 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) |
11284 { | 11284 { |
11285 strcpy(file, filename); | 11285 strcpy(file, filename); |
11286 strcat(file, image_exts[z]); | 11286 strcat(file, image_exts[z]); |
11287 if(access(file, 04) == 0 && | 11287 if(access(file, 04) == 0 && |
11288 _load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) | 11288 _dw_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) |
11289 break; | 11289 break; |
11290 } | 11290 } |
11291 } | 11291 } |
11292 | 11292 |
11293 /* Try to load the bitmap from file */ | 11293 /* Try to load the bitmap from file */ |
11329 fp = fopen( file, "wb" ); | 11329 fp = fopen( file, "wb" ); |
11330 if ( fp != NULL ) | 11330 if ( fp != NULL ) |
11331 { | 11331 { |
11332 fwrite( data, 1, len, fp ); | 11332 fwrite( data, 1, len, fp ); |
11333 fclose( fp ); | 11333 fclose( fp ); |
11334 if(!_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) | 11334 if(!_dw_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) |
11335 { | 11335 { |
11336 /* can't use ICO ? */ | 11336 /* can't use ICO ? */ |
11337 unlink( file ); | 11337 unlink( file ); |
11338 return NULL; | 11338 return NULL; |
11339 } | 11339 } |
11358 */ | 11358 */ |
11359 void API dw_pixmap_set_transparent_color( HPIXMAP pixmap, ULONG color ) | 11359 void API dw_pixmap_set_transparent_color( HPIXMAP pixmap, ULONG color ) |
11360 { | 11360 { |
11361 if ( pixmap ) | 11361 if ( pixmap ) |
11362 { | 11362 { |
11363 pixmap->transcolor = _internal_color(color); | 11363 pixmap->transcolor = _dw_internal_color(color); |
11364 } | 11364 } |
11365 } | 11365 } |
11366 | 11366 |
11367 /* | 11367 /* |
11368 * Creates a pixmap from internal resource graphic specified by id. | 11368 * Creates a pixmap from internal resource graphic specified by id. |
11497 return DW_ERROR_GENERAL; | 11497 return DW_ERROR_GENERAL; |
11498 | 11498 |
11499 if(dest) | 11499 if(dest) |
11500 { | 11500 { |
11501 hpsdest = WinGetPS(dest); | 11501 hpsdest = WinGetPS(dest); |
11502 dheight = _get_height(dest); | 11502 dheight = _dw_get_height(dest); |
11503 } | 11503 } |
11504 else if(destp) | 11504 else if(destp) |
11505 { | 11505 { |
11506 hpsdest = destp->hps; | 11506 hpsdest = destp->hps; |
11507 dheight = destp->height; | 11507 dheight = destp->height; |
11510 return DW_ERROR_GENERAL; | 11510 return DW_ERROR_GENERAL; |
11511 | 11511 |
11512 if(src) | 11512 if(src) |
11513 { | 11513 { |
11514 hpssrc = WinGetPS(src); | 11514 hpssrc = WinGetPS(src); |
11515 sheight = _get_height(src); | 11515 sheight = _dw_get_height(src); |
11516 } | 11516 } |
11517 else if(srcp) | 11517 else if(srcp) |
11518 { | 11518 { |
11519 hpssrc = srcp->hps; | 11519 hpssrc = srcp->hps; |
11520 sheight = srcp->height; | 11520 sheight = srcp->height; |
11563 WinReleasePS(hpssrc); | 11563 WinReleasePS(hpssrc); |
11564 return DW_ERROR_NONE; | 11564 return DW_ERROR_NONE; |
11565 } | 11565 } |
11566 | 11566 |
11567 /* Run DosBeep() in a separate thread so it doesn't block */ | 11567 /* Run DosBeep() in a separate thread so it doesn't block */ |
11568 void _beepthread(void *data) | 11568 void _dw_beep_thread(void *data) |
11569 { | 11569 { |
11570 int *info = (int *)data; | 11570 int *info = (int *)data; |
11571 | 11571 |
11572 if(data) | 11572 if(data) |
11573 { | 11573 { |
11589 if(info) | 11589 if(info) |
11590 { | 11590 { |
11591 info[0] = freq; | 11591 info[0] = freq; |
11592 info[1] = dur; | 11592 info[1] = dur; |
11593 | 11593 |
11594 _beginthread(_beepthread, NULL, 100, (void *)info); | 11594 _beginthread(_dw_beep_thread, NULL, 100, (void *)info); |
11595 } | 11595 } |
11596 } | 11596 } |
11597 | 11597 |
11598 /* Open a shared library and return a handle. | 11598 /* Open a shared library and return a handle. |
11599 * Parameters: | 11599 * Parameters: |
12175 if(mypercent) | 12175 if(mypercent) |
12176 *mypercent = percent; | 12176 *mypercent = percent; |
12177 | 12177 |
12178 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); | 12178 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); |
12179 | 12179 |
12180 _handle_splitbar_resize(handle, percent, type, width, height); | 12180 _dw_handle_splitbar_resize(handle, percent, type, width, height); |
12181 } | 12181 } |
12182 | 12182 |
12183 /* | 12183 /* |
12184 * Gets the position of a splitbar (pecentage). | 12184 * Gets the position of a splitbar (pecentage). |
12185 * Parameters: | 12185 * Parameters: |
12231 pchEnd--; | 12231 pchEnd--; |
12232 } | 12232 } |
12233 return (0); | 12233 return (0); |
12234 } | 12234 } |
12235 | 12235 |
12236 ULONG _GetSystemBuildLevel(void) { | 12236 ULONG _dw_get_system_build_level(void) { |
12237 /* The build level info is normally available in the end of the OS2KRNL file. However, this is not the case in some beta versions of OS/2. | 12237 /* The build level info is normally available in the end of the OS2KRNL file. However, this is not the case in some beta versions of OS/2. |
12238 * We first try to find the info in the 256 last bytes of the file. If that fails, we load the entire file and search it completely. | 12238 * We first try to find the info in the 256 last bytes of the file. If that fails, we load the entire file and search it completely. |
12239 */ | 12239 */ |
12240 ULONG ulBootDrive = 0; | 12240 ULONG ulBootDrive = 0; |
12241 ULONG ulBuild = 0; | 12241 ULONG ulBuild = 0; |
12317 * Sets window to click the default dialog item when an ENTER is pressed. | 12317 * Sets window to click the default dialog item when an ENTER is pressed. |
12318 * Parameters: | 12318 * Parameters: |
12319 * window: Window (widget) to look for the ENTER press. | 12319 * window: Window (widget) to look for the ENTER press. |
12320 * next: Window (widget) to move to next (or click) | 12320 * next: Window (widget) to move to next (or click) |
12321 */ | 12321 */ |
12322 void API dw_window_click_default(HWND window, HWND next) | 12322 void API dw_window_dw_click_default(HWND window, HWND next) |
12323 { | 12323 { |
12324 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); | 12324 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
12325 | 12325 |
12326 if(blah) | 12326 if(blah) |
12327 blah->clickdefault = next; | 12327 blah->clickdefault = next; |
12344 | 12344 |
12345 WinOpenClipbrd(dwhab); | 12345 WinOpenClipbrd(dwhab); |
12346 | 12346 |
12347 #ifdef UNICODE | 12347 #ifdef UNICODE |
12348 if(!Unicode || !(unistr = (UniChar *)WinQueryClipbrdData(dwhab, Unicode)) || | 12348 if(!Unicode || !(unistr = (UniChar *)WinQueryClipbrdData(dwhab, Unicode)) || |
12349 !(retbuf = _WideToUTF8(unistr))) | 12349 !(retbuf = _dw_WideToUTF8(unistr))) |
12350 #endif | 12350 #endif |
12351 { | 12351 { |
12352 ULONG fmtInfo; | 12352 ULONG fmtInfo; |
12353 | 12353 |
12354 if (WinQueryClipbrdFmtInfo(dwhab, CF_TEXT, &fmtInfo)) /* Text data in clipboard */ | 12354 if (WinQueryClipbrdFmtInfo(dwhab, CF_TEXT, &fmtInfo)) /* Text data in clipboard */ |
12394 PVOID uold = ushared; | 12394 PVOID uold = ushared; |
12395 | 12395 |
12396 src = calloc(len + 1, 1); | 12396 src = calloc(len + 1, 1); |
12397 | 12397 |
12398 memcpy(src, str, len); | 12398 memcpy(src, str, len); |
12399 unistr = _UTF8toWide((char *)src); | 12399 unistr = _dw_UTF8toWide((char *)src); |
12400 free(src); | 12400 free(src); |
12401 | 12401 |
12402 if(unistr) | 12402 if(unistr) |
12403 { | 12403 { |
12404 buflen = (UniStrlen(unistr) + 1) * sizeof(UniChar); | 12404 buflen = (UniStrlen(unistr) + 1) * sizeof(UniChar); |
12468 /* The default is OS/2 2.0 */ | 12468 /* The default is OS/2 2.0 */ |
12469 strcpy(env->osName,"OS/2"); | 12469 strcpy(env->osName,"OS/2"); |
12470 env->MajorVersion = 2; | 12470 env->MajorVersion = 2; |
12471 env->MinorVersion = 0; | 12471 env->MinorVersion = 0; |
12472 | 12472 |
12473 Build = _GetSystemBuildLevel(); | 12473 Build = _dw_get_system_build_level(); |
12474 env->MinorBuild = Build & 0xFFFF; | 12474 env->MinorBuild = Build & 0xFFFF; |
12475 env->MajorBuild = Build >> 16; | 12475 env->MajorBuild = Build >> 16; |
12476 | 12476 |
12477 if (aulBuffer[0] == 20) | 12477 if (aulBuffer[0] == 20) |
12478 { | 12478 { |
12497 env->DWSubVersion = DW_SUB_VERSION; | 12497 env->DWSubVersion = DW_SUB_VERSION; |
12498 #endif | 12498 #endif |
12499 } | 12499 } |
12500 | 12500 |
12501 /* The next few functions are support functions for the OS/2 folder browser */ | 12501 /* The next few functions are support functions for the OS/2 folder browser */ |
12502 void _populate_directory(HWND tree, HTREEITEM parent, char *path) | 12502 void _dw_populate_directory(HWND tree, HTREEITEM parent, char *path) |
12503 { | 12503 { |
12504 FILEFINDBUF3 ffbuf; | 12504 FILEFINDBUF3 ffbuf; |
12505 HTREEITEM item; | 12505 HTREEITEM item; |
12506 ULONG count = 1; | 12506 ULONG count = 1; |
12507 HDIR hdir = HDIR_CREATE; | 12507 HDIR hdir = HDIR_CREATE; |
12527 } | 12527 } |
12528 DosFindClose(hdir); | 12528 DosFindClose(hdir); |
12529 } | 12529 } |
12530 } | 12530 } |
12531 | 12531 |
12532 void API _populate_tree_thread(void *data) | 12532 void API _dw_populate_tree_thread(void *data) |
12533 { | 12533 { |
12534 HWND window = (HWND)data, tree = (HWND)dw_window_get_data(window, "_dw_tree"); | 12534 HWND window = (HWND)data, tree = (HWND)dw_window_get_data(window, "_dw_tree"); |
12535 HMTX mtx = (HMTX)dw_window_get_data(window, "_dw_mutex"); | 12535 HMTX mtx = (HMTX)dw_window_get_data(window, "_dw_mutex"); |
12536 int drive; | 12536 int drive; |
12537 HTREEITEM items[26]; | 12537 HTREEITEM items[26]; |
12593 dw_window_destroy((HWND)dwwait->data); | 12593 dw_window_destroy((HWND)dwwait->data); |
12594 dw_dialog_dismiss((DWDialog *)data, NULL); | 12594 dw_dialog_dismiss((DWDialog *)data, NULL); |
12595 return FALSE; | 12595 return FALSE; |
12596 } | 12596 } |
12597 | 12597 |
12598 char *_tree_folder(HWND tree, HTREEITEM item) | 12598 char *_dw_tree_folder(HWND tree, HTREEITEM item) |
12599 { | 12599 { |
12600 char *folder=strdup(""); | 12600 char *folder=strdup(""); |
12601 HTREEITEM parent = item; | 12601 HTREEITEM parent = item; |
12602 | 12602 |
12603 while(parent) | 12603 while(parent) |
12619 parent = dw_tree_get_parent(tree, parent); | 12619 parent = dw_tree_get_parent(tree, parent); |
12620 } | 12620 } |
12621 return folder; | 12621 return folder; |
12622 } | 12622 } |
12623 | 12623 |
12624 int DWSIGNAL _item_select(HWND window, HTREEITEM item, char *text, void *data, void *itemdata) | 12624 int DWSIGNAL _dw_item_select(HWND window, HTREEITEM item, char *text, void *data, void *itemdata) |
12625 { | 12625 { |
12626 DWDialog *dwwait = (DWDialog *)data; | 12626 DWDialog *dwwait = (DWDialog *)data; |
12627 char *treedata = (char *)dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected"); | 12627 char *treedata = (char *)dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected"); |
12628 | 12628 |
12629 text = text; itemdata = itemdata; | 12629 text = text; itemdata = itemdata; |
12630 if(treedata) | 12630 if(treedata) |
12631 free(treedata); | 12631 free(treedata); |
12632 | 12632 |
12633 treedata = _tree_folder(window, item); | 12633 treedata = _dw_tree_folder(window, item); |
12634 dw_window_set_data((HWND)dwwait->data, "_dw_tree_selected", (void *)treedata); | 12634 dw_window_set_data((HWND)dwwait->data, "_dw_tree_selected", (void *)treedata); |
12635 | 12635 |
12636 return FALSE; | 12636 return FALSE; |
12637 } | 12637 } |
12638 | 12638 |
12641 HTREEITEM tempitem = (HTREEITEM)dw_tree_item_get_data(window, item); | 12641 HTREEITEM tempitem = (HTREEITEM)dw_tree_item_get_data(window, item); |
12642 | 12642 |
12643 data = data; | 12643 data = data; |
12644 if(tempitem) | 12644 if(tempitem) |
12645 { | 12645 { |
12646 char *folder = _tree_folder(window, item); | 12646 char *folder = _dw_tree_folder(window, item); |
12647 | 12647 |
12648 dw_tree_item_set_data(window, item, 0); | 12648 dw_tree_item_set_data(window, item, 0); |
12649 dw_tree_item_delete(window, tempitem); | 12649 dw_tree_item_delete(window, tempitem); |
12650 | 12650 |
12651 if(*folder) | 12651 if(*folder) |
12652 { | 12652 { |
12653 strcat(folder, "*"); | 12653 strcat(folder, "*"); |
12654 _populate_directory(window, item, folder); | 12654 _dw_populate_directory(window, item, folder); |
12655 } | 12655 } |
12656 free(folder); | 12656 free(folder); |
12657 } | 12657 } |
12658 | 12658 |
12659 return FALSE; | 12659 return FALSE; |
12695 | 12695 |
12696 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0); | 12696 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0); |
12697 | 12697 |
12698 dwwait = dw_dialog_new((void *)window); | 12698 dwwait = dw_dialog_new((void *)window); |
12699 | 12699 |
12700 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(_item_select), (void *)dwwait); | 12700 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(_dw_item_select), (void *)dwwait); |
12701 dw_signal_connect(tree, DW_SIGNAL_TREE_EXPAND, DW_SIGNAL_FUNC(_tree_expand), (void *)dwwait); | 12701 dw_signal_connect(tree, DW_SIGNAL_TREE_EXPAND, DW_SIGNAL_FUNC(_tree_expand), (void *)dwwait); |
12702 | 12702 |
12703 button = dw_button_new("Ok", 1001L); | 12703 button = dw_button_new("Ok", 1001L); |
12704 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3); | 12704 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3); |
12705 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); | 12705 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); |
12710 dw_signal_connect(window, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); | 12710 dw_signal_connect(window, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); |
12711 | 12711 |
12712 dw_window_set_size(window, 225, 300); | 12712 dw_window_set_size(window, 225, 300); |
12713 dw_window_show(window); | 12713 dw_window_show(window); |
12714 | 12714 |
12715 dw_thread_new((void *)_populate_tree_thread, (void *)window, 0xff); | 12715 dw_thread_new((void *)_dw_populate_tree_thread, (void *)window, 0xff); |
12716 return (char *)dw_dialog_wait(dwwait); | 12716 return (char *)dw_dialog_wait(dwwait); |
12717 } | 12717 } |
12718 else | 12718 else |
12719 { | 12719 { |
12720 FILEDLG fild = { 0 }; | 12720 FILEDLG fild = { 0 }; |
12783 } | 12783 } |
12784 return NULL; | 12784 return NULL; |
12785 } | 12785 } |
12786 | 12786 |
12787 /* Internal function to set drive and directory */ | 12787 /* Internal function to set drive and directory */ |
12788 int _SetPath(char *path) | 12788 int _dw_set_path(char *path) |
12789 { | 12789 { |
12790 #ifndef __WATCOMC__ | 12790 #ifndef __WATCOMC__ |
12791 if(strlen(path) > 2) | 12791 if(strlen(path) > 2) |
12792 { | 12792 { |
12793 if(path[1] == ':') | 12793 if(path[1] == ':') |
12832 | 12832 |
12833 PrfQueryProfileString(HINI_USERPROFILE, (PSZ)"WPURLDEFAULTSETTINGS", | 12833 PrfQueryProfileString(HINI_USERPROFILE, (PSZ)"WPURLDEFAULTSETTINGS", |
12834 (PSZ)"DefaultWorkingDir", NULL, (PSZ)browser, 1024); | 12834 (PSZ)"DefaultWorkingDir", NULL, (PSZ)browser, 1024); |
12835 | 12835 |
12836 if(browser[0]) | 12836 if(browser[0]) |
12837 _SetPath(browser); | 12837 _dw_set_path(browser); |
12838 | 12838 |
12839 PrfQueryProfileString(HINI_USERPROFILE, (PSZ)"WPURLDEFAULTSETTINGS", | 12839 PrfQueryProfileString(HINI_USERPROFILE, (PSZ)"WPURLDEFAULTSETTINGS", |
12840 (PSZ)"DefaultBrowserExe", NULL, (PSZ)browser, 1024); | 12840 (PSZ)"DefaultBrowserExe", NULL, (PSZ)browser, 1024); |
12841 | 12841 |
12842 len = strlen(browser) - strlen("explore.exe"); | 12842 len = strlen(browser) - strlen("explore.exe"); |
12869 | 12869 |
12870 ret = dw_exec(browser, DW_EXEC_GUI, execargs); | 12870 ret = dw_exec(browser, DW_EXEC_GUI, execargs); |
12871 | 12871 |
12872 if(olddir) | 12872 if(olddir) |
12873 { | 12873 { |
12874 _SetPath(olddir); | 12874 _dw_set_path(olddir); |
12875 free(olddir); | 12875 free(olddir); |
12876 } | 12876 } |
12877 if(newurl) | 12877 if(newurl) |
12878 free(newurl); | 12878 free(newurl); |
12879 return ret; | 12879 return ret; |
13008 dw_dialog_dismiss(dwwait, (void *)result); | 13008 dw_dialog_dismiss(dwwait, (void *)result); |
13009 return FALSE; | 13009 return FALSE; |
13010 } | 13010 } |
13011 | 13011 |
13012 /* Borrowed functions which should probably be rewritten */ | 13012 /* Borrowed functions which should probably be rewritten */ |
13013 BOOL _ExtractLogAddress(char * LogAddress, char * DetailStr) | 13013 BOOL _dw_extract_log_address(char * LogAddress, char * DetailStr) |
13014 { | 13014 { |
13015 char *p; | 13015 char *p; |
13016 | 13016 |
13017 p = DetailStr; | 13017 p = DetailStr; |
13018 while(*p++ != ';'); /* Gets to first ';' and one char beyond */ | 13018 while(*p++ != ';'); /* Gets to first ';' and one char beyond */ |
13020 while(*p != ';') *LogAddress++ = *p++; | 13020 while(*p != ';') *LogAddress++ = *p++; |
13021 *LogAddress = '\0'; | 13021 *LogAddress = '\0'; |
13022 return TRUE; | 13022 return TRUE; |
13023 } | 13023 } |
13024 | 13024 |
13025 BOOL _ExtractDriverName(char * DriverName, char * DetailStr) | 13025 BOOL _dw_extract_driver_name(char * DriverName, char * DetailStr) |
13026 { | 13026 { |
13027 char *p; | 13027 char *p; |
13028 | 13028 |
13029 p = DetailStr; | 13029 p = DetailStr; |
13030 while(*p++ != ';'); /* Gets to first ';' and one char beyond */ | 13030 while(*p++ != ';'); /* Gets to first ';' and one char beyond */ |
13205 char LogAddress[32]; | 13205 char LogAddress[32]; |
13206 DEVOPENSTRUC dop; | 13206 DEVOPENSTRUC dop; |
13207 | 13207 |
13208 /* Get the printer information string */ | 13208 /* Get the printer information string */ |
13209 cb = PrfQueryProfileString(HINI_PROFILE, (PSZ)"PM_SPOOLER_PRINTER", (PSZ)print->printername, (PSZ)"", PrintDetails, 256); | 13209 cb = PrfQueryProfileString(HINI_PROFILE, (PSZ)"PM_SPOOLER_PRINTER", (PSZ)print->printername, (PSZ)"", PrintDetails, 256); |
13210 _ExtractLogAddress(LogAddress, PrintDetails); | 13210 _dw_extract_log_address(LogAddress, PrintDetails); |
13211 _ExtractDriverName(DriverName, PrintDetails); | 13211 _dw_extract_driver_name(DriverName, PrintDetails); |
13212 dop.pszDriverName = (PSZ)DriverName; | 13212 dop.pszDriverName = (PSZ)DriverName; |
13213 dop.pszLogAddress = (PSZ)LogAddress; | 13213 dop.pszLogAddress = (PSZ)LogAddress; |
13214 dop.pdriv = NULL; | 13214 dop.pdriv = NULL; |
13215 dop.pszDataType = (PSZ)"PM_Q_STD"; | 13215 dop.pszDataType = (PSZ)"PM_Q_STD"; |
13216 /* Attempt to open a device context and return a handle to it */ | 13216 /* Attempt to open a device context and return a handle to it */ |
13354 * function: Function pointer to be called. | 13354 * function: Function pointer to be called. |
13355 * data: Pointer to the data to be passed to the function. | 13355 * data: Pointer to the data to be passed to the function. |
13356 */ | 13356 */ |
13357 void API dw_window_function(HWND handle, void *function, void *data) | 13357 void API dw_window_function(HWND handle, void *function, void *data) |
13358 { | 13358 { |
13359 WinSendMsg(_toplevel_window(handle), WM_USER, (MPARAM)function, (MPARAM)data); | 13359 WinSendMsg(_dw_toplevel_window(handle), WM_USER, (MPARAM)function, (MPARAM)data); |
13360 } | 13360 } |
13361 | 13361 |
13362 /* Functions for managing the user data lists that are associated with | 13362 /* Functions for managing the user data lists that are associated with |
13363 * a given window handle. Used in dw_window_set_data() and | 13363 * a given window handle. Used in dw_window_set_data() and |
13364 * dw_window_get_data(). | 13364 * dw_window_get_data(). |
13365 */ | 13365 */ |
13366 UserData *_find_userdata(UserData **root, const char *varname) | 13366 UserData *_dw_find_userdata(UserData **root, const char *varname) |
13367 { | 13367 { |
13368 UserData *tmp = *root; | 13368 UserData *tmp = *root; |
13369 | 13369 |
13370 while(tmp) | 13370 while(tmp) |
13371 { | 13371 { |
13374 tmp = tmp->next; | 13374 tmp = tmp->next; |
13375 } | 13375 } |
13376 return NULL; | 13376 return NULL; |
13377 } | 13377 } |
13378 | 13378 |
13379 int _new_userdata(UserData **root, const char *varname, void *data) | 13379 int _dw_new_userdata(UserData **root, const char *varname, void *data) |
13380 { | 13380 { |
13381 UserData *new = _find_userdata(root, varname); | 13381 UserData *new = _dw_find_userdata(root, varname); |
13382 | 13382 |
13383 if(new) | 13383 if(new) |
13384 { | 13384 { |
13385 new->data = data; | 13385 new->data = data; |
13386 return TRUE; | 13386 return TRUE; |
13412 } | 13412 } |
13413 } | 13413 } |
13414 return FALSE; | 13414 return FALSE; |
13415 } | 13415 } |
13416 | 13416 |
13417 int _remove_userdata(UserData **root, const char *varname, int all) | 13417 int _dw_remove_userdata(UserData **root, const char *varname, int all) |
13418 { | 13418 { |
13419 UserData *prev = NULL, *tmp = *root; | 13419 UserData *prev = NULL, *tmp = *root; |
13420 | 13420 |
13421 while(tmp) | 13421 while(tmp) |
13422 { | 13422 { |
13470 blah = calloc(1, sizeof(WindowData)); | 13470 blah = calloc(1, sizeof(WindowData)); |
13471 WinSetWindowPtr(window, QWP_USER, blah); | 13471 WinSetWindowPtr(window, QWP_USER, blah); |
13472 } | 13472 } |
13473 | 13473 |
13474 if(data) | 13474 if(data) |
13475 _new_userdata(&(blah->root), dataname, data); | 13475 _dw_new_userdata(&(blah->root), dataname, data); |
13476 else | 13476 else |
13477 { | 13477 { |
13478 if(dataname) | 13478 if(dataname) |
13479 _remove_userdata(&(blah->root), dataname, FALSE); | 13479 _dw_remove_userdata(&(blah->root), dataname, FALSE); |
13480 else | 13480 else |
13481 _remove_userdata(&(blah->root), NULL, TRUE); | 13481 _dw_remove_userdata(&(blah->root), NULL, TRUE); |
13482 } | 13482 } |
13483 } | 13483 } |
13484 | 13484 |
13485 /* | 13485 /* |
13486 * Gets a named user data item to a window handle. | 13486 * Gets a named user data item to a window handle. |
13493 { | 13493 { |
13494 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); | 13494 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
13495 | 13495 |
13496 if(blah && blah->root && dataname) | 13496 if(blah && blah->root && dataname) |
13497 { | 13497 { |
13498 UserData *ud = _find_userdata(&(blah->root), dataname); | 13498 UserData *ud = _dw_find_userdata(&(blah->root), dataname); |
13499 if(ud) | 13499 if(ud) |
13500 return ud->data; | 13500 return ud->data; |
13501 } | 13501 } |
13502 return NULL; | 13502 return NULL; |
13503 } | 13503 } |
13535 { | 13535 { |
13536 HTIMER timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval); | 13536 HTIMER timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval); |
13537 | 13537 |
13538 if(timerid) | 13538 if(timerid) |
13539 { | 13539 { |
13540 _new_signal(WM_TIMER, NULLHANDLE, timerid, sigfunc, NULL, data); | 13540 _dw_new_signal(WM_TIMER, NULLHANDLE, timerid, sigfunc, NULL, data); |
13541 return timerid; | 13541 return timerid; |
13542 } | 13542 } |
13543 } | 13543 } |
13544 return 0; | 13544 return 0; |
13545 } | 13545 } |
13610 { | 13610 { |
13611 ULONG message = 0, id = 0; | 13611 ULONG message = 0, id = 0; |
13612 | 13612 |
13613 if(window && signame && sigfunc) | 13613 if(window && signame && sigfunc) |
13614 { | 13614 { |
13615 if((message = _findsigmessage(signame)) != 0) | 13615 if((message = _dw_findsigmessage(signame)) != 0) |
13616 { | 13616 { |
13617 /* Handle special case of the menu item */ | 13617 /* Handle special case of the menu item */ |
13618 if(message == WM_COMMAND && window < 65536) | 13618 if(message == WM_COMMAND && window < 65536) |
13619 { | 13619 { |
13620 char buffer[15]; | 13620 char buffer[15]; |
13630 { | 13630 { |
13631 id = window; | 13631 id = window; |
13632 window = owner; | 13632 window = owner; |
13633 } | 13633 } |
13634 } | 13634 } |
13635 _new_signal(message, window, id, sigfunc, discfunc, data); | 13635 _dw_new_signal(message, window, id, sigfunc, discfunc, data); |
13636 } | 13636 } |
13637 } | 13637 } |
13638 } | 13638 } |
13639 | 13639 |
13640 /* | 13640 /* |
13645 void API dw_signal_disconnect_by_name(HWND window, const char *signame) | 13645 void API dw_signal_disconnect_by_name(HWND window, const char *signame) |
13646 { | 13646 { |
13647 SignalHandler *prev = NULL, *tmp = Root; | 13647 SignalHandler *prev = NULL, *tmp = Root; |
13648 ULONG message; | 13648 ULONG message; |
13649 | 13649 |
13650 if(!window || !signame || (message = _findsigmessage(signame)) == 0) | 13650 if(!window || !signame || (message = _dw_findsigmessage(signame)) == 0) |
13651 return; | 13651 return; |
13652 | 13652 |
13653 while(tmp) | 13653 while(tmp) |
13654 { | 13654 { |
13655 if(((window < 65536 && tmp->id == window) || tmp->window == window) && tmp->message == message) | 13655 if(((window < 65536 && tmp->id == window) || tmp->window == window) && tmp->message == message) |
13843 * or NULL on failure. | 13843 * or NULL on failure. |
13844 */ | 13844 */ |
13845 wchar_t * API dw_utf8_to_wchar(const char *utf8string) | 13845 wchar_t * API dw_utf8_to_wchar(const char *utf8string) |
13846 { | 13846 { |
13847 #ifdef UNICODE | 13847 #ifdef UNICODE |
13848 return _UTF8toWide((char *)utf8string); | 13848 return _dw_UTF8toWide((char *)utf8string); |
13849 #else | 13849 #else |
13850 return NULL; | 13850 return NULL; |
13851 #endif | 13851 #endif |
13852 } | 13852 } |
13853 | 13853 |
13860 * or NULL on failure. | 13860 * or NULL on failure. |
13861 */ | 13861 */ |
13862 char * API dw_wchar_to_utf8(const wchar_t *wstring) | 13862 char * API dw_wchar_to_utf8(const wchar_t *wstring) |
13863 { | 13863 { |
13864 #ifdef UNICODE | 13864 #ifdef UNICODE |
13865 return _WideToUTF8((wchar_t *)wstring); | 13865 return _dw_WideToUTF8((wchar_t *)wstring); |
13866 #else | 13866 #else |
13867 return NULL; | 13867 return NULL; |
13868 #endif | 13868 #endif |
13869 } | 13869 } |
13870 | 13870 |