⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 te_help.c

📁 用BC++3.1编的C语言文本编辑器
💻 C
字号:
#include "te.h"




void show_box(int x0,int y0,int x1,int y1)
{
box(x0,y0,x1,y1,2,0x50,1);
outs(x0+1,y0,0x70,0,"\xfe Online Help\0");
outs(x0+2,y1,0x70,0x7e,"Avalid key:\v  \x18 \x19 \x1a \x1b ESC");
}

void help(void)
{
int j,code,is_show=1;
static int page=0;
int x0=9,y0=4,x1=72,y1=22,cur_point=0;
unsigned char *buff,c;
struct text_info tf;
unsigned char  *word[]=
{
 "  Text Editor Ver 1.0",
 "\0",
 "  Move cursor:"
 "     \x18 \x19 \x1a \x1b",
 "     Home        -to begin of the line",
 "     End         -to end of the line",
 "     PageUp      -to last page",
 "     PageDown    -to next page",
 "\0",
 "     Ctrl+Home    -to begin of file",
 "     Ctrl+End     -to end of file",
 "\0",
 "  Accelerator key:",
 "   F1   -Help",
 "   \0",
 "$",
};
buff=(unsigned char *)farmalloc((y1+2-y0)*(x1+2-x0)*2);
if(buff==NULL)
{ NeedMem(0);
 return ;
}

gettextinfo(&tf);
cur(0);
gettext(x0,y0,x1+1,y1+1,buff);
show_box(x0,y0,x1,y1);
 do{
 if(is_show)
 {clr();
  for(j=0;j<y1-y0-1;j++)
   {
    if(word[j+page][0]=='$')break;
    if(cur_point<slen(word[j+page]))
      outsn(x0+1,j+y0+1,0x5F,word[j+page]+cur_point,x1-x0-1);
   }
  is_show=0;
 }
 code=getkey(NULL);
 switch(code)
  {
   case UP:
	if(page==0)break;
	page--;
	is_show=1;
	break;
   case RIGHT:
	if(cur_point==1024)break;
	cur_point++;
	is_show=1;
	break;
   case LEFT:
	if(cur_point==0)break;
	cur_point--;
	is_show=1;
	break;
   case DOWN:
	if(word[page][0]=='$')break;
	page++;
	is_show=1;
	break;
  }
 }
 while(code!=ESC);
 puttext(x0,y0,x1+1,y1+1,buff);
 farfree(buff);
 window(tf.winleft,tf.wintop,tf.winright,tf.winbottom);
 textattr(tf.attribute);
 clrkey();
 gotoxy(tf.curx,tf.cury);
 cur(cur_type);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -