ReactOS 0.4.17-dev-966-gf06eace
filedlg31.c File Reference
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "winreg.h"
#include "winternl.h"
#include "commdlg.h"
#include "shlwapi.h"
#include "cderr.h"
#include "cdlg.h"
Include dependency graph for filedlg31.c:

Go to the source code of this file.

Classes

struct  tagFD31_DATA
 

Macros

#define BUFFILE   512
 
#define BUFFILEALLOC   512 * sizeof(WCHAR)
 
#define FD31_OFN_PROP   "FILEDLG_OFN"
 

Typedefs

typedef struct tagFD31_DATA FD31_DATA
 
typedef struct tagFD31_DATA * PFD31_DATA
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commdlg)
 
static BOOL FD31_Init (void)
 
static void FD31_StripEditControl (HWND hwnd)
 
static BOOL FD31_CallWindowProc (const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
 
static LPCWSTR FD31_GetFileType (LPCWSTR cfptr, LPCWSTR fptr, const WORD index)
 
static BOOL FD31_ScanDir (const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath)
 
static LONG FD31_WMDrawItem (HWND hWnd, WPARAM wParam, LPARAM lParam, int savedlg, const DRAWITEMSTRUCT *lpdis)
 
static void FD31_UpdateResult (const FD31_DATA *lfs, const WCHAR *tmpstr)
 
static void FD31_UpdateFileTitle (const FD31_DATA *lfs)
 
static LRESULT FD31_DirListDblClick (const FD31_DATA *lfs)
 
static LRESULT FD31_FileListSelect (const FD31_DATA *lfs)
 
static LRESULT FD31_TestPath (const FD31_DATA *lfs, LPWSTR path)
 
static LRESULT FD31_Validate (const FD31_DATA *lfs, LPCWSTR path, UINT control, INT itemIndex, BOOL internalUse)
 
static LRESULT FD31_DiskChange (const FD31_DATA *lfs)
 
static LRESULT FD31_FileTypeChange (const FD31_DATA *lfs)
 
static LRESULT FD31_WMCommand (HWND hWnd, LPARAM lParam, UINT notification, UINT control, const FD31_DATA *lfs)
 
static LPWSTR FD31_MapStringPairsToW (LPCSTR strA, UINT size)
 
static LPWSTR FD31_DupToW (LPCSTR str, DWORD size)
 
static void FD31_MapOfnStructA (const OPENFILENAMEA *ofnA, LPOPENFILENAMEW ofnW, BOOL open)
 
static void FD31_FreeOfnW (OPENFILENAMEW *ofnW)
 
static void FD31_DestroyPrivate (PFD31_DATA lfs)
 
static BOOL FD31_GetTemplate (PFD31_DATA lfs)
 
static PFD31_DATA FD31_AllocPrivate (LPARAM lParam, UINT dlgType, BOOL IsUnicode)
 
static LONG FD31_WMInitDialog (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
static int FD31_GetFldrHeight (void)
 
static LONG FD31_WMMeasureItem (LPARAM lParam)
 
static INT_PTR CALLBACK FD31_FileOpenDlgProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
 
BOOL GetFileName31A (OPENFILENAMEA *lpofn, UINT dlgType)
 
BOOL GetFileName31W (OPENFILENAMEW *lpofn, UINT dlgType)
 

Variables

static const int fldrHeight = 16
 
static const int fldrWidth = 20
 
static HICON hFolder = 0
 
static HICON hFolder2 = 0
 
static HICON hFloppy = 0
 
static HICON hHDisk = 0
 
static HICON hCDRom = 0
 
static HICON hNet = 0
 

Macro Definition Documentation

◆ BUFFILE

#define BUFFILE   512

Definition at line 43 of file filedlg31.c.

◆ BUFFILEALLOC

#define BUFFILEALLOC   512 * sizeof(WCHAR)

Definition at line 44 of file filedlg31.c.

◆ FD31_OFN_PROP

#define FD31_OFN_PROP   "FILEDLG_OFN"

Definition at line 56 of file filedlg31.c.

Typedef Documentation

◆ FD31_DATA

◆ PFD31_DATA

Function Documentation

◆ FD31_AllocPrivate()

static PFD31_DATA FD31_AllocPrivate ( LPARAM  lParam,
UINT  dlgType,
BOOL  IsUnicode 
)
static

Definition at line 915 of file filedlg31.c.

916{
917 FD31_DATA *lfs = heap_alloc_zero(sizeof(*lfs));
918
919 TRACE("alloc private buf %p\n", lfs);
920 if (!lfs) return NULL;
921 lfs->hook = FALSE;
922 lfs->lParam = lParam;
923 lfs->open = (dlgType == OPEN_DIALOG);
924
925 if (IsUnicode)
926 {
927 lfs->ofnA = NULL;
928 lfs->ofnW = (LPOPENFILENAMEW) lParam;
929 if (lfs->ofnW->Flags & OFN_ENABLEHOOK)
930 if (lfs->ofnW->lpfnHook)
931 lfs->hook = TRUE;
932 }
933 else
934 {
935 lfs->ofnA = (LPOPENFILENAMEA) lParam;
936 if (lfs->ofnA->Flags & OFN_ENABLEHOOK)
937 if (lfs->ofnA->lpfnHook)
938 lfs->hook = TRUE;
939 lfs->ofnW = heap_alloc_zero(lfs->ofnA->lStructSize);
940 lfs->ofnW->lStructSize = lfs->ofnA->lStructSize;
941 FD31_MapOfnStructA(lfs->ofnA, lfs->ofnW, lfs->open);
942 }
943
944 if (! FD31_GetTemplate(lfs))
945 {
947 return NULL;
948 }
951
952 return lfs;
953}
LPARAM lParam
Definition: combotst.c:139
#define FILEOKSTRINGA
Definition: commdlg.h:17
struct tagOFNW * LPOPENFILENAMEW
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
struct tagOFNA * LPOPENFILENAMEA
#define OPEN_DIALOG
Definition: commdlg.h:13
#define LBSELCHSTRINGA
Definition: commdlg.h:15
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static void FD31_DestroyPrivate(PFD31_DATA lfs)
Definition: filedlg31.c:832
static BOOL FD31_GetTemplate(PFD31_DATA lfs)
Definition: filedlg31.c:856
static void FD31_MapOfnStructA(const OPENFILENAMEA *ofnA, LPOPENFILENAMEW ofnW, BOOL open)
Definition: filedlg31.c:754
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)
#define TRACE(s)
Definition: solgame.cpp:4
LPARAM lParam
Definition: filedlg31.c:64
UINT lbselchstring
Definition: filedlg31.c:62
UINT fileokstring
Definition: filedlg31.c:63
LPOPENFILENAMEW ofnW
Definition: filedlg31.c:67
LPOPENFILENAMEA ofnA
Definition: filedlg31.c:69
DWORD Flags
Definition: commdlg.h:342
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
DWORD lStructSize
Definition: commdlg.h:329
DWORD Flags
Definition: commdlg.h:373
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
DWORD lStructSize
Definition: commdlg.h:360

Referenced by GetFileName31A(), and GetFileName31W().

◆ FD31_CallWindowProc()

static BOOL FD31_CallWindowProc ( const FD31_DATA *  lfs,
UINT  wMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 122 of file filedlg31.c.

123{
124 BOOL ret;
125
126 if (lfs->ofnA)
127 {
128 TRACE("Call hookA %p (%p, %04x, %08Ix, %08Ix)\n",
129 lfs->ofnA->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
130 ret = lfs->ofnA->lpfnHook(lfs->hwnd, wMsg, wParam, lParam);
131 TRACE("ret hookA %p (%p, %04x, %08Ix, %08Ix)\n",
132 lfs->ofnA->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
133 return ret;
134 }
135
136 TRACE("Call hookW %p (%p, %04x, %08Ix, %08Ix)\n",
137 lfs->ofnW->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
138 ret = lfs->ofnW->lpfnHook(lfs->hwnd, wMsg, wParam, lParam);
139 TRACE("Ret hookW %p (%p, %04x, %08Ix, %08Ix)\n",
140 lfs->ofnW->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
141 return ret;
142}
WPARAM wParam
Definition: combotst.c:138
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by FD31_DirListDblClick(), FD31_FileListSelect(), FD31_FileOpenDlgProc(), FD31_Validate(), and FD31_WMInitDialog().

◆ FD31_DestroyPrivate()

static void FD31_DestroyPrivate ( PFD31_DATA  lfs)
static

Definition at line 832 of file filedlg31.c.

833{
834 HWND hwnd;
835 if (!lfs) return;
836 hwnd = lfs->hwnd;
837 TRACE("destroying private allocation %p\n", lfs);
838
839 /* if ofnW has been allocated, have to free everything in it */
840 if (lfs->ofnA)
841 {
842 FD31_FreeOfnW(lfs->ofnW);
843 heap_free(lfs->ofnW);
844 }
845 heap_free(lfs);
847}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define FD31_OFN_PROP
Definition: filedlg31.c:56
static void FD31_FreeOfnW(OPENFILENAMEW *ofnW)
Definition: filedlg31.c:816
HANDLE WINAPI RemovePropA(_In_ HWND, _In_ LPCSTR)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by FD31_AllocPrivate(), GetFileName31A(), and GetFileName31W().

◆ FD31_DirListDblClick()

static LRESULT FD31_DirListDblClick ( const FD31_DATA *  lfs)
static

Definition at line 408 of file filedlg31.c.

409{
410 LONG lRet;
411 HWND hWnd = lfs->hwnd;
412 LPWSTR pstr;
413 WCHAR tmpstr[BUFFILE];
414
415 /* get the raw string (with brackets) */
417 if (lRet == LB_ERR) return TRUE;
418 pstr = heap_alloc(BUFFILEALLOC);
420 (LPARAM)pstr);
421 lstrcpyW( tmpstr, pstr );
422 heap_free(pstr);
423 /* get the selected directory in tmpstr */
424 if (tmpstr[0] == '[')
425 {
426 tmpstr[lstrlenW(tmpstr) - 1] = 0;
427 lstrcpyW(tmpstr,tmpstr+1);
428 }
429 lstrcatW(tmpstr, L"\\");
430
431 FD31_ScanDir(lfs->ofnW, hWnd, tmpstr);
432 /* notify the app */
433 if (lfs->hook)
434 {
437 return TRUE;
438 }
439 return TRUE;
440}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
HWND hWnd
Definition: settings.c:17
#define CD_LBSELCHANGE
Definition: commdlg.h:196
#define lst2
Definition: dlgs.h:101
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
#define L(x)
Definition: resources.c:13
static BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:122
static BOOL FD31_ScanDir(const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath)
Definition: filedlg31.c:173
#define BUFFILE
Definition: filedlg31.c:43
#define BUFFILEALLOC
Definition: filedlg31.c:44
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
LONG_PTR LPARAM
Definition: minwindef.h:175
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define LB_ERR
Definition: winuser.h:2468
#define LB_GETTEXT
Definition: winuser.h:2085
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2068
uint16_t * LPWSTR
Definition: typedefs.h:56
#define MAKELONG(a, b)
Definition: typedefs.h:249

Referenced by FD31_WMCommand().

◆ FD31_DiskChange()

static LRESULT FD31_DiskChange ( const FD31_DATA *  lfs)
static

Definition at line 613 of file filedlg31.c.

614{
615 LONG lRet;
616 HWND hWnd = lfs->hwnd;
617 LPWSTR pstr;
618 WCHAR diskname[BUFFILE];
619
622 if (lRet == LB_ERR)
623 return 0;
624 pstr = heap_alloc(BUFFILEALLOC);
626 (LPARAM)pstr);
627 wsprintfW(diskname, L"%c:", pstr[2]);
628 heap_free(pstr);
629
630 return FD31_Validate( lfs, diskname, cmb2, lRet, TRUE );
631}
#define cmb2
Definition: dlgs.h:54
static void FD31_StripEditControl(HWND hwnd)
Definition: filedlg31.c:101
static LRESULT FD31_Validate(const FD31_DATA *lfs, LPCWSTR path, UINT control, INT itemIndex, BOOL internalUse)
Definition: filedlg31.c:548
#define CB_GETLBTEXT
Definition: winuser.h:1981
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define CB_GETCURSEL
Definition: winuser.h:1972

Referenced by FD31_WMCommand().

◆ FD31_DupToW()

static LPWSTR FD31_DupToW ( LPCSTR  str,
DWORD  size 
)
static

Definition at line 739 of file filedlg31.c.

740{
741 LPWSTR strW = NULL;
742 if (str && (size > 0))
743 {
744 strW = heap_alloc(size * sizeof(WCHAR));
745 if (strW) MultiByteToWideChar( CP_ACP, 0, str, -1, strW, size );
746 }
747 return strW;
748}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
GLsizeiptr size
Definition: glext.h:5919
WCHAR strW[12]
Definition: clipboard.c:2216
const WCHAR * str

Referenced by FD31_MapOfnStructA().

◆ FD31_FileListSelect()

static LRESULT FD31_FileListSelect ( const FD31_DATA *  lfs)
static

Definition at line 446 of file filedlg31.c.

447{
448 LONG lRet;
449 HWND hWnd = lfs->hwnd;
450 LPWSTR pstr;
451
452 lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0);
453 if (lRet == LB_ERR)
454 return TRUE;
455
456 /* set the edit control to the chosen file */
457 if ((pstr = heap_alloc(BUFFILEALLOC)))
458 {
460 (LPARAM)pstr);
461 SetDlgItemTextW( hWnd, edt1, pstr );
462 heap_free(pstr);
463 }
464 if (lfs->hook)
465 {
468 }
469 /* FIXME: for OFN_ALLOWMULTISELECT we need CD_LBSELSUB, CD_SELADD,
470 CD_LBSELNOITEMS */
471 return TRUE;
472}
#define edt1
Definition: dlgs.h:70
#define lst1
Definition: dlgs.h:100
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)

Referenced by FD31_WMCommand().

◆ FD31_FileOpenDlgProc()

static INT_PTR CALLBACK FD31_FileOpenDlgProc ( HWND  hWnd,
UINT  wMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1097 of file filedlg31.c.

1099{
1101
1102 TRACE("msg=%x wparam=%Ix lParam=%Ix\n", wMsg, wParam, lParam);
1103 if ((wMsg != WM_INITDIALOG) && lfs && lfs->hook)
1104 {
1105 INT_PTR lRet;
1106 lRet = (INT_PTR)FD31_CallWindowProc( lfs, wMsg, wParam, lParam );
1107 if (lRet) return lRet; /* else continue message processing */
1108 }
1109 switch (wMsg)
1110 {
1111 case WM_INITDIALOG:
1112 return FD31_WMInitDialog( hWnd, wParam, lParam );
1113
1114 case WM_MEASUREITEM:
1115 return FD31_WMMeasureItem( lParam );
1116
1117 case WM_DRAWITEM:
1119
1120 case WM_COMMAND:
1121 return FD31_WMCommand( hWnd, lParam, HIWORD(wParam), LOWORD(wParam), lfs );
1122#if 0
1123 case WM_CTLCOLOR:
1124 SetBkColor( (HDC16)wParam, 0x00C0C0C0 );
1125 switch (HIWORD(lParam))
1126 {
1127 case CTLCOLOR_BTN:
1128 SetTextColor( (HDC16)wParam, 0x00000000 );
1129 return hGRAYBrush;
1130 case CTLCOLOR_STATIC:
1131 SetTextColor( (HDC16)wParam, 0x00000000 );
1132 return hGRAYBrush;
1133 }
1134 break;
1135#endif
1136 }
1137 return FALSE;
1138}
static LONG FD31_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:958
static LRESULT FD31_WMCommand(HWND hWnd, LPARAM lParam, UINT notification, UINT control, const FD31_DATA *lfs)
Definition: filedlg31.c:657
static LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam, int savedlg, const DRAWITEMSTRUCT *lpdis)
Definition: filedlg31.c:222
static LONG FD31_WMMeasureItem(LPARAM lParam)
Definition: filedlg31.c:1083
struct tagFD31_DATA * PFD31_DATA
#define LOWORD(l)
Definition: pedump.c:82
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_INITDIALOG
Definition: winuser.h:1767
#define WM_DRAWITEM
Definition: winuser.h:1673
#define WM_MEASUREITEM
Definition: winuser.h:1674
#define CTLCOLOR_STATIC
Definition: winuser.h:968
#define CTLCOLOR_BTN
Definition: winuser.h:965
int32_t INT_PTR
Definition: typedefs.h:64
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_CTLCOLOR
Definition: windowsx.h:29
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917

Referenced by GetFileName31A(), and GetFileName31W().

◆ FD31_FileTypeChange()

static LRESULT FD31_FileTypeChange ( const FD31_DATA *  lfs)
static

Definition at line 637 of file filedlg31.c.

638{
639 LONG lRet;
640 LPWSTR pstr;
641
642 lRet = SendDlgItemMessageW(lfs->hwnd, cmb1, CB_GETCURSEL, 0, 0);
643 if (lRet == LB_ERR)
644 return TRUE;
645 lfs->ofnW->nFilterIndex = lRet + 1;
646 if (lfs->ofnA)
647 lfs->ofnA->nFilterIndex = lRet + 1;
648 pstr = (LPWSTR)SendDlgItemMessageW(lfs->hwnd, cmb1, CB_GETITEMDATA, lRet, 0);
649 TRACE("Selected filter : %s\n", debugstr_w(pstr));
650
651 return FD31_Validate( lfs, pstr, cmb1, lRet, TRUE );
652}
#define cmb1
Definition: dlgs.h:53
#define debugstr_w
Definition: kernel32.h:32
#define CB_GETITEMDATA
Definition: winuser.h:1979
DWORD nFilterIndex
Definition: commdlg.h:335
DWORD nFilterIndex
Definition: commdlg.h:366

Referenced by FD31_WMCommand().

◆ FD31_FreeOfnW()

static void FD31_FreeOfnW ( OPENFILENAMEW *  ofnW)
static

Definition at line 816 of file filedlg31.c.

817{
818 heap_free((void *)ofnW->lpstrFilter);
820 heap_free(ofnW->lpstrFile);
822 heap_free((void *)ofnW->lpstrInitialDir);
823 heap_free((void *)ofnW->lpstrTitle);
824 if (!IS_INTRESOURCE(ofnW->lpTemplateName))
825 heap_free((void *)ofnW->lpTemplateName);
826}
#define IS_INTRESOURCE(x)
Definition: loader.c:613
LPCWSTR lpTemplateName
Definition: commdlg.h:379
LPWSTR lpstrFile
Definition: commdlg.h:367
LPCWSTR lpstrInitialDir
Definition: commdlg.h:371
LPCWSTR lpstrTitle
Definition: commdlg.h:372
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
LPWSTR lpstrCustomFilter
Definition: commdlg.h:364
LPCWSTR lpstrFilter
Definition: commdlg.h:363

Referenced by FD31_DestroyPrivate().

◆ FD31_GetFileType()

static LPCWSTR FD31_GetFileType ( LPCWSTR  cfptr,
LPCWSTR  fptr,
const WORD  index 
)
static

Definition at line 147 of file filedlg31.c.

148{
149 int n, i;
150 i = 0;
151 if (cfptr)
152 for ( ;(n = lstrlenW(cfptr)) != 0; i++)
153 {
154 cfptr += n + 1;
155 if (i == index)
156 return cfptr;
157 cfptr += lstrlenW(cfptr) + 1;
158 }
159 if (fptr)
160 for ( ;(n = lstrlenW(fptr)) != 0; i++)
161 {
162 fptr += n + 1;
163 if (i == index)
164 return fptr;
165 fptr += lstrlenW(fptr) + 1;
166 }
167 return L"*.*"; /* FIXME */
168}
GLdouble n
Definition: glext.h:7729
GLuint index
Definition: glext.h:6031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by FD31_ScanDir(), and FD31_WMInitDialog().

◆ FD31_GetFldrHeight()

static int FD31_GetFldrHeight ( void  )
static

Definition at line 1075 of file filedlg31.c.

1076{
1077 return fldrHeight;
1078}
static const int fldrHeight
Definition: filedlg31.c:46

Referenced by FD31_WMMeasureItem().

◆ FD31_GetTemplate()

static BOOL FD31_GetTemplate ( PFD31_DATA  lfs)
static

Definition at line 856 of file filedlg31.c.

857{
858 LPOPENFILENAMEW ofnW = lfs->ofnW;
859 LPOPENFILENAMEA ofnA = lfs->ofnA;
860 HANDLE hDlgTmpl;
861
863 {
864 if (!(lfs->template = LockResource( ofnW->hInstance )))
865 {
867 return FALSE;
868 }
869 }
870 else if (ofnW->Flags & OFN_ENABLETEMPLATE)
871 {
872 HRSRC hResInfo;
873 if (ofnA)
874 hResInfo = FindResourceA( ofnA->hInstance, ofnA->lpTemplateName, (LPSTR)RT_DIALOG );
875 else
876 hResInfo = FindResourceW( ofnW->hInstance, ofnW->lpTemplateName, (LPWSTR)RT_DIALOG );
877 if (!hResInfo)
878 {
880 return FALSE;
881 }
882 if (!(hDlgTmpl = LoadResource( ofnW->hInstance, hResInfo )) ||
883 !(lfs->template = LockResource( hDlgTmpl )))
884 {
886 return FALSE;
887 }
888 }
889 else /* get it from internal Wine resource */
890 {
891 HRSRC hResInfo;
892 if (!(hResInfo = FindResourceA( COMDLG32_hInstance, lfs->open ? "OPEN_FILE" : "SAVE_FILE", (LPSTR)RT_DIALOG )))
893 {
895 return FALSE;
896 }
897 if (!(hDlgTmpl = LoadResource( COMDLG32_hInstance, hResInfo )) ||
898 !(lfs->template = LockResource( hDlgTmpl )))
899 {
901 return FALSE;
902 }
903 }
904 return TRUE;
905}
#define CDERR_LOADRESFAILURE
Definition: cderr.h:12
#define CDERR_FINDRESFAILURE
Definition: cderr.h:11
void COMDLG32_SetCommDlgExtendedError(DWORD err)
Definition: cdlg32.c:124
HINSTANCE COMDLG32_hInstance
Definition: cdlg32.c:42
#define OFN_ENABLETEMPLATEHANDLE
Definition: commdlg.h:103
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define RT_DIALOG
Definition: pedump.c:367
LPCVOID template
Definition: filedlg31.c:65
LPCSTR lpTemplateName
Definition: commdlg.h:348
HINSTANCE hInstance
Definition: commdlg.h:331
HINSTANCE hInstance
Definition: commdlg.h:362
char * LPSTR
Definition: typedefs.h:51

Referenced by FD31_AllocPrivate().

◆ FD31_Init()

static BOOL FD31_Init ( void  )
static

Definition at line 75 of file filedlg31.c.

76{
77 static BOOL initialized = FALSE;
78
79 if (!initialized) {
85 hNet = LoadImageA( COMDLG32_hInstance, "NETWORK", IMAGE_ICON, 16, 16, LR_SHARED );
86 if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
87 hHDisk == 0 || hCDRom == 0 || hNet == 0)
88 {
89 ERR("Error loading icons!\n");
90 return FALSE;
91 }
93 }
94 return TRUE;
95}
#define ERR(fmt,...)
Definition: precomp.h:57
static HICON hNet
Definition: filedlg31.c:54
static HICON hFolder
Definition: filedlg31.c:49
static HICON hFloppy
Definition: filedlg31.c:51
static HICON hCDRom
Definition: filedlg31.c:53
static HICON hHDisk
Definition: filedlg31.c:52
static HICON hFolder2
Definition: filedlg31.c:50
#define IMAGE_ICON
Definition: winuser.h:212
#define LR_SHARED
Definition: winuser.h:1111
HANDLE WINAPI LoadImageA(_In_opt_ HINSTANCE hInst, _In_ LPCSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2547
static BOOL initialized
Definition: syslog.c:39

Referenced by GetFileName31A(), and GetFileName31W().

◆ FD31_MapOfnStructA()

static void FD31_MapOfnStructA ( const OPENFILENAMEA *  ofnA,
LPOPENFILENAMEW  ofnW,
BOOL  open 
)
static

Definition at line 754 of file filedlg31.c.

755{
756 UNICODE_STRING usBuffer;
757
758 ofnW->hwndOwner = ofnA->hwndOwner;
759 ofnW->hInstance = ofnA->hInstance;
760 if (ofnA->lpstrFilter)
762
763 if ((ofnA->lpstrCustomFilter) && (*(ofnA->lpstrCustomFilter)))
765 ofnW->nMaxCustFilter = ofnA->nMaxCustFilter;
766 ofnW->nFilterIndex = ofnA->nFilterIndex;
767 ofnW->nMaxFile = ofnA->nMaxFile;
768 ofnW->lpstrFile = FD31_DupToW(ofnA->lpstrFile, ofnW->nMaxFile);
769 ofnW->nMaxFileTitle = ofnA->nMaxFileTitle;
771 if (ofnA->lpstrInitialDir)
772 {
774 ofnW->lpstrInitialDir = usBuffer.Buffer;
775 }
776 if (ofnA->lpstrTitle) {
778 ofnW->lpstrTitle = usBuffer.Buffer;
779 } else {
780 WCHAR buf[16];
781 LPWSTR title_tmp;
782 int len;
784 len = lstrlenW(buf)+1;
785 title_tmp = heap_alloc(len * sizeof(WCHAR));
786 memcpy(title_tmp, buf, len * sizeof(WCHAR));
787 ofnW->lpstrTitle = title_tmp;
788 }
789 ofnW->Flags = ofnA->Flags;
790 ofnW->nFileOffset = ofnA->nFileOffset;
791 ofnW->nFileExtension = ofnA->nFileExtension;
792 ofnW->lpstrDefExt = FD31_DupToW(ofnA->lpstrDefExt, 3);
793 if ((ofnA->Flags & OFN_ENABLETEMPLATE) && (ofnA->lpTemplateName))
794 {
795 if (!IS_INTRESOURCE(ofnA->lpTemplateName))
796 {
798 ofnW->lpTemplateName = usBuffer.Buffer;
799 }
800 else /* numbered resource */
801 ofnW->lpTemplateName = (LPCWSTR) ofnA->lpTemplateName;
802 }
804 {
805 ofnW->pvReserved = ofnA->pvReserved;
806 ofnW->dwReserved = ofnA->dwReserved;
807 ofnW->FlagsEx = ofnA->FlagsEx;
808 }
809}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define IDS_SAVE_AS
Definition: cdlg.h:159
#define IDS_OPEN_FILE
Definition: cdlg.h:160
#define OPENFILENAME_SIZE_VERSION_400W
Definition: commdlg.h:397
#define open
Definition: io.h:44
static LPWSTR FD31_MapStringPairsToW(LPCSTR strA, UINT size)
Definition: filedlg31.c:715
static LPWSTR FD31_DupToW(LPCSTR str, DWORD size)
Definition: filedlg31.c:739
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
#define LoadStringW
Definition: utils.h:64
LPCSTR lpstrDefExt
Definition: commdlg.h:345
DWORD nMaxCustFilter
Definition: commdlg.h:334
LPSTR lpstrFileTitle
Definition: commdlg.h:338
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
HWND hwndOwner
Definition: commdlg.h:330
LPCSTR lpstrTitle
Definition: commdlg.h:341
WORD nFileExtension
Definition: commdlg.h:344
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD nMaxFileTitle
Definition: commdlg.h:339
WORD nFileOffset
Definition: commdlg.h:343
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337
HWND hwndOwner
Definition: commdlg.h:361
DWORD nMaxFileTitle
Definition: commdlg.h:370
WORD nFileExtension
Definition: commdlg.h:375
DWORD nMaxCustFilter
Definition: commdlg.h:365
WORD nFileOffset
Definition: commdlg.h:374
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
DWORD nMaxFile
Definition: commdlg.h:368
const uint16_t * LPCWSTR
Definition: typedefs.h:57

Referenced by FD31_AllocPrivate().

◆ FD31_MapStringPairsToW()

static LPWSTR FD31_MapStringPairsToW ( LPCSTR  strA,
UINT  size 
)
static

Definition at line 715 of file filedlg31.c.

716{
717 LPCSTR s;
718 LPWSTR x;
719 unsigned int n, len;
720
721 s = strA;
722 while (*s)
723 s = s+strlen(s)+1;
724 s++;
725 n = s + 1 - strA; /* Don't forget the other \0 */
726 if (n < size) n = size;
727
728 len = MultiByteToWideChar( CP_ACP, 0, strA, n, NULL, 0 );
729 x = heap_alloc(len * sizeof(WCHAR));
731 return x;
732}
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble s
Definition: gl.h:2039
char strA[12]
Definition: clipboard.c:2215
const char * LPCSTR
Definition: typedefs.h:52

Referenced by FD31_MapOfnStructA().

◆ FD31_ScanDir()

static BOOL FD31_ScanDir ( const OPENFILENAMEW *  ofn,
HWND  hWnd,
LPCWSTR  newPath 
)
static

Definition at line 173 of file filedlg31.c.

174{
176 HWND hdlg;
177 LRESULT lRet = TRUE;
178 HCURSOR hCursorWait, oldCursor;
179
180 TRACE("Trying to change to %s\n", debugstr_w(newPath));
181 if ( newPath[0] && !SetCurrentDirectoryW( newPath ))
182 return FALSE;
183
184 /* get the list of spec files */
187
188 hCursorWait = LoadCursorA(0, (LPSTR)IDC_WAIT);
189 oldCursor = SetCursor(hCursorWait);
190
191 /* list of files */
192 if ((hdlg = GetDlgItem(hWnd, lst1)) != 0) {
193 WCHAR* scptr; /* ptr on semi-colon */
195
196 TRACE("Using filter %s\n", debugstr_w(filter));
197 SendMessageW(hdlg, LB_RESETCONTENT, 0, 0);
198 while (filter) {
199 scptr = wcschr(filter, ';');
200 if (scptr) *scptr = 0;
201 while (*filter == ' ') filter++;
202 TRACE("Using file spec %s\n", debugstr_w(filter));
203 SendMessageW(hdlg, LB_DIR, 0, (LPARAM)filter);
204 if (scptr) *scptr = ';';
205 filter = (scptr) ? (scptr + 1) : 0;
206 }
207 }
208
209 /* list of directories */
210 lstrcpyW(buffer, L"*.*");
211
212 if (GetDlgItem(hWnd, lst2) != 0) {
214 }
215 SetCursor(oldCursor);
216 return lRet;
217}
#define stc1
Definition: dlgs.h:165
#define wcschr
Definition: compat.h:17
#define lstrcpynW
Definition: compat.h:738
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2267
static LPCWSTR FD31_GetFileType(LPCWSTR cfptr, LPCWSTR fptr, const WORD index)
Definition: filedlg31.c:147
GLuint buffer
Definition: glext.h:5915
LONG_PTR LRESULT
Definition: minwindef.h:176
#define LB_DIR
Definition: winuser.h:2062
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DDL_EXCLUSIVE
Definition: winuser.h:426
#define LB_RESETCONTENT
Definition: winuser.h:2091
#define DDL_DIRECTORY
Definition: winuser.h:422
#define IDC_WAIT
Definition: winuser.h:697
int WINAPI DlgDirListW(_In_ HWND, _Inout_ LPWSTR, _In_ int, _In_ int, _In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2459
OPENFILENAME ofn
Definition: sndrec32.cpp:56
Definition: filter.c:165
HICON HCURSOR
Definition: windef.h:99

Referenced by FD31_DirListDblClick(), FD31_TestPath(), and FD31_WMInitDialog().

◆ FD31_StripEditControl()

static void FD31_StripEditControl ( HWND  hwnd)
static

Definition at line 101 of file filedlg31.c.

102{
103 WCHAR temp[BUFFILE], *cp;
104
106 cp = wcsrchr(temp, '\\');
107 if (cp != NULL) {
108 lstrcpyW(temp, cp+1);
109 }
110 cp = wcsrchr(temp, ':');
111 if (cp != NULL) {
112 lstrcpyW(temp, cp+1);
113 }
114 /* FIXME: shouldn't we do something with the result here? ;-) */
115}
#define wcsrchr
Definition: compat.h:16
POINT cp
Definition: magnifier.c:59
static calc_node_t temp
Definition: rpn_ieee.c:38
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2283

Referenced by FD31_DiskChange(), and FD31_WMCommand().

◆ FD31_TestPath()

static LRESULT FD31_TestPath ( const FD31_DATA *  lfs,
LPWSTR  path 
)
static

Definition at line 479 of file filedlg31.c.

480{
481 HWND hWnd = lfs->hwnd;
482 LPWSTR pBeginFileName, pstr2;
483 WCHAR tmpstr2[BUFFILE];
484
485 pBeginFileName = wcsrchr(path, '\\');
486 if (pBeginFileName == NULL)
487 pBeginFileName = wcsrchr(path, ':');
488
489 if (wcschr(path,'*') != NULL || wcschr(path,'?') != NULL)
490 {
491 /* edit control contains wildcards */
492 if (pBeginFileName != NULL)
493 {
494 lstrcpynW(tmpstr2, pBeginFileName + 1, BUFFILE);
495 *(pBeginFileName + 1) = 0;
496 }
497 else
498 {
499 lstrcpyW(tmpstr2, path);
500 if(!(lfs->ofnW->Flags & OFN_NOVALIDATE))
501 *path = 0;
502 }
503
504 TRACE("path=%s, tmpstr2=%s\n", debugstr_w(path), debugstr_w(tmpstr2));
505 SetDlgItemTextW( hWnd, edt1, tmpstr2 );
506 FD31_ScanDir(lfs->ofnW, hWnd, path);
507 return (lfs->ofnW->Flags & OFN_NOVALIDATE) != 0;
508 }
509
510 /* no wildcards, we might have a directory or a filename */
511 /* try appending a wildcard and reading the directory */
512
513 pstr2 = path + lstrlenW(path);
514 if (pBeginFileName == NULL || *(pBeginFileName + 1) != 0)
515 lstrcatW(path, L"\\");
516
517 /* if ScanDir succeeds, we have changed the directory */
518 if (FD31_ScanDir(lfs->ofnW, hWnd, path))
519 return FALSE; /* and path is not a valid file name */
520
521 /* if not, this must be a filename */
522
523 *pstr2 = 0; /* remove the wildcard added before */
524
525 if (pBeginFileName != NULL)
526 {
527 /* strip off the pathname */
528 *pBeginFileName = 0;
529 SetDlgItemTextW( hWnd, edt1, pBeginFileName + 1 );
530
531 lstrcpynW(tmpstr2, pBeginFileName + 1, ARRAY_SIZE(tmpstr2));
532 /* Should we MessageBox() if this fails? */
533 if (!FD31_ScanDir(lfs->ofnW, hWnd, path))
534 {
535 return FALSE;
536 }
537 lstrcpyW(path, tmpstr2);
538 }
539 else
541 return TRUE;
542}
#define OFN_NOVALIDATE
Definition: commdlg.h:115

Referenced by FD31_Validate().

◆ FD31_UpdateFileTitle()

static void FD31_UpdateFileTitle ( const FD31_DATA *  lfs)
static

Definition at line 385 of file filedlg31.c.

386{
387 LONG lRet;
388 LPOPENFILENAMEW ofnW = lfs->ofnW;
389 LPOPENFILENAMEA ofnA = lfs->ofnA;
390
391 if (ofnW->lpstrFileTitle != NULL)
392 {
393 lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0);
395 (LPARAM)ofnW->lpstrFileTitle );
396 if (ofnA)
397 {
398 if (!WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFileTitle, -1,
399 ofnA->lpstrFileTitle, ofnA->nMaxFileTitle, NULL, NULL ))
400 ofnA->lpstrFileTitle[ofnA->nMaxFileTitle-1] = 0;
401 }
402 }
403}
#define WideCharToMultiByte
Definition: compat.h:111

