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>2016-09-29 03:00:00 +0300
committerKornel Lesiński <kornel@geekhood.net>2016-12-08 15:12:54 +0300
commit232ce7957441b06193c4cbdc1bc9e71436fadfdb (patch)
treecbfba61cb993434ebb38be4e058a977d91a8676a /CPP/7zip/UI/FileManager
parent1eddf527cacc149016ec987d554d3dfb52b69131 (diff)
16.0316.03
Diffstat (limited to 'CPP/7zip/UI/FileManager')
-rw-r--r--CPP/7zip/UI/FileManager/EnumFormatEtc.cpp2
-rw-r--r--CPP/7zip/UI/FileManager/Panel.cpp38
-rw-r--r--CPP/7zip/UI/FileManager/Panel.h14
-rw-r--r--CPP/7zip/UI/FileManager/PanelDrag.cpp5
-rw-r--r--CPP/7zip/UI/FileManager/PanelFolderChange.cpp31
-rw-r--r--CPP/7zip/UI/FileManager/PanelItems.cpp78
-rw-r--r--CPP/7zip/UI/FileManager/PanelListNotify.cpp2
-rw-r--r--CPP/7zip/UI/FileManager/PanelOperations.cpp2
-rw-r--r--CPP/7zip/UI/FileManager/StringUtils.cpp13
9 files changed, 152 insertions, 33 deletions
diff --git a/CPP/7zip/UI/FileManager/EnumFormatEtc.cpp b/CPP/7zip/UI/FileManager/EnumFormatEtc.cpp
index d34d67bb..cba9aa21 100644
--- a/CPP/7zip/UI/FileManager/EnumFormatEtc.cpp
+++ b/CPP/7zip/UI/FileManager/EnumFormatEtc.cpp
@@ -43,7 +43,7 @@ CEnumFormatEtc::CEnumFormatEtc(const FORMATETC *pFormatEtc, ULONG numFormats)
m_Index = 0;
m_NumFormats = 0;
m_Formats = new FORMATETC[numFormats];
- if (m_Formats)
+ // if (m_Formats)
{
m_NumFormats = numFormats;
for (ULONG i = 0; i < numFormats; i++)
diff --git a/CPP/7zip/UI/FileManager/Panel.cpp b/CPP/7zip/UI/FileManager/Panel.cpp
index a80fd049..5e3ec8ef 100644
--- a/CPP/7zip/UI/FileManager/Panel.cpp
+++ b/CPP/7zip/UI/FileManager/Panel.cpp
@@ -3,6 +3,7 @@
#include "StdAfx.h"
#include <Windowsx.h>
+// #include <stdio.h>
#include "../../../Common/IntToString.h"
#include "../../../Common/StringConvert.h"
@@ -619,10 +620,47 @@ bool CPanel::OnNotifyReBar(LPNMHDR header, LRESULT & /* result */)
return false;
}
+/*
+UInt32 g_OnNotify = 0;
+UInt32 g_LVIF_TEXT = 0;
+UInt32 g_Time = 0;
+
+void Print_OnNotify(const char *name)
+{
+ char s[256];
+ DWORD tim = GetTickCount();
+ sprintf(s,
+ "Time = %7u ms, Notify = %9u, TEXT = %9u, %s",
+ tim - g_Time,
+ g_OnNotify,
+ g_LVIF_TEXT,
+ name);
+ g_Time = tim;
+ OutputDebugStringA(s);
+ g_OnNotify = 0;
+ g_LVIF_TEXT = 0;
+}
+*/
+
bool CPanel::OnNotify(UINT /* controlID */, LPNMHDR header, LRESULT &result)
{
+ /*
+ g_OnNotify++;
+
+ if (header->hwndFrom == _listView)
+ {
+ if (header->code == LVN_GETDISPINFOW)
+ {
+ LV_DISPINFOW *dispInfo = (LV_DISPINFOW *)header;
+ if ((dispInfo->item.mask & LVIF_TEXT))
+ g_LVIF_TEXT++;
+ }
+ }
+ */
+
if (!_processNotify)
return false;
+
if (header->hwndFrom == _headerComboBox)
return OnNotifyComboBox(header, result);
else if (header->hwndFrom == _headerReBar)
diff --git a/CPP/7zip/UI/FileManager/Panel.h b/CPP/7zip/UI/FileManager/Panel.h
index 261388de..0110ee9d 100644
--- a/CPP/7zip/UI/FileManager/Panel.h
+++ b/CPP/7zip/UI/FileManager/Panel.h
@@ -361,6 +361,7 @@ public:
// CMyComboBox _headerComboBox;
CMyComboBoxEdit _comboBoxEdit;
CMyListView _listView;
+ bool _thereAre_ListView_Items;
NWindows::NControl::CStatusBar _statusBar;
bool _lastFocusedIsList;
// NWindows::NControl::CStatusBar _statusBar2;
@@ -380,6 +381,18 @@ public:
bool PanelCreated;
+ void DeleteListItems()
+ {
+ if (_thereAre_ListView_Items)
+ {
+ bool b = _enableItemChangeNotify;
+ _enableItemChangeNotify = false;
+ _listView.DeleteAllItems();
+ _thereAre_ListView_Items = false;
+ _enableItemChangeNotify = b;
+ }
+ }
+
HWND GetParent();
UInt32 GetRealIndex(const LVITEMW &item) const
@@ -502,6 +515,7 @@ public:
_flatModeForDisk(false),
_flatModeForArc(false),
PanelCreated(false),
+ _thereAre_ListView_Items(false),
// _showNtfsStrems_Mode(false),
// _showNtfsStrems_ModeForDisk(false),
diff --git a/CPP/7zip/UI/FileManager/PanelDrag.cpp b/CPP/7zip/UI/FileManager/PanelDrag.cpp
index befd19f5..ff16f24e 100644
--- a/CPP/7zip/UI/FileManager/PanelDrag.cpp
+++ b/CPP/7zip/UI/FileManager/PanelDrag.cpp
@@ -404,8 +404,11 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
}
else
{
- if (res != DRAGDROP_S_CANCEL && res != S_OK)
+ // we ignore E_UNEXPECTED that is returned if we drag file to printer
+ if (res != DRAGDROP_S_CANCEL && res != S_OK
+ && res != E_UNEXPECTED)
MessageBoxError(res);
+
res = dropSourceSpec->Result;
}
diff --git a/CPP/7zip/UI/FileManager/PanelFolderChange.cpp b/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
index aaf3f867..5a59d056 100644
--- a/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
+++ b/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
@@ -30,6 +30,8 @@ using namespace NFind;
void CPanel::ReleaseFolder()
{
+ DeleteListItems();
+
_folder.Release();
_folderCompare.Release();
@@ -175,15 +177,36 @@ HRESULT CPanel::BindToPath(const UString &fullPath, const UString &arcFormat, bo
}
else if (fileInfo.IsDir())
{
+ #ifdef _WIN32
+ if (DoesNameContainWildcard(sysPath))
+ {
+ FString dirPrefix, fileName;
+ NDir::GetFullPathAndSplit(us2fs(sysPath), dirPrefix, fileName);
+ if (DoesNameContainWildcard(dirPrefix))
+ return E_INVALIDARG;
+ sysPath = fs2us(dirPrefix + fileInfo.Name);
+ }
+ #endif
+
NName::NormalizeDirPathPrefix(sysPath);
_folder->BindToFolder(sysPath, &newFolder);
}
else
{
FString dirPrefix, fileName;
+
NDir::GetFullPathAndSplit(us2fs(sysPath), dirPrefix, fileName);
- HRESULT res;
- // = OpenAsArc(fs2us(fileName), arcFormat, encrypted);
+
+ HRESULT res = S_OK;
+
+ #ifdef _WIN32
+ if (DoesNameContainWildcard(dirPrefix))
+ return E_INVALIDARG;
+
+ if (DoesNameContainWildcard(fileName))
+ res = S_FALSE;
+ else
+ #endif
{
CTempFileInfo tfi;
tfi.RelPath = fs2us(fileName);
@@ -258,9 +281,9 @@ HRESULT CPanel::BindToPathAndRefresh(const UString &path)
CDisableTimerProcessing disableTimerProcessing(*this);
CDisableNotify disableNotify(*this);
bool archiveIsOpened, encrypted;
- RINOK(BindToPath(path, UString(), archiveIsOpened, encrypted));
+ HRESULT res = BindToPath(path, UString(), archiveIsOpened, encrypted);
RefreshListCtrl(UString(), -1, true, UStringVector());
- return S_OK;
+ return res;
}
void CPanel::SetBookmark(unsigned index)
diff --git a/CPP/7zip/UI/FileManager/PanelItems.cpp b/CPP/7zip/UI/FileManager/PanelItems.cpp
index 8f73cffd..55981d6d 100644
--- a/CPP/7zip/UI/FileManager/PanelItems.cpp
+++ b/CPP/7zip/UI/FileManager/PanelItems.cpp
@@ -92,7 +92,7 @@ HRESULT CPanel::InitColumns()
{
SaveListViewInfo();
- _listView.DeleteAllItems();
+ // DeleteListItems();
_selectedStatusVector.Clear();
{
@@ -411,9 +411,21 @@ void CPanel::SetFocusedSelectedItem(int index, bool select)
}
}
+// #define PRINT_STAT
+
+#ifdef PRINT_STAT
+ void Print_OnNotify(const char *name);
+#else
+ #define Print_OnNotify(x)
+#endif
+
+
HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
const UStringVector &selectedNames)
{
+ if (!_folder)
+ return S_OK;
+
_dontShowMode = false;
LoadFullPathAndShow();
// OutputDebugStringA("=======\n");
@@ -431,11 +443,11 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
ZeroMemory(&item, sizeof(item));
// DWORD tickCount0 = GetTickCount();
- _enableItemChangeNotify = false;
- _listView.DeleteAllItems();
+
+ // _enableItemChangeNotify = false;
+ DeleteListItems();
_enableItemChangeNotify = true;
-
int listViewItemCount = 0;
_selectedStatusVector.Clear();
@@ -512,6 +524,12 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
}
}
+ _thereAre_ListView_Items = true;
+
+ // OutputDebugStringA("\n\n");
+
+ Print_OnNotify("===== Before Load");
+
if (showDots)
{
UString itemName = L"..";
@@ -642,7 +660,8 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
// item.pszText = const_cast<wchar_t *>((const wchar_t *)name);
item.pszText = LPSTR_TEXTCALLBACKW;
/* LPSTR_TEXTCALLBACKW works, but in some cases there are problems,
- since we block notify handler. */
+ since we block notify handler.
+ LPSTR_TEXTCALLBACKW can be 2-3 times faster for loading in this loop. */
}
UInt32 attrib = 0;
@@ -687,14 +706,35 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
listViewItemCount++;
}
- // OutputDebugStringA("End2\n");
+ /*
+ xp-64: there is different order when Windows calls CPanel::OnNotify for _listView modes:
+ Details : after whole code
+ List : 2 times:
+ 1) - ListView.SotRedraw()
+ 2) - after whole code
+ Small Icons :
+ Large icons : 2 times:
+ 1) - ListView.Sort()
+ 2) - after whole code (calls with reverse order of items)
+
+ So we need to allow Notify(), when windows requests names during the following code.
+ */
+
+ Print_OnNotify("after Load");
+
+ disableNotify.SetMemMode_Enable();
+ disableNotify.Restore();
if (_listView.GetItemCount() > 0 && cursorIndex >= 0)
SetFocusedSelectedItem(cursorIndex, selectFocused);
- // DWORD tickCount3 = GetTickCount();
+
+ Print_OnNotify("after SetFocusedSelectedItem");
+
SetSortRawStatus();
_listView.SortItems(CompareItems, (LPARAM)this);
- // DWORD tickCount4 = GetTickCount();
+
+ Print_OnNotify("after Sort");
+
if (cursorIndex < 0 && _listView.GetItemCount() > 0)
{
if (focusedPos >= _listView.GetItemCount())
@@ -702,23 +742,29 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
// we select item only in showDots mode.
SetFocusedSelectedItem(focusedPos, showDots);
}
+
// m_RedrawEnabled = true;
- // DWORD tickCount5 = GetTickCount();
+
+ Print_OnNotify("after SetFocusedSelectedItem2");
+
_listView.EnsureVisible(_listView.GetFocusedItem(), false);
- // DWORD tickCount6 = GetTickCount();
- disableNotify.SetMemMode_Enable();
- disableNotify.Restore();
+ // disableNotify.SetMemMode_Enable();
+ // disableNotify.Restore();
+
+ Print_OnNotify("after EnsureVisible");
+
_listView.SetRedraw(true);
- // DWORD tickCount7 = GetTickCount();
+
+ Print_OnNotify("after SetRedraw");
+
_listView.InvalidateRect(NULL, true);
- // DWORD tickCount8 = GetTickCount();
- // OutputDebugStringA("End1\n");
+
+ Print_OnNotify("after InvalidateRect");
/*
_listView.UpdateWindow();
*/
Refresh_StatusBar();
- // DWORD tickCount9 = GetTickCount();
/*
char s[256];
sprintf(s,
diff --git a/CPP/7zip/UI/FileManager/PanelListNotify.cpp b/CPP/7zip/UI/FileManager/PanelListNotify.cpp
index 39c29681..cc84f712 100644
--- a/CPP/7zip/UI/FileManager/PanelListNotify.cpp
+++ b/CPP/7zip/UI/FileManager/PanelListNotify.cpp
@@ -356,8 +356,8 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
i += t;
}
}
-
text[dest] = 0;
+ // OutputDebugStringW(text);
return 0;
}
}
diff --git a/CPP/7zip/UI/FileManager/PanelOperations.cpp b/CPP/7zip/UI/FileManager/PanelOperations.cpp
index bd128695..3331a4cf 100644
--- a/CPP/7zip/UI/FileManager/PanelOperations.cpp
+++ b/CPP/7zip/UI/FileManager/PanelOperations.cpp
@@ -348,7 +348,7 @@ BOOL CPanel::OnEndLabelEdit(LV_DISPINFOW * lpnmh)
// We need clear all items to disable GetText before Reload:
// number of items can change.
- // _listView.DeleteAllItems();
+ // DeleteListItems();
// But seems it can still call GetText (maybe for current item)
// so we can't delete items.
diff --git a/CPP/7zip/UI/FileManager/StringUtils.cpp b/CPP/7zip/UI/FileManager/StringUtils.cpp
index 10056549..7c814f7f 100644
--- a/CPP/7zip/UI/FileManager/StringUtils.cpp
+++ b/CPP/7zip/UI/FileManager/StringUtils.cpp
@@ -9,24 +9,19 @@ void SplitStringToTwoStrings(const UString &src, UString &dest1, UString &dest2)
dest1.Empty();
dest2.Empty();
bool quoteMode = false;
- unsigned i;
- for (i = 0; i < src.Len(); i++)
+ for (unsigned i = 0; i < src.Len(); i++)
{
- wchar_t c = src[i];
+ const wchar_t c = src[i];
if (c == L'\"')
quoteMode = !quoteMode;
else if (c == L' ' && !quoteMode)
{
- if (!quoteMode)
- {
- i++;
- break;
- }
+ dest2 = src.Ptr(i + 1);
+ return;
}
else
dest1 += c;
}
- dest2 = src.Ptr(i);
}
void SplitString(const UString &srcString, UStringVector &destStrings)