Changeset 297
- Timestamp:
- Jun 27, 2006, 2:17:35 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/dll/mainwnd.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/mainwnd.c
r260 r297 19 19 06 Jun 05 SHL Rework MainWMCommand for VAC3.65 compat 20 20 13 Aug 05 SHL Renames and comments 21 08 Dec 05 SHL DriveProc: disable menu items if drive not ready 22 17 Dec 05 SHL DriveProc: correct my stupid 23 29 May 06 SHL IDM_EDITANYARCHIVER: sanitize code 21 24 22 25 ***********************************************************************/ … … 1926 1929 { 1927 1930 USHORT id; 1928 static CHAR dv[4]; 1931 CHAR szDrv[CCHMAXPATH]; 1932 1929 1933 static BOOL emphasized = FALSE; 1930 static HWND hwndMenu = (HWND) 0;1934 static HWND hwndMenu = NULLHANDLE; 1931 1935 static USHORT helpid = 0; 1932 1936 … … 1997 2001 hwndMenu = (HWND) 0; 1998 2002 id = WinQueryWindowUShort(hwnd, QWS_ID); 1999 * dv = 0;2003 *szDrv = 0; 2000 2004 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2001 2005 id + 50), 2002 sizeof( dv),2003 dv);2004 if (isalpha(* dv))2006 sizeof(szDrv), 2007 szDrv); 2008 if (isalpha(*szDrv)) 2005 2009 { 2006 2010 hwndMenu = WinLoadMenu(HWND_DESKTOP, … … 2009 2013 if (hwndMenu) 2010 2014 { 2011 if (!(driveflags[toupper(*dv) - 'A'] & DRIVE_REMOTE)) 2015 BOOL rdy; 2016 CHAR chDrv = *szDrv; 2017 UINT iDrv; 2018 strcpy(szDrv + 2, "\\"); 2019 MakeValidDir(szDrv); 2020 // Disable menus if MakeValidDir changes drive letter 2021 rdy = toupper(*szDrv) == toupper(chDrv); 2022 iDrv = toupper(*szDrv) - 'A'; 2023 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE) 2012 2024 WinEnableMenuItem(hwndMenu, 2013 2025 IDM_DETACH, 2014 2026 FALSE); 2015 if ( driveflags[toupper(*dv) - 'A'] & DRIVE_NOTWRITEABLE)2027 if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) 2016 2028 { 2017 WinEnableMenuItem(hwndMenu, 2018 IDM_MKDIR, 2019 FALSE); 2020 WinEnableMenuItem(hwndMenu, 2021 IDM_FORMAT, 2022 FALSE); 2023 WinEnableMenuItem(hwndMenu, 2024 IDM_OPTIMIZE, 2025 FALSE); 2026 WinEnableMenuItem(hwndMenu, 2027 IDM_UNDELETE, 2028 FALSE); 2029 } 2030 if (!(driveflags[toupper(*dv) - 'A'] & DRIVE_REMOVABLE)) 2029 WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE); 2030 WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE); 2031 WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE); 2032 WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE); 2033 } 2034 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) 2031 2035 { 2032 WinEnableMenuItem(hwndMenu, 2033 IDM_EJECT,2034 FALSE);2035 WinEnableMenuItem(hwndMenu,2036 IDM_LOCK,2037 FALSE);2038 WinEnableMenuItem(hwndMenu, 2039 IDM_UNLOCK,2040 FALSE);2041 }2042 /*2043 if(!(driveflags[toupper(*dv) - 'A'] & DRIVE_CDROM)) {2044 WinEnableMenuItem(hwndMenu,2045 IDM_CLOSETRAY,2046 FALSE);2047 }2048 */2036 WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE); 2037 WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE); 2038 WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE); 2039 } 2040 if (!rdy) 2041 { 2042 WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE); 2043 WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE); 2044 WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE); 2045 WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE); 2046 WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE); 2047 } 2048 /* fixme to be gone? 2049 if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) { 2050 WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE); 2051 } 2052 */ 2049 2053 PopupMenu(hwnd, 2050 2054 hwnd, … … 2062 2066 case WM_BUTTON3CLICK: 2063 2067 id = WinQueryWindowUShort(hwnd, QWS_ID); 2064 * dv = 0;2068 *szDrv = 0; 2065 2069 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2066 2070 id + 50), 2067 sizeof( dv),2068 dv);2069 if (isalpha(* dv))2070 { 2071 strcat( dv, "\\");2072 if (!FindDirCnrByName( dv, TRUE))2071 sizeof(szDrv), 2072 szDrv); 2073 if (isalpha(*szDrv)) 2074 { 2075 strcat(szDrv, "\\"); 2076 if (!FindDirCnrByName(szDrv, TRUE)) 2073 2077 OpenDirCnr((HWND) 0, 2074 2078 hwndMain, 2075 2079 hwndTree, 2076 2080 FALSE, 2077 dv);2081 szDrv); 2078 2082 } 2079 2083 break; … … 2085 2089 case UM_COMMAND: 2086 2090 id = WinQueryWindowUShort(hwnd, QWS_ID); 2087 * dv = 0;2091 *szDrv = 0; 2088 2092 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2089 2093 id + 50), 2090 sizeof( dv),2091 dv);2092 if (isalpha(* dv))2093 { 2094 strcat( dv, "\\");2095 CommonDriveCmd(hwnd, dv, SHORT1FROMMP(mp1));2094 sizeof(szDrv), 2095 szDrv); 2096 if (isalpha(*szDrv)) 2097 { 2098 strcat(szDrv, "\\"); 2099 CommonDriveCmd(hwnd, szDrv, SHORT1FROMMP(mp1)); 2096 2100 } 2097 2101 return 0; … … 2099 2103 case DM_DRAGOVER: 2100 2104 id = WinQueryWindowUShort(hwnd, QWS_ID); 2101 * dv = 0;2105 *szDrv = 0; 2102 2106 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2103 2107 id + 50), 2104 sizeof( dv),2105 dv);2106 if (isalpha(* dv) &&2107 !(driveflags[toupper(* dv) - 'A'] & DRIVE_NOTWRITEABLE))2108 sizeof(szDrv), 2109 szDrv); 2110 if (isalpha(*szDrv) && 2111 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) 2108 2112 { 2109 2113 if (!emphasized) … … 2121 2125 case DM_DRAGLEAVE: 2122 2126 id = WinQueryWindowUShort(hwnd, QWS_ID); 2123 * dv = 0;2127 *szDrv = 0; 2124 2128 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2125 2129 id + 50), 2126 sizeof( dv),2127 dv);2128 if (isalpha(* dv) &&2129 !(driveflags[toupper(* dv) - 'A'] & DRIVE_NOTWRITEABLE))2130 sizeof(szDrv), 2131 szDrv); 2132 if (isalpha(*szDrv) && 2133 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) 2130 2134 { 2131 2135 if (emphasized) … … 2139 2143 case DM_DROPHELP: 2140 2144 id = WinQueryWindowUShort(hwnd, QWS_ID); 2141 * dv = 0;2145 *szDrv = 0; 2142 2146 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2143 id + 50), sizeof( dv), dv);2144 if (isalpha(* dv) &&2145 !(driveflags[toupper(* dv) - 'A'] & DRIVE_NOTWRITEABLE))2147 id + 50), sizeof(szDrv), szDrv); 2148 if (isalpha(*szDrv) && 2149 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) 2146 2150 { 2147 2151 DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP)); … … 2152 2156 case DM_DROP: 2153 2157 id = WinQueryWindowUShort(hwnd, QWS_ID); 2154 * dv = 0;2158 *szDrv = 0; 2155 2159 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2156 2160 id + 50), 2157 sizeof( dv),2158 dv);2159 if (isalpha(* dv) &&2160 !(driveflags[toupper(* dv) - 'A'] & DRIVE_NOTWRITEABLE))2161 sizeof(szDrv), 2162 szDrv); 2163 if (isalpha(*szDrv) && 2164 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) 2161 2165 { 2162 2166 … … 2180 2184 if (li) 2181 2185 { 2182 strcpy(li -> targetpath, dv);2186 strcpy(li -> targetpath, szDrv); 2183 2187 strcat(li -> targetpath, "\\"); 2184 2188 if (li -> list && … … 5296 5300 5297 5301 case IDM_EDITANYARCHIVER: 5298 { 5299 DIRCNRDATA arc; 5300 5301 memset(&arc, 0, sizeof(DIRCNRDATA)); 5302 EditArchiverData(hwnd, &arc); 5303 } 5302 EditArchiverData(hwnd); 5304 5303 break; 5305 5304
Note:
See TracChangeset
for help on using the changeset viewer.
