Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2014-11-23 03:00:00 +0300
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:51 +0300
commitf08f4dcc3c02464c17753b3feafcfe5243b9e236 (patch)
treeb0e1b15bc5368d92dff422e8ec0818564a2b00b8 /CPP/7zip/UI/GUI
parent83f8ddcc5b2161e1e3c49666265257fca8aeb12c (diff)
9.349.34
Diffstat (limited to 'CPP/7zip/UI/GUI')
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/7zG.exe.manifest0
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/BenchmarkDialog.cpp313
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/BenchmarkDialog.h25
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/BenchmarkDialog.rc188
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/BenchmarkDialogRes.h121
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/CompressDialog.cpp719
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/CompressDialog.h64
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/CompressDialog.rc206
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/CompressDialogRes.h168
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/Extract.rc63
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/ExtractDialog.cpp360
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/ExtractDialog.h48
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/ExtractDialog.rc68
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/ExtractDialogRes.h31
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/ExtractGUI.cpp158
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/ExtractGUI.h6
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/ExtractRes.h73
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/FM.icobin4846 -> 4846 bytes
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/GUI.cpp229
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/GUI.dsp144
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/GUI.dsw0
-rw-r--r--CPP/7zip/UI/GUI/HashGUI.cpp278
-rw-r--r--CPP/7zip/UI/GUI/HashGUI.h16
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/StdAfx.cpp0
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/StdAfx.h16
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp93
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/UpdateCallbackGUI.h3
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/UpdateGUI.cpp219
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/UpdateGUI.h4
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/makefile73
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/resource.rc8
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/resource2.h5
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/GUI/resource2.rc5
33 files changed, 2400 insertions, 1304 deletions
diff --git a/CPP/7zip/UI/GUI/7zG.exe.manifest b/CPP/7zip/UI/GUI/7zG.exe.manifest
index 68c6047e..68c6047e 100755..100644
--- a/CPP/7zip/UI/GUI/7zG.exe.manifest
+++ b/CPP/7zip/UI/GUI/7zG.exe.manifest
diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.cpp b/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
index 8ca87f8f..1f4bcab5 100755..100644
--- a/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
+++ b/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
@@ -2,13 +2,16 @@
#include "StdAfx.h"
-#include "Common/IntToString.h"
-#include "Common/MyException.h"
-#include "Common/StringConvert.h"
+#include "../../../Common/Defs.h"
+#include "../../../Common/IntToString.h"
+#include "../../../Common/MyException.h"
+#include "../../../Common/StringConvert.h"
+#include "../../../Common/StringToInt.h"
-#include "Windows/Error.h"
-#include "Windows/System.h"
-#include "Windows/Thread.h"
+#include "../../../Windows/System.h"
+#include "../../../Windows/Thread.h"
+
+#include "../../Common/MethodProps.h"
#include "../FileManager/HelpUtils.h"
@@ -30,39 +33,37 @@ using namespace NWindows;
UString HResultToMessage(HRESULT errorCode);
#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+static const UInt32 kLangIDs[] =
{
- { IDC_BENCHMARK_DICTIONARY, 0x02000D0C },
- { IDC_BENCHMARK_MEMORY, 0x03080001 },
- { IDC_BENCHMARK_NUM_THREADS, 0x02000D12 },
- { IDC_BENCHMARK_SPEED_LABEL, 0x03080004 },
- { IDC_BENCHMARK_RATING_LABEL, 0x03080005 },
- { IDC_BENCHMARK_COMPRESSING, 0x03080002 },
- { IDC_BENCHMARK_DECOMPRESSING, 0x03080003 },
- { IDC_BENCHMARK_CURRENT, 0x03080007 },
- { IDC_BENCHMARK_RESULTING, 0x03080008 },
- { IDC_BENCHMARK_CURRENT2, 0x03080007 },
- { IDC_BENCHMARK_RESULTING2, 0x03080008 },
- { IDC_BENCHMARK_TOTAL_RATING, 0x03080006 },
- { IDC_BENCHMARK_ELAPSED, 0x02000C01 },
- { IDC_BENCHMARK_SIZE, 0x02000C03 },
- { IDC_BENCHMARK_PASSES, 0x03080009 },
- // { IDC_BENCHMARK_ERRORS, 0x0308000A },
- { IDC_BENCHMARK_USAGE_LABEL, 0x0308000B },
- { IDC_BENCHMARK_RPU_LABEL, 0x0308000C },
- { IDC_BENCHMARK_COMBO_NUM_THREADS, 0x02000D12},
-
- { IDC_BUTTON_STOP, 0x02000714 },
- { IDC_BUTTON_RESTART, 0x02000715 },
- { IDHELP, 0x02000720 },
- { IDCANCEL, 0x02000710 }
+ IDT_BENCH_DICTIONARY,
+ IDT_BENCH_MEMORY,
+ IDT_BENCH_NUM_THREADS,
+ IDT_BENCH_SPEED,
+ IDT_BENCH_RATING_LABEL,
+ IDT_BENCH_USAGE_LABEL,
+ IDT_BENCH_RPU_LABEL,
+ IDG_BENCH_COMPRESSING,
+ IDG_BENCH_DECOMPRESSING,
+ IDG_BENCH_TOTAL_RATING,
+ IDT_BENCH_CURRENT,
+ IDT_BENCH_RESULTING,
+ IDT_BENCH_ELAPSED,
+ IDT_BENCH_PASSES,
+ IDB_STOP,
+ IDB_RESTART
};
+
+static const UInt32 kLangIDs_Colon[] =
+{
+ IDT_BENCH_SIZE
+};
+
#endif
-const LPCTSTR kProcessingString = TEXT("...");
-const LPCTSTR kMB = TEXT(" MB");
-const LPCTSTR kMIPS = TEXT(" MIPS");
-const LPCTSTR kKBs = TEXT(" KB/s");
+static const LPCTSTR kProcessingString = TEXT("...");
+static const LPCTSTR kMB = TEXT(" MB");
+static const LPCTSTR kMIPS = TEXT(" MIPS");
+static const LPCTSTR kKBs = TEXT(" KB/s");
#ifdef UNDER_CE
static const int kMinDicLogSize = 20;
@@ -80,15 +81,18 @@ static const UInt32 kMaxDicSize =
bool CBenchmarkDialog::OnInit()
{
#ifdef LANG
- LangSetWindowText(HWND(*this), 0x03080000);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ LangSetWindowText(*this, IDD_BENCH);
+ LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
+ LangSetDlgItems_Colon(*this, kLangIDs_Colon, ARRAY_SIZE(kLangIDs_Colon));
+ LangSetDlgItemText(*this, IDT_BENCH_CURRENT2, IDT_BENCH_CURRENT);
+ LangSetDlgItemText(*this, IDT_BENCH_RESULTING2, IDT_BENCH_RESULTING);
#endif
Sync.Init();
if (TotalMode)
{
- _consoleEdit.Attach(GetItem(IDC_BENCHMARK2_EDIT));
+ _consoleEdit.Attach(GetItem(IDE_BENCH2_EDIT));
LOGFONT f;
memset(&f, 0, sizeof(f));
f.lfHeight = 14;
@@ -100,7 +104,8 @@ bool CBenchmarkDialog::OnInit()
f.lfQuality = DEFAULT_QUALITY;
f.lfPitchAndFamily = FIXED_PITCH;
- MyStringCopy(f.lfFaceName, TEXT(""));
+ // MyStringCopy(f.lfFaceName, TEXT(""));
+ // f.lfFaceName[0] = 0;
_font.Create(&f);
if (_font._font)
_consoleEdit.SendMessage(WM_SETFONT, (WPARAM)_font._font, TRUE);
@@ -111,13 +116,13 @@ bool CBenchmarkDialog::OnInit()
numCPUs = 1;
numCPUs = MyMin(numCPUs, (UInt32)(1 << 8));
- if (Sync.NumThreads == (UInt32)-1)
+ if (Sync.NumThreads == (UInt32)(Int32)-1)
{
Sync.NumThreads = numCPUs;
if (Sync.NumThreads > 1)
Sync.NumThreads &= ~1;
}
- m_NumThreads.Attach(GetItem(IDC_BENCHMARK_COMBO_NUM_THREADS));
+ m_NumThreads.Attach(GetItem(IDC_BENCH_NUM_THREADS));
int cur = 0;
for (UInt32 num = 1; num <= numCPUs * 2;)
{
@@ -134,7 +139,7 @@ bool CBenchmarkDialog::OnInit()
m_NumThreads.SetCurSel(cur);
Sync.NumThreads = GetNumberOfThreads();
- m_Dictionary.Attach(GetItem(IDC_BENCHMARK_COMBO_DICTIONARY));
+ m_Dictionary.Attach(GetItem(IDC_BENCH_DICTIONARY));
cur = 0;
UInt64 ramSize = NSystem::GetRamSize();
@@ -144,7 +149,7 @@ bool CBenchmarkDialog::OnInit()
ramSize = kNormalizedCeSize;
#endif
- if (Sync.DictionarySize == (UInt32)-1)
+ if (Sync.DictionarySize == (UInt32)(Int32)-1)
{
int dicSizeLog;
for (dicSizeLog = 25; dicSizeLog > kBenchMinDicLogSize; dicSizeLog--)
@@ -205,7 +210,7 @@ bool CBenchmarkDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
{
int yPos = ySize - my - by;
RECT rect;
- GetClientRectOfItem(IDC_BENCHMARK2_EDIT, rect);
+ GetClientRectOfItem(IDE_BENCH2_EDIT, rect);
int y = rect.top;
int ySize2 = yPos - my - y;
const int kMinYSize = 20;
@@ -221,54 +226,54 @@ bool CBenchmarkDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
UInt32 CBenchmarkDialog::GetNumberOfThreads()
{
- return (UInt32)m_NumThreads.GetItemData(m_NumThreads.GetCurSel());
+ return (UInt32)m_NumThreads.GetItemData_of_CurSel();
}
UInt32 CBenchmarkDialog::OnChangeDictionary()
{
- UInt32 dictionary = (UInt32)m_Dictionary.GetItemData(m_Dictionary.GetCurSel());
+ UInt32 dictionary = (UInt32)m_Dictionary.GetItemData_of_CurSel();
UInt64 memUsage = GetBenchMemoryUsage(GetNumberOfThreads(), dictionary);
memUsage = (memUsage + (1 << 20) - 1) >> 20;
TCHAR s[40];
ConvertUInt64ToString(memUsage, s);
lstrcat(s, kMB);
- SetItemText(IDC_BENCHMARK_MEMORY_VALUE, s);
+ SetItemText(IDT_BENCH_MEMORY_VAL, s);
return dictionary;
}
static const UInt32 g_IDs[] =
{
- IDC_BENCHMARK_COMPRESSING_USAGE,
- IDC_BENCHMARK_COMPRESSING_USAGE2,
- IDC_BENCHMARK_COMPRESSING_SPEED,
- IDC_BENCHMARK_COMPRESSING_SPEED2,
- IDC_BENCHMARK_COMPRESSING_RATING,
- IDC_BENCHMARK_COMPRESSING_RATING2,
- IDC_BENCHMARK_COMPRESSING_RPU,
- IDC_BENCHMARK_COMPRESSING_RPU2,
+ IDT_BENCH_COMPRESS_USAGE1,
+ IDT_BENCH_COMPRESS_USAGE2,
+ IDT_BENCH_COMPRESS_SPEED1,
+ IDT_BENCH_COMPRESS_SPEED2,
+ IDT_BENCH_COMPRESS_RATING1,
+ IDT_BENCH_COMPRESS_RATING2,
+ IDT_BENCH_COMPRESS_RPU1,
+ IDT_BENCH_COMPRESS_RPU2,
- IDC_BENCHMARK_DECOMPRESSING_SPEED,
- IDC_BENCHMARK_DECOMPRESSING_SPEED2,
- IDC_BENCHMARK_DECOMPRESSING_RATING,
- IDC_BENCHMARK_DECOMPRESSING_RATING2,
- IDC_BENCHMARK_DECOMPRESSING_USAGE,
- IDC_BENCHMARK_DECOMPRESSING_USAGE2,
- IDC_BENCHMARK_DECOMPRESSING_RPU,
- IDC_BENCHMARK_DECOMPRESSING_RPU2,
+ IDT_BENCH_DECOMPR_SPEED1,
+ IDT_BENCH_DECOMPR_SPEED2,
+ IDT_BENCH_DECOMPR_RATING1,
+ IDT_BENCH_DECOMPR_RATING2,
+ IDT_BENCH_DECOMPR_USAGE1,
+ IDT_BENCH_DECOMPR_USAGE2,
+ IDT_BENCH_DECOMPR_RPU1,
+ IDT_BENCH_DECOMPR_RPU2,
- IDC_BENCHMARK_TOTAL_USAGE_VALUE,
- IDC_BENCHMARK_TOTAL_RATING_VALUE,
- IDC_BENCHMARK_TOTAL_RPU_VALUE
+ IDT_BENCH_TOTAL_USAGE_VAL,
+ IDT_BENCH_TOTAL_RATING_VAL,
+ IDT_BENCH_TOTAL_RPU_VAL
};
void CBenchmarkDialog::OnChangeSettings()
{
- EnableItem(IDC_BUTTON_STOP, true);
+ EnableItem(IDB_STOP, true);
UInt32 dictionary = OnChangeDictionary();
TCHAR s[40] = { TEXT('/'), TEXT(' '), 0 };
ConvertUInt32ToString(NSystem::GetNumberOfProcessors(), s + 2);
- SetItemText(IDC_BENCHMARK_HARDWARE_THREADS, s);
- for (int i = 0; i < sizeof(g_IDs) / sizeof(g_IDs[0]); i++)
+ SetItemText(IDT_BENCH_HARDWARE_THREADS, s);
+ for (int i = 0; i < ARRAY_SIZE(g_IDs); i++)
SetItemText(g_IDs[i], kProcessingString);
_startTime = GetTickCount();
PrintTime();
@@ -286,7 +291,7 @@ void CBenchmarkDialog::OnRestartButton()
void CBenchmarkDialog::OnStopButton()
{
- EnableItem(IDC_BUTTON_STOP, false);
+ EnableItem(IDB_STOP, false);
Sync.Pause();
}
@@ -302,13 +307,7 @@ void CBenchmarkDialog::OnCancel()
CModalDialog::OnCancel();
}
-static void GetTimeString(UInt64 timeValue, TCHAR *s)
-{
- wsprintf(s, TEXT("%02d:%02d:%02d"),
- UInt32(timeValue / 3600),
- UInt32((timeValue / 60) % 60),
- UInt32(timeValue % 60));
-}
+void GetTimeString(UInt64 timeValue, wchar_t *s);
void CBenchmarkDialog::PrintTime()
{
@@ -317,9 +316,9 @@ void CBenchmarkDialog::PrintTime()
UInt32 elapsedSec = elapsedTime / 1000;
if (elapsedSec != 0 && Sync.WasPaused())
return;
- TCHAR s[40];
+ WCHAR s[40];
GetTimeString(elapsedSec, s);
- SetItemText(IDC_BENCHMARK_ELAPSED_VALUE, s);
+ SetItemText(IDT_BENCH_ELAPSED_VAL, s);
}
void CBenchmarkDialog::PrintRating(UInt64 rating, UINT controlID)
@@ -347,19 +346,18 @@ void CBenchmarkDialog::PrintResults(
if (info.GlobalTime == 0)
return;
- UInt64 size = info.UnpackSize;
TCHAR s[40];
{
- UInt64 speed = size * info.GlobalFreq / info.GlobalTime;
+ UInt64 speed = info.UnpackSize * info.NumIterations * info.GlobalFreq / info.GlobalTime;
ConvertUInt64ToString(speed / 1024, s);
lstrcat(s, kKBs);
SetItemText(speedID, s);
}
UInt64 rating;
if (decompressMode)
- rating = GetDecompressRating(info.GlobalTime, info.GlobalFreq, size, info.PackSize, 1);
+ rating = info.GetDecompressRating();
else
- rating = GetCompressRating(dictionarySize, info.GlobalTime, info.GlobalFreq, size * info.NumIterations);
+ rating = info.GetCompressRating(dictionarySize);
PrintRating(rating, ratingID);
PrintRating(info.GetRatingPerUsage(rating), rpuID);
@@ -391,71 +389,63 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
TCHAR s[40];
ConvertUInt64ToString((Sync.ProcessedSize >> 20), s);
lstrcat(s, kMB);
- SetItemText(IDC_BENCHMARK_SIZE_VALUE, s);
+ SetItemText(IDT_BENCH_SIZE_VAL, s);
ConvertUInt64ToString(Sync.NumPasses, s);
- SetItemText(IDC_BENCHMARK_PASSES_VALUE, s);
-
- /*
- ConvertUInt64ToString(Sync.NumErrors, s);
- SetItemText(IDC_BENCHMARK_ERRORS_VALUE, s);
- */
+ SetItemText(IDT_BENCH_PASSES_VAL, s);
{
UInt32 dicSizeTemp = (UInt32)MyMax(Sync.ProcessedSize, UInt64(1) << 20);
dicSizeTemp = MyMin(dicSizeTemp, Sync.DictionarySize),
PrintResults(dicSizeTemp,
Sync.CompressingInfoTemp,
- IDC_BENCHMARK_COMPRESSING_USAGE,
- IDC_BENCHMARK_COMPRESSING_SPEED,
- IDC_BENCHMARK_COMPRESSING_RPU,
- IDC_BENCHMARK_COMPRESSING_RATING);
+ IDT_BENCH_COMPRESS_USAGE1,
+ IDT_BENCH_COMPRESS_SPEED1,
+ IDT_BENCH_COMPRESS_RPU1,
+ IDT_BENCH_COMPRESS_RATING1);
}
{
PrintResults(
Sync.DictionarySize,
Sync.CompressingInfo,
- IDC_BENCHMARK_COMPRESSING_USAGE2,
- IDC_BENCHMARK_COMPRESSING_SPEED2,
- IDC_BENCHMARK_COMPRESSING_RPU2,
- IDC_BENCHMARK_COMPRESSING_RATING2);
+ IDT_BENCH_COMPRESS_USAGE2,
+ IDT_BENCH_COMPRESS_SPEED2,
+ IDT_BENCH_COMPRESS_RPU2,
+ IDT_BENCH_COMPRESS_RATING2);
}
{
PrintResults(
Sync.DictionarySize,
Sync.DecompressingInfoTemp,
- IDC_BENCHMARK_DECOMPRESSING_USAGE,
- IDC_BENCHMARK_DECOMPRESSING_SPEED,
- IDC_BENCHMARK_DECOMPRESSING_RPU,
- IDC_BENCHMARK_DECOMPRESSING_RATING,
+ IDT_BENCH_DECOMPR_USAGE1,
+ IDT_BENCH_DECOMPR_SPEED1,
+ IDT_BENCH_DECOMPR_RPU1,
+ IDT_BENCH_DECOMPR_RATING1,
true);
}
{
PrintResults(
Sync.DictionarySize,
Sync.DecompressingInfo,
- IDC_BENCHMARK_DECOMPRESSING_USAGE2,
- IDC_BENCHMARK_DECOMPRESSING_SPEED2,
- IDC_BENCHMARK_DECOMPRESSING_RPU2,
- IDC_BENCHMARK_DECOMPRESSING_RATING2,
+ IDT_BENCH_DECOMPR_USAGE2,
+ IDT_BENCH_DECOMPR_SPEED2,
+ IDT_BENCH_DECOMPR_RPU2,
+ IDT_BENCH_DECOMPR_RATING2,
true);
if (Sync.DecompressingInfo.GlobalTime > 0 &&
Sync.CompressingInfo.GlobalTime > 0)
{
- UInt64 comprRating = GetCompressRating(Sync.DictionarySize,
- Sync.CompressingInfo.GlobalTime, Sync.CompressingInfo.GlobalFreq, Sync.CompressingInfo.UnpackSize);
- UInt64 decomprRating = GetDecompressRating(Sync.DecompressingInfo.GlobalTime,
- Sync.DecompressingInfo.GlobalFreq, Sync.DecompressingInfo.UnpackSize,
- Sync.DecompressingInfo.PackSize, 1);
- PrintRating((comprRating + decomprRating) / 2, IDC_BENCHMARK_TOTAL_RATING_VALUE);
+ UInt64 comprRating = Sync.CompressingInfo.GetCompressRating(Sync.DictionarySize);
+ UInt64 decomprRating = Sync.DecompressingInfo.GetDecompressRating();
+ PrintRating((comprRating + decomprRating) / 2, IDT_BENCH_TOTAL_RATING_VAL);
PrintRating((
Sync.CompressingInfo.GetRatingPerUsage(comprRating) +
- Sync.DecompressingInfo.GetRatingPerUsage(decomprRating)) / 2, IDC_BENCHMARK_TOTAL_RPU_VALUE);
+ Sync.DecompressingInfo.GetRatingPerUsage(decomprRating)) / 2, IDT_BENCH_TOTAL_RPU_VAL);
PrintUsage(
(Sync.CompressingInfo.GetUsage() +
- Sync.DecompressingInfo.GetUsage()) / 2, IDC_BENCHMARK_TOTAL_USAGE_VALUE);
+ Sync.DecompressingInfo.GetUsage()) / 2, IDT_BENCH_TOTAL_USAGE_VAL);
}
}
return true;
@@ -464,8 +454,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 ||
- itemID == IDC_BENCHMARK_COMBO_NUM_THREADS))
+ (itemID == IDC_BENCH_DICTIONARY ||
+ itemID == IDC_BENCH_NUM_THREADS))
{
OnChangeSettings();
return true;
@@ -477,10 +467,10 @@ bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(buttonID)
{
- case IDC_BUTTON_RESTART:
+ case IDB_RESTART:
OnRestartButton();
return true;
- case IDC_BUTTON_STOP:
+ case IDB_STOP:
OnStopButton();
return true;
}
@@ -490,7 +480,7 @@ bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
struct CThreadBenchmark
{
CBenchmarkDialog *BenchmarkDialog;
- DECL_EXTERNAL_CODECS_VARS
+ DECL_EXTERNAL_CODECS_LOC_VARS2;
// UInt32 dictionarySize;
// UInt32 numThreads;
@@ -507,16 +497,23 @@ struct CBenchCallback: public IBenchCallback
{
UInt32 dictionarySize;
CProgressSyncInfo *Sync;
+
+ HRESULT SetFreq(bool showFreq, UInt64 cpuFreq);
HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
};
+HRESULT CBenchCallback::SetFreq(bool /* showFreq */, UInt64 /* cpuFreq */)
+{
+ return S_OK;
+}
+
HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final)
{
NSynchronization::CCriticalSectionLock lock(Sync->CS);
if (Sync->Changed || Sync->Paused || Sync->Stopped)
return E_ABORT;
- Sync->ProcessedSize = info.UnpackSize;
+ Sync->ProcessedSize = info.UnpackSize * info.NumIterations;
if (final && Sync->CompressingInfo.GlobalTime == 0)
{
(CBenchInfo&)Sync->CompressingInfo = info;
@@ -535,13 +532,6 @@ HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
if (Sync->Changed || Sync->Paused || Sync->Stopped)
return E_ABORT;
CBenchInfo info2 = info;
- if (info2.NumIterations == 0)
- info2.NumIterations = 1;
-
- info2.UnpackSize *= info2.NumIterations;
- info2.PackSize *= info2.NumIterations;
- info2.NumIterations = 1;
-
if (final && Sync->DecompressingInfo.GlobalTime == 0)
{
(CBenchInfo&)Sync->DecompressingInfo = info2;
@@ -642,7 +632,7 @@ HRESULT CThreadBenchmark::Process()
props.Add(prop);
}
}
- result = Bench(EXTERNAL_CODECS_VARS
+ result = Bench(EXTERNAL_CODECS_LOC_VARS
BenchmarkDialog->TotalMode ? &callback2 : NULL,
BenchmarkDialog->TotalMode ? NULL : &callback,
props, 1, false);
@@ -660,7 +650,6 @@ HRESULT CThreadBenchmark::Process()
{
if (result != E_ABORT)
{
- // sync.NumErrors++;
{
NSynchronization::CCriticalSectionLock lock(sync.CS);
sync.Pause();
@@ -695,27 +684,81 @@ HRESULT CThreadBenchmark::Process()
}
}
+static void ParseNumberString(const UString &s, NCOM::CPropVariant &prop)
+{
+ const wchar_t *end;
+ UInt64 result = ConvertStringToUInt64(s, &end);
+ if (*end != 0 || s.IsEmpty())
+ prop = s;
+ else if (result <= (UInt32)0xFFFFFFFF)
+ prop = (UInt32)result;
+ else
+ prop = result;
+}
+
HRESULT Benchmark(
DECL_EXTERNAL_CODECS_LOC_VARS
const CObjectVector<CProperty> props, HWND hwndParent)
{
CThreadBenchmark benchmarker;
#ifdef EXTERNAL_CODECS
- benchmarker._codecsInfo = codecsInfo;
- benchmarker._externalCodecs = *externalCodecs;
+ benchmarker.__externalCodecs = __externalCodecs;
#endif
CBenchmarkDialog bd;
bd.Props = props;
bd.TotalMode = false;
- for (int i = 0; i < props.Size(); i++)
+ bd.Sync.DictionarySize = (UInt32)(Int32)-1;
+ bd.Sync.NumThreads = (UInt32)(Int32)-1;
+
+ COneMethodInfo method;
+
+ UInt32 numCPUs = 1;
+ #ifndef _7ZIP_ST
+ numCPUs = NSystem::GetNumberOfProcessors();
+ #endif
+ UInt32 numThreads = numCPUs;
+
+ FOR_VECTOR (i, props)
{
const CProperty &prop = props[i];
- if (prop.Name.CompareNoCase(L"m") == 0 && prop.Value == L"*")
+ UString name = prop.Name;
+ name.MakeLower_Ascii();
+ if (name.IsEqualToNoCase(L"m") && prop.Value == L"*")
+ {
bd.TotalMode = true;
+ continue;
+ }
+
+ NCOM::CPropVariant propVariant;
+ if (!prop.Value.IsEmpty())
+ ParseNumberString(prop.Value, propVariant);
+ if (name.IsPrefixedBy(L"mt"))
+ {
+ #ifndef _7ZIP_ST
+ RINOK(ParseMtProp(name.Ptr(2), propVariant, numCPUs, numThreads));
+ if (numThreads != numCPUs)
+ bd.Sync.NumThreads = numThreads;
+ #endif
+ continue;
+ }
+ if (name.IsEqualTo("testtime"))
+ {
+ // UInt32 testTime = 4;
+ // RINOK(ParsePropToUInt32(L"", propVariant, testTime));
+ continue;
+ }
+ RINOK(method.ParseMethodFromPROPVARIANT(name, propVariant));
}
- bd.Sync.DictionarySize = (UInt32)-1;
- bd.Sync.NumThreads = (UInt32)-1;
+
+ // bool totalBenchMode = (method.MethodName == L"*");
+
+ {
+ UInt32 dict;
+ if (method.Get_DicSize(dict))
+ bd.Sync.DictionarySize = dict;
+ }
+
benchmarker.BenchmarkDialog = &bd;
NWindows::CThread thread;
diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.h b/CPP/7zip/UI/GUI/BenchmarkDialog.h
index b3ab9dcb..82531117 100755..100644
--- a/CPP/7zip/UI/GUI/BenchmarkDialog.h
+++ b/CPP/7zip/UI/GUI/BenchmarkDialog.h
@@ -3,9 +3,10 @@
#ifndef __BENCHMARK_DIALOG_H
#define __BENCHMARK_DIALOG_H
-#include "Windows/Synchronization.h"
-#include "Windows/Control/ComboBox.h"
-#include "Windows/Control/Edit.h"
+#include "../../../Windows/Synchronization.h"
+
+#include "../../../Windows/Control/ComboBox.h"
+#include "../../../Windows/Control/Edit.h"
#include "../Common/Bench.h"
@@ -16,6 +17,16 @@
struct CBenchInfo2 : public CBenchInfo
{
void Init() { GlobalTime = UserTime = 0; }
+
+ UInt64 GetCompressRating(UInt32 dictSize) const
+ {
+ return ::GetCompressRating(dictSize, GlobalTime, GlobalFreq, UnpackSize * NumIterations);
+ }
+
+ UInt64 GetDecompressRating() const
+ {
+ return ::GetDecompressRating(GlobalTime, GlobalFreq, UnpackSize, PackSize, NumIterations);
+ }
};
class CProgressSyncInfo
@@ -27,7 +38,6 @@ public:
UInt32 DictionarySize;
UInt32 NumThreads;
UInt64 NumPasses;
- // UInt64 NumErrors;
NWindows::NSynchronization::CManualResetEvent _startEvent;
NWindows::NSynchronization::CCriticalSection CS;
@@ -59,7 +69,6 @@ public:
DecompressingInfo.Init();
NumPasses = 0;
- // NumErrors = 0;
Text.Empty();
TextWasChanged = true;
@@ -115,7 +124,7 @@ class CBenchmarkDialog:
NWindows::NControl::CComboBox m_NumThreads;
NWindows::NControl::CEdit _consoleEdit;
UINT_PTR _timer;
- UINT32 _startTime;
+ UInt32 _startTime;
CMyFont _font;
bool OnSize(WPARAM /* wParam */, int xSize, int ySize);
@@ -132,7 +141,7 @@ class CBenchmarkDialog:
void PrintRating(UInt64 rating, UINT controlID);
void PrintUsage(UInt64 usage, UINT controlID);
void PrintResults(
- UINT32 dictionarySize,
+ UInt32 dictionarySize,
const CBenchInfo2 &info, UINT usageID, UINT speedID, UINT rpuID, UINT ratingID,
bool decompressMode = false);
@@ -148,7 +157,7 @@ public:
INT_PTR Create(HWND wndParent = 0)
{
BIG_DIALOG_SIZE(332, 228);
- return CModalDialog::Create(TotalMode ? IDD_DIALOG_BENCHMARK_TOTAL : SIZED_DIALOG(IDD_DIALOG_BENCHMARK), wndParent);
+ return CModalDialog::Create(TotalMode ? IDD_BENCH_TOTAL : SIZED_DIALOG(IDD_BENCH), wndParent);
}
void MessageBoxError(LPCWSTR message)
{
diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.rc b/CPP/7zip/UI/GUI/BenchmarkDialog.rc
index 6b17a12a..a31d2f25 100755..100644
--- a/CPP/7zip/UI/GUI/BenchmarkDialog.rc
+++ b/CPP/7zip/UI/GUI/BenchmarkDialog.rc
@@ -48,69 +48,72 @@
#define GROUP_Y_SIZE 40
#endif
-IDD_DIALOG_BENCHMARK DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
+IDD_BENCH DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
CAPTION "Benchmark"
MY_FONT
BEGIN
- PUSHBUTTON "&Restart", IDC_BUTTON_RESTART, bx1, m, bxs, bys
- PUSHBUTTON "&Stop", IDC_BUTTON_STOP, bx1, m + bys + 6, bxs, bys
+ PUSHBUTTON "&Restart", IDB_RESTART, bx1, m, bxs, bys
+ PUSHBUTTON "&Stop", IDB_STOP, bx1, m + bys + 6, bxs, bys
- PUSHBUTTON "&Help", IDHELP, bx2, by, bxs, bys
- PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
+ PUSHBUTTON "&Help", IDHELP, bx2, by, bxs, bys
+ PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
- LTEXT "&Dictionary size:", IDC_BENCHMARK_DICTIONARY, m, m + 1, g0xs, 8
- COMBOBOX IDC_BENCHMARK_COMBO_DICTIONARY, g1x, m, g1xs, 140, MY_COMBO
- LTEXT "Memory usage:", IDC_BENCHMARK_MEMORY, gc2x, m + 1, gc2xs, 8
- LTEXT "0 MB", IDC_BENCHMARK_MEMORY_VALUE, gc2x + gc2xs, m + 1, 40, 8
-
- LTEXT "&Number of CPU threads:", IDC_BENCHMARK_NUM_THREADS, m, 28, g0xs, 8
- COMBOBOX IDC_BENCHMARK_COMBO_NUM_THREADS, g1x, 27, g1xs, 140, MY_COMBO
- LTEXT "1", IDC_BENCHMARK_HARDWARE_THREADS, gc2x, 28, 40, 8
-
- RTEXT "CPU Usage", IDC_BENCHMARK_USAGE_LABEL, xUsage, 54, sUsage, 8
- RTEXT "Speed", IDC_BENCHMARK_SPEED_LABEL, xSpeed, 54, sSpeed, 8
- RTEXT "Rating / Usage", IDC_BENCHMARK_RPU_LABEL, xRpu, 54, sRpu, 8
- RTEXT "Rating", IDC_BENCHMARK_RATING_LABEL, xRating, 54, sRating, 8
+ LTEXT "&Dictionary size:", IDT_BENCH_DICTIONARY, m, m + 1, g0xs, 8
+ COMBOBOX IDC_BENCH_DICTIONARY, g1x, m, g1xs, 140, MY_COMBO
+
+ LTEXT "Memory usage:", IDT_BENCH_MEMORY, gc2x, m + 1, gc2xs, 8
+ LTEXT "", IDT_BENCH_MEMORY_VAL, gc2x + gc2xs, m + 1, 40, 8
+
+ LTEXT "&Number of CPU threads:", IDT_BENCH_NUM_THREADS, m, 28, g0xs, 8
+ COMBOBOX IDC_BENCH_NUM_THREADS, g1x, 27, g1xs, 140, MY_COMBO
+ LTEXT "", IDT_BENCH_HARDWARE_THREADS, gc2x, 28, 40, 8
+
+ RTEXT "CPU Usage", IDT_BENCH_USAGE_LABEL, xUsage, 54, sUsage, 8
+ RTEXT "Speed", IDT_BENCH_SPEED, xSpeed, 54, sSpeed, 8
+ RTEXT "Rating / Usage", IDT_BENCH_RPU_LABEL, xRpu, 54, sRpu, 8
+ RTEXT "Rating", IDT_BENCH_RATING_LABEL, xRating, 54, sRating, 8
- GROUPBOX "Compressing", IDC_BENCHMARK_COMPRESSING, m, 64, xc, GROUP_Y_SIZE
+ GROUPBOX "Compressing", IDG_BENCH_COMPRESSING, m, 64, xc, GROUP_Y_SIZE
- LTEXT "Current", IDC_BENCHMARK_CURRENT, g4x, 76, sLabel, 8
- RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE, xUsage, 76, sUsage, 8
- RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED, xSpeed, 76, sSpeed, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU, xRpu, 76, sRpu, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING, xRating, 76, sRating, 8
+ LTEXT "Current", IDT_BENCH_CURRENT, g4x, 76, sLabel, 8
+ RTEXT "", IDT_BENCH_COMPRESS_USAGE1, xUsage, 76, sUsage, 8
+ RTEXT "", IDT_BENCH_COMPRESS_SPEED1, xSpeed, 76, sSpeed, 8
+ RTEXT "", IDT_BENCH_COMPRESS_RPU1, xRpu, 76, sRpu, 8
+ RTEXT "", IDT_BENCH_COMPRESS_RATING1, xRating, 76, sRating, 8
- LTEXT "Resulting", IDC_BENCHMARK_RESULTING, g4x, 89, sLabel, 8
- RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE2, xUsage, 89, sUsage, 8
- RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED2, xSpeed, 89, sSpeed, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU2, xRpu, 89, sRpu, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING2, xRating, 89, sRating, 8
+ LTEXT "Resulting", IDT_BENCH_RESULTING, g4x, 89, sLabel, 8
+ RTEXT "", IDT_BENCH_COMPRESS_USAGE2, xUsage, 89, sUsage, 8
+ RTEXT "", IDT_BENCH_COMPRESS_SPEED2, xSpeed, 89, sSpeed, 8
+ RTEXT "", IDT_BENCH_COMPRESS_RPU2, xRpu, 89, sRpu, 8
+ RTEXT "", IDT_BENCH_COMPRESS_RATING2, xRating, 89, sRating, 8
- GROUPBOX "Decompressing", IDC_BENCHMARK_DECOMPRESSING, m, 111, xc, GROUP_Y_SIZE
+ GROUPBOX "Decompressing", IDG_BENCH_DECOMPRESSING, m, 111, xc, GROUP_Y_SIZE
- LTEXT "Current", IDC_BENCHMARK_CURRENT2, g4x, 123, sLabel, 8
- RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE, xUsage, 123, sUsage, 8
- RTEXT "100 KB/s", IDC_BENCHMARK_DECOMPRESSING_SPEED, xSpeed, 123, sSpeed, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU, xRpu, 123, sRpu, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING, xRating, 123, sRating, 8
+ LTEXT "Current", IDT_BENCH_CURRENT2, g4x, 123, sLabel, 8
+ RTEXT "", IDT_BENCH_DECOMPR_USAGE1, xUsage, 123, sUsage, 8
+ RTEXT "", IDT_BENCH_DECOMPR_SPEED1, xSpeed, 123, sSpeed, 8
+ RTEXT "", IDT_BENCH_DECOMPR_RPU1, xRpu, 123, sRpu, 8
+ RTEXT "", IDT_BENCH_DECOMPR_RATING1, xRating, 123, sRating, 8
- LTEXT "Resulting", IDC_BENCHMARK_RESULTING2, g4x, 136, sLabel, 8
- RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE2, xUsage, 136, sUsage, 8
- RTEXT "100 KB/s", IDC_BENCHMARK_DECOMPRESSING_SPEED2, xSpeed, 136, sSpeed, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU2, xRpu, 136, sRpu, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING2, xRating, 136, sRating, 8
+ LTEXT "Resulting", IDT_BENCH_RESULTING2, g4x, 136, sLabel, 8
+ RTEXT "", IDT_BENCH_DECOMPR_USAGE2, xUsage, 136, sUsage, 8
+ RTEXT "", IDT_BENCH_DECOMPR_SPEED2, xSpeed, 136, sSpeed, 8
+ RTEXT "", IDT_BENCH_DECOMPR_RPU2, xRpu, 136, sRpu, 8
+ RTEXT "", IDT_BENCH_DECOMPR_RATING2, xRating, 136, sRating, 8
- GROUPBOX "Total Rating", IDC_BENCHMARK_TOTAL_RATING, xTotalRating, 163, sTotalRating, GROUP_Y_SIZE
- RTEXT "0", IDC_BENCHMARK_TOTAL_USAGE_VALUE, xUsage, 181, sUsage, 8
- RTEXT "0", IDC_BENCHMARK_TOTAL_RPU_VALUE, xRpu, 181, sRpu, 8
- RTEXT "0", IDC_BENCHMARK_TOTAL_RATING_VALUE, xRating, 181, sRating, 8
+ GROUPBOX "Total Rating", IDG_BENCH_TOTAL_RATING, xTotalRating, 163, sTotalRating, GROUP_Y_SIZE
+
+ RTEXT "", IDT_BENCH_TOTAL_USAGE_VAL, xUsage, 181, sUsage, 8
+ RTEXT "", IDT_BENCH_TOTAL_RPU_VAL, xRpu, 181, sRpu, 8
+ RTEXT "", IDT_BENCH_TOTAL_RATING_VAL, xRating, 181, sRating, 8
- LTEXT "Elapsed time:", IDC_BENCHMARK_ELAPSED, m, 163, g2xs, 8
- LTEXT "Size:", IDC_BENCHMARK_SIZE, m, 176, g2xs, 8
- LTEXT "Passes:", IDC_BENCHMARK_PASSES, m, 189, g2xs, 8
- RTEXT "00:00:00", IDC_BENCHMARK_ELAPSED_VALUE, g3x, 163, g3xs, 8
- RTEXT "0", IDC_BENCHMARK_SIZE_VALUE, g3x, 176, g3xs, 8
- RTEXT "0", IDC_BENCHMARK_PASSES_VALUE, g3x, 189, g3xs, 8
+ LTEXT "Elapsed time:", IDT_BENCH_ELAPSED, m, 163, g2xs, 8
+ LTEXT "Size:", IDT_BENCH_SIZE, m, 176, g2xs, 8
+ LTEXT "Passes:", IDT_BENCH_PASSES, m, 189, g2xs, 8
+
+ RTEXT "", IDT_BENCH_ELAPSED_VAL, g3x, 163, g3xs, 8
+ RTEXT "", IDT_BENCH_SIZE_VAL, g3x, 176, g3xs, 8
+ RTEXT "", IDT_BENCH_PASSES_VAL, g3x, 189, g3xs, 8
END
#ifdef UNDER_CE
@@ -177,57 +180,58 @@ END
#define g2xs (g3x - m)
-IDD_DIALOG_BENCHMARK_2 DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
+IDD_BENCH_2 DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
CAPTION "Benchmark"
MY_FONT
BEGIN
- PUSHBUTTON "&Restart", IDC_BUTTON_RESTART, bx1, m, bxs, bys
- PUSHBUTTON "&Stop", IDC_BUTTON_STOP, bx1, m + bys + m, bxs, bys
- PUSHBUTTON "Cancel", IDCANCEL, bx1, m + bys + m + bys + m, bxs, bys
+ PUSHBUTTON "&Restart", IDB_RESTART, bx1, m, bxs, bys
+ PUSHBUTTON "&Stop", IDB_STOP, bx1, m + bys + m, bxs, bys
+
+ PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
- LTEXT "&Dictionary size:", IDC_BENCHMARK_DICTIONARY, m, m, g0xs, 8
- COMBOBOX IDC_BENCHMARK_COMBO_DICTIONARY, m, m + 11, g1xs, 140, MY_COMBO
+ LTEXT "&Dictionary size:", IDT_BENCH_DICTIONARY, m, m, g0xs, 8
+ COMBOBOX IDC_BENCH_DICTIONARY, m, m + 11, g1xs, 140, MY_COMBO
- LTEXT "&Number of CPU threads:", IDC_BENCHMARK_NUM_THREADS, m, 31, g0xs, 8
- COMBOBOX IDC_BENCHMARK_COMBO_NUM_THREADS, m, 42, g1xs, 140, MY_COMBO
+ LTEXT "&Number of CPU threads:", IDT_BENCH_NUM_THREADS, m, 31, g0xs, 8
+ COMBOBOX IDC_BENCH_NUM_THREADS, m, 42, g1xs, 140, MY_COMBO
- LTEXT "0 MB", IDC_BENCHMARK_MEMORY_VALUE, m + g1xs + 8, m + 13, xc - bxs - g1xs - 8, 8
- LTEXT "1", IDC_BENCHMARK_HARDWARE_THREADS, m + g1xs + 8, 44, xc - bxs - g1xs - 8, 8
+ LTEXT "", IDT_BENCH_MEMORY_VAL, m + g1xs + 8, m + 13, xc - bxs - g1xs - 8, 8
+ LTEXT "", IDT_BENCH_HARDWARE_THREADS, m + g1xs + 8, 44, xc - bxs - g1xs - 8, 8
- LTEXT "Current", IDC_BENCHMARK_CURRENT, g4x, 70, sLabel, 8
- RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE, xUsage, 70, sUsage, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU, xRpu, 70, sRpu, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING, xRating, 70, sRating, 8
+ LTEXT "Current", IDT_BENCH_CURRENT, g4x, 70, sLabel, 8
+ RTEXT "", IDT_BENCH_COMPRESS_USAGE1, xUsage, 70, sUsage, 8
+ RTEXT "", IDT_BENCH_COMPRESS_RPU1, xRpu, 70, sRpu, 8
+ RTEXT "", IDT_BENCH_COMPRESS_RATING1, xRating, 70, sRating, 8
- LTEXT "Resulting", IDC_BENCHMARK_RESULTING, g4x, 80, sLabel, 8
- RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE2, xUsage, 80, sUsage, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU2, xRpu, 80, sRpu, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING2, xRating, 80, sRating, 8
+ LTEXT "Resulting", IDT_BENCH_RESULTING, g4x, 80, sLabel, 8
+ RTEXT "", IDT_BENCH_COMPRESS_USAGE2, xUsage, 80, sUsage, 8
+ RTEXT "", IDT_BENCH_COMPRESS_RPU2, xRpu, 80, sRpu, 8
+ RTEXT "", IDT_BENCH_COMPRESS_RATING2, xRating, 80, sRating, 8
- LTEXT "Compressing", IDC_BENCHMARK_COMPRESSING, m, 60, xc - bxs, 8
+ LTEXT "Compressing", IDG_BENCH_COMPRESSING, m, 60, xc - bxs, 8
- LTEXT "Current", IDC_BENCHMARK_CURRENT2, g4x, 104, sLabel, 8
- RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE, xUsage, 104, sUsage, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU, xRpu, 104, sRpu, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING, xRating, 104, sRating, 8
+ LTEXT "Current", IDT_BENCH_CURRENT2, g4x, 104, sLabel, 8
+ RTEXT "", IDT_BENCH_DECOMPR_USAGE1, xUsage, 104, sUsage, 8
+ RTEXT "", IDT_BENCH_DECOMPR_RPU1, xRpu, 104, sRpu, 8
+ RTEXT "", IDT_BENCH_DECOMPR_RATING1, xRating, 104, sRating, 8
- LTEXT "Resulting", IDC_BENCHMARK_RESULTING2, g4x, 114, sLabel, 8
- RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE2, xUsage, 114, sUsage, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU2, xRpu, 114, sRpu, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING2, xRating, 114, sRating, 8
+ LTEXT "Resulting", IDT_BENCH_RESULTING2, g4x, 114, sLabel, 8
+ RTEXT "", IDT_BENCH_DECOMPR_USAGE2, xUsage, 114, sUsage, 8
+ RTEXT "", IDT_BENCH_DECOMPR_RPU2, xRpu, 114, sRpu, 8
+ RTEXT "", IDT_BENCH_DECOMPR_RATING2, xRating, 114, sRating, 8
- LTEXT "Decompressing", IDC_BENCHMARK_DECOMPRESSING, m, 94, xc, 8
+ LTEXT "Decompressing", IDG_BENCH_DECOMPRESSING, m, 94, xc, 8
- RTEXT "0", IDC_BENCHMARK_TOTAL_RPU_VALUE, xRpu, 140, sRpu, 8
- RTEXT "0", IDC_BENCHMARK_TOTAL_RATING_VALUE, xRating, 140, sRating, 8
+ RTEXT "", IDT_BENCH_TOTAL_RPU_VAL, xRpu, 140, sRpu, 8
+ RTEXT "", IDT_BENCH_TOTAL_RATING_VAL, xRating, 140, sRating, 8
- LTEXT "Elapsed time:", IDC_BENCHMARK_ELAPSED, m, 130, g2xs, 8
- LTEXT "Size:", IDC_BENCHMARK_SIZE, m, 140, g2xs, 8
- LTEXT "Passes:", IDC_BENCHMARK_PASSES, m, 150, g2xs, 8
+ LTEXT "Elapsed time:", IDT_BENCH_ELAPSED, m, 130, g2xs, 8
+ LTEXT "Size:", IDT_BENCH_SIZE, m, 140, g2xs, 8
+ LTEXT "Passes:", IDT_BENCH_PASSES, m, 150, g2xs, 8
- RTEXT "00:00:00", IDC_BENCHMARK_ELAPSED_VALUE, g3x, 130, g3xs, 8
- RTEXT "0", IDC_BENCHMARK_SIZE_VALUE, g3x, 140, g3xs, 8
- RTEXT "0", IDC_BENCHMARK_PASSES_VALUE, g3x, 150, g3xs, 8
+ RTEXT "", IDT_BENCH_ELAPSED_VAL, g3x, 130, g3xs, 8
+ RTEXT "", IDT_BENCH_SIZE_VAL, g3x, 140, g3xs, 8
+ RTEXT "", IDT_BENCH_PASSES_VAL, g3x, 150, g3xs, 8
END
#endif
@@ -237,12 +241,12 @@ END
#define xc 360
#define yc 260
-IDD_DIALOG_BENCHMARK_TOTAL MY_RESIZE_DIALOG
+IDD_BENCH_TOTAL DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
CAPTION "Benchmark"
{
- LTEXT "Elapsed time:", IDC_BENCHMARK_ELAPSED, m, m, 58, 8
- RTEXT "00:00:00", IDC_BENCHMARK_ELAPSED_VALUE, m + 58, m, 38, 8
- EDITTEXT IDC_BENCHMARK2_EDIT, m, m + 14, xc, yc - bys - m - 14, ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL | WS_VSCROLL | WS_HSCROLL
- PUSHBUTTON "&Help", IDHELP, bx2, by, bxs, bys
- PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
+ LTEXT "Elapsed time:", IDT_BENCH_ELAPSED, m, m, 58, 8
+ RTEXT "", IDT_BENCH_ELAPSED_VAL, m + 58, m, 38, 8
+ EDITTEXT IDE_BENCH2_EDIT, m, m + 14, xc, yc - bys - m - 14, ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL | WS_VSCROLL | WS_HSCROLL
+ PUSHBUTTON "&Help", IDHELP, bx2, by, bxs, bys
+ PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
}
diff --git a/CPP/7zip/UI/GUI/BenchmarkDialogRes.h b/CPP/7zip/UI/GUI/BenchmarkDialogRes.h
index cf009df3..7dd6d031 100755..100644
--- a/CPP/7zip/UI/GUI/BenchmarkDialogRes.h
+++ b/CPP/7zip/UI/GUI/BenchmarkDialogRes.h
@@ -1,59 +1,62 @@
-#define IDD_DIALOG_BENCHMARK 550
-#define IDD_DIALOG_BENCHMARK_2 650
-#define IDD_DIALOG_BENCHMARK_TOTAL 750
-#define IDD_DIALOG_BENCHMARK_TOTAL_2 750
-#define IDC_BUTTON_STOP 1001
-#define IDC_BUTTON_RESTART 1002
-#define IDC_BENCHMARK_DICTIONARY 1010
-#define IDC_BENCHMARK_COMBO_DICTIONARY 1011
-#define IDC_BENCHMARK_MEMORY 1012
-#define IDC_BENCHMARK_MEMORY_VALUE 1013
-#define IDC_BENCHMARK_NUM_THREADS 1014
-#define IDC_BENCHMARK_COMBO_NUM_THREADS 1015
-#define IDC_BENCHMARK_HARDWARE_THREADS 1016
-
-#define IDC_BENCHMARK_SPEED_LABEL 1020
-#define IDC_BENCHMARK_RATING_LABEL 1021
-#define IDC_BENCHMARK_COMPRESSING 1022
-#define IDC_BENCHMARK_DECOMPRESSING 1023
-#define IDC_BENCHMARK_CURRENT 1024
-#define IDC_BENCHMARK_RESULTING 1025
-#define IDC_BENCHMARK_CURRENT2 1026
-#define IDC_BENCHMARK_RESULTING2 1027
-#define IDC_BENCHMARK_USAGE_LABEL 1028
-#define IDC_BENCHMARK_RPU_LABEL 1029
-
-#define IDC_BENCHMARK_COMPRESSING_SPEED 1030
-#define IDC_BENCHMARK_COMPRESSING_SPEED2 1031
-#define IDC_BENCHMARK_COMPRESSING_RATING 1032
-#define IDC_BENCHMARK_COMPRESSING_RATING2 1033
-#define IDC_BENCHMARK_COMPRESSING_USAGE 1034
-#define IDC_BENCHMARK_COMPRESSING_USAGE2 1035
-#define IDC_BENCHMARK_COMPRESSING_RPU 1036
-#define IDC_BENCHMARK_COMPRESSING_RPU2 1037
-
-
-#define IDC_BENCHMARK_DECOMPRESSING_SPEED 1040
-#define IDC_BENCHMARK_DECOMPRESSING_SPEED2 1041
-#define IDC_BENCHMARK_DECOMPRESSING_RATING 1042
-#define IDC_BENCHMARK_DECOMPRESSING_RATING2 1043
-#define IDC_BENCHMARK_DECOMPRESSING_USAGE 1044
-#define IDC_BENCHMARK_DECOMPRESSING_USAGE2 1045
-#define IDC_BENCHMARK_DECOMPRESSING_RPU 1046
-#define IDC_BENCHMARK_DECOMPRESSING_RPU2 1047
-
-
-#define IDC_BENCHMARK_TOTAL_RATING 1050
-
-#define IDC_BENCHMARK_TOTAL_RATING_VALUE 1051
-#define IDC_BENCHMARK_TOTAL_RPU_VALUE 1052
-#define IDC_BENCHMARK_TOTAL_USAGE_VALUE 1053
-
-#define IDC_BENCHMARK_ELAPSED 1060
-#define IDC_BENCHMARK_ELAPSED_VALUE 1061
-#define IDC_BENCHMARK_SIZE 1062
-#define IDC_BENCHMARK_SIZE_VALUE 1063
-#define IDC_BENCHMARK_PASSES 1066
-#define IDC_BENCHMARK_PASSES_VALUE 1067
-
-#define IDC_BENCHMARK2_EDIT 1090
+#define IDD_BENCH 7600
+#define IDD_BENCH_2 17600
+#define IDD_BENCH_TOTAL 7699
+
+#define IDE_BENCH2_EDIT 100
+
+#define IDC_BENCH_DICTIONARY 101
+#define IDT_BENCH_MEMORY_VAL 102
+#define IDC_BENCH_NUM_THREADS 103
+#define IDT_BENCH_HARDWARE_THREADS 104
+
+#define IDT_BENCH_COMPRESS_SPEED1 110
+#define IDT_BENCH_COMPRESS_SPEED2 111
+#define IDT_BENCH_COMPRESS_RATING1 112
+#define IDT_BENCH_COMPRESS_RATING2 113
+#define IDT_BENCH_COMPRESS_USAGE1 114
+#define IDT_BENCH_COMPRESS_USAGE2 115
+#define IDT_BENCH_COMPRESS_RPU1 116
+#define IDT_BENCH_COMPRESS_RPU2 117
+
+#define IDT_BENCH_DECOMPR_SPEED1 118
+#define IDT_BENCH_DECOMPR_SPEED2 119
+#define IDT_BENCH_DECOMPR_RATING1 120
+#define IDT_BENCH_DECOMPR_RATING2 121
+#define IDT_BENCH_DECOMPR_USAGE1 122
+#define IDT_BENCH_DECOMPR_USAGE2 123
+#define IDT_BENCH_DECOMPR_RPU1 124
+#define IDT_BENCH_DECOMPR_RPU2 125
+
+#define IDT_BENCH_TOTAL_RATING_VAL 130
+#define IDT_BENCH_TOTAL_RPU_VAL 131
+#define IDT_BENCH_TOTAL_USAGE_VAL 133
+
+#define IDT_BENCH_ELAPSED_VAL 140
+#define IDT_BENCH_SIZE_VAL 141
+#define IDT_BENCH_PASSES_VAL 142
+
+
+#define IDB_STOP 442
+#define IDB_RESTART 443
+
+#define IDT_BENCH_DICTIONARY 4006
+#define IDT_BENCH_NUM_THREADS 4009
+
+#define IDT_BENCH_SIZE 1007
+#define IDT_BENCH_ELAPSED 3900
+#define IDT_BENCH_SPEED 3903
+
+#define IDT_BENCH_MEMORY 7601
+
+#define IDG_BENCH_COMPRESSING 7602
+#define IDG_BENCH_DECOMPRESSING 7603
+#define IDG_BENCH_TOTAL_RATING 7605
+
+#define IDT_BENCH_RATING_LABEL 7604
+#define IDT_BENCH_CURRENT 7606
+#define IDT_BENCH_RESULTING 7607
+#define IDT_BENCH_USAGE_LABEL 7608
+#define IDT_BENCH_RPU_LABEL 7609
+#define IDT_BENCH_PASSES 7610
+#define IDT_BENCH_CURRENT2 (7606+50)
+#define IDT_BENCH_RESULTING2 (7607+50)
diff --git a/CPP/7zip/UI/GUI/CompressDialog.cpp b/CPP/7zip/UI/GUI/CompressDialog.cpp
index 2723f515..a2d0ac2b 100755..100644
--- a/CPP/7zip/UI/GUI/CompressDialog.cpp
+++ b/CPP/7zip/UI/GUI/CompressDialog.cpp
@@ -2,12 +2,12 @@
#include "StdAfx.h"
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
+#include "../../../Common/IntToString.h"
+#include "../../../Common/StringConvert.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileName.h"
-#include "Windows/System.h"
+#include "../../../Windows/FileDir.h"
+#include "../../../Windows/FileName.h"
+#include "../../../Windows/System.h"
#include "../FileManager/BrowseDialog.h"
#include "../FileManager/FormatUtils.h"
@@ -29,81 +29,70 @@ extern bool g_IsNT;
#endif
#include "CompressDialogRes.h"
-
-#define MY_SIZE_OF_ARRAY(x) (sizeof(x) / sizeof(x[0]))
+#include "ExtractRes.h"
#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDC_STATIC_COMPRESS_ARCHIVE, 0x02000D01 },
- { IDC_STATIC_COMPRESS_FORMAT, 0x02000D03 },
- { IDC_STATIC_COMPRESS_LEVEL, 0x02000D0B },
- { IDC_STATIC_COMPRESS_METHOD, 0x02000D04 },
- { IDC_STATIC_COMPRESS_DICTIONARY, 0x02000D0C },
- { IDC_STATIC_COMPRESS_ORDER, 0x02000D0D },
- { IDC_STATIC_COMPRESS_MEMORY, 0x02000D0E },
- { IDC_STATIC_COMPRESS_MEMORY_DE, 0x02000D0F },
- { IDC_STATIC_COMPRESS_THREADS, 0x02000D12 },
- { IDC_STATIC_COMPRESS_SOLID, 0x02000D13 },
- { IDC_STATIC_COMPRESS_VOLUME, 0x02000D40 },
- { IDC_STATIC_COMPRESS_PARAMETERS, 0x02000D06 },
-
- { IDC_STATIC_COMPRESS_UPDATE_MODE, 0x02000D02 },
- { IDC_STATIC_COMPRESS_OPTIONS, 0x02000D07 },
- { IDC_COMPRESS_SFX, 0x02000D08 },
- { IDC_COMPRESS_SHARED, 0x02000D16 },
+static const UInt32 kLangIDs[] =
+{
+ IDT_COMPRESS_ARCHIVE,
+ IDT_COMPRESS_UPDATE_MODE,
+ IDT_COMPRESS_FORMAT,
+ IDT_COMPRESS_LEVEL,
+ IDT_COMPRESS_METHOD,
+ IDT_COMPRESS_DICTIONARY,
+ IDT_COMPRESS_ORDER,
+ IDT_COMPRESS_SOLID,
+ IDT_COMPRESS_THREADS,
+ IDT_COMPRESS_PARAMETERS,
- { IDC_COMPRESS_ENCRYPTION, 0x02000D10 },
- { IDC_STATIC_COMPRESS_PASSWORD1, 0x02000B01 },
- { IDC_STATIC_COMPRESS_PASSWORD2, 0x02000B03 },
- { IDC_COMPRESS_CHECK_SHOW_PASSWORD, 0x02000B02 },
- { IDC_STATIC_COMPRESS_ENCRYPTION_METHOD, 0x02000D11 },
- { IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, 0x02000D0A },
-
- { IDOK, 0x02000702 },
- { IDCANCEL, 0x02000710 },
- { IDHELP, 0x02000720 }
+ IDG_COMPRESS_OPTIONS,
+ IDX_COMPRESS_SFX,
+ IDX_COMPRESS_SHARED,
+ IDX_COMPRESS_DEL,
+
+ IDT_COMPRESS_MEMORY,
+ IDT_COMPRESS_MEMORY_DE,
+
+ IDX_COMPRESS_NT_SYM_LINKS,
+ IDX_COMPRESS_NT_HARD_LINKS,
+ IDX_COMPRESS_NT_ALT_STREAMS,
+ IDX_COMPRESS_NT_SECUR,
+
+ IDG_COMPRESS_ENCRYPTION,
+ IDT_COMPRESS_ENCRYPTION_METHOD,
+ IDX_COMPRESS_ENCRYPT_FILE_NAMES,
+
+ IDT_PASSWORD_ENTER,
+ IDT_PASSWORD_REENTER,
+ IDX_PASSWORD_SHOW,
+
+ IDT_SPLIT_TO_VOLUMES,
+ IDT_COMPRESS_PATH_MODE
};
#endif
using namespace NWindows;
using namespace NFile;
using namespace NName;
-using namespace NDirectory;
+using namespace NDir;
static const int kHistorySize = 20;
static LPCWSTR kExeExt = L".exe";
static LPCWSTR k7zFormat = L"7z";
-struct CLevelInfo
+static const UInt32 g_Levels[] =
{
- UInt32 ResourceID;
- UInt32 LangID;
-};
-
-enum ELevel
-{
- kStore = 0,
- kFastest = 1,
- kFast = 3,
- kNormal = 5,
- kMaximum = 7,
- kUltra = 9
-};
-
-static const CLevelInfo g_Levels[] =
-{
- { IDS_METHOD_STORE, 0x02000D81 },
- { IDS_METHOD_FASTEST, 0x02000D85 },
- { 0, 0 },
- { IDS_METHOD_FAST, 0x02000D84 },
- { 0, 0 },
- { IDS_METHOD_NORMAL, 0x02000D82 },
- { 0, 0 },
- { IDS_METHOD_MAXIMUM, 0x02000D83 },
- { 0, 0 },
- { IDS_METHOD_ULTRA, 0x02000D86 }
+ IDS_METHOD_STORE,
+ IDS_METHOD_FASTEST,
+ 0,
+ IDS_METHOD_FAST,
+ 0,
+ IDS_METHOD_NORMAL,
+ 0,
+ IDS_METHOD_MAXIMUM,
+ 0,
+ IDS_METHOD_ULTRA
};
enum EMethodID
@@ -132,8 +121,8 @@ static const LPCWSTR kMethodsNames[] =
static const EMethodID g_7zMethods[] =
{
- kLZMA,
kLZMA2,
+ kLZMA,
kPPMd,
kBZip2
};
@@ -146,7 +135,7 @@ static const EMethodID g_7zSfxMethods[] =
kPPMd
};
-static EMethodID g_ZipMethods[] =
+static const EMethodID g_ZipMethods[] =
{
kDeflate,
kDeflate64,
@@ -155,21 +144,27 @@ static EMethodID g_ZipMethods[] =
kPPMdZip
};
-static EMethodID g_GZipMethods[] =
+static const EMethodID g_GZipMethods[] =
{
kDeflate
};
-static EMethodID g_BZip2Methods[] =
+static const EMethodID g_BZip2Methods[] =
{
kBZip2
};
-static EMethodID g_XzMethods[] =
+static const EMethodID g_XzMethods[] =
{
kLZMA2
};
+static const EMethodID g_SwfcMethods[] =
+{
+ kDeflate
+ // kLZMA
+};
+
struct CFormatInfo
{
LPCWSTR Name;
@@ -180,11 +175,12 @@ struct CFormatInfo
bool Solid;
bool MultiThread;
bool SFX;
+
bool Encrypt;
bool EncryptFileNames;
};
-#define METHODS_PAIR(x) x, MY_SIZE_OF_ARRAY(x)
+#define METHODS_PAIR(x) x, ARRAY_SIZE(x)
static const CFormatInfo g_Formats[] =
{
@@ -225,6 +221,12 @@ static const CFormatInfo g_Formats[] =
false, false, true, false, false, false
},
{
+ L"Swfc",
+ (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
+ METHODS_PAIR(g_SwfcMethods),
+ false, false, true, false, false, false
+ },
+ {
L"Tar",
(1 << 0),
0, 0,
@@ -240,7 +242,7 @@ static const CFormatInfo g_Formats[] =
static bool IsMethodSupportedBySfx(int methodID)
{
- for (int i = 0; i < MY_SIZE_OF_ARRAY(g_7zSfxMethods); i++)
+ for (int i = 0; i < ARRAY_SIZE(g_7zSfxMethods); i++)
if (methodID == g_7zSfxMethods[i])
return true;
return false;
@@ -260,81 +262,156 @@ static UInt64 GetMaxRamSizeForProgram()
return physSize;
}
+
+static const
+ // NCompressDialog::NUpdateMode::EEnum
+ int
+ k_UpdateMode_Vals[] =
+{
+ NCompressDialog::NUpdateMode::kAdd,
+ NCompressDialog::NUpdateMode::kUpdate,
+ NCompressDialog::NUpdateMode::kFresh,
+ NCompressDialog::NUpdateMode::kSync
+};
+
+static const UInt32 k_UpdateMode_IDs[] =
+{
+ IDS_COMPRESS_UPDATE_MODE_ADD,
+ IDS_COMPRESS_UPDATE_MODE_UPDATE,
+ IDS_COMPRESS_UPDATE_MODE_FRESH,
+ IDS_COMPRESS_UPDATE_MODE_SYNC
+};
+
+static const
+ // NWildcard::ECensorPathMode
+ int
+ k_PathMode_Vals[] =
+{
+ NWildcard::k_RelatPath,
+ NWildcard::k_FullPath,
+ NWildcard::k_AbsPath,
+};
+
+static const UInt32 k_PathMode_IDs[] =
+{
+ IDS_PATH_MODE_RELAT,
+ IDS_EXTRACT_PATHS_FULL,
+ IDS_EXTRACT_PATHS_ABS
+};
+
+void AddComboItems(NControl::CComboBox &combo, const UInt32 *langIDs, unsigned numItems, const int *values, int curVal);
+bool GetBoolsVal(const CBoolPair &b1, const CBoolPair &b2);
+
+void CCompressDialog::CheckButton_TwoBools(UINT id, const CBoolPair &b1, const CBoolPair &b2)
+{
+ CheckButton(id, GetBoolsVal(b1, b2));
+}
+
+void CCompressDialog::GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2)
+{
+ bool val = IsButtonCheckedBool(id);
+ bool oldVal = GetBoolsVal(b1, b2);
+ if (val != oldVal)
+ b1.Def = b2.Def = true;
+ b1.Val = b2.Val = val;
+}
+
+
bool CCompressDialog::OnInit()
{
#ifdef LANG
- LangSetWindowText(HWND(*this), 0x02000D00);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, MY_SIZE_OF_ARRAY(kIDLangPairs) );
+ LangSetWindowText(*this, IDD_COMPRESS);
+ LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
#endif
- _password1Control.Attach(GetItem(IDC_COMPRESS_EDIT_PASSWORD1));
- _password2Control.Attach(GetItem(IDC_COMPRESS_EDIT_PASSWORD2));
+
+ _password1Control.Attach(GetItem(IDE_COMPRESS_PASSWORD1));
+ _password2Control.Attach(GetItem(IDE_COMPRESS_PASSWORD2));
_password1Control.SetText(Info.Password);
_password2Control.SetText(Info.Password);
- _encryptionMethod.Attach(GetItem(IDC_COMPRESS_COMBO_ENCRYPTION_METHOD));
-
- m_ArchivePath.Attach(GetItem(IDC_COMPRESS_COMBO_ARCHIVE));
- m_Format.Attach(GetItem(IDC_COMPRESS_COMBO_FORMAT));
- m_Level.Attach(GetItem(IDC_COMPRESS_COMBO_LEVEL));
- m_Method.Attach(GetItem(IDC_COMPRESS_COMBO_METHOD));
- m_Dictionary.Attach(GetItem(IDC_COMPRESS_COMBO_DICTIONARY));
- m_Order.Attach(GetItem(IDC_COMPRESS_COMBO_ORDER));
- m_Solid.Attach(GetItem(IDC_COMPRESS_COMBO_SOLID));
- m_NumThreads.Attach(GetItem(IDC_COMPRESS_COMBO_THREADS));
+ _encryptionMethod.Attach(GetItem(IDC_COMPRESS_ENCRYPTION_METHOD));
+
+ m_ArchivePath.Attach(GetItem(IDC_COMPRESS_ARCHIVE));
+ m_Format.Attach(GetItem(IDC_COMPRESS_FORMAT));
+ m_Level.Attach(GetItem(IDC_COMPRESS_LEVEL));
+ m_Method.Attach(GetItem(IDC_COMPRESS_METHOD));
+ m_Dictionary.Attach(GetItem(IDC_COMPRESS_DICTIONARY));
+ m_Order.Attach(GetItem(IDC_COMPRESS_ORDER));
+ m_Solid.Attach(GetItem(IDC_COMPRESS_SOLID));
+ m_NumThreads.Attach(GetItem(IDC_COMPRESS_THREADS));
- m_UpdateMode.Attach(GetItem(IDC_COMPRESS_COMBO_UPDATE_MODE));
- m_Volume.Attach(GetItem(IDC_COMPRESS_COMBO_VOLUME));
- m_Params.Attach(GetItem(IDC_COMPRESS_EDIT_PARAMETERS));
+ m_UpdateMode.Attach(GetItem(IDC_COMPRESS_UPDATE_MODE));
+ m_PathMode.Attach(GetItem(IDC_COMPRESS_PATH_MODE));
+
+ m_Volume.Attach(GetItem(IDC_COMPRESS_VOLUME));
+ m_Params.Attach(GetItem(IDE_COMPRESS_PARAMETERS));
AddVolumeItems(m_Volume);
m_RegistryInfo.Load();
- CheckButton(IDC_COMPRESS_CHECK_SHOW_PASSWORD, m_RegistryInfo.ShowPassword);
- CheckButton(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, m_RegistryInfo.EncryptHeaders);
+ CheckButton(IDX_PASSWORD_SHOW, m_RegistryInfo.ShowPassword);
+ CheckButton(IDX_COMPRESS_ENCRYPT_FILE_NAMES, m_RegistryInfo.EncryptHeaders);
+
+ CheckButton_TwoBools(IDX_COMPRESS_NT_SYM_LINKS, Info.SymLinks, m_RegistryInfo.SymLinks);
+ CheckButton_TwoBools(IDX_COMPRESS_NT_HARD_LINKS, Info.HardLinks, m_RegistryInfo.HardLinks);
+ CheckButton_TwoBools(IDX_COMPRESS_NT_ALT_STREAMS, Info.AltStreams, m_RegistryInfo.AltStreams);
+ CheckButton_TwoBools(IDX_COMPRESS_NT_SECUR, Info.NtSecurity, m_RegistryInfo.NtSecurity);
UpdatePasswordControl();
- Info.FormatIndex = -1;
- int i;
- for (i = 0; i < ArcIndices.Size(); i++)
{
- int arcIndex = ArcIndices[i];
- const CArcInfoEx &ai = (*ArcFormats)[arcIndex];
- int index = (int)m_Format.AddString(ai.Name);
- m_Format.SetItemData(index, arcIndex);
- if (ai.Name.CompareNoCase(m_RegistryInfo.ArcType) == 0 || i == 0)
+ bool needSetMain = (Info.FormatIndex < 0);
+ FOR_VECTOR(i, ArcIndices)
{
- m_Format.SetCurSel(index);
- Info.FormatIndex = arcIndex;
+ unsigned arcIndex = ArcIndices[i];
+ const CArcInfoEx &ai = (*ArcFormats)[arcIndex];
+ int index = (int)m_Format.AddString(ai.Name);
+ m_Format.SetItemData(index, arcIndex);
+ if (!needSetMain)
+ {
+ if (Info.FormatIndex == (int)arcIndex)
+ m_Format.SetCurSel(index);
+ continue;
+ }
+ if (i == 0 || ai.Name.IsEqualToNoCase(m_RegistryInfo.ArcType))
+ {
+ m_Format.SetCurSel(index);
+ Info.FormatIndex = arcIndex;
+ }
}
}
- SetArchiveName(Info.ArchiveName);
+ {
+ UString fileName;
+ SetArcPathFields(Info.ArcPath, fileName, true);
+ StartDirPrefix = DirPrefix;
+ SetArchiveName(fileName);
+ }
SetLevel();
SetParams();
- for (i = 0; i < m_RegistryInfo.ArcPaths.Size() && i < kHistorySize; i++)
+ for (unsigned i = 0; i < m_RegistryInfo.ArcPaths.Size() && i < kHistorySize; i++)
m_ArchivePath.AddString(m_RegistryInfo.ArcPaths[i]);
- m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_ADD, 0x02000DA1));
- m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_UPDATE, 0x02000DA2));
- m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_FRESH, 0x02000DA3));
- m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE, 0x02000DA4));
+ AddComboItems(m_UpdateMode, k_UpdateMode_IDs, ARRAY_SIZE(k_UpdateMode_IDs),
+ k_UpdateMode_Vals, Info.UpdateMode);
- m_UpdateMode.SetCurSel(0);
+ AddComboItems(m_PathMode, k_PathMode_IDs, ARRAY_SIZE(k_PathMode_IDs),
+ k_PathMode_Vals, Info.PathMode);
SetSolidBlockSize();
SetNumThreads();
TCHAR s[40] = { TEXT('/'), TEXT(' '), 0 };
ConvertUInt32ToString(NSystem::GetNumberOfProcessors(), s + 2);
- SetItemText(IDC_COMPRESS_HARDWARE_THREADS, s);
+ SetItemText(IDT_COMPRESS_HARDWARE_THREADS, s);
+
+ CheckButton(IDX_COMPRESS_SFX, Info.SFXMode);
+ CheckButton(IDX_COMPRESS_SHARED, Info.OpenShareForWrite);
+ CheckButton(IDX_COMPRESS_DEL, Info.DeleteAfterCompressing);
- CheckButton(IDC_COMPRESS_SFX, Info.SFXMode);
- CheckButton(IDC_COMPRESS_SHARED, Info.OpenShareForWrite);
-
CheckControlsEnable();
- OnButtonSFX();
+ // OnButtonSFX();
SetEncryptionMethod();
SetMemoryUsage();
@@ -344,12 +421,13 @@ bool CCompressDialog::OnInit()
return CModalDialog::OnInit();
}
+/*
namespace NCompressDialog
{
bool CInfo::GetFullPathName(UString &result) const
{
#ifndef UNDER_CE
- NDirectory::MySetCurrentDirectory(CurrentDirPrefix);
+ // NDirectory::MySetCurrentDirectory(CurrentDirPrefix);
#endif
FString resultF;
bool res = MyGetFullPathName(us2fs(ArchiveName), resultF);
@@ -357,11 +435,12 @@ namespace NCompressDialog
return res;
}
}
+*/
void CCompressDialog::UpdatePasswordControl()
{
bool showPassword = IsShowPasswordChecked();
- TCHAR c = showPassword ? 0: TEXT('*');
+ TCHAR c = showPassword ? (TCHAR)0: TEXT('*');
_password1Control.SetPasswordChar(c);
_password2Control.SetPasswordChar(c);
UString password;
@@ -370,27 +449,27 @@ void CCompressDialog::UpdatePasswordControl()
_password2Control.GetText(password);
_password2Control.SetText(password);
- int cmdShow = showPassword ? SW_HIDE : SW_SHOW;
- ShowItem(IDC_STATIC_COMPRESS_PASSWORD2, cmdShow);
- _password2Control.Show(cmdShow);
+ ShowItem_Bool(IDT_PASSWORD_REENTER, !showPassword);
+ _password2Control.Show_Bool(!showPassword);
}
bool CCompressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
switch(buttonID)
{
- case IDC_COMPRESS_BUTTON_SET_ARCHIVE:
+ case IDB_COMPRESS_SET_ARCHIVE:
{
OnButtonSetArchive();
return true;
}
- case IDC_COMPRESS_SFX:
+ case IDX_COMPRESS_SFX:
{
+ SetMethod(GetMethodID());
OnButtonSFX();
SetMemoryUsage();
return true;
}
- case IDC_COMPRESS_CHECK_SHOW_PASSWORD:
+ case IDX_PASSWORD_SHOW:
{
UpdatePasswordControl();
return true;
@@ -409,10 +488,11 @@ void CCompressDialog::CheckSFXControlsEnable()
enable = (methodID == -1 || IsMethodSupportedBySfx(methodID));
}
if (!enable)
- CheckButton(IDC_COMPRESS_SFX, false);
- EnableItem(IDC_COMPRESS_SFX, enable);
+ CheckButton(IDX_COMPRESS_SFX, false);
+ EnableItem(IDX_COMPRESS_SFX, enable);
}
+/*
void CCompressDialog::CheckVolumeEnable()
{
bool isSFX = IsSFX();
@@ -420,6 +500,7 @@ void CCompressDialog::CheckVolumeEnable()
if (isSFX)
m_Volume.SetText(TEXT(""));
}
+*/
void CCompressDialog::CheckControlsEnable()
{
@@ -429,46 +510,66 @@ void CCompressDialog::CheckControlsEnable()
Info.MultiThreadIsAllowed = multiThreadEnable;
Info.EncryptHeadersIsAllowed = fi.EncryptFileNames;
- EnableItem(IDC_COMPRESS_COMBO_SOLID, fi.Solid);
- EnableItem(IDC_COMPRESS_COMBO_THREADS, multiThreadEnable);
+ EnableItem(IDC_COMPRESS_SOLID, fi.Solid);
+ EnableItem(IDC_COMPRESS_THREADS, multiThreadEnable);
+
CheckSFXControlsEnable();
- CheckVolumeEnable();
- EnableItem(IDC_COMPRESS_ENCRYPTION, fi.Encrypt);
+ {
+ const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
+
+ ShowItem_Bool(IDX_COMPRESS_NT_SYM_LINKS, ai.Flags_SymLinks());
+ ShowItem_Bool(IDX_COMPRESS_NT_HARD_LINKS, ai.Flags_HardLinks());
+ ShowItem_Bool(IDX_COMPRESS_NT_ALT_STREAMS, ai.Flags_AltStreams());
+ ShowItem_Bool(IDX_COMPRESS_NT_SECUR, ai.Flags_NtSecure());
+
+ ShowItem_Bool(IDG_COMPRESS_NTFS,
+ ai.Flags_SymLinks()
+ || ai.Flags_HardLinks()
+ || ai.Flags_AltStreams()
+ || ai.Flags_NtSecure());
+ }
+ // CheckVolumeEnable();
+
+ EnableItem(IDG_COMPRESS_ENCRYPTION, fi.Encrypt);
- EnableItem(IDC_STATIC_COMPRESS_PASSWORD1, fi.Encrypt);
- EnableItem(IDC_STATIC_COMPRESS_PASSWORD2, fi.Encrypt);
- EnableItem(IDC_COMPRESS_EDIT_PASSWORD1, fi.Encrypt);
- EnableItem(IDC_COMPRESS_EDIT_PASSWORD2, fi.Encrypt);
- EnableItem(IDC_COMPRESS_CHECK_SHOW_PASSWORD, fi.Encrypt);
+ EnableItem(IDT_PASSWORD_ENTER, fi.Encrypt);
+ EnableItem(IDT_PASSWORD_REENTER, fi.Encrypt);
+ EnableItem(IDE_COMPRESS_PASSWORD1, fi.Encrypt);
+ EnableItem(IDE_COMPRESS_PASSWORD2, fi.Encrypt);
+ EnableItem(IDX_PASSWORD_SHOW, fi.Encrypt);
- EnableItem(IDC_STATIC_COMPRESS_ENCRYPTION_METHOD, fi.Encrypt);
- EnableItem(IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, fi.Encrypt);
- EnableItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames);
+ EnableItem(IDT_COMPRESS_ENCRYPTION_METHOD, fi.Encrypt);
+ EnableItem(IDC_COMPRESS_ENCRYPTION_METHOD, fi.Encrypt);
+ EnableItem(IDX_COMPRESS_ENCRYPT_FILE_NAMES, fi.EncryptFileNames);
- ShowItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames ? SW_SHOW : SW_HIDE);
+ ShowItem_Bool(IDX_COMPRESS_ENCRYPT_FILE_NAMES, fi.EncryptFileNames);
}
bool CCompressDialog::IsSFX()
{
- CWindow sfxButton = GetItem(IDC_COMPRESS_SFX);
- return sfxButton.IsEnabled() && IsButtonCheckedBool(IDC_COMPRESS_SFX);
+ CWindow sfxButton = GetItem(IDX_COMPRESS_SFX);
+ return sfxButton.IsEnabled() && IsButtonCheckedBool(IDX_COMPRESS_SFX);
}
-void CCompressDialog::OnButtonSFX()
+static int GetExtDotPos(const UString &s)
{
- SetMethod(GetMethodID());
+ int dotPos = s.ReverseFind('.');
+ int slashPos = MyMax(s.ReverseFind(WCHAR_PATH_SEPARATOR), s.ReverseFind('/'));
+ if (dotPos >= 0 && dotPos > slashPos + 1)
+ return dotPos;
+ return -1;
+}
+void CCompressDialog::OnButtonSFX()
+{
UString fileName;
m_ArchivePath.GetText(fileName);
- int dotPos = fileName.ReverseFind(L'.');
- int slashPos = fileName.ReverseFind(WCHAR_PATH_SEPARATOR);
- if (dotPos < 0 || dotPos <= slashPos)
- dotPos = -1;
+ int dotPos = GetExtDotPos(fileName);
if (IsSFX())
{
if (dotPos >= 0)
- fileName = fileName.Left(dotPos);
+ fileName.DeleteFrom(dotPos);
fileName += kExeExt;
m_ArchivePath.SetText(fileName);
}
@@ -476,38 +577,92 @@ void CCompressDialog::OnButtonSFX()
{
if (dotPos >= 0)
{
- UString ext = fileName.Mid(dotPos);
- if (ext.CompareNoCase(kExeExt) == 0)
+ UString ext = fileName.Ptr(dotPos);
+ if (ext.IsEqualToNoCase(kExeExt))
{
- fileName = fileName.Left(dotPos);
+ fileName.DeleteFrom(dotPos);
m_ArchivePath.SetText(fileName);
}
}
SetArchiveName2(false); // it's for OnInit
}
- CheckVolumeEnable();
+ // CheckVolumeEnable();
}
+bool CCompressDialog::GetFinalPath_Smart(UString &resPath)
+{
+ UString name;
+ m_ArchivePath.GetText(name);
+ name.Trim();
+ UString tempPath = name;
+ if (!IsAbsolutePath(name))
+ {
+ UString newDirPrefix = DirPrefix;
+ if (newDirPrefix.IsEmpty())
+ newDirPrefix = StartDirPrefix;
+ FString resultF;
+ if (!MyGetFullPathName(us2fs(newDirPrefix + name), resultF))
+ return false;
+ tempPath = fs2us(resultF);
+ }
+ if (!SetArcPathFields(tempPath, name, false))
+ return false;
+ FString resultF;
+ if (!MyGetFullPathName(us2fs(DirPrefix + name), resultF))
+ return false;
+ resPath = fs2us(resultF);
+ return true;
+}
+
+bool CCompressDialog::SetArcPathFields(const UString &path, UString &name, bool always)
+{
+ FString resDirPrefix;
+ FString resFileName;
+ bool res = GetFullPathAndSplit(us2fs(path), resDirPrefix, resFileName);
+ if (res)
+ {
+ DirPrefix = fs2us(resDirPrefix);
+ name = fs2us(resFileName);
+ }
+ else
+ {
+ if (!always)
+ return false;
+ DirPrefix.Empty();
+ name = path;
+ }
+ SetItemText(IDT_COMPRESS_ARCHIVE_FOLDER, DirPrefix);
+ m_ArchivePath.SetText(name);
+ return res;
+}
+
+static const wchar_t *k_IncorrectPathMessage = L"Incorrect archive path";
+
void CCompressDialog::OnButtonSetArchive()
{
- UString fileName;
- m_ArchivePath.GetText(fileName);
- fileName.Trim();
- Info.ArchiveName = fileName;
- UString fullFileName;
- if (!Info.GetFullPathName(fullFileName))
+ UString path;
+ if (!GetFinalPath_Smart(path))
{
- fullFileName = Info.ArchiveName;
+ ShowErrorMessage(*this, k_IncorrectPathMessage);
return;
}
- UString title = LangString(IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE, 0x02000D90);
- UString s = LangString(IDS_OPEN_TYPE_ALL_FILES, 0x02000DB1);
- s += L" (*.*)";
+
+ UString title = LangString(IDS_COMPRESS_SET_ARCHIVE_BROWSE);
+ UString filterDescription = LangString(IDS_OPEN_TYPE_ALL_FILES);
+ filterDescription += L" (*.*)";
UString resPath;
- if (!MyBrowseForFile(HWND(*this), title, fullFileName, s, resPath))
+ CurrentDirWasChanged = true;
+ if (!MyBrowseForFile(*this, title,
+ // DirPrefix.IsEmpty() ? NULL : (const wchar_t *)DirPrefix,
+ // NULL,
+ path,
+ filterDescription,
+ NULL, // L"*.*",
+ resPath))
return;
- m_ArchivePath.SetText(resPath);
+ UString dummyName;
+ SetArcPathFields(resPath, dummyName, true);
}
// in ExtractDialog.cpp
@@ -515,7 +670,7 @@ extern void AddUniqueString(UStringVector &strings, const UString &srcString);
static bool IsAsciiString(const UString &s)
{
- for (int i = 0; i < s.Length(); i++)
+ for (unsigned i = 0; i < s.Len(); i++)
{
wchar_t c = s[i];
if (c < 0x20 || c > 0x7F)
@@ -531,16 +686,16 @@ void CCompressDialog::OnOK()
{
if (!IsAsciiString(Info.Password))
{
- ShowErrorMessageHwndRes(*this, IDS_PASSWORD_USE_ASCII, 0x02000B11);
+ ShowErrorMessageHwndRes(*this, IDS_PASSWORD_USE_ASCII);
return;
}
UString method = GetEncryptionMethodSpec();
- method.MakeUpper();
- if (method.Find(L"AES") == 0)
+ method.MakeLower_Ascii();
+ if (method.Find(L"aes") == 0)
{
- if (Info.Password.Length() > 99)
+ if (Info.Password.Len() > 99)
{
- ShowErrorMessageHwndRes(*this, IDS_PASSWORD_IS_TOO_LONG, 0x02000B12);
+ ShowErrorMessageHwndRes(*this, IDS_PASSWORD_TOO_LONG);
return;
}
}
@@ -551,19 +706,25 @@ void CCompressDialog::OnOK()
_password2Control.GetText(password2);
if (password2 != Info.Password)
{
- ShowErrorMessageHwndRes(*this, IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH, 0x02000B10);
+ ShowErrorMessageHwndRes(*this, IDS_PASSWORD_NOT_MATCH);
return;
}
}
SaveOptionsInMem();
UString s;
- m_ArchivePath.GetText(s);
- s.Trim();
+ if (!GetFinalPath_Smart(s))
+ {
+ ShowErrorMessage(*this, k_IncorrectPathMessage);
+ return;
+ }
+
m_RegistryInfo.ArcPaths.Clear();
AddUniqueString(m_RegistryInfo.ArcPaths, s);
- Info.ArchiveName = s;
- Info.UpdateMode = NCompressDialog::NUpdateMode::EEnum(m_UpdateMode.GetCurSel());
+ Info.ArcPath = s;
+
+ Info.UpdateMode = (NCompressDialog::NUpdateMode::EEnum)k_UpdateMode_Vals[m_UpdateMode.GetCurSel()];;
+ Info.PathMode = (NWildcard::ECensorPathMode)k_PathMode_Vals[m_PathMode.GetCurSel()];
Info.Level = GetLevelSpec();
Info.Dictionary = GetDictionarySpec();
@@ -573,27 +734,45 @@ void CCompressDialog::OnOK()
UInt32 solidLogSize = GetBlockSizeSpec();
Info.SolidBlockSize = 0;
- if (solidLogSize > 0 && solidLogSize != (UInt32)-1)
+ if (solidLogSize > 0 && solidLogSize != (UInt32)(Int32)-1)
Info.SolidBlockSize = (solidLogSize >= 64) ? (UInt64)(Int64)-1 : ((UInt64)1 << solidLogSize);
Info.Method = GetMethodSpec();
Info.EncryptionMethod = GetEncryptionMethodSpec();
Info.FormatIndex = GetFormatIndex();
Info.SFXMode = IsSFX();
- Info.OpenShareForWrite = IsButtonCheckedBool(IDC_COMPRESS_SHARED);
+ Info.OpenShareForWrite = IsButtonCheckedBool(IDX_COMPRESS_SHARED);
+ Info.DeleteAfterCompressing = IsButtonCheckedBool(IDX_COMPRESS_DEL);
- m_RegistryInfo.EncryptHeaders = Info.EncryptHeaders = IsButtonCheckedBool(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES);
+ m_RegistryInfo.EncryptHeaders =
+ Info.EncryptHeaders = IsButtonCheckedBool(IDX_COMPRESS_ENCRYPT_FILE_NAMES);
+
+
+ GetButton_Bools(IDX_COMPRESS_NT_SYM_LINKS, Info.SymLinks, m_RegistryInfo.SymLinks);
+ GetButton_Bools(IDX_COMPRESS_NT_HARD_LINKS, Info.HardLinks, m_RegistryInfo.HardLinks);
+ GetButton_Bools(IDX_COMPRESS_NT_ALT_STREAMS, Info.AltStreams, m_RegistryInfo.AltStreams);
+ GetButton_Bools(IDX_COMPRESS_NT_SECUR, Info.NtSecurity, m_RegistryInfo.NtSecurity);
+
+ {
+ const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
+ if (!ai.Flags_SymLinks()) Info.SymLinks.Val = false;
+ if (!ai.Flags_HardLinks()) Info.HardLinks.Val = false;
+ if (!ai.Flags_AltStreams()) Info.AltStreams.Val = false;
+ if (!ai.Flags_NtSecure()) Info.NtSecurity.Val = false;
+ }
m_Params.GetText(Info.Options);
+
UString volumeString;
m_Volume.GetText(volumeString);
volumeString.Trim();
Info.VolumeSizes.Clear();
+
if (!volumeString.IsEmpty())
{
if (!ParseVolumeSizes(volumeString, Info.VolumeSizes))
{
- ShowErrorMessageHwndRes(*this, IDS_COMPRESS_INCORRECT_VOLUME_SIZE, 0x02000D41);
+ ShowErrorMessageHwndRes(*this, IDS_INCORRECT_VOLUME_SIZE);
return;
}
if (!Info.VolumeSizes.IsEmpty())
@@ -603,7 +782,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_SPLIT_CONFIRM, s),
L"7-Zip", MB_YESNOCANCEL | MB_ICONQUESTION) != IDYES)
return;
}
@@ -617,10 +796,12 @@ void CCompressDialog::OnOK()
sTemp.Trim();
AddUniqueString(m_RegistryInfo.ArcPaths, sTemp);
}
+
if (m_RegistryInfo.ArcPaths.Size() > kHistorySize)
m_RegistryInfo.ArcPaths.DeleteBack();
- m_RegistryInfo.ArcType = (*ArcFormats)[Info.FormatIndex].Name;
+ if (Info.FormatIndex >= 0)
+ m_RegistryInfo.ArcType = (*ArcFormats)[Info.FormatIndex].Name;
m_RegistryInfo.ShowPassword = IsShowPasswordChecked();
m_RegistryInfo.Save();
@@ -641,7 +822,26 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
{
switch(itemID)
{
- case IDC_COMPRESS_COMBO_FORMAT:
+ case IDC_COMPRESS_ARCHIVE:
+ {
+ // we can 't change m_ArchivePath in that handler !
+ DirPrefix.Empty();
+ SetItemText(IDT_COMPRESS_ARCHIVE_FOLDER, DirPrefix);
+
+ /*
+ UString path;
+ m_ArchivePath.GetText(path);
+ m_ArchivePath.SetText(L"");
+ if (IsAbsolutePath(path))
+ {
+ UString fileName;
+ SetArcPathFields(path, fileName);
+ SetArchiveName(fileName);
+ }
+ */
+ return true;
+ }
+ case IDC_COMPRESS_FORMAT:
{
bool isSFX = IsSFX();
SaveOptionsInMem();
@@ -655,7 +855,7 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
SetMemoryUsage();
return true;
}
- case IDC_COMPRESS_COMBO_LEVEL:
+ case IDC_COMPRESS_LEVEL:
{
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormatAlways(ai.Name);
@@ -668,7 +868,7 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
SetMemoryUsage();
return true;
}
- case IDC_COMPRESS_COMBO_METHOD:
+ case IDC_COMPRESS_METHOD:
{
SetDictionary();
SetOrder();
@@ -678,14 +878,14 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
SetMemoryUsage();
return true;
}
- case IDC_COMPRESS_COMBO_DICTIONARY:
- case IDC_COMPRESS_COMBO_ORDER:
+ case IDC_COMPRESS_DICTIONARY:
+ case IDC_COMPRESS_ORDER:
{
SetSolidBlockSize();
SetMemoryUsage();
return true;
}
- case IDC_COMPRESS_COMBO_THREADS:
+ case IDC_COMPRESS_THREADS:
{
SetMemoryUsage();
return true;
@@ -708,17 +908,17 @@ void CCompressDialog::SetArchiveName2(bool prevWasSFX)
UString fileName;
m_ArchivePath.GetText(fileName);
const CArcInfoEx &prevArchiverInfo = (*ArcFormats)[m_PrevFormat];
- if (prevArchiverInfo.KeepName || Info.KeepName)
+ if (prevArchiverInfo.Flags_KeepName() || Info.KeepName)
{
- UString prevExtension = prevArchiverInfo.GetMainExt();
+ UString prevExtension;
if (prevWasSFX)
prevExtension = kExeExt;
else
- prevExtension = UString('.') + prevExtension;
- const int prevExtensionLen = prevExtension.Length();
- if (fileName.Length() >= prevExtensionLen)
- if (fileName.Right(prevExtensionLen).CompareNoCase(prevExtension) == 0)
- fileName = fileName.Left(fileName.Length() - prevExtensionLen);
+ prevExtension = UString('.') + prevArchiverInfo.GetMainExt();
+ const unsigned prevExtensionLen = prevExtension.Len();
+ if (fileName.Len() >= prevExtensionLen)
+ if (StringsAreEqualNoCase(fileName.RightPtr(prevExtensionLen), prevExtension))
+ fileName.DeleteFrom(fileName.Len() - prevExtensionLen);
}
SetArchiveName(fileName);
}
@@ -733,7 +933,7 @@ void CCompressDialog::SetArchiveName(const UString &name)
Info.FormatIndex = GetFormatIndex();
const CArcInfoEx &ai = (*ArcFormats)[Info.FormatIndex];
m_PrevFormat = Info.FormatIndex;
- if (ai.KeepName)
+ if (ai.Flags_KeepName())
{
fileName = OriginalFileName;
}
@@ -741,10 +941,9 @@ void CCompressDialog::SetArchiveName(const UString &name)
{
if (!Info.KeepName)
{
- int dotPos = fileName.ReverseFind('.');
- int slashPos = MyMax(fileName.ReverseFind(WCHAR_PATH_SEPARATOR), fileName.ReverseFind('/'));
- if (dotPos >= 0 && dotPos > slashPos + 1)
- fileName = fileName.Left(dotPos);
+ int dotPos = GetExtDotPos(fileName);
+ if (dotPos >= 0)
+ fileName.DeleteFrom(dotPos);
}
}
@@ -760,10 +959,10 @@ void CCompressDialog::SetArchiveName(const UString &name)
int CCompressDialog::FindRegistryFormat(const UString &name)
{
- for (int i = 0; i < m_RegistryInfo.Formats.Size(); i++)
+ FOR_VECTOR (i, m_RegistryInfo.Formats)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[i];
- if (name.CompareNoCase(GetUnicodeString(fo.FormatID)) == 0)
+ if (name.IsEqualToNoCase(GetUnicodeString(fo.FormatID)))
return i;
}
return -1;
@@ -783,10 +982,9 @@ int CCompressDialog::FindRegistryFormatAlways(const UString &name)
int CCompressDialog::GetStaticFormatIndex()
{
- int formatIndex = GetFormatIndex();
- const CArcInfoEx &ai = (*ArcFormats)[formatIndex];
- for (int i = 0; i < MY_SIZE_OF_ARRAY(g_Formats); i++)
- if (ai.Name.CompareNoCase(g_Formats[i].Name) == 0)
+ const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
+ for (unsigned i = 0; i < ARRAY_SIZE(g_Formats); i++)
+ if (ai.Name.IsEqualToNoCase(g_Formats[i].Name))
return i;
return 0; // -1;
}
@@ -809,22 +1007,22 @@ void CCompressDialog::SetLevel()
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
- UInt32 level = kNormal;
+ UInt32 level = 5;
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
- if (fo.Level <= kUltra)
+ if (fo.Level <= 9)
level = fo.Level;
else
- level = kUltra;
+ level = 9;
}
int i;
- for (i = 0; i <= kUltra; i++)
+ for (i = 0; i <= 9; i++)
{
if ((fi.LevelsMask & (1 << i)) != 0)
{
- const CLevelInfo &levelInfo = g_Levels[i];
- int index = (int)m_Level.AddString(LangString(levelInfo.ResourceID, levelInfo.LangID));
+ UInt32 langID = g_Levels[i];
+ int index = (int)m_Level.AddString(LangString(langID));
m_Level.SetItemData(index, i);
}
}
@@ -868,7 +1066,7 @@ void CCompressDialog::SetMethod(int keepMethodId)
weUseSameMethod = true;
continue;
}
- if ((defaultMethod.CompareNoCase(method) == 0 || m == 0) && !weUseSameMethod)
+ if ((defaultMethod.IsEqualToNoCase(method) || m == 0) && !weUseSameMethod)
m_Method.SetCurSel(itemIndex);
}
if (!weUseSameMethod)
@@ -881,19 +1079,19 @@ void CCompressDialog::SetMethod(int keepMethodId)
bool CCompressDialog::IsZipFormat()
{
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
- return (ai.Name.CompareNoCase(L"zip") == 0);
+ return ai.Name.IsEqualToNoCase(L"zip");
}
void CCompressDialog::SetEncryptionMethod()
{
_encryptionMethod.ResetContent();
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
- if (ai.Name.CompareNoCase(L"7z") == 0)
+ if (ai.Name.IsEqualToNoCase(L"7z"))
{
_encryptionMethod.AddString(TEXT("AES-256"));
_encryptionMethod.SetCurSel(0);
}
- else if (ai.Name.CompareNoCase(L"zip") == 0)
+ else if (ai.Name.IsEqualToNoCase(L"zip"))
{
int index = FindRegistryFormat(ai.Name);
UString encryptionMethod;
@@ -912,7 +1110,7 @@ int CCompressDialog::GetMethodID()
{
if (m_Method.GetCount() <= 0)
return -1;
- return (int)(UInt32)m_Method.GetItemData(m_Method.GetCurSel());
+ return (int)(UInt32)m_Method.GetItemData_of_CurSel();
}
UString CCompressDialog::GetMethodSpec()
@@ -930,41 +1128,26 @@ UString CCompressDialog::GetEncryptionMethodSpec()
return UString();
UString result;
_encryptionMethod.GetText(result);
- result.Replace(L"-", L"");
+ result.RemoveChar(L'-');
return result;
}
-int CCompressDialog::AddDictionarySize(UInt32 size, bool kilo, bool maga)
+void CCompressDialog::AddDictionarySize(UInt32 size)
{
- UInt32 sizePrint = size;
- if (kilo)
- sizePrint >>= 10;
- else if (maga)
- sizePrint >>= 20;
+ Byte c = 0;
+ unsigned moveBits = 0;
+ if ((size & 0xFFFFF) == 0) { moveBits = 20; c = 'M'; }
+ else if ((size & 0x3FF) == 0) { moveBits = 10; c = 'K'; }
TCHAR s[40];
- ConvertUInt32ToString(sizePrint, s);
- if (kilo)
- lstrcat(s, TEXT(" K"));
- else if (maga)
- lstrcat(s, TEXT(" M"));
- else
- lstrcat(s, TEXT(" "));
- lstrcat(s, TEXT("B"));
+ ConvertUInt32ToString(size >> moveBits, s);
+ unsigned pos = MyStringLen(s);
+ s[pos++] = ' ';
+ if (moveBits != 0)
+ s[pos++] = c;
+ s[pos++] = 'B';
+ s[pos++] = 0;
int index = (int)m_Dictionary.AddString(s);
m_Dictionary.SetItemData(index, size);
- return index;
-}
-
-int CCompressDialog::AddDictionarySize(UInt32 size)
-{
- if (size > 0)
- {
- if ((size & 0xFFFFF) == 0)
- return AddDictionarySize(size, false, true);
- if ((size & 0x3FF) == 0)
- return AddDictionarySize(size, true, false);
- }
- return AddDictionarySize(size, false, false);
}
void CCompressDialog::SetDictionary()
@@ -972,11 +1155,11 @@ void CCompressDialog::SetDictionary()
m_Dictionary.ResetContent();
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
- UInt32 defaultDictionary = (UInt32)-1;
+ UInt32 defaultDictionary = (UInt32)(Int32)-1;
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
- if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
+ if (fo.Method.IsEqualToNoCase(GetMethodSpec()))
defaultDictionary = fo.Dictionary;
}
int methodID = GetMethodID();
@@ -990,7 +1173,7 @@ void CCompressDialog::SetDictionary()
case kLZMA2:
{
static const UInt32 kMinDicSize = (1 << 16);
- if (defaultDictionary == (UInt32)-1)
+ if (defaultDictionary == (UInt32)(Int32)-1)
{
if (level >= 9) defaultDictionary = (1 << 26);
else if (level >= 7) defaultDictionary = (1 << 25);
@@ -1027,7 +1210,7 @@ void CCompressDialog::SetDictionary()
}
case kPPMd:
{
- if (defaultDictionary == (UInt32)-1)
+ if (defaultDictionary == (UInt32)(Int32)-1)
{
if (level >= 9) defaultDictionary = (192 << 20);
else if (level >= 7) defaultDictionary = ( 64 << 20);
@@ -1072,7 +1255,7 @@ void CCompressDialog::SetDictionary()
}
case kBZip2:
{
- if (defaultDictionary == (UInt32)-1)
+ if (defaultDictionary == (UInt32)(Int32)-1)
{
if (level >= 5)
defaultDictionary = (900 << 10);
@@ -1092,7 +1275,7 @@ void CCompressDialog::SetDictionary()
}
case kPPMdZip:
{
- if (defaultDictionary == (UInt32)-1)
+ if (defaultDictionary == (UInt32)(Int32)-1)
defaultDictionary = (1 << (19 + (level > 8 ? 8 : level)));
for (int i = 20; i <= 28; i++)
{
@@ -1112,14 +1295,14 @@ void CCompressDialog::SetDictionary()
UInt32 CCompressDialog::GetComboValue(NWindows::NControl::CComboBox &c, int defMax)
{
if (c.GetCount() <= defMax)
- return (UInt32)-1;
- return (UInt32)c.GetItemData(c.GetCurSel());
+ return (UInt32)(Int32)-1;
+ return (UInt32)c.GetItemData_of_CurSel();
}
UInt32 CCompressDialog::GetLevel2()
{
UInt32 level = GetLevel();
- if (level == (UInt32)-1)
+ if (level == (UInt32)(Int32)-1)
level = 5;
return level;
}
@@ -1138,11 +1321,11 @@ void CCompressDialog::SetOrder()
m_Order.ResetContent();
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
- UInt32 defaultOrder = (UInt32)-1;
+ UInt32 defaultOrder = (UInt32)(Int32)-1;
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
- if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
+ if (fo.Method.IsEqualToNoCase(GetMethodSpec()))
defaultOrder = fo.Order;
}
int methodID = GetMethodID();
@@ -1154,7 +1337,7 @@ void CCompressDialog::SetOrder()
case kLZMA:
case kLZMA2:
{
- if (defaultOrder == (UInt32)-1)
+ if (defaultOrder == (UInt32)(Int32)-1)
defaultOrder = (level >= 7) ? 64 : 32;
for (int i = 3; i <= 8; i++)
for (int j = 0; j < 2; j++)
@@ -1169,7 +1352,7 @@ void CCompressDialog::SetOrder()
}
case kPPMd:
{
- if (defaultOrder == (UInt32)-1)
+ if (defaultOrder == (UInt32)(Int32)-1)
{
if (level >= 9)
defaultOrder = 32;
@@ -1197,7 +1380,7 @@ void CCompressDialog::SetOrder()
case kDeflate:
case kDeflate64:
{
- if (defaultOrder == (UInt32)-1)
+ if (defaultOrder == (UInt32)(Int32)-1)
{
if (level >= 9)
defaultOrder = 128;
@@ -1224,7 +1407,7 @@ void CCompressDialog::SetOrder()
}
case kPPMdZip:
{
- if (defaultOrder == (UInt32)-1)
+ if (defaultOrder == (UInt32)(Int32)-1)
defaultOrder = level + 3;
for (int i = 2; i <= 16; i++)
AddOrder(i);
@@ -1260,24 +1443,24 @@ void CCompressDialog::SetSolidBlockSize()
return;
UInt32 dictionary = GetDictionarySpec();
- if (dictionary == (UInt32)-1)
+ if (dictionary == (UInt32)(Int32)-1)
dictionary = 1;
- UInt32 defaultBlockSize = (UInt32)-1;
+ UInt32 defaultBlockSize = (UInt32)(Int32)-1;
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
- if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
+ if (fo.Method.IsEqualToNoCase(GetMethodSpec()))
defaultBlockSize = fo.BlockLogSize;
}
- index = (int)m_Solid.AddString(LangString(IDS_COMPRESS_NON_SOLID, 0x02000D14));
+ index = (int)m_Solid.AddString(LangString(IDS_COMPRESS_NON_SOLID));
m_Solid.SetItemData(index, (UInt32)kNoSolidBlockSize);
m_Solid.SetCurSel(0);
- bool needSet = defaultBlockSize == (UInt32)-1;
+ bool needSet = defaultBlockSize == (UInt32)(Int32)-1;
for (int i = 20; i <= 36; i++)
{
if (needSet && dictionary >= (((UInt64)1 << (i - 7))) && i <= 32)
@@ -1290,9 +1473,9 @@ void CCompressDialog::SetSolidBlockSize()
int index = (int)m_Solid.AddString(s);
m_Solid.SetItemData(index, (UInt32)i);
}
- index = (int)m_Solid.AddString(LangString(IDS_COMPRESS_SOLID, 0x02000D15));
+ index = (int)m_Solid.AddString(LangString(IDS_COMPRESS_SOLID));
m_Solid.SetItemData(index, kSolidBlockSize);
- if (defaultBlockSize == (UInt32)-1)
+ if (defaultBlockSize == (UInt32)(Int32)-1)
defaultBlockSize = kSolidBlockSize;
if (defaultBlockSize != kNoSolidBlockSize)
SetNearestSelectComboBox(m_Solid, defaultBlockSize);
@@ -1314,7 +1497,7 @@ void CCompressDialog::SetNumThreads()
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
- if (fo.Method.CompareNoCase(GetMethodSpec()) == 0 && fo.NumThreads != (UInt32)-1)
+ if (fo.Method.IsEqualToNoCase(GetMethodSpec()) && fo.NumThreads != (UInt32)(Int32)-1)
defaultValue = fo.NumThreads;
}
@@ -1415,7 +1598,7 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
case kDeflate64:
{
UInt32 order = GetOrder();
- if (order == (UInt32)-1)
+ if (order == (UInt32)(Int32)-1)
order = 32;
if (level >= 7)
size += (1 << 20);
@@ -1461,8 +1644,8 @@ void CCompressDialog::SetMemoryUsage()
{
UInt64 decompressMem;
UInt64 memUsage = GetMemoryUsage(decompressMem);
- PrintMemUsage(IDC_STATIC_COMPRESS_MEMORY_VALUE, memUsage);
- PrintMemUsage(IDC_STATIC_COMPRESS_MEMORY_DE_VALUE, decompressMem);
+ PrintMemUsage(IDT_COMPRESS_MEMORY_VALUE, memUsage);
+ PrintMemUsage(IDT_COMPRESS_MEMORY_DE_VALUE, decompressMem);
}
void CCompressDialog::SetParams()
@@ -1494,7 +1677,7 @@ void CCompressDialog::SaveOptionsInMem()
fo.BlockLogSize = GetBlockSizeSpec();
}
-int CCompressDialog::GetFormatIndex()
+unsigned CCompressDialog::GetFormatIndex()
{
- return (int)m_Format.GetItemData(m_Format.GetCurSel());
+ return (unsigned)m_Format.GetItemData_of_CurSel();
}
diff --git a/CPP/7zip/UI/GUI/CompressDialog.h b/CPP/7zip/UI/GUI/CompressDialog.h
index 7b0067fa..3463fefc 100755..100644
--- a/CPP/7zip/UI/GUI/CompressDialog.h
+++ b/CPP/7zip/UI/GUI/CompressDialog.h
@@ -3,8 +3,10 @@
#ifndef __COMPRESS_DIALOG_H
#define __COMPRESS_DIALOG_H
-#include "Windows/Control/ComboBox.h"
-#include "Windows/Control/Edit.h"
+#include "../../../Common/Wildcard.h"
+
+#include "../../../Windows/Control/ComboBox.h"
+#include "../../../Windows/Control/Edit.h"
#include "../Common/LoadCodecs.h"
#include "../Common/ZipRegistry.h"
@@ -22,12 +24,15 @@ namespace NCompressDialog
kAdd,
kUpdate,
kFresh,
- kSynchronize
+ kSync
};
}
+
struct CInfo
{
NUpdateMode::EEnum UpdateMode;
+ NWildcard::ECensorPathMode PathMode;
+
bool SolidIsSpecified;
bool MultiThreadIsAllowed;
UInt64 SolidBlockSize;
@@ -46,10 +51,16 @@ namespace NCompressDialog
bool SFXMode;
bool OpenShareForWrite;
-
+ bool DeleteAfterCompressing;
- UString ArchiveName; // in: Relative for ; out: abs
- FString CurrentDirPrefix;
+ CBoolPair SymLinks;
+ CBoolPair HardLinks;
+ CBoolPair AltStreams;
+ CBoolPair NtSecurity;
+
+ UString ArcPath; // in: Relative or abs ; out: Relative or abs
+
+ // FString CurrentDirPrefix;
bool KeepName;
bool GetFullPathName(UString &result) const;
@@ -60,7 +71,13 @@ namespace NCompressDialog
bool EncryptHeadersIsAllowed;
bool EncryptHeaders;
- void Init()
+ CInfo():
+ UpdateMode(NCompressDialog::NUpdateMode::kAdd),
+ PathMode(NWildcard::k_RelatPath),
+ SFXMode(false),
+ OpenShareForWrite(false),
+ DeleteAfterCompressing(false),
+ FormatIndex(-1)
{
Level = Dictionary = Order = UInt32(-1);
OrderMode = false;
@@ -68,10 +85,6 @@ namespace NCompressDialog
Options.Empty();
EncryptionMethod.Empty();
}
- CInfo()
- {
- Init();
- }
};
}
@@ -85,7 +98,10 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
NWindows::NControl::CComboBox m_Order;
NWindows::NControl::CComboBox m_Solid;
NWindows::NControl::CComboBox m_NumThreads;
+
NWindows::NControl::CComboBox m_UpdateMode;
+ NWindows::NControl::CComboBox m_PathMode;
+
NWindows::NControl::CComboBox m_Volume;
NWindows::NControl::CDialogChildControl m_Params;
@@ -96,6 +112,12 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
NCompression::CInfo m_RegistryInfo;
int m_PrevFormat;
+ UString DirPrefix;
+ UString StartDirPrefix;
+
+ void CheckButton_TwoBools(UINT id, const CBoolPair &b1, const CBoolPair &b2);
+ void GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2);
+
void SetArchiveName(const UString &name);
int FindRegistryFormat(const UString &name);
int FindRegistryFormatAlways(const UString &name);
@@ -118,8 +140,7 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
void SetEncryptionMethod();
- int AddDictionarySize(UInt32 size, bool kilo, bool maga);
- int AddDictionarySize(UInt32 size);
+ void AddDictionarySize(UInt32 size);
void SetDictionary();
@@ -151,27 +172,32 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
void SaveOptionsInMem();
void UpdatePasswordControl();
- bool IsShowPasswordChecked() const
- { return IsButtonChecked(IDC_COMPRESS_CHECK_SHOW_PASSWORD) == BST_CHECKED; }
+ bool IsShowPasswordChecked() const { return IsButtonCheckedBool(IDX_PASSWORD_SHOW); }
+
+ unsigned GetFormatIndex();
+ bool SetArcPathFields(const UString &path, UString &name, bool always);
+ bool GetFinalPath_Smart(UString &resPath);
- int GetFormatIndex();
public:
CObjectVector<CArcInfoEx> *ArcFormats;
- CRecordVector<int> ArcIndices;
+ CUIntVector ArcIndices; // can not be empty, must contain Info.FormatIndex, if Info.FormatIndex >= 0
NCompressDialog::CInfo Info;
UString OriginalFileName; // for bzip2, gzip2
+ bool CurrentDirWasChanged;
INT_PTR Create(HWND wndParent = 0)
{
BIG_DIALOG_SIZE(400, 304);
- return CModalDialog::Create(SIZED_DIALOG(IDD_DIALOG_COMPRESS), wndParent);
+ return CModalDialog::Create(SIZED_DIALOG(IDD_COMPRESS), wndParent);
}
+ CCompressDialog(): CurrentDirWasChanged(false) {};
+
protected:
void CheckSFXControlsEnable();
- void CheckVolumeEnable();
+ // void CheckVolumeEnable();
void CheckControlsEnable();
void OnButtonSetArchive();
diff --git a/CPP/7zip/UI/GUI/CompressDialog.rc b/CPP/7zip/UI/GUI/CompressDialog.rc
index 5a71b043..6c555a7e 100755..100644
--- a/CPP/7zip/UI/GUI/CompressDialog.rc
+++ b/CPP/7zip/UI/GUI/CompressDialog.rc
@@ -2,7 +2,7 @@
#include "../../GuiCommon.rc"
#define xc 400
-#define yc 304
+#define yc 354
#undef gSize
#undef gSpace
@@ -20,6 +20,11 @@
#define gSize 192
#define gSpace 24
+#define ntSize2 168
+#define ntSizeX (ntSize2 - m - m)
+#define ntPosX m + m
+#define ntPosY 292
+
#define g1xs 88
#define g0xs (gSize - g1xs)
#define g1x (m + g0xs)
@@ -33,8 +38,9 @@
#define g4xs (xc - gSize - gSpace)
#define g4xs2 (g4xs - m - m)
-#define yOpt 72
-#define yPsw 128
+#define yOpt 80
+
+#define xArcFolderOffs 40
#undef GROUP_Y_SIZE
#undef GROUP_Y_SIZE_ENCRYPT
@@ -42,81 +48,105 @@
#define GROUP_Y_SIZE 8
#define GROUP_Y_SIZE_ENCRYPT 8
#else
-#define GROUP_Y_SIZE 48
+#define GROUP_Y_SIZE 64
#define GROUP_Y_SIZE_ENCRYPT 128
#endif
-IDD_DIALOG_COMPRESS MY_DIALOG
+#define yPsw (yOpt + GROUP_Y_SIZE + 8)
+
+IDD_COMPRESS DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "Add to Archive"
BEGIN
- LTEXT "&Archive:", IDC_STATIC_COMPRESS_ARCHIVE, m, m, xc, 8
- COMBOBOX IDC_COMPRESS_COMBO_ARCHIVE, m, 18, xc - bxsDots - 12, 126, MY_COMBO_WITH_EDIT
- PUSHBUTTON "...", IDC_COMPRESS_BUTTON_SET_ARCHIVE, xs - m - bxsDots, 17, bxsDots, bys, WS_GROUP
+ LTEXT "", IDT_COMPRESS_ARCHIVE_FOLDER, m + xArcFolderOffs, m, xc - xArcFolderOffs, 8
+ LTEXT "&Archive:", IDT_COMPRESS_ARCHIVE, m, 12, xArcFolderOffs, 8
+ COMBOBOX IDC_COMPRESS_ARCHIVE, m + xArcFolderOffs, 18, xc - bxsDots - 12 - xArcFolderOffs, 126, MY_COMBO_WITH_EDIT
+ PUSHBUTTON "...", IDB_COMPRESS_SET_ARCHIVE, xs - m - bxsDots, 16, bxsDots, bys, WS_GROUP
- LTEXT "Archive &format:", IDC_STATIC_COMPRESS_FORMAT, m, 41, g0xs, 8
- COMBOBOX IDC_COMPRESS_COMBO_FORMAT, g1x, 39, g1xs , 80, MY_COMBO | CBS_SORT
+ LTEXT "Archive &format:", IDT_COMPRESS_FORMAT, m, 41, g0xs, 8
+ COMBOBOX IDC_COMPRESS_FORMAT, g1x, 39, g1xs, 80, MY_COMBO | CBS_SORT
- LTEXT "Compression &level:",IDC_STATIC_COMPRESS_LEVEL, m, 62, g0xs, 8
- COMBOBOX IDC_COMPRESS_COMBO_LEVEL, g1x, 60, g1xs, 80, MY_COMBO
+ LTEXT "Compression &level:", IDT_COMPRESS_LEVEL, m, 62, g0xs, 8
+ COMBOBOX IDC_COMPRESS_LEVEL, g1x, 60, g1xs, 80, MY_COMBO
- LTEXT "Compression &method:",IDC_STATIC_COMPRESS_METHOD, m, 83, g0xs, 8
- COMBOBOX IDC_COMPRESS_COMBO_METHOD, g1x, 81, g1xs, 80, MY_COMBO
+ LTEXT "Compression &method:", IDT_COMPRESS_METHOD, m, 83, g0xs, 8
+ COMBOBOX IDC_COMPRESS_METHOD, g1x, 81, g1xs, 80, MY_COMBO
- LTEXT "&Dictionary size:",IDC_STATIC_COMPRESS_DICTIONARY, m, 104, g0xs, 8
- COMBOBOX IDC_COMPRESS_COMBO_DICTIONARY, g1x, 102, g1xs, 167, MY_COMBO
+ LTEXT "&Dictionary size:", IDT_COMPRESS_DICTIONARY, m, 104, g0xs, 8
+ COMBOBOX IDC_COMPRESS_DICTIONARY, g1x, 102, g1xs, 167, MY_COMBO
- LTEXT "&Word size:",IDC_STATIC_COMPRESS_ORDER, m, 125, g0xs, 8
- COMBOBOX IDC_COMPRESS_COMBO_ORDER, g1x, 123, g1xs, 141, MY_COMBO
+ LTEXT "&Word size:", IDT_COMPRESS_ORDER, m, 125, g0xs, 8
+ COMBOBOX IDC_COMPRESS_ORDER, g1x, 123, g1xs, 141, MY_COMBO
- LTEXT "&Solid Block size:",IDC_STATIC_COMPRESS_SOLID, m, 146, g0xs, 8
- COMBOBOX IDC_COMPRESS_COMBO_SOLID, g1x, 144, g1xs, 140, MY_COMBO
+ LTEXT "&Solid Block size:", IDT_COMPRESS_SOLID, m, 146, g0xs, 8
+ COMBOBOX IDC_COMPRESS_SOLID, g1x, 144, g1xs, 140, MY_COMBO
- LTEXT "&Number of CPU threads:",IDC_STATIC_COMPRESS_THREADS, m, 167, g0xs, 8
- COMBOBOX IDC_COMPRESS_COMBO_THREADS, g1x, 165, g1xs - 35, 140, MY_COMBO
- RTEXT "1", IDC_COMPRESS_HARDWARE_THREADS, g1x + g1xs - 35 + 10, 167, 25, 8
+ LTEXT "&Number of CPU threads:", IDT_COMPRESS_THREADS, m, 167, g0xs, 8
+ COMBOBOX IDC_COMPRESS_THREADS, g1x, 165, g1xs - 35, 140, MY_COMBO
+ RTEXT "", IDT_COMPRESS_HARDWARE_THREADS, g1x + g1xs - 35 + 10, 167, 25, 8
- LTEXT "Memory usage for Compressing:", IDC_STATIC_COMPRESS_MEMORY, m, 190, g2xs, 8
- RTEXT "0", IDC_STATIC_COMPRESS_MEMORY_VALUE, g3x, 190, g3xs, 8
+ LTEXT "Memory usage for Compressing:", IDT_COMPRESS_MEMORY, m, 190, g2xs, 8
+ RTEXT "", IDT_COMPRESS_MEMORY_VALUE, g3x, 190, g3xs, 8
+
+ LTEXT "Memory usage for Decompressing:", IDT_COMPRESS_MEMORY_DE, m, 206, g2xs, 8
+ RTEXT "", IDT_COMPRESS_MEMORY_DE_VALUE, g3x, 206, g3xs, 8
+
+
+ LTEXT "Split to &volumes, bytes:", IDT_SPLIT_TO_VOLUMES, m, 225, gSize, 8
+ COMBOBOX IDC_COMPRESS_VOLUME, m, 237, gSize, 73, MY_COMBO_WITH_EDIT
+
+ LTEXT "&Parameters:", IDT_COMPRESS_PARAMETERS, m, 256, gSize, 8
+ EDITTEXT IDE_COMPRESS_PARAMETERS, m, 268, gSize, 14, ES_AUTOHSCROLL
+
+
+ GROUPBOX "NTFS", IDG_COMPRESS_NTFS, m, ntPosY, ntSize2, 68
+
+ CONTROL "Store symbolic links", IDX_COMPRESS_NT_SYM_LINKS, MY_CHECKBOX,
+ ntPosX, ntPosY + 12, ntSizeX, 10
+ CONTROL "Store hard links", IDX_COMPRESS_NT_HARD_LINKS, MY_CHECKBOX,
+ ntPosX, ntPosY + 26, ntSizeX, 10
+ CONTROL "Store alternate data streams", IDX_COMPRESS_NT_ALT_STREAMS, MY_CHECKBOX,
+ ntPosX, ntPosY + 40, ntSizeX, 10
+ CONTROL "Store file security", IDX_COMPRESS_NT_SECUR, MY_CHECKBOX,
+ ntPosX, ntPosY + 54, ntSizeX, 10
- LTEXT "Memory usage for Decompressing:", IDC_STATIC_COMPRESS_MEMORY_DE, m, 206, g2xs, 8
- RTEXT "0",IDC_STATIC_COMPRESS_MEMORY_DE_VALUE, g3x, 206, g3xs, 8
+ LTEXT "&Update mode:", IDT_COMPRESS_UPDATE_MODE, g4x, 41, 80, 8
+ COMBOBOX IDC_COMPRESS_UPDATE_MODE, g4x + 84, 39, g4xs - 84, 80, MY_COMBO
- LTEXT "Split to &volumes, bytes:", IDC_STATIC_COMPRESS_VOLUME, m, 225, gSize, 8
- COMBOBOX IDC_COMPRESS_COMBO_VOLUME, m, 237, gSize, 73, MY_COMBO_WITH_EDIT
+ LTEXT "Path mode:", IDT_COMPRESS_PATH_MODE, g4x, 61, 80, 8
+ COMBOBOX IDC_COMPRESS_PATH_MODE, g4x + 84, 59, g4xs - 84, 80, MY_COMBO
- LTEXT "&Parameters:",IDC_STATIC_COMPRESS_PARAMETERS, m, 260, xc, 8
- EDITTEXT IDC_COMPRESS_EDIT_PARAMETERS, m, 272, xc, 14, ES_AUTOHSCROLL
- LTEXT "&Update mode:",IDC_STATIC_COMPRESS_UPDATE_MODE, g4x, 39, g4xs, 8
- COMBOBOX IDC_COMPRESS_COMBO_UPDATE_MODE, g4x, 51, g4xs, 80, MY_COMBO
+ GROUPBOX "Options", IDG_COMPRESS_OPTIONS, g4x, yOpt, g4xs, GROUP_Y_SIZE
- GROUPBOX "Options",IDC_STATIC_COMPRESS_OPTIONS, g4x, yOpt, g4xs, GROUP_Y_SIZE
- CONTROL "Create SF&X archive",IDC_COMPRESS_SFX, MY_CHECKBOX,
+ CONTROL "Create SF&X archive", IDX_COMPRESS_SFX, MY_CHECKBOX,
g4x2, yOpt + 14, g4xs2, 10
- CONTROL "Compress shared files",IDC_COMPRESS_SHARED, MY_CHECKBOX,
+ CONTROL "Compress shared files", IDX_COMPRESS_SHARED, MY_CHECKBOX,
g4x2, yOpt + 30, g4xs2, 10
-
- GROUPBOX "Encryption", IDC_COMPRESS_ENCRYPTION, g4x, yPsw, g4xs, GROUP_Y_SIZE_ENCRYPT
+ CONTROL "Delete files after compression", IDX_COMPRESS_DEL, MY_CHECKBOX,
+ g4x2, yOpt + 46, g4xs2, 10
+
- LTEXT "Enter password:",IDC_STATIC_COMPRESS_PASSWORD1, g4x2, yPsw + 14, g4xs2, 8
- EDITTEXT IDC_COMPRESS_EDIT_PASSWORD1, g4x2, yPsw + 26, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
- LTEXT "Reenter password:",IDC_STATIC_COMPRESS_PASSWORD2, g4x2, yPsw + 46, g4xs2, 8
- EDITTEXT IDC_COMPRESS_EDIT_PASSWORD2, g4x2, yPsw + 58, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
+ GROUPBOX "Encryption", IDG_COMPRESS_ENCRYPTION, g4x, yPsw, g4xs, GROUP_Y_SIZE_ENCRYPT
- CONTROL "Show Password",IDC_COMPRESS_CHECK_SHOW_PASSWORD,MY_CHECKBOX,
+ LTEXT "Enter password:", IDT_PASSWORD_ENTER, g4x2, yPsw + 14, g4xs2, 8
+ EDITTEXT IDE_COMPRESS_PASSWORD1, g4x2, yPsw + 26, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
+ LTEXT "Reenter password:", IDT_PASSWORD_REENTER, g4x2, yPsw + 46, g4xs2, 8
+ EDITTEXT IDE_COMPRESS_PASSWORD2, g4x2, yPsw + 58, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
+
+ CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX,
g4x2, yPsw + 79, g4xs2, 10
- LTEXT "&Encryption method:",IDC_STATIC_COMPRESS_ENCRYPTION_METHOD, g4x2, yPsw + 95, 100, 8
- COMBOBOX IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, g4x2 + 100, yPsw + 93, g4xs2 - 100, 198, MY_COMBO
+ LTEXT "&Encryption method:", IDT_COMPRESS_ENCRYPTION_METHOD, g4x2, yPsw + 95, 100, 8
+ COMBOBOX IDC_COMPRESS_ENCRYPTION_METHOD, g4x2 + 100, yPsw + 93, g4xs2 - 100, 198, MY_COMBO
- CONTROL "Encrypt file &names", IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, MY_CHECKBOX,
+ CONTROL "Encrypt file &names", IDX_COMPRESS_ENCRYPT_FILE_NAMES, MY_CHECKBOX,
g4x2, yPsw + 111, g4xs2, 10
- DEFPUSHBUTTON "OK", IDOK, bx3, by, bxs, bys, WS_GROUP
+ DEFPUSHBUTTON "OK", IDOK, bx3, by, bxs, bys, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, bx2, by, bxs, bys
- PUSHBUTTON "Help", IDHELP, bx1, by, bxs, bys
+ PUSHBUTTON "Help", IDHELP, bx1, by, bxs, bys
END
@@ -131,39 +161,38 @@ END
#define yc 160
-IDD_DIALOG_COMPRESS_2 MY_DIALOG
+IDD_COMPRESS_2 DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "Add to Archive"
MY_FONT
BEGIN
- // LTEXT "&Archive:", IDC_STATIC_COMPRESS_ARCHIVE, m, m + 1, 32, 8
- COMBOBOX IDC_COMPRESS_COMBO_ARCHIVE, m, m, xc - bxsDots - m, 126, MY_COMBO_WITH_EDIT
- PUSHBUTTON "...", IDC_COMPRESS_BUTTON_SET_ARCHIVE, xs - m - bxsDots, m, bxsDots, 12, WS_GROUP
+ COMBOBOX IDC_COMPRESS_ARCHIVE, m, m, xc - bxsDots - m, 126, MY_COMBO_WITH_EDIT
+ PUSHBUTTON "...", IDB_COMPRESS_SET_ARCHIVE, xs - m - bxsDots, m, bxsDots, 12, WS_GROUP
- COMBOBOX IDC_COMPRESS_COMBO_FORMAT, m , 22, 32, 80, MY_COMBO | CBS_SORT
- COMBOBOX IDC_COMPRESS_COMBO_LEVEL, m + 36, 22, 68, 80, MY_COMBO
- COMBOBOX IDC_COMPRESS_COMBO_METHOD, m + 108, 22, 44, 80, MY_COMBO
+ COMBOBOX IDC_COMPRESS_FORMAT, m , 22, 32, 80, MY_COMBO | CBS_SORT
+ COMBOBOX IDC_COMPRESS_LEVEL, m + 36, 22, 68, 80, MY_COMBO
+ COMBOBOX IDC_COMPRESS_METHOD, m + 108, 22, 44, 80, MY_COMBO
- COMBOBOX IDC_COMPRESS_COMBO_DICTIONARY, m, 40, 40, 80, MY_COMBO
- COMBOBOX IDC_COMPRESS_COMBO_ORDER, m + 44, 40, 32, 80, MY_COMBO
- COMBOBOX IDC_COMPRESS_COMBO_SOLID, m + 80, 40, 40, 80, MY_COMBO
- COMBOBOX IDC_COMPRESS_COMBO_THREADS, m + 124, 40, 28, 80, MY_COMBO
+ COMBOBOX IDC_COMPRESS_DICTIONARY, m, 40, 40, 80, MY_COMBO
+ COMBOBOX IDC_COMPRESS_ORDER, m + 44, 40, 32, 80, MY_COMBO
+ COMBOBOX IDC_COMPRESS_SOLID, m + 80, 40, 40, 80, MY_COMBO
+ COMBOBOX IDC_COMPRESS_THREADS, m + 124, 40, 28, 80, MY_COMBO
- LTEXT "Split to &volumes, bytes:", IDC_STATIC_COMPRESS_VOLUME, m, 60, 32, 8
- COMBOBOX IDC_COMPRESS_COMBO_VOLUME, m + 32, 58, 44, 73, MY_COMBO_WITH_EDIT
- LTEXT "&Parameters:",IDC_STATIC_COMPRESS_PARAMETERS, m + 80, 60, 48, 8
- EDITTEXT IDC_COMPRESS_EDIT_PARAMETERS, m + 128, 58, 24, 13, ES_AUTOHSCROLL
+ LTEXT "Split to &volumes, bytes:", IDT_SPLIT_TO_VOLUMES, m, 60, 32, 8
+ COMBOBOX IDC_COMPRESS_VOLUME, m + 32, 58, 44, 73, MY_COMBO_WITH_EDIT
+ LTEXT "&Parameters:", IDT_COMPRESS_PARAMETERS, m + 80, 60, 48, 8
+ EDITTEXT IDE_COMPRESS_PARAMETERS, m + 128, 58, 24, 13, ES_AUTOHSCROLL
- COMBOBOX IDC_COMPRESS_COMBO_UPDATE_MODE, m, 76, 88, 80, MY_COMBO
- CONTROL "SF&X", IDC_COMPRESS_SFX, MY_CHECKBOX, m + 92, 77, 60, 10
+ COMBOBOX IDC_COMPRESS_UPDATE_MODE, m, 76, 88, 80, MY_COMBO
+ CONTROL "SF&X", IDX_COMPRESS_SFX, MY_CHECKBOX, m + 92, 77, 60, 10
- CONTROL "Compress shared files", IDC_COMPRESS_SHARED, MY_CHECKBOX, m, 94, xc, 10
+ CONTROL "Compress shared files", IDX_COMPRESS_SHARED, MY_CHECKBOX, m, 94, xc, 10
- LTEXT "Enter password:", IDC_STATIC_COMPRESS_PASSWORD1, m, 112, 60, 8
- EDITTEXT IDC_COMPRESS_EDIT_PASSWORD1, m + 60, 110, 44, 13, ES_PASSWORD | ES_AUTOHSCROLL
- CONTROL "Show Password", IDC_COMPRESS_CHECK_SHOW_PASSWORD, MY_CHECKBOX, m + 108, 112, 44, 10
+ LTEXT "Enter password:", IDT_PASSWORD_ENTER, m, 112, 60, 8
+ EDITTEXT IDE_COMPRESS_PASSWORD1, m + 60, 110, 44, 13, ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX, m + 108, 112, 44, 10
- COMBOBOX IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, m, 128, 48, 198, MY_COMBO
- CONTROL "Encrypt file &names", IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, MY_CHECKBOX, m + 52, 130, 100, 10
+ COMBOBOX IDC_COMPRESS_ENCRYPTION_METHOD, m, 128, 48, 198, MY_COMBO
+ CONTROL "Encrypt file &names", IDX_COMPRESS_ENCRYPT_FILE_NAMES, MY_CHECKBOX, m + 52, 130, 100, 10
OK_CANCEL
END
@@ -172,26 +201,27 @@ END
STRINGTABLE
BEGIN
- IDS_METHOD_STORE "Store"
- IDS_METHOD_NORMAL "Normal"
- IDS_METHOD_MAXIMUM "Maximum"
- IDS_METHOD_FAST "Fast"
- IDS_METHOD_FASTEST "Fastest"
- IDS_METHOD_ULTRA "Ultra"
+ IDS_PASSWORD_NOT_MATCH "Passwords do not match"
+ IDS_PASSWORD_USE_ASCII "Use only English letters, numbers and special characters (!, #, $, ...) for password."
+ IDS_PASSWORD_TOO_LONG "Password is too long"
- IDS_COMPRESS_NON_SOLID "Non-solid"
- IDS_COMPRESS_SOLID "Solid"
+ IDS_METHOD_STORE "Store"
+ IDS_METHOD_FASTEST "Fastest"
+ IDS_METHOD_FAST "Fast"
+ IDS_METHOD_NORMAL "Normal"
+ IDS_METHOD_MAXIMUM "Maximum"
+ IDS_METHOD_ULTRA "Ultra"
- IDS_COMPRESS_UPDATE_MODE_ADD "Add and replace files"
+ IDS_COMPRESS_UPDATE_MODE_ADD "Add and replace files"
IDS_COMPRESS_UPDATE_MODE_UPDATE "Update and add files"
- IDS_COMPRESS_UPDATE_MODE_FRESH "Freshen existing files"
- IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE "Synchronize files"
- IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE "Browse"
- IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE "Specified volume size: {0} bytes.\nAre you sure you want to split archive into such volumes?"
+ IDS_COMPRESS_UPDATE_MODE_FRESH "Freshen existing files"
+ IDS_COMPRESS_UPDATE_MODE_SYNC "Synchronize files"
- IDS_OPEN_TYPE_ALL_FILES "All Files"
+ IDS_OPEN_TYPE_ALL_FILES "All Files"
+ IDS_COMPRESS_SET_ARCHIVE_BROWSE "Browse"
- IDS_PASSWORD_USE_ASCII "Use only English letters, numbers and special characters (!, #, $, ...) for password."
- IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH "Passwords do not match"
- IDS_PASSWORD_IS_TOO_LONG "Password is too long"
+ IDS_COMPRESS_NON_SOLID "Non-solid"
+ IDS_COMPRESS_SOLID "Solid"
+
+ IDS_SPLIT_CONFIRM "Specified volume size: {0} bytes.\nAre you sure you want to split archive into such volumes?"
END
diff --git a/CPP/7zip/UI/GUI/CompressDialogRes.h b/CPP/7zip/UI/GUI/CompressDialogRes.h
index 2dcdc80e..ff99fa94 100755..100644
--- a/CPP/7zip/UI/GUI/CompressDialogRes.h
+++ b/CPP/7zip/UI/GUI/CompressDialogRes.h
@@ -1,81 +1,87 @@
-#define IDD_DIALOG_COMPRESS 551
-#define IDD_DIALOG_COMPRESS_2 651
-#define IDC_STATIC_COMPRESS_MEMORY 1022
-#define IDC_STATIC_COMPRESS_MEMORY_DE 1023
-#define IDC_STATIC_COMPRESS_MEMORY_VALUE 1027
-#define IDC_STATIC_COMPRESS_MEMORY_DE_VALUE 1028
-#define IDC_COMPRESS_COMBO_ARCHIVE 1072
-#define IDC_COMPRESS_BUTTON_SET_ARCHIVE 1073
-#define IDC_COMPRESS_COMBO_LEVEL 1074
-#define IDC_COMPRESS_COMBO_UPDATE_MODE 1075
-#define IDC_COMPRESS_COMBO_FORMAT 1076
-#define IDC_COMPRESS_COMBO_VOLUME 1077
-#define IDC_COMPRESS_COMBO_METHOD 1078
-#define IDC_COMPRESS_COMBO_DICTIONARY 1079
-#define IDC_COMPRESS_COMBO_ORDER 1080
-
-#define IDC_COMPRESS_COMBO_SOLID 1081
-#define IDC_COMPRESS_COMBO_THREADS 1082
-#define IDC_COMPRESS_HARDWARE_THREADS 1083
-
-#define IDC_COMPRESS_SFX 1090
-#define IDC_COMPRESS_EDIT_PARAMETERS 1091
-
-// #define IDC_COMPRESS_SOLID 1092
-// #define IDC_COMPRESS_MULTI_THREAD 1093
-
-#define IDC_STATIC_COMPRESS_ARCHIVE 1097
-#define IDC_STATIC_COMPRESS_FORMAT 1098
-#define IDC_STATIC_COMPRESS_LEVEL 1099
-#define IDC_STATIC_COMPRESS_PARAMETERS 1100
-#define IDC_STATIC_COMPRESS_UPDATE_MODE 1101
-#define IDC_STATIC_COMPRESS_OPTIONS 1102
-#define IDC_STATIC_COMPRESS_VOLUME 1103
-#define IDC_STATIC_COMPRESS_METHOD 1104
-#define IDC_STATIC_COMPRESS_DICTIONARY 1105
-#define IDC_STATIC_COMPRESS_ORDER 1106
-
-#define IDC_STATIC_COMPRESS_SOLID 1107
-#define IDC_STATIC_COMPRESS_THREADS 1108
-
-#define IDC_COMPRESS_ENCRYPTION 1110
-#define IDC_STATIC_COMPRESS_PASSWORD1 1111
-#define IDC_COMPRESS_EDIT_PASSWORD1 1112
-#define IDC_STATIC_COMPRESS_PASSWORD2 1113
-#define IDC_COMPRESS_EDIT_PASSWORD2 1114
-#define IDC_COMPRESS_CHECK_SHOW_PASSWORD 1115
-
-#define IDC_STATIC_COMPRESS_ENCRYPTION_METHOD 1120
-#define IDC_COMPRESS_COMBO_ENCRYPTION_METHOD 1121
-
-#define IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES 1122
-
-#define IDC_COMPRESS_SHARED 1130
-
-
-#define IDS_OPEN_TYPE_ALL_FILES 80
-
-#define IDS_METHOD_STORE 81
-#define IDS_METHOD_NORMAL 82
-#define IDS_METHOD_MAXIMUM 83
-#define IDS_METHOD_FAST 84
-#define IDS_METHOD_FASTEST 85
-#define IDS_METHOD_ULTRA 86
-
-#define IDS_COMPRESS_NON_SOLID 88
-#define IDS_COMPRESS_SOLID 89
-
-#define IDS_COMPRESS_UPDATE_MODE_ADD 90
-#define IDS_COMPRESS_UPDATE_MODE_UPDATE 91
-#define IDS_COMPRESS_UPDATE_MODE_FRESH 92
-#define IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE 93
-
-#define IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE 94
-
-#define IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE 96
-
-#define IDS_PASSWORD_USE_ASCII 110
-#define IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH 111
-#define IDS_PASSWORD_IS_TOO_LONG 112
-
-#define IDS_COMPRESS_INCORRECT_VOLUME_SIZE 95
+#define IDD_COMPRESS 4000
+#define IDD_COMPRESS_2 14000
+
+#define IDC_COMPRESS_ARCHIVE 100
+#define IDB_COMPRESS_SET_ARCHIVE 101
+#define IDC_COMPRESS_LEVEL 102
+#define IDC_COMPRESS_UPDATE_MODE 103
+#define IDC_COMPRESS_FORMAT 104
+#define IDC_COMPRESS_VOLUME 105
+#define IDC_COMPRESS_METHOD 106
+#define IDC_COMPRESS_DICTIONARY 107
+#define IDC_COMPRESS_ORDER 108
+#define IDC_COMPRESS_SOLID 109
+#define IDC_COMPRESS_THREADS 110
+#define IDE_COMPRESS_PARAMETERS 111
+
+#define IDT_COMPRESS_HARDWARE_THREADS 112
+#define IDT_COMPRESS_MEMORY_VALUE 113
+#define IDT_COMPRESS_MEMORY_DE_VALUE 114
+
+#define IDG_COMPRESS_NTFS 115
+#define IDC_COMPRESS_PATH_MODE 116
+
+#define IDE_COMPRESS_PASSWORD1 120
+#define IDE_COMPRESS_PASSWORD2 121
+#define IDC_COMPRESS_ENCRYPTION_METHOD 122
+
+#define IDT_COMPRESS_ARCHIVE_FOLDER 130
+
+#define IDT_COMPRESS_PATH_MODE 3410
+
+#define IDT_PASSWORD_ENTER 3801
+#define IDT_PASSWORD_REENTER 3802
+#define IDX_PASSWORD_SHOW 3803
+#define IDS_PASSWORD_NOT_MATCH 3804
+#define IDS_PASSWORD_USE_ASCII 3805
+#define IDS_PASSWORD_TOO_LONG 3806
+
+#define IDT_COMPRESS_ARCHIVE 4001
+#define IDT_COMPRESS_UPDATE_MODE 4002
+#define IDT_COMPRESS_FORMAT 4003
+#define IDT_COMPRESS_LEVEL 4004
+#define IDT_COMPRESS_METHOD 4005
+#define IDT_COMPRESS_DICTIONARY 4006
+#define IDT_COMPRESS_ORDER 4007
+#define IDT_COMPRESS_SOLID 4008
+#define IDT_COMPRESS_THREADS 4009
+#define IDT_COMPRESS_PARAMETERS 4010
+#define IDG_COMPRESS_OPTIONS 4011
+
+#define IDX_COMPRESS_SFX 4012
+#define IDX_COMPRESS_SHARED 4013
+
+#define IDG_COMPRESS_ENCRYPTION 4014
+#define IDT_COMPRESS_ENCRYPTION_METHOD 4015
+#define IDX_COMPRESS_ENCRYPT_FILE_NAMES 4016
+
+#define IDT_COMPRESS_MEMORY 4017
+#define IDT_COMPRESS_MEMORY_DE 4018
+
+#define IDX_COMPRESS_DEL 4019
+
+#define IDX_COMPRESS_NT_SYM_LINKS 4040
+#define IDX_COMPRESS_NT_HARD_LINKS 4041
+#define IDX_COMPRESS_NT_ALT_STREAMS 4042
+#define IDX_COMPRESS_NT_SECUR 4043
+
+#define IDS_METHOD_STORE 4050
+#define IDS_METHOD_FASTEST 4051
+#define IDS_METHOD_FAST 4052
+#define IDS_METHOD_NORMAL 4053
+#define IDS_METHOD_MAXIMUM 4054
+#define IDS_METHOD_ULTRA 4055
+
+#define IDS_COMPRESS_UPDATE_MODE_ADD 4060
+#define IDS_COMPRESS_UPDATE_MODE_UPDATE 4061
+#define IDS_COMPRESS_UPDATE_MODE_FRESH 4062
+#define IDS_COMPRESS_UPDATE_MODE_SYNC 4063
+
+#define IDS_COMPRESS_SET_ARCHIVE_BROWSE 4070
+#define IDS_OPEN_TYPE_ALL_FILES 4071
+#define IDS_COMPRESS_NON_SOLID 4072
+#define IDS_COMPRESS_SOLID 4073
+
+#define IDT_SPLIT_TO_VOLUMES 7302
+#define IDS_INCORRECT_VOLUME_SIZE 7307
+#define IDS_SPLIT_CONFIRM 7308
diff --git a/CPP/7zip/UI/GUI/Extract.rc b/CPP/7zip/UI/GUI/Extract.rc
index ad8f9910..defcfcc4 100755..100644
--- a/CPP/7zip/UI/GUI/Extract.rc
+++ b/CPP/7zip/UI/GUI/Extract.rc
@@ -4,30 +4,49 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
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."
- IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR "Data error in '{0}'. File is broken"
- IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC_ENCRYPTED "CRC failed in encrypted file '{0}'. Wrong password?"
- IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED "Data error in encrypted file '{0}'. Wrong password?"
- IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_UNSUPPORTED_METHOD "Unsupported compression method for '{0}'."
- IDS_EXTRACT_SET_FOLDER "Specify a location for extracted files."
- IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CANNOT_OPEN_FILE "Can not open output file '{0}'."
- 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_CANNOT_CREATE_FOLDER "Cannot create folder '{0}'"
+ IDS_UPDATE_NOT_SUPPORTED "Update operations are not supported for this archive."
+ 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_UNSUPPORTED_ARCHIVE_TYPE "Unsupported archive type"
- IDC_EXTRACT_RADIO_FULL_PATHNAMES "Full pathnames"
- IDC_EXTRACT_RADIO_CURRENT_PATHNAMES "Current pathnames"
- IDC_EXTRACT_RADIO_NO_PATHNAMES "No pathnames"
+ IDS_PROGRESS_EXTRACTING "Extracting"
+
+ IDS_EXTRACT_SET_FOLDER "Specify a location for extracted files."
+
+ IDS_EXTRACT_PATHS_FULL "Full pathnames"
+ IDS_EXTRACT_PATHS_NO "No pathnames"
+ IDS_EXTRACT_PATHS_ABS "Absolute pathnames"
+ IDS_PATH_MODE_RELAT "Relative pathnames"
+
+ IDS_EXTRACT_OVERWRITE_ASK "Ask before overwrite"
+ IDS_EXTRACT_OVERWRITE_WITHOUT_PROMPT "Overwrite without prompt"
+ IDS_EXTRACT_OVERWRITE_SKIP_EXISTING "Skip existing files"
+ IDS_EXTRACT_OVERWRITE_RENAME "Auto rename"
+ IDS_EXTRACT_OVERWRITE_RENAME_EXISTING "Auto rename existing files"
+
+ IDS_EXTRACT_MESSAGE_UNSUPPORTED_METHOD "Unsupported compression method for '{0}'."
+ IDS_EXTRACT_MESSAGE_DATA_ERROR "Data error in '{0}'. File is broken"
+ IDS_EXTRACT_MESSAGE_CRC_ERROR "CRC failed in '{0}'. File is broken."
+ IDS_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED "Data error in encrypted file '{0}'. Wrong password?"
+ IDS_EXTRACT_MESSAGE_CRC_ERROR_ENCRYPTED "CRC failed in encrypted file '{0}'. Wrong password?"
+
+ IDS_EXTRACT_MSG_WRONG_PSW "Wrong password?"
+ // IDS_EXTRACT_MSG_ENCRYPTED "Encrypted file"
+
+ IDS_EXTRACT_MSG_UNSUPPORTED_METHOD "Unsupported compression method"
+ IDS_EXTRACT_MSG_DATA_ERROR "Data error"
+ IDS_EXTRACT_MSG_CRC_ERROR "CRC failed"
+ IDS_EXTRACT_MSG_UNAVAILABLE_DATA "Unavailable data"
+ IDS_EXTRACT_MSG_UEXPECTED_END "Unexpected end of data";
+ IDS_EXTRACT_MSG_DATA_AFTER_END "There are some data after the end of the payload data"
+ IDS_EXTRACT_MSG_IS_NOT_ARC "Is not archive"
+ IDS_EXTRACT_MSG_HEADERS_ERROR "Headers Error"
- IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE "Ask before overwrite"
- IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT "Overwrite without prompt"
- IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES "Skip existing files"
- IDC_EXTRACT_RADIO_AUTO_RENAME "Auto rename"
- IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING "Auto rename existing files"
+ IDS_OPEN_MSG_UNAVAILABLE_START "Unavailable start of archive"
+ IDS_OPEN_MSG_UNCONFIRMED_START "Unconfirmed start of archive"
+ // IDS_OPEN_MSG_ERROR_FLAGS + 5 "Unexpected end of archive"
+ // IDS_OPEN_MSG_ERROR_FLAGS + 6 "There are data after the end of archive"
+ IDS_OPEN_MSG_UNSUPPORTED_FEATURE "Unsupported feature"
END
diff --git a/CPP/7zip/UI/GUI/ExtractDialog.cpp b/CPP/7zip/UI/GUI/ExtractDialog.cpp
index 64ae445e..d1ce8255 100755..100644
--- a/CPP/7zip/UI/GUI/ExtractDialog.cpp
+++ b/CPP/7zip/UI/GUI/ExtractDialog.cpp
@@ -2,28 +2,25 @@
#include "StdAfx.h"
-// #include <HtmlHelp.h>
+#include "../../../Common/StringConvert.h"
+#include "../../../Common/Wildcard.h"
-#include "ExtractDialog.h"
-
-#include "Common/StringConvert.h"
-
-#include "Windows/FileName.h"
-#include "Windows/FileDir.h"
-#include "Windows/ResourceString.h"
+#include "../../../Windows/FileName.h"
+#include "../../../Windows/FileDir.h"
+#include "../../../Windows/ResourceString.h"
#ifndef NO_REGISTRY
#include "../FileManager/HelpUtils.h"
#endif
-#include "../Common/ZipRegistry.h"
#include "../FileManager/BrowseDialog.h"
#include "../FileManager/LangUtils.h"
#include "../FileManager/resourceGui.h"
-#include "ExtractRes.h"
+#include "ExtractDialog.h"
#include "ExtractDialogRes.h"
+#include "ExtractRes.h"
using namespace NWindows;
using namespace NFile;
@@ -31,20 +28,20 @@ using namespace NName;
extern HINSTANCE g_hInstance;
-static CIDLangPair kPathMode_Pairs[] =
+static const UInt32 kPathMode_IDs[] =
{
- { IDC_EXTRACT_RADIO_FULL_PATHNAMES, 0x02000811 },
- // { IDC_EXTRACT_RADIO_CURRENT_PATHNAMES, 0x02000812 },
- { IDC_EXTRACT_RADIO_NO_PATHNAMES, 0x02000813 }
+ IDS_EXTRACT_PATHS_FULL,
+ IDS_EXTRACT_PATHS_NO,
+ IDS_EXTRACT_PATHS_ABS
};
-static CIDLangPair kOverwriteMode_Pairs[] =
+static const UInt32 kOverwriteMode_IDs[] =
{
- { IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE, 0x02000821 },
- { IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT, 0x02000822 },
- { IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES, 0x02000823 },
- { IDC_EXTRACT_RADIO_AUTO_RENAME, 0x02000824 },
- { IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING, 0x02000825 }
+ IDS_EXTRACT_OVERWRITE_ASK,
+ IDS_EXTRACT_OVERWRITE_WITHOUT_PROMPT,
+ IDS_EXTRACT_OVERWRITE_SKIP_EXISTING,
+ IDS_EXTRACT_OVERWRITE_RENAME,
+ IDS_EXTRACT_OVERWRITE_RENAME_EXISTING
};
#ifndef _SFX
@@ -54,18 +51,9 @@ static const
int
kPathModeButtonsVals[] =
{
- NExtract::NPathMode::kFullPathnames,
- // NExtract::NPathMode::kCurrentPathnames,
- NExtract::NPathMode::kNoPathnames
-};
-
-static const int kOverwriteButtons[] =
-{
- IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE,
- IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT,
- IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES,
- IDC_EXTRACT_RADIO_AUTO_RENAME,
- IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING,
+ NExtract::NPathMode::kFullPaths,
+ NExtract::NPathMode::kNoPaths,
+ NExtract::NPathMode::kAbsPaths
};
static const
@@ -73,68 +61,46 @@ static const
// NExtract::NOverwriteMode::EEnum
kOverwriteButtonsVals[] =
{
- NExtract::NOverwriteMode::kAskBefore,
- NExtract::NOverwriteMode::kWithoutPrompt,
- NExtract::NOverwriteMode::kSkipExisting,
- NExtract::NOverwriteMode::kAutoRename,
- NExtract::NOverwriteMode::kAutoRenameExisting
-};
-
-static const int kNumOverwriteButtons = sizeof(kOverwriteButtons) / sizeof(kOverwriteButtons[0]);
-
-/*
-static const int kFilesButtons[] =
-{
- IDC_EXTRACT_RADIO_SELECTED_FILES,
- IDC_EXTRACT_RADIO_ALL_FILES
+ NExtract::NOverwriteMode::kAsk,
+ NExtract::NOverwriteMode::kOverwrite,
+ NExtract::NOverwriteMode::kSkip,
+ NExtract::NOverwriteMode::kRename,
+ NExtract::NOverwriteMode::kRenameExisting
};
-static const int kNumFilesButtons = sizeof(kFilesButtons) / sizeof(kFilesButtons[0]);
-*/
-
-/*
-int CExtractDialog::GetFilesMode() const
-{
- for (int i = 0; i < kNumFilesButtons; i++)
- if (IsButtonCheckedBool(kFilesButtons[i]))
- return i;
- throw 0;
-}
-*/
#endif
#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDC_STATIC_EXTRACT_EXTRACT_TO, 0x02000801 },
- { IDC_EXTRACT_PATH_MODE, 0x02000810 },
- { IDC_EXTRACT_OVERWRITE_MODE, 0x02000820 },
- // { IDC_EXTRACT_FILES, 0x02000830 },
- // { IDC_EXTRACT_RADIO_SELECTED_FILES, 0x02000831 },
- // { IDC_EXTRACT_RADIO_ALL_FILES, 0x02000832 },
- { IDC_EXTRACT_PASSWORD, 0x02000802 },
- { IDC_EXTRACT_CHECK_SHOW_PASSWORD, 0x02000B02 },
- { IDOK, 0x02000702 },
- { IDCANCEL, 0x02000710 },
- { IDHELP, 0x02000720 }
+static const UInt32 kLangIDs[] =
+{
+ IDT_EXTRACT_EXTRACT_TO,
+ IDT_EXTRACT_PATH_MODE,
+ IDT_EXTRACT_OVERWRITE_MODE,
+ // IDX_EXTRACT_ALT_STREAMS,
+ IDX_EXTRACT_NT_SECUR,
+ IDX_EXTRACT_ELIM_DUP,
+ IDG_PASSWORD,
+ IDX_PASSWORD_SHOW
};
#endif
// static const int kWildcardsButtonIndex = 2;
#ifndef NO_REGISTRY
-static const int kHistorySize = 8;
+static const unsigned kHistorySize = 16;
#endif
#ifndef _SFX
-static void AddComboItems(NWindows::NControl::CComboBox &combo, const CIDLangPair *items, int numItems, const int *values, int curVal)
+
+// it's used in CompressDialog also
+void AddComboItems(NControl::CComboBox &combo, const UInt32 *langIDs, unsigned numItems, const int *values, int curVal)
{
int curSel = 0;
- for (int i = 0; i < numItems; i++)
+ for (unsigned i = 0; i < numItems; i++)
{
- UString s = LangString(items[i].ControlID, items[i].LangID);
- s.Replace(L"&", L"");
+ UString s = LangString(langIDs[i]);
+ s.RemoveChar(L'&');
int index = (int)combo.AddString(s);
combo.SetItemData(index, i);
if (values[i] == curVal)
@@ -142,45 +108,113 @@ static void AddComboItems(NWindows::NControl::CComboBox &combo, const CIDLangPai
}
combo.SetCurSel(curSel);
}
+
+// it's used in CompressDialog also
+bool GetBoolsVal(const CBoolPair &b1, const CBoolPair &b2)
+{
+ if (b1.Def) return b1.Val;
+ if (b2.Def) return b2.Val;
+ return b1.Val;
+}
+
+void CExtractDialog::CheckButton_TwoBools(UINT id, const CBoolPair &b1, const CBoolPair &b2)
+{
+ CheckButton(id, GetBoolsVal(b1, b2));
+}
+
+void CExtractDialog::GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2)
+{
+ bool val = IsButtonCheckedBool(id);
+ bool oldVal = GetBoolsVal(b1, b2);
+ if (val != oldVal)
+ b1.Def = b2.Def = true;
+ b1.Val = b2.Val = val;
+}
+
#endif
bool CExtractDialog::OnInit()
{
#ifdef LANG
- LangSetWindowText(HWND(*this), 0x02000800);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ {
+ UString s;
+ LangString_OnlyFromLangFile(IDD_EXTRACT, s);
+ if (s.IsEmpty())
+ GetText(s);
+ if (!ArcPath.IsEmpty())
+ {
+ s += L" : ";
+ s += ArcPath;
+ }
+ SetText(s);
+ // LangSetWindowText(*this, IDD_EXTRACT);
+ LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
+ }
#endif
+
#ifndef _SFX
- _passwordControl.Attach(GetItem(IDC_EXTRACT_EDIT_PASSWORD));
+ _passwordControl.Attach(GetItem(IDE_EXTRACT_PASSWORD));
_passwordControl.SetText(Password);
_passwordControl.SetPasswordChar(TEXT('*'));
+ _pathName.Attach(GetItem(IDE_EXTRACT_NAME));
#endif
- NExtract::CInfo info;
-
#ifdef NO_REGISTRY
- PathMode = NExtract::NPathMode::kFullPathnames;
- OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
- // info.Paths = NExtract::NPathMode::kFullPathnames;
+
+ PathMode = NExtract::NPathMode::kFullPaths;
+ OverwriteMode = NExtract::NOverwriteMode::kAsk;
+
#else
- info.Load();
- CheckButton(IDC_EXTRACT_CHECK_SHOW_PASSWORD, info.ShowPassword);
+
+ _info.Load();
+
+ if (_info.PathMode == NExtract::NPathMode::kCurPaths)
+ _info.PathMode = NExtract::NPathMode::kFullPaths;
+
+ if (!PathMode_Force && _info.PathMode_Force)
+ PathMode = _info.PathMode;
+ if (!OverwriteMode_Force && _info.OverwriteMode_Force)
+ OverwriteMode = _info.OverwriteMode;
+
+ // CheckButton_TwoBools(IDX_EXTRACT_ALT_STREAMS, AltStreams, _info.AltStreams);
+ CheckButton_TwoBools(IDX_EXTRACT_NT_SECUR, NtSecurity, _info.NtSecurity);
+ CheckButton_TwoBools(IDX_EXTRACT_ELIM_DUP, ElimDup, _info.ElimDup);
+
+ CheckButton(IDX_PASSWORD_SHOW, _info.ShowPassword.Val);
UpdatePasswordControl();
- PathMode = info.PathMode;
- OverwriteMode = info.OverwriteMode;
+
#endif
- _path.Attach(GetItem(IDC_EXTRACT_COMBO_PATH));
+ _path.Attach(GetItem(IDC_EXTRACT_PATH));
- _path.SetText(DirectoryPath);
+ UString pathPrefix = DirPath;
+
+ #ifndef _SFX
+ if (_info.SplitDest.Val)
+ {
+ CheckButton(IDX_EXTRACT_NAME_ENABLE, true);
+ UString pathName;
+ SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
+ if (pathPrefix.IsEmpty())
+ pathPrefix = pathName;
+ else
+ _pathName.SetText(pathName);
+ }
+ else
+ ShowItem_Bool(IDE_EXTRACT_NAME, false);
+
+ #endif
+
+ _path.SetText(pathPrefix);
+
#ifndef NO_REGISTRY
- for (int i = 0; i < info.Paths.Size() && i < kHistorySize; i++)
- _path.AddString(info.Paths[i]);
+ for (unsigned i = 0; i < _info.Paths.Size() && i < kHistorySize; i++)
+ _path.AddString(_info.Paths[i]);
#endif
/*
- if (info.Paths.Size() > 0)
+ if (_info.Paths.Size() > 0)
_path.SetCurSel(0);
else
_path.SetCurSel(-1);
@@ -188,22 +222,11 @@ bool CExtractDialog::OnInit()
#ifndef _SFX
- _pathMode.Attach(GetItem(IDC_EXTRACT_COMBO_PATH_MODE));
- AddComboItems(_pathMode, kPathMode_Pairs, sizeof(kPathMode_Pairs) / sizeof(kPathMode_Pairs[0]),
- kPathModeButtonsVals, PathMode);
-
- _overwriteMode.Attach(GetItem(IDC_EXTRACT_COMBO_OVERWRITE_MODE));
- AddComboItems(_overwriteMode, kOverwriteMode_Pairs, sizeof(kOverwriteMode_Pairs) / sizeof(kOverwriteMode_Pairs[0]),
- kOverwriteButtonsVals, OverwriteMode);
-
- /*
- CheckRadioButton(kFilesButtons[0], kFilesButtons[kNumFilesButtons - 1],
- kFilesButtons[_filesMode]);
- */
-
- // CWindow selectedFilesWindow = GetItem(IDC_EXTRACT_RADIO_SELECTED_FILES);
- // selectedFilesWindow.Enable(_enableSelectedFilesButton);
+ _pathMode.Attach(GetItem(IDC_EXTRACT_PATH_MODE));
+ _overwriteMode.Attach(GetItem(IDC_EXTRACT_OVERWRITE_MODE));
+ AddComboItems(_pathMode, kPathMode_IDs, ARRAY_SIZE(kPathMode_IDs), kPathModeButtonsVals, PathMode);
+ AddComboItems(_overwriteMode, kOverwriteMode_IDs, ARRAY_SIZE(kOverwriteMode_IDs), kOverwriteButtonsVals, OverwriteMode);
#endif
@@ -213,7 +236,6 @@ bool CExtractDialog::OnInit()
// CWindow filesWindow = GetItem(IDC_EXTRACT_RADIO_FILES);
// filesWindow.Enable(_enableFilesButton);
- // UpdateWildCardState();
NormalizePosition();
return CModalDialog::OnInit();
@@ -222,8 +244,7 @@ bool CExtractDialog::OnInit()
#ifndef _SFX
void CExtractDialog::UpdatePasswordControl()
{
- _passwordControl.SetPasswordChar((IsButtonChecked(
- IDC_EXTRACT_CHECK_SHOW_PASSWORD) == BST_CHECKED) ? 0: TEXT('*'));
+ _passwordControl.SetPasswordChar(IsShowPasswordChecked() ? 0 : TEXT('*'));
UString password;
_passwordControl.GetText(password);
_passwordControl.SetText(password);
@@ -232,21 +253,16 @@ void CExtractDialog::UpdatePasswordControl()
bool CExtractDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
- /*
- for (int i = 0; i < kNumFilesButtons; i++)
- if (buttonID == kFilesButtons[i])
- {
- UpdateWildCardState();
- return true;
- }
- */
switch(buttonID)
{
- case IDC_EXTRACT_BUTTON_SET_PATH:
+ case IDB_EXTRACT_SET_PATH:
OnButtonSetPath();
return true;
#ifndef _SFX
- case IDC_EXTRACT_CHECK_SHOW_PASSWORD:
+ case IDX_EXTRACT_NAME_ENABLE:
+ ShowItem_Bool(IDE_EXTRACT_NAME, IsButtonCheckedBool(IDX_EXTRACT_NAME_ENABLE));
+ return true;
+ case IDX_PASSWORD_SHOW:
{
UpdatePasswordControl();
return true;
@@ -260,9 +276,9 @@ void CExtractDialog::OnButtonSetPath()
{
UString currentPath;
_path.GetText(currentPath);
- UString title = LangStringSpec(IDS_EXTRACT_SET_FOLDER, 0x02000881);
+ UString title = LangString(IDS_EXTRACT_SET_FOLDER);
UString resultPath;
- if (!MyBrowseForFolder(HWND(*this), title, currentPath, resultPath))
+ if (!MyBrowseForFolder(*this, title, currentPath, resultPath))
return;
#ifndef NO_REGISTRY
_path.SetCurSel(-1);
@@ -272,8 +288,8 @@ void CExtractDialog::OnButtonSetPath()
void AddUniqueString(UStringVector &list, const UString &s)
{
- for (int i = 0; i < list.Size(); i++)
- if (s.CompareNoCase(list[i]) == 0)
+ FOR_VECTOR (i, list)
+ if (s.IsEqualToNoCase(list[i]))
return;
list.Add(s);
}
@@ -281,21 +297,53 @@ void AddUniqueString(UStringVector &list, const UString &s)
void CExtractDialog::OnOK()
{
#ifndef _SFX
- NExtract::NPathMode::EEnum pathMode2 = (NExtract::NPathMode::EEnum)kPathModeButtonsVals[_pathMode.GetItemData(_pathMode.GetCurSel())];
- if (PathMode != NExtract::NPathMode::kCurrentPathnames ||
- pathMode2 != NExtract::NPathMode::kFullPathnames)
- PathMode = pathMode2;
- OverwriteMode = (NExtract::NOverwriteMode::EEnum)kOverwriteButtonsVals[_overwriteMode.GetItemData(_overwriteMode.GetCurSel())];
+ int pathMode2 = kPathModeButtonsVals[_pathMode.GetCurSel()];
+ if (PathMode != NExtract::NPathMode::kCurPaths ||
+ pathMode2 != NExtract::NPathMode::kFullPaths)
+ PathMode = (NExtract::NPathMode::EEnum)pathMode2;
+
+ OverwriteMode = (NExtract::NOverwriteMode::EEnum)kOverwriteButtonsVals[_overwriteMode.GetCurSel()];
// _filesMode = (NExtractionDialog::NFilesMode::EEnum)GetFilesMode();
_passwordControl.GetText(Password);
+
#endif
- NExtract::CInfo info;
- info.PathMode = PathMode;
- info.OverwriteMode = OverwriteMode;
- info.ShowPassword = (IsButtonCheckedBool(IDC_EXTRACT_CHECK_SHOW_PASSWORD));
+ #ifndef NO_REGISTRY
+
+ // GetButton_Bools(IDX_EXTRACT_ALT_STREAMS, AltStreams, _info.AltStreams);
+ GetButton_Bools(IDX_EXTRACT_NT_SECUR, NtSecurity, _info.NtSecurity);
+ GetButton_Bools(IDX_EXTRACT_ELIM_DUP, ElimDup, _info.ElimDup);
+
+ bool showPassword = IsShowPasswordChecked();
+ if (showPassword != _info.ShowPassword.Val)
+ {
+ _info.ShowPassword.Def = true;
+ _info.ShowPassword.Val = showPassword;
+ }
+
+ if (_info.PathMode != pathMode2)
+ {
+ _info.PathMode_Force = true;
+ _info.PathMode = (NExtract::NPathMode::EEnum)pathMode2;
+ /*
+ // we allow kAbsPaths in registry.
+ if (_info.PathMode == NExtract::NPathMode::kAbsPaths)
+ _info.PathMode = NExtract::NPathMode::kFullPaths;
+ */
+ }
+
+ if (!OverwriteMode_Force && _info.OverwriteMode != OverwriteMode)
+ _info.OverwriteMode_Force = true;
+ _info.OverwriteMode = OverwriteMode;
+
+
+ #else
+
+ ElimDup.Val = IsButtonCheckedBool(IDX_EXTRACT_ELIM_DUP);
+
+ #endif
UString s;
@@ -318,33 +366,49 @@ void CExtractDialog::OnOK()
#endif
s.Trim();
+ NName::NormalizeDirPathPrefix(s);
+
+ #ifndef _SFX
+
+ bool splitDest = IsButtonCheckedBool(IDX_EXTRACT_NAME_ENABLE);
+ if (splitDest)
+ {
+ UString pathName;
+ _pathName.GetText(pathName);
+ pathName.Trim();
+ s += pathName;
+ NName::NormalizeDirPathPrefix(s);
+ }
+ if (splitDest != _info.SplitDest.Val)
+ {
+ _info.SplitDest.Def = true;
+ _info.SplitDest.Val = splitDest;
+ }
+
+ #endif
+
+ DirPath = s;
+
+ #ifndef NO_REGISTRY
+ _info.Paths.Clear();
#ifndef _SFX
- AddUniqueString(info.Paths, s);
+ AddUniqueString(_info.Paths, s);
#endif
- DirectoryPath = s;
- #ifndef NO_REGISTRY
for (int i = 0; i < _path.GetCount(); i++)
if (i != currentItem)
{
UString sTemp;
_path.GetLBText(i, sTemp);
sTemp.Trim();
- AddUniqueString(info.Paths, sTemp);
+ AddUniqueString(_info.Paths, sTemp);
}
- info.Save();
+ _info.Save();
#endif
+
CModalDialog::OnOK();
}
-/*
-void CExtractDialog::UpdateWildCardState()
-{
- // UpdateData(TRUE);
- // m_Wildcards.EnableWindow(BoolToBOOL(m_Files == kWildcardsButtonIndex));
-}
-*/
-
-#ifndef NO_REGISTRY
+#ifndef NO_REGISTRY
static LPCWSTR kHelpTopic = L"fm/plugins/7-zip/extract.htm";
void CExtractDialog::OnHelp()
{
diff --git a/CPP/7zip/UI/GUI/ExtractDialog.h b/CPP/7zip/UI/GUI/ExtractDialog.h
index b0636c72..33349ffc 100755..100644
--- a/CPP/7zip/UI/GUI/ExtractDialog.h
+++ b/CPP/7zip/UI/GUI/ExtractDialog.h
@@ -5,16 +5,17 @@
#include "ExtractDialogRes.h"
-#include "Windows/Control/Edit.h"
-#include "Windows/Control/ComboBox.h"
+#include "../../../Windows/Control/ComboBox.h"
+#include "../../../Windows/Control/Edit.h"
-#ifndef NO_REGISTRY
-#include "../Common/ZipRegistry.h"
-#endif
#include "../Common/ExtractMode.h"
#include "../FileManager/DialogSize.h"
+#ifndef NO_REGISTRY
+#include "../Common/ZipRegistry.h"
+#endif
+
namespace NExtractionDialog
{
/*
@@ -37,8 +38,9 @@ class CExtractDialog: public NWindows::NControl::CModalDialog
#else
NWindows::NControl::CComboBox _path;
#endif
-
+
#ifndef _SFX
+ NWindows::NControl::CEdit _pathName;
NWindows::NControl::CEdit _passwordControl;
NWindows::NControl::CComboBox _pathMode;
NWindows::NControl::CComboBox _overwriteMode;
@@ -51,24 +53,44 @@ class CExtractDialog: public NWindows::NControl::CModalDialog
void OnButtonSetPath();
+ void CheckButton_TwoBools(UINT id, const CBoolPair &b1, const CBoolPair &b2);
+ void GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2);
virtual bool OnInit();
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnOK();
- #ifndef NO_REGISTRY
+
+ #ifndef NO_REGISTRY
+
virtual void OnHelp();
+
+ NExtract::CInfo _info;
+
#endif
+
+ bool IsShowPasswordChecked() const { return IsButtonCheckedBool(IDX_PASSWORD_SHOW); }
public:
// bool _enableSelectedFilesButton;
// bool _enableFilesButton;
// NExtractionDialog::NFilesMode::EEnum FilesMode;
- UString DirectoryPath;
+ UString DirPath;
+ UString ArcPath;
+
#ifndef _SFX
UString Password;
#endif
+ bool PathMode_Force;
+ bool OverwriteMode_Force;
NExtract::NPathMode::EEnum PathMode;
NExtract::NOverwriteMode::EEnum OverwriteMode;
+ #ifndef _SFX
+ // CBoolPair AltStreams;
+ CBoolPair NtSecurity;
+ #endif
+
+ CBoolPair ElimDup;
+
INT_PTR Create(HWND aWndParent = 0)
{
#ifdef _SFX
@@ -76,8 +98,16 @@ public:
#else
BIG_DIALOG_SIZE(300, 160);
#endif
- return CModalDialog::Create(SIZED_DIALOG(IDD_DIALOG_EXTRACT), aWndParent);
+ return CModalDialog::Create(SIZED_DIALOG(IDD_EXTRACT), aWndParent);
}
+
+ CExtractDialog():
+ PathMode_Force(false),
+ OverwriteMode_Force(false)
+ {
+ ElimDup.Val = true;
+ }
+
};
#endif
diff --git a/CPP/7zip/UI/GUI/ExtractDialog.rc b/CPP/7zip/UI/GUI/ExtractDialog.rc
index ec4c20c2..3728b96d 100755..100644
--- a/CPP/7zip/UI/GUI/ExtractDialog.rc
+++ b/CPP/7zip/UI/GUI/ExtractDialog.rc
@@ -1,8 +1,8 @@
#include "ExtractDialogRes.h"
#include "../../GuiCommon.rc"
-#define xc 280
-#define yc 128
+#define xc 336
+#define yc 168
#undef g1xs
#undef g2x
@@ -10,9 +10,9 @@
#undef g2xs
#undef g2xs2
-#define g1xs 128
+#define g1xs 160
-#define gSpace 24
+#define gSpace 20
#define g2x (m + g1xs + gSpace)
#define g2x2 (g2x + m)
#define g2xs (xc - g1xs - gSpace)
@@ -25,26 +25,38 @@
#define GROUP_Y_SIZE 56
#endif
-IDD_DIALOG_EXTRACT MY_DIALOG
+IDD_EXTRACT DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "Extract"
BEGIN
- LTEXT "E&xtract to:", IDC_STATIC_EXTRACT_EXTRACT_TO, m, m, xc, 8
- COMBOBOX IDC_EXTRACT_COMBO_PATH, m, m + 12, xc - bxsDots - 12, 100, MY_COMBO_WITH_EDIT
- PUSHBUTTON "...", IDC_EXTRACT_BUTTON_SET_PATH, xs - m - bxsDots, m + 12 - 2, bxsDots, bys, WS_GROUP
+ LTEXT "E&xtract to:", IDT_EXTRACT_EXTRACT_TO, m, m, xc, 8
+ COMBOBOX IDC_EXTRACT_PATH, m, m + 12, xc - bxsDots - 12, 100, MY_COMBO_WITH_EDIT
+ PUSHBUTTON "...", IDB_EXTRACT_SET_PATH, xs - m - bxsDots, m + 12 - 2, bxsDots, bys, WS_GROUP
+
+ CONTROL "", IDX_EXTRACT_NAME_ENABLE, MY_CHECKBOX, m, m + 34, 12, 10
+ EDITTEXT IDE_EXTRACT_NAME, m + 12 + 2, m + 32, g1xs - 12 - 2, 14, ES_AUTOHSCROLL
+
+ LTEXT "Path mode:", IDT_EXTRACT_PATH_MODE, m, m + 52, g1xs, 8
+ COMBOBOX IDC_EXTRACT_PATH_MODE, m, m + 64, g1xs, 140, MY_COMBO
+
+ CONTROL "Eliminate duplication of root folder", IDX_EXTRACT_ELIM_DUP, MY_CHECKBOX,
+ m, m + 84, g1xs, 10
+
+ LTEXT "Overwrite mode:", IDT_EXTRACT_OVERWRITE_MODE, m, m + 104, g1xs, 8
+ COMBOBOX IDC_EXTRACT_OVERWRITE_MODE, m, m + 116, g1xs, 140, MY_COMBO
- LTEXT "Path mode:", IDC_EXTRACT_PATH_MODE, m, m + 36, g1xs, 8
- COMBOBOX IDC_EXTRACT_COMBO_PATH_MODE, m, m + 48, g1xs, 140, MY_COMBO
- LTEXT "Overwrite mode:", IDC_EXTRACT_OVERWRITE_MODE, m, m + 68, g1xs, 8
- COMBOBOX IDC_EXTRACT_COMBO_OVERWRITE_MODE, m, m + 80, g1xs, 140, MY_COMBO
+ GROUPBOX "Password", IDG_PASSWORD, g2x, m + 36, g2xs, GROUP_Y_SIZE
+ EDITTEXT IDE_EXTRACT_PASSWORD, g2x2, m + 50, g2xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX, g2x2, m + 72, g2xs2, 10
- GROUPBOX "Password", IDC_EXTRACT_PASSWORD, g2x, m + 36, g2xs, GROUP_Y_SIZE
- EDITTEXT IDC_EXTRACT_EDIT_PASSWORD, g2x2, m + 50, g2xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
- CONTROL "Show Password", IDC_EXTRACT_CHECK_SHOW_PASSWORD, MY_CHECKBOX, g2x2, m + 72, g2xs2, 10
+// CONTROL "Restore alternate data streams", IDX_EXTRACT_ALT_STREAMS, MY_CHECKBOX,
+// g2x, m + 104, g2xs, 10
+ CONTROL "Restore file security", IDX_EXTRACT_NT_SECUR, MY_CHECKBOX,
+ g2x, m + 104, g2xs, 10
- DEFPUSHBUTTON "OK", IDOK, bx3, by, bxs, bys, WS_GROUP
+ DEFPUSHBUTTON "OK", IDOK, bx3, by, bxs, bys, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, bx2, by, bxs, bys
- PUSHBUTTON "Help", IDHELP, bx1, by, bxs, bys
+ PUSHBUTTON "Help", IDHELP, bx1, by, bxs, bys
END
@@ -63,22 +75,22 @@ END
#define g1xs 64
-IDD_DIALOG_EXTRACT_2 MY_DIALOG
+IDD_EXTRACT_2 DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "Extract"
BEGIN
- LTEXT "E&xtract to:", IDC_STATIC_EXTRACT_EXTRACT_TO, m, m, xc - bxsDots - 8, 8
- COMBOBOX IDC_EXTRACT_COMBO_PATH, m, m + 12, xc - bxsDots - 8, 100, MY_COMBO_WITH_EDIT
- PUSHBUTTON "...", IDC_EXTRACT_BUTTON_SET_PATH, xs - m - bxsDots, m + 12 - 3, bxsDots, bys, WS_GROUP
+ LTEXT "E&xtract to:", IDT_EXTRACT_EXTRACT_TO, m, m, xc - bxsDots - 8, 8
+ COMBOBOX IDC_EXTRACT_PATH, m, m + 12, xc - bxsDots - 8, 100, MY_COMBO_WITH_EDIT
+ PUSHBUTTON "...", IDB_EXTRACT_SET_PATH, xs - m - bxsDots, m + 12 - 3, bxsDots, bys, WS_GROUP
- LTEXT "Path mode:", IDC_EXTRACT_PATH_MODE, m, m + 36, g1xs, 8
- COMBOBOX IDC_EXTRACT_COMBO_PATH_MODE, m + g1xs, m + 36, xc - g1xs, 100, MY_COMBO
+ LTEXT "Path mode:", IDT_EXTRACT_PATH_MODE, m, m + 36, g1xs, 8
+ COMBOBOX IDC_EXTRACT_PATH_MODE, m + g1xs, m + 36, xc - g1xs, 100, MY_COMBO
- LTEXT "Overwrite mode:", IDC_EXTRACT_OVERWRITE_MODE, m, m + 56, g1xs, 8
- COMBOBOX IDC_EXTRACT_COMBO_OVERWRITE_MODE, m + g1xs, m + 56, xc - g1xs, 100, MY_COMBO
+ LTEXT "Overwrite mode:", IDT_EXTRACT_OVERWRITE_MODE, m, m + 56, g1xs, 8
+ COMBOBOX IDC_EXTRACT_OVERWRITE_MODE, m + g1xs, m + 56, xc - g1xs, 100, MY_COMBO
- LTEXT "Password", IDC_EXTRACT_PASSWORD, m, m + 76, g1xs, 8
- EDITTEXT IDC_EXTRACT_EDIT_PASSWORD, m + g1xs, m + 76, xc - g1xs, 14, ES_PASSWORD | ES_AUTOHSCROLL
- CONTROL "Show Password", IDC_EXTRACT_CHECK_SHOW_PASSWORD, MY_CHECKBOX, m, m + 92, xc, 10
+ LTEXT "Password", IDG_PASSWORD, m, m + 76, g1xs, 8
+ EDITTEXT IDE_EXTRACT_PASSWORD, m + g1xs, m + 76, xc - g1xs, 14, ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX, m, m + 92, xc, 10
OK_CANCEL
END
diff --git a/CPP/7zip/UI/GUI/ExtractDialogRes.h b/CPP/7zip/UI/GUI/ExtractDialogRes.h
index 38652b29..403a6546 100755..100644
--- a/CPP/7zip/UI/GUI/ExtractDialogRes.h
+++ b/CPP/7zip/UI/GUI/ExtractDialogRes.h
@@ -1,19 +1,24 @@
-#define IDD_DIALOG_EXTRACT 552
-#define IDD_DIALOG_EXTRACT_2 652
+#define IDD_EXTRACT 3400
+#define IDD_EXTRACT_2 13400
-#define IDC_STATIC_EXTRACT_EXTRACT_TO 1020
-#define IDC_EXTRACT_COMBO_PATH 1021
-#define IDC_EXTRACT_BUTTON_SET_PATH 1022
+#define IDC_EXTRACT_PATH 100
+#define IDB_EXTRACT_SET_PATH 101
+#define IDC_EXTRACT_PATH_MODE 102
+#define IDC_EXTRACT_OVERWRITE_MODE 103
-#define IDC_EXTRACT_COMBO_PATH_MODE 1030
-#define IDC_EXTRACT_COMBO_OVERWRITE_MODE 1031
+#define IDE_EXTRACT_PASSWORD 120
-#define IDC_EXTRACT_PATH_MODE 1040
-#define IDC_EXTRACT_OVERWRITE_MODE 1050
+#define IDE_EXTRACT_NAME 130
+#define IDX_EXTRACT_NAME_ENABLE 131
-#define IDC_EXTRACT_FILES 1060
-#define IDC_EXTRACT_PASSWORD 1100
-#define IDC_EXTRACT_EDIT_PASSWORD 1101
-#define IDC_EXTRACT_CHECK_SHOW_PASSWORD 1102
+#define IDT_EXTRACT_EXTRACT_TO 3401
+#define IDT_EXTRACT_PATH_MODE 3410
+#define IDT_EXTRACT_OVERWRITE_MODE 3420
+#define IDX_EXTRACT_ELIM_DUP 3430
+#define IDX_EXTRACT_NT_SECUR 3431
+// #define IDX_EXTRACT_ALT_STREAMS 3432
+
+#define IDX_PASSWORD_SHOW 3803
+#define IDG_PASSWORD 3807
diff --git a/CPP/7zip/UI/GUI/ExtractGUI.cpp b/CPP/7zip/UI/GUI/ExtractGUI.cpp
index 9d39bffd..b5fbeaec 100755..100644
--- a/CPP/7zip/UI/GUI/ExtractGUI.cpp
+++ b/CPP/7zip/UI/GUI/ExtractGUI.cpp
@@ -2,19 +2,19 @@
#include "StdAfx.h"
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
+#include "../../../Common/IntToString.h"
+#include "../../../Common/StringConvert.h"
-#include "Windows/Error.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/FileName.h"
-#include "Windows/Thread.h"
+#include "../../../Windows/FileDir.h"
+#include "../../../Windows/FileFind.h"
+#include "../../../Windows/FileName.h"
+#include "../../../Windows/Thread.h"
#include "../FileManager/ExtractCallback.h"
#include "../FileManager/FormatUtils.h"
#include "../FileManager/LangUtils.h"
#include "../FileManager/resourceGui.h"
+#include "../FileManager/OverwriteDialogRes.h"
#include "../Common/ArchiveExtractCallback.h"
#include "../Common/PropIDUtils.h"
@@ -26,34 +26,45 @@
#include "ExtractDialog.h"
#include "ExtractGUI.h"
+#include "HashGUI.h"
+
+#include "../FileManager/PropertyNameRes.h"
using namespace NWindows;
+using namespace NFile;
+using namespace NDir;
static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
#ifndef _SFX
-static void AddValuePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
+static void AddValuePair(UString &s, UINT resourceID, UInt64 value, bool addColon = true)
{
wchar_t sz[32];
- s += LangString(resourceID, langID);
+ s += LangString(resourceID);
+ if (addColon)
+ s += L':';
s += L' ';
ConvertUInt64ToString(value, sz);
s += sz;
s += L'\n';
}
-static void AddSizePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
+static void AddSizePair(UString &s, UINT resourceID, UInt64 value)
{
wchar_t sz[32];
- s += LangString(resourceID, langID);
- s += L' ';
+ s += LangString(resourceID);
+ s += L": ";
ConvertUInt64ToString(value, sz);
- s += sz;
- ConvertUInt64ToString(value >> 20, sz);
- s += L" (";
- s += sz;
- s += L" MB)";
+ s += MyFormatNew(IDS_FILE_SIZE, sz);
+ // s += sz;
+ if (value >= (1 << 20))
+ {
+ ConvertUInt64ToString(value >> 20, sz);
+ s += L" (";
+ s += sz;
+ s += L" MB)";
+ }
s += L'\n';
}
@@ -65,12 +76,16 @@ class CThreadExtracting: public CProgressThreadVirt
public:
CCodecs *codecs;
CExtractCallbackImp *ExtractCallbackSpec;
- CIntVector FormatIndices;
+ const CObjectVector<COpenType> *FormatIndices;
+ const CIntVector *ExcludedFormatIndices;
UStringVector *ArchivePaths;
UStringVector *ArchivePathsFull;
const NWildcard::CCensorNode *WildcardCensor;
const CExtractOptions *Options;
+ #ifndef _SFX
+ CHashBundle *HashBundle;
+ #endif
CMyComPtr<IExtractCallbackUI> ExtractCallback;
UString Title;
};
@@ -78,32 +93,52 @@ public:
HRESULT CThreadExtracting::ProcessVirt()
{
CDecompressStat Stat;
- HRESULT res = DecompressArchives(codecs, FormatIndices, *ArchivePaths, *ArchivePathsFull,
- *WildcardCensor, *Options, ExtractCallbackSpec, ExtractCallback, ErrorMessage, Stat);
#ifndef _SFX
- if (Options->TestMode && ExtractCallbackSpec->IsOK())
+ if (HashBundle)
+ HashBundle->Init();
+ #endif
+
+ HRESULT res = Extract(codecs,
+ *FormatIndices, *ExcludedFormatIndices,
+ *ArchivePaths, *ArchivePathsFull,
+ *WildcardCensor, *Options, ExtractCallbackSpec, ExtractCallback,
+ #ifndef _SFX
+ HashBundle,
+ #endif
+ FinalMessage.ErrorMessage.Message, Stat);
+ #ifndef _SFX
+ if (res == S_OK && Options->TestMode && ExtractCallbackSpec->IsOK())
{
UString s;
- AddValuePair(IDS_ARCHIVES_COLON, 0x02000324, Stat.NumArchives, s);
- AddValuePair(IDS_FOLDERS_COLON, 0x02000321, Stat.NumFolders, s);
- AddValuePair(IDS_FILES_COLON, 0x02000320, Stat.NumFiles, s);
- AddSizePair(IDS_SIZE_COLON, 0x02000322, Stat.UnpackSize, s);
- AddSizePair(IDS_COMPRESSED_COLON, 0x02000323, Stat.PackSize, s);
- if (Options->CalcCrc)
+ AddValuePair(s, IDS_ARCHIVES_COLON, Stat.NumArchives, false);
+ AddSizePair(s, IDS_PROP_PACKED_SIZE, Stat.PackSize);
+
+ if (!HashBundle)
+ {
+ if (Stat.NumFolders != 0)
+ AddValuePair(s, IDS_PROP_FOLDERS, Stat.NumFolders);
+ AddValuePair(s, IDS_PROP_FILES, Stat.NumFiles);
+ AddSizePair(s, IDS_PROP_SIZE, Stat.UnpackSize);
+ if (Stat.NumAltStreams != 0)
+ {
+ s += L'\n';
+ AddValuePair(s, IDS_PROP_NUM_ALT_STREAMS, Stat.NumAltStreams);
+ AddSizePair(s, IDS_PROP_ALT_STREAMS_SIZE, Stat.AltStreams_UnpackSize);
+ }
+ }
+
+ if (HashBundle)
{
- wchar_t temp[16];
- ConvertUInt32ToHex(Stat.CrcSum, temp);
- s += L"CRC: ";
- s += temp;
s += L'\n';
+ AddHashBundleRes(s, *HashBundle, UString());
}
s += L'\n';
- s += LangString(IDS_MESSAGE_NO_ERRORS, 0x02000608);
+ s += LangString(IDS_MESSAGE_NO_ERRORS);
- OkMessageTitle = Title;
- OkMessage = s;
+ FinalMessage.OkMessage.Title = Title;
+ FinalMessage.OkMessage.Message = s;
}
#endif
return res;
@@ -111,11 +146,15 @@ HRESULT CThreadExtracting::ProcessVirt()
HRESULT ExtractGUI(
CCodecs *codecs,
- const CIntVector &formatIndices,
+ const CObjectVector<COpenType> &formatIndices,
+ const CIntVector &excludedFormatIndices,
UStringVector &archivePaths,
UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
CExtractOptions &options,
+ #ifndef _SFX
+ CHashBundle *hb,
+ #endif
bool showDialog,
bool &messageWasDisplayed,
CExtractCallbackImp *extractCallback,
@@ -125,51 +164,72 @@ HRESULT ExtractGUI(
CThreadExtracting extracter;
extracter.codecs = codecs;
- extracter.FormatIndices = formatIndices;
+ extracter.FormatIndices = &formatIndices;
+ extracter.ExcludedFormatIndices = &excludedFormatIndices;
if (!options.TestMode)
{
FString outputDir = options.OutputDir;
#ifndef UNDER_CE
if (outputDir.IsEmpty())
- NFile::NDirectory::MyGetCurrentDirectory(outputDir);
+ GetCurrentDir(outputDir);
#endif
if (showDialog)
{
CExtractDialog dialog;
FString outputDirFull;
- if (!NFile::NDirectory::MyGetFullPathName(outputDir, outputDirFull))
+ if (!MyGetFullPathName(outputDir, outputDirFull))
{
ShowErrorMessage(kIncorrectOutDir);
messageWasDisplayed = true;
return E_FAIL;
}
- NFile::NName::NormalizeDirPathPrefix(outputDirFull);
- dialog.DirectoryPath = fs2us(outputDirFull);
+ NName::NormalizeDirPathPrefix(outputDirFull);
+
+ dialog.DirPath = fs2us(outputDirFull);
+
+ dialog.OverwriteMode = options.OverwriteMode;
+ dialog.OverwriteMode_Force = options.OverwriteMode_Force;
+ dialog.PathMode = options.PathMode;
+ dialog.PathMode_Force = options.PathMode_Force;
+ dialog.ElimDup = options.ElimDup;
- // dialog.OverwriteMode = options.OverwriteMode;
- // dialog.PathMode = options.PathMode;
+ if (archivePathsFull.Size() == 1)
+ dialog.ArcPath = archivePathsFull[0];
+
+ #ifndef _SFX
+ // dialog.AltStreams = options.NtOptions.AltStreams;
+ dialog.NtSecurity = options.NtOptions.NtSecurity;
+ if (extractCallback->PasswordIsDefined)
+ dialog.Password = extractCallback->Password;
+ #endif
if (dialog.Create(hwndParent) != IDOK)
return E_ABORT;
- outputDir = us2fs(dialog.DirectoryPath);
+
+ outputDir = us2fs(dialog.DirPath);
+
options.OverwriteMode = dialog.OverwriteMode;
options.PathMode = dialog.PathMode;
+ options.ElimDup = dialog.ElimDup;
+
#ifndef _SFX
+ // options.NtOptions.AltStreams = dialog.AltStreams;
+ options.NtOptions.NtSecurity = dialog.NtSecurity;
extractCallback->Password = dialog.Password;
extractCallback->PasswordIsDefined = !dialog.Password.IsEmpty();
#endif
}
- if (!NFile::NDirectory::MyGetFullPathName(outputDir, options.OutputDir))
+ if (!MyGetFullPathName(outputDir, options.OutputDir))
{
ShowErrorMessage(kIncorrectOutDir);
messageWasDisplayed = true;
return E_FAIL;
}
- NFile::NName::NormalizeDirPathPrefix(options.OutputDir);
+ NName::NormalizeDirPathPrefix(options.OutputDir);
/*
- if(!NFile::NDirectory::CreateComplexDirectory(options.OutputDir))
+ if(!CreateComplexDirectory(options.OutputDir))
{
UString s = GetUnicodeString(NError::MyFormatMessage(GetLastError()));
UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
@@ -183,8 +243,7 @@ HRESULT ExtractGUI(
*/
}
- UString title = LangStringSpec(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING,
- options.TestMode ? 0x02000F90: 0x02000890);
+ UString title = LangString(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING);
extracter.Title = title;
extracter.ExtractCallbackSpec = extractCallback;
@@ -198,6 +257,9 @@ HRESULT ExtractGUI(
extracter.ArchivePathsFull = &archivePathsFull;
extracter.WildcardCensor = &wildcardCensor;
extracter.Options = &options;
+ #ifndef _SFX
+ extracter.HashBundle = hb;
+ #endif
extracter.ProgressDialog.IconID = IDI_ICON;
diff --git a/CPP/7zip/UI/GUI/ExtractGUI.h b/CPP/7zip/UI/GUI/ExtractGUI.h
index b0a692f0..d55b30de 100755..100644
--- a/CPP/7zip/UI/GUI/ExtractGUI.h
+++ b/CPP/7zip/UI/GUI/ExtractGUI.h
@@ -21,11 +21,15 @@
HRESULT ExtractGUI(
CCodecs *codecs,
- const CIntVector &formatIndices,
+ const CObjectVector<COpenType> &formatIndices,
+ const CIntVector &excludedFormatIndices,
UStringVector &archivePaths,
UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
CExtractOptions &options,
+ #ifndef _SFX
+ CHashBundle *hb,
+ #endif
bool showDialog,
bool &messageWasDisplayed,
CExtractCallbackImp *extractCallback,
diff --git a/CPP/7zip/UI/GUI/ExtractRes.h b/CPP/7zip/UI/GUI/ExtractRes.h
index 6219edda..48738bbb 100755..100644
--- a/CPP/7zip/UI/GUI/ExtractRes.h
+++ b/CPP/7zip/UI/GUI/ExtractRes.h
@@ -1,29 +1,44 @@
-#define IDS_UPDATE_NOT_SUPPORTED 199
-#define IDS_CANNOT_CREATE_FOLDER 200
-#define IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE 201
-
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC 202
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR 203
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_UNSUPPORTED_METHOD 204
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC_ENCRYPTED 205
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED 206
-
-#define IDS_EXTRACT_SET_FOLDER 207
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CANNOT_OPEN_FILE 208
-#define IDS_PROGRESS_EXTRACTING 209
-
-#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
-
-#define IDC_EXTRACT_RADIO_FULL_PATHNAMES 1041
-#define IDC_EXTRACT_RADIO_CURRENT_PATHNAMES 1042
-#define IDC_EXTRACT_RADIO_NO_PATHNAMES 1043
-
-#define IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE 1051
-#define IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT 1052
-#define IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES 1053
-#define IDC_EXTRACT_RADIO_AUTO_RENAME 1056
-#define IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING 1057
+#define IDS_MEM_ERROR 3000
+
+#define IDS_CANNOT_CREATE_FOLDER 3003
+#define IDS_UPDATE_NOT_SUPPORTED 3004
+#define IDS_CANT_OPEN_ARCHIVE 3005
+#define IDS_CANT_OPEN_ENCRYPTED_ARCHIVE 3006
+#define IDS_UNSUPPORTED_ARCHIVE_TYPE 3007
+
+#define IDS_PROGRESS_EXTRACTING 3300
+
+#define IDS_EXTRACT_SET_FOLDER 3402
+
+#define IDS_EXTRACT_PATHS_FULL 3411
+#define IDS_EXTRACT_PATHS_NO 3412
+#define IDS_EXTRACT_PATHS_ABS 3413
+#define IDS_PATH_MODE_RELAT 3414
+
+#define IDS_EXTRACT_OVERWRITE_ASK 3421
+#define IDS_EXTRACT_OVERWRITE_WITHOUT_PROMPT 3422
+#define IDS_EXTRACT_OVERWRITE_SKIP_EXISTING 3423
+#define IDS_EXTRACT_OVERWRITE_RENAME 3424
+#define IDS_EXTRACT_OVERWRITE_RENAME_EXISTING 3425
+
+#define IDS_EXTRACT_MESSAGE_UNSUPPORTED_METHOD 3700
+#define IDS_EXTRACT_MESSAGE_DATA_ERROR 3701
+#define IDS_EXTRACT_MESSAGE_CRC_ERROR 3702
+#define IDS_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED 3703
+#define IDS_EXTRACT_MESSAGE_CRC_ERROR_ENCRYPTED 3704
+
+#define IDS_EXTRACT_MSG_WRONG_PSW 3710
+// #define IDS_EXTRACT_MSG_ENCRYPTED 3711
+
+#define IDS_EXTRACT_MSG_UNSUPPORTED_METHOD 3721
+#define IDS_EXTRACT_MSG_DATA_ERROR 3722
+#define IDS_EXTRACT_MSG_CRC_ERROR 3723
+#define IDS_EXTRACT_MSG_UNAVAILABLE_DATA 3724
+#define IDS_EXTRACT_MSG_UEXPECTED_END 3725
+#define IDS_EXTRACT_MSG_DATA_AFTER_END 3726
+#define IDS_EXTRACT_MSG_IS_NOT_ARC 3727
+#define IDS_EXTRACT_MSG_HEADERS_ERROR 3728
+
+#define IDS_OPEN_MSG_UNAVAILABLE_START 3763
+#define IDS_OPEN_MSG_UNCONFIRMED_START 3764
+#define IDS_OPEN_MSG_UNSUPPORTED_FEATURE 3768
diff --git a/CPP/7zip/UI/GUI/FM.ico b/CPP/7zip/UI/GUI/FM.ico
index 3a0a34da..3a0a34da 100755..100644
--- a/CPP/7zip/UI/GUI/FM.ico
+++ b/CPP/7zip/UI/GUI/FM.ico
Binary files differ
diff --git a/CPP/7zip/UI/GUI/GUI.cpp b/CPP/7zip/UI/GUI/GUI.cpp
index 5b809a63..592f7673 100755..100644
--- a/CPP/7zip/UI/GUI/GUI.cpp
+++ b/CPP/7zip/UI/GUI/GUI.cpp
@@ -2,18 +2,19 @@
#include "StdAfx.h"
-#include "Common/MyInitGuid.h"
-
#include "../../../../C/Alloc.h"
-#include "Common/CommandLineParser.h"
-#include "Common/MyException.h"
-#include "Common/StringConvert.h"
+#include "../../../Common/MyInitGuid.h"
+
+#include "../../../Common/CommandLineParser.h"
+#include "../../../Common/IntToString.h"
+#include "../../../Common/MyException.h"
+#include "../../../Common/StringConvert.h"
-#include "Windows/Error.h"
-#include "Windows/NtCheck.h"
+#include "../../../Windows/FileDir.h"
+#include "../../../Windows/NtCheck.h"
#ifdef _WIN32
-#include "Windows/MemoryLock.h"
+#include "../../../Windows/MemoryLock.h"
#endif
#include "../Common/ArchiveCommandLine.h"
@@ -24,6 +25,7 @@
#include "BenchmarkDialog.h"
#include "ExtractGUI.h"
+#include "HashGUI.h"
#include "UpdateGUI.h"
#include "ExtractRes.h"
@@ -34,25 +36,50 @@ HINSTANCE g_hInstance;
#ifndef _UNICODE
#endif
-#ifdef UNDER_CE
-bool g_LVN_ITEMACTIVATE_Support = true;
+#ifndef UNDER_CE
+
+DWORD g_ComCtl32Version;
+
+static DWORD GetDllVersion(LPCTSTR dllName)
+{
+ DWORD dwVersion = 0;
+ HINSTANCE hinstDll = LoadLibrary(dllName);
+ if (hinstDll)
+ {
+ DLLGETVERSIONPROC pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hinstDll, "DllGetVersion");
+ if (pDllGetVersion)
+ {
+ DLLVERSIONINFO dvi;
+ ZeroMemory(&dvi, sizeof(dvi));
+ dvi.cbSize = sizeof(dvi);
+ HRESULT hr = (*pDllGetVersion)(&dvi);
+ if (SUCCEEDED(hr))
+ dwVersion = MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion);
+ }
+ FreeLibrary(hinstDll);
+ }
+ return dwVersion;
+}
+
#endif
+bool g_LVN_ITEMACTIVATE_Support = true;
+
static void ErrorMessage(LPCWSTR message)
{
MessageBoxW(NULL, message, L"7-Zip", MB_ICONERROR | MB_OK);
}
-static void ErrorLangMessage(UINT resourceID, UInt32 langID)
+static void ErrorLangMessage(UINT resourceID)
{
- ErrorMessage(LangString(resourceID, langID));
+ ErrorMessage(LangString(resourceID));
}
static const char *kNoFormats = "7-Zip cannot find the code that works with archives.";
static int ShowMemErrorMessage()
{
- ErrorLangMessage(IDS_MEM_ERROR, 0x0200060B);
+ ErrorLangMessage(IDS_MEM_ERROR);
return NExitCode::kMemoryError;
}
@@ -64,6 +91,12 @@ static int ShowSysErrorMessage(DWORD errorCode)
return NExitCode::kFatalError;
}
+static void ThrowException_if_Error(HRESULT res)
+{
+ if (res != S_OK)
+ throw CSystemException(res);
+}
+
static int Main2()
{
UStringVector commandStrings;
@@ -79,52 +112,79 @@ static int Main2()
return 0;
}
- CArchiveCommandLineOptions options;
- CArchiveCommandLineParser parser;
+ CArcCmdLineOptions options;
+ CArcCmdLineParser parser;
parser.Parse1(commandStrings, options);
parser.Parse2(options);
- #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
+ #if defined(_WIN32) && !defined(UNDER_CE)
+ NSecurity::EnablePrivilege_SymLink();
+ #ifdef _7ZIP_LARGE_PAGES
if (options.LargePages)
- NSecurity::EnableLockMemoryPrivilege();
+ NSecurity::EnablePrivilege_LockMemory();
+ #endif
#endif
CCodecs *codecs = new CCodecs;
+ #ifdef EXTERNAL_CODECS
+ CExternalCodecs __externalCodecs;
+ __externalCodecs.GetCodecs = codecs;
+ __externalCodecs.GetHashers = codecs;
+ #else
CMyComPtr<IUnknown> compressCodecsInfo = codecs;
- HRESULT result = codecs->Load();
- if (result != S_OK)
- throw CSystemException(result);
+ #endif
+ codecs->CaseSensitiveChange = options.CaseSensitiveChange;
+ codecs->CaseSensitive = options.CaseSensitive;
+ ThrowException_if_Error(codecs->Load());
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
+
if (codecs->Formats.Size() == 0 &&
- (isExtractGroupCommand ||
- options.Command.IsFromUpdateGroup()))
+ (isExtractGroupCommand
+
+ || options.Command.IsFromUpdateGroup()))
throw kNoFormats;
- CIntVector formatIndices;
- if (!codecs->FindFormatForArchiveType(options.ArcType, formatIndices))
+ CObjectVector<COpenType> formatIndices;
+ if (!ParseOpenTypes(*codecs, options.ArcType, formatIndices))
{
- ErrorLangMessage(IDS_UNSUPPORTED_ARCHIVE_TYPE, 0x0200060D);
+ ErrorLangMessage(IDS_UNSUPPORTED_ARCHIVE_TYPE);
return NExitCode::kFatalError;
}
-
+
+ CIntVector excludedFormatIndices;
+ FOR_VECTOR (k, options.ExcludedArcTypes)
+ {
+ CIntVector tempIndices;
+ if (!codecs->FindFormatForArchiveType(options.ExcludedArcTypes[k], tempIndices)
+ || tempIndices.Size() != 1)
+ {
+ ErrorLangMessage(IDS_UNSUPPORTED_ARCHIVE_TYPE);
+ return NExitCode::kFatalError;
+ }
+ excludedFormatIndices.AddToUniqueSorted(tempIndices[0]);
+ // excludedFormatIndices.Sort();
+ }
+
+ #ifdef EXTERNAL_CODECS
+ if (isExtractGroupCommand
+ || options.Command.CommandType == NCommandType::kHash
+ || options.Command.CommandType == NCommandType::kBenchmark)
+ ThrowException_if_Error(__externalCodecs.LoadCodecs());
+ #endif
+
if (options.Command.CommandType == NCommandType::kBenchmark)
{
- HRESULT res;
- #ifdef EXTERNAL_CODECS
- CObjectVector<CCodecInfoEx> externalCodecs;
- res = LoadExternalCodecs(codecs, externalCodecs);
- if (res != S_OK)
- throw CSystemException(res);
- #endif
- res = Benchmark(
- #ifdef EXTERNAL_CODECS
- codecs, &externalCodecs,
- #endif
- options.Properties);
- if (res != S_OK)
- throw CSystemException(res);
+ HRESULT res = Benchmark(EXTERNAL_CODECS_VARS options.Properties);
+ /*
+ if (res == S_FALSE)
+ {
+ stdStream << "\nDecoding Error\n";
+ return NExitCode::kFatalError;
+ }
+ */
+ ThrowException_if_Error(res);
}
else if (isExtractGroupCommand)
{
@@ -139,23 +199,39 @@ static int Main2()
ecs->Init();
CExtractOptions eo;
+ (CExtractOptionsBase &)eo = options.ExtractOptions;
+ eo.StdInMode = options.StdInMode;
eo.StdOutMode = options.StdOutMode;
- eo.OutputDir = options.OutputDir;
eo.YesToAll = options.YesToAll;
- eo.OverwriteMode = options.OverwriteMode;
- eo.PathMode = options.Command.GetPathMode();
- eo.TestMode = options.Command.IsTestMode();
- eo.CalcCrc = options.CalcCrc;
- #if !defined(_7ZIP_ST) && !defined(_SFX)
+ eo.TestMode = options.Command.IsTestCommand();
+
+ #ifndef _SFX
eo.Properties = options.Properties;
#endif
bool messageWasDisplayed = false;
- HRESULT result = ExtractGUI(codecs, formatIndices,
+
+ #ifndef _SFX
+ CHashBundle hb;
+ CHashBundle *hb_ptr = NULL;
+
+ if (!options.HashMethods.IsEmpty())
+ {
+ hb_ptr = &hb;
+ ThrowException_if_Error(hb.SetMethods(EXTERNAL_CODECS_VARS options.HashMethods));
+ }
+ #endif
+
+ HRESULT result = ExtractGUI(codecs,
+ formatIndices, excludedFormatIndices,
options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
- options.WildcardCensor.Pairs.Front().Head,
- eo, options.ShowDialog, messageWasDisplayed, ecs);
+ options.Censor.Pairs.Front().Head,
+ eo,
+ #ifndef _SFX
+ hb_ptr,
+ #endif
+ options.ShowDialog, messageWasDisplayed, ecs);
if (result != S_OK)
{
if (result != E_ABORT && messageWasDisplayed)
@@ -183,17 +259,21 @@ static int Main2()
// callback.StdOutMode = options.UpdateOptions.StdOutMode;
callback.Init();
- if (!options.UpdateOptions.Init(codecs, formatIndices, options.ArchiveName))
+ if (!options.UpdateOptions.InitFormatIndex(codecs, formatIndices, options.ArchiveName) ||
+ !options.UpdateOptions.SetArcPath(codecs, options.ArchiveName))
{
- ErrorLangMessage(IDS_UPDATE_NOT_SUPPORTED, 0x02000601);
+ ErrorLangMessage(IDS_UPDATE_NOT_SUPPORTED);
return NExitCode::kFatalError;
}
bool messageWasDisplayed = false;
HRESULT result = UpdateGUI(
- codecs,
- options.WildcardCensor, options.UpdateOptions,
+ codecs, formatIndices,
+ options.ArchiveName,
+ options.Censor,
+ options.UpdateOptions,
options.ShowDialog,
- messageWasDisplayed, &callback);
+ messageWasDisplayed,
+ &callback);
if (result != S_OK)
{
@@ -208,6 +288,27 @@ static int Main2()
return NExitCode::kWarning;
}
}
+ else if (options.Command.CommandType == NCommandType::kHash)
+ {
+ bool messageWasDisplayed = false;
+ HRESULT result = HashCalcGUI(EXTERNAL_CODECS_VARS
+ options.Censor, options.HashOptions, messageWasDisplayed);
+
+ if (result != S_OK)
+ {
+ if (result != E_ABORT && messageWasDisplayed)
+ return NExitCode::kFatalError;
+ throw CSystemException(result);
+ }
+ /*
+ if (callback.FailedFiles.Size() > 0)
+ {
+ if (!messageWasDisplayed)
+ throw CSystemException(E_FAIL);
+ return NExitCode::kWarning;
+ }
+ */
+ }
else
{
throw "Unsupported command";
@@ -233,12 +334,17 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
InitCommonControls();
+ #ifndef UNDER_CE
+ g_ComCtl32Version = ::GetDllVersion(TEXT("comctl32.dll"));
+ g_LVN_ITEMACTIVATE_Support = (g_ComCtl32Version >= MAKELONG(71, 4));
+ #endif
+
// OleInitialize is required for ProgressBar in TaskBar.
#ifndef UNDER_CE
OleInitialize(NULL);
#endif
- ReloadLang();
+ LoadLangOneTime();
// setlocale(LC_COLLATE, ".ACP");
try
@@ -249,9 +355,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
{
return ShowMemErrorMessage();
}
- catch(const CArchiveCommandLineException &e)
+ catch(const CArcCmdLineException &e)
{
- ErrorMessage(GetUnicodeString(e));
+ ErrorMessage(e);
return NExitCode::kUserError;
}
catch(const CSystemException &systemError)
@@ -280,9 +386,16 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
ErrorMessage(GetUnicodeString(s));
return NExitCode::kFatalError;
}
+ catch(int v)
+ {
+ wchar_t s[32];
+ ConvertUInt32ToString(v, s);
+ ErrorMessage(UString(L"Error: ") + s);
+ return NExitCode::kFatalError;
+ }
catch(...)
{
- ErrorLangMessage(IDS_UNKNOWN_ERROR, 0x0200060C);
+ ErrorMessage(L"Unknown error");
return NExitCode::kFatalError;
}
}
diff --git a/CPP/7zip/UI/GUI/GUI.dsp b/CPP/7zip/UI/GUI/GUI.dsp
index 382f592e..1cbdbfd4 100755..100644
--- a/CPP/7zip/UI/GUI/GUI.dsp
+++ b/CPP/7zip/UI/GUI/GUI.dsp
@@ -45,7 +45,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
@@ -72,7 +72,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MDd /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG"
@@ -99,7 +99,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
@@ -127,7 +127,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MDd /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG"
@@ -156,11 +156,11 @@ SOURCE=.\7zG.exe.manifest
# End Source File
# Begin Source File
-SOURCE=.\FM.ico
+SOURCE=.\ExtractRes.h
# End Source File
# Begin Source File
-SOURCE=.\resource.h
+SOURCE=.\FM.ico
# End Source File
# Begin Source File
@@ -257,7 +257,11 @@ SOURCE=..\Common\ExtractMode.h
# End Source File
# Begin Source File
-SOURCE=..\Common\HandlerLoader.h
+SOURCE=..\Common\HashCalc.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common\HashCalc.h
# End Source File
# Begin Source File
@@ -397,6 +401,22 @@ SOURCE=.\BenchmarkDialog.h
# End Source File
# Begin Source File
+SOURCE=..\FileManager\BrowseDialog.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\FileManager\BrowseDialog.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\FileManager\ComboDialog.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\FileManager\ComboDialog.h
+# End Source File
+# Begin Source File
+
SOURCE=.\CompressDialog.cpp
# End Source File
# Begin Source File
@@ -515,6 +535,14 @@ SOURCE=..\FileManager\StringUtils.cpp
SOURCE=..\FileManager\StringUtils.h
# End Source File
+# Begin Source File
+
+SOURCE=..\FileManager\SysIconUtils.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\FileManager\SysIconUtils.h
+# End Source File
# End Group
# Begin Group "Engine"
@@ -533,6 +561,14 @@ SOURCE=.\GUI.cpp
# End Source File
# Begin Source File
+SOURCE=.\HashGUI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\HashGUI.h
+# End Source File
+# Begin Source File
+
SOURCE=.\UpdateCallbackGUI.cpp
# End Source File
# Begin Source File
@@ -585,6 +621,14 @@ SOURCE=..\..\Common\FilterCoder.h
# End Source File
# Begin Source File
+SOURCE=..\..\Common\LimitedStreams.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\LimitedStreams.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Common\MethodProps.cpp
# End Source File
# Begin Source File
@@ -601,12 +645,32 @@ SOURCE=..\..\Common\ProgressUtils.h
# End Source File
# Begin Source File
+SOURCE=..\..\Common\PropId.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\StreamObjects.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\StreamObjects.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Common\StreamUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\StreamUtils.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\UniqBlocks.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\UniqBlocks.h
+# End Source File
# End Group
# Begin Group "Compress"
@@ -714,6 +778,34 @@ SOURCE=..\..\..\..\C\CpuArch.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\C\Sort.c
+
+!IF "$(CFG)" == "GUI - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "GUI - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "GUI - Win32 ReleaseU"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "GUI - Win32 DebugU"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Sort.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\C\Threads.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
@@ -727,6 +819,10 @@ SOURCE=..\..\..\..\C\Threads.h
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\..\Common\Buffer.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\Common\CommandLineParser.cpp
# End Source File
# Begin Source File
@@ -803,14 +899,6 @@ SOURCE=..\..\..\Common\StringToInt.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\TextConfig.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\TextConfig.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\..\Common\UTFConvert.cpp
# End Source File
# Begin Source File
@@ -891,11 +979,11 @@ SOURCE=..\..\..\Windows\DLL.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Error.cpp
+SOURCE=..\..\..\Windows\ErrorMsg.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Error.h
+SOURCE=..\..\..\Windows\ErrorMsg.h
# End Source File
# Begin Source File
@@ -923,6 +1011,10 @@ SOURCE=..\..\..\Windows\FileIO.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\Windows\FileLink.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\Windows\FileMapping.h
# End Source File
# Begin Source File
@@ -935,6 +1027,14 @@ SOURCE=..\..\..\Windows\FileName.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\Windows\FileSystem.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\Windows\FileSystem.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\Windows\MemoryLock.cpp
# End Source File
# Begin Source File
@@ -951,11 +1051,11 @@ SOURCE=..\..\..\Windows\PropVariant.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\PropVariantConversions.cpp
+SOURCE=..\..\..\Windows\PropVariantConv.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\PropVariantConversions.h
+SOURCE=..\..\..\Windows\PropVariantConv.h
# End Source File
# Begin Source File
@@ -999,7 +1099,11 @@ SOURCE=..\..\..\Windows\System.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Time.cpp
+SOURCE=..\..\..\Windows\TimeUtils.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\Windows\TimeUtils.h
# End Source File
# Begin Source File
diff --git a/CPP/7zip/UI/GUI/GUI.dsw b/CPP/7zip/UI/GUI/GUI.dsw
index 85d33484..85d33484 100755..100644
--- a/CPP/7zip/UI/GUI/GUI.dsw
+++ b/CPP/7zip/UI/GUI/GUI.dsw
diff --git a/CPP/7zip/UI/GUI/HashGUI.cpp b/CPP/7zip/UI/GUI/HashGUI.cpp
new file mode 100644
index 00000000..903e41fc
--- /dev/null
+++ b/CPP/7zip/UI/GUI/HashGUI.cpp
@@ -0,0 +1,278 @@
+// HashGUI.cpp
+
+#include "StdAfx.h"
+
+#include "../../../Common/IntToString.h"
+#include "../../../Common/StringConvert.h"
+
+#include "../../../Windows/ErrorMsg.h"
+
+#include "../FileManager/FormatUtils.h"
+#include "../FileManager/LangUtils.h"
+#include "../FileManager/OverwriteDialogRes.h"
+#include "../FileManager/ProgressDialog2.h"
+#include "../FileManager/ProgressDialog2Res.h"
+#include "../FileManager/PropertyNameRes.h"
+#include "../FileManager/resourceGUI.h"
+
+#include "HashGUI.h"
+
+using namespace NWindows;
+
+class CHashCallbackGUI: public CProgressThreadVirt, public IHashCallbackUI
+{
+ UInt64 NumFiles;
+ UStringVector FailedFiles;
+ bool _curIsFolder;
+ UString FirstFileName;
+
+ HRESULT ProcessVirt();
+
+public:
+ const NWildcard::CCensor *censor;
+ const CHashOptions *options;
+
+ DECL_EXTERNAL_CODECS_LOC_VARS2;
+
+ CHashCallbackGUI() {}
+ ~CHashCallbackGUI() { }
+
+ INTERFACE_IHashCallbackUI(;)
+
+ void AddErrorMessage(DWORD systemError, const wchar_t *name)
+ {
+ ProgressDialog.Sync.AddError_Code_Name(systemError, name);
+ }
+};
+
+static void NewLine(UString &s)
+{
+ s += L'\n';
+}
+
+static void AddValuePair(UString &s, UINT resourceID, UInt64 value)
+{
+ s += LangString(resourceID);
+ s += L": ";
+ wchar_t sz[32];
+ ConvertUInt64ToString(value, sz);
+ s += sz;
+ NewLine(s);
+}
+
+static void AddSizeValuePair(UString &s, UINT resourceID, UInt64 value)
+{
+ s += LangString(resourceID);
+ s += L": ";
+ wchar_t sz[32];
+ ConvertUInt64ToString(value, sz);
+ s += MyFormatNew(IDS_FILE_SIZE, sz);
+ ConvertUInt64ToString(value >> 20, sz);
+ s += L" (";
+ s += sz;
+ s += L" MB)";
+ NewLine(s);
+}
+
+HRESULT CHashCallbackGUI::StartScanning()
+{
+ CProgressSync &sync = ProgressDialog.Sync;
+ sync.Set_Status(LangString(IDS_SCANNING));
+ return CheckBreak();
+}
+
+HRESULT CHashCallbackGUI::ScanProgress(UInt64 /* numFolders */, UInt64 numFiles, UInt64 totalSize, const wchar_t *path, bool isDir)
+{
+ return ProgressDialog.Sync.ScanProgress(numFiles, totalSize, path, isDir);
+}
+
+HRESULT CHashCallbackGUI::CanNotFindError(const wchar_t *name, DWORD systemError)
+{
+ FailedFiles.Add(name);
+ AddErrorMessage(systemError, name);
+ return CheckBreak();
+}
+
+HRESULT CHashCallbackGUI::FinishScanning()
+{
+ CProgressSync &sync = ProgressDialog.Sync;
+ sync.Set_FilePath(L"");
+ return CheckBreak();
+}
+
+HRESULT CHashCallbackGUI::CheckBreak()
+{
+ return ProgressDialog.Sync.CheckStop();
+}
+
+HRESULT CHashCallbackGUI::SetNumFiles(UInt64 numFiles)
+{
+ CProgressSync &sync = ProgressDialog.Sync;
+ sync.Set_NumFilesTotal(numFiles);
+ return CheckBreak();
+}
+
+HRESULT CHashCallbackGUI::SetTotal(UInt64 size)
+{
+ CProgressSync &sync = ProgressDialog.Sync;
+ sync.Set_NumBytesTotal(size);
+ return CheckBreak();
+}
+
+HRESULT CHashCallbackGUI::SetCompleted(const UInt64 *completed)
+{
+ return ProgressDialog.Sync.Set_NumBytesCur(completed);
+}
+
+HRESULT CHashCallbackGUI::BeforeFirstFile(const CHashBundle & /* hb */)
+{
+ return S_OK;
+}
+
+HRESULT CHashCallbackGUI::GetStream(const wchar_t *name, bool isFolder)
+{
+ if (NumFiles == 0)
+ FirstFileName = name;
+ _curIsFolder = isFolder;
+ CProgressSync &sync = ProgressDialog.Sync;
+ sync.Set_FilePath(name, isFolder);
+ return CheckBreak();
+}
+
+HRESULT CHashCallbackGUI::OpenFileError(const wchar_t *name, DWORD systemError)
+{
+ FailedFiles.Add(name);
+ // if (systemError == ERROR_SHARING_VIOLATION)
+ {
+ AddErrorMessage(systemError, name);
+ return S_FALSE;
+ }
+ // return systemError;
+}
+
+HRESULT CHashCallbackGUI::SetOperationResult(UInt64 /* fileSize */, const CHashBundle & /* hb */, bool /* showHash */)
+{
+ CProgressSync &sync = ProgressDialog.Sync;
+ if (!_curIsFolder)
+ NumFiles++;
+ sync.Set_NumFilesCur(NumFiles);
+ return CheckBreak();
+}
+
+static void AddHashString(UString &s, const CHasherState &h, int digestIndex, const wchar_t *title)
+{
+ s += title;
+ s += L' ';
+ char temp[k_HashCalc_DigestSize_Max * 2 + 4];
+ AddHashHexToString(temp, h.Digests[digestIndex], h.DigestSize);
+ s.AddAsciiStr(temp);
+ NewLine(s);
+}
+
+static void AddHashResString(UString &s, const CHasherState &h, int digestIndex, UInt32 resID)
+{
+ UString s2 = LangString(resID);
+ s2.Replace(L"CRC", h.Name);
+ AddHashString(s, h, digestIndex, s2);
+}
+
+void AddHashBundleRes(UString &s, const CHashBundle &hb, const UString &firstFileName)
+{
+ if (hb.NumErrors != 0)
+ {
+ AddValuePair(s, IDS_PROP_NUM_ERRORS, hb.NumErrors);
+ NewLine(s);
+ }
+ if (hb.NumFiles == 1 && hb.NumDirs == 0 && !firstFileName.IsEmpty())
+ {
+ s += LangString(IDS_PROP_NAME);
+ s += L": ";
+ s += firstFileName;
+ NewLine(s);
+ }
+ else
+ {
+ AddValuePair(s, IDS_PROP_FOLDERS, hb.NumDirs);
+ AddValuePair(s, IDS_PROP_FILES, hb.NumFiles);
+ }
+
+ AddSizeValuePair(s, IDS_PROP_SIZE, hb.FilesSize);
+
+ if (hb.NumAltStreams != 0)
+ {
+ NewLine(s);
+ AddValuePair(s, IDS_PROP_NUM_ALT_STREAMS, hb.NumAltStreams);
+ AddSizeValuePair(s, IDS_PROP_ALT_STREAMS_SIZE, hb.AltStreamsSize);
+ }
+
+ FOR_VECTOR (i, hb.Hashers)
+ {
+ NewLine(s);
+ const CHasherState &h = hb.Hashers[i];
+ if (hb.NumFiles == 1 && hb.NumDirs == 0)
+ {
+ s += h.Name;
+ AddHashString(s, h, k_HashCalc_Index_DataSum, L":");
+ }
+ else
+ {
+ AddHashResString(s, h, k_HashCalc_Index_DataSum, IDS_CHECKSUM_CRC_DATA);
+ AddHashResString(s, h, k_HashCalc_Index_NamesSum, IDS_CHECKSUM_CRC_DATA_NAMES);
+ }
+ if (hb.NumAltStreams != 0)
+ {
+ AddHashResString(s, h, k_HashCalc_Index_StreamsSum, IDS_CHECKSUM_CRC_STREAMS_NAMES);
+ }
+ }
+}
+
+HRESULT CHashCallbackGUI::AfterLastFile(const CHashBundle &hb)
+{
+ UString s;
+ AddHashBundleRes(s, hb, FirstFileName);
+
+ CProgressSync &sync = ProgressDialog.Sync;
+ sync.Set_NumFilesCur(hb.NumFiles);
+
+ CProgressMessageBoxPair &pair = GetMessagePair(hb.NumErrors != 0);
+ pair.Message = s;
+ LangString(IDS_CHECKSUM_INFORMATION, pair.Title);
+
+ return S_OK;
+}
+
+HRESULT CHashCallbackGUI::ProcessVirt()
+{
+ NumFiles = 0;
+
+ UString errorInfo;
+ HRESULT res = HashCalc(EXTERNAL_CODECS_LOC_VARS
+ *censor, *options, errorInfo, this);
+
+ return res;
+}
+
+HRESULT HashCalcGUI(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ const NWildcard::CCensor &censor,
+ const CHashOptions &options,
+ bool &messageWasDisplayed)
+{
+ CHashCallbackGUI t;
+ #ifdef EXTERNAL_CODECS
+ t.__externalCodecs = __externalCodecs;
+ #endif
+ t.censor = &censor;
+ t.options = &options;
+
+ t.ProgressDialog.ShowCompressionInfo = false;
+
+ const UString title = LangString(IDS_CHECKSUM_CALCULATING);
+
+ t.ProgressDialog.MainTitle = L"7-Zip"; // LangString(IDS_APP_TITLE);
+ t.ProgressDialog.MainAddTitle = title + L' ';
+
+ RINOK(t.Create(title));
+ messageWasDisplayed = t.ThreadFinishedOK && t.ProgressDialog.MessagesDisplayed;
+ return S_OK;
+}
diff --git a/CPP/7zip/UI/GUI/HashGUI.h b/CPP/7zip/UI/GUI/HashGUI.h
new file mode 100644
index 00000000..40340365
--- /dev/null
+++ b/CPP/7zip/UI/GUI/HashGUI.h
@@ -0,0 +1,16 @@
+// HashGUI.h
+
+#ifndef __HASH_GUI_H
+#define __HASH_GUI_H
+
+#include "../Common/HashCalc.h"
+
+HRESULT HashCalcGUI(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ const NWildcard::CCensor &censor,
+ const CHashOptions &options,
+ bool &messageWasDisplayed);
+
+void AddHashBundleRes(UString &s, const CHashBundle &hb, const UString &firstFileName);
+
+#endif
diff --git a/CPP/7zip/UI/GUI/StdAfx.cpp b/CPP/7zip/UI/GUI/StdAfx.cpp
index d0feea85..d0feea85 100755..100644
--- a/CPP/7zip/UI/GUI/StdAfx.cpp
+++ b/CPP/7zip/UI/GUI/StdAfx.cpp
diff --git a/CPP/7zip/UI/GUI/StdAfx.h b/CPP/7zip/UI/GUI/StdAfx.h
index 46ea51cf..9e322f96 100755..100644
--- a/CPP/7zip/UI/GUI/StdAfx.h
+++ b/CPP/7zip/UI/GUI/StdAfx.h
@@ -3,11 +3,17 @@
#ifndef __STDAFX_H
#define __STDAFX_H
-#include <windows.h>
-#include <commctrl.h>
-#include <shlobj.h>
-#include <stdio.h>
+// #define _WIN32_WINNT 0x0400
+#define _WIN32_WINNT 0x0500
+#define WINVER _WIN32_WINNT
-#include "Common/NewHandler.h"
+#include "../../../Common/Common.h"
+
+// #include <commctrl.h>
+#include <ShlObj.h>
+#include <shlwapi.h>
+
+// #define printf(x) NO_PRINTF_(x)
+// #define sprintf(x) NO_SPRINTF_(x)
#endif
diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp b/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
index 8ec01867..36af147b 100755..100644
--- a/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
+++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
@@ -2,13 +2,17 @@
#include "StdAfx.h"
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
+#include "../../../Common/IntToString.h"
+#include "../../../Common/StringConvert.h"
-#include "Windows/Error.h"
-#include "Windows/PropVariant.h"
+#include "../../../Windows/PropVariant.h"
#include "../FileManager/PasswordDialog.h"
+#include "../FileManager/LangUtils.h"
+
+#include "../FileManager/resourceGUI.h"
+
+#include "resource2.h"
#include "UpdateCallbackGUI.h"
@@ -22,67 +26,68 @@ void CUpdateCallbackGUI::Init()
NumFiles = 0;
}
-void CUpdateCallbackGUI::AddErrorMessage(LPCWSTR message)
-{
- ProgressDialog->Sync.AddErrorMessage(message);
-}
-
-void CUpdateCallbackGUI::AddErrorMessage(const wchar_t *name, DWORD systemError)
-{
- AddErrorMessage(
- UString(L"WARNING: ") +
- NError::MyFormatMessageW(systemError) +
- UString(L": ") +
- UString(name));
-}
-
-HRESULT CUpdateCallbackGUI::OpenResult(const wchar_t *name, HRESULT result)
+HRESULT CUpdateCallbackGUI::OpenResult(const wchar_t *name, HRESULT result, const wchar_t *errorArcType)
{
if (result != S_OK)
{
- AddErrorMessage (UString(L"Error: ") + name + UString(L" is not supported archive"));
+ UString s;
+ if (errorArcType)
+ {
+ s += L"Can not open the file as [";
+ s += errorArcType;
+ s += L"] archive";
+ }
+ else
+ s += L"The file is not supported archive";
+ ProgressDialog->Sync.AddError_Message_Name(s, name);
}
return S_OK;
}
HRESULT CUpdateCallbackGUI::StartScanning()
{
+ CProgressSync &sync = ProgressDialog->Sync;
+ sync.Set_Status(LangString(IDS_SCANNING));
return S_OK;
}
HRESULT CUpdateCallbackGUI::CanNotFindError(const wchar_t *name, DWORD systemError)
{
FailedFiles.Add(name);
- AddErrorMessage(name, systemError);
+ ProgressDialog->Sync.AddError_Code_Name(systemError, name);
return S_OK;
}
HRESULT CUpdateCallbackGUI::FinishScanning()
{
+ CProgressSync &sync = ProgressDialog->Sync;
+ sync.Set_Status(L"");
return S_OK;
}
HRESULT CUpdateCallbackGUI::StartArchive(const wchar_t *name, bool /* updating */)
{
- ProgressDialog->Sync.SetTitleFileName(name);
+ CProgressSync &sync = ProgressDialog->Sync;
+ sync.Set_Status(LangString(IDS_PROGRESS_COMPRESSING));
+ sync.Set_TitleFileName(name);
return S_OK;
}
HRESULT CUpdateCallbackGUI::FinishArchive()
{
+ CProgressSync &sync = ProgressDialog->Sync;
+ sync.Set_Status(L"");
return S_OK;
}
HRESULT CUpdateCallbackGUI::CheckBreak()
{
- return ProgressDialog->Sync.ProcessStopAndPause();
+ return ProgressDialog->Sync.CheckStop();
}
-HRESULT CUpdateCallbackGUI::ScanProgress(UInt64 /* numFolders */, UInt64 numFiles, const wchar_t *path)
+HRESULT CUpdateCallbackGUI::ScanProgress(UInt64 /* numFolders */, UInt64 numFiles, UInt64 totalSize, const wchar_t *path, bool isDir)
{
- ProgressDialog->Sync.SetCurrentFileName(path);
- ProgressDialog->Sync.SetNumFilesTotal(numFiles);
- return ProgressDialog->Sync.ProcessStopAndPause();
+ return ProgressDialog->Sync.ScanProgress(numFiles, totalSize, path, isDir);
}
HRESULT CUpdateCallbackGUI::Finilize()
@@ -92,34 +97,30 @@ HRESULT CUpdateCallbackGUI::Finilize()
HRESULT CUpdateCallbackGUI::SetNumFiles(UInt64 numFiles)
{
- ProgressDialog->Sync.SetNumFilesTotal(numFiles);
+ ProgressDialog->Sync.Set_NumFilesTotal(numFiles);
return S_OK;
}
HRESULT CUpdateCallbackGUI::SetTotal(UInt64 total)
{
- ProgressDialog->Sync.SetProgress(total, 0);
+ ProgressDialog->Sync.Set_NumBytesTotal(total);
return S_OK;
}
-HRESULT CUpdateCallbackGUI::SetCompleted(const UInt64 *completeValue)
+HRESULT CUpdateCallbackGUI::SetCompleted(const UInt64 *completed)
{
- RINOK(CheckBreak());
- if (completeValue != NULL)
- ProgressDialog->Sync.SetPos(*completeValue);
- return S_OK;
+ return ProgressDialog->Sync.Set_NumBytesCur(completed);
}
HRESULT CUpdateCallbackGUI::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
{
- RINOK(CheckBreak());
- ProgressDialog->Sync.SetRatioInfo(inSize, outSize);
- return S_OK;
+ ProgressDialog->Sync.Set_Ratio(inSize, outSize);
+ return CheckBreak();
}
HRESULT CUpdateCallbackGUI::GetStream(const wchar_t *name, bool /* isAnti */)
{
- ProgressDialog->Sync.SetCurrentFileName(name);
+ ProgressDialog->Sync.Set_FilePath(name);
return S_OK;
}
@@ -128,7 +129,7 @@ HRESULT CUpdateCallbackGUI::OpenFileError(const wchar_t *name, DWORD systemError
FailedFiles.Add(name);
// if (systemError == ERROR_SHARING_VIOLATION)
{
- AddErrorMessage(name, systemError);
+ ProgressDialog->Sync.AddError_Code_Name(systemError, name);
return S_FALSE;
}
// return systemError;
@@ -137,7 +138,7 @@ HRESULT CUpdateCallbackGUI::OpenFileError(const wchar_t *name, DWORD systemError
HRESULT CUpdateCallbackGUI::SetOperationResult(Int32 /* operationResult */)
{
NumFiles++;
- ProgressDialog->Sync.SetNumFilesCur(NumFiles);
+ ProgressDialog->Sync.Set_NumFilesCur(NumFiles);
return S_OK;
}
@@ -150,7 +151,7 @@ HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BST
{
CPasswordDialog dialog;
ProgressDialog->WaitCreating();
- if (dialog.Create(*ProgressDialog) == IDCANCEL)
+ if (dialog.Create(*ProgressDialog) != IDOK)
return E_ABORT;
Password = dialog.Password;
PasswordIsDefined = true;
@@ -178,7 +179,7 @@ HRESULT CUpdateCallbackGUI::CloseProgress()
HRESULT CUpdateCallbackGUI::Open_CheckBreak()
{
- return ProgressDialog->Sync.ProcessStopAndPause();
+ return ProgressDialog->Sync.CheckStop();
}
HRESULT CUpdateCallbackGUI::Open_SetTotal(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
@@ -189,7 +190,7 @@ HRESULT CUpdateCallbackGUI::Open_SetTotal(const UInt64 * /* numFiles */, const U
HRESULT CUpdateCallbackGUI::Open_SetCompleted(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
{
- return ProgressDialog->Sync.ProcessStopAndPause();
+ return ProgressDialog->Sync.CheckStop();
}
#ifndef _NO_CRYPTO
@@ -200,10 +201,10 @@ HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password)
return CryptoGetTextPassword2(NULL, password);
}
-HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(UString &password)
+HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(bool &passwordIsDefined, UString &password)
{
- if (PasswordIsDefined)
- password = Password;
+ passwordIsDefined = PasswordIsDefined;
+ password = Password;
return S_OK;
}
diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI.h b/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
index b5ca154a..21b6f432 100755..100644
--- a/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
+++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
@@ -33,9 +33,6 @@ public:
UStringVector FailedFiles;
CProgressDialog *ProgressDialog;
-
- void AddErrorMessage(LPCWSTR message);
- void AddErrorMessage(const wchar_t *name, DWORD systemError);
};
#endif
diff --git a/CPP/7zip/UI/GUI/UpdateGUI.cpp b/CPP/7zip/UI/GUI/UpdateGUI.cpp
index 406d5bf1..a7af4e94 100755..100644
--- a/CPP/7zip/UI/GUI/UpdateGUI.cpp
+++ b/CPP/7zip/UI/GUI/UpdateGUI.cpp
@@ -2,16 +2,14 @@
#include "StdAfx.h"
-#include "UpdateGUI.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-#include "Common/StringToInt.h"
+#include "../../../Common/IntToString.h"
+#include "../../../Common/StringConvert.h"
+#include "../../../Common/StringToInt.h"
-#include "Windows/Error.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileName.h"
-#include "Windows/Thread.h"
+// #include "../../../Windows/Error.h"
+#include "../../../Windows/FileDir.h"
+#include "../../../Windows/FileName.h"
+#include "../../../Windows/Thread.h"
#include "../Common/WorkDir.h"
@@ -28,6 +26,7 @@
using namespace NWindows;
using namespace NFile;
+using namespace NDir;
static CFSTR kDefaultSfxModule = FTEXT("7z.sfx");
static const wchar_t *kSFXExtension = L"exe";
@@ -41,17 +40,21 @@ class CThreadUpdating: public CProgressThreadVirt
HRESULT ProcessVirt();
public:
CCodecs *codecs;
+ const CObjectVector<COpenType> *formatIndices;
+ const UString *cmdArcPath;
CUpdateCallbackGUI *UpdateCallbackGUI;
- const NWildcard::CCensor *WildcardCensor;
+ NWildcard::CCensor *WildcardCensor;
CUpdateOptions *Options;
+ bool needSetPath;
};
HRESULT CThreadUpdating::ProcessVirt()
{
CUpdateErrorInfo ei;
- HRESULT res = UpdateArchive(codecs, *WildcardCensor, *Options,
- ei, UpdateCallbackGUI, UpdateCallbackGUI);
- ErrorMessage = ei.Message;
+ HRESULT res = UpdateArchive(codecs, *formatIndices, *cmdArcPath,
+ *WildcardCensor, *Options,
+ ei, UpdateCallbackGUI, UpdateCallbackGUI, needSetPath);
+ FinalMessage.ErrorMessage.Message = ei.Message;
SetErrorPath1(ei.FileName);
SetErrorPath2(ei.FileName2);
if (ei.SystemError != S_OK && ei.SystemError != E_FAIL && ei.SystemError != E_ABORT)
@@ -83,7 +86,7 @@ static bool IsThereMethodOverride(bool is7z, const UString &propertiesString)
{
UStringVector strings;
SplitString(propertiesString, strings);
- for (int i = 0; i < strings.Size(); i++)
+ FOR_VECTOR (i, strings)
{
const UString &s = strings[i];
if (is7z)
@@ -95,7 +98,7 @@ static bool IsThereMethodOverride(bool is7z, const UString &propertiesString)
}
else
{
- if (s.Length() > 0)
+ if (s.Len() > 0)
if (s[0] == L'm' && s[1] == L'=')
return true;
}
@@ -108,7 +111,7 @@ static void ParseAndAddPropertires(CObjectVector<CProperty> &properties,
{
UStringVector strings;
SplitString(propertiesString, strings);
- for (int i = 0; i < strings.Size(); i++)
+ FOR_VECTOR (i, strings)
{
const UString &s = strings[i];
CProperty property;
@@ -117,8 +120,8 @@ static void ParseAndAddPropertires(CObjectVector<CProperty> &properties,
property.Name = s;
else
{
- property.Name = s.Left(index);
- property.Value = s.Mid(index + 1);
+ property.Name.SetFrom(s, index);
+ property.Value = s.Ptr(index + 1);
}
properties.Add(property);
}
@@ -190,25 +193,61 @@ static void SetOutProperties(
AddProp(properties, L"mt", numThreads);
}
+struct C_UpdateMode_ToAction_Pair
+{
+ NCompressDialog::NUpdateMode::EEnum UpdateMode;
+ const NUpdateArchive::CActionSet *ActionSet;
+};
+
+static const C_UpdateMode_ToAction_Pair g_UpdateMode_Pairs[] =
+{
+ { NCompressDialog::NUpdateMode::kAdd, &NUpdateArchive::k_ActionSet_Add },
+ { NCompressDialog::NUpdateMode::kUpdate, &NUpdateArchive::k_ActionSet_Update },
+ { NCompressDialog::NUpdateMode::kFresh, &NUpdateArchive::k_ActionSet_Fresh },
+ { NCompressDialog::NUpdateMode::kSync, &NUpdateArchive::k_ActionSet_Sync }
+};
+
+static int FindActionSet(const NUpdateArchive::CActionSet &actionSet)
+{
+ for (unsigned i = 0; i < ARRAY_SIZE(g_UpdateMode_Pairs); i++)
+ if (actionSet.IsEqualTo(*g_UpdateMode_Pairs[i].ActionSet))
+ return i;
+ return -1;
+}
+
+static int FindUpdateMode(NCompressDialog::NUpdateMode::EEnum mode)
+{
+ for (unsigned i = 0; i < ARRAY_SIZE(g_UpdateMode_Pairs); i++)
+ if (mode == g_UpdateMode_Pairs[i].UpdateMode)
+ return i;
+ return -1;
+}
+
+
static HRESULT ShowDialog(
CCodecs *codecs,
- const NWildcard::CCensor &censor,
- CUpdateOptions &options, CUpdateCallbackGUI *callback, HWND hwndParent)
+ const CObjectVector<NWildcard::CCensorPath> &censor,
+ CUpdateOptions &options,
+ CUpdateCallbackGUI *callback, HWND hwndParent)
{
if (options.Commands.Size() != 1)
throw "It must be one command";
+ /*
FString currentDirPrefix;
#ifndef UNDER_CE
{
- if (!NDirectory::MyGetCurrentDirectory(currentDirPrefix))
+ if (!MyGetCurrentDirectory(currentDirPrefix))
return E_FAIL;
NName::NormalizeDirPathPrefix(currentDirPrefix);
}
#endif
+ */
bool oneFile = false;
NFind::CFileInfo fileInfo;
UString name;
+
+ /*
if (censor.Pairs.Size() > 0)
{
const NWildcard::CPair &pair = censor.Pairs[0];
@@ -218,7 +257,7 @@ static HRESULT ShowDialog(
if (item.ForFile)
{
name = pair.Prefix;
- for (int i = 0; i < item.PathParts.Size(); i++)
+ FOR_VECTOR (i, item.PathParts)
{
if (i > 0)
name += WCHAR_PATH_SEPARATOR;
@@ -232,41 +271,96 @@ static HRESULT ShowDialog(
}
}
}
-
+ */
+ if (censor.Size() > 0)
+ {
+ const NWildcard::CCensorPath &cp = censor[0];
+ if (cp.Include)
+ {
+ {
+ if (fileInfo.Find(us2fs(cp.Path)))
+ {
+ if (censor.Size() == 1)
+ oneFile = !fileInfo.IsDir();
+ }
+ }
+ }
+ }
+
+
+ #if defined(_WIN32) && !defined(UNDER_CE)
+ CCurrentDirRestorer curDirRestorer;
+ #endif
CCompressDialog dialog;
NCompressDialog::CInfo &di = dialog.Info;
dialog.ArcFormats = &codecs->Formats;
- for (int i = 0; i < codecs->Formats.Size(); i++)
+
+ if (options.MethodMode.Type_Defined)
+ di.FormatIndex = options.MethodMode.Type.FormatIndex;
+
+ FOR_VECTOR (i, codecs->Formats)
{
const CArcInfoEx &ai = codecs->Formats[i];
- if (ai.Name.CompareNoCase(L"swfc") == 0)
- if (!oneFile || name.Right(4).CompareNoCase(L".swf") != 0)
- continue;
- if (ai.UpdateEnabled && (oneFile || !ai.KeepName))
- dialog.ArcIndices.Add(i);
+ if (!ai.UpdateEnabled)
+ continue;
+ if (!oneFile && ai.Flags_KeepName())
+ continue;
+ if ((int)i != di.FormatIndex)
+ if (ai.Name.IsEqualToNoCase(L"swfc"))
+ if (!oneFile || name.Len() < 4 || !StringsAreEqualNoCase(name.RightPtr(4), L".swf"))
+ continue;
+ dialog.ArcIndices.Add(i);
}
- if (dialog.ArcIndices.Size() == 0)
+ if (dialog.ArcIndices.IsEmpty())
{
ShowErrorMessage(L"No Update Engines");
return E_FAIL;
}
// di.ArchiveName = options.ArchivePath.GetFinalPath();
- di.ArchiveName = options.ArchivePath.GetPathWithoutExt();
- dialog.OriginalFileName = options.ArchivePath.Prefix + fs2us(fileInfo.Name);
+ di.ArcPath = options.ArchivePath.GetPathWithoutExt();
+ dialog.OriginalFileName = fs2us(fileInfo.Name);
+
+ di.PathMode = options.PathMode;
- di.CurrentDirPrefix = currentDirPrefix;
+ // di.CurrentDirPrefix = currentDirPrefix;
di.SFXMode = options.SfxMode;
di.OpenShareForWrite = options.OpenShareForWrite;
+ di.DeleteAfterCompressing = options.DeleteAfterCompressing;
+
+ di.SymLinks = options.SymLinks;
+ di.HardLinks = options.HardLinks;
+ di.AltStreams = options.AltStreams;
+ di.NtSecurity = options.NtSecurity;
if (callback->PasswordIsDefined)
di.Password = callback->Password;
di.KeepName = !oneFile;
-
+
+ NUpdateArchive::CActionSet &actionSet = options.Commands.Front().ActionSet;
+
+ {
+ int index = FindActionSet(actionSet);
+ if (index < 0)
+ return E_NOTIMPL;
+ di.UpdateMode = g_UpdateMode_Pairs[index].UpdateMode;
+ }
+
if (dialog.Create(hwndParent) != IDOK)
return E_ABORT;
-
+
+ options.DeleteAfterCompressing = di.DeleteAfterCompressing;
+
+ options.SymLinks = di.SymLinks;
+ options.HardLinks = di.HardLinks;
+ options.AltStreams = di.AltStreams;
+ options.NtSecurity = di.NtSecurity;
+
+ #if defined(_WIN32) && !defined(UNDER_CE)
+ curDirRestorer.NeedRestore = dialog.CurrentDirWasChanged;
+ #endif
+
options.VolumesSizes = di.VolumeSizes;
/*
if (di.VolumeSizeIsDefined)
@@ -275,26 +369,17 @@ static HRESULT ShowDialog(
return E_FAIL;
}
*/
-
- NUpdateArchive::CActionSet &actionSet = options.Commands.Front().ActionSet;
-
- switch(di.UpdateMode)
+
+
{
- case NCompressDialog::NUpdateMode::kAdd:
- actionSet = NUpdateArchive::kAddActionSet;
- break;
- case NCompressDialog::NUpdateMode::kUpdate:
- actionSet = NUpdateArchive::kUpdateActionSet;
- break;
- case NCompressDialog::NUpdateMode::kFresh:
- actionSet = NUpdateArchive::kFreshActionSet;
- break;
- case NCompressDialog::NUpdateMode::kSynchronize:
- actionSet = NUpdateArchive::kSynchronizeActionSet;
- break;
- default:
- throw 1091756;
+ int index = FindUpdateMode(di.UpdateMode);
+ if (index < 0)
+ return E_FAIL;
+ actionSet = *g_UpdateMode_Pairs[index].ActionSet;
}
+
+ options.PathMode = di.PathMode;
+
const CArcInfoEx &archiverInfo = codecs->Formats[di.FormatIndex];
callback->PasswordIsDefined = (!di.Password.IsEmpty());
if (callback->PasswordIsDefined)
@@ -302,7 +387,7 @@ static HRESULT ShowDialog(
options.MethodMode.Properties.Clear();
- bool is7z = archiverInfo.Name.CompareNoCase(L"7z") == 0;
+ bool is7z = archiverInfo.Name.IsEqualToNoCase(L"7z");
bool methodOverride = IsThereMethodOverride(is7z, di.Options);
SetOutProperties(
@@ -324,14 +409,16 @@ static HRESULT ShowDialog(
if (di.SFXMode)
options.SfxMode = true;
- options.MethodMode.FormatIndex = di.FormatIndex;
+ options.MethodMode.Type = COpenType();
+ options.MethodMode.Type_Defined = true;
+ options.MethodMode.Type.FormatIndex = di.FormatIndex;
options.ArchivePath.VolExtension = archiverInfo.GetMainExt();
if (di.SFXMode)
options.ArchivePath.BaseExtension = kSFXExtension;
else
options.ArchivePath.BaseExtension = options.ArchivePath.VolExtension;
- options.ArchivePath.ParseFromPath(di.ArchiveName);
+ options.ArchivePath.ParseFromPath(di.ArcPath, k_ArcNameMode_Smart);
NWorkDir::CInfo workDirInfo;
workDirInfo.Load();
@@ -339,17 +426,19 @@ static HRESULT ShowDialog(
if (workDirInfo.Mode != NWorkDir::NMode::kCurrent)
{
FString fullPath;
- NDirectory::MyGetFullPathName(us2fs(di.ArchiveName), fullPath);
+ MyGetFullPathName(us2fs(di.ArcPath), fullPath);
FString namePart;
options.WorkingDir = GetWorkDir(workDirInfo, fullPath, namePart);
- NDirectory::CreateComplexDirectory(options.WorkingDir);
+ CreateComplexDir(options.WorkingDir);
}
return S_OK;
}
HRESULT UpdateGUI(
CCodecs *codecs,
- const NWildcard::CCensor &censor,
+ const CObjectVector<COpenType> &formatIndices,
+ const UString &cmdArcPath,
+ NWildcard::CCensor &censor,
CUpdateOptions &options,
bool showDialog,
bool &messageWasDisplayed,
@@ -357,9 +446,11 @@ HRESULT UpdateGUI(
HWND hwndParent)
{
messageWasDisplayed = false;
+ bool needSetPath = true;
if (showDialog)
{
- RINOK(ShowDialog(codecs, censor, options, callback, hwndParent));
+ RINOK(ShowDialog(codecs, censor.CensorPaths, options, callback, hwndParent));
+ needSetPath = false;
}
if (options.SfxMode && options.SfxModule.IsEmpty())
{
@@ -369,20 +460,24 @@ HRESULT UpdateGUI(
CThreadUpdating tu;
+ tu.needSetPath = needSetPath;
+
tu.codecs = codecs;
+ tu.formatIndices = &formatIndices;
+ tu.cmdArcPath = &cmdArcPath;
tu.UpdateCallbackGUI = callback;
tu.UpdateCallbackGUI->ProgressDialog = &tu.ProgressDialog;
tu.UpdateCallbackGUI->Init();
- UString title = LangString(IDS_PROGRESS_COMPRESSING, 0x02000DC0);
+ UString title = LangString(IDS_PROGRESS_COMPRESSING);
/*
if (hwndParent != 0)
{
tu.ProgressDialog.MainWindow = hwndParent;
// tu.ProgressDialog.MainTitle = fileName;
- tu.ProgressDialog.MainAddTitle = title + L" ";
+ tu.ProgressDialog.MainAddTitle = title + L' ';
}
*/
diff --git a/CPP/7zip/UI/GUI/UpdateGUI.h b/CPP/7zip/UI/GUI/UpdateGUI.h
index c06ec1e7..d1880de0 100755..100644
--- a/CPP/7zip/UI/GUI/UpdateGUI.h
+++ b/CPP/7zip/UI/GUI/UpdateGUI.h
@@ -21,7 +21,9 @@
HRESULT UpdateGUI(
CCodecs *codecs,
- const NWildcard::CCensor &censor,
+ const CObjectVector<COpenType> &formatIndices,
+ const UString &cmdArcPath2,
+ NWildcard::CCensor &censor,
CUpdateOptions &options,
bool showDialog,
bool &messageWasDisplayed,
diff --git a/CPP/7zip/UI/GUI/makefile b/CPP/7zip/UI/GUI/makefile
index cd2c2f55..60cfcd4b 100755..100644
--- a/CPP/7zip/UI/GUI/makefile
+++ b/CPP/7zip/UI/GUI/makefile
@@ -1,5 +1,5 @@
PROG = 7zG.exe
-CFLAGS = $(CFLAGS) -I ../../../ \
+CFLAGS = $(CFLAGS) \
-DLANG \
-DEXTERNAL_CODECS \
@@ -16,6 +16,7 @@ GUI_OBJS = \
$O\ExtractDialog.obj \
$O\ExtractGUI.obj \
$O\GUI.obj \
+ $O\HashGUI.obj \
$O\UpdateCallbackGUI.obj \
$O\UpdateGUI.obj \
@@ -30,27 +31,28 @@ COMMON_OBJS = \
$O\NewHandler.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
- $O\TextConfig.obj \
$O\UTFConvert.obj \
$O\Wildcard.obj \
WIN_OBJS = \
$O\CommonDialog.obj \
$O\DLL.obj \
- $O\Error.obj \
+ $O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
+ $O\FileLink.obj \
$O\FileName.obj \
+ $O\FileSystem.obj \
$O\MemoryLock.obj \
$O\PropVariant.obj \
- $O\PropVariantConversions.obj \
+ $O\PropVariantConv.obj \
$O\Registry.obj \
$O\ResourceString.obj \
$O\Shell.obj \
$O\Synchronization.obj \
$O\System.obj \
- $O\Time.obj \
+ $O\TimeUtils.obj \
$O\Window.obj \
WIN_CTRL_OBJS = \
@@ -63,9 +65,13 @@ WIN_CTRL_OBJS = \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
+ $O\LimitedStreams.obj \
$O\MethodProps.obj \
$O\ProgressUtils.obj \
+ $O\PropId.obj \
+ $O\StreamObjects.obj \
$O\StreamUtils.obj \
+ $O\UniqBlocks.obj \
UI_COMMON_OBJS = \
$O\ArchiveCommandLine.obj \
@@ -76,6 +82,7 @@ UI_COMMON_OBJS = \
$O\EnumDirItems.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
+ $O\HashCalc.obj \
$O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
@@ -107,60 +114,24 @@ FM_OBJS = \
$O\PasswordDialog.obj \
$O\ProgressDialog2.obj \
-!IFDEF UNDER_CE
FM_OBJS = $(FM_OBJS) \
$O\BrowseDialog.obj \
+ $O\ComboDialog.obj \
$O\SysIconUtils.obj \
-!ENDIF
+
+EXPLORER_OBJS = \
+ $O\MyMessages.obj \
+
+COMPRESS_OBJS = \
+ $O\CopyCoder.obj \
C_OBJS = \
$O\Alloc.obj \
$O\CpuArch.obj \
+ $O\Sort.obj \
$O\Threads.obj \
!include "../../Crc.mak"
-OBJS = \
- $O\StdAfx.obj \
- $(GUI_OBJS) \
- $(COMMON_OBJS) \
- $(WIN_OBJS) \
- $(WIN_CTRL_OBJS) \
- $(7ZIP_COMMON_OBJS) \
- $(UI_COMMON_OBJS) \
- $(AR_COMMON_OBJS) \
- $(FM_OBJS)\
- $O\MyMessages.obj \
- $O\CopyCoder.obj \
- $(LZMA_BENCH_OBJS) \
- $(C_OBJS) \
- $(ASM_OBJS) \
- $O\resource.res
-
-!include "../../../Build.mak"
-
-$(GUI_OBJS): $(*B).cpp
- $(COMPL)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
- $(COMPL)
-$(WIN_OBJS): ../../../Windows/$(*B).cpp
- $(COMPL)
-$(WIN_CTRL_OBJS): ../../../Windows/Control/$(*B).cpp
- $(COMPL)
-$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
- $(COMPL)
-$(UI_COMMON_OBJS): ../Common/$(*B).cpp
- $(COMPL)
-$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
- $(COMPL)
-$(FM_OBJS): ../FileManager/$(*B).cpp
- $(COMPL)
-$O\MyMessages.obj: ../Explorer/MyMessages.cpp
- $(COMPL)
-
-$O\CopyCoder.obj: ../../Compress/$(*B).cpp
- $(COMPL)
-$(C_OBJS): ../../../../C/$(*B).c
- $(COMPL_O2)
-
-!include "../../Asm.mak"
+
+!include "../../7zip.mak"
diff --git a/CPP/7zip/UI/GUI/resource.rc b/CPP/7zip/UI/GUI/resource.rc
index bfc2029b..0f7c6235 100755..100644
--- a/CPP/7zip/UI/GUI/resource.rc
+++ b/CPP/7zip/UI/GUI/resource.rc
@@ -1,10 +1,10 @@
#include "../../MyVersionInfo.rc"
-#include <winnt.h>
+// #include <winnt.h>
#include "resource2.rc"
#include "../FileManager/resourceGui.rc"
-MY_VERSION_INFO_APP("7-Zip GUI", "7zg")
+MY_VERSION_INFO(MY_VFT_APP, "7-Zip GUI", "7zg", "7zg.exe")
IDI_ICON ICON "FM.ico"
@@ -12,10 +12,10 @@ IDI_ICON ICON "FM.ico"
1 24 MOVEABLE PURE "7zG.exe.manifest"
#endif
-#ifdef UNDER_CE
#include "../FileManager/PropertyName.rc"
-#endif
#include "../FileManager/OverwriteDialog.rc"
#include "../FileManager/PasswordDialog.rc"
#include "../FileManager/ProgressDialog2.rc"
#include "Extract.rc"
+#include "../FileManager/BrowseDialog.rc"
+#include "../FileManager/ComboDialog.rc"
diff --git a/CPP/7zip/UI/GUI/resource2.h b/CPP/7zip/UI/GUI/resource2.h
index 4f8b1573..cd882924 100755..100644
--- a/CPP/7zip/UI/GUI/resource2.h
+++ b/CPP/7zip/UI/GUI/resource2.h
@@ -1,3 +1,2 @@
-#define IDS_COMPRESSED_COLON 2277
-#define IDS_ARCHIVES_COLON 2278
-#define IDS_PROGRESS_COMPRESSING 98
+#define IDS_PROGRESS_COMPRESSING 3301
+#define IDS_ARCHIVES_COLON 3907
diff --git a/CPP/7zip/UI/GUI/resource2.rc b/CPP/7zip/UI/GUI/resource2.rc
index 542717ee..49534f50 100755..100644
--- a/CPP/7zip/UI/GUI/resource2.rc
+++ b/CPP/7zip/UI/GUI/resource2.rc
@@ -5,7 +5,6 @@
STRINGTABLE
BEGIN
- IDS_COMPRESSED_COLON "Compressed size:"
- IDS_ARCHIVES_COLON "Archives:"
- IDS_PROGRESS_COMPRESSING "Compressing"
+ IDS_PROGRESS_COMPRESSING "Compressing"
+ IDS_ARCHIVES_COLON "Archives:"
END