void console_putch(u08 ch) { // new line if(ch == '\n') { pos -= x; x = 0; if(y == ( CONSOLE_HEIGHT-1 )) { scroll_up(); } else { y++; pos += CONSOLE_WIDTH; } } // visible char else if(ch >= ' ') { buffer[pos] = ch; display_draw_char(x,y,ch); x++; pos++; if(x == CONSOLE_WIDTH) { x = 0; pos -= CONSOLE_WIDTH; if(y == ( CONSOLE_HEIGHT-1 )) { scroll_up(); } else { y++; pos += CONSOLE_WIDTH; } } } }
int view_text(const char *title, const char *text) { struct view_info info; const struct button_mapping *view_contexts[] = { pla_main_ctx, }; int button; init_view(&info, title, text); draw_text(&info); /* wait for keypress */ while(1) { button = pluginlib_getaction(TIMEOUT_BLOCK, view_contexts, ARRAYLEN(view_contexts)); switch (button) { case PLA_UP: case PLA_UP_REPEAT: #ifdef HAVE_SCROLLWHEEL case PLA_SCROLL_BACK: case PLA_SCROLL_BACK_REPEAT: #endif scroll_up(&info, 1); break; case PLA_DOWN: case PLA_DOWN_REPEAT: #ifdef HAVE_SCROLLWHEEL case PLA_SCROLL_FWD: case PLA_SCROLL_FWD_REPEAT: #endif scroll_down(&info, 1); break; case PLA_LEFT: scroll_up(&info, info.display_lines); break; case PLA_RIGHT: scroll_down(&info, info.display_lines); break; case PLA_LEFT_REPEAT: scroll_to_top(&info); break; case PLA_RIGHT_REPEAT: scroll_to_bottom(&info); break; case PLA_EXIT: case PLA_CANCEL: return PLUGIN_OK; default: if (rb->default_event_handler(button) == SYS_USB_CONNECTED) return PLUGIN_USB_CONNECTED; break; } } return PLUGIN_OK; }
static void vidc_rawputchar(int c) { int i; if (c == '\t') /* lame tab expansion */ for (i = 0; i < 8; i++) vidc_rawputchar(' '); else { #ifndef TERM_EMU vidc_biosputchar(c); #else /* Emulate AH=0eh (teletype output) */ switch(c) { case '\a': vidc_biosputchar(c); return; case '\r': curx = 0; curs_move(&curx, &cury, curx, cury); return; case '\n': cury++; if (cury > 24) { scroll_up(1, fg_c, bg_c); cury--; } else { curs_move(&curx, &cury, curx, cury); } return; case '\b': if (curx > 0) { curx--; curs_move(&curx, &cury, curx, cury); /* write_char(' ', fg_c, bg_c); XXX destructive(!) */ return; } return; default: write_char(c, fg_c, bg_c); curx++; if (curx > 79) { curx = 0; cury++; } if (cury > 24) { curx = 0; scroll_up(1, fg_c, bg_c); cury--; } } curs_move(&curx, &cury, curx, cury); #endif } }
static inline void cputchar (textarea_t *area, char c) { char cbuf [2]; cbuf[0] = c; cbuf[1] = '\0'; if (c == '\n') { area->cursor_x = 0; if (area->cursor_y++ == (area->cpi_height - 1)) { area->cursor_y--; scroll_up (area); } } else if (c == '\b') { if (area->cursor_x > 0) area->cursor_x--; } else { if (area->cursor_x == area->cpi_width) { area->cursor_x = 0; if (area->cursor_y++ == (area->cpi_height - 1)) { area->cursor_y--; scroll_up (area); } } cpi_puts (area->selected_font, area->display->width, area->display->height, area->pos_x + area->cursor_x * 8, area->pos_y + area->selected_font->rows * (area->cursor_y), area->display->screen->pixels, 4, !(area->bgcolor & 0xff000000), area->color, area->bgcolor, cbuf); __make_dirty (area->display, area->pos_x + area->cursor_x * 8, area->pos_y + area->selected_font->rows * (area->cursor_y)); __make_dirty (area->display, area->pos_x + area->cursor_x * 8 + 7, area->pos_y + area->selected_font->rows * (area->cursor_y + 1) - 1); area->cursor_x++; } }
static void console_putc(char c) { if (check_escape(c)) return; switch (c) { case '\n': new_line(); return; case '\r': pos_x = 0; return; case '\b': if (pos_x == 0) return; pos_x--; return; } vram[pos_y * cols + pos_x] = c | (attrib << 8); pos_x++; if (pos_x >= cols) { pos_x = 0; pos_y++; if (pos_y >= rows) { pos_y = rows - 1; scroll_up(); } } }
/*** Remove the char under the cursor ***/ void del(Project p, BYTE word) { if(p->nbc < p->edited->size) { ULONG nbc = word ? forward_word(p->edited,p->nbc)-1 : p->nbc; rem_chars(&p->undo, p->edited, p->nbc, nbc); REDRAW_CURLINE(p); inv_curs(p, TRUE); } else if(p->edited->next) { /* Join current and next line: */ if( join_lines(&p->undo, p->edited, p->edited->next) ) { REDRAW_CURLINE(p); /* Is it needed to scroll display? */ if(p->ycurs < gui.botcurs) scroll_up(p,p->edited->next,p->ycurs,p->left_pos); /* Redraw the cursor: */ inv_curs(p,TRUE); p->max_lines--; prop_adj(p); } else ThrowError(Wnd, ErrMsg(ERR_NOMEM)); } }
void screen_delete_char(struct te_buffer *buf) { if (buf == NULL) return; move_left(buf); bstring previous_line = current_line_as_bstring(buf->contents, max(buf->point - 1, 0)); char c = curr_char(buf); delete_char(buf); bstring s = current_line_as_bstring(buf->contents, max(buf->point, 0)); if (c == '\n') { statusprintf("s : %s", bstr2cstr(s, '\0')); clear_nfirst_lines(buffer_win, max(buf->y, 0)); scroll_up(buffer_win); paint_buffer_nlines(buf, buf->y + 1); screen_prev_line(buf); buf->x = max(screen_line_length(previous_line, 0) - 1, 0); /* max because scr_l_len("a") == 1 and coords begin at 0 */ move(buf->y, buf->x); } else { draw_line(s, buf->y); screen_move_left(buf); move_right(buf); /* yes it's ugly but I don't feel like recoding screen_move_right atm */ } bdestroy(previous_line); bdestroy(s); }
void move_curitem(int direction) { list_item tmp; if(curitem < 0 || curitem > last_item()) return; tmp = item_create(); item_copy(tmp, db_item_get(curitem)); switch(direction) { case MOVE_ITEM_UP: if( curitem < 1 ) goto out_move; item_copy(db_item_get(curitem), db_item_get(curitem - 1)); item_copy(db_item_get(curitem-1), tmp); scroll_up(); break; case MOVE_ITEM_DOWN: if(curitem >= last_item()) goto out_move; item_copy(db_item_get(curitem), db_item_get(curitem + 1)); item_copy(db_item_get(curitem + 1), tmp); scroll_down(); break; } out_move: item_free(&tmp); }
void console_putc(unsigned c) { unsigned short *pixels; if(c > 127) return; if(c < 32) { if(c == '\n') goto newline; return; } pixels = mddi_framebuffer(); drawglyph(pixels + cy * 12 * fb_width + cx * 6, FGCOLOR, fb_width, font5x12 + (c - 32) * 2); cx++; if(cx < cmaxx) return; newline: cy++; cx = 0; if(cy >= cmaxy) { cy = cmaxy - 1; scroll_up(); } }
void Editor::update_keyboard() { if (!enabled){ return; } auto controller = InputManager::current()->get_controller(); if (controller->pressed(Controller::ESCAPE)) { esc_press(); return; } if (controller->hold(Controller::LEFT)) { scroll_left(); } if (controller->hold(Controller::RIGHT)) { scroll_right(); } if (controller->hold(Controller::UP)) { scroll_up(); } if (controller->hold(Controller::DOWN)) { scroll_down(); } }
WORD mon_disassembly_scroll(struct mon_disassembly_private *pmdp, MON_SCROLL_TYPE ScrollType) { switch (ScrollType) { case MON_SCROLL_NOTHING: break; case MON_SCROLL_DOWN: pmdp->StartAddress = scroll_down(pmdp, pmdp->StartAddress); break; case MON_SCROLL_UP: pmdp->StartAddress = scroll_up(pmdp, pmdp->StartAddress); break; case MON_SCROLL_PAGE_DOWN: pmdp->StartAddress = scroll_down_page(pmdp, pmdp->StartAddress); break; case MON_SCROLL_PAGE_UP: pmdp->StartAddress = scroll_up_page(pmdp, pmdp->StartAddress); break; } return pmdp->StartAddress; }
/*** Join two lines and strip spaces on the next ***/ void join_strip( Project p ) { LINE *ln; if((ln = p->edited->next) != NULL) { STRPTR data; ULONG i; inv_curs(p, FALSE); p->nbc = p->edited->size; for(i=0, data=ln->stream; TypeChar[*data] == SPACE && i<ln->size; i++, data++); reg_group_by(&p->undo); if(i != ln->size) { /* Do not add a blank if there is already one */ if( p->nbc > 0 && TypeChar[ p->edited->stream[ p->nbc-1 ] ] != SPACE ) add_char(&p->undo, p->edited, p->nbc, ' '); if( insert_str(&p->undo, p->edited, p->edited->size, data, ln->size-i) == 0 ) ThrowError(Wnd, ErrMsg(ERR_NOMEM)); } /* ln can't be the first */ del_line(&p->undo, NULL, ln); p->max_lines--; reg_group_by(&p->undo); prop_adj(p); /* Refresh screen */ p->nbrc = p->nbrwc = x2pos(p->edited, p->nbc); REDRAW_CURLINE( p ); draw_info( p ); scroll_up(p, p->edited->next, p->ycurs, center_horiz(p)); inv_curs(p,TRUE); } }
void kputchar(char c) { char *videoram = (char *)__VIDEORAM; if (c == '\n') { __kposX = 0; __kposY++; } else if (c == '\r') __kposX = 0; else if (c == '\t') __kposX += 4; else { *(videoram + __kposY * COLS + __kposX * 2) = c; *(videoram + __kposY * COLS + __kposX * 2 + 1) = __kattr; __kposX++; } if (__kposX > 79) { __kposX = __kposX - 80; __kposY++; } if (__kposY > 24) { __kposY = 24; scroll_up(1); } }
void up_single_click_handler(ClickRecognizerRef recognizer, void *context) { if(selected_event) { scroll_up(); } else { auto_select_event(); } }
/*** Move cursor to absolute position ***/ void move_to_line(Project p, ULONG nbline, char dirtiness) { ULONG newtop; if(!p->ccp.select) inv_curs(p,FALSE); /* Get the new top line */ { register ULONG old_nbl = p->nbl; p->nbl = nbline; newtop = center_vert(p); p->nbl = old_nbl; } set_cursor_line(p, nbline, newtop); if(dirtiness == LINE_AS_IS) scroll_xy(p, center_horiz(p), newtop, TRUE); else { /* Some lines are modified: redraw in one pass */ if( newtop == p->top_line ) { REDRAW_CURLINE(p); if( dirtiness == LINES_DIRTY ) scroll_up(p, p->edited->next, p->ycurs, center_horiz(p)), prop_adj(p); else if( p->left_pos != (newtop = center_horiz(p)) ) scroll_xy(p, newtop, p->top_line, FALSE); } else if( dirtiness == LINE_DIRTY ) scroll_xy(p, center_horiz(p), newtop, TRUE); else set_top_line(p, newtop, center_horiz(p)); } /* Move cursor or selection */ if(p->ccp.select) move_selection(p, p->nbrwc, p->nbl); inv_curs(p,TRUE); draw_info( p ); }
void menu_main(){ switch(current_function)//get current function and make decision based on it { case 0: //function 0 log if(!isShowingLog) show_log(); //if the log isnt showing show it if(nNxtButtonPressed == 2){ //if we are pressing left while(nNxtButtonPressed == 2); //must click and release to scroll another line scroll_down(); } if(nNxtButtonPressed == 1){ //if we are pressing right while(nNxtButtonPressed==1); //must click and release to scroll another line scroll_up(); } break; case 1: //function 1 menu display_menu(); break; } if(nNxtButtonPressed==3 && current_function!=1){ //if we press enter and are not on menu while(nNxtButtonPressed==3); //dont allow double reads. you have to release before anything happens hide_log(); //hide the menu. cant hurt previous_function=current_function; //save the old function number current_function=1; //set the current function to menu } }
// ===================================================================================================================== static void screen_putc(char c) { switch (c) { case '\r' : s_x = 0; break; case '\n' : s_x = 0; s_y++; break; default : { char* p = (char*)s_base + (s_y * WIDTH + s_x) * 2; *p = c; s_x++; break; } } if (s_x == WIDTH) { s_x = 0; s_y++; } if (s_y == HEIGHT) scroll_up(); update_cursor(); }
static void move_downwards(console_private_t *pcp) { if (++pcp->yPos >= pcp->pConsole->console_yres - 1) { /* we must scroll the window */ scroll_up(pcp); } }
void scrollbar::process_event() { if (uparrow_.pressed()) scroll_up(); if (downarrow_.pressed()) scroll_down(); }
void new_line(void) { cursor_x = 0; if ( ++cursor_y >= VGA_TERMINAL_HEIGHT ) { scroll_up(); cursor_y= 24; } }
static void cmd_ctrl_y(key_info_t key_info, keys_info_t *keys_info) { if(fpos_has_hidden_top(view)) { int new_pos = get_corrected_list_pos_up(view, view->column_count); scroll_up(view, view->column_count); goto_pos_force_update(new_pos); } }
static void new_line(void) { pos_x = 0; pos_y++; if (pos_y >= rows) { pos_y = rows - 1; scroll_up(); } }
void kbd_handler() { char scancode = 0; if(inb(0x64) & 1) scancode = inb(0x60); // kprintf("%X ", scancode); // return; if(scancode & 0x80) { // when key release // if(scancode == 0x2A || scancode == 0x36) { shift_pressed = false; return; } } else { scancode = scancode & 0x7F; // 0x0E -> backspace // 0x49 -> page up // 0x48 -> a up // 0x4B -> a left // 0x4D -> a right // 0x50 -> a down // 0x51 -> page down // 0x47 -> home // 0x4F -> end serial_debug("%X ", scancode); if(scancode == 0x48) { scroll_up(); return; } if(scancode == 0x50) { scroll_down(); return; } if (scancode == 0x1) { kprintf("Shut down\n"); char *c = "Shutdown"; while (*c) { outb(0x8900, *c++); } } // kprintf("%c", scancode); // when key pressed // if(scancode == 0x2A || scancode == 0x36) { shift_pressed = true; return; } if(shift_pressed) { kprintf("%c", kbd_map_shift[scancode]); } else { kprintf("%c", kbd_map[scancode]); } } return; }
static void cursor_up(struct hexedit *buf) { if (buf->cursor_y == 0) { if (scroll_up(buf)) { hexedit_refresh(buf); } } else { buf->cursor_y--; } calc_cursor_offset(buf); }
void table_scroll_handler(GtkTable *table, GdkEvent *ev, StackWidget *sw) { (void) table; GdkEventScroll *e = (GdkEventScroll *) ev; if(e->direction == GDK_SCROLL_UP) scroll_up(sw); if(e->direction == GDK_SCROLL_DOWN) scroll_down(sw); }
void ncurses_backlog_scroll(window_t *w, int offset) { ncurses_window_t *n; backlog_line_t *bl; if (!w || !(n = w->priv_data) || !n->backlog->len) return; n->cleared = 0; calc_window_dimension(w); if (n->index == EKG_NCURSES_BACKLOG_END) { if (offset > 0) return; /* move to first line on screen */ scroll_up(w, n->height); } if (offset < 0) { scroll_up(w, -offset); } else { int h = ncurses_get_backlog_height(w, bl, n->index); if (n->first_row + offset < h) { n->first_row += offset; return; } offset -= (h - n->first_row); while (offset >= 0 && ++n->index < n->backlog->len) { h = ncurses_get_backlog_height(w, bl, n->index); offset -= h; } if (!(n->index < n->backlog->len)) { ncurses_backlog_seek_end(n); return; } n->first_row = h + offset; } }
void special_key(unsigned int key) { if(key == KEY_PAGE_DOWN && shift) { scroll_down(current_pty, 10); } else if(key == KEY_PAGE_UP && shift) { scroll_up(current_pty, 10); } else if(key == KEY_ARROW_UP) { sendescstr("[A"); } else if(key == KEY_ARROW_DOWN) { sendescstr("[B"); } else if(key == KEY_ARROW_LEFT) { sendescstr("[D"); } else if(key == KEY_ARROW_RIGHT) { sendescstr("[C"); } else if(key >= KEY_F1 && key <= KEY_F9 && ctrl) { int console = key - KEY_F1; switch_console(console); } else if(key >= KEY_F1 && key < KEY_F10) { char str[5]; str[0] = '['; str[1] = '1' + (key - KEY_F1); str[2] = 'F'; str[3] = 0; sendescstr(str); } else if(key == KEY_DEL) { if(shift) sendescstr("[^4~"); else sendescstr("[4~"); } else if(key == KEY_INSERT) { if(shift) sendescstr("[^1~"); else sendescstr("[1~"); } else if(key == KEY_HOME) { if(shift) sendescstr("[^2~"); else sendescstr("[2~"); } else if(key == KEY_END) { if(shift) sendescstr("[^5~"); else sendescstr("[5~"); } else if(key == KEY_PAGE_DOWN) { sendescstr("[6~"); } else if(key == KEY_PAGE_UP) { sendescstr("[3~"); } else if(key == KEY_BACKTAB) { sendescstr("[Z"); } }
void auto_select_event() { static time_t now; time(&now); get_upcoming_events(&selected_event,1,&now); if(!selected_event) { selected_event=get_last(); } APP_LOG(APP_LOG_LEVEL_INFO, "auto selected event %s. location=%d %s" ,selected_event?selected_event->description:"NULL", selected_location_id,get_location(selected_location_id)); scroll_up(); scroll_down(); APP_LOG(APP_LOG_LEVEL_INFO, "scrolled up to event %s",selected_event?selected_event->description:"NULL"); //selected_event = get_nearest_event_at(selected_location_id,&now); //APP_LOG(APP_LOG_LEVEL_INFO, "auto selected event %s",selected_event?selected_event->description:"NULL"); //show_event(); }
static void nl() { if (console->scroll_full_screen || console->y < console->scroll_bottom) { DWORD bytes_written; WriteConsoleA(console->out, "\n", 1, &bytes_written, NULL); if (console->y == console->height - 1) { /* The entire screen is scrolled */ console->top = min(console->top + 1, console->buffer_height - console->height); } else console->y++; } else scroll_up(1); console->at_right_margin = 0; }
static void cursor_fix(void) { if (cursorx < 0) { cursorx = VT_RIGHT; cursory--; } if (cursory < 0) cursory = 0; if (cursorx > VT_RIGHT) { cursorx = 0; cursory++; } if (cursory > VT_BOTTOM) { scroll_up(); clear_lines(VT_BOTTOM, 1); cursory--; } }