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

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2007-01-20 03:00:00 +0300
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:49 +0300
commitd9666cf046a8453b33b3e2fbf4d82295a9f87df3 (patch)
treec722ed19b844b53042aec0c1d7d2f8381140a5ed /CPP/7zip/FileManager/Resource
parent804edc5756fede54dbb1aefda6d39d306111938d (diff)
4.44 beta
Diffstat (limited to 'CPP/7zip/FileManager/Resource')
-rwxr-xr-xCPP/7zip/FileManager/Resource/AboutDialog/7zipLogo.icobin0 -> 9150 bytes
-rwxr-xr-xCPP/7zip/FileManager/Resource/AboutDialog/AboutDialog.cpp60
-rwxr-xr-xCPP/7zip/FileManager/Resource/AboutDialog/AboutDialog.h18
-rwxr-xr-xCPP/7zip/FileManager/Resource/AboutDialog/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/AboutDialog/resource.h6
-rwxr-xr-xCPP/7zip/FileManager/Resource/AboutDialog/resource.rc41
-rwxr-xr-xCPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp976
-rwxr-xr-xCPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.h136
-rwxr-xr-xCPP/7zip/FileManager/Resource/BenchmarkDialog/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/BenchmarkDialog/resource.h34
-rwxr-xr-xCPP/7zip/FileManager/Resource/BenchmarkDialog/resource.rc87
-rwxr-xr-xCPP/7zip/FileManager/Resource/ComboDialog/ComboDialog.cpp53
-rwxr-xr-xCPP/7zip/FileManager/Resource/ComboDialog/ComboDialog.h25
-rwxr-xr-xCPP/7zip/FileManager/Resource/ComboDialog/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/ComboDialog/resource.h4
-rwxr-xr-xCPP/7zip/FileManager/Resource/ComboDialog/resource.rc24
-rwxr-xr-xCPP/7zip/FileManager/Resource/CopyDialog/CopyDialog.cpp81
-rwxr-xr-xCPP/7zip/FileManager/Resource/CopyDialog/CopyDialog.h26
-rwxr-xr-xCPP/7zip/FileManager/Resource/CopyDialog/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/CopyDialog/resource.h7
-rwxr-xr-xCPP/7zip/FileManager/Resource/CopyDialog/resource.rc28
-rwxr-xr-xCPP/7zip/FileManager/Resource/EditPage/EditPage.cpp91
-rwxr-xr-xCPP/7zip/FileManager/Resource/EditPage/EditPage.h21
-rwxr-xr-xCPP/7zip/FileManager/Resource/EditPage/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/EditPage/resource.h4
-rwxr-xr-xCPP/7zip/FileManager/Resource/EditPage/resource.rc16
-rwxr-xr-xCPP/7zip/FileManager/Resource/LangPage/LangPage.cpp90
-rwxr-xr-xCPP/7zip/FileManager/Resource/LangPage/LangPage.h21
-rwxr-xr-xCPP/7zip/FileManager/Resource/LangPage/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/LangPage/resource.h6
-rwxr-xr-xCPP/7zip/FileManager/Resource/LangPage/resource.rc21
-rwxr-xr-xCPP/7zip/FileManager/Resource/ListBoxDialog/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/ListBoxDialog/resource.h3
-rwxr-xr-xCPP/7zip/FileManager/Resource/ListBoxDialog/resource.rc22
-rwxr-xr-xCPP/7zip/FileManager/Resource/ListViewDialog/ListViewDialog.cpp102
-rwxr-xr-xCPP/7zip/FileManager/Resource/ListViewDialog/ListViewDialog.h30
-rwxr-xr-xCPP/7zip/FileManager/Resource/ListViewDialog/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/ListViewDialog/resource.h3
-rwxr-xr-xCPP/7zip/FileManager/Resource/ListViewDialog/resource.rc26
-rwxr-xr-xCPP/7zip/FileManager/Resource/MessagesDialog/MessagesDialog.cpp100
-rwxr-xr-xCPP/7zip/FileManager/Resource/MessagesDialog/MessagesDialog.h22
-rwxr-xr-xCPP/7zip/FileManager/Resource/MessagesDialog/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/MessagesDialog/resource.h3
-rwxr-xr-xCPP/7zip/FileManager/Resource/MessagesDialog/resource.rc25
-rwxr-xr-xCPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.cpp124
-rwxr-xr-xCPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.h34
-rwxr-xr-xCPP/7zip/FileManager/Resource/OverwriteDialog/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/OverwriteDialog/resource.h19
-rwxr-xr-xCPP/7zip/FileManager/Resource/OverwriteDialog/resource.rc47
-rwxr-xr-xCPP/7zip/FileManager/Resource/PasswordDialog/PasswordDialog.cpp50
-rwxr-xr-xCPP/7zip/FileManager/Resource/PasswordDialog/PasswordDialog.h21
-rwxr-xr-xCPP/7zip/FileManager/Resource/PasswordDialog/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/PasswordDialog/resource.h4
-rwxr-xr-xCPP/7zip/FileManager/Resource/PasswordDialog/resource.rc26
-rwxr-xr-xCPP/7zip/FileManager/Resource/PluginsPage/PluginsPage.cpp220
-rwxr-xr-xCPP/7zip/FileManager/Resource/PluginsPage/PluginsPage.h26
-rwxr-xr-xCPP/7zip/FileManager/Resource/PluginsPage/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/PluginsPage/resource.h4
-rwxr-xr-xCPP/7zip/FileManager/Resource/PluginsPage/resource.rc19
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp175
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.h129
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog/resource.h3
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog/resource.rc20
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.cpp432
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.h184
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog2/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog2/resource.h17
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog2/resource.rc56
-rwxr-xr-xCPP/7zip/FileManager/Resource/PropertyName/resource.h28
-rwxr-xr-xCPP/7zip/FileManager/Resource/PropertyName/resource.rc35
-rwxr-xr-xCPP/7zip/FileManager/Resource/SettingsPage/SettingsPage.cpp113
-rwxr-xr-xCPP/7zip/FileManager/Resource/SettingsPage/SettingsPage.h19
-rwxr-xr-xCPP/7zip/FileManager/Resource/SettingsPage/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/SettingsPage/resource.h11
-rwxr-xr-xCPP/7zip/FileManager/Resource/SettingsPage/resource.rc35
-rwxr-xr-xCPP/7zip/FileManager/Resource/SplitDialog/SplitDialog.cpp89
-rwxr-xr-xCPP/7zip/FileManager/Resource/SplitDialog/SplitDialog.h27
-rwxr-xr-xCPP/7zip/FileManager/Resource/SplitDialog/StdAfx.h18
-rwxr-xr-xCPP/7zip/FileManager/Resource/SplitDialog/resource.h8
-rwxr-xr-xCPP/7zip/FileManager/Resource/SplitDialog/resource.rc32
-rwxr-xr-xCPP/7zip/FileManager/Resource/SystemPage/StdAfx.h16
-rwxr-xr-xCPP/7zip/FileManager/Resource/SystemPage/SystemPage.cpp435
-rwxr-xr-xCPP/7zip/FileManager/Resource/SystemPage/SystemPage.h40
-rwxr-xr-xCPP/7zip/FileManager/Resource/SystemPage/resource.h7
-rwxr-xr-xCPP/7zip/FileManager/Resource/SystemPage/resource.rc31
86 files changed, 5006 insertions, 0 deletions
diff --git a/CPP/7zip/FileManager/Resource/AboutDialog/7zipLogo.ico b/CPP/7zip/FileManager/Resource/AboutDialog/7zipLogo.ico
new file mode 100755
index 00000000..973241c8
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/AboutDialog/7zipLogo.ico
Binary files differ
diff --git a/CPP/7zip/FileManager/Resource/AboutDialog/AboutDialog.cpp b/CPP/7zip/FileManager/Resource/AboutDialog/AboutDialog.cpp
new file mode 100755
index 00000000..e4dd2313
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/AboutDialog/AboutDialog.cpp
@@ -0,0 +1,60 @@
+// AboutDialog.cpp
+
+#include "StdAfx.h"
+
+#include "resource.h"
+#include "AboutDialog.h"
+#include "../../HelpUtils.h"
+#include "../../LangUtils.h"
+
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_ABOUT_STATIC_REGISTER_INFO, 0x01000103 },
+ { IDC_ABOUT_BUTTON_SUPPORT, 0x01000104 },
+ { IDC_ABOUT_BUTTON_REGISTER, 0x01000105 },
+ { IDOK, 0x02000702 }
+};
+
+#define MY_HOME_PAGE TEXT("http://www.7-zip.org/")
+
+static LPCTSTR kHomePageURL = MY_HOME_PAGE;
+static LPCTSTR kRegisterPageURL = MY_HOME_PAGE TEXT("register.html");
+static LPCTSTR kSupportPageURL = MY_HOME_PAGE TEXT("support.html");
+
+static LPCWSTR kHelpTopic = L"start.htm";
+
+bool CAboutDialog::OnInit()
+{
+ LangSetWindowText(HWND(*this), 0x01000100);
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ return CModalDialog::OnInit();
+}
+
+void CAboutDialog::OnHelp()
+{
+ ShowHelpWindow(NULL, kHelpTopic);
+}
+
+static void MyShellExecute(LPCTSTR url)
+{
+ ::ShellExecute(NULL, NULL, url, NULL, NULL, SW_SHOWNORMAL);
+}
+
+bool CAboutDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ case IDC_ABOUT_BUTTON_HOMEPAGE:
+ ::MyShellExecute(kHomePageURL);
+ break;
+ case IDC_ABOUT_BUTTON_REGISTER:
+ ::MyShellExecute(kRegisterPageURL);
+ break;
+ case IDC_ABOUT_BUTTON_SUPPORT:
+ ::MyShellExecute(kSupportPageURL);
+ break;
+ default:
+ return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
+ }
+ return true;
+}
diff --git a/CPP/7zip/FileManager/Resource/AboutDialog/AboutDialog.h b/CPP/7zip/FileManager/Resource/AboutDialog/AboutDialog.h
new file mode 100755
index 00000000..278d7c82
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/AboutDialog/AboutDialog.h
@@ -0,0 +1,18 @@
+// AboutDialog.h
+
+#ifndef __ABOUTDIALOG_H
+#define __ABOUTDIALOG_H
+
+#include "resource.h"
+#include "Windows/Control/Dialog.h"
+
+class CAboutDialog: public NWindows::NControl::CModalDialog
+{
+public:
+ virtual bool OnInit();
+ virtual void OnHelp();
+ virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
+ INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_ABOUT, wndParent); }
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/AboutDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/AboutDialog/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/AboutDialog/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/AboutDialog/resource.h b/CPP/7zip/FileManager/Resource/AboutDialog/resource.h
new file mode 100755
index 00000000..54475484
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/AboutDialog/resource.h
@@ -0,0 +1,6 @@
+#define IDD_ABOUT 100
+#define IDI_LOGO 138
+#define IDC_ABOUT_STATIC_REGISTER_INFO 1010
+#define IDC_ABOUT_BUTTON_HOMEPAGE 1020
+#define IDC_ABOUT_BUTTON_SUPPORT 1021
+#define IDC_ABOUT_BUTTON_REGISTER 1022
diff --git a/CPP/7zip/FileManager/Resource/AboutDialog/resource.rc b/CPP/7zip/FileManager/Resource/AboutDialog/resource.rc
new file mode 100755
index 00000000..b93fdd41
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/AboutDialog/resource.rc
@@ -0,0 +1,41 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+#include "../../../MyVersion.h"
+
+#define xSize2 224
+#define ySize2 158
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#define bXPos (xSize - marg - bXSize)
+#define bYPos (ySize - marg - bYSize)
+
+#undef b2XSize
+#undef b2XPos
+#undef infoYPos
+#undef infoYSize
+
+#define b2XSize 94
+#define b2XPos (xSize - marg - b2XSize)
+#define gSpace 2
+#define gSize (xSize2 - gSpace - b2XSize)
+
+#define infoYPos 91
+#define infoYSize (ySize2 - infoYPos - bYSize - 2)
+
+IDI_LOGO ICON "7zipLogo.ico"
+
+IDD_ABOUT DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
+CAPTION "About 7-Zip"
+MY_FONT
+BEGIN
+ PUSHBUTTON "OK", IDOK, bXPos, bYPos, bXSize, bYSize
+ PUSHBUTTON "www.7-zip.org", IDC_ABOUT_BUTTON_HOMEPAGE, b2XPos, 7, b2XSize, bYSize
+ PUSHBUTTON "Support", IDC_ABOUT_BUTTON_SUPPORT, b2XPos, 30, b2XSize, bYSize
+ PUSHBUTTON "Register", IDC_ABOUT_BUTTON_REGISTER, b2XPos, 53, b2XSize, bYSize
+ ICON IDI_LOGO, -1, marg, marg, 20, 20, SS_REALSIZEIMAGE
+ LTEXT MY_7ZIP_VERSION, -1, marg, 54, gSize, 9
+ LTEXT MY_COPYRIGHT, -1, marg, 67, gSize, 17
+ LTEXT "7-Zip is free software. However, you can support development of 7-Zip by registering.",
+ IDC_ABOUT_STATIC_REGISTER_INFO, marg, infoYPos, xSize2, infoYSize
+END
diff --git a/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp b/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp
new file mode 100755
index 00000000..1083fc4c
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp
@@ -0,0 +1,976 @@
+// BenchmarkDialog.cpp
+
+#include "StdAfx.h"
+
+#include "Common/IntToString.h"
+#include "Common/StringToInt.h"
+#include "Common/Exception.h"
+#include "Common/Alloc.h"
+#include "Windows/Thread.h"
+#include "Windows/PropVariant.h"
+#include "Windows/Error.h"
+#include "Windows/DLL.h"
+#include "Windows/FileFind.h"
+#include "../../ProgramLocation.h"
+#include "../../HelpUtils.h"
+#include "../../../Common/StreamObjects.h"
+#include "resource.h"
+#include "BenchmarkDialog.h"
+#include "Common/CRC.h"
+
+using namespace NWindows;
+
+static LPCWSTR kHelpTopic = L"fm/benchmark.htm";
+
+static const UINT_PTR kTimerID = 4;
+static const UINT kTimerElapse = 1000;
+
+static const UInt32 kAdditionalSize = (6 << 20);
+static const UInt32 kCompressedAdditionalSize = (1 << 10);
+static const int kSubBits = 8;
+
+#ifdef LANG
+#include "../../LangUtils.h"
+#endif
+
+using namespace NWindows;
+
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_BENCHMARK_DICTIONARY, 0x02000D0C },
+ { IDC_BENCHMARK_MEMORY, 0x03080001 },
+ { IDC_BENCHMARK_MULTITHREADING, 0x02000D09 },
+ { IDC_BENCHMARK_SPEED_LABEL, 0x03080004 },
+ { IDC_BENCHMARK_RATING_LABEL, 0x03080005 },
+ { IDC_BENCHMARK_COMPRESSING, 0x03080002 },
+ { IDC_BENCHMARK_DECOMPRESSING, 0x03080003 },
+ { IDC_BENCHMARK_CURRENT, 0x03080007 },
+ { IDC_BENCHMARK_RESULTING, 0x03080008 },
+ { IDC_BENCHMARK_CURRENT2, 0x03080007 },
+ { IDC_BENCHMARK_RESULTING2, 0x03080008 },
+ { IDC_BENCHMARK_TOTAL_RATING, 0x03080006 },
+ { IDC_BENCHMARK_ELAPSED, 0x02000C01 },
+ { IDC_BENCHMARK_SIZE, 0x02000C03 },
+ { IDC_BENCHMARK_PASSES, 0x03080009 },
+ { IDC_BENCHMARK_ERRORS, 0x0308000A },
+ { IDC_BUTTON_STOP, 0x02000714 },
+ { IDC_BUTTON_RESTART, 0x02000715 },
+ { IDHELP, 0x02000720 },
+ { IDCANCEL, 0x02000710 }
+};
+#endif
+
+static void MyMessageBoxError(HWND hwnd, LPCWSTR message)
+{
+ MessageBoxW(hwnd, message, L"7-Zip", MB_ICONERROR);
+}
+
+UInt64 GetTimeCount()
+{
+ return GetTickCount();
+ /*
+ LARGE_INTEGER value;
+ if (::QueryPerformanceCounter(&value))
+ return value.QuadPart;
+ return GetTickCount();
+ */
+}
+
+UInt64 GetFreq()
+{
+ return 1000;
+ /*
+ LARGE_INTEGER value;
+ if (::QueryPerformanceFrequency(&value))
+ return value.QuadPart;
+ return 1000;
+ */
+}
+
+class CRandomGenerator
+{
+ UInt32 A1;
+ UInt32 A2;
+public:
+ CRandomGenerator() { Init(); }
+ void Init() { A1 = 362436069; A2 = 521288629;}
+ UInt32 GetRnd()
+ {
+ return
+ ((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) ^
+ ((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) );
+ }
+};
+
+class CBitRandomGenerator
+{
+ CRandomGenerator RG;
+ UInt32 Value;
+ int NumBits;
+public:
+ void Init()
+ {
+ Value = 0;
+ NumBits = 0;
+ }
+ UInt32 GetRnd(int numBits)
+ {
+ if (NumBits > numBits)
+ {
+ UInt32 result = Value & ((1 << numBits) - 1);
+ Value >>= numBits;
+ NumBits -= numBits;
+ return result;
+ }
+ numBits -= NumBits;
+ UInt32 result = (Value << numBits);
+ Value = RG.GetRnd();
+ result |= Value & ((1 << numBits) - 1);
+ Value >>= numBits;
+ NumBits = 32 - numBits;
+ return result;
+ }
+};
+
+class CBenchRandomGenerator
+{
+ CBitRandomGenerator RG;
+ UInt32 Pos;
+ UInt32 Rep0;
+public:
+ UInt32 BufferSize;
+ Byte *Buffer;
+ CBenchRandomGenerator(): Buffer(0) {}
+ ~CBenchRandomGenerator() { Free(); }
+ void Free()
+ {
+ ::MidFree(Buffer);
+ Buffer = 0;
+ }
+ bool Alloc(UInt32 bufferSize)
+ {
+ if (Buffer != 0 && BufferSize == bufferSize)
+ return true;
+ Free();
+ Buffer = (Byte *)::MidAlloc(bufferSize);
+ Pos = 0;
+ BufferSize = bufferSize;
+ return (Buffer != 0);
+ }
+ UInt32 GetRndBit() { return RG.GetRnd(1); }
+ /*
+ UInt32 GetLogRand(int maxLen)
+ {
+ UInt32 len = GetRnd() % (maxLen + 1);
+ return GetRnd() & ((1 << len) - 1);
+ }
+ */
+ UInt32 GetLogRandBits(int numBits)
+ {
+ UInt32 len = RG.GetRnd(numBits);
+ return RG.GetRnd(len);
+ }
+ UInt32 GetOffset()
+ {
+ if (GetRndBit() == 0)
+ return GetLogRandBits(4);
+ return (GetLogRandBits(4) << 10) | RG.GetRnd(10);
+ }
+ UInt32 GetLen1() { return RG.GetRnd(1 + RG.GetRnd(2)); }
+ UInt32 GetLen2() { return RG.GetRnd(2 + RG.GetRnd(2)); }
+ void Generate()
+ {
+ RG.Init();
+ Rep0 = 1;
+ while(Pos < BufferSize)
+ {
+ if (GetRndBit() == 0 || Pos < 1)
+ Buffer[Pos++] = Byte(RG.GetRnd(8));
+ else
+ {
+ UInt32 len;
+ if (RG.GetRnd(3) == 0)
+ len = 1 + GetLen1();
+ else
+ {
+ do
+ Rep0 = GetOffset();
+ while (Rep0 >= Pos);
+ Rep0++;
+ len = 2 + GetLen2();
+ }
+ for (UInt32 i = 0; i < len && Pos < BufferSize; i++, Pos++)
+ Buffer[Pos] = Buffer[Pos - Rep0];
+ }
+ }
+ }
+};
+
+const LPCTSTR kProcessingString = TEXT("...");
+const LPCTSTR kMB = TEXT(" MB");
+const LPCTSTR kMIPS = TEXT(" MIPS");
+const LPCTSTR kKBs = TEXT(" KB/s");
+
+bool CBenchmarkDialog::OnInit()
+{
+ #ifdef LANG
+ LangSetWindowText(HWND(*this), 0x03080000);
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+
+ m_Dictionary.Attach(GetItem(IDC_BENCHMARK_COMBO_DICTIONARY));
+ for (int i = kNumBenchDictionaryBitsStart; i <= 30; i++)
+ for (int j = 0; j < 2; j++)
+ {
+ UInt32 dictionary = (1 << i) + (j << (i - 1));
+ if(dictionary >
+ #ifdef _WIN64
+ (1 << 30)
+ #else
+ (1 << 27)
+ #endif
+ )
+ continue;
+ TCHAR s[40];
+ ConvertUInt64ToString((dictionary >> 20), s);
+ lstrcat(s, kMB);
+ int index = (int)m_Dictionary.AddString(s);
+ m_Dictionary.SetItemData(index, dictionary);
+ }
+ m_Dictionary.SetCurSel(0);
+ OnChangeSettings();
+
+ _syncInfo.Init();
+ _syncInfo.InitSettings();
+
+ _syncInfo._startEvent.Set();
+ _timer = SetTimer(kTimerID, kTimerElapse);
+ return CModalDialog::OnInit();
+}
+
+static UInt64 GetLZMAUsage(UInt32 dictionary)
+{
+ UInt32 hs = dictionary - 1;
+ hs |= (hs >> 1);
+ hs |= (hs >> 2);
+ hs |= (hs >> 4);
+ hs |= (hs >> 8);
+ hs >>= 1;
+ hs |= 0xFFFF;
+ if (hs > (1 << 24))
+ hs >>= 1;
+ hs++;
+ return ((hs + (1 << 16)) + (UInt64)dictionary * 2) * 4 + (UInt64)dictionary * 3 / 2 + (1 << 20);
+}
+
+static UInt64 GetMemoryUsage(UInt32 dictionary, bool mtMode)
+{
+ const UInt32 kBufferSize = dictionary + kAdditionalSize;
+ const UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize;
+ return (mtMode ? (6 << 20) : 0 )+ kBufferSize + kCompressedBufferSize +
+ GetLZMAUsage(dictionary) + dictionary + (2 << 20);
+}
+
+UInt32 CBenchmarkDialog::OnChangeDictionary()
+{
+ UInt32 dictionary = (UInt32)m_Dictionary.GetItemData(m_Dictionary.GetCurSel());
+ UInt64 memUsage = GetMemoryUsage(dictionary, IsButtonCheckedBool(IDC_BENCHMARK_MULTITHREADING));
+ memUsage = (memUsage + (1 << 20) - 1) >> 20;
+ TCHAR s[40];
+ ConvertUInt64ToString(memUsage, s);
+ lstrcat(s, kMB);
+ SetItemText(IDC_BENCHMARK_MEMORY_VALUE, s);
+ return dictionary;
+}
+
+void CBenchmarkDialog::OnChangeSettings()
+{
+ EnableItem(IDC_BUTTON_STOP, true);
+ UInt32 dictionary = OnChangeDictionary();
+ SetItemText(IDC_BENCHMARK_COMPRESSING_SPEED, kProcessingString);
+ SetItemText(IDC_BENCHMARK_COMPRESSING_SPEED2, kProcessingString);
+ SetItemText(IDC_BENCHMARK_COMPRESSING_RATING, kProcessingString);
+ SetItemText(IDC_BENCHMARK_COMPRESSING_RATING2, kProcessingString);
+ SetItemText(IDC_BENCHMARK_DECOMPRESSING_SPEED, kProcessingString);
+ SetItemText(IDC_BENCHMARK_DECOMPRESSING_SPEED2, kProcessingString);
+ SetItemText(IDC_BENCHMARK_DECOMPRESSING_RATING, kProcessingString);
+ SetItemText(IDC_BENCHMARK_DECOMPRESSING_RATING2, kProcessingString);
+ SetItemText(IDC_BENCHMARK_TOTAL_RATING_VALUE, kProcessingString);
+ _startTime = GetTickCount();
+ PrintTime();
+ NWindows::NSynchronization::CCriticalSectionLock lock(_syncInfo.CS);
+ _syncInfo.Init();
+ _syncInfo.DictionarySize = dictionary;
+ _syncInfo.Changed = true;
+ _syncInfo.MultiThread = IsButtonCheckedBool(IDC_BENCHMARK_MULTITHREADING);
+}
+
+void CBenchmarkDialog::OnRestartButton()
+{
+ OnChangeSettings();
+}
+
+void CBenchmarkDialog::OnStopButton()
+{
+ EnableItem(IDC_BUTTON_STOP, false);
+ _syncInfo.Pause();
+}
+
+void CBenchmarkDialog::OnHelp()
+{
+ ShowHelpWindow(NULL, kHelpTopic);
+}
+
+void CBenchmarkDialog::OnCancel()
+{
+ _syncInfo.Stop();
+ KillTimer(_timer);
+ CModalDialog::OnCancel();
+}
+
+static void GetTimeString(UInt64 timeValue, TCHAR *s)
+{
+ wsprintf(s, TEXT("%02d:%02d:%02d"),
+ UInt32(timeValue / 3600),
+ UInt32((timeValue / 60) % 60),
+ UInt32(timeValue % 60));
+}
+
+void CBenchmarkDialog::PrintTime()
+{
+ UInt32 curTime = ::GetTickCount();
+ UInt32 elapsedTime = (curTime - _startTime);
+ UInt32 elapsedSec = elapsedTime / 1000;
+ TCHAR s[40];
+ GetTimeString(elapsedSec, s);
+ SetItemText(IDC_BENCHMARK_ELAPSED_VALUE, s);
+}
+
+static UInt32 GetLogSize(UInt32 size)
+{
+ for (int i = kSubBits; i < 32; i++)
+ for (UInt32 j = 0; j < (1 << kSubBits); j++)
+ if (size <= (((UInt32)1) << i) + (j << (i - kSubBits)))
+ return (i << kSubBits) + j;
+ return (32 << kSubBits);
+}
+
+static UInt64 GetCompressRating(UInt32 dictionarySize,
+ UInt64 elapsedTime, UInt64 size)
+{
+ if (elapsedTime == 0)
+ elapsedTime = 1;
+ UInt64 t = GetLogSize(dictionarySize) - (18 << kSubBits);
+ UInt64 numCommandsForOne = 1060 + ((t * t * 10) >> (2 * kSubBits));
+ UInt64 numCommands = (UInt64)(size) * numCommandsForOne;
+ return numCommands * GetFreq() / elapsedTime;
+}
+
+static UInt64 GetDecompressRating(UInt64 elapsedTime,
+ UInt64 outSize, UInt64 inSize)
+{
+ if (elapsedTime == 0)
+ elapsedTime = 1;
+ UInt64 numCommands = inSize * 220 + outSize * 20;
+ return numCommands * GetFreq() / elapsedTime;
+}
+
+static UInt64 GetTotalRating(
+ UInt32 dictionarySize,
+ UInt64 elapsedTimeEn, UInt64 sizeEn,
+ UInt64 elapsedTimeDe,
+ UInt64 inSizeDe, UInt64 outSizeDe)
+{
+ return (GetCompressRating(dictionarySize, elapsedTimeEn, sizeEn) +
+ GetDecompressRating(elapsedTimeDe, inSizeDe, outSizeDe)) / 2;
+}
+
+void CBenchmarkDialog::PrintRating(UInt64 rating, UINT controlID)
+{
+ TCHAR s[40];
+ ConvertUInt64ToString(rating / 1000000, s);
+ lstrcat(s, kMIPS);
+ SetItemText(controlID, s);
+}
+
+void CBenchmarkDialog::PrintResults(
+ UInt32 dictionarySize,
+ UInt64 elapsedTime,
+ UInt64 size, UINT speedID, UINT ratingID,
+ bool decompressMode, UInt64 secondSize)
+{
+ TCHAR s[40];
+ UInt64 speed = size * GetFreq() / elapsedTime;
+ ConvertUInt64ToString(speed / 1024, s);
+ lstrcat(s, kKBs);
+ SetItemText(speedID, s);
+ UInt64 rating;
+ if (decompressMode)
+ rating = GetDecompressRating(elapsedTime, size, secondSize);
+ else
+ rating = GetCompressRating(dictionarySize, elapsedTime, size);
+ PrintRating(rating, ratingID);
+}
+
+bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
+{
+ PrintTime();
+ NWindows::NSynchronization::CCriticalSectionLock lock(_syncInfo.CS);
+
+ TCHAR s[40];
+ ConvertUInt64ToString((_syncInfo.ProcessedSize >> 20), s);
+ lstrcat(s, kMB);
+ SetItemText(IDC_BENCHMARK_SIZE_VALUE, s);
+
+ ConvertUInt64ToString(_syncInfo.NumPasses, s);
+ SetItemText(IDC_BENCHMARK_PASSES_VALUE, s);
+
+ ConvertUInt64ToString(_syncInfo.NumErrors, s);
+ SetItemText(IDC_BENCHMARK_ERRORS_VALUE, s);
+
+ UInt64 elapsedTime = _syncInfo.CompressingInfoTemp.Time;
+ if (elapsedTime >= 1)
+ {
+ UInt32 dicSizeTemp = (UInt32)MyMax(_syncInfo.ProcessedSize, UInt64(1) << 20);
+ dicSizeTemp = MyMin(dicSizeTemp, _syncInfo.DictionarySize),
+ PrintResults(dicSizeTemp, elapsedTime,
+ _syncInfo.CompressingInfoTemp.InSize,
+ IDC_BENCHMARK_COMPRESSING_SPEED,
+ IDC_BENCHMARK_COMPRESSING_RATING);
+ }
+
+ if (_syncInfo.CompressingInfo.Time >= 1)
+ {
+ PrintResults(
+ _syncInfo.DictionarySize,
+ _syncInfo.CompressingInfo.Time,
+ _syncInfo.CompressingInfo.InSize,
+ IDC_BENCHMARK_COMPRESSING_SPEED2,
+ IDC_BENCHMARK_COMPRESSING_RATING2);
+ }
+
+ if (_syncInfo.DecompressingInfoTemp.Time >= 1)
+ {
+ PrintResults(
+ _syncInfo.DictionarySize,
+ _syncInfo.DecompressingInfoTemp.Time,
+ _syncInfo.DecompressingInfoTemp.OutSize,
+ IDC_BENCHMARK_DECOMPRESSING_SPEED,
+ IDC_BENCHMARK_DECOMPRESSING_RATING,
+ true,
+ _syncInfo.DecompressingInfoTemp.InSize);
+ }
+ if (_syncInfo.DecompressingInfo.Time >= 1)
+ {
+ PrintResults(
+ _syncInfo.DictionarySize,
+ _syncInfo.DecompressingInfo.Time,
+ _syncInfo.DecompressingInfo.OutSize,
+ IDC_BENCHMARK_DECOMPRESSING_SPEED2,
+ IDC_BENCHMARK_DECOMPRESSING_RATING2,
+ true,
+ _syncInfo.DecompressingInfo.InSize);
+ if (_syncInfo.CompressingInfo.Time >= 1)
+ {
+ PrintRating(GetTotalRating(
+ _syncInfo.DictionarySize,
+ _syncInfo.CompressingInfo.Time,
+ _syncInfo.CompressingInfo.InSize,
+ _syncInfo.DecompressingInfo.Time,
+ _syncInfo.DecompressingInfo.OutSize,
+ _syncInfo.DecompressingInfo.InSize),
+ IDC_BENCHMARK_TOTAL_RATING_VALUE);
+ }
+ }
+ return true;
+}
+
+bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
+{
+ if (code == CBN_SELCHANGE && itemID == IDC_BENCHMARK_COMBO_DICTIONARY)
+ {
+ OnChangeSettings();
+ return true;
+ }
+ return CModalDialog::OnCommand(code, itemID, lParam);
+}
+
+bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ case IDC_BUTTON_RESTART:
+ OnRestartButton();
+ return true;
+ case IDC_BUTTON_STOP:
+ OnStopButton();
+ return true;
+ case IDC_BENCHMARK_MULTITHREADING:
+ OnChangeSettings();
+ return true;
+ }
+ return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
+}
+
+class CBenchmarkInStream:
+ public ISequentialInStream,
+ public CMyUnknownImp
+{
+ const Byte *Data;
+ UInt32 Pos;
+ UInt32 Size;
+public:
+ MY_UNKNOWN_IMP
+ void Init(const Byte *data, UInt32 size)
+ {
+ Data = data;
+ Size = size;
+ Pos = 0;
+ }
+ STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
+};
+
+STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
+{
+ UInt32 remain = Size - Pos;
+ if (size > remain)
+ size = remain;
+ for (UInt32 i = 0; i < size; i++)
+ {
+ ((Byte *)data)[i] = Data[Pos + i];
+ }
+ Pos += size;
+ if(processedSize != NULL)
+ *processedSize = size;
+ return S_OK;
+}
+
+class CBenchmarkOutStream:
+ public ISequentialOutStream,
+ public CMyUnknownImp
+{
+ UInt32 BufferSize;
+public:
+ UInt32 Pos;
+ Byte *Buffer;
+ CBenchmarkOutStream(): Buffer(0) {}
+ ~CBenchmarkOutStream() { Free(); }
+ void Free()
+ {
+ ::MidFree(Buffer);
+ Buffer = 0;
+ }
+
+ bool Alloc(UInt32 bufferSize)
+ {
+ if (Buffer != 0 && BufferSize == bufferSize)
+ return true;
+ Free();
+ Buffer = (Byte *)::MidAlloc(bufferSize);
+ Init();
+ BufferSize = bufferSize;
+ return (Buffer != 0);
+ }
+
+ void Init()
+ {
+ Pos = 0;
+ }
+
+ MY_UNKNOWN_IMP
+ STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
+};
+
+STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
+{
+ UInt32 i;
+ for (i = 0; i < size && Pos < BufferSize; i++)
+ Buffer[Pos++] = ((const Byte *)data)[i];
+ if(processedSize != NULL)
+ *processedSize = i;
+ if (i != size)
+ {
+ MessageBoxW(0, L"Buffer is full", L"7-zip error", 0);
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+class CCompareOutStream:
+ public ISequentialOutStream,
+ public CMyUnknownImp
+{
+public:
+ CCRC CRC;
+ MY_UNKNOWN_IMP
+ void Init() { CRC.Init(); }
+ STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
+};
+
+STDMETHODIMP CCompareOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
+{
+ CRC.Update(data, size);
+ if(processedSize != NULL)
+ *processedSize = size;
+ return S_OK;
+}
+
+typedef UInt32 (WINAPI * CreateObjectPointer)(const GUID *clsID,
+ const GUID *interfaceID, void **outObject);
+
+struct CDecoderProgressInfo:
+ public ICompressProgressInfo,
+ public CMyUnknownImp
+{
+ CProgressSyncInfo *SyncInfo;
+ MY_UNKNOWN_IMP
+ STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
+};
+
+STDMETHODIMP CDecoderProgressInfo::SetRatioInfo(
+ const UInt64 * /* inSize */, const UInt64 * /* outSize */)
+{
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ if (SyncInfo->Changed)
+ return E_ABORT;
+ return S_OK;
+}
+
+struct CThreadBenchmark:
+ public ICompressProgressInfo,
+ public CMyUnknownImp
+{
+ CProgressSyncInfo *SyncInfo;
+ UInt64 _startTime;
+ UInt64 _approvedStart;
+ NDLL::CLibrary Library;
+ CMyComPtr<ICompressCoder> Encoder;
+ CMyComPtr<ICompressCoder> Decoder;
+ HRESULT Process();
+ HRESULT Result;
+ static DWORD WINAPI MyThreadFunction(void *param)
+ {
+ ((CThreadBenchmark *)param)->Result = ((CThreadBenchmark *)param)->Process();
+ return 0;
+ }
+ MY_UNKNOWN_IMP
+ STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
+};
+
+HRESULT CThreadBenchmark::Process()
+{
+ try
+ {
+ SyncInfo->WaitCreating();
+ CBenchRandomGenerator randomGenerator;
+ CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
+ Encoder.QueryInterface(IID_ICompressWriteCoderProperties,
+ &writeCoderProperties);
+ CMyComPtr<ICompressSetDecoderProperties2> compressSetDecoderProperties;
+ Decoder.QueryInterface(
+ IID_ICompressSetDecoderProperties2, &compressSetDecoderProperties);
+ CSequentialOutStreamImp *propStreamSpec = 0;
+ CMyComPtr<ISequentialOutStream> propStream;
+ if (writeCoderProperties != NULL)
+ {
+ propStreamSpec = new CSequentialOutStreamImp;
+ propStream = propStreamSpec;
+ }
+
+ CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
+ Encoder.QueryInterface(IID_ICompressSetCoderProperties,
+ &setCoderProperties);
+
+ CDecoderProgressInfo *decoderProgressInfoSpec = new
+ CDecoderProgressInfo;
+ CMyComPtr<ICompressProgressInfo> decoderProgress = decoderProgressInfoSpec;
+ decoderProgressInfoSpec->SyncInfo = SyncInfo;
+
+ for (;;)
+ {
+ if (SyncInfo->WasStopped())
+ return 0;
+ if (SyncInfo->WasPaused())
+ {
+ Sleep(200);
+ continue;
+ }
+ UInt32 dictionarySize;
+ bool multiThread;
+ {
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ dictionarySize = SyncInfo->DictionarySize;
+ multiThread = SyncInfo->MultiThread;
+ if (SyncInfo->Changed)
+ SyncInfo->Init();
+ }
+
+ const UInt32 kBufferSize = dictionarySize + kAdditionalSize;
+ const UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize;
+
+ if (setCoderProperties)
+ {
+ PROPID propIDs[] =
+ {
+ NCoderPropID::kDictionarySize,
+ NCoderPropID::kMultiThread
+ };
+ const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);
+ NWindows::NCOM::CPropVariant properties[kNumProps];
+ properties[0] = UInt32(dictionarySize);
+ properties[1] = bool(multiThread);
+ HRESULT res = setCoderProperties->SetCoderProperties(propIDs,
+ properties, kNumProps);
+ if (res != S_OK)
+ {
+ // SyncInfo->Pause();
+ MessageBox(0, NError::MyFormatMessage(res), TEXT("7-Zip"), MB_ICONERROR);
+ return res;
+ }
+ }
+
+ if (propStream)
+ {
+ propStreamSpec->Init();
+ writeCoderProperties->WriteCoderProperties(propStream);
+ }
+
+ if (!randomGenerator.Alloc(kBufferSize))
+ return E_OUTOFMEMORY;
+
+ randomGenerator.Generate();
+ CCRC crc;
+
+ // randomGenerator.BufferSize
+ crc.Update(randomGenerator.Buffer, randomGenerator.BufferSize);
+
+ {
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ if (SyncInfo->Changed)
+ continue;
+ }
+
+ CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
+ CBenchmarkOutStream *outStreamSpec = new CBenchmarkOutStream;
+ CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
+ if (!outStreamSpec->Alloc(kCompressedBufferSize))
+ return E_OUTOFMEMORY;
+
+ {
+ // this code is for reducing time of memory allocationg
+ inStreamSpec->Init(randomGenerator.Buffer, MyMin((UInt32)1, randomGenerator.BufferSize));
+ outStreamSpec->Init();
+ /* HRESULT result = */ Encoder->Code(inStream, outStream, 0, 0, NULL);
+ }
+
+ inStreamSpec->Init(randomGenerator.Buffer, randomGenerator.BufferSize);
+ outStreamSpec->Init();
+
+ _approvedStart = dictionarySize;
+ _startTime = ::GetTimeCount();
+ HRESULT result = Encoder->Code(inStream, outStream, 0, 0, this);
+ UInt64 tickCount = ::GetTimeCount() - _startTime;
+ UInt32 compressedSize = outStreamSpec->Pos;
+ {
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ if (result == S_OK)
+ {
+ if (SyncInfo->ApprovedInfo.InSize != 0)
+ {
+ SyncInfo->CompressingInfoTemp.InSize = kBufferSize - SyncInfo->ApprovedInfo.InSize;
+ SyncInfo->CompressingInfoTemp.OutSize = compressedSize - SyncInfo->ApprovedInfo.OutSize;
+ SyncInfo->CompressingInfoTemp.Time = tickCount - SyncInfo->ApprovedInfo.Time;
+ if (SyncInfo->CompressingInfo.Time == 0)
+ SyncInfo->CompressingInfo = SyncInfo->CompressingInfoTemp;
+ }
+ }
+ SyncInfo->ApprovedInfo.Init();
+ }
+ if(result != S_OK)
+ {
+ if (result != E_ABORT)
+ {
+ SyncInfo->Pause();
+ MessageBox(0, NError::MyFormatMessage(result), TEXT("7-Zip"), MB_ICONERROR);
+ }
+ continue;
+ }
+ {
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ SyncInfo->NumPasses++;
+ }
+
+ ///////////////////////
+ // Decompressing
+
+
+ CCompareOutStream *outCompareStreamSpec = new CCompareOutStream;
+ CMyComPtr<ISequentialOutStream> outCompareStream = outCompareStreamSpec;
+
+ for (int i = 0; i < 2; i++)
+ {
+ inStreamSpec->Init(outStreamSpec->Buffer, compressedSize);
+ outCompareStreamSpec->Init();
+
+ if (compressSetDecoderProperties)
+ {
+ RINOK(compressSetDecoderProperties->SetDecoderProperties2(
+ propStreamSpec->GetBuffer(), (UInt32)propStreamSpec->GetSize()));
+ }
+
+ UInt64 outSize = kBufferSize;
+ UInt64 startTime = ::GetTimeCount();
+ result = Decoder->Code(inStream, outCompareStream, 0, &outSize, decoderProgress);
+ tickCount = ::GetTimeCount() - startTime;
+ {
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ if (result == S_OK)
+ {
+ SyncInfo->DecompressingInfoTemp.InSize = compressedSize;
+ SyncInfo->DecompressingInfoTemp.OutSize = kBufferSize;
+ SyncInfo->DecompressingInfoTemp.Time = tickCount;
+ if (SyncInfo->DecompressingInfo.Time == 0 && i >= 1)
+ SyncInfo->DecompressingInfo = SyncInfo->DecompressingInfoTemp;
+ if (outCompareStreamSpec->CRC.GetDigest() != crc.GetDigest())
+ {
+ SyncInfo->NumErrors++;
+ break;
+ }
+ }
+ else
+ {
+ if(result != E_ABORT)
+ {
+ SyncInfo->NumErrors++;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch(CSystemException &e)
+ {
+ MessageBox(0, NError::MyFormatMessage(e.ErrorCode), TEXT("7-Zip"), MB_ICONERROR);
+ return E_FAIL;
+ }
+ catch(...)
+ {
+ MyMessageBoxError(0, L"Some error");
+ return E_FAIL;
+ }
+}
+
+STDMETHODIMP CThreadBenchmark::SetRatioInfo(
+ const UInt64 *inSize, const UInt64 *outSize)
+{
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ if (SyncInfo->Changed || SyncInfo->WasPaused() || SyncInfo->WasStopped())
+ return E_ABORT;
+ CProgressInfo ci;
+ ci.InSize = *inSize;
+ ci.OutSize = *outSize;
+ ci.Time = ::GetTimeCount() - _startTime;
+ SyncInfo->ProcessedSize = *inSize;
+
+ UInt64 deltaTime = ci.Time - SyncInfo->CompressingInfoPrev.Time;
+ if (deltaTime >= GetFreq())
+ {
+ SyncInfo->CompressingInfoTemp.Time = deltaTime;
+ SyncInfo->CompressingInfoTemp.InSize = ci.InSize - SyncInfo->CompressingInfoPrev.InSize;
+ SyncInfo->CompressingInfoTemp.OutSize = ci.InSize - SyncInfo->CompressingInfoPrev.OutSize;
+ SyncInfo->CompressingInfoPrev = ci;
+ }
+ if (*inSize >= _approvedStart && SyncInfo->ApprovedInfo.InSize == 0)
+ SyncInfo->ApprovedInfo = ci;
+ return S_OK;
+}
+
+static bool GetCoderPath(UString &path)
+{
+ if (!GetProgramFolderPath(path))
+ return false;
+ path += L"Codecs\\LZMA.dll";
+ return true;
+}
+
+typedef UInt32 (WINAPI *GetMethodPropertyFunc)(
+ UInt32 index, PROPID propID, PROPVARIANT *value);
+
+static bool LoadCoder(
+ const UString &filePath,
+ NWindows::NDLL::CLibrary &library,
+ CLSID &encoder, CLSID &decoder)
+{
+ if (!library.Load(filePath))
+ return false;
+ GetMethodPropertyFunc getMethodProperty = (GetMethodPropertyFunc)
+ library.GetProcAddress("GetMethodProperty");
+ if (getMethodProperty == NULL)
+ return false;
+
+ NWindows::NCOM::CPropVariant propVariant;
+ if (getMethodProperty (0, NMethodPropID::kEncoder, &propVariant) != S_OK)
+ return false;
+ if (propVariant.vt != VT_BSTR)
+ return false;
+ encoder = *(const GUID *)propVariant.bstrVal;
+ propVariant.Clear();
+
+ if (getMethodProperty (0, NMethodPropID::kDecoder, &propVariant) != S_OK)
+ return false;
+ if (propVariant.vt != VT_BSTR)
+ return false;
+ decoder = *(const GUID *)propVariant.bstrVal;
+ propVariant.Clear();
+ return true;
+}
+
+void Benchmark(HWND hwnd)
+{
+ UString path;
+ if (!GetCoderPath(path))
+ {
+ MyMessageBoxError(hwnd, L"Can't find LZMA.dll");
+ return;
+ }
+ CLSID encoder;
+ CLSID decoder;
+ CThreadBenchmark benchmarker;
+ if (!LoadCoder(path, benchmarker.Library, encoder, decoder))
+ {
+ MyMessageBoxError(hwnd, L"Can't load LZMA.dll");
+ return;
+ }
+
+ CreateObjectPointer createObject = (CreateObjectPointer)
+ benchmarker.Library.GetProcAddress("CreateObject");
+ if (createObject == NULL)
+ {
+ MyMessageBoxError(hwnd, L"Incorrect LZMA.dll");
+ return;
+ }
+ if (createObject(&encoder, &IID_ICompressCoder, (void **)&benchmarker.Encoder) != S_OK)
+ {
+ MyMessageBoxError(hwnd, L"Can't create codec");
+ return;
+ }
+ if (createObject(&decoder, &IID_ICompressCoder, (void **)&benchmarker.Decoder) != S_OK)
+ {
+ MyMessageBoxError(hwnd, L"Can't create codec");
+ return;
+ }
+
+ CBenchmarkDialog benchmarkDialog;
+ benchmarker.SyncInfo = &benchmarkDialog._syncInfo;
+ CThread thread;
+ if (!thread.Create(CThreadBenchmark::MyThreadFunction, &benchmarker))
+ {
+ MyMessageBoxError(hwnd, L"error");
+ return;
+ }
+ benchmarkDialog.Create(hwnd);
+ WaitForSingleObject(thread, INFINITE);
+}
diff --git a/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.h b/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.h
new file mode 100755
index 00000000..244e7fe5
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.h
@@ -0,0 +1,136 @@
+// BenchmarkDialog.h
+
+#ifndef __BENCHMARKDIALOG_H
+#define __BENCHMARKDIALOG_H
+
+#include "resource.h"
+
+#include "Common/MyCom.h"
+#include "Windows/Control/Dialog.h"
+#include "Windows/Control/ComboBox.h"
+#include "Windows/Synchronization.h"
+#include "../../../ICoder.h"
+
+const int kNumBenchDictionaryBitsStart = 21;
+
+struct CProgressInfo
+{
+ UINT64 InSize;
+ UINT64 OutSize;
+ UINT64 Time;
+ void Init()
+ {
+ InSize = 0;
+ OutSize = 0;
+ Time = 0;
+ }
+};
+
+class CProgressSyncInfo
+{
+ bool Stopped;
+ bool Paused;
+public:
+ bool Changed;
+ UINT32 DictionarySize;
+ bool MultiThread;
+ UINT64 NumPasses;
+ UINT64 NumErrors;
+ NWindows::NSynchronization::CManualResetEvent _startEvent;
+ NWindows::NSynchronization::CCriticalSection CS;
+
+ CProgressInfo ApprovedInfo;
+ CProgressInfo CompressingInfoPrev;
+ CProgressInfo CompressingInfoTemp;
+ CProgressInfo CompressingInfo;
+ UINT64 ProcessedSize;
+
+ CProgressInfo DecompressingInfoTemp;
+ CProgressInfo DecompressingInfo;
+
+ void Init()
+ {
+ Changed = false;
+ ApprovedInfo.Init();
+ CompressingInfoPrev.Init();
+ CompressingInfoTemp.Init();
+ CompressingInfo.Init();
+ ProcessedSize = 0;
+
+ DecompressingInfoTemp.Init();
+ DecompressingInfo.Init();
+
+ Stopped = false;
+ Paused = false;
+ NumPasses = 0;
+ NumErrors = 0;
+ }
+ void InitSettings()
+ {
+ DictionarySize = (1 << kNumBenchDictionaryBitsStart);
+ MultiThread = false;
+ }
+ 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(); }
+};
+
+class CBenchmarkDialog:
+ public NWindows::NControl::CModalDialog
+{
+ NWindows::NControl::CComboBox m_Dictionary;
+ UINT_PTR _timer;
+ UINT32 _startTime;
+
+ 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 PrintResults(
+ UINT32 dictionarySize,
+ UINT64 elapsedTime,
+ UINT64 size, UINT speedID, UINT ratingID,
+ bool decompressMode = false, UINT64 secondSize = 0);
+
+ UINT32 OnChangeDictionary();
+ void OnChangeSettings();
+public:
+ CProgressSyncInfo _syncInfo;
+
+ CBenchmarkDialog(): _timer(0) {}
+ INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_BENCHMARK, wndParent); }
+};
+
+void Benchmark(HWND hwnd);
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/BenchmarkDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/BenchmarkDialog/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/BenchmarkDialog/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.h b/CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.h
new file mode 100755
index 00000000..d720058d
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.h
@@ -0,0 +1,34 @@
+#define IDD_DIALOG_BENCHMARK 800
+#define IDC_BUTTON_STOP 1001
+#define IDC_BUTTON_RESTART 1002
+#define IDC_BENCHMARK_DICTIONARY 1010
+#define IDC_BENCHMARK_COMBO_DICTIONARY 1011
+#define IDC_BENCHMARK_MEMORY 1012
+#define IDC_BENCHMARK_MEMORY_VALUE 1013
+#define IDC_BENCHMARK_MULTITHREADING 1014
+#define IDC_BENCHMARK_SPEED_LABEL 1020
+#define IDC_BENCHMARK_RATING_LABEL 1021
+#define IDC_BENCHMARK_COMPRESSING 1022
+#define IDC_BENCHMARK_DECOMPRESSING 1023
+#define IDC_BENCHMARK_CURRENT 1024
+#define IDC_BENCHMARK_RESULTING 1025
+#define IDC_BENCHMARK_CURRENT2 1026
+#define IDC_BENCHMARK_RESULTING2 1027
+#define IDC_BENCHMARK_COMPRESSING_SPEED 1030
+#define IDC_BENCHMARK_COMPRESSING_SPEED2 1031
+#define IDC_BENCHMARK_COMPRESSING_RATING 1032
+#define IDC_BENCHMARK_COMPRESSING_RATING2 1033
+#define IDC_BENCHMARK_DECOMPRESSING_SPEED 1040
+#define IDC_BENCHMARK_DECOMPRESSING_SPEED2 1041
+#define IDC_BENCHMARK_DECOMPRESSING_RATING 1042
+#define IDC_BENCHMARK_DECOMPRESSING_RATING2 1043
+#define IDC_BENCHMARK_TOTAL_RATING 1050
+#define IDC_BENCHMARK_TOTAL_RATING_VALUE 1051
+#define IDC_BENCHMARK_ELAPSED 1060
+#define IDC_BENCHMARK_ELAPSED_VALUE 1061
+#define IDC_BENCHMARK_SIZE 1062
+#define IDC_BENCHMARK_SIZE_VALUE 1063
+#define IDC_BENCHMARK_ERRORS 1064
+#define IDC_BENCHMARK_ERRORS_VALUE 1065
+#define IDC_BENCHMARK_PASSES 1066
+#define IDC_BENCHMARK_PASSES_VALUE 1067
diff --git a/CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.rc b/CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.rc
new file mode 100755
index 00000000..5ab220e5
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.rc
@@ -0,0 +1,87 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 210
+#define ySize2 228
+
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#define bXPos1 (xSize - marg - bXSize)
+#define bXPos2 (bXPos1 - 10 - bXSize)
+
+#define bYPos (ySize - marg - bYSize)
+
+#define gSize 160
+#define gSpace 24
+
+#define g0XSize 75
+#define g1XSize 44
+#define g1XPos (marg + g0XSize)
+
+#define g10XPos (marg + marg)
+#define gRatingSize 51
+#define gSpeedSize 64
+#define gRatingPos (xSize - marg - marg - gRatingSize)
+#define gSpeedPos (gRatingPos - gSpeedSize)
+#define gLabelSize (gSpeedPos - g10XPos)
+#define gTotalRatingSize (gRatingSize + marg + marg)
+#define gTotalRatingPos (xSize - marg - gTotalRatingSize)
+
+#define g2XSize 58
+#define g3XSize 36
+#define g3XPos (marg + g2XSize)
+
+
+IDD_DIALOG_BENCHMARK DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
+CAPTION "Benchmark"
+MY_FONT
+BEGIN
+ PUSHBUTTON "&Restart", IDC_BUTTON_RESTART, bXPos1, marg, bXSize, bYSize
+ PUSHBUTTON "&Stop", IDC_BUTTON_STOP, bXPos1, 27, bXSize, bYSize
+
+ PUSHBUTTON "&Help", IDHELP, bXPos2, bYPos, bXSize,bYSize
+ PUSHBUTTON "Cancel", IDCANCEL, bXPos1, bYPos, bXSize, bYSize
+
+ LTEXT "&Dictionary size:", IDC_BENCHMARK_DICTIONARY, marg, marg + 1, g0XSize, 8
+ COMBOBOX IDC_BENCHMARK_COMBO_DICTIONARY, g1XPos, marg, g1XSize, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Memory usage:", IDC_BENCHMARK_MEMORY, marg, 25, g0XSize, 8
+ LTEXT "0 MB", IDC_BENCHMARK_MEMORY_VALUE, g1XPos,25,g1XSize,8
+ CONTROL "Multi-threading", IDC_BENCHMARK_MULTITHREADING, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ marg, 41, g0XSize, 10
+
+ RTEXT "Speed", IDC_BENCHMARK_SPEED_LABEL, gSpeedPos, 53, gSpeedSize, 8
+ RTEXT "Rating", IDC_BENCHMARK_RATING_LABEL, gRatingPos, 53, gRatingSize, 8
+
+ GROUPBOX "Compressing", IDC_BENCHMARK_COMPRESSING, marg, 64, xSize2, 40
+
+ LTEXT "Current", IDC_BENCHMARK_CURRENT, g10XPos, 76, gLabelSize, 8
+ RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED, gSpeedPos, 76, gSpeedSize, 8
+ RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING, gRatingPos, 76, gRatingSize, 8
+
+ LTEXT "Resulting", IDC_BENCHMARK_RESULTING, g10XPos, 89, gLabelSize, 8
+ RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED2, gSpeedPos, 89, gSpeedSize, 8
+ RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING2, gRatingPos, 89, gRatingSize, 8
+
+ GROUPBOX "Decompressing", IDC_BENCHMARK_DECOMPRESSING, marg, 111, xSize2, 40
+
+ LTEXT "Current", IDC_BENCHMARK_CURRENT2, g10XPos, 123, gLabelSize, 8
+ RTEXT "100 KB/s", IDC_BENCHMARK_DECOMPRESSING_SPEED, gSpeedPos, 123, gSpeedSize, 8
+ RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING, gRatingPos, 123, gRatingSize, 8
+
+ LTEXT "Resulting", IDC_BENCHMARK_RESULTING2, g10XPos, 136, gLabelSize, 8
+ RTEXT "100 KB/s", IDC_BENCHMARK_DECOMPRESSING_SPEED2, gSpeedPos, 136, gSpeedSize, 8
+ RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING2, gRatingPos, 136, gRatingSize, 8
+
+ GROUPBOX "Total Rating", IDC_BENCHMARK_TOTAL_RATING, gTotalRatingPos, 163, gTotalRatingSize, 38
+ RTEXT "0", IDC_BENCHMARK_TOTAL_RATING_VALUE, gRatingPos, 181, gRatingSize, 8
+
+ LTEXT "Elapsed time:", IDC_BENCHMARK_ELAPSED, marg, 163, g2XSize, 8
+ LTEXT "Size:", IDC_BENCHMARK_SIZE, marg, 176, g2XSize, 8
+ LTEXT "Passes:", IDC_BENCHMARK_PASSES, marg, 189, g2XSize, 8
+ LTEXT "Errors:", IDC_BENCHMARK_ERRORS, marg, 202, g2XSize, 8
+ RTEXT "00:00:00", IDC_BENCHMARK_ELAPSED_VALUE, g3XPos, 163, g3XSize, 8
+ RTEXT "0", IDC_BENCHMARK_SIZE_VALUE, g3XPos, 176, g3XSize, 8
+ RTEXT "0", IDC_BENCHMARK_PASSES_VALUE, g3XPos, 189, g3XSize, 8
+ RTEXT "0", IDC_BENCHMARK_ERRORS_VALUE, g3XPos, 202, g3XSize, 8
+END
diff --git a/CPP/7zip/FileManager/Resource/ComboDialog/ComboDialog.cpp b/CPP/7zip/FileManager/Resource/ComboDialog/ComboDialog.cpp
new file mode 100755
index 00000000..2dc42ee0
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ComboDialog/ComboDialog.cpp
@@ -0,0 +1,53 @@
+// ComboDialog.cpp
+
+#include "StdAfx.h"
+#include "ComboDialog.h"
+
+#include "Windows/Control/Static.h"
+
+#ifdef LANG
+#include "../../LangUtils.h"
+#endif
+
+using namespace NWindows;
+
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDOK, 0x02000702 },
+ { IDCANCEL, 0x02000710 }
+};
+#endif
+
+bool CComboDialog::OnInit()
+{
+ #ifdef LANG
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+ _comboBox.Attach(GetItem(IDC_COMBO_COMBO));
+
+ /*
+ // why it doesn't work ?
+ DWORD style = _comboBox.GetStyle();
+ if (Sorted)
+ style |= CBS_SORT;
+ else
+ style &= ~CBS_SORT;
+ _comboBox.SetStyle(style);
+ */
+ SetText(Title);
+
+ NControl::CStatic staticContol;
+ staticContol.Attach(GetItem(IDC_COMBO_STATIC));
+ staticContol.SetText(Static);
+ _comboBox.SetText(Value);
+ for(int i = 0; i < Strings.Size(); i++)
+ _comboBox.AddString(Strings[i]);
+ return CModalDialog::OnInit();
+}
+
+void CComboDialog::OnOK()
+{
+ _comboBox.GetText(Value);
+ CModalDialog::OnOK();
+}
diff --git a/CPP/7zip/FileManager/Resource/ComboDialog/ComboDialog.h b/CPP/7zip/FileManager/Resource/ComboDialog/ComboDialog.h
new file mode 100755
index 00000000..1838783d
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ComboDialog/ComboDialog.h
@@ -0,0 +1,25 @@
+// ComboDialog.h
+
+#ifndef __COMBODIALOG_H
+#define __COMBODIALOG_H
+
+#include "Windows/Control/Dialog.h"
+#include "Windows/Control/ComboBox.h"
+#include "resource.h"
+
+class CComboDialog: public NWindows::NControl::CModalDialog
+{
+ NWindows::NControl::CComboBox _comboBox;
+ virtual void OnOK();
+ virtual bool OnInit();
+public:
+ // bool Sorted;
+ UString Title;
+ UString Static;
+ UString Value;
+ UStringVector Strings;
+ // CComboDialog(): Sorted(false) {};
+ INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_COMBO, parentWindow); }
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/ComboDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/ComboDialog/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ComboDialog/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/ComboDialog/resource.h b/CPP/7zip/FileManager/Resource/ComboDialog/resource.h
new file mode 100755
index 00000000..b5111ddf
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ComboDialog/resource.h
@@ -0,0 +1,4 @@
+#define IDD_DIALOG_COMBO 200
+
+#define IDC_COMBO_STATIC 1000
+#define IDC_COMBO_COMBO 1001
diff --git a/CPP/7zip/FileManager/Resource/ComboDialog/resource.rc b/CPP/7zip/FileManager/Resource/ComboDialog/resource.rc
new file mode 100755
index 00000000..7bf25365
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ComboDialog/resource.rc
@@ -0,0 +1,24 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 233
+#define ySize2 57
+
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#define bYPos (ySize - marg - bYSize)
+#define b1XPos (xSize - marg - bXSize)
+#define b2XPos (b1XPos - 10 - bXSize)
+
+
+IDD_DIALOG_COMBO DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
+CAPTION "Combo"
+MY_FONT
+BEGIN
+ LTEXT "", IDC_COMBO_STATIC, marg, marg, xSize2, 8
+ COMBOBOX IDC_COMBO_COMBO, marg, 20, xSize2, 65, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+
+ DEFPUSHBUTTON "OK", IDOK, b2XPos, bYPos, bXSize, bYSize
+ PUSHBUTTON "Cancel", IDCANCEL, b1XPos, bYPos, bXSize, bYSize
+END
diff --git a/CPP/7zip/FileManager/Resource/CopyDialog/CopyDialog.cpp b/CPP/7zip/FileManager/Resource/CopyDialog/CopyDialog.cpp
new file mode 100755
index 00000000..c0bcf2bc
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/CopyDialog/CopyDialog.cpp
@@ -0,0 +1,81 @@
+// CopyDialog.cpp
+
+#include "StdAfx.h"
+#include "CopyDialog.h"
+
+#include "Common/StringConvert.h"
+
+#include "Windows/Control/Static.h"
+#include "Windows/Shell.h"
+#include "Windows/FileName.h"
+
+#ifdef LANG
+#include "../../LangUtils.h"
+#endif
+
+using namespace NWindows;
+
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDOK, 0x02000702 },
+ { IDCANCEL, 0x02000710 }
+};
+#endif
+
+bool CCopyDialog::OnInit()
+{
+ #ifdef LANG
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+ _path.Attach(GetItem(IDC_COPY_COMBO));
+ SetText(Title);
+
+ NControl::CStatic staticContol;
+ staticContol.Attach(GetItem(IDC_COPY_STATIC));
+ staticContol.SetText(Static);
+ for(int i = 0; i < Strings.Size(); i++)
+ _path.AddString(Strings[i]);
+ _path.SetText(Value);
+ return CModalDialog::OnInit();
+}
+
+bool CCopyDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ case IDC_COPY_SET_PATH:
+ OnButtonSetPath();
+ return true;
+ }
+ return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
+}
+
+void CCopyDialog::OnButtonSetPath()
+{
+ UString currentPath;
+ _path.GetText(currentPath);
+
+ /*
+ #ifdef LANG
+ UString title = LangLoadString(IDS_EXTRACT_SET_FOLDER, 0x02000881);
+ #else
+ UString title = MyLoadString(IDS_EXTRACT_SET_FOLDER);
+ #endif
+ */
+ UString title = LangStringSpec(IDS_SET_FOLDER, 0x03020209);
+ // UString title = L"Specify a location for output folder";
+
+ UString resultPath;
+ if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
+ return;
+ NFile::NName::NormalizeDirPathPrefix(resultPath);
+ _path.SetCurSel(-1);
+ _path.SetText(resultPath);
+}
+
+void CCopyDialog::OnOK()
+{
+ _path.GetText(Value);
+ CModalDialog::OnOK();
+}
diff --git a/CPP/7zip/FileManager/Resource/CopyDialog/CopyDialog.h b/CPP/7zip/FileManager/Resource/CopyDialog/CopyDialog.h
new file mode 100755
index 00000000..353f6807
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/CopyDialog/CopyDialog.h
@@ -0,0 +1,26 @@
+// CopyDialog.h
+
+#ifndef __COPYDIALOG_H
+#define __COPYDIALOG_H
+
+#include "Windows/Control/Dialog.h"
+#include "Windows/Control/ComboBox.h"
+#include "resource.h"
+
+class CCopyDialog: public NWindows::NControl::CModalDialog
+{
+ NWindows::NControl::CComboBox _path;
+ virtual void OnOK();
+ virtual bool OnInit();
+ void OnButtonSetPath();
+ bool OnButtonClicked(int buttonID, HWND buttonHWND);
+public:
+ UString Title;
+ UString Static;
+ UString Value;
+ UStringVector Strings;
+
+ INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_COPY, parentWindow); }
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/CopyDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/CopyDialog/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/CopyDialog/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/CopyDialog/resource.h b/CPP/7zip/FileManager/Resource/CopyDialog/resource.h
new file mode 100755
index 00000000..7ec6162a
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/CopyDialog/resource.h
@@ -0,0 +1,7 @@
+#define IDD_DIALOG_COPY 202
+
+#define IDC_COPY_STATIC 1000
+#define IDC_COPY_COMBO 1001
+#define IDC_COPY_SET_PATH 1002
+
+#define IDS_SET_FOLDER 210
diff --git a/CPP/7zip/FileManager/Resource/CopyDialog/resource.rc b/CPP/7zip/FileManager/Resource/CopyDialog/resource.rc
new file mode 100755
index 00000000..156b56cf
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/CopyDialog/resource.rc
@@ -0,0 +1,28 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 346
+#define ySize2 57
+
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#define bYPos (ySize - marg - bYSize)
+#define b1XPos (xSize - marg - bXSize)
+#define b2XPos (b1XPos - 10 - bXSize)
+
+IDD_DIALOG_COPY DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
+CAPTION "Copy"
+MY_FONT
+BEGIN
+ LTEXT "", IDC_COPY_STATIC, marg, marg, xSize2, 8
+ COMBOBOX IDC_COPY_COMBO, marg, 20, xSize2 - bDotsSize - 12, 65, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "...", IDC_COPY_SET_PATH, (xSize - marg - bDotsSize), 20, bDotsSize, 14, WS_GROUP
+ DEFPUSHBUTTON "OK", IDOK, b2XPos, bYPos, bXSize, bYSize
+ PUSHBUTTON "Cancel", IDCANCEL, b1XPos, bYPos, bXSize, bYSize
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_SET_FOLDER "Specify a location for output folder."
+END
diff --git a/CPP/7zip/FileManager/Resource/EditPage/EditPage.cpp b/CPP/7zip/FileManager/Resource/EditPage/EditPage.cpp
new file mode 100755
index 00000000..0e6e1d71
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/EditPage/EditPage.cpp
@@ -0,0 +1,91 @@
+// EditPage.cpp
+
+#include "StdAfx.h"
+#include "resource.h"
+#include "EditPage.h"
+
+#include "Common/StringConvert.h"
+
+#include "Windows/Defs.h"
+#include "Windows/CommonDialog.h"
+// #include "Windows/FileFind.h"
+// #include "Windows/FileDir.h"
+
+#include "../../RegistryUtils.h"
+#include "../../HelpUtils.h"
+#include "../../LangUtils.h"
+#include "../../ProgramLocation.h"
+
+using namespace NWindows;
+
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_EDIT_STATIC_EDITOR, 0x03010201}
+};
+
+static LPCWSTR kEditTopic = L"FM/options.htm#editor";
+
+bool CEditPage::OnInit()
+{
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+
+ _editorEdit.Attach(GetItem(IDC_EDIT_EDIT_EDITOR));
+ UString editorPath;
+ ReadRegEditor(editorPath);
+ _editorEdit.SetText(editorPath);
+ return CPropertyPage::OnInit();
+}
+
+LONG CEditPage::OnApply()
+{
+ // int selectedIndex = _langCombo.GetCurSel();
+ // int pathIndex = _langCombo.GetItemData(selectedIndex);
+ // ReloadLang();
+ UString editorPath;
+ _editorEdit.GetText(editorPath);
+ SaveRegEditor(editorPath);
+ return PSNRET_NOERROR;
+}
+
+void CEditPage::OnNotifyHelp()
+{
+ ShowHelpWindow(NULL, kEditTopic); // change it
+}
+
+bool CEditPage::OnButtonClicked(int aButtonID, HWND aButtonHWND)
+{
+ switch(aButtonID)
+ {
+ case IDC_EDIT_BUTTON_SET:
+ {
+ OnSetEditorButton();
+ // if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, aResultPath))
+ // return;
+ return true;
+ }
+ }
+ return CPropertyPage::OnButtonClicked(aButtonID, aButtonHWND);
+}
+
+void CEditPage::OnSetEditorButton()
+{
+ UString editorPath;
+ _editorEdit.GetText(editorPath);
+ UString resPath;
+ if(!MyGetOpenFileName(HWND(*this), 0, editorPath, L"*.exe", resPath))
+ return;
+ _editorEdit.SetText(resPath);
+ // Changed();
+}
+
+bool CEditPage::OnCommand(int code, int itemID, LPARAM param)
+{
+ if (code == EN_CHANGE && itemID == IDC_EDIT_EDIT_EDITOR)
+ {
+ Changed();
+ return true;
+ }
+ return CPropertyPage::OnCommand(code, itemID, param);
+}
+
+
diff --git a/CPP/7zip/FileManager/Resource/EditPage/EditPage.h b/CPP/7zip/FileManager/Resource/EditPage/EditPage.h
new file mode 100755
index 00000000..26999dcf
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/EditPage/EditPage.h
@@ -0,0 +1,21 @@
+// EditPage.h
+
+#ifndef __EDITPAGE_H
+#define __EDITPAGE_H
+
+#include "Windows/Control/PropertyPage.h"
+#include "Windows/Control/Edit.h"
+
+class CEditPage: public NWindows::NControl::CPropertyPage
+{
+ NWindows::NControl::CEdit _editorEdit;
+ void OnSetEditorButton();
+public:
+ virtual bool OnInit();
+ virtual void OnNotifyHelp();
+ virtual bool OnCommand(int code, int itemID, LPARAM param);
+ virtual LONG OnApply();
+ virtual bool OnButtonClicked(int aButtonID, HWND aButtonHWND);
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/EditPage/StdAfx.h b/CPP/7zip/FileManager/Resource/EditPage/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/EditPage/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/EditPage/resource.h b/CPP/7zip/FileManager/Resource/EditPage/resource.h
new file mode 100755
index 00000000..a2de1970
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/EditPage/resource.h
@@ -0,0 +1,4 @@
+#define IDD_EDIT 903
+#define IDC_EDIT_STATIC_EDITOR 1000
+#define IDC_EDIT_EDIT_EDITOR 1002
+#define IDC_EDIT_BUTTON_SET 1003
diff --git a/CPP/7zip/FileManager/Resource/EditPage/resource.rc b/CPP/7zip/FileManager/Resource/EditPage/resource.rc
new file mode 100755
index 00000000..d4d8b9cd
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/EditPage/resource.rc
@@ -0,0 +1,16 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 196
+#define ySize2 140
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+IDD_EDIT DIALOG 0, 0, xSize, ySize MY_PAGE_STYLE
+CAPTION "Editor"
+MY_FONT
+BEGIN
+ LTEXT "&Editor:", IDC_EDIT_STATIC_EDITOR, marg, marg, xSize2, 8
+ EDITTEXT IDC_EDIT_EDIT_EDITOR, marg, 20, xSize2 - 12 - bDotsSize, 14, ES_AUTOHSCROLL
+ PUSHBUTTON "...", IDC_EDIT_BUTTON_SET, (xSize - marg - bDotsSize), 20, bDotsSize, bYSize
+END
diff --git a/CPP/7zip/FileManager/Resource/LangPage/LangPage.cpp b/CPP/7zip/FileManager/Resource/LangPage/LangPage.cpp
new file mode 100755
index 00000000..9974759a
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/LangPage/LangPage.cpp
@@ -0,0 +1,90 @@
+// LangPage.cpp
+
+#include "StdAfx.h"
+#include "resource.h"
+#include "LangPage.h"
+
+#include "Common/StringConvert.h"
+
+#include "Windows/ResourceString.h"
+
+#include "../../RegistryUtils.h"
+#include "../../HelpUtils.h"
+#include "../../LangUtils.h"
+
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_LANG_STATIC_LANG, 0x01000401}
+};
+
+static LPCWSTR kLangTopic = L"fm/options.htm#language";
+
+bool CLangPage::OnInit()
+{
+ _langWasChanged = false;
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+
+ _langCombo.Attach(GetItem(IDC_LANG_COMBO_LANG));
+
+ UString s = NWindows::MyLoadStringW(IDS_LANG_ENGLISH);
+ s += L" (";
+ s += NWindows::MyLoadStringW(IDS_LANG_NATIVE);
+ s += L")";
+ int index = (int)_langCombo.AddString(s);
+ _langCombo.SetItemData(index, _paths.Size());
+ _paths.Add(L"-");
+ _langCombo.SetCurSel(0);
+
+ CObjectVector<CLangEx> langs;
+ LoadLangs(langs);
+ for (int i = 0; i < langs.Size(); i++)
+ {
+ const CLangEx &lang = langs[i];
+ UString name;
+ UString englishName, nationalName;
+ if (lang.Lang.GetMessage(0x00000000, englishName))
+ name = englishName;
+ else
+ name = lang.ShortName;
+ if (lang.Lang.GetMessage(0x00000001, nationalName))
+ {
+ if (!nationalName.IsEmpty())
+ {
+ name += L" (";
+ name += nationalName;
+ name += L")";
+ }
+ }
+ index = (int)_langCombo.AddString(name);
+ _langCombo.SetItemData(index, _paths.Size());
+ _paths.Add(lang.ShortName);
+ if (g_LangID.CompareNoCase(lang.ShortName) == 0)
+ _langCombo.SetCurSel(index);
+ }
+ return CPropertyPage::OnInit();
+}
+
+LONG CLangPage::OnApply()
+{
+ int selectedIndex = _langCombo.GetCurSel();
+ int pathIndex = (int)_langCombo.GetItemData(selectedIndex);
+ SaveRegLang(_paths[pathIndex]);
+ ReloadLang();
+ _langWasChanged = true;
+ return PSNRET_NOERROR;
+}
+
+void CLangPage::OnNotifyHelp()
+{
+ ShowHelpWindow(NULL, kLangTopic); // change it
+}
+
+bool CLangPage::OnCommand(int code, int itemID, LPARAM param)
+{
+ if (code == CBN_SELCHANGE && itemID == IDC_LANG_COMBO_LANG)
+ {
+ Changed();
+ return true;
+ }
+ return CPropertyPage::OnCommand(code, itemID, param);
+}
diff --git a/CPP/7zip/FileManager/Resource/LangPage/LangPage.h b/CPP/7zip/FileManager/Resource/LangPage/LangPage.h
new file mode 100755
index 00000000..b28d6984
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/LangPage/LangPage.h
@@ -0,0 +1,21 @@
+// LangPage.h
+
+#ifndef __LANGPAGE_H
+#define __LANGPAGE_H
+
+#include "Windows/Control/PropertyPage.h"
+#include "Windows/Control/ComboBox.h"
+
+class CLangPage: public NWindows::NControl::CPropertyPage
+{
+ NWindows::NControl::CComboBox _langCombo;
+ UStringVector _paths;
+public:
+ bool _langWasChanged;
+ virtual bool OnInit();
+ virtual void OnNotifyHelp();
+ virtual bool OnCommand(int code, int itemID, LPARAM param);
+ virtual LONG OnApply();
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/LangPage/StdAfx.h b/CPP/7zip/FileManager/Resource/LangPage/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/LangPage/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/LangPage/resource.h b/CPP/7zip/FileManager/Resource/LangPage/resource.h
new file mode 100755
index 00000000..39571e53
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/LangPage/resource.h
@@ -0,0 +1,6 @@
+#define IDD_LANG 900
+#define IDS_LANG_ENGLISH 995
+#define IDS_LANG_NATIVE 996
+
+#define IDC_LANG_STATIC_LANG 1000
+#define IDC_LANG_COMBO_LANG 1001
diff --git a/CPP/7zip/FileManager/Resource/LangPage/resource.rc b/CPP/7zip/FileManager/Resource/LangPage/resource.rc
new file mode 100755
index 00000000..abaa9481
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/LangPage/resource.rc
@@ -0,0 +1,21 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 238
+#define ySize2 204
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+IDD_LANG DIALOG 0, 0, xSize, ySize MY_PAGE_STYLE
+CAPTION "Language"
+MY_FONT
+BEGIN
+ LTEXT "Language:", IDC_LANG_STATIC_LANG, marg, marg, xSize2, 8
+ COMBOBOX IDC_LANG_COMBO_LANG, marg, 20, 146, ySize2 - 12, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+END
+
+STRINGTABLE
+BEGIN
+ IDS_LANG_ENGLISH "English"
+ IDS_LANG_NATIVE "English"
+END
diff --git a/CPP/7zip/FileManager/Resource/ListBoxDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/ListBoxDialog/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ListBoxDialog/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/ListBoxDialog/resource.h b/CPP/7zip/FileManager/Resource/ListBoxDialog/resource.h
new file mode 100755
index 00000000..507e17bd
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ListBoxDialog/resource.h
@@ -0,0 +1,3 @@
+#define IDD_DIALOG_LISTBOX 202
+
+#define IDC_LISTBOX_LIST 1000
diff --git a/CPP/7zip/FileManager/Resource/ListBoxDialog/resource.rc b/CPP/7zip/FileManager/Resource/ListBoxDialog/resource.rc
new file mode 100755
index 00000000..728aaa94
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ListBoxDialog/resource.rc
@@ -0,0 +1,22 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 223
+#define ySize2 177
+
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#define bYPos (ySize - marg - bYSize)
+#define b1XPos (xSize - marg - bXSize)
+#define b2XPos (b1XPos - 10 - bXSize)
+
+
+IDD_DIALOG_LISTBOX DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
+CAPTION "List Box"
+MY_FONT
+BEGIN
+ LISTBOX IDC_LISTBOX_LIST, marg, marg, xSize2, 149, LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "OK", IDOK, b2XPos, bYPos, bXSize, bYSize
+ PUSHBUTTON "Cancel", IDCANCEL, b1XPos, bYPos, bXSize, bYSize
+END
diff --git a/CPP/7zip/FileManager/Resource/ListViewDialog/ListViewDialog.cpp b/CPP/7zip/FileManager/Resource/ListViewDialog/ListViewDialog.cpp
new file mode 100755
index 00000000..ca7b7935
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ListViewDialog/ListViewDialog.cpp
@@ -0,0 +1,102 @@
+// ListViewDialog.cpp
+
+#include "StdAfx.h"
+#include "ListViewDialog.h"
+
+#include "Common/Vector.h"
+
+#ifdef LANG
+#include "../../LangUtils.h"
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDOK, 0x02000702 },
+ { IDCANCEL, 0x02000710 }
+};
+#endif
+
+bool CListViewDialog::OnInit()
+{
+ #ifdef LANG
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+ _listView.Attach(GetItem(IDC_LISTVIEW_LIST));
+ SetText(Title);
+
+ LVCOLUMN columnInfo;
+ columnInfo.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
+ columnInfo.fmt = LVCFMT_LEFT;
+ columnInfo.iSubItem = 0;
+ columnInfo.cx = 1000;
+
+ _listView.InsertColumn(0, &columnInfo);
+
+ for(int i = 0; i < Strings.Size(); i++)
+ {
+ LVITEMW item;
+ item.mask = LVIF_TEXT;
+ item.iItem = i;
+ item.pszText = (LPWSTR)(LPCWSTR)Strings[i];
+ item.iSubItem = 0;
+ _listView.InsertItem(&item);
+ }
+ if (Strings.Size() > 0)
+ _listView.SetItemState(0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
+ StringsWereChanged = false;
+ return CModalDialog::OnInit();
+}
+
+bool CListViewDialog::OnNotify(UINT /* controlID */, LPNMHDR header)
+{
+ if (header->hwndFrom != _listView)
+ return false;
+ switch(header->code)
+ {
+ case LVN_KEYDOWN:
+ {
+ LPNMLVKEYDOWN keyDownInfo = LPNMLVKEYDOWN(header);
+ switch(keyDownInfo->wVKey)
+ {
+ case VK_DELETE:
+ {
+ if (!DeleteIsAllowed)
+ return false;
+ int focusedIndex = _listView.GetFocusedItem();
+ if (focusedIndex < 0)
+ focusedIndex = 0;
+ for (;;)
+ {
+ int index = _listView.GetNextSelectedItem(-1);
+ if (index < 0)
+ break;
+ StringsWereChanged = true;
+ _listView.DeleteItem(index);
+ Strings.Delete(index);
+ }
+ if (focusedIndex >= _listView.GetItemCount())
+ focusedIndex = _listView.GetItemCount() - 1;
+ if (focusedIndex >= 0)
+ _listView.SetItemState(focusedIndex, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
+ return true;
+ }
+ case 'A':
+ {
+ bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
+ if (ctrl)
+ {
+ int numItems = _listView.GetItemCount();
+ for (int i = 0; i < numItems; i++)
+ _listView.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+}
+
+void CListViewDialog::OnOK()
+{
+ FocusedItemIndex = _listView.GetFocusedItem();
+ CModalDialog::OnOK();
+}
diff --git a/CPP/7zip/FileManager/Resource/ListViewDialog/ListViewDialog.h b/CPP/7zip/FileManager/Resource/ListViewDialog/ListViewDialog.h
new file mode 100755
index 00000000..ad107eba
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ListViewDialog/ListViewDialog.h
@@ -0,0 +1,30 @@
+// ListViewDialog.h
+
+#ifndef __LISTVIEWDIALOG_H
+#define __LISTVIEWDIALOG_H
+
+#include "Windows/Control/Dialog.h"
+#include "Windows/Control/ListView.h"
+#include "resource.h"
+
+class CListViewDialog: public NWindows::NControl::CModalDialog
+{
+ NWindows::NControl::CListView _listView;
+ virtual void OnOK();
+ virtual bool OnInit();
+ virtual bool OnNotify(UINT controlID, LPNMHDR header);
+
+public:
+ UString Title;
+ bool DeleteIsAllowed;
+ UStringVector Strings;
+ bool StringsWereChanged;
+ int FocusedItemIndex;
+
+ INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_LISTVIEW, wndParent); }
+
+ CListViewDialog(): DeleteIsAllowed(false) {}
+
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/ListViewDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/ListViewDialog/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ListViewDialog/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/ListViewDialog/resource.h b/CPP/7zip/FileManager/Resource/ListViewDialog/resource.h
new file mode 100755
index 00000000..440d14b0
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ListViewDialog/resource.h
@@ -0,0 +1,3 @@
+#define IDD_DIALOG_LISTVIEW 201
+
+#define IDC_LISTVIEW_LIST 1000
diff --git a/CPP/7zip/FileManager/Resource/ListViewDialog/resource.rc b/CPP/7zip/FileManager/Resource/ListViewDialog/resource.rc
new file mode 100755
index 00000000..5c0bdbcd
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ListViewDialog/resource.rc
@@ -0,0 +1,26 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 342
+#define ySize2 220
+
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#define bYPos (ySize - marg - bYSize)
+#define b1XPos (xSize - marg - bXSize)
+#define b2XPos (b1XPos - 10 - bXSize)
+
+
+IDD_DIALOG_LISTVIEW DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
+CAPTION "ListView"
+MY_FONT
+BEGIN
+ CONTROL "List1", IDC_LISTVIEW_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS |
+ LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,
+ marg, marg, xSize2, ySize2 - bYSize - 10
+ DEFPUSHBUTTON "OK", IDOK, b2XPos, bYPos, bXSize, bYSize
+ PUSHBUTTON "Cancel", IDCANCEL, b1XPos, bYPos, bXSize, bYSize
+END
+
+
diff --git a/CPP/7zip/FileManager/Resource/MessagesDialog/MessagesDialog.cpp b/CPP/7zip/FileManager/Resource/MessagesDialog/MessagesDialog.cpp
new file mode 100755
index 00000000..d156f823
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/MessagesDialog/MessagesDialog.cpp
@@ -0,0 +1,100 @@
+// MessagesDialog.cpp
+
+#include "StdAfx.h"
+#include "MessagesDialog.h"
+#include "Common/StringConvert.h"
+#include "Common/IntToString.h"
+#include "Windows/ResourceString.h"
+
+#ifdef LANG
+#include "../../LangUtils.h"
+#endif
+
+using namespace NWindows;
+
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDOK, 0x02000713 }
+};
+#endif
+
+void CMessagesDialog::AddMessageDirect(LPCWSTR message)
+{
+ int itemIndex = _messageList.GetItemCount();
+ LVITEMW item;
+ item.mask = LVIF_TEXT;
+ item.iItem = itemIndex;
+
+ wchar_t sz[32];
+ ConvertInt64ToString(itemIndex, sz);
+
+ item.pszText = sz;
+ item.iSubItem = 0;
+ _messageList.InsertItem(&item);
+
+ item.pszText = (LPWSTR)message;
+ item.iSubItem = 1;
+ _messageList.SetItem(&item);
+}
+
+void CMessagesDialog::AddMessage(LPCWSTR message)
+{
+ UString s = message;
+ while (!s.IsEmpty())
+ {
+ int pos = s.Find(L'\n');
+ if (pos < 0)
+ break;
+ AddMessageDirect(s.Left(pos));
+ s.Delete(0, pos + 1);
+ }
+ AddMessageDirect(s);
+}
+
+bool CMessagesDialog::OnInit()
+{
+ #ifdef LANG
+ LangSetWindowText(HWND(*this), 0x02000A00);
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+ _messageList.Attach(GetItem(IDC_MESSAGE_LIST));
+ _messageList.SetUnicodeFormat(true);
+
+ LVCOLUMNW columnInfo;
+ columnInfo.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
+ columnInfo.fmt = LVCFMT_LEFT;
+ columnInfo.pszText = L"#";
+ columnInfo.iSubItem = 0;
+ columnInfo.cx = 30;
+
+ _messageList.InsertColumn(0, &columnInfo);
+
+
+ columnInfo.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
+ columnInfo.fmt = LVCFMT_LEFT;
+ UString s =
+ #ifdef LANG
+ LangString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN, 0x02000A80);
+ #else
+ MyLoadStringW(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN);
+ #endif
+
+ columnInfo.pszText = (LPWSTR)(LPCWSTR)s;
+ columnInfo.iSubItem = 1;
+ columnInfo.cx = 600;
+
+ _messageList.InsertColumn(1, &columnInfo);
+
+ for(int i = 0; i < Messages->Size(); i++)
+ AddMessage((*Messages)[i]);
+
+ /*
+ if(_messageList.GetItemCount() > 0)
+ {
+ UINT aState = LVIS_SELECTED | LVIS_FOCUSED;
+ _messageList.SetItemState(0, aState, aState);
+ }
+ */
+ return CModalDialog::OnInit();
+}
diff --git a/CPP/7zip/FileManager/Resource/MessagesDialog/MessagesDialog.h b/CPP/7zip/FileManager/Resource/MessagesDialog/MessagesDialog.h
new file mode 100755
index 00000000..2ec22d80
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/MessagesDialog/MessagesDialog.h
@@ -0,0 +1,22 @@
+// MessagesDialog.h
+
+#ifndef __MESSAGESDIALOG_H
+#define __MESSAGESDIALOG_H
+
+#include "resource.h"
+
+#include "Windows/Control/Dialog.h"
+#include "Windows/Control/ListView.h"
+
+class CMessagesDialog: public NWindows::NControl::CModalDialog
+{
+ NWindows::NControl::CListView _messageList;
+ void AddMessageDirect(LPCWSTR message);
+ void AddMessage(LPCWSTR message);
+ virtual bool OnInit();
+public:
+ const UStringVector *Messages;
+ INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_DIALOG_MESSAGES, parent); }
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/MessagesDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/MessagesDialog/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/MessagesDialog/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/MessagesDialog/resource.h b/CPP/7zip/FileManager/Resource/MessagesDialog/resource.h
new file mode 100755
index 00000000..39d49f57
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/MessagesDialog/resource.h
@@ -0,0 +1,3 @@
+#define IDS_MESSAGES_DIALOG_MESSAGE_COLUMN 503
+#define IDD_DIALOG_MESSAGES 503
+#define IDC_MESSAGE_LIST 1000
diff --git a/CPP/7zip/FileManager/Resource/MessagesDialog/resource.rc b/CPP/7zip/FileManager/Resource/MessagesDialog/resource.rc
new file mode 100755
index 00000000..eae00bf0
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/MessagesDialog/resource.rc
@@ -0,0 +1,25 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 430
+#define ySize2 140
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+#define bXPos (xSize - marg - bXSize)
+#define bYPos (ySize - marg - bYSize)
+
+
+IDD_DIALOG_MESSAGES DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
+CAPTION "7-Zip: Diagnostic messages"
+MY_FONT
+BEGIN
+ DEFPUSHBUTTON "&Close", IDOK, bXPos, bYPos, bXSize, bYSize
+ CONTROL "List1",IDC_MESSAGE_LIST,"SysListView32",
+ LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,
+ marg, marg, xSize2, ySize2 - bYSize - 6
+END
+
+STRINGTABLE
+BEGIN
+ IDS_MESSAGES_DIALOG_MESSAGE_COLUMN "Message"
+END
diff --git a/CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.cpp b/CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.cpp
new file mode 100755
index 00000000..8f13a43a
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.cpp
@@ -0,0 +1,124 @@
+// OverwriteDialog.cpp
+
+#include "StdAfx.h"
+
+#include "OverwriteDialog.h"
+
+#include "Common/StringConvert.h"
+#include "Windows/FileName.h"
+#include "Windows/Defs.h"
+#include "Windows/ResourceString.h"
+#include "Windows/Control/Static.h"
+#include "Windows/PropVariantConversions.h"
+
+#include "../../FormatUtils.h"
+
+// #include "../resource.h"
+
+#ifdef LANG
+#include "../../LangUtils.h"
+#endif
+
+using namespace NWindows;
+
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_STATIC_OVERWRITE_HEADER, 0x02000901},
+ { IDC_STATIC_OVERWRITE_QUESTION_BEGIN, 0x02000902 },
+ { IDC_STATIC_OVERWRITE_QUESTION_END, 0x02000903 },
+ { IDYES, 0x02000705 },
+ { IDC_BUTTON_OVERWRITE_YES_TO_ALL, 0x02000707 },
+ { IDNO, 0x02000709 },
+ { IDC_BUTTON_OVERWRITE_NO_TO_ALL,0x0200070B },
+ { IDC_BUTTON_OVERWRITE_AUTO_RENAME, 0x02000911 },
+ { IDCANCEL, 0x02000711 }
+};
+#endif
+
+void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
+ const NOverwriteDialog::CFileInfo &fileInfo)
+{
+ UString sizeString;
+ if (fileInfo.SizeIsDefined)
+ sizeString = MyFormatNew(IDS_FILE_SIZE,
+ #ifdef LANG
+ 0x02000982,
+ #endif
+ NumberToString(fileInfo.Size));
+
+ UString reducedName;
+ const int kLineSize = 88;
+ for (int i = 0; i < fileInfo.Name.Length();)
+ {
+ reducedName += fileInfo.Name.Mid(i, kLineSize);
+ reducedName += L" ";
+ i += kLineSize;
+ }
+
+ UString fullString = reducedName;
+ fullString += L"\n";
+ fullString += sizeString;
+ fullString += L"\n";
+
+ if (fileInfo.TimeIsDefined)
+ {
+ UString timeString;
+ FILETIME localFileTime;
+ if (!FileTimeToLocalFileTime(&fileInfo.Time, &localFileTime))
+ throw 4190402;
+ timeString = ConvertFileTimeToString(localFileTime);
+
+ fullString +=
+ #ifdef LANG
+ LangString(IDS_FILE_MODIFIED, 0x02000983);
+ #else
+ MyLoadStringW(IDS_FILE_MODIFIED);
+ #endif
+
+ fullString += L" ";
+ fullString += timeString;
+ }
+
+ NWindows::NControl::CDialogChildControl control;
+ control.Init(*this, textID);
+ control.SetText(fullString);
+
+ SHFILEINFO shellFileInfo;
+ if (::SHGetFileInfo(
+ GetSystemString(fileInfo.Name), FILE_ATTRIBUTE_NORMAL, &shellFileInfo,
+ sizeof(shellFileInfo), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | SHGFI_LARGEICON))
+ {
+ NControl::CStatic staticContol;
+ staticContol.Attach(GetItem(iconID));
+ staticContol.SetIcon(shellFileInfo.hIcon);
+ }
+}
+
+bool COverwriteDialog::OnInit()
+{
+ #ifdef LANG
+ LangSetWindowText(HWND(*this), 0x02000900);
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+ SetFileInfoControl(IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME,
+ IDC_STATIC_OVERWRITE_OLD_FILE_ICON, OldFileInfo);
+ SetFileInfoControl(IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME,
+ IDC_STATIC_OVERWRITE_NEW_FILE_ICON, NewFileInfo);
+ return CModalDialog::OnInit();
+}
+
+bool COverwriteDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ case IDYES:
+ case IDC_BUTTON_OVERWRITE_YES_TO_ALL:
+ case IDNO:
+ case IDC_BUTTON_OVERWRITE_NO_TO_ALL:
+ case IDC_BUTTON_OVERWRITE_AUTO_RENAME:
+ End(buttonID);
+ return true;
+ }
+ return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
+}
diff --git a/CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.h b/CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.h
new file mode 100755
index 00000000..193efb85
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/OverwriteDialog/OverwriteDialog.h
@@ -0,0 +1,34 @@
+// OverwriteDialog.h
+
+#ifndef __OVERWRITEDIALOG_H
+#define __OVERWRITEDIALOG_H
+
+#include "resource.h"
+#include "Windows/Control/Dialog.h"
+
+namespace NOverwriteDialog
+{
+ struct CFileInfo
+ {
+ bool SizeIsDefined;
+ UINT64 Size;
+ bool TimeIsDefined;
+ FILETIME Time;
+ UString Name;
+ };
+}
+
+class COverwriteDialog: public NWindows::NControl::CModalDialog
+{
+ void SetFileInfoControl(int textID, int iconID,
+ const NOverwriteDialog::CFileInfo &fileInfo);
+ virtual bool OnInit();
+ bool OnButtonClicked(int buttonID, HWND buttonHWND);
+public:
+ INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_DIALOG_OVERWRITE, parent); }
+
+ NOverwriteDialog::CFileInfo OldFileInfo;
+ NOverwriteDialog::CFileInfo NewFileInfo;
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/OverwriteDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/OverwriteDialog/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/OverwriteDialog/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/OverwriteDialog/resource.h b/CPP/7zip/FileManager/Resource/OverwriteDialog/resource.h
new file mode 100755
index 00000000..66710f84
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/OverwriteDialog/resource.h
@@ -0,0 +1,19 @@
+#define IDS_FILE_MODIFIED 600
+#define IDS_FILE_SIZE 601
+
+#define IDD_DIALOG_OVERWRITE 502
+
+#define IDC_STATIC_OVERWRITE_HEADER 1000
+
+#define IDC_STATIC_OVERWRITE_QUESTION_BEGIN 1001
+#define IDC_STATIC_OVERWRITE_QUESTION_END 1002
+
+#define IDC_STATIC_OVERWRITE_OLD_FILE_ICON 1003
+#define IDC_STATIC_OVERWRITE_NEW_FILE_ICON 1004
+
+#define IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME 1005
+#define IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME 1006
+
+#define IDC_BUTTON_OVERWRITE_YES_TO_ALL 1010
+#define IDC_BUTTON_OVERWRITE_NO_TO_ALL 1011
+#define IDC_BUTTON_OVERWRITE_AUTO_RENAME 1012
diff --git a/CPP/7zip/FileManager/Resource/OverwriteDialog/resource.rc b/CPP/7zip/FileManager/Resource/OverwriteDialog/resource.rc
new file mode 100755
index 00000000..1a907955
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/OverwriteDialog/resource.rc
@@ -0,0 +1,47 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 357
+#define ySize2 204
+
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#undef iconSize
+#define iconSize 20
+
+#undef fiXPos
+#undef fiXSize
+#undef fiYSize
+#define fiXPos (iconSize + 12)
+#define fiXSize (xSize2 - fiXPos)
+#define fiYSize 50
+
+#define b1YPos (ySize - marg - bYSize)
+#define b2YPos (b1YPos - bYSize - 10)
+
+IDD_DIALOG_OVERWRITE DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
+CAPTION "Confirm File Replace"
+MY_FONT
+BEGIN
+ LTEXT "Destination folder already contains processed file.", IDC_STATIC_OVERWRITE_HEADER, marg, 7, xSize2, 8
+ LTEXT "Would you like to replace the existing file", IDC_STATIC_OVERWRITE_QUESTION_BEGIN, marg, 28, xSize2, 8
+ ICON "", IDC_STATIC_OVERWRITE_OLD_FILE_ICON, marg, 44, iconSize, iconSize
+ LTEXT "", IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME, fiXPos, 44, fiXSize, fiYSize, SS_NOPREFIX
+ LTEXT "with this one?",IDC_STATIC_OVERWRITE_QUESTION_END, marg, 98, xSize2, 8
+ ICON "",IDC_STATIC_OVERWRITE_NEW_FILE_ICON, marg, 114, iconSize, iconSize
+ LTEXT "",IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME, fiXPos, 114, fiXSize, fiYSize, SS_NOPREFIX
+ PUSHBUTTON "&Yes", IDYES, 78, b2YPos, bXSize, bYSize
+ PUSHBUTTON "Yes to &All", IDC_BUTTON_OVERWRITE_YES_TO_ALL, 152, b2YPos, bXSize, bYSize
+ PUSHBUTTON "&No", IDNO, 226, b2YPos, bXSize, bYSize
+ PUSHBUTTON "No to A&ll", IDC_BUTTON_OVERWRITE_NO_TO_ALL, 300, b2YPos, bXSize, bYSize
+ PUSHBUTTON "A&uto Rename", IDC_BUTTON_OVERWRITE_AUTO_RENAME, 181, b1YPos, 109, bYSize
+ PUSHBUTTON "&Cancel", IDCANCEL, 300, b1YPos, bXSize, bYSize
+END
+
+
+STRINGTABLE
+BEGIN
+ IDS_FILE_MODIFIED "modified on"
+ IDS_FILE_SIZE "{0} bytes"
+END
diff --git a/CPP/7zip/FileManager/Resource/PasswordDialog/PasswordDialog.cpp b/CPP/7zip/FileManager/Resource/PasswordDialog/PasswordDialog.cpp
new file mode 100755
index 00000000..4f09f7f7
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PasswordDialog/PasswordDialog.cpp
@@ -0,0 +1,50 @@
+// PasswordDialog.cpp
+
+#include "StdAfx.h"
+#include "PasswordDialog.h"
+
+#ifdef LANG
+#include "../../LangUtils.h"
+#endif
+
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_STATIC_PASSWORD_HEADER, 0x02000B01 },
+ { IDC_CHECK_PASSWORD_SHOW, 0x02000B02 },
+
+};
+#endif
+
+
+bool CPasswordDialog::OnInit()
+{
+ #ifdef LANG
+ LangSetWindowText(HWND(*this), 0x02000B00);
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+ _passwordControl.Attach(GetItem(IDC_EDIT_PASSWORD));
+ _passwordControl.SetText(Password);
+ _passwordControl.SetPasswordChar(TEXT('*'));
+ return CModalDialog::OnInit();
+}
+
+bool CPasswordDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ if (buttonID == IDC_CHECK_PASSWORD_SHOW)
+ {
+ _passwordControl.SetPasswordChar((IsButtonChecked(
+ IDC_CHECK_PASSWORD_SHOW) == BST_CHECKED) ? 0: TEXT('*'));
+ UString password;
+ _passwordControl.GetText(password);
+ _passwordControl.SetText(password);
+ return true;
+ }
+ return CDialog::OnButtonClicked(buttonID, buttonHWND);
+}
+
+void CPasswordDialog::OnOK()
+{
+ _passwordControl.GetText(Password);
+ CModalDialog::OnOK();
+}
diff --git a/CPP/7zip/FileManager/Resource/PasswordDialog/PasswordDialog.h b/CPP/7zip/FileManager/Resource/PasswordDialog/PasswordDialog.h
new file mode 100755
index 00000000..f77cd2be
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PasswordDialog/PasswordDialog.h
@@ -0,0 +1,21 @@
+// PasswordDialog.h
+
+#ifndef __PASSWORDDIALOG_H
+#define __PASSWORDDIALOG_H
+
+#include "Windows/Control/Dialog.h"
+#include "Windows/Control/Edit.h"
+#include "resource.h"
+
+class CPasswordDialog: public NWindows::NControl::CModalDialog
+{
+ NWindows::NControl::CEdit _passwordControl;
+ virtual void OnOK();
+ virtual bool OnInit();
+ virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
+public:
+ UString Password;
+ INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_PASSWORD, parentWindow); }
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/PasswordDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/PasswordDialog/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PasswordDialog/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/PasswordDialog/resource.h b/CPP/7zip/FileManager/Resource/PasswordDialog/resource.h
new file mode 100755
index 00000000..e0b42661
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PasswordDialog/resource.h
@@ -0,0 +1,4 @@
+#define IDD_DIALOG_PASSWORD 501
+#define IDC_STATIC_PASSWORD_HEADER 1000
+#define IDC_EDIT_PASSWORD 1001
+#define IDC_CHECK_PASSWORD_SHOW 1002
diff --git a/CPP/7zip/FileManager/Resource/PasswordDialog/resource.rc b/CPP/7zip/FileManager/Resource/PasswordDialog/resource.rc
new file mode 100755
index 00000000..7e2658c7
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PasswordDialog/resource.rc
@@ -0,0 +1,26 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 172
+#define ySize2 68
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#define bYPos (ySize - marg - bYSize)
+#define b1XPos (xSize - marg - bXSize)
+#define b2XPos (b1XPos - 10 - bXSize)
+
+
+IDD_DIALOG_PASSWORD DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
+CAPTION "Enter password"
+MY_FONT
+BEGIN
+ LTEXT "&Enter password:", IDC_STATIC_PASSWORD_HEADER, marg, marg, xSize2, 8
+ EDITTEXT IDC_EDIT_PASSWORD, marg , 19, xSize2, 14, ES_PASSWORD | ES_AUTOHSCROLL
+
+ CONTROL "&Show password", IDC_CHECK_PASSWORD_SHOW, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ marg, 41, xSize2, 10
+
+ DEFPUSHBUTTON "OK", IDOK, b2XPos, bYPos, bXSize, bYSize
+ PUSHBUTTON "Cancel", IDCANCEL, b1XPos, bYPos, bXSize, bYSize
+END
diff --git a/CPP/7zip/FileManager/Resource/PluginsPage/PluginsPage.cpp b/CPP/7zip/FileManager/Resource/PluginsPage/PluginsPage.cpp
new file mode 100755
index 00000000..0ccdf07e
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PluginsPage/PluginsPage.cpp
@@ -0,0 +1,220 @@
+// PluginsPage.cpp
+
+#include "StdAfx.h"
+#include "resource.h"
+#include "PluginsPage.h"
+
+#include "Common/StringConvert.h"
+#include "Common/MyCom.h"
+
+#include "Windows/Defs.h"
+#include "Windows/DLL.h"
+#include "Windows/Control/ListView.h"
+#include "Windows/FileFind.h"
+
+#include "../../RegistryUtils.h"
+#include "../../HelpUtils.h"
+#include "../../LangUtils.h"
+#include "../../ProgramLocation.h"
+
+#include "../../PluginInterface.h"
+
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_PLUGINS_STATIC_PLUGINS, 0x03010101},
+ { IDC_PLUGINS_BUTTON_OPTIONS, 0x03010110}
+};
+
+static LPCWSTR kPluginsTopic = L"FM/options.htm#plugins";
+
+bool CPluginsPage::OnInit()
+{
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+
+ _listView.Attach(GetItem(IDC_PLUGINS_LIST));
+
+ UINT32 newFlags = /*LVS_EX_CHECKBOXES | */ LVS_EX_FULLROWSELECT;
+ _listView.SetExtendedListViewStyle(newFlags, newFlags);
+
+ UString title = L"Plugins";
+ LVCOLUMNW column;
+ column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
+ column.cx = 160;
+ column.fmt = LVCFMT_LEFT;
+ column.pszText = (LPWSTR)(LPCWSTR)title;
+ column.iSubItem = 0;
+ _listView.InsertColumn(0, &column);
+
+ ReadFileFolderPluginInfoList(_plugins);
+
+ _listView.SetRedraw(false);
+ // _listView.DeleteAllItems();
+ for(int i = 0; i < _plugins.Size(); i++)
+ {
+ LVITEMW item;
+ item.iItem = i;
+ item.mask = LVIF_TEXT | LVIF_STATE;
+ UString pluginName = _plugins[i].Name;
+ item.pszText = (WCHAR *)(const WCHAR *)pluginName;
+ item.state = 0;
+ item.stateMask = UINT(-1);
+ item.iSubItem = 0;
+ _listView.InsertItem(&item);
+ _listView.SetCheckState(i, true);
+ }
+ _listView.SetRedraw(true);
+ if(_listView.GetItemCount() > 0)
+ {
+ UINT state = LVIS_SELECTED | LVIS_FOCUSED;
+ _listView.SetItemState(0, state, state);
+ }
+
+ return CPropertyPage::OnInit();
+}
+
+LONG CPluginsPage::OnApply()
+{
+ /*
+ int selectedIndex = m_Lang.GetCurSel();
+ int aPathIndex = m_Lang.GetItemData(selectedIndex);
+ SaveRegLang(m_Paths[aPathIndex]);
+ ReloadLang();
+ */
+ return PSNRET_NOERROR;
+}
+
+void CPluginsPage::OnNotifyHelp()
+{
+ ShowHelpWindow(NULL, kPluginsTopic);
+}
+
+bool CPluginsPage::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ case IDC_PLUGINS_BUTTON_OPTIONS:
+ OnButtonOptions();
+ break;
+ default:
+ return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
+ }
+ return true;
+}
+
+class CPluginOptionsCallback:
+ public IPluginOptionsCallback,
+ public CMyUnknownImp
+{
+ UString _pluginName;
+public:
+ MY_UNKNOWN_IMP
+
+ STDMETHOD(GetProgramFolderPath)(BSTR *value);
+ STDMETHOD(GetProgramPath)(BSTR *Value);
+ STDMETHOD(GetRegistryCUPath)(BSTR *Value);
+ void Init(const UString &pluginName)
+ { _pluginName = pluginName; }
+};
+
+STDMETHODIMP CPluginOptionsCallback::GetProgramFolderPath(BSTR *value)
+{
+ *value = 0;
+ UString folder;
+ if (!::GetProgramFolderPath(folder))
+ return E_FAIL;
+ CMyComBSTR valueTemp = folder;
+ *value = valueTemp.Detach();
+ return S_OK;
+}
+
+static UString GetDefaultProgramName()
+{
+ return L"7zFM.exe";
+}
+
+STDMETHODIMP CPluginOptionsCallback::GetProgramPath(BSTR *value)
+{
+ *value = 0;
+ UString folder;
+ if (!::GetProgramFolderPath(folder))
+ return E_FAIL;
+ CMyComBSTR valueTemp = folder + GetDefaultProgramName();
+ *value = valueTemp.Detach();
+ return S_OK;
+}
+
+STDMETHODIMP CPluginOptionsCallback::GetRegistryCUPath(BSTR *value)
+{
+ CMyComBSTR valueTemp = UString(L"Software\\7-Zip\\FM\\Plugins\\") + _pluginName;
+ *value = valueTemp.Detach();
+ return S_OK;
+}
+
+void CPluginsPage::OnButtonOptions()
+{
+ int index = _listView.GetSelectionMark();
+ if (index < 0)
+ return;
+
+ CPluginInfo pluginInfo = _plugins[index];
+ if (!pluginInfo.OptionsClassIDDefined)
+ {
+ MessageBoxW(HWND(*this), L"There are no options", L"7-Zip", 0);
+ return;
+ }
+ NWindows::NDLL::CLibrary library;
+ CMyComPtr<IPluginOptions> pluginOptions;
+ if (!library.Load(pluginInfo.FilePath))
+ {
+ MessageBoxW(HWND(*this), L"Can't load plugin", L"7-Zip", 0);
+ return;
+ }
+ typedef UINT32 (WINAPI * CreateObjectPointer)(
+ const GUID *clsID, const GUID *interfaceID, void **outObject);
+ CreateObjectPointer createObject = (CreateObjectPointer)
+ library.GetProcAddress("CreateObject");
+ if (createObject == NULL)
+ {
+ MessageBoxW(HWND(*this), L"Incorrect plugin", L"7-Zip", 0);
+ return;
+ }
+ if (createObject(&pluginInfo.OptionsClassID, &IID_IPluginOptions, (void **)&pluginOptions) != S_OK)
+ {
+ MessageBoxW(HWND(*this), L"There are no options", L"7-Zip", 0);
+ return;
+ }
+ CPluginOptionsCallback *callbackSpec = new CPluginOptionsCallback;
+ CMyComPtr<IPluginOptionsCallback> callback(callbackSpec);
+ callbackSpec->Init(pluginInfo.Name);
+ pluginOptions->PluginOptions(HWND(*this), callback);
+}
+
+bool CPluginsPage::OnNotify(UINT controlID, LPNMHDR lParam)
+{
+ if (lParam->hwndFrom == HWND(_listView) && lParam->code == LVN_ITEMCHANGED)
+ {
+ const NMLISTVIEW *aNMListView = (const NMLISTVIEW *)lParam;
+ if ((aNMListView->uChanged & LVIF_STATE) != 0)
+ {
+ UINT oldState = aNMListView->uOldState & LVIS_STATEIMAGEMASK;
+ UINT newState = aNMListView->uNewState & LVIS_STATEIMAGEMASK;
+ if (oldState != newState)
+ Changed();
+ }
+ return true;
+ }
+ return CPropertyPage::OnNotify(controlID, lParam);
+}
+
+/*
+bool CPluginsPage::OnCommand(int code, int itemID, LPARAM lParam)
+{
+ if (code == CBN_SELCHANGE && itemID == IDC_LANG_COMBO_LANG)
+ {
+ Changed();
+ return true;
+ }
+ return CPropertyPage::OnCommand(code, itemID, lParam);
+}
+
+*/ \ No newline at end of file
diff --git a/CPP/7zip/FileManager/Resource/PluginsPage/PluginsPage.h b/CPP/7zip/FileManager/Resource/PluginsPage/PluginsPage.h
new file mode 100755
index 00000000..78e81dbb
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PluginsPage/PluginsPage.h
@@ -0,0 +1,26 @@
+// PluginsPage.h
+
+#include "Windows/Control/ListView.h"
+
+#ifndef __PLUGINSPAGE_H
+#define __PLUGINSPAGE_H
+
+#include "Windows/Control/PropertyPage.h"
+#include "Windows/Control/ComboBox.h"
+
+#include "../../RegistryPlugins.h"
+
+class CPluginsPage: public NWindows::NControl::CPropertyPage
+{
+ NWindows::NControl::CListView _listView;
+ CObjectVector<CPluginInfo> _plugins;
+public:
+ virtual bool OnInit();
+ virtual void OnNotifyHelp();
+ virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
+ virtual void OnButtonOptions();
+ virtual LONG OnApply();
+ virtual bool OnNotify(UINT controlID, LPNMHDR lParam);
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/PluginsPage/StdAfx.h b/CPP/7zip/FileManager/Resource/PluginsPage/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PluginsPage/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/PluginsPage/resource.h b/CPP/7zip/FileManager/Resource/PluginsPage/resource.h
new file mode 100755
index 00000000..8fc923ee
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PluginsPage/resource.h
@@ -0,0 +1,4 @@
+#define IDD_PLUGINS 901
+#define IDC_PLUGINS_STATIC_PLUGINS 1000
+#define IDC_PLUGINS_LIST 1001
+#define IDC_PLUGINS_BUTTON_OPTIONS 1002
diff --git a/CPP/7zip/FileManager/Resource/PluginsPage/resource.rc b/CPP/7zip/FileManager/Resource/PluginsPage/resource.rc
new file mode 100755
index 00000000..7b74107b
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PluginsPage/resource.rc
@@ -0,0 +1,19 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 196
+#define ySize2 140
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+
+IDD_PLUGINS DIALOG 0, 0, xSize, ySize MY_PAGE_STYLE
+CAPTION "Plugins"
+MY_FONT
+BEGIN
+ LTEXT "&Plugins:", IDC_PLUGINS_STATIC_PLUGINS, marg, marg, xSize2, 8
+ CONTROL "List1", IDC_PLUGINS_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS |
+ LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,
+ marg, 20, xSize2 - bXSize - 12, ySize2 - 12
+ PUSHBUTTON "Options...", IDC_PLUGINS_BUTTON_OPTIONS, (xSize - marg - bXSize), 20, bXSize, bYSize
+END
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp b/CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp
new file mode 100755
index 00000000..ea0f6fd6
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp
@@ -0,0 +1,175 @@
+// ProgressDialog.cpp
+
+#include "StdAfx.h"
+#include "resource.h"
+#include "ProgressDialog.h"
+#include "Common/IntToString.h"
+#include "Common/IntToString.h"
+
+using namespace NWindows;
+
+static const UINT_PTR kTimerID = 3;
+static const UINT kTimerElapse = 50;
+
+#ifdef LANG
+#include "../../LangUtils.h"
+#endif
+
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDCANCEL, 0x02000711 }
+};
+#endif
+
+#ifndef _SFX
+CProgressDialog::~CProgressDialog()
+{
+ AddToTitle(TEXT(""));
+}
+void CProgressDialog::AddToTitle(LPCWSTR s)
+{
+ if (MainWindow != 0)
+ ::MySetWindowText(MainWindow, UString(s) + MainTitle);
+}
+#endif
+
+
+
+bool CProgressDialog::OnInit()
+{
+ _range = UINT64(-1);
+ _prevPercentValue = -1;
+
+ #ifdef LANG
+ // LangSetWindowText(HWND(*this), 0x02000C00);
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+
+ m_ProgressBar.Attach(GetItem(IDC_PROGRESS1));
+ _timer = SetTimer(kTimerID, kTimerElapse);
+ _dialogCreatedEvent.Set();
+ SetText(_title);
+ return CModalDialog::OnInit();
+}
+
+void CProgressDialog::OnCancel()
+{
+ ProgressSynch.SetStopped(true);
+}
+
+void CProgressDialog::SetRange(UINT64 range)
+{
+ _range = range;
+ _peviousPos = (UInt64)(Int64)-1;
+ _converter.Init(range);
+ m_ProgressBar.SetRange32(0 , _converter.Count(range)); // Test it for 100%
+}
+
+void CProgressDialog::SetPos(UINT64 pos)
+{
+ bool redraw = true;
+ if (pos < _range && pos > _peviousPos)
+ {
+ UINT64 posDelta = pos - _peviousPos;
+ if (posDelta < (_range >> 10))
+ redraw = false;
+ }
+ if(redraw)
+ {
+ m_ProgressBar.SetPos(_converter.Count(pos)); // Test it for 100%
+ _peviousPos = pos;
+ }
+}
+
+bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
+{
+ if (ProgressSynch.GetPaused())
+ return true;
+ UINT64 total, completed;
+ ProgressSynch.GetProgress(total, completed);
+ if (total != _range)
+ SetRange(total);
+ SetPos(completed);
+
+ if (total == 0)
+ total = 1;
+
+ int percentValue = (int)(completed * 100 / total);
+ if (percentValue != _prevPercentValue)
+ {
+ wchar_t s[64];
+ ConvertUInt64ToString(percentValue, s);
+ UString title = s;
+ title += L"% ";
+ SetText(title + _title);
+ #ifndef _SFX
+ AddToTitle(title + MainAddTitle);
+ #endif
+ _prevPercentValue = percentValue;
+ }
+ return true;
+}
+
+
+////////////////////
+// CU64ToI32Converter
+
+static const UINT64 kMaxIntValue = 0x7FFFFFFF;
+
+void CU64ToI32Converter::Init(UINT64 range)
+{
+ _numShiftBits = 0;
+ while(range > kMaxIntValue)
+ {
+ range >>= 1;
+ _numShiftBits++;
+ }
+}
+
+int CU64ToI32Converter::Count(UINT64 aValue)
+{
+ return int(aValue >> _numShiftBits);
+}
+
+const UINT CProgressDialog::kCloseMessage = WM_USER + 1;
+
+bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch(message)
+ {
+ case kCloseMessage:
+ {
+ KillTimer(_timer);
+ _timer = 0;
+ End(0);
+ return true;
+ }
+ case WM_SETTEXT:
+ {
+ if (_timer == 0)
+ return true;
+ }
+ }
+ return CModalDialog::OnMessage(message, wParam, lParam);
+}
+
+bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ case IDCANCEL:
+ {
+ bool paused = ProgressSynch.GetPaused();;
+ ProgressSynch.SetPaused(true);
+ int res = ::MessageBoxW(HWND(*this),
+ L"Are you sure you want to cancel?",
+ _title, MB_YESNOCANCEL);
+ ProgressSynch.SetPaused(paused);
+ if (res == IDCANCEL || res == IDNO)
+ return true;
+ break;
+ }
+ }
+ return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
+}
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.h b/CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.h
new file mode 100755
index 00000000..e11ffc51
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.h
@@ -0,0 +1,129 @@
+// ProgressDialog.h
+
+#ifndef __PROGRESSDIALOG_H
+#define __PROGRESSDIALOG_H
+
+#include "resource.h"
+
+#include "Windows/Control/Dialog.h"
+#include "Windows/Control/ProgressBar.h"
+#include "Windows/Synchronization.h"
+
+class CProgressSynch
+{
+ NWindows::NSynchronization::CCriticalSection _criticalSection;
+ bool _stopped;
+ bool _paused;
+ UINT64 _total;
+ UINT64 _completed;
+public:
+ CProgressSynch(): _stopped(false), _paused(false), _total(1), _completed(0) {}
+
+ bool GetStopped()
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ return _stopped;
+ }
+ void SetStopped(bool value)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ _stopped = value;
+ }
+ bool GetPaused()
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ return _paused;
+ }
+ void SetPaused(bool value)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ _paused = value;
+ }
+ void SetProgress(UINT64 total, UINT64 completed)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ _total = total;
+ _completed = completed;
+ }
+ void SetPos(UINT64 completed)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ _completed = completed;
+ }
+ void GetProgress(UINT64 &total, UINT64 &completed)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ total = _total;
+ completed = _completed;
+ }
+};
+
+class CU64ToI32Converter
+{
+ UINT64 _numShiftBits;
+public:
+ void Init(UINT64 _range);
+ int Count(UINT64 aValue);
+};
+
+// class CProgressDialog: public NWindows::NControl::CModelessDialog
+
+class CProgressDialog: public NWindows::NControl::CModalDialog
+{
+private:
+ UINT_PTR _timer;
+
+ UString _title;
+ CU64ToI32Converter _converter;
+ UINT64 _peviousPos;
+ UINT64 _range;
+ NWindows::NControl::CProgressBar m_ProgressBar;
+
+ int _prevPercentValue;
+
+ bool OnTimer(WPARAM timerID, LPARAM callback);
+ void SetRange(UINT64 range);
+ void SetPos(UINT64 pos);
+ virtual bool OnInit();
+ virtual void OnCancel();
+ NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
+ #ifndef _SFX
+ void AddToTitle(LPCWSTR string);
+ #endif
+ bool OnButtonClicked(int buttonID, HWND buttonHWND);
+public:
+ CProgressSynch ProgressSynch;
+
+ #ifndef _SFX
+ HWND MainWindow;
+ UString MainTitle;
+ UString MainAddTitle;
+ ~CProgressDialog();
+ #endif
+
+ CProgressDialog(): _timer(0)
+ #ifndef _SFX
+ ,MainWindow(0)
+ #endif
+ {}
+
+ void WaitCreating() { _dialogCreatedEvent.Lock(); }
+
+
+ INT_PTR Create(const UString &title, HWND wndParent = 0)
+ {
+ _title = title;
+ return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
+ }
+
+ static const UINT kCloseMessage;
+
+ virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
+
+ void MyClose()
+ {
+ PostMessage(kCloseMessage);
+ };
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/ProgressDialog/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog/resource.h b/CPP/7zip/FileManager/Resource/ProgressDialog/resource.h
new file mode 100755
index 00000000..97e47228
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog/resource.h
@@ -0,0 +1,3 @@
+#define IDD_DIALOG_PROGRESS 500
+
+#define IDC_PROGRESS1 1000
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog/resource.rc b/CPP/7zip/FileManager/Resource/ProgressDialog/resource.rc
new file mode 100755
index 00000000..a6b375ed
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog/resource.rc
@@ -0,0 +1,20 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 172
+#define ySize2 42
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#define bYPos (ySize - marg - bYSize)
+#define bXPos (xSize - marg - bXSize)
+
+
+IDD_DIALOG_PROGRESS DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
+CAPTION "Progress"
+MY_FONT
+BEGIN
+ PUSHBUTTON "Cancel", IDCANCEL, bXPos, bYPos , bXSize, bYSize
+ CONTROL "Progress1", IDC_PROGRESS1,"msctls_progress32",PBS_SMOOTH | WS_BORDER,
+ marg,marg, xSize2, 14
+END
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.cpp b/CPP/7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.cpp
new file mode 100755
index 00000000..e5a496bd
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.cpp
@@ -0,0 +1,432 @@
+// ProgressDialog.cpp
+
+#include "StdAfx.h"
+#include "resource.h"
+#include "ProgressDialog.h"
+#include "Common/IntToString.h"
+#include "Common/IntToString.h"
+
+using namespace NWindows;
+
+static const UINT_PTR kTimerID = 3;
+static const UINT kTimerElapse = 50;
+
+#ifdef LANG
+#include "../../LangUtils.h"
+#endif
+
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDCANCEL, 0x02000C00 },
+ { IDC_PROGRESS_ELAPSED, 0x02000C01 },
+ { IDC_PROGRESS_REMAINING, 0x02000C02 },
+ { IDC_PROGRESS_TOTAL, 0x02000C03 },
+ { IDC_PROGRESS_SPEED, 0x02000C04 },
+ { IDC_BUTTON_PROGRESS_PRIORITY, 0x02000C10 },
+ { IDC_BUTTON_PAUSE, 0x02000C12 },
+ { IDCANCEL, 0x02000711 },
+};
+#endif
+
+HRESULT CProgressSynch::SetPosAndCheckPaused(UInt64 completed)
+{
+ for (;;)
+ {
+ if(GetStopped())
+ return E_ABORT;
+ if(!GetPaused())
+ break;
+ ::Sleep(100);
+ }
+ SetPos(completed);
+ return S_OK;
+}
+
+#ifndef _SFX
+CProgressDialog::~CProgressDialog()
+{
+ AddToTitle(L"");
+}
+void CProgressDialog::AddToTitle(LPCWSTR s)
+{
+ if (MainWindow != 0)
+ {
+ CWindow window(MainWindow);
+ window.SetText(s + UString(MainTitle));
+ }
+}
+
+static const int kTitleFileNameSizeLimit = 36;
+static const int kCurrentFileNameSizeLimit = 68;
+
+static void ReduceString(UString &s, int size)
+{
+ if (s.Length() > size)
+ s = s.Left(size / 2) + UString(L" ... ") + s.Right(size / 2);
+}
+#endif
+
+bool CProgressDialog::OnInit()
+{
+ _range = (UInt64)(Int64)(-1);
+ _prevPercentValue = UInt32(-1);
+ _prevElapsedSec = UInt32(-1);
+ _prevRemainingSec = UInt32(-1);
+ _prevSpeed = UInt32(-1);
+ _prevMode = kSpeedBytes;
+ _prevTime = ::GetTickCount();
+ _elapsedTime = 0;
+ _foreground = true;
+
+ #ifdef LANG
+ // LangSetWindowText(HWND(*this), 0x02000C00);
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+
+
+ CWindow window(GetItem(IDC_BUTTON_PROGRESS_PRIORITY));
+ window.GetText(backgroundString);
+ backgroundedString = backgroundString;
+ backgroundedString.Replace(L"&", L"");
+
+ window = GetItem(IDC_BUTTON_PAUSE);
+ window.GetText(pauseString);
+
+ foregroundString = LangString(IDS_PROGRESS_FOREGROUND, 0x02000C11);
+ continueString = LangString(IDS_PROGRESS_CONTINUE, 0x02000C13);
+ pausedString = LangString(IDS_PROGRESS_PAUSED, 0x02000C20);
+
+ m_ProgressBar.Attach(GetItem(IDC_PROGRESS1));
+ _timer = SetTimer(kTimerID, kTimerElapse);
+ _dialogCreatedEvent.Set();
+ SetText(_title);
+ SetPauseText();
+ SetPriorityText();
+ return CModalDialog::OnInit();
+}
+
+void CProgressDialog::OnCancel()
+{
+ ProgressSynch.SetStopped(true);
+}
+
+static void ConvertSizeToString(UInt64 value, wchar_t *s)
+{
+ const wchar_t *kModif = L" KMGTP";
+ for (int i = 0; ; i++)
+ if (i == 5 || value < (UInt64(10000) << (i * 10)))
+ {
+ ConvertUInt64ToString(value >> (i * 10), s);
+ s += wcslen(s);
+ *s++ = ' ';
+ if (i != 0)
+ *s++ = kModif[i];
+ *s++ = L'B';
+ *s++ = L'\0';
+ return;
+ }
+}
+
+void CProgressDialog::SetRange(UInt64 range)
+{
+ _range = range;
+ _previousPos = (UInt64)(Int64)-1;
+ _converter.Init(range);
+ m_ProgressBar.SetRange32(0 , _converter.Count(range)); // Test it for 100%
+
+ wchar_t s[32];
+ ConvertSizeToString(_range, s);
+ SetItemText(IDC_PROGRESS_SPEED_TOTAL_VALUE, s);
+}
+
+void CProgressDialog::SetPos(UInt64 pos)
+{
+ bool redraw = true;
+ if (pos < _range && pos > _previousPos)
+ {
+ if (pos - _previousPos < (_range >> 10))
+ redraw = false;
+ }
+ if(redraw)
+ {
+ m_ProgressBar.SetPos(_converter.Count(pos)); // Test it for 100%
+ _previousPos = pos;
+ }
+}
+
+static void GetTimeString(UInt64 timeValue, TCHAR *s)
+{
+ wsprintf(s, TEXT("%02d:%02d:%02d"),
+ UInt32(timeValue / 3600),
+ UInt32((timeValue / 60) % 60),
+ UInt32(timeValue % 60));
+}
+
+bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
+{
+ if (ProgressSynch.GetPaused())
+ return true;
+ UInt64 total, completed;
+ ProgressSynch.GetProgress(total, completed);
+
+ UInt32 curTime = ::GetTickCount();
+
+ if (total != _range)
+ SetRange(total);
+ if (total == (UInt64)(Int64)-1)
+ {
+ SetPos(0);
+ SetRange(completed);
+ }
+ else
+ SetPos(completed);
+
+ _elapsedTime += (curTime - _prevTime);
+ _prevTime = curTime;
+
+ UInt32 elapsedSec = _elapsedTime / 1000;
+
+ bool elapsedChanged = false;
+ if (elapsedSec != _prevElapsedSec)
+ {
+ TCHAR s[40];
+ GetTimeString(elapsedSec, s);
+ SetItemText(IDC_PROGRESS_ELAPSED_VALUE, s);
+ _prevElapsedSec = elapsedSec;
+ elapsedChanged = true;
+ }
+
+ if (completed != 0 && elapsedChanged)
+ {
+ if (total == (UInt64)(Int64)-1)
+ {
+ SetItemText(IDC_PROGRESS_REMAINING_VALUE, L"");
+ }
+ else
+ {
+ UInt64 remainingTime = 0;
+ if (completed < total)
+ remainingTime = _elapsedTime * (total - completed) / completed;
+ UInt64 remainingSec = remainingTime / 1000;
+ if (remainingSec != _prevRemainingSec)
+ {
+ TCHAR s[40];
+ GetTimeString(remainingSec, s);
+ SetItemText(IDC_PROGRESS_REMAINING_VALUE, s);
+ _prevRemainingSec = remainingSec;
+ }
+ }
+ // if (elapsedChanged)
+ {
+ UInt64 speedB = (completed * 1000) / _elapsedTime;
+ UInt64 speedKB = speedB / 1024;
+ UInt64 speedMB = speedKB / 1024;
+ const UInt32 kLimit1 = 10;
+ TCHAR s[40];
+ bool needRedraw = false;
+ if (speedMB >= kLimit1)
+ {
+ if (_prevMode != kSpeedMBytes || speedMB != _prevSpeed)
+ {
+ ConvertUInt64ToString(speedMB, s);
+ lstrcat(s, TEXT(" MB/s"));
+ _prevMode = kSpeedMBytes;
+ _prevSpeed = speedMB;
+ needRedraw = true;
+ }
+ }
+ else if (speedKB >= kLimit1)
+ {
+ if (_prevMode != kSpeedKBytes || speedKB != _prevSpeed)
+ {
+ ConvertUInt64ToString(speedKB, s);
+ lstrcat(s, TEXT(" KB/s"));
+ _prevMode = kSpeedKBytes;
+ _prevSpeed = speedKB;
+ needRedraw = true;
+ }
+ }
+ else
+ {
+ if (_prevMode != kSpeedBytes || speedB != _prevSpeed)
+ {
+ ConvertUInt64ToString(speedB, s);
+ lstrcat(s, TEXT(" B/s"));
+ _prevMode = kSpeedBytes;
+ _prevSpeed = speedB;
+ needRedraw = true;
+ }
+ }
+ if (needRedraw)
+ SetItemText(IDC_PROGRESS_SPEED_VALUE, s);
+ }
+ }
+
+ if (total == 0)
+ total = 1;
+ UInt32 percentValue = (UInt32)(completed * 100 / total);
+ UString titleName;
+ ProgressSynch.GetTitleFileName(titleName);
+ if (percentValue != _prevPercentValue || _prevTitleName != titleName)
+ {
+ _prevPercentValue = percentValue;
+ SetTitleText();
+ _prevTitleName = titleName;
+ }
+ UString fileName;
+ ProgressSynch.GetCurrentFileName(fileName);
+ if (_prevFileName != fileName)
+ {
+ ReduceString(fileName, kCurrentFileNameSizeLimit);
+ SetItemText(IDC_PROGRESS_FILE_NAME, fileName);
+ _prevFileName == fileName;
+ }
+
+ return true;
+}
+
+
+////////////////////
+// CU64ToI32Converter
+
+static const UInt64 kMaxIntValue = 0x7FFFFFFF;
+
+void CU64ToI32Converter::Init(UInt64 range)
+{
+ _numShiftBits = 0;
+ while(range > kMaxIntValue)
+ {
+ range >>= 1;
+ _numShiftBits++;
+ }
+}
+
+int CU64ToI32Converter::Count(UInt64 aValue)
+{
+ return int(aValue >> _numShiftBits);
+}
+
+const UINT CProgressDialog::kCloseMessage = WM_USER + 1;
+
+bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch(message)
+ {
+ case kCloseMessage:
+ {
+ KillTimer(_timer);
+ _timer = 0;
+ End(0);
+ return true;
+ }
+ case WM_SETTEXT:
+ {
+ if (_timer == 0)
+ return true;
+ }
+ }
+ return CModalDialog::OnMessage(message, wParam, lParam);
+}
+
+void CProgressDialog::SetTitleText()
+{
+ UString title;
+ if (ProgressSynch.GetPaused())
+ {
+ title = pausedString;
+ title += L" ";
+ }
+ if (_prevPercentValue != UInt32(-1))
+ {
+ wchar_t s[64];
+ ConvertUInt64ToString(_prevPercentValue, s);
+ title += s;
+ title += L"%";
+ }
+ if (!_foreground)
+ {
+ title += L" ";
+ title += backgroundedString;
+ }
+ title += L" ";
+ UString totalTitle = title + _title;
+ UString fileName;
+ ProgressSynch.GetTitleFileName(fileName);
+ if (!fileName.IsEmpty())
+ {
+ ReduceString(fileName, kTitleFileNameSizeLimit);
+ totalTitle += L" ";
+ totalTitle += fileName;
+ }
+ SetText(totalTitle);
+ #ifndef _SFX
+ AddToTitle(title + MainAddTitle);
+ #endif
+}
+
+void CProgressDialog::SetPauseText()
+{
+ SetItemText(IDC_BUTTON_PAUSE, ProgressSynch.GetPaused() ?
+ continueString : pauseString);
+ SetTitleText();
+}
+
+void CProgressDialog::OnPauseButton()
+{
+ bool paused = !ProgressSynch.GetPaused();
+ ProgressSynch.SetPaused(paused);
+ UInt32 curTime = ::GetTickCount();
+ if (paused)
+ _elapsedTime += (curTime - _prevTime);
+ _prevTime = curTime;
+ SetPauseText();
+}
+
+void CProgressDialog::SetPriorityText()
+{
+ SetItemText(IDC_BUTTON_PROGRESS_PRIORITY, _foreground ?
+ backgroundString :
+ foregroundString);
+ SetTitleText();
+}
+
+void CProgressDialog::OnPriorityButton()
+{
+ _foreground = !_foreground;
+ SetPriorityClass(GetCurrentProcess(), _foreground ?
+ NORMAL_PRIORITY_CLASS: IDLE_PRIORITY_CLASS);
+ SetPriorityText();
+}
+
+bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ case IDCANCEL:
+ {
+ bool paused = ProgressSynch.GetPaused();;
+ // ProgressSynch.SetPaused(true);
+ if (!paused)
+ OnPauseButton();
+ int res = ::MessageBoxW(HWND(*this),
+ LangString(IDS_PROGRESS_ASK_CANCEL, 0x02000C30),
+ _title, MB_YESNOCANCEL);
+ // ProgressSynch.SetPaused(paused);
+ if (!paused)
+ OnPauseButton();
+ if (res == IDCANCEL || res == IDNO)
+ return true;
+ break;
+ }
+ case IDC_BUTTON_PAUSE:
+ OnPauseButton();
+ return true;
+ case IDC_BUTTON_PROGRESS_PRIORITY:
+ {
+ OnPriorityButton();
+ return true;
+ }
+ }
+ return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
+}
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.h b/CPP/7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.h
new file mode 100755
index 00000000..0625eadd
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog2/ProgressDialog.h
@@ -0,0 +1,184 @@
+// ProgressDialog.h
+
+#ifndef __PROGRESSDIALOG_H
+#define __PROGRESSDIALOG_H
+
+#include "resource.h"
+
+#include "Common/Types.h"
+
+#include "Windows/Control/Dialog.h"
+#include "Windows/Control/ProgressBar.h"
+#include "Windows/Synchronization.h"
+
+class CProgressSynch
+{
+ NWindows::NSynchronization::CCriticalSection _criticalSection;
+ bool _stopped;
+ bool _paused;
+ UInt64 _total;
+ UInt64 _completed;
+ UString TitleFileName;
+ UString CurrentFileName;
+public:
+ CProgressSynch(): _stopped(false), _paused(false), _total((UInt64)(Int64)-1), _completed(0) {}
+
+ bool GetStopped()
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ return _stopped;
+ }
+ void SetStopped(bool value)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ _stopped = value;
+ }
+ bool GetPaused()
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ return _paused;
+ }
+ void SetPaused(bool value)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ _paused = value;
+ }
+ void SetProgress(UInt64 total, UInt64 completed)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ _total = total;
+ _completed = completed;
+ }
+ void SetPos(UInt64 completed)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ _completed = completed;
+ }
+ HRESULT SetPosAndCheckPaused(UInt64 completed);
+ void GetProgress(UInt64 &total, UInt64 &completed)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ total = _total;
+ completed = _completed;
+ }
+ void SetTitleFileName(const UString &fileName)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ TitleFileName = fileName;
+ }
+ void GetTitleFileName(UString &fileName)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ fileName = TitleFileName;
+ }
+ void SetCurrentFileName(const UString &fileName)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ CurrentFileName = fileName;
+ }
+ void GetCurrentFileName(UString &fileName)
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ fileName = CurrentFileName;
+ }
+};
+
+class CU64ToI32Converter
+{
+ UInt64 _numShiftBits;
+public:
+ void Init(UInt64 _range);
+ int Count(UInt64 aValue);
+};
+
+// class CProgressDialog: public NWindows::NControl::CModelessDialog
+
+enum ESpeedMode
+{
+ kSpeedBytes,
+ kSpeedKBytes,
+ kSpeedMBytes
+};
+
+class CProgressDialog: public NWindows::NControl::CModalDialog
+{
+ UString _prevFileName;
+ UString _prevTitleName;
+private:
+ UString backgroundString;
+ UString backgroundedString;
+ UString foregroundString;
+ UString pauseString;
+ UString continueString;
+ UString pausedString;
+
+
+
+ UINT_PTR _timer;
+
+ UString _title;
+ CU64ToI32Converter _converter;
+ UInt64 _previousPos;
+ UInt64 _range;
+ NWindows::NControl::CProgressBar m_ProgressBar;
+
+ UInt32 _prevPercentValue;
+ UInt32 _prevTime;
+ UInt32 _elapsedTime;
+ UInt32 _prevElapsedSec;
+ UInt64 _prevRemainingSec;
+ ESpeedMode _prevMode;
+ UInt64 _prevSpeed;
+
+ bool _foreground;
+
+ bool OnTimer(WPARAM timerID, LPARAM callback);
+ void SetRange(UInt64 range);
+ void SetPos(UInt64 pos);
+ virtual bool OnInit();
+ virtual void OnCancel();
+ NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
+ #ifndef _SFX
+ void AddToTitle(LPCWSTR string);
+ #endif
+
+ void SetPauseText();
+ void SetPriorityText();
+ void OnPauseButton();
+ void OnPriorityButton();
+ bool OnButtonClicked(int buttonID, HWND buttonHWND);
+
+ void SetTitleText();
+public:
+ CProgressSynch ProgressSynch;
+
+ #ifndef _SFX
+ HWND MainWindow;
+ UString MainTitle;
+ UString MainAddTitle;
+ ~CProgressDialog();
+ #endif
+
+ CProgressDialog(): _timer(0)
+ #ifndef _SFX
+ ,MainWindow(0)
+ #endif
+ {}
+
+ void WaitCreating() { _dialogCreatedEvent.Lock(); }
+
+
+ INT_PTR Create(const UString &title, HWND wndParent = 0)
+ {
+ _title = title;
+ return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
+ }
+
+ static const UINT kCloseMessage;
+
+ virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
+
+ void MyClose() { PostMessage(kCloseMessage); };
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog2/StdAfx.h b/CPP/7zip/FileManager/Resource/ProgressDialog2/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog2/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog2/resource.h b/CPP/7zip/FileManager/Resource/ProgressDialog2/resource.h
new file mode 100755
index 00000000..be1da4ad
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog2/resource.h
@@ -0,0 +1,17 @@
+#define IDC_BUTTON_PAUSE 3
+#define IDC_BUTTON_PROGRESS_PRIORITY 4
+#define IDD_DIALOG_PROGRESS 500
+#define IDS_PROGRESS_PAUSED 700
+#define IDS_PROGRESS_FOREGROUND 701
+#define IDS_PROGRESS_CONTINUE 702
+#define IDS_PROGRESS_ASK_CANCEL 703
+#define IDC_PROGRESS1 1000
+#define IDC_PROGRESS_ELAPSED 1002
+#define IDC_PROGRESS_ELAPSED_VALUE 1003
+#define IDC_PROGRESS_REMAINING 1004
+#define IDC_PROGRESS_REMAINING_VALUE 1005
+#define IDC_PROGRESS_SPEED 1006
+#define IDC_PROGRESS_SPEED_VALUE 1007
+#define IDC_PROGRESS_TOTAL 1008
+#define IDC_PROGRESS_SPEED_TOTAL_VALUE 1009
+#define IDC_PROGRESS_FILE_NAME 1010
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog2/resource.rc b/CPP/7zip/FileManager/Resource/ProgressDialog2/resource.rc
new file mode 100755
index 00000000..9f395bff
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog2/resource.rc
@@ -0,0 +1,56 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 290
+#define ySize2 76
+
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#define bYPos (ySize - marg - bYSize)
+
+#undef bXSize
+#define bXSize 72
+
+#define bXPos1 (xSize - marg - bXSize)
+#define bXPos2 (bXPos1 - 10 - bXSize)
+#define bXPos3 (bXPos2 - 10 - bXSize)
+
+#define valSize 42
+#define timeSize 91
+#define labelPos 178
+#define valPos1 (marg + timeSize)
+#define valPos2 (xSize - marg - valSize)
+#define labelSize (valPos2 - labelPos)
+
+#undef yPos
+#define yPos (marg + 11)
+
+
+IDD_DIALOG_PROGRESS DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
+CAPTION "Progress"
+MY_FONT
+BEGIN
+ PUSHBUTTON "&Background", IDC_BUTTON_PROGRESS_PRIORITY, bXPos3, bYPos, bXSize, bYSize
+ PUSHBUTTON "&Pause", IDC_BUTTON_PAUSE, bXPos2, bYPos, bXSize, bYSize
+ PUSHBUTTON "Cancel", IDCANCEL, bXPos1, bYPos, bXSize, bYSize
+ LTEXT "Elapsed time:", IDC_PROGRESS_ELAPSED, marg, marg, timeSize, 8
+ LTEXT "Remaining time:", IDC_PROGRESS_REMAINING, marg, yPos, timeSize, 8
+ LTEXT "Size:", IDC_PROGRESS_TOTAL, labelPos, marg, labelSize, 8
+ LTEXT "Speed:", IDC_PROGRESS_SPEED, labelPos, yPos, labelSize, 8
+ RTEXT "00:00:00", IDC_PROGRESS_ELAPSED_VALUE, valPos1, marg, valSize, 8
+ RTEXT "", IDC_PROGRESS_REMAINING_VALUE, valPos1, yPos, valSize, 8
+ RTEXT "", IDC_PROGRESS_SPEED_TOTAL_VALUE, valPos2, marg, valSize, 8
+ RTEXT "", IDC_PROGRESS_SPEED_VALUE, valPos2, yPos, valSize, 8
+ LTEXT "", IDC_PROGRESS_FILE_NAME, marg, yPos + 16, xSize2, 8, SS_NOPREFIX
+ CONTROL "Progress1", IDC_PROGRESS1, "msctls_progress32", PBS_SMOOTH | WS_BORDER, marg, bYPos - 20, xSize2, 13
+END
+
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_PROGRESS_PAUSED "Paused"
+ IDS_PROGRESS_FOREGROUND "&Foreground"
+ IDS_PROGRESS_CONTINUE "&Continue"
+ IDS_PROGRESS_ASK_CANCEL "Are you sure you want to cancel?"
+END
diff --git a/CPP/7zip/FileManager/Resource/PropertyName/resource.h b/CPP/7zip/FileManager/Resource/PropertyName/resource.h
new file mode 100755
index 00000000..f3d56ef3
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PropertyName/resource.h
@@ -0,0 +1,28 @@
+#define IDS_PROPERTY_PATH 3
+#define IDS_PROPERTY_NAME 4
+#define IDS_PROPERTY_EXTENSION 5
+#define IDS_PROPERTY_IS_FOLDER 6
+#define IDS_PROPERTY_SIZE 7
+#define IDS_PROPERTY_PACKED_SIZE 8
+#define IDS_PROPERTY_ATTRIBUTES 9
+#define IDS_PROPERTY_CREATION_TIME 10
+#define IDS_PROPERTY_LAST_ACCESS_TIME 11
+#define IDS_PROPERTY_LAST_WRITE_TIME 12
+#define IDS_PROPERTY_SOLID 13
+#define IDS_PROPERTY_C0MMENTED 14
+#define IDS_PROPERTY_ENCRYPTED 15
+#define IDS_PROPERTY_DICTIONARY_SIZE 16
+#define IDS_PROPERTY_SPLIT_BEFORE 17
+#define IDS_PROPERTY_SPLIT_AFTER 18
+#define IDS_PROPERTY_CRC 19
+#define IDS_PROPERTY_FILE_TYPE 20
+#define IDS_PROPERTY_ANTI 21
+#define IDS_PROPERTY_METHOD 22
+#define IDS_PROPERTY_HOST_OS 23
+#define IDS_PROPERTY_FILE_SYSTEM 24
+#define IDS_PROPERTY_USER 25
+#define IDS_PROPERTY_GROUP 26
+#define IDS_PROPERTY_BLOCK 27
+#define IDS_PROPERTY_COMMENT 28
+#define IDS_PROPERTY_POSITION 29
+#define IDS_PROPERTY_PREFIX 30
diff --git a/CPP/7zip/FileManager/Resource/PropertyName/resource.rc b/CPP/7zip/FileManager/Resource/PropertyName/resource.rc
new file mode 100755
index 00000000..3f517aff
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/PropertyName/resource.rc
@@ -0,0 +1,35 @@
+#include "resource.h"
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+STRINGTABLE
+BEGIN
+ IDS_PROPERTY_PATH "Path"
+ IDS_PROPERTY_NAME "Name"
+ IDS_PROPERTY_EXTENSION "Extension"
+ IDS_PROPERTY_IS_FOLDER "Folder"
+ IDS_PROPERTY_SIZE "Size"
+ IDS_PROPERTY_PACKED_SIZE "Packed Size"
+ IDS_PROPERTY_ATTRIBUTES "Attributes"
+ IDS_PROPERTY_CREATION_TIME "Created"
+ IDS_PROPERTY_LAST_ACCESS_TIME "Accessed"
+ IDS_PROPERTY_LAST_WRITE_TIME "Modified"
+ IDS_PROPERTY_SOLID "Solid"
+ IDS_PROPERTY_C0MMENTED "Commented"
+ IDS_PROPERTY_ENCRYPTED "Encrypted"
+ IDS_PROPERTY_DICTIONARY_SIZE "Dictionary Size"
+ IDS_PROPERTY_SPLIT_BEFORE "Split Before"
+ IDS_PROPERTY_SPLIT_AFTER "Split After"
+ IDS_PROPERTY_CRC "CRC"
+ IDS_PROPERTY_FILE_TYPE "Type"
+ IDS_PROPERTY_ANTI "Anti"
+ IDS_PROPERTY_METHOD "Method"
+ IDS_PROPERTY_HOST_OS "Host OS"
+ IDS_PROPERTY_FILE_SYSTEM "File System"
+ IDS_PROPERTY_USER "User"
+ IDS_PROPERTY_GROUP "Group"
+ IDS_PROPERTY_BLOCK "Block"
+ IDS_PROPERTY_COMMENT "Comment"
+ IDS_PROPERTY_POSITION "Position"
+ IDS_PROPERTY_PREFIX "Path Prefix"
+END
diff --git a/CPP/7zip/FileManager/Resource/SettingsPage/SettingsPage.cpp b/CPP/7zip/FileManager/Resource/SettingsPage/SettingsPage.cpp
new file mode 100755
index 00000000..6a681fbc
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SettingsPage/SettingsPage.cpp
@@ -0,0 +1,113 @@
+// SettingsPage.cpp
+
+#include "StdAfx.h"
+#include "resource.h"
+#include "SettingsPage.h"
+
+#include "Common/StringConvert.h"
+
+#include "Windows/Defs.h"
+#include "Windows/MemoryLock.h"
+
+#include "../../RegistryUtils.h"
+#include "../../HelpUtils.h"
+#include "../../LangUtils.h"
+#include "../../ProgramLocation.h"
+
+using namespace NWindows;
+
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_SETTINGS_SHOW_DOTS, 0x03010401},
+ { IDC_SETTINGS_SHOW_REAL_FILE_ICONS, 0x03010402},
+ { IDC_SETTINGS_SHOW_SYSTEM_MENU, 0x03010410},
+ { IDC_SETTINGS_FULL_ROW, 0x03010420},
+ { IDC_SETTINGS_SHOW_GRID, 0x03010421},
+ { IDC_SETTINGS_ALTERNATIVE_SELECTION, 0x03010430},
+ { IDC_SETTINGS_LARGE_PAGES, 0x03010440}
+ // { IDC_SETTINGS_SINGLE_CLICK, 0x03010422},
+ // { IDC_SETTINGS_UNDERLINE, 0x03010423}
+};
+
+static LPCWSTR kEditTopic = L"FM/options.htm#settings";
+
+extern bool IsLargePageSupported();
+
+bool CSettingsPage::OnInit()
+{
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+
+ CheckButton(IDC_SETTINGS_SHOW_DOTS, ReadShowDots());
+ CheckButton(IDC_SETTINGS_SHOW_SYSTEM_MENU, ReadShowSystemMenu());
+ CheckButton(IDC_SETTINGS_SHOW_REAL_FILE_ICONS, ReadShowRealFileIcons());
+
+ CheckButton(IDC_SETTINGS_FULL_ROW, ReadFullRow());
+ CheckButton(IDC_SETTINGS_SHOW_GRID, ReadShowGrid());
+ CheckButton(IDC_SETTINGS_ALTERNATIVE_SELECTION, ReadAlternativeSelection());
+ if (IsLargePageSupported())
+ CheckButton(IDC_SETTINGS_LARGE_PAGES, ReadLockMemoryEnable());
+ else
+ EnableItem(IDC_SETTINGS_LARGE_PAGES, false);
+ // CheckButton(IDC_SETTINGS_SINGLE_CLICK, ReadSingleClick());
+ // CheckButton(IDC_SETTINGS_UNDERLINE, ReadUnderline());
+
+ // EnableSubItems();
+
+ return CPropertyPage::OnInit();
+}
+
+/*
+void CSettingsPage::EnableSubItems()
+{
+ EnableItem(IDC_SETTINGS_UNDERLINE, IsButtonCheckedBool(IDC_SETTINGS_SINGLE_CLICK));
+}
+*/
+
+LONG CSettingsPage::OnApply()
+{
+ SaveShowDots(IsButtonCheckedBool(IDC_SETTINGS_SHOW_DOTS));
+ SaveShowSystemMenu(IsButtonCheckedBool(IDC_SETTINGS_SHOW_SYSTEM_MENU));
+ SaveShowRealFileIcons(IsButtonCheckedBool(IDC_SETTINGS_SHOW_REAL_FILE_ICONS));
+
+ SaveFullRow(IsButtonCheckedBool(IDC_SETTINGS_FULL_ROW));
+ SaveShowGrid(IsButtonCheckedBool(IDC_SETTINGS_SHOW_GRID));
+ SaveAlternativeSelection(IsButtonCheckedBool(IDC_SETTINGS_ALTERNATIVE_SELECTION));
+ if (IsLargePageSupported())
+ {
+ bool enable = IsButtonCheckedBool(IDC_SETTINGS_LARGE_PAGES);
+ NSecurity::EnableLockMemoryPrivilege(enable);
+ SaveLockMemoryEnable(enable);
+ }
+
+ // SaveSingleClick(IsButtonCheckedBool(IDC_SETTINGS_SINGLE_CLICK));
+ // SaveUnderline(IsButtonCheckedBool(IDC_SETTINGS_UNDERLINE));
+
+ return PSNRET_NOERROR;
+}
+
+void CSettingsPage::OnNotifyHelp()
+{
+ ShowHelpWindow(NULL, kEditTopic); // change it
+}
+
+bool CSettingsPage::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ /*
+ case IDC_SETTINGS_SINGLE_CLICK:
+ EnableSubItems();
+ break;
+ */
+ case IDC_SETTINGS_SHOW_DOTS:
+ case IDC_SETTINGS_SHOW_SYSTEM_MENU:
+ case IDC_SETTINGS_SHOW_REAL_FILE_ICONS:
+ case IDC_SETTINGS_FULL_ROW:
+ case IDC_SETTINGS_SHOW_GRID:
+ case IDC_SETTINGS_ALTERNATIVE_SELECTION:
+ case IDC_SETTINGS_LARGE_PAGES:
+ Changed();
+ return true;
+ }
+ return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
+}
diff --git a/CPP/7zip/FileManager/Resource/SettingsPage/SettingsPage.h b/CPP/7zip/FileManager/Resource/SettingsPage/SettingsPage.h
new file mode 100755
index 00000000..e5fe6e67
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SettingsPage/SettingsPage.h
@@ -0,0 +1,19 @@
+// SettingsPage.h
+
+#ifndef __SETTINGSPAGE_H
+#define __SETTINGSPAGE_H
+
+#include "Windows/Control/PropertyPage.h"
+#include "Windows/Control/Edit.h"
+
+class CSettingsPage: public NWindows::NControl::CPropertyPage
+{
+ // void EnableSubItems();
+ bool OnButtonClicked(int buttonID, HWND buttonHWND);
+public:
+ virtual bool OnInit();
+ virtual void OnNotifyHelp();
+ virtual LONG OnApply();
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/SettingsPage/StdAfx.h b/CPP/7zip/FileManager/Resource/SettingsPage/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SettingsPage/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/SettingsPage/resource.h b/CPP/7zip/FileManager/Resource/SettingsPage/resource.h
new file mode 100755
index 00000000..8932dc0e
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SettingsPage/resource.h
@@ -0,0 +1,11 @@
+#define IDD_SETTINGS 904
+#define IDC_SETTINGS_SHOW_DOTS 1000
+#define IDC_SETTINGS_SHOW_REAL_FILE_ICONS 1001
+
+#define IDC_SETTINGS_SHOW_SYSTEM_MENU 1010
+#define IDC_SETTINGS_FULL_ROW 1011
+#define IDC_SETTINGS_SHOW_GRID 1013
+#define IDC_SETTINGS_SINGLE_CLICK 1014
+#define IDC_SETTINGS_UNDERLINE 1015
+#define IDC_SETTINGS_ALTERNATIVE_SELECTION 1016
+#define IDC_SETTINGS_LARGE_PAGES 1017
diff --git a/CPP/7zip/FileManager/Resource/SettingsPage/resource.rc b/CPP/7zip/FileManager/Resource/SettingsPage/resource.rc
new file mode 100755
index 00000000..69afeba7
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SettingsPage/resource.rc
@@ -0,0 +1,35 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 196
+#define ySize2 140
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+
+IDD_SETTINGS DIALOG 0, 0, xSize, ySize MY_PAGE_STYLE
+CAPTION "Settings"
+MY_FONT
+BEGIN
+ CONTROL "Show "".."" item", IDC_SETTINGS_SHOW_DOTS, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ marg, marg, xSize2, 10
+ CONTROL "Show real file &icons", IDC_SETTINGS_SHOW_REAL_FILE_ICONS, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ marg, 21, xSize2, 10
+ CONTROL "Show system &menu", IDC_SETTINGS_SHOW_SYSTEM_MENU, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ marg, 35, xSize2, 10
+ CONTROL "&Full row select", IDC_SETTINGS_FULL_ROW, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ marg, 63, xSize2, 10
+ CONTROL "Show &grid lines", IDC_SETTINGS_SHOW_GRID, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ marg, 77, xSize2, 10
+ CONTROL "&Single-click to open an item", IDC_SETTINGS_SINGLE_CLICK, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,
+ marg, 91, xSize2, 10
+ CONTROL "&Underline current name", IDC_SETTINGS_UNDERLINE, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,
+ marg + 12, 105, xSize2 - 12, 10
+
+ CONTROL "&Alternative selection mode", IDC_SETTINGS_ALTERNATIVE_SELECTION, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ marg, 122, xSize2, 10
+
+ CONTROL "Use &large memory pages", IDC_SETTINGS_LARGE_PAGES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ marg, 142, xSize2, 10
+
+END
diff --git a/CPP/7zip/FileManager/Resource/SplitDialog/SplitDialog.cpp b/CPP/7zip/FileManager/Resource/SplitDialog/SplitDialog.cpp
new file mode 100755
index 00000000..383fa48a
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SplitDialog/SplitDialog.cpp
@@ -0,0 +1,89 @@
+// SplitDialog.cpp
+
+#include "StdAfx.h"
+#include "SplitDialog.h"
+
+#include "Common/StringToInt.h"
+#include "Windows/Shell.h"
+#include "Windows/FileName.h"
+
+#include "../../SplitUtils.h"
+#ifdef LANG
+#include "../../LangUtils.h"
+#endif
+
+#include "../CopyDialog/resource.h"
+
+using namespace NWindows;
+
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_STATIC_SPLIT_PATH, 0x03020501 },
+ { IDC_STATIC_SPLIT_VOLUME, 0x02000D40 },
+};
+#endif
+
+
+bool CSplitDialog::OnInit()
+{
+ #ifdef LANG
+ LangSetWindowText(HWND(*this), 0x03020500);
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+ _pathCombo.Attach(GetItem(IDC_COMBO_SPLIT_PATH));
+ _volumeCombo.Attach(GetItem(IDC_COMBO_SPLIT_VOLUME));
+
+ if (!FilePath.IsEmpty())
+ {
+ UString title;
+ GetText(title);
+ title += L' ';
+ title += FilePath;
+ SetText(title);
+ }
+ _pathCombo.SetText(Path);
+ AddVolumeItems(_volumeCombo);
+ _volumeCombo.SetCurSel(0);
+ return CModalDialog::OnInit();
+}
+
+bool CSplitDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ case IDC_BUTTON_SPLIT_PATH:
+ OnButtonSetPath();
+ return true;
+ }
+ return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
+}
+
+void CSplitDialog::OnButtonSetPath()
+{
+ UString currentPath;
+ _pathCombo.GetText(currentPath);
+ // UString title = L"Specify a location for output folder";
+ UString title = LangStringSpec(IDS_SET_FOLDER, 0x03020209);
+
+ UString resultPath;
+ if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
+ return;
+ NFile::NName::NormalizeDirPathPrefix(resultPath);
+ _pathCombo.SetCurSel(-1);
+ _pathCombo.SetText(resultPath);
+}
+
+void CSplitDialog::OnOK()
+{
+ _pathCombo.GetText(Path);
+ UString volumeString;
+ _volumeCombo.GetText(volumeString);
+ volumeString.Trim();
+ if (!ParseVolumeSizes(volumeString, VolumeSizes) || VolumeSizes.Size() == 0)
+ {
+ ::MessageBoxW(*this, LangString(IDS_COMPRESS_INCORRECT_VOLUME_SIZE, 0x02000D41), L"7-Zip", 0);
+ return;
+ }
+ CModalDialog::OnOK();
+}
diff --git a/CPP/7zip/FileManager/Resource/SplitDialog/SplitDialog.h b/CPP/7zip/FileManager/Resource/SplitDialog/SplitDialog.h
new file mode 100755
index 00000000..d73dcbca
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SplitDialog/SplitDialog.h
@@ -0,0 +1,27 @@
+// SplitDialog.h
+
+#ifndef __SPLITDIALOG_H
+#define __SPLITDIALOG_H
+
+#include "Common/Types.h"
+#include "Windows/Control/Dialog.h"
+#include "Windows/Control/ComboBox.h"
+#include "resource.h"
+
+class CSplitDialog: public NWindows::NControl::CModalDialog
+{
+ NWindows::NControl::CComboBox _pathCombo;
+ NWindows::NControl::CComboBox _volumeCombo;
+ virtual void OnOK();
+ virtual bool OnInit();
+ virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
+ void OnButtonSetPath();
+public:
+ UString FilePath;
+ UString Path;
+ CRecordVector<UInt64> VolumeSizes;
+ INT_PTR Create(HWND parentWindow = 0)
+ { return CModalDialog::Create(IDD_DIALOG_SPLIT, parentWindow); }
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/SplitDialog/StdAfx.h b/CPP/7zip/FileManager/Resource/SplitDialog/StdAfx.h
new file mode 100755
index 00000000..eb2ba641
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SplitDialog/StdAfx.h
@@ -0,0 +1,18 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+// #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/SplitDialog/resource.h b/CPP/7zip/FileManager/Resource/SplitDialog/resource.h
new file mode 100755
index 00000000..019b7029
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SplitDialog/resource.h
@@ -0,0 +1,8 @@
+#define IDD_DIALOG_SPLIT 504
+#define IDC_STATIC_SPLIT_PATH 1000
+#define IDC_COMBO_SPLIT_PATH 1001
+#define IDC_BUTTON_SPLIT_PATH 1002
+#define IDC_STATIC_SPLIT_VOLUME 1010
+#define IDC_COMBO_SPLIT_VOLUME 1011
+
+#define IDS_COMPRESS_INCORRECT_VOLUME_SIZE 95
diff --git a/CPP/7zip/FileManager/Resource/SplitDialog/resource.rc b/CPP/7zip/FileManager/Resource/SplitDialog/resource.rc
new file mode 100755
index 00000000..5282ee7d
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SplitDialog/resource.rc
@@ -0,0 +1,32 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 223
+#define ySize2 89
+
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+
+#define bYPos (ySize - marg - bYSize)
+#define b1XPos (xSize - marg - bXSize)
+#define b2XPos (b1XPos - 10 - bXSize)
+
+
+
+IDD_DIALOG_SPLIT DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
+CAPTION "Split File"
+MY_FONT
+BEGIN
+ LTEXT "&Split to:", IDC_STATIC_SPLIT_PATH, marg, marg, xSize2, 8
+ COMBOBOX IDC_COMBO_SPLIT_PATH, marg, 18, xSize2 - bDotsSize - 12, 126, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "...", IDC_BUTTON_SPLIT_PATH, xSize - marg - bDotsSize, 17, bDotsSize, bYSize, WS_GROUP
+ LTEXT "Split to &volumes, bytes:", IDC_STATIC_SPLIT_VOLUME, marg, 38, xSize2, 8
+ COMBOBOX IDC_COMBO_SPLIT_VOLUME, marg, 50, 120, 52, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "OK", IDOK, b2XPos, bYPos, bXSize, bYSize
+ PUSHBUTTON "Cancel", IDCANCEL, b1XPos, bYPos, bXSize, bYSize
+END
+
+STRINGTABLE
+BEGIN
+ IDS_COMPRESS_INCORRECT_VOLUME_SIZE "Incorrect volume size"
+END
diff --git a/CPP/7zip/FileManager/Resource/SystemPage/StdAfx.h b/CPP/7zip/FileManager/Resource/SystemPage/StdAfx.h
new file mode 100755
index 00000000..a444ca31
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SystemPage/StdAfx.h
@@ -0,0 +1,16 @@
+// stdafx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#define _WIN32_WINNT 0x0400
+
+// it's for Windows NT supporting (MENUITEMINFOW)
+#define WINVER 0x0400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/SystemPage/SystemPage.cpp b/CPP/7zip/FileManager/Resource/SystemPage/SystemPage.cpp
new file mode 100755
index 00000000..ca3b7432
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SystemPage/SystemPage.cpp
@@ -0,0 +1,435 @@
+// SystemDialog.cpp
+
+#include "StdAfx.h"
+#include "resource.h"
+#include "SystemPage.h"
+
+#include "Common/StringConvert.h"
+#include "Common/MyCom.h"
+
+#include "Windows/Defs.h"
+#include "Windows/Control/ListView.h"
+
+#include "../../IFolder.h"
+#include "../../HelpUtils.h"
+#include "../../LangUtils.h"
+#include "../../PluginLoader.h"
+#include "../../ProgramLocation.h"
+#include "../../StringUtils.h"
+
+#include "../PropertyName/resource.h"
+
+using namespace NRegistryAssociations;
+
+const int kRefreshpluginsListMessage = WM_USER + 1;
+const int kUpdateDatabase = kRefreshpluginsListMessage + 1;
+
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_SYSTEM_STATIC_ASSOCIATE, 0x03010302},
+ { IDC_SYSTEM_SELECT_ALL, 0x03000330}
+};
+
+static LPCWSTR kSystemTopic = L"FM/options.htm#system";
+
+
+bool CSystemPage::OnInit()
+{
+ _initMode = true;
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+
+ _listViewExt.Attach(GetItem(IDC_SYSTEM_LIST_ASSOCIATE));
+ _listViewPlugins.Attach(GetItem(IDC_SYSTEM_LIST_PLUGINS));
+
+ /*
+ CheckButton(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
+ NRegistryAssociations::CheckContextMenuHandler());
+ */
+
+ UINT32 newFlags = LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT;
+ _listViewExt.SetExtendedListViewStyle(newFlags, newFlags);
+ _listViewPlugins.SetExtendedListViewStyle(newFlags, newFlags);
+
+ UString s = LangString(IDS_PROPERTY_EXTENSION, 0x02000205);
+ LVCOLUMNW column;
+ column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
+ column.cx = 70;
+ column.fmt = LVCFMT_LEFT;
+ column.pszText = (LPWSTR)(LPCWSTR)s;
+ column.iSubItem = 0;
+ _listViewExt.InsertColumn(0, &column);
+
+ s = LangString(IDS_PLUGIN, 0x03010310);
+ column.cx = 70;
+ column.pszText = (LPWSTR)(LPCWSTR)s;
+ column.iSubItem = 1;
+ _listViewExt.InsertColumn(1, &column);
+
+ s = LangString(IDS_PLUGIN, 0x03010310);
+ column.cx = 70;
+ column.pszText = (LPWSTR)(LPCWSTR)s;
+ column.iSubItem = 0;
+ _listViewPlugins.InsertColumn(0, &column);
+
+ _extDatabase.Read();
+
+ for (int i = 0; i < _extDatabase.ExtBigItems.Size(); i++)
+ {
+ CExtInfoBig &extInfo = _extDatabase.ExtBigItems[i];
+
+ LVITEMW item;
+ item.iItem = i;
+ item.mask = LVIF_TEXT | LVIF_PARAM;
+ item.lParam = i;
+ item.pszText = (LPWSTR)(LPCWSTR)extInfo.Ext;
+ item.iSubItem = 0;
+ int itemIndex = _listViewExt.InsertItem(&item);
+
+ extInfo.Associated = NRegistryAssociations::CheckShellExtensionInfo(GetSystemString(extInfo.Ext));
+ _listViewExt.SetCheckState(itemIndex, extInfo.Associated);
+
+ SetMainPluginText(itemIndex, i);
+ }
+ // _listViewExt.SortItems();
+
+ if(_listViewExt.GetItemCount() > 0)
+ {
+ UINT state = LVIS_SELECTED | LVIS_FOCUSED;
+ _listViewExt.SetItemState(0, state, state);
+ }
+ RefreshPluginsList(-1);
+ _initMode = false;
+
+ return CPropertyPage::OnInit();
+}
+
+void CSystemPage::SetMainPluginText(int itemIndex, int indexInDatabase)
+{
+ LVITEMW item;
+ item.iItem = itemIndex;
+ item.mask = LVIF_TEXT;
+ UString mainPlugin = _extDatabase.GetMainPluginNameForExtItem(indexInDatabase);
+ item.pszText = (WCHAR *)(const WCHAR *)mainPlugin;
+ item.iSubItem = 1;
+ _listViewExt.SetItem(&item);
+}
+
+static UString GetProgramCommand()
+{
+ UString path = L"\"";
+ UString folder;
+ if (GetProgramFolderPath(folder))
+ path += folder;
+ path += L"7zFM.exe\" \"%1\"";
+ return path;
+}
+
+static UString GetIconPath(const UString &filePath,
+ const CLSID &clsID, const UString &extension)
+{
+ CPluginLibrary library;
+ CMyComPtr<IFolderManager> folderManager;
+ CMyComPtr<IFolderFolder> folder;
+ if (library.LoadAndCreateManager(filePath, clsID, &folderManager) != S_OK)
+ return UString();
+ CMyComBSTR typesString;
+ if (folderManager->GetTypes(&typesString) != S_OK)
+ return UString();
+ UStringVector types;
+ SplitString((const wchar_t *)typesString, types);
+ for (int typeIndex = 0; typeIndex < types.Size(); typeIndex++)
+ {
+ const UString &type = types[typeIndex];
+ CMyComBSTR extTemp;
+ if (folderManager->GetExtension(type, &extTemp) != S_OK)
+ continue;
+ if (extension.CompareNoCase((const wchar_t *)extTemp) == 0)
+ {
+ CMyComPtr<IFolderManagerGetIconPath> getIconPath;
+ if (folderManager.QueryInterface(IID_IFolderManagerGetIconPath, &getIconPath) != S_OK)
+ break;
+ CMyComBSTR iconPathTemp;
+ if (getIconPath->GetIconPath(type, &iconPathTemp) != S_OK)
+ break;
+ return (const wchar_t *)iconPathTemp;
+ }
+ }
+ return UString();
+}
+
+LONG CSystemPage::OnApply()
+{
+ UpdateDatabase();
+ _extDatabase.Save();
+ UString command = GetProgramCommand();
+
+ for (int i = 0; i < _extDatabase.ExtBigItems.Size(); i++)
+ {
+ const CExtInfoBig &extInfo = _extDatabase.ExtBigItems[i];
+ if (extInfo.Associated)
+ {
+ UString title = extInfo.Ext + UString(L" Archive");
+ UString command = GetProgramCommand();
+ UString iconPath;
+ if (!extInfo.PluginsPairs.IsEmpty())
+ {
+ const CPluginInfo &plugin = _extDatabase.Plugins[extInfo.PluginsPairs[0].Index];
+ iconPath = GetIconPath(plugin.FilePath, plugin.ClassID, extInfo.Ext);
+ }
+ NRegistryAssociations::AddShellExtensionInfo(
+ GetSystemString(extInfo.Ext),
+ title,
+ command,
+ iconPath, NULL, 0);
+ }
+ else
+ NRegistryAssociations::DeleteShellExtensionInfo(GetSystemString(extInfo.Ext));
+ }
+ /*
+ if (IsButtonCheckedBool(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU))
+ NRegistryAssociations::AddContextMenuHandler();
+ else
+ NRegistryAssociations::DeleteContextMenuHandler();
+ */
+ SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
+ return PSNRET_NOERROR;
+}
+
+void CSystemPage::OnNotifyHelp()
+{
+ ShowHelpWindow(NULL, kSystemTopic);
+}
+
+void CSystemPage::SelectAll()
+{
+ int count = _listViewExt.GetItemCount();
+ for (int i = 0; i < count; i++)
+ _listViewExt.SetCheckState(i, true);
+ UpdateDatabase();
+}
+
+bool CSystemPage::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ case IDC_SYSTEM_SELECT_ALL:
+ {
+ SelectAll();
+ Changed();
+ return true;
+ }
+ }
+ return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
+}
+
+bool CSystemPage::OnNotify(UINT controlID, LPNMHDR lParam)
+{
+ if (lParam->hwndFrom == HWND(_listViewExt))
+ {
+ switch(lParam->code)
+ {
+ case (LVN_ITEMCHANGED):
+ return OnItemChanged((const NMLISTVIEW *)lParam);
+ case NM_RCLICK:
+ case NM_DBLCLK:
+ case LVN_KEYDOWN:
+ case NM_CLICK:
+ case LVN_BEGINRDRAG:
+ PostMessage(kRefreshpluginsListMessage, 0);
+ PostMessage(kUpdateDatabase, 0);
+ break;
+ }
+ }
+ else if (lParam->hwndFrom == HWND(_listViewPlugins))
+ {
+ switch(lParam->code)
+ {
+ case NM_RCLICK:
+ case NM_DBLCLK:
+ // case LVN_KEYDOWN:
+ case NM_CLICK:
+ case LVN_BEGINRDRAG:
+ PostMessage(kUpdateDatabase, 0);
+ break;
+
+ case (LVN_ITEMCHANGED):
+ {
+ OnItemChanged((const NMLISTVIEW *)lParam);
+ PostMessage(kUpdateDatabase, 0);
+ break;
+ }
+ case LVN_KEYDOWN:
+ {
+ OnPluginsKeyDown((LPNMLVKEYDOWN)lParam);
+ PostMessage(kUpdateDatabase, 0);
+ break;
+ }
+ }
+ }
+ return CPropertyPage::OnNotify(controlID, lParam);
+}
+
+bool CSystemPage::OnPluginsKeyDown(LPNMLVKEYDOWN keyDownInfo)
+{
+ bool alt = (::GetKeyState(VK_MENU) & 0x8000) != 0;
+ // bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
+ switch(keyDownInfo->wVKey)
+ {
+ case VK_UP:
+ {
+ if (alt)
+ MovePlugin(true);
+ return true;
+ }
+ case VK_DOWN:
+ {
+ if (alt)
+ MovePlugin(false);
+ return true;
+ }
+ }
+ return false;
+}
+
+void CSystemPage::MovePlugin(bool upDirection)
+{
+ int selectedPlugin = _listViewPlugins.GetSelectionMark();
+ if (selectedPlugin < 0)
+ return;
+ int newIndex = selectedPlugin + (upDirection ? -1: 1);
+ if (newIndex < 0 || newIndex >= _listViewPlugins.GetItemCount())
+ return;
+ int selectedExtIndex = GetSelectedExtIndex();
+ if (selectedExtIndex < 0)
+ return;
+ CExtInfoBig &extInfo = _extDatabase.ExtBigItems[selectedExtIndex];
+ CPluginEnabledPair pluginPairTemp = extInfo.PluginsPairs[newIndex];
+ extInfo.PluginsPairs[newIndex] = extInfo.PluginsPairs[selectedPlugin];
+ extInfo.PluginsPairs[selectedPlugin] = pluginPairTemp;
+
+ SetMainPluginText(_listViewExt.GetSelectionMark(), selectedExtIndex);
+ RefreshPluginsList(newIndex);
+
+ Changed();
+}
+
+bool CSystemPage::OnItemChanged(const NMLISTVIEW *info)
+{
+ if (_initMode)
+ return true;
+ if ((info->uChanged & LVIF_STATE) != 0)
+ {
+ UINT oldState = info->uOldState & LVIS_STATEIMAGEMASK;
+ UINT newState = info->uNewState & LVIS_STATEIMAGEMASK;
+ if (oldState != newState)
+ Changed();
+ }
+ // PostMessage(kRefreshpluginsListMessage, 0);
+ // RefreshPluginsList();
+ return true;
+}
+
+bool CSystemPage::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch(message)
+ {
+ case kRefreshpluginsListMessage:
+ RefreshPluginsList(-1);
+ return true;
+ case kUpdateDatabase:
+ UpdateDatabase();
+ return true;
+ }
+ return CPropertyPage::OnMessage(message, wParam, lParam);
+}
+
+void CSystemPage::UpdateDatabase()
+{
+ int i;
+ for (i = 0; i < _listViewExt.GetItemCount(); i++)
+ {
+ LPARAM param;
+ if (!_listViewExt.GetItemParam(i, param))
+ return;
+ CExtInfoBig &extInfo = _extDatabase.ExtBigItems[(int)param];
+ extInfo.Associated = _listViewExt.GetCheckState(i);
+ }
+
+ int selectedExtIndex = GetSelectedExtIndex();
+ if (selectedExtIndex < 0)
+ return;
+
+ CExtInfoBig &extInfo = _extDatabase.ExtBigItems[selectedExtIndex];
+ for (i = 0; i < _listViewPlugins.GetItemCount(); i++)
+ {
+ extInfo.PluginsPairs[i].Enabled = _listViewPlugins.GetCheckState(i);
+ }
+}
+
+
+
+int CSystemPage::GetSelectedExtIndex()
+{
+ int selectedIndex = _listViewExt.GetSelectionMark();
+ if (selectedIndex < 0)
+ return -1;
+ LPARAM param;
+ if (!_listViewExt.GetItemParam(selectedIndex, param))
+ return -1;
+ return (int)param;
+}
+
+
+void CSystemPage::RefreshPluginsList(int selectIndex)
+{
+ _listViewPlugins.DeleteAllItems();
+ int selectedExtIndex = GetSelectedExtIndex();
+ if (selectedExtIndex < 0)
+ return;
+ const CExtInfoBig &extInfo = _extDatabase.ExtBigItems[selectedExtIndex];
+
+ _initMode = true;
+ for (int i = 0; i < extInfo.PluginsPairs.Size(); i++)
+ {
+ CPluginEnabledPair pluginPair = extInfo.PluginsPairs[i];
+ UString pluginName = _extDatabase.Plugins[pluginPair.Index].Name;
+ LVITEMW item;
+ item.iItem = i;
+ item.mask = LVIF_TEXT | LVIF_PARAM;
+ item.lParam = i;
+ item.pszText = (LPWSTR)(LPCWSTR)pluginName;
+ item.iSubItem = 0;
+ int itemIndex = _listViewPlugins.InsertItem(&item);
+ _listViewPlugins.SetCheckState(itemIndex, pluginPair.Enabled);
+ }
+ if(_listViewPlugins.GetItemCount() > 0)
+ {
+ if (selectIndex < 0)
+ selectIndex = 0;
+ UINT state = LVIS_SELECTED | LVIS_FOCUSED;
+ _listViewPlugins.SetItemState(selectIndex, state, state);
+ }
+ _initMode = false;
+}
+
+
+
+/*
+static BYTE kZipShellNewData[] =
+ { 0x50-1, 0x4B, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0 };
+
+static BYTE kRarShellNewData[] =
+ { 0x52-1, 0x61, 0x72, 0x21, 0x1A, 7, 0, 0xCF, 0x90, 0x73, 0, 0, 0x0D, 0, 0, 0, 0, 0, 0, 0};
+
+class CSignatureMaker
+{
+public:
+ CSignatureMaker()
+ {
+ kZipShellNewData[0]++;
+ kRarShellNewData[0]++;
+ };
+};
+
+static CSignatureMaker g_SignatureMaker;
+*/
diff --git a/CPP/7zip/FileManager/Resource/SystemPage/SystemPage.h b/CPP/7zip/FileManager/Resource/SystemPage/SystemPage.h
new file mode 100755
index 00000000..3798f640
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SystemPage/SystemPage.h
@@ -0,0 +1,40 @@
+// SystemPage.h
+
+#ifndef __SYSTEMPAGE_H
+#define __SYSTEMPAGE_H
+
+#include "Windows/Control/PropertyPage.h"
+#include "Windows/Control/ListView.h"
+
+#include "../../FilePlugins.h"
+
+class CSystemPage: public NWindows::NControl::CPropertyPage
+{
+ bool _initMode;
+ CExtDatabase _extDatabase;
+
+ // CObjectVector<NZipRootRegistry::CArchiverInfo> m_Archivers;
+ NWindows::NControl::CListView _listViewExt;
+ NWindows::NControl::CListView _listViewPlugins;
+
+ void SetMainPluginText(int itemIndex, int indexInDatabase);
+
+ int GetSelectedExtIndex();
+ void RefreshPluginsList(int selectIndex);
+ void MovePlugin(bool upDirection);
+ void UpdateDatabase();
+ void SelectAll();
+
+public:
+ virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
+ virtual bool OnInit();
+ virtual void OnNotifyHelp();
+ virtual bool OnNotify(UINT controlID, LPNMHDR lParam);
+ virtual bool OnItemChanged(const NMLISTVIEW *info);
+
+ virtual LONG OnApply();
+ virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
+ bool OnPluginsKeyDown(LPNMLVKEYDOWN keyDownInfo);
+};
+
+#endif
diff --git a/CPP/7zip/FileManager/Resource/SystemPage/resource.h b/CPP/7zip/FileManager/Resource/SystemPage/resource.h
new file mode 100755
index 00000000..8dce778b
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SystemPage/resource.h
@@ -0,0 +1,7 @@
+#define IDD_SYSTEM 902
+#define IDS_PLUGIN 990
+// #define IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU 1010
+#define IDC_SYSTEM_STATIC_ASSOCIATE 1020
+#define IDC_SYSTEM_LIST_ASSOCIATE 1021
+#define IDC_SYSTEM_LIST_PLUGINS 1022
+#define IDC_SYSTEM_SELECT_ALL 1023
diff --git a/CPP/7zip/FileManager/Resource/SystemPage/resource.rc b/CPP/7zip/FileManager/Resource/SystemPage/resource.rc
new file mode 100755
index 00000000..cf19d11b
--- /dev/null
+++ b/CPP/7zip/FileManager/Resource/SystemPage/resource.rc
@@ -0,0 +1,31 @@
+#include "resource.h"
+#include "../../../GuiCommon.rc"
+
+#define xSize2 238
+#define ySize2 214
+#define xSize (xSize2 + marg + marg)
+#define ySize (ySize2 + marg + marg)
+#define gSpace 30
+#define g0Size 110
+#define gYSize (ySize2 - 20 - bYSize)
+
+
+IDD_SYSTEM DIALOG 0, 0, xSize, ySize MY_PAGE_STYLE
+CAPTION "System"
+MY_FONT
+BEGIN
+ LTEXT "Associate 7-Zip with:", IDC_SYSTEM_STATIC_ASSOCIATE, marg, marg, xSize2, 8
+ CONTROL "List1", IDC_SYSTEM_LIST_ASSOCIATE, "SysListView32",
+ LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
+ marg, 20, g0Size, gYSize
+ CONTROL "List1", IDC_SYSTEM_LIST_PLUGINS, "SysListView32",
+ LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | NOT WS_VISIBLE | WS_BORDER | WS_TABSTOP,
+ marg + g0Size + gSpace, 20, xSize2 - gSpace - g0Size, gYSize
+ PUSHBUTTON "Select all", IDC_SYSTEM_SELECT_ALL, marg, (ySize - marg - bYSize), 90, bYSize
+
+END
+
+STRINGTABLE
+BEGIN
+ IDS_PLUGIN "Plugin"
+END