4.54 beta

This commit is contained in:
Igor Pavlov
2007-09-04 00:00:00 +00:00
committed by Kornel Lesiński
parent 051769bbc5
commit b82f80647d
56 changed files with 558 additions and 202 deletions

View File

@@ -607,7 +607,9 @@ void CInArchive::ReadStreamsInfo(
for (;;) for (;;)
{ {
UInt64 type = ReadID(); UInt64 type = ReadID();
switch(type) if (type > ((UInt32)1 << 30))
ThrowIncorrect();
switch((UInt32)type)
{ {
case NID::kEnd: case NID::kEnd:
return; return;
@@ -627,6 +629,8 @@ void CInArchive::ReadStreamsInfo(
unPackSizes, digestsDefined, digests); unPackSizes, digestsDefined, digests);
break; break;
} }
default:
ThrowIncorrect();
} }
} }
} }
@@ -664,7 +668,7 @@ void CInArchive::ReadBoolVector2(int numItems, CBoolVector &v)
} }
void CInArchive::ReadTime(const CObjectVector<CByteBuffer> &dataVector, void CInArchive::ReadTime(const CObjectVector<CByteBuffer> &dataVector,
CObjectVector<CFileItem> &files, UInt64 type) CObjectVector<CFileItem> &files, UInt32 type)
{ {
CBoolVector boolVector; CBoolVector boolVector;
ReadBoolVector2(files.Size(), boolVector); ReadBoolVector2(files.Size(), boolVector);
@@ -881,8 +885,10 @@ HRESULT CInArchive::ReadHeader(
if (type == NID::kEnd) if (type == NID::kEnd)
break; break;
UInt64 size = ReadNumber(); UInt64 size = ReadNumber();
database.ArchiveInfo.FileInfoPopIDs.Add(type); bool isKnownType = true;
switch(type) if (type > ((UInt32)1 << 30))
isKnownType = false;
else switch((UInt32)type)
{ {
case NID::kName: case NID::kName:
{ {
@@ -951,15 +957,16 @@ HRESULT CInArchive::ReadHeader(
case NID::kLastWriteTime: case NID::kLastWriteTime:
case NID::kLastAccessTime: case NID::kLastAccessTime:
{ {
ReadTime(dataVector, database.Files, type); ReadTime(dataVector, database.Files, (UInt32)type);
break; break;
} }
default: default:
{ isKnownType = false;
database.ArchiveInfo.FileInfoPopIDs.DeleteBack();
SkeepData(size);
}
} }
if (isKnownType)
database.ArchiveInfo.FileInfoPopIDs.Add(type);
else
SkeepData(size);
} }
CNum emptyFileIndex = 0; CNum emptyFileIndex = 0;

View File

@@ -194,7 +194,7 @@ private:
void ReadBoolVector(int numItems, CBoolVector &v); void ReadBoolVector(int numItems, CBoolVector &v);
void ReadBoolVector2(int numItems, CBoolVector &v); void ReadBoolVector2(int numItems, CBoolVector &v);
void ReadTime(const CObjectVector<CByteBuffer> &dataVector, void ReadTime(const CObjectVector<CByteBuffer> &dataVector,
CObjectVector<CFileItem> &files, UInt64 type); CObjectVector<CFileItem> &files, UInt32 type);
HRESULT ReadAndDecodePackedStreams( HRESULT ReadAndDecodePackedStreams(
DECL_EXTERNAL_CODECS_LOC_VARS DECL_EXTERNAL_CODECS_LOC_VARS
UInt64 baseOffset, UInt64 &dataOffset, UInt64 baseOffset, UInt64 &dataOffset,

View File

@@ -104,7 +104,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
prop = (UInt32)numBlocks; prop = (UInt32)numBlocks;
break; break;
} }
case kpidNumVolumes: prop = (UInt32)(_archives.Size() - 1); case kpidNumVolumes: prop = (UInt32)_archives.Size();
// case kpidCommented: prop = _archiveInfo.IsCommented(); break; // case kpidCommented: prop = _archiveInfo.IsCommented(); break;
} }

View File

@@ -1,4 +1,4 @@
/ Tar/Handler.cpp // Tar/Handler.cpp
#include "StdAfx.h" #include "StdAfx.h"

View File

@@ -219,7 +219,7 @@ HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item)
item.LongLinkSize = item.HeaderPosition - headerPosition; item.LongLinkSize = item.HeaderPosition - headerPosition;
item.HeaderPosition = headerPosition; item.HeaderPosition = headerPosition;
} }
else if (item.LinkFlag == 'g' || item.LinkFlag == 'x') else if (item.LinkFlag == 'g' || item.LinkFlag == 'x' || item.LinkFlag == 'X')
{ {
// pax Extended Header // pax Extended Header
return S_OK; return S_OK;

View File

@@ -25,7 +25,16 @@ public:
return false; return false;
pos += _bufferSize; pos += _bufferSize;
} }
do if (_limitPos - _pos > len && _bufferSize - pos > len)
{
const Byte *src = _buffer + pos;
Byte *dest = _buffer + _pos;
_pos += len;
do
*dest++ = *src++;
while(--len != 0);
}
else do
{ {
if (pos == _bufferSize) if (pos == _bufferSize)
pos = 0; pos = 0;

View File

@@ -159,7 +159,7 @@ int main2(int n, const char *args[])
g_IsNT = IsItWindowsNT(); g_IsNT = IsItWindowsNT();
#endif #endif
fprintf(stderr, "\nLZMA 4.49 Copyright (c) 1999-2007 Igor Pavlov 2007-07-05\n"); fprintf(stderr, "\nLZMA 4.54 Copyright (c) 1999-2007 Igor Pavlov 2007-09-04\n");
if (n == 1) if (n == 1)
{ {

View File

@@ -448,7 +448,7 @@ UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq,
UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations) UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations)
{ {
// UInt64 numCommands = (inSize * 216 + outSize * 14) * numIterations; // AMD K8 // UInt64 numCommands = (inSize * 216 + outSize * 14) * numIterations; // AMD K8
UInt64 numCommands = (inSize * 220 + outSize * 14) * numIterations; // Intel Core2 UInt64 numCommands = (inSize * 220 + outSize * 8) * numIterations; // Intel Core2
return MyMultDiv64(numCommands, elapsedTime, freq); return MyMultDiv64(numCommands, elapsedTime, freq);
} }

View File

@@ -266,13 +266,26 @@ public:
{ {
_lzSize += len; _lzSize += len;
UInt32 pos = (_winPos - distance - 1) & kWindowMask; UInt32 pos = (_winPos - distance - 1) & kWindowMask;
Byte *window = _window;
UInt32 winPos = _winPos;
if (kWindowSize - winPos > len && kWindowSize - pos > len)
{
const Byte *src = window + pos;
Byte *dest = window + winPos;
_winPos += len;
do
*dest++ = *src++;
while(--len != 0);
return;
}
do do
{ {
_window[_winPos] = _window[pos]; window[winPos] = window[pos];
_winPos = (_winPos + 1) & kWindowMask; winPos = (winPos + 1) & kWindowMask;
pos = (pos + 1) & kWindowMask; pos = (pos + 1) & kWindowMask;
} }
while(--len != 0); while(--len != 0);
_winPos = winPos;
} }
void PutByte(Byte b) void PutByte(Byte b)

View File

@@ -1,8 +1,8 @@
#define MY_VER_MAJOR 4 #define MY_VER_MAJOR 4
#define MY_VER_MINOR 53 #define MY_VER_MINOR 54
#define MY_VER_BUILD 3 #define MY_VER_BUILD 0
#define MY_VERSION "4.53 beta" #define MY_VERSION "4.54 beta"
#define MY_7ZIP_VERSION "7-Zip 4.53 beta" #define MY_7ZIP_VERSION "7-Zip 4.54 beta"
#define MY_DATE "2007-08-27" #define MY_DATE "2007-09-04"
#define MY_COPYRIGHT "Copyright (c) 1999-2007 Igor Pavlov" #define MY_COPYRIGHT "Copyright (c) 1999-2007 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE

View File

@@ -2,8 +2,7 @@
#include "StdAfx.h" #include "StdAfx.h"
#include <initguid.h> #include "Common/MyInitGuid.h"
#include "Common/StringConvert.h" #include "Common/StringConvert.h"
#include "Common/IntToString.h" #include "Common/IntToString.h"
@@ -45,6 +44,7 @@ typedef UINT32 (WINAPI * CreateObjectFunc)(
const GUID *interfaceID, const GUID *interfaceID,
void **outObject); void **outObject);
#ifdef _WIN32
#ifndef _UNICODE #ifndef _UNICODE
bool g_IsNT = false; bool g_IsNT = false;
static inline bool IsItWindowsNT() static inline bool IsItWindowsNT()
@@ -56,6 +56,7 @@ static inline bool IsItWindowsNT()
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
} }
#endif #endif
#endif
void PrintString(const UString &s) void PrintString(const UString &s)
{ {
@@ -678,9 +679,11 @@ __cdecl
#endif #endif
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
#ifdef _WIN32
#ifndef _UNICODE #ifndef _UNICODE
g_IsNT = IsItWindowsNT(); g_IsNT = IsItWindowsNT();
#endif #endif
#endif
PrintStringLn(kCopyrightString); PrintStringLn(kCopyrightString);

View File

@@ -262,13 +262,11 @@ static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
return true; return true;
} }
static inline UINT GetCurrentCodePage() { return AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor, static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor,
LPCWSTR fileName, bool include, NRecursedType::EEnum type, UINT codePage) LPCWSTR fileName, bool include, NRecursedType::EEnum type, UINT codePage)
{ {
UStringVector names; UStringVector names;
if (!ReadNamesFromListFile(GetSystemString(fileName, GetCurrentCodePage()), names, codePage)) if (!ReadNamesFromListFile(fileName, names, codePage))
throw kIncorrectListFile; throw kIncorrectListFile;
for (int i = 0; i < names.Size(); i++) for (int i = 0; i < names.Size(); i++)
if (!AddNameToCensor(wildcardCensor, names[i], include, type)) if (!AddNameToCensor(wildcardCensor, names[i], include, type))

View File

@@ -48,11 +48,7 @@ void CArchiveExtractCallback::Init(
_extractCallback2 = extractCallback2; _extractCallback2 = extractCallback2;
_compressProgress.Release(); _compressProgress.Release();
_extractCallback2.QueryInterface(IID_ICompressProgressInfo, &_compressProgress); _extractCallback2.QueryInterface(IID_ICompressProgressInfo, &_compressProgress);
if (!_localProgress)
{
LocalProgressSpec = new CLocalProgress();
_localProgress = LocalProgressSpec;
}
LocalProgressSpec->Init(extractCallback2, true); LocalProgressSpec->Init(extractCallback2, true);
_itemDefaultName = itemDefaultName; _itemDefaultName = itemDefaultName;

View File

@@ -98,7 +98,11 @@ public:
WriteCreated(false), WriteCreated(false),
WriteAccessed(false), WriteAccessed(false),
_multiArchives(false) _multiArchives(false)
{} {
LocalProgressSpec = new CLocalProgress();
_localProgress = LocalProgressSpec;
}
CLocalProgress *LocalProgressSpec; CLocalProgress *LocalProgressSpec;
CMyComPtr<ICompressProgressInfo> _localProgress; CMyComPtr<ICompressProgressInfo> _localProgress;
bool _ratioMode; bool _ratioMode;

View File

@@ -119,6 +119,7 @@ STDMETHODIMP COpenCallbackImp::GetStream(const wchar_t *name, IInStream **inStre
inFile->OpenCallbackImp = this; inFile->OpenCallbackImp = this;
inFile->OpenCallbackRef = this; inFile->OpenCallbackRef = this;
FileNames.Add(name); FileNames.Add(name);
TotalSize += _fileInfo.Size;
return S_OK; return S_OK;
COM_TRY_END COM_TRY_END
} }

View File

@@ -75,6 +75,7 @@ private:
public: public:
UStringVector FileNames; UStringVector FileNames;
IOpenCallbackUI *Callback; IOpenCallbackUI *Callback;
UInt64 TotalSize;
COpenCallbackImp(): Callback(NULL) {} COpenCallbackImp(): Callback(NULL) {}
void Init(const UString &folderPrefix, const UString &fileName) void Init(const UString &folderPrefix, const UString &fileName)
@@ -84,6 +85,7 @@ public:
throw 1; throw 1;
FileNames.Clear(); FileNames.Clear();
_subArchiveMode = false; _subArchiveMode = false;
TotalSize = 0;
} }
int FindName(const UString &name); int FindName(const UString &name);
}; };

