This commit is contained in:
Igor Pavlov
2008-12-31 00:00:00 +00:00
committed by Kornel Lesiński
parent c1f1243a70
commit 3a524e5ba2
259 changed files with 2792 additions and 4855 deletions

View File

@@ -11,14 +11,15 @@
#include "Windows/PropVariantConversions.h"
#include "Windows/Time.h"
#include "../../Compress/Copy/CopyCoder.h"
#include "../../Compress/CopyCoder.h"
#include "../../Common/FileStreams.h"
#include "../Common/UpdatePair.h"
#include "../Common/EnumDirItems.h"
#include "../Common/HandlerLoader.h"
#include "../Common/UpdateCallback.h"
#include "../Common/OpenArchive.h"
#include "../Common/UpdateCallback.h"
#include "../Common/UpdatePair.h"
#include "Agent.h"
#include "UpdateCallbackAgent.h"
@@ -143,6 +144,21 @@ static HRESULT EnumerateArchiveItems(CAgent *agent,
return S_OK;
}
struct CAgUpCallbackImp: public IUpdateProduceCallback
{
const CObjectVector<CArcItem> *_arcItems;
IFolderArchiveUpdateCallback *_callback;
CAgUpCallbackImp(const CObjectVector<CArcItem> *a,
IFolderArchiveUpdateCallback *callback): _arcItems(a), _callback(callback) {}
HRESULT ShowDeleteFile(int arcIndex);
};
HRESULT CAgUpCallbackImp::ShowDeleteFile(int arcIndex)
{
return _callback->DeleteOperation((*_arcItems)[arcIndex].Name);
}
STDMETHODIMP CAgent::DoOperation(
CCodecs *codecs,
int formatIndex,
@@ -221,7 +237,8 @@ STDMETHODIMP CAgent::DoOperation(
{
CRecordVector<CUpdatePair> updatePairs;
GetUpdatePairInfoList(dirItems, arcItems, fileTimeType, updatePairs);
UpdateProduce(updatePairs, actionSet, updatePairs2);
CAgUpCallbackImp upCallback(&arcItems, updateCallback100);
UpdateProduce(updatePairs, actionSet, updatePairs2, &upCallback);
}
UInt32 numFiles = 0;

View File

@@ -102,3 +102,10 @@ HRESULT CUpdateCallbackAgent::CryptoGetTextPassword2(Int32 *passwordIsDefined, B
}
return _cryptoGetTextPassword->CryptoGetTextPassword2(passwordIsDefined, password);
}
/*
HRESULT CUpdateCallbackAgent::ShowDeleteFile(const wchar_t *name)
{
return Callback->DeleteOperation(name);
}
*/

View File

@@ -19,7 +19,8 @@
#include "Windows/Time.h"
#include "../../Common/FileStreams.h"
#include "../../Compress/Copy/CopyCoder.h"
#include "../../Compress/CopyCoder.h"
#include "../Common/DirItem.h"
#include "../Common/EnumDirItems.h"
@@ -285,6 +286,22 @@ bool CUpdateOptions::Init(const CCodecs *codecs, const CIntVector &formatIndices
return true;
}
/*
struct CUpdateProduceCallbackImp: public IUpdateProduceCallback
{
const CObjectVector<CArcItem> *_arcItems;
IUpdateCallbackUI *_callback;
CUpdateProduceCallbackImp(const CObjectVector<CArcItem> *a,
IUpdateCallbackUI *callback): _arcItems(a), _callback(callback) {}
virtual HRESULT ShowDeleteFile(int arcIndex);
};
HRESULT CUpdateProduceCallbackImp::ShowDeleteFile(int arcIndex)
{
return _callback->ShowDeleteFile((*_arcItems)[arcIndex].Name);
}
*/
static HRESULT Compress(
CCodecs *codecs,
@@ -351,7 +368,8 @@ static HRESULT Compress(
{
CRecordVector<CUpdatePair> updatePairs;
GetUpdatePairInfoList(dirItems, arcItems, fileTimeType, updatePairs); // must be done only once!!!
UpdateProduce(updatePairs, actionSet, updatePairs2);
// CUpdateProduceCallbackImp upCallback(&arcItems, callback);
UpdateProduce(updatePairs, actionSet, updatePairs2, NULL /* &upCallback */);
}
UInt32 numFiles = 0;

View File

@@ -23,7 +23,7 @@
virtual HRESULT OpenFileError(const wchar_t *name, DWORD systemError) x; \
virtual HRESULT SetOperationResult(Int32 operationResult) x; \
virtual HRESULT CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password) x; \
// virtual HRESULT ShowDeleteFile(const wchar_t *name) x; \
// virtual HRESULT CloseProgress() { return S_OK; };
struct IUpdateCallbackUI

View File

@@ -10,8 +10,9 @@ static const char *kUpdateActionSetCollision = "Internal collision in update act
void UpdateProduce(
const CRecordVector<CUpdatePair> &updatePairs,
const NUpdateArchive::CActionSet &actionSet,
CRecordVector<CUpdatePair2> &operationChain)
const CActionSet &actionSet,
CRecordVector<CUpdatePair2> &operationChain,
IUpdateProduceCallback *callback)
{
for (int i = 0; i < updatePairs.Size(); i++)
{
@@ -22,6 +23,7 @@ void UpdateProduce(
up2.DirIndex = pair.DirIndex;
up2.ArcIndex = pair.ArcIndex;
up2.NewData = up2.NewProps = true;
switch(actionSet.StateActions[pair.State])
{
case NPairAction::kIgnore:
@@ -30,6 +32,8 @@ void UpdateProduce(
IgnoreArchiveItem(m_ArchiveItems[pair.ArcIndex]);
// cout << "deleting";
*/
if (callback)
callback->ShowDeleteFile(pair.ArcIndex);
continue;
case NPairAction::kCopy:

View File

@@ -21,9 +21,15 @@ struct CUpdatePair2
CUpdatePair2(): IsAnti(false), DirIndex(-1), ArcIndex(-1), NewNameIndex(-1) {}
};
struct IUpdateProduceCallback
{
virtual HRESULT ShowDeleteFile(int arcIndex) = 0;
};
void UpdateProduce(
const CRecordVector<CUpdatePair> &updatePairs,
const NUpdateArchive::CActionSet &actionSet,
CRecordVector<CUpdatePair2> &operationChain);
CRecordVector<CUpdatePair2> &operationChain,
IUpdateProduceCallback *callback);
#endif

View File

@@ -696,11 +696,11 @@ SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.h
# End Group
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.cpp
SOURCE=..\..\Compress\CopyCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.h
SOURCE=..\..\Compress\CopyCoder.h
# End Source File
# End Group
# Begin Group "C"

View File

@@ -217,3 +217,22 @@ HRESULT CUpdateCallbackConsole::CryptoGetTextPassword2(Int32 *passwordIsDefined,
#endif
}
/*
HRESULT CUpdateCallbackConsole::ShowDeleteFile(const wchar_t *name)
{
// MT_LOCK
if (StdOutMode)
return S_OK;
RINOK(Finilize());
m_PercentPrinter.PrintString("Deleting ");
if (name[0] == 0)
name = kEmptyFileAlias;
m_PercentPrinter.PrintString(name);
if (EnablePercents)
m_PercentPrinter.RePrintRatio();
m_NeedBeClosed = true;
m_NeedNewLine = true;
return S_OK;
}
*/

View File

@@ -111,7 +111,7 @@ $(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
$(UI_COMMON_OBJS): ../Common/$(*B).cpp
$(COMPL)
$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
$O\CopyCoder.obj: ../../Compress/$(*B).cpp
$(COMPL)
$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
$(COMPL)

View File

@@ -518,11 +518,11 @@ SOURCE=..\Agent\UpdateCallbackAgent.h
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.cpp
SOURCE=..\..\Compress\CopyCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.h
SOURCE=..\..\Compress\CopyCoder.h
# End Source File
# End Group
# Begin Group "7-zip Common"

View File

@@ -101,7 +101,7 @@ $(UI_COMMON_OBJS): ../Common/$(*B).cpp
$(COMPL)
$(AGENT_OBJS): ../Agent/$(*B).cpp
$(COMPL)
$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
$O\CopyCoder.obj: ../../Compress/$(*B).cpp
$(COMPL)
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)

View File

@@ -355,8 +355,10 @@ HRESULT CApp::Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &ar
ReadListMode(listMode);
for (i = 0; i < kNumPanelsMax; i++)
{
Panels[i]._ListViewMode = listMode.Panels[i];
Panels[i]._xSize = xSizes[i];
CPanel &panel = Panels[i];
panel._ListViewMode = listMode.Panels[i];
panel._xSize = xSizes[i];
panel._flatModeForArc = ReadFlatView(i);
}
for (i = 0; i < kNumPanelsMax; i++)
if (NumPanels > 1 || i == LastFocusedPanel)
@@ -414,6 +416,7 @@ void CApp::Save()
path = GetFolderPath(panel._parentFolders[0].ParentFolder);
SavePanelPath(i, path);
listMode.Panels[i] = panel.GetListViewMode();
SaveFlatView(i, panel._flatModeForArc);
}
SaveListMode(listMode);
}

View File

@@ -1319,11 +1319,11 @@ SOURCE=..\Agent\UpdateCallbackAgent.h
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.cpp
SOURCE=..\..\Compress\CopyCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.h
SOURCE=..\..\Compress\CopyCoder.h
# End Source File
# End Group
# Begin Group "Interface"

View File

@@ -756,6 +756,10 @@ void CPanel::SetListViewMode(UInt32 index)
void CPanel::ChangeFlatMode()
{
_flatMode = !_flatMode;
if (_parentFolders.Size() > 0)
_flatModeForArc = _flatMode;
else
_flatModeForDisk = _flatMode;
RefreshListCtrlSaveFocused();
}

View File

@@ -271,6 +271,8 @@ public:
int _xSize;
bool _flatMode;
bool _flatModeForDisk;
bool _flatModeForArc;
bool _dontShowMode;
@@ -336,6 +338,8 @@ public:
_selectionIsDefined(false),
_ListViewMode(3),
_flatMode(false),
_flatModeForDisk(false),
_flatModeForArc(false),
_xSize(300),
_mySelectMode(false),
_enableItemChangeNotify(true),

View File

@@ -501,6 +501,8 @@ void CPanel::OpenParentFolder()
if (_parentFolders.Size () > 1)
OpenParentArchiveFolder();
_parentFolders.DeleteBack();
if (_parentFolders.IsEmpty())
_flatMode = _flatModeForDisk;
}
}
@@ -528,6 +530,7 @@ void CPanel::CloseOpenFolders()
OpenParentArchiveFolder();
_parentFolders.DeleteBack();
}
_flatMode = _flatModeForDisk;
_folder.Release();
_library.Free();
}

