re-enable DesktopWindow::OnDefaultCommand to open explorer windows on desktop double...
authorMartin Fuchs <fuchs.martin@gmail.com>
Fri, 18 Jun 2004 16:36:00 +0000 (16:36 +0000)
committerMartin Fuchs <fuchs.martin@gmail.com>
Fri, 18 Jun 2004 16:36:00 +0000 (16:36 +0000)
svn path=/trunk/; revision=9706

reactos/subsys/system/explorer/desktop/desktop.cpp
reactos/subsys/system/explorer/shell/mainframe.cpp
reactos/subsys/system/explorer/shell/mainframe.h
reactos/subsys/system/explorer/shell/shellbrowser.cpp
reactos/subsys/system/explorer/utility/xmlstorage.h

index 0a11cfd..094d8c3 100644 (file)
@@ -481,9 +481,9 @@ LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
 
 HRESULT DesktopWindow::OnDefaultCommand(LPIDA pida)
 {
-/*@@   if (SDIMainFrame::OpenShellFolders(pida, 0))
+       if (MainFrameBase::OpenShellFolders(pida, 0))
                return S_OK;
-*/
+
        return E_NOTIMPL;
 }
 
index a4c245f..88a1381 100644 (file)
@@ -86,6 +86,67 @@ HWND MainFrameBase::Create(LPCTSTR path, bool mdi, UINT cmdshow)
 }
 
 
+int MainFrameBase::OpenShellFolders(LPIDA pida, HWND hFrameWnd, bool mdi)
+{
+       int cnt = 0;
+
+       LPCITEMIDLIST parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]);
+       ShellFolder folder(parent_pidl);
+
+       for(int i=pida->cidl; i>0; --i) {
+               LPCITEMIDLIST pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i]);
+
+               SFGAOF attribs = SFGAO_FOLDER;
+               HRESULT hr = folder->GetAttributesOf(1, &pidl, &attribs);
+
+               if (SUCCEEDED(hr))
+                       if (attribs & SFGAO_FOLDER) {
+                               try {
+                                       ShellPath pidl_abs = ShellPath(pidl).create_absolute_pidl(parent_pidl);
+
+                                       if (hFrameWnd) {
+                                               if (SendMessage(hFrameWnd, PM_OPEN_WINDOW, OWM_PIDL, (LPARAM)(LPCITEMIDLIST)pidl_abs))
+                                                       ++cnt;
+                                       } else {
+                                               HWND hwnd;
+#ifndef _NO_MDI
+                                               if (mdi)
+                                                       hwnd = MDIMainFrame::Create(pidl_abs, 0);
+                                               else
+#endif
+                                                       hwnd = SDIMainFrame::Create(pidl_abs, 0);
+
+                                               if (hwnd)
+                                                       ++cnt;
+                                       }
+                               } catch(COMException& e) {
+                                       HandleException(e, g_Globals._hMainWnd);
+                               }
+                       }/*TEST
+                       else { // !(attribs & SFGAO_FOLDER))
+                               SHELLEXECUTEINFOA shexinfo;
+
+                               shexinfo.cbSize = sizeof(SHELLEXECUTEINFOA);
+                               shexinfo.fMask = SEE_MASK_INVOKEIDLIST;
+                               shexinfo.hwnd = NULL;
+                               shexinfo.lpVerb = NULL;
+                               shexinfo.lpFile = NULL;
+                               shexinfo.lpParameters = NULL;
+                               shexinfo.lpDirectory = NULL;
+                               shexinfo.nShow = SW_NORMAL;
+                               shexinfo.lpIDList = ILCombine(parent_pidl, pidl);
+
+                               if (ShellExecuteExA(&shexinfo))
+                                       ++cnt;
+
+                               ILFree((LPITEMIDLIST)shexinfo.lpIDList);
+                       }*/
+       }
+
+       return cnt;
+}
+
+
 MainFrameBase::MainFrameBase(HWND hwnd)
  :     super(hwnd),
        _himl(ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK|ILC_COLOR24, 2, 0))
@@ -815,60 +876,6 @@ ChildWindow* MDIMainFrame::CreateChild(LPCITEMIDLIST pidl, int mode)
 }
 
 