View File

@@ -163,7 +163,8 @@ HRESULT DecompressArchives(
archiveFileInfo.Size, archiveFileInfo.Size,
archiveLink.GetDefaultItemName(), archiveLink.GetDefaultItemName(),
wildcardCensor, options, extractCallback, extractCallbackSpec, errorMessage)); wildcardCensor, options, extractCallback, extractCallbackSpec, errorMessage));
extractCallbackSpec->LocalProgressSpec->InSize += archiveFileInfo.Size; extractCallbackSpec->LocalProgressSpec->InSize += archiveFileInfo.Size +
archiveLink.VolumesSize;
extractCallbackSpec->LocalProgressSpec->OutSize = extractCallbackSpec->UnpackSize; extractCallbackSpec->LocalProgressSpec->OutSize = extractCallbackSpec->UnpackSize;
if (!errorMessage.IsEmpty()) if (!errorMessage.IsEmpty())
return E_FAIL; return E_FAIL;

View File

@@ -366,8 +366,10 @@ HRESULT MyOpenArchive(
UString &defaultItemName0, UString &defaultItemName0,
UString &defaultItemName1, UString &defaultItemName1,
UStringVector &volumePaths, UStringVector &volumePaths,
UInt64 &volumesSize,
IOpenCallbackUI *openCallbackUI) IOpenCallbackUI *openCallbackUI)
{ {
volumesSize = 0;
COpenCallbackImp *openCallbackSpec = new COpenCallbackImp; COpenCallbackImp *openCallbackSpec = new COpenCallbackImp;
CMyComPtr<IArchiveOpenCallback> openCallback = openCallbackSpec; CMyComPtr<IArchiveOpenCallback> openCallback = openCallbackSpec;
openCallbackSpec->Callback = openCallbackUI; openCallbackSpec->Callback = openCallbackUI;
@@ -391,6 +393,7 @@ HRESULT MyOpenArchive(
volumePaths.Add(prefix + name); volumePaths.Add(prefix + name);
for (int i = 0; i < openCallbackSpec->FileNames.Size(); i++) for (int i = 0; i < openCallbackSpec->FileNames.Size(); i++)
volumePaths.Add(prefix + openCallbackSpec->FileNames[i]); volumePaths.Add(prefix + openCallbackSpec->FileNames[i]);
volumesSize = openCallbackSpec->TotalSize;
return S_OK; return S_OK;
} }
@@ -435,6 +438,7 @@ HRESULT MyOpenArchive(CCodecs *codecs,
&archiveLink.Archive0, &archiveLink.Archive1, &archiveLink.Archive0, &archiveLink.Archive1,
archiveLink.DefaultItemName0, archiveLink.DefaultItemName1, archiveLink.DefaultItemName0, archiveLink.DefaultItemName1,
archiveLink.VolumePaths, archiveLink.VolumePaths,
archiveLink.VolumesSize,
openCallbackUI); openCallbackUI);
archiveLink.IsOpen = (res == S_OK); archiveLink.IsOpen = (res == S_OK);
return res; return res;

View File

