Пример #1
0
void debugMessage(char* text1, char* text2, int value) {
    int key;
    MsgBoxPush(4);
    mPrintXY(3,2,(char*)text1, TEXT_MODE_TRANSPARENT_BACKGROUND, TEXT_COLOR_BLACK);
    char buffer1[10];
    itoa(value, (unsigned char*)buffer1);
    char buffer2[15];
    strcpy(buffer2, text2);
    strcat(buffer2, buffer1);
    mPrintXY(3,3,(char*)buffer2, TEXT_MODE_TRANSPARENT_BACKGROUND, TEXT_COLOR_BLACK);
    mGetKey(&key);
    MsgBoxPop();
}
Пример #2
0
void Disp_About()
{
    /*
	    显示关于信息(界面绘制)
	*/

	beg:
	font16 = open_font("\\\\fls0\\24PX.hzk");
	select_font(font16);
	
	MsgBoxPush(5);
	
	ClearArea(35,45,349,166);
	locate_OS(3,2);
	Print_OS("iBooks Pro C",0,0);
	print_chs_2(38, 71, 0, "版本 ");
	locate_OS(7, 3);
	Print_OS("1.50", 0, 0);
	print_chs_2(38, 95, 0, "制作:清水视野工作室");
	print_chs_2(38, 119, 0, "本程序依");
	locate_OS(10, 5);
	Print_OS("GNU GPL v3",0,0);
	print_chs_2(38, 143, 0, "协议开放源代码。");
	close_font(font16);
	
	while (1)
	{
	    int key;
	    GetKey(&key);
	    switch (key)
		{
		    case KEY_CTRL_EXIT:
				MsgBoxPop();
				return;break;
	    }
	}
}
Пример #3
0
int Subdir_Open(const char* fn)
{
    /*
	    子目录文件名输入(界面绘制)
		参数说明:
		    fn: 接收从键盘输入文件名的缓冲区
	*/

	FONTCHARACTER fname[64];
	char keybuff[32];    //  接受文件名的字符缓冲区
	int inspos = 0;
	
	memset(keybuff, 0, sizeof(keybuff));
	MsgBoxPush(4);
	
	beg:
	font16 = open_font("\\\\fls0\\24PX.hzk");
	select_font(font16);
	
	ClearArea(0, 192, 384, 216);
	draw_pic(0, 192, 61, 22, 0, Menu_Sub_Jump);
	
	ClearArea(35, 45, 349, 141);
	print_chs_2(38, 71, 0, "输入欲打开的文件名:");
		
	locate_OS(3, 4);
	Print_OS("[        ].txt", 0, 0);
	locate_OS(4, 4);
	Print_OS(keybuff, 0, 0);
	
	close_font(font16);
	
	while (1)
	{
	    int key;
	    GetKey(&key);
	    switch (key)
		{
			case KEY_CTRL_EXIT:
				MsgBoxPop();
			    return 0; break;
						
			case KEY_CTRL_DEL:
			    if (inspos > 0)
				{
					keybuff[--inspos] = 0;    // 最后一个字节置为 NULL,标识已删除
					goto beg;
				}
			    break;
			
			case KEY_CTRL_F1:
			case KEY_CTRL_EXE:
			    strcpy(fn, keybuff);
				//MsgBoxPop();
				return 1; break;
			
			default:
			    if (key >= 0x30 && key <= 0x39 || key >= 0x41 && key <= 0x5A || key >= 0x61 && key <= 0x7A)    // 输入数字 0~9 或英文字母 a-z、A-Z
				{
				    if (inspos <= 8)
					{
						keybuff[inspos++] = key;    // 最后一个字节添加输入
						goto beg;
					}
				}
		}
	}
}
Пример #4
0
void Page_Jump(const char* fn)
{
    /*
	    跳页(界面绘制)
		参数说明:
		    fn: 当前打开文件的文件名
	*/

	FONTCHARACTER fname[64];
	char tip[64],tmp[64];
	char keybuff[32];    //  接受页码的字符缓冲区
	int inspos=0,target;
	
	memset(keybuff, 0, sizeof(keybuff));
	MsgBoxPush(5);
	
	beg:
	font16 = open_font("\\\\fls0\\24PX.hzk");
	select_font(font16);
	
	ClearArea(0,192,384,216);
	draw_pic(0,192,61,22,0,Menu_Sub_Jump);
	draw_pic(63,192,61,22,0,Menu_Jump);
	
	ClearArea(35,45,349,166);
	
	print_chs_2(38,47,0,"当前页/已缓存页数:");
	
	locate_OS(3,3);
	memset(tmp,0,sizeof(tmp));memset(tip,0,sizeof(tip));
	itoa(page+1,tmp,10);strcat(tip,tmp);
    strcat(tip,"/");memset(tmp,0,sizeof(tmp));
	itoa(cached,tmp,10);strcat(tip,tmp);
	Print_OS(tip,0,0);
	
	print_chs_2(38,119,0,"输入目标页码:");
	locate_OS(3,6);
	Print_OS("[    ]",0,0);
	locate_OS(4,6);
	Print_OS(keybuff,0,0);
	
	close_font(font16);
	
	while (1)
	{
	    int key;
	    GetKey(&key);
	    switch (key)
		{
			case KEY_CTRL_EXIT:
				MsgBoxPop();
			    return;break;
			
			case KEY_CTRL_F2:
			    Confirm_AllDivide(fn);    // 尝试全部分页
				goto beg;break;
			
			case KEY_CTRL_DEL:
			    if (inspos>0)
				{
					keybuff[--inspos]=0;    // 最后一个字节置为 NULL,标识已删除
					goto beg;
				}
			    break;
			
			case KEY_CTRL_F1:
			case KEY_CTRL_EXE:
			    if (inspos==0) break;
				target=atoi(keybuff);
				if (target>cached)    // 如果目标位置超出已缓存页面数,尝试分页
				{
				    if (!divide_page(fn, target-cached, 1)) page = cached - 1;    // 若分页已达文件末尾,则将当前页面修正到最后一页
					else page=target-1;    // 否则修正当前页面为输入的目标位置
			    }
				else
				    page=target-1;    // 修正当前页面为输入的目标位置
				MsgBoxPop();
				return;break;
			
			default:
			    if (key>=0x30&&key<=0x39)    // 输入数字 0~9
				{
				    if (inspos<=3)
					{
					    if (key==0x30&&inspos==0) break;    // 尝试第一位输入 0 时跳出
						keybuff[inspos++]=key;    // 最后一个字节添加输入
						goto beg;
					}
				}
		}
	}
}
Пример #5
0
void Read_Bookmark(const char* fn,int* pages,int* n)
{
    /*
	    读取书签(界面绘制)
		参数说明:
		    fn: 当前打开文件的文件名
		    pages: 接受当前所在页码的缓冲区
		    n: 接受已缓存页面数的缓冲区
	*/

    int handle,_n=0,_page=*pages;
	int i,sel=0;
	FONTCHARACTER fname[64];
	char tip[64],tmp[64];
	
	MsgBoxPush(5);
	
	beg:
	font16 = open_font("\\\\fls0\\24PX.hzk");
	select_font(font16);
	
	ClearArea(0,192,384,216);
	draw_pic(0,192,61,22,0,Menu_ReadB);
	
	ClearArea(35,49,349,166);
	print_chs_2(38,47,0,"读取书签");
	
	close_font(font16);
	for (i=0;i<4;++i)
	{
	    memset(tmp,0,sizeof(tmp));memset(tip,0,sizeof(tip));
	    strcat(tip,"[");
	    itoa(i+1,tmp,10);strcat(tip,tmp);
		strcat(tip,"]");
        if (bookmark[i])
		{
		    strcat(tip,"     Page ");
		    memset(tmp,0,sizeof(tmp));
		    itoa(bookmark[i],tmp,10);strcat(tip,tmp);
		}
		else strcat(tip,"     Empty");
		locate_OS(3,3+i);
		Print_OS(tip,0,0);
	}

	Bdisp_AreaReverseVRAM(35,72+sel*24,349,94+sel*24);
	
	while (1)
	{
	    int key;
	    GetKey(&key);
	    switch (key)
		{
		    case KEY_CTRL_UP:
			    if (sel>0) --sel;
				goto beg;break;
				
			case KEY_CTRL_DOWN:
			    if (sel<3) ++sel;
				goto beg;break;
				
	        case KEY_CTRL_EXE:
			    if (bookmark[sel])
				{
			        *pages=bookmark[sel]-1;    // 读取书签
					MsgBoxPop();
			        return;
				}
				else goto beg;break;
			
			case KEY_CTRL_F1:
			case KEY_CTRL_EXIT:
			    *pages=_page;
				MsgBoxPop();
			    return;break;
		}
	}
}
Пример #6
0
void Save_Bookmark(const char* fn,unsigned int pages,int n)
{
    /*
	    存储书签(界面绘制)
		参数说明:
		    fn: 当前打开文件的文件名
		    pages: 当前所在页码
		    n: 已缓存页面数
	*/

    int handle,size,i=0;
	int sel=0,flag;
	char tip[64],tmp[64];
	
	MsgBoxPush(5);
	
	beg:
	flag=0;
	
	font16 = open_font("\\\\fls0\\24PX.hzk");
	select_font(font16);
	
	ClearArea(0,192,384,216);
	draw_pic(0,192,124,22,0,Menu_PutB);
	
	ClearArea(35,49,349,166);
	print_chs_2(38,47,0,"存储书签");
	
	close_font(font16);
	for (i=0;i<4;++i)
	{
	    memset(tmp,0,sizeof(tmp));memset(tip,0,sizeof(tip));
	    strcat(tip,"[");
	    itoa(i+1,tmp,10);strcat(tip,tmp);
		strcat(tip,"]");
        if (bookmark[i])
		{
		    strcat(tip,"     Page ");
		    memset(tmp,0,sizeof(tmp));
		    itoa(bookmark[i],tmp,10);strcat(tip,tmp);
		}
		else strcat(tip,"     Empty");
		locate_OS(3,3+i);
		Print_OS(tip,0,0);
	}

	Bdisp_AreaReverseVRAM(35,72+sel*24,349,94+sel*24);
	
	while (1)
	{
	    int key;
	    GetKey(&key);
	    switch (key)
		{
		    case KEY_CTRL_UP:
			    if (sel>0) --sel;
				goto beg;break;
				
			case KEY_CTRL_DOWN:
			    if (sel<3) ++sel;
				goto beg;break;
			
			case KEY_CTRL_F1:
	        case KEY_CTRL_EXE:
				bookmark[sel]=pages+1;    // 存储书签
			    goto prg;break;
			
			case KEY_CTRL_F2:
			case KEY_CTRL_DEL:
			    bookmark[sel]=0;flag=1;goto prg;break;    // 删除书签
			
			case KEY_CTRL_EXIT:
				MsgBoxPop();
			    return;
		}
	}
	
	prg:
	Save_Config(fn,n);
	
	if (flag) goto beg;
	MsgBoxPop();
}