void layout(int w, int h) { screenBox.top = (float)h; screenBox.bottom = 0.0f; screenBox.left = 0.0f; screenBox.right = (float)w; screenBox.width = (float)w; screenBox.height = (float)h; box_inside(&screenBox, &timelineBox, 50); timelineBox.height = 30; box_update_bottom_right(&timelineBox); box_inside(&screenBox, &tachoBox, 50); tachoBox.top = timelineBox.bottom - 5; tachoBox.left += tachoBox.width/2; tachoBox.bottom = tachoBox.top - (tachoBox.right - tachoBox.left); box_update_size(&tachoBox); }
static void show_help(WINDOW *current) { /* *INDENT-OFF* */ static struct { int key; CONST_FMT char * msg; } help[] = { { '?', "Show this screen" }, { 'b', "Draw a box inside the current window" }, { 'c', "Create a new window" }, { 'd', "Create a new derived window" }, { 'D', "Move derived window (moves viewport)" }, { 'f', "Fill the current window with the next character" }, { 'F', "Fill the current window with a pattern" }, { 'm', "Move the current window" }, { 'M', "Move the current window (and its children)" }, { 'q', "Quit" }, { 's', "Create a new subwindow" }, { CTRL('L'), "Repaint all windows, doing current one last" }, { CTRL('N'), "Cursor to next window" }, { CTRL('P'), "Cursor to previous window" }, }; /* *INDENT-ON* */ WINDOW *mywin = newwin(LINES, COLS, 0, 0); int row; for (row = 0; row < LINES - 2 && row < (int) SIZEOF(help); ++row) { wmove(mywin, row + 1, 1); wprintw(mywin, "%s", keyname(help[row].key)); wmove(mywin, row + 1, 20); wprintw(mywin, "%s", help[row].msg); } box_inside(mywin); wmove(mywin, 1, 1); wgetch(mywin); delwin(mywin); refresh_all(current); }