@@ -69,6 +69,7 @@ HRESULT MyOpenArchive(
UString &defaultItemName0, UString &defaultItemName0,
UString &defaultItemName1, UString &defaultItemName1,
UStringVector &volumePaths, UStringVector &volumePaths,
UInt64 &volumesSize,
IOpenCallbackUI *openCallbackUI); IOpenCallbackUI *openCallbackUI);
struct CArchiveLink struct CArchiveLink
@@ -83,6 +84,8 @@ struct CArchiveLink
UStringVector VolumePaths; UStringVector VolumePaths;
UInt64 VolumesSize;
int GetNumLevels() const int GetNumLevels() const
{ {
int result = 0; int result = 0;
@@ -97,7 +100,7 @@ struct CArchiveLink
bool IsOpen; bool IsOpen;
CArchiveLink(): IsOpen(false) {}; CArchiveLink(): IsOpen(false), VolumesSize(0) {};
IInArchive *GetArchive() { return Archive1 != 0 ? Archive1: Archive0; } IInArchive *GetArchive() { return Archive1 != 0 ? Archive1: Archive0; }
UString GetDefaultItemName() { return Archive1 != 0 ? DefaultItemName1: DefaultItemName0; } UString GetDefaultItemName() { return Archive1 != 0 ? DefaultItemName1: DefaultItemName0; }

View File

@@ -7,12 +7,9 @@
#include "Common/CommandLineParser.h" #include "Common/CommandLineParser.h"
#include "Common/MyException.h" #include "Common/MyException.h"
#include "Common/IntToString.h" #include "Common/IntToString.h"
#include "Common/ListFileUtils.h"
#include "Common/StdInStream.h"
#include "Common/StdOutStream.h" #include "Common/StdOutStream.h"
#include "Common/StringConvert.h" #include "Common/StringConvert.h"
#include "Common/StringToInt.h" #include "Common/StringToInt.h"
#include "Common/Wildcard.h"
#include "Windows/FileDir.h" #include "Windows/FileDir.h"
#include "Windows/FileName.h" #include "Windows/FileName.h"

View File

@@ -371,14 +371,6 @@ SOURCE=..\..\..\Common\Random.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\Common\StdInStream.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StdInStream.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StringConvert.cpp SOURCE=..\..\..\Common\StringConvert.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@@ -17,16 +17,14 @@ EXPLORER_OBJS = \
COMMON_OBJS = \ COMMON_OBJS = \
$O\IntToString.obj \ $O\IntToString.obj \
$O\Lang.obj \ $O\Lang.obj \
$O\ListFileUtils.obj \ $O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \ $O\NewHandler.obj \
$O\Random.obj \ $O\Random.obj \
$O\StdInStream.obj \
$O\MyString.obj \
$O\StringConvert.obj \ $O\StringConvert.obj \
$O\StringToInt.obj \ $O\StringToInt.obj \
$O\TextConfig.obj \ $O\TextConfig.obj \
$O\UTFConvert.obj \ $O\UTFConvert.obj \
$O\MyVector.obj \
$O\Wildcard.obj \ $O\Wildcard.obj \
WIN_OBJS = \ WIN_OBJS = \

View File

@@ -79,6 +79,10 @@ void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex)
throw 272340; throw 272340;
CSysString oemString = UnicodeStringToMultiByte(propVariant.bstrVal, CP_OEMCP); CSysString oemString = UnicodeStringToMultiByte(propVariant.bstrVal, CP_OEMCP);
const int kFileNameSizeMax = (int)(sizeof(panelItem.FindData.cFileName) / sizeof(panelItem.FindData.cFileName[0]) - 1);
if (oemString.Length() > kFileNameSizeMax)
oemString = oemString.Left(kFileNameSizeMax);
MyStringCopy(panelItem.FindData.cFileName, (const char *)oemString); MyStringCopy(panelItem.FindData.cFileName, (const char *)oemString);
panelItem.FindData.cAlternateFileName[0] = 0; panelItem.FindData.cAlternateFileName[0] = 0;

View File

@@ -18,6 +18,7 @@
#include "ExtractCallback.h" #include "ExtractCallback.h"
#include "ViewSettings.h" #include "ViewSettings.h"
#include "RegistryUtils.h" #include "RegistryUtils.h"
#include "LangUtils.h"
using namespace NWindows; using namespace NWindows;
using namespace NFile; using namespace NFile;
@@ -32,6 +33,7 @@ void CPanelCallbackImp::OnTab()
{ {
if (g_App.NumPanels != 1) if (g_App.NumPanels != 1)
_app->Panels[1 - _index].SetFocusToList(); _app->Panels[1 - _index].SetFocusToList();
_app->RefreshTitle();
} }
void CPanelCallbackImp::SetFocusToPath(int index) void CPanelCallbackImp::SetFocusToPath(int index)
@@ -40,26 +42,17 @@ void CPanelCallbackImp::SetFocusToPath(int index)
if (g_App.NumPanels == 1) if (g_App.NumPanels == 1)
newPanelIndex = g_App.LastFocusedPanel; newPanelIndex = g_App.LastFocusedPanel;
_app->Panels[newPanelIndex]._headerComboBox.SetFocus(); _app->Panels[newPanelIndex]._headerComboBox.SetFocus();
_app->RefreshTitle();
} }
void CPanelCallbackImp::OnCopy(bool move, bool copyToSame) void CPanelCallbackImp::OnCopy(bool move, bool copyToSame) { _app->OnCopy(move, copyToSame, _index); }
{ _app->OnCopy(move, copyToSame, _index); } void CPanelCallbackImp::OnSetSameFolder() { _app->OnSetSameFolder(_index); }
void CPanelCallbackImp::OnSetSubFolder() { _app->OnSetSubFolder(_index); }
void CPanelCallbackImp::OnSetSameFolder() void CPanelCallbackImp::PanelWasFocused() { _app->SetFocusedPanel(_index); _app->RefreshTitle(_index); }
{ _app->OnSetSameFolder(_index); } void CPanelCallbackImp::DragBegin() { _app->DragBegin(_index); }
void CPanelCallbackImp::DragEnd() { _app->DragEnd(); }
void CPanelCallbackImp::OnSetSubFolder() void CPanelCallbackImp::RefreshTitle(bool always) { _app->RefreshTitle(_index, always); }
{ _app->OnSetSubFolder(_index); }
void CPanelCallbackImp::PanelWasFocused()
{ _app->SetFocusedPanel(_index); }
void CPanelCallbackImp::DragBegin()
{ _app->DragBegin(_index); }
void CPanelCallbackImp::DragEnd()
{ _app->DragEnd(); }
void CApp::SetListSettings() void CApp::SetListSettings()
{ {
@@ -636,6 +629,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
} }
} }
RefreshTitleAlways();
if (copyToSame || move) if (copyToSame || move)
{ {
srcPanel.RefreshListCtrl(srcSelState); srcPanel.RefreshListCtrl(srcSelState);
@@ -757,3 +751,22 @@ void CApp::OnNotify(int /* ctrlID */, LPNMHDR pnmh)
#endif #endif
} }
} }
void CApp::RefreshTitle(bool always)
{
UString path = GetFocusedPanel()._currentFolderPrefix;
if (path.IsEmpty())
path += LangString(IDS_APP_TITLE, 0x03000000);
if (!always && path == PrevTitle)
return;
PrevTitle = path;
NWindows::MySetWindowText(_window, path);
}
void CApp::RefreshTitle(int panelIndex, bool always)
{
if (panelIndex != GetFocusedPanelIndex())
return;
RefreshTitle(always);
}

View File

@@ -41,6 +41,7 @@ public:
virtual void PanelWasFocused(); virtual void PanelWasFocused();
virtual void DragBegin(); virtual void DragBegin();
virtual void DragEnd(); virtual void DragEnd();
virtual void RefreshTitle(bool always);
}; };
class CApp; class CApp;
@@ -216,6 +217,8 @@ public:
{ GetFocusedPanel().CreateFile(); } { GetFocusedPanel().CreateFile(); }
// Edit // Edit
void EditCut()
{ GetFocusedPanel().EditCut(); }
void EditCopy() void EditCopy()
{ GetFocusedPanel().EditCopy(); } { GetFocusedPanel().EditCopy(); }
void EditPaste() void EditPaste()
@@ -327,6 +330,11 @@ public:
{ GetFocusedPanel().TestArchives(); } { GetFocusedPanel().TestArchives(); }
void OnNotify(int ctrlID, LPNMHDR pnmh); void OnNotify(int ctrlID, LPNMHDR pnmh);
UString PrevTitle;
void RefreshTitle(bool always = false);
void RefreshTitleAlways() { RefreshTitle(true); }
void RefreshTitle(int panelIndex, bool always = false);
}; };
#endif #endif

View File

