4.27 beta

This commit is contained in:
Igor Pavlov
2005-09-21 00:00:00 +00:00
committed by Kornel Lesiński
parent 31e7b924e8
commit d66cf2fcf3
393 changed files with 17345 additions and 4743 deletions

View File

@@ -340,7 +340,8 @@ void CApp::Create(HWND hwnd, const UString &mainPath, int xSizes[2])
ReadToolbar();
ReloadRebar(hwnd);
for (int i = 0; i < kNumPanelsMax; i++)
int i;
for (i = 0; i < kNumPanelsMax; i++)
PanelsCreated[i] = false;
_window.Attach(hwnd);

View File

@@ -200,8 +200,8 @@ public:
{ OnCopy(false, false, GetFocusedPanelIndex()); }
void MoveTo()
{ OnCopy(true, false, GetFocusedPanelIndex()); }
void Delete()
{ GetFocusedPanel().DeleteItems(); }
void Delete(bool toRecycleBin)
{ GetFocusedPanel().DeleteItems(toRecycleBin); }
void Split();
void Combine();
void Properties()

View File

@@ -508,6 +508,40 @@ STDMETHODIMP CFSFolder::Delete(const UINT32 *indices, UINT32 numItems,
return S_OK;
}
/*
STDMETHODIMP CFSFolder::DeleteToRecycleBin(const UINT32 *indices, UINT32 numItems,
IProgress *progress)
{
RINOK(progress->SetTotal(numItems));
for (UINT32 i = 0; i < numItems; i++)
{
int index = indices[i];
const CFileInfoW &fileInfo = _files[indices[i]];
const UString fullPath = _path + fileInfo.Name;
CBuffer<TCHAR> buffer;
const CSysString fullPathSys = GetSystemString(fullPath);
buffer.SetCapacity(fullPathSys.Length() + 2);
memmove((TCHAR *)buffer, (const TCHAR *)fullPathSys, (fullPathSys.Length() + 1) * sizeof(TCHAR));
((TCHAR *)buffer)[fullPathSys.Length() + 1] = 0;
SHFILEOPSTRUCT fo;
fo.hwnd = 0;
fo.wFunc = FO_DELETE;
fo.pFrom = (const TCHAR *)buffer;
fo.pTo = 0;
fo.fFlags = FOF_ALLOWUNDO;
fo.fAnyOperationsAborted = FALSE;
fo.hNameMappings = 0;
fo.lpszProgressTitle = 0;
int res = SHFileOperation(&fo);
if (fo.fAnyOperationsAborted)
return E_ABORT;
UINT64 completed = i;
RINOK(progress->SetCompleted(&completed));
}
return S_OK;
}
*/
STDMETHODIMP CFSFolder::SetProperty(UINT32 index, PROPID propID,
const PROPVARIANT *value, IProgress *progress)
{

View File

@@ -28,6 +28,7 @@ class CFSFolder:
public IFolderGetPath,
public IFolderWasChanged,
public IFolderOperations,
// public IFolderOperationsDeleteToRecycleBin,
public IFolderGetItemFullSize,
public IFolderClone,
public IFolderGetSystemIconIndex,
@@ -40,6 +41,7 @@ public:
MY_QUERYINTERFACE_ENTRY(IFolderGetTypeID)
MY_QUERYINTERFACE_ENTRY(IFolderGetPath)
MY_QUERYINTERFACE_ENTRY(IFolderWasChanged)
// MY_QUERYINTERFACE_ENTRY(IFolderOperationsDeleteToRecycleBin)
MY_QUERYINTERFACE_ENTRY(IFolderOperations)
MY_QUERYINTERFACE_ENTRY(IFolderGetItemFullSize)
MY_QUERYINTERFACE_ENTRY(IFolderClone)
@@ -80,6 +82,8 @@ public:
STDMETHOD(SetProperty)(UINT32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress);
STDMETHOD(GetSystemIconIndex)(UINT32 index, INT32 *iconIndex);
// STDMETHOD(DeleteToRecycleBin)(const UINT32 *indices, UINT32 numItems, IProgress *progress);
private:
UINT _fileCodePage;
UString _path;

View File

@@ -5,6 +5,15 @@
#include "../IProgress.h"
#define FOLDER_INTERFACE_SUB(i, b, x, y) \
DEFINE_GUID(IID_ ## i, \
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, x, y, 0x00); \
struct i: public b
#define FOLDER_INTERFACE2(i, x, y) FOLDER_INTERFACE_SUB(i, IUnknown, x, y)
#define FOLDER_INTERFACE(i, x) FOLDER_INTERFACE2(i, x, 0x00)
namespace NPlugin
{
enum
@@ -16,85 +25,50 @@ namespace NPlugin
};
}
// {23170F69-40C1-278A-0000-000800000000}
DEFINE_GUID(IID_IFolderFolder,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800000000")
IFolderFolder: public IUnknown
FOLDER_INTERFACE(IFolderFolder, 0x00)
{
public:
STDMETHOD(LoadItems)() = 0;
STDMETHOD(GetNumberOfItems)(UINT32 *numItems) = 0;
// STDMETHOD(GetNumberOfSubFolders)(UINT32 *numSubFolders) = 0;
STDMETHOD(GetProperty)(UINT32 itemIndex, PROPID propID, PROPVARIANT *value) = 0;
STDMETHOD(BindToFolder)(UINT32 index, IFolderFolder **resultFolder) = 0;
STDMETHOD(BindToFolder)(const wchar_t *name, IFolderFolder **resultFolder) = 0;
STDMETHOD(BindToParentFolder)(IFolderFolder **resultFolder) = 0;
STDMETHOD(GetName)(BSTR *name) = 0;
STDMETHOD(LoadItems)() PURE;
STDMETHOD(GetNumberOfItems)(UINT32 *numItems) PURE;
// STDMETHOD(GetNumberOfSubFolders)(UINT32 *numSubFolders) PURE;
STDMETHOD(GetProperty)(UINT32 itemIndex, PROPID propID, PROPVARIANT *value) PURE;
STDMETHOD(BindToFolder)(UINT32 index, IFolderFolder **resultFolder) PURE;
STDMETHOD(BindToFolder)(const wchar_t *name, IFolderFolder **resultFolder) PURE;
STDMETHOD(BindToParentFolder)(IFolderFolder **resultFolder) PURE;
STDMETHOD(GetName)(BSTR *name) PURE;
};
// {23170F69-40C1-278A-0000-000800010000}
DEFINE_GUID(IID_IEnumProperties,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800010000")
IEnumProperties: public IUnknown
FOLDER_INTERFACE(IEnumProperties, 0x01)
{
public:
// STDMETHOD(EnumProperties)(IEnumSTATPROPSTG **enumerator) = 0;
STDMETHOD(GetNumberOfProperties)(UINT32 *numProperties) = 0;
// STDMETHOD(EnumProperties)(IEnumSTATPROPSTG **enumerator) PURE;
STDMETHOD(GetNumberOfProperties)(UINT32 *numProperties) PURE;
STDMETHOD(GetPropertyInfo)(UINT32 index,
BSTR *name, PROPID *propID, VARTYPE *varType) = 0;
BSTR *name, PROPID *propID, VARTYPE *varType) PURE;
};
// {23170F69-40C1-278A-0000-000800020000}
DEFINE_GUID(IID_IFolderGetTypeID,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800020000")
IFolderGetTypeID: public IUnknown
FOLDER_INTERFACE(IFolderGetTypeID, 0x02)
{
public:
STDMETHOD(GetTypeID)(BSTR *name) = 0;
STDMETHOD(GetTypeID)(BSTR *name) PURE;
};
// {23170F69-40C1-278A-0000-000800030000}
DEFINE_GUID(IID_IFolderGetPath,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x03, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800030000")
IFolderGetPath: public IUnknown
FOLDER_INTERFACE(IFolderGetPath, 0x03)
{
public:
STDMETHOD(GetPath)(BSTR *path) = 0;
STDMETHOD(GetPath)(BSTR *path) PURE;
};
// {23170F69-40C1-278A-0000-000800040000}
DEFINE_GUID(IID_IFolderWasChanged,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800040000")
IFolderWasChanged: public IUnknown
FOLDER_INTERFACE(IFolderWasChanged, 0x04)
{
public:
STDMETHOD(WasChanged)(INT32 *wasChanged) = 0;
STDMETHOD(WasChanged)(INT32 *wasChanged) PURE;
};
/*
// {23170F69-40C1-278A-0000-000800050000}
DEFINE_GUID(IID_IFolderReload,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x05, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800050000")
IFolderReload: public IUnknown
FOLDER_INTERFACE(IFolderReload, 0x05)
{
public:
STDMETHOD(Reload)() = 0;
STDMETHOD(Reload)() PURE;
};
*/
// {23170F69-40C1-278A-0000-000800060100}
DEFINE_GUID(IID_IFolderOperationsExtractCallback,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x06, 0x01, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800060100")
IFolderOperationsExtractCallback: public IProgress
FOLDER_INTERFACE_SUB(IFolderOperationsExtractCallback, IProgress, 0x06, 0x01)
{
public:
STDMETHOD(AskWrite)(
const wchar_t *srcPath,
INT32 srcIsFolder,
@@ -102,19 +76,14 @@ public:
const UINT64 *srcSize,
const wchar_t *destPathRequest,
BSTR *destPathResult,
INT32 *writeAnswer) = 0;
STDMETHOD(ShowMessage)(const wchar_t *message) = 0;
STDMETHOD(SetCurrentFilePath)(const wchar_t *filePath) = 0;
INT32 *writeAnswer) PURE;
STDMETHOD(ShowMessage)(const wchar_t *message) PURE;
STDMETHOD(SetCurrentFilePath)(const wchar_t *filePath) PURE;
};
/*
// {23170F69-40C1-278A-0000-000800060200}
DEFINE_GUID(IID_IFolderOperationsUpdateCallback,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x06, 0x02, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800060200")
IFolderOperationsUpdateCallback: public IProgress
FOLDER_INTERFACE_SUB(IFolderOperationsUpdateCallback, IProgress, 0x06, 0x02)
{
public:
STDMETHOD(AskOverwrite)(
const wchar_t *srcPath,
INT32 destIsFolder,
@@ -127,124 +96,88 @@ public:
};
*/
// {23170F69-40C1-278A-0000-000800060000}
DEFINE_GUID(IID_IFolderOperations,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x06, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800060000")
IFolderOperations: public IUnknown
FOLDER_INTERFACE(IFolderOperations, 0x06)
{
public:
STDMETHOD(CreateFolder)(const wchar_t *name, IProgress *progress) = 0;
STDMETHOD(CreateFile)(const wchar_t *name, IProgress *progress) = 0;
STDMETHOD(Rename)(UINT32 index, const wchar_t *newName, IProgress *progress) = 0;
STDMETHOD(Delete)(const UINT32 *indices, UINT32 numItems, IProgress *progress) = 0;
STDMETHOD(CreateFolder)(const wchar_t *name, IProgress *progress) PURE;
STDMETHOD(CreateFile)(const wchar_t *name, IProgress *progress) PURE;
STDMETHOD(Rename)(UINT32 index, const wchar_t *newName, IProgress *progress) PURE;
STDMETHOD(Delete)(const UINT32 *indices, UINT32 numItems, IProgress *progress) PURE;
STDMETHOD(CopyTo)(const UINT32 *indices, UINT32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback) = 0;
const wchar_t *path, IFolderOperationsExtractCallback *callback) PURE;
STDMETHOD(MoveTo)(const UINT32 *indices, UINT32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback) = 0;
const wchar_t *path, IFolderOperationsExtractCallback *callback) PURE;
STDMETHOD(CopyFrom)(const wchar_t *fromFolderPath,
const wchar_t **itemsPaths, UINT32 numItems, IProgress *progress) = 0;
STDMETHOD(SetProperty)(UINT32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress) = 0;
};
// {23170F69-40C1-278A-0000-000800070000}
DEFINE_GUID(IID_IFolderGetSystemIconIndex,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800070000")
IFolderGetSystemIconIndex: public IUnknown
{
public:
STDMETHOD(GetSystemIconIndex)(UINT32 index, INT32 *iconIndex) = 0;
};
// {23170F69-40C1-278A-0000-000800080000}
DEFINE_GUID(IID_IFolderGetItemFullSize,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800080000")
IFolderGetItemFullSize: public IUnknown
{
public:
STDMETHOD(GetItemFullSize)(UINT32 index, PROPVARIANT *value, IProgress *progress) = 0;
};
// {23170F69-40C1-278A-0000-000800090000}
DEFINE_GUID(IID_IFolderClone,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x09, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800090000")
IFolderClone: public IUnknown
{
public:
STDMETHOD(Clone)(IFolderFolder **resultFolder) = 0;
const wchar_t **itemsPaths, UINT32 numItems, IProgress *progress) PURE;
STDMETHOD(SetProperty)(UINT32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress) PURE;
};
/*
// {23170F69-40C1-278A-0000-0008000A0000}
DEFINE_GUID(IID_IFolderOpen,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-0008000A0000")
IFolderOpen: public IUnknown
FOLDER_INTERFACE2(IFolderOperationsDeleteToRecycleBin, 0x06, 0x03)
{
STDMETHOD(DeleteToRecycleBin)(const UINT32 *indices, UINT32 numItems, IProgress *progress) PURE;
};
*/
FOLDER_INTERFACE(IFolderGetSystemIconIndex, 0x07)
{
STDMETHOD(GetSystemIconIndex)(UINT32 index, INT32 *iconIndex) PURE;
};
FOLDER_INTERFACE(IFolderGetItemFullSize, 0x08)
{
STDMETHOD(GetItemFullSize)(UINT32 index, PROPVARIANT *value, IProgress *progress) PURE;
};
FOLDER_INTERFACE(IFolderClone, 0x09)
{
STDMETHOD(Clone)(IFolderFolder **resultFolder) PURE;
};
/*
FOLDER_INTERFACE(IFolderOpen, 0x0A)
{
STDMETHOD(FolderOpen)(
const wchar_t *aFileName,
// IArchiveHandler100 **anArchiveHandler,
// NZipRootRegistry::CArchiverInfo &anArchiverInfoResult,
// UString &aDefaultName,
IOpenArchive2CallBack *anOpenArchive2CallBack) = 0;
IOpenArchive2CallBack *anOpenArchive2CallBack) PURE;
};
*/
// {23170F69-40C1-278A-0000-000900000000}
DEFINE_GUID(IID_IFolderManager,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000900000000")
IFolderManager: public IUnknown
#define FOLDER_MANAGER_INTERFACE(i, x) \
DEFINE_GUID(IID_ ## i, \
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x09, 0x00, x, 0x00, 0x00); \
struct i: public IUnknown
FOLDER_MANAGER_INTERFACE(IFolderManager, 0x00)
{
STDMETHOD(OpenFolderFile)(const wchar_t *filePath, IFolderFolder **resultFolder, IProgress *progress) = 0;
STDMETHOD(GetTypes)(BSTR *types);
STDMETHOD(GetExtension)(const wchar_t *type, BSTR *extension);
STDMETHOD(CreateFolderFile)(const wchar_t *type, const wchar_t *filePath, IProgress *progress) = 0;
STDMETHOD(OpenFolderFile)(const wchar_t *filePath, IFolderFolder **resultFolder, IProgress *progress) PURE;
STDMETHOD(GetTypes)(BSTR *types) PURE;
STDMETHOD(GetExtension)(const wchar_t *type, BSTR *extension) PURE;
STDMETHOD(CreateFolderFile)(const wchar_t *type, const wchar_t *filePath, IProgress *progress) PURE;
};
// {23170F69-40C1-278A-0000-000900010000}
DEFINE_GUID(IID_IFolderManagerGetIconPath,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x09, 0x00, 0x01, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000900010000")
IFolderManagerGetIconPath: public IUnknown
FOLDER_MANAGER_INTERFACE(IFolderManagerGetIconPath, 0x01)
{
STDMETHOD(GetIconPath)(const wchar_t *type, BSTR *iconPath) = 0;
STDMETHOD(GetIconPath)(const wchar_t *type, BSTR *iconPath) PURE;
};
/*
// {23170F69-40C1-278A-0000-000800050A00}
DEFINE_GUID(IID_IFolderExtract,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x05, 0x0A, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800050A00")
IFolderExtract: public IUnknown
FOLDER_INTERFACE(IFolderExtract, 0x05, 0x0A);
{
public:
STDMETHOD(Clone)(IFolderFolder **aFolder) = 0;
STDMETHOD(Clone)(IFolderFolder **aFolder) PURE;
};
*/
/*
// {23170F69-40C1-278A-0000-000800050400}
DEFINE_GUID(IID_IFolderChangeNotify,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x05, 0x04, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800050400")
FOLDER_INTERFACE(IFolderChangeNotify,0x05, 0x04, 0x00);
IFolderChangeNotify: public IUnknown
{
public:
STDMETHOD(OnChanged)() = 0;
STDMETHOD(OnChanged)() PURE;
};
// {23170F69-40C1-278A-0000-000800050500}
DEFINE_GUID(IID_IFolderSetChangeNotify,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x08, 0x00, 0x05, 0x05, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000800050500")
IFolderSetChangeNotify: public IUnknown
FOLDER_INTERFACE(IFolderSetChangeNotify, 0x05, 0x05);
{
public:
STDMETHOD(SetChangeNotify)(IFolderChangeNotify *aChangeNotify) = 0;
STDMETHOD(SetChangeNotify)(IFolderChangeNotify *aChangeNotify) PURE;
};
*/

View File

@@ -600,8 +600,11 @@ bool ExecuteFileCommand(int id)
g_App.MoveTo();
break;
case IDM_DELETE:
g_App.Delete();
{
bool shift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0;
g_App.Delete(!shift);
break;
}
case IDM_FILE_SPLIT:
g_App.Split();
break;

View File

@@ -94,7 +94,10 @@ void OptionsDialog(HWND hwndOwner, HINSTANCE hInstance)
if (::PropertySheet(&sheet) != -1)
{
if (langPage._langWasChanged)
{
g_App._window.SetText(LangLoadStringW(IDS_APP_TITLE, 0x03000000));
MyLoadMenu();
}
g_App.SetListSettings();
g_App.SetShowSystemMenu();
g_App.RefreshAllPanels();

View File

@@ -736,7 +736,7 @@ void CPanel::AddToArchive()
names.Front(), (names.Size() > 1), false);
CompressFiles(_currentFolderPrefix, archiveName,
names, false, true, false);
KillSelection();
// KillSelection();
}
void CPanel::ExtractArchives()

View File

@@ -136,8 +136,9 @@ struct CSelectedState
{
int FocusedItem;
UString FocusedName;
bool SelectFocused;
UStringVector SelectedNames;
CSelectedState(): FocusedItem(-1) {}
CSelectedState(): FocusedItem(-1), SelectFocused(false) {}
};
class CPanel:public NWindows::NControl::CWindow2
@@ -173,7 +174,7 @@ class CPanel:public NWindows::NControl::CWindow2
public:
CPanelCallback *_panelCallback;
void DeleteItems();
void DeleteItems(bool toRecycleBin);
void CreateFolder();
void CreateFile();
@@ -185,8 +186,8 @@ private:
// void InitColumns2(PROPID sortID);
void InsertColumn(int index);
void SetFocusedSelectedItem(int index);
void RefreshListCtrl(const UString &focusedName, int focusedPos,
void SetFocusedSelectedItem(int index, bool select);
void RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
const UStringVector &selectedNames);
void OnShiftSelectMessage();
@@ -224,6 +225,7 @@ public:
bool _showRealFileIcons;
// bool _virtualMode;
// CUIntVector _realIndices;
bool _enableItemChangeNotify;
bool _mySelectMode;
CBoolVector _selectedStatusVector;
@@ -312,7 +314,8 @@ public:
_selectionIsDefined(false),
_ListViewMode(3),
_xSize(300),
_mySelectMode(false)
_mySelectMode(false),
_enableItemChangeNotify(true)
{}
void SetExtendedStyle()

View File

@@ -95,7 +95,7 @@ HRESULT CPanel::BindToPathAndRefresh(const UString &path)
{
CDisableTimerProcessing disableTimerProcessing1(*this);
RINOK(BindToPath(path));
RefreshListCtrl(UString(), -1, UStringVector());
RefreshListCtrl(UString(), -1, true, UStringVector());
return S_OK;
}
@@ -112,7 +112,7 @@ void CPanel::OpenBookmark(int index)
UString GetFolderPath(IFolderFolder * folder)
{
CMyComPtr<IFolderGetPath> folderGetPath;
if (folder->QueryInterface(&folderGetPath) == S_OK)
if (folder->QueryInterface(IID_IFolderGetPath, (void **)&folderGetPath) == S_OK)
{
CMyComBSTR path;
if (folderGetPath->GetPath(&path) == S_OK)
@@ -310,7 +310,7 @@ void CPanel::OpenParentFolder()
*/
LoadFullPath();
::SetCurrentDirectory(::GetSystemString(_currentFolderPrefix));
RefreshListCtrl(focucedName, -1, selectedItems);
RefreshListCtrl(focucedName, -1, true, selectedItems);
_listView.EnsureVisible(_listView.GetFocusedItem(), false);
RefreshStatusBar();
}
@@ -336,7 +336,7 @@ void CPanel::OpenRootFolder()
CDisableTimerProcessing disableTimerProcessing1(*this);
_parentFolders.Clear();
SetToRootFolder();
RefreshListCtrl(UString(), 0, UStringVector());
RefreshListCtrl(UString(), -1, true, UStringVector());
// ::SetCurrentDirectory(::GetSystemString(_currentFolderPrefix));
/*
BeforeChangeFolder();

View File

@@ -12,10 +12,12 @@
#include "../PropID.h"
#include "Panel.h"
#include "resource.h"
#include "RootFolder.h"
#include "PropertyName.h"
#include "LangUtils.h"
using namespace NWindows;
@@ -201,7 +203,7 @@ void CPanel::InsertColumn(int index)
void CPanel::RefreshListCtrl()
{
RefreshListCtrl(UString(), 0, UStringVector());
RefreshListCtrl(UString(), -1, true, UStringVector());
}
int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData);
@@ -245,35 +247,42 @@ void CPanel::SaveSelectedState(CSelectedState &s)
s.FocusedName.Empty();
s.SelectedNames.Clear();
s.FocusedItem = _listView.GetFocusedItem();
if (s.FocusedItem >= 0)
{
int realIndex = GetRealItemIndex(s.FocusedItem);
if (realIndex != kParentIndex)
s.FocusedName = GetItemName(realIndex);
/*
const int kSize = 1024;
TCHAR name[kSize + 1];
LVITEM item;
item.iItem = focusedItem;
item.pszText = name;
item.cchTextMax = kSize;
item.iSubItem = 0;
item.mask = LVIF_TEXT;
if (_listView.GetItem(&item))
focusedName = GetUnicodeString(item.pszText);
*/
}
if (!_focusedName.IsEmpty())
{
s.FocusedName = _focusedName;
s.SelectFocused = true;
_focusedName.Empty();
}
else
{
if (s.FocusedItem >= 0)
{
int realIndex = GetRealItemIndex(s.FocusedItem);
if (realIndex != kParentIndex)
s.FocusedName = GetItemName(realIndex);
/*
const int kSize = 1024;
TCHAR name[kSize + 1];
LVITEM item;
item.iItem = focusedItem;
item.pszText = name;
item.cchTextMax = kSize;
item.iSubItem = 0;
item.mask = LVIF_TEXT;
if (_listView.GetItem(&item))
focusedName = GetUnicodeString(item.pszText);
*/
}
}
GetSelectedNames(s.SelectedNames);
}
void CPanel::RefreshListCtrl(const CSelectedState &s)
{
RefreshListCtrl(s.FocusedName, s.FocusedItem, s.SelectedNames);
bool selectFocused = s.SelectFocused;
if (_mySelectMode)
selectFocused = true;
RefreshListCtrl(s.FocusedName, s.FocusedItem, selectFocused, s.SelectedNames);
}
void CPanel::RefreshListCtrlSaveFocused()
@@ -283,11 +292,13 @@ void CPanel::RefreshListCtrlSaveFocused()
RefreshListCtrl(state);
}
void CPanel::SetFocusedSelectedItem(int index)
void CPanel::SetFocusedSelectedItem(int index, bool select)
{
UINT state = LVIS_FOCUSED | LVIS_SELECTED;
UINT state = LVIS_FOCUSED;
if (select)
state |= LVIS_SELECTED;
_listView.SetItemState(index, state, state);
if (!_mySelectMode)
if (!_mySelectMode && select)
{
int realIndex = GetRealItemIndex(index);
if (realIndex != kParentIndex)
@@ -295,7 +306,7 @@ void CPanel::SetFocusedSelectedItem(int index)
}
}
void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos,
void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
const UStringVector &selectedNames)
{
LoadFullPathAndShow();
@@ -468,13 +479,13 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos,
// OutputDebugStringA("End2\n");
if(_listView.GetItemCount() > 0 && cursorIndex >= 0)
SetFocusedSelectedItem(cursorIndex);
SetFocusedSelectedItem(cursorIndex, selectFocused);
_listView.SortItems(CompareItems, (LPARAM)this);
if (cursorIndex < 0 && _listView.GetItemCount() > 0)
{
if (focusedPos >= _listView.GetItemCount())
focusedPos = _listView.GetItemCount() - 1;
SetFocusedSelectedItem(focusedPos);
SetFocusedSelectedItem(focusedPos, true);
}
// m_RedrawEnabled = true;
_listView.EnsureVisible(_listView.GetFocusedItem(), false);
@@ -514,9 +525,12 @@ void CPanel::GetOperatedItemIndices(CRecordVector<UINT32> &indices) const
int focusedItem = _listView.GetFocusedItem();
if (focusedItem >= 0)
{
int realIndex = GetRealItemIndex(focusedItem);
if (realIndex != kParentIndex)
if(_listView.GetItemState(focusedItem, LVIS_SELECTED) == LVIS_SELECTED)
{
int realIndex = GetRealItemIndex(focusedItem);
if (realIndex != kParentIndex)
indices.Add(realIndex);
}
}
}
@@ -571,7 +585,7 @@ void CPanel::OpenSelectedItems(bool tryInternal)
GetOperatedItemIndices(indices);
if (indices.Size() > 20)
{
MessageBox(L"Too much items");
MessageBox(LangLoadStringW(IDS_TOO_MANY_ITEMS, 0x02000606));
return;
}
@@ -659,7 +673,8 @@ void CPanel::ReadListViewInfo()
void CPanel::SaveListViewInfo()
{
for(int i = 0; i < _visibleProperties.Size(); i++)
int i;
for(i = 0; i < _visibleProperties.Size(); i++)
{
CItemProperty &property = _visibleProperties[i];
LVCOLUMN winColumnInfo;

View File

@@ -152,8 +152,7 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
*/
case VK_DELETE:
{
// if (shift)
DeleteItems();
DeleteItems(!shift);
return true;
}
case VK_INSERT:

View File

@@ -169,9 +169,12 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result)
{
case LVN_ITEMCHANGED:
{
if (!_mySelectMode)
OnItemChanged((LPNMLISTVIEW)header);
RefreshStatusBar();
if (_enableItemChangeNotify)
{
if (!_mySelectMode)
OnItemChanged((LPNMLISTVIEW)header);
RefreshStatusBar();
}
return false;
}
/*
@@ -257,6 +260,8 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result)
*/
case NM_CLICK:
{
// we need SetFocusToList, if we drag-select items from other panel.
SetFocusToList();
RefreshStatusBar();
if(_mySelectMode)
if(g_ComCtl32Version >= MAKELONG(71, 4))

View File

@@ -261,7 +261,8 @@ void CPanel::CreateSevenZipMenu(HMENU menuSpec,
return;
UString currentFolderUnicode = _currentFolderPrefix;
UStringVector names;
for(int i = 0; i < operatedIndices.Size(); i++)
int i;
for(i = 0; i < operatedIndices.Size(); i++)
names.Add(currentFolderUnicode + GetItemName(operatedIndices[i]));
CRecordVector<const wchar_t *> namePointers;
for(i = 0; i < operatedIndices.Size(); i++)

View File

@@ -7,6 +7,7 @@
#include "Panel.h"
#include "Common/StringConvert.h"
#include "Common/DynamicBuffer.h"
#include "Windows/FileDir.h"
#include "Windows/ResourceString.h"
#include "Windows/Thread.h"
@@ -35,8 +36,7 @@ struct CThreadDelete
{
NCOM::CComInitializer comInitializer;
UpdateCallbackSpec->ProgressDialog.WaitCreating();
Result = FolderOperations->Delete(&Indices.Front(),
Indices.Size(), UpdateCallback);
Result = FolderOperations->Delete(&Indices.Front(), Indices.Size(), UpdateCallback);
UpdateCallbackSpec->ProgressDialog.MyClose();
return 0;
}
@@ -47,15 +47,8 @@ struct CThreadDelete
}
};
void CPanel::DeleteItems()
void CPanel::DeleteItems(bool toRecycleBin)
{
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
CRecordVector<UInt32> indices;
GetOperatedItemIndices(indices);
@@ -63,6 +56,55 @@ void CPanel::DeleteItems()
return;
CSelectedState state;
SaveSelectedState(state);
if (IsFSFolder())
{
CDynamicBuffer<TCHAR> buffer;
size_t size = 0;
for (int i = 0; i < indices.Size(); i++)
{
const CSysString path = GetSystemString(GetFsPath() + GetItemName(indices[i]));
buffer.EnsureCapacity(size + path.Length() + 1);
memmove(((TCHAR *)buffer) + size, (const TCHAR *)path, (path.Length() + 1) * sizeof(TCHAR));
size += path.Length() + 1;
}
buffer.EnsureCapacity(size + 1);
((TCHAR *)buffer)[size] = 0;
SHFILEOPSTRUCT fo;
fo.hwnd = GetParent();
fo.wFunc = FO_DELETE;
fo.pFrom = (const TCHAR *)buffer;
fo.pTo = 0;
fo.fFlags = 0;
if (toRecycleBin)
fo.fFlags |= FOF_ALLOWUNDO;
// fo.fFlags |= FOF_NOCONFIRMATION;
// fo.fFlags |= FOF_NOERRORUI;
// fo.fFlags |= FOF_SILENT;
// fo.fFlags |= FOF_WANTNUKEWARNING;
fo.fAnyOperationsAborted = FALSE;
fo.hNameMappings = 0;
fo.lpszProgressTitle = 0;
int res = SHFileOperation(&fo);
/*
if (fo.fAnyOperationsAborted)
{
MessageBoxError(result, LangLoadStringW(IDS_ERROR_DELETING, 0x03020217));
}
*/
/*
(!result)
return GetLastError();
*/
}
else
{
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
MessageBox(LangLoadStringW(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
return;
}
UString title;
UString message;
@@ -112,6 +154,7 @@ void CPanel::DeleteItems()
HRESULT result = deleter.Result;
if (result != S_OK)
MessageBoxError(result, LangLoadStringW(IDS_ERROR_DELETING, 0x03020217));
}
RefreshListCtrl(state);
}
@@ -152,6 +195,11 @@ BOOL CPanel::OnEndLabelEdit(LV_DISPINFO * lpnmh)
// Can't use RefreshListCtrl here.
// RefreshListCtrlSaveFocused();
_focusedName = newName;
// We need clear all items to disable GetText before Reload:
// number of items can change.
_listView.DeleteAllItems();
PostMessage(kReLoadMessage);
return TRUE;
}
@@ -186,6 +234,7 @@ void CPanel::CreateFolder()
if (!_mySelectMode)
state.SelectedNames.Clear();
state.FocusedName = newName;
state.SelectFocused = true;
RefreshListCtrl(state);
}
@@ -219,6 +268,7 @@ void CPanel::CreateFile()
if (!_mySelectMode)
state.SelectedNames.Clear();
state.FocusedName = newName;
state.SelectFocused = true;
RefreshListCtrl(state);
}

View File

@@ -129,6 +129,8 @@ void CPanel::UpdateSelection()
{
if (!_mySelectMode)
{
bool enableTemp = _enableItemChangeNotify;
_enableItemChangeNotify = false;
int numItems = _listView.GetItemCount();
for (int i = 0; i < numItems; i++)
{
@@ -140,6 +142,7 @@ void CPanel::UpdateSelection()
_listView.SetItemState(i, value, LVIS_SELECTED);
}
}
_enableItemChangeNotify = enableTemp;
}
_listView.RedrawAllItems();
}
@@ -213,6 +216,24 @@ void CPanel::SelectAll(bool selectMode)
void CPanel::InvertSelection()
{
if (!_mySelectMode)
{
int numSelected = 0;
for (int i = 0; i < _selectedStatusVector.Size(); i++)
if (_selectedStatusVector[i])
numSelected++;
if (numSelected == 1)
{
int focused = _listView.GetFocusedItem();
if (focused >= 0)
{
int realIndex = GetRealItemIndex(focused);
if (realIndex >= 0)
if (_selectedStatusVector[realIndex])
_selectedStatusVector[realIndex] = false;
}
}
}
for (int i = 0; i < _selectedStatusVector.Size(); i++)
_selectedStatusVector[i] = !_selectedStatusVector[i];
UpdateSelection();

View File

@@ -499,7 +499,6 @@ public:
Pos = 0;
}
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
STDMETHOD(ReadPart)(void *data, UInt32 size, UInt32 *processedSize);
};
STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
@@ -517,11 +516,6 @@ STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processed
return S_OK;
}
STDMETHODIMP CBenchmarkInStream::ReadPart(void *data, UInt32 size, UInt32 *processedSize)
{
return Read(data, size, processedSize);
}
class CBenchmarkOutStream:
public ISequentialOutStream,
public CMyUnknownImp
@@ -542,7 +536,6 @@ public:
}
MY_UNKNOWN_IMP
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
STDMETHOD(WritePart)(const void *data, UInt32 size, UInt32 *processedSize);
};
STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
@@ -560,11 +553,6 @@ STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *p
return S_OK;
}
STDMETHODIMP CBenchmarkOutStream::WritePart(const void *data, UInt32 size, UInt32 *processedSize)
{
return Write(data, size, processedSize);
}
class CCompareOutStream:
public ISequentialOutStream,
public CMyUnknownImp
@@ -574,7 +562,6 @@ public:
MY_UNKNOWN_IMP
void Init() { CRC.Init(); }
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
STDMETHOD(WritePart)(const void *data, UInt32 size, UInt32 *processedSize);
};
STDMETHODIMP CCompareOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
@@ -585,11 +572,6 @@ STDMETHODIMP CCompareOutStream::Write(const void *data, UInt32 size, UInt32 *pro
return S_OK;
}
STDMETHODIMP CCompareOutStream::WritePart(const void *data, UInt32 size, UInt32 *processedSize)
{
return Write(data, size, processedSize);
}
typedef UInt32 (WINAPI * CreateObjectPointer)(const GUID *clsID,
const GUID *interfaceID, void **outObject);

