void real_page_up(t_data *data) { if (data->list_auto) delete_list_auto(data->list_auto); data->list_auto = NULL; page_up(data); }
//int MYCall_Back(void *pdata,int argc,char *value[],char *name[]); TestShow::TestShow(QWidget *parent) : QDialog(parent), ui(new Ui::TestShow) { ui->setupUi(this); setWindowFlags(Qt::FramelessWindowHint); page = -1; //初始化显示框 model=new QStandardItemModel(this); model->setColumnCount(1);//ID option name age gender Result time,add some ,totally 11 ui->lineEdit_Year->setValidator(new QIntValidator(0,10000,this)); ui->lineEdit_Month->setValidator(new QIntValidator(0,12,this)); ui->lineEdit_Day->setValidator(new QIntValidator(0,30,this)); ui->pushButton_Exit->setFocusPolicy(Qt::NoFocus); connect(ui->pushButton_up,SIGNAL(clicked()),this,SLOT(page_up())); connect(ui->pushButton_down,SIGNAL(clicked()),this,SLOT(page_down())); connect(ui->pushButton_go,SIGNAL(clicked()),this,SLOT(page_go())); connect(ui->pushButton_Exit,SIGNAL(clicked()),this,SLOT(home())); connect(ui->tableView,SIGNAL(clicked(QModelIndex)),this,SLOT(setPrintTrue(QModelIndex))); connect(ui->pushButton_print,SIGNAL(clicked()),this,SLOT(PrintItem())); connect(ui->pushButton_Search,SIGNAL(clicked()),this,SLOT(find_info())); connect(ui->pushButton_LogOut,SIGNAL(clicked()),this,SLOT(logout())); connect(ui->pushButton_Edit,SIGNAL(clicked()),this,SLOT(view_clicked())); QRegExp rx("^[0-9]{1,10}$");//这个10就是最大长度 QValidator *validator = new QRegExpValidator(rx,0); ui->lineEdit_Page->setValidator(validator); dateEdit=new QDateEdit(this); dateEdit->setDisplayFormat("yyyy-MM-dd"); dateEdit->setGeometry(QRect(413,90,163,29)); dateEdit->setAlignment(Qt::AlignCenter); dateEdit->setDate(QDateTime::currentDateTime().date()); ui->pushButton->setVisible(false); }
static int parse_stdin_data(struct asfd *asfd, struct sel *sel, int count) { static int ch; if(asfd->rbuf->len!=sizeof(ch)) { logp("Unexpected input length in %s: %lu!=%zu\n", __func__, (unsigned long)asfd->rbuf->len, sizeof(ch)); return -1; } memcpy(&ch, asfd->rbuf->buf, sizeof(ch)); switch(ch) { case 'q': case 'Q': return 1; case 't': case 'T': if(toggle) toggle=0; else toggle=1; break; case KEY_UP: case 'k': case 'K': up(sel); break; case KEY_DOWN: case 'j': case 'J': down(sel); break; case KEY_LEFT: case 'h': case 'H': left(sel); break; case KEY_RIGHT: case 'l': case 'L': case KEY_ENTER: case '\n': case ' ': right(sel); break; case KEY_PPAGE: page_up(sel); break; case KEY_NPAGE: page_down(sel); break; case -1: logp("Error on stdin\n"); return -1; } return 0; }
static gboolean scroll_event(GtkWidget *widget,GdkEventScroll *event, gpointer user_data) { dbg("scroll_event\n"); switch (event->direction) { case GDK_SCROLL_UP: page_up(); break; case GDK_SCROLL_DOWN: page_down(); break; default: break; } return FALSE; }
gboolean key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { if (last_row) return FALSE; // dbg("key_press_event %x\n", event->keyval); switch (event->keyval) { case GDK_Up: case GDK_KP_Up: if (page_ofs>0) page_ofs--; break; case GDK_Down: case GDK_KP_Down: if (page_ofs<tsN-1) page_ofs++; break; case GDK_KP_Page_Up: case GDK_Page_Up: page_up(); break; case GDK_KP_Page_Down: case GDK_Page_Down: page_down(); break; case GDK_Home: case GDK_KP_Home: page_ofs = 0; break; case GDK_End: case GDK_KP_End: page_ofs = tsN - PAGE_LEN; break; } disp_page(); return TRUE; }
int main( int argc, char *argv[] ) { /* (x,y) position of edit window. x column, y line -> (0,0) at upper left on screen */ unsigned int xCursorPos = 0; unsigned int yCursorPos = 0; unsigned int curmenu = 0x1100; int i; cwsetup( argc, argv ); writestatus( 0 ); writetab( ); splashscreen( ); /* Main program loop */ do { dispstrhgc( " ", wind.col, 2, NORMALATTR ); i = pulled_down_menu( &curmenu, &xCursorPos, &yCursorPos ); if ( filename[0] != '\0' ) { switch ( i ) { case RETKEY: keymain = menu_to_key( curmenu ); break; case ESCKEY: waitkbd( wind.col + xCursorPos, wind.row + yCursorPos ); /* Show blinking cursor */ keymain = readkbd( ); /* If keypressed Get it */ break; default: keymain = i; break; } while ( keymain != ESCKEY ) { if ( ( keymain & 0xff ) >= 32 ) { keymain = changekey( keymain ); if ( insertmode ) { if ( !insert_char( keymain, &xCursorPos, &yCursorPos ) ) { linetoolong( ); } } else { if ( !ovrwrite_char( keymain, &xCursorPos, &yCursorPos ) ) { linetoolong( ); } } refreshline( xCursorPos, yCursorPos ); } else { /* Function Key */ switch ( keymain ) { case PGUPKEY: case CNTRL_R: page_up( ); break; case PGDNKEY: case CNTRL_C: page_down( ); break; case UPKEY: case CNTRL_E: cursor_up( ); break; case DNKEY: case CNTRL_X: cursor_down( yCursorPos ); break; case LEKEY: case CNTRL_S: cursor_left( &xCursorPos ); break; case 0x2301: gobeginblk( &xCursorPos ); break; case 0x2401: goendblk( &xCursorPos ); break; case RIKEY: case CNTRL_D: cursor_right( &xCursorPos, yCursorPos ); break; case CNTRL_W: scroll_up( ); break; case CNTRL_Z: scroll_down( ); break; case CHOMEKEY: top_of_page( ); break; case CPGUPKEY: topfile( &xCursorPos ); break; case CENDKEY: bottom_of_page( ); break; case CPGDNKEY: endfile( &xCursorPos ); break; case DELKEY: case CNTRL_G: delete_char( xCursorPos ); refreshline( xCursorPos, yCursorPos ); changeflag = YES; break; case CNTRL_T: delete_word( xCursorPos ); refreshline( xCursorPos, yCursorPos ); changeflag = YES; break; case CNTRL_Y: delete_line( ); changeflag = YES; break; case CNTRL_M: case RETKEY: if ( insertmode == NO ) { returnkey( &xCursorPos, yCursorPos ); } else { ret_with_ins( &xCursorPos, yCursorPos ); changeflag = YES; } break; case BSKEY: case CNTRL_H: backspace( &xCursorPos ); yCursorPos = findrow( ); refreshline( 0, yCursorPos ); changeflag = YES; break; case INSKEY: case CNTRL_V: insertmode = !insertmode; writeinsmode( ); break; case CNTRL_N: insert_ret( &xCursorPos ); break; case F10KEY: thaimode = !thaimode; writelanguage( ); break; case F1KEY: fontused = 0x00; writeattr( ); break; case F2KEY: fontused = fontused | ITALICATTR; writeattr( ); break; case F3KEY: fontused = fontused | ONELINEATTR; fontused = fontused & 0x7f; writeattr( ); break; case F4KEY: fontused = fontused | TWOLINEATTR; fontused = fontused & 0xfe; writeattr( ); break; case F5KEY: fontused = fontused | BOLDATTR; writeattr( ); break; case F6KEY: fontused = fontused | ENLARGEATTR; writeattr( ); break; case F7KEY: fontused = fontused | SUPERATTR; if ( ( fontused & SUBATTR ) == SUBATTR ) { fontused = fontused ^ SUBATTR; } writeattr( ); break; case F8KEY: fontused = fontused | SUBATTR; if ( ( fontused & SUPERATTR ) == SUPERATTR ) { fontused = fontused ^ SUPERATTR; } writeattr( ); break; case F9KEY: manualwrap( &xCursorPos, &yCursorPos ); break; case ALTM: editmacro( ); break; case TABKEY: case CNTRL_I: movetotab( &xCursorPos, yCursorPos ); break; case CNTRL_K: blockcommand( &xCursorPos ); break; case 0x1401: blkcmd( 'p', &xCursorPos ); break; case 0x6101: blkcmd( 'b', &xCursorPos ); break; case 0x6201: blkcmd( 'k', &xCursorPos ); break; case 0x6301: blkcmd( 'c', &xCursorPos ); break; case 0x6401: blkcmd( 'y', &xCursorPos ); break; case 0x6501: blkcmd( 'v', &xCursorPos ); break; case 0x6601: blkcmd( 'r', &xCursorPos ); break; case 0x6701: blkcmd( 'w', &xCursorPos ); break; case 0x6801: blkcmd( 'h', &xCursorPos ); break; case CNTRL_O: onscreen( xCursorPos, yCursorPos ); break; case 0x7101: doonscrn( 'l', xCursorPos, yCursorPos ); break; case 0x7201: doonscrn( 'r', xCursorPos, yCursorPos ); break; case 0x7301: doonscrn( 'i', xCursorPos, yCursorPos ); break; case 0x7401: doonscrn( 'n', xCursorPos, yCursorPos ); break; case 0x7501: doonscrn( 'c', xCursorPos, yCursorPos ); break; case 0x7601: doonscrn( 'p', xCursorPos, yCursorPos ); break; case 0x7701: doonscrn( 'x', xCursorPos, yCursorPos ); break; case CNTRL_Q: quick( &xCursorPos, &yCursorPos ); break; case 0x3501: deltoendline( xCursorPos, yCursorPos ); break; case 0x8111: inscntrl( CNTRL_W, xCursorPos, yCursorPos ); break; case 0x8211: inscntrl( CNTRL_S, xCursorPos, yCursorPos ); break; case 0x8311: inscntrl( CNTRL_R, xCursorPos, yCursorPos ); break; case 0x8411: inscntrl( CNTRL_B, xCursorPos, yCursorPos ); break; case 0x8511: inscntrl( CNTRL_E, xCursorPos, yCursorPos ); break; case 0x8611: inscntrl( CNTRL_T, xCursorPos, yCursorPos ); break; case 0x8711: inscntrl( CNTRL_V, xCursorPos, yCursorPos ); break; case CNTRL_P: printcntrl( xCursorPos, yCursorPos ); break; case HOMEKEY: home( &xCursorPos ); break; case ENDKEY: endline( &xCursorPos ); break; case CLEKEY: case CNTRL_A: backword( &xCursorPos ); break; case CRIKEY: case CNTRL_F: nextword( &xCursorPos, yCursorPos ); break; case CNTRL_L: if ( source[0] != '\0' ) { if ( replaceflag == NO ) { if ( searchfwd( &xCursorPos, &yCursorPos ) == NO ) { wordnotfound( ); } } else { if ( searchreplace( &xCursorPos, &yCursorPos ) == NO ) { wordnotfound( ); } } } break; case CNTRL_B: reform( ); break; case ALTP: gotopage( ); break; case CNTRL_J: case ALTL: gotoline( ); break; case 0x5101: searching( &xCursorPos, &yCursorPos ); break; case 0x5201: replacing( &xCursorPos, &yCursorPos ); break; case 0x8501: loadtoline( curline->text ); refreshline( 0, yCursorPos ); break; case CF1KEY: insertmacro( ¯o[0][0], &xCursorPos, &yCursorPos ); break; case CF2KEY: insertmacro( ¯o[1][0], &xCursorPos, &yCursorPos ); break; case CF3KEY: insertmacro( ¯o[2][0], &xCursorPos, &yCursorPos ); break; case CF4KEY: insertmacro( ¯o[3][0], &xCursorPos, &yCursorPos ); break; case CF5KEY: insertmacro( ¯o[4][0], &xCursorPos, &yCursorPos ); break; case CF6KEY: insertmacro( ¯o[5][0], &xCursorPos, &yCursorPos ); break; case CF7KEY: insertmacro( ¯o[6][0], &xCursorPos, &yCursorPos ); break; case CF8KEY: insertmacro( ¯o[7][0], &xCursorPos, &yCursorPos ); break; case CF9KEY: insertmacro( ¯o[8][0], &xCursorPos, &yCursorPos ); break; case CF10KEY: insertmacro( ¯o[9][0], &xCursorPos, &yCursorPos ); break; case AF2KEY: inscntrl( ITALICCODE, xCursorPos, yCursorPos ); break; case AF3KEY: inscntrl( ONELINECODE, xCursorPos, yCursorPos ); break; case AF4KEY: inscntrl( TWOLINECODE, xCursorPos, yCursorPos ); break; case AF5KEY: inscntrl( BOLDCODE, xCursorPos, yCursorPos ); break; case AF6KEY: inscntrl( ENLARGECODE, xCursorPos, yCursorPos ); break; case AF7KEY: inscntrl( SUPERCODE, xCursorPos, yCursorPos ); break; case AF8KEY: inscntrl( SUBCODE, xCursorPos, yCursorPos ); break; #ifdef WANT_TO_USE_GRAPH case ALTG: insertgraph( ); break; case ALTD: deletegraph( ); break; #endif case ALTX: quitprog = YES; keymain = ESCKEY; break; default: if ( ( alt_char_map( keymain ) ) != -1 ) { keymain = alt_char_map( keymain ); if ( insertmode ) { if ( !insert_char( keymain, &xCursorPos, &yCursorPos ) ) { linetoolong( ); } } else { if ( !ovrwrite_char( keymain, &xCursorPos, &yCursorPos ) ) { linetoolong( ); } } refreshline( xCursorPos, yCursorPos ); } break; } /* switch ( keymain ) */ } adjustcol( &xCursorPos ); while ( ( yCursorPos = findrow( ) ) > ( wind.width - 1 ) ) { storeline( curline ); curline = curline->previous; loadtoline( curline->text ); lineno--; } if ( !keypressed( ) ) { if ( !pagecomplete ) { showpage( ); } if ( !keypressed( ) ) { writecolno( firstcol + xCursorPos ); dispstrhgc( " ", wind.col, 2, NORMALATTR ); if ( !keypressed( ) ) { writepageline( ); } } } if ( quitprog != YES ) { waitkbd( wind.col + xCursorPos, wind.row + yCursorPos ); keymain = readkbd( ); dispkey( keymain ); } } /* while */ } else { /* if filename[0] != '\0' */ errorsound( ); } } while ( !quitprog ); if ( changeflag ) { blockmsg( 5 ); dispstrhgc( "ÂѧäÁèä´é¨Ñ´à¡çºá¿éÁ¢éÍÁÙÅ µéͧ¡ÒèѴà¡çºËÃ×ÍäÁè (Y/N)?", ( 16 + center_factor ) + 7, 5, REVERSEATTR ); keymain = 0; while ( ( keymain != 'n' ) && ( keymain != 'N' ) && ( keymain != 'y' ) && ( keymain != 'Y' ) ) { keymain = ebioskey( 0 ) & 0xff; if ( ( keymain == 'y' ) || ( keymain == 'Y' ) ) { writeblk( filename, sentinel->next, 0, sentinel->previous, MAXCOL ); } } } settext( ); return 0; }
void get_commands() { int ch; for(;;) { can_resize = TRUE; /* it's safe to resize now */ if(!opt_get_bool(BOOL_SHOW_CURSOR)) hide_cursor(); if(should_resize) refresh_screen(); ch = getch(); if(!opt_get_bool(BOOL_SHOW_CURSOR)) show_cursor(); can_resize = FALSE; /* it's not safe to resize anymore */ switch(ch) { case 'q': return; case 'Q': quit_abook(QUIT_DONTSAVE); break; case 'P': print_stderr(selected_items() ? -1 : list_get_curitem()); return; case '?': display_help(HELP_MAIN); refresh_screen(); break; case 'a': add_item(); break; case '\r': edit_item(-1); break; case KEY_DC: case 'd': case 'r': ui_remove_items(); break; case 'D': duplicate_item(); break; case 12: refresh_screen(); break; case 'k': case KEY_UP: scroll_up(); break; case 'j': case KEY_DOWN: scroll_down(); break; case 'K': case KEY_PPAGE: page_up(); break; case 'J': case KEY_NPAGE: page_down(); break; case 'g': case KEY_HOME: goto_home(); break; case 'G': case KEY_END: goto_end(); break; case 'w': save_database(); break; case 'l': ui_read_database(); break; case 'i': import_database(); break; case 'e': export_database(); break; case 'C': ui_clear_database(); break; case 'o': ui_open_datafile(); break; case 's': sort_by_field("name"); break; case 'S': sort_surname(); break; case 'F': sort_by_field(NULL); break; case '/': ui_find(0); break; case '\\': ui_find(1); break; case ' ': if(list_get_curitem() >= 0) { list_invert_curitem_selection(); ui_print_number_of_items(); refresh_list(); } break; case '+': select_all(); refresh_list(); break; case '-': select_none(); refresh_list(); break; case '*': invert_selection(); refresh_list(); break; case 'A': move_curitem(MOVE_ITEM_UP); break; case 'Z': move_curitem(MOVE_ITEM_DOWN); break; case 'm': launch_mutt(selected_items() ? -1 : list_get_curitem()); refresh_screen(); break; case 'p': ui_print_database(); break; case 'v': launch_wwwbrowser(list_get_curitem()); refresh_screen(); break; case 'H': launch_callpgm(list_get_curitem(), 'H'); refresh_screen(); break; case 'W': launch_callpgm(list_get_curitem(), 'W'); refresh_screen(); break; case 'M': launch_callpgm(list_get_curitem(), 'M'); refresh_screen(); break; } } }
STATUS disp_diff(STATUS acmmt,i4 canons) { STATUS ioerr ; STATUS up_canon = FAIL ; char cmmtfile [50] ; char canon_upd = '\0' ; char junk ; char menu_ans ; bool conditional_exp ; /* initialize diff window */ conditional_exp = FALSE; #ifndef NT_GENERIC TEwrite(CL,STlength(CL)); TEflush(); #endif diffW = TDnewwin(MAIN_ROWS,MAIN_COLS,FIRST_MAIN_ROW,FIRST_MAIN_COL); diffstW = TDnewwin(STATUS_ROWS,STATUS_COLS,FIRST_STAT_ROW,FIRST_MAIN_COL); TDrefresh(diffstW); TDrefresh(diffW); screenLine = 0; old_page = 0; bottom_page = 0; myPages = NULL; ioerr = OK; STprintf(cmmtfile,ERx("ct%s.stf"),SEPpidstr); diffPtr = sepDiffer->_fptr; /* ** display diff */ page_down(0); if (updateMode) up_canon = OK; for (;;) { if (updateMode) { if (editCAns == '\0') disp_prompt(DIFF_MENU_M,&menu_ans,DIFF_MENU_AM); else menu_ans = 'e'; } else disp_prompt(DIFF_MENU,&menu_ans,DIFF_MENU_A); switch (menu_ans) { case 'A': case 'a': ioerr = FAIL; break; case 'P': case 'p': page_up(); break; case 'N': case 'n': page_down(0); break; case 'C': case 'c': if (acmmt == FAIL && !updateMode) disp_prompt(ERx("no comments attached to this command"), &junk,NULL); else { edit_file(cmmtfile); TDtouchwin(diffW); TDrefresh(diffW); } break; case 'E': case 'e': if (up_canon == OK) { if (editCAns == '\0') { disp_prompt(UPD_CANON,&canon_upd,UPD_CANON_A); } else { canon_upd = editCAns; menu_ans = 'q'; } if (canon_upd == 'M' || canon_upd == 'A' || canon_upd == 'm' || canon_upd == 'a' ) conditional_exp = ask_for_conditional(diffstW, editCAns); up_canon = FAIL; } break; } if (menu_ans == 'Q' || menu_ans == 'q' || menu_ans == 'A' || menu_ans == 'a' || menu_ans == 'D' || menu_ans == 'd') { disp_prompt(NULLSTR,NULL,NULL); SEPdisconnect = (menu_ans == 'A' || menu_ans == 'a' || menu_ans == 'D' || menu_ans == 'd'); break; } } /* ** update test */ if (updateMode) { LOCATION cmmtloc; short count; /* add comments */ LOfroms(FILENAME & PATH,cmmtfile,&cmmtloc); if (SEP_LOexists(&cmmtloc)) { append_line(OPEN_COMMENT,1); append_file(cmmtfile); append_line(CLOSE_COMMENT,1); LOdelete(&cmmtloc); } /* add canons */ switch (canon_upd) { case 'I': case 'i': append_line(OPEN_CANON,1); append_line(SKIP_SYMBOL,1); append_line(CLOSE_CANON,1); break; case 'M': case 'm': SEPrewind(sepResults, FALSE); if (conditional_exp == TRUE) { append_line(OPEN_CANON,0); append_line(conditional_prompt,1); } else append_line(OPEN_CANON,1); append_sepfile(sepResults); append_line(CLOSE_CANON,1); append_sepfile(sepGCanons); break; case 'O': case 'o': SEPrewind(sepResults, FALSE); append_line(OPEN_CANON,1); append_sepfile(sepResults); append_line(CLOSE_CANON,1); break; case '\0': case 'E': case 'e': append_sepfile(sepGCanons); break; case 'A': case 'a': append_sepfile(sepGCanons); SEPrewind(sepResults, FALSE); if (conditional_exp == TRUE) { append_line(OPEN_CANON,0); append_line(conditional_prompt,1); } else append_line(OPEN_CANON,1); append_sepfile(sepResults); append_line(CLOSE_CANON,1); break; } } MEtfree(SEP_ME_TAG_PAGES); TDdelwin(diffW); TDdelwin(diffstW); return(ioerr); }