~ubuntu-branches/ubuntu/lucid/cmake/lucid

« back to all changes in this revision

Viewing changes to Source/WXDialog/CMakeSetupFrame.h

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2009-12-16 11:11:54 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091216111154-6accvv6yq86h2hkc
Tags: 2.8.0-5ubuntu1
* Merge from debian testing (LP: #497349). Remaining changes:
  - Keep the Replaces: on cmake-data to cover the Kubuntu version from
    Jaunty in case someone decides to do an (unsupported) Jaunty->Lucid
    upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*=========================================================================
2
 
 
3
 
  Program:   WXDialog - wxWidgets X-platform GUI Front-End for CMake
4
 
  Module:    $RCSfile: CMakeSetupFrame.h,v $
5
 
  Language:  C++
6
 
  Date:      $Date: 2005-06-30 19:54:14 $
7
 
  Version:   $Revision: 1.1 $
8
 
 
9
 
  Author:    Jorgen Bodde
10
 
 
11
 
  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
12
 
  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
13
 
 
14
 
     This software is distributed WITHOUT ANY WARRANTY; without even 
15
 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
16
 
     PURPOSE.  See the above copyright notices for more information.
17
 
 
18
 
=========================================================================*/
19
 
 
20
 
#ifndef _CMAKESETUPFRAME_H_
21
 
#define _CMAKESETUPFRAME_H_
22
 
 
23
 
#if defined(__GNUG__) && !defined(__APPLE__)
24
 
#pragma interface "CMakeSetupFrame.cpp"
25
 
#endif
26
 
 
27
 
/*!
28
 
 * Includes
29
 
 */
30
 
 
31
 
////@begin includes
32
 
#include "wx/frame.h"
33
 
#include "wx/splitter.h"
34
 
#include "wx/grid.h"
35
 
#include "wx/statline.h"
36
 
#include "wx/statusbr.h"
37
 
////@end includes
38
 
 
39
 
#include <wx/config.h>
40
 
#include <wx/dataobj.h>
41
 
#include <wx/dnd.h>
42
 
 
43
 
 
44
 
#include "../cmake.h"
45
 
#include "progressdlg.h"
46
 
#include "optionsdlg.h"
47
 
#include "CommandLineInfo.h"
48
 
#include "config.h"
49
 
 
50
 
// this ID should be taken as base to make sure they are unique
51
 
// NOTE: DialogBlocks starts at 10100 so 10000 to 10099 are free
52
 
#define CM_NEXT_USABLEID      CM_RECENT_BUILD_ITEM + CM_MAX_RECENT_PATHS
53
 
 
54
 
/*!
55
 
 * Forward declarations
56
 
 */
57
 
 
58
 
////@begin forward declarations
59
 
class wxSplitterWindow;
60
 
class wxPropertyList;
61
 
////@end forward declarations
62
 
 
63
 
/*!
64
 
 * Control identifiers
65
 
 */
66
 
 
67
 
////@begin control identifiers
68
 
#define ID_FRAME 10100
69
 
#define SYMBOL_CMAKESETUPFRM_STYLE wxDEFAULT_FRAME_STYLE|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCLOSE_BOX|wxSUNKEN_BORDER
70
 
#define SYMBOL_CMAKESETUPFRM_TITLE _("CMake Setup v2.0.x")
71
 
#define SYMBOL_CMAKESETUPFRM_IDNAME ID_FRAME
72
 
#define SYMBOL_CMAKESETUPFRM_SIZE wxSize(600, 550)
73
 
#define SYMBOL_CMAKESETUPFRM_POSITION wxDefaultPosition
74
 
#define ID_SPLITTERWINDOW 10101
75
 
#define ID_MAINPANEL 10102
76
 
#define ID_PROJECT_PATH 10103
77
 
#define ID_BROWSE_PROJECT 10104
78
 
#define ID_SOURCE_BUILD_PATH 10105
79
 
#define ID_BROWSE_BUILD 10106
80
 
#define ID_CHOOSE_GENERATOR 10107
81
 
#define ID_SEARCHQUERY 10109
82
 
#define ID_SHOW_ADVANCED 10108
83
 
#define ID_OPTIONS 10110
84
 
#define ID_LOGPANEL 10111
85
 
#define ID_LOG_AREA 10112
86
 
#define ID_DESCRIPTION 10113
87
 
#define ID_DO_CONFIGURE 10114
88
 
#define ID_DO_OK 10115
89
 
#define ID_DO_CANCEL 10116
90
 
#define ID_DO_DELETE_CACHE 10117
91
 
#define ID_CLEAR_LOG 10118
92
 
#define ID_BROWSE_GRID 10119
93
 
#define ID_STATUSBAR 10120
94
 
#define ID_MENU_RELOAD_CACHE 10122
95
 
#define ID_MENU_DELETE_CACHE 10123
96
 
#define ID_MENU_QUIT 10125
97
 
#define ID_MENU_CONFIGURE 10126
98
 
#define ID_MENU_EXITGENERATE 10127
99
 
#define ID_MENU_TOGGLE_ADVANCED 10128
100
 
#define ID_CMAKE_OPTIONS 10124
101
 
#define ID_ABOUTDLG 10121
102
 
////@end control identifiers
103
 
 
104
 
/*!
105
 
 * Compatibility
106
 
 */
107
 
 
108
 
#ifndef wxCLOSE_BOX
109
 
#define wxCLOSE_BOX 0x1000
110
 
#endif
111
 
#ifndef wxFIXED_MINSIZE
112
 
#define wxFIXED_MINSIZE 0
113
 
#endif
114
 
 
115
 
class DnDFile : public wxFileDropTarget
116
 
{
117
 
public:
118
 
    DnDFile(wxTextCtrl *pOwner) 
119
 
        : m_pOwner(pOwner)
120
 
    {
121
 
    };
122
 
 
123
 
    virtual bool OnDropFiles(wxCoord x, wxCoord y,
124
 
                             const wxArrayString& filenames);
125
 
 
126
 
private:
127
 
    wxTextCtrl *m_pOwner;
128
 
};
129
 
 
130
 
 
131
 
/*!
132
 
 * CMakeSetupFrm class declaration
133
 
 */
134
 
 
135
 
class CMakeSetupFrm: public wxFrame
136
 
{    
137
 
    DECLARE_CLASS( CMakeSetupFrm )
138
 
    DECLARE_EVENT_TABLE()
139
 
 
140
 
public:
141
 
    /// Constructors
142
 
    CMakeSetupFrm( );
143
 
    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 );
144
 
 
145
 
    // Destructor
146
 
    virtual ~CMakeSetupFrm();
147
 
 
148
 
    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 );