@@ -759,6 +759,14 @@ SOURCE=..\..\..\Windows\Control\Window2.h
# End Group # End Group
# Begin Source File # Begin Source File
SOURCE=..\..\..\Windows\Clipboard.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Clipboard.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\CommonDialog.cpp SOURCE=..\..\..\Windows\CommonDialog.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -999,14 +1007,6 @@ SOURCE=..\..\..\Common\Lang.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\Common\ListFileUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\ListFileUtils.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyCom.h SOURCE=..\..\..\Common\MyCom.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -1043,22 +1043,6 @@ SOURCE=..\..\..\Common\Random.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\Common\StdInStream.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StdInStream.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StdOutStream.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StdOutStream.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StringConvert.cpp SOURCE=..\..\..\Common\StringConvert.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@@ -5,8 +5,6 @@
#include "FSFolder.h" #include "FSFolder.h"
#include "Common/StringConvert.h" #include "Common/StringConvert.h"
#include "Common/StdInStream.h"
#include "Common/StdOutStream.h"
#include "Common/UTFConvert.h" #include "Common/UTFConvert.h"
#include "Common/ComTry.h" #include "Common/ComTry.h"
@@ -73,7 +71,7 @@ HRESULT CFSFolder::Init(const UString &path, IFolderFolder *parentFolder)
return S_OK; return S_OK;
} }
static HRESULT GetFolderSize(const UString &path, UInt64 &numFolders, UInt64 &numFiles, UInt64 &size, IProgress *progress) HRESULT GetFolderSize(const UString &path, UInt64 &numFolders, UInt64 &numFiles, UInt64 &size, IProgress *progress)
{ {
RINOK(progress->SetCompleted(NULL)); RINOK(progress->SetCompleted(NULL));
numFiles = numFolders = size = 0; numFiles = numFolders = size = 0;

View File

@@ -113,6 +113,8 @@ public:
} }
}; };
HRESULT GetFolderSize(const UString &path, UInt64 &numFolders, UInt64 &numFiles, UInt64 &size, IProgress *progress);
} }
#endif #endif

View File

@@ -469,6 +469,40 @@ STDMETHODIMP CFSFolder::MoveTo(
STDMETHODIMP CFSFolder::CopyFrom(const wchar_t * /* fromFolderPath */, STDMETHODIMP CFSFolder::CopyFrom(const wchar_t * /* fromFolderPath */,
const wchar_t ** /* itemsPaths */, UInt32 /* numItems */, IProgress * /* progress */) const wchar_t ** /* itemsPaths */, UInt32 /* numItems */, IProgress * /* progress */)
{ {
/*
UInt64 numFolders, numFiles, totalSize;
numFiles = numFolders = totalSize = 0;
UInt32 i;
for (i = 0; i < numItems; i++)
{
UString path = (UString)fromFolderPath + itemsPaths[i];
CFileInfoW fileInfo;
if (!FindFile(path, fileInfo))
return ::GetLastError();
if (fileInfo.IsDirectory())
{
UInt64 subFolders, subFiles, subSize;
RINOK(GetFolderSize(path + UString(L"\\") + fileInfo.Name, subFolders, subFiles, subSize, progress));
numFolders += subFolders;
numFolders++;
numFiles += subFiles;
totalSize += subSize;
}
else
{
numFiles++;
totalSize += fileInfo.Size;
}
}
RINOK(progress->SetTotal(totalSize));
RINOK(callback->SetNumFiles(numFiles));
for (i = 0; i < numItems; i++)
{
UString path = (UString)fromFolderPath + itemsPaths[i];
}
return S_OK;
*/
return E_NOTIMPL; return E_NOTIMPL;
} }

View File

@@ -35,7 +35,7 @@ void ReloadLang()
if (GetProgramFolderPath(folderPath)) if (GetProgramFolderPath(folderPath))
langPath = folderPath + UString(L"Lang\\") + langPath; langPath = folderPath + UString(L"Lang\\") + langPath;
} }
g_Lang.Open(GetSystemString(langPath)); g_Lang.Open(langPath);
} }
} }
@@ -107,7 +107,7 @@ void LoadLangs(CObjectVector<CLangEx> &langs)
if (fileInfo.Name.Right(kExtSize) != L".txt") if (fileInfo.Name.Right(kExtSize) != L".txt")
continue; continue;
lang.ShortName = fileInfo.Name.Left(fileInfo.Name.Length() - kExtSize); lang.ShortName = fileInfo.Name.Left(fileInfo.Name.Length() - kExtSize);
if (lang.Lang.Open(GetSystemString(filePath))) if (lang.Lang.Open(filePath))
langs.Add(lang); langs.Add(lang);
} }
} }

View File

@@ -6,6 +6,7 @@
#include "Windows/Menu.h" #include "Windows/Menu.h"
#include "Windows/Error.h" #include "Windows/Error.h"
#include "Windows/Clipboard.h"
#include "../../PropID.h" #include "../../PropID.h"
@@ -30,6 +31,7 @@ extern void OptionsDialog(HWND hwndOwner, HINSTANCE hInstance);
using namespace NWindows; using namespace NWindows;
static const int kFileMenuIndex = 0; static const int kFileMenuIndex = 0;
static const int kEditMenuIndex = 1;
static const int kViewMenuIndex = 2; static const int kViewMenuIndex = 2;
static const int kBookmarksMenuIndex = kViewMenuIndex + 1; static const int kBookmarksMenuIndex = kViewMenuIndex + 1;
@@ -321,7 +323,16 @@ void OnMenuActivating(HWND /* hWnd */, HMENU hMenu, int position)
} }
// CopyMenu(g_FileMenu, hMenu); // CopyMenu(g_FileMenu, hMenu);
g_App.GetFocusedPanel().CreateFileMenu(hMenu); g_App.GetFocusedPanel().CreateFileMenu(hMenu);
}
else if (position == kEditMenuIndex)
{
/*
CMenu menu;
menu.Attach(hMenu);
menu.EnableItem(IDM_EDIT_CUT, MF_ENABLED);
menu.EnableItem(IDM_EDIT_COPY, MF_ENABLED);
menu.EnableItem(IDM_EDIT_PASTE, IsClipboardFormatAvailableHDROP() ? MF_ENABLED : MF_GRAYED);
*/
} }
else if (position == kViewMenuIndex) else if (position == kViewMenuIndex)
{ {
@@ -545,6 +556,9 @@ bool OnMenuCommand(HWND hWnd, int id)
break; break;
// Edit // Edit
case IDM_EDIT_CUT:
g_App.EditCut();
break;
case IDM_EDIT_COPY: case IDM_EDIT_COPY:
g_App.EditCopy(); g_App.EditCopy();
break; break;

View File

@@ -891,6 +891,7 @@ void CPanel::TestArchives()
_folder.QueryInterface(IID_IArchiveFolder, &archiveFolder); _folder.QueryInterface(IID_IArchiveFolder, &archiveFolder);
if (archiveFolder) if (archiveFolder)
{ {
{
CThreadTest extracter; CThreadTest extracter;
extracter.ArchiveFolder = archiveFolder; extracter.ArchiveFolder = archiveFolder;
@@ -938,6 +939,8 @@ void CPanel::TestArchives()
if (extracter.Result != S_OK && extracter.Result != E_ABORT) if (extracter.Result != S_OK && extracter.Result != E_ABORT)
MessageBoxError(extracter.Result, L"Testing Error"); MessageBoxError(extracter.Result, L"Testing Error");
} }
}
RefreshTitleAlways();
return; return;
} }

View File

@@ -32,9 +32,8 @@ const int kToolbarStartID = 2000;
const int kParentIndex = -1; const int kParentIndex = -1;
class CPanelCallback struct CPanelCallback
{ {
public:
virtual void OnTab() = 0; virtual void OnTab() = 0;
virtual void SetFocusToPath(int index) = 0; virtual void SetFocusToPath(int index) = 0;
virtual void OnCopy(bool move, bool copyToSame) = 0; virtual void OnCopy(bool move, bool copyToSame) = 0;
@@ -43,6 +42,7 @@ public:
virtual void PanelWasFocused() = 0; virtual void PanelWasFocused() = 0;
virtual void DragBegin() = 0; virtual void DragBegin() = 0;
virtual void DragEnd() = 0; virtual void DragEnd() = 0;
virtual void RefreshTitle(bool always) = 0;
}; };
void PanelCopyItems(); void PanelCopyItems();
@@ -378,6 +378,7 @@ public:
void InvokeSystemCommand(const char *command); void InvokeSystemCommand(const char *command);
void Properties(); void Properties();
void EditCut();
void EditCopy(); void EditCopy();
void EditPaste(); void EditPaste();
@@ -499,13 +500,17 @@ public:
HRESULT CopyFrom(const UString &folderPrefix, const UStringVector &filePaths, HRESULT CopyFrom(const UString &folderPrefix, const UStringVector &filePaths,
bool showErrorMessages, UStringVector *messages); bool showErrorMessages, UStringVector *messages);
void CopyFrom(const UStringVector &filePaths); void CopyFromNoAsk(const UStringVector &filePaths);
void CopyFromAsk(const UStringVector &filePaths);
// empty folderPath means create new Archive to path of first fileName. // empty folderPath means create new Archive to path of first fileName.
void DropObject(IDataObject * dataObject, const UString &folderPath); void DropObject(IDataObject * dataObject, const UString &folderPath);
// empty folderPath means create new Archive to path of first fileName. // empty folderPath means create new Archive to path of first fileName.
void CompressDropFiles(const UStringVector &fileNames, const UString &folderPath); void CompressDropFiles(const UStringVector &fileNames, const UString &folderPath);
void RefreshTitle(bool always = false) { _panelCallback->RefreshTitle(always); }
void RefreshTitleAlways() { RefreshTitle(true); }
}; };
#endif #endif

