ReactOS  0.4.15-dev-1177-g6cb3b62
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 ()
 
- 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< CWindow, CControlWinTraits >
 CWindowImplBaseT ()
 
virtual void OnFinalMessage (HWND)
 
BOOL SubclassWindow (HWND hWnd)
 
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< CWindow >
 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 (int nID)
 
UINT GetDlgItemInt (int nID, BOOL *lpTrans=NULL, BOOL bSigned=TRUE) const
 
UINT GetDlgItemText (int nID, LPTSTR lpStr, int nMaxCount) const
 
BOOL GetDlgItemText (int nID, 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 (LPTSTR lpszStringBuf, int nMaxCount) const
 
BOOL GetWindowText (BSTR &bstrText)
 
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)
 

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< CWindow, CControlWinTraits >
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

SCRNSHOT_STATUS ScrnshotPrevStauts = SCRNSHOT_PREV_EMPTY
 
ImagepImage = NULL
 
HICON hBrokenImgIcon = NULL
 
BOOL bLoadingTimerOn = FALSE
 
int LoadingAnimationFrame = 0
 
int BrokenImgSize = BROKENIMG_ICON_SIZE
 
pASYNCINET AsyncInet = NULL
 
LONGLONG ContentID = 0
 
ATL::CStringW TempImagePath
 

Additional Inherited Members

- Public Types inherited from ATL::CWindowImplRoot< CWindow >
enum  
 
- Public Attributes inherited from ATL::CWindowImplBaseT< CWindow, CControlWinTraits >
WNDPROC m_pfnSuperWindowProc
 
- Public Attributes inherited from ATL::CWindowImplRoot< CWindow >
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 122 of file appview.h.

Constructor & Destructor Documentation

◆ ~CAppScrnshotPreview()

CAppScrnshotPreview::~CAppScrnshotPreview ( )

Definition at line 876 of file appview.cpp.

877 {
879 }
VOID PreviousDisplayCleanup()
Definition: appview.cpp:761

Member Function Documentation

◆ Create()

HWND CAppScrnshotPreview::Create ( HWND  hParent)

Definition at line 754 of file appview.cpp.