Referenced by FD31_Validate().

◆ FD31_UpdateResult()

static void FD31_UpdateResult ( const FD31_DATA *  lfs,
const WCHAR *  tmpstr 
)
static

Definition at line 328 of file filedlg31.c.

329{
330 int lenstr2;
331 LPOPENFILENAMEW ofnW = lfs->ofnW;
332 LPOPENFILENAMEA ofnA = lfs->ofnA;
333 WCHAR tmpstr2[BUFFILE];
334 WCHAR *p;
335
336 TRACE("%s\n", debugstr_w(tmpstr));
337 if(ofnW->Flags & OFN_NOVALIDATE)
338 tmpstr2[0] = '\0';
339 else
341 lenstr2 = lstrlenW(tmpstr2);
342 if (lenstr2 > 3)
343 tmpstr2[lenstr2++]='\\';
344 lstrcpynW(tmpstr2+lenstr2, tmpstr, BUFFILE-lenstr2);
345 if (!ofnW->lpstrFile)
346 return;
347
348 lstrcpynW(ofnW->lpstrFile, tmpstr2, ofnW->nMaxFile);
349
350 /* set filename offset */
352 ofnW->nFileOffset = (p - ofnW->lpstrFile);
353
354 /* set extension offset */
356 ofnW->nFileExtension = (*p) ? (p - ofnW->lpstrFile) + 1 : 0;
357
358 TRACE("file %s, file offset %d, ext offset %d\n",
359 debugstr_w(ofnW->lpstrFile), ofnW->nFileOffset, ofnW->nFileExtension);
360
361 /* update the real client structures if any */
362 if (ofnA)
363 {
364 LPSTR lpszTemp;
365 if (ofnW->nMaxFile &&
366 !WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFile, -1,
367 ofnA->lpstrFile, ofnA->nMaxFile, NULL, NULL ))
368 ofnA->lpstrFile[ofnA->nMaxFile-1] = 0;
369
370 /* offsets are not guaranteed to be the same in WCHAR to MULTIBYTE conversion */
371 /* set filename offset */
372 lpszTemp = PathFindFileNameA(ofnA->lpstrFile);
373 ofnA->nFileOffset = (lpszTemp - ofnA->lpstrFile);
374
375 /* set extension offset */
376 lpszTemp = PathFindExtensionA(ofnA->lpstrFile);
377 ofnA->nFileExtension = (*lpszTemp) ? (lpszTemp - ofnA->lpstrFile) + 1 : 0;
378 }
379}
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
LPSTR WINAPI PathFindExtensionA(const char *path)
Definition: path.c:1229
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1677
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
Definition: path.c:1250
char *WINAPI PathFindFileNameA(const char *path)
Definition: path.c:1660
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by FD31_Validate().

◆ FD31_Validate()

static LRESULT FD31_Validate ( const FD31_DATA *  lfs,
LPCWSTR  path,
UINT  control,
INT  itemIndex,
BOOL  internalUse 
)
static

Definition at line 548 of file filedlg31.c.

550{
551 LONG lRet;
552 HWND hWnd = lfs->hwnd;
553 OPENFILENAMEW ofnsav;
554 LPOPENFILENAMEW ofnW = lfs->ofnW;
556 int copied_size = min( ofnW->lStructSize, sizeof(ofnsav) );
557
558 memcpy( &ofnsav, ofnW, copied_size ); /* for later restoring */
559
560 /* get current file name */
561 if (path)
563 else
565
566 TRACE("got filename = %s\n", debugstr_w(filename));
567 /* if we did not click in file list to get there */
568 if (control != lst1)
569 {
570 if (!FD31_TestPath( lfs, filename) )
571 return FALSE;
572 }
574
575 if (internalUse)
576 { /* called internally after a change in a combo */
577 if (lfs->hook)
578 {
580 MAKELONG(itemIndex,CD_LBSELCHANGE));
581 }
582 return TRUE;
583 }
584
586 if (lfs->hook)
587 {
588 lRet = FD31_CallWindowProc(lfs, lfs->fileokstring,
589 0, lfs->lParam );
590 if (lRet)
591 {
592 memcpy( ofnW, &ofnsav, copied_size ); /* restore old state */
593 return FALSE;
594 }
595 }
596 if ((ofnW->Flags & OFN_ALLOWMULTISELECT) && (ofnW->Flags & OFN_EXPLORER))
597 {
598 if (ofnW->lpstrFile)
599 {
600 LPWSTR str = ofnW->lpstrFile;
601 LPWSTR ptr = wcsrchr(str, '\\');
602 str[lstrlenW(str) + 1] = '\0';
603 *ptr = 0;
604 }
605 }
606 return TRUE;
607}
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_ALLOWMULTISELECT
Definition: commdlg.h:96
static void FD31_UpdateResult(const FD31_DATA *lfs, const WCHAR *tmpstr)
Definition: filedlg31.c:328
static void FD31_UpdateFileTitle(const FD31_DATA *lfs)
Definition: filedlg31.c:385
static LRESULT FD31_TestPath(const FD31_DATA *lfs, LPWSTR path)
Definition: filedlg31.c:479
const char * filename
Definition: ioapi.h:137
static PVOID ptr
Definition: dispmode.c:27
#define min(a, b)
Definition: monoChain.cc:55
Definition: dialog.c:52