View File

@@ -58,37 +58,42 @@ HRESULT CPanel::CopyTo(const CRecordVector<UInt32> &indices, const UString &fold
return E_FAIL; return E_FAIL;
} }
HRESULT res;
{
CThreadExtractInArchive2 extracter; CThreadExtractInArchive2 extracter;
extracter.ExtractCallbackSpec = new CExtractCallbackImp; extracter.ExtractCallbackSpec = new CExtractCallbackImp;
extracter.ExtractCallback = extracter.ExtractCallbackSpec; extracter.ExtractCallback = extracter.ExtractCallbackSpec;
extracter.ExtractCallbackSpec->ParentWindow = GetParent(); extracter.ExtractCallbackSpec->ParentWindow = GetParent();
extracter.ExtractCallbackSpec->ShowMessages = showErrorMessages; extracter.ExtractCallbackSpec->ShowMessages = showErrorMessages;
extracter.ExtractCallbackSpec->ProgressDialog.CompressingMode = false; extracter.ExtractCallbackSpec->ProgressDialog.CompressingMode = false;
UString title = moveMode ? UString title = moveMode ?
LangString(IDS_MOVING, 0x03020206): LangString(IDS_MOVING, 0x03020206):
LangString(IDS_COPYING, 0x03020205); LangString(IDS_COPYING, 0x03020205);
UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000); UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
extracter.ExtractCallbackSpec->ProgressDialog.MainWindow = GetParent(); extracter.ExtractCallbackSpec->ProgressDialog.MainWindow = GetParent();
extracter.ExtractCallbackSpec->ProgressDialog.MainTitle = progressWindowTitle; extracter.ExtractCallbackSpec->ProgressDialog.MainTitle = progressWindowTitle;
extracter.ExtractCallbackSpec->ProgressDialog.MainAddTitle = title + L" "; extracter.ExtractCallbackSpec->ProgressDialog.MainAddTitle = title + L" ";
extracter.ExtractCallbackSpec->OverwriteMode = NExtract::NOverwriteMode::kAskBefore; extracter.ExtractCallbackSpec->OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
extracter.ExtractCallbackSpec->Init(); extracter.ExtractCallbackSpec->Init();
extracter.Indices = indices; extracter.Indices = indices;
extracter.DestPath = folder; extracter.DestPath = folder;
extracter.FolderOperations = folderOperations; extracter.FolderOperations = folderOperations;
extracter.MoveMode = moveMode; extracter.MoveMode = moveMode;
NWindows::CThread extractThread; NWindows::CThread extractThread;
RINOK(extractThread.Create(CThreadExtractInArchive2::MyThreadFunction, &extracter)); RINOK(extractThread.Create(CThreadExtractInArchive2::MyThreadFunction, &extracter));
extracter.ExtractCallbackSpec->StartProgressDialog(title); extracter.ExtractCallbackSpec->StartProgressDialog(title);
if (messages != 0) if (messages != 0)
*messages = extracter.ExtractCallbackSpec->Messages; *messages = extracter.ExtractCallbackSpec->Messages;
return extracter.Result; res = extracter.Result;
}
RefreshTitleAlways();
return res;
} }
@@ -135,6 +140,8 @@ HRESULT CPanel::CopyFrom(const UString &folderPrefix, const UStringVector &fileP
return E_FAIL; return E_FAIL;
} }
HRESULT res;
{
CThreadUpdate updater; CThreadUpdate updater;
updater.UpdateCallbackSpec = new CUpdateCallback100Imp; updater.UpdateCallbackSpec = new CUpdateCallback100Imp;
updater.UpdateCallback = updater.UpdateCallbackSpec; updater.UpdateCallback = updater.UpdateCallbackSpec;
@@ -164,20 +171,14 @@ HRESULT CPanel::CopyFrom(const UString &folderPrefix, const UStringVector &fileP
if (messages != 0) if (messages != 0)
*messages = updater.UpdateCallbackSpec->Messages; *messages = updater.UpdateCallbackSpec->Messages;
return updater.Result; res = updater.Result;
}
RefreshTitleAlways();
return res;
} }
void CPanel::CopyFrom(const UStringVector &filePaths) void CPanel::CopyFromNoAsk(const UStringVector &filePaths)
{ {
UString title = LangString(IDS_CONFIRM_FILE_COPY, 0x03020222);
UString message = LangString(IDS_WANT_TO_COPY_FILES, 0x03020223);
message += L"\n\'";
message += _currentFolderPrefix;
message += L"\' ?";
int res = ::MessageBoxW(*(this), message, title, MB_YESNOCANCEL | MB_ICONQUESTION | MB_SYSTEMMODAL);
if (res != IDYES)
return;
CDisableTimerProcessing disableTimerProcessing(*this); CDisableTimerProcessing disableTimerProcessing(*this);
CSelectedState srcSelState; CSelectedState srcSelState;
@@ -201,3 +202,17 @@ void CPanel::CopyFrom(const UStringVector &filePaths)
SetFocusToList(); SetFocusToList();
} }
void CPanel::CopyFromAsk(const UStringVector &filePaths)
{
UString title = LangString(IDS_CONFIRM_FILE_COPY, 0x03020222);
UString message = LangString(IDS_WANT_TO_COPY_FILES, 0x03020223);
message += L"\n\'";
message += _currentFolderPrefix;
message += L"\' ?";
int res = ::MessageBoxW(*(this), message, title, MB_YESNOCANCEL | MB_ICONQUESTION | MB_SYSTEMMODAL);
if (res != IDYES)
return;
CopyFromNoAsk(filePaths);
}

View File

@@ -290,6 +290,7 @@ void CApp::CalculateCrc()
combiner.DirEnumerator.BasePrefix = srcPanel._currentFolderPrefix; combiner.DirEnumerator.BasePrefix = srcPanel._currentFolderPrefix;
combiner.DirEnumerator.FlatMode = GetFlatMode(); combiner.DirEnumerator.FlatMode = GetFlatMode();
{
CProgressDialog progressDialog; CProgressDialog progressDialog;
combiner.ProgressDialog = &progressDialog; combiner.ProgressDialog = &progressDialog;
combiner.ErrorCode = 0; combiner.ErrorCode = 0;
@@ -362,4 +363,6 @@ void CApp::CalculateCrc()
} }
srcPanel.MessageBoxInfo(s, LangString(IDS_CHECKSUM_INFORMATION, 0x03020720)); srcPanel.MessageBoxInfo(s, LangString(IDS_CHECKSUM_INFORMATION, 0x03020720));
} }
}
RefreshTitleAlways();
} }

View File

@@ -792,5 +792,5 @@ void CPanel::CompressDropFiles(const UStringVector &fileNames, const UString &fo
); );
} }
else else
CopyFrom(fileNames); CopyFromAsk(fileNames);
} }

View File

