From 173c07e166fdf6fcd20f18ea73008f1b628945df Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Wed, 13 Aug 2008 00:00:00 +0000 Subject: 4.59 beta --- CPP/7zip/UI/GUI/BenchmarkDialog.cpp | 52 +++++------ CPP/7zip/UI/GUI/BenchmarkDialog.h | 6 +- CPP/7zip/UI/GUI/CompressDialog.cpp | 94 ++++++++++---------- CPP/7zip/UI/GUI/CompressDialog.h | 6 +- CPP/7zip/UI/GUI/CompressDialog.rc | 4 +- CPP/7zip/UI/GUI/Extract.rc | 6 +- CPP/7zip/UI/GUI/ExtractDialog.cpp | 22 ++--- CPP/7zip/UI/GUI/ExtractGUI.cpp | 38 ++++---- CPP/7zip/UI/GUI/ExtractGUI.h | 5 +- CPP/7zip/UI/GUI/ExtractRes.h | 4 + CPP/7zip/UI/GUI/GUI.cpp | 161 +++++++++++++++------------------- CPP/7zip/UI/GUI/GUI.dsp | 12 +-- CPP/7zip/UI/GUI/OpenCallbackGUI.cpp | 61 ------------- CPP/7zip/UI/GUI/OpenCallbackGUI.h | 35 -------- CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp | 91 +++++++++++++++---- CPP/7zip/UI/GUI/UpdateCallbackGUI.h | 10 ++- CPP/7zip/UI/GUI/UpdateGUI.cpp | 38 ++++---- CPP/7zip/UI/GUI/UpdateGUI.h | 4 +- CPP/7zip/UI/GUI/makefile | 2 +- CPP/7zip/UI/GUI/resource.h | 26 +++--- 20 files changed, 308 insertions(+), 369 deletions(-) delete mode 100755 CPP/7zip/UI/GUI/OpenCallbackGUI.cpp delete mode 100755 CPP/7zip/UI/GUI/OpenCallbackGUI.h (limited to 'CPP/7zip/UI/GUI') diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.cpp b/CPP/7zip/UI/GUI/BenchmarkDialog.cpp index 3177bb06..c7a1cc5b 100755 --- a/CPP/7zip/UI/GUI/BenchmarkDialog.cpp +++ b/CPP/7zip/UI/GUI/BenchmarkDialog.cpp @@ -21,14 +21,14 @@ static LPCWSTR kHelpTopic = L"fm/benchmark.htm"; static const UINT_PTR kTimerID = 4; static const UINT kTimerElapse = 1000; -#ifdef LANG +#ifdef LANG #include "../FileManager/LangUtils.h" #endif using namespace NWindows; -#ifdef LANG -static CIDLangPair kIDLangPairs[] = +#ifdef LANG +static CIDLangPair kIDLangPairs[] = { { IDC_BENCHMARK_DICTIONARY, 0x02000D0C }, { IDC_BENCHMARK_MEMORY, 0x03080001 }, @@ -69,16 +69,16 @@ const LPCTSTR kKBs = TEXT(" KB/s"); static const int kMinDicLogSize = 21; static const UInt32 kMinDicSize = (1 << kMinDicLogSize); -static const UInt32 kMaxDicSize = +static const UInt32 kMaxDicSize = #ifdef _WIN64 (1 << 30); #else (1 << 27); #endif -bool CBenchmarkDialog::OnInit() +bool CBenchmarkDialog::OnInit() { - #ifdef LANG + #ifdef LANG LangSetWindowText(HWND(*this), 0x03080000); LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0])); #endif @@ -177,7 +177,7 @@ UInt32 CBenchmarkDialog::OnChangeDictionary() return dictionary; } -static const UInt32 g_IDs[] = +static const UInt32 g_IDs[] = { IDC_BENCHMARK_COMPRESSING_USAGE, IDC_BENCHMARK_COMPRESSING_USAGE2, @@ -231,12 +231,12 @@ void CBenchmarkDialog::OnStopButton() _syncInfo.Pause(); } -void CBenchmarkDialog::OnHelp() +void CBenchmarkDialog::OnHelp() { ShowHelpWindow(NULL, kHelpTopic); } -void CBenchmarkDialog::OnCancel() +void CBenchmarkDialog::OnCancel() { _syncInfo.Stop(); KillTimer(_timer); @@ -245,9 +245,9 @@ void CBenchmarkDialog::OnCancel() static void GetTimeString(UInt64 timeValue, TCHAR *s) { - wsprintf(s, TEXT("%02d:%02d:%02d"), + wsprintf(s, TEXT("%02d:%02d:%02d"), UInt32(timeValue / 3600), - UInt32((timeValue / 60) % 60), + UInt32((timeValue / 60) % 60), UInt32(timeValue % 60)); } @@ -281,7 +281,7 @@ void CBenchmarkDialog::PrintUsage(UInt64 usage, UINT controlID) void CBenchmarkDialog::PrintResults( UInt32 dictionarySize, - const CBenchInfo2 &info, + const CBenchInfo2 &info, UINT usageID, UINT speedID, UINT rpuID, UINT ratingID, bool decompressMode) { @@ -327,8 +327,8 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */) { UInt32 dicSizeTemp = (UInt32)MyMax(_syncInfo.ProcessedSize, UInt64(1) << 20); - dicSizeTemp = MyMin(dicSizeTemp, _syncInfo.DictionarySize), - PrintResults(dicSizeTemp, + dicSizeTemp = MyMin(dicSizeTemp, _syncInfo.DictionarySize), + PrintResults(dicSizeTemp, _syncInfo.CompressingInfoTemp, IDC_BENCHMARK_COMPRESSING_USAGE, IDC_BENCHMARK_COMPRESSING_SPEED, @@ -338,7 +338,7 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */) { PrintResults( - _syncInfo.DictionarySize, + _syncInfo.DictionarySize, _syncInfo.CompressingInfo, IDC_BENCHMARK_COMPRESSING_USAGE2, IDC_BENCHMARK_COMPRESSING_SPEED2, @@ -348,7 +348,7 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */) { PrintResults( - _syncInfo.DictionarySize, + _syncInfo.DictionarySize, _syncInfo.DecompressingInfoTemp, IDC_BENCHMARK_DECOMPRESSING_USAGE, IDC_BENCHMARK_DECOMPRESSING_SPEED, @@ -358,8 +358,8 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */) } { PrintResults( - _syncInfo.DictionarySize, - _syncInfo.DecompressingInfo, + _syncInfo.DictionarySize, + _syncInfo.DecompressingInfo, IDC_BENCHMARK_DECOMPRESSING_USAGE2, IDC_BENCHMARK_DECOMPRESSING_SPEED2, IDC_BENCHMARK_DECOMPRESSING_RPU2, @@ -368,14 +368,14 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */) if (_syncInfo.DecompressingInfo.GlobalTime > 0 && _syncInfo.CompressingInfo.GlobalTime > 0) { - UInt64 comprRating = GetCompressRating(_syncInfo.DictionarySize, + UInt64 comprRating = GetCompressRating(_syncInfo.DictionarySize, _syncInfo.CompressingInfo.GlobalTime, _syncInfo.CompressingInfo.GlobalFreq, _syncInfo.CompressingInfo.UnpackSize); - UInt64 decomprRating = GetDecompressRating(_syncInfo.DecompressingInfo.GlobalTime, - _syncInfo.DecompressingInfo.GlobalFreq, _syncInfo.DecompressingInfo.UnpackSize, + UInt64 decomprRating = GetDecompressRating(_syncInfo.DecompressingInfo.GlobalTime, + _syncInfo.DecompressingInfo.GlobalFreq, _syncInfo.DecompressingInfo.UnpackSize, _syncInfo.DecompressingInfo.PackSize, 1); PrintRating((comprRating + decomprRating) / 2, IDC_BENCHMARK_TOTAL_RATING_VALUE); PrintRating(( - GetRatingPerUsage(_syncInfo.CompressingInfo, comprRating) + + GetRatingPerUsage(_syncInfo.CompressingInfo, comprRating) + GetRatingPerUsage(_syncInfo.DecompressingInfo, decomprRating)) / 2, IDC_BENCHMARK_TOTAL_RPU_VALUE); PrintUsage((GetUsage(_syncInfo.CompressingInfo) + GetUsage(_syncInfo.DecompressingInfo)) / 2, IDC_BENCHMARK_TOTAL_USAGE_VALUE); } @@ -385,8 +385,8 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */) bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam) { - if (code == CBN_SELCHANGE && - (itemID == IDC_BENCHMARK_COMBO_DICTIONARY || + if (code == CBN_SELCHANGE && + (itemID == IDC_BENCHMARK_COMBO_DICTIONARY || itemID == IDC_BENCHMARK_COMBO_NUM_THREADS)) { OnChangeSettings(); @@ -395,8 +395,8 @@ bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam) return CModalDialog::OnCommand(code, itemID, lParam); } -bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND) -{ +bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND) +{ switch(buttonID) { case IDC_BUTTON_RESTART: diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.h b/CPP/7zip/UI/GUI/BenchmarkDialog.h index 2ba4a9a5..a57cdb39 100755 --- a/CPP/7zip/UI/GUI/BenchmarkDialog.h +++ b/CPP/7zip/UI/GUI/BenchmarkDialog.h @@ -87,7 +87,7 @@ public: void WaitCreating() { _startEvent.Lock(); } }; -class CBenchmarkDialog: +class CBenchmarkDialog: public NWindows::NControl::CModalDialog { NWindows::NControl::CComboBox m_Dictionary; @@ -109,7 +109,7 @@ class CBenchmarkDialog: void PrintUsage(UInt64 usage, UINT controlID); void PrintResults( UINT32 dictionarySize, - const CBenchInfo2 &info, UINT usageID, UINT speedID, UINT rpuID, UINT ratingID, + const CBenchInfo2 &info, UINT usageID, UINT speedID, UINT rpuID, UINT ratingID, bool decompressMode = false); UInt32 GetNumberOfThreads(); @@ -122,7 +122,7 @@ public: INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_BENCHMARK, wndParent); } }; -HRESULT Benchmark( +HRESULT Benchmark( #ifdef EXTERNAL_LZMA CCodecs *codecs, #endif diff --git a/CPP/7zip/UI/GUI/CompressDialog.cpp b/CPP/7zip/UI/GUI/CompressDialog.cpp index 51d215bc..9634ba02 100755 --- a/CPP/7zip/UI/GUI/CompressDialog.cpp +++ b/CPP/7zip/UI/GUI/CompressDialog.cpp @@ -26,7 +26,7 @@ extern bool g_IsNT; #endif -#ifdef LANG +#ifdef LANG #include "../FileManager/LangUtils.h" #endif @@ -34,8 +34,8 @@ extern bool g_IsNT; #define MY_SIZE_OF_ARRAY(x) (sizeof(x) / sizeof(x[0])) -#ifdef LANG -static CIDLangPair kIDLangPairs[] = +#ifdef LANG +static CIDLangPair kIDLangPairs[] = { { IDC_STATIC_COMPRESS_ARCHIVE, 0x02000D01 }, { IDC_STATIC_COMPRESS_FORMAT, 0x02000D03 }, @@ -94,7 +94,7 @@ enum ELevel kUltra = 9 }; -static const CLevelInfo g_Levels[] = +static const CLevelInfo g_Levels[] = { { IDS_METHOD_STORE, 0x02000D81 }, { IDS_METHOD_FASTEST, 0x02000D85 }, @@ -118,7 +118,7 @@ enum EMethodID kDeflate64 }; -static const LPCWSTR kMethodsNames[] = +static const LPCWSTR kMethodsNames[] = { L"Copy", L"LZMA", @@ -128,33 +128,33 @@ static const LPCWSTR kMethodsNames[] = L"Deflate64" }; -static const EMethodID g_7zMethods[] = +static const EMethodID g_7zMethods[] = { kLZMA, kPPMd, kBZip2 }; -static const EMethodID g_7zSfxMethods[] = +static const EMethodID g_7zSfxMethods[] = { kCopy, kLZMA, kPPMd }; -static EMethodID g_ZipMethods[] = +static EMethodID g_ZipMethods[] = { kDeflate, kDeflate64, kBZip2 }; -static EMethodID g_GZipMethods[] = +static EMethodID g_GZipMethods[] = { kDeflate }; -static EMethodID g_BZip2Methods[] = +static EMethodID g_BZip2Methods[] = { kBZip2 }; @@ -173,42 +173,42 @@ struct CFormatInfo bool EncryptFileNames; }; -static const CFormatInfo g_Formats[] = +static const CFormatInfo g_Formats[] = { - { - L"", - (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9), + { + L"", + (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9), 0, 0, false, false, false, false, false, false }, - { - k7zFormat, - (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9), + { + k7zFormat, + (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9), g_7zMethods, MY_SIZE_OF_ARRAY(g_7zMethods), true, true, true, true, true, true }, - { - L"Zip", - (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9), + { + L"Zip", + (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9), g_ZipMethods, MY_SIZE_OF_ARRAY(g_ZipMethods) , false, false, true, false, true, false }, - { - L"GZip", - (1 << 1) | (1 << 5) | (1 << 7) | (1 << 9), + { + L"GZip", + (1 << 1) | (1 << 5) | (1 << 7) | (1 << 9), g_GZipMethods, MY_SIZE_OF_ARRAY(g_GZipMethods), false, false, false, false, false, false }, - { - L"BZip2", + { + L"BZip2", (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9), - g_BZip2Methods, + g_BZip2Methods, MY_SIZE_OF_ARRAY(g_BZip2Methods), false, false, true, false, false }, - { - L"Tar", - (1 << 0), + { + L"Tar", + (1 << 0), 0, 0, false, false, false, false, false, false } @@ -236,9 +236,9 @@ static UInt64 GetMaxRamSizeForProgram() return physSize; } -bool CCompressDialog::OnInit() +bool CCompressDialog::OnInit() { - #ifdef LANG + #ifdef LANG LangSetWindowText(HWND(*this), 0x02000D00); LangSetDlgItemsText(HWND(*this), kIDLangPairs, MY_SIZE_OF_ARRAY(kIDLangPairs) ); #endif @@ -410,7 +410,7 @@ void CCompressDialog::CheckControlsEnable() EnableItem(IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, fi.Encrypt); EnableItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames); - ShowItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames); + ShowItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames ? SW_SHOW : SW_HIDE); } bool CCompressDialog::IsSFX() @@ -454,7 +454,7 @@ void CCompressDialog::OnButtonSFX() CheckVolumeEnable(); } -void CCompressDialog::OnButtonSetArchive() +void CCompressDialog::OnButtonSetArchive() { UString fileName; m_ArchivePath.GetText(fileName); @@ -489,14 +489,14 @@ static bool IsAsciiString(const UString &s) return true; } -void CCompressDialog::OnOK() +void CCompressDialog::OnOK() { _password1Control.GetText(Info.Password); if (IsZipFormat()) { if (!IsAsciiString(Info.Password)) { - MyMessageBoxResource(*this, IDS_PASSWORD_USE_ASCII, 0x02000B11); + ShowErrorMessageHwndRes(*this, IDS_PASSWORD_USE_ASCII, 0x02000B11); return; } UString method = GetEncryptionMethodSpec(); @@ -505,7 +505,7 @@ void CCompressDialog::OnOK() { if (Info.Password.Length() > 99) { - MyMessageBoxResource(*this, IDS_PASSWORD_IS_TOO_LONG, 0x02000B12); + ShowErrorMessageHwndRes(*this, IDS_PASSWORD_IS_TOO_LONG, 0x02000B12); return; } } @@ -516,7 +516,7 @@ void CCompressDialog::OnOK() _password2Control.GetText(password2); if (password2 != Info.Password) { - MyMessageBoxResource(*this, IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH, 0x02000B10); + ShowErrorMessageHwndRes(*this, IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH, 0x02000B10); return; } } @@ -558,7 +558,7 @@ void CCompressDialog::OnOK() { if (!ParseVolumeSizes(volumeString, Info.VolumeSizes)) { - MyMessageBoxResource(*this, IDS_COMPRESS_INCORRECT_VOLUME_SIZE, 0x02000D41); + ShowErrorMessageHwndRes(*this, IDS_COMPRESS_INCORRECT_VOLUME_SIZE, 0x02000D41); return; } if (!Info.VolumeSizes.IsEmpty()) @@ -568,7 +568,7 @@ void CCompressDialog::OnOK() { wchar_t s[32]; ConvertUInt64ToString(volumeSize, s); - if (::MessageBoxW(*this, MyFormatNew(IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE, 0x02000D42, s), + if (::MessageBoxW(*this, MyFormatNew(IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE, 0x02000D42, s), L"7-Zip", MB_YESNOCANCEL | MB_ICONQUESTION | MB_TASKMODAL) != IDYES) return; } @@ -595,7 +595,7 @@ void CCompressDialog::OnOK() static LPCWSTR kHelpTopic = L"fm/plugins/7-zip/add.htm"; -void CCompressDialog::OnHelp() +void CCompressDialog::OnHelp() { ShowHelpWindow(NULL, kHelpTopic); } @@ -660,7 +660,7 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam) return CModalDialog::OnCommand(code, itemID, lParam); } -void CCompressDialog::CheckSFXNameChange() +void CCompressDialog::CheckSFXNameChange() { bool isSFX = IsSFX(); CheckSFXControlsEnable(); @@ -668,7 +668,7 @@ void CCompressDialog::CheckSFXNameChange() SetArchiveName2(isSFX); } -void CCompressDialog::SetArchiveName2(bool prevWasSFX) +void CCompressDialog::SetArchiveName2(bool prevWasSFX) { UString fileName; m_ArchivePath.GetText(fileName); @@ -797,7 +797,7 @@ void CCompressDialog::SetLevel() SetMethod(); } -void CCompressDialog::SetMethod() +void CCompressDialog::SetMethod() { m_Method.ResetContent(); UInt32 level = GetLevel(); @@ -814,7 +814,7 @@ void CCompressDialog::SetMethod() if (index >= 0) { const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index]; - defaultMethod = fo.Method; + defaultMethod = fo.Method; } bool isSfx = IsSFX(); for(int m = 0; m < fi.NumMethods; m++) @@ -838,7 +838,7 @@ bool CCompressDialog::IsZipFormat() return (ai.Name.CompareNoCase(L"zip") == 0); } -void CCompressDialog::SetEncryptionMethod() +void CCompressDialog::SetEncryptionMethod() { _encryptionMethod.ResetContent(); const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()]; @@ -854,7 +854,7 @@ void CCompressDialog::SetEncryptionMethod() if (index >= 0) { const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index]; - encryptionMethod = fo.EncryptionMethod; + encryptionMethod = fo.EncryptionMethod; } _encryptionMethod.AddString(TEXT("ZipCrypto")); _encryptionMethod.AddString(TEXT("AES-256")); @@ -1365,7 +1365,7 @@ void CCompressDialog::PrintMemUsage(UINT res, UInt64 value) void CCompressDialog::SetMemoryUsage() { - UInt64 decompressMem; + UInt64 decompressMem; UInt64 memUsage = GetMemoryUsage(decompressMem); PrintMemUsage(IDC_STATIC_COMPRESS_MEMORY_VALUE, memUsage); PrintMemUsage(IDC_STATIC_COMPRESS_MEMORY_DE_VALUE, decompressMem); diff --git a/CPP/7zip/UI/GUI/CompressDialog.h b/CPP/7zip/UI/GUI/CompressDialog.h index 0b9e38c2..a88d472c 100755 --- a/CPP/7zip/UI/GUI/CompressDialog.h +++ b/CPP/7zip/UI/GUI/CompressDialog.h @@ -58,9 +58,9 @@ namespace NCompressDialog bool EncryptHeadersIsAllowed; bool EncryptHeaders; - void Init() - { - Level = Dictionary = Order = UInt32(-1); + void Init() + { + Level = Dictionary = Order = UInt32(-1); OrderMode = false; Method.Empty(); Options.Empty(); diff --git a/CPP/7zip/UI/GUI/CompressDialog.rc b/CPP/7zip/UI/GUI/CompressDialog.rc index d2a14104..397a2756 100755 --- a/CPP/7zip/UI/GUI/CompressDialog.rc +++ b/CPP/7zip/UI/GUI/CompressDialog.rc @@ -97,9 +97,9 @@ BEGIN COMBOBOX IDC_COMPRESS_COMBO_UPDATE_MODE, g4XPos, 51, g4XSize, 80, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "Options",IDC_STATIC_COMPRESS_OPTIONS, g4XPos, OptYPos, g4XSize, 48 - CONTROL "Create SF&X archive",IDC_COMPRESS_SFX, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, + CONTROL "Create SF&X archive",IDC_COMPRESS_SFX, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, g4XPos2, OptYPos + 14, g4XSize2, 10 - CONTROL "Compress shared files",IDC_COMPRESS_SHARED, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, + CONTROL "Compress shared files",IDC_COMPRESS_SHARED, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, g4XPos2, OptYPos + 30, g4XSize2, 10 GROUPBOX "Encryption",IDC_COMPRESS_ENCRYPTION, g4XPos, PswYPos, g4XSize, 127 diff --git a/CPP/7zip/UI/GUI/Extract.rc b/CPP/7zip/UI/GUI/Extract.rc index 4f2a520c..0c655ce4 100755 --- a/CPP/7zip/UI/GUI/Extract.rc +++ b/CPP/7zip/UI/GUI/Extract.rc @@ -2,8 +2,9 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -STRINGTABLE DISCARDABLE +STRINGTABLE DISCARDABLE BEGIN + IDS_UPDATE_NOT_SUPPORTED "Update operations are not supported for this archive." IDS_CANNOT_CREATE_FOLDER "Cannot create folder '{0}'" IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE "File is not supported archive." IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC "CRC failed in '{0}'. File is broken." @@ -16,4 +17,7 @@ BEGIN IDS_PROGRESS_EXTRACTING "Extracting" IDS_CANT_OPEN_ARCHIVE "Can not open file '{0}' as archive" IDS_CANT_OPEN_ENCRYPTED_ARCHIVE "Can not open encrypted archive '{0}'. Wrong password?" + IDS_MEM_ERROR "The system cannot allocate the required amount of memory" + IDS_UNKNOWN_ERROR "Unknown Error" + IDS_UNSUPPORTED_ARCHIVE_TYPE "Unsupported archive type" END diff --git a/CPP/7zip/UI/GUI/ExtractDialog.cpp b/CPP/7zip/UI/GUI/ExtractDialog.cpp index 876fbbba..6b388700 100755 --- a/CPP/7zip/UI/GUI/ExtractDialog.cpp +++ b/CPP/7zip/UI/GUI/ExtractDialog.cpp @@ -94,7 +94,7 @@ void CExtractDialog::SetPathMode() for (int i = 0; i < kNumPathnamesButtons; i++) if(PathMode == kPathModeButtonsVals[i]) { - CheckRadioButton(kPathModeButtons[0], kPathModeButtons[kNumPathnamesButtons - 1], + CheckRadioButton(kPathModeButtons[0], kPathModeButtons[kNumPathnamesButtons - 1], kPathModeButtons[i]); return; } @@ -121,7 +121,7 @@ void CExtractDialog::SetOverwriteMode() for (int i = 0; i < kNumOverwriteButtons; i++) if(OverwriteMode == kOverwriteButtonsVals[i]) { - CheckRadioButton(kOverwriteButtons[0], kOverwriteButtons[kNumOverwriteButtons - 1], + CheckRadioButton(kOverwriteButtons[0], kOverwriteButtons[kNumOverwriteButtons - 1], kOverwriteButtons[i]); return; } @@ -142,8 +142,8 @@ int CExtractDialog::GetFilesMode() const #endif -#ifdef LANG -static CIDLangPair kIDLangPairs[] = +#ifdef LANG +static CIDLangPair kIDLangPairs[] = { { IDC_STATIC_EXTRACT_EXTRACT_TO, 0x02000801 }, { IDC_EXTRACT_PATH_MODE, 0x02000810 }, @@ -174,9 +174,9 @@ static CIDLangPair kIDLangPairs[] = static const int kHistorySize = 8; #endif -bool CExtractDialog::OnInit() +bool CExtractDialog::OnInit() { - #ifdef LANG + #ifdef LANG LangSetWindowText(HWND(*this), 0x02000800); LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0])); #endif @@ -210,7 +210,7 @@ bool CExtractDialog::OnInit() #endif /* - if(extractionInfo.Paths.Size() > 0) + if(extractionInfo.Paths.Size() > 0) _path.SetCurSel(0); else _path.SetCurSel(-1); @@ -223,7 +223,7 @@ bool CExtractDialog::OnInit() SetOverwriteMode(); /* - CheckRadioButton(kFilesButtons[0], kFilesButtons[kNumFilesButtons - 1], + CheckRadioButton(kFilesButtons[0], kFilesButtons[kNumFilesButtons - 1], kFilesButtons[_filesMode]); */ @@ -278,7 +278,7 @@ bool CExtractDialog::OnButtonClicked(int buttonID, HWND buttonHWND) return CModalDialog::OnButtonClicked(buttonID, buttonHWND); } -void CExtractDialog::OnButtonSetPath() +void CExtractDialog::OnButtonSetPath() { UString currentPath; _path.GetText(currentPath); @@ -300,7 +300,7 @@ void AddUniqueString(UStringVector &list, const UString &s) list.Add(s); } -void CExtractDialog::OnOK() +void CExtractDialog::OnOK() { #ifndef _SFX GetPathMode(); @@ -365,7 +365,7 @@ void CExtractDialog::UpdateWildCardState() #ifndef NO_REGISTRY static LPCWSTR kHelpTopic = L"fm/plugins/7-zip/extract.htm"; -void CExtractDialog::OnHelp() +void CExtractDialog::OnHelp() { ShowHelpWindow(NULL, kHelpTopic); CModalDialog::OnHelp(); diff --git a/CPP/7zip/UI/GUI/ExtractGUI.cpp b/CPP/7zip/UI/GUI/ExtractGUI.cpp index 7936fa86..a03bd77a 100755 --- a/CPP/7zip/UI/GUI/ExtractGUI.cpp +++ b/CPP/7zip/UI/GUI/ExtractGUI.cpp @@ -21,7 +21,6 @@ #include "resource.h" #include "ExtractRes.h" -#include "OpenCallbackGUI.h" #include "ExtractDialog.h" using namespace NWindows; @@ -32,11 +31,12 @@ struct CThreadExtracting { CCodecs *codecs; CExtractCallbackImp *ExtractCallbackSpec; + CIntVector FormatIndices; + UStringVector *ArchivePaths; UStringVector *ArchivePathsFull; const NWildcard::CCensorNode *WildcardCensor; const CExtractOptions *Options; - COpenCallbackGUI *OpenCallback; CMyComPtr ExtractCallback; CDecompressStat Stat; UString ErrorMessage; @@ -48,20 +48,20 @@ struct CThreadExtracting try { Result = DecompressArchives( - codecs, + codecs, FormatIndices, *ArchivePaths, *ArchivePathsFull, - *WildcardCensor, *Options, OpenCallback, ExtractCallback, ErrorMessage, Stat); + *WildcardCensor, *Options, ExtractCallbackSpec, ExtractCallback, ErrorMessage, Stat); } catch(const UString &s) { ErrorMessage = s; Result = E_FAIL; - } + } catch(const wchar_t *s) { ErrorMessage = s; Result = E_FAIL; - } + } catch(const char *s) { ErrorMessage = GetUnicodeString(s); @@ -110,16 +110,17 @@ static void AddSizePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s HRESULT ExtractGUI( CCodecs *codecs, - UStringVector &archivePaths, + const CIntVector &formatIndices, + UStringVector &archivePaths, UStringVector &archivePathsFull, const NWildcard::CCensorNode &wildcardCensor, CExtractOptions &options, bool showDialog, - COpenCallbackGUI *openCallback, CExtractCallbackImp *extractCallback) { CThreadExtracting extracter; extracter.codecs = codecs; + extracter.FormatIndices = formatIndices; if (!options.TestMode) { @@ -131,7 +132,7 @@ HRESULT ExtractGUI( CExtractDialog dialog; if (!NFile::NDirectory::MyGetFullPathName(outputDir, dialog.DirectoryPath)) { - MyMessageBox(kIncorrectOutDir); + ShowErrorMessage(kIncorrectOutDir); return E_FAIL; } NFile::NName::NormalizeDirPathPrefix(dialog.DirectoryPath); @@ -145,13 +146,13 @@ HRESULT ExtractGUI( options.OverwriteMode = dialog.OverwriteMode; options.PathMode = dialog.PathMode; #ifndef _SFX - openCallback->Password = dialog.Password; - openCallback->PasswordIsDefined = !dialog.Password.IsEmpty(); + extractCallback->Password = dialog.Password; + extractCallback->PasswordIsDefined = !dialog.Password.IsEmpty(); #endif } if (!NFile::NDirectory::MyGetFullPathName(outputDir, options.OutputDir)) { - MyMessageBox(kIncorrectOutDir); + ShowErrorMessage(kIncorrectOutDir); return E_FAIL; } NFile::NName::NormalizeDirPathPrefix(options.OutputDir); @@ -160,10 +161,10 @@ HRESULT ExtractGUI( if(!NFile::NDirectory::CreateComplexDirectory(options.OutputDir)) { UString s = GetUnicodeString(NError::MyFormatMessage(GetLastError())); - UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER, - #ifdef LANG - 0x02000603, - #endif + UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER, + #ifdef LANG + 0x02000603, + #endif options.OutputDir); MyMessageBox(s2 + UString(L"\n") + s); return E_FAIL; @@ -171,7 +172,7 @@ HRESULT ExtractGUI( */ } - UString title = LangStringSpec(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING, + UString title = LangStringSpec(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING, options.TestMode ? 0x02000F90: 0x02000890); extracter.ExtractCallbackSpec = extractCallback; @@ -182,12 +183,11 @@ HRESULT ExtractGUI( extracter.ArchivePathsFull = &archivePathsFull; extracter.WildcardCensor = &wildcardCensor; extracter.Options = &options; - extracter.OpenCallback = openCallback; NWindows::CThread thread; RINOK(thread.Create(CThreadExtracting::MyThreadFunction, &extracter)); extracter.ExtractCallbackSpec->StartProgressDialog(title); - if (extracter.Result == S_OK && options.TestMode && + if (extracter.Result == S_OK && options.TestMode && extracter.ExtractCallbackSpec->Messages.IsEmpty() && extracter.ExtractCallbackSpec->NumArchiveErrors == 0) { diff --git a/CPP/7zip/UI/GUI/ExtractGUI.h b/CPP/7zip/UI/GUI/ExtractGUI.h index dfc59945..ffefabfe 100755 --- a/CPP/7zip/UI/GUI/ExtractGUI.h +++ b/CPP/7zip/UI/GUI/ExtractGUI.h @@ -4,18 +4,17 @@ #define __EXTRACT_GUI_H #include "../Common/Extract.h" -#include "OpenCallbackGUI.h" #include "../FileManager/ExtractCallback.h" HRESULT ExtractGUI( CCodecs *codecs, - UStringVector &archivePaths, + const CIntVector &formatIndices, + UStringVector &archivePaths, UStringVector &archivePathsFull, const NWildcard::CCensorNode &wildcardCensor, CExtractOptions &options, bool showDialog, - COpenCallbackGUI *openCallback, CExtractCallbackImp *extractCallback); #endif diff --git a/CPP/7zip/UI/GUI/ExtractRes.h b/CPP/7zip/UI/GUI/ExtractRes.h index 917c0a34..084181ea 100755 --- a/CPP/7zip/UI/GUI/ExtractRes.h +++ b/CPP/7zip/UI/GUI/ExtractRes.h @@ -1,3 +1,4 @@ +#define IDS_UPDATE_NOT_SUPPORTED 199 #define IDS_CANNOT_CREATE_FOLDER 200 #define IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE 201 @@ -13,3 +14,6 @@ #define IDS_CANT_OPEN_ARCHIVE 103 #define IDS_CANT_OPEN_ENCRYPTED_ARCHIVE 104 +#define IDS_MEM_ERROR 105 +#define IDS_UNKNOWN_ERROR 106 +#define IDS_UNSUPPORTED_ARCHIVE_TYPE 107 diff --git a/CPP/7zip/UI/GUI/GUI.cpp b/CPP/7zip/UI/GUI/GUI.cpp index 65b7fafa..e1117188 100755 --- a/CPP/7zip/UI/GUI/GUI.cpp +++ b/CPP/7zip/UI/GUI/GUI.cpp @@ -4,8 +4,8 @@ #include -extern "C" -{ +extern "C" +{ #include "../../../../C/Alloc.h" } @@ -14,26 +14,17 @@ extern "C" #include "Common/CommandLineParser.h" #include "Common/MyException.h" -#include "Windows/COM.h" -#include "Windows/FileMapping.h" -#include "Windows/FileDir.h" -#include "Windows/Synchronization.h" #include "Windows/Error.h" -#include "Windows/FileName.h" #ifdef _WIN32 #include "Windows/MemoryLock.h" #endif -#include "../../IStream.h" -#include "../../IPassword.h" - #include "../FileManager/StringUtils.h" #include "../Common/ExitCode.h" #include "../Common/ArchiveCommandLine.h" #include "ExtractRes.h" -#include "../Explorer/MyMessages.h" #include "ExtractGUI.h" #include "UpdateGUI.h" @@ -46,31 +37,37 @@ HINSTANCE g_hInstance; bool g_IsNT = false; #endif -// static const wchar_t *kExceptionErrorMessage = L"Error:"; -// static const wchar_t *kUserBreak = L"Break signaled"; +static void ErrorMessage(LPCWSTR message) +{ + MessageBoxW(NULL, message, L"7-Zip", MB_ICONERROR | MB_OK); +} + +static void ErrorLangMessage(UINT resourceID, UInt32 langID) +{ + ErrorMessage(LangString(resourceID, langID)); +} -static const wchar_t *kMemoryExceptionMessage = L"ERROR: Can't allocate required memory!"; -static const wchar_t *kUnknownExceptionMessage = L"Unknown Error"; -// static const wchar_t *kInternalExceptionMessage = L"Internal Error #"; -// static const wchar_t *kIncorrectCommandMessage = L"Incorrect command"; +static const char *kNoFormats = "7-Zip cannot find the code that works with archives."; -static void ErrorMessage(const wchar_t *message) +static int ShowMemErrorMessage() { - MessageBoxW(0, message, L"7-Zip GUI", MB_ICONERROR); + ErrorLangMessage(IDS_MEM_ERROR, 0x0200060B); + return NExitCode::kMemoryError; } -int Main2() +static int ShowSysErrorMessage(DWORD errorCode) { - /* - TCHAR t[512]; - GetCurrentDirectory(512, t); - ErrorMessage(t); - return 0; - */ + if (errorCode == E_OUTOFMEMORY) + return ShowMemErrorMessage(); + ErrorMessage(NError::MyFormatMessageW(errorCode)); + return NExitCode::kFatalError; +} +static int Main2() +{ UStringVector commandStrings; NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings); - if(commandStrings.Size() <= 1) + if (commandStrings.Size() <= 1) { MessageBoxW(0, L"Specify command", L"7-Zip", 0); return 0; @@ -95,6 +92,17 @@ int Main2() throw CSystemException(result); bool isExtractGroupCommand = options.Command.IsFromExtractGroup(); + if (codecs->Formats.Size() == 0 && + (isExtractGroupCommand || + options.Command.IsFromUpdateGroup())) + throw kNoFormats; + + CIntVector formatIndices; + if (!codecs->FindFormatForArchiveType(options.ArcType, formatIndices)) + { + ErrorLangMessage(IDS_UNSUPPORTED_ARCHIVE_TYPE, 0x0200060D); + return NExitCode::kFatalError; + } if (options.Command.CommandType == NCommandType::kBenchmark) { @@ -115,10 +123,6 @@ int Main2() ecs->Password = options.Password; ecs->Init(); - COpenCallbackGUI openCallback; - openCallback.PasswordIsDefined = options.PasswordEnabled; - openCallback.Password = options.Password; - CExtractOptions eo; eo.StdOutMode = options.StdOutMode; eo.OutputDir = options.OutputDir; @@ -130,25 +134,21 @@ int Main2() eo.Properties = options.ExtractProperties; #endif - HRESULT result = ExtractGUI(codecs, - options.ArchivePathsSorted, + HRESULT result = ExtractGUI(codecs, formatIndices, + options.ArchivePathsSorted, options.ArchivePathsFullSorted, - options.WildcardCensor.Pairs.Front().Head, - eo, options.ShowDialog, &openCallback, ecs); + options.WildcardCensor.Pairs.Front().Head, + eo, options.ShowDialog, ecs); if (result != S_OK) throw CSystemException(result); if (ecs->Messages.Size() > 0 || ecs->NumArchiveErrors != 0) - return NExitCode::kFatalError; + return NExitCode::kFatalError; } else if (options.Command.IsFromUpdateGroup()) { - bool passwordIsDefined = + bool passwordIsDefined = options.PasswordEnabled && !options.Password.IsEmpty(); - COpenCallbackGUI openCallback; - openCallback.PasswordIsDefined = passwordIsDefined; - openCallback.Password = options.Password; - CUpdateCallbackGUI callback; // callback.EnablePercents = options.EnablePercents; callback.PasswordIsDefined = passwordIsDefined; @@ -159,27 +159,33 @@ int Main2() CUpdateErrorInfo errorInfo; - if (!options.UpdateOptions.Init(codecs, options.ArchiveName, options.ArcType)) - throw "Unsupported archive type"; + if (!options.UpdateOptions.Init(codecs, formatIndices, options.ArchiveName)) + { + ErrorLangMessage(IDS_UPDATE_NOT_SUPPORTED, 0x02000601); + return NExitCode::kFatalError; + } HRESULT result = UpdateGUI( codecs, - options.WildcardCensor, options.UpdateOptions, + options.WildcardCensor, options.UpdateOptions, options.ShowDialog, - errorInfo, &openCallback, &callback); + errorInfo, &callback); if (result != S_OK) { if (!errorInfo.Message.IsEmpty()) + { ErrorMessage(errorInfo.Message); + if (result == E_FAIL) + return NExitCode::kFatalError; + } throw CSystemException(result); } if (callback.FailedFiles.Size() > 0) - return NExitCode::kWarning; + return NExitCode::kWarning; } else { - ErrorMessage(L"Use correct command"); - return 0; + throw "Unsupported command"; } return 0; } @@ -188,7 +194,7 @@ static bool inline IsItWindowsNT() { OSVERSIONINFO versionInfo; versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) + if (!::GetVersionEx(&versionInfo)) return false; return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); } @@ -199,7 +205,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR / #ifdef _UNICODE if (!IsItWindowsNT()) { - MyMessageBox(L"This program requires Windows NT/2000/XP/2003"); + ErrorMessage(L"This program requires Windows NT/2000/2003/2008/XP/Vista"); return NExitCode::kFatalError; } #else @@ -221,64 +227,43 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR / } catch(const CNewException &) { - MyMessageBox(kMemoryExceptionMessage); - return (NExitCode::kMemoryError); + return ShowMemErrorMessage(); } catch(const CArchiveCommandLineException &e) { - MyMessageBox(GetUnicodeString(e)); - return (NExitCode::kUserError); + ErrorMessage(GetUnicodeString(e)); + return NExitCode::kUserError; } catch(const CSystemException &systemError) { - if (systemError.ErrorCode == E_OUTOFMEMORY) - { - MyMessageBox(kMemoryExceptionMessage); - return (NExitCode::kMemoryError); - } if (systemError.ErrorCode == E_ABORT) - { - // MyMessageBox(kUserBreak); - return (NExitCode::kUserBreak); - } - UString message; - NError::MyFormatMessage(systemError.ErrorCode, message); - MyMessageBox(message); - return (NExitCode::kFatalError); - } - /* - catch(NExitCode::EEnum &exitCode) - { - g_StdErr << kInternalExceptionMessage << exitCode << endl; - return (exitCode); + return NExitCode::kUserBreak; + return ShowSysErrorMessage(systemError.ErrorCode); } - */ catch(const UString &s) { - MyMessageBox(s); - return (NExitCode::kFatalError); + ErrorMessage(s); + return NExitCode::kFatalError; } catch(const AString &s) { - MyMessageBox(GetUnicodeString(s)); - return (NExitCode::kFatalError); + ErrorMessage(GetUnicodeString(s)); + return NExitCode::kFatalError; } - catch(const char *s) + catch(const wchar_t *s) { - MyMessageBox(GetUnicodeString(s)); - return (NExitCode::kFatalError); + ErrorMessage(s); + return NExitCode::kFatalError; } - /* - catch(int t) + catch(const char *s) { - g_StdErr << kInternalExceptionMessage << t << endl; - return (NExitCode::kFatalError); + ErrorMessage(GetUnicodeString(s)); + return NExitCode::kFatalError; } - */ catch(...) { - MyMessageBox(kUnknownExceptionMessage); - return (NExitCode::kFatalError); + ErrorLangMessage(IDS_UNKNOWN_ERROR, 0x0200060C); + return NExitCode::kFatalError; } } diff --git a/CPP/7zip/UI/GUI/GUI.dsp b/CPP/7zip/UI/GUI/GUI.dsp index b61ef92f..1de7ac97 100755 --- a/CPP/7zip/UI/GUI/GUI.dsp +++ b/CPP/7zip/UI/GUI/GUI.dsp @@ -561,14 +561,6 @@ SOURCE=.\GUI.cpp # End Source File # Begin Source File -SOURCE=.\OpenCallbackGUI.cpp -# End Source File -# Begin Source File - -SOURCE=.\OpenCallbackGUI.h -# End Source File -# Begin Source File - SOURCE=.\UpdateCallbackGUI.cpp # End Source File # Begin Source File @@ -959,6 +951,10 @@ SOURCE=..\..\..\Windows\System.h # End Source File # Begin Source File +SOURCE=..\..\..\Windows\Time.cpp +# End Source File +# Begin Source File + SOURCE=..\..\..\Windows\Window.cpp # End Source File # Begin Source File diff --git a/CPP/7zip/UI/GUI/OpenCallbackGUI.cpp b/CPP/7zip/UI/GUI/OpenCallbackGUI.cpp deleted file mode 100755 index 7717de99..00000000 --- a/CPP/7zip/UI/GUI/OpenCallbackGUI.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// OpenCallbackGUI.cpp - -#include "StdAfx.h" - -#include "OpenCallbackGUI.h" - -#ifndef _NO_CRYPTO -#include "../FileManager/PasswordDialog.h" -#endif - -HRESULT COpenCallbackGUI::CheckBreak() -{ - return S_OK; -} - -HRESULT COpenCallbackGUI::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */) -{ - return S_OK; -} - -HRESULT COpenCallbackGUI::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */) -{ - return S_OK; -} - -#ifndef _NO_CRYPTO -HRESULT COpenCallbackGUI::CryptoGetTextPassword(BSTR *password) -{ - PasswordWasAsked = true; - if (!PasswordIsDefined) - { - CPasswordDialog dialog; - if (dialog.Create(ParentWindow) == IDCANCEL) - return E_ABORT; - Password = dialog.Password; - PasswordIsDefined = true; - } - CMyComBSTR tempName(Password); - *password = tempName.Detach(); - return S_OK; -} - -HRESULT COpenCallbackGUI::GetPasswordIfAny(UString &password) -{ - if (PasswordIsDefined) - password = Password; - return S_OK; -} - -bool COpenCallbackGUI::WasPasswordAsked() -{ - return PasswordWasAsked; -} - -void COpenCallbackGUI::ClearPasswordWasAskedFlag() -{ - PasswordWasAsked = false; -} - -#endif - diff --git a/CPP/7zip/UI/GUI/OpenCallbackGUI.h b/CPP/7zip/UI/GUI/OpenCallbackGUI.h deleted file mode 100755 index 6b531d3c..00000000 --- a/CPP/7zip/UI/GUI/OpenCallbackGUI.h +++ /dev/null @@ -1,35 +0,0 @@ -// OpenCallbackGUI.h - -#ifndef __OPEN_CALLBACK_GUI_H -#define __OPEN_CALLBACK_GUI_H - -#include "../Common/ArchiveOpenCallback.h" - -class COpenCallbackGUI: public IOpenCallbackUI -{ -public: - HRESULT CheckBreak(); - HRESULT SetTotal(const UInt64 *files, const UInt64 *bytes); - HRESULT SetCompleted(const UInt64 *files, const UInt64 *bytes); - #ifndef _NO_CRYPTO - HRESULT CryptoGetTextPassword(BSTR *password); - HRESULT GetPasswordIfAny(UString &password); - bool WasPasswordAsked(); - void ClearPasswordWasAskedFlag(); - - bool PasswordIsDefined; - UString Password; - bool PasswordWasAsked; - #endif - - HWND ParentWindow; - - COpenCallbackGUI(): - #ifndef _NO_CRYPTO - PasswordIsDefined(false), - PasswordWasAsked(false), - #endif - ParentWindow(0) {} -}; - -#endif diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp b/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp index a17f0cac..7cd5df95 100755 --- a/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp +++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp @@ -41,9 +41,9 @@ void CUpdateCallbackGUI::AddErrorMessage(LPCWSTR message) void CUpdateCallbackGUI::AddErrorMessage(const wchar_t *name, DWORD systemError) { AddErrorMessage( - UString(L"WARNING: ") + - NError::MyFormatMessageW(systemError) + - UString(L": ") + + UString(L"WARNING: ") + + NError::MyFormatMessageW(systemError) + + UString(L": ") + UString(name)); } @@ -87,15 +87,14 @@ HRESULT CUpdateCallbackGUI::FinishArchive() HRESULT CUpdateCallbackGUI::CheckBreak() { - for (;;) - { - if(ProgressDialog.ProgressSynch.GetStopped()) - return E_ABORT; - if(!ProgressDialog.ProgressSynch.GetPaused()) - break; - ::Sleep(100); - } - return S_OK; + return ProgressDialog.ProgressSynch.ProcessStopAndPause(); +} + +HRESULT CUpdateCallbackGUI::ScanProgress(UInt64 /* numFolders */, UInt64 numFiles, const wchar_t *path) +{ + ProgressDialog.ProgressSynch.SetCurrentFileName(path); + ProgressDialog.ProgressSynch.SetNumFilesTotal(numFiles); + return ProgressDialog.ProgressSynch.ProcessStopAndPause(); } HRESULT CUpdateCallbackGUI::Finilize() @@ -151,17 +150,17 @@ HRESULT CUpdateCallbackGUI::SetOperationResult(Int32 /* operationResult */) { NumFiles++; ProgressDialog.ProgressSynch.SetNumFilesCur(NumFiles); - return S_OK; + return S_OK; } HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password) { - if (!PasswordIsDefined) + if (!PasswordIsDefined) { if (AskPassword) { CPasswordDialog dialog; - if (dialog.Create(ParentWindow) == IDCANCEL) + if (dialog.Create(ProgressDialog) == IDCANCEL) return E_ABORT; Password = dialog.Password; PasswordIsDefined = true; @@ -175,9 +174,63 @@ HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BST /* It doesn't work, since main stream waits Dialog -HRESULT CUpdateCallbackGUI::CloseProgress() -{ - ProgressDialog.MyClose(); +HRESULT CUpdateCallbackGUI::CloseProgress() +{ + ProgressDialog.MyClose(); return S_OK; }; -*/ \ No newline at end of file +*/ + + +HRESULT CUpdateCallbackGUI::Open_CheckBreak() +{ + return ProgressDialog.ProgressSynch.ProcessStopAndPause(); +} + +HRESULT CUpdateCallbackGUI::Open_SetTotal(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */) +{ + // if (numFiles != NULL) ProgressDialog.ProgressSynch.SetNumFilesTotal(*numFiles); + return S_OK; +} + +HRESULT CUpdateCallbackGUI::Open_SetCompleted(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */) +{ + return ProgressDialog.ProgressSynch.ProcessStopAndPause(); +} + +#ifndef _NO_CRYPTO + +HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password) +{ + PasswordWasAsked = true; + if (!PasswordIsDefined) + { + CPasswordDialog dialog; + if (dialog.Create(ProgressDialog) == IDCANCEL) + return E_ABORT; + Password = dialog.Password; + PasswordIsDefined = true; + } + CMyComBSTR tempName(Password); + *password = tempName.Detach(); + return S_OK; +} + +HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(UString &password) +{ + if (PasswordIsDefined) + password = Password; + return S_OK; +} + +bool CUpdateCallbackGUI::Open_WasPasswordAsked() +{ + return PasswordWasAsked; +} + +void CUpdateCallbackGUI::Open_ClearPasswordWasAskedFlag() +{ + PasswordWasAsked = false; +} + +#endif diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI.h b/CPP/7zip/UI/GUI/UpdateCallbackGUI.h index dc370638..1f8b70e0 100755 --- a/CPP/7zip/UI/GUI/UpdateCallbackGUI.h +++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI.h @@ -4,19 +4,24 @@ #define __UPDATE_CALLBACK_GUI_H #include "../Common/Update.h" +#include "../Common/ArchiveOpenCallback.h" #include "../FileManager/ProgressDialog2.h" -class CUpdateCallbackGUI: public IUpdateCallbackUI2 +class CUpdateCallbackGUI: + public IOpenCallbackUI, + public IUpdateCallbackUI2 { public: // bool StdOutMode; bool PasswordIsDefined; UString Password; bool AskPassword; + bool PasswordWasAsked; UInt64 NumFiles; - CUpdateCallbackGUI(): + CUpdateCallbackGUI(): PasswordIsDefined(false), + PasswordWasAsked(false), AskPassword(false), // StdOutMode(false) ParentWindow(0) @@ -26,6 +31,7 @@ public: void Init(); INTERFACE_IUpdateCallbackUI2(;) + INTERFACE_IOpenCallbackUI(;) // HRESULT CloseProgress(); diff --git a/CPP/7zip/UI/GUI/UpdateGUI.cpp b/CPP/7zip/UI/GUI/UpdateGUI.cpp index ca89c7c9..16edc718 100755 --- a/CPP/7zip/UI/GUI/UpdateGUI.cpp +++ b/CPP/7zip/UI/GUI/UpdateGUI.cpp @@ -23,7 +23,6 @@ #include "../Explorer/MyMessages.h" #include "ExtractRes.h" -#include "OpenCallbackGUI.h" #include "CompressDialog.h" #include "UpdateGUI.h" @@ -41,7 +40,6 @@ struct CThreadUpdating CUpdateCallbackGUI *UpdateCallbackGUI; const NWildcard::CCensor *WildcardCensor; CUpdateOptions *Options; - COpenCallbackGUI *OpenCallback; CUpdateErrorInfo *ErrorInfo; HRESULT Result; @@ -51,19 +49,19 @@ struct CThreadUpdating UpdateCallbackGUI->ProgressDialog.WaitCreating(); try { - Result = UpdateArchive(codecs, *WildcardCensor, *Options, - *ErrorInfo, OpenCallback, UpdateCallbackGUI); + Result = UpdateArchive(codecs, *WildcardCensor, *Options, + *ErrorInfo, UpdateCallbackGUI, UpdateCallbackGUI); } catch(const UString &s) { ErrorInfo->Message = s; Result = E_FAIL; - } + } catch(const wchar_t *s) { ErrorInfo->Message = s; Result = E_FAIL; - } + } catch(const char *s) { ErrorInfo->Message = GetUnicodeString(s); @@ -126,7 +124,7 @@ static bool IsThereMethodOverride(bool is7z, const UString &propertiesString) return false; } -static void ParseAndAddPropertires(CObjectVector &properties, +static void ParseAndAddPropertires(CObjectVector &properties, const UString &propertiesString) { UStringVector strings; @@ -160,14 +158,14 @@ static UString GetNumInBytesString(UInt64 v) static void SetOutProperties( CObjectVector &properties, bool is7z, - UInt32 level, + UInt32 level, bool setMethod, const UString &method, UInt32 dictionary, bool orderMode, UInt32 order, - bool solidIsSpecified, UInt64 solidBlockSize, - bool multiThreadIsAllowed, UInt32 numThreads, + bool solidIsSpecified, UInt64 solidBlockSize, + bool multiThreadIsAllowed, UInt32 numThreads, const UString &encryptionMethod, bool encryptHeadersIsAllowed, bool encryptHeaders, bool /* sfxMode */) @@ -247,7 +245,7 @@ static HRESULT ShowDialog( if (NFind::FindFile(name, fileInfo)) { if (censor.Pairs.Size() == 1 && pair.Head.IncludeItems.Size() == 1) - oneFile = !fileInfo.IsDirectory(); + oneFile = !fileInfo.IsDir(); } } } @@ -263,7 +261,7 @@ static HRESULT ShowDialog( } if(dialog.m_ArchiverInfoList.Size() == 0) { - MyMessageBox(L"No Update Engines"); + ShowErrorMessage(L"No Update Engines"); return E_FAIL; } @@ -324,13 +322,13 @@ static HRESULT ShowDialog( SetOutProperties( options.MethodMode.Properties, is7z, - di.Level, + di.Level, !methodOverride, - di.Method, - di.Dictionary, + di.Method, + di.Dictionary, di.OrderMode, di.Order, - di.SolidIsSpecified, di.SolidBlockSize, - di.MultiThreadIsAllowed, di.NumThreads, + di.SolidIsSpecified, di.SolidBlockSize, + di.MultiThreadIsAllowed, di.NumThreads, di.EncryptionMethod, di.EncryptHeadersIsAllowed, di.EncryptHeaders, di.SFXMode); @@ -364,11 +362,10 @@ static HRESULT ShowDialog( HRESULT UpdateGUI( CCodecs *codecs, - const NWildcard::CCensor &censor, + const NWildcard::CCensor &censor, CUpdateOptions &options, bool showDialog, CUpdateErrorInfo &errorInfo, - COpenCallbackGUI *openCallback, CUpdateCallbackGUI *callback) { if (showDialog) @@ -387,7 +384,6 @@ HRESULT UpdateGUI( tu.WildcardCensor = &censor; tu.Options = &options; - tu.OpenCallback = openCallback; tu.ErrorInfo = &errorInfo; NWindows::CThread thread; @@ -395,5 +391,3 @@ HRESULT UpdateGUI( tu.UpdateCallbackGUI->StartProgressDialog(LangString(IDS_PROGRESS_COMPRESSING, 0x02000DC0)); return tu.Result; } - - diff --git a/CPP/7zip/UI/GUI/UpdateGUI.h b/CPP/7zip/UI/GUI/UpdateGUI.h index db58877b..112eff0f 100755 --- a/CPP/7zip/UI/GUI/UpdateGUI.h +++ b/CPP/7zip/UI/GUI/UpdateGUI.h @@ -4,18 +4,16 @@ #define __UPDATE_GUI_H #include "../Common/Update.h" -#include "OpenCallbackGUI.h" #include "UpdateCallbackGUI.h" #include "../FileManager/UpdateCallback100.h" HRESULT UpdateGUI( CCodecs *codecs, - const NWildcard::CCensor &censor, + const NWildcard::CCensor &censor, CUpdateOptions &options, bool showDialog, CUpdateErrorInfo &errorInfo, - COpenCallbackGUI *openCallback, CUpdateCallbackGUI *callback); #endif diff --git a/CPP/7zip/UI/GUI/makefile b/CPP/7zip/UI/GUI/makefile index e37ce7d5..e2caf8ee 100755 --- a/CPP/7zip/UI/GUI/makefile +++ b/CPP/7zip/UI/GUI/makefile @@ -15,7 +15,6 @@ GUI_OBJS = \ $O\ExtractDialog.obj \ $O\ExtractGUI.obj \ $O\GUI.obj \ - $O\OpenCallbackGUI.obj \ $O\UpdateCallbackGUI.obj \ $O\UpdateGUI.obj \ @@ -50,6 +49,7 @@ WIN_OBJS = \ $O\Shell.obj \ $O\Synchronization.obj \ $O\System.obj \ + $O\Time.obj \ $O\Window.obj \ WIN_CTRL_OBJS = \ diff --git a/CPP/7zip/UI/GUI/resource.h b/CPP/7zip/UI/GUI/resource.h index 08517dec..e154e035 100755 --- a/CPP/7zip/UI/GUI/resource.h +++ b/CPP/7zip/UI/GUI/resource.h @@ -1,13 +1,13 @@ -#define IDS_CONTEXT_EXTRACT 42 -#define IDS_CONTEXT_EXTRACT_HELP 43 -#define IDS_CONTEXT_COMPRESS 44 -#define IDS_CONTEXT_COMPRESS_HELP 45 -#define IDS_CONTEXT_OPEN 46 -#define IDS_CONTEXT_OPEN_HELP 47 -#define IDS_CONTEXT_TEST 48 -#define IDS_CONTEXT_TEST_HELP 49 -#define IDS_CONTEXT_CAPTION_HELP 50 -#define IDS_CONTEXT_POPUP_CAPTION 51 +#define IDS_CONTEXT_EXTRACT 142 +#define IDS_CONTEXT_EXTRACT_HELP 143 +#define IDS_CONTEXT_COMPRESS 144 +#define IDS_CONTEXT_COMPRESS_HELP 145 +#define IDS_CONTEXT_OPEN 146 +#define IDS_CONTEXT_OPEN_HELP 147 +#define IDS_CONTEXT_TEST 148 +#define IDS_CONTEXT_TEST_HELP 149 +#define IDS_CONTEXT_CAPTION_HELP 150 +#define IDS_CONTEXT_POPUP_CAPTION 151 #define IDS_OPEN_TYPE_ALL_FILES 80 #define IDS_METHOD_STORE 81 @@ -39,7 +39,7 @@ #define IDS_PASSWORD_USE_ASCII 110 #define IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH 111 -#define IDS_PASSWORD_IS_TOO_LONG 112 +#define IDS_PASSWORD_IS_TOO_LONG 112 #define IDS_FILES_COLON 2274 #define IDS_FOLDERS_COLON 2275 @@ -47,7 +47,3 @@ #define IDS_COMPRESSED_COLON 2277 #define IDS_ARCHIVES_COLON 2278 -#define IDB_DELETE 149 -#define IDC_LIST1 1067 -#define IDC_COLUMN_EDIT_WIDTH 1068 - -- cgit v1.2.3