149
 
 
150
 
    /// Creates the controls and sizers
151
 
    void CreateControls();
152
 
 
153
 
    /** Logs a message. For the kind parameter use; 
154
 
        1  - neutral message
155
 
        0  - warning message (blue text)
156
 
        -1 - error message (red text)
157
 
    */
158
 
    void LogMessage(int logkind, const char *msg);
159
 
 
160
 
    void UpdateProgress(float progress) {
161
 
        if(m_progressDlg)
162
 
            m_progressDlg->SetProgress(progress);
163
 
 
164
 
        // also show in the tiny field
165
 
        wxStatusBar *bar = GetStatusBar();
166
 
        if(bar)
167
 
        {
168
 
            wxString str;
169
 
            str.Printf("%2.1f %%", (progress * 100));
170
 
            bar->SetStatusText(str, 1);
171
 
        }
172
 
    };
173
 
 
174
 
    void IssueUpdate();
175
 
 
176
 
    /** Initialise all crap in the frame, like listing the make generators,
177
 
        selecting the best one to use, and loading the cache for the first time
178
 
        when the build paths were set */
179
 
    void DoInitFrame(cmCommandLineInfo &cm, const wxString &fn);
180
 
 
181
 
////@begin CMakeSetupFrm event handler declarations
182
 
 
183
 
    /// wxEVT_CLOSE_WINDOW event handler for ID_FRAME
184
 
    void OnCloseWindow( wxCloseEvent& event );
