ReactOS 0.4.16-dev-814-g656a5dc
CAppScrnshotPreview Class Reference

#include <appview.h>

Inheritance diagram for CAppScrnshotPreview:
Collaboration diagram for CAppScrnshotPreview:

Public Member Functions

HWND Create (HWND hParent)
 
VOID PreviousDisplayCleanup ()
 
VOID DisplayEmpty ()
 
BOOL DisplayImage (LPCWSTR lpszLocation)
 
int GetRequestedWidth (int Height)
 
 CAppScrnshotPreview (const CStringW &BasePath)
 
 ~CAppScrnshotPreview ()
 
- Public Member Functions inherited from ATL::CWindowImpl< CAppScrnshotPreview >
HWND Create (HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
 
- Public Member Functions inherited from ATL::CWindowImplBaseT< TBase, TWinTraits >
 CWindowImplBaseT ()
 
virtual void OnFinalMessage (HWND)
 
BOOL SubclassWindow (HWND hWnd)
 
HWND UnsubclassWindow (BOOL bForce=FALSE)
 
virtual WNDPROC GetWindowProc ()
 
LRESULT DefWindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam)
 
HWND Create (HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, _U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam)
 
- Public Member Functions inherited from ATL::CWindowImplRoot< TBase >
 CWindowImplRoot ()
 
virtual ~CWindowImplRoot ()
 
- Public Member Functions inherited from ATL::CWindow
 CWindow (HWND hWnd=NULL)
 
 operator HWND () const
 
UINT ArrangeIconicWindows ()
 
void Attach (HWND hWndNew)
 
HDC BeginPaint (LPPAINTSTRUCT lpPaint)
 
BOOL BringWindowToTop ()
 
BOOL CenterWindow (HWND hWndCenter=NULL)
 
BOOL ChangeClipboardChain (HWND hWndNewNext)
 
BOOL CheckDlgButton (int nIDButton, UINT nCheck)
 
BOOL CheckRadioButton (int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
 
HWND ChildWindowFromPoint (POINT point) const
 
HWND ChildWindowFromPointEx (POINT point, UINT uFlags) const
 
BOOL ClientToScreen (LPPOINT lpPoint) const
 
BOOL ClientToScreen (LPRECT lpRect) const
 
HWND Create (LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
 
BOOL CreateCaret (HBITMAP pBitmap)
 
BOOL CreateGrayCaret (int nWidth, int nHeight)
 
BOOL CreateSolidCaret (int nWidth, int nHeight)
 
HDWP DeferWindowPos (HDWP hWinPosInfo, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags)
 
BOOL DestroyWindow ()
 
HWND Detach ()
 
int DlgDirList (LPTSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT nFileType)
 
int DlgDirListComboBox (LPTSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT nFileType)
 
BOOL DlgDirSelect (LPTSTR lpString, int nCount, int nIDListBox)
 
BOOL DlgDirSelectComboBox (LPTSTR lpString, int nCount, int nIDComboBox)
 
void DragAcceptFiles (BOOL bAccept=TRUE)
 
BOOL DrawMenuBar ()
 
BOOL EnableScrollBar (UINT uSBFlags, UINT uArrowFlags=ESB_ENABLE_BOTH)
 
BOOL EnableWindow (BOOL bEnable=TRUE)
 
void EndPaint (LPPAINTSTRUCT lpPaint)
 
BOOL FlashWindow (BOOL bInvert)
 
BOOL GetClientRect (LPRECT lpRect) const
 
HDC GetDC ()
 
HDC GetDCEx (HRGN hRgnClip, DWORD flags)
 
HWND GetDescendantWindow (int nID) const
 
HRESULT GetDlgControl (int nID, REFIID iid, void **ppCtrl)
 
int GetDlgCtrlID () const
 
HRESULT GetDlgHost (int nID, REFIID iid, void **ppHost)
 
HWND GetDlgItem (_In_ int nID) const
 
UINT GetDlgItemInt (_In_ int nID, _Out_opt_ BOOL *lpTrans=NULL, _In_ BOOL bSigned=TRUE) const
 
UINT GetDlgItemText (_In_ int nID, _Out_writes_to_(nMaxCount, return+1) LPTSTR lpStr, _In_ int nMaxCount) const
 
BOOL GetDlgItemText (_In_ int nID, _Inout_ _Outref_result_maybenull_ _Post_z_ BSTR &bstrText) const
 
DWORD GetExStyle () const
 
HFONT GetFont () const
 
DWORD GetHotKey () const
 
HICON GetIcon (BOOL bBigIcon=TRUE) const
 
HWND GetLastActivePopup () const
 
HMENU GetMenu () const
 
HWND GetNextDlgGroupItem (HWND hWndCtl, BOOL bPrevious=FALSE) const
 
HWND GetNextDlgTabItem (HWND hWndCtl, BOOL bPrevious=FALSE) const
 
CWindow GetParent () const
 
BOOL GetScrollInfo (int nBar, LPSCROLLINFO lpScrollInfo)
 
BOOL GetScrollPos (int nBar)
 
BOOL GetScrollRange (int nBar, LPINT lpMinPos, LPINT lpMaxPos) const
 
DWORD GetStyle () const
 
HMENU GetSystemMenu (BOOL bRevert)
 
HWND GetTopLevelParent () const
 
HWND GetTopLevelWindow () const
 
HWND GetTopWindow () const
 
BOOL GetUpdateRect (LPRECT lpRect, BOOL bErase=FALSE)
 
int GetUpdateRgn (HRGN hRgn, BOOL bErase=FALSE)
 
HWND GetWindow (UINT nCmd) const
 
DWORD GetWindowContextHelpId () const
 
HDC GetWindowDC ()
 
LONG GetWindowLong (int nIndex) const
 
LONG_PTR GetWindowLongPtr (int nIndex) const
 
BOOL GetWindowPlacement (WINDOWPLACEMENT *lpwndpl) const
 
DWORD GetWindowProcessID ()
 
BOOL GetWindowRect (LPRECT lpRect) const
 
int GetWindowRgn (HRGN hRgn)
 
int GetWindowText (_Out_writes_to_(nMaxCount, return+1) LPTSTR lpszStringBuf, _In_ int nMaxCount) const
 
BOOL GetWindowText (_Inout_ _Outref_result_maybenull_ _Post_z_ BSTR &bstrText) const
 
int GetWindowTextLength () const
 
DWORD GetWindowThreadID ()
 
WORD GetWindowWord (int nIndex) const
 
void GotoDlgCtrl (HWND hWndCtrl) const
 
BOOL HideCaret ()
 
BOOL HiliteMenuItem (HMENU hMenu, UINT uHiliteItem, UINT uHilite)
 
BOOL Invalidate (BOOL bErase=TRUE)
 
BOOL InvalidateRect (LPCRECT lpRect, BOOL bErase=TRUE)
 
void InvalidateRgn (HRGN hRgn, BOOL bErase=TRUE)
 
BOOL IsChild (const HWND hWnd) const
 
BOOL IsDialogMessage (LPMSG lpMsg)
 
UINT IsDlgButtonChecked (int nIDButton) const
 
BOOL IsIconic () const
 
BOOL IsParentDialog ()
 
BOOL IsWindow () const
 
BOOL IsWindowEnabled () const
 
BOOL IsWindowVisible () const
 
BOOL IsWindowUnicode ()
 
BOOL IsZoomed () const
 
BOOL KillTimer (UINT_PTR nIDEvent)
 
BOOL LockWindowUpdate (BOOL bLock=TRUE)
 
int MapWindowPoints (HWND hWndTo, LPPOINT lpPoint, UINT nCount) const
 
int MapWindowPoints (HWND hWndTo, LPRECT lpRect) const
 
int MessageBox (LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
 
BOOL ModifyStyle (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
 
BOOL ModifyStyleEx (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
 
BOOL MoveWindow (int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
 
void NextDlgCtrl () const
 
BOOL OpenClipboard ()
 
BOOL PostMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
void PrevDlgCtrl () const
 
void Print (HDC hDC, DWORD dwFlags) const
 
void PrintClient (HDC hDC, DWORD dwFlags) const
 
BOOL RedrawWindow (LPCRECT lpRectUpdate=NULL, HRGN hRgnUpdate=NULL, UINT flags=RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE)
 
int ReleaseDC (HDC hDC)
 
BOOL ResizeClient (int nWidth, int nHeight, BOOL bRedraw=FALSE)
 
BOOL ScreenToClient (LPPOINT lpPoint) const
 
BOOL ScrollWindow (int xAmount, int yAmount, LPCRECT lpRect=NULL, LPCRECT lpClipRect=NULL)
 
int ScrollWindowEx (int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate, UINT flags)
 
LRESULT SendDlgItemMessage (int nID, UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
LRESULT SendMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
void SendMessageToDescendants (UINT message, WPARAM wParam=0, LPARAM lParam=0, BOOL bDeep=TRUE)
 
BOOL SendNotifyMessage (UINT message, WPARAM wParam=0, LPARAM lParam=0)
 
HWND SetActiveWindow ()
 
HWND SetCapture ()
 
HWND SetClipboardViewer ()
 
int SetDlgCtrlID (int nID)
 
BOOL SetDlgItemInt (int nID, UINT nValue, BOOL bSigned=TRUE)
 
BOOL SetDlgItemText (int nID, LPCTSTR lpszString)
 
HWND SetFocus ()
 
void SetFont (HFONT hFont, BOOL bRedraw=TRUE)
 
int SetHotKey (WORD wVirtualKeyCode, WORD wModifiers)
 
HICON SetIcon (HICON hIcon, BOOL bBigIcon=TRUE)
 
BOOL SetMenu (HMENU hMenu)
 
HWND SetParent (HWND hWndNewParent)
 
void SetRedraw (BOOL bRedraw=TRUE)
 
int SetScrollInfo (int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw=TRUE)
 
int SetScrollPos (int nBar, int nPos, BOOL bRedraw=TRUE)
 
BOOL SetScrollRange (int nBar, int nMinPos, int nMaxPos, BOOL bRedraw=TRUE)
 
UINT_PTR SetTimer (UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
 
BOOL SetWindowContextHelpId (DWORD dwContextHelpId)
 
LONG SetWindowLong (int nIndex, LONG dwNewLong)
 
LONG_PTR SetWindowLongPtr (int nIndex, LONG_PTR dwNewLong)
 
BOOL SetWindowPlacement (const WINDOWPLACEMENT *lpwndpl)
 
BOOL SetWindowPos (HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
 
int SetWindowRgn (HRGN hRgn, BOOL bRedraw=FALSE)
 
BOOL SetWindowText (LPCTSTR lpszString)
 
WORD SetWindowWord (int nIndex, WORD wNewWord)
 
BOOL ShowCaret ()
 
BOOL ShowOwnedPopups (BOOL bShow=TRUE)
 
BOOL ShowScrollBar (UINT nBar, BOOL bShow=TRUE)
 
BOOL ShowWindow (int nCmdShow)
 
BOOL ShowWindowAsync (int nCmdShow)
 
BOOL UpdateWindow ()
 
BOOL ValidateRect (LPCRECT lpRect)
 
BOOL ValidateRgn (HRGN hRgn)
 
BOOL WinHelp (LPCTSTR lpszHelp, UINT nCmd=HELP_CONTEXT, DWORD dwData=0)
 
virtual BOOL ProcessWindowMessage (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID)=0
 

Static Public Member Functions

static ATL::CWndClassInfoGetWndClassInfo ()
 
- Static Public Member Functions inherited from ATL::CWindowImpl< CAppScrnshotPreview >
static LPCTSTR GetWndCaption ()
 
- Static Public Member Functions inherited from ATL::CWindowImplBaseT< TBase, TWinTraits >
static DWORD GetWndStyle (DWORD dwStyle)
 
static DWORD GetWndExStyle (DWORD dwExStyle)
 
static LRESULT CALLBACK StartWindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
- Static Public Member Functions inherited from ATL::CWindow
static LPCTSTR GetWndClassName ()
 
static LRESULT SendMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 

Private Member Functions

BOOL ProcessWindowMessage (HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT &theResult, DWORD dwMapId)
 
VOID DisplayLoading ()
 
VOID DisplayFailed ()
 
BOOL DisplayFile (LPCWSTR lpszFileName)
 
VOID SetStatus (SCRNSHOT_STATUS Status)
 
VOID PaintOnDC (HDC hdc, int width, int height, BOOL bDrawBkgnd)
 
float GetLoadingDotWidth (int width, int height)
 
float GetFrameDotShift (int Frame, int width, int height)
 

Private Attributes

CStringW m_BasePath
 
SCRNSHOT_STATUS ScrnshotPrevStauts = SCRNSHOT_PREV_EMPTY
 
Gdiplus::Image * pImage = NULL
 
HICON hBrokenImgIcon = NULL
 
BOOL bLoadingTimerOn = FALSE
 
int LoadingAnimationFrame = 0
 
int BrokenImgSize = BROKENIMG_ICON_SIZE
 
pASYNCINET AsyncInet = NULL
 
LONGLONG ContentID = 0
 
CStringW TempImagePath
 

Additional Inherited Members

- Public Types inherited from ATL::CWindowImplRoot< TBase >
enum  { WINSTATE_DESTROYED = 0x00000001 }
 
- Public Attributes inherited from ATL::CWindowImplBaseT< TBase, TWinTraits >
WNDPROC m_pfnSuperWindowProc
 
- Public Attributes inherited from ATL::CWindowImplRoot< TBase >
CWndProcThunk m_thunk
 
const _ATL_MSGm_pCurrentMsg
 
DWORD m_dwState
 
- Public Attributes inherited from ATL::CWindow
HWND m_hWnd
 
- Static Public Attributes inherited from ATL::CWindow
static RECT rcDefault
 

Detailed Description

Definition at line 97 of file appview.h.

Constructor & Destructor Documentation

◆ CAppScrnshotPreview()

CAppScrnshotPreview::CAppScrnshotPreview ( const CStringW BasePath)

Definition at line 352 of file appview.cpp.

352 : m_BasePath(BasePath)
353{
354}
CStringW m_BasePath
Definition: appview.h:100

◆ ~CAppScrnshotPreview()

CAppScrnshotPreview::~CAppScrnshotPreview ( )

Definition at line 767 of file appview.cpp.

768{
770}
VOID PreviousDisplayCleanup()
Definition: appview.cpp:644

Member Function Documentation

◆ Create()

HWND CAppScrnshotPreview::Create ( HWND  hParent)

Definition at line 636 of file appview.cpp.

637{
638 RECT r = {0, 0, 0, 0};
639
640 return CWindowImpl::Create(hParent, r, L"", WS_CHILD | WS_VISIBLE);
641}
HWND Create(HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:1734
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by CAppInfoDisplay::ProcessWindowMessage().

◆ DisplayEmpty()

VOID CAppScrnshotPreview::DisplayEmpty ( )

Definition at line 669 of file appview.cpp.

670{
674}
@ SCRNSHOT_PREV_EMPTY
Definition: appview.h:46
#define InterlockedIncrement64(a)
Definition: btrfs_drv.h:143
VOID SetStatus(SCRNSHOT_STATUS Status)
Definition: appview.cpp:516
LONGLONG ContentID
Definition: appview.h:108

Referenced by CAppInfoDisplay::SetWelcomeText(), and CAppInfoDisplay::ShowAppInfo().

◆ DisplayFailed()

VOID CAppScrnshotPreview::DisplayFailed ( )
private

Definition at line 494 of file appview.cpp.

Referenced by DisplayFile(), DisplayImage(), and ProcessWindowMessage().

◆ DisplayFile()

BOOL CAppScrnshotPreview::DisplayFile ( LPCWSTR  lpszFileName)
private

Definition at line 502 of file appview.cpp.

503{
506 pImage = Bitmap::FromFile(lpszFileName, 0);
507 if (pImage->GetLastStatus() != Ok)
508 {
510 return FALSE;
511 }
512 return TRUE;
513}
@ SCRNSHOT_PREV_IMAGE
Definition: appview.h:48
static Bitmap * FromFile(const WCHAR *filename, BOOL useEmbeddedColorManagement)
Gdiplus::Image * pImage
Definition: appview.h:102
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
@ Ok
Definition: gdiplustypes.h:26

Referenced by DisplayImage(), and ProcessWindowMessage().

◆ DisplayImage()

BOOL CAppScrnshotPreview::DisplayImage ( LPCWSTR  lpszLocation)

Definition at line 677 of file appview.cpp.

678{
681
682 if (PathIsURLW(lpszLocation))
683 {
685
686 ScrnshotDownloadParam *DownloadParam = new ScrnshotDownloadParam;
687 if (!DownloadParam)
688 return FALSE;
689
690 DownloadParam->hwndNotify = m_hWnd;
691 DownloadParam->ID = ID;
692 // generate a filename
693 CStringW ScrnshotFolder = m_BasePath;
694 PathAppendW(ScrnshotFolder.GetBuffer(MAX_PATH), L"screenshots");
695 ScrnshotFolder.ReleaseBuffer();
696
697 if (!PathIsDirectoryW(ScrnshotFolder.GetString()))
698 {
699 CreateDirectoryW(ScrnshotFolder.GetString(), NULL);
700 }
701
702 if (!GetTempFileNameW(
703 ScrnshotFolder.GetString(), L"img", 0, DownloadParam->DownloadFileName.GetBuffer(MAX_PATH)))
704 {
705 DownloadParam->DownloadFileName.ReleaseBuffer();
706 delete DownloadParam;
708 return FALSE;
709 }
710 DownloadParam->DownloadFileName.ReleaseBuffer();
711
712 DownloadParam->hFile = CreateFileW(
714 NULL);
715 if (DownloadParam->hFile == INVALID_HANDLE_VALUE)
716 {
717 delete DownloadParam;
719 return FALSE;
720 }
721
723 0, INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, lpszLocation, TRUE, ScrnshotDownloadCallback, DownloadParam);
724 if (!AsyncInet)
725 {
726 CloseHandle(DownloadParam->hFile);
727 DeleteFileW(DownloadParam->DownloadFileName.GetBuffer());
728 delete DownloadParam;
730 return FALSE;
731 }
732 return TRUE;
733 }
734 else
735 {
736 return DisplayFile(lpszLocation);
737 }
738}
int ScrnshotDownloadCallback(pASYNCINET AsyncInet, ASYNC_EVENT Event, WPARAM wParam, LPARAM lParam, VOID *Extension)
Definition: appview.cpp:320
struct __ScrnshotDownloadParam ScrnshotDownloadParam
pASYNCINET AsyncInetDownload(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, LPCWSTR lpszUrl, BOOL bAllowCache, ASYNCINET_CALLBACK Callback, VOID *Extension)
Definition: asyncinet.cpp:33
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:387
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
HWND m_hWnd
Definition: atlwin.h:273
BOOL DisplayFile(LPCWSTR lpszFileName)
Definition: appview.cpp:502
pASYNCINET AsyncInet
Definition: appview.h:107
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1729
BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
Definition: url.c:2432
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
#define PathAppendW
Definition: pathcch.h:309
#define ID
Definition: ruserpass.c:36
CStringW DownloadFileName
Definition: appview.h:80
int64_t LONGLONG
Definition: typedefs.h:68
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521

Referenced by CAppInfoDisplay::ShowAppInfo().

◆ DisplayLoading()

VOID CAppScrnshotPreview::DisplayLoading ( )
private

Definition at line 481 of file appview.cpp.

482{
484 if (bLoadingTimerOn)
485 {
487 }
491}
#define LOADING_ANIMATION_FPS
Definition: appview.h:55
@ SCRNSHOT_PREV_LOADING
Definition: appview.h:47
#define TIMER_LOADING_ANIMATION
Definition: appview.h:52
int LoadingAnimationFrame
Definition: appview.h:105
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Referenced by DisplayImage().

◆ GetFrameDotShift()

float CAppScrnshotPreview::GetFrameDotShift ( int  Frame,
int  width,
int  height 
)
private

Definition at line 612 of file appview.cpp.

613{
614 return min(width, height) * (1.0 / 16.0) * (2.0 / (2.0 - sqrt(3.0))) *
615 (max(sin((float)Frame * 2 * PI / (LOADING_ANIMATION_PERIOD * LOADING_ANIMATION_FPS)), sqrt(3.0) / 2.0) -
616 sqrt(3.0) / 2.0);
617}
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
#define PI
Definition: appview.h:57
#define LOADING_ANIMATION_PERIOD
Definition: appview.h:54
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63

Referenced by PaintOnDC().

◆ GetLoadingDotWidth()

float CAppScrnshotPreview::GetLoadingDotWidth ( int  width,
int  height 
)
private

Definition at line 606 of file appview.cpp.

607{
608 return min(width, height) / 20.0;
609}

Referenced by PaintOnDC().

◆ GetRequestedWidth()

int CAppScrnshotPreview::GetRequestedWidth ( int  Height)

Definition at line 741 of file appview.cpp.

742{
743 switch (ScrnshotPrevStauts)
744 {
746 return 0;
748 return 200;
750 if (pImage)
751 {
752 // return the width needed to display image inside the window.
753 // and always keep window w/h ratio inside [ 1/SCRNSHOT_MAX_ASPECT_RAT, SCRNSHOT_MAX_ASPECT_RAT ]
754 return (int)floor(
755 (float)Height *
756 max(min((float)pImage->GetWidth() / (float)pImage->GetHeight(), (float)SCRNSHOT_MAX_ASPECT_RAT),
757 1.0 / (float)SCRNSHOT_MAX_ASPECT_RAT));
758 }
759 return 0;
761 return 200;
762 default:
763 return 0;
764 }
765}
#define SCRNSHOT_MAX_ASPECT_RAT
Definition: appview.h:27
SCRNSHOT_STATUS ScrnshotPrevStauts
Definition: appview.h:101
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88

Referenced by CAppInfoDisplay::ResizeChildren().

◆ GetWndClassInfo()

ATL::CWndClassInfo & CAppScrnshotPreview::GetWndClassInfo ( )
static

Definition at line 620 of file appview.cpp.

621{
622 DWORD csStyle = CS_VREDRAW | CS_HREDRAW;
623 static ATL::CWndClassInfo wc = {
624 {sizeof(WNDCLASSEX), csStyle, StartWindowProc, 0, 0, NULL, 0, LoadCursorW(NULL, IDC_ARROW),
625 (HBRUSH)(COLOR_BTNFACE + 1), 0, L"RAppsScrnshotPreview", NULL},
626 NULL,
627 NULL,
628 IDC_ARROW,
629 TRUE,
630 0,
631 _T("")};
632 return wc;
633}
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1619
unsigned long DWORD
Definition: ntddk_ex.h:95
#define _T(x)
Definition: vfdio.h:22
#define CS_VREDRAW
Definition: winuser.h:658
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2191
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5731
#define COLOR_BTNFACE
Definition: winuser.h:931

◆ PaintOnDC()

VOID CAppScrnshotPreview::PaintOnDC ( HDC  hdc,
int  width,
int  height,
BOOL  bDrawBkgnd 
)
private

Definition at line 522 of file appview.cpp.

523{
524 // use an off screen dc to avoid blinking
528
529 if (bDrawBkgnd)
530 {
531 HBRUSH hOldBrush = (HBRUSH)SelectObject(hdcMem, (HGDIOBJ)GetSysColorBrush(COLOR_BTNFACE));
532 PatBlt(hdcMem, 0, 0, width, height, PATCOPY);
533 SelectObject(hdcMem, hOldBrush);
534 }
535
536 switch (ScrnshotPrevStauts)
537 {
539 {
540 }
541 break;
542
544 {
545 Graphics graphics(hdcMem);
546 Color color(255, 0, 0);
547 SolidBrush dotBrush(Color(255, 100, 100, 100));
548
549 graphics.SetSmoothingMode(SmoothingMode::SmoothingModeAntiAlias);
550
551 // Paint three dot
552 float DotWidth = GetLoadingDotWidth(width, height);
553 graphics.FillEllipse(
554 (Brush *)(&dotBrush), (REAL)width / 2.0 - min(width, height) * 2.0 / 16.0 - DotWidth / 2.0,
555 (REAL)height / 2.0 -
557 DotWidth, DotWidth);
558
559 graphics.FillEllipse(
560 (Brush *)(&dotBrush), (REAL)width / 2.0 - DotWidth / 2.0,
561 (REAL)height / 2.0 - GetFrameDotShift(LoadingAnimationFrame, width, height) - DotWidth / 2.0, DotWidth,
562 DotWidth);
563
564 graphics.FillEllipse(
565 (Brush *)(&dotBrush), (REAL)width / 2.0 + min(width, height) * 2.0 / 16.0 - DotWidth / 2.0,
566 (REAL)height / 2.0 -
568 DotWidth, DotWidth);
569 }
570 break;
571
573 {
574 if (pImage)
575 {
576 // always draw entire image inside the window.
577 Graphics graphics(hdcMem);
578 float ZoomRatio =
579 min(((float)width / (float)pImage->GetWidth()), ((float)height / (float)pImage->GetHeight()));
580 float ZoomedImgWidth = ZoomRatio * (float)pImage->GetWidth();
581 float ZoomedImgHeight = ZoomRatio * (float)pImage->GetHeight();
582
583 graphics.DrawImage(
584 pImage, ((float)width - ZoomedImgWidth) / 2.0, ((float)height - ZoomedImgHeight) / 2.0,
585 ZoomedImgWidth, ZoomedImgHeight);
586 }
587 }
588 break;
589
591 {
595 }
596 break;
597 }
598
599 // copy the content form off-screen dc to hdc
600 BitBlt(hdc, 0, 0, width, height, hdcMem, 0, 0, SRCCOPY);
603}
float GetLoadingDotWidth(int width, int height)
Definition: appview.cpp:606
HICON hBrokenImgIcon
Definition: appview.h:103
float GetFrameDotShift(int Frame, int width, int height)
Definition: appview.cpp:612
static HBITMAP hBitmap
Definition: timezone.c:26
float REAL
Definition: types.h:41
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
pKey DeleteObject()
GLuint color
Definition: glext.h:6243
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static float(__cdecl *square_half_float)(float x
HDC hdcMem
Definition: welcome.c:104
#define DI_COMPAT
Definition: wingdi.h:68
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DI_NORMAL
Definition: wingdi.h:72
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
#define PATCOPY
Definition: wingdi.h:335
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI DeleteDC(_In_ HDC)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:2114

Referenced by ProcessWindowMessage().

◆ PreviousDisplayCleanup()

VOID CAppScrnshotPreview::PreviousDisplayCleanup ( )

Definition at line 644 of file appview.cpp.

645{
646 if (bLoadingTimerOn)
647 {
650 }
652 if (pImage)
653 {
654 delete pImage;
655 pImage = NULL;
656 }
657 if (AsyncInet)
658 {
660 }
661 if (!TempImagePath.IsEmpty())
662 {
665 }
666}
BOOL AsyncInetCancel(pASYNCINET AsyncInet)
Definition: asyncinet.cpp:126
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
void Empty() noexcept
Definition: atlsimpstr.h:253
CStringW TempImagePath
Definition: appview.h:110

Referenced by DisplayEmpty(), DisplayFailed(), DisplayFile(), DisplayImage(), ProcessWindowMessage(), and ~CAppScrnshotPreview().

◆ ProcessWindowMessage()

BOOL CAppScrnshotPreview::ProcessWindowMessage ( HWND  hwnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT theResult,
DWORD  dwMapId 
)
privatevirtual

Implements ATL::CMessageMap.

Definition at line 357 of file appview.cpp.

364{
365 theResult = 0;
366 switch (Msg)
367 {
368 case WM_CREATE:
371 break;
372 case WM_SIZE:
373 {
375 {
377
378 if (hBrokenImgIcon)
379 {
383 }
384 }
385 break;
386 }
388 {
391 AsyncInet = NULL;
392 switch (wParam)
393 {
394 case ERROR_SUCCESS:
395 if (ContentID == DownloadParam->ID)
396 {
397 DisplayFile(DownloadParam->DownloadFileName);
398 // send a message to trigger resizing
400 InvalidateRect(0, 0);
402 DownloadParam->DownloadFileName; // record tmp file path in order to delete it when cleanup
403 }
404 else
405 {
406 // the picture downloaded is already outdated. delete it.
407 DeleteFileW(DownloadParam->DownloadFileName);
408 }
409 break;
410 case ERROR_CANCELLED:
411 DeleteFileW(DownloadParam->DownloadFileName);
412 break;
413 default:
415 // send a message to trigger resizing
417 InvalidateRect(0, 0);
418 DeleteFileW(DownloadParam->DownloadFileName);
419 break;
420 }
421 delete DownloadParam;
422 break;
423 }
424 case WM_PAINT:
425 {
426 PAINTSTRUCT ps;
427 HDC hdc = BeginPaint(&ps);
428 CRect rect;
430
431 PaintOnDC(hdc, rect.Width(), rect.Height(), ps.fErase);
432
433 EndPaint(&ps);
434 break;
435 }
436 case WM_PRINTCLIENT:
437 {
439 {
440 if (!IsWindowVisible())
441 break;
442 }
443 CRect rect;
445
446 PaintOnDC((HDC)wParam, rect.Width(), rect.Height(), lParam & PRF_ERASEBKGND);
447 break;
448 }
449 case WM_ERASEBKGND:
450 {
451 return TRUE; // do not erase to avoid blinking
452 }
453 case WM_TIMER:
454 {
455 switch (wParam)
456 {
460 HDC hdc = GetDC();
461 CRect rect;
463
464 PaintOnDC(hdc, rect.Width(), rect.Height(), TRUE);
465 ReleaseDC(hdc);
466 }
467 break;
468 }
469 case WM_DESTROY:
470 {
474 break;
475 }
476 }
477 return FALSE;
478}
#define WM_RAPPS_DOWNLOAD_COMPLETE
Definition: appview.h:39
#define BROKENIMG_ICON_SIZE
Definition: appview.h:24
#define WM_RAPPS_RESIZE_CHILDREN
Definition: appview.h:41
VOID AsyncInetRelease(pASYNCINET AsyncInet)
Definition: asyncinet.cpp:184
#define IDI_BROKEN_IMAGE
Definition: resource.h:18
HDC GetDC()
Definition: atlwin.h:547
CWindow GetParent() const
Definition: atlwin.h:700
BOOL IsWindowVisible() const
Definition: atlwin.h:958
VOID PaintOnDC(HDC hdc, int width, int height, BOOL bDrawBkgnd)
Definition: appview.cpp:522
WPARAM wParam
Definition: combotst.c:138
struct @1647 Msg[]
LPARAM lParam
Definition: combotst.c:139
#define ERROR_SUCCESS
Definition: deptool.c:10
HINSTANCE hInst
Definition: dxdiag.c:13
static HICON
Definition: imagelist.c:80
#define WM_PRINTCLIENT
Definition: richedit.h:70
& rect
Definition: startmenu.cpp:1413
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define ERROR_CANCELLED
Definition: winerror.h:726
#define WM_PAINT
Definition: winuser.h:1623
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_ERASEBKGND
Definition: winuser.h:1628
#define IMAGE_ICON
Definition: winuser.h:212
#define WM_CREATE
Definition: winuser.h:1611
#define WM_SIZE
Definition: winuser.h:1614
#define PRF_ERASEBKGND
Definition: winuser.h:2529
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WM_TIMER
Definition: winuser.h:1745
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define LoadImage
Definition: winuser.h:5827
#define PRF_CHECKVISIBLE
Definition: winuser.h:2526
#define WM_DESTROY
Definition: winuser.h:1612
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define MAKEINTRESOURCE
Definition: winuser.h:591
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ SetStatus()

VOID CAppScrnshotPreview::SetStatus ( SCRNSHOT_STATUS  Status)
private

Definition at line 516 of file appview.cpp.

517{
519}
Status
Definition: gdiplustypes.h:25

Referenced by DisplayEmpty(), DisplayFailed(), DisplayFile(), and DisplayLoading().

Member Data Documentation

◆ AsyncInet

pASYNCINET CAppScrnshotPreview::AsyncInet = NULL
private

Definition at line 107 of file appview.h.

Referenced by DisplayImage(), PreviousDisplayCleanup(), and ProcessWindowMessage().

◆ bLoadingTimerOn

BOOL CAppScrnshotPreview::bLoadingTimerOn = FALSE
private

Definition at line 104 of file appview.h.

Referenced by DisplayLoading(), and PreviousDisplayCleanup().

◆ BrokenImgSize

int CAppScrnshotPreview::BrokenImgSize = BROKENIMG_ICON_SIZE
private

Definition at line 106 of file appview.h.

Referenced by PaintOnDC(), and ProcessWindowMessage().

◆ ContentID

LONGLONG CAppScrnshotPreview::ContentID = 0
private

Definition at line 108 of file appview.h.

Referenced by DisplayEmpty(), DisplayFailed(), DisplayImage(), and ProcessWindowMessage().

◆ hBrokenImgIcon

HICON CAppScrnshotPreview::hBrokenImgIcon = NULL
private

Definition at line 103 of file appview.h.

Referenced by PaintOnDC(), and ProcessWindowMessage().

◆ LoadingAnimationFrame

int CAppScrnshotPreview::LoadingAnimationFrame = 0
private

Definition at line 105 of file appview.h.

Referenced by DisplayLoading(), PaintOnDC(), PreviousDisplayCleanup(), and ProcessWindowMessage().

◆ m_BasePath

CStringW CAppScrnshotPreview::m_BasePath
private

Definition at line 100 of file appview.h.

Referenced by DisplayImage().

◆ pImage

Gdiplus::Image* CAppScrnshotPreview::pImage = NULL
private

Definition at line 102 of file appview.h.

Referenced by DisplayFile(), GetRequestedWidth(), PaintOnDC(), and PreviousDisplayCleanup().

◆ ScrnshotPrevStauts

SCRNSHOT_STATUS CAppScrnshotPreview::ScrnshotPrevStauts = SCRNSHOT_PREV_EMPTY
private

Definition at line 101 of file appview.h.

Referenced by GetRequestedWidth(), PaintOnDC(), and SetStatus().

◆ TempImagePath

CStringW CAppScrnshotPreview::TempImagePath
private

Definition at line 110 of file appview.h.

Referenced by PreviousDisplayCleanup(), and ProcessWindowMessage().


The documentation for this class was generated from the following files: