00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "DownloaderProperties_CommunityPage.h"
00009
00010 #ifdef _DEBUG
00011 #define new DEBUG_NEW
00012 #undef THIS_FILE
00013 static char THIS_FILE[] = __FILE__;
00014 #endif
00015
00016 IMPLEMENT_DYNCREATE(CDownloaderProperties_CommunityPage, CPropertyPage)
00017
00018 CDownloaderProperties_CommunityPage::CDownloaderProperties_CommunityPage() : CPropertyPage(CDownloaderProperties_CommunityPage::IDD)
00019 {
00020 m_psp.dwFlags |= PSP_USETITLE;
00021 m_psp.pszTitle = LS (L_FDMCOMMUNITY);
00022 }
00023
00024 CDownloaderProperties_CommunityPage::~CDownloaderProperties_CommunityPage()
00025 {
00026 }
00027
00028 void CDownloaderProperties_CommunityPage::DoDataExchange(CDataExchange* pDX)
00029 {
00030 CPropertyPage::DoDataExchange(pDX);
00031
00032
00033
00034 }
00035
00036 BEGIN_MESSAGE_MAP(CDownloaderProperties_CommunityPage, CPropertyPage)
00037
00038 ON_BN_CLICKED(IDC_SWITCHTOOPINIONS, OnSwitchtoopinions)
00039 ON_WM_CONTEXTMENU()
00040 ON_WM_HELPINFO()
00041 ON_COMMAND(ID_WHATISTHIS, OnWhatisthis)
00042 ON_BN_CLICKED(IDC_CHECKIFMAL, OnCheckifmal)
00043 ON_BN_CLICKED(IDC_DISPLAYOPINIONS, OnDisplayopinions)
00044 ON_EN_CHANGE(IDC_MALREPSMINIMUM, OnChangeMalrepsminimum)
00045
00046 END_MESSAGE_MAP()
00047
00048 BOOL CDownloaderProperties_CommunityPage::OnInitDialog()
00049 {
00050 CPropertyPage::OnInitDialog();
00051
00052 CheckDlgButton (IDC_SWITCHTOOPINIONS, _App.Community_SwitchToOpinions () ? BST_CHECKED : BST_UNCHECKED);
00053 CheckDlgButton (IDC_CHECKIFMAL, _App.Community_CheckIfMalBeforeDlding () ? BST_CHECKED : BST_UNCHECKED);
00054 CheckDlgButton (IDC_DISPLAYOPINIONS, _App.Community_DisplayOpinionsAtDlding () ? BST_CHECKED : BST_UNCHECKED);
00055
00056 SetDlgItemInt (IDC_MALREPSMINIMUM, _App.Community_MalReportsMinPerc ());
00057
00058 ApplyLanguage ();
00059 UpdateEnabled ();
00060
00061 return TRUE;
00062 }
00063
00064 BOOL CDownloaderProperties_CommunityPage::OnApply()
00065 {
00066 _App.Community_SwitchToOpinions (IsDlgButtonChecked (IDC_SWITCHTOOPINIONS) == BST_CHECKED);
00067 _App.Community_DisplayOpinionsAtDlding (IsDlgButtonChecked (IDC_DISPLAYOPINIONS) == BST_CHECKED);
00068 BOOL b = IsDlgButtonChecked (IDC_CHECKIFMAL) == BST_CHECKED;
00069 _App.Community_CheckIfMalBeforeDlding (b);
00070 if (b)
00071 _App.Community_MalReportsMinPerc (GetDlgItemInt (IDC_MALREPSMINIMUM));
00072
00073 return CPropertyPage::OnApply();
00074 }
00075
00076 void CDownloaderProperties_CommunityPage::ApplyLanguage()
00077 {
00078 fsDlgLngInfo lnginfo [] = {
00079 fsDlgLngInfo (IDC_SWITCHTOOPINIONS, L_SWITCHTOOPINIONS),
00080 fsDlgLngInfo (IDC_CHECKIFMAL, L_CHECKNEWDLDIFITISMALICIOUS),
00081 fsDlgLngInfo (IDC_DISPLAYOPINIONS, L_DISPLAYOPINIONSWHENDOWNLOADING),
00082 fsDlgLngInfo (IDC__S0, L_CONSIDER_DLD_AS_MAL_IF_MIN_0),
00083 fsDlgLngInfo (IDC__S1, L_CONSIDER_DLD_AS_MAL_IF_MIN_1),
00084 };
00085
00086 _LngMgr.ApplyLanguage ( this, lnginfo, sizeof (lnginfo) / sizeof (fsDlgLngInfo), 0);
00087 }
00088
00089 void CDownloaderProperties_CommunityPage::OnSwitchtoopinions()
00090 {
00091 SetModified ();
00092 }
00093
00094 void CDownloaderProperties_CommunityPage::OnContextMenu(CWnd* pWnd, CPoint point)
00095 {
00096 PrepareCHMgr (point);
00097 _CHMgr.ShowMenu ();
00098 }
00099
00100 BOOL CDownloaderProperties_CommunityPage::OnHelpInfo(HELPINFO* pHelpInfo)
00101 {
00102 RECT rc;
00103 CWnd *pItem = GetDlgItem (pHelpInfo->iCtrlId);
00104 if (pItem == NULL)
00105 return TRUE;
00106 pItem->GetWindowRect (&rc);
00107 if (PtInRect (&rc, pHelpInfo->MousePos) == FALSE)
00108 {
00109 pHelpInfo->MousePos.x = rc.left + (rc.right - rc.left) / 2;
00110 pHelpInfo->MousePos.y = rc.top + (rc.bottom - rc.top) / 2;
00111 }
00112 PrepareCHMgr (pHelpInfo->MousePos);
00113 _CHMgr.OnWT ();
00114 return TRUE;
00115 }
00116
00117 void CDownloaderProperties_CommunityPage::OnWhatisthis()
00118 {
00119 _CHMgr.OnWT ();
00120 }
00121
00122 void CDownloaderProperties_CommunityPage::PrepareCHMgr(CPoint point)
00123 {
00124 fsCtrlContextHelp aCH1 [] = {
00125 fsCtrlContextHelp (IDC_SWITCHTOOPINIONS, LS (L_SWITCHTOOPINIONS_HERE)),
00126 fsCtrlContextHelp (IDC_CHECKIFMAL, LS (L_CHECKNEWDLDIFITISMALICIOUS_HERE)),
00127 fsCtrlContextHelp (IDC_DISPLAYOPINIONS, LS (L_DISPLAYOPINIONSWHENDOWNLOADING_HERE)),
00128 };
00129
00130 static fsCtrlContextHelp aCH [sizeof (aCH1) / sizeof (fsCtrlContextHelp)];
00131 CopyMemory (aCH, aCH1, sizeof (aCH));
00132
00133 _CHMgr.PrepareContextMenu (this, point, aCH, sizeof (aCH) / sizeof (fsCtrlContextHelp));
00134 }
00135
00136 void CDownloaderProperties_CommunityPage::OnCheckifmal()
00137 {
00138 SetModified ();
00139 UpdateEnabled ();
00140 }
00141
00142 void CDownloaderProperties_CommunityPage::OnDisplayopinions()
00143 {
00144 SetModified ();
00145 }
00146
00147 void CDownloaderProperties_CommunityPage::OnChangeMalrepsminimum()
00148 {
00149 SetModified ();
00150 }
00151
00152 void CDownloaderProperties_CommunityPage::UpdateEnabled()
00153 {
00154 BOOL b = IsDlgButtonChecked (IDC_CHECKIFMAL) == BST_CHECKED;
00155 GetDlgItem (IDC__S0)->EnableWindow (b);
00156 GetDlgItem (IDC__S1)->EnableWindow (b);
00157 GetDlgItem (IDC_MALREPSMINIMUM)->EnableWindow (b);
00158 }