ENH: m_ cleanup for curses

This commit is contained in:
Ken Martin 2006-03-16 10:44:55 -05:00
parent 4b83a08b37
commit fb5d92ea37
18 changed files with 376 additions and 378 deletions

View File

@ -21,10 +21,10 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height,
int left, int top) : int left, int top) :
cmCursesWidget(width, height, left, top) cmCursesWidget(width, height, left, top)
{ {
m_Type = cmCacheManager::BOOL; this->Type = cmCacheManager::BOOL;
set_field_fore(m_Field, A_NORMAL); set_field_fore(this->Field, A_NORMAL);
set_field_back(m_Field, A_STANDOUT); set_field_back(this->Field, A_STANDOUT);
field_opts_off(m_Field, O_STATIC); field_opts_off(this->Field, O_STATIC);
this->SetValueAsBool(false); this->SetValueAsBool(false);
} }
@ -68,7 +68,7 @@ void cmCursesBoolWidget::SetValueAsBool(bool value)
bool cmCursesBoolWidget::GetValueAsBool() bool cmCursesBoolWidget::GetValueAsBool()
{ {
if (m_Value == "ON") if (this->Value == "ON")
{ {
return true; return true;
} }

View File

@ -26,55 +26,55 @@
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key, cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key,
int labelwidth, int labelwidth,
int entrywidth) : int entrywidth) :
m_Key(key), m_LabelWidth(labelwidth), m_EntryWidth(entrywidth) Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth)
{ {
m_Label = new cmCursesLabelWidget(m_LabelWidth, 1, 1, 1, key); this->Label = new cmCursesLabelWidget(this->LabelWidth, 1, 1, 1, key);
m_IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, " "); this->IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, " ");
m_Entry = 0; this->Entry = 0;
} }
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
const char* key, const cmCacheManager::CacheIterator& it, bool isNew, const char* key, const cmCacheManager::CacheIterator& it, bool isNew,
int labelwidth, int entrywidth) int labelwidth, int entrywidth)
: m_Key(key), m_LabelWidth(labelwidth), m_EntryWidth(entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth)
{ {
m_Label = new cmCursesLabelWidget(m_LabelWidth, 1, 1, 1, key); this->Label = new cmCursesLabelWidget(this->LabelWidth, 1, 1, 1, key);
if (isNew) if (isNew)
{ {
m_IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, "*"); this->IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, "*");
} }
else else
{ {
m_IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, " "); this->IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, " ");
} }
m_Entry = 0; this->Entry = 0;
switch ( it.GetType() ) switch ( it.GetType() )
{ {
case cmCacheManager::BOOL: case cmCacheManager::BOOL:
m_Entry = new cmCursesBoolWidget(m_EntryWidth, 1, 1, 1); this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
if (cmSystemTools::IsOn(it.GetValue())) if (cmSystemTools::IsOn(it.GetValue()))
{ {
static_cast<cmCursesBoolWidget*>(m_Entry)->SetValueAsBool(true); static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true);
} }
else else
{ {
static_cast<cmCursesBoolWidget*>(m_Entry)->SetValueAsBool(false); static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(false);
} }
break; break;
case cmCacheManager::PATH: case cmCacheManager::PATH:
m_Entry = new cmCursesPathWidget(m_EntryWidth, 1, 1, 1); this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1);
static_cast<cmCursesPathWidget*>(m_Entry)->SetString( static_cast<cmCursesPathWidget*>(this->Entry)->SetString(
it.GetValue()); it.GetValue());
break; break;
case cmCacheManager::FILEPATH: case cmCacheManager::FILEPATH:
m_Entry = new cmCursesFilePathWidget(m_EntryWidth, 1, 1, 1); this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1);
static_cast<cmCursesFilePathWidget*>(m_Entry)->SetString( static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(
it.GetValue()); it.GetValue());
break; break;
case cmCacheManager::STRING: case cmCacheManager::STRING:
m_Entry = new cmCursesStringWidget(m_EntryWidth, 1, 1, 1); this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
static_cast<cmCursesStringWidget*>(m_Entry)->SetString( static_cast<cmCursesStringWidget*>(this->Entry)->SetString(
it.GetValue()); it.GetValue());
break; break;
case cmCacheManager::UNINITIALIZED: case cmCacheManager::UNINITIALIZED:
@ -89,16 +89,16 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
cmCursesCacheEntryComposite::~cmCursesCacheEntryComposite() cmCursesCacheEntryComposite::~cmCursesCacheEntryComposite()
{ {
delete m_Label; delete this->Label;
delete m_IsNewLabel; delete this->IsNewLabel;
delete m_Entry; delete this->Entry;
} }
const char* cmCursesCacheEntryComposite::GetValue() const char* cmCursesCacheEntryComposite::GetValue()
{ {
if (m_Label) if (this->Label)
{ {
return m_Label->GetValue(); return this->Label->GetValue();
} }
else else
{ {

View File

@ -36,12 +36,12 @@ protected:
cmCursesCacheEntryComposite(const cmCursesCacheEntryComposite& from); cmCursesCacheEntryComposite(const cmCursesCacheEntryComposite& from);
void operator=(const cmCursesCacheEntryComposite&); void operator=(const cmCursesCacheEntryComposite&);
cmCursesLabelWidget* m_Label; cmCursesLabelWidget* Label;
cmCursesLabelWidget* m_IsNewLabel; cmCursesLabelWidget* IsNewLabel;
cmCursesWidget* m_Entry; cmCursesWidget* Entry;
std::string m_Key; std::string Key;
int m_LabelWidth; int LabelWidth;
int m_EntryWidth; int EntryWidth;
}; };
#endif // __cmCursesCacheEntryComposite_h #endif // __cmCursesCacheEntryComposite_h

View File

@ -20,7 +20,7 @@ cmCursesDummyWidget::cmCursesDummyWidget(int width, int height,
int left, int top) : int left, int top) :
cmCursesWidget(width, height, left, top) cmCursesWidget(width, height, left, top)
{ {
m_Type = cmCacheManager::INTERNAL; this->Type = cmCacheManager::INTERNAL;
} }

View File

@ -20,6 +20,6 @@ cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height,
int left, int top) : int left, int top) :
cmCursesPathWidget(width, height, left, top) cmCursesPathWidget(width, height, left, top)
{ {
m_Type = cmCacheManager::FILEPATH; this->Type = cmCacheManager::FILEPATH;
} }

View File

@ -21,16 +21,16 @@ bool cmCursesForm::Debug = false;
cmCursesForm::cmCursesForm() cmCursesForm::cmCursesForm()
{ {
m_Form = 0; this->Form = 0;
} }
cmCursesForm::~cmCursesForm() cmCursesForm::~cmCursesForm()
{ {
if (m_Form) if (this->Form)
{ {
unpost_form(m_Form); unpost_form(this->Form);
free_form(m_Form); free_form(this->Form);
m_Form = 0; this->Form = 0;
} }
} }

View File

@ -60,7 +60,7 @@ public:
// Return the FORM. Should be only used by low-level methods. // Return the FORM. Should be only used by low-level methods.
FORM* GetForm() FORM* GetForm()
{ {
return m_Form; return this->Form;
} }
static cmCursesForm* CurrentForm; static cmCursesForm* CurrentForm;
@ -71,10 +71,10 @@ protected:
static std::ofstream DebugFile; static std::ofstream DebugFile;
static bool Debug; static bool Debug;
cmCursesForm(const cmCursesForm& from); cmCursesForm(const cmCursesForm& form);
void operator=(const cmCursesForm&); void operator=(const cmCursesForm&);
FORM* m_Form; FORM* Form;
}; };
#endif // __cmCursesForm_h #endif // __cmCursesForm_h

View File

@ -21,9 +21,9 @@ cmCursesLabelWidget::cmCursesLabelWidget(int width, int height,
const std::string& name) : const std::string& name) :
cmCursesWidget(width, height, left, top) cmCursesWidget(width, height, left, top)
{ {
field_opts_off(m_Field, O_EDIT); field_opts_off(this->Field, O_EDIT);
field_opts_off(m_Field, O_ACTIVE); field_opts_off(this->Field, O_ACTIVE);
field_opts_off(m_Field, O_STATIC); field_opts_off(this->Field, O_STATIC);
this->SetValue(name.c_str()); this->SetValue(name.c_str());
} }

View File

