00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(AFX_CTRLSEARCHDETAILPANEL_H__946418DF_EE15_4346_A4A7_FA1E4672FC3C__INCLUDED_)
00023 #define AFX_CTRLSEARCHDETAILPANEL_H__946418DF_EE15_4346_A4A7_FA1E4672FC3C__INCLUDED_
00024
00025 #pragma once
00026
00027 #include "MetaPanel.h"
00028 #include "RichDocument.h"
00029 #include "RichViewCtrl.h"
00030 #include "HttpRequest.h"
00031
00032 class CMatchFile;
00033 class CImageFile;
00034
00035
00036 class CSearchDetailPanel : public CWnd
00037 {
00038
00039 public:
00040 CSearchDetailPanel();
00041 virtual ~CSearchDetailPanel();
00042
00043 DECLARE_DYNAMIC(CSearchDetailPanel)
00044
00045
00046 public:
00047 void Update(CMatchFile* pFile);
00048 protected:
00049 static void DrawText(CDC* pDC, int nX, int nY, LPCTSTR pszText, RECT* pRect = NULL);
00050 void DrawThumbnail(CDC* pDC, CRect& rcClient, CRect& rcWork);
00051 void DrawThumbnail(CDC* pDC, CRect& rcThumb);
00052 void ClearReviews();
00053 protected:
00054 BOOL RequestPreview();
00055 void CancelPreview();
00056 static UINT ThreadStart(LPVOID pParam);
00057 void OnRun();
00058 BOOL ExecuteRequest(CString strURL, BYTE** ppBuffer, DWORD* pnBuffer);
00059 void OnPreviewLoaded(SHA1* pSHA1, CImageFile* pImage);
00060 BOOL CachePreviewImage(SHA1* pSHA1, LPBYTE pBuffer, DWORD nBuffer);
00061
00062
00063 protected:
00064 class Review
00065 {
00066 public:
00067 Review(GGUID* pGUID, IN_ADDR* pAddress, LPCTSTR pszNick, int nRating, LPCTSTR pszComments);
00068 virtual ~Review();
00069 void Layout(CSearchDetailPanel* pParent, CRect* pRect);
00070 void Reposition(int nScroll);
00071 void Paint(CDC* pDC, int nScroll);
00072 public:
00073 GGUID m_pGUID;
00074 CString m_sNick;
00075 int m_nRating;
00076 CRichDocument m_pComments;
00077 CRichViewCtrl m_wndComments;
00078 CRect m_rc;
00079 };
00080 friend class Review;
00081
00082
00083 protected:
00084 CMatchList* m_pMatches;
00085 BOOL m_bValid;
00086 CMatchFile* m_pFile;
00087 SHA1 m_pSHA1;
00088 CString m_sName;
00089 CString m_sStatus;
00090 CRect m_rcStatus;
00091 CString m_sSize;
00092 int m_nIcon48;
00093 int m_nIcon32;
00094 int m_nRating;
00095 CSchema* m_pSchema;
00096 CMetaPanel m_pMetadata;
00097 CPtrList m_pReviews;
00098 int m_nScrollWheelLines;
00099 protected:
00100 CCriticalSection m_pSection;
00101 CEvent m_pWakeup;
00102 BOOL m_bCanPreview;
00103 BOOL m_bRunPreview;
00104 BOOL m_bIsPreviewing;
00105 HANDLE m_hThread;
00106 BOOL m_bThread;
00107 CHttpRequest m_pRequest;
00108 CStringList m_pPreviewURLs;
00109 protected:
00110 CBitmap m_bmThumb;
00111 CSize m_szThumb;
00112 CRect m_rcThumb;
00113 COLORREF m_crLight;
00114 int m_nThumbSize;
00115
00116
00117 public:
00118
00119 public:
00120 virtual BOOL Create(CWnd* pParentWnd);
00121
00122
00123
00124 protected:
00125
00126 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00127 afx_msg void OnDestroy();
00128 afx_msg void OnSize(UINT nType, int cx, int cy);
00129 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00130 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
00131 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00132 afx_msg void OnPaint();
00133 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00134 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00135 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00136 afx_msg void OnClickReview(RVN_ELEMENTEVENT* pNotify, LRESULT *pResult);
00137
00138
00139 DECLARE_MESSAGE_MAP()
00140
00141 };
00142
00143 #define IDC_DETAIL_PANEL 104
00144 #define IDC_REVIEW_VIEW 99
00145
00146
00147
00148 #endif // !defined(AFX_CTRLSEARCHDETAILPANEL_H__946418DF_EE15_4346_A4A7_FA1E4672FC3C__INCLUDED_)