ENH: rework GUI with configure/OK/Cancel

This commit is contained in:
Bill Hoffman 2001-07-25 18:30:27 -04:00
parent 4ab2650802
commit a5eac44d18
11 changed files with 174 additions and 130 deletions

View File

@ -1,73 +0,0 @@
// CMakeSetupDialogDlg.h : header file
//
#if !defined(AFX_CMakeSetupDialogDLG_H__AC17A6F6_4634_11D4_8F21_00A0CC33FCD3__INCLUDED_)
#define AFX_CMakeSetupDialogDLG_H__AC17A6F6_4634_11D4_8F21_00A0CC33FCD3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CMakeSetupDialog dialog
class CMakeSetupDialog : public CDialog
{
// Construction
public:
CMakeSetupDialog(CWnd* pParent = NULL); // standard constructor
protected:
bool Browse(CString&, const char* title);
void SaveToRegistry();
void LoadFromRegistry();
void ReadRegistryValue(HKEY hKey,
CString *val,
char *key,
char *adefault);
// Dialog Data
//{{AFX_DATA(CMakeSetupDialog)
enum { IDD = IDD_CMakeSetupDialog_DIALOG };
CButton m_CancelButton;
CStatic m_MouseHelp;
CStatic m_VersionDisplay;
CButton m_BuildProjects;
CButton m_ListFrame;
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
//{{AFX_VIRTUAL(CMakeSetupDialog)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CMakeSetupDialog)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
virtual void OnOK();
afx_msg void OnBuildProjects();
afx_msg void OnChangeWhereBuild();
afx_msg void OnChangeWhereSource();
afx_msg void OnSelendokWhereBuild();
afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CMakeSetupDialogDLG_H__AC17A6F6_4634_11D4_8F21_00A0CC33FCD3__INCLUDED_)

View File

@ -98,8 +98,8 @@ BEGIN
COMBOBOX IDC_WhereBuild,148,26,133,68,CBS_DROPDOWN | COMBOBOX IDC_WhereBuild,148,26,133,68,CBS_DROPDOWN |
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Browse...",IDC_BUTTON3,286,25,43,13 PUSHBUTTON "Browse...",IDC_BUTTON3,286,25,43,13
DEFPUSHBUTTON "Build Project Files",IDC_BuildProjects,112,206,67,15 DEFPUSHBUTTON "Configure",IDC_BuildProjects,88,202,67,15
PUSHBUTTON "Close",IDOK,190,206,67,15 PUSHBUTTON "Cancel",IDCANCEL,220,201,67,15
LISTBOX IDC_LIST2,15,55,344,122,LBS_OWNERDRAWVARIABLE | LISTBOX IDC_LIST2,15,55,344,122,LBS_OWNERDRAWVARIABLE |
LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_HSCROLL WS_HSCROLL
@ -110,6 +110,7 @@ BEGIN
CTEXT "Right click on cache entries for additional options", CTEXT "Right click on cache entries for additional options",
IDC_MouseHelpCaption,106,189,156,8 IDC_MouseHelpCaption,106,189,156,8
LTEXT "Static",IDC_CMAKE_VERSION,3,211,58,13,SS_CENTERIMAGE LTEXT "Static",IDC_CMAKE_VERSION,3,211,58,13,SS_CENTERIMAGE
PUSHBUTTON "OK",IDC_OK,160,202,56,14
END END

View File

