2002-01-21 23:30:43 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
2002-10-24 02:03:27 +04:00
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
2002-01-21 23:30:43 +03:00
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
2002-10-24 02:03:27 +04:00
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
2002-01-21 23:30:43 +03:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
=========================================================================*/
|
2001-11-05 02:05:21 +03:00
|
|
|
#ifndef __cmCursesMainForm_h
|
|
|
|
#define __cmCursesMainForm_h
|
|
|
|
|
2001-11-05 16:37:22 +03:00
|
|
|
#include "../cmStandardIncludes.h"
|
2001-11-05 02:05:21 +03:00
|
|
|
#include "cmCursesForm.h"
|
2001-11-05 21:24:44 +03:00
|
|
|
#include "cmCursesStandardIncludes.h"
|
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);
|
2001-11-05 02:05:21 +03:00
|
|
|
virtual ~cmCursesMainForm();
|
|
|
|
|
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();
|
2001-11-05 02:05:21 +03:00
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
|
|
|
* Handle user input.
|
|
|
|
*/
|
2001-11-05 02:05:21 +03:00
|
|
|
virtual void HandleInput();
|
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
|
|
|
* Display form. Use a window of size width x height, starting
|
|
|
|
* at top, left.
|
|
|
|
*/
|
2001-11-05 02:05:21 +03:00
|
|
|
virtual void Render(int left, int top, int width, int height);
|
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
|
|
|
* Returns true if an entry with the given key is in the
|
|
|
|
* list of current composites.
|
|
|
|
*/
|
2001-11-05 02:05:21 +03:00
|
|
|
bool LookForCacheEntry(const char* key);
|
|
|
|
|
2001-11-30 18:51:30 +03:00
|
|
|
enum {
|
|
|
|
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
|
|
|
/**
|
|
|
|
* This method should normally called only by the form.
|
|
|
|
* The only exception is during a resize.
|
|
|
|
*/
|
2001-11-30 00:44:22 +03:00
|
|
|
virtual void UpdateStatusBar();
|
2001-11-06 06:10:52 +03:00
|
|
|
|
2001-12-13 21:28:41 +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.
|
|
|
|
*/
|
2001-11-06 06:10:52 +03:00
|
|
|
void PrintKeys();
|
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
|
|
|
* During a CMake run, an error handle should add errors
|
|
|
|
* to be displayed afterwards.
|
|
|
|
*/
|
2001-11-30 00:44:22 +03:00
|
|
|
virtual void AddError(const char* message, const char* title);
|
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
/**
|
2002-09-06 21:00:12 +04:00
|
|
|
* Used to do a configure.
|
2001-12-13 21:28:41 +03:00
|
|
|
*/
|
2002-09-06 21:00:12 +04:00
|
|
|
int Configure();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to generate
|
|
|
|
*/
|
|
|
|
int Generate();
|
2001-11-30 00:44:22 +03:00
|
|
|
|
2002-08-29 00:35:54 +04:00
|
|
|
/**
|
|
|
|
* Used by main program
|
|
|
|
*/
|
|
|
|
void LoadCache(const char *dir);
|
|
|
|
|
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();
|
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
|
|
|
|
2001-12-13 21:28:41 +03:00
|
|
|
// Copies of cache entries stored in the user interface
|
2001-11-05 02:05:21 +03:00
|
|
|
std::vector<cmCursesCacheEntryComposite*>* m_Entries;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Errors produced during last run of cmake
|
2001-11-30 00:44:22 +03:00
|
|
|
std::vector<std::string> m_Errors;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Command line argumens to be passed to cmake each time
|
|
|
|
// it is run
|
2001-11-30 00:44:22 +03:00
|
|
|
std::vector<std::string> m_Args;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Message displayed when user presses 'h'
|
|
|
|
// It is: Welcome + info about current entry + common help
|
2001-11-30 00:44:22 +03:00
|
|
|
std::vector<std::string> m_HelpMessage;
|
|
|
|
|
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
|
2001-11-05 02:05:21 +03:00
|
|
|
FIELD** m_Fields;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Where is source of current project
|
2001-11-05 02:05:21 +03:00
|
|
|
std::string m_WhereSource;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Where is cmake executable
|
2001-11-06 20:03:36 +03:00
|
|
|
std::string m_WhereCMake;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Number of entries shown (depends on mode -normal or advanced-)
|
2001-11-30 00:44:22 +03:00
|
|
|
int m_NumberOfVisibleEntries;
|
|
|
|
bool m_AdvancedMode;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Did the iteration converge (no new entries) ?
|
2001-11-30 00:44:22 +03:00
|
|
|
bool m_OkToGenerate;
|
2001-12-13 21:28:41 +03:00
|
|
|
// Number of pages displayed
|
|
|
|
int m_NumberOfPages;
|
2001-11-06 06:10:52 +03:00
|
|
|
|
2002-05-01 19:34:27 +04:00
|
|
|
int m_InitialWidth;
|
2002-08-29 00:35:54 +04:00
|
|
|
cmake *m_CMakeInstance;
|
2001-11-05 02:05:21 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __cmCursesMainForm_h
|