Ignore:
Timestamp:
Mar 24, 2000, 6:16:27 PM (26 years ago)
Author:
cbratschi
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comdlg32/filedlgbrowser.c

    r2607 r3216  
    11/*
    22 *  Implementation of IShellBrowser for the File Open common dialog
    3  *
    43 *
    54 */
     
    9089*   External Prototypes
    9190*/
    92 extern const char *FileOpenDlgInfosStr; 
     91extern const char *FileOpenDlgInfosStr;
    9392
    9493extern HRESULT          GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName);
     
    149148*/
    150149HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
    151                                             REFIID riid, 
     150                                            REFIID riid,
    152151                                            LPVOID *ppvObj)
    153152{
     
    159158
    160159    if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
    161     { *ppvObj = This; 
     160    { *ppvObj = This;
    162161    }
    163162    else if(IsEqualIID(riid, &IID_IOleWindow))  /*IOleWindow*/
     
    201200    TRACE("(%p)\n", This);
    202201
    203     if (!--(This->ref)) 
    204     { 
     202    if (!--(This->ref))
     203    {
    205204      COMDLG32_SHFree(This);
    206205      return 0;
     
    221220*
    222221*  Note : We will never be window less in the File Open dialog
    223 * 
    224 */
    225 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 
     222*
     223*/
     224HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
    226225                                           HWND * phwnd)
    227226{
     
    235234    *phwnd = This->hwndOwner;
    236235
    237     return (*phwnd) ? S_OK : E_UNEXPECTED; 
     236    return (*phwnd) ? S_OK : E_UNEXPECTED;
    238237
    239238}
     
    262261*  See Windows documentation on IShellBrowser::BrowseObject for more details
    263262*
    264 *  This function will override user specified flags and will always 
    265 *  use SBSP_DEFBROWSER and SBSP_DEFMODE. 
    266 */
    267 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 
    268                                               LPCITEMIDLIST pidl, 
     263*  This function will override user specified flags and will always
     264*  use SBSP_DEFBROWSER and SBSP_DEFMODE.
     265*/
     266HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
     267                                              LPCITEMIDLIST pidl,
    269268                                              UINT wFlags)
    270269{
     
    284283    if(wFlags & SBSP_RELATIVE)
    285284    {
    286        
     285
    287286        /* SBSP_RELATIVE  A relative pidl (relative from the current folder) */
    288287        hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
     
    298297        pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
    299298                                                        (LPITEMIDLIST)pidl);
    300        
     299
    301300    }
    302301    else if(wFlags & SBSP_PARENT)
    303302    {
    304303        /* Browse the parent folder (ignores the pidl) */
    305        
     304
    306305        pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
    307306        psfTmp = GetShellFolderFromPidl(pidlTmp);
     
    315314    }
    316315
    317    
     316
    318317    /* Retrieve the IShellFolder interface of the pidl specified folder */
    319318    if(!psfTmp)
    320319        return E_FAIL;
    321320
    322     /* If the pidl to browse to is equal to the actual pidl ... 
     321    /* If the pidl to browse to is equal to the actual pidl ...
    323322       do nothing and pretend you did it*/
    324323    if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
    325324    {
    326325        IShellFolder_Release(psfTmp);
    327         COMDLG32_SHFree(pidlTmp);
     326        COMDLG32_SHFree(pidlTmp);
    328327        return NOERROR;
    329328    }
     
    342341        /* Get the foldersettings from the old view */
    343342        if(fodInfos->Shell.FOIShellView)
    344         { 
    345           IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView, 
     343        {
     344          IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView,
    346345                                  &fodInfos->ShellInfos.folderSettings);
    347346        }
     
    364363
    365364            /* Select the new folder in the Look In combo box of the Open file dialog */
    366            
     365
    367366            FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,pidlTmp);
    368367
     
    383382
    384383            fodInfos->ShellInfos.hwndView = hwndView;
    385            
     384
    386385            return NOERROR;
    387386        }
     
    389388
    390389    FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
    391     return hRes; 
     390    return hRes;
    392391}
    393392
     
    395394*  IShellBrowserImpl_EnableModelessSB
    396395*/
    397 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,   
     396HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
    398397                                              BOOL fEnable)
    399                                              
     398
    400399{
    401400    ICOM_THIS(IShellBrowserImpl, iface);
     
    410409*  IShellBrowserImpl_GetControlWindow
    411410*/
    412 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,   
    413                                               UINT id,   
     411HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
     412                                              UINT id,
    414413                                              HWND *lphwnd)
    415                                              
     414
    416415{
    417416    ICOM_THIS(IShellBrowserImpl, iface);
     
    426425*/
    427426HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
    428                                                 DWORD grfMode,   
     427                                                DWORD grfMode,
    429428                                                LPSTREAM *ppStrm)
    430                                              
    431 {
    432     ICOM_THIS(IShellBrowserImpl, iface);
    433 
    434     TRACE("(%p)\n", This);
    435 
    436     /* Feature not implemented */
    437     return E_NOTIMPL;
    438 }       
     429
     430{
     431    ICOM_THIS(IShellBrowserImpl, iface);
     432
     433    TRACE("(%p)\n", This);
     434
     435    /* Feature not implemented */
     436    return E_NOTIMPL;
     437}
    439438/**************************************************************************
    440439*  IShellBrowserImpl_InsertMenusSB
     
    443442                                           HMENU hmenuShared,
    444443                                           LPOLEMENUGROUPWIDTHS lpMenuWidths)
    445                                              
     444
    446445{
    447446    ICOM_THIS(IShellBrowserImpl, iface);
     
    457456HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
    458457                                                IShellView *ppshv)
    459                                              
    460 {
    461     ICOM_THIS(IShellBrowserImpl, iface);
    462 
    463     TRACE("(%p)\n", This);
    464 
    465     /* Feature not implemented */
    466     return E_NOTIMPL;
    467 }   
     458
     459{
     460    ICOM_THIS(IShellBrowserImpl, iface);
     461
     462    TRACE("(%p)\n", This);
     463
     464    /* Feature not implemented */
     465    return E_NOTIMPL;
     466}
    468467/**************************************************************************
    469468*  IShellBrowserImpl_QueryActiveShellView
     
    471470HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
    472471                                                  IShellView **ppshv)
    473                                              
     472
    474473{
    475474    ICOM_THIS(IShellBrowserImpl, iface);
     
    487486    IShellView_AddRef(fodInfos->Shell.FOIShellView);
    488487    return NOERROR;
    489 }   
     488}
    490489/**************************************************************************
    491490*  IShellBrowserImpl_RemoveMenusSB
     
    493492HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
    494493                                           HMENU hmenuShared)
    495                                              
    496 {
    497     ICOM_THIS(IShellBrowserImpl, iface);
    498 
    499     TRACE("(%p)\n", This);
    500 
    501     /* Feature not implemented */
    502     return E_NOTIMPL;
    503 }   
     494
     495{
     496    ICOM_THIS(IShellBrowserImpl, iface);
     497
     498    TRACE("(%p)\n", This);
     499
     500    /* Feature not implemented */
     501    return E_NOTIMPL;
     502}
    504503/**************************************************************************
    505504*  IShellBrowserImpl_SendControlMsg
    506505*/
    507 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,   
    508                                             UINT id,   
    509                                             UINT uMsg,   
    510                                             WPARAM wParam,   
     506HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
     507                                            UINT id,
     508                                            UINT uMsg,
     509                                            WPARAM wParam,
    511510                                            LPARAM lParam,
    512511                                            LRESULT *pret)
    513                                              
     512
    514513{
    515514    ICOM_THIS(IShellBrowserImpl, iface);
    516515    LRESULT lres;
    517    
     516
    518517    TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
    519518
     
    522521      case FCW_TOOLBAR:
    523522        lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
    524         break;
     523        break;
    525524      default:
    526525        FIXME("ctrl id: %x\n", id);
     
    534533*/
    535534HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
    536                                        HMENU hmenuShared,   
     535                                       HMENU hmenuShared,
    537536                                       HOLEMENU holemenuReserved,
    538537                                       HWND hwndActiveObject)
    539                                              
    540 {
    541     ICOM_THIS(IShellBrowserImpl, iface);
    542 
    543     TRACE("(%p)\n", This);
    544 
    545     /* Feature not implemented */
    546     return E_NOTIMPL;
    547 }   
     538
     539{
     540    ICOM_THIS(IShellBrowserImpl, iface);
     541
     542    TRACE("(%p)\n", This);
     543
     544    /* Feature not implemented */
     545    return E_NOTIMPL;
     546}
    548547/**************************************************************************
    549548*  IShellBrowserImpl_SetStatusTextSB
     
    551550HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
    552551                                             LPCOLESTR lpszStatusText)
    553                                              
    554 {
    555     ICOM_THIS(IShellBrowserImpl, iface);
    556 
    557     TRACE("(%p)\n", This);
    558 
    559     /* Feature not implemented */
    560     return E_NOTIMPL;
    561 }   
     552
     553{
     554    ICOM_THIS(IShellBrowserImpl, iface);
     555
     556    TRACE("(%p)\n", This);
     557
     558    /* Feature not implemented */
     559    return E_NOTIMPL;
     560}
    562561/**************************************************************************
    563562*  IShellBrowserImpl_SetToolbarItems
    564563*/
    565564HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
    566                                              LPTBBUTTON lpButtons,   
    567                                              UINT nButtons,   
     565                                             LPTBBUTTON lpButtons,
     566                                             UINT nButtons,
    568567                                             UINT uFlags)
    569                                              
    570 {
    571     ICOM_THIS(IShellBrowserImpl, iface);
    572 
    573     TRACE("(%p)\n", This);
    574 
    575     /* Feature not implemented */
    576     return E_NOTIMPL;
    577 }   
     568
     569{
     570    ICOM_THIS(IShellBrowserImpl, iface);
     571
     572    TRACE("(%p)\n", This);
     573
     574    /* Feature not implemented */
     575    return E_NOTIMPL;
     576}
    578577/**************************************************************************
    579578*  IShellBrowserImpl_TranslateAcceleratorSB
    580579*/
    581580HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
    582                                                     LPMSG lpmsg,   
     581                                                    LPMSG lpmsg,
    583582                                                    WORD wID)
    584                                              
     583
    585584{
    586585    ICOM_THIS(IShellBrowserImpl, iface);
     
    600599*/
    601600HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface,
    602                                             REFIID riid, 
     601                                            REFIID riid,
    603602                                            LPVOID *ppvObj)
    604603{
     
    648647    TRACE("(%p)\n", This);
    649648
    650     fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 
    651    
     649    fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
     650
    652651    /* If the selected object is not a folder, send a IDOK command to parent window */
    653     if((pidl = GetSelectedPidl(ppshv)))
     652    pidl = GetSelectedPidl(ppshv);
     653    if (pidl)
    654654    {
    655655        HRESULT hRes;
     
    657657        ULONG  ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
    658658        IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
    659         if (ulAttr)
     659        if (ulAttr)
    660660            hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
    661661        /* Tell the dialog that the user selected a file */
    662662        else
    663         {
     663        {
    664664            hRes = FILEDLG95_OnOpen(This->hwndOwner);
    665         }
     665        }
    666666
    667667        /* Free memory used by pidl */
     
    690690        case CDBOSC_SETFOCUS:
    691691            break;
    692         case CDBOSC_KILLFOCUS: 
    693             {
    694                 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
    695                 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
    696                     SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
     692        case CDBOSC_KILLFOCUS:
     693            {
     694                FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
     695                if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
     696                    SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
    697697            }
    698698            break;
     
    703703    }
    704704
    705     return NOERROR;     
     705    return NOERROR;
    706706}
    707707/**************************************************************************
    708708*  IShellBrowserImpl_ICommDlgBrowser_IncludeObject
    709709*/
    710 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 
     710HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
    711711                                                               IShellView * ppshv,
    712712                                                               LPCITEMIDLIST pidl)
     
    725725    ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK;
    726726    IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
    727    
    728 
    729     if( (ulAttr & SFGAO_HIDDEN)                                         /* hidden */
    730       | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
     727
     728
     729    if( (ulAttr & SFGAO_HIDDEN)                                         /* hidden */
     730      | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
    731731        return S_FALSE;
    732732    /* always include directorys and links */
    733     if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) 
     733    if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK))
    734734        return S_OK;
    735735    /* Check if there is a mask to apply if not */
     
    741741    { if (SUCCEEDED(StrRetToBufW(&str, pidl,szPathW, MAX_PATH)))
    742742      {
    743           if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
     743          if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
    744744          return S_OK;
    745745      }
     
    751751/**************************************************************************
    752752*  IShellBrowserImpl_ICommDlgBrowser_OnSelChange
    753 */ 
     753*/
    754754HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
    755755{
     
    761761    TRACE("(%p)\n", This);
    762762
    763     if((pidl = GetSelectedPidl(ppshv)))
     763    pidl = GetSelectedPidl(ppshv);
     764    if (pidl)
    764765    {
    765766        HRESULT hRes = E_FAIL;
    766767        char lpstrFileName[MAX_PATH];
    767    
    768768        ULONG  ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
     769
    769770        IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
    770771        if (!ulAttr)
     
    772773            if(SUCCEEDED(hRes = GetName(fodInfos->Shell.FOIShellFolder,pidl,SHGDN_NORMAL,lpstrFileName)))
    773774                SetWindowTextA(fodInfos->DlgInfos.hwndFileName,lpstrFileName);
    774             if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
    775                     SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
     775            if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
     776                    SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
    776777        }
    777         else
    778             SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open");
    779 
    780         fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW;
     778        else
     779            SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open");
     780
     781        fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW;
    781782
    782783        COMDLG32_SHFree((LPVOID)pidl);
     
    785786    }
    786787    if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
    787         SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
     788        SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
    788789
    789790    fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
     
    812813        STGMEDIUM medium;
    813814        FORMATETC formatetc;
    814        
     815
    815816        /* Set the FORMATETC structure*/
    816817        SETDefFormatEtc(formatetc,
     
    822823        {
    823824            LPIDA cida = GlobalLock(medium.u.hGlobal);
    824             TRACE("cida=%p\n", cida);
     825            TRACE("cida=%p\n", cida);
    825826            pidlSelected =  COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[1]]));
    826827
     
    828829                IUnknown_Release(medium.pUnkForRelease);
    829830            else
    830             {
    831               GlobalUnlock(medium.u.hGlobal);
    832               GlobalFree(medium.u.hGlobal);
    833             }
     831            {
     832              GlobalUnlock(medium.u.hGlobal);
     833              GlobalFree(medium.u.hGlobal);
     834            }
    834835        }
    835836        IDataObject_Release(doSelected);
Note: See TracChangeset for help on using the changeset viewer.