@ -33,20 +33,20 @@ cmCursesLongMessageForm::cmCursesLongMessageForm(std::vector<std::string>
std::vector<std::string>::const_iterator it; std::vector<std::string>::const_iterator it;
for(it=messages.begin(); it != messages.end(); it++) for(it=messages.begin(); it != messages.end(); it++)
{ {
m_Messages += (*it); this->Messages += (*it);
// Add one blank line after each message // Add one blank line after each message
m_Messages += "\n\n"; this->Messages += "\n\n";
} }
m_Title = title; this->Title = title;
m_Fields[0] = 0; this->Fields[0] = 0;
m_Fields[1] = 0; this->Fields[1] = 0;
} }
cmCursesLongMessageForm::~cmCursesLongMessageForm() cmCursesLongMessageForm::~cmCursesLongMessageForm()
{ {
if (m_Fields[0]) if (this->Fields[0])
{ {
free_field(m_Fields[0]); free_field(this->Fields[0]);
} }
} }
@ -57,12 +57,12 @@ void cmCursesLongMessageForm::UpdateStatusBar()
getmaxyx(stdscr, y, x); getmaxyx(stdscr, y, x);
char bar[cmCursesMainForm::MAX_WIDTH]; char bar[cmCursesMainForm::MAX_WIDTH];
int size = strlen(m_Title.c_str()); int size = strlen(this->Title.c_str());
if ( size >= cmCursesMainForm::MAX_WIDTH ) if ( size >= cmCursesMainForm::MAX_WIDTH )
{ {
size = cmCursesMainForm::MAX_WIDTH-1; size = cmCursesMainForm::MAX_WIDTH-1;
} }
strncpy(bar, m_Title.c_str(), size); strncpy(bar, this->Title.c_str(), size);
for(int i=size-1; i<cmCursesMainForm::MAX_WIDTH; i++) bar[i] = ' '; for(int i=size-1; i<cmCursesMainForm::MAX_WIDTH; i++) bar[i] = ' ';
int width; int width;
@ -92,7 +92,7 @@ void cmCursesLongMessageForm::UpdateStatusBar()
attroff(A_STANDOUT); attroff(A_STANDOUT);
curses_move(y-3,0); curses_move(y-3,0);
printw(version); printw(version);
pos_form_cursor(m_Form); pos_form_cursor(this->Form);
} }
void cmCursesLongMessageForm::PrintKeys() void cmCursesLongMessageForm::PrintKeys()
@ -109,7 +109,7 @@ void cmCursesLongMessageForm::PrintKeys()
curses_move(y-2,0); curses_move(y-2,0);
printw(firstLine); printw(firstLine);
pos_form_cursor(m_Form); pos_form_cursor(this->Form);
} }
@ -118,45 +118,45 @@ void cmCursesLongMessageForm::Render(int, int, int, int)
int x,y; int x,y;
getmaxyx(stdscr, y, x); getmaxyx(stdscr, y, x);
if (m_Form) if (this->Form)
{ {
unpost_form(m_Form); unpost_form(this->Form);
free_form(m_Form); free_form(this->Form);
m_Form = 0; this->Form = 0;
} }
const char* msg = m_Messages.c_str(); const char* msg = this->Messages.c_str();
curses_clear(); curses_clear();
if (m_Fields[0]) if (this->Fields[0])
{ {
free_field(m_Fields[0]); free_field(this->Fields[0]);
m_Fields[0] = 0; this->Fields[0] = 0;
} }
m_Fields[0] = new_field(y-6, x-2, 1, 1, 0, 0); this->Fields[0] = new_field(y-6, x-2, 1, 1, 0, 0);
field_opts_off(m_Fields[0], O_STATIC); field_opts_off(this->Fields[0], O_STATIC);
m_Form = new_form(m_Fields); this->Form = new_form(this->Fields);
post_form(m_Form); post_form(this->Form);
int i=0; int i=0;
form_driver(m_Form, REQ_BEG_FIELD); form_driver(this->Form, REQ_BEG_FIELD);
while(msg[i] != '\0' && i < 60000) while(msg[i] != '\0' && i < 60000)
{ {
if (msg[i] == '\n' && msg[i+1] != '\0') if (msg[i] == '\n' && msg[i+1] != '\0')
{ {
form_driver(m_Form, REQ_NEW_LINE); form_driver(this->Form, REQ_NEW_LINE);
} }
else else
{ {
form_driver(m_Form, msg[i]); form_driver(this->Form, msg[i]);
} }
i++; i++;
} }
form_driver(m_Form, REQ_BEG_FIELD); form_driver(this->Form, REQ_BEG_FIELD);
this->UpdateStatusBar(); this->UpdateStatusBar();
this->PrintKeys(); this->PrintKeys();
@ -167,7 +167,7 @@ void cmCursesLongMessageForm::Render(int, int, int, int)
void cmCursesLongMessageForm::HandleInput() void cmCursesLongMessageForm::HandleInput()
{ {
if (!m_Form) if (!this->Form)
{ {
return; return;
} }
@ -188,19 +188,19 @@ void cmCursesLongMessageForm::HandleInput()
} }
else if ( key == KEY_DOWN || key == ctrl('n') ) else if ( key == KEY_DOWN || key == ctrl('n') )
{ {
form_driver(m_Form, REQ_SCR_FLINE); form_driver(this->Form, REQ_SCR_FLINE);
} }
else if ( key == KEY_UP || key == ctrl('p') ) else if ( key == KEY_UP || key == ctrl('p') )
{ {
form_driver(m_Form, REQ_SCR_BLINE); form_driver(this->Form, REQ_SCR_BLINE);
} }
else if ( key == KEY_NPAGE || key == ctrl('d') ) else if ( key == KEY_NPAGE || key == ctrl('d') )
{ {
form_driver(m_Form, REQ_SCR_FPAGE); form_driver(this->Form, REQ_SCR_FPAGE);
} }
else if ( key == KEY_PPAGE || key == ctrl('u') ) else if ( key == KEY_PPAGE || key == ctrl('u') )
{ {
form_driver(m_Form, REQ_SCR_BPAGE); form_driver(this->Form, REQ_SCR_BPAGE);
} }
this->UpdateStatusBar(); this->UpdateStatusBar();

View File

@ -53,10 +53,10 @@ protected:
cmCursesLongMessageForm(const cmCursesLongMessageForm& from); cmCursesLongMessageForm(const cmCursesLongMessageForm& from);
void operator=(const cmCursesLongMessageForm&); void operator=(const cmCursesLongMessageForm&);
std::string m_Messages; std::string Messages;
std::string m_Title; std::string Title;
FIELD* m_Fields[2]; FIELD* Fields[2];
}; };

View File