Referenced by FD31_DiskChange(), FD31_FileTypeChange(), and FD31_WMCommand().

◆ FD31_WMCommand()

static LRESULT FD31_WMCommand ( HWND  hWnd,
LPARAM  lParam,
UINT  notification,
UINT  control,
const FD31_DATA *  lfs 
)
static

Definition at line 657 of file filedlg31.c.

659{
660 switch (control)
661 {
662 case lst1: /* file list */
665 {
666 return SendMessageW(hWnd, WM_COMMAND, IDOK, 0);
667 }
668 else if (notification == LBN_SELCHANGE)
669 return FD31_FileListSelect( lfs );
670 break;
671
672 case lst2: /* directory list */
675 return FD31_DirListDblClick( lfs );
676 break;
677
678 case cmb1: /* file type drop list */
680 return FD31_FileTypeChange( lfs );
681 break;
682
683 case chx1:
684 break;
685
686 case pshHelp:
687 break;
688
689 case cmb2: /* disk dropdown combo */
691 return FD31_DiskChange( lfs );
692 break;
693
694 case IDOK:
695 TRACE("OK pressed\n");
696 if (FD31_Validate( lfs, NULL, control, 0, FALSE ))
698 return TRUE;
699
700 case IDCANCEL:
702 return TRUE;
703
704 case IDABORT: /* can be sent by the hook procedure */
706 return TRUE;
707 }
708 return FALSE;
709}
#define pshHelp
Definition: dlgs.h:132
#define chx1
Definition: dlgs.h:36
static LRESULT FD31_FileListSelect(const FD31_DATA *lfs)
Definition: filedlg31.c:446
static LRESULT FD31_FileTypeChange(const FD31_DATA *lfs)
Definition: filedlg31.c:637
static LRESULT FD31_DirListDblClick(const FD31_DATA *lfs)
Definition: filedlg31.c:408
static LRESULT FD31_DiskChange(const FD31_DATA *lfs)
Definition: filedlg31.c:613
#define IDCANCEL
Definition: winuser.h:842
#define LBN_DBLCLK
Definition: winuser.h:2107
#define IDOK
Definition: winuser.h:841
#define CBN_SELCHANGE
Definition: winuser.h:2008
#define IDABORT
Definition: winuser.h:843
#define LBN_SELCHANGE
Definition: winuser.h:2111
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by FD31_FileOpenDlgProc().

