- Timestamp:
- Nov 9, 1999, 11:38:57 PM (26 years ago)
- Location:
- trunk/src/comdlg32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/comdlg32.cpp
r1556 r1677 1 /* $Id: comdlg32.cpp,v 1.1 7 1999-11-02 20:37:42 sandervlExp $ */1 /* $Id: comdlg32.cpp,v 1.18 1999-11-09 22:38:57 phaller Exp $ */ 2 2 3 3 /* … … 25 25 #include <win32wnd.h> 26 26 27 ODINDEBUGCHANNEL(COMDLG32 )27 ODINDEBUGCHANNEL(COMDLG32-COMDLG32) 28 28 29 29 #if 0 … … 87 87 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC) 88 88 89 //@@@PH 1999/11/09 needs to be fixed 89 90 return(O32_GetSaveFileName(lpofn)); 90 91 } … … 175 176 ofn.lpstrCustomFilter = szCustFilter; 176 177 177 COMDLG32_CHECKHOOK((&ofn), OFN_ENABLEHOOK, WNDPROC)178 179 bResult = O32_GetSaveFileName(&ofn);178 // call ascii variant of function 179 // @@@PH switch to ODIN_GetSaveFileNameA later 180 bResult = GetSaveFileNameA(&ofn); 180 181 181 182 if (ofn.lpTemplateName != NULL) FreeAsciiString((char*)ofn.lpTemplateName); … … 230 231 Win32WindowProc *wndproc; 231 232 232 if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) { 233 return GetFileDialog95A(lpofn, OPEN_DIALOG); 233 if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) 234 { 235 return GetFileDialog95A(lpofn, OPEN_DIALOG); 234 236 } 235 237 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC) 236 238 239 //@@@PH 1999/11/09 needs to be fixed 237 240 return(O32_GetOpenFileName(lpofn)); 238 241 } … … 323 326 ofn.lpstrCustomFilter = szCustFilter; 324 327 325 COMDLG32_CHECKHOOK((&ofn), OFN_ENABLEHOOK, WNDPROC)326 327 bResult = O32_GetOpenFileName(&ofn);328 // call ascii variant of function 329 // @@@PH switch to ODIN_GetOpenFileNameA later 330 bResult = GetOpenFileNameA(&ofn); 328 331 329 332 if (ofn.lpTemplateName != NULL) FreeAsciiString((char*)ofn.lpTemplateName); -
trunk/src/comdlg32/filedlg95.cpp
r1556 r1677 1 /* $Id: filedlg95.cpp,v 1. 2 1999-11-02 20:37:42 sandervlExp $ */1 /* $Id: filedlg95.cpp,v 1.3 1999-11-09 22:38:57 phaller Exp $ */ 2 2 /* 3 3 * COMMDLG - File Open Dialogs Win95 look and feel … … 46 46 HIMAGELIST hImgList; 47 47 int m_iIndent; /* Indentation index */ 48 LPITEMIDLIST pidlItem; /* absolute pidl of the item */ 48 LPITEMIDLIST pidlItem; /* absolute pidl of the item */ 49 49 50 50 } SFOLDER,*LPSFOLDER; … … 174 174 * GetOpenFileName95 175 175 * 176 * Creates an Open common dialog box that lets the user select 176 * Creates an Open common dialog box that lets the user select 177 177 * the drive, directory, and the name of a file or set of files to open. 178 178 * … … 211 211 if( lRes == -1) 212 212 return FALSE; 213 213 214 214 return lRes; 215 215 } … … 254 254 if( lRes == -1) 255 255 return FALSE; 256 256 257 257 return lRes; 258 258 } … … 272 272 BOOL ret; 273 273 FileOpenDlgInfos *fodInfos; 274 275 /* Initialise FileOpenDlgInfos structure*/ 274 275 /* Initialise FileOpenDlgInfos structure*/ 276 276 fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos)); 277 277 memset(&fodInfos->ofnInfos,'\0',sizeof(*ofn)); fodInfos->ofnInfos.lStructSize = sizeof(*ofn); … … 353 353 /* Initialise the dialog property */ 354 354 fodInfos->DlgInfos.dwDlgProp = 0; 355 355 356 356 switch(iDlgType) 357 357 { … … 382 382 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrCustomFilter)); 383 383 384 if (fodInfos->ofnInfos.lpstrFile) 384 if (fodInfos->ofnInfos.lpstrFile) 385 385 { 386 386 strcpy(ofn->lpstrFile,fodInfos->ofnInfos.lpstrFile); 387 387 MemFree((LPVOID)fodInfos->ofnInfos.lpstrFile); 388 388 } 389 if (fodInfos->ofnInfos.lpstrFileTitle) 389 if (fodInfos->ofnInfos.lpstrFileTitle) 390 390 { 391 391 if (ofn->lpstrFileTitle) … … 427 427 /* filter is a list... title\0ext\0......\0\0 */ 428 428 s = (LPWSTR)ofn->lpstrFilter; 429 429 430 430 while (*s) 431 431 s = s+lstrlenW(s)+1; … … 491 491 fodInfos->ofnInfos.lCustData = ofn->lCustData; 492 492 fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook; 493 if (ofn->lpTemplateName) 494 { 493 if (ofn->lpTemplateName) 494 { 495 495 fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)+1); 496 496 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpTemplateName,(LPWSTR)ofn->lpTemplateName); … … 498 498 /* Initialise the dialog property */ 499 499 fodInfos->DlgInfos.dwDlgProp = 0; 500 500 501 501 switch(iDlgType) 502 502 { … … 511 511 ret = 0; 512 512 } 513 513 514 514 /* Cleaning */ 515 515 ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset; … … 625 625 if(rectCtrl.top > rectStc32.top) 626 626 { 627 627 628 628 if(ptMoveCtl.x > 0) 629 629 rectCtrl.left += ptMoveCtl.x; 630 630 rectCtrl.top += ptMoveCtl.y; 631 handle = DeferWindowPos(handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 631 handle = DeferWindowPos(handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 632 632 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, 633 633 SWP_NOSIZE | SWP_NOZORDER ); … … 662 662 rectCtrl.top += ptMoveCtl.y; 663 663 664 handle = DeferWindowPos( handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 664 handle = DeferWindowPos( handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 665 665 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, 666 666 SWP_NOSIZE |SWP_NOZORDER ); … … 682 682 { 683 683 case WM_INITDIALOG: 684 { 684 { 685 685 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *)lParam; 686 686 procUserHook=NULL; … … 694 694 } } 695 695 if(procUserHook) 696 return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam); 697 return DefWindowProcA(hwnd,uMsg,wParam,lParam); 696 return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam); 697 return DefWindowProcA(hwnd,uMsg,wParam,lParam); 698 698 } 699 699 … … 735 735 if(hChildDlg) 736 736 { 737 ShowWindow(hChildDlg,SW_SHOW); 737 ShowWindow(hChildDlg,SW_SHOW); 738 738 return hChildDlg; 739 739 } … … 751 751 tmplate.cx = rectHwnd.right-rectHwnd.left; 752 752 tmplate.cy = rectHwnd.bottom-rectHwnd.top; 753 753 754 754 return CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos); 755 755 } … … 782 782 } 783 783 return FALSE; 784 784 785 785 case WM_GETISHELLBROWSER: 786 786 return FILEDLG95_OnWMGetIShellBrowser(hwnd); … … 806 806 TRACE("\n"); 807 807 808 /* Adds the FileOpenDlgInfos in the property list of the dialog 808 /* Adds the FileOpenDlgInfos in the property list of the dialog 809 809 so it will be easily accessible through a GetPropA(...) */ 810 810 SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) fodInfos); 811 811 812 812 #ifndef __WIN32OS2__ 813 /* Make sure the common control DLL is loaded */ 813 /* Make sure the common control DLL is loaded */ 814 814 InitCommonControls(); 815 815 #endif … … 910 910 } 911 911 /* Do not use the listview selection anymore */ 912 fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW; 913 return 0; 912 913 // @@@PH 1999/11/09 914 if (fodInfos != NULL) 915 fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW; 916 917 return 0; 914 918 } 915 919 … … 928 932 SetWindowLongA(hwnd,DWL_MSGRESULT,(LONG)fodInfos->Shell.FOIShellBrowser); 929 933 930 return TRUE; 934 return TRUE; 931 935 } 932 936 … … 1008 1012 * 1009 1013 * Ok button WM_COMMAND message handler 1010 * 1014 * 1011 1015 * If the function succeeds, the return value is nonzero. 1012 1016 */ … … 1040 1044 char lpstrPathAndFile[MAX_PATH] = ""; 1041 1045 1042 /* Separate the file spec from the path spec 1043 e.g.: 1046 /* Separate the file spec from the path spec 1047 e.g.: 1044 1048 lpstrSpecifiedByUser lpstrPathSpec lpstrFileSpec 1045 1049 C:\TEXT1\TEXT2 C:\TEXT1 TEXT2 1046 */ 1050 */ 1047 1051 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrSpecifiedByUser); 1048 1052 strcpy(lpstrPathSpec,lpstrSpecifiedByUser); 1049 1053 COMDLG32_PathRemoveFileSpecA(lpstrPathSpec); 1050 1054 1051 1055 /* Get the current directory name */ 1052 1056 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, 1053 1057 lpstrCurrentDir); 1054 1058 1055 /* Create an absolute path name */ 1059 /* Create an absolute path name */ 1056 1060 if(lpstrSpecifiedByUser[1] != ':') 1057 1061 { … … 1069 1073 strcpy(lpstrPathSpec,lpstrTmp); 1070 1074 } 1071 break; 1072 /* Go to parent ..\TEXT */ 1075 break; 1076 /* Go to parent ..\TEXT */ 1073 1077 case '.': 1074 1078 { … … 1094 1098 strcpy(lpstrPathSpec,lpstrTmp); 1095 1099 } 1096 1100 1097 1101 } /* end switch */ 1098 1102 } … … 1101 1105 { 1102 1106 /* Browse to the right directory */ 1103 COMDLG32_SHGetDesktopFolder(&psfDesktop); 1107 COMDLG32_SHGetDesktopFolder(&psfDesktop); 1104 1108 if((browsePidl = GetPidlFromName(psfDesktop,lpstrPathSpec))) 1105 1109 { … … 1122 1126 } 1123 1127 } 1124 1128 1125 1129 strcat(lpstrPathAndFile,lpstrPathSpec); 1126 1130 IShellFolder_Release(psfDesktop); … … 1134 1138 COMDLG32_PathAddBackslashA(lpstrPathAndFile); 1135 1139 strcat(lpstrPathAndFile,lpstrFileSpec); 1136 1140 1137 1141 /* Update the edit field */ 1138 1142 SetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileSpec); 1139 1143 SendDlgItemMessageA(hwnd,IDC_FILENAME,EM_SETSEL,0,-1); 1140 1144 1141 1145 /* Don't go further if we dont have a file spec */ 1142 1146 if(!strlen(lpstrFileSpec) || !strcmp(lpstrFileSpec,lpstrPathSpec)) 1143 1147 return FALSE; 1144 1148 1145 /* Time to check lpstrFileSpec */ 1149 /* Time to check lpstrFileSpec */ 1146 1150 /* search => contains * or ? */ 1147 1151 /* browse => contains a directory name */ … … 1160 1164 lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter, 1161 1165 (LPSTR)strlwr((LPSTR)lpstrFileSpec)); 1162 1166 1163 1167 IShellView_Refresh(fodInfos->Shell.FOIShellView); 1164 1168 … … 1175 1179 { 1176 1180 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 1177 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1178 1, 1179 &browsePidl, 1181 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1182 1, 1183 &browsePidl, 1180 1184 &ulAttr); 1181 1185 … … 1249 1253 return EndDialog(hwnd,TRUE); 1250 1254 } 1251 return FALSE; 1255 return FALSE; 1252 1256 } 1253 1257 } … … 1260 1264 /* if the file has no extension, append the selected 1261 1265 extension of the filetype combo box */ 1262 int iExt; 1266 int iExt; 1263 1267 LPSTR lpstrExt; 1264 1268 iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB); … … 1276 1280 strcpy(lpstrExt,&lpstrTemp[1]); 1277 1281 } 1278 1282 1279 1283 if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt) 1280 1284 { … … 1300 1304 fodInfos->ofnInfos.nMaxFileTitle); 1301 1305 1302 /* Check if the file is to be opened as read only */ 1306 /* Check if the file is to be opened as read only */ 1303 1307 if(BST_CHECKED == SendDlgItemMessageA(hwnd, 1304 1308 IDC_OPENREADONLY, … … 1313 1317 fodInfos->ofnInfos.nFileExtension = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1; 1314 1318 1315 1319 1316 1320 /* clean and exit */ 1317 1321 FILEDLG95_Clean(hwnd); … … 1334 1338 1335 1339 /* 1336 * Initialisation of the FileOpenDialogInfos structure 1340 * Initialisation of the FileOpenDialogInfos structure 1337 1341 */ 1338 1342 … … 1354 1358 1355 1359 /* Construct the IShellBrowser interface */ 1356 fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd); 1357 1360 fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd); 1361 1358 1362 return NOERROR; 1359 1363 } … … 1413 1417 * FILEDLG95_SHELL_NewFolder 1414 1418 * 1415 * Creates a new directory with New folder as name 1419 * Creates a new directory with New folder as name 1416 1420 * If the function succeeds, the return value is nonzero. 1417 1421 * FIXME: let the contextmenu (CMDSTR_NEWFOLDER) do this thing … … 1461 1465 * FILEDLG95_FILETYPE_Init 1462 1466 * 1463 * Initialisation of the file type combo box 1467 * Initialisation of the file type combo box 1464 1468 */ 1465 1469 static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd) … … 1496 1500 if(!lpstrExt) 1497 1501 break; 1498 1502 1499 1503 strcpy(lpstrExt,lpstrExtTmp); 1500 1504 1501 1505 iStrIndex += strlen(lpstrExt) +1; 1502 1506 1503 1507 /* Add the item at the end of the combo */ 1504 1508 CBAddString(fodInfos->DlgInfos.hwndFileTypeCB,lpstrTmp); … … 1608 1612 1609 1613 } 1610 1614 1611 1615 /*********************************************************************** 1612 1616 * FILEDLG95_LOOKIN_Init 1613 1617 * 1614 * Initialisation of the look in combo box 1618 * Initialisation of the look in combo box 1615 1619 */ 1616 1620 static HRESULT FILEDLG95_LOOKIN_Init(HWND hwndCombo) … … 1712 1716 { 1713 1717 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1714 0, 1715 &sfi, 1716 sizeof (SHFILEINFOA), 1717 SHGFI_PIDL | SHGFI_SMALLICON | 1718 SHGFI_OPENICON | SHGFI_SYSICONINDEX | 1719 SHGFI_DISPLAYNAME ); 1718 0, 1719 &sfi, 1720 sizeof (SHFILEINFOA), 1721 SHGFI_PIDL | SHGFI_SMALLICON | 1722 SHGFI_OPENICON | SHGFI_SYSICONINDEX | 1723 SHGFI_DISPLAYNAME ); 1720 1724 } 1721 1725 else 1722 1726 { 1723 1727 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1724 0, 1725 &sfi, 1728 0, 1729 &sfi, 1726 1730 sizeof (SHFILEINFOA), 1727 SHGFI_PIDL | SHGFI_SMALLICON | 1728 SHGFI_SYSICONINDEX | 1731 SHGFI_PIDL | SHGFI_SMALLICON | 1732 SHGFI_SYSICONINDEX | 1729 1733 SHGFI_DISPLAYNAME); 1730 1734 } … … 1749 1753 iIndentation = 0; 1750 1754 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1751 0, 1752 &sfi, 1753 sizeof (SHFILEINFOA), 1754 SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON 1755 0, 1756 &sfi, 1757 sizeof (SHFILEINFOA), 1758 SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON 1755 1759 | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME ); 1756 1760 … … 1774 1778 rectText.bottom = pDIStruct->rcItem.bottom; 1775 1779 1776 1780 1777 1781 /* Draw the icon from the image list */ 1778 1782 COMDLG32_ImageList_Draw(ilItemImage, 1779 1783 sfi.iIcon, 1780 pDIStruct->hDC, 1781 rectIcon.left, 1782 rectIcon.top, 1783 ILD_TRANSPARENT ); 1784 pDIStruct->hDC, 1785 rectIcon.left, 1786 rectIcon.top, 1787 ILD_TRANSPARENT ); 1784 1788 1785 1789 /* Draw the associated text */ … … 1808 1812 { 1809 1813 LPSFOLDER tmpFolder; 1810 int iItem; 1814 int iItem; 1811 1815 1812 1816 iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB); … … 1825 1829 break; 1826 1830 } 1827 1831 1828 1832 } 1829 1833 return FALSE; … … 1847 1851 if(!(liInfos = (LookInInfos *)GetPropA(hwnd,LookInInfosStr))) 1848 1852 return -1; 1849 1853 1850 1854 tmpFolder->m_iIndent = 0; 1851 1855 … … 1864 1868 if(tmpFolder->m_iIndent > liInfos->iMaxIndentation) 1865 1869 liInfos->iMaxIndentation = tmpFolder->m_iIndent; 1866 1870 1867 1871 COMDLG32_SHGetFileInfoA((LPSTR)pidl, 1868 1872 0, 1869 1873 &sfi, 1870 1874 sizeof(sfi), 1871 SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX 1875 SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX 1872 1876 | SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ATTRIBUTES); 1873 1877 … … 1898 1902 * FILEDLG95_LOOKIN_InsertItemAfterParent 1899 1903 * 1900 * Insert an item below its parent 1904 * Insert an item below its parent 1901 1905 */ 1902 1906 static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd,LPITEMIDLIST pidl) 1903 1907 { 1904 1908 1905 1909 LPITEMIDLIST pidlParent = GetParentPidl(pidl); 1906 1910 int iParentPos; … … 1957 1961 } 1958 1962 } 1959 1963 1960 1964 CBSetCurSel(hwnd,iItemPos); 1961 1965 liInfos->uSelectedItem = iItemPos; … … 2051 2055 * GetName 2052 2056 * 2053 * Get the pidl's display name (relative to folder) and 2057 * Get the pidl's display name (relative to folder) and 2054 2058 * put it in lpstrFileName. 2055 * 2059 * 2056 2060 * Return NOERROR on success, 2057 2061 * E_FAIL otherwise … … 2076 2080 /* Get the display name of the pidl relative to the folder */ 2077 2081 if (SUCCEEDED(hRes = IShellFolder_GetDisplayNameOf(lpsf, 2078 pidl, 2079 dwFlags, 2082 pidl, 2083 dwFlags, 2080 2084 &str))) 2081 2085 { … … 2088 2092 * GetShellFolderFromPidl 2089 2093 * 2090 * pidlRel is the item pidl relative 2094 * pidlRel is the item pidl relative 2091 2095 * Return the IShellFolder of the absolute pidl 2092 2096 */ … … 2127 2131 pidlParent = COMDLG32_PIDL_ILClone(pidl); 2128 2132 COMDLG32_PIDL_ILRemoveLastID(pidlParent); 2129 2133 2130 2134 return pidlParent; 2131 2135 } … … 2134 2138 * GetPidlFromName 2135 2139 * 2136 * returns the pidl of the file name relative to folder 2140 * returns the pidl of the file name relative to folder 2137 2141 * NULL if an error occured 2138 2142 */ … … 2148 2152 if(!lpcstrFileName) 2149 2153 return NULL; 2150 2154 2151 2155 MultiByteToWideChar(CP_ACP, 2152 MB_PRECOMPOSED, 2153 lpcstrFileName, 2154 -1, 2155 (LPWSTR)lpwstrDirName, 2156 MAX_PATH); 2156 MB_PRECOMPOSED, 2157 lpcstrFileName, 2158 -1, 2159 (LPWSTR)lpwstrDirName, 2160 MAX_PATH); 2157 2161 2158 2162 IShellFolder_ParseDisplayName(psf, 0, … … 2161 2165 &ulEaten, 2162 2166 &pidl, 2163 NULL); 2167 NULL); 2164 2168 2165 2169 return pidl;
Note:
See TracChangeset
for help on using the changeset viewer.