755 {
756  RECT r = { 0,0,0,0 };
757 
759 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
_In_ BOOLEAN Create
Definition: pstypes.h:519
#define WS_CHILD
Definition: pedump.c:617
static const WCHAR L[]
Definition: oid.c:1250
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by CAppInfoDisplay::ProcessWindowMessage().

◆ DisplayEmpty()

VOID CAppScrnshotPreview::DisplayEmpty ( )

◆ DisplayFailed()

VOID CAppScrnshotPreview::DisplayFailed ( )
private

Definition at line 602 of file appview.cpp.

603 {
607 }
VOID SetStatus(SCRNSHOT_STATUS Status)
Definition: appview.cpp:622
#define InterlockedIncrement64
Definition: interlocked.h:211
LONGLONG ContentID
Definition: appview.h:134
VOID PreviousDisplayCleanup()
Definition: appview.cpp:761

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

◆ DisplayFile()

BOOL CAppScrnshotPreview::DisplayFile ( LPCWSTR  lpszFileName)
private

Definition at line 609 of file appview.cpp.

610 {
613  pImage = Bitmap::FromFile(lpszFileName, 0);
614  if (pImage->GetLastStatus() != Ok)
615  {
616  DisplayFailed();
617  return FALSE;
618  }
619  return TRUE;
620 }
static Bitmap * FromFile(const WCHAR *filename, BOOL useEmbeddedColorManagement)
#define TRUE
Definition: types.h:120
VOID SetStatus(SCRNSHOT_STATUS Status)
Definition: appview.cpp:622
#define FALSE
Definition: types.h:117
Status GetLastStatus()
VOID PreviousDisplayCleanup()
Definition: appview.cpp:761

Referenced by DisplayImage(), and ProcessWindowMessage().

◆ DisplayImage()

BOOL CAppScrnshotPreview::DisplayImage ( LPCWSTR  lpszLocation)

Definition at line 792 of file appview.cpp.

793 {
796 
797  if (PathIsURLW(lpszLocation))
798  {
799  DisplayLoading();
800 
802  if (!DownloadParam) return FALSE;
803 
804  DownloadParam->hwndNotify = m_hWnd;
805  DownloadParam->ID = ID;
806  // generate a filename
808  PathAppendW(ScrnshotFolder.GetBuffer(MAX_PATH), L"screenshots");
809  ScrnshotFolder.ReleaseBuffer();
810 
811  if (!PathIsDirectoryW(ScrnshotFolder.GetString()))
812  {
813  CreateDirectoryW(ScrnshotFolder.GetString(), NULL);
814  }
815 
816  if (!GetTempFileNameW(ScrnshotFolder.GetString(), L"img",
817  0, DownloadParam->DownloadFileName.GetBuffer(MAX_PATH)))
818  {
819  DownloadParam->DownloadFileName.ReleaseBuffer();
820  delete DownloadParam;
821  DisplayFailed();
822  return FALSE;
823  }
824  DownloadParam->DownloadFileName.ReleaseBuffer();
825 
826  DownloadParam->hFile = CreateFileW(DownloadParam->DownloadFileName.GetString(),
828  if (DownloadParam->hFile == INVALID_HANDLE_VALUE)
829  {
830  delete DownloadParam;
831  DisplayFailed();
832  return FALSE;
833  }
834 
836  if (!AsyncInet)
837  {
838  CloseHandle(DownloadParam->hFile);
839  DeleteFileW(DownloadParam->DownloadFileName.GetBuffer());
840  delete DownloadParam;
841  DisplayFailed();
842  return FALSE;
843  }
844  return TRUE;
845  }
846  else
847  {
848  return DisplayFile(lpszLocation);
849  }
850 }
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
struct __ScrnshotDownloadParam ScrnshotDownloadParam
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1702
pASYNCINET AsyncInet
Definition: appview.h:133
#define CloseHandle
Definition: compat.h:487
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
Definition: url.c:2432
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:121
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
#define FALSE
Definition: types.h:117
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
smooth NULL
Definition: ftsmooth.c:416
int64_t LONGLONG
Definition: typedefs.h:68
#define InterlockedIncrement64
Definition: interlocked.h:211
static AvailableStrings m_Strings
Definition: available.h:111
#define MAX_PATH
Definition: compat.h:34
PCXSTR GetString() const
Definition: atlsimpstr.h:361
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
BOOL DisplayFile(LPCWSTR lpszFileName)
Definition: appview.cpp:609
LONGLONG ContentID
Definition: appview.h:134
pASYNCINET AsyncInetDownload(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, LPCWSTR lpszUrl, BOOL bAllowCache, ASYNCINET_CALLBACK Callback, VOID *Extension)
Definition: asyncinet.cpp:33
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
static const WCHAR L[]
Definition: oid.c:1250
HWND m_hWnd
Definition: atlwin.h:268
#define ID
Definition: ruserpass.c:36
#define CREATE_ALWAYS
Definition: disk.h:72
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
VOID PreviousDisplayCleanup()
Definition: appview.cpp:761
ATL::CStringW szAppsPath
Definition: available.h:32
int ScrnshotDownloadCallback(pASYNCINET AsyncInet, ASYNC_EVENT Event, WPARAM wParam, LPARAM lParam, VOID *Extension)
Definition: appview.cpp:431
#define CreateFileW
Definition: compat.h:489

Referenced by CAppInfoDisplay::ShowAvailableAppInfo().

◆ DisplayLoading()

VOID CAppScrnshotPreview::DisplayLoading ( )
private

Definition at line 590 of file appview.cpp.

591 {
593  if (bLoadingTimerOn)
594  {
596  }
600 }
#define TRUE
Definition: types.h:120
#define TIMER_LOADING_ANIMATION
Definition: appview.h:52
VOID SetStatus(SCRNSHOT_STATUS Status)
Definition: appview.cpp:622
UINT_PTR SetTimer(UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
Definition: atlwin.h:1190
BOOL KillTimer(UINT_PTR nIDEvent)
Definition: atlwin.h:908
int LoadingAnimationFrame
Definition: appview.h:131
#define LOADING_ANIMATION_FPS
Definition: appview.h:55

Referenced by DisplayImage().

◆ GetFrameDotShift()

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

Definition at line 722 of file appview.cpp.

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

Referenced by PaintOnDC().

◆ GetLoadingDotWidth()

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

Definition at line 717 of file appview.cpp.

718 {
719  return min(width, height) / 20.0;
720 }
GLint GLint GLsizei width
Definition: gl.h:1546
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define min(a, b)
Definition: monoChain.cc:55

Referenced by PaintOnDC().

◆ GetRequestedWidth()

int CAppScrnshotPreview::GetRequestedWidth ( int  Height)

Definition at line 852 of file appview.cpp.

853 {
854  switch (ScrnshotPrevStauts)
855  {
856  case SCRNSHOT_PREV_EMPTY:
857  return 0;
859  return 200;
860  case SCRNSHOT_PREV_IMAGE:
861  if (pImage)
862  {
863  // return the width needed to display image inside the window.
864  // and always keep window w/h ratio inside [ 1/SCRNSHOT_MAX_ASPECT_RAT, SCRNSHOT_MAX_ASPECT_RAT ]
865  return (int)floor((float)Height *
867  }
868  return 0;
870  return 200;
871  default:
872  return 0;
873  }
874 }
#define max(a, b)
Definition: svc.c:63
SCRNSHOT_STATUS ScrnshotPrevStauts
Definition: appview.h:127
UINT GetHeight()
UINT GetWidth()
static float(__cdecl *square_half_float)(float x
#define min(a, b)
Definition: monoChain.cc:55
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
#define SCRNSHOT_MAX_ASPECT_RAT
Definition: appview.h:29

Referenced by CAppInfoDisplay::ResizeChildren().

◆ GetWndClassInfo()

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

Definition at line 730 of file appview.cpp.

731 {
732  DWORD csStyle = CS_VREDRAW | CS_HREDRAW;
733  static ATL::CWndClassInfo wc =
734  {
735  {
736  sizeof(WNDCLASSEX),
737  csStyle,
739  0,
740  0,
741  NULL,
742  0,
744  (HBRUSH)(COLOR_BTNFACE + 1),
745  0,
746  L"RAppsScrnshotPreview",
747  NULL
748  },
749  NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
750  };
751  return wc;
752 }
#define TRUE
Definition: types.h:120
#define CS_HREDRAW
Definition: winuser.h:648
smooth NULL
Definition: ftsmooth.c:416
#define CS_VREDRAW
Definition: winuser.h:653
#define _T(x)
Definition: vfdio.h:22
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
static const WCHAR L[]
Definition: oid.c:1250
#define COLOR_BTNFACE
Definition: winuser.h:918
static LRESULT CALLBACK StartWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1530
#define IDC_ARROW
Definition: winuser.h:682
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5694

◆ PaintOnDC()

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

Definition at line 627 of file appview.cpp.

628 {
629  // use an off screen dc to avoid blinking
633 
634  if (bDrawBkgnd)
635  {
636  HBRUSH hOldBrush = (HBRUSH)SelectObject(hdcMem, (HGDIOBJ)GetSysColorBrush(COLOR_BTNFACE));
637  PatBlt(hdcMem, 0, 0, width, height, PATCOPY);
638  SelectObject(hdcMem, hOldBrush);
639  }
640 
641  switch (ScrnshotPrevStauts)
642  {
643  case SCRNSHOT_PREV_EMPTY:
644  {
645 
646  }
647  break;
648 
650  {
651  Graphics graphics(hdcMem);
652  Color color(255, 0, 0);
653  SolidBrush dotBrush(Color(255, 100, 100, 100));
654 
655  graphics.SetSmoothingMode(SmoothingMode::SmoothingModeAntiAlias);
656 
657  // Paint three dot
658  float DotWidth = GetLoadingDotWidth(width, height);
659  graphics.FillEllipse((Brush *)(&dotBrush),
660  (REAL)width / 2.0 - min(width, height) * 2.0 / 16.0 - DotWidth / 2.0,
662  DotWidth,
663  DotWidth);
664 
665  graphics.FillEllipse((Brush *)(&dotBrush),
666  (REAL)width / 2.0 - DotWidth / 2.0,
667  (REAL)height / 2.0 - GetFrameDotShift(LoadingAnimationFrame, width, height) - DotWidth / 2.0,
668  DotWidth,
669  DotWidth);
670 
671  graphics.FillEllipse((Brush *)(&dotBrush),
672  (REAL)width / 2.0 + min(width, height) * 2.0 / 16.0 - DotWidth / 2.0,
674  DotWidth,
675  DotWidth);
676  }
677  break;
678 
679  case SCRNSHOT_PREV_IMAGE:
680  {
681  if (pImage)
682  {
683  // always draw entire image inside the window.
684  Graphics graphics(hdcMem);
685  float ZoomRatio = min(((float)width / (float)pImage->GetWidth()), ((float)height / (float)pImage->GetHeight()));
686  float ZoomedImgWidth = ZoomRatio * (float)pImage->GetWidth();
687  float ZoomedImgHeight = ZoomRatio * (float)pImage->GetHeight();
688 
689  graphics.DrawImage(pImage,
690  ((float)width - ZoomedImgWidth) / 2.0, ((float)height - ZoomedImgHeight) / 2.0,
691  ZoomedImgWidth, ZoomedImgHeight);
692  }
693  }
694  break;
695 
697  {
699  (width - BrokenImgSize) / 2,
700  (height - BrokenImgSize) / 2,
704  NULL,
705  NULL,
706  DI_NORMAL | DI_COMPAT);
707  }
708  break;
709  }
710 
711  // copy the content form off-screen dc to hdc
712  BitBlt(hdc, 0, 0, width, height, hdcMem, 0, 0, SRCCOPY);
713  DeleteDC(hdcMem);
715 }
GLint GLint GLsizei width
Definition: gl.h:1546
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
SCRNSHOT_STATUS ScrnshotPrevStauts
Definition: appview.h:127
static HDC
Definition: imagelist.c:92
#define DI_COMPAT
Definition: wingdi.h:68
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
struct Color Color
UINT GetHeight()
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
GLuint color
Definition: glext.h:6243
smooth NULL
Definition: ftsmooth.c:416
float GetLoadingDotWidth(int width, int height)
Definition: appview.cpp:717
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:1997
float GetFrameDotShift(int Frame, int width, int height)
Definition: appview.cpp:722
HDC hdc
Definition: main.c:9
#define COLOR_BTNFACE
Definition: winuser.h:918
#define DI_NORMAL
Definition: wingdi.h:72
UINT GetWidth()
int LoadingAnimationFrame
Definition: appview.h:131
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define PATCOPY
Definition: wingdi.h:334
BOOL WINAPI DeleteDC(_In_ HDC)
static float(__cdecl *square_half_float)(float x
#define min(a, b)
Definition: monoChain.cc:55
HICON hBrokenImgIcon
Definition: appview.h:129
static HBITMAP
Definition: button.c:44
float REAL
Definition: types.h:41
HBRUSH WINAPI GetSysColorBrush(_In_ int)
static HBITMAP hBitmap
Definition: timezone.c:26
#define LOADING_ANIMATION_FPS
Definition: appview.h:55
#define SRCCOPY
Definition: wingdi.h:332
HDC hdcMem
Definition: welcome.c:104
static VOID NTAPI 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:49

Referenced by ProcessWindowMessage().

◆ PreviousDisplayCleanup()

VOID CAppScrnshotPreview::PreviousDisplayCleanup ( )

Definition at line 761 of file appview.cpp.

762 {
763  if (bLoadingTimerOn)
764  {
767  }
769  if (pImage)
770  {
771  delete pImage;
772  pImage = NULL;
773  }
774  if (AsyncInet)
775  {
777  }
778  if (!TempImagePath.IsEmpty())
779  {
782  }
783 }
pASYNCINET AsyncInet
Definition: appview.h:133
#define TIMER_LOADING_ANIMATION
Definition: appview.h:52
#define FALSE
Definition: types.h:117
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL KillTimer(UINT_PTR nIDEvent)
Definition: atlwin.h:908
smooth NULL
Definition: ftsmooth.c:416
PCXSTR GetString() const
Definition: atlsimpstr.h:361
BOOL AsyncInetCancel(pASYNCINET AsyncInet)
Definition: asyncinet.cpp:126
ATL::CStringW TempImagePath
Definition: appview.h:135
int LoadingAnimationFrame
Definition: appview.h:131
bool IsEmpty() const
Definition: atlsimpstr.h:379

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 468 of file appview.cpp.

469 {
470  theResult = 0;
471  switch (Msg)
472  {
473  case WM_CREATE:
475  break;
476  case WM_SIZE:
477  {
479  {
481 
482  if (hBrokenImgIcon)
483  {
486  }
487  }
488  break;
489  }
491  {
494  AsyncInet = NULL;
495  switch (wParam)
496  {
497  case ERROR_SUCCESS:
498  if (ContentID == DownloadParam->ID)
499  {
500  DisplayFile(DownloadParam->DownloadFileName);
501  // send a message to trigger resizing
503  InvalidateRect(0, 0);
504  TempImagePath = DownloadParam->DownloadFileName; // record tmp file path in order to delete it when cleanup
505  }
506  else
507  {
508  // the picture downloaded is already outdated. delete it.
509  DeleteFileW(DownloadParam->DownloadFileName);
510  }
511  break;
512  case ERROR_CANCELLED:
513  DeleteFileW(DownloadParam->DownloadFileName);
514  break;
515  default:
516  DisplayFailed();
517  // send a message to trigger resizing
519  InvalidateRect(0, 0);
520  DeleteFileW(DownloadParam->DownloadFileName);
521  break;
522  }
523  delete DownloadParam;
524  break;
525  }
526  case WM_PAINT:
527  {
528  PAINTSTRUCT ps;
529  HDC hdc = BeginPaint(&ps);
530  CRect rect;
532 
533  PaintOnDC(hdc,
534  rect.Width(),
535  rect.Height(),
536  ps.fErase);
537 
538  EndPaint(&ps);
539  break;
540  }
541  case WM_PRINTCLIENT:
542  {
543  if (lParam & PRF_CHECKVISIBLE)
544  {
545  if (!IsWindowVisible()) break;
546  }
547  CRect rect;
549 
551  rect.Width(),
552  rect.Height(),
554  break;
555  }
556  case WM_ERASEBKGND:
557  {
558  return TRUE; // do not erase to avoid blinking
559  }
560  case WM_TIMER:
561  {
562  switch (wParam)
563  {
567  HDC hdc = GetDC();
568  CRect rect;
570 
571  PaintOnDC(hdc,
572  rect.Width(),
573  rect.Height(),
574  TRUE);
575  ReleaseDC(hdc);
576  }
577  break;
578  }
579  case WM_DESTROY:
580  {
584  break;
585  }
586  }
587  return FALSE;
588 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
pASYNCINET AsyncInet
Definition: appview.h:133
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
struct @1610 Msg[]
void EndPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:495
#define TIMER_LOADING_ANIMATION
Definition: appview.h:52
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define WM_PRINTCLIENT
Definition: richedit.h:70
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:834
VOID PaintOnDC(HDC hdc, int width, int height, BOOL bDrawBkgnd)
Definition: appview.cpp:627
#define FALSE
Definition: types.h:117
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
smooth NULL
Definition: ftsmooth.c:416
#define WM_DESTROY
Definition: winuser.h:1591
#define LOADING_ANIMATION_PERIOD
Definition: appview.h:54
#define PRF_ERASEBKGND
Definition: winuser.h:2501
HDC BeginPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:297
#define WM_SIZE
Definition: winuser.h:1593
#define WM_RAPPS_DOWNLOAD_COMPLETE
Definition: appview.h:41
#define WM_TIMER
Definition: winuser.h:1724
BOOL DisplayFile(LPCWSTR lpszFileName)
Definition: appview.cpp:609
LONGLONG ContentID
Definition: appview.h:134
#define PRF_CHECKVISIBLE
Definition: winuser.h:2498
#define WM_PAINT
Definition: winuser.h:1602
HDC hdc
Definition: main.c:9
ATL::CStringW TempImagePath
Definition: appview.h:135
HWND m_hWnd
Definition: atlwin.h:268
int LoadingAnimationFrame
Definition: appview.h:131
#define BROKENIMG_ICON_SIZE
Definition: appview.h:26
int ReleaseDC(HDC hDC)
Definition: atlwin.h:1006
HINSTANCE hInst
Definition: dxdiag.c:13
VOID AsyncInetRelease(pASYNCINET AsyncInet)
Definition: asyncinet.cpp:184
#define ERROR_CANCELLED
Definition: winerror.h:726
VOID PreviousDisplayCleanup()
Definition: appview.cpp:761
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define min(a, b)
Definition: monoChain.cc:55
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
#define WM_CREATE
Definition: winuser.h:1590
#define WM_RAPPS_RESIZE_CHILDREN
Definition: appview.h:42
#define LoadImage
Definition: winuser.h:5790
HICON hBrokenImgIcon
Definition: appview.h:129
CWindow GetParent() const
Definition: atlwin.h:654
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define IDI_BROKEN_IMAGE
Definition: resource.h:17
LPARAM lParam
Definition: combotst.c:139
#define LOADING_ANIMATION_FPS
Definition: appview.h:55
HDC GetDC()
Definition: atlwin.h:513
BOOL IsWindowVisible() const
Definition: atlwin.h:890

◆ SetStatus()

VOID CAppScrnshotPreview::SetStatus ( SCRNSHOT_STATUS  Status)
private

Definition at line 622 of file appview.cpp.

623 {
625 }
SCRNSHOT_STATUS ScrnshotPrevStauts
Definition: appview.h:127
Status
Definition: gdiplustypes.h:24

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

Member Data Documentation

◆ AsyncInet

pASYNCINET CAppScrnshotPreview::AsyncInet = NULL
private

Definition at line 133 of file appview.h.

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

◆ bLoadingTimerOn

BOOL CAppScrnshotPreview::bLoadingTimerOn = FALSE
private

Definition at line 130 of file appview.h.

Referenced by DisplayLoading(), and PreviousDisplayCleanup().

◆ BrokenImgSize

int CAppScrnshotPreview::BrokenImgSize = BROKENIMG_ICON_SIZE
private

Definition at line 132 of file appview.h.

Referenced by PaintOnDC(), and ProcessWindowMessage().

◆ ContentID

LONGLONG CAppScrnshotPreview::ContentID = 0
private

Definition at line 134 of file appview.h.

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

◆ hBrokenImgIcon

HICON CAppScrnshotPreview::hBrokenImgIcon = NULL
private

Definition at line 129 of file appview.h.

Referenced by PaintOnDC(), and ProcessWindowMessage().

◆ LoadingAnimationFrame

int CAppScrnshotPreview::LoadingAnimationFrame = 0
private

Definition at line 131 of file appview.h.

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

◆ pImage

Image* CAppScrnshotPreview::pImage = NULL
private

Definition at line 128 of file appview.h.

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

◆ ScrnshotPrevStauts

SCRNSHOT_STATUS CAppScrnshotPreview::ScrnshotPrevStauts = SCRNSHOT_PREV_EMPTY
private

Definition at line 127 of file appview.h.

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

◆ TempImagePath

ATL::CStringW CAppScrnshotPreview::TempImagePath
private

Definition at line 135 of file appview.h.

Referenced by PreviousDisplayCleanup(), and ProcessWindowMessage().


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