| 205 | } |
| 206 | |
| 207 | void cmCursesMainForm::Render(int left, int top, int width, int height) |
| 208 | { |
| 209 | |
| 210 | if (this->Form) { |
| 211 | FIELD* currentField = current_field(this->Form); |
| 212 | cmCursesWidget* cw = |
| 213 | reinterpret_cast<cmCursesWidget*>(field_userptr(currentField)); |
| 214 | // If in edit mode, get out of it |
| 215 | if (cw->GetType() == cmStateEnums::STRING || |
| 216 | cw->GetType() == cmStateEnums::PATH || |
| 217 | cw->GetType() == cmStateEnums::FILEPATH) { |
| 218 | cmCursesStringWidget* sw = static_cast<cmCursesStringWidget*>(cw); |
| 219 | sw->SetInEdit(false); |
| 220 | } |
| 221 | // Delete the previous form |
| 222 | unpost_form(this->Form); |
| 223 | free_form(this->Form); |
| 224 | this->Form = nullptr; |
| 225 | } |
| 226 | |
| 227 | // Wrong window size |
| 228 | if (width < cmCursesMainForm::MIN_WIDTH || width < this->InitialWidth || |
| 229 | height < cmCursesMainForm::MIN_HEIGHT) { |
| 230 | return; |
| 231 | } |
| 232 | |
| 233 | // Leave room for toolbar |
| 234 | height -= 7; |
| 235 | |
| 236 | if (this->AdvancedMode) { |
| 237 | this->NumberOfVisibleEntries = this->Entries.size(); |
| 238 | } else { |
| 239 | // If normal, display only non-advanced entries |
| 240 | this->NumberOfVisibleEntries = 0; |
| 241 | for (cmCursesCacheEntryComposite& entry : this->Entries) { |
| 242 | cmValue existingValue = |
| 243 | this->CMakeInstance->GetState()->GetCacheEntryValue(entry.GetValue()); |
| 244 | bool advanced = |
| 245 | this->CMakeInstance->GetState()->GetCacheEntryPropertyAsBool( |
| 246 | entry.GetValue(), "ADVANCED"); |
| 247 | if (!existingValue || (!this->AdvancedMode && advanced)) { |
| 248 | continue; |
| 249 | } |
| 250 | this->NumberOfVisibleEntries++; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | // Re-adjust the fields according to their place |
| 255 | this->NumberOfPages = 1; |
| 256 | if (height > 0) { |
| 257 | bool isNewPage; |
| 258 | int i = 0; |
| 259 | for (cmCursesCacheEntryComposite& entry : this->Entries) { |
| 260 | cmValue existingValue = |
| 261 | this->CMakeInstance->GetState()->GetCacheEntryValue(entry.GetValue()); |
| 262 | bool advanced = |
| 263 | this->CMakeInstance->GetState()->GetCacheEntryPropertyAsBool( |
| 264 | entry.GetValue(), "ADVANCED"); |
no test coverage detected