diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2011-04-18 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:06 +0300 |
commit | 83f8ddcc5b2161e1e3c49666265257fca8aeb12c (patch) | |
tree | fa164096cf0b1cdc9707ae031efc6a5017dd6963 /CPP/7zip | |
parent | 35596517f203f1c4970413b3b5b2e216b849e462 (diff) |
9.229.22
Diffstat (limited to 'CPP/7zip')
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipAddCommon.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipCompressionMode.h | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipHandlerOut.cpp | 4 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipUpdate.cpp | 12 | ||||
-rwxr-xr-x | CPP/7zip/Bundles/Alone7z/resource.rc | 4 | ||||
-rwxr-xr-x | CPP/7zip/Bundles/Format7zExtractR/resource.rc | 4 | ||||
-rwxr-xr-x | CPP/7zip/Bundles/Format7zR/resource.rc | 4 | ||||
-rwxr-xr-x | CPP/7zip/Bundles/SFXWin/Main.cpp | 6 | ||||
-rwxr-xr-x | CPP/7zip/MyVersion.h | 10 | ||||
-rwxr-xr-x | CPP/7zip/MyVersionInfo.rc | 52 | ||||
-rwxr-xr-x | CPP/7zip/UI/Console/Main.cpp | 18 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/7zFM.exe.manifest | 14 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/ClassDefs.cpp | 1 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/FM.dsp | 4 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/MyWindowsNew.h | 72 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/ProgressDialog2.cpp | 82 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/ProgressDialog2.h | 19 | ||||
-rwxr-xr-x | CPP/7zip/UI/GUI/7zG.exe.manifest | 14 | ||||
-rwxr-xr-x | CPP/7zip/UI/GUI/GUI.cpp | 6 | ||||
-rwxr-xr-x | CPP/7zip/UI/GUI/UpdateGUI.cpp | 3 |
20 files changed, 228 insertions, 105 deletions
diff --git a/CPP/7zip/Archive/Zip/ZipAddCommon.cpp b/CPP/7zip/Archive/Zip/ZipAddCommon.cpp index da42f3bd..f77e4f23 100755 --- a/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +++ b/CPP/7zip/Archive/Zip/ZipAddCommon.cpp @@ -292,7 +292,7 @@ HRESULT CAddCommon::Compress( else if (opRes.PackSize < opRes.UnpackSize) break; } - if (_options.IsAesMode) + if (_options.PasswordIsDefined && _options.IsAesMode) { RINOK(_filterAesSpec->WriteFooter(outStream)); RINOK(outStream->Seek(0, STREAM_SEEK_CUR, &opRes.PackSize)); diff --git a/CPP/7zip/Archive/Zip/ZipCompressionMode.h b/CPP/7zip/Archive/Zip/ZipCompressionMode.h index 5be33166..893daaab 100755 --- a/CPP/7zip/Archive/Zip/ZipCompressionMode.h +++ b/CPP/7zip/Archive/Zip/ZipCompressionMode.h @@ -48,6 +48,8 @@ struct CCompressionMethodMode: public CBaseProps UInt64 _dataSizeReduce; bool _dataSizeReduceDefined; + bool IsRealAesMode() const { return PasswordIsDefined && IsAesMode; } + CCompressionMethodMode(): PasswordIsDefined(false) { _dataSizeReduceDefined = false; diff --git a/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp b/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp index 427b0c31..dd1ca136 100755 --- a/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +++ b/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp @@ -409,7 +409,9 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v m_ForceLocal = false; } else - return _props.MethodInfo.ParseParamsFromPROPVARIANT(name, prop); + { + RINOK(_props.MethodInfo.ParseParamsFromPROPVARIANT(name, prop)); + } } return S_OK; } diff --git a/CPP/7zip/Archive/Zip/ZipUpdate.cpp b/CPP/7zip/Archive/Zip/ZipUpdate.cpp index 490d9e26..a91364be 100755 --- a/CPP/7zip/Archive/Zip/ZipUpdate.cpp +++ b/CPP/7zip/Archive/Zip/ZipUpdate.cpp @@ -389,7 +389,7 @@ static void WriteDirHeader(COutArchive &archive, const CCompressionMethodMode *o const CUpdateItem &ui, CItemEx &item) { SetFileHeader(archive, *options, ui, item); - archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsAesMode); + archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsRealAesMode()); archive.WriteLocalHeader(item); } @@ -448,14 +448,14 @@ static HRESULT Update2St( // file Size can be 64-bit !!! SetFileHeader(archive, *options, ui, item); - archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsAesMode); + archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsRealAesMode()); CCompressingResult compressingResult; CMyComPtr<IOutStream> outStream; archive.CreateStreamForCompressing(&outStream); RINOK(compressor.Compress( EXTERNAL_CODECS_LOC_VARS fileInStream, outStream, progress, compressingResult)); - SetItemInfoFromCompressingResult(compressingResult, options->IsAesMode, options->AesKeyMode, item); + SetItemInfoFromCompressingResult(compressingResult, options->IsRealAesMode(), options->AesKeyMode, item); archive.WriteLocalHeader(item); RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); unpackSizeTotal += item.UnPackSize; @@ -741,7 +741,7 @@ static HRESULT Update2( lastRealStreamItemIndex = itemIndex; SetFileHeader(archive, *options, ui, item); // file Size can be 64-bit !!! - archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsAesMode); + archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsRealAesMode()); } CMemBlocks2 &memRef = refs.Refs[itemIndex]; @@ -751,7 +751,7 @@ static HRESULT Update2( archive.CreateStreamForCompressing(&outStream); memRef.WriteToStream(memManager.GetBlockSize(), outStream); SetItemInfoFromCompressingResult(memRef.CompressingResult, - options->IsAesMode, options->AesKeyMode, item); + options->IsRealAesMode(), options->AesKeyMode, item); SetFileHeader(archive, *options, ui, item); archive.WriteLocalHeader(item); // RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); @@ -784,7 +784,7 @@ static HRESULT Update2( RINOK(threadInfo.OutStreamSpec->WriteToRealStream()); threadInfo.OutStreamSpec->ReleaseOutStream(); SetItemInfoFromCompressingResult(threadInfo.CompressingResult, - options->IsAesMode, options->AesKeyMode, item); + options->IsRealAesMode(), options->AesKeyMode, item); SetFileHeader(archive, *options, ui, item); archive.WriteLocalHeader(item); } diff --git a/CPP/7zip/Bundles/Alone7z/resource.rc b/CPP/7zip/Bundles/Alone7z/resource.rc index f4ee3577..b3fb079a 100755 --- a/CPP/7zip/Bundles/Alone7z/resource.rc +++ b/CPP/7zip/Bundles/Alone7z/resource.rc @@ -1,3 +1,3 @@ -#include "../../MyVersionInfo.rc" +#include "../../../../C/7zVersion.rc" -MY_VERSION_INFO_APP("7-Zip Standalone Console", "7zr") +MY_VERSION_INFO_APP("7-Zip Reduced Standalone Console", "7zr") diff --git a/CPP/7zip/Bundles/Format7zExtractR/resource.rc b/CPP/7zip/Bundles/Format7zExtractR/resource.rc index eb636986..149f58c4 100755 --- a/CPP/7zip/Bundles/Format7zExtractR/resource.rc +++ b/CPP/7zip/Bundles/Format7zExtractR/resource.rc @@ -1,5 +1,5 @@ -#include "../../MyVersionInfo.rc" +#include "../../../../C/7zVersion.rc" -MY_VERSION_INFO_DLL("7z Standalone Extracting Plugin", "7zxr") +MY_VERSION_INFO_DLL("7z Extracting Reduced Standalone Plugin", "7zxr") 101 ICON "../../Archive/Icons/7z.ico" diff --git a/CPP/7zip/Bundles/Format7zR/resource.rc b/CPP/7zip/Bundles/Format7zR/resource.rc index f9c17683..a8baa596 100755 --- a/CPP/7zip/Bundles/Format7zR/resource.rc +++ b/CPP/7zip/Bundles/Format7zR/resource.rc @@ -1,5 +1,5 @@ -#include "../../MyVersionInfo.rc" +#include "../../../../C/7zVersion.rc" -MY_VERSION_INFO_DLL("7z Standalone Plugin", "7zr") +MY_VERSION_INFO_DLL("7z Reduced Standalone Plugin", "7zr") 101 ICON "../../Archive/Icons/7z.ico" diff --git a/CPP/7zip/Bundles/SFXWin/Main.cpp b/CPP/7zip/Bundles/SFXWin/Main.cpp index bb7318a1..bd72fc08 100755 --- a/CPP/7zip/Bundles/SFXWin/Main.cpp +++ b/CPP/7zip/Bundles/SFXWin/Main.cpp @@ -20,6 +20,7 @@ #include "../../UI/Common/Extract.h" #include "../../UI/Common/ExitCode.h" #include "../../UI/Explorer/MyMessages.h" +#include "../../UI/FileManager/MyWindowsNew.h" #include "../../UI/GUI/ExtractGUI.h" #include "../../UI/GUI/ExtractRes.h" @@ -38,6 +39,11 @@ void ErrorMessageForHRESULT(HRESULT res) int APIENTRY WinMain2() { + // OleInitialize is required for ProgressBar in TaskBar. + #ifndef UNDER_CE + OleInitialize(NULL); + #endif + UString password; bool assumeYes = false; bool outputFolderDefined = false; diff --git a/CPP/7zip/MyVersion.h b/CPP/7zip/MyVersion.h index b6f541c1..2e657393 100755 --- a/CPP/7zip/MyVersion.h +++ b/CPP/7zip/MyVersion.h @@ -1,8 +1,6 @@ -#define MY_VER_MAJOR 9 -#define MY_VER_MINOR 21 -#define MY_VER_BUILD 00 -#define MY_VERSION "9.21 beta" -#define MY_7ZIP_VERSION "7-Zip 9.21 beta" -#define MY_DATE "2011-04-11" +#include "..\..\C\7zVersion.h" + +#undef MY_COPYRIGHT +#undef MY_VERSION_COPYRIGHT_DATE #define MY_COPYRIGHT "Copyright (c) 1999-2011 Igor Pavlov" #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE diff --git a/CPP/7zip/MyVersionInfo.rc b/CPP/7zip/MyVersionInfo.rc index 814d7a4a..fab66860 100755 --- a/CPP/7zip/MyVersionInfo.rc +++ b/CPP/7zip/MyVersionInfo.rc @@ -1,52 +1,2 @@ -#define MY_VS_FFI_FILEFLAGSMASK 0x0000003FL -#define MY_VOS_NT_WINDOWS32 0x00040004L -#define MY_VOS_CE_WINDOWS32 0x00050004L - -#define MY_VFT_APP 0x00000001L -#define MY_VFT_DLL 0x00000002L - -// #include <WinVer.h> #include "MyVersion.h" - -#define MY_VER MY_VER_MAJOR,MY_VER_MINOR,MY_VER_BUILD,0 - -#ifdef DEBUG -#define DBG_FL VS_FF_DEBUG -#else -#define DBG_FL 0 -#endif - -#define MY_VERSION_INFO(fileType, descr, intName, origName) \ -LANGUAGE 9, 1 \ -1 VERSIONINFO \ - FILEVERSION MY_VER \ - PRODUCTVERSION MY_VER \ - FILEFLAGSMASK MY_VS_FFI_FILEFLAGSMASK \ - FILEFLAGS DBG_FL \ - FILEOS MY_VOS_NT_WINDOWS32 \ - FILETYPE fileType \ - FILESUBTYPE 0x0L \ -BEGIN \ - BLOCK "StringFileInfo" \ - BEGIN \ - BLOCK "040904b0" \ - BEGIN \ - VALUE "CompanyName", "Igor Pavlov" \ - VALUE "FileDescription", descr \ - VALUE "FileVersion", MY_VERSION \ - VALUE "InternalName", intName \ - VALUE "LegalCopyright", MY_COPYRIGHT \ - VALUE "OriginalFilename", origName \ - VALUE "ProductName", "7-Zip" \ - VALUE "ProductVersion", MY_VERSION \ - END \ - END \ - BLOCK "VarFileInfo" \ - BEGIN \ - VALUE "Translation", 0x409, 1200 \ - END \ -END - -#define MY_VERSION_INFO_APP(descr, intName) MY_VERSION_INFO(MY_VFT_APP, descr, intName, intName ".exe") - -#define MY_VERSION_INFO_DLL(descr, intName) MY_VERSION_INFO(MY_VFT_DLL, descr, intName, intName ".dll") +#include "..\..\C\7zVersion.rc" diff --git a/CPP/7zip/UI/Console/Main.cpp b/CPP/7zip/UI/Console/Main.cpp index 722b09e2..f5a70397 100755 --- a/CPP/7zip/UI/Console/Main.cpp +++ b/CPP/7zip/UI/Console/Main.cpp @@ -33,7 +33,15 @@ #include "OpenCallbackConsole.h" #include "UpdateCallbackConsole.h" +#if !defined(EXTERNAL_CODECS) && defined(_NO_CRYPTO) +#define IT_IS_REDUCED_VERSION +#endif + +#ifdef IT_IS_REDUCED_VERSION +#include "../../../../C/7zVersion.h" +#else #include "../../MyVersion.h" +#endif using namespace NWindows; using namespace NFile; @@ -46,7 +54,11 @@ extern CStdOutStream *g_StdStream; static const char *kCopyrightString = "\n7-Zip" #ifndef EXTERNAL_CODECS -" (A)" +#ifdef IT_IS_REDUCED_VERSION +" (r)" +#else +" (a)" +#endif #endif #ifdef _WIN64 @@ -57,10 +69,10 @@ static const char *kCopyrightString = "\n7-Zip" static const char *kHelpString = "\nUsage: 7z" -#ifdef _NO_CRYPTO +#ifndef EXTERNAL_CODECS +#ifdef IT_IS_REDUCED_VERSION "r" #else -#ifndef EXTERNAL_CODECS "a" #endif #endif diff --git a/CPP/7zip/UI/FileManager/7zFM.exe.manifest b/CPP/7zip/UI/FileManager/7zFM.exe.manifest index 06710e04..e8237451 100755 --- a/CPP/7zip/UI/FileManager/7zFM.exe.manifest +++ b/CPP/7zip/UI/FileManager/7zFM.exe.manifest @@ -1 +1,13 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="7-Zip.7-Zip.7zFM" type="win32"/><description>7-Zip File manager.</description><dependency> <dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly></dependency></assembly> +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> + <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="7-Zip.7-Zip.7zFM" type="win32"/> + <description>7-Zip File Manager.</description> + <dependency> + <dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly> + </dependency> + <asmv3:application> + <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> + <dpiAware>true</dpiAware> + </asmv3:windowsSettings> + </asmv3:application> +</assembly> diff --git a/CPP/7zip/UI/FileManager/ClassDefs.cpp b/CPP/7zip/UI/FileManager/ClassDefs.cpp index ca05cc6d..9fec3d92 100755 --- a/CPP/7zip/UI/FileManager/ClassDefs.cpp +++ b/CPP/7zip/UI/FileManager/ClassDefs.cpp @@ -5,3 +5,4 @@ #include "Common/MyInitGuid.h" #include "../Agent/Agent.h" +#include "MyWindowsNew.h" diff --git a/CPP/7zip/UI/FileManager/FM.dsp b/CPP/7zip/UI/FileManager/FM.dsp index b821d460..3f3cd77c 100755 --- a/CPP/7zip/UI/FileManager/FM.dsp +++ b/CPP/7zip/UI/FileManager/FM.dsp @@ -184,6 +184,10 @@ SOURCE=.\Move.bmp # End Source File # Begin Source File +SOURCE=.\MyWindowsNew.h +# End Source File +# Begin Source File + SOURCE=.\Parent.bmp # End Source File # Begin Source File diff --git a/CPP/7zip/UI/FileManager/MyWindowsNew.h b/CPP/7zip/UI/FileManager/MyWindowsNew.h new file mode 100755 index 00000000..3e081a96 --- /dev/null +++ b/CPP/7zip/UI/FileManager/MyWindowsNew.h @@ -0,0 +1,72 @@ +// MyWindowsNew.h + +#ifndef __MY_WINDOWS_NEW_H +#define __MY_WINDOWS_NEW_H + +#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 diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp index bd77d20d..a4ff7f58 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp @@ -74,34 +74,35 @@ HRESULT CProgressSync::SetPosAndCheckPaused(UInt64 completed) } -CProgressDialog::CProgressDialog(): _timer(0), CompressingMode(true) - #ifndef _SFX - , MainWindow(0) - #endif - { - IconID = -1; - MessagesDisplayed = false; - _wasCreated = false; - _needClose = false; - _inCancelMessageBox = false; - _externalCloseMessageWasReceived = false; - - _numPostedMessages = 0; - _numAutoSizeMessages = 0; - _errorsWereDisplayed = false; - _waitCloseByCancelButton = false; - _cancelWasPressed = false; - ShowCompressionInfo = true; - WaitMode = false; - if (_dialogCreatedEvent.Create() != S_OK) - throw 1334987; - if (_createDialogEvent.Create() != S_OK) - throw 1334987; - } +CProgressDialog::CProgressDialog(): _timer(0), CompressingMode(true), MainWindow(0) +{ + IconID = -1; + MessagesDisplayed = false; + _wasCreated = false; + _needClose = false; + _inCancelMessageBox = false; + _externalCloseMessageWasReceived = false; + + _numPostedMessages = 0; + _numAutoSizeMessages = 0; + _errorsWereDisplayed = false; + _waitCloseByCancelButton = false; + _cancelWasPressed = false; + ShowCompressionInfo = true; + WaitMode = false; + if (_dialogCreatedEvent.Create() != S_OK) + throw 1334987; + if (_createDialogEvent.Create() != S_OK) + throw 1334987; + CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (void**)&_taskbarList); + if (_taskbarList) + _taskbarList->HrInit(); +} #ifndef _SFX CProgressDialog::~CProgressDialog() { + SetTaskbarProgressState(TBPF_NOPROGRESS); AddToTitle(L""); } void CProgressDialog::AddToTitle(LPCWSTR s) @@ -115,6 +116,20 @@ void CProgressDialog::AddToTitle(LPCWSTR s) #endif + +void CProgressDialog::SetTaskbarProgressState() +{ + if (_taskbarList && _hwndForTaskbar) + { + TBPFLAG tbpFlags; + if (Sync.GetPaused()) + tbpFlags = TBPF_PAUSED; + else + tbpFlags = _errorsWereDisplayed ? TBPF_ERROR: TBPF_NORMAL; + SetTaskbarProgressState(tbpFlags); + } +} + static const int kTitleFileNameSizeLimit = 36; static const int kCurrentFileNameSizeLimit = 82; @@ -134,6 +149,12 @@ void CProgressDialog::EnableErrorsControls(bool enable) bool CProgressDialog::OnInit() { + _hwndForTaskbar = MainWindow; + if (!_hwndForTaskbar) + _hwndForTaskbar = GetParent(); + if (!_hwndForTaskbar) + _hwndForTaskbar = (HWND)*this; + _range = (UInt64)(Int64)-1; _prevPercentValue = (UInt32)-1; _prevElapsedSec = (UInt32)-1; @@ -208,6 +229,8 @@ bool CProgressDialog::OnInit() CheckNeedClose(); + SetTaskbarProgressState(); + return CModalDialog::OnInit(); } @@ -382,9 +405,11 @@ void CProgressDialog::SetPos(UInt64 pos) if (pos - _previousPos < (_range >> 10)) redraw = false; } - if(redraw) + if (redraw) { m_ProgressBar.SetPos(_converter.Count(pos)); // Test it for 100% + if (_taskbarList && _hwndForTaskbar) + _taskbarList->SetProgressValue(_hwndForTaskbar, pos, _range); _previousPos = pos; } } @@ -466,6 +491,7 @@ void CProgressDialog::UpdateStatInfo(bool showAll) { _errorsWereDisplayed = true; EnableErrorsControls(true); + SetTaskbarProgressState(); } } } @@ -670,6 +696,11 @@ INT_PTR CProgressDialog::Create(const UString &title, NWindows::CThread &thread, bool CProgressDialog::OnExternalCloseMessage() { + // it doesn't work if there is MessageBox. + SetTaskbarProgressState(TBPF_NOPROGRESS); + // AddToTitle(L"Finished "); + // SetText(L"Finished2 "); + UpdateStatInfo(true); HideItem(IDC_BUTTON_PROGRESS_PRIORITY); @@ -795,6 +826,7 @@ void CProgressDialog::OnPauseButton() UInt32 curTime = ::GetTickCount(); if (paused) _elapsedTime += (curTime - _prevTime); + SetTaskbarProgressState(); _prevTime = curTime; SetPauseText(); } diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.h b/CPP/7zip/UI/FileManager/ProgressDialog2.h index 81a64e32..6bb13603 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.h +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.h @@ -3,6 +3,8 @@ #ifndef __PROGRESS_DIALOG2_H #define __PROGRESS_DIALOG2_H +#include "Common/MyCom.h" + #include "Windows/Synchronization.h" #include "Windows/Thread.h" @@ -10,6 +12,8 @@ #include "Windows/Control/ListView.h" #include "Windows/Control/ProgressBar.h" +#include "MyWindowsNew.h" + class CProgressSync { bool _stopped; @@ -201,7 +205,7 @@ class CProgressDialog: public NWindows::NControl::CModalDialog { UString _prevFileName; UString _prevTitleName; -private: + UString backgroundString; UString backgroundedString; UString foregroundString; @@ -221,6 +225,9 @@ private: NWindows::NControl::CProgressBar m_ProgressBar; NWindows::NControl::CListView _messageList; + CMyComPtr<ITaskbarList3> _taskbarList; + HWND _hwndForTaskbar; + UInt32 _prevPercentValue; UInt32 _prevTime; UInt32 _elapsedTime; @@ -247,6 +254,14 @@ private: bool _inCancelMessageBox; bool _externalCloseMessageWasReceived; + + void SetTaskbarProgressState(TBPFLAG tbpFlags) + { + if (_taskbarList && _hwndForTaskbar) + _taskbarList->SetProgressState(_hwndForTaskbar, tbpFlags); + } + void SetTaskbarProgressState(); + void UpdateStatInfo(bool showAll); bool OnTimer(WPARAM timerID, LPARAM callback); void SetRange(UInt64 range); @@ -289,8 +304,8 @@ public: bool MessagesDisplayed; // = true if user pressed OK on all messages or there are no messages. int IconID; - #ifndef _SFX HWND MainWindow; + #ifndef _SFX UString MainTitle; UString MainAddTitle; ~CProgressDialog(); diff --git a/CPP/7zip/UI/GUI/7zG.exe.manifest b/CPP/7zip/UI/GUI/7zG.exe.manifest index c6ef90e8..68c6047e 100755 --- a/CPP/7zip/UI/GUI/7zG.exe.manifest +++ b/CPP/7zip/UI/GUI/7zG.exe.manifest @@ -1 +1,13 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="7-Zip.7-Zip.7zG" type="win32"/><description>7-Zip GUI.</description><dependency> <dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly></dependency></assembly> +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> + <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="7-Zip.7-Zip.7zG" type="win32"/> + <description>7-Zip GUI.</description> + <dependency> + <dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly> + </dependency> + <asmv3:application> + <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> + <dpiAware>true</dpiAware> + </asmv3:windowsSettings> + </asmv3:application> +</assembly> diff --git a/CPP/7zip/UI/GUI/GUI.cpp b/CPP/7zip/UI/GUI/GUI.cpp index 0a40b58e..5b809a63 100755 --- a/CPP/7zip/UI/GUI/GUI.cpp +++ b/CPP/7zip/UI/GUI/GUI.cpp @@ -20,6 +20,7 @@ #include "../Common/ExitCode.h" #include "../FileManager/StringUtils.h" +#include "../FileManager/MyWindowsNew.h" #include "BenchmarkDialog.h" #include "ExtractGUI.h" @@ -232,6 +233,11 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, InitCommonControls(); + // OleInitialize is required for ProgressBar in TaskBar. + #ifndef UNDER_CE + OleInitialize(NULL); + #endif + ReloadLang(); // setlocale(LC_COLLATE, ".ACP"); diff --git a/CPP/7zip/UI/GUI/UpdateGUI.cpp b/CPP/7zip/UI/GUI/UpdateGUI.cpp index ec56492f..406d5bf1 100755 --- a/CPP/7zip/UI/GUI/UpdateGUI.cpp +++ b/CPP/7zip/UI/GUI/UpdateGUI.cpp @@ -392,7 +392,6 @@ HRESULT UpdateGUI( RINOK(tu.Create(title, hwndParent)); - messageWasDisplayed = tu.ThreadFinishedOK & - tu.ProgressDialog.MessagesDisplayed; + messageWasDisplayed = tu.ThreadFinishedOK && tu.ProgressDialog.MessagesDisplayed; return tu.Result; } |