diff options
Diffstat (limited to 'CPP/7zip/UI/FileManager')
56 files changed, 1236 insertions, 953 deletions
diff --git a/CPP/7zip/UI/FileManager/App.cpp b/CPP/7zip/UI/FileManager/App.cpp index f4f0bde7..21942065 100755 --- a/CPP/7zip/UI/FileManager/App.cpp +++ b/CPP/7zip/UI/FileManager/App.cpp @@ -157,12 +157,12 @@ static void CreateToolbar( struct CButtonInfo { - UINT commandID; + int CommandID; UINT BitmapResID; UINT Bitmap2ResID; UINT StringResID; - UINT32 LangID; - UString GetText()const { return LangString(StringResID, LangID); }; + UInt32 LangID; + UString GetText() const { return LangString(StringResID, LangID); }; }; static CButtonInfo g_StandardButtons[] = @@ -180,12 +180,12 @@ static CButtonInfo g_ArchiveButtons[] = { kTestCommand , IDB_TEST, IDB_TEST2, IDS_TEST, 0x03020402} }; -bool SetButtonText(UINT32 commandID, CButtonInfo *buttons, int numButtons, UString &s) +static bool SetButtonText(int commandID, CButtonInfo *buttons, int numButtons, UString &s) { for (int i = 0; i < numButtons; i++) { const CButtonInfo &b = buttons[i]; - if (b.commandID == commandID) + if (b.CommandID == commandID) { s = b.GetText(); return true; @@ -194,7 +194,7 @@ bool SetButtonText(UINT32 commandID, CButtonInfo *buttons, int numButtons, UStri return false; } -void SetButtonText(UINT32 commandID, UString &s) +static void SetButtonText(int commandID, UString &s) { if (SetButtonText(commandID, g_StandardButtons, sizeof(g_StandardButtons) / sizeof(g_StandardButtons[0]), s)) @@ -212,7 +212,7 @@ static void AddButton( { TBBUTTON but; but.iBitmap = 0; - but.idCommand = butInfo.commandID; + but.idCommand = butInfo.CommandID; but.fsState = TBSTATE_ENABLED; but.fsStyle = BTNS_BUTTON // | BTNS_AUTOSIZE @@ -428,20 +428,12 @@ void CApp::Release() Panels[i].Release(); } -static bool IsThereFolderOfPath(const UString &path) -{ - CFileInfoW fi; - if (!FindFile(path, fi)) - return false; - return fi.IsDir(); -} - // reduces path to part that exists on disk static void ReducePathToRealFileSystemPath(UString &path) { while (!path.IsEmpty()) { - if (IsThereFolderOfPath(path)) + if (NFind::DoesDirExist(path)) { NName::NormalizeDirPathPrefix(path); break; @@ -663,7 +655,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex) } if (indices.Size() > 1 || (destPath.Length() > 0 && destPath.ReverseFind(WCHAR_PATH_SEPARATOR) == destPath.Length() - 1) || - IsThereFolderOfPath(destPath)) + NFind::DoesDirExist(destPath)) { NDirectory::CreateComplexDirectory(destPath); NName::NormalizeDirPathPrefix(destPath); @@ -698,7 +690,15 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex) SaveCopyHistory(copyFolders); } - bool useSrcPanel = (!useDestPanel || !srcPanel.IsFSFolder() || destPanel.IsFSFolder()); + /* + if (destPath == destPanel._currentFolderPrefix) + { + if (destPanel.GetFolderTypeID() == L"PhysDrive") + useDestPanel = true; + } + */ + + bool useSrcPanel = (!useDestPanel || !srcPanel.IsFsOrDrivesFolder() || destPanel.IsFSFolder()); bool useTemp = useSrcPanel && useDestPanel; NFile::NDirectory::CTempDirectoryW tempDirectory; UString tempDirPrefix; @@ -857,7 +857,7 @@ void CApp::OnNotify(int /* ctrlID */, LPNMHDR pnmh) LPNMTTDISPINFO info = (LPNMTTDISPINFO)pnmh; info->hinst = 0; g_ToolTipBuffer.Empty(); - SetButtonText((UINT32)info->hdr.idFrom, g_ToolTipBuffer); + SetButtonText((int)info->hdr.idFrom, g_ToolTipBuffer); g_ToolTipBufferSys = GetSystemString(g_ToolTipBuffer); info->lpszText = (LPTSTR)(LPCTSTR)g_ToolTipBufferSys; return; @@ -868,7 +868,7 @@ void CApp::OnNotify(int /* ctrlID */, LPNMHDR pnmh) LPNMTTDISPINFOW info = (LPNMTTDISPINFOW)pnmh; info->hinst = 0; g_ToolTipBuffer.Empty(); - SetButtonText((UINT32)info->hdr.idFrom, g_ToolTipBuffer); + SetButtonText((int)info->hdr.idFrom, g_ToolTipBuffer); info->lpszText = (LPWSTR)(LPCWSTR)g_ToolTipBuffer; return; } @@ -893,4 +893,3 @@ void CApp::RefreshTitle(int panelIndex, bool always) return; RefreshTitle(always); } - diff --git a/CPP/7zip/UI/FileManager/App.h b/CPP/7zip/UI/FileManager/App.h index d30e1151..1fc77138 100755 --- a/CPP/7zip/UI/FileManager/App.h +++ b/CPP/7zip/UI/FileManager/App.h @@ -204,6 +204,7 @@ public: void Delete(bool toRecycleBin) { GetFocusedPanel().DeleteItems(toRecycleBin); } void CalculateCrc(); + void DiffFiles(); void Split(); void Combine(); void Properties() diff --git a/CPP/7zip/UI/FileManager/AppState.h b/CPP/7zip/UI/FileManager/AppState.h index 5ba0d47f..4f8b7bbe 100755 --- a/CPP/7zip/UI/FileManager/AppState.h +++ b/CPP/7zip/UI/FileManager/AppState.h @@ -1,10 +1,12 @@ // AppState.h -#ifndef __APPSTATE_H -#define __APPSTATE_H +#ifndef __APP_STATE_H +#define __APP_STATE_H #include "Windows/Synchronization.h" +#include "ViewSettings.h" + void inline AddUniqueStringToHead(UStringVector &list, const UString &string) { diff --git a/CPP/7zip/UI/FileManager/ExtractCallback.cpp b/CPP/7zip/UI/FileManager/ExtractCallback.cpp index b5e70d02..9902e9a1 100755 --- a/CPP/7zip/UI/FileManager/ExtractCallback.cpp +++ b/CPP/7zip/UI/FileManager/ExtractCallback.cpp @@ -2,27 +2,26 @@ #include "StdAfx.h" -#include "ExtractCallback.h" +#include "Common/Wildcard.h" +#include "Common/StringConvert.h" #include "Windows/Error.h" -#include "Windows/FileFind.h" #include "Windows/FileDir.h" +#include "Windows/FileFind.h" #include "Windows/ResourceString.h" -#include "OverwriteDialog.h" -#ifndef _NO_CRYPTO -#include "PasswordDialog.h" -#endif -#include "MessagesDialog.h" +#include "../../Common/FilePathAutoRename.h" + #include "../GUI/ExtractRes.h" #include "../GUI/resource.h" -#include "Common/Wildcard.h" -#include "Common/StringConvert.h" - +#include "ExtractCallback.h" #include "FormatUtils.h" - -#include "../../Common/FilePathAutoRename.h" +#include "MessagesDialog.h" +#include "OverwriteDialog.h" +#ifndef _NO_CRYPTO +#include "PasswordDialog.h" +#endif using namespace NWindows; using namespace NFile; @@ -351,6 +350,8 @@ HRESULT CExtractCallbackImp::ExtractResult(HRESULT result) return S_OK; } +#ifndef _NO_CRYPTO + HRESULT CExtractCallbackImp::SetPassword(const UString &password) { PasswordIsDefined = true; @@ -372,6 +373,7 @@ STDMETHODIMP CExtractCallbackImp::CryptoGetTextPassword(BSTR *password) return StringToBstr(Password, password); } +#endif // IExtractCallBack3 STDMETHODIMP CExtractCallbackImp::AskWrite( @@ -392,7 +394,7 @@ STDMETHODIMP CExtractCallbackImp::AskWrite( UString destPathSys = destPathSpec; bool srcIsFolderSpec = IntToBool(srcIsFolder); CFileInfoW destFileInfo; - if (FindFile(destPathSys, destFileInfo)) + if (destFileInfo.Find(destPathSys)) { if (srcIsFolderSpec) { @@ -474,4 +476,3 @@ STDMETHODIMP CExtractCallbackImp::AskWrite( *writeAnswer = BoolToInt(true); return StringToBstr(destPathResultTemp, destPathResult); } - diff --git a/CPP/7zip/UI/FileManager/FM.cpp b/CPP/7zip/UI/FileManager/FM.cpp index fc94bcbf..e4bcc998 100755 --- a/CPP/7zip/UI/FileManager/FM.cpp +++ b/CPP/7zip/UI/FileManager/FM.cpp @@ -2,40 +2,28 @@ #include "StdAfx.h" -#include "resource.h" -#include "Panel.h" - -extern "C" -{ - #include "../../../../C/Alloc.h" -} +#include "../../../../C/Alloc.h" -#include "Common/Defs.h" -#include "Common/StringConvert.h" -// #include "Common/CommandLineParser.h" - -#include "Windows/Control/Toolbar.h" #include "Windows/Error.h" -#include "Windows/COM.h" -#include "Windows/DLL.h" -#include "Windows/Security.h" #include "Windows/MemoryLock.h" +#include "Windows/Security.h" -#include "ViewSettings.h" #include "../GUI/ExtractRes.h" -#include "App.h" -#include "StringUtils.h" +#include "resource.h" -#include "MyLoadMenu.h" -#include "LangUtils.h" +#include "App.h" #include "FormatUtils.h" +#include "LangUtils.h" +#include "MyLoadMenu.h" +#include "Panel.h" #include "RegistryUtils.h" +#include "StringUtils.h" +#include "ViewSettings.h" using namespace NWindows; using namespace NFile; using namespace NFind; -// using namespace NCommandLineParser; #define MAX_LOADSTRING 100 @@ -617,10 +605,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) bool needOpenFile = false; if (!g_MainPath.IsEmpty() /* && g_OpenArchive */) { - NFile::NFind::CFileInfoW fileInfo; - if (NFile::NFind::FindFile(g_MainPath, fileInfo)) - if (!fileInfo.IsDir()) - needOpenFile = true; + if (NFile::NFind::DoesFileExist(g_MainPath)) + needOpenFile = true; } HRESULT res = g_App.Create(hWnd, g_MainPath, xSizes, archiveIsOpened, encrypted); diff --git a/CPP/7zip/UI/FileManager/FM.dsp b/CPP/7zip/UI/FileManager/FM.dsp index 6727b085..2c3ab6c8 100755 --- a/CPP/7zip/UI/FileManager/FM.dsp +++ b/CPP/7zip/UI/FileManager/FM.dsp @@ -45,7 +45,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /c +# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "NDEBUG" @@ -72,7 +72,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /GZ /c +# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "_DEBUG" @@ -99,7 +99,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"StdAfx.h" /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /c +# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "NDEBUG" @@ -127,7 +127,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c -# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /GZ /c +# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "_DEBUG" @@ -210,13 +210,21 @@ SOURCE=.\StdAfx.h SOURCE=.\Test.bmp # End Source File # End Group -# Begin Group "Archive Interfaces" +# Begin Group "Archive" # PROP Default_Filter "" # Begin Source File SOURCE=..\..\Archive\IArchive.h # End Source File +# Begin Source File + +SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Archive\Common\OutStreamWithCRC.h +# End Source File # End Group # Begin Group "Folders" @@ -255,14 +263,6 @@ SOURCE=.\NetFolder.h # End Source File # Begin Source File -SOURCE=.\PhysDriveFolder.cpp -# End Source File -# Begin Source File - -SOURCE=.\PhysDriveFolder.h -# End Source File -# Begin Source File - SOURCE=.\RootFolder.cpp # End Source File # Begin Source File @@ -831,14 +831,6 @@ SOURCE=..\..\..\Windows\Error.h # End Source File # Begin Source File -SOURCE=..\..\..\Windows\FileDevice.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileDevice.h -# End Source File -# Begin Source File - SOURCE=..\..\..\Windows\FileDir.cpp # End Source File # Begin Source File diff --git a/CPP/7zip/UI/FileManager/FSDrives.cpp b/CPP/7zip/UI/FileManager/FSDrives.cpp index f2d7ac93..87ee3fc9 100755 --- a/CPP/7zip/UI/FileManager/FSDrives.cpp +++ b/CPP/7zip/UI/FileManager/FSDrives.cpp @@ -2,48 +2,118 @@ #include "StdAfx.h" -#include "resource.h" - -#include "FSDrives.h" +#include "../../../../C/Alloc.h" -#include "Common/StringConvert.h" #include "Common/ComTry.h" -#include "../../PropID.h" +#include "Common/StringConvert.h" + #include "Windows/Defs.h" -#include "Windows/PropVariant.h" #include "Windows/FileDir.h" +#include "Windows/FileIO.h" #include "Windows/FileSystem.h" +#include "Windows/PropVariant.h" -#include "SysIconUtils.h" +#include "../../PropID.h" + +#include "FSDrives.h" #include "FSFolder.h" -#include "PhysDriveFolder.h" #include "LangUtils.h" +#include "SysIconUtils.h" + +#include "resource.h" using namespace NWindows; using namespace NFile; using namespace NFind; -static const STATPROPSTG kProperties[] = +static const wchar_t *kVolPrefix = L"\\\\.\\"; + +UString CDriveInfo::GetDeviceFileIoName() const +{ + return kVolPrefix + Name; +} + +struct CPhysTempBuffer +{ + void *buffer; + CPhysTempBuffer(): buffer(0) {} + ~CPhysTempBuffer() { MidFree(buffer); } +}; + +static HRESULT CopyFileSpec(LPCWSTR fromPath, LPCWSTR toPath, bool writeToDisk, UInt64 fileSize, + UInt32 bufferSize, UInt64 progressStart, IProgress *progress) +{ + NFile::NIO::CInFile inFile; + if (!inFile.Open(fromPath)) + return GetLastError(); + if (fileSize == (UInt64)(Int64)-1) + { + if (!inFile.GetLength(fileSize)) + ::GetLastError(); + } + NFile::NIO::COutFile outFile; + if (writeToDisk) + { + if (!outFile.Open(toPath, FILE_SHARE_WRITE, OPEN_EXISTING, 0)) + return GetLastError(); + } + else + if (!outFile.Create(toPath, true)) + return GetLastError(); + CPhysTempBuffer tempBuffer; + tempBuffer.buffer = MidAlloc(bufferSize); + if (tempBuffer.buffer == 0) + return E_OUTOFMEMORY; + + for (UInt64 pos = 0; pos < fileSize;) + { + UInt64 progressCur = progressStart + pos; + RINOK(progress->SetCompleted(&progressCur)); + UInt64 rem = fileSize - pos; + UInt32 curSize = (UInt32)MyMin(rem, (UInt64)bufferSize); + UInt32 processedSize; + if (!inFile.Read(tempBuffer.buffer, curSize, processedSize)) + return GetLastError(); + if (processedSize == 0) + break; + curSize = processedSize; + if (writeToDisk) + { + const UInt32 kMask = 0x1FF; + curSize = (curSize + kMask) & ~kMask; + if (curSize > bufferSize) + return E_FAIL; + } + + if (!outFile.Write(tempBuffer.buffer, curSize, processedSize)) + return GetLastError(); + if (curSize != processedSize) + return E_FAIL; + pos += curSize; + } + return S_OK; +} + +static const STATPROPSTG kProps[] = { { NULL, kpidName, VT_BSTR}, - // { NULL, kpidIsDir, VT_BOOL}, - { L"Total Size", kpidTotalSize, VT_UI8}, - { L"Free Space", kpidFreeSpace, VT_UI8}, + { NULL, kpidTotalSize, VT_UI8}, + { NULL, kpidFreeSpace, VT_UI8}, { NULL, kpidType, VT_BSTR}, - { L"Label", kpidVolumeName, VT_BSTR}, - { L"File system", kpidFileSystem, VT_BSTR}, - { L"Cluster Size", kpidClusterSize, VT_UI8} + { NULL, kpidVolumeName, VT_BSTR}, + { NULL, kpidFileSystem, VT_BSTR}, + { NULL, kpidClusterSize, VT_UI8} }; -static const wchar_t *kDriveTypes[] = +static const char *kDriveTypes[] = { - L"Unknown", - L"No Root Dir", - L"Removable", - L"Fixed", - L"Remote", - L"CD-ROM", - L"RAM disk" + "Unknown", + "No Root Dir", + "Removable", + "Fixed", + "Remote", + "CD-ROM", + "RAM disk" }; STDMETHODIMP CFSDrives::LoadItems() @@ -60,18 +130,13 @@ STDMETHODIMP CFSDrives::LoadItems() di.FullSystemName = driveName; - di.Name = di.FullSystemName.Left( - di.FullSystemName.Length() - 1); + di.Name = di.FullSystemName.Left(di.FullSystemName.Length() - 1); di.ClusterSize = 0; di.DriveSize = 0; di.FreeSpace = 0; - UINT driveType = NFile::NSystem::MyGetDriveType(driveName); - if (driveType < sizeof(kDriveTypes) / sizeof(kDriveTypes[0])) - { - di.Type = kDriveTypes[driveType]; - } + di.DriveType = NFile::NSystem::MyGetDriveType(driveName); bool needRead = true; - if (driveType == DRIVE_CDROM || driveType == DRIVE_REMOVABLE) + if (di.DriveType == DRIVE_CDROM || di.DriveType == DRIVE_REMOVABLE) { /* DWORD dwSerialNumber;` @@ -117,12 +182,15 @@ STDMETHODIMP CFSDrives::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT const CDriveInfo &di = _drives[itemIndex]; switch(propID) { - case kpidIsDir: prop = true; break; + case kpidIsDir: prop = !_volumeMode; break; case kpidName: prop = di.Name; break; case kpidTotalSize: if (di.KnownSizes) prop = di.DriveSize; break; case kpidFreeSpace: if (di.KnownSizes) prop = di.FreeSpace; break; case kpidClusterSize: if (di.KnownSizes) prop = di.ClusterSize; break; - case kpidType: prop = di.Type; break; + case kpidType: + if (di.DriveType < sizeof(kDriveTypes) / sizeof(kDriveTypes[0])) + prop = kDriveTypes[di.DriveType]; + break; case kpidVolumeName: prop = di.VolumeName; break; case kpidFileSystem: prop = di.FileSystemName; break; } @@ -133,6 +201,8 @@ STDMETHODIMP CFSDrives::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT HRESULT CFSDrives::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder) { *resultFolder = 0; + if (_volumeMode) + return S_OK; NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder; CMyComPtr<IFolderFolder> subFolder = fsFolderSpec; RINOK(fsFolderSpec->Init(name, 0)); @@ -146,6 +216,7 @@ STDMETHODIMP CFSDrives::BindToFolder(UInt32 index, IFolderFolder **resultFolder) if (index >= (UInt32)_drives.Size()) return E_INVALIDARG; const CDriveInfo &di = _drives[index]; + /* if (_volumeMode) { *resultFolder = 0; @@ -155,6 +226,7 @@ STDMETHODIMP CFSDrives::BindToFolder(UInt32 index, IFolderFolder **resultFolder) *resultFolder = subFolder.Detach(); return S_OK; } + */ return BindToFolderSpec(di.FullSystemName, resultFolder); } @@ -169,24 +241,7 @@ STDMETHODIMP CFSDrives::BindToParentFolder(IFolderFolder **resultFolder) return S_OK; } -STDMETHODIMP CFSDrives::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CFSDrives::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if (index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &prop = kProperties[index]; - *propID = prop.propid; - *varType = prop.vt; - *name = 0; - return S_OK; -} - +IMP_IFolderFolder_Props(CFSDrives) STDMETHODIMP CFSDrives::GetFolderProperty(PROPID propID, PROPVARIANT *value) { @@ -195,14 +250,20 @@ STDMETHODIMP CFSDrives::GetFolderProperty(PROPID propID, PROPVARIANT *value) switch(propID) { case kpidType: prop = L"FSDrives"; break; - case kpidPath: prop = LangString(IDS_COMPUTER, 0x03020300) + UString(WCHAR_PATH_SEPARATOR); break; + case kpidPath: + if (_volumeMode) + prop = kVolPrefix; + else + prop = LangString(IDS_COMPUTER, 0x03020300) + UString(WCHAR_PATH_SEPARATOR); + break; } prop.Detach(value); return S_OK; COM_TRY_END } -STDMETHODIMP CFSDrives::GetSystemIconIndex(UInt32 index, INT32 *iconIndex) + +STDMETHODIMP CFSDrives::GetSystemIconIndex(UInt32 index, Int32 *iconIndex) { *iconIndex = 0; const CDriveInfo &di = _drives[index]; @@ -215,3 +276,145 @@ STDMETHODIMP CFSDrives::GetSystemIconIndex(UInt32 index, INT32 *iconIndex) return GetLastError(); } +UString CFSDrives::GetExt(int index) const +{ + const CDriveInfo &di = _drives[index]; + const wchar_t *ext = NULL; + if (di.DriveType == DRIVE_CDROM) + ext = L"iso"; + else if (di.FileSystemName.Find(L"NTFS") >= 0) + ext = L"ntfs"; + else if (di.FileSystemName.Find(L"FAT") >= 0) + ext = L"fat"; + else + ext = L"img"; + return (UString)L'.' + ext; +} + +HRESULT CFSDrives::GetLength(int index, UInt64 &length) const +{ + NFile::NIO::CInFile inFile; + if (!inFile.Open(_drives[index].GetDeviceFileIoName())) + return GetLastError(); + if (!inFile.LengthDefined) + return E_FAIL; + length = inFile.Length; + return S_OK; +} + +STDMETHODIMP CFSDrives::CopyTo(const UInt32 *indices, UInt32 numItems, + const wchar_t *path, IFolderOperationsExtractCallback *callback) +{ + if (numItems == 0) + return S_OK; + + if (!_volumeMode) + return E_NOTIMPL; + + UInt64 totalSize = 0; + UInt32 i; + for (i = 0; i < numItems; i++) + { + const CDriveInfo &di = _drives[indices[i]]; + if (di.KnownSizes) + totalSize += di.DriveSize; + } + RINOK(callback->SetTotal(totalSize)); + RINOK(callback->SetNumFiles(numItems)); + + UString destPath = path; + if (destPath.IsEmpty()) + return E_INVALIDARG; + bool directName = (destPath[destPath.Length() - 1] != WCHAR_PATH_SEPARATOR); + if (directName) + { + if (numItems > 1) + return E_INVALIDARG; + } + + UInt64 completedSize = 0; + RINOK(callback->SetCompleted(&completedSize)); + for (i = 0; i < numItems; i++) + { + int index = indices[i]; + const CDriveInfo &di = _drives[index]; + UString destPath2 = destPath; + UString name = di.Name; + if (!directName) + { + UString destName = name; + if (!destName.IsEmpty() && destName[destName.Length() - 1] == L':') + { + destName.Delete(destName.Length() - 1); + destName += GetExt(index); + } + destPath2 += destName; + } + UString srcPath = di.GetDeviceFileIoName(); + + UInt64 fileSize = 0; + if (GetLength(index, fileSize) != S_OK) + { + return E_FAIL; + } + if (!di.KnownSizes) + totalSize += fileSize; + RINOK(callback->SetTotal(totalSize)); + + Int32 writeAskResult; + CMyComBSTR destPathResult; + RINOK(callback->AskWrite(srcPath, BoolToInt(false), NULL, &fileSize, + destPath2, &destPathResult, &writeAskResult)); + if (!IntToBool(writeAskResult)) + continue; + + RINOK(callback->SetCurrentFilePath(srcPath)); + + static const UInt32 kBufferSize = (4 << 20); + UInt32 bufferSize = (di.DriveType == DRIVE_REMOVABLE) ? (18 << 10) * 4 : kBufferSize; + RINOK(CopyFileSpec(srcPath, destPathResult, false, fileSize, bufferSize, completedSize, callback)); + completedSize += fileSize; + } + return S_OK; +} + +STDMETHODIMP CFSDrives::MoveTo( + const UInt32 * /* indices */, + UInt32 /* numItems */, + const wchar_t * /* path */, + IFolderOperationsExtractCallback * /* callback */) +{ + return E_NOTIMPL; +} + +STDMETHODIMP CFSDrives::CopyFrom(const wchar_t * /* fromFolderPath */, + const wchar_t ** /* itemsPaths */, UInt32 /* numItems */, IProgress * /* progress */) +{ + return E_NOTIMPL; +} + +STDMETHODIMP CFSDrives::CreateFolder(const wchar_t * /* name */, IProgress * /* progress */) +{ + return E_NOTIMPL; +} + +STDMETHODIMP CFSDrives::CreateFile(const wchar_t * /* name */, IProgress * /* progress */) +{ + return E_NOTIMPL; +} + +STDMETHODIMP CFSDrives::Rename(UInt32 /* index */, const wchar_t * /* newName */, IProgress * /* progress */) +{ + return E_NOTIMPL; +} + +STDMETHODIMP CFSDrives::Delete(const UInt32 * /* indices */, UInt32 /* numItems */, IProgress * /* progress */) +{ + return E_NOTIMPL; +} + +STDMETHODIMP CFSDrives::SetProperty(UInt32 /* index */, PROPID /* propID */, + const PROPVARIANT * /* value */, IProgress * /* progress */) +{ + return E_NOTIMPL; +} diff --git a/CPP/7zip/UI/FileManager/FSDrives.h b/CPP/7zip/UI/FileManager/FSDrives.h index 84db5b7e..fc99bce7 100755 --- a/CPP/7zip/UI/FileManager/FSDrives.h +++ b/CPP/7zip/UI/FileManager/FSDrives.h @@ -1,13 +1,10 @@ // FSDrives.h -#ifndef __FSDRIVES_H -#define __FSDRIVES_H +#ifndef __FS_DRIVES_H +#define __FS_DRIVES_H -#include "Common/MyString.h" -#include "Common/Types.h" #include "Common/MyCom.h" -#include "Windows/FileFind.h" -#include "Windows/PropVariant.h" +#include "Common/MyString.h" #include "IFolder.h" @@ -19,31 +16,38 @@ struct CDriveInfo UInt64 DriveSize; UInt64 FreeSpace; UInt64 ClusterSize; - UString Type; + // UString Type; UString VolumeName; UString FileSystemName; + UINT DriveType; + + UString GetDeviceFileIoName() const; }; class CFSDrives: public IFolderFolder, + public IFolderOperations, public IFolderGetSystemIconIndex, public CMyUnknownImp { + CObjectVector<CDriveInfo> _drives; + bool _volumeMode; + + HRESULT BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder); + UString GetExt(int index) const; + HRESULT GetLength(int index, UInt64 &length) const; public: - MY_UNKNOWN_IMP1( - IFolderGetSystemIconIndex - ) + MY_UNKNOWN_IMP2(IFolderGetSystemIconIndex, IFolderOperations) INTERFACE_FolderFolder(;) + INTERFACE_FolderOperations(;) - STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex); + STDMETHOD(GetSystemIconIndex)(UInt32 index, Int32 *iconIndex); -private: - HRESULT BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder); - CObjectVector<CDriveInfo> _drives; - bool _volumeMode; -public: - void Init() { _volumeMode = false;} + void Init(bool volMode = false) + { + _volumeMode = volMode; + } }; #endif diff --git a/CPP/7zip/UI/FileManager/FSFolder.cpp b/CPP/7zip/UI/FileManager/FSFolder.cpp index 604c9b9c..5951fc09 100755 --- a/CPP/7zip/UI/FileManager/FSFolder.cpp +++ b/CPP/7zip/UI/FileManager/FSFolder.cpp @@ -2,22 +2,20 @@ #include "StdAfx.h" -#include "FSFolder.h" - +#include "Common/ComTry.h" #include "Common/StringConvert.h" #include "Common/UTFConvert.h" -#include "Common/ComTry.h" -#include "Windows/Defs.h" -#include "Windows/PropVariant.h" #include "Windows/FileDir.h" #include "Windows/FileIO.h" +#include "Windows/PropVariant.h" #include "../../PropID.h" -#include "SysIconUtils.h" #include "FSDrives.h" +#include "FSFolder.h" #include "NetFolder.h" +#include "SysIconUtils.h" namespace NWindows { namespace NFile { @@ -32,10 +30,9 @@ using namespace NFind; namespace NFsFolder { -static STATPROPSTG kProperties[] = +static STATPROPSTG kProps[] = { { NULL, kpidName, VT_BSTR}, - // { NULL, kpidIsDir, VT_BOOL}, { NULL, kpidSize, VT_UI8}, { NULL, kpidMTime, VT_FILETIME}, { NULL, kpidCTime, VT_FILETIME}, @@ -152,7 +149,7 @@ void CFSFolder::AddRefs(CDirItem &dirItem) STDMETHODIMP CFSFolder::LoadItems() { // OutputDebugString(TEXT("Start\n")); - INT32 dummy; + Int32 dummy; WasChanged(&dummy); Clear(); RINOK(LoadSubItems(_root, _path)); @@ -394,24 +391,13 @@ STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder) STDMETHODIMP CFSFolder::GetNumberOfProperties(UInt32 *numProperties) { - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); + *numProperties = sizeof(kProps) / sizeof(kProps[0]); if (!_flatMode) (*numProperties)--; return S_OK; } -STDMETHODIMP CFSFolder::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if (index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &prop = kProperties[index]; - *propID = prop.propid; - *varType = prop.vt; - *name = 0; - return S_OK; -} - +STDMETHODIMP CFSFolder::GetPropertyInfo IMP_IFolderFolder_GetProp(kProps) STDMETHODIMP CFSFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) { @@ -427,7 +413,7 @@ STDMETHODIMP CFSFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) COM_TRY_END } -STDMETHODIMP CFSFolder::WasChanged(INT32 *wasChanged) +STDMETHODIMP CFSFolder::WasChanged(Int32 *wasChanged) { bool wasChangedMain = false; for (;;) @@ -640,7 +626,7 @@ STDMETHODIMP CFSFolder::SetProperty(UInt32 index, PROPID propID, return S_OK; } -STDMETHODIMP CFSFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex) +STDMETHODIMP CFSFolder::GetSystemIconIndex(UInt32 index, Int32 *iconIndex) { if (index >= (UInt32)_refs.Size()) return E_INVALIDARG; diff --git a/CPP/7zip/UI/FileManager/FSFolder.h b/CPP/7zip/UI/FileManager/FSFolder.h index ca229055..95f40bb3 100755 --- a/CPP/7zip/UI/FileManager/FSFolder.h +++ b/CPP/7zip/UI/FileManager/FSFolder.h @@ -5,11 +5,10 @@ #include "Common/MyString.h" #include "Common/MyCom.h" + #include "Windows/FileFind.h" -#include "Windows/PropVariant.h" #include "IFolder.h" - #include "TextPairs.h" namespace NFsFolder { @@ -65,13 +64,13 @@ public: INTERFACE_FolderFolder(;) INTERFACE_FolderOperations(;) - STDMETHOD(WasChanged)(INT32 *wasChanged); + STDMETHOD(WasChanged)(Int32 *wasChanged); STDMETHOD(Clone)(IFolderFolder **resultFolder); STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress); STDMETHOD(SetFlatMode)(Int32 flatMode); - STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex); + STDMETHOD(GetSystemIconIndex)(UInt32 index, Int32 *iconIndex); private: UString _path; diff --git a/CPP/7zip/UI/FileManager/FSFolderCopy.cpp b/CPP/7zip/UI/FileManager/FSFolderCopy.cpp index b2d057df..9711616c 100755 --- a/CPP/7zip/UI/FileManager/FSFolderCopy.cpp +++ b/CPP/7zip/UI/FileManager/FSFolderCopy.cpp @@ -4,14 +4,15 @@ #include <Winbase.h> -#include "FSFolder.h" +#include "Common/StringConvert.h" + #include "Windows/FileDir.h" #include "Windows/Error.h" -#include "Common/StringConvert.h" - #include "../../Common/FilePathAutoRename.h" +#include "FSFolder.h" + using namespace NWindows; using namespace NFile; using namespace NFind; @@ -189,7 +190,7 @@ static HRESULT MyCopyFile( return E_ABORT; } - INT32 writeAskResult; + Int32 writeAskResult; CMyComBSTR destPathResult; RINOK(callback->AskWrite( srcPath, @@ -340,7 +341,7 @@ HRESULT MyMoveFile( return E_ABORT; } - INT32 writeAskResult; + Int32 writeAskResult; CMyComBSTR destPathResult; RINOK(callback->AskWrite( srcPath, @@ -510,5 +511,5 @@ STDMETHODIMP CFSFolder::CopyFrom(const wchar_t * /* fromFolderPath */, */ return E_NOTIMPL; } - + } diff --git a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp index 3cd79da0..992fbd8c 100755 --- a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp +++ b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp @@ -4,21 +4,15 @@ #include "resource.h" -#include "Common/StringConvert.h" -#include "Windows/Defs.h" -#include "Windows/FileDir.h" -#include "Windows/FileName.h" -#include "Windows/DLL.h" #include "Windows/Thread.h" -#include "IFolder.h" -#include "RegistryAssociations.h" -#include "RegistryPlugins.h" +#include "../Agent/Agent.h" +#include "LangUtils.h" #include "OpenCallback.h" #include "PluginLoader.h" -#include "LangUtils.h" -#include "../Agent/Agent.h" +#include "RegistryAssociations.h" +#include "RegistryPlugins.h" using namespace NWindows; using namespace NRegistryAssociations; @@ -26,6 +20,7 @@ using namespace NRegistryAssociations; struct CThreadArchiveOpen { UString Path; + CMyComPtr<IInStream> InStream; CMyComPtr<IFolderManager> FolderManager; CMyComPtr<IProgress> OpenCallback; COpenArchiveCallback *OpenCallbackSpec; @@ -36,7 +31,7 @@ struct CThreadArchiveOpen void Process() { OpenCallbackSpec->ProgressDialog.WaitCreating(); - Result = FolderManager->OpenFolderFile(Path, &Folder, OpenCallback); + Result = FolderManager->OpenFolderFile(InStream, Path, &Folder, OpenCallback); OpenCallbackSpec->ProgressDialog.MyClose(); } @@ -57,6 +52,7 @@ static int FindPlugin(const CObjectVector<CPluginInfo> &plugins, } HRESULT OpenFileFolderPlugin( + IInStream *inStream, const UString &path, HMODULE *module, IFolderFolder **resultFolder, @@ -66,13 +62,7 @@ HRESULT OpenFileFolderPlugin( CObjectVector<CPluginInfo> plugins; ReadFileFolderPluginInfoList(plugins); - UString extension; - UString name, pureName, dot; - - if(!NFile::NDirectory::GetOnlyName(path, name)) - return E_FAIL; - NFile::NName::SplitNameToPureNameAndExtension(name, pureName, dot, extension); - + UString extension, name, pureName, dot; int slashPos = path.ReverseFind(WCHAR_PATH_SEPARATOR); UString dirPrefix; @@ -85,6 +75,8 @@ HRESULT OpenFileFolderPlugin( else fileName = path; + NFile::NName::SplitNameToPureNameAndExtension(fileName, pureName, dot, extension); + if (!extension.IsEmpty()) { CExtInfo extInfo; @@ -122,8 +114,13 @@ HRESULT OpenFileFolderPlugin( t.OpenCallbackSpec->PasswordIsDefined = encrypted; t.OpenCallbackSpec->Password = password; t.OpenCallbackSpec->ParentWindow = parentWindow; - t.OpenCallbackSpec->LoadFileInfo(dirPrefix, fileName); + if (inStream) + t.OpenCallbackSpec->SetSubArchiveName(fileName); + else + t.OpenCallbackSpec->LoadFileInfo(dirPrefix, fileName); + + t.InStream = inStream; t.Path = path; UString progressTitle = LangString(IDS_OPENNING, 0x03020283); diff --git a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h index 9e5c66c7..692417ba 100755 --- a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h +++ b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h @@ -1,9 +1,9 @@ // FileFolderPluginOpen.h -#ifndef __FILEFOLDERPLUGINOPEN_H -#define __FILEFOLDERPLUGINOPEN_H +#ifndef __FILE_FOLDER_PLUGIN_OPEN_H +#define __FILE_FOLDER_PLUGIN_OPEN_H -HRESULT OpenFileFolderPlugin(const UString &path, +HRESULT OpenFileFolderPlugin(IInStream *inStream, const UString &path, HMODULE *module, IFolderFolder **resultFolder, HWND parentWindow, bool &encrypted, UString &password); #endif diff --git a/CPP/7zip/UI/FileManager/IFolder.h b/CPP/7zip/UI/FileManager/IFolder.h index 6709cd1e..b301f513 100755 --- a/CPP/7zip/UI/FileManager/IFolder.h +++ b/CPP/7zip/UI/FileManager/IFolder.h @@ -4,6 +4,7 @@ #define __IFOLDER_H #include "../../IProgress.h" +#include "../../IStream.h" #define FOLDER_INTERFACE_SUB(i, b, x) DECL_INTERFACE_SUB(i, b, 8, x) #define FOLDER_INTERFACE(i, x) FOLDER_INTERFACE_SUB(i, IUnknown, x) @@ -106,7 +107,7 @@ FOLDER_INTERFACE(IFolderSetFlatMode, 0x0A) STDMETHOD(GetNumberOfFolderProperties)(UInt32 *numProperties) x; \ STDMETHOD(GetFolderPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x; \ -FOLDER_INTERFACE(IFolderProperties, 0x0B) +FOLDER_INTERFACE(IFolderProperties, 0x0E) { INTERFACE_FolderProperties(PURE) }; @@ -129,17 +130,28 @@ FOLDER_INTERFACE(IGetFolderArchiveProperties, 0x0D) #define FOLDER_MANAGER_INTERFACE(i, x) DECL_INTERFACE(i, 9, x) #define INTERFACE_IFolderManager(x) \ - STDMETHOD(OpenFolderFile)(const wchar_t *filePath, IFolderFolder **resultFolder, IProgress *progress) x; \ + STDMETHOD(OpenFolderFile)(IInStream *inStream, const wchar_t *filePath, IFolderFolder **resultFolder, IProgress *progress) x; \ STDMETHOD(GetExtensions)(BSTR *extensions) x; \ STDMETHOD(GetIconPath)(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex) x; \ // STDMETHOD(GetTypes)(BSTR *types) PURE; // STDMETHOD(CreateFolderFile)(const wchar_t *type, const wchar_t *filePath, IProgress *progress) PURE; -FOLDER_MANAGER_INTERFACE(IFolderManager, 0x03) +FOLDER_MANAGER_INTERFACE(IFolderManager, 0x04) { INTERFACE_IFolderManager(PURE); }; +#define IMP_IFolderFolder_GetProp(k) \ + (UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) \ + { if(index >= sizeof(k) / sizeof(k[0])) return E_INVALIDARG; \ + const STATPROPSTG &srcItem = k[index]; \ + *propID = srcItem.propid; *varType = srcItem.vt; *name = 0; return S_OK; } \ + +#define IMP_IFolderFolder_Props(c) \ + STDMETHODIMP c::GetNumberOfProperties(UInt32 *numProperties) \ + { *numProperties = sizeof(kProps) / sizeof(kProps[0]); return S_OK; } \ + STDMETHODIMP c::GetPropertyInfo IMP_IFolderFolder_GetProp(kProps) + #endif diff --git a/CPP/7zip/UI/FileManager/LangPage.rc b/CPP/7zip/UI/FileManager/LangPage.rc index 0e06406c..bd4d83d8 100755 --- a/CPP/7zip/UI/FileManager/LangPage.rc +++ b/CPP/7zip/UI/FileManager/LangPage.rc @@ -1,8 +1,8 @@ #include "LangPageRes.h" #include "../../GuiCommon.rc" -#define xSize2 238 -#define ySize2 204 +#define xSize2 196 +#define ySize2 140 #define xSize (xSize2 + marg + marg) #define ySize (ySize2 + marg + marg) diff --git a/CPP/7zip/UI/FileManager/LangUtils.cpp b/CPP/7zip/UI/FileManager/LangUtils.cpp index 0591c73c..52f85348 100755 --- a/CPP/7zip/UI/FileManager/LangUtils.cpp +++ b/CPP/7zip/UI/FileManager/LangUtils.cpp @@ -104,7 +104,8 @@ void LoadLangs(CObjectVector<CLangEx> &langs) CLangEx lang; UString filePath = folderPath + fileInfo.Name; const int kExtSize = 4; - if (fileInfo.Name.Right(kExtSize) != L".txt") + const UString ext = fileInfo.Name.Right(kExtSize); + if (ext.CompareNoCase(L".txt") != 0) continue; lang.ShortName = fileInfo.Name.Left(fileInfo.Name.Length() - kExtSize); if (lang.Lang.Open(filePath)) diff --git a/CPP/7zip/UI/FileManager/ListViewDialog.cpp b/CPP/7zip/UI/FileManager/ListViewDialog.cpp index 7a78fcde..e8001cf6 100755 --- a/CPP/7zip/UI/FileManager/ListViewDialog.cpp +++ b/CPP/7zip/UI/FileManager/ListViewDialog.cpp @@ -43,6 +43,9 @@ bool CListViewDialog::OnNotify(UINT /* controlID */, LPNMHDR header) return false; switch(header->code) { + case NM_DBLCLK: + OnOK(); + return true; case LVN_KEYDOWN: { LPNMLVKEYDOWN keyDownInfo = LPNMLVKEYDOWN(header); diff --git a/CPP/7zip/UI/FileManager/MyLoadMenu.cpp b/CPP/7zip/UI/FileManager/MyLoadMenu.cpp index c6f57f9e..f98325a0 100755 --- a/CPP/7zip/UI/FileManager/MyLoadMenu.cpp +++ b/CPP/7zip/UI/FileManager/MyLoadMenu.cpp @@ -1,23 +1,20 @@ -// MyLoadMenu +// MyLoadMenu.cpp #include "StdAfx.h" -#include "Common/StringConvert.h" - #include "Windows/Menu.h" -#include "Windows/Error.h" -#include "Windows/Clipboard.h" #include "../../PropID.h" -#include "resource.h" -#include "App.h" -#include "AboutDialog.h" #include "../Common/CompressCall.h" +#include "AboutDialog.h" +#include "App.h" #include "HelpUtils.h" #include "LangUtils.h" -#include "PluginInterface.h" +#include "RegistryUtils.h" + +#include "resource.h" static const UINT kOpenBookmarkMenuID = 730; static const UINT kSetBookmarkMenuID = 740; @@ -428,6 +425,9 @@ void LoadFileMenu(HMENU hMenu, int startPos, bool programMenu, CMenu destMenu; destMenu.Attach(hMenu); + + UString diffPath; + ReadRegDiff(diffPath); for (int i = 0; i < g_FileMenu.GetItemCount(); i++) { @@ -440,6 +440,10 @@ void LoadFileMenu(HMENU hMenu, int startPos, bool programMenu, if (!programMenu) if (item.wID == IDCLOSE) continue; + + if (item.wID == IDM_FILE_DIFF && diffPath.IsEmpty()) + continue; + bool isOneFsFile = (isFsFolder && numItems == 1 && allAreFiles); if ((item.wID == IDM_FILE_SPLIT || item.wID == IDM_FILE_COMBINE) && !isOneFsFile) item.fState |= MFS_DISABLED; @@ -522,6 +526,9 @@ bool ExecuteFileCommand(int id) case IDM_FILE_CRC: g_App.CalculateCrc(); break; + case IDM_FILE_DIFF: + g_App.DiffFiles(); + break; case IDM_FILE_SPLIT: g_App.Split(); break; diff --git a/CPP/7zip/UI/FileManager/NetFolder.cpp b/CPP/7zip/UI/FileManager/NetFolder.cpp index d3298c62..e1fa1965 100755 --- a/CPP/7zip/UI/FileManager/NetFolder.cpp +++ b/CPP/7zip/UI/FileManager/NetFolder.cpp @@ -2,21 +2,18 @@ #include "StdAfx.h" -#include "NetFolder.h" +#include "Windows/PropVariant.h" -#include "Common/StringConvert.h" #include "../../PropID.h" -#include "Windows/Defs.h" -#include "Windows/PropVariant.h" -#include "Windows/FileFind.h" -#include "SysIconUtils.h" #include "FSFolder.h" +#include "NetFolder.h" +#include "SysIconUtils.h" using namespace NWindows; using namespace NNet; -static const STATPROPSTG kProperties[] = +static const STATPROPSTG kProps[] = { { NULL, kpidName, VT_BSTR}, { NULL, kpidLocalName, VT_BSTR}, @@ -232,23 +229,7 @@ STDMETHODIMP CNetFolder::BindToParentFolder(IFolderFolder **resultFolder) return S_OK; } -STDMETHODIMP CNetFolder::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CNetFolder::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if (index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &prop = kProperties[index]; - *propID = prop.propid; - *varType = prop.vt; - *name = 0; - return S_OK; -} +IMP_IFolderFolder_Props(CNetFolder) STDMETHODIMP CNetFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) { @@ -262,7 +243,7 @@ STDMETHODIMP CNetFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) return S_OK; } -STDMETHODIMP CNetFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex) +STDMETHODIMP CNetFolder::GetSystemIconIndex(UInt32 index, Int32 *iconIndex) { if (index >= (UInt32)_items.Size()) return E_INVALIDARG; diff --git a/CPP/7zip/UI/FileManager/NetFolder.h b/CPP/7zip/UI/FileManager/NetFolder.h index 92471ec6..9962845c 100755 --- a/CPP/7zip/UI/FileManager/NetFolder.h +++ b/CPP/7zip/UI/FileManager/NetFolder.h @@ -1,12 +1,10 @@ // NetFolder.h -#ifndef __NETFOLDER_H -#define __NETFOLDER_H +#ifndef __NET_FOLDER_H +#define __NET_FOLDER_H -#include "Common/MyString.h" -#include "Common/Buffer.h" #include "Common/MyCom.h" -#include "Windows/PropVariant.h" + #include "Windows/Net.h" #include "IFolder.h" @@ -21,16 +19,6 @@ class CNetFolder: public IFolderGetSystemIconIndex, public CMyUnknownImp { -public: - MY_UNKNOWN_IMP1( - IFolderGetSystemIconIndex - ) - - INTERFACE_FolderFolder(;) - - STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex); - -private: NWindows::NNet::CResourceW _netResource; NWindows::NNet::CResourceW *_netResourcePointer; @@ -38,12 +26,15 @@ private: CMyComPtr<IFolderFolder> _parentFolder; UString _path; - public: + MY_UNKNOWN_IMP1(IFolderGetSystemIconIndex) + INTERFACE_FolderFolder(;) + STDMETHOD(GetSystemIconIndex)(UInt32 index, Int32 *iconIndex); + + CNetFolder(): _netResourcePointer(0) {} void Init(const UString &path); void Init(const NWindows::NNet::CResourceW *netResource, IFolderFolder *parentFolder, const UString &path); - CNetFolder(): _netResourcePointer(0) {} }; #endif diff --git a/CPP/7zip/UI/FileManager/OpenCallback.cpp b/CPP/7zip/UI/FileManager/OpenCallback.cpp index 9c71a291..a275f89b 100755 --- a/CPP/7zip/UI/FileManager/OpenCallback.cpp +++ b/CPP/7zip/UI/FileManager/OpenCallback.cpp @@ -2,50 +2,48 @@ #include "StdAfx.h" -#include "OpenCallback.h" - #include "Common/StringConvert.h" + #include "Windows/PropVariant.h" #include "../../Common/FileStreams.h" +#include "OpenCallback.h" #include "PasswordDialog.h" +using namespace NWindows; + STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 *numFiles, const UInt64 *numBytes) { + RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause()); { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - _numFilesTotalDefined = (numFiles != NULL); - _numBytesTotalDefined = (numBytes != NULL); - if (_numFilesTotalDefined) + NSynchronization::CCriticalSectionLock lock(_criticalSection); + if (numFiles != NULL) { ProgressDialog.ProgressSynch.SetNumFilesTotal(*numFiles); - ProgressDialog.ProgressSynch.SetProgress(*numFiles, 0); + ProgressDialog.ProgressSynch.SetBytesProgressMode(false); } - else if (_numBytesTotalDefined) - ProgressDialog.ProgressSynch.SetProgress(*numBytes, 0); + if (numBytes != NULL) + ProgressDialog.ProgressSynch.SetNumBytesTotal(*numBytes); } return S_OK; } STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *numFiles, const UInt64 *numBytes) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause()); + NSynchronization::CCriticalSectionLock lock(_criticalSection); if (numFiles != NULL) - { ProgressDialog.ProgressSynch.SetNumFilesCur(*numFiles); - if (_numFilesTotalDefined) - ProgressDialog.ProgressSynch.SetPos(*numFiles); - } - if (numBytes != NULL && _numBytesTotalDefined) + if (numBytes != NULL) ProgressDialog.ProgressSynch.SetPos(*numBytes); return S_OK; } STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 total) { - ProgressDialog.ProgressSynch.SetProgress(total, 0); + RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause()); + ProgressDialog.ProgressSynch.SetNumBytesTotal(total); return S_OK; } @@ -59,7 +57,7 @@ STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *completed) STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value) { - NWindows::NCOM::CPropVariant prop; + NCOM::CPropVariant prop; if (_subArchiveMode) { switch(propID) @@ -91,10 +89,10 @@ STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name, if (_subArchiveMode) return S_FALSE; - NWindows::NFile::NFind::CFileInfoW fileInfo; + NFile::NFind::CFileInfoW fileInfo; UString fullPath = _folderPrefix + name; - if (!NWindows::NFile::NFind::FindFile(fullPath, fileInfo)) + if (!fileInfo.Find(fullPath)) return S_FALSE; _fileInfo = fileInfo; if (_fileInfo.IsDir()) diff --git a/CPP/7zip/UI/FileManager/OpenCallback.h b/CPP/7zip/UI/FileManager/OpenCallback.h index 168f171b..5f0fbefc 100755 --- a/CPP/7zip/UI/FileManager/OpenCallback.h +++ b/CPP/7zip/UI/FileManager/OpenCallback.h @@ -3,15 +3,15 @@ #ifndef __OPENCALLBACK_H #define __OPENCALLBACK_H -#include "Common/MyString.h" #include "Common/MyCom.h" +#include "Common/MyString.h" + #include "Windows/FileFind.h" #include "../../IPassword.h" #include "../../Archive/IArchive.h" - #ifdef _SFX #include "ProgressDialog.h" #else @@ -29,21 +29,15 @@ class COpenArchiveCallback: { UString _folderPrefix; NWindows::NFile::NFind::CFileInfoW _fileInfo; - - bool _numFilesTotalDefined; - bool _numBytesTotalDefined; NWindows::NSynchronization::CCriticalSection _criticalSection; + bool _subArchiveMode; + UString _subArchiveName; public: bool PasswordIsDefined; - UString Password; bool PasswordWasAsked; + UString Password; HWND ParentWindow; - - bool _subArchiveMode; - UString _subArchiveName; - -public: CProgressDialog ProgressDialog; MY_UNKNOWN_IMP5( @@ -70,9 +64,6 @@ public: COpenArchiveCallback(): ParentWindow(0) { - _numFilesTotalDefined = false; - _numBytesTotalDefined = false; - _subArchiveMode = false; PasswordIsDefined = false; PasswordWasAsked = false; @@ -87,7 +78,7 @@ public: void LoadFileInfo(const UString &folderPrefix, const UString &fileName) { _folderPrefix = folderPrefix; - if (!NWindows::NFile::NFind::FindFile(_folderPrefix + fileName, _fileInfo)) + if (!_fileInfo.Find(_folderPrefix + fileName)) throw 1; } void ShowMessage(const UInt64 *completed); @@ -96,7 +87,6 @@ public: { return ProgressDialog.Create(title, ParentWindow); } - }; #endif diff --git a/CPP/7zip/UI/FileManager/Panel.cpp b/CPP/7zip/UI/FileManager/Panel.cpp index 40192c5f..9255b117 100755 --- a/CPP/7zip/UI/FileManager/Panel.cpp +++ b/CPP/7zip/UI/FileManager/Panel.cpp @@ -5,28 +5,30 @@ #include <Windowsx.h> #include "Common/Defs.h" -#include "Common/StringConvert.h" #include "Common/IntToString.h" +#include "Common/StringConvert.h" + #include "Windows/Error.h" #include "Windows/PropVariant.h" #include "Windows/Thread.h" #include "../../PropID.h" -#include "Panel.h" -#include "RootFolder.h" -#include "FSFolder.h" -#include "FormatUtils.h" -#include "App.h" -#include "ExtractCallback.h" - #include "resource.h" -#include "..\GUI\ExtractRes.h" +#include "../GUI/ExtractRes.h" + +#include "../Common/ArchiveName.h" +#include "../Common/CompressCall.h" #include "../Agent/IFolderArchive.h" -#include "../Common/CompressCall.h" -#include "../Common/ArchiveName.h" +#include "App.h" +#include "ExtractCallback.h" +#include "FSFolder.h" +#include "FormatUtils.h" +#include "Panel.h" +#include "RootFolder.h" + using namespace NWindows; using namespace NControl; @@ -707,7 +709,7 @@ bool CPanel::IsFSDrivesFolder() const UString CPanel::GetFsPath() const { - if (IsFSDrivesFolder()) + if (IsFSDrivesFolder() && !IsDeviceDrivesPrefix()) return UString(); return _currentFolderPrefix; } @@ -773,7 +775,7 @@ void CPanel::AddToArchive() { CRecordVector<UInt32> indices; GetOperatedItemIndices(indices); - if (!IsFSFolder()) + if (!IsFsOrDrivesFolder()) { MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208); return; @@ -784,14 +786,25 @@ void CPanel::AddToArchive() return; } UStringVector names; + + UString curPrefix = _currentFolderPrefix; + UString destCurDirPrefix = _currentFolderPrefix; + if (IsFSDrivesFolder()) + { + destCurDirPrefix = L"C:\\"; + if (!IsDeviceDrivesPrefix()) + curPrefix.Empty(); + } + for (int i = 0; i < indices.Size(); i++) { int index = indices[i]; - names.Add(_currentFolderPrefix + GetItemRelPath(index)); + names.Add(curPrefix + GetItemRelPath(index)); } const UString archiveName = CreateArchiveName( names.Front(), (names.Size() > 1), false); - HRESULT res = CompressFiles(_currentFolderPrefix, archiveName, L"", names, false, true, false); + + HRESULT res = CompressFiles(destCurDirPrefix, archiveName, L"", names, false, true, false); if (res != S_OK) { if (_currentFolderPrefix.Length() >= MAX_PATH) @@ -823,7 +836,7 @@ void CPanel::GetFilePaths(const CRecordVector<UInt32> &indices, UStringVector &p paths.Clear(); break; } - paths.Add(_currentFolderPrefix + GetItemRelPath(index)); + paths.Add(GetItemFullPath(index)); } if (paths.Size() == 0) { diff --git a/CPP/7zip/UI/FileManager/Panel.h b/CPP/7zip/UI/FileManager/Panel.h index 4ba36a71..ed157634 100755 --- a/CPP/7zip/UI/FileManager/Panel.h +++ b/CPP/7zip/UI/FileManager/Panel.h @@ -6,25 +6,24 @@ #include "Common/MyCom.h" #include "Windows/DLL.h" -#include "Windows/FileFind.h" #include "Windows/FileDir.h" -#include "Windows/Synchronization.h" +#include "Windows/FileFind.h" #include "Windows/Handle.h" +#include "Windows/Synchronization.h" -#include "Windows/Control/ToolBar.h" -#include "Windows/Control/ReBar.h" +#include "Windows/Control/ComboBox.h" +#include "Windows/Control/Edit.h" #include "Windows/Control/ListView.h" +#include "Windows/Control/ReBar.h" #include "Windows/Control/Static.h" -#include "Windows/Control/Edit.h" -#include "Windows/Control/ComboBox.h" -#include "Windows/Control/Window2.h" #include "Windows/Control/StatusBar.h" +#include "Windows/Control/ToolBar.h" +#include "Windows/Control/Window2.h" -#include "SysIconUtils.h" -#include "IFolder.h" -#include "ViewSettings.h" #include "AppState.h" +#include "IFolder.h" #include "MyCom2.h" +#include "SysIconUtils.h" const int kParentFolderID = 100; const int kPluginMenuStartID = 1000; @@ -81,10 +80,21 @@ struct CTempFileInfo UString FolderPath; UString FilePath; NWindows::NFile::NFind::CFileInfoW FileInfo; - void DeleteDirAndFile() + bool NeedDelete; + + CTempFileInfo(): NeedDelete(false) {} + void DeleteDirAndFile() const { - NWindows::NFile::NDirectory::DeleteFileAlways(FilePath); - NWindows::NFile::NDirectory::MyRemoveDirectory(FolderPath); + if (NeedDelete) + { + NWindows::NFile::NDirectory::DeleteFileAlways(FilePath); + NWindows::NFile::NDirectory::MyRemoveDirectory(FolderPath); + } + } + bool WasChanged(const NWindows::NFile::NFind::CFileInfoW &newFileInfo) const + { + return newFileInfo.Size != FileInfo.Size || + CompareFileTime(&newFileInfo.MTime, &FileInfo.MTime) != 0; } }; @@ -94,9 +104,16 @@ struct CFolderLink: public CTempFileInfo CMyComPtr<IFolderFolder> ParentFolder; bool UsePassword; UString Password; + bool IsVirtual; UString VirtualPath; - CFolderLink(): UsePassword(false) {} + CFolderLink(): UsePassword(false), IsVirtual(false) {} + + bool WasChanged(const NWindows::NFile::NFind::CFileInfoW &newFileInfo) const + { + return IsVirtual || CTempFileInfo::WasChanged(newFileInfo); + } + }; enum MyMessages @@ -294,6 +311,7 @@ public: UString GetItemName(int itemIndex) const; UString GetItemPrefix(int itemIndex) const; UString GetItemRelPath(int itemIndex) const; + UString GetItemFullPath(int itemIndex) const; bool IsItemFolder(int itemIndex) const; UInt64 GetItemSize(int itemIndex) const; @@ -419,6 +437,9 @@ public: bool IsRootFolder() const; bool IsFSFolder() const; bool IsFSDrivesFolder() const; + bool IsFsOrDrivesFolder() const { return IsFSFolder() || IsFSDrivesFolder(); } + bool IsDeviceDrivesPrefix() const { return _currentFolderPrefix == L"\\\\.\\"; } + bool IsFsOrPureDrivesFolder() const { return IsFSFolder() || (IsFSDrivesFolder() && !IsDeviceDrivesPrefix()); } UString GetFsPath() const; UString GetDriveOrNetworkPrefix() const; @@ -482,12 +503,11 @@ public: void OpenFolder(int index); HRESULT OpenParentArchiveFolder(); - HRESULT OpenItemAsArchive(const UString &name, - const UString &folderPath, - const UString &filePath, + HRESULT OpenItemAsArchive(IInStream *inStream, + const CTempFileInfo &tempFileInfo, const UString &virtualFilePath, bool &encrypted); - HRESULT OpenItemAsArchive(const UString &name); + HRESULT OpenItemAsArchive(const UString &name, bool &encrypted); HRESULT OpenItemAsArchive(int index); void OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bool editMode); diff --git a/CPP/7zip/UI/FileManager/PanelCrc.cpp b/CPP/7zip/UI/FileManager/PanelCrc.cpp index 61a84050..aaa645cf 100755 --- a/CPP/7zip/UI/FileManager/PanelCrc.cpp +++ b/CPP/7zip/UI/FileManager/PanelCrc.cpp @@ -2,15 +2,11 @@ #include "StdAfx.h" -extern "C" -{ - #include "../../../../C/Alloc.h" - #include "../../../../C/7zCrc.h" - #include "../../../../C/Sha256.h" -} +#include "../../../../C/7zCrc.h" +#include "../../../../C/Alloc.h" +#include "../../../../C/Sha256.h" #include "Common/IntToString.h" -#include "Common/StringConvert.h" #include "Windows/Error.h" #include "Windows/FileFind.h" @@ -25,6 +21,8 @@ extern "C" #include "FormatUtils.h" #include "LangUtils.h" +#include "../Common/PropIDUtils.h" + #include "resource.h" using namespace NWindows; @@ -69,7 +67,18 @@ bool CDirEnumerator::GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UStr resPath.Empty(); if (pos >= 0) resPath = path.Left(pos + 1); - if (!NFind::FindFile(BasePrefix + path, fileInfo)) + + #ifdef _WIN32 + // it's for "c:" paths/ + if (BasePrefix.IsEmpty() && path.Length() == 2 && path[1] == ':') + { + fileInfo.Name = path; + fileInfo.Attrib = FILE_ATTRIBUTE_DIRECTORY; + fileInfo.Size = 0; + } + else + #endif + if (!fileInfo.Find(BasePrefix + path)) { errorCode = ::GetLastError(); resPath = path; @@ -285,21 +294,11 @@ static void ConvertByteToHex(unsigned value, wchar_t *s) } } -static void ConvertUInt32ToHex(UInt32 value, wchar_t *s) -{ - for (int i = 6; i >= 0; i -= 2) - { - ConvertByteToHex(value & 0xFF, s + i); - value >>= 8; - } - s[8] = L'\0'; -} - void CApp::CalculateCrc() { int srcPanelIndex = GetFocusedPanelIndex(); CPanel &srcPanel = Panels[srcPanelIndex]; - if (!srcPanel.IsFSFolder()) + if (!srcPanel.IsFsOrDrivesFolder()) { srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208); return; @@ -312,7 +311,7 @@ void CApp::CalculateCrc() CThreadCrc combiner; for (int i = 0; i < indices.Size(); i++) combiner.DirEnumerator.FileNames.Add(srcPanel.GetItemRelPath(indices[i])); - combiner.DirEnumerator.BasePrefix = srcPanel._currentFolderPrefix; + combiner.DirEnumerator.BasePrefix = srcPanel.GetFsPath(); combiner.DirEnumerator.FlatMode = GetFlatMode(); { diff --git a/CPP/7zip/UI/FileManager/PanelDrag.cpp b/CPP/7zip/UI/FileManager/PanelDrag.cpp index 6cae36fe..6d1c9a29 100755 --- a/CPP/7zip/UI/FileManager/PanelDrag.cpp +++ b/CPP/7zip/UI/FileManager/PanelDrag.cpp @@ -459,7 +459,7 @@ void CDropTarget::PositionCursor(POINTL ptl) return; */ - if (!m_Panel->IsFSFolder() && !m_Panel->IsFSDrivesFolder()) + if (!m_Panel->IsFsOrPureDrivesFolder()) return; if (WindowFromPoint(pt) != (HWND)m_Panel->_listView) diff --git a/CPP/7zip/UI/FileManager/PanelFolderChange.cpp b/CPP/7zip/UI/FileManager/PanelFolderChange.cpp index 01fec329..e6336f31 100755 --- a/CPP/7zip/UI/FileManager/PanelFolderChange.cpp +++ b/CPP/7zip/UI/FileManager/PanelFolderChange.cpp @@ -4,16 +4,18 @@ #include "Common/StringConvert.h" #include "Common/Wildcard.h" -#include "Windows/FileDir.h" + +#include "Windows/PropVariant.h" #include "../../PropID.h" -#include "Panel.h" +#include "FSDrives.h" +#include "LangUtils.h" #include "ListViewDialog.h" +#include "Panel.h" #include "RootFolder.h" #include "ViewSettings.h" -#include "FSDrives.h" -#include "LangUtils.h" + #include "resource.h" using namespace NWindows; @@ -71,7 +73,7 @@ HRESULT CPanel::BindToPath(const UString &fullPath, bool &archiveIsOpened, bool UStringVector reducedParts; while (!sysPath.IsEmpty()) { - if (FindFile(sysPath, fileInfo)) + if (fileInfo.Find(sysPath)) break; int pos = sysPath.ReverseFind(WCHAR_PATH_SEPARATOR); if (pos < 0) @@ -108,11 +110,7 @@ HRESULT CPanel::BindToPath(const UString &fullPath, bool &archiveIsOpened, bool UString fileName; if (NDirectory::GetOnlyName(sysPath, fileName)) { - HRESULT res = - OpenItemAsArchive(fileName, _currentFolderPrefix, - _currentFolderPrefix + fileName, - _currentFolderPrefix + fileName, - encrypted); + HRESULT res = OpenItemAsArchive(fileName, encrypted); if (res != S_FALSE) { RINOK(res); @@ -210,7 +208,7 @@ void CPanel::LoadFullPathAndShow() CFileInfoW info; DWORD attrib = FILE_ATTRIBUTE_DIRECTORY; - if (NFile::NFind::FindFile(path, info)) + if (info.Find(path)) attrib = info.Attrib; item.iImage = GetRealIconIndex(path, attrib); @@ -343,7 +341,7 @@ bool CPanel::OnComboBoxCommand(UINT code, LPARAM /* param */, LRESULT &result) curName += WCHAR_PATH_SEPARATOR; CFileInfoW info; DWORD attrib = FILE_ATTRIBUTE_DIRECTORY; - if (NFile::NFind::FindFile(sumPass, info)) + if (info.Find(sumPass)) attrib = info.Attrib; sumPass += WCHAR_PATH_SEPARATOR; AddComboBoxItem(name, GetRealIconIndex(curName, attrib), i, false); @@ -498,7 +496,7 @@ void CPanel::OpenParentFolder() _folder = link.ParentFolder; _library.Attach(link.Library.Detach()); focucedName = link.ItemName; - if (_parentFolders.Size () > 1) + if (_parentFolders.Size() > 1) OpenParentArchiveFolder(); _parentFolders.DeleteBack(); if (_parentFolders.IsEmpty()) @@ -526,7 +524,7 @@ void CPanel::CloseOpenFolders() _library.Free(); _folder = _parentFolders.Back().ParentFolder; _library.Attach(_parentFolders.Back().Library.Detach()); - if (_parentFolders.Size () > 1) + if (_parentFolders.Size() > 1) OpenParentArchiveFolder(); _parentFolders.DeleteBack(); } diff --git a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp index c40b0d18..2aab2aae 100755 --- a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp +++ b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp @@ -2,27 +2,29 @@ #include "StdAfx.h" -#include "resource.h" - -#include "Common/StringConvert.h" -#include "Common/Random.h" -#include "Common/StringConvert.h" #include "Common/AutoPtr.h" +#include "Common/StringConvert.h" +#include "Windows/Error.h" #include "Windows/FileDir.h" #include "Windows/FileFind.h" -#include "Windows/Thread.h" #include "Windows/Synchronization.h" -#include "Windows/Error.h" +#include "Windows/Thread.h" #include "ExtractCallback.h" -#include "UpdateCallback100.h" -#include "IFolder.h" #include "FileFolderPluginOpen.h" #include "FormatUtils.h" +#include "IFolder.h" +#include "LangUtils.h" #include "Panel.h" #include "RegistryUtils.h" -#include "LangUtils.h" +#include "UpdateCallback100.h" + +#include "App.h" + +#include "../Common/ExtractingFilePath.h" + +#include "resource.h" using namespace NWindows; using namespace NSynchronization; @@ -66,20 +68,25 @@ public: } }; -HRESULT CPanel::OpenItemAsArchive(const UString &name, - const UString &folderPath, const UString &filePath, +HRESULT CPanel::OpenItemAsArchive(IInStream *inStream, + const CTempFileInfo &tempFileInfo, const UString &virtualFilePath, bool &encrypted) { encrypted = false; CFolderLink folderLink; - if (!NFile::NFind::FindFile(filePath, folderLink.FileInfo)) - return E_FAIL; - if (folderLink.FileInfo.IsDir()) - return S_FALSE; + (CTempFileInfo &)folderLink = tempFileInfo; + if (inStream) + folderLink.IsVirtual = true; + else + { + if (!folderLink.FileInfo.Find(folderLink.FilePath)) + return ::GetLastError(); + if (folderLink.FileInfo.IsDir()) + return S_FALSE; + folderLink.IsVirtual = false; + } - folderLink.FilePath = filePath; - folderLink.FolderPath = folderPath; folderLink.VirtualPath = virtualFilePath; CMyComPtr<IFolderFolder> newFolder; @@ -90,13 +97,14 @@ HRESULT CPanel::OpenItemAsArchive(const UString &name, NDLL::CLibrary library; UString password; - RINOK(OpenFileFolderPlugin(filePath, &library, &newFolder, GetParent(), encrypted, password)); + RINOK(OpenFileFolderPlugin(inStream, + folderLink.FilePath.IsEmpty() ? virtualFilePath : folderLink.FilePath, + &library, &newFolder, GetParent(), encrypted, password)); folderLink.Password = password; folderLink.UsePassword = encrypted; folderLink.ParentFolder = _folder; - folderLink.ItemName = name; _parentFolders.Add(folderLink); _parentFolders.Back().Library.Attach(_library.Detach()); @@ -110,19 +118,20 @@ HRESULT CPanel::OpenItemAsArchive(const UString &name, return S_OK; } -HRESULT CPanel::OpenItemAsArchive(const UString &name) +HRESULT CPanel::OpenItemAsArchive(const UString &name, bool &encrypted) { - bool encrypted; - return OpenItemAsArchive(name, _currentFolderPrefix, - _currentFolderPrefix + name, - _currentFolderPrefix + name, - encrypted); + CTempFileInfo tfi; + tfi.ItemName = name; + tfi.FolderPath = _currentFolderPrefix; + tfi.FilePath = _currentFolderPrefix + name; + return OpenItemAsArchive(NULL, tfi, _currentFolderPrefix + name, encrypted); } HRESULT CPanel::OpenItemAsArchive(int index) { CDisableTimerProcessing disableTimerProcessing1(*this); - RINOK(OpenItemAsArchive(GetItemRelPath(index))); + bool encrypted; + RINOK(OpenItemAsArchive(GetItemRelPath(index), encrypted)); RefreshListCtrl(); return S_OK; } @@ -132,12 +141,11 @@ HRESULT CPanel::OpenParentArchiveFolder() CDisableTimerProcessing disableTimerProcessing1(*this); if (_parentFolders.Size() < 2) return S_OK; - CFolderLink &folderLink = _parentFolders.Back(); + const CFolderLink &folderLink = _parentFolders.Back(); NFind::CFileInfoW newFileInfo; - if (NFind::FindFile(folderLink.FilePath, newFileInfo)) + if (newFileInfo.Find(folderLink.FilePath)) { - if (newFileInfo.Size != folderLink.FileInfo.Size || - CompareFileTime(&newFileInfo.MTime, &folderLink.FileInfo.MTime) != 0) + if (folderLink.WasChanged(newFileInfo)) { UString message = MyFormatNew(IDS_WANT_UPDATE_MODIFIED_FILE, 0x03020280, folderLink.ItemName); @@ -166,7 +174,7 @@ static const wchar_t *kStartExtensions[] = L"docx", L"docm", L"dotx", L"dotm", L"xlsx", L"xlsm", L"xltx", L"xltm", L"xlsb", L"xlam", L"pptx", L"pptm", L"potx", L"potm", L"ppam", L"ppsx", L"ppsm", L"xsn", - L"dwf", + L"dwf", L"odt", L"ods", L"wb3", @@ -186,22 +194,8 @@ static bool DoItemAlwaysStart(const UString &name) return false; } -static HANDLE StartEditApplication(const UString &path, HWND window) +static HRESULT MyCreateProcess(const UString &command, HANDLE *hProcess) { - UString command; - ReadRegEditor(command); - if (command.IsEmpty()) - { - if (!MyGetWindowsDirectory(command)) - return 0; - NFile::NName::NormalizeDirPathPrefix(command); - command += L"notepad.exe"; - } - command = UString(L"\"") + command + UString(L"\""); - command += L" \""; - command += UString(path); - command += L"\""; - PROCESS_INFORMATION processInformation; BOOL result; #ifndef _UNICODE @@ -235,16 +229,96 @@ static HANDLE StartEditApplication(const UString &path, HWND window) NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInformation); } - if (result != FALSE) + if (result == 0) + return ::GetLastError(); + + ::CloseHandle(processInformation.hThread); + *hProcess = processInformation.hProcess; + return S_OK; +} + +static HRESULT MyCreateProcess(const UString &command) +{ + HANDLE hProcess; + HRESULT res = MyCreateProcess(command, &hProcess); + if (res == SZ_OK) + ::CloseHandle(hProcess); + return res; +} + +static HANDLE StartEditApplication(const UString &path, HWND window) +{ + UString command; + ReadRegEditor(command); + if (command.IsEmpty()) { - ::CloseHandle(processInformation.hThread); - return processInformation.hProcess; + if (!MyGetWindowsDirectory(command)) + return 0; + NFile::NName::NormalizeDirPathPrefix(command); + command += L"notepad.exe"; } + command = UString(L"\"") + command + UString(L"\""); + command += L" \""; + command += path; + command += L"\""; + + HANDLE hProcess; + HRESULT res = MyCreateProcess(command, &hProcess); + if (res == SZ_OK) + return hProcess; ::MessageBoxW(window, LangString(IDS_CANNOT_START_EDITOR, 0x03020282), L"7-Zip", MB_OK | MB_ICONSTOP); return 0; } +void CApp::DiffFiles() +{ + const CPanel &panel = GetFocusedPanel(); + + CRecordVector<UInt32> indices; + panel.GetSelectedItemsIndices(indices); + + UString path1, path2; + if (indices.Size() == 2) + { + path1 = panel.GetItemFullPath(indices[0]); + path2 = panel.GetItemFullPath(indices[1]); + } + else if (indices.Size() == 1 && NumPanels >= 2) + { + const CPanel &destPanel = Panels[1 - LastFocusedPanel]; + path1 = panel.GetItemFullPath(indices[0]); + const UString relPath = panel.GetItemRelPath(indices[0]); + CRecordVector<UInt32> indices2; + destPanel.GetSelectedItemsIndices(indices2); + if (indices2.Size() == 1) + path2 = destPanel.GetItemFullPath(indices2[0]); + else + path2 = destPanel._currentFolderPrefix + relPath; + } + else + return; + + UString command; + ReadRegDiff(command); + if (command.IsEmpty()) + return; + + command = UString(L"\"") + command + UString(L"\""); + command += L" \""; + command += path1; + command += L"\""; + + command += L" \""; + command += path2; + command += L"\""; + + HRESULT res = MyCreateProcess(command); + if (res == SZ_OK) + return; + ::MessageBoxW(_window, LangString(IDS_CANNOT_START_EDITOR, 0x03020282), L"7-Zip", MB_OK | MB_ICONSTOP); +} + #ifndef _UNICODE typedef BOOL (WINAPI * ShellExecuteExWP)(LPSHELLEXECUTEINFOW lpExecInfo); #endif @@ -314,14 +388,16 @@ void CPanel::EditItem(int index) OpenItemInArchive(index, false, true, true); return; } - HANDLE hProcess = StartEditApplication(_currentFolderPrefix + GetItemRelPath(index), (HWND)*this); + HANDLE hProcess = StartEditApplication(GetItemFullPath(index), (HWND)*this); if (hProcess != 0) ::CloseHandle(hProcess); } void CPanel::OpenFolderExternal(int index) { - HANDLE hProcess = StartApplication(GetFsPath(), GetFsPath() + GetItemRelPath(index), (HWND)*this); + UString fsPrefix = GetFsPath(); + HANDLE hProcess = StartApplication(fsPrefix, + fsPrefix + GetItemRelPath(index) + WCHAR_PATH_SEPARATOR, (HWND)*this); if (hProcess != 0) ::CloseHandle(hProcess); } @@ -428,7 +504,7 @@ public: static THREAD_FUNC_DECL MyThreadFunction(void *param) { CMyAutoPtr<CTmpProcessInfo> tmpProcessInfoPtr((CTmpProcessInfo *)param); - CTmpProcessInfo *tmpProcessInfo = tmpProcessInfoPtr.get(); + const CTmpProcessInfo *tmpProcessInfo = tmpProcessInfoPtr.get(); HANDLE hProcess = tmpProcessInfo->ProcessHandle; HANDLE events[2] = { g_ExitEventLauncher._exitEvent, hProcess}; @@ -440,10 +516,9 @@ static THREAD_FUNC_DECL MyThreadFunction(void *param) return 1; Sleep(200); NFind::CFileInfoW newFileInfo; - if (NFind::FindFile(tmpProcessInfo->FilePath, newFileInfo)) + if (newFileInfo.Find(tmpProcessInfo->FilePath)) { - if (newFileInfo.Size != tmpProcessInfo->FileInfo.Size || - CompareFileTime(&newFileInfo.MTime, &tmpProcessInfo->FileInfo.MTime) != 0) + if (tmpProcessInfo->WasChanged(newFileInfo)) { UString message = MyFormatNew(IDS_WANT_UPDATE_MODIFIED_FILE, 0x03020280, tmpProcessInfo->ItemName); @@ -478,12 +553,51 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo return; } + bool tryAsArchive = tryInternal && (!tryExternal || !DoItemAlwaysStart(name)); + + UString fullVirtPath = _currentFolderPrefix + name; + NFile::NDirectory::CTempDirectoryW tempDirectory; tempDirectory.Create(kTempDirPrefix); UString tempDir = tempDirectory.GetPath(); UString tempDirNorm = tempDir; NFile::NName::NormalizeDirPathPrefix(tempDirNorm); + UString tempFilePath = tempDirNorm + GetCorrectFsPath(name); + + CTempFileInfo tempFileInfo; + tempFileInfo.ItemName = name; + tempFileInfo.FolderPath = tempDir; + tempFileInfo.FilePath = tempFilePath; + tempFileInfo.NeedDelete = true; + + if (tryAsArchive) + { + CMyComPtr<IInArchiveGetStream> getStream; + _folder.QueryInterface(IID_IInArchiveGetStream, &getStream); + if (getStream) + { + CMyComPtr<ISequentialInStream> subSeqStream; + getStream->GetStream(index, &subSeqStream); + if (subSeqStream) + { + CMyComPtr<IInStream> subStream; + subSeqStream.QueryInterface(IID_IInStream, &subStream); + if (subStream) + { + bool encrypted; + if (OpenItemAsArchive(subStream, tempFileInfo, fullVirtPath, encrypted) == S_OK) + { + tempDirectory.DisableDeleting(); + RefreshListCtrl(); + return; + } + } + } + } + } + + CRecordVector<UInt32> indices; indices.Add(index); @@ -516,32 +630,29 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo return; } - UString tempFilePath = tempDirNorm + name; + + if (tryAsArchive) + { + bool encrypted; + if (OpenItemAsArchive(NULL, tempFileInfo, fullVirtPath, encrypted) == S_OK) + { + tempDirectory.DisableDeleting(); + RefreshListCtrl(); + return; + } + } CMyAutoPtr<CTmpProcessInfo> tmpProcessInfoPtr(new CTmpProcessInfo()); CTmpProcessInfo *tmpProcessInfo = tmpProcessInfoPtr.get(); tmpProcessInfo->FolderPath = tempDir; tmpProcessInfo->FilePath = tempFilePath; + tmpProcessInfo->NeedDelete = true; tmpProcessInfo->UsePassword = usePassword; tmpProcessInfo->Password = password; - if (!NFind::FindFile(tempFilePath, tmpProcessInfo->FileInfo)) + if (!tmpProcessInfo->FileInfo.Find(tempFilePath)) return; - if (tryInternal) - { - if (!tryExternal || !DoItemAlwaysStart(name)) - { - bool encrypted; - if (OpenItemAsArchive(name, tempDir, tempFilePath, - _currentFolderPrefix + name, encrypted) == S_OK) - { - RefreshListCtrl(); - return; - } - } - } - CTmpProcessInfoRelease tmpProcessInfoRelease(*tmpProcessInfo); if (!tryExternal) diff --git a/CPP/7zip/UI/FileManager/PanelItems.cpp b/CPP/7zip/UI/FileManager/PanelItems.cpp index 58e14759..7ea9585a 100755 --- a/CPP/7zip/UI/FileManager/PanelItems.cpp +++ b/CPP/7zip/UI/FileManager/PanelItems.cpp @@ -2,6 +2,8 @@ #include "StdAfx.h" +#include "../../../../C/Sort.h" + #include "Common/StringConvert.h" #include "Windows/Menu.h" @@ -17,11 +19,6 @@ #include "PropertyName.h" #include "RootFolder.h" -extern "C" -{ - #include "../../../../C/Sort.h" -} - using namespace NWindows; static int GetColumnAlign(PROPID propID, VARTYPE varType) @@ -137,9 +134,9 @@ void CPanel::InitColumns() _visibleProperties.Clear(); for (i = 0; i < _properties.Size(); i++) { - const CItemProperty &property = _properties[i]; - if (property.IsVisible) - _visibleProperties.Add(property); + const CItemProperty &prop = _properties[i]; + if (prop.IsVisible) + _visibleProperties.Add(prop); } // _sortIndex = 0; @@ -162,14 +159,14 @@ void CPanel::InitColumns() void CPanel::InsertColumn(int index) { - const CItemProperty &property = _visibleProperties[index]; + const CItemProperty &prop = _visibleProperties[index]; LV_COLUMNW column; column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_ORDER; - column.cx = property.Width; - column.fmt = GetColumnAlign(property.ID, property.Type); - column.iOrder = property.Order; + column.cx = prop.Width; + column.fmt = GetColumnAlign(prop.ID, prop.Type); + column.iOrder = prop.Order; column.iSubItem = index; - column.pszText = (wchar_t *)(const wchar_t *)property.Name; + column.pszText = (wchar_t *)(const wchar_t *)prop.Name; _listView.InsertColumn(index, &column); } @@ -344,8 +341,8 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se item.iSubItem = subItem++; item.lParam = kParentIndex; item.pszText = (wchar_t *)(const wchar_t *)itemName; - UInt32 attributes = FILE_ATTRIBUTE_DIRECTORY; - item.iImage = _extToIconMap.GetIconIndex(attributes, itemName); + UInt32 attrib = FILE_ATTRIBUTE_DIRECTORY; + item.iImage = _extToIconMap.GetIconIndex(attrib, itemName); if (item.iImage < 0) item.iImage = 0; if(_listView.InsertItem(&item) == -1) @@ -402,16 +399,13 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se else item.pszText = (wchar_t *)(const wchar_t *)itemName; - NCOM::CPropVariant propVariant; - _folder->GetProperty(i, kpidAttrib, &propVariant); - UInt32 attributes = 0; - if (propVariant.vt == VT_UI4) - attributes = propVariant.ulVal; - else - { - if (IsItemFolder(i)) - attributes |= FILE_ATTRIBUTE_DIRECTORY; - } + NCOM::CPropVariant prop; + _folder->GetProperty(i, kpidAttrib, &prop); + UInt32 attrib = 0; + if (prop.vt == VT_UI4) + attrib = prop.ulVal; + else if (IsItemFolder(i)) + attrib |= FILE_ATTRIBUTE_DIRECTORY; bool defined = false; @@ -425,12 +419,12 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se if (_currentFolderPrefix.IsEmpty()) { int iconIndexTemp; - GetRealIconIndex(itemName + WCHAR_PATH_SEPARATOR, attributes, iconIndexTemp); + GetRealIconIndex(itemName + WCHAR_PATH_SEPARATOR, attrib, iconIndexTemp); item.iImage = iconIndexTemp; } else { - item.iImage = _extToIconMap.GetIconIndex(attributes, itemName); + item.iImage = _extToIconMap.GetIconIndex(attrib, itemName); } } if (item.iImage < 0) @@ -572,7 +566,7 @@ void CPanel::OpenSelectedItems(bool tryInternal) if (focusedItem >= 0) { int realIndex = GetRealItemIndex(focusedItem); - if (realIndex == kParentIndex && (tryInternal || indices.Size() == 0) && + if (realIndex == kParentIndex && (tryInternal || indices.Size() == 0) && _listView.GetItemState(focusedItem, LVIS_SELECTED) == LVIS_SELECTED) indices.Insert(0, realIndex); } @@ -605,24 +599,24 @@ UString CPanel::GetItemName(int itemIndex) const { if (itemIndex == kParentIndex) return L".."; - NCOM::CPropVariant propVariant; - if (_folder->GetProperty(itemIndex, kpidName, &propVariant) != S_OK) + NCOM::CPropVariant prop; + if (_folder->GetProperty(itemIndex, kpidName, &prop) != S_OK) throw 2723400; - if (propVariant.vt != VT_BSTR) + if (prop.vt != VT_BSTR) throw 2723401; - return (propVariant.bstrVal); + return prop.bstrVal; } UString CPanel::GetItemPrefix(int itemIndex) const { if (itemIndex == kParentIndex) return UString(); - NCOM::CPropVariant propVariant; - if (_folder->GetProperty(itemIndex, kpidPrefix, &propVariant) != S_OK) + NCOM::CPropVariant prop; + if (_folder->GetProperty(itemIndex, kpidPrefix, &prop) != S_OK) throw 2723400; UString prefix; - if (propVariant.vt == VT_BSTR) - prefix = propVariant.bstrVal; + if (prop.vt == VT_BSTR) + prefix = prop.bstrVal; return prefix; } @@ -631,17 +625,21 @@ UString CPanel::GetItemRelPath(int itemIndex) const return GetItemPrefix(itemIndex) + GetItemName(itemIndex); } +UString CPanel::GetItemFullPath(int itemIndex) const +{ + return _currentFolderPrefix + GetItemRelPath(itemIndex); +} bool CPanel::IsItemFolder(int itemIndex) const { if (itemIndex == kParentIndex) return true; - NCOM::CPropVariant propVariant; - if (_folder->GetProperty(itemIndex, kpidIsDir, &propVariant) != S_OK) + NCOM::CPropVariant prop; + if (_folder->GetProperty(itemIndex, kpidIsDir, &prop) != S_OK) throw 2723400; - if (propVariant.vt == VT_BOOL) - return VARIANT_BOOLToBool(propVariant.boolVal); - if (propVariant.vt == VT_EMPTY) + if (prop.vt == VT_BOOL) + return VARIANT_BOOLToBool(prop.boolVal); + if (prop.vt == VT_EMPTY) return false; return false; } @@ -650,12 +648,12 @@ UINT64 CPanel::GetItemSize(int itemIndex) const { if (itemIndex == kParentIndex) return 0; - NCOM::CPropVariant propVariant; - if (_folder->GetProperty(itemIndex, kpidSize, &propVariant) != S_OK) + NCOM::CPropVariant prop; + if (_folder->GetProperty(itemIndex, kpidSize, &prop) != S_OK) throw 2723400; - if (propVariant.vt == VT_EMPTY) + if (prop.vt == VT_EMPTY) return 0; - return ConvertPropVariantToUInt64(propVariant); + return ConvertPropVariantToUInt64(prop); } void CPanel::ReadListViewInfo() @@ -670,13 +668,13 @@ void CPanel::SaveListViewInfo() int i; for(i = 0; i < _visibleProperties.Size(); i++) { - CItemProperty &property = _visibleProperties[i]; + CItemProperty &prop = _visibleProperties[i]; LVCOLUMN winColumnInfo; winColumnInfo.mask = LVCF_ORDER | LVCF_WIDTH; if (!_listView.GetColumn(i, &winColumnInfo)) throw 1; - property.Order = winColumnInfo.iOrder; - property.Width = winColumnInfo.cx; + prop.Order = winColumnInfo.iOrder; + prop.Width = winColumnInfo.cx; } CListViewInfo viewInfo; @@ -687,22 +685,22 @@ void CPanel::SaveListViewInfo() _visibleProperties.Sort(); for(i = 0; i < _visibleProperties.Size(); i++) { - const CItemProperty &property = _visibleProperties[i]; + const CItemProperty &prop = _visibleProperties[i]; CColumnInfo columnInfo; - columnInfo.IsVisible = property.IsVisible; - columnInfo.PropID = property.ID; - columnInfo.Width = property.Width; + columnInfo.IsVisible = prop.IsVisible; + columnInfo.PropID = prop.ID; + columnInfo.Width = prop.Width; viewInfo.Columns.Add(columnInfo); } for(i = 0; i < _properties.Size(); i++) { - const CItemProperty &property = _properties[i]; - if (!property.IsVisible) + const CItemProperty &prop = _properties[i]; + if (!prop.IsVisible) { CColumnInfo columnInfo; - columnInfo.IsVisible = property.IsVisible; - columnInfo.PropID = property.ID; - columnInfo.Width = property.Width; + columnInfo.IsVisible = prop.IsVisible; + columnInfo.PropID = prop.ID; + columnInfo.Width = prop.Width; viewInfo.Columns.Add(columnInfo); } } @@ -734,32 +732,32 @@ bool CPanel::OnRightClick(LPNMITEMACTIVATE itemActiveate, LRESULT &result) const int kCommandStart = 100; for(int i = 0; i < _properties.Size(); i++) { - const CItemProperty &property = _properties[i]; + const CItemProperty &prop = _properties[i]; UINT flags = MF_STRING; - if (property.IsVisible) + if (prop.IsVisible) flags |= MF_CHECKED; if (i == 0) flags |= MF_GRAYED; - menu.AppendItem(flags, kCommandStart + i, GetSystemString(property.Name)); + menu.AppendItem(flags, kCommandStart + i, prop.Name); } int menuResult = menu.Track(TPM_LEFTALIGN | TPM_RETURNCMD | TPM_NONOTIFY, point.x, point.y, _listView); if (menuResult >= kCommandStart && menuResult <= kCommandStart + _properties.Size()) { int index = menuResult - kCommandStart; - CItemProperty &property = _properties[index]; - property.IsVisible = !property.IsVisible; + CItemProperty &prop = _properties[index]; + prop.IsVisible = !prop.IsVisible; - if (property.IsVisible) + if (prop.IsVisible) { int prevVisibleSize = _visibleProperties.Size(); - property.Order = prevVisibleSize; - _visibleProperties.Add(property); + prop.Order = prevVisibleSize; + _visibleProperties.Add(prop); InsertColumn(prevVisibleSize); } else { - int visibleIndex = _visibleProperties.FindItemWithID(property.ID); + int visibleIndex = _visibleProperties.FindItemWithID(prop.ID); _visibleProperties.Delete(visibleIndex); /* if (_sortIndex == index) @@ -768,7 +766,7 @@ bool CPanel::OnRightClick(LPNMITEMACTIVATE itemActiveate, LRESULT &result) _ascending = true; } */ - if (_sortID == property.ID) + if (_sortID == prop.ID) { _sortID = kpidName; _ascending = true; @@ -794,11 +792,10 @@ void CPanel::OnTimer() CMyComPtr<IFolderWasChanged> folderWasChanged; if (_folder.QueryInterface(IID_IFolderWasChanged, &folderWasChanged) != S_OK) return; - INT32 wasChanged; + Int32 wasChanged; if (folderWasChanged->WasChanged(&wasChanged) != S_OK) return; if (wasChanged == 0) return; OnReload(); } - diff --git a/CPP/7zip/UI/FileManager/PanelListNotify.cpp b/CPP/7zip/UI/FileManager/PanelListNotify.cpp index 21600a68..aee4759e 100755 --- a/CPP/7zip/UI/FileManager/PanelListNotify.cpp +++ b/CPP/7zip/UI/FileManager/PanelListNotify.cpp @@ -18,6 +18,7 @@ using namespace NWindows; +/* static UString ConvertSizeToStringShort(UInt64 value) { wchar_t s[32]; @@ -50,6 +51,7 @@ static UString ConvertSizeToStringShort(UInt64 value) s[p++] = L'\0'; return s; } +*/ UString ConvertSizeToString(UInt64 value) { @@ -116,7 +118,7 @@ LRESULT CPanel::SetItemText(LVITEMW &item) /* { NCOM::CPropVariant property; - if(propID == kpidType) + if (propID == kpidType) string = GetFileType(index); else { @@ -150,13 +152,18 @@ LRESULT CPanel::SetItemText(LVITEMW &item) if (_folder->GetProperty(realIndex, propID, &prop) != S_OK) throw 2723407; - if ((propID == kpidSize || propID == kpidPackSize || propID == kpidClusterSize || - propID == kpidNumSubDirs || propID == kpidNumSubFiles) && - (prop.vt == VT_UI8 || prop.vt == VT_UI4)) + if ((prop.vt == VT_UI8 || prop.vt == VT_UI4) && ( + propID == kpidSize || + propID == kpidPackSize || + propID == kpidNumSubDirs || + propID == kpidNumSubFiles || + propID == kpidPosition || + propID == kpidNumBlocks || + propID == kpidClusterSize || + propID == kpidTotalSize || + propID == kpidFreeSpace + )) s = ConvertSizeToString(ConvertPropVariantToUInt64(prop)); - else if ((propID == kpidTotalSize || propID == kpidFreeSpace) && - (prop.vt == VT_UI8 || prop.vt == VT_UI4)) - s = ConvertSizeToStringShort(ConvertPropVariantToUInt64(prop)); else { s = ConvertPropertyToString(prop, propID, false); @@ -164,9 +171,9 @@ LRESULT CPanel::SetItemText(LVITEMW &item) s.Replace(wchar_t(0xD), L' '); } int size = item.cchTextMax; - if(size > 0) + if (size > 0) { - if(s.Length() + 1 > size) + if (s.Length() + 1 > size) s = s.Left(size - 1); MyStringCopy(item.pszText, (const wchar_t *)s); } @@ -183,7 +190,7 @@ void CPanel::OnItemChanged(NMLISTVIEW *item) bool oldSelected = (item->uOldState & LVIS_SELECTED) != 0; bool newSelected = (item->uNewState & LVIS_SELECTED) != 0; // Don't change this code. It works only with such check - if(oldSelected != newSelected) + if (oldSelected != newSelected) _selectedStatusVector[index] = newSelected; } @@ -218,7 +225,7 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result) //is the sub-item information being requested? - if((dispInfo->item.mask & LVIF_TEXT) != 0 || + if ((dispInfo->item.mask & LVIF_TEXT) != 0 || (dispInfo->item.mask & LVIF_IMAGE) != 0) SetItemText(dispInfo->item); return false; @@ -290,8 +297,8 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result) // we need SetFocusToList, if we drag-select items from other panel. SetFocusToList(); RefreshStatusBar(); - if(_mySelectMode) - if(g_ComCtl32Version >= MAKELONG(71, 4)) + if (_mySelectMode) + if (g_ComCtl32Version >= MAKELONG(71, 4)) OnLeftClick((LPNMITEMACTIVATE)header); return false; } diff --git a/CPP/7zip/UI/FileManager/PanelMenu.cpp b/CPP/7zip/UI/FileManager/PanelMenu.cpp index ab48bbc7..2672f694 100755 --- a/CPP/7zip/UI/FileManager/PanelMenu.cpp +++ b/CPP/7zip/UI/FileManager/PanelMenu.cpp @@ -1,21 +1,23 @@ #include "StdAfx.h" #include "Common/StringConvert.h" -#include "Windows/Menu.h" + #include "Windows/COM.h" -#include "Windows/PropVariant.h" #include "Windows/Clipboard.h" +#include "Windows/Menu.h" +#include "Windows/PropVariant.h" #include "Windows/PropVariantConversions.h" + #include "../Common/PropIDUtils.h" #include "../../PropID.h" -#include "Panel.h" -#include "PluginInterface.h" -#include "MyLoadMenu.h" #include "App.h" #include "LangUtils.h" -#include "resource.h" +#include "MyLoadMenu.h" +#include "PluginInterface.h" #include "PropertyName.h" + +#include "resource.h" #include "PropertyNameRes.h" using namespace NWindows; @@ -30,7 +32,7 @@ static const UINT kSystemStartMenuID = kPluginMenuStartID + 100; void CPanel::InvokeSystemCommand(const char *command) { NCOM::CComInitializer comInitializer; - if (!IsFSFolder() && !IsFSDrivesFolder()) + if (!IsFsOrPureDrivesFolder()) return; CRecordVector<UInt32> operatedIndices; GetOperatedItemIndices(operatedIndices); @@ -58,26 +60,28 @@ static void AddPropertyString(PROPID propID, const wchar_t *nameBSTR, { if (prop.vt != VT_EMPTY) { - const UString name = GetNameOfProperty(propID, nameBSTR); UString val; - if (( + if ((prop.vt == VT_UI8 || prop.vt == VT_UI4) && ( propID == kpidSize || propID == kpidPackSize || propID == kpidNumSubDirs || propID == kpidNumSubFiles || propID == kpidNumBlocks || + propID == kpidClusterSize || + propID == kpidTotalSize || + propID == kpidFreeSpace || propID == kpidPhySize || propID == kpidHeadersSize || - propID == kpidClusterSize - ) && (prop.vt == VT_UI8 || prop.vt == VT_UI4)) + propID == kpidFreeSpace + )) val = ConvertSizeToString(ConvertPropVariantToUInt64(prop)); else val = ConvertPropertyToString(prop, propID); if (!val.IsEmpty()) { - s += name; + s += GetNameOfProperty(propID, nameBSTR); s += kPropValueSeparator; /* if (propID == kpidComment) @@ -129,7 +133,7 @@ void CPanel::Properties() message += kSeparator; } - message += LangString(IDS_PROPERTY_FILE_TYPE, 0x02000214); + message += LangString(IDS_PROP_FILE_TYPE, 0x02000214); message += kPropValueSeparator; message += GetFolderTypeID(); message += L"\n"; diff --git a/CPP/7zip/UI/FileManager/PanelOperations.cpp b/CPP/7zip/UI/FileManager/PanelOperations.cpp index c3b5d69d..9a60fb1a 100755 --- a/CPP/7zip/UI/FileManager/PanelOperations.cpp +++ b/CPP/7zip/UI/FileManager/PanelOperations.cpp @@ -2,25 +2,25 @@ #include "StdAfx.h" -#include "resource.h" - -#include "Panel.h" - -#include "Common/StringConvert.h" #include "Common/DynamicBuffer.h" +#include "Common/StringConvert.h" + +#include "Windows/COM.h" #include "Windows/FileDir.h" +#include "Windows/PropVariant.h" #include "Windows/ResourceString.h" #include "Windows/Thread.h" -#include "Windows/COM.h" #include "ComboDialog.h" #include "FSFolder.h" -#include "LangUtils.h" #include "FormatUtils.h" - +#include "LangUtils.h" +#include "Panel.h" #include "UpdateCallback100.h" +#include "resource.h" + using namespace NWindows; using namespace NFile; diff --git a/CPP/7zip/UI/FileManager/PanelSplitFile.cpp b/CPP/7zip/UI/FileManager/PanelSplitFile.cpp index 36146d7a..d1531957 100755 --- a/CPP/7zip/UI/FileManager/PanelSplitFile.cpp +++ b/CPP/7zip/UI/FileManager/PanelSplitFile.cpp @@ -2,30 +2,25 @@ #include "StdAfx.h" -#include "resource.h" - -extern "C" -{ - #include "../../../../C/Alloc.h" -} +#include "../../../../C/Alloc.h" -#include "Common/Types.h" #include "Common/IntToString.h" -// #include "Windows/COM.h" #include "Windows/FileIO.h" #include "Windows/FileFind.h" #include "Windows/Thread.h" -#include "ProgressDialog2.h" -#include "SplitDialog.h" -#include "CopyDialog.h" #include "../GUI/ExtractRes.h" -#include "SplitUtils.h" +#include "resource.h" + #include "App.h" +#include "CopyDialog.h" #include "FormatUtils.h" #include "LangUtils.h" +#include "ProgressDialog2.h" +#include "SplitDialog.h" +#include "SplitUtils.h" using namespace NWindows; @@ -227,7 +222,7 @@ void CApp::Split() return; NFile::NFind::CFileInfoW fileInfo; - if (!NFile::NFind::FindFile(srcPath + itemName, fileInfo)) + if (!fileInfo.Find(srcPath + itemName)) { srcPanel.MessageBoxMyError(L"Can not find file"); return; @@ -422,7 +417,7 @@ void CApp::Combine() for (;;) { NFile::NFind::CFileInfoW fileInfo; - if (!NFile::NFind::FindFile(srcPath + nextName, fileInfo) || fileInfo.IsDir()) + if (!fileInfo.Find(srcPath + nextName) || fileInfo.IsDir()) break; combiner.Names.Add(nextName); combiner.TotalSize += fileInfo.Size; @@ -490,7 +485,7 @@ void CApp::Combine() NFile::NFind::CFileInfoW fileInfo; UString destFilePath = path + outName; combiner.OutputPath = destFilePath; - if (NFile::NFind::FindFile(destFilePath, fileInfo)) + if (fileInfo.Find(destFilePath)) { srcPanel.MessageBoxMyError(MyFormatNew(IDS_FILE_EXIST, 0x03020A04, destFilePath)); return; diff --git a/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp b/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp index 750f2e02..12b7dce8 100755 --- a/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp +++ b/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp @@ -2,22 +2,21 @@ #include "StdAfx.h" -extern "C" -{ - #include "../../../../C/Alloc.h" -} +#include "../../../../C/Alloc.h" + +#include "Common/Buffer.h" -#include "PhysDriveFolder.h" #include "Windows/PropVariant.h" #include "Windows/FileDevice.h" #include "Windows/FileSystem.h" #include "../../PropID.h" +#include "PhysDriveFolder.h" + using namespace NWindows; static const UInt32 kBufferSize = (4 << 20); - static STATPROPSTG kProperties[] = { { NULL, kpidName, VT_BSTR}, @@ -177,7 +176,8 @@ struct CPhysTempBuffer ~CPhysTempBuffer() { MyFree(buffer); } }; -HRESULT CopyFileSpec(LPCWSTR fromPath, LPCWSTR toPath, bool writeToDisk, UInt64 fileSize, UInt32 bufferSize, IProgress *progress) +HRESULT CopyFileSpec(LPCWSTR fromPath, LPCWSTR toPath, bool writeToDisk, UInt64 fileSize, + UInt32 bufferSize, UInt64 progressStart, IProgress *progress) { NFile::NIO::CInFile inFile; if (!inFile.Open(fromPath)) @@ -203,7 +203,8 @@ HRESULT CopyFileSpec(LPCWSTR fromPath, LPCWSTR toPath, bool writeToDisk, UInt64 for (UInt64 pos = 0; pos < fileSize;) { - RINOK(progress->SetCompleted(&pos)); + UInt64 progressCur = progressStart + pos; + RINOK(progress->SetCompleted(&progressCur)); UInt64 rem = fileSize - pos; UInt32 curSize = (UInt32)MyMin(rem, (UInt64)bufferSize); UInt32 processedSize; @@ -262,7 +263,7 @@ STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numIt RINOK(callback->SetCurrentFilePath(GetFullPathWithName())); UInt32 bufferSize = (_driveType == DRIVE_REMOVABLE) ? (18 << 10) * 4 : kBufferSize; - return CopyFileSpec(GetFullPath(), destPathResult, false, fileSize, bufferSize, callback); + return CopyFileSpec(GetFullPath(), destPathResult, false, fileSize, bufferSize, 0, callback); } ///////////////////////////////////////////////// @@ -289,5 +290,6 @@ STDMETHODIMP CPhysDriveFolder::CopyFrom( return E_NOTIMPL; UInt32 bufferSize = (_driveType == DRIVE_REMOVABLE) ? (18 << 10) * 4 : kBufferSize; // MessageBoxW(0, fromFolderPath, itemsPaths[0], 0); - return CopyFileSpec((UString)fromFolderPath + itemsPaths[0], GetFullPath(), true, (UInt64)(Int64)-1, bufferSize, callback); + return CopyFileSpec((UString)fromFolderPath + itemsPaths[0], GetFullPath(), true, (UInt64)(Int64)-1, bufferSize, 0, callback); } + diff --git a/CPP/7zip/UI/FileManager/PhysDriveFolder.h b/CPP/7zip/UI/FileManager/PhysDriveFolder.h index 1f327966..64a36b91 100755 --- a/CPP/7zip/UI/FileManager/PhysDriveFolder.h +++ b/CPP/7zip/UI/FileManager/PhysDriveFolder.h @@ -5,6 +5,7 @@ #include "Common/MyString.h" #include "Common/MyCom.h" +#include "../../Archive/IArchive.h" #include "IFolder.h" @@ -32,11 +33,11 @@ public: INTERFACE_FolderFolder(;) INTERFACE_FolderOperations(;) - STDMETHOD(WasChanged)(INT32 *wasChanged); - STDMETHOD(Clone)(IFolderFolder **resultFolder); + STDMETHOD(WasChanged)(Int32 *wasChanged); STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress); + STDMETHOD(Clone)(IFolderFolder **resultFolder); - // STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex); + // STDMETHOD(GetSystemIconIndex)(UInt32 index, Int32 *iconIndex); private: UString _name; diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp index e8846e68..87a1521d 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp @@ -1,10 +1,11 @@ // ProgressDialog2.cpp #include "StdAfx.h" -#include "resource.h" -#include "ProgressDialog2.h" + #include "Common/IntToString.h" +#include "ProgressDialog2.h" + using namespace NWindows; static const UINT_PTR kTimerID = 3; @@ -67,8 +68,8 @@ void CProgressDialog::AddToTitle(LPCWSTR s) } } -static const int kTitleFileNameSizeLimit = 36; -static const int kCurrentFileNameSizeLimit = 70; +static const int kTitleFileNameSizeLimit = 40; +static const int kCurrentFileNameSizeLimit = 82; static void ReduceString(UString &s, int size) { @@ -143,11 +144,7 @@ void CProgressDialog::SetRange(UInt64 range) _range = range; _previousPos = (UInt64)(Int64)-1; _converter.Init(range); - m_ProgressBar.SetRange32(0 , _converter.Count(range)); // Test it for 100% - - wchar_t s[32]; - ConvertSizeToString(_range, s); - SetItemText(IDC_PROGRESS_TOTAL_VALUE, s); + m_ProgressBar.SetRange32(0, _converter.Count(range)); // Test it for 100% } void CProgressDialog::SetPos(UInt64 pos) @@ -187,19 +184,28 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */) if (ProgressSynch.GetPaused()) return true; UInt64 total, completed, totalFiles, completedFiles, inSize, outSize; - ProgressSynch.GetProgress(total, completed, totalFiles, completedFiles, inSize, outSize); + bool bytesProgressMode; + ProgressSynch.GetProgress(total, completed, totalFiles, completedFiles, inSize, outSize, bytesProgressMode); UInt32 curTime = ::GetTickCount(); - if (total != _range) - SetRange(total); - if (total == (UInt64)(Int64)-1) + UInt64 progressTotal = bytesProgressMode ? total : totalFiles; + UInt64 progressCompleted = bytesProgressMode ? completed : completedFiles; + + if (progressTotal != _range) + SetRange(progressTotal); + if (progressTotal == (UInt64)(Int64)-1) { SetPos(0); - SetRange(completed); + SetRange(progressCompleted); } else - SetPos(completed); + SetPos(progressCompleted); + + wchar_t s[32] = { 0 }; + if (total != (UInt64)(Int64)-1) + ConvertSizeToString(total, s); + SetItemText(IDC_PROGRESS_TOTAL_VALUE, s); _elapsedTime += (curTime - _prevTime); _prevTime = curTime; diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.h b/CPP/7zip/UI/FileManager/ProgressDialog2.h index e838ae25..3ab9f4c0 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.h +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.h @@ -1,9 +1,7 @@ // ProgressDialog2.h -#ifndef __PROGRESSDIALOG2_H -#define __PROGRESSDIALOG2_H - -#include "ProgressDialog2Res.h" +#ifndef __PROGRESS_DIALOG2_H +#define __PROGRESS_DIALOG2_H #include "Common/Types.h" @@ -11,59 +9,69 @@ #include "Windows/Control/ProgressBar.h" #include "Windows/Synchronization.h" +#include "ProgressDialog2Res.h" + class CProgressSynch { - NWindows::NSynchronization::CCriticalSection _criticalSection; + NWindows::NSynchronization::CCriticalSection _cs; bool _stopped; bool _paused; - UInt64 _total; - UInt64 _completed; + bool _bytesProgressMode; + + UInt64 _totalBytes; + UInt64 _curBytes; + UInt64 _totalFiles; + UInt64 _curFiles; UInt64 _inSize; UInt64 _outSize; - UInt64 _totalFiles; - UInt64 _completedFiles; + UString TitleFileName; UString CurrentFileName; + public: CProgressSynch(): _stopped(false), _paused(false), - _total((UInt64)(Int64)-1), - _completed(0), - _totalFiles((UInt64)(Int64)-1), - _completedFiles(0), + _totalBytes((UInt64)(Int64)-1), _curBytes(0), + _totalFiles((UInt64)(Int64)-1), _curFiles(0), _inSize((UInt64)(Int64)-1), - _outSize((UInt64)(Int64)-1) + _outSize((UInt64)(Int64)-1), + _bytesProgressMode(true) {} bool GetStopped() { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); return _stopped; } void SetStopped(bool value) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); _stopped = value; } bool GetPaused() { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); return _paused; } void SetPaused(bool value) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); _paused = value; } + void SetBytesProgressMode(bool bytesProgressMode) + { + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + _bytesProgressMode = bytesProgressMode; + } void SetProgress(UInt64 total, UInt64 completed) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - _total = total; - _completed = completed; + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + _totalBytes = total; + _curBytes = completed; } void SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); if (inSize) _inSize = *inSize; if (outSize) @@ -71,51 +79,58 @@ public: } void SetPos(UInt64 completed) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - _completed = completed; + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + _curBytes = completed; + } + void SetNumBytesTotal(UInt64 value) + { + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + _totalBytes = value; } void SetNumFilesTotal(UInt64 value) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); _totalFiles = value; } void SetNumFilesCur(UInt64 value) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - _completedFiles = value; + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + _curFiles = value; } HRESULT ProcessStopAndPause(); HRESULT SetPosAndCheckPaused(UInt64 completed); void GetProgress(UInt64 &total, UInt64 &completed, - UInt64 &totalFiles, UInt64 &completedFiles, - UInt64 &inSize, UInt64 &outSize) + UInt64 &totalFiles, UInt64 &curFiles, + UInt64 &inSize, UInt64 &outSize, + bool &bytesProgressMode) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); - total = _total; - completed = _completed; + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); + total = _totalBytes; + completed = _curBytes; totalFiles = _totalFiles; - completedFiles = _completedFiles; + curFiles = _curFiles; inSize = _inSize; outSize = _outSize; + bytesProgressMode = _bytesProgressMode; } void SetTitleFileName(const UString &fileName) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); TitleFileName = fileName; } void GetTitleFileName(UString &fileName) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); fileName = TitleFileName; } void SetCurrentFileName(const UString &fileName) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); CurrentFileName = fileName; } void GetCurrentFileName(UString &fileName) { - NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + NWindows::NSynchronization::CCriticalSectionLock lock(_cs); fileName = CurrentFileName; } }; diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.rc b/CPP/7zip/UI/FileManager/ProgressDialog2.rc index 92b970f6..2b707451 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.rc +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.rc @@ -1,7 +1,7 @@ #include "ProgressDialog2Res.h" #include "../../GuiCommon.rc" -#define xSize2 320 +#define xSize2 350 #define ySize2 110 #define xSize (xSize2 + marg + marg) @@ -20,7 +20,7 @@ #define x1 (marg + x0Size) #define x1Size 70 -#define x3Size 40 +#define x3Size 60 #define x3 (xSize - marg - x3Size) #define x2Size 90 diff --git a/CPP/7zip/UI/FileManager/PropertyName.cpp b/CPP/7zip/UI/FileManager/PropertyName.cpp index cb4edfc2..48090d38 100755 --- a/CPP/7zip/UI/FileManager/PropertyName.cpp +++ b/CPP/7zip/UI/FileManager/PropertyName.cpp @@ -3,15 +3,17 @@ #include "StdAfx.h" #include "Common/IntToString.h" + #include "Windows/ResourceString.h" #include "../../PropID.h" -#include "resource.h" -#include "PropertyNameRes.h" #include "LangUtils.h" #include "PropertyName.h" +#include "resource.h" +#include "PropertyNameRes.h" + struct CPropertyIDNamePair { PROPID PropID; @@ -21,60 +23,66 @@ struct CPropertyIDNamePair static CPropertyIDNamePair kPropertyIDNamePairs[] = { - { kpidPath, IDS_PROPERTY_PATH, 0x02000203 }, - { kpidName, IDS_PROPERTY_NAME, 0x02000204 }, - { kpidExtension, IDS_PROPERTY_EXTENSION, 0x02000205 }, - { kpidIsDir, IDS_PROPERTY_IS_FOLDER, 0x02000206}, - { kpidSize, IDS_PROPERTY_SIZE, 0x02000207}, - { kpidPackSize, IDS_PROPERTY_PACKED_SIZE, 0x02000208 }, - { kpidAttrib, IDS_PROPERTY_ATTRIBUTES, 0x02000209 }, - { kpidCTime, IDS_PROPERTY_CTIME, 0x0200020A }, - { kpidATime, IDS_PROPERTY_ATIME, 0x0200020B }, - { kpidMTime, IDS_PROPERTY_MTIME, 0x0200020C }, - { kpidSolid, IDS_PROPERTY_SOLID, 0x0200020D }, - { kpidCommented, IDS_PROPERTY_C0MMENTED, 0x0200020E }, - { kpidEncrypted, IDS_PROPERTY_ENCRYPTED, 0x0200020F }, - { kpidSplitBefore, IDS_PROPERTY_SPLIT_BEFORE, 0x02000210 }, - { kpidSplitAfter, IDS_PROPERTY_SPLIT_AFTER, 0x02000211 }, - { kpidDictionarySize, IDS_PROPERTY_DICTIONARY_SIZE, 0x02000212 }, - { kpidCRC, IDS_PROPERTY_CRC, 0x02000213 }, - { kpidType, IDS_PROPERTY_FILE_TYPE, 0x02000214}, - { kpidIsAnti, IDS_PROPERTY_ANTI, 0x02000215 }, - { kpidMethod, IDS_PROPERTY_METHOD, 0x02000216 }, - { kpidHostOS, IDS_PROPERTY_HOST_OS, 0x02000217 }, - { kpidFileSystem, IDS_PROPERTY_FILE_SYSTEM, 0x02000218}, - { kpidUser, IDS_PROPERTY_USER, 0x02000219}, - { kpidGroup, IDS_PROPERTY_GROUP, 0x0200021A}, - { kpidBlock, IDS_PROPERTY_BLOCK, 0x0200021B }, - { kpidComment, IDS_PROPERTY_COMMENT, 0x0200021C }, - { kpidPosition, IDS_PROPERTY_POSITION, 0x0200021D }, - { kpidPrefix, IDS_PROPERTY_PREFIX, 0x0200021E }, - { kpidNumSubDirs, IDS_PROPERTY_FOLDERS, 0x0200021F }, - { kpidNumSubFiles, IDS_PROPERTY_FILES, 0x02000220 }, - { kpidUnpackVer, IDS_PROPERTY_VERSION, 0x02000221}, - { kpidVolume, IDS_PROPERTY_VOLUME, 0x02000222}, - { kpidIsVolume, IDS_PROPERTY_IS_VOLUME, 0x02000223}, - { kpidOffset, IDS_PROPERTY_OFFSET, 0x02000224}, - { kpidLinks, IDS_PROPERTY_LINKS, 0x02000225}, - { kpidNumBlocks, IDS_PROPERTY_NUM_BLOCKS, 0x02000226}, - { kpidNumVolumes, IDS_PROPERTY_NUM_VOLUMES, 0x02000227}, - - { kpidBit64, IDS_PROPERTY_BIT64, 0x02000229}, - { kpidBigEndian, IDS_PROPERTY_BIG_ENDIAN, 0x0200022A}, - { kpidCpu, IDS_PROPERTY_CPU, 0x0200022B}, - { kpidPhySize, IDS_PROPERTY_PHY_SIZE, 0x0200022C}, - { kpidHeadersSize, IDS_PROPERTY_HEADERS_SIZE, 0x0200022D}, - { kpidChecksum, IDS_PROPERTY_CHECKSUM, 0x0200022E}, - { kpidCharacts, IDS_PROPERTY_CHARACTS, 0x0200022F}, - { kpidVa, IDS_PROPERTY_VA, 0x02000230}, + { kpidPath, IDS_PROP_PATH, 0x02000203 }, + { kpidName, IDS_PROP_NAME, 0x02000204 }, + { kpidExtension, IDS_PROP_EXTENSION, 0x02000205 }, + { kpidIsDir, IDS_PROP_IS_FOLDER, 0x02000206}, + { kpidSize, IDS_PROP_SIZE, 0x02000207}, + { kpidPackSize, IDS_PROP_PACKED_SIZE, 0x02000208 }, + { kpidAttrib, IDS_PROP_ATTRIBUTES, 0x02000209 }, + { kpidCTime, IDS_PROP_CTIME, 0x0200020A }, + { kpidATime, IDS_PROP_ATIME, 0x0200020B }, + { kpidMTime, IDS_PROP_MTIME, 0x0200020C }, + { kpidSolid, IDS_PROP_SOLID, 0x0200020D }, + { kpidCommented, IDS_PROP_C0MMENTED, 0x0200020E }, + { kpidEncrypted, IDS_PROP_ENCRYPTED, 0x0200020F }, + { kpidSplitBefore, IDS_PROP_SPLIT_BEFORE, 0x02000210 }, + { kpidSplitAfter, IDS_PROP_SPLIT_AFTER, 0x02000211 }, + { kpidDictionarySize, IDS_PROP_DICTIONARY_SIZE, 0x02000212 }, + { kpidCRC, IDS_PROP_CRC, 0x02000213 }, + { kpidType, IDS_PROP_FILE_TYPE, 0x02000214}, + { kpidIsAnti, IDS_PROP_ANTI, 0x02000215 }, + { kpidMethod, IDS_PROP_METHOD, 0x02000216 }, + { kpidHostOS, IDS_PROP_HOST_OS, 0x02000217 }, + { kpidFileSystem, IDS_PROP_FILE_SYSTEM, 0x02000218}, + { kpidUser, IDS_PROP_USER, 0x02000219}, + { kpidGroup, IDS_PROP_GROUP, 0x0200021A}, + { kpidBlock, IDS_PROP_BLOCK, 0x0200021B }, + { kpidComment, IDS_PROP_COMMENT, 0x0200021C }, + { kpidPosition, IDS_PROP_POSITION, 0x0200021D }, + { kpidPrefix, IDS_PROP_PREFIX, 0x0200021E }, + { kpidNumSubDirs, IDS_PROP_FOLDERS, 0x0200021F }, + { kpidNumSubFiles, IDS_PROP_FILES, 0x02000220 }, + { kpidUnpackVer, IDS_PROP_VERSION, 0x02000221}, + { kpidVolume, IDS_PROP_VOLUME, 0x02000222}, + { kpidIsVolume, IDS_PROP_IS_VOLUME, 0x02000223}, + { kpidOffset, IDS_PROP_OFFSET, 0x02000224}, + { kpidLinks, IDS_PROP_LINKS, 0x02000225}, + { kpidNumBlocks, IDS_PROP_NUM_BLOCKS, 0x02000226}, + { kpidNumVolumes, IDS_PROP_NUM_VOLUMES, 0x02000227}, - { kpidTotalSize, IDS_PROPERTY_TOTAL_SIZE, 0x03031100 }, - { kpidFreeSpace, IDS_PROPERTY_FREE_SPACE, 0x03031101 }, - { kpidClusterSize, IDS_PROPERTY_CLUSTER_SIZE, 0x03031102}, - { kpidVolumeName, IDS_PROPERTY_VOLUME_NAME, 0x03031103 }, + { kpidBit64, IDS_PROP_BIT64, 0x02000229}, + { kpidBigEndian, IDS_PROP_BIG_ENDIAN, 0x0200022A}, + { kpidCpu, IDS_PROP_CPU, 0x0200022B}, + { kpidPhySize, IDS_PROP_PHY_SIZE, 0x0200022C}, + { kpidHeadersSize, IDS_PROP_HEADERS_SIZE, 0x0200022D}, + { kpidChecksum, IDS_PROP_CHECKSUM, 0x0200022E}, + { kpidCharacts, IDS_PROP_CHARACTS, 0x0200022F}, + { kpidVa, IDS_PROP_VA, 0x02000230}, + { kpidId, IDS_PROP_ID, 0x02000231 }, + { kpidShortName, IDS_PROP_SHORT_NAME, 0x02000232 }, + { kpidCreatorApp, IDS_PROP_CREATOR_APP, 0x02000233 }, + { kpidSectorSize, IDS_PROP_SECTOR_SIZE, 0x02000234 }, + { kpidPosixAttrib, IDS_PROP_POSIX_ATTRIB, 0x02000235 }, + { kpidLink, IDS_PROP_LINK, 0x02000236 }, + + { kpidTotalSize, IDS_PROP_TOTAL_SIZE, 0x03031100 }, + { kpidFreeSpace, IDS_PROP_FREE_SPACE, 0x03031101 }, + { kpidClusterSize, IDS_PROP_CLUSTER_SIZE, 0x03031102}, + { kpidVolumeName, IDS_PROP_VOLUME_NAME, 0x03031103 }, - { kpidLocalName, IDS_PROPERTY_LOCAL_NAME, 0x03031200 }, - { kpidProvider, IDS_PROPERTY_PROVIDER, 0x03031201 } + { kpidLocalName, IDS_PROP_LOCAL_NAME, 0x03031200 }, + { kpidProvider, IDS_PROP_PROVIDER, 0x03031201 } }; int FindProperty(PROPID propID) @@ -92,8 +100,8 @@ UString GetNameOfProperty(PROPID propID, const wchar_t *name) { if (name) return name; - wchar_t s[32]; - ConvertUInt64ToString(propID, s); + wchar_t s[16]; + ConvertUInt32ToString(propID, s); return s; } const CPropertyIDNamePair &pair = kPropertyIDNamePairs[index]; diff --git a/CPP/7zip/UI/FileManager/PropertyName.rc b/CPP/7zip/UI/FileManager/PropertyName.rc index ad8a9012..576b52cb 100755 --- a/CPP/7zip/UI/FileManager/PropertyName.rc +++ b/CPP/7zip/UI/FileManager/PropertyName.rc @@ -4,50 +4,56 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US STRINGTABLE BEGIN - IDS_PROPERTY_PATH "Path" - IDS_PROPERTY_NAME "Name" - IDS_PROPERTY_EXTENSION "Extension" - IDS_PROPERTY_IS_FOLDER "Folder" - IDS_PROPERTY_SIZE "Size" - IDS_PROPERTY_PACKED_SIZE "Packed Size" - IDS_PROPERTY_ATTRIBUTES "Attributes" - IDS_PROPERTY_CTIME "Created" - IDS_PROPERTY_ATIME "Accessed" - IDS_PROPERTY_MTIME "Modified" - IDS_PROPERTY_SOLID "Solid" - IDS_PROPERTY_C0MMENTED "Commented" - IDS_PROPERTY_ENCRYPTED "Encrypted" - IDS_PROPERTY_DICTIONARY_SIZE "Dictionary Size" - IDS_PROPERTY_SPLIT_BEFORE "Split Before" - IDS_PROPERTY_SPLIT_AFTER "Split After" - IDS_PROPERTY_CRC "CRC" - IDS_PROPERTY_FILE_TYPE "Type" - IDS_PROPERTY_ANTI "Anti" - IDS_PROPERTY_METHOD "Method" - IDS_PROPERTY_HOST_OS "Host OS" - IDS_PROPERTY_FILE_SYSTEM "File System" - IDS_PROPERTY_USER "User" - IDS_PROPERTY_GROUP "Group" - IDS_PROPERTY_BLOCK "Block" - IDS_PROPERTY_COMMENT "Comment" - IDS_PROPERTY_POSITION "Position" - IDS_PROPERTY_PREFIX "Path Prefix" - IDS_PROPERTY_FOLDERS "Folders" - IDS_PROPERTY_FILES "Files" - IDS_PROPERTY_VERSION "Version" - IDS_PROPERTY_VOLUME "Volume" - IDS_PROPERTY_IS_VOLUME "Multivolume" - IDS_PROPERTY_OFFSET "Offset" - IDS_PROPERTY_LINKS "Links" - IDS_PROPERTY_NUM_BLOCKS "Blocks" - IDS_PROPERTY_NUM_VOLUMES "Volumes" + IDS_PROP_PATH "Path" + IDS_PROP_NAME "Name" + IDS_PROP_EXTENSION "Extension" + IDS_PROP_IS_FOLDER "Folder" + IDS_PROP_SIZE "Size" + IDS_PROP_PACKED_SIZE "Packed Size" + IDS_PROP_ATTRIBUTES "Attributes" + IDS_PROP_CTIME "Created" + IDS_PROP_ATIME "Accessed" + IDS_PROP_MTIME "Modified" + IDS_PROP_SOLID "Solid" + IDS_PROP_C0MMENTED "Commented" + IDS_PROP_ENCRYPTED "Encrypted" + IDS_PROP_DICTIONARY_SIZE "Dictionary Size" + IDS_PROP_SPLIT_BEFORE "Split Before" + IDS_PROP_SPLIT_AFTER "Split After" + IDS_PROP_CRC "CRC" + IDS_PROP_FILE_TYPE "Type" + IDS_PROP_ANTI "Anti" + IDS_PROP_METHOD "Method" + IDS_PROP_HOST_OS "Host OS" + IDS_PROP_FILE_SYSTEM "File System" + IDS_PROP_USER "User" + IDS_PROP_GROUP "Group" + IDS_PROP_BLOCK "Block" + IDS_PROP_COMMENT "Comment" + IDS_PROP_POSITION "Position" + IDS_PROP_PREFIX "Path Prefix" + IDS_PROP_FOLDERS "Folders" + IDS_PROP_FILES "Files" + IDS_PROP_VERSION "Version" + IDS_PROP_VOLUME "Volume" + IDS_PROP_IS_VOLUME "Multivolume" + IDS_PROP_OFFSET "Offset" + IDS_PROP_LINKS "Links" + IDS_PROP_NUM_BLOCKS "Blocks" + IDS_PROP_NUM_VOLUMES "Volumes" - IDS_PROPERTY_BIT64 "64-bit" - IDS_PROPERTY_BIG_ENDIAN "Big-endian" - IDS_PROPERTY_CPU "CPU" - IDS_PROPERTY_PHY_SIZE "Physical Size" - IDS_PROPERTY_HEADERS_SIZE "Headers Size" - IDS_PROPERTY_CHECKSUM "Checksum" - IDS_PROPERTY_CHARACTS "Characteristics" - IDS_PROPERTY_VA "Va" + IDS_PROP_BIT64 "64-bit" + IDS_PROP_BIG_ENDIAN "Big-endian" + IDS_PROP_CPU "CPU" + IDS_PROP_PHY_SIZE "Physical Size" + IDS_PROP_HEADERS_SIZE "Headers Size" + IDS_PROP_CHECKSUM "Checksum" + IDS_PROP_CHARACTS "Characteristics" + IDS_PROP_VA "Virtual Address" + IDS_PROP_ID "ID" + IDS_PROP_SHORT_NAME "Short Name" + IDS_PROP_CREATOR_APP "Creator Application" + IDS_PROP_SECTOR_SIZE "Sector Size" + IDS_PROP_POSIX_ATTRIB "Mode" + IDS_PROP_LINK "Link" END diff --git a/CPP/7zip/UI/FileManager/PropertyNameRes.h b/CPP/7zip/UI/FileManager/PropertyNameRes.h index 74d535ac..00458a24 100755 --- a/CPP/7zip/UI/FileManager/PropertyNameRes.h +++ b/CPP/7zip/UI/FileManager/PropertyNameRes.h @@ -1,46 +1,52 @@ -#define IDS_PROPERTY_PATH 3 -#define IDS_PROPERTY_NAME 4 -#define IDS_PROPERTY_EXTENSION 5 -#define IDS_PROPERTY_IS_FOLDER 6 -#define IDS_PROPERTY_SIZE 7 -#define IDS_PROPERTY_PACKED_SIZE 8 -#define IDS_PROPERTY_ATTRIBUTES 9 -#define IDS_PROPERTY_CTIME 10 -#define IDS_PROPERTY_ATIME 11 -#define IDS_PROPERTY_MTIME 12 -#define IDS_PROPERTY_SOLID 13 -#define IDS_PROPERTY_C0MMENTED 14 -#define IDS_PROPERTY_ENCRYPTED 15 -#define IDS_PROPERTY_DICTIONARY_SIZE 16 -#define IDS_PROPERTY_SPLIT_BEFORE 17 -#define IDS_PROPERTY_SPLIT_AFTER 18 -#define IDS_PROPERTY_CRC 19 -#define IDS_PROPERTY_FILE_TYPE 20 -#define IDS_PROPERTY_ANTI 21 -#define IDS_PROPERTY_METHOD 22 -#define IDS_PROPERTY_HOST_OS 23 -#define IDS_PROPERTY_FILE_SYSTEM 24 -#define IDS_PROPERTY_USER 25 -#define IDS_PROPERTY_GROUP 26 -#define IDS_PROPERTY_BLOCK 27 -#define IDS_PROPERTY_COMMENT 28 -#define IDS_PROPERTY_POSITION 29 -#define IDS_PROPERTY_PREFIX 30 -#define IDS_PROPERTY_FOLDERS 31 -#define IDS_PROPERTY_FILES 32 -#define IDS_PROPERTY_VERSION 33 -#define IDS_PROPERTY_VOLUME 34 -#define IDS_PROPERTY_IS_VOLUME 35 -#define IDS_PROPERTY_OFFSET 36 -#define IDS_PROPERTY_LINKS 37 -#define IDS_PROPERTY_NUM_BLOCKS 38 -#define IDS_PROPERTY_NUM_VOLUMES 39 +#define IDS_PROP_PATH 3 +#define IDS_PROP_NAME 4 +#define IDS_PROP_EXTENSION 5 +#define IDS_PROP_IS_FOLDER 6 +#define IDS_PROP_SIZE 7 +#define IDS_PROP_PACKED_SIZE 8 +#define IDS_PROP_ATTRIBUTES 9 +#define IDS_PROP_CTIME 10 +#define IDS_PROP_ATIME 11 +#define IDS_PROP_MTIME 12 +#define IDS_PROP_SOLID 13 +#define IDS_PROP_C0MMENTED 14 +#define IDS_PROP_ENCRYPTED 15 +#define IDS_PROP_DICTIONARY_SIZE 16 +#define IDS_PROP_SPLIT_BEFORE 17 +#define IDS_PROP_SPLIT_AFTER 18 +#define IDS_PROP_CRC 19 +#define IDS_PROP_FILE_TYPE 20 +#define IDS_PROP_ANTI 21 +#define IDS_PROP_METHOD 22 +#define IDS_PROP_HOST_OS 23 +#define IDS_PROP_FILE_SYSTEM 24 +#define IDS_PROP_USER 25 +#define IDS_PROP_GROUP 26 +#define IDS_PROP_BLOCK 27 +#define IDS_PROP_COMMENT 28 +#define IDS_PROP_POSITION 29 +#define IDS_PROP_PREFIX 30 +#define IDS_PROP_FOLDERS 31 +#define IDS_PROP_FILES 32 +#define IDS_PROP_VERSION 33 +#define IDS_PROP_VOLUME 34 +#define IDS_PROP_IS_VOLUME 35 +#define IDS_PROP_OFFSET 36 +#define IDS_PROP_LINKS 37 +#define IDS_PROP_NUM_BLOCKS 38 +#define IDS_PROP_NUM_VOLUMES 39 -#define IDS_PROPERTY_BIT64 41 -#define IDS_PROPERTY_BIG_ENDIAN 42 -#define IDS_PROPERTY_CPU 43 -#define IDS_PROPERTY_PHY_SIZE 44 -#define IDS_PROPERTY_HEADERS_SIZE 45 -#define IDS_PROPERTY_CHECKSUM 46 -#define IDS_PROPERTY_CHARACTS 47 -#define IDS_PROPERTY_VA 48 +#define IDS_PROP_BIT64 41 +#define IDS_PROP_BIG_ENDIAN 42 +#define IDS_PROP_CPU 43 +#define IDS_PROP_PHY_SIZE 44 +#define IDS_PROP_HEADERS_SIZE 45 +#define IDS_PROP_CHECKSUM 46 +#define IDS_PROP_CHARACTS 47 +#define IDS_PROP_VA 48 +#define IDS_PROP_ID 49 +#define IDS_PROP_SHORT_NAME 50 +#define IDS_PROP_CREATOR_APP 51 +#define IDS_PROP_SECTOR_SIZE 52 +#define IDS_PROP_POSIX_ATTRIB 53 +#define IDS_PROP_LINK 54 diff --git a/CPP/7zip/UI/FileManager/RegistryAssociations.cpp b/CPP/7zip/UI/FileManager/RegistryAssociations.cpp index 8c6e6ae8..d4fbfe13 100755 --- a/CPP/7zip/UI/FileManager/RegistryAssociations.cpp +++ b/CPP/7zip/UI/FileManager/RegistryAssociations.cpp @@ -4,21 +4,18 @@ #include "RegistryAssociations.h" -#include "Common/StringConvert.h" #include "Common/IntToString.h" +#include "Common/StringConvert.h" #include "Common/StringToInt.h" -#include "Windows/Synchronization.h" #include "Windows/Registry.h" - -#include "Windows/FileName.h" +#include "Windows/Synchronization.h" #include "StringUtils.h" using namespace NWindows; using namespace NRegistry; - namespace NRegistryAssociations { static NSynchronization::CCriticalSection g_CriticalSection; @@ -218,8 +215,8 @@ void AddShellExtensionInfo(const CSysString &extension, if (iconIndex >= 0) { iconPathFull += L","; - wchar_t s[32]; - ConvertUInt64ToString((UInt64)iconIndex, s); + wchar_t s[16]; + ConvertUInt32ToString(iconIndex, s); iconPathFull += s; } iconKey.SetValue(NULL, iconPathFull); diff --git a/CPP/7zip/UI/FileManager/RegistryUtils.cpp b/CPP/7zip/UI/FileManager/RegistryUtils.cpp index ed118457..bd1248a2 100755 --- a/CPP/7zip/UI/FileManager/RegistryUtils.cpp +++ b/CPP/7zip/UI/FileManager/RegistryUtils.cpp @@ -2,10 +2,12 @@ #include "StdAfx.h" -#include "RegistryUtils.h" #include "Common/IntToString.h" + #include "Windows/Registry.h" +#include "RegistryUtils.h" + using namespace NWindows; using namespace NRegistry; @@ -17,6 +19,7 @@ static const TCHAR *kCU_FMPath = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("F static const WCHAR *kLangValueName = L"Lang"; static const WCHAR *kEditor = L"Editor"; +static const WCHAR *kDiff = L"Diff"; static const TCHAR *kShowDots = TEXT("ShowDots"); static const TCHAR *kShowRealFileIcons = TEXT("ShowRealFileIcons"); static const TCHAR *kShowSystemMenu = TEXT("ShowSystemMenu"); @@ -31,35 +34,29 @@ static const TCHAR *kLargePagesEnable = TEXT("LargePages"); static const TCHAR *kFlatViewName = TEXT("FlatViewArc"); -void SaveRegLang(const UString &langFile) +static void SaveCuString(LPCTSTR keyPath, LPCWSTR valuePath, LPCWSTR value) { CKey key; - key.Create(HKEY_CURRENT_USER, kCUBasePath); - key.SetValue(kLangValueName, langFile); + key.Create(HKEY_CURRENT_USER, keyPath); + key.SetValue(valuePath, value); } -void ReadRegLang(UString &langFile) +static void ReadCuString(LPCTSTR keyPath, LPCWSTR valuePath, UString &res) { - langFile.Empty(); + res.Empty(); CKey key; - if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS) - key.QueryValue(kLangValueName, langFile); + if (key.Open(HKEY_CURRENT_USER, keyPath, KEY_READ) == ERROR_SUCCESS) + key.QueryValue(valuePath, res); } -void SaveRegEditor(const UString &editorPath) -{ - CKey key; - key.Create(HKEY_CURRENT_USER, kCU_FMPath); - key.SetValue(kEditor, editorPath); -} +void SaveRegLang(const UString &path) { SaveCuString(kCUBasePath, kLangValueName, path); } +void ReadRegLang(UString &path) { ReadCuString(kCUBasePath, kLangValueName, path); } -void ReadRegEditor(UString &editorPath) -{ - editorPath.Empty(); - CKey key; - if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS) - key.QueryValue(kEditor, editorPath); -} +void SaveRegEditor(const UString &path) { SaveCuString(kCU_FMPath, kEditor, path); } +void ReadRegEditor(UString &path) { ReadCuString(kCU_FMPath, kEditor, path); } + +void SaveRegDiff(const UString &path) { SaveCuString(kCU_FMPath, kDiff, path); } +void ReadRegDiff(UString &path) { ReadCuString(kCU_FMPath, kDiff, path); } static void Save7ZipOption(const TCHAR *value, bool enabled) { @@ -154,8 +151,8 @@ bool ReadLockMemoryEnable() { return Read7ZipOption(kLargePagesEnable, false); } static CSysString GetFlatViewName(UInt32 panelIndex) { - TCHAR panelString[32]; - ConvertUInt64ToString(panelIndex, panelString); + TCHAR panelString[16]; + ConvertUInt32ToString(panelIndex, panelString); return (CSysString)kFlatViewName + panelString; } diff --git a/CPP/7zip/UI/FileManager/RegistryUtils.h b/CPP/7zip/UI/FileManager/RegistryUtils.h index 9b9c91cf..5469f401 100755 --- a/CPP/7zip/UI/FileManager/RegistryUtils.h +++ b/CPP/7zip/UI/FileManager/RegistryUtils.h @@ -1,15 +1,18 @@ // RegistryUtils.h -#include "Common/StringConvert.h" +#ifndef __REGISTRY_UTILS_H +#define __REGISTRY_UTILS_H -#ifndef __REGISTRYUTILS_H -#define __REGISTRYUTILS_H +#include "Common/MyString.h" -void SaveRegLang(const UString &langFile); -void ReadRegLang(UString &langFile); +void SaveRegLang(const UString &path); +void ReadRegLang(UString &path); -void SaveRegEditor(const UString &editorPath); -void ReadRegEditor(UString &editorPath); +void SaveRegEditor(const UString &path); +void ReadRegEditor(UString &path); + +void SaveRegDiff(const UString &path); +void ReadRegDiff(UString &path); void SaveShowDots(bool showDots); bool ReadShowDots(); diff --git a/CPP/7zip/UI/FileManager/RootFolder.cpp b/CPP/7zip/UI/FileManager/RootFolder.cpp index 1cb71e5f..ea6f5080 100755 --- a/CPP/7zip/UI/FileManager/RootFolder.cpp +++ b/CPP/7zip/UI/FileManager/RootFolder.cpp @@ -2,32 +2,28 @@ #include "StdAfx.h" -#include "resource.h" +#include "Common/StringConvert.h" -#include "RootFolder.h" +#include "Windows/PropVariant.h" -#include "Common/StringConvert.h" #include "../../PropID.h" -#include "Windows/Defs.h" -#include "Windows/PropVariant.h" #include "FSDrives.h" -#include "PhysDriveFolder.h" +#include "FSFolder.h" +#include "LangUtils.h" #include "NetFolder.h" +#include "RootFolder.h" #include "SysIconUtils.h" -#include "LangUtils.h" -using namespace NWindows; +#include "resource.h" +using namespace NWindows; -static const STATPROPSTG kProperties[] = +static const STATPROPSTG kProps[] = { { NULL, kpidName, VT_BSTR} }; -// static const wchar_t *kMyComputerTitle = L"Computer"; -// static const wchar_t *kMyNetworkTitle = L"Network"; - UString RootFolder_GetName_Computer(int &iconIndex) { iconIndex = GetIconIndexForCSIDL(CSIDL_DRIVES); @@ -49,12 +45,17 @@ UString RootFolder_GetName_Documents(int &iconIndex) const int ROOT_INDEX_COMPUTER = 0; const int ROOT_INDEX_DOCUMENTS = 1; const int ROOT_INDEX_NETWORK = 2; +const int ROOT_INDEX_VOLUMES = 3; + +static const wchar_t *kVolPrefix = L"\\\\.\\"; void CRootFolder::Init() { _names[ROOT_INDEX_COMPUTER] = RootFolder_GetName_Computer(_iconIndices[ROOT_INDEX_COMPUTER]); _names[ROOT_INDEX_DOCUMENTS] = RootFolder_GetName_Documents(_iconIndices[ROOT_INDEX_DOCUMENTS]); _names[ROOT_INDEX_NETWORK] = RootFolder_GetName_Network(_iconIndices[ROOT_INDEX_NETWORK]); + _names[ROOT_INDEX_VOLUMES] = kVolPrefix; + _iconIndices[ROOT_INDEX_VOLUMES] = GetIconIndexForCSIDL(CSIDL_DRIVES); }; STDMETHODIMP CRootFolder::LoadItems() @@ -109,19 +110,19 @@ UString GetMyDocsPath() STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder) { - if (index == ROOT_INDEX_COMPUTER) + *resultFolder = NULL; + CMyComPtr<IFolderFolder> subFolder; + if (index == ROOT_INDEX_COMPUTER || index == ROOT_INDEX_VOLUMES) { CFSDrives *fsDrivesSpec = new CFSDrives; - CMyComPtr<IFolderFolder> subFolder = fsDrivesSpec; - fsDrivesSpec->Init(); - *resultFolder = subFolder.Detach(); + subFolder = fsDrivesSpec; + fsDrivesSpec->Init(index == ROOT_INDEX_VOLUMES); } else if (index == ROOT_INDEX_NETWORK) { CNetFolder *netFolderSpec = new CNetFolder; - CMyComPtr<IFolderFolder> subFolder = netFolderSpec; + subFolder = netFolderSpec; netFolderSpec->Init(0, 0, _names[ROOT_INDEX_NETWORK] + WCHAR_PATH_SEPARATOR); - *resultFolder = subFolder.Detach(); } else if (index == ROOT_INDEX_DOCUMENTS) { @@ -129,13 +130,13 @@ STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolde if (!s.IsEmpty()) { NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder; - CMyComPtr<IFolderFolder> subFolder = fsFolderSpec; + subFolder = fsFolderSpec; RINOK(fsFolderSpec->Init(s, NULL)); - *resultFolder = subFolder.Detach(); } } else return E_INVALIDARG; + *resultFolder = subFolder.Detach(); return S_OK; } @@ -178,11 +179,11 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu CMyComPtr<IFolderFolder> subFolder; - if (name2.Left(4) == L"\\\\.\\") + if (name2.Left(4) == kVolPrefix) { - CPhysDriveFolder *folderSpec = new CPhysDriveFolder; + CFSDrives *folderSpec = new CFSDrives; subFolder = folderSpec; - RINOK(folderSpec->Init(name2.Mid(4, 2))); + folderSpec->Init(true); } else { @@ -212,23 +213,7 @@ STDMETHODIMP CRootFolder::BindToParentFolder(IFolderFolder **resultFolder) return S_OK; } -STDMETHODIMP CRootFolder::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CRootFolder::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if (index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &prop = kProperties[index]; - *propID = prop.propid; - *varType = prop.vt; - *name = 0; - return S_OK; -} +IMP_IFolderFolder_Props(CRootFolder) STDMETHODIMP CRootFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) { @@ -242,7 +227,7 @@ STDMETHODIMP CRootFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) return S_OK; } -STDMETHODIMP CRootFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex) +STDMETHODIMP CRootFolder::GetSystemIconIndex(UInt32 index, Int32 *iconIndex) { *iconIndex = _iconIndices[index]; return S_OK; diff --git a/CPP/7zip/UI/FileManager/RootFolder.h b/CPP/7zip/UI/FileManager/RootFolder.h index f17a0783..9f08e601 100755 --- a/CPP/7zip/UI/FileManager/RootFolder.h +++ b/CPP/7zip/UI/FileManager/RootFolder.h @@ -1,34 +1,27 @@ // RootFolder.h -#ifndef __ROOTFOLDER_H -#define __ROOTFOLDER_H +#ifndef __ROOT_FOLDER_H +#define __ROOT_FOLDER_H #include "Common/MyString.h" -#include "Windows/PropVariant.h" +#include "IFolder.h" -#include "FSFolder.h" - -const int kNumRootFolderItems = 3; +const int kNumRootFolderItems = 4; class CRootFolder: public IFolderFolder, public IFolderGetSystemIconIndex, public CMyUnknownImp { -public: - MY_UNKNOWN_IMP1( - IFolderGetSystemIconIndex - ) + UString _names[kNumRootFolderItems]; + int _iconIndices[kNumRootFolderItems]; +public: + MY_UNKNOWN_IMP1(IFolderGetSystemIconIndex) INTERFACE_FolderFolder(;) - - STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex); - + STDMETHOD(GetSystemIconIndex)(UInt32 index, Int32 *iconIndex); void Init(); -private: - UString _names[kNumRootFolderItems]; - int _iconIndices[kNumRootFolderItems]; }; #endif diff --git a/CPP/7zip/UI/FileManager/SysIconUtils.cpp b/CPP/7zip/UI/FileManager/SysIconUtils.cpp index 5af6f850..3e5de7aa 100755 --- a/CPP/7zip/UI/FileManager/SysIconUtils.cpp +++ b/CPP/7zip/UI/FileManager/SysIconUtils.cpp @@ -131,10 +131,7 @@ int CExtToIconMap::GetIconIndex(UINT32 attributes, const UString &fileNameSpec, { fileName = L"__File__"; if (_noExtIconIndex < 0) - { - int iconIndexTemp; - GetRealIconIndex(fileName, attributes, iconIndexTemp, _noExtTypeName); - } + GetRealIconIndex(fileName, attributes, _noExtIconIndex, _noExtTypeName); typeName = _noExtTypeName; return _noExtIconIndex; } diff --git a/CPP/7zip/UI/FileManager/SystemPage.cpp b/CPP/7zip/UI/FileManager/SystemPage.cpp index f8605ea8..1cd7ce15 100755 --- a/CPP/7zip/UI/FileManager/SystemPage.cpp +++ b/CPP/7zip/UI/FileManager/SystemPage.cpp @@ -52,7 +52,7 @@ bool CSystemPage::OnInit() _listViewExt.SetExtendedListViewStyle(newFlags, newFlags); _listViewPlugins.SetExtendedListViewStyle(newFlags, newFlags); - _listViewExt.InsertColumn(0, LangString(IDS_PROPERTY_EXTENSION, 0x02000205), 70); + _listViewExt.InsertColumn(0, LangString(IDS_PROP_EXTENSION, 0x02000205), 70); const UString s = LangString(IDS_PLUGIN, 0x03010310); _listViewExt.InsertColumn(1, s, 70); diff --git a/CPP/7zip/UI/FileManager/SystemPage.rc b/CPP/7zip/UI/FileManager/SystemPage.rc index 1cf9405f..9b4e808d 100755 --- a/CPP/7zip/UI/FileManager/SystemPage.rc +++ b/CPP/7zip/UI/FileManager/SystemPage.rc @@ -1,12 +1,11 @@ #include "SystemPageRes.h" #include "../../GuiCommon.rc" -#define xSize2 238 -#define ySize2 214 +#define xSize2 196 +#define ySize2 200 #define xSize (xSize2 + marg + marg) #define ySize (ySize2 + marg + marg) -#define gSpace 30 -#define g0Size 160 +#define g0Size xSize2 #define gYSize (ySize2 - 20 - bYSize) diff --git a/CPP/7zip/UI/FileManager/TextPairs.cpp b/CPP/7zip/UI/FileManager/TextPairs.cpp index 74df1c62..cc57c0d5 100755 --- a/CPP/7zip/UI/FileManager/TextPairs.cpp +++ b/CPP/7zip/UI/FileManager/TextPairs.cpp @@ -1,28 +1,20 @@ -// Common/TextPairs.cpp +// TextPairs.cpp #include "StdAfx.h" #include "TextPairs.h" -#include "Common/Defs.h" -#include "Common/UTFConvert.h" - static const wchar_t kNewLineChar = '\n'; +static const wchar_t kQuoteChar = '\"'; -static const wchar_t kSpaceChar = ' '; -static const wchar_t kTabChar = '\t'; - -static const wchar_t kQuoteChar = '\"'; -static const wchar_t kEndOfLine = '\0'; - -static const wchar_t kBOM = wchar_t(0xFEFF); +static const wchar_t kBOM = (wchar_t)0xFEFF; static bool IsSeparatorChar(wchar_t c) { - return (c == kSpaceChar || c == kTabChar); + return (c == ' ' || c == '\t'); } -void RemoveCr(UString &s) +static void RemoveCr(UString &s) { s.Replace(L"\x0D", L""); } @@ -34,7 +26,7 @@ static UString GetIDString(const wchar_t *srcString, int &finishPos) for (finishPos = 0;;) { wchar_t c = srcString[finishPos]; - if (c == kEndOfLine) + if (c == 0) break; finishPos++; bool isSeparatorChar = IsSeparatorChar(c); @@ -57,7 +49,7 @@ static UString GetValueString(const wchar_t *srcString, int &finishPos) for (finishPos = 0;;) { wchar_t c = srcString[finishPos]; - if (c == kEndOfLine) + if (c == 0) break; finishPos++; if (c == kNewLineChar) @@ -99,42 +91,22 @@ static bool GetTextPairs(const UString &srcString, CObjectVector<CTextPair> &pai return true; } -int FindItem(const CObjectVector<CTextPair> &pairs, const UString &id) -{ - for (int i = 0; i < pairs.Size(); i++) - if (pairs[i].ID.CompareNoCase(id) == 0) - return i; - return -1; -} - -UString GetTextConfigValue(const CObjectVector<CTextPair> &pairs, const UString &id) -{ - int index = FindItem(pairs, id); - if (index < 0) - return UString(); - return pairs[index].Value; -} - static int ComparePairIDs(const UString &s1, const UString &s2) { return s1.CompareNoCase(s2); } static int ComparePairItems(const CTextPair &p1, const CTextPair &p2) { return ComparePairIDs(p1.ID, p2.ID); } -// typedef void* MY_PVOID; - -// static int ComparePairItems(const MY_PVOID *a1, const MY_PVOID *a2, void *param) static int ComparePairItems(void *const *a1, void *const *a2, void * /* param */) { return ComparePairItems(**(const CTextPair **)a1, **(const CTextPair **)a2); } -void CPairsStorage::Sort() - { Pairs.Sort(ComparePairItems, 0); } +void CPairsStorage::Sort() { Pairs.Sort(ComparePairItems, 0); } int CPairsStorage::FindID(const UString &id, int &insertPos) { int left = 0, right = Pairs.Size(); while (left != right) { - UINT32 mid = (left + right) / 2; + int mid = (left + right) / 2; int compResult = ComparePairIDs(id, Pairs[mid].ID); if (compResult == 0) return mid; diff --git a/CPP/7zip/UI/FileManager/TextPairs.h b/CPP/7zip/UI/FileManager/TextPairs.h index b75d9c72..2670e030 100755 --- a/CPP/7zip/UI/FileManager/TextPairs.h +++ b/CPP/7zip/UI/FileManager/TextPairs.h @@ -1,7 +1,7 @@ -// Common/TextPairs.h +// TextPairs.h -#ifndef __COMMON_TEXTPAIRS_H -#define __COMMON_TEXTPAIRS_H +#ifndef __FM_TEXT_PAIRS_H +#define __FM_TEXT_PAIRS_H #include "Common/MyString.h" diff --git a/CPP/7zip/UI/FileManager/UpdateCallback100.cpp b/CPP/7zip/UI/FileManager/UpdateCallback100.cpp index e23c7d34..3701d2bb 100755 --- a/CPP/7zip/UI/FileManager/UpdateCallback100.cpp +++ b/CPP/7zip/UI/FileManager/UpdateCallback100.cpp @@ -1,17 +1,10 @@ -// UpdateCallback.h +// UpdateCallback100.cpp #include "StdAfx.h" -#include "Common/StringConvert.h" - -#include "UpdateCallback100.h" -// #include "Windows/ProcessMessages.h" -// #include "Resource/PasswordDialog/PasswordDialog.h" #include "MessagesDialog.h" - -#include "Common/Defs.h" - -using namespace NWindows; +#include "PasswordDialog.h" +#include "UpdateCallback100.h" CUpdateCallback100Imp::~CUpdateCallback100Imp() { @@ -81,19 +74,10 @@ STDMETHODIMP CUpdateCallback100Imp::UpdateErrorMessage(const wchar_t *message) STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password) { + *password = NULL; *passwordIsDefined = BoolToInt(_passwordIsDefined); if (!_passwordIsDefined) - { return S_OK; - /* - CPasswordDialog dialog; - if (dialog.Create(_parentWindow) == IDCANCEL) - return E_ABORT; - _password = dialog._password; - _passwordIsDefined = true; - */ - } - *passwordIsDefined = BoolToInt(_passwordIsDefined); return StringToBstr(_password, password); } @@ -109,7 +93,14 @@ STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 * /* files */, con STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword(BSTR *password) { + *password = NULL; if (!_passwordIsDefined) - return S_FALSE; + { + CPasswordDialog dialog; + if (dialog.Create(_parentWindow) == IDCANCEL) + return E_ABORT; + _password = dialog.Password; + _passwordIsDefined = true; + } return StringToBstr(_password, password); } diff --git a/CPP/7zip/UI/FileManager/ViewSettings.cpp b/CPP/7zip/UI/FileManager/ViewSettings.cpp index 6c611dad..0f98c217 100755 --- a/CPP/7zip/UI/FileManager/ViewSettings.cpp +++ b/CPP/7zip/UI/FileManager/ViewSettings.cpp @@ -297,8 +297,8 @@ UInt32 ReadToolbarsMask() static UString GetPanelPathName(UInt32 panelIndex) { - WCHAR panelString[32]; - ConvertUInt64ToString(panelIndex, panelString); + WCHAR panelString[16]; + ConvertUInt32ToString(panelIndex, panelString); return UString(kPanelPathValueName) + panelString; } diff --git a/CPP/7zip/UI/FileManager/makefile b/CPP/7zip/UI/FileManager/makefile index 86bdd85f..fea2d39a 100755 --- a/CPP/7zip/UI/FileManager/makefile +++ b/CPP/7zip/UI/FileManager/makefile @@ -5,6 +5,7 @@ CFLAGS = $(CFLAGS) -I ../../../ \ -DWIN_LONG_PATH \ -DNEW_FOLDER_INTERFACE \ -DEXTERNAL_CODECS \ + -DSUPPORT_DEVICE_FILE \ FM_OBJS = \ $O\App.obj \ @@ -38,7 +39,6 @@ FM_OBJS = \ $O\PanelSelect.obj \ $O\PanelSort.obj \ $O\PanelSplitFile.obj \ - $O\PhysDriveFolder.obj \ $O\ProgramLocation.obj \ $O\PropertyName.obj \ $O\RegistryAssociations.obj \ @@ -85,7 +85,6 @@ WIN_OBJS = \ $O\CommonDialog.obj \ $O\DLL.obj \ $O\Error.obj \ - $O\FileDevice.obj \ $O\FileDir.obj \ $O\FileFind.obj \ $O\FileIO.obj \ @@ -138,6 +137,9 @@ UI_COMMON_OBJS = \ $O\WorkDir.obj \ $O\ZipRegistry.obj \ +AR_COMMON_OBJS = \ + $O\OutStreamWithCRC.obj \ + AGENT_OBJS = \ $O\Agent.obj \ $O\AgentOut.obj \ @@ -163,6 +165,7 @@ OBJS = \ $(WIN_CTRL_OBJS) \ $(7ZIP_COMMON_OBJS) \ $(UI_COMMON_OBJS) \ + $(AR_COMMON_OBJS) \ $(AGENT_OBJS) \ $O\CopyCoder.obj \ $(CRC_OBJS) \ @@ -183,6 +186,8 @@ $(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp $(COMPL) $(UI_COMMON_OBJS): ../Common/$(*B).cpp $(COMPL) +$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp + $(COMPL) $(AGENT_OBJS): ../Agent/$(*B).cpp $(COMPL) diff --git a/CPP/7zip/UI/FileManager/resource.h b/CPP/7zip/UI/FileManager/resource.h index edd351b6..72121c89 100755 --- a/CPP/7zip/UI/FileManager/resource.h +++ b/CPP/7zip/UI/FileManager/resource.h @@ -17,6 +17,7 @@ #define IDM_FILE_PROPERTIES 240 #define IDM_FILE_COMMENT 241 #define IDM_FILE_CRC 242 +#define IDM_FILE_DIFF 243 #define IDM_CREATE_FOLDER 250 #define IDM_CREATE_FILE 251 #define IDM_EDIT_CUT 320 @@ -128,12 +129,12 @@ #define IDS_BUTTON_MOVE 2421 #define IDS_BUTTON_DELETE 2422 #define IDS_BUTTON_INFO 2423 -#define IDS_PROPERTY_TOTAL_SIZE 3100 -#define IDS_PROPERTY_FREE_SPACE 3101 -#define IDS_PROPERTY_CLUSTER_SIZE 3102 -#define IDS_PROPERTY_VOLUME_NAME 3103 -#define IDS_PROPERTY_LOCAL_NAME 3200 -#define IDS_PROPERTY_PROVIDER 3201 +#define IDS_PROP_TOTAL_SIZE 3100 +#define IDS_PROP_FREE_SPACE 3101 +#define IDS_PROP_CLUSTER_SIZE 3102 +#define IDS_PROP_VOLUME_NAME 3103 +#define IDS_PROP_LOCAL_NAME 3200 +#define IDS_PROP_PROVIDER 3201 #define IDS_OPTIONS 4000 #define IDS_COMMENT 4001 #define IDS_COMMENT2 4002 diff --git a/CPP/7zip/UI/FileManager/resource.rc b/CPP/7zip/UI/FileManager/resource.rc index 3ec3bb32..cdfed0b6 100755 --- a/CPP/7zip/UI/FileManager/resource.rc +++ b/CPP/7zip/UI/FileManager/resource.rc @@ -34,6 +34,7 @@ BEGIN MENUITEM "P&roperties\tAlt+Enter", IDM_FILE_PROPERTIES MENUITEM "Comme&nt\tCtrl+Z", IDM_FILE_COMMENT MENUITEM "Calculate checksum", IDM_FILE_CRC + MENUITEM "Di&ff", IDM_FILE_DIFF MENUITEM SEPARATOR MENUITEM "Create Folder\tF7", IDM_CREATE_FOLDER MENUITEM "Create File\tCtrl+N", IDM_CREATE_FILE @@ -190,12 +191,12 @@ BEGIN IDS_FOLDERS_COLON "Folders:" IDS_SIZE_COLON "Size:" - IDS_PROPERTY_TOTAL_SIZE "Total Size" - IDS_PROPERTY_FREE_SPACE "Free Space" - IDS_PROPERTY_CLUSTER_SIZE "Cluster Size" - IDS_PROPERTY_VOLUME_NAME "Label" - IDS_PROPERTY_LOCAL_NAME "Local Name" - IDS_PROPERTY_PROVIDER "Provider" + IDS_PROP_TOTAL_SIZE "Total Size" + IDS_PROP_FREE_SPACE "Free Space" + IDS_PROP_CLUSTER_SIZE "Cluster Size" + IDS_PROP_VOLUME_NAME "Label" + IDS_PROP_LOCAL_NAME "Local Name" + IDS_PROP_PROVIDER "Provider" IDS_OPTIONS "Options" IDS_COMMENT "Comment" IDS_COMMENT2 "&Comment:" |