View File

@@ -105,6 +105,8 @@ HRESULT CPanel::OpenItemAsArchive(const UString &name,
_folder = newFolder;
_library.Attach(library.Detach());
_flatMode = _flatModeForArc;
return S_OK;
}

View File

@@ -572,7 +572,8 @@ void CPanel::OpenSelectedItems(bool tryInternal)
if (focusedItem >= 0)
{
int realIndex = GetRealItemIndex(focusedItem);
if (realIndex == kParentIndex && (tryInternal || indices.Size() == 0))
if (realIndex == kParentIndex && (tryInternal || indices.Size() == 0) &&
_listView.GetItemState(focusedItem, LVIS_SELECTED) == LVIS_SELECTED)
indices.Insert(0, realIndex);
}

View File

@@ -3,6 +3,7 @@
#include "StdAfx.h"
#include "RegistryUtils.h"
#include "Common/IntToString.h"
#include "Windows/Registry.h"
using namespace NWindows;
@@ -28,6 +29,8 @@ static const TCHAR *kLargePagesEnable = TEXT("LargePages");
// static const TCHAR *kSingleClick = TEXT("SingleClick");
// static const TCHAR *kUnderline = TEXT("Underline");
static const TCHAR *kFlatViewName = TEXT("FlatViewArc");
void SaveRegLang(const UString &langFile)
{
CKey key;
@@ -149,4 +152,12 @@ bool ReadUnderline(){ return ReadOption(kUnderline, false); }
void SaveLockMemoryEnable(bool enable) { Save7ZipOption(kLargePagesEnable, enable); }
bool ReadLockMemoryEnable() { return Read7ZipOption(kLargePagesEnable, false); }
static CSysString GetFlatViewName(UInt32 panelIndex)
{
TCHAR panelString[32];
ConvertUInt64ToString(panelIndex, panelString);
return (CSysString)kFlatViewName + panelString;
}
void SaveFlatView(UInt32 panelIndex, bool enable) { SaveOption(GetFlatViewName(panelIndex), enable); }
bool ReadFlatView(UInt32 panelIndex) { return ReadOption(GetFlatViewName(panelIndex), false); }

View File

@@ -43,4 +43,7 @@ void SaveUnderline(bool enable);
bool ReadUnderline();
*/
void SaveFlatView(UInt32 panelIndex, bool enable);
bool ReadFlatView(UInt32 panelIndex);
#endif

View File

@@ -60,8 +60,9 @@ STDMETHODIMP CUpdateCallback100Imp::CompressOperation(const wchar_t *name)
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t * /* name */)
STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t *name)
{
ProgressDialog.ProgressSynch.SetCurrentFileName(name);
return S_OK;
}

