Some <open> features in the file dialog 95.
This commit is contained in:
parent
cebd60b33c
commit
25eeb8f880
|
@ -395,12 +395,16 @@ BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType)
|
|||
GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos.lpstrInitialDir);
|
||||
}
|
||||
|
||||
/* Initialise the dialog property */
|
||||
fodInfos->DlgInfos.dwDlgProp = 0;
|
||||
|
||||
switch(iDlgType)
|
||||
{
|
||||
case OPEN_DIALOG :
|
||||
ret = GetOpenFileName95(fodInfos);
|
||||
break;
|
||||
case SAVE_DIALOG :
|
||||
fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG;
|
||||
ret = GetSaveFileName95(fodInfos);
|
||||
break;
|
||||
default :
|
||||
|
@ -512,31 +516,46 @@ BOOL WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
|
|||
if (ofn->nMaxFileTitle)
|
||||
fodInfos->ofnInfos.lpstrFileTitle = (LPSTR)MemAlloc(ofn->nMaxFileTitle);
|
||||
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)
|
||||
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.nFileOffset = ofn->nFileOffset;
|
||||
fodInfos->ofnInfos.nFileExtension = ofn->nFileExtension;
|
||||
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.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook;
|
||||
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)
|
||||
{
|
||||
case OPEN_DIALOG :
|
||||
ret = GetOpenFileName95(fodInfos);
|
||||
break;
|
||||
case SAVE_DIALOG :
|
||||
fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG;
|
||||
ret = GetSaveFileName95(fodInfos);
|
||||
break;
|
||||
default :
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Cleaning */
|
||||
ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset;
|
||||
ofn->nFileExtension = fodInfos->ofnInfos.nFileExtension;
|
||||
|
@ -600,6 +619,7 @@ HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
|
||||
case WM_DESTROY:
|
||||
RemovePropA(hwnd, FileOpenDlgInfosStr);
|
||||
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -676,6 +696,7 @@ static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
WORD wNotifyCode = HIWORD(wParam); /* notification code */
|
||||
WORD wID = LOWORD(wParam); /* item, control, or accelerator identifier */
|
||||
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
|
||||
|
||||
switch(wID)
|
||||
{
|
||||
|
@ -717,7 +738,8 @@ static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
|
||||
}
|
||||
|
||||
/* Do not use the listview selection anymore */
|
||||
fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -819,10 +841,22 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
|
|||
{
|
||||
char lpstrSpecifiedByUser[MAX_PATH] = "";
|
||||
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
|
||||
LPITEMIDLIST pidlSelection;
|
||||
|
||||
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;
|
||||
LPITEMIDLIST browsePidl;
|
||||
|
@ -1148,7 +1182,6 @@ static HRESULT FILEDLG95_SHELL_Init(HWND hwnd)
|
|||
/* Construct the IShellBrowser interface */
|
||||
fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd);
|
||||
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
|
|||
*/
|
||||
|
||||
HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv);
|
||||
LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
|
||||
//LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
|
||||
|
||||
/**************************************************************************
|
||||
* External Prototypes
|
||||
|
@ -658,6 +658,11 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *
|
|||
case CDBOSC_SETFOCUS:
|
||||
break;
|
||||
case CDBOSC_KILLFOCUS:
|
||||
{
|
||||
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
|
||||
if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
|
||||
SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
|
||||
}
|
||||
break;
|
||||
case CDBOSC_SELCHANGE:
|
||||
return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv);
|
||||
|
@ -717,9 +722,10 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
|
|||
HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
|
||||
{
|
||||
LPITEMIDLIST pidl;
|
||||
|
||||
FileOpenDlgInfos *fodInfos;
|
||||
_ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
|
||||
|
||||
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
if((pidl = GetSelectedPidl(ppshv)))
|
||||
|
@ -727,20 +733,27 @@ HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IS
|
|||
HRESULT hRes = E_FAIL;
|
||||
char lpstrFileName[MAX_PATH];
|
||||
|
||||
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
|
||||
|
||||
ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
|
||||
IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
|
||||
if (!ulAttr)
|
||||
{
|
||||
if(SUCCEEDED(hRes = GetName(fodInfos->Shell.FOIShellFolder,pidl,SHGDN_NORMAL,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);
|
||||
return hRes;
|
||||
}
|
||||
if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
|
||||
SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
|
||||
|
||||
fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,12 @@
|
|||
*/
|
||||
#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
|
||||
*/
|
||||
|
@ -55,6 +61,7 @@ typedef struct
|
|||
HWND hwndFileTypeCB;
|
||||
HWND hwndLookInCB;
|
||||
HWND hwndFileName;
|
||||
DWORD dwDlgProp;
|
||||
} DlgInfos;
|
||||
|
||||
} FileOpenDlgInfos;
|
||||
|
@ -160,4 +167,7 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
|
|||
LPCITEMIDLIST pidl);
|
||||
|
||||
|
||||
|
||||
LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
|
||||
|
||||
#endif /*SHBROWSER_H*/
|
||||
|
|
|
@ -226,7 +226,7 @@ static BOOL ShellView_CreateList (IShellViewImpl * 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;
|
||||
|
||||
switch (This->FolderSettings.ViewMode)
|
||||
|
@ -787,6 +787,9 @@ static LRESULT ShellView_OnSetFocus(IShellViewImpl * This)
|
|||
IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This);
|
||||
ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS);
|
||||
|
||||
/* Notify the ICommDlgBrowser interface */
|
||||
OnStateChange(This,CDBOSC_SETFOCUS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -798,6 +801,8 @@ static LRESULT ShellView_OnKillFocus(IShellViewImpl * This)
|
|||
TRACE("(%p) stub\n",This);
|
||||
|
||||
ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS);
|
||||
/* Notify the ICommDlgBrowser */
|
||||
OnStateChange(This,CDBOSC_KILLFOCUS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -859,6 +864,8 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
|
|||
case NM_KILLFOCUS:
|
||||
TRACE("-- NM_KILLFOCUS %p\n",This);
|
||||
ShellView_OnDeactivate(This);
|
||||
/* Notify the ICommDlgBrowser interface */
|
||||
OnStateChange(This,CDBOSC_KILLFOCUS);
|
||||
break;
|
||||
|
||||
case HDN_ENDTRACKA:
|
||||
|
|
Loading…
Reference in New Issue