-int MDIMainFrame::OpenShellFolders(LPIDA pida, HWND hFrameWnd)
-{
-       int cnt = 0;
-
-       LPCITEMIDLIST parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]);
-       ShellFolder folder(parent_pidl);
-
-       for(int i=pida->cidl; i>0; --i) {
-               LPCITEMIDLIST pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i]);
-
-               SFGAOF attribs = SFGAO_FOLDER;
-               HRESULT hr = folder->GetAttributesOf(1, &pidl, &attribs);
-
-               if (SUCCEEDED(hr))
-                       if (attribs & SFGAO_FOLDER) {
-                               try {
-                                       ShellPath pidl_abs = ShellPath(pidl).create_absolute_pidl(parent_pidl);
-
-                                       if (hFrameWnd) {
-                                               if (SendMessage(hFrameWnd, PM_OPEN_WINDOW, OWM_PIDL, (LPARAM)(LPCITEMIDLIST)pidl_abs))
-                                                       ++cnt;
-                                       } else {
-                                               if (MDIMainFrame::Create(pidl_abs, 0))
-                                                       ++cnt;
-                                       }
-                               } catch(COMException& e) {
-                                       HandleException(e, g_Globals._hMainWnd);
-                               }
-                       }/*TEST
-                       else { // !(attribs & SFGAO_FOLDER))
-                               SHELLEXECUTEINFOA shexinfo;
-
-                               shexinfo.cbSize = sizeof(SHELLEXECUTEINFOA);
-                               shexinfo.fMask = SEE_MASK_INVOKEIDLIST;
-                               shexinfo.hwnd = NULL;
-                               shexinfo.lpVerb = NULL;
-                               shexinfo.lpFile = NULL;
-                               shexinfo.lpParameters = NULL;
-                               shexinfo.lpDirectory = NULL;
-                               shexinfo.nShow = SW_NORMAL;
-                               shexinfo.lpIDList = ILCombine(parent_pidl, pidl);
-
-                               if (ShellExecuteExA(&shexinfo))
-                                       ++cnt;
-
-                               ILFree((LPITEMIDLIST)shexinfo.lpIDList);
-                       }*/
-       }
-
-       return cnt;
-}
-
-
-
 BOOL MDIMainFrame::TranslateMsg(MSG* pmsg)
 {
        if (_hmdiclient && TranslateMDISysAccel(_hmdiclient, pmsg))
@@ -1284,6 +1291,22 @@ HWND SDIMainFrame::Create()
                                0/*hwndDesktop*/, hMenuFrame);
 }
 
+HWND SDIMainFrame::Create(LPCITEMIDLIST pidl, int mode)
+{
+       HWND hFrame = Create();
+       if (!hFrame)
+               return 0;
+
+       ShowWindow(hFrame, SW_SHOW);
+
+       SDIMainFrame* pFrame = GET_WINDOW(SDIMainFrame, hFrame);
+
+       if (pFrame)
+               pFrame->jump_to(pidl, mode);
+
+       return hFrame;
+}
+
 LRESULT SDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
 {
        switch(nmsg) {
index 4c96cc9..0b06023 100644 (file)
@@ -39,6 +39,7 @@ struct MainFrameBase : public PreTranslateWindow
        ~MainFrameBase();
 
        static HWND Create(LPCTSTR path, bool mdi=true, UINT cmdshow=SW_SHOWNORMAL);
+       static int OpenShellFolders(LPIDA pida, HWND hFrameWnd, bool mdi=true);
 
        WindowHandle _hwndrebar;
 
@@ -93,7 +94,6 @@ struct MDIMainFrame : public MainFrameBase
        static HWND Create();
        static HWND Create(LPCTSTR path, int mode=OWM_EXPLORE|OWM_DETAILS);
        static HWND Create(LPCITEMIDLIST pidl, int mode=OWM_EXPLORE|OWM_DETAILS|OWM_PIDL);
-       static int OpenShellFolders(LPIDA pida, HWND hFrameWnd);
 
        ChildWindow* CreateChild(LPCTSTR path=NULL, int mode=OWM_EXPLORE|OWM_DETAILS);
        ChildWindow* CreateChild(LPCITEMIDLIST pidl, int mode=OWM_EXPLORE|OWM_DETAILS|OWM_PIDL);
@@ -131,6 +131,7 @@ struct SDIMainFrame : public ShellBrowserChildT<MainFrameBase>
        SDIMainFrame(HWND hwnd);
 
        static HWND Create();
+       static HWND Create(LPCITEMIDLIST pidl, int mode=OWM_EXPLORE|OWM_DETAILS|OWM_PIDL);
 
 protected:
        ShellPathInfo _shellpath_info;
index c674a8c..adaf4ed 100644 (file)
@@ -421,7 +421,7 @@ HRESULT ShellBrowser::OnDefaultCommand(LPIDA pida)
                                }
                        }
                } else { // no tree control
-                       if (MDIMainFrame::OpenShellFolders(pida, _hWndFrame))
+                       if (MainFrameBase::OpenShellFolders(pida, _hWndFrame))
                                return S_OK;
 
 /* create new Frame Window
index 5fed7e8..1ec305c 100644 (file)
@@ -1395,7 +1395,7 @@ struct XMLDoc : public XMLNode
                return status != XML_STATUS_ERROR;
        }
 
-       bool read(XMLReaderBase& reader, const string& display_path)
+       bool read(XMLReaderBase& reader, const std::string& display_path)
        {
                XML_Status status = reader.read();