ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2019
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
36 participants
281 discussions
Start a n
N
ew thread
[reactos] 17/17: [RAPPS] Remove unused function definitions
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cda2bc50ebf9f32e067fa…
commit cda2bc50ebf9f32e067faabd8a1449e7bff7b86d Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Tue Aug 20 01:41:40 2019 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 01:41:40 2019 +0200 [RAPPS] Remove unused function definitions --- base/applications/rapps/loaddlg.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/base/applications/rapps/loaddlg.cpp b/base/applications/rapps/loaddlg.cpp index 201538f7edb..5b31ed06f0e 100644 --- a/base/applications/rapps/loaddlg.cpp +++ b/base/applications/rapps/loaddlg.cpp @@ -351,9 +351,6 @@ public: static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE); static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static DWORD WINAPI ThreadFunc(LPVOID Context); - static BOOL DownloadListOfApplications(const ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal = FALSE); - static BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal = FALSE); - static VOID DownloadApplicationsDB(LPCWSTR lpUrl); static VOID LaunchDownloadDialog(BOOL); };
5 years, 4 months
1
0
0
0
[reactos] 16/17: [RAPPS] CDownloadManager: Get rid of the implementation of IBindStatusCallback as we stopped using URLDownloadToFileW a decade ago
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1e201d7057741b48d559e…
commit 1e201d7057741b48d559e5ee6db2c5b2a2748d92 Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Mon Apr 29 15:12:32 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:49 2019 +0200 [RAPPS] CDownloadManager: Get rid of the implementation of IBindStatusCallback as we stopped using URLDownloadToFileW a decade ago --- base/applications/rapps/loaddlg.cpp | 176 +++++++++--------------------------- 1 file changed, 42 insertions(+), 134 deletions(-) diff --git a/base/applications/rapps/loaddlg.cpp b/base/applications/rapps/loaddlg.cpp index 9880b7691e2..201538f7edb 100644 --- a/base/applications/rapps/loaddlg.cpp +++ b/base/applications/rapps/loaddlg.cpp @@ -218,127 +218,6 @@ public: END_MSG_MAP() }; -class CDownloadDialog : - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IBindStatusCallback -{ - HWND m_hDialog; - BOOL m_UrlHasBeenCopied; - CDownloaderProgress* m_progress; - -public: - ~CDownloadDialog() - { - //DestroyWindow(m_hDialog); - } - - HRESULT Initialize(HWND Dlg, CDownloaderProgress* pProgress) - { - m_hDialog = Dlg; - m_UrlHasBeenCopied = FALSE; - m_progress = pProgress; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE OnStartBinding( - DWORD dwReserved, - IBinding *pib) - { - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE GetPriority( - LONG *pnPriority) - { - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE OnLowResource( - DWORD reserved) - { - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE OnProgress( - ULONG ulProgress, - ULONG ulProgressMax, - ULONG ulStatusCode, - LPCWSTR szStatusText) - { - HWND Item; - LONG r; - - m_progress->SetProgress(ulProgress, ulProgressMax); - - Item = GetDlgItem(m_hDialog, IDC_DOWNLOAD_STATUS); - if (Item && szStatusText && wcslen(szStatusText) > 0 && m_UrlHasBeenCopied == FALSE) - { - SIZE_T len = wcslen(szStatusText) + 1; - ATL::CStringW buf; - DWORD dummyLen; - - /* beautify our url for display purposes */ - if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE)) - { - /* just use the original */ - buf.ReleaseBuffer(); - buf = szStatusText; - } - else - { - buf.ReleaseBuffer(); - } - - /* paste it into our dialog and don't do it again in this instance */ - SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) buf.GetString()); - m_UrlHasBeenCopied = TRUE; - } - - SetLastError(ERROR_SUCCESS); - r = GetWindowLongPtrW(m_hDialog, GWLP_USERDATA); - if (r || GetLastError() != ERROR_SUCCESS) - { - return E_ABORT; - } - - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE OnStopBinding( - HRESULT hresult, - LPCWSTR szError) - { - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE GetBindInfo( - DWORD *grfBINDF, - BINDINFO *pbindinfo) - { - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE OnDataAvailable( - DWORD grfBSCF, - DWORD dwSize, - FORMATETC *pformatetc, - STGMEDIUM *pstgmed) - { - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable( - REFIID riid, - IUnknown *punk) - { - return S_OK; - } - - BEGIN_COM_MAP(CDownloadDialog) - COM_INTERFACE_ENTRY_IID(IID_IBindStatusCallback, IBindStatusCallback) - END_COM_MAP() -}; - class CDowloadingAppsListView : public CListView { @@ -406,12 +285,6 @@ public: } }; -extern "C" -HRESULT WINAPI CDownloadDialog_Constructor(HWND Dlg, CDownloaderProgress* pProgress, REFIID riid, LPVOID *ppv) -{ - return ShellObjectCreatorInit<CDownloadDialog>(Dlg, pProgress, riid, ppv); -} - #ifdef USE_CERT_PINNING typedef CHeapPtr<char, CLocalAllocator> CLocalPtr; @@ -472,6 +345,7 @@ class CDownloadManager static CDowloadingAppsListView DownloadsListView; static CDownloaderProgress ProgressBar; static BOOL bCancelled; + static VOID UpdateProgress(HWND hDlg, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText); public: static VOID Add(DownloadInfo info); static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE); @@ -586,9 +460,46 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM w } } +BOOL UrlHasBeenCopied; + +VOID CDownloadManager::UpdateProgress( + HWND hDlg, + ULONG ulProgress, + ULONG ulProgressMax, + ULONG ulStatusCode, + LPCWSTR szStatusText) +{ + HWND Item; + + ProgressBar.SetProgress(ulProgress, ulProgressMax); + + Item = GetDlgItem(hDlg, IDC_DOWNLOAD_STATUS); + if (Item && szStatusText && wcslen(szStatusText) > 0 && UrlHasBeenCopied == FALSE) + { + SIZE_T len = wcslen(szStatusText) + 1; + ATL::CStringW buf; + DWORD dummyLen; + + /* beautify our url for display purposes */ + if (!InternetCanonicalizeUrlW(szStatusText, buf.GetBuffer(len), &dummyLen, ICU_DECODE | ICU_NO_ENCODE)) + { + /* just use the original */ + buf.ReleaseBuffer(); + buf = szStatusText; + } + else + { + buf.ReleaseBuffer(); + } + + /* paste it into our dialog and don't do it again in this instance */ + SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) buf.GetString()); + UrlHasBeenCopied = TRUE; + } +} + DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) { - CComPtr<IBindStatusCallback> dl; ATL::CStringW Path; PWSTR p, q; @@ -700,11 +611,8 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) DownloadsListView.SetDownloadStatus(iAppId, DLSTATUS_DOWNLOADING); // download it + UrlHasBeenCopied = FALSE; bTempfile = TRUE; - CDownloadDialog_Constructor(hDlg, &ProgressBar, IID_PPV_ARG(IBindStatusCallback, &dl)); - - if (dl == NULL) - goto end; /* FIXME: this should just be using the system-wide proxy settings */ switch (SettingsInfo.Proxy) @@ -843,7 +751,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) } dwCurrentBytesRead += dwBytesRead; - dl->OnProgress(dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString()); + UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString()); } while (dwBytesRead && !bCancelled); CloseHandle(hOut); @@ -858,7 +766,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) ProgressBar.SetMarquee(FALSE); dwContentLen = dwCurrentBytesRead; - dl->OnProgress(dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString()); + UpdateProgress(hDlg, dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString()); } /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
5 years, 4 months
1
0
0
0
[reactos] 15/17: [RAPPS] CDownloadManager: simplify canceling
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=db8f1d6f6a662fe1a1d61…
commit db8f1d6f6a662fe1a1d61ac793047f4320939a0a Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Mon Apr 29 14:21:08 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:48 2019 +0200 [RAPPS] CDownloadManager: simplify canceling --- base/applications/rapps/loaddlg.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/base/applications/rapps/loaddlg.cpp b/base/applications/rapps/loaddlg.cpp index 44929c25fe8..9880b7691e2 100644 --- a/base/applications/rapps/loaddlg.cpp +++ b/base/applications/rapps/loaddlg.cpp @@ -223,7 +223,6 @@ class CDownloadDialog : public IBindStatusCallback { HWND m_hDialog; - PBOOL m_pbCancelled; BOOL m_UrlHasBeenCopied; CDownloaderProgress* m_progress; @@ -233,10 +232,9 @@ public: //DestroyWindow(m_hDialog); } - HRESULT Initialize(HWND Dlg, BOOL *pbCancelled, CDownloaderProgress* pProgress) + HRESULT Initialize(HWND Dlg, CDownloaderProgress* pProgress) { m_hDialog = Dlg; - m_pbCancelled = pbCancelled; m_UrlHasBeenCopied = FALSE; m_progress = pProgress; return S_OK; @@ -300,7 +298,6 @@ public: r = GetWindowLongPtrW(m_hDialog, GWLP_USERDATA); if (r || GetLastError() != ERROR_SUCCESS) { - *m_pbCancelled = TRUE; return E_ABORT; } @@ -410,9 +407,9 @@ public: }; extern "C" -HRESULT WINAPI CDownloadDialog_Constructor(HWND Dlg, BOOL *pbCancelled, CDownloaderProgress* pProgress, REFIID riid, LPVOID *ppv) +HRESULT WINAPI CDownloadDialog_Constructor(HWND Dlg, CDownloaderProgress* pProgress, REFIID riid, LPVOID *ppv) { - return ShellObjectCreatorInit<CDownloadDialog>(Dlg, pbCancelled, pProgress, riid, ppv); + return ShellObjectCreatorInit<CDownloadDialog>(Dlg, pProgress, riid, ppv); } #ifdef USE_CERT_PINNING @@ -468,14 +465,13 @@ inline VOID MessageBox_LoadString(HWND hMainWnd, INT StringID) } } - // Download dialog (loaddlg.cpp) class CDownloadManager { static ATL::CSimpleArray<DownloadInfo> AppsToInstallList; static CDowloadingAppsListView DownloadsListView; static CDownloaderProgress ProgressBar; - + static BOOL bCancelled; public: static VOID Add(DownloadInfo info); static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE); @@ -492,7 +488,7 @@ public: ATL::CSimpleArray<DownloadInfo> CDownloadManager::AppsToInstallList; CDowloadingAppsListView CDownloadManager::DownloadsListView; CDownloaderProgress CDownloadManager::ProgressBar; - +BOOL CDownloadManager::bCancelled; VOID CDownloadManager::Add(DownloadInfo info) { @@ -517,6 +513,8 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM w HICON hIconSm, hIconBg; ATL::CStringW szTempCaption; + bCancelled = FALSE; + hIconBg = (HICON) GetClassLongPtrW(hMainWnd, GCLP_HICON); hIconSm = (HICON) GetClassLongPtrW(hMainWnd, GCLP_HICONSM); @@ -573,7 +571,7 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM w case WM_COMMAND: if (wParam == IDCANCEL) { - SetWindowLongW(Dlg, GWLP_USERDATA, 1); + bCancelled = TRUE; PostMessageW(Dlg, WM_CLOSE, 0, 0); } return FALSE; @@ -602,7 +600,6 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) ULONG dwCurrentBytesRead = 0; ULONG dwStatusLen = sizeof(dwStatus); - BOOL bCancelled = FALSE; BOOL bTempfile = FALSE; BOOL bCab = FALSE; @@ -704,7 +701,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) // download it bTempfile = TRUE; - CDownloadDialog_Constructor(hDlg, &bCancelled, &ProgressBar, IID_PPV_ARG(IBindStatusCallback, &dl)); + CDownloadDialog_Constructor(hDlg, &ProgressBar, IID_PPV_ARG(IBindStatusCallback, &dl)); if (dl == NULL) goto end;
5 years, 4 months
1
0
0
0
[reactos] 14/17: [RAPPS] factor CDownloaderProgress class out of CDownloadManager and CDownloadDialog
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6803490a4d944a811fb03…
commit 6803490a4d944a811fb0357cc8c89ffbc527b479 Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Mon Apr 29 11:33:33 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:48 2019 +0200 [RAPPS] factor CDownloaderProgress class out of CDownloadManager and CDownloadDialog --- base/applications/rapps/loaddlg.cpp | 299 +++++++++++++++++------------------- 1 file changed, 141 insertions(+), 158 deletions(-) diff --git a/base/applications/rapps/loaddlg.cpp b/base/applications/rapps/loaddlg.cpp index f774d67f3dd..44929c25fe8 100644 --- a/base/applications/rapps/loaddlg.cpp +++ b/base/applications/rapps/loaddlg.cpp @@ -41,6 +41,7 @@ #include <rosctrls.h> #include <windowsx.h> +#undef SubclassWindow #include "rosui.h" #include "dialogs.h" @@ -95,6 +96,128 @@ struct DownloadParam }; +class CDownloaderProgress + : public CWindowImpl<CDownloaderProgress, CWindow, CControlWinTraits> +{ + ATL::CStringW m_szProgressText; + +public: + CDownloaderProgress() + { + } + + VOID SetMarquee(BOOL Enable) + { + if (Enable) + ModifyStyle(0, PBS_MARQUEE, 0); + else + ModifyStyle(PBS_MARQUEE, 0, 0); + + SendMessage(PBM_SETMARQUEE, Enable, 0); + } + + VOID SetProgress(ULONG ulProgress, ULONG ulProgressMax) + { + WCHAR szProgress[100]; + + /* format the bits and bytes into pretty and accessible units... */ + StrFormatByteSizeW(ulProgress, szProgress, _countof(szProgress)); + + /* use our subclassed progress bar text subroutine */ + ATL::CStringW ProgressText; + + if (ulProgressMax) + { + /* total size is known */ + WCHAR szProgressMax[100]; + UINT uiPercentage = ((ULONGLONG) ulProgress * 100) / ulProgressMax; + + /* send the current progress to the progress bar */ + SendMessage(PBM_SETPOS, uiPercentage, 0); + + /* format total download size */ + StrFormatByteSizeW(ulProgressMax, szProgressMax, _countof(szProgressMax)); + + /* generate the text on progress bar */ + ProgressText.Format(L"%u%% \x2014 %ls / %ls", + uiPercentage, + szProgress, + szProgressMax); + } + else + { + /* send the current progress to the progress bar */ + SendMessage(PBM_SETPOS, 0, 0); + + /* total size is not known, display only current size */ + ProgressText.Format(L"%ls...", szProgress); + } + + /* and finally display it */ + SendMessage(WM_SETTEXT, 0, (LPARAM) ProgressText.GetString()); + } + + LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) + { + PAINTSTRUCT ps; + HDC hDC = BeginPaint(&ps), hdcMem; + HBITMAP hbmMem; + HANDLE hOld; + RECT myRect; + UINT win_width, win_height; + + GetClientRect(&myRect); + + /* grab the progress bar rect size */ + win_width = myRect.right - myRect.left; + win_height = myRect.bottom - myRect.top; + + /* create an off-screen DC for double-buffering */ + hdcMem = CreateCompatibleDC(hDC); + hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height); + + hOld = SelectObject(hdcMem, hbmMem); + + /* call the original draw code and redirect it to our memory buffer */ + DefWindowProc(uMsg, (WPARAM) hdcMem, lParam); + + /* draw our nifty progress text over it */ + SelectFont(hdcMem, GetStockFont(DEFAULT_GUI_FONT)); + DrawShadowText(hdcMem, m_szProgressText.GetString(), m_szProgressText.GetLength(), + &myRect, + DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE, + GetSysColor(COLOR_CAPTIONTEXT), + GetSysColor(COLOR_3DSHADOW), + 1, 1); + + /* transfer the off-screen DC to the screen */ + BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY); + + /* free the off-screen DC */ + SelectObject(hdcMem, hOld); + DeleteObject(hbmMem); + DeleteDC(hdcMem); + + EndPaint(&ps); + return 0; + } + + LRESULT OnSetText(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) + { + if (lParam) + { + m_szProgressText = (PCWSTR) lParam; + } + return 0; + } + + BEGIN_MSG_MAP(CDownloaderProgress) + MESSAGE_HANDLER(WM_ERASEBKGND, OnPaint) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_SETTEXT, OnSetText) + END_MSG_MAP() +}; + class CDownloadDialog : public CComObjectRootEx<CComMultiThreadModelNoCS>, public IBindStatusCallback @@ -102,6 +225,7 @@ class CDownloadDialog : HWND m_hDialog; PBOOL m_pbCancelled; BOOL m_UrlHasBeenCopied; + CDownloaderProgress* m_progress; public: ~CDownloadDialog() @@ -109,11 +233,12 @@ public: //DestroyWindow(m_hDialog); } - HRESULT Initialize(HWND Dlg, BOOL *pbCancelled) + HRESULT Initialize(HWND Dlg, BOOL *pbCancelled, CDownloaderProgress* pProgress) { m_hDialog = Dlg; m_pbCancelled = pbCancelled; m_UrlHasBeenCopied = FALSE; + m_progress = pProgress; return S_OK; } @@ -145,47 +270,7 @@ public: HWND Item; LONG r; - Item = GetDlgItem(m_hDialog, IDC_DOWNLOAD_PROGRESS); - if (Item) - { - WCHAR szProgress[100]; - - /* format the bits and bytes into pretty and accessible units... */ - StrFormatByteSizeW(ulProgress, szProgress, _countof(szProgress)); - - /* use our subclassed progress bar text subroutine */ - ATL::CStringW m_ProgressText; - - if (ulProgressMax) - { - /* total size is known */ - WCHAR szProgressMax[100]; - UINT uiPercentage = ((ULONGLONG) ulProgress * 100) / ulProgressMax; - - /* send the current progress to the progress bar */ - SendMessageW(Item, PBM_SETPOS, uiPercentage, 0); - - /* format total download size */ - StrFormatByteSizeW(ulProgressMax, szProgressMax, _countof(szProgressMax)); - - /* generate the text on progress bar */ - m_ProgressText.Format(L"%u%% \x2014 %ls / %ls", - uiPercentage, - szProgress, - szProgressMax); - } - else - { - /* send the current progress to the progress bar */ - SendMessageW(Item, PBM_SETPOS, 0, 0); - - /* total size is not known, display only current size */ - m_ProgressText.Format(L"%ls...", - szProgress); - } - /* and finally display it */ - SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) m_ProgressText.GetString()); - } + m_progress->SetProgress(ulProgress, ulProgressMax); Item = GetDlgItem(m_hDialog, IDC_DOWNLOAD_STATUS); if (Item && szStatusText && wcslen(szStatusText) > 0 && m_UrlHasBeenCopied == FALSE) @@ -325,9 +410,9 @@ public: }; extern "C" -HRESULT WINAPI CDownloadDialog_Constructor(HWND Dlg, BOOL *pbCancelled, REFIID riid, LPVOID *ppv) +HRESULT WINAPI CDownloadDialog_Constructor(HWND Dlg, BOOL *pbCancelled, CDownloaderProgress* pProgress, REFIID riid, LPVOID *ppv) { - return ShellObjectCreatorInit<CDownloadDialog>(Dlg, pbCancelled, riid, ppv); + return ShellObjectCreatorInit<CDownloadDialog>(Dlg, pbCancelled, pProgress, riid, ppv); } #ifdef USE_CERT_PINNING @@ -389,20 +474,12 @@ class CDownloadManager { static ATL::CSimpleArray<DownloadInfo> AppsToInstallList; static CDowloadingAppsListView DownloadsListView; - - static VOID SetProgressMarquee(HWND Item, BOOL Enable); + static CDownloaderProgress ProgressBar; public: static VOID Add(DownloadInfo info); static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE); static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - static LRESULT CALLBACK DownloadProgressProc(HWND hWnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam, - UINT_PTR uIdSubclass, - DWORD_PTR dwRefData); - static DWORD WINAPI ThreadFunc(LPVOID Context); static BOOL DownloadListOfApplications(const ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal = FALSE); static BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal = FALSE); @@ -414,6 +491,8 @@ public: // CDownloadManager ATL::CSimpleArray<DownloadInfo> CDownloadManager::AppsToInstallList; CDowloadingAppsListView CDownloadManager::DownloadsListView; +CDownloaderProgress CDownloadManager::ProgressBar; + VOID CDownloadManager::Add(DownloadInfo info) { @@ -453,10 +532,9 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM w { // initialize the default values for our nifty progress bar // and subclass it so that it learns to print a status text - SendMessageW(Item, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); - SendMessageW(Item, PBM_SETPOS, 0, 0); - - SetWindowSubclass(Item, DownloadProgressProc, 0, 0); + ProgressBar.SubclassWindow(Item); + ProgressBar.SendMessage(PBM_SETRANGE, 0, MAKELPARAM(0, 100)); + ProgressBar.SendMessage(PBM_SETPOS, 0, 0); } // Add a ListView @@ -510,101 +588,6 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM w } } -LRESULT CALLBACK CDownloadManager::DownloadProgressProc(HWND hWnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam, - UINT_PTR uIdSubclass, - DWORD_PTR dwRefData) -{ - static ATL::CStringW szProgressText; - - switch (uMsg) - { - case WM_SETTEXT: - { - if (lParam) - { - szProgressText = (PCWSTR) lParam; - } - return TRUE; - } - - case WM_ERASEBKGND: - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hDC = BeginPaint(hWnd, &ps), hdcMem; - HBITMAP hbmMem; - HANDLE hOld; - RECT myRect; - UINT win_width, win_height; - - GetClientRect(hWnd, &myRect); - - /* grab the progress bar rect size */ - win_width = myRect.right - myRect.left; - win_height = myRect.bottom - myRect.top; - - /* create an off-screen DC for double-buffering */ - hdcMem = CreateCompatibleDC(hDC); - hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height); - - hOld = SelectObject(hdcMem, hbmMem); - - /* call the original draw code and redirect it to our memory buffer */ - DefSubclassProc(hWnd, uMsg, (WPARAM) hdcMem, lParam); - - /* draw our nifty progress text over it */ - SelectFont(hdcMem, GetStockFont(DEFAULT_GUI_FONT)); - DrawShadowText(hdcMem, szProgressText.GetString(), szProgressText.GetLength(), - &myRect, - DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE, - GetSysColor(COLOR_CAPTIONTEXT), - GetSysColor(COLOR_3DSHADOW), - 1, 1); - - /* transfer the off-screen DC to the screen */ - BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY); - - /* free the off-screen DC */ - SelectObject(hdcMem, hOld); - DeleteObject(hbmMem); - DeleteDC(hdcMem); - - EndPaint(hWnd, &ps); - return 0; - } - - /* Raymond Chen says that we should safely unsubclass all the things! - (
http://blogs.msdn.com/b/oldnewthing/archive/2003/11/11/55653.aspx
) */ - - case WM_NCDESTROY: - { - szProgressText.Empty(); - RemoveWindowSubclass(hWnd, DownloadProgressProc, uIdSubclass); - } - /* Fall-through */ - default: - return DefSubclassProc(hWnd, uMsg, wParam, lParam); - } -} - -VOID CDownloadManager::SetProgressMarquee(HWND Item, BOOL Enable) -{ - if (!Item) - return; - - DWORD style = GetWindowLongPtr(Item, GWL_STYLE); - if (!style) - return; - - if (!SetWindowLongPtr(Item, GWL_STYLE, (Enable ? style | PBS_MARQUEE : style & ~PBS_MARQUEE))) - return; - - SendMessageW(Item, PBM_SETMARQUEE, Enable, 0); -} - DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) { CComPtr<IBindStatusCallback> dl; @@ -650,9 +633,9 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) Item = GetDlgItem(hDlg, IDC_DOWNLOAD_PROGRESS); if (Item) { - SetProgressMarquee(Item, FALSE); - SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) L""); - SendMessageW(Item, PBM_SETPOS, 0, 0); + ProgressBar.SetMarquee(FALSE); + ProgressBar.SendMessage(WM_SETTEXT, 0, (LPARAM) L""); + ProgressBar.SendMessage(PBM_SETPOS, 0, 0); } // is this URL an update package for RAPPS? if so store it in a different place @@ -721,7 +704,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) // download it bTempfile = TRUE; - CDownloadDialog_Constructor(hDlg, &bCancelled, IID_PPV_ARG(IBindStatusCallback, &dl)); + CDownloadDialog_Constructor(hDlg, &bCancelled, &ProgressBar, IID_PPV_ARG(IBindStatusCallback, &dl)); if (dl == NULL) goto end; @@ -803,7 +786,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) if (!dwContentLen) { // content-length is not known, enable marquee mode - SetProgressMarquee(Item, TRUE); + ProgressBar.SetMarquee(TRUE); } free(urlComponents.lpszScheme); @@ -875,7 +858,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) if (!dwContentLen) { // set progress bar to 100% - SetProgressMarquee(Item, FALSE); + ProgressBar.SetMarquee(FALSE); dwContentLen = dwCurrentBytesRead; dl->OnProgress(dwCurrentBytesRead, dwContentLen, 0, InfoArray[iAppId].szUrl.GetString());
5 years, 4 months
1
0
0
0
[reactos] 13/17: [RAPPS] CDowloadingAppsListView: The download dialog doesn't use the layout engine so there is no need for it to be a CUiWindow
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=96fba571e04cc37cdb12e…
commit 96fba571e04cc37cdb12e8d0b14645f02f753f6b Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Mon Apr 29 11:05:35 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:48 2019 +0200 [RAPPS] CDowloadingAppsListView: The download dialog doesn't use the layout engine so there is no need for it to be a CUiWindow --- base/applications/rapps/loaddlg.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/base/applications/rapps/loaddlg.cpp b/base/applications/rapps/loaddlg.cpp index c4de1e29eec..f774d67f3dd 100644 --- a/base/applications/rapps/loaddlg.cpp +++ b/base/applications/rapps/loaddlg.cpp @@ -258,7 +258,7 @@ public: }; class CDowloadingAppsListView - : public CUiWindow<CListView> + : public CListView { public: HWND Create(HWND hwndParent) @@ -285,9 +285,8 @@ public: VOID SetDownloadStatus(INT ItemIndex, DownloadStatus Status) { - HWND hListView = GetWindow(); ATL::CStringW szBuffer = LoadStatusString(Status); - ListView_SetItemText(hListView, ItemIndex, 1, const_cast<LPWSTR>(szBuffer.GetString())); + SetItemText(ItemIndex, 1, szBuffer.GetString()); } BOOL AddItem(INT ItemIndex, LPWSTR lpText)
5 years, 4 months
1
0
0
0
[reactos] 12/17: [RAPPS] CMainWindow: use more atl
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=653894b972e1fd09af40e…
commit 653894b972e1fd09af40ef5a613e4ecb3e832f88 Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 18:15:55 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:48 2019 +0200 [RAPPS] CMainWindow: use more atl --- base/applications/rapps/gui.cpp | 57 +++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index 55df5152175..ad2a13f9a9f 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -802,38 +802,33 @@ private: // UpdateApplicationsList(ENUM_ALL_COMPONENTS); } - HTREEITEM AddCategory(HTREEITEM hRootItem, UINT TextIndex, UINT IconIndex) - { - return m_TreeView->AddCategory(hRootItem, TextIndex, IconIndex); - } - VOID InitCategoriesList() { HTREEITEM hRootItemInstalled, hRootItemAvailable; - hRootItemInstalled = AddCategory(TVI_ROOT, IDS_INSTALLED, IDI_CATEGORY); - AddCategory(hRootItemInstalled, IDS_APPLICATIONS, IDI_APPS); - AddCategory(hRootItemInstalled, IDS_UPDATES, IDI_APPUPD); - - AddCategory(TVI_ROOT, IDS_SELECTEDFORINST, IDI_SELECTEDFORINST); - - hRootItemAvailable = AddCategory(TVI_ROOT, IDS_AVAILABLEFORINST, IDI_CATEGORY); - AddCategory(hRootItemAvailable, IDS_CAT_AUDIO, IDI_CAT_AUDIO); - AddCategory(hRootItemAvailable, IDS_CAT_VIDEO, IDI_CAT_VIDEO); - AddCategory(hRootItemAvailable, IDS_CAT_GRAPHICS, IDI_CAT_GRAPHICS); - AddCategory(hRootItemAvailable, IDS_CAT_GAMES, IDI_CAT_GAMES); - AddCategory(hRootItemAvailable, IDS_CAT_INTERNET, IDI_CAT_INTERNET); - AddCategory(hRootItemAvailable, IDS_CAT_OFFICE, IDI_CAT_OFFICE); - AddCategory(hRootItemAvailable, IDS_CAT_DEVEL, IDI_CAT_DEVEL); - AddCategory(hRootItemAvailable, IDS_CAT_EDU, IDI_CAT_EDU); - AddCategory(hRootItemAvailable, IDS_CAT_ENGINEER, IDI_CAT_ENGINEER); - AddCategory(hRootItemAvailable, IDS_CAT_FINANCE, IDI_CAT_FINANCE); - AddCategory(hRootItemAvailable, IDS_CAT_SCIENCE, IDI_CAT_SCIENCE); - AddCategory(hRootItemAvailable, IDS_CAT_TOOLS, IDI_CAT_TOOLS); - AddCategory(hRootItemAvailable, IDS_CAT_DRIVERS, IDI_CAT_DRIVERS); - AddCategory(hRootItemAvailable, IDS_CAT_LIBS, IDI_CAT_LIBS); - AddCategory(hRootItemAvailable, IDS_CAT_THEMES, IDI_CAT_THEMES); - AddCategory(hRootItemAvailable, IDS_CAT_OTHER, IDI_CAT_OTHER); + hRootItemInstalled = m_TreeView->AddCategory(TVI_ROOT, IDS_INSTALLED, IDI_CATEGORY); + m_TreeView->AddCategory(hRootItemInstalled, IDS_APPLICATIONS, IDI_APPS); + m_TreeView->AddCategory(hRootItemInstalled, IDS_UPDATES, IDI_APPUPD); + + m_TreeView->AddCategory(TVI_ROOT, IDS_SELECTEDFORINST, IDI_SELECTEDFORINST); + + hRootItemAvailable = m_TreeView->AddCategory(TVI_ROOT, IDS_AVAILABLEFORINST, IDI_CATEGORY); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_AUDIO, IDI_CAT_AUDIO); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_VIDEO, IDI_CAT_VIDEO); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_GRAPHICS, IDI_CAT_GRAPHICS); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_GAMES, IDI_CAT_GAMES); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_INTERNET, IDI_CAT_INTERNET); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_OFFICE, IDI_CAT_OFFICE); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_DEVEL, IDI_CAT_DEVEL); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_EDU, IDI_CAT_EDU); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_ENGINEER, IDI_CAT_ENGINEER); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_FINANCE, IDI_CAT_FINANCE); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_SCIENCE, IDI_CAT_SCIENCE); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_TOOLS, IDI_CAT_TOOLS); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_DRIVERS, IDI_CAT_DRIVERS); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_LIBS, IDI_CAT_LIBS); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_THEMES, IDI_CAT_THEMES); + m_TreeView->AddCategory(hRootItemAvailable, IDS_CAT_OTHER, IDI_CAT_OTHER); m_TreeView->SetImageList(); m_TreeView->Expand(hRootItemInstalled, TVE_EXPAND); @@ -1562,7 +1557,7 @@ private: break; case ID_SEARCH: - ::SetFocus(m_SearchBar->m_hWnd); + m_SearchBar->SetFocus(); break; case ID_INSTALL: @@ -1871,8 +1866,8 @@ VOID ShowMainWindow(INT nShowCmd) return; /* Maximize it if we must */ - ShowWindow(hMainWnd, ((SettingsInfo.bSaveWndPos && SettingsInfo.Maximized) ? SW_MAXIMIZE : nShowCmd)); - UpdateWindow(hMainWnd); + wnd->ShowWindow((SettingsInfo.bSaveWndPos && SettingsInfo.Maximized) ? SW_MAXIMIZE : nShowCmd); + wnd->UpdateWindow(); /* Load the menu hotkeys */ KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS));
5 years, 4 months
1
0
0
0
[reactos] 11/17: [RAPPS] CMainWindow: remove unused functions , and the globals g_MainWindow and hListView
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=872289446dbe14ba9e6dc…
commit 872289446dbe14ba9e6dcaa1c48080e52cd7da64 Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 06:30:32 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:48 2019 +0200 [RAPPS] CMainWindow: remove unused functions , and the globals g_MainWindow and hListView --- base/applications/rapps/CMakeLists.txt | 1 - base/applications/rapps/gui.cpp | 148 ++++++-------------------------- base/applications/rapps/include/gui.h | 16 ---- base/applications/rapps/include/rapps.h | 1 - base/applications/rapps/installed.cpp | 1 - base/applications/rapps/misc.cpp | 1 - 6 files changed, 24 insertions(+), 144 deletions(-) diff --git a/base/applications/rapps/CMakeLists.txt b/base/applications/rapps/CMakeLists.txt index f3dea22852b..ea0cf7d34f8 100644 --- a/base/applications/rapps/CMakeLists.txt +++ b/base/applications/rapps/CMakeLists.txt @@ -20,7 +20,6 @@ list(APPEND SOURCE unattended.cpp include/rapps.h include/available.h - include/gui.h include/dialogs.h include/installed.h include/crichedit.h diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index adba84ac449..55df5152175 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -26,8 +26,6 @@ #define LISTVIEW_ICON_SIZE 24 #define TREEVIEW_ICON_SIZE 24 -HWND hListView = NULL; - INT GetSystemColorDepth() { DEVMODEW pDevMode; @@ -508,24 +506,6 @@ public: bIsAscending = !bIsAscending; } - PVOID GetLParam(INT Index) - { - INT ItemIndex; - - if (Index == -1) - { - ItemIndex = (INT) SendMessage(LVM_GETNEXTITEM, -1, LVNI_FOCUSED); - if (ItemIndex == -1) - return NULL; - } - else - { - ItemIndex = Index; - } - - return (PVOID) GetItemData(ItemIndex); - } - BOOL AddColumn(INT Index, ATL::CStringW& Text, INT Width, INT Format) { return AddColumn(Index, const_cast<LPWSTR>(Text.GetString()), Width, Format); @@ -898,8 +878,7 @@ private: m_ListView->m_HorizontalAlignment = UiAlign_Stretch; m_HSplitter->First().Append(m_ListView); - hListView = m_ListView->Create(m_hWnd); - return hListView != NULL; + return m_ListView->Create(m_hWnd) != NULL; } BOOL CreateRichEdit() @@ -1647,7 +1626,7 @@ private: while (Count >= 0) { - Info = (PINSTALLED_INFO) ListViewGetlParam(Count); + Info = (PINSTALLED_INFO) m_ListView->GetItemData(Count); if (Info) { RegCloseKey(Info->hSubKey); @@ -1702,7 +1681,7 @@ private: INT Index; HICON hIcon = NULL; - HIMAGELIST hImageListView = ListView_GetImageList(hListView, LVSIL_SMALL); + HIMAGELIST hImageListView = (HIMAGELIST)m_ListView->SendMessage(LVM_GETIMAGELIST, LVSIL_SMALL, 0); if (!SearchPatternMatch(Info->m_szName.GetString(), szSearchPattern) && !SearchPatternMatch(Info->m_szDesc.GetString(), szSearchPattern)) @@ -1876,116 +1855,37 @@ public: return CWindowImpl::Create(NULL, r, szWindowName.GetString(), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE); } - - CStatusBar * GetStatusBar() - { - return m_StatusBar; - } - - CAppsListView * GetListView() - { - return m_ListView; - } - - CRichEdit * GetRichEdit() - { - return m_RichEdit; - } - - CAvailableApps * GetAvailableApps() - { - return &m_AvailableApps; - } }; -// global interface -CMainWindow * g_MainWindow; - -HWND CreateMainWindow() -{ - g_MainWindow = new CMainWindow(); - return g_MainWindow->Create(); -} - -DWORD_PTR ListViewGetlParam(INT item) -{ - if (item < 0) - { - item = g_MainWindow->GetListView()->GetSelectionMark(); - } - return g_MainWindow->GetListView()->GetItemData(item); -} - -VOID SetStatusBarText(LPCWSTR szText) -{ - g_MainWindow->GetStatusBar()->SetText(szText); -} - -INT ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpName, LPARAM lParam) -{ - return g_MainWindow->GetListView()->AddItem(ItemIndex, IconIndex, lpName, lParam); -} - -VOID NewRichEditText(LPCWSTR szText, DWORD flags) -{ - g_MainWindow->GetRichEdit()->SetText(szText, flags); -} - -VOID InsertRichEditText(LPCWSTR szText, DWORD flags) -{ - g_MainWindow->GetRichEdit()->InsertText(szText, flags); -} - -CAvailableApps* GetAvailableApps() -{ - return g_MainWindow->GetAvailableApps(); -} - -// ATL version of functions above -VOID SetStatusBarText(const ATL::CStringW& szText) -{ - SetStatusBarText(szText.GetString()); -} - -INT ListViewAddItem(INT ItemIndex, INT IconIndex, const ATL::CStringW& Name, LPARAM lParam) -{ - return ListViewAddItem(ItemIndex, IconIndex, const_cast<LPWSTR>(Name.GetString()), lParam); -} - -VOID NewRichEditText(const ATL::CStringW& szText, DWORD flags) -{ - NewRichEditText(szText.GetString(), flags); -} - -VOID InsertRichEditText(const ATL::CStringW& szText, DWORD flags) -{ - InsertRichEditText(szText.GetString(), flags); -} - VOID ShowMainWindow(INT nShowCmd) { HACCEL KeyBrd; MSG Msg; - hMainWnd = CreateMainWindow(); + CMainWindow* wnd = new CMainWindow(); + if (!wnd) + return; - if (hMainWnd) - { - /* Maximize it if we must */ - ShowWindow(hMainWnd, ((SettingsInfo.bSaveWndPos && SettingsInfo.Maximized) ? SW_MAXIMIZE : nShowCmd)); - UpdateWindow(hMainWnd); + hMainWnd = wnd->Create(); + if (!hMainWnd) + return; - /* Load the menu hotkeys */ - KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS)); + /* Maximize it if we must */ + ShowWindow(hMainWnd, ((SettingsInfo.bSaveWndPos && SettingsInfo.Maximized) ? SW_MAXIMIZE : nShowCmd)); + UpdateWindow(hMainWnd); - /* Message Loop */ - while (GetMessageW(&Msg, NULL, 0, 0)) + /* Load the menu hotkeys */ + KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS)); + + /* Message Loop */ + while (GetMessageW(&Msg, NULL, 0, 0)) + { + if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg)) { - if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg)) - { - TranslateMessage(&Msg); - DispatchMessageW(&Msg); - } + TranslateMessage(&Msg); + DispatchMessageW(&Msg); } - } + } + + delete wnd; } diff --git a/base/applications/rapps/include/gui.h b/base/applications/rapps/include/gui.h deleted file mode 100644 index 974a24d3d29..00000000000 --- a/base/applications/rapps/include/gui.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include <windef.h> -#include <atlstr.h> - -DWORD_PTR ListViewGetlParam(INT item); -INT ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpName, LPARAM lParam); -VOID SetStatusBarText(LPCWSTR szText); -VOID NewRichEditText(LPCWSTR szText, DWORD flags); -VOID InsertRichEditText(LPCWSTR szText, DWORD flags); - -VOID SetStatusBarText(const ATL::CStringW& szText); -INT ListViewAddItem(INT ItemIndex, INT IconIndex, const ATL::CStringW& Name, LPARAM lParam); -VOID NewRichEditText(const ATL::CStringW& szText, DWORD flags); -VOID InsertRichEditText(const ATL::CStringW& szText, DWORD flags); -CAvailableApps * GetAvailableApps(); -extern HWND hListView; diff --git a/base/applications/rapps/include/rapps.h b/base/applications/rapps/include/rapps.h index d3534412703..43d8a5e8e0b 100644 --- a/base/applications/rapps/include/rapps.h +++ b/base/applications/rapps/include/rapps.h @@ -7,6 +7,5 @@ #include "installed.h" #include "available.h" #include "misc.h" -#include "gui.h" #endif /* _RAPPS_H */ diff --git a/base/applications/rapps/installed.cpp b/base/applications/rapps/installed.cpp index dda0bbfdcff..c35f141f526 100644 --- a/base/applications/rapps/installed.cpp +++ b/base/applications/rapps/installed.cpp @@ -10,7 +10,6 @@ #include "installed.h" -#include "gui.h" #include "misc.h" BOOL INSTALLED_INFO::GetApplicationString(LPCWSTR lpKeyName, ATL::CStringW& String) diff --git a/base/applications/rapps/misc.cpp b/base/applications/rapps/misc.cpp index cb18503cc13..d7bd62c9d99 100644 --- a/base/applications/rapps/misc.cpp +++ b/base/applications/rapps/misc.cpp @@ -9,7 +9,6 @@ */ #include "rapps.h" -#include "gui.h" #include "misc.h" static HANDLE hLog = NULL;
5 years, 4 months
1
0
0
0
[reactos] 10/17: [RAPPS] CMainWindow: Make SelectedEnumType a member
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=69bd96e09f57672e6e8e3…
commit 69bd96e09f57672e6e8e3955f99d47c621ea3d7b Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 18:08:55 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:47 2019 +0200 [RAPPS] CMainWindow: Make SelectedEnumType a member --- base/applications/rapps/gui.cpp | 4 +++- base/applications/rapps/include/winmain.h | 1 - base/applications/rapps/winmain.cpp | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index be6da8ff8f4..adba84ac449 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -792,12 +792,14 @@ class CMainWindow : BOOL bUpdating; ATL::CStringW szSearchPattern; + INT SelectedEnumType; public: CMainWindow() : m_ClientPanel(NULL), pLink(NULL), - bSearchEnabled(FALSE) + bSearchEnabled(FALSE), + SelectedEnumType(ENUM_ALL_INSTALLED) { } diff --git a/base/applications/rapps/include/winmain.h b/base/applications/rapps/include/winmain.h index bee3b964927..d941e52cfa2 100644 --- a/base/applications/rapps/include/winmain.h +++ b/base/applications/rapps/include/winmain.h @@ -25,7 +25,6 @@ typedef SETTINGS_INFO *PSETTINGS_INFO; extern HWND hMainWnd; extern HINSTANCE hInst; -extern INT SelectedEnumType; extern SETTINGS_INFO SettingsInfo; VOID SaveSettings(HWND hwnd); diff --git a/base/applications/rapps/winmain.cpp b/base/applications/rapps/winmain.cpp index 5d731c54368..58e100dc661 100644 --- a/base/applications/rapps/winmain.cpp +++ b/base/applications/rapps/winmain.cpp @@ -15,7 +15,6 @@ HWND hMainWnd; HINSTANCE hInst; -INT SelectedEnumType = ENUM_ALL_INSTALLED; SETTINGS_INFO SettingsInfo; class CRAppsModule : public CComModule
5 years, 4 months
1
0
0
0
[reactos] 09/17: [RAPPS] CMainWindow: Move gui part of UninstallApplication in it
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8a401eb299e75b145263c…
commit 8a401eb299e75b145263c4db952dd88e35c4bd31 Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 16:47:23 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:47 2019 +0200 [RAPPS] CMainWindow: Move gui part of UninstallApplication in it --- base/applications/rapps/gui.cpp | 31 ++++++++++++++--------- base/applications/rapps/include/installed.h | 3 +-- base/applications/rapps/installed.cpp | 38 +++-------------------------- 3 files changed, 24 insertions(+), 48 deletions(-) diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index b30cf80d14a..be6da8ff8f4 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -511,7 +511,6 @@ public: PVOID GetLParam(INT Index) { INT ItemIndex; - LVITEMW Item; if (Index == -1) { @@ -524,14 +523,7 @@ public: ItemIndex = Index; } - ZeroMemory(&Item, sizeof(Item)); - - Item.mask = LVIF_PARAM; - Item.iItem = ItemIndex; - if (!GetItem(&Item)) - return NULL; - - return (PVOID) Item.lParam; + return (PVOID) GetItemData(ItemIndex); } BOOL AddColumn(INT Index, ATL::CStringW& Text, INT Width, INT Format) @@ -1134,6 +1126,23 @@ private: } } + BOOL UninstallSelectedApp(BOOL bModify) + { + WCHAR szAppName[MAX_STR_LEN]; + + if (!IsInstalledEnum(SelectedEnumType)) + return FALSE; + + INT ItemIndex = m_ListView->GetNextItem(-1, LVNI_FOCUSED); + if (ItemIndex == -1) + return FALSE; + + m_ListView->GetItemText(ItemIndex, 0, szAppName, _countof(szAppName)); + WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_REMOVE, szAppName); + + PINSTALLED_INFO ItemInfo = (PINSTALLED_INFO)m_ListView->GetItemData(ItemIndex); + return UninstallApplication(ItemInfo, bModify); + } BOOL ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT& theResult, DWORD dwMapId) { theResult = 0; @@ -1593,12 +1602,12 @@ private: break; case ID_UNINSTALL: - if (UninstallApplication(-1, FALSE)) + if (UninstallSelectedApp(FALSE)) UpdateApplicationsList(-1); break; case ID_MODIFY: - if (UninstallApplication(-1, TRUE)) + if (UninstallSelectedApp(TRUE)) UpdateApplicationsList(-1); break; diff --git a/base/applications/rapps/include/installed.h b/base/applications/rapps/include/installed.h index 876c7423522..76a12418c1c 100644 --- a/base/applications/rapps/include/installed.h +++ b/base/applications/rapps/include/installed.h @@ -18,5 +18,4 @@ typedef BOOL(CALLBACK *APPENUMPROC)(INT ItemIndex, ATL::CStringW &Name, PINSTALL BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc, PVOID param); BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString); -BOOL UninstallApplication(INT Index, BOOL bModify); -VOID RemoveAppFromRegistry(INT Index); +BOOL UninstallApplication(PINSTALLED_INFO ItemInfo, BOOL bModify); diff --git a/base/applications/rapps/installed.cpp b/base/applications/rapps/installed.cpp index cb53b88be7f..dda0bbfdcff 100644 --- a/base/applications/rapps/installed.cpp +++ b/base/applications/rapps/installed.cpp @@ -38,48 +38,16 @@ BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString) return FALSE; } -BOOL UninstallApplication(INT Index, BOOL bModify) +BOOL UninstallApplication(PINSTALLED_INFO ItemInfo, BOOL bModify) { LPCWSTR szModify = L"ModifyPath"; LPCWSTR szUninstall = L"UninstallString"; - WCHAR szPath[MAX_PATH]; - WCHAR szAppName[MAX_STR_LEN]; DWORD dwType, dwSize; - INT ItemIndex; - LVITEMW Item; - HKEY hKey; - PINSTALLED_INFO ItemInfo; - - if (!IsInstalledEnum(SelectedEnumType)) - return FALSE; - - if (Index == -1) - { - ItemIndex = (INT) SendMessageW(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED); - if (ItemIndex == -1) - return FALSE; - } - else - { - ItemIndex = Index; - } - - ListView_GetItemText(hListView, ItemIndex, 0, szAppName, _countof(szAppName)); - WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_REMOVE, szAppName); - - ZeroMemory(&Item, sizeof(Item)); - - Item.mask = LVIF_PARAM; - Item.iItem = ItemIndex; - if (!ListView_GetItem(hListView, &Item)) - return FALSE; - - ItemInfo = (PINSTALLED_INFO) Item.lParam; - hKey = ItemInfo->hSubKey; + WCHAR szPath[MAX_PATH]; dwType = REG_SZ; dwSize = MAX_PATH * sizeof(WCHAR); - if (RegQueryValueExW(hKey, + if (RegQueryValueExW(ItemInfo->hSubKey, bModify ? szModify : szUninstall, NULL, &dwType,
5 years, 4 months
1
0
0
0
[reactos] 08/17: [RAPPS] CMainWindow: make szSearchPattern a member
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=85d60552014b85fd803b8…
commit 85d60552014b85fd803b87f2a4988e60abb8d45f Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 16:21:16 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:47 2019 +0200 [RAPPS] CMainWindow: make szSearchPattern a member --- base/applications/rapps/gui.cpp | 2 ++ base/applications/rapps/include/gui.h | 4 ---- base/applications/rapps/winmain.cpp | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index 064ec4ee463..b30cf80d14a 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -799,6 +799,8 @@ class CMainWindow : BOOL bSearchEnabled; BOOL bUpdating; + ATL::CStringW szSearchPattern; + public: CMainWindow() : m_ClientPanel(NULL), diff --git a/base/applications/rapps/include/gui.h b/base/applications/rapps/include/gui.h index 3636ac1a3c3..974a24d3d29 100644 --- a/base/applications/rapps/include/gui.h +++ b/base/applications/rapps/include/gui.h @@ -2,9 +2,6 @@ #include <windef.h> #include <atlstr.h> -class CAvailableApps; - -HWND CreateMainWindow(); DWORD_PTR ListViewGetlParam(INT item); INT ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpName, LPARAM lParam); VOID SetStatusBarText(LPCWSTR szText); @@ -17,4 +14,3 @@ VOID NewRichEditText(const ATL::CStringW& szText, DWORD flags); VOID InsertRichEditText(const ATL::CStringW& szText, DWORD flags); CAvailableApps * GetAvailableApps(); extern HWND hListView; -extern ATL::CStringW szSearchPattern; diff --git a/base/applications/rapps/winmain.cpp b/base/applications/rapps/winmain.cpp index 5660db81acd..5d731c54368 100644 --- a/base/applications/rapps/winmain.cpp +++ b/base/applications/rapps/winmain.cpp @@ -18,8 +18,6 @@ HINSTANCE hInst; INT SelectedEnumType = ENUM_ALL_INSTALLED; SETTINGS_INFO SettingsInfo; -ATL::CStringW szSearchPattern; - class CRAppsModule : public CComModule { public:
5 years, 4 months
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
29
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Results per page:
10
25
50
100
200