Commit cb327212 authored by Pavel Roskin's avatar Pavel Roskin Committed by Alexandre Julliard

File open dialog now uses icons instead of bitmaps.

parent 960c725e
......@@ -28,11 +28,14 @@
extern DWORD CommDlgLastError;
static HBITMAP16 hFolder = 0;
static HBITMAP16 hFolder2 = 0;
static HBITMAP16 hFloppy = 0;
static HBITMAP16 hHDisk = 0;
static HBITMAP16 hCDRom = 0;
static HICON16 hFolder = 0;
static HICON16 hFolder2 = 0;
static HICON16 hFloppy = 0;
static HICON16 hHDisk = 0;
static HICON16 hCDRom = 0;
static HICON16 hNet = 0;
static int fldrHeight = 0;
static int fldrWidth = 0;
static const char defaultfilter[]=" \0\0";
......@@ -42,19 +45,30 @@ static const char defaultfilter[]=" \0\0";
static BOOL FileDlg_Init(void)
{
static BOOL initialized = 0;
CURSORICONINFO *fldrInfo;
if (!initialized) {
if (!hFolder) hFolder = LoadBitmap16(0, MAKEINTRESOURCE16(OBM_FOLDER));
if (!hFolder2) hFolder2 = LoadBitmap16(0, MAKEINTRESOURCE16(OBM_FOLDER2));
if (!hFloppy) hFloppy = LoadBitmap16(0, MAKEINTRESOURCE16(OBM_FLOPPY));
if (!hHDisk) hHDisk = LoadBitmap16(0, MAKEINTRESOURCE16(OBM_HDISK));
if (!hCDRom) hCDRom = LoadBitmap16(0, MAKEINTRESOURCE16(OBM_CDROM));
if (!hFolder) hFolder = LoadIcon16(0, MAKEINTRESOURCE16(OIC_FOLDER));
if (!hFolder2) hFolder2 = LoadIcon16(0, MAKEINTRESOURCE16(OIC_FOLDER2));
if (!hFloppy) hFloppy = LoadIcon16(0, MAKEINTRESOURCE16(OIC_FLOPPY));
if (!hHDisk) hHDisk = LoadIcon16(0, MAKEINTRESOURCE16(OIC_HDISK));
if (!hCDRom) hCDRom = LoadIcon16(0, MAKEINTRESOURCE16(OIC_CDROM));
if (!hNet) hNet = LoadIcon16(0, MAKEINTRESOURCE16(OIC_NETWORK));
if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
hHDisk == 0 || hCDRom == 0)
hHDisk == 0 || hCDRom == 0 || hNet == 0)
{
ERR(commdlg, "Error loading icons !\n");
return FALSE;
}
fldrInfo = (CURSORICONINFO *) GlobalLock16( hFolder2 );
if (!fldrInfo)
{
WARN(commdlg, "Error loading bitmaps !\nprin");
ERR(commdlg, "Error measuring icons !\n");
return FALSE;
}
fldrHeight = fldrInfo -> nHeight;
fldrWidth = fldrInfo -> nWidth;
GlobalUnlock16( hFolder2 );
initialized = TRUE;
}
return TRUE;
......@@ -400,7 +414,7 @@ static BOOL FILEDLG_ScanDir(HWND16 hWnd, LPSTR newPath)
}
strcpy(buffer, "*.*");
return DlgDirListA(hWnd, buffer, lst2, stc1, 0x8010);
return DlgDirListA(hWnd, buffer, lst2, stc1, DDL_EXCLUSIVE | DDL_DIRECTORY);
}
/***********************************************************************
......@@ -437,87 +451,94 @@ static LONG FILEDLG_WMDrawItem(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam,int s
{
LPDRAWITEMSTRUCT16 lpdis = (LPDRAWITEMSTRUCT16)PTR_SEG_TO_LIN(lParam);
char *str;
HBRUSH hBrush;
HBITMAP16 hBitmap, hPrevBitmap;
BITMAP16 bm;
HDC hMemDC;
HICON16 hIcon;
COLORREF oldText = 0, oldBk = 0;
if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst1)
{
if (!(str = SEGPTR_ALLOC(512))) return FALSE;
hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH));
SelectObject(lpdis->hDC, hBrush);
FillRect16(lpdis->hDC, &lpdis->rcItem, hBrush);
SendMessage16(lpdis->hwndItem, LB_GETTEXT16, lpdis->itemID,
(LPARAM)SEGPTR_GET(str));
if (savedlg) /* use _gray_ text in FileSaveDlg */
{
if (!lpdis->itemState)
if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
{
oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
}
if (savedlg)
SetTextColor(lpdis->hDC,GetSysColor(COLOR_GRAYTEXT) );
else
SetTextColor(lpdis->hDC,GetSysColor(COLOR_WINDOWTEXT) );
/* inversion of gray would be bad readable */
}
TextOut16(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
str, strlen(str));
if (lpdis->itemState != 0) {
InvertRect16(lpdis->hDC, &lpdis->rcItem);
ExtTextOut16(lpdis->hDC, lpdis->rcItem.left + 1,
lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
&(lpdis->rcItem), str, strlen(str), NULL);
if (lpdis->itemState & ODS_SELECTED)
DrawFocusRect16( lpdis->hDC, &(lpdis->rcItem) );
if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
{
SetBkColor( lpdis->hDC, oldBk );
SetTextColor( lpdis->hDC, oldText );
}
SEGPTR_FREE(str);
return TRUE;
}
if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst2)
{
if (!(str = SEGPTR_ALLOC(512))) return FALSE;
hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH));
SelectObject(lpdis->hDC, hBrush);
FillRect16(lpdis->hDC, &lpdis->rcItem, hBrush);
SendMessage16(lpdis->hwndItem, LB_GETTEXT16, lpdis->itemID,
(LPARAM)SEGPTR_GET(str));
hBitmap = hFolder;
GetObject16( hBitmap, sizeof(bm), &bm );
TextOut16(lpdis->hDC, lpdis->rcItem.left + bm.bmWidth,
lpdis->rcItem.top, str, strlen(str));
hMemDC = CreateCompatibleDC(lpdis->hDC);
hPrevBitmap = SelectObject(hMemDC, hBitmap);
BitBlt(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
SelectObject(hMemDC, hPrevBitmap);
DeleteDC(hMemDC);
if (lpdis->itemState != 0) InvertRect16(lpdis->hDC, &lpdis->rcItem);
if (lpdis->itemState & ODS_SELECTED)
{
oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
}
ExtTextOut16(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
&(lpdis->rcItem), str, strlen(str), NULL);
if (lpdis->itemState & ODS_SELECTED)
DrawFocusRect16( lpdis->hDC, &(lpdis->rcItem) );
if (lpdis->itemState & ODS_SELECTED)
{
SetBkColor( lpdis->hDC, oldBk );
SetTextColor( lpdis->hDC, oldText );
}
DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hFolder);
SEGPTR_FREE(str);
return TRUE;
}
if (lpdis->CtlType == ODT_COMBOBOX && lpdis->CtlID == cmb2)
{
if (!(str = SEGPTR_ALLOC(512))) return FALSE;
hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH));
SelectObject(lpdis->hDC, hBrush);
FillRect16(lpdis->hDC, &lpdis->rcItem, hBrush);
SendMessage16(lpdis->hwndItem, CB_GETLBTEXT16, lpdis->itemID,
(LPARAM)SEGPTR_GET(str));
switch(DRIVE_GetType( str[2] - 'a' ))
{
case TYPE_FLOPPY: hBitmap = hFloppy; break;
case TYPE_CDROM: hBitmap = hCDRom; break;
case TYPE_FLOPPY: hIcon = hFloppy; break;
case TYPE_CDROM: hIcon = hCDRom; break;
case TYPE_NETWORK: hIcon = hNet; break;
case TYPE_HD:
case TYPE_NETWORK:
default: hBitmap = hHDisk; break;
default: hIcon = hHDisk; break;
}
GetObject16( hBitmap, sizeof(bm), &bm );
TextOut16(lpdis->hDC, lpdis->rcItem.left + bm.bmWidth,
lpdis->rcItem.top, str, strlen(str));
hMemDC = CreateCompatibleDC(lpdis->hDC);
hPrevBitmap = SelectObject(hMemDC, hBitmap);
BitBlt( lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY );
SelectObject(hMemDC, hPrevBitmap);
DeleteDC(hMemDC);
if (lpdis->itemState != 0) InvertRect16(lpdis->hDC, &lpdis->rcItem);
if (lpdis->itemState & ODS_SELECTED)
{
oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
}
ExtTextOut16(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
&(lpdis->rcItem), str, strlen(str), NULL);
if (lpdis->itemState & ODS_SELECTED)
{
SetBkColor( lpdis->hDC, oldBk );
SetTextColor( lpdis->hDC, oldText );
}
DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hIcon);
SEGPTR_FREE(str);
return TRUE;
}
......@@ -529,12 +550,10 @@ static LONG FILEDLG_WMDrawItem(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam,int s
*/
static LONG FILEDLG_WMMeasureItem(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam)
{
BITMAP16 bm;
LPMEASUREITEMSTRUCT16 lpmeasure;
GetObject16( hFolder2, sizeof(bm), &bm );
lpmeasure = (LPMEASUREITEMSTRUCT16)PTR_SEG_TO_LIN(lParam);
lpmeasure->itemHeight = bm.bmHeight;
lpmeasure->itemHeight = fldrHeight;
return TRUE;
}
......
......@@ -34,11 +34,6 @@ typedef unsigned long Pixel;
#include "x11drv.h"
/* Include OEM pixmaps */
#include "bitmaps/obm_cdrom"
#include "bitmaps/obm_harddisk"
#include "bitmaps/obm_drive"
#include "bitmaps/obm_folder2"
#include "bitmaps/obm_folder"
#include "bitmaps/obm_lfarrowi"
#include "bitmaps/obm_rgarrowi"
#include "bitmaps/obm_dnarrowi"
......@@ -97,11 +92,6 @@ static struct
{ obm_closed_95,TRUE}, /* OBM_CLOSED */
{ obm_radiocheck, FALSE }, /* OBM_RADIOCHECK */
{ obm_trtype, TRUE }, /* OBM_TRTYPE */
{ obm_cdrom, TRUE }, /* OBM_CDROM */
{ obm_harddisk, TRUE }, /* OBM_HARDDISK */
{ obm_drive, TRUE }, /* OBM_DRIVE */
{ obm_folder2, TRUE }, /* OBM_FOLDER2 */
{ obm_folder, TRUE }, /* OBM_FOLDER */
{ obm_lfarrowi, TRUE }, /* OBM_LFARROWI */
{ obm_rgarrowi, TRUE }, /* OBM_RGARROWI */
{ obm_dnarrowi, TRUE }, /* OBM_DNARROWI */
......@@ -152,9 +142,15 @@ static struct
#include "bitmaps/oic_ques_95"
#include "bitmaps/oic_bang_95"
#include "bitmaps/oic_note_95"
#include "bitmaps/oic_folder"
#include "bitmaps/oic_folder2"
#include "bitmaps/oic_floppy"
#include "bitmaps/oic_cdrom"
#include "bitmaps/oic_hdisk"
#include "bitmaps/oic_network"
#define OIC_FIRST OIC_SAMPLE /* First OEM icon */
#define OIC_LAST OIC_WINEICON /* Last OEM icon */
#define OIC_LAST OIC_NETWORK /* Last OEM icon */
static char **OBM_Icons_Data[OIC_LAST-OIC_FIRST+1] =
{
......@@ -165,7 +161,13 @@ static char **OBM_Icons_Data[OIC_LAST-OIC_FIRST+1] =
oic_note, /* OIC_NOTE */
oic_portrait, /* OIC_PORTRAIT */
oic_landscape, /* OIC_LANDSCAPE */
oic_wineicon /* OIC_WINEICON */
oic_wineicon, /* OIC_WINEICON */
oic_folder, /* OIC_FOLDER */
oic_folder2, /* OIC_FOLDER2 */
oic_floppy, /* OIC_FLOPPY */
oic_cdrom, /* OIC_CDROM */
oic_hdisk, /* OIC_HDISK */
oic_network /* OIC_NETWORK */
};
......
/* XPM */
static char * obm_cdrom[] = {
"20 15 5 1",
" s white c white",
". s black c black",
"X s ltgray c #c0c0c0",
"o s dkgray c #808080",
"O s red c red",
" ",
" ",
" .................. ",
" .XXXXXXXXXXXXXXXo. ",
" .XXXXXXXXXXXXXXXo. ",
" .XoooooooooooooXo. ",
" .Xo.XXXXXXXXX.oXo. ",
" .Xoo..XXXXX..ooXo. ",
" .XXXXX.....XXXXXo. ",
" .X.XOOXXXXXXX..Xo. ",
" .X.XOOXXXXXXX..Xo. ",
" .oooooooooooooooo. ",
" .................. ",
" ",
" "};
/* XPM */
static char * obm_folder2[] = {
"20 16 5 1",
" s white c white",
". s dkgray c #808080",
"X s yellow c yellow",
"o s ltgray c #c0c0c0",
"B s black c black",
" ",
" ",
" ..... ",
" . . ",
" . .X.X. ...... ",
" . X.X.X. .. ",
" . .X.X.X.X.X... ",
" .............X.. ",
" . ..... ",
" . oXoXoXoXoX.... ",
" . oXoXoXoXo.... ",
" . XoXoXoXoXo... ",
" . XoXoXoXoX... ",
" .............. ",
" ............. ",
" "};
/* XPM */
static char * oic_cdrom[] = {
"20 15 8 1",
" s None c None",
". s dkgray c #808080",
"X s ltgray c #c0c0c0",
"o s yellow c #ffff00",
"O s black c #000000",
"+ s green c #00ff00",
"@ s cyan c #00ffff",
"# s white c #ffffff",
" ...... ",
" ..XXXXXoOO ",
" .XXXXXXXo+@O ",
" .XXXXXXXX+@@oO ",
" .XXXXXXXX+@ooO ",
" .XXXXXXXXX@ooooO ",
" .XXXXX.OO.XXXXXO ",
" .XXXXXOOOO#XXXXO ",
" .XXXXX.OO.#XXXXO ",
" .ooooo@###XXXXXO ",
" ..oo+@@XXXXXXXO ",
" .o++@oXXXXXXXO ",
" .+@@oXXXXXXO ",
" ..ooXXXXOO ",
" OOOOOO "};
/* XPM */
static char * obm_drive[] = {
"20 15 5 1",
" s white c white",
". s black c black",
"X s ltgray c #c0c0c0",
"o s dkgray c #808080",
"O s red c red",
static char * oic_floppy[] = {
"20 15 6 1",
" s None c None",
". s black c #000000",
"x s white c #ffffff",
"X s ltgray c #c0c0c0",
"o s dkgray c #808080",
"O s green c #00ff00",
" ",
" ",
" .................. ",
" .XXXXXXXXXXXXXXXo. ",
" .XXXXXXXXXXXXXXXo. ",
" .XXX.........XXXo. ",
" .XXXX.......XXXXo. ",
" .X.............Xo. ",
" .XXX.........XXXo. ",
" .XXXX.......XXXXo. ",
" .XXXXXXXXXXXXXXXo. ",
" .XXXOOXXXXX..XXXo. ",
" .XXXOOXXXXX..XXXo. ",
" .oooooooooooooooo. ",
" .................. ",
" ",
" ",
" "};
/* XPM */
static char * obm_folder[] = {
"20 16 5 1",
" s white c white",
static char * oic_folder[] = {
"20 16 6 1",
" s None c None",
". s dkgray c #808080",
"X s yellow c yellow",
"o s ltgray c #c0c0c0",
"O s white c white",
"B s black c black",
" ",
" ..... ",
" .XoXoX. ",
" .XoXoXoX...... ",
" . .. ",
" . XoXoXoXoXoX.. ",
" . oXoXoXoXoXo.. ",
" . XoXoXoXoXoX.. ",
" . oXoXoXoXoXo.. ",
" . XoXoXoXoXoX.. ",
" . oXoXoXoXoXo.. ",
" . XoXoXoXoXoX.. ",
" .OOOOOOOOOOOO.. ",
" .OXoXoXoXoXoX.. ",
" .OoXoXoXoXoXo.. ",
" .OXoXoXoXoXoX.. ",
" .OoXoXoXoXoXo.. ",
" .OXoXoXoXoXoX.. ",
" .OoXoXoXoXoXo.. ",
" .OXoXoXoXoXoX.. ",
" ............... ",
" .............. ",
" ",
......
/* XPM */
static char * oic_folder2[] = {
"20 16 6 1",
" s None c None",
". s dkgray c #808080",
"X s yellow c yellow",
"o s ltgray c #c0c0c0",
"O s white c white",
"B s black c black",
" ",
" ",
" ..... ",
" .OOOOO. ",
" .O.X.X.O...... ",
" .OX.X.X.OOOOO.. ",
" .O.X.X.X.X.X... ",
" .............X.. ",
" .OOOOOOOOOO..... ",
" .OoXoXoXoXoX.... ",
" .OoXoXoXoXo.... ",
" .OXoXoXoXoXo... ",
" .OXoXoXoXoX... ",
" .............. ",
" ............. ",
" "};
/* XPM */
static char * obm_harddisk[] = {
static char * oic_hdisk[] = {
"20 15 5 1",
" s white c white",
" s None c None",
". s black c black",
"X s ltgray c #c0c0c0",
"o s dkgray c #808080",
......
/* XPM */
static char * oic_network[] = {
"20 15 7 1",
" s None c None",
". s dkgray c #808080",
"x s white c #ffffff",
"X s ltgray c #c0c0c0",
"o s black c #000000",
"O s green c #00ff00",
"+ s yellow c #ffff00",
" ",
" ............. ",
" .XXXXXXXXXXXX.o ",
" .xxxxxxxxxxxx..o ",
" .XXXXXXXXXXOX..o ",
" .XXXXXXXXXXXX..o ",
" .X..........X..o ",
" .XxxxxxxxxxxX.o ",
" ooooooooooooo ",
" oo ",
" Xo ",
" XXXXXX+++oXXXXXX ",
" oooooo+x+ooooooo ",
" oooo ",
" "};
......@@ -209,52 +209,43 @@ typedef struct
#define ES_NUMBER 0x00002000
/* OEM Resource Ordinal Numbers */
#define OBM_CLOSE 32754
#define OBM_UPARROW 32753
#define OBM_DNARROW 32752
#define OBM_RGARROW 32751
#define OBM_LFARROW 32750
#define OBM_REDUCE 32749
#define OBM_ZOOM 32748
#define OBM_RESTORE 32747
#define OBM_REDUCED 32746
#define OBM_ZOOMD 32745
#define OBM_RESTORED 32744
#define OBM_UPARROWD 32743
#define OBM_DNARROWD 32742
#define OBM_RGARROWD 32741
#define OBM_LFARROWD 32740
#define OBM_MNARROW 32739
#define OBM_COMBO 32738
#define OBM_UPARROWI 32737
#define OBM_DNARROWI 32736
#define OBM_RGARROWI 32735
#define OBM_CLOSED 32731
#define OBM_RADIOCHECK 32732
#define OBM_TRTYPE 32733
#define OBM_LFARROWI 32734
#define OBM_FOLDER 32733
#define OBM_FOLDER2 32732
#define OBM_FLOPPY 32731
#define OBM_HDISK 32730
#define OBM_CDROM 32729
#define OBM_TRTYPE 32728
/* Wine extension, I think. */
#define OBM_CLOSED 32726
#define OBM_RADIOCHECK 32727
#define OBM_OLD_CLOSE 32767
#define OBM_SIZE 32766
#define OBM_OLD_UPARROW 32765
#define OBM_OLD_DNARROW 32764
#define OBM_OLD_RGARROW 32763
#define OBM_OLD_LFARROW 32762
#define OBM_BTSIZE 32761
#define OBM_CHECK 32760
#define OBM_CHECKBOXES 32759
#define OBM_BTNCORNERS 32758
#define OBM_OLD_REDUCE 32757
#define OBM_OLD_ZOOM 32756
#define OBM_RGARROWI 32735
#define OBM_DNARROWI 32736
#define OBM_UPARROWI 32737
#define OBM_COMBO 32738
#define OBM_MNARROW 32739
#define OBM_LFARROWD 32740
#define OBM_RGARROWD 32741
#define OBM_DNARROWD 32742
#define OBM_UPARROWD 32743
#define OBM_RESTORED 32744
#define OBM_ZOOMD 32745
#define OBM_REDUCED 32746
#define OBM_RESTORE 32747
#define OBM_ZOOM 32748
#define OBM_REDUCE 32749
#define OBM_LFARROW 32750
#define OBM_RGARROW 32751
#define OBM_DNARROW 32752
#define OBM_UPARROW 32753
#define OBM_CLOSE 32754
#define OBM_OLD_RESTORE 32755
#define OBM_OLD_ZOOM 32756
#define OBM_OLD_REDUCE 32757
#define OBM_BTNCORNERS 32758
#define OBM_CHECKBOXES 32759
#define OBM_CHECK 32760
#define OBM_BTSIZE 32761
#define OBM_OLD_LFARROW 32762
#define OBM_OLD_RGARROW 32763
#define OBM_OLD_DNARROW 32764
#define OBM_OLD_UPARROW 32765
#define OBM_SIZE 32766
#define OBM_OLD_CLOSE 32767
#define OCR_BUMMER 100
#define OCR_DRAGOBJECT 101
......@@ -284,6 +275,12 @@ typedef struct
#define OIC_PORTRAIT 32517
#define OIC_LANDSCAPE 32518
#define OIC_WINEICON 32519
#define OIC_FOLDER 32520
#define OIC_FOLDER2 32521
#define OIC_FLOPPY 32522
#define OIC_CDROM 32523
#define OIC_HDISK 32524
#define OIC_NETWORK 32525
/* Edit control messages */
#define EM_GETSEL 0x00b0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment