* only handle direction keys specially if buffer is bigger than window

This commit is contained in:
pierre 2002-10-30 22:07:11 +00:00
parent ffa8a38c48
commit fe29b4aca5
2 changed files with 48 additions and 17 deletions

View File

@ -50,16 +50,19 @@ begin
GiveUpTimeSlice; GiveUpTimeSlice;
until Event.What=evKeyboard; until Event.What=evKeyboard;
Clear:=true; Clear:=true;
case Event.keycode of if not UserScreen^.CanScroll then
kbPgUp : UserScreen^.Scroll(-20); Clear:=false
kbPgDn : UserScreen^.Scroll(20); else
kbUp : UserScreen^.Scroll(-1); case Event.keycode of
kbDown : UserScreen^.Scroll(1); kbPgUp : UserScreen^.Scroll(-20);
kbHome : UserScreen^.Scroll(-1024); kbPgDn : UserScreen^.Scroll(20);
kbEnd : UserScreen^.Scroll(+1024); kbUp : UserScreen^.Scroll(-1);
kbDown : UserScreen^.Scroll(1);
kbHome : UserScreen^.Scroll(-1024);
kbEnd : UserScreen^.Scroll(+1024);
else else
Clear:=false; Clear:=false;
end; end;
if Clear then if Clear then
ClearEvent(Event); ClearEvent(Event);
until Event.what=evKeyboard; until Event.what=evKeyboard;
@ -179,7 +182,10 @@ end;
{ {
$Log$ $Log$
Revision 1.4 2002-09-07 15:40:43 peter Revision 1.5 2002-10-30 22:07:11 pierre
* only handle direction keys specially if buffer is bigger than window
Revision 1.4 2002/09/07 15:40:43 peter
* old logs removed and tabs fixed * old logs removed and tabs fixed
Revision 1.3 2002/09/03 13:59:09 pierre Revision 1.3 2002/09/03 13:59:09 pierre

View File

@ -45,6 +45,8 @@ type
procedure Restore; virtual; procedure Restore; virtual;
{ move up or down if supported by OS } { move up or down if supported by OS }
function Scroll(i : integer) : integer; virtual; function Scroll(i : integer) : integer; virtual;
{ is moving supported by OS }
function CanScroll : boolean; virtual;
{ saves the current IDE screen } { saves the current IDE screen }
procedure SaveIDEScreen; virtual; procedure SaveIDEScreen; virtual;
{ saves the current console screen } { saves the current console screen }
@ -55,7 +57,7 @@ type
procedure SwitchBackToIDEScreen; virtual; procedure SwitchBackToIDEScreen; virtual;
end; end;
{$IFDEF OS2} {$IFDEF OS2}
POS2Screen = ^TOS2Screen; POS2Screen = ^TOS2Screen;
TOS2Screen = object(TScreen) TOS2Screen = object(TScreen)
constructor Init; constructor Init;
@ -80,7 +82,7 @@ type
{ restores the saved IDE screen } { restores the saved IDE screen }
procedure SwitchBackToIDEScreen; virtual; procedure SwitchBackToIDEScreen; virtual;
end; end;
{$ENDIF} {$ENDIF}
{$ifdef DOS} {$ifdef DOS}
TDOSVideoInfo = record TDOSVideoInfo = record
@ -180,6 +182,7 @@ type
function GetHeight: integer; virtual; function GetHeight: integer; virtual;
procedure GetLine(Line: integer; var Text, Attr: string); virtual; procedure GetLine(Line: integer; var Text, Attr: string); virtual;
procedure GetCursorPos(var P: TPoint); virtual; procedure GetCursorPos(var P: TPoint); virtual;
function CanScroll : boolean; virtual;
function Scroll(i : integer) : integer; virtual; function Scroll(i : integer) : integer; virtual;
procedure Capture; virtual; procedure Capture; virtual;
procedure Restore; virtual; procedure Restore; virtual;
@ -281,6 +284,11 @@ begin
Scroll:=0; Scroll:=0;
end; end;
function TScreen.CanScroll : boolean;
begin
CanScroll:=false;
end;
procedure TScreen.SaveConsoleScreen; procedure TScreen.SaveConsoleScreen;
begin begin
Abstract; Abstract;
@ -1038,6 +1046,20 @@ begin
GetHeight:=ConsoleScreenBufferInfo.dwSize.Y; GetHeight:=ConsoleScreenBufferInfo.dwSize.Y;
end; end;
function TWin32Screen.CanScroll : boolean;
var
ConsoleScreenBufferInfo : Console_screen_buffer_info;
BufferLines : longint;
WindowLines : longint;
begin
GetConsoleScreenBufferInfo(DosScreenBufferHandle,
@ConsoleScreenBufferInfo);
WindowLines:=ConsoleScreenBufferInfo.srWindow.Bottom-
ConsoleScreenBufferInfo.srWindow.Top;
BufferLines:= ConsoleScreenBufferInfo.dwSize.Y-1;
CanScroll:=(BufferLines>WindowLines);
end;
function TWin32Screen.Scroll(i : integer) : integer; function TWin32Screen.Scroll(i : integer) : integer;
var var
ConsoleScreenBufferInfo : Console_screen_buffer_info; ConsoleScreenBufferInfo : Console_screen_buffer_info;
@ -1305,7 +1327,7 @@ end;
****************************************************************************} ****************************************************************************}
{$ifdef OS2} {$ifdef OS2}
function TOS2Screen.GetWidth: integer; function TOS2Screen.GetWidth: integer;
begin begin
GetWidth:=80; GetWidth:=80;
@ -1322,19 +1344,19 @@ begin
Attr:=' '; Attr:=' ';
end; end;
procedure TOS2Screen.GetCursorPos(var P: TPoint); procedure TOS2Screen.GetCursorPos(var P: TPoint);
begin begin
P.X:=1; P.X:=1;
P.Y:=1; P.Y:=1;
end; end;
{ remember the initial video screen } { remember the initial video screen }
procedure TOS2Screen.Capture; procedure TOS2Screen.Capture;
begin begin
end; end;
{ restore the initial video mode } { restore the initial video mode }
procedure TOS2Screen.Restore; procedure TOS2Screen.Restore;
begin begin
end; end;
@ -1413,7 +1435,10 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.25 2002-10-12 19:41:30 hajny Revision 1.26 2002-10-30 22:07:11 pierre
* only handle direction keys specially if buffer is bigger than window
Revision 1.25 2002/10/12 19:41:30 hajny
* dummy OS/2 implementation to enable compilation * dummy OS/2 implementation to enable compilation
Revision 1.24 2002/10/07 15:43:15 pierre Revision 1.24 2002/10/07 15:43:15 pierre