mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 05:15:01 -06:00
9.06 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
829409452d
commit
c99f3ebdd6
@@ -118,6 +118,9 @@ LRESULT CPanel::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case kRefreshStatusBar:
|
||||
OnRefreshStatusBar();
|
||||
return 0;
|
||||
case kRefreshHeaderComboBox:
|
||||
LoadFullPathAndShow();
|
||||
return 0;
|
||||
case WM_TIMER:
|
||||
OnTimer();
|
||||
return 0;
|
||||
@@ -184,6 +187,7 @@ LRESULT CMyListView::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
bool shift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0;
|
||||
switch(wParam)
|
||||
{
|
||||
/*
|
||||
case VK_RETURN:
|
||||
{
|
||||
if (shift && !alt && !ctrl)
|
||||
@@ -193,6 +197,7 @@ LRESULT CMyListView::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case VK_NEXT:
|
||||
{
|
||||
if (ctrl && !alt && !shift)
|
||||
@@ -210,6 +215,17 @@ LRESULT CMyListView::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef UNDER_CE
|
||||
else if (message == WM_KEYUP)
|
||||
{
|
||||
if (wParam == VK_F2) // it's VK_TSOFT2
|
||||
{
|
||||
// Activate Menu
|
||||
::PostMessage(g_HWND, WM_SYSCOMMAND, SC_KEYMENU, 0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (message == WM_SETFOCUS)
|
||||
{
|
||||
_panel->_lastFocusedIsList = true;
|
||||
@@ -310,15 +326,6 @@ LRESULT CMyComboBoxEdit::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
|
||||
}
|
||||
|
||||
static HIMAGELIST GetSysImageList(bool smallIcons)
|
||||
{
|
||||
SHFILEINFO shellInfo;
|
||||
return (HIMAGELIST)SHGetFileInfo(TEXT(""),
|
||||
FILE_ATTRIBUTE_NORMAL |FILE_ATTRIBUTE_DIRECTORY,
|
||||
&shellInfo, sizeof(shellInfo),
|
||||
SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | (smallIcons ? SHGFI_SMALLICON : SHGFI_ICON));
|
||||
}
|
||||
|
||||
bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
|
||||
{
|
||||
// _virtualMode = false;
|
||||
@@ -356,7 +363,9 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
|
||||
HWND(*this), (HMENU)(UINT_PTR)(_baseID + 1), g_hInstance, NULL))
|
||||
return false;
|
||||
|
||||
#ifndef UNDER_CE
|
||||
_listView.SetUnicodeFormat(true);
|
||||
#endif
|
||||
|
||||
_listView.SetUserDataLongPtr(LONG_PTR(&_listView));
|
||||
_listView._panel = this;
|
||||
@@ -398,7 +407,9 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
|
||||
// {VIEW_NEWFOLDER, kCreateFolderID, TBSTATE_ENABLED, BTNS_BUTTON, 0L, 0},
|
||||
};
|
||||
|
||||
#ifndef UNDER_CE
|
||||
if (g_ComCtl32Version >= MAKELONG(71, 4))
|
||||
#endif
|
||||
{
|
||||
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||
icex.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES;
|
||||
@@ -409,7 +420,7 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
|
||||
NULL, WS_VISIBLE | WS_BORDER | WS_CHILD |
|
||||
WS_CLIPCHILDREN | WS_CLIPSIBLINGS
|
||||
| CCS_NODIVIDER
|
||||
| CCS_NOPARENTALIGN
|
||||
// | CCS_NOPARENTALIGN
|
||||
| CCS_TOP
|
||||
| RBS_VARHEIGHT
|
||||
| RBS_BANDBORDERS
|
||||
@@ -437,17 +448,27 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
|
||||
(LPCTBBUTTON)&tbb, sizeof(tbb) / sizeof(tbb[0]),
|
||||
0, 0, 0, 0, sizeof (TBBUTTON)));
|
||||
|
||||
#ifndef UNDER_CE
|
||||
// Load ComboBoxEx class
|
||||
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||
icex.dwICC = ICC_USEREX_CLASSES;
|
||||
InitCommonControlsEx(&icex);
|
||||
#endif
|
||||
|
||||
_headerComboBox.CreateEx(0, WC_COMBOBOXEXW, NULL,
|
||||
_headerComboBox.CreateEx(0,
|
||||
#ifdef UNDER_CE
|
||||
WC_COMBOBOXW
|
||||
#else
|
||||
WC_COMBOBOXEXW
|
||||
#endif
|
||||
, NULL,
|
||||
WS_BORDER | WS_VISIBLE |WS_CHILD | CBS_DROPDOWN | CBS_AUTOHSCROLL,
|
||||
0, 0, 100, 520,
|
||||
((_headerReBar == 0) ? HWND(*this) : _headerToolBar),
|
||||
(HMENU)(UINT_PTR)(_comboBoxID),
|
||||
g_hInstance, NULL);
|
||||
_headerComboBox.SendMessage(CBEM_SETUNICODEFORMAT, (WPARAM)(BOOL)TRUE, 0);
|
||||
#ifndef UNDER_CE
|
||||
_headerComboBox.SetUnicodeFormat(true);
|
||||
|
||||
_headerComboBox.SetImageList(GetSysImageList(true));
|
||||
|
||||
@@ -475,6 +496,8 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
|
||||
_comboBoxEdit._origWindowProc =
|
||||
(WNDPROC)_comboBoxEdit.SetLongPtr(GWLP_WNDPROC, LONG_PTR(ComboBoxEditSubclassProc));
|
||||
|
||||
#endif
|
||||
|
||||
if (_headerReBar)
|
||||
{
|
||||
REBARINFO rbi;
|
||||
@@ -491,7 +514,7 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
|
||||
|
||||
REBARBANDINFO rbBand;
|
||||
rbBand.cbSize = sizeof(REBARBANDINFO); // Required
|
||||
rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE;
|
||||
rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE;
|
||||
rbBand.fStyle = RBBS_NOGRIPPER;
|
||||
rbBand.cxMinChild = size.cx;
|
||||
rbBand.cyMinChild = size.cy;
|
||||
@@ -540,6 +563,8 @@ void CPanel::OnDestroy()
|
||||
|
||||
void CPanel::ChangeWindowSize(int xSize, int ySize)
|
||||
{
|
||||
if ((HWND)*this == 0)
|
||||
return;
|
||||
int kHeaderSize;
|
||||
int kStatusBarSize;
|
||||
// int kStatusBar2Size;
|
||||
@@ -577,6 +602,8 @@ void CPanel::ChangeWindowSize(int xSize, int ySize)
|
||||
|
||||
bool CPanel::OnSize(WPARAM /* wParam */, int xSize, int ySize)
|
||||
{
|
||||
if ((HWND)*this == 0)
|
||||
return true;
|
||||
if (_headerReBar)
|
||||
_headerReBar.Move(0, 0, xSize, 0);
|
||||
ChangeWindowSize(xSize, ySize);
|
||||
@@ -611,7 +638,7 @@ bool CPanel::OnNotify(UINT /* controlID */, LPNMHDR header, LRESULT &result)
|
||||
return OnNotifyList(header, result);
|
||||
else if (::GetParent(header->hwndFrom) == _listView &&
|
||||
header->code == NM_RCLICK)
|
||||
return OnRightClick((LPNMITEMACTIVATE)header, result);
|
||||
return OnRightClick((MY_NMLISTVIEW_NMITEMACTIVATE *)header, result);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -647,15 +674,11 @@ void CPanel::MessageBox(LPCWSTR message)
|
||||
{ MessageBox(message, L"7-Zip"); }
|
||||
void CPanel::MessageBoxMyError(LPCWSTR message)
|
||||
{ MessageBox(message, L"Error"); }
|
||||
|
||||
|
||||
void CPanel::MessageBoxError(HRESULT errorCode, LPCWSTR caption)
|
||||
{
|
||||
UString message;
|
||||
if (errorCode == E_OUTOFMEMORY)
|
||||
message = LangString(IDS_MEM_ERROR, 0x0200060B);
|
||||
else
|
||||
if (!NError::MyFormatMessage(errorCode, message))
|
||||
message = L"Error";
|
||||
MessageBox(message, caption);
|
||||
MessageBox(HResultToMessage(errorCode), caption);
|
||||
}
|
||||
|
||||
void CPanel::MessageBoxError(HRESULT errorCode)
|
||||
@@ -791,26 +814,19 @@ void CPanel::AddToArchive()
|
||||
UString destCurDirPrefix = _currentFolderPrefix;
|
||||
if (IsFSDrivesFolder())
|
||||
{
|
||||
destCurDirPrefix = L"C:\\";
|
||||
destCurDirPrefix = ROOT_FS_FOLDER;
|
||||
if (!IsDeviceDrivesPrefix())
|
||||
curPrefix.Empty();
|
||||
}
|
||||
|
||||
for (int i = 0; i < indices.Size(); i++)
|
||||
{
|
||||
int index = indices[i];
|
||||
names.Add(curPrefix + GetItemRelPath(index));
|
||||
}
|
||||
const UString archiveName = CreateArchiveName(
|
||||
names.Front(), (names.Size() > 1), false);
|
||||
|
||||
names.Add(curPrefix + GetItemRelPath(indices[i]));
|
||||
const UString archiveName = CreateArchiveName(names.Front(), (names.Size() > 1), false);
|
||||
HRESULT res = CompressFiles(destCurDirPrefix, archiveName, L"", names, false, true, false);
|
||||
if (res != S_OK)
|
||||
{
|
||||
if (_currentFolderPrefix.Length() >= MAX_PATH)
|
||||
if (destCurDirPrefix.Length() >= MAX_PATH)
|
||||
MessageBoxErrorLang(IDS_MESSAGE_UNSUPPORTED_OPERATION_FOR_LONG_PATH_FOLDER, 0x03020A01);
|
||||
else
|
||||
MessageBoxError(res);
|
||||
}
|
||||
// KillSelection();
|
||||
}
|
||||
@@ -866,40 +882,45 @@ void CPanel::ExtractArchives()
|
||||
::ExtractArchives(paths, _currentFolderPrefix + folderName + UString(WCHAR_PATH_SEPARATOR), true);
|
||||
}
|
||||
|
||||
struct CThreadTest
|
||||
{
|
||||
CRecordVector<UInt32> Indices;
|
||||
CExtractCallbackImp *ExtractCallbackSpec;
|
||||
CMyComPtr<IFolderArchiveExtractCallback> ExtractCallback;
|
||||
CMyComPtr<IArchiveFolder> ArchiveFolder;
|
||||
HRESULT Result;
|
||||
|
||||
void Test()
|
||||
{
|
||||
ExtractCallbackSpec->ProgressDialog.WaitCreating();
|
||||
Result = ArchiveFolder->Extract(&Indices[0], Indices.Size(),
|
||||
NExtract::NPathMode::kFullPathnames, NExtract::NOverwriteMode::kAskBefore,
|
||||
NULL, BoolToInt(true), ExtractCallback);
|
||||
ExtractCallbackSpec->ProgressDialog.MyClose();
|
||||
}
|
||||
|
||||
static THREAD_FUNC_DECL MyThreadFunction(void *param)
|
||||
{
|
||||
((CThreadTest*)param)->Test();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
static void AddValuePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
|
||||
{
|
||||
wchar_t sz[32];
|
||||
s += LangString(resourceID, langID);
|
||||
s += L" ";
|
||||
s += L' ';
|
||||
ConvertUInt64ToString(value, sz);
|
||||
s += sz;
|
||||
s += L"\n";
|
||||
s += L'\n';
|
||||
}
|
||||
|
||||
class CThreadTest: public CProgressThreadVirt
|
||||
{
|
||||
HRESULT ProcessVirt();
|
||||
public:
|
||||
CRecordVector<UInt32> Indices;
|
||||
CExtractCallbackImp *ExtractCallbackSpec;
|
||||
CMyComPtr<IFolderArchiveExtractCallback> ExtractCallback;
|
||||
CMyComPtr<IArchiveFolder> ArchiveFolder;
|
||||
};
|
||||
|
||||
HRESULT CThreadTest::ProcessVirt()
|
||||
{
|
||||
RINOK(ArchiveFolder->Extract(&Indices[0], Indices.Size(),
|
||||
NExtract::NPathMode::kFullPathnames, NExtract::NOverwriteMode::kAskBefore,
|
||||
NULL, BoolToInt(true), ExtractCallback));
|
||||
if (ExtractCallbackSpec->IsOK())
|
||||
{
|
||||
UString s;
|
||||
AddValuePair(IDS_FOLDERS_COLON, 0x02000321, ExtractCallbackSpec->NumFolders, s);
|
||||
AddValuePair(IDS_FILES_COLON, 0x02000320, ExtractCallbackSpec->NumFiles, s);
|
||||
// AddSizePair(IDS_SIZE_COLON, 0x02000322, Stat.UnpackSize, s);
|
||||
// AddSizePair(IDS_COMPRESSED_COLON, 0x02000323, Stat.PackSize, s);
|
||||
s += L'\n';
|
||||
s += LangString(IDS_MESSAGE_NO_ERRORS, 0x02000608);
|
||||
OkMessage = s;
|
||||
}
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
/*
|
||||
static void AddSizePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
|
||||
{
|
||||
@@ -912,7 +933,7 @@ static void AddSizePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s
|
||||
s += L" (";
|
||||
s += sz;
|
||||
s += L" MB)";
|
||||
s += L"\n";
|
||||
s += L'\n';
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -930,8 +951,7 @@ void CPanel::TestArchives()
|
||||
extracter.ArchiveFolder = archiveFolder;
|
||||
extracter.ExtractCallbackSpec = new CExtractCallbackImp;
|
||||
extracter.ExtractCallback = extracter.ExtractCallbackSpec;
|
||||
extracter.ExtractCallbackSpec->ParentWindow = GetParent();
|
||||
extracter.ExtractCallbackSpec->ShowMessages = true;
|
||||
extracter.ExtractCallbackSpec->ProgressDialog = &extracter.ProgressDialog;
|
||||
|
||||
if (indices.IsEmpty())
|
||||
return;
|
||||
@@ -941,35 +961,17 @@ void CPanel::TestArchives()
|
||||
UString title = LangString(IDS_PROGRESS_TESTING, 0x02000F90);
|
||||
UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
|
||||
|
||||
extracter.ExtractCallbackSpec->ProgressDialog.CompressingMode = false;
|
||||
extracter.ExtractCallbackSpec->ProgressDialog.MainWindow = GetParent();
|
||||
extracter.ExtractCallbackSpec->ProgressDialog.MainTitle = progressWindowTitle;
|
||||
extracter.ExtractCallbackSpec->ProgressDialog.MainAddTitle = title + L" ";
|
||||
extracter.ProgressDialog.CompressingMode = false;
|
||||
extracter.ProgressDialog.MainWindow = GetParent();
|
||||
extracter.ProgressDialog.MainTitle = progressWindowTitle;
|
||||
extracter.ProgressDialog.MainAddTitle = title + L" ";
|
||||
|
||||
extracter.ExtractCallbackSpec->OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
|
||||
extracter.ExtractCallbackSpec->Init();
|
||||
|
||||
NWindows::CThread extractThread;
|
||||
if (extractThread.Create(CThreadTest::MyThreadFunction, &extracter) != S_OK)
|
||||
if (extracter.Create(title, GetParent()) != S_OK)
|
||||
return;
|
||||
extracter.ExtractCallbackSpec->StartProgressDialog(title);
|
||||
|
||||
if (extracter.ExtractCallbackSpec->Messages.IsEmpty() && extracter.Result == S_OK)
|
||||
{
|
||||
UString s;
|
||||
AddValuePair(IDS_FOLDERS_COLON, 0x02000321, extracter.ExtractCallbackSpec->NumFolders, s);
|
||||
AddValuePair(IDS_FILES_COLON, 0x02000320, extracter.ExtractCallbackSpec->NumFiles, s);
|
||||
// AddSizePair(IDS_SIZE_COLON, 0x02000322, extracter.Stat.UnpackSize, s);
|
||||
// AddSizePair(IDS_COMPRESSED_COLON, 0x02000323, extracter.Stat.PackSize, s);
|
||||
s += L"\n";
|
||||
s += LangString(IDS_MESSAGE_NO_ERRORS, 0x02000608);
|
||||
MessageBoxInfo(s, LangString(IDS_PROGRESS_TESTING, 0x02000F90));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (extracter.Result != S_OK && extracter.Result != E_ABORT)
|
||||
MessageBoxError(extracter.Result, L"Testing Error");
|
||||
}
|
||||
}
|
||||
RefreshTitleAlways();
|
||||
return;
|
||||
@@ -986,4 +988,3 @@ void CPanel::TestArchives()
|
||||
return;
|
||||
::TestArchives(paths);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user