diff --git a/Source/MFCDialog/CMakeLists.txt b/Source/MFCDialog/CMakeLists.txt index af5223273..5064135b6 100644 --- a/Source/MFCDialog/CMakeLists.txt +++ b/Source/MFCDialog/CMakeLists.txt @@ -1,5 +1,6 @@ SOURCE_FILES(SRCS CMakeSetup.cpp +MakeHelp.cpp CMakeSetup.rc CMakeSetupDialog.cpp PathDialog.cpp diff --git a/Source/MFCDialog/CMakeSetup.dsp b/Source/MFCDialog/CMakeSetup.dsp index 414adce92..f1320afd1 100644 --- a/Source/MFCDialog/CMakeSetup.dsp +++ b/Source/MFCDialog/CMakeSetup.dsp @@ -111,6 +111,10 @@ SOURCE=.\CMakeSetupDialog.cpp # End Source File # Begin Source File +SOURCE=.\MakeHelp.cpp +# End Source File +# Begin Source File + SOURCE=.\PathDialog.cpp # End Source File # Begin Source File @@ -140,6 +144,10 @@ SOURCE=.\CMakeSetupDialog.h # End Source File # Begin Source File +SOURCE=.\MakeHelp.h +# End Source File +# Begin Source File + SOURCE=.\Resource.h # End Source File # Begin Source File diff --git a/Source/MFCDialog/CMakeSetup.rc b/Source/MFCDialog/CMakeSetup.rc index 49bc8ba47..0d799e83e 100644 --- a/Source/MFCDialog/CMakeSetup.rc +++ b/Source/MFCDialog/CMakeSetup.rc @@ -85,12 +85,12 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP END -IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 389, 225 +IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 389, 241 STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW CAPTION "CMakeSetupDialog" -FONT 8, "MS Sans Serif", 0, 0, 0x1 +FONT 8, "MS Sans Serif" BEGIN COMBOBOX IDC_WhereSource,96,6,133,66,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP @@ -98,21 +98,32 @@ BEGIN COMBOBOX IDC_WhereBuild,96,26,133,68,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Browse...",IDC_BUTTON3,230,25,34,13 - DEFPUSHBUTTON "Configure",IDC_BuildProjects,88,202,67,15 - PUSHBUTTON "Cancel",IDCANCEL,220,201,67,15 + DEFPUSHBUTTON "Configure",IDC_BuildProjects,70,223,67,15 + PUSHBUTTON "Cancel",IDCANCEL,202,223,67,15 LISTBOX IDC_LIST2,15,55,356,122,LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL RTEXT "Where is the source code:",IDC_STATIC,6,7,86,9 RTEXT "Where to build the binaries:",IDC_STATIC,5,27,90,9 GROUPBOX "Cache Values",IDC_FRAME,9,43,369,141 - CTEXT "Right click on cache entries for additional options", - IDC_MouseHelpCaption,106,189,156,8 - LTEXT "Static",IDC_CMAKE_VERSION,3,211,58,13,SS_CENTERIMAGE - PUSHBUTTON "OK",IDC_OK,160,202,56,14 + LTEXT "Right click on a cache value for additional options and help.\nPress Configure to update and display new values in red.\nPress OK to generate selected build files and exit.", + IDC_MouseHelpCaption,103,190,197,27 + LTEXT "Static",IDC_CMAKE_VERSION,3,227,52,13,SS_CENTERIMAGE + PUSHBUTTON "OK",IDC_OK,142,223,56,14 COMBOBOX IDC_Generator,275,25,103,50,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Build For:",IDC_GeneratorLabel,279,10,103,12 + PUSHBUTTON "Help",IDC_HELP_BUTTON,274,223,57,15 +END + +IDD_CMAKE_HELP_DIALOG DIALOG DISCARDABLE 0, 0, 365, 183 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "CMake Help" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,155,159,50,14 + EDITTEXT IDC_EDIT1,7,7,351,152,ES_MULTILINE | ES_READONLY | NOT + WS_BORDER END @@ -178,6 +189,15 @@ BEGIN IDD_CMakeSetupDialog_DIALOG, DIALOG BEGIN RIGHTMARGIN, 388 + BOTTOMMARGIN, 238 + END + + IDD_CMAKE_HELP_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 358 + TOPMARGIN, 7 + BOTTOMMARGIN, 176 END END #endif // APSTUDIO_INVOKED diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index cca009d42..0d0e504b7 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -3,6 +3,7 @@ #include "stdafx.h" #include "CMakeSetup.h" +#include "MakeHelp.h" #include "PathDialog.h" #include "CMakeSetupDialog.h" #include "CMakeCommandLineInfo.h" @@ -86,7 +87,7 @@ CMakeSetupDialog::CMakeSetupDialog(const CMakeCommandLineInfo& cmdInfo, m_WhereSource = cmdInfo.m_WhereSource; m_WhereBuild = cmdInfo.m_WhereBuild; m_GeneratorChoiceString = _T(""); - //}}AFX_DATA_INIT + //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_BuildPathChanged = false; @@ -106,6 +107,7 @@ void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMakeSetupDialog) + DDX_Control(pDX, IDC_HELP_BUTTON, m_HelpButton); DDX_Control(pDX, IDC_Generator, m_GeneratorChoice); DDX_Control(pDX, IDC_OK, m_OKButton); DDX_Control(pDX, IDCANCEL, m_CancelButton); @@ -137,8 +139,9 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog) ON_WM_SIZE() ON_WM_GETMINMAXINFO() ON_BN_CLICKED(IDC_OK, OnOk) - ON_BN_CLICKED(IDCANCEL, OnCancel) ON_CBN_EDITCHANGE(IDC_Generator, OnEditchangeGenerator) + ON_BN_CLICKED(IDCANCEL, OnCancel) + ON_BN_CLICKED(IDC_HELP_BUTTON, OnHelpButton) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -605,14 +608,6 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager() } const cmCacheManager::CacheEntryMap &cache = cmCacheManager::GetInstance()->GetCacheMap(); - if(cache.size() == 0) - { - m_OKButton.EnableWindow(false); - } - else - { - m_OKButton.EnableWindow(true); - } for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); i != cache.end(); ++i) @@ -670,6 +665,28 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager() break; } } + m_OKButton.EnableWindow(false); + if(cache.size() > 0) + { + bool enable = true; + items = m_CacheEntriesList.GetItems(); + for(std::set::iterator i = items.begin(); + i != items.end(); ++i) + { + CPropertyItem* item = *i; + if(item->m_NewValue) + { + // if one new value then disable to OK button + enable = false; + break; + } + } + if(enable) + { + m_OKButton.EnableWindow(true); + } + } + // redraw the list m_CacheEntriesList.SetTopIndex(0); m_CacheEntriesList.Invalidate(); @@ -797,6 +814,12 @@ void CMakeSetupDialog::OnSize(UINT nType, int cx, int cy) cRect.top + deltay, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + m_HelpButton.GetWindowRect(&cRect); + this->ScreenToClient(&cRect); + m_HelpButton.SetWindowPos(&wndTop, cRect.left + deltax/2, + cRect.top + deltay, + 0, 0, + SWP_NOSIZE | SWP_NOZORDER); } } @@ -972,3 +995,9 @@ int CMakeSetupDialog::CreateShortcut() return 0; } + +void CMakeSetupDialog::OnHelpButton() +{ + CMakeHelp dialog; + dialog.DoModal(); +} diff --git a/Source/MFCDialog/CMakeSetupDialog.h b/Source/MFCDialog/CMakeSetupDialog.h index bef4dbc73..8c6c21059 100644 --- a/Source/MFCDialog/CMakeSetupDialog.h +++ b/Source/MFCDialog/CMakeSetupDialog.h @@ -36,6 +36,7 @@ protected: // Dialog Data //{{AFX_DATA(CMakeSetupDialog) enum { IDD = IDD_CMakeSetupDialog_DIALOG }; + CButton m_HelpButton; CComboBox m_GeneratorChoice; CButton m_OKButton; CButton m_CancelButton; @@ -89,6 +90,7 @@ protected: afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI ); afx_msg void OnOk(); afx_msg void OnEditchangeGenerator(); + afx_msg void OnHelpButton(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/Source/MFCDialog/MakeHelp.cpp b/Source/MFCDialog/MakeHelp.cpp new file mode 100644 index 000000000..5c022eefe --- /dev/null +++ b/Source/MFCDialog/MakeHelp.cpp @@ -0,0 +1,43 @@ +// MakeHelp.cpp : implementation file +// + +#include "stdafx.h" +#include "cmakesetup.h" +#include "MakeHelp.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMakeHelp dialog + + +CMakeHelp::CMakeHelp(CWnd* pParent /*=NULL*/) + : CDialog(CMakeHelp::IDD, pParent) +{ + //{{AFX_DATA_INIT(CMakeHelp) + m_HelpMessage = _T("CMake is used to configure and generate build files for software projects. The basic steps for configuring a project are as follows:\r\n\r\n1. Select the source directory for the project. This should contain the CMakeLists.txt files for the project.\r\n\r\n2. Select the build directory for the project. This is the directory where the project will be built. It can be the same or a different directory than the source directory. For easy clean up, a separate build directory is recommended. CMake will create the directory if it does not exist.\r\n\r\n3. Once the source and binary directories are selected, it is time to press the Configure button. This will cause CMake to read all of the input files and discover all the variables used by the project. The first time a variable is displayed it will be in Red. Users should inspect red variables making sure the values are correct. For some projects the Configure process can be iterative, so continue to press the Configure button until there are no longer red entries.\r\n\r\n4. Once there are no longer red entries, you should click the OK button. This will write the build files to the build directory and exit CMake."); + //}}AFX_DATA_INIT +} + + +void CMakeHelp::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CMakeHelp) + DDX_Text(pDX, IDC_EDIT1, m_HelpMessage); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CMakeHelp, CDialog) + //{{AFX_MSG_MAP(CMakeHelp) + // NOTE: the ClassWizard will add message map macros here + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CMakeHelp message handlers diff --git a/Source/MFCDialog/MakeHelp.h b/Source/MFCDialog/MakeHelp.h new file mode 100644 index 000000000..27f076c80 --- /dev/null +++ b/Source/MFCDialog/MakeHelp.h @@ -0,0 +1,46 @@ +#if !defined(AFX_MAKEHELP_H__DD327AED_1E65_43E8_A605_0933065D1757__INCLUDED_) +#define AFX_MAKEHELP_H__DD327AED_1E65_43E8_A605_0933065D1757__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// MakeHelp.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CMakeHelp dialog + +class CMakeHelp : public CDialog +{ +// Construction +public: + CMakeHelp(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CMakeHelp) + enum { IDD = IDD_CMAKE_HELP_DIALOG }; + CString m_HelpMessage; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMakeHelp) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CMakeHelp) + // NOTE: the ClassWizard will add member functions here + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAKEHELP_H__DD327AED_1E65_43E8_A605_0933065D1757__INCLUDED_) diff --git a/Source/MFCDialog/resource.h b/Source/MFCDialog/resource.h index 56200d042..be740c4a3 100644 --- a/Source/MFCDialog/resource.h +++ b/Source/MFCDialog/resource.h @@ -9,6 +9,7 @@ #define IDD_CMakeSetupDialog_DIALOG 102 #define IDS_CREATESHORTCUT 102 #define IDR_MAINFRAME 128 +#define IDD_CMAKE_HELP_DIALOG 133 #define IDC_WhereSource 1001 #define IDC_BUTTON2 1002 #define IDC_WhereBuild 1003 @@ -22,14 +23,16 @@ #define IDC_OK 1018 #define IDC_Generator 1019 #define IDC_GeneratorLabel 1020 +#define IDC_HELP_BUTTON 1021 +#define IDC_EDIT1 1025 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_RESOURCE_VALUE 134 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1021 +#define _APS_NEXT_CONTROL_VALUE 1026 #define _APS_NEXT_SYMED_VALUE 102 #endif #endif