9.06 beta

This commit is contained in:
Igor Pavlov
2009-08-17 00:00:00 +00:00
committed by Kornel Lesiński
parent 829409452d
commit c99f3ebdd6
445 changed files with 15246 additions and 8133 deletions

View File

@@ -3,19 +3,18 @@
#include "StdAfx.h"
#include "Common/IntToString.h"
#include "Common/StringToInt.h"
#include "Common/MyException.h"
#include "Windows/Thread.h"
#include "Windows/Error.h"
#include "Windows/System.h"
#include "Windows/Thread.h"
#include "../FileManager/HelpUtils.h"
// #include "BenchmarkDialogRes.h"
#include "BenchmarkDialog.h"
using namespace NWindows;
// const int kNumBenchDictionaryBitsStart = 21;
static LPCWSTR kHelpTopic = L"fm/benchmark.htm";
static const UINT_PTR kTimerID = 4;
@@ -27,6 +26,8 @@ static const UINT kTimerElapse = 1000;
using namespace NWindows;
UString HResultToMessage(HRESULT errorCode);
#ifdef LANG
static CIDLangPair kIDLangPairs[] =
{
@@ -57,17 +58,16 @@ static CIDLangPair kIDLangPairs[] =
};
#endif
static void MyMessageBoxError(HWND hwnd, LPCWSTR message)
{
MessageBoxW(hwnd, message, L"7-Zip", MB_ICONERROR);
}
const LPCTSTR kProcessingString = TEXT("...");
const LPCTSTR kMB = TEXT(" MB");
const LPCTSTR kMIPS = TEXT(" MIPS");
const LPCTSTR kKBs = TEXT(" KB/s");
#ifdef UNDER_CE
static const int kMinDicLogSize = 20;
#else
static const int kMinDicLogSize = 21;
#endif
static const UInt32 kMinDicSize = (1 << kMinDicLogSize);
static const UInt32 kMaxDicSize =
#ifdef _WIN64
@@ -83,39 +83,59 @@ bool CBenchmarkDialog::OnInit()
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
_syncInfo.Init();
Sync.Init();
m_Dictionary.Attach(GetItem(IDC_BENCHMARK_COMBO_DICTIONARY));
int cur = 0;
// _syncInfo.DictionarySize = (1 << kNumBenchDictionaryBitsStart);
UInt32 numCPUs = NSystem::GetNumberOfProcessors();
if (numCPUs < 1)
numCPUs = 1;
numCPUs = MyMin(numCPUs, (UInt32)(1 << 8));
cur = 0;
bool setDefaultThreads = (_syncInfo.NumThreads == (UInt32)(-1));
if (setDefaultThreads)
{
_syncInfo.NumThreads = numCPUs;
if (_syncInfo.NumThreads > 1)
_syncInfo.NumThreads &= ~1;
}
if (Sync.NumThreads == (UInt32)-1)
{
Sync.NumThreads = numCPUs;
if (Sync.NumThreads > 1)
Sync.NumThreads &= ~1;
}
m_NumThreads.Attach(GetItem(IDC_BENCHMARK_COMBO_NUM_THREADS));
int cur = 0;
for (UInt32 num = 1; num <= numCPUs * 2;)
{
TCHAR s[40];
ConvertUInt64ToString(num, s);
int index = (int)m_NumThreads.AddString(s);
m_NumThreads.SetItemData(index, num);
if (num <= Sync.NumThreads)
cur = index;
if (num > 1)
num++;
num++;
}
m_NumThreads.SetCurSel(cur);
Sync.NumThreads = GetNumberOfThreads();
m_Dictionary.Attach(GetItem(IDC_BENCHMARK_COMBO_DICTIONARY));
cur = 0;
UInt64 ramSize = NSystem::GetRamSize();
bool setDefaultDictionary = (_syncInfo.DictionarySize == (UInt32)(-1));
if (setDefaultDictionary)
#ifdef UNDER_CE
const UInt32 kNormalizedCeSize = (16 << 20);
if (ramSize > kNormalizedCeSize && ramSize < (33 << 20))
ramSize = kNormalizedCeSize;
#endif
if (Sync.DictionarySize == (UInt32)-1)
{
int dicSizeLog;
for (dicSizeLog = 25; dicSizeLog >= kBenchMinDicLogSize; dicSizeLog--)
if (GetBenchMemoryUsage(_syncInfo.NumThreads, ((UInt32)1 << dicSizeLog)) + (8 << 20) <= ramSize)
for (dicSizeLog = 25; dicSizeLog > kBenchMinDicLogSize; dicSizeLog--)
if (GetBenchMemoryUsage(Sync.NumThreads, ((UInt32)1 << dicSizeLog)) + (8 << 20) <= ramSize)
break;
_syncInfo.DictionarySize = (1 << dicSizeLog);
Sync.DictionarySize = (1 << dicSizeLog);
}
if (_syncInfo.DictionarySize < kMinDicSize)
_syncInfo.DictionarySize = kMinDicSize;
if (_syncInfo.DictionarySize > kMaxDicSize)
_syncInfo.DictionarySize = kMaxDicSize;
if (Sync.DictionarySize < kMinDicSize)
Sync.DictionarySize = kMinDicSize;
if (Sync.DictionarySize > kMaxDicSize)
Sync.DictionarySize = kMaxDicSize;
for (int i = kMinDicLogSize; i <= 30; i++)
for (int j = 0; j < 2; j++)
@@ -128,35 +148,17 @@ bool CBenchmarkDialog::OnInit()
lstrcat(s, kMB);
int index = (int)m_Dictionary.AddString(s);
m_Dictionary.SetItemData(index, dictionary);
if (dictionary <= _syncInfo.DictionarySize)
if (dictionary <= Sync.DictionarySize)
cur = index;
}
m_Dictionary.SetCurSel(cur);
m_NumThreads.Attach(GetItem(IDC_BENCHMARK_COMBO_NUM_THREADS));
for (UInt32 num = 1; ;)
{
if (num > numCPUs * 2)
break;
TCHAR s[40];
ConvertUInt64ToString(num, s);
int index = (int)m_NumThreads.AddString(s);
m_NumThreads.SetItemData(index, num);
if (num <= numCPUs && setDefaultThreads)
{
_syncInfo.NumThreads = num;
cur = index;
}
if (num > 1)
num++;
num++;
}
m_NumThreads.SetCurSel(cur);
OnChangeSettings();
_syncInfo._startEvent.Set();
Sync._startEvent.Set();
_timer = SetTimer(kTimerID, kTimerElapse);
NormalizePosition();
return CModalDialog::OnInit();
}
@@ -213,11 +215,11 @@ void CBenchmarkDialog::OnChangeSettings()
SetItemText(g_IDs[i], kProcessingString);
_startTime = GetTickCount();
PrintTime();
NWindows::NSynchronization::CCriticalSectionLock lock(_syncInfo.CS);
_syncInfo.Init();
_syncInfo.DictionarySize = dictionary;
_syncInfo.Changed = true;
_syncInfo.NumThreads = GetNumberOfThreads();
NWindows::NSynchronization::CCriticalSectionLock lock(Sync.CS);
Sync.Init();
Sync.DictionarySize = dictionary;
Sync.Changed = true;
Sync.NumThreads = GetNumberOfThreads();
}
void CBenchmarkDialog::OnRestartButton()
@@ -228,7 +230,7 @@ void CBenchmarkDialog::OnRestartButton()
void CBenchmarkDialog::OnStopButton()
{
EnableItem(IDC_BUTTON_STOP, false);
_syncInfo.Pause();
Sync.Pause();
}
void CBenchmarkDialog::OnHelp()
@@ -238,7 +240,7 @@ void CBenchmarkDialog::OnHelp()
void CBenchmarkDialog::OnCancel()
{
_syncInfo.Stop();
Sync.Stop();
KillTimer(_timer);
CModalDialog::OnCancel();
}
@@ -256,7 +258,7 @@ void CBenchmarkDialog::PrintTime()
UInt32 curTime = ::GetTickCount();
UInt32 elapsedTime = (curTime - _startTime);
UInt32 elapsedSec = elapsedTime / 1000;
if (elapsedSec != 0 && _syncInfo.WasPaused())
if (elapsedSec != 0 && Sync.WasPaused())
return;
TCHAR s[40];
GetTimeString(elapsedSec, s);
@@ -310,26 +312,26 @@ void CBenchmarkDialog::PrintResults(
bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
{
PrintTime();
NWindows::NSynchronization::CCriticalSectionLock lock(_syncInfo.CS);
NWindows::NSynchronization::CCriticalSectionLock lock(Sync.CS);
TCHAR s[40];
ConvertUInt64ToString((_syncInfo.ProcessedSize >> 20), s);
ConvertUInt64ToString((Sync.ProcessedSize >> 20), s);
lstrcat(s, kMB);
SetItemText(IDC_BENCHMARK_SIZE_VALUE, s);
ConvertUInt64ToString(_syncInfo.NumPasses, s);
ConvertUInt64ToString(Sync.NumPasses, s);
SetItemText(IDC_BENCHMARK_PASSES_VALUE, s);
/*
ConvertUInt64ToString(_syncInfo.NumErrors, s);
ConvertUInt64ToString(Sync.NumErrors, s);
SetItemText(IDC_BENCHMARK_ERRORS_VALUE, s);
*/
{
UInt32 dicSizeTemp = (UInt32)MyMax(_syncInfo.ProcessedSize, UInt64(1) << 20);
dicSizeTemp = MyMin(dicSizeTemp, _syncInfo.DictionarySize),
UInt32 dicSizeTemp = (UInt32)MyMax(Sync.ProcessedSize, UInt64(1) << 20);
dicSizeTemp = MyMin(dicSizeTemp, Sync.DictionarySize),
PrintResults(dicSizeTemp,
_syncInfo.CompressingInfoTemp,
Sync.CompressingInfoTemp,
IDC_BENCHMARK_COMPRESSING_USAGE,
IDC_BENCHMARK_COMPRESSING_SPEED,
IDC_BENCHMARK_COMPRESSING_RPU,
@@ -338,8 +340,8 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
{
PrintResults(
_syncInfo.DictionarySize,
_syncInfo.CompressingInfo,
Sync.DictionarySize,
Sync.CompressingInfo,
IDC_BENCHMARK_COMPRESSING_USAGE2,
IDC_BENCHMARK_COMPRESSING_SPEED2,
IDC_BENCHMARK_COMPRESSING_RPU2,
@@ -348,8 +350,8 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
{
PrintResults(
_syncInfo.DictionarySize,
_syncInfo.DecompressingInfoTemp,
Sync.DictionarySize,
Sync.DecompressingInfoTemp,
IDC_BENCHMARK_DECOMPRESSING_USAGE,
IDC_BENCHMARK_DECOMPRESSING_SPEED,
IDC_BENCHMARK_DECOMPRESSING_RPU,
@@ -358,26 +360,26 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
}
{
PrintResults(
_syncInfo.DictionarySize,
_syncInfo.DecompressingInfo,
Sync.DictionarySize,
Sync.DecompressingInfo,
IDC_BENCHMARK_DECOMPRESSING_USAGE2,
IDC_BENCHMARK_DECOMPRESSING_SPEED2,
IDC_BENCHMARK_DECOMPRESSING_RPU2,
IDC_BENCHMARK_DECOMPRESSING_RATING2,
true);
if (_syncInfo.DecompressingInfo.GlobalTime > 0 &&
_syncInfo.CompressingInfo.GlobalTime > 0)
if (Sync.DecompressingInfo.GlobalTime > 0 &&
Sync.CompressingInfo.GlobalTime > 0)
{
UInt64 comprRating = GetCompressRating(_syncInfo.DictionarySize,
_syncInfo.CompressingInfo.GlobalTime, _syncInfo.CompressingInfo.GlobalFreq, _syncInfo.CompressingInfo.UnpackSize);
UInt64 decomprRating = GetDecompressRating(_syncInfo.DecompressingInfo.GlobalTime,
_syncInfo.DecompressingInfo.GlobalFreq, _syncInfo.DecompressingInfo.UnpackSize,
_syncInfo.DecompressingInfo.PackSize, 1);
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);
PrintRating((
GetRatingPerUsage(_syncInfo.CompressingInfo, comprRating) +
GetRatingPerUsage(_syncInfo.DecompressingInfo, decomprRating)) / 2, IDC_BENCHMARK_TOTAL_RPU_VALUE);
PrintUsage((GetUsage(_syncInfo.CompressingInfo) + GetUsage(_syncInfo.DecompressingInfo)) / 2, IDC_BENCHMARK_TOTAL_USAGE_VALUE);
GetRatingPerUsage(Sync.CompressingInfo, comprRating) +
GetRatingPerUsage(Sync.DecompressingInfo, decomprRating)) / 2, IDC_BENCHMARK_TOTAL_RPU_VALUE);
PrintUsage((GetUsage(Sync.CompressingInfo) + GetUsage(Sync.DecompressingInfo)) / 2, IDC_BENCHMARK_TOTAL_USAGE_VALUE);
}
}
return true;
@@ -411,7 +413,7 @@ bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
struct CThreadBenchmark
{
CProgressSyncInfo *SyncInfo;
CBenchmarkDialog *BenchmarkDialog;
UInt64 _startTime;
#ifdef EXTERNAL_LZMA
CCodecs *codecs;
@@ -431,33 +433,33 @@ struct CThreadBenchmark
struct CBenchCallback: public IBenchCallback
{
UInt32 dictionarySize;
CProgressSyncInfo *SyncInfo;
CProgressSyncInfo *Sync;
HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
};
HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final)
{
NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
if (SyncInfo->Changed || SyncInfo->Paused || SyncInfo->Stopped)
NSynchronization::CCriticalSectionLock lock(Sync->CS);
if (Sync->Changed || Sync->Paused || Sync->Stopped)
return E_ABORT;
SyncInfo->ProcessedSize = info.UnpackSize;
if (final && SyncInfo->CompressingInfo.GlobalTime == 0)
Sync->ProcessedSize = info.UnpackSize;
if (final && Sync->CompressingInfo.GlobalTime == 0)
{
(CBenchInfo&)SyncInfo->CompressingInfo = info;
if (SyncInfo->CompressingInfo.GlobalTime == 0)
SyncInfo->CompressingInfo.GlobalTime = 1;
(CBenchInfo&)Sync->CompressingInfo = info;
if (Sync->CompressingInfo.GlobalTime == 0)
Sync->CompressingInfo.GlobalTime = 1;
}
else
(CBenchInfo&)SyncInfo->CompressingInfoTemp = info;
(CBenchInfo&)Sync->CompressingInfoTemp = info;
return S_OK;
}
HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
{
NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
if (SyncInfo->Changed || SyncInfo->Paused || SyncInfo->Stopped)
NSynchronization::CCriticalSectionLock lock(Sync->CS);
if (Sync->Changed || Sync->Paused || Sync->Stopped)
return E_ABORT;
CBenchInfo info2 = info;
if (info2.NumIterations == 0)
@@ -467,27 +469,28 @@ HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
info2.PackSize *= info2.NumIterations;
info2.NumIterations = 1;
if (final && SyncInfo->DecompressingInfo.GlobalTime == 0)
if (final && Sync->DecompressingInfo.GlobalTime == 0)
{
(CBenchInfo&)SyncInfo->DecompressingInfo = info2;
if (SyncInfo->DecompressingInfo.GlobalTime == 0)
SyncInfo->DecompressingInfo.GlobalTime = 1;
(CBenchInfo&)Sync->DecompressingInfo = info2;
if (Sync->DecompressingInfo.GlobalTime == 0)
Sync->DecompressingInfo.GlobalTime = 1;
}
else
(CBenchInfo&)SyncInfo->DecompressingInfoTemp = info2;
(CBenchInfo&)Sync->DecompressingInfoTemp = info2;
return S_OK;
}
HRESULT CThreadBenchmark::Process()
{
CProgressSyncInfo &sync = BenchmarkDialog->Sync;
sync.WaitCreating();
try
{
SyncInfo->WaitCreating();
for (;;)
{
if (SyncInfo->WasStopped())
if (sync.WasStopped())
return 0;
if (SyncInfo->WasPaused())
if (sync.WasPaused())
{
Sleep(200);
continue;
@@ -495,18 +498,18 @@ HRESULT CThreadBenchmark::Process()
UInt32 dictionarySize;
UInt32 numThreads;
{
NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
if (SyncInfo->Stopped || SyncInfo->Paused)
NSynchronization::CCriticalSectionLock lock(sync.CS);
if (sync.Stopped || sync.Paused)
continue;
if (SyncInfo->Changed)
SyncInfo->Init();
dictionarySize = SyncInfo->DictionarySize;
numThreads = SyncInfo->NumThreads;
if (sync.Changed)
sync.Init();
dictionarySize = sync.DictionarySize;
numThreads = sync.NumThreads;
}
CBenchCallback callback;
callback.dictionarySize = dictionarySize;
callback.SyncInfo = SyncInfo;
callback.Sync = &sync;
HRESULT result;
try
{
@@ -525,44 +528,46 @@ HRESULT CThreadBenchmark::Process()
{
if (result != E_ABORT)
{
// SyncInfo->NumErrors++;
// sync.NumErrors++;
{
NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
SyncInfo->Pause();
NSynchronization::CCriticalSectionLock lock(sync.CS);
sync.Pause();
}
CSysString message;
UString message;
if (result == S_FALSE)
message = TEXT("Decoding error");
message = L"Decoding error";
else if (result == CLASS_E_CLASSNOTAVAILABLE)
message = L"Can't find 7z.dll";
else
message = NError::MyFormatMessage(result);
MessageBox(0, message, TEXT("7-Zip"), MB_ICONERROR);
message = HResultToMessage(result);
BenchmarkDialog->MessageBoxError(message);
}
}
else
{
NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
SyncInfo->NumPasses++;
NSynchronization::CCriticalSectionLock lock(sync.CS);
sync.NumPasses++;
}
}
// return S_OK;
}
catch(CSystemException &e)
{
MessageBox(0, NError::MyFormatMessage(e.ErrorCode), TEXT("7-Zip"), MB_ICONERROR);
BenchmarkDialog->MessageBoxError(HResultToMessage(e.ErrorCode));
return E_FAIL;
}
catch(...)
{
MyMessageBoxError(0, L"Some error");
BenchmarkDialog->MessageBoxError(HResultToMessage(E_FAIL));
return E_FAIL;
}
}
HRESULT Benchmark(
#ifdef EXTERNAL_LZMA
CCodecs *codecs,
#endif
UInt32 numThreads, UInt32 dictionarySize)
#ifdef EXTERNAL_LZMA
CCodecs *codecs,
#endif
UInt32 numThreads, UInt32 dictionarySize, HWND hwndParent)
{
CThreadBenchmark benchmarker;
#ifdef EXTERNAL_LZMA
@@ -570,12 +575,12 @@ HRESULT Benchmark(
#endif
CBenchmarkDialog benchmarkDialog;
benchmarkDialog._syncInfo.DictionarySize = dictionarySize;
benchmarkDialog._syncInfo.NumThreads = numThreads;
benchmarkDialog.Sync.DictionarySize = dictionarySize;
benchmarkDialog.Sync.NumThreads = numThreads;
benchmarker.SyncInfo = &benchmarkDialog._syncInfo;
benchmarker.BenchmarkDialog = &benchmarkDialog;
NWindows::CThread thread;
RINOK(thread.Create(CThreadBenchmark::MyThreadFunction, &benchmarker));
benchmarkDialog.Create(0);
benchmarkDialog.Create(hwndParent);
return thread.Wait();
}

View File

@@ -1,11 +1,8 @@
// BenchmarkDialog.h
#ifndef __BENCHMARKDIALOG_H
#define __BENCHMARKDIALOG_H
#ifndef __BENCHMARK_DIALOG_H
#define __BENCHMARK_DIALOG_H
#include "BenchmarkDialogRes.h"
#include "Windows/Control/Dialog.h"
#include "Windows/Control/ComboBox.h"
#include "Windows/Synchronization.h"
#include "../../Compress/LZMA_Alone/LzmaBench.h"
@@ -14,6 +11,10 @@
#include "../Common/LoadCodecs.h"
#endif
#include "../FileManager/DialogSize.h"
#include "BenchmarkDialogRes.h"
struct CBenchInfo2 : public CBenchInfo
{
void Init() { GlobalTime = UserTime = 0; }
@@ -116,16 +117,24 @@ class CBenchmarkDialog:
UInt32 OnChangeDictionary();
void OnChangeSettings();
public:
CProgressSyncInfo _syncInfo;
CProgressSyncInfo Sync;
CBenchmarkDialog(): _timer(0) {}
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_BENCHMARK, wndParent); }
INT_PTR Create(HWND wndParent = 0)
{
BIG_DIALOG_SIZE(332, 228);
return CModalDialog::Create(SIZED_DIALOG(IDD_DIALOG_BENCHMARK), wndParent);
}
void MessageBoxError(LPCWSTR message)
{
MessageBoxW(*this, message, L"7-Zip", MB_ICONERROR);
}
};
HRESULT Benchmark(
#ifdef EXTERNAL_LZMA
CCodecs *codecs,
#endif
UInt32 dictionarySize, UInt32 numThreads);
#ifdef EXTERNAL_LZMA
CCodecs *codecs,
#endif
UInt32 dictionarySize, UInt32 numThreads, HWND hwndParent = NULL);
#endif

View File

@@ -1,116 +1,227 @@
#include "BenchmarkDialogRes.h"
#include "../../GuiCommon.rc"
#define xSize2 330
#define ySize2 228
#define xc 332
#define yc 228
#define xSize (xSize2 + marg + marg)
#define ySize (ySize2 + marg + marg)
#undef g0xs
#undef g1x
#undef g1xs
#undef g2xs
#undef g3x
#undef g3xs
#undef g4x
#undef g0XSize
#undef g1XPos
#undef g1XSize
#undef g2XSize
#undef g3XPos
#undef g3XSize
#define bXPos1 (xSize - marg - bXSize)
#define bXPos2 (bXPos1 - 10 - bXSize)
#define bYPos (ySize - marg - bYSize)
#define gSize 160
#define gs 160
#define gSpace 24
#define g0XSize 90
#define g1XSize 44
#define g1XPos (marg + g0XSize)
#define gc2XPos (g1XPos + g1XSize + 10)
#define gc2XSize 80
#define g0xs 90
#define g1xs 44
#define g1x (m + g0xs)
#define gc2x (g1x + g1xs + m)
#define gc2xs 80
#define g10XPos (marg + marg)
#define g4x (m + m)
#define gRatingSize 60
#define gSpeedSize 60
#define gUsageSize 60
#define gRpuSize 60
#define sRating 60
#define sSpeed 60
#define sUsage 60
#define sRpu 60
#define gRatingPos (xSize - marg - marg - gRatingSize)
#define gRpuPos (gRatingPos - gRpuSize)
#define gUsagePos (gRpuPos - gUsageSize)
#define gSpeedPos (gUsagePos - gSpeedSize)
#define xRating (xs - m - m - sRating)
#define xRpu (xRating - sRpu)
#define xUsage (xRpu - sUsage)
#define xSpeed (xUsage - sSpeed)
#define gLabelSize (gUsagePos - g10XPos)
#define gTotalRatingSize (gUsageSize + gRpuSize + gRatingSize + marg + marg)
#define gTotalRatingPos (xSize - marg - gTotalRatingSize)
#define sLabel (xUsage - g4x)
#define sTotalRating (sUsage + sRpu + sRating + m + m)
#define xTotalRating (xs - m - sTotalRating)
#define g2XSize 58
#define g3XSize 36
#define g3XPos (marg + g2XSize)
#define g2xs 58
#define g3xs 36
#define g3x (m + g2xs)
IDD_DIALOG_BENCHMARK DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
IDD_DIALOG_BENCHMARK DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
CAPTION "Benchmark"
MY_FONT
BEGIN
PUSHBUTTON "&Restart", IDC_BUTTON_RESTART, bXPos1, marg, bXSize, bYSize
PUSHBUTTON "&Stop", IDC_BUTTON_STOP, bXPos1, 27, bXSize, bYSize
PUSHBUTTON "&Restart", IDC_BUTTON_RESTART, bx1, m, bxs, bys
PUSHBUTTON "&Stop", IDC_BUTTON_STOP, bx1, m + bys + 6, bxs, bys
PUSHBUTTON "&Help", IDHELP, bXPos2, bYPos, bXSize,bYSize
PUSHBUTTON "Cancel", IDCANCEL, bXPos1, bYPos, bXSize, bYSize
PUSHBUTTON "&Help", IDHELP, bx2, by, bxs, bys
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
LTEXT "&Dictionary size:", IDC_BENCHMARK_DICTIONARY, marg, marg + 1, g0XSize, 8
COMBOBOX IDC_BENCHMARK_COMBO_DICTIONARY, g1XPos, marg, g1XSize, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
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, marg, 24, g0XSize, 8
COMBOBOX IDC_BENCHMARK_COMBO_NUM_THREADS, g1XPos, 23, g1XSize, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
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
LTEXT "Memory usage:", IDC_BENCHMARK_MEMORY, gc2XPos, marg + 1, gc2XSize, 8
LTEXT "0 MB", IDC_BENCHMARK_MEMORY_VALUE, gc2XPos + gc2XSize, marg + 1, 40, 8
LTEXT "1", IDC_BENCHMARK_HARDWARE_THREADS, gc2XPos, 24, 40, 8
RTEXT "CPU Usage", IDC_BENCHMARK_USAGE_LABEL, gUsagePos, 53, gUsageSize, 8
RTEXT "Speed", IDC_BENCHMARK_SPEED_LABEL, gSpeedPos, 53, gSpeedSize, 8
RTEXT "Rating / Usage", IDC_BENCHMARK_RPU_LABEL, gRpuPos, 53, gRpuSize, 8
RTEXT "Rating", IDC_BENCHMARK_RATING_LABEL, gRatingPos, 53, gRatingSize, 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
GROUPBOX "Compressing", IDC_BENCHMARK_COMPRESSING, marg, 64, xSize2, 40
GROUPBOX "Compressing", IDC_BENCHMARK_COMPRESSING, m, 64, xc, 40
LTEXT "Current", IDC_BENCHMARK_CURRENT, g10XPos, 76, gLabelSize, 8
RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE, gUsagePos, 76, gUsageSize, 8
RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED, gSpeedPos, 76, gSpeedSize, 8
RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU, gRpuPos, 76, gRpuSize, 8
RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING, gRatingPos, 76, gRatingSize, 8
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 "Resulting", IDC_BENCHMARK_RESULTING, g10XPos, 89, gLabelSize, 8
RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE2, gUsagePos, 89, gUsageSize, 8
RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED2, gSpeedPos, 89, gSpeedSize, 8
RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU2, gRpuPos, 89, gRpuSize, 8
RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING2, gRatingPos, 89, gRatingSize, 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
GROUPBOX "Decompressing", IDC_BENCHMARK_DECOMPRESSING, marg, 111, xSize2, 40
GROUPBOX "Decompressing", IDC_BENCHMARK_DECOMPRESSING, m, 111, xc, 40
LTEXT "Current", IDC_BENCHMARK_CURRENT2, g10XPos, 123, gLabelSize, 8
RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE, gUsagePos, 123, gUsageSize, 8
RTEXT "100 KB/s", IDC_BENCHMARK_DECOMPRESSING_SPEED, gSpeedPos, 123, gSpeedSize, 8
RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU, gRpuPos, 123, gRpuSize, 8
RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING, gRatingPos, 123, gRatingSize, 8
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 "Resulting", IDC_BENCHMARK_RESULTING2, g10XPos, 136, gLabelSize, 8
RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE2, gUsagePos, 136, gUsageSize, 8
RTEXT "100 KB/s", IDC_BENCHMARK_DECOMPRESSING_SPEED2, gSpeedPos, 136, gSpeedSize, 8
RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU2, gRpuPos, 136, gRpuSize, 8
RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING2, gRatingPos, 136, gRatingSize, 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
GROUPBOX "Total Rating", IDC_BENCHMARK_TOTAL_RATING, gTotalRatingPos, 163, gTotalRatingSize, 38
RTEXT "0", IDC_BENCHMARK_TOTAL_USAGE_VALUE, gUsagePos, 181, gUsageSize, 8
RTEXT "0", IDC_BENCHMARK_TOTAL_RPU_VALUE, gRpuPos, 181, gRpuSize, 8
RTEXT "0", IDC_BENCHMARK_TOTAL_RATING_VALUE, gRatingPos, 181, gRatingSize, 8
GROUPBOX "Total Rating", IDC_BENCHMARK_TOTAL_RATING, xTotalRating, 163, sTotalRating, 38
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
LTEXT "Elapsed time:", IDC_BENCHMARK_ELAPSED, marg, 163, g2XSize, 8
LTEXT "Size:", IDC_BENCHMARK_SIZE, marg, 176, g2XSize, 8
LTEXT "Passes:", IDC_BENCHMARK_PASSES, marg, 189, g2XSize, 8
RTEXT "00:00:00", IDC_BENCHMARK_ELAPSED_VALUE, g3XPos, 163, g3XSize, 8
RTEXT "0", IDC_BENCHMARK_SIZE_VALUE, g3XPos, 176, g3XSize, 8
RTEXT "0", IDC_BENCHMARK_PASSES_VALUE, g3XPos, 189, g3XSize, 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
END
#ifdef UNDER_CE
#undef m
#define m 4
#undef xc
#undef yc
#define xc 154
#define yc 160
#undef g0xs
#undef g1x
#undef g1xs
#undef g2xs
#undef g3x
#undef g3xs
#undef bxs
#undef bys
#define bxs 60
#define bys 14
#undef gs
#undef gSpace
#define gs 160
#define gSpace 24
#define g0xs (xc - bxs)
#define g1xs 44
#undef g4x
#define g4x (m)
#undef xRpu
#undef xUsage
#undef xRating
#undef xTotalRating
#undef sRpu
#undef sRating
#undef sUsage
#undef sLabel
#undef sTotalRating
#define sRating 40
#define sUsage 24
#define sRpu 40
#define xRating (xs - m - sRating)
#define xRpu (xRating - sRpu)
#define xUsage (xRpu - sUsage)
#define sLabel (xUsage - g4x)
#define sTotalRating (sRpu + sRating)
#define xTotalRating (xs - m - sTotalRating)
#define g3xs 32
#define g3x (xRpu - g3xs)
#define g2xs (g3x - m)
IDD_DIALOG_BENCHMARK_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
LTEXT "&Dictionary size:", IDC_BENCHMARK_DICTIONARY, m, m, g0xs, 8
COMBOBOX IDC_BENCHMARK_COMBO_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 "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 "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 "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 "Compressing", IDC_BENCHMARK_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 "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 "Decompressing", IDC_BENCHMARK_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
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
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
END
#endif

View File

@@ -1,4 +1,5 @@
#define IDD_DIALOG_BENCHMARK 800
#define IDD_DIALOG_BENCHMARK 550
#define IDD_DIALOG_BENCHMARK_2 650
#define IDC_BUTTON_STOP 1001
#define IDC_BUTTON_RESTART 1002
#define IDC_BENCHMARK_DICTIONARY 1010

View File

@@ -2,16 +2,14 @@
#include "StdAfx.h"
#include "Common/Defs.h"
#include "Common/IntToString.h"
#include "Common/StringConvert.h"
#include "Windows/CommonDialog.h"
#include "Windows/FileDir.h"
#include "Windows/FileName.h"
#include "Windows/ResourceString.h"
#include "Windows/System.h"
#include "../FileManager/BrowseDialog.h"
#include "../FileManager/FormatUtils.h"
#include "../FileManager/HelpUtils.h"
#include "../FileManager/SplitUtils.h"
@@ -22,8 +20,6 @@
#include "CompressDialog.h"
#include "resource.h"
#ifndef _UNICODE
extern bool g_IsNT;
#endif
@@ -249,7 +245,7 @@ static UInt64 GetMaxRamSizeForProgram()
physSize = 0;
else
physSize -= kMinSysSize;
const UInt64 kMinUseSize = (1 << 25);
const UInt64 kMinUseSize = (1 << 24);
if (physSize < kMinUseSize)
physSize = kMinUseSize;
return physSize;
@@ -282,23 +278,24 @@ bool CCompressDialog::OnInit()
AddVolumeItems(m_Volume);
ReadCompressionInfo(m_RegistryInfo);
m_RegistryInfo.Load();
CheckButton(IDC_COMPRESS_CHECK_SHOW_PASSWORD, m_RegistryInfo.ShowPassword);
CheckButton(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, m_RegistryInfo.EncryptHeaders);
UpdatePasswordControl();
Info.ArchiverInfoIndex = 0;
Info.FormatIndex = -1;
int i;
for (i = 0; i < m_ArchiverInfoList.Size(); i++)
for (i = 0; i < ArcIndices.Size(); i++)
{
const CArcInfoEx &ai = m_ArchiverInfoList[i];
int arcIndex = ArcIndices[i];
const CArcInfoEx &ai = (*ArcFormats)[arcIndex];
int index = (int)m_Format.AddString(ai.Name);
m_Format.SetItemData(index, i);
if (ai.Name.CompareNoCase(m_RegistryInfo.ArchiveType) == 0 || i == 0)
m_Format.SetItemData(index, arcIndex);
if (ai.Name.CompareNoCase(m_RegistryInfo.ArcType) == 0 || i == 0)
{
m_Format.SetCurSel(index);
Info.ArchiverInfoIndex = i;
Info.FormatIndex = arcIndex;
}
}
@@ -306,8 +303,8 @@ bool CCompressDialog::OnInit()
SetLevel();
SetParams();
for (i = 0; i < m_RegistryInfo.HistoryArchives.Size() && i < kHistorySize; i++)
m_ArchivePath.AddString(m_RegistryInfo.HistoryArchives[i]);
for (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));
@@ -332,6 +329,9 @@ bool CCompressDialog::OnInit()
SetEncryptionMethod();
SetMemoryUsage();
NormalizePosition();
return CModalDialog::OnInit();
}
@@ -339,7 +339,9 @@ namespace NCompressDialog
{
bool CInfo::GetFullPathName(UString &result) const
{
#ifndef UNDER_CE
NDirectory::MySetCurrentDirectory(CurrentDirPrefix);
#endif
return MyGetFullPathName(ArchiveName, result);
}
}
@@ -491,7 +493,7 @@ void CCompressDialog::OnButtonSetArchive()
UString s = LangString(IDS_OPEN_TYPE_ALL_FILES, 0x02000DB1);
s += L" (*.*)";
UString resPath;
if (!MyGetOpenFileName(HWND(*this), title, fullFileName, s, resPath))
if (!MyBrowseForFile(HWND(*this), title, fullFileName, s, resPath))
return;
m_ArchivePath.SetText(resPath);
}
@@ -546,8 +548,8 @@ void CCompressDialog::OnOK()
UString s;
m_ArchivePath.GetText(s);
s.Trim();
m_RegistryInfo.HistoryArchives.Clear();
AddUniqueString(m_RegistryInfo.HistoryArchives, s);
m_RegistryInfo.ArcPaths.Clear();
AddUniqueString(m_RegistryInfo.ArcPaths, s);
Info.ArchiveName = s;
Info.UpdateMode = NCompressDialog::NUpdateMode::EEnum(m_UpdateMode.GetCurSel());
@@ -564,7 +566,7 @@ void CCompressDialog::OnOK()
Info.Method = GetMethodSpec();
Info.EncryptionMethod = GetEncryptionMethodSpec();
Info.ArchiverInfoIndex = GetFormatIndex();
Info.FormatIndex = GetFormatIndex();
Info.SFXMode = IsSFX();
Info.OpenShareForWrite = IsButtonCheckedBool(IDC_COMPRESS_SHARED);
@@ -590,7 +592,7 @@ void CCompressDialog::OnOK()
wchar_t s[32];
ConvertUInt64ToString(volumeSize, s);
if (::MessageBoxW(*this, MyFormatNew(IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE, 0x02000D42, s),
L"7-Zip", MB_YESNOCANCEL | MB_ICONQUESTION | MB_TASKMODAL) != IDYES)
L"7-Zip", MB_YESNOCANCEL | MB_ICONQUESTION) != IDYES)
return;
}
}
@@ -601,15 +603,15 @@ void CCompressDialog::OnOK()
UString sTemp;
m_ArchivePath.GetLBText(i, sTemp);
sTemp.Trim();
AddUniqueString(m_RegistryInfo.HistoryArchives, sTemp);
AddUniqueString(m_RegistryInfo.ArcPaths, sTemp);
}
if (m_RegistryInfo.HistoryArchives.Size() > kHistorySize)
m_RegistryInfo.HistoryArchives.DeleteBack();
if (m_RegistryInfo.ArcPaths.Size() > kHistorySize)
m_RegistryInfo.ArcPaths.DeleteBack();
m_RegistryInfo.ArchiveType = m_ArchiverInfoList[Info.ArchiverInfoIndex].Name;
m_RegistryInfo.ArcType = (*ArcFormats)[Info.FormatIndex].Name;
m_RegistryInfo.ShowPassword = IsShowPasswordChecked();
SaveCompressionInfo(m_RegistryInfo);
m_RegistryInfo.Save();
CModalDialog::OnOK();
}
@@ -643,9 +645,9 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
}
case IDC_COMPRESS_COMBO_LEVEL:
{
const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormatAlways(ai.Name);
NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
fo.ResetForLevelChange();
SetMethod();
SetSolidBlockSize();
@@ -693,7 +695,7 @@ void CCompressDialog::SetArchiveName2(bool prevWasSFX)
{
UString fileName;
m_ArchivePath.GetText(fileName);
const CArcInfoEx &prevArchiverInfo = m_ArchiverInfoList[m_PrevFormat];
const CArcInfoEx &prevArchiverInfo = (*ArcFormats)[m_PrevFormat];
if (prevArchiverInfo.KeepName || Info.KeepName)
{
UString prevExtension = prevArchiverInfo.GetMainExt();
@@ -716,9 +718,9 @@ void CCompressDialog::SetArchiveName2(bool prevWasSFX)
void CCompressDialog::SetArchiveName(const UString &name)
{
UString fileName = name;
Info.ArchiverInfoIndex = GetFormatIndex();
const CArcInfoEx &ai = m_ArchiverInfoList[Info.ArchiverInfoIndex];
m_PrevFormat = Info.ArchiverInfoIndex;
Info.FormatIndex = GetFormatIndex();
const CArcInfoEx &ai = (*ArcFormats)[Info.FormatIndex];
m_PrevFormat = Info.FormatIndex;
if (ai.KeepName)
{
fileName = OriginalFileName;
@@ -746,10 +748,10 @@ void CCompressDialog::SetArchiveName(const UString &name)
int CCompressDialog::FindRegistryFormat(const UString &name)
{
for (int i = 0; i < m_RegistryInfo.FormatOptionsVector.Size(); i++)
for (int i = 0; i < m_RegistryInfo.Formats.Size(); i++)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[i];
if (GetUnicodeString(fo.FormatID) == name)
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[i];
if (name.CompareNoCase(GetUnicodeString(fo.FormatID)) == 0)
return i;
}
return -1;
@@ -762,7 +764,7 @@ int CCompressDialog::FindRegistryFormatAlways(const UString &name)
{
NCompression::CFormatOptions fo;
fo.FormatID = GetSystemString(name);
index = m_RegistryInfo.FormatOptionsVector.Add(fo);
index = m_RegistryInfo.Formats.Add(fo);
}
return index;
}
@@ -770,7 +772,7 @@ int CCompressDialog::FindRegistryFormatAlways(const UString &name)
int CCompressDialog::GetStaticFormatIndex()
{
int formatIndex = GetFormatIndex();
const CArcInfoEx &ai = m_ArchiverInfoList[formatIndex];
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)
return i;
@@ -793,12 +795,12 @@ void CCompressDialog::SetLevel()
{
m_Level.ResetContent();
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UInt32 level = kNormal;
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
if (fo.Level <= kUltra)
level = fo.Level;
else
@@ -829,12 +831,12 @@ void CCompressDialog::SetMethod(int keepMethodId)
return;
}
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UString defaultMethod;
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
defaultMethod = fo.Method;
}
bool isSfx = IsSFX();
@@ -865,14 +867,14 @@ void CCompressDialog::SetMethod(int keepMethodId)
bool CCompressDialog::IsZipFormat()
{
const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
return (ai.Name.CompareNoCase(L"zip") == 0);
}
void CCompressDialog::SetEncryptionMethod()
{
_encryptionMethod.ResetContent();
const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
if (ai.Name.CompareNoCase(L"7z") == 0)
{
_encryptionMethod.AddString(TEXT("AES-256"));
@@ -884,7 +886,7 @@ void CCompressDialog::SetEncryptionMethod()
UString encryptionMethod;
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
encryptionMethod = fo.EncryptionMethod;
}
_encryptionMethod.AddString(TEXT("ZipCrypto"));
@@ -960,12 +962,12 @@ int CCompressDialog::AddDictionarySize(UInt32 size)
void CCompressDialog::SetDictionary()
{
m_Dictionary.ResetContent();
const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UInt32 defaultDictionary = UInt32(-1);
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
defaultDictionary = fo.Dictionary;
}
@@ -1105,12 +1107,12 @@ int CCompressDialog::AddOrder(UInt32 size)
void CCompressDialog::SetOrder()
{
m_Order.ResetContent();
const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UInt32 defaultOrder = UInt32(-1);
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
defaultOrder = fo.Order;
}
@@ -1224,11 +1226,11 @@ void CCompressDialog::SetSolidBlockSize()
UInt32 defaultBlockSize = (UInt32)-1;
const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
defaultBlockSize = fo.BlockLogSize;
}
@@ -1268,12 +1270,12 @@ void CCompressDialog::SetNumThreads()
UInt32 numHardwareThreads = NSystem::GetNumberOfProcessors();
UInt32 defaultValue = numHardwareThreads;
const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
if (fo.Method.CompareNoCase(GetMethodSpec()) == 0 && fo.NumThreads != (UInt32)-1)
defaultValue = fo.NumThreads;
}
@@ -1422,23 +1424,23 @@ void CCompressDialog::SetMemoryUsage()
void CCompressDialog::SetParams()
{
const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
m_Params.SetText(TEXT(""));
int index = FindRegistryFormat(ai.Name);
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
m_Params.SetText(fo.Options);
}
}
void CCompressDialog::SaveOptionsInMem()
{
const CArcInfoEx &ai = m_ArchiverInfoList[Info.ArchiverInfoIndex];
const CArcInfoEx &ai = (*ArcFormats)[Info.FormatIndex];
int index = FindRegistryFormatAlways(ai.Name);
m_Params.GetText(Info.Options);
Info.Options.Trim();
NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
fo.Options = Info.Options;
fo.Level = GetLevelSpec();
fo.Dictionary = GetDictionarySpec();

View File

@@ -4,12 +4,13 @@
#define __COMPRESS_DIALOG_H
#include "Windows/Control/ComboBox.h"
#include "Windows/Control/Dialog.h"
#include "Windows/Control/Edit.h"
#include "../Common/LoadCodecs.h"
#include "../Common/ZipRegistry.h"
#include "../FileManager/DialogSize.h"
#include "CompressDialogRes.h"
namespace NCompressDialog
@@ -53,7 +54,7 @@ namespace NCompressDialog
bool GetFullPathName(UString &result) const;
int ArchiverInfoIndex;
int FormatIndex;
UString Password;
bool EncryptHeadersIsAllowed;
@@ -155,13 +156,17 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
int GetFormatIndex();
public:
CObjectVector<CArcInfoEx> m_ArchiverInfoList;
CObjectVector<CArcInfoEx> *ArcFormats;
CRecordVector<int> ArcIndices;
NCompressDialog::CInfo Info;
UString OriginalFileName; // for bzip2, gzip2
INT_PTR Create(HWND wndParent = 0)
{ return CModalDialog::Create(IDD_DIALOG_COMPRESS, wndParent); }
{
BIG_DIALOG_SIZE(400, 304);
return CModalDialog::Create(SIZED_DIALOG(IDD_DIALOG_COMPRESS), wndParent);
}
protected:

View File

@@ -1,124 +1,187 @@
#include "CompressDialogRes.h"
#include "../../GuiCommon.rc"
#define xSize2 400
#define ySize2 305
#define xSize (xSize2 + marg + marg)
#define ySize (ySize2 + marg + marg)
#define xc 400
#define yc 304
#undef gSize
#undef gSpace
#undef g0XSize
#undef g1XPos
#undef g1XSize
#undef g2XSize
#undef g3XPos
#undef g3XSize
#undef g4XPos
#undef g4XPos2
#undef g4XSize
#undef g4XSize2
#undef bXPos1
#undef bXPos2
#undef bXPos3
#undef bYPos
#undef g0xs
#undef g1x
#undef g1xs
#undef g2xs
#undef g3x
#undef g3xs
#undef g4x
#undef g4x2
#undef g4xs
#undef g4xs2
#define gSize 190
#define gSize 192
#define gSpace 24
#define g1XSize 90
#define g0XSize (gSize - g1XSize)
#define g1XPos (marg + g0XSize)
#define g1xs 88
#define g0xs (gSize - g1xs)
#define g1x (m + g0xs)
#define g3XSize 40
#define g2XSize (gSize - g3XSize)
#define g3XPos (marg + g2XSize)
#define g3xs 40
#define g2xs (gSize - g3xs)
#define g3x (m + g2xs)
#define g4XPos (marg + gSize + gSpace)
#define g4XPos2 (g4XPos + 7)
#define g4XSize (xSize2 - gSize - gSpace)
#define g4XSize2 (g4XSize - 14)
#define g4x (m + gSize + gSpace)
#define g4x2 (g4x + m)
#define g4xs (xc - gSize - gSpace)
#define g4xs2 (g4xs - m - m)
#define OptYPos 73
#define PswYPos 128
#define yOpt 72
#define yPsw 128
#define bXPos1 (xSize - marg - bXSize)
#define bXPos2 (bXPos1 - 10 - bXSize)
#define bXPos3 (bXPos2 - 10 - bXSize)
IDD_DIALOG_COMPRESS MY_DIALOG
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
#define bYPos (ySize - marg - bYSize)
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 "Compression &level:",IDC_STATIC_COMPRESS_LEVEL, m, 62, g0xs, 8
COMBOBOX IDC_COMPRESS_COMBO_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
IDD_DIALOG_COMPRESS DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
LTEXT "&Dictionary size:",IDC_STATIC_COMPRESS_DICTIONARY, m, 104, g0xs, 8
COMBOBOX IDC_COMPRESS_COMBO_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 "&Solid Block size:",IDC_STATIC_COMPRESS_SOLID, m, 146, g0xs, 8
COMBOBOX IDC_COMPRESS_COMBO_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 "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 Decompressing:", IDC_STATIC_COMPRESS_MEMORY_DE, m, 206, g2xs, 8
RTEXT "0",IDC_STATIC_COMPRESS_MEMORY_DE_VALUE, g3x, 206, g3xs, 8
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 "&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",IDC_STATIC_COMPRESS_OPTIONS, g4x, yOpt, g4xs, 48
CONTROL "Create SF&X archive",IDC_COMPRESS_SFX, MY_CHECKBOX,
g4x2, yOpt + 14, g4xs2, 10
CONTROL "Compress shared files",IDC_COMPRESS_SHARED, MY_CHECKBOX,
g4x2, yOpt + 30, g4xs2, 10
GROUPBOX "Encryption",IDC_COMPRESS_ENCRYPTION, g4x, yPsw, g4xs, 127
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
CONTROL "Show Password",IDC_COMPRESS_CHECK_SHOW_PASSWORD,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
CONTROL "Encrypt file &names", IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, MY_CHECKBOX,
g4x2, yPsw + 111, g4xs2, 10
DEFPUSHBUTTON "OK", IDOK, bx3, by, bxs, bys, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, bx2, by, bxs, bys
PUSHBUTTON "Help", IDHELP, bx1, by, bxs, bys
END
#ifdef UNDER_CE
#undef m
#undef xc
#undef yc
#define m 4
#define xc 152
#define yc 160
IDD_DIALOG_COMPRESS_2 MY_DIALOG
CAPTION "Add to Archive"
MY_FONT
BEGIN
LTEXT "&Archive:", IDC_STATIC_COMPRESS_ARCHIVE, marg, marg, xSize2, 8
COMBOBOX IDC_COMPRESS_COMBO_ARCHIVE, marg, 18, xSize2 - bDotsSize - 12, 126, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...", IDC_COMPRESS_BUTTON_SET_ARCHIVE, xSize - marg - bDotsSize, 17, bDotsSize, bYSize, WS_GROUP
// 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
LTEXT "Archive &format:", IDC_STATIC_COMPRESS_FORMAT, marg, 41, g0XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_FORMAT, g1XPos, 39, g1XSize , 80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
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_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
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
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
CONTROL "Compress shared files", IDC_COMPRESS_SHARED, MY_CHECKBOX, m, 94, xc, 10
LTEXT "Compression &level:",IDC_STATIC_COMPRESS_LEVEL, marg, 62, g0XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_LEVEL, g1XPos, 60, g1XSize, 80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
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
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
LTEXT "Compression &method:",IDC_STATIC_COMPRESS_METHOD, marg, 83, g0XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_METHOD, g1XPos, 81, g1XSize, 80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Dictionary size:",IDC_STATIC_COMPRESS_DICTIONARY, marg, 104, g0XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_DICTIONARY, g1XPos, 102, g1XSize, 167, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Word size:",IDC_STATIC_COMPRESS_ORDER, marg, 125, g0XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_ORDER, g1XPos, 123, g1XSize, 141, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Solid Block size:",IDC_STATIC_COMPRESS_SOLID, marg, 146, g0XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_SOLID, g1XPos, 144, g1XSize, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Number of CPU threads:",IDC_STATIC_COMPRESS_THREADS, marg, 167, g0XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_THREADS, g1XPos, 165, g1XSize - 35, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "1", IDC_COMPRESS_HARDWARE_THREADS, g1XPos + g1XSize - 35 + 10, 167, 25, 8
LTEXT "Memory usage for Compressing:", IDC_STATIC_COMPRESS_MEMORY, marg, 190, g2XSize, 8
RTEXT "0", IDC_STATIC_COMPRESS_MEMORY_VALUE, g3XPos, 190, g3XSize, 8
LTEXT "Memory usage for Decompressing:", IDC_STATIC_COMPRESS_MEMORY_DE, marg, 206, g2XSize, 8
RTEXT "0",IDC_STATIC_COMPRESS_MEMORY_DE_VALUE, g3XPos, 206, g3XSize, 8
LTEXT "Split to &volumes, bytes:", IDC_STATIC_COMPRESS_VOLUME, marg, 225, gSize, 8
COMBOBOX IDC_COMPRESS_COMBO_VOLUME, marg, 237, gSize, 73, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
LTEXT "&Parameters:",IDC_STATIC_COMPRESS_PARAMETERS, marg, 260, xSize2, 8
EDITTEXT IDC_COMPRESS_EDIT_PARAMETERS, marg, 272, xSize2, 14, ES_AUTOHSCROLL
LTEXT "&Update mode:",IDC_STATIC_COMPRESS_UPDATE_MODE, g4XPos, 39, g4XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_UPDATE_MODE, g4XPos, 51, g4XSize, 80, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Options",IDC_STATIC_COMPRESS_OPTIONS, g4XPos, OptYPos, g4XSize, 48
CONTROL "Create SF&X archive",IDC_COMPRESS_SFX, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
g4XPos2, OptYPos + 14, g4XSize2, 10
CONTROL "Compress shared files",IDC_COMPRESS_SHARED, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
g4XPos2, OptYPos + 30, g4XSize2, 10
GROUPBOX "Encryption",IDC_COMPRESS_ENCRYPTION, g4XPos, PswYPos, g4XSize, 127
LTEXT "Enter password:",IDC_STATIC_COMPRESS_PASSWORD1, g4XPos2, PswYPos + 14, g4XSize2, 8
EDITTEXT IDC_COMPRESS_EDIT_PASSWORD1, g4XPos2, PswYPos + 26, g4XSize2, 14, ES_PASSWORD | ES_AUTOHSCROLL
LTEXT "Reenter password:",IDC_STATIC_COMPRESS_PASSWORD2, g4XPos2, PswYPos + 46, g4XSize2, 8
EDITTEXT IDC_COMPRESS_EDIT_PASSWORD2, g4XPos2, PswYPos + 58, g4XSize2, 14, ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Show Password",IDC_COMPRESS_CHECK_SHOW_PASSWORD,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
g4XPos2, PswYPos + 79, g4XSize2, 10
LTEXT "&Encryption method:",IDC_STATIC_COMPRESS_ENCRYPTION_METHOD, g4XPos2, PswYPos + 95, 100, 8
COMBOBOX IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, g4XPos2 + 100, PswYPos + 93, g4XSize2 - 100, 198, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Encrypt file &names", IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
g4XPos2, PswYPos + 111, g4XSize2, 10
DEFPUSHBUTTON "OK", IDOK, bXPos3, bYPos, bXSize, bYSize, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, bXPos2, bYPos, bXSize, bYSize
PUSHBUTTON "Help", IDHELP, bXPos1, bYPos, bXSize, bYSize
OK_CANCEL
END
#endif
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_COMPRESS_NON_SOLID "Non-solid"
IDS_COMPRESS_SOLID "Solid"
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_OPEN_TYPE_ALL_FILES "All Files"
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"
END

View File

@@ -1,4 +1,5 @@
#define IDD_DIALOG_COMPRESS 152
#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
@@ -50,3 +51,31 @@
#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

View File

@@ -20,4 +20,14 @@ BEGIN
IDS_MEM_ERROR "The system cannot allocate the required amount of memory"
IDS_UNKNOWN_ERROR "Unknown Error"
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"
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"
END

View File

@@ -7,7 +7,7 @@
#include "ExtractDialog.h"
#include "Common/StringConvert.h"
#include "Windows/Shell.h"
#include "Windows/FileName.h"
#include "Windows/FileDir.h"
#include "Windows/ResourceString.h"
@@ -18,35 +18,47 @@
#include "../Common/ZipRegistry.h"
#include "../FileManager/BrowseDialog.h"
#include "../FileManager/LangUtils.h"
#include "../FileManager/resourceGui.h"
#include "ExtractRes.h"
#include "ExtractDialogRes.h"
// #include "Help/Context/Extract.h"
using namespace NWindows;
using namespace NFile;
using namespace NName;
static const int kPathModeButtons[] =
extern HINSTANCE g_hInstance;
static CIDLangPair kPathMode_Pairs[] =
{
IDC_EXTRACT_RADIO_FULL_PATHNAMES,
IDC_EXTRACT_RADIO_CURRENT_PATHNAMES,
IDC_EXTRACT_RADIO_NO_PATHNAMES
{ IDC_EXTRACT_RADIO_FULL_PATHNAMES, 0x02000811 },
// { IDC_EXTRACT_RADIO_CURRENT_PATHNAMES, 0x02000812 },
{ IDC_EXTRACT_RADIO_NO_PATHNAMES, 0x02000813 }
};
static CIDLangPair kOverwriteMode_Pairs[] =
{
{ 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 }
};
#ifndef _SFX
static const NExtract::NPathMode::EEnum kPathModeButtonsVals[] =
static const
// NExtract::NPathMode::EEnum
int
kPathModeButtonsVals[] =
{
NExtract::NPathMode::kFullPathnames,
NExtract::NPathMode::kCurrentPathnames,
// NExtract::NPathMode::kCurrentPathnames,
NExtract::NPathMode::kNoPathnames
};
static const int kNumPathnamesButtons = sizeof(kPathModeButtons) / sizeof(kPathModeButtons[0]);
static const int kOverwriteButtons[] =
{
IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE,
@@ -56,7 +68,10 @@ static const int kOverwriteButtons[] =
IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING,
};
static const NExtract::NOverwriteMode::EEnum kOverwriteButtonsVals[] =
static const
int
// NExtract::NOverwriteMode::EEnum
kOverwriteButtonsVals[] =
{
NExtract::NOverwriteMode::kAskBefore,
NExtract::NOverwriteMode::kWithoutPrompt,
@@ -76,65 +91,11 @@ static const int kFilesButtons[] =
static const int kNumFilesButtons = sizeof(kFilesButtons) / sizeof(kFilesButtons[0]);
*/
void CExtractDialog::GetPathMode()
{
for (int i = 0; i < kNumPathnamesButtons; i++)
if(IsButtonCheckedBool(kPathModeButtons[i]))
{
PathMode = kPathModeButtonsVals[i];
return;
}
throw 1;
}
void CExtractDialog::SetPathMode()
{
for (int j = 0; j < 2; j++)
{
for (int i = 0; i < kNumPathnamesButtons; i++)
if(PathMode == kPathModeButtonsVals[i])
{
CheckRadioButton(kPathModeButtons[0], kPathModeButtons[kNumPathnamesButtons - 1],
kPathModeButtons[i]);
return;
}
PathMode = kPathModeButtonsVals[0];
}
throw 1;
}
void CExtractDialog::GetOverwriteMode()
{
for (int i = 0; i < kNumOverwriteButtons; i++)
if(IsButtonCheckedBool(kOverwriteButtons[i]))
{
OverwriteMode = kOverwriteButtonsVals[i];
return;
}
throw 0;
}
void CExtractDialog::SetOverwriteMode()
{
for (int j = 0; j < 2; j++)
{
for (int i = 0; i < kNumOverwriteButtons; i++)
if(OverwriteMode == kOverwriteButtonsVals[i])
{
CheckRadioButton(kOverwriteButtons[0], kOverwriteButtons[kNumOverwriteButtons - 1],
kOverwriteButtons[i]);
return;
}
OverwriteMode = kOverwriteButtonsVals[0];
}
throw 1;
}
/*
int CExtractDialog::GetFilesMode() const
{
for (int i = 0; i < kNumFilesButtons; i++)
if(IsButtonCheckedBool(kFilesButtons[i]))
if (IsButtonCheckedBool(kFilesButtons[i]))
return i;
throw 0;
}
@@ -147,18 +108,10 @@ static CIDLangPair kIDLangPairs[] =
{
{ IDC_STATIC_EXTRACT_EXTRACT_TO, 0x02000801 },
{ IDC_EXTRACT_PATH_MODE, 0x02000810 },
{ IDC_EXTRACT_RADIO_FULL_PATHNAMES, 0x02000811 },
{ IDC_EXTRACT_RADIO_CURRENT_PATHNAMES, 0x02000812 },
{ IDC_EXTRACT_RADIO_NO_PATHNAMES, 0x02000813 },
{ IDC_EXTRACT_OVERWRITE_MODE, 0x02000820 },
{ 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 },
{ IDC_EXTRACT_FILES, 0x02000830 },
{ IDC_EXTRACT_RADIO_SELECTED_FILES, 0x02000831 },
{ IDC_EXTRACT_RADIO_ALL_FILES, 0x02000832 },
{ 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 },
@@ -174,6 +127,23 @@ static CIDLangPair kIDLangPairs[] =
static const int kHistorySize = 8;
#endif
#ifndef _SFX
static void AddComboItems(NWindows::NControl::CComboBox &combo, const CIDLangPair *items, int numItems, const int *values, int curVal)
{
int curSel = 0;
for (int i = 0; i < numItems; i++)
{
UString s = LangString(items[i].ControlID, items[i].LangID);
s.Replace(L"&", L"");
int index = (int)combo.AddString(s);
combo.SetItemData(index, i);
if (values[i] == curVal)
curSel = i;
}
combo.SetCurSel(curSel);
}
#endif
bool CExtractDialog::OnInit()
{
#ifdef LANG
@@ -186,18 +156,18 @@ bool CExtractDialog::OnInit()
_passwordControl.SetPasswordChar(TEXT('*'));
#endif
NExtract::CInfo extractionInfo;
NExtract::CInfo info;
#ifdef NO_REGISTRY
PathMode = NExtract::NPathMode::kFullPathnames;
OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
// extractionInfo.Paths = NExtract::NPathMode::kFullPathnames;
// info.Paths = NExtract::NPathMode::kFullPathnames;
#else
ReadExtractionInfo(extractionInfo);
CheckButton(IDC_EXTRACT_CHECK_SHOW_PASSWORD, extractionInfo.ShowPassword);
info.Load();
CheckButton(IDC_EXTRACT_CHECK_SHOW_PASSWORD, info.ShowPassword);
UpdatePasswordControl();
PathMode = extractionInfo.PathMode;
OverwriteMode = extractionInfo.OverwriteMode;
PathMode = info.PathMode;
OverwriteMode = info.OverwriteMode;
#endif
_path.Attach(GetItem(IDC_EXTRACT_COMBO_PATH));
@@ -205,22 +175,26 @@ bool CExtractDialog::OnInit()
_path.SetText(DirectoryPath);
#ifndef NO_REGISTRY
for(int i = 0; i < extractionInfo.Paths.Size() && i < kHistorySize; i++)
_path.AddString(extractionInfo.Paths[i]);
for (int i = 0; i < info.Paths.Size() && i < kHistorySize; i++)
_path.AddString(info.Paths[i]);
#endif
/*
if(extractionInfo.Paths.Size() > 0)
if (info.Paths.Size() > 0)
_path.SetCurSel(0);
else
_path.SetCurSel(-1);
*/
#ifndef _SFX
SetPathMode();
SetOverwriteMode();
_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],
@@ -233,11 +207,15 @@ bool CExtractDialog::OnInit()
#endif
HICON icon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON));
SetIcon(ICON_BIG, icon);
// CWindow filesWindow = GetItem(IDC_EXTRACT_RADIO_FILES);
// filesWindow.Enable(_enableFilesButton);
// UpdateWildCardState();
NormalizePosition();
return CModalDialog::OnInit();
}
@@ -284,7 +262,7 @@ void CExtractDialog::OnButtonSetPath()
_path.GetText(currentPath);
UString title = LangStringSpec(IDS_EXTRACT_SET_FOLDER, 0x02000881);
UString resultPath;
if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
if (!MyBrowseForFolder(HWND(*this), title, currentPath, resultPath))
return;
#ifndef NO_REGISTRY
_path.SetCurSel(-1);
@@ -294,7 +272,7 @@ void CExtractDialog::OnButtonSetPath()
void AddUniqueString(UStringVector &list, const UString &s)
{
for(int i = 0; i < list.Size(); i++)
for (int i = 0; i < list.Size(); i++)
if (s.CompareNoCase(list[i]) == 0)
return;
list.Add(s);
@@ -303,18 +281,21 @@ void AddUniqueString(UStringVector &list, const UString &s)
void CExtractDialog::OnOK()
{
#ifndef _SFX
GetPathMode();
GetOverwriteMode();
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())];
// _filesMode = (NExtractionDialog::NFilesMode::EEnum)GetFilesMode();
_passwordControl.GetText(Password);
#endif
NExtract::CInfo extractionInfo;
extractionInfo.PathMode = PathMode;
extractionInfo.OverwriteMode = OverwriteMode;
extractionInfo.ShowPassword = (IsButtonChecked(
IDC_EXTRACT_CHECK_SHOW_PASSWORD) == BST_CHECKED);
NExtract::CInfo info;
info.PathMode = PathMode;
info.OverwriteMode = OverwriteMode;
info.ShowPassword = (IsButtonCheckedBool(IDC_EXTRACT_CHECK_SHOW_PASSWORD));
UString s;
@@ -325,10 +306,10 @@ void CExtractDialog::OnOK()
#else
int currentItem = _path.GetCurSel();
if(currentItem == CB_ERR)
if (currentItem == CB_ERR)
{
_path.GetText(s);
if(_path.GetCount() >= kHistorySize)
if (_path.GetCount() >= kHistorySize)
currentItem = _path.GetCount() - 1;
}
else
@@ -338,19 +319,19 @@ void CExtractDialog::OnOK()
s.Trim();
#ifndef _SFX
AddUniqueString(extractionInfo.Paths, s);
AddUniqueString(info.Paths, s);
#endif
DirectoryPath = s;
#ifndef NO_REGISTRY
for(int i = 0; i < _path.GetCount(); i++)
if(i != currentItem)
for (int i = 0; i < _path.GetCount(); i++)
if (i != currentItem)
{
UString sTemp;
_path.GetLBText(i, sTemp);
sTemp.Trim();
AddUniqueString(extractionInfo.Paths, sTemp);
AddUniqueString(info.Paths, sTemp);
}
SaveExtractionInfo(extractionInfo);
info.Save();
#endif
CModalDialog::OnOK();
}

View File

@@ -1,11 +1,10 @@
// ExtractDialog.h
#ifndef __EXTRACTDIALOG_H
#define __EXTRACTDIALOG_H
#ifndef __EXTRACT_DIALOG_H
#define __EXTRACT_DIALOG_H
#include "ExtractDialogRes.h"
#include "Windows/Control/Dialog.h"
#include "Windows/Control/Edit.h"
#include "Windows/Control/ComboBox.h"
@@ -14,6 +13,8 @@
#endif
#include "../Common/ExtractMode.h"
#include "../FileManager/DialogSize.h"
namespace NExtractionDialog
{
/*
@@ -39,13 +40,11 @@ class CExtractDialog: public NWindows::NControl::CModalDialog
#ifndef _SFX
NWindows::NControl::CEdit _passwordControl;
NWindows::NControl::CComboBox _pathMode;
NWindows::NControl::CComboBox _overwriteMode;
#endif
#ifndef _SFX
void GetPathMode();
void SetPathMode();
void GetOverwriteMode();
void SetOverwriteMode();
// int GetFilesMode() const;
void UpdatePasswordControl();
#endif
@@ -71,7 +70,14 @@ public:
NExtract::NOverwriteMode::EEnum OverwriteMode;
INT_PTR Create(HWND aWndParent = 0)
{ return CModalDialog::Create(IDD_DIALOG_EXTRACT, aWndParent); }
{
#ifdef _SFX
BIG_DIALOG_SIZE(240, 64);
#else
BIG_DIALOG_SIZE(300, 160);
#endif
return CModalDialog::Create(SIZED_DIALOG(IDD_DIALOG_EXTRACT), aWndParent);
}
};
#endif

View File

@@ -1,80 +1,83 @@
#include "ExtractDialogRes.h"
#include "../../GuiCommon.rc"
#define xSize2 285
#define ySize2 204
#define xc 280
#define yc 128
#define xSize (xSize2 + marg + marg)
#define ySize (ySize2 + marg + marg)
#undef g1xs
#undef g2x
#undef g2x2
#undef g2xs
#undef g2xs2
#undef g1XSize
#undef g1XSize2
#undef g1XPos2
#undef g2XPos
#undef g2XPos2
#undef g2XSize
#undef g2XSize2
#define g1xs 128
#define bYPos (ySize - marg - bYSize)
#define gSpace 24
#define g2x (m + g1xs + gSpace)
#define g2x2 (g2x + m)
#define g2xs (xc - g1xs - gSpace)
#define g2xs2 (g2xs - m - m)
#define g1XSize 127
#define g1XSize2 (g1XSize - 13)
#define g1XPos2 (marg + 7)
#define gSpace 14
#define g2XPos (marg + g1XSize + gSpace)
#define g2XPos2 (g2XPos + 7)
#define g2XSize (xSize2 - g1XSize - gSpace)
#define g2XSize2 (g2XSize - 14)
#define bXPos1 (xSize - marg - bXSize)
#define bXPos2 (bXPos1 - 10 - bXSize)
#define bXPos3 (bXPos2 - 10 - bXSize)
IDD_DIALOG_EXTRACT DIALOG DISCARDABLE 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
IDD_DIALOG_EXTRACT MY_DIALOG
CAPTION "Extract"
MY_FONT
BEGIN
LTEXT "E&xtract to:", IDC_STATIC_EXTRACT_EXTRACT_TO, marg, marg, xSize2, 8
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 "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
#ifdef UNDER_CE
LTEXT "Password", IDC_EXTRACT_PASSWORD, g2x, m + 36, g2xs, 8
#else
GROUPBOX "Password", IDC_EXTRACT_PASSWORD, g2x, m + 36, g2xs, 56
#endif
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
COMBOBOX IDC_EXTRACT_COMBO_PATH, marg, 21, xSize2 - bDotsSize - 13, 126, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...", IDC_EXTRACT_BUTTON_SET_PATH, xSize - marg - bDotsSize, 20, bDotsSize, bYSize, WS_GROUP
GROUPBOX "Path mode",IDC_EXTRACT_PATH_MODE, marg, 44, g1XSize, 57
CONTROL "Full pathnames", IDC_EXTRACT_RADIO_FULL_PATHNAMES,"Button", BS_AUTORADIOBUTTON | WS_GROUP,
g1XPos2, 57, g1XSize2, 10
CONTROL "Current pathnames",IDC_EXTRACT_RADIO_CURRENT_PATHNAMES, "Button", BS_AUTORADIOBUTTON,
g1XPos2, 71, g1XSize2, 10
CONTROL "No pathnames", IDC_EXTRACT_RADIO_NO_PATHNAMES, "Button", BS_AUTORADIOBUTTON,
g1XPos2, 85, g1XSize2, 10
GROUPBOX "Overwrite mode",IDC_EXTRACT_OVERWRITE_MODE, g2XPos, 44, g2XSize, 88, WS_GROUP
CONTROL "Ask before overwrite", IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE, "Button", BS_AUTORADIOBUTTON | WS_GROUP,
g2XPos2, 57, g2XSize2, 10
CONTROL "Overwrite without prompt", IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT, "Button", BS_AUTORADIOBUTTON,
g2XPos2, 71, g2XSize2, 10
CONTROL "Skip existing files", IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES, "Button", BS_AUTORADIOBUTTON,
g2XPos2, 85, g2XSize2, 10
CONTROL "Auto rename", IDC_EXTRACT_RADIO_AUTO_RENAME, "Button", BS_AUTORADIOBUTTON,
g2XPos2, 99, g2XSize2, 10
CONTROL "Auto rename existing files", IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING, "Button", BS_AUTORADIOBUTTON,
g2XPos2,113, g2XSize2, 10
GROUPBOX "Files",IDC_EXTRACT_FILES, marg, 140, 127, 48, NOT WS_VISIBLE | WS_DISABLED | WS_GROUP
CONTROL "&Selected files",IDC_EXTRACT_RADIO_SELECTED_FILES, "Button", BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED | WS_GROUP,
g1XPos2, 153, g1XSize2, 10
CONTROL "&All files",IDC_EXTRACT_RADIO_ALL_FILES, "Button", BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED,
g1XPos2, 166, g1XSize2, 10
GROUPBOX "Password",IDC_EXTRACT_PASSWORD, g2XPos, 142, g2XSize, 46
EDITTEXT IDC_EXTRACT_EDIT_PASSWORD,154,153,130,14, ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Show Password",IDC_EXTRACT_CHECK_SHOW_PASSWORD,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
g2XPos2, 172, g2XSize2, 10
DEFPUSHBUTTON "OK", IDOK, bXPos3, bYPos, bXSize, bYSize, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, bXPos2, bYPos, bXSize, bYSize
PUSHBUTTON "Help", IDHELP, bXPos1, bYPos, bXSize, bYSize
DEFPUSHBUTTON "OK", IDOK, bx3, by, bxs, bys, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, bx2, by, bxs, bys
PUSHBUTTON "Help", IDHELP, bx1, by, bxs, bys
END
#ifdef UNDER_CE
#undef m
#define m 4
#undef xc
#undef yc
#define xc 152
#define yc 128
#undef g1xs
#define g1xs 64
IDD_DIALOG_EXTRACT_2 MY_DIALOG
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 "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 "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 "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
OK_CANCEL
END
#endif

View File

@@ -1,24 +1,15 @@
#define IDD_DIALOG_EXTRACT 137
#define IDD_DIALOG_EXTRACT 552
#define IDD_DIALOG_EXTRACT_2 652
#define IDC_STATIC_EXTRACT_EXTRACT_TO 1020
#define IDC_EXTRACT_COMBO_PATH 1021
#define IDC_EXTRACT_BUTTON_SET_PATH 1022
#define IDC_EXTRACT_COMBO_PATH_MODE 1030
#define IDC_EXTRACT_COMBO_OVERWRITE_MODE 1031
#define IDC_EXTRACT_PATH_MODE 1040
#define IDC_EXTRACT_RADIO_FULL_PATHNAMES 1041
#define IDC_EXTRACT_RADIO_CURRENT_PATHNAMES 1042
#define IDC_EXTRACT_RADIO_NO_PATHNAMES 1043
#define IDC_EXTRACT_OVERWRITE_MODE 1050
#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_SELECTED_FILES 1054
#define IDC_EXTRACT_RADIO_ALL_FILES 1055
#define IDC_EXTRACT_RADIO_AUTO_RENAME 1056
#define IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING 1057
#define IDC_EXTRACT_FILES 1060

View File

@@ -13,14 +13,16 @@
#include "../FileManager/ExtractCallback.h"
#include "../FileManager/FormatUtils.h"
#include "../FileManager/LangUtils.h"
#include "../FileManager/resourceGui.h"
#include "../Common/ArchiveExtractCallback.h"
#include "../Common/PropIDUtils.h"
#include "../Explorer/MyMessages.h"
#include "resource.h"
#include "resource2.h"
#include "ExtractRes.h"
#include "ExtractDialog.h"
#include "ExtractGUI.h"
@@ -28,8 +30,38 @@ using namespace NWindows;
static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
struct CThreadExtracting
#ifndef _SFX
static void AddValuePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
{
wchar_t sz[32];
s += LangString(resourceID, langID);
s += L' ';
ConvertUInt64ToString(value, sz);
s += sz;
s += L'\n';
}
static void AddSizePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
{
wchar_t sz[32];
s += LangString(resourceID, langID);
s += L' ';
ConvertUInt64ToString(value, sz);
s += sz;
ConvertUInt64ToString(value >> 20, sz);
s += L" (";
s += sz;
s += L" MB)";
s += L'\n';
}
#endif
class CThreadExtracting: public CProgressThreadVirt
{
HRESULT ProcessVirt();
public:
CCodecs *codecs;
CExtractCallbackImp *ExtractCallbackSpec;
CIntVector FormatIndices;
@@ -39,75 +71,42 @@ struct CThreadExtracting
const NWildcard::CCensorNode *WildcardCensor;
const CExtractOptions *Options;
CMyComPtr<IExtractCallbackUI> ExtractCallback;
CDecompressStat Stat;
UString ErrorMessage;
HRESULT Result;
DWORD Process()
{
ExtractCallbackSpec->ProgressDialog.WaitCreating();
try
{
Result = DecompressArchives(
codecs, FormatIndices,
*ArchivePaths, *ArchivePathsFull,
*WildcardCensor, *Options, ExtractCallbackSpec, ExtractCallback, ErrorMessage, Stat);
}
catch(const UString &s)
{
ErrorMessage = s;
Result = E_FAIL;
}
catch(const wchar_t *s)
{
ErrorMessage = s;
Result = E_FAIL;
}
catch(const char *s)
{
ErrorMessage = GetUnicodeString(s);
Result = E_FAIL;
}
catch(...)
{
Result = E_FAIL;
}
ExtractCallbackSpec->ProgressDialog.MyClose();
return 0;
}
static THREAD_FUNC_DECL MyThreadFunction(void *param)
{
return ((CThreadExtracting *)param)->Process();
}
UString Title;
};
#ifndef _SFX
static void AddValuePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
HRESULT CThreadExtracting::ProcessVirt()
{
wchar_t sz[32];
s += LangString(resourceID, langID);
s += L" ";
ConvertUInt64ToString(value, sz);
s += sz;
s += L"\n";
}
static void AddSizePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
{
wchar_t sz[32];
s += LangString(resourceID, langID);
s += L" ";
ConvertUInt64ToString(value, sz);
s += sz;
ConvertUInt64ToString(value >> 20, sz);
s += L" (";
s += sz;
s += L" MB)";
s += L"\n";
}
#endif
CDecompressStat Stat;
HRESULT res = DecompressArchives(codecs, FormatIndices, *ArchivePaths, *ArchivePathsFull,
*WildcardCensor, *Options, ExtractCallbackSpec, ExtractCallback, ErrorMessage, Stat);
#ifndef _SFX
if (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)
{
wchar_t temp[16];
ConvertUInt32ToHex(Stat.CrcSum, temp);
s += L"CRC: ";
s += temp;
s += L'\n';
}
s += L'\n';
s += LangString(IDS_MESSAGE_NO_ERRORS, 0x02000608);
OkMessageTitle = Title;
OkMessage = s;
}
#endif
return res;
};
HRESULT ExtractGUI(
CCodecs *codecs,
@@ -117,8 +116,12 @@ HRESULT ExtractGUI(
const NWildcard::CCensorNode &wildcardCensor,
CExtractOptions &options,
bool showDialog,
CExtractCallbackImp *extractCallback)
bool &messageWasDisplayed,
CExtractCallbackImp *extractCallback,
HWND hwndParent)
{
messageWasDisplayed = false;
CThreadExtracting extracter;
extracter.codecs = codecs;
extracter.FormatIndices = formatIndices;
@@ -126,14 +129,17 @@ HRESULT ExtractGUI(
if (!options.TestMode)
{
UString outputDir = options.OutputDir;
#ifndef UNDER_CE
if (outputDir.IsEmpty())
NFile::NDirectory::MyGetCurrentDirectory(outputDir);
#endif
if (showDialog)
{
CExtractDialog dialog;
if (!NFile::NDirectory::MyGetFullPathName(outputDir, dialog.DirectoryPath))
{
ShowErrorMessage(kIncorrectOutDir);
messageWasDisplayed = true;
return E_FAIL;
}
NFile::NName::NormalizeDirPathPrefix(dialog.DirectoryPath);
@@ -141,7 +147,7 @@ HRESULT ExtractGUI(
// dialog.OverwriteMode = options.OverwriteMode;
// dialog.PathMode = options.PathMode;
if(dialog.Create(0) != IDOK)
if (dialog.Create(hwndParent) != IDOK)
return E_ABORT;
outputDir = dialog.DirectoryPath;
options.OverwriteMode = dialog.OverwriteMode;
@@ -154,6 +160,7 @@ HRESULT ExtractGUI(
if (!NFile::NDirectory::MyGetFullPathName(outputDir, options.OutputDir))
{
ShowErrorMessage(kIncorrectOutDir);
messageWasDisplayed = true;
return E_FAIL;
}
NFile::NName::NormalizeDirPathPrefix(options.OutputDir);
@@ -167,7 +174,7 @@ HRESULT ExtractGUI(
0x02000603,
#endif
options.OutputDir);
MyMessageBox(s2 + UString(L"\n") + s);
MyMessageBox(s2 + UString(L'\n') + s);
return E_FAIL;
}
*/
@@ -176,47 +183,23 @@ HRESULT ExtractGUI(
UString title = LangStringSpec(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING,
options.TestMode ? 0x02000F90: 0x02000890);
extracter.Title = title;
extracter.ExtractCallbackSpec = extractCallback;
extracter.ExtractCallbackSpec->ProgressDialog = &extracter.ProgressDialog;
extracter.ExtractCallback = extractCallback;
extracter.ExtractCallbackSpec->Init();
extracter.ProgressDialog.CompressingMode = false;
extracter.ArchivePaths = &archivePaths;
extracter.ArchivePathsFull = &archivePathsFull;
extracter.WildcardCensor = &wildcardCensor;
extracter.Options = &options;
NWindows::CThread thread;
RINOK(thread.Create(CThreadExtracting::MyThreadFunction, &extracter));
extracter.ExtractCallbackSpec->StartProgressDialog(title);
if (extracter.Result == S_OK && options.TestMode &&
extracter.ExtractCallbackSpec->Messages.IsEmpty() &&
extracter.ExtractCallbackSpec->NumArchiveErrors == 0)
{
#ifndef _SFX
UString s;
AddValuePair(IDS_ARCHIVES_COLON, 0x02000324, extracter.Stat.NumArchives, s);
AddValuePair(IDS_FOLDERS_COLON, 0x02000321, extracter.Stat.NumFolders, s);
AddValuePair(IDS_FILES_COLON, 0x02000320, extracter.Stat.NumFiles, s);
AddSizePair(IDS_SIZE_COLON, 0x02000322, extracter.Stat.UnpackSize, s);
AddSizePair(IDS_COMPRESSED_COLON, 0x02000323, extracter.Stat.PackSize, s);
extracter.ProgressDialog.IconID = IDI_ICON;
if (options.CalcCrc)
{
wchar_t temp[16];
ConvertUInt32ToHex(extracter.Stat.CrcSum, temp);
s += L"CRC: ";
s += temp;
s += L"\n";
}
s += L"\n";
s += LangString(IDS_MESSAGE_NO_ERRORS, 0x02000608);
MessageBoxW(0, s, LangString(IDS_PROGRESS_TESTING, 0x02000F90), 0);
#endif
}
if (extracter.Result != S_OK)
if (!extracter.ErrorMessage.IsEmpty())
throw extracter.ErrorMessage;
RINOK(extracter.Create(title, hwndParent));
messageWasDisplayed = extracter.ThreadFinishedOK &
extracter.ProgressDialog.MessagesDisplayed;
return extracter.Result;
}

View File

@@ -7,6 +7,18 @@
#include "../FileManager/ExtractCallback.h"
/*
RESULT can be S_OK, even if there are errors!!!
if RESULT == S_OK, check extractCallback->IsOK() after ExtractGUI().
RESULT = E_ABORT - user break.
RESULT != E_ABORT:
{
messageWasDisplayed = true - message was displayed already.
messageWasDisplayed = false - there was some internal error, so you must show error message.
}
*/
HRESULT ExtractGUI(
CCodecs *codecs,
const CIntVector &formatIndices,
@@ -15,6 +27,8 @@ HRESULT ExtractGUI(
const NWildcard::CCensorNode &wildcardCensor,
CExtractOptions &options,
bool showDialog,
CExtractCallbackImp *extractCallback);
bool &messageWasDisplayed,
CExtractCallbackImp *extractCallback,
HWND hwndParent = NULL);
#endif

View File

@@ -17,3 +17,13 @@
#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

View File

@@ -2,7 +2,7 @@
#include "StdAfx.h"
#include <initguid.h>
#include "Common/MyInitGuid.h"
#include "../../../../C/Alloc.h"
@@ -11,6 +11,7 @@
#include "Common/StringConvert.h"
#include "Windows/Error.h"
#include "Windows/NtCheck.h"
#ifdef _WIN32
#include "Windows/MemoryLock.h"
#endif
@@ -30,7 +31,10 @@ using namespace NWindows;
HINSTANCE g_hInstance;
#ifndef _UNICODE
bool g_IsNT = false;
#endif
#ifdef UNDER_CE
bool g_LVN_ITEMACTIVATE_Support = true;
#endif
static void ErrorMessage(LPCWSTR message)
@@ -55,7 +59,7 @@ static int ShowSysErrorMessage(DWORD errorCode)
{
if (errorCode == E_OUTOFMEMORY)
return ShowMemErrorMessage();
ErrorMessage(NError::MyFormatMessageW(errorCode));
ErrorMessage(HResultToMessage(errorCode));
return NExitCode::kFatalError;
}
@@ -63,12 +67,16 @@ static int Main2()
{
UStringVector commandStrings;
NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
if (commandStrings.Size() <= 1)
#ifndef UNDER_CE
if (commandStrings.Size() > 0)
commandStrings.Delete(0);
#endif
if (commandStrings.Size() == 0)
{
MessageBoxW(0, L"Specify command", L"7-Zip", 0);
return 0;
}
commandStrings.Delete(0);
CArchiveCommandLineOptions options;
CArchiveCommandLineParser parser;
@@ -76,7 +84,7 @@ static int Main2()
parser.Parse1(commandStrings, options);
parser.Parse2(options);
#ifdef _WIN32
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
if (options.LargePages)
NSecurity::EnableLockMemoryPrivilege();
#endif
@@ -114,7 +122,6 @@ static int Main2()
{
CExtractCallbackImp *ecs = new CExtractCallbackImp;
CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
ecs->ProgressDialog.CompressingMode = false;
#ifndef _NO_CRYPTO
ecs->PasswordIsDefined = options.PasswordEnabled;
@@ -135,14 +142,19 @@ static int Main2()
eo.Properties = options.ExtractProperties;
#endif
bool messageWasDisplayed = false;
HRESULT result = ExtractGUI(codecs, formatIndices,
options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
options.WildcardCensor.Pairs.Front().Head,
eo, options.ShowDialog, ecs);
eo, options.ShowDialog, messageWasDisplayed, ecs);
if (result != S_OK)
{
if (result != E_ABORT && messageWasDisplayed)
return NExitCode::kFatalError;
throw CSystemException(result);
if (ecs->Messages.Size() > 0 || ecs->NumArchiveErrors != 0)
}
if (!ecs->IsOK())
return NExitCode::kFatalError;
}
else if (options.Command.IsFromUpdateGroup())
@@ -163,31 +175,30 @@ static int Main2()
// callback.StdOutMode = options.UpdateOptions.StdOutMode;
callback.Init();
CUpdateErrorInfo errorInfo;
if (!options.UpdateOptions.Init(codecs, formatIndices, options.ArchiveName))
{
ErrorLangMessage(IDS_UPDATE_NOT_SUPPORTED, 0x02000601);
return NExitCode::kFatalError;
}
bool messageWasDisplayed = false;
HRESULT result = UpdateGUI(
codecs,
options.WildcardCensor, options.UpdateOptions,
options.ShowDialog,
errorInfo, &callback);
messageWasDisplayed, &callback);
if (result != S_OK)
{
if (!errorInfo.Message.IsEmpty())
{
ErrorMessage(errorInfo.Message);
if (result == E_FAIL)
return NExitCode::kFatalError;
}
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
{
@@ -196,29 +207,19 @@ static int Main2()
return 0;
}
static bool inline IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
#define NT_CHECK_FAIL_ACTION ErrorMessage(L"Unsupported Windows version"); return NExitCode::kFatalError;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */, int /* nCmdShow */)
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
#ifdef UNDER_CE
LPWSTR
#else
LPSTR
#endif
/* lpCmdLine */, int /* nCmdShow */)
{
g_hInstance = hInstance;
#ifdef _UNICODE
if (!IsItWindowsNT())
{
ErrorMessage(L"This program requires Windows NT/2000/2003/2008/XP/Vista");
return NExitCode::kFatalError;
}
#else
g_IsNT = IsItWindowsNT();
#endif
#ifdef _WIN32
NT_CHECK
SetLargePageSize();
#endif

View File

@@ -405,14 +405,6 @@ SOURCE=.\ExtractDialog.h
# End Source File
# Begin Source File
SOURCE=..\FileManager\MessagesDialog.cpp
# End Source File
# Begin Source File
SOURCE=..\FileManager\MessagesDialog.h
# End Source File
# Begin Source File
SOURCE=..\FileManager\OverwriteDialog.cpp
# End Source File
# Begin Source File
@@ -800,9 +792,17 @@ SOURCE=..\..\..\Windows\Control\ListView.h
SOURCE=..\..\..\Windows\Control\ProgressBar.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Control\Static.h
# End Source File
# End Group
# Begin Source File
SOURCE=..\..\..\Windows\COM.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\CommonDialog.cpp
# End Source File
# Begin Source File
@@ -851,6 +851,10 @@ SOURCE=..\..\..\Windows\FileIO.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\FileMapping.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\FileName.cpp
# End Source File
# Begin Source File

View File

@@ -2,41 +2,29 @@
#include "StdAfx.h"
#include "Common/Defs.h"
#include "Common/IntToString.h"
#include "Common/StringConvert.h"
#include "Windows/Error.h"
#include "Windows/PropVariant.h"
#include "../FileManager/MessagesDialog.h"
#include "../FileManager/PasswordDialog.h"
#include "UpdateCallbackGUI.h"
using namespace NWindows;
CUpdateCallbackGUI::~CUpdateCallbackGUI()
{
if (!Messages.IsEmpty())
{
CMessagesDialog messagesDialog;
messagesDialog.Messages = &Messages;
messagesDialog.Create(ParentWindow);
}
}
CUpdateCallbackGUI::~CUpdateCallbackGUI() {}
void CUpdateCallbackGUI::Init()
{
FailedFiles.Clear();
Messages.Clear();
NumArchiveErrors = 0;
NumFiles = 0;
}
void CUpdateCallbackGUI::AddErrorMessage(LPCWSTR message)
{
Messages.Add(message);
ProgressDialog->Sync.AddErrorMessage(message);
}
void CUpdateCallbackGUI::AddErrorMessage(const wchar_t *name, DWORD systemError)
@@ -52,8 +40,7 @@ HRESULT CUpdateCallbackGUI::OpenResult(const wchar_t *name, HRESULT result)
{
if (result != S_OK)
{
AddErrorMessage (UString(L"Error: ") + name +
UString(L" is not supported archive"));
AddErrorMessage (UString(L"Error: ") + name + UString(L" is not supported archive"));
}
return S_OK;
}
@@ -77,7 +64,7 @@ HRESULT CUpdateCallbackGUI::FinishScanning()
HRESULT CUpdateCallbackGUI::StartArchive(const wchar_t *name, bool /* updating */)
{
ProgressDialog.ProgressSynch.SetTitleFileName(name);
ProgressDialog->Sync.SetTitleFileName(name);
return S_OK;
}
@@ -88,14 +75,14 @@ HRESULT CUpdateCallbackGUI::FinishArchive()
HRESULT CUpdateCallbackGUI::CheckBreak()
{
return ProgressDialog.ProgressSynch.ProcessStopAndPause();
return ProgressDialog->Sync.ProcessStopAndPause();
}
HRESULT CUpdateCallbackGUI::ScanProgress(UInt64 /* numFolders */, UInt64 numFiles, const wchar_t *path)
{
ProgressDialog.ProgressSynch.SetCurrentFileName(path);
ProgressDialog.ProgressSynch.SetNumFilesTotal(numFiles);
return ProgressDialog.ProgressSynch.ProcessStopAndPause();
ProgressDialog->Sync.SetCurrentFileName(path);
ProgressDialog->Sync.SetNumFilesTotal(numFiles);
return ProgressDialog->Sync.ProcessStopAndPause();
}
HRESULT CUpdateCallbackGUI::Finilize()
@@ -105,13 +92,13 @@ HRESULT CUpdateCallbackGUI::Finilize()
HRESULT CUpdateCallbackGUI::SetNumFiles(UInt64 numFiles)
{
ProgressDialog.ProgressSynch.SetNumFilesTotal(numFiles);
ProgressDialog->Sync.SetNumFilesTotal(numFiles);
return S_OK;
}
HRESULT CUpdateCallbackGUI::SetTotal(UInt64 total)
{
ProgressDialog.ProgressSynch.SetProgress(total, 0);
ProgressDialog->Sync.SetProgress(total, 0);
return S_OK;
}
@@ -119,20 +106,20 @@ HRESULT CUpdateCallbackGUI::SetCompleted(const UInt64 *completeValue)
{
RINOK(CheckBreak());
if (completeValue != NULL)
ProgressDialog.ProgressSynch.SetPos(*completeValue);
ProgressDialog->Sync.SetPos(*completeValue);
return S_OK;
}
HRESULT CUpdateCallbackGUI::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
{
RINOK(CheckBreak());
ProgressDialog.ProgressSynch.SetRatioInfo(inSize, outSize);
ProgressDialog->Sync.SetRatioInfo(inSize, outSize);
return S_OK;
}
HRESULT CUpdateCallbackGUI::GetStream(const wchar_t *name, bool /* isAnti */)
{
ProgressDialog.ProgressSynch.SetCurrentFileName(name);
ProgressDialog->Sync.SetCurrentFileName(name);
return S_OK;
}
@@ -150,7 +137,7 @@ HRESULT CUpdateCallbackGUI::OpenFileError(const wchar_t *name, DWORD systemError
HRESULT CUpdateCallbackGUI::SetOperationResult(Int32 /* operationResult */)
{
NumFiles++;
ProgressDialog.ProgressSynch.SetNumFilesCur(NumFiles);
ProgressDialog->Sync.SetNumFilesCur(NumFiles);
return S_OK;
}
@@ -159,38 +146,31 @@ HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BST
*password = NULL;
if (!PasswordIsDefined)
{
if (AskPassword)
if (passwordIsDefined == 0 || AskPassword)
{
CPasswordDialog dialog;
if (dialog.Create(ProgressDialog) == IDCANCEL)
ProgressDialog->WaitCreating();
if (dialog.Create(*ProgressDialog) == IDCANCEL)
return E_ABORT;
Password = dialog.Password;
PasswordIsDefined = true;
}
}
*passwordIsDefined = BoolToInt(PasswordIsDefined);
if (passwordIsDefined != 0)
*passwordIsDefined = BoolToInt(PasswordIsDefined);
return StringToBstr(Password, password);
}
HRESULT CUpdateCallbackGUI::CryptoGetTextPassword(BSTR *password)
{
*password = NULL;
if (!PasswordIsDefined)
{
CPasswordDialog dialog;
if (dialog.Create(ProgressDialog) == IDCANCEL)
return E_ABORT;
Password = dialog.Password;
PasswordIsDefined = true;
}
return StringToBstr(Password, password);
return CryptoGetTextPassword2(NULL, password);
}
/*
It doesn't work, since main stream waits Dialog
HRESULT CUpdateCallbackGUI::CloseProgress()
{
ProgressDialog.MyClose();
ProgressDialog->MyClose();
return S_OK;
};
*/
@@ -198,18 +178,18 @@ HRESULT CUpdateCallbackGUI::CloseProgress()
HRESULT CUpdateCallbackGUI::Open_CheckBreak()
{
return ProgressDialog.ProgressSynch.ProcessStopAndPause();
return ProgressDialog->Sync.ProcessStopAndPause();
}
HRESULT CUpdateCallbackGUI::Open_SetTotal(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
{
// if (numFiles != NULL) ProgressDialog.ProgressSynch.SetNumFilesTotal(*numFiles);
// if (numFiles != NULL) ProgressDialog->Sync.SetNumFilesTotal(*numFiles);
return S_OK;
}
HRESULT CUpdateCallbackGUI::Open_SetCompleted(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
{
return ProgressDialog.ProgressSynch.ProcessStopAndPause();
return ProgressDialog->Sync.ProcessStopAndPause();
}
#ifndef _NO_CRYPTO
@@ -217,15 +197,7 @@ HRESULT CUpdateCallbackGUI::Open_SetCompleted(const UInt64 * /* numFiles */, con
HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password)
{
PasswordWasAsked = true;
if (!PasswordIsDefined)
{
CPasswordDialog dialog;
if (dialog.Create(ProgressDialog) == IDCANCEL)
return E_ABORT;
Password = dialog.Password;
PasswordIsDefined = true;
}
return StringToBstr(Password, password);
return CryptoGetTextPassword2(NULL, password);
}
HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(UString &password)
@@ -248,7 +220,7 @@ void CUpdateCallbackGUI::Open_ClearPasswordWasAskedFlag()
/*
HRESULT CUpdateCallbackGUI::ShowDeleteFile(const wchar_t *name)
{
ProgressDialog.ProgressSynch.SetCurrentFileName(name);
ProgressDialog->Sync.SetCurrentFileName(name);
return S_OK;
}
*/

View File

@@ -12,7 +12,6 @@ class CUpdateCallbackGUI:
public IUpdateCallbackUI2
{
public:
// bool StdOutMode;
bool PasswordIsDefined;
UString Password;
bool AskPassword;
@@ -22,9 +21,7 @@ public:
CUpdateCallbackGUI():
PasswordIsDefined(false),
PasswordWasAsked(false),
AskPassword(false),
// StdOutMode(false)
ParentWindow(0)
AskPassword(false)
{}
~CUpdateCallbackGUI();
@@ -33,19 +30,10 @@ public:
INTERFACE_IUpdateCallbackUI2(;)
INTERFACE_IOpenCallbackUI(;)
// HRESULT CloseProgress();
UStringVector FailedFiles;
CProgressDialog ProgressDialog;
HWND ParentWindow;
void StartProgressDialog(const UString &title)
{
ProgressDialog.Create(title, ParentWindow);
}
CProgressDialog *ProgressDialog;
UStringVector Messages;
int NumArchiveErrors;
void AddErrorMessage(LPCWSTR message);
void AddErrorMessage(const wchar_t *name, DWORD systemError);
};

View File

@@ -16,12 +16,15 @@
#include "../Explorer/MyMessages.h"
#include "../FileManager/LangUtils.h"
#include "../FileManager/ProgramLocation.h"
#include "../FileManager/StringUtils.h"
#include "../FileManager/resourceGui.h"
#include "CompressDialog.h"
#include "UpdateGUI.h"
#include "resource.h"
#include "resource2.h"
using namespace NWindows;
using namespace NFile;
@@ -29,51 +32,31 @@ using namespace NFile;
static const wchar_t *kDefaultSfxModule = L"7z.sfx";
static const wchar_t *kSFXExtension = L"exe";
struct CThreadUpdating
{
CCodecs *codecs;
extern void AddMessageToString(UString &dest, const UString &src);
UString HResultToMessage(HRESULT errorCode);
class CThreadUpdating: public CProgressThreadVirt
{
HRESULT ProcessVirt();
public:
CCodecs *codecs;
CUpdateCallbackGUI *UpdateCallbackGUI;
const NWildcard::CCensor *WildcardCensor;
CUpdateOptions *Options;
CUpdateErrorInfo *ErrorInfo;
HRESULT Result;
DWORD Process()
{
UpdateCallbackGUI->ProgressDialog.WaitCreating();
try
{
Result = UpdateArchive(codecs, *WildcardCensor, *Options,
*ErrorInfo, UpdateCallbackGUI, UpdateCallbackGUI);
}
catch(const UString &s)
{
ErrorInfo->Message = s;
Result = E_FAIL;
}
catch(const wchar_t *s)
{
ErrorInfo->Message = s;
Result = E_FAIL;
}
catch(const char *s)
{
ErrorInfo->Message = GetUnicodeString(s);
Result = E_FAIL;
}
catch(...)
{
Result = E_FAIL;
}
UpdateCallbackGUI->ProgressDialog.MyClose();
return 0;
}
static THREAD_FUNC_DECL MyThreadFunction(void *param)
{
return ((CThreadUpdating *)param)->Process();
}
};
HRESULT CThreadUpdating::ProcessVirt()
{
CUpdateErrorInfo ei;
HRESULT res = UpdateArchive(codecs, *WildcardCensor, *Options,
ei, UpdateCallbackGUI, UpdateCallbackGUI);
ErrorMessage = ei.Message;
ErrorPath1 = ei.FileName;
ErrorPath2 = ei.FileName2;
if (ei.SystemError != S_OK && ei.SystemError != E_FAIL && ei.SystemError != E_ABORT)
return ei.SystemError;
return res;
};
static void AddProp(CObjectVector<CProperty> &properties, const UString &name, const UString &value)
@@ -210,19 +193,22 @@ static void SetOutProperties(
static HRESULT ShowDialog(
CCodecs *codecs,
const NWildcard::CCensor &censor,
CUpdateOptions &options, CUpdateCallbackGUI *callback)
CUpdateOptions &options, CUpdateCallbackGUI *callback, HWND hwndParent)
{
if (options.Commands.Size() != 1)
throw "It must be one command";
UString currentDirPrefix;
#ifndef UNDER_CE
{
if (!NDirectory::MyGetCurrentDirectory(currentDirPrefix))
return E_FAIL;
NName::NormalizeDirPathPrefix(currentDirPrefix);
}
#endif
bool oneFile = false;
NFind::CFileInfoW fileInfo;
UString name;
if (censor.Pairs.Size() > 0)
{
const NWildcard::CPair &pair = censor.Pairs[0];
@@ -231,7 +217,7 @@ static HRESULT ShowDialog(
const NWildcard::CItem &item = pair.Head.IncludeItems[0];
if (item.ForFile)
{
UString name = pair.Prefix;
name = pair.Prefix;
for (int i = 0; i < item.PathParts.Size(); i++)
{
if (i > 0)
@@ -249,13 +235,17 @@ static HRESULT ShowDialog(
CCompressDialog dialog;
NCompressDialog::CInfo &di = dialog.Info;
for(int i = 0; i < codecs->Formats.Size(); i++)
dialog.ArcFormats = &codecs->Formats;
for (int i = 0; i < codecs->Formats.Size(); i++)
{
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.m_ArchiverInfoList.Add(ai);
dialog.ArcIndices.Add(i);
}
if(dialog.m_ArchiverInfoList.Size() == 0)
if (dialog.ArcIndices.Size() == 0)
{
ShowErrorMessage(L"No Update Engines");
return E_FAIL;
@@ -263,7 +253,7 @@ static HRESULT ShowDialog(
// di.ArchiveName = options.ArchivePath.GetFinalPath();
di.ArchiveName = options.ArchivePath.GetPathWithoutExt();
dialog.OriginalFileName = fileInfo.Name;
dialog.OriginalFileName = options.ArchivePath.Prefix + fileInfo.Name;
di.CurrentDirPrefix = currentDirPrefix;
di.SFXMode = options.SfxMode;
@@ -274,7 +264,7 @@ static HRESULT ShowDialog(
di.KeepName = !oneFile;
if(dialog.Create(0) != IDOK)
if (dialog.Create(hwndParent) != IDOK)
return E_ABORT;
options.VolumesSizes = di.VolumeSizes;
@@ -305,7 +295,7 @@ static HRESULT ShowDialog(
default:
throw 1091756;
}
const CArcInfoEx &archiverInfo = dialog.m_ArchiverInfoList[di.ArchiverInfoIndex];
const CArcInfoEx &archiverInfo = codecs->Formats[di.FormatIndex];
callback->PasswordIsDefined = (!di.Password.IsEmpty());
if (callback->PasswordIsDefined)
callback->Password = di.Password;
@@ -334,17 +324,17 @@ static HRESULT ShowDialog(
if (di.SFXMode)
options.SfxMode = true;
options.MethodMode.FormatIndex = archiverInfo.FormatIndex;
options.MethodMode.FormatIndex = di.FormatIndex;
options.ArchivePath.VolExtension = archiverInfo.GetMainExt();
if(di.SFXMode)
if (di.SFXMode)
options.ArchivePath.BaseExtension = kSFXExtension;
else
options.ArchivePath.BaseExtension = options.ArchivePath.VolExtension;
options.ArchivePath.ParseFromPath(di.ArchiveName);
NWorkDir::CInfo workDirInfo;
ReadWorkDirInfo(workDirInfo);
workDirInfo.Load();
options.WorkingDir.Empty();
if (workDirInfo.Mode != NWorkDir::NMode::kCurrent)
{
@@ -361,29 +351,49 @@ HRESULT UpdateGUI(
const NWildcard::CCensor &censor,
CUpdateOptions &options,
bool showDialog,
CUpdateErrorInfo &errorInfo,
CUpdateCallbackGUI *callback)
bool &messageWasDisplayed,
CUpdateCallbackGUI *callback,
HWND hwndParent)
{
messageWasDisplayed = false;
if (showDialog)
{
RINOK(ShowDialog(codecs, censor, options, callback));
RINOK(ShowDialog(codecs, censor, options, callback, hwndParent));
}
if (options.SfxMode && options.SfxModule.IsEmpty())
options.SfxModule = kDefaultSfxModule;
{
UString folder;
if (!GetProgramFolderPath(folder))
folder.Empty();
options.SfxModule = folder + kDefaultSfxModule;
}
CThreadUpdating tu;
tu.codecs = codecs;
tu.UpdateCallbackGUI = callback;
tu.UpdateCallbackGUI->ProgressDialog = &tu.ProgressDialog;
tu.UpdateCallbackGUI->Init();
UString title = LangString(IDS_PROGRESS_COMPRESSING, 0x02000DC0);
/*
if (hwndParent != 0)
{
tu.ProgressDialog.MainWindow = hwndParent;
// tu.ProgressDialog.MainTitle = fileName;
tu.ProgressDialog.MainAddTitle = title + L" ";
}
*/
tu.WildcardCensor = &censor;
tu.Options = &options;
tu.ErrorInfo = &errorInfo;
tu.ProgressDialog.IconID = IDI_ICON;
NWindows::CThread thread;
RINOK(thread.Create(CThreadUpdating::MyThreadFunction, &tu))
tu.UpdateCallbackGUI->StartProgressDialog(LangString(IDS_PROGRESS_COMPRESSING, 0x02000DC0));
RINOK(tu.Create(title, hwndParent));
messageWasDisplayed = tu.ThreadFinishedOK &
tu.ProgressDialog.MessagesDisplayed;
return tu.Result;
}

View File

@@ -4,16 +4,28 @@
#define __UPDATE_GUI_H
#include "../Common/Update.h"
#include "UpdateCallbackGUI.h"
#include "../FileManager/UpdateCallback100.h"
/*
callback->FailedFiles contains names of files for that there were problems.
RESULT can be S_OK, even if there are such warnings!!!
RESULT = E_ABORT - user break.
RESULT != E_ABORT:
{
messageWasDisplayed = true - message was displayed already.
messageWasDisplayed = false - there was some internal error, so you must show error message.
}
*/
HRESULT UpdateGUI(
CCodecs *codecs,
const NWildcard::CCensor &censor,
CUpdateOptions &options,
bool showDialog,
CUpdateErrorInfo &errorInfo,
CUpdateCallbackGUI *callback);
bool &messageWasDisplayed,
CUpdateCallbackGUI *callback,
HWND hwndParent = NULL);
#endif

View File

@@ -1,14 +1,17 @@
PROG = 7zG.exe
LIBS = $(LIBS) user32.lib advapi32.lib oleaut32.lib shell32.lib comctl32.lib htmlhelp.lib ole32.lib comdlg32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
-DLANG \
-DCOMPRESS_MT \
-DWIN_LONG_PATH \
-DEXTERNAL_LZMA \
-DEXTERNAL_CODECS \
-DBENCH_MT \
-D_7ZIP_LARGE_PAGES \
-DSUPPORT_DEVICE_FILE \
!IFDEF UNDER_CE
LIBS = $(LIBS) ceshell.lib Commctrl.lib
!ELSE
LIBS = $(LIBS) comctl32.lib htmlhelp.lib comdlg32.lib
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -DSUPPORT_DEVICE_FILE -D_7ZIP_LARGE_PAGES
!ENDIF
GUI_OBJS = \
$O\BenchmarkDialog.obj \
@@ -102,11 +105,16 @@ FM_OBJS = \
$O\RegistryUtils.obj \
$O\SplitUtils.obj \
$O\StringUtils.obj \
$O\MessagesDialog.obj \
$O\OverwriteDialog.obj \
$O\PasswordDialog.obj \
$O\ProgressDialog2.obj \
!IFDEF UNDER_CE
FM_OBJS = $(FM_OBJS) \
$O\BrowseDialog.obj \
$O\SysIconUtils.obj \
!ENDIF
C_OBJS = \
$O\Alloc.obj \
$O\Threads.obj \

View File

@@ -1,49 +0,0 @@
#define IDS_CONTEXT_EXTRACT 142
#define IDS_CONTEXT_EXTRACT_HELP 143
#define IDS_CONTEXT_COMPRESS 144
#define IDS_CONTEXT_COMPRESS_HELP 145
#define IDS_CONTEXT_OPEN 146
#define IDS_CONTEXT_OPEN_HELP 147
#define IDS_CONTEXT_TEST 148
#define IDS_CONTEXT_TEST_HELP 149
#define IDS_CONTEXT_CAPTION_HELP 150
#define IDS_CONTEXT_POPUP_CAPTION 151
#define IDS_OPEN_TYPE_ALL_FILES 80
#define IDS_METHOD_STORE 81
#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_INCORRECT_VOLUME_SIZE 95
#define IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE 96
#define IDS_CANT_UPDATE_ARCHIVE 97
#define IDS_PROGRESS_COMPRESSING 98
#define IDS_PROGRESS_TESTING 99
#define IDS_ERROR 100
#define IDS_MESSAGE_NO_ERRORS 101
#define IDS_CONFIG_DIALOG_CAPTION 102
#define IDS_PASSWORD_USE_ASCII 110
#define IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH 111
#define IDS_PASSWORD_IS_TOO_LONG 112
#define IDS_FILES_COLON 2274
#define IDS_FOLDERS_COLON 2275
#define IDS_SIZE_COLON 2276
#define IDS_COMPRESSED_COLON 2277
#define IDS_ARCHIVES_COLON 2278

View File

@@ -1,68 +1,21 @@
#include "../../MyVersionInfo.rc"
#include <winnt.h>
#include "resource.h"
#include "resource2.rc"
#include "../FileManager/resourceGui.rc"
MY_VERSION_INFO_APP("7-Zip GUI", "7zg")
IDI_ICON1 ICON "FM.ico"
IDI_ICON ICON "FM.ico"
#ifndef UNDER_CE
1 24 MOVEABLE PURE "7zG.exe.manifest"
#endif
STRINGTABLE
BEGIN
IDS_CONTEXT_EXTRACT "Extract files..."
IDS_CONTEXT_EXTRACT_HELP "Extracts files from the selected archive."
IDS_CONTEXT_COMPRESS "Add to archive..."
IDS_CONTEXT_COMPRESS_HELP "Adds the selected items to archive."
IDS_CONTEXT_OPEN "Open"
IDS_CONTEXT_OPEN_HELP "Opens the selected archive."
IDS_CONTEXT_TEST "Test archive"
IDS_CONTEXT_TEST_HELP "Tests integrity of the selected archive."
IDS_CONTEXT_CAPTION_HELP "7-Zip commands"
IDS_CONTEXT_POPUP_CAPTION "7-Zip"
IDS_OPEN_TYPE_ALL_FILES "All Files"
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_COMPRESS_NON_SOLID "Non-solid"
IDS_COMPRESS_SOLID "Solid"
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_INCORRECT_VOLUME_SIZE "Incorrect volume size"
IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE "Specified volume size: {0} bytes.\nAre you sure you want to split archive into such volumes?"
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_CANT_UPDATE_ARCHIVE "Can not update archive '{0}'"
IDS_PROGRESS_COMPRESSING "Compressing"
IDS_PROGRESS_TESTING "Testing"
IDS_ERROR "Error"
IDS_MESSAGE_NO_ERRORS "There are no errors"
IDS_CONFIG_DIALOG_CAPTION "7-Zip Options"
IDS_FILES_COLON "Files:"
IDS_FOLDERS_COLON "Folders:"
IDS_SIZE_COLON "Size:"
IDS_COMPRESSED_COLON "Compressed size:"
IDS_ARCHIVES_COLON "Archives:"
END
#ifdef UNDER_CE
#include "../FileManager/PropertyName.rc"
#endif
#include "../FileManager/OverwriteDialog.rc"
#include "../FileManager/PasswordDialog.rc"
#include "../FileManager/MessagesDialog.rc"
#include "../FileManager/ProgressDialog2.rc"
#include "Extract.rc"
#include "ExtractDialog.rc"
#include "CompressDialog.rc"
#include "BenchmarkDialog.rc"

3
CPP/7zip/UI/GUI/resource2.h Executable file
View File

@@ -0,0 +1,3 @@
#define IDS_COMPRESSED_COLON 2277
#define IDS_ARCHIVES_COLON 2278
#define IDS_PROGRESS_COMPRESSING 98

11
CPP/7zip/UI/GUI/resource2.rc Executable file
View File

@@ -0,0 +1,11 @@
#include "ExtractDialog.rc"
#include "CompressDialog.rc"
#include "BenchmarkDialog.rc"
#include "resource2.h"
STRINGTABLE
BEGIN
IDS_COMPRESSED_COLON "Compressed size:"
IDS_ARCHIVES_COLON "Archives:"
IDS_PROGRESS_COMPRESSING "Compressing"
END