mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-14 18:11:41 -06:00
4.30 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
bcd1db2f5a
commit
e18587ba51
@@ -12,8 +12,7 @@ public:
|
||||
virtual bool OnInit();
|
||||
virtual void OnHelp();
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
INT_PTR Create(HWND aWndParent = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_ABOUT), aWndParent); }
|
||||
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_ABOUT, wndParent); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#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"
|
||||
@@ -140,15 +141,22 @@ public:
|
||||
UInt32 BufferSize;
|
||||
Byte *Buffer;
|
||||
CBenchRandomGenerator(): Buffer(0) {}
|
||||
~CBenchRandomGenerator() { delete []Buffer; }
|
||||
void Init() { RG.Init(); }
|
||||
void Set(UInt32 bufferSize)
|
||||
{
|
||||
delete []Buffer;
|
||||
~CBenchRandomGenerator() { Free(); }
|
||||
void Free()
|
||||
{
|
||||
::MidFree(Buffer);
|
||||
Buffer = 0;
|
||||
Buffer = new Byte[bufferSize];
|
||||
}
|
||||
void Init() { RG.Init(); }
|
||||
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); }
|
||||
/*
|
||||
@@ -525,15 +533,29 @@ public:
|
||||
UInt32 Pos;
|
||||
Byte *Buffer;
|
||||
CBenchmarkOutStream(): Buffer(0) {}
|
||||
~CBenchmarkOutStream() { delete []Buffer; }
|
||||
void Init(UInt32 bufferSize)
|
||||
{
|
||||
delete []Buffer;
|
||||
~CBenchmarkOutStream() { Free(); }
|
||||
void Free()
|
||||
{
|
||||
::MidFree(Buffer);
|
||||
Buffer = 0;
|
||||
Buffer = new Byte[bufferSize];
|
||||
Pos = 0;
|
||||
BufferSize = bufferSize;
|
||||
}
|
||||
|
||||
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);
|
||||
};
|
||||
@@ -691,7 +713,9 @@ DWORD CThreadBenchmark::Process()
|
||||
writeCoderProperties->WriteCoderProperties(propStream);
|
||||
}
|
||||
|
||||
randomGenerator.Set(kBufferSize);
|
||||
if (!randomGenerator.Alloc(kBufferSize))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
randomGenerator.Generate();
|
||||
CCRC crc;
|
||||
|
||||
@@ -705,11 +729,22 @@ DWORD CThreadBenchmark::Process()
|
||||
}
|
||||
|
||||
CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
|
||||
inStreamSpec->Init(randomGenerator.Buffer, randomGenerator.BufferSize);
|
||||
CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
|
||||
CBenchmarkOutStream *outStreamSpec = new CBenchmarkOutStream;
|
||||
outStreamSpec->Init(kCompressedBufferSize);
|
||||
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);
|
||||
|
||||
@@ -128,11 +128,7 @@ public:
|
||||
CProgressSyncInfo _syncInfo;
|
||||
|
||||
CBenchmarkDialog(): _timer(0) {}
|
||||
|
||||
INT_PTR Create(HWND wndParent = 0)
|
||||
{
|
||||
return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_BENCHMARK), wndParent);
|
||||
}
|
||||
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_BENCHMARK, wndParent); }
|
||||
};
|
||||
|
||||
void Benchmark(HWND hwnd);
|
||||
|
||||
@@ -17,10 +17,9 @@ public:
|
||||
UString Title;
|
||||
UString Static;
|
||||
UString Value;
|
||||
CSysStringVector Strings;
|
||||
UStringVector Strings;
|
||||
// CComboDialog(): Sorted(false) {};
|
||||
INT_PTR Create(HWND parentWindow = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_COMBO), parentWindow); }
|
||||
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_COMBO, parentWindow); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,7 +35,7 @@ bool CCopyDialog::OnInit()
|
||||
staticContol.Attach(GetItem(IDC_COPY_STATIC));
|
||||
staticContol.SetText(Static);
|
||||
for(int i = 0; i < Strings.Size(); i++)
|
||||
_path.AddString(GetSystemString(Strings[i]));
|
||||
_path.AddString(Strings[i]);
|
||||
_path.SetText(Value);
|
||||
return CModalDialog::OnInit();
|
||||
}
|
||||
@@ -53,19 +53,19 @@ bool CCopyDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
|
||||
void CCopyDialog::OnButtonSetPath()
|
||||
{
|
||||
CSysString currentPath;
|
||||
UString currentPath;
|
||||
_path.GetText(currentPath);
|
||||
|
||||
/*
|
||||
#ifdef LANG
|
||||
CSysString title = LangLoadString(IDS_EXTRACT_SET_FOLDER, 0x02000881);
|
||||
UString title = LangLoadString(IDS_EXTRACT_SET_FOLDER, 0x02000881);
|
||||
#else
|
||||
CSysString title = MyLoadString(IDS_EXTRACT_SET_FOLDER);
|
||||
UString title = MyLoadString(IDS_EXTRACT_SET_FOLDER);
|
||||
#endif
|
||||
*/
|
||||
CSysString title = TEXT("Specify a location for output folder");
|
||||
UString title = L"Specify a location for output folder";
|
||||
|
||||
CSysString resultPath;
|
||||
UString resultPath;
|
||||
if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
|
||||
return;
|
||||
NFile::NName::NormalizeDirPathPrefix(resultPath);
|
||||
|
||||
@@ -20,8 +20,7 @@ public:
|
||||
UString Value;
|
||||
UStringVector Strings;
|
||||
|
||||
INT_PTR Create(HWND parentWindow = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_COPY), parentWindow); }
|
||||
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_COPY, parentWindow); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Defs.h"
|
||||
#include "Windows/CommonDialog.h"
|
||||
// #include "Windows/FileFind.h"
|
||||
// #include "Windows/FileDir.h"
|
||||
|
||||
@@ -29,7 +30,7 @@ bool CEditPage::OnInit()
|
||||
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
|
||||
|
||||
_editorEdit.Attach(GetItem(IDC_EDIT_EDIT_EDITOR));
|
||||
CSysString editorPath;
|
||||
UString editorPath;
|
||||
ReadRegEditor(editorPath);
|
||||
_editorEdit.SetText(editorPath);
|
||||
return CPropertyPage::OnInit();
|
||||
@@ -40,7 +41,7 @@ LONG CEditPage::OnApply()
|
||||
// int selectedIndex = _langCombo.GetCurSel();
|
||||
// int pathIndex = _langCombo.GetItemData(selectedIndex);
|
||||
// ReloadLang();
|
||||
CSysString editorPath;
|
||||
UString editorPath;
|
||||
_editorEdit.GetText(editorPath);
|
||||
SaveRegEditor(editorPath);
|
||||
return PSNRET_NOERROR;
|
||||
@@ -66,85 +67,14 @@ bool CEditPage::OnButtonClicked(int aButtonID, HWND aButtonHWND)
|
||||
return CPropertyPage::OnButtonClicked(aButtonID, aButtonHWND);
|
||||
}
|
||||
|
||||
class CDoubleZeroStringList
|
||||
{
|
||||
CRecordVector<int> _indexes;
|
||||
CSysString _string;
|
||||
public:
|
||||
void Add(LPCTSTR string);
|
||||
void SetForBuffer(LPTSTR buffer);
|
||||
};
|
||||
|
||||
const TCHAR kDelimiterSymbol = TEXT(' ');
|
||||
void CDoubleZeroStringList::Add(LPCTSTR string)
|
||||
{
|
||||
_string += string;
|
||||
_indexes.Add(_string.Length());
|
||||
_string += kDelimiterSymbol;
|
||||
}
|
||||
|
||||
void CDoubleZeroStringList::SetForBuffer(LPTSTR buffer)
|
||||
{
|
||||
lstrcpy(buffer, _string);
|
||||
for (int i = 0; i < _indexes.Size(); i++)
|
||||
buffer[_indexes[i]] = TEXT('\0');
|
||||
}
|
||||
|
||||
void CEditPage::OnSetEditorButton()
|
||||
{
|
||||
OPENFILENAME info;
|
||||
info.lStructSize = sizeof(info);
|
||||
info.hwndOwner = HWND(*this);
|
||||
info.hInstance = 0;
|
||||
|
||||
const int kBufferSize = MAX_PATH * 2;
|
||||
TCHAR buffer[kBufferSize + 1];
|
||||
CSysString editorPath;
|
||||
UString editorPath;
|
||||
_editorEdit.GetText(editorPath);
|
||||
|
||||
lstrcpy(buffer, editorPath);
|
||||
|
||||
const int kFilterBufferSize = MAX_PATH;
|
||||
TCHAR filterBuffer[kFilterBufferSize];
|
||||
CDoubleZeroStringList doubleZeroStringList;
|
||||
CSysString string = TEXT("*.exe");
|
||||
doubleZeroStringList.Add(string);
|
||||
doubleZeroStringList.Add(string);
|
||||
doubleZeroStringList.SetForBuffer(filterBuffer);
|
||||
info.lpstrFilter = filterBuffer;
|
||||
|
||||
info.lpstrCustomFilter = NULL;
|
||||
info.nMaxCustFilter = 0;
|
||||
info.nFilterIndex = 0;
|
||||
|
||||
info.lpstrFile = buffer;
|
||||
info.nMaxFile = kBufferSize;
|
||||
|
||||
info.lpstrFileTitle = NULL;
|
||||
info.nMaxFileTitle = 0;
|
||||
|
||||
info.lpstrInitialDir= NULL;
|
||||
|
||||
/*
|
||||
CSysString title = "Open";
|
||||
LangLoadString(IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE, 0x02000D90);
|
||||
info.lpstrTitle = title;
|
||||
*/
|
||||
info.lpstrTitle = 0;
|
||||
|
||||
|
||||
info.Flags = OFN_EXPLORER | OFN_HIDEREADONLY;
|
||||
info.nFileOffset = 0;
|
||||
info.nFileExtension = 0;
|
||||
info.lpstrDefExt = NULL;
|
||||
|
||||
info.lCustData = 0;
|
||||
info.lpfnHook = NULL;
|
||||
info.lpTemplateName = NULL;
|
||||
|
||||
if(!GetOpenFileName(&info))
|
||||
UString resPath;
|
||||
if(!MyGetOpenFileName(HWND(*this), 0, editorPath, L"*.exe", resPath))
|
||||
return;
|
||||
_editorEdit.SetText(buffer);
|
||||
_editorEdit.SetText(resPath);
|
||||
// Changed();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ bool CLangPage::OnInit()
|
||||
|
||||
_langCombo.Attach(GetItem(IDC_LANG_COMBO_LANG));
|
||||
|
||||
CSysString s = NWindows::MyLoadString(IDS_LANG_ENGLISH);
|
||||
s += TEXT(" (");
|
||||
s += NWindows::MyLoadString(IDS_LANG_NATIVE);
|
||||
s += TEXT(")");
|
||||
UString s = NWindows::MyLoadStringW(IDS_LANG_ENGLISH);
|
||||
s += L" (";
|
||||
s += NWindows::MyLoadStringW(IDS_LANG_NATIVE);
|
||||
s += L")";
|
||||
int index = _langCombo.AddString(s);
|
||||
_langCombo.SetItemData(index, _paths.Size());
|
||||
_paths.Add(TEXT("-"));
|
||||
_paths.Add(L"-");
|
||||
_langCombo.SetCurSel(0);
|
||||
|
||||
CObjectVector<CLangEx> langs;
|
||||
@@ -55,10 +55,10 @@ bool CLangPage::OnInit()
|
||||
name += L")";
|
||||
}
|
||||
}
|
||||
index = _langCombo.AddString(GetSystemString(name));
|
||||
index = _langCombo.AddString(name);
|
||||
_langCombo.SetItemData(index, _paths.Size());
|
||||
_paths.Add(GetSystemString(lang.ShortName));
|
||||
if (g_LangID.CompareNoCase(GetSystemString(lang.ShortName)) == 0)
|
||||
_paths.Add(lang.ShortName);
|
||||
if (g_LangID.CompareNoCase(lang.ShortName) == 0)
|
||||
_langCombo.SetCurSel(index);
|
||||
}
|
||||
return CPropertyPage::OnInit();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class CLangPage: public NWindows::NControl::CPropertyPage
|
||||
{
|
||||
NWindows::NControl::CComboBox _langCombo;
|
||||
CSysStringVector _paths;
|
||||
UStringVector _paths;
|
||||
public:
|
||||
bool _langWasChanged;
|
||||
virtual bool OnInit();
|
||||
|
||||
@@ -32,10 +32,10 @@ bool CListViewDialog::OnInit()
|
||||
|
||||
for(int i = 0; i < Strings.Size(); i++)
|
||||
{
|
||||
LVITEM item;
|
||||
LVITEMW item;
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iItem = i;
|
||||
item.pszText = (LPTSTR)(LPCTSTR)Strings[i];
|
||||
item.pszText = (LPWSTR)(LPCWSTR)Strings[i];
|
||||
item.iSubItem = 0;
|
||||
_listView.InsertItem(&item);
|
||||
}
|
||||
|
||||
@@ -17,12 +17,11 @@ class CListViewDialog: public NWindows::NControl::CModalDialog
|
||||
public:
|
||||
UString Title;
|
||||
bool DeleteIsAllowed;
|
||||
CSysStringVector Strings;
|
||||
UStringVector Strings;
|
||||
bool StringsWereChanged;
|
||||
int FocusedItemIndex;
|
||||
|
||||
INT_PTR Create(HWND wndParent = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_LISTVIEW), wndParent); }
|
||||
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_LISTVIEW, wndParent); }
|
||||
|
||||
CListViewDialog(): DeleteIsAllowed(false) {}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "StdAfx.h"
|
||||
#include "MessagesDialog.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/IntToString.h"
|
||||
#include "Windows/ResourceString.h"
|
||||
|
||||
#ifdef LANG
|
||||
@@ -18,24 +19,21 @@ static CIDLangPair kIDLangPairs[] =
|
||||
};
|
||||
#endif
|
||||
|
||||
void CMessagesDialog::AddMessageDirect(LPCTSTR message)
|
||||
void CMessagesDialog::AddMessageDirect(LPCWSTR message)
|
||||
{
|
||||
int itemIndex = _messageList.GetItemCount();
|
||||
LVITEM item;
|
||||
LVITEMW item;
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iItem = itemIndex;
|
||||
|
||||
CSysString stringNumber;
|
||||
TCHAR sz[32];
|
||||
wsprintf(sz, TEXT("%d"), itemIndex);
|
||||
stringNumber = sz;
|
||||
wchar_t sz[32];
|
||||
ConvertInt64ToString(itemIndex, sz);
|
||||
|
||||
item.pszText = (LPTSTR)(LPCTSTR)stringNumber;
|
||||
item.pszText = sz;
|
||||
item.iSubItem = 0;
|
||||
_messageList.InsertItem(&item);
|
||||
|
||||
item.mask = LVIF_TEXT;
|
||||
item.pszText = (LPTSTR)message;
|
||||
item.pszText = (LPWSTR)message;
|
||||
item.iSubItem = 1;
|
||||
_messageList.SetItem(&item);
|
||||
}
|
||||
@@ -48,10 +46,10 @@ void CMessagesDialog::AddMessage(LPCWSTR message)
|
||||
int pos = s.Find(L'\n');
|
||||
if (pos < 0)
|
||||
break;
|
||||
AddMessageDirect(GetSystemString(s.Left(pos)));
|
||||
AddMessageDirect(s.Left(pos));
|
||||
s.Delete(0, pos + 1);
|
||||
}
|
||||
AddMessageDirect(GetSystemString(s));
|
||||
AddMessageDirect(s);
|
||||
}
|
||||
|
||||
bool CMessagesDialog::OnInit()
|
||||
@@ -61,11 +59,12 @@ bool CMessagesDialog::OnInit()
|
||||
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
|
||||
#endif
|
||||
_messageList.Attach(GetItem(IDC_MESSAGE_LIST));
|
||||
_messageList.SetUnicodeFormat(true);
|
||||
|
||||
LVCOLUMN columnInfo;
|
||||
LVCOLUMNW columnInfo;
|
||||
columnInfo.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
|
||||
columnInfo.fmt = LVCFMT_LEFT;
|
||||
columnInfo.pszText = TEXT("#");
|
||||
columnInfo.pszText = L"#";
|
||||
columnInfo.iSubItem = 0;
|
||||
columnInfo.cx = 30;
|
||||
|
||||
@@ -74,13 +73,14 @@ bool CMessagesDialog::OnInit()
|
||||
|
||||
columnInfo.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
|
||||
columnInfo.fmt = LVCFMT_LEFT;
|
||||
#ifdef LANG
|
||||
CSysString s = LangLoadString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN, 0x02000A80);
|
||||
UString s =
|
||||
#ifdef LANG
|
||||
LangString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN, 0x02000A80);
|
||||
#else
|
||||
CSysString s = MyLoadString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN);
|
||||
MyLoadStringW(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN);
|
||||
#endif
|
||||
|
||||
columnInfo.pszText = (LPTSTR)(LPCTSTR)s;
|
||||
columnInfo.pszText = (LPWSTR)(LPCWSTR)s;
|
||||
columnInfo.iSubItem = 1;
|
||||
columnInfo.cx = 450;
|
||||
|
||||
|
||||
@@ -11,13 +11,12 @@
|
||||
class CMessagesDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
NWindows::NControl::CListView _messageList;
|
||||
void AddMessageDirect(LPCTSTR message);
|
||||
void AddMessageDirect(LPCWSTR message);
|
||||
void AddMessage(LPCWSTR message);
|
||||
virtual bool OnInit();
|
||||
public:
|
||||
const UStringVector *Messages;
|
||||
INT_PTR Create(HWND parentWindow = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_MESSAGES), parentWindow); }
|
||||
INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_DIALOG_MESSAGES, parent); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,7 +45,7 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
|
||||
#ifdef LANG
|
||||
0x02000982,
|
||||
#endif
|
||||
NumberToStringW(fileInfo.Size));
|
||||
NumberToString(fileInfo.Size));
|
||||
|
||||
UString reducedName;
|
||||
const int kLineSize = 88;
|
||||
@@ -70,11 +70,12 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
|
||||
timeString = ConvertFileTimeToString(localFileTime);
|
||||
|
||||
fullString +=
|
||||
#ifdef LANG
|
||||
LangLoadStringW(IDS_FILE_MODIFIED, 0x02000983);
|
||||
#ifdef LANG
|
||||
LangString(IDS_FILE_MODIFIED, 0x02000983);
|
||||
#else
|
||||
MyLoadStringW(IDS_FILE_MODIFIED);
|
||||
#endif
|
||||
|
||||
fullString += L" ";
|
||||
fullString += timeString;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,7 @@ class COverwriteDialog: public NWindows::NControl::CModalDialog
|
||||
virtual bool OnInit();
|
||||
bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
public:
|
||||
INT_PTR Create(HWND parent = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_OVERWRITE), parent); }
|
||||
INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_DIALOG_OVERWRITE, parent); }
|
||||
|
||||
NOverwriteDialog::CFileInfo OldFileInfo;
|
||||
NOverwriteDialog::CFileInfo NewFileInfo;
|
||||
|
||||
@@ -35,7 +35,7 @@ bool CPasswordDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
_passwordControl.SetPasswordChar((IsButtonChecked(
|
||||
IDC_CHECK_PASSWORD_SHOW) == BST_CHECKED) ? 0: TEXT('*'));
|
||||
CSysString password;
|
||||
UString password;
|
||||
_passwordControl.GetText(password);
|
||||
_passwordControl.SetText(password);
|
||||
return true;
|
||||
|
||||
@@ -15,8 +15,7 @@ class CPasswordDialog: public NWindows::NControl::CModalDialog
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
public:
|
||||
UString Password;
|
||||
INT_PTR Create(HWND parentWindow = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_PASSWORD), parentWindow); }
|
||||
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_PASSWORD, parentWindow); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,18 +33,17 @@ bool CPluginsPage::OnInit()
|
||||
|
||||
_listView.Attach(GetItem(IDC_PLUGINS_LIST));
|
||||
|
||||
UINT32 aNewFlags = /*LVS_EX_CHECKBOXES | */ LVS_EX_FULLROWSELECT;
|
||||
_listView.SetExtendedListViewStyle(aNewFlags, aNewFlags);
|
||||
UINT32 newFlags = /*LVS_EX_CHECKBOXES | */ LVS_EX_FULLROWSELECT;
|
||||
_listView.SetExtendedListViewStyle(newFlags, newFlags);
|
||||
|
||||
// CSysString aString = LangLoadString(IDS_COLUMN_TITLE, 0x02000E81);
|
||||
CSysString aString = TEXT("Plugins");
|
||||
LVCOLUMN aColumn;
|
||||
aColumn.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
|
||||
aColumn.cx = 160;
|
||||
aColumn.fmt = LVCFMT_LEFT;
|
||||
aColumn.pszText = (LPTSTR)(LPCTSTR)aString;
|
||||
aColumn.iSubItem = 0;
|
||||
_listView.InsertColumn(0, &aColumn);
|
||||
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);
|
||||
|
||||
@@ -52,22 +51,22 @@ bool CPluginsPage::OnInit()
|
||||
// _listView.DeleteAllItems();
|
||||
for(int i = 0; i < _plugins.Size(); i++)
|
||||
{
|
||||
LVITEM anItem;
|
||||
anItem.iItem = i;
|
||||
anItem.mask = LVIF_TEXT | LVIF_STATE;
|
||||
CSysString pluginName = GetSystemString(_plugins[i].Name);
|
||||
anItem.pszText = (TCHAR *)(const TCHAR *)pluginName;
|
||||
anItem.state = 0;
|
||||
anItem.stateMask = UINT(-1);
|
||||
anItem.iSubItem = 0;
|
||||
_listView.InsertItem(&anItem);
|
||||
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 aState = LVIS_SELECTED | LVIS_FOCUSED;
|
||||
_listView.SetItemState(0, aState, aState);
|
||||
UINT state = LVIS_SELECTED | LVIS_FOCUSED;
|
||||
_listView.SetItemState(0, state, state);
|
||||
}
|
||||
|
||||
return CPropertyPage::OnInit();
|
||||
@@ -76,8 +75,8 @@ bool CPluginsPage::OnInit()
|
||||
LONG CPluginsPage::OnApply()
|
||||
{
|
||||
/*
|
||||
int aSelectedIndex = m_Lang.GetCurSel();
|
||||
int aPathIndex = m_Lang.GetItemData(aSelectedIndex);
|
||||
int selectedIndex = m_Lang.GetCurSel();
|
||||
int aPathIndex = m_Lang.GetItemData(selectedIndex);
|
||||
SaveRegLang(m_Paths[aPathIndex]);
|
||||
ReloadLang();
|
||||
*/
|
||||
@@ -123,31 +122,14 @@ STDMETHODIMP CPluginOptionsCallback::GetProgramFolderPath(BSTR *value)
|
||||
UString folder;
|
||||
if (!::GetProgramFolderPath(folder))
|
||||
return E_FAIL;
|
||||
CMyComBSTR valueTemp = GetUnicodeString(folder);
|
||||
CMyComBSTR valueTemp = folder;
|
||||
*value = valueTemp.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifndef _WIN64
|
||||
static bool IsItWindowsNT()
|
||||
{
|
||||
OSVERSIONINFO aVersionInfo;
|
||||
aVersionInfo.dwOSVersionInfoSize = sizeof(aVersionInfo);
|
||||
if (!::GetVersionEx(&aVersionInfo))
|
||||
return false;
|
||||
return (aVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
|
||||
}
|
||||
#endif
|
||||
|
||||
static UString GetDefaultProgramName()
|
||||
{
|
||||
UString name;
|
||||
name += L"7zFM";
|
||||
#ifndef _WIN64
|
||||
if (IsItWindowsNT())
|
||||
name += L"n";
|
||||
#endif
|
||||
return name + L".exe";
|
||||
return L"7zFM.exe";
|
||||
}
|
||||
|
||||
STDMETHODIMP CPluginOptionsCallback::GetProgramPath(BSTR *value)
|
||||
@@ -214,9 +196,9 @@ bool CPluginsPage::OnNotify(UINT controlID, LPNMHDR lParam)
|
||||
const NMLISTVIEW *aNMListView = (const NMLISTVIEW *)lParam;
|
||||
if ((aNMListView->uChanged & LVIF_STATE) != 0)
|
||||
{
|
||||
UINT anOldState = aNMListView->uOldState & LVIS_STATEIMAGEMASK;
|
||||
UINT aNewState = aNMListView->uNewState & LVIS_STATEIMAGEMASK;
|
||||
if (anOldState != aNewState)
|
||||
UINT oldState = aNMListView->uOldState & LVIS_STATEIMAGEMASK;
|
||||
UINT newState = aNMListView->uNewState & LVIS_STATEIMAGEMASK;
|
||||
if (oldState != newState)
|
||||
Changed();
|
||||
}
|
||||
return true;
|
||||
@@ -225,14 +207,14 @@ bool CPluginsPage::OnNotify(UINT controlID, LPNMHDR lParam)
|
||||
}
|
||||
|
||||
/*
|
||||
bool CPluginsPage::OnCommand(int aCode, int anItemID, LPARAM lParam)
|
||||
bool CPluginsPage::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
{
|
||||
if (aCode == CBN_SELCHANGE && anItemID == IDC_LANG_COMBO_LANG)
|
||||
if (code == CBN_SELCHANGE && itemID == IDC_LANG_COMBO_LANG)
|
||||
{
|
||||
Changed();
|
||||
return true;
|
||||
}
|
||||
return CPropertyPage::OnCommand(aCode, anItemID, lParam);
|
||||
return CPropertyPage::OnCommand(code, itemID, lParam);
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -17,7 +17,6 @@ class CPluginsPage: public NWindows::NControl::CPropertyPage
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
virtual void OnNotifyHelp();
|
||||
// virtual bool OnCommand(int aCode, int anItemID, LPARAM lParam);
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
virtual void OnButtonOptions();
|
||||
virtual LONG OnApply();
|
||||
|
||||
@@ -27,10 +27,10 @@ CProgressDialog::~CProgressDialog()
|
||||
{
|
||||
AddToTitle(TEXT(""));
|
||||
}
|
||||
void CProgressDialog::AddToTitle(LPCTSTR s)
|
||||
void CProgressDialog::AddToTitle(LPCWSTR s)
|
||||
{
|
||||
if (MainWindow != 0)
|
||||
::SetWindowText(MainWindow, s + UString(MainTitle));
|
||||
::MySetWindowText(MainWindow, UString(s) + MainTitle);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
virtual void OnCancel();
|
||||
NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
|
||||
#ifndef _SFX
|
||||
void AddToTitle(LPCTSTR string);
|
||||
void AddToTitle(LPCWSTR string);
|
||||
#endif
|
||||
bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
public:
|
||||
@@ -110,10 +110,10 @@ public:
|
||||
void WaitCreating() { _dialogCreatedEvent.Lock(); }
|
||||
|
||||
|
||||
INT_PTR Create(const UString &title, HWND aWndParent = 0)
|
||||
INT_PTR Create(const UString &title, HWND wndParent = 0)
|
||||
{
|
||||
_title = title;
|
||||
return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_PROGRESS), aWndParent);
|
||||
return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
|
||||
}
|
||||
|
||||
static const UINT kCloseMessage;
|
||||
|
||||
@@ -69,7 +69,7 @@ static void ReduceString(UString &s, int size)
|
||||
|
||||
bool CProgressDialog::OnInit()
|
||||
{
|
||||
_range = UInt64(-1);
|
||||
_range = (UInt64)(Int64)(-1);
|
||||
_prevPercentValue = UInt32(-1);
|
||||
_prevElapsedSec = UInt32(-1);
|
||||
_prevRemainingSec = UInt32(-1);
|
||||
@@ -93,9 +93,9 @@ bool CProgressDialog::OnInit()
|
||||
window = GetItem(IDC_BUTTON_PAUSE);
|
||||
window.GetText(pauseString);
|
||||
|
||||
foregroundString = LangLoadStringW(IDS_PROGRESS_FOREGROUND, 0x02000C11);
|
||||
continueString = LangLoadStringW(IDS_PROGRESS_CONTINUE, 0x02000C13);
|
||||
pausedString = LangLoadStringW(IDS_PROGRESS_PAUSED, 0x02000C20);
|
||||
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);
|
||||
@@ -113,27 +113,19 @@ void CProgressDialog::OnCancel()
|
||||
|
||||
static void ConvertSizeToString(UInt64 value, wchar_t *s)
|
||||
{
|
||||
if (value < (UInt64(10000) << 0))
|
||||
{
|
||||
ConvertUInt64ToString(value, s);
|
||||
lstrcatW(s, L" B");
|
||||
return;
|
||||
}
|
||||
if (value < (UInt64(10000) << 10))
|
||||
{
|
||||
ConvertUInt64ToString((value >> 10), s);
|
||||
lstrcatW(s, L" KB");
|
||||
return;
|
||||
}
|
||||
if (value < (UInt64(10000) << 20))
|
||||
{
|
||||
ConvertUInt64ToString((value >> 20), s);
|
||||
lstrcatW(s, L" MB");
|
||||
return;
|
||||
}
|
||||
ConvertUInt64ToString((value >> 30), s);
|
||||
lstrcatW(s, L" GB");
|
||||
return;
|
||||
const wchar_t *kModif = L" KMGTP";
|
||||
for (int i = 0; true; 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)
|
||||
@@ -182,7 +174,13 @@ bool CProgressDialog::OnTimer(WPARAM timerID, LPARAM callback)
|
||||
|
||||
if (total != _range)
|
||||
SetRange(total);
|
||||
SetPos(completed);
|
||||
if (total == (UInt64)(Int64)-1)
|
||||
{
|
||||
SetPos(0);
|
||||
SetRange(completed);
|
||||
}
|
||||
else
|
||||
SetPos(completed);
|
||||
|
||||
_elapsedTime += (curTime - _prevTime);
|
||||
_prevTime = curTime;
|
||||
@@ -201,16 +199,23 @@ bool CProgressDialog::OnTimer(WPARAM timerID, LPARAM callback)
|
||||
|
||||
if (completed != 0 && elapsedChanged)
|
||||
{
|
||||
UInt64 remainingTime = 0;
|
||||
if (completed < total)
|
||||
remainingTime = _elapsedTime * (total - completed) / completed;
|
||||
UInt64 remainingSec = remainingTime / 1000;
|
||||
if (remainingSec != _prevRemainingSec)
|
||||
if (total == (UInt64)(Int64)-1)
|
||||
{
|
||||
TCHAR s[40];
|
||||
GetTimeString(remainingSec, s);
|
||||
SetItemText(IDC_PROGRESS_REMAINING_VALUE, s);
|
||||
_prevRemainingSec = remainingSec;
|
||||
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)
|
||||
{
|
||||
@@ -405,7 +410,7 @@ bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
if (!paused)
|
||||
OnPauseButton();
|
||||
int res = ::MessageBoxW(HWND(*this),
|
||||
LangLoadStringW(IDS_PROGRESS_ASK_CANCEL, 0x02000C30),
|
||||
LangString(IDS_PROGRESS_ASK_CANCEL, 0x02000C30),
|
||||
_title, MB_YESNOCANCEL);
|
||||
// ProgressSynch.SetPaused(paused);
|
||||
if (!paused)
|
||||
|
||||
@@ -21,7 +21,7 @@ class CProgressSynch
|
||||
UString TitleFileName;
|
||||
UString CurrentFileName;
|
||||
public:
|
||||
CProgressSynch(): _stopped(false), _paused(false), _total(1), _completed(0) {}
|
||||
CProgressSynch(): _stopped(false), _paused(false), _total((UInt64)(Int64)-1), _completed(0) {}
|
||||
|
||||
bool GetStopped()
|
||||
{
|
||||
@@ -168,10 +168,10 @@ public:
|
||||
void WaitCreating() { _dialogCreatedEvent.Lock(); }
|
||||
|
||||
|
||||
INT_PTR Create(const UString &title, HWND aWndParent = 0)
|
||||
INT_PTR Create(const UString &title, HWND wndParent = 0)
|
||||
{
|
||||
_title = title;
|
||||
return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_PROGRESS), aWndParent);
|
||||
return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
|
||||
}
|
||||
|
||||
static const UINT kCloseMessage;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Defs.h"
|
||||
#include "Windows/MemoryLock.h"
|
||||
|
||||
#include "../../RegistryUtils.h"
|
||||
#include "../../HelpUtils.h"
|
||||
@@ -23,12 +24,15 @@ static CIDLangPair kIDLangPairs[] =
|
||||
{ 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]));
|
||||
@@ -40,6 +44,10 @@ bool CSettingsPage::OnInit()
|
||||
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());
|
||||
|
||||
@@ -64,6 +72,12 @@ LONG CSettingsPage::OnApply()
|
||||
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));
|
||||
@@ -91,6 +105,7 @@ bool CSettingsPage::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
case IDC_SETTINGS_FULL_ROW:
|
||||
case IDC_SETTINGS_SHOW_GRID:
|
||||
case IDC_SETTINGS_ALTERNATIVE_SELECTION:
|
||||
case IDC_SETTINGS_LARGE_PAGES:
|
||||
Changed();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,3 +8,4 @@
|
||||
#define IDC_SETTINGS_SINGLE_CLICK 1014
|
||||
#define IDC_SETTINGS_UNDERLINE 1015
|
||||
#define IDC_SETTINGS_ALTERNATIVE_SELECTION 1016
|
||||
#define IDC_SETTINGS_LARGE_PAGES 1017
|
||||
|
||||
@@ -29,4 +29,7 @@ BEGIN
|
||||
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
|
||||
|
||||
@@ -36,7 +36,7 @@ bool CSplitDialog::OnInit()
|
||||
{
|
||||
UString title;
|
||||
GetText(title);
|
||||
title += ' ';
|
||||
title += L' ';
|
||||
title += FilePath;
|
||||
SetText(title);
|
||||
}
|
||||
@@ -59,10 +59,10 @@ bool CSplitDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
|
||||
void CSplitDialog::OnButtonSetPath()
|
||||
{
|
||||
CSysString currentPath;
|
||||
UString currentPath;
|
||||
_pathCombo.GetText(currentPath);
|
||||
CSysString title = TEXT("Specify a location for output folder");
|
||||
CSysString resultPath;
|
||||
UString title = L"Specify a location for output folder";
|
||||
UString resultPath;
|
||||
if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
|
||||
return;
|
||||
NFile::NName::NormalizeDirPathPrefix(resultPath);
|
||||
@@ -78,7 +78,7 @@ void CSplitDialog::OnOK()
|
||||
volumeString.Trim();
|
||||
if (!ParseVolumeSizes(volumeString, VolumeSizes))
|
||||
{
|
||||
MessageBox((HWND)*this, TEXT("Incorrect volume size"), TEXT("7-Zip"), MB_ICONERROR);
|
||||
MessageBoxW((HWND)*this, L"Incorrect volume size", L"7-Zip", MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
CModalDialog::OnOK();
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
UString Path;
|
||||
CRecordVector<UInt64> VolumeSizes;
|
||||
INT_PTR Create(HWND parentWindow = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_SPLIT), parentWindow); }
|
||||
{ return CModalDialog::Create(IDD_DIALOG_SPLIT, parentWindow); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -50,24 +50,24 @@ bool CSystemPage::OnInit()
|
||||
_listViewExt.SetExtendedListViewStyle(newFlags, newFlags);
|
||||
_listViewPlugins.SetExtendedListViewStyle(newFlags, newFlags);
|
||||
|
||||
CSysString s = LangLoadString(IDS_PROPERTY_EXTENSION, 0x02000205);
|
||||
LVCOLUMN column;
|
||||
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 = (LPTSTR)(LPCTSTR)s;
|
||||
column.pszText = (LPWSTR)(LPCWSTR)s;
|
||||
column.iSubItem = 0;
|
||||
_listViewExt.InsertColumn(0, &column);
|
||||
|
||||
s = LangLoadString(IDS_PLUGIN, 0x03010310);
|
||||
s = LangString(IDS_PLUGIN, 0x03010310);
|
||||
column.cx = 70;
|
||||
column.pszText = (LPTSTR)(LPCTSTR)s;
|
||||
column.pszText = (LPWSTR)(LPCWSTR)s;
|
||||
column.iSubItem = 1;
|
||||
_listViewExt.InsertColumn(1, &column);
|
||||
|
||||
s = LangLoadString(IDS_PLUGIN, 0x03010310);
|
||||
s = LangString(IDS_PLUGIN, 0x03010310);
|
||||
column.cx = 70;
|
||||
column.pszText = (LPTSTR)(LPCTSTR)s;
|
||||
column.pszText = (LPWSTR)(LPCWSTR)s;
|
||||
column.iSubItem = 0;
|
||||
_listViewPlugins.InsertColumn(0, &column);
|
||||
|
||||
@@ -77,12 +77,11 @@ bool CSystemPage::OnInit()
|
||||
{
|
||||
CExtInfoBig &extInfo = _extDatabase.ExtBigItems[i];
|
||||
|
||||
LVITEM item;
|
||||
LVITEMW item;
|
||||
item.iItem = i;
|
||||
item.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
item.lParam = i;
|
||||
CSysString ext = GetSystemString(extInfo.Ext);
|
||||
item.pszText = (LPTSTR)(LPCTSTR)ext;
|
||||
item.pszText = (LPWSTR)(LPCWSTR)extInfo.Ext;
|
||||
item.iSubItem = 0;
|
||||
int itemIndex = _listViewExt.InsertItem(&item);
|
||||
|
||||
@@ -106,53 +105,36 @@ bool CSystemPage::OnInit()
|
||||
|
||||
void CSystemPage::SetMainPluginText(int itemIndex, int indexInDatabase)
|
||||
{
|
||||
LVITEM item;
|
||||
LVITEMW item;
|
||||
item.iItem = itemIndex;
|
||||
item.mask = LVIF_TEXT;
|
||||
CSysString mainPlugin = GetSystemString(
|
||||
_extDatabase.GetMainPluginNameForExtItem(indexInDatabase));
|
||||
item.pszText = (TCHAR *)(const TCHAR *)mainPlugin;
|
||||
UString mainPlugin = _extDatabase.GetMainPluginNameForExtItem(indexInDatabase);
|
||||
item.pszText = (WCHAR *)(const WCHAR *)mainPlugin;
|
||||
item.iSubItem = 1;
|
||||
_listViewExt.SetItem(&item);
|
||||
}
|
||||
|
||||
#ifndef _WIN64
|
||||
static bool IsItWindowsNT()
|
||||
{
|
||||
OSVERSIONINFO versionInfo;
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
|
||||
if (!::GetVersionEx(&versionInfo))
|
||||
return false;
|
||||
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
|
||||
}
|
||||
#endif
|
||||
|
||||
static UString GetProgramCommand()
|
||||
{
|
||||
UString path = L"\"";
|
||||
UString folder;
|
||||
if (GetProgramFolderPath(folder))
|
||||
path += folder;
|
||||
path += L"7zFM";
|
||||
#ifndef _WIN64
|
||||
if (IsItWindowsNT())
|
||||
path += L"n";
|
||||
#endif
|
||||
path += L".exe\" \"%1\"";
|
||||
path += L"7zFM.exe\" \"%1\"";
|
||||
return path;
|
||||
}
|
||||
|
||||
static CSysString GetIconPath(const CSysString &filePath,
|
||||
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 CSysString();
|
||||
return UString();
|
||||
CMyComBSTR typesString;
|
||||
if (folderManager->GetTypes(&typesString) != S_OK)
|
||||
return CSysString();
|
||||
return UString();
|
||||
UStringVector types;
|
||||
SplitString((const wchar_t *)typesString, types);
|
||||
for (int typeIndex = 0; typeIndex < types.Size(); typeIndex++)
|
||||
@@ -164,16 +146,15 @@ static CSysString GetIconPath(const CSysString &filePath,
|
||||
if (extension.CompareNoCase((const wchar_t *)extTemp) == 0)
|
||||
{
|
||||
CMyComPtr<IFolderManagerGetIconPath> getIconPath;
|
||||
if (folderManager.QueryInterface(
|
||||
IID_IFolderManagerGetIconPath, &getIconPath) != S_OK)
|
||||
return CSysString();
|
||||
if (folderManager.QueryInterface(IID_IFolderManagerGetIconPath, &getIconPath) != S_OK)
|
||||
break;
|
||||
CMyComBSTR iconPathTemp;
|
||||
if (getIconPath->GetIconPath(type, &iconPathTemp) != S_OK)
|
||||
return CSysString();
|
||||
return GetSystemString((const wchar_t *)iconPathTemp);
|
||||
break;
|
||||
return (const wchar_t *)iconPathTemp;
|
||||
}
|
||||
}
|
||||
return CSysString();
|
||||
return UString();
|
||||
}
|
||||
|
||||
LONG CSystemPage::OnApply()
|
||||
@@ -189,7 +170,7 @@ LONG CSystemPage::OnApply()
|
||||
{
|
||||
UString title = extInfo.Ext + UString(L" Archive");
|
||||
UString command = GetProgramCommand();
|
||||
CSysString iconPath;
|
||||
UString iconPath;
|
||||
if (!extInfo.PluginsPairs.IsEmpty())
|
||||
{
|
||||
const CPluginInfo &plugin = _extDatabase.Plugins[extInfo.PluginsPairs[0].Index];
|
||||
@@ -197,8 +178,8 @@ LONG CSystemPage::OnApply()
|
||||
}
|
||||
NRegistryAssociations::AddShellExtensionInfo(
|
||||
GetSystemString(extInfo.Ext),
|
||||
GetSystemString(title),
|
||||
GetSystemString(command),
|
||||
title,
|
||||
command,
|
||||
iconPath, NULL, 0);
|
||||
}
|
||||
else
|
||||
@@ -210,7 +191,7 @@ LONG CSystemPage::OnApply()
|
||||
else
|
||||
NRegistryAssociations::DeleteContextMenuHandler();
|
||||
*/
|
||||
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
|
||||
return PSNRET_NOERROR;
|
||||
}
|
||||
|
||||
@@ -411,12 +392,12 @@ void CSystemPage::RefreshPluginsList(int selectIndex)
|
||||
for (int i = 0; i < extInfo.PluginsPairs.Size(); i++)
|
||||
{
|
||||
CPluginEnabledPair pluginPair = extInfo.PluginsPairs[i];
|
||||
CSysString pluginName = GetSystemString(_extDatabase.Plugins[pluginPair.Index].Name);
|
||||
LVITEM item;
|
||||
UString pluginName = _extDatabase.Plugins[pluginPair.Index].Name;
|
||||
LVITEMW item;
|
||||
item.iItem = i;
|
||||
item.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
item.lParam = i;
|
||||
item.pszText = (LPTSTR)(LPCTSTR)pluginName;
|
||||
item.pszText = (LPWSTR)(LPCWSTR)pluginName;
|
||||
item.iSubItem = 0;
|
||||
int itemIndex = _listViewPlugins.InsertItem(&item);
|
||||
_listViewPlugins.SetCheckState(itemIndex, pluginPair.Enabled);
|
||||
@@ -434,9 +415,6 @@ void CSystemPage::RefreshPluginsList(int selectIndex)
|
||||
|
||||
|
||||
/*
|
||||
static LPCTSTR kZIPExtension = TEXT("zip");
|
||||
static LPCTSTR kRARExtension = TEXT("rar");
|
||||
|
||||
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 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user