View File

@@ -185,7 +185,7 @@ $(UI_COMMON_OBJS): ../Common/$(*B).cpp
$(AGENT_OBJS): ../Agent/$(*B).cpp
$(COMPL)
$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
$O\CopyCoder.obj: ../../Compress/$(*B).cpp
$(COMPL)
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)

View File

@@ -629,11 +629,11 @@ SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h
# End Group
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.cpp
SOURCE=..\..\Compress\CopyCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.h
SOURCE=..\..\Compress\CopyCoder.h
# End Source File
# End Group
# Begin Group "C"

View File

@@ -2,17 +2,18 @@
#include "StdAfx.h"
#include "UpdateCallbackGUI.h"
#include "Common/StringConvert.h"
#include "Common/IntToString.h"
#include "Common/Defs.h"
#include "Common/IntToString.h"
#include "Common/StringConvert.h"
#include "Windows/PropVariant.h"
#include "Windows/Error.h"
#include "Windows/PropVariant.h"
#include "../FileManager/MessagesDialog.h"
#include "../FileManager/PasswordDialog.h"
#include "UpdateCallbackGUI.h"
using namespace NWindows;
CUpdateCallbackGUI::~CUpdateCallbackGUI()
@@ -229,4 +230,12 @@ void CUpdateCallbackGUI::Open_ClearPasswordWasAskedFlag()
PasswordWasAsked = false;
}
/*
HRESULT CUpdateCallbackGUI::ShowDeleteFile(const wchar_t *name)
{
ProgressDialog.ProgressSynch.SetCurrentFileName(name);
return S_OK;
}
*/
#endif

View File

@@ -145,7 +145,7 @@ $O\MyMessages.obj: ../Explorer/MyMessages.cpp
$(COMPL)
$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
$O\CopyCoder.obj: ../../Compress/$(*B).cpp
$(COMPL)
$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
$(COMPL)