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/UI/FileManager | |
parent | 35596517f203f1c4970413b3b5b2e216b849e462 (diff) |
9.229.22
Diffstat (limited to 'CPP/7zip/UI/FileManager')
-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 |
6 files changed, 164 insertions, 28 deletions
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(); |