void CONSOLE_Resize( ) { if( !gCurses ) return; wresize( gMainWindow, LINES - 3, COLS - 17 ); wresize( gBottomBorder, 1, COLS ); wresize( gRightBorder, LINES - 3, 1 ); wresize( gInputWindow, 2, COLS ); wresize( gChannelWindow, LINES - 3, 16 ); // mvwin( gMainWindow, 0, 0 ); mvwin( gBottomBorder, LINES - 3, 0 ); mvwin( gRightBorder, 0, COLS - 17 ); mvwin( gInputWindow, LINES - 2, 0 ); mvwin( gChannelWindow, 0, COLS - 16 ); mvwhline( gBottomBorder, 0, 0, 0, COLS ); mvwvline( gRightBorder, 0, 0, 0, LINES ); wrefresh( gBottomBorder ); wrefresh( gRightBorder ); gMainWindowChanged = true; gInputWindowChanged = true; gChannelWindowChanged = true; CONSOLE_Draw( ); }
static void resize_display_all(void) { struct winsize winsz; /* get new window size */ winsz.ws_col = winsz.ws_row = 0; ioctl(0, TIOCGWINSZ, &winsz); /* ioctl on STDIN */ if (winsz.ws_col && winsz.ws_row) resizeterm(winsz.ws_row, winsz.ws_col); COLS = winsz.ws_col; LINES = winsz.ws_row; resize_display_main(); if (show_win) wresize(show_win, LINES-1, COLS); if (conf_win) { if (conf_win_current == 'f') mvwin(conf_win, LINES/2-12, COLS/2-28); else if (conf_win_current == 'c') mvwin(conf_win, LINES/2-5, COLS/2-20); } }
void title_bar_resize(void) { int cols = getmaxx(stdscr); werase(win); int row = screen_titlebar_row(); mvwin(win, row, 0); wresize(win, 1, cols); wbkgd(win, theme_attrs(THEME_TITLE_TEXT)); _title_bar_draw(); }
void resize(YWidgetState *wid, int renderType) { CWidget *state = wid->renderStates[renderType].opac; Entity *pos = yeGet(wid->entity, "wid-pos"); state->h = yeGetInt(yeGet(pos, "h")) * LINES / 1000; state->w = yeGetInt(yeGet(pos, "w")) * COLS / 1000; state->x = yeGetInt(yeGet(pos, "x")) * COLS / 1000; state->y = yeGetInt(yeGet(pos, "y")) * LINES / 1000; wresize(state->win, state->h, state->w); mvwin(state->win, state->y, state->x); wborder(state->win, '|', '|', '-','-','+','+','+','+'); refresh(); }
void ide::Window::move(int x,int y) { _left = x; _top = y; if(_hidden==true) return; hide(); if(_owner==FULLSCREEN) { if(_bwin!=NULL) { mvwin(_bwin,y,x); int err=mvderwin(_win,1,1); //wprintw(_win,"%d",err); touchwin(_bwin); wrefresh(_win); } else { mvwin(_win,y,x); //wrefresh(_win); } } else { if(_bwin!=NULL) { mvderwin(_bwin,y,x); //wrefresh(_bwin); } else { mvderwin(_win,y,x); //wrefresh(_win); } } show(); }
static void recur_move_window(WINDOW *parent, int dy, int dx) { unsigned n; for (n = 0; n < num_windows; ++n) { if (all_windows[n].parent == parent) { int y0, x0; getbegyx(all_windows[n].child, y0, x0); mvwin(all_windows[n].child, y0 + dy, x0 + dx); recur_move_window(all_windows[n].child, dy, dx); } } }
move_panel(PANEL * pan, int starty, int startx) { T((T_CALLED("move_panel(%p,%d,%d)"), pan, starty, startx)); if (!pan) returnCode(ERR); if (IS_LINKED(pan)) { Touchpan(pan); PANEL_UPDATE(pan, (PANEL *) 0); } returnCode(mvwin(pan->win, starty, startx)); }
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"); #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"); assert(cy - top == SK_COUNT && "Sort dialog and sort options should not diverge"); mvwaddstr(sort_win, curr, 4, caps[descending]); wrefresh(sort_win); }
static int _vdk_surface_move(vdk_object_t *object,int x,int y) { vdk_context_t *context; int raster_type; int ctx_x = 0; int ctx_y = 0; if(object == NULL) return -1; if(x < 0) return -1; if(y < 0) return -1; raster_type = vdk_object_get_raster_type(object); if(raster_type == VDK_RASTER_NULL || raster_type == VDK_RASTER_SCR) return -1; context = vdk_context_get_target(VDK_CONTEXT(object)); raster_type = vdk_object_get_raster_type(VDK_OBJECT(context)); if(raster_type != VDK_RASTER_NULL && raster_type != VDK_RASTER_SCR) { ctx_x = VDK_RASTER(context)->abs_x; ctx_y = VDK_RASTER(context)->abs_y; } VDK_RASTER(object)->rel_x = x; VDK_RASTER(object)->rel_y = y; VDK_RASTER(object)->abs_x = ctx_x + x; VDK_RASTER(object)->abs_y = ctx_y + y; /* if the raster type of the object we're moving is a VDK_RASTER_WND (which is a true curses WINDOW) then we'll try to do the physical move. according to the man pages this will error if the WINDOW would be relocated off the screen. */ raster_type = vdk_object_get_raster_type(object); if(raster_type == VDK_RASTER_WND) { mvwin(*(WINDOW**)object,y,x); } return 0; }
void show_log(ui_t *ui) { chat_tab = COLS-12; log_tab = COLS-6; render_tab_bar(ACTIVE_LOG); hide_panel(ALERT); reset_borders(ui); wclear(ui->log); wresize(ui->log, LINES - 6, COLS - 1); mvwin(ui->log, 1, 1); restore_history(ui->log, log_history, &ui->next_log_line); box(ui->log, 0, 0); hide_panel(CHAT); top_panel(LOG); update_panels(); doupdate(); }
void status_bar_resize(void) { int rows, cols; getmaxyx(stdscr, rows, cols); werase(status_bar); int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET); mvwin(status_bar, rows-2, 0); wresize(status_bar, 1, cols); wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT)); wattron(status_bar, bracket_attrs); mvwprintw(status_bar, 0, cols - 34, _active); mvwprintw(status_bar, 0, cols - 34 + ((current - 1) * 3), bracket); wattroff(status_bar, bracket_attrs); if (message) { char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR); gchar *date_fmt = NULL; if (g_strcmp0(time_pref, "off") == 0) { date_fmt = g_strdup(""); } else { date_fmt = g_date_time_format(last_time, time_pref); } assert(date_fmt != NULL); size_t len = strlen(date_fmt); g_free(date_fmt); if (g_strcmp0(time_pref, "off") != 0) { /* 01234567890123456 * [HH:MM] message */ mvwprintw(status_bar, 0, 5 + len, message); } else { mvwprintw(status_bar, 0, 1, message); } prefs_free_string(time_pref); } if (last_time) { g_date_time_unref(last_time); } last_time = g_date_time_new_now_local(); _status_bar_draw(); }
void gui_vfslist_move(struct gui_vfslist *gv, int x, int y, int width, int height) { gui_lock(); if (gv->win == NULL) { gv->win = newwin(height, width, y, x); } else { wresize(gv->win, height, width); mvwin(gv->win, y, x); } clearok(gv->win, TRUE); gui_unlock(); gv->winheight = height; gui_vfslist_refresh(gv); }
void show_split(ui_t *ui) { chat_tab = (COLS/2)-7; log_tab = COLS-6; render_tab_bar(ACTIVE_CHAT); hide_panel(ALERT); reset_borders(ui); wresize(ui->screen, LINES - 6, COLS/2 - 1); box(ui->screen, 0, 0); show_panel(CHAT); wresize(ui->log, LINES - 6, COLS/2); mvwin(ui->log, 1, COLS/2); box(ui->log, 0, 0); show_panel(LOG); update_panels(); doupdate(); show_prompt(ui, NULL); }
static void tresize(void) { struct winsize ws; winchg=0; if (ioctl(0, TIOCGWINSZ, &ws)<0) panic("Ioctl (TIOCGWINSZ) failed."); resizeterm(scr.y=ws.ws_row, scr.x=ws.ws_col); if (scr.y<3 || scr.x<10) panic("Screen too small."); wresize(scr.mw, scr.y-2, scr.x); wresize(scr.iw, 1, scr.x); wresize(scr.sw, 1, scr.x); mvwin(scr.iw, scr.y-1, 0); tredraw(); tdrawbar(); }
static void prompt_onDraw(ToxWindow* self) { int x, y; mvwin(self->window,0,0); wresize(self->window, LINES-2, COLS); getyx(self->window, y, x); (void) x; wattron(self->window, COLOR_PAIR(1)); mvwprintw(self->window, y, 0, "# "); wattroff(self->window, COLOR_PAIR(1)); mvwprintw(self->window, y, 2, "%s", prompt_buf); wclrtoeol(self->window); wrefresh(self->window); }
move_panel(PANEL * pan, int starty, int startx) { int rc = ERR; T((T_CALLED("move_panel(%p,%d,%d)"), (void *)pan, starty, startx)); if (pan) { GetHook(pan); if (IS_LINKED(pan)) { Touchpan(pan); PANEL_UPDATE(pan, (PANEL *) 0); } rc = mvwin(pan->win, starty, startx); } returnCode(rc); }
/* Create a new dialog, or reposition an existing one, in an appropriate position for showing prompts. Also draw a border around it. */ WINDOW * newdialog(int height, int width, int dismissable, WINDOW *win) { int starty, startx; if (height < 3) height = 3; if (height > LINES) height = LINES; if (width > COLS) width = COLS; if (game_is_running) { /* instead of covering up messages, draw the dialog as if it were a message */ fresh_message_line(TRUE); draw_msgwin(); if (getmaxx(msgwin) < getmaxx(stdscr)) width = getmaxx(msgwin) + (ui_flags.draw_outer_frame_lines ? 2 : 0); else width = getmaxx(stdscr); startx = 0; starty = getmaxy(msgwin) - (ui_flags.draw_outer_frame_lines ? 0 : 1); } else { /* out of game, keep dialogs centred */ starty = (LINES - height) / 2; startx = (COLS - width) / 2; } redraw_popup_windows(); if (!win) win = newwin_onscreen(height, width, starty, startx); else { mvwin(win, starty, startx); wresize(win, height, width); } werase(win); keypad(win, TRUE); meta(win, TRUE); nh_window_border(win, dismissable); return win; }
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 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); }
/* * test mvwin(). */ static bool move_window(WINDOW *win, bool recur) { WINDOW *parent = parent_of(win); bool result = FALSE; if (parent != 0) { bool top = (parent == stdscr); int min_col = top ? COL_MIN : 0; int max_col = top ? COL_MAX : getmaxx(parent); int min_line = top ? LINE_MIN : 0; int max_line = top ? LINE_MAX : getmaxy(parent); PAIR *tmp; head_line("Select new position for %swindow", top ? "" : "sub"); if ((tmp = selectcell(parent, min_line, min_col, max_line, max_col)) != 0) { int y0, x0; getbegyx(parent, y0, x0); /* * Note: Moving a subwindow has the effect of moving a viewport * around the screen. The parent window retains the contents of * the subwindow in the original location, but the viewport will * show the contents (again) at the new location. So it will look * odd when testing. */ if (mvwin(win, y0 + tmp->y, x0 + tmp->x) != ERR) { if (recur) { recur_move_window(win, tmp->y, tmp->x); } refresh_all(win); doupdate(); result = TRUE; } } } return result; }
int main(void) { WINDOW *alpha,*beta; int x; initscr(); start_color(); init_pair(1,COLOR_WHITE,COLOR_BLUE); init_pair(2,COLOR_WHITE,COLOR_RED); /* create and populate the original window */ alpha = newwin(5,30,0,0); wbkgd(alpha,COLOR_PAIR(1)); for(x=0;x<75;x++) wprintw(alpha,"O "); wrefresh(alpha); getch(); /* duplicate window alpha to window beta */ beta = dupwin(alpha); if( beta == NULL) { endwin(); puts("Error creating duplicate window"); return 1; } /* move new window and change color */ mvwin(beta,10,40); wbkgd(beta,COLOR_PAIR(2)); mvwaddstr(alpha,0,0,"This is window Alpha!"); mvwaddstr(beta,0,0,"This is window Beta!"); wrefresh(alpha); wrefresh(beta); getch(); endwin(); return 0; }
static void regrid() { glong pw = get_prefix_width(); view.prefix_width = pw; glong mtw = MIN((COLS - pw), max_string_width); view.max_text_width = mtw; correct_top_x(); view.cols = conf.onecolumn ? 1 : (COLS / (mtw + pw)); view.rows = SL % view.cols == 0 ? SL / view.cols : (SL / view.cols) + 1; correct_top_y(); for (glong i = 0; i < SL; i++) { glong yn = i / view.cols; glong xn = i % view.cols; grid_line_t* grid_line = g_array_index(grid, grid_line_t*, i); grid_line->y = yn; grid_line->x = (mtw + pw) * xn; } mvwin(ws, LINES - 1, 0); }
static void popup_dropdown(GntComboBox *box) { GntWidget *widget = GNT_WIDGET(box); GntWidget *parent = box->dropdown->parent; int height = g_list_length(GNT_TREE(box->dropdown)->list); int y = widget->priv.y + widget->priv.height - 1; gnt_widget_set_size(box->dropdown, widget->priv.width, height + 2); if (y + height + 2 >= getmaxy(stdscr)) y = widget->priv.y - height - 1; gnt_widget_set_position(parent, widget->priv.x, y); if (parent->window) { mvwin(parent->window, y, widget->priv.x); wresize(parent->window, height+2, widget->priv.width); } parent->priv.width = widget->priv.width; parent->priv.height = height + 2; GNT_WIDGET_UNSET_FLAGS(parent, GNT_WIDGET_INVISIBLE); gnt_widget_draw(parent); }
int main() { WINDOW *b; int maxy,maxx,y,x; initscr(); getmaxyx(stdscr,maxy,maxx); x = (maxx-TSIZE) >> 1; b = newwin(1,TSIZE,0,x); waddstr(b,"I'm getting sick!"); for(y=1;y<maxy;y++) { mvwin(b,y,x); wrefresh(b); getch(); } endwin(); return 0; }
//------------------------------------------------------------------------------ int move_panel( PANEL* pan, int starty, int startx ) { __QCS_FCONTEXT( "move_panel" ); WINDOW* win; int maxy, maxx; if( !pan ) { return ERR; } if( _panel_is_linked( pan ) ) { _override( pan, 0 ); } win = pan->win; if( mvwin( win, starty, startx ) == ERR ) { return ERR; } getbegyx( win, pan->wstarty, pan->wstartx ); getmaxyx( win, maxy, maxx ); pan->wendy = pan->wstarty + maxy; pan->wendx = pan->wstartx + maxx; if( _panel_is_linked( pan ) ) { _calculate_obscure(); } return 0; }
void clean_status_bar(void) { (void)ui_stat_reposition(1); werase(status_bar); wresize(status_bar, 1, getmaxx(stdscr) - FIELDS_WIDTH()); mvwin(status_bar, getmaxy(stdscr) - 1, 0); wnoutrefresh(status_bar); if(curr_stats.load_stage <= 2) { multiline_status_bar = 0; curr_stats.need_update = UT_FULL; return; } if(multiline_status_bar) { multiline_status_bar = 0; update_screen(UT_FULL); } multiline_status_bar = 0; }
static void viper_kmio_show_mouse(MEVENT *mouse_event) { extern VIPER *viper; extern WINDOW *SCREEN_WINDOW; WINDOW *screen_window; static chtype color; gshort fg,bg; screen_window=SCREEN_WINDOW; if(viper->console_mouse==NULL) { viper->console_mouse=newwin(1,1,0,0); color=mvwinch(screen_window,0,0); pair_content(PAIR_NUMBER(color & A_COLOR),&fg,&bg); if(bg==COLOR_RED || bg==COLOR_YELLOW || bg==COLOR_MAGENTA) color=VIPER_COLORS(COLOR_CYAN,COLOR_CYAN); if(bg==COLOR_CYAN || bg==COLOR_BLUE) color=VIPER_COLORS(COLOR_YELLOW,COLOR_YELLOW); } if(mouse_event!=NULL) { color=mvwinch(screen_window,mouse_event->y,mouse_event->x); pair_content(PAIR_NUMBER(color & A_COLOR),&fg,&bg); if(bg==COLOR_RED || bg==COLOR_YELLOW || bg==COLOR_MAGENTA) color=VIPER_COLORS(COLOR_CYAN,COLOR_CYAN); else color=VIPER_COLORS(COLOR_YELLOW,COLOR_YELLOW); mvwin(viper->console_mouse,mouse_event->y,mouse_event->x); } mvwaddch(viper->console_mouse,0,0,' ' | color); return; }
int traceview_scrollbar_redraw (int y, int x, int height, float state) { int res = wresize(traceview_scrollbar, height, 1); assert_inner(res != ERR, "wresize"); res = mvwin(traceview_scrollbar, y, x); assert_inner(res != ERR, "mvwin"); res = werase(traceview_scrollbar); assert_inner(res != ERR, "werase"); res = mvwvline(traceview_scrollbar, 0, 0, 0, height); assert_inner(res != ERR, "mvwvline"); mvwaddch(traceview_scrollbar, 0, 0, ACS_UARROW); mvwaddch(traceview_scrollbar, height - 1, 0, ACS_DARROW); mvwaddch(traceview_scrollbar, 1 + state * (height - 3), 0, ACS_BLOCK); res = wrefresh(traceview_scrollbar); assert_inner(res != ERR, "wrefresh"); return 0; }
void prepare_window(WINDOW *w) { mvwin(w, 0, 0); wresize(w, LINES-2, COLS); }