From 8c28e4e9f0b82ec96b4b68c370a8fc50333b093c Mon Sep 17 00:00:00 2001 From: Jorgen Bodde Date: Thu, 30 Jun 2005 15:54:14 -0400 Subject: Initial checkin new wx dialog --- Source/WXDialog/CMakeIcon.xpm | 276 +++ Source/WXDialog/CMakeLists.txt | 93 + Source/WXDialog/CMakeSetup.cpp | 120 ++ Source/WXDialog/CMakeSetup.h | 92 + Source/WXDialog/CMakeSetup.pjd | 3513 +++++++++++++++++++++++++++++++++ Source/WXDialog/CMakeSetup.rc | 12 + Source/WXDialog/CMakeSetupFrame.cpp | 1775 +++++++++++++++++ Source/WXDialog/CMakeSetupFrame.h | 360 ++++ Source/WXDialog/CommandLineInfo.cpp | 136 ++ Source/WXDialog/CommandLineInfo.h | 66 + Source/WXDialog/NGDialog.exe.manifest | 22 + Source/WXDialog/NGDialog.ico | Bin 0 -> 1406 bytes Source/WXDialog/PropertyList.cpp | 856 ++++++++ Source/WXDialog/PropertyList.h | 339 ++++ Source/WXDialog/about.html | 21 + Source/WXDialog/aboutdlg.cpp | 210 ++ Source/WXDialog/aboutdlg.h | 117 ++ Source/WXDialog/app_resources.cpp | 86 + Source/WXDialog/app_resources.h | 60 + Source/WXDialog/changelog.txt | 22 + Source/WXDialog/cmake_icon.gif | Bin 0 -> 892 bytes Source/WXDialog/cmake_icon.xpm | 276 +++ Source/WXDialog/cmake_logo.xpm | 50 + Source/WXDialog/cmakesetup.done.xml | 2 + Source/WXDialog/cmakesetup.xml | 95 + Source/WXDialog/config.h | 43 + Source/WXDialog/optionsdlg.cpp | 199 ++ Source/WXDialog/optionsdlg.h | 125 ++ Source/WXDialog/progressdlg.cpp | 177 ++ Source/WXDialog/progressdlg.h | 139 ++ 30 files changed, 9282 insertions(+) create mode 100644 Source/WXDialog/CMakeIcon.xpm create mode 100644 Source/WXDialog/CMakeLists.txt create mode 100644 Source/WXDialog/CMakeSetup.cpp create mode 100644 Source/WXDialog/CMakeSetup.h create mode 100644 Source/WXDialog/CMakeSetup.pjd create mode 100644 Source/WXDialog/CMakeSetup.rc create mode 100644 Source/WXDialog/CMakeSetupFrame.cpp create mode 100644 Source/WXDialog/CMakeSetupFrame.h create mode 100644 Source/WXDialog/CommandLineInfo.cpp create mode 100644 Source/WXDialog/CommandLineInfo.h create mode 100644 Source/WXDialog/NGDialog.exe.manifest create mode 100644 Source/WXDialog/NGDialog.ico create mode 100644 Source/WXDialog/PropertyList.cpp create mode 100644 Source/WXDialog/PropertyList.h create mode 100644 Source/WXDialog/about.html create mode 100644 Source/WXDialog/aboutdlg.cpp create mode 100644 Source/WXDialog/aboutdlg.h create mode 100644 Source/WXDialog/app_resources.cpp create mode 100644 Source/WXDialog/app_resources.h create mode 100644 Source/WXDialog/changelog.txt create mode 100644 Source/WXDialog/cmake_icon.gif create mode 100644 Source/WXDialog/cmake_icon.xpm create mode 100644 Source/WXDialog/cmake_logo.xpm create mode 100644 Source/WXDialog/cmakesetup.done.xml create mode 100644 Source/WXDialog/cmakesetup.xml create mode 100644 Source/WXDialog/config.h create mode 100644 Source/WXDialog/optionsdlg.cpp create mode 100644 Source/WXDialog/optionsdlg.h create mode 100644 Source/WXDialog/progressdlg.cpp create mode 100644 Source/WXDialog/progressdlg.h diff --git a/Source/WXDialog/CMakeIcon.xpm b/Source/WXDialog/CMakeIcon.xpm new file mode 100644 index 0000000..4c694c3 --- /dev/null +++ b/Source/WXDialog/CMakeIcon.xpm @@ -0,0 +1,276 @@ +/* XPM */ +static char *CMakeIcon_xpm[] = { +"16 16 256 3", +"000 c black", +"001 c #003F00", +"002 c #003F3F", +"003 c #3F0000", +"004 c #3F003F", +"005 c #3F3F00", +"006 c gray19", +"007 c #00007F", +"008 c #007F00", +"009 c #306F30", +"010 c #7F0000", +"011 c #606060", +"012 c #0000BF", +"013 c blue", +"014 c #00BF00", +"015 c green", +"016 c #BF0000", +"017 c red", +"018 c #909090", +"019 c #C0C0C0", +"020 c none", +"021 c black", +"022 c black", +"023 c black", +"024 c black", +"025 c black", +"026 c black", +"027 c black", +"028 c black", +"029 c black", +"030 c black", +"031 c black", +"032 c black", +"033 c black", +"034 c black", +"035 c black", +"036 c black", +"037 c black", +"038 c black", +"039 c black", +"040 c black", +"041 c black", +"042 c black", +"043 c black", +"044 c black", +"045 c black", +"046 c black", +"047 c black", +"048 c black", +"049 c black", +"050 c black", +"051 c black", +"052 c black", +"053 c black", +"054 c black", +"055 c black", +"056 c black", +"057 c black", +"058 c black", +"059 c black", +"060 c black", +"061 c black", +"062 c black", +"063 c black", +"064 c black", +"065 c black", +"066 c black", +"067 c black", +"068 c black", +"069 c black", +"070 c black", +"071 c black", +"072 c black", +"073 c black", +"074 c black", +"075 c black", +"076 c black", +"077 c black", +"078 c black", +"079 c black", +"080 c black", +"081 c black", +"082 c black", +"083 c black", +"084 c black", +"085 c black", +"086 c black", +"087 c black", +"088 c black", +"089 c black", +"090 c black", +"091 c black", +"092 c black", +"093 c black", +"094 c black", +"095 c black", +"096 c black", +"097 c black", +"098 c black", +"099 c black", +"100 c black", +"101 c black", +"102 c black", +"103 c black", +"104 c black", +"105 c black", +"106 c black", +"107 c black", +"108 c black", +"109 c black", +"110 c black", +"111 c black", +"112 c black", +"113 c black", +"114 c black", +"115 c black", +"116 c black", +"117 c black", +"118 c black", +"119 c black", +"120 c black", +"121 c black", +"122 c black", +"123 c black", +"124 c black", +"125 c black", +"126 c black", +"127 c black", +"128 c black", +"129 c black", +"130 c black", +"131 c black", +"132 c black", +"133 c black", +"134 c black", +"135 c black", +"136 c black", +"137 c black", +"138 c black", +"139 c black", +"140 c black", +"141 c black", +"142 c black", +"143 c black", +"144 c black", +"145 c black", +"146 c black", +"147 c black", +"148 c black", +"149 c black", +"150 c black", +"151 c black", +"152 c black", +"153 c black", +"154 c black", +"155 c black", +"156 c black", +"157 c black", +"158 c black", +"159 c black", +"160 c black", +"161 c black", +"162 c black", +"163 c black", +"164 c black", +"165 c black", +"166 c black", +"167 c black", +"168 c black", +"169 c black", +"170 c black", +"171 c black", +"172 c black", +"173 c black", +"174 c black", +"175 c black", +"176 c black", +"177 c black", +"178 c black", +"179 c black", +"180 c black", +"181 c black", +"182 c black", +"183 c black", +"184 c black", +"185 c black", +"186 c black", +"187 c black", +"188 c black", +"189 c black", +"190 c black", +"191 c black", +"192 c black", +"193 c black", +"194 c black", +"195 c black", +"196 c black", +"197 c black", +"198 c black", +"199 c black", +"200 c black", +"201 c black", +"202 c black", +"203 c black", +"204 c black", +"205 c black", +"206 c black", +"207 c black", +"208 c black", +"209 c black", +"210 c black", +"211 c black", +"212 c black", +"213 c black", +"214 c black", +"215 c black", +"216 c black", +"217 c black", +"218 c black", +"219 c black", +"220 c black", +"221 c black", +"222 c black", +"223 c black", +"224 c black", +"225 c black", +"226 c black", +"227 c black", +"228 c black", +"229 c black", +"230 c black", +"231 c black", +"232 c black", +"233 c black", +"234 c black", +"235 c black", +"236 c black", +"237 c black", +"238 c black", +"239 c black", +"240 c black", +"241 c black", +"242 c black", +"243 c black", +"244 c black", +"245 c black", +"246 c black", +"247 c black", +"248 c black", +"249 c black", +"250 c black", +"251 c black", +"252 c black", +"253 c black", +"254 c black", +"255 c black", +"020020020020020020020020020020020020020020020020", +"020020020020020020020000000020020020020020020020", +"020020020020020020020000003020020020020020020020", +"020020020020020020000012010000020020020020020020", +"020020020020020020007013010003020020020020020020", +"020020020020020000013013010016000020020020020020", +"020020020020020007013013004017003020020020020020", +"020020020020000013013013007017016000020020020020", +"020020020020007013013012006017017003020020020020", +"020020020000012013012018011017017016000020020020", +"020020020007013012009018019010017017003020020020", +"020020000013012014015014009010017017016000020020", +"020020007007014015015015015008005016017003020020", +"020000002015015015015015015015015014005010000020", +"020000008008008008008008008008008008008001000020", +"020020020020020020020020020020020020020020020020" +}; diff --git a/Source/WXDialog/CMakeLists.txt b/Source/WXDialog/CMakeLists.txt new file mode 100644 index 0000000..80c5212 --- /dev/null +++ b/Source/WXDialog/CMakeLists.txt @@ -0,0 +1,93 @@ +##--------------------------------------------------------------------------- +## $RCSfile$ +## $Source$ +## $Revision$ +## $Date$ +##--------------------------------------------------------------------------- +## Author: Jorgen Bodde +## Copyright: (c) Jorgen Bodde +## License: wxWidgets License +##--------------------------------------------------------------------------- + + +#wxWidgets build related stuff +SET(WXW_USE_DEBUG OFF) +SET(WXW_USE_UNICODE OFF) +SET(WXW_USE_SHARED OFF) +SET(WXW_USE_UNIV OFF) +SET(WXW_USE_MONO OFF) +SET(WXW_FILE_VERSION "26") +SET(WXW_VERSION "2.6") + +#CMake Options +SET(CMAKE_VERBOSE_MAKEFILE TRUE) + +IF(WIN32) + INCLUDE (${CMAKE_SOURCE_DIR}/Source/WXDialog/bin/FindwxW.cmake) +ELSE(WIN32) + INCLUDE (${CMAKE_SOURCE_DIR}/Source/WXDialog/bin/FindwxWin.cmake) + + # sync flags + SET(WXWIDGETS_FOUND ${WXWINDOWS_FOUND}) + SET(WXWIDGETS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR}) + SET(WXWIDGETS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES}) + SET(WXWIDGETS_LIBRARIES ${WXWINDOWS_LIBRARIES}) +ENDIF(WIN32) + +# Old find script + +## Start using wx stuff when it is fully found and set +IF(WXWIDGETS_FOUND) + + SET (CMAKE_SRCS + CMakeSetupFrame.cpp + CMakeSetup.cpp + CMakeSetupFrame.h + CMakeSetup.h + PropertyList.cpp + PropertyList.h + app_resources.cpp + app_resources.h + progressdlg.cpp + progressdlg.h + aboutdlg.cpp + aboutdlg.h + optionsdlg.cpp + optionsdlg.h + config.h + CommandLineInfo.cpp + CommandLineInfo.h ) + + # include .rc when windows + + IF(WIN32) + SET ( CMAKE_SRCS + ${CMAKE_SRCS} + CMakeSetup.rc ) + ENDIF(WIN32) + + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/Source/WXDialog + ${WXWIDGETS_INCLUDE_DIR}) + LINK_DIRECTORIES( ${WXWIDGETS_LINK_DIRECTORIES} ${CMake_BINARY_DIR}/Source ${CMake_BINARY_DIR}/Source/kwsys ) + + ADD_EXECUTABLE(WXDialog WIN32 ${CMAKE_SRCS}) + + SET(CMAKE_CXX_FLAGS "${CMAKE_WX_CXX_FLAGS}") + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__WXDEBUG__ -DWXDEBUG=1") + + IF(LINUX) + ADD_DEFINITIONS( -DLINUX=1 ) + ENDIF(LINUX) + + # if the checkbox view functionality is not desired, + # exclude this part from the sample + + TARGET_LINK_LIBRARIES(WXDialog ${WXWIDGETS_LIBRARIES} cmsys CMakeLib) + + # if UPX is found, make a target + + #INCLUDE (${CMAKE_SOURCE_DIR}/Source/WXDialog/bin/FindUPX.cmake) + #IF(UPX_FOUND) + #END(UPX_FOUND) + +ENDIF(WXWIDGETS_FOUND) diff --git a/Source/WXDialog/CMakeSetup.cpp b/Source/WXDialog/CMakeSetup.cpp new file mode 100644 index 0000000..8816461 --- /dev/null +++ b/Source/WXDialog/CMakeSetup.cpp @@ -0,0 +1,120 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma implementation "CMakeSetup.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +////@begin includes +////@end includes + +#include + +#include "cmSystemTools.h" +#include "CommandLineInfo.h" + +#include "CMakeSetup.h" +#include "CMakeSetupFrame.h" + +////@begin XPM images +////@end XPM images + +/*! + * Application instance implementation + */ + +////@begin implement app +IMPLEMENT_APP( CMakeSetupApp ) +////@end implement app + +/*! + * CMakeSetupApp type definition + */ + +IMPLEMENT_CLASS( CMakeSetupApp, wxApp ) + +/*! + * CMakeSetupApp event table definition + */ + +BEGIN_EVENT_TABLE( CMakeSetupApp, wxApp ) + +////@begin CMakeSetupApp event table entries +////@end CMakeSetupApp event table entries + +END_EVENT_TABLE() + +/*! + * Constructor for CMakeSetupApp + */ + +CMakeSetupApp::CMakeSetupApp() +{ +////@begin CMakeSetupApp member initialisation +////@end CMakeSetupApp member initialisation +} + +/*! + * Initialisation for CMakeSetupApp + */ + +bool CMakeSetupApp::OnInit() +{ + cmSystemTools::DisableRunCommandOutput(); + + // parse command line params + cmCommandLineInfo cm; + cm.SetValidArguments("ABGHQ"); + cm.ParseCommandLine(wxApp::argc, wxApp::argv); + + // set vendor name and app for config + SetVendorName("Kitware"); + SetAppName("CMakeSetup"); + + CMakeSetupFrm *MyFrame = new CMakeSetupFrm(NULL); + + // alternative app path way, somehow otherwise it does not work + wxFileName fname(argv[0]); + MyFrame->DoInitFrame(cm, fname.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME)); + MyFrame->Show(TRUE); + + return true; +} + +/*! + * Cleanup for CMakeSetupApp + */ +int CMakeSetupApp::OnExit() +{ +////@begin CMakeSetupApp cleanup + return wxApp::OnExit(); +////@end CMakeSetupApp cleanup +} + diff --git a/Source/WXDialog/CMakeSetup.h b/Source/WXDialog/CMakeSetup.h new file mode 100644 index 0000000..df1cc77 --- /dev/null +++ b/Source/WXDialog/CMakeSetup.h @@ -0,0 +1,92 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef _CMAKESETUP_H_ +#define _CMAKESETUP_H_ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "CMakeSetup.cpp" +#endif + +/*! + * Includes + */ + +////@begin includes +#include "wx/image.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +////@end control identifiers + +/*! + * CMakeSetupApp class declaration + */ + +class CMakeSetupApp: public wxApp +{ + DECLARE_CLASS( CMakeSetupApp ) + DECLARE_EVENT_TABLE() + +public: + /// Constructor + CMakeSetupApp(); + + /// Initialises the application + virtual bool OnInit(); + + /// Called on exit + virtual int OnExit(); + +////@begin CMakeSetupApp event handler declarations + +////@end CMakeSetupApp event handler declarations + +////@begin CMakeSetupApp member function declarations + +////@end CMakeSetupApp member function declarations + +////@begin CMakeSetupApp member variables +////@end CMakeSetupApp member variables + +private: + wxString m_AppPath; +}; + +/*! + * Application instance declaration + */ + +////@begin declare app +DECLARE_APP(CMakeSetupApp) +////@end declare app + +#endif + // _CMAKESETUP_H_ diff --git a/Source/WXDialog/CMakeSetup.pjd b/Source/WXDialog/CMakeSetup.pjd new file mode 100644 index 0000000..0dd9543 --- /dev/null +++ b/Source/WXDialog/CMakeSetup.pjd @@ -0,0 +1,3513 @@ + + + + 1.0 + dialogblocks + + Project File + + + 0 + + + + + 87 + + FALSE + FALSE + FALSE + TRUE + TRUE + FALSE + Jorgen Bodde + + + FALSE + <All platforms> + <Any> + ///////////////////////////////////////////////////////////////////////////// +// Name: %HEADER-FILENAME% +// Purpose: +// Author: %AUTHOR% +// Modified by: +// Created: %DATE% +// RCS-ID: +// Copyright: %COPYRIGHT% +// Licence: +///////////////////////////////////////////////////////////////////////////// + + + ///////////////////////////////////////////////////////////////////////////// +// Name: %SOURCE-FILENAME% +// Purpose: +// Author: %AUTHOR% +// Modified by: +// Created: %DATE% +// RCS-ID: +// Copyright: %COPYRIGHT% +// Licence: +///////////////////////////////////////////////////////////////////////////// + + + /*! + * %BODY% + */ + + + ///////////////////////////////////////////////////////////////////////////// +// Name: %SYMBOLS-FILENAME% +// Purpose: Symbols file +// Author: %AUTHOR% +// Modified by: +// Created: %DATE% +// RCS-ID: +// Copyright: %COPYRIGHT% +// Licence: +///////////////////////////////////////////////////////////////////////////// + + + app_resources.h + app_resources.cpp + AppResources + app.h + app.cpp + Application + FALSE + + <None> + + + 14941224 + data-document + + + 0 + 1 + 0 + 0 + 0 + + Configurations + 14901752 + config-data-document + + + 0 + 1 + 0 + 14941224 + 0 + + TRUE + + Debug + ANSI + Static + Modular + GUI + wxMSW + Dynamic + Yes + No + No + %WXVERSION% + %EXECUTABLE% + + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + %AUTO% + + + + Projects + 14941112 + root-document + + project + 1 + 1 + 0 + 0 + 0 + + Windows + 14970776 + html-document + + dialogsfolder + 1 + 1 + 0 + 14941112 + 1 + + CMakeSetupApp + 14557712 + dialog-document + + app + 0 + 1 + 0 + 14970776 + 0 + 7/4/2005 + wbAppProxy + 10000 + FALSE + + CMakeSetupApp + wxApp + CMakeSetup.cpp + CMakeSetup.h + + + + + CMake Setup + 14557936 + dialog-document + + frame + 0 + 1 + 0 + 14970776 + 0 + 7/4/2005 + wbFrameProxy + 10100 + FALSE + + wxEVT_CLOSE_WINDOW|OnCloseWindow + ID_FRAME + 10100 + CMakeSetupFrm + wxFrame + CMakeSetupFrame.cpp + CMakeSetupFrame.h + + CMake Setup v2.0.x + TRUE + cmake_icon.xpm + FALSE + + + + + + FALSE + <Any platform> + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + FALSE + + FALSE + FALSE + -1 + -1 + 600 + 550 + + + wxSplitterWindow: ID_SPLITTERWINDOW + 15131328 + dialog-control-document + + splitter + 0 + 1 + 0 + 14557936 + 0 + 7/4/2005 + wbSplitterWindowProxy + wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING|OnSplitterPosChanging + wxEVT_COMMAND_SPLITTER_DOUBLECLICKED|OnSplitterwindowSashDClick + ID_SPLITTERWINDOW + 10101 + wxSplitterWindow + wxSplitterWindow + m_splitter + TRUE + Horizontal + 300 + + + + + + FALSE + <Any platform> + TRUE + FALSE + TRUE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + 100 + 100 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + wxPanel: ID_MAINPANEL + 15012400 + dialog-control-document + + panel + 0 + 1 + 0 + 15131328 + 0 + 7/4/2005 + wbPanelProxy + ID_MAINPANEL + 10102 + wxPanel + wxPanel + + FALSE + + + + + + FALSE + <Any platform> + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + TRUE + FALSE + + TRUE + -1 + -1 + 600 + 400 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + TRUE + + + + + wxBoxSizer V + 15305752 + dialog-control-document + + sizer + 0 + 1 + 0 + 15012400 + 0 + 7/4/2005 + wbBoxSizerProxy + Vertical + + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + wxBoxSizer H + 15063344 + dialog-control-document + + sizer + 0 + 1 + 0 + 15305752 + 0 + 7/4/2005 + wbBoxSizerProxy + Horizontal + + Expand + Centre + 0 + 5 + FALSE + FALSE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + wxFlexGridSizer + 15010096 + dialog-control-document + + sizer + 0 + 1 + 0 + 15063344 + 0 + 7/4/2005 + wbFlexGridSizerProxy + 1 + 1 + 3 + 2 + 0 + 0 + + <Any platform> + Centre + Top + 1 + 5 + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + wxStaticText: wxID_STATIC + 15060672 + dialog-control-document + + statictext + 0 + 1 + 0 + 15010096 + 0 + 7/4/2005 + wbStaticTextProxy + wxID_STATIC + 5105 + wxStaticText + + CMake project path + + + + + + FALSE + <Any platform> + + + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Left + Centre + 0 + 5 + TRUE + TRUE + FALSE + FALSE + FALSE + TRUE + FALSE + + + + + wxTextCtrl: ID_PROJECT_PATH + 15158408 + dialog-control-document + + textctrl + 0 + 1 + 0 + 15010096 + 0 + 7/4/2005 + wbTextCtrlProxy + ID_PROJECT_PATH + 10103 + wxTextCtrl + m_cmProjectPath + + + + + + + FALSE + <Any platform> + + + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + 50 + -1 + Expand + Centre + 1 + 5 + FALSE + FALSE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxButton: ID_BROWSE_PROJECT + 15128288 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 15010096 + 0 + 7/4/2005 + wbButtonProxy + wxEVT_COMMAND_BUTTON_CLICKED|OnButtonBrowseProject + ID_BROWSE_PROJECT + 10104 + wxButton + m_BrowseProjectPathButton + Browse + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + 55 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxStaticText: wxID_STATIC + 15128064 + dialog-control-document + + statictext + 0 + 1 + 0 + 15010096 + 0 + 7/4/2005 + wbStaticTextProxy + wxID_STATIC + 5105 + wxStaticText + + Project build path + + + + + + FALSE + <Any platform> + + + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Left + Centre + 0 + 5 + TRUE + TRUE + FALSE + FALSE + FALSE + TRUE + FALSE + + + + + wxTextCtrl: ID_SOURCE_BUILD_PATH + 14975400 + dialog-control-document + + textctrl + 0 + 1 + 0 + 15010096 + 0 + 7/4/2005 + wbTextCtrlProxy + wxEVT_COMMAND_TEXT_UPDATED|OnSourceBuildPathUpdated + wxEVT_COMMAND_TEXT_ENTER|OnSourceBuildPathEnter + ID_SOURCE_BUILD_PATH + 10105 + wxTextCtrl + m_cmBuildPath + + + + + + + FALSE + <Any platform> + + + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + 50 + -1 + Expand + Top + 1 + 5 + FALSE + FALSE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxButton: ID_BROWSE_BUILD + 15219840 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 15010096 + 0 + 7/4/2005 + wbButtonProxy + wxEVT_COMMAND_BUTTON_CLICKED|OnButtonBrowseBuild + ID_BROWSE_BUILD + 10106 + wxButton + m_BrowseSourcePathButton + Browse + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + 55 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + + wxBoxSizer V + 15219616 + dialog-control-document + + sizer + 0 + 1 + 0 + 15063344 + 0 + 7/4/2005 + wbBoxSizerProxy + Vertical + + Centre + Expand + 0 + 5 + TRUE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + <Any platform> + + wxFlexGridSizer + 15024832 + dialog-control-document + + sizer + 0 + 1 + 0 + 15219616 + 0 + 21/4/2005 + wbFlexGridSizerProxy + + + 2 + 2 + 0 + 0 + + <Any platform> + Centre + Centre + 0 + 5 + TRUE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + + wxStaticText: wxID_STATIC + 15170512 + dialog-control-document + + statictext + 0 + 1 + 0 + 15024832 + 0 + 28/4/2005 + wbStaticTextProxy + wxID_STATIC + 5105 + wxStaticText + + Generate + + + + + + FALSE + <Any platform> + + + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Left + Centre + 0 + 5 + FALSE + TRUE + FALSE + FALSE + FALSE + TRUE + FALSE + + + + + wxComboBox: ID_CHOOSE_GENERATOR + 15214776 + dialog-control-document + + combobox + 0 + 1 + 0 + 15024832 + 0 + 28/4/2005 + wbComboBoxProxy + ID_CHOOSE_GENERATOR + 10107 + wxComboBox + m_cmGeneratorChoice + + + + + + + + FALSE + <Any platform> + + + FALSE + FALSE + TRUE + FALSE + FALSE + + -1 + -1 + 170 + -1 + Centre + Expand + 1 + 5 + FALSE + FALSE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxStaticText: wxID_STATIC + 15214552 + dialog-control-document + + statictext + 0 + 1 + 0 + 15024832 + 0 + 21/4/2005 + wbStaticTextProxy + wxID_STATIC + 5105 + wxStaticText + + Search + + + + + + FALSE + <Any platform> + + + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Left + Centre + 0 + 5 + FALSE + TRUE + FALSE + FALSE + FALSE + TRUE + FALSE + + + + + wxComboBox: ID_SEARCHQUERY + 15160272 + dialog-control-document + + combobox + 0 + 1 + 0 + 15024832 + 0 + 21/4/2005 + wbComboBoxProxy + wxEVT_COMMAND_COMBOBOX_SELECTED|OnSearchquerySelected + wxEVT_COMMAND_TEXT_UPDATED|OnSearchqueryUpdated + ID_SEARCHQUERY + 10109 + wxComboBox + m_cmSearchQuery + + + + + + + + FALSE + <Any platform> + + + FALSE + FALSE + FALSE + FALSE + TRUE + + -1 + -1 + 170 + -1 + Centre + Expand + 1 + 5 + FALSE + FALSE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + + wxCheckBox: ID_SHOW_ADVANCED + 15194888 + dialog-control-document + + checkbox + 0 + 1 + 0 + 15219616 + 0 + 7/4/2005 + wbCheckBoxProxy + wxEVT_COMMAND_CHECKBOX_CLICKED|OnShowAdvancedValues + ID_SHOW_ADVANCED + 10108 + wxCheckBox + m_cmShowAdvanced + Show advanced values + FALSE + + + + + + + + FALSE + <Any platform> + FALSE + TRUE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Right + Centre + 0 + 5 + TRUE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + + + + + + + wxGrid: ID_OPTIONS + 15160048 + dialog-control-document + + grid + 0 + 1 + 0 + 15305752 + 0 + 7/4/2005 + wbGridProxy + wxEVT_GRID_CELL_CHANGE|OnCellChange + wxEVT_GRID_SELECT_CELL|OnGridSelectCell + wxEVT_MOTION|OnPropertyMotion + ID_OPTIONS + 10110 + wxPropertyList + wxGrid + m_cmOptions + TRUE + 10 + 2 + 250 + 25 + 20 + 0 + Rows + + + + + + FALSE + <Any platform> + + + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + TRUE + FALSE + FALSE + TRUE + FALSE + + -1 + -1 + 200 + 150 + Expand + Centre + 1 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + + + wxPanel: ID_LOGPANEL + 15305304 + dialog-control-document + + panel + 0 + 1 + 0 + 15131328 + 0 + 7/4/2005 + wbPanelProxy + ID_LOGPANEL + 10111 + wxPanel + wxPanel + + FALSE + + + + + + FALSE + <Any platform> + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + FALSE + + TRUE + -1 + -1 + -1 + 100 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + TRUE + + + + + wxBoxSizer V + 15274912 + dialog-control-document + + sizer + 0 + 1 + 0 + 15305304 + 0 + 7/4/2005 + wbBoxSizerProxy + Vertical + + Centre + Centre + 1 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + wxBoxSizer H + 15282864 + dialog-control-document + + sizer + 0 + 1 + 0 + 15274912 + 0 + 8/4/2005 + wbBoxSizerProxy + Horizontal + + Expand + Centre + 1 + 5 + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + FALSE + <Any platform> + + wxTextCtrl: ID_LOG_AREA + 15291488 + dialog-control-document + + textctrl + 0 + 1 + 0 + 15282864 + 0 + 8/4/2005 + wbTextCtrlProxy + ID_LOG_AREA + 10112 + wxTextCtrl + m_cmLog + Select your project path (where CMakeLists.txt is) and then select the build path (where the projects should be saved), or select a previous build path. + +Right click on a cache value for additional options (delete and ignore). Press configure to update and display new values in red, press OK to generate the projects and exit. + + + + + + FALSE + <Any platform> + + + TRUE + FALSE + FALSE + FALSE + TRUE + FALSE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + + -1 + -1 + -1 + -1 + Expand + Expand + 1 + 5 + FALSE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + + + + + wxTextCtrl: ID_DESCRIPTION + 31865312 + dialog-control-document + + textctrl + 0 + 1 + 0 + 15282864 + 0 + 8/4/2005 + wbTextCtrlProxy + ID_DESCRIPTION + 10113 + wxTextCtrl + m_cmDescription + + + + + + + FALSE + <Any platform> + + + TRUE + FALSE + FALSE + FALSE + TRUE + FALSE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + + -1 + -1 + 200 + -1 + Centre + Expand + 0 + 5 + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + + + + + wxBoxSizer H + 31885600 + dialog-control-document + + sizer + 0 + 1 + 0 + 15274912 + 0 + 7/4/2005 + wbBoxSizerProxy + Horizontal + + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + wxButton: ID_DO_CONFIGURE + 31891896 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 31885600 + 0 + 7/4/2005 + wbButtonProxy + wxEVT_COMMAND_BUTTON_CLICKED|OnButtonConfigure + ID_DO_CONFIGURE + 10114 + wxButton + m_ConfigureButton + Co&nfigure + TRUE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxButton: ID_DO_OK + 31906136 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 31885600 + 0 + 7/4/2005 + wbButtonProxy + wxEVT_COMMAND_BUTTON_CLICKED|OnButtonOk + ID_DO_OK + 10115 + wxButton + m_OkButton + &Generate! + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxButton: ID_DO_CANCEL + 31920296 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 31885600 + 0 + 23/4/2005 + wbButtonProxy + wxEVT_COMMAND_BUTTON_CLICKED|OnButtonCancel + ID_DO_CANCEL + 10116 + wxButton + m_CancelButton + C&ancel + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxStaticLine: wxID_STATIC + 31934496 + dialog-control-document + + staticline + 0 + 1 + 0 + 31885600 + 0 + 23/4/2005 + wbStaticLineProxy + wxID_STATIC + 5105 + wxStaticLine + + + + + FALSE + __WXMSW__ + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Expand + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + wxButton: ID_DO_DELETE_CACHE + 31947384 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 31885600 + 0 + 8/4/2005 + wbButtonProxy + wxEVT_COMMAND_BUTTON_CLICKED|OnButtonDeleteCache + ID_DO_DELETE_CACHE + 10117 + wxButton + m_DeleteCacheButton + &Delete Cache + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxButton: ID_CLEAR_LOG + 31961512 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 31885600 + 0 + 23/4/2005 + wbButtonProxy + wxEVT_COMMAND_BUTTON_CLICKED|OnClearLogClick + ID_CLEAR_LOG + 10118 + wxButton + m_ClearLogButton + Clear &Log + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxStaticLine: wxID_STATIC + 31975712 + dialog-control-document + + staticline + 0 + 1 + 0 + 31885600 + 0 + 23/4/2005 + wbStaticLineProxy + wxID_STATIC + 5105 + wxStaticLine + + + + + FALSE + __WXMSW__ + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Expand + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + wxButton: ID_BROWSE_GRID + 31988648 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 31885600 + 0 + 23/4/2005 + wbButtonProxy + wxEVT_COMMAND_BUTTON_CLICKED|OnBrowseGridClick + ID_BROWSE_GRID + 10119 + wxButton + m_cmBrowseCell + &Browse + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + + + + + wxStatusBar: ID_STATUSBAR + 15169112 + dialog-control-document + + statusbar + 0 + 1 + 0 + 14557936 + 0 + 7/4/2005 + wbStatusBarProxy + ID_STATUSBAR + 10120 + wxStatusBar + + + + + + + FALSE + <Any platform> + 2 + + + TRUE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxMenuBar: ID_CMAKE_MENUBAR + 31891672 + dialog-control-document + + menubar + 0 + 1 + 0 + 14557936 + 0 + 19/4/2005 + wbMenuBarProxy + ID_CMAKE_MENUBAR + <Any platform> + + File + 32012808 + dialog-control-document + + menu + 0 + 1 + 0 + 31891672 + 0 + 19/4/2005 + wbMenuProxy + &File + <Any platform> + + &Reload Cache\tCtrl+R: ID_MENU_RELOAD_CACHE + 32014784 + dialog-control-document + + menuitem + 0 + 1 + 0 + 32012808 + 0 + 19/4/2005 + wbMenuItemProxy + wxEVT_COMMAND_MENU_SELECTED|OnMenuReloadCacheClick + ID_MENU_RELOAD_CACHE + 10122 + &Reload Cache\tCtrl+R + Normal + FALSE + Reload the cache from disk + + <Any platform> + + + &Delete Cache\tCtrl+D: ID_MENU_DELETE_CACHE + 32018496 + dialog-control-document + + menuitem + 0 + 1 + 0 + 32012808 + 0 + 19/4/2005 + wbMenuItemProxy + wxEVT_COMMAND_MENU_SELECTED|OnMenuDeleteCacheClick + ID_MENU_DELETE_CACHE + 10123 + &Delete Cache\tCtrl+D + Normal + FALSE + Delete the cache on disk of the current path + + <Any platform> + + + ------------ + 32022168 + dialog-control-document + + menuitem + 0 + 1 + 0 + 32012808 + 0 + 19/4/2005 + wbMenuSeparatorProxy + <Any platform> + + + E&xit\tAlt+F4: ID_MENU_QUIT + 32023984 + dialog-control-document + + menuitem + 0 + 1 + 0 + 32012808 + 0 + 19/4/2005 + wbMenuItemProxy + wxEVT_COMMAND_MENU_SELECTED|OnMenuQuitClick + ID_MENU_QUIT + 10125 + E&xit\tAlt+F4 + Normal + FALSE + Quit CMake Setup + + <Any platform> + + + + Tools + 32027696 + dialog-control-document + + menu + 0 + 1 + 0 + 31891672 + 0 + 29/4/2005 + wbMenuProxy + &Tools + <Any platform> + + &Configure\tCtrl+N: ID_MENU_CONFIGURE + 32029440 + dialog-control-document + + menuitem + 0 + 1 + 0 + 32027696 + 0 + 31/4/2005 + wbMenuItemProxy + wxEVT_COMMAND_MENU_SELECTED|OnMenuConfigureClick + ID_MENU_CONFIGURE + 10126 + &Configure\tCtrl+N + Normal + FALSE + + + <Any platform> + + + &Generate and Exit\tCtrl+G: ID_MENU_EXITGENERATE + 32033160 + dialog-control-document + + menuitem + 0 + 1 + 0 + 32027696 + 0 + 31/4/2005 + wbMenuItemProxy + wxEVT_COMMAND_MENU_SELECTED|OnMenuGenerateClick + ID_MENU_EXITGENERATE + 10127 + &Generate and Exit\tCtrl+G + Normal + FALSE + + + <Any platform> + + + Toggle &Advanced\tCtrl+A: ID_MENU_TOGGLE_ADVANCED + 15388832 + dialog-control-document + + menuitem + 0 + 1 + 0 + 32027696 + 0 + 31/4/2005 + wbMenuItemProxy + wxEVT_COMMAND_MENU_SELECTED|OnMenuToggleAdvancedClick + ID_MENU_TOGGLE_ADVANCED + 10128 + Toggle &Advanced\tCtrl+A + Normal + FALSE + + + <Any platform> + + + ------------ + 32036848 + dialog-control-document + + menuitem + 0 + 1 + 0 + 32027696 + 0 + 31/4/2005 + wbMenuSeparatorProxy + <Any platform> + + + &Options\tCtrl+O: ID_CMAKE_OPTIONS + 32038704 + dialog-control-document + + menuitem + 0 + 1 + 0 + 32027696 + 0 + 31/4/2005 + wbMenuItemProxy + wxEVT_COMMAND_MENU_SELECTED|OnOptionsClick + ID_CMAKE_OPTIONS + 10124 + &Options\tCtrl+O + Normal + FALSE + + + <Any platform> + + + + Help + 32042336 + dialog-control-document + + menu + 0 + 1 + 0 + 31891672 + 0 + 29/4/2005 + wbMenuProxy + &Help + <Any platform> + + &About ...: ID_ABOUTDLG + 32044160 + dialog-control-document + + menuitem + 0 + 1 + 0 + 32042336 + 0 + 29/4/2005 + wbMenuItemProxy + wxEVT_COMMAND_MENU_SELECTED|OnAboutClick + ID_ABOUTDLG + 10121 + &About ... + Normal + FALSE + Shows the about dialog ... + + <Any platform> + + + + + + CachePopupMenu + 14983520 + dialog-document + + menu + 0 + 1 + 0 + 14970776 + 0 + wbStandaloneMenuProxy + 10050 + FALSE + + ID_MENU + CreatePopupMenu + <Any platform> + + &Ignore cache entry: ID_CACHE_IGNORE + 32048400 + dialog-control-document + + menuitem + 0 + 1 + 0 + 14983520 + 0 + 16/4/2005 + wbMenuItemProxy + ID_CACHE_IGNORE + 10051 + &Ignore cache entry + Normal + FALSE + Ignores the value of the current cache entry + + <Any platform> + + + &Delete cache entry: ID_CACHE_DELETE + 32052016 + dialog-control-document + + menuitem + 0 + 1 + 0 + 14983520 + 0 + 16/4/2005 + wbMenuItemProxy + ID_CACHE_DELETE + 10052 + &Delete cache entry + Normal + FALSE + Deletes the current cache entry (reverts on next configure) + + <Any platform> + + + ------------ + 32055608 + dialog-control-document + + menuitem + 0 + 1 + 0 + 14983520 + 0 + 23/4/2005 + wbMenuSeparatorProxy + <Any platform> + + + &Browse ...: ID_CACHE_BROWSE + 32057208 + dialog-control-document + + menuitem + 0 + 1 + 0 + 14983520 + 0 + 23/4/2005 + wbMenuItemProxy + ID_CACHE_BROWSE + 10053 + &Browse ... + Normal + FALSE + + + <Any platform> + + + + Progress Dialog + 32060872 + dialog-document + + dialog + 0 + 1 + 0 + 14970776 + 0 + 27/4/2005 + wbDialogProxy + 10000 + FALSE + + ID_PROGRESSDLG + 10000 + CMProgressDialog + wxDialog + wxDialog + progressdlg.cpp + progressdlg.h + + Progress Dialog + TRUE + + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + + FALSE + TRUE + -1 + -1 + 400 + 300 + + + wxBoxSizer V + 32078568 + dialog-control-document + + sizer + 0 + 1 + 0 + 32060872 + 0 + wbBoxSizerProxy + Vertical + + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + Spacer + 32086456 + dialog-control-document + + spacer + 0 + 1 + 0 + 32078568 + 0 + 27/4/2005 + wbSpacerProxy + 5 + 5 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + + wxStaticText: wxID_STATIC + 32093136 + dialog-control-document + + statictext + 0 + 1 + 0 + 32078568 + 0 + 27/4/2005 + wbStaticTextProxy + wxID_STATIC + 5105 + wxStaticText + m_textMessage + Please wait while CMake configures ... + + + + + + FALSE + <Any platform> + + + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + TRUE + FALSE + + + + + wxBoxSizer H + 32109792 + dialog-control-document + + sizer + 0 + 1 + 0 + 32078568 + 0 + 27/4/2005 + wbBoxSizerProxy + Horizontal + + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + wxGauge: ID_CMAKE_PROGRESS + 32116776 + dialog-control-document + + gauge + 0 + 1 + 0 + 32109792 + 0 + 27/4/2005 + wbGaugeProxy + ID_CMAKE_PROGRESS + 10001 + wxGauge + m_progress + 0 + 100 + + + + + + FALSE + <Any platform> + + + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + 250 + 20 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + + wxButton: ID_CMAKE_BUTTON + 32133864 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 32078568 + 0 + 27/4/2005 + wbButtonProxy + wxEVT_COMMAND_BUTTON_CLICKED|OnCmakeCancelClick + ID_CMAKE_BUTTON + 10002 + wxButton + + &Cancel + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + Spacer + 32133640 + dialog-control-document + + spacer + 0 + 1 + 0 + 32078568 + 0 + 27/4/2005 + wbSpacerProxy + 5 + 5 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + FALSE + <Any platform> + + + + + About ... + 15183080 + dialog-document + + dialog + 0 + 1 + 0 + 14970776 + 0 + 27/4/2005 + wbDialogProxy + 10000 + FALSE + + ID_SOME_ABOUTDLG + 10003 + CMAboutDlg + wxDialog + wxDialog + aboutdlg.cpp + aboutdlg.h + + About ... + TRUE + + FALSE + + + + + + FALSE + <Any platform> + FALSE + TRUE + TRUE + FALSE + TRUE + FALSE + FALSE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + + FALSE + TRUE + -1 + -1 + 400 + 300 + + + wxBoxSizer V + 32168512 + dialog-control-document + + sizer + 0 + 1 + 0 + 15183080 + 0 + wbBoxSizerProxy + Vertical + + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + wxFlexGridSizer + 32176768 + dialog-control-document + + sizer + 0 + 1 + 0 + 32168512 + 0 + 28/4/2005 + wbFlexGridSizerProxy + 1 + 0 + 2 + 1 + 0 + 0 + + <Any platform> + Expand + Centre + 1 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + wxStaticBitmap: wxID_STATIC + 32187248 + dialog-control-document + + staticbitmap + 0 + 1 + 0 + 32176768 + 0 + 28/4/2005 + wbStaticBitmapProxy + wxID_STATIC + 5105 + wxStaticBitmap + m_cmIcon + + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + 32 + 32 + Centre + Top + 0 + 5 + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + FALSE + + + + + wxHtmlWindow: ID_HTMLWINDOW + 32186448 + dialog-control-document + + htmlwindow + 0 + 1 + 0 + 32176768 + 0 + 28/4/2005 + wbHtmlWindowProxy + ID_HTMLWINDOW + 10000 + wxHtmlWindow + m_html + + + + + + + + FALSE + <Any platform> + + + FALSE + TRUE + FALSE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + TRUE + FALSE + + -1 + -1 + 500 + 300 + Expand + Expand + 1 + 5 + FALSE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + + wxButton: ID_ABOUT_DLG_OK + 32218992 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 32168512 + 0 + 28/4/2005 + wbButtonProxy + wxEVT_COMMAND_BUTTON_CLICKED|OnAboutDlgClick + ID_ABOUT_DLG_OK + 10005 + wxButton + + &Ok + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + + + CMakeSetup Options ... + 32218768 + dialog-document + + dialog + 0 + 1 + 0 + 14970776 + 0 + 29/4/2005 + wbDialogProxy + 10000 + FALSE + + ID_DIALOG + 10004 + CMOptionsDlg + wxDialog + wxDialog + optionsdlg.cpp + optionsdlg.h + + CMakeSetup Options ... + TRUE + + FALSE + + + + + + FALSE + <Any platform> + FALSE + TRUE + TRUE + FALSE + TRUE + FALSE + FALSE + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + + FALSE + FALSE + -1 + -1 + 400 + 300 + + + wxBoxSizer V + 32246976 + dialog-control-document + + sizer + 0 + 1 + 0 + 32218768 + 0 + wbBoxSizerProxy + Vertical + + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + wxNotebook: ID_NOTEBOOK + 32255440 + dialog-control-document + + notebook + 0 + 1 + 0 + 32246976 + 0 + 29/4/2005 + wbNotebookProxy + ID_NOTEBOOK + 10006 + wxNotebook + + FALSE + + + + + + FALSE + <Any platform> + + + TRUE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Expand + Centre + 1 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + TRUE + + + + wxPanel: ID_PANEL + 32276584 + dialog-control-document + + panel + 0 + 1 + 0 + 32255440 + 0 + 29/4/2005 + wbPanelProxy + ID_PANEL + 10007 + wxPanel + wxPanel + + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + TRUE + FALSE + FALSE + + TRUE + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + General + + + wxBoxSizer V + 32296720 + dialog-control-document + + sizer + 0 + 1 + 0 + 32276584 + 0 + 29/4/2005 + wbBoxSizerProxy + Vertical + + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + Spacer + 32304784 + dialog-control-document + + spacer + 0 + 1 + 0 + 32296720 + 0 + 29/4/2005 + wbSpacerProxy + 5 + 5 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + + wxCheckBox: ID_CHECKBOX_CLOSECMAKE + 32443856 + dialog-control-document + + checkbox + 0 + 1 + 0 + 32296720 + 0 + 29/4/2005 + wbCheckBoxProxy + wxEVT_COMMAND_CHECKBOX_CLICKED|OnButtonOK + ID_CHECKBOX_CLOSECMAKE + 10008 + wxCheckBox + m_closeAfterGenerate + Close down CMakeSetup after generation of project + FALSE + + + + + + + + FALSE + <Any platform> + FALSE + TRUE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Left + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + + + + wxBoxSizer H + 32442960 + dialog-control-document + + sizer + 0 + 1 + 0 + 32246976 + 0 + 29/4/2005 + wbBoxSizerProxy + Horizontal + + Centre + Centre + 0 + 5 + TRUE + TRUE + FALSE + TRUE + FALSE + FALSE + FALSE + <Any platform> + + wxButton: wxID_OK + 32459328 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 32442960 + 0 + 29/4/2005 + wbButtonProxy + wxID_OK + 5100 + wxButton + + &OK + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + wxButton: wxID_CANCEL + 32473152 + dialog-control-document + + dialogcontrol + 0 + 1 + 0 + 32442960 + 0 + 29/4/2005 + wbButtonProxy + wxID_CANCEL + 5101 + wxButton + + &Cancel + FALSE + + + + + + FALSE + <Any platform> + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + FALSE + + -1 + -1 + -1 + -1 + Centre + Centre + 0 + 5 + TRUE + TRUE + TRUE + TRUE + FALSE + FALSE + FALSE + + + + + + + + + Sources + 15249400 + html-document + + sourcesfolder + 1 + 1 + 0 + 14941112 + 1 + + CMakeSetup.rc + 15249512 + source-editor-document + CMakeSetup.rc + source-editor + 0 + 0 + 1 + 15249400 + 0 + 7/4/2005 + + + + + Images + 32201280 + html-document + + bitmapsfolder + 1 + 1 + 0 + 14941112 + 1 + + NGDialog.ico + 32201456 + image-document + NGDialog.ico + image + 0 + 0 + 0 + 32201280 + 0 + 25/4/2005 + 100 + + + + diff --git a/Source/WXDialog/CMakeSetup.rc b/Source/WXDialog/CMakeSetup.rc new file mode 100644 index 0000000..1cd7ef2 --- /dev/null +++ b/Source/WXDialog/CMakeSetup.rc @@ -0,0 +1,12 @@ +#ifndef APSTUDIO_INVOKED +#include "wx/msw/wx.rc" +#endif + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +DID_AAAAAAA ICON "NGDialog.ico" diff --git a/Source/WXDialog/CMakeSetupFrame.cpp b/Source/WXDialog/CMakeSetupFrame.cpp new file mode 100644 index 0000000..c4072ca --- /dev/null +++ b/Source/WXDialog/CMakeSetupFrame.cpp @@ -0,0 +1,1775 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma implementation "CMakeSetupFrame.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +////@begin includes +////@end includes + +#include +#include +#include + +#include "CMakeSetupFrame.h" +#include "PropertyList.h" +#include "app_resources.h" +#include "CMakeIcon.xpm" +#include "aboutdlg.h" + +// cmake includes +#include "../cmListFileCache.h" +#include "../cmCacheManager.h" +#include "../cmGlobalGenerator.h" +#include "../cmDynamicLoader.h" + +////@begin XPM images +////@end XPM images + +/*! + * CMakeSetupFrm type definition + */ + +IMPLEMENT_CLASS( CMakeSetupFrm, wxFrame ) + +/*! + * CMakeSetupFrm event table definition + */ + +BEGIN_EVENT_TABLE( CMakeSetupFrm, wxFrame ) + +////@begin CMakeSetupFrm event table entries + EVT_CLOSE( CMakeSetupFrm::OnCloseWindow ) + + EVT_SPLITTER_SASH_POS_CHANGING( ID_SPLITTERWINDOW, CMakeSetupFrm::OnSplitterPosChanging ) + EVT_SPLITTER_DCLICK( ID_SPLITTERWINDOW, CMakeSetupFrm::OnSplitterwindowSashDClick ) + + EVT_BUTTON( ID_BROWSE_PROJECT, CMakeSetupFrm::OnButtonBrowseProject ) + + EVT_TEXT( ID_SOURCE_BUILD_PATH, CMakeSetupFrm::OnSourceBuildPathUpdated ) + EVT_TEXT_ENTER( ID_SOURCE_BUILD_PATH, CMakeSetupFrm::OnSourceBuildPathEnter ) + + EVT_BUTTON( ID_BROWSE_BUILD, CMakeSetupFrm::OnButtonBrowseBuild ) + + EVT_COMBOBOX( ID_SEARCHQUERY, CMakeSetupFrm::OnSearchquerySelected ) + EVT_TEXT( ID_SEARCHQUERY, CMakeSetupFrm::OnSearchqueryUpdated ) + + EVT_CHECKBOX( ID_SHOW_ADVANCED, CMakeSetupFrm::OnShowAdvancedValues ) + + EVT_GRID_CELL_CHANGE( CMakeSetupFrm::OnCellChange ) + EVT_GRID_SELECT_CELL( CMakeSetupFrm::OnGridSelectCell ) + EVT_MOTION( CMakeSetupFrm::OnPropertyMotion ) + + EVT_BUTTON( ID_DO_CONFIGURE, CMakeSetupFrm::OnButtonConfigure ) + + EVT_BUTTON( ID_DO_OK, CMakeSetupFrm::OnButtonOk ) + + EVT_BUTTON( ID_DO_CANCEL, CMakeSetupFrm::OnButtonCancel ) + + EVT_BUTTON( ID_DO_DELETE_CACHE, CMakeSetupFrm::OnButtonDeleteCache ) + + EVT_BUTTON( ID_CLEAR_LOG, CMakeSetupFrm::OnClearLogClick ) + + EVT_BUTTON( ID_BROWSE_GRID, CMakeSetupFrm::OnBrowseGridClick ) + + EVT_MENU( ID_MENU_RELOAD_CACHE, CMakeSetupFrm::OnMenuReloadCacheClick ) + + EVT_MENU( ID_MENU_DELETE_CACHE, CMakeSetupFrm::OnMenuDeleteCacheClick ) + + EVT_MENU( ID_MENU_QUIT, CMakeSetupFrm::OnMenuQuitClick ) + + EVT_MENU( ID_MENU_CONFIGURE, CMakeSetupFrm::OnMenuConfigureClick ) + + EVT_MENU( ID_MENU_EXITGENERATE, CMakeSetupFrm::OnMenuGenerateClick ) + + EVT_MENU( ID_MENU_TOGGLE_ADVANCED, CMakeSetupFrm::OnMenuToggleAdvancedClick ) + + EVT_MENU( ID_CMAKE_OPTIONS, CMakeSetupFrm::OnOptionsClick ) + + EVT_MENU( ID_ABOUTDLG, CMakeSetupFrm::OnAboutClick ) + +////@end CMakeSetupFrm event table entries + + EVT_MENU_RANGE(CM_RECENT_BUILD_ITEM, CM_RECENT_BUILD_ITEM + CM_MAX_RECENT_PATHS, CMakeSetupFrm::OnRecentFileMenu) + + EVT_TEXT_ENTER(ID_SEARCHQUERY, CMakeSetupFrm::OnAddQuery ) + +END_EVENT_TABLE() + +/** Callback function for CMake generator, to tell user how + far the generation actually is */ +void updateProgress(const char *msg, float prog, void *cd) +{ + // TODO: Make some kind of progress counter + + CMakeSetupFrm *fm = (CMakeSetupFrm *)cd; + + if(fm) + { + if(prog < 0) + fm->LogMessage(0, msg); + else + { + fm->UpdateProgress(prog); + fm->IssueUpdate(); + } + } +} + +/** Callback function for CMake generator, to tell user about stuff. This should be + logged in the m_log window */ +void MFCMessageCallback(const char* m, const char* title, bool& nomore, void *clientdata) +{ + CMakeSetupFrm *fm = (CMakeSetupFrm *)clientdata; + + if(fm) + { + wxString what = m, msg; + if(what.StartsWith("CMake Error: ")) + fm->LogMessage(-1, m); + else + fm->LogMessage(1, m); + } +} + +// Convert to Win32 path (slashes). This calls the system tools one and then +// removes the spaces. It is not in system tools because we don't want any +// generators accidentally use it +std::string ConvertToWindowsPath(const char* path) +{ + // Convert to output path. + // Remove the "" around it (if any) since it's an output path for + // the shell. If another shell-oriented feature is not designed + // for a GUI use, then we are in trouble. + // save the value of the force to unix path option + bool saveForce = cmSystemTools::GetForceUnixPaths(); + // make sure we get windows paths no matter what for the GUI + cmSystemTools::SetForceUnixPaths(false); + std::string s = cmSystemTools::ConvertToOutputPath(path); + // now restore the force unix path to its previous value + cmSystemTools::SetForceUnixPaths(saveForce); + if (s.size()) + { + std::string::iterator i = s.begin(); + if (*i == '\"') + { + s.erase(i, i + 1); + } + i = s.begin() + s.length() - 1; + if (*i == '\"') + { + s.erase(i, i + 1); + } + } + return s; +} + + +bool DnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames) +{ + size_t nFiles = filenames.GetCount(); + + // only one item allowed + if(nFiles > 1) + return false; + + if(nFiles == 1) + { + // only one dir allowed + if(!wxDirExists(filenames[0])) + return false; + + // strip the seperator + wxFileName name; + name.AssignDir(filenames[0]); + + // issue a 'drop' by changing text ctrl + m_pOwner->SetValue(name.GetFullPath()); + + return true; + } + + return false; +} + +/*! + * CMakeSetupFrm constructors + */ + +CMakeSetupFrm::CMakeSetupFrm( ) + : m_cmake(0) +{ +} + +CMakeSetupFrm::CMakeSetupFrm( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) + : m_cmake(0) +{ + Create( parent, id, caption, pos, size, style ); +} + +/*! + * CMakeSetupFrm creator + */ + +bool CMakeSetupFrm::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ +////@begin CMakeSetupFrm member initialisation + m_splitter = NULL; + m_cmProjectPath = NULL; + m_BrowseProjectPathButton = NULL; + m_cmBuildPath = NULL; + m_BrowseSourcePathButton = NULL; + m_cmGeneratorChoice = NULL; + m_cmSearchQuery = NULL; + m_cmShowAdvanced = NULL; + m_cmOptions = NULL; + m_cmLog = NULL; + m_cmDescription = NULL; + m_ConfigureButton = NULL; + m_OkButton = NULL; + m_CancelButton = NULL; + m_DeleteCacheButton = NULL; + m_ClearLogButton = NULL; + m_cmBrowseCell = NULL; +////@end CMakeSetupFrm member initialisation + + wxFrame::Create( parent, id, caption, pos, size, style ); + + // make sure the developer does not assign more then 100 + // would be rediculous but also overlap other id's + wxASSERT(CM_MAX_RECENT_PATHS < 100); + + m_ExitTimer = 0; + + m_progressDlg = 0; + m_noRefresh = false; + m_quitAfterGenerating = false; + + m_config = new wxConfig("CMakeSetup"); + + wxIcon icon(CMakeIcon_xpm); + SetIcon(icon); + + CreateControls(); + + //SetIcon(GetIconResource(wxT("cmake_icon.xpm"))); + //SetIcon(wxIcon("NGDialog.ico", wxBITMAP_TYPE_ICO_RESOURCE)); + Centre(); + + // is it needed to hide console? + m_RunningConfigure = false; + cmSystemTools::SetRunCommandHideConsole(true); + cmSystemTools::SetErrorCallback(MFCMessageCallback, (void *)this); + + // create our cmake instance + m_cmake = new cmake; + m_cmake->SetProgressCallback(updateProgress, (void *)this); + + return TRUE; +} + +CMakeSetupFrm::~CMakeSetupFrm() +{ + wxString str; + + // write configs back to disk + m_config->Write(CM_LASTPROJECT_PATH, m_cmProjectPath->GetValue()); + m_config->Write(CM_LASTBUILD_PATH, m_cmBuildPath->GetValue()); + + // clear the config first + for(size_t i = 0 ; i < CM_MAX_RECENT_PATHS; i++) + { + str.Printf("%s%i", _(CM_RECENT_BUILD_PATH), i); + m_config->Write(str, _("")); + } + + // write the last CM_MAX_RECENT_PATHS items back to config + int i = (m_recentPaths.Count() >= CM_MAX_RECENT_PATHS ? CM_MAX_RECENT_PATHS : m_recentPaths.Count()); + while(i > 0) + { + str.Printf("%s%i", _(CM_RECENT_BUILD_PATH), i); + m_config->Write(str, m_recentPaths[i - 1]); + i--; + } + + // write recent query list to config + for(int j = 0; j < m_cmSearchQuery->GetCount(); j++) + { + // allow max to be written + if(j < CM_MAX_SEARCH_QUERIES) + { + str.Printf("%s%i", _(CM_SEARCH_QUERY), j); + m_config->Write(str, m_cmSearchQuery->GetString(j)); + } + else + break; + } + + // set window pos + size in settings + if(!IsIconized() && !IsMaximized()) + { + int xsize, ysize; + GetSize(&xsize, &ysize); + if(xsize > 0 && ysize > 0) + { + m_config->Write(CM_XSIZE, (long)xsize); + m_config->Write(CM_YSIZE, (long)ysize); + } + + if(m_splitter->GetSashPosition() > 0) + m_config->Write(CM_SPLITTERPOS, (long)m_splitter->GetSashPosition()); + + GetPosition(&xsize, &ysize); + if(xsize != 0 && ysize != 0) + { + m_config->Write(CM_XPOS, (long)xsize); + m_config->Write(CM_YPOS, (long)ysize); + } + } + + // write changes (will be done before deletion) + delete m_config; + + // delete timer + if(m_ExitTimer) + delete m_ExitTimer; + + // delete our cmake instance again + if(m_cmake) + delete m_cmake; +} + +void CMakeSetupFrm::UpdateWindowState() +{ + bool dogenerate = !m_RunningConfigure && !m_cmOptions->IsCacheDirty() && + (m_cmOptions->GetCount() != 0); + + // when configure is running, disable a lot of stuff + m_cmProjectPath->Enable(!m_RunningConfigure); + m_BrowseProjectPathButton->Enable(!m_RunningConfigure); + m_cmBuildPath->Enable(!m_RunningConfigure); + m_BrowseSourcePathButton->Enable(!m_RunningConfigure); + m_cmGeneratorChoice->Enable(!m_RunningConfigure); + m_cmShowAdvanced->Enable(!m_RunningConfigure); + m_cmOptions->Enable(!m_RunningConfigure); + m_ConfigureButton->Enable(!m_RunningConfigure); + m_OkButton->Enable(dogenerate); + m_CancelButton->Enable(m_RunningConfigure); + m_DeleteCacheButton->Enable(!m_RunningConfigure); + m_ClearLogButton->Enable(!m_RunningConfigure); + if(m_RunningConfigure) + m_cmBrowseCell->Enable(false); + + // when cache loaded (items available show other control) + m_cmGeneratorChoice->Enable(m_cmOptions->GetCount() == 0 && !m_RunningConfigure); + m_cmSearchQuery->Enable(!m_RunningConfigure); + m_cmBrowseCell->Enable(!m_RunningConfigure && m_cmOptions->IsSelectedItemBrowsable()); + + // disable the menus when configuring + if(GetMenuBar()) + { + // disable configure button when there is nothing, and generate and exit + // only when it is allowed to generate + GetMenuBar()->Enable(ID_MENU_EXITGENERATE, dogenerate); + GetMenuBar()->Enable(ID_MENU_CONFIGURE, !m_RunningConfigure); + + for(size_t i = 0; i < GetMenuBar()->GetMenuCount(); i++) + GetMenuBar()->EnableTop(i, !m_RunningConfigure); + } +} + +void CMakeSetupFrm::LogMessage(int logkind, const char *msg) +{ + // put CR first but prevent a CR at the end +#ifndef __LINUX__ + if(m_cmLog->IsModified()) + (*m_cmLog) << wxT("\n"); +#else + // Linux requires a different approach + if(!m_cmLog->GetValue().IsEmpty()) + (*m_cmLog) << wxT("\n"); +#endif + + // log error, warning, or message + wxTextAttr defattr = m_cmLog->GetDefaultStyle(); + + switch(logkind) + { + // user message + case 1: + { + wxTextAttr colattr(*wxBLUE); + m_cmLog->SetDefaultStyle(colattr); + (*m_cmLog) << msg; + m_cmLog->SetDefaultStyle(defattr); + } + break; + + // progress + case 0: + (*m_cmLog) << msg; + break; + + // error + case -1: + { + wxTextAttr colattr(*wxRED); + m_cmLog->SetDefaultStyle(colattr); + (*m_cmLog) << msg; + m_cmLog->SetDefaultStyle(defattr); + } + break; + } + + IssueUpdate(); +} + +void CMakeSetupFrm::IssueUpdate() +{ + //::wxSafeYield(m_CancelButton, true); + ::wxYield(); + + // when we pressed cancel on the progress dialog + // stop all activities + if(m_progressDlg) + { + if(m_progressDlg->CancelPressed() && !m_progressDlg->IsCancelling()) + { + m_progressDlg->CancelAcknowledged(); + + // send a button event to cancel the progress + wxCommandEvent event( wxEVT_COMMAND_BUTTON_CLICKED, ID_DO_CANCEL); + wxPostEvent(this, event); + } + } +} + +/*! + * Control creation for CMakeSetupFrm + */ + +void CMakeSetupFrm::CreateControls() +{ +////@begin CMakeSetupFrm content construction + CMakeSetupFrm* itemFrame1 = this; + + wxMenuBar* menuBar = new wxMenuBar; + wxMenu* itemMenu37 = new wxMenu; + itemMenu37->Append(ID_MENU_RELOAD_CACHE, _("&Reload Cache\tCtrl+R"), _("Reload the cache from disk"), wxITEM_NORMAL); + itemMenu37->Append(ID_MENU_DELETE_CACHE, _("&Delete Cache\tCtrl+D"), _("Delete the cache on disk of the current path"), wxITEM_NORMAL); + itemMenu37->AppendSeparator(); + itemMenu37->Append(ID_MENU_QUIT, _("E&xit\tAlt+F4"), _("Quit CMake Setup"), wxITEM_NORMAL); + menuBar->Append(itemMenu37, _("&File")); + wxMenu* itemMenu42 = new wxMenu; + itemMenu42->Append(ID_MENU_CONFIGURE, _("&Configure\tCtrl+N"), _T(""), wxITEM_NORMAL); + itemMenu42->Append(ID_MENU_EXITGENERATE, _("&Generate and Exit\tCtrl+G"), _T(""), wxITEM_NORMAL); + itemMenu42->Append(ID_MENU_TOGGLE_ADVANCED, _("Toggle &Advanced\tCtrl+A"), _T(""), wxITEM_NORMAL); + itemMenu42->AppendSeparator(); + itemMenu42->Append(ID_CMAKE_OPTIONS, _("&Options\tCtrl+O"), _T(""), wxITEM_NORMAL); + menuBar->Append(itemMenu42, _("&Tools")); + wxMenu* itemMenu48 = new wxMenu; + itemMenu48->Append(ID_ABOUTDLG, _("&About ..."), _("Shows the about dialog ..."), wxITEM_NORMAL); + menuBar->Append(itemMenu48, _("&Help")); + itemFrame1->SetMenuBar(menuBar); + + m_splitter = new wxSplitterWindow( itemFrame1, ID_SPLITTERWINDOW, wxDefaultPosition, wxSize(100, 100), wxSP_3DBORDER|wxSP_3DSASH|wxNO_BORDER ); + + wxPanel* itemPanel3 = new wxPanel( m_splitter, ID_MAINPANEL, wxDefaultPosition, wxSize(600, 400), wxNO_BORDER|wxTAB_TRAVERSAL ); + itemPanel3->SetExtraStyle(itemPanel3->GetExtraStyle()|wxWS_EX_VALIDATE_RECURSIVELY); + wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); + itemPanel3->SetSizer(itemBoxSizer4); + + wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW|wxTOP|wxBOTTOM, 5); + wxFlexGridSizer* itemFlexGridSizer6 = new wxFlexGridSizer(2, 3, 0, 0); + itemFlexGridSizer6->AddGrowableRow(1); + itemFlexGridSizer6->AddGrowableCol(1); + itemBoxSizer5->Add(itemFlexGridSizer6, 1, wxALIGN_TOP|wxLEFT, 5); + wxStaticText* itemStaticText7 = new wxStaticText( itemPanel3, wxID_STATIC, _("CMake project path"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer6->Add(itemStaticText7, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); + + m_cmProjectPath = new wxTextCtrl( itemPanel3, ID_PROJECT_PATH, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + itemFlexGridSizer6->Add(m_cmProjectPath, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); + + m_BrowseProjectPathButton = new wxButton( itemPanel3, ID_BROWSE_PROJECT, _("Browse"), wxDefaultPosition, wxSize(55, -1), 0 ); + itemFlexGridSizer6->Add(m_BrowseProjectPathButton, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxStaticText* itemStaticText10 = new wxStaticText( itemPanel3, wxID_STATIC, _("Project build path"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer6->Add(itemStaticText10, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); + + m_cmBuildPath = new wxTextCtrl( itemPanel3, ID_SOURCE_BUILD_PATH, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + itemFlexGridSizer6->Add(m_cmBuildPath, 1, wxGROW|wxALIGN_TOP|wxTOP|wxBOTTOM, 5); + + m_BrowseSourcePathButton = new wxButton( itemPanel3, ID_BROWSE_BUILD, _("Browse"), wxDefaultPosition, wxSize(55, -1), 0 ); + itemFlexGridSizer6->Add(m_BrowseSourcePathButton, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer5->Add(itemBoxSizer13, 0, wxGROW|wxLEFT|wxRIGHT, 5); + wxFlexGridSizer* itemFlexGridSizer14 = new wxFlexGridSizer(2, 2, 0, 0); + itemBoxSizer13->Add(itemFlexGridSizer14, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 5); + wxStaticText* itemStaticText15 = new wxStaticText( itemPanel3, wxID_STATIC, _("Generate"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxADJUST_MINSIZE, 5); + + wxString* m_cmGeneratorChoiceStrings = NULL; + m_cmGeneratorChoice = new wxComboBox( itemPanel3, ID_CHOOSE_GENERATOR, _T(""), wxDefaultPosition, wxSize(170, -1), 0, m_cmGeneratorChoiceStrings, wxCB_READONLY ); + itemFlexGridSizer14->Add(m_cmGeneratorChoice, 1, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxTOP|wxBOTTOM, 5); + + wxStaticText* itemStaticText17 = new wxStaticText( itemPanel3, wxID_STATIC, _("Search"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer14->Add(itemStaticText17, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxADJUST_MINSIZE, 5); + + wxString* m_cmSearchQueryStrings = NULL; + m_cmSearchQuery = new wxComboBox( itemPanel3, ID_SEARCHQUERY, _T(""), wxDefaultPosition, wxSize(170, -1), 0, m_cmSearchQueryStrings, wxWANTS_CHARS ); + itemFlexGridSizer14->Add(m_cmSearchQuery, 1, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxTOP|wxBOTTOM, 5); + + m_cmShowAdvanced = new wxCheckBox( itemPanel3, ID_SHOW_ADVANCED, _("Show advanced values"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + m_cmShowAdvanced->SetValue(FALSE); + itemBoxSizer13->Add(m_cmShowAdvanced, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5); + + m_cmOptions = new wxPropertyList( itemPanel3, ID_OPTIONS, wxDefaultPosition, wxSize(200, 150), wxSTATIC_BORDER|wxWANTS_CHARS|wxVSCROLL ); + m_cmOptions->SetDefaultColSize(250); + m_cmOptions->SetDefaultRowSize(25); + m_cmOptions->SetColLabelSize(20); + m_cmOptions->SetRowLabelSize(0); + m_cmOptions->CreateGrid(10, 2, wxGrid::wxGridSelectRows); + itemBoxSizer4->Add(m_cmOptions, 1, wxGROW|wxALL, 5); + + wxPanel* itemPanel21 = new wxPanel( m_splitter, ID_LOGPANEL, wxDefaultPosition, wxSize(-1, 100), wxNO_BORDER|wxTAB_TRAVERSAL ); + wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxVERTICAL); + itemPanel21->SetSizer(itemBoxSizer22); + + wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer22->Add(itemBoxSizer23, 1, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); + m_cmLog = new wxTextCtrl( itemPanel21, ID_LOG_AREA, _("Select your project path (where CMakeLists.txt is) and then select the build path (where the projects should be saved), or select a previous build path.\n\nRight click on a cache value for additional options (delete and ignore). Press configure to update and display new values in red, press OK to generate the projects and exit."), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH2|wxSTATIC_BORDER ); + itemBoxSizer23->Add(m_cmLog, 1, wxGROW|wxRIGHT, 5); + + m_cmDescription = new wxTextCtrl( itemPanel21, ID_DESCRIPTION, _T(""), wxDefaultPosition, wxSize(200, -1), wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH2|wxSTATIC_BORDER ); + itemBoxSizer23->Add(m_cmDescription, 0, wxGROW|wxLEFT, 5); + + wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer22->Add(itemBoxSizer26, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + m_ConfigureButton = new wxButton( itemPanel21, ID_DO_CONFIGURE, _("Co&nfigure"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ConfigureButton->SetDefault(); + itemBoxSizer26->Add(m_ConfigureButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_OkButton = new wxButton( itemPanel21, ID_DO_OK, _("&Generate!"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer26->Add(m_OkButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_CancelButton = new wxButton( itemPanel21, ID_DO_CANCEL, _("C&ancel"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer26->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + +#if defined(__WXMSW__) + wxStaticLine* itemStaticLine30 = new wxStaticLine( itemPanel21, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + itemBoxSizer26->Add(itemStaticLine30, 0, wxGROW|wxALL, 5); +#endif + + m_DeleteCacheButton = new wxButton( itemPanel21, ID_DO_DELETE_CACHE, _("&Delete Cache"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer26->Add(m_DeleteCacheButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_ClearLogButton = new wxButton( itemPanel21, ID_CLEAR_LOG, _("Clear &Log"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer26->Add(m_ClearLogButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + +#if defined(__WXMSW__) + wxStaticLine* itemStaticLine33 = new wxStaticLine( itemPanel21, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + itemBoxSizer26->Add(itemStaticLine33, 0, wxGROW|wxALL, 5); +#endif + + m_cmBrowseCell = new wxButton( itemPanel21, ID_BROWSE_GRID, _("&Browse"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer26->Add(m_cmBrowseCell, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + m_splitter->SplitHorizontally(itemPanel3, itemPanel21, 300); + + wxStatusBar* itemStatusBar35 = new wxStatusBar( itemFrame1, ID_STATUSBAR, wxST_SIZEGRIP|wxNO_BORDER ); + itemStatusBar35->SetFieldsCount(2); + itemFrame1->SetStatusBar(itemStatusBar35); + +////@end CMakeSetupFrm content construction +} + +void CMakeSetupFrm::DoInitFrame(cmCommandLineInfo &cm, const wxString &fn) +{ + // create accelerator table for some commands + // not very useful if the focus is on an edit ctrl all the time ;-) + //wxAcceleratorEntry entries[3]; + //entries[0].Set(wxACCEL_NORMAL, (int) 'c', ID_MENU_CONFIGURE); + //entries[1].Set(wxACCEL_NORMAL, (int) 'g', ID_MENU_EXITGENERATE); + //entries[2].Set(wxACCEL_NORMAL, (int) 't', ID_MENU_TOGGLE_ADVANCED); + //wxAcceleratorTable accel(3, entries); + //SetAcceleratorTable(accel); + + // path to where cmake.exe is + // m_PathToExecutable = cm.GetPathToExecutable().c_str(); + m_PathToExecutable = fn; + + // adjust size of last bar, to display % progress + wxStatusBar *bar = GetStatusBar(); + if(bar) + { + wxASSERT(bar->GetFieldsCount() > 1); + + // fill all with -1. Why this way? because the count of the status bars + // can change. All of the widths must be accounted for and initialised + int *widths = new int[bar->GetFieldsCount()]; + for(int i = 0; i < bar->GetFieldsCount(); i++) + widths[i] = -1; + + // the % field + widths[1] = 75; + bar->SetStatusWidths(bar->GetFieldsCount(), widths); + delete widths; + } + + wxString name, generator; + std::vector names; + + m_RunningConfigure = false; + + // set grid labels + m_cmOptions->SetColLabelValue(0, wxT("Cache Name")); + m_cmOptions->SetColLabelValue(1, wxT("Cache Value")); + m_cmOptions->SetProjectGenerated(false); + + // set drop target + m_cmOptions->SetDropTarget(new DnDFile(m_cmBuildPath)); + + m_cmake->GetRegisteredGenerators(names); + for(std::vector::iterator i = names.begin(); i != names.end(); ++i) + { + name = i->c_str(); + m_cmGeneratorChoice->Append(name); + } + + // sync advanced option with grid + m_cmOptions->SetShowAdvanced(m_cmShowAdvanced->GetValue()); + + // if none selected, we will see if VS8, VS7 or VS6 is present + if(m_cmGeneratorChoice->GetValue().IsEmpty()) + { + std::string mp; + mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path]"; + cmSystemTools::ExpandRegistryValues(mp); + if(mp != "/registry") + generator = wxT("Visual Studio 8 2005"); + else + { + mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir]"; + cmSystemTools::ExpandRegistryValues(mp); + if (mp != "/registry") + generator = wxT("Visual Studio 7 .NET 2003"); + else + { + mp = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0;InstallDir]"; + cmSystemTools::ExpandRegistryValues(mp); + if (mp != "/registry") + generator = wxT("Visual Studio 7"); + else + generator = wxT("Visual Studio 6"); + } + } + } + + // set proper discovered generator + m_cmGeneratorChoice->SetStringSelection(generator); + + wxString str; + //str.Printf("CMake %d.%d - %s", cmake::GetMajorVersion(), cmake::GetMinorVersion(), cmake::GetReleaseVersion()); + str.Printf("CMakeSetup v%i.%i%s", CMAKEGUI_MAJORVER, CMAKEGUI_MINORVER, CMAKEGUI_ADDVER); + + SetTitle(str); + wxString path; + + // get last 5 used projects + for(size_t i = 0; i < CM_MAX_RECENT_PATHS; i++) + { + path.Printf("%s%i", _(CM_RECENT_BUILD_PATH), i); + if(m_config->Read(path, &str)) + AppendPathToRecentList(str); + } + + // get query items + for(size_t i = 0; i < CM_MAX_SEARCH_QUERIES; i++) + { + path.Printf("%s%i", _(CM_SEARCH_QUERY), i); + if(m_config->Read(path, &str)) + m_cmSearchQuery->Append(str); + } + + + // make sure the call to update grid is not executed + m_noRefresh = true; + m_cmSearchQuery->SetValue(_("")); + m_noRefresh = false; + + // Get the parameters from the command line info + // If an unknown parameter is found, try to interpret it too, since it + // is likely to be a file dropped on the shortcut :) + bool sourceDirLoaded = false, + buildDirLoaded = false; + + if(cm.m_LastUnknownParameter.empty()) + { + if(cm.m_WhereSource.size() > 0 ) + { + m_cmProjectPath->SetValue(cm.m_WhereSource.c_str()); + sourceDirLoaded = true; + } + + if (cm.m_WhereBuild.size() > 0 ) + { + m_cmBuildPath->SetValue(cm.m_WhereBuild.c_str()); + buildDirLoaded = true; + } + + m_cmShowAdvanced->SetValue(cm.m_AdvancedValues); + } + else + { + m_cmShowAdvanced->SetValue(false); + + // TODO: Interpret directory from dropped shortcut + //this->ChangeDirectoriesFromFile(cmdInfo->m_LastUnknownParameter.c_str()); + } + + if (cm.m_ExitAfterLoad) + { + int id = GetId(); + m_ExitTimer = new wxTimer(this, id); + m_ExitTimer->Start(3000); + + Connect( id, wxEVT_TIMER,(wxObjectEventFunction) &CMakeSetupFrm::OnExitTimer ); + + } + + // retrieve settings, this needs to be done here + // because writing to the m_cmBuildPath triggers a cache reload + if(!sourceDirLoaded && m_config->Read(CM_LASTPROJECT_PATH, &str)) + m_cmProjectPath->SetValue(str); + + if(!buildDirLoaded) + { + m_cmOptions->RemoveAll(); + if(m_config->Read(CM_LASTBUILD_PATH, &str)) + m_cmBuildPath->SetValue(str); + } + + // set window size from settings + long xsize, ysize, splitpos; + if(m_config->Read(CM_XSIZE, &xsize) && m_config->Read(CM_YSIZE, &ysize) && + m_config->Read(CM_SPLITTERPOS, &splitpos)) + { + SetSize(xsize, ysize); + m_splitter->SetSashPosition(splitpos); + } + + if(m_config->Read(CM_XPOS, &xsize) && m_config->Read(CM_YPOS, &ysize)) + SetSize(xsize, ysize, -1, -1, wxSIZE_USE_EXISTING); + + UpdateWindowState(); +} + +void CMakeSetupFrm::LoadCacheFromDiskToGUI() +{ + wxString builddir = m_cmBuildPath->GetValue(); + + cmCacheManager *cachem = m_cmake->GetCacheManager(); + if(cachem && !builddir.Trim().IsEmpty()) + { + if(cachem->LoadCache(builddir.c_str())) + AppendPathToRecentList(builddir); + + // represent this cache in the grid, but not before we + // wiped all of the old items + FillCacheGUIFromCacheManager(); + + // set the generator string to the one used in the cache + cmCacheManager::CacheIterator it = cachem->GetCacheIterator("CMAKE_GENERATOR"); + if(!it.IsAtEnd()) + { + wxString curGen = it.GetValue(); + m_cmGeneratorChoice->SetStringSelection(curGen); + } + } +} + +void CMakeSetupFrm::AppendPathToRecentList(const wxString &p) +{ + wxFileName path; + wxString str; + + if(p.IsEmpty()) + return; + + // cheap way to get rid of trailing seperators + path.AssignDir(p); + str = path.GetPath(); + + // append the item, or add it to end to make sure + // it is remembered between sessions + for(size_t i = 0; i < m_recentPaths.Count(); i++) + { + if(m_recentPaths[i].IsSameAs(str, false)) + { + m_recentPaths.RemoveAt(i); + + // only re-add when item is still valid + if(::wxDirExists(str)) + m_recentPaths.Add(str); + else + return; // no add when the item is not existing + + return; + } + } + + if(GetMenuBar()) + { + // get file menu + int lastUsedID = 0; + wxMenu *mnu = GetMenuBar()->GetMenu(0); + wxASSERT(mnu != 0); + + if(::wxDirExists(str)) + { + // add to array + if(m_recentPaths.Count() == 0) + mnu->AppendSeparator(); + + lastUsedID = CM_RECENT_BUILD_ITEM + m_recentPaths.Count(); + m_recentPaths.Add(str); + + // when we have more in list then we can display, prune and + // remove some menu items until we have room (and available ID's again) + if(m_recentPaths.Count() > CM_MAX_RECENT_PATHS) + { + // prune the list + while(m_recentPaths.Count() > CM_MAX_RECENT_PATHS) + m_recentPaths.RemoveAt(0); + + // now determine count, and remove until we have room + int index = mnu->GetMenuItemCount() - 1; + int count = 0; + wxASSERT(index > 0); + + wxMenuItem *item; + do + { + item = mnu->FindItemByPosition(index); + if(item) + { + if(item->IsSeparator()) + { + // next index is valid item + index ++; + break; + } + else + count ++; + } + + index --; + } + while(index >= 0 && item); + + // ok, if count > CM_MAX_RECENT_PATHS then we are going to + // delete some items on the index position + if(count >= CM_MAX_RECENT_PATHS) + { + // delete items that are exceeding + while(count >= CM_MAX_RECENT_PATHS) + { + lastUsedID = mnu->FindItemByPosition(index)->GetId(); + mnu->Delete(lastUsedID); + count --; + } + } + } + + // append item + mnu->Append(lastUsedID, str); + } + } +} + +bool CMakeSetupFrm::PerformCacheRun() +{ + bool enable = false; + cmCacheManager *cachem = m_cmake->GetCacheManager(); + cmCacheManager::CacheIterator it = cachem->NewIterator(); + + // remove all items that are no longer present + size_t j = 0; + while(j < m_cmOptions->GetCount()) + { + // check to see if it is still in the CMake cache + // if it is still in the cache then it is no longer new + wxPropertyItem *item = m_cmOptions->GetItem(j); + if ( !it.Find((const char*)item->GetPropName().c_str()) ) + m_cmOptions->RemoveProperty(item); + else + { + // ok we found it, mark as old + item->SetNewValue(false); + int row = m_cmOptions->FindProperty(item); + if(row != -1) + m_cmOptions->UpdatePropertyItem(item, row); + j++; + } + } + + if(cachem->GetSize() > 0 && !cmSystemTools::GetErrorOccuredFlag()) + { + bool enable = true; + for(size_t i = 0; i < m_cmOptions->GetCount(); i++) + { + wxPropertyItem* item = m_cmOptions->GetItem(i); + if(item->GetAdvanced()) + { + if(item->GetNewValue() && m_cmOptions->GetShowAdvanced()) + { + // if one new value then disable to OK button + enable = false; + break; + } + } + else + { + if(item->GetNewValue()) + { + // if one new value then disable to OK button + enable = false; + break; + } + } + } + } + + return enable; +} + +void CMakeSetupFrm::FillCacheGUIFromCacheManager() +{ + cmCacheManager *cachem = m_cmake->GetCacheManager(); + cmCacheManager::CacheIterator it = cachem->NewIterator(); + + // remove all items that are no longer present + size_t j = 0; + while(j < m_cmOptions->GetCount()) + { + // check to see if it is still in the CMake cache + // if it is still in the cache then it is no longer new + wxPropertyItem *item = m_cmOptions->GetItem(j); + if ( !it.Find((const char*)item->GetPropName().c_str()) ) + m_cmOptions->RemoveProperty(item); + else + j++; + } + + // if there are already entries in the cache, then + // put the new ones in the top, so they show up first + bool reverseOrder = false; + for(cmCacheManager::CacheIterator i = cachem->NewIterator(); !i.IsAtEnd(); i.Next()) + { + const char* key = i.GetName(); + + // if value has trailing space or tab, enclose it in single quotes + // to enforce the fact that it has 'invisible' trailing stuff + std::string value = i.GetValue(); + if (value.size() && (value[value.size() - 1] == ' ' || value[value.size() - 1] == '\t')) + value = '\'' + value + '\''; + + bool advanced = i.GetPropertyAsBool("ADVANCED"); + switch(i.GetType() ) + { + case cmCacheManager::BOOL: + { + wxString OnOff; + + if(cmSystemTools::IsOn(value.c_str())) + OnOff = wxT("ON"); + else + OnOff = wxT("OFF"); + + m_cmOptions->AddProperty(key, + OnOff.c_str(), + i.GetProperty("HELPSTRING"), + wxPropertyList::CHECKBOX, "ON|OFF", + reverseOrder, + advanced ); + } + break; + + case cmCacheManager::PATH: + m_cmOptions->AddProperty(key, + value.c_str(), + i.GetProperty("HELPSTRING"), + wxPropertyList::PATH,"", + reverseOrder, advanced); + break; + + case cmCacheManager::FILEPATH: + m_cmOptions->AddProperty(key, + value.c_str(), + i.GetProperty("HELPSTRING"), + wxPropertyList::FILE,"", + reverseOrder, advanced); + break; + + case cmCacheManager::STRING: + m_cmOptions->AddProperty(key, + value.c_str(), + i.GetProperty("HELPSTRING"), + wxPropertyList::EDIT,"", + reverseOrder, advanced); + break; + + case cmCacheManager::INTERNAL: + { + wxPropertyItem *pItem = m_cmOptions->FindPropertyByName(key); + if(pItem) + m_cmOptions->RemoveProperty(pItem); + } + break; + } + } +} + +void CMakeSetupFrm::OnExitTimer(wxTimerEvent &event) +{ + Close(); +} + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_PROJECT + */ + +void CMakeSetupFrm::OnButtonBrowseProject( wxCommandEvent& event ) +{ + const wxString& dir = wxDirSelector("Select project directory", m_cmProjectPath->GetValue()); + if(!dir.IsEmpty()) + m_cmProjectPath->SetValue(dir); +} + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_BUILD + */ + +void CMakeSetupFrm::OnButtonBrowseBuild( wxCommandEvent& event ) +{ + const wxString& dir = wxDirSelector("Select build directory", m_cmBuildPath->GetValue()); + if(!dir.IsEmpty()) + m_cmBuildPath->SetValue(dir); +} + +/*! + * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_SHOW_ADVANCED + */ + +void CMakeSetupFrm::OnShowAdvancedValues( wxCommandEvent& event ) +{ + if(m_cmShowAdvanced->GetValue()) + m_cmOptions->ShowAdvanced(); + else + m_cmOptions->HideAdvanced(); +} + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_CONFIGURE + */ + +void CMakeSetupFrm::OnButtonConfigure( wxCommandEvent& event ) +{ + DoConfigure(); +} + +void CMakeSetupFrm::DoConfigure() +{ + // enable error messages each time configure is pressed + cmSystemTools::EnableMessages(); + m_cmOptions->HideControls(); + + cmSystemTools::ResetErrorOccuredFlag(); + + // instantiate a dialog for the progress meter + + PerformCacheRun(); + RunCMake(false); +} + +int CMakeSetupFrm::RunCMake(bool generateProjectFiles) +{ + int value = -1; + + // clear log + m_cmLog->Clear(); + m_cmLog->DiscardEdits(); + + wxString builddir = m_cmBuildPath->GetValue(), + sourcedir = m_cmProjectPath->GetValue(), + err = wxT("Error in configuration process, project files may be invalid"); + + + // sanity check for people pressing OK on empty dirs + if(builddir.Trim().IsEmpty() || sourcedir.Trim().IsEmpty()) + { + wxMessageBox(wxT("Please enter a valid source directory and build directory"), wxT("Error"), wxOK | wxICON_ERROR, this); + return -1; + } + + // check if the directory exists, if not, create it + if(!cmSystemTools::FileExists(builddir.c_str())) + { + wxString str; + str << wxT("Build directory does not exist, should I create it?\n\nDirectory: ") << builddir; + + int answer = wxMessageBox(str, wxT("Create directory"), wxYES_NO, this); + if (answer == wxYES) + { + if(!cmSystemTools::MakeDirectory(builddir.c_str())) + { + // could not create, tell and abort + wxMessageBox(wxT("Could not create directory"), wxT("Error"), wxOK | wxICON_ERROR, this); + return -1; + } + } + else + { + // we abort because the user did not want to make the directory + wxMessageBox(wxT("Build Project aborted, nothing done."), wxT("Aborted"), + wxOK | wxICON_EXCLAMATION, this); + return -1; + } + } + + /** show progress dialog that informs the user with a progress bar */ + if(m_progressDlg) + m_progressDlg->Destroy(); + + m_progressDlg = new CMProgressDialog(this); + m_progressDlg->Show(); + + // set the wait cursor + m_RunningConfigure = true; + UpdateWindowState(); + + // always save the current gui values to disk + SaveCacheFromGUI(); + + // Make sure we are working from the cache on disk + LoadCacheFromDiskToGUI(); + + // setup the cmake instance + if (generateProjectFiles) + { + if(m_cmake->Generate() != 0) + { + wxMessageBox(err, wxT("Error"), wxOK | wxICON_ERROR, this); + cmSystemTools::Error(err.c_str()); + value = -1; + } + else + { + value = 0; + m_cmOptions->SetProjectGenerated(true); // clear cache dirty when generated + } + } + else + { + // set paths + m_cmake->SetHomeDirectory(m_cmProjectPath->GetValue().c_str()); + m_cmake->SetStartDirectory(m_cmProjectPath->GetValue().c_str()); + m_cmake->SetHomeOutputDirectory(m_cmBuildPath->GetValue().c_str()); + m_cmake->SetStartOutputDirectory(m_cmBuildPath->GetValue().c_str()); + + m_cmake->SetGlobalGenerator(m_cmake->CreateGlobalGenerator(m_cmGeneratorChoice->GetValue().c_str())); + m_cmake->SetCMakeCommand(m_PathToExecutable.c_str()); + m_cmake->LoadCache(); + if(m_cmake->Configure() != 0) + { + wxMessageBox(err, wxT("Error"), wxOK | wxICON_ERROR, this); + cmSystemTools::Error(err.c_str()); + } + + // update the GUI with any new values in the caused by the + // generation process + LoadCacheFromDiskToGUI(); + } + + m_RunningConfigure = false; + + if(!value) + cmSystemTools::ResetErrorOccuredFlag(); + + m_progressDlg->Destroy(); + m_progressDlg = 0; + + // reset the statusbar progress + wxStatusBar *bar = GetStatusBar(); + if(bar) + bar->SetStatusText(wxEmptyString, 1); + + UpdateWindowState(); + return value; +} + +//! Save GUI values to cmCacheManager and then save to disk. +void CMakeSetupFrm::SaveCacheFromGUI() +{ + cmCacheManager *cachem = m_cmake->GetCacheManager(); + FillCacheManagerFromCacheGUI(); + + // write the cache to disk + if(!m_cmBuildPath->GetValue().Trim().IsEmpty()) + cachem->SaveCache(m_cmBuildPath->GetValue().c_str()); +} + +void CMakeSetupFrm::FillCacheManagerFromCacheGUI() +{ + cmCacheManager *cachem = m_cmake->GetCacheManager(); + + cmCacheManager::CacheIterator it = cachem->NewIterator(); + for(size_t i = 0; i < m_cmOptions->GetCount(); i++) + { + wxPropertyItem* item = m_cmOptions->GetItem(i); + if ( it.Find((const char*)item->GetPropName().c_str()) ) + { + // if value is enclosed in single quotes ('foo') then remove them + // they were used to enforce the fact that it had 'invisible' + // trailing stuff + if (item->GetCurValue().Len() >= 2 && + item->GetCurValue().GetChar(0) == '\'' && + item->GetCurValue().GetChar(item->GetCurValue().Len() - 1) == '\'') + { + it.SetValue(item->GetCurValue().Mid(1, item->GetCurValue().Len() - 2).c_str()); + } + else + it.SetValue(item->GetCurValue().c_str()); + } + } +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_OK + */ + +void CMakeSetupFrm::OnButtonOk( wxCommandEvent& event ) +{ + DoGenerate(); +} + +void CMakeSetupFrm::DoGenerate() +{ + cmSystemTools::EnableMessages(); + + cmSystemTools::ResetErrorOccuredFlag(); + + m_cmOptions->HideControls(); + PerformCacheRun(); + + if(!RunCMake(true)) + { + // issue a close when this is done (this is issued by menu "Generate and Exit" + if(m_quitAfterGenerating) + Close(); + else if(!wxGetKeyState(WXK_SHIFT)) + { + bool close; + m_config->Read(CM_CLOSEAFTERGEN, &close, CM_CLOSEAFTERGEN_DEF); + + if(!close) + wxMessageBox(wxT("Building of project files succesful!"), wxT("Success!"), wxOK|wxICON_INFORMATION); + else + Close(); + } + } +} + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_CANCEL + */ + +void CMakeSetupFrm::OnButtonCancel( wxCommandEvent& event ) +{ + DoCancelButton(); +} + +void CMakeSetupFrm::DoCancelButton() +{ + if(m_RunningConfigure) + { + int result = wxMessageBox(wxT("You are in the middle of a Configure.\n" + "If you Cancel now the configure information will be lost.\n" + "Are you sure you want to Cancel?"), wxT("Warning"), wxYES_NO|wxICON_WARNING); + if(result == wxYES) + cmSystemTools::SetFatalErrorOccured(); + else + if(m_progressDlg) + m_progressDlg->ResetCancel(); + } +} + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_DELETE_CACHE + */ + +void CMakeSetupFrm::OnButtonDeleteCache( wxCommandEvent& event ) +{ + DoDeleteCache(); +} + +void CMakeSetupFrm::DoDeleteCache() +{ + bool deletecache = true; + if(m_cmOptions->IsCacheDirty() || (m_cmOptions->GetCount() > 0 && !m_cmOptions->IsGenerated())) + { + int result = ::wxMessageBox(_("You have changed options, are you sure you want to delete all items?\n"), + _("Warning"), wxYES_NO|wxICON_QUESTION); + + // when user wants to wait, wait.. else quit + if(result == wxNO) + deletecache = false; + + } + + if(deletecache) + { + // indicate that we haven't generated a project yet + m_cmOptions->SetProjectGenerated(false); + + if(!m_cmBuildPath->GetValue().Trim().IsEmpty() && m_cmake != 0) + m_cmake->GetCacheManager()->DeleteCache(m_cmBuildPath->GetValue().Trim()); + + LoadCacheFromDiskToGUI(); + UpdateWindowState(); + } +} + +/*! + * Should we show tooltips? + */ + +bool CMakeSetupFrm::ShowToolTips() +{ + return TRUE; +} + +/*! + * Get bitmap resources + */ + +wxBitmap CMakeSetupFrm::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin CMakeSetupFrm bitmap retrieval + return wxNullBitmap; +////@end CMakeSetupFrm bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon CMakeSetupFrm::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin CMakeSetupFrm icon retrieval + if (name == wxT("cmake_icon.xpm")) + { + wxIcon icon(_T("cmake_icon.xpm"), wxBITMAP_TYPE_XPM); + return icon; + } + return wxNullIcon; +////@end CMakeSetupFrm icon retrieval +} + +/*! + * wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING event handler for ID_SPLITTERWINDOW + */ + +void CMakeSetupFrm::OnSplitterPosChanging( wxSplitterEvent& event ) +{ + int width, height; + + GetSize(&width, &height); + + if((height > 100)) + { + if(event.GetSashPosition() < 170) + event.SetSashPosition(170); + else + { + if(event.GetSashPosition() > (height - 180)) + event.SetSashPosition(height - 180); + } + } + else + event.Veto(); + +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CLEAR_LOG + */ + +void CMakeSetupFrm::OnClearLogClick( wxCommandEvent& event ) +{ + // delete the log text + m_cmLog->Clear(); + m_cmLog->DiscardEdits(); +} + + +/*! + * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_SOURCE_BUILD_PATH + */ + +void CMakeSetupFrm::OnSourceBuildPathUpdated( wxCommandEvent& event ) +{ + DoReloadCache(); +} + +void CMakeSetupFrm::DoReloadCache() +{ + wxString buildpath = m_cmBuildPath->GetValue(); + // The build dir has changed, check if there is a cache, and + // grab the source dir from it + + // make sure the call to update grid is not executed + m_noRefresh = true; + m_cmSearchQuery->SetValue(_("")); + m_noRefresh = false; + + std::string path = buildpath.c_str(); + cmSystemTools::ConvertToUnixSlashes(path); + + // adjust the cmake instance + m_cmake->SetHomeOutputDirectory(buildpath.c_str()); + m_cmake->SetStartOutputDirectory(buildpath.c_str()); + + std::string cache_file = path; + cache_file += "/CMakeCache.txt"; + + // fill in the project path where the source is located, this is + // read from the CMake cache + cmCacheManager *cachem = m_cmake->GetCacheManager(); + cmCacheManager::CacheIterator it = cachem->NewIterator(); + if (cmSystemTools::FileExists(cache_file.c_str()) && cachem->LoadCache(path.c_str()) && + it.Find("CMAKE_HOME_DIRECTORY")) + { + path = ConvertToWindowsPath(it.GetValue()); + m_cmProjectPath->SetValue(path.c_str()); + } + + m_cmOptions->RemoveAll(); + LoadCacheFromDiskToGUI(); + UpdateWindowState(); +} + + +/*! + * wxEVT_COMMAND_TEXT_ENTER event handler for ID_SOURCE_BUILD_PATH + */ + +void CMakeSetupFrm::OnSourceBuildPathEnter( wxCommandEvent& event ) +{ + OnSourceBuildPathUpdated(event); +} + +/*! + * wxEVT_MOTION event handler for ID_OPTIONS + */ + +void CMakeSetupFrm::OnPropertyMotion( wxMouseEvent& event ) +{ + ShowPropertyDescription(m_cmOptions->YToRow(event.GetY())); + event.Skip(); +} + + +/*! + * wxEVT_GRID_SELECT_CELL event handler for ID_OPTIONS + */ + +void CMakeSetupFrm::OnGridSelectCell( wxGridEvent& event ) +{ + // show description + ShowPropertyDescription(event.GetRow()); + + // enable or disable the browse button + m_cmBrowseCell->Enable(m_cmOptions->IsSelectedItemBrowsable(event.GetRow())); + event.Skip(); +} + +void CMakeSetupFrm::ShowPropertyDescription(int row) +{ + if(row == wxNOT_FOUND || row < 0) + m_cmDescription->SetValue(wxEmptyString); + else + { + wxPropertyItem *pItem = m_cmOptions->GetPropertyItemFromRow(row); + if(pItem) + m_cmDescription->SetValue(pItem->GetHelpString()); + else + m_cmDescription->SetValue(wxEmptyString); + } +} + +/*! + * wxEVT_GRID_CELL_CHANGE event handler for ID_OPTIONS + */ + +void CMakeSetupFrm::OnCellChange( wxGridEvent& event ) +{ + // update the button state when the cache is invalidated + UpdateWindowState(); +} + +void CMakeSetupFrm::OnRecentFileMenu( wxCommandEvent &event ) +{ + if(GetMenuBar()) + { + // get file menu + wxMenu *mnu = GetMenuBar()->GetMenu(0); + wxASSERT(mnu != 0); + + wxMenuItem *item = mnu->FindItem(event.GetId()); + if(item) + m_cmBuildPath->SetValue(item->GetLabel()); + } +} +/*! + * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_COMBOBOX + */ + +void CMakeSetupFrm::OnSearchquerySelected( wxCommandEvent& event ) +{ + m_cmOptions->SetQuery(m_cmSearchQuery->GetValue()); +} + +void CMakeSetupFrm::OnAddQuery ( wxCommandEvent &event ) +{ + // add current text if not yet present + if(m_cmSearchQuery->FindString(m_cmSearchQuery->GetValue()) == wxNOT_FOUND) + { + m_cmSearchQuery->Append(m_cmSearchQuery->GetValue()); + + // if too many items are present, prune + while(m_cmSearchQuery->GetCount() > CM_MAX_SEARCH_QUERIES) + m_cmSearchQuery->Delete(0); + } +} + +/*! + * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_SEARCHQUERY + */ + +void CMakeSetupFrm::OnSearchqueryUpdated( wxCommandEvent& event ) +{ + // only refresh when this event was caused by user + if(!m_noRefresh) + m_cmOptions->SetQuery(m_cmSearchQuery->GetValue()); +} + + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_GRID + */ + +void CMakeSetupFrm::OnBrowseGridClick( wxCommandEvent& event ) +{ + m_cmOptions->BrowseSelectedItem(); +} + + +/*! + * wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_RELOAD_CACHE + */ + +void CMakeSetupFrm::OnMenuReloadCacheClick( wxCommandEvent& event ) +{ + bool reload = true; + if(m_cmOptions->IsCacheDirty() || (m_cmOptions->GetCount() > 0 && !m_cmOptions->IsGenerated())) + { + int result = ::wxMessageBox(_("You have changed options, are you sure you want to reload?\n"), + _("Warning"), wxYES_NO|wxICON_QUESTION); + + // when user wants to wait, wait.. else quit + if(result == wxNO) + reload = false; + + } + + if(reload) + DoReloadCache(); +} + +/*! + * wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_DELETE_CACHE + */ + +void CMakeSetupFrm::OnMenuDeleteCacheClick( wxCommandEvent& event ) +{ + DoDeleteCache(); +} + + +/*! + * wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_QUIT + */ + +void CMakeSetupFrm::OnMenuQuitClick( wxCommandEvent& event ) +{ + // the close event will veto if the user + // did not want to quit due to unsaved changes + Close(); +} + + +/*! + * wxEVT_CLOSE_WINDOW event handler for ID_FRAME + */ + +void CMakeSetupFrm::OnCloseWindow( wxCloseEvent& event ) +{ + // ask quit if: + // - The cache is dirty + // - Or the cache is OK and has some items, and no project was generated recently (configure -> generate) + if(m_cmOptions->IsCacheDirty() || (m_cmOptions->GetCount() > 0 && !m_cmOptions->IsGenerated())) + { + int result = ::wxMessageBox(_("You have changed options, but not yet generated the projects\n" + "are you sure you want to quit?"), _("Warning"), wxYES_NO|wxICON_QUESTION); + + // when user wants to wait, wait.. else quit + if(result == wxNO) + event.Veto(); + else + event.Skip(); + } + else + event.Skip(); +} + + +/*! + * wxEVT_COMMAND_MENU_SELECTED event handler for ID_ABOUTDLG + */ + +void CMakeSetupFrm::OnAboutClick( wxCommandEvent& event ) +{ + CMAboutDlg *dlg = new CMAboutDlg(this); + + wxArrayString generators; + std::vector names; + m_cmake->GetRegisteredGenerators(names); + for(std::vector::iterator i = names.begin(); i != names.end(); ++i) + generators.Add(i->c_str()); + + wxString cmversion, cmsversion; + cmversion.Printf("v%i.%i %s", cmake::GetMajorVersion(), cmake::GetMinorVersion(), cmake::GetReleaseVersion()); + cmsversion.Printf("v%i.%i%s", CMAKEGUI_MAJORVER, CMAKEGUI_MINORVER, CMAKEGUI_ADDVER); + + dlg->SetAboutText(cmversion, cmsversion, generators); + + dlg->ShowModal(); + dlg->Destroy(); +} + + +/*! + * wxEVT_COMMAND_MENU_SELECTED event handler for ID_CMAKE_OPTIONS + */ + +void CMakeSetupFrm::OnOptionsClick( wxCommandEvent& event ) +{ + CMOptionsDlg *dlg = new CMOptionsDlg(this); + + dlg->SetConfig(m_config); + if(dlg->ShowModal() == wxID_OK) + { + // store volatile settings + dlg->GetConfig(m_config); + + // apply non volatile setting such as clear search query, recent menu, etc. + SyncFormOptions(dlg); + } + + dlg->Destroy(); +} + +void CMakeSetupFrm::SyncFormOptions(CMOptionsDlg *dlg) +{ + // TODO: Clear search query etc. +} +/*! + * wxEVT_COMMAND_SPLITTER_DOUBLECLICKED event handler for ID_SPLITTERWINDOW + */ + +void CMakeSetupFrm::OnSplitterwindowSashDClick( wxSplitterEvent& event ) +{ + event.Veto(); +} + + +/*! + * wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_CONFIGURE + */ + +void CMakeSetupFrm::OnMenuConfigureClick( wxCommandEvent& event ) +{ + DoConfigure(); +} + +/*! + * wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_EXITGENERATE + */ + +void CMakeSetupFrm::OnMenuGenerateClick( wxCommandEvent& event ) +{ + // set flag so that a close command is issued + // after generating the cmake cache to projects + m_quitAfterGenerating = true; + DoGenerate(); + m_quitAfterGenerating = false; +} + + +/*! + * wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_TOGGLE_ADVANCED + */ + +void CMakeSetupFrm::OnMenuToggleAdvancedClick( wxCommandEvent& event ) +{ + // toggle the check box + m_cmShowAdvanced->SetValue(!m_cmShowAdvanced->GetValue()); + OnShowAdvancedValues(event); +} + + diff --git a/Source/WXDialog/CMakeSetupFrame.h b/Source/WXDialog/CMakeSetupFrame.h new file mode 100644 index 0000000..accadae --- /dev/null +++ b/Source/WXDialog/CMakeSetupFrame.h @@ -0,0 +1,360 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef _CMAKESETUPFRAME_H_ +#define _CMAKESETUPFRAME_H_ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "CMakeSetupFrame.cpp" +#endif + +/*! + * Includes + */ + +////@begin includes +#include "wx/frame.h" +#include "wx/splitter.h" +#include "wx/grid.h" +#include "wx/statline.h" +#include "wx/statusbr.h" +////@end includes + +#include +#include +#include + + +#include "../cmake.h" +#include "progressdlg.h" +#include "optionsdlg.h" +#include "CommandLineInfo.h" +#include "config.h" + +// this ID should be taken as base to make sure they are unique +// NOTE: DialogBlocks starts at 10100 so 10000 to 10099 are free +#define CM_NEXT_USABLEID CM_RECENT_BUILD_ITEM + CM_MAX_RECENT_PATHS + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxSplitterWindow; +class wxPropertyList; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define ID_FRAME 10100 +#define SYMBOL_CMAKESETUPFRM_STYLE wxDEFAULT_FRAME_STYLE|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCLOSE_BOX|wxSUNKEN_BORDER +#define SYMBOL_CMAKESETUPFRM_TITLE _("CMake Setup v2.0.x") +#define SYMBOL_CMAKESETUPFRM_IDNAME ID_FRAME +#define SYMBOL_CMAKESETUPFRM_SIZE wxSize(600, 550) +#define SYMBOL_CMAKESETUPFRM_POSITION wxDefaultPosition +#define ID_SPLITTERWINDOW 10101 +#define ID_MAINPANEL 10102 +#define ID_PROJECT_PATH 10103 +#define ID_BROWSE_PROJECT 10104 +#define ID_SOURCE_BUILD_PATH 10105 +#define ID_BROWSE_BUILD 10106 +#define ID_CHOOSE_GENERATOR 10107 +#define ID_SEARCHQUERY 10109 +#define ID_SHOW_ADVANCED 10108 +#define ID_OPTIONS 10110 +#define ID_LOGPANEL 10111 +#define ID_LOG_AREA 10112 +#define ID_DESCRIPTION 10113 +#define ID_DO_CONFIGURE 10114 +#define ID_DO_OK 10115 +#define ID_DO_CANCEL 10116 +#define ID_DO_DELETE_CACHE 10117 +#define ID_CLEAR_LOG 10118 +#define ID_BROWSE_GRID 10119 +#define ID_STATUSBAR 10120 +#define ID_MENU_RELOAD_CACHE 10122 +#define ID_MENU_DELETE_CACHE 10123 +#define ID_MENU_QUIT 10125 +#define ID_MENU_CONFIGURE 10126 +#define ID_MENU_EXITGENERATE 10127 +#define ID_MENU_TOGGLE_ADVANCED 10128 +#define ID_CMAKE_OPTIONS 10124 +#define ID_ABOUTDLG 10121 +////@end control identifiers + +/*! + * Compatibility + */ + +#ifndef wxCLOSE_BOX +#define wxCLOSE_BOX 0x1000 +#endif +#ifndef wxFIXED_MINSIZE +#define wxFIXED_MINSIZE 0 +#endif + +class DnDFile : public wxFileDropTarget +{ +public: + DnDFile(wxTextCtrl *pOwner) + : m_pOwner(pOwner) + { + }; + + virtual bool OnDropFiles(wxCoord x, wxCoord y, + const wxArrayString& filenames); + +private: + wxTextCtrl *m_pOwner; +}; + + +/*! + * CMakeSetupFrm class declaration + */ + +class CMakeSetupFrm: public wxFrame +{ + DECLARE_CLASS( CMakeSetupFrm ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + CMakeSetupFrm( ); + CMakeSetupFrm( wxWindow* parent, wxWindowID id = SYMBOL_CMAKESETUPFRM_IDNAME, const wxString& caption = SYMBOL_CMAKESETUPFRM_TITLE, const wxPoint& pos = SYMBOL_CMAKESETUPFRM_POSITION, const wxSize& size = SYMBOL_CMAKESETUPFRM_SIZE, long style = SYMBOL_CMAKESETUPFRM_STYLE ); + + // Destructor + virtual ~CMakeSetupFrm(); + + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CMAKESETUPFRM_IDNAME, const wxString& caption = SYMBOL_CMAKESETUPFRM_TITLE, const wxPoint& pos = SYMBOL_CMAKESETUPFRM_POSITION, const wxSize& size = SYMBOL_CMAKESETUPFRM_SIZE, long style = SYMBOL_CMAKESETUPFRM_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + + /** Logs a message. For the kind parameter use; + 1 - neutral message + 0 - warning message (blue text) + -1 - error message (red text) + */ + void LogMessage(int logkind, const char *msg); + + void UpdateProgress(float progress) { + if(m_progressDlg) + m_progressDlg->SetProgress(progress); + + // also show in the tiny field + wxStatusBar *bar = GetStatusBar(); + if(bar) + { + wxString str; + str.Printf("%2.1f %%", (progress * 100)); + bar->SetStatusText(str, 1); + } + }; + + void IssueUpdate(); + + /** Initialise all crap in the frame, like listing the make generators, + selecting the best one to use, and loading the cache for the first time + when the build paths were set */ + void DoInitFrame(cmCommandLineInfo &cm, const wxString &fn); + +////@begin CMakeSetupFrm event handler declarations + + /// wxEVT_CLOSE_WINDOW event handler for ID_FRAME + void OnCloseWindow( wxCloseEvent& event ); + + /// wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING event handler for ID_SPLITTERWINDOW + void OnSplitterPosChanging( wxSplitterEvent& event ); + + /// wxEVT_COMMAND_SPLITTER_DOUBLECLICKED event handler for ID_SPLITTERWINDOW + void OnSplitterwindowSashDClick( wxSplitterEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_PROJECT + void OnButtonBrowseProject( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_SOURCE_BUILD_PATH + void OnSourceBuildPathUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_ENTER event handler for ID_SOURCE_BUILD_PATH + void OnSourceBuildPathEnter( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_BUILD + void OnButtonBrowseBuild( wxCommandEvent& event ); + + /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_SEARCHQUERY + void OnSearchquerySelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_SEARCHQUERY + void OnSearchqueryUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_SHOW_ADVANCED + void OnShowAdvancedValues( wxCommandEvent& event ); + + /// wxEVT_GRID_CELL_CHANGE event handler for ID_OPTIONS + void OnCellChange( wxGridEvent& event ); + + /// wxEVT_GRID_SELECT_CELL event handler for ID_OPTIONS + void OnGridSelectCell( wxGridEvent& event ); + + /// wxEVT_MOTION event handler for ID_OPTIONS + void OnPropertyMotion( wxMouseEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_CONFIGURE + void OnButtonConfigure( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_OK + void OnButtonOk( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_CANCEL + void OnButtonCancel( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_DELETE_CACHE + void OnButtonDeleteCache( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CLEAR_LOG + void OnClearLogClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_GRID + void OnBrowseGridClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_RELOAD_CACHE + void OnMenuReloadCacheClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_DELETE_CACHE + void OnMenuDeleteCacheClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_QUIT + void OnMenuQuitClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_CONFIGURE + void OnMenuConfigureClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_EXITGENERATE + void OnMenuGenerateClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_TOGGLE_ADVANCED + void OnMenuToggleAdvancedClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_CMAKE_OPTIONS + void OnOptionsClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_ABOUTDLG + void OnAboutClick( wxCommandEvent& event ); + +////@end CMakeSetupFrm event handler declarations + + void OnRecentFileMenu( wxCommandEvent &event ); + + void OnAddQuery ( wxCommandEvent &event ); + +////@begin CMakeSetupFrm member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end CMakeSetupFrm member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + + /** Load cache for the CMakeLists to the GUI */ + void LoadCacheFromDiskToGUI(); + + /** Display the grid with the loaded cache. */ + void FillCacheGUIFromCacheManager(); + + int RunCMake(bool generateProjectFiles); + + /** Save cache to disk from the GUI */ + void SaveCacheFromGUI(); + + void FillCacheManagerFromCacheGUI(); + + /** Update the cache and mark all the new items as old */ + bool PerformCacheRun(); + + /** Shows the property matched by the row in the description area + or nothing when the row is not correct */ + void ShowPropertyDescription(int row); + + /** Disable or enable controls based upon the internal state of the + program */ + void UpdateWindowState(); + + void AppendPathToRecentList(const wxString &p); + + /** Used to synchonise any options that have immediate effect on the GUI + form, like clearing a search list, resetting a spitter perhaps, etc */ + void SyncFormOptions(CMOptionsDlg *dlg); + + void DoCancelButton(); + + void DoReloadCache(); + + void DoDeleteCache(); + + void DoConfigure(); + + void DoGenerate(); + + void OnExitTimer(wxTimerEvent &event); + +////@begin CMakeSetupFrm member variables + wxSplitterWindow* m_splitter; + wxTextCtrl* m_cmProjectPath; + wxButton* m_BrowseProjectPathButton; + wxTextCtrl* m_cmBuildPath; + wxButton* m_BrowseSourcePathButton; + wxComboBox* m_cmGeneratorChoice; + wxComboBox* m_cmSearchQuery; + wxCheckBox* m_cmShowAdvanced; + wxPropertyList* m_cmOptions; + wxTextCtrl* m_cmLog; + wxTextCtrl* m_cmDescription; + wxButton* m_ConfigureButton; + wxButton* m_OkButton; + wxButton* m_CancelButton; + wxButton* m_DeleteCacheButton; + wxButton* m_ClearLogButton; + wxButton* m_cmBrowseCell; +////@end CMakeSetupFrm member variables + + // this is the cmake instance with which we will communicate + // to generate our stuff, and get the info from. + cmake *m_cmake; + + // the config class for project build dir and source path + wxTimer *m_ExitTimer; + wxConfig *m_config; + wxString m_PathToExecutable; + wxArrayString m_recentPaths; + CMProgressDialog *m_progressDlg; + bool m_RunningConfigure; + bool m_noRefresh; + bool m_quitAfterGenerating; +}; + +#endif + // _CMAKESETUPFRAME_H_ diff --git a/Source/WXDialog/CommandLineInfo.cpp b/Source/WXDialog/CommandLineInfo.cpp new file mode 100644 index 0000000..490dd61 --- /dev/null +++ b/Source/WXDialog/CommandLineInfo.cpp @@ -0,0 +1,136 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#include "CommandLineInfo.h" + +#include "cmSystemTools.h" + +/////////////////////////////////////////////////////////////// +// cmCommandLineInfo + +cmCommandLineInfo::cmCommandLineInfo() +{ + this->m_WhereSource = ""; + this->m_WhereBuild = ""; + this->m_AdvancedValues = false; + this->m_GeneratorChoiceString = ""; + this->m_LastUnknownParameter = ""; + this->m_ValidArguments = ""; + this->m_ExitAfterLoad = false; +} + +/////////////////////////////////////////////////////////////// +cmCommandLineInfo::~cmCommandLineInfo() +{ +} + +/////////////////////////////////////////////////////////////// +void cmCommandLineInfo::ParseCommandLine(int argc, char* argv[]) +{ + int cc; + for ( cc = 1; cc < argc; cc ++ ) + { + if ( strlen(argv[cc]) < 1 ) + { + continue; + } + bool valid = true; + std::string argument = argv[cc]; + if ( argument.size() > 1 && + this->m_ValidArguments.find(argument[1]) == std::string::npos ) + { + valid = false; + } + this->ParseParam(argument, valid, (cc + 1 == argc)); + } + this->m_ExecutablePath = cmSystemTools::GetFilenamePath(argv[0]); +} + +/////////////////////////////////////////////////////////////// +int cmCommandLineInfo::GetBoolValue(const std::string& v) { + std::string value = cmSystemTools::LowerCase(v); + if (value == "1" || + value == "on" || + value == "true" || + value == "yes") + { + return 1; + } + else if (value == "0" || + value == "off" || + value == "false" || + value == "no") + { + return -1; + } + return 0; +} + +/////////////////////////////////////////////////////////////// +// Parse param + +void cmCommandLineInfo::ParseParam(const std::string& parameter, + bool know_about, bool /*last*/) +{ + if(!know_about) + { + this->m_LastUnknownParameter = parameter; + } + else + { + std::string sParam(parameter.c_str(), 1, parameter.npos); + // Single letter valued flag like /B=value or /B:value + std::string value; + if (sParam[1] == '=' || sParam[1] == ':') + { + value = std::string(parameter.c_str()+3); + } + else + { + value = std::string(parameter.c_str()+2); + } + int res; + switch (sParam[0]) + { + case 'A': + res = cmCommandLineInfo::GetBoolValue(value); + if (res == 1) + { + this->m_AdvancedValues = true; + } + else if (res == -1) + { + this->m_AdvancedValues = false; + } + break; + case 'B': + this->m_WhereBuild = value; + break; + case 'G': + this->m_GeneratorChoiceString = value; + break; + case 'Q': + this->m_ExitAfterLoad = true; + break; + case 'H': + this->m_WhereSource = value; + break; + } + } +} diff --git a/Source/WXDialog/CommandLineInfo.h b/Source/WXDialog/CommandLineInfo.h new file mode 100644 index 0000000..a904bbc --- /dev/null +++ b/Source/WXDialog/CommandLineInfo.h @@ -0,0 +1,66 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#if !defined(CMAKECOMMANDLINEINFO_H) +#define CMAKECOMMANDLINEINFO_H + +#include "cmStandardIncludes.h" + +/////////////////////////////////////////////////////////////// +// cmCommandLineInfo: +// See cmCommandLineInfo.cxx for the implementation of this class +// + +class cmCommandLineInfo +{ + // Construction +public: + cmCommandLineInfo(); + virtual ~cmCommandLineInfo(); + + // Parse the command line + void ParseCommandLine(int argc, char* argv[]); + + // Set the valid arguments + void SetValidArguments(const std::string& va) { this->m_ValidArguments = va; } + + // Retrieve the path of executable + std::string GetPathToExecutable() { return this->m_ExecutablePath; } + + // Attributes +public: + std::string m_WhereSource; + std::string m_WhereBuild; + bool m_AdvancedValues; + std::string m_GeneratorChoiceString; + std::string m_LastUnknownParameter; + std::string m_ExecutablePath; + bool m_ExitAfterLoad; + +protected: + // Parse one argument + void ParseParam(const std::string& parameter, bool know_about, bool last); + + // Return boolean value of the string + static int GetBoolValue(const std::string&); + + std::string m_ValidArguments; +}; + +#endif // !defined(CMAKECOMMANDLINEINFO_H) diff --git a/Source/WXDialog/NGDialog.exe.manifest b/Source/WXDialog/NGDialog.exe.manifest new file mode 100644 index 0000000..6cdabd0 --- /dev/null +++ b/Source/WXDialog/NGDialog.exe.manifest @@ -0,0 +1,22 @@ + + + + CMake Next Generation Dialog + + + + + + \ No newline at end of file diff --git a/Source/WXDialog/NGDialog.ico b/Source/WXDialog/NGDialog.ico new file mode 100644 index 0000000..0c66d7e Binary files /dev/null and b/Source/WXDialog/NGDialog.ico differ diff --git a/Source/WXDialog/PropertyList.cpp b/Source/WXDialog/PropertyList.cpp new file mode 100644 index 0000000..ef7c897 --- /dev/null +++ b/Source/WXDialog/PropertyList.cpp @@ -0,0 +1,856 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +/* for compilers that support precompilation + includes "wx/wx.h" */ + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "PropertyList.h" +#include "app_resources.h" + +#include "../cmCacheManager.h" +#include "../cmSystemTools.h" +#include "../cmake.h" + +BEGIN_EVENT_TABLE( wxPropertyList, wxGrid ) + EVT_GRID_CELL_LEFT_CLICK( wxPropertyList::OnSelectCell ) + EVT_GRID_CELL_CHANGE( wxPropertyList::OnCellChange ) + EVT_GRID_CMD_CELL_RIGHT_CLICK( wxID_ANY, wxPropertyList::OnCellPopup ) + EVT_MENU ( ID_CACHE_DELETE, wxPropertyList::OnDeleteCache ) + EVT_MENU ( ID_CACHE_IGNORE, wxPropertyList::OnIgnoreCache ) + EVT_MENU ( ID_CACHE_BROWSE, wxPropertyList::OnBrowseItem ) + EVT_SIZE ( wxPropertyList::OnSizeGrid ) + EVT_CHAR ( wxPropertyList::OnKeyPressed ) +END_EVENT_TABLE() + +#if 0 + +// ---------------------------------------------------------------------------- +// wxGridCellPathEditor +// ---------------------------------------------------------------------------- + +wxGridCellPathEditor::wxGridCellPathEditor() +{ + m_maxChars = 0; +} + +void wxGridCellPathEditor::Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) +{ + m_control = new wxTextCtrl(parent, id, wxEmptyString, + wxDefaultPosition, wxDefaultSize +#if defined(__WXMSW__) + , wxTE_PROCESS_TAB | wxTE_AUTO_SCROLL +#endif + ); +// +// m_button = new wxButton(parent, id+1, _("..."), +// wxDefaultPosition, wxDefaultSize); +// + + // set max length allowed in the textctrl, if the parameter was set + if (m_maxChars != 0) + { + ((wxTextCtrl*)m_control)->SetMaxLength(m_maxChars); + } + + wxGridCellEditor::Create(parent, id, evtHandler); +} + +void wxGridCellPathEditor::PaintBackground(const wxRect& WXUNUSED(rectCell), + wxGridCellAttr * WXUNUSED(attr)) +{ + // as we fill the entire client area, don't do anything here to minimize + // flicker +} + +void wxGridCellPathEditor::SetSize(const wxRect& rectOrig) +{ + wxRect rect(rectOrig); + + // Make the edit control large enough to allow for internal + // margins + // + // TODO: remove this if the text ctrl sizing is improved esp. for + // unix + // +#if defined(__WXGTK__) + if (rect.x != 0) + { + rect.x += 1; + rect.y += 1; + rect.width -= 1; + rect.height -= 1; + } +#else // !GTK + int extra_x = ( rect.x > 2 )? 2 : 1; + +// MB: treat MSW separately here otherwise the caret doesn't show +// when the editor is in the first row. +#if defined(__WXMSW__) + int extra_y = 2; +#else + int extra_y = ( rect.y > 2 )? 2 : 1; +#endif // MSW + +#if defined(__WXMOTIF__) + extra_x *= 2; + extra_y *= 2; +#endif + rect.SetLeft( wxMax(0, rect.x - extra_x) ); + rect.SetTop( wxMax(0, rect.y - extra_y) ); + rect.SetRight( rect.GetRight() + 2*extra_x ); + rect.SetBottom( rect.GetBottom() + 2*extra_y ); +#endif // GTK/!GTK + + wxGridCellEditor::SetSize(rect); +} + +void wxGridCellPathEditor::BeginEdit(int row, int col, wxGrid* grid) +{ + wxASSERT_MSG(m_control, + wxT("The wxGridCellEditor must be Created first!")); + + m_startValue = grid->GetTable()->GetValue(row, col); + + DoBeginEdit(m_startValue); +} + +void wxGridCellPathEditor::DoBeginEdit(const wxString& startValue) +{ + Text()->SetValue(startValue); + Text()->SetInsertionPointEnd(); + Text()->SetSelection(-1,-1); + Text()->SetFocus(); +} + +bool wxGridCellPathEditor::EndEdit(int row, int col, + wxGrid* grid) +{ + wxASSERT_MSG(m_control, + wxT("The wxGridCellEditor must be Created first!")); + + bool changed = false; + wxString value = Text()->GetValue(); + if (value != m_startValue) + changed = true; + + if (changed) + grid->GetTable()->SetValue(row, col, value); + + m_startValue = wxEmptyString; + // No point in setting the text of the hidden control + //Text()->SetValue(m_startValue); + + return changed; +} + + +void wxGridCellPathEditor::Reset() +{ + wxASSERT_MSG(m_control, + wxT("The wxGridCellEditor must be Created first!")); + + DoReset(m_startValue); +} + +void wxGridCellPathEditor::DoReset(const wxString& startValue) +{ + Text()->SetValue(startValue); + Text()->SetInsertionPointEnd(); +} + +bool wxGridCellPathEditor::IsAcceptedKey(wxKeyEvent& event) +{ + return wxGridCellEditor::IsAcceptedKey(event); +} + +void wxGridCellPathEditor::StartingKey(wxKeyEvent& event) +{ + // Since this is now happening in the EVT_CHAR event EmulateKeyPress is no + // longer an appropriate way to get the character into the text control. + // Do it ourselves instead. We know that if we get this far that we have + // a valid character, so not a whole lot of testing needs to be done. + + wxTextCtrl* tc = Text(); + wxChar ch; + long pos; + +#if wxUSE_UNICODE + ch = event.GetUnicodeKey(); + if (ch <= 127) + ch = (wxChar)event.GetKeyCode(); +#else + ch = (wxChar)event.GetKeyCode(); +#endif + switch (ch) + { + case WXK_DELETE: + // delete the character at the cursor + pos = tc->GetInsertionPoint(); + if (pos < tc->GetLastPosition()) + tc->Remove(pos, pos+1); + break; + + case WXK_BACK: + // delete the character before the cursor + pos = tc->GetInsertionPoint(); + if (pos > 0) + tc->Remove(pos-1, pos); + break; + + default: + tc->WriteText(ch); + break; + } +} + +void wxGridCellPathEditor::HandleReturn( wxKeyEvent &event ) +{ +#if defined(__WXMOTIF__) || defined(__WXGTK__) + // wxMotif needs a little extra help... + size_t pos = (size_t)( Text()->GetInsertionPoint() ); + wxString s( Text()->GetValue() ); + s = s.Left(pos) + wxT("\n") + s.Mid(pos); + Text()->SetValue(s); + Text()->SetInsertionPoint( pos ); +#else + // the other ports can handle a Return key press + // + event.Skip(); +#endif +} + +void wxGridCellPathEditor::SetParameters(const wxString& params) +{ + if ( !params ) + { + // reset to default + m_maxChars = 0; + } + else + { + long tmp; + if ( !params.ToLong(&tmp) ) + { + wxLogDebug(_T("Invalid wxGridCellPathEditor parameter string '%s' ignored"), params.c_str()); + } + else + { + m_maxChars = (size_t)tmp; + } + } +} + +// return the value in the text control +wxString wxGridCellPathEditor::GetValue() const +{ + return Text()->GetValue(); +} + +#endif + +///////////////////////////////////////////////////////////////////////////// +// wxPropertyItem + +// returns true when this property item is a filepath +bool wxPropertyItem::IsFilePath() +{ + return m_nItemType == wxPropertyList::FILE; +} + +// returns true when this property item is a dir path +bool wxPropertyItem::IsDirPath() +{ + return m_nItemType == wxPropertyList::PATH; +} + +///////////////////////////////////////////////////////////////////////////// +// wxPropertyList + +wxPropertyList::~wxPropertyList() +{ + WX_CLEAR_ARRAY(m_PropertyItems); +} + +int wxPropertyList::AddItem(const wxString &txt) +{ + // TODO: Add the item to the grid! + + //int nIndex = AddString(txt); + //return nIndex; + + return 0; +} + +// order = 0 sorted (not supported yet) +// order = 1 add to top +// order = 2 add to bottom +int wxPropertyList::AddPropItem(wxPropertyItem* pItem, int order) +{ + m_PropertyItems.Add(pItem); + if(pItem->GetAdvanced() && ! m_ShowAdvanced) + return 0; + + // disable in progress editing + HideControls(); + + return AddPropertyToGrid(pItem, order); +} + +int wxPropertyList::AddPropertyToGrid(wxPropertyItem *pItem, int order) +{ + int row = 0; + if(order == 1) + InsertRows(0,1); + else + { + AppendRows(1); + row = GetNumberRows() - 1; + } + + // initialise the type of renderer + if(pItem->GetItemType() == wxPropertyList::CHECKBOX) + { + SetCellRenderer(row, 1, new wxGridCellBoolRenderer); + SetCellEditor(row, 1, new wxGridCellBoolEditor); + } + +#ifdef __LINUX__ + // fix to make sure scrollbars are drawn properly + wxGrid::AdjustScrollbars(); +#endif + + // the property display is read only + UpdatePropertyItem(pItem, row); + return row; +} + +void wxPropertyList::AddProperty(const char* name, const char* value, const char* helpString, + int type, const char* comboItems, bool reverseOrder, bool advanced) +{ + wxPropertyItem* pItem = 0; + + // add or update the property item + for(size_t i = 0; i < m_PropertyItems.Count(); i++) + { + if(m_PropertyItems[i]->GetPropName().IsSameAs(name)) + { + pItem = m_PropertyItems[i]; + if(!pItem->GetCurValue().IsSameAs(value)) + { + pItem->SetCurValue(value); + pItem->SetHelpString(helpString); + pItem->SetAdvanced(advanced); + + // update the property item + int row = FindProperty(pItem); + if(row != -1) + UpdatePropertyItem(pItem, row); + } + return; + } + } + + // if it is not found, then create a new one + if(!pItem) + { + pItem = new wxPropertyItem(name, value, helpString, type, comboItems); + pItem->SetAdvanced(advanced); + + AddPropItem(pItem, 1); + } +} + +void wxPropertyList::UpdateGridView() +{ + // make sure all items are shown, remove items that should not be shown + bool keepItem; + int row; + for(size_t i = 0; i < m_PropertyItems.Count(); i++) + { + // to begin with, does this item fit the query? + keepItem = m_strQuery.IsEmpty() || (m_PropertyItems[i]->GetPropName().Find(m_strQuery) != -1); + if(keepItem) + { + // when advanced items are allowed to be shown, keep when ok + if(!m_ShowAdvanced) + keepItem = !m_PropertyItems[i]->GetAdvanced(); + } + + // find the item, if not present but keep is true, add, if + // present but keep is false, remove + row = -1; + for(size_t j = 0; j < (size_t)GetNumberRows(); j++) + { + if(m_PropertyItems[i]->GetPropName().IsSameAs(GetCellValue(j, 0))) + { + row = j; + break; + } + } + + if(row == -1 && keepItem) + AddPropertyToGrid(m_PropertyItems[i], (m_ShowAdvanced ? 2 : 0)); + else if(row != -1 && !keepItem) + DeleteRows(row, 1); + } + +#ifdef __LINUX__ + // fix to make sure scrollbars are drawn properly + wxGrid::AdjustScrollbars(); +#endif +} + +void wxPropertyList::HideControls() +{ + DisableCellEditControl(); +} + +void wxPropertyList::RemoveProperty(wxPropertyItem *pItem) +{ + HideControls(); + + // look for property in grid, delete it when present + for(size_t j = 0; j < (size_t)GetNumberRows(); j++) + { + if(pItem->GetPropName().IsSameAs(GetCellValue(j, 0), false)) + { + DeleteRows(j, 1); + +#ifdef __LINUX__ + // fix to make sure scrollbars are drawn properly + wxGrid::AdjustScrollbars(); +#endif + break; + } + } + + // delete the item from the list + m_PropertyItems.Remove(pItem); + delete pItem; +} + +wxPropertyItem *wxPropertyList::FindPropertyByName(const wxString &name) +{ + for(size_t i = 0; i < m_PropertyItems.Count(); i++) + { + // we have an advanced item, go through table and if not present, show it + if(m_PropertyItems[i]->GetPropName().IsSameAs(name, true)) + return m_PropertyItems[i]; + } + + return 0; +} + +/** +void wxPropertyList::OnIgnore() +{ + if(m_curSel == -1 || this->GetCount() <= 0) + { + return; + } + wxPropertyItem* pItem = (wxPropertyItem*) GetItemDataPtr(m_curSel); + pItem->m_curValue = "IGNORE"; + InvalidateList(); +} +*/ + +/** +void wxPropertyList::OnDelete() +{ + if(m_curSel == -1 || this->GetCount() <= 0) + { + return; + } + wxPropertyItem* pItem = (wxPropertyItem*) GetItemDataPtr(m_curSel); + m_CMakeSetupDialog->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(pItem->m_propName); + m_PropertyItems.erase(pItem); + delete pItem; + this->DeleteString(m_curSel); + this->HideControls(); + this->SetTopIndex(0); + InvalidateList(); +} +*/ + +/** +void wxPropertyList::OnHelp() +{ + if(m_curSel == -1 || this->GetCount() <= 0) + { + return; + } + wxPropertyItem* pItem = (wxPropertyItem*) GetItemDataPtr(m_curSel); + MessageBox(pItem->m_HelpString, pItem->m_propName, MB_OK|MB_ICONINFORMATION); +} +*/ + +void wxPropertyList::RemoveAll() +{ + WX_CLEAR_ARRAY(m_PropertyItems); + m_generatedProjects = false; + + if(GetNumberRows() > 0) + DeleteRows(0, GetNumberRows()); + + m_strQuery.Empty(); + +#ifdef __LINUX__ + // fix to make sure scrollbars are drawn properly + wxGrid::AdjustScrollbars(); +#endif +} + +void wxPropertyList::ShowAdvanced() +{ + // set flag in the control + m_ShowAdvanced = true; + UpdateGridView(); +} + + +void wxPropertyList::HideAdvanced() +{ + // set flag in the control + m_ShowAdvanced = false; + UpdateGridView(); +} + +int wxPropertyList::FindProperty(wxPropertyItem *pItem) +{ + if(GetNumberRows() > 0 && pItem != 0) + { + // find the property the traditional way + for(size_t j = 0; j < (size_t)GetNumberRows(); j++) + { + if(pItem->GetPropName().IsSameAs(GetCellValue(j, 0))) + return j; + } + } + + return -1; +} + +wxPropertyItem *wxPropertyList::GetPropertyItemFromRow(int row) +{ + if(row < GetNumberRows() && row >= 0) + { + wxString str = GetCellValue(row, 0); + // find the property the traditional way + for(size_t i = 0; i < (size_t)m_PropertyItems.Count(); i++) + { + if(m_PropertyItems[i]->GetPropName().IsSameAs(str)) + return m_PropertyItems[i]; + } + } + + return 0; +} + +bool wxPropertyList::UpdatePropertyItem(wxPropertyItem *pItem, int row) +{ + wxCHECK(row < GetNumberRows(), false); + + // reflect the property's state to match the grid row + + SetReadOnly(row, 0); + // TODO: Make this a UpdatePropItem where ADVANCED, and new edit values are reflected + SetCellValue(row,0, pItem->GetPropName()); + + // boolean renderer + if(pItem->GetItemType() == wxPropertyList::CHECKBOX) + { + // translate ON or TRUE (case insensitive to a checkbox) + if(pItem->GetCurValue().IsSameAs(wxT("ON"), false) || + pItem->GetCurValue().IsSameAs(wxT("TRUE"), false)) + SetCellValue(row, 1, wxT("1")); + else + SetCellValue(row, 1, wxT("0")); + } + else + { + // for normal path values, give bold in cell when + // the NOTFOUND is present, for emphasis + wxString str = pItem->GetPropName() + wxT("-NOTFOUND"); + if(pItem->GetCurValue().IsSameAs(str)) + { + wxFont fnt = GetCellFont(row, 0); + fnt.SetWeight(wxFONTWEIGHT_BOLD); + SetCellFont(row, 1, fnt); + } + else + SetCellFont(row, 1, GetCellFont(row, 0)); + + SetCellValue(row,1, pItem->GetCurValue()); + } + + if(pItem->GetCurValue().IsSameAs("IGNORE")) + { + // ignored cell is completely dimmed + wxColour col(192,192,192); + SetCellTextColour(row, 1, col); + } + else + { + // we colour paths blue, filenames green, all else black + wxColour col; + if(pItem->IsDirPath()) + col.Set(0,0,255); + else if(pItem->IsFilePath()) + col.Set(0,128,0); + else + col = GetCellTextColour(row, 0); + + SetCellTextColour(row, 1, col); + } + + if(pItem->GetNewValue()) + { + // new cell is red + wxColour col(255,100,100); + SetCellBackgroundColour(row, 0, col); + } + else + { + // old cell is grey + wxColour col(192, 192, 192); + SetCellBackgroundColour(row, 0, col); + } + + return true; +} + +void wxPropertyList::OnSelectCell( wxGridEvent& event ) +{ + this->SetFocus(); + event.Skip(); +} + +void wxPropertyList::OnCellChange( wxGridEvent& event ) +{ + int row = event.GetRow(); + + wxPropertyItem *pItem = GetPropertyItemFromRow(row); + if(pItem && row != wxNOT_FOUND) + { + // write propery back, and set as new + pItem->SetNewValue(true); + + // write back bool + if(pItem->GetItemType() == CHECKBOX) + { + if(GetCellValue(row, 1).IsSameAs("1")) + pItem->SetCurValue("ON"); + else + pItem->SetCurValue("OFF"); + } + else + pItem->SetCurValue(GetCellValue(row, 1)); + + UpdatePropertyItem(pItem, row); + event.Skip(); + } +} + +void wxPropertyList::OnCellPopup( wxGridEvent& event ) +{ + wxPoint pt; + int row = event.GetRow(); + + //pt = ::wxGetMousePosition(); + //ScreenToClient(pt); + + //row = YToRow(pt.y); + if(row != wxNOT_FOUND) + { + wxPropertyItem *pItem = GetPropertyItemFromRow(row); + + if(pItem) + { + // select the row first if already in selection, don't + // this will clear the previous selection + if(!IsInSelection(row, 0)) + SelectRow(row); + + // show popup menu + wxMenu *menu = AppResources::CreatePopupMenu(); + + // enable when it is browsable, and selected one only + wxMenuItem *item = menu->FindItem(ID_CACHE_BROWSE); + if(item) + item->Enable(IsSelectedItemBrowsable()); + + PopupMenu(menu); + + delete menu; + } + } +} + +void wxPropertyList::OnIgnoreCache( wxCommandEvent& event ) +{ + HideControls(); + + // ignore all selected items + for(size_t i = 0; i < (size_t)GetNumberRows(); i++) + { + if(IsInSelection(i, 0)) + { + wxPropertyItem *pItem = GetPropertyItemFromRow(i); + if(pItem) + { + pItem->SetCurValue("IGNORE"); + UpdatePropertyItem(pItem, i); + } + } + } +} + +void wxPropertyList::OnDeleteCache( wxCommandEvent& event ) +{ + HideControls(); + + // convert selections to prop items + wxArrayPtrVoid items; + for(size_t i = 0; i < (size_t)GetNumberRows(); i++) + { + // if selected, query for removal + if(IsInSelection(i, 0)) + { + wxPropertyItem *pItem = GetPropertyItemFromRow(i); + if(pItem) + items.Add((void *)pItem); + } + } + + // now delete all prop items in cells + for(size_t i = 0; i < items.Count(); i++) + RemoveProperty((wxPropertyItem *)items[i]); +} + +void wxPropertyList::OnBrowseItem( wxCommandEvent& event ) +{ + BrowseSelectedItem(); +} + +bool wxPropertyList::IsSelectedItemBrowsable(int row) +{ + // when there is only one selection, and our current item + // is browsable, make sure it can be selected. + wxPropertyItem *pItem = 0; + + size_t count = 0; + for(size_t i = 0; i < (size_t)GetNumberRows() && (count < 2); i++) + { + if(IsInSelection(i, 0)) + { + if(!pItem) + pItem = GetPropertyItemFromRow(i); + count ++; + } + } + + // if we found nothing, take row (because the event EVT_GRID_CELL_SELECTED + // deselects the cells first before selecting the new one again + if(row != -1 && !pItem) + { + pItem = GetPropertyItemFromRow(row); + count ++; // needed because of next loop + } + + // only one item allowed to select + if(pItem && count == 1) + { + if(pItem) + return pItem->IsDirPath() || pItem->IsFilePath(); + } + + return false; +} + + +void wxPropertyList::BrowseSelectedItem() +{ + HideControls(); + + for(size_t i = 0; i < (size_t)GetNumberRows(); i++) + { + if(IsInSelection(i, 0)) + { + // browse for file or directory + wxPropertyItem *pItem = GetPropertyItemFromRow(i); + if(pItem) + { + wxString title; + wxString str = pItem->GetPropName() + _("-NOTFOUND"); + if(pItem->GetCurValue().IsSameAs(str, true)) + str.Empty(); + else + str = pItem->GetCurValue(); + + // browse the directory path + + if(pItem->IsDirPath()) + { + title = _("Select path for ") + pItem->GetPropName(); + str = ::wxDirSelector(title, str, 0, wxDefaultPosition, this); + } + else if(pItem->IsFilePath()) + { + title = _("Select file for ") + pItem->GetPropName(); + str = ::wxFileSelector(title, str, _(""), _(""), _(MC_DEFAULT_WILDCARD), wxFILE_MUST_EXIST, this); + } + else + str.Empty(); + + if(!str.IsEmpty()) + { + pItem->SetCurValue(str.c_str()); + UpdatePropertyItem(pItem, i); + } + } + + // only allow one item to browse + break; + } + } +} + +void wxPropertyList::OnSizeGrid( wxSizeEvent &event ) +{ + int width, height; + + // make sure the grid's cells are equally adjusted + GetClientSize(&width, &height); + SetDefaultColSize(width / 2, true); + + wxGrid::AdjustScrollbars(); +} + +void wxPropertyList::OnKeyPressed( wxKeyEvent &event ) +{ + event.Skip(); +} diff --git a/Source/WXDialog/PropertyList.h b/Source/WXDialog/PropertyList.h new file mode 100644 index 0000000..8dbf4da --- /dev/null +++ b/Source/WXDialog/PropertyList.h @@ -0,0 +1,339 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef __WXPROPERTYLIST_H +#define __WXPROPERTYLIST_H + + +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include +#include + +#include "../cmStandardIncludes.h" + +#ifdef __LINUX__ + #define MC_DEFAULT_WILDCARD "*" +#else + #define MC_DEFAULT_WILDCARD "*.*" +#endif + +#if 0 + +// the editor for string/text data +class wxGridCellPathEditor : public wxGridCellEditor +{ +public: + wxGridCellPathEditor(); + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler); + virtual void SetSize(const wxRect& rect); + + virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + + virtual bool IsAcceptedKey(wxKeyEvent& event); + virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); + + virtual void Reset(); + virtual void StartingKey(wxKeyEvent& event); + virtual void HandleReturn(wxKeyEvent& event); + + // parameters string format is "max_width" + virtual void SetParameters(const wxString& params); + + virtual wxGridCellEditor *Clone() const + { return new wxGridCellPathEditor; } + + // DJC MAPTEK + // added GetValue so we can get the value which is in the control + virtual wxString GetValue() const; +protected: + wxTextCtrl *Text() const { return (wxTextCtrl *)m_control; } + + // parts of our virtual functions reused by the derived classes + void DoBeginEdit(const wxString& startValue); + void DoReset(const wxString& startValue); + +private: + size_t m_maxChars; // max number of chars allowed + wxString m_startValue; + + DECLARE_NO_COPY_CLASS(wxGridCellPathEditor) +}; + +#endif + +///////////////////////////////////////////////////////////////////////////// +//wxPropertyItem Items +class wxPropertyItem +{ +public: + wxPropertyItem(const wxString &propName, const wxString &curValue, + const wxString &helpString, int nItemType, const wxString &cmbItems) + : m_NewValue(true) + , m_HelpString(helpString) + , m_Removed(false) + , m_propName(propName) + , m_curValue(curValue) + , m_nItemType(nItemType) + , m_cmbItems(cmbItems) + , m_Advanced(false) + { + //m_NewValue = true; + //m_HelpString = helpString; + //m_Removed = false; + //m_propName = propName; + //m_curValue = curValue; + //m_nItemType = nItemType; + //m_cmbItems = cmbItems; + //m_Advanced = false; + } + + const wxString &GetCurValue() const { + return m_curValue; + }; + + const wxString &GetPropName() const { + return m_propName; + }; + + void SetCurValue(const char *str) { + m_curValue = str; + }; + + void SetPropName(const char *str) { + m_propName = str; + }; + + void SetAdvanced(bool value) { + m_Advanced = value; + }; + + void SetHelpString(const char *str) { + m_HelpString = str; + }; + + bool GetAdvanced() const { + return m_Advanced; + }; + + void SetNewValue(bool value) { + m_NewValue = value; + }; + + bool GetNewValue() const { + return m_NewValue; + }; + + int GetItemType() const { + return m_nItemType; + }; + + const wxString &GetHelpString() const { + return m_HelpString; + }; + + // returns true when this property item is a filepath + bool IsFilePath(); + + // returns true when this property item is a dir path + bool IsDirPath(); + +private: + wxString m_HelpString; + wxString m_propName; + wxString m_curValue; + int m_nItemType; + wxString m_cmbItems; + bool m_NewValue; + bool m_Removed; + bool m_Advanced; +}; + +WX_DEFINE_ARRAY(wxPropertyItem *, wxPropertyItems); + +///////////////////////////////////////////////////////////////////////////// +// wxPropertyList Grid +class wxPropertyList : public wxGrid +{ +// Construction +public: + wxPropertyList(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxWANTS_CHARS, + const wxString& name = wxPanelNameStr) + : wxGrid(parent, id, pos, size, style, name) + { + }; + + enum ItemType + { + COMBO = 0, + EDIT, + COLOR, + FONT, + FILE, + CHECKBOX, + PATH + }; + + virtual ~wxPropertyList(); + +public: + bool GetShowAdvanced() const { + return m_ShowAdvanced; + }; + + void SetProjectGenerated(bool value) { + m_generatedProjects = value; + }; + + bool IsGenerated() { + return m_generatedProjects; + }; + + int AddItem(const wxString &txt); + + void AddProperty(const char* name, const char* value, const char* helpString, int type, + const char* comboItems, bool reverseOrder, bool advanced); + + void RemoveProperty(wxPropertyItem *pItem); + + void HideControls(); + void ShowAdvanced(); + void HideAdvanced(); + + void RemoveAll(); + + wxPropertyItem* GetItem(size_t index) { + wxCHECK(index < GetCount(), 0); + return m_PropertyItems[index]; + }; + + size_t GetCount() const { + return m_PropertyItems.Count(); + }; + + const wxPropertyItems &GetItems() { + return m_PropertyItems; + }; + + void SetShowAdvanced(bool value) { + m_ShowAdvanced = value; + }; + + bool UpdatePropertyItem(wxPropertyItem *pItem, int row); + + /** Returns the row of the grid on which the item is found. -1 is returned when not found */ + int FindProperty(wxPropertyItem *pItem); + + /** Returns true when the cache is still dirty, which means + after a configuration run, there are still new items */ + bool IsCacheDirty() { + // check if we have items that are new + for(size_t i = 0; i < m_PropertyItems.Count(); i++) + { + //if((m_PropertyItems[i]->GetNewValue() && m_ShowAdvanced && m_PropertyItems[i]->GetAdvanced()) || + // (m_PropertyItems[i]->GetNewValue() && !m_ShowAdvanced)) + if(m_PropertyItems[i]->GetNewValue()) + return true; + } + + // return flag if generated cache or not + return false; + }; + + /** Returns the property item from the current row. 0 if no property item found */ + wxPropertyItem *GetPropertyItemFromRow(int row); + + /** Finds the property by name and returns the property item */ + wxPropertyItem *FindPropertyByName(const wxString &name); + + /** Sets the search filter. Making sure that the items currently displayed + match this substring query */ + void SetQuery(const wxString &query) { + m_strQuery = query; + UpdateGridView(); + }; + + /** Returns the last used query. */ + const wxString &GetQuery() { + return m_strQuery; + }; + + /** Function that tries to browse for the item that is selected */ + void BrowseSelectedItem(); + + /** Returns true when the item is browsable (file or path) and only one item is + selected */ + bool IsSelectedItemBrowsable(int row = -1); + +private: + // order = 0 sorted + // order = 1 add to top + // order = 2 add to bottom + int AddPropItem(wxPropertyItem* pItem, int order); + + /** Adds the property item to the grid. */ + int AddPropertyToGrid(wxPropertyItem *pItem, int order) ; + + /** Adds / removes all the items that are currently (not) matching the + query filter */ + void UpdateGridView(); + + void OnSelectCell( wxGridEvent& event ); + + void OnCellChange( wxGridEvent& event ); + + void OnCellPopup( wxGridEvent& event ); + + void OnIgnoreCache( wxCommandEvent& event ); + + void OnDeleteCache( wxCommandEvent& event ); + + void OnSizeGrid( wxSizeEvent &event ); + + void OnBrowseItem( wxCommandEvent& event ); + + void OnKeyPressed( wxKeyEvent &event ); + + 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; + bool m_ShowAdvanced; + // flag to indicate the last cache load has resulted + // in generating a valid project + bool m_generatedProjects; + wxString m_strQuery; + wxPropertyItems m_PropertyItems; + + DECLARE_EVENT_TABLE() +}; + +#endif diff --git a/Source/WXDialog/about.html b/Source/WXDialog/about.html new file mode 100644 index 0000000..52187ed --- /dev/null +++ b/Source/WXDialog/about.html @@ -0,0 +1,21 @@ + + +CMake - CMakeSetup GUI Build System + + + +CMake - CMakeSetup GUI Build System +