@ -35,69 +35,69 @@ inline int ctrl(int z)
cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args, cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
int initWidth) : int initWidth) :
m_Args(args), m_InitialWidth(initWidth) Args(args), InitialWidth(initWidth)
{ {
m_NumberOfPages = 0; this->NumberOfPages = 0;
m_Fields = 0; this->Fields = 0;
m_Entries = 0; this->Entries = 0;
m_AdvancedMode = false; this->AdvancedMode = false;
m_NumberOfVisibleEntries = 0; this->NumberOfVisibleEntries = 0;
m_OkToGenerate = false; this->OkToGenerate = false;
m_HelpMessage.push_back("Welcome to ccmake, curses based user interface for CMake."); this->HelpMessage.push_back("Welcome to ccmake, curses based user interface for CMake.");
m_HelpMessage.push_back(""); this->HelpMessage.push_back("");
m_HelpMessage.push_back(s_ConstHelpMessage); this->HelpMessage.push_back(s_ConstHelpMessage);
m_CMakeInstance = new cmake; this->CMakeInstance = new cmake;
// create the arguments for the cmake object // create the arguments for the cmake object
std::string whereCMake = cmSystemTools::GetProgramPath(m_Args[0].c_str()); std::string whereCMake = cmSystemTools::GetProgramPath(this->Args[0].c_str());
whereCMake += "/cmake"; whereCMake += "/cmake";
m_Args[0] = whereCMake; this->Args[0] = whereCMake;
m_CMakeInstance->SetArgs(m_Args); this->CMakeInstance->SetArgs(this->Args);
m_CMakeInstance->SetCMakeCommand(whereCMake.c_str()); this->CMakeInstance->SetCMakeCommand(whereCMake.c_str());
m_SearchString = ""; this->SearchString = "";
m_OldSearchString = ""; this->OldSearchString = "";
m_SearchMode = false; this->SearchMode = false;
} }
cmCursesMainForm::~cmCursesMainForm() cmCursesMainForm::~cmCursesMainForm()
{ {
if (m_Form) if (this->Form)
{ {
unpost_form(m_Form); unpost_form(this->Form);
free_form(m_Form); free_form(this->Form);
m_Form = 0; this->Form = 0;
} }
delete[] m_Fields; delete[] this->Fields;
// Clean-up composites // Clean-up composites
if (m_Entries) if (this->Entries)
{ {
std::vector<cmCursesCacheEntryComposite*>::iterator it; std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
delete *it; delete *it;
} }
} }
delete m_Entries; delete this->Entries;
if (this->m_CMakeInstance) if (this->CMakeInstance)
{ {
delete this->m_CMakeInstance; delete this->CMakeInstance;
this->m_CMakeInstance = 0; this->CMakeInstance = 0;
} }
} }
// See if a cache entry is in the list of entries in the ui. // See if a cache entry is in the list of entries in the ui.
bool cmCursesMainForm::LookForCacheEntry(const char* key) bool cmCursesMainForm::LookForCacheEntry(const char* key)
{ {
if (!key || !m_Entries) if (!key || !this->Entries)
{ {
return false; return false;
} }
std::vector<cmCursesCacheEntryComposite*>::iterator it; std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
if (!strcmp(key, (*it)->m_Key.c_str())) if (!strcmp(key, (*it)->Key.c_str()))
{ {
return true; return true;
} }
@ -113,12 +113,12 @@ void cmCursesMainForm::InitializeUI()
// which contain labels, entries and new entry markers // which contain labels, entries and new entry markers
std::vector<cmCursesCacheEntryComposite*>* newEntries = std::vector<cmCursesCacheEntryComposite*>* newEntries =
new std::vector<cmCursesCacheEntryComposite*>; new std::vector<cmCursesCacheEntryComposite*>;
newEntries->reserve(this->m_CMakeInstance->GetCacheManager()->GetSize()); newEntries->reserve(this->CMakeInstance->GetCacheManager()->GetSize());
// Count non-internal and non-static entries // Count non-internal and non-static entries
int count=0; int count=0;
for(cmCacheManager::CacheIterator i = for(cmCacheManager::CacheIterator i =
this->m_CMakeInstance->GetCacheManager()->NewIterator(); this->CMakeInstance->GetCacheManager()->NewIterator();
!i.IsAtEnd(); i.Next()) !i.IsAtEnd(); i.Next())
{ {
if ( i.GetType() != cmCacheManager::INTERNAL && if ( i.GetType() != cmCacheManager::INTERNAL &&
@ -129,7 +129,7 @@ void cmCursesMainForm::InitializeUI()
} }
} }
int entrywidth = m_InitialWidth - 35; int entrywidth = this->InitialWidth - 35;
cmCursesCacheEntryComposite* comp; cmCursesCacheEntryComposite* comp;
if ( count == 0 ) if ( count == 0 )
@ -137,7 +137,7 @@ void cmCursesMainForm::InitializeUI()
// If cache is empty, display a label saying so and a // If cache is empty, display a label saying so and a
// dummy entry widget (does not respond to input) // dummy entry widget (does not respond to input)
comp = new cmCursesCacheEntryComposite("EMPTY CACHE", 30, 30); comp = new cmCursesCacheEntryComposite("EMPTY CACHE", 30, 30);
comp->m_Entry = new cmCursesDummyWidget(1, 1, 1, 1); comp->Entry = new cmCursesDummyWidget(1, 1, 1, 1);
newEntries->push_back(comp); newEntries->push_back(comp);
} }
else else
@ -146,7 +146,7 @@ void cmCursesMainForm::InitializeUI()
// First add entries which are new // First add entries which are new
for(cmCacheManager::CacheIterator i = for(cmCacheManager::CacheIterator i =
this->m_CMakeInstance->GetCacheManager()->NewIterator(); this->CMakeInstance->GetCacheManager()->NewIterator();
!i.IsAtEnd(); i.Next()) !i.IsAtEnd(); i.Next())
{ {
const char* key = i.GetName(); const char* key = i.GetName();
@ -162,13 +162,13 @@ void cmCursesMainForm::InitializeUI()
newEntries->push_back(new cmCursesCacheEntryComposite(key, i, newEntries->push_back(new cmCursesCacheEntryComposite(key, i,
true, 30, true, 30,
entrywidth)); entrywidth));
m_OkToGenerate = false; this->OkToGenerate = false;
} }
} }
// then add entries which are old // then add entries which are old
for(cmCacheManager::CacheIterator i = for(cmCacheManager::CacheIterator i =
this->m_CMakeInstance->GetCacheManager()->NewIterator(); this->CMakeInstance->GetCacheManager()->NewIterator();
!i.IsAtEnd(); i.Next()) !i.IsAtEnd(); i.Next())
{ {
const char* key = i.GetName(); const char* key = i.GetName();
@ -189,17 +189,17 @@ void cmCursesMainForm::InitializeUI()
} }
// Clean old entries // Clean old entries
if (m_Entries) if (this->Entries)
{ {
// Have to call delete on each pointer // Have to call delete on each pointer
std::vector<cmCursesCacheEntryComposite*>::iterator it; std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
delete *it; delete *it;
} }
} }
delete m_Entries; delete this->Entries;
m_Entries = newEntries; this->Entries = newEntries;
// Compute fields from composites // Compute fields from composites
this->RePost(); this->RePost();
@ -209,71 +209,71 @@ void cmCursesMainForm::InitializeUI()
void cmCursesMainForm::RePost() void cmCursesMainForm::RePost()
{ {
// Create the fields to be passed to the form. // Create the fields to be passed to the form.
if (m_Form) if (this->Form)
{ {
unpost_form(m_Form); unpost_form(this->Form);
free_form(m_Form); free_form(this->Form);
m_Form = 0; this->Form = 0;
} }
delete[] m_Fields; delete[] this->Fields;
if (m_AdvancedMode) if (this->AdvancedMode)
{ {
m_NumberOfVisibleEntries = m_Entries->size(); this->NumberOfVisibleEntries = this->Entries->size();
} }
else else
{ {
// If normal mode, count only non-advanced entries // If normal mode, count only non-advanced entries
m_NumberOfVisibleEntries = 0; this->NumberOfVisibleEntries = 0;
std::vector<cmCursesCacheEntryComposite*>::iterator it; std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
cmCacheManager::CacheIterator mit = cmCacheManager::CacheIterator mit =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED")) if (mit.IsAtEnd() || !this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))
{ {
continue; continue;
} }
m_NumberOfVisibleEntries++; this->NumberOfVisibleEntries++;
} }
} }
// Assign the fields: 3 for each entry: label, new entry marker // Assign the fields: 3 for each entry: label, new entry marker
// ('*' or ' ') and entry widget // ('*' or ' ') and entry widget
m_Fields = new FIELD*[3*m_NumberOfVisibleEntries+1]; this->Fields = new FIELD*[3*this->NumberOfVisibleEntries+1];
int cc; int cc;
for ( cc = 0; cc < 3 * m_NumberOfVisibleEntries+1; cc ++ ) for ( cc = 0; cc < 3 * this->NumberOfVisibleEntries+1; cc ++ )
{ {
m_Fields[cc] = 0; this->Fields[cc] = 0;
} }
// Assign fields // Assign fields
int j=0; int j=0;
std::vector<cmCursesCacheEntryComposite*>::iterator it; std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
cmCacheManager::CacheIterator mit = cmCacheManager::CacheIterator mit =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED")) if (mit.IsAtEnd() || !this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))
{ {
continue; continue;
} }
m_Fields[3*j] = (*it)->m_Label->m_Field; this->Fields[3*j] = (*it)->Label->Field;
m_Fields[3*j+1] = (*it)->m_IsNewLabel->m_Field; this->Fields[3*j+1] = (*it)->IsNewLabel->Field;
m_Fields[3*j+2] = (*it)->m_Entry->m_Field; this->Fields[3*j+2] = (*it)->Entry->Field;
j++; j++;
} }
// Has to be null terminated. // Has to be null terminated.
m_Fields[3*m_NumberOfVisibleEntries] = 0; this->Fields[3*this->NumberOfVisibleEntries] = 0;
} }
void cmCursesMainForm::Render(int left, int top, int width, int height) void cmCursesMainForm::Render(int left, int top, int width, int height)
{ {
if (m_Form) if (this->Form)
{ {
FIELD* currentField = current_field(m_Form); FIELD* currentField = current_field(this->Form);
cmCursesWidget* cw = reinterpret_cast<cmCursesWidget*> cmCursesWidget* cw = reinterpret_cast<cmCursesWidget*>
(field_userptr(currentField)); (field_userptr(currentField));
// If in edit mode, get out of it // If in edit mode, get out of it
@ -285,14 +285,14 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
sw->SetInEdit(false); sw->SetInEdit(false);
} }
// Delete the previous form // Delete the previous form
unpost_form(m_Form); unpost_form(this->Form);
free_form(m_Form); free_form(this->Form);
m_Form = 0; this->Form = 0;
} }
// Wrong window size // Wrong window size
if ( width < cmCursesMainForm::MIN_WIDTH || if ( width < cmCursesMainForm::MIN_WIDTH ||
width < m_InitialWidth || width < this->InitialWidth ||
height < cmCursesMainForm::MIN_HEIGHT ) height < cmCursesMainForm::MIN_HEIGHT )
{ {
return; return;
@ -301,37 +301,37 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
// Leave room for toolbar // Leave room for toolbar
height -= 7; height -= 7;
if (m_AdvancedMode) if (this->AdvancedMode)
{ {
m_NumberOfVisibleEntries = m_Entries->size(); this->NumberOfVisibleEntries = this->Entries->size();
} }
else else
{ {
// If normal, display only non-advanced entries // If normal, display only non-advanced entries
m_NumberOfVisibleEntries = 0; this->NumberOfVisibleEntries = 0;
std::vector<cmCursesCacheEntryComposite*>::iterator it; std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
cmCacheManager::CacheIterator mit = cmCacheManager::CacheIterator mit =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED")) if (mit.IsAtEnd() || !this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))
{ {
continue; continue;
} }
m_NumberOfVisibleEntries++; this->NumberOfVisibleEntries++;
} }
} }
// Re-adjust the fields according to their place // Re-adjust the fields according to their place
bool isNewPage; bool isNewPage;
int i=0; int i=0;
m_NumberOfPages = 1; this->NumberOfPages = 1;
std::vector<cmCursesCacheEntryComposite*>::iterator it; std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
cmCacheManager::CacheIterator mit = cmCacheManager::CacheIterator mit =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED")) if (mit.IsAtEnd() || !this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))
{ {
continue; continue;
} }
@ -341,18 +341,18 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
if (isNewPage) if (isNewPage)
{ {
m_NumberOfPages++; this->NumberOfPages++;
} }
(*it)->m_Label->Move(left, top+row-1, isNewPage); (*it)->Label->Move(left, top+row-1, isNewPage);
(*it)->m_IsNewLabel->Move(left+32, top+row-1, false); (*it)->IsNewLabel->Move(left+32, top+row-1, false);
(*it)->m_Entry->Move(left+33, top+row-1, false); (*it)->Entry->Move(left+33, top+row-1, false);
(*it)->m_Entry->SetPage(m_NumberOfPages); (*it)->Entry->SetPage(this->NumberOfPages);
i++; i++;
} }
// Post the form // Post the form
m_Form = new_form(m_Fields); this->Form = new_form(this->Fields);
post_form(m_Form); post_form(this->Form);
// Update toolbar // Update toolbar
this->UpdateStatusBar(); this->UpdateStatusBar();
this->PrintKeys(); this->PrintKeys();
@ -366,7 +366,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
int x,y; int x,y;
getmaxyx(stdscr, y, x); getmaxyx(stdscr, y, x);
if ( x < cmCursesMainForm::MIN_WIDTH || if ( x < cmCursesMainForm::MIN_WIDTH ||
x < m_InitialWidth || x < this->InitialWidth ||
y < cmCursesMainForm::MIN_HEIGHT ) y < cmCursesMainForm::MIN_HEIGHT )
{ {
return; return;
@ -374,9 +374,9 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
// Give the current widget (if it exists), a chance to print keys // Give the current widget (if it exists), a chance to print keys
cmCursesWidget* cw = 0; cmCursesWidget* cw = 0;
if (m_Form) if (this->Form)
{ {
FIELD* currentField = current_field(m_Form); FIELD* currentField = current_field(this->Form);
cw = reinterpret_cast<cmCursesWidget*>(field_userptr(currentField)); cw = reinterpret_cast<cmCursesWidget*>(field_userptr(currentField));
} }
@ -403,7 +403,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
} }
else else
{ {
if (m_OkToGenerate) if (this->OkToGenerate)
{ {
sprintf(firstLine, sprintf(firstLine,
"Press [c] to configure Press [g] to generate and exit"); "Press [c] to configure Press [g] to generate and exit");
@ -412,7 +412,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
{ {
sprintf(firstLine, "Press [c] to configure "); sprintf(firstLine, "Press [c] to configure ");
} }
if (m_AdvancedMode) if (this->AdvancedMode)
{ {
sprintf(thirdLine, "Press [t] to toggle advanced mode (Currently On)"); sprintf(thirdLine, "Press [t] to toggle advanced mode (Currently On)");
} }
@ -441,13 +441,13 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
if (cw) if (cw)
{ {
sprintf(firstLine, "Page %d of %d", cw->GetPage(), m_NumberOfPages); sprintf(firstLine, "Page %d of %d", cw->GetPage(), this->NumberOfPages);
curses_move(0,65-strlen(firstLine)-1); curses_move(0,65-strlen(firstLine)-1);
printw(firstLine); printw(firstLine);
} }
// } // }
pos_form_cursor(m_Form); pos_form_cursor(this->Form);
} }
@ -459,15 +459,15 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
getmaxyx(stdscr, y, x); getmaxyx(stdscr, y, x);
// If window size is too small, display error and return // If window size is too small, display error and return
if ( x < cmCursesMainForm::MIN_WIDTH || if ( x < cmCursesMainForm::MIN_WIDTH ||
x < m_InitialWidth || x < this->InitialWidth ||
y < cmCursesMainForm::MIN_HEIGHT ) y < cmCursesMainForm::MIN_HEIGHT )
{ {
curses_clear(); curses_clear();
curses_move(0,0); curses_move(0,0);
char fmt[] = "Window is too small. A size of at least %dx%d is required."; char fmt[] = "Window is too small. A size of at least %dx%d is required.";
printw(fmt, printw(fmt,
(cmCursesMainForm::MIN_WIDTH < m_InitialWidth ? (cmCursesMainForm::MIN_WIDTH < this->InitialWidth ?
m_InitialWidth : cmCursesMainForm::MIN_WIDTH), this->InitialWidth : cmCursesMainForm::MIN_WIDTH),
cmCursesMainForm::MIN_HEIGHT); cmCursesMainForm::MIN_HEIGHT);
touchwin(stdscr); touchwin(stdscr);
wrefresh(stdscr); wrefresh(stdscr);
@ -475,12 +475,12 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
} }
// Get the key of the current entry // Get the key of the current entry
FIELD* cur = current_field(m_Form); FIELD* cur = current_field(this->Form);
int findex = field_index(cur); int findex = field_index(cur);
cmCursesWidget* lbl = 0; cmCursesWidget* lbl = 0;
if ( findex >= 0 ) if ( findex >= 0 )
{ {
lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(m_Fields[findex-2])); lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(this->Fields[findex-2]));
} }
char help[128] = ""; char help[128] = "";
const char* curField = ""; const char* curField = "";
@ -491,7 +491,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
// Get the help string of the current entry // Get the help string of the current entry
// and add it to the help string // and add it to the help string
cmCacheManager::CacheIterator it = cmCacheManager::CacheIterator it =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator(curField); this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
if (!it.IsAtEnd()) if (!it.IsAtEnd())
{ {
const char* hs = it.GetProperty("HELPSTRING"); const char* hs = it.GetProperty("HELPSTRING");
@ -594,7 +594,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
attroff(A_STANDOUT); attroff(A_STANDOUT);
curses_move(y-4,0); curses_move(y-4,0);
printw(version); printw(version);
pos_form_cursor(m_Form); pos_form_cursor(this->Form);
} }
void cmCursesMainForm::UpdateProgressOld(const char *msg, float prog, void*) void cmCursesMainForm::UpdateProgressOld(const char *msg, float prog, void*)
@ -639,24 +639,24 @@ int cmCursesMainForm::Configure(int noconfigure)
this->PrintKeys(1); this->PrintKeys(1);
touchwin(stdscr); touchwin(stdscr);
refresh(); refresh();
this->m_CMakeInstance->SetProgressCallback(cmCursesMainForm::UpdateProgress, this); this->CMakeInstance->SetProgressCallback(cmCursesMainForm::UpdateProgress, this);
// always save the current gui values to disk // always save the current gui values to disk
this->FillCacheManagerFromUI(); this->FillCacheManagerFromUI();
this->m_CMakeInstance->GetCacheManager()->SaveCache( this->CMakeInstance->GetCacheManager()->SaveCache(
m_CMakeInstance->GetHomeOutputDirectory()); this->CMakeInstance->GetHomeOutputDirectory());
this->LoadCache(0); this->LoadCache(0);
// Get rid of previous errors // Get rid of previous errors
m_Errors = std::vector<std::string>(); this->Errors = std::vector<std::string>();
// run the generate process // run the generate process
m_OkToGenerate = true; this->OkToGenerate = true;
int retVal; int retVal;
if ( noconfigure ) if ( noconfigure )
{ {
retVal = this->m_CMakeInstance->DoPreConfigureChecks(); retVal = this->CMakeInstance->DoPreConfigureChecks();
m_OkToGenerate = false; this->OkToGenerate = false;
if ( retVal > 0 ) if ( retVal > 0 )
{ {
retVal = 0; retVal = 0;
@ -664,26 +664,26 @@ int cmCursesMainForm::Configure(int noconfigure)
} }
else else
{ {
retVal = this->m_CMakeInstance->Configure(); retVal = this->CMakeInstance->Configure();
} }
this->m_CMakeInstance->SetProgressCallback(0, 0); this->CMakeInstance->SetProgressCallback(0, 0);
keypad(stdscr,TRUE); /* Use key symbols as keypad(stdscr,TRUE); /* Use key symbols as
KEY_DOWN*/ KEY_DOWN*/
if( retVal != 0 || !m_Errors.empty()) if( retVal != 0 || !this->Errors.empty())
{ {
// see if there was an error // see if there was an error
if(cmSystemTools::GetErrorOccuredFlag()) if(cmSystemTools::GetErrorOccuredFlag())
{ {
m_OkToGenerate = false; this->OkToGenerate = false;
} }
// reset error condition // reset error condition
cmSystemTools::ResetErrorOccuredFlag(); cmSystemTools::ResetErrorOccuredFlag();
int xx,yy; int xx,yy;
getmaxyx(stdscr, yy, xx); getmaxyx(stdscr, yy, xx);
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm( cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
m_Errors, this->Errors,
cmSystemTools::GetErrorOccuredFlag() ? "Errors occurred during the last pass." : cmSystemTools::GetErrorOccuredFlag() ? "Errors occurred during the last pass." :
"CMake produced the following output."); "CMake produced the following output.");
CurrentForm = msgs; CurrentForm = msgs;
@ -715,30 +715,30 @@ int cmCursesMainForm::Generate()
this->PrintKeys(1); this->PrintKeys(1);
touchwin(stdscr); touchwin(stdscr);
refresh(); refresh();
this->m_CMakeInstance->SetProgressCallback(cmCursesMainForm::UpdateProgress, this); this->CMakeInstance->SetProgressCallback(cmCursesMainForm::UpdateProgress, this);
// Get rid of previous errors // Get rid of previous errors
m_Errors = std::vector<std::string>(); this->Errors = std::vector<std::string>();
// run the generate process // run the generate process
int retVal = this->m_CMakeInstance->Generate(); int retVal = this->CMakeInstance->Generate();
this->m_CMakeInstance->SetProgressCallback(0, 0); this->CMakeInstance->SetProgressCallback(0, 0);
keypad(stdscr,TRUE); /* Use key symbols as keypad(stdscr,TRUE); /* Use key symbols as
KEY_DOWN*/ KEY_DOWN*/
if( retVal != 0 || !m_Errors.empty()) if( retVal != 0 || !this->Errors.empty())
{ {
// see if there was an error // see if there was an error
if(cmSystemTools::GetErrorOccuredFlag()) if(cmSystemTools::GetErrorOccuredFlag())
{ {
m_OkToGenerate = false; this->OkToGenerate = false;
} }
// reset error condition // reset error condition
cmSystemTools::ResetErrorOccuredFlag(); cmSystemTools::ResetErrorOccuredFlag();
int xx,yy; int xx,yy;
getmaxyx(stdscr, yy, xx); getmaxyx(stdscr, yy, xx);
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(m_Errors, cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(this->Errors,
"Errors occurred during the last pass."); "Errors occurred during the last pass.");
CurrentForm = msgs; CurrentForm = msgs;
msgs->Render(1,1,xx,yy); msgs->Render(1,1,xx,yy);
@ -761,7 +761,7 @@ int cmCursesMainForm::Generate()
void cmCursesMainForm::AddError(const char* message, const char*) void cmCursesMainForm::AddError(const char* message, const char*)
{ {
m_Errors.push_back(message); this->Errors.push_back(message);
} }
void cmCursesMainForm::RemoveEntry(const char* value) void cmCursesMainForm::RemoveEntry(const char* value)
@ -772,12 +772,12 @@ void cmCursesMainForm::RemoveEntry(const char* value)
} }
std::vector<cmCursesCacheEntryComposite*>::iterator it; std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
const char* val = (*it)->GetValue(); const char* val = (*it)->GetValue();
if ( val && !strcmp(value, val) ) if ( val && !strcmp(value, val) )
{ {
m_Entries->erase(it); this->Entries->erase(it);
break; break;
} }
} }
@ -786,16 +786,16 @@ void cmCursesMainForm::RemoveEntry(const char* value)
// copy from the list box to the cache manager // copy from the list box to the cache manager
void cmCursesMainForm::FillCacheManagerFromUI() void cmCursesMainForm::FillCacheManagerFromUI()
{ {
int size = m_Entries->size(); int size = this->Entries->size();
for(int i=0; i < size; i++) for(int i=0; i < size; i++)
{ {
cmCacheManager::CacheIterator it = cmCacheManager::CacheIterator it =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator( this->CMakeInstance->GetCacheManager()->GetCacheIterator(
(*m_Entries)[i]->m_Key.c_str()); (*this->Entries)[i]->Key.c_str());
if (!it.IsAtEnd()) if (!it.IsAtEnd())
{ {
std::string oldValue = it.GetValue(); std::string oldValue = it.GetValue();
std::string newValue = (*m_Entries)[i]->m_Entry->GetValue(); std::string newValue = (*this->Entries)[i]->Entry->GetValue();
std::string fixedOldValue; std::string fixedOldValue;
std::string fixedNewValue; std::string fixedNewValue;
this->FixValue(it.GetType(), oldValue, fixedOldValue); this->FixValue(it.GetType(), oldValue, fixedOldValue);
@ -838,7 +838,7 @@ void cmCursesMainForm::HandleInput()
{ {
int x=0,y=0; int x=0,y=0;
if (!m_Form) if (!this->Form)
{ {
return; return;
} }
@ -852,9 +852,9 @@ void cmCursesMainForm::HandleInput()
{ {
this->UpdateStatusBar(); this->UpdateStatusBar();
this->PrintKeys(); this->PrintKeys();
if ( m_SearchMode ) if ( this->SearchMode )
{ {
std::string searchstr = "Search: " + m_SearchString; std::string searchstr = "Search: " + this->SearchString;
this->UpdateStatusBar( searchstr.c_str() ); this->UpdateStatusBar( searchstr.c_str() );
this->PrintKeys(1); this->PrintKeys(1);
curses_move(y-5,searchstr.size()); curses_move(y-5,searchstr.size());
@ -880,28 +880,28 @@ void cmCursesMainForm::HandleInput()
} }
} }
currentField = current_field(m_Form); currentField = current_field(this->Form);
currentWidget = reinterpret_cast<cmCursesWidget*>(field_userptr( currentWidget = reinterpret_cast<cmCursesWidget*>(field_userptr(
currentField)); currentField));
bool widgetHandled=false; bool widgetHandled=false;
if ( m_SearchMode ) if ( this->SearchMode )
{ {
if ( key == 10 || key == KEY_ENTER ) if ( key == 10 || key == KEY_ENTER )
{ {
m_SearchMode = false; this->SearchMode = false;
if ( m_SearchString.size() > 0 ) if ( this->SearchString.size() > 0 )
{ {
this->JumpToCacheEntry(-1, m_SearchString.c_str()); this->JumpToCacheEntry(-1, this->SearchString.c_str());
m_OldSearchString = m_SearchString; this->OldSearchString = this->SearchString;
} }
m_SearchString = ""; this->SearchString = "";
} }
/* /*
else if ( key == KEY_ESCAPE ) else if ( key == KEY_ESCAPE )
{ {
m_SearchMode = false; this->SearchMode = false;
} }
*/ */
else if ( key >= 'a' && key <= 'z' || else if ( key >= 'a' && key <= 'z' ||
@ -909,31 +909,31 @@ void cmCursesMainForm::HandleInput()
key >= '0' && key <= '9' || key >= '0' && key <= '9' ||
key == '_' ) key == '_' )
{ {
if ( m_SearchString.size() < static_cast<std::string::size_type>(x-10) ) if ( this->SearchString.size() < static_cast<std::string::size_type>(x-10) )
{ {
m_SearchString += key; this->SearchString += key;
} }
} }
else if ( key == ctrl('h') || key == KEY_BACKSPACE || key == KEY_DC ) else if ( key == ctrl('h') || key == KEY_BACKSPACE || key == KEY_DC )
{ {
if ( m_SearchString.size() > 0 ) if ( this->SearchString.size() > 0 )
{ {
m_SearchString.resize(m_SearchString.size()-1); this->SearchString.resize(this->SearchString.size()-1);
} }
} }
} }
else if (currentWidget && !m_SearchMode) else if (currentWidget && !this->SearchMode)
{ {
// Ask the current widget if it wants to handle input // Ask the current widget if it wants to handle input
widgetHandled = currentWidget->HandleInput(key, this, stdscr); widgetHandled = currentWidget->HandleInput(key, this, stdscr);
if (widgetHandled) if (widgetHandled)
{ {
m_OkToGenerate = false; this->OkToGenerate = false;
this->UpdateStatusBar(); this->UpdateStatusBar();
this->PrintKeys(); this->PrintKeys();
} }
} }
if ((!currentWidget || !widgetHandled) && !m_SearchMode) if ((!currentWidget || !widgetHandled) && !this->SearchMode)
{ {
// If the current widget does not want to handle input, // If the current widget does not want to handle input,
// we handle it. // we handle it.
@ -951,19 +951,19 @@ void cmCursesMainForm::HandleInput()
// (index always corresponds to the value field) // (index always corresponds to the value field)
else if ( key == KEY_DOWN || key == ctrl('n') ) else if ( key == KEY_DOWN || key == ctrl('n') )
{ {
FIELD* cur = current_field(m_Form); FIELD* cur = current_field(this->Form);
int findex = field_index(cur); int findex = field_index(cur);
if ( findex == 3*m_NumberOfVisibleEntries-1 ) if ( findex == 3*this->NumberOfVisibleEntries-1 )
{ {
continue; continue;
} }
if (new_page(m_Fields[findex+1])) if (new_page(this->Fields[findex+1]))
{ {
form_driver(m_Form, REQ_NEXT_PAGE); form_driver(this->Form, REQ_NEXT_PAGE);
} }
else else
{ {
form_driver(m_Form, REQ_NEXT_FIELD); form_driver(this->Form, REQ_NEXT_FIELD);
} }
} }
// if not beginning of page, previous field, otherwise previous page // if not beginning of page, previous field, otherwise previous page
@ -973,31 +973,31 @@ void cmCursesMainForm::HandleInput()
// (index always corresponds to the value field) // (index always corresponds to the value field)
else if ( key == KEY_UP || key == ctrl('p') ) else if ( key == KEY_UP || key == ctrl('p') )
{ {
FIELD* cur = current_field(m_Form); FIELD* cur = current_field(this->Form);
int findex = field_index(cur); int findex = field_index(cur);
if ( findex == 2 ) if ( findex == 2 )
{ {
continue; continue;
} }
if ( new_page(m_Fields[findex-2]) ) if ( new_page(this->Fields[findex-2]) )
{ {
form_driver(m_Form, REQ_PREV_PAGE); form_driver(this->Form, REQ_PREV_PAGE);
set_current_field(m_Form, m_Fields[findex-3]); set_current_field(this->Form, this->Fields[findex-3]);
} }
else else
{ {
form_driver(m_Form, REQ_PREV_FIELD); form_driver(this->Form, REQ_PREV_FIELD);
} }
} }
// pg down // pg down
else if ( key == KEY_NPAGE || key == ctrl('d') ) else if ( key == KEY_NPAGE || key == ctrl('d') )
{ {
form_driver(m_Form, REQ_NEXT_PAGE); form_driver(this->Form, REQ_NEXT_PAGE);
} }
// pg up // pg up
else if ( key == KEY_PPAGE || key == ctrl('u') ) else if ( key == KEY_PPAGE || key == ctrl('u') )
{ {
form_driver(m_Form, REQ_PREV_PAGE); form_driver(this->Form, REQ_PREV_PAGE);
} }
// configure // configure
else if ( key == 'c' ) else if ( key == 'c' )
@ -1009,14 +1009,14 @@ void cmCursesMainForm::HandleInput()
{ {
getmaxyx(stdscr, y, x); getmaxyx(stdscr, y, x);
FIELD* cur = current_field(m_Form); FIELD* cur = current_field(this->Form);
int findex = field_index(cur); int findex = field_index(cur);
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr( cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
m_Fields[findex-2])); this->Fields[findex-2]));
const char* curField = lbl->GetValue(); const char* curField = lbl->GetValue();
const char* helpString=0; const char* helpString=0;
cmCacheManager::CacheIterator it = cmCacheManager::CacheIterator it =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator(curField); this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
if (!it.IsAtEnd()) if (!it.IsAtEnd())
{ {
helpString = it.GetProperty("HELPSTRING"); helpString = it.GetProperty("HELPSTRING");
@ -1026,28 +1026,28 @@ void cmCursesMainForm::HandleInput()
char* message = new char[strlen(curField)+strlen(helpString) char* message = new char[strlen(curField)+strlen(helpString)
+strlen("Current option is: \n Help string for this option is: \n")+10]; +strlen("Current option is: \n Help string for this option is: \n")+10];
sprintf(message,"Current option is: %s\nHelp string for this option is: %s\n", curField, helpString); sprintf(message,"Current option is: %s\nHelp string for this option is: %s\n", curField, helpString);
m_HelpMessage[1] = message; this->HelpMessage[1] = message;
delete[] message; delete[] message;
} }
else else
{ {
m_HelpMessage[1] = ""; this->HelpMessage[1] = "";
} }
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(m_HelpMessage, cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(this->HelpMessage,
"Help."); "Help.");
CurrentForm = msgs; CurrentForm = msgs;
msgs->Render(1,1,x,y); msgs->Render(1,1,x,y);
msgs->HandleInput(); msgs->HandleInput();
CurrentForm = this; CurrentForm = this;
this->Render(1,1,x,y); this->Render(1,1,x,y);
set_current_field(m_Form, cur); set_current_field(this->Form, cur);
} }
// display last errors // display last errors
else if ( key == 'l' ) else if ( key == 'l' )
{ {
getmaxyx(stdscr, y, x); getmaxyx(stdscr, y, x);
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(m_Errors, cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(this->Errors,
"Errors occurred during the last pass."); "Errors occurred during the last pass.");
CurrentForm = msgs; CurrentForm = msgs;
msgs->Render(1,1,x,y); msgs->Render(1,1,x,y);
@ -1057,7 +1057,7 @@ void cmCursesMainForm::HandleInput()
} }
else if ( key == '/' ) else if ( key == '/' )
{ {
m_SearchMode = true; this->SearchMode = true;
this->UpdateStatusBar("Search"); this->UpdateStatusBar("Search");
this->PrintKeys(1); this->PrintKeys(1);
touchwin(stdscr); touchwin(stdscr);
@ -1065,21 +1065,21 @@ void cmCursesMainForm::HandleInput()
} }
else if ( key == 'n' ) else if ( key == 'n' )
{ {
if ( m_OldSearchString.size() > 0 ) if ( this->OldSearchString.size() > 0 )
{ {
this->JumpToCacheEntry(-1, m_OldSearchString.c_str()); this->JumpToCacheEntry(-1, this->OldSearchString.c_str());
} }
} }
// switch advanced on/off // switch advanced on/off
else if ( key == 't' ) else if ( key == 't' )
{ {
if (m_AdvancedMode) if (this->AdvancedMode)
{ {
m_AdvancedMode = false; this->AdvancedMode = false;
} }
else else
{ {
m_AdvancedMode = true; this->AdvancedMode = true;
} }
getmaxyx(stdscr, y, x); getmaxyx(stdscr, y, x);
this->RePost(); this->RePost();
@ -1088,17 +1088,17 @@ void cmCursesMainForm::HandleInput()
// generate and exit // generate and exit
else if ( key == 'g' ) else if ( key == 'g' )
{ {
if ( m_OkToGenerate ) if ( this->OkToGenerate )
{ {
this->Generate(); this->Generate();
break; break;
} }
} }
// delete cache entry // delete cache entry
else if ( key == 'd' && m_NumberOfVisibleEntries ) else if ( key == 'd' && this->NumberOfVisibleEntries )
{ {
m_OkToGenerate = false; this->OkToGenerate = false;
FIELD* cur = current_field(m_Form); FIELD* cur = current_field(this->Form);
int findex = field_index(cur); int findex = field_index(cur);
// make the next or prev. current field after deletion // make the next or prev. current field after deletion
@ -1111,13 +1111,13 @@ void cmCursesMainForm::HandleInput()
{ {
nextCur=0; nextCur=0;
} }
else if ( findex == 3*m_NumberOfVisibleEntries-1 ) else if ( findex == 3*this->NumberOfVisibleEntries-1 )
{ {
nextCur = m_Fields[findex-5]; nextCur = this->Fields[findex-5];
} }
else else
{ {
nextCur = m_Fields[findex+1]; nextCur = this->Fields[findex+1];
} }
// Get the label widget // Get the label widget
@ -1126,10 +1126,10 @@ void cmCursesMainForm::HandleInput()
// (findex always corresponds to the value field) // (findex always corresponds to the value field)
cmCursesWidget* lbl cmCursesWidget* lbl
= reinterpret_cast<cmCursesWidget*>( = reinterpret_cast<cmCursesWidget*>(
field_userptr(m_Fields[findex-2])); field_userptr(this->Fields[findex-2]));
if ( lbl ) if ( lbl )
{ {
this->m_CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue()); this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue());
std::string nextVal; std::string nextVal;
if (nextCur) if (nextCur)
@ -1147,17 +1147,17 @@ void cmCursesMainForm::HandleInput()
// make the next or prev. current field after deletion // make the next or prev. current field after deletion
nextCur = 0; nextCur = 0;
std::vector<cmCursesCacheEntryComposite*>::iterator it; std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
if (nextVal == (*it)->m_Key) if (nextVal == (*it)->Key)
{ {
nextCur = (*it)->m_Entry->m_Field; nextCur = (*it)->Entry->Field;
} }
} }
if (nextCur) if (nextCur)
{ {
set_current_field(m_Form, nextCur); set_current_field(this->Form, nextCur);
} }
} }
} }
@ -1172,13 +1172,13 @@ void cmCursesMainForm::HandleInput()
int cmCursesMainForm::LoadCache(const char *) int cmCursesMainForm::LoadCache(const char *)
{ {
int r = m_CMakeInstance->LoadCache(); int r = this->CMakeInstance->LoadCache();
if(r < 0) if(r < 0)
{ {
return r; return r;
} }
m_CMakeInstance->SetCacheArgs(m_Args); this->CMakeInstance->SetCacheArgs(this->Args);
m_CMakeInstance->PreLoadCMakeFiles(); this->CMakeInstance->PreLoadCMakeFiles();
return r; return r;
} }
@ -1190,7 +1190,7 @@ void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr)
str = cmSystemTools::LowerCase(astr); str = cmSystemTools::LowerCase(astr);
} }
if ( idx > m_NumberOfVisibleEntries ) if ( idx > this->NumberOfVisibleEntries )
{ {
return; return;
} }
@ -1198,7 +1198,7 @@ void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr)
{ {
return; return;
} }
FIELD* cur = current_field(m_Form); FIELD* cur = current_field(this->Form);
int start_index = field_index(cur); int start_index = field_index(cur);
int findex = start_index; int findex = start_index;
while ( (findex / 3) != idx ) while ( (findex / 3) != idx )
@ -1208,7 +1208,7 @@ void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr)
cmCursesWidget* lbl = 0; cmCursesWidget* lbl = 0;
if ( findex >= 0 ) if ( findex >= 0 )
{ {
lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(m_Fields[findex-2])); lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(this->Fields[findex-2]));
} }
if ( lbl ) if ( lbl )
{ {
@ -1223,27 +1223,27 @@ void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr)
} }
} }
} }
if ( findex >= 3* m_NumberOfVisibleEntries-1 ) if ( findex >= 3* this->NumberOfVisibleEntries-1 )
{ {
set_current_field(m_Form, m_Fields[2]); set_current_field(this->Form, this->Fields[2]);
} }
else if (new_page(m_Fields[findex+1])) else if (new_page(this->Fields[findex+1]))
{ {
form_driver(m_Form, REQ_NEXT_PAGE); form_driver(this->Form, REQ_NEXT_PAGE);
} }
else else
{ {
form_driver(m_Form, REQ_NEXT_FIELD); form_driver(this->Form, REQ_NEXT_FIELD);
} }
/* /*
char buffer[1024]; char buffer[1024];
sprintf(buffer, "Line: %d != %d / %d\n", findex, idx, m_NumberOfVisibleEntries); sprintf(buffer, "Line: %d != %d / %d\n", findex, idx, this->NumberOfVisibleEntries);
touchwin(stdscr); touchwin(stdscr);
refresh(); refresh();
this->UpdateStatusBar( buffer ); this->UpdateStatusBar( buffer );
usleep(100000); usleep(100000);
*/ */
cur = current_field(m_Form); cur = current_field(this->Form);
findex = field_index(cur); findex = field_index(cur);
if ( findex == start_index ) if ( findex == start_index )
{ {

View File

@ -132,39 +132,39 @@ protected:
void JumpToCacheEntry(int idx, const char* str); void JumpToCacheEntry(int idx, const char* str);
// Copies of cache entries stored in the user interface // Copies of cache entries stored in the user interface
std::vector<cmCursesCacheEntryComposite*>* m_Entries; std::vector<cmCursesCacheEntryComposite*>* Entries;
// Errors produced during last run of cmake // Errors produced during last run of cmake
std::vector<std::string> m_Errors; std::vector<std::string> Errors;
// Command line argumens to be passed to cmake each time // Command line argumens to be passed to cmake each time
// it is run // it is run
std::vector<std::string> m_Args; std::vector<std::string> Args;
// Message displayed when user presses 'h' // Message displayed when user presses 'h'
// It is: Welcome + info about current entry + common help // It is: Welcome + info about current entry + common help
std::vector<std::string> m_HelpMessage; std::vector<std::string> HelpMessage;
// Common help // Common help
static const char* s_ConstHelpMessage; static const char* s_ConstHelpMessage;
// Fields displayed. Includes labels, new entry markers, entries // Fields displayed. Includes labels, new entry markers, entries
FIELD** m_Fields; FIELD** Fields;
// Where is source of current project // Where is source of current project
std::string m_WhereSource; std::string WhereSource;
// Where is cmake executable // Where is cmake executable
std::string m_WhereCMake; std::string WhereCMake;
// Number of entries shown (depends on mode -normal or advanced-) // Number of entries shown (depends on mode -normal or advanced-)
int m_NumberOfVisibleEntries; int NumberOfVisibleEntries;
bool m_AdvancedMode; bool AdvancedMode;
// Did the iteration converge (no new entries) ? // Did the iteration converge (no new entries) ?
bool m_OkToGenerate; bool OkToGenerate;
// Number of pages displayed // Number of pages displayed
int m_NumberOfPages; int NumberOfPages;
int m_InitialWidth; int InitialWidth;
cmake *m_CMakeInstance; cmake *CMakeInstance;
std::string m_SearchString; std::string SearchString;
std::string m_OldSearchString; std::string OldSearchString;
bool m_SearchMode; bool SearchMode;
}; };
#endif // __cmCursesMainForm_h #endif // __cmCursesMainForm_h

