2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2014-12-11 21:10:03 +03:00
|
|
|
#ifndef cmCursesMainForm_h
|
|
|
|
#define cmCursesMainForm_h
|
2001-11-05 02:05:21 +03:00
|
|
|
|
2016-09-01 22:55:09 +03:00
|
|
|
#include <cmConfigure.h>
|
2016-04-29 16:40:20 +03:00
|
|
|
|
2001-11-05 02:05:21 +03:00
|
|
|
#include "cmCursesForm.h"
|
2016-09-01 22:55:09 +03:00
|
|
|
#include "cmCursesStandardIncludes.h"
|
|
|
|
#include "cmState.h"
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2001-11-05 02:05:21 +03:00
|
|
|
|
|
|
|
class cmCursesCacheEntryComposite;
|
2002-08-29 00:35:54 +04:00
|
|
|
class cmake;
|
2001-11-05 02:05:21 +03:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/** \class cmCursesMainForm
|
|
|
|
* \brief The main page of ccmake
|
|
|
|
*
|
|
|
|
* cmCursesMainForm is the main page of ccmake.
|
|
|
|
*/
|
2001-11-05 02:05:21 +03:00
|
|
|
class cmCursesMainForm : public cmCursesForm
|
|
|
|
{
|
|
|
|
public:
|
2002-05-01 19:34:27 +04:00
|
|
|
cmCursesMainForm(std::vector<std::string> const& args, int initwidth);
|
2016-06-27 22:25:27 +03:00
|
|
|
~cmCursesMainForm() CM_OVERRIDE;
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
|
|
|
* Set the widgets which represent the cache entries.
|
|
|
|
*/
|
2001-11-30 00:44:22 +03:00
|
|
|
void InitializeUI();
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
|
|
|
* Handle user input.
|
|
|
|
*/
|
2016-06-27 22:25:27 +03:00
|
|
|
void HandleInput() CM_OVERRIDE;
|
2001-11-05 02:05:21 +03:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
|
|
|
* Display form. Use a window of size width x height, starting
|
|
|
|
* at top, left.
|
|
|
|
*/
|
2016-06-27 22:25:27 +03:00
|
|
|
void Render(int left, int top, int width, int height) CM_OVERRIDE;
|
2001-11-05 02:05:21 +03:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
|
|
|
* Returns true if an entry with the given key is in the
|
|
|
|
* list of current composites.
|
|
|
|
*/
|
2014-02-05 01:06:56 +04:00
|
|
|
bool LookForCacheEntry(const std::string& key);
|
2001-11-05 02:05:21 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
enum
|
|
|
|
{
|
2001-11-30 18:51:30 +03:00
|
|
|
MIN_WIDTH = 65,
|
|
|
|
MIN_HEIGHT = 6,
|
|
|
|
IDEAL_WIDTH = 80,
|
|
|
|
MAX_WIDTH = 512
|
|
|
|
};
|
2001-11-06 06:10:52 +03:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
2002-11-19 21:09:16 +03:00
|
|
|
* This method should normally be called only by the form. The only
|
|
|
|
* exception is during a resize. The optional argument specifies the
|
|
|
|
* string to be displayed in the status bar.
|
2001-12-13 21:28:41 +03:00
|
|
|
*/
|
2016-06-27 23:44:16 +03:00
|
|
|
void UpdateStatusBar() CM_OVERRIDE { this->UpdateStatusBar(CM_NULLPTR); }
|
2002-11-19 21:09:16 +03:00
|
|
|
virtual void UpdateStatusBar(const char* message);
|
2001-11-06 06:10:52 +03:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
2002-11-19 21:09:16 +03:00
|
|
|
* Display current commands and their keys on the toolbar. This
|
|
|
|
* method should normally called only by the form. The only
|
|
|
|
* exception is during a resize. If the optional argument process is
|
|
|
|
* specified and is either 1 (configure) or 2 (generate), then keys
|
|
|
|
* will be displayed accordingly.
|
2001-12-13 21:28:41 +03:00
|
|
|
*/
|
2002-11-19 21:09:16 +03:00
|
|
|
void PrintKeys(int process = 0);
|
2001-11-06 06:10:52 +03:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
|
|
|
* During a CMake run, an error handle should add errors
|
|
|
|
* to be displayed afterwards.
|
|
|
|
*/
|
2016-06-27 22:25:27 +03:00
|
|
|
void AddError(const char* message, const char* title) CM_OVERRIDE;
|
2001-11-30 00:44:22 +03:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
2003-05-29 19:14:48 +04:00
|
|
|
* Used to do a configure. If argument is specified, it does only the check
|
|
|
|
* and not configure.
|
2001-12-13 21:28:41 +03:00
|
|
|
*/
|
2016-05-16 17:34:04 +03:00
|
|
|
int Configure(int noconfigure = 0);
|
2002-09-06 21:00:12 +04:00
|
|
|
|
|
|
|
/**
|
2012-08-13 21:42:58 +04:00
|
|
|
* Used to generate
|
2002-09-06 21:00:12 +04:00
|
|
|
*/
|
|
|
|
int Generate();
|
2001-11-30 00:44:22 +03:00
|
|
|
|
2002-08-29 00:35:54 +04:00
|
|
|
/**
|
|
|
|
* Used by main program
|
|
|
|
*/
|
2016-05-16 17:34:04 +03:00
|
|
|
int LoadCache(const char* dir);
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2002-11-19 00:29:14 +03:00
|
|
|
/**
|
|
|
|
* Progress callback
|
|
|
|
*/
|
2016-05-16 17:34:04 +03:00
|
|
|
static void UpdateProgressOld(const char* msg, float prog, void*);
|
|
|
|
static void UpdateProgress(const char* msg, float prog, void*);
|
2002-11-19 00:29:14 +03:00
|
|
|
|
2001-11-05 02:05:21 +03:00
|
|
|
protected:
|
|
|
|
cmCursesMainForm(const cmCursesMainForm& from);
|
|
|
|
void operator=(const cmCursesMainForm&);
|
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
// Copy the cache values from the user interface to the actual
|
|
|
|
// cache.
|
2001-11-05 02:05:21 +03:00
|
|
|
void FillCacheManagerFromUI();
|
2004-06-23 18:13:02 +04:00
|
|
|
// Fix formatting of values to a consistent form.
|
2016-05-16 17:34:04 +03:00
|
|
|
void FixValue(cmState::CacheEntryType type, const std::string& in,
|
|
|
|
std::string& out) const;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Re-post the existing fields. Used to toggle between
|
|
|
|
// normal and advanced modes. Render() should be called
|
|
|
|
// afterwards.
|
2001-11-30 00:44:22 +03:00
|
|
|
void RePost();
|
2001-12-13 21:28:41 +03:00
|
|
|
// Remove an entry from the interface and the cache.
|
2001-11-30 00:44:22 +03:00
|
|
|
void RemoveEntry(const char* value);
|
2001-11-05 02:05:21 +03:00
|
|
|
|
2010-09-17 01:45:27 +04:00
|
|
|
// Jump to the cache entry whose name matches the string.
|
|
|
|
void JumpToCacheEntry(const char* str);
|
2003-03-07 19:27:28 +03:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
// Copies of cache entries stored in the user interface
|
2006-03-16 18:44:55 +03:00
|
|
|
std::vector<cmCursesCacheEntryComposite*>* Entries;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Errors produced during last run of cmake
|
2006-03-16 18:44:55 +03:00
|
|
|
std::vector<std::string> Errors;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Command line argumens to be passed to cmake each time
|
|
|
|
// it is run
|
2006-03-16 18:44:55 +03:00
|
|
|
std::vector<std::string> Args;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Message displayed when user presses 'h'
|
|
|
|
// It is: Welcome + info about current entry + common help
|
2006-03-16 18:44:55 +03:00
|
|
|
std::vector<std::string> HelpMessage;
|
2001-11-30 00:44:22 +03:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
// Common help
|
2001-11-30 00:44:22 +03:00
|
|
|
static const char* s_ConstHelpMessage;
|
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
// Fields displayed. Includes labels, new entry markers, entries
|
2006-03-16 18:44:55 +03:00
|
|
|
FIELD** Fields;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Where is source of current project
|
2006-03-16 18:44:55 +03:00
|
|
|
std::string WhereSource;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Where is cmake executable
|
2006-03-16 18:44:55 +03:00
|
|
|
std::string WhereCMake;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Number of entries shown (depends on mode -normal or advanced-)
|
2010-06-29 17:52:12 +04:00
|
|
|
size_t NumberOfVisibleEntries;
|
2006-03-16 18:44:55 +03:00
|
|
|
bool AdvancedMode;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Did the iteration converge (no new entries) ?
|
2006-03-16 18:44:55 +03:00
|
|
|
bool OkToGenerate;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Number of pages displayed
|
2006-03-16 18:44:55 +03:00
|
|
|
int NumberOfPages;
|
2001-11-06 06:10:52 +03:00
|
|
|
|
2006-03-16 18:44:55 +03:00
|
|
|
int InitialWidth;
|
2016-05-16 17:34:04 +03:00
|
|
|
cmake* CMakeInstance;
|
2003-03-07 19:27:28 +03:00
|
|
|
|
2006-03-16 18:44:55 +03:00
|
|
|
std::string SearchString;
|
|
|
|
std::string OldSearchString;
|
|
|
|
bool SearchMode;
|
2001-11-05 02:05:21 +03:00
|
|
|
};
|
|
|
|
|
2014-12-11 21:10:03 +03:00
|
|
|
#endif // cmCursesMainForm_h
|