Merge topic 'fix-11668-ccmake-resize-crash'

693c9a6 Avoid exceptions when ccmake terminal window is too small (#11668)
This commit is contained in:
Brad King 2011-01-26 15:21:48 -05:00 committed by CMake Topic Stage
commit c9d3b602d0
1 changed files with 24 additions and 21 deletions

View File

@ -334,32 +334,35 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
} }
// Re-adjust the fields according to their place // Re-adjust the fields according to their place
bool isNewPage;
int i=0;
this->NumberOfPages = 1; this->NumberOfPages = 1;
std::vector<cmCursesCacheEntryComposite*>::iterator it; if (height > 0)
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
cmCacheManager::CacheIterator mit = bool isNewPage;
this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue()); int i=0;
if (mit.IsAtEnd() || std::vector<cmCursesCacheEntryComposite*>::iterator it;
(!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
continue; cmCacheManager::CacheIterator mit =
} this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
int row = (i % height) + 1; if (mit.IsAtEnd() ||
int page = (i / height) + 1; (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
isNewPage = ( page > 1 ) && ( row == 1 ); {
continue;
}
int row = (i % height) + 1;
int page = (i / height) + 1;
isNewPage = ( page > 1 ) && ( row == 1 );
if (isNewPage) if (isNewPage)
{ {
this->NumberOfPages++; this->NumberOfPages++;
}
(*it)->Label->Move(left, top+row-1, isNewPage);
(*it)->IsNewLabel->Move(left+32, top+row-1, false);
(*it)->Entry->Move(left+33, top+row-1, false);
(*it)->Entry->SetPage(this->NumberOfPages);
i++;
} }
(*it)->Label->Move(left, top+row-1, isNewPage);
(*it)->IsNewLabel->Move(left+32, top+row-1, false);
(*it)->Entry->Move(left+33, top+row-1, false);
(*it)->Entry->SetPage(this->NumberOfPages);
i++;
} }
// Post the form // Post the form