mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 21:14:58 -06:00
17.01
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
|
||||
#include "../../PropID.h"
|
||||
|
||||
#include "../Common/ExtractingFilePath.h"
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "LangUtils.h"
|
||||
@@ -317,7 +319,8 @@ void CPanel::AddColumn(const CPropColumn &prop)
|
||||
|
||||
HRESULT CPanel::RefreshListCtrl()
|
||||
{
|
||||
return RefreshListCtrl(UString(), -1, true, UStringVector());
|
||||
CSelectedState state;
|
||||
return RefreshListCtrl(state);
|
||||
}
|
||||
|
||||
int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData);
|
||||
@@ -356,7 +359,9 @@ void CPanel::GetSelectedNames(UStringVector &selectedNames)
|
||||
|
||||
void CPanel::SaveSelectedState(CSelectedState &s)
|
||||
{
|
||||
s.FocusedName_Defined = false;
|
||||
s.FocusedName.Empty();
|
||||
s.SelectFocused = true; // false;
|
||||
s.SelectedNames.Clear();
|
||||
s.FocusedItem = _listView.GetFocusedItem();
|
||||
{
|
||||
@@ -364,7 +369,12 @@ void CPanel::SaveSelectedState(CSelectedState &s)
|
||||
{
|
||||
int realIndex = GetRealItemIndex(s.FocusedItem);
|
||||
if (realIndex != kParentIndex)
|
||||
{
|
||||
s.FocusedName = GetItemRelPath(realIndex);
|
||||
s.FocusedName_Defined = true;
|
||||
|
||||
s.SelectFocused = _listView.IsItemSelected(s.FocusedItem);
|
||||
|
||||
/*
|
||||
const int kSize = 1024;
|
||||
WCHAR name[kSize + 1];
|
||||
@@ -376,21 +386,26 @@ void CPanel::SaveSelectedState(CSelectedState &s)
|
||||
item.mask = LVIF_TEXT;
|
||||
if (_listView.GetItem(&item))
|
||||
focusedName = item.pszText;
|
||||
*/
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
GetSelectedNames(s.SelectedNames);
|
||||
}
|
||||
|
||||
/*
|
||||
HRESULT CPanel::RefreshListCtrl(const CSelectedState &s)
|
||||
{
|
||||
bool selectFocused = s.SelectFocused;
|
||||
if (_mySelectMode)
|
||||
selectFocused = true;
|
||||
return RefreshListCtrl(s.FocusedName, s.FocusedItem, selectFocused, s.SelectedNames);
|
||||
return RefreshListCtrl2(
|
||||
s.FocusedItem >= 0, // allowEmptyFocusedName
|
||||
s.FocusedName, s.FocusedItem, selectFocused, s.SelectedNames);
|
||||
}
|
||||
*/
|
||||
|
||||
HRESULT CPanel::RefreshListCtrlSaveFocused()
|
||||
HRESULT CPanel::RefreshListCtrl_SaveFocused()
|
||||
{
|
||||
CSelectedState state;
|
||||
SaveSelectedState(state);
|
||||
@@ -420,8 +435,7 @@ void CPanel::SetFocusedSelectedItem(int index, bool select)
|
||||
#endif
|
||||
|
||||
|
||||
HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
|
||||
const UStringVector &selectedNames)
|
||||
HRESULT CPanel::RefreshListCtrl(const CSelectedState &state)
|
||||
{
|
||||
if (!_folder)
|
||||
return S_OK;
|
||||
@@ -433,6 +447,7 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
|
||||
CDisableTimerProcessing timerProcessing(*this);
|
||||
CDisableNotify disableNotify(*this);
|
||||
|
||||
int focusedPos = state.FocusedItem;
|
||||
if (focusedPos < 0)
|
||||
focusedPos = 0;
|
||||
|
||||
@@ -534,8 +549,8 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
|
||||
{
|
||||
UString itemName ("..");
|
||||
item.iItem = listViewItemCount;
|
||||
if (itemName == focusedName)
|
||||
cursorIndex = item.iItem;
|
||||
if (itemName == state.FocusedName)
|
||||
cursorIndex = listViewItemCount;
|
||||
item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
|
||||
int subItem = 0;
|
||||
item.iSubItem = subItem++;
|
||||
@@ -573,7 +588,7 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
|
||||
|
||||
bool selected = false;
|
||||
|
||||
if (!focusedName.IsEmpty() || !selectedNames.IsEmpty())
|
||||
if (state.FocusedName_Defined || !state.SelectedNames.IsEmpty())
|
||||
{
|
||||
relPath.Empty();
|
||||
|
||||
@@ -599,9 +614,9 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
|
||||
}
|
||||
}
|
||||
relPath += name;
|
||||
if (relPath == focusedName)
|
||||
if (relPath == state.FocusedName)
|
||||
cursorIndex = listViewItemCount;
|
||||
if (selectedNames.FindInSorted(relPath) >= 0)
|
||||
if (state.SelectedNames.FindInSorted(relPath) >= 0)
|
||||
selected = true;
|
||||
}
|
||||
|
||||
@@ -724,7 +739,7 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
|
||||
disableNotify.Restore();
|
||||
|
||||
if (_listView.GetItemCount() > 0 && cursorIndex >= 0)
|
||||
SetFocusedSelectedItem(cursorIndex, selectFocused);
|
||||
SetFocusedSelectedItem(cursorIndex, state.SelectFocused);
|
||||
|
||||
Print_OnNotify("after SetFocusedSelectedItem");
|
||||
|
||||
@@ -738,7 +753,7 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
|
||||
if (focusedPos >= _listView.GetItemCount())
|
||||
focusedPos = _listView.GetItemCount() - 1;
|
||||
// we select item only in showDots mode.
|
||||
SetFocusedSelectedItem(focusedPos, showDots);
|
||||
SetFocusedSelectedItem(focusedPos, showDots && (focusedPos == 0));
|
||||
}
|
||||
|
||||
// m_RedrawEnabled = true;
|
||||
@@ -789,6 +804,7 @@ HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
void CPanel::GetSelectedItemsIndices(CRecordVector<UInt32> &indices) const
|
||||
{
|
||||
indices.Clear();
|
||||
@@ -800,13 +816,16 @@ void CPanel::GetSelectedItemsIndices(CRecordVector<UInt32> &indices) const
|
||||
if (_listView.GetItemParam(itemIndex, param))
|
||||
indices.Add(param);
|
||||
}
|
||||
HeapSort(&indices.Front(), indices.Size());
|
||||
*/
|
||||
FOR_VECTOR (i, _selectedStatusVector)
|
||||
if (_selectedStatusVector[i])
|
||||
const bool *v = &_selectedStatusVector.Front();
|
||||
unsigned size = _selectedStatusVector.Size();
|
||||
for (unsigned i = 0; i < size; i++)
|
||||
if (v[i])
|
||||
indices.Add(i);
|
||||
// HeapSort(&indices.Front(), indices.Size());
|
||||
}
|
||||
|
||||
|
||||
void CPanel::GetOperatedItemIndices(CRecordVector<UInt32> &indices) const
|
||||
{
|
||||
GetSelectedItemsIndices(indices);
|
||||
@@ -922,7 +941,7 @@ void CPanel::OpenSelectedItems(bool tryInternal)
|
||||
GetOperatedItemIndices(indices);
|
||||
if (indices.Size() > 20)
|
||||
{
|
||||
MessageBoxErrorLang(IDS_TOO_MANY_ITEMS);
|
||||
MessageBox_Error_LangID(IDS_TOO_MANY_ITEMS);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -974,17 +993,20 @@ UString CPanel::GetItemName_for_Copy(int itemIndex) const
|
||||
{
|
||||
if (itemIndex == kParentIndex)
|
||||
return L"..";
|
||||
UString s;
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
if (_folder->GetProperty(itemIndex, kpidOutName, &prop) == S_OK)
|
||||
{
|
||||
if (prop.vt == VT_BSTR)
|
||||
return prop.bstrVal;
|
||||
if (prop.vt != VT_EMPTY)
|
||||
s = prop.bstrVal;
|
||||
else if (prop.vt != VT_EMPTY)
|
||||
throw 2723401;
|
||||
}
|
||||
if (s.IsEmpty())
|
||||
s = GetItemName(itemIndex);
|
||||
}
|
||||
return GetItemName(itemIndex);
|
||||
return Get_Correct_FsFile_Name(s);
|
||||
}
|
||||
|
||||
void CPanel::GetItemName(int itemIndex, UString &s) const
|
||||
@@ -1224,9 +1246,9 @@ void CPanel::ShowColumnsContextMenu(int x, int y)
|
||||
|
||||
void CPanel::OnReload()
|
||||
{
|
||||
HRESULT res = RefreshListCtrlSaveFocused();
|
||||
HRESULT res = RefreshListCtrl_SaveFocused();
|
||||
if (res != S_OK)
|
||||
MessageBoxError(res);
|
||||
MessageBox_Error_HRESULT(res);
|
||||
}
|
||||
|
||||
void CPanel::OnTimer()
|
||||
|
||||
Reference in New Issue
Block a user