00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "DownloaderProperties_NotificationsPage.h"
00009 #include "DlgSounds.h"
00010
00011 #ifdef _DEBUG
00012 #define new DEBUG_NEW
00013 #undef THIS_FILE
00014 static char THIS_FILE[] = __FILE__;
00015 #endif
00016
00017 IMPLEMENT_DYNCREATE(CDownloaderProperties_NotificationsPage, CPropertyPage)
00018
00019 CDownloaderProperties_NotificationsPage::CDownloaderProperties_NotificationsPage() : CPropertyPage(CDownloaderProperties_NotificationsPage::IDD)
00020 {
00021 m_psp.dwFlags |= PSP_USETITLE;
00022 m_psp.pszTitle = LS (L_NOTIFICATIONS);
00023 }
00024
00025 CDownloaderProperties_NotificationsPage::~CDownloaderProperties_NotificationsPage()
00026 {
00027 }
00028
00029 void CDownloaderProperties_NotificationsPage::DoDataExchange(CDataExchange* pDX)
00030 {
00031 CPropertyPage::DoDataExchange(pDX);
00032
00033 DDX_Control(pDX, IDC_TIMEOUTSPIN, m_wndTSpin);
00034
00035 }
00036
00037 BEGIN_MESSAGE_MAP(CDownloaderProperties_NotificationsPage, CPropertyPage)
00038
00039 ON_WM_CONTEXTMENU()
00040 ON_WM_HELPINFO()
00041 ON_COMMAND(ID_WHATISTHIS, OnWhatisthis)
00042 ON_EN_CHANGE(IDC_TIMEOUT, OnChangeTimeout)
00043 ON_BN_CLICKED(IDC_USEBALLOON, OnUseballoon)
00044 ON_BN_CLICKED(IDC_USESOUNDS, OnUsesounds)
00045 ON_BN_CLICKED(IDC_CUSTOMIZE, OnCustomize)
00046 ON_BN_CLICKED(IDC_DISABLEFORBATCHDLDS, OnDisableforbatchdlds)
00047
00048 END_MESSAGE_MAP()
00049
00050 BOOL CDownloaderProperties_NotificationsPage::OnInitDialog()
00051 {
00052 CPropertyPage::OnInitDialog();
00053
00054 m_wndTSpin.SetRange (1, UD_MAXVAL);
00055
00056 CheckDlgButton (IDC_USEBALLOON, _App.Notif_UseBalloon () ? BST_CHECKED : BST_UNCHECKED);
00057 SetDlgItemInt (IDC_TIMEOUT, _App.Notif_BalloonTimeout ());
00058
00059 CheckDlgButton (IDC_USESOUNDS, _App.Snd_Use () ? BST_CHECKED : BST_UNCHECKED);
00060
00061 CheckDlgButton (IDC_DISABLEFORBATCHDLDS, _App.Notif_DisableForBatchDownloads () ? BST_CHECKED : BST_UNCHECKED);
00062
00063 ApplyLanguage ();
00064 UpdateEnabled ();
00065
00066 return TRUE;
00067 }
00068
00069 void CDownloaderProperties_NotificationsPage::ApplyLanguage()
00070 {
00071 fsDlgLngInfo lnginfo [] = {
00072 fsDlgLngInfo (IDC_USEBALLOON, L_USEBALLOONS),
00073 fsDlgLngInfo (IDC__TIMEOUT, L_TIMEOUT),
00074 fsDlgLngInfo (IDC__SEC, L_SECS),
00075 fsDlgLngInfo (IDC_USESOUNDS, L_USESOUNDS),
00076 fsDlgLngInfo (IDC_CUSTOMIZE, L_CUSTOMIZE),
00077 fsDlgLngInfo (IDC_DISABLEFORBATCHDLDS, L_DISABLENOTIFICATIONSFORBATCHDLDS),
00078 };
00079
00080 _LngMgr.ApplyLanguage ( this, lnginfo, sizeof (lnginfo) / sizeof (fsDlgLngInfo), 0);
00081 }
00082
00083 void CDownloaderProperties_NotificationsPage::OnContextMenu(CWnd* , CPoint point)
00084 {
00085 PrepareCHMgr (point);
00086 _CHMgr.ShowMenu ();
00087 }
00088
00089 BOOL CDownloaderProperties_NotificationsPage::OnHelpInfo(HELPINFO* pHelpInfo)
00090 {
00091 RECT rc;
00092 CWnd *pItem = GetDlgItem (pHelpInfo->iCtrlId);
00093 if (pItem == NULL)
00094 return TRUE;
00095 pItem->GetWindowRect (&rc);
00096 if (PtInRect (&rc, pHelpInfo->MousePos) == FALSE)
00097 {
00098 pHelpInfo->MousePos.x = rc.left + (rc.right - rc.left) / 2;
00099 pHelpInfo->MousePos.y = rc.top + (rc.bottom - rc.top) / 2;
00100 }
00101 PrepareCHMgr (pHelpInfo->MousePos);
00102 _CHMgr.OnWT ();
00103 return TRUE;
00104 }
00105
00106 void CDownloaderProperties_NotificationsPage::OnWhatisthis()
00107 {
00108 _CHMgr.OnWT ();
00109 }
00110
00111 void CDownloaderProperties_NotificationsPage::PrepareCHMgr(CPoint point)
00112 {
00113 static CString _strDisableForBatchDlds;
00114 _strDisableForBatchDlds.Format (LS (L_DISABLENOTIFICATIONSFORBATCHDLDS_HERE),
00115 LS (L_CREATEBATCHDLD));
00116 fsCtrlContextHelp aCH1 [] = {
00117 fsCtrlContextHelp (IDC_USEBALLOON, LS (L_USEBALLOONSHERE)),
00118 fsCtrlContextHelp (IDC__TIMEOUT, LS (L_BALLOONTIMEOUTHERE)),
00119 fsCtrlContextHelp (IDC_TIMEOUT, LS (L_BALLOONTIMEOUTHERE)),
00120 fsCtrlContextHelp (IDC_USESOUNDS, LS (L_USESOUNDSHERE)),
00121 fsCtrlContextHelp (IDC_CUSTOMIZE, LS (L_CUSTOMIZESOUNDSHERE)),
00122 fsCtrlContextHelp (IDC_DISABLEFORBATCHDLDS, _strDisableForBatchDlds),
00123 };
00124
00125 static fsCtrlContextHelp aCH [sizeof (aCH1) / sizeof (fsCtrlContextHelp)];
00126 CopyMemory (aCH, aCH1, sizeof (aCH));
00127
00128 _CHMgr.PrepareContextMenu (this, point, aCH, sizeof (aCH) / sizeof (fsCtrlContextHelp));
00129 }
00130
00131 void CDownloaderProperties_NotificationsPage::OnChangeTimeout()
00132 {
00133 SetModified ();
00134 }
00135
00136 void CDownloaderProperties_NotificationsPage::OnUseballoon()
00137 {
00138 if (GetShell32Version () < 5)
00139 {
00140 MessageBox (LS (L_AVAILON2000), LS (L_ERR), MB_ICONEXCLAMATION);
00141 CheckDlgButton (IDC_USEBALLOON, BST_UNCHECKED);
00142 return;
00143 }
00144
00145 SetModified ();
00146 UpdateEnabled ();
00147 }
00148
00149 void CDownloaderProperties_NotificationsPage::UpdateEnabled()
00150 {
00151 BOOL b = IsDlgButtonChecked (IDC_USEBALLOON) == BST_CHECKED;
00152
00153 GetDlgItem (IDC__TIMEOUT)->EnableWindow (b);
00154 GetDlgItem (IDC_TIMEOUT)->EnableWindow (b);
00155 GetDlgItem (IDC_TIMEOUTSPIN)->EnableWindow (b);
00156 GetDlgItem (IDC__SEC)->EnableWindow (b);
00157
00158 GetDlgItem (IDC_CUSTOMIZE)->EnableWindow (
00159 IsDlgButtonChecked (IDC_USESOUNDS) == BST_CHECKED);
00160 }
00161
00162 BOOL CDownloaderProperties_NotificationsPage::OnApply()
00163 {
00164 _App.Notif_UseBalloon (IsDlgButtonChecked (IDC_USEBALLOON) == BST_CHECKED);
00165 _App.Notif_BalloonTimeout (GetDlgItemInt (IDC_TIMEOUT));
00166
00167 _App.Snd_Use (IsDlgButtonChecked (IDC_USESOUNDS) == BST_CHECKED);
00168 _Snds.ReadSettings ();
00169
00170 _App.Notif_DisableForBatchDownloads (IsDlgButtonChecked (IDC_DISABLEFORBATCHDLDS) == BST_CHECKED);
00171
00172 return CPropertyPage::OnApply();
00173 }
00174
00175 void CDownloaderProperties_NotificationsPage::OnUsesounds()
00176 {
00177 SetModified ();
00178 UpdateEnabled ();
00179 }
00180
00181 void CDownloaderProperties_NotificationsPage::OnCustomize()
00182 {
00183 CDlgSounds dlg;
00184 _DlgMgr.DoModal (&dlg);
00185 }
00186
00187 void CDownloaderProperties_NotificationsPage::OnDisableforbatchdlds()
00188 {
00189 SetModified ();
00190 }