@@ -145,6 +145,7 @@ void CPanel::LoadFullPathAndShow()
// _headerComboBox.SendMessage(CB_RESETCONTENT, 0, 0); // _headerComboBox.SendMessage(CB_RESETCONTENT, 0, 0);
_headerComboBox.SetText(_currentFolderPrefix); _headerComboBox.SetText(_currentFolderPrefix);
RefreshTitle();
/* /*
for (int i = 0; i < g_Folders.m_Strings.Size(); i++) for (int i = 0; i < g_Folders.m_Strings.Size(); i++)

View File

@@ -157,8 +157,25 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
} }
case VK_INSERT: case VK_INSERT:
{ {
OnInsert(); if (!alt)
return true; {
if (ctrl && !shift)
{
EditCopy();
return true;
}
if (shift && !ctrl)
{
EditPaste();
return true;
}
if (!shift && !ctrl && _mySelectMode)
{
OnInsert();
return true;
}
}
return false;
} }
case VK_DOWN: case VK_DOWN:
{ {
@@ -249,6 +266,27 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
return true; return true;
} }
return false; return false;
case 'X':
if (ctrl)
{
EditCut();
return true;
}
return false;
case 'C':
if (ctrl)
{
EditCopy();
return true;
}
return false;
case 'V':
if (ctrl)
{
EditPaste();
return true;
}
return false;
case 'N': case 'N':
if (ctrl) if (ctrl)
{ {

View File

@@ -4,6 +4,7 @@
#include "Windows/Menu.h" #include "Windows/Menu.h"
#include "Windows/COM.h" #include "Windows/COM.h"
#include "Windows/PropVariant.h" #include "Windows/PropVariant.h"
#include "Windows/Clipboard.h"
#include "../Common/PropIDUtils.h" #include "../Common/PropIDUtils.h"
#include "../../PropID.h" #include "../../PropID.h"
@@ -27,6 +28,7 @@ static const UINT kSystemStartMenuID = kPluginMenuStartID + 100;
void CPanel::InvokeSystemCommand(const char *command) void CPanel::InvokeSystemCommand(const char *command)
{ {
NCOM::CComInitializer comInitializer;
if (!IsFSFolder() && !IsFSDrivesFolder()) if (!IsFSFolder() && !IsFSDrivesFolder())
return; return;
CRecordVector<UInt32> operatedIndices; CRecordVector<UInt32> operatedIndices;
@@ -181,18 +183,51 @@ void CPanel::Properties()
} }
} }
// Copy and paste do not work, if you know why write me. void CPanel::EditCut()
{
// InvokeSystemCommand("cut");
}
void CPanel::EditCopy() void CPanel::EditCopy()
{ {
NCOM::CComInitializer comInitializer; /*
InvokeSystemCommand("copy"); CMyComPtr<IGetFolderArchiveProperties> getFolderArchiveProperties;
_folder.QueryInterface(IID_IGetFolderArchiveProperties, &getFolderArchiveProperties);
if (!getFolderArchiveProperties)
{
InvokeSystemCommand("copy");
return;
}
*/
UString s;
CRecordVector<UInt32> indices;
GetSelectedItemsIndices(indices);
for (int i = 0; i < indices.Size(); i++)
{
if (i > 0)
s += L"\xD\n";
s += GetItemName(indices[i]);
}
ClipboardSetText(_mainWindow, s);
} }
void CPanel::EditPaste() void CPanel::EditPaste()
{ {
NCOM::CComInitializer comInitializer; /*
InvokeSystemCommand("paste"); UStringVector names;
ClipboardGetFileNames(names);
CopyFromNoAsk(names);
UString s;
for (int i = 0; i < names.Size(); i++)
{
s += L" ";
s += names[i];
}
MessageBoxW(0, s, L"", 0);
*/
// InvokeSystemCommand("paste");
} }
HRESULT CPanel::CreateShellContextMenu( HRESULT CPanel::CreateShellContextMenu(

View File

@@ -220,6 +220,7 @@ void CPanel::DeleteItemsInternal(CRecordVector<UInt32> &indices)
if (::MessageBoxW(GetParent(), message, title, MB_OKCANCEL | MB_ICONQUESTION) != IDOK) if (::MessageBoxW(GetParent(), message, title, MB_OKCANCEL | MB_ICONQUESTION) != IDOK)
return; return;
{
CThreadDelete deleter; CThreadDelete deleter;
deleter.UpdateCallbackSpec = new CUpdateCallback100Imp; deleter.UpdateCallbackSpec = new CUpdateCallback100Imp;
deleter.UpdateCallback = deleter.UpdateCallbackSpec; deleter.UpdateCallback = deleter.UpdateCallbackSpec;
@@ -242,6 +243,8 @@ void CPanel::DeleteItemsInternal(CRecordVector<UInt32> &indices)
HRESULT result = deleter.Result; HRESULT result = deleter.Result;
if (result != S_OK) if (result != S_OK)
MessageBoxError(result, LangString(IDS_ERROR_DELETING, 0x03020217)); MessageBoxError(result, LangString(IDS_ERROR_DELETING, 0x03020217));
}
RefreshTitleAlways();
} }
BOOL CPanel::OnBeginLabelEdit(LV_DISPINFOW * lpnmh) BOOL CPanel::OnBeginLabelEdit(LV_DISPINFOW * lpnmh)
@@ -319,6 +322,7 @@ void CPanel::CreateFolder()
// HRESULT result = folderOperations->CreateFolder(newName, 0); // HRESULT result = folderOperations->CreateFolder(newName, 0);
{
CThreadCreateFolder upd; CThreadCreateFolder upd;
upd.UpdateCallbackSpec = new CUpdateCallback100Imp; upd.UpdateCallbackSpec = new CUpdateCallback100Imp;
upd.UpdateCallback = upd.UpdateCallbackSpec; upd.UpdateCallback = upd.UpdateCallbackSpec;
@@ -352,6 +356,8 @@ void CPanel::CreateFolder()
state.SelectedNames.Clear(); state.SelectedNames.Clear();
state.FocusedName = newName; state.FocusedName = newName;
state.SelectFocused = true; state.SelectFocused = true;
}
RefreshTitleAlways();
RefreshListCtrl(state); RefreshListCtrl(state);
} }

View File

@@ -259,6 +259,7 @@ void CApp::Split()
CThreadSplit spliter; CThreadSplit spliter;
// spliter.Panel = this; // spliter.Panel = this;
{
CProgressDialog progressDialog; CProgressDialog progressDialog;
spliter.ProgressDialog = &progressDialog; spliter.ProgressDialog = &progressDialog;
@@ -284,6 +285,9 @@ void CApp::Split()
if (thread.Create(CThreadSplit::MyThreadFunction, &spliter) != S_OK) if (thread.Create(CThreadSplit::MyThreadFunction, &spliter) != S_OK)
throw 271824; throw 271824;
progressDialog.Create(title, _window); progressDialog.Create(title, _window);
}
RefreshTitleAlways();
if (!spliter.Error.IsEmpty()) if (!spliter.Error.IsEmpty())
srcPanel.MessageBoxMyError(spliter.Error); srcPanel.MessageBoxMyError(spliter.Error);
@@ -442,6 +446,7 @@ void CApp::Combine()
CThreadCombine combiner; CThreadCombine combiner;
// combiner.Panel = this; // combiner.Panel = this;
{
CProgressDialog progressDialog; CProgressDialog progressDialog;
combiner.ProgressDialog = &progressDialog; combiner.ProgressDialog = &progressDialog;
@@ -471,6 +476,8 @@ void CApp::Combine()
if (thread.Create(CThreadCombine::MyThreadFunction, &combiner) != S_OK) if (thread.Create(CThreadCombine::MyThreadFunction, &combiner) != S_OK)
throw 271824; throw 271824;
progressDialog.Create(title, _window); progressDialog.Create(title, _window);
}
RefreshTitleAlways();
if (!combiner.Error.IsEmpty()) if (!combiner.Error.IsEmpty())
srcPanel.MessageBoxMyError(combiner.Error); srcPanel.MessageBoxMyError(combiner.Error);

View File

@@ -70,20 +70,18 @@ COMMON_OBJS = \
$O\CRC.obj \ $O\CRC.obj \
$O\IntToString.obj \ $O\IntToString.obj \
$O\Lang.obj \ $O\Lang.obj \
$O\ListFileUtils.obj \ $O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \ $O\NewHandler.obj \
$O\Random.obj \ $O\Random.obj \
$O\StdInStream.obj \
$O\StdOutStream.obj \
$O\MyString.obj \
$O\StringConvert.obj \ $O\StringConvert.obj \
$O\StringToInt.obj \ $O\StringToInt.obj \
$O\TextConfig.obj \ $O\TextConfig.obj \
$O\UTFConvert.obj \ $O\UTFConvert.obj \
$O\MyVector.obj \
$O\Wildcard.obj \ $O\Wildcard.obj \
WIN_OBJS = \ WIN_OBJS = \
$O\Clipboard.obj \
$O\CommonDialog.obj \ $O\CommonDialog.obj \
$O\DLL.obj \ $O\DLL.obj \
$O\Error.obj \ $O\Error.obj \

View File