@ -68,8 +68,8 @@ CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/)
m_RegistryKey = "Software\\Kitware\\CMakeSetup\\Settings\\StartPath"; m_RegistryKey = "Software\\Kitware\\CMakeSetup\\Settings\\StartPath";
//{{AFX_DATA_INIT(CMakeSetupDialog) //{{AFX_DATA_INIT(CMakeSetupDialog)
m_WhereBuild = _T("");
m_WhereSource = _T(""); m_WhereSource = _T("");
m_WhereBuild = _T("");
//}}AFX_DATA_INIT //}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32 // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
@ -90,16 +90,17 @@ void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMakeSetupDialog) //{{AFX_DATA_MAP(CMakeSetupDialog)
DDX_Control(pDX, IDOK, m_CancelButton); DDX_Control(pDX, IDC_OK, m_OKButton);
DDX_Control(pDX, IDC_MouseHelpCaption, m_MouseHelp); DDX_Control(pDX, IDCANCEL, m_CancelButton);
DDX_Control(pDX, IDC_CMAKE_VERSION, m_VersionDisplay); DDX_CBStringExact(pDX, IDC_WhereSource, m_WhereSource);
DDX_Control(pDX, IDC_BuildProjects, m_BuildProjects); DDX_CBStringExact(pDX, IDC_WhereBuild, m_WhereBuild);
DDX_Control(pDX, IDC_FRAME, m_ListFrame); DDX_Control(pDX, IDC_FRAME, m_ListFrame);
DDX_Control(pDX, IDC_WhereSource, m_WhereSourceControl); DDX_Control(pDX, IDC_WhereSource, m_WhereSourceControl);
DDX_Control(pDX, IDC_WhereBuild, m_WhereBuildControl); DDX_Control(pDX, IDC_WhereBuild, m_WhereBuildControl);
DDX_Control(pDX, IDC_LIST2, m_CacheEntriesList); DDX_Control(pDX, IDC_LIST2, m_CacheEntriesList);
DDX_CBStringExact(pDX, IDC_WhereBuild, m_WhereBuild); DDX_Control(pDX, IDC_MouseHelpCaption, m_MouseHelp);
DDX_CBStringExact(pDX, IDC_WhereSource, m_WhereSource); DDX_Control(pDX, IDC_CMAKE_VERSION, m_VersionDisplay);
DDX_Control(pDX, IDC_BuildProjects, m_Configure);
//}}AFX_DATA_MAP //}}AFX_DATA_MAP
} }
@ -108,16 +109,17 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
ON_WM_SYSCOMMAND() ON_WM_SYSCOMMAND()
ON_WM_PAINT() ON_WM_PAINT()
ON_WM_QUERYDRAGICON() ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDOK, OnOK)
ON_BN_CLICKED(IDC_BuildProjects, OnBuildProjects)
ON_CBN_EDITCHANGE(IDC_WhereBuild, OnChangeWhereBuild)
ON_CBN_EDITCHANGE(IDC_WhereSource, OnChangeWhereSource)
ON_CBN_SELCHANGE(IDC_WhereBuild, OnSelendokWhereBuild)
ON_BN_CLICKED(IDC_BUTTON2, OnBrowseWhereSource) ON_BN_CLICKED(IDC_BUTTON2, OnBrowseWhereSource)
ON_BN_CLICKED(IDC_BuildProjects, OnConfigure)
ON_BN_CLICKED(IDC_BUTTON3, OnBrowseWhereBuild) ON_BN_CLICKED(IDC_BUTTON3, OnBrowseWhereBuild)
ON_CBN_EDITCHANGE(IDC_WhereBuild, OnChangeWhereBuild)
ON_CBN_SELCHANGE(IDC_WhereBuild, OnSelendokWhereBuild)
ON_CBN_EDITCHANGE(IDC_WhereSource, OnChangeWhereSource)
ON_CBN_SELENDOK(IDC_WhereSource, OnSelendokWhereSource) ON_CBN_SELENDOK(IDC_WhereSource, OnSelendokWhereSource)
ON_WM_SIZE() ON_WM_SIZE()
ON_WM_GETMINMAXINFO() ON_WM_GETMINMAXINFO()
ON_BN_CLICKED(IDCANCEL, OnCancel)
ON_BN_CLICKED(IDC_OK, OnOk)
//}}AFX_MSG_MAP //}}AFX_MSG_MAP
END_MESSAGE_MAP() END_MESSAGE_MAP()
@ -162,6 +164,7 @@ BOOL CMakeSetupDialog::OnInitDialog()
cmMakefile::GetMinorVersion()); cmMakefile::GetMinorVersion());
SetDlgItemText(IDC_CMAKE_VERSION, tmp); SetDlgItemText(IDC_CMAKE_VERSION, tmp);
this->UpdateData(FALSE); this->UpdateData(FALSE);
m_OKButton.EnableWindow(false);
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
} }
@ -386,10 +389,9 @@ void CMakeSetupDialog::OnBrowseWhereBuild()
this->OnChangeWhereBuild(); this->OnChangeWhereBuild();
} }
// Callback for build projects button void CMakeSetupDialog::RunCMake(bool generateProjectFiles)
void CMakeSetupDialog::OnBuildProjects()
{ {
if(!cmSystemTools::FileExists(m_WhereBuild)) if(!cmSystemTools::FileExists(m_WhereBuild))
{ {
std::string message = std::string message =
"Build directory does not exist, should I create it?\n\n" "Build directory does not exist, should I create it?\n\n"
@ -431,7 +433,7 @@ void CMakeSetupDialog::OnBuildProjects()
arg += m_WhereBuild; arg += m_WhereBuild;
args.push_back(arg); args.push_back(arg);
// run the generate process // run the generate process
if(make.Generate(args) != 0) if(make.Generate(args, generateProjectFiles) != 0)
{ {
cmSystemTools::Error( cmSystemTools::Error(
"Error in generation process, project files may be invalid"); "Error in generation process, project files may be invalid");
@ -446,7 +448,15 @@ void CMakeSetupDialog::OnBuildProjects()
m_BuildPathChanged = false; m_BuildPathChanged = false;
// put the cursor back // put the cursor back
::SetCursor(LoadCursor(NULL, IDC_ARROW)); ::SetCursor(LoadCursor(NULL, IDC_ARROW));
m_CacheEntriesList.ClearDirty(); }
// Callback for build projects button
void CMakeSetupDialog::OnConfigure()
{
this->RunCMake(false);
// if cache has values then enb
m_OKButton.EnableWindow(true);
} }
@ -490,6 +500,23 @@ void CMakeSetupDialog::OnChangeWhereBuild()
// copy from the cache manager to the cache edit list box // copy from the cache manager to the cache edit list box
void CMakeSetupDialog::FillCacheGUIFromCacheManager() void CMakeSetupDialog::FillCacheGUIFromCacheManager()
{ {
int size = m_CacheEntriesList.GetItems().size();
bool reverseOrder = false;
// if there are already entries in the cache, then
// put the new ones in the top, so they show up first
if(size)
{
reverseOrder = true;
}
// all the current values are not new any more
std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems();
for(std::set<CPropertyItem*>::iterator i = items.begin();
i != items.end(); ++i)
{
CPropertyItem* item = *i;
item->m_NewValue = false;
}
const cmCacheManager::CacheEntryMap &cache = const cmCacheManager::CacheEntryMap &cache =
cmCacheManager::GetInstance()->GetCacheMap(); cmCacheManager::GetInstance()->GetCacheMap();
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
@ -505,38 +532,51 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager()
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
"ON", "ON",
value.m_HelpString.c_str(), value.m_HelpString.c_str(),
CPropertyList::CHECKBOX,""); CPropertyList::CHECKBOX,"",
reverseOrder
);
} }
else else
{ {
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
"OFF", "OFF",
value.m_HelpString.c_str(), value.m_HelpString.c_str(),
CPropertyList::CHECKBOX,""); CPropertyList::CHECKBOX,"",
reverseOrder
);
} }
break; break;
case cmCacheManager::PATH: case cmCacheManager::PATH:
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
value.m_Value.c_str(), value.m_Value.c_str(),
value.m_HelpString.c_str(), value.m_HelpString.c_str(),
CPropertyList::PATH,""); CPropertyList::PATH,"",
reverseOrder
);
break; break;
case cmCacheManager::FILEPATH: case cmCacheManager::FILEPATH:
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
value.m_Value.c_str(), value.m_Value.c_str(),
value.m_HelpString.c_str(), value.m_HelpString.c_str(),
CPropertyList::FILE,""); CPropertyList::FILE,"",
reverseOrder
);
break; break;
case cmCacheManager::STRING: case cmCacheManager::STRING:
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
value.m_Value.c_str(), value.m_Value.c_str(),
value.m_HelpString.c_str(), value.m_HelpString.c_str(),
CPropertyList::EDIT,""); CPropertyList::EDIT,"",
reverseOrder
);
break; break;
case cmCacheManager::INTERNAL: case cmCacheManager::INTERNAL:
break; break;
} }
} }
// redraw the list
m_CacheEntriesList.SetTopIndex(0);
m_CacheEntriesList.Invalidate();
} }
// copy from the list box to the cache manager // copy from the list box to the cache manager
@ -633,9 +673,9 @@ void CMakeSetupDialog::OnSize(UINT nType, int cx, int cy)
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOZORDER); SWP_NOSIZE | SWP_NOZORDER);
m_BuildProjects.GetWindowRect(&cRect); m_Configure.GetWindowRect(&cRect);
this->ScreenToClient(&cRect); this->ScreenToClient(&cRect);
m_BuildProjects.SetWindowPos(&wndTop, cRect.left + deltax/2, m_Configure.SetWindowPos(&wndTop, cRect.left + deltax/2,
cRect.top + deltay, cRect.top + deltay,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOZORDER); SWP_NOSIZE | SWP_NOZORDER);
@ -645,6 +685,12 @@ void CMakeSetupDialog::OnSize(UINT nType, int cx, int cy)
cRect.top + deltay, cRect.top + deltay,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOZORDER); SWP_NOSIZE | SWP_NOZORDER);
m_OKButton.GetWindowRect(&cRect);
this->ScreenToClient(&cRect);
m_OKButton.SetWindowPos(&wndTop, cRect.left + deltax/2,
cRect.top + deltay,
0, 0,
SWP_NOSIZE | SWP_NOZORDER);
} }
} }
@ -656,9 +702,9 @@ void CMakeSetupDialog::OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI )
lpMMI->ptMinTrackSize.y = 272; lpMMI->ptMinTrackSize.y = 272;
} }
void CMakeSetupDialog::OnOK() void CMakeSetupDialog::OnCancel()
{ {
if(m_CacheEntriesList.IsDirty()) if(m_OKButton.IsWindowEnabled())
{ {
if(MessageBox("You have changed options but not rebuilt, " if(MessageBox("You have changed options but not rebuilt, "
"are you sure you want to exit?", "Confirm Exit", "are you sure you want to exit?", "Confirm Exit",
@ -672,3 +718,10 @@ void CMakeSetupDialog::OnOK()
CDialog::OnOK(); CDialog::OnOK();
} }
} }
void CMakeSetupDialog::OnOk()
{
m_CacheEntriesList.ClearDirty();
this->RunCMake(true);
CDialog::OnOK();
}

View File

@ -32,7 +32,9 @@ protected:
const char *aadefault); const char *aadefault);
// Dialog Data // Dialog Data
//{{AFX_DATA(CMakeSetupDialog) //{{AFX_DATA(CMakeSetupDialog)
enum { IDD = IDD_CMakeSetupDialog_DIALOG }; enum { IDD = IDD_CMakeSetupDialog_DIALOG };
CButton m_OKButton;
CButton m_CancelButton;
CString m_WhereSource; CString m_WhereSource;
CString m_WhereBuild; CString m_WhereBuild;
CButton m_ListFrame; CButton m_ListFrame;
@ -42,9 +44,8 @@ protected:
CPropertyList m_CacheEntriesList; CPropertyList m_CacheEntriesList;
CStatic m_MouseHelp; CStatic m_MouseHelp;
CStatic m_VersionDisplay; CStatic m_VersionDisplay;
CButton m_BuildProjects; CButton m_Configure;
CButton m_CancelButton; //}}AFX_DATA
//}}AFX_DATA
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMakeSetupDialog) //{{AFX_VIRTUAL(CMakeSetupDialog)
@ -54,7 +55,7 @@ protected:
// Implementation // Implementation
protected: protected:
void RunCMake(bool generateProjectFiles);
// copy from the cache manager to the cache edit list box // copy from the cache manager to the cache edit list box
void FillCacheGUIFromCacheManager(); void FillCacheGUIFromCacheManager();
// copy from the list box to the cache manager // copy from the list box to the cache manager
@ -68,11 +69,11 @@ protected:
//{{AFX_MSG(CMakeSetupDialog) //{{AFX_MSG(CMakeSetupDialog)
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnOK(); afx_msg void OnCancel();
afx_msg void OnPaint(); afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon(); afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnBrowseWhereSource(); afx_msg void OnBrowseWhereSource();
virtual void OnBuildProjects(); virtual void OnConfigure();
afx_msg void OnBrowseWhereBuild(); afx_msg void OnBrowseWhereBuild();
afx_msg void OnChangeWhereBuild(); afx_msg void OnChangeWhereBuild();
afx_msg void OnSelendokWhereBuild(); afx_msg void OnSelendokWhereBuild();
@ -80,7 +81,8 @@ protected:
afx_msg void OnSelendokWhereSource(); afx_msg void OnSelendokWhereSource();
afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI ); afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI );
//}}AFX_MSG afx_msg void OnOk();
//}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
int m_oldCX; int m_oldCX;

