void writepage( void ) { char page[4]; dispstrhgc( "˹éÒ ", 4, 2, NORMALATTR ); sprintf( page, "%d", ( ( lineno - 1 ) / lineperpage ) + 1 ); arabictothai( page ); dispstrhgc( page, 8, 2, NORMALATTR ); }
void writelineno( void ) { char st2[6]; dispstrhgc( " ºÃ÷Ѵ ", 4, 2, NORMALATTR ); sprintf( st2, "%u", lineno ); arabictothai( st2 ); dispstrhgc( st2, 15, 2, NORMALATTR ); }
void writeline( void ) { char line[5]; dispstrhgc( "ºÃ÷Ѵ ", 11, 2, NORMALATTR ); sprintf( line, "%d", ( ( lineno - 1 ) % lineperpage ) + 1 ); arabictothai( line ); dispstrhgc( line, 17, 2, NORMALATTR ); }
void writeinsmode( void ) { if ( insertmode ) { dispstrhgc( "¾ÔÁ¾ìá·Ã¡", 33, 2, NORMALATTR ); } else { dispstrhgc( " ¾ÔÁ¾ì·Ñº ", 33, 2, NORMALATTR ); } }
void writelanguage( void ) { if ( thaimode ) { dispstrhgc( " ä·Â ", 42 - 1, 2, BOLDATTR ); } else { dispstrhgc( "English", 42 - 1, 2, BOLDATTR ); } }
void set_all_lineperpage(set_linespace_mode mode) { char *find_lineperinch(void); static char m1[] = "¨Ó¹Ç¹ºÃ÷ѴµèÍ˹éÒäÁè¾Í " "à¤Ã×èͧ¨Ðà»ÅÕè¹ãËéà»ç¹¨Ó¹Ç¹ÊÙ§ÊØ´à·èÒ·Õè¨ÐÂÍÁä´é"; static char m2[] = "¡´»ØèÁ ESC à¾×èÍ·Ó§Ò¹µèÍä»"; if (userlineperpage > find_max_userline_perpage()) { userlineperpage = find_max_userline_perpage(); if (mode == INTERACTIVE) { savepic(); framebox(10, 8, 10+thaistrlen(m1)+4, 11, REVERSEATTR); dispstrhgc(m1, 10+2, 9, REVERSEATTR); dispstrhgc(m2, 10+ (thaistrlen(m1)+4 - thaistrlen(m2)) / 2, 10, REVERSEATTR); while (ebioskey(0) != ESCKEY) ; retpic(); writemenu(0, 1, 0); /* show new userline per page */ } } lineperpage = find_line_perpage(); if (mode == INTERACTIVE) { savepic(); /*" "*/ dispprintf(19,12,0, "¨Ó¹Ç¹ºÃ÷ѴµèÍ¡ÃдÒÉ 1 ¹ÔéÇ ¤×Í : %s ºÃ÷Ѵ/¹ÔéÇ", find_lineperinch()); ebioskey(0); retpic(); } }
void relmarstatus( void ) { if ( relmargin == YES ) { dispstrhgc( "»ÅèÍ¢ͺ", 65 - 3, 2, BOLDATTR ); } else { dispstrhgc( " ", 65 - 3, 2, NORMALATTR ); } }
void writecolno( unsigned int p_xCursorPos ) { char st2[5]; dispstrhgc( "¤ÍÅÑÁ¹ì", 21, 2, NORMALATTR ); sprintf( st2, "%u", p_xCursorPos + 1 ); dispstrhgc( " ", 27, 2, NORMALATTR ); arabictothai( st2 ); dispstrhgc( st2, 27, 2, NORMALATTR ); }
void writeattr( void ) { dispstrhgc( " ", 50 - 1, 2, NORMALATTR ); if ( fontused == 0 ) { dispstrhgc( " µÑÇÍÑ¡Éû¡µÔ", 50 - 1, 2, fontused ); } else if ( ( fontused & 0x08 ) == 0x08 ) { dispstrhgc( "µÑÇ¡¢Öé¹", 50 - 1, 2, fontused & 0xf7 ); } else if ( ( fontused & 0x10 ) == 0x10 ) { dispstrhgc( "µÑÇËéÍÂ", 50 - 1, 2, fontused & 0xef ); } else { dispstrhgc( "µÑÇÍÑ¡ÉÃ", 50 - 1, 2, fontused ); } }
void disperror( char *p_string ) { clear_message( ); /* from printing.obj */ dispstrhgc( p_string, 40 - ( strlen( p_string ) / 2 ), 13, REVERSEATTR ); /* errorsound( ); */ while ( !keypressed( ) ); clear_message( ); /* from printing.obj */ }
void dispkey( register unsigned int p_key ) { dispstrhgc( " ", wind.col, 2, NORMALATTR ); if ( ( p_key & 0xff ) < 32 ) { prchar( '^', NORMALATTR, wind.col, REVERSEATTR ); prchar( ( p_key & 0xff ) + 0x40, NORMALATTR, wind.col + 1, REVERSEATTR ); } }
/** setvideomode * init_cursor */ void setup_screen( void ) { extern int herc_align; registerfarbgidriver( EGAVGA_driver_far ); registerfarbgidriver( Herc_driver_far ); setgraph( ); if ( scrmode == HERCMONO ) { writech = hgcwritech; if ( herc_align ) { align = 40; }/* else { align = 0 (init already) }*/ } else { writech = ewritech; herc_align = 0; } init_graph_and_cursor( ); clsall( ); /* _rectangle( 0 + align, 0, 639 + align, 347 ); */ _rectangle( 0, 0, 639, 347 ); prakeaw( ); dispstrhgc( "¨ØÌÒŧ¡Ã³ìÁËÒÇÔ·ÂÒÅÑÂ", 6, 0, BOLDATTR ); /* _line( 0 + align, 24, 639 + align, 24 ); */ _line( 0, 24, 639, 24 ); }
void wordnotfound( void ) { errorsound( ); blockmsg( 5 ); dispstrhgc( "ËÒ¤ÓäÁ辺 ! ¡´ ESC à¾×èÍ·Ó§Ò¹µèÍ", ( 14 + center_factor ) + 13, 5, REVERSEATTR ); while ( ebioskey( 0 ) != ESCKEY ); pagecomplete = NO; }
void showerrno( void ) { errorsound( ); blockmsg( 5 ); switch ( errno ) { case ENOENT: dispstrhgc( "ËÒá¿éÁ¢éÍÁÙÅäÁ辺 ! ¡´»ØèÁã´æà¾×èÍ·Ó§Ò¹µèÍ...", ( 7 + center_factor ) + 15, 5, REVERSEATTR ); break; case ENOMEM: dispstrhgc( "˹èǤÇÒÁ¨ÓäÁè¾Í ! ¡´»ØèÁã´æà¾×èÍ·Ó§Ò¹µèÍ...", ( 14 + center_factor ) + 8, 6, REVERSEATTR ); break; default: framebox( 13 + center_factor, 4, ( 13 + center_factor ) + 54, 7, REVERSEATTR ); dispstrhgc( "à¡Ô´¤ÇÒÁ¼Ô´¾ÅÒ´ÀÒÂã¹Ãкº !", ( 14 + center_factor ) + 15, 5, REVERSEATTR ); dispstrhgc( sys_errlist[errno], ( 14 + center_factor ) + 15, 6, REVERSEATTR ); } ebioskey( 0 ); }
void notavailable( void ) { savepic( ); blockmsg( 5 ); dispstrhgc( "¤ÓÊÑ觹ÕéÍÂÙèÃÐËÇèÒ§¡ÒþѲ¹Ò ! ¡´»ØèÁã´æ à¾×èÍ·Ó§Ò¹µèÍ", ( 14 + center_factor ) + 4, 5, REVERSEATTR ); ebioskey( 0 ); retpic( ); }
void dispprintf( int p_xPos, int p_yPos, font_attr p_attr, char *p_format, ... ) { va_list argptr; unsigned char tstring[240]; va_start( argptr, p_format ); vsprintf( tstring, p_format, argptr ); va_end( argptr ); dispstrhgc( tstring, p_xPos, p_yPos, p_attr ); }
void gotopage( void ) { char st[4]; int linetogo; st[0] = '\0'; framebox( 30 - CENTER_FACTOR, 4, 30 - CENTER_FACTOR + 29, 6, 2 ); dispstrhgc( "µéͧ¡ÒÃä»·Õè˹éÒ·Õèà·èÒäà ? ", 30 - CENTER_FACTOR + 3, 5, 2 ); if ( getstring( st, 54 - CENTER_FACTOR, 5, 3, 2, NUMBER ) ) { linetogo = ( atoi( st ) * lineperpage ) - lineperpage + 1; if ( linetogo >= 1 ) { goline( linetogo ); } } pagecomplete = NO; }
void gotoline( void ) { char st[5]; register int linetogo; st[0] = '\0'; framebox( 22 - CENTER_FACTOR, 4, 22 - CENTER_FACTOR + 49, 6, 2 ); dispstrhgc( " – µéͧ¡ÒÃä»·ÕèºÃ÷Ѵ·Õèà·èÒäà ? (¹Ñº¨Ò¡µé¹á¿éÁ¢éÍÁÙÅ)", 22 - CENTER_FACTOR, 5, 2 ); if ( getstring( st, 65 - CENTER_FACTOR, 5, 4, 2, NUMBER ) ) { linetogo = atoi( st ); if ( linetogo >= 1 ) { goline( linetogo ); } } pagecomplete = NO; }
unsigned char *savescrn( int p_xStart, int p_yStart, int p_xEnd, int p_yEnd ) { unsigned char *scrnindex; scrnindex = ( unsigned char * ) malloc( ( p_xEnd - p_xStart + 1 ) * ( p_yEnd - p_yStart + 1 ) * 20 ); if ( scrnindex == NULL ) { savepic( ); errorsound( ); blockmsg( 5 ); dispstrhgc( "˹èǤÇÒÁ¨ÓäÁè¾Í ! ¡´»ØèÁã´æà¾×èÍ·Ó§Ò¹µèÍ...", ( 14 + center_factor ) + 8, 6, REVERSEATTR ); ebioskey( 0 ); return( NULL ); } ( *getwind_ptr )( p_xStart, p_yStart, ( p_yEnd - p_yStart + 1 ) * 20, ( p_xEnd - p_xStart + 1 ), scrnindex ); return( scrnindex ); }
void waitkbd( int p_xcurpos, int p_ycurpos ) { register unsigned int i; setcurpos( p_xcurpos, p_ycurpos, thaimode ); while ( !keypressed( ) ) { for ( i = 0; !keypressed( ) && i < 6000; i++ ); setcurpos( p_xcurpos, p_ycurpos, thaimode ); for ( i = 0; !keypressed( ) && i < 6000; i++ ); setcurpos( p_xcurpos, p_ycurpos, thaimode ); if ( !last_menu_on ) dispstrhgc( ( ebioskey( 2 ) & 0x10 ) ? "ΚΓι�§µ�Γ�§" : " ", 70, 2, BOLDATTR ); } setcurpos( p_xcurpos, p_ycurpos, thaimode ); }
void abandonfile(void) { struct line_node *currentline,*templine; blockmsg(10); dispstrhgc("║сея╖╥с║рцб║Юет║А©Иа╒ИмаыеЮ╢тамбыХ ║цьЁрцмйя║╓цыХ..." ,26-CENTER_FACTOR,10,2); currentline = sentinel->next; while (currentline != sentinel) { templine = currentline; currentline = currentline->next; free(templine->text); if (templine->graph != NULL) free(templine->graph); free(templine); } free(sentinel); }
int searchonlyinfo( void ) { int i; framebox( 4 + center_factor, 4, ( 7 + center_factor ) + 69, 10, REVERSEATTR ); dispstrhgc( "ãÊè¤Ó·Õèµéͧ¡Òäé¹ËÒ :", ( 7 + center_factor ), 5, REVERSEATTR ); dispstrhgc( "¤é¹ËÒẺä˹ (ãÊèµÑÇÍÑ¡ÉâͧµÑÇàÅ×Í¡·Õèµéͧ¡ÒÃ) :", ( 7 + center_factor ), 6, REVERSEATTR ); dispstrhgc( "µÑÇàÅ×Í¡ : G = àÃÔèÁ¤é¹ËÒµÑé§áµèµé¹á¿éÁ¢éÍÁÙÅ", ( 7 + center_factor ), 7, REVERSEATTR ); dispstrhgc( "U = äÁèʹ㨵ÑÇàÅç¡ËÃ×͵ÑÇãËè (àªè¹ a ¡Ñº A)", ( 7 + center_factor ), 8, REVERSEATTR ); dispstrhgc( "W = ¤é¹ËÒà»ç¹¤Ó (ËÃ×Íà»ç¹»ÃÐâ¤ã¹ÀÒÉÒä·Â)", ( 7 + center_factor ), 9, REVERSEATTR ); dispstrhgc( "<ESC> ¡àÅÔ¡", ( 7 + center_factor ), 10, 2 ); dispstrhgc( source, ( 7 + center_factor ), 5, REVERSEATTR ); dispstrhgc( option, ( 7 + center_factor ), 6, REVERSEATTR ); pagecomplete = NO; for ( ;; ) { i = getstring( source, ( 7 + center_factor ) + 18, 5, 49, REVERSEATTR, THAIENG ); switch ( i ) { case ESCKEY: return( ESCKEY ); case DNKEY: case YES: do { i = getstring( option, ( 7 + center_factor ) + 40, 6, 3, REVERSEATTR, ENGLISH ); switch ( i ) { case ESCKEY: return( ESCKEY ); case YES: strupr( option ); /* to upper case */ return( YES ); } } while ( i != UPKEY ); break; } } }
int getname(char textst[],unsigned x,unsigned y,unsigned maxlen,char attr) { int i; char drv[MAXDRIVE],dir[MAXDIR],name[MAXFILE],ext[MAXEXT]; char textst2[80]; do { i = getstring(textst,x,y,maxlen,attr,ENGUPCASE); } while ((i != YES) && (i != ESCKEY) && (i != NO)); if (i == YES) { fnsplit(textst,drv,dir,name,ext); fnmerge(textst2,drv,dir,name,ext); if (strcmp(textst,textst2) != 0) { blockmsg(10); dispstrhgc("������������żԴ��Ҵ ! �� <ESC> ���ͷӧҹ���",27,10,REVERSEATTR); while (bioskey(0) != ESCKEY); return(ESCKEY); } } return(i); }
void destroynode( void ) { struct line_node *currentline; struct line_node *templine; blockmsg( 5 ); dispstrhgc( "¡ÓÅѧ·Ó¡ÒáàÅÔ¡á¿éÁ¢éÍÁÙÅà´ÔÁÍÂÙè ¡ÃسÒÃÍÊÑ¡¤ÃÙè...", 26 + center_factor, 5, REVERSEATTR ); currentline = sentinel->next; while ( currentline != sentinel ) { templine = currentline; currentline = currentline->next; free( templine->text ); #ifdef WANT_TO_USE_GRAPH if ( templine->graph != NULL ) { free( templine->graph ); } #endif free( templine ); } free( sentinel ); }
void insertgraph( ) { int i; char graphname[30]; notavailable( ); /* comment this out */ storeline( curline ); blockmsg( 5 ); dispstrhgc( "ãÊèª×èÍá¿éÁÃÙ»ÀÒ¾·Õèµéͧ¡ÒÃÍèÒ¹ :", ( 14 + center_factor ) + 3, 6, REVERSEATTR ); strcpy( graphname, "*.*" ); i = getname( graphname, ( 14 + center_factor ) + 28, 5, 22, REVERSEATTR ); if ( ( i == YES ) && ( graphname[0] != '\0' ) ) { if ( havewild( graphname ) ) { selectfile( graphname ); } curline->graph = readgraph( graphname ); } changeflag = YES; pagecomplete = NO; loadtoline( curline->text ); }
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 splashscreen( void ) { extern char prog_date[]; extern char prog_time[]; #ifdef EDA_VERSION framebox( 17 + center_factor, 5, ( 17 + center_factor ) + 46, 11, REVERSEATTR ); dispstrhgc( "CU WRITER", ( 19 + center_factor ) + 12, 6, REVERSEATTR ); dispstrhgc( "Version 1.2", ( 19 + center_factor ) + 15, 7, REVERSEATTR ); dispstrhgc( "EDA version", ( 19 + center_factor ) + 15, 8, REVERSEATTR ); dispstrhgc( "ÍÀԹѹ·¹Ò¡Òèҡ ¨ØÌÒŧ¡Ã³ìÁËÒÇÔ·ÂÒÅÑÂ", ( 19 + center_factor ) + 6, 9, REVERSEATTR ); dispstrhgc( "Áͺá´è ¡ÃзÃǧµèÒ§»ÃÐà·È", ( 19 + center_factor ) + 10, 10, REVERSEATTR ); #else #ifdef CW_VERSION framebox( 17 + center_factor, 5, ( 17 + center_factor ) + 46, 13, REVERSEATTR ); /* framebox( 17 + center_factor, 5, ( 17 + center_factor ) + 46, 14, REVERSEATTR ); */ dispstrhgc( "CU WRITER", ( 19 + center_factor ) + 12, 6, REVERSEATTR ); dispstrhgc( "Version 1.41", ( 19 + center_factor ) + 15, 7, REVERSEATTR ); dispprintf( ( 19 + center_factor ) + 10, 8, REVERSEATTR, "%11s %8s", prog_date, prog_time ); dispstrhgc( "Hercules/EGA/VGA/MCGA/AT&T", ( 19 + center_factor ) + 8, 9, REVERSEATTR ); dispstrhgc( "¾Ñ²¹Òâ´Â ʶҺѹºÃÔ¡ÒäÍÁ¾ÔÇàµÍÃì ÃèÇÁ¡Ñº", ( 19 + center_factor ) + 5, 10, REVERSEATTR ); dispstrhgc( "ÀÒ¤ÇÔªÒÇÔÈÇ¡ÃÃÁ¤ÍÁ¾ÔÇàµÍÃì ¤³ÐÇÔÈÇ¡ÃÃÁÈÒʵÃì", ( 19 + center_factor ) + 2, 11, REVERSEATTR ); /* dispstrhgc( "áÅÐ ªÁÃÁ¤ÍÁ¾ÔÇàµÍÃì ͺ¨.", ( 19 + center_factor ) + 10, 12, REVERSEATTR ); dispstrhgc("¨ØÌÒŧ¡Ã³ìÁËÒÇÔ·ÂÒÅÑÂ", ( 19 + center_factor ) + 12, 13, REVERSEATTR ); */ dispstrhgc( "¨ØÌÒŧ¡Ã³ìÁËÒÇÔ·ÂÒÅÑÂ", ( 19 + center_factor ) + 12, 12, REVERSEATTR ); #else framebox( ( 17 + center_factor ), 5, ( 17 + center_factor ) + 46, 14, REVERSEATTR ); dispstrhgc( "THAI WRITE", ( 19 + center_factor ) + 11, 6, REVERSEATTR ); dispstrhgc( "Version 1.0.0", ( 19 + center_factor ) + 14, 7, REVERSEATTR ); dispprintf( ( 19 + center_factor ) + 11, 8, REVERSEATTR, "%11s %8s", prog_date, prog_time ); dispstrhgc( "Hercules/EGA/VGA/MCGA/AT&T", ( 19 + center_factor ) + 8, 9, REVERSEATTR ); dispstrhgc( "Khral Steelforge", ( 19 + center_factor ) + 13, 10, REVERSEATTR ); dispstrhgc( "The Forge Warband, Iron Legion", ( 19 + center_factor ) + 6, 11, REVERSEATTR ); dispstrhgc( "¾Ñ²¹Ò¨Ò¡ àÇÔÃì´¨ØÌÒ â´Â ÁËÒÇÔ·ÂÒÅѨØÌÒŧ¡Ã³ì", ( 19 + center_factor ) + 3, 13, REVERSEATTR ); #endif #endif if ( cu_song ) { cusong( ); } ebioskey( 0 ); cls( ); }
int searchreplace( unsigned int *p_xCursorPos, unsigned int *y_CursorPos ) { int ok = 0; int i; int ask = YES; int global = NO; int found = NO; if ( optionnoask( ) ) { ok = 'y'; ask = NO; } if ( optionglobal( ) ) { topfile( p_xCursorPos ); showpageall( ); global = YES; } do { if ( searchfwd( p_xCursorPos, y_CursorPos ) ) { found = YES; if ( ask ) { dispstrhgc( "á·¹·ÕèËÃ×ÍäÁè ? (Y/N) ", 1, 2, BOLDATTR ); while ( ( ok != 'y' ) && ( ok != 'n' ) && ( ok != 'Y' ) && ( ok != 'N' ) ) { while ( !keypressed( ) ) { setcurpos( 19, 2, thaimode ); for ( i = 0; i < 15000; i++ ); setcurpos( 19, 2, thaimode ); for ( i = 0; i < 15000; i++ ); setcurpos( wind.col + *p_xCursorPos, wind.row + *y_CursorPos, thaimode ); for ( i = 0; i < 15000; i++ ); setcurpos( wind.col + *p_xCursorPos, wind.row + *y_CursorPos, thaimode ); for ( i = 0; i < 15000; i++ ); } /* while !keypressed */ ok = ebioskey( 0 ); if ( ( ok != CNTRL_U ) && ( ok != ESCKEY ) ) { ok = ok & 0xff; } else { return( CNTRL_U ); } } /* while ok */ } else { if ( keypressed( ) ) { ok = ebioskey( 0 ); if ( ( ok == CNTRL_U ) || ( ok == ESCKEY ) ) { return( CNTRL_U ); } } ok = 'y'; } if ( ( ok == 'y' ) || ( ok == 'Y' ) ) { replaceword( p_xCursorPos, y_CursorPos ); } ok = 0; } else { global = NO; } } while ( global ); return( found ); }
void doonscrn(register unsigned key,unsigned x,unsigned y) { register int j; char st[4],invmsg[60]; key &= 0xff; if (!isalpha(key) && !iscntrl(key)) return; key &= 0x1f; switch(key) { case 'l' - 'a' + 1 : itoa(leftmar,st,10); framebox(25-CENTER_FACTOR, 4, 25-CENTER_FACTOR+39, 6,REVERSEATTR); dispstrhgc("µйЌІ°“√µ—йІ°—麀铬Ј’и§Ќ≈—ЅємЈ’иаЈи“дЋ√и ?",25-CENTER_FACTOR+4,5,REVERSEATTR); if (getstring(st,58-CENTER_FACTOR,5,3,2,NUMBER)) { j = atoi(st); if ((j < rightmar) && (j > 0)) { leftmar = j; } else { /* Invalid Left Margin */ if (j<1) strcpy(invmsg,"°—麀铬єйЌ¬°«и“ 1 !"); else strcpy(invmsg,"°—麀铬Ѕ“°°«и“°—йє¢«“ !"); strcat(invmsg," °іїЎиЅгіжаЊ„иЌЈ”І“єµиЌ ..."); blockmsg(10); dispstrhgc(invmsg,25-CENTER_FACTOR,10,REVERSEATTR); errorsound(); ebioskey(0); } } break; case 'r' -'a' + 1 : itoa(rightmar,st,10); framebox(25-CENTER_FACTOR, 4, 25-CENTER_FACTOR+39, 6, 2); dispstrhgc("µйЌІ°“√µ—йІ°—йє¢«“Ј’и§Ќ≈—ЅємЈ’иаЈи“дЋ√и ?",25-CENTER_FACTOR+4,5,2); if (getstring(st,58-CENTER_FACTOR,5,3,2,NUMBER)) { j = atoi(st); if ((j > leftmar) && (j <= MAXRMAR)) { rightmar = j; } else { /* Invalid Right Margin */ if (j<=leftmar) strcpy(invmsg,"°—йє¢«“єйЌ¬°«и“°—麀铬 !"); else sprintf(invmsg,"°—йє¢«“ ўІ ЎідЅиа°‘є %d !",MAXRMAR); strcat(invmsg," °іїЎиЅгіжаЊ„иЌЈ”І“єµиЌ ..."); blockmsg(10); dispstrhgc(invmsg,25-CENTER_FACTOR,10,REVERSEATTR); errorsound(); ebioskey(0); } } break; case 'i' -'a' + 1: itoa(x+1,st,10); framebox(25-CENTER_FACTOR, 4, 25-CENTER_FACTOR+39, 6, 2); dispstrhgc("µйЌІ°“√µ—йІ TAB Ј’и§Ќ≈—ЅємЈ’иаЈи“дЋ√и ?",25-CENTER_FACTOR+4,5,2); if (getstring(st,58-CENTER_FACTOR,5,3,2,NUMBER)) { j = atoi(st); if ((j <= MAXCOL) && (j > 0)) tab[j - 1]=YES; } break; case 'n' - 'a' + 1 : strcpy(st,"ALL"); framebox(25-CENTER_FACTOR, 4, 25-CENTER_FACTOR+39, 6, 2); dispstrhgc("µйЌІ°“√≈Ї TAB Ј’и§Ќ≈—ЅємЈ’иаЈи“дЋ√и ?",25-CENTER_FACTOR+4,5,2); if (getstring(st,58-CENTER_FACTOR,5,3,2,NUMBER)) { if (strcmp(st,"ALL") == 0) { for (j=0;j < MAXCOL;++j) tab[j] = NO; } else { j = atoi(st); if ((j <= MAXCOL) && (j > 0)) tab[j - 1] = NO; } } break; case 'p' - 'a' + 1 : itoa(lineperpage,st,10); framebox(25-CENTER_FACTOR, 4, 25-CENTER_FACTOR+41, 6, 2); dispstrhgc("µйЌІ°“√µ—йІ®”є«єЇ√√Ј—іµиЌЋєй“аЈи“дЋ√и ?",25-CENTER_FACTOR+4,5,2); if (getstring(st,61-CENTER_FACTOR,5,3,2,NUMBER)) { if (atoi(st) > 0) { lineperpage = atoi(st); writepageline(); } } break; case 'c' - 'a' + 1 : centerline(y); break; case 'x' - 'a' + 1 : relmargin = !relmargin; relmarstatus(); break; } pagecomplete = NO; writestatus(x); }
void writedriveno( void ) { dispstrhgc( "ä´Ã¿ì :", 40, 0, NORMALATTR ); prchar( 'A' + getdisk( ), BOLDATTR, 45, NORMALATTR ); }