185
 
 
186
 
    /// wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING event handler for ID_SPLITTERWINDOW
187
 
    void OnSplitterPosChanging( wxSplitterEvent& event );
188
 
 
189
 
    /// wxEVT_COMMAND_SPLITTER_DOUBLECLICKED event handler for ID_SPLITTERWINDOW
190
 
    void OnSplitterwindowSashDClick( wxSplitterEvent& event );
191
 
 
192
 
    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_PROJECT
193
 
    void OnButtonBrowseProject( wxCommandEvent& event );
194
 
 
195
 
    /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_SOURCE_BUILD_PATH
196
 
    void OnSourceBuildPathUpdated( wxCommandEvent& event );
197
 
 
198
 
    /// wxEVT_COMMAND_TEXT_ENTER event handler for ID_SOURCE_BUILD_PATH
199
 
    void OnSourceBuildPathEnter( wxCommandEvent& event );
200
 
 
201
 
    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_BUILD
202
 
    void OnButtonBrowseBuild( wxCommandEvent& event );
203
 
 
204
 
    /// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_SEARCHQUERY
205
 
    void OnSearchquerySelected( wxCommandEvent& event );
206
 
 
207
 
    /// wxEVT_COMMAND_TEXT_UPDATED event handler for ID_SEARCHQUERY
208
 
    void OnSearchqueryUpdated( wxCommandEvent& event );
209
 
 
210
 
    /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_SHOW_ADVANCED
211
 
    void OnShowAdvancedValues( wxCommandEvent& event );
212
 
 
213
 
    /// wxEVT_GRID_CELL_CHANGE event handler for ID_OPTIONS
214
 
    void OnCellChange( wxGridEvent& event );
215
 
 
216
 
    /// wxEVT_GRID_SELECT_CELL event handler for ID_OPTIONS
217
 
    void OnGridSelectCell( wxGridEvent& event );
218
 
 
219
 
    /// wxEVT_MOTION event handler for ID_OPTIONS
220
 
    void OnPropertyMotion( wxMouseEvent& event );
221
 
 
222
 
    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_CONFIGURE
223
 
    void OnButtonConfigure( wxCommandEvent& event );
224
 
 
225
 
    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_OK
226
 
    void OnButtonOk( wxCommandEvent& event );
227
 
 
228
 
    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_CANCEL
229
 
    void OnButtonCancel( wxCommandEvent& event );
230
 
 
231
 
    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DO_DELETE_CACHE
232
 
    void OnButtonDeleteCache( wxCommandEvent& event );
233
 
 
234
 
    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CLEAR_LOG
235
 
    void OnClearLogClick( wxCommandEvent& event );
236
 
 
237
 
    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BROWSE_GRID
238
 
    void OnBrowseGridClick( wxCommandEvent& event );
239
 
 
240
 
    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_RELOAD_CACHE
241
 
    void OnMenuReloadCacheClick( wxCommandEvent& event );
242
 
 
243
 
    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_DELETE_CACHE
244
 
    void OnMenuDeleteCacheClick( wxCommandEvent& event );
245
 
 
246
 
    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_QUIT
247
 
    void OnMenuQuitClick( wxCommandEvent& event );
248
 
 
249
 
    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_CONFIGURE
250
 
    void OnMenuConfigureClick( wxCommandEvent& event );
251
 
 
252
 
    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_EXITGENERATE
253
 
    void OnMenuGenerateClick( wxCommandEvent& event );
254
 
 
255
 
    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_MENU_TOGGLE_ADVANCED
256
 
    void OnMenuToggleAdvancedClick( wxCommandEvent& event );
257
 
 
258
 
    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_CMAKE_OPTIONS
259
 
    void OnOptionsClick( wxCommandEvent& event );
260
 
 
261
 
    /// wxEVT_COMMAND_MENU_SELECTED event handler for ID_ABOUTDLG
262
 
    void OnAboutClick( wxCommandEvent& event );
263
 
 
264
 
////@end CMakeSetupFrm event handler declarations
265
 
 
266
 
    void OnRecentFileMenu( wxCommandEvent &event );