View File

@ -91,13 +91,21 @@ void CPropertyList::DrawItem(LPDRAWITEMSTRUCT lpDIS)
if (nIndex != (UINT) -1) if (nIndex != (UINT) -1)
{ {
//get the CPropertyItem for the current row
CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(nIndex);
//draw two rectangles, one for each row column //draw two rectangles, one for each row column
dc.FillSolidRect(rect2,RGB(192,192,192)); if(pItem->m_NewValue)
{
dc.FillSolidRect(rect2,RGB(255,100, 100));
}
else
{
dc.FillSolidRect(rect2,RGB(192,192,192));
}
dc.DrawEdge(rect2,EDGE_SUNKEN,BF_BOTTOMRIGHT); dc.DrawEdge(rect2,EDGE_SUNKEN,BF_BOTTOMRIGHT);
dc.DrawEdge(rect,EDGE_SUNKEN,BF_BOTTOM); dc.DrawEdge(rect,EDGE_SUNKEN,BF_BOTTOM);
//get the CPropertyItem for the current row
CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(nIndex);
//write the property name in the first rectangle //write the property name in the first rectangle
dc.SetBkMode(TRANSPARENT); dc.SetBkMode(TRANSPARENT);
@ -119,9 +127,18 @@ int CPropertyList::AddItem(CString txt)
return nIndex; return nIndex;
} }
int CPropertyList::AddPropItem(CPropertyItem* pItem) int CPropertyList::AddPropItem(CPropertyItem* pItem, bool reverseOrder)
{ {
int nIndex = AddString(_T("")); this->HideControls();
int nIndex;
if(reverseOrder)
{
nIndex = InsertString(0, _T(""));
}
else
{
nIndex = AddString(_T(""));
}
SetItemDataPtr(nIndex,pItem); SetItemDataPtr(nIndex,pItem);
m_PropertyItems.insert(pItem); m_PropertyItems.insert(pItem);
return nIndex; return nIndex;
@ -131,7 +148,7 @@ int CPropertyList::AddProperty(const char* name,
const char* value, const char* value,
const char* helpString, const char* helpString,
int type, int type,
const char* comboItems) const char* comboItems, bool reverseOrder)
{ {
CPropertyItem* pItem = 0; CPropertyItem* pItem = 0;
for(int i =0; i < this->GetCount(); ++i) for(int i =0; i < this->GetCount(); ++i)
@ -153,8 +170,9 @@ int CPropertyList::AddProperty(const char* name,
if(!pItem) if(!pItem)
{ {
pItem = new CPropertyItem(name, value, helpString, type, comboItems); pItem = new CPropertyItem(name, value, helpString, type, comboItems);
pItem->m_NewValue = true;
} }
return this->AddPropItem(pItem); return this->AddPropItem(pItem, reverseOrder);
} }
int CPropertyList::OnCreate(LPCREATESTRUCT lpCreateStruct) int CPropertyList::OnCreate(LPCREATESTRUCT lpCreateStruct)
@ -357,7 +375,7 @@ void CPropertyList::OnChangeEditBox()
} }
} }
void CPropertyList::OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar ) void CPropertyList::HideControls()
{ {
if(m_editBox) if(m_editBox)
{ {
@ -375,6 +393,11 @@ void CPropertyList::OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar )
{ {
m_btnCtrl.ShowWindow(SW_HIDE); m_btnCtrl.ShowWindow(SW_HIDE);
} }
}
void CPropertyList::OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar )
{
this->HideControls();
CListBox::OnVScroll(nSBCode, nPos, pScrollBar); CListBox::OnVScroll(nSBCode, nPos, pScrollBar);
} }
@ -603,6 +626,8 @@ void CPropertyList::OnDelete()
m_PropertyItems.erase(pItem); m_PropertyItems.erase(pItem);
delete pItem; delete pItem;
this->DeleteString(m_curSel); this->DeleteString(m_curSel);
this->HideControls();
this->SetTopIndex(0);
InvalidateList(); InvalidateList();
} }
@ -627,6 +652,7 @@ void CPropertyList::RemoveAll()
delete pItem; delete pItem;
this->DeleteString(0); this->DeleteString(0);
} }
this->HideControls();
InvalidateList(); InvalidateList();
} }

