CMakeSetupDialog.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. // pcbuilderdialogDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CMakeSetup.h"
  5. #include "PathDialog.h"
  6. #include "CMakeSetupDialog.h"
  7. #include "../cmCacheManager.h"
  8. #include "../cmake.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CAboutDlg dialog used for App About
  16. class CAboutDlg : public CDialog
  17. {
  18. public:
  19. CAboutDlg();
  20. // Dialog Data
  21. //{{AFX_DATA(CAboutDlg)
  22. enum { IDD = IDD_ABOUTBOX };
  23. //}}AFX_DATA
  24. // ClassWizard generated virtual function overrides
  25. //{{AFX_VIRTUAL(CAboutDlg)
  26. protected:
  27. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  28. //}}AFX_VIRTUAL
  29. // Implementation
  30. protected:
  31. //{{AFX_MSG(CAboutDlg)
  32. //}}AFX_MSG
  33. DECLARE_MESSAGE_MAP()
  34. };
  35. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  36. {
  37. //{{AFX_DATA_INIT(CAboutDlg)
  38. //}}AFX_DATA_INIT
  39. }
  40. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  41. {
  42. CDialog::DoDataExchange(pDX);
  43. //{{AFX_DATA_MAP(CAboutDlg)
  44. //}}AFX_DATA_MAP
  45. }
  46. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  47. //{{AFX_MSG_MAP(CAboutDlg)
  48. // No message handlers
  49. //}}AFX_MSG_MAP
  50. END_MESSAGE_MAP();
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CMakeSetupDialog dialog
  53. CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/)
  54. : CDialog(CMakeSetupDialog::IDD, pParent)
  55. {
  56. m_RegistryKey = "Software\\Kitware\\CMakeSetup\\Settings\\StartPath";
  57. //{{AFX_DATA_INIT(CMakeSetupDialog)
  58. m_WhereBuild = _T("");
  59. m_WhereSource = _T("");
  60. //}}AFX_DATA_INIT
  61. // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  62. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  63. m_BuildPathChanged = false;
  64. // Find the path to the cmake.exe executable
  65. char fname[1024];
  66. ::GetModuleFileName(NULL,fname,1023);
  67. // extract just the path part
  68. m_PathToExecutable = cmSystemTools::GetProgramPath(fname).c_str();
  69. // add the cmake.exe to the path
  70. m_PathToExecutable += "/cmake.exe";
  71. m_oldCX = -1;
  72. m_deltaXRemainder = 0;
  73. }
  74. void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
  75. {
  76. CDialog::DoDataExchange(pDX);
  77. //{{AFX_DATA_MAP(CMakeSetupDialog)
  78. DDX_Control(pDX, IDOK, m_CancelButton);
  79. DDX_Control(pDX, IDC_MouseHelpCaption, m_MouseHelp);
  80. DDX_Control(pDX, IDC_CMAKE_VERSION, m_VersionDisplay);
  81. DDX_Control(pDX, IDC_BuildProjects, m_BuildProjects);
  82. DDX_Control(pDX, IDC_FRAME, m_ListFrame);
  83. DDX_Control(pDX, IDC_WhereSource, m_WhereSourceControl);
  84. DDX_Control(pDX, IDC_WhereBuild, m_WhereBuildControl);
  85. DDX_Control(pDX, IDC_LIST2, m_CacheEntriesList);
  86. DDX_CBStringExact(pDX, IDC_WhereBuild, m_WhereBuild);
  87. DDX_CBStringExact(pDX, IDC_WhereSource, m_WhereSource);
  88. //}}AFX_DATA_MAP
  89. }
  90. BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
  91. //{{AFX_MSG_MAP(CMakeSetupDialog)
  92. ON_WM_SYSCOMMAND()
  93. ON_WM_PAINT()
  94. ON_WM_QUERYDRAGICON()
  95. ON_BN_CLICKED(IDC_BuildProjects, OnBuildProjects)
  96. ON_CBN_EDITCHANGE(IDC_WhereBuild, OnChangeWhereBuild)
  97. ON_CBN_EDITCHANGE(IDC_WhereSource, OnChangeWhereSource)
  98. ON_CBN_SELCHANGE(IDC_WhereBuild, OnSelendokWhereBuild)
  99. ON_BN_CLICKED(IDC_BUTTON2, OnBrowseWhereSource)
  100. ON_BN_CLICKED(IDC_BUTTON3, OnBrowseWhereBuild)
  101. ON_CBN_SELENDOK(IDC_WhereSource, OnSelendokWhereSource)
  102. ON_WM_SIZE()
  103. ON_WM_GETMINMAXINFO()
  104. //}}AFX_MSG_MAP
  105. END_MESSAGE_MAP()
  106. /////////////////////////////////////////////////////////////////////////////
  107. // CMakeSetupDialog message handlers
  108. BOOL CMakeSetupDialog::OnInitDialog()
  109. {
  110. CDialog::OnInitDialog();
  111. // Add "About..." menu item to system menu.
  112. // IDM_ABOUTBOX must be in the system command range.
  113. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  114. ASSERT(IDM_ABOUTBOX < 0xF000);
  115. CMenu* pSysMenu = GetSystemMenu(FALSE);
  116. if (pSysMenu != NULL)
  117. {
  118. CString strAboutMenu;
  119. strAboutMenu.LoadString(IDS_ABOUTBOX);
  120. if (!strAboutMenu.IsEmpty())
  121. {
  122. pSysMenu->AppendMenu(MF_SEPARATOR);
  123. pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
  124. }
  125. }
  126. // Set the icon for this dialog. The framework does this automatically
  127. // when the application's main window is not a dialog
  128. SetIcon(m_hIcon, TRUE); // Set big icon
  129. SetIcon(m_hIcon, FALSE); // Set small icon
  130. // Load source and build dirs from registry
  131. this->LoadFromRegistry();
  132. // try to load the cmake cache from disk
  133. this->LoadCacheFromDiskToGUI();
  134. m_WhereBuildControl.LimitText(2048);
  135. m_WhereSourceControl.LimitText(2048);
  136. // Set the version number
  137. char tmp[1024];
  138. sprintf(tmp,"Version %d.%d", cmMakefile::GetMajorVersion(),
  139. cmMakefile::GetMinorVersion());
  140. SetDlgItemText(IDC_CMAKE_VERSION, tmp);
  141. this->UpdateData(FALSE);
  142. return TRUE; // return TRUE unless you set the focus to a control
  143. }
  144. // About dialog invoke
  145. void CMakeSetupDialog::OnSysCommand(UINT nID, LPARAM lParam)
  146. {
  147. if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  148. {
  149. CAboutDlg dlgAbout;
  150. dlgAbout.DoModal();
  151. }
  152. else
  153. {
  154. CDialog::OnSysCommand(nID, lParam);
  155. }
  156. }
  157. // If you add a minimize button to your dialog, you will need the code below
  158. // to draw the icon. For MFC applications using the document/view model,
  159. // this is automatically done for you by the framework.
  160. void CMakeSetupDialog::OnPaint()
  161. {
  162. if (IsIconic())
  163. {
  164. CPaintDC dc(this); // device context for painting
  165. SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  166. // Center icon in client rectangle
  167. int cxIcon = GetSystemMetrics(SM_CXICON);
  168. int cyIcon = GetSystemMetrics(SM_CYICON);
  169. CRect rect;
  170. GetClientRect(&rect);
  171. int x = (rect.Width() - cxIcon + 1) / 2;
  172. int y = (rect.Height() - cyIcon + 1) / 2;
  173. // Draw the icon
  174. dc.DrawIcon(x, y, m_hIcon);
  175. }
  176. else
  177. {
  178. CDialog::OnPaint();
  179. }
  180. }
  181. // The system calls this to obtain the cursor to display while the user drags
  182. // the minimized window.
  183. HCURSOR CMakeSetupDialog::OnQueryDragIcon()
  184. {
  185. return (HCURSOR) m_hIcon;
  186. }
  187. // Browse button
  188. bool CMakeSetupDialog::Browse(CString &result, const char *title)
  189. {
  190. CPathDialog dlg("Select Path", title, result);
  191. if(dlg.DoModal()==IDOK)
  192. {
  193. result = dlg.GetPathName();
  194. return true;
  195. }
  196. else
  197. {
  198. return false;
  199. }
  200. }
  201. void CMakeSetupDialog::SaveToRegistry()
  202. {
  203. HKEY hKey;
  204. DWORD dwDummy;
  205. if(RegCreateKeyEx(HKEY_CURRENT_USER,
  206. m_RegistryKey,
  207. 0, "", REG_OPTION_NON_VOLATILE, KEY_READ|KEY_WRITE,
  208. NULL, &hKey, &dwDummy) != ERROR_SUCCESS)
  209. {
  210. return;
  211. }
  212. else
  213. {
  214. // load some values
  215. CString regvalue;
  216. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource","C:\\");
  217. if(m_WhereSource != regvalue)
  218. {
  219. regvalue = "";
  220. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource3","");
  221. RegSetValueEx(hKey, _T("WhereSource4"), 0, REG_SZ,
  222. (CONST BYTE *)(const char *)regvalue,
  223. regvalue.GetLength());
  224. regvalue = "";
  225. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource2","");
  226. RegSetValueEx(hKey, _T("WhereSource3"), 0, REG_SZ,
  227. (CONST BYTE *)(const char *)regvalue,
  228. regvalue.GetLength());
  229. regvalue = "";
  230. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource","");
  231. RegSetValueEx(hKey, _T("WhereSource2"), 0, REG_SZ,
  232. (CONST BYTE *)(const char *)regvalue,
  233. regvalue.GetLength());
  234. RegSetValueEx(hKey, _T("WhereSource"), 0, REG_SZ,
  235. (CONST BYTE *)(const char *)m_WhereSource,
  236. m_WhereSource.GetLength());
  237. }
  238. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild","C:\\");
  239. if(m_WhereBuild != regvalue)
  240. {
  241. regvalue = "";
  242. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild3","");
  243. RegSetValueEx(hKey, _T("WhereBuild4"), 0, REG_SZ,
  244. (CONST BYTE *)(const char *)regvalue,
  245. regvalue.GetLength());
  246. regvalue = "";
  247. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild2","");
  248. RegSetValueEx(hKey, _T("WhereBuild3"), 0, REG_SZ,
  249. (CONST BYTE *)(const char *)regvalue,
  250. regvalue.GetLength());
  251. regvalue = "";
  252. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild","");
  253. RegSetValueEx(hKey, _T("WhereBuild2"), 0, REG_SZ,
  254. (CONST BYTE *)(const char *)regvalue,
  255. regvalue.GetLength());
  256. RegSetValueEx(hKey, _T("WhereBuild"), 0, REG_SZ,
  257. (CONST BYTE *)(const char *)m_WhereBuild,
  258. m_WhereBuild.GetLength());
  259. }
  260. }
  261. RegCloseKey(hKey);
  262. }
  263. void CMakeSetupDialog::ReadRegistryValue(HKEY hKey,
  264. CString *val,
  265. const char *key,
  266. const char *adefault)
  267. {
  268. DWORD dwType, dwSize;
  269. char *pb;
  270. dwType = REG_SZ;
  271. pb = val->GetBuffer(MAX_PATH);
  272. dwSize = MAX_PATH;
  273. if(RegQueryValueEx(hKey,_T(key), NULL, &dwType,
  274. (BYTE *)pb, &dwSize) != ERROR_SUCCESS)
  275. {
  276. val->ReleaseBuffer();
  277. *val = _T(adefault);
  278. }
  279. else
  280. {
  281. val->ReleaseBuffer();
  282. }
  283. }
  284. void CMakeSetupDialog::LoadFromRegistry()
  285. {
  286. HKEY hKey;
  287. if(RegOpenKeyEx(HKEY_CURRENT_USER,
  288. m_RegistryKey,
  289. 0, KEY_READ, &hKey) != ERROR_SUCCESS)
  290. {
  291. return;
  292. }
  293. else
  294. {
  295. // load some values
  296. this->ReadRegistryValue(hKey, &(m_WhereSource),"WhereSource","C:\\");
  297. this->ReadRegistryValue(hKey, &(m_WhereBuild),"WhereBuild","C:\\");
  298. m_WhereSourceControl.AddString(m_WhereSource);
  299. m_WhereBuildControl.AddString(m_WhereBuild);
  300. CString regvalue;
  301. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource2","C:\\");
  302. m_WhereSourceControl.AddString(regvalue);
  303. regvalue = "";
  304. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild2","C:\\");
  305. m_WhereBuildControl.AddString(regvalue);
  306. regvalue = "";
  307. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource3","C:\\");
  308. m_WhereSourceControl.AddString(regvalue);
  309. regvalue = "";
  310. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild3","C:\\");
  311. m_WhereBuildControl.AddString(regvalue);
  312. regvalue = "";
  313. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource4","C:\\");
  314. m_WhereSourceControl.AddString(regvalue);
  315. regvalue = "";
  316. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild4","C:\\");
  317. m_WhereBuildControl.AddString(regvalue);
  318. }
  319. RegCloseKey(hKey);
  320. }
  321. // Callback for browse source button
  322. void CMakeSetupDialog::OnBrowseWhereSource()
  323. {
  324. this->UpdateData();
  325. Browse(m_WhereSource, "Enter Path to Source");
  326. this->UpdateData(false);
  327. this->OnChangeWhereSource();
  328. }
  329. // Callback for browser build button
  330. void CMakeSetupDialog::OnBrowseWhereBuild()
  331. {
  332. this->UpdateData();
  333. Browse(m_WhereBuild, "Enter Path to Build");
  334. this->UpdateData(false);
  335. this->OnChangeWhereBuild();
  336. }
  337. // Callback for build projects button
  338. void CMakeSetupDialog::OnBuildProjects()
  339. {
  340. if(!cmSystemTools::FileExists(m_WhereBuild))
  341. {
  342. std::string message =
  343. "Build directory does not exist, should I create it?\n\n"
  344. "Directory: ";
  345. message += (const char*)m_WhereBuild;
  346. if(MessageBox(message.c_str(), "Create Directory", MB_OKCANCEL) == IDOK)
  347. {
  348. cmSystemTools::MakeDirectory(m_WhereBuild);
  349. }
  350. else
  351. {
  352. MessageBox("Build Project aborted, nothing done.");
  353. return;
  354. }
  355. }
  356. // set the wait cursor
  357. ::SetCursor(LoadCursor(NULL, IDC_WAIT));
  358. // get all the info from the dialog
  359. this->UpdateData();
  360. if(!m_BuildPathChanged)
  361. {
  362. // if the build path has not changed save the
  363. // current GUI values to the cache
  364. this->SaveCacheFromGUI();
  365. }
  366. // Make sure we are working from the cache on disk
  367. this->LoadCacheFromDiskToGUI();
  368. // create a cmake object
  369. cmake make;
  370. // create the arguments for the cmake object
  371. std::vector<std::string> args;
  372. args.push_back((const char*)m_PathToExecutable);
  373. std::string arg;
  374. arg = "-H";
  375. arg += m_WhereSource;
  376. args.push_back(arg);
  377. arg = "-B";
  378. arg += m_WhereBuild;
  379. args.push_back(arg);
  380. // run the generate process
  381. if(make.Generate(args) != 0)
  382. {
  383. cmSystemTools::Error(
  384. "Error in generation process, project files may be invalid");
  385. cmSystemTools::ResetErrorOccuredFlag();
  386. }
  387. // update the GUI with any new values in the caused by the
  388. // generation process
  389. this->LoadCacheFromDiskToGUI();
  390. // save source and build paths to registry
  391. this->SaveToRegistry();
  392. // path is up-to-date now
  393. m_BuildPathChanged = false;
  394. // put the cursor back
  395. ::SetCursor(LoadCursor(NULL, IDC_ARROW));
  396. }
  397. // callback for combo box menu where build selection
  398. void CMakeSetupDialog::OnSelendokWhereBuild()
  399. {
  400. m_WhereBuildControl.GetLBText(m_WhereBuildControl.GetCurSel(),
  401. m_WhereBuild);
  402. m_WhereBuildControl.SetWindowText( m_WhereBuild);
  403. this->UpdateData(FALSE);
  404. this->OnChangeWhereBuild();
  405. }
  406. // callback for combo box menu where source selection
  407. void CMakeSetupDialog::OnSelendokWhereSource()
  408. {
  409. m_WhereSourceControl.GetLBText(m_WhereSourceControl.GetCurSel(),
  410. m_WhereSource);
  411. this->UpdateData(FALSE);
  412. this->OnChangeWhereSource();
  413. }
  414. // callback for chaing source directory
  415. void CMakeSetupDialog::OnChangeWhereSource()
  416. {
  417. }
  418. // callback for changing the build directory
  419. void CMakeSetupDialog::OnChangeWhereBuild()
  420. {
  421. this->UpdateData();
  422. std::string cachefile = m_WhereBuild;
  423. cachefile += "/CMakeCache.txt";
  424. m_CacheEntriesList.RemoveAll();
  425. if(cmSystemTools::FileExists(cachefile.c_str()))
  426. {
  427. m_CacheEntriesList.ShowWindow(SW_SHOW);
  428. this->LoadCacheFromDiskToGUI();
  429. m_BuildPathChanged = true;
  430. }
  431. }
  432. // copy from the cache manager to the cache edit list box
  433. void CMakeSetupDialog::FillCacheGUIFromCacheManager()
  434. {
  435. const cmCacheManager::CacheEntryMap &cache =
  436. cmCacheManager::GetInstance()->GetCacheMap();
  437. for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
  438. i != cache.end(); ++i)
  439. {
  440. const char* key = i->first.c_str();
  441. const cmCacheManager::CacheEntry& value = i->second;
  442. switch(value.m_Type )
  443. {
  444. case cmCacheManager::BOOL:
  445. if(cmCacheManager::GetInstance()->IsOn(key))
  446. {
  447. m_CacheEntriesList.AddProperty(key,
  448. "ON",
  449. value.m_HelpString.c_str(),
  450. CPropertyList::CHECKBOX,"");
  451. }
  452. else
  453. {
  454. m_CacheEntriesList.AddProperty(key,
  455. "OFF",
  456. value.m_HelpString.c_str(),
  457. CPropertyList::CHECKBOX,"");
  458. }
  459. break;
  460. case cmCacheManager::PATH:
  461. m_CacheEntriesList.AddProperty(key,
  462. value.m_Value.c_str(),
  463. value.m_HelpString.c_str(),
  464. CPropertyList::PATH,"");
  465. break;
  466. case cmCacheManager::FILEPATH:
  467. m_CacheEntriesList.AddProperty(key,
  468. value.m_Value.c_str(),
  469. value.m_HelpString.c_str(),
  470. CPropertyList::FILE,"");
  471. break;
  472. case cmCacheManager::STRING:
  473. m_CacheEntriesList.AddProperty(key,
  474. value.m_Value.c_str(),
  475. value.m_HelpString.c_str(),
  476. CPropertyList::EDIT,"");
  477. break;
  478. case cmCacheManager::INTERNAL:
  479. break;
  480. }
  481. }
  482. }
  483. // copy from the list box to the cache manager
  484. void CMakeSetupDialog::FillCacheManagerFromCacheGUI()
  485. {
  486. cmCacheManager::GetInstance()->GetCacheMap();
  487. std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems();
  488. for(std::set<CPropertyItem*>::iterator i = items.begin();
  489. i != items.end(); ++i)
  490. {
  491. CPropertyItem* item = *i;
  492. cmCacheManager::CacheEntry *entry =
  493. cmCacheManager::GetInstance()->GetCacheEntry(
  494. (const char*)item->m_propName);
  495. if (entry)
  496. {
  497. entry->m_Value = item->m_curValue;
  498. }
  499. }
  500. }
  501. //! Load cache file from m_WhereBuild and display in GUI editor
  502. void CMakeSetupDialog::LoadCacheFromDiskToGUI()
  503. {
  504. if(m_WhereBuild != "")
  505. {
  506. cmCacheManager::GetInstance()->LoadCache(m_WhereBuild);
  507. this->FillCacheGUIFromCacheManager();
  508. }
  509. }
  510. //! Save GUI values to cmCacheManager and then save to disk.
  511. void CMakeSetupDialog::SaveCacheFromGUI()
  512. {
  513. this->FillCacheManagerFromCacheGUI();
  514. if(m_WhereBuild != "")
  515. {
  516. cmCacheManager::GetInstance()->SaveCache(m_WhereBuild);
  517. }
  518. }
  519. void CMakeSetupDialog::OnSize(UINT nType, int cx, int cy)
  520. {
  521. if (nType == SIZE_MINIMIZED)
  522. {
  523. CDialog::OnSize(nType, cx, cy);
  524. return;
  525. }
  526. if (m_oldCX == -1)
  527. {
  528. m_oldCX = cx;
  529. m_oldCY = cy;
  530. }
  531. int deltax = cx - m_oldCX;
  532. int deltay = cy - m_oldCY;
  533. m_oldCX = cx;
  534. m_oldCY = cy;
  535. CDialog::OnSize(nType, cx, cy);
  536. if (deltax == 0 && deltay == 0)
  537. {
  538. return;
  539. }
  540. if(m_CacheEntriesList.m_hWnd)
  541. {
  542. // get the original sizes/positions
  543. CRect cRect;
  544. m_ListFrame.GetWindowRect(&cRect);
  545. m_ListFrame.SetWindowPos(&wndTop, cRect.left, cRect.top,
  546. cRect.Width() + deltax,
  547. cRect.Height() + deltay,
  548. SWP_NOMOVE | SWP_NOZORDER);
  549. m_CacheEntriesList.GetWindowRect(&cRect);
  550. m_CacheEntriesList.SetWindowPos(&wndTop, cRect.left, cRect.top,
  551. cRect.Width() + deltax,
  552. cRect.Height() + deltay,
  553. SWP_NOMOVE | SWP_NOZORDER);
  554. m_VersionDisplay.SetWindowPos(&wndTop, 5, cy-23, 0, 0,
  555. SWP_NOSIZE | SWP_NOZORDER);
  556. deltax = deltax + m_deltaXRemainder;
  557. m_deltaXRemainder = deltax%2;
  558. m_MouseHelp.GetWindowRect(&cRect);
  559. this->ScreenToClient(&cRect);
  560. m_MouseHelp.SetWindowPos(&wndTop, cRect.left + deltax/2,
  561. cRect.top + deltay,
  562. 0, 0,
  563. SWP_NOSIZE | SWP_NOZORDER);
  564. m_BuildProjects.GetWindowRect(&cRect);
  565. this->ScreenToClient(&cRect);
  566. m_BuildProjects.SetWindowPos(&wndTop, cRect.left + deltax/2,
  567. cRect.top + deltay,
  568. 0, 0,
  569. SWP_NOSIZE | SWP_NOZORDER);
  570. m_CancelButton.GetWindowRect(&cRect);
  571. this->ScreenToClient(&cRect);
  572. m_CancelButton.SetWindowPos(&wndTop, cRect.left + deltax/2,
  573. cRect.top + deltay,
  574. 0, 0,
  575. SWP_NOSIZE | SWP_NOZORDER);
  576. }
  577. }
  578. void CMakeSetupDialog::OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI )
  579. {
  580. lpMMI->ptMinTrackSize.x = 550;
  581. lpMMI->ptMinTrackSize.y = 272;
  582. }