static bool create(void) { int len, width; if (screen_lines < 3 || screen_cols < 8) { text_widget.close(); beep(); return FALSE; } width = max_line_width; len = get_mbs_width(title) + 2; if (width < len) width = len; text_box_y = text_lines_count; if (text_box_y > screen_lines - 2) text_box_y = screen_lines - 2; max_scroll_y = text_lines_count - text_box_y; text_box_x = width; if (text_box_x > screen_cols - 2) text_box_x = screen_cols - 2; max_scroll_x = max_line_width - text_box_x; widget_init(&text_widget, text_box_y + 2, text_box_x + 2, SCREEN_CENTER, SCREEN_CENTER, widget_attrs, WIDGET_BORDER); mvwprintw(text_widget.window, 0, (text_box_x + 2 - get_mbs_width(title) - 2) / 2, " %s ", title); if (current_top > max_scroll_y) current_top = max_scroll_y; if (current_left > max_scroll_x) current_left = max_scroll_x; update_text_lines(); update_y_scroll_bar(); update_x_scroll_bar(); return TRUE; }
static bool create(void) { const char *title; if (screen_lines < 6 || screen_cols < 36) { form_widget.close(); beep(); return FALSE; } widget_init(&form_widget, 6, 36, SCREEN_CENTER, SCREEN_CENTER, attr_textbox, WIDGET_BORDER | WIDGET_SUBWINDOW | WIDGET_CURSOR_VISIBLE); title = _("Sound Card"); mvwprintw(form_widget.window, 0, (36 - 2 - get_mbs_width(title)) / 2, " %s ", title); set_form_win(form, form_widget.window); set_form_sub(form, form_widget.subwindow); return TRUE; }