1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
|
/*=========================================================================
Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake
Module: $RCSfile: CMakeSetupFrame.h,v $
Language: C++
Date: $Date: 2005-06-30 19:54:14 $
Version: $Revision: 1.1 $
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 <wx/config.h>
#include <wx/dataobj.h>
#include <wx/dnd.h>
#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_
|