void init_ncurses() { initscr(); curs_set(0); cbreak(); noecho(); nodelay(stdscr, TRUE); // getch can't block clock keypad(stdscr, TRUE); scrollok(stdscr, TRUE); resizeterm(MAX_BOARD_Y + 10, 2 * MAX_BOARD_X + 10); }
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 init_ncurses() { srand(time(NULL)); initscr(); curs_set(0); cbreak(); noecho(); nodelay(stdscr, TRUE); // getch can't block clock keypad(stdscr, TRUE); scrollok(stdscr, TRUE); }
/* Set up all the curses parameters. This is called from main() -- before gli_initialize_windows, actually -- and also when curses is reinitialized for a screen-size change. */ void gli_setup_curses() { initscr(); cbreak(); noecho(); nonl(); intrflush(stdscr, FALSE); keypad(stdscr, TRUE); scrollok(stdscr, FALSE); }
static void genlines(int base) { int i, j; #if USE_TRACE if (base == 'a') Trace(("Resetting screen")); else Trace(("Painting `%c' screen", base)); #endif /* Do this so writes to lower-right corner don't cause a spurious * scrolling operation. This _shouldn't_ break the scrolling * optimization, since that's computed in the refresh() call. */ scrollok(stdscr, FALSE); move(0,0); for (i = 0; i < head_lines; i++) for (j = 0; j < COLS; j++) addch((j % 8 == 0) ? ('A' + j/8) : '-'); move(head_lines, 0); for (i = head_lines; i < LINES - foot_lines; i++) { int c = (base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + LO_CHAR; int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1; for (j = 0; j < hi; j++) addch(c); } for (i = LINES - foot_lines; i < LINES; i++) { move(i, 0); for (j = 0; j < (extend_corner ? COLS : COLS - 1); j++) addch((j % 8 == 0) ? ('A' + j/8) : '-'); } scrollok(stdscr, TRUE); if (single_step) { move(LINES-1, 0); getch(); } else refresh(); }
int init0() { initscr(); clear(); noecho(); cbreak(); curs_set(0); scrollok(stdscr, TRUE); keypad(stdscr, TRUE); return 0; }
void Scrollok ( WINDOW *win, bool bf ) { int retval; retval = scrollok ( win, bf ); if ( retval == ERR ) Fatal_failure ( "scrollok\n" ); }
static void chat_onInit(ToxWindow *self) { int x, y; ChatContext *ctx = (ChatContext*) self->x; getmaxyx(self->window, y, x); ctx->history = subwin(self->window, y - 4, x, 0, 0); scrollok(ctx->history, 1); ctx->linewin = subwin(self->window, 2, x, y - 3, 0); print_help(ctx); }
int main() { WINDOW *sub_window_ptr; int x_loop; int y_loop; int counter; char a_letter = '1'; initscr(); for (y_loop = 0; y_loop < LINES - 1; y_loop ++){ for (x_loop = 0; x_loop < COLS - 1; x_loop ++){ mvwaddch(stdscr, y_loop, x_loop, a_letter); a_letter ++; if (a_letter > '9') a_letter = '0'; } } sub_window_ptr = subwin(stdscr, 10, 20, 10, 10); scrollok(sub_window_ptr, 1); touchwin(stdscr); refresh(); sleep(1); werase(sub_window_ptr); mvwprintw(sub_window_ptr, 2, 0, "%s", "This window will now scroll"); wrefresh(sub_window_ptr); sleep(1); for (counter = 1; counter < 10; counter ++){ wprintw(sub_window_ptr, "%s", "This text is both wrapping and \ scrolling."); wrefresh(sub_window_ptr); sleep(1); } delwin(sub_window_ptr); touchwin(stdscr); refresh(); sleep(1); endwin(); exit(EXIT_SUCCESS); }
void setup_menu(void) { scrollok(menu_win, FALSE); curs_set(0); werase(menu_win); werase(status_bar); werase(ruler_win); wrefresh(status_bar); wrefresh(ruler_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); }
void os_reset_screen (void) { os_stop_sample(0); os_set_text_style(0); print_string("[Hit any key to exit.]\n"); os_read_key(0, FALSE); scrollok(stdscr, TRUE); scroll(stdscr); refresh(); endwin(); }/* os_reset_screen */
static void groupchat_onInit(ToxWindow *self, Tox *m) { int x, y; ChatContext *ctx = (ChatContext *) self->chatwin; getmaxyx(self->window, y, x); ctx->history = subwin(self->window, y-3, x, 0, 0); scrollok(ctx->history, 1); ctx->linewin = subwin(self->window, 2, x, y-4, 0); print_groupchat_help(ctx); wmove(self->window, y - CURS_Y_OFFSET, 0); }
void setupscreen() { int rows, cols; initscr(); cbreak(); noecho(); intrflush(stdscr, FALSE); cols = COLS - 2; rows = (LINES - 3) / 2; me = newwin(rows + 1 , cols, 0, 0); them = newwin(rows + 1 , cols, rows + 2, 0); idlok(me, TRUE); scrollok(me, TRUE); keypad(me, TRUE); idlok(them, TRUE); scrollok(them, TRUE); move(rows + 1, 0); hline(0, cols+2); refresh(); }
void Ui::create_window_scroll(int px, int py, int sizex, int sizey, std::string id){ if(m_windows.count(id) != 0){ wrefresh(m_windows[id]); delwin(m_windows[id]); } WINDOW * win; win = newwin(sizey, sizex, py, px); wrefresh(win); scrollok(win, true); m_windows[id] = win; }
value caml_curses_scrollok(value mlwindow, value scrollable) { CAMLparam2(mlwindow, scrollable); WINDOW *window = window_of_ml(mlwindow); /* Update window settings */ scrollok(window, Bool_val(scrollable)); CAMLreturn(Val_unit); }
static void draw_log_window(void) { idlok(win_txt, FALSE); /* Get scrolling */ scrollok(win_txt, TRUE); /* Leave cursor where it was */ leaveok(win_txt, TRUE); wbkgd(win_txt, COLOR_PAIR(BLACK_ON_CYAN)); wrefresh(win_txt); }
static void printe(const char *msg){ scrollok(winmsg, FALSE); cbreak(); refi(); wprintw(winses, "%s: %m\n", msg); wprintw(winses, "Exiting..."); refo(); geti(); endwin(); exit(EXIT_FAILURE); }
static void setup_ncurses() { SCREEN* main_screen = newterm(term_type, stdout, term_in); set_term(main_screen); scrollok(stdscr, TRUE); // If enabled the window is scrolled up one line when reaching bottom idlok(stdscr, TRUE); // Use the hardware insert/delete line feature of terminals so equipped ncurses_active = TRUE; //printf("\t\t\t\t\tncurses set up.\n"); if (signal(SIGWINCH, catch_sigwinch) == SIG_ERR) { fputs("\t\t\t\t\tAn error occurred when setting up SIGWINCH signal handler.\n", stderr); } } // Done setting up ncurses
void start_graph(void) { initscr(); raw(); color_init(); curs_set(0); cbreak(); noecho(); nodelay(stdscr, TRUE); scrollok(stdscr, TRUE); draw_border(); }
void NYView::guiScroll(int dx, int dy) { Q_UNUSED(dx); //TODO if(dy >= getLinesVisible()) { guiPaintEvent(YSelection(YInterval(YCursor(0, 0), YCursor(getColumnsVisible() - 1, getLinesVisible() - 1)))); } else { scrollok(editor, true); wscrl(editor, dy); scrollok(editor, false); int top = 0; int n = qAbs(dy); if(dy > 0) { /* redraw the new bottom */ top += getLinesVisible() - n; } guiPaintEvent(YSelection(YInterval(YCursor(0, top), YCursor(getColumnsVisible() - 1, top + n - 1)))); } }
void curses_init(){ initscr(); /* Start curses mode */ raw(); /* Line buffering disabled */ keypad(stdscr, FALSE); /* Don't get F1, F2 etc.. */ noecho(); /* Don't echo() while we do getch */ scrollok(stdscr, TRUE); /* scroll enable */ log_window = newwin(LINES-1, COLS, 0, 1); box(log_window, 0,0); wrefresh(log_window); }
static void scrollTest(WINDOW *win) { int i; int half; int OldY; NCURSES_CONST char *Message = "The window will now scroll slowly"; wclear(win); OldY = getmaxy(win); half = OldY / 2; MvWAddStr(win, OldY - 2, 1, Message); wrefresh(win); scrollok(win, TRUE); for (i = 1; i <= OldY; i++) { napms(600); scroll(win); wrefresh(win); } werase(win); for (i = 1; i < OldY; i++) { MvWPrintw(win, i, 1, "Line %d", i); } MvWPrintw(win, OldY - 2, 1, "The top of the window will scroll"); wmove(win, 1, 1); wsetscrreg(win, 0, half - 1); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); for (i = 1; i <= half; i++) { napms(600); scroll(win); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); } werase(win); for (i = 1; i < OldY; i++) { MvWPrintw(win, i, 1, "Line %d", i); } MvWPrintw(win, 1, 1, "The bottom of the window will scroll"); wmove(win, OldY - 2, 1); wsetscrreg(win, half, --OldY); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); for (i = half; i <= OldY; i++) { napms(600); wscrl(win, -1); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); } wsetscrreg(win, 0, OldY); }
void scrollTest(WINDOW *win) { int i, OldY; #ifndef PDCURSES int OldX; #endif werase(win); mvwaddstr(win, height - 2, 1, "The window will now scroll slowly"); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); scrollok(win, TRUE); napms(500); for (i = 1; i <= height; i++) { napms(150); scroll(win); wrefresh(win); }; #ifdef PDCURSES OldY = getmaxy(win); #else getmaxyx(win, OldY, OldX); #endif mvwaddstr(win, 6, 1, "The top of the window will scroll"); wmove(win, 1, 1); wsetscrreg(win, 0, 4); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); for (i = 1; i <= 5; i++) { napms(500); scroll(win); wrefresh(win); } mvwaddstr(win, 3, 1, "The bottom of the window will scroll"); wmove(win, 8, 1); wsetscrreg(win, 5, --OldY); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); for (i = 5; i <= OldY; i++) { napms(300); wscrl(win, -1); wrefresh(win); } wsetscrreg(win, 0, OldY); }
CListWidget::CListWidget(const string &name, int id, Color fgcolor, Color bgcolor, bool bold) : CWidget(name, id) { scrollok(_window, true); _scroll = 0; _count = 0; _autoScroll = true; setForegroundColor(fgcolor); setBackgroundColor(bgcolor); setBold(bold); }
nc_window_streambuf::nc_window_streambuf(WINDOW* _p, std::ostream& _os, unsigned long _cursesAttr): m_pnl(_p), m_flags(_cursesAttr), m_os(&_os), m_old(_os.rdbuf()) { setp(0, 0); setg(0, 0, 0); _os.rdbuf(this); scrollok(_p, true); mvwinch(_p, 0, 0); }
/********************************************************\ * Description: scrolls window one line up or down * * Returns: none * \********************************************************/ void winscroll(WINS *windows, WINDOW *win, int n, int currentLine) { int row, col; /* row and col */ getyx(win, row, col); /* get cur row/col */ scrollok(windows->hex, TRUE); /* allow scrolling */ scrollok(windows->ascii, TRUE); scrollok(windows->address, TRUE); wscrl(windows->hex, n); /* scroll each win */ wscrl(windows->ascii, n); wscrl(windows->address, n); scrollok(windows->hex, FALSE); /*disable scrolling */ scrollok(windows->ascii, FALSE); scrollok(windows->address, FALSE); wmove(windows->hex, (n == 1) ? MAXY:0, 0); /* place cursor */ wmove(windows->ascii, (n == 1) ? MAXY:0, 0); wmove(windows->address, (n == 1) ? MAXY:0, 0); outline(fpIN, currentLine); /* output line */ wnoutrefresh(windows->hex); /* set win refreshes */ wnoutrefresh(windows->ascii); wnoutrefresh(windows->address); wmove(win, row, col); /* restore cursor */ }
/* Call this before any call to linux conio - except the port functions ! */ void init_lconio (void) /* This is needed, because ncurses needs to be initialized */ { int x,y; initialized=1; initscr(); /* initialize curses screen -- modified by GLF to detect X Windows */ #ifdef XCURSES Xinitscr(1, fakelist); /* fake out argument list */ #else initscr(); #endif start_color(); oldattr=wattr_get(stdscr,&store_oldattr.attrs,&store_oldattr.color_pair,&store_oldattr.opts); nonl(); /* disable translation of CR to newline on input */ raw(); /* characters immediately available -- break not processed; like cbreak() but also passes INTR, QUIT, SUSP, and STOP chars */ noecho(); /* no echo of key input */ /* Removed from original linux-conio: if (!has_colors() & (color_warning>-1)) fprintf(stderr,"Attention: A color terminal may be required to run this application !\n"); */ /* GLF settings added to the original linux-conio initializations */ curs_set(0); /* turn off cursor */ /* cbreak(); */ /* characters immediately available -- break not processed */ clear(); /* clear screen */ timeout(0); /* non-blocking read -- if no input, return ERR */ conio_scr=newwin(0,0,0,0); keypad(conio_scr,TRUE); meta(conio_scr,TRUE); idlok(conio_scr,TRUE); scrollok(conio_scr,TRUE); /* Color initialization */ for (y=0;y<=7;y++) for (x=0;x<=7;x++) init_pair((8*y)+x+1, colortab(x), colortab(y)); txtattr=wattr_get(conio_scr,&store_txtattr.attrs,&store_txtattr.color_pair,&store_txtattr.opts); bgc=0; textcolor(7); textbackground(0); }
static void scroll_window(winid wid) { int wh, ww, s_top, s_bottom; boolean border = curses_window_has_border(wid); WINDOW *win = curses_get_nhwin(wid); curses_get_window_size(wid, &wh, &ww); if (wh == 1) { curses_clear_nhwin(wid); return; } if (border) { s_top = 1; s_bottom = wh; } else { s_top = 0; s_bottom = wh - 1; } scrollok(win, TRUE); wsetscrreg(win, s_top, s_bottom); scroll(win); scrollok(win, FALSE); if (wid == MESSAGE_WIN) { if (border) mx = 1; else mx = 0; } if (border) { box(win, 0, 0); } wrefresh(win); }
nc_window_streambuf::nc_window_streambuf(WINDOW * p, unsigned long _cursesAttr): m_pnl(p), m_flags(_cursesAttr), m_os(0), m_old(0) { // Tell parent class that we want to call overflow() for each // input char: setp(0, 0); setg(0, 0, 0); scrollok(p, true); mvwinch(p, 0, 0); }