Initial add of progress

This commit is contained in:
Andy Cedilnik 2002-11-18 16:29:14 -05:00
parent d05716c498
commit 65a814c989
2 changed files with 17 additions and 1 deletions

View File

@ -547,6 +547,14 @@ void cmCursesMainForm::UpdateStatusBar()
pos_form_cursor(m_Form); pos_form_cursor(m_Form);
} }
void cmCursesMainForm::UpdateProgress(const char *msg, float prog, void*)
{
if ( prog < 0 )
{
std::cout << "-- " << msg << std::endl;
}
}
int cmCursesMainForm::Configure() int cmCursesMainForm::Configure()
{ {
@ -559,7 +567,7 @@ int cmCursesMainForm::Configure()
refresh(); refresh();
endwin(); endwin();
std::cerr << "Configuring, please wait...\n\r"; std::cerr << "Configuring, please wait...\n\r";
this->m_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();
@ -573,6 +581,7 @@ int cmCursesMainForm::Configure()
// run the generate process // run the generate process
m_OkToGenerate = true; m_OkToGenerate = true;
int retVal = this->m_CMakeInstance->Configure(); int retVal = this->m_CMakeInstance->Configure();
this->m_CMakeInstance->SetProgressCallback(0, 0);
initscr(); /* Initialization */ initscr(); /* Initialization */
noecho(); /* Echo off */ noecho(); /* Echo off */
@ -623,6 +632,7 @@ int cmCursesMainForm::Generate()
refresh(); refresh();
endwin(); endwin();
std::cerr << "Generating, please wait...\n\r"; std::cerr << "Generating, please wait...\n\r";
this->m_CMakeInstance->SetProgressCallback(cmCursesMainForm::UpdateProgress, this);
// Get rid of previous errors // Get rid of previous errors
m_Errors = std::vector<std::string>(); m_Errors = std::vector<std::string>();
@ -630,6 +640,7 @@ int cmCursesMainForm::Generate()
// run the generate process // run the generate process
int retVal = this->m_CMakeInstance->Generate(); int retVal = this->m_CMakeInstance->Generate();
this->m_CMakeInstance->SetProgressCallback(0, 0);
initscr(); /* Initialization */ initscr(); /* Initialization */
noecho(); /* Echo off */ noecho(); /* Echo off */
cbreak(); /* nl- or cr not needed */ cbreak(); /* nl- or cr not needed */

View File

@ -98,6 +98,11 @@ public:
*/ */
void LoadCache(const char *dir); void LoadCache(const char *dir);
/**
* Progress callback
*/
static void UpdateProgress(const char *msg, float prog, void*);
protected: protected:
cmCursesMainForm(const cmCursesMainForm& from); cmCursesMainForm(const cmCursesMainForm& from);
void operator=(const cmCursesMainForm&); void operator=(const cmCursesMainForm&);