ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

mainframe.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2003, 2004, 2005 Martin Fuchs
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00017  */
00018 
00019 
00020  //
00021  // Explorer clone
00022  //
00023  // mainframe.cpp
00024  //
00025  // Martin Fuchs, 23.07.2003
00026  //
00027 
00028 
00029 #include <precomp.h>
00030 
00031 /* We can't include webchild.h here - otherwise MinGW produces errors like: "multiple definition of `QACONTAINERFLAGS'"
00032 #include "webchild.h"
00033 */
00034 extern HWND create_webchildwindow(const WebChildWndInfo& info);
00035 
00036 #include "../resource.h"
00037 
00038 #include "../dialogs/settings.h"    // for MdiSdiDlg
00039 
00040 //#define _NO_REBAR
00041 
00042 HWND MainFrameBase::Create(const ExplorerCmd& cmd)
00043 {
00044     HWND hFrame;
00045 
00046 #ifndef _NO_MDI
00047     if (cmd._mdi)
00048         hFrame = MDIMainFrame::Create();
00049     else
00050 #endif
00051         hFrame = SDIMainFrame::Create();
00052 
00053     if (hFrame) {
00054         HWND hwndOld = g_Globals._hMainWnd;
00055 
00056         g_Globals._hMainWnd = hFrame;
00057 
00058         if (hwndOld)
00059             DestroyWindow(hwndOld);
00060 
00061         ShowWindow(hFrame, cmd._cmdShow);
00062         UpdateWindow(hFrame);
00063 
00064          // Open the first child window after initializing the application
00065         if (cmd.IsValidPath()) {
00066              // We use the static s_path variable to store the path string in order
00067              // to avoid accessing prematurely freed memory in the PostMessage handlers.
00068             static String s_path = cmd._path;
00069 
00070             PostMessage(hFrame, PM_OPEN_WINDOW, cmd._flags, (LPARAM)(LPCTSTR)s_path);
00071         } else
00072             PostMessage(hFrame, PM_OPEN_WINDOW, OWM_EXPLORE|OWM_DETAILS, 0);
00073     }
00074 
00075     return hFrame;
00076 }
00077 
00078 
00079 int MainFrameBase::OpenShellFolders(LPIDA pida, HWND hFrameWnd)
00080 {
00081     int cnt = 0;
00082 
00083     LPCITEMIDLIST parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]);
00084     ShellFolder folder(parent_pidl);
00085     LOG(FmtString(TEXT("MainFrameBase::OpenShellFolders(): parent_pidl=%s"), (LPCTSTR)FileSysShellPath(parent_pidl)));
00086 
00087     for(int i=pida->cidl; i>0; --i) {
00088         LPCITEMIDLIST pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i]);
00089 
00090         SFGAOF attribs = SFGAO_FOLDER;
00091         HRESULT hr = folder->GetAttributesOf(1, &pidl, &attribs);
00092 
00093         if (SUCCEEDED(hr))
00094             if (attribs & SFGAO_FOLDER) {
00095                 try {
00096                     XMLPos explorer_options = g_Globals.get_cfg("general/explorer");
00097 
00098                     bool mdi = XMLBool(explorer_options, "mdi", true);
00099                     bool separateFolders = XMLBool(explorer_options, "separate-folders", false);
00100 
00101                     ShellPath pidl_abs = ShellPath(pidl).create_absolute_pidl(parent_pidl);
00102                     LOG(FmtString(TEXT("MainFrameBase::OpenShellFolders(): pidl_abs=%s"), (LPCTSTR)FileSysShellPath(pidl_abs)));
00103 
00104                     if (hFrameWnd && (mdi || !separateFolders)) {
00105                         int flags = OWM_PIDL;
00106 
00107                         if (separateFolders)
00108                             flags |= OWM_SEPARATE;
00109 
00110                         if (SendMessage(hFrameWnd, PM_OPEN_WINDOW, flags, (LPARAM)(LPCITEMIDLIST)pidl_abs))
00111                             ++cnt;
00112                     } else {
00113                         HWND hwnd;
00114 #ifndef _NO_MDI
00115                         if (mdi)
00116                             hwnd = MDIMainFrame::Create(pidl_abs, 0);
00117                         else
00118 #endif
00119                             hwnd = SDIMainFrame::Create(pidl_abs, 0);
00120 
00121                         if (hwnd)
00122                             ++cnt;
00123                     }
00124                 } catch(COMException& e) {
00125                     HandleException(e, g_Globals._hMainWnd);
00126                 }
00127             }/*TEST
00128             else { // !(attribs & SFGAO_FOLDER))
00129                 SHELLEXECUTEINFOA shexinfo;
00130 
00131                 shexinfo.cbSize = sizeof(SHELLEXECUTEINFOA);
00132                 shexinfo.fMask = SEE_MASK_INVOKEIDLIST;
00133                 shexinfo.hwnd = NULL;
00134                 shexinfo.lpVerb = NULL;
00135                 shexinfo.lpFile = NULL;
00136                 shexinfo.lpParameters = NULL;
00137                 shexinfo.lpDirectory = NULL;
00138                 shexinfo.nShow = SW_NORMAL;
00139                 shexinfo.lpIDList = ILCombine(parent_pidl, pidl);
00140 
00141                 if (ShellExecuteExA(&shexinfo))
00142                     ++cnt;
00143 
00144                 ILFree((LPITEMIDLIST)shexinfo.lpIDList);
00145             }*/
00146     }
00147 
00148     return cnt;
00149 }
00150 
00151 
00152 MainFrameBase::MainFrameBase(HWND hwnd)
00153  :  super(hwnd)
00154 {
00155     HDC hDC = GetDC(NULL);
00156 #ifndef _NO_REBAR
00157     //static TCHAR Title1[] = TEXT("Toolbar");
00158     static TCHAR Title2[] = TEXT("Address :");
00159 #endif
00160 
00161     if (hDC)
00162     {
00163         DWORD ilMask;
00164         INT bpp = GetDeviceCaps(hDC, BITSPIXEL);
00165         ReleaseDC(NULL, hDC);
00166 
00167         if (bpp <= 4)
00168             ilMask = ILC_COLOR4;
00169         else if (bpp <= 8)
00170             ilMask = ILC_COLOR8;
00171         else if (bpp <= 16)
00172             ilMask = ILC_COLOR16;
00173         else if (bpp <= 24)
00174             ilMask = ILC_COLOR24;
00175         else if (bpp <= 32)
00176             ilMask = ILC_COLOR32;
00177         else
00178             ilMask = ILC_COLOR;
00179 
00180         ilMask |= ILC_MASK;
00181 
00182         _himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ilMask, 2, 0);
00183     }
00184 
00185     _hMenuFrame = GetMenu(hwnd);
00186     _hMenuWindow = GetSubMenu(_hMenuFrame, GetMenuItemCount(_hMenuFrame)-3);
00187 
00188     _menu_info._hMenuView = GetSubMenu(_hMenuFrame, 1);
00189 
00190     _hAccel = LoadAccelerators(g_Globals._hInstance, MAKEINTRESOURCE(IDA_EXPLORER));
00191 
00192 
00193     TBBUTTON toolbarBtns[] = {
00194 #ifdef _NO_REBAR
00195         {0, 0, 0, BTNS_SEP, {0, 0}, 0, 0},
00196 #endif
00197         {7, ID_GO_BACK, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
00198         {8, ID_GO_FORWARD, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
00199         {9, ID_GO_UP, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
00200         {10, ID_GO_HOME, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
00201         {11, ID_GO_SEARCH, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
00202         {12, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
00203         {13, ID_STOP, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}
00204     };
00205 
00206     _htoolbar = CreateToolbarEx(hwnd,
00207 #ifndef _NO_REBAR
00208         CCS_NOPARENTALIGN|CCS_NORESIZE|CCS_NODIVIDER|
00209 #endif
00210         WS_CHILD|TBSTYLE_FLAT|WS_VISIBLE, IDW_TOOLBAR, 2, g_Globals._hInstance, IDB_TOOLBAR,
00211         toolbarBtns, sizeof(toolbarBtns)/sizeof(TBBUTTON),
00212         16, 16, 16, 16, sizeof(TBBUTTON));
00213 
00214     CheckMenuItem(_menu_info._hMenuView, ID_VIEW_TOOL_BAR, MF_BYCOMMAND|MF_CHECKED);
00215 
00216 
00217      // address bar 
00218     _haddrcombo = CreateWindowEx(0,
00219                                 WC_COMBOBOX,
00220                                 TEXT("Address"),
00221                                 WS_CHILD|WS_TABSTOP|WS_BORDER|WS_VISIBLE|CBS_DROPDOWN|
00222                                 CCS_NOPARENTALIGN|CCS_NORESIZE|CCS_NODIVIDER|CCS_NOMOVEY,
00223                                 0, 0, 0, 0,
00224                                 hwnd,
00225                                 (HMENU)IDW_ADDRESSBAR,
00226                                 g_Globals._hInstance,
00227                                 0);
00228 
00229     HFONT hFont = (HFONT)GetStockObject(ANSI_VAR_FONT);
00230     SendMessageW(_haddrcombo, WM_SETFONT, (WPARAM)hFont, 0);
00231 
00232 
00233     _hstatusbar = CreateStatusWindow(WS_CHILD|WS_VISIBLE, 0, hwnd, IDW_STATUSBAR);
00234     CheckMenuItem(_menu_info._hMenuView, ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
00235 
00236     _hsidebar = CreateWindowEx(WS_EX_STATICEDGE, WC_TREEVIEW, TEXT("Sidebar"),
00237                     WS_CHILD|WS_TABSTOP|WS_BORDER|/*WS_VISIBLE|*/TVS_HASLINES|TVS_HASBUTTONS|TVS_SHOWSELALWAYS|TVS_INFOTIP,
00238                     -1, -1, 200, 0, _hwnd, (HMENU)IDW_SIDEBAR, g_Globals._hInstance, 0);
00239 
00240     _himl_old = TreeView_SetImageList(_hsidebar, _himl, TVSIL_NORMAL);
00241 
00242     CheckMenuItem(_menu_info._hMenuView, ID_VIEW_SIDE_BAR, MF_BYCOMMAND|MF_UNCHECKED/*MF_CHECKED*/);
00243 
00244 
00245      // create rebar window to manage toolbar and drivebar
00246 #ifndef _NO_REBAR
00247     _hwndrebar = CreateWindowEx(WS_EX_TOOLWINDOW,
00248                                 REBARCLASSNAME,
00249                                 NULL,
00250                                 WS_CHILD|WS_VISIBLE|WS_BORDER|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|
00251                                  RBS_VARHEIGHT|RBS_DBLCLKTOGGLE| RBS_AUTOSIZE|RBS_BANDBORDERS,
00252                                 0, 0, 0, 0,
00253                                 _hwnd,
00254                                 NULL,
00255                                 g_Globals._hInstance,
00256                                 0);
00257 
00258     int btn_hgt = HIWORD(SendMessage(_htoolbar, TB_GETBUTTONSIZE, 0, 0));
00259 
00260     REBARBANDINFO rbBand;
00261 
00262     rbBand.cbSize = sizeof(REBARBANDINFO);
00263     rbBand.fMask  = RBBIM_TEXT|RBBIM_STYLE|RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_SIZE;
00264     rbBand.fStyle = RBBS_CHILDEDGE|RBBS_GRIPPERALWAYS|RBBS_HIDETITLE;
00265 
00266     rbBand.cxMinChild = 0;
00267     rbBand.cyMinChild = 0;
00268     rbBand.cyChild = 0;
00269     rbBand.cyMaxChild = 0;
00270     rbBand.cyIntegral = btn_hgt;
00271 
00272     rbBand.lpText = NULL;//Title1
00273     rbBand.hwndChild = _htoolbar;
00274     rbBand.cxMinChild = 0;
00275     rbBand.cyMinChild = btn_hgt;
00276     rbBand.cx = 284;
00277     SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)0, (LPARAM)&rbBand);
00278 
00279     rbBand.fStyle &= ~RBBS_HIDETITLE;
00280     rbBand.fStyle |= RBBS_BREAK;
00281     rbBand.lpText = Title2;
00282     rbBand.hwndChild = _haddrcombo;
00283     rbBand.cxMinChild = 0;
00284     rbBand.cyMinChild = btn_hgt;
00285     rbBand.cx = 400;
00286     SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)3, (LPARAM)&rbBand);
00287 #endif
00288 }
00289 
00290 
00291 MainFrameBase::~MainFrameBase()
00292 {
00293     (void)TreeView_SetImageList(_hsidebar, _himl_old, TVSIL_NORMAL);
00294     ImageList_Destroy(_himl);
00295 
00296      // don't exit desktop when closing file manager window
00297     if (!g_Globals._desktop_mode)
00298         if (g_Globals._hMainWnd == _hwnd)   // don't quit when switching between MDI and SDI mode
00299             PostQuitMessage(0);
00300 }
00301 
00302 
00303 LRESULT MainFrameBase::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
00304 {
00305     LRESULT res;
00306 
00307     if (ProcessMessage(nmsg, wparam, lparam, &res))
00308         return res;
00309     else
00310         return super::WndProc(nmsg, wparam, lparam);
00311 }
00312 
00313 bool MainFrameBase::ProcessMessage(UINT nmsg, WPARAM wparam, LPARAM lparam, LRESULT* pres)
00314 {
00315     switch(nmsg) {
00316       case PM_TRANSLATE_MSG:
00317         *pres = TranslateMsg((MSG*)lparam);
00318         return true;
00319 
00320       case WM_SHOWWINDOW:
00321         if (wparam) {   // trigger child resizing after window creation - now we can succesfully call IsWindowVisible()
00322             int height = SendMessage(_hwndrebar, RB_GETBARHEIGHT, 0, 0);
00323             MoveWindow(_hwndrebar, 0, 0, LOWORD(lparam), height, TRUE);
00324             resize_frame_client();
00325         }
00326         return false; // goto def;
00327 
00328       case WM_CLOSE:
00329         DestroyWindow(_hwnd);
00330         g_Globals._hMainWnd = 0;
00331         break;
00332 
00333       case WM_DESTROY:
00334         break;
00335 
00336       case WM_SIZE: {
00337 #ifdef __REACTOS__  ///@todo Work around to display rebar in ROS (with flickering) as long as the control isn't fixed
00338         int height = SendMessage(_hwndrebar, RB_GETBARHEIGHT, 0, 0);
00339         MoveWindow(_hwndrebar, 0, 0, LOWORD(lparam), height, TRUE);
00340 #else
00341         resize_frame(LOWORD(lparam), HIWORD(lparam));
00342         SendMessage(_hwndrebar, WM_SIZE, 0, 0);
00343 #endif
00344 
00345 
00346         break;} // do not pass message to DefFrameProc
00347 
00348       case WM_GETMINMAXINFO: {
00349         LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam;
00350 
00351         lpmmi->ptMaxTrackSize.x <<= 1;/*2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN */
00352         lpmmi->ptMaxTrackSize.y <<= 1;/*2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN */
00353         break;}
00354 
00355       case PM_FRM_CALC_CLIENT:
00356         frame_get_clientspace((PRECT)lparam);
00357         *pres = TRUE;
00358         return true;
00359 
00360       case PM_FRM_GET_MENUINFO:
00361         *pres = (LPARAM)&_menu_info;
00362         return true;
00363 
00364       case PM_GET_CONTROLWINDOW:
00365         if (wparam == FCW_STATUS) {
00366             *pres = (LRESULT)(HWND)_hstatusbar;
00367             return true;
00368         }
00369         break;
00370 
00371       case PM_SETSTATUSTEXT:
00372         SendMessage(_hstatusbar, SB_SETTEXT, 0, lparam);
00373         break;
00374 
00375       case WM_SYSCOLORCHANGE:
00376         SendMessage(_hwndrebar, WM_SYSCOLORCHANGE, 0, 0);
00377         SendMessage(_htoolbar, WM_SYSCOLORCHANGE, 0, 0);
00378         break;
00379 
00380       default:
00381         return false;
00382     }
00383 
00384     *pres = 0;
00385     return true;
00386 }
00387 
00388 BOOL MainFrameBase::TranslateMsg(MSG* pmsg)
00389 {
00390     if (TranslateAccelerator(_hwnd, _hAccel, pmsg))
00391         return TRUE;
00392 
00393     return FALSE;
00394 }
00395 
00396 
00397 int MainFrameBase::Command(int id, int code)
00398 {
00399     CONTEXT("MainFrameBase::Command()");
00400 
00401     switch(id) {
00402       case ID_FILE_EXIT:
00403         SendMessage(_hwnd, WM_CLOSE, 0, 0);
00404         break;
00405 
00406       case ID_VIEW_TOOL_BAR:
00407         toggle_child(_hwnd, id, _htoolbar, 0);
00408         break;
00409 
00410       case ID_VIEW_STATUSBAR:
00411         toggle_child(_hwnd, id, _hstatusbar);
00412         break;
00413 
00414       case ID_VIEW_SIDE_BAR:
00415          // lazy initialization
00416         if (!TreeView_GetCount(_hsidebar))
00417             FillBookmarks();
00418 
00419         toggle_child(_hwnd, id, _hsidebar);
00420         break;
00421 
00422       case ID_EXECUTE: {
00423         ExecuteDialog dlg = {{0}, 0};
00424 
00425         if (DialogBoxParam(g_Globals._hInstance, MAKEINTRESOURCE(IDD_EXECUTE), _hwnd, ExecuteDialog::WndProc, (LPARAM)&dlg) == IDOK) {
00426             CONTEXT("ID_EXECUTE - ShellExecute()");
00427 
00428             HINSTANCE hinst = ShellExecute(_hwnd, NULL/*operation*/, dlg.cmd/*file*/, NULL/*parameters*/, NULL/*dir*/, dlg.cmdshow);
00429 
00430             if ((int)hinst <= 32)
00431                 display_error(_hwnd, GetLastError());
00432         }
00433         break;}
00434 
00435       case ID_HELP:
00436         WinHelp(_hwnd, TEXT("explorer")/*file explorer.hlp*/, HELP_INDEX, 0);
00437         break;
00438 
00439       case ID_VIEW_FULLSCREEN:
00440         CheckMenuItem(_menu_info._hMenuView, id, toggle_fullscreen()?MF_CHECKED:0);
00441         break;
00442 
00443       case ID_TOOLS_OPTIONS:
00444         Dialog::DoModal(IDD_MDI_SDI, WINDOW_CREATOR(MdiSdiDlg), _hwnd);
00445         break;
00446 
00447       case ID_ABOUT_WINDOWS:
00448         ShellAbout(_hwnd, ResString(IDS_TITLE), NULL, 0);
00449         break;
00450 
00451       case ID_ABOUT_EXPLORER:
00452         explorer_about(_hwnd);
00453         break;
00454 
00455       case ID_EXPLORER_FAQ:
00456         launch_file(_hwnd, TEXT("http://www.sky.franken.de/explorer/"), SW_SHOW);
00457         break;
00458 
00459       default:
00460         return 1;   // no command handlers in Window::Command()
00461     }
00462 
00463     return 0;
00464 }
00465 
00466 int MainFrameBase::Notify(int id, NMHDR* pnmh)
00467 {
00468     switch(pnmh->code) {
00469          // resize children windows when the rebar size changes
00470 
00471       case RBN_AUTOSIZE:
00472         resize_frame_client();
00473         break;
00474 
00475       case TVN_GETINFOTIP: {
00476         NMTVGETINFOTIP* pnmgit = (NMTVGETINFOTIP*)pnmh;
00477 
00478         if (pnmgit->lParam) {
00479             const BookmarkNode& node = *(BookmarkNode*)pnmgit->lParam;
00480 
00481             if (node._type == BookmarkNode::BMNT_FOLDER) {
00482                  // display tooltips for bookmark folders
00483                 if (!node._pfolder->_description.empty())
00484                     lstrcpyn(pnmgit->pszText, node._pfolder->_description.c_str(), pnmgit->cchTextMax);
00485             } else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
00486                  // display tooltips for bookmark folders
00487                 String txt = node._pbookmark->_description;
00488 
00489                 if (!node._pbookmark->_url.empty()) {
00490                     if (!txt.empty())
00491                         txt += TEXT("  -  ");
00492 
00493                     txt += node._pbookmark->_url;
00494                 }
00495 
00496                 lstrcpyn(pnmgit->pszText, txt.c_str(), pnmgit->cchTextMax);
00497             }
00498         }
00499         break;}
00500 
00501       case NM_DBLCLK: {
00502         HTREEITEM hitem = TreeView_GetSelection(_hsidebar);
00503         LPARAM lparam = TreeView_GetItemData(_hsidebar, hitem);
00504 
00505         if (lparam) {
00506             const BookmarkNode& node = *(BookmarkNode*)lparam;
00507 
00508             if (node._type == BookmarkNode::BMNT_BOOKMARK) {
00509                 bool new_window = GetAsyncKeyState(VK_SHIFT)<0;
00510 
00511                 go_to(node._pbookmark->_url, new_window);
00512             }
00513         }
00514         break;}
00515     }
00516 
00517     return 0;
00518 }
00519 
00520 
00521 void MainFrameBase::resize_frame(int cx, int cy)
00522 {
00523     if (cy <= 0)
00524         return; // avoid resizing children when receiving RBN_AUTOSIZE while getting minimized
00525 
00526     RECT rect = {0, 0, cx, cy};
00527 
00528     if (_hwndrebar) {
00529         int height = SendMessage(_hwndrebar, RB_GETBARHEIGHT, 0, 0);
00530         rect.top += height;
00531         rect.top += 5;
00532 
00533         SetWindowPos(_haddrcombo, NULL, 0, 0, cx, height, SWP_NOMOVE);
00534     } else {
00535         if (IsWindowVisible(_htoolbar)) {
00536             SendMessage(_htoolbar, WM_SIZE, 0, 0);
00537             WindowRect rt(_htoolbar);
00538             rect.top = rt.bottom;
00539         //  rect.bottom -= rt.bottom;
00540         }
00541     }
00542 
00543     if (IsWindowVisible(_hstatusbar)) {
00544         int parts[] = {300, 500};
00545 
00546         SendMessage(_hstatusbar, WM_SIZE, 0, 0);
00547         SendMessage(_hstatusbar, SB_SETPARTS, 2, (LPARAM)&parts);
00548         ClientRect rt(_hstatusbar);
00549         rect.bottom -= rt.bottom;
00550     }
00551 
00552     if (IsWindowVisible(_hsidebar)) {
00553         WindowRect rt(_hsidebar);
00554         rect.left += rt.right-rt.left;
00555 
00556         SetWindowPos(_hsidebar, 0, -1, rect.top-1, rt.right-rt.left, rect.bottom-rect.top+1, SWP_NOACTIVATE|SWP_NOZORDER);
00557     }
00558 }
00559 
00560 void MainFrameBase::resize_frame_client()
00561 {
00562     ClientRect rect(_hwnd);
00563 
00564     resize_frame(rect.right, rect.bottom);
00565 }
00566 
00567 void MainFrameBase::frame_get_clientspace(PRECT prect)
00568 {
00569     if (!IsIconic(_hwnd))
00570         GetClientRect(_hwnd, prect);
00571     else {
00572         WINDOWPLACEMENT wp;
00573 
00574         GetWindowPlacement(_hwnd, &wp);
00575 
00576         prect->left = prect->top = 0;
00577         prect->right = wp.rcNormalPosition.right-wp.rcNormalPosition.left-
00578                         2*(GetSystemMetrics(SM_CXSIZEFRAME)+GetSystemMetrics(SM_CXEDGE));
00579         prect->bottom = wp.rcNormalPosition.bottom-wp.rcNormalPosition.top-
00580                         2*(GetSystemMetrics(SM_CYSIZEFRAME)+GetSystemMetrics(SM_CYEDGE))-
00581                         GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYMENUSIZE);
00582     }
00583 
00584     if (IsWindowVisible(_htoolbar)) {
00585         ClientRect rt(_htoolbar);
00586         prect->top += rt.bottom+2;
00587     }
00588 
00589     if (IsWindowVisible(_hstatusbar)) {
00590         ClientRect rt(_hstatusbar);
00591         prect->bottom -= rt.bottom;
00592     }
00593 }
00594 
00595 BOOL MainFrameBase::toggle_fullscreen()
00596 {
00597     RECT rt;
00598 
00599     if ((_fullscreen._mode=!_fullscreen._mode)) {
00600         GetWindowRect(_hwnd, &_fullscreen._orgPos);
00601         _fullscreen._wasZoomed = IsZoomed(_hwnd);
00602 
00603         Frame_CalcFrameClient(_hwnd, &rt);
00604         ClientToScreen(_hwnd, (LPPOINT)&rt.left);
00605         ClientToScreen(_hwnd, (LPPOINT)&rt.right);
00606 
00607         rt.left = _fullscreen._orgPos.left-rt.left;
00608         rt.top = _fullscreen._orgPos.top-rt.top;
00609         rt.right = GetSystemMetrics(SM_CXSCREEN)+_fullscreen._orgPos.right-rt.right;
00610         rt.bottom = GetSystemMetrics(SM_CYSCREEN)+_fullscreen._orgPos.bottom-rt.bottom;
00611 
00612         MoveWindow(_hwnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE);
00613     } else {
00614         MoveWindow(_hwnd, _fullscreen._orgPos.left, _fullscreen._orgPos.top,
00615                             _fullscreen._orgPos.right-_fullscreen._orgPos.left,
00616                             _fullscreen._orgPos.bottom-_fullscreen._orgPos.top, TRUE);
00617 
00618         if (_fullscreen._wasZoomed)
00619             ShowWindow(_hwnd, WS_MAXIMIZE);
00620     }
00621 
00622     return _fullscreen._mode;
00623 }
00624 
00625 void MainFrameBase::fullscreen_move()
00626 {
00627     RECT rt, pos;
00628     GetWindowRect(_hwnd, &pos);
00629 
00630     Frame_CalcFrameClient(_hwnd, &rt);
00631     ClientToScreen(_hwnd, (LPPOINT)&rt.left);
00632     ClientToScreen(_hwnd, (LPPOINT)&rt.right);
00633 
00634     rt.left = pos.left-rt.left;
00635     rt.top = pos.top-rt.top;
00636     rt.right = GetSystemMetrics(SM_CXSCREEN)+pos.right-rt.right;
00637     rt.bottom = GetSystemMetrics(SM_CYSCREEN)+pos.bottom-rt.bottom;
00638 
00639     MoveWindow(_hwnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE);
00640 }
00641 
00642 
00643 void MainFrameBase::toggle_child(HWND hwnd, UINT cmd, HWND hchild, int band_idx)
00644 {
00645     BOOL vis = IsWindowVisible(hchild);
00646 
00647     CheckMenuItem(_menu_info._hMenuView, cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED);
00648 
00649     if (band_idx != -1)
00650         SendMessage(_hwndrebar, RB_SHOWBAND, band_idx, !vis);
00651     else
00652         ShowWindow(hchild, vis? SW_HIDE: SW_SHOW);
00653 
00654     if (_fullscreen._mode)
00655         fullscreen_move();
00656 
00657     resize_frame_client();
00658 }
00659 
00660 void MainFrameBase::FillBookmarks()
00661 {
00662     HiddenWindow hide(_hsidebar);
00663     WindowCanvas canvas(_hwnd);
00664 
00665     TreeView_DeleteAllItems(_hsidebar);
00666 
00667     g_Globals._icon_cache.get_icon(ICID_FAVORITES).add_to_imagelist(_himl, canvas);
00668     g_Globals._icon_cache.get_icon(ICID_BOOKMARK).add_to_imagelist(_himl, canvas);
00669     ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_DOT), GetStockBrush(WHITE_BRUSH), canvas);
00670     g_Globals._icon_cache.get_icon(ICID_FOLDER).add_to_imagelist(_himl, canvas);
00671     g_Globals._icon_cache.get_icon(ICID_FOLDER).add_to_imagelist(_himl, canvas);
00672 
00673     TV_INSERTSTRUCT tvi;
00674 
00675     tvi.hParent = TVI_ROOT;
00676     tvi.hInsertAfter = TVI_LAST;
00677     tvi.item.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
00678     ResString sFavorites(IDS_FAVORITES);
00679     tvi.item.pszText = sFavorites.str();
00680     tvi.item.iSelectedImage = tvi.item.iImage = 0;
00681 
00682     HTREEITEM hitem_bookmarks = TreeView_InsertItem(_hsidebar, &tvi);
00683 
00684     g_Globals._favorites.fill_tree(_hsidebar, hitem_bookmarks, _himl, canvas);
00685 
00686     TreeView_Expand(_hsidebar, hitem_bookmarks, TVE_EXPAND);
00687 }
00688 
00689 
00690 bool MainFrameBase::go_to(LPCTSTR url, bool new_window)
00691 {
00693 
00694     return false;
00695 }
00696 
00697 
00698 #ifndef _NO_MDI
00699 
00700 MDIMainFrame::MDIMainFrame(HWND hwnd)
00701  :  super(hwnd)
00702 {
00703     TBBUTTON mdiBtns[] = {
00704         {0, 0, 0, BTNS_SEP, {0, 0}, 0, 0},
00705         {0, ID_WINDOW_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
00706         {1, ID_WINDOW_CASCADE, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
00707         {2, ID_WINDOW_TILE_HORZ, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
00708         {3, ID_WINDOW_TILE_VERT, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}
00709     };
00710 
00711     SendMessage(_htoolbar, TB_ADDBUTTONS, sizeof(mdiBtns)/sizeof(TBBUTTON), (LPARAM)&mdiBtns);
00712 
00713     CLIENTCREATESTRUCT ccs;
00714 
00715     ccs.hWindowMenu = _hMenuWindow;
00716     ccs.idFirstChild = IDW_FIRST_CHILD;
00717 
00718     _hmdiclient = CreateWindowEx(WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY, TEXT("MDICLIENT"), NULL,
00719                     WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
00720                     0, 0, 0, 0,
00721                     hwnd, 0, g_Globals._hInstance, &ccs);
00722 
00723     TBBUTTON extraBtns = {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0};
00724 
00725 #ifndef _NO_REBAR
00726     _hextrabar = CreateToolbarEx(hwnd,
00727                 CCS_NOPARENTALIGN|CCS_NORESIZE|CCS_NODIVIDER|
00728                 WS_CHILD|TBSTYLE_FLAT|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST,
00729                 IDW_EXTRABAR, 2, g_Globals._hInstance, IDB_DRIVEBAR, NULL, 0,
00730                 16, 16, 16, 16, sizeof(TBBUTTON));
00731 #else
00732     _hextrabar = CreateToolbarEx(hwnd,
00733                 WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST,CCS_NODIVIDER|
00734                 IDW_EXTRABAR, 2, g_Globals._hInstance, IDB_DRIVEBAR, &extraBtns, 1,
00735                 16, 13, 16, 13, sizeof(TBBUTTON));
00736 #endif
00737 
00738     CheckMenuItem(_menu_info._hMenuView, ID_VIEW_EXTRA_BAR, MF_BYCOMMAND|MF_CHECKED);
00739 
00740 
00741     extraBtns.fsStyle = BTNS_BUTTON;
00742 
00743 #ifdef __WINE__
00744      // insert unix file system button
00745     extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("/\0"));
00746     extraBtns.idCommand = ID_DRIVE_UNIX_FS;
00747     SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
00748 #endif
00749 
00750      // insert explorer window button
00751     extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("Explore\0"));
00752     extraBtns.idCommand = ID_DRIVE_DESKTOP;
00753     SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
00754 
00755      // insert shell namespace button
00756     extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("Shell\0"));
00757     extraBtns.idCommand = ID_DRIVE_SHELL_NS;
00758     extraBtns.iBitmap = 6;
00759     SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
00760 
00761      // insert web control button
00762     extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("Web\0"));
00763     extraBtns.idCommand = ID_WEB_WINDOW;
00764     extraBtns.iBitmap = 7;
00765     SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
00766 
00767     if ((HIWORD(GetVersion())>>14) == W_VER_NT) {
00768          // insert NT object namespace button
00769         extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("NT Obj\0"));
00770         extraBtns.idCommand = ID_DRIVE_NTOBJ_NS;
00771         extraBtns.iBitmap = 8;
00772         SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
00773     }
00774 #ifndef __REACTOS__ // don't insert reg button for ROS. Regedit should be used.
00775      // insert Registry button
00776     extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("Reg.\0"));
00777     extraBtns.idCommand = ID_DRIVE_REGISTRY;
00778     extraBtns.iBitmap = 9;
00779     SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
00780 #endif
00781 
00782 #ifdef _DEBUG
00783      // insert FAT direct file system access button
00784     extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("FAT\0"));
00785     extraBtns.idCommand = ID_DRIVE_FAT;
00786     extraBtns.iBitmap = 10;
00787     SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
00788 #endif
00789 
00790 
00791     TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, BTNS_SEP, {0, 0}, 0, 0};
00792 #ifndef _NO_WIN_FS
00793     PTSTR p;
00794 
00795 #ifndef _NO_REBAR
00796     _hdrivebar = CreateToolbarEx(hwnd,
00797                 CCS_NOPARENTALIGN|CCS_NORESIZE|CCS_NODIVIDER|
00798                 WS_CHILD|WS_VISIBLE|TBSTYLE_FLAT|CCS_NOMOVEY|TBSTYLE_LIST,
00799                 IDW_DRIVEBAR, 2, g_Globals._hInstance, IDB_DRIVEBAR, NULL, 0,
00800                 16, 16, 16, 16, sizeof(TBBUTTON));
00801 #else
00802     _hdrivebar = CreateToolbarEx(hwnd,
00803                 WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST|CCS_NODIVIDER,
00804                 IDW_DRIVEBAR, 2, g_Globals._hInstance, IDB_DRIVEBAR, &drivebarBtn, 1,
00805                 16, 13, 16, 13, sizeof(TBBUTTON));
00806 #endif
00807 #endif
00808 
00809     CheckMenuItem(_menu_info._hMenuView, ID_VIEW_DRIVE_BAR, MF_BYCOMMAND|MF_UNCHECKED);
00810 
00811 
00812 #ifndef _NO_WIN_FS
00813     GetLogicalDriveStrings(BUFFER_LEN, _drives);
00814 
00815      // register windows drive root strings
00816     SendMessage(_hdrivebar, TB_ADDSTRING, 0, (LPARAM)_drives);
00817 
00818     drivebarBtn.fsStyle = BTNS_BUTTON;
00819     drivebarBtn.idCommand = ID_DRIVE_FIRST;
00820 
00821     for(p=_drives; *p; ) {
00822         switch(GetDriveType(p)) {
00823             case DRIVE_REMOVABLE:   drivebarBtn.iBitmap = 1;    break;
00824             case DRIVE_CDROM:       drivebarBtn.iBitmap = 3;    break;
00825             case DRIVE_REMOTE:      drivebarBtn.iBitmap = 4;    break;
00826             case DRIVE_RAMDISK:     drivebarBtn.iBitmap = 5;    break;
00827             default:/*DRIVE_FIXED*/ drivebarBtn.iBitmap = 2;
00828         }
00829 
00830         SendMessage(_hdrivebar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&drivebarBtn);
00831         ++drivebarBtn.idCommand;
00832         ++drivebarBtn.iString;
00833 
00834         while(*p++);
00835     }
00836 #endif
00837 
00838 
00839 #ifndef _NO_REBAR
00840     int btn_hgt = HIWORD(SendMessage(_htoolbar, TB_GETBUTTONSIZE, 0, 0));
00841 
00842     REBARBANDINFO rbBand;
00843 
00844     rbBand.cbSize = sizeof(REBARBANDINFO);
00845     rbBand.fMask  = RBBIM_TEXT|RBBIM_STYLE|RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_SIZE;
00846 #ifndef RBBS_HIDETITLE // missing in MinGW headers as of 25.02.2004
00847 #define RBBS_HIDETITLE  0x400
00848 #endif
00849     rbBand.fStyle = RBBS_CHILDEDGE|RBBS_GRIPPERALWAYS|RBBS_HIDETITLE;
00850 
00851     TCHAR ExtrasBand[] = _T("Extras");
00852     rbBand.lpText = ExtrasBand;
00853     rbBand.hwndChild = _hextrabar;
00854     rbBand.cxMinChild = 0;
00855     rbBand.cyMinChild = btn_hgt;
00856     rbBand.cx = 284;
00857     SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)1, (LPARAM)&rbBand);
00858 
00859 #ifndef _NO_WIN_FS
00860     rbBand.fStyle |= RBBS_BREAK;
00861     TCHAR DrivesBand[] = _T("Drives");
00862     rbBand.lpText = DrivesBand;
00863     rbBand.hwndChild = _hdrivebar;
00864     rbBand.cxMinChild = 0;
00865     rbBand.cyMinChild = btn_hgt;
00866     rbBand.cx = 400;
00867     SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)2, (LPARAM)&rbBand);
00868 
00869     // hide the drivebar by default
00870     SendMessage(_hwndrebar, RB_SHOWBAND, 2, FALSE);
00871 #endif
00872 #endif
00873 }
00874 
00875 
00876 HWND MDIMainFrame::Create()
00877 {
00878     HMENU hMenuFrame = LoadMenu(g_Globals._hInstance, MAKEINTRESOURCE(IDM_MDIFRAME));
00879 
00880     return Window::Create(WINDOW_CREATOR(MDIMainFrame), 0,
00881                 (LPCTSTR)(int)g_Globals._hframeClass, ResString(IDS_TITLE), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
00882                 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
00883                 0/*hwndDesktop*/, hMenuFrame);
00884 }
00885 
00886 HWND MDIMainFrame::Create(LPCTSTR path, int mode)
00887 {
00888     HWND hFrame = Create();
00889     if (!hFrame)
00890         return 0;
00891 
00892     ShowWindow(hFrame, SW_SHOW);
00893 
00894     MDIMainFrame* pMainFrame = GET_WINDOW(MDIMainFrame, hFrame);
00895 
00896     if (pMainFrame)
00897         pMainFrame->CreateChild(path, mode);
00898 
00899     return hFrame;
00900 }
00901 
00902 HWND MDIMainFrame::Create(LPCITEMIDLIST pidl, int mode)
00903 {
00904     HWND hFrame = Create();
00905     if (!hFrame)
00906         return 0;
00907 
00908     ShowWindow(hFrame, SW_SHOW);
00909 
00910     MDIMainFrame* pMainFrame = GET_WINDOW(MDIMainFrame, hFrame);
00911 
00912     if (pMainFrame)
00913         pMainFrame->CreateChild(pidl, mode);
00914 
00915     return hFrame;
00916 }
00917 
00918 
00919 ChildWindow* MDIMainFrame::CreateChild(LPCTSTR path, int mode)
00920 {
00921     return reinterpret_cast<ChildWindow*>(SendMessage(_hwnd, PM_OPEN_WINDOW, mode, (LPARAM)path));
00922 }
00923 
00924 ChildWindow* MDIMainFrame::CreateChild(LPCITEMIDLIST pidl, int mode)
00925 {
00926     return reinterpret_cast<ChildWindow*>(SendMessage(_hwnd, PM_OPEN_WINDOW, mode|OWM_PIDL, (LPARAM)pidl));
00927 }
00928 
00929 
00930 BOOL MDIMainFrame::TranslateMsg(MSG* pmsg)
00931 {
00932     if (_hmdiclient && TranslateMDISysAccel(_hmdiclient, pmsg))
00933         return TRUE;
00934 
00935     return super::TranslateMsg(pmsg);
00936 }
00937 
00938 LRESULT MDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
00939 {
00940     switch(nmsg) {
00941       case PM_OPEN_WINDOW: {
00942         CONTEXT("MDIMainFrame PM_OPEN_WINDOW");
00943 
00944         TCHAR buffer[MAX_PATH];
00945         LPCTSTR path;
00946         ShellPath shell_path = DesktopFolderPath();
00947 
00948         if (lparam) {
00949             if (wparam & OWM_PIDL) {
00950                  // take over PIDL from lparam
00951                 shell_path.assign((LPCITEMIDLIST)lparam);   // create as "rooted" window
00952                 FileSysShellPath fsp(shell_path);
00953                 path = fsp;
00954 
00955                 if (path) {
00956                     LOG(FmtString(TEXT("MDIMainFrame PM_OPEN_WINDOW: path=%s"), path));
00957                     lstrcpy(buffer, path);
00958                     path = buffer;
00959                 }
00960             } else {
00961                  // take over path from lparam
00962                 path = (LPCTSTR)lparam;
00963                 shell_path = path;  // create as "rooted" window
00964             }
00965         } else {
00967             if (!GetCurrentDirectory(MAX_PATH, buffer))
00968                 *buffer = '\0';
00969 
00970             path = buffer;
00971         }
00972 
00973         if (path && _tcsstr(path, TEXT("://"))) {   // "http://...", "ftp://", ...
00974             OBJ_CONTEXT("create WebChild window", path);
00975 
00976             return (LRESULT)GET_WINDOW(ChildWindow, create_webchildwindow(WebChildWndInfo(_hmdiclient, path)));
00977         } else {
00978             OBJ_CONTEXT("create ShellChildWndInfo", path);
00979 
00980              // Shell Namespace as default view
00981             ShellChildWndInfo create_info(_hmdiclient, path, shell_path);
00982 
00983             if (wparam & OWM_ROOTED)
00984                 create_info._root_shell_path = shell_path;
00985             else
00986                 create_info._root_shell_path = DesktopFolderPath(); //SpecialFolderPath(CSIDL_DRIVES, _hwnd);
00987 
00988             create_info._pos.showCmd = wparam&OWM_SEPARATE? SW_SHOWNORMAL: SW_SHOWMAXIMIZED;
00989             create_info._pos.rcNormalPosition.left = CW_USEDEFAULT;
00990             create_info._pos.rcNormalPosition.top = CW_USEDEFAULT;
00991             create_info._pos.rcNormalPosition.right = CW_USEDEFAULT;
00992             create_info._pos.rcNormalPosition.bottom = CW_USEDEFAULT;
00993 
00994             create_info._open_mode = wparam;
00995 
00996         //  FileChildWindow::create(_hmdiclient, create_info);
00997             return (LRESULT)MDIShellBrowserChild::create(create_info);
00998         }
00999         return TRUE;}   // success
01000 
01001       case WM_SYSCOLORCHANGE: {
01002         LRESULT res;
01003         HWND hChild;
01004 
01005         /* Forward WM_SYSCOLORCHANGE to common controls */
01006         SendMessage(_hextrabar, WM_SYSCOLORCHANGE, 0, 0);
01007         SendMessage(_hdrivebar, WM_SYSCOLORCHANGE, 0, 0);
01008 
01009         for(hChild = GetNextWindow(_hmdiclient,GW_CHILD); hChild; hChild = GetNextWindow(hChild, GW_HWNDNEXT))
01010             SendMessage(hChild, WM_SYSCOLORCHANGE, 0, 0);
01011 
01012         super::ProcessMessage(nmsg, wparam, lparam, &res);
01013         break; }
01014 
01015       default: {
01016         LRESULT res;
01017 
01018         if (super::ProcessMessage(nmsg, wparam, lparam, &res))
01019             return res;
01020         else
01021             return DefFrameProc(_hwnd, _hmdiclient, nmsg, wparam, lparam);
01022       }
01023     }
01024 
01025     return 0;
01026 }
01027 
01028 int MDIMainFrame::Command(int id, int code)
01029 {
01030     CONTEXT("MDIMainFrame::Command()");
01031 
01032     HWND hwndClient = (HWND) SendMessage(_hmdiclient, WM_MDIGETACTIVE, 0, 0);
01033 
01034     if (hwndClient)
01035         if (SendMessage(hwndClient, PM_DISPATCH_COMMAND, MAKELONG(id,code), 0))
01036             return 0;
01037 
01038 #ifndef _NO_WIN_FS
01039     if (id>=ID_DRIVE_FIRST && id<=ID_DRIVE_FIRST+0xFF) {
01040         TCHAR drv[_MAX_DRIVE], path[MAX_PATH];
01041         LPCTSTR root = _drives;
01042 
01043         for(int i=id-ID_DRIVE_FIRST; i--; root++)
01044             while(*root)
01045                 ++root;
01046 
01047         if (activate_drive_window(root))
01048             return 0;
01049 
01050         _tsplitpath_s(root, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
01051 
01052         if (!SetCurrentDirectory(drv)) {
01053             display_error(_hwnd, GetLastError());
01054             return 0;
01055         }
01056 
01057         GetCurrentDirectory(MAX_PATH, path); 
01058 
01059         FileChildWindow::create(FileChildWndInfo(_hmdiclient, path));
01060 
01061         return 1;
01062     }
01063 #endif
01064 
01065     switch(id) {
01066       case ID_WINDOW_NEW: {
01067         TCHAR path[MAX_PATH];
01068 
01069         GetCurrentDirectory(MAX_PATH, path);
01070 
01071         FileChildWindow::create(FileChildWndInfo(_hmdiclient, path));
01072         break;}
01073 
01074       case ID_WINDOW_CASCADE:
01075         SendMessage(_hmdiclient, WM_MDICASCADE, 0, 0);
01076         break;
01077 
01078       case ID_WINDOW_TILE_HORZ:
01079         SendMessage(_hmdiclient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
01080         break;
01081 
01082       case ID_WINDOW_TILE_VERT:
01083         SendMessage(_hmdiclient, WM_MDITILE, MDITILE_VERTICAL, 0);
01084         break;
01085 
01086       case ID_WINDOW_ARRANGE:
01087         SendMessage(_hmdiclient, WM_MDIICONARRANGE, 0, 0);
01088         break;
01089 
01090       case ID_VIEW_EXTRA_BAR:
01091         toggle_child(_hwnd, id, _hextrabar, 1);
01092         break;
01093 
01094 #ifndef _NO_WIN_FS
01095       case ID_VIEW_DRIVE_BAR:
01096         toggle_child(_hwnd, id, _hdrivebar, 2);
01097         break;
01098 #endif
01099 
01100 #ifdef __WINE__
01101       case ID_DRIVE_UNIX_FS: {
01102         TCHAR path[MAX_PATH];
01103         FileChildWindow* child;
01104 
01105         getcwd(path, COUNTOF(path));
01106 
01107         if (activate_child_window(TEXT("unixfs")))
01108             break;
01109 
01110         FileChildWindow::create(_hmdiclient, FileChildWndInfo(path));
01111         break;}
01112 #endif
01113 
01114       case ID_DRIVE_DESKTOP: {
01115         TCHAR path[MAX_PATH];
01116 
01117         if (activate_child_window(TEXT("Desktop")))
01118             break;
01119 
01120         GetCurrentDirectory(MAX_PATH, path);
01121 
01122         MDIShellBrowserChild::create(ShellChildWndInfo(_hmdiclient, path, DesktopFolderPath()));
01123         break;}
01124 
01125       case ID_DRIVE_SHELL_NS: {
01126         TCHAR path[MAX_PATH];
01127         GetCurrentDirectory(MAX_PATH, path);
01128 
01129         if (activate_child_window(TEXT("Shell")))
01130             break;
01131 
01132         FileChildWindow::create(ShellChildWndInfo(_hmdiclient, path, DesktopFolderPath()));
01133         break;}
01134 
01135       case ID_DRIVE_NTOBJ_NS: {
01136         if (activate_child_window(TEXT("NTOBJ")))
01137             break;
01138 
01139         FileChildWindow::create(NtObjChildWndInfo(_hmdiclient, TEXT("\\")));
01140       break;}
01141 
01142       case ID_DRIVE_REGISTRY: {
01143         if (activate_child_window(TEXT("Registry")))
01144             break;
01145 
01146         FileChildWindow::create(RegistryChildWndInfo(_hmdiclient, TEXT("\\")));
01147       break;}
01148 
01149       case ID_DRIVE_FAT: {
01150 
01152 
01153         if (activate_child_window(TEXT("FAT")))
01154             break;
01155 
01156         FileChildWindow::create(FATChildWndInfo(_hmdiclient, TEXT("FAT Image")));   //@@
01157       break;}
01158 
01159       case ID_WEB_WINDOW:
01160 #ifdef _DEBUG
01161         create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://localhost")));
01162 #else
01163         create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://www.reactos.org")));
01164 #endif
01165         break;
01166 
01167       case ID_EXPLORER_FAQ:
01168         create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://www.sky.franken.de/explorer/")));
01169         break;
01170 
01171       case ID_VIEW_SDI:
01172         MainFrameBase::Create(ExplorerCmd());
01173         break;
01174 
01176 
01177       default:
01178         if (super::Command(id, code) == 0)
01179             return 0;
01180         else
01181             return DefFrameProc(_hwnd, _hmdiclient, WM_COMMAND, MAKELONG(id,code), 0);
01182     }
01183 
01184     return 0;
01185 }
01186 
01187 
01188 void MDIMainFrame::frame_get_clientspace(PRECT prect)
01189 {
01190     super::frame_get_clientspace(prect);
01191 
01192 #ifndef _NO_WIN_FS
01193     if (IsWindowVisible(_hdrivebar)) {
01194         ClientRect rt(_hdrivebar);
01195         prect->top += rt.bottom+2;
01196     }
01197 #endif
01198 }
01199 
01200 void MDIMainFrame::resize_frame(int cx, int cy)
01201 {
01202     if (cy <= 0)
01203         return; // avoid resizing children when receiving RBN_AUTOSIZE while getting minimized
01204 
01205     RECT rect = {0, 0, cx, cy};
01206 
01207     if (_hwndrebar) {
01208         int height = SendMessage(_hwndrebar, RB_GETBARHEIGHT, 0, 0);
01209         rect.top += height;
01210         rect.top += 5;
01211     } else {
01212         if (IsWindowVisible(_htoolbar)) {
01213             SendMessage(_htoolbar, WM_SIZE, 0, 0);
01214             WindowRect rt(_htoolbar);
01215             rect.top = rt.bottom;
01216         //  rect.bottom -= rt.bottom;
01217         }
01218 
01219         if (IsWindowVisible(_hextrabar)) {
01220             SendMessage(_hextrabar, WM_SIZE, 0, 0);
01221             WindowRect rt(_hextrabar);
01222             int new_top = --rect.top + rt.bottom;
01223             MoveWindow(_hextrabar, 0, rect.top, rt.right, new_top, TRUE);
01224             rect.top = new_top;
01225         //  rect.bottom -= rt.bottom;
01226         }
01227 
01228 #ifndef _NO_WIN_FS
01229         if (IsWindowVisible(_hdrivebar)) {
01230             SendMessage(_hdrivebar, WM_SIZE, 0, 0);
01231             WindowRect rt(_hdrivebar);
01232             int new_top = --rect.top + rt.bottom;
01233             MoveWindow(_hdrivebar, 0, rect.top, rt.right, new_top, TRUE);
01234             rect.top = new_top;
01235         //  rect.bottom -= rt.bottom;
01236         }
01237 #endif
01238     }
01239 
01240     if (IsWindowVisible(_hstatusbar)) {
01241         int parts[] = {300, 500};
01242 
01243         SendMessage(_hstatusbar, WM_SIZE, 0, 0);
01244         SendMessage(_hstatusbar, SB_SETPARTS, 2, (LPARAM)&parts);
01245         ClientRect rt(_hstatusbar);
01246         rect.bottom -= rt.bottom;
01247     }
01248 
01249     if (IsWindowVisible(_hsidebar)) {
01250         WindowRect rt(_hsidebar);
01251         rect.left += rt.right-rt.left;
01252 
01253         SetWindowPos(_hsidebar, 0, -1, rect.top-1, rt.right-rt.left, rect.bottom-rect.top+1, SWP_NOACTIVATE|SWP_NOZORDER);
01254     }
01255 
01256     MoveWindow(_hmdiclient, rect.left-1, rect.top-1, rect.right-rect.left+1, rect.bottom-rect.top+1, TRUE);
01257 }
01258 
01259 bool MDIMainFrame::activate_drive_window(LPCTSTR path)
01260 {
01261     TCHAR drv1[_MAX_DRIVE], drv2[_MAX_DRIVE];
01262     HWND child_wnd;
01263 
01264     _tsplitpath_s(path, drv1, COUNTOF(drv1), NULL, 0, NULL, 0, NULL, 0);
01265 
01266      // search for a already open window for the same drive
01267     for(child_wnd=GetNextWindow(_hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) {
01268         FileChildWindow* child = (FileChildWindow*) SendMessage(child_wnd, PM_GET_FILEWND_PTR, 0, 0);
01269 
01270         if (child) {
01271             _tsplitpath_s(child->get_root()._path, drv2, COUNTOF(drv2), NULL, 0, NULL, 0, NULL, 0);
01272 
01273             if (!lstrcmpi(drv2, drv1)) {
01274                 SendMessage(_hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
01275 
01276                 if (IsMinimized(child_wnd))
01277                     ShowWindow(child_wnd, SW_SHOWNORMAL);
01278 
01279                 return true;
01280             }
01281         }
01282     }
01283 
01284     return false;
01285 }
01286 
01287 bool MDIMainFrame::activate_child_window(LPCTSTR filesys)
01288 {
01289     HWND child_wnd;
01290 
01291      // search for a already open window of the given file system name
01292     for(child_wnd=GetNextWindow(_hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) {
01293         FileChildWindow* child = (FileChildWindow*) SendMessage(child_wnd, PM_GET_FILEWND_PTR, 0, 0);
01294 
01295         if (child) {
01296             if (!lstrcmpi(child->get_root()._fs, filesys)) {
01297                 SendMessage(_hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
01298 
01299                 if (IsMinimized(child_wnd))
01300                     ShowWindow(child_wnd, SW_SHOWNORMAL);
01301 
01302                 return true;
01303             }
01304         } else {
01305             ShellBrowser* shell_child = (ShellBrowser*) SendMessage(child_wnd, PM_GET_SHELLBROWSER_PTR, 0, 0);
01306 
01307             if (shell_child) {
01308                 if (!lstrcmpi(shell_child->get_root()._fs, filesys)) {
01309                     SendMessage(_hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
01310 
01311                     if (IsMinimized(child_wnd))
01312                         ShowWindow(child_wnd, SW_SHOWNORMAL);
01313 
01314                     return true;
01315                 }
01316             }
01317         }
01318     }
01319 
01320     return false;
01321 }
01322 
01323 bool MDIMainFrame::go_to(LPCTSTR url, bool new_window)
01324 {
01325     if (!new_window) {
01326         HWND hwndClient = (HWND) SendMessage(_hmdiclient, WM_MDIGETACTIVE, 0, 0);
01327 
01328         if (hwndClient)
01329             if (SendMessage(hwndClient, PM_JUMP_TO_URL, 0, (LPARAM)url))
01330                 return true;
01331     }
01332 
01333     if (CreateChild(url))
01334         return true;
01335 
01336     return super::go_to(url, new_window);
01337 }
01338 
01339 #endif // _NO_MDI
01340 
01341 
01342 SDIMainFrame::SDIMainFrame(HWND hwnd)
01343  :  super(hwnd)
01344 {
01345     _split_pos = DEFAULT_SPLIT_POS;
01346     _last_split = DEFAULT_SPLIT_POS;
01347 
01348     /* wait for PM_OPEN_WINDOW message before creating a shell view
01349     update_shell_browser();*/
01350 }
01351 
01352 HWND SDIMainFrame::Create()
01353 {
01354     HMENU hMenuFrame = LoadMenu(g_Globals._hInstance, MAKEINTRESOURCE(IDM_SDIFRAME));
01355 
01356     return Window::Create(WINDOW_CREATOR(SDIMainFrame), 0,
01357                 (LPCTSTR)(int)g_Globals._hframeClass, ResString(IDS_TITLE), WS_OVERLAPPEDWINDOW,
01358                 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
01359                 0/*hwndDesktop*/, hMenuFrame);
01360 }
01361 
01362 HWND SDIMainFrame::Create(LPCITEMIDLIST pidl, int mode)
01363 {
01364     HWND hFrame = Create();
01365     if (!hFrame)
01366         return 0;
01367 
01368     ShowWindow(hFrame, SW_SHOW);
01369 
01370     SDIMainFrame* pFrame = GET_WINDOW(SDIMainFrame, hFrame);
01371 
01372     if (pFrame)
01373         pFrame->jump_to(pidl, mode);
01374 
01375     return hFrame;
01376 }
01377 
01378 HWND SDIMainFrame::Create(LPCTSTR path, int mode)
01379 {
01380     HWND hFrame = Create();
01381     if (!hFrame)
01382         return 0;
01383 
01384     ShowWindow(hFrame, SW_SHOW);
01385 
01386     MDIMainFrame* pMainFrame = GET_WINDOW(MDIMainFrame, hFrame);
01387 
01388     if (pMainFrame)
01389         pMainFrame->CreateChild(path, mode);
01390 
01391     return hFrame;
01392 }
01393 
01394 LRESULT SDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
01395 {
01396     switch(nmsg) {
01397       case WM_SIZE:
01398         resize_frame(LOWORD(lparam), HIWORD(lparam));
01399         break;
01400 
01401       case WM_PAINT: {
01402         PaintCanvas canvas(_hwnd);
01403 
01404         if (_left_hwnd) {
01405             ClientRect rt(_hwnd);
01406             rt.left = _split_pos-SPLIT_WIDTH/2;
01407             rt.right = _split_pos+SPLIT_WIDTH/2+1;
01408 
01409             if (_right_hwnd) {
01410                 WindowRect right_rect(_right_hwnd);
01411                 ScreenToClient(_hwnd, &right_rect);
01412                 rt.top = right_rect.top;
01413                 rt.bottom = right_rect.bottom;
01414             }
01415 
01416             HBRUSH lastBrush = SelectBrush(canvas, GetStockBrush(COLOR_SPLITBAR));
01417             Rectangle(canvas, rt.left, rt.top-1, rt.right, rt.bottom+1);
01418             SelectObject(canvas, lastBrush);
01419         }
01420         break;}
01421 
01422       case WM_SETCURSOR:
01423         if (_left_hwnd)
01424             if (LOWORD(lparam) == HTCLIENT) {
01425                 POINT pt;
01426                 GetCursorPos(&pt);
01427                 ScreenToClient(_hwnd, &pt);
01428 
01429                 if (pt.x>=_split_pos-SPLIT_WIDTH/2 && pt.x<_split_pos+SPLIT_WIDTH/2+1) {
01430                     SetCursor(LoadCursor(0, IDC_SIZEWE));
01431                     return TRUE;
01432                 }
01433             }
01434         goto def;
01435 
01436       case WM_LBUTTONDOWN:
01437         if (_left_hwnd) {
01438             int x = GET_X_LPARAM(lparam);
01439 
01440             ClientRect rt(_hwnd);
01441 
01442             if (x>=_split_pos-SPLIT_WIDTH/2 && x<_split_pos+SPLIT_WIDTH/2+1) {
01443                 _last_split = _split_pos;
01444                 SetCapture(_hwnd);
01445             }
01446         }
01447         break;
01448 
01449       case WM_LBUTTONUP:
01450         if (GetCapture() == _hwnd)
01451             ReleaseCapture();
01452         break;
01453 
01454       case WM_KEYDOWN:
01455         if (wparam == VK_ESCAPE)
01456             if (GetCapture() == _hwnd) {
01457                 _split_pos = _last_split;
01458                 resize_children();
01459                 _last_split = -1;
01460                 ReleaseCapture();
01461                 SetCursor(LoadCursor(0, IDC_ARROW));
01462             }
01463         break;
01464 
01465       case WM_MOUSEMOVE:
01466         if (GetCapture() == _hwnd) {
01467             int x = GET_X_LPARAM(lparam);
01468 
01469             ClientRect rt(_hwnd);
01470 
01471             if (x>=0 && x<rt.right) {
01472                 _split_pos = x;
01473                 resize_children();
01474                 rt.left = x-SPLIT_WIDTH/2;
01475                 rt.right = x+SPLIT_WIDTH/2+1;
01476                 InvalidateRect(_hwnd, &rt, FALSE);
01477                 UpdateWindow(_left_hwnd);
01478                 UpdateWindow(_hwnd);
01479                 UpdateWindow(_right_hwnd);
01480             }
01481         }
01482         break;
01483 
01484       case PM_OPEN_WINDOW: {
01485         CONTEXT("SDIMainFrame PM_OPEN_WINDOW");
01486 
01487         TCHAR buffer[MAX_PATH];
01488         LPCTSTR path;
01489         ShellPath shell_path = DesktopFolderPath();
01490 
01491         if (lparam) {
01492             if (wparam & OWM_PIDL) {
01493                  // take over PIDL from lparam
01494                 shell_path.assign((LPCITEMIDLIST)lparam);   // create as "rooted" window
01495                 FileSysShellPath fsp(shell_path);
01496                 path = fsp;
01497 
01498                 if (path) {
01499                     LOG(FmtString(TEXT("SDIMainFrame PM_OPEN_WINDOW: path=%s"), path));
01500                     lstrcpy(buffer, path);
01501                     path = buffer;
01502                 }
01503             } else {
01504                  // take over path from lparam
01505                 path = (LPCTSTR)lparam;
01506                 shell_path = path;  // create as "rooted" window
01507             }
01508         } else {
01510             if (!GetCurrentDirectory(MAX_PATH, buffer))
01511                 *buffer = '\0';
01512 
01513             path = buffer;
01514             shell_path = path;
01515         }
01516 
01517         if (wparam & OWM_ROOTED)
01518             _shellpath_info._root_shell_path = shell_path;
01519         else
01520             _shellpath_info._root_shell_path = DesktopFolderPath(); //SpecialFolderPath(CSIDL_DRIVES, _hwnd);
01521 
01522         jump_to(shell_path, wparam);    
01523         return TRUE;}   // success
01524 
01525       default: def:
01526         return super::WndProc(nmsg, wparam, lparam);
01527     }
01528 
01529     return 0;
01530 }
01531 
01532 int SDIMainFrame::Command(int id, int code)
01533 {
01534     switch(id) {
01535       case ID_VIEW_MDI:
01536         MainFrameBase::Create(ExplorerCmd(_url, true));
01537         break;
01538 
01539       default:
01540         return super::Command(id, code);
01541     }
01542 
01543     return 0;
01544 }
01545 
01546 void SDIMainFrame::resize_frame(int cx, int cy)
01547 {
01548     if (cy <= 0)
01549         return; // avoid resizing children when receiving RBN_AUTOSIZE while getting minimized
01550 
01551     RECT rect = {0, 0, cx, cy};
01552 
01553     if (_hwndrebar) {
01554         int height = ClientRect(_hwndrebar).bottom;
01555         rect.top += height;
01556         rect.top += 5;
01557     } else {
01558         if (IsWindowVisible(_htoolbar)) {
01559             SendMessage(_htoolbar, WM_SIZE, 0, 0);
01560             WindowRect rt(_htoolbar);
01561             rect.top = rt.bottom;
01562         //  rect.bottom -= rt.bottom;
01563         }
01564     }
01565 
01566     if (IsWindowVisible(_hstatusbar)) {
01567         int parts[] = {300, 500};
01568 
01569         SendMessage(_hstatusbar, WM_SIZE, 0, 0);
01570         SendMessage(_hstatusbar, SB_SETPARTS, 2, (LPARAM)&parts);
01571         ClientRect rt(_hstatusbar);
01572         rect.bottom -= rt.bottom;
01573     }
01574 
01575     if (IsWindowVisible(_hsidebar)) {
01576         WindowRect rt(_hsidebar);
01577         rect.left += rt.right-rt.left;
01578 
01579         SetWindowPos(_hsidebar, 0, -1, rect.top-1, rt.right-rt.left, rect.bottom-rect.top+1, SWP_NOACTIVATE|SWP_NOZORDER);
01580     }
01581 
01582     _clnt_rect = rect;
01583 
01584     resize_children();
01585 }
01586 
01587 void SDIMainFrame::resize_children()
01588 {
01589     HDWP hdwp = BeginDeferWindowPos(2);
01590 
01591     int cx = _clnt_rect.left;
01592 
01593     if (_left_hwnd) {
01594         cx = _split_pos + SPLIT_WIDTH/2;
01595 
01596         hdwp = DeferWindowPos(hdwp, _left_hwnd, 0, _clnt_rect.left, _clnt_rect.top, _split_pos-SPLIT_WIDTH/2-_clnt_rect.left, _clnt_rect.bottom-_clnt_rect.top, SWP_NOZORDER|SWP_NOACTIVATE);
01597     } else {
01598         //_split_pos = -1;
01599         cx = 0;
01600     }
01601 
01602     if (_right_hwnd)
01603         hdwp = DeferWindowPos(hdwp, _right_hwnd, 0, _clnt_rect.left+cx+1, _clnt_rect.top, _clnt_rect.right-cx, _clnt_rect.bottom-_clnt_rect.top, SWP_NOZORDER|SWP_NOACTIVATE);
01604 
01605     EndDeferWindowPos(hdwp);
01606 }
01607 
01608 void SDIMainFrame::update_clnt_rect()
01609 {
01610     ClientRect rect(_hwnd);
01611 
01612     resize_frame(rect.right, rect.bottom);
01613 }
01614 
01615 void SDIMainFrame::update_shell_browser()
01616 {
01617     int split_pos = DEFAULT_SPLIT_POS;
01618 
01619     if (_shellBrowser.get()) {
01620         split_pos = _split_pos;
01621         delete _shellBrowser.release();
01622     }
01623 
01624      // create explorer treeview
01625     if (_shellpath_info._open_mode & OWM_EXPLORE) {
01626         if (!_left_hwnd) {
01627             ClientRect rect(_hwnd);
01628 
01629             _left_hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, NULL,
01630                             WS_CHILD|WS_TABSTOP|WS_VISIBLE|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_NOTOOLTIPS|TVS_SHOWSELALWAYS,
01631                             0, rect.top, split_pos-SPLIT_WIDTH/2, rect.bottom-rect.top,
01632                             _hwnd, (HMENU)IDC_FILETREE, g_Globals._hInstance, 0);
01633 
01634              // display tree window as long as the shell view is not yet visible
01635             resize_frame(rect.right, rect.bottom);
01636             MoveWindow(_left_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
01637         }
01638     } else {
01639         if (_left_hwnd) {
01640             DestroyWindow(_left_hwnd);
01641             _left_hwnd = 0;
01642         }
01643     }
01644 
01645     _shellBrowser = auto_ptr<ShellBrowser>(new ShellBrowser(_hwnd, _hwnd, _left_hwnd, _right_hwnd,
01646                                                 _shellpath_info, this, _cm_ifs));
01647 
01648     if (_left_hwnd)
01649         _shellBrowser->Init();
01650 
01651      // update _clnt_rect and set size of new created shell view windows
01652     update_clnt_rect();
01653 }
01654 
01655 void SDIMainFrame::entry_selected(Entry* entry)
01656 {
01657     if (_left_hwnd)
01658         _shellBrowser->select_folder(entry, false);
01659 
01660     _shellBrowser->UpdateFolderView(entry->get_shell_folder());
01661 
01662      // set size of new created shell view windows
01663     resize_children();
01664 }
01665 
01666 void SDIMainFrame::set_url(LPCTSTR url)
01667 {
01668     if (_url != url) {
01669         _url = url;
01670         SetWindowText(_haddrcombo, url);
01671     }
01672 }
01673 
01674 
01675 void SDIMainFrame::jump_to(LPCTSTR path, int mode)
01676 {/*@@todo
01677     if (_shellBrowser.get() && (_shellpath_info._open_mode&~OWM_PIDL)==(mode&~OWM_PIDL)) {
01678         _shellBrowser->jump_to(path);
01679 
01680         _shellpath_info._shell_path = path;
01681     } else */{
01682         _shellpath_info._open_mode = mode;
01683         _shellpath_info._shell_path = path;
01684 
01685         update_shell_browser();
01686     }
01687 }
01688 
01689 void SDIMainFrame::jump_to(LPCITEMIDLIST path, int mode)
01690 {
01691     if (_shellBrowser.get() && (_shellpath_info._open_mode&~OWM_PIDL)==(mode&~OWM_PIDL)) {
01692         ShellPath shell_path = path;
01693 
01694         _shellBrowser->jump_to(shell_path);
01695 
01696         _shellpath_info._shell_path = shell_path;
01697     } else {
01698         _shellpath_info._open_mode = mode;
01699         _shellpath_info._shell_path = path;
01700 
01701         update_shell_browser();
01702     }
01703 }

Generated on Sat May 26 2012 04:17:30 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.