@@ -759,14 +759,6 @@ SOURCE=..\..\..\Common\NewHandler.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\Common\StdInStream.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StdInStream.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StringConvert.cpp SOURCE=..\..\..\Common\StringConvert.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@@ -4,10 +4,6 @@
#include "OpenCallbackGUI.h" #include "OpenCallbackGUI.h"
#include "Common/StdOutStream.h"
#include "Common/StdInStream.h"
#include "Common/StringConvert.h"
#ifndef _NO_CRYPTO #ifndef _NO_CRYPTO
#include "../FileManager/PasswordDialog.h" #include "../FileManager/PasswordDialog.h"
#endif #endif

View File

@@ -25,14 +25,13 @@ COMMON_OBJS = \
$O\IntToString.obj \ $O\IntToString.obj \
$O\Lang.obj \ $O\Lang.obj \
$O\ListFileUtils.obj \ $O\ListFileUtils.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\MyString.obj \ $O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \
$O\StringConvert.obj \ $O\StringConvert.obj \
$O\StringToInt.obj \ $O\StringToInt.obj \
$O\TextConfig.obj \ $O\TextConfig.obj \
$O\UTFConvert.obj \ $O\UTFConvert.obj \
$O\MyVector.obj \
$O\Wildcard.obj \ $O\Wildcard.obj \
WIN_OBJS = \ WIN_OBJS = \

View File

