void ScrollControl::set_sel(int xsel, int ysel) { STACKTRACE; xselect = xsel; yselect = ysel; check_sel(); check_pos(); }
// сдвинуть выделение void move_sel(DWORD new_x, DWORD new_y) { sel_moved = 1; stop_edit(); prev_x = sel_x; prev_y = sel_y; sel_x = new_x; if (sel_x < 1) sel_x = 1; if (sel_x > col_count - 1) sel_x = col_count - 1; sel_end_x = sel_x; sel_y = new_y; if (sel_y < 1) sel_y = 1; if (sel_y > row_count - 1) sel_y = row_count - 1; sel_end_y = sel_y; check_sel(); draw_window(); }
int aff_menu(t_struct *st) { int continu; SDL_Event event; aff_menu2(st); SDL_Flip(st->ecran); continu = 1; while (continu == 1) { SDL_WaitEvent(&event); if (check_win(event) == -1) exit(0); if (event.type == SDL_KEYDOWN) { st->menu = check_touch(st, event); if (event.key.keysym.sym == SDLK_RETURN) continu = 0; aff_menu2(st); SDL_Flip(st->ecran); } } return (check_sel(st->menu, st)); }
void main_loop() { char *cs; int index; int n_match; int scroll = 0; #ifdef USE_XSELECTION cs = check_sel(); #endif if(cs) edit_set_text(cs); n_match = myd_bsearch(myd, edit.text, &index); display(myd, index, n_match, scroll); print_prompt(edit.text, edit.cursor); while(1) { int c; c = term_getch(); if(isprint(c)) { edit_ins_char(c); n_match = myd_bsearch(myd, edit.text, &index); scroll = 0; } else { switch(c) { /* * move cursor */ case 1: /* ^A */ edit_cur_head(); move_cursor(edit.cursor); continue; case 2: /* ^B */ case KEY_LEFT: edit_cur_back(); move_cursor(edit.cursor); continue; case 5: /* ^E */ edit_cur_tail(); move_cursor(edit.cursor); continue; case 6: /* ^F */ case KEY_RIGHT: edit_cur_forward(); move_cursor(edit.cursor); continue; /* * scroll */ case 16: /* ^P */ case KEY_PPAGE: case KEY_UP: if(scroll == 0) continue; scroll -= SCROLL_STEP; if(scroll < 0) scroll = 0; break; case 14: /* ^N */ case KEY_NPAGE: case KEY_DOWN: if(scroll == n_match - 1) continue; scroll += SCROLL_STEP; if(scroll >= n_match) scroll = n_match - 1; break; /* * delete text */ case 8: /* ^H */ edit_back_space(); n_match = myd_bsearch(myd, edit.text, &index); scroll = 0; break; case 4: /* ^D */ case 0x7f: edit_del_char(); n_match = myd_bsearch(myd, edit.text, &index); scroll = 0; break; case 21: /* ^U */ case 10: /* ^J */ case 13: /* ^M */ edit_clear(); n_match = myd_bsearch(myd, edit.text, &index); scroll = 0; break; case 11: /* ^K */ edit_kill(); n_match = myd_bsearch(myd, edit.text, &index); scroll = 0; break; case 20: /* ^T */ edit_transpose(); n_match = myd_bsearch(myd, edit.text, &index); scroll = 0; break; case 12: /* ^L */ break; /* Exit */ case 24: /* ^X */ return; case ERR: /* timeout */ #ifdef USE_XSELECTION cs = check_sel(); #endif if(cs) { edit_set_text(cs); n_match = myd_bsearch(myd, edit.text, &index); scroll = 0; break; } else continue; default: break; } } display(myd, index, n_match, scroll); print_prompt(edit.text, edit.cursor); } }