mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-09 06:07:05 -06:00
4.58 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
bd1fa36322
commit
3901bf0ab8
@@ -443,6 +443,12 @@ static void ReducePathToRealFileSystemPath(UString &path)
|
||||
path = path.Left(pos + 1);
|
||||
if (path.Length() == 3 && path[1] == L':')
|
||||
break;
|
||||
if (path.Length() > 2 && path[0] == '\\' && path[1] == '\\')
|
||||
{
|
||||
int nextPos = path.Find('\\', 2); // pos after \\COMPNAME
|
||||
if (nextPos > 0 && path.Find('\\', nextPos + 1) == pos)
|
||||
break;
|
||||
}
|
||||
path = path.Left(pos);
|
||||
}
|
||||
}
|
||||
@@ -524,6 +530,12 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
||||
|
||||
destPath = copyDialog.Value;
|
||||
|
||||
if (destPath.IsEmpty())
|
||||
{
|
||||
srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsPathAbsolute(destPath))
|
||||
{
|
||||
if (!srcPanel.IsFSFolder())
|
||||
@@ -534,6 +546,13 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
||||
destPath = srcPanel._currentFolderPrefix + destPath;
|
||||
}
|
||||
|
||||
if (destPath.Length() > 0 && destPath[0] == '\\')
|
||||
if (destPath.Length() == 1 || destPath[1] != '\\')
|
||||
{
|
||||
srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
|
||||
return;
|
||||
}
|
||||
|
||||
if (indices.Size() > 1 || (destPath.Length() > 0 && destPath.ReverseFind('\\') == destPath.Length() - 1) ||
|
||||
IsThereFolderOfPath(destPath))
|
||||
{
|
||||
|
||||
@@ -162,7 +162,7 @@ STDMETHODIMP CExtractCallbackImp::AskOverwrite(
|
||||
*answer = NOverwriteAnswer::kYes;
|
||||
break;
|
||||
default:
|
||||
throw 20413;
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
@@ -408,7 +408,7 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
|
||||
OverwriteMode = NExtract::NOverwriteMode::kAutoRename;
|
||||
break;
|
||||
default:
|
||||
throw 20413;
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -766,38 +766,40 @@ void OnSize(HWND hWnd)
|
||||
MoveSubWindows(hWnd);
|
||||
}
|
||||
|
||||
int Window_GetRealHeight(NWindows::CWindow &w)
|
||||
{
|
||||
RECT rect;
|
||||
WINDOWPLACEMENT placement;
|
||||
w.GetWindowRect(&rect);
|
||||
int res = rect.bottom - rect.top;
|
||||
if (w.GetPlacement(&placement))
|
||||
res += placement.rcNormalPosition.top;
|
||||
return res;
|
||||
}
|
||||
|
||||
void MoveSubWindows(HWND hWnd)
|
||||
{
|
||||
RECT rect;
|
||||
::GetClientRect(hWnd, &rect);
|
||||
int xSize = rect.right;
|
||||
int kHeaderSize = 0;
|
||||
int ySize = MyMax(int(rect.bottom - kHeaderSize), 0);
|
||||
int headerSize = 0;
|
||||
if (g_App._rebar)
|
||||
{
|
||||
RECT barRect;
|
||||
g_App._rebar.GetWindowRect(&barRect);
|
||||
kHeaderSize = barRect.bottom - barRect.top;
|
||||
ySize = MyMax(int(rect.bottom - kHeaderSize), 0);
|
||||
}
|
||||
headerSize = Window_GetRealHeight(g_App._rebar);
|
||||
int ySize = MyMax((int)(rect.bottom - headerSize), 0);
|
||||
|
||||
// g_App._headerToolBar.Move(0, 2, xSize, kHeaderSize - 2);
|
||||
RECT rect2 = rect;
|
||||
rect2.bottom = 0;
|
||||
// g_App._headerReBar.SizeToRect(&rect2);
|
||||
if (g_App.NumPanels > 1)
|
||||
{
|
||||
g_App.Panels[0].Move(0, kHeaderSize, g_Splitter.GetPos(), ySize);
|
||||
g_App.Panels[0].Move(0, headerSize, g_Splitter.GetPos(), ySize);
|
||||
int xWidth1 = g_Splitter.GetPos() + kSplitterWidth;
|
||||
g_App.Panels[1].Move(xWidth1, kHeaderSize, xSize - xWidth1, ySize);
|
||||
g_App.Panels[1].Move(xWidth1, headerSize, xSize - xWidth1, ySize);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
int otherPanel = 1 - g_App.LastFocusedPanel;
|
||||
if (g_App.PanelsCreated[otherPanel])
|
||||
g_App.Panels[otherPanel].Move(0, kHeaderSize, 0, ySize);
|
||||
g_App.Panels[otherPanel].Move(0, headerSize, 0, ySize);
|
||||
*/
|
||||
g_App.Panels[g_App.LastFocusedPanel].Move(0, kHeaderSize, xSize, ySize);
|
||||
g_App.Panels[g_App.LastFocusedPanel].Move(0, headerSize, xSize, ySize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
|
||||
_statusBar.Create(WS_CHILD | WS_VISIBLE, L"Status", (*this), _statusBarID);
|
||||
// _statusBar2.Create(WS_CHILD | WS_VISIBLE, L"Status", (*this), _statusBarID + 1);
|
||||
|
||||
int sizes[] = {150, 200, 250, -1};
|
||||
int sizes[] = {150, 250, 350, -1};
|
||||
_statusBar.SetParts(4, sizes);
|
||||
// _statusBar2.SetParts(5, sizes);
|
||||
|
||||
|
||||
@@ -145,8 +145,13 @@ static const wchar_t *kStartExtensions[] =
|
||||
{
|
||||
L"exe", L"bat", L"com",
|
||||
L"chm",
|
||||
L"msi", L"doc", L"xls", L"ppt", L"wps", L"wpt", L"wks", L"xlr", L"wdb",
|
||||
L"msi", L"doc", L"xls", L"ppt", L"pps", L"wps", L"wpt", L"wks", L"xlr", L"wdb",
|
||||
|
||||
L"docx", L"docm", L"dotx", L"dotm", L"xlsx", L"xlsm", L"xltx", L"xltm", L"xlsb",
|
||||
L"xlam", L"pptx", L"pptm", L"potx", L"potm", L"ppam", L"ppsx", L"ppsm", L"xsn",
|
||||
|
||||
L"odt", L"ods",
|
||||
L"wb3",
|
||||
L"pdf"
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/PropVariantConversions.h"
|
||||
// #include "Windows/COM.h"
|
||||
|
||||
#include "../Common/PropIDUtils.h"
|
||||
#include "../../PropID.h"
|
||||
@@ -19,26 +18,56 @@
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static UString ConvertSizeToString(UINT64 value)
|
||||
static UString ConvertSizeToStringShort(UInt64 value)
|
||||
{
|
||||
wchar_t s[64];
|
||||
if (value < (UINT64(10000) << 0) /*&& ((value & 0x3FF) != 0 || value == 0)*/)
|
||||
wchar_t s[32];
|
||||
wchar_t c, c2 = L'B';
|
||||
if (value < (UInt64)10000)
|
||||
{
|
||||
ConvertUInt64ToString(value, s);
|
||||
return UString(s) + L" B";
|
||||
c = L'B';
|
||||
c2 = L'\0';
|
||||
}
|
||||
if (value < (UINT64(10000) << 10))
|
||||
else if (value < ((UInt64)10000 << 10))
|
||||
{
|
||||
ConvertUInt64ToString((value >> 10), s);
|
||||
return UString(s) + L" K";
|
||||
value >>= 10;
|
||||
c = L'K';
|
||||
}
|
||||
if (value < (UINT64(10000) << 20))
|
||||
else if (value < ((UInt64)10000 << 20))
|
||||
{
|
||||
ConvertUInt64ToString((value >> 20), s);
|
||||
return UString(s) + L" M";
|
||||
value >>= 20;
|
||||
c = L'M';
|
||||
}
|
||||
ConvertUInt64ToString((value >> 30), s);
|
||||
return UString(s) + L" G";
|
||||
else
|
||||
{
|
||||
value >>= 30;
|
||||
c = L'G';
|
||||
}
|
||||
ConvertUInt64ToString(value, s);
|
||||
int p = MyStringLen(s);
|
||||
s[p++] = L' ';
|
||||
s[p++] = c;
|
||||
s[p++] = c2;
|
||||
s[p++] = L'\0';
|
||||
return s;
|
||||
}
|
||||
|
||||
static UString ConvertSizeToString(UInt64 value)
|
||||
{
|
||||
wchar_t s[32];
|
||||
ConvertUInt64ToString(value, s);
|
||||
int i = MyStringLen(s);
|
||||
int pos = sizeof(s) / sizeof(s[0]);
|
||||
s[--pos] = L'\0';
|
||||
while (i > 3)
|
||||
{
|
||||
s[--pos] = s[--i];
|
||||
s[--pos] = s[--i];
|
||||
s[--pos] = s[--i];
|
||||
s[--pos] = L' ';
|
||||
}
|
||||
while (i > 0)
|
||||
s[--pos] = s[--i];
|
||||
return s + pos;
|
||||
}
|
||||
|
||||
LRESULT CPanel::SetItemText(LVITEMW &item)
|
||||
@@ -60,11 +89,11 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
|
||||
}
|
||||
if (!defined)
|
||||
{
|
||||
NCOM::CPropVariant propVariant;
|
||||
_folder->GetProperty(index, kpidAttributes, &propVariant);
|
||||
NCOM::CPropVariant prop;
|
||||
_folder->GetProperty(index, kpidAttributes, &prop);
|
||||
UINT32 attributes = 0;
|
||||
if (propVariant.vt == VT_UI4)
|
||||
attributes = propVariant.ulVal;
|
||||
if (prop.vt == VT_UI4)
|
||||
attributes = prop.ulVal;
|
||||
else
|
||||
{
|
||||
if (IsItemFolder(index))
|
||||
@@ -109,7 +138,7 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
|
||||
*/
|
||||
// const NFind::CFileInfo &aFileInfo = m_Files[index];
|
||||
|
||||
NCOM::CPropVariant propVariant;
|
||||
NCOM::CPropVariant prop;
|
||||
/*
|
||||
bool needRead = true;
|
||||
if (propID == kpidSize)
|
||||
@@ -117,26 +146,26 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
|
||||
CComPtr<IFolderGetItemFullSize> getItemFullSize;
|
||||
if (_folder.QueryInterface(&getItemFullSize) == S_OK)
|
||||
{
|
||||
if (getItemFullSize->GetItemFullSize(index, &propVariant) == S_OK)
|
||||
if (getItemFullSize->GetItemFullSize(index, &prop) == S_OK)
|
||||
needRead = false;
|
||||
}
|
||||
}
|
||||
if (needRead)
|
||||
*/
|
||||
|
||||
if (_folder->GetProperty(realIndex, propID, &propVariant) != S_OK)
|
||||
if (_folder->GetProperty(realIndex, propID, &prop) != S_OK)
|
||||
throw 2723407;
|
||||
|
||||
if ((propID == kpidSize || propID == kpidPackedSize ||
|
||||
propID == kpidTotalSize || propID == kpidFreeSpace ||
|
||||
propID == kpidClusterSize)
|
||||
&&
|
||||
(propVariant.vt == VT_UI8 || propVariant.vt == VT_UI4))
|
||||
s = ConvertSizeToString(ConvertPropVariantToUInt64(propVariant));
|
||||
if ((propID == kpidSize || propID == kpidPackedSize || propID == kpidClusterSize ||
|
||||
propID == kpidNumSubFolders || propID == kpidNumSubFiles) &&
|
||||
(prop.vt == VT_UI8 || prop.vt == VT_UI4))
|
||||
s = ConvertSizeToString(ConvertPropVariantToUInt64(prop));
|
||||
else if ((propID == kpidTotalSize || propID == kpidFreeSpace) &&
|
||||
(prop.vt == VT_UI8 || prop.vt == VT_UI4))
|
||||
s = ConvertSizeToStringShort(ConvertPropVariantToUInt64(prop));
|
||||
else
|
||||
s = ConvertPropertyToString(propVariant, propID, false);
|
||||
|
||||
{
|
||||
s = ConvertPropertyToString(prop, propID, false);
|
||||
s.Replace(wchar_t(0xA), L' ');
|
||||
s.Replace(wchar_t(0xD), L' ');
|
||||
}
|
||||
@@ -364,7 +393,7 @@ void CPanel::OnRefreshStatusBar()
|
||||
|
||||
if (indices.Size() > 0)
|
||||
{
|
||||
UINT64 totalSize = 0;
|
||||
UInt64 totalSize = 0;
|
||||
for (int i = 0; i < indices.Size(); i++)
|
||||
totalSize += GetItemSize(indices[i]);
|
||||
selectSizeString = ConvertSizeToString(totalSize);
|
||||
@@ -380,9 +409,9 @@ void CPanel::OnRefreshStatusBar()
|
||||
if (realIndex != kParentIndex)
|
||||
{
|
||||
sizeString = ConvertSizeToString(GetItemSize(realIndex));
|
||||
NCOM::CPropVariant propVariant;
|
||||
if (_folder->GetProperty(realIndex, kpidLastWriteTime, &propVariant) == S_OK)
|
||||
dateString = ConvertPropertyToString(propVariant, kpidLastWriteTime, false);
|
||||
NCOM::CPropVariant prop;
|
||||
if (_folder->GetProperty(realIndex, kpidLastWriteTime, &prop) == S_OK)
|
||||
dateString = ConvertPropertyToString(prop, kpidLastWriteTime, false);
|
||||
}
|
||||
}
|
||||
_statusBar.SetText(2, sizeString);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#define bYPos (ySize - marg - bYSize)
|
||||
|
||||
#undef bXSize
|
||||
#define bXSize 72
|
||||
#define bXSize 80
|
||||
|
||||
#define bXPos1 (xSize - marg - bXSize)
|
||||
#define bXPos2 (bXPos1 - 10 - bXSize)
|
||||
|
||||
Reference in New Issue
Block a user