00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "WPDS_FilesPage.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(CWPDS_FilesPage, CPropertyPage)
00017
00018 CWPDS_FilesPage::CWPDS_FilesPage() : CPropertyPage(CWPDS_FilesPage::IDD)
00019 {
00020 m_psp.dwFlags |= PSP_USETITLE;
00021 m_psp.pszTitle = LS (L_FILES);
00022 }
00023
00024 CWPDS_FilesPage::~CWPDS_FilesPage()
00025 {
00026 }
00027
00028 void CWPDS_FilesPage::DoDataExchange(CDataExchange* pDX)
00029 {
00030 CPropertyPage::DoDataExchange(pDX);
00031
00032
00033
00034
00035 BOOL bDLAll = !m_wpds->bNotAllFiles;
00036 BOOL bEl = m_wpds->enExtsType != WPDET_OFF;
00037 BOOL bElDL = m_wpds->enExtsType != WPDET_NOTDOWNLOAD;
00038 BOOL bElNDL = !bElDL;
00039 CString strExts = m_wpds->strExts;
00040
00041 DDX_Text (pDX, IDC_EXTS, strExts);
00042
00043 DDX_Check (pDX, IDC_DLFILESFROMOTHERSITES, bDLAll);
00044 DDX_Check (pDX, IDC_ELON, bEl);
00045 DDX_Check (pDX, IDC_ELDL, bElDL);
00046 DDX_Check (pDX, IDC_ELDONTDL, bElNDL);
00047
00048 if (strExts == "" && bEl)
00049 {
00050 MessageBox (LS (L_ENTEREXTS), LS (L_INPERR), MB_ICONEXCLAMATION);
00051 GetDlgItem (IDC_EXTS)->SetFocus ();
00052 pDX->Fail ();
00053 return;
00054 }
00055
00056 DDX_Check (pDX, IDC_DLFILES, m_wpds->bDownloadFiles);
00057
00058 m_wpds->bNotAllFiles = !bDLAll;
00059 if (bEl)
00060 {
00061 if (bElDL)
00062 m_wpds->enExtsType = WPDET_DOWNLOAD;
00063 else
00064 m_wpds->enExtsType = WPDET_NOTDOWNLOAD;
00065 }
00066 else
00067 m_wpds->enExtsType = WPDET_OFF;
00068 m_wpds->strExts = strExts;
00069 }
00070
00071 BEGIN_MESSAGE_MAP(CWPDS_FilesPage, CPropertyPage)
00072
00073 ON_BN_CLICKED(IDC_DLFILES, OnDlfiles)
00074 ON_BN_CLICKED(IDC_ELON, OnElon)
00075 ON_WM_CONTEXTMENU()
00076 ON_COMMAND(ID_WHATISTHIS, OnWhatisthis)
00077 ON_BN_CLICKED(IDC_DLFILESFROMOTHERSITES, OnDlfilesfromothersites)
00078 ON_BN_CLICKED(IDC_ELDL, OnEldl)
00079 ON_BN_CLICKED(IDC_ELDONTDL, OnEldontdl)
00080 ON_EN_CHANGE(IDC_EXTS, OnChangeExts)
00081 ON_WM_HELPINFO()
00082
00083 END_MESSAGE_MAP()
00084
00085 BOOL CWPDS_FilesPage::OnInitDialog()
00086 {
00087 CPropertyPage::OnInitDialog();
00088
00089 UpdateEnabled ();
00090
00091 ApplyLanguage ();
00092
00093 return TRUE;
00094 }
00095
00096 void CWPDS_FilesPage::UpdateEnabled()
00097 {
00098 BOOL b = IsDlgButtonChecked (IDC_DLFILES) == BST_CHECKED;
00099
00100 GetDlgItem (IDC_DLFILESFROMOTHERSITES)->EnableWindow (b);
00101 GetDlgItem (IDC_ELON)->EnableWindow (b);
00102 GetDlgItem (IDC__ELIMINATION)->EnableWindow (b);
00103
00104 b = b && IsDlgButtonChecked (IDC_ELON) == BST_CHECKED;
00105 UINT nIDs [] = {
00106 IDC_ELDL, IDC_ELDONTDL, IDC__EXTS, IDC_EXTS
00107 };
00108 for (int i = 0; i < sizeof (nIDs) / sizeof (UINT); i++)
00109 GetDlgItem (nIDs [i])->EnableWindow (b);
00110 }
00111
00112 void CWPDS_FilesPage::OnDlfiles()
00113 {
00114 UpdateEnabled ();
00115 SetModified ();
00116 }
00117
00118 void CWPDS_FilesPage::OnElon()
00119 {
00120 UpdateEnabled ();
00121 SetModified ();
00122 }
00123
00124 void CWPDS_FilesPage::ApplyLanguage()
00125 {
00126 fsDlgLngInfo lnginfo [] = {
00127 fsDlgLngInfo (IDC_DLFILES, L_DLFILES),
00128 fsDlgLngInfo (IDC_DLFILESFROMOTHERSITES, L_DLFILESFROMOTHERSITES),
00129 fsDlgLngInfo (IDC__ELIMINATION, L_ELIMINATION),
00130 fsDlgLngInfo (IDC_ELON, L_TURNON),
00131 fsDlgLngInfo (IDC_ELDL, L_TODONWLOAD),
00132 fsDlgLngInfo (IDC_ELDONTDL, L_DONTDOWNLOAD),
00133 fsDlgLngInfo (IDC__EXTS, L_FILESTHISEXTS),
00134 };
00135
00136 _LngMgr.ApplyLanguage (this, lnginfo, sizeof (lnginfo) / sizeof (fsDlgLngInfo), 0);
00137 }
00138
00139 void CWPDS_FilesPage::OnContextMenu(CWnd* , CPoint point)
00140 {
00141 PrepareCHMgr (point);
00142 _CHMgr.ShowMenu ();
00143 }
00144
00145 void CWPDS_FilesPage::OnWhatisthis()
00146 {
00147 _CHMgr.OnWT ();
00148 }
00149
00150 void CWPDS_FilesPage::OnDlfilesfromothersites()
00151 {
00152 SetModified ();
00153 }
00154
00155 void CWPDS_FilesPage::OnEldl()
00156 {
00157 SetModified ();
00158 }
00159
00160 void CWPDS_FilesPage::OnEldontdl()
00161 {
00162 SetModified ();
00163 }
00164
00165 void CWPDS_FilesPage::OnChangeExts()
00166 {
00167 SetModified ();
00168 }
00169
00170 void CWPDS_FilesPage::PrepareCHMgr(CPoint point)
00171 {
00172 fsCtrlContextHelp aCH1 [] = {
00173 fsCtrlContextHelp (IDC_DLFILES, LS (L_DLFILESHERE)),
00174 fsCtrlContextHelp (IDC_DLFILESFROMOTHERSITES, LS (L_DLFILESFROMHERE)),
00175 fsCtrlContextHelp (IDC_ELON, LS (L_ELONHERE)),
00176 fsCtrlContextHelp (IDC_ELDL, LS (L_ELDLHERE)),
00177 fsCtrlContextHelp (IDC_ELDONTDL, LS (L_ELDONTDLHERE)),
00178 };
00179
00180 static fsCtrlContextHelp aCH [sizeof (aCH1) / sizeof (fsCtrlContextHelp)];
00181 CopyMemory (aCH, aCH1, sizeof (aCH));
00182
00183 _CHMgr.PrepareContextMenu (this, point, aCH, sizeof (aCH) / sizeof (fsCtrlContextHelp));
00184 }
00185
00186 BOOL CWPDS_FilesPage::OnHelpInfo(HELPINFO* pHelpInfo)
00187 {
00188 RECT rc;
00189 CWnd *pItem = GetDlgItem (pHelpInfo->iCtrlId);
00190 if (pItem == NULL)
00191 return TRUE;
00192 pItem->GetWindowRect (&rc);
00193 if (PtInRect (&rc, pHelpInfo->MousePos) == FALSE)
00194 {
00195 pHelpInfo->MousePos.x = rc.left + (rc.right - rc.left) / 2;
00196 pHelpInfo->MousePos.y = rc.top + (rc.bottom - rc.top) / 2;
00197 }
00198 PrepareCHMgr (pHelpInfo->MousePos);
00199 _CHMgr.OnWT ();
00200 return TRUE;
00201 }