Welcome to CMake! The cross-platform, open-source make system. + +CMake is used to control the software compilation process using simple platform and compiler independent configuration files. +CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. +Please go to http://www.cmake.org to learn more about CMake.

+CMakeSetup.exe is enhanced and ported to wxWidgets 2.6.0 by Jorgen Bodde (jorgb@xs4all.nl).
+Current CMakeSetup version is: @V@
+Current CMake build system is: @B@

+Current generators are supported:
+@G@ +
+

+ + diff --git a/Source/WXDialog/aboutdlg.cpp b/Source/WXDialog/aboutdlg.cpp new file mode 100644 index 0000000..e87b96e --- /dev/null +++ b/Source/WXDialog/aboutdlg.cpp @@ -0,0 +1,210 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma implementation "aboutdlg.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +////@begin includes +////@end includes + +#include "cmake_logo.xpm" +#include "aboutdlg.h" + +////@begin XPM images +////@end XPM images + +/*! + * CMAboutDlg type definition + */ + +IMPLEMENT_DYNAMIC_CLASS( CMAboutDlg, wxDialog ) + +/*! + * CMAboutDlg event table definition + */ + +BEGIN_EVENT_TABLE( CMAboutDlg, wxDialog ) + +////@begin CMAboutDlg event table entries + EVT_BUTTON( ID_ABOUT_DLG_OK, CMAboutDlg::OnAboutDlgClick ) + +////@end CMAboutDlg event table entries + +END_EVENT_TABLE() + +/*! + * CMAboutDlg constructors + */ + +CMAboutDlg::CMAboutDlg( ) +{ +} + +CMAboutDlg::CMAboutDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ + Create(parent, id, caption, pos, size, style); +} + +/*! + * CMAboutDlg creator + */ + +bool CMAboutDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ +////@begin CMAboutDlg member initialisation + m_cmIcon = NULL; + m_html = NULL; +////@end CMAboutDlg member initialisation + +////@begin CMAboutDlg creation + SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); + wxDialog::Create( parent, id, caption, pos, size, style ); + + CreateControls(); + GetSizer()->Fit(this); + GetSizer()->SetSizeHints(this); + Centre(); +////@end CMAboutDlg creation + + // set logo on the dialog + wxBitmap bmp(cmake_logo); + m_cmIcon->SetBitmap(bmp); + + return TRUE; +} + +/*! + * Control creation for CMAboutDlg + */ + +void CMAboutDlg::CreateControls() +{ +////@begin CMAboutDlg content construction + CMAboutDlg* itemDialog1 = this; + + wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); + itemDialog1->SetSizer(itemBoxSizer2); + + wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(1, 2, 0, 0); + itemFlexGridSizer3->AddGrowableRow(0); + itemFlexGridSizer3->AddGrowableCol(1); + itemBoxSizer2->Add(itemFlexGridSizer3, 1, wxGROW|wxALL, 5); + + wxBitmap m_cmIconBitmap(wxNullBitmap); + m_cmIcon = new wxStaticBitmap( itemDialog1, wxID_STATIC, m_cmIconBitmap, wxDefaultPosition, wxSize(32, 32), 0 ); + itemFlexGridSizer3->Add(m_cmIcon, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxLEFT|wxRIGHT|wxTOP, 5); + + m_html = new wxHtmlWindow( itemDialog1, ID_HTMLWINDOW, wxDefaultPosition, wxSize(500, 300), wxHW_SCROLLBAR_AUTO|wxNO_BORDER|wxHSCROLL|wxVSCROLL ); + itemFlexGridSizer3->Add(m_html, 1, wxGROW|wxGROW|wxRIGHT|wxTOP|wxBOTTOM, 5); + + wxButton* itemButton6 = new wxButton( itemDialog1, ID_ABOUT_DLG_OK, _("&Ok"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer2->Add(itemButton6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + +////@end CMAboutDlg content construction +} + +/*! + * Should we show tooltips? + */ + +bool CMAboutDlg::ShowToolTips() +{ + return TRUE; +} + +void CMAboutDlg::SetAboutText(const wxString &cmversion, const wxString &cmsversion, const wxArrayString &generators) +{ + // set HTML text in window + + wxString text = _("CMakeSetup - GUI Build System for CMake" + "CMakeSetup - GUI Build System for CMake" + "