◆ FD31_WMDrawItem()

static LONG FD31_WMDrawItem ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam,
int  savedlg,
const DRAWITEMSTRUCT *  lpdis 
)
static

Definition at line 222 of file filedlg31.c.

224{
225 WCHAR *str;
226 HICON hIcon;
227 COLORREF oldText = 0, oldBk = 0;
228
229 if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst1)
230 {
231 if (!(str = heap_alloc(BUFFILEALLOC))) return FALSE;
232 SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
233 (LPARAM)str);
234
235 if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
236 {
237 oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
238 oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
239 }
240 if (savedlg)
242
243 ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + 1,
244 lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
245 &(lpdis->rcItem), str, lstrlenW(str), NULL);
246
247 if (lpdis->itemState & ODS_SELECTED)
248 DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );
249
250 if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
251 {
252 SetBkColor( lpdis->hDC, oldBk );
253 SetTextColor( lpdis->hDC, oldText );
254 }
255 heap_free(str);
256 return TRUE;
257 }
258
259 if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst2)
260 {
261 if (!(str = heap_alloc(BUFFILEALLOC)))
262 return FALSE;
263 SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
264 (LPARAM)str);
265
266 if (lpdis->itemState & ODS_SELECTED)
267 {
268 oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
269 oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
270 }
271 ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
272 lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
273 &(lpdis->rcItem), str, lstrlenW(str), NULL);
274
275 if (lpdis->itemState & ODS_SELECTED)
276 DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );
277
278 if (lpdis->itemState & ODS_SELECTED)
279 {
280 SetBkColor( lpdis->hDC, oldBk );
281 SetTextColor( lpdis->hDC, oldText );
282 }
283 DrawIconEx( lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hFolder, 16, 16, 0, 0, DI_NORMAL );
284 heap_free(str);
285 return TRUE;
286 }
287 if (lpdis->CtlType == ODT_COMBOBOX && lpdis->CtlID == cmb2)
288 {
289 char root[] = "a:";
290 if (!(str = heap_alloc(BUFFILEALLOC)))
291 return FALSE;
293 (LPARAM)str);
294 root[0] += str[2] - 'a';
295 switch(GetDriveTypeA(root))
296 {
297 case DRIVE_REMOVABLE: hIcon = hFloppy; break;
298 case DRIVE_CDROM: hIcon = hCDRom; break;
299 case DRIVE_REMOTE: hIcon = hNet; break;
300 case DRIVE_FIXED:
301 default: hIcon = hHDisk; break;
302 }
303 if (lpdis->itemState & ODS_SELECTED)
304 {
305 oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
306 oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
307 }
308 ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
309 lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
310 &(lpdis->rcItem), str, lstrlenW(str), NULL);
311
312 if (lpdis->itemState & ODS_SELECTED)
313 {
314 SetBkColor( lpdis->hDC, oldBk );
315 SetTextColor( lpdis->hDC, oldText );
316 }
317 DrawIconEx( lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hIcon, 16, 16, 0, 0, DI_NORMAL );
318 heap_free(str);
319 return TRUE;
320 }
321 return FALSE;
322}
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
static const int fldrWidth
Definition: filedlg31.c:47
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
#define ODT_COMBOBOX
Definition: winuser.h:2575
DWORD WINAPI GetSysColor(_In_ int)
#define ODS_SELECTED
Definition: winuser.h:2581
#define COLOR_GRAYTEXT
Definition: winuser.h:943
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:2397
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:938
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define ODT_LISTBOX
Definition: winuser.h:2574
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
#define DRIVE_REMOTE
Definition: winbase.h:278
#define DRIVE_CDROM
Definition: winbase.h:279
#define DRIVE_FIXED
Definition: winbase.h:277
#define DRIVE_REMOVABLE
Definition: winbase.h:276
DWORD COLORREF
Definition: windef.h:100
#define DI_NORMAL
Definition: wingdi.h:72
#define ETO_CLIPPED
Definition: wingdi.h:648
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647