View File

@@ -9,7 +9,8 @@ void SplitStringToTwoStrings(const UString &src, UString &dest1, UString &dest2)
dest1.Empty();
dest2.Empty();
bool quoteMode = false;
for (int i = 0; i < src.Length(); i++)
int i;
for (i = 0; i < src.Length(); i++)
{
wchar_t c = src[i];
if (c == L'\"')

View File

@@ -119,19 +119,15 @@ static int ComparePairIDs(const UString &s1, const UString &s2)
{ return s1.CollateNoCase(s2); }
static int ComparePairItems(const CTextPair &p1, const CTextPair &p2)
{ return ComparePairIDs(p1.ID, p2.ID); }
static int __cdecl ComparePairItems(const void *a1, const void *a2)
{
return ComparePairItems(
*(*((const CTextPair **)a1)),
*(*((const CTextPair **)a2)));
}
// typedef void* MY_PVOID;
// static int ComparePairItems(const MY_PVOID *a1, const MY_PVOID *a2, void *param)
static int ComparePairItems(void *const *a1, void *const *a2, void *param)
{ return ComparePairItems(**(const CTextPair **)a1, **(const CTextPair **)a2); }
void CPairsStorage::Sort()
{
CPointerVector &pointerVector = Pairs;
qsort(&pointerVector[0], Pairs.Size(), sizeof(void *),
ComparePairItems);
}
{ Pairs.Sort(ComparePairItems, 0); }
int CPairsStorage::FindID(const UString &id, int &insertPos)
{

View File

@@ -105,6 +105,7 @@
#define IDS_SELECT_MASK 2252
#define IDS_FOLDERS_HISTORY 2260
#define IDS_N_SELECTED_ITEMS 2270
#define IDS_TOO_MANY_ITEMS 2279
#define IDS_WANT_UPDATE_MODIFIED_FILE 2280
#define IDS_CANNOT_UPDATE_FILE 2281
#define IDS_CANNOT_START_EDITOR 2282

View File

@@ -176,6 +176,7 @@ BEGIN
IDS_COMMENT "Comment"
IDS_COMMENT2 "&Comment:"
IDS_SYSTEM "System"
IDS_TOO_MANY_ITEMS "Too many items"
IDS_WANT_UPDATE_MODIFIED_FILE "File '{0}' was modified.\nDo you want to update it in the archive?"
IDS_CANNOT_UPDATE_FILE "Can not update file\n'{0}'"
IDS_CANNOT_START_EDITOR "Cannot start editor."