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