Mercurial > dwindows
comparison win/dw.c @ 1732:03a76c4185a8
Fixes for building on Windows 2000. Use VS2008 and disabled GDIPLUS/AEROGLASS.
These fixes essentially amount to unicode enabling the non-GDI+ code and
an #ifdef to not use _dw_composite outside of AEROGLASS sections.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 16 May 2012 08:56:19 +0000 |
parents | f7a41d057a50 |
children | 535e8c19a13d |
comparison
equal
deleted
inserted
replaced
1731:f7a41d057a50 | 1732:03a76c4185a8 |
---|---|
3797 free(file); | 3797 free(file); |
3798 return 0; | 3798 return 0; |
3799 } | 3799 } |
3800 if ( stricmp( file + len - 4, ".ico" ) == 0 ) | 3800 if ( stricmp( file + len - 4, ".ico" ) == 0 ) |
3801 { | 3801 { |
3802 *icon = LoadImage(NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE); | 3802 *icon = LoadImage(NULL, UTF8toWide(file), IMAGE_ICON, 0, 0, LR_LOADFROMFILE); |
3803 windowtype = BS_ICON; | 3803 windowtype = BS_ICON; |
3804 } | 3804 } |
3805 else if ( stricmp( file + len - 4, ".bmp" ) == 0 ) | 3805 else if ( stricmp( file + len - 4, ".bmp" ) == 0 ) |
3806 { | 3806 { |
3807 *hbitmap = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); | 3807 *hbitmap = (HBITMAP)LoadImage(NULL, UTF8toWide(file), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); |
3808 windowtype = BS_BITMAP; | 3808 windowtype = BS_BITMAP; |
3809 } | 3809 } |
3810 else if ( stricmp( file + len - 4, ".png" ) == 0 ) | 3810 else if ( stricmp( file + len - 4, ".png" ) == 0 ) |
3811 { | 3811 { |
3812 *hbitmap = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); | 3812 *hbitmap = (HBITMAP)LoadImage(NULL, UTF8toWide(file), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); |
3813 windowtype = BS_BITMAP; | 3813 windowtype = BS_BITMAP; |
3814 } | 3814 } |
3815 free(file); | 3815 free(file); |
3816 } | 3816 } |
3817 else | 3817 else |
3818 { | 3818 { |
3819 /* Try with .ico extension first...*/ | 3819 /* Try with .ico extension first...*/ |
3820 strcat(file, ".ico"); | 3820 strcat(file, ".ico"); |
3821 if (access(file, 04) == 0) | 3821 if (access(file, 04) == 0) |
3822 { | 3822 { |
3823 *icon = LoadImage(NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE); | 3823 *icon = LoadImage(NULL, UTF8toWide(file), IMAGE_ICON, 0, 0, LR_LOADFROMFILE); |
3824 windowtype = BS_ICON; | 3824 windowtype = BS_ICON; |
3825 } | 3825 } |
3826 else | 3826 else |
3827 { | 3827 { |
3828 strcpy(file, filename); | 3828 strcpy(file, filename); |
3829 strcat(file, ".bmp"); | 3829 strcat(file, ".bmp"); |
3830 if (access(file, 04) == 0) | 3830 if (access(file, 04) == 0) |
3831 { | 3831 { |
3832 *hbitmap = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); | 3832 *hbitmap = (HBITMAP)LoadImage(NULL, UTF8toWide(file), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); |
3833 windowtype = BS_BITMAP; | 3833 windowtype = BS_BITMAP; |
3834 } | 3834 } |
3835 } | 3835 } |
3836 free(file); | 3836 free(file); |
3837 } | 3837 } |
6406 windowtype = BS_ICON; | 6406 windowtype = BS_ICON; |
6407 else | 6407 else |
6408 hbitmap = _dw_load_bitmap(file, NULL); | 6408 hbitmap = _dw_load_bitmap(file, NULL); |
6409 #else | 6409 #else |
6410 if ( len > 1 && data[0] == 'B' && data[1] == 'M' ) /* first 2 chars of data is BM, then its a BMP */ | 6410 if ( len > 1 && data[0] == 'B' && data[1] == 'M' ) /* first 2 chars of data is BM, then its a BMP */ |
6411 hbitmap = (HBITMAP)LoadImage( NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); | 6411 hbitmap = (HBITMAP)LoadImage( NULL, UTF8toWide(file), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); |
6412 else /* otherwise its assumed to be an ico */ | 6412 else /* otherwise its assumed to be an ico */ |
6413 { | 6413 { |
6414 hicon = LoadImage( NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); | 6414 hicon = LoadImage( NULL, UTF8toWide(file), IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); |
6415 windowtype = BS_ICON; | 6415 windowtype = BS_ICON; |
6416 } | 6416 } |
6417 #endif | 6417 #endif |
6418 } | 6418 } |
6419 else | 6419 else |
6800 fclose( fp ); | 6800 fclose( fp ); |
6801 #ifdef GDIPLUS | 6801 #ifdef GDIPLUS |
6802 hbitmap = _dw_load_bitmap(file, NULL); | 6802 hbitmap = _dw_load_bitmap(file, NULL); |
6803 #else | 6803 #else |
6804 if ( len > 1 && data[0] == 'B' && data[1] == 'M' ) /* first 2 chars of data is BM, then its a BMP */ | 6804 if ( len > 1 && data[0] == 'B' && data[1] == 'M' ) /* first 2 chars of data is BM, then its a BMP */ |
6805 hbitmap = (HBITMAP)LoadImage( NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); | 6805 hbitmap = (HBITMAP)LoadImage( NULL, UTF8toWide(file), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); |
6806 else /* otherwise its assumed to be an ico */ | 6806 else /* otherwise its assumed to be an ico */ |
6807 icon = LoadImage( NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); | 6807 icon = LoadImage( NULL, UTF8toWide(file), IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); |
6808 #endif | 6808 #endif |
6809 } | 6809 } |
6810 else | 6810 else |
6811 { | 6811 { |
6812 _unlink( file ); | 6812 _unlink( file ); |
7134 } | 7134 } |
7135 } | 7135 } |
7136 #ifdef TOOLBAR | 7136 #ifdef TOOLBAR |
7137 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) | 7137 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) |
7138 { | 7138 { |
7139 #ifdef AEROGLASS | |
7139 if(!(_dw_composition && (GetWindowLongPtr(_toplevel_window(box), GWL_EXSTYLE) & WS_EX_LAYERED))) | 7140 if(!(_dw_composition && (GetWindowLongPtr(_toplevel_window(box), GWL_EXSTYLE) & WS_EX_LAYERED))) |
7141 #endif | |
7140 { | 7142 { |
7141 /* Enable double buffering if our window isn't composited */ | 7143 /* Enable double buffering if our window isn't composited */ |
7142 SendMessage(item, TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_DOUBLEBUFFER); | 7144 SendMessage(item, TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_DOUBLEBUFFER); |
7143 } | 7145 } |
7144 } | 7146 } |
9066 { | 9068 { |
9067 free(file); | 9069 free(file); |
9068 return 0; | 9070 return 0; |
9069 } | 9071 } |
9070 } | 9072 } |
9071 icon = LoadImage(NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE); | 9073 icon = LoadImage(NULL, UTF8toWide(file), IMAGE_ICON, 0, 0, LR_LOADFROMFILE); |
9072 free(file); | 9074 free(file); |
9073 return (HICN)icon; | 9075 return (HICN)icon; |
9074 #endif | 9076 #endif |
9075 } | 9077 } |
9076 | 9078 |
9098 fwrite( data, 1, len, fp ); | 9100 fwrite( data, 1, len, fp ); |
9099 fclose( fp ); | 9101 fclose( fp ); |
9100 #ifdef GDIPLUS | 9102 #ifdef GDIPLUS |
9101 icon = _dw_load_icon(file); | 9103 icon = _dw_load_icon(file); |
9102 #else | 9104 #else |
9103 icon = LoadImage( NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); | 9105 icon = LoadImage( NULL, UTF8toWide(file), IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); |
9104 #endif | 9106 #endif |
9105 } | 9107 } |
9106 else | 9108 else |
9107 { | 9109 { |
9108 _unlink( file ); | 9110 _unlink( file ); |
10579 free(file); | 10581 free(file); |
10580 return NULL; | 10582 return NULL; |
10581 } | 10583 } |
10582 } | 10584 } |
10583 | 10585 |
10584 pixmap->hbm = (HBITMAP)LoadImage(NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); | 10586 pixmap->hbm = (HBITMAP)LoadImage(NULL, UTF8toWide(file), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); |
10585 pixmap->depth = _read_bitmap_header(file); | 10587 pixmap->depth = _read_bitmap_header(file); |
10586 #endif | 10588 #endif |
10587 | 10589 |
10588 pixmap->handle = handle; | 10590 pixmap->handle = handle; |
10589 | 10591 |
10641 fwrite( data, 1, len, fp ); | 10643 fwrite( data, 1, len, fp ); |
10642 fclose( fp ); | 10644 fclose( fp ); |
10643 #ifdef GDIPLUS | 10645 #ifdef GDIPLUS |
10644 pixmap->hbm = _dw_load_bitmap(file, NULL); | 10646 pixmap->hbm = _dw_load_bitmap(file, NULL); |
10645 #else | 10647 #else |
10646 pixmap->hbm = (HBITMAP)LoadImage( NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); | 10648 pixmap->hbm = (HBITMAP)LoadImage( NULL, UTF8toWide(file), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); |
10647 pixmap->depth = _read_bitmap_header(file); | 10649 pixmap->depth = _read_bitmap_header(file); |
10648 #endif | 10650 #endif |
10649 } | 10651 } |
10650 else | 10652 else |
10651 { | 10653 { |