Referenced by FD31_FileOpenDlgProc().

◆ FD31_WMInitDialog()

static LONG FD31_WMInitDialog ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 958 of file filedlg31.c.

959{
960 int i, n;
961 WCHAR tmpstr[BUFFILE];
962 LPWSTR pstr, old_pstr;
965
966 if (!lfs) return FALSE;
968 lfs->hwnd = hWnd;
969 ofn = lfs->ofnW;
970
971 TRACE("flags=%lx initialdir=%s\n", ofn->Flags, debugstr_w(ofn->lpstrInitialDir));
972
974 /* read custom filter information */
976 {
977 pstr = ofn->lpstrCustomFilter;
978 n = 0;
979 TRACE("lpstrCustomFilter = %p\n", pstr);
980 while(*pstr)
981 {
982 old_pstr = pstr;
985 n += lstrlenW(pstr) + 1;
986 pstr += lstrlenW(pstr) + 1;
987 TRACE("add str=%s associated to %s\n",
988 debugstr_w(old_pstr), debugstr_w(pstr));
990 n += lstrlenW(pstr) + 1;
991 pstr += lstrlenW(pstr) + 1;
992 }
993 }
994 /* read filter information */
995 if (ofn->lpstrFilter) {
996 pstr = (LPWSTR) ofn->lpstrFilter;
997 n = 0;
998 while(*pstr) {
999 old_pstr = pstr;
1001 (LPARAM)(ofn->lpstrFilter + n) );
1002 n += lstrlenW(pstr) + 1;
1003 pstr += lstrlenW(pstr) + 1;
1004 TRACE("add str=%s associated to %s\n",
1005 debugstr_w(old_pstr), debugstr_w(pstr));
1007 n += lstrlenW(pstr) + 1;
1008 pstr += lstrlenW(pstr) + 1;
1009 }
1010 }
1011 /* set default filter */
1012 if (ofn->nFilterIndex == 0 && ofn->lpstrCustomFilter == NULL)
1013 ofn->nFilterIndex = 1;
1015 if (ofn->lpstrFile && ofn->lpstrFile[0])
1016 {
1017 TRACE( "SetText of edt1 to %s\n", debugstr_w(ofn->lpstrFile) );
1019 }
1020 else
1021 {
1024 TRACE("nFilterIndex = %ld, SetText of edt1 to %s\n",
1025 ofn->nFilterIndex, debugstr_w(tmpstr));
1026 SetDlgItemTextW( hWnd, edt1, tmpstr );
1027 }
1028 /* get drive list */
1029 *tmpstr = 0;
1031 /* read initial directory */
1032 /* FIXME: Note that this is now very version-specific (See MSDN description of
1033 * the OPENFILENAME structure). For example under 2000/XP any path in the
1034 * lpstrFile overrides the lpstrInitialDir, but not under 95/98/ME
1035 */
1036 if (ofn->lpstrInitialDir != NULL)
1037 {
1038 int len;
1039 lstrcpynW(tmpstr, ofn->lpstrInitialDir, 511);
1040 len = lstrlenW(tmpstr);
1041 if (len > 0 && tmpstr[len-1] != '\\' && tmpstr[len-1] != ':') {
1042 tmpstr[len]='\\';
1043 tmpstr[len+1]='\0';
1044 }
1045 }
1046 else
1047 *tmpstr = 0;
1048 if (!FD31_ScanDir(ofn, hWnd, tmpstr)) {
1049 *tmpstr = 0;
1050 if (!FD31_ScanDir(ofn, hWnd, tmpstr))
1051 WARN("Couldn't read initial directory %s!\n", debugstr_w(tmpstr));
1052 }
1053 /* select current drive in combo 2, omit missing drives */
1054 {
1055 char dir[MAX_PATH];
1056 char str[4] = "a:\\";
1057 GetCurrentDirectoryA( sizeof(dir), dir );
1058 for(i = 0, n = -1; i < 26; i++)
1059 {
1060 str[0] = 'a' + i;
1062 if (toupper(str[0]) == toupper(dir[0])) break;
1063 }
1064 }
1066 if (!(ofn->Flags & OFN_SHOWHELP))
1068 if (ofn->Flags & OFN_HIDEREADONLY)
1070 if (lfs->hook)
1071 return FD31_CallWindowProc(lfs, WM_INITDIALOG, wParam, lfs->lParam);
1072 return TRUE;
1073}
unsigned int dir
Definition: maze.c:112
#define WARN(fmt,...)
Definition: precomp.h:61
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_SHOWHELP
Definition: commdlg.h:120
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2164
int CDECL toupper(int c)
Definition: ctype.c:514
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define SW_HIDE
Definition: winuser.h:779
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
#define CB_SETCURSEL
Definition: winuser.h:1990
#define DDL_DRIVES
Definition: winuser.h:425
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define CB_ADDSTRING
Definition: winuser.h:1965
int WINAPI DlgDirListComboBoxW(_In_ HWND, _Inout_ LPWSTR, _In_ int, _In_ int, _In_ UINT)
#define DRIVE_NO_ROOT_DIR
Definition: winbase.h:282

Referenced by FD31_FileOpenDlgProc().

◆ FD31_WMMeasureItem()

static LONG FD31_WMMeasureItem ( LPARAM  lParam)
static

Definition at line 1083 of file filedlg31.c.

1084{
1085 LPMEASUREITEMSTRUCT lpmeasure;
1086
1087 lpmeasure = (LPMEASUREITEMSTRUCT)lParam;
1088 lpmeasure->itemHeight = FD31_GetFldrHeight();
1089 return TRUE;
1090}
static int FD31_GetFldrHeight(void)
Definition: filedlg31.c:1075
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT

Referenced by FD31_FileOpenDlgProc().

◆ GetFileName31A()

BOOL GetFileName31A ( OPENFILENAMEA *  lpofn,
UINT  dlgType 
)

Definition at line 1145 of file filedlg31.c.

1146{
1147 BOOL bRet = FALSE;
1148 PFD31_DATA lfs;
1149
1150 if (!lpofn || !FD31_Init()) return FALSE;
1151
1152 TRACE("ofn flags %08lx\n", lpofn->Flags);
1153 lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, FALSE);
1154 if (lfs)
1155 {
1159 }
1160
1161 TRACE("return lpstrFile='%s' !\n", lpofn->lpstrFile);
1162 return bRet;
1163}
static PFD31_DATA FD31_AllocPrivate(LPARAM lParam, UINT dlgType, BOOL IsUnicode)
Definition: filedlg31.c:915
static BOOL FD31_Init(void)
Definition: filedlg31.c:75
static INT_PTR CALLBACK FD31_FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: filedlg31.c:1097
INT_PTR WINAPI DialogBoxIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by GetOpenFileNameA(), and GetSaveFileNameA().