View File

@ -23,16 +23,16 @@ cmCursesPathWidget::cmCursesPathWidget(int width, int height,
int left, int top) : int left, int top) :
cmCursesStringWidget(width, height, left, top) cmCursesStringWidget(width, height, left, top)
{ {
m_Type = cmCacheManager::PATH; this->Type = cmCacheManager::PATH;
m_Cycle = false; this->Cycle = false;
m_CurrentIndex = 0; this->CurrentIndex = 0;
} }
void cmCursesPathWidget::OnType(int& key, cmCursesMainForm* fm, WINDOW* w) void cmCursesPathWidget::OnType(int& key, cmCursesMainForm* fm, WINDOW* w)
{ {
m_Cycle = false; this->Cycle = false;
m_CurrentIndex = 0; this->CurrentIndex = 0;
m_LastGlob = ""; this->LastGlob = "";
this->cmCursesStringWidget::OnType(key, fm, w); this->cmCursesStringWidget::OnType(key, fm, w);
} }
@ -47,16 +47,16 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w)
form_driver(form, REQ_PREV_FIELD); form_driver(form, REQ_PREV_FIELD);
std::string cstr = this->GetString(); std::string cstr = this->GetString();
cstr = cstr.substr(0, cstr.find_last_not_of(" \t\n\r")+1); cstr = cstr.substr(0, cstr.find_last_not_of(" \t\n\r")+1);
if ( m_LastString != cstr ) if ( this->LastString != cstr )
{ {
m_Cycle = false; this->Cycle = false;
m_CurrentIndex = 0; this->CurrentIndex = 0;
m_LastGlob = ""; this->LastGlob = "";
} }
std::string glob; std::string glob;
if ( m_Cycle ) if ( this->Cycle )
{ {
glob = m_LastGlob; glob = this->LastGlob;
} }
else else
{ {
@ -64,10 +64,10 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w)
} }
std::vector<cmStdString> dirs; std::vector<cmStdString> dirs;
cmSystemTools::SimpleGlob(glob.c_str(), dirs, (m_Type == cmCacheManager::PATH?-1:0)); cmSystemTools::SimpleGlob(glob.c_str(), dirs, (this->Type == cmCacheManager::PATH?-1:0));
if ( m_CurrentIndex < dirs.size() ) if ( this->CurrentIndex < dirs.size() )
{ {
cstr = dirs[m_CurrentIndex]; cstr = dirs[this->CurrentIndex];
} }
if ( cstr[cstr.size()-1] == '*' ) if ( cstr[cstr.size()-1] == '*' )
{ {
@ -83,13 +83,13 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w)
touchwin(w); touchwin(w);
wrefresh(w); wrefresh(w);
form_driver(form, REQ_END_FIELD); form_driver(form, REQ_END_FIELD);
m_LastGlob = glob; this->LastGlob = glob;
m_LastString = cstr; this->LastString = cstr;
m_Cycle = true; this->Cycle = true;
m_CurrentIndex ++; this->CurrentIndex ++;
if ( m_CurrentIndex >= dirs.size() ) if ( this->CurrentIndex >= dirs.size() )
{ {
m_CurrentIndex = 0; this->CurrentIndex = 0;
} }
} }

