MCPcopy Create free account
hub / github.com/Kitware/CMake / PrintKeys

Method PrintKeys

Source/CursesDialog/cmCursesMainForm.cxx:294–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294void cmCursesMainForm::PrintKeys(int process /* = 0 */)
295{
296 int x;
297 int y;
298 getmaxyx(stdscr, y, x);
299 if (x < cmCursesMainForm::MIN_WIDTH || x < this->InitialWidth ||
300 y < cmCursesMainForm::MIN_HEIGHT) {
301 return;
302 }
303
304 // Give the current widget (if it exists), a chance to print keys
305 cmCursesWidget* cw = nullptr;
306 if (this->Form) {
307 FIELD* currentField = current_field(this->Form);
308 cw = reinterpret_cast<cmCursesWidget*>(field_userptr(currentField));
309 }
310
311 char fmt_s[] = "%s";
312 if (!cw || !cw->PrintKeys()) {
313 char firstLine[512] = "";
314 char secondLine[512] = "";
315 char thirdLine[512] = "";
316 if (process) {
317 memset(firstLine, ' ', 68);
318 memset(secondLine, ' ', 68);
319 memset(thirdLine, ' ', 68);
320 } else {
321 if (this->OkToGenerate) {
322 snprintf(firstLine, sizeof(firstLine),
323 " [l] Show log output [c] Configure"
324 " [g] Generate ");
325 } else {
326 snprintf(firstLine, sizeof(firstLine),
327 " [l] Show log output [c] Configure"
328 " ");
329 }
330 {
331 char const* toggleKeyInstruction =
332 " [t] Toggle advanced mode (currently %s)";
333 snprintf(thirdLine, sizeof(thirdLine), toggleKeyInstruction,
334 this->AdvancedMode ? "on" : "off");
335 }
336 snprintf(secondLine, sizeof(secondLine),
337 " [h] Help [q] Quit without generating");
338 }
339
340 move(y - 4, 0);
341 char fmt[512] = "Keys: [enter] Edit an entry [d] Delete an entry";
342 if (process) {
343 memset(fmt, ' ', 57);
344 }
345 printw(fmt_s, fmt);
346 move(y - 3, 0);
347 printw(fmt_s, firstLine);
348 move(y - 2, 0);
349 printw(fmt_s, secondLine);
350 move(y - 1, 0);
351 printw(fmt_s, thirdLine);

Callers 2

RenderMethod · 0.95
HandleInputMethod · 0.95

Calls 8

current_fieldFunction · 0.85
field_userptrFunction · 0.85
moveFunction · 0.85
printwFunction · 0.85
pos_form_cursorFunction · 0.85
GetPageMethod · 0.80
snprintfFunction · 0.50
strlenFunction · 0.50

Tested by

no test coverage detected