Welcome to CMake! The cross-platform, open-source make system." + "CMake is used to control the software compilation process using simple platform and compiler independent configuration files. " + "CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. " + "Please go to http://www.cmake.org to learn more about CMake.

" + "CMakeSetup.exe is enhanced and ported by Jorgen Bodde using @WXV@. The original CMakeSetup.exe is " + "written by Bill Hoffman, Ken Martin, Brad King and Andy Cedilnik.

" + "Current CMakeSetup version is: @B@
" + "Current CMake build system is: @V@

" + "Current generators are supported:
" + "@G@

"); + + // compile list of generators in a bulleted list + wxString gens = _("
    "); + for(size_t i = 0; i < generators.Count(); i++) + gens << "
  • " << generators[i] << "
  • "; + gens << _("
"); + + // replace stuff + text.Replace(_("@V@"), cmversion, true); + text.Replace(_("@B@"), cmsversion, true); + text.Replace(_("@G@"), gens, true); + text.Replace(_("@WXV@"), wxVERSION_STRING, true); + + m_html->SetPage(text); + + // set color of HTML window to bg window + m_html->SetBackgroundColour(GetBackgroundColour()); +} + +/*! + * Get bitmap resources + */ + +wxBitmap CMAboutDlg::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin CMAboutDlg bitmap retrieval + return wxNullBitmap; +////@end CMAboutDlg bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon CMAboutDlg::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin CMAboutDlg icon retrieval + return wxNullIcon; +////@end CMAboutDlg icon retrieval +} +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ABOUT_DLG_OK + */ + +void CMAboutDlg::OnAboutDlgClick( wxCommandEvent& event ) +{ + Close(); +} + + diff --git a/Source/WXDialog/aboutdlg.h b/Source/WXDialog/aboutdlg.h new file mode 100644 index 0000000..712f986 --- /dev/null +++ b/Source/WXDialog/aboutdlg.h @@ -0,0 +1,117 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef _ABOUTDLG_H_ +#define _ABOUTDLG_H_ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "aboutdlg.cpp" +#endif + +/*! + * Includes + */ + +////@begin includes +#include "wx/html/htmlwin.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxHtmlWindow; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define ID_SOME_ABOUTDLG 10003 +#define SYMBOL_CMABOUTDLG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_CMABOUTDLG_TITLE _("About ...") +#define SYMBOL_CMABOUTDLG_IDNAME ID_SOME_ABOUTDLG +#define SYMBOL_CMABOUTDLG_SIZE wxSize(400, 300) +#define SYMBOL_CMABOUTDLG_POSITION wxDefaultPosition +#define ID_HTMLWINDOW 10000 +#define ID_ABOUT_DLG_OK 10005 +////@end control identifiers + +/*! + * Compatibility + */ + +#ifndef wxCLOSE_BOX +#define wxCLOSE_BOX 0x1000 +#endif +#ifndef wxFIXED_MINSIZE +#define wxFIXED_MINSIZE 0 +#endif + +/*! + * CMAboutDlg class declaration + */ + +class CMAboutDlg: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( CMAboutDlg ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + CMAboutDlg( ); + CMAboutDlg( wxWindow* parent, wxWindowID id = SYMBOL_CMABOUTDLG_IDNAME, const wxString& caption = SYMBOL_CMABOUTDLG_TITLE, const wxPoint& pos = SYMBOL_CMABOUTDLG_POSITION, const wxSize& size = SYMBOL_CMABOUTDLG_SIZE, long style = SYMBOL_CMABOUTDLG_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CMABOUTDLG_IDNAME, const wxString& caption = SYMBOL_CMABOUTDLG_TITLE, const wxPoint& pos = SYMBOL_CMABOUTDLG_POSITION, const wxSize& size = SYMBOL_CMABOUTDLG_SIZE, long style = SYMBOL_CMABOUTDLG_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + + void SetAboutText(const wxString &cmversion, const wxString &cmsversion, const wxArrayString &generators); + +////@begin CMAboutDlg event handler declarations + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ABOUT_DLG_OK + void OnAboutDlgClick( wxCommandEvent& event ); + +////@end CMAboutDlg event handler declarations + +////@begin CMAboutDlg member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end CMAboutDlg member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin CMAboutDlg member variables + wxStaticBitmap* m_cmIcon; + wxHtmlWindow* m_html; +////@end CMAboutDlg member variables +}; + +#endif + // _ABOUTDLG_H_ diff --git a/Source/WXDialog/app_resources.cpp b/Source/WXDialog/app_resources.cpp new file mode 100644 index 0000000..430e568 --- /dev/null +++ b/Source/WXDialog/app_resources.cpp @@ -0,0 +1,86 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma implementation "app_resources.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +////@begin includes +////@end includes + +#include "app_resources.h" + +////@begin XPM images +////@end XPM images + +/*! + * Resource functions + */ + +////@begin AppResources resource functions +/*! + * Menu creation function for ID_MENU + */ + +wxMenu* AppResources::CreatePopupMenu() +{ + wxMenu* itemMenu1 = new wxMenu; + itemMenu1->Append(ID_CACHE_IGNORE, _("&Ignore cache entry"), _("Ignores the value of the current cache entry"), wxITEM_NORMAL); + itemMenu1->Append(ID_CACHE_DELETE, _("&Delete cache entry"), _("Deletes the current cache entry (reverts on next configure)"), wxITEM_NORMAL); + itemMenu1->AppendSeparator(); + itemMenu1->Append(ID_CACHE_BROWSE, _("&Browse ..."), _T(""), wxITEM_NORMAL); + return itemMenu1; +} + +////@end AppResources resource functions + +/*! + * Get bitmap resources + */ + +wxBitmap AppResources::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin AppResources bitmap retrieval + return wxNullBitmap; +////@end AppResources bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon AppResources::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin AppResources icon retrieval + return wxNullIcon; +////@end AppResources icon retrieval +} diff --git a/Source/WXDialog/app_resources.h b/Source/WXDialog/app_resources.h new file mode 100644 index 0000000..75175b2 --- /dev/null +++ b/Source/WXDialog/app_resources.h @@ -0,0 +1,60 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef _APP_RESOURCES_H_ +#define _APP_RESOURCES_H_ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "app_resources.cpp" +#endif + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define ID_CACHE_IGNORE 10051 +#define ID_CACHE_DELETE 10052 +#define ID_CACHE_BROWSE 10053 +////@end control identifiers + +class AppResources +{ +public: + AppResources() {} + +/*! + * Resource functions + */ + +////@begin AppResources resource functions + /// Menu creation function for ID_MENU + static wxMenu* CreatePopupMenu(); + + /// Retrieves bitmap resources + static wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + static wxIcon GetIconResource( const wxString& name ); +////@end AppResources resource functions + +}; + +#endif + // _APP_RESOURCES_H_ diff --git a/Source/WXDialog/changelog.txt b/Source/WXDialog/changelog.txt new file mode 100644 index 0000000..3f94d0e --- /dev/null +++ b/Source/WXDialog/changelog.txt @@ -0,0 +1,22 @@ +Changes for new CMakeSetup dialog (v0.9) +- Cancel button on progress dialog now cancels the process +- Generator cannot be chosen anymore after there are cache items (this is pointless anyway) +- Drop target on grid (a folder) will load this in the build path and load up the cache +- Deletion of cache before something is generated, will ask the user if this is what he/she wants +- Reloading of cache added, after deleting cache items (and it was a mistake, a reload can bring it back to previous state) +- Added a search query. Typing a substring will narrow the search. When ENTER is pressed the substring is stored in the search query history for easy lookup +- Added a message display window, that will show all messages for easy copy-pasting and reference. This also obsoleted the "stop reporting errors" option +- A status percentage is shown in the task bar (when configuring, next to the configure window) +- Added menu bar with most common options (reload cache, delete cache, options, about etc) +- Added browse option in context menu on grid. Blue and green items are browsable (paths and files) +- Added about dialog +- Added options dialog (for future options) +- OPTION cache items are now implemented as checkboxes instead of comboboxes. Easier to double click instead of figuring out if you want to go up or down for YES or NO +- Added XP look to window (XP manifest) +- Added progress dialog that shows configuration progress +- Closing of dialog can be postponed by SHIFT (when option "close after generation is done" is selected) +- Window position X, Y and size is remembered between sessions +- Added most recent used list, with 5 last used build directories for easy lookup +- Cache options for paths are colored blue, cache options for files are green, and the rest is black +- NOTFOUND entries are made bold for easy recognition +- The selected item is described in a seperate text box for easy reading instead of in the statusbar diff --git a/Source/WXDialog/cmake_icon.gif b/Source/WXDialog/cmake_icon.gif new file mode 100644 index 0000000..ccf1f99 Binary files /dev/null and b/Source/WXDialog/cmake_icon.gif differ diff --git a/Source/WXDialog/cmake_icon.xpm b/Source/WXDialog/cmake_icon.xpm new file mode 100644 index 0000000..e26354c --- /dev/null +++ b/Source/WXDialog/cmake_icon.xpm @@ -0,0 +1,276 @@ +/* XPM */ +static char *Pixmap[] = { +"16 16 256 3", +"000 c black", +"001 c #003F00", +"002 c #003F3F", +"003 c #3F0000", +"004 c #3F003F", +"005 c #3F3F00", +"006 c gray19", +"007 c #00007F", +"008 c #007F00", +"009 c #306F30", +"010 c #7F0000", +"011 c #606060", +"012 c #0000BF", +"013 c blue", +"014 c #00BF00", +"015 c green", +"016 c #BF0000", +"017 c red", +"018 c #909090", +"019 c #C0C0C0", +"020 c none", +"021 c black", +"022 c black", +"023 c black", +"024 c black", +"025 c black", +"026 c black", +"027 c black", +"028 c black", +"029 c black", +"030 c black", +"031 c black", +"032 c black", +"033 c black", +"034 c black", +"035 c black", +"036 c black", +"037 c black", +"038 c black", +"039 c black", +"040 c black", +"041 c black", +"042 c black", +"043 c black", +"044 c black", +"045 c black", +"046 c black", +"047 c black", +"048 c black", +"049 c black", +"050 c black", +"051 c black", +"052 c black", +"053 c black", +"054 c black", +"055 c black", +"056 c black", +"057 c black", +"058 c black", +"059 c black", +"060 c black", +"061 c black", +"062 c black", +"063 c black", +"064 c black", +"065 c black", +"066 c black", +"067 c black", +"068 c black", +"069 c black", +"070 c black", +"071 c black", +"072 c black", +"073 c black", +"074 c black", +"075 c black", +"076 c black", +"077 c black", +"078 c black", +"079 c black", +"080 c black", +"081 c black", +"082 c black", +"083 c black", +"084 c black", +"085 c black", +"086 c black", +"087 c black", +"088 c black", +"089 c black", +"090 c black", +"091 c black", +"092 c black", +"093 c black", +"094 c black", +"095 c black", +"096 c black", +"097 c black", +"098 c black", +"099 c black", +"100 c black", +"101 c black", +"102 c black", +"103 c black", +"104 c black", +"105 c black", +"106 c black", +"107 c black", +"108 c black", +"109 c black", +"110 c black", +"111 c black", +"112 c black", +"113 c black", +"114 c black", +"115 c black", +"116 c black", +"117 c black", +"118 c black", +"119 c black", +"120 c black", +"121 c black", +"122 c black", +"123 c black", +"124 c black", +"125 c black", +"126 c black", +"127 c black", +"128 c black", +"129 c black", +"130 c black", +"131 c black", +"132 c black", +"133 c black", +"134 c black", +"135 c black", +"136 c black", +"137 c black", +"138 c black", +"139 c black", +"140 c black", +"141 c black", +"142 c black", +"143 c black", +"144 c black", +"145 c black", +"146 c black", +"147 c black", +"148 c black", +"149 c black", +"150 c black", +"151 c black", +"152 c black", +"153 c black", +"154 c black", +"155 c black", +"156 c black", +"157 c black", +"158 c black", +"159 c black", +"160 c black", +"161 c black", +"162 c black", +"163 c black", +"164 c black", +"165 c black", +"166 c black", +"167 c black", +"168 c black", +"169 c black", +"170 c black", +"171 c black", +"172 c black", +"173 c black", +"174 c black", +"175 c black", +"176 c black", +"177 c black", +"178 c black", +"179 c black", +"180 c black", +"181 c black", +"182 c black", +"183 c black", +"184 c black", +"185 c black", +"186 c black", +"187 c black", +"188 c black", +"189 c black", +"190 c black", +"191 c black", +"192 c black", +"193 c black", +"194 c black", +"195 c black", +"196 c black", +"197 c black", +"198 c black", +"199 c black", +"200 c black", +"201 c black", +"202 c black", +"203 c black", +"204 c black", +"205 c black", +"206 c black", +"207 c black", +"208 c black", +"209 c black", +"210 c black", +"211 c black", +"212 c black", +"213 c black", +"214 c black", +"215 c black", +"216 c black", +"217 c black", +"218 c black", +"219 c black", +"220 c black", +"221 c black", +"222 c black", +"223 c black", +"224 c black", +"225 c black", +"226 c black", +"227 c black", +"228 c black", +"229 c black", +"230 c black", +"231 c black", +"232 c black", +"233 c black", +"234 c black", +"235 c black", +"236 c black", +"237 c black", +"238 c black", +"239 c black", +"240 c black", +"241 c black", +"242 c black", +"243 c black", +"244 c black", +"245 c black", +"246 c black", +"247 c black", +"248 c black", +"249 c black", +"250 c black", +"251 c black", +"252 c black", +"253 c black", +"254 c black", +"255 c black", +"020020020020020020020020020020020020020020020020", +"020020020020020020020000000020020020020020020020", +"020020020020020020020000003020020020020020020020", +"020020020020020020000012010000020020020020020020", +"020020020020020020007013010003020020020020020020", +"020020020020020000013013010016000020020020020020", +"020020020020020007013013004017003020020020020020", +"020020020020000013013013007017016000020020020020", +"020020020020007013013012006017017003020020020020", +"020020020000012013012018011017017016000020020020", +"020020020007013012009018019010017017003020020020", +"020020000013012014015014009010017017016000020020", +"020020007007014015015015015008005016017003020020", +"020000002015015015015015015015015014005010000020", +"020000008008008008008008008008008008008001000020", +"020020020020020020020020020020020020020020020020" +}; diff --git a/Source/WXDialog/cmake_logo.xpm b/Source/WXDialog/cmake_logo.xpm new file mode 100644 index 0000000..9184125 --- /dev/null +++ b/Source/WXDialog/cmake_logo.xpm @@ -0,0 +1,50 @@ +/* XPM */ +static char *cmake_logo[] = { +"32 30 16 2", +"00 c #00CC00", +"01 c #3333CC", +"02 c gray60", +"03 c #99CC99", +"04 c gray80", +"05 c red", +"06 c none", +"07 c black", +"08 c black", +"09 c black", +"10 c black", +"11 c black", +"12 c black", +"13 c black", +"14 c black", +"15 c black", +"0606060606060606060606060606060601060606060606060606060606060606", +"0606060606060606060606060606060601060606060606060606060606060606", +"0606060606060606060606060606060101050606060606060606060606060606", +"0606060606060606060606060606060101050606060606060606060606060606", +"0606060606060606060606060606010101050506060606060606060606060606", +"0606060606060606060606060606010101050506060606060606060606060606", +"0606060606060606060606060601010101050505060606060606060606060606", +"0606060606060606060606060601010101050505060606060606060606060606", +"0606060606060606060606060101010101050505050606060606060606060606", +"0606060606060606060606060101010101050505050606060606060606060606", +"0606060606060606060606010101010101050505050506060606060606060606", +"0606060606060606060606010101010101010505050506060606060606060606", +"0606060606060606060601010101010101010505050505060606060606060606", +"0606060606060606060601010101010101010505050505060606060606060606", +"0606060606060606060101010101010101010505050505050606060606060606", +"0606060606060606060101010101010101010505050505050606060606060606", +"0606060606060606010101010101010101040505050505050506060606060606", +"0606060606060606010101010101010104040505050505050506060606060606", +"0606060606060601010101010101010404040505050505050505060606060606", +"0606060606060601010101010101040404040505050505050505060606060606", +"0606060606060101010101010404040404040505050505050505050606060606", +"0606060606060101010101010404040404040505050505050505050606060606", +"0606060606010101010100000003040404040405050505050505050506060606", +"0606060606010101010000000000000004040405050505050505050506060606", +"0606060601010101000000000000000000000305050505050505050505060606", +"0606060601010100000000000000000000000000000505050505050505060606", +"0606060101000000000000000000000000000000000000050505050505050606", +"0606060100000000000000000000000000000000000000000000050505050606", +"0606010000000000000000000000000000000000000000000000000005050506", +"0606000000000000000000000000000000000000000000000000000000000006" +}; diff --git a/Source/WXDialog/cmakesetup.done.xml b/Source/WXDialog/cmakesetup.done.xml new file mode 100644 index 0000000..40a317a --- /dev/null +++ b/Source/WXDialog/cmakesetup.done.xml @@ -0,0 +1,2 @@ + diff --git a/Source/WXDialog/cmakesetup.xml b/Source/WXDialog/cmakesetup.xml new file mode 100644 index 0000000..c8e3b78 --- /dev/null +++ b/Source/WXDialog/cmakesetup.xml @@ -0,0 +1,95 @@ + diff --git a/Source/WXDialog/config.h b/Source/WXDialog/config.h new file mode 100644 index 0000000..33b75c6 --- /dev/null +++ b/Source/WXDialog/config.h @@ -0,0 +1,43 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef __CMAKE_CONFIG_H__ +#define __CMAKE_CONFIG_H__ + +#define CM_LASTPROJECT_PATH "LastProjectPath" // last project path for CMakeLists.txt in edit box +#define CM_LASTBUILD_PATH "LastBuildPath" // last build path for cache in edit box +#define CM_MAX_RECENT_PATHS 5 // max amount most recent used paths in menu +#define CM_MAX_SEARCH_QUERIES 10 // max amount of entries in search query window +#define CM_RECENT_BUILD_PATH "LastRecentPath" // will be enumerated like LastRecentPath0 LastRecentPath1 etc +#define CM_SEARCH_QUERY "SearchQuery" // will be enumerated like SearchQuery0 SearchQuery1 etc +#define CM_XSIZE "CMakeXSize" // x size of window +#define CM_YSIZE "CMakeYSize" // y size of window +#define CM_XPOS "CMakeXPos" // x pos of window +#define CM_YPOS "CMakeYPos" // y pos of window +#define CM_SPLITTERPOS "CMakeSplitterPos" // position of splitter window + +#define CM_CLOSEAFTERGEN "CMakeCloseAfterGenerate" // close CMake after succesful generation (old behaviour) +#define CM_CLOSEAFTERGEN_DEF false // inherit default false when not present + +#define CM_RECENT_BUILD_ITEM 10000 // ID of menu item for recent builds +#define CMAKEGUI_MAJORVER 0 // major build +#define CMAKEGUI_MINORVER 9 // minor build +#define CMAKEGUI_ADDVER "b" // postfix (beta, alpha, none) + +#endif diff --git a/Source/WXDialog/optionsdlg.cpp b/Source/WXDialog/optionsdlg.cpp new file mode 100644 index 0000000..55c62d9 --- /dev/null +++ b/Source/WXDialog/optionsdlg.cpp @@ -0,0 +1,199 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma implementation "optionsdlg.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +////@begin includes +////@end includes + +#include "optionsdlg.h" + +////@begin XPM images +////@end XPM images + +/*! + * CMOptionsDlg type definition + */ + +IMPLEMENT_DYNAMIC_CLASS( CMOptionsDlg, wxDialog ) + +/*! + * CMOptionsDlg event table definition + */ + +BEGIN_EVENT_TABLE( CMOptionsDlg, wxDialog ) + +////@begin CMOptionsDlg event table entries + EVT_CHECKBOX( ID_CHECKBOX_CLOSECMAKE, CMOptionsDlg::OnButtonOK ) + +////@end CMOptionsDlg event table entries + +END_EVENT_TABLE() + +/*! + * CMOptionsDlg constructors + */ + +CMOptionsDlg::CMOptionsDlg( ) +{ +} + +CMOptionsDlg::CMOptionsDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ + Create(parent, id, caption, pos, size, style); +} + +/*! + * CMOptionsDlg creator + */ + +bool CMOptionsDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ +////@begin CMOptionsDlg member initialisation + m_closeAfterGenerate = NULL; +////@end CMOptionsDlg member initialisation + +////@begin CMOptionsDlg creation + SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); + wxDialog::Create( parent, id, caption, pos, size, style ); + + CreateControls(); + Centre(); +////@end CMOptionsDlg creation + return TRUE; +} + +/*! + * Control creation for CMOptionsDlg + */ + +void CMOptionsDlg::CreateControls() +{ +////@begin CMOptionsDlg content construction + CMOptionsDlg* itemDialog1 = this; + + wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); + itemDialog1->SetSizer(itemBoxSizer2); + + wxNotebook* itemNotebook3 = new wxNotebook( itemDialog1, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxNB_TOP ); + + wxPanel* itemPanel4 = new wxPanel( itemNotebook3, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); + itemPanel4->SetSizer(itemBoxSizer5); + + itemBoxSizer5->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + m_closeAfterGenerate = new wxCheckBox( itemPanel4, ID_CHECKBOX_CLOSECMAKE, _("Close down CMakeSetup after generation of project"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + m_closeAfterGenerate->SetValue(FALSE); + itemBoxSizer5->Add(m_closeAfterGenerate, 0, wxALIGN_LEFT|wxALL, 5); + + itemNotebook3->AddPage(itemPanel4, _("General")); + + itemBoxSizer2->Add(itemNotebook3, 1, wxGROW|wxALL|wxFIXED_MINSIZE, 5); + + wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer2->Add(itemBoxSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); + + wxButton* itemButton9 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer8->Add(itemButton9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxButton* itemButton10 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer8->Add(itemButton10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + +////@end CMOptionsDlg content construction +} + +/*! + * Should we show tooltips? + */ + +bool CMOptionsDlg::ShowToolTips() +{ + return TRUE; +} + +/*! + * Get bitmap resources + */ + +wxBitmap CMOptionsDlg::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin CMOptionsDlg bitmap retrieval + return wxNullBitmap; +////@end CMOptionsDlg bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon CMOptionsDlg::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin CMOptionsDlg icon retrieval + return wxNullIcon; +////@end CMOptionsDlg icon retrieval +} + +void CMOptionsDlg::SetConfig(wxConfig *cfg) +{ + bool boolval; + + // close after generation + cfg->Read(CM_CLOSEAFTERGEN, &boolval, CM_CLOSEAFTERGEN_DEF); + m_closeAfterGenerate->SetValue(boolval); +} + +void CMOptionsDlg::GetConfig(wxConfig *cfg) +{ + // close after generation + cfg->Write(CM_CLOSEAFTERGEN, m_closeAfterGenerate->GetValue()); +} + +/*! + * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CLOSECMAKE + */ + +void CMOptionsDlg::OnButtonOK( wxCommandEvent& event ) +{ +////@begin wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CLOSECMAKE in CMOptionsDlg. + // Before editing this code, remove the block markers. + event.Skip(); +////@end wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CLOSECMAKE in CMOptionsDlg. +} + + + + + + diff --git a/Source/WXDialog/optionsdlg.h b/Source/WXDialog/optionsdlg.h new file mode 100644 index 0000000..3fe336c --- /dev/null +++ b/Source/WXDialog/optionsdlg.h @@ -0,0 +1,125 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef _OPTIONSDLG_H_ +#define _OPTIONSDLG_H_ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "optionsdlg.cpp" +#endif + +/*! + * Includes + */ + +////@begin includes +#include "wx/notebook.h" +////@end includes + +#include +#include "config.h" + +/*! + * Forward declarations + */ + +////@begin forward declarations +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define ID_DIALOG 10004 +#define SYMBOL_CMOPTIONSDLG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_CMOPTIONSDLG_TITLE _("CMakeSetup Options ...") +#define SYMBOL_CMOPTIONSDLG_IDNAME ID_DIALOG +#define SYMBOL_CMOPTIONSDLG_SIZE wxSize(400, 300) +#define SYMBOL_CMOPTIONSDLG_POSITION wxDefaultPosition +#define ID_NOTEBOOK 10006 +#define ID_PANEL 10007 +#define ID_CHECKBOX_CLOSECMAKE 10008 +////@end control identifiers + +/*! + * Compatibility + */ + +#ifndef wxCLOSE_BOX +#define wxCLOSE_BOX 0x1000 +#endif +#ifndef wxFIXED_MINSIZE +#define wxFIXED_MINSIZE 0 +#endif + +/*! + * CMOptionsDlg class declaration + */ + +class CMOptionsDlg: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( CMOptionsDlg ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + CMOptionsDlg( ); + CMOptionsDlg( wxWindow* parent, wxWindowID id = SYMBOL_CMOPTIONSDLG_IDNAME, const wxString& caption = SYMBOL_CMOPTIONSDLG_TITLE, const wxPoint& pos = SYMBOL_CMOPTIONSDLG_POSITION, const wxSize& size = SYMBOL_CMOPTIONSDLG_SIZE, long style = SYMBOL_CMOPTIONSDLG_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CMOPTIONSDLG_IDNAME, const wxString& caption = SYMBOL_CMOPTIONSDLG_TITLE, const wxPoint& pos = SYMBOL_CMOPTIONSDLG_POSITION, const wxSize& size = SYMBOL_CMOPTIONSDLG_SIZE, long style = SYMBOL_CMOPTIONSDLG_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + +////@begin CMOptionsDlg event handler declarations + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CLOSECMAKE + void OnButtonOK( wxCommandEvent& event ); + +////@end CMOptionsDlg event handler declarations + +////@begin CMOptionsDlg member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end CMOptionsDlg member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + + // write values from config to GUI controls + void SetConfig(wxConfig *cfg); + + // write GUI controls back to config + void GetConfig(wxConfig *cfg); + +private: + +////@begin CMOptionsDlg member variables + wxCheckBox* m_closeAfterGenerate; +////@end CMOptionsDlg member variables +}; + +#endif + // _OPTIONSDLG_H_ diff --git a/Source/WXDialog/progressdlg.cpp b/Source/WXDialog/progressdlg.cpp new file mode 100644 index 0000000..263d3e9 --- /dev/null +++ b/Source/WXDialog/progressdlg.cpp @@ -0,0 +1,177 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma implementation "progressdlg.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +////@begin includes +////@end includes + +#include "progressdlg.h" + +////@begin XPM images +////@end XPM images + +/*! + * CMProgressDialog type definition + */ + +IMPLEMENT_DYNAMIC_CLASS( CMProgressDialog, wxDialog ) + +/*! + * CMProgressDialog event table definition + */ + +BEGIN_EVENT_TABLE( CMProgressDialog, wxDialog ) + +////@begin CMProgressDialog event table entries + EVT_BUTTON( ID_CMAKE_BUTTON, CMProgressDialog::OnCmakeCancelClick ) + +////@end CMProgressDialog event table entries + +END_EVENT_TABLE() + +/*! + * CMProgressDialog constructors + */ + +CMProgressDialog::CMProgressDialog( ) +{ +} + +CMProgressDialog::CMProgressDialog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ + Create(parent, id, caption, pos, size, style); +} + +/*! + * CMProgressDialog creator + */ + +bool CMProgressDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +{ +////@begin CMProgressDialog member initialisation + m_textMessage = NULL; + m_progress = NULL; +////@end CMProgressDialog member initialisation + +////@begin CMProgressDialog creation + SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); + wxDialog::Create( parent, id, caption, pos, size, style ); + + CreateControls(); + GetSizer()->Fit(this); + GetSizer()->SetSizeHints(this); + Centre(); +////@end CMProgressDialog creation + + m_cancelPressed = false; + m_cancelling = false; + + return TRUE; +} + +/*! + * Control creation for CMProgressDialog + */ + +void CMProgressDialog::CreateControls() +{ +////@begin CMProgressDialog content construction + CMProgressDialog* itemDialog1 = this; + + wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); + itemDialog1->SetSizer(itemBoxSizer2); + + itemBoxSizer2->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + m_textMessage = new wxStaticText( itemDialog1, wxID_STATIC, _("Please wait while CMake configures ..."), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer2->Add(m_textMessage, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE, 5); + + wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer2->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + m_progress = new wxGauge( itemDialog1, ID_CMAKE_PROGRESS, 100, wxDefaultPosition, wxSize(250, 20), wxGA_HORIZONTAL ); + m_progress->SetValue(0); + itemBoxSizer5->Add(m_progress, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxButton* itemButton7 = new wxButton( itemDialog1, ID_CMAKE_BUTTON, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer2->Add(itemButton7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + + itemBoxSizer2->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP, 5); + +////@end CMProgressDialog content construction +} + +/*! + * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CMAKE_BUTTON + */ + +void CMProgressDialog::OnCmakeCancelClick( wxCommandEvent& event ) +{ + m_cancelPressed = true; +} + +/*! + * Should we show tooltips? + */ + +bool CMProgressDialog::ShowToolTips() +{ + return TRUE; +} + +/*! + * Get bitmap resources + */ + +wxBitmap CMProgressDialog::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin CMProgressDialog bitmap retrieval + return wxNullBitmap; +////@end CMProgressDialog bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon CMProgressDialog::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin CMProgressDialog icon retrieval + return wxNullIcon; +////@end CMProgressDialog icon retrieval +} + + + diff --git a/Source/WXDialog/progressdlg.h b/Source/WXDialog/progressdlg.h new file mode 100644 index 0000000..3465220 --- /dev/null +++ b/Source/WXDialog/progressdlg.h @@ -0,0 +1,139 @@ +/*========================================================================= + + Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Author: Jorgen Bodde + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef _PROGRESSDLG_H_ +#define _PROGRESSDLG_H_ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "progressdlg.cpp" +#endif + +/*! + * Includes + */ + +////@begin includes +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define ID_PROGRESSDLG 10000 +#define SYMBOL_CMPROGRESSDIALOG_STYLE wxRAISED_BORDER +#define SYMBOL_CMPROGRESSDIALOG_TITLE _("Progress Dialog") +#define SYMBOL_CMPROGRESSDIALOG_IDNAME ID_PROGRESSDLG +#define SYMBOL_CMPROGRESSDIALOG_SIZE wxSize(400, 300) +#define SYMBOL_CMPROGRESSDIALOG_POSITION wxDefaultPosition +#define ID_CMAKE_PROGRESS 10001 +#define ID_CMAKE_BUTTON 10002 +////@end control identifiers + +/*! + * Compatibility + */ + +#ifndef wxCLOSE_BOX +#define wxCLOSE_BOX 0x1000 +#endif +#ifndef wxFIXED_MINSIZE +#define wxFIXED_MINSIZE 0 +#endif + +/*! + * CMProgressDialog class declaration + */ + +class CMProgressDialog: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( CMProgressDialog ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + CMProgressDialog( ); + CMProgressDialog( wxWindow* parent, wxWindowID id = SYMBOL_CMPROGRESSDIALOG_IDNAME, const wxString& caption = SYMBOL_CMPROGRESSDIALOG_TITLE, const wxPoint& pos = SYMBOL_CMPROGRESSDIALOG_POSITION, const wxSize& size = SYMBOL_CMPROGRESSDIALOG_SIZE, long style = SYMBOL_CMPROGRESSDIALOG_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CMPROGRESSDIALOG_IDNAME, const wxString& caption = SYMBOL_CMPROGRESSDIALOG_TITLE, const wxPoint& pos = SYMBOL_CMPROGRESSDIALOG_POSITION, const wxSize& size = SYMBOL_CMPROGRESSDIALOG_SIZE, long style = SYMBOL_CMPROGRESSDIALOG_STYLE ); + + /// Creates the controls and sizers + void CreateControls(); + + void SetProgress(float progress) { + m_progress->SetValue((int)(progress * 100)); + }; + +////@begin CMProgressDialog event handler declarations + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CMAKE_BUTTON + void OnCmakeCancelClick( wxCommandEvent& event ); + +////@end CMProgressDialog event handler declarations + +////@begin CMProgressDialog member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end CMProgressDialog member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + + bool CancelPressed() const { + return m_cancelPressed; + }; + + void CancelAcknowledged() { + m_cancelling = true; + }; + + bool IsCancelling() const { + return m_cancelling; + }; + + void ResetCancel() { + m_cancelling = false; + m_cancelPressed = false; + }; + +////@begin CMProgressDialog member variables + wxStaticText* m_textMessage; + wxGauge* m_progress; +////@end CMProgressDialog member variables + +private: + bool m_cancelPressed; + bool m_cancelling; + +}; + +#endif + // _PROGRESSDLG_H_ -- cgit v0.12