View File

@ -36,10 +36,10 @@ protected:
cmCursesPathWidget(const cmCursesPathWidget& from); cmCursesPathWidget(const cmCursesPathWidget& from);
void operator=(const cmCursesPathWidget&); void operator=(const cmCursesPathWidget&);
std::string m_LastString; std::string LastString;
std::string m_LastGlob; std::string LastGlob;
bool m_Cycle; bool Cycle;
std::string::size_type m_CurrentIndex; std::string::size_type CurrentIndex;
}; };
#endif // __cmCursesPathWidget_h #endif // __cmCursesPathWidget_h

View File

@ -26,11 +26,11 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height,
int left, int top) : int left, int top) :
cmCursesWidget(width, height, left, top) cmCursesWidget(width, height, left, top)
{ {
m_InEdit = false; this->InEdit = false;
m_Type = cmCacheManager::STRING; this->Type = cmCacheManager::STRING;
set_field_fore(m_Field, A_NORMAL); set_field_fore(this->Field, A_NORMAL);
set_field_back(m_Field, A_STANDOUT); set_field_back(this->Field, A_STANDOUT);
field_opts_off(m_Field, O_STATIC); field_opts_off(this->Field, O_STATIC);
} }
void cmCursesStringWidget::OnTab(cmCursesMainForm*, WINDOW*) void cmCursesStringWidget::OnTab(cmCursesMainForm*, WINDOW*)
@ -41,25 +41,25 @@ void cmCursesStringWidget::OnTab(cmCursesMainForm*, WINDOW*)
void cmCursesStringWidget::OnReturn(cmCursesMainForm* fm, WINDOW*) void cmCursesStringWidget::OnReturn(cmCursesMainForm* fm, WINDOW*)
{ {
FORM* form = fm->GetForm(); FORM* form = fm->GetForm();
if (m_InEdit) if (this->InEdit)
{ {
cmCursesForm::LogMessage("String widget leaving edit."); cmCursesForm::LogMessage("String widget leaving edit.");
m_InEdit = false; this->InEdit = false;
fm->PrintKeys(); fm->PrintKeys();
delete[] m_OriginalString; delete[] this->OriginalString;
// trick to force forms to update the field buffer // trick to force forms to update the field buffer
form_driver(form, REQ_NEXT_FIELD); form_driver(form, REQ_NEXT_FIELD);
form_driver(form, REQ_PREV_FIELD); form_driver(form, REQ_PREV_FIELD);
m_Done = true; this->Done = true;
} }
else else
{ {
cmCursesForm::LogMessage("String widget entering edit."); cmCursesForm::LogMessage("String widget entering edit.");
m_InEdit = true; this->InEdit = true;
fm->PrintKeys(); fm->PrintKeys();
char* buf = field_buffer(m_Field, 0); char* buf = field_buffer(this->Field, 0);
m_OriginalString = new char[strlen(buf)+1]; this->OriginalString = new char[strlen(buf)+1];
strcpy(m_OriginalString, buf); strcpy(this->OriginalString, buf);
} }
} }
@ -75,18 +75,18 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
FORM* form = fm->GetForm(); FORM* form = fm->GetForm();
// 10 == enter // 10 == enter
if (!m_InEdit && ( key != 10 && key != KEY_ENTER ) ) if (!this->InEdit && ( key != 10 && key != KEY_ENTER ) )
{ {
return false; return false;
} }
m_OriginalString=0; this->OriginalString=0;
m_Done = false; this->Done = false;
char debugMessage[128]; char debugMessage[128];
// <Enter> is used to change edit mode (like <Esc> in vi). // <Enter> is used to change edit mode (like <Esc> in vi).
while(!m_Done) while(!this->Done)
{ {
sprintf(debugMessage, "String widget handling input, key: %d", key); sprintf(debugMessage, "String widget handling input, key: %d", key);
cmCursesForm::LogMessage(debugMessage); cmCursesForm::LogMessage(debugMessage);
@ -111,7 +111,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
} }
// If resize occured during edit, move out of edit mode // If resize occured during edit, move out of edit mode
if (!m_InEdit && ( key != 10 && key != KEY_ENTER ) ) if (!this->InEdit && ( key != 10 && key != KEY_ENTER ) )
{ {
return false; return false;
} }
@ -125,8 +125,8 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
key == KEY_NPAGE || key == ctrl('d') || key == KEY_NPAGE || key == ctrl('d') ||
key == KEY_PPAGE || key == ctrl('u')) key == KEY_PPAGE || key == ctrl('u'))
{ {
m_InEdit = false; this->InEdit = false;
delete[] m_OriginalString; delete[] this->OriginalString;
// trick to force forms to update the field buffer // trick to force forms to update the field buffer
form_driver(form, REQ_NEXT_FIELD); form_driver(form, REQ_NEXT_FIELD);
form_driver(form, REQ_PREV_FIELD); form_driver(form, REQ_PREV_FIELD);
@ -135,12 +135,12 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
// esc // esc
else if (key == 27) else if (key == 27)
{ {
if (m_InEdit) if (this->InEdit)
{ {
m_InEdit = false; this->InEdit = false;
fm->PrintKeys(); fm->PrintKeys();
this->SetString(m_OriginalString); this->SetString(this->OriginalString);
delete[] m_OriginalString; delete[] this->OriginalString;
touchwin(w); touchwin(w);
wrefresh(w); wrefresh(w);
return true; return true;
@ -182,7 +182,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
{ {
this->OnType(key, fm, w); this->OnType(key, fm, w);
} }
if ( !m_Done ) if ( !this->Done )
{ {
touchwin(w); touchwin(w);
wrefresh(w); wrefresh(w);
@ -205,7 +205,7 @@ const char* cmCursesStringWidget::GetString()
const char* cmCursesStringWidget::GetValue() const char* cmCursesStringWidget::GetValue()
{ {
return field_buffer(m_Field, 0); return field_buffer(this->Field, 0);
} }
bool cmCursesStringWidget::PrintKeys() bool cmCursesStringWidget::PrintKeys()
@ -217,7 +217,7 @@ bool cmCursesStringWidget::PrintKeys()
{ {
return false; return false;
} }
if (m_InEdit) if (this->InEdit)
{ {
char firstLine[512]; char firstLine[512];
// Clean the toolbar // Clean the toolbar

View File

@ -50,10 +50,8 @@ public:
* Set/Get InEdit flag. Can be used to tell the widget to leave * Set/Get InEdit flag. Can be used to tell the widget to leave
* edit mode (in case of a resize for example). * edit mode (in case of a resize for example).
*/ */
void SetInEdit(bool inedit) void SetInEdit(bool inedit) { this->InEdit = inedit; }
{ m_InEdit = inedit; } bool GetInEdit() { return this->InEdit; }
bool GetInEdit()
{ return m_InEdit; }
/** /**
* This method is called when different keys are pressed. The * This method is called when different keys are pressed. The
@ -75,9 +73,9 @@ protected:
void operator=(const cmCursesStringWidget&); void operator=(const cmCursesStringWidget&);
// true if the widget is in edit mode // true if the widget is in edit mode
bool m_InEdit; bool InEdit;
char* m_OriginalString; char* OriginalString;
bool m_Done; bool Done;
}; };
#endif // __cmCursesStringWidget_h #endif // __cmCursesStringWidget_h

View File

@ -18,46 +18,46 @@
cmCursesWidget::cmCursesWidget(int width, int height, int left, int top) cmCursesWidget::cmCursesWidget(int width, int height, int left, int top)
{ {
m_Field = new_field(height, width, top, left, 0, 0); this->Field = new_field(height, width, top, left, 0, 0);
set_field_userptr(m_Field, reinterpret_cast<char*>(this)); set_field_userptr(this->Field, reinterpret_cast<char*>(this));
field_opts_off(m_Field, O_AUTOSKIP); field_opts_off(this->Field, O_AUTOSKIP);
m_Page = 0; this->Page = 0;
} }
cmCursesWidget::~cmCursesWidget() cmCursesWidget::~cmCursesWidget()
{ {
if (m_Field) if (this->Field)
{ {
free_field(m_Field); free_field(this->Field);
m_Field = 0; this->Field = 0;
} }
} }
void cmCursesWidget::Move(int x, int y, bool isNewPage) void cmCursesWidget::Move(int x, int y, bool isNewPage)
{ {
if (!m_Field) if (!this->Field)
{ {
return; return;
} }
move_field(m_Field, y, x); move_field(this->Field, y, x);
if (isNewPage) if (isNewPage)
{ {
set_new_page(m_Field, TRUE); set_new_page(this->Field, TRUE);
} }
else else
{ {
set_new_page(m_Field, FALSE); set_new_page(this->Field, FALSE);
} }
} }
void cmCursesWidget::SetValue(const char* value) void cmCursesWidget::SetValue(const char* value)
{ {
m_Value = value; this->Value = value;
set_field_buffer(m_Field, 0, value); set_field_buffer(this->Field, 0, value);
} }
const char* cmCursesWidget::GetValue() const char* cmCursesWidget::GetValue()
{ {
return m_Value.c_str(); return this->Value.c_str();
} }

View File

@ -52,7 +52,7 @@ public:
* Get the type of the widget (STRING, PATH etc...) * Get the type of the widget (STRING, PATH etc...)
*/ */
cmCacheManager::CacheEntryType GetType() cmCacheManager::CacheEntryType GetType()
{ return m_Type; } { return this->Type; }
/** /**
* If there are any, print the widget specific commands * If there are any, print the widget specific commands
@ -69,11 +69,11 @@ public:
*/ */
void SetPage(int page) void SetPage(int page)
{ {
m_Page = page; this->Page = page;
} }
int GetPage() int GetPage()
{ {
return m_Page; return this->Page;
} }
friend class cmCursesMainForm; friend class cmCursesMainForm;
@ -82,11 +82,11 @@ protected:
cmCursesWidget(const cmCursesWidget& from); cmCursesWidget(const cmCursesWidget& from);
void operator=(const cmCursesWidget&); void operator=(const cmCursesWidget&);
cmCacheManager::CacheEntryType m_Type; cmCacheManager::CacheEntryType Type;
std::string m_Value; std::string Value;
FIELD* m_Field; FIELD* Field;
// The page in the main form this widget is in // The page in the main form this widget is in
int m_Page; int Page;
}; };
#endif // __cmCursesWidget_h #endif // __cmCursesWidget_h