267
 
 
268
 
    void OnAddQuery ( wxCommandEvent &event );
269
 
 
270
 
////@begin CMakeSetupFrm member function declarations
271
 
 
272
 
    /// Retrieves bitmap resources
273
 
    wxBitmap GetBitmapResource( const wxString& name );
274
 
 
275
 
    /// Retrieves icon resources
276
 
    wxIcon GetIconResource( const wxString& name );
277
 
////@end CMakeSetupFrm member function declarations
278
 
 
279
 
    /// Should we show tooltips?
280
 
    static bool ShowToolTips();
281
 
 
282
 
        /** Load cache for the CMakeLists to the GUI */
283
 
    void LoadCacheFromDiskToGUI();
284
 
 
285
 
    /** Display the grid with the loaded cache. */
286
 
    void FillCacheGUIFromCacheManager();
287
 
 
288
 
    int RunCMake(bool generateProjectFiles);
289
 
 
290
 
    /** Save cache to disk from the GUI */
291
 
    void SaveCacheFromGUI();
292
 
 
293
 
    void FillCacheManagerFromCacheGUI();
294
 
 
295
 
    /** Update the cache and mark all the new items as old */
296
 
    bool PerformCacheRun();
297
 
 
298
 
    /** Shows the property matched by the row in the description area
299
 
        or nothing when the row is not correct */
300
 
    void ShowPropertyDescription(int row);
301
 
 
302
 
    /** Disable or enable controls based upon the internal state of the 
303
 
        program */
304
 
    void UpdateWindowState();
305
 
 
306
 
    void AppendPathToRecentList(const wxString &p);
307
 
 
308
 
    /** Used to synchonise any options that have immediate effect on the GUI
309
 
        form, like clearing a search list, resetting a spitter perhaps, etc */
310
 
    void SyncFormOptions(CMOptionsDlg *dlg);
311
 
 
312
 
    void DoCancelButton();
313
 
 
314
 
    void DoReloadCache();
315
 
 
316
 
    void DoDeleteCache();
317
 
 
318
 
    void DoConfigure();
319
 
 
320
 
    void DoGenerate();
321
 
 
322
 
    void OnExitTimer(wxTimerEvent &event);
323
 
 
324
 
////@begin CMakeSetupFrm member variables
325
 
    wxSplitterWindow* m_splitter;
326
 
    wxTextCtrl* m_cmProjectPath;
327
 
    wxButton* m_BrowseProjectPathButton;
328
 
    wxTextCtrl* m_cmBuildPath;
329
 
    wxButton* m_BrowseSourcePathButton;
330
 
    wxComboBox* m_cmGeneratorChoice;
331
 
    wxComboBox* m_cmSearchQuery;
332
 
    wxCheckBox* m_cmShowAdvanced;
333
 
    wxPropertyList* m_cmOptions;
334
 
    wxTextCtrl* m_cmLog;
335
 
    wxTextCtrl* m_cmDescription;
336
 
    wxButton* m_ConfigureButton;
337
 
    wxButton* m_OkButton;
338
 
    wxButton* m_CancelButton;
339
 
    wxButton* m_DeleteCacheButton;
340
 
    wxButton* m_ClearLogButton;
341
 
    wxButton* m_cmBrowseCell;
342
 
////@end CMakeSetupFrm member variables
343
 
 
344
 
    // this is the cmake instance with which we will communicate
345
 
    // to generate our stuff, and get the info from.
346
 
    cmake *m_cmake;
347
 
 
348
 
    // the config class for project build dir and source path
349
 
    wxTimer *m_ExitTimer;
350
 
    wxConfig *m_config;
351
 
    wxString m_PathToExecutable;
352
 
    wxArrayString m_recentPaths;
353
 
    CMProgressDialog *m_progressDlg;
354
 
    bool m_RunningConfigure;
355
 
    bool m_noRefresh;
356
 
    bool m_quitAfterGenerating;
357
 
};
358
 
 
359
 
#endif
360
 
    // _CMAKESETUPFRAME_H_