mirror of
https://github.com/aaru-dps/Aaru.Compression.Native.git
synced 2025-12-16 19:24:31 +00:00
Move placement of lzma.
This commit is contained in:
1025
3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp
vendored
Normal file
1025
3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h
vendored
Normal file
21
3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
// BrowseDialog.h
|
||||
|
||||
#ifndef __BROWSE_DIALOG_H
|
||||
#define __BROWSE_DIALOG_H
|
||||
|
||||
#include "../../../Common/MyString.h"
|
||||
|
||||
bool MyBrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR path, UString &resultPath);
|
||||
bool MyBrowseForFile(HWND owner, LPCWSTR title, LPCWSTR path, LPCWSTR filterDescription, LPCWSTR filter, UString &resultPath);
|
||||
|
||||
/* CorrectFsPath removes undesirable characters in names (dots and spaces at the end of file)
|
||||
But it doesn't change "bad" name in any of the following cases:
|
||||
- path is Super Path (with \\?\ prefix)
|
||||
- path is relative and relBase is Super Path
|
||||
- there is file or dir in filesystem with specified "bad" name */
|
||||
|
||||
bool CorrectFsPath(const UString &relBase, const UString &path, UString &result);
|
||||
|
||||
bool Dlg_CreateFolder(HWND wnd, UString &destName);
|
||||
|
||||
#endif
|
||||
9
3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialogRes.h
vendored
Normal file
9
3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialogRes.h
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
#define IDD_BROWSE 95
|
||||
|
||||
#define IDL_BROWSE 100
|
||||
#define IDT_BROWSE_FOLDER 101
|
||||
#define IDE_BROWSE_PATH 102
|
||||
#define IDC_BROWSE_FILTER 103
|
||||
|
||||
#define IDB_BROWSE_PARENT 110
|
||||
#define IDB_BROWSE_CREATE_DIR 112
|
||||
64
3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp
vendored
Normal file
64
3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
// ComboDialog.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "ComboDialog.h"
|
||||
|
||||
#include "../../../Windows/Control/Static.h"
|
||||
|
||||
#ifdef LANG
|
||||
#include "LangUtils.h"
|
||||
#endif
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
bool CComboDialog::OnInit()
|
||||
{
|
||||
#ifdef LANG
|
||||
LangSetDlgItems(*this, NULL, 0);
|
||||
#endif
|
||||
_comboBox.Attach(GetItem(IDC_COMBO));
|
||||
|
||||
/*
|
||||
// why it doesn't work ?
|
||||
DWORD style = _comboBox.GetStyle();
|
||||
if (Sorted)
|
||||
style |= CBS_SORT;
|
||||
else
|
||||
style &= ~CBS_SORT;
|
||||
_comboBox.SetStyle(style);
|
||||
*/
|
||||
SetText(Title);
|
||||
|
||||
NControl::CStatic staticContol;
|
||||
staticContol.Attach(GetItem(IDT_COMBO));
|
||||
staticContol.SetText(Static);
|
||||
_comboBox.SetText(Value);
|
||||
FOR_VECTOR (i, Strings)
|
||||
_comboBox.AddString(Strings[i]);
|
||||
NormalizeSize();
|
||||
return CModalDialog::OnInit();
|
||||
}
|
||||
|
||||
bool CComboDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
|
||||
{
|
||||
int mx, my;
|
||||
GetMargins(8, mx, my);
|
||||
int bx1, bx2, by;
|
||||
GetItemSizes(IDCANCEL, bx1, by);
|
||||
GetItemSizes(IDOK, bx2, by);
|
||||
int y = ySize - my - by;
|
||||
int x = xSize - mx - bx1;
|
||||
|
||||
InvalidateRect(NULL);
|
||||
|
||||
MoveItem(IDCANCEL, x, y, bx1, by);
|
||||
MoveItem(IDOK, x - mx - bx2, y, bx2, by);
|
||||
ChangeSubWindowSizeX(_comboBox, xSize - mx * 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
void CComboDialog::OnOK()
|
||||
{
|
||||
_comboBox.GetText(Value);
|
||||
CModalDialog::OnOK();
|
||||
}
|
||||
28
3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.h
vendored
Normal file
28
3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.h
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// ComboDialog.h
|
||||
|
||||
#ifndef __COMBO_DIALOG_H
|
||||
#define __COMBO_DIALOG_H
|
||||
|
||||
#include "../../../Windows/Control/ComboBox.h"
|
||||
#include "../../../Windows/Control/Dialog.h"
|
||||
|
||||
#include "ComboDialogRes.h"
|
||||
|
||||
class CComboDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
NWindows::NControl::CComboBox _comboBox;
|
||||
virtual void OnOK();
|
||||
virtual bool OnInit();
|
||||
virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
|
||||
public:
|
||||
// bool Sorted;
|
||||
UString Title;
|
||||
UString Static;
|
||||
UString Value;
|
||||
UStringVector Strings;
|
||||
|
||||
// CComboDialog(): Sorted(false) {};
|
||||
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_COMBO, parentWindow); }
|
||||
};
|
||||
|
||||
#endif
|
||||
4
3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialogRes.h
vendored
Normal file
4
3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialogRes.h
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
#define IDD_COMBO 98
|
||||
|
||||
#define IDT_COMBO 100
|
||||
#define IDC_COMBO 101
|
||||
16
3rdparty/lzma/CPP/7zip/UI/FileManager/DialogSize.h
vendored
Normal file
16
3rdparty/lzma/CPP/7zip/UI/FileManager/DialogSize.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// DialogSize.h
|
||||
|
||||
#ifndef __DIALOG_SIZE_H
|
||||
#define __DIALOG_SIZE_H
|
||||
|
||||
#include "../../../Windows/Control/Dialog.h"
|
||||
|
||||
#ifdef UNDER_CE
|
||||
#define BIG_DIALOG_SIZE(x, y) bool isBig = NWindows::NControl::IsDialogSizeOK(x, y);
|
||||
#define SIZED_DIALOG(big) (isBig ? big : big ## _2)
|
||||
#else
|
||||
#define BIG_DIALOG_SIZE(x, y)
|
||||
#define SIZED_DIALOG(big) big
|
||||
#endif
|
||||
|
||||
#endif
|
||||
1045
3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp
vendored
Normal file
1045
3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
326
3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h
vendored
Normal file
326
3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h
vendored
Normal file
@@ -0,0 +1,326 @@
|
||||
// ExtractCallback.h
|
||||
|
||||
#ifndef __EXTRACT_CALLBACK_H
|
||||
#define __EXTRACT_CALLBACK_H
|
||||
|
||||
#include "../../../../C/Alloc.h"
|
||||
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../../Common/StringConvert.h"
|
||||
|
||||
#ifndef _SFX
|
||||
#include "../Agent/IFolderArchive.h"
|
||||
#endif
|
||||
|
||||
#include "../Common/ArchiveExtractCallback.h"
|
||||
#include "../Common/ArchiveOpenCallback.h"
|
||||
|
||||
#ifndef _NO_CRYPTO
|
||||
#include "../../IPassword.h"
|
||||
#endif
|
||||
|
||||
#ifndef _SFX
|
||||
#include "IFolder.h"
|
||||
#endif
|
||||
|
||||
#include "ProgressDialog2.h"
|
||||
|
||||
#ifdef LANG
|
||||
#include "LangUtils.h"
|
||||
#endif
|
||||
|
||||
#ifndef _SFX
|
||||
|
||||
class CGrowBuf
|
||||
{
|
||||
Byte *_items;
|
||||
size_t _size;
|
||||
|
||||
CLASS_NO_COPY(CGrowBuf);
|
||||
|
||||
public:
|
||||
bool ReAlloc_KeepData(size_t newSize, size_t keepSize)
|
||||
{
|
||||
void *buf = MyAlloc(newSize);
|
||||
if (!buf)
|
||||
return false;
|
||||
if (keepSize != 0)
|
||||
memcpy(buf, _items, keepSize);
|
||||
MyFree(_items);
|
||||
_items = (Byte *)buf;
|
||||
_size = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
CGrowBuf(): _items(0), _size(0) {}
|
||||
~CGrowBuf() { MyFree(_items); }
|
||||
|
||||
operator Byte *() { return _items; }
|
||||
operator const Byte *() const { return _items; }
|
||||
size_t Size() const { return _size; }
|
||||
};
|
||||
|
||||
struct CVirtFile
|
||||
{
|
||||
CGrowBuf Data;
|
||||
|
||||
UInt64 Size; // real size
|
||||
UInt64 ExpectedSize; // the size from props request. 0 if unknown
|
||||
|
||||
UString Name;
|
||||
|
||||
bool CTimeDefined;
|
||||
bool ATimeDefined;
|
||||
bool MTimeDefined;
|
||||
bool AttribDefined;
|
||||
|
||||
bool IsDir;
|
||||
bool IsAltStream;
|
||||
|
||||
DWORD Attrib;
|
||||
|
||||
FILETIME CTime;
|
||||
FILETIME ATime;
|
||||
FILETIME MTime;
|
||||
|
||||
CVirtFile():
|
||||
CTimeDefined(false),
|
||||
ATimeDefined(false),
|
||||
MTimeDefined(false),
|
||||
AttribDefined(false),
|
||||
IsDir(false),
|
||||
IsAltStream(false) {}
|
||||
};
|
||||
|
||||
class CVirtFileSystem:
|
||||
public ISequentialOutStream,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
UInt64 _totalAllocSize;
|
||||
|
||||
size_t _pos;
|
||||
unsigned _numFlushed;
|
||||
bool _fileIsOpen;
|
||||
bool _fileMode;
|
||||
COutFileStream *_outFileStreamSpec;
|
||||
CMyComPtr<ISequentialOutStream> _outFileStream;
|
||||
public:
|
||||
CObjectVector<CVirtFile> Files;
|
||||
UInt64 MaxTotalAllocSize;
|
||||
FString DirPrefix;
|
||||
|
||||
CVirtFile &AddNewFile()
|
||||
{
|
||||
if (!Files.IsEmpty())
|
||||
{
|
||||
MaxTotalAllocSize -= Files.Back().Data.Size();
|
||||
}
|
||||
return Files.AddNew();
|
||||
}
|
||||
HRESULT CloseMemFile()
|
||||
{
|
||||
if (_fileMode)
|
||||
{
|
||||
return FlushToDisk(true);
|
||||
}
|
||||
CVirtFile &file = Files.Back();
|
||||
if (file.Data.Size() != file.Size)
|
||||
{
|
||||
file.Data.ReAlloc_KeepData((size_t)file.Size, (size_t)file.Size);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
bool IsStreamInMem() const
|
||||
{
|
||||
if (_fileMode)
|
||||
return false;
|
||||
if (Files.Size() < 1 || /* Files[0].IsAltStream || */ Files[0].IsDir)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t GetMemStreamWrittenSize() const { return _pos; }
|
||||
|
||||
CVirtFileSystem(): _outFileStreamSpec(NULL), MaxTotalAllocSize((UInt64)0 - 1) {}
|
||||
|
||||
void Init()
|
||||
{
|
||||
_totalAllocSize = 0;
|
||||
_fileMode = false;
|
||||
_pos = 0;
|
||||
_numFlushed = 0;
|
||||
_fileIsOpen = false;
|
||||
}
|
||||
|
||||
HRESULT CloseFile(const FString &path);
|
||||
HRESULT FlushToDisk(bool closeLast);
|
||||
size_t GetPos() const { return _pos; }
|
||||
|
||||
MY_UNKNOWN_IMP
|
||||
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
class CExtractCallbackImp:
|
||||
public IExtractCallbackUI, // it includes IFolderArchiveExtractCallback
|
||||
public IOpenCallbackUI,
|
||||
public IFolderArchiveExtractCallback2,
|
||||
#ifndef _SFX
|
||||
public IFolderOperationsExtractCallback,
|
||||
public IFolderExtractToStreamCallback,
|
||||
public ICompressProgressInfo,
|
||||
#endif
|
||||
#ifndef _NO_CRYPTO
|
||||
public ICryptoGetTextPassword,
|
||||
#endif
|
||||
public CMyUnknownImp
|
||||
{
|
||||
HRESULT MessageError(const char *message, const FString &path);
|
||||
void Add_ArchiveName_Error();
|
||||
public:
|
||||
MY_QUERYINTERFACE_BEGIN2(IFolderArchiveExtractCallback)
|
||||
MY_QUERYINTERFACE_ENTRY(IFolderArchiveExtractCallback2)
|
||||
#ifndef _SFX
|
||||
MY_QUERYINTERFACE_ENTRY(IFolderOperationsExtractCallback)
|
||||
MY_QUERYINTERFACE_ENTRY(IFolderExtractToStreamCallback)
|
||||
MY_QUERYINTERFACE_ENTRY(ICompressProgressInfo)
|
||||
#endif
|
||||
#ifndef _NO_CRYPTO
|
||||
MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
|
||||
#endif
|
||||
MY_QUERYINTERFACE_END
|
||||
MY_ADDREF_RELEASE
|
||||
|
||||
INTERFACE_IProgress(;)
|
||||
INTERFACE_IOpenCallbackUI(;)
|
||||
INTERFACE_IFolderArchiveExtractCallback(;)
|
||||
INTERFACE_IFolderArchiveExtractCallback2(;)
|
||||
// STDMETHOD(SetTotalFiles)(UInt64 total);
|
||||
// STDMETHOD(SetCompletedFiles)(const UInt64 *value);
|
||||
|
||||
INTERFACE_IExtractCallbackUI(;)
|
||||
|
||||
#ifndef _SFX
|
||||
// IFolderOperationsExtractCallback
|
||||
STDMETHOD(AskWrite)(
|
||||
const wchar_t *srcPath,
|
||||
Int32 srcIsFolder,
|
||||
const FILETIME *srcTime,
|
||||
const UInt64 *srcSize,
|
||||
const wchar_t *destPathRequest,
|
||||
BSTR *destPathResult,
|
||||
Int32 *writeAnswer);
|
||||
STDMETHOD(ShowMessage)(const wchar_t *message);
|
||||
STDMETHOD(SetCurrentFilePath)(const wchar_t *filePath);
|
||||
STDMETHOD(SetNumFiles)(UInt64 numFiles);
|
||||
INTERFACE_IFolderExtractToStreamCallback(;)
|
||||
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
|
||||
#endif
|
||||
|
||||
// ICryptoGetTextPassword
|
||||
#ifndef _NO_CRYPTO
|
||||
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
|
||||
#endif
|
||||
|
||||
private:
|
||||
UString _currentArchivePath;
|
||||
bool _needWriteArchivePath;
|
||||
|
||||
UString _currentFilePath;
|
||||
bool _isFolder;
|
||||
|
||||
bool _isAltStream;
|
||||
UInt64 _curSize;
|
||||
bool _curSizeDefined;
|
||||
UString _filePath;
|
||||
// bool _extractMode;
|
||||
// bool _testMode;
|
||||
bool _newVirtFileWasAdded;
|
||||
bool _needUpdateStat;
|
||||
|
||||
|
||||
HRESULT SetCurrentFilePath2(const wchar_t *filePath);
|
||||
void AddError_Message(LPCWSTR message);
|
||||
|
||||
#ifndef _SFX
|
||||
bool _hashStreamWasUsed;
|
||||
COutStreamWithHash *_hashStreamSpec;
|
||||
CMyComPtr<ISequentialOutStream> _hashStream;
|
||||
IHashCalc *_hashCalc; // it's for stat in Test operation
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
#ifndef _SFX
|
||||
CVirtFileSystem *VirtFileSystemSpec;
|
||||
CMyComPtr<ISequentialOutStream> VirtFileSystem;
|
||||
#endif
|
||||
|
||||
bool ProcessAltStreams;
|
||||
|
||||
bool StreamMode;
|
||||
|
||||
CProgressDialog *ProgressDialog;
|
||||
#ifndef _SFX
|
||||
UInt64 NumFolders;
|
||||
UInt64 NumFiles;
|
||||
bool NeedAddFile;
|
||||
#endif
|
||||
UInt32 NumArchiveErrors;
|
||||
bool ThereAreMessageErrors;
|
||||
NExtract::NOverwriteMode::EEnum OverwriteMode;
|
||||
|
||||
#ifndef _NO_CRYPTO
|
||||
bool PasswordIsDefined;
|
||||
bool PasswordWasAsked;
|
||||
UString Password;
|
||||
#endif
|
||||
|
||||
|
||||
UString _lang_Extracting;
|
||||
UString _lang_Testing;
|
||||
UString _lang_Skipping;
|
||||
UString _lang_Empty;
|
||||
|
||||
bool _totalFilesDefined;
|
||||
bool _totalBytesDefined;
|
||||
bool MultiArcMode;
|
||||
|
||||
CExtractCallbackImp():
|
||||
#ifndef _SFX
|
||||
_hashCalc(NULL),
|
||||
#endif
|
||||
ProcessAltStreams(true),
|
||||
StreamMode(false),
|
||||
OverwriteMode(NExtract::NOverwriteMode::kAsk),
|
||||
#ifndef _NO_CRYPTO
|
||||
PasswordIsDefined(false),
|
||||
PasswordWasAsked(false),
|
||||
#endif
|
||||
_totalFilesDefined(false),
|
||||
_totalBytesDefined(false),
|
||||
MultiArcMode(false)
|
||||
{}
|
||||
|
||||
~CExtractCallbackImp();
|
||||
void Init();
|
||||
|
||||
#ifndef _SFX
|
||||
void SetHashCalc(IHashCalc *hashCalc) { _hashCalc = hashCalc; }
|
||||
|
||||
void SetHashMethods(IHashCalc *hash)
|
||||
{
|
||||
if (!hash)
|
||||
return;
|
||||
_hashStreamSpec = new COutStreamWithHash;
|
||||
_hashStream = _hashStreamSpec;
|
||||
_hashStreamSpec->_hash = hash;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool IsOK() const { return NumArchiveErrors == 0 && !ThereAreMessageErrors; }
|
||||
};
|
||||
|
||||
#endif
|
||||
28
3rdparty/lzma/CPP/7zip/UI/FileManager/FormatUtils.cpp
vendored
Normal file
28
3rdparty/lzma/CPP/7zip/UI/FileManager/FormatUtils.cpp
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// FormatUtils.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/IntToString.h"
|
||||
|
||||
#include "FormatUtils.h"
|
||||
|
||||
#include "LangUtils.h"
|
||||
|
||||
UString NumberToString(UInt64 number)
|
||||
{
|
||||
wchar_t numberString[32];
|
||||
ConvertUInt64ToString(number, numberString);
|
||||
return numberString;
|
||||
}
|
||||
|
||||
UString MyFormatNew(const UString &format, const UString &argument)
|
||||
{
|
||||
UString result = format;
|
||||
result.Replace(L"{0}", argument);
|
||||
return result;
|
||||
}
|
||||
|
||||
UString MyFormatNew(UINT resourceID, const UString &argument)
|
||||
{
|
||||
return MyFormatNew(LangString(resourceID), argument);
|
||||
}
|
||||
14
3rdparty/lzma/CPP/7zip/UI/FileManager/FormatUtils.h
vendored
Normal file
14
3rdparty/lzma/CPP/7zip/UI/FileManager/FormatUtils.h
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// FormatUtils.h
|
||||
|
||||
#ifndef __FORMAT_UTILS_H
|
||||
#define __FORMAT_UTILS_H
|
||||
|
||||
#include "../../../Common/MyTypes.h"
|
||||
#include "../../../Common/MyString.h"
|
||||
|
||||
UString NumberToString(UInt64 number);
|
||||
|
||||
UString MyFormatNew(const UString &format, const UString &argument);
|
||||
UString MyFormatNew(UINT resourceID, const UString &argument);
|
||||
|
||||
#endif
|
||||
40
3rdparty/lzma/CPP/7zip/UI/FileManager/LangUtils.h
vendored
Normal file
40
3rdparty/lzma/CPP/7zip/UI/FileManager/LangUtils.h
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// LangUtils.h
|
||||
|
||||
#ifndef __LANG_UTILS_H
|
||||
#define __LANG_UTILS_H
|
||||
|
||||
#include "../../../Windows/ResourceString.h"
|
||||
|
||||
#ifdef LANG
|
||||
|
||||
extern UString g_LangID;
|
||||
|
||||
struct CIDLangPair
|
||||
{
|
||||
UInt32 ControlID;
|
||||
UInt32 LangID;
|
||||
};
|
||||
|
||||
void ReloadLang();
|
||||
void LoadLangOneTime();
|
||||
FString GetLangDirPrefix();
|
||||
|
||||
void LangSetDlgItemText(HWND dialog, UInt32 controlID, UInt32 langID);
|
||||
void LangSetDlgItems(HWND dialog, const UInt32 *ids, unsigned numItems);
|
||||
void LangSetDlgItems_Colon(HWND dialog, const UInt32 *ids, unsigned numItems);
|
||||
void LangSetWindowText(HWND window, UInt32 langID);
|
||||
|
||||
UString LangString(UInt32 langID);
|
||||
void AddLangString(UString &s, UInt32 langID);
|
||||
void LangString(UInt32 langID, UString &dest);
|
||||
void LangString_OnlyFromLangFile(UInt32 langID, UString &dest);
|
||||
|
||||
#else
|
||||
|
||||
inline UString LangString(UInt32 langID) { return NWindows::MyLoadString(langID); }
|
||||
inline void LangString(UInt32 langID, UString &dest) { NWindows::MyLoadString(langID, dest); }
|
||||
inline void AddLangString(UString &s, UInt32 langID) { s += NWindows::MyLoadString(langID); }
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
76
3rdparty/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h
vendored
Normal file
76
3rdparty/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
// MyWindowsNew.h
|
||||
|
||||
#ifndef __MY_WINDOWS_NEW_H
|
||||
#define __MY_WINDOWS_NEW_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include <ShObjIdl.h>
|
||||
|
||||
#ifndef __ITaskbarList3_INTERFACE_DEFINED__
|
||||
#define __ITaskbarList3_INTERFACE_DEFINED__
|
||||
|
||||
typedef enum THUMBBUTTONFLAGS
|
||||
{
|
||||
THBF_ENABLED = 0,
|
||||
THBF_DISABLED = 0x1,
|
||||
THBF_DISMISSONCLICK = 0x2,
|
||||
THBF_NOBACKGROUND = 0x4,
|
||||
THBF_HIDDEN = 0x8,
|
||||
THBF_NONINTERACTIVE = 0x10
|
||||
} THUMBBUTTONFLAGS;
|
||||
|
||||
typedef enum THUMBBUTTONMASK
|
||||
{
|
||||
THB_BITMAP = 0x1,
|
||||
THB_ICON = 0x2,
|
||||
THB_TOOLTIP = 0x4,
|
||||
THB_FLAGS = 0x8
|
||||
} THUMBBUTTONMASK;
|
||||
|
||||
// #include <pshpack8.h>
|
||||
|
||||
typedef struct THUMBBUTTON
|
||||
{
|
||||
THUMBBUTTONMASK dwMask;
|
||||
UINT iId;
|
||||
UINT iBitmap;
|
||||
HICON hIcon;
|
||||
WCHAR szTip[260];
|
||||
THUMBBUTTONFLAGS dwFlags;
|
||||
} THUMBBUTTON;
|
||||
|
||||
typedef struct THUMBBUTTON *LPTHUMBBUTTON;
|
||||
|
||||
typedef enum TBPFLAG
|
||||
{
|
||||
TBPF_NOPROGRESS = 0,
|
||||
TBPF_INDETERMINATE = 0x1,
|
||||
TBPF_NORMAL = 0x2,
|
||||
TBPF_ERROR = 0x4,
|
||||
TBPF_PAUSED = 0x8
|
||||
} TBPFLAG;
|
||||
|
||||
DEFINE_GUID(IID_ITaskbarList3, 0xEA1AFB91, 0x9E28, 0x4B86, 0x90, 0xE9, 0x9E, 0x9F, 0x8A, 0x5E, 0xEF, 0xAF);
|
||||
|
||||
struct ITaskbarList3: public ITaskbarList2
|
||||
{
|
||||
STDMETHOD(SetProgressValue)(HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) = 0;
|
||||
STDMETHOD(SetProgressState)(HWND hwnd, TBPFLAG tbpFlags) = 0;
|
||||
STDMETHOD(RegisterTab)(HWND hwndTab, HWND hwndMDI) = 0;
|
||||
STDMETHOD(UnregisterTab)(HWND hwndTab) = 0;
|
||||
STDMETHOD(SetTabOrder)(HWND hwndTab, HWND hwndInsertBefore) = 0;
|
||||
STDMETHOD(SetTabActive)(HWND hwndTab, HWND hwndMDI, DWORD dwReserved) = 0;
|
||||
STDMETHOD(ThumbBarAddButtons)(HWND hwnd, UINT cButtons, LPTHUMBBUTTON pButton) = 0;
|
||||
STDMETHOD(ThumbBarUpdateButtons)(HWND hwnd, UINT cButtons, LPTHUMBBUTTON pButton) = 0;
|
||||
STDMETHOD(ThumbBarSetImageList)(HWND hwnd, HIMAGELIST himl) = 0;
|
||||
STDMETHOD(SetOverlayIcon)(HWND hwnd, HICON hIcon, LPCWSTR pszDescription) = 0;
|
||||
STDMETHOD(SetThumbnailTooltip)(HWND hwnd, LPCWSTR pszTip) = 0;
|
||||
STDMETHOD(SetThumbnailClip)(HWND hwnd, RECT *prcClip) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
138
3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
vendored
Normal file
138
3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
// OverwriteDialog.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/StringConvert.h"
|
||||
|
||||
#include "../../../Windows/PropVariantConv.h"
|
||||
#include "../../../Windows/ResourceString.h"
|
||||
|
||||
#include "../../../Windows/Control/Static.h"
|
||||
|
||||
#include "FormatUtils.h"
|
||||
#include "LangUtils.h"
|
||||
#include "OverwriteDialog.h"
|
||||
|
||||
#include "PropertyNameRes.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
#ifdef LANG
|
||||
static const UInt32 kLangIDs[] =
|
||||
{
|
||||
IDT_OVERWRITE_HEADER,
|
||||
IDT_OVERWRITE_QUESTION_BEGIN,
|
||||
IDT_OVERWRITE_QUESTION_END,
|
||||
IDB_YES_TO_ALL,
|
||||
IDB_NO_TO_ALL,
|
||||
IDB_AUTO_RENAME
|
||||
};
|
||||
#endif
|
||||
|
||||
static const unsigned kCurrentFileNameSizeLimit = 82;
|
||||
static const unsigned kCurrentFileNameSizeLimit2 = 30;
|
||||
|
||||
void COverwriteDialog::ReduceString(UString &s)
|
||||
{
|
||||
unsigned size = _isBig ? kCurrentFileNameSizeLimit : kCurrentFileNameSizeLimit2;
|
||||
if (s.Len() > size)
|
||||
{
|
||||
s.Delete(size / 2, s.Len() - size);
|
||||
s.Insert(size / 2, L" ... ");
|
||||
}
|
||||
if (!s.IsEmpty() && s.Back() == ' ')
|
||||
{
|
||||
// s += (wchar_t)(0x2423);
|
||||
s.InsertAtFront(L'\"');
|
||||
s += L'\"';
|
||||
}
|
||||
}
|
||||
|
||||
void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
|
||||
const NOverwriteDialog::CFileInfo &fileInfo)
|
||||
{
|
||||
UString sizeString;
|
||||
if (fileInfo.SizeIsDefined)
|
||||
sizeString = MyFormatNew(IDS_FILE_SIZE, NumberToString(fileInfo.Size));
|
||||
|
||||
const UString &fileName = fileInfo.Name;
|
||||
int slashPos = fileName.ReverseFind_PathSepar();
|
||||
UString s1 = fileName.Left((unsigned)(slashPos + 1));
|
||||
UString s2 = fileName.Ptr((unsigned)(slashPos + 1));
|
||||
|
||||
ReduceString(s1);
|
||||
ReduceString(s2);
|
||||
|
||||
UString s = s1;
|
||||
s.Add_LF();
|
||||
s += s2;
|
||||
s.Add_LF();
|
||||
s += sizeString;
|
||||
s.Add_LF();
|
||||
|
||||
if (fileInfo.TimeIsDefined)
|
||||
{
|
||||
AddLangString(s, IDS_PROP_MTIME);
|
||||
s += ": ";
|
||||
char t[32];
|
||||
ConvertUtcFileTimeToString(fileInfo.Time, t);
|
||||
s += t;
|
||||
}
|
||||
|
||||
NControl::CDialogChildControl control;
|
||||
control.Init(*this, textID);
|
||||
control.SetText(s);
|
||||
|
||||
SHFILEINFO shellFileInfo;
|
||||
if (::SHGetFileInfo(
|
||||
GetSystemString(fileInfo.Name), FILE_ATTRIBUTE_NORMAL, &shellFileInfo,
|
||||
sizeof(shellFileInfo), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | SHGFI_LARGEICON))
|
||||
{
|
||||
NControl::CStatic staticContol;
|
||||
staticContol.Attach(GetItem(iconID));
|
||||
staticContol.SetIcon(shellFileInfo.hIcon);
|
||||
}
|
||||
}
|
||||
|
||||
bool COverwriteDialog::OnInit()
|
||||
{
|
||||
#ifdef LANG
|
||||
LangSetWindowText(*this, IDD_OVERWRITE);
|
||||
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
|
||||
#endif
|
||||
SetFileInfoControl(IDT_OVERWRITE_OLD_FILE_SIZE_TIME, IDI_OVERWRITE_OLD_FILE, OldFileInfo);
|
||||
SetFileInfoControl(IDT_OVERWRITE_NEW_FILE_SIZE_TIME, IDI_OVERWRITE_NEW_FILE, NewFileInfo);
|
||||
NormalizePosition();
|
||||
|
||||
if (!ShowExtraButtons)
|
||||
{
|
||||
HideItem(IDB_YES_TO_ALL);
|
||||
HideItem(IDB_NO_TO_ALL);
|
||||
HideItem(IDB_AUTO_RENAME);
|
||||
}
|
||||
|
||||
if (DefaultButton_is_NO)
|
||||
{
|
||||
PostMsg(DM_SETDEFID, IDNO);
|
||||
HWND h = GetItem(IDNO);
|
||||
PostMsg(WM_NEXTDLGCTL, (WPARAM)h, TRUE);
|
||||
// ::SetFocus(h);
|
||||
}
|
||||
|
||||
return CModalDialog::OnInit();
|
||||
}
|
||||
|
||||
bool COverwriteDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
switch (buttonID)
|
||||
{
|
||||
case IDYES:
|
||||
case IDNO:
|
||||
case IDB_YES_TO_ALL:
|
||||
case IDB_NO_TO_ALL:
|
||||
case IDB_AUTO_RENAME:
|
||||
End(buttonID);
|
||||
return true;
|
||||
}
|
||||
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
|
||||
}
|
||||
79
3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h
vendored
Normal file
79
3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
// OverwriteDialog.h
|
||||
|
||||
#ifndef __OVERWRITE_DIALOG_H
|
||||
#define __OVERWRITE_DIALOG_H
|
||||
|
||||
#include "../../../Windows/Control/Dialog.h"
|
||||
|
||||
#include "DialogSize.h"
|
||||
#include "OverwriteDialogRes.h"
|
||||
|
||||
namespace NOverwriteDialog
|
||||
{
|
||||
struct CFileInfo
|
||||
{
|
||||
bool SizeIsDefined;
|
||||
bool TimeIsDefined;
|
||||
UInt64 Size;
|
||||
FILETIME Time;
|
||||
UString Name;
|
||||
|
||||
void SetTime(const FILETIME *t)
|
||||
{
|
||||
if (!t)
|
||||
TimeIsDefined = false;
|
||||
else
|
||||
{
|
||||
TimeIsDefined = true;
|
||||
Time = *t;
|
||||
}
|
||||
}
|
||||
|
||||
void SetSize(UInt64 size)
|
||||
{
|
||||
SizeIsDefined = true;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
void SetSize(const UInt64 *size)
|
||||
{
|
||||
if (!size)
|
||||
SizeIsDefined = false;
|
||||
else
|
||||
SetSize(*size);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class COverwriteDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
bool _isBig;
|
||||
|
||||
void SetFileInfoControl(int textID, int iconID, const NOverwriteDialog::CFileInfo &fileInfo);
|
||||
virtual bool OnInit();
|
||||
bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
void ReduceString(UString &s);
|
||||
|
||||
public:
|
||||
bool ShowExtraButtons;
|
||||
bool DefaultButton_is_NO;
|
||||
|
||||
|
||||
COverwriteDialog(): ShowExtraButtons(true), DefaultButton_is_NO(false) {}
|
||||
|
||||
INT_PTR Create(HWND parent = 0)
|
||||
{
|
||||
BIG_DIALOG_SIZE(280, 200);
|
||||
#ifdef UNDER_CE
|
||||
_isBig = isBig;
|
||||
#else
|
||||
_isBig = true;
|
||||
#endif
|
||||
return CModalDialog::Create(SIZED_DIALOG(IDD_OVERWRITE), parent);
|
||||
}
|
||||
|
||||
NOverwriteDialog::CFileInfo OldFileInfo;
|
||||
NOverwriteDialog::CFileInfo NewFileInfo;
|
||||
};
|
||||
|
||||
#endif
|
||||
91
3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.rc
vendored
Normal file
91
3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.rc
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
#include "OverwriteDialogRes.h"
|
||||
#include "../../GuiCommon.rc"
|
||||
|
||||
#define xc 280
|
||||
#define yc 200
|
||||
|
||||
#undef iconSize
|
||||
#define iconSize 24
|
||||
|
||||
#undef x
|
||||
#undef fx
|
||||
#undef fy
|
||||
#define x (m + iconSize + m)
|
||||
#define fx (xc - iconSize - m)
|
||||
#define fy 50
|
||||
|
||||
#define bSizeBig 104
|
||||
#undef bx1
|
||||
#define bx1 (xs - m - bSizeBig)
|
||||
|
||||
IDD_OVERWRITE DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
|
||||
CAPTION "Confirm File Replace"
|
||||
BEGIN
|
||||
LTEXT "Destination folder already contains processed file.", IDT_OVERWRITE_HEADER, m, 7, xc, 8
|
||||
LTEXT "Would you like to replace the existing file", IDT_OVERWRITE_QUESTION_BEGIN, m, 28, xc, 8
|
||||
|
||||
ICON "", IDI_OVERWRITE_OLD_FILE, m, 44, iconSize, iconSize
|
||||
LTEXT "", IDT_OVERWRITE_OLD_FILE_SIZE_TIME, x, 44, fx, fy, SS_NOPREFIX
|
||||
|
||||
LTEXT "with this one?", IDT_OVERWRITE_QUESTION_END, m, 98, xc, 8
|
||||
|
||||
ICON "", IDI_OVERWRITE_NEW_FILE, m, 114, iconSize, iconSize
|
||||
LTEXT "", IDT_OVERWRITE_NEW_FILE_SIZE_TIME, x, 114, fx, fy, SS_NOPREFIX
|
||||
|
||||
PUSHBUTTON "&Yes", IDYES, bx3, by2, bxs, bys
|
||||
PUSHBUTTON "Yes to &All", IDB_YES_TO_ALL, bx2, by2, bxs, bys
|
||||
PUSHBUTTON "A&uto Rename", IDB_AUTO_RENAME, bx1, by2, bSizeBig, bys
|
||||
PUSHBUTTON "&No", IDNO, bx3, by1, bxs, bys
|
||||
PUSHBUTTON "No to A&ll", IDB_NO_TO_ALL, bx2, by1, bxs, bys
|
||||
PUSHBUTTON "&Cancel", IDCANCEL, xs - m - bxs, by1, bxs, bys
|
||||
END
|
||||
|
||||
|
||||
#ifdef UNDER_CE
|
||||
|
||||
#undef m
|
||||
#undef xc
|
||||
#undef yc
|
||||
|
||||
#define m 4
|
||||
#define xc 152
|
||||
#define yc 144
|
||||
|
||||
#undef fy
|
||||
#define fy 40
|
||||
|
||||
#undef bxs
|
||||
#define bxs 48
|
||||
|
||||
#undef bx1
|
||||
|
||||
#define bx1 (xs - m - bxs)
|
||||
|
||||
IDD_OVERWRITE_2 DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
|
||||
CAPTION "Confirm File Replace"
|
||||
BEGIN
|
||||
LTEXT "Would you like to replace the existing file", IDT_OVERWRITE_QUESTION_BEGIN, m, m, xc, 8
|
||||
|
||||
ICON "", IDI_OVERWRITE_OLD_FILE, m, 20, iconSize, iconSize
|
||||
LTEXT "", IDT_OVERWRITE_OLD_FILE_SIZE_TIME, x, 20, fx, fy, SS_NOPREFIX
|
||||
|
||||
LTEXT "with this one?", IDT_OVERWRITE_QUESTION_END, m, 60, xc, 8
|
||||
|
||||
ICON "", IDI_OVERWRITE_NEW_FILE, m, 72, iconSize, iconSize
|
||||
LTEXT "", IDT_OVERWRITE_NEW_FILE_SIZE_TIME, x, 72, fx, fy, SS_NOPREFIX
|
||||
|
||||
PUSHBUTTON "&Yes", IDYES, bx3, by2, bxs, bys
|
||||
PUSHBUTTON "Yes to &All", IDB_YES_TO_ALL, bx2, by2, bxs, bys
|
||||
PUSHBUTTON "A&uto Rename", IDB_AUTO_RENAME, bx1, by2, bxs, bys
|
||||
PUSHBUTTON "&No", IDNO, bx3, by1, bxs, bys
|
||||
PUSHBUTTON "No to A&ll", IDB_NO_TO_ALL, bx2, by1, bxs, bys
|
||||
PUSHBUTTON "&Cancel", IDCANCEL, bx1, by1, bxs, bys
|
||||
END
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_FILE_SIZE "{0} bytes"
|
||||
END
|
||||
17
3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialogRes.h
vendored
Normal file
17
3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialogRes.h
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
#define IDD_OVERWRITE 3500
|
||||
#define IDD_OVERWRITE_2 13500
|
||||
|
||||
#define IDT_OVERWRITE_HEADER 3501
|
||||
#define IDT_OVERWRITE_QUESTION_BEGIN 3502
|
||||
#define IDT_OVERWRITE_QUESTION_END 3503
|
||||
#define IDS_FILE_SIZE 3504
|
||||
|
||||
#define IDB_AUTO_RENAME 3505
|
||||
#define IDB_YES_TO_ALL 440
|
||||
#define IDB_NO_TO_ALL 441
|
||||
|
||||
#define IDI_OVERWRITE_OLD_FILE 100
|
||||
#define IDI_OVERWRITE_NEW_FILE 101
|
||||
|
||||
#define IDT_OVERWRITE_OLD_FILE_SIZE_TIME 102
|
||||
#define IDT_OVERWRITE_NEW_FILE_SIZE_TIME 103
|
||||
58
3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp
vendored
Normal file
58
3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// PasswordDialog.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "PasswordDialog.h"
|
||||
|
||||
#ifdef LANG
|
||||
#include "LangUtils.h"
|
||||
#endif
|
||||
|
||||
#ifdef LANG
|
||||
static const UInt32 kLangIDs[] =
|
||||
{
|
||||
IDT_PASSWORD_ENTER,
|
||||
IDX_PASSWORD_SHOW
|
||||
};
|
||||
#endif
|
||||
|
||||
void CPasswordDialog::ReadControls()
|
||||
{
|
||||
_passwordEdit.GetText(Password);
|
||||
ShowPassword = IsButtonCheckedBool(IDX_PASSWORD_SHOW);
|
||||
}
|
||||
|
||||
void CPasswordDialog::SetTextSpec()
|
||||
{
|
||||
_passwordEdit.SetPasswordChar(ShowPassword ? 0: TEXT('*'));
|
||||
_passwordEdit.SetText(Password);
|
||||
}
|
||||
|
||||
bool CPasswordDialog::OnInit()
|
||||
{
|
||||
#ifdef LANG
|
||||
LangSetWindowText(*this, IDD_PASSWORD);
|
||||
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
|
||||
#endif
|
||||
_passwordEdit.Attach(GetItem(IDE_PASSWORD_PASSWORD));
|
||||
CheckButton(IDX_PASSWORD_SHOW, ShowPassword);
|
||||
SetTextSpec();
|
||||
return CModalDialog::OnInit();
|
||||
}
|
||||
|
||||
bool CPasswordDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
if (buttonID == IDX_PASSWORD_SHOW)
|
||||
{
|
||||
ReadControls();
|
||||
SetTextSpec();
|
||||
return true;
|
||||
}
|
||||
return CDialog::OnButtonClicked(buttonID, buttonHWND);
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnOK()
|
||||
{
|
||||
ReadControls();
|
||||
CModalDialog::OnOK();
|
||||
}
|
||||
28
3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h
vendored
Normal file
28
3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// PasswordDialog.h
|
||||
|
||||
#ifndef __PASSWORD_DIALOG_H
|
||||
#define __PASSWORD_DIALOG_H
|
||||
|
||||
#include "../../../Windows/Control/Dialog.h"
|
||||
#include "../../../Windows/Control/Edit.h"
|
||||
|
||||
#include "PasswordDialogRes.h"
|
||||
|
||||
class CPasswordDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
NWindows::NControl::CEdit _passwordEdit;
|
||||
|
||||
virtual void OnOK();
|
||||
virtual bool OnInit();
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
void SetTextSpec();
|
||||
void ReadControls();
|
||||
public:
|
||||
UString Password;
|
||||
bool ShowPassword;
|
||||
|
||||
CPasswordDialog(): ShowPassword(false) {}
|
||||
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_PASSWORD, parentWindow); }
|
||||
};
|
||||
|
||||
#endif
|
||||
14
3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.rc
vendored
Normal file
14
3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.rc
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "PasswordDialogRes.h"
|
||||
#include "../../GuiCommon.rc"
|
||||
|
||||
#define xc 140
|
||||
#define yc 72
|
||||
|
||||
IDD_PASSWORD DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
|
||||
CAPTION "Enter password"
|
||||
BEGIN
|
||||
LTEXT "&Enter password:", IDT_PASSWORD_ENTER, m, m, xc, 8
|
||||
EDITTEXT IDE_PASSWORD_PASSWORD, m, 20, xc, 14, ES_PASSWORD | ES_AUTOHSCROLL
|
||||
CONTROL "&Show password", IDX_PASSWORD_SHOW, MY_CHECKBOX, m, 42, xc, 10
|
||||
OK_CANCEL
|
||||
END
|
||||
5
3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialogRes.h
vendored
Normal file
5
3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialogRes.h
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#define IDD_PASSWORD 3800
|
||||
#define IDT_PASSWORD_ENTER 3801
|
||||
#define IDX_PASSWORD_SHOW 3803
|
||||
|
||||
#define IDE_PASSWORD_PASSWORD 120
|
||||
199
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp
vendored
Normal file
199
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
// ProgressDialog.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/IntToString.h"
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "ProgressDialog.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
|
||||
static const UINT_PTR kTimerID = 3;
|
||||
static const UINT kTimerElapse = 100;
|
||||
|
||||
#ifdef LANG
|
||||
#include "LangUtils.h"
|
||||
#endif
|
||||
|
||||
HRESULT CProgressSync::ProcessStopAndPause()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (GetStopped())
|
||||
return E_ABORT;
|
||||
if (!GetPaused())
|
||||
break;
|
||||
::Sleep(100);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifndef _SFX
|
||||
CProgressDialog::~CProgressDialog()
|
||||
{
|
||||
AddToTitle(L"");
|
||||
}
|
||||
void CProgressDialog::AddToTitle(LPCWSTR s)
|
||||
{
|
||||
if (MainWindow != 0)
|
||||
MySetWindowText(MainWindow, UString(s) + MainTitle);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool CProgressDialog::OnInit()
|
||||
{
|
||||
_range = (UInt64)(Int64)-1;
|
||||
_prevPercentValue = -1;
|
||||
|
||||
_wasCreated = true;
|
||||
_dialogCreatedEvent.Set();
|
||||
|
||||
#ifdef LANG
|
||||
LangSetDlgItems(*this, NULL, 0);
|
||||
#endif
|
||||
|
||||
m_ProgressBar.Attach(GetItem(IDC_PROGRESS1));
|
||||
|
||||
if (IconID >= 0)
|
||||
{
|
||||
HICON icon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IconID));
|
||||
SetIcon(ICON_BIG, icon);
|
||||
}
|
||||
|
||||
_timer = SetTimer(kTimerID, kTimerElapse);
|
||||
SetText(_title);
|
||||
CheckNeedClose();
|
||||
return CModalDialog::OnInit();
|
||||
}
|
||||
|
||||
void CProgressDialog::OnCancel() { Sync.SetStopped(true); }
|
||||
void CProgressDialog::OnOK() { }
|
||||
|
||||
void CProgressDialog::SetRange(UInt64 range)
|
||||
{
|
||||
_range = range;
|
||||
_peviousPos = (UInt64)(Int64)-1;
|
||||
_converter.Init(range);
|
||||
m_ProgressBar.SetRange32(0 , _converter.Count(range)); // Test it for 100%
|
||||
}
|
||||
|
||||
void CProgressDialog::SetPos(UInt64 pos)
|
||||
{
|
||||
bool redraw = true;
|
||||
if (pos < _range && pos > _peviousPos)
|
||||
{
|
||||
UInt64 posDelta = pos - _peviousPos;
|
||||
if (posDelta < (_range >> 10))
|
||||
redraw = false;
|
||||
}
|
||||
if (redraw)
|
||||
{
|
||||
m_ProgressBar.SetPos(_converter.Count(pos)); // Test it for 100%
|
||||
_peviousPos = pos;
|
||||
}
|
||||
}
|
||||
|
||||
bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
|
||||
{
|
||||
if (Sync.GetPaused())
|
||||
return true;
|
||||
|
||||
CheckNeedClose();
|
||||
|
||||
UInt64 total, completed;
|
||||
Sync.GetProgress(total, completed);
|
||||
if (total != _range)
|
||||
SetRange(total);
|
||||
SetPos(completed);
|
||||
|
||||
if (total == 0)
|
||||
total = 1;
|
||||
|
||||
int percentValue = (int)(completed * 100 / total);
|
||||
if (percentValue != _prevPercentValue)
|
||||
{
|
||||
wchar_t s[64];
|
||||
ConvertUInt64ToString(percentValue, s);
|
||||
UString title = s;
|
||||
title += "% ";
|
||||
SetText(title + _title);
|
||||
#ifndef _SFX
|
||||
AddToTitle(title + MainAddTitle);
|
||||
#endif
|
||||
_prevPercentValue = percentValue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case kCloseMessage:
|
||||
{
|
||||
if (_timer)
|
||||
{
|
||||
KillTimer(kTimerID);
|
||||
_timer = 0;
|
||||
}
|
||||
if (_inCancelMessageBox)
|
||||
{
|
||||
_externalCloseMessageWasReceived = true;
|
||||
break;
|
||||
}
|
||||
return OnExternalCloseMessage();
|
||||
}
|
||||
/*
|
||||
case WM_SETTEXT:
|
||||
{
|
||||
if (_timer == 0)
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
return CModalDialog::OnMessage(message, wParam, lParam);
|
||||
}
|
||||
|
||||
bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
|
||||
{
|
||||
switch (buttonID)
|
||||
{
|
||||
case IDCANCEL:
|
||||
{
|
||||
bool paused = Sync.GetPaused();
|
||||
Sync.SetPaused(true);
|
||||
_inCancelMessageBox = true;
|
||||
int res = ::MessageBoxW(*this, L"Are you sure you want to cancel?", _title, MB_YESNOCANCEL);
|
||||
_inCancelMessageBox = false;
|
||||
Sync.SetPaused(paused);
|
||||
if (res == IDCANCEL || res == IDNO)
|
||||
{
|
||||
if (_externalCloseMessageWasReceived)
|
||||
OnExternalCloseMessage();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
|
||||
}
|
||||
|
||||
void CProgressDialog::CheckNeedClose()
|
||||
{
|
||||
if (_needClose)
|
||||
{
|
||||
PostMsg(kCloseMessage);
|
||||
_needClose = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CProgressDialog::OnExternalCloseMessage()
|
||||
{
|
||||
End(0);
|
||||
return true;
|
||||
}
|
||||
170
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h
vendored
Normal file
170
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
// ProgressDialog.h
|
||||
|
||||
#ifndef __PROGRESS_DIALOG_H
|
||||
#define __PROGRESS_DIALOG_H
|
||||
|
||||
#include "../../../Windows/Synchronization.h"
|
||||
#include "../../../Windows/Thread.h"
|
||||
|
||||
#include "../../../Windows/Control/Dialog.h"
|
||||
#include "../../../Windows/Control/ProgressBar.h"
|
||||
|
||||
#include "ProgressDialogRes.h"
|
||||
|
||||
class CProgressSync
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSection _cs;
|
||||
bool _stopped;
|
||||
bool _paused;
|
||||
UInt64 _total;
|
||||
UInt64 _completed;
|
||||
public:
|
||||
CProgressSync(): _stopped(false), _paused(false), _total(1), _completed(0) {}
|
||||
|
||||
HRESULT ProcessStopAndPause();
|
||||
bool GetStopped()
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
return _stopped;
|
||||
}
|
||||
void SetStopped(bool value)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
_stopped = value;
|
||||
}
|
||||
bool GetPaused()
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
return _paused;
|
||||
}
|
||||
void SetPaused(bool value)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
_paused = value;
|
||||
}
|
||||
void SetProgress(UInt64 total, UInt64 completed)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
_total = total;
|
||||
_completed = completed;
|
||||
}
|
||||
void SetPos(UInt64 completed)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
_completed = completed;
|
||||
}
|
||||
void GetProgress(UInt64 &total, UInt64 &completed)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
total = _total;
|
||||
completed = _completed;
|
||||
}
|
||||
};
|
||||
|
||||
class CU64ToI32Converter
|
||||
{
|
||||
UInt64 _numShiftBits;
|
||||
public:
|
||||
void Init(UInt64 range)
|
||||
{
|
||||
// Windows CE doesn't like big number here.
|
||||
for (_numShiftBits = 0; range > (1 << 15); _numShiftBits++)
|
||||
range >>= 1;
|
||||
}
|
||||
int Count(UInt64 value) { return int(value >> _numShiftBits); }
|
||||
};
|
||||
|
||||
class CProgressDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
private:
|
||||
UINT_PTR _timer;
|
||||
|
||||
UString _title;
|
||||
CU64ToI32Converter _converter;
|
||||
UInt64 _peviousPos;
|
||||
UInt64 _range;
|
||||
NWindows::NControl::CProgressBar m_ProgressBar;
|
||||
|
||||
int _prevPercentValue;
|
||||
|
||||
bool _wasCreated;
|
||||
bool _needClose;
|
||||
bool _inCancelMessageBox;
|
||||
bool _externalCloseMessageWasReceived;
|
||||
|
||||
bool OnTimer(WPARAM timerID, LPARAM callback);
|
||||
void SetRange(UInt64 range);
|
||||
void SetPos(UInt64 pos);
|
||||
virtual bool OnInit();
|
||||
virtual void OnCancel();
|
||||
virtual void OnOK();
|
||||
NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
|
||||
#ifndef _SFX
|
||||
void AddToTitle(LPCWSTR string);
|
||||
#endif
|
||||
bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
|
||||
void WaitCreating() { _dialogCreatedEvent.Lock(); }
|
||||
void CheckNeedClose();
|
||||
bool OnExternalCloseMessage();
|
||||
public:
|
||||
CProgressSync Sync;
|
||||
int IconID;
|
||||
|
||||
#ifndef _SFX
|
||||
HWND MainWindow;
|
||||
UString MainTitle;
|
||||
UString MainAddTitle;
|
||||
~CProgressDialog();
|
||||
#endif
|
||||
|
||||
CProgressDialog(): _timer(0)
|
||||
#ifndef _SFX
|
||||
,MainWindow(0)
|
||||
#endif
|
||||
{
|
||||
IconID = -1;
|
||||
_wasCreated = false;
|
||||
_needClose = false;
|
||||
_inCancelMessageBox = false;
|
||||
_externalCloseMessageWasReceived = false;
|
||||
|
||||
if (_dialogCreatedEvent.Create() != S_OK)
|
||||
throw 1334987;
|
||||
}
|
||||
|
||||
INT_PTR Create(const UString &title, NWindows::CThread &thread, HWND wndParent = 0)
|
||||
{
|
||||
_title = title;
|
||||
INT_PTR res = CModalDialog::Create(IDD_PROGRESS, wndParent);
|
||||
thread.Wait_Close();
|
||||
return res;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
kCloseMessage = WM_APP + 1
|
||||
};
|
||||
|
||||
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void ProcessWasFinished()
|
||||
{
|
||||
WaitCreating();
|
||||
if (_wasCreated)
|
||||
PostMsg(kCloseMessage);
|
||||
else
|
||||
_needClose = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class CProgressCloser
|
||||
{
|
||||
CProgressDialog *_p;
|
||||
public:
|
||||
CProgressCloser(CProgressDialog &p) : _p(&p) {}
|
||||
~CProgressCloser() { _p->ProcessWasFinished(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
12
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.rc
vendored
Normal file
12
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.rc
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "ProgressDialogRes.h"
|
||||
#include "../../GuiCommon.rc"
|
||||
|
||||
#define xc 172
|
||||
#define yc 44
|
||||
|
||||
IDD_PROGRESS DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
|
||||
CAPTION "Progress"
|
||||
BEGIN
|
||||
PUSHBUTTON "Cancel", IDCANCEL, bx, by, bxs, bys
|
||||
CONTROL "Progress1", IDC_PROGRESS1, "msctls_progress32", PBS_SMOOTH | WS_BORDER, m, m, xc, 14
|
||||
END
|
||||
1355
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
vendored
Normal file
1355
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
353
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h
vendored
Normal file
353
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h
vendored
Normal file
@@ -0,0 +1,353 @@
|
||||
// ProgressDialog2.h
|
||||
|
||||
#ifndef __PROGRESS_DIALOG_2_H
|
||||
#define __PROGRESS_DIALOG_2_H
|
||||
|
||||
#include "../../../Common/MyCom.h"
|
||||
|
||||
#include "../../../Windows/ErrorMsg.h"
|
||||
#include "../../../Windows/Synchronization.h"
|
||||
#include "../../../Windows/Thread.h"
|
||||
|
||||
#include "../../../Windows/Control/Dialog.h"
|
||||
#include "../../../Windows/Control/ListView.h"
|
||||
#include "../../../Windows/Control/ProgressBar.h"
|
||||
|
||||
#include "MyWindowsNew.h"
|
||||
|
||||
struct CProgressMessageBoxPair
|
||||
{
|
||||
UString Title;
|
||||
UString Message;
|
||||
};
|
||||
|
||||
struct CProgressFinalMessage
|
||||
{
|
||||
CProgressMessageBoxPair ErrorMessage;
|
||||
CProgressMessageBoxPair OkMessage;
|
||||
|
||||
bool ThereIsMessage() const { return !ErrorMessage.Message.IsEmpty() || !OkMessage.Message.IsEmpty(); }
|
||||
};
|
||||
|
||||
class CProgressSync
|
||||
{
|
||||
bool _stopped;
|
||||
bool _paused;
|
||||
|
||||
public:
|
||||
bool _bytesProgressMode;
|
||||
UInt64 _totalBytes;
|
||||
UInt64 _completedBytes;
|
||||
UInt64 _totalFiles;
|
||||
UInt64 _curFiles;
|
||||
UInt64 _inSize;
|
||||
UInt64 _outSize;
|
||||
|
||||
UString _titleFileName;
|
||||
UString _status;
|
||||
UString _filePath;
|
||||
bool _isDir;
|
||||
|
||||
UStringVector Messages;
|
||||
CProgressFinalMessage FinalMessage;
|
||||
|
||||
NWindows::NSynchronization::CCriticalSection _cs;
|
||||
|
||||
CProgressSync();
|
||||
|
||||
bool Get_Stopped()
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
return _stopped;
|
||||
}
|
||||
void Set_Stopped(bool val)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
_stopped = val;
|
||||
}
|
||||
|
||||
bool Get_Paused();
|
||||
void Set_Paused(bool val)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
_paused = val;
|
||||
}
|
||||
|
||||
void Set_BytesProgressMode(bool bytesProgressMode)
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
|
||||
_bytesProgressMode = bytesProgressMode;
|
||||
}
|
||||
|
||||
HRESULT CheckStop();
|
||||
HRESULT ScanProgress(UInt64 numFiles, UInt64 totalSize, const FString &fileName, bool isDir = false);
|
||||
|
||||
HRESULT Set_NumFilesTotal(UInt64 val);
|
||||
void Set_NumBytesTotal(UInt64 val);
|
||||
void Set_NumFilesCur(UInt64 val);
|
||||
HRESULT Set_NumBytesCur(const UInt64 *val);
|
||||
HRESULT Set_NumBytesCur(UInt64 val);
|
||||
void Set_Ratio(const UInt64 *inSize, const UInt64 *outSize);
|
||||
|
||||
void Set_TitleFileName(const UString &fileName);
|
||||
void Set_Status(const UString &s);
|
||||
HRESULT Set_Status2(const UString &s, const wchar_t *path, bool isDir = false);
|
||||
void Set_FilePath(const wchar_t *path, bool isDir = false);
|
||||
|
||||
void AddError_Message(const wchar_t *message);
|
||||
void AddError_Message_Name(const wchar_t *message, const wchar_t *name);
|
||||
void AddError_Code_Name(DWORD systemError, const wchar_t *name);
|
||||
|
||||
bool ThereIsMessage() const { return !Messages.IsEmpty() || FinalMessage.ThereIsMessage(); }
|
||||
};
|
||||
|
||||
class CProgressDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
UString _titleFileName;
|
||||
UString _filePath;
|
||||
UString _status;
|
||||
bool _isDir;
|
||||
|
||||
UString _background_String;
|
||||
UString _backgrounded_String;
|
||||
UString _foreground_String;
|
||||
UString _pause_String;
|
||||
UString _continue_String;
|
||||
UString _paused_String;
|
||||
|
||||
int _buttonSizeX;
|
||||
int _buttonSizeY;
|
||||
|
||||
UINT_PTR _timer;
|
||||
|
||||
UString _title;
|
||||
|
||||
class CU64ToI32Converter
|
||||
{
|
||||
unsigned _numShiftBits;
|
||||
UInt64 _range;
|
||||
public:
|
||||
CU64ToI32Converter(): _numShiftBits(0), _range(1) {}
|
||||
void Init(UInt64 range)
|
||||
{
|
||||
_range = range;
|
||||
// Windows CE doesn't like big number for ProgressBar.
|
||||
for (_numShiftBits = 0; range >= ((UInt32)1 << 15); _numShiftBits++)
|
||||
range >>= 1;
|
||||
}
|
||||
int Count(UInt64 val)
|
||||
{
|
||||
int res = (int)(val >> _numShiftBits);
|
||||
if (val == _range)
|
||||
res++;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
CU64ToI32Converter _progressConv;
|
||||
UInt64 _progressBar_Pos;
|
||||
UInt64 _progressBar_Range;
|
||||
|
||||
NWindows::NControl::CProgressBar m_ProgressBar;
|
||||
NWindows::NControl::CListView _messageList;
|
||||
|
||||
int _numMessages;
|
||||
|
||||
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
|
||||
CMyComPtr<ITaskbarList3> _taskbarList;
|
||||
#endif
|
||||
HWND _hwndForTaskbar;
|
||||
|
||||
UInt32 _prevTime;
|
||||
UInt64 _elapsedTime;
|
||||
|
||||
UInt64 _prevPercentValue;
|
||||
UInt64 _prevElapsedSec;
|
||||
UInt64 _prevRemainingSec;
|
||||
|
||||
UInt64 _totalBytes_Prev;
|
||||
UInt64 _processed_Prev;
|
||||
UInt64 _packed_Prev;
|
||||
UInt64 _ratio_Prev;
|
||||
|
||||
UString _filesStr_Prev;
|
||||
UString _filesTotStr_Prev;
|
||||
|
||||
unsigned _prevSpeed_MoveBits;
|
||||
UInt64 _prevSpeed;
|
||||
|
||||
bool _foreground;
|
||||
|
||||
unsigned _numReduceSymbols;
|
||||
|
||||
bool _wasCreated;
|
||||
bool _needClose;
|
||||
|
||||
unsigned _numPostedMessages;
|
||||
UInt32 _numAutoSizeMessages;
|
||||
|
||||
bool _errorsWereDisplayed;
|
||||
|
||||
bool _waitCloseByCancelButton;
|
||||
bool _cancelWasPressed;
|
||||
|
||||
bool _inCancelMessageBox;
|
||||
bool _externalCloseMessageWasReceived;
|
||||
|
||||
|
||||
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
|
||||
void SetTaskbarProgressState(TBPFLAG tbpFlags)
|
||||
{
|
||||
if (_taskbarList && _hwndForTaskbar)
|
||||
_taskbarList->SetProgressState(_hwndForTaskbar, tbpFlags);
|
||||
}
|
||||
#endif
|
||||
void SetTaskbarProgressState();
|
||||
|
||||
void UpdateStatInfo(bool showAll);
|
||||
bool OnTimer(WPARAM timerID, LPARAM callback);
|
||||
void SetProgressRange(UInt64 range);
|
||||
void SetProgressPos(UInt64 pos);
|
||||
virtual bool OnInit();
|
||||
virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
|
||||
virtual void OnCancel();
|
||||
virtual void OnOK();
|
||||
NWindows::NSynchronization::CManualResetEvent _createDialogEvent;
|
||||
NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
|
||||
#ifndef _SFX
|
||||
void AddToTitle(LPCWSTR string);
|
||||
#endif
|
||||
|
||||
void SetPauseText();
|
||||
void SetPriorityText();
|
||||
void OnPauseButton();
|
||||
void OnPriorityButton();
|
||||
bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void SetTitleText();
|
||||
void ShowSize(int id, UInt64 val, UInt64 &prev);
|
||||
|
||||
void UpdateMessagesDialog();
|
||||
|
||||
void AddMessageDirect(LPCWSTR message, bool needNumber);
|
||||
void AddMessage(LPCWSTR message);
|
||||
|
||||
bool OnExternalCloseMessage();
|
||||
void EnableErrorsControls(bool enable);
|
||||
|
||||
void ShowAfterMessages(HWND wndParent);
|
||||
|
||||
void CheckNeedClose();
|
||||
public:
|
||||
CProgressSync Sync;
|
||||
bool CompressingMode;
|
||||
bool WaitMode;
|
||||
bool ShowCompressionInfo;
|
||||
bool MessagesDisplayed; // = true if user pressed OK on all messages or there are no messages.
|
||||
int IconID;
|
||||
|
||||
HWND MainWindow;
|
||||
#ifndef _SFX
|
||||
UString MainTitle;
|
||||
UString MainAddTitle;
|
||||
~CProgressDialog();
|
||||
#endif
|
||||
|
||||
CProgressDialog();
|
||||
void WaitCreating()
|
||||
{
|
||||
_createDialogEvent.Set();
|
||||
_dialogCreatedEvent.Lock();
|
||||
}
|
||||
|
||||
INT_PTR Create(const UString &title, NWindows::CThread &thread, HWND wndParent = 0);
|
||||
|
||||
|
||||
/* how it works:
|
||||
1) the working thread calls ProcessWasFinished()
|
||||
that sends kCloseMessage message to CProgressDialog (GUI) thread
|
||||
2) CProgressDialog (GUI) thread receives kCloseMessage message and
|
||||
calls ProcessWasFinished_GuiVirt();
|
||||
So we can implement ProcessWasFinished_GuiVirt() and show special
|
||||
results window in GUI thread with CProgressDialog as parent window
|
||||
*/
|
||||
|
||||
void ProcessWasFinished();
|
||||
virtual void ProcessWasFinished_GuiVirt() {}
|
||||
};
|
||||
|
||||
|
||||
class CProgressCloser
|
||||
{
|
||||
CProgressDialog *_p;
|
||||
public:
|
||||
CProgressCloser(CProgressDialog &p) : _p(&p) {}
|
||||
~CProgressCloser() { _p->ProcessWasFinished(); }
|
||||
};
|
||||
|
||||
|
||||
class CProgressThreadVirt: public CProgressDialog
|
||||
{
|
||||
protected:
|
||||
FStringVector ErrorPaths;
|
||||
CProgressFinalMessage FinalMessage;
|
||||
|
||||
// error if any of HRESULT, ErrorMessage, ErrorPath
|
||||
virtual HRESULT ProcessVirt() = 0;
|
||||
public:
|
||||
HRESULT Result;
|
||||
bool ThreadFinishedOK; // if there is no fatal exception
|
||||
|
||||
void Process();
|
||||
void AddErrorPath(const FString &path) { ErrorPaths.Add(path); }
|
||||
|
||||
HRESULT Create(const UString &title, HWND parentWindow = 0);
|
||||
CProgressThreadVirt(): Result(E_FAIL), ThreadFinishedOK(false) {}
|
||||
|
||||
CProgressMessageBoxPair &GetMessagePair(bool isError) { return isError ? FinalMessage.ErrorMessage : FinalMessage.OkMessage; }
|
||||
};
|
||||
|
||||
UString HResultToMessage(HRESULT errorCode);
|
||||
|
||||
/*
|
||||
how it works:
|
||||
|
||||
client code inherits CProgressThreadVirt and calls
|
||||
CProgressThreadVirt::Create()
|
||||
{
|
||||
it creates new thread that calls CProgressThreadVirt::Process();
|
||||
it creates modal progress dialog window with ProgressDialog.Create()
|
||||
}
|
||||
|
||||
CProgressThreadVirt::Process()
|
||||
{
|
||||
{
|
||||
Result = ProcessVirt(); // virtual function that must implement real work
|
||||
}
|
||||
if (exceptions) or FinalMessage.ErrorMessage.Message
|
||||
{
|
||||
set message to ProgressDialog.Sync.FinalMessage.ErrorMessage.Message
|
||||
}
|
||||
else if (FinalMessage.OkMessage.Message)
|
||||
{
|
||||
set message to ProgressDialog.Sync.FinalMessage.OkMessage
|
||||
}
|
||||
|
||||
PostMsg(kCloseMessage);
|
||||
}
|
||||
|
||||
|
||||
CProgressDialog::OnExternalCloseMessage()
|
||||
{
|
||||
if (ProgressDialog.Sync.FinalMessage)
|
||||
{
|
||||
WorkWasFinishedVirt();
|
||||
Show (ProgressDialog.Sync.FinalMessage)
|
||||
MessagesDisplayed = true;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
#endif
|
||||
40
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.rc
vendored
Normal file
40
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.rc
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "ProgressDialog2Res.h"
|
||||
#include "../../GuiCommon.rc"
|
||||
|
||||
#undef DIALOG_ID
|
||||
#define DIALOG_ID IDD_PROGRESS
|
||||
#define xc 360
|
||||
#define k 11
|
||||
#define z1s 16
|
||||
|
||||
#include "ProgressDialog2a.rc"
|
||||
|
||||
#ifdef UNDER_CE
|
||||
|
||||
#include "../../GuiCommon.rc"
|
||||
|
||||
|
||||
#undef DIALOG_ID
|
||||
#undef m
|
||||
#undef k
|
||||
#undef z1s
|
||||
|
||||
#define DIALOG_ID IDD_PROGRESS_2
|
||||
#define m 4
|
||||
#define k 8
|
||||
#define z1s 12
|
||||
|
||||
#define xc 280
|
||||
|
||||
#include "ProgressDialog2a.rc"
|
||||
|
||||
#endif
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
{
|
||||
IDS_PROGRESS_PAUSED "Paused"
|
||||
IDS_PROGRESS_FOREGROUND "&Foreground"
|
||||
IDS_CONTINUE "&Continue"
|
||||
IDS_PROGRESS_ASK_CANCEL "Are you sure you want to cancel?"
|
||||
IDS_CLOSE "&Close"
|
||||
}
|
||||
49
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h
vendored
Normal file
49
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
#define IDD_PROGRESS 97
|
||||
#define IDD_PROGRESS_2 10097
|
||||
|
||||
#define IDS_CLOSE 408
|
||||
#define IDS_CONTINUE 411
|
||||
|
||||
#define IDB_PROGRESS_BACKGROUND 444
|
||||
#define IDS_PROGRESS_FOREGROUND 445
|
||||
#define IDB_PAUSE 446
|
||||
#define IDS_PROGRESS_PAUSED 447
|
||||
#define IDS_PROGRESS_ASK_CANCEL 448
|
||||
|
||||
#define IDT_PROGRESS_PACKED 1008
|
||||
#define IDT_PROGRESS_FILES 1032
|
||||
|
||||
#define IDT_PROGRESS_ELAPSED 3900
|
||||
#define IDT_PROGRESS_REMAINING 3901
|
||||
#define IDT_PROGRESS_TOTAL 3902
|
||||
#define IDT_PROGRESS_SPEED 3903
|
||||
#define IDT_PROGRESS_PROCESSED 3904
|
||||
#define IDT_PROGRESS_RATIO 3905
|
||||
#define IDT_PROGRESS_ERRORS 3906
|
||||
|
||||
#define IDC_PROGRESS1 100
|
||||
#define IDL_PROGRESS_MESSAGES 101
|
||||
#define IDT_PROGRESS_FILE_NAME 102
|
||||
#define IDT_PROGRESS_STATUS 103
|
||||
|
||||
#define IDT_PROGRESS_PACKED_VAL 110
|
||||
#define IDT_PROGRESS_FILES_VAL 111
|
||||
#define IDT_PROGRESS_FILES_TOTAL 112
|
||||
|
||||
#define IDT_PROGRESS_ELAPSED_VAL 120
|
||||
#define IDT_PROGRESS_REMAINING_VAL 121
|
||||
#define IDT_PROGRESS_TOTAL_VAL 122
|
||||
#define IDT_PROGRESS_SPEED_VAL 123
|
||||
#define IDT_PROGRESS_PROCESSED_VAL 124
|
||||
#define IDT_PROGRESS_RATIO_VAL 125
|
||||
#define IDT_PROGRESS_ERRORS_VAL 126
|
||||
|
||||
|
||||
#ifdef UNDER_CE
|
||||
#define MY_PROGRESS_VAL_UNITS 44
|
||||
#else
|
||||
#define MY_PROGRESS_VAL_UNITS 72
|
||||
#endif
|
||||
#define MY_PROGRESS_LABEL_UNITS_MIN 60
|
||||
#define MY_PROGRESS_LABEL_UNITS_START 90
|
||||
#define MY_PROGRESS_PAD_UNITS 4
|
||||
85
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc
vendored
Normal file
85
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
#undef bxs
|
||||
#define bxs 80
|
||||
|
||||
#define x0s MY_PROGRESS_LABEL_UNITS_START
|
||||
#define x1s MY_PROGRESS_VAL_UNITS
|
||||
#define x2s MY_PROGRESS_LABEL_UNITS_START
|
||||
#define x3s MY_PROGRESS_VAL_UNITS
|
||||
|
||||
#define x1 (m + x0s)
|
||||
#define x3 (xs - m - x3s)
|
||||
#define x2 (x3 - x2s)
|
||||
|
||||
#undef y0
|
||||
#undef y1
|
||||
#undef y2
|
||||
#undef y3
|
||||
#undef y4
|
||||
|
||||
#undef z0
|
||||
#undef z1
|
||||
#undef z2
|
||||
#undef z3
|
||||
|
||||
#define y0 m
|
||||
#define y1 (y0 + k)
|
||||
#define y2 (y1 + k)
|
||||
#define y3 (y2 + k)
|
||||
#define y4 (y3 + k)
|
||||
|
||||
#define z3 (y4 + k + 1)
|
||||
|
||||
#define z2 (z3 + k + 1)
|
||||
#define z2s 24
|
||||
|
||||
#define z1 (z2 + z2s)
|
||||
|
||||
#define z0 (z1 + z1s + m)
|
||||
#define z0s 48
|
||||
|
||||
#define yc (z0 + z0s + bys)
|
||||
|
||||
|
||||
DIALOG_ID DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
|
||||
CAPTION "Progress"
|
||||
{
|
||||
DEFPUSHBUTTON "&Background", IDB_PROGRESS_BACKGROUND, bx3, by, bxs, bys
|
||||
PUSHBUTTON "&Pause", IDB_PAUSE, bx2, by, bxs, bys
|
||||
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
|
||||
|
||||
|
||||
LTEXT "Elapsed time:", IDT_PROGRESS_ELAPSED, m, y0, x0s, 8
|
||||
LTEXT "Remaining time:", IDT_PROGRESS_REMAINING, m, y1, x0s, 8
|
||||
LTEXT "Files:", IDT_PROGRESS_FILES, m, y2, x0s, 8
|
||||
|
||||
LTEXT "Errors:", IDT_PROGRESS_ERRORS, m, y4, x0s, 8
|
||||
|
||||
|
||||
LTEXT "Total size:", IDT_PROGRESS_TOTAL, x2, y0, x2s, 8
|
||||
LTEXT "Speed:", IDT_PROGRESS_SPEED, x2, y1, x2s, 8
|
||||
LTEXT "Processed:", IDT_PROGRESS_PROCESSED,x2, y2, x2s, 8
|
||||
LTEXT "Compressed size:" , IDT_PROGRESS_PACKED, x2, y3, x2s, 8
|
||||
LTEXT "Compression ratio:", IDT_PROGRESS_RATIO, x2, y4, x2s, 8
|
||||
|
||||
|
||||
RTEXT "", IDT_PROGRESS_ELAPSED_VAL, x1, y0, x1s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_REMAINING_VAL, x1, y1, x1s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_FILES_VAL, x1, y2, x1s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_FILES_TOTAL x1, y3, x1s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_ERRORS_VAL, x1, y4, x1s, MY_TEXT_NOPREFIX
|
||||
|
||||
RTEXT "", IDT_PROGRESS_TOTAL_VAL, x3, y0, x3s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_SPEED_VAL, x3, y1, x3s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_PROCESSED_VAL, x3, y2, x3s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_PACKED_VAL, x3, y3, x3s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_RATIO_VAL, x3, y4, x3s, MY_TEXT_NOPREFIX
|
||||
|
||||
LTEXT "", IDT_PROGRESS_STATUS, m, z3, xc, MY_TEXT_NOPREFIX
|
||||
CONTROL "", IDT_PROGRESS_FILE_NAME, "Static", SS_NOPREFIX | SS_LEFTNOWORDWRAP, m, z2, xc, z2s
|
||||
|
||||
CONTROL "Progress1", IDC_PROGRESS1, "msctls_progress32", PBS_SMOOTH | WS_BORDER, m, z1, xc, z1s
|
||||
|
||||
CONTROL "List1", IDL_PROGRESS_MESSAGES, "SysListView32",
|
||||
LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,
|
||||
m, z0, xc, z0s
|
||||
}
|
||||
3
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialogRes.h
vendored
Normal file
3
3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialogRes.h
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#define IDD_PROGRESS 97
|
||||
|
||||
#define IDC_PROGRESS1 100
|
||||
23
3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyName.cpp
vendored
Normal file
23
3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyName.cpp
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
// PropertyName.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/IntToString.h"
|
||||
|
||||
#include "LangUtils.h"
|
||||
#include "PropertyName.h"
|
||||
|
||||
UString GetNameOfProperty(PROPID propID, const wchar_t *name)
|
||||
{
|
||||
if (propID < 1000)
|
||||
{
|
||||
UString s = LangString(1000 + propID);
|
||||
if (!s.IsEmpty())
|
||||
return s;
|
||||
}
|
||||
if (name)
|
||||
return name;
|
||||
wchar_t temp[16];
|
||||
ConvertUInt32ToString(propID, temp);
|
||||
return temp;
|
||||
}
|
||||
10
3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyName.h
vendored
Normal file
10
3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyName.h
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// PropertyName.h
|
||||
|
||||
#ifndef __PROPERTY_NAME_H
|
||||
#define __PROPERTY_NAME_H
|
||||
|
||||
#include "../../../Common/MyString.h"
|
||||
|
||||
UString GetNameOfProperty(PROPID propID, const wchar_t *name);
|
||||
|
||||
#endif
|
||||
95
3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h
vendored
Normal file
95
3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
|
||||
|
||||
#define IDS_PROP_PATH 1003
|
||||
#define IDS_PROP_NAME 1004
|
||||
#define IDS_PROP_EXTENSION 1005
|
||||
#define IDS_PROP_IS_FOLDER 1006
|
||||
#define IDS_PROP_SIZE 1007
|
||||
#define IDS_PROP_PACKED_SIZE 1008
|
||||
#define IDS_PROP_ATTRIBUTES 1009
|
||||
#define IDS_PROP_CTIME 1010
|
||||
#define IDS_PROP_ATIME 1011
|
||||
#define IDS_PROP_MTIME 1012
|
||||
#define IDS_PROP_SOLID 1013
|
||||
#define IDS_PROP_C0MMENTED 1014
|
||||
#define IDS_PROP_ENCRYPTED 1015
|
||||
#define IDS_PROP_SPLIT_BEFORE 1016
|
||||
#define IDS_PROP_SPLIT_AFTER 1017
|
||||
#define IDS_PROP_DICTIONARY_SIZE 1018
|
||||
#define IDS_PROP_CRC 1019
|
||||
#define IDS_PROP_FILE_TYPE 1020
|
||||
#define IDS_PROP_ANTI 1021
|
||||
#define IDS_PROP_METHOD 1022
|
||||
#define IDS_PROP_HOST_OS 1023
|
||||
#define IDS_PROP_FILE_SYSTEM 1024
|
||||
#define IDS_PROP_USER 1025
|
||||
#define IDS_PROP_GROUP 1026
|
||||
#define IDS_PROP_BLOCK 1027
|
||||
#define IDS_PROP_COMMENT 1028
|
||||
#define IDS_PROP_POSITION 1029
|
||||
#define IDS_PROP_PREFIX 1030
|
||||
#define IDS_PROP_FOLDERS 1031
|
||||
#define IDS_PROP_FILES 1032
|
||||
#define IDS_PROP_VERSION 1033
|
||||
#define IDS_PROP_VOLUME 1034
|
||||
#define IDS_PROP_IS_VOLUME 1035
|
||||
#define IDS_PROP_OFFSET 1036
|
||||
#define IDS_PROP_LINKS 1037
|
||||
#define IDS_PROP_NUM_BLOCKS 1038
|
||||
#define IDS_PROP_NUM_VOLUMES 1039
|
||||
|
||||
#define IDS_PROP_BIT64 1041
|
||||
#define IDS_PROP_BIG_ENDIAN 1042
|
||||
#define IDS_PROP_CPU 1043
|
||||
#define IDS_PROP_PHY_SIZE 1044
|
||||
#define IDS_PROP_HEADERS_SIZE 1045
|
||||
#define IDS_PROP_CHECKSUM 1046
|
||||
#define IDS_PROP_CHARACTS 1047
|
||||
#define IDS_PROP_VA 1048
|
||||
#define IDS_PROP_ID 1049
|
||||
#define IDS_PROP_SHORT_NAME 1050
|
||||
#define IDS_PROP_CREATOR_APP 1051
|
||||
#define IDS_PROP_SECTOR_SIZE 1052
|
||||
#define IDS_PROP_POSIX_ATTRIB 1053
|
||||
#define IDS_PROP_SYM_LINK 1054
|
||||
#define IDS_PROP_ERROR 1055
|
||||
#define IDS_PROP_TOTAL_SIZE 1056
|
||||
#define IDS_PROP_FREE_SPACE 1057
|
||||
#define IDS_PROP_CLUSTER_SIZE 1058
|
||||
#define IDS_PROP_VOLUME_NAME 1059
|
||||
#define IDS_PROP_LOCAL_NAME 1060
|
||||
#define IDS_PROP_PROVIDER 1061
|
||||
#define IDS_PROP_NT_SECURITY 1062
|
||||
#define IDS_PROP_ALT_STREAM 1063
|
||||
#define IDS_PROP_AUX 1064
|
||||
#define IDS_PROP_DELETED 1065
|
||||
#define IDS_PROP_IS_TREE 1066
|
||||
#define IDS_PROP_SHA1 1067
|
||||
#define IDS_PROP_SHA256 1068
|
||||
#define IDS_PROP_ERROR_TYPE 1069
|
||||
#define IDS_PROP_NUM_ERRORS 1070
|
||||
#define IDS_PROP_ERROR_FLAGS 1071
|
||||
#define IDS_PROP_WARNING_FLAGS 1072
|
||||
#define IDS_PROP_WARNING 1073
|
||||
#define IDS_PROP_NUM_STREAMS 1074
|
||||
#define IDS_PROP_NUM_ALT_STREAMS 1075
|
||||
#define IDS_PROP_ALT_STREAMS_SIZE 1076
|
||||
#define IDS_PROP_VIRTUAL_SIZE 1077
|
||||
#define IDS_PROP_UNPACK_SIZE 1078
|
||||
#define IDS_PROP_TOTAL_PHY_SIZE 1079
|
||||
#define IDS_PROP_VOLUME_INDEX 1080
|
||||
#define IDS_PROP_SUBTYPE 1081
|
||||
#define IDS_PROP_SHORT_COMMENT 1082
|
||||
#define IDS_PROP_CODE_PAGE 1083
|
||||
#define IDS_PROP_IS_NOT_ARC_TYPE 1084
|
||||
#define IDS_PROP_PHY_SIZE_CANT_BE_DETECTED 1085
|
||||
#define IDS_PROP_ZEROS_TAIL_IS_ALLOWED 1086
|
||||
#define IDS_PROP_TAIL_SIZE 1087
|
||||
#define IDS_PROP_EMB_STUB_SIZE 1088
|
||||
#define IDS_PROP_NT_REPARSE 1089
|
||||
#define IDS_PROP_HARD_LINK 1090
|
||||
#define IDS_PROP_INODE 1091
|
||||
#define IDS_PROP_STREAM_ID 1092
|
||||
#define IDS_PROP_READ_ONLY 1093
|
||||
#define IDS_PROP_OUT_NAME 1094
|
||||
#define IDS_PROP_COPY_LINK 1095
|
||||
255
3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp
vendored
Normal file
255
3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
// SysIconUtils.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#ifndef _UNICODE
|
||||
#include "../../../Common/StringConvert.h"
|
||||
#endif
|
||||
|
||||
#include "../../../Windows/FileDir.h"
|
||||
|
||||
#include "SysIconUtils.h"
|
||||
|
||||
#include <ShlObj.h>
|
||||
|
||||
#ifndef _UNICODE
|
||||
extern bool g_IsNT;
|
||||
#endif
|
||||
|
||||
int GetIconIndexForCSIDL(int csidl)
|
||||
{
|
||||
LPITEMIDLIST pidl = 0;
|
||||
SHGetSpecialFolderLocation(NULL, csidl, &pidl);
|
||||
if (pidl)
|
||||
{
|
||||
SHFILEINFO shellInfo;
|
||||
SHGetFileInfo((LPCTSTR)(const void *)(pidl), FILE_ATTRIBUTE_NORMAL,
|
||||
&shellInfo, sizeof(shellInfo),
|
||||
SHGFI_PIDL | SHGFI_SYSICONINDEX);
|
||||
IMalloc *pMalloc;
|
||||
SHGetMalloc(&pMalloc);
|
||||
if (pMalloc)
|
||||
{
|
||||
pMalloc->Free(pidl);
|
||||
pMalloc->Release();
|
||||
}
|
||||
return shellInfo.iIcon;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef _UNICODE
|
||||
typedef int (WINAPI * SHGetFileInfoWP)(LPCWSTR pszPath, DWORD attrib, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
|
||||
|
||||
static struct CSHGetFileInfoInit
|
||||
{
|
||||
SHGetFileInfoWP shGetFileInfoW;
|
||||
CSHGetFileInfoInit()
|
||||
{
|
||||
shGetFileInfoW = (SHGetFileInfoWP)
|
||||
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetFileInfoW");
|
||||
}
|
||||
} g_SHGetFileInfoInit;
|
||||
#endif
|
||||
|
||||
static DWORD_PTR MySHGetFileInfoW(LPCWSTR pszPath, DWORD attrib, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
return SHGetFileInfo
|
||||
#else
|
||||
if (g_SHGetFileInfoInit.shGetFileInfoW == 0)
|
||||
return 0;
|
||||
return g_SHGetFileInfoInit.shGetFileInfoW
|
||||
#endif
|
||||
(pszPath, attrib, psfi, cbFileInfo, uFlags);
|
||||
}
|
||||
|
||||
DWORD_PTR GetRealIconIndex(CFSTR path, DWORD attrib, int &iconIndex)
|
||||
{
|
||||
#ifndef _UNICODE
|
||||
if (!g_IsNT)
|
||||
{
|
||||
SHFILEINFO shellInfo;
|
||||
DWORD_PTR res = ::SHGetFileInfo(fs2fas(path), FILE_ATTRIBUTE_NORMAL | attrib, &shellInfo,
|
||||
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
|
||||
iconIndex = shellInfo.iIcon;
|
||||
return res;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SHFILEINFOW shellInfo;
|
||||
DWORD_PTR res = ::MySHGetFileInfoW(fs2us(path), FILE_ATTRIBUTE_NORMAL | attrib, &shellInfo,
|
||||
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
|
||||
iconIndex = shellInfo.iIcon;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DWORD_PTR GetRealIconIndex(const UString &fileName, DWORD attrib, int &iconIndex, UString *typeName)
|
||||
{
|
||||
#ifndef _UNICODE
|
||||
if (!g_IsNT)
|
||||
{
|
||||
SHFILEINFO shellInfo;
|
||||
shellInfo.szTypeName[0] = 0;
|
||||
DWORD_PTR res = ::SHGetFileInfoA(GetSystemString(fileName), FILE_ATTRIBUTE_NORMAL | attrib, &shellInfo,
|
||||
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | SHGFI_TYPENAME);
|
||||
if (typeName)
|
||||
*typeName = GetUnicodeString(shellInfo.szTypeName);
|
||||
iconIndex = shellInfo.iIcon;
|
||||
return res;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SHFILEINFOW shellInfo;
|
||||
shellInfo.szTypeName[0] = 0;
|
||||
DWORD_PTR res = ::MySHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attrib, &shellInfo,
|
||||
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | SHGFI_TYPENAME);
|
||||
if (typeName)
|
||||
*typeName = shellInfo.szTypeName;
|
||||
iconIndex = shellInfo.iIcon;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
static int FindInSorted_Attrib(const CRecordVector<CAttribIconPair> &vect, DWORD attrib, int &insertPos)
|
||||
{
|
||||
unsigned left = 0, right = vect.Size();
|
||||
while (left != right)
|
||||
{
|
||||
unsigned mid = (left + right) / 2;
|
||||
DWORD midAttrib = vect[mid].Attrib;
|
||||
if (attrib == midAttrib)
|
||||
return mid;
|
||||
if (attrib < midAttrib)
|
||||
right = mid;
|
||||
else
|
||||
left = mid + 1;
|
||||
}
|
||||
insertPos = left;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int FindInSorted_Ext(const CObjectVector<CExtIconPair> &vect, const wchar_t *ext, int &insertPos)
|
||||
{
|
||||
unsigned left = 0, right = vect.Size();
|
||||
while (left != right)
|
||||
{
|
||||
unsigned mid = (left + right) / 2;
|
||||
int compare = MyStringCompareNoCase(ext, vect[mid].Ext);
|
||||
if (compare == 0)
|
||||
return mid;
|
||||
if (compare < 0)
|
||||
right = mid;
|
||||
else
|
||||
left = mid + 1;
|
||||
}
|
||||
insertPos = left;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CExtToIconMap::GetIconIndex(DWORD attrib, const wchar_t *fileName /*, UString *typeName */)
|
||||
{
|
||||
int dotPos = -1;
|
||||
unsigned i;
|
||||
for (i = 0;; i++)
|
||||
{
|
||||
wchar_t c = fileName[i];
|
||||
if (c == 0)
|
||||
break;
|
||||
if (c == '.')
|
||||
dotPos = i;
|
||||
}
|
||||
|
||||
/*
|
||||
if (MyStringCompareNoCase(fileName, L"$Recycle.Bin") == 0)
|
||||
{
|
||||
char s[256];
|
||||
sprintf(s, "SPEC i = %3d, attr = %7x", _attribMap.Size(), attrib);
|
||||
OutputDebugStringA(s);
|
||||
OutputDebugStringW(fileName);
|
||||
}
|
||||
*/
|
||||
|
||||
if ((attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 || dotPos < 0)
|
||||
{
|
||||
int insertPos = 0;
|
||||
int index = FindInSorted_Attrib(_attribMap, attrib, insertPos);
|
||||
if (index >= 0)
|
||||
{
|
||||
// if (typeName) *typeName = _attribMap[index].TypeName;
|
||||
return _attribMap[index].IconIndex;
|
||||
}
|
||||
CAttribIconPair pair;
|
||||
GetRealIconIndex(
|
||||
#ifdef UNDER_CE
|
||||
FTEXT("\\")
|
||||
#endif
|
||||
FTEXT("__DIR__")
|
||||
, attrib, pair.IconIndex
|
||||
// , pair.TypeName
|
||||
);
|
||||
|
||||
/*
|
||||
char s[256];
|
||||
sprintf(s, "i = %3d, attr = %7x", _attribMap.Size(), attrib);
|
||||
OutputDebugStringA(s);
|
||||
*/
|
||||
|
||||
pair.Attrib = attrib;
|
||||
_attribMap.Insert(insertPos, pair);
|
||||
// if (typeName) *typeName = pair.TypeName;
|
||||
return pair.IconIndex;
|
||||
}
|
||||
|
||||
const wchar_t *ext = fileName + dotPos + 1;
|
||||
int insertPos = 0;
|
||||
int index = FindInSorted_Ext(_extMap, ext, insertPos);
|
||||
if (index >= 0)
|
||||
{
|
||||
const CExtIconPair &pa = _extMap[index];
|
||||
// if (typeName) *typeName = pa.TypeName;
|
||||
return pa.IconIndex;
|
||||
}
|
||||
|
||||
for (i = 0;; i++)
|
||||
{
|
||||
wchar_t c = ext[i];
|
||||
if (c == 0)
|
||||
break;
|
||||
if (c < L'0' || c > L'9')
|
||||
break;
|
||||
}
|
||||
if (i != 0 && ext[i] == 0)
|
||||
{
|
||||
// GetRealIconIndex is too slow for big number of split extensions: .001, .002, .003
|
||||
if (!SplitIconIndex_Defined)
|
||||
{
|
||||
GetRealIconIndex(
|
||||
#ifdef UNDER_CE
|
||||
FTEXT("\\")
|
||||
#endif
|
||||
FTEXT("__FILE__.001"), 0, SplitIconIndex);
|
||||
SplitIconIndex_Defined = true;
|
||||
}
|
||||
return SplitIconIndex;
|
||||
}
|
||||
|
||||
CExtIconPair pair;
|
||||
pair.Ext = ext;
|
||||
GetRealIconIndex(us2fs(fileName + dotPos), attrib, pair.IconIndex);
|
||||
_extMap.Insert(insertPos, pair);
|
||||
// if (typeName) *typeName = pair.TypeName;
|
||||
return pair.IconIndex;
|
||||
}
|
||||
|
||||
/*
|
||||
int CExtToIconMap::GetIconIndex(DWORD attrib, const UString &fileName)
|
||||
{
|
||||
return GetIconIndex(attrib, fileName, NULL);
|
||||
}
|
||||
*/
|
||||
62
3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h
vendored
Normal file
62
3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
// SysIconUtils.h
|
||||
|
||||
#ifndef __SYS_ICON_UTILS_H
|
||||
#define __SYS_ICON_UTILS_H
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <CommCtrl.h>
|
||||
|
||||
#include "../../../Common/MyString.h"
|
||||
|
||||
struct CExtIconPair
|
||||
{
|
||||
UString Ext;
|
||||
int IconIndex;
|
||||
// UString TypeName;
|
||||
|
||||
// int Compare(const CExtIconPair &a) const { return MyStringCompareNoCase(Ext, a.Ext); }
|
||||
};
|
||||
|
||||
struct CAttribIconPair
|
||||
{
|
||||
DWORD Attrib;
|
||||
int IconIndex;
|
||||
// UString TypeName;
|
||||
|
||||
// int Compare(const CAttribIconPair &a) const { return Ext.Compare(a.Ext); }
|
||||
};
|
||||
|
||||
class CExtToIconMap
|
||||
{
|
||||
public:
|
||||
CRecordVector<CAttribIconPair> _attribMap;
|
||||
CObjectVector<CExtIconPair> _extMap;
|
||||
int SplitIconIndex;
|
||||
int SplitIconIndex_Defined;
|
||||
|
||||
CExtToIconMap(): SplitIconIndex_Defined(false) {}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
SplitIconIndex_Defined = false;
|
||||
_extMap.Clear();
|
||||
_attribMap.Clear();
|
||||
}
|
||||
int GetIconIndex(DWORD attrib, const wchar_t *fileName /* , UString *typeName */);
|
||||
// int GetIconIndex(DWORD attrib, const UString &fileName);
|
||||
};
|
||||
|
||||
DWORD_PTR GetRealIconIndex(CFSTR path, DWORD attrib, int &iconIndex);
|
||||
int GetIconIndexForCSIDL(int csidl);
|
||||
|
||||
inline HIMAGELIST GetSysImageList(bool smallIcons)
|
||||
{
|
||||
SHFILEINFO shellInfo;
|
||||
return (HIMAGELIST)SHGetFileInfo(TEXT(""),
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY,
|
||||
&shellInfo, sizeof(shellInfo),
|
||||
SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | (smallIcons ? SHGFI_SMALLICON : SHGFI_ICON));
|
||||
}
|
||||
|
||||
#endif
|
||||
182
3rdparty/lzma/CPP/7zip/UI/FileManager/resource.h
vendored
Normal file
182
3rdparty/lzma/CPP/7zip/UI/FileManager/resource.h
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
#include "resourceGui.h"
|
||||
|
||||
#define IDR_MENUBAR1 70
|
||||
#define IDM_MENU 71
|
||||
#define IDR_ACCELERATOR1 72
|
||||
|
||||
#define IDB_ADD 100
|
||||
#define IDB_EXTRACT 101
|
||||
#define IDB_TEST 102
|
||||
#define IDB_COPY 103
|
||||
#define IDB_MOVE 104
|
||||
#define IDB_DELETE 105
|
||||
#define IDB_INFO 106
|
||||
|
||||
#define IDB_ADD2 150
|
||||
#define IDB_EXTRACT2 151
|
||||
#define IDB_TEST2 152
|
||||
#define IDB_COPY2 153
|
||||
#define IDB_MOVE2 154
|
||||
#define IDB_DELETE2 155
|
||||
#define IDB_INFO2 156
|
||||
|
||||
#define IDM_HASH_ALL 101
|
||||
#define IDM_CRC32 102
|
||||
#define IDM_CRC64 103
|
||||
#define IDM_SHA1 104
|
||||
#define IDM_SHA256 105
|
||||
|
||||
#define IDM_OPEN 540
|
||||
#define IDM_OPEN_INSIDE 541
|
||||
#define IDM_OPEN_OUTSIDE 542
|
||||
#define IDM_FILE_VIEW 543
|
||||
#define IDM_FILE_EDIT 544
|
||||
#define IDM_RENAME 545
|
||||
#define IDM_COPY_TO 546
|
||||
#define IDM_MOVE_TO 547
|
||||
#define IDM_DELETE 548
|
||||
#define IDM_SPLIT 549
|
||||
#define IDM_COMBINE 550
|
||||
#define IDM_PROPERTIES 551
|
||||
#define IDM_COMMENT 552
|
||||
#define IDM_CRC 553
|
||||
#define IDM_DIFF 554
|
||||
#define IDM_CREATE_FOLDER 555
|
||||
#define IDM_CREATE_FILE 556
|
||||
// #define IDM_EXIT 557
|
||||
#define IDM_LINK 558
|
||||
#define IDM_ALT_STREAMS 559
|
||||
|
||||
#define IDM_VER_EDIT 580
|
||||
#define IDM_VER_COMMIT 581
|
||||
#define IDM_VER_REVERT 582
|
||||
#define IDM_VER_DIFF 583
|
||||
|
||||
#define IDM_OPEN_INSIDE_ONE 590
|
||||
#define IDM_OPEN_INSIDE_PARSER 591
|
||||
|
||||
#define IDM_SELECT_ALL 600
|
||||
#define IDM_DESELECT_ALL 601
|
||||
#define IDM_INVERT_SELECTION 602
|
||||
#define IDM_SELECT 603
|
||||
#define IDM_DESELECT 604
|
||||
#define IDM_SELECT_BY_TYPE 605
|
||||
#define IDM_DESELECT_BY_TYPE 606
|
||||
|
||||
#define IDM_VIEW_LARGE_ICONS 700
|
||||
#define IDM_VIEW_SMALL_ICONS 701
|
||||
#define IDM_VIEW_LIST 702
|
||||
#define IDM_VIEW_DETAILS 703
|
||||
|
||||
#define IDM_VIEW_ARANGE_BY_NAME 710
|
||||
#define IDM_VIEW_ARANGE_BY_TYPE 711
|
||||
#define IDM_VIEW_ARANGE_BY_DATE 712
|
||||
#define IDM_VIEW_ARANGE_BY_SIZE 713
|
||||
|
||||
#define IDM_VIEW_ARANGE_NO_SORT 730
|
||||
#define IDM_VIEW_FLAT_VIEW 731
|
||||
#define IDM_VIEW_TWO_PANELS 732
|
||||
#define IDM_VIEW_TOOLBARS 733
|
||||
#define IDM_OPEN_ROOT_FOLDER 734
|
||||
#define IDM_OPEN_PARENT_FOLDER 735
|
||||
#define IDM_FOLDERS_HISTORY 736
|
||||
#define IDM_VIEW_REFRESH 737
|
||||
#define IDM_VIEW_AUTO_REFRESH 738
|
||||
// #define IDM_VIEW_SHOW_DELETED 739
|
||||
// #define IDM_VIEW_SHOW_STREAMS 740
|
||||
|
||||
#define IDM_VIEW_ARCHIVE_TOOLBAR 750
|
||||
#define IDM_VIEW_STANDARD_TOOLBAR 751
|
||||
#define IDM_VIEW_TOOLBARS_LARGE_BUTTONS 752
|
||||
#define IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT 753
|
||||
|
||||
#define IDM_VIEW_TIME 761
|
||||
|
||||
#define IDS_BOOKMARK 801
|
||||
|
||||
#define IDM_OPTIONS 900
|
||||
#define IDM_BENCHMARK 901
|
||||
#define IDM_BENCHMARK2 902
|
||||
|
||||
#define IDM_HELP_CONTENTS 960
|
||||
#define IDM_ABOUT 961
|
||||
|
||||
#define IDS_OPTIONS 2100
|
||||
|
||||
#define IDS_N_SELECTED_ITEMS 3002
|
||||
|
||||
#define IDS_FILE_EXIST 3008
|
||||
#define IDS_WANT_UPDATE_MODIFIED_FILE 3009
|
||||
#define IDS_CANNOT_UPDATE_FILE 3010
|
||||
#define IDS_CANNOT_START_EDITOR 3011
|
||||
#define IDS_VIRUS 3012
|
||||
#define IDS_MESSAGE_UNSUPPORTED_OPERATION_FOR_LONG_PATH_FOLDER 3013
|
||||
#define IDS_SELECT_ONE_FILE 3014
|
||||
#define IDS_SELECT_FILES 3015
|
||||
#define IDS_TOO_MANY_ITEMS 3016
|
||||
|
||||
#define IDS_COPY 6000
|
||||
#define IDS_MOVE 6001
|
||||
#define IDS_COPY_TO 6002
|
||||
#define IDS_MOVE_TO 6003
|
||||
#define IDS_COPYING 6004
|
||||
#define IDS_MOVING 6005
|
||||
#define IDS_RENAMING 6006
|
||||
|
||||
#define IDS_OPERATION_IS_NOT_SUPPORTED 6008
|
||||
#define IDS_ERROR_RENAMING 6009
|
||||
#define IDS_CONFIRM_FILE_COPY 6010
|
||||
#define IDS_WANT_TO_COPY_FILES 6011
|
||||
|
||||
#define IDS_CONFIRM_FILE_DELETE 6100
|
||||
#define IDS_CONFIRM_FOLDER_DELETE 6101
|
||||
#define IDS_CONFIRM_ITEMS_DELETE 6102
|
||||
#define IDS_WANT_TO_DELETE_FILE 6103
|
||||
#define IDS_WANT_TO_DELETE_FOLDER 6104
|
||||
#define IDS_WANT_TO_DELETE_ITEMS 6105
|
||||
#define IDS_DELETING 6106
|
||||
#define IDS_ERROR_DELETING 6107
|
||||
#define IDS_ERROR_LONG_PATH_TO_RECYCLE 6108
|
||||
|
||||
#define IDS_CREATE_FOLDER 6300
|
||||
#define IDS_CREATE_FILE 6301
|
||||
#define IDS_CREATE_FOLDER_NAME 6302
|
||||
#define IDS_CREATE_FILE_NAME 6303
|
||||
#define IDS_CREATE_FOLDER_DEFAULT_NAME 6304
|
||||
#define IDS_CREATE_FILE_DEFAULT_NAME 6305
|
||||
#define IDS_CREATE_FOLDER_ERROR 6306
|
||||
#define IDS_CREATE_FILE_ERROR 6307
|
||||
|
||||
#define IDS_COMMENT 6400
|
||||
#define IDS_COMMENT2 6401
|
||||
#define IDS_SELECT 6402
|
||||
#define IDS_DESELECT 6403
|
||||
#define IDS_SELECT_MASK 6404
|
||||
|
||||
#define IDS_PROPERTIES 6600
|
||||
#define IDS_FOLDERS_HISTORY 6601
|
||||
|
||||
#define IDS_COMPUTER 7100
|
||||
#define IDS_NETWORK 7101
|
||||
#define IDS_DOCUMENTS 7102
|
||||
#define IDS_SYSTEM 7103
|
||||
|
||||
#define IDS_ADD 7200
|
||||
#define IDS_EXTRACT 7201
|
||||
#define IDS_TEST 7202
|
||||
#define IDS_BUTTON_COPY 7203
|
||||
#define IDS_BUTTON_MOVE 7204
|
||||
#define IDS_BUTTON_DELETE 7205
|
||||
#define IDS_BUTTON_INFO 7206
|
||||
|
||||
#define IDS_SPLITTING 7303
|
||||
#define IDS_SPLIT_CONFIRM_TITLE 7304
|
||||
#define IDS_SPLIT_CONFIRM_MESSAGE 7305
|
||||
#define IDS_SPLIT_VOL_MUST_BE_SMALLER 7306
|
||||
|
||||
#define IDS_COMBINE 7400
|
||||
#define IDS_COMBINE_TO 7401
|
||||
#define IDS_COMBINING 7402
|
||||
#define IDS_COMBINE_SELECT_ONE_FILE 7403
|
||||
#define IDS_COMBINE_CANT_DETECT_SPLIT_FILE 7404
|
||||
#define IDS_COMBINE_CANT_FIND_MORE_THAN_ONE_PART 7405
|
||||
15
3rdparty/lzma/CPP/7zip/UI/FileManager/resourceGui.h
vendored
Normal file
15
3rdparty/lzma/CPP/7zip/UI/FileManager/resourceGui.h
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#define IDI_ICON 1
|
||||
|
||||
#define IDS_MESSAGE_NO_ERRORS 3001
|
||||
|
||||
#define IDS_PROGRESS_TESTING 3302
|
||||
#define IDS_OPENNING 3303
|
||||
#define IDS_SCANNING 3304
|
||||
|
||||
#define IDS_CHECKSUM_CALCULATING 7500
|
||||
#define IDS_CHECKSUM_INFORMATION 7501
|
||||
#define IDS_CHECKSUM_CRC_DATA 7502
|
||||
#define IDS_CHECKSUM_CRC_DATA_NAMES 7503
|
||||
#define IDS_CHECKSUM_CRC_STREAMS_NAMES 7504
|
||||
|
||||
#define IDS_INCORRECT_VOLUME_SIZE 7307
|
||||
Reference in New Issue
Block a user