summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-04-23 20:40:29 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-04-23 20:40:29 (GMT)
commit90e56122989f4021e9fbabd3299ea783b80a2c61 (patch)
tree4180b9c4c858bee3bdea327b301cea187adbf38c
parent619dd8c4791850f3fe4d564d32f8285cb027b4fc (diff)
downloadCMake-90e56122989f4021e9fbabd3299ea783b80a2c61.zip
CMake-90e56122989f4021e9fbabd3299ea783b80a2c61.tar.gz
CMake-90e56122989f4021e9fbabd3299ea783b80a2c61.tar.bz2
ENH: new GUI editor for cmake cache file
-rw-r--r--Source/CMakeLib.dsp12
-rw-r--r--Source/MFCDialog/CMakeDialog.h9
-rw-r--r--Source/MFCDialog/CMakeSetup.dsp4
-rw-r--r--Source/MFCDialog/CMakeSetup.rc417
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.cpp176
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.h14
-rw-r--r--Source/MFCDialog/PropertyList.cpp585
-rw-r--r--Source/MFCDialog/PropertyList.h141
-rw-r--r--Source/MFCDialog/resource.h50
-rw-r--r--Source/cmCacheManager.cxx5
-rw-r--r--Source/cmCacheManager.h25
-rw-r--r--Source/cmDSWMakefile.cxx1
-rw-r--r--Source/cmDSWWriter.cxx1
-rw-r--r--Source/cmSourceGroup.h2
-rw-r--r--Source/cmStandardIncludes.h1
-rw-r--r--Source/cmWindowsConfigure.cxx95
-rw-r--r--Source/cmWindowsConfigure.h58
17 files changed, 1137 insertions, 459 deletions
diff --git a/Source/CMakeLib.dsp b/Source/CMakeLib.dsp
index f8d69df..c7168db 100644
--- a/Source/CMakeLib.dsp
+++ b/Source/CMakeLib.dsp
@@ -135,10 +135,6 @@ SOURCE=.\cmSourceGroup.cxx
SOURCE=.\cmSystemTools.cxx
# End Source File
-# Begin Source File
-
-SOURCE=.\cmWindowsConfigure.cxx
-# End Source File
# End Group
# Begin Group "Header Files"
@@ -415,14 +411,6 @@ SOURCE=..\cmWin32LibrariesCommand.h
SOURCE=.\cmWin32LibrariesCommand.h
# End Source File
-# Begin Source File
-
-SOURCE=..\cmWindowsConfigure.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\cmWindowsConfigure.h
-# End Source File
# End Group
# End Target
# End Project
diff --git a/Source/MFCDialog/CMakeDialog.h b/Source/MFCDialog/CMakeDialog.h
index 9e491bd..8ad95ca 100644
--- a/Source/MFCDialog/CMakeDialog.h
+++ b/Source/MFCDialog/CMakeDialog.h
@@ -26,10 +26,11 @@ protected:
char *adefault);
// Dialog Data
//{{AFX_DATA(CMakeSetupDialog)
- enum { IDD = IDD_CMakeSetupDialog_DIALOG };
+ enum { IDD = IDD_CMakeSetupDialog_DIALOG };
+ CListBox m_CacheEntriesList;
CString m_WhereITK;
CString m_WhereBuildITK;
- //}}AFX_DATA
+ //}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMakeSetupDialog)
@@ -51,8 +52,8 @@ protected:
afx_msg void OnBrowse();
virtual void OnOK();
afx_msg void OnButton3();
-
- //}}AFX_MSG
+ afx_msg void OnBuildProjects();
+ //}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
diff --git a/Source/MFCDialog/CMakeSetup.dsp b/Source/MFCDialog/CMakeSetup.dsp
index 2b0d9e4..13bb7ba 100644
--- a/Source/MFCDialog/CMakeSetup.dsp
+++ b/Source/MFCDialog/CMakeSetup.dsp
@@ -107,6 +107,10 @@ SOURCE=.\CMakeSetupDialog.cpp
# End Source File
# Begin Source File
+SOURCE=.\PropertyList.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
diff --git a/Source/MFCDialog/CMakeSetup.rc b/Source/MFCDialog/CMakeSetup.rc
index 0cd8f78..d44844b 100644
--- a/Source/MFCDialog/CMakeSetup.rc
+++ b/Source/MFCDialog/CMakeSetup.rc
@@ -1,204 +1,213 @@
-//Microsoft Developer Studio generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE DISCARDABLE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
- "#define _AFX_NO_OLE_RESOURCES\r\n"
- "#define _AFX_NO_TRACKER_RESOURCES\r\n"
- "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
- "\r\n"
- "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
- "#ifdef _WIN32\r\n"
- "LANGUAGE 9, 1\r\n"
- "#pragma code_page(1252)\r\n"
- "#endif //_WIN32\r\n"
- "#include ""res\\CMakeSetupDialog.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
- "#include ""afxres.rc"" // Standard components\r\n"
- "#endif\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDR_MAINFRAME ICON DISCARDABLE "res\\CMakeSetupDialog.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "About CMakeSetup"
-FONT 8, "MS Sans Serif"
-BEGIN
- ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
- LTEXT "CMakeSetup Version 1.0",IDC_STATIC,40,10,119,8,
- SS_NOPREFIX
- LTEXT "Copyright (C) 2000",IDC_STATIC,40,25,119,8
- DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
-END
-
-IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 320, 200
-STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-EXSTYLE WS_EX_APPWINDOW
-CAPTION "CMakeSetupDialog"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,260,7,50,14
- PUSHBUTTON "Cancel",IDCANCEL,260,23,50,14
- EDITTEXT IDC_WhereSource,13,27,135,13,ES_AUTOHSCROLL
- PUSHBUTTON "Browse...",IDC_BUTTON2,150,28,43,13
- LTEXT "Where is the source code:",IDC_STATIC,15,15,104,9
- EDITTEXT IDC_WhereBuild,14,67,133,13,ES_AUTOHSCROLL
- PUSHBUTTON "Browse...",IDC_BUTTON3,151,66,43,13
- LTEXT "Where do you want to build the binaries:",IDC_STATIC,16,
- 56,128,9
-END
-
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904B0"
- BEGIN
- VALUE "CompanyName", "\0"
- VALUE "FileDescription", "CMakeSetup MFC Application\0"
- VALUE "FileVersion", "1, 0, 0, 1\0"
- VALUE "InternalName", "CMakeSetup\0"
- VALUE "LegalCopyright", "Copyright (C) 2000\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "CMakeSetup.EXE\0"
- VALUE "ProductName", "CMakeSetup Application\0"
- VALUE "ProductVersion", "1, 0, 0, 1\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // !_MAC
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE
-BEGIN
- IDD_ABOUTBOX, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 228
- TOPMARGIN, 7
- BOTTOMMARGIN, 48
- END
-END
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// String Table
-//
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_ABOUTBOX "&About CMakeSetup..."
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-#define _AFX_NO_SPLITTER_RESOURCES
-#define _AFX_NO_OLE_RESOURCES
-#define _AFX_NO_TRACKER_RESOURCES
-#define _AFX_NO_PROPERTY_RESOURCES
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE 9, 1
-#pragma code_page(1252)
-#endif //_WIN32
-#include "res\CMakeSetupDialog.rc2" // non-Microsoft Visual C++ edited resources
-#include "afxres.rc" // Standard components
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "#ifdef _WIN32\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#endif //_WIN32\r\n"
+ "#include ""res\\CMakeSetupDialog.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON DISCARDABLE "res\\CMakeSetupDialog.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "About CMakeSetup"
+FONT 8, "MS Sans Serif"
+BEGIN
+ ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
+ LTEXT "CMakeSetup Version 1.0",IDC_STATIC,40,10,119,8,
+ SS_NOPREFIX
+ LTEXT "Copyright (C) 2000",IDC_STATIC,40,25,119,8
+ DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
+END
+
+IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 375, 226
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_APPWINDOW
+CAPTION "CMakeSetupDialog"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "Close",IDOK,319,39,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
+ PUSHBUTTON "Build Project Files",IDC_BuildProjects,6,39,67,15
+ GROUPBOX "Cache Values",IDC_STATIC,2,67,370,156
+ LISTBOX IDC_LIST2,13,84,344,122,LBS_OWNERDRAWVARIABLE |
+ LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
+ WS_TABSTOP
+END
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "\0"
+ VALUE "FileDescription", "CMakeSetup MFC Application\0"
+ VALUE "FileVersion", "1, 0, 0, 1\0"
+ VALUE "InternalName", "CMakeSetup\0"
+ VALUE "LegalCopyright", "Copyright (C) 2000\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "CMakeSetup.EXE\0"
+ VALUE "ProductName", "CMakeSetup Application\0"
+ VALUE "ProductVersion", "1, 0, 0, 1\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_ABOUTBOX, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 228
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 48
+ END
+
+ IDD_CMakeSetupDialog_DIALOG, DIALOG
+ BEGIN
+ BOTTOMMARGIN, 215
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_ABOUTBOX "&About CMakeSetup..."
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#endif //_WIN32
+#include "res\CMakeSetupDialog.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp
index 97b80ee..64bbde9 100644
--- a/Source/MFCDialog/CMakeSetupDialog.cpp
+++ b/Source/MFCDialog/CMakeSetupDialog.cpp
@@ -5,7 +5,6 @@
#include "CMakeSetup.h"
#include "CMakeSetupDialog.h"
#include "../cmDSWMakefile.h"
-#include "../cmWindowsConfigure.h"
#include "../cmMSProjectGenerator.h"
#include "../cmCacheManager.h"
#ifdef _DEBUG
@@ -79,7 +78,7 @@ CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/)
//{{AFX_DATA_INIT(CMakeSetupDialog)
m_WhereSource = _T("");
m_WhereBuild = _T("");
- //}}AFX_DATA_INIT
+ //}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
// Guess the initial source directory based on the location
@@ -96,15 +95,49 @@ CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/)
}
m_WhereSource = startPath;
this->LoadFromRegistry();
+ m_InitMakefile = false;
+ this->InitMakefile();
+
+}
+
+void CMakeSetupDialog::InitMakefile()
+{
+ if(m_InitMakefile)
+ {
+ return;
+ }
+ if(m_WhereBuild == "")
+ {
+ m_WhereBuild = m_WhereSource;
+ }
+ if(m_WhereSource == "")
+ {
+ return;
+ }
+ m_InitMakefile = true;
+ // set up the cmMakefile member
+ m_Makefile.SetMakefileGenerator(new cmMSProjectGenerator);
+ m_Makefile.SetHomeDirectory(m_WhereSource);
+ // Set the output directory
+ m_Makefile.SetStartOutputDirectory(m_WhereBuild);
+ m_Makefile.SetHomeOutputDirectory(m_WhereBuild);
+ // set the directory which contains the CMakeLists.txt
+ m_Makefile.SetStartDirectory(m_WhereSource);
+ // Create the master DSW file and all children dsp files for ITK
+ // Set the CMakeLists.txt file
+ m_Makefile.MakeStartDirectoriesCurrent();
+ // Create a string for the cache file
+ cmCacheManager::GetInstance()->LoadCache(&m_Makefile);
}
void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMakeSetupDialog)
+ DDX_Control(pDX, IDC_LIST2, m_CacheEntriesList);
DDX_Text(pDX, IDC_WhereSource, m_WhereSource);
DDX_Text(pDX, IDC_WhereBuild, m_WhereBuild);
- //}}AFX_DATA_MAP
+ //}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
@@ -115,7 +148,8 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
ON_EN_CHANGE(IDC_WhereSource, OnChangeEdit1)
ON_BN_CLICKED(IDC_BUTTON2, OnBrowse)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
- //}}AFX_MSG_MAP
+ ON_BN_CLICKED(IDC_BuildProjects, OnBuildProjects)
+ //}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
@@ -149,7 +183,10 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
-
+ if(m_InitMakefile)
+ {
+ this->FillCacheEditorFromCacheManager();
+ }
return TRUE; // return TRUE unless you set the focus to a control
}
@@ -246,51 +283,7 @@ bool CMakeSetupDialog::Browse(CString &result, const char *title)
void CMakeSetupDialog::OnOK()
{
- // get all the info from the screen
- this->UpdateData();
- if(m_WhereBuild == "")
- {
- m_WhereBuild = m_WhereSource;
- }
-
- cmMakefile mf;
- mf.SetMakefileGenerator(new cmMSProjectGenerator);
- mf.SetHomeDirectory(m_WhereSource);
-
- // Set the output directory
- mf.SetStartOutputDirectory(m_WhereBuild);
- mf.SetHomeOutputDirectory(m_WhereBuild);
- // set the directory which contains the CMakeLists.txt
- mf.SetStartDirectory(m_WhereSource);
- // Create the master DSW file and all children dsp files for ITK
- // Set the CMakeLists.txt file
- CString makefileIn = m_WhereSource;
- makefileIn += "/CMakeLists.txt";
- mf.MakeStartDirectoriesCurrent();
- // Create a string for the cache file
- cmCacheManager::GetInstance()->LoadCache(&mf);
- mf.ReadListFile(makefileIn);
- // Move this to the cache editor
- mf.GenerateMakefile();
- cmCacheManager::GetInstance()->SaveCache(&mf);
- std::string command;
- command = "notepad ";
- std::string cachefile = m_WhereBuild;
- cachefile += "/CMakeCache.txt";
- command += cachefile.c_str();
- long int originalMT = cmSystemTools::ModifiedTime(cachefile.c_str());
- system(command.c_str());
- long int afterEditMT = cmSystemTools::ModifiedTime(cachefile.c_str());
- // if the cache was changed, re-generate the project
- if(originalMT != afterEditMT)
- {
- cmCacheManager::GetInstance()->LoadCache(&mf);
- mf.GenerateMakefile();
- cmCacheManager::GetInstance()->SaveCache(&mf);
- }
-
- // parent class
- this->SaveToRegistry();
+
CDialog::OnOK();
}
@@ -369,3 +362,86 @@ void CMakeSetupDialog::LoadFromRegistry()
}
RegCloseKey(hKey);
}
+
+void CMakeSetupDialog::OnBuildProjects()
+{
+ ::SetCursor(LoadCursor(NULL, IDC_WAIT));
+ // copy the GUI cache values into the cache manager
+ this->FillCacheManagerFromCacheEditor();
+ // get all the info from the screen
+ this->UpdateData();
+ CString makefileIn = m_WhereSource;
+ makefileIn += "/CMakeLists.txt";
+ m_Makefile.ReadListFile(makefileIn);
+ // Move this to the cache editor
+ m_Makefile.GenerateMakefile();
+ cmCacheManager::GetInstance()->SaveCache(&m_Makefile);
+ // update the GUI with any new values in the caused by the
+ // generation process
+ this->FillCacheEditorFromCacheManager();
+ this->SaveToRegistry();
+ ::SetCursor(LoadCursor(NULL, IDC_ARROW));
+}
+
+
+ // copy from the cache manager to the cache edit list box
+void CMakeSetupDialog::FillCacheEditorFromCacheManager()
+{
+ cmCacheManager::CacheEntryMap cache =
+ cmCacheManager::GetInstance()->GetCacheMap();
+ for(cmCacheManager::CacheEntryMap::iterator i = cache.begin();
+ i != cache.end(); ++i)
+ {
+ const char* key = i->first.c_str();
+ cmCacheManager::CacheEntry& value = i->second;
+ switch(value.m_Type )
+ {
+ case cmCacheManager::BOOL:
+ m_CacheEntriesList.AddProperty(key,
+ value.m_Value.c_str(),
+ PIT_CHECKBOX,"");
+ break;
+ case cmCacheManager::PATH:
+ m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(),
+ PIT_FILE,"");
+ break;
+ case cmCacheManager::FILEPATH:
+ m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(),
+ PIT_FILE,"");
+ break;
+ case cmCacheManager::STRING:
+ m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(),
+ PIT_EDIT,"");
+ break;
+ case cmCacheManager::INTERNAL:
+ break;
+ }
+ }
+ this->UpdateData(FALSE);
+}
+
+ // copy from the list box to the cache manager
+void CMakeSetupDialog::FillCacheManagerFromCacheEditor()
+{
+ cmCacheManager::CacheEntryMap cache =
+ cmCacheManager::GetInstance()->GetCacheMap();
+ std::list<CPropertyItem*> items = m_CacheEntriesList.GetItems();
+ for(std::list<CPropertyItem*>::iterator i = items.begin();
+ i != items.end(); ++i)
+ {
+ // check to see if the editor has removed the cache entry
+ if((*i)->m_Removed)
+ {
+ cmCacheManager::GetInstance()->RemoveCacheEntry((*i)->m_propName);
+ }
+ else
+ {
+ cmCacheManager::CacheEntryMap::iterator p =
+ cache.find((const char*)(*i)->m_propName);
+ (*p).second.m_Value = (*i)->m_curValue;
+ }
+ }
+}
+
+
+
diff --git a/Source/MFCDialog/CMakeSetupDialog.h b/Source/MFCDialog/CMakeSetupDialog.h
index 1989234..47c09d3 100644
--- a/Source/MFCDialog/CMakeSetupDialog.h
+++ b/Source/MFCDialog/CMakeSetupDialog.h
@@ -7,7 +7,8 @@
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
-
+#include "../cmMakefile.h"
+#include "PropertyList.h"
/////////////////////////////////////////////////////////////////////////////
// CMakeSetupDialog dialog
@@ -20,6 +21,7 @@ protected:
bool Browse(CString&, const char* title);
void SaveToRegistry();
void LoadFromRegistry();
+ void InitMakefile();
void ReadRegistryValue(HKEY hKey,
CString *val,
const char *key,
@@ -27,8 +29,11 @@ protected:
// Dialog Data
//{{AFX_DATA(CMakeSetupDialog)
enum { IDD = IDD_CMakeSetupDialog_DIALOG };
+ cmMakefile m_Makefile;
+ bool m_InitMakefile;
CString m_WhereSource;
CString m_WhereBuild;
+ CPropertyList m_CacheEntriesList;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
@@ -39,6 +44,7 @@ protected:
// Implementation
protected:
+
HICON m_hIcon;
CString m_RegistryKey;
// Generated message map functions
@@ -50,8 +56,14 @@ protected:
afx_msg void OnChangeEdit1();
afx_msg void OnBrowse();
virtual void OnOK();
+ virtual void OnBuildProjects();
afx_msg void OnButton3();
+ // copy from the cache manager to the cache edit list box
+ void FillCacheEditorFromCacheManager();
+ // copy from the list box to the cache manager
+ void FillCacheManagerFromCacheEditor();
+
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
diff --git a/Source/MFCDialog/PropertyList.cpp b/Source/MFCDialog/PropertyList.cpp
new file mode 100644
index 0000000..5c69967
--- /dev/null
+++ b/Source/MFCDialog/PropertyList.cpp
@@ -0,0 +1,585 @@
+// PropertyList.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "PropertyList.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CPropertyList
+
+CPropertyList::CPropertyList()
+{
+ m_Dirty = false;
+}
+
+CPropertyList::~CPropertyList()
+{
+ for(std::list<CPropertyItem*>::iterator i = m_PropertyItems.begin();
+ i != m_PropertyItems.end(); ++i)
+ {
+ delete *i;
+ }
+}
+
+
+BEGIN_MESSAGE_MAP(CPropertyList, CListBox)
+ //{{AFX_MSG_MAP(CPropertyList)
+ ON_WM_CREATE()
+ ON_CONTROL_REFLECT(LBN_SELCHANGE, OnSelchange)
+ ON_WM_LBUTTONUP()
+ ON_WM_KILLFOCUS()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_RBUTTONUP()
+ ON_WM_MOUSEMOVE()
+ //}}AFX_MSG_MAP
+ ON_CBN_KILLFOCUS(IDC_PROPCMBBOX, OnKillfocusCmbBox)
+ ON_CBN_SELCHANGE(IDC_PROPCMBBOX, OnSelchangeCmbBox)
+ ON_EN_KILLFOCUS(IDC_PROPEDITBOX, OnKillfocusEditBox)
+ ON_EN_CHANGE(IDC_PROPEDITBOX, OnChangeEditBox)
+ ON_BN_CLICKED(IDC_PROPBTNCTRL, OnButton)
+ ON_BN_CLICKED(IDC_PROPCHECKBOXCTRL, OnCheckBox)
+ ON_COMMAND(42, OnDelete)
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CPropertyList message handlers
+
+BOOL CPropertyList::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if (!CListBox::PreCreateWindow(cs))
+ return FALSE;
+
+ cs.style &= ~(LBS_OWNERDRAWVARIABLE | LBS_SORT);
+ cs.style |= LBS_OWNERDRAWFIXED;
+
+ m_bTracking = FALSE;
+ m_nDivider = 0;
+ m_bDivIsSet = FALSE;
+
+ return TRUE;
+}
+
+void CPropertyList::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
+{
+ lpMeasureItemStruct->itemHeight = 20; //pixels
+}
+
+
+void CPropertyList::DrawItem(LPDRAWITEMSTRUCT lpDIS)
+{
+ CDC dc;
+ dc.Attach(lpDIS->hDC);
+ CRect rectFull = lpDIS->rcItem;
+ CRect rect = rectFull;
+ if (m_nDivider==0)
+ m_nDivider = rect.Width() / 2;
+ rect.left = m_nDivider;
+ CRect rect2 = rectFull;
+ rect2.right = rect.left - 1;
+ UINT nIndex = lpDIS->itemID;
+
+ if (nIndex != (UINT) -1)
+ {
+ //draw two rectangles, one for each row column
+ dc.FillSolidRect(rect2,RGB(192,192,192));
+ dc.DrawEdge(rect2,EDGE_SUNKEN,BF_BOTTOMRIGHT);
+ 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
+ dc.SetBkMode(TRANSPARENT);
+ dc.DrawText(pItem->m_propName,CRect(rect2.left+3,rect2.top+3,
+ rect2.right-3,rect2.bottom+3),
+ DT_LEFT | DT_SINGLELINE);
+
+ //write the initial property value in the second rectangle
+ dc.DrawText(pItem->m_curValue,CRect(rect.left+3,rect.top+3,
+ rect.right+3,rect.bottom+3),
+ DT_LEFT | DT_SINGLELINE);
+ }
+ dc.Detach();
+}
+
+int CPropertyList::AddItem(CString txt)
+{
+ int nIndex = AddString(txt);
+ return nIndex;
+}
+
+int CPropertyList::AddPropItem(CPropertyItem* pItem)
+{
+ int nIndex = AddString(_T(""));
+ SetItemDataPtr(nIndex,pItem);
+ m_PropertyItems.push_back(pItem);
+ return nIndex;
+}
+
+int CPropertyList::AddProperty(const char* name,
+ const char* value,
+ int type,
+ const char* comboItems)
+{
+ CPropertyItem* pItem = 0;
+ for(int i =0; i < this->GetCount(); ++i)
+ {
+ CPropertyItem* item = this->GetItem(i);
+ if(item->m_propName == name)
+ {
+ pItem = item;
+ if(pItem->m_curValue != value)
+ {
+ pItem->m_curValue = value;
+ m_Dirty = true;
+ Invalidate();
+ }
+ return i;
+ }
+ }
+ // if it is not found, then create a new one
+ int nIndex = AddString(_T(""));
+ pItem = new CPropertyItem(name, value, type, comboItems);
+ SetItemDataPtr(nIndex,pItem);
+ return nIndex;
+}
+
+int CPropertyList::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if (CListBox::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ m_bDivIsSet = FALSE;
+ m_nDivider = 0;
+ m_bTracking = FALSE;
+
+ m_hCursorSize = AfxGetApp()->LoadStandardCursor(IDC_SIZEWE);
+ m_hCursorArrow = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
+
+ m_SSerif8Font.CreatePointFont(80,_T("MS Sans Serif"));
+
+ return 0;
+}
+
+void CPropertyList::OnSelchange()
+{
+ CRect rect;
+ CString lBoxSelText;
+
+ GetItemRect(m_curSel,rect);
+ rect.left = m_nDivider;
+
+ CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
+
+ if (m_btnCtrl)
+ m_btnCtrl.ShowWindow(SW_HIDE);
+ if (m_CheckBoxControl)
+ m_CheckBoxControl.ShowWindow(SW_HIDE);
+
+ if (pItem->m_nItemType==PIT_COMBO)
+ {
+ //display the combo box. If the combo box has already been
+ //created then simply move it to the new location, else create it
+ m_nLastBox = 0;
+ if (m_cmbBox)
+ m_cmbBox.MoveWindow(rect);
+ else
+ {
+ rect.bottom += 100;
+ m_cmbBox.Create(CBS_DROPDOWNLIST | CBS_NOINTEGRALHEIGHT | WS_VISIBLE | WS_CHILD | WS_BORDER,
+ rect,this,IDC_PROPCMBBOX);
+ m_cmbBox.SetFont(&m_SSerif8Font);
+ }
+
+ //add the choices for this particular property
+ CString cmbItems = pItem->m_cmbItems;
+ lBoxSelText = pItem->m_curValue;
+
+ m_cmbBox.ResetContent();
+ int i,i2;
+ i=0;
+ while ((i2=cmbItems.Find('|',i)) != -1)
+ {
+ m_cmbBox.AddString(cmbItems.Mid(i,i2-i));
+ i=i2+1;
+ }
+ if(i != 0)
+ m_cmbBox.AddString(cmbItems.Mid(i));
+
+ m_cmbBox.ShowWindow(SW_SHOW);
+ m_cmbBox.SetFocus();
+
+ //jump to the property's current value in the combo box
+ int j = m_cmbBox.FindStringExact(0,lBoxSelText);
+ if (j != CB_ERR)
+ m_cmbBox.SetCurSel(j);
+ else
+ m_cmbBox.SetCurSel(0);
+ }
+ else if (pItem->m_nItemType==PIT_EDIT)
+ {
+ //display edit box
+ m_nLastBox = 1;
+ m_prevSel = m_curSel;
+ rect.bottom -= 3;
+ if (m_editBox)
+ m_editBox.MoveWindow(rect);
+ else
+ {
+ m_editBox.Create(ES_LEFT | ES_AUTOHSCROLL | WS_VISIBLE | WS_CHILD | WS_BORDER,
+ rect,this,IDC_PROPEDITBOX);
+ m_editBox.SetFont(&m_SSerif8Font);
+ }
+
+ lBoxSelText = pItem->m_curValue;
+
+ m_editBox.ShowWindow(SW_SHOW);
+ m_editBox.SetFocus();
+ //set the text in the edit box to the property's current value
+ m_editBox.SetWindowText(lBoxSelText);
+ }
+ else if (pItem->m_nItemType == PIT_CHECKBOX)
+ {
+ rect.bottom -= 3;
+ if (m_CheckBoxControl)
+ m_CheckBoxControl.MoveWindow(rect);
+ else
+ {
+ m_CheckBoxControl.Create("check",BS_CHECKBOX | BM_SETCHECK |BS_LEFTTEXT | WS_VISIBLE | WS_CHILD,
+ rect,this,IDC_PROPCHECKBOXCTRL);
+ m_CheckBoxControl.SetFont(&m_SSerif8Font);
+ }
+
+ lBoxSelText = pItem->m_curValue;
+
+ m_CheckBoxControl.ShowWindow(SW_SHOW);
+ m_CheckBoxControl.SetFocus();
+ //set the text in the edit box to the property's current value
+ if(lBoxSelText == "ON")
+ {
+ m_CheckBoxControl.SetCheck(1);
+ }
+ else
+ {
+ m_CheckBoxControl.SetCheck(0);
+ }
+ }
+
+ else
+ DisplayButton(rect);
+}
+
+void CPropertyList::DisplayButton(CRect region)
+{
+ //displays a button if the property is a file/color/font chooser
+ m_nLastBox = 2;
+ m_prevSel = m_curSel;
+
+ if (region.Width() > 25)
+ region.left = region.right - 25;
+ region.bottom -= 3;
+
+ if (m_btnCtrl)
+ m_btnCtrl.MoveWindow(region);
+ else
+ {
+ m_btnCtrl.Create("...",BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD,
+ region,this,IDC_PROPBTNCTRL);
+ m_btnCtrl.SetFont(&m_SSerif8Font);
+ }
+
+ m_btnCtrl.ShowWindow(SW_SHOW);
+ m_btnCtrl.SetFocus();
+}
+
+void CPropertyList::OnKillFocus(CWnd* pNewWnd)
+{
+ //m_btnCtrl.ShowWindow(SW_HIDE);
+
+ CListBox::OnKillFocus(pNewWnd);
+}
+
+void CPropertyList::OnKillfocusCmbBox()
+{
+ m_cmbBox.ShowWindow(SW_HIDE);
+
+ Invalidate();
+}
+
+void CPropertyList::OnKillfocusEditBox()
+{
+ CString newStr;
+ m_editBox.ShowWindow(SW_HIDE);
+
+ Invalidate();
+}
+
+void CPropertyList::OnSelchangeCmbBox()
+{
+ CString selStr;
+ if (m_cmbBox)
+ {
+ m_cmbBox.GetLBText(m_cmbBox.GetCurSel(),selStr);
+ CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
+ pItem->m_curValue = selStr;
+ m_Dirty = true;
+ }
+}
+
+void CPropertyList::OnChangeEditBox()
+{
+ CString newStr;
+ m_editBox.GetWindowText(newStr);
+
+ CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
+ pItem->m_curValue = newStr;
+ m_Dirty = true;
+}
+
+void CPropertyList::OnCheckBox()
+{
+ CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
+ if(m_CheckBoxControl.GetCheck())
+ {
+ pItem->m_curValue = "ON";
+ }
+ else
+ {
+ pItem->m_curValue = "OFF";
+ }
+ m_Dirty = true;
+}
+
+void CPropertyList::OnButton()
+{
+ CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
+
+ //display the appropriate common dialog depending on what type
+ //of chooser is associated with the property
+ if (pItem->m_nItemType == PIT_COLOR)
+ {
+ COLORREF initClr;
+ CString currClr = pItem->m_curValue;
+ //parse the property's current color value
+ if (currClr.Find("RGB") > -1)
+ {
+ int j = currClr.Find(',',3);
+ CString bufr = currClr.Mid(4,j-4);
+ int RVal = atoi(bufr);
+ int j2 = currClr.Find(',',j+1);
+ bufr = currClr.Mid(j+1,j2-(j+1));
+ int GVal = atoi(bufr);
+ int j3 = currClr.Find(')',j2+1);
+ bufr = currClr.Mid(j2+1,j3-(j2+1));
+ int BVal = atoi(bufr);
+ initClr = RGB(RVal,GVal,BVal);
+ }
+ else
+ initClr = 0;
+
+ CColorDialog ClrDlg(initClr);
+
+ if (IDOK == ClrDlg.DoModal())
+ {
+ COLORREF selClr = ClrDlg.GetColor();
+ CString clrStr;
+ clrStr.Format("RGB(%d,%d,%d)",GetRValue(selClr),
+ GetGValue(selClr),GetBValue(selClr));
+ m_btnCtrl.ShowWindow(SW_HIDE);
+
+ pItem->m_curValue = clrStr;
+ m_Dirty = true;
+ Invalidate();
+ }
+ }
+ else if (pItem->m_nItemType == PIT_FILE)
+ {
+ CString SelectedFile;
+ CString Filter("Gif Files (*.gif)|*.gif||");
+
+ CFileDialog FileDlg(TRUE, NULL, NULL, NULL,
+ Filter);
+
+ CString currPath = pItem->m_curValue;
+ FileDlg.m_ofn.lpstrTitle = "Select file";
+ if (currPath.GetLength() > 0)
+ FileDlg.m_ofn.lpstrInitialDir = currPath.Left(
+ currPath.GetLength() - currPath.ReverseFind('\\'));
+
+ if(IDOK == FileDlg.DoModal())
+ {
+ SelectedFile = FileDlg.GetPathName();
+
+ m_btnCtrl.ShowWindow(SW_HIDE);
+
+ pItem->m_curValue = SelectedFile;
+ m_Dirty = true;
+ Invalidate();
+ }
+ }
+ else if (pItem->m_nItemType == PIT_FONT)
+ {
+ CFontDialog FontDlg(NULL,CF_EFFECTS | CF_SCREENFONTS,NULL,this);
+
+ if(IDOK == FontDlg.DoModal())
+ {
+ CString faceName = FontDlg.GetFaceName();
+
+ m_btnCtrl.ShowWindow(SW_HIDE);
+
+ pItem->m_curValue = faceName;
+ m_Dirty = true;
+ Invalidate();
+ }
+ }
+}
+
+void CPropertyList::OnLButtonUp(UINT nFlags, CPoint point)
+{
+ if (m_bTracking)
+ {
+ //if columns were being resized then this indicates
+ //that mouse is up so resizing is done. Need to redraw
+ //columns to reflect their new widths.
+
+ m_bTracking = FALSE;
+ //if mouse was captured then release it
+ if (GetCapture()==this)
+ ::ReleaseCapture();
+
+ ::ClipCursor(NULL);
+
+ CClientDC dc(this);
+ InvertLine(&dc,CPoint(point.x,m_nDivTop),CPoint(point.x,m_nDivBtm));
+ //set the divider position to the new value
+ m_nDivider = point.x;
+
+ //redraw
+ Invalidate();
+ }
+ else
+ {
+ BOOL loc;
+ int i = ItemFromPoint(point,loc);
+ m_curSel = i;
+ CListBox::OnLButtonUp(nFlags, point);
+ }
+}
+
+void CPropertyList::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ if ((point.x>=m_nDivider-5) && (point.x<=m_nDivider+5))
+ {
+ //if mouse clicked on divider line, then start resizing
+
+ ::SetCursor(m_hCursorSize);
+
+ CRect windowRect;
+ GetWindowRect(windowRect);
+ windowRect.left += 10; windowRect.right -= 10;
+ //do not let mouse leave the list box boundary
+ ::ClipCursor(windowRect);
+
+ if (m_cmbBox)
+ m_cmbBox.ShowWindow(SW_HIDE);
+ if (m_editBox)
+ m_editBox.ShowWindow(SW_HIDE);
+
+ CRect clientRect;
+ GetClientRect(clientRect);
+
+ m_bTracking = TRUE;
+ m_nDivTop = clientRect.top;
+ m_nDivBtm = clientRect.bottom;
+ m_nOldDivX = point.x;
+
+ CClientDC dc(this);
+ InvertLine(&dc,CPoint(m_nOldDivX,m_nDivTop),CPoint(m_nOldDivX,m_nDivBtm));
+
+ //capture the mouse
+ SetCapture();
+ }
+ else
+ {
+ m_bTracking = FALSE;
+ CListBox::OnLButtonDown(nFlags, point);
+ }
+}
+
+void CPropertyList::OnMouseMove(UINT nFlags, CPoint point)
+{
+ if (m_bTracking)
+ {
+ //move divider line to the mouse pos. if columns are
+ //currently being resized
+ CClientDC dc(this);
+ //remove old divider line
+ InvertLine(&dc,CPoint(m_nOldDivX,m_nDivTop),CPoint(m_nOldDivX,m_nDivBtm));
+ //draw new divider line
+ InvertLine(&dc,CPoint(point.x,m_nDivTop),CPoint(point.x,m_nDivBtm));
+ m_nOldDivX = point.x;
+ }
+ else if ((point.x >= m_nDivider-5) && (point.x <= m_nDivider+5))
+ //set the cursor to a sizing cursor if the cursor is over the row divider
+ ::SetCursor(m_hCursorSize);
+ else
+ CListBox::OnMouseMove(nFlags, point);
+}
+
+void CPropertyList::InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo)
+{
+ int nOldMode = pDC->SetROP2(R2_NOT);
+
+ pDC->MoveTo(ptFrom);
+ pDC->LineTo(ptTo);
+
+ pDC->SetROP2(nOldMode);
+}
+
+void CPropertyList::PreSubclassWindow()
+{
+ m_bDivIsSet = FALSE;
+ m_nDivider = 0;
+ m_bTracking = FALSE;
+ m_curSel = 1;
+
+ m_hCursorSize = AfxGetApp()->LoadStandardCursor(IDC_SIZEWE);
+ m_hCursorArrow = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
+
+ m_SSerif8Font.CreatePointFont(80,_T("MS Sans Serif"));
+}
+
+CPropertyItem* CPropertyList::GetItem(int index)
+{
+ return (CPropertyItem*)GetItemDataPtr(index);
+}
+
+void CPropertyList::OnRButtonUp( UINT nFlags, CPoint point )
+{
+ CMenu menu;
+ CRect rect;
+ this->GetWindowRect(&rect);
+ BOOL loc;
+ m_curSel = ItemFromPoint(point,loc);
+ menu.CreatePopupMenu();
+ menu.AppendMenu(MF_STRING | MF_ENABLED, 42, "Delete Cache Entry");
+ menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
+ rect.TopLeft().x + point.x,
+ rect.TopLeft().y + point.y, this, NULL);
+}
+
+
+void CPropertyList::OnDelete()
+{
+ CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
+ pItem->m_Removed = true;
+ this->DeleteString(m_curSel);
+ Invalidate();
+}
+
diff --git a/Source/MFCDialog/PropertyList.h b/Source/MFCDialog/PropertyList.h
new file mode 100644
index 0000000..c6d65ed
--- /dev/null
+++ b/Source/MFCDialog/PropertyList.h
@@ -0,0 +1,141 @@
+#if !defined(AFX_PROPERTYLIST_H__74205380_1B56_11D4_BC48_00105AA2186F__INCLUDED_)
+#define AFX_PROPERTYLIST_H__74205380_1B56_11D4_BC48_00105AA2186F__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// PropertyList.h : header file
+//
+
+#define PIT_COMBO 0 //PIT = property item type
+#define PIT_EDIT 1
+#define PIT_COLOR 2
+#define PIT_FONT 3
+#define PIT_FILE 4
+#define PIT_CHECKBOX 5
+
+#define IDC_PROPCMBBOX 712
+#define IDC_PROPEDITBOX 713
+#define IDC_PROPBTNCTRL 714
+#define IDC_PROPCHECKBOXCTRL 715
+
+#include <list>
+
+/////////////////////////////////////////////////////////////////////////////
+//CPropertyList Items
+class CPropertyItem
+{
+// Attributes
+public:
+ CString m_propName;
+ CString m_curValue;
+ int m_nItemType;
+ CString m_cmbItems;
+ bool m_Removed;
+public:
+ CPropertyItem(CString propName, CString curValue,
+ int nItemType, CString cmbItems)
+ {
+ m_Removed = false;
+ m_propName = propName;
+ m_curValue = curValue;
+ m_nItemType = nItemType;
+ m_cmbItems = cmbItems;
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// CPropertyList window
+
+class CPropertyList : public CListBox
+{
+// Construction
+public:
+ CPropertyList();
+
+// Attributes
+public:
+
+// Operations
+public:
+ int AddItem(CString txt);
+ int AddProperty(const char* name,
+ const char* value,
+ int type,
+ const char* comboItems);
+ std::list<CPropertyItem*> GetItems()
+ {
+ return m_PropertyItems;
+ }
+
+ CPropertyItem* GetItem(int index);
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CPropertyList)
+public:
+ virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
+ virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+protected:
+ int AddPropItem(CPropertyItem* pItem);
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ virtual void PreSubclassWindow();
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ virtual ~CPropertyList();
+
+ // Generated message map functions
+protected:
+ //{{AFX_MSG(CPropertyList)
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg void OnSelchange();
+ afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+ afx_msg void OnKillFocus(CWnd* pNewWnd);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ afx_msg void OnRButtonUp( UINT nFlags, CPoint point );
+ //}}AFX_MSG
+ afx_msg void OnKillfocusCmbBox();
+ afx_msg void OnSelchangeCmbBox();
+ afx_msg void OnKillfocusEditBox();
+ afx_msg void OnChangeEditBox();
+ afx_msg void OnButton();
+ afx_msg void OnDelete();
+ afx_msg void OnCheckBox();
+
+
+
+ DECLARE_MESSAGE_MAP()
+
+ void InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo);
+ void DisplayButton(CRect region);
+
+ CComboBox m_cmbBox;
+ CEdit m_editBox;
+ CButton m_btnCtrl;
+ CButton m_CheckBoxControl;
+
+ CFont m_SSerif8Font;
+
+ bool m_Dirty;
+ int m_curSel;
+ int m_prevSel;
+ int m_nDivider;
+ int m_nDivTop;
+ int m_nDivBtm;
+ int m_nOldDivX;
+ int m_nLastBox;
+ BOOL m_bTracking;
+ BOOL m_bDivIsSet;
+ HCURSOR m_hCursorArrow;
+ HCURSOR m_hCursorSize;
+ std::list<CPropertyItem*> m_PropertyItems;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_PROPERTYLIST_H__74205380_1B56_11D4_BC48_00105AA2186F__INCLUDED_)
diff --git a/Source/MFCDialog/resource.h b/Source/MFCDialog/resource.h
index bf8788d..682c50c 100644
--- a/Source/MFCDialog/resource.h
+++ b/Source/MFCDialog/resource.h
@@ -1,24 +1,26 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by CMakeSetup.rc
-//
-#define IDM_ABOUTBOX 0x0010
-#define IDD_ABOUTBOX 100
-#define IDS_ABOUTBOX 101
-#define IDD_CMakeSetupDialog_DIALOG 102
-#define IDR_MAINFRAME 128
-#define IDC_WhereSource 1001
-#define IDC_BUTTON2 1002
-#define IDC_WhereBuild 1003
-#define IDC_BUTTON3 1004
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 131
-#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1004
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by CMakeSetup.rc
+//
+#define IDM_ABOUTBOX 0x0010
+#define IDD_ABOUTBOX 100
+#define IDS_ABOUTBOX 101
+#define IDD_CMakeSetupDialog_DIALOG 102
+#define IDR_MAINFRAME 128
+#define IDC_WhereSource 1001
+#define IDC_BUTTON2 1002
+#define IDC_WhereBuild 1003
+#define IDC_BUTTON3 1004
+#define IDC_BuildProjects 1006
+#define IDC_LIST2 1007
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 131
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1008
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 62762e2..90cfd3d 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -136,6 +136,11 @@ bool cmCacheManager::SaveCache(cmMakefile* mf)
return true;
}
+void cmCacheManager::RemoveCacheEntry(const char* key)
+{
+ m_Cache.erase(key);
+}
+
void cmCacheManager::AddCacheEntry(const char* key,
const char* value,
CacheEntryType type)
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 11cd592..f5ded99 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -28,6 +28,15 @@ class cmMakefile;
class cmCacheManager
{
public:
+ enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL };
+ class CacheEntry
+ {
+ public:
+ std::string m_Value;
+ CacheEntryType m_Type;
+ };
+ typedef std::map<std::string, CacheEntry> CacheEntryMap;
+public:
/**
* Types for the cache entries. These are useful as
* hints for a cache editor program. Path should bring
@@ -35,7 +44,6 @@ public:
* text entry box, FILEPATH is a full path to a file which
* can be different than just a path input
*/
- enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL };
static CacheEntryType StringToType(const char*);
//! Singleton pattern get instance of the cmCacheManager.
static cmCacheManager* GetInstance();
@@ -49,20 +57,21 @@ public:
//! Add an entry into the cache
void AddCacheEntry(const char* key, const char* value, CacheEntryType type);
+ //! Remove an entry from the cache
+ void RemoveCacheEntry(const char* key);
+
//! Get a value from the cache given a key
const char* GetCacheValue(const char* key);
//! Print the cache to a stream
void PrintCache(std::ostream&);
+
+ //! Get the cache map ivar.
+ CacheEntryMap GetCacheMap() { return m_Cache; }
+
private:
static cmCacheManager* s_Instance;
- class CacheEntry
- {
- public:
- std::string m_Value;
- CacheEntryType m_Type;
- };
- std::map<std::string, CacheEntry> m_Cache;
+ CacheEntryMap m_Cache;
};
#endif
diff --git a/Source/cmDSWMakefile.cxx b/Source/cmDSWMakefile.cxx
index 8e37083..97eb9c3 100644
--- a/Source/cmDSWMakefile.cxx
+++ b/Source/cmDSWMakefile.cxx
@@ -18,7 +18,6 @@
#include "cmSystemTools.h"
#include "cmDSPMakefile.h"
#include "cmMSProjectGenerator.h"
-//#include <windows.h>
cmDSWMakefile::cmDSWMakefile(cmMakefile* m)
diff --git a/Source/cmDSWWriter.cxx b/Source/cmDSWWriter.cxx
index 8e37083..97eb9c3 100644
--- a/Source/cmDSWWriter.cxx
+++ b/Source/cmDSWWriter.cxx
@@ -18,7 +18,6 @@
#include "cmSystemTools.h"
#include "cmDSPMakefile.h"
#include "cmMSProjectGenerator.h"
-//#include <windows.h>
cmDSWMakefile::cmDSWMakefile(cmMakefile* m)
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index 4fa9e2d..09c1ecc 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -19,7 +19,7 @@
#include "cmStandardIncludes.h"
#include "cmRegularExpression.h"
#include "cmCustomCommand.h"
-#include <set>
+
/** \class cmSourceGroup
* \brief Hold a group of sources as specified by a SOURCE_GROUP command.
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 1b13cbd..e9733bf 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -51,6 +51,7 @@
#include <functional>
#include <map>
#include <list>
+#include <set>
#ifdef CMAKE_NO_STD_NAMESPACE
#define std
diff --git a/Source/cmWindowsConfigure.cxx b/Source/cmWindowsConfigure.cxx
deleted file mode 100644
index fe81508..0000000
--- a/Source/cmWindowsConfigure.cxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/*=========================================================================
-
- Program: Insight Segmentation & Registration Toolkit
- Module: $RCSfile$
- Language: C++
- Date: $Date$
- Version: $Revision$
-
-
- Copyright (c) 2000 National Library of Medicine
- All rights reserved.
-
- See COPYRIGHT.txt for copyright details.
-
-=========================================================================*/
-#include "cmWindowsConfigure.h"
-#include "cmStandardIncludes.h"
-#include "cmSystemTools.h"
-#include <windows.h>
-
-bool cmWindowsConfigure::Configure(const char* file)
-{
- std::ifstream fin(file);
- if(!fin)
- {
- return false;
- }
- char inbuf[5001];
- while(fin.getline(inbuf, 5000) )
- {
- std::string inputLine = inbuf;
- if(inputLine[0] != '#')
- {
- std::string destDir;
- std::string fromFile;
- std::string toFile;
- std::string::size_type pos = inputLine.find(':');
- if(pos != std::string::npos)
- {
- destDir = inputLine.substr(0, pos);
- std::string::size_type nextPos = inputLine.find(':', pos+1);
- if(nextPos != std::string::npos)
- {
- std::string toFileName = inputLine.substr(pos+1, nextPos-pos-1);
- fromFile = inputLine.substr(nextPos+1);
- toFile = destDir;
- toFile += "/";
- toFile += toFileName;
- cmSystemTools::ReplaceString(toFile, "${CMAKE_BINARY_DIR}",
- m_WhereBuild.c_str() );
- cmSystemTools::ReplaceString(toFile, "${CMAKE_SOURCE_DIR}",
- m_WhereSource.c_str() );
- cmSystemTools::ReplaceString(fromFile, "${CMAKE_BINARY_DIR}",
- m_WhereBuild.c_str() );
- cmSystemTools::ReplaceString(fromFile, "${CMAKE_SOURCE_DIR}",
- m_WhereSource.c_str() );
- cmSystemTools::ReplaceString(destDir, "${CMAKE_BINARY_DIR}",
- m_WhereBuild.c_str() );
- cmSystemTools::ReplaceString(destDir, "${CMAKE_SOURCE_DIR}",
- m_WhereSource.c_str() );
- }
- }
- if(destDir != "" && fromFile != "" && toFile != "")
- {
- if(!cmSystemTools::MakeDirectory(destDir.c_str()) )
- {
- std::string error = "Error: can not create directory: ";
- error += destDir;
- MessageBox(0, error.c_str(), "config ERROR", MB_OK);
- return false;
- }
- if(!CopyFile(fromFile.c_str(), toFile.c_str(), FALSE))
- {
- std::string error = "Error: can not copy : ";
- error += fromFile;
- error += " to ";
- error += toFile;
- MessageBox(0, error.c_str(), "config ERROR", MB_OK);
- return false;
- }
- }
- else if (inputLine != "")
- {
- std::string error = "Error in parsing : ";
- error += file;
- error += " in line:\n ";
- error += inputLine;
- MessageBox(0, error.c_str(), "config ERROR", MB_OK);
- return false;
- }
- }
- }
- return true;
-}
-
diff --git a/Source/cmWindowsConfigure.h b/Source/cmWindowsConfigure.h
deleted file mode 100644
index 191ee1d..0000000
--- a/Source/cmWindowsConfigure.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*=========================================================================
-
- Program: Insight Segmentation & Registration Toolkit
- Module: $RCSfile$
- Language: C++
- Date: $Date$
- Version: $Revision$
-
-
- Copyright (c) 2000 National Library of Medicine
- All rights reserved.
-
- See COPYRIGHT.txt for copyright details.
-
-=========================================================================*/
-#ifndef cmWindowsConfigure_h
-#define cmWindowsConfigure_h
-
-#include "cmStandardIncludes.h"
-
-/** \class cmWindowsConfigure
- * \brief Configure the build process on Windows systems.
- *
- * cmWindowsConfigure configures the build process
- * on windows where the Unix autoconf configure can not be used.
- * The system specific .h files normally generated by autoconf
- * should be generated by sub-classes of this class.
- */
-class cmWindowsConfigure
-{
-public:
- /**
- * Set the path to the top level of the source directory.
- */
- void SetWhereSource(const char* dir)
- {
- m_WhereSource = dir;
- }
-
- /**
- * Set the path to the top level of the build directory.
- */
- void SetWhereBuild(const char* dir)
- {
- m_WhereBuild = dir;
- }
-
- /**
- * Perform the configure process.
- */
- virtual bool Configure(const char* input);
-
-protected:
- std::string m_WhereSource;
- std::string m_WhereBuild;
-};
-
-#endif