OptionsGeneral.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. // OptionsGeneral.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CP_Main.h"
  5. #include "OptionsGeneral.h"
  6. #include "InternetUpdate.h"
  7. #include <io.h>
  8. #include <Mmsystem.h> //play sound
  9. #include "Path.h"
  10. #include "AccessToSqlite.h"
  11. #include "AdvGeneral.h"
  12. #include "DimWnd.h"
  13. #include "HyperLink.h"
  14. using namespace nsPath;
  15. #define DEFAULT_THEME _T("(Default)")
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. /////////////////////////////////////////////////////////////////////////////
  22. // COptionsGeneral property page
  23. IMPLEMENT_DYNCREATE(COptionsGeneral, CPropertyPage)
  24. COptionsGeneral::COptionsGeneral() : CPropertyPage(COptionsGeneral::IDD)
  25. {
  26. m_csTitle = theApp.m_Language.GetString("GeneralTitle", "General");
  27. m_psp.pszTitle = m_csTitle;
  28. m_psp.dwFlags |= PSP_USETITLE;
  29. memset(&m_LogFont, 0, sizeof(LOGFONT));
  30. //{{AFX_DATA_INIT(COptionsGeneral)
  31. //}}AFX_DATA_INIT
  32. }
  33. COptionsGeneral::~COptionsGeneral()
  34. {
  35. }
  36. void COptionsGeneral::DoDataExchange(CDataExchange* pDX)
  37. {
  38. CPropertyPage::DoDataExchange(pDX);
  39. //{{AFX_DATA_MAP(COptionsGeneral)
  40. //DDX_Control(pDX, IDC_ENSURE, m_EnsureConnected);
  41. // DDX_Control(pDX, IDC_EDIT_SAVE_DELAY, m_SaveDelay);
  42. DDX_Control(pDX, IDC_COMBO_LANGUAGE, m_cbLanguage);
  43. DDX_Control(pDX, IDC_PATH, m_ePath);
  44. DDX_Control(pDX, IDC_EXPIRE_AFTER, m_eExpireAfter);
  45. DDX_Control(pDX, IDC_MAX_SAVED_COPIES, m_eMaxSavedCopies);
  46. DDX_Control(pDX, IDC_EXPIRE, m_btExpire);
  47. DDX_Control(pDX, IDC_START_ON_STARTUP, m_btRunOnStartup);
  48. DDX_Control(pDX, IDC_EDIT_APP_COPY_INCLUDE, m_copyAppInclude);
  49. DDX_Control(pDX, IDC_EDIT_APP_COPY_EXCLUDE, m_copyAppExclude);
  50. DDX_Control(pDX, IDC_MAXIMUM, m_btMaximumCheck);
  51. //}}AFX_DATA_MAP
  52. DDX_Control(pDX, IDC_COMBO_THEME, m_cbTheme);
  53. DDX_Control(pDX, IDC_BUTTON_FONT, m_btFont);
  54. DDX_Control(pDX, IDC_BUTTON_DEFAULT_FAULT, m_btDefaultButton);
  55. DDX_Control(pDX, IDC_COMBO_POPUP_POSITION, m_popupPositionCombo);
  56. DDX_Control(pDX, IDC_MFCLINK_ENV_VAR, m_envVarLink);
  57. }
  58. BEGIN_MESSAGE_MAP(COptionsGeneral, CPropertyPage)
  59. //{{AFX_MSG_MAP(COptionsGeneral)
  60. ON_BN_CLICKED(IDC_GET_PATH, OnGetPath)
  61. ON_BN_CLICKED(IDC_BUTTON_ABOUT, OnButtonAbout)
  62. //}}AFX_MSG_MAP
  63. ON_BN_CLICKED(IDC_BUTTON_ADVANCED, &COptionsGeneral::OnBnClickedButtonAdvanced)
  64. ON_WM_CTLCOLOR()
  65. ON_BN_CLICKED(IDC_BUTTON_THEME, &COptionsGeneral::OnBnClickedButtonTheme)
  66. ON_BN_CLICKED(IDC_BUTTON_DEFAULT_FAULT, &COptionsGeneral::OnBnClickedButtonDefaultFault)
  67. ON_BN_CLICKED(IDC_BUTTON_FONT, &COptionsGeneral::OnBnClickedButtonFont)
  68. ON_EN_CHANGE(IDC_PATH, &COptionsGeneral::OnEnChangePath)
  69. END_MESSAGE_MAP()
  70. /////////////////////////////////////////////////////////////////////////////
  71. // COptionsGeneral message handlers
  72. BOOL COptionsGeneral::OnInitDialog()
  73. {
  74. CPropertyPage::OnInitDialog();
  75. CString url = _T("https://sourceforge.net/p/ditto-cp/wiki/EnvironmentVariables/");
  76. /*m_envVarLink.SetURL(_T("\"") + url);
  77. m_envVarLink.SetFontSize(-9);*/
  78. m_brush.CreateSolidBrush(RGB(251, 251, 251));
  79. m_pParent = (COptionsSheet *)GetParent();
  80. #ifndef _DEBUG
  81. if (CGetSetOptions::GetIsWindowsApp())
  82. {
  83. m_btRunOnStartup.SetCheck(BST_CHECKED);
  84. GetDlgItem(IDC_START_ON_STARTUP)->EnableWindow(FALSE);
  85. }
  86. else
  87. {
  88. m_btRunOnStartup.SetCheck(CGetSetOptions::GetRunOnStartUp());
  89. }
  90. #endif
  91. m_btMaximumCheck.SetCheck(CGetSetOptions::GetCheckForMaxEntries());
  92. m_btExpire.SetCheck(CGetSetOptions::GetCheckForExpiredEntries());
  93. m_eExpireAfter.SetNumber(CGetSetOptions::GetExpiredEntries());
  94. m_eMaxSavedCopies.SetNumber(CGetSetOptions::GetMaxEntries());
  95. m_copyAppInclude.SetWindowText(g_Opt.GetCopyAppInclude());
  96. m_copyAppExclude.SetWindowText(g_Opt.GetCopyAppExclude());
  97. CString csPath = CGetSetOptions::GetDBPath(false);
  98. m_ePath.SetWindowText(csPath);
  99. if (CGetSetOptions::GetFont(m_LogFont))
  100. {
  101. m_Font.CreateFontIndirect(&m_LogFont);
  102. m_btFont.SetFont(&m_Font);
  103. }
  104. else
  105. {
  106. CFont *ft = m_btFont.GetFont();
  107. ft->GetLogFont(&m_LogFont);
  108. }
  109. CString cs;
  110. cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, abs(theApp.m_metrics.PixelsToPoints(m_LogFont.lfHeight)));
  111. m_btFont.SetWindowText(cs);
  112. FillThemes();
  113. FillLanguages();
  114. int caretPos = m_popupPositionCombo.AddString(_T("At Caret"));
  115. m_popupPositionCombo.SetItemData(caretPos, POS_AT_CARET);
  116. int cursorPos = m_popupPositionCombo.AddString(_T("At Cursor"));
  117. m_popupPositionCombo.SetItemData(cursorPos, POS_AT_CURSOR);
  118. int prevPos = m_popupPositionCombo.AddString(_T("At Previous Position"));
  119. m_popupPositionCombo.SetItemData(prevPos, POS_AT_PREVIOUS);
  120. switch (CGetSetOptions::GetQuickPastePosition())
  121. {
  122. case POS_AT_CARET:
  123. m_popupPositionCombo.SetCurSel(caretPos);
  124. break;
  125. case POS_AT_CURSOR:
  126. m_popupPositionCombo.SetCurSel(cursorPos);
  127. break;
  128. case POS_AT_PREVIOUS:
  129. m_popupPositionCombo.SetCurSel(prevPos);
  130. break;
  131. default:
  132. m_popupPositionCombo.SetCurSel(cursorPos);
  133. }
  134. UpdateData(FALSE);
  135. theApp.m_Language.UpdateOptionGeneral(this);
  136. OnEnChangePath();
  137. return TRUE;
  138. }
  139. #define NO_MATCH -2
  140. #define FOUND_MATCH -1
  141. void COptionsGeneral::FillLanguages()
  142. {
  143. CString csFile = CGetSetOptions::GetPath(PATH_LANGUAGE);
  144. csFile += "*.xml";
  145. CString csLanguage = CGetSetOptions::GetLanguageFile();
  146. CFileFind find;
  147. BOOL bCont = find.FindFile(csFile);
  148. int nEnglishIndex = NO_MATCH;
  149. while(bCont)
  150. {
  151. bCont = find.FindNextFile();
  152. int nIndex = m_cbLanguage.AddString(find.GetFileTitle());
  153. if(find.GetFileTitle() == csLanguage)
  154. {
  155. nEnglishIndex = -1;
  156. m_cbLanguage.SetCurSel(nIndex);
  157. }
  158. else if(find.GetFileTitle() == _T("English"))
  159. {
  160. if(nEnglishIndex == NO_MATCH)
  161. nEnglishIndex = nIndex;
  162. }
  163. }
  164. if(nEnglishIndex >= 0)
  165. {
  166. m_cbLanguage.SetCurSel(nEnglishIndex);
  167. }
  168. }
  169. BOOL COptionsGeneral::OnApply()
  170. {
  171. UpdateData();
  172. #ifndef _DEBUG
  173. if (CGetSetOptions::GetIsWindowsApp() == FALSE)
  174. {
  175. CGetSetOptions::SetRunOnStartUp(m_btRunOnStartup.GetCheck());
  176. }
  177. #endif
  178. CGetSetOptions::SetCheckForMaxEntries(m_btMaximumCheck.GetCheck());
  179. CGetSetOptions::SetCheckForExpiredEntries(m_btExpire.GetCheck());
  180. CGetSetOptions::SetMaxEntries(m_eMaxSavedCopies.GetNumber());
  181. CGetSetOptions::SetExpiredEntries(m_eExpireAfter.GetNumber());
  182. CString stringVal;
  183. m_copyAppInclude.GetWindowText(stringVal);
  184. g_Opt.SetCopyAppInclude(stringVal);
  185. m_copyAppExclude.GetWindowText(stringVal);
  186. g_Opt.SetCopyAppExclude(stringVal);
  187. CString csLanguage;
  188. if(m_cbLanguage.GetCurSel() >= 0)
  189. {
  190. m_cbLanguage.GetLBText(m_cbLanguage.GetCurSel(), csLanguage);
  191. g_Opt.SetLanguageFile(csLanguage);
  192. }
  193. if(csLanguage.IsEmpty() == FALSE)
  194. {
  195. if(!theApp.m_Language.LoadLanguageFile(csLanguage))
  196. {
  197. CString cs;
  198. cs.Format(_T("Error loading language file - %s - \n\n%s"), csLanguage, theApp.m_Language.m_csLastError);
  199. MessageBox(cs, _T("Ditto"), MB_OK);
  200. }
  201. }
  202. CString toSavePath;
  203. m_ePath.GetWindowText(toSavePath);
  204. CString resolvedPath = CGetSetOptions::ResolvePath(toSavePath);
  205. bool bOpenNewDatabase = false;
  206. if(resolvedPath.IsEmpty() == FALSE)
  207. {
  208. if(FileExists(resolvedPath) == FALSE)
  209. {
  210. CString cs;
  211. cs.Format(_T("The database %s does not exist.\n\nCreate a new database?"), resolvedPath);
  212. if(MessageBox(cs, _T("Ditto"), MB_YESNO) == IDYES)
  213. {
  214. // -- create a new one
  215. if(CreateDB(resolvedPath))
  216. {
  217. bOpenNewDatabase = true;
  218. }
  219. else
  220. MessageBox(_T("Error Creating Database"));
  221. }
  222. else
  223. return FALSE;
  224. }
  225. else
  226. {
  227. if(ValidDB(resolvedPath) == FALSE)
  228. {
  229. MessageBox(_T("Invalid Database"), _T("Ditto"), MB_OK);
  230. m_ePath.SetFocus();
  231. return FALSE;
  232. }
  233. else
  234. {
  235. bOpenNewDatabase = true;
  236. }
  237. }
  238. if(bOpenNewDatabase)
  239. {
  240. CGetSetOptions::SetDBPath(toSavePath);
  241. if(OpenDatabase(resolvedPath) == FALSE)
  242. {
  243. MessageBox(_T("Error Opening new database"), _T("Ditto"), MB_OK);
  244. m_ePath.SetFocus();
  245. return FALSE;
  246. }
  247. else
  248. {
  249. theApp.RefreshView();
  250. }
  251. }
  252. }
  253. CGetSetOptions::SetQuickPastePosition(m_popupPositionCombo.GetItemData(m_popupPositionCombo.GetCurSel()));
  254. if (m_LogFont.lfWeight != 0)
  255. {
  256. CGetSetOptions::SetFont(m_LogFont);
  257. }
  258. CString currentTheme = g_Opt.GetTheme();
  259. CString csTheme;
  260. if (m_cbTheme.GetCurSel() >= 0)
  261. {
  262. m_cbTheme.GetLBText(m_cbTheme.GetCurSel(), csTheme);
  263. if (csTheme == DEFAULT_THEME)
  264. {
  265. g_Opt.SetTheme("");
  266. csTheme = _T("");
  267. }
  268. else
  269. g_Opt.SetTheme(csTheme);
  270. }
  271. else
  272. {
  273. g_Opt.SetTheme("");
  274. }
  275. if (currentTheme != csTheme)
  276. {
  277. m_pParent->m_themeChanged = TRUE;
  278. }
  279. return CPropertyPage::OnApply();
  280. }
  281. BOOL COptionsGeneral::OnSetActive()
  282. {
  283. return CPropertyPage::OnSetActive();
  284. }
  285. //void COptionsGeneral::OnSetDbPath()
  286. //{
  287. // if(m_btSetDatabasePath.GetCheck() == BST_CHECKED)
  288. // {
  289. // m_ePath.EnableWindow(TRUE);
  290. // m_btGetPath.EnableWindow(TRUE);
  291. // }
  292. // else
  293. // {
  294. // m_ePath.EnableWindow(FALSE);
  295. // m_btGetPath.EnableWindow(FALSE);
  296. // }
  297. //}
  298. void COptionsGeneral::OnGetPath()
  299. {
  300. OPENFILENAME FileName;
  301. TCHAR szFileName[400];
  302. TCHAR szDir[400];
  303. memset(&FileName, 0, sizeof(FileName));
  304. memset(szFileName, 0, sizeof(szFileName));
  305. memset(&szDir, 0, sizeof(szDir));
  306. FileName.lStructSize = sizeof(FileName);
  307. FileName.lpstrTitle = _T("Open Database");
  308. FileName.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;
  309. FileName.nMaxFile = 400;
  310. FileName.lpstrFile = szFileName;
  311. FileName.lpstrInitialDir = szDir;
  312. FileName.lpstrFilter = _T("Ditto Databases (*.db; *.mdb)\0*.db;*.mdb\0\0");
  313. FileName.lpstrDefExt = _T("db");
  314. FileName.hwndOwner = m_hWnd;
  315. if(GetOpenFileName(&FileName) == 0)
  316. return;
  317. CString csPath(FileName.lpstrFile);
  318. CPath path(FileName.lpstrFile);
  319. if(path.GetExtension() == _T("mdb"))
  320. {
  321. CString cs;
  322. cs.Format(_T("The database '%s' must be converted to a Sqlite Database (Version 3 format).\n\nConvert database?"), FileName.lpstrFile);
  323. if(MessageBox(cs, _T("Ditto"), MB_YESNO) == IDNO)
  324. return;
  325. CString csNewDBPath = path.RemoveExtension();
  326. //Make sure the db name is unique
  327. CString csTempName;
  328. csTempName.Format(_T("%s.db"), csNewDBPath);
  329. int i = 1;
  330. while(FileExists(csTempName))
  331. {
  332. csTempName.Format(_T("%s_%d.db"), csNewDBPath, i);
  333. i++;
  334. }
  335. csNewDBPath = csTempName;
  336. CreateDB(csNewDBPath);
  337. CAccessToSqlite Convert;
  338. if(Convert.ConvertDatabase(csNewDBPath, FileName.lpstrFile))
  339. {
  340. csPath = csNewDBPath;
  341. }
  342. else
  343. {
  344. MessageBox(_T("Error converting database."), _T("Ditto"), MB_OK);
  345. DeleteFile(csNewDBPath);
  346. return;
  347. }
  348. }
  349. if(FileExists(csPath))
  350. {
  351. if(ValidDB(csPath) == FALSE)
  352. {
  353. MessageBox(_T("Invalid Database"), _T("Ditto"), MB_OK);
  354. m_ePath.SetFocus();
  355. }
  356. else
  357. {
  358. m_ePath.SetWindowText(csPath);
  359. }
  360. }
  361. else
  362. {
  363. m_ePath.SetWindowText(csPath);
  364. }
  365. }
  366. void COptionsGeneral::OnButtonAbout()
  367. {
  368. CDimWnd dim(this->GetParent());
  369. CMultiLanguage Lang;
  370. CString csLanguage;
  371. m_cbLanguage.GetLBText(m_cbLanguage.GetCurSel(), csLanguage);
  372. Lang.SetOnlyGetHeader(true);
  373. if(Lang.LoadLanguageFile(csLanguage))
  374. {
  375. CString csMessage;
  376. csMessage.Format(_T("Language - %s\n")
  377. _T("Version - %d\n")
  378. _T("Author - %s\n")
  379. _T("Notes - %s"), csLanguage,
  380. Lang.GetVersion(),
  381. Lang.GetAuthor(),
  382. Lang.GetNotes());
  383. MessageBox(csMessage, _T("Ditto"), MB_OK);
  384. }
  385. else
  386. {
  387. CString csError;
  388. csError.Format(_T("Error loading language file - %s - reason = "), csLanguage, Lang.m_csLastError);
  389. MessageBox(csError, _T("Ditto"), MB_OK);
  390. }
  391. }
  392. void COptionsGeneral::OnBnClickedButtonAdvanced()
  393. {
  394. CDimWnd dim(this->GetParent());
  395. CAdvGeneral adv(this);
  396. adv.DoModal();
  397. }
  398. HBRUSH COptionsGeneral::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  399. {
  400. HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
  401. switch(nCtlColor)
  402. {
  403. case CTLCOLOR_DLG: // dialog
  404. case CTLCOLOR_STATIC: // static, checkbox, read-only edit, etc.
  405. //pDC->SetBkColor(RGB(251, 251, 251));
  406. //hbr = m_brush;
  407. break;
  408. }
  409. return hbr;
  410. }
  411. void COptionsGeneral::FillThemes()
  412. {
  413. CString csFile = CGetSetOptions::GetPath(PATH_THEMES);
  414. csFile += "*.xml";
  415. CString csTheme = CGetSetOptions::GetTheme();
  416. CFileFind find;
  417. BOOL bCont = find.FindFile(csFile);
  418. bool bSetCurSel = false;
  419. while (bCont)
  420. {
  421. bCont = find.FindNextFile();
  422. CTheme theme;
  423. if (theme.Load(find.GetFileTitle(), true, false))
  424. {
  425. if (theme.FileVersion() >= 2 && theme.FileVersion() < 100)
  426. {
  427. int nIndex = m_cbTheme.AddString(find.GetFileTitle());
  428. if (find.GetFileTitle() == csTheme)
  429. {
  430. m_cbTheme.SetCurSel(nIndex);
  431. bSetCurSel = true;
  432. }
  433. }
  434. }
  435. }
  436. int nIndex = m_cbTheme.AddString(DEFAULT_THEME);
  437. if (bSetCurSel == false)
  438. {
  439. m_cbTheme.SetCurSel(nIndex);
  440. }
  441. }
  442. void COptionsGeneral::OnBnClickedButtonTheme()
  443. {
  444. CDimWnd dim(this->GetParent());
  445. CTheme theme;
  446. CString csTheme;
  447. m_cbTheme.GetLBText(m_cbTheme.GetCurSel(), csTheme);
  448. if (csTheme == DEFAULT_THEME)
  449. return;
  450. if (theme.Load(csTheme, true, false))
  451. {
  452. CString csMessage;
  453. csMessage.Format(_T("Theme - %s\n")
  454. _T("Version - %d\n")
  455. _T("Author - %s\n")
  456. _T("Notes - %s"), csTheme,
  457. theme.FileVersion(),
  458. theme.Author(),
  459. theme.Notes());
  460. MessageBox(csMessage, _T("Ditto"), MB_OK);
  461. }
  462. else
  463. {
  464. CString csError;
  465. csError.Format(_T("Error loading theme file - %s - reason = "), csTheme, theme.LastError());
  466. MessageBox(csError, _T("Ditto"), MB_OK);
  467. }
  468. }
  469. void COptionsGeneral::OnBnClickedButtonDefaultFault()
  470. {
  471. CFont *ft = m_btDefaultButton.GetFont();
  472. ft->GetLogFont(&m_LogFont);
  473. memset(&m_LogFont, 0, sizeof(m_LogFont));
  474. m_LogFont.lfHeight = -theApp.m_metrics.PointsToPixels(10);
  475. m_LogFont.lfWeight = 400;
  476. m_LogFont.lfCharSet = 1;
  477. STRCPY(m_LogFont.lfFaceName, _T("Segoe UI"));
  478. m_Font.DeleteObject();
  479. m_Font.CreateFontIndirect(&m_LogFont);
  480. m_btFont.SetFont(&m_Font);
  481. CString cs;
  482. cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, abs(theApp.m_metrics.PixelsToPoints(m_LogFont.lfHeight)));
  483. m_btFont.SetWindowText(cs);
  484. this->SetFont(&m_Font);
  485. }
  486. void COptionsGeneral::OnBnClickedButtonFont()
  487. {
  488. CFontDialog dlg(&m_LogFont, (CF_TTONLY | CF_SCREENFONTS), 0, this);
  489. if (dlg.DoModal() == IDOK)
  490. {
  491. m_Font.DeleteObject();
  492. memcpy(&m_LogFont, dlg.m_cf.lpLogFont, sizeof(LOGFONT));
  493. m_Font.CreateFontIndirect(&m_LogFont);
  494. m_btFont.SetFont(&m_Font);
  495. CString cs;
  496. cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, abs(theApp.m_metrics.PixelsToPoints(m_LogFont.lfHeight)));
  497. m_btFont.SetWindowText(cs);
  498. }
  499. }
  500. //void COptionsGeneral::OnNMClickSyslinkEnvVarInfo(NMHDR *pNMHDR, LRESULT *pResult)
  501. //{
  502. // CString url = _T("https:////sourceforge.net//p//ditto-cp//wiki//EnvironmentVariables//");
  503. //
  504. // CHyperLink::GotoURL(url, SW_SHOW);
  505. //
  506. // *pResult = 0;
  507. //}
  508. //
  509. //
  510. //void COptionsGeneral::OnEnChangePath()
  511. //{
  512. // // TODO: If this is a RICHEDIT control, the control will not
  513. // // send this notification unless you override the CPropertyPage::OnInitDialog()
  514. // // function and call CRichEditCtrl().SetEventMask()
  515. // // with the ENM_CHANGE flag ORed into the mask.
  516. //
  517. // // TODO: Add your control notification handler code here
  518. //}
  519. void COptionsGeneral::OnEnChangePath()
  520. {
  521. // TODO: If this is a RICHEDIT control, the control will not
  522. // send this notification unless you override the CPropertyPage::OnInitDialog()
  523. // function and call CRichEditCtrl().SetEventMask()
  524. // with the ENM_CHANGE flag ORed into the mask.
  525. // TODO: Add your control notification handler code here
  526. CString toSavePath;
  527. m_ePath.GetWindowText(toSavePath);
  528. if (toSavePath.Find(_T("%")) >= 0)
  529. {
  530. CString resolvedPath = CGetSetOptions::ResolvePath(toSavePath);
  531. m_envVarLink.SetWindowText(resolvedPath);
  532. }
  533. else
  534. {
  535. m_envVarLink.SetWindowText(_T("Environment Variables"));
  536. }
  537. }