home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1998 September
/
VPR9809A.ISO
/
FFILLY
/
Chat091
/
chat.tfy
< prev
next >
Wrap
Text File
|
1998-04-21
|
54KB
|
1,429 lines
//chat.tfy
#info INAM "Filly de Chat Ver.0.91"
#info ISBJ "Fillyで動くチャットソフト"
#info IART "Koji TAKAHASHI/POCOPEN,poco@yun.co.jp,GGB02243@niftyserve.or.jp"
#info ICOP "Koji TAKAHASHI/POCOPEN,poco@yun.co.jp,GGB02243@niftyserve.or.jp"
#info IENG "Koji TAKAHASHI/POCOPEN,poco@yun.co.jp,GGB02243@niftyserve.or.jp"
#info IGNR "utility"
#info IKEY "chat"
#info GENR "utility"
#info MDFY "Ask me"
#info TRNS "Ask me"
#info JINT "Ask me"
#info VIDO "800x600,65536"
#info PROD "Koji TAKAHASHI/POCOPEN,poco@yun.co.jp,GGB02243@niftyserve.or.jp"
#info THKS "Yun,tomo@yun.co.jp;Yu-chan,yuji@yun.co.jp;Kage-chan,kage@yun.co.jp;Moriq,moriq@ma2.seikyou.ne.jp"
#info CONT "Koji TAKAHASHI/POCOPEN,poco@yun.co.jp,GGB02243@niftyserve.or.jp"
#include rgb2bgr.h
#include draw3D.h
#define WAIT 1
str recordTime();
str lastStr();
str LF,CR,CD,start,record[],fileName,font,name,link[],oldJob,bName[],Handle;
int pic,rCol[],ID,eCol[],help,width,height,fSize,lSize,bHeight,lines;
int user[],userMax,count,top,mode,y,scLine,no,lHandle,cFlag,oldHeight,oldLines;
int sl[],el[],sx[],ex[],sp[],ep[],key[],mWin,res[],res2[],wid[],fmode;
int cWinx,cWiny,mWinx,mWiny;
main(){
Debug(1);
int i,pic0;
int length;
str VER;
VER="2.31";
LF=StrCode(0x0a);
CR=StrCode(0x0d);
CD=GetCWD();
length=StrLen(CD);
if(SubStr(CD,length-1,1)!="\")CD=CD+"\";
if(GetVer()<VER)exit(VER);
loadIni();
BackMode(1);
bgCol(eCol[0]);
makeBmp("chat.bmp");
pic0=LoadPic("chat.bmp");
bHeight=24;
pic=CreatePic(pic0,width,height+bHeight);
DelPic(pic0);
fmode=0;
makeWindow();
textCol(eCol[2]);
SetFont(fSize,font,128,0,0,0,500);
if(help)showHelp(1);
ready0();
}
int ready0(){
int i;
mes(KEY_DOWN){
if(StrCode(MesP2)=="A"){
del_us;
init();
del_me;
}
else if(StrCode(MesP2)=="C"){
del_us;
custom();
del_me;
}
else if(StrCode(MesP2)=="H"||MesP2==113){
SetLineSize(4);
SetPaintColor(eCol[0]);
DrawRect(pic,0,0,width,height-1);
textCol(eCol[2]);
SetFont(fSize,font,128,0,0,0,500);
showHelp(1);
}
else if(StrCode(MesP2)=="E"||MesP2==27){
del_us;
end(0,2);
del_me;
}
}
mes(LBDOWN){
if(MesP2>=0&&MesP2<80&&MesP3>=height&&MesP3<height+bHeight){
mes(TIME){step(WAIT){del_us;buttonAction(0);
,,,,,,init();del_me}}
}
else if(MesP2>=80&&MesP2<160&&MesP3>=height&&MesP3<height+bHeight){
del_us;
buttonAction(1);
custom();
del_me;
}
else if(MesP2>=160&&MesP2<240&&MesP3>=height&&MesP3<height+bHeight){
buttonAction(2);
SetLineSize(4);
SetPaintColor(eCol[0]);
DrawRect(pic,0,0,width,height-1);
textCol(eCol[2]);
SetFont(fSize,font,128,0,0,0,500);
showHelp(1);
}
else if(MesP2>=240&&MesP2<320&&MesP3>=height&&MesP3<height+bHeight){
mes(TIME){step(WAIT){del_us;buttonAction(3);
,,,,,,end(0,2);del_me}}
}
}
mes(RBDOWN){
del_us;
end(0,2);
del_me;
}
}
int buttonAction(int i){
mes(TIME){
step(WAIT){
SetFont(16,"MS ゴシック",128,0,0,0,500);
SetLineSize(1);
draw3D(pic,i*80,height,i*80+79,height+bHeight-1,eCol[0],2,20,1);
textCol(0x0);
TextWrite(bName[i],pic,i*80+10,height+(bHeight-16)/2+3);
textCol(eCol[2]);
TextWrite(bName[i],pic,i*80+9,height+(bHeight-16)/2+2);
,,,draw3D(pic,i*80,height,i*80+79,height+bHeight-1,eCol[0],2,20,0);
textCol(0x0);
TextWrite(bName[i],pic,i*80+8,height+(bHeight-16)/2+1);
textCol(eCol[2]);
TextWrite(bName[i],pic,i*80+7,height+(bHeight-16)/2);
del_me;
}
}
}
int ready(){
int i,j;
int x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;
mes(DP_RECEIVE){
getMes(DPGetMessage(),MesP1,MesP2);
}
mes(KEY_DOWN){
getKey(MesP1,MesP2);
}
mes(RBDOWN){
end(count);
}
mes(LBDOWN){
for(i=0;i<7;i=i+1){
if(MesP2>=i*80&&MesP2<i*80+80&&MesP3>=height&&MesP3<height+bHeight){
mes(TIME){
step(WAIT){
SetFont(16,"MS ゴシック",128,0,0,0,500);
SetLineSize(1);
draw3D(pic,i*80,height,i*80+79,height+bHeight-1,eCol[0],2,20,1);
textCol(0x0);
TextWrite(bName[i],pic,i*80+10,height+(bHeight-16)/2+3);
textCol(eCol[2]);
TextWrite(bName[i],pic,i*80+9,height+(bHeight-16)/2+2);
,,,draw3D(pic,i*80,height,i*80+79,height+bHeight-1,eCol[0],2,20,0);
textCol(0x0);
TextWrite(bName[i],pic,i*80+8,height+(bHeight-16)/2+1);
textCol(eCol[2]);
TextWrite(bName[i],pic,i*80+7,height+(bHeight-16)/2);
PostMes(KEY_DOWN,0,key[i]);
SetFont(fSize,font,128,0,0,0,500);
del_me;
}
}
break;
}
}
for(j=0;j<no;j=j+1){
if(sl[j]==el[j]){
x1=sx[j]+10;
x2=ex[j]+10;
y1=(sl[j]-top)*lSize;
y2=(sl[j]-top+1)*lSize;
if(MesP2>=x1&&MesP2<x2&&MesP3>=y1&&MesP3<y2){
if(GetColor(pic,MesP2,(MesP3/lSize)*lSize+fSize)==eCol[1])
Shell(link[j]);
}
if(mode==1||mode==2){
y1=(lines-(count-sl[j]))*lSize;
y2=(lines-(count-sl[j])+1)*lSize;
if(MesP2>=x1&&MesP2<x2&&MesP3>=y1&&MesP3<y2){
if(GetColor(pic,MesP2,(MesP3/lSize)*lSize+fSize)==eCol[1])
Shell(link[j]);
}
}
}
else if(el[j]-sl[j]==1){
x1=sx[j]+10;
x2=wid[sl[j]]+10;
y1=(sl[j]-top)*lSize;
y2=(sl[j]-top+1)*lSize;
x3=10;
x4=ex[j]+10;
y3=(el[j]-top)*lSize;
y4=(el[j]-top+1)*lSize;
if((MesP2>=x1&&MesP2<x2&&MesP3>=y1&&MesP3<y2)||(MesP2>=x3&&MesP2<x4&&MesP3>=y3&&MesP3<y4)){
if(GetColor(pic,MesP2,(MesP3/lSize)*lSize+fSize)==eCol[1])
Shell(link[j]);
}
if(mode==1||mode==2){
y1=(lines-(count-sl[j]))*lSize;
y2=(lines-(count-sl[j])+1)*lSize;
y3=(lines-(count-el[j]))*lSize;
y4=(lines-(count-el[j])+1)*lSize;
if((MesP2>=x1&&MesP2<x2&&MesP3>=y1&&MesP3<y2)||(MesP2>=x3&&MesP2<x4&&MesP3>=y3&&MesP3<y4)){
if(GetColor(pic,MesP2,(MesP3/lSize)*lSize+fSize)==eCol[1])
Shell(link[j]);
}
}
}
else if(el[j]-sl[j]==2){
x1=sx[j]+10;
x2=wid[sl[j]]+10;
y1=(sl[j]-top)*lSize;
y2=(sl[j]-top+1)*lSize;
x3=10;
x4=wid[sl[j]+1]+10;
x5=10;
x6=ex[j]+10;
y3=(el[j]-top-1)*lSize;
y4=(el[j]-top)*lSize;
y5=(el[j]-top)*lSize;
y6=(el[j]-top+1)*lSize;
if((MesP2>=x1&&MesP2<x2&&MesP3>=y1&&MesP3<y2)||(MesP2>=x3&&MesP2<x4&&MesP3>=y3&&MesP3<y4)||(MesP2>=x5&&MesP2<x6&&MesP3>=y5&&MesP3<y6)){
if(GetColor(pic,MesP2,(MesP3/lSize)*lSize+fSize)==eCol[1])
Shell(link[j]);
}
if(mode==1||mode==2){
y1=(lines-(count-sl[j]))*lSize;
y2=(lines-(count-sl[j])+1)*lSize;
y3=(lines-(count-sl[j])-1)*lSize;
y4=(lines-(count-sl[j]))*lSize;
y5=(lines-(count-el[j]))*lSize;
y6=(lines-(count-el[j])+1)*lSize;
if((MesP2>=x1&&MesP2<x2&&MesP3>=y1&&MesP3<y2)||(MesP2>=x3&&MesP2<x4&&MesP3>=y3&&MesP3<y4)||(MesP2>=x5&&MesP2<x6&&MesP3>=y5&&MesP3<y6)){
if(GetColor(pic,MesP2,(MesP3/lSize)*lSize+fSize)==eCol[1])
Shell(link[j]);
}
}
}
}
}
}
//画面スクロール関数
int scroll(int s,int h){
MovePic(pic,0,s,width,h-lSize,pic,0,s-lSize);
SetLineSize(4);
SetPaintColor(eCol[0]);
DrawRect(pic,0,height-lSize,width,height);
}
//バージョン違い
int exit(int VER){
MsgBox(StrPrint("Filly.exe Ver.%s 以上が必要です","2.31"));
del_all;
del_me;
}
//全角半角混在文の切り分け関数
int splitStr1(str s,int l){//文字列、欲しい文字数-1
int i,c;
i=0;
for(;;){
c=CharCode(SubStr(s,i,1));
if((c>=0x81&&c<=0x9f)||(c>=0xe0&&c<=0xfc)){
c=CharCode(SubStr(s,i+1,1));
if((c>=0x40&&c<=0x7e)||(c>=0x80&&c<=0xfc)){
i=i+2;
}
else i=i+1;
}
else i=i+1;
if(i>=l)break;
}
return(i);//分割位置
}
//ログ記録&終了
int end(int count,int s=0){
if(s==0){
if(MsgBox("チャットから抜けますか?",0x24)==6){
int file,i;
str logFile;
mes(TIME){
step(5){
DPSendMessage(DPGetName(ID),2);
,,,,DPEnd();
del_all;
record[count+1]=recordTime(1);
logFile=CD+StrPrint("ch%ld.log",WhatDay());
if(IsExist(logFile))file=OpenF(logFile,0x1);
else file=OpenF(logFile,0x1001);
SeekF(file,0,2);
StrWriteF(file,start+LF);
for(i=0;i<=count+1;i=i+1){
StrWriteF(file,record[i]+LF);
}
CloseF(file);
fmode=0;
makeButton();
ready0();
del_me;
}
}
}
}
else if(s==1){
if(MsgBox("チャットから抜けますか?",0x24)==6){
mes(TIME){
step(5){
DPSendMessage(DPGetName(ID),2);
,,,DPEnd();
del_all;
fmode=0;
makeButton();
ready0();
del_me;
}
}
}
}
else if(s==2){
if(MsgBox("終了しますか?",0x24)==6){
del_all;
mWinx=GetLowWord(GetWinPos(mWin));
mWiny=GetHiWord(GetWinPos(mWin));
saveIni();
CloseWinAll();
del_me;
}
else ready0();
}
}
//1x1ドットのBMPファイルを新たに作る関数
int makeBmp(str bmpFile){
if(IsExist(bmpFile)==0){
int code[],i,file;
code[0]=0x4d42; code[1]=0x0044; code[2]=0x0000; code[3]=0x0000;
code[4]=0x0000; code[5]=0x003e; code[6]=0x0000; code[7]=0x0028;
code[8]=0x0000; code[9]=0x0001; code[10]=0x0000;code[11]=0x0001;
code[12]=0x0000;code[13]=0x0001;code[14]=0x0004;code[15]=0x0000;
code[16]=0x0000;code[17]=0x0000;code[18]=0x0000;code[19]=0x0b12;
code[20]=0x0000;code[21]=0x0b12;code[22]=0x0000;code[23]=0x0002;
code[24}=0x0000;code[25]=0x0002;code[26]=0x0000;code[27]=0xffff;
code[28]=0x00ff;code[29]=0x0000;code[30]=0x0000;code[31]=0x0000;
code[32]=0x0000;code[33]=0x0000;
file=OpenF(bmpFile,0x9001);
for(i=0;i<34;i=i+1){
WriteF(file,code[i],2);
}
CloseF(file);
}
}
//発言の表示
int writeRec(int repaint=0){
int bottom;
if(mode==1||mode==2){
SetLineSize(4);
SetPaintColor(eCol[0]);
DrawRect(pic,0,0,width,height-scLine*lSize);
bottom=top+lines-scLine;
writeLine(0,top,bottom);
if(repaint){
DrawRect(pic,0,height-scLine*lSize,width,height);
SetLineSize(1);
SetPaintColor(eCol[6]);
DrawRect(pic,0,height-scLine*lSize-2,width,height-scLine*lSize-1);
bottom=count;
writeLine(height-scLine*lSize,bottom-scLine,bottom);
}
}
else{
if(repaint){
writeLine(0,top,count);
}
else{
SetPaintColor(eCol[0]);
SetLineSize(4);
DrawRect(pic,0,0,width,height-scLine*lSize);
writeLine(0,top,count-scLine);
}
}
}
//行を表示
int writeLine(int y0,int lTop,int lBottom){
int i,j,yy;
yy=y0;
for(i=lTop;i<lBottom;i=i+1){
SetPaintColor(eCol[rCol[i]]);
SetLineSize(1);
textCol(eCol[rCol[i]]);
TextWrite(record[i],pic,10,yy+1);
for(j=0;j<no;j=j+1){
if(i==sl[j]&&i==el[j]){
DrawRect(pic,sx[j]+10,yy+fSize,ex[j]+10,yy+fSize+1);
}
else if(i==sl[j]&&i!=el[j]){
DrawRect(pic,sx[j]+10,yy+fSize,wid[i]+10,yy+fSize+1);
}
else if(i!=sl[j]&&i==el[j]){
DrawRect(pic,10,yy+fSize,ex[j]+10,yy+fSize+1);
}
if(i>sl[j]&&i<el[j]){
DrawRect(pic,10,yy+fSize,wid[i]+10,yy+fSize+1);
}
}
yy=yy+lSize;
}
SetPaintColor(eCol[0]);
SetLineSize(4);
}
//メッセージの表示
int getMes(str Mes,int mesp1,int mesp2){
int col,i,j,point,length,lLength,oldPoint,cCount,ePoint,sPoint;
int uPoint,mPoint,devide,ce[],cs[],oldno,oldep;
str Speaker,Mes2,Mes3;
col=5;
textCol(eCol[col]);
Speaker=DPGetName(mesp1);
if(mesp1!=0){
if(mesp2==0&&mesp1!=ID){
if(DPIsHost()){
user[userMax]=StrtoInt(Mes);
userMax=userMax+1;
for(i=0;i<userMax;i=i+1){
DPSendMessage(StrPrint("%ld",user[i]),4);
}
}
else{
userMax=0;
}
Mes=StrPrint("system:%s がチャットに参加しました",DPGetName(StrtoInt(Mes)));
}
else if(mesp2==0&&mesp1==ID){
Mes="system:チャットに参加しました";
}
else if(mesp2==7){
Mes=StrPrint("system:ハンドル変更( %s )",Mes);
}
else if(mesp2==2){
if(mesp1==ID)Mes="system:チャットを終了しました";
else Mes=StrPrint("system:%s がチャットを終了しました",Mes);
for(i=0;i<userMax;i=i+1){
if(user[i]==mesp1)user[i]=0;
}
}
else if(mesp2==1||mesp2==10||mesp2==11||mesp2==ID+1000){
if(mesp2==1){
Mes=StrPrint("(%s)%s",Speaker,Mes);
col=1;
}
else if(mesp2==10&&mesp1==ID){
col=4;
}
else if(mesp2==11&&mesp1==ID){
col=2;
}
else if(mesp2==ID+1000){
if(mesp1!=ID){
for(i=0;i<userMax;i=i+1){
if(user[i]==mesp1)oldJob=StrPrint("%ld",i+1);
}
}
col=3;
}
textCol(eCol[col]);
}
if(mesp2==4){
if(DPIsHost()==0){
user[userMax]=StrtoInt(Mes);
userMax=userMax+1;
}
}
else if(mesp2==0||mesp2==1||mesp2==2||mesp2==7||(mesp2==10&&mesp1==ID)||(mesp2==11&&mesp1==ID)||mesp2==ID+1000){
if(StrFind(Mes,StrPrint(">%s",DPGetName(ID)))!=-1){
col=7;
textCol(eCol[col]);
}
oldno=no;
Mes2=Mes;
oldep=0;
while(StrFind(Mes2,"http://")!=-1){
length=StrLen(Mes2);
sPoint=StrFind(Mes2,"http://");//リンク開始位置の、先頭からの文字数
Mes3=SubStr(Mes2,0,sPoint);
sp[no]=getStrWidth(Mes3,font,fSize)+oldep;//リンク開始位置のx座標
Mes3=SubStr(Mes2,sPoint,length-sPoint);
ePoint=StrFind(Mes3," ");
if(ePoint!=-1)ePoint=ePoint+sPoint;
else ePoint=StrLen(Mes3)+sPoint;//リンク終了位置の、先頭からの文字数
Mes3=SubStr(Mes2,0,ePoint);
ep[no]=getStrWidth(Mes3,font,fSize)+oldep;//リンク終了位置のx座標
link[no]=SubStr(Mes2,sPoint,ePoint-sPoint);
Mes2=SubStr(Mes2,ePoint,length-ePoint);
oldep=ep[no];
ce[no]=0;
cs[no]=0;
no=no+1;
}
Mes2=Mes;
oldep=0;
while(StrFind(Mes2,"mailto:")!=-1){
length=StrLen(Mes2);
sPoint=StrFind(Mes2,"mailto:");//リンク開始位置の、先頭からの文字数
Mes3=SubStr(Mes2,0,sPoint);
sp[no]=getStrWidth(Mes3,font,fSize)+oldep;//リンク開始位置のx座標
Mes3=SubStr(Mes2,sPoint,length-sPoint);
ePoint=StrFind(Mes3," ");
if(ePoint!=-1)ePoint=ePoint+sPoint;
else ePoint=StrLen(Mes3)+sPoint;//リンク終了位置の、先頭からの文字数
Mes3=SubStr(Mes2,0,ePoint);
ep[no]=getStrWidth(Mes3,font,fSize)+oldep;//リンク終了位置のx座標
link[no]=SubStr(Mes2,sPoint,ePoint-sPoint);
Mes2=SubStr(Mes2,ePoint,length-ePoint);
oldep=ep[no];
ce[no]=0;
cs[no]=0;
no=no+1;
}
devide=splitStr(Mes,width-10-fSize,font,fSize);
res[0]=0;
res2[0]=0;
textCol(eCol[col]);
SetFont(fSize,font,128,0,0,0,500,0,0);
for(i=1;i<=devide;i=i+1){
wid[count]=res2[i]-res2[i-1];
rCol[count]=col;
record[count]=SubStr(Mes,res[i-1],res[i]-res[i-1]);
if(y==height){
if(mode==0)scroll(lSize,height);
else scroll(height-(scLine-1)*lSize,scLine*lSize);
TextWrite(record[count],pic,10,height-lSize+1);
SetPaintColor(eCol[col]);
SetLineSize(1);
for(j=oldno;j<no;j=j+1){
if(cs[j]!=1&&ce[j]!=1&&sp[j]>=res2[i-1]&&sp[j]<res2[i]&&ep[j]<=res2[i]){
sx[j]=sp[j]-res2[i-1];
ex[j]=ep[j]-res2[i-1];
cs[j]=1;
ce[j]=1;
sl[j]=count;
el[j]=count;
DrawRect(pic,sx[j]+10,y-lSize+fSize,ex[j]+10,y-lSize+fSize+1);
}
else if(cs[j]!=1&&ce[j]!=1&&sp[j]>=res2[i-1]&&sp[j]<res2[i]&&ep[j]>res2[i]){
sx[j]=sp[j]-res2[i-1];
cs[j]=1;
sl[j]=count;
DrawRect(pic,sx[j]+10,y-lSize+fSize,res2[i]+10,y-lSize+fSize+1);
}
else if(cs[j]==1&&ce[j]!=1&&sp[j]<=res2[i-1]&&ep[j]>res2[i]){
DrawRect(pic,10,y-lSize+fSize,res2[i]+10,y-lSize+fSize+1);
}
else if(cs[j]==1&&ce[j]!=1&&sp[j]<=res2[i-1]&&ep[j]>res2[i-1]&&ep[j]<=res2[i]){
ex[j]=ep[j]-res2[i-1];
ce[j]=1;
el[j]=count;
DrawRect(pic,10,y-lSize+fSize,ex[j]+10,y-lSize+fSize+1);
}
}
if(mode==0)top=top+1;
}
else{
TextWrite(record[count],pic,10,y+1);
SetPaintColor(eCol[col]);
SetLineSize(1);
for(j=oldno;j<no;j=j+1){
if(cs[j]!=1&&ce[j]!=1&&sp[j]>=res2[i-1]&&sp[j]<res2[i]&&ep[j]>res2[i-1]&&ep[j]<=res2[i]){
sx[j]=sp[j]-res2[i-1];
ex[j]=ep[j]-res2[i-1];
cs[j]=1;
ce[j]=1;
sl[j]=count;
el[j]=count;
DrawRect(pic,sx[j]+10,y+fSize,ex[j]+10,y+fSize+1);
}
if(cs[j]!=1&&ce[j]!=1&&sp[j]>=res2[i-1]&&sp[j]<res2[i]&&ep[j]>res2[i]){
sx[j]=sp[j]-res2[i-1];
cs[j]=1;
sl[j]=count;
DrawRect(pic,sx[j]+10,y+fSize,res2[i]+10,y+fSize+1);
}
if(cs[j]==1&&ce[j]!=1&&sp[j]<=res2[i-1]&&ep[j]>res2[i]){
DrawRect(pic,10,y+fSize,res2[i]+10,y+fSize+1);
}
if(cs[j]==1&&ce[j]!=1&&sp[j]<=res2[i-1]&&ep[j]>res2[i-1]&&ep[j]<=res2[i]){
ex[j]=ep[j]-res2[i-1];
ce[j]=1;
el[j]=count;
DrawRect(pic,10,y+fSize,ex[j]+10,y+fSize+1);
}
}
y=y+lSize;
}
count=count+1;
}
}
}
}
//キーボード操作
int getKey(int mesP1,int mesP2){
str Mesk,line[],job,oldHandle;
int length,i,sjob,rjob,max,fileNo;
if((mesP2==36||mesP2==38||mesP2==33)&&(y==height||mode!=0)&&top>0){
mode=1;
if(mesP2==38)top=top-1;
else if(mesP2==36)top=0;
else if(mesP2==33)top=top-height/(lSize*2);
if(top<0)top=0;
writeRec();
SetLineSize(1);
SetPaintColor(eCol[6]);
DrawRect(pic,0,height-scLine*lSize-2,width,height-scLine*lSize-1);
SetLineSize(4);
SetPaintColor(eCol[0]);
}
else if(mesP2==35&&mode!=0){
mode=0;
top=count-lines;
writeRec();
}
else if((mesP2==40||mesP2==34)&&mode!=0&&top<count-lines+1){
if((mesP2==40&&top==count-lines-1)||(mesP2==34&&top>=count-lines-height/(lSize*2))){
mode=0;
top=count-lines;
writeRec();
}
else{
mode=2;
if(mesP2==40)top=top+1;
if(mesP2==34)top=top+height/(lSize*2);
if(top>count-lines)top=count-lines;
writeRec();
SetLineSize(1);
SetPaintColor(eCol[6]);
DrawRect(pic,0,height-scLine*lSize-2,width,height-scLine*lSize-1);
SetLineSize(4);
SetPaintColor(eCol[0]);
}
}
else if(mesP2==13){
Mesk=StrInput("メッセージを入力してください","");
if(Mesk=="/U"||Mesk=="/u")PostMes(KEY_DOWN,0,119);
else if(Mesk=="/F"||Mesk=="/f")PostMes(KEY_DOWN,0,118);
else if(Mesk=="/N"||Mesk=="/n")PostMes(KEY_DOWN,0,115);
else if(SubStr(Mesk,0,3)=="/F "||SubStr(Mesk,0,3)=="/f ")PostMes(KEY_DOWN,1,118);
else if(SubStr(Mesk,0,3)=="/N "||SubStr(Mesk,0,3)=="/n ")PostMes(KEY_DOWN,1,115);
else if(Mesk=="/E"||Mesk=="/e")PostMes(KEY_DOWN,0,27);
else if(Mesk=="/Q"||Mesk=="/q")PostMes(KEY_DOWN,0,19);
else if(Mesk=="/H"||Mesk=="/h")PostMes(KEY_DOWN,0,113);
else if(SubStr(Mesk,0,3)=="/S "||SubStr(Mesk,0,3)=="/s ")PostMes(KEY_DOWN,1,114);
else{
if(Mesk!=StrCode(0x00)){
if(Mesk==LF)Mesk="";
mes(TIME){
step(WAIT){
,DPSendMessage(Mesk,1);
del_me;
}
}
}
}
}
else if(StrCode(mesP2)=="U"||mesP2==119){
Mesk="JOB USER NAME";
DPSendMessage(Mesk,10);
for(i=0;i<userMax;i=i+1){
if(user[i]!=0&&DPGetName(user[i])!=""){
Mesk=StrPrint("%3ld %s",i+1,DPGetName(user[i]));
DPSendMessage(Mesk,10);
}
}
}
else if(StrCode(mesP2)=="H"||mesP2==113)showHelp();
else if(StrCode(mesP2)=="E"||mesP2==27){
if(fmode)end(count);
else end(count,2);
}
else if(StrCode(mesP2)=="Q"||mesP2==19)end(count,1);
else if(StrCode(mesP2)=="F"||mesP2==118){
if(mesP1){
length=StrLen(Mesk);
fileName=SubStr(Mesk,3,length-3);
}
else fileName=StrInput("txt","テキスト文書|*.txt||",1,0x1800,fileName,1);
if(IsExist(fileName)){
fileNo=OpenF(fileName,0x0);
i=0;
while((Mesk=StrReadF(fileNo))!=""){
length=StrLen(Mesk);
line[i]=SubStr(Mesk,0,length-1);
i=i+1;
}
max=i;
i=0;
mes(IDLE){
step(1){
DPSendMessage(line[i],1);
i=i+1;
if(i==max)del_me;
DPSendMessage(line[i],1);
i=i+1;
if(i==max)del_me;
DPSendMessage(line[i],1);
i=i+1;
if(i==max)del_me;
}
}
CloseF(fileNo);
}
else fileName="";
}
else if(StrCode(mesP2)=="N"||mesP2==115){
oldHandle=DPGetName(ID);
Handle=LF;
if(mesP1)Handle=SubStr(Mesk,3,20);
else{
while(Handle==LF){
Handle=StrInput("名前を入力してください(全角8文字分まで)","");
}
}
if(CharCode(Handle)==0x00)return;
Handle=SubStr(Handle,0,splitStr1(Handle,15));
mes(TIME){
step(WAIT){
,DPSendMessage(StrPrint("%s → %s",oldHandle,Handle),7);
DPSetName(Handle);
del_me;
}
}
}
else if(StrCode(mesP2)=="S"||mesP2==114){
if(mesP1)rjob=StrtoInt(SubStr(Mesk,3,20));
else{
job=LF;
while(job==LF){
job=StrInput("相手のJOB番号を半角で入力してください",oldJob);
}
if(CharCode(job)==0x00)return;
oldJob=job;
rjob=StrtoInt(job);
}
for(i=0;i<userMax;i=i+1){
if(user[i]==ID){
sjob=i+1;
break;
}
}
if(rjob==sjob){
mes(TIME){
step(WAIT){
,DPSendMessage("send:自分には送れません",ID+1000);
del_me;
}
}
}
else if(rjob<=userMax&&rjob!=0){
if(user[rjob-1]!=0&&DPGetName(user[rjob-1])!=""){
Mesk=StrInput("メッセージを入力してください","");
if(CharCode(Mesk)==0x00)return;
else if(Mesk==LF)Mesk="";
Mesk=StrPrint("send:JOB %ld=>JOB %ld %s",sjob,rjob,Mesk);
mes(TIME){
step(WAIT){
,DPSendMessage(Mesk,user[rjob-1]+1000);
DPSendMessage(Mesk,ID+1000);
del_me;
}
}
}
else{
mes(TIME){
step(WAIT){
,DPSendMessage("send:指定したJOB番号は現在いません",ID+1000); del_me;
}
}
}
}
else{
mes(TIME){
step(WAIT){
,DPSendMessage("send:無効なJOB番号です",ID+1000);
del_me;
}
}
}
}
}
//データロード
int loadIni(){
str iniFile,lastName;
iniFile="chat.ini";
font=GetIniStr("Setting","font","MS ゴシック",iniFile);
name=GetIniStr("Setting","defaultName","",iniFile);
lastName=GetIniStr("Setting","lastName","",iniFile);
if(name=="")name=lastName;
help=GetIniInt("Setting","help",1,iniFile);
width=GetIniInt("Setting","width",640,iniFile);
height=GetIniInt("Setting","height",400,iniFile);
fSize=GetIniInt("Setting","fontSize",16,iniFile);
scLine=GetIniInt("Setting","scrollLine",1,iniFile);
mWinx=GetIniInt("Setting","mainWindow_x",0,iniFile);
mWiny=GetIniInt("Setting","mainWindow_y",0,iniFile);
cWinx=GetIniInt("Setting","custWindow_x",0,iniFile);
cWiny=GetIniInt("Setting","custWindow_y",0,iniFile);
eCol[0]=StrtoInt(GetIniStr("Setting","backColor","0x000000",iniFile),1);//バック
eCol[1]=StrtoInt(GetIniStr("Setting","textColor","0xffffff",iniFile),1);//テキスト
eCol[2]=StrtoInt(GetIniStr("Setting","helpColor","0x00ff00",iniFile),1);//ヘルプ
eCol[3]=StrtoInt(GetIniStr("Setting","sendColor","0x00ffff",iniFile),1);//センド
eCol[4]=StrtoInt(GetIniStr("Setting","listColor","0xffff00",iniFile),1);//一覧
eCol[5]=StrtoInt(GetIniStr("Setting","systemColor","0x0000ff",iniFile),1);//システム
eCol[6]=StrtoInt(GetIniStr("Setting","lineColor","0xffffff",iniFile),1);//ライン
eCol[7]=StrtoInt(GetIniStr("Setting","tomeColor","0xff00ff",iniFile),1);//ネームマッチ
if(width<640)width=640;
else if(width>WinInfo(0))width=WinInfo(0);
if(height<400)height=400;
else if(height>WinInfo(1)-bHeight)height=WinInfo(1)-bHeight;
if(fSize<8)fSize=8;
else if(fSize>30)fSize=30;
lSize=fSize*5/4;
oldHeight=height;
if(height%lSize!=0)height=height+lSize-height%lSize;
if(scLine<1)scLine=1;
lines=height/lSize;
if(scLine*lSize>=height/2)scLine=lines/2;
}
//データセーブ
int saveIni(){
str iniFile;
CopyFile(CD+"chat.ini",CD+"chat.bak.ini");
iniFile="chat.ini";
WriteIniStr("Setting","lastName",Handle,iniFile);
WriteIniStr("Setting","font",font,iniFile);
// WriteIniStr("Setting","name",name,iniFile);
// WriteIniInt("Setting","help",help,iniFile);
WriteIniInt("Setting","width",width,iniFile);
WriteIniInt("Setting","height",height,iniFile);
WriteIniInt("Setting","fontSize",fSize,iniFile);
WriteIniInt("Setting","scrollLine",scLine,iniFile);
WriteIniInt("Setting","mainWindow_x",mWinx,iniFile);
WriteIniInt("Setting","mainWindow_y",mWiny,iniFile);
WriteIniInt("Setting","custWindow_x",cWinx,iniFile);
WriteIniInt("Setting","custWindow_y",cWiny,iniFile);
WriteIniStr("Setting","backColor",StrPrint("0x%06lx",eCol[0]),iniFile);//バック
WriteIniStr("Setting","textColor",StrPrint("0x%06lx",eCol[1]),iniFile);//テキスト
WriteIniStr("Setting","helpColor",StrPrint("0x%06lx",eCol[2]),iniFile);//ヘルプ
WriteIniStr("Setting","sendColor",StrPrint("0x%06lx",eCol[3]),iniFile);//センド
WriteIniStr("Setting","listColor",StrPrint("0x%06lx",eCol[4]),iniFile);//一覧
WriteIniStr("Setting","systemColor",StrPrint("0x%06lx",eCol[5]),iniFile);//システム
WriteIniStr("Setting","lineColor",StrPrint("0x%06lx",eCol[6]),iniFile);//ライン
WriteIniStr("Setting","tomeColor",StrPrint("0x%06lx",eCol[7]),iniFile);//ネームマッチ
}
//ヘルプの表示
int showHelp(int pat=0){
str Mes[];
int i;
Mes[0]="help: キーの使い方";
Mes[1]="help:----------------------------------------------------------";
Mes[2]="help:チャット開始:[A] 画面カスタマイズ:[C]";
Mes[3]="help:Filly de Chatの終了:右クリック or [Esc] 、[E]";
Mes[4]="help:----------------------------------------------------------";
Mes[5]="help:メッセージ入力:[Enter] ユーザー一覧:[U] or [F8]";
Mes[6]="help:センド:[S] or [F3] 名前変更:[N] or [F4]";
Mes[7]="help:ファイルアップロード:[F] or [F5] ヘルプ表示:[H] or [F2]";
Mes[8]="help:ログを保存してチャットを終了:右クリック or [Esc] 、[E]";
Mes[9]="help:ログを保存しないでチャットを終了:[Q] or [Pause]";
Mes[10]="help:スクロールアップ:[↑] スクロールダウン:[↓]";
Mes[11]="help:1/2ページアップ:[Page Up] 1/2ページダウン:[Page Down]";
Mes[12]="help:先頭行へジャンプ:[Home] 最新行へジャンプ:[End]";
Mes[13]="help:----------------------------------------------------------";
for(i=0;i<14;i=i+1){
if(pat==0)DPSendMessage(Mes[i],11);
else TextWrite(Mes[i],pic,10,i*lSize+1);
}
}
//記録時間
str recordTime(int se=0){
int wd,wt;
str a,time;
wd=WhatDay();
wt=WhatTime();
a=SubStr("開始終了",se*4,4);
time=StrPrint("----%s時刻:%ld年%ld月%ld日%ld時%ld分%ld秒----",a,wd/10000,(wd/100)%100,wd%100,wt/10000,(wt/100)%100,wt%100);
return time;
}
//画面カスタマイズ
int custom(){
int i,old,new,select,point,pic0,cWin,cPic;
str bName2[],lName[],lName2[];
int bx,by,bWidth,wHeight,wWidth,yPitch,oldc2;
mes(RBDOWN){}
oldc2=eCol[2];
bName2[0]=" OK";
bName2[1]="reset";
wHeight=350;
wWidth=160;
yPitch=20;
bWidth=60;
bx=20+(wWidth-160)/2;
by=wHeight-30;
cPic=CreatePic(pic,wWidth,wHeight);
SetPaintColor(eCol[0]);
DrawRect(cPic,0,0,wWidth,wHeight);
lName[1]="|メッセージの色|";
lName[2]="| ヘルプの色 |";
lName[3]="| センドの色 |";
lName[4]="ユーザー一覧の色";
lName[5]="| システムの色 |";
lName[6]="| 境界線の色 |";
lName[7]="自分あて発言の色";
lName2[0]=" フォントの変更 ";
lName2[1]="ウィンドウサイズの変更";
lName2[2]=" スクロール時行数変更";
SetFont(16,"MS ゴシック",128,0,0,0,500);
// SetFont(16,font,128,0,0,0,500);
for(i=1;i<8;i=i+1){
textCol(eCol[i]);
TextWrite(lName[i],cPic,(wWidth-16*8)/2,i*yPitch);
}
for(i=0;i<3;i=i+1){
textCol(eCol[1]);
TextWrite(lName2[i],cPic,(wWidth-128)/2,i*50+wHeight-180);
}
draw3D(cPic,5,yPitch*8,wWidth-6,yPitch*8+2,eCol[0],1,20,1);
draw3D(cPic,(wWidth-160)/2+20,wHeight-160,(wWidth-160)/2+109,wHeight-141,0xffffff,2,20,1);
draw3D(cPic,(wWidth-160)/2+115,wHeight-160,(wWidth-160)/2+139,wHeight-141,0xffffff,2,20,1);
draw3D(cPic,(wWidth-160)/2+30,wHeight-110,(wWidth-160)/2+69,wHeight-91,0xffffff,2,20,1);
draw3D(cPic,(wWidth-160)/2+90,wHeight-110,(wWidth-160)/2+129,wHeight-91,0xffffff,2,20,1);
draw3D(cPic,(wWidth-160)/2+70,wHeight-60,(wWidth-160)/2+89,wHeight-41,0xffffff,2,20,1);
textCol(0xffffff);
TextWrite("x",cPic,(wWidth-160)/2+76,wHeight-107);
textCol(0x0);
point=splitStr1(font,11);
SetFont(14,"MS ゴシック",128,0,0,0,500);
TextWrite(StrPrint("%s",SubStr(font,0,point)),cPic,(wWidth-160)/2+22,wHeight-157);
TextWrite(StrPrint("%2ldp",fSize),cPic,(wWidth-160)/2+117,wHeight-157);
TextWrite(StrPrint("%4ld",width),cPic,(wWidth-160)/2+36,wHeight-107);
TextWrite(StrPrint("%4ld",height),cPic,(wWidth-160)/2+96,wHeight-107);
TextWrite(StrPrint("%2ld",scLine),cPic,(wWidth-160)/2+76,wHeight-57);
SetFont(16,"MS ゴシック",128,0,0,0,500);
for(i=0;i<2;i=i+1){
draw3D(cPic,i*bWidth+bx,by,(i+1)*bWidth+bx-1,by+bHeight-1,eCol[0],2,20,0);
textCol(0x0);
TextWrite(bName2[i],cPic,i*bWidth+bx+7,by+5);
textCol(eCol[2]);
TextWrite(bName2[i],cPic,i*bWidth+bx+6,by+4);
}
oldLines=lines;
CapTitle(" Customize");
cWin=OpenWin(cPic,cWinx,cWiny);
cFlag=1;
mes(LBDOWN){
if(MesP1==cWin&&MesP2>=bx+bWidth&&MesP2<bx+bWidth*2&&MesP3>=by&&MesP3<by+bHeight){
mes(TIME){
step(WAIT){
del_us;
draw3D(cPic,bx+bWidth,by,bx+bWidth*2-1,by+bHeight-1,eCol[0],2,20,1);
SetFont(16,"MS ゴシック",128,0,0,0,500);
textCol(0x0);
TextWrite(bName2[1],cPic,bx+bWidth+9,by+7);
textCol(oldc2);
TextWrite(bName2[1],cPic,bx+bWidth+8,by+6);
,,,draw3D(cPic,bx+bWidth,by,bx+bWidth*2-1,by+bHeight-1,eCol[0],2,20,0);
textCol(0x0);
TextWrite(bName2[1],cPic,bx+bWidth+7,by+5);
textCol(oldc2);
TextWrite(bName2[1],cPic,bx+bWidth+6,by+4);
SetFont(fSize,font,128,0,0,0,500);
loadIni();
,,,CloseWin(cWin);
DelPic(cPic);
custom();
del_me;
}
}
}
else if(MesP1==cWin&&MesP2>=bx&&MesP2<bx+bWidth&&MesP3>=by&&MesP3<by+bHeight){
mes(TIME){
step(WAIT){
del_us;
draw3D(cPic,bx,by,bx+bWidth-1,by+bHeight-1,eCol[0],2,20,1);
SetFont(16,"MS ゴシック",128,0,0,0,500);
textCol(0x0);
TextWrite(bName2[0],cPic,bx+9,by+7);
textCol(oldc2);
TextWrite(bName2[0],cPic,bx+8,by+6);
,,,draw3D(cPic,bx,by,bx+bWidth-1,by+bHeight-1,eCol[0],2,20,0);
textCol(0x0);
TextWrite(bName2[0],cPic,bx+7,by+5);
textCol(oldc2);
TextWrite(bName2[0],cPic,bx+6,by+4);
SetFont(fSize,font,128,0,0,0,500);
,,,CloseWin(cWin);
DelPic(cPic);
cWinx=GetLowWord(GetWinPos(cWin));
cWiny=GetHiWord(GetWinPos(cWin));
mWinx=GetLowWord(GetWinPos(mWin));
mWiny=GetHiWord(GetWinPos(mWin));
CloseWin(mWin);
pic0=CreatePic(pic,1,1);
DelPic(pic);
pic=CreatePic(pic0,width,height+bHeight);
DelPic(pic0);
makeWindow();
if(mode==0){
if(lines>oldLines){
top=top+oldLines-lines;
if(top<0)top=0;
if(count<=lines)top=0;
y=(count-top)*lSize;
}
else if(lines<oldLines){
if(count<=lines){
top=0;
y=count*lSize;
}
else{
top=count-lines;
y=(count-top)*lSize;
}
}
else y=(count-top)*lSize;
}
else if(mode!=0){
if(lines>oldLines){
if(lines>=count){
mode=0;
top=0;
y=(count-top)*lSize;
}
else if(lines+top>=count){
mode=0;
if(top>=count-lines)top=count-lines;
y=(count-top)*lSize;
}
else{
y=height;
}
}
else if(lines<oldLines){
y=height;
}
}
SetFont(fSize,font,128,0,0,0,500);
cFlag=0;
ready0();
del_me;
}
}
}
else if(MesP1==cWin){
if(MesP2>=(wWidth-160)/2+20&&MesP2<(wWidth-160)/2+110&&MesP3>=wHeight-160&&MesP3<wHeight-140){
int ret[];
str newFont;
newFont=StrInput(ret[],"",3);
if(newFont!="")font=newFont;
point=splitStr1(font,11);
draw3D(cPic,(wWidth-160)/2+20,wHeight-160,(wWidth-160)/2+109,wHeight-141,0xffffff,2,20,1);
textCol(0x0);
SetFont(14,"MS ゴシック",128,0,0,0,500);
TextWrite(StrPrint("%s",SubStr(font,0,point)),cPic,(wWidth-160)/2+22,wHeight-157);
SetPaintColor(eCol[0]);
DrawRect(cPic,0,0,wWidth,yPitch*8);
SetFont(16,"MS ゴシック",128,0,0,0,500);
// SetFont(16,font,128,0,0,0,500);
for(i=1;i<8;i=i+1){
textCol(eCol[i]);
TextWrite(lName[i],cPic,(wWidth-16*8)/2,i*yPitch);
}
}
else if(MesP2>=(wWidth-160)/2+115&&MesP2<(wWidth-160)/2+140&&MesP3>=wHeight-160&&MesP3<wHeight-140){
fSize=StrtoInt(StrInput("フォントのサイズは?(8~30)",StrPrint("%ld",fSize)));
if(fSize<8)fSize=8;
else if(fSize>30)fSize=30;
draw3D(cPic,(wWidth-160)/2+115,wHeight-160,(wWidth-160)/2+139,wHeight-141,0xffffff,2,20,1);
textCol(0x0);
SetFont(14,"MS ゴシック",128,0,0,0,500);
TextWrite(StrPrint("%2ldp",fSize),cPic,(wWidth-160)/2+117,wHeight-157);
// oldLines=height/lSize;
lSize=fSize*5/4;
height=oldHeight+lSize-oldHeight%lSize;
lines=height/lSize;
}
else if(MesP2>=(wWidth-160)/2+30&&MesP2<(wWidth-160)/2+70&&MesP3>=wHeight-110&&MesP3<wHeight-90){
width=StrtoInt(StrInput("ウィンドウの幅は?",StrPrint("%ld",width)));
if(width<640)width=640;
else if(width>WinInfo(0))width=WinInfo(0);
draw3D(cPic,(wWidth-160)/2+30,wHeight-110,(wWidth-160)/2+69,wHeight-91,0xffffff,2,20,1);
textCol(0x0);
SetFont(14,"MS ゴシック",128,0,0,0,500);
TextWrite(StrPrint("%4ld",width),cPic,(wWidth-160)/2+36,wHeight-107);
}
else if(MesP2>=(wWidth-160)/2+90&&MesP2<(wWidth-160)/2+130&&MesP3>=wHeight-110&&MesP3<wHeight-90){
oldLines=height/lSize;
height=StrtoInt(StrInput("ウィンドウの高さは?",StrPrint("%ld",height)));
if(height<400)height=400;
else if(height>WinInfo(1))height=WinInfo(1);
if(height%lSize!=0)height=height+lSize-height%lSize;
lines=height/lSize;
draw3D(cPic,(wWidth-160)/2+90,wHeight-110,(wWidth-160)/2+129,wHeight-91,0xffffff,2,20,1);
textCol(0x0);
SetFont(14,"MS ゴシック",128,0,0,0,500);
TextWrite(StrPrint("%4ld",height),cPic,(wWidth-160)/2+96,wHeight-107);
}
else if(MesP2>=(wWidth-160)/2+70&&MesP2<(wWidth-160)/2+90&&MesP3>=wHeight-60&&MesP3<wHeight-40){
scLine=StrtoInt(StrInput("スクロール時の表示行数は?",StrPrint("%ld",scLine)));
if(scLine<1)scLine=1;
if(scLine*lSize>=height/2)scLine=lines/2;
draw3D(cPic,(wWidth-160)/2+70,wHeight-60,(wWidth-160)/2+89,wHeight-41,0xffffff,2,20,1);
textCol(0x0);
SetFont(14,"MS ゴシック",128,0,0,0,500);
TextWrite(StrPrint("%2ld",scLine),cPic,(wWidth-160)/2+76,wHeight-57);
}
else{
select=0;
for(i=0;i<8;i=i+1){
if(MesP2>=(wWidth-fSize*8)/2&&MesP2<wWidth-(wWidth-fSize*8)/2&&MesP3>=i*yPitch&&MesP3<i*yPitch+fSize)select=i;
}
old=eCol[select];
new=ColorInput();
if(new==-1)new=old;
eCol[select]=new;
if(select==0){
SetPaintColor(eCol[0]);
DrawRect(cPic,0,0,wWidth,wHeight);
SetFont(16,"MS ゴシック",128,0,0,0,500);
// SetFont(16,font,128,0,0,0,500);
for(i=1;i<8;i=i+1){
textCol(eCol[i]);
TextWrite(lName[i],cPic,(wWidth-16*8)/2,i*yPitch);
}
for(i=0;i<3;i=i+1){
textCol(eCol[1]);
TextWrite(lName2[i],cPic,(wWidth-128)/2,i*50+wHeight-180);
}
draw3D(cPic,(wWidth-160)/2+20,wHeight-160,(wWidth-160)/2+109,wHeight-141,0xffffff,2,20,1);
draw3D(cPic,(wWidth-160)/2+115,wHeight-160,(wWidth-160)/2+139,wHeight-141,0xffffff,2,20,1);
draw3D(cPic,(wWidth-160)/2+30,wHeight-110,(wWidth-160)/2+69,wHeight-91,0xffffff,2,20,1);
draw3D(cPic,(wWidth-160)/2+90,wHeight-110,(wWidth-160)/2+129,wHeight-91,0xffffff,2,20,1);
draw3D(cPic,(wWidth-160)/2+70,wHeight-60,(wWidth-160)/2+89,wHeight-41,0xffffff,2,20,1);
textCol(0xffffff);
TextWrite("x",cPic,(wWidth-160)/2+76,wHeight-57);
textCol(0x0);
SetFont(14,"MS ゴシック",128,0,0,0,500);
point=splitStr1(font,11);
TextWrite(StrPrint("%s",SubStr(font,0,point)),cPic,(wWidth-160)/2+22,wHeight-157);
TextWrite(StrPrint("%2ldp",fSize),cPic,(wWidth-160)/2+117,wHeight-157);
TextWrite(StrPrint("%4ld",width),cPic,(wWidth-160)/2+36,wHeight-107);
TextWrite(StrPrint("%4ld",height),cPic,(wWidth-160)/2+96,wHeight-107);
TextWrite(StrPrint("%2ld",scLine),cPic,(wWidth-160)/2+76,wHeight-57);
draw3D(cPic,5,yPitch*8,wWidth-6,yPitch*8+2,eCol[0],1,20,1);
SetFont(16,"MS ゴシック",128,0,0,0,500);
for(i=0;i<2;i=i+1){
draw3D(cPic,i*bWidth+bx,by,(i+1)*bWidth+bx-1,by+bHeight-1,eCol[0],2,20,0);
textCol(0x0);
TextWrite(bName2[i],cPic,i*bWidth+bx+7,by+5);
textCol(eCol[2]);
TextWrite(bName2[i],cPic,i*bWidth+bx+6,by+4);
}
}
else{
SetFont(16,"MS ゴシック",128,0,0,0,500);
// SetFont(16,font,128,0,0,0,500);
SetPaintColor(eCol[0]);
DrawRect(cPic,(wWidth-16*8)/2,select*yPitch,(wWidth+16*8)/2,select*20+20);
textCol(eCol[select]);
TextWrite(lName[select],cPic,(wWidth-16*8)/2,select*yPitch);
}
}
}
}
}
//チャットウインドウを作る
int makeWindow(){
SetLineSize(4);
SetPaintColor(eCol[0]);
DrawRect(pic,0,0,width,height+bHeight);
makeButton();
CapTitle(" Filly de Chat Ver.0.91");
mWin=OpenWin(pic,mWinx,mWiny);
}
//チャットウインドウのボタンを作る
int makeButton(){
int i,bmax;
if(fmode){
bName[0]="[Enter]"; bName[1]=" [U]ser";
bName[2]=" [S]end"; bName[3]=" [N]ame";
bName[4]=" [F]ile"; bName[5]=" [H]elp";
bName[6]=" [E]xit";
key[0]=13; key[1]=85;
key[2]=83; key[3]=78;
key[4]=70; key[5]=72;
key[6]=69;
bmax=7;
}
if(fmode==0){
bName[0]="[A]ccess"; bName[1]="[C]ustom";
bName[2]=" [H]elp"; bName[3]=" [E]xit";
key[0]=65; key[1]=67;
key[2]=72; key[3]=69;
bmax=4;
}
SetLineSize(4);
SetPaintColor(eCol[0]);
DrawRect(pic,0,height,width,height+bHeight);
SetFont(16,"MS ゴシック",128,0,0,0,500);
SetLineSize(1);
for(i=0;i<bmax;i=i+1){
draw3D(pic,i*80,height,i*80+79,height+bHeight-1,eCol[0],2,20,0);
textCol(0x0);
TextWrite(bName[i],pic,i*80+8,height+(bHeight-16)/2+1);
textCol(eCol[2]);
TextWrite(bName[i],pic,i*80+7,height+(bHeight-16)/2);
}
if(fmode){
draw3D(pic,560,height,width-1,height+bHeight-1,eCol[0],2,20,1);
}
else if(fmode==0){
draw3D(pic,320,height,width-1,height+bHeight-1,eCol[0],2,20,1);
}
if(width>=720){
textCol(0x0);
TextWrite("Filly de Chat 0.91",pic,574,height+(bHeight-16)/2+1);
textCol(eCol[2]);
TextWrite("Filly de Chat 0.91",pic,573,height+(bHeight-16)/2);
}
}
str lastStr(str strings){
int length;
length=StrLen(strings);
return SubStr(strings,length-1,1);
}
int splitStr(str ss,int w,str font,int size){
str s;
int x,oldx,c,i,j,lenss,len,z,oldres,oldres2;
j=0;
res[0]=0;
res2[0]=0;
oldres=0;
oldres2=0;
lenss=StrLen(ss);
s=ss;
SetFont(size,font,128,0,0,0,500);
while(s!=""){
z=1;
oldx=0;
len=StrLen(s);
for(i=0;i<len;i=i+z){
c=CharCode(SubStr(s,i,1));
if((c>=0x81&&c<=0x9f)||(c>=0xe0&&c<=0xfc)){
c=CharCode(SubStr(s,i+1,1));
if((c>=0x40&&c<=0x7e)||(c>=0x80&&c<=0xfc)){
z=2;
}
else z=1;
}
else z=1;
x=GetLowWord(GetTextSize(SubStr(s,0,i+z)));
if(x>=w)break;
oldx=x;
}
j=j+1;
res[j]=oldres+i;
res2[j]=oldres2+oldx;
oldres=res[j];
oldres2=res2[j];
s=SubStr(ss,res[j],lenss-res[j]);
}
return j;
}
/*int splitStr(str ss,int w,str font,int size){
int x[],sPic,i,j,len,lenss,c,z,oldres,oldres2,oldz;
str s;
j=0;
res[0]=0;
res2[0]=0;
oldres=0;
oldres2=0;
lenss=StrLen(ss);
s=ss;
sPic=CreatePic(pic,lenss*size/2+10,1);
while(s!=""){
TextColor(0,0,0);
BgColor(0,0,0);
BackMode(0);
len=StrLen(s);
SetFont(size,font,128,0,0,0,500);
SetPaintColor(0xffffff);
DrawLine(sPic,0,0,len*size/2+10,0);
x[0]=0;
oldz=1;
z=1;
for(i=0;i<len;i=i+z){
c=CharCode(SubStr(s,i,1));
if((c>=0x81&&c<=0x9f)||(c>=0xe0&&c<=0xfc)){
c=CharCode(SubStr(s,i+1,1));
if((c>=0x40&&c<=0x7e)||(c>=0x80&&c<=0xfc)){
z=2;
}
else z=1;
}
else z=1;
TextWrite(SubStr(s,0,i+z),sPic,0,0);
if(i==0)x[i]=0;
else x[i]=x[i-oldz];
while(GetColor(sPic,x[i],0)!=0xffffff){
x[i]=x[i]+1;
}
if(x[i]>=w){
break;
}
oldz=z;
}
j=j+1;
res[j]=oldres+i;
res2[j]=x[i-z]+oldres2;
oldres=res[j];
oldres2=res2[j];
s=SubStr(ss,res[j],lenss-res[j]);
}
DelPic(sPic);
BackMode(1);
return j;
}*/
int getStrWidth(str l,str f,int s){
int y;
SetFont(s,f,128,0,0,0,500);
y=GetLowWord(GetTextSize(l));
}
/*int getStrWidth(str l,str f,int s){
int picg,x,len;
len=StrLen(l);
picg=CreatePic(pic,len*s,1);
SetPaintColor(0xffffff);
DrawLine(picg,0,0,len*s,0);
SetFont(s,f,128,0,0,0,500);
TextColor(0,0,0);
BgColor(0,0,0);
BackMode(0);
x=0;
TextWrite(l,picg,0,0);
while(GetColor(picg,x,0)!=0xffffff){
x=x+1;
}
BackMode(1);
DelPic(picg);
MsgBox(StrPrint("%ld %ld",y,x));
return x;
}*/
int init(){
Handle=LF;
SetPaintColor(eCol[0]);
SetLineSize(4);
// mWinx=GetLowWord(GetWinPos(mWin));
// mWiny=GetHiWord(GetWinPos(mWin));
// dPic=CreatePic(pic,647,29);
// DrawRect(dPic,0,0,647,29);
// TextWrite("名前を入力してください(全角8文字分まで有効)",dPic,6,height-46);
// CapTitle("名前を入力してください(全角8文字分まで有効)");
// dWin=OpenWin(dPic,mWinx+10,mWiny+height-60);
while(Handle==LF){
Handle=StrInput("名前を入力してください(全角8文字分まで)",name);
// Handle=StrInput("",name,4,mWinx+18,mWiny+height-34);
}
// CloseWin(dWin);
// DelPic(dPic);
if(CharCode(Handle)==0x00){
ready0();
}
else{
ID=DPInit(0x39ca8000);
if(ID!=-1){
DrawRect(pic,0,0,width,height);
fmode=1;
makeButton();
Handle=SubStr(Handle,0,splitStr1(Handle,15));
DPSetName(Handle);
userMax=0;
if(DPIsHost()){
user[0]=ID;
userMax=1;
}
y=0;
cFlag=0;
top=0;
mode=0;
count=0;
no=0;
fileName="";
oldJob="";
start=recordTime();
DPSendMessage(StrPrint("%ld",ID),0);
ready();
}
else{
ready0();
}
}
}