void win_hide_subwin(ProfWin *window) { if (window->layout->type == LAYOUT_SPLIT) { ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; if (layout->subwin) { delwin(layout->subwin); } layout->subwin = NULL; layout->sub_y_pos = 0; int cols = getmaxx(stdscr); wresize(layout->base.win, PAD_SIZE, cols); win_redraw(window); } else { int cols = getmaxx(stdscr); wresize(window->layout->win, PAD_SIZE, cols); win_redraw(window); } }
void Window::resize(int x, int y, int cols, int lines) { wresize(this->win, lines, cols); this->startx = x; this->starty = y; this->cols = cols; this->lines = lines; mvwin(this->win, y, x); }
int call_list_resize(PANEL *panel) { int maxx, maxy; // Get panel info call_list_info_t *info = call_list_info(panel); // Get current screen dimensions getmaxyx(stdscr, maxy, maxx); // Change the main window size wresize(panel_window(panel), maxy, maxx); // Calculate available printable area wresize(info->list_win, maxy - 5, maxx - 4); // Force list redraw call_list_clear(panel); return 0; }
void title_bar_resize(void) { int cols = getmaxx(stdscr); wresize(win, 1, cols); wbkgd(win, COLOUR_TITLE_TEXT); _title_bar_draw(); }
void NApplication::Private::resize (int rows, int cols) { this->size.rows() = rows; this->size.cols() = cols; wresize(this->screen.get(), rows, cols); wrefresh(this->screen.get()); if (this->topLevelWidget) { this->topLevelWidget->resize(rows, cols); this->topLevelWidget->update(); } }
void WindowManager::init_gameLog(bool firstTime) { if (firstTime) gameLog = newwin(10,101,27,1); else { wresize(gameLog,10,101); wclear(gameLog); } drawFrame(26,0,37,102); scrollok(gameLog,TRUE); }
void frame::set_dimension(const point& dimension) { CONS_ASSERT(handle, "inavlid handle"); if(wresize(handle.get(), dimension.y, dimension.x)==ERR) { std::ostringstream oss; oss << "Unable to resize frame from: " << get_dimension() << " to " << dimension; throw CONS_MAKE_EXCEPTION(oss.str()); } touchwin(handle.get()); }
static void leave_cmdline_mode(void) { int attr; if(getmaxy(status_bar) > 1) { curr_stats.need_redraw = 2; wresize(status_bar, 1, getmaxx(stdscr) - 19); mvwin(status_bar, getmaxy(stdscr) - 1, 0); if(prev_mode == MENU_MODE) { wresize(menu_win, getmaxy(stdscr) - 1, getmaxx(stdscr)); update_menu(); } } else { wresize(status_bar, 1, getmaxx(stdscr) - 19); } curs_set(FALSE); curr_stats.save_msg = 0; free(input_stat.line); free(input_stat.line_buf); clean_status_bar(); if(*mode == CMDLINE_MODE) *mode = prev_mode; if(*mode != MENU_MODE) update_pos_window(curr_view); attr = cfg.cs.color[CMD_LINE_COLOR].attr; wattroff(status_bar, COLOR_PAIR(DCOLOR_BASE + CMD_LINE_COLOR) | attr); if(prev_mode != MENU_MODE && prev_mode != VIEW_MODE) { draw_dir_list(curr_view, curr_view->top_line); move_to_list_pos(curr_view, curr_view->list_pos); } }
static void leave_cmdline_mode(void) { int attr; if(getmaxy(status_bar) > 1) { curr_stats.need_update = UT_FULL; wresize(status_bar, 1, getmaxx(stdscr) - FIELDS_WIDTH); mvwin(status_bar, getmaxy(stdscr) - 1, 0); if(prev_mode == MENU_MODE) { wresize(menu_win, getmaxy(stdscr) - 1, getmaxx(stdscr)); update_menu(); } } else { wresize(status_bar, 1, getmaxx(stdscr) - FIELDS_WIDTH); } curs_set(FALSE); curr_stats.save_msg = 0; free(input_stat.line); free(input_stat.initial_line); free(input_stat.line_buf); clean_status_bar(); if(*mode == CMDLINE_MODE) *mode = prev_mode; if(*mode != MENU_MODE) update_pos_window(curr_view); attr = cfg.cs.color[CMD_LINE_COLOR].attr; wattroff(status_bar, COLOR_PAIR(DCOLOR_BASE + CMD_LINE_COLOR) | attr); if(prev_mode != MENU_MODE && prev_mode != VIEW_MODE) { redraw_current_view(); } }
void clock_move(int x, int y, int w, int h){ /* Erase border for a clean move */ wbkgdset(ttyclock->framewin, COLOR_PAIR(0)); wborder(ttyclock->framewin, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); werase(ttyclock->framewin); wrefresh(ttyclock->framewin); if (ttyclock->option.date) { wbkgdset(ttyclock->datewin, COLOR_PAIR(0)); wborder(ttyclock->datewin, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); werase(ttyclock->datewin); wrefresh(ttyclock->datewin); } /* Frame win move */ mvwin(ttyclock->framewin, (ttyclock->geo.x = x), (ttyclock->geo.y = y)); wresize(ttyclock->framewin, (ttyclock->geo.h = h), (ttyclock->geo.w = w)); /* Date win move */ if (ttyclock->option.date) { mvwin(ttyclock->datewin, ttyclock->geo.x + ttyclock->geo.h - 1, ttyclock->geo.y + (ttyclock->geo.w / 2) - (strlen(ttyclock->date.datestr) / 2) - 1); wresize(ttyclock->datewin, DATEWINH, strlen(ttyclock->date.datestr) + 2); if (ttyclock->option.box) { box(ttyclock->datewin, 0, 0); } } if (ttyclock->option.box) { box(ttyclock->framewin, 0, 0); } wrefresh(ttyclock->framewin); wrefresh(ttyclock->datewin); return; }
void progress_bar_resize(struct progress_bar *p, unsigned width, int y, int x) { assert(p != NULL); p->window.cols = width; wresize(p->window.w, 1, width); mvwin(p->window.w, y, x); progress_bar_calc(p); }
void taylortrack::vis::OutputVisualizer::handle_resize() { int rows, cols; // retrieve window size getmaxyx(stdscr, rows, cols); if (rows != this->rows_ || cols != this->cols_) { if (this->show_top_window_) { wresize(this->top_window_, 4, cols); wresize(this->main_window_, rows - 4, cols); if (cols != this->cols_) { this->update_top_window(); } } else { wresize(this->main_window_, rows, cols); } this->rows_ = rows; this->cols_ = cols; } }
void resize_windows() { struct window_dimensions *dimensions; set_status_window_size(); dimensions = status_win_dimensions; wresize(status_win, dimensions->height, dimensions->width); mvwin(status_win, dimensions->starty, dimensions->startx); wclear(status_win); box(status_win, 0, 0); show_status(); wrefresh(status_win); set_main_window_size(); dimensions = main_win_dimensions; wresize(main_win, dimensions->height, dimensions->width); handle_resize(main_win); show_files(main_win); }
void WindowManager::init_debugLog(bool firstTime) { if (firstTime) debugLog = newwin(10,101,39,1); else { wresize(debugLog,10,101); wclear(debugLog); } drawFrame(38,0,49,102); scrollok(debugLog,TRUE); }
/* Determine the actual size of the main window. */ void term_size (WINDOW * main_win, int *main_win_height) { int term_h = 0, term_w = 0; getmaxyx (stdscr, term_h, term_w); *main_win_height = term_h - (MAX_HEIGHT_HEADER + MAX_HEIGHT_FOOTER); wresize (main_win, *main_win_height, term_w); wmove (main_win, *main_win_height, 0); }
void CTabWidget::setSize(uint width, uint height) { _size.set(width, height); wresize(_window, height, width); replace_panel(_panel, _window); for(vector<CWidget *>::const_iterator i = _widgets.begin(); i != _widgets.end(); ++i) (*i)->setSize(width, height - 1); _changed = true; }
void handle_window_resizing() { Position act_term_size; // stdscr is global variable from ncurses library for main screen getmaxyx(stdscr, act_term_size.y, act_term_size.x); if (act_term_size.y != term_size.y || act_term_size.x != term_size.x) { check_term_size(); term_size.x = act_term_size.x; term_size.y = act_term_size.y; computer.x = term_size.x-2; wresize(info, INFO_HEIGHT, term_size.x); wresize(field, term_size.y - INFO_HEIGHT, term_size.x); wclear(stdscr); } }
void WindowManager::init_levelView(bool firstTime) { if (firstTime) levelView = newwin(21,21,4,41); else { wresize(levelView,21,21); wclear(levelView); } drawFrame(3,40,25,62); drawFrame(3,0,25,39); drawFrame(3,63,25,102); }
void WindowManager::init_title(bool firstTime) { if (firstTime) title = newwin(1,101,1,1); else { wresize(title,1,101); wclear(title); } drawFrame(0,0,2,102); mvwprintw(title,0,41,"chiasmus"); }
static void create_or_move_display_separator(int height, int x) { if (!display_sep) { display_sep = newwin(height, 1, 0, x); if (!display_sep) die("Failed to create separator window"); } else { wresize(display_sep, height, 1); mvwin(display_sep, 0, x); } }
void CWidget::setSize(uint width, uint height) { DEBUG_ui("CWidget::setSize [" + _name + "]"); _size.set(width, height); wresize(_window, height, width); replace_panel(_panel, _window); if(_layout) _layout->setSize(width, height); _changed = true; }
void ui(void) { int max_x, max_y; getmaxyx ( stdscr, max_y, max_x ); if ( mx != max_x || my != max_y ) { mx = max_x; my = max_y; wresize ( vi_w, 10, max_x ); mvwin ( vi_w, 0, 0 ); wresize ( log_w, max_y- 10 - 3, max_x ); mvwin ( log_w, 10, 0 ); wresize ( log_iw, max_y- 10 - 3-2, max_x-2 ); mvwin ( log_iw, 11, 1 ); wresize ( shell_w, 3, max_x ); mvwin ( shell_w, 10+max_y- 10 - 3, 0 ); box ( vi_w, 0, 0 ); mvwprintw ( vi_w, 0, 1, " Samu's visual imagery " ); box ( log_w, 0, 0 ); mvwprintw ( log_w, 0, 1, " Samu's answers " ); box ( shell_w, 0, 0 ); mvwprintw ( shell_w, 0, 1, " Caregiver shell " ); mvwprintw ( shell_w, 1, 1, "Norbi> " ); wrefresh ( vi_w ); wrefresh ( log_w ); wrefresh ( log_iw ); wrefresh ( shell_w ); } }
int main(int argc, char *argv[]) { int c; /* c must be int not char, because the value of KEY_RESIZE is 632. */ char buf[BUFSIZ]; enum request request; request = REQ_VIEW_MAIN; struct view *view; if (argc < 2) { printf("Usage: %s <dir/filename> <keyword>\n", argv[0]); return; } signal(SIGINT, quit); if (argc == 3) { snprintf(buf, sizeof(buf), FIND_CMDD, argv[1], argv[2]); string_copy(fmt_cmd, buf); }else{ snprintf(buf, sizeof(buf), FIND_CMD, argv[1]); string_copy(fmt_cmd, buf); } init(); while (view_driver(display[current_view], request)) { int i; foreach_view (view, i) update_view(view); c = wgetch(status_win); request = get_request(c); if ( request == REQ_SCREEN_RESIZE) { int height, width; getmaxyx(stdscr, height, width); wresize(status_win, 1, width); mvwin(status_win, height - 1, 0); wrefresh(status_win); } } quit(0); return 0; }
/* * Needed for SIGWINCH handling. */ void pad_resize(void) { set_size(main_pad); if(!main_pad->wd) return; // wresize(border_wd, main_pad->size_y-PAD_Y+3, main_pad->size_x-PAD_X+3); wresize(border_wd, BORDER_ROWS+1, BORDER_COLS+1); werase(border_wd); box(border_wd, ACS_VLINE, ACS_HLINE); print_titles(); wbkgd(main_pad->wd, COLOR_PAIR(8)); werase(main_pad->wd); pad_draw(); pad_refresh(); }
void hi_ncurses_fpager_resize(hi_ncurses_fpager *pager, int height, int width, int y, int x) { pager->x = x; pager->y = y; pager->width = width; pager->height = height; update_bytes_per_line(pager); wresize(pager->window,height, width); mvwin(pager->window, y, x); box(pager->window, 0, 0); werase(pager->window); }
void handle_resize() /* {{{ */ { /* handle a change in screen size */ int pagerheight; /* make sure rows and cols are set correctly */ rows = getmaxy(stdscr); cols = getmaxx(stdscr); /* resize windows */ wresize(header, 1, cols); wresize(tasklist, rows-2, cols); wresize(statusbar, 1, cols); /* move to proper positions */ mvwin(header, 0, 0); mvwin(tasklist, 1, 0); mvwin(statusbar, rows-1, 0); /* handle pager */ if (pager != NULL) { pagerheight = getmaxy(pager); if (pagerheight > rows-2) pagerheight = rows-2; wresize(pager, pagerheight, cols); mvwin(pager, rows-pagerheight-1, 0); } /* redraw windows */ tasklist_print_task_list(); print_header(); /* message about resize */ tnc_fprintf(logfp, LOG_DEBUG, "window resized to y=%d x=%d", rows, cols); statusbar_message(cfg.statusbar_timeout, "window resized to y=%d x=%d", rows, cols); } /* }}} */
void redraw_sort_dialog(void) { int x, y, cy; y = (getmaxy(stdscr) - ((top + SK_COUNT) - 2 + 3))/2; x = (getmaxx(stdscr) - SORT_WIN_WIDTH)/2; wresize(sort_win, MIN(getmaxy(stdscr), SK_COUNT + 6), SORT_WIN_WIDTH); mvwin(sort_win, MAX(0, y), x); werase(sort_win); box(sort_win, 0, 0); mvwaddstr(sort_win, 0, (getmaxx(sort_win) - 6)/2, " Sort "); mvwaddstr(sort_win, top - 2, 2, " Sort files by:"); cy = top; mvwaddstr(sort_win, cy++, 2, " [ ] e Extension"); mvwaddstr(sort_win, cy++, 2, " [ ] f File Extension"); mvwaddstr(sort_win, cy++, 2, " [ ] n Name"); mvwaddstr(sort_win, cy++, 2, " [ ] N Name (ignore case)"); mvwaddstr(sort_win, cy++, 2, " [ ] t Type"); mvwaddstr(sort_win, cy++, 2, " [ ] d Dir"); #ifndef _WIN32 mvwaddstr(sort_win, cy++, 2, " [ ] r Group ID"); mvwaddstr(sort_win, cy++, 2, " [ ] R Group Name"); mvwaddstr(sort_win, cy++, 2, " [ ] M Mode"); mvwaddstr(sort_win, cy++, 2, " [ ] p Permissions"); mvwaddstr(sort_win, cy++, 2, " [ ] o Owner ID"); mvwaddstr(sort_win, cy++, 2, " [ ] O Owner Name"); mvwaddstr(sort_win, cy++, 2, " [ ] L Links Count"); mvwaddstr(sort_win, cy++, 2, " [ ] I Inode"); #endif mvwaddstr(sort_win, cy++, 2, " [ ] s Size"); mvwaddstr(sort_win, cy++, 2, " [ ] i Item Count"); mvwaddstr(sort_win, cy++, 2, " [ ] u Groups"); mvwaddstr(sort_win, cy++, 2, " [ ] T Link Target"); mvwaddstr(sort_win, cy++, 2, " [ ] a Time Accessed"); #ifndef _WIN32 mvwaddstr(sort_win, cy++, 2, " [ ] c Time Changed"); #else mvwaddstr(sort_win, cy++, 2, " [ ] c Time Created"); #endif mvwaddstr(sort_win, cy++, 2, " [ ] m Time Modified"); mvwaddstr(sort_win, cy++, 2, " [ ] S Star Rating"); //add by sim1 assert(cy - top == SK_COUNT && "Sort dialog and sort options should not diverge"); print_at_pos(); ui_refresh_win(sort_win); }
void win_resize(ProfWin *window) { int cols = getmaxx(stdscr); if (window->layout->type == LAYOUT_SPLIT) { ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; if (layout->subwin) { int subwin_cols = 0; if (window->type == WIN_CONSOLE) { subwin_cols = win_roster_cols(); } else if (window->type == WIN_MUC) { subwin_cols = win_occpuants_cols(); } wbkgd(layout->base.win, theme_attrs(THEME_TEXT)); wresize(layout->base.win, PAD_SIZE, cols - subwin_cols); wbkgd(layout->subwin, theme_attrs(THEME_TEXT)); wresize(layout->subwin, PAD_SIZE, subwin_cols); if (window->type == WIN_CONSOLE) { rosterwin_roster(); } else if (window->type == WIN_MUC) { ProfMucWin *mucwin = (ProfMucWin *)window; assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); occupantswin_occupants(mucwin->roomjid); } } else { wbkgd(layout->base.win, theme_attrs(THEME_TEXT)); wresize(layout->base.win, PAD_SIZE, cols); } } else { wbkgd(window->layout->win, theme_attrs(THEME_TEXT)); wresize(window->layout->win, PAD_SIZE, cols); } win_redraw(window); }
static void ui_resize(Ui *ui) { struct winsize ws; int width, height; if (ioctl(STDERR_FILENO, TIOCGWINSZ, &ws) == -1) { getmaxyx(stdscr, height, width); } else { width = ws.ws_col; height = ws.ws_row; } resizeterm(height, width); wresize(stdscr, height, width); ui_resize_to(ui, width, height); }
void vtMove(int index, int x, int y, int width, int height) { struct virtualTerminal *vt; char message[64]; vt = virtualTerminals[index]; if(vt != NULL) { vt->x = x; vt->y = y; if(vt->wBorder) { wresize(vt->wBorder, height, width); wnoutrefresh(vt->wBorder); } height--; // because of title window vt->width = width; vt->height = height; wresize(vt->window, height, width); wnoutrefresh(vt->window); // move windows // // resize ncurses windows // send resize signal to app (will bash pass signal on to child?) // is there any way to check if bash has a child process? VTCore_set_screen_size(vt->core, width, height); /* vtScrollRegion(vt, 0, height); snprintf(message, 63, "export LINES=%d \n", height); vtSend(index, message); snprintf(message, 63, "export COLUMNS=%d \n", width); vtSend(index, message); */ //kill(to->pid, SIGWINCH); // re-number terminal in wBorder } }