📄 mtext.cpp
字号:
#include"\sunshine\include\mtext.h"
#include<string.h>
MText::MText(int x,int y,char *idname,char *text1,int fast)
: MObj(x,y,0,16,idname)
{
int maxlength=0,maxwidth=0;
int c=0;
char word[2];
fastput=fast;
word[1]='\0';
text=new char[strlen(text1)+1];
strcpy(text,text1);
for(int i=0;text[i];i++)
{
if(text[i]=='\r' || text[i]=='\n' || text[i]=='\0')
{
c=0;maxlength=(maxlength>c?c:maxlength);
maxwidth+=16;
continue;
}
word[0]=text[i];
c+=Length(word);
}
w(maxlength);
h(maxwidth);
firstrun=1;
TextColor(BLACK);
}
MText::~MText()
{
delete text;
}
void MText::UnFocus() //每行最多128个字符
{
char word[130];
int c=0,col=y();
Mouse am(1);
for(int i=0;text[i];i++)
{
if(text[i]=='\r' || text[i]=='\n' || text[i]=='\0')
{
word[c]='\0';c=0;
if(fastput)
Write((unsigned char far *) word,x(),col,TextColor());
else
Write(word,x(),col,TextColor());
col+=16;
continue;
}
if(c==128) continue;
word[c]=text[i];
c++;
}
}
void MText::GetFocus()
{
UnFocus();
}
int MText::Process()
{
if(firstrun){firstrun=0;UnFocus();return 1;}
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -