mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 15:14:59 -06:00
Initialer Commit
This commit is contained in:
13
CPP/7zip/UI/GUI/7zG.exe.manifest
Normal file
13
CPP/7zip/UI/GUI/7zG.exe.manifest
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="7-Zip.7-Zip.7zG" type="win32"/>
|
||||
<description>7-Zip GUI.</description>
|
||||
<dependency>
|
||||
<dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly>
|
||||
</dependency>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
837
CPP/7zip/UI/GUI/BenchmarkDialog.cpp
Normal file
837
CPP/7zip/UI/GUI/BenchmarkDialog.cpp
Normal file
@@ -0,0 +1,837 @@
|
||||
// BenchmarkDialog.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../../C/CpuArch.h"
|
||||
|
||||
#include "../../../Common/Defs.h"
|
||||
#include "../../../Common/IntToString.h"
|
||||
#include "../../../Common/MyException.h"
|
||||
#include "../../../Common/StringConvert.h"
|
||||
#include "../../../Common/StringToInt.h"
|
||||
|
||||
#include "../../../Windows/System.h"
|
||||
#include "../../../Windows/Thread.h"
|
||||
|
||||
#include "../../Common/MethodProps.h"
|
||||
|
||||
#include "../FileManager/HelpUtils.h"
|
||||
|
||||
#include "../../MyVersion.h"
|
||||
|
||||
#include "BenchmarkDialog.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
void GetCpuName(AString &s);
|
||||
|
||||
static LPCWSTR kHelpTopic = L"fm/benchmark.htm";
|
||||
|
||||
static const UINT_PTR kTimerID = 4;
|
||||
static const UINT kTimerElapse = 1000;
|
||||
|
||||
#ifdef LANG
|
||||
#include "../FileManager/LangUtils.h"
|
||||
#endif
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
UString HResultToMessage(HRESULT errorCode);
|
||||
|
||||
#ifdef LANG
|
||||
static const UInt32 kLangIDs[] =
|
||||
{
|
||||
IDT_BENCH_DICTIONARY,
|
||||
IDT_BENCH_MEMORY,
|
||||
IDT_BENCH_NUM_THREADS,
|
||||
IDT_BENCH_SPEED,
|
||||
IDT_BENCH_RATING_LABEL,
|
||||
IDT_BENCH_USAGE_LABEL,
|
||||
IDT_BENCH_RPU_LABEL,
|
||||
IDG_BENCH_COMPRESSING,
|
||||
IDG_BENCH_DECOMPRESSING,
|
||||
IDG_BENCH_TOTAL_RATING,
|
||||
IDT_BENCH_CURRENT,
|
||||
IDT_BENCH_RESULTING,
|
||||
IDT_BENCH_ELAPSED,
|
||||
IDT_BENCH_PASSES,
|
||||
IDB_STOP,
|
||||
IDB_RESTART
|
||||
};
|
||||
|
||||
static const UInt32 kLangIDs_Colon[] =
|
||||
{
|
||||
IDT_BENCH_SIZE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
static const LPCTSTR kProcessingString = TEXT("...");
|
||||
static const LPCTSTR kMB = TEXT(" MB");
|
||||
static const LPCTSTR kMIPS = TEXT(" MIPS");
|
||||
static const LPCTSTR kKBs = TEXT(" KB/s");
|
||||
|
||||
static const unsigned kMinDicLogSize =
|
||||
#ifdef UNDER_CE
|
||||
20;
|
||||
#else
|
||||
21;
|
||||
#endif
|
||||
|
||||
static const UInt32 kMinDicSize = (1 << kMinDicLogSize);
|
||||
static const UInt32 kMaxDicSize =
|
||||
#ifdef MY_CPU_64BIT
|
||||
(1 << 30);
|
||||
#else
|
||||
(1 << 27);
|
||||
#endif
|
||||
|
||||
bool CBenchmarkDialog::OnInit()
|
||||
{
|
||||
#ifdef LANG
|
||||
LangSetWindowText(*this, IDD_BENCH);
|
||||
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
|
||||
LangSetDlgItems_Colon(*this, kLangIDs_Colon, ARRAY_SIZE(kLangIDs_Colon));
|
||||
LangSetDlgItemText(*this, IDT_BENCH_CURRENT2, IDT_BENCH_CURRENT);
|
||||
LangSetDlgItemText(*this, IDT_BENCH_RESULTING2, IDT_BENCH_RESULTING);
|
||||
#endif
|
||||
|
||||
Sync.Init();
|
||||
|
||||
if (TotalMode)
|
||||
{
|
||||
_consoleEdit.Attach(GetItem(IDE_BENCH2_EDIT));
|
||||
LOGFONT f;
|
||||
memset(&f, 0, sizeof(f));
|
||||
f.lfHeight = 14;
|
||||
f.lfWidth = 0;
|
||||
f.lfWeight = FW_DONTCARE;
|
||||
f.lfCharSet = DEFAULT_CHARSET;
|
||||
f.lfOutPrecision = OUT_DEFAULT_PRECIS;
|
||||
f.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
f.lfQuality = DEFAULT_QUALITY;
|
||||
|
||||
f.lfPitchAndFamily = FIXED_PITCH;
|
||||
// MyStringCopy(f.lfFaceName, TEXT(""));
|
||||
// f.lfFaceName[0] = 0;
|
||||
_font.Create(&f);
|
||||
if (_font._font)
|
||||
_consoleEdit.SendMsg(WM_SETFONT, (WPARAM)_font._font, TRUE);
|
||||
}
|
||||
|
||||
{
|
||||
TCHAR s[40];
|
||||
s[0] = '/';
|
||||
s[1] = ' ';
|
||||
ConvertUInt32ToString(NSystem::GetNumberOfProcessors(), s + 2);
|
||||
SetItemText(IDT_BENCH_HARDWARE_THREADS, s);
|
||||
}
|
||||
|
||||
{
|
||||
UString s;
|
||||
{
|
||||
AString cpuName;
|
||||
GetCpuName(cpuName);
|
||||
s.SetFromAscii(cpuName);
|
||||
SetItemText(IDT_BENCH_CPU, s);
|
||||
}
|
||||
|
||||
s.SetFromAscii("7-Zip " MY_VERSION " ["
|
||||
#ifdef MY_CPU_64BIT
|
||||
"64-bit"
|
||||
#elif defined MY_CPU_32BIT
|
||||
"32-bit"
|
||||
#endif
|
||||
"]");
|
||||
SetItemText(IDT_BENCH_VER, s);
|
||||
}
|
||||
|
||||
|
||||
UInt32 numCPUs = NSystem::GetNumberOfProcessors();
|
||||
if (numCPUs < 1)
|
||||
numCPUs = 1;
|
||||
numCPUs = MyMin(numCPUs, (UInt32)(1 << 8));
|
||||
|
||||
if (Sync.NumThreads == (UInt32)(Int32)-1)
|
||||
{
|
||||
Sync.NumThreads = numCPUs;
|
||||
if (Sync.NumThreads > 1)
|
||||
Sync.NumThreads &= ~1;
|
||||
}
|
||||
m_NumThreads.Attach(GetItem(IDC_BENCH_NUM_THREADS));
|
||||
int cur = 0;
|
||||
for (UInt32 num = 1; num <= numCPUs * 2;)
|
||||
{
|
||||
TCHAR s[16];
|
||||
ConvertUInt32ToString(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_BENCH_DICTIONARY));
|
||||
cur = 0;
|
||||
|
||||
UInt64 ramSize = (UInt64)(sizeof(size_t)) << 29;
|
||||
bool ramSize_Defined = NSystem::GetRamSize(ramSize);
|
||||
|
||||
#ifdef UNDER_CE
|
||||
const UInt32 kNormalizedCeSize = (16 << 20);
|
||||
if (ramSize > kNormalizedCeSize && ramSize < (33 << 20))
|
||||
ramSize = kNormalizedCeSize;
|
||||
#endif
|
||||
|
||||
if (Sync.DictionarySize == (UInt32)(Int32)-1)
|
||||
{
|
||||
unsigned dicSizeLog = 25;
|
||||
|
||||
#ifdef UNDER_CE
|
||||
dicSizeLog = 20;
|
||||
#endif
|
||||
|
||||
if (ramSize_Defined)
|
||||
for (; dicSizeLog > kBenchMinDicLogSize; dicSizeLog--)
|
||||
if (GetBenchMemoryUsage(Sync.NumThreads, ((UInt32)1 << dicSizeLog)) + (8 << 20) <= ramSize)
|
||||
break;
|
||||
Sync.DictionarySize = (1 << dicSizeLog);
|
||||
}
|
||||
|
||||
if (Sync.DictionarySize < kMinDicSize) Sync.DictionarySize = kMinDicSize;
|
||||
if (Sync.DictionarySize > kMaxDicSize) Sync.DictionarySize = kMaxDicSize;
|
||||
|
||||
for (unsigned i = kMinDicLogSize; i <= 30; i++)
|
||||
for (unsigned j = 0; j < 2; j++)
|
||||
{
|
||||
UInt32 dict = (1 << i) + (j << (i - 1));
|
||||
if (dict > kMaxDicSize)
|
||||
continue;
|
||||
TCHAR s[16];
|
||||
ConvertUInt32ToString((dict >> 20), s);
|
||||
lstrcat(s, kMB);
|
||||
int index = (int)m_Dictionary.AddString(s);
|
||||
m_Dictionary.SetItemData(index, dict);
|
||||
if (dict <= Sync.DictionarySize)
|
||||
cur = index;
|
||||
}
|
||||
m_Dictionary.SetCurSel(cur);
|
||||
|
||||
OnChangeSettings();
|
||||
|
||||
Sync._startEvent.Set();
|
||||
_timer = SetTimer(kTimerID, kTimerElapse);
|
||||
|
||||
if (TotalMode)
|
||||
NormalizeSize(true);
|
||||
else
|
||||
NormalizePosition();
|
||||
return CModalDialog::OnInit();
|
||||
}
|
||||
|
||||
bool CBenchmarkDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
|
||||
{
|
||||
if (!TotalMode)
|
||||
return false;
|
||||
int mx, my;
|
||||
GetMargins(8, mx, my);
|
||||
int bx1, bx2, by;
|
||||
GetItemSizes(IDCANCEL, bx1, by);
|
||||
GetItemSizes(IDHELP, bx2, by);
|
||||
|
||||
{
|
||||
int y = ySize - my - by;
|
||||
int x = xSize - mx - bx1;
|
||||
|
||||
InvalidateRect(NULL);
|
||||
|
||||
MoveItem(IDCANCEL, x, y, bx1, by);
|
||||
MoveItem(IDHELP, x - mx - bx2, y, bx2, by);
|
||||
}
|
||||
|
||||
if (_consoleEdit)
|
||||
{
|
||||
int yPos = ySize - my - by;
|
||||
RECT rect;
|
||||
GetClientRectOfItem(IDE_BENCH2_EDIT, rect);
|
||||
int y = rect.top;
|
||||
int ySize2 = yPos - my - y;
|
||||
const int kMinYSize = 20;
|
||||
int xx = xSize - mx * 2;
|
||||
if (ySize2 < kMinYSize)
|
||||
{
|
||||
ySize2 = kMinYSize;
|
||||
}
|
||||
_consoleEdit.Move(mx, y, xx, ySize2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
UInt32 CBenchmarkDialog::GetNumberOfThreads()
|
||||
{
|
||||
return (UInt32)m_NumThreads.GetItemData_of_CurSel();
|
||||
}
|
||||
|
||||
UInt32 CBenchmarkDialog::OnChangeDictionary()
|
||||
{
|
||||
UInt32 dict = (UInt32)m_Dictionary.GetItemData_of_CurSel();
|
||||
UInt64 memUsage = GetBenchMemoryUsage(GetNumberOfThreads(), dict);
|
||||
memUsage = (memUsage + (1 << 20) - 1) >> 20;
|
||||
TCHAR s[40];
|
||||
ConvertUInt64ToString(memUsage, s);
|
||||
lstrcat(s, kMB);
|
||||
SetItemText(IDT_BENCH_MEMORY_VAL, s);
|
||||
return dict;
|
||||
}
|
||||
|
||||
static const UInt32 g_IDs[] =
|
||||
{
|
||||
IDT_BENCH_COMPRESS_USAGE1,
|
||||
IDT_BENCH_COMPRESS_USAGE2,
|
||||
IDT_BENCH_COMPRESS_SPEED1,
|
||||
IDT_BENCH_COMPRESS_SPEED2,
|
||||
IDT_BENCH_COMPRESS_RATING1,
|
||||
IDT_BENCH_COMPRESS_RATING2,
|
||||
IDT_BENCH_COMPRESS_RPU1,
|
||||
IDT_BENCH_COMPRESS_RPU2,
|
||||
|
||||
IDT_BENCH_DECOMPR_SPEED1,
|
||||
IDT_BENCH_DECOMPR_SPEED2,
|
||||
IDT_BENCH_DECOMPR_RATING1,
|
||||
IDT_BENCH_DECOMPR_RATING2,
|
||||
IDT_BENCH_DECOMPR_USAGE1,
|
||||
IDT_BENCH_DECOMPR_USAGE2,
|
||||
IDT_BENCH_DECOMPR_RPU1,
|
||||
IDT_BENCH_DECOMPR_RPU2,
|
||||
|
||||
IDT_BENCH_TOTAL_USAGE_VAL,
|
||||
IDT_BENCH_TOTAL_RATING_VAL,
|
||||
IDT_BENCH_TOTAL_RPU_VAL
|
||||
};
|
||||
|
||||
void CBenchmarkDialog::OnChangeSettings()
|
||||
{
|
||||
EnableItem(IDB_STOP, true);
|
||||
UInt32 dict = OnChangeDictionary();
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(g_IDs); i++)
|
||||
SetItemText(g_IDs[i], kProcessingString);
|
||||
_startTime = GetTickCount();
|
||||
PrintTime();
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(Sync.CS);
|
||||
Sync.Init();
|
||||
Sync.DictionarySize = dict;
|
||||
Sync.Changed = true;
|
||||
Sync.NumThreads = GetNumberOfThreads();
|
||||
}
|
||||
|
||||
void CBenchmarkDialog::OnRestartButton()
|
||||
{
|
||||
OnChangeSettings();
|
||||
}
|
||||
|
||||
void CBenchmarkDialog::OnStopButton()
|
||||
{
|
||||
EnableItem(IDB_STOP, false);
|
||||
Sync.Pause();
|
||||
}
|
||||
|
||||
void CBenchmarkDialog::OnHelp()
|
||||
{
|
||||
ShowHelpWindow(NULL, kHelpTopic);
|
||||
}
|
||||
|
||||
void CBenchmarkDialog::OnCancel()
|
||||
{
|
||||
Sync.Stop();
|
||||
KillTimer(_timer);
|
||||
CModalDialog::OnCancel();
|
||||
}
|
||||
|
||||
void GetTimeString(UInt64 timeValue, wchar_t *s);
|
||||
|
||||
void CBenchmarkDialog::PrintTime()
|
||||
{
|
||||
UInt32 curTime = ::GetTickCount();
|
||||
UInt32 elapsedTime = (curTime - _startTime);
|
||||
UInt32 elapsedSec = elapsedTime / 1000;
|
||||
if (elapsedSec != 0 && Sync.WasPaused())
|
||||
return;
|
||||
WCHAR s[40];
|
||||
GetTimeString(elapsedSec, s);
|
||||
SetItemText(IDT_BENCH_ELAPSED_VAL, s);
|
||||
}
|
||||
|
||||
void CBenchmarkDialog::PrintRating(UInt64 rating, UINT controlID)
|
||||
{
|
||||
TCHAR s[40];
|
||||
ConvertUInt64ToString(rating / 1000000, s);
|
||||
lstrcat(s, kMIPS);
|
||||
SetItemText(controlID, s);
|
||||
}
|
||||
|
||||
void CBenchmarkDialog::PrintUsage(UInt64 usage, UINT controlID)
|
||||
{
|
||||
TCHAR s[40];
|
||||
ConvertUInt64ToString((usage + 5000) / 10000, s);
|
||||
lstrcat(s, TEXT("%"));
|
||||
SetItemText(controlID, s);
|
||||
}
|
||||
|
||||
void CBenchmarkDialog::PrintResults(
|
||||
UInt32 dictionarySize,
|
||||
const CBenchInfo2 &info,
|
||||
UINT usageID, UINT speedID, UINT rpuID, UINT ratingID,
|
||||
bool decompressMode)
|
||||
{
|
||||
if (info.GlobalTime == 0)
|
||||
return;
|
||||
|
||||
TCHAR s[40];
|
||||
{
|
||||
UInt64 speed = info.UnpackSize * info.NumIterations * info.GlobalFreq / info.GlobalTime;
|
||||
ConvertUInt64ToString(speed / 1024, s);
|
||||
lstrcat(s, kKBs);
|
||||
SetItemText(speedID, s);
|
||||
}
|
||||
UInt64 rating;
|
||||
if (decompressMode)
|
||||
rating = info.GetDecompressRating();
|
||||
else
|
||||
rating = info.GetCompressRating(dictionarySize);
|
||||
|
||||
PrintRating(rating, ratingID);
|
||||
PrintRating(info.GetRatingPerUsage(rating), rpuID);
|
||||
PrintUsage(info.GetUsage(), usageID);
|
||||
}
|
||||
|
||||
bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
|
||||
{
|
||||
bool printTime = true;
|
||||
if (TotalMode)
|
||||
{
|
||||
if (Sync.WasStopped())
|
||||
printTime = false;
|
||||
}
|
||||
if (printTime)
|
||||
PrintTime();
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(Sync.CS);
|
||||
|
||||
if (TotalMode)
|
||||
{
|
||||
if (Sync.TextWasChanged)
|
||||
{
|
||||
_consoleEdit.SetText(GetSystemString(Sync.Text));
|
||||
Sync.TextWasChanged = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
TCHAR s[40];
|
||||
ConvertUInt64ToString((Sync.ProcessedSize >> 20), s);
|
||||
lstrcat(s, kMB);
|
||||
SetItemText(IDT_BENCH_SIZE_VAL, s);
|
||||
|
||||
ConvertUInt64ToString(Sync.NumPasses, s);
|
||||
SetItemText(IDT_BENCH_PASSES_VAL, s);
|
||||
|
||||
/*
|
||||
if (Sync.FreqWasChanged)
|
||||
{
|
||||
SetItemText(IDT_BENCH_FREQ, Sync.Freq);
|
||||
Sync.FreqWasChanged = false;
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
UInt32 dicSizeTemp = (UInt32)MyMax(Sync.ProcessedSize, UInt64(1) << 20);
|
||||
dicSizeTemp = MyMin(dicSizeTemp, Sync.DictionarySize),
|
||||
PrintResults(dicSizeTemp,
|
||||
Sync.CompressingInfoTemp,
|
||||
IDT_BENCH_COMPRESS_USAGE1,
|
||||
IDT_BENCH_COMPRESS_SPEED1,
|
||||
IDT_BENCH_COMPRESS_RPU1,
|
||||
IDT_BENCH_COMPRESS_RATING1);
|
||||
}
|
||||
|
||||
{
|
||||
PrintResults(
|
||||
Sync.DictionarySize,
|
||||
Sync.CompressingInfo,
|
||||
IDT_BENCH_COMPRESS_USAGE2,
|
||||
IDT_BENCH_COMPRESS_SPEED2,
|
||||
IDT_BENCH_COMPRESS_RPU2,
|
||||
IDT_BENCH_COMPRESS_RATING2);
|
||||
}
|
||||
|
||||
{
|
||||
PrintResults(
|
||||
Sync.DictionarySize,
|
||||
Sync.DecompressingInfoTemp,
|
||||
IDT_BENCH_DECOMPR_USAGE1,
|
||||
IDT_BENCH_DECOMPR_SPEED1,
|
||||
IDT_BENCH_DECOMPR_RPU1,
|
||||
IDT_BENCH_DECOMPR_RATING1,
|
||||
true);
|
||||
}
|
||||
{
|
||||
PrintResults(
|
||||
Sync.DictionarySize,
|
||||
Sync.DecompressingInfo,
|
||||
IDT_BENCH_DECOMPR_USAGE2,
|
||||
IDT_BENCH_DECOMPR_SPEED2,
|
||||
IDT_BENCH_DECOMPR_RPU2,
|
||||
IDT_BENCH_DECOMPR_RATING2,
|
||||
true);
|
||||
if (Sync.DecompressingInfo.GlobalTime > 0 &&
|
||||
Sync.CompressingInfo.GlobalTime > 0)
|
||||
{
|
||||
UInt64 comprRating = Sync.CompressingInfo.GetCompressRating(Sync.DictionarySize);
|
||||
UInt64 decomprRating = Sync.DecompressingInfo.GetDecompressRating();
|
||||
PrintRating((comprRating + decomprRating) / 2, IDT_BENCH_TOTAL_RATING_VAL);
|
||||
PrintRating((
|
||||
Sync.CompressingInfo.GetRatingPerUsage(comprRating) +
|
||||
Sync.DecompressingInfo.GetRatingPerUsage(decomprRating)) / 2, IDT_BENCH_TOTAL_RPU_VAL);
|
||||
PrintUsage(
|
||||
(Sync.CompressingInfo.GetUsage() +
|
||||
Sync.DecompressingInfo.GetUsage()) / 2, IDT_BENCH_TOTAL_USAGE_VAL);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
{
|
||||
if (code == CBN_SELCHANGE &&
|
||||
(itemID == IDC_BENCH_DICTIONARY ||
|
||||
itemID == IDC_BENCH_NUM_THREADS))
|
||||
{
|
||||
OnChangeSettings();
|
||||
return true;
|
||||
}
|
||||
return CModalDialog::OnCommand(code, itemID, lParam);
|
||||
}
|
||||
|
||||
bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
switch (buttonID)
|
||||
{
|
||||
case IDB_RESTART:
|
||||
OnRestartButton();
|
||||
return true;
|
||||
case IDB_STOP:
|
||||
OnStopButton();
|
||||
return true;
|
||||
}
|
||||
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
|
||||
}
|
||||
|
||||
struct CThreadBenchmark
|
||||
{
|
||||
CBenchmarkDialog *BenchmarkDialog;
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS2;
|
||||
// UInt32 dictionarySize;
|
||||
// UInt32 numThreads;
|
||||
|
||||
HRESULT Process();
|
||||
HRESULT Result;
|
||||
static THREAD_FUNC_DECL MyThreadFunction(void *param)
|
||||
{
|
||||
((CThreadBenchmark *)param)->Result = ((CThreadBenchmark *)param)->Process();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct CBenchCallback: public IBenchCallback
|
||||
{
|
||||
UInt32 dictionarySize;
|
||||
CProgressSyncInfo *Sync;
|
||||
|
||||
// void AddCpuFreq(UInt64 cpuFreq);
|
||||
HRESULT SetFreq(bool showFreq, UInt64 cpuFreq);
|
||||
HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
|
||||
HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
|
||||
};
|
||||
|
||||
/*
|
||||
void CBenchCallback::AddCpuFreq(UInt64 cpuFreq)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(Sync->CS);
|
||||
{
|
||||
wchar_t s[32];
|
||||
ConvertUInt64ToString(cpuFreq, s);
|
||||
Sync->Freq.Add_Space_if_NotEmpty();
|
||||
Sync->Freq += s;
|
||||
Sync->FreqWasChanged = true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
HRESULT CBenchCallback::SetFreq(bool /* showFreq */, UInt64 /* cpuFreq */)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(Sync->CS);
|
||||
if (Sync->Changed || Sync->Paused || Sync->Stopped)
|
||||
return E_ABORT;
|
||||
Sync->ProcessedSize = info.UnpackSize * info.NumIterations;
|
||||
if (final && Sync->CompressingInfo.GlobalTime == 0)
|
||||
{
|
||||
(CBenchInfo&)Sync->CompressingInfo = info;
|
||||
if (Sync->CompressingInfo.GlobalTime == 0)
|
||||
Sync->CompressingInfo.GlobalTime = 1;
|
||||
}
|
||||
else
|
||||
(CBenchInfo&)Sync->CompressingInfoTemp = info;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(Sync->CS);
|
||||
if (Sync->Changed || Sync->Paused || Sync->Stopped)
|
||||
return E_ABORT;
|
||||
CBenchInfo info2 = info;
|
||||
if (final && Sync->DecompressingInfo.GlobalTime == 0)
|
||||
{
|
||||
(CBenchInfo&)Sync->DecompressingInfo = info2;
|
||||
if (Sync->DecompressingInfo.GlobalTime == 0)
|
||||
Sync->DecompressingInfo.GlobalTime = 1;
|
||||
}
|
||||
else
|
||||
(CBenchInfo&)Sync->DecompressingInfoTemp = info2;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
struct CBenchCallback2: public IBenchPrintCallback
|
||||
{
|
||||
CProgressSyncInfo *Sync;
|
||||
|
||||
void Print(const char *s);
|
||||
void NewLine();
|
||||
HRESULT CheckBreak();
|
||||
};
|
||||
|
||||
void CBenchCallback2::Print(const char *s)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(Sync->CS);
|
||||
Sync->Text += s;
|
||||
Sync->TextWasChanged = true;
|
||||
}
|
||||
|
||||
void CBenchCallback2::NewLine()
|
||||
{
|
||||
Print("\xD\n");
|
||||
}
|
||||
|
||||
HRESULT CBenchCallback2::CheckBreak()
|
||||
{
|
||||
if (Sync->Changed || Sync->Paused || Sync->Stopped)
|
||||
return E_ABORT;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CThreadBenchmark::Process()
|
||||
{
|
||||
CProgressSyncInfo &sync = BenchmarkDialog->Sync;
|
||||
sync.WaitCreating();
|
||||
try
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (sync.WasStopped())
|
||||
return 0;
|
||||
if (sync.WasPaused())
|
||||
{
|
||||
Sleep(200);
|
||||
continue;
|
||||
}
|
||||
UInt32 dictionarySize;
|
||||
UInt32 numThreads;
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(sync.CS);
|
||||
if (sync.Stopped || sync.Paused)
|
||||
continue;
|
||||
if (sync.Changed)
|
||||
sync.Init();
|
||||
dictionarySize = sync.DictionarySize;
|
||||
numThreads = sync.NumThreads;
|
||||
}
|
||||
|
||||
CBenchCallback callback;
|
||||
callback.dictionarySize = dictionarySize;
|
||||
callback.Sync = &sync;
|
||||
CBenchCallback2 callback2;
|
||||
callback2.Sync = &sync;
|
||||
HRESULT result;
|
||||
|
||||
try
|
||||
{
|
||||
CObjectVector<CProperty> props;
|
||||
if (BenchmarkDialog->TotalMode)
|
||||
{
|
||||
props = BenchmarkDialog->Props;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
CProperty prop;
|
||||
prop.Name = L"mt";
|
||||
wchar_t s[16];
|
||||
ConvertUInt32ToString(numThreads, s);
|
||||
prop.Value = s;
|
||||
props.Add(prop);
|
||||
}
|
||||
{
|
||||
CProperty prop;
|
||||
prop.Name = L'd';
|
||||
wchar_t s[16];
|
||||
ConvertUInt32ToString(dictionarySize, s);
|
||||
prop.Name += s;
|
||||
prop.Name += L'b';
|
||||
props.Add(prop);
|
||||
}
|
||||
}
|
||||
result = Bench(EXTERNAL_CODECS_LOC_VARS
|
||||
BenchmarkDialog->TotalMode ? &callback2 : NULL,
|
||||
BenchmarkDialog->TotalMode ? NULL : &callback,
|
||||
props, 1, false);
|
||||
if (BenchmarkDialog->TotalMode)
|
||||
{
|
||||
sync.Stop();
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
result = E_FAIL;
|
||||
}
|
||||
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (result != E_ABORT)
|
||||
{
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(sync.CS);
|
||||
sync.Pause();
|
||||
}
|
||||
UString message;
|
||||
if (result == S_FALSE)
|
||||
message = L"Decoding error";
|
||||
else if (result == CLASS_E_CLASSNOTAVAILABLE)
|
||||
message = L"Can't find 7z.dll";
|
||||
else
|
||||
message = HResultToMessage(result);
|
||||
BenchmarkDialog->MessageBoxError(message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(sync.CS);
|
||||
sync.NumPasses++;
|
||||
}
|
||||
}
|
||||
// return S_OK;
|
||||
}
|
||||
catch(CSystemException &e)
|
||||
{
|
||||
BenchmarkDialog->MessageBoxError(HResultToMessage(e.ErrorCode));
|
||||
return E_FAIL;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
BenchmarkDialog->MessageBoxError(HResultToMessage(E_FAIL));
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
static void ParseNumberString(const UString &s, NCOM::CPropVariant &prop)
|
||||
{
|
||||
const wchar_t *end;
|
||||
UInt64 result = ConvertStringToUInt64(s, &end);
|
||||
if (*end != 0 || s.IsEmpty())
|
||||
prop = s;
|
||||
else if (result <= (UInt32)0xFFFFFFFF)
|
||||
prop = (UInt32)result;
|
||||
else
|
||||
prop = result;
|
||||
}
|
||||
|
||||
HRESULT Benchmark(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
const CObjectVector<CProperty> props, HWND hwndParent)
|
||||
{
|
||||
CThreadBenchmark benchmarker;
|
||||
#ifdef EXTERNAL_CODECS
|
||||
benchmarker.__externalCodecs = __externalCodecs;
|
||||
#endif
|
||||
|
||||
CBenchmarkDialog bd;
|
||||
bd.Props = props;
|
||||
bd.TotalMode = false;
|
||||
bd.Sync.DictionarySize = (UInt32)(Int32)-1;
|
||||
bd.Sync.NumThreads = (UInt32)(Int32)-1;
|
||||
|
||||
COneMethodInfo method;
|
||||
|
||||
UInt32 numCPUs = 1;
|
||||
#ifndef _7ZIP_ST
|
||||
numCPUs = NSystem::GetNumberOfProcessors();
|
||||
#endif
|
||||
UInt32 numThreads = numCPUs;
|
||||
|
||||
FOR_VECTOR (i, props)
|
||||
{
|
||||
const CProperty &prop = props[i];
|
||||
UString name = prop.Name;
|
||||
name.MakeLower_Ascii();
|
||||
if (name.IsEqualTo_Ascii_NoCase("m") && prop.Value == L"*")
|
||||
{
|
||||
bd.TotalMode = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
NCOM::CPropVariant propVariant;
|
||||
if (!prop.Value.IsEmpty())
|
||||
ParseNumberString(prop.Value, propVariant);
|
||||
if (name.IsPrefixedBy(L"mt"))
|
||||
{
|
||||
#ifndef _7ZIP_ST
|
||||
RINOK(ParseMtProp(name.Ptr(2), propVariant, numCPUs, numThreads));
|
||||
if (numThreads != numCPUs)
|
||||
bd.Sync.NumThreads = numThreads;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
if (name.IsEqualTo("testtime"))
|
||||
{
|
||||
// UInt32 testTime = 4;
|
||||
// RINOK(ParsePropToUInt32(L"", propVariant, testTime));
|
||||
continue;
|
||||
}
|
||||
RINOK(method.ParseMethodFromPROPVARIANT(name, propVariant));
|
||||
}
|
||||
|
||||
// bool totalBenchMode = (method.MethodName == L"*");
|
||||
|
||||
{
|
||||
UInt32 dict;
|
||||
if (method.Get_DicSize(dict))
|
||||
bd.Sync.DictionarySize = dict;
|
||||
}
|
||||
|
||||
benchmarker.BenchmarkDialog = &bd;
|
||||
|
||||
NWindows::CThread thread;
|
||||
RINOK(thread.Create(CThreadBenchmark::MyThreadFunction, &benchmarker));
|
||||
bd.Create(hwndParent);
|
||||
return thread.Wait();
|
||||
}
|
||||
180
CPP/7zip/UI/GUI/BenchmarkDialog.h
Normal file
180
CPP/7zip/UI/GUI/BenchmarkDialog.h
Normal file
@@ -0,0 +1,180 @@
|
||||
// BenchmarkDialog.h
|
||||
|
||||
#ifndef __BENCHMARK_DIALOG_H
|
||||
#define __BENCHMARK_DIALOG_H
|
||||
|
||||
#include "../../../Windows/Synchronization.h"
|
||||
|
||||
#include "../../../Windows/Control/ComboBox.h"
|
||||
#include "../../../Windows/Control/Edit.h"
|
||||
|
||||
#include "../Common/Bench.h"
|
||||
|
||||
#include "../FileManager/DialogSize.h"
|
||||
|
||||
#include "BenchmarkDialogRes.h"
|
||||
|
||||
struct CBenchInfo2 : public CBenchInfo
|
||||
{
|
||||
void Init() { GlobalTime = UserTime = 0; }
|
||||
|
||||
UInt64 GetCompressRating(UInt32 dictSize) const
|
||||
{
|
||||
return ::GetCompressRating(dictSize, GlobalTime, GlobalFreq, UnpackSize * NumIterations);
|
||||
}
|
||||
|
||||
UInt64 GetDecompressRating() const
|
||||
{
|
||||
return ::GetDecompressRating(GlobalTime, GlobalFreq, UnpackSize, PackSize, NumIterations);
|
||||
}
|
||||
};
|
||||
|
||||
class CProgressSyncInfo
|
||||
{
|
||||
public:
|
||||
bool Stopped;
|
||||
bool Paused;
|
||||
bool Changed;
|
||||
UInt32 DictionarySize;
|
||||
UInt32 NumThreads;
|
||||
UInt64 NumPasses;
|
||||
NWindows::NSynchronization::CManualResetEvent _startEvent;
|
||||
NWindows::NSynchronization::CCriticalSection CS;
|
||||
|
||||
CBenchInfo2 CompressingInfoTemp;
|
||||
CBenchInfo2 CompressingInfo;
|
||||
UInt64 ProcessedSize;
|
||||
|
||||
CBenchInfo2 DecompressingInfoTemp;
|
||||
CBenchInfo2 DecompressingInfo;
|
||||
|
||||
AString Text;
|
||||
bool TextWasChanged;
|
||||
|
||||
// UString Freq;
|
||||
// bool FreqWasChanged;
|
||||
|
||||
CProgressSyncInfo()
|
||||
{
|
||||
if (_startEvent.Create() != S_OK)
|
||||
throw 3986437;
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
Changed = false;
|
||||
Stopped = false;
|
||||
Paused = false;
|
||||
CompressingInfoTemp.Init();
|
||||
CompressingInfo.Init();
|
||||
ProcessedSize = 0;
|
||||
|
||||
DecompressingInfoTemp.Init();
|
||||
DecompressingInfo.Init();
|
||||
|
||||
NumPasses = 0;
|
||||
|
||||
// Freq.SetFromAscii("MHz: ");
|
||||
// FreqWasChanged = true;
|
||||
|
||||
Text.Empty();
|
||||
TextWasChanged = true;
|
||||
}
|
||||
|
||||
void Stop()
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(CS);
|
||||
Stopped = true;
|
||||
}
|
||||
bool WasStopped()
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(CS);
|
||||
return Stopped;
|
||||
}
|
||||
void Pause()
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(CS);
|
||||
Paused = true;
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(CS);
|
||||
Paused = false;
|
||||
}
|
||||
bool WasPaused()
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(CS);
|
||||
return Paused;
|
||||
}
|
||||
void WaitCreating() { _startEvent.Lock(); }
|
||||
};
|
||||
|
||||
struct CMyFont
|
||||
{
|
||||
HFONT _font;
|
||||
CMyFont(): _font(NULL) {}
|
||||
~CMyFont()
|
||||
{
|
||||
if (_font)
|
||||
DeleteObject(_font);
|
||||
}
|
||||
void Create(const LOGFONT *lplf)
|
||||
{
|
||||
_font = CreateFontIndirect(lplf);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CBenchmarkDialog:
|
||||
public NWindows::NControl::CModalDialog
|
||||
{
|
||||
NWindows::NControl::CComboBox m_Dictionary;
|
||||
NWindows::NControl::CComboBox m_NumThreads;
|
||||
NWindows::NControl::CEdit _consoleEdit;
|
||||
UINT_PTR _timer;
|
||||
UInt32 _startTime;
|
||||
CMyFont _font;
|
||||
|
||||
bool OnSize(WPARAM /* wParam */, int xSize, int ySize);
|
||||
bool OnTimer(WPARAM timerID, LPARAM callback);
|
||||
virtual bool OnInit();
|
||||
void OnRestartButton();
|
||||
void OnStopButton();
|
||||
void OnHelp();
|
||||
virtual void OnCancel();
|
||||
bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
bool OnCommand(int code, int itemID, LPARAM lParam);
|
||||
|
||||
void PrintTime();
|
||||
void PrintRating(UInt64 rating, UINT controlID);
|
||||
void PrintUsage(UInt64 usage, UINT controlID);
|
||||
void PrintResults(
|
||||
UInt32 dictionarySize,
|
||||
const CBenchInfo2 &info, UINT usageID, UINT speedID, UINT rpuID, UINT ratingID,
|
||||
bool decompressMode = false);
|
||||
|
||||
UInt32 GetNumberOfThreads();
|
||||
UInt32 OnChangeDictionary();
|
||||
void OnChangeSettings();
|
||||
public:
|
||||
CProgressSyncInfo Sync;
|
||||
bool TotalMode;
|
||||
CObjectVector<CProperty> Props;
|
||||
|
||||
CBenchmarkDialog(): _timer(0), TotalMode(false) {}
|
||||
INT_PTR Create(HWND wndParent = 0)
|
||||
{
|
||||
BIG_DIALOG_SIZE(332, 228);
|
||||
return CModalDialog::Create(TotalMode ? IDD_BENCH_TOTAL : SIZED_DIALOG(IDD_BENCH), wndParent);
|
||||
}
|
||||
void MessageBoxError(LPCWSTR message)
|
||||
{
|
||||
MessageBoxW(*this, message, L"7-Zip", MB_ICONERROR);
|
||||
}
|
||||
};
|
||||
|
||||
HRESULT Benchmark(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
const CObjectVector<CProperty> props, HWND hwndParent = NULL);
|
||||
|
||||
#endif
|
||||
258
CPP/7zip/UI/GUI/BenchmarkDialog.rc
Normal file
258
CPP/7zip/UI/GUI/BenchmarkDialog.rc
Normal file
@@ -0,0 +1,258 @@
|
||||
#include "BenchmarkDialogRes.h"
|
||||
#include "../../GuiCommon.rc"
|
||||
|
||||
#define xc 332
|
||||
#define yc 248
|
||||
|
||||
#undef g0xs
|
||||
#undef g1x
|
||||
#undef g1xs
|
||||
#undef g2xs
|
||||
#undef g3x
|
||||
#undef g3xs
|
||||
#undef g4x
|
||||
|
||||
#define gs 160
|
||||
#define gSpace 24
|
||||
|
||||
#define g0xs 90
|
||||
#define g1xs 44
|
||||
#define g1x (m + g0xs)
|
||||
#define gc2x (g1x + g1xs + m)
|
||||
#define gc2xs 80
|
||||
|
||||
#define g4x (m + m)
|
||||
|
||||
#define sRating 60
|
||||
#define sSpeed 60
|
||||
#define sUsage 60
|
||||
#define sRpu 60
|
||||
|
||||
#define xRating (xs - m - m - sRating)
|
||||
#define xRpu (xRating - sRpu)
|
||||
#define xUsage (xRpu - sUsage)
|
||||
#define xSpeed (xUsage - sSpeed)
|
||||
|
||||
#define sLabel (xUsage - g4x)
|
||||
#define sTotalRating (sUsage + sRpu + sRating + m + m)
|
||||
#define xTotalRating (xs - m - sTotalRating)
|
||||
|
||||
#define g2xs 58
|
||||
#define g3xs 36
|
||||
#define g3x (m + g2xs)
|
||||
|
||||
#undef GROUP_Y_SIZE
|
||||
#undef GROUP_Y2_SIZE
|
||||
#ifdef UNDER_CE
|
||||
#define GROUP_Y_SIZE 8
|
||||
#define GROUP_Y2_SIZE 8
|
||||
#else
|
||||
#define GROUP_Y_SIZE 40
|
||||
#define GROUP_Y2_SIZE 32
|
||||
#endif
|
||||
|
||||
IDD_BENCH DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
|
||||
CAPTION "Benchmark"
|
||||
MY_FONT
|
||||
BEGIN
|
||||
PUSHBUTTON "&Restart", IDB_RESTART, bx1, m, bxs, bys
|
||||
PUSHBUTTON "&Stop", IDB_STOP, bx1, m + bys + 6, bxs, bys
|
||||
|
||||
PUSHBUTTON "&Help", IDHELP, bx2, by, bxs, bys
|
||||
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
|
||||
|
||||
LTEXT "&Dictionary size:", IDT_BENCH_DICTIONARY, m, m + 1, g0xs, 8
|
||||
COMBOBOX IDC_BENCH_DICTIONARY, g1x, m, g1xs, 140, MY_COMBO
|
||||
|
||||
LTEXT "Memory usage:", IDT_BENCH_MEMORY, gc2x, m + 1, gc2xs, 8
|
||||
LTEXT "", IDT_BENCH_MEMORY_VAL, gc2x + gc2xs, m + 1, 40, 8
|
||||
|
||||
LTEXT "&Number of CPU threads:", IDT_BENCH_NUM_THREADS, m, 28, g0xs, 8
|
||||
COMBOBOX IDC_BENCH_NUM_THREADS, g1x, 27, g1xs, 140, MY_COMBO
|
||||
LTEXT "", IDT_BENCH_HARDWARE_THREADS, gc2x, 28, 40, 8
|
||||
|
||||
RTEXT "CPU Usage", IDT_BENCH_USAGE_LABEL, xUsage, 54, sUsage, 8
|
||||
RTEXT "Speed", IDT_BENCH_SPEED, xSpeed, 54, sSpeed, 8
|
||||
RTEXT "Rating / Usage", IDT_BENCH_RPU_LABEL, xRpu, 54, sRpu, 8
|
||||
RTEXT "Rating", IDT_BENCH_RATING_LABEL, xRating, 54, sRating, 8
|
||||
|
||||
GROUPBOX "Compressing", IDG_BENCH_COMPRESSING, m, 64, xc, GROUP_Y_SIZE
|
||||
|
||||
LTEXT "Current", IDT_BENCH_CURRENT, g4x, 76, sLabel, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_USAGE1, xUsage, 76, sUsage, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_SPEED1, xSpeed, 76, sSpeed, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_RPU1, xRpu, 76, sRpu, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_RATING1, xRating, 76, sRating, 8
|
||||
|
||||
LTEXT "Resulting", IDT_BENCH_RESULTING, g4x, 89, sLabel, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_USAGE2, xUsage, 89, sUsage, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_SPEED2, xSpeed, 89, sSpeed, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_RPU2, xRpu, 89, sRpu, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_RATING2, xRating, 89, sRating, 8
|
||||
|
||||
GROUPBOX "Decompressing", IDG_BENCH_DECOMPRESSING, m, 111, xc, GROUP_Y_SIZE
|
||||
|
||||
LTEXT "Current", IDT_BENCH_CURRENT2, g4x, 123, sLabel, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_USAGE1, xUsage, 123, sUsage, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_SPEED1, xSpeed, 123, sSpeed, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_RPU1, xRpu, 123, sRpu, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_RATING1, xRating, 123, sRating, 8
|
||||
|
||||
LTEXT "Resulting", IDT_BENCH_RESULTING2, g4x, 136, sLabel, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_USAGE2, xUsage, 136, sUsage, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_SPEED2, xSpeed, 136, sSpeed, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_RPU2, xRpu, 136, sRpu, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_RATING2, xRating, 136, sRating, 8
|
||||
|
||||
GROUPBOX "Total Rating", IDG_BENCH_TOTAL_RATING, xTotalRating, 163, sTotalRating, GROUP_Y2_SIZE
|
||||
|
||||
RTEXT "", IDT_BENCH_TOTAL_USAGE_VAL, xUsage, 176, sUsage, 8
|
||||
RTEXT "", IDT_BENCH_TOTAL_RPU_VAL, xRpu, 176, sRpu, 8
|
||||
RTEXT "", IDT_BENCH_TOTAL_RATING_VAL, xRating, 176, sRating, 8
|
||||
|
||||
RTEXT "", IDT_BENCH_CPU, m, 202, xc, 8
|
||||
RTEXT "", IDT_BENCH_VER, m, 216, xc, 8
|
||||
|
||||
LTEXT "Elapsed time:", IDT_BENCH_ELAPSED, m, 163, g2xs, 8
|
||||
LTEXT "Size:", IDT_BENCH_SIZE, m, 176, g2xs, 8
|
||||
LTEXT "Passes:", IDT_BENCH_PASSES, m, 189, g2xs, 8
|
||||
|
||||
RTEXT "", IDT_BENCH_ELAPSED_VAL, g3x, 163, g3xs, 8
|
||||
RTEXT "", IDT_BENCH_SIZE_VAL, g3x, 176, g3xs, 8
|
||||
RTEXT "", IDT_BENCH_PASSES_VAL, g3x, 189, g3xs, 8
|
||||
END
|
||||
|
||||
#ifdef UNDER_CE
|
||||
|
||||
#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_BENCH_2 DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
|
||||
CAPTION "Benchmark"
|
||||
MY_FONT
|
||||
BEGIN
|
||||
PUSHBUTTON "&Restart", IDB_RESTART, bx1, m, bxs, bys
|
||||
PUSHBUTTON "&Stop", IDB_STOP, bx1, m + bys + m, bxs, bys
|
||||
|
||||
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
|
||||
|
||||
LTEXT "&Dictionary size:", IDT_BENCH_DICTIONARY, m, m, g0xs, 8
|
||||
COMBOBOX IDC_BENCH_DICTIONARY, m, m + 11, g1xs, 140, MY_COMBO
|
||||
|
||||
LTEXT "&Number of CPU threads:", IDT_BENCH_NUM_THREADS, m, 31, g0xs, 8
|
||||
COMBOBOX IDC_BENCH_NUM_THREADS, m, 42, g1xs, 140, MY_COMBO
|
||||
|
||||
LTEXT "", IDT_BENCH_MEMORY_VAL, m + g1xs + 8, m + 13, xc - bxs - g1xs - 8, 8
|
||||
LTEXT "", IDT_BENCH_HARDWARE_THREADS, m + g1xs + 8, 44, xc - bxs - g1xs - 8, 8
|
||||
|
||||
LTEXT "Current", IDT_BENCH_CURRENT, g4x, 70, sLabel, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_USAGE1, xUsage, 70, sUsage, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_RPU1, xRpu, 70, sRpu, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_RATING1, xRating, 70, sRating, 8
|
||||
|
||||
LTEXT "Resulting", IDT_BENCH_RESULTING, g4x, 80, sLabel, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_USAGE2, xUsage, 80, sUsage, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_RPU2, xRpu, 80, sRpu, 8
|
||||
RTEXT "", IDT_BENCH_COMPRESS_RATING2, xRating, 80, sRating, 8
|
||||
|
||||
LTEXT "Compressing", IDG_BENCH_COMPRESSING, m, 60, xc - bxs, 8
|
||||
|
||||
LTEXT "Current", IDT_BENCH_CURRENT2, g4x, 104, sLabel, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_USAGE1, xUsage, 104, sUsage, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_RPU1, xRpu, 104, sRpu, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_RATING1, xRating, 104, sRating, 8
|
||||
|
||||
LTEXT "Resulting", IDT_BENCH_RESULTING2, g4x, 114, sLabel, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_USAGE2, xUsage, 114, sUsage, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_RPU2, xRpu, 114, sRpu, 8
|
||||
RTEXT "", IDT_BENCH_DECOMPR_RATING2, xRating, 114, sRating, 8
|
||||
|
||||
LTEXT "Decompressing", IDG_BENCH_DECOMPRESSING, m, 94, xc, 8
|
||||
|
||||
RTEXT "", IDT_BENCH_TOTAL_RPU_VAL, xRpu, 140, sRpu, 8
|
||||
RTEXT "", IDT_BENCH_TOTAL_RATING_VAL, xRating, 140, sRating, 8
|
||||
|
||||
LTEXT "Elapsed time:", IDT_BENCH_ELAPSED, m, 130, g2xs, 8
|
||||
LTEXT "Size:", IDT_BENCH_SIZE, m, 140, g2xs, 8
|
||||
LTEXT "Passes:", IDT_BENCH_PASSES, m, 150, g2xs, 8
|
||||
|
||||
RTEXT "", IDT_BENCH_ELAPSED_VAL, g3x, 130, g3xs, 8
|
||||
RTEXT "", IDT_BENCH_SIZE_VAL, g3x, 140, g3xs, 8
|
||||
RTEXT "", IDT_BENCH_PASSES_VAL, g3x, 150, g3xs, 8
|
||||
END
|
||||
|
||||
#endif
|
||||
|
||||
#include "../../GuiCommon.rc"
|
||||
|
||||
#define xc 360
|
||||
#define yc 260
|
||||
|
||||
IDD_BENCH_TOTAL DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
|
||||
CAPTION "Benchmark"
|
||||
{
|
||||
LTEXT "Elapsed time:", IDT_BENCH_ELAPSED, m, m, 58, 8
|
||||
RTEXT "", IDT_BENCH_ELAPSED_VAL, m + 58, m, 38, 8
|
||||
EDITTEXT IDE_BENCH2_EDIT, m, m + 14, xc, yc - bys - m - 14, ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL | WS_VSCROLL | WS_HSCROLL
|
||||
PUSHBUTTON "&Help", IDHELP, bx2, by, bxs, bys
|
||||
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
|
||||
}
|
||||
65
CPP/7zip/UI/GUI/BenchmarkDialogRes.h
Normal file
65
CPP/7zip/UI/GUI/BenchmarkDialogRes.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#define IDD_BENCH 7600
|
||||
#define IDD_BENCH_2 17600
|
||||
#define IDD_BENCH_TOTAL 7699
|
||||
|
||||
#define IDE_BENCH2_EDIT 100
|
||||
|
||||
#define IDC_BENCH_DICTIONARY 101
|
||||
#define IDT_BENCH_MEMORY_VAL 102
|
||||
#define IDC_BENCH_NUM_THREADS 103
|
||||
#define IDT_BENCH_HARDWARE_THREADS 104
|
||||
|
||||
#define IDT_BENCH_VER 105
|
||||
#define IDT_BENCH_CPU 106
|
||||
|
||||
#define IDT_BENCH_COMPRESS_SPEED1 110
|
||||
#define IDT_BENCH_COMPRESS_SPEED2 111
|
||||
#define IDT_BENCH_COMPRESS_RATING1 112
|
||||
#define IDT_BENCH_COMPRESS_RATING2 113
|
||||
#define IDT_BENCH_COMPRESS_USAGE1 114
|
||||
#define IDT_BENCH_COMPRESS_USAGE2 115
|
||||
#define IDT_BENCH_COMPRESS_RPU1 116
|
||||
#define IDT_BENCH_COMPRESS_RPU2 117
|
||||
|
||||
#define IDT_BENCH_DECOMPR_SPEED1 118
|
||||
#define IDT_BENCH_DECOMPR_SPEED2 119
|
||||
#define IDT_BENCH_DECOMPR_RATING1 120
|
||||
#define IDT_BENCH_DECOMPR_RATING2 121
|
||||
#define IDT_BENCH_DECOMPR_USAGE1 122
|
||||
#define IDT_BENCH_DECOMPR_USAGE2 123
|
||||
#define IDT_BENCH_DECOMPR_RPU1 124
|
||||
#define IDT_BENCH_DECOMPR_RPU2 125
|
||||
|
||||
#define IDT_BENCH_TOTAL_RATING_VAL 130
|
||||
#define IDT_BENCH_TOTAL_RPU_VAL 131
|
||||
#define IDT_BENCH_TOTAL_USAGE_VAL 133
|
||||
|
||||
#define IDT_BENCH_ELAPSED_VAL 140
|
||||
#define IDT_BENCH_SIZE_VAL 141
|
||||
#define IDT_BENCH_PASSES_VAL 142
|
||||
|
||||
|
||||
#define IDB_STOP 442
|
||||
#define IDB_RESTART 443
|
||||
|
||||
#define IDT_BENCH_DICTIONARY 4006
|
||||
#define IDT_BENCH_NUM_THREADS 4009
|
||||
|
||||
#define IDT_BENCH_SIZE 1007
|
||||
#define IDT_BENCH_ELAPSED 3900
|
||||
#define IDT_BENCH_SPEED 3903
|
||||
|
||||
#define IDT_BENCH_MEMORY 7601
|
||||
|
||||
#define IDG_BENCH_COMPRESSING 7602
|
||||
#define IDG_BENCH_DECOMPRESSING 7603
|
||||
#define IDG_BENCH_TOTAL_RATING 7605
|
||||
|
||||
#define IDT_BENCH_RATING_LABEL 7604
|
||||
#define IDT_BENCH_CURRENT 7606
|
||||
#define IDT_BENCH_RESULTING 7607
|
||||
#define IDT_BENCH_USAGE_LABEL 7608
|
||||
#define IDT_BENCH_RPU_LABEL 7609
|
||||
#define IDT_BENCH_PASSES 7610
|
||||
#define IDT_BENCH_CURRENT2 (7606+50)
|
||||
#define IDT_BENCH_RESULTING2 (7607+50)
|
||||
1733
CPP/7zip/UI/GUI/CompressDialog.cpp
Normal file
1733
CPP/7zip/UI/GUI/CompressDialog.cpp
Normal file
File diff suppressed because it is too large
Load Diff
215
CPP/7zip/UI/GUI/CompressDialog.h
Normal file
215
CPP/7zip/UI/GUI/CompressDialog.h
Normal file
@@ -0,0 +1,215 @@
|
||||
// CompressDialog.h
|
||||
|
||||
#ifndef __COMPRESS_DIALOG_H
|
||||
#define __COMPRESS_DIALOG_H
|
||||
|
||||
#include "../../../Common/Wildcard.h"
|
||||
|
||||
#include "../../../Windows/Control/ComboBox.h"
|
||||
#include "../../../Windows/Control/Edit.h"
|
||||
|
||||
#include "../Common/LoadCodecs.h"
|
||||
#include "../Common/ZipRegistry.h"
|
||||
|
||||
#include "../FileManager/DialogSize.h"
|
||||
|
||||
#include "CompressDialogRes.h"
|
||||
|
||||
namespace NCompressDialog
|
||||
{
|
||||
namespace NUpdateMode
|
||||
{
|
||||
enum EEnum
|
||||
{
|
||||
kAdd,
|
||||
kUpdate,
|
||||
kFresh,
|
||||
kSync
|
||||
};
|
||||
}
|
||||
|
||||
struct CInfo
|
||||
{
|
||||
NUpdateMode::EEnum UpdateMode;
|
||||
NWildcard::ECensorPathMode PathMode;
|
||||
|
||||
bool SolidIsSpecified;
|
||||
bool MultiThreadIsAllowed;
|
||||
UInt64 SolidBlockSize;
|
||||
UInt32 NumThreads;
|
||||
|
||||
CRecordVector<UInt64> VolumeSizes;
|
||||
|
||||
UInt32 Level;
|
||||
UString Method;
|
||||
UInt32 Dictionary;
|
||||
bool OrderMode;
|
||||
UInt32 Order;
|
||||
UString Options;
|
||||
|
||||
UString EncryptionMethod;
|
||||
|
||||
bool SFXMode;
|
||||
bool OpenShareForWrite;
|
||||
bool DeleteAfterCompressing;
|
||||
|
||||
CBoolPair SymLinks;
|
||||
CBoolPair HardLinks;
|
||||
CBoolPair AltStreams;
|
||||
CBoolPair NtSecurity;
|
||||
|
||||
UString ArcPath; // in: Relative or abs ; out: Relative or abs
|
||||
|
||||
// FString CurrentDirPrefix;
|
||||
bool KeepName;
|
||||
|
||||
bool GetFullPathName(UString &result) const;
|
||||
|
||||
int FormatIndex;
|
||||
|
||||
UString Password;
|
||||
bool EncryptHeadersIsAllowed;
|
||||
bool EncryptHeaders;
|
||||
|
||||
CInfo():
|
||||
UpdateMode(NCompressDialog::NUpdateMode::kAdd),
|
||||
PathMode(NWildcard::k_RelatPath),
|
||||
SFXMode(false),
|
||||
OpenShareForWrite(false),
|
||||
DeleteAfterCompressing(false),
|
||||
FormatIndex(-1)
|
||||
{
|
||||
Level = Dictionary = Order = UInt32(-1);
|
||||
OrderMode = false;
|
||||
Method.Empty();
|
||||
Options.Empty();
|
||||
EncryptionMethod.Empty();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class CCompressDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
NWindows::NControl::CComboBox m_ArchivePath;
|
||||
NWindows::NControl::CComboBox m_Format;
|
||||
NWindows::NControl::CComboBox m_Level;
|
||||
NWindows::NControl::CComboBox m_Method;
|
||||
NWindows::NControl::CComboBox m_Dictionary;
|
||||
NWindows::NControl::CComboBox m_Order;
|
||||
NWindows::NControl::CComboBox m_Solid;
|
||||
NWindows::NControl::CComboBox m_NumThreads;
|
||||
|
||||
NWindows::NControl::CComboBox m_UpdateMode;
|
||||
NWindows::NControl::CComboBox m_PathMode;
|
||||
|
||||
NWindows::NControl::CComboBox m_Volume;
|
||||
NWindows::NControl::CDialogChildControl m_Params;
|
||||
|
||||
NWindows::NControl::CEdit _password1Control;
|
||||
NWindows::NControl::CEdit _password2Control;
|
||||
NWindows::NControl::CComboBox _encryptionMethod;
|
||||
|
||||
NCompression::CInfo m_RegistryInfo;
|
||||
|
||||
int m_PrevFormat;
|
||||
UString DirPrefix;
|
||||
UString StartDirPrefix;
|
||||
|
||||
void CheckButton_TwoBools(UINT id, const CBoolPair &b1, const CBoolPair &b2);
|
||||
void GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2);
|
||||
|
||||
void SetArchiveName(const UString &name);
|
||||
int FindRegistryFormat(const UString &name);
|
||||
int FindRegistryFormatAlways(const UString &name);
|
||||
|
||||
void CheckSFXNameChange();
|
||||
void SetArchiveName2(bool prevWasSFX);
|
||||
|
||||
int GetStaticFormatIndex();
|
||||
|
||||
void SetNearestSelectComboBox(NWindows::NControl::CComboBox &comboBox, UInt32 value);
|
||||
|
||||
void SetLevel();
|
||||
|
||||
void SetMethod(int keepMethodId = -1);
|
||||
int GetMethodID();
|
||||
UString GetMethodSpec();
|
||||
UString GetEncryptionMethodSpec();
|
||||
|
||||
bool IsZipFormat();
|
||||
|
||||
void SetEncryptionMethod();
|
||||
|
||||
void AddDictionarySize(UInt32 size);
|
||||
|
||||
void SetDictionary();
|
||||
|
||||
UInt32 GetComboValue(NWindows::NControl::CComboBox &c, int defMax = 0);
|
||||
|
||||
UInt32 GetLevel() { return GetComboValue(m_Level); }
|
||||
UInt32 GetLevelSpec() { return GetComboValue(m_Level, 1); }
|
||||
UInt32 GetLevel2();
|
||||
UInt32 GetDictionary() { return GetComboValue(m_Dictionary); }
|
||||
UInt32 GetDictionarySpec() { return GetComboValue(m_Dictionary, 1); }
|
||||
UInt32 GetOrder() { return GetComboValue(m_Order); }
|
||||
UInt32 GetOrderSpec() { return GetComboValue(m_Order, 1); }
|
||||
UInt32 GetNumThreadsSpec() { return GetComboValue(m_NumThreads, 1); }
|
||||
UInt32 GetNumThreads2() { UInt32 num = GetNumThreadsSpec(); if (num == UInt32(-1)) num = 1; return num; }
|
||||
UInt32 GetBlockSizeSpec() { return GetComboValue(m_Solid, 1); }
|
||||
|
||||
int AddOrder(UInt32 size);
|
||||
void SetOrder();
|
||||
bool GetOrderMode();
|
||||
|
||||
void SetSolidBlockSize();
|
||||
void SetNumThreads();
|
||||
|
||||
UInt64 GetMemoryUsage(UInt32 dict, UInt64 &decompressMemory);
|
||||
UInt64 GetMemoryUsage(UInt64 &decompressMemory);
|
||||
void PrintMemUsage(UINT res, UInt64 value);
|
||||
void SetMemoryUsage();
|
||||
void SetParams();
|
||||
void SaveOptionsInMem();
|
||||
|
||||
void UpdatePasswordControl();
|
||||
bool IsShowPasswordChecked() const { return IsButtonCheckedBool(IDX_PASSWORD_SHOW); }
|
||||
|
||||
unsigned GetFormatIndex();
|
||||
bool SetArcPathFields(const UString &path, UString &name, bool always);
|
||||
bool GetFinalPath_Smart(UString &resPath);
|
||||
|
||||
public:
|
||||
CObjectVector<CArcInfoEx> *ArcFormats;
|
||||
CUIntVector ArcIndices; // can not be empty, must contain Info.FormatIndex, if Info.FormatIndex >= 0
|
||||
|
||||
NCompressDialog::CInfo Info;
|
||||
UString OriginalFileName; // for bzip2, gzip2
|
||||
bool CurrentDirWasChanged;
|
||||
|
||||
INT_PTR Create(HWND wndParent = 0)
|
||||
{
|
||||
BIG_DIALOG_SIZE(400, 304);
|
||||
return CModalDialog::Create(SIZED_DIALOG(IDD_COMPRESS), wndParent);
|
||||
}
|
||||
|
||||
CCompressDialog(): CurrentDirWasChanged(false) {};
|
||||
|
||||
protected:
|
||||
|
||||
void CheckSFXControlsEnable();
|
||||
// void CheckVolumeEnable();
|
||||
void CheckControlsEnable();
|
||||
|
||||
void OnButtonSetArchive();
|
||||
bool IsSFX();
|
||||
void OnButtonSFX();
|
||||
|
||||
virtual bool OnInit();
|
||||
virtual bool OnCommand(int code, int itemID, LPARAM lParam);
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
virtual void OnOK();
|
||||
virtual void OnHelp();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
227
CPP/7zip/UI/GUI/CompressDialog.rc
Normal file
227
CPP/7zip/UI/GUI/CompressDialog.rc
Normal file
@@ -0,0 +1,227 @@
|
||||
#include "CompressDialogRes.h"
|
||||
#include "../../GuiCommon.rc"
|
||||
|
||||
#define xc 400
|
||||
#define yc 354
|
||||
|
||||
#undef gSize
|
||||
#undef gSpace
|
||||
#undef g0xs
|
||||
#undef g1x
|
||||
#undef g1xs
|
||||
#undef g2xs
|
||||
#undef g3x
|
||||
#undef g3xs
|
||||
#undef g4x
|
||||
#undef g4x2
|
||||
#undef g4xs
|
||||
#undef g4xs2
|
||||
|
||||
#define gSize 192
|
||||
#define gSpace 24
|
||||
|
||||
#define ntSize2 168
|
||||
#define ntSizeX (ntSize2 - m - m)
|
||||
#define ntPosX m + m
|
||||
#define ntPosY 292
|
||||
|
||||
#define g1xs 88
|
||||
#define g0xs (gSize - g1xs)
|
||||
#define g1x (m + g0xs)
|
||||
|
||||
#define g3xs 40
|
||||
#define g2xs (gSize - g3xs)
|
||||
#define g3x (m + g2xs)
|
||||
|
||||
#define g4x (m + gSize + gSpace)
|
||||
#define g4x2 (g4x + m)
|
||||
#define g4xs (xc - gSize - gSpace)
|
||||
#define g4xs2 (g4xs - m - m)
|
||||
|
||||
#define yOpt 80
|
||||
|
||||
#define xArcFolderOffs 40
|
||||
|
||||
#undef GROUP_Y_SIZE
|
||||
#undef GROUP_Y_SIZE_ENCRYPT
|
||||
#ifdef UNDER_CE
|
||||
#define GROUP_Y_SIZE 8
|
||||
#define GROUP_Y_SIZE_ENCRYPT 8
|
||||
#else
|
||||
#define GROUP_Y_SIZE 64
|
||||
#define GROUP_Y_SIZE_ENCRYPT 128
|
||||
#endif
|
||||
|
||||
#define yPsw (yOpt + GROUP_Y_SIZE + 8)
|
||||
|
||||
IDD_COMPRESS DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
|
||||
CAPTION "Add to Archive"
|
||||
BEGIN
|
||||
LTEXT "", IDT_COMPRESS_ARCHIVE_FOLDER, m + xArcFolderOffs, m, xc - xArcFolderOffs, 8
|
||||
LTEXT "&Archive:", IDT_COMPRESS_ARCHIVE, m, 12, xArcFolderOffs, 8
|
||||
COMBOBOX IDC_COMPRESS_ARCHIVE, m + xArcFolderOffs, 18, xc - bxsDots - 12 - xArcFolderOffs, 126, MY_COMBO_WITH_EDIT
|
||||
PUSHBUTTON "...", IDB_COMPRESS_SET_ARCHIVE, xs - m - bxsDots, 16, bxsDots, bys, WS_GROUP
|
||||
|
||||
LTEXT "Archive &format:", IDT_COMPRESS_FORMAT, m, 41, g0xs, 8
|
||||
COMBOBOX IDC_COMPRESS_FORMAT, g1x, 39, g1xs, 80, MY_COMBO | CBS_SORT
|
||||
|
||||
LTEXT "Compression &level:", IDT_COMPRESS_LEVEL, m, 62, g0xs, 8
|
||||
COMBOBOX IDC_COMPRESS_LEVEL, g1x, 60, g1xs, 80, MY_COMBO
|
||||
|
||||
LTEXT "Compression &method:", IDT_COMPRESS_METHOD, m, 83, g0xs, 8
|
||||
COMBOBOX IDC_COMPRESS_METHOD, g1x, 81, g1xs, 80, MY_COMBO
|
||||
|
||||
LTEXT "&Dictionary size:", IDT_COMPRESS_DICTIONARY, m, 104, g0xs, 8
|
||||
COMBOBOX IDC_COMPRESS_DICTIONARY, g1x, 102, g1xs, 167, MY_COMBO
|
||||
|
||||
LTEXT "&Word size:", IDT_COMPRESS_ORDER, m, 125, g0xs, 8
|
||||
COMBOBOX IDC_COMPRESS_ORDER, g1x, 123, g1xs, 141, MY_COMBO
|
||||
|
||||
LTEXT "&Solid Block size:", IDT_COMPRESS_SOLID, m, 146, g0xs, 8
|
||||
COMBOBOX IDC_COMPRESS_SOLID, g1x, 144, g1xs, 140, MY_COMBO
|
||||
|
||||
LTEXT "Number of CPU &threads:", IDT_COMPRESS_THREADS, m, 167, g0xs, 8
|
||||
COMBOBOX IDC_COMPRESS_THREADS, g1x, 165, g1xs - 35, 140, MY_COMBO
|
||||
RTEXT "", IDT_COMPRESS_HARDWARE_THREADS, g1x + g1xs - 35 + 10, 167, 25, 8
|
||||
|
||||
|
||||
LTEXT "Memory usage for Compressing:", IDT_COMPRESS_MEMORY, m, 190, g2xs, 8
|
||||
RTEXT "", IDT_COMPRESS_MEMORY_VALUE, g3x, 190, g3xs, 8
|
||||
|
||||
LTEXT "Memory usage for Decompressing:", IDT_COMPRESS_MEMORY_DE, m, 206, g2xs, 8
|
||||
RTEXT "", IDT_COMPRESS_MEMORY_DE_VALUE, g3x, 206, g3xs, 8
|
||||
|
||||
|
||||
LTEXT "Split to &volumes, bytes:", IDT_SPLIT_TO_VOLUMES, m, 225, gSize, 8
|
||||
COMBOBOX IDC_COMPRESS_VOLUME, m, 237, gSize, 73, MY_COMBO_WITH_EDIT
|
||||
|
||||
LTEXT "Parameters:", IDT_COMPRESS_PARAMETERS, m, 256, gSize, 8
|
||||
EDITTEXT IDE_COMPRESS_PARAMETERS, m, 268, gSize, 14, ES_AUTOHSCROLL
|
||||
|
||||
|
||||
GROUPBOX "NTFS", IDG_COMPRESS_NTFS, m, ntPosY, ntSize2, 68
|
||||
|
||||
CONTROL "Store symbolic links", IDX_COMPRESS_NT_SYM_LINKS, MY_CHECKBOX,
|
||||
ntPosX, ntPosY + 12, ntSizeX, 10
|
||||
CONTROL "Store hard links", IDX_COMPRESS_NT_HARD_LINKS, MY_CHECKBOX,
|
||||
ntPosX, ntPosY + 26, ntSizeX, 10
|
||||
CONTROL "Store alternate data streams", IDX_COMPRESS_NT_ALT_STREAMS, MY_CHECKBOX,
|
||||
ntPosX, ntPosY + 40, ntSizeX, 10
|
||||
CONTROL "Store file security", IDX_COMPRESS_NT_SECUR, MY_CHECKBOX,
|
||||
ntPosX, ntPosY + 54, ntSizeX, 10
|
||||
|
||||
|
||||
LTEXT "&Update mode:", IDT_COMPRESS_UPDATE_MODE, g4x, 41, 80, 8
|
||||
COMBOBOX IDC_COMPRESS_UPDATE_MODE, g4x + 84, 39, g4xs - 84, 80, MY_COMBO
|
||||
|
||||
LTEXT "Path mode:", IDT_COMPRESS_PATH_MODE, g4x, 61, 80, 8
|
||||
COMBOBOX IDC_COMPRESS_PATH_MODE, g4x + 84, 59, g4xs - 84, 80, MY_COMBO
|
||||
|
||||
|
||||
GROUPBOX "Options", IDG_COMPRESS_OPTIONS, g4x, yOpt, g4xs, GROUP_Y_SIZE
|
||||
|
||||
CONTROL "Create SF&X archive", IDX_COMPRESS_SFX, MY_CHECKBOX,
|
||||
g4x2, yOpt + 14, g4xs2, 10
|
||||
CONTROL "Compress shared files", IDX_COMPRESS_SHARED, MY_CHECKBOX,
|
||||
g4x2, yOpt + 30, g4xs2, 10
|
||||
CONTROL "Delete files after compression", IDX_COMPRESS_DEL, MY_CHECKBOX,
|
||||
g4x2, yOpt + 46, g4xs2, 10
|
||||
|
||||
|
||||
GROUPBOX "Encryption", IDG_COMPRESS_ENCRYPTION, g4x, yPsw, g4xs, GROUP_Y_SIZE_ENCRYPT
|
||||
|
||||
LTEXT "Enter &password:", IDT_PASSWORD_ENTER, g4x2, yPsw + 14, g4xs2, 8
|
||||
EDITTEXT IDE_COMPRESS_PASSWORD1, g4x2, yPsw + 26, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
|
||||
LTEXT "Reenter password:", IDT_PASSWORD_REENTER, g4x2, yPsw + 46, g4xs2, 8
|
||||
EDITTEXT IDE_COMPRESS_PASSWORD2, g4x2, yPsw + 58, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
|
||||
|
||||
CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX,
|
||||
g4x2, yPsw + 79, g4xs2, 10
|
||||
|
||||
LTEXT "&Encryption method:", IDT_COMPRESS_ENCRYPTION_METHOD, g4x2, yPsw + 95, 100, 8
|
||||
COMBOBOX IDC_COMPRESS_ENCRYPTION_METHOD, g4x2 + 100, yPsw + 93, g4xs2 - 100, 198, MY_COMBO
|
||||
|
||||
CONTROL "Encrypt file &names", IDX_COMPRESS_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_COMPRESS_2 DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
|
||||
CAPTION "Add to Archive"
|
||||
MY_FONT
|
||||
BEGIN
|
||||
COMBOBOX IDC_COMPRESS_ARCHIVE, m, m, xc - bxsDots - m, 126, MY_COMBO_WITH_EDIT
|
||||
PUSHBUTTON "...", IDB_COMPRESS_SET_ARCHIVE, xs - m - bxsDots, m, bxsDots, 12, WS_GROUP
|
||||
|
||||
COMBOBOX IDC_COMPRESS_FORMAT, m , 22, 32, 80, MY_COMBO | CBS_SORT
|
||||
COMBOBOX IDC_COMPRESS_LEVEL, m + 36, 22, 68, 80, MY_COMBO
|
||||
COMBOBOX IDC_COMPRESS_METHOD, m + 108, 22, 44, 80, MY_COMBO
|
||||
|
||||
COMBOBOX IDC_COMPRESS_DICTIONARY, m, 40, 40, 80, MY_COMBO
|
||||
COMBOBOX IDC_COMPRESS_ORDER, m + 44, 40, 32, 80, MY_COMBO
|
||||
COMBOBOX IDC_COMPRESS_SOLID, m + 80, 40, 40, 80, MY_COMBO
|
||||
COMBOBOX IDC_COMPRESS_THREADS, m + 124, 40, 28, 80, MY_COMBO
|
||||
|
||||
LTEXT "Split to &volumes, bytes:", IDT_SPLIT_TO_VOLUMES, m, 60, 32, 8
|
||||
COMBOBOX IDC_COMPRESS_VOLUME, m + 32, 58, 44, 73, MY_COMBO_WITH_EDIT
|
||||
LTEXT "Parameters:", IDT_COMPRESS_PARAMETERS, m + 80, 60, 48, 8
|
||||
EDITTEXT IDE_COMPRESS_PARAMETERS, m + 128, 58, 24, 13, ES_AUTOHSCROLL
|
||||
|
||||
COMBOBOX IDC_COMPRESS_UPDATE_MODE, m, 76, 88, 80, MY_COMBO
|
||||
CONTROL "SF&X", IDX_COMPRESS_SFX, MY_CHECKBOX, m + 92, 77, 60, 10
|
||||
|
||||
CONTROL "Compress shared files", IDX_COMPRESS_SHARED, MY_CHECKBOX, m, 94, xc, 10
|
||||
|
||||
LTEXT "Enter &password:", IDT_PASSWORD_ENTER, m, 112, 60, 8
|
||||
EDITTEXT IDE_COMPRESS_PASSWORD1, m + 60, 110, 44, 13, ES_PASSWORD | ES_AUTOHSCROLL
|
||||
CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX, m + 108, 112, 44, 10
|
||||
|
||||
COMBOBOX IDC_COMPRESS_ENCRYPTION_METHOD, m, 128, 48, 198, MY_COMBO
|
||||
CONTROL "Encrypt file &names", IDX_COMPRESS_ENCRYPT_FILE_NAMES, MY_CHECKBOX, m + 52, 130, 100, 10
|
||||
|
||||
OK_CANCEL
|
||||
END
|
||||
|
||||
#endif
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_PASSWORD_NOT_MATCH "Passwords do not match"
|
||||
IDS_PASSWORD_USE_ASCII "Use only English letters, numbers and special characters (!, #, $, ...) for password."
|
||||
IDS_PASSWORD_TOO_LONG "Password is too long"
|
||||
|
||||
IDS_METHOD_STORE "Store"
|
||||
IDS_METHOD_FASTEST "Fastest"
|
||||
IDS_METHOD_FAST "Fast"
|
||||
IDS_METHOD_NORMAL "Normal"
|
||||
IDS_METHOD_MAXIMUM "Maximum"
|
||||
IDS_METHOD_ULTRA "Ultra"
|
||||
|
||||
IDS_COMPRESS_UPDATE_MODE_ADD "Add and replace files"
|
||||
IDS_COMPRESS_UPDATE_MODE_UPDATE "Update and add files"
|
||||
IDS_COMPRESS_UPDATE_MODE_FRESH "Freshen existing files"
|
||||
IDS_COMPRESS_UPDATE_MODE_SYNC "Synchronize files"
|
||||
|
||||
IDS_OPEN_TYPE_ALL_FILES "All Files"
|
||||
IDS_COMPRESS_SET_ARCHIVE_BROWSE "Browse"
|
||||
|
||||
IDS_COMPRESS_NON_SOLID "Non-solid"
|
||||
IDS_COMPRESS_SOLID "Solid"
|
||||
|
||||
IDS_SPLIT_CONFIRM "Specified volume size: {0} bytes.\nAre you sure you want to split archive into such volumes?"
|
||||
END
|
||||
87
CPP/7zip/UI/GUI/CompressDialogRes.h
Normal file
87
CPP/7zip/UI/GUI/CompressDialogRes.h
Normal file
@@ -0,0 +1,87 @@
|
||||
#define IDD_COMPRESS 4000
|
||||
#define IDD_COMPRESS_2 14000
|
||||
|
||||
#define IDC_COMPRESS_ARCHIVE 100
|
||||
#define IDB_COMPRESS_SET_ARCHIVE 101
|
||||
#define IDC_COMPRESS_LEVEL 102
|
||||
#define IDC_COMPRESS_UPDATE_MODE 103
|
||||
#define IDC_COMPRESS_FORMAT 104
|
||||
#define IDC_COMPRESS_VOLUME 105
|
||||
#define IDC_COMPRESS_METHOD 106
|
||||
#define IDC_COMPRESS_DICTIONARY 107
|
||||
#define IDC_COMPRESS_ORDER 108
|
||||
#define IDC_COMPRESS_SOLID 109
|
||||
#define IDC_COMPRESS_THREADS 110
|
||||
#define IDE_COMPRESS_PARAMETERS 111
|
||||
|
||||
#define IDT_COMPRESS_HARDWARE_THREADS 112
|
||||
#define IDT_COMPRESS_MEMORY_VALUE 113
|
||||
#define IDT_COMPRESS_MEMORY_DE_VALUE 114
|
||||
|
||||
#define IDG_COMPRESS_NTFS 115
|
||||
#define IDC_COMPRESS_PATH_MODE 116
|
||||
|
||||
#define IDE_COMPRESS_PASSWORD1 120
|
||||
#define IDE_COMPRESS_PASSWORD2 121
|
||||
#define IDC_COMPRESS_ENCRYPTION_METHOD 122
|
||||
|
||||
#define IDT_COMPRESS_ARCHIVE_FOLDER 130
|
||||
|
||||
#define IDT_COMPRESS_PATH_MODE 3410
|
||||
|
||||
#define IDT_PASSWORD_ENTER 3801
|
||||
#define IDT_PASSWORD_REENTER 3802
|
||||
#define IDX_PASSWORD_SHOW 3803
|
||||
#define IDS_PASSWORD_NOT_MATCH 3804
|
||||
#define IDS_PASSWORD_USE_ASCII 3805
|
||||
#define IDS_PASSWORD_TOO_LONG 3806
|
||||
|
||||
#define IDT_COMPRESS_ARCHIVE 4001
|
||||
#define IDT_COMPRESS_UPDATE_MODE 4002
|
||||
#define IDT_COMPRESS_FORMAT 4003
|
||||
#define IDT_COMPRESS_LEVEL 4004
|
||||
#define IDT_COMPRESS_METHOD 4005
|
||||
#define IDT_COMPRESS_DICTIONARY 4006
|
||||
#define IDT_COMPRESS_ORDER 4007
|
||||
#define IDT_COMPRESS_SOLID 4008
|
||||
#define IDT_COMPRESS_THREADS 4009
|
||||
#define IDT_COMPRESS_PARAMETERS 4010
|
||||
#define IDG_COMPRESS_OPTIONS 4011
|
||||
|
||||
#define IDX_COMPRESS_SFX 4012
|
||||
#define IDX_COMPRESS_SHARED 4013
|
||||
|
||||
#define IDG_COMPRESS_ENCRYPTION 4014
|
||||
#define IDT_COMPRESS_ENCRYPTION_METHOD 4015
|
||||
#define IDX_COMPRESS_ENCRYPT_FILE_NAMES 4016
|
||||
|
||||
#define IDT_COMPRESS_MEMORY 4017
|
||||
#define IDT_COMPRESS_MEMORY_DE 4018
|
||||
|
||||
#define IDX_COMPRESS_DEL 4019
|
||||
|
||||
#define IDX_COMPRESS_NT_SYM_LINKS 4040
|
||||
#define IDX_COMPRESS_NT_HARD_LINKS 4041
|
||||
#define IDX_COMPRESS_NT_ALT_STREAMS 4042
|
||||
#define IDX_COMPRESS_NT_SECUR 4043
|
||||
|
||||
#define IDS_METHOD_STORE 4050
|
||||
#define IDS_METHOD_FASTEST 4051
|
||||
#define IDS_METHOD_FAST 4052
|
||||
#define IDS_METHOD_NORMAL 4053
|
||||
#define IDS_METHOD_MAXIMUM 4054
|
||||
#define IDS_METHOD_ULTRA 4055
|
||||
|
||||
#define IDS_COMPRESS_UPDATE_MODE_ADD 4060
|
||||
#define IDS_COMPRESS_UPDATE_MODE_UPDATE 4061
|
||||
#define IDS_COMPRESS_UPDATE_MODE_FRESH 4062
|
||||
#define IDS_COMPRESS_UPDATE_MODE_SYNC 4063
|
||||
|
||||
#define IDS_COMPRESS_SET_ARCHIVE_BROWSE 4070
|
||||
#define IDS_OPEN_TYPE_ALL_FILES 4071
|
||||
#define IDS_COMPRESS_NON_SOLID 4072
|
||||
#define IDS_COMPRESS_SOLID 4073
|
||||
|
||||
#define IDT_SPLIT_TO_VOLUMES 7302
|
||||
#define IDS_INCORRECT_VOLUME_SIZE 7307
|
||||
#define IDS_SPLIT_CONFIRM 7308
|
||||
59
CPP/7zip/UI/GUI/Extract.rc
Normal file
59
CPP/7zip/UI/GUI/Extract.rc
Normal file
@@ -0,0 +1,59 @@
|
||||
#include "ExtractRes.h"
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_MEM_ERROR "The system cannot allocate the required amount of memory"
|
||||
IDS_CANNOT_CREATE_FOLDER "Cannot create folder '{0}'"
|
||||
IDS_UPDATE_NOT_SUPPORTED "Update operations are not supported for this archive."
|
||||
IDS_CANT_OPEN_ARCHIVE "Can not open file '{0}' as archive"
|
||||
IDS_CANT_OPEN_ENCRYPTED_ARCHIVE "Can not open encrypted archive '{0}'. Wrong password?"
|
||||
IDS_UNSUPPORTED_ARCHIVE_TYPE "Unsupported archive type"
|
||||
|
||||
IDS_CANT_OPEN_AS_TYPE "Can not open the file as {0} archive"
|
||||
IDS_IS_OPEN_AS_TYPE "The file is open as {0} archive"
|
||||
IDS_IS_OPEN_WITH_OFFSET "The archive is open with offset"
|
||||
|
||||
IDS_PROGRESS_EXTRACTING "Extracting"
|
||||
|
||||
IDS_PROGRESS_SKIPPING "Skipping"
|
||||
|
||||
IDS_EXTRACT_SET_FOLDER "Specify a location for extracted files."
|
||||
|
||||
IDS_EXTRACT_PATHS_FULL "Full pathnames"
|
||||
IDS_EXTRACT_PATHS_NO "No pathnames"
|
||||
IDS_EXTRACT_PATHS_ABS "Absolute pathnames"
|
||||
IDS_PATH_MODE_RELAT "Relative pathnames"
|
||||
|
||||
IDS_EXTRACT_OVERWRITE_ASK "Ask before overwrite"
|
||||
IDS_EXTRACT_OVERWRITE_WITHOUT_PROMPT "Overwrite without prompt"
|
||||
IDS_EXTRACT_OVERWRITE_SKIP_EXISTING "Skip existing files"
|
||||
IDS_EXTRACT_OVERWRITE_RENAME "Auto rename"
|
||||
IDS_EXTRACT_OVERWRITE_RENAME_EXISTING "Auto rename existing files"
|
||||
|
||||
IDS_EXTRACT_MESSAGE_UNSUPPORTED_METHOD "Unsupported compression method for '{0}'."
|
||||
IDS_EXTRACT_MESSAGE_DATA_ERROR "Data error in '{0}'. File is broken"
|
||||
IDS_EXTRACT_MESSAGE_CRC_ERROR "CRC failed in '{0}'. File is broken."
|
||||
IDS_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED "Data error in encrypted file '{0}'. Wrong password?"
|
||||
IDS_EXTRACT_MESSAGE_CRC_ERROR_ENCRYPTED "CRC failed in encrypted file '{0}'. Wrong password?"
|
||||
|
||||
IDS_EXTRACT_MSG_WRONG_PSW_GUESS "Wrong password?"
|
||||
// IDS_EXTRACT_MSG_ENCRYPTED "Encrypted file"
|
||||
|
||||
IDS_EXTRACT_MSG_UNSUPPORTED_METHOD "Unsupported compression method"
|
||||
IDS_EXTRACT_MSG_DATA_ERROR "Data error"
|
||||
IDS_EXTRACT_MSG_CRC_ERROR "CRC failed"
|
||||
IDS_EXTRACT_MSG_UNAVAILABLE_DATA "Unavailable data"
|
||||
IDS_EXTRACT_MSG_UEXPECTED_END "Unexpected end of data";
|
||||
IDS_EXTRACT_MSG_DATA_AFTER_END "There are some data after the end of the payload data"
|
||||
IDS_EXTRACT_MSG_IS_NOT_ARC "Is not archive"
|
||||
IDS_EXTRACT_MSG_HEADERS_ERROR "Headers Error"
|
||||
IDS_EXTRACT_MSG_WRONG_PSW_CLAIM "Wrong password"
|
||||
|
||||
IDS_OPEN_MSG_UNAVAILABLE_START "Unavailable start of archive"
|
||||
IDS_OPEN_MSG_UNCONFIRMED_START "Unconfirmed start of archive"
|
||||
// IDS_OPEN_MSG_ERROR_FLAGS + 5 "Unexpected end of archive"
|
||||
// IDS_OPEN_MSG_ERROR_FLAGS + 6 "There are data after the end of archive"
|
||||
IDS_OPEN_MSG_UNSUPPORTED_FEATURE "Unsupported feature"
|
||||
END
|
||||
418
CPP/7zip/UI/GUI/ExtractDialog.cpp
Normal file
418
CPP/7zip/UI/GUI/ExtractDialog.cpp
Normal file
@@ -0,0 +1,418 @@
|
||||
// ExtractDialog.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/StringConvert.h"
|
||||
#include "../../../Common/Wildcard.h"
|
||||
|
||||
#include "../../../Windows/FileName.h"
|
||||
#include "../../../Windows/FileDir.h"
|
||||
#include "../../../Windows/ResourceString.h"
|
||||
|
||||
#ifndef NO_REGISTRY
|
||||
#include "../FileManager/HelpUtils.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "../FileManager/BrowseDialog.h"
|
||||
#include "../FileManager/LangUtils.h"
|
||||
#include "../FileManager/resourceGui.h"
|
||||
|
||||
#include "ExtractDialog.h"
|
||||
#include "ExtractDialogRes.h"
|
||||
#include "ExtractRes.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NName;
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
|
||||
static const UInt32 kPathMode_IDs[] =
|
||||
{
|
||||
IDS_EXTRACT_PATHS_FULL,
|
||||
IDS_EXTRACT_PATHS_NO,
|
||||
IDS_EXTRACT_PATHS_ABS
|
||||
};
|
||||
|
||||
static const UInt32 kOverwriteMode_IDs[] =
|
||||
{
|
||||
IDS_EXTRACT_OVERWRITE_ASK,
|
||||
IDS_EXTRACT_OVERWRITE_WITHOUT_PROMPT,
|
||||
IDS_EXTRACT_OVERWRITE_SKIP_EXISTING,
|
||||
IDS_EXTRACT_OVERWRITE_RENAME,
|
||||
IDS_EXTRACT_OVERWRITE_RENAME_EXISTING
|
||||
};
|
||||
|
||||
#ifndef _SFX
|
||||
|
||||
static const
|
||||
// NExtract::NPathMode::EEnum
|
||||
int
|
||||
kPathModeButtonsVals[] =
|
||||
{
|
||||
NExtract::NPathMode::kFullPaths,
|
||||
NExtract::NPathMode::kNoPaths,
|
||||
NExtract::NPathMode::kAbsPaths
|
||||
};
|
||||
|
||||
static const
|
||||
int
|
||||
// NExtract::NOverwriteMode::EEnum
|
||||
kOverwriteButtonsVals[] =
|
||||
{
|
||||
NExtract::NOverwriteMode::kAsk,
|
||||
NExtract::NOverwriteMode::kOverwrite,
|
||||
NExtract::NOverwriteMode::kSkip,
|
||||
NExtract::NOverwriteMode::kRename,
|
||||
NExtract::NOverwriteMode::kRenameExisting
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef LANG
|
||||
|
||||
static const UInt32 kLangIDs[] =
|
||||
{
|
||||
IDT_EXTRACT_EXTRACT_TO,
|
||||
IDT_EXTRACT_PATH_MODE,
|
||||
IDT_EXTRACT_OVERWRITE_MODE,
|
||||
// IDX_EXTRACT_ALT_STREAMS,
|
||||
IDX_EXTRACT_NT_SECUR,
|
||||
IDX_EXTRACT_ELIM_DUP,
|
||||
IDG_PASSWORD,
|
||||
IDX_PASSWORD_SHOW
|
||||
};
|
||||
#endif
|
||||
|
||||
// static const int kWildcardsButtonIndex = 2;
|
||||
|
||||
#ifndef NO_REGISTRY
|
||||
static const unsigned kHistorySize = 16;
|
||||
#endif
|
||||
|
||||
#ifndef _SFX
|
||||
|
||||
// it's used in CompressDialog also
|
||||
void AddComboItems(NControl::CComboBox &combo, const UInt32 *langIDs, unsigned numItems, const int *values, int curVal)
|
||||
{
|
||||
int curSel = 0;
|
||||
for (unsigned i = 0; i < numItems; i++)
|
||||
{
|
||||
UString s = LangString(langIDs[i]);
|
||||
s.RemoveChar(L'&');
|
||||
int index = (int)combo.AddString(s);
|
||||
combo.SetItemData(index, i);
|
||||
if (values[i] == curVal)
|
||||
curSel = i;
|
||||
}
|
||||
combo.SetCurSel(curSel);
|
||||
}
|
||||
|
||||
// it's used in CompressDialog also
|
||||
bool GetBoolsVal(const CBoolPair &b1, const CBoolPair &b2)
|
||||
{
|
||||
if (b1.Def) return b1.Val;
|
||||
if (b2.Def) return b2.Val;
|
||||
return b1.Val;
|
||||
}
|
||||
|
||||
void CExtractDialog::CheckButton_TwoBools(UINT id, const CBoolPair &b1, const CBoolPair &b2)
|
||||
{
|
||||
CheckButton(id, GetBoolsVal(b1, b2));
|
||||
}
|
||||
|
||||
void CExtractDialog::GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2)
|
||||
{
|
||||
bool val = IsButtonCheckedBool(id);
|
||||
bool oldVal = GetBoolsVal(b1, b2);
|
||||
if (val != oldVal)
|
||||
b1.Def = b2.Def = true;
|
||||
b1.Val = b2.Val = val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool CExtractDialog::OnInit()
|
||||
{
|
||||
#ifdef LANG
|
||||
{
|
||||
UString s;
|
||||
LangString_OnlyFromLangFile(IDD_EXTRACT, s);
|
||||
if (s.IsEmpty())
|
||||
GetText(s);
|
||||
if (!ArcPath.IsEmpty())
|
||||
{
|
||||
s.AddAscii(" : ");
|
||||
s += ArcPath;
|
||||
}
|
||||
SetText(s);
|
||||
// LangSetWindowText(*this, IDD_EXTRACT);
|
||||
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _SFX
|
||||
_passwordControl.Attach(GetItem(IDE_EXTRACT_PASSWORD));
|
||||
_passwordControl.SetText(Password);
|
||||
_passwordControl.SetPasswordChar(TEXT('*'));
|
||||
_pathName.Attach(GetItem(IDE_EXTRACT_NAME));
|
||||
#endif
|
||||
|
||||
#ifdef NO_REGISTRY
|
||||
|
||||
PathMode = NExtract::NPathMode::kFullPaths;
|
||||
OverwriteMode = NExtract::NOverwriteMode::kAsk;
|
||||
|
||||
#else
|
||||
|
||||
_info.Load();
|
||||
|
||||
if (_info.PathMode == NExtract::NPathMode::kCurPaths)
|
||||
_info.PathMode = NExtract::NPathMode::kFullPaths;
|
||||
|
||||
if (!PathMode_Force && _info.PathMode_Force)
|
||||
PathMode = _info.PathMode;
|
||||
if (!OverwriteMode_Force && _info.OverwriteMode_Force)
|
||||
OverwriteMode = _info.OverwriteMode;
|
||||
|
||||
// CheckButton_TwoBools(IDX_EXTRACT_ALT_STREAMS, AltStreams, _info.AltStreams);
|
||||
CheckButton_TwoBools(IDX_EXTRACT_NT_SECUR, NtSecurity, _info.NtSecurity);
|
||||
CheckButton_TwoBools(IDX_EXTRACT_ELIM_DUP, ElimDup, _info.ElimDup);
|
||||
|
||||
CheckButton(IDX_PASSWORD_SHOW, _info.ShowPassword.Val);
|
||||
UpdatePasswordControl();
|
||||
|
||||
#endif
|
||||
|
||||
_path.Attach(GetItem(IDC_EXTRACT_PATH));
|
||||
|
||||
UString pathPrefix = DirPath;
|
||||
|
||||
#ifndef _SFX
|
||||
|
||||
if (_info.SplitDest.Val)
|
||||
{
|
||||
CheckButton(IDX_EXTRACT_NAME_ENABLE, true);
|
||||
UString pathName;
|
||||
SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
|
||||
if (pathPrefix.IsEmpty())
|
||||
pathPrefix = pathName;
|
||||
else
|
||||
_pathName.SetText(pathName);
|
||||
}
|
||||
else
|
||||
ShowItem_Bool(IDE_EXTRACT_NAME, false);
|
||||
|
||||
#endif
|
||||
|
||||
_path.SetText(pathPrefix);
|
||||
|
||||
#ifndef NO_REGISTRY
|
||||
for (unsigned i = 0; i < _info.Paths.Size() && i < kHistorySize; i++)
|
||||
_path.AddString(_info.Paths[i]);
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (_info.Paths.Size() > 0)
|
||||
_path.SetCurSel(0);
|
||||
else
|
||||
_path.SetCurSel(-1);
|
||||
*/
|
||||
|
||||
#ifndef _SFX
|
||||
|
||||
_pathMode.Attach(GetItem(IDC_EXTRACT_PATH_MODE));
|
||||
_overwriteMode.Attach(GetItem(IDC_EXTRACT_OVERWRITE_MODE));
|
||||
|
||||
AddComboItems(_pathMode, kPathMode_IDs, ARRAY_SIZE(kPathMode_IDs), kPathModeButtonsVals, PathMode);
|
||||
AddComboItems(_overwriteMode, kOverwriteMode_IDs, ARRAY_SIZE(kOverwriteMode_IDs), kOverwriteButtonsVals, OverwriteMode);
|
||||
|
||||
#endif
|
||||
|
||||
HICON icon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON));
|
||||
SetIcon(ICON_BIG, icon);
|
||||
|
||||
// CWindow filesWindow = GetItem(IDC_EXTRACT_RADIO_FILES);
|
||||
// filesWindow.Enable(_enableFilesButton);
|
||||
|
||||
NormalizePosition();
|
||||
|
||||
return CModalDialog::OnInit();
|
||||
}
|
||||
|
||||
#ifndef _SFX
|
||||
void CExtractDialog::UpdatePasswordControl()
|
||||
{
|
||||
_passwordControl.SetPasswordChar(IsShowPasswordChecked() ? 0 : TEXT('*'));
|
||||
UString password;
|
||||
_passwordControl.GetText(password);
|
||||
_passwordControl.SetText(password);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CExtractDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
switch (buttonID)
|
||||
{
|
||||
case IDB_EXTRACT_SET_PATH:
|
||||
OnButtonSetPath();
|
||||
return true;
|
||||
#ifndef _SFX
|
||||
case IDX_EXTRACT_NAME_ENABLE:
|
||||
ShowItem_Bool(IDE_EXTRACT_NAME, IsButtonCheckedBool(IDX_EXTRACT_NAME_ENABLE));
|
||||
return true;
|
||||
case IDX_PASSWORD_SHOW:
|
||||
{
|
||||
UpdatePasswordControl();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
|
||||
}
|
||||
|
||||
void CExtractDialog::OnButtonSetPath()
|
||||
{
|
||||
UString currentPath;
|
||||
_path.GetText(currentPath);
|
||||
UString title = LangString(IDS_EXTRACT_SET_FOLDER);
|
||||
UString resultPath;
|
||||
if (!MyBrowseForFolder(*this, title, currentPath, resultPath))
|
||||
return;
|
||||
#ifndef NO_REGISTRY
|
||||
_path.SetCurSel(-1);
|
||||
#endif
|
||||
_path.SetText(resultPath);
|
||||
}
|
||||
|
||||
void AddUniqueString(UStringVector &list, const UString &s)
|
||||
{
|
||||
FOR_VECTOR (i, list)
|
||||
if (s.IsEqualTo_NoCase(list[i]))
|
||||
return;
|
||||
list.Add(s);
|
||||
}
|
||||
|
||||
void CExtractDialog::OnOK()
|
||||
{
|
||||
#ifndef _SFX
|
||||
int pathMode2 = kPathModeButtonsVals[_pathMode.GetCurSel()];
|
||||
if (PathMode != NExtract::NPathMode::kCurPaths ||
|
||||
pathMode2 != NExtract::NPathMode::kFullPaths)
|
||||
PathMode = (NExtract::NPathMode::EEnum)pathMode2;
|
||||
|
||||
OverwriteMode = (NExtract::NOverwriteMode::EEnum)kOverwriteButtonsVals[_overwriteMode.GetCurSel()];
|
||||
|
||||
// _filesMode = (NExtractionDialog::NFilesMode::EEnum)GetFilesMode();
|
||||
|
||||
_passwordControl.GetText(Password);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef NO_REGISTRY
|
||||
|
||||
// GetButton_Bools(IDX_EXTRACT_ALT_STREAMS, AltStreams, _info.AltStreams);
|
||||
GetButton_Bools(IDX_EXTRACT_NT_SECUR, NtSecurity, _info.NtSecurity);
|
||||
GetButton_Bools(IDX_EXTRACT_ELIM_DUP, ElimDup, _info.ElimDup);
|
||||
|
||||
bool showPassword = IsShowPasswordChecked();
|
||||
if (showPassword != _info.ShowPassword.Val)
|
||||
{
|
||||
_info.ShowPassword.Def = true;
|
||||
_info.ShowPassword.Val = showPassword;
|
||||
}
|
||||
|
||||
if (_info.PathMode != pathMode2)
|
||||
{
|
||||
_info.PathMode_Force = true;
|
||||
_info.PathMode = (NExtract::NPathMode::EEnum)pathMode2;
|
||||
/*
|
||||
// we allow kAbsPaths in registry.
|
||||
if (_info.PathMode == NExtract::NPathMode::kAbsPaths)
|
||||
_info.PathMode = NExtract::NPathMode::kFullPaths;
|
||||
*/
|
||||
}
|
||||
|
||||
if (!OverwriteMode_Force && _info.OverwriteMode != OverwriteMode)
|
||||
_info.OverwriteMode_Force = true;
|
||||
_info.OverwriteMode = OverwriteMode;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
ElimDup.Val = IsButtonCheckedBool(IDX_EXTRACT_ELIM_DUP);
|
||||
|
||||
#endif
|
||||
|
||||
UString s;
|
||||
|
||||
#ifdef NO_REGISTRY
|
||||
|
||||
_path.GetText(s);
|
||||
|
||||
#else
|
||||
|
||||
int currentItem = _path.GetCurSel();
|
||||
if (currentItem == CB_ERR)
|
||||
{
|
||||
_path.GetText(s);
|
||||
if (_path.GetCount() >= kHistorySize)
|
||||
currentItem = _path.GetCount() - 1;
|
||||
}
|
||||
else
|
||||
_path.GetLBText(currentItem, s);
|
||||
|
||||
#endif
|
||||
|
||||
s.Trim();
|
||||
NName::NormalizeDirPathPrefix(s);
|
||||
|
||||
#ifndef _SFX
|
||||
|
||||
bool splitDest = IsButtonCheckedBool(IDX_EXTRACT_NAME_ENABLE);
|
||||
if (splitDest)
|
||||
{
|
||||
UString pathName;
|
||||
_pathName.GetText(pathName);
|
||||
pathName.Trim();
|
||||
s += pathName;
|
||||
NName::NormalizeDirPathPrefix(s);
|
||||
}
|
||||
if (splitDest != _info.SplitDest.Val)
|
||||
{
|
||||
_info.SplitDest.Def = true;
|
||||
_info.SplitDest.Val = splitDest;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
DirPath = s;
|
||||
|
||||
#ifndef NO_REGISTRY
|
||||
_info.Paths.Clear();
|
||||
#ifndef _SFX
|
||||
AddUniqueString(_info.Paths, s);
|
||||
#endif
|
||||
for (int i = 0; i < _path.GetCount(); i++)
|
||||
if (i != currentItem)
|
||||
{
|
||||
UString sTemp;
|
||||
_path.GetLBText(i, sTemp);
|
||||
sTemp.Trim();
|
||||
AddUniqueString(_info.Paths, sTemp);
|
||||
}
|
||||
_info.Save();
|
||||
#endif
|
||||
|
||||
CModalDialog::OnOK();
|
||||
}
|
||||
|
||||
#ifndef NO_REGISTRY
|
||||
static LPCWSTR kHelpTopic = L"fm/plugins/7-zip/extract.htm";
|
||||
void CExtractDialog::OnHelp()
|
||||
{
|
||||
ShowHelpWindow(NULL, kHelpTopic);
|
||||
CModalDialog::OnHelp();
|
||||
}
|
||||
#endif
|
||||
113
CPP/7zip/UI/GUI/ExtractDialog.h
Normal file
113
CPP/7zip/UI/GUI/ExtractDialog.h
Normal file
@@ -0,0 +1,113 @@
|
||||
// ExtractDialog.h
|
||||
|
||||
#ifndef __EXTRACT_DIALOG_H
|
||||
#define __EXTRACT_DIALOG_H
|
||||
|
||||
#include "ExtractDialogRes.h"
|
||||
|
||||
#include "../../../Windows/Control/ComboBox.h"
|
||||
#include "../../../Windows/Control/Edit.h"
|
||||
|
||||
#include "../Common/ExtractMode.h"
|
||||
|
||||
#include "../FileManager/DialogSize.h"
|
||||
|
||||
#ifndef NO_REGISTRY
|
||||
#include "../Common/ZipRegistry.h"
|
||||
#endif
|
||||
|
||||
namespace NExtractionDialog
|
||||
{
|
||||
/*
|
||||
namespace NFilesMode
|
||||
{
|
||||
enum EEnum
|
||||
{
|
||||
kSelected,
|
||||
kAll,
|
||||
kSpecified
|
||||
};
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
class CExtractDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
#ifdef NO_REGISTRY
|
||||
NWindows::NControl::CDialogChildControl _path;
|
||||
#else
|
||||
NWindows::NControl::CComboBox _path;
|
||||
#endif
|
||||
|
||||
#ifndef _SFX
|
||||
NWindows::NControl::CEdit _pathName;
|
||||
NWindows::NControl::CEdit _passwordControl;
|
||||
NWindows::NControl::CComboBox _pathMode;
|
||||
NWindows::NControl::CComboBox _overwriteMode;
|
||||
#endif
|
||||
|
||||
#ifndef _SFX
|
||||
// int GetFilesMode() const;
|
||||
void UpdatePasswordControl();
|
||||
#endif
|
||||
|
||||
void OnButtonSetPath();
|
||||
|
||||
void CheckButton_TwoBools(UINT id, const CBoolPair &b1, const CBoolPair &b2);
|
||||
void GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2);
|
||||
virtual bool OnInit();
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
virtual void OnOK();
|
||||
|
||||
#ifndef NO_REGISTRY
|
||||
|
||||
virtual void OnHelp();
|
||||
|
||||
NExtract::CInfo _info;
|
||||
|
||||
#endif
|
||||
|
||||
bool IsShowPasswordChecked() const { return IsButtonCheckedBool(IDX_PASSWORD_SHOW); }
|
||||
public:
|
||||
// bool _enableSelectedFilesButton;
|
||||
// bool _enableFilesButton;
|
||||
// NExtractionDialog::NFilesMode::EEnum FilesMode;
|
||||
|
||||
UString DirPath;
|
||||
UString ArcPath;
|
||||
|
||||
#ifndef _SFX
|
||||
UString Password;
|
||||
#endif
|
||||
bool PathMode_Force;
|
||||
bool OverwriteMode_Force;
|
||||
NExtract::NPathMode::EEnum PathMode;
|
||||
NExtract::NOverwriteMode::EEnum OverwriteMode;
|
||||
|
||||
#ifndef _SFX
|
||||
// CBoolPair AltStreams;
|
||||
CBoolPair NtSecurity;
|
||||
#endif
|
||||
|
||||
CBoolPair ElimDup;
|
||||
|
||||
INT_PTR Create(HWND aWndParent = 0)
|
||||
{
|
||||
#ifdef _SFX
|
||||
BIG_DIALOG_SIZE(240, 64);
|
||||
#else
|
||||
BIG_DIALOG_SIZE(300, 160);
|
||||
#endif
|
||||
return CModalDialog::Create(SIZED_DIALOG(IDD_EXTRACT), aWndParent);
|
||||
}
|
||||
|
||||
CExtractDialog():
|
||||
PathMode_Force(false),
|
||||
OverwriteMode_Force(false)
|
||||
{
|
||||
ElimDup.Val = true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
98
CPP/7zip/UI/GUI/ExtractDialog.rc
Normal file
98
CPP/7zip/UI/GUI/ExtractDialog.rc
Normal file
@@ -0,0 +1,98 @@
|
||||
#include "ExtractDialogRes.h"
|
||||
#include "../../GuiCommon.rc"
|
||||
|
||||
#define xc 336
|
||||
#define yc 168
|
||||
|
||||
#undef g1xs
|
||||
#undef g2x
|
||||
#undef g2x2
|
||||
#undef g2xs
|
||||
#undef g2xs2
|
||||
|
||||
#define g1xs 160
|
||||
|
||||
#define gSpace 20
|
||||
#define g2x (m + g1xs + gSpace)
|
||||
#define g2x2 (g2x + m)
|
||||
#define g2xs (xc - g1xs - gSpace)
|
||||
#define g2xs2 (g2xs - m - m)
|
||||
|
||||
#undef GROUP_Y_SIZE
|
||||
#ifdef UNDER_CE
|
||||
#define GROUP_Y_SIZE 8
|
||||
#else
|
||||
#define GROUP_Y_SIZE 56
|
||||
#endif
|
||||
|
||||
IDD_EXTRACT DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
|
||||
CAPTION "Extract"
|
||||
BEGIN
|
||||
LTEXT "E&xtract to:", IDT_EXTRACT_EXTRACT_TO, m, m, xc, 8
|
||||
COMBOBOX IDC_EXTRACT_PATH, m, m + 12, xc - bxsDots - 12, 100, MY_COMBO_WITH_EDIT
|
||||
PUSHBUTTON "...", IDB_EXTRACT_SET_PATH, xs - m - bxsDots, m + 12 - 2, bxsDots, bys, WS_GROUP
|
||||
|
||||
CONTROL "", IDX_EXTRACT_NAME_ENABLE, MY_CHECKBOX, m, m + 34, 12, 10
|
||||
EDITTEXT IDE_EXTRACT_NAME, m + 12 + 2, m + 32, g1xs - 12 - 2, 14, ES_AUTOHSCROLL
|
||||
|
||||
LTEXT "Path mode:", IDT_EXTRACT_PATH_MODE, m, m + 52, g1xs, 8
|
||||
COMBOBOX IDC_EXTRACT_PATH_MODE, m, m + 64, g1xs, 140, MY_COMBO
|
||||
|
||||
CONTROL "Eliminate duplication of root folder", IDX_EXTRACT_ELIM_DUP, MY_CHECKBOX,
|
||||
m, m + 84, g1xs, 10
|
||||
|
||||
LTEXT "Overwrite mode:", IDT_EXTRACT_OVERWRITE_MODE, m, m + 104, g1xs, 8
|
||||
COMBOBOX IDC_EXTRACT_OVERWRITE_MODE, m, m + 116, g1xs, 140, MY_COMBO
|
||||
|
||||
|
||||
GROUPBOX "Password", IDG_PASSWORD, g2x, m + 36, g2xs, GROUP_Y_SIZE
|
||||
EDITTEXT IDE_EXTRACT_PASSWORD, g2x2, m + 50, g2xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
|
||||
CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX, g2x2, m + 72, g2xs2, 10
|
||||
|
||||
// CONTROL "Restore alternate data streams", IDX_EXTRACT_ALT_STREAMS, MY_CHECKBOX,
|
||||
// g2x, m + 104, g2xs, 10
|
||||
CONTROL "Restore file security", IDX_EXTRACT_NT_SECUR, MY_CHECKBOX,
|
||||
g2x, m + 104, g2xs, 10
|
||||
|
||||
DEFPUSHBUTTON "OK", IDOK, bx3, by, bxs, bys, WS_GROUP
|
||||
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_EXTRACT_2 DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
|
||||
CAPTION "Extract"
|
||||
BEGIN
|
||||
LTEXT "E&xtract to:", IDT_EXTRACT_EXTRACT_TO, m, m, xc - bxsDots - 8, 8
|
||||
COMBOBOX IDC_EXTRACT_PATH, m, m + 12, xc - bxsDots - 8, 100, MY_COMBO_WITH_EDIT
|
||||
PUSHBUTTON "...", IDB_EXTRACT_SET_PATH, xs - m - bxsDots, m + 12 - 3, bxsDots, bys, WS_GROUP
|
||||
|
||||
LTEXT "Path mode:", IDT_EXTRACT_PATH_MODE, m, m + 36, g1xs, 8
|
||||
COMBOBOX IDC_EXTRACT_PATH_MODE, m + g1xs, m + 36, xc - g1xs, 100, MY_COMBO
|
||||
|
||||
LTEXT "Overwrite mode:", IDT_EXTRACT_OVERWRITE_MODE, m, m + 56, g1xs, 8
|
||||
COMBOBOX IDC_EXTRACT_OVERWRITE_MODE, m + g1xs, m + 56, xc - g1xs, 100, MY_COMBO
|
||||
|
||||
LTEXT "Password", IDG_PASSWORD, m, m + 76, g1xs, 8
|
||||
EDITTEXT IDE_EXTRACT_PASSWORD, m + g1xs, m + 76, xc - g1xs, 14, ES_PASSWORD | ES_AUTOHSCROLL
|
||||
CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX, m, m + 92, xc, 10
|
||||
|
||||
OK_CANCEL
|
||||
END
|
||||
|
||||
#endif
|
||||
24
CPP/7zip/UI/GUI/ExtractDialogRes.h
Normal file
24
CPP/7zip/UI/GUI/ExtractDialogRes.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#define IDD_EXTRACT 3400
|
||||
#define IDD_EXTRACT_2 13400
|
||||
|
||||
#define IDC_EXTRACT_PATH 100
|
||||
#define IDB_EXTRACT_SET_PATH 101
|
||||
#define IDC_EXTRACT_PATH_MODE 102
|
||||
#define IDC_EXTRACT_OVERWRITE_MODE 103
|
||||
|
||||
#define IDE_EXTRACT_PASSWORD 120
|
||||
|
||||
#define IDE_EXTRACT_NAME 130
|
||||
#define IDX_EXTRACT_NAME_ENABLE 131
|
||||
|
||||
|
||||
#define IDT_EXTRACT_EXTRACT_TO 3401
|
||||
#define IDT_EXTRACT_PATH_MODE 3410
|
||||
#define IDT_EXTRACT_OVERWRITE_MODE 3420
|
||||
|
||||
#define IDX_EXTRACT_ELIM_DUP 3430
|
||||
#define IDX_EXTRACT_NT_SECUR 3431
|
||||
// #define IDX_EXTRACT_ALT_STREAMS 3432
|
||||
|
||||
#define IDX_PASSWORD_SHOW 3803
|
||||
#define IDG_PASSWORD 3807
|
||||
272
CPP/7zip/UI/GUI/ExtractGUI.cpp
Normal file
272
CPP/7zip/UI/GUI/ExtractGUI.cpp
Normal file
@@ -0,0 +1,272 @@
|
||||
// ExtractGUI.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/IntToString.h"
|
||||
#include "../../../Common/StringConvert.h"
|
||||
|
||||
#include "../../../Windows/FileDir.h"
|
||||
#include "../../../Windows/FileFind.h"
|
||||
#include "../../../Windows/FileName.h"
|
||||
#include "../../../Windows/Thread.h"
|
||||
|
||||
#include "../FileManager/ExtractCallback.h"
|
||||
#include "../FileManager/FormatUtils.h"
|
||||
#include "../FileManager/LangUtils.h"
|
||||
#include "../FileManager/resourceGui.h"
|
||||
#include "../FileManager/OverwriteDialogRes.h"
|
||||
|
||||
#include "../Common/ArchiveExtractCallback.h"
|
||||
#include "../Common/PropIDUtils.h"
|
||||
|
||||
#include "../Explorer/MyMessages.h"
|
||||
|
||||
#include "resource2.h"
|
||||
#include "ExtractRes.h"
|
||||
|
||||
#include "ExtractDialog.h"
|
||||
#include "ExtractGUI.h"
|
||||
#include "HashGUI.h"
|
||||
|
||||
#include "../FileManager/PropertyNameRes.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NDir;
|
||||
|
||||
static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
|
||||
|
||||
#ifndef _SFX
|
||||
|
||||
static void AddValuePair(UString &s, UINT resourceID, UInt64 value, bool addColon = true)
|
||||
{
|
||||
AddLangString(s, resourceID);
|
||||
if (addColon)
|
||||
s += L':';
|
||||
s.Add_Space();
|
||||
char sz[32];
|
||||
ConvertUInt64ToString(value, sz);
|
||||
s.AddAscii(sz);
|
||||
s.Add_LF();
|
||||
}
|
||||
|
||||
static void AddSizePair(UString &s, UINT resourceID, UInt64 value)
|
||||
{
|
||||
wchar_t sz[32];
|
||||
AddLangString(s, resourceID);
|
||||
s += L": ";
|
||||
ConvertUInt64ToString(value, sz);
|
||||
s += MyFormatNew(IDS_FILE_SIZE, sz);
|
||||
// s += sz;
|
||||
if (value >= (1 << 20))
|
||||
{
|
||||
ConvertUInt64ToString(value >> 20, sz);
|
||||
s += L" (";
|
||||
s += sz;
|
||||
s += L" MB)";
|
||||
}
|
||||
s.Add_LF();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
class CThreadExtracting: public CProgressThreadVirt
|
||||
{
|
||||
HRESULT ProcessVirt();
|
||||
public:
|
||||
CCodecs *codecs;
|
||||
CExtractCallbackImp *ExtractCallbackSpec;
|
||||
const CObjectVector<COpenType> *FormatIndices;
|
||||
const CIntVector *ExcludedFormatIndices;
|
||||
|
||||
UStringVector *ArchivePaths;
|
||||
UStringVector *ArchivePathsFull;
|
||||
const NWildcard::CCensorNode *WildcardCensor;
|
||||
const CExtractOptions *Options;
|
||||
#ifndef _SFX
|
||||
CHashBundle *HashBundle;
|
||||
#endif
|
||||
CMyComPtr<IExtractCallbackUI> ExtractCallback;
|
||||
UString Title;
|
||||
};
|
||||
|
||||
HRESULT CThreadExtracting::ProcessVirt()
|
||||
{
|
||||
CDecompressStat Stat;
|
||||
#ifndef _SFX
|
||||
if (HashBundle)
|
||||
HashBundle->Init();
|
||||
#endif
|
||||
|
||||
HRESULT res = Extract(codecs,
|
||||
*FormatIndices, *ExcludedFormatIndices,
|
||||
*ArchivePaths, *ArchivePathsFull,
|
||||
*WildcardCensor, *Options, ExtractCallbackSpec, ExtractCallback,
|
||||
#ifndef _SFX
|
||||
HashBundle,
|
||||
#endif
|
||||
FinalMessage.ErrorMessage.Message, Stat);
|
||||
#ifndef _SFX
|
||||
if (res == S_OK && Options->TestMode && ExtractCallbackSpec->IsOK())
|
||||
{
|
||||
UString s;
|
||||
|
||||
AddValuePair(s, IDS_ARCHIVES_COLON, Stat.NumArchives, false);
|
||||
AddSizePair(s, IDS_PROP_PACKED_SIZE, Stat.PackSize);
|
||||
|
||||
if (!HashBundle)
|
||||
{
|
||||
if (Stat.NumFolders != 0)
|
||||
AddValuePair(s, IDS_PROP_FOLDERS, Stat.NumFolders);
|
||||
AddValuePair(s, IDS_PROP_FILES, Stat.NumFiles);
|
||||
AddSizePair(s, IDS_PROP_SIZE, Stat.UnpackSize);
|
||||
if (Stat.NumAltStreams != 0)
|
||||
{
|
||||
s.Add_LF();
|
||||
AddValuePair(s, IDS_PROP_NUM_ALT_STREAMS, Stat.NumAltStreams);
|
||||
AddSizePair(s, IDS_PROP_ALT_STREAMS_SIZE, Stat.AltStreams_UnpackSize);
|
||||
}
|
||||
}
|
||||
|
||||
if (HashBundle)
|
||||
{
|
||||
s.Add_LF();
|
||||
AddHashBundleRes(s, *HashBundle, UString());
|
||||
}
|
||||
|
||||
s.Add_LF();
|
||||
AddLangString(s, IDS_MESSAGE_NO_ERRORS);
|
||||
|
||||
FinalMessage.OkMessage.Title = Title;
|
||||
FinalMessage.OkMessage.Message = s;
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
HRESULT ExtractGUI(
|
||||
CCodecs *codecs,
|
||||
const CObjectVector<COpenType> &formatIndices,
|
||||
const CIntVector &excludedFormatIndices,
|
||||
UStringVector &archivePaths,
|
||||
UStringVector &archivePathsFull,
|
||||
const NWildcard::CCensorNode &wildcardCensor,
|
||||
CExtractOptions &options,
|
||||
#ifndef _SFX
|
||||
CHashBundle *hb,
|
||||
#endif
|
||||
bool showDialog,
|
||||
bool &messageWasDisplayed,
|
||||
CExtractCallbackImp *extractCallback,
|
||||
HWND hwndParent)
|
||||
{
|
||||
messageWasDisplayed = false;
|
||||
|
||||
CThreadExtracting extracter;
|
||||
extracter.codecs = codecs;
|
||||
extracter.FormatIndices = &formatIndices;
|
||||
extracter.ExcludedFormatIndices = &excludedFormatIndices;
|
||||
|
||||
if (!options.TestMode)
|
||||
{
|
||||
FString outputDir = options.OutputDir;
|
||||
#ifndef UNDER_CE
|
||||
if (outputDir.IsEmpty())
|
||||
GetCurrentDir(outputDir);
|
||||
#endif
|
||||
if (showDialog)
|
||||
{
|
||||
CExtractDialog dialog;
|
||||
FString outputDirFull;
|
||||
if (!MyGetFullPathName(outputDir, outputDirFull))
|
||||
{
|
||||
ShowErrorMessage(kIncorrectOutDir);
|
||||
messageWasDisplayed = true;
|
||||
return E_FAIL;
|
||||
}
|
||||
NName::NormalizeDirPathPrefix(outputDirFull);
|
||||
|
||||
dialog.DirPath = fs2us(outputDirFull);
|
||||
|
||||
dialog.OverwriteMode = options.OverwriteMode;
|
||||
dialog.OverwriteMode_Force = options.OverwriteMode_Force;
|
||||
dialog.PathMode = options.PathMode;
|
||||
dialog.PathMode_Force = options.PathMode_Force;
|
||||
dialog.ElimDup = options.ElimDup;
|
||||
|
||||
if (archivePathsFull.Size() == 1)
|
||||
dialog.ArcPath = archivePathsFull[0];
|
||||
|
||||
#ifndef _SFX
|
||||
// dialog.AltStreams = options.NtOptions.AltStreams;
|
||||
dialog.NtSecurity = options.NtOptions.NtSecurity;
|
||||
if (extractCallback->PasswordIsDefined)
|
||||
dialog.Password = extractCallback->Password;
|
||||
#endif
|
||||
|
||||
if (dialog.Create(hwndParent) != IDOK)
|
||||
return E_ABORT;
|
||||
|
||||
outputDir = us2fs(dialog.DirPath);
|
||||
|
||||
options.OverwriteMode = dialog.OverwriteMode;
|
||||
options.PathMode = dialog.PathMode;
|
||||
options.ElimDup = dialog.ElimDup;
|
||||
|
||||
#ifndef _SFX
|
||||
// options.NtOptions.AltStreams = dialog.AltStreams;
|
||||
options.NtOptions.NtSecurity = dialog.NtSecurity;
|
||||
extractCallback->Password = dialog.Password;
|
||||
extractCallback->PasswordIsDefined = !dialog.Password.IsEmpty();
|
||||
#endif
|
||||
}
|
||||
if (!MyGetFullPathName(outputDir, options.OutputDir))
|
||||
{
|
||||
ShowErrorMessage(kIncorrectOutDir);
|
||||
messageWasDisplayed = true;
|
||||
return E_FAIL;
|
||||
}
|
||||
NName::NormalizeDirPathPrefix(options.OutputDir);
|
||||
|
||||
/*
|
||||
if (!CreateComplexDirectory(options.OutputDir))
|
||||
{
|
||||
UString s = GetUnicodeString(NError::MyFormatMessage(GetLastError()));
|
||||
UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
|
||||
#ifdef LANG
|
||||
0x02000603,
|
||||
#endif
|
||||
options.OutputDir);
|
||||
s2.Add_LF();
|
||||
s2 += s;
|
||||
MyMessageBox(s2);
|
||||
return E_FAIL;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
UString title = LangString(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING);
|
||||
|
||||
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;
|
||||
#ifndef _SFX
|
||||
extracter.HashBundle = hb;
|
||||
#endif
|
||||
|
||||
extracter.ProgressDialog.IconID = IDI_ICON;
|
||||
|
||||
RINOK(extracter.Create(title, hwndParent));
|
||||
messageWasDisplayed = extracter.ThreadFinishedOK &
|
||||
extracter.ProgressDialog.MessagesDisplayed;
|
||||
return extracter.Result;
|
||||
}
|
||||
38
CPP/7zip/UI/GUI/ExtractGUI.h
Normal file
38
CPP/7zip/UI/GUI/ExtractGUI.h
Normal file
@@ -0,0 +1,38 @@
|
||||
// GUI/ExtractGUI.h
|
||||
|
||||
#ifndef __EXTRACT_GUI_H
|
||||
#define __EXTRACT_GUI_H
|
||||
|
||||
#include "../Common/Extract.h"
|
||||
|
||||
#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 CObjectVector<COpenType> &formatIndices,
|
||||
const CIntVector &excludedFormatIndices,
|
||||
UStringVector &archivePaths,
|
||||
UStringVector &archivePathsFull,
|
||||
const NWildcard::CCensorNode &wildcardCensor,
|
||||
CExtractOptions &options,
|
||||
#ifndef _SFX
|
||||
CHashBundle *hb,
|
||||
#endif
|
||||
bool showDialog,
|
||||
bool &messageWasDisplayed,
|
||||
CExtractCallbackImp *extractCallback,
|
||||
HWND hwndParent = NULL);
|
||||
|
||||
#endif
|
||||
51
CPP/7zip/UI/GUI/ExtractRes.h
Normal file
51
CPP/7zip/UI/GUI/ExtractRes.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#define IDS_MEM_ERROR 3000
|
||||
|
||||
#define IDS_CANNOT_CREATE_FOLDER 3003
|
||||
#define IDS_UPDATE_NOT_SUPPORTED 3004
|
||||
#define IDS_CANT_OPEN_ARCHIVE 3005
|
||||
#define IDS_CANT_OPEN_ENCRYPTED_ARCHIVE 3006
|
||||
#define IDS_UNSUPPORTED_ARCHIVE_TYPE 3007
|
||||
|
||||
#define IDS_CANT_OPEN_AS_TYPE 3017
|
||||
#define IDS_IS_OPEN_AS_TYPE 3018
|
||||
#define IDS_IS_OPEN_WITH_OFFSET 3019
|
||||
|
||||
#define IDS_PROGRESS_EXTRACTING 3300
|
||||
|
||||
#define IDS_PROGRESS_SKIPPING 3325
|
||||
|
||||
#define IDS_EXTRACT_SET_FOLDER 3402
|
||||
|
||||
#define IDS_EXTRACT_PATHS_FULL 3411
|
||||
#define IDS_EXTRACT_PATHS_NO 3412
|
||||
#define IDS_EXTRACT_PATHS_ABS 3413
|
||||
#define IDS_PATH_MODE_RELAT 3414
|
||||
|
||||
#define IDS_EXTRACT_OVERWRITE_ASK 3421
|
||||
#define IDS_EXTRACT_OVERWRITE_WITHOUT_PROMPT 3422
|
||||
#define IDS_EXTRACT_OVERWRITE_SKIP_EXISTING 3423
|
||||
#define IDS_EXTRACT_OVERWRITE_RENAME 3424
|
||||
#define IDS_EXTRACT_OVERWRITE_RENAME_EXISTING 3425
|
||||
|
||||
#define IDS_EXTRACT_MESSAGE_UNSUPPORTED_METHOD 3700
|
||||
#define IDS_EXTRACT_MESSAGE_DATA_ERROR 3701
|
||||
#define IDS_EXTRACT_MESSAGE_CRC_ERROR 3702
|
||||
#define IDS_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED 3703
|
||||
#define IDS_EXTRACT_MESSAGE_CRC_ERROR_ENCRYPTED 3704
|
||||
|
||||
#define IDS_EXTRACT_MSG_WRONG_PSW_GUESS 3710
|
||||
// #define IDS_EXTRACT_MSG_ENCRYPTED 3711
|
||||
|
||||
#define IDS_EXTRACT_MSG_UNSUPPORTED_METHOD 3721
|
||||
#define IDS_EXTRACT_MSG_DATA_ERROR 3722
|
||||
#define IDS_EXTRACT_MSG_CRC_ERROR 3723
|
||||
#define IDS_EXTRACT_MSG_UNAVAILABLE_DATA 3724
|
||||
#define IDS_EXTRACT_MSG_UEXPECTED_END 3725
|
||||
#define IDS_EXTRACT_MSG_DATA_AFTER_END 3726
|
||||
#define IDS_EXTRACT_MSG_IS_NOT_ARC 3727
|
||||
#define IDS_EXTRACT_MSG_HEADERS_ERROR 3728
|
||||
#define IDS_EXTRACT_MSG_WRONG_PSW_CLAIM 3729
|
||||
|
||||
#define IDS_OPEN_MSG_UNAVAILABLE_START 3763
|
||||
#define IDS_OPEN_MSG_UNCONFIRMED_START 3764
|
||||
#define IDS_OPEN_MSG_UNSUPPORTED_FEATURE 3768
|
||||
BIN
CPP/7zip/UI/GUI/FM.ico
Normal file
BIN
CPP/7zip/UI/GUI/FM.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
435
CPP/7zip/UI/GUI/GUI.cpp
Normal file
435
CPP/7zip/UI/GUI/GUI.cpp
Normal file
@@ -0,0 +1,435 @@
|
||||
// GUI.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <shlwapi.h>
|
||||
|
||||
#include "../../../../C/Alloc.h"
|
||||
|
||||
#include "../../../Common/MyInitGuid.h"
|
||||
|
||||
#include "../../../Common/CommandLineParser.h"
|
||||
#include "../../../Common/IntToString.h"
|
||||
#include "../../../Common/MyException.h"
|
||||
#include "../../../Common/StringConvert.h"
|
||||
|
||||
#include "../../../Windows/FileDir.h"
|
||||
#include "../../../Windows/NtCheck.h"
|
||||
#ifdef _WIN32
|
||||
#include "../../../Windows/MemoryLock.h"
|
||||
#endif
|
||||
|
||||
#include "../Common/ArchiveCommandLine.h"
|
||||
#include "../Common/ExitCode.h"
|
||||
|
||||
#include "../FileManager/StringUtils.h"
|
||||
#include "../FileManager/MyWindowsNew.h"
|
||||
|
||||
#include "BenchmarkDialog.h"
|
||||
#include "ExtractGUI.h"
|
||||
#include "HashGUI.h"
|
||||
#include "UpdateGUI.h"
|
||||
|
||||
#include "ExtractRes.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
#ifndef _UNICODE
|
||||
#endif
|
||||
|
||||
#ifndef UNDER_CE
|
||||
|
||||
DWORD g_ComCtl32Version;
|
||||
|
||||
static DWORD GetDllVersion(LPCTSTR dllName)
|
||||
{
|
||||
DWORD dwVersion = 0;
|
||||
HINSTANCE hinstDll = LoadLibrary(dllName);
|
||||
if (hinstDll)
|
||||
{
|
||||
DLLGETVERSIONPROC pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hinstDll, "DllGetVersion");
|
||||
if (pDllGetVersion)
|
||||
{
|
||||
DLLVERSIONINFO dvi;
|
||||
ZeroMemory(&dvi, sizeof(dvi));
|
||||
dvi.cbSize = sizeof(dvi);
|
||||
HRESULT hr = (*pDllGetVersion)(&dvi);
|
||||
if (SUCCEEDED(hr))
|
||||
dwVersion = MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion);
|
||||
}
|
||||
FreeLibrary(hinstDll);
|
||||
}
|
||||
return dwVersion;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool g_LVN_ITEMACTIVATE_Support = true;
|
||||
|
||||
static void ErrorMessage(LPCWSTR message)
|
||||
{
|
||||
MessageBoxW(NULL, message, L"7-Zip", MB_ICONERROR | MB_OK);
|
||||
}
|
||||
|
||||
static void ErrorLangMessage(UINT resourceID)
|
||||
{
|
||||
ErrorMessage(LangString(resourceID));
|
||||
}
|
||||
|
||||
static const char *kNoFormats = "7-Zip cannot find the code that works with archives.";
|
||||
|
||||
static int ShowMemErrorMessage()
|
||||
{
|
||||
ErrorLangMessage(IDS_MEM_ERROR);
|
||||
return NExitCode::kMemoryError;
|
||||
}
|
||||
|
||||
static int ShowSysErrorMessage(DWORD errorCode)
|
||||
{
|
||||
if (errorCode == E_OUTOFMEMORY)
|
||||
return ShowMemErrorMessage();
|
||||
ErrorMessage(HResultToMessage(errorCode));
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
|
||||
static void ThrowException_if_Error(HRESULT res)
|
||||
{
|
||||
if (res != S_OK)
|
||||
throw CSystemException(res);
|
||||
}
|
||||
|
||||
static int Main2()
|
||||
{
|
||||
UStringVector commandStrings;
|
||||
NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
CArcCmdLineOptions options;
|
||||
CArcCmdLineParser parser;
|
||||
|
||||
parser.Parse1(commandStrings, options);
|
||||
parser.Parse2(options);
|
||||
|
||||
#if defined(_WIN32) && !defined(UNDER_CE)
|
||||
NSecurity::EnablePrivilege_SymLink();
|
||||
#ifdef _7ZIP_LARGE_PAGES
|
||||
if (options.LargePages)
|
||||
NSecurity::EnablePrivilege_LockMemory();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CREATE_CODECS_OBJECT
|
||||
|
||||
codecs->CaseSensitiveChange = options.CaseSensitiveChange;
|
||||
codecs->CaseSensitive = options.CaseSensitive;
|
||||
ThrowException_if_Error(codecs->Load());
|
||||
|
||||
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
|
||||
|
||||
if (codecs->Formats.Size() == 0 &&
|
||||
(isExtractGroupCommand
|
||||
|
||||
|| options.Command.IsFromUpdateGroup()))
|
||||
{
|
||||
#ifdef EXTERNAL_CODECS
|
||||
if (!codecs->MainDll_ErrorPath.IsEmpty())
|
||||
{
|
||||
UString s = L"7-Zip cannot load module ";
|
||||
s += fs2us(codecs->MainDll_ErrorPath);
|
||||
throw s;
|
||||
}
|
||||
#endif
|
||||
throw kNoFormats;
|
||||
}
|
||||
|
||||
CObjectVector<COpenType> formatIndices;
|
||||
if (!ParseOpenTypes(*codecs, options.ArcType, formatIndices))
|
||||
{
|
||||
ErrorLangMessage(IDS_UNSUPPORTED_ARCHIVE_TYPE);
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
|
||||
CIntVector excludedFormatIndices;
|
||||
FOR_VECTOR (k, options.ExcludedArcTypes)
|
||||
{
|
||||
CIntVector tempIndices;
|
||||
if (!codecs->FindFormatForArchiveType(options.ExcludedArcTypes[k], tempIndices)
|
||||
|| tempIndices.Size() != 1)
|
||||
{
|
||||
ErrorLangMessage(IDS_UNSUPPORTED_ARCHIVE_TYPE);
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
excludedFormatIndices.AddToUniqueSorted(tempIndices[0]);
|
||||
// excludedFormatIndices.Sort();
|
||||
}
|
||||
|
||||
#ifdef EXTERNAL_CODECS
|
||||
if (isExtractGroupCommand
|
||||
|| options.Command.CommandType == NCommandType::kHash
|
||||
|| options.Command.CommandType == NCommandType::kBenchmark)
|
||||
ThrowException_if_Error(__externalCodecs.Load());
|
||||
#endif
|
||||
|
||||
if (options.Command.CommandType == NCommandType::kBenchmark)
|
||||
{
|
||||
HRESULT res = Benchmark(EXTERNAL_CODECS_VARS_L options.Properties);
|
||||
/*
|
||||
if (res == S_FALSE)
|
||||
{
|
||||
stdStream << "\nDecoding Error\n";
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
*/
|
||||
ThrowException_if_Error(res);
|
||||
}
|
||||
else if (isExtractGroupCommand)
|
||||
{
|
||||
UStringVector ArchivePathsSorted;
|
||||
UStringVector ArchivePathsFullSorted;
|
||||
|
||||
CExtractCallbackImp *ecs = new CExtractCallbackImp;
|
||||
CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
|
||||
|
||||
#ifndef _NO_CRYPTO
|
||||
ecs->PasswordIsDefined = options.PasswordEnabled;
|
||||
ecs->Password = options.Password;
|
||||
#endif
|
||||
|
||||
ecs->Init();
|
||||
|
||||
CExtractOptions eo;
|
||||
(CExtractOptionsBase &)eo = options.ExtractOptions;
|
||||
eo.StdInMode = options.StdInMode;
|
||||
eo.StdOutMode = options.StdOutMode;
|
||||
eo.YesToAll = options.YesToAll;
|
||||
eo.TestMode = options.Command.IsTestCommand();
|
||||
|
||||
#ifndef _SFX
|
||||
eo.Properties = options.Properties;
|
||||
#endif
|
||||
|
||||
bool messageWasDisplayed = false;
|
||||
|
||||
#ifndef _SFX
|
||||
CHashBundle hb;
|
||||
CHashBundle *hb_ptr = NULL;
|
||||
|
||||
if (!options.HashMethods.IsEmpty())
|
||||
{
|
||||
hb_ptr = &hb;
|
||||
ThrowException_if_Error(hb.SetMethods(EXTERNAL_CODECS_VARS_L options.HashMethods));
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
CDirItemsStat st;
|
||||
HRESULT hresultMain = EnumerateDirItemsAndSort(
|
||||
options.arcCensor,
|
||||
NWildcard::k_RelatPath,
|
||||
UString(), // addPathPrefix
|
||||
ArchivePathsSorted,
|
||||
ArchivePathsFullSorted,
|
||||
st,
|
||||
NULL // &scan: change it!!!!
|
||||
);
|
||||
if (hresultMain != S_OK)
|
||||
{
|
||||
/*
|
||||
if (hresultMain != E_ABORT && messageWasDisplayed)
|
||||
return NExitCode::kFatalError;
|
||||
*/
|
||||
throw CSystemException(hresultMain);
|
||||
}
|
||||
}
|
||||
|
||||
ecs->MultiArcMode = (ArchivePathsSorted.Size() > 1);
|
||||
|
||||
HRESULT result = ExtractGUI(codecs,
|
||||
formatIndices, excludedFormatIndices,
|
||||
ArchivePathsSorted,
|
||||
ArchivePathsFullSorted,
|
||||
options.Censor.Pairs.Front().Head,
|
||||
eo,
|
||||
#ifndef _SFX
|
||||
hb_ptr,
|
||||
#endif
|
||||
options.ShowDialog, messageWasDisplayed, ecs);
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (result != E_ABORT && messageWasDisplayed)
|
||||
return NExitCode::kFatalError;
|
||||
throw CSystemException(result);
|
||||
}
|
||||
if (!ecs->IsOK())
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
else if (options.Command.IsFromUpdateGroup())
|
||||
{
|
||||
#ifndef _NO_CRYPTO
|
||||
bool passwordIsDefined = options.PasswordEnabled && !options.Password.IsEmpty();
|
||||
#endif
|
||||
|
||||
CUpdateCallbackGUI callback;
|
||||
// callback.EnablePercents = options.EnablePercents;
|
||||
|
||||
#ifndef _NO_CRYPTO
|
||||
callback.PasswordIsDefined = passwordIsDefined;
|
||||
callback.AskPassword = options.PasswordEnabled && options.Password.IsEmpty();
|
||||
callback.Password = options.Password;
|
||||
#endif
|
||||
|
||||
// callback.StdOutMode = options.UpdateOptions.StdOutMode;
|
||||
callback.Init();
|
||||
|
||||
if (!options.UpdateOptions.InitFormatIndex(codecs, formatIndices, options.ArchiveName) ||
|
||||
!options.UpdateOptions.SetArcPath(codecs, options.ArchiveName))
|
||||
{
|
||||
ErrorLangMessage(IDS_UPDATE_NOT_SUPPORTED);
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
bool messageWasDisplayed = false;
|
||||
HRESULT result = UpdateGUI(
|
||||
codecs, formatIndices,
|
||||
options.ArchiveName,
|
||||
options.Censor,
|
||||
options.UpdateOptions,
|
||||
options.ShowDialog,
|
||||
messageWasDisplayed,
|
||||
&callback);
|
||||
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (result != E_ABORT && messageWasDisplayed)
|
||||
return NExitCode::kFatalError;
|
||||
throw CSystemException(result);
|
||||
}
|
||||
if (callback.FailedFiles.Size() > 0)
|
||||
{
|
||||
if (!messageWasDisplayed)
|
||||
throw CSystemException(E_FAIL);
|
||||
return NExitCode::kWarning;
|
||||
}
|
||||
}
|
||||
else if (options.Command.CommandType == NCommandType::kHash)
|
||||
{
|
||||
bool messageWasDisplayed = false;
|
||||
HRESULT result = HashCalcGUI(EXTERNAL_CODECS_VARS_L
|
||||
options.Censor, options.HashOptions, messageWasDisplayed);
|
||||
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (result != E_ABORT && messageWasDisplayed)
|
||||
return NExitCode::kFatalError;
|
||||
throw CSystemException(result);
|
||||
}
|
||||
/*
|
||||
if (callback.FailedFiles.Size() > 0)
|
||||
{
|
||||
if (!messageWasDisplayed)
|
||||
throw CSystemException(E_FAIL);
|
||||
return NExitCode::kWarning;
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "Unsupported command";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define NT_CHECK_FAIL_ACTION ErrorMessage(L"Unsupported Windows version"); return NExitCode::kFatalError;
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
|
||||
#ifdef UNDER_CE
|
||||
LPWSTR
|
||||
#else
|
||||
LPSTR
|
||||
#endif
|
||||
/* lpCmdLine */, int /* nCmdShow */)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
#ifdef _WIN32
|
||||
NT_CHECK
|
||||
SetLargePageSize();
|
||||
#endif
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
#ifndef UNDER_CE
|
||||
g_ComCtl32Version = ::GetDllVersion(TEXT("comctl32.dll"));
|
||||
g_LVN_ITEMACTIVATE_Support = (g_ComCtl32Version >= MAKELONG(71, 4));
|
||||
#endif
|
||||
|
||||
// OleInitialize is required for ProgressBar in TaskBar.
|
||||
#ifndef UNDER_CE
|
||||
OleInitialize(NULL);
|
||||
#endif
|
||||
|
||||
LoadLangOneTime();
|
||||
|
||||
// setlocale(LC_COLLATE, ".ACP");
|
||||
try
|
||||
{
|
||||
return Main2();
|
||||
}
|
||||
catch(const CNewException &)
|
||||
{
|
||||
return ShowMemErrorMessage();
|
||||
}
|
||||
catch(const CArcCmdLineException &e)
|
||||
{
|
||||
ErrorMessage(e);
|
||||
return NExitCode::kUserError;
|
||||
}
|
||||
catch(const CSystemException &systemError)
|
||||
{
|
||||
if (systemError.ErrorCode == E_ABORT)
|
||||
return NExitCode::kUserBreak;
|
||||
return ShowSysErrorMessage(systemError.ErrorCode);
|
||||
}
|
||||
catch(const UString &s)
|
||||
{
|
||||
ErrorMessage(s);
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
catch(const AString &s)
|
||||
{
|
||||
ErrorMessage(GetUnicodeString(s));
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
catch(const wchar_t *s)
|
||||
{
|
||||
ErrorMessage(s);
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
catch(const char *s)
|
||||
{
|
||||
ErrorMessage(GetUnicodeString(s));
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
catch(int v)
|
||||
{
|
||||
wchar_t s[32];
|
||||
ConvertUInt32ToString(v, s);
|
||||
ErrorMessage(UString(L"Error: ") + s);
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
ErrorMessage(L"Unknown error");
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
}
|
||||
1146
CPP/7zip/UI/GUI/GUI.dsp
Normal file
1146
CPP/7zip/UI/GUI/GUI.dsp
Normal file
File diff suppressed because it is too large
Load Diff
29
CPP/7zip/UI/GUI/GUI.dsw
Normal file
29
CPP/7zip/UI/GUI/GUI.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "GUI"=.\GUI.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
278
CPP/7zip/UI/GUI/HashGUI.cpp
Normal file
278
CPP/7zip/UI/GUI/HashGUI.cpp
Normal file
@@ -0,0 +1,278 @@
|
||||
// HashGUI.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/IntToString.h"
|
||||
#include "../../../Common/StringConvert.h"
|
||||
|
||||
#include "../../../Windows/ErrorMsg.h"
|
||||
|
||||
#include "../FileManager/FormatUtils.h"
|
||||
#include "../FileManager/LangUtils.h"
|
||||
#include "../FileManager/OverwriteDialogRes.h"
|
||||
#include "../FileManager/ProgressDialog2.h"
|
||||
#include "../FileManager/ProgressDialog2Res.h"
|
||||
#include "../FileManager/PropertyNameRes.h"
|
||||
#include "../FileManager/resourceGui.h"
|
||||
|
||||
#include "HashGUI.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
class CHashCallbackGUI: public CProgressThreadVirt, public IHashCallbackUI
|
||||
{
|
||||
UInt64 NumFiles;
|
||||
bool _curIsFolder;
|
||||
UString FirstFileName;
|
||||
|
||||
HRESULT ProcessVirt();
|
||||
|
||||
public:
|
||||
const NWildcard::CCensor *censor;
|
||||
const CHashOptions *options;
|
||||
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS2;
|
||||
|
||||
CHashCallbackGUI() {}
|
||||
~CHashCallbackGUI() { }
|
||||
|
||||
INTERFACE_IHashCallbackUI(;)
|
||||
|
||||
void AddErrorMessage(DWORD systemError, const wchar_t *name)
|
||||
{
|
||||
ProgressDialog.Sync.AddError_Code_Name(systemError, name);
|
||||
}
|
||||
};
|
||||
|
||||
static void AddValuePair(UString &s, UINT resourceID, UInt64 value)
|
||||
{
|
||||
AddLangString(s, resourceID);
|
||||
s.AddAscii(": ");
|
||||
char sz[32];
|
||||
ConvertUInt64ToString(value, sz);
|
||||
s.AddAscii(sz);
|
||||
s.Add_LF();
|
||||
}
|
||||
|
||||
static void AddSizeValuePair(UString &s, UINT resourceID, UInt64 value)
|
||||
{
|
||||
AddLangString(s, resourceID);
|
||||
s.AddAscii(": ");
|
||||
wchar_t sz[32];
|
||||
ConvertUInt64ToString(value, sz);
|
||||
s += MyFormatNew(IDS_FILE_SIZE, sz);
|
||||
ConvertUInt64ToString(value >> 20, sz);
|
||||
s.AddAscii(" (");
|
||||
s += sz;
|
||||
s.AddAscii(" MB)");
|
||||
s.Add_LF();
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::StartScanning()
|
||||
{
|
||||
CProgressSync &sync = ProgressDialog.Sync;
|
||||
sync.Set_Status(LangString(IDS_SCANNING));
|
||||
return CheckBreak();
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::ScanProgress(const CDirItemsStat &st, const FString &path, bool isDir)
|
||||
{
|
||||
return ProgressDialog.Sync.ScanProgress(st.NumFiles, st.GetTotalBytes(), path, isDir);
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::ScanError(const FString &path, DWORD systemError)
|
||||
{
|
||||
AddErrorMessage(systemError, fs2us(path));
|
||||
return CheckBreak();
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::FinishScanning(const CDirItemsStat &st)
|
||||
{
|
||||
return ScanProgress(st, FString(), false);
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::CheckBreak()
|
||||
{
|
||||
return ProgressDialog.Sync.CheckStop();
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::SetNumFiles(UInt64 numFiles)
|
||||
{
|
||||
CProgressSync &sync = ProgressDialog.Sync;
|
||||
sync.Set_NumFilesTotal(numFiles);
|
||||
return CheckBreak();
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::SetTotal(UInt64 size)
|
||||
{
|
||||
CProgressSync &sync = ProgressDialog.Sync;
|
||||
sync.Set_NumBytesTotal(size);
|
||||
return CheckBreak();
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::SetCompleted(const UInt64 *completed)
|
||||
{
|
||||
return ProgressDialog.Sync.Set_NumBytesCur(completed);
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::BeforeFirstFile(const CHashBundle & /* hb */)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::GetStream(const wchar_t *name, bool isFolder)
|
||||
{
|
||||
if (NumFiles == 0)
|
||||
FirstFileName = name;
|
||||
_curIsFolder = isFolder;
|
||||
CProgressSync &sync = ProgressDialog.Sync;
|
||||
sync.Set_FilePath(name, isFolder);
|
||||
return CheckBreak();
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::OpenFileError(const FString &path, DWORD systemError)
|
||||
{
|
||||
// if (systemError == ERROR_SHARING_VIOLATION)
|
||||
{
|
||||
AddErrorMessage(systemError, fs2us(path));
|
||||
return S_FALSE;
|
||||
}
|
||||
// return systemError;
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::SetOperationResult(UInt64 /* fileSize */, const CHashBundle & /* hb */, bool /* showHash */)
|
||||
{
|
||||
CProgressSync &sync = ProgressDialog.Sync;
|
||||
if (!_curIsFolder)
|
||||
NumFiles++;
|
||||
sync.Set_NumFilesCur(NumFiles);
|
||||
return CheckBreak();
|
||||
}
|
||||
|
||||
static void AddHashString(UString &s, const CHasherState &h, unsigned digestIndex, const wchar_t *title)
|
||||
{
|
||||
s += title;
|
||||
s.Add_Space();
|
||||
char temp[k_HashCalc_DigestSize_Max * 2 + 4];
|
||||
AddHashHexToString(temp, h.Digests[digestIndex], h.DigestSize);
|
||||
s.AddAscii(temp);
|
||||
s.Add_LF();
|
||||
}
|
||||
|
||||
static void AddHashResString(UString &s, const CHasherState &h, unsigned digestIndex, UInt32 resID)
|
||||
{
|
||||
UString s2 = LangString(resID);
|
||||
UString name;
|
||||
name.SetFromAscii(h.Name);
|
||||
s2.Replace(L"CRC", name);
|
||||
AddHashString(s, h, digestIndex, s2);
|
||||
}
|
||||
|
||||
void AddHashBundleRes(UString &s, const CHashBundle &hb, const UString &firstFileName)
|
||||
{
|
||||
if (hb.NumErrors != 0)
|
||||
{
|
||||
AddValuePair(s, IDS_PROP_NUM_ERRORS, hb.NumErrors);
|
||||
s.Add_LF();
|
||||
}
|
||||
|
||||
if (hb.NumFiles == 1 && hb.NumDirs == 0 && !firstFileName.IsEmpty())
|
||||
{
|
||||
AddLangString(s, IDS_PROP_NAME);
|
||||
s.AddAscii(": ");
|
||||
s += firstFileName;
|
||||
s.Add_LF();
|
||||
}
|
||||
else
|
||||
{
|
||||
AddValuePair(s, IDS_PROP_FOLDERS, hb.NumDirs);
|
||||
AddValuePair(s, IDS_PROP_FILES, hb.NumFiles);
|
||||
}
|
||||
|
||||
AddSizeValuePair(s, IDS_PROP_SIZE, hb.FilesSize);
|
||||
|
||||
if (hb.NumAltStreams != 0)
|
||||
{
|
||||
s.Add_LF();
|
||||
AddValuePair(s, IDS_PROP_NUM_ALT_STREAMS, hb.NumAltStreams);
|
||||
AddSizeValuePair(s, IDS_PROP_ALT_STREAMS_SIZE, hb.AltStreamsSize);
|
||||
}
|
||||
|
||||
if (hb.NumErrors == 0 && hb.Hashers.IsEmpty())
|
||||
{
|
||||
s.Add_LF();
|
||||
AddLangString(s, IDS_MESSAGE_NO_ERRORS);
|
||||
}
|
||||
|
||||
FOR_VECTOR (i, hb.Hashers)
|
||||
{
|
||||
s.Add_LF();
|
||||
const CHasherState &h = hb.Hashers[i];
|
||||
if (hb.NumFiles == 1 && hb.NumDirs == 0)
|
||||
{
|
||||
s.AddAscii(h.Name);
|
||||
AddHashString(s, h, k_HashCalc_Index_DataSum, L":");
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHashResString(s, h, k_HashCalc_Index_DataSum, IDS_CHECKSUM_CRC_DATA);
|
||||
AddHashResString(s, h, k_HashCalc_Index_NamesSum, IDS_CHECKSUM_CRC_DATA_NAMES);
|
||||
}
|
||||
if (hb.NumAltStreams != 0)
|
||||
{
|
||||
AddHashResString(s, h, k_HashCalc_Index_StreamsSum, IDS_CHECKSUM_CRC_STREAMS_NAMES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::AfterLastFile(const CHashBundle &hb)
|
||||
{
|
||||
UString s;
|
||||
AddHashBundleRes(s, hb, FirstFileName);
|
||||
|
||||
CProgressSync &sync = ProgressDialog.Sync;
|
||||
sync.Set_NumFilesCur(hb.NumFiles);
|
||||
|
||||
CProgressMessageBoxPair &pair = GetMessagePair(hb.NumErrors != 0);
|
||||
pair.Message = s;
|
||||
LangString(IDS_CHECKSUM_INFORMATION, pair.Title);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CHashCallbackGUI::ProcessVirt()
|
||||
{
|
||||
NumFiles = 0;
|
||||
|
||||
AString errorInfo;
|
||||
HRESULT res = HashCalc(EXTERNAL_CODECS_LOC_VARS
|
||||
*censor, *options, errorInfo, this);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
HRESULT HashCalcGUI(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
const NWildcard::CCensor &censor,
|
||||
const CHashOptions &options,
|
||||
bool &messageWasDisplayed)
|
||||
{
|
||||
CHashCallbackGUI t;
|
||||
#ifdef EXTERNAL_CODECS
|
||||
t.__externalCodecs = __externalCodecs;
|
||||
#endif
|
||||
t.censor = &censor;
|
||||
t.options = &options;
|
||||
|
||||
t.ProgressDialog.ShowCompressionInfo = false;
|
||||
|
||||
const UString title = LangString(IDS_CHECKSUM_CALCULATING);
|
||||
|
||||
t.ProgressDialog.MainTitle = L"7-Zip"; // LangString(IDS_APP_TITLE);
|
||||
t.ProgressDialog.MainAddTitle = title;
|
||||
t.ProgressDialog.MainAddTitle.Add_Space();
|
||||
|
||||
RINOK(t.Create(title));
|
||||
messageWasDisplayed = t.ThreadFinishedOK && t.ProgressDialog.MessagesDisplayed;
|
||||
return S_OK;
|
||||
}
|
||||
16
CPP/7zip/UI/GUI/HashGUI.h
Normal file
16
CPP/7zip/UI/GUI/HashGUI.h
Normal file
@@ -0,0 +1,16 @@
|
||||
// HashGUI.h
|
||||
|
||||
#ifndef __HASH_GUI_H
|
||||
#define __HASH_GUI_H
|
||||
|
||||
#include "../Common/HashCalc.h"
|
||||
|
||||
HRESULT HashCalcGUI(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
const NWildcard::CCensor &censor,
|
||||
const CHashOptions &options,
|
||||
bool &messageWasDisplayed);
|
||||
|
||||
void AddHashBundleRes(UString &s, const CHashBundle &hb, const UString &firstFileName);
|
||||
|
||||
#endif
|
||||
3
CPP/7zip/UI/GUI/StdAfx.cpp
Normal file
3
CPP/7zip/UI/GUI/StdAfx.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
// StdAfx.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
21
CPP/7zip/UI/GUI/StdAfx.h
Normal file
21
CPP/7zip/UI/GUI/StdAfx.h
Normal file
@@ -0,0 +1,21 @@
|
||||
// StdAfx.h
|
||||
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
// #define _WIN32_WINNT 0x0400
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#define WINVER _WIN32_WINNT
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
|
||||
// #include "../../../Common/MyWindows.h"
|
||||
|
||||
// #include <commctrl.h>
|
||||
// #include <ShlObj.h>
|
||||
// #include <shlwapi.h>
|
||||
|
||||
// #define printf(x) NO_PRINTF_(x)
|
||||
// #define sprintf(x) NO_SPRINTF_(x)
|
||||
|
||||
#endif
|
||||
280
CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
Normal file
280
CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
Normal file
@@ -0,0 +1,280 @@
|
||||
// UpdateCallbackGUI.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/IntToString.h"
|
||||
#include "../../../Common/StringConvert.h"
|
||||
|
||||
#include "../../../Windows/PropVariant.h"
|
||||
|
||||
#include "../FileManager/FormatUtils.h"
|
||||
#include "../FileManager/LangUtils.h"
|
||||
|
||||
#include "../FileManager/resourceGui.h"
|
||||
|
||||
#include "resource2.h"
|
||||
|
||||
#include "UpdateCallbackGUI.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
// CUpdateCallbackGUI::~CUpdateCallbackGUI() {}
|
||||
|
||||
void CUpdateCallbackGUI::Init()
|
||||
{
|
||||
CUpdateCallbackGUI2::Init();
|
||||
FailedFiles.Clear();
|
||||
}
|
||||
|
||||
void OpenResult_GUI(UString &s, const CCodecs *codecs, const CArchiveLink &arcLink, const wchar_t *name, HRESULT result);
|
||||
|
||||
HRESULT CUpdateCallbackGUI::OpenResult(
|
||||
const CCodecs *codecs, const CArchiveLink &arcLink, const wchar_t *name, HRESULT result)
|
||||
{
|
||||
UString s;
|
||||
OpenResult_GUI(s, codecs, arcLink, name, result);
|
||||
if (!s.IsEmpty())
|
||||
{
|
||||
ProgressDialog->Sync.AddError_Message(s);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::StartScanning()
|
||||
{
|
||||
CProgressSync &sync = ProgressDialog->Sync;
|
||||
sync.Set_Status(LangString(IDS_SCANNING));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::ScanError(const FString &path, DWORD systemError)
|
||||
{
|
||||
FailedFiles.Add(path);
|
||||
ProgressDialog->Sync.AddError_Code_Name(systemError, fs2us(path));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::FinishScanning(const CDirItemsStat &st)
|
||||
{
|
||||
CProgressSync &sync = ProgressDialog->Sync;
|
||||
RINOK(ProgressDialog->Sync.ScanProgress(st.NumFiles + st.NumAltStreams,
|
||||
st.GetTotalBytes(), FString(), true));
|
||||
sync.Set_Status(L"");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::StartArchive(const wchar_t *name, bool /* updating */)
|
||||
{
|
||||
CProgressSync &sync = ProgressDialog->Sync;
|
||||
sync.Set_Status(LangString(IDS_PROGRESS_COMPRESSING));
|
||||
sync.Set_TitleFileName(name);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::FinishArchive(const CFinishArchiveStat & /* st */)
|
||||
{
|
||||
CProgressSync &sync = ProgressDialog->Sync;
|
||||
sync.Set_Status(L"");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::CheckBreak()
|
||||
{
|
||||
return ProgressDialog->Sync.CheckStop();
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::ScanProgress(const CDirItemsStat &st, const FString &path, bool isDir)
|
||||
{
|
||||
return ProgressDialog->Sync.ScanProgress(st.NumFiles + st.NumAltStreams,
|
||||
st.GetTotalBytes(), path, isDir);
|
||||
}
|
||||
|
||||
/*
|
||||
HRESULT CUpdateCallbackGUI::Finalize()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
HRESULT CUpdateCallbackGUI::SetNumItems(UInt64 numItems)
|
||||
{
|
||||
ProgressDialog->Sync.Set_NumFilesTotal(numItems);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::SetTotal(UInt64 total)
|
||||
{
|
||||
ProgressDialog->Sync.Set_NumBytesTotal(total);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::SetCompleted(const UInt64 *completed)
|
||||
{
|
||||
return ProgressDialog->Sync.Set_NumBytesCur(completed);
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
|
||||
{
|
||||
ProgressDialog->Sync.Set_Ratio(inSize, outSize);
|
||||
return CheckBreak();
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::GetStream(const wchar_t *name, bool isDir, bool /* isAnti */, UInt32 mode)
|
||||
{
|
||||
return SetOperation_Base(mode, name, isDir);
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::OpenFileError(const FString &path, DWORD systemError)
|
||||
{
|
||||
FailedFiles.Add(path);
|
||||
// if (systemError == ERROR_SHARING_VIOLATION)
|
||||
{
|
||||
ProgressDialog->Sync.AddError_Code_Name(systemError, fs2us(path));
|
||||
return S_FALSE;
|
||||
}
|
||||
// return systemError;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::SetOperationResult(Int32 /* operationResult */)
|
||||
{
|
||||
NumFiles++;
|
||||
ProgressDialog->Sync.Set_NumFilesCur(NumFiles);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, const wchar_t *fileName, UString &s);
|
||||
|
||||
HRESULT CUpdateCallbackGUI::ReportExtractResult(Int32 opRes, Int32 isEncrypted, const wchar_t *name)
|
||||
{
|
||||
if (opRes != NArchive::NExtract::NOperationResult::kOK)
|
||||
{
|
||||
UString s;
|
||||
SetExtractErrorMessage(opRes, isEncrypted, name, s);
|
||||
ProgressDialog->Sync.AddError_Message(s);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::ReportUpdateOpeartion(UInt32 op, const wchar_t *name, bool isDir)
|
||||
{
|
||||
return SetOperation_Base(op, name, isDir);
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
|
||||
{
|
||||
*password = NULL;
|
||||
if (passwordIsDefined)
|
||||
*passwordIsDefined = BoolToInt(PasswordIsDefined);
|
||||
if (!PasswordIsDefined)
|
||||
{
|
||||
if (AskPassword)
|
||||
{
|
||||
RINOK(ShowAskPasswordDialog())
|
||||
}
|
||||
}
|
||||
if (passwordIsDefined)
|
||||
*passwordIsDefined = BoolToInt(PasswordIsDefined);
|
||||
return StringToBstr(Password, password);
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::CryptoGetTextPassword(BSTR *password)
|
||||
{
|
||||
return CryptoGetTextPassword2(NULL, password);
|
||||
}
|
||||
|
||||
/*
|
||||
It doesn't work, since main stream waits Dialog
|
||||
HRESULT CUpdateCallbackGUI::CloseProgress()
|
||||
{
|
||||
ProgressDialog->MyClose();
|
||||
return S_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
HRESULT CUpdateCallbackGUI::Open_CheckBreak()
|
||||
{
|
||||
return ProgressDialog->Sync.CheckStop();
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::Open_SetTotal(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
|
||||
{
|
||||
// if (numFiles != NULL) ProgressDialog->Sync.SetNumFilesTotal(*numFiles);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::Open_SetCompleted(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
|
||||
{
|
||||
return ProgressDialog->Sync.CheckStop();
|
||||
}
|
||||
|
||||
#ifndef _NO_CRYPTO
|
||||
|
||||
HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password)
|
||||
{
|
||||
PasswordWasAsked = true;
|
||||
return CryptoGetTextPassword2(NULL, password);
|
||||
}
|
||||
|
||||
/*
|
||||
HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(bool &passwordIsDefined, UString &password)
|
||||
{
|
||||
passwordIsDefined = PasswordIsDefined;
|
||||
password = Password;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
bool CUpdateCallbackGUI::Open_WasPasswordAsked()
|
||||
{
|
||||
return PasswordWasAsked;
|
||||
}
|
||||
|
||||
void CUpdateCallbackGUI::Open_Clear_PasswordWasAsked_Flag()
|
||||
{
|
||||
PasswordWasAsked = false;
|
||||
}
|
||||
*/
|
||||
|
||||
HRESULT CUpdateCallbackGUI::ShowDeleteFile(const wchar_t *name, bool isDir)
|
||||
{
|
||||
return SetOperation_Base(NUpdateNotifyOp::kDelete, name, isDir);
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::FinishDeletingAfterArchiving()
|
||||
{
|
||||
// ClosePercents2();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::DeletingAfterArchiving(const FString &path, bool isDir)
|
||||
{
|
||||
return ProgressDialog->Sync.Set_Status2(_lang_Removing, fs2us(path), isDir);
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::StartOpenArchive(const wchar_t * /* name */)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::ReadingFileError(const FString &path, DWORD systemError)
|
||||
{
|
||||
FailedFiles.Add(path);
|
||||
ProgressDialog->Sync.AddError_Code_Name(systemError, fs2us(path));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::WriteSfx(const wchar_t * /* name */, UInt64 /* size */)
|
||||
{
|
||||
CProgressSync &sync = ProgressDialog->Sync;
|
||||
sync.Set_Status(L"WriteSfx");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI::Open_Finished()
|
||||
{
|
||||
// ClosePercents();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
34
CPP/7zip/UI/GUI/UpdateCallbackGUI.h
Normal file
34
CPP/7zip/UI/GUI/UpdateCallbackGUI.h
Normal file
@@ -0,0 +1,34 @@
|
||||
// UpdateCallbackGUI.h
|
||||
|
||||
#ifndef __UPDATE_CALLBACK_GUI_H
|
||||
#define __UPDATE_CALLBACK_GUI_H
|
||||
|
||||
#include "../Common/Update.h"
|
||||
#include "../Common/ArchiveOpenCallback.h"
|
||||
|
||||
#include "UpdateCallbackGUI2.h"
|
||||
|
||||
class CUpdateCallbackGUI:
|
||||
public IOpenCallbackUI,
|
||||
public IUpdateCallbackUI2,
|
||||
public CUpdateCallbackGUI2
|
||||
{
|
||||
public:
|
||||
// CUpdateCallbackGUI();
|
||||
// ~CUpdateCallbackGUI();
|
||||
|
||||
bool AskPassword;
|
||||
|
||||
void Init();
|
||||
|
||||
CUpdateCallbackGUI():
|
||||
AskPassword(false)
|
||||
{}
|
||||
|
||||
INTERFACE_IUpdateCallbackUI2(;)
|
||||
INTERFACE_IOpenCallbackUI(;)
|
||||
|
||||
FStringVector FailedFiles;
|
||||
};
|
||||
|
||||
#endif
|
||||
59
CPP/7zip/UI/GUI/UpdateCallbackGUI2.cpp
Normal file
59
CPP/7zip/UI/GUI/UpdateCallbackGUI2.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
// UpdateCallbackGUI2.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../FileManager/LangUtils.h"
|
||||
#include "../FileManager/PasswordDialog.h"
|
||||
|
||||
#include "resource2.h"
|
||||
#include "resource3.h"
|
||||
#include "ExtractRes.h"
|
||||
|
||||
#include "UpdateCallbackGUI.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static const UINT k_UpdNotifyLangs[] =
|
||||
{
|
||||
IDS_PROGRESS_ADD,
|
||||
IDS_PROGRESS_UPDATE,
|
||||
IDS_PROGRESS_ANALYZE,
|
||||
IDS_PROGRESS_REPLICATE,
|
||||
IDS_PROGRESS_REPACK,
|
||||
IDS_PROGRESS_SKIPPING,
|
||||
IDS_PROGRESS_DELETE,
|
||||
IDS_PROGRESS_HEADER
|
||||
};
|
||||
|
||||
void CUpdateCallbackGUI2::Init()
|
||||
{
|
||||
NumFiles = 0;
|
||||
|
||||
_lang_Removing = LangString(IDS_PROGRESS_REMOVE);
|
||||
_lang_Ops.Clear();
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(k_UpdNotifyLangs); i++)
|
||||
_lang_Ops.Add(LangString(k_UpdNotifyLangs[i]));
|
||||
}
|
||||
|
||||
HRESULT CUpdateCallbackGUI2::SetOperation_Base(UInt32 notifyOp, const wchar_t *name, bool isDir)
|
||||
{
|
||||
const UString *s = NULL;
|
||||
if (notifyOp < _lang_Ops.Size())
|
||||
s = &(_lang_Ops[(unsigned)notifyOp]);
|
||||
else
|
||||
s = &_emptyString;
|
||||
|
||||
return ProgressDialog->Sync.Set_Status2(*s, name, isDir);
|
||||
}
|
||||
|
||||
|
||||
HRESULT CUpdateCallbackGUI2::ShowAskPasswordDialog()
|
||||
{
|
||||
CPasswordDialog dialog;
|
||||
ProgressDialog->WaitCreating();
|
||||
if (dialog.Create(*ProgressDialog) != IDOK)
|
||||
return E_ABORT;
|
||||
Password = dialog.Password;
|
||||
PasswordIsDefined = true;
|
||||
return S_OK;
|
||||
}
|
||||
35
CPP/7zip/UI/GUI/UpdateCallbackGUI2.h
Normal file
35
CPP/7zip/UI/GUI/UpdateCallbackGUI2.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// UpdateCallbackGUI2.h
|
||||
|
||||
#ifndef __UPDATE_CALLBACK_GUI2_H
|
||||
#define __UPDATE_CALLBACK_GUI2_H
|
||||
|
||||
#include "../FileManager/ProgressDialog2.h"
|
||||
|
||||
class CUpdateCallbackGUI2
|
||||
{
|
||||
UStringVector _lang_Ops;
|
||||
UString _emptyString;
|
||||
public:
|
||||
UString Password;
|
||||
bool PasswordIsDefined;
|
||||
bool PasswordWasAsked;
|
||||
UInt64 NumFiles;
|
||||
|
||||
UString _lang_Removing;
|
||||
|
||||
CUpdateCallbackGUI2():
|
||||
PasswordIsDefined(false),
|
||||
PasswordWasAsked(false),
|
||||
NumFiles(0)
|
||||
{}
|
||||
|
||||
// ~CUpdateCallbackGUI2();
|
||||
void Init();
|
||||
|
||||
CProgressDialog *ProgressDialog;
|
||||
|
||||
HRESULT SetOperation_Base(UInt32 notifyOp, const wchar_t *name, bool isDir);
|
||||
HRESULT ShowAskPasswordDialog();
|
||||
};
|
||||
|
||||
#endif
|
||||
491
CPP/7zip/UI/GUI/UpdateGUI.cpp
Normal file
491
CPP/7zip/UI/GUI/UpdateGUI.cpp
Normal file
@@ -0,0 +1,491 @@
|
||||
// UpdateGUI.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/IntToString.h"
|
||||
#include "../../../Common/StringConvert.h"
|
||||
#include "../../../Common/StringToInt.h"
|
||||
|
||||
#include "../../../Windows/DLL.h"
|
||||
#include "../../../Windows/FileDir.h"
|
||||
#include "../../../Windows/FileName.h"
|
||||
#include "../../../Windows/Thread.h"
|
||||
|
||||
#include "../Common/WorkDir.h"
|
||||
|
||||
#include "../Explorer/MyMessages.h"
|
||||
|
||||
#include "../FileManager/LangUtils.h"
|
||||
#include "../FileManager/StringUtils.h"
|
||||
#include "../FileManager/resourceGui.h"
|
||||
|
||||
#include "CompressDialog.h"
|
||||
#include "UpdateGUI.h"
|
||||
|
||||
#include "resource2.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NDir;
|
||||
|
||||
static CFSTR kDefaultSfxModule = FTEXT("7z.sfx");
|
||||
static const wchar_t *kSFXExtension = L"exe";
|
||||
|
||||
extern void AddMessageToString(UString &dest, const UString &src);
|
||||
|
||||
UString HResultToMessage(HRESULT errorCode);
|
||||
|
||||
class CThreadUpdating: public CProgressThreadVirt
|
||||
{
|
||||
HRESULT ProcessVirt();
|
||||
public:
|
||||
CCodecs *codecs;
|
||||
const CObjectVector<COpenType> *formatIndices;
|
||||
const UString *cmdArcPath;
|
||||
CUpdateCallbackGUI *UpdateCallbackGUI;
|
||||
NWildcard::CCensor *WildcardCensor;
|
||||
CUpdateOptions *Options;
|
||||
bool needSetPath;
|
||||
};
|
||||
|
||||
HRESULT CThreadUpdating::ProcessVirt()
|
||||
{
|
||||
CUpdateErrorInfo ei;
|
||||
HRESULT res = UpdateArchive(codecs, *formatIndices, *cmdArcPath,
|
||||
*WildcardCensor, *Options,
|
||||
ei, UpdateCallbackGUI, UpdateCallbackGUI, needSetPath);
|
||||
FinalMessage.ErrorMessage.Message.SetFromAscii(ei.Message);
|
||||
ErrorPaths = ei.FileNames;
|
||||
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)
|
||||
{
|
||||
CProperty prop;
|
||||
prop.Name = name;
|
||||
prop.Value = value;
|
||||
properties.Add(prop);
|
||||
}
|
||||
|
||||
static void AddProp(CObjectVector<CProperty> &properties, const UString &name, UInt32 value)
|
||||
{
|
||||
wchar_t tmp[32];
|
||||
ConvertUInt64ToString(value, tmp);
|
||||
AddProp(properties, name, tmp);
|
||||
}
|
||||
|
||||
static void AddProp(CObjectVector<CProperty> &properties, const UString &name, bool value)
|
||||
{
|
||||
AddProp(properties, name, value ? UString(L"on"): UString(L"off"));
|
||||
}
|
||||
|
||||
static bool IsThereMethodOverride(bool is7z, const UString &propertiesString)
|
||||
{
|
||||
UStringVector strings;
|
||||
SplitString(propertiesString, strings);
|
||||
FOR_VECTOR (i, strings)
|
||||
{
|
||||
const UString &s = strings[i];
|
||||
if (is7z)
|
||||
{
|
||||
const wchar_t *end;
|
||||
UInt64 n = ConvertStringToUInt64(s, &end);
|
||||
if (n == 0 && *end == L'=')
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s.Len() > 0)
|
||||
if (s[0] == L'm' && s[1] == L'=')
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ParseAndAddPropertires(CObjectVector<CProperty> &properties,
|
||||
const UString &propertiesString)
|
||||
{
|
||||
UStringVector strings;
|
||||
SplitString(propertiesString, strings);
|
||||
FOR_VECTOR (i, strings)
|
||||
{
|
||||
const UString &s = strings[i];
|
||||
CProperty property;
|
||||
int index = s.Find(L'=');
|
||||
if (index < 0)
|
||||
property.Name = s;
|
||||
else
|
||||
{
|
||||
property.Name.SetFrom(s, index);
|
||||
property.Value = s.Ptr(index + 1);
|
||||
}
|
||||
properties.Add(property);
|
||||
}
|
||||
}
|
||||
|
||||
static UString GetNumInBytesString(UInt64 v)
|
||||
{
|
||||
wchar_t s[32];
|
||||
ConvertUInt64ToString(v, s);
|
||||
size_t len = wcslen(s);
|
||||
s[len++] = L'B';
|
||||
s[len] = L'\0';
|
||||
return s;
|
||||
}
|
||||
|
||||
static void SetOutProperties(
|
||||
CObjectVector<CProperty> &properties,
|
||||
bool is7z,
|
||||
UInt32 level,
|
||||
bool setMethod,
|
||||
const UString &method,
|
||||
UInt32 dictionary,
|
||||
bool orderMode,
|
||||
UInt32 order,
|
||||
bool solidIsSpecified, UInt64 solidBlockSize,
|
||||
bool multiThreadIsAllowed, UInt32 numThreads,
|
||||
const UString &encryptionMethod,
|
||||
bool encryptHeadersIsAllowed, bool encryptHeaders,
|
||||
bool /* sfxMode */)
|
||||
{
|
||||
if (level != (UInt32)(Int32)-1)
|
||||
AddProp(properties, L"x", (UInt32)level);
|
||||
if (setMethod)
|
||||
{
|
||||
if (!method.IsEmpty())
|
||||
AddProp(properties, is7z ? L"0": L"m", method);
|
||||
if (dictionary != (UInt32)(Int32)-1)
|
||||
{
|
||||
UString name;
|
||||
if (is7z)
|
||||
name = L"0";
|
||||
if (orderMode)
|
||||
name += L"mem";
|
||||
else
|
||||
name += L"d";
|
||||
AddProp(properties, name, GetNumInBytesString(dictionary));
|
||||
}
|
||||
if (order != (UInt32)(Int32)-1)
|
||||
{
|
||||
UString name;
|
||||
if (is7z)
|
||||
name = L"0";
|
||||
if (orderMode)
|
||||
name += L"o";
|
||||
else
|
||||
name += L"fb";
|
||||
AddProp(properties, name, (UInt32)order);
|
||||
}
|
||||
}
|
||||
|
||||
if (!encryptionMethod.IsEmpty())
|
||||
AddProp(properties, L"em", encryptionMethod);
|
||||
|
||||
if (encryptHeadersIsAllowed)
|
||||
AddProp(properties, L"he", encryptHeaders);
|
||||
if (solidIsSpecified)
|
||||
AddProp(properties, L"s", GetNumInBytesString(solidBlockSize));
|
||||
if (multiThreadIsAllowed)
|
||||
AddProp(properties, L"mt", numThreads);
|
||||
}
|
||||
|
||||
struct C_UpdateMode_ToAction_Pair
|
||||
{
|
||||
NCompressDialog::NUpdateMode::EEnum UpdateMode;
|
||||
const NUpdateArchive::CActionSet *ActionSet;
|
||||
};
|
||||
|
||||
static const C_UpdateMode_ToAction_Pair g_UpdateMode_Pairs[] =
|
||||
{
|
||||
{ NCompressDialog::NUpdateMode::kAdd, &NUpdateArchive::k_ActionSet_Add },
|
||||
{ NCompressDialog::NUpdateMode::kUpdate, &NUpdateArchive::k_ActionSet_Update },
|
||||
{ NCompressDialog::NUpdateMode::kFresh, &NUpdateArchive::k_ActionSet_Fresh },
|
||||
{ NCompressDialog::NUpdateMode::kSync, &NUpdateArchive::k_ActionSet_Sync }
|
||||
};
|
||||
|
||||
static int FindActionSet(const NUpdateArchive::CActionSet &actionSet)
|
||||
{
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(g_UpdateMode_Pairs); i++)
|
||||
if (actionSet.IsEqualTo(*g_UpdateMode_Pairs[i].ActionSet))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int FindUpdateMode(NCompressDialog::NUpdateMode::EEnum mode)
|
||||
{
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(g_UpdateMode_Pairs); i++)
|
||||
if (mode == g_UpdateMode_Pairs[i].UpdateMode)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT ShowDialog(
|
||||
CCodecs *codecs,
|
||||
const CObjectVector<NWildcard::CCensorPath> &censor,
|
||||
CUpdateOptions &options,
|
||||
CUpdateCallbackGUI *callback, HWND hwndParent)
|
||||
{
|
||||
if (options.Commands.Size() != 1)
|
||||
throw "It must be one command";
|
||||
/*
|
||||
FString currentDirPrefix;
|
||||
#ifndef UNDER_CE
|
||||
{
|
||||
if (!MyGetCurrentDirectory(currentDirPrefix))
|
||||
return E_FAIL;
|
||||
NName::NormalizeDirPathPrefix(currentDirPrefix);
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
bool oneFile = false;
|
||||
NFind::CFileInfo fileInfo;
|
||||
UString name;
|
||||
|
||||
/*
|
||||
if (censor.Pairs.Size() > 0)
|
||||
{
|
||||
const NWildcard::CPair &pair = censor.Pairs[0];
|
||||
if (pair.Head.IncludeItems.Size() > 0)
|
||||
{
|
||||
const NWildcard::CItem &item = pair.Head.IncludeItems[0];
|
||||
if (item.ForFile)
|
||||
{
|
||||
name = pair.Prefix;
|
||||
FOR_VECTOR (i, item.PathParts)
|
||||
{
|
||||
if (i > 0)
|
||||
name.Add_PathSepar();
|
||||
name += item.PathParts[i];
|
||||
}
|
||||
if (fileInfo.Find(us2fs(name)))
|
||||
{
|
||||
if (censor.Pairs.Size() == 1 && pair.Head.IncludeItems.Size() == 1)
|
||||
oneFile = !fileInfo.IsDir();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (censor.Size() > 0)
|
||||
{
|
||||
const NWildcard::CCensorPath &cp = censor[0];
|
||||
if (cp.Include)
|
||||
{
|
||||
{
|
||||
if (fileInfo.Find(us2fs(cp.Path)))
|
||||
{
|
||||
if (censor.Size() == 1)
|
||||
oneFile = !fileInfo.IsDir();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(_WIN32) && !defined(UNDER_CE)
|
||||
CCurrentDirRestorer curDirRestorer;
|
||||
#endif
|
||||
CCompressDialog dialog;
|
||||
NCompressDialog::CInfo &di = dialog.Info;
|
||||
dialog.ArcFormats = &codecs->Formats;
|
||||
|
||||
if (options.MethodMode.Type_Defined)
|
||||
di.FormatIndex = options.MethodMode.Type.FormatIndex;
|
||||
|
||||
FOR_VECTOR (i, codecs->Formats)
|
||||
{
|
||||
const CArcInfoEx &ai = codecs->Formats[i];
|
||||
if (!ai.UpdateEnabled)
|
||||
continue;
|
||||
if (!oneFile && ai.Flags_KeepName())
|
||||
continue;
|
||||
if ((int)i != di.FormatIndex)
|
||||
if (ai.Name.IsEqualTo_Ascii_NoCase("swfc"))
|
||||
if (!oneFile || name.Len() < 4 || !StringsAreEqualNoCase_Ascii(name.RightPtr(4), ".swf"))
|
||||
continue;
|
||||
dialog.ArcIndices.Add(i);
|
||||
}
|
||||
if (dialog.ArcIndices.IsEmpty())
|
||||
{
|
||||
ShowErrorMessage(L"No Update Engines");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// di.ArchiveName = options.ArchivePath.GetFinalPath();
|
||||
di.ArcPath = options.ArchivePath.GetPathWithoutExt();
|
||||
dialog.OriginalFileName = fs2us(fileInfo.Name);
|
||||
|
||||
di.PathMode = options.PathMode;
|
||||
|
||||
// di.CurrentDirPrefix = currentDirPrefix;
|
||||
di.SFXMode = options.SfxMode;
|
||||
di.OpenShareForWrite = options.OpenShareForWrite;
|
||||
di.DeleteAfterCompressing = options.DeleteAfterCompressing;
|
||||
|
||||
di.SymLinks = options.SymLinks;
|
||||
di.HardLinks = options.HardLinks;
|
||||
di.AltStreams = options.AltStreams;
|
||||
di.NtSecurity = options.NtSecurity;
|
||||
|
||||
if (callback->PasswordIsDefined)
|
||||
di.Password = callback->Password;
|
||||
|
||||
di.KeepName = !oneFile;
|
||||
|
||||
NUpdateArchive::CActionSet &actionSet = options.Commands.Front().ActionSet;
|
||||
|
||||
{
|
||||
int index = FindActionSet(actionSet);
|
||||
if (index < 0)
|
||||
return E_NOTIMPL;
|
||||
di.UpdateMode = g_UpdateMode_Pairs[(unsigned)index].UpdateMode;
|
||||
}
|
||||
|
||||
if (dialog.Create(hwndParent) != IDOK)
|
||||
return E_ABORT;
|
||||
|
||||
options.DeleteAfterCompressing = di.DeleteAfterCompressing;
|
||||
|
||||
options.SymLinks = di.SymLinks;
|
||||
options.HardLinks = di.HardLinks;
|
||||
options.AltStreams = di.AltStreams;
|
||||
options.NtSecurity = di.NtSecurity;
|
||||
|
||||
#if defined(_WIN32) && !defined(UNDER_CE)
|
||||
curDirRestorer.NeedRestore = dialog.CurrentDirWasChanged;
|
||||
#endif
|
||||
|
||||
options.VolumesSizes = di.VolumeSizes;
|
||||
/*
|
||||
if (di.VolumeSizeIsDefined)
|
||||
{
|
||||
MyMessageBox(L"Splitting to volumes is not supported");
|
||||
return E_FAIL;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
{
|
||||
int index = FindUpdateMode(di.UpdateMode);
|
||||
if (index < 0)
|
||||
return E_FAIL;
|
||||
actionSet = *g_UpdateMode_Pairs[index].ActionSet;
|
||||
}
|
||||
|
||||
options.PathMode = di.PathMode;
|
||||
|
||||
const CArcInfoEx &archiverInfo = codecs->Formats[di.FormatIndex];
|
||||
callback->PasswordIsDefined = (!di.Password.IsEmpty());
|
||||
if (callback->PasswordIsDefined)
|
||||
callback->Password = di.Password;
|
||||
|
||||
options.MethodMode.Properties.Clear();
|
||||
|
||||
bool is7z = archiverInfo.Name.IsEqualTo_Ascii_NoCase("7z");
|
||||
bool methodOverride = IsThereMethodOverride(is7z, di.Options);
|
||||
|
||||
SetOutProperties(
|
||||
options.MethodMode.Properties,
|
||||
is7z,
|
||||
di.Level,
|
||||
!methodOverride,
|
||||
di.Method,
|
||||
di.Dictionary,
|
||||
di.OrderMode, di.Order,
|
||||
di.SolidIsSpecified, di.SolidBlockSize,
|
||||
di.MultiThreadIsAllowed, di.NumThreads,
|
||||
di.EncryptionMethod,
|
||||
di.EncryptHeadersIsAllowed, di.EncryptHeaders,
|
||||
di.SFXMode);
|
||||
|
||||
options.OpenShareForWrite = di.OpenShareForWrite;
|
||||
ParseAndAddPropertires(options.MethodMode.Properties, di.Options);
|
||||
|
||||
if (di.SFXMode)
|
||||
options.SfxMode = true;
|
||||
options.MethodMode.Type = COpenType();
|
||||
options.MethodMode.Type_Defined = true;
|
||||
options.MethodMode.Type.FormatIndex = di.FormatIndex;
|
||||
|
||||
options.ArchivePath.VolExtension = archiverInfo.GetMainExt();
|
||||
if (di.SFXMode)
|
||||
options.ArchivePath.BaseExtension = kSFXExtension;
|
||||
else
|
||||
options.ArchivePath.BaseExtension = options.ArchivePath.VolExtension;
|
||||
options.ArchivePath.ParseFromPath(di.ArcPath, k_ArcNameMode_Smart);
|
||||
|
||||
NWorkDir::CInfo workDirInfo;
|
||||
workDirInfo.Load();
|
||||
options.WorkingDir.Empty();
|
||||
if (workDirInfo.Mode != NWorkDir::NMode::kCurrent)
|
||||
{
|
||||
FString fullPath;
|
||||
MyGetFullPathName(us2fs(di.ArcPath), fullPath);
|
||||
FString namePart;
|
||||
options.WorkingDir = GetWorkDir(workDirInfo, fullPath, namePart);
|
||||
CreateComplexDir(options.WorkingDir);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT UpdateGUI(
|
||||
CCodecs *codecs,
|
||||
const CObjectVector<COpenType> &formatIndices,
|
||||
const UString &cmdArcPath,
|
||||
NWildcard::CCensor &censor,
|
||||
CUpdateOptions &options,
|
||||
bool showDialog,
|
||||
bool &messageWasDisplayed,
|
||||
CUpdateCallbackGUI *callback,
|
||||
HWND hwndParent)
|
||||
{
|
||||
messageWasDisplayed = false;
|
||||
bool needSetPath = true;
|
||||
if (showDialog)
|
||||
{
|
||||
RINOK(ShowDialog(codecs, censor.CensorPaths, options, callback, hwndParent));
|
||||
needSetPath = false;
|
||||
}
|
||||
if (options.SfxMode && options.SfxModule.IsEmpty())
|
||||
{
|
||||
FString folder = NWindows::NDLL::GetModuleDirPrefix();
|
||||
options.SfxModule = folder + kDefaultSfxModule;
|
||||
}
|
||||
|
||||
CThreadUpdating tu;
|
||||
|
||||
tu.needSetPath = needSetPath;
|
||||
|
||||
tu.codecs = codecs;
|
||||
tu.formatIndices = &formatIndices;
|
||||
tu.cmdArcPath = &cmdArcPath;
|
||||
|
||||
tu.UpdateCallbackGUI = callback;
|
||||
tu.UpdateCallbackGUI->ProgressDialog = &tu.ProgressDialog;
|
||||
tu.UpdateCallbackGUI->Init();
|
||||
|
||||
UString title = LangString(IDS_PROGRESS_COMPRESSING);
|
||||
|
||||
/*
|
||||
if (hwndParent != 0)
|
||||
{
|
||||
tu.ProgressDialog.MainWindow = hwndParent;
|
||||
// tu.ProgressDialog.MainTitle = fileName;
|
||||
tu.ProgressDialog.MainAddTitle = title + L' ';
|
||||
}
|
||||
*/
|
||||
|
||||
tu.WildcardCensor = &censor;
|
||||
tu.Options = &options;
|
||||
tu.ProgressDialog.IconID = IDI_ICON;
|
||||
|
||||
RINOK(tu.Create(title, hwndParent));
|
||||
|
||||
messageWasDisplayed = tu.ThreadFinishedOK && tu.ProgressDialog.MessagesDisplayed;
|
||||
return tu.Result;
|
||||
}
|
||||
33
CPP/7zip/UI/GUI/UpdateGUI.h
Normal file
33
CPP/7zip/UI/GUI/UpdateGUI.h
Normal file
@@ -0,0 +1,33 @@
|
||||
// GUI/UpdateGUI.h
|
||||
|
||||
#ifndef __UPDATE_GUI_H
|
||||
#define __UPDATE_GUI_H
|
||||
|
||||
#include "../Common/Update.h"
|
||||
|
||||
#include "UpdateCallbackGUI.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 CObjectVector<COpenType> &formatIndices,
|
||||
const UString &cmdArcPath2,
|
||||
NWildcard::CCensor &censor,
|
||||
CUpdateOptions &options,
|
||||
bool showDialog,
|
||||
bool &messageWasDisplayed,
|
||||
CUpdateCallbackGUI *callback,
|
||||
HWND hwndParent = NULL);
|
||||
|
||||
#endif
|
||||
139
CPP/7zip/UI/GUI/makefile
Normal file
139
CPP/7zip/UI/GUI/makefile
Normal file
@@ -0,0 +1,139 @@
|
||||
PROG = 7zG.exe
|
||||
CFLAGS = $(CFLAGS) \
|
||||
-DLANG \
|
||||
-DEXTERNAL_CODECS \
|
||||
|
||||
!IFDEF UNDER_CE
|
||||
LIBS = $(LIBS) ceshell.lib Commctrl.lib
|
||||
!ELSE
|
||||
LIBS = $(LIBS) comctl32.lib htmlhelp.lib comdlg32.lib gdi32.lib
|
||||
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -DSUPPORT_DEVICE_FILE -D_7ZIP_LARGE_PAGES
|
||||
!ENDIF
|
||||
|
||||
GUI_OBJS = \
|
||||
$O\BenchmarkDialog.obj \
|
||||
$O\CompressDialog.obj \
|
||||
$O\ExtractDialog.obj \
|
||||
$O\ExtractGUI.obj \
|
||||
$O\GUI.obj \
|
||||
$O\HashGUI.obj \
|
||||
$O\UpdateCallbackGUI.obj \
|
||||
$O\UpdateCallbackGUI2.obj \
|
||||
$O\UpdateGUI.obj \
|
||||
|
||||
COMMON_OBJS = \
|
||||
$O\CommandLineParser.obj \
|
||||
$O\CRC.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\Lang.obj \
|
||||
$O\ListFileUtils.obj \
|
||||
$O\MyString.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\UTFConvert.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
$O\CommonDialog.obj \
|
||||
$O\DLL.obj \
|
||||
$O\ErrorMsg.obj \
|
||||
$O\FileDir.obj \
|
||||
$O\FileFind.obj \
|
||||
$O\FileIO.obj \
|
||||
$O\FileLink.obj \
|
||||
$O\FileName.obj \
|
||||
$O\FileSystem.obj \
|
||||
$O\MemoryLock.obj \
|
||||
$O\PropVariant.obj \
|
||||
$O\PropVariantConv.obj \
|
||||
$O\Registry.obj \
|
||||
$O\ResourceString.obj \
|
||||
$O\Shell.obj \
|
||||
$O\Synchronization.obj \
|
||||
$O\System.obj \
|
||||
$O\TimeUtils.obj \
|
||||
$O\Window.obj \
|
||||
|
||||
WIN_CTRL_OBJS = \
|
||||
$O\ComboBox.obj \
|
||||
$O\Dialog.obj \
|
||||
$O\ListView.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\CreateCoder.obj \
|
||||
$O\FilePathAutoRename.obj \
|
||||
$O\FileStreams.obj \
|
||||
$O\FilterCoder.obj \
|
||||
$O\LimitedStreams.obj \
|
||||
$O\MethodProps.obj \
|
||||
$O\ProgressUtils.obj \
|
||||
$O\PropId.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\UniqBlocks.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveCommandLine.obj \
|
||||
$O\ArchiveExtractCallback.obj \
|
||||
$O\ArchiveOpenCallback.obj \
|
||||
$O\Bench.obj \
|
||||
$O\DefaultName.obj \
|
||||
$O\EnumDirItems.obj \
|
||||
$O\Extract.obj \
|
||||
$O\ExtractingFilePath.obj \
|
||||
$O\HashCalc.obj \
|
||||
$O\LoadCodecs.obj \
|
||||
$O\OpenArchive.obj \
|
||||
$O\PropIDUtils.obj \
|
||||
$O\SetProperties.obj \
|
||||
$O\SortUtils.obj \
|
||||
$O\TempFiles.obj \
|
||||
$O\Update.obj \
|
||||
$O\UpdateAction.obj \
|
||||
$O\UpdateCallback.obj \
|
||||
$O\UpdatePair.obj \
|
||||
$O\UpdateProduce.obj \
|
||||
$O\WorkDir.obj \
|
||||
$O\ZipRegistry.obj \
|
||||
|
||||
AR_COMMON_OBJS = \
|
||||
$O\OutStreamWithCRC.obj \
|
||||
|
||||
FM_OBJS = \
|
||||
$O\ExtractCallback.obj \
|
||||
$O\FormatUtils.obj \
|
||||
$O\HelpUtils.obj \
|
||||
$O\LangUtils.obj \
|
||||
$O\OpenCallback.obj \
|
||||
$O\ProgramLocation.obj \
|
||||
$O\PropertyName.obj \
|
||||
$O\RegistryUtils.obj \
|
||||
$O\SplitUtils.obj \
|
||||
$O\StringUtils.obj \
|
||||
$O\OverwriteDialog.obj \
|
||||
$O\PasswordDialog.obj \
|
||||
$O\ProgressDialog2.obj \
|
||||
|
||||
FM_OBJS = $(FM_OBJS) \
|
||||
$O\BrowseDialog.obj \
|
||||
$O\ComboDialog.obj \
|
||||
$O\SysIconUtils.obj \
|
||||
|
||||
EXPLORER_OBJS = \
|
||||
$O\MyMessages.obj \
|
||||
|
||||
COMPRESS_OBJS = \
|
||||
$O\CopyCoder.obj \
|
||||
|
||||
C_OBJS = \
|
||||
$O\Alloc.obj \
|
||||
$O\CpuArch.obj \
|
||||
$O\Sort.obj \
|
||||
$O\Threads.obj \
|
||||
|
||||
!include "../../Crc.mak"
|
||||
|
||||
|
||||
!include "../../7zip.mak"
|
||||
23
CPP/7zip/UI/GUI/resource.rc
Normal file
23
CPP/7zip/UI/GUI/resource.rc
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "../../MyVersionInfo.rc"
|
||||
// #include <winnt.h>
|
||||
|
||||
#include "resource2.rc"
|
||||
#include "resource3.rc"
|
||||
|
||||
#include "../FileManager/resourceGui.rc"
|
||||
|
||||
MY_VERSION_INFO(MY_VFT_APP, "7-Zip GUI", "7zg", "7zg.exe")
|
||||
|
||||
IDI_ICON ICON "FM.ico"
|
||||
|
||||
#ifndef UNDER_CE
|
||||
1 24 MOVEABLE PURE "7zG.exe.manifest"
|
||||
#endif
|
||||
|
||||
#include "../FileManager/PropertyName.rc"
|
||||
#include "../FileManager/OverwriteDialog.rc"
|
||||
#include "../FileManager/PasswordDialog.rc"
|
||||
#include "../FileManager/ProgressDialog2.rc"
|
||||
#include "Extract.rc"
|
||||
#include "../FileManager/BrowseDialog.rc"
|
||||
#include "../FileManager/ComboDialog.rc"
|
||||
2
CPP/7zip/UI/GUI/resource2.h
Normal file
2
CPP/7zip/UI/GUI/resource2.h
Normal file
@@ -0,0 +1,2 @@
|
||||
#define IDS_PROGRESS_COMPRESSING 3301
|
||||
#define IDS_ARCHIVES_COLON 3907
|
||||
10
CPP/7zip/UI/GUI/resource2.rc
Normal file
10
CPP/7zip/UI/GUI/resource2.rc
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "ExtractDialog.rc"
|
||||
#include "CompressDialog.rc"
|
||||
#include "BenchmarkDialog.rc"
|
||||
#include "resource2.h"
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_PROGRESS_COMPRESSING "Compressing"
|
||||
IDS_ARCHIVES_COLON "Archives:"
|
||||
END
|
||||
10
CPP/7zip/UI/GUI/resource3.h
Normal file
10
CPP/7zip/UI/GUI/resource3.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#define IDS_PROGRESS_REMOVE 3305
|
||||
|
||||
#define IDS_PROGRESS_ADD 3320
|
||||
#define IDS_PROGRESS_UPDATE 3321
|
||||
#define IDS_PROGRESS_ANALYZE 3322
|
||||
#define IDS_PROGRESS_REPLICATE 3323
|
||||
#define IDS_PROGRESS_REPACK 3324
|
||||
|
||||
#define IDS_PROGRESS_DELETE 3326
|
||||
#define IDS_PROGRESS_HEADER 3327
|
||||
15
CPP/7zip/UI/GUI/resource3.rc
Normal file
15
CPP/7zip/UI/GUI/resource3.rc
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "resource3.h"
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_PROGRESS_REMOVE "Removing"
|
||||
|
||||
IDS_PROGRESS_ADD "Adding"
|
||||
IDS_PROGRESS_UPDATE "Updating"
|
||||
IDS_PROGRESS_ANALYZE "Analyzing"
|
||||
IDS_PROGRESS_REPLICATE "Replicating"
|
||||
IDS_PROGRESS_REPACK "Repacking"
|
||||
|
||||
IDS_PROGRESS_DELETE "Deleting"
|
||||
IDS_PROGRESS_HEADER "Header creating"
|
||||
END
|
||||
Reference in New Issue
Block a user