{*********unitees souris *********} unit soursime; {Celle la je me la fais en anglais} INTERFACE uses dos; CONST intrnum=$33; {getstatus sert a conaitre le status de la souris} {left, right, pressleft ect c'est pour les bouttons} {xpos,ypos c'est pour la position} {ainsi que oldx et oldy . Le reste est comprehensible} VAR status,buttons,strokes:integer; releases,callmask,buttonstatus:integer; Xpos,Ypos,oldX,oldY,deltaX,deltaY:integer; moved,left,right,middle,left_right:boolean; oldleft,oldright,oldmiddle,oldleft_right:boolean; pressleft,pressright,pressmiddle,pressleft_right:boolean; holdleft,holdright,holdmiddle,holdleft_right:boolean; relleft,relright,relmiddle,relleft_right:boolean; time_out:array[0..3] of word; PROCEDURE initialize; PROCEDURE hide; PROCEDURE shows; PROCEDURE shows_fleche; FUNCTION Dclic(button_number:byte):boolean; PROCEDURE getstatus; PROCEDURE setposition(X,Y:integer); PROCEDURE setxlimits(Xmin,Xmax:integer); PROCEDURE setylimits(ymin,ymax:integer); PROCEDURE readmotion; PROCEDURE setsensibility(Xsen,Ysen:integer); IMPLEMENTATION VAR regs:registers; PROCEDURE initialize; Begin callmask:=0; moved:=false; buttonstatus:=0; status:=0; buttons:=0; strokes:=0; releases:=0; Xpos:=0; Ypos:=0; oldX:=0; oldY:=0; deltaX:=0; deltaY:=0; left:=false; right:=false; middle:=false; left_right:=false; oldleft:=false; oldright:=false; oldmiddle:=false; oldleft_right:=false; pressleft:=false; pressright:=false; pressmiddle:=false; pressleft_right:=false; holdleft:=false; holdright:=false; holdmiddle:=false; holdleft_right:=false; relleft:=false; relright:=false; relmiddle:=false; relleft_right:=false; gettime(time_out[0],time_out[1],time_out[2],time_out[3]); WITH regs DO begin ax:=0; intr(intrnum,regs); status:=ax; buttons:=bx; end; End; FUNCTION Dclic; {indique si il y a eu un double clic} var h,m,s,c:word; {se sert de time_out come compteur} pression:byte; Begin WITH regs DO begin ax:=$03; intr(intrnum,regs); pression:=bx; end; if pression=button_number then begin Dclic:=false; gettime(h,m,s,c); if ((100*(s-time_out[2])+c-time_out[3] in [7..25]) and (time_out[2] in [s-1..s])) and ((time_out[1]=m) and (time_out[0]=h)) then Dclic:=true; gettime(time_out[0],time_out[1],time_out[2],time_out[3]); end else Dclic:=false; End; {Dclic} PROCEDURE shows_fleche; begin asm mov ax,21h int 33h end; setposition(xpos,ypos); shows; end; PROCEDURE hide; begin if status<>-1 then exit; asm mov ax,02 int 33h end; end; PROCEDURE shows; begin if status<>-1 then exit; asm mov ax,01 int 33h end; end; PROCEDURE getstatus; Begin if status<>-1 then exit; with regs do begin ax:=3; intr(intrnum,regs); oldleft:=left; oldright:=right; oldmiddle:=middle; oldleft_right:=left_right; left:=(bx and 1)<>0; right:=(bx and 2)<>0; middle:=(bx and 4)<>0; left_right:=(bx and 3)<>0; pressleft:=left and (oldleft=false); pressright:=right and (oldright=false); pressmiddle:=middle and (oldmiddle=false); pressleft_right:=left_right and (oldleft_right=false); holdleft:=left and oldleft; holdright:=right and oldright; holdmiddle:=middle and oldmiddle; holdleft_right:=left_right and oldleft_right; relleft:=(left=false) and oldleft; relright:=(right=false) and oldright; relmiddle:=(middle=false) and oldmiddle; relleft_right:=(left_right=false) and oldleft_right; oldx:=xpos; oldy:=ypos; xpos:=cx; ypos:=dx; if (oldx<>xpos) or (oldy<>ypos) then begin moved:=true; deltax:=xpos-oldx; deltay:=ypos-oldy; end else moved:=false; end; End; PROCEDURE setposition; Begin if status<>-1 then exit; with regs do begin ax:=4; cx:=X; dx:=Y; intr(intrnum,regs); end; End; PROCEDURE setxlimits; Begin if status<>-1 then exit; with regs do begin ax:=7; cx:=xmin; dx:=xmax; intr(intrnum,regs); end; End; PROCEDURE setylimits; Begin if status<>-1 then exit; with regs do begin ax:=8; cx:=ymin; dx:=Ymax; intr(intrnum,regs); end; End; PROCEDURE readmotion; Begin if status<>-1 then exit; with regs do begin ax:=11; intr(intrnum,regs); deltax:=cx; deltay:=dx; end; End; PROCEDURE setsensibility; Begin if status<>-1 then exit; with regs do begin ax:=15; cx:=xsen; dx:=Ysen; end; intr(intrnum,regs); End; BEGIN initialize; END.