diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-03-25 17:53:14 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-03-25 17:53:14 +0100 |
commit | f2902217b38cf2e16e851ae84d61247f8e828180 (patch) | |
tree | 0156a6db6aa8b4d87bf041ece5cf5229c59fe9de /other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog | |
parent | 917a2c450f08ab4c934c9938319f10a1114272b4 (diff) | |
download | UXP-f2902217b38cf2e16e851ae84d61247f8e828180.tar UXP-f2902217b38cf2e16e851ae84d61247f8e828180.tar.gz UXP-f2902217b38cf2e16e851ae84d61247f8e828180.tar.lz UXP-f2902217b38cf2e16e851ae84d61247f8e828180.tar.xz UXP-f2902217b38cf2e16e851ae84d61247f8e828180.zip |
Update the 7z installer stub source to 18.05.
Tag #1022
Diffstat (limited to 'other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog')
5 files changed, 0 insertions, 343 deletions
diff --git a/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp b/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp deleted file mode 100644 index b421e8cce..000000000 --- a/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp +++ /dev/null @@ -1,175 +0,0 @@ -// ProgressDialog.cpp
-
-#include "StdAfx.h"
-#include "resource.h"
-#include "ProgressDialog.h"
-#include "Common/IntToString.h"
-#include "Common/IntToString.h"
-
-using namespace NWindows;
-
-static const UINT_PTR kTimerID = 3;
-static const UINT kTimerElapse = 50;
-
-#ifdef LANG
-#include "../../LangUtils.h"
-#endif
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDCANCEL, 0x02000711 }
-};
-#endif
-
-#ifndef _SFX
-CProgressDialog::~CProgressDialog()
-{
- AddToTitle(TEXT(""));
-}
-void CProgressDialog::AddToTitle(LPCWSTR s)
-{
- if (MainWindow != 0)
- ::MySetWindowText(MainWindow, UString(s) + MainTitle);
-}
-#endif
-
-
-
-bool CProgressDialog::OnInit()
-{
- _range = UINT64(-1);
- _prevPercentValue = -1;
-
- #ifdef LANG
- // LangSetWindowText(HWND(*this), 0x02000C00);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
-
- m_ProgressBar.Attach(GetItem(IDC_PROGRESS1));
- _timer = SetTimer(kTimerID, kTimerElapse);
- _dialogCreatedEvent.Set();
- SetText(_title);
- return CModalDialog::OnInit();
-}
-
-void CProgressDialog::OnCancel()
-{
- ProgressSynch.SetStopped(true);
-}
-
-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 (ProgressSynch.GetPaused())
- return true;
- UINT64 total, completed;
- ProgressSynch.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 += L"% ";
- SetText(title + _title);
- #ifndef _SFX
- AddToTitle(title + MainAddTitle);
- #endif
- _prevPercentValue = percentValue;
- }
- return true;
-}
-
-
-////////////////////
-// CU64ToI32Converter
-
-static const UINT64 kMaxIntValue = 0x7FFFFFFF;
-
-void CU64ToI32Converter::Init(UINT64 range)
-{
- _numShiftBits = 0;
- while(range > kMaxIntValue)
- {
- range >>= 1;
- _numShiftBits++;
- }
-}
-
-int CU64ToI32Converter::Count(UINT64 aValue)
-{
- return int(aValue >> _numShiftBits);
-}
-
-const UINT CProgressDialog::kCloseMessage = WM_USER + 1;
-
-bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch(message)
- {
- case kCloseMessage:
- {
- KillTimer(_timer);
- _timer = 0;
- End(0);
- return true;
- }
- 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 = ProgressSynch.GetPaused();;
- ProgressSynch.SetPaused(true);
- int res = ::MessageBoxW(HWND(*this),
- L"Are you sure you want to cancel?",
- _title, MB_YESNO);
- ProgressSynch.SetPaused(paused);
- if (res == IDNO)
- return true;
- break;
- }
- }
- return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
-}
diff --git a/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.h b/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.h deleted file mode 100644 index d0d8db56f..000000000 --- a/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.h +++ /dev/null @@ -1,129 +0,0 @@ -// ProgressDialog.h
-
-#ifndef __PROGRESSDIALOG_H
-#define __PROGRESSDIALOG_H
-
-#include "resource.h"
-
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/ProgressBar.h"
-#include "Windows/Synchronization.h"
-
-class CProgressSynch
-{
- NWindows::NSynchronization::CCriticalSection _criticalSection;
- bool _stopped;
- bool _paused;
- UINT64 _total;
- UINT64 _completed;
-public:
- CProgressSynch(): _stopped(false), _paused(false), _total(1), _completed(0) {}
-
- bool GetStopped()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- return _stopped;
- }
- void SetStopped(bool value)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- _stopped = value;
- }
- bool GetPaused()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- return _paused;
- }
- void SetPaused(bool value)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- _paused = value;
- }
- void SetProgress(UINT64 total, UINT64 completed)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- _total = total;
- _completed = completed;
- }
- void SetPos(UINT64 completed)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- _completed = completed;
- }
- void GetProgress(UINT64 &total, UINT64 &completed)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- total = _total;
- completed = _completed;
- }
-};
-
-class CU64ToI32Converter
-{
- UINT64 _numShiftBits;
-public:
- void Init(UINT64 _range);
- int Count(UINT64 aValue);
-};
-
-// class CProgressDialog: public NWindows::NControl::CModelessDialog
-
-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 OnTimer(WPARAM timerID, LPARAM callback);
- void SetRange(UINT64 range);
- void SetPos(UINT64 pos);
- virtual bool OnInit();
- virtual void OnCancel();
- NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
- #ifndef _SFX
- void AddToTitle(LPCWSTR string);
- #endif
- bool OnButtonClicked(int buttonID, HWND buttonHWND);
-public:
- CProgressSynch ProgressSynch;
-
- #ifndef _SFX
- HWND MainWindow;
- UString MainTitle;
- UString MainAddTitle;
- ~CProgressDialog();
- #endif
-
- CProgressDialog(): _timer(0)
- #ifndef _SFX
- ,MainWindow(0)
- #endif
- {}
-
- void WaitCreating() { _dialogCreatedEvent.Lock(); }
-
-
- INT_PTR Create(const UString &title, HWND wndParent = 0)
- {
- _title = title;
- return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
- }
-
- static const UINT kCloseMessage;
-
- virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
-
- void MyClose()
- {
- PostMessage(kCloseMessage);
- };
-};
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/StdAfx.h b/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/StdAfx.h deleted file mode 100644 index 6447c2064..000000000 --- a/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/StdAfx.h +++ /dev/null @@ -1,16 +0,0 @@ -// stdafx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#define _WIN32_WINNT 0x0400
-
-// it's for Windows NT supporting (MENUITEMINFOW)
-#define WINVER 0x0400
-
-#include <windows.h>
-#include <commctrl.h>
-
-#include "Common/NewHandler.h"
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/resource.h b/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/resource.h deleted file mode 100644 index 7f9828126..000000000 --- a/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/resource.h +++ /dev/null @@ -1,3 +0,0 @@ -#define IDD_DIALOG_PROGRESS 500
-
-#define IDC_PROGRESS1 1000
diff --git a/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/resource.rc b/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/resource.rc deleted file mode 100644 index 71a76fe9e..000000000 --- a/other-licenses/7zstub/src/7zip/FileManager/Resource/ProgressDialog/resource.rc +++ /dev/null @@ -1,20 +0,0 @@ -#include "resource.h"
-#include "../../../GuiCommon.rc"
-
-#define xSize2 172
-#define ySize2 42
-#define xSize (xSize2 + marg + marg)
-#define ySize (ySize2 + marg + marg)
-
-#define bYPos (ySize - marg - bYSize)
-#define bXPos (xSize - marg - bXSize)
-
-
-IDD_DIALOG_PROGRESS DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
-CAPTION "Progress"
-MY_FONT
-BEGIN
- PUSHBUTTON "Cancel", IDCANCEL, bXPos, bYPos , bXSize, bYSize
- CONTROL "Progress1", IDC_PROGRESS1,"msctls_progress32",PBS_SMOOTH | WS_BORDER,
- marg,marg, xSize2, 14
-END
|