View File

@ -16,12 +16,14 @@ public:
CString m_curValue; CString m_curValue;
int m_nItemType; int m_nItemType;
CString m_cmbItems; CString m_cmbItems;
bool m_NewValue;
bool m_Removed; bool m_Removed;
public: public:
CPropertyItem(CString propName, CString curValue, CPropertyItem(CString propName, CString curValue,
CString helpString, CString helpString,
int nItemType, CString cmbItems) int nItemType, CString cmbItems)
{ {
m_NewValue = true;
m_HelpString = helpString; m_HelpString = helpString;
m_Removed = false; m_Removed = false;
m_propName = propName; m_propName = propName;
@ -63,7 +65,9 @@ public:
const char* value, const char* value,
const char* helpString, const char* helpString,
int type, int type,
const char* comboItems); const char* comboItems,
bool reverseOrder);
void HideControls();
std::set<CPropertyItem*> GetItems() std::set<CPropertyItem*> GetItems()
{ {
return m_PropertyItems; return m_PropertyItems;
@ -111,7 +115,7 @@ protected:
void InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo); void InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo);
void DisplayButton(CRect region); void DisplayButton(CRect region);
int AddPropItem(CPropertyItem* pItem); int AddPropItem(CPropertyItem* pItem, bool top);
void InvalidateList(); void InvalidateList();
CComboBox m_cmbBox; CComboBox m_cmbBox;

