Commit 25eeb8f8 authored by Francois Boisvert's avatar Francois Boisvert Committed by Alexandre Julliard

Some <open> features in the file dialog 95.

parent cebd60b3
...@@ -395,12 +395,16 @@ BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType) ...@@ -395,12 +395,16 @@ BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType)
GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos.lpstrInitialDir); GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos.lpstrInitialDir);
} }
/* Initialise the dialog property */
fodInfos->DlgInfos.dwDlgProp = 0;
switch(iDlgType) switch(iDlgType)
{ {
case OPEN_DIALOG : case OPEN_DIALOG :
ret = GetOpenFileName95(fodInfos); ret = GetOpenFileName95(fodInfos);
break; break;
case SAVE_DIALOG : case SAVE_DIALOG :
fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG;
ret = GetSaveFileName95(fodInfos); ret = GetSaveFileName95(fodInfos);
break; break;
default : default :
...@@ -512,31 +516,46 @@ BOOL WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType) ...@@ -512,31 +516,46 @@ BOOL WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
if (ofn->nMaxFileTitle) if (ofn->nMaxFileTitle)
fodInfos->ofnInfos.lpstrFileTitle = (LPSTR)MemAlloc(ofn->nMaxFileTitle); fodInfos->ofnInfos.lpstrFileTitle = (LPSTR)MemAlloc(ofn->nMaxFileTitle);
if (ofn->lpstrInitialDir) if (ofn->lpstrInitialDir)
fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrInitialDir)); {
fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrInitialDir)+1);
lstrcpyWtoA(fodInfos->ofnInfos.lpstrInitialDir,ofn->lpstrInitialDir);
}
if (ofn->lpstrTitle) if (ofn->lpstrTitle)
fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrTitle)); {
fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrTitle)+1);
lstrcpyWtoA(fodInfos->ofnInfos.lpstrTitle,ofn->lpstrTitle);
}
fodInfos->ofnInfos.Flags = ofn->Flags|OFN_WINE|OFN_UNICODE; fodInfos->ofnInfos.Flags = ofn->Flags|OFN_WINE|OFN_UNICODE;
fodInfos->ofnInfos.nFileOffset = ofn->nFileOffset; fodInfos->ofnInfos.nFileOffset = ofn->nFileOffset;
fodInfos->ofnInfos.nFileExtension = ofn->nFileExtension; fodInfos->ofnInfos.nFileExtension = ofn->nFileExtension;
if (ofn->lpstrDefExt) if (ofn->lpstrDefExt)
fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrDefExt)); {
fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrDefExt)+1);
lstrcpyWtoA(fodInfos->ofnInfos.lpstrDefExt,ofn->lpstrDefExt);
}
fodInfos->ofnInfos.lCustData = ofn->lCustData; fodInfos->ofnInfos.lCustData = ofn->lCustData;
fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook; fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook;
if (ofn->lpTemplateName) if (ofn->lpTemplateName)
fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)); {
fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)+1);
lstrcpyWtoA(fodInfos->ofnInfos.lpTemplateName,ofn->lpTemplateName);
}
/* Initialise the dialog property */
fodInfos->DlgInfos.dwDlgProp = 0;
switch(iDlgType) switch(iDlgType)
{ {
case OPEN_DIALOG : case OPEN_DIALOG :
ret = GetOpenFileName95(fodInfos); ret = GetOpenFileName95(fodInfos);
break; break;
case SAVE_DIALOG : case SAVE_DIALOG :
fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG;
ret = GetSaveFileName95(fodInfos); ret = GetSaveFileName95(fodInfos);
break; break;
default : default :
ret = 0; ret = 0;
} }
/* Cleaning */ /* Cleaning */
ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset; ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset;
ofn->nFileExtension = fodInfos->ofnInfos.nFileExtension; ofn->nFileExtension = fodInfos->ofnInfos.nFileExtension;
...@@ -600,6 +619,7 @@ HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa ...@@ -600,6 +619,7 @@ HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
case WM_DESTROY: case WM_DESTROY:
RemovePropA(hwnd, FileOpenDlgInfosStr); RemovePropA(hwnd, FileOpenDlgInfosStr);
default : default :
return FALSE; return FALSE;
} }
...@@ -676,6 +696,7 @@ static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -676,6 +696,7 @@ static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
WORD wNotifyCode = HIWORD(wParam); /* notification code */ WORD wNotifyCode = HIWORD(wParam); /* notification code */
WORD wID = LOWORD(wParam); /* item, control, or accelerator identifier */ WORD wID = LOWORD(wParam); /* item, control, or accelerator identifier */
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
switch(wID) switch(wID)
{ {
...@@ -717,7 +738,8 @@ static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -717,7 +738,8 @@ static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
break; break;
} }
/* Do not use the listview selection anymore */
fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
return 0; return 0;
} }
...@@ -819,10 +841,22 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) ...@@ -819,10 +841,22 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
{ {
char lpstrSpecifiedByUser[MAX_PATH] = ""; char lpstrSpecifiedByUser[MAX_PATH] = "";
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
LPITEMIDLIST pidlSelection;
TRACE("\n"); TRACE("\n");
if(GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrSpecifiedByUser,MAX_PATH)) /* Check if there is a selected item in the listview */
if(fodInfos->DlgInfos.dwDlgProp & FODPROP_USEVIEW)
{
pidlSelection = GetSelectedPidl(fodInfos->Shell.FOIShellView);
GetName(fodInfos->Shell.FOIShellFolder,pidlSelection,SHGDN_NORMAL,lpstrSpecifiedByUser);
COMDLG32_SHFree((LPVOID)pidlSelection);
}
else
/* Get the text from the filename edit */
GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrSpecifiedByUser,MAX_PATH);
if(strlen(lpstrSpecifiedByUser))
{ {
LPSHELLFOLDER psfDesktop; LPSHELLFOLDER psfDesktop;
LPITEMIDLIST browsePidl; LPITEMIDLIST browsePidl;
...@@ -1148,7 +1182,6 @@ static HRESULT FILEDLG95_SHELL_Init(HWND hwnd) ...@@ -1148,7 +1182,6 @@ static HRESULT FILEDLG95_SHELL_Init(HWND hwnd)
/* Construct the IShellBrowser interface */ /* Construct the IShellBrowser interface */
fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd); fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd);
return NOERROR; return NOERROR;
} }
......
...@@ -72,7 +72,7 @@ static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl = ...@@ -72,7 +72,7 @@ static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
*/ */
HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv); HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv);
LPITEMIDLIST GetSelectedPidl(IShellView *ppshv); //LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
/************************************************************************** /**************************************************************************
* External Prototypes * External Prototypes
...@@ -658,6 +658,11 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser * ...@@ -658,6 +658,11 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *
case CDBOSC_SETFOCUS: case CDBOSC_SETFOCUS:
break; break;
case CDBOSC_KILLFOCUS: case CDBOSC_KILLFOCUS:
{
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
}
break; break;
case CDBOSC_SELCHANGE: case CDBOSC_SELCHANGE:
return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv); return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv);
...@@ -717,9 +722,10 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser * ...@@ -717,9 +722,10 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv) HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
{ {
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
FileOpenDlgInfos *fodInfos;
_ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface); _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
if((pidl = GetSelectedPidl(ppshv))) if((pidl = GetSelectedPidl(ppshv)))
...@@ -727,20 +733,27 @@ HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IS ...@@ -727,20 +733,27 @@ HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IS
HRESULT hRes = E_FAIL; HRESULT hRes = E_FAIL;
char lpstrFileName[MAX_PATH]; char lpstrFileName[MAX_PATH];
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
if (!ulAttr) if (!ulAttr)
{ {
if(SUCCEEDED(hRes = GetName(fodInfos->Shell.FOIShellFolder,pidl,SHGDN_NORMAL,lpstrFileName))) if(SUCCEEDED(hRes = GetName(fodInfos->Shell.FOIShellFolder,pidl,SHGDN_NORMAL,lpstrFileName)))
SetWindowTextA(fodInfos->DlgInfos.hwndFileName,lpstrFileName); SetWindowTextA(fodInfos->DlgInfos.hwndFileName,lpstrFileName);
if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
} }
else
SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open");
fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW;
COMDLG32_SHFree((LPVOID)pidl); COMDLG32_SHFree((LPVOID)pidl);
return hRes; return hRes;
} }
if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
return E_FAIL; return E_FAIL;
} }
......
...@@ -17,6 +17,12 @@ ...@@ -17,6 +17,12 @@
*/ */
#define _ICOM_THIS_FromICommDlgBrowser(Class,name) Class* This = (Class*) (((char*)name)-sizeof(void *)) #define _ICOM_THIS_FromICommDlgBrowser(Class,name) Class* This = (Class*) (((char*)name)-sizeof(void *))
/* dialog internal property */
#define FODPROP_SAVEDLG 0x0001 /* File dialog is a Save file dialog */
#define FODPROP_USEVIEW 0x0002 /* Indicates the user selection must be taken
from the IShellView */
/*********************************************************************** /***********************************************************************
* Data structure * Data structure
*/ */
...@@ -55,6 +61,7 @@ typedef struct ...@@ -55,6 +61,7 @@ typedef struct
HWND hwndFileTypeCB; HWND hwndFileTypeCB;
HWND hwndLookInCB; HWND hwndLookInCB;
HWND hwndFileName; HWND hwndFileName;
DWORD dwDlgProp;
} DlgInfos; } DlgInfos;
} FileOpenDlgInfos; } FileOpenDlgInfos;
...@@ -160,4 +167,7 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser * ...@@ -160,4 +167,7 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
LPCITEMIDLIST pidl); LPCITEMIDLIST pidl);
LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
#endif /*SHBROWSER_H*/ #endif /*SHBROWSER_H*/
...@@ -226,7 +226,7 @@ static BOOL ShellView_CreateList (IShellViewImpl * This) ...@@ -226,7 +226,7 @@ static BOOL ShellView_CreateList (IShellViewImpl * This)
TRACE("%p\n",This); TRACE("%p\n",This);
dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER | dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE; LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE;
switch (This->FolderSettings.ViewMode) switch (This->FolderSettings.ViewMode)
...@@ -787,6 +787,9 @@ static LRESULT ShellView_OnSetFocus(IShellViewImpl * This) ...@@ -787,6 +787,9 @@ static LRESULT ShellView_OnSetFocus(IShellViewImpl * This)
IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This); IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This);
ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS); ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS);
/* Notify the ICommDlgBrowser interface */
OnStateChange(This,CDBOSC_SETFOCUS);
return 0; return 0;
} }
...@@ -798,6 +801,8 @@ static LRESULT ShellView_OnKillFocus(IShellViewImpl * This) ...@@ -798,6 +801,8 @@ static LRESULT ShellView_OnKillFocus(IShellViewImpl * This)
TRACE("(%p) stub\n",This); TRACE("(%p) stub\n",This);
ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS); ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS);
/* Notify the ICommDlgBrowser */
OnStateChange(This,CDBOSC_KILLFOCUS);
return 0; return 0;
} }
...@@ -859,6 +864,8 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn ...@@ -859,6 +864,8 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
case NM_KILLFOCUS: case NM_KILLFOCUS:
TRACE("-- NM_KILLFOCUS %p\n",This); TRACE("-- NM_KILLFOCUS %p\n",This);
ShellView_OnDeactivate(This); ShellView_OnDeactivate(This);
/* Notify the ICommDlgBrowser interface */
OnStateChange(This,CDBOSC_KILLFOCUS);
break; break;
case HDN_ENDTRACKA: case HDN_ENDTRACKA:
......
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