diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2009-12-14 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:01 +0300 |
commit | 1fbaf0aac5000ca563a1ee2bb15ba6821a08e468 (patch) | |
tree | ec079944edffd096355ecb0c499f889364aefb4b /CPP/7zip/UI/FileManager | |
parent | 2fed8721946901375d21d4a506fe8b114045b397 (diff) |
9.09 beta
Diffstat (limited to 'CPP/7zip/UI/FileManager')
-rwxr-xr-x | CPP/7zip/UI/FileManager/FM.dsp | 54 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/FSFolder.h | 2 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/MyCom2.h | 13 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/PanelItemOpen.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/PhysDriveFolder.cpp | 295 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/PhysDriveFolder.h | 59 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/ProgressDialog2.cpp | 15 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/ProgressDialog2.h | 1 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/makefile | 7 |
9 files changed, 75 insertions, 373 deletions
diff --git a/CPP/7zip/UI/FileManager/FM.dsp b/CPP/7zip/UI/FileManager/FM.dsp index 615043b5..f8ec9364 100755 --- a/CPP/7zip/UI/FileManager/FM.dsp +++ b/CPP/7zip/UI/FileManager/FM.dsp @@ -660,6 +660,31 @@ SOURCE=..\..\..\..\C\7zCrc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\7zCrcOpt.c + +!IF "$(CFG)" == "FM - Win32 Release" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 Debug" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 ReleaseU" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 DebugU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ENDIF + +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Alloc.c # SUBTRACT CPP /YX /Yc /Yu # End Source File @@ -669,6 +694,35 @@ SOURCE=..\..\..\..\C\Alloc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\CpuArch.c + +!IF "$(CFG)" == "FM - Win32 Release" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 Debug" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 ReleaseU" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 DebugU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\CpuArch.h +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Sha256.c !IF "$(CFG)" == "FM - Win32 Release" diff --git a/CPP/7zip/UI/FileManager/FSFolder.h b/CPP/7zip/UI/FileManager/FSFolder.h index 42e33242..e39004ad 100755 --- a/CPP/7zip/UI/FileManager/FSFolder.h +++ b/CPP/7zip/UI/FileManager/FSFolder.h @@ -50,7 +50,7 @@ class CFSFolder: { UInt64 GetSizeOfItem(int anIndex) const; public: - MY_QUERYINTERFACE_BEGIN + MY_QUERYINTERFACE_BEGIN2(IFolderFolder) MY_QUERYINTERFACE_ENTRY(IFolderWasChanged) // MY_QUERYINTERFACE_ENTRY(IFolderOperationsDeleteToRecycleBin) MY_QUERYINTERFACE_ENTRY(IFolderOperations) diff --git a/CPP/7zip/UI/FileManager/MyCom2.h b/CPP/7zip/UI/FileManager/MyCom2.h index 756a8169..98b1d708 100755 --- a/CPP/7zip/UI/FileManager/MyCom2.h +++ b/CPP/7zip/UI/FileManager/MyCom2.h @@ -10,23 +10,14 @@ STDMETHOD_(ULONG, AddRef)() { InterlockedIncrement((LONG *)&__m_RefCount); retur STDMETHOD_(ULONG, Release)() { InterlockedDecrement((LONG *)&__m_RefCount); if (__m_RefCount != 0) \ return __m_RefCount; delete this; return 0; } -#define MY_UNKNOWN_IMP_SPEC_MT(i) \ - MY_QUERYINTERFACE_BEGIN \ - MY_QUERYINTERFACE_ENTRY(IUnknown) \ - i \ - MY_QUERYINTERFACE_END \ - MY_ADDREF_RELEASE_MT - #define MY_UNKNOWN_IMP_SPEC_MT2(i1, i) \ MY_QUERYINTERFACE_BEGIN \ - if (iid == IID_IUnknown) \ - { *outObject = (void *)(IUnknown *)(i1 *)this; AddRef(); return S_OK; } i \ + MY_QUERYINTERFACE_ENTRY_UNKNOWN(i1) \ + i \ MY_QUERYINTERFACE_END \ MY_ADDREF_RELEASE_MT -#define MY_UNKNOWN_IMP_MT MY_UNKNOWN_IMP_SPEC_MT(;) - #define MY_UNKNOWN_IMP1_MT(i) MY_UNKNOWN_IMP_SPEC_MT2( \ i, \ MY_QUERYINTERFACE_ENTRY(i) \ diff --git a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp index 2deea0af..b77d3e2a 100755 --- a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp +++ b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp @@ -172,7 +172,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"msg", L"dwf", L"flv", L"swf", diff --git a/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp b/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp deleted file mode 100755 index 12b7dce8..00000000 --- a/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp +++ /dev/null @@ -1,295 +0,0 @@ -// PhysDriveFolder.cpp - -#include "StdAfx.h" - -#include "../../../../C/Alloc.h" - -#include "Common/Buffer.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}, - { NULL, kpidSize, VT_UI8} -}; - -HRESULT CPhysDriveFolder::Init(const UString &path) -{ - _prefix = L"\\\\.\\"; - _path = path; - NFile::NDevice::CInFile inFile; - if (!inFile.Open(GetFullPath())) - return GetLastError(); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::LoadItems() -{ - _driveType = NFile::NSystem::MyGetDriveType(_path + L"\\"); - _name = _path.Left(1); - _name += L'.'; - if (_driveType == DRIVE_CDROM) - _name += L"iso"; - else - _name += L"img"; - Int32 dummy; - WasChanged(&dummy); - return GetLength(_length); -} - -STDMETHODIMP CPhysDriveFolder::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = 1; - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value) -{ - NCOM::CPropVariant prop; - if (itemIndex >= 1) - return E_INVALIDARG; - switch(propID) - { - case kpidIsDir: prop = false; break; - case kpidName: prop = _name; break; - case kpidSize: prop = _length; break; - } - prop.Detach(value); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::BindToFolder(UInt32 /* index */, IFolderFolder ** /* resultFolder */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::BindToFolder(const wchar_t * /* name */, IFolderFolder ** /* resultFolder */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::BindToParentFolder(IFolderFolder **resultFolder) -{ - *resultFolder = 0; - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::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 CPhysDriveFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant prop; - switch(propID) - { - case kpidType: prop = L"PhysDrive"; break; - case kpidPath: prop = (GetFullPath() + L"\\"); break; - } - prop.Detach(value); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::WasChanged(Int32 *wasChanged) -{ - bool wasChangedMain = false; - *wasChanged = BoolToInt(wasChangedMain); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::Clone(IFolderFolder **resultFolder) -{ - CPhysDriveFolder *folderSpec = new CPhysDriveFolder; - CMyComPtr<IFolderFolder> folderNew = folderSpec; - folderSpec->Init(_path); - *resultFolder = folderNew.Detach(); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress * /* progress */) -{ - NCOM::CPropVariant prop; - if (index >= 1) - return E_INVALIDARG; - UInt64 size = 0; - HRESULT result = GetLength(size); - prop = size; - prop.Detach(value); - return result; -} - -STDMETHODIMP CPhysDriveFolder::CreateFolder(const wchar_t * /* name */, IProgress * /* progress */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::CreateFile(const wchar_t * /* name */, IProgress * /* progress */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::Rename(UInt32 /* index */, const wchar_t * /* newName */, IProgress * /* progress */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::Delete(const UInt32 * /* indices */, UInt32 /* numItems */, IProgress * /* progress */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::SetProperty(UInt32 index, PROPID /* propID */, - const PROPVARIANT * /* value */, IProgress * /* progress */) -{ - if (index >= 1) - return E_INVALIDARG; - return E_NOTIMPL; -} - -HRESULT CPhysDriveFolder::GetLength(UInt64 &length) const -{ - NFile::NDevice::CInFile inFile; - if (!inFile.Open(GetFullPath())) - return GetLastError(); - if (!inFile.GetLengthSmart(length)) - return GetLastError(); - return S_OK; -} - -struct CPhysTempBuffer -{ - void *buffer; - CPhysTempBuffer(): buffer(0) {} - ~CPhysTempBuffer() { MyFree(buffer); } -}; - -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 = MyAlloc(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; -} - -STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numItems, - const wchar_t *path, IFolderOperationsExtractCallback *callback) -{ - if (numItems == 0) - return S_OK; - 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; - } - else - destPath += _name; - - UInt64 fileSize; - if (GetLength(fileSize) == S_OK) - { - RINOK(callback->SetTotal(fileSize)); - } - - Int32 writeAskResult; - CMyComBSTR destPathResult; - RINOK(callback->AskWrite(GetFullPath(), BoolToInt(false), NULL, &fileSize, - destPath, &destPathResult, &writeAskResult)); - if (!IntToBool(writeAskResult)) - return S_OK; - - RINOK(callback->SetCurrentFilePath(GetFullPathWithName())); - - UInt32 bufferSize = (_driveType == DRIVE_REMOVABLE) ? (18 << 10) * 4 : kBufferSize; - return CopyFileSpec(GetFullPath(), destPathResult, false, fileSize, bufferSize, 0, callback); -} - -///////////////////////////////////////////////// -// Move Operations - -STDMETHODIMP CPhysDriveFolder::MoveTo( - const UInt32 * /* indices */, - UInt32 /* numItems */, - const wchar_t * /* path */, - IFolderOperationsExtractCallback * /* callback */) -{ - return E_NOTIMPL; -} - -STDMETHODIMP CPhysDriveFolder::CopyFrom( - const wchar_t * fromFolderPath, - const wchar_t ** itemsPaths, UInt32 numItems, IProgress *callback) -{ - if (numItems == 0) - return S_OK; - if (numItems != 1) - return E_INVALIDARG; - if (_driveType != DRIVE_REMOVABLE /* && _driveType != DRIVE_CDROM */) - 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, 0, callback); -} - diff --git a/CPP/7zip/UI/FileManager/PhysDriveFolder.h b/CPP/7zip/UI/FileManager/PhysDriveFolder.h deleted file mode 100755 index 64a36b91..00000000 --- a/CPP/7zip/UI/FileManager/PhysDriveFolder.h +++ /dev/null @@ -1,59 +0,0 @@ -// PhysDriveFolder.h - -#ifndef __PHYSDRIVEFOLDER_H -#define __PHYSDRIVEFOLDER_H - -#include "Common/MyString.h" -#include "Common/MyCom.h" -#include "../../Archive/IArchive.h" - -#include "IFolder.h" - -class CPhysDriveFolder: - public IFolderFolder, - public IFolderWasChanged, - public IFolderOperations, - public IFolderGetItemFullSize, - public IFolderClone, - // public IFolderGetSystemIconIndex, - public CMyUnknownImp -{ - UInt64 GetSizeOfItem(int anIndex) const; -public: - MY_QUERYINTERFACE_BEGIN - MY_QUERYINTERFACE_ENTRY(IFolderWasChanged) - MY_QUERYINTERFACE_ENTRY(IFolderOperations) - MY_QUERYINTERFACE_ENTRY(IFolderGetItemFullSize) - MY_QUERYINTERFACE_ENTRY(IFolderClone) - // MY_QUERYINTERFACE_ENTRY(IFolderGetSystemIconIndex) - MY_QUERYINTERFACE_END - MY_ADDREF_RELEASE - - - INTERFACE_FolderFolder(;) - INTERFACE_FolderOperations(;) - - STDMETHOD(WasChanged)(Int32 *wasChanged); - STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress); - STDMETHOD(Clone)(IFolderFolder **resultFolder); - - // STDMETHOD(GetSystemIconIndex)(UInt32 index, Int32 *iconIndex); - -private: - UString _name; - UString _prefix; - UString _path; - UString GetFullPath() const { return _prefix + _path; } - UString GetFullPathWithName() const { return GetFullPath() + L'\\' + _name; } - CMyComPtr<IFolderFolder> _parentFolder; - - UINT _driveType; - DISK_GEOMETRY geom; - UInt64 _length; - -public: - HRESULT Init(const UString &path); - HRESULT GetLength(UInt64 &size) const; -}; - -#endif diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp index 2c9996ab..313b6181 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp @@ -46,6 +46,7 @@ static CIDLangPair kIDLangPairs[] = { IDC_PROGRESS_RATIO, 0x02000C06 }, { IDC_PROGRESS_SPEED, 0x02000C04 }, { IDC_PROGRESS_FILES, 0x02000320 }, + { IDC_PROGRESS_ERRORS, 0x0308000A }, { IDC_BUTTON_PROGRESS_PRIORITY, 0x02000C10 }, { IDC_BUTTON_PAUSE, 0x02000C12 }, { IDCANCEL, 0x02000711 }, @@ -86,6 +87,7 @@ CProgressDialog::CProgressDialog(): _timer(0), CompressingMode(true) _externalCloseMessageWasReceived = false; _numPostedMessages = 0; + _numAutoSizeMessages = 0; _errorsWereDisplayed = false; _waitCloseByCancelButton = false; _cancelWasPressed = false; @@ -843,13 +845,19 @@ void CProgressDialog::AddMessage(LPCWSTR message) AddMessageDirect(s); } +static unsigned GetNumDigits(UInt32 value) +{ + unsigned i; + for (i = 0; value >= 10; i++) + value /= 10; + return i; +} + void CProgressDialog::UpdateMessagesDialog() { - int numMessages; UStringVector messages; { NWindows::NSynchronization::CCriticalSectionLock lock(Sync._cs); - numMessages = _numPostedMessages; for (int i = _numPostedMessages; i < Sync.Messages.Size(); i++) messages.Add(Sync.Messages[i]); _numPostedMessages = Sync.Messages.Size(); @@ -858,10 +866,11 @@ void CProgressDialog::UpdateMessagesDialog() { for (int i = 0; i < messages.Size(); i++) AddMessage(messages[i]); - if (numMessages < 128) + if (_numAutoSizeMessages < 256 || GetNumDigits(_numPostedMessages) > GetNumDigits(_numAutoSizeMessages)) { _messageList.SetColumnWidthAuto(0); _messageList.SetColumnWidthAuto(1); + _numAutoSizeMessages = _numPostedMessages; } } } diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.h b/CPP/7zip/UI/FileManager/ProgressDialog2.h index bbdc5afa..ed096f06 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.h +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.h @@ -237,6 +237,7 @@ private: bool _needClose; UInt32 _numPostedMessages; + UInt32 _numAutoSizeMessages; bool _errorsWereDisplayed; diff --git a/CPP/7zip/UI/FileManager/makefile b/CPP/7zip/UI/FileManager/makefile index d26aa04b..01016038 100755 --- a/CPP/7zip/UI/FileManager/makefile +++ b/CPP/7zip/UI/FileManager/makefile @@ -172,11 +172,12 @@ AGENT_OBJS = \ C_OBJS = \ $O\Alloc.obj \ + $O\CpuArch.obj \ $O\Sha256.obj \ $O\Sort.obj \ $O\Threads.obj \ -!include "../../Crc2.mak" +!include "../../Crc.mak" OBJS = \ $O\StdAfx.obj \ @@ -190,8 +191,8 @@ OBJS = \ $(EXPLORER_OBJS) \ $(AGENT_OBJS) \ $O\CopyCoder.obj \ - $(CRC_OBJS) \ $(C_OBJS) \ + $(ASM_OBJS) \ $O\resource.res \ !include "../../../Build.mak" @@ -220,4 +221,4 @@ $O\CopyCoder.obj: ../../Compress/$(*B).cpp $(C_OBJS): ../../../../C/$(*B).c $(COMPL_O2) -!include "../../Crc.mak" +!include "../../Asm.mak" |