summaryrefslogtreecommitdiffstats
path: root/Source/MFCDialog
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-05-21 14:47:00 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-05-21 14:47:00 (GMT)
commit650691850bd4c507296a8abd7cde10c3ac2d8fb7 (patch)
tree78093f3b1ce6b81a984ad0b1c4f9cef1f6091e1a /Source/MFCDialog
parent06f403b274cb80b024f0c8adbe7137d9ac99f344 (diff)
downloadCMake-650691850bd4c507296a8abd7cde10c3ac2d8fb7.zip
CMake-650691850bd4c507296a8abd7cde10c3ac2d8fb7.tar.gz
CMake-650691850bd4c507296a8abd7cde10c3ac2d8fb7.tar.bz2
BUG: fix compiler name
Diffstat (limited to 'Source/MFCDialog')
-rw-r--r--Source/MFCDialog/CMakeDialog.h11
-rw-r--r--Source/MFCDialog/CMakeSetup.rc6
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.cpp234
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.h4
-rw-r--r--Source/MFCDialog/resource.h2
5 files changed, 195 insertions, 62 deletions
diff --git a/Source/MFCDialog/CMakeDialog.h b/Source/MFCDialog/CMakeDialog.h
index 7c0463d..85d3cfd 100644
--- a/Source/MFCDialog/CMakeDialog.h
+++ b/Source/MFCDialog/CMakeDialog.h
@@ -27,9 +27,13 @@ protected:
// Dialog Data
//{{AFX_DATA(CMakeSetupDialog)
enum { IDD = IDD_CMakeSetupDialog_DIALOG };
+ CComboBox m_WhereSourceControl;
+ CComboBox m_WhereBuildControl;
CListBox m_CacheEntriesList;
CString m_WhereITK;
CString m_WhereBuildITK;
+ CString m_WhereBuild;
+ CString m_WhereSource;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
@@ -54,6 +58,13 @@ protected:
afx_msg void OnBuildProjects();
afx_msg void OnChangeWhereBuild();
afx_msg void OnChangeWhereSource();
+ afx_msg void OnEditchangeWhereBuild();
+ afx_msg void OnEditchangeWhereSource();
+ afx_msg void OnSelchangeWhereSource();
+ afx_msg void OnSelchangeWhereBuild();
+ afx_msg void OnEditupdateWhereBuild();
+ afx_msg void OnCloseupWhereBuild();
+ afx_msg void OnSelendokWhereBuild();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
diff --git a/Source/MFCDialog/CMakeSetup.rc b/Source/MFCDialog/CMakeSetup.rc
index 4f8e45c..41bf038 100644
--- a/Source/MFCDialog/CMakeSetup.rc
+++ b/Source/MFCDialog/CMakeSetup.rc
@@ -92,10 +92,8 @@ CAPTION "CMakeSetupDialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Close",IDOK,231,206,50,14
- EDITTEXT IDC_WhereSource,129,4,135,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUTTON2,269,5,43,13
LTEXT "Where is the source code:",IDC_STATIC,39,6,86,9
- EDITTEXT IDC_WhereBuild,129,25,133,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUTTON3,268,25,43,13
LTEXT "Where do you want to build the binaries:",IDC_STATIC,1,
27,128,9
@@ -106,6 +104,10 @@ BEGIN
WS_HSCROLL | WS_TABSTOP
CTEXT "Right click on cache entries for additional options",
IDC_STATIC,19,190,333,11
+ COMBOBOX IDC_WhereBuild,129,26,133,68,CBS_DROPDOWN | WS_VSCROLL |
+ WS_TABSTOP
+ COMBOBOX IDC_WhereSource,127,6,135,66,CBS_DROPDOWN | WS_VSCROLL |
+ WS_TABSTOP
END
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp
index 9c5a0f1..3f2693f 100644
--- a/Source/MFCDialog/CMakeSetupDialog.cpp
+++ b/Source/MFCDialog/CMakeSetupDialog.cpp
@@ -69,12 +69,11 @@ CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/)
m_RegistryKey = "Software\\Kitware\\CMakeSetup\\Settings\\StartPath";
//{{AFX_DATA_INIT(CMakeSetupDialog)
- m_WhereSource = _T("");
- m_WhereBuild = _T("");
- //}}AFX_DATA_INIT
+ m_WhereBuild = _T("");
+ m_WhereSource = _T("");
+ //}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- this->LoadFromRegistry();
m_BuildPathChanged = false;
}
@@ -82,9 +81,11 @@ void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMakeSetupDialog)
+ DDX_Control(pDX, IDC_WhereSource, m_WhereSourceControl);
+ DDX_Control(pDX, IDC_WhereBuild, m_WhereBuildControl);
DDX_Control(pDX, IDC_LIST2, m_CacheEntriesList);
- DDX_Text(pDX, IDC_WhereSource, m_WhereSource);
- DDX_Text(pDX, IDC_WhereBuild, m_WhereBuild);
+ DDX_CBString(pDX, IDC_WhereBuild, m_WhereBuild);
+ DDX_CBString(pDX, IDC_WhereSource, m_WhereSource);
//}}AFX_DATA_MAP
}
@@ -93,18 +94,20 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
+ ON_BN_CLICKED(IDC_BuildProjects, OnBuildProjects)
+ ON_CBN_EDITCHANGE(IDC_WhereBuild, OnChangeWhereBuild)
ON_BN_CLICKED(IDC_BUTTON2, OnBrowseWhereSource)
ON_BN_CLICKED(IDC_BUTTON3, OnBrowseWhereBuild)
- ON_BN_CLICKED(IDC_BuildProjects, OnBuildProjects)
- ON_EN_CHANGE(IDC_WhereBuild, OnChangeWhereBuild)
- ON_EN_CHANGE(IDC_WhereSource, OnChangeWhereSource)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
+ ON_CBN_SELENDOK(IDC_WhereBuild, OnSelendokWhereBuild)
+ ON_CBN_SELENDOK(IDC_WhereSource, OnSelendokWhereSource)
+ ON_CBN_EDITCHANGE(IDC_WhereSource, OnChangeWhereSource)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMakeSetupDialog message handlers
- BOOL CMakeSetupDialog::OnInitDialog()
+BOOL CMakeSetupDialog::OnInitDialog()
{
CDialog::OnInitDialog();
@@ -130,10 +133,15 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
+ // Load source and build dirs from registry
+ this->LoadFromRegistry();
+ // try to load the cmake cache from disk
this->LoadCacheFromDiskToGUI();
return TRUE; // return TRUE unless you set the focus to a control
}
+
+// About dialog invoke
void CMakeSetupDialog::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
@@ -184,13 +192,23 @@ HCURSOR CMakeSetupDialog::OnQueryDragIcon()
}
-void CMakeSetupDialog::OnBrowseWhereSource()
+
+// Insane Microsoft way of setting the initial directory
+// for the Shbrowseforfolder function...
+// SetSelProc
+// Callback procedure to set the initial selection of the browser.
+int CALLBACK CMakeSetupDialog_SetSelProc( HWND hWnd, UINT uMsg,
+ LPARAM lParam, LPARAM lpData )
{
- this->UpdateData();
- Browse(m_WhereSource, "Enter Path to Source");
- this->UpdateData(false);
+ if (uMsg==BFFM_INITIALIZED)
+ {
+ ::SendMessage(hWnd, BFFM_SETSELECTION, TRUE, lpData );
+ }
+ return 0;
}
+
+// Browse button
bool CMakeSetupDialog::Browse(CString &result, const char *title)
{
// don't know what to do with initial right now...
@@ -201,27 +219,23 @@ bool CMakeSetupDialog::Browse(CString &result, const char *title)
bi.pidlRoot = NULL;
bi.pszDisplayName = (LPTSTR)szPathName;
bi.lpszTitle = title;
- bi.ulFlags = BIF_BROWSEINCLUDEFILES ;
- bi.lpfn = NULL;
-
+ bi.ulFlags = BIF_BROWSEINCLUDEFILES;
+ // set up initial directory code
+ bi.lpfn = CMakeSetupDialog_SetSelProc;
+ bi.lParam = (LPARAM)(LPCSTR) result;
+ // open the directory chooser
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
-
+ // get the result
bool bSuccess = (SHGetPathFromIDList(pidl, szPathName) ? true : false);
if(bSuccess)
{
result = szPathName;
}
-
return bSuccess;
}
-void CMakeSetupDialog::OnBrowseWhereBuild()
-{
- this->UpdateData();
- Browse(m_WhereBuild, "Enter Path to Build");
- this->UpdateData(false);
-}
+
void CMakeSetupDialog::SaveToRegistry()
{
@@ -237,12 +251,52 @@ void CMakeSetupDialog::SaveToRegistry()
}
else
{
- RegSetValueEx(hKey, _T("WhereSource"), 0, REG_SZ,
- (CONST BYTE *)(const char *)m_WhereSource,
- m_WhereSource.GetLength());
- RegSetValueEx(hKey, _T("WhereBuild"), 0, REG_SZ,
- (CONST BYTE *)(const char *)m_WhereBuild,
- m_WhereBuild.GetLength());
+ // load some values
+ CString regvalue;
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereSource","C:\\");
+ if(m_WhereSource != regvalue)
+ {
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereSource3","");
+ RegSetValueEx(hKey, _T("WhereSource4"), 0, REG_SZ,
+ (CONST BYTE *)(const char *)regvalue,
+ regvalue.GetLength());
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereSource2","");
+ RegSetValueEx(hKey, _T("WhereSource3"), 0, REG_SZ,
+ (CONST BYTE *)(const char *)regvalue,
+ regvalue.GetLength());
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereSource","");
+ RegSetValueEx(hKey, _T("WhereSource2"), 0, REG_SZ,
+ (CONST BYTE *)(const char *)regvalue,
+ regvalue.GetLength());
+ RegSetValueEx(hKey, _T("WhereSource"), 0, REG_SZ,
+ (CONST BYTE *)(const char *)m_WhereSource,
+ m_WhereSource.GetLength());
+ }
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild","C:\\");
+ if(m_WhereBuild != regvalue)
+ {
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild3","");
+ RegSetValueEx(hKey, _T("WhereBuild4"), 0, REG_SZ,
+ (CONST BYTE *)(const char *)regvalue,
+ regvalue.GetLength());
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild2","");
+ RegSetValueEx(hKey, _T("WhereBuild3"), 0, REG_SZ,
+ (CONST BYTE *)(const char *)regvalue,
+ regvalue.GetLength());
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild","");
+ RegSetValueEx(hKey, _T("WhereBuild2"), 0, REG_SZ,
+ (CONST BYTE *)(const char *)regvalue,
+ regvalue.GetLength());
+ RegSetValueEx(hKey, _T("WhereBuild"), 0, REG_SZ,
+ (CONST BYTE *)(const char *)m_WhereBuild,
+ m_WhereBuild.GetLength());
+ }
}
RegCloseKey(hKey);
}
@@ -283,13 +337,57 @@ void CMakeSetupDialog::LoadFromRegistry()
}
else
{
- // save some values
+ // load some values
this->ReadRegistryValue(hKey, &(m_WhereSource),"WhereSource","C:\\");
this->ReadRegistryValue(hKey, &(m_WhereBuild),"WhereBuild","C:\\");
+ m_WhereSourceControl.AddString(m_WhereSource);
+ m_WhereBuildControl.AddString(m_WhereBuild);
+
+ CString regvalue;
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereSource2","C:\\");
+ m_WhereSourceControl.AddString(regvalue);
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild2","C:\\");
+ m_WhereBuildControl.AddString(regvalue);
+
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereSource3","C:\\");
+ m_WhereSourceControl.AddString(regvalue);
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild3","C:\\");
+ m_WhereBuildControl.AddString(regvalue);
+
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereSource4","C:\\");
+ m_WhereSourceControl.AddString(regvalue);
+ regvalue = "";
+ this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild4","C:\\");
+ m_WhereBuildControl.AddString(regvalue);
}
RegCloseKey(hKey);
}
+
+
+// Callback for browse source button
+void CMakeSetupDialog::OnBrowseWhereSource()
+{
+ this->UpdateData();
+ Browse(m_WhereSource, "Enter Path to Source");
+ this->UpdateData(false);
+ this->OnChangeWhereSource();
+}
+
+// Callback for browser build button
+void CMakeSetupDialog::OnBrowseWhereBuild()
+{
+ this->UpdateData();
+ Browse(m_WhereBuild, "Enter Path to Build");
+ this->UpdateData(false);
+ this->OnChangeWhereBuild();
+}
+
+// Callback for build projects button
void CMakeSetupDialog::OnBuildProjects()
{
if(!cmSystemTools::FileExists(m_WhereBuild))
@@ -359,7 +457,46 @@ void CMakeSetupDialog::OnBuildProjects()
}
- // copy from the cache manager to the cache edit list box
+
+
+// callback for combo box menu where build selection
+void CMakeSetupDialog::OnSelendokWhereBuild()
+{
+ m_WhereBuildControl.GetLBText(m_WhereBuildControl.GetCurSel(), m_WhereBuild);
+ this->UpdateData(FALSE);
+ this->OnChangeWhereBuild();
+}
+
+// callback for combo box menu where source selection
+void CMakeSetupDialog::OnSelendokWhereSource()
+{
+ m_WhereSourceControl.GetLBText(m_WhereSourceControl.GetCurSel(), m_WhereSource);
+ this->UpdateData(FALSE);
+ this->OnChangeWhereSource();
+}
+
+// callback for chaing source directory
+void CMakeSetupDialog::OnChangeWhereSource()
+{
+}
+
+// callback for changing the build directory
+void CMakeSetupDialog::OnChangeWhereBuild()
+{
+ this->UpdateData();
+ std::string cachefile = m_WhereBuild;
+ cachefile += "/CMakeCache.txt";
+ m_CacheEntriesList.RemoveAll();
+ if(cmSystemTools::FileExists(cachefile.c_str()))
+ {
+ m_CacheEntriesList.ShowWindow(SW_SHOW);
+ this->LoadCacheFromDiskToGUI();
+ m_BuildPathChanged = true;
+ }
+}
+
+
+// copy from the cache manager to the cache edit list box
void CMakeSetupDialog::FillCacheGUIFromCacheManager()
{
const cmCacheManager::CacheEntryMap &cache =
@@ -412,7 +549,7 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager()
this->UpdateData(FALSE);
}
- // copy from the list box to the cache manager
+// copy from the list box to the cache manager
void CMakeSetupDialog::FillCacheManagerFromCacheGUI()
{
cmCacheManager::GetInstance()->GetCacheMap();
@@ -431,29 +568,6 @@ void CMakeSetupDialog::FillCacheManagerFromCacheGUI()
}
-
-
-void CMakeSetupDialog::OnChangeWhereBuild()
-{
- this->UpdateData();
- std::string cachefile = m_WhereBuild;
- cachefile += "/CMakeCache.txt";
- if(cmSystemTools::FileExists(cachefile.c_str()))
- {
- m_CacheEntriesList.ShowWindow(SW_SHOW);
- this->LoadCacheFromDiskToGUI();
- m_BuildPathChanged = true;
- }
- else
- {
- m_CacheEntriesList.RemoveAll();
- }
-}
-
-void CMakeSetupDialog::OnChangeWhereSource()
-{
- this->UpdateData();
-}
//! Load cache file from m_WhereBuild and display in GUI editor
void CMakeSetupDialog::LoadCacheFromDiskToGUI()
@@ -495,3 +609,5 @@ void CMakeSetupDialog::SaveCacheFromGUI()
cmCacheManager::GetInstance()->SaveCache(m_WhereBuild);
}
}
+
+
diff --git a/Source/MFCDialog/CMakeSetupDialog.h b/Source/MFCDialog/CMakeSetupDialog.h
index d04c1c3..b1140a6 100644
--- a/Source/MFCDialog/CMakeSetupDialog.h
+++ b/Source/MFCDialog/CMakeSetupDialog.h
@@ -36,6 +36,8 @@ protected:
CString m_WhereSource;
CString m_WhereBuild;
bool m_BuildPathChanged;
+ CComboBox m_WhereSourceControl;
+ CComboBox m_WhereBuildControl;
CPropertyList m_CacheEntriesList;
//}}AFX_DATA
@@ -66,7 +68,9 @@ protected:
virtual void OnBuildProjects();
afx_msg void OnBrowseWhereBuild();
afx_msg void OnChangeWhereBuild();
+ afx_msg void OnSelendokWhereBuild();
afx_msg void OnChangeWhereSource();
+ afx_msg void OnSelendokWhereSource();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
diff --git a/Source/MFCDialog/resource.h b/Source/MFCDialog/resource.h
index 3e1aa31..cfe7d98 100644
--- a/Source/MFCDialog/resource.h
+++ b/Source/MFCDialog/resource.h
@@ -21,7 +21,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1011
+#define _APS_NEXT_CONTROL_VALUE 1014
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif