CMake/Source/CursesDialog/cmCursesMainForm.cxx

740 lines
18 KiB
C++
Raw Normal View History

#include "../cmCacheManager.h"
#include "../cmSystemTools.h"
#include "../cmake.h"
2001-11-05 02:05:21 +03:00
#include "cmCursesMainForm.h"
#include "cmCursesStringWidget.h"
#include "cmCursesLabelWidget.h"
#include "cmCursesBoolWidget.h"
#include "cmCursesPathWidget.h"
#include "cmCursesFilePathWidget.h"
#include "cmCursesDummyWidget.h"
#include "cmCursesCacheEntryComposite.h"
2001-11-30 00:44:22 +03:00
#include "cmCursesLongMessageForm.h"
2001-11-05 02:05:21 +03:00
2001-11-06 06:10:52 +03:00
inline int ctrl(int z)
{
return (z&037);
}
2001-11-30 00:44:22 +03:00
cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args) :
m_Args(args)
2001-11-05 02:05:21 +03:00
{
m_Fields = 0;
m_Height = 0;
m_Entries = 0;
2001-11-30 00:44:22 +03:00
m_AdvancedMode = false;
m_NumberOfVisibleEntries = 0;
m_OkToGenerate = false;
m_HelpMessage.push_back(s_ConstHelpMessage);
2001-11-05 02:05:21 +03:00
}
cmCursesMainForm::~cmCursesMainForm()
{
if (m_Form)
{
unpost_form(m_Form);
free_form(m_Form);
m_Form = 0;
}
delete[] m_Fields;
// Clean-up composites
if (m_Entries)
{
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
{
delete *it;
}
}
delete m_Entries;
}
bool cmCursesMainForm::LookForCacheEntry(const char* key)
{
if (!key || !m_Entries)
{
return false;
}
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
{
if (!strcmp(key, (*it)->m_Key.c_str()))
{
return true;
}
}
return false;
}
2001-11-30 00:44:22 +03:00
void cmCursesMainForm::InitializeUI()
2001-11-05 02:05:21 +03:00
{
// Get the cache entries.
const cmCacheManager::CacheEntryMap &cache =
cmCacheManager::GetInstance()->GetCacheMap();
std::vector<cmCursesCacheEntryComposite*>* newEntries =
new std::vector<cmCursesCacheEntryComposite*>;
newEntries->reserve(cache.size());
// Count non-internal and non-static entries
int count=0;
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
i != cache.end(); ++i)
{
const cmCacheManager::CacheEntry& value = i->second;
if ( value.m_Type != cmCacheManager::INTERNAL &&
value.m_Type != cmCacheManager::STATIC )
{
++count;
}
}
cmCursesCacheEntryComposite* comp;
if ( count == 0 )
{
// If cache is empty, display a label saying so and a
// dummy entry widget (does not respond to input)
comp = new cmCursesCacheEntryComposite("EMPTY CACHE");
comp->m_Entry = new cmCursesDummyWidget(1, 1, 1, 1);
newEntries->push_back(comp);
}
else
{
// Create the composites.
// First add entries which are new
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
i != cache.end(); ++i)
{
const char* key = i->first.c_str();
const cmCacheManager::CacheEntry& value = i->second;
if ( value.m_Type == cmCacheManager::INTERNAL ||
value.m_Type == cmCacheManager::STATIC )
{
continue;
}
if (!this->LookForCacheEntry(key))
{
newEntries->push_back(new cmCursesCacheEntryComposite(key, value,
true));
2001-11-30 00:44:22 +03:00
m_OkToGenerate = false;
2001-11-05 02:05:21 +03:00
}
}
// then add entries which are old
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
i != cache.end(); ++i)
{
const char* key = i->first.c_str();
const cmCacheManager::CacheEntry& value = i->second;
if ( value.m_Type == cmCacheManager::INTERNAL ||
value.m_Type == cmCacheManager::STATIC )
{
continue;
}
if (this->LookForCacheEntry(key))
{
newEntries->push_back(new cmCursesCacheEntryComposite(key, value,
false));
}
}
}
if (m_Entries)
{
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
{
delete *it;
}
}
delete m_Entries;
m_Entries = newEntries;
2001-11-30 00:44:22 +03:00
this->RePost();
}
void cmCursesMainForm::RePost()
{
2001-11-05 02:05:21 +03:00
// Create the fields to be passed to the form.
if (m_Form)
{
unpost_form(m_Form);
free_form(m_Form);
m_Form = 0;
}
delete[] m_Fields;
2001-11-30 00:44:22 +03:00
if (m_AdvancedMode)
{
m_NumberOfVisibleEntries = m_Entries->size();
}
else
{
m_NumberOfVisibleEntries = 0;
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
{
if (!m_AdvancedMode && cmCacheManager::GetInstance()->IsAdvanced(
(*it)->GetValue()))
{
continue;
}
m_NumberOfVisibleEntries++;
}
}
m_Fields = new FIELD*[3*m_NumberOfVisibleEntries+1];
int j=0;
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
2001-11-05 02:05:21 +03:00
{
2001-11-30 00:44:22 +03:00
if (!m_AdvancedMode && cmCacheManager::GetInstance()->IsAdvanced(
(*it)->GetValue()))
{
continue;
}
m_Fields[3*j] = (*it)->m_Label->m_Field;
m_Fields[3*j+1] = (*it)->m_IsNewLabel->m_Field;
m_Fields[3*j+2] = (*it)->m_Entry->m_Field;
j++;
2001-11-05 02:05:21 +03:00
}
2001-11-30 00:44:22 +03:00
2001-11-05 02:05:21 +03:00
// Has to be null terminated.
2001-11-30 00:44:22 +03:00
m_Fields[3*m_NumberOfVisibleEntries] = 0;
2001-11-05 02:05:21 +03:00
}
void cmCursesMainForm::Render(int left, int top, int width, int height)
{
if (m_Form)
{
FIELD* currentField = current_field(m_Form);
cmCursesWidget* cw = reinterpret_cast<cmCursesWidget*>
(field_userptr(currentField));
if ( cw->GetType() == cmCacheManager::STRING ||
cw->GetType() == cmCacheManager::PATH ||
cw->GetType() == cmCacheManager::FILEPATH )
{
cmCursesStringWidget* sw = static_cast<cmCursesStringWidget*>(cw);
sw->SetInEdit(false);
}
unpost_form(m_Form);
free_form(m_Form);
m_Form = 0;
}
2001-11-06 06:10:52 +03:00
if ( width < cmCursesMainForm::MIN_WIDTH ||
height < cmCursesMainForm::MIN_HEIGHT )
2001-11-05 02:05:21 +03:00
{
return;
}
2001-11-30 00:44:22 +03:00
height -= 6;
2001-11-05 02:05:21 +03:00
m_Height = height;
2001-11-30 00:44:22 +03:00
if (m_AdvancedMode)
{
m_NumberOfVisibleEntries = m_Entries->size();
}
else
{
m_NumberOfVisibleEntries = 0;
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
{
if (!m_AdvancedMode && cmCacheManager::GetInstance()->IsAdvanced(
(*it)->GetValue()))
{
continue;
}
m_NumberOfVisibleEntries++;
}
}
2001-11-05 02:05:21 +03:00
bool isNewPage;
2001-11-30 00:44:22 +03:00
int i=0;
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
2001-11-05 02:05:21 +03:00
{
2001-11-30 00:44:22 +03:00
if (!m_AdvancedMode && cmCacheManager::GetInstance()->IsAdvanced(
(*it)->GetValue()))
{
continue;
}
2001-11-05 02:05:21 +03:00
int row = (i % height) + 1;
int page = (i / height) + 1;
isNewPage = ( page > 1 ) && ( row == 1 );
2001-11-30 00:44:22 +03:00
(*it)->m_Label->Move(left, top+row-1, isNewPage);
(*it)->m_IsNewLabel->Move(left+32, top+row-1, false);
(*it)->m_Entry->Move(left+33, top+row-1, false);
i++;
2001-11-05 02:05:21 +03:00
}
2001-11-30 00:44:22 +03:00
2001-11-05 02:05:21 +03:00
m_Form = new_form(m_Fields);
post_form(m_Form);
2001-11-06 06:10:52 +03:00
this->UpdateStatusBar();
this->PrintKeys();
2001-11-30 00:44:22 +03:00
touchwin(stdscr);
2001-11-05 02:05:21 +03:00
refresh();
}
2001-11-06 06:10:52 +03:00
void cmCursesMainForm::PrintKeys()
2001-11-05 02:05:21 +03:00
{
int x,y;
2001-11-30 00:44:22 +03:00
getmaxyx(stdscr, y, x);
2001-11-06 06:10:52 +03:00
if ( x < cmCursesMainForm::MIN_WIDTH ||
y < cmCursesMainForm::MIN_HEIGHT )
{
return;
}
char firstLine[512], secondLine[512];
2001-11-30 00:44:22 +03:00
if (m_OkToGenerate)
{
sprintf(firstLine, "C)onfigure G)enerate and Exit H)elp");
}
else
{
sprintf(firstLine, "C)onfigure H)elp");
}
if (m_AdvancedMode)
{
sprintf(secondLine, "Q)uit Without Generating T)oggle Advanced Mode (On)");
}
else
{
sprintf(secondLine, "Q)uit Without Generating T)oggle Advanced Mode (Off)");
}
2001-11-06 06:10:52 +03:00
curses_move(y-2,0);
2001-11-06 06:10:52 +03:00
printw(firstLine);
curses_move(y-1,0);
2001-11-06 06:10:52 +03:00
printw(secondLine);
pos_form_cursor(m_Form);
}
// Print the key of the current entry and the CMake version
// on the status bar. Designed for a width of 80 chars.
void cmCursesMainForm::UpdateStatusBar()
{
int x,y;
2001-11-30 00:44:22 +03:00
getmaxyx(stdscr, y, x);
2001-11-06 06:10:52 +03:00
if ( x < cmCursesMainForm::MIN_WIDTH ||
y < cmCursesMainForm::MIN_HEIGHT )
{
curses_clear();
curses_move(0,0);
2001-11-06 06:10:52 +03:00
printw("Window is too small. A size of at least %dx%d is required.",
cmCursesMainForm::MIN_WIDTH, cmCursesMainForm::MIN_HEIGHT);
2001-11-30 00:44:22 +03:00
touchwin(stdscr);
wrefresh(stdscr);
2001-11-06 06:10:52 +03:00
return;
}
FIELD* cur = current_field(m_Form);
int index = field_index(cur);
2001-11-30 00:44:22 +03:00
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
m_Fields[index-2]));
const char* curField = lbl->GetValue();
// We want to display this on the right
char help[128];
const char* helpString;
cmCacheManager::CacheEntry *entry =
cmCacheManager::GetInstance()->GetCacheEntry(curField);
if (entry)
{
helpString = entry->m_HelpString.c_str();
if (strlen(helpString) > 127)
{
sprintf(help,"%127s", helpString);
}
else
{
sprintf(help,"%s", helpString);
}
}
else
{
sprintf(help," ");
}
2001-11-05 02:05:21 +03:00
2001-11-06 06:10:52 +03:00
char bar[cmCursesMainForm::MAX_WIDTH];
int i, curFieldLen = strlen(curField);
2001-11-30 00:44:22 +03:00
int helpLen = strlen(help);
int width;
if (x < cmCursesMainForm::MAX_WIDTH )
2001-11-06 06:10:52 +03:00
{
2001-11-30 00:44:22 +03:00
width = x;
2001-11-06 06:10:52 +03:00
}
else
{
2001-11-30 00:44:22 +03:00
width = cmCursesMainForm::MAX_WIDTH;
2001-11-06 06:10:52 +03:00
}
2001-11-30 00:44:22 +03:00
if (curFieldLen >= width)
2001-11-06 06:10:52 +03:00
{
2001-11-30 00:44:22 +03:00
strncpy(bar, curField, width);
2001-11-06 06:10:52 +03:00
}
else
{
2001-11-30 00:44:22 +03:00
strcpy(bar, curField);
bar[curFieldLen] = ':';
bar[curFieldLen+1] = ' ';
if (curFieldLen + helpLen + 2 >= width)
2001-11-06 06:10:52 +03:00
{
2001-11-30 00:44:22 +03:00
strncpy(bar+curFieldLen+2, help, width
- curFieldLen - 2);
}
else
{
strcpy(bar+curFieldLen+2, help);
for(i=curFieldLen+helpLen+2; i < width; ++i)
{
bar[i] = ' ';
}
2001-11-06 06:10:52 +03:00
}
}
2001-11-30 00:44:22 +03:00
bar[width] = '\0';
char version[cmCursesMainForm::MAX_WIDTH];
char vertmp[128];
sprintf(vertmp,"CMake Version %d.%d", cmMakefile::GetMajorVersion(),
cmMakefile::GetMinorVersion());
int sideSpace = (width-strlen(vertmp));
for(i=0; i<sideSpace; i++) { version[i] = ' '; }
sprintf(version+sideSpace, "%s", vertmp);
version[width] = '\0';
curses_move(y-4,0);
2001-11-06 06:10:52 +03:00
attron(A_STANDOUT);
printw(bar);
attroff(A_STANDOUT);
2001-11-30 00:44:22 +03:00
curses_move(y-3,0);
printw(version);
2001-11-05 02:05:21 +03:00
pos_form_cursor(m_Form);
}
void cmCursesMainForm::RunCMake(bool generateMakefiles)
{
int x,y;
2001-11-30 00:44:22 +03:00
getmaxyx(stdscr, y, x);
curses_clear();
2001-11-30 00:44:22 +03:00
curses_move(1,1);
printw("Running CMake, please wait.");
touchwin(stdscr);
refresh();
2001-11-05 02:05:21 +03:00
endwin();
// always save the current gui values to disk
this->FillCacheManagerFromUI();
cmCacheManager::GetInstance()->SaveCache(cmSystemTools::GetCurrentWorkingDirectory().c_str());
// create a cmake object
cmake make;
// create the arguments for the cmake object
2001-11-30 00:44:22 +03:00
std::string whereCMake = cmSystemTools::GetProgramPath(m_Args[0].c_str());
whereCMake += "/cmake";
m_Args[0] = whereCMake;
// Get rid of previous errors
m_Errors = std::vector<std::string>();
2001-11-05 02:05:21 +03:00
// run the generate process
2001-11-30 00:44:22 +03:00
m_OkToGenerate = true;
if(make.Generate(m_Args, generateMakefiles) != 0 || !m_Errors.empty())
2001-11-05 02:05:21 +03:00
{
2001-11-30 00:44:22 +03:00
m_OkToGenerate = false;
2001-11-05 02:05:21 +03:00
cmSystemTools::ResetErrorOccuredFlag();
2001-11-30 00:44:22 +03:00
int x,y;
getmaxyx(stdscr, y, x);
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(m_Errors,
"Errors which during last pass.");
CurrentForm = msgs;
msgs->Render(1,1,x,y);
msgs->HandleInput();
CurrentForm = this;
this->Render(1,1,x,y);
2001-11-05 02:05:21 +03:00
}
2001-11-30 00:44:22 +03:00
initscr(); /* Initialization */
2001-11-05 02:05:21 +03:00
noecho(); /* Echo off */
cbreak(); /* nl- or cr not needed */
2001-11-30 00:44:22 +03:00
keypad(stdscr,TRUE); /* Use key symbols as
2001-11-05 02:05:21 +03:00
KEY_DOWN*/
2001-11-06 06:10:52 +03:00
2001-11-30 00:44:22 +03:00
this->InitializeUI();
2001-11-05 02:05:21 +03:00
this->Render(1, 1, x, y);
}
2001-11-30 00:44:22 +03:00
void cmCursesMainForm::AddError(const char* message, const char* title)
{
m_Errors.push_back(message);
}
void cmCursesMainForm::RemoveEntry(const char* value)
{
if (!value)
{
return;
}
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
{
const char* val = (*it)->GetValue();
if ( val && !strcmp(value, val) )
{
m_Entries->erase(it);
break;
}
}
}
2001-11-05 02:05:21 +03:00
// copy from the list box to the cache manager
void cmCursesMainForm::FillCacheManagerFromUI()
{
2001-11-05 23:55:24 +03:00
std::string tmpString;
2001-11-05 02:05:21 +03:00
cmCacheManager::GetInstance()->GetCacheMap();
int size = m_Entries->size();
for(int i=0; i < size; i++)
{
cmCacheManager::CacheEntry *entry =
cmCacheManager::GetInstance()->GetCacheEntry(
(*m_Entries)[i]->m_Key.c_str());
if (entry)
{
2001-11-05 23:55:24 +03:00
tmpString = (*m_Entries)[i]->m_Entry->GetValue();
// Remove trailing spaces
entry->m_Value = tmpString.substr(0,tmpString.find_last_not_of(" ")+1);
2001-11-05 02:05:21 +03:00
}
}
}
void cmCursesMainForm::HandleInput()
{
if (!m_Form)
{
return;
}
FIELD* currentField;
cmCursesWidget* currentWidget;
while(1)
{
2001-11-06 06:10:52 +03:00
this->UpdateStatusBar();
this->PrintKeys();
2001-11-05 02:05:21 +03:00
int key = getch();
currentField = current_field(m_Form);
currentWidget = reinterpret_cast<cmCursesWidget*>(field_userptr(
currentField));
2001-11-30 00:44:22 +03:00
if (!currentWidget || !currentWidget->HandleInput(key, m_Form, stdscr))
2001-11-05 02:05:21 +03:00
{
2001-11-06 06:10:52 +03:00
// quit
2001-11-05 02:05:21 +03:00
if ( key == 'q' )
{
break;
}
2001-11-06 06:10:52 +03:00
// if not end of page, next field otherwise next page
2001-11-30 00:44:22 +03:00
// each entry consists of fields: label, isnew, value
// therefore, the label field for the prev. entry is index-5
// and the label field for the next entry is index+1
// (index always corresponds to the value field)
2001-11-06 06:10:52 +03:00
else if ( key == KEY_DOWN || key == ctrl('n') )
2001-11-05 02:05:21 +03:00
{
FIELD* cur = current_field(m_Form);
2001-11-30 18:54:04 +03:00
int index = field_index(cur);
2001-11-30 00:44:22 +03:00
if ( index == 3*m_NumberOfVisibleEntries-1 )
2001-11-05 02:05:21 +03:00
{
continue;
}
2001-11-30 00:44:22 +03:00
if (new_page(m_Fields[index+1]))
2001-11-05 02:05:21 +03:00
{
form_driver(m_Form, REQ_NEXT_PAGE);
}
else
{
form_driver(m_Form, REQ_NEXT_FIELD);
}
}
2001-11-06 06:10:52 +03:00
// if not beginning of page, previous field, otherwise previous page
2001-11-30 00:44:22 +03:00
// each entry consists of fields: label, isnew, value
// therefore, the label field for the prev. entry is index-5
// and the label field for the next entry is index+1
// (index always corresponds to the value field)
2001-11-06 06:10:52 +03:00
else if ( key == KEY_UP || key == ctrl('p') )
2001-11-05 02:05:21 +03:00
{
FIELD* cur = current_field(m_Form);
int index = field_index(cur);
if ( index == 2 )
{
continue;
}
if ( new_page(m_Fields[index-2]) )
{
form_driver(m_Form, REQ_PREV_PAGE);
set_current_field(m_Form, m_Fields[index-3]);
}
else
{
form_driver(m_Form, REQ_PREV_FIELD);
}
}
2001-11-06 06:10:52 +03:00
// pg down
else if ( key == KEY_NPAGE || key == ctrl('d') )
2001-11-05 02:05:21 +03:00
{
form_driver(m_Form, REQ_NEXT_PAGE);
}
2001-11-06 06:10:52 +03:00
// pg up
else if ( key == KEY_PPAGE || key == ctrl('u') )
2001-11-05 02:05:21 +03:00
{
form_driver(m_Form, REQ_PREV_PAGE);
}
2001-11-06 06:10:52 +03:00
// configure
2001-11-05 02:05:21 +03:00
else if ( key == 'c' )
{
this->RunCMake(false);
}
2001-11-30 00:44:22 +03:00
// display help
else if ( key == 'h' )
{
int x,y;
getmaxyx(stdscr, y, x);
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(m_HelpMessage,
"Help.");
CurrentForm = msgs;
msgs->Render(1,1,x,y);
msgs->HandleInput();
CurrentForm = this;
this->Render(1,1,x,y);
}
// display last errors
else if ( key == 'l' )
{
int x,y;
getmaxyx(stdscr, y, x);
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(m_Errors,
"Errors which during last pass.");
CurrentForm = msgs;
msgs->Render(1,1,x,y);
msgs->HandleInput();
CurrentForm = this;
this->Render(1,1,x,y);
}
// switch advanced on/off
else if ( key == 't' )
{
if (m_AdvancedMode)
{
m_AdvancedMode = false;
}
else
{
m_AdvancedMode = true;
}
int x,y;
getmaxyx(stdscr, y, x);
this->RePost();
this->Render(1, 1, x, y);
}
2001-11-06 06:10:52 +03:00
// generate and exit
else if ( key == 'g' )
2001-11-05 02:05:21 +03:00
{
2001-11-30 00:44:22 +03:00
if ( m_OkToGenerate )
{
this->RunCMake(true);
break;
}
2001-11-05 02:05:21 +03:00
}
2001-11-06 06:10:52 +03:00
// delete cache entry
else if ( key == 'd' )
{
FIELD* cur = current_field(m_Form);
2001-11-30 18:54:04 +03:00
int index = field_index(cur);
2001-11-06 06:10:52 +03:00
// make the next or prev. current field after deletion
2001-11-30 00:44:22 +03:00
// each entry consists of fields: label, isnew, value
// therefore, the label field for the prev. entry is index-5
// and the label field for the next entry is index+1
// (index always corresponds to the value field)
2001-11-06 06:10:52 +03:00
FIELD* nextCur;
if ( index == 2 )
{
2001-11-30 00:44:22 +03:00
nextCur=0;
2001-11-06 06:10:52 +03:00
}
2001-11-30 00:44:22 +03:00
else if ( index == 3*m_NumberOfVisibleEntries-1 )
2001-11-06 06:10:52 +03:00
{
nextCur = m_Fields[index-5];
}
else
{
nextCur = m_Fields[index+1];
}
// Get the label widget
2001-11-30 00:44:22 +03:00
// each entry consists of fields: label, isnew, value
// therefore, the label field for the is index-2
// (index always corresponds to the value field)
2001-11-06 06:10:52 +03:00
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
m_Fields[index-2]));
cmCacheManager::GetInstance()->RemoveCacheEntry(lbl->GetValue());
2001-11-30 00:44:22 +03:00
std::string nextVal;
if (nextCur)
{
nextVal = (reinterpret_cast<cmCursesWidget*>(field_userptr(nextCur))->GetValue());
}
2001-11-06 06:10:52 +03:00
int x,y;
2001-11-30 00:44:22 +03:00
getmaxyx(stdscr, y, x);
this->RemoveEntry(lbl->GetValue());
this->RePost();
2001-11-06 06:10:52 +03:00
this->Render(1, 1, x, y);
2001-11-30 00:44:22 +03:00
if (nextCur)
2001-11-06 06:10:52 +03:00
{
2001-11-30 00:44:22 +03:00
// make the next or prev. current field after deletion
nextCur = 0;
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
2001-11-06 06:10:52 +03:00
{
2001-11-30 00:44:22 +03:00
if (nextVal == (*it)->m_Key)
{
nextCur = (*it)->m_Entry->m_Field;
}
}
if (nextCur)
{
set_current_field(m_Form, nextCur);
2001-11-06 06:10:52 +03:00
}
}
}
2001-11-05 02:05:21 +03:00
}
2001-11-30 00:44:22 +03:00
touchwin(stdscr);
wrefresh(stdscr);
2001-11-05 02:05:21 +03:00
}
}
2001-11-30 00:44:22 +03:00
const char* cmCursesMainForm::s_ConstHelpMessage = "CMake is used to configure and generate build files for software projects. The basic steps for configuring a project are as follows:\n\n1. Select the source directory for the project. This should contain the CMakeLists.txt files for the project.\n\n2. Select the build directory for the project. This is the directory where the project will be built. It can be the same or a different directory than the source directory. For easy clean up, a separate build directory is recommended. CMake will create the directory if it does not exist.\n\n3. Once the source and binary directories are selected, it is time to press the Configure button. This will cause CMake to read all of the input files and discover all the variables used by the project. The first time a variable is displayed it will be in Red. Users should inspect red variables making sure the values are correct. For some projects the Configure process can be iterative, so continue to press the Configure button until there are no longer red entries.\n\n4. Once there are no longer red entries, you should click the OK button. This will write the build files to the build directory and exit CMake.";