comparison win/dw.c @ 1601:71e0a3ad07f7

Enable level 3 warnings in DEBUG mode with Visual C to show deprecation warnings. Source code cleanup to eliminate the warnings now generated on this level.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 26 Feb 2012 09:21:35 +0000
parents a80ec948c3eb
children 02641cd81203
comparison
equal deleted inserted replaced
1600:cbfdd56e3e72 1601:71e0a3ad07f7
210 HFONT _DefaultFont = NULL; 210 HFONT _DefaultFont = NULL;
211 211
212 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) && !defined(__MINGW32__) 212 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) && !defined(__MINGW32__)
213 LRESULT CALLBACK _browserWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 213 LRESULT CALLBACK _browserWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
214 #endif 214 #endif
215 BOOL CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2); 215 LRESULT CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2);
216 void _resize_notebook_page(HWND handle, int pageid); 216 void _resize_notebook_page(HWND handle, int pageid);
217 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); 217 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y);
218 int _lookup_icon(HWND handle, HICON hicon, int type); 218 int _lookup_icon(HWND handle, HICON hicon, int type);
219 HFONT _acquire_font(HWND handle, char *fontname); 219 HFONT _acquire_font(HWND handle, char *fontname);
220 void _click_default(HWND handle); 220 void _click_default(HWND handle);
345 inquotes = 1; 345 inquotes = 1;
346 } 346 }
347 else if(*tmp == ' ' && !inquotes) 347 else if(*tmp == ' ' && !inquotes)
348 { 348 {
349 *tmp = 0; 349 *tmp = 0;
350 argv[loc] = strdup(argstart); 350 argv[loc] = _strdup(argstart);
351 351
352 /* Push past any white space */ 352 /* Push past any white space */
353 while(*(tmp+1) == ' ') 353 while(*(tmp+1) == ' ')
354 tmp++; 354 tmp++;
355 355
363 loc++; 363 loc++;
364 } 364 }
365 tmp++; 365 tmp++;
366 } 366 }
367 if(*argstart) 367 if(*argstart)
368 argv[loc] = strdup(argstart); 368 argv[loc] = _strdup(argstart);
369 } 369 }
370 argv[loc+1] = NULL; 370 argv[loc+1] = NULL;
371 return argv; 371 return argv;
372 } 372 }
373 373
445 }; 445 };
446 446
447 /* Section for loading files of types besides BMP and ICO and return HBITMAP or HICON */ 447 /* Section for loading files of types besides BMP and ICO and return HBITMAP or HICON */
448 void *_dw_load_gpbitmap( char *filename ) 448 void *_dw_load_gpbitmap( char *filename )
449 { 449 {
450 int i, wclen = (strlen(filename) + 6) * sizeof(wchar_t); 450 int i, wclen = (int)(strlen(filename) + 6) * sizeof(wchar_t);
451 char *file = _alloca(strlen(filename) + 6); 451 char *file = _alloca(strlen(filename) + 6);
452 wchar_t *wfile = _alloca(wclen); 452 wchar_t *wfile = _alloca(wclen);
453 void *image; 453 void *image;
454 454
455 /* Try various extentions */ 455 /* Try various extentions */
458 strcpy( file, filename ); 458 strcpy( file, filename );
459 strcat( file, image_exts[i] ); 459 strcat( file, image_exts[i] );
460 if ( _access( file, 04 ) == 0 ) 460 if ( _access( file, 04 ) == 0 )
461 { 461 {
462 /* Convert to wide format */ 462 /* Convert to wide format */
463 MultiByteToWideChar(CP_ACP, 0, file, strlen(file)+1, wfile, wclen); 463 MultiByteToWideChar(CP_ACP, 0, file, (int)strlen(file)+1, wfile, wclen);
464 if(!GdipCreateBitmapFromFile(wfile, &image)) 464 if(!GdipCreateBitmapFromFile(wfile, &image))
465 return image; 465 return image;
466 } 466 }
467 } 467 }
468 return NULL; 468 return NULL;
593 { 593 {
594 int z; 594 int z;
595 595
596 for(z=0;z<SIGNALMAX;z++) 596 for(z=0;z<SIGNALMAX;z++)
597 { 597 {
598 if(stricmp(signame, SignalTranslate[z].name) == 0) 598 if(_stricmp(signame, SignalTranslate[z].name) == 0)
599 return SignalTranslate[z].message; 599 return SignalTranslate[z].message;
600 } 600 }
601 return 0L; 601 return 0L;
602 } 602 }
603 603
621 if(oldfont) 621 if(oldfont)
622 DeleteObject(oldfont); 622 DeleteObject(oldfont);
623 if(oldicon) 623 if(oldicon)
624 DeleteObject(oldicon); 624 DeleteObject(oldicon);
625 625
626 if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) 626 if(_strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0)
627 { 627 {
628 HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); 628 HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0);
629 629
630 if(oldbitmap) 630 if(oldbitmap)
631 DeleteObject(oldbitmap); 631 DeleteObject(oldbitmap);
632 } 632 }
633 if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0) 633 if(_strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0)
634 { 634 {
635 HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); 635 HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0);
636 636
637 if(oldbitmap) 637 if(oldbitmap)
638 DeleteObject(oldbitmap); 638 DeleteObject(oldbitmap);
639 } 639 }
640 else if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) 640 else if(_strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0)
641 { 641 {
642 Box *box = (Box *)thiscinfo; 642 Box *box = (Box *)thiscinfo;
643 643
644 if(box && box->count && box->items) 644 if(box && box->count && box->items)
645 free(box->items); 645 free(box->items);
646 } 646 }
647 else if(strnicmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) 647 else if(_strnicmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
648 { 648 {
649 void *data = dw_window_get_data(handle, "_dw_percent"); 649 void *data = dw_window_get_data(handle, "_dw_percent");
650 650
651 if(data) 651 if(data)
652 free(data); 652 free(data);
653 } 653 }
654 else if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)==0) 654 else if(_strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)==0)
655 { 655 {
656 dw_tree_clear(handle); 656 dw_tree_clear(handle);
657 } 657 }
658 else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL)+1)==0) /* Notebook */ 658 else if(_strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL)+1)==0) /* Notebook */
659 { 659 {
660 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); 660 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array");
661 661
662 if(array) 662 if(array)
663 { 663 {
674 } 674 }
675 } 675 }
676 free(array); 676 free(array);
677 } 677 }
678 } 678 }
679 else if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) 679 else if(_strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0)
680 { 680 {
681 /* for spinbuttons, we need to get the spinbutton's "buddy", the text window associated and destroy it */ 681 /* for spinbuttons, we need to get the spinbutton's "buddy", the text window associated and destroy it */
682 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); 682 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
683 683
684 if(cinfo && cinfo->buddy) 684 if(cinfo && cinfo->buddy)
768 GetClassName(handle, tmpbuf, 99); 768 GetClassName(handle, tmpbuf, 99);
769 769
770 /* These are the window classes which can 770 /* These are the window classes which can
771 * obtain input focus. 771 * obtain input focus.
772 */ 772 */
773 if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1)==0 || /* Entryfield */ 773 if(_strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1)==0 || /* Entryfield */
774 strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0 || /* Button */ 774 _strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0 || /* Button */
775 strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0 || /* Combobox */ 775 _strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0 || /* Combobox */
776 strnicmp(tmpbuf, LISTBOXCLASSNAME, strlen(LISTBOXCLASSNAME)+1)==0 || /* List box */ 776 _strnicmp(tmpbuf, LISTBOXCLASSNAME, strlen(LISTBOXCLASSNAME)+1)==0 || /* List box */
777 strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0 || /* Spinbutton */ 777 _strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0 || /* Spinbutton */
778 strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1)==0 || /* Slider */ 778 _strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1)==0 || /* Slider */
779 strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0 || /* Container */ 779 _strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0 || /* Container */
780 strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) /* Tree */ 780 _strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) /* Tree */
781 return 1; 781 return 1;
782 return 0; 782 return 0;
783 } 783 }
784 784
785 HWND _normalize_handle(HWND handle) 785 HWND _normalize_handle(HWND handle)
786 { 786 {
787 char tmpbuf[100] = {0}; 787 char tmpbuf[100] = {0};
788 788
789 GetClassName(handle, tmpbuf, 99); 789 GetClassName(handle, tmpbuf, 99);
790 if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0) /* Spinner */ 790 if(_strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS))==0) /* Spinner */
791 { 791 {
792 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); 792 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
793 793
794 if(cinfo && cinfo->buddy) 794 if(cinfo && cinfo->buddy)
795 return cinfo->buddy; 795 return cinfo->buddy;
796 } 796 }
797 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==0) /* Combobox */ 797 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME))==0) /* Combobox */
798 { 798 {
799 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); 799 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
800 800
801 if(cinfo && cinfo->buddy) 801 if(cinfo && cinfo->buddy)
802 return cinfo->buddy; 802 return cinfo->buddy;
905 905
906 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) 906 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem))
907 return 1; 907 return 1;
908 } 908 }
909 } 909 }
910 else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ 910 else if(_strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */
911 { 911 {
912 NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array"); 912 NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array");
913 int pageid = TabCtrl_GetCurSel(box->items[z].hwnd); 913 int pageid = TabCtrl_GetCurSel(box->items[z].hwnd);
914 914
915 if(pageid > -1 && array && array[pageid]) 915 if(pageid > -1 && array && array[pageid])
923 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) 923 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem))
924 return 1; 924 return 1;
925 } 925 }
926 } 926 }
927 } 927 }
928 else if(strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName))==0) /* Scroll Box */ 928 else if(_strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName))==0) /* Scroll Box */
929 { 929 {
930 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(box->items[z].hwnd, GWLP_USERDATA); 930 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(box->items[z].hwnd, GWLP_USERDATA);
931 Box *scrollbox = (Box *)GetWindowLongPtr(cinfo->combo, GWLP_USERDATA); 931 Box *scrollbox = (Box *)GetWindowLongPtr(cinfo->combo, GWLP_USERDATA);
932 932
933 if(scrollbox && _focus_check_box(scrollbox, handle, start == 3 ? 3 : 0, defaultitem)) 933 if(scrollbox && _focus_check_box(scrollbox, handle, start == 3 ? 3 : 0, defaultitem))
1040 1040
1041 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) 1041 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem))
1042 return 1; 1042 return 1;
1043 } 1043 }
1044 } 1044 }
1045 else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ 1045 else if(_strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */
1046 { 1046 {
1047 NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array"); 1047 NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array");
1048 int pageid = TabCtrl_GetCurSel(box->items[z].hwnd); 1048 int pageid = TabCtrl_GetCurSel(box->items[z].hwnd);
1049 1049
1050 if(pageid > -1 && array && array[pageid]) 1050 if(pageid > -1 && array && array[pageid])
1058 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem)) 1058 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem))
1059 return 1; 1059 return 1;
1060 } 1060 }
1061 } 1061 }
1062 } 1062 }
1063 else if(strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName))==0) /* Scroll Box */ 1063 else if(_strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName))==0) /* Scroll Box */
1064 { 1064 {
1065 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(box->items[z].hwnd, GWLP_USERDATA); 1065 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(box->items[z].hwnd, GWLP_USERDATA);
1066 Box *scrollbox = (Box *)GetWindowLongPtr(cinfo->combo, GWLP_USERDATA); 1066 Box *scrollbox = (Box *)GetWindowLongPtr(cinfo->combo, GWLP_USERDATA);
1067 1067
1068 if(scrollbox && _focus_check_box_back(scrollbox, handle, start == 3 ? 3 : 0, defaultitem)) 1068 if(scrollbox && _focus_check_box_back(scrollbox, handle, start == 3 ? 3 : 0, defaultitem))
1085 if(!handle) 1085 if(!handle)
1086 return; 1086 return;
1087 1087
1088 GetClassName(handle, tmpbuf, 99); 1088 GetClassName(handle, tmpbuf, 99);
1089 1089
1090 if(strnicmp(tmpbuf, ClassName, strlen(ClassName)+1)!=0) 1090 if(_strnicmp(tmpbuf, ClassName, strlen(ClassName)+1)!=0)
1091 return; 1091 return;
1092 1092
1093 1093
1094 if(handle) 1094 if(handle)
1095 thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); 1095 thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA);
1364 HWND handle = thisbox->items[z].hwnd; 1364 HWND handle = thisbox->items[z].hwnd;
1365 char tmpbuf[100] = {0}; 1365 char tmpbuf[100] = {0};
1366 1366
1367 GetClassName(handle, tmpbuf, 99); 1367 GetClassName(handle, tmpbuf, 99);
1368 1368
1369 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 1369 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
1370 { 1370 {
1371 /* Handle special case Combobox */ 1371 /* Handle special case Combobox */
1372 MoveWindow(handle, currentx + pad, currenty + pad, 1372 MoveWindow(handle, currentx + pad, currenty + pad,
1373 width, height + 400, FALSE); 1373 width, height + 400, FALSE);
1374 } 1374 }
1375 else if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0) 1375 else if(_strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1)==0)
1376 { 1376 {
1377 /* Handle special case Spinbutton */ 1377 /* Handle special case Spinbutton */
1378 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); 1378 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
1379 1379
1380 MoveWindow(handle, currentx + pad + (width - 20), currenty + pad, 1380 MoveWindow(handle, currentx + pad + (width - 20), currenty + pad,
1460 width, height, FALSE); 1460 width, height, FALSE);
1461 1461
1462 if(percent && width > 0 && height > 0) 1462 if(percent && width > 0 && height > 0)
1463 _handle_splitbar_resize(handle, *percent, type, width, height); 1463 _handle_splitbar_resize(handle, *percent, type, width, height);
1464 } 1464 }
1465 else if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) 1465 else if(_strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0)
1466 { 1466 {
1467 /* Handle special case Vertically Center static text */ 1467 /* Handle special case Vertically Center static text */
1468 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); 1468 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
1469 1469
1470 if(cinfo && cinfo->vcenter) 1470 if(cinfo && cinfo->vcenter)
1533 rect.right - rect.left, rect.bottom-rect.top, FALSE); 1533 rect.right - rect.left, rect.bottom-rect.top, FALSE);
1534 dw_window_redraw(array[pageid]->hwnd); 1534 dw_window_redraw(array[pageid]->hwnd);
1535 } 1535 }
1536 } 1536 }
1537 /* So does the List View... handle delayed cursoring */ 1537 /* So does the List View... handle delayed cursoring */
1538 if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0 && width > 10 && height > 10) 1538 if(_strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0 && width > 10 && height > 10)
1539 { 1539 {
1540 int index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_cursor")); 1540 int index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_cursor"));
1541 1541
1542 if(index > 0) 1542 if(index > 0)
1543 ListView_EnsureVisible(handle, index, TRUE); 1543 ListView_EnsureVisible(handle, index, TRUE);
1591 pos = si.nMin; 1591 pos = si.nMin;
1592 return pos; 1592 return pos;
1593 /*case SB_PAGEDOWN:*/ 1593 /*case SB_PAGEDOWN:*/
1594 case SB_PAGERIGHT: 1594 case SB_PAGERIGHT:
1595 pos = si.nPos + si.nPage; 1595 pos = si.nPos + si.nPage;
1596 if(pos > (si.nMax - si.nPage) + 1) 1596 if(pos > (int)(si.nMax - si.nPage) + 1)
1597 pos = (si.nMax - si.nPage) + 1; 1597 pos = (si.nMax - si.nPage) + 1;
1598 return pos; 1598 return pos;
1599 /*case SB_LINEUP:*/ 1599 /*case SB_LINEUP:*/
1600 case SB_LINELEFT: 1600 case SB_LINELEFT:
1601 pos = si.nPos - 1; 1601 pos = si.nPos - 1;
1603 pos = si.nMin; 1603 pos = si.nMin;
1604 return pos; 1604 return pos;
1605 /*case SB_LINEDOWN:*/ 1605 /*case SB_LINEDOWN:*/
1606 case SB_LINERIGHT: 1606 case SB_LINERIGHT:
1607 pos = si.nPos + 1; 1607 pos = si.nPos + 1;
1608 if(pos > (si.nMax - si.nPage) + 1) 1608 if(pos > (int)(si.nMax - si.nPage) + 1)
1609 pos = (si.nMax - si.nPage) + 1; 1609 pos = (si.nMax - si.nPage) + 1;
1610 return pos; 1610 return pos;
1611 } 1611 }
1612 return -1; 1612 return -1;
1613 } 1613 }
1652 if ( checkable ) 1652 if ( checkable )
1653 { 1653 {
1654 int is_checked; 1654 int is_checked;
1655 sprintf( buffer, "_dw_ischecked%d", id ); 1655 sprintf( buffer, "_dw_ischecked%d", id );
1656 is_checked = (int)dw_window_get_data(DW_HWND_OBJECT, buffer); 1656 is_checked = (int)dw_window_get_data(DW_HWND_OBJECT, buffer);
1657 is_checked = (is_checked) ? 0 : 1; 1657 is_checked = (is_checked) ? DW_MIS_UNCHECKED : DW_MIS_CHECKED;
1658 dw_menu_item_set_check( window, id, is_checked ); 1658 dw_menu_item_set_state( window, id, is_checked );
1659 } 1659 }
1660 } 1660 }
1661 1661
1662 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ 1662 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
1663 BOOL CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 1663 LRESULT CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
1664 { 1664 {
1665 int result = -1, taskbar = FALSE; 1665 int result = -1, taskbar = FALSE;
1666 static int command_active = 0; 1666 static int command_active = 0;
1667 SignalHandler *tmp = Root; 1667 SignalHandler *tmp = Root;
1668 void (*windowfunc)(PVOID); 1668 void (*windowfunc)(PVOID);
1841 special |= KC_ALT; 1841 special |= KC_ALT;
1842 1842
1843 if(origmsg == WM_CHAR && mp1 < 128) 1843 if(origmsg == WM_CHAR && mp1 < 128)
1844 ch = (char)mp1; 1844 ch = (char)mp1;
1845 1845
1846 result = keypressfunc(tmp->window, ch, mp1, special, tmp->data); 1846 result = keypressfunc(tmp->window, ch, (int)mp1, special, tmp->data);
1847 tmp = NULL; 1847 tmp = NULL;
1848 } 1848 }
1849 } 1849 }
1850 break; 1850 break;
1851 case WM_CLOSE: 1851 case WM_CLOSE:
1887 NMLISTVIEW FAR *lem=(NMLISTVIEW FAR *)mp2; 1887 NMLISTVIEW FAR *lem=(NMLISTVIEW FAR *)mp2;
1888 char tmpbuf[100] = {0}; 1888 char tmpbuf[100] = {0};
1889 1889
1890 GetClassName(tem->hdr.hwndFrom, tmpbuf, 99); 1890 GetClassName(tem->hdr.hwndFrom, tmpbuf, 99);
1891 1891
1892 if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW))==0) 1892 if(_strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW))==0)
1893 { 1893 {
1894 if(tem->hdr.code == TVN_SELCHANGED && tmp->message == TVN_SELCHANGED) 1894 if(tem->hdr.code == TVN_SELCHANGED && tmp->message == TVN_SELCHANGED)
1895 { 1895 {
1896 if(tmp->window == tem->hdr.hwndFrom && !dw_window_get_data(tmp->window, "_dw_select_item")) 1896 if(tmp->window == tem->hdr.hwndFrom && !dw_window_get_data(tmp->window, "_dw_select_item"))
1897 { 1897 {
1955 containercontextfunc(tmp->window, ptrs ? (char *)ptrs[0] : NULL, x, y, tmp->data, ptrs ? ptrs[1] : NULL); 1955 containercontextfunc(tmp->window, ptrs ? (char *)ptrs[0] : NULL, x, y, tmp->data, ptrs ? ptrs[1] : NULL);
1956 tmp = NULL; 1956 tmp = NULL;
1957 } 1957 }
1958 } 1958 }
1959 } 1959 }
1960 else if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0) 1960 else if(_strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0)
1961 { 1961 {
1962 if((lem->hdr.code == LVN_ITEMCHANGED && (lem->uChanged & LVIF_STATE)) && tmp->message == TVN_SELCHANGED) 1962 if((lem->hdr.code == LVN_ITEMCHANGED && (lem->uChanged & LVIF_STATE)) && tmp->message == TVN_SELCHANGED)
1963 { 1963 {
1964 if(tmp->window == tem->hdr.hwndFrom) 1964 if(tmp->window == tem->hdr.hwndFrom)
1965 { 1965 {
2064 if(!GetClassName(handle, tmpbuf, 99)) 2064 if(!GetClassName(handle, tmpbuf, 99))
2065 { 2065 {
2066 GetClassName(hWnd, tmpbuf, 99); 2066 GetClassName(hWnd, tmpbuf, 99);
2067 } 2067 }
2068 2068
2069 if (strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1)==0) 2069 if (_strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1)==0)
2070 { 2070 {
2071 2071
2072 if (handle == tmp->window) 2072 if (handle == tmp->window)
2073 { 2073 {
2074 int value = (int)SendMessage(handle, TBM_GETPOS, 0, 0); 2074 int value = (int)SendMessage(handle, TBM_GETPOS, 0, 0);
2080 else 2080 else
2081 result = valuechangefunc(tmp->window, value, tmp->data); 2081 result = valuechangefunc(tmp->window, value, tmp->data);
2082 tmp = NULL; 2082 tmp = NULL;
2083 } 2083 }
2084 } 2084 }
2085 else if(strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1)==0) 2085 else if(_strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1)==0)
2086 { 2086 {
2087 if(handle == tmp->window) 2087 if(handle == tmp->window)
2088 { 2088 {
2089 int bar = (origmsg == WM_HSCROLL) ? SB_HORZ : SB_VERT; 2089 int bar = (origmsg == WM_HSCROLL) ? SB_HORZ : SB_VERT;
2090 int value = _HandleScroller(handle, bar, (int)HIWORD(mp1), (int)LOWORD(mp1)); 2090 int value = _HandleScroller(handle, bar, (int)HIWORD(mp1), (int)LOWORD(mp1));
2112 switch( msg ) 2112 switch( msg )
2113 { 2113 {
2114 #ifdef AEROGLASS 2114 #ifdef AEROGLASS
2115 case WM_DWMCOMPOSITIONCHANGED: 2115 case WM_DWMCOMPOSITIONCHANGED:
2116 { 2116 {
2117 DWORD styleex = GetWindowLongPtr(hWnd, GWL_EXSTYLE); 2117 LONG_PTR styleex = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
2118 2118
2119 if(_DwmIsCompositionEnabled) 2119 if(_DwmIsCompositionEnabled)
2120 _DwmIsCompositionEnabled(&_dw_composition); 2120 _DwmIsCompositionEnabled(&_dw_composition);
2121 2121
2122 /* If we are no longer compositing... disable layered windows */ 2122 /* If we are no longer compositing... disable layered windows */
2229 else 2229 else
2230 { 2230 {
2231 char tmpbuf[100] = {0}; 2231 char tmpbuf[100] = {0};
2232 2232
2233 GetClassName( hWnd, tmpbuf, 99 ); 2233 GetClassName( hWnd, tmpbuf, 99 );
2234 if ( strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1 ) == 0 ) 2234 if ( _strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1 ) == 0 )
2235 { 2235 {
2236 _HandleScroller(hWnd, bar, (int)HIWORD(mp1), (int)LOWORD(mp1)); 2236 _HandleScroller(hWnd, bar, (int)HIWORD(mp1), (int)LOWORD(mp1));
2237 } 2237 }
2238 } 2238 }
2239 } 2239 }
2291 VOID CALLBACK _TimerProc(HWND hwnd, UINT msg, UINT_PTR idEvent, DWORD dwTime) 2291 VOID CALLBACK _TimerProc(HWND hwnd, UINT msg, UINT_PTR idEvent, DWORD dwTime)
2292 { 2292 {
2293 _wndproc(hwnd, msg, (WPARAM)idEvent, 0); 2293 _wndproc(hwnd, msg, (WPARAM)idEvent, 0);
2294 } 2294 }
2295 2295
2296 BOOL CALLBACK _framewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 2296 LRESULT CALLBACK _framewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
2297 { 2297 {
2298 switch( msg ) 2298 switch( msg )
2299 { 2299 {
2300 case WM_LBUTTONDOWN: 2300 case WM_LBUTTONDOWN:
2301 case WM_MBUTTONDOWN: 2301 case WM_MBUTTONDOWN:
2395 break; 2395 break;
2396 } 2396 }
2397 return DefWindowProc(hWnd, msg, mp1, mp2); 2397 return DefWindowProc(hWnd, msg, mp1, mp2);
2398 } 2398 }
2399 2399
2400 BOOL CALLBACK _rendwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 2400 LRESULT CALLBACK _rendwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
2401 { 2401 {
2402 BOOL rcode = TRUE; 2402 LRESULT rcode = TRUE;
2403 2403
2404 switch( msg ) 2404 switch( msg )
2405 { 2405 {
2406 case WM_LBUTTONDOWN: 2406 case WM_LBUTTONDOWN:
2407 case WM_MBUTTONDOWN: 2407 case WM_MBUTTONDOWN:
2433 if ( rcode != 0 ) 2433 if ( rcode != 0 )
2434 rcode = DefWindowProc(hWnd, msg, mp1, mp2); 2434 rcode = DefWindowProc(hWnd, msg, mp1, mp2);
2435 return rcode; 2435 return rcode;
2436 } 2436 }
2437 2437
2438 BOOL CALLBACK _spinnerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 2438 LRESULT CALLBACK _spinnerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
2439 { 2439 {
2440 ColorInfo *cinfo; 2440 ColorInfo *cinfo;
2441 2441
2442 cinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); 2442 cinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
2443 2443
2451 case WM_LBUTTONDOWN: 2451 case WM_LBUTTONDOWN:
2452 case WM_MBUTTONDOWN: 2452 case WM_MBUTTONDOWN:
2453 case WM_RBUTTONDOWN: 2453 case WM_RBUTTONDOWN:
2454 case WM_KEYDOWN: 2454 case WM_KEYDOWN:
2455 { 2455 {
2456 BOOL ret; 2456 LRESULT ret;
2457 2457
2458 if(!cinfo || !cinfo->pOldProc) 2458 if(!cinfo || !cinfo->pOldProc)
2459 ret = DefWindowProc(hWnd, msg, mp1, mp2); 2459 ret = DefWindowProc(hWnd, msg, mp1, mp2);
2460 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); 2460 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
2461 2461
2473 case WM_LBUTTONUP: 2473 case WM_LBUTTONUP:
2474 case WM_MBUTTONUP: 2474 case WM_MBUTTONUP:
2475 case WM_RBUTTONUP: 2475 case WM_RBUTTONUP:
2476 case WM_KEYUP: 2476 case WM_KEYUP:
2477 { 2477 {
2478 BOOL ret; 2478 LRESULT ret;
2479 2479
2480 if(!cinfo || !cinfo->pOldProc) 2480 if(!cinfo || !cinfo->pOldProc)
2481 ret = DefWindowProc(hWnd, msg, mp1, mp2); 2481 ret = DefWindowProc(hWnd, msg, mp1, mp2);
2482 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); 2482 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
2483 2483
2495 break; 2495 break;
2496 case WM_TIMER: 2496 case WM_TIMER:
2497 { 2497 {
2498 if(mp1 == 100) 2498 if(mp1 == 100)
2499 { 2499 {
2500 BOOL ret; 2500 LRESULT ret;
2501 2501
2502 if(cinfo && cinfo->buddy) 2502 if(cinfo && cinfo->buddy)
2503 SendMessage(cinfo->buddy, WM_USER+10, 0, 0); 2503 SendMessage(cinfo->buddy, WM_USER+10, 0, 0);
2504 2504
2505 if(!cinfo || !cinfo->pOldProc) 2505 if(!cinfo || !cinfo->pOldProc)
2546 GetClassName(handle, tmpbuf, 99); 2546 GetClassName(handle, tmpbuf, 99);
2547 2547
2548 /* These are the window classes which can 2548 /* These are the window classes which can
2549 * obtain input focus. 2549 * obtain input focus.
2550 */ 2550 */
2551 if (strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME))==0) 2551 if (_strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME))==0)
2552 { 2552 {
2553 /* Generate click on default item */ 2553 /* Generate click on default item */
2554 SignalHandler *tmp = Root; 2554 SignalHandler *tmp = Root;
2555 2555
2556 /* Find any callbacks for this function */ 2556 /* Find any callbacks for this function */
2573 else 2573 else
2574 SetFocus(handle); 2574 SetFocus(handle);
2575 } 2575 }
2576 2576
2577 /* Subclass function that will handle setting colors on controls */ 2577 /* Subclass function that will handle setting colors on controls */
2578 BOOL CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 2578 LRESULT CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
2579 { 2579 {
2580 ColorInfo *cinfo; 2580 ColorInfo *cinfo;
2581 char tmpbuf[100] = {0}; 2581 char tmpbuf[100] = {0};
2582 WNDPROC pOldProc = 0; 2582 WNDPROC pOldProc = 0;
2583 int ret = -1; 2583 LRESULT ret = -1;
2584 2584
2585 cinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); 2585 cinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
2586 2586
2587 GetClassName(hWnd, tmpbuf, 99); 2587 GetClassName(hWnd, tmpbuf, 99);
2588 if(strcmp(tmpbuf, FRAMECLASSNAME) == 0) 2588 if(strcmp(tmpbuf, FRAMECLASSNAME) == 0)
2808 } 2808 }
2809 return ret; 2809 return ret;
2810 } 2810 }
2811 2811
2812 /* Window procedure for container/listview */ 2812 /* Window procedure for container/listview */
2813 BOOL CALLBACK _containerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 2813 LRESULT CALLBACK _containerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
2814 { 2814 {
2815 ContainerInfo *continfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); 2815 ContainerInfo *continfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
2816 2816
2817 switch( msg ) 2817 switch( msg )
2818 { 2818 {
2962 if(!continfo || !continfo->cinfo.pOldProc) 2962 if(!continfo || !continfo->cinfo.pOldProc)
2963 return DefWindowProc(hWnd, msg, mp1, mp2); 2963 return DefWindowProc(hWnd, msg, mp1, mp2);
2964 return CallWindowProc(continfo->cinfo.pOldProc, hWnd, msg, mp1, mp2); 2964 return CallWindowProc(continfo->cinfo.pOldProc, hWnd, msg, mp1, mp2);
2965 } 2965 }
2966 2966
2967 BOOL CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 2967 LRESULT CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
2968 { 2968 {
2969 ContainerInfo *cinfo; 2969 ContainerInfo *cinfo;
2970 int ret = -1; 2970 LRESULT ret = -1;
2971 2971
2972 cinfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); 2972 cinfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
2973 2973
2974 switch( msg ) 2974 switch( msg )
2975 { 2975 {
3077 ShowWindow(handle1, SW_SHOW); 3077 ShowWindow(handle1, SW_SHOW);
3078 ShowWindow(handle2, SW_SHOW); 3078 ShowWindow(handle2, SW_SHOW);
3079 } 3079 }
3080 3080
3081 /* This handles any activity on the scrollbox */ 3081 /* This handles any activity on the scrollbox */
3082 BOOL CALLBACK _scrollwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) 3082 LRESULT CALLBACK _scrollwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2)
3083 { 3083 {
3084 switch (msg) 3084 switch (msg)
3085 { 3085 {
3086 case WM_HSCROLL: 3086 case WM_HSCROLL:
3087 case WM_VSCROLL: 3087 case WM_VSCROLL:
3117 si->nPos = 0; 3117 si->nPos = 0;
3118 break; 3118 break;
3119 /*case SB_PAGEUP:*/ 3119 /*case SB_PAGEUP:*/
3120 case SB_PAGERIGHT: 3120 case SB_PAGERIGHT:
3121 si->nPos = si->nPos + si->nPage; 3121 si->nPos = si->nPos + si->nPage;
3122 if(si->nPos > (si->nMax - si->nPage) + 1) 3122 if(si->nPos > (int)(si->nMax - si->nPage) + 1)
3123 si->nPos = (si->nMax - si->nPage) + 1; 3123 si->nPos = (si->nMax - si->nPage) + 1;
3124 break; 3124 break;
3125 /*case SB_LINEDOWN:*/ 3125 /*case SB_LINEDOWN:*/
3126 case SB_LINELEFT: 3126 case SB_LINELEFT:
3127 si->nPos = si->nPos - 1; 3127 si->nPos = si->nPos - 1;
3129 si->nPos = si->nMin; 3129 si->nPos = si->nMin;
3130 break; 3130 break;
3131 /*case SB_LINEUP:*/ 3131 /*case SB_LINEUP:*/
3132 case SB_LINERIGHT: 3132 case SB_LINERIGHT:
3133 si->nPos = si->nPos + 1; 3133 si->nPos = si->nPos + 1;
3134 if(si->nPos > (si->nMax - si->nPage) + 1) 3134 if(si->nPos > (int)(si->nMax - si->nPage) + 1)
3135 si->nPos = (si->nMax - si->nPage) + 1; 3135 si->nPos = (si->nMax - si->nPage) + 1;
3136 break; 3136 break;
3137 } 3137 }
3138 3138
3139 /* Position the scrolled box */ 3139 /* Position the scrolled box */
3145 } 3145 }
3146 return DefWindowProc(hwnd, msg, mp1, mp2); 3146 return DefWindowProc(hwnd, msg, mp1, mp2);
3147 } 3147 }
3148 3148
3149 /* This handles any activity on the splitbars (sizers) */ 3149 /* This handles any activity on the splitbars (sizers) */
3150 BOOL CALLBACK _splitwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) 3150 LRESULT CALLBACK _splitwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2)
3151 { 3151 {
3152 switch (msg) 3152 switch (msg)
3153 { 3153 {
3154 case WM_ACTIVATE: 3154 case WM_ACTIVATE:
3155 case WM_SETFOCUS: 3155 case WM_SETFOCUS:
3224 3224
3225 if(type == DW_HORZ) 3225 if(type == DW_HORZ)
3226 { 3226 {
3227 start = point.x - rect.left; 3227 start = point.x - rect.left;
3228 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) 3228 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH)
3229 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; 3229 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * (float)100.0;
3230 } 3230 }
3231 else 3231 else
3232 { 3232 {
3233 start = point.y - rect.top; 3233 start = point.y - rect.top;
3234 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH) 3234 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH)
3235 *percent = ((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0; 3235 *percent = ((float)start / (float)(height - SPLITBAR_WIDTH)) * (float)100.0;
3236 } 3236 }
3237 _handle_splitbar_resize(hwnd, *percent, type, width, height); 3237 _handle_splitbar_resize(hwnd, *percent, type, width, height);
3238 } 3238 }
3239 memcpy(&lastpoint, &point, sizeof(POINT)); 3239 memcpy(&lastpoint, &point, sizeof(POINT));
3240 } 3240 }
3244 } 3244 }
3245 return DefWindowProc(hwnd, msg, mp1, mp2); 3245 return DefWindowProc(hwnd, msg, mp1, mp2);
3246 } 3246 }
3247 3247
3248 /* This handles drawing the status text areas */ 3248 /* This handles drawing the status text areas */
3249 BOOL CALLBACK _statuswndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) 3249 LRESULT CALLBACK _statuswndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2)
3250 { 3250 {
3251 switch (msg) 3251 switch (msg)
3252 { 3252 {
3253 case WM_MOUSEMOVE: 3253 case WM_MOUSEMOVE:
3254 _wndproc(hwnd, msg, mp1, mp2); 3254 _wndproc(hwnd, msg, mp1, mp2);
3293 return DefWindowProc(hwnd, msg, mp1, mp2); 3293 return DefWindowProc(hwnd, msg, mp1, mp2);
3294 } 3294 }
3295 3295
3296 #ifdef AEROGLASS 3296 #ifdef AEROGLASS
3297 /* Window procedure to handle drawing themed text when in composited mode */ 3297 /* Window procedure to handle drawing themed text when in composited mode */
3298 BOOL CALLBACK _staticwndproc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2) 3298 LRESULT CALLBACK _staticwndproc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2)
3299 { 3299 {
3300 ColorInfo *parentcinfo, *cinfo = (ColorInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA); 3300 ColorInfo *parentcinfo, *cinfo = (ColorInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
3301 WNDPROC pOldProc; 3301 WNDPROC pOldProc;
3302 3302
3303 if (!cinfo) 3303 if (!cinfo)
3439 3439
3440 /* Function: _BtProc 3440 /* Function: _BtProc
3441 * Abstract: Subclass procedure for buttons 3441 * Abstract: Subclass procedure for buttons
3442 */ 3442 */
3443 3443
3444 BOOL CALLBACK _BtProc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2) 3444 LRESULT CALLBACK _BtProc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2)
3445 { 3445 {
3446 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA); 3446 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
3447 WNDPROC pOldProc; 3447 WNDPROC pOldProc;
3448 int retval = -1; 3448 int retval = -1;
3449 3449
4277 } 4277 }
4278 } 4278 }
4279 4279
4280 int instring(char *text, char *buffer) 4280 int instring(char *text, char *buffer)
4281 { 4281 {
4282 int z, len = strlen(text), buflen = strlen(buffer); 4282 int z, len = (int)strlen(text), buflen = (int)strlen(buffer);
4283 4283
4284 if(buflen > len) 4284 if(buflen > len)
4285 { 4285 {
4286 for(z=0;z<=(buflen-len);z++) 4286 for(z=0;z<=(buflen-len);z++)
4287 { 4287 {
4332 lf.lfQuality = DEFAULT_QUALITY; 4332 lf.lfQuality = DEFAULT_QUALITY;
4333 lf.lfPitchAndFamily = DEFAULT_PITCH | FW_DONTCARE; 4333 lf.lfPitchAndFamily = DEFAULT_PITCH | FW_DONTCARE;
4334 /* 4334 /*
4335 * remove any font modifiers 4335 * remove any font modifiers
4336 */ 4336 */
4337 myFontName = strdup(&fontname[z+1]); 4337 myFontName = _strdup(&fontname[z+1]);
4338 if(Italic) 4338 if(Italic)
4339 myFontName[Italic] = 0; 4339 myFontName[Italic] = 0;
4340 if(Bold) 4340 if(Bold)
4341 myFontName[Bold] = 0; 4341 myFontName[Bold] = 0;
4342 strncpy(lf.lfFaceName, myFontName, sizeof(lf.lfFaceName)-1); 4342 strncpy(lf.lfFaceName, myFontName, sizeof(lf.lfFaceName)-1);
4454 dw_font_text_extents_get(handle, NULL, buf, &thiswidth, &thisheight); 4454 dw_font_text_extents_get(handle, NULL, buf, &thiswidth, &thisheight);
4455 dw_free(buf); 4455 dw_free(buf);
4456 } 4456 }
4457 4457
4458 /* Attempt to get bitmap from classes that can have them */ 4458 /* Attempt to get bitmap from classes that can have them */
4459 if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1) == 0) 4459 if(_strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1) == 0)
4460 hbm = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); 4460 hbm = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0);
4461 if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0) 4461 if(_strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0)
4462 hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0); 4462 hbm = (HBITMAP)SendMessage(handle, BM_GETIMAGE, IMAGE_BITMAP, 0);
4463 4463
4464 /* If we got an image... set the sizes appropriately */ 4464 /* If we got an image... set the sizes appropriately */
4465 if(hbm) 4465 if(hbm)
4466 { 4466 {
4470 thiswidth = bmi.bmWidth; 4470 thiswidth = bmi.bmWidth;
4471 thisheight = bmi.bmHeight; 4471 thisheight = bmi.bmHeight;
4472 } 4472 }
4473 4473
4474 /* Combobox */ 4474 /* Combobox */
4475 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0) 4475 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0)
4476 { 4476 {
4477 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); 4477 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight);
4478 thiswidth = 150; 4478 thiswidth = 150;
4479 extraheight = 4; 4479 extraheight = 4;
4480 if(thisheight < 18) 4480 if(thisheight < 18)
4481 thisheight = 18; 4481 thisheight = 18;
4482 } 4482 }
4483 /* Ranged: Percent, Slider, Scrollbar */ 4483 /* Ranged: Percent, Slider, Scrollbar */
4484 else if(strnicmp(tmpbuf, PROGRESS_CLASS, strlen(PROGRESS_CLASS)+1) == 0 || 4484 else if(_strnicmp(tmpbuf, PROGRESS_CLASS, strlen(PROGRESS_CLASS)+1) == 0 ||
4485 strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1) == 0 || 4485 _strnicmp(tmpbuf, TRACKBAR_CLASS, strlen(TRACKBAR_CLASS)+1) == 0 ||
4486 strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1) == 0) 4486 _strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1) == 0)
4487 { 4487 {
4488 if(strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1) == 0 && 4488 if(_strnicmp(tmpbuf, SCROLLBARCLASSNAME, strlen(SCROLLBARCLASSNAME)+1) == 0 &&
4489 GetWindowLong(handle, GWL_STYLE) & SBS_VERT) 4489 GetWindowLong(handle, GWL_STYLE) & SBS_VERT)
4490 { 4490 {
4491 /* Vertical */ 4491 /* Vertical */
4492 thiswidth = GetSystemMetrics(SM_CXVSCROLL); 4492 thiswidth = GetSystemMetrics(SM_CXVSCROLL);
4493 thisheight = 100; 4493 thisheight = 100;
4498 thiswidth = 100; 4498 thiswidth = 100;
4499 thisheight = GetSystemMetrics(SM_CYHSCROLL); 4499 thisheight = GetSystemMetrics(SM_CYHSCROLL);
4500 } 4500 }
4501 } 4501 }
4502 /* Spinbuttons */ 4502 /* Spinbuttons */
4503 else if(strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0) 4503 else if(_strnicmp(tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0)
4504 { 4504 {
4505 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); 4505 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight);
4506 thiswidth = 50; 4506 thiswidth = 50;
4507 extraheight = 6; 4507 extraheight = 6;
4508 } 4508 }
4509 /* Listbox */ 4509 /* Listbox */
4510 else if(strnicmp(tmpbuf, LISTBOXCLASSNAME, strlen(LISTBOXCLASSNAME)+1) == 0) 4510 else if(_strnicmp(tmpbuf, LISTBOXCLASSNAME, strlen(LISTBOXCLASSNAME)+1) == 0)
4511 { 4511 {
4512 char buf[1025] = {0}; 4512 char buf[1025] = {0};
4513 int x, count = dw_listbox_count(handle); 4513 int x, count = dw_listbox_count(handle);
4514 int basicwidth = thiswidth = GetSystemMetrics(SM_CXVSCROLL) + 8; 4514 int basicwidth = thiswidth = GetSystemMetrics(SM_CXVSCROLL) + 8;
4515 4515
4539 thisheight = _DW_SCROLLED_MIN_HEIGHT; 4539 thisheight = _DW_SCROLLED_MIN_HEIGHT;
4540 if(thisheight > _DW_SCROLLED_MAX_HEIGHT) 4540 if(thisheight > _DW_SCROLLED_MAX_HEIGHT)
4541 thisheight = _DW_SCROLLED_MAX_HEIGHT; 4541 thisheight = _DW_SCROLLED_MAX_HEIGHT;
4542 } 4542 }
4543 /* Entryfields and MLE */ 4543 /* Entryfields and MLE */
4544 else if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1) == 0 || 4544 else if(_strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1) == 0 ||
4545 strnicmp(tmpbuf, RICHEDIT_CLASS, strlen(RICHEDIT_CLASS)+1) == 0) 4545 _strnicmp(tmpbuf, RICHEDIT_CLASS, strlen(RICHEDIT_CLASS)+1) == 0)
4546 { 4546 {
4547 LONG style = GetWindowLong(handle, GWL_STYLE); 4547 LONG style = GetWindowLong(handle, GWL_STYLE);
4548 if((style & ES_MULTILINE)) 4548 if((style & ES_MULTILINE))
4549 { 4549 {
4550 unsigned long bytes; 4550 unsigned long bytes;
4605 thiswidth = 150; 4605 thiswidth = 150;
4606 extraheight = 6; 4606 extraheight = 6;
4607 } 4607 }
4608 } 4608 }
4609 /* Container */ 4609 /* Container */
4610 else if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0) 4610 else if(_strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0)
4611 { 4611 {
4612 DWORD result = ListView_ApproximateViewRect(handle, _DW_SCROLLED_MAX_WIDTH, _DW_SCROLLED_MAX_HEIGHT, -1); 4612 DWORD result = ListView_ApproximateViewRect(handle, _DW_SCROLLED_MAX_WIDTH, _DW_SCROLLED_MAX_HEIGHT, -1);
4613 4613
4614 thiswidth = LOWORD(result); 4614 thiswidth = LOWORD(result);
4615 thisheight = HIWORD(result); 4615 thisheight = HIWORD(result);
4622 thisheight = _DW_SCROLLED_MIN_HEIGHT; 4622 thisheight = _DW_SCROLLED_MIN_HEIGHT;
4623 if(thisheight > _DW_SCROLLED_MAX_HEIGHT) 4623 if(thisheight > _DW_SCROLLED_MAX_HEIGHT)
4624 thisheight = _DW_SCROLLED_MAX_HEIGHT; 4624 thisheight = _DW_SCROLLED_MAX_HEIGHT;
4625 } 4625 }
4626 /* Tree */ 4626 /* Tree */
4627 else if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) 4627 else if(_strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0)
4628 { 4628 {
4629 thiswidth = (int)((_DW_SCROLLED_MAX_WIDTH + _DW_SCROLLED_MIN_WIDTH)/2); 4629 thiswidth = (int)((_DW_SCROLLED_MAX_WIDTH + _DW_SCROLLED_MIN_WIDTH)/2);
4630 thisheight = (int)((_DW_SCROLLED_MAX_HEIGHT + _DW_SCROLLED_MIN_HEIGHT)/2); 4630 thisheight = (int)((_DW_SCROLLED_MAX_HEIGHT + _DW_SCROLLED_MIN_HEIGHT)/2);
4631 } 4631 }
4632 /* Buttons */ 4632 /* Buttons */
4633 else if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0) 4633 else if(_strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0)
4634 { 4634 {
4635 ULONG style = GetWindowLong(handle, GWL_STYLE); 4635 ULONG style = GetWindowLong(handle, GWL_STYLE);
4636 4636
4637 /* Bitmap buttons */ 4637 /* Bitmap buttons */
4638 if(hbm) 4638 if(hbm)
4651 { 4651 {
4652 extrawidth = 8; 4652 extrawidth = 8;
4653 extraheight = 8; 4653 extraheight = 8;
4654 } 4654 }
4655 } 4655 }
4656 else if(strnicmp(tmpbuf, StatusbarClassName, strlen(StatusbarClassName)+1) == 0) 4656 else if(_strnicmp(tmpbuf, StatusbarClassName, strlen(StatusbarClassName)+1) == 0)
4657 { 4657 {
4658 extrawidth = 4; 4658 extrawidth = 4;
4659 extraheight = 2; 4659 extraheight = 2;
4660 } 4660 }
4661 4661
4679 char tmpbuf[100] = {0}; 4679 char tmpbuf[100] = {0};
4680 4680
4681 cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); 4681 cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
4682 4682
4683 GetClassName(handle, tmpbuf, 99); 4683 GetClassName(handle, tmpbuf, 99);
4684 if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) 4684 if ( _strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 )
4685 { 4685 {
4686 /* groupbox */ 4686 /* groupbox */
4687 Box *thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA ); 4687 Box *thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA );
4688 if ( thisbox && thisbox->grouphwnd != (HWND)NULL ) 4688 if ( thisbox && thisbox->grouphwnd != (HWND)NULL )
4689 { 4689 {
4792 LOGFONT lf = { 0 }; 4792 LOGFONT lf = { 0 };
4793 Box *thisbox; 4793 Box *thisbox;
4794 char tmpbuf[100] = {0}; 4794 char tmpbuf[100] = {0};
4795 4795
4796 GetClassName(handle, tmpbuf, 99); 4796 GetClassName(handle, tmpbuf, 99);
4797 if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) 4797 if ( _strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 )
4798 { 4798 {
4799 /* groupbox */ 4799 /* groupbox */
4800 thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA ); 4800 thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA );
4801 if ( thisbox && thisbox->grouphwnd != (HWND)NULL ) 4801 if ( thisbox && thisbox->grouphwnd != (HWND)NULL )
4802 { 4802 {
4841 4841
4842 cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); 4842 cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
4843 4843
4844 GetClassName(handle, tmpbuf, 99); 4844 GetClassName(handle, tmpbuf, 99);
4845 4845
4846 if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW))==0) 4846 if(_strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW))==0)
4847 { 4847 {
4848 cinfo->fore = fore = _internal_color(fore); 4848 cinfo->fore = fore = _internal_color(fore);
4849 cinfo->back = back = _internal_color(back); 4849 cinfo->back = back = _internal_color(back);
4850 4850
4851 ListView_SetTextColor(handle, RGB(DW_RED_VALUE(fore), 4851 ListView_SetTextColor(handle, RGB(DW_RED_VALUE(fore),
4858 DW_GREEN_VALUE(back), 4858 DW_GREEN_VALUE(back),
4859 DW_BLUE_VALUE(back))); 4859 DW_BLUE_VALUE(back)));
4860 InvalidateRgn(handle, NULL, TRUE); 4860 InvalidateRgn(handle, NULL, TRUE);
4861 return TRUE; 4861 return TRUE;
4862 } 4862 }
4863 else if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)) == 0 ) 4863 else if ( _strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)) == 0 )
4864 { 4864 {
4865 /* groupbox */ 4865 /* groupbox */
4866 thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA ); 4866 thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA );
4867 if ( thisbox && thisbox->grouphwnd != (HWND)NULL ) 4867 if ( thisbox && thisbox->grouphwnd != (HWND)NULL )
4868 { 4868 {
5463 if (IsMenu((HMENU)submenu)) 5463 if (IsMenu((HMENU)submenu))
5464 mii.hSubMenu = (HMENU)submenu; 5464 mii.hSubMenu = (HMENU)submenu;
5465 else 5465 else
5466 mii.hSubMenu = 0; 5466 mii.hSubMenu = 0;
5467 mii.dwTypeData = menutitle; 5467 mii.dwTypeData = menutitle;
5468 mii.cch = strlen(menutitle); 5468 mii.cch = (UINT)strlen(menutitle);
5469 5469
5470 InsertMenuItem(mymenu, 65535, TRUE, &mii); 5470 InsertMenuItem(mymenu, 65535, TRUE, &mii);
5471 5471
5472 _snprintf(buffer, 30, "_dw_id%ld", id); 5472 _snprintf(buffer, 30, "_dw_id%ld", id);
5473 dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)mymenu ); 5473 dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)mymenu );
6158 } 6158 }
6159 #endif 6159 #endif
6160 } 6160 }
6161 else 6161 else
6162 { 6162 {
6163 unlink( file ); 6163 _unlink( file );
6164 free( file ); 6164 free( file );
6165 return 0; 6165 return 0;
6166 } 6166 }
6167 unlink( file ); 6167 _unlink( file );
6168 free( file ); 6168 free( file );
6169 } 6169 }
6170 6170
6171 tmp = CreateWindow( BUTTONCLASSNAME, 6171 tmp = CreateWindow( BUTTONCLASSNAME,
6172 "", 6172 "",
6546 icon = LoadImage( NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); 6546 icon = LoadImage( NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
6547 #endif 6547 #endif
6548 } 6548 }
6549 else 6549 else
6550 { 6550 {
6551 unlink( file ); 6551 _unlink( file );
6552 free( file ); 6552 free( file );
6553 return; 6553 return;
6554 } 6554 }
6555 unlink( file ); 6555 _unlink( file );
6556 free( file ); 6556 free( file );
6557 } 6557 }
6558 if (icon == 0 && hbitmap == 0) 6558 if (icon == 0 && hbitmap == 0)
6559 return; 6559 return;
6560 } 6560 }
6599 GetClassName(handle, tmpbuf, 99); 6599 GetClassName(handle, tmpbuf, 99);
6600 6600
6601 SetWindowText(handle, text); 6601 SetWindowText(handle, text);
6602 6602
6603 /* Combobox */ 6603 /* Combobox */
6604 if ( strnicmp( tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0 ) 6604 if ( _strnicmp( tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0 )
6605 SendMessage(handle, CB_SETEDITSEL, 0, MAKELPARAM(-1, 0)); 6605 SendMessage(handle, CB_SETEDITSEL, 0, MAKELPARAM(-1, 0));
6606 else if ( strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 ) 6606 else if ( _strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 )
6607 { 6607 {
6608 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); 6608 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
6609 if( cinfo && cinfo->buddy ) 6609 if( cinfo && cinfo->buddy )
6610 SetWindowText( cinfo->buddy, text ); 6610 SetWindowText( cinfo->buddy, text );
6611 } 6611 }
6612 else if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) 6612 else if ( _strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 )
6613 { 6613 {
6614 /* groupbox */ 6614 /* groupbox */
6615 thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA ); 6615 thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA );
6616 if ( thisbox && thisbox->grouphwnd != (HWND)NULL ) 6616 if ( thisbox && thisbox->grouphwnd != (HWND)NULL )
6617 SetWindowText( thisbox->grouphwnd, text ); 6617 SetWindowText( thisbox->grouphwnd, text );
6657 char tmpbuf[100] = {0}, *tempbuf; 6657 char tmpbuf[100] = {0}, *tempbuf;
6658 int len; 6658 int len;
6659 6659
6660 GetClassName(handle, tmpbuf, 99); 6660 GetClassName(handle, tmpbuf, 99);
6661 6661
6662 if ( strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 ) 6662 if ( _strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 )
6663 { 6663 {
6664 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); 6664 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
6665 6665
6666 if( cinfo && cinfo->buddy ) 6666 if( cinfo && cinfo->buddy )
6667 handle = cinfo->buddy; 6667 handle = cinfo->buddy;
6765 } 6765 }
6766 6766
6767 GetClassName(box, tmpbuf, 99); 6767 GetClassName(box, tmpbuf, 99);
6768 6768
6769 /* If we are in a scrolled box... extract the interal box */ 6769 /* If we are in a scrolled box... extract the interal box */
6770 if(strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) 6770 if(_strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0)
6771 { 6771 {
6772 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(box, GWLP_USERDATA); 6772 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(box, GWLP_USERDATA);
6773 if(cinfo) 6773 if(cinfo)
6774 { 6774 {
6775 box = cinfo->buddy; 6775 box = cinfo->buddy;
6776 thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA); 6776 thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA);
6777 } 6777 }
6778 } 6778 }
6779 else //if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) 6779 else //if(_strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0)
6780 thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA); 6780 thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA);
6781 if(thisbox) 6781 if(thisbox)
6782 { 6782 {
6783 int z, x = 0; 6783 int z, x = 0;
6784 Item *tmpitem, *thisitem = thisbox->items; 6784 Item *tmpitem, *thisitem = thisbox->items;
6804 if(vsize && !height) 6804 if(vsize && !height)
6805 height = 1; 6805 height = 1;
6806 if(hsize && !width) 6806 if(hsize && !width)
6807 width = 1; 6807 width = 1;
6808 6808
6809 if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) 6809 if(_strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0)
6810 tmpitem[index].type = TYPEBOX; 6810 tmpitem[index].type = TYPEBOX;
6811 else 6811 else
6812 { 6812 {
6813 if(strnicmp(tmpbuf, "SysMonthCal32", 13)==0) 6813 if(_strnicmp(tmpbuf, "SysMonthCal32", 13)==0)
6814 { 6814 {
6815 RECT rc; 6815 RECT rc;
6816 MonthCal_GetMinReqRect(item, &rc); 6816 MonthCal_GetMinReqRect(item, &rc);
6817 width = 1 + rc.right - rc.left; 6817 width = 1 + rc.right - rc.left;
6818 height = 1 + rc.bottom - rc.top; 6818 height = 1 + rc.bottom - rc.top;
6925 Box *thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); 6925 Box *thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA);
6926 6926
6927 if(thisbox) 6927 if(thisbox)
6928 { 6928 {
6929 int depth = 0; 6929 int depth = 0;
6930 DWORD dwStyle = GetWindowLongPtr(handle, GWL_STYLE); 6930 DWORD dwStyle = GetWindowLong(handle, GWL_STYLE);
6931 DWORD dwExStyle = GetWindowLongPtr(handle, GWL_EXSTYLE); 6931 DWORD dwExStyle = GetWindowLong(handle, GWL_EXSTYLE);
6932 HMENU menu = GetMenu(handle) ; 6932 HMENU menu = GetMenu(handle) ;
6933 RECT rc = { 0 } ; 6933 RECT rc = { 0 } ;
6934 6934
6935 /* Calculate space requirements */ 6935 /* Calculate space requirements */
6936 _resize_box(thisbox, &depth, *width, *height, 1); 6936 _resize_box(thisbox, &depth, *width, *height, 1);
6974 { 6974 {
6975 char tmpbuf[100] = {0}; 6975 char tmpbuf[100] = {0};
6976 6976
6977 GetClassName(handle, tmpbuf, 99); 6977 GetClassName(handle, tmpbuf, 99);
6978 6978
6979 if(strnicmp(tmpbuf, ClassName, strlen(ClassName)+1) == 0) 6979 if(_strnicmp(tmpbuf, ClassName, strlen(ClassName)+1) == 0)
6980 { 6980 {
6981 unsigned long thiswidth = 0, thisheight = 0; 6981 unsigned long thiswidth = 0, thisheight = 0;
6982 6982
6983 /* Get the size with the border */ 6983 /* Get the size with the border */
6984 _get_window_for_size(handle, &thiswidth, &thisheight); 6984 _get_window_for_size(handle, &thiswidth, &thisheight);
6985 6985
6986 /* Return what was requested */ 6986 /* Return what was requested */
6987 if(width) *width = (int)thiswidth; 6987 if(width) *width = (int)thiswidth;
6988 if(height) *height = (int)thisheight; 6988 if(height) *height = (int)thisheight;
6989 } 6989 }
6990 else if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0) 6990 else if(_strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0)
6991 { 6991 {
6992 Box *thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA); 6992 Box *thisbox = (Box *)GetWindowLongPtr(handle, GWLP_USERDATA);
6993 6993
6994 if(thisbox) 6994 if(thisbox)
6995 { 6995 {
7226 7226
7227 tmp = currentstyle | mask; 7227 tmp = currentstyle | mask;
7228 tmp ^= mask; 7228 tmp ^= mask;
7229 tmp |= style; 7229 tmp |= style;
7230 7230
7231 if(strnicmp(tmpbuf, ClassName, strlen(ClassName)+1)==0) 7231 if(_strnicmp(tmpbuf, ClassName, strlen(ClassName)+1)==0)
7232 { 7232 {
7233 tmp = tmp & 0xffff0000; 7233 tmp = tmp & 0xffff0000;
7234 #ifdef AEROGLASS 7234 #ifdef AEROGLASS
7235 if(mask & DW_FCF_COMPOSITED && _DwmExtendFrameIntoClientArea && _dw_composition) 7235 if(mask & DW_FCF_COMPOSITED && _DwmExtendFrameIntoClientArea && _dw_composition)
7236 { 7236 {
7237 DWORD styleex = GetWindowLongPtr(handle, GWL_EXSTYLE); 7237 LONG_PTR styleex = GetWindowLongPtr(handle, GWL_EXSTYLE);
7238 7238
7239 if(style & DW_FCF_COMPOSITED) 7239 if(style & DW_FCF_COMPOSITED)
7240 { 7240 {
7241 MARGINS mar = {-1}; 7241 MARGINS mar = {-1};
7242 7242
7518 { 7518 {
7519 char tmpbuf[100] = {0}; 7519 char tmpbuf[100] = {0};
7520 7520
7521 GetClassName(handle, tmpbuf, 99); 7521 GetClassName(handle, tmpbuf, 99);
7522 7522
7523 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7523 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7524 SendMessage(handle, 7524 SendMessage(handle,
7525 CB_ADDSTRING, 7525 CB_ADDSTRING,
7526 0, (LPARAM)text); 7526 0, (LPARAM)text);
7527 else 7527 else
7528 SendMessage(handle, 7528 SendMessage(handle,
7543 int listbox_type; 7543 int listbox_type;
7544 int i; 7544 int i;
7545 7545
7546 GetClassName(handle, tmpbuf, 99); 7546 GetClassName(handle, tmpbuf, 99);
7547 7547
7548 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7548 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7549 listbox_type = CB_ADDSTRING; 7549 listbox_type = CB_ADDSTRING;
7550 else 7550 else
7551 listbox_type = LB_ADDSTRING; 7551 listbox_type = LB_ADDSTRING;
7552 7552
7553 for(i=0;i<count;i++) 7553 for(i=0;i<count;i++)
7565 { 7565 {
7566 char tmpbuf[100] = {0}; 7566 char tmpbuf[100] = {0};
7567 7567
7568 GetClassName(handle, tmpbuf, 99); 7568 GetClassName(handle, tmpbuf, 99);
7569 7569
7570 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7570 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7571 SendMessage(handle, 7571 SendMessage(handle,
7572 CB_INSERTSTRING, 7572 CB_INSERTSTRING,
7573 pos, (LPARAM)text); 7573 pos, (LPARAM)text);
7574 else 7574 else
7575 SendMessage(handle, 7575 SendMessage(handle,
7586 { 7586 {
7587 char tmpbuf[100] = {0}; 7587 char tmpbuf[100] = {0};
7588 7588
7589 GetClassName(handle, tmpbuf, 99); 7589 GetClassName(handle, tmpbuf, 99);
7590 7590
7591 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7591 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7592 { 7592 {
7593 char *buf = dw_window_get_text(handle); 7593 char *buf = dw_window_get_text(handle);
7594 7594
7595 SendMessage(handle, 7595 SendMessage(handle,
7596 CB_RESETCONTENT, 0L, 0L); 7596 CB_RESETCONTENT, 0L, 0L);
7617 { 7617 {
7618 char tmpbuf[100] = {0}; 7618 char tmpbuf[100] = {0};
7619 7619
7620 GetClassName(handle, tmpbuf, 99); 7620 GetClassName(handle, tmpbuf, 99);
7621 7621
7622 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7622 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7623 { 7623 {
7624 SendMessage(handle, CB_DELETESTRING, (WPARAM)index, 0); 7624 SendMessage(handle, CB_DELETESTRING, (WPARAM)index, 0);
7625 SendMessage(handle, CB_INSERTSTRING, (WPARAM)index, (LPARAM)buffer); 7625 SendMessage(handle, CB_INSERTSTRING, (WPARAM)index, (LPARAM)buffer);
7626 } 7626 }
7627 else 7627 else
7643 * length: Length of the buffer (including NULL). 7643 * length: Length of the buffer (including NULL).
7644 */ 7644 */
7645 void API dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length) 7645 void API dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length)
7646 { 7646 {
7647 char tmpbuf[100] = {0}; 7647 char tmpbuf[100] = {0};
7648 int len; 7648 unsigned int len;
7649 7649
7650 if(!buffer || !length) 7650 if(!buffer || !length)
7651 return; 7651 return;
7652 7652
7653 buffer[0] = 0; 7653 buffer[0] = 0;
7654 7654
7655 GetClassName(handle, tmpbuf, 99); 7655 GetClassName(handle, tmpbuf, 99);
7656 7656
7657 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7657 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7658 { 7658 {
7659 len = (int)SendMessage(handle, CB_GETLBTEXTLEN, (WPARAM)index, 0); 7659 len = (int)SendMessage(handle, CB_GETLBTEXTLEN, (WPARAM)index, 0);
7660 7660
7661 if(len < length && len != CB_ERR) 7661 if(len < length && len != CB_ERR)
7662 SendMessage(handle, 7662 SendMessage(handle,
7681 { 7681 {
7682 char tmpbuf[100] = {0}; 7682 char tmpbuf[100] = {0};
7683 7683
7684 GetClassName(handle, tmpbuf, 99); 7684 GetClassName(handle, tmpbuf, 99);
7685 7685
7686 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7686 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7687 return (unsigned int)SendMessage(handle, 7687 return (unsigned int)SendMessage(handle,
7688 CB_GETCURSEL, 7688 CB_GETCURSEL,
7689 0, 0); 7689 0, 0);
7690 7690
7691 return (unsigned int)SendMessage(handle, 7691 return (unsigned int)SendMessage(handle,
7705 char tmpbuf[100] = {0}; 7705 char tmpbuf[100] = {0};
7706 7706
7707 GetClassName(handle, tmpbuf, 99); 7707 GetClassName(handle, tmpbuf, 99);
7708 7708
7709 /* This doesn't work on comboboxes */ 7709 /* This doesn't work on comboboxes */
7710 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7710 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7711 return -1; 7711 return -1;
7712 7712
7713 count = (int)SendMessage(handle, LB_GETSELCOUNT, 0, 0); 7713 count = (int)SendMessage(handle, LB_GETSELCOUNT, 0, 0);
7714 if(count > 0) 7714 if(count > 0)
7715 { 7715 {
7747 { 7747 {
7748 char tmpbuf[100] = {0}; 7748 char tmpbuf[100] = {0};
7749 7749
7750 GetClassName(handle, tmpbuf, 99); 7750 GetClassName(handle, tmpbuf, 99);
7751 7751
7752 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7752 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7753 SendMessage(handle, CB_SETCURSEL, (WPARAM)index, 0); 7753 SendMessage(handle, CB_SETCURSEL, (WPARAM)index, 0);
7754 else 7754 else
7755 { 7755 {
7756 SendMessage(handle, LB_SETCURSEL, (WPARAM)index, 0); 7756 SendMessage(handle, LB_SETCURSEL, (WPARAM)index, 0);
7757 SendMessage(handle, LB_SETSEL, (WPARAM)state, (LPARAM)index); 7757 SendMessage(handle, LB_SETSEL, (WPARAM)state, (LPARAM)index);
7769 { 7769 {
7770 char tmpbuf[100] = {0}; 7770 char tmpbuf[100] = {0};
7771 7771
7772 GetClassName(handle, tmpbuf, 99); 7772 GetClassName(handle, tmpbuf, 99);
7773 7773
7774 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7774 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7775 SendMessage(handle, CB_DELETESTRING, (WPARAM)index, 0); 7775 SendMessage(handle, CB_DELETESTRING, (WPARAM)index, 0);
7776 else 7776 else
7777 SendMessage(handle, LB_DELETESTRING, (WPARAM)index, 0); 7777 SendMessage(handle, LB_DELETESTRING, (WPARAM)index, 0);
7778 } 7778 }
7779 7779
7786 { 7786 {
7787 char tmpbuf[100] = {0}; 7787 char tmpbuf[100] = {0};
7788 7788
7789 GetClassName(handle, tmpbuf, 99); 7789 GetClassName(handle, tmpbuf, 99);
7790 7790
7791 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7791 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7792 return (int)SendMessage(handle, 7792 return (int)SendMessage(handle,
7793 CB_GETCOUNT,0L, 0L); 7793 CB_GETCOUNT,0L, 0L);
7794 7794
7795 return (int)SendMessage(handle, 7795 return (int)SendMessage(handle,
7796 LB_GETCOUNT,0L, 0L); 7796 LB_GETCOUNT,0L, 0L);
7807 char tmpbuf[100] = {0}; 7807 char tmpbuf[100] = {0};
7808 7808
7809 GetClassName(handle, tmpbuf, 99); 7809 GetClassName(handle, tmpbuf, 99);
7810 7810
7811 /* This doesn't work on comboboxes */ 7811 /* This doesn't work on comboboxes */
7812 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) 7812 if(_strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0)
7813 return; 7813 return;
7814 7814
7815 SendMessage(handle, LB_SETTOPINDEX, (WPARAM)top, 0); 7815 SendMessage(handle, LB_SETTOPINDEX, (WPARAM)top, 0);
7816 } 7816 }
7817 7817
7828 char *tmpbuf; 7828 char *tmpbuf;
7829 7829
7830 if(startpoint < 0) 7830 if(startpoint < 0)
7831 startpoint = 0; 7831 startpoint = 0;
7832 7832
7833 if(!buffer || (textlen = strlen(buffer)) < 1) 7833 if(!buffer || (textlen = (int)strlen(buffer)) < 1)
7834 return startpoint; 7834 return startpoint;
7835 7835
7836 tmpbuf = calloc(1, len + textlen + startpoint + 2); 7836 tmpbuf = calloc(1, len + textlen + startpoint + 2);
7837 7837
7838 if(len) 7838 if(len)
8008 char *tmpbuf = calloc(1, len+2); 8008 char *tmpbuf = calloc(1, len+2);
8009 int z, textlen, retval = 0; 8009 int z, textlen, retval = 0;
8010 8010
8011 GetWindowText(handle, tmpbuf, len+1); 8011 GetWindowText(handle, tmpbuf, len+1);
8012 8012
8013 textlen = strlen(text); 8013 textlen = (int)strlen(text);
8014 8014
8015 if(flags & DW_MLE_CASESENSITIVE) 8015 if(flags & DW_MLE_CASESENSITIVE)
8016 { 8016 {
8017 for(z=point;z<(len-textlen) && !retval;z++) 8017 for(z=point;z<(len-textlen) && !retval;z++)
8018 { 8018 {
8022 } 8022 }
8023 else 8023 else
8024 { 8024 {
8025 for(z=point;z<(len-textlen) && !retval;z++) 8025 for(z=point;z<(len-textlen) && !retval;z++)
8026 { 8026 {
8027 if(strnicmp(&tmpbuf[z], text, textlen) == 0) 8027 if(_strnicmp(&tmpbuf[z], text, textlen) == 0)
8028 retval = z + textlen; 8028 retval = z + textlen;
8029 } 8029 }
8030 } 8030 }
8031 8031
8032 if(retval) 8032 if(retval)
8240 { 8240 {
8241 char tmpbuf[100] = {0}; 8241 char tmpbuf[100] = {0};
8242 8242
8243 GetClassName(handle, tmpbuf, 99); 8243 GetClassName(handle, tmpbuf, 99);
8244 8244
8245 if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0) 8245 if(_strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1)==0)
8246 { 8246 {
8247 if(!dw_window_get_data(handle, "_dw_checkbox")) 8247 if(!dw_window_get_data(handle, "_dw_checkbox"))
8248 SendMessage(handle, BM_SETCHECK, 0, 0); 8248 SendMessage(handle, BM_SETCHECK, 0, 0);
8249 } 8249 }
8250 return TRUE; 8250 return TRUE;
8288 ptrs[1] = itemdata; 8288 ptrs[1] = itemdata;
8289 8289
8290 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; 8290 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
8291 tvi.pszText = title; 8291 tvi.pszText = title;
8292 tvi.lParam = (LONG)ptrs; 8292 tvi.lParam = (LONG)ptrs;
8293 tvi.cchTextMax = strlen(title); 8293 tvi.cchTextMax = (int)strlen(title);
8294 tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1); 8294 tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1);
8295 8295
8296 tvins.item = tvi; 8296 tvins.item = tvi;
8297 tvins.hParent = parent; 8297 tvins.hParent = parent;
8298 tvins.hInsertAfter = item ? item : TVI_FIRST; 8298 tvins.hInsertAfter = item ? item : TVI_FIRST;
8322 ptrs[1] = itemdata; 8322 ptrs[1] = itemdata;
8323 8323
8324 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; 8324 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
8325 tvi.pszText = title; 8325 tvi.pszText = title;
8326 tvi.lParam = (LONG)ptrs; 8326 tvi.lParam = (LONG)ptrs;
8327 tvi.cchTextMax = strlen(title); 8327 tvi.cchTextMax = (int)strlen(title);
8328 tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1); 8328 tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1);
8329 8329
8330 tvins.item = tvi; 8330 tvins.item = tvi;
8331 tvins.hParent = parent; 8331 tvins.hParent = parent;
8332 tvins.hInsertAfter = TVI_LAST; 8332 tvins.hInsertAfter = TVI_LAST;
8358 ptrs = (void **)tvi.lParam; 8358 ptrs = (void **)tvi.lParam;
8359 ptrs[0] = title; 8359 ptrs[0] = title;
8360 8360
8361 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; 8361 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
8362 tvi.pszText = title; 8362 tvi.pszText = title;
8363 tvi.cchTextMax = strlen(title); 8363 tvi.cchTextMax = (int)strlen(title);
8364 tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1); 8364 tvi.iSelectedImage = tvi.iImage = _lookup_icon(handle, (HICON)icon, 1);
8365 tvi.hItem = (HTREEITEM)item; 8365 tvi.hItem = (HTREEITEM)item;
8366 8366
8367 TreeView_SetItem(handle, &tvi); 8367 TreeView_SetItem(handle, &tvi);
8368 } 8368 }
8572 { 8572 {
8573 if(titles[z]) 8573 if(titles[z])
8574 { 8574 {
8575 lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT; 8575 lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT;
8576 lvc.pszText = titles[z]; 8576 lvc.pszText = titles[z];
8577 lvc.cchTextMax = strlen(titles[z]); 8577 lvc.cchTextMax = (int)strlen(titles[z]);
8578 if(flags[z] & DW_CFA_RIGHT) 8578 if(flags[z] & DW_CFA_RIGHT)
8579 lvc.fmt = LVCFMT_RIGHT; 8579 lvc.fmt = LVCFMT_RIGHT;
8580 else if(flags[z] & DW_CFA_CENTER) 8580 else if(flags[z] & DW_CFA_CENTER)
8581 lvc.fmt = LVCFMT_CENTER; 8581 lvc.fmt = LVCFMT_CENTER;
8582 else 8582 else
8695 icon = LoadImage( NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); 8695 icon = LoadImage( NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
8696 #endif 8696 #endif
8697 } 8697 }
8698 else 8698 else
8699 { 8699 {
8700 unlink( file ); 8700 _unlink( file );
8701 free( file ); 8701 free( file );
8702 return 0; 8702 return 0;
8703 } 8703 }
8704 unlink( file ); 8704 _unlink( file );
8705 free( file ); 8705 free( file );
8706 } 8706 }
8707 return (HICN)icon; 8707 return (HICN)icon;
8708 } 8708 }
8709 8709
8824 8824
8825 lvi.iItem = row + item; 8825 lvi.iItem = row + item;
8826 lvi.iSubItem = 0; 8826 lvi.iSubItem = 0;
8827 lvi.mask = LVIF_DI_SETITEM | LVIF_IMAGE | LVIF_TEXT; 8827 lvi.mask = LVIF_DI_SETITEM | LVIF_IMAGE | LVIF_TEXT;
8828 lvi.pszText = filename; 8828 lvi.pszText = filename;
8829 lvi.cchTextMax = strlen(filename); 8829 lvi.cchTextMax = (int)strlen(filename);
8830 lvi.iImage = _lookup_icon(handle, (HICON)icon, 0); 8830 lvi.iImage = _lookup_icon(handle, (HICON)icon, 0);
8831 8831
8832 ListView_SetItem(handle, &lvi); 8832 ListView_SetItem(handle, &lvi);
8833 } 8833 }
8834 8834
8899 8899
8900 if(!tmp) 8900 if(!tmp)
8901 tmp = ""; 8901 tmp = "";
8902 8902
8903 lvi.pszText = tmp; 8903 lvi.pszText = tmp;
8904 lvi.cchTextMax = strlen(tmp); 8904 lvi.cchTextMax = (int)strlen(tmp);
8905 } 8905 }
8906 else if(flags[column] & DW_CFA_ULONG && data) 8906 else if(flags[column] & DW_CFA_ULONG && data)
8907 { 8907 {
8908 ULONG tmp = *((ULONG *)data); 8908 ULONG tmp = *((ULONG *)data);
8909 8909
8910 _snprintf(textbuffer, 100, "%lu", tmp); 8910 _snprintf(textbuffer, 100, "%lu", tmp);
8911 8911
8912 lvi.cchTextMax = strlen(textbuffer); 8912 lvi.cchTextMax = (int)strlen(textbuffer);
8913 } 8913 }
8914 else if(flags[column] & DW_CFA_DATE && data) 8914 else if(flags[column] & DW_CFA_DATE && data)
8915 { 8915 {
8916 struct tm curtm; 8916 struct tm curtm;
8917 CDATE cdate = *((CDATE *)data); 8917 CDATE cdate = *((CDATE *)data);
8927 curtm.tm_mon = (cdate.month > 0 && cdate.month < 13) ? cdate.month - 1 : 0; 8927 curtm.tm_mon = (cdate.month > 0 && cdate.month < 13) ? cdate.month - 1 : 0;
8928 curtm.tm_year = cdate.year - 1900; 8928 curtm.tm_year = cdate.year - 1900;
8929 strftime(textbuffer, 100, "%x", &curtm); 8929 strftime(textbuffer, 100, "%x", &curtm);
8930 } 8930 }
8931 8931
8932 lvi.cchTextMax = strlen(textbuffer); 8932 lvi.cchTextMax = (int)strlen(textbuffer);
8933 } 8933 }
8934 else if(flags[column] & DW_CFA_TIME && data) 8934 else if(flags[column] & DW_CFA_TIME && data)
8935 { 8935 {
8936 struct tm curtm; 8936 struct tm curtm;
8937 CTIME ctime = *((CTIME *)data); 8937 CTIME ctime = *((CTIME *)data);
8940 curtm.tm_min = (ctime.minutes >= 0 && ctime.minutes < 60) ? ctime.minutes : 0; 8940 curtm.tm_min = (ctime.minutes >= 0 && ctime.minutes < 60) ? ctime.minutes : 0;
8941 curtm.tm_sec = (ctime.seconds >= 0 && ctime.seconds < 60) ? ctime.seconds : 0; 8941 curtm.tm_sec = (ctime.seconds >= 0 && ctime.seconds < 60) ? ctime.seconds : 0;
8942 8942
8943 strftime(textbuffer, 100, "%X", &curtm); 8943 strftime(textbuffer, 100, "%X", &curtm);
8944 8944
8945 lvi.cchTextMax = strlen(textbuffer); 8945 lvi.cchTextMax = (int)strlen(textbuffer);
8946 } 8946 }
8947 8947
8948 ListView_SetItem(handle, &lvi); 8948 ListView_SetItem(handle, &lvi);
8949 } 8949 }
8950 8950
9328 { 9328 {
9329 ListView_SetColumnWidth(handle, 0, LVSCW_AUTOSIZE); 9329 ListView_SetColumnWidth(handle, 0, LVSCW_AUTOSIZE);
9330 } 9330 }
9331 else if(cinfo && cinfo->columns > 1) 9331 else if(cinfo && cinfo->columns > 1)
9332 { 9332 {
9333 int z, index;
9334 ULONG *flags = cinfo->flags, *columns = calloc(sizeof(ULONG), cinfo->columns); 9333 ULONG *flags = cinfo->flags, *columns = calloc(sizeof(ULONG), cinfo->columns);
9335 char *text = malloc(1024); 9334 char *text = malloc(1024);
9335 unsigned int z;
9336 int index;
9336 9337
9337 /* Initialize with sizes of column labels */ 9338 /* Initialize with sizes of column labels */
9338 for(z=0;z<cinfo->columns;z++) 9339 for(z=0;z<cinfo->columns;z++)
9339 { 9340 {
9340 if(flags[z] & DW_CFA_BITMAPORICON) 9341 if(flags[z] & DW_CFA_BITMAPORICON)
9360 /* Query all the item texts */ 9361 /* Query all the item texts */
9361 while(index != -1) 9362 while(index != -1)
9362 { 9363 {
9363 for(z=0;z<cinfo->columns;z++) 9364 for(z=0;z<cinfo->columns;z++)
9364 { 9365 {
9365 int width; 9366 unsigned int width;
9366 9367
9367 ListView_GetItemText(handle, index, z, text, 1023); 9368 ListView_GetItemText(handle, index, z, text, 1023);
9368 width = ListView_GetStringWidth(handle, text); 9369 width = ListView_GetStringWidth(handle, text);
9369 9370
9370 /* Figure extra space for the icon for the first column */ 9371 /* Figure extra space for the icon for the first column */
9716 oldBrush = SelectObject( hdcPaint, GetStockObject(HOLLOW_BRUSH) ); 9717 oldBrush = SelectObject( hdcPaint, GetStockObject(HOLLOW_BRUSH) );
9717 oldPen = SelectObject( hdcPaint, TlsGetValue(_hPen) ); 9718 oldPen = SelectObject( hdcPaint, TlsGetValue(_hPen) );
9718 if(flags & DW_DRAW_FULL) 9719 if(flags & DW_DRAW_FULL)
9719 Ellipse(hdcPaint, x1, y1, x2, y2); 9720 Ellipse(hdcPaint, x1, y1, x2, y2);
9720 else 9721 else
9721 Arc(hdcPaint, xorigin-r, yorigin-r, xorigin+r, yorigin+r, x2, y2, x1, y1); 9722 Arc(hdcPaint, xorigin-(int)r, yorigin-(int)r, xorigin+(int)r, yorigin+(int)r, x2, y2, x1, y1);
9722 SelectObject( hdcPaint, oldBrush ); 9723 SelectObject( hdcPaint, oldBrush );
9723 SelectObject( hdcPaint, oldPen ); 9724 SelectObject( hdcPaint, oldPen );
9724 9725
9725 if(!pixmap) 9726 if(!pixmap)
9726 ReleaseDC(handle, hdcPaint); 9727 ReleaseDC(handle, hdcPaint);
9771 else 9772 else
9772 { 9773 {
9773 SetBkMode(hdc, OPAQUE); 9774 SetBkMode(hdc, OPAQUE);
9774 SetBkColor(hdc, background); 9775 SetBkColor(hdc, background);
9775 } 9776 }
9776 TextOut(hdc, x, y, text, strlen(text)); 9777 TextOut(hdc, x, y, text, (int)strlen(text));
9777 if(oldFont) 9778 if(oldFont)
9778 SelectObject(hdc, oldFont); 9779 SelectObject(hdc, oldFont);
9779 if(mustdelete) 9780 if(mustdelete)
9780 DeleteObject(hFont); 9781 DeleteObject(hFont);
9781 if(!pixmap) 9782 if(!pixmap)
9823 mustdelete = 1; 9824 mustdelete = 1;
9824 } 9825 }
9825 } 9826 }
9826 oldFont = SelectObject(hdc, hFont); 9827 oldFont = SelectObject(hdc, hFont);
9827 9828
9828 GetTextExtentPoint32(hdc, text, strlen(text), &sz); 9829 GetTextExtentPoint32(hdc, text, (int)strlen(text), &sz);
9829 9830
9830 if(width) 9831 if(width)
9831 *width = sz.cx; 9832 *width = sz.cx;
9832 9833
9833 if(height) 9834 if(height)
10039 pixmap->depth = _read_bitmap_header(file); 10040 pixmap->depth = _read_bitmap_header(file);
10040 #endif 10041 #endif
10041 } 10042 }
10042 else 10043 else
10043 { 10044 {
10044 unlink( file ); 10045 _unlink( file );
10045 free( file ); 10046 free( file );
10046 free( pixmap ); 10047 free( pixmap );
10047 return NULL; 10048 return NULL;
10048 } 10049 }
10049 unlink( file ); 10050 _unlink( file );
10050 free( file ); 10051 free( file );
10051 } 10052 }
10052 10053
10053 if ( !pixmap->hbm ) 10054 if ( !pixmap->hbm )
10054 { 10055 {
10914 return ret; 10915 return ret;
10915 } 10916 }
10916 10917
10917 if ( (tmp = GlobalLock(handle)) && strlen(tmp) ) 10918 if ( (tmp = GlobalLock(handle)) && strlen(tmp) )
10918 { 10919 {
10919 ret = strdup(tmp); 10920 ret = _strdup(tmp);
10920 GlobalUnlock(handle); 10921 GlobalUnlock(handle);
10921 } 10922 }
10922 CloseClipboard(); 10923 CloseClipboard();
10923 return ret; 10924 return ret;
10924 } 10925 }
11069 } 11070 }
11070 11071
11071 // In C++: pMalloc->Free(pidl); pMalloc->Release(); 11072 // In C++: pMalloc->Free(pidl); pMalloc->Release();
11072 pMalloc->lpVtbl->Free(pMalloc,pidl); 11073 pMalloc->lpVtbl->Free(pMalloc,pidl);
11073 pMalloc->lpVtbl->Release(pMalloc); 11074 pMalloc->lpVtbl->Release(pMalloc);
11074 return strdup(filenamebuf); 11075 return _strdup(filenamebuf);
11075 } 11076 }
11076 } 11077 }
11077 #else 11078 #else
11078 if ( XBrowseForFolder( NULL, 11079 if ( XBrowseForFolder( NULL,
11079 (LPCTSTR)defpath, 11080 (LPCTSTR)defpath,
11081 (LPCTSTR)title, 11082 (LPCTSTR)title,
11082 (LPTSTR)filenamebuf, 11083 (LPTSTR)filenamebuf,
11083 1000, 11084 1000,
11084 FALSE ) ) 11085 FALSE ) )
11085 { 11086 {
11086 return strdup( filenamebuf ); 11087 return _strdup( filenamebuf );
11087 } 11088 }
11088 #endif 11089 #endif
11089 } 11090 }
11090 else 11091 else
11091 { 11092 {
11137 of.Flags |= OFN_FILEMUSTEXIST; 11138 of.Flags |= OFN_FILEMUSTEXIST;
11138 rc = GetOpenFileName(&of); 11139 rc = GetOpenFileName(&of);
11139 } 11140 }
11140 11141
11141 if (rc) 11142 if (rc)
11142 return strdup(of.lpstrFile); 11143 return _strdup(of.lpstrFile);
11143 } 11144 }
11144 return NULL; 11145 return NULL;
11145 } 11146 }
11146 11147
11147 /* 11148 /*
11172 strcat(newparams[z], params[z]); 11173 strcat(newparams[z], params[z]);
11173 strcat(newparams[z], "\""); 11174 strcat(newparams[z], "\"");
11174 } 11175 }
11175 newparams[count] = NULL; 11176 newparams[count] = NULL;
11176 11177
11177 retcode = _spawnvp(P_NOWAIT, program, (const char * const *)newparams); 11178 /* Why does this return intptr_t ... can the PID exceed an integer value? */
11179 retcode = (int)_spawnvp(P_NOWAIT, program, (const char * const *)newparams);
11178 11180
11179 for(z=0;z<count;z++) 11181 for(z=0;z<count;z++)
11180 { 11182 {
11181 free(newparams[z]); 11183 free(newparams[z]);
11182 } 11184 }
11198 if(strlen(url) > 7 && strncmp(url, "file://", 7) == 0) 11200 if(strlen(url) > 7 && strncmp(url, "file://", 7) == 0)
11199 { 11201 {
11200 int len, z; 11202 int len, z;
11201 11203
11202 browseurl = &url[7]; 11204 browseurl = &url[7];
11203 len = strlen(browseurl); 11205 len = (int)strlen(browseurl);
11204 11206
11205 for(z=0;z<len;z++) 11207 for(z=0;z<len;z++)
11206 { 11208 {
11207 if(browseurl[z] == '|') 11209 if(browseurl[z] == '|')
11208 browseurl[z] = ':'; 11210 browseurl[z] = ':';
11390 { 11392 {
11391 UserData *tmp = *root; 11393 UserData *tmp = *root;
11392 11394
11393 while(tmp) 11395 while(tmp)
11394 { 11396 {
11395 if(stricmp(tmp->varname, varname) == 0) 11397 if(_stricmp(tmp->varname, varname) == 0)
11396 return tmp; 11398 return tmp;
11397 tmp = tmp->next; 11399 tmp = tmp->next;
11398 } 11400 }
11399 return NULL; 11401 return NULL;
11400 } 11402 }
11411 else 11413 else
11412 { 11414 {
11413 new = malloc(sizeof(UserData)); 11415 new = malloc(sizeof(UserData));
11414 if(new) 11416 if(new)
11415 { 11417 {
11416 new->varname = strdup(varname); 11418 new->varname = _strdup(varname);
11417 new->data = data; 11419 new->data = data;
11418 11420
11419 new->next = NULL; 11421 new->next = NULL;
11420 11422
11421 if (!*root) 11423 if (!*root)
11441 { 11443 {
11442 UserData *prev = NULL, *tmp = *root; 11444 UserData *prev = NULL, *tmp = *root;
11443 11445
11444 while(tmp) 11446 while(tmp)
11445 { 11447 {
11446 if(all || stricmp(tmp->varname, varname) == 0) 11448 if(all || _stricmp(tmp->varname, varname) == 0)
11447 { 11449 {
11448 if(!prev) 11450 if(!prev)
11449 { 11451 {
11450 *root = tmp->next; 11452 *root = tmp->next;
11451 free(tmp->varname); 11453 free(tmp->varname);
11540 */ 11542 */
11541 int API dw_timer_connect(int interval, void *sigfunc, void *data) 11543 int API dw_timer_connect(int interval, void *sigfunc, void *data)
11542 { 11544 {
11543 if(sigfunc) 11545 if(sigfunc)
11544 { 11546 {
11545 int timerid = SetTimer(NULL, 0, interval, _TimerProc); 11547 /* Warning: This seems to return UINT_PTR on some systems...
11548 * which may exceed the storage of int that our API uses.
11549 */
11550 int timerid = (int)SetTimer(NULL, 0, interval, _TimerProc);
11546 11551
11547 if(timerid) 11552 if(timerid)
11548 { 11553 {
11549 _new_signal(WM_TIMER, NULL, timerid, sigfunc, data); 11554 _new_signal(WM_TIMER, NULL, timerid, sigfunc, data);
11550 return timerid; 11555 return timerid;
11605 { 11610 {
11606 ULONG message = 0, id = 0; 11611 ULONG message = 0, id = 0;
11607 11612
11608 if (window && signame && sigfunc) 11613 if (window && signame && sigfunc)
11609 { 11614 {
11610 if (stricmp(signame, DW_SIGNAL_SET_FOCUS) == 0) 11615 if (_stricmp(signame, DW_SIGNAL_SET_FOCUS) == 0)
11611 window = _normalize_handle(window); 11616 window = _normalize_handle(window);
11612 11617
11613 if ((message = _findsigmessage(signame)) != 0) 11618 if ((message = _findsigmessage(signame)) != 0)
11614 { 11619 {
11615 /* Handle special case of the menu item */ 11620 /* Handle special case of the menu item */