* changed the parameters of gotoxy() and the return values of wherex/wherey

from byte into tcrtcoord=1..255, since all crt unit coordinates are
    1-based (not for Window() procedure, see comments in crth.inc;
    mantis #13788)

git-svn-id: trunk@13191 -
This commit is contained in:
Jonas Maebe 2009-05-24 11:48:49 +00:00
parent d39e82b256
commit 78c29a33ba
8 changed files with 32 additions and 24 deletions

View File

@ -479,7 +479,7 @@ begin
ConData := pos + 1; ConData := pos + 1;
end; end;
function WhereX : Byte; function WhereX : tcrtcoord;
begin begin
WhereX := Byte(ConData(CD_CURRX))-lo(windmin); WhereX := Byte(ConData(CD_CURRX))-lo(windmin);
end; end;
@ -494,7 +494,7 @@ begin
RealY := Byte(ConData(CD_CURRY)); RealY := Byte(ConData(CD_CURRY));
end; end;
function WhereY : Byte; function WhereY : tcrtcoord;
begin begin
WhereY := Byte(ConData(CD_CURRY))-hi(windmin); WhereY := Byte(ConData(CD_CURRY))-hi(windmin);
end; end;
@ -516,7 +516,7 @@ end;
end; end;
procedure gotoxy(x,y : byte); procedure gotoxy(x,y : tcrtcoord);
begin begin
if (x<1) then if (x<1) then
x:=1; x:=1;

View File

@ -219,7 +219,7 @@ Begin
End; End;
Procedure GotoXy(X: Byte; Y: Byte); Procedure GotoXy(X: tcrtcoord; Y: tcrtcoord);
{ {
Go to coordinates X,Y in the current window. Go to coordinates X,Y in the current window.
} }
@ -284,7 +284,7 @@ End;
Function WhereX: Byte; Function WhereX: tcrtcoord;
{ {
Return current X-position of cursor. Return current X-position of cursor.
} }
@ -297,7 +297,7 @@ End;
Function WhereY: Byte; Function WhereY: tcrtcoord;
{ {
Return current Y-position of cursor. Return current Y-position of cursor.
} }

View File

@ -66,15 +66,23 @@ var
WindMinY : DWord; WindMinY : DWord;
WindMaxY : DWord ; WindMaxY : DWord ;
type
{ all crt unit coordinates are 1-based }
tcrtcoord = 1..255;
{ Interface procedures } { Interface procedures }
procedure AssignCrt(var F: Text); procedure AssignCrt(var F: Text);
function KeyPressed: Boolean; function KeyPressed: Boolean;
function ReadKey: Char; function ReadKey: Char;
procedure TextMode (Mode: word); procedure TextMode (Mode: word);
{ Window parameters not changed to tcrtcoord, because the window() procedure
does nothing if (x1 > x2) or (y1 > y2), and some people may set x2 or y2
to 0 if they don't want it to do anything (JM)
}
procedure Window(X1,Y1,X2,Y2: Byte); procedure Window(X1,Y1,X2,Y2: Byte);
procedure GotoXY(X,Y: Byte); procedure GotoXY(X,Y: tcrtcoord);
function WhereX: Byte; function WhereX: tcrtcoord;
function WhereY: Byte; function WhereY: tcrtcoord;
procedure ClrScr; procedure ClrScr;
procedure ClrEol; procedure ClrEol;
procedure InsLine; procedure InsLine;

View File

@ -198,7 +198,7 @@ Begin
End; End;
Procedure GotoXy(X: Byte; Y: Byte); Procedure GotoXy(X: tcrtcoord; Y: tcrtcoord);
{ {
Go to coordinates X,Y in the current window. Go to coordinates X,Y in the current window.
} }
@ -279,7 +279,7 @@ End;
Function WhereX: Byte; Function WhereX: tcrtcoord;
{ {
Return current X-position of cursor. Return current X-position of cursor.
} }
@ -292,7 +292,7 @@ End;
Function WhereY: Byte; Function WhereY: Btcrtcoordyte;
{ {
Return current Y-position of cursor. Return current Y-position of cursor.
} }

View File

@ -185,7 +185,7 @@ Begin
End; End;
Procedure GotoXy(X: Byte; Y: Byte); Procedure GotoXy(X: tcrtcoord; Y: tcrtcoord);
{ {
Go to coordinates X,Y in the current window. Go to coordinates X,Y in the current window.
} }
@ -253,7 +253,7 @@ End;
Function WhereX: Byte; Function WhereX: tcrtcoord;
{ {
Return current X-position of cursor. Return current X-position of cursor.
} }
@ -263,7 +263,7 @@ End;
Function WhereY: Byte; Function WhereY: tcrtcoord;
{ {
Return current Y-position of cursor. Return current Y-position of cursor.
} }

View File

@ -580,7 +580,7 @@ End;
Procedure GotoXy(X: Byte; Y: Byte); Procedure GotoXy(X: tcrtcoord; Y: tcrtcoord);
{ {
Go to coordinates X,Y in the current window. Go to coordinates X,Y in the current window.
} }
@ -697,7 +697,7 @@ End;
Function WhereX: Byte; Function WhereX: tcrtcoord;
{ {
Return current X-position of cursor. Return current X-position of cursor.
} }
@ -707,7 +707,7 @@ End;
Function WhereY: Byte; Function WhereY: tcrtcoord;
{ {
Return current Y-position of cursor. Return current Y-position of cursor.
} }

View File

@ -208,7 +208,7 @@ Begin
End; End;
Procedure GotoXy(X: Byte; Y: Byte); Procedure GotoXy(X: tcrtcoord; Y: tcrtcoord);
{ {
Go to coordinates X,Y in the current window. Go to coordinates X,Y in the current window.
} }
@ -273,7 +273,7 @@ End;
Function WhereX: Byte; Function WhereX: tcrtcoord;
{ {
Return current X-position of cursor. Return current X-position of cursor.
} }
@ -286,7 +286,7 @@ End;
Function WhereY: Byte; Function WhereY: tcrtcoord;
{ {
Return current Y-position of cursor. Return current Y-position of cursor.
} }

View File

@ -143,7 +143,7 @@ Begin
TextBackGround(0); TextBackGround(0);
End; End;
Procedure GotoXY(X: Byte; Y: Byte); Procedure GotoXY(X: tcrtcoord; Y: tcrtcoord);
begin begin
GotoXY32(X,Y); GotoXY32(X,Y);
@ -227,7 +227,7 @@ begin
Coord, @Temp); Coord, @Temp);
end; end;
Function WhereX: Byte; Function WhereX: tcrtcoord;
begin begin
@ -245,7 +245,7 @@ Begin
WhereX32:= x - WindMinX +1; WhereX32:= x - WindMinX +1;
End; End;
Function WhereY: Byte; Function WhereY: tcrtcoord;
begin begin
WhereY:=WhereY32 mod 256; WhereY:=WhereY32 mod 256;