◆ GetFileName31W()

BOOL GetFileName31W ( OPENFILENAMEW *  lpofn,
UINT  dlgType 
)

Definition at line 1170 of file filedlg31.c.

1171{
1172 BOOL bRet = FALSE;
1173 PFD31_DATA lfs;
1174
1175 if (!lpofn || !FD31_Init()) return FALSE;
1176
1177 lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, TRUE);
1178 if (lfs)
1179 {
1183 }
1184
1185 TRACE("file %s, file offset %d, ext offset %d\n",
1186 debugstr_w(lpofn->lpstrFile), lpofn->nFileOffset, lpofn->nFileExtension);
1187 return bRet;
1188}
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by GetOpenFileNameW(), and GetSaveFileNameW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( commdlg  )

Variable Documentation

◆ fldrHeight

const int fldrHeight = 16
static

Definition at line 46 of file filedlg31.c.

Referenced by FD31_GetFldrHeight().

◆ fldrWidth

const int fldrWidth = 20
static

Definition at line 47 of file filedlg31.c.

Referenced by FD31_WMDrawItem().

◆ hCDRom

HICON hCDRom = 0
static

Definition at line 53 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hFloppy

HICON hFloppy = 0
static

Definition at line 51 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hFolder

HICON hFolder = 0
static

Definition at line 49 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hFolder2

HICON hFolder2 = 0
static

Definition at line 50 of file filedlg31.c.

Referenced by FD31_Init().

◆ hHDisk

HICON hHDisk = 0
static

Definition at line 52 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().

◆ hNet

HICON hNet = 0
static

Definition at line 54 of file filedlg31.c.

Referenced by FD31_Init(), and FD31_WMDrawItem().