@@ -5,40 +5,18 @@
#include "Lang.h" #include "Lang.h"
#include "TextConfig.h" #include "TextConfig.h"
#include "StdInStream.h" #include "../Windows/FileIO.h"
#include "UTFConvert.h" #include "UTFConvert.h"
#include "Defs.h" #include "Defs.h"
/* static bool HexStringToNumber(const UString &s, UInt32 &value)
static UInt32 HexStringToNumber(const char *string, int &finishPos)
{ {
UInt32 number = 0; value = 0;
for (finishPos = 0; finishPos < 8; finishPos++) if (s.IsEmpty())
{
char c = string[finishPos];
int a;
if (c >= '0' && c <= '9')
a = c - '0';
else if (c >= 'A' && c <= 'F')
a = 10 + c - 'A';
else if (c >= 'a' && c <= 'f')
a = 10 + c - 'a';
else
return number;
number *= 0x10;
number += a;
}
return number;
}
*/
static bool HexStringToNumber(const UString &string, UInt32 &aResultValue)
{
aResultValue = 0;
if (string.IsEmpty())
return false; return false;
for (int i = 0; i < string.Length(); i++) for (int i = 0; i < s.Length(); i++)
{ {
wchar_t c = string[i]; wchar_t c = s[i];
int a; int a;
if (c >= L'0' && c <= L'9') if (c >= L'0' && c <= L'9')
a = c - L'0'; a = c - L'0';
@@ -48,17 +26,17 @@ static bool HexStringToNumber(const UString &string, UInt32 &aResultValue)
a = 10 + c - L'a'; a = 10 + c - L'a';
else else
return false; return false;
aResultValue *= 0x10; value *= 0x10;
aResultValue += a; value += a;
} }
return true; return true;
} }
static bool WaitNextLine(const AString &string, int &pos) static bool WaitNextLine(const AString &s, int &pos)
{ {
for (;pos < string.Length(); pos++) for (; pos < s.Length(); pos++)
if (string[pos] == 0x0A) if (s[pos] == 0x0A)
return true; return true;
return false; return false;
} }
@@ -70,19 +48,29 @@ static int CompareLangItems(void *const *elem1, void *const *elem2, void *)
return MyCompare(langPair1.Value, langPair2.Value); return MyCompare(langPair1.Value, langPair2.Value);
} }
bool CLang::Open(LPCTSTR fileName) bool CLang::Open(LPCWSTR fileName)
{ {
_langPairs.Clear(); _langPairs.Clear();
CStdInStream file; NWindows::NFile::NIO::CInFile file;
if (!file.Open(fileName)) if (!file.Open(fileName))
return false; return false;
AString string; UInt64 length;
file.ReadToString(string); if (!file.GetLength(length))
return false;
if (length > (1 << 20))
return false;
AString s;
char *p = s.GetBuffer((int)length + 1);
UInt32 processed;
if (!file.Read(p, (UInt32)length, processed))
return false;
p[(UInt32)length] = 0;
s.ReleaseBuffer();
file.Close(); file.Close();
int pos = 0; int pos = 0;
if (string.Length() >= 3) if (s.Length() >= 3)
{ {
if (Byte(string[0]) == 0xEF && Byte(string[1]) == 0xBB && Byte(string[2]) == 0xBF) if (Byte(s[0]) == 0xEF && Byte(s[1]) == 0xBB && Byte(s[2]) == 0xBF)
pos += 3; pos += 3;
} }
@@ -90,15 +78,15 @@ bool CLang::Open(LPCTSTR fileName)
// read header // read header
AString stringID = ";!@Lang@!UTF-8!"; AString stringID = ";!@Lang@!UTF-8!";
if (string.Mid(pos, stringID.Length()) != stringID) if (s.Mid(pos, stringID.Length()) != stringID)
return false; return false;
pos += stringID.Length(); pos += stringID.Length();
if (!WaitNextLine(string, pos)) if (!WaitNextLine(s, pos))
return false; return false;
CObjectVector<CTextConfigPair> pairs; CObjectVector<CTextConfigPair> pairs;
if (!GetTextConfig(string.Mid(pos), pairs)) if (!GetTextConfig(s.Mid(pos), pairs))
return false; return false;
_langPairs.Reserve(_langPairs.Size()); _langPairs.Reserve(_langPairs.Size());

View File

@@ -17,7 +17,7 @@ class CLang
{ {
CObjectVector<CLangPair> _langPairs; CObjectVector<CLangPair> _langPairs;
public: public:
bool Open(LPCTSTR fileName); bool Open(LPCWSTR fileName);
void Clear() { _langPairs.Clear(); } void Clear() { _langPairs.Clear(); }
int FindItem(UInt32 value) const; int FindItem(UInt32 value) const;
bool GetMessage(UInt32 value, UString &message) const; bool GetMessage(UInt32 value, UString &message) const;

View File

@@ -2,8 +2,9 @@
#include "StdAfx.h" #include "StdAfx.h"
#include "../Windows/FileIO.h"
#include "ListFileUtils.h" #include "ListFileUtils.h"
#include "StdInStream.h"
#include "StringConvert.h" #include "StringConvert.h"
#include "UTFConvert.h" #include "UTFConvert.h"
@@ -15,14 +16,25 @@ static void RemoveQuote(UString &s)
s = s.Mid(1, s.Length() - 2); s = s.Mid(1, s.Length() - 2);
} }
bool ReadNamesFromListFile(LPCTSTR fileName, UStringVector &resultStrings, UINT codePage) bool ReadNamesFromListFile(LPCWSTR fileName, UStringVector &resultStrings, UINT codePage)
{ {
CStdInStream file; NWindows::NFile::NIO::CInFile file;
if (!file.Open(fileName)) if (!file.Open(fileName))
return false; return false;
UInt64 length;
if (!file.GetLength(length))
return false;
if (length > ((UInt32)1 << 31))
return false;
AString s; AString s;
file.ReadToString(s); char *p = s.GetBuffer((int)length + 1);
UInt32 processed;
if (!file.Read(p, (UInt32)length, processed))
return false;
p[(UInt32)length] = 0;
s.ReleaseBuffer();
file.Close();
UString u; UString u;
#ifdef CP_UTF8 #ifdef CP_UTF8
if (codePage == CP_UTF8) if (codePage == CP_UTF8)
@@ -43,7 +55,7 @@ bool ReadNamesFromListFile(LPCTSTR fileName, UStringVector &resultStrings, UINT
for(int i = 0; i < u.Length(); i++) for(int i = 0; i < u.Length(); i++)
{ {
wchar_t c = u[i]; wchar_t c = u[i];
if (c == L'\n') if (c == L'\n' || c == 0xD)
{ {
t.Trim(); t.Trim();
RemoveQuote(t); RemoveQuote(t);

View File

@@ -6,6 +6,6 @@
#include "MyString.h" #include "MyString.h"
#include "Types.h" #include "Types.h"
bool ReadNamesFromListFile(LPCTSTR fileName, UStringVector &strings, UINT codePage = CP_OEMCP); bool ReadNamesFromListFile(LPCWSTR fileName, UStringVector &strings, UINT codePage = CP_OEMCP);
#endif #endif

View File

@@ -75,7 +75,7 @@ bool CStdInStream::Eof()
int CStdInStream::GetChar() int CStdInStream::GetChar()
{ {
int c = getc(_stream); int c = fgetc(_stream); // getc() doesn't work in BeOS?
if(c == EOF && !Eof()) if(c == EOF && !Eof())
throw kReadErrorMessage; throw kReadErrorMessage;
return c; return c;

131
CPP/Windows/Clipboard.cpp Executable file
View File

@@ -0,0 +1,131 @@
// Windows/Clipboard.cpp
#include "StdAfx.h"
#include "Windows/Clipboard.h"
#include "Windows/Defs.h"
#include "Windows/Memory.h"
#include "Windows/Shell.h"
#include "Windows/Memory.h"
#include "Common/StringConvert.h"
namespace NWindows {
bool CClipboard::Open(HWND wndNewOwner)
{
m_Open = BOOLToBool(::OpenClipboard(wndNewOwner));
return m_Open;
}
CClipboard::~CClipboard()
{
Close();
}
bool CClipboard::Close()
{
if (!m_Open)
return true;
m_Open = !BOOLToBool(CloseClipboard());
return !m_Open;
}
bool ClipboardIsFormatAvailableHDROP()
{
return BOOLToBool(IsClipboardFormatAvailable(CF_HDROP));
}
/*
bool ClipboardGetTextString(AString &s)
{
s.Empty();
if (!IsClipboardFormatAvailable(CF_TEXT))
return false;
CClipboard clipboard;
if (!clipboard.Open(NULL))
return false;
HGLOBAL h = ::GetClipboardData(CF_TEXT);
if (h != NULL)
{
NMemory::CGlobalLock globalLock(h);
const char *p = (const char *)globalLock.GetPointer();
if (p != NULL)
{
s = p;
return true;
}
}
return false;
}
*/
/*
bool ClipboardGetFileNames(UStringVector &names)
{
names.Clear();
if (!IsClipboardFormatAvailable(CF_HDROP))
return false;
CClipboard clipboard;
if (!clipboard.Open(NULL))
return false;
HGLOBAL h = ::GetClipboardData(CF_HDROP);
if (h != NULL)
{
NMemory::CGlobalLock globalLock(h);
void *p = (void *)globalLock.GetPointer();
if (p != NULL)
{
NShell::CDrop drop(false);
drop.Attach((HDROP)p);
drop.QueryFileNames(names);
return true;
}
}
return false;
}
*/
static bool ClipboardSetData(UINT uFormat, const void *data, size_t size)
{
NMemory::CGlobal global;
if (!global.Alloc(GMEM_DDESHARE | GMEM_MOVEABLE, size))
return false;
{
NMemory::CGlobalLock globalLock(global);
LPVOID p = globalLock.GetPointer();
if (p == NULL)
return false;
memcpy(p, data, size);
}
if (::SetClipboardData(uFormat, global) == NULL)
return false;
global.Detach();
return true;
}
bool ClipboardSetText(HWND owner, const UString &s)
{
CClipboard clipboard;
if (!clipboard.Open(owner))
return false;
if (!::EmptyClipboard())
return false;
bool res;
res = ClipboardSetData(CF_UNICODETEXT, (const wchar_t *)s, (s.Length() + 1) * sizeof(wchar_t));
#ifndef _UNICODE
AString a;
a = UnicodeStringToMultiByte(s, CP_ACP);
res |= ClipboardSetData(CF_TEXT, (const char *)a, (a.Length() + 1) * sizeof(char));
a = UnicodeStringToMultiByte(s, CP_OEMCP);
res |= ClipboardSetData(CF_OEMTEXT, (const char *)a, (a.Length() + 1) * sizeof(char));
#endif
return res;
}
}

28
CPP/Windows/Clipboard.h Executable file
View File

@@ -0,0 +1,28 @@
// Windows/Clipboard.h
#ifndef __CLIPBOARD_H
#define __CLIPBOARD_H
#include "Common/MyString.h"
namespace NWindows {
class CClipboard
{
bool m_Open;
public:
CClipboard(): m_Open(false) {};
~CClipboard();
bool Open(HWND wndNewOwner);
bool Close();
};
bool ClipboardIsFormatAvailableHDROP();
// bool ClipboardGetFileNames(UStringVector &names);
// bool ClipboardGetTextString(AString &s);
bool ClipboardSetText(HWND owner, const UString &s);
}
#endif

View File

@@ -119,6 +119,9 @@ public:
{ return BOOLToBool(::CheckMenuRadioItem(_menu, idFirst, idLast, idCheck, flags)); } { return BOOLToBool(::CheckMenuRadioItem(_menu, idFirst, idLast, idCheck, flags)); }
DWORD CheckItem(UINT id, UINT uCheck) DWORD CheckItem(UINT id, UINT uCheck)
{ return ::CheckMenuItem(_menu, id, uCheck); } { return ::CheckMenuItem(_menu, id, uCheck); }
BOOL EnableItem(UINT uIDEnableItem, UINT uEnable)
{ return EnableMenuItem(_menu, uIDEnableItem, uEnable); }
}; };
class CMenuDestroyer class CMenuDestroyer

View File

@@ -2,7 +2,7 @@
;Defines ;Defines
!define VERSION_MAJOR 4 !define VERSION_MAJOR 4
!define VERSION_MINOR 53 !define VERSION_MINOR 54
!define VERSION_POSTFIX_FULL " beta" !define VERSION_POSTFIX_FULL " beta"
!ifdef WIN64 !ifdef WIN64
!ifdef IA64 !ifdef IA64
@@ -487,15 +487,26 @@ Section "Uninstall"
DeleteRegKey HKCR "7-Zip.7z" DeleteRegKey HKCR "7-Zip.7z"
DeleteRegKey HKCR "7-Zip.arj" DeleteRegKey HKCR "7-Zip.arj"
DeleteRegKey HKCR "7-Zip.bz2" DeleteRegKey HKCR "7-Zip.bz2"
DeleteRegKey HKCR "7-Zip.bzip2"
DeleteRegKey HKCR "7-Zip.tbz"
DeleteRegKey HKCR "7-Zip.tbz2"
DeleteRegKey HKCR "7-Zip.cab" DeleteRegKey HKCR "7-Zip.cab"
DeleteRegKey HKCR "7-Zip.cpio" DeleteRegKey HKCR "7-Zip.cpio"
DeleteRegKey HKCR "7-Zip.deb" DeleteRegKey HKCR "7-Zip.deb"
DeleteRegKey HKCR "7-Zip.gz" DeleteRegKey HKCR "7-Zip.gz"
DeleteRegKey HKCR "7-Zip.gzip"
DeleteRegKey HKCR "7-Zip.iso" DeleteRegKey HKCR "7-Zip.iso"
DeleteRegKey HKCR "7-Zip.lha"
DeleteRegKey HKCR "7-Zip.lzh"
DeleteRegKey HKCR "7-Zip.rar" DeleteRegKey HKCR "7-Zip.rar"
DeleteRegKey HKCR "7-Zip.rpm" DeleteRegKey HKCR "7-Zip.rpm"
DeleteRegKey HKCR "7-Zip.split" DeleteRegKey HKCR "7-Zip.split"
DeleteRegKey HKCR "7-Zip.swm"
DeleteRegKey HKCR "7-Zip.tar" DeleteRegKey HKCR "7-Zip.tar"
DeleteRegKey HKCR "7-Zip.taz"
DeleteRegKey HKCR "7-Zip.tgz"
DeleteRegKey HKCR "7-Zip.tpz"
DeleteRegKey HKCR "7-Zip.wim"
DeleteRegKey HKCR "7-Zip.z" DeleteRegKey HKCR "7-Zip.z"
DeleteRegKey HKCR "7-Zip.zip" DeleteRegKey HKCR "7-Zip.zip"

View File

@@ -1,8 +1,8 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?define VerMajor = "4" ?> <?define VerMajor = "4" ?>
<?define VerMinor = "53" ?> <?define VerMinor = "54" ?>
<?define VerBuild = "03" ?> <?define VerBuild = "00" ?>
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?> <?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?> <?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>
<?define MmmmVer = "$(var.MmVer).$(var.VerBuild).0" ?> <?define MmmmVer = "$(var.MmVer).$(var.VerBuild).0" ?>

View File

@@ -1,4 +1,4 @@
7-Zip 4.53 Sources 7-Zip 4.54 Sources
------------------ ------------------
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP/Vista. 7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP/Vista.