View File

@ -17,7 +17,7 @@
#define IDC_CMAKE_VERSION 1014 #define IDC_CMAKE_VERSION 1014
#define IDC_FRAME 1015 #define IDC_FRAME 1015
#define IDC_MouseHelpCaption 1016 #define IDC_MouseHelpCaption 1016
#define IDC_CompilingText 1017 #define IDC_OK 1018
// Next default values for new objects // Next default values for new objects
// //
@ -25,7 +25,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 133 #define _APS_NEXT_RESOURCE_VALUE 133
#define _APS_NEXT_COMMAND_VALUE 32771 #define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1018 #define _APS_NEXT_CONTROL_VALUE 1019
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -404,8 +404,7 @@ void cmMakefile::SetMakefileGenerator(cmMakefileGenerator* mf)
mf->SetMakefile(this); mf->SetMakefile(this);
} }
// Generate the output file void cmMakefile::FinalPass()
void cmMakefile::GenerateMakefile()
{ {
// do all the variable expansions here // do all the variable expansions here
this->ExpandVariables(); this->ExpandVariables();
@ -416,6 +415,13 @@ void cmMakefile::GenerateMakefile()
{ {
(*i)->FinalPass(); (*i)->FinalPass();
} }
}
// Generate the output file
void cmMakefile::GenerateMakefile()
{
this->FinalPass();
// merge libraries // merge libraries
for (cmTargets::iterator l = m_Targets.begin(); for (cmTargets::iterator l = m_Targets.begin();
l != m_Targets.end(); l++) l != m_Targets.end(); l++)

View File

@ -119,6 +119,11 @@ public:
*/ */
void GenerateMakefile(); void GenerateMakefile();
/**
* run the final pass on all commands.
*/
void FinalPass();
/** /**
* Print the object state to std::cout. * Print the object state to std::cout.
*/ */

View File

@ -222,7 +222,7 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args)
"Path to CMake installation.", cmCacheManager::INTERNAL); "Path to CMake installation.", cmCacheManager::INTERNAL);
} }
int cmake::Generate(const std::vector<std::string>& args) int cmake::Generate(const std::vector<std::string>& args, bool buildMakefiles)
{ {
if(args.size() == 1 && !cmSystemTools::FileExists("CMakeLists.txt")) if(args.size() == 1 && !cmSystemTools::FileExists("CMakeLists.txt"))
{ {
@ -279,7 +279,25 @@ int cmake::Generate(const std::vector<std::string>& args)
this->Usage(args[0].c_str()); this->Usage(args[0].c_str());
return -1; return -1;
} }
mf.GenerateMakefile(); // if buildMakefiles, then call GenerateMakefile
if(buildMakefiles)
{
mf.GenerateMakefile();
}
else // do not build, but let the commands finalize
{
std::vector<cmMakefile*> makefiles;
mf.FindSubDirectoryCMakeListsFiles(makefiles);
for(std::vector<cmMakefile*>::iterator i = makefiles.begin();
i != makefiles.end(); ++i)
{
cmMakefile* mf = *i;
mf->FinalPass();
delete mf;
}
mf.FinalPass();
}
// Before saving the cache // Before saving the cache
// if the project did not define one of the entries below, add them now // if the project did not define one of the entries below, add them now

View File

@ -60,8 +60,10 @@ class cmake
* to the command line version of cmake. For building a GUI, * to the command line version of cmake. For building a GUI,
* you would pass in the following arguments: * you would pass in the following arguments:
* /path/to/cmake -H/path/to/source -B/path/to/build * /path/to/cmake -H/path/to/source -B/path/to/build
* If you only want to parse the CMakeLists.txt files,
* but not actually generate the makefiles, use buildMakefiles = false.
*/ */
int Generate(const std::vector<std::string>&); int Generate(const std::vector<std::string>&, bool buildMakefiles = true);
/** /**
* Generate the SourceFilesList from the SourceLists. This should only be * Generate the SourceFilesList from the SourceLists. This should only be