00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "Downloads_Downloads.h"
00009
00010 #ifdef _DEBUG
00011 #define new DEBUG_NEW
00012 #undef THIS_FILE
00013 static char THIS_FILE[] = __FILE__;
00014 #endif
00015
00016 CDownloads_Downloads::CDownloads_Downloads()
00017 {
00018 }
00019
00020 CDownloads_Downloads::~CDownloads_Downloads()
00021 {
00022 }
00023
00024 BEGIN_MESSAGE_MAP(CDownloads_Downloads, CWnd)
00025
00026 ON_WM_CREATE()
00027 ON_WM_SIZE()
00028 ON_WM_SETFOCUS()
00029 ON_WM_ERASEBKGND()
00030
00031 END_MESSAGE_MAP()
00032
00033 BOOL CDownloads_Downloads::Create(CWnd *pParent)
00034 {
00035 CRect rc (0, 0, 50, 50);
00036
00037 if (FALSE == CWnd::Create (AfxRegisterWndClass (0, LoadCursor (NULL, IDC_ARROW),
00038 (HBRUSH) (COLOR_WINDOW+1), NULL), NULL, WS_CHILD | WS_VISIBLE, rc, pParent, 0x121))
00039 return FALSE;
00040
00041 return TRUE;
00042 }
00043
00044 int CDownloads_Downloads::OnCreate(LPCREATESTRUCT lpCreateStruct)
00045 {
00046 if (CWnd::OnCreate(lpCreateStruct) == -1)
00047 return -1;
00048
00049 m_bShowDLInfo = _App.View_DLInfo ();
00050
00051 m_tasks.Create (this);
00052 m_info.Create (this);
00053 m_splitter.Create (AfxGetInstanceHandle (), m_hWnd, WST_HORIZONTAL);
00054 m_splitter.SetWnd1 (m_tasks.m_hWnd);
00055 m_splitter.SetWnd2 (m_info.m_hWnd);
00056 m_splitter.SetMinDimensions (50, 50);
00057 float fRatio = _App.View_SplitterRatio ("Downloads_DL_LOG");
00058 if (fRatio < 0.1f)
00059 fRatio = 0.1f;
00060 m_splitter.SetRatio (fRatio);
00061
00062 ShowDLInfo (m_bShowDLInfo);
00063
00064 return 0;
00065 }
00066
00067 void CDownloads_Downloads::OnSize(UINT, int cx, int cy)
00068 {
00069 if (m_bShowDLInfo)
00070 m_splitter.ApplyRatio ();
00071 else
00072 m_tasks.MoveWindow (0, 0, cx, cy);
00073 }
00074
00075 BOOL CDownloads_Downloads::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
00076 {
00077 return CWnd::OnNotify(wParam, lParam, pResult);
00078 }
00079
00080 void CDownloads_Downloads::ShowDLInfo(BOOL bShow)
00081 {
00082 UINT nShow = bShow ? SW_SHOW : SW_HIDE;
00083 m_info.ShowWindow (nShow);
00084 ::ShowWindow (m_splitter.m_wndSplitter, nShow);
00085
00086 m_bShowDLInfo = bShow;
00087 _App.View_DLInfo (m_bShowDLInfo);
00088
00089 RECT rc;
00090 GetClientRect (&rc);
00091 OnSize (0, rc.right, rc.bottom);
00092 }
00093
00094 void CDownloads_Downloads::SaveState()
00095 {
00096 _App.View_SplitterRatio ("Downloads_DL_LOG", m_splitter.GetRatio ());
00097 m_tasks.SaveState ("DownloadsList");
00098 m_info.SaveState ();
00099 }
00100
00101 void CDownloads_Downloads::ApplyLanguage()
00102 {
00103 m_tasks.ApplyLanguage ();
00104 m_info.ApplyLanguage ();
00105 }
00106
00107 void CDownloads_Downloads::OnSetFocus(CWnd* pOldWnd)
00108 {
00109 CWnd::OnSetFocus(pOldWnd);
00110 m_tasks.SetFocus ();
00111 }
00112
00113 BOOL CDownloads_Downloads::OnEraseBkgnd(CDC* pDC)
00114 {
00115 if (m_info.m_video.m_wndVideo.m_player.Get_State () != VFPS_CLOSED)
00116 {
00117 CRect rc;
00118
00119 m_info.m_video.GetWindowRect(&rc);
00120 ScreenToClient(&rc);
00121
00122 pDC->ExcludeClipRect(&rc);
00123 }
00124
00125 return CWnd::OnEraseBkgnd(pDC);
00126 }