diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2008-05-05 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:55 +0300 |
commit | 3901bf0ab88106a5b031cba7bc18d60cdebf7eef (patch) | |
tree | 808a2489abed822223b118b64e0553db80af6087 /CPP/7zip/UI/FileManager | |
parent | bd1fa36322ac27f5715433b388742893d6524516 (diff) |
4.58 beta
Diffstat (limited to 'CPP/7zip/UI/FileManager')
-rwxr-xr-x | CPP/7zip/UI/FileManager/App.cpp | 19 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/ExtractCallback.cpp | 4 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/FM.cpp | 34 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/Panel.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/PanelItemOpen.cpp | 7 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/PanelListNotify.cpp | 95 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/ProgressDialog2.rc | 2 |
7 files changed, 109 insertions, 54 deletions
diff --git a/CPP/7zip/UI/FileManager/App.cpp b/CPP/7zip/UI/FileManager/App.cpp index 86479f04..4a4dcc96 100755 --- a/CPP/7zip/UI/FileManager/App.cpp +++ b/CPP/7zip/UI/FileManager/App.cpp @@ -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)) { diff --git a/CPP/7zip/UI/FileManager/ExtractCallback.cpp b/CPP/7zip/UI/FileManager/ExtractCallback.cpp index 8b27b217..7998d5cc 100755 --- a/CPP/7zip/UI/FileManager/ExtractCallback.cpp +++ b/CPP/7zip/UI/FileManager/ExtractCallback.cpp @@ -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; } } } diff --git a/CPP/7zip/UI/FileManager/FM.cpp b/CPP/7zip/UI/FileManager/FM.cpp index b9a51193..66e5a086 100755 --- a/CPP/7zip/UI/FileManager/FM.cpp +++ b/CPP/7zip/UI/FileManager/FM.cpp @@ -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); } } diff --git a/CPP/7zip/UI/FileManager/Panel.cpp b/CPP/7zip/UI/FileManager/Panel.cpp index ac6e7d4b..9807b958 100755 --- a/CPP/7zip/UI/FileManager/Panel.cpp +++ b/CPP/7zip/UI/FileManager/Panel.cpp @@ -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); diff --git a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp index 7a42b2d0..bf746282 100755 --- a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp +++ b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp @@ -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" }; diff --git a/CPP/7zip/UI/FileManager/PanelListNotify.cpp b/CPP/7zip/UI/FileManager/PanelListNotify.cpp index 69b06119..572118d0 100755 --- a/CPP/7zip/UI/FileManager/PanelListNotify.cpp +++ b/CPP/7zip/UI/FileManager/PanelListNotify.cpp @@ -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); diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.rc b/CPP/7zip/UI/FileManager/ProgressDialog2.rc index d505033f..58cdec36 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.rc +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.rc @@ -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) |