📄 basal_reader_de.i
字号:
non_banked void StandbyScreen( unsigned char bStandby);
non_banked void ClearScreen(region_t *clrregion);
non_banked void MsgBox(int MsgNo,char x,char y);
non_banked void SetBrightness(char BrightnessValue);
non_banked unsigned char sUI_Init(char mode);
non_banked void sUI_Exit(void);
non_banked void sUI_HardInit(void);
extern long FontLibAddr;
extern long AsciiFontLibAddr;
extern char DisplayBuffer[];
typedef struct
{
int title;
int headpic;
char menu_grade[3];
}menuhead_t;
typedef struct
{
int total;
int active;
const unsigned short *title;
unsigned char grade[3];
unsigned char string_id;
}function_menu_t;
typedef struct
{
int min;
int max;
int value;
unsigned char string_id;
} progress_t;
typedef struct
{
int title;
int min;
int max;
int value;
int step;
unsigned char string_id;
}slider_t;
typedef struct
{
const unsigned short *strid;
int total;
int active;
int headid;
unsigned char string_id;
}pop_up_list_t;
int ui_menuhead (menuhead_t *menuhead, int string_id);
int ui_popup_list(pop_up_list_t *list, const void (*callback)(int value));
int ui_err_msg (int msgID, int typeID, int string_id);
int ui_show_msg (int msgID, int typeID, int string_id);
int ui_menu (function_menu_t *menu , const void (*callback)(int value));
int ui_menu2 (function_menu_t *menu , const void (*callback)(int value));
int ui_show_progress(const progress_t *progress, int string_id);
void ui_show_guage(int step, unsigned char para);
int ui_filelist(file_location_t *location, int type, int string_id);
int ui_explore(file_location_t *location, int type, int string_id);
extern char file_name[12];
extern char dir_name[30];
extern char *str_pt;
extern char *strhead_pt;
extern unsigned char scroll_cnt;
int rm_dir_from_buf(int n);
extern unsigned char read_idm_data(char *name, int count);
extern unsigned char write_idm_data(char *name, int count);
extern void init_dir_buf();
extern unsigned char get_dir_name(char *file, unsigned short num);
extern void get_dir_name2(char *file, int num);
extern int init_sel_dir_buf(void);
extern unsigned char del_all_my_file(int type, unsigned char string_id);
extern void reinit_idm_buf(int top, int bottom, int total_dir, int string_id);
void show_active_list(int old_active, int active, int top);
unsigned char show_popup_list(int string_id);
int ui_explore_sub(file_location_t *location, int type, int string_id);
int init_active(int string_id);
int init_active_dironly(file_location_t *location);
void reset_cur_list_bg_color(int i, int tmp);
void get_dir_long_name(file_location_t *location, int string_id);
void redraw_window(void);
void Clearexplore(void);
void ui_show_data(char *buf, unsigned char x, unsigned char y);
typedef struct
{
char magic[4];
unsigned short counts;
char reserved[10];
}res_head_t;
typedef struct
{
long offset;
unsigned short length;
unsigned char type;
char name[9];
}res_entry_t;
extern SD_FILE *res_fp;
extern unsigned char ui_auto_update;
extern unsigned char ui_auto_select;
extern unsigned char ui_run_realtime;
extern region_t res_region;
extern const char mychar[];
extern const char menu_pos[6];
extern unsigned char charge_flag;
SD_FILE *ResOpen(const char * filename);
void ResClose(const SD_FILE *fp_res);
int ResShowPic( unsigned short id, unsigned char x, unsigned char y);
int main_ResShowPic( unsigned short id, unsigned char x, unsigned char y);
int ResShowString( unsigned short id, unsigned char x, unsigned char y);
int ResShowMultiString( unsigned short id, unsigned char string_id, unsigned char x, unsigned char y);
int ResInvertShowPic( unsigned short id, unsigned char x, unsigned char y);
void ap_message_init(const comval_t *comval);
non_banked char ap_get_message(void);
non_banked char ap_handle_hotkey(char key);
char ap_sleep(int half_sec);
void ap_set_event( unsigned short event);
unsigned short ap_get_event( unsigned short event, unsigned short condition);
void ap_del_event( unsigned short event);
char *itoa_1( unsigned char i, char *buf);
char *itoa_2( unsigned char i, char *buf);
char *itoa_3( unsigned short i, char *buf);
char *itoa_4( unsigned short i, char *buf);
int get_text_width(const char *string);
int get_large_text_width(const char *string);
void ui_show_a( unsigned short id);
void ui_show_b( unsigned short id);
void ui_show_c( unsigned short id);
void ui_show_d(const char *string,char mode);
void ui_show_d2(const char *string);
void ui_show_cd(const char *string, unsigned char part);
void ui_show_d_pic( unsigned short id);
void ui_show_e( unsigned short id);
void ui_show_f(const char *string );
void ui_show_ef(const char *string, unsigned char part);
void ui_show_batt(int value, char batt_type, unsigned char fmflag);
void ui_show_g(const char *string);
void ui_show_h(const char *string);
int ui_delete(file_location_t *location, unsigned char type, unsigned char string_id);
int ui_delete_all(file_location_t *location, unsigned char type, unsigned char string_id);
int ui_deleteplaylist(file_location_t *location, unsigned char type, unsigned char string_id);
int ui_directory(file_location_t *location, unsigned char type, unsigned char string_id);
int ui_playlist(file_location_t *location, unsigned char type, unsigned char string_id);
int ui_function_menu(function_menu_t *menu, const void (*callback)(int res_id));
int ui_slider(slider_t *slider, const void (*callback)(int res_id));
char ui_show_lock(char islock);
void ui_show_vol( unsigned char volume);
unsigned char Count_Byte(char *str,char language);
void Scroll(char *scrollstr, char language);
void ScrollInit( char * scrollstr, char language);
void ScrollString( char * scrollstr, unsigned char mode ,char language,region_t *scroll);
typedef unsigned char UInt8;
typedef unsigned char UChar;
typedef unsigned short UInt16;
typedef unsigned long UInt32;
typedef unsigned int UInt;
typedef struct bkmark_nodeType
{
UInt32 offset;
UChar title[ 0x10 - sizeof(UInt32) ];
} bkmark_node;
extern UInt g_bookmark_handle;
extern bkmark_node bkmarks[ 0x10 ];
extern unsigned char
init_bookmark();
extern unsigned char
close_bookmark();
extern unsigned char
add_bookmark(STRUCT_VIEW_FILE *vf, UChar *title, UInt32 offset);
extern unsigned char
get_num_bookmarks();
extern bkmark_node
get_bookmark(UInt8 id);
extern unsigned char
del_bookmark(UInt32 offset);
extern unsigned char
del_bookmark_id(UInt8 id);
extern int
ui_bookmark_list(pop_up_list_t *list, const void (*callback)(int value));
extern int
bookmark_op(void);
extern char fileName[50];
long lBakSeek[ 7 +1];
void ToPrevScreenPosition( STRUCT_VIEW_FILE *ViewFileStructPoint )
{
ViewFileStructPoint->CurrentSeek = ViewFileStructPoint->PrevSeek;
}
unsigned char CheckLangID( unsigned char LangID )
{
return ( LangID != 1 && LangID < 5 );
}
unsigned char read_text(STRUCT_VIEW_FILE *ViewFileStructPoint, unsigned short nFileSector )
{
unsigned char i;
if( nFileSector >= g_reader_vars.g_txt.SectorTotal )
return 0 ;
if( (nFileSector != ViewFileStructPoint->BufSector)||(nFileSector==0) )
{
ViewFileStructPoint->BufSector = nFileSector;
for( i=0; i<( 20 ); i++ )
{
ViewFileStructPoint->bufPrev[i] = ViewFileStructPoint->bufFile[ 512 -( 20 )+i ];
ViewFileStructPoint->bufNext[i] = ViewFileStructPoint->bufFile[ i ];
}
output8( 0x4e , (input8( 0x4e ) | 0x08)) ;
FS_FSeek( ViewFileStructPoint->BufSector, 0 , ViewFileStructPoint->FileHandle );
FS_FRead( ( unsigned char *)ViewFileStructPoint->bufFile, 1, ViewFileStructPoint->FileHandle );
}
return 1 ;
}
unsigned char * read_buff(STRUCT_VIEW_FILE *ViewFileStructPoint, long OA_LongAddr, unsigned short ReadDataLength )
{
unsigned short nSector, nOffset;
if( (OA_LongAddr<ViewFileStructPoint->FileLengthBytes) && (ReadDataLength< 512 ) )
{
nSector = OA_LongAddr / 512 ;
nOffset = OA_LongAddr % 512 ;
if( nOffset + ReadDataLength <= 512 )
{
if( !read_text(ViewFileStructPoint, nSector ) )
return 0 ;
return ( unsigned char *)ViewFileStructPoint->bufFile + nOffset;
}
else if( nOffset + ReadDataLength <= 512 + ( 20 ) )
{
if( !read_text(ViewFileStructPoint, nSector+1 ) )
return 0 ;
if( !read_text(ViewFileStructPoint, nSector ) )
return 0 ;
return ( unsigned char *)ViewFileStructPoint->bufFile + nOffset;
}
else if( nOffset > 512 - ( 20 ) )
{
if( !read_text(ViewFileStructPoint, nSector ) )
return 0 ;
if( !read_text(ViewFileStructPoint, nSector+1 ) )
return 0 ;
return ( unsigned char *)ViewFileStructPoint->bufFile-( 512 -nOffset);
}
}
return 0 ;
}
unsigned char view_page_down(STRUCT_VIEW_FILE *ViewFileStructPoint, unsigned char DealMode,int BackGroundID )
{
long LeftFileLength;
long ReadFileLength;
unsigned short ReadLengthOneTime;
unsigned char *str;
unsigned short RowHeadPosition;
unsigned char ReReadFlag;
unsigned char row, col;
unsigned char CountWords;
LeftFileLength = ViewFileStructPoint->FileLengthBytes - ViewFileStructPoint->CurrentSeek;
if( LeftFileLength <= 0 )
{
ViewFileStructPoint->CurrentSeek =0;
}
if( !DealMode )
ClearScreen( 0 );
ReReadFlag = 1 ;
ReadFileLength = ViewFileStructPoint->CurrentSeek;
RowHeadPosition = 0;
for( row=0; row< 7 ; )
{
if( ReReadFlag )
{
ReReadFlag = 0 ;
ReadFileLength += RowHeadPosition;
LeftFileLength -= RowHeadPosition;
RowHeadPosition = 0;
if( LeftFileLength == 0 )
break;
if( LeftFileLength > 20 *2)
ReadLengthOneTime = 20 *2;
else
ReadLengthOneTime = LeftFileLength;
str = read_buff(ViewFileStructPoint, ReadFileLength, ReadLengthOneTime );
if( str == 0 )
return 0;
if(row==0)
{
memcpy(fileName,str,sizeof(fileName));
}
}
for( ; RowHeadPosition<ReadLengthOneTime; RowHeadPosition++ )
{
output8( 0x4e , (input8( 0x4e ) | 0x08)) ;
if( str[RowHeadPosition]!=0x0d && str[RowHeadPosition]!=0x0a )
break;
}
if( (RowHeadPosition==ReadLengthOneTime) || ((RowHeadPosition+ 20 >=ReadLengthOneTime) && (ReadLengthOneTime!=LeftFileLength)) )
{
ReReadFlag = 1 ;
}
else
{
for( col=CountWords=0; (col< 20 )&&(RowHeadPosition+col<ReadLengthOneTime); CountWords++ )
{
if( str[ RowHeadPosition+col ]==0x0d || str[ RowHeadPosition+col ]==0x0a )
break;
if( str[ RowHeadPosition+col ]<0x80 )
col += 1;
else if( col< 20 -1 )
col += 2;
else
break;
}
if( !DealMode )
{
if( !CheckLangID( ViewFileStructPoint->langid ) )
CountWords = col;
SetTextPos( 6 , row*16+8);
PutS( &str[RowHeadPosition], CountWords );
}
RowHeadPosition += col;
row ++;
}
}
if(DealMode != 2)
{
ViewFileStructPoint->PrevSeek = ViewFileStructPoint->CurrentSeek;
ViewFileStructPoint->CurrentSeek = ReadFileLength + RowHeadPosition;
}
return row;
}
unsigned char view_page_up(STRUCT_VIEW_FILE *ViewFileStructPoint , int BackGroundID)
{
long ReadFileLength;
unsigned short ReadLengthOneTime;
unsigned short RowHeadPosition;
unsigned short ByteCount;
unsigned char ReturnFlag;
unsigned char ReReadFlag;
char FileHeadFlag=0;
unsigned char row, col;
unsigned char chr;
unsigned char *str, *p;
ClearScreen( 0 );
if( ViewFileStructPoint->PrevSeek != 0 )
{
ToPrevScreenPosition(ViewFileStructPoint);
ViewFileStructPoint->PrevSeek = 0;
}
if( 0 == ViewFileStructPoint->CurrentSeek )
return 0;
ReturnFlag = 0 ;
ByteCount = 0;
ReadLengthOneTime = 0 ;
ReadFileLength = ViewFileStructPoint->CurrentSeek;
while( ReadFileLength != 0 )
{
if( ReadLengthOneTime == 0 )
{
if( ReadFileLength > 20 *2)
ReadLengthOneTime = 20 *2;
else
ReadLengthOneTime = ReadFileLength;
ReadFileLength -= ReadLengthOneTime;
str = read_buff(ViewFileStructPoint, ReadFileLength, ReadLengthOneTime );
p = str + ReadLengthOneTime - 1;
}
while( ReadLengthOneTime )
{
output8( 0x4e , (input8( 0x4e ) | 0x08)) ;
chr = *p --;
ReadLengthOneTime --;
if( chr!=0x0d && chr!=0x0a )
{
ByteCount += 1;
ReturnFlag = 0 ;
break;
}
}
while( ReadLengthOneTime )
{
output8( 0x4e , (input8( 0x4e ) | 0x08)) ;
chr = *p --;
ReadLengthOneTime --;
if( chr==0x0d || chr==0x0a )
{
ReturnFlag = 1 ;
break;
}
ByteCount ++;
}
if((ByteCount >= 20 * 7 ) && ReturnFlag )
{
ReadFileLength += ReadLengthOneTime + 1;
break;
}
}
memset( lBakSeek, 0, sizeof(lBakSeek) );
lBakSeek[ 0 ] = ReadFileLength;
if(ReadFileLength==0)
{
FileHeadFlag=1;
}
RowHeadPosition = 0;
ReReadFlag = 1 ;
ByteCount = ViewFileStructPoint->CurrentSeek - ReadFileLength;
for( row=0; ; )
{
if( ReReadFlag )
{
ReReadFlag = 0 ;
ReadFileLength += RowHeadPosition;
ByteCount -= RowHeadPosition;
RowHeadPosition = 0;
if( ByteCount == 0 )
break;
if( ByteCount > 20 *2 )
ReadLengthOneTime = 20 *2;
else
ReadLengthOneTime = ByteCount;
str = read_buff(ViewFileStructPoint, ReadFileLength, ReadLengthOneTime );
if( str == 0 )
return 0;
}
for( ; RowHeadPosition<ReadLengthOneTime; RowHeadPosition++ )
{
output8( 0x4e , (input8( 0x4e ) | 0x08)) ;
chr = str[ RowHeadPosition ];
if( chr!=0x0d && chr!=0x0a )
break;
}
if( (RowHeadPosition==ReadLengthOneTime) || ((RowHeadPosition+ 20 >=ReadLengthOneTime)&&(ReadLengthOneTime!=ByteCount)) )
{
ReReadFlag = 1 ;
}
else
{
for( col=0; (col< 20 )&&(RowHeadPosition+col<ReadLengthOneTime); )
{
chr = str[ RowHeadPosition+col ];
if( chr==0x0d || chr==0x0a )
break;
if( chr<0x80 )
col += 1;
else if( col< 20 -1 )
col += 2;
else
break;
}
RowHeadPosition += col;
lBakSeek[ row%( 7 +1) ] = ReadFileLength + RowHeadPosition;
row ++;
}
}
if(FileHeadFlag)
{
ViewFileStructPoint->CurrentSeek=0;
}
else
{
if(row>=( 7 +1))
ViewFileStructPoint->CurrentSeek = lBakSeek[ row % ( 7 +1) ];
else
ViewFileStructPoint->CurrentSeek = lBakSeek[0];
}
return row;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -