mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 19:08:15 +02:00
* Video and keyboard initialization spaghetti organized and hopefully fixed.
- Remove useless function from validate.pas git-svn-id: trunk@3443 -
This commit is contained in:
parent
79b8d66212
commit
dc6e856dda
26
fv/app.pas
26
fv/app.pas
@ -230,7 +230,7 @@ TYPE
|
||||
PROCEDURE Run; Virtual;
|
||||
PROCEDURE Idle; Virtual;
|
||||
PROCEDURE InitScreen; Virtual;
|
||||
procedure DoneScreen; virtual;
|
||||
{ procedure DoneScreen; virtual;}
|
||||
PROCEDURE InitDeskTop; Virtual;
|
||||
PROCEDURE OutOfMemory; Virtual;
|
||||
PROCEDURE InitMenuBar; Virtual;
|
||||
@ -789,11 +789,15 @@ END;
|
||||
{ InitScreen -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB }
|
||||
{---------------------------------------------------------------------------}
|
||||
PROCEDURE TProgram.InitScreen;
|
||||
|
||||
{Initscreen is passive only, i.e. it detects the video size and capabilities
|
||||
after initalization. Active video initalization is the task of Tapplication.}
|
||||
|
||||
BEGIN
|
||||
{ the orginal code can't be used here because of the limited
|
||||
video unit capabilities, the mono modus can't be handled
|
||||
}
|
||||
Drivers.InitVideo;
|
||||
{ Drivers.InitVideo;}
|
||||
if (ScreenMode.Col div ScreenMode.Row<2) then
|
||||
ShadowSize.X := 1
|
||||
else
|
||||
@ -809,11 +813,11 @@ BEGIN
|
||||
END;
|
||||
|
||||
|
||||
procedure TProgram.DoneScreen;
|
||||
{procedure TProgram.DoneScreen;
|
||||
begin
|
||||
Drivers.DoneVideo;
|
||||
Buffer:=nil;
|
||||
end;
|
||||
end;}
|
||||
|
||||
|
||||
{--TProgram-----------------------------------------------------------------}
|
||||
@ -965,14 +969,15 @@ END;
|
||||
{---------------------------------------------------------------------------}
|
||||
CONSTRUCTOR TApplication.Init;
|
||||
BEGIN
|
||||
{ InitMemory;} { Start memory up }
|
||||
{ InitMemory;} { Start memory up }
|
||||
initkeyboard;
|
||||
Drivers.InitVideo; { Start video up }
|
||||
Drivers.InitEvents; { Start event drive }
|
||||
Drivers.InitSysError; { Start system error }
|
||||
InitHistory; { Start history up }
|
||||
InitHistory; { Start history up }
|
||||
InitResource;
|
||||
InitMsgBox;
|
||||
Inherited Init; { Call ancestor }
|
||||
Inherited Init; { Call ancestor }
|
||||
{ init mouse and cursor }
|
||||
Video.SetCursorType(crHidden);
|
||||
Mouse.SetMouseXY(1,1);
|
||||
@ -988,8 +993,9 @@ BEGIN
|
||||
DoneResource;
|
||||
Drivers.DoneSysError; { Close system error }
|
||||
Drivers.DoneEvents; { Close event drive }
|
||||
DoneScreen;
|
||||
drivers.donevideo;
|
||||
{ DoneMemory;} { Close memory }
|
||||
donekeyboard;
|
||||
END;
|
||||
|
||||
{--TApplication-------------------------------------------------------------}
|
||||
@ -1019,14 +1025,14 @@ PROCEDURE TApplication.DosShell;
|
||||
BEGIN { Compatability only }
|
||||
DoneSysError;
|
||||
DoneEvents;
|
||||
DoneScreen;
|
||||
drivers.donevideo;
|
||||
{ DoneDosMem;}
|
||||
WriteShellMsg;
|
||||
SwapVectors;
|
||||
Exec(GetEnv('COMSPEC'), '');
|
||||
SwapVectors;
|
||||
{ InitDosMem;}
|
||||
InitScreen;
|
||||
drivers.initvideo;
|
||||
InitEvents;
|
||||
InitSysError;
|
||||
Redraw;
|
||||
|
@ -57,6 +57,10 @@ UNIT Drivers;
|
||||
{$DEFINE ENDIAN_BIG}
|
||||
{$endif CPU68K}
|
||||
|
||||
{$ifdef FPC}
|
||||
{$INLINE ON}
|
||||
{$endif}
|
||||
|
||||
USES
|
||||
{$IFDEF OS_WINDOWS} { WIN/NT CODE }
|
||||
Windows, { Standard unit }
|
||||
@ -464,6 +468,21 @@ PROCEDURE DoneEvents;
|
||||
{ VIDEO CONTROL ROUTINES }
|
||||
{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
|
||||
|
||||
{-Initkeyboard-------------------------------------------------------
|
||||
Initializes the keyboard. Before it is called read(ln)/write(ln)
|
||||
are functional, after it is called FV's keyboard routines are
|
||||
functional.
|
||||
---------------------------------------------------------------------}
|
||||
|
||||
procedure initkeyboard;
|
||||
|
||||
{-Donekeyboard-------------------------------------------------------
|
||||
Restores keyboard to original state. FV's keyboard routines may not
|
||||
be used after a call to this. Read(ln)/write(ln) can be used again.
|
||||
---------------------------------------------------------------------}
|
||||
|
||||
procedure donekeyboard;
|
||||
|
||||
{-InitVideo---------------------------------------------------------
|
||||
Initializes the video manager, Saves the current screen mode in
|
||||
StartupMode, and switches to the mode indicated by ScreenMode.
|
||||
@ -830,7 +849,7 @@ PROCEDURE ExitDrivers; {$IFNDEF PPC_FPC}{$IFNDEF OS_UNIX} FAR; {$ENDIF}{$ENDIF}
|
||||
BEGIN
|
||||
DoneSysError; { Relase error trap }
|
||||
DoneEvents; { Close event driver }
|
||||
DoneKeyboard;
|
||||
{ DoneKeyboard;}
|
||||
DoneVideo;
|
||||
ExitProc := SaveExit; { Restore old exit }
|
||||
END;
|
||||
@ -1260,6 +1279,26 @@ END;
|
||||
const
|
||||
VideoInitialized : boolean = false;
|
||||
|
||||
{---------------------------------------------------------------------------}
|
||||
{ InitKeyboard -> Platforms ALL - 07Nov06 DM }
|
||||
{---------------------------------------------------------------------------}
|
||||
|
||||
procedure initkeyboard;inline;
|
||||
|
||||
begin
|
||||
keyboard.initkeyboard;
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------}
|
||||
{ DoneKeyboard -> Platforms ALL - 07Nov06 DM }
|
||||
{---------------------------------------------------------------------------}
|
||||
|
||||
procedure donekeyboard;inline;
|
||||
|
||||
begin
|
||||
keyboard.donekeyboard;
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------}
|
||||
{ InitVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Nov99 LdB }
|
||||
{---------------------------------------------------------------------------}
|
||||
@ -1521,7 +1560,7 @@ END;
|
||||
BEGIN
|
||||
ButtonCount := DetectMouse; { Detect mouse }
|
||||
DetectVideo; { Detect video }
|
||||
InitKeyboard;
|
||||
{ InitKeyboard;}
|
||||
InitSystemMsg;
|
||||
{$ifdef win32}
|
||||
SetFileApisToOEM;
|
||||
|
@ -302,15 +302,6 @@ USES MsgBox; { GFV standard unit }
|
||||
{ PRIVATE ROUTINES }
|
||||
{***************************************************************************}
|
||||
|
||||
{---------------------------------------------------------------------------}
|
||||
{ IsNumber -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 18May98 LdB }
|
||||
{---------------------------------------------------------------------------}
|
||||
FUNCTION IsNumber (Chr: Char): Boolean;
|
||||
BEGIN
|
||||
If (Chr >= '0') AND (Chr <= '9') Then { Check if '0..9' }
|
||||
IsNumber := True Else IsNumber := False; { Return result }
|
||||
END;
|
||||
|
||||
{---------------------------------------------------------------------------}
|
||||
{ IsLetter -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 18May98 LdB }
|
||||
{---------------------------------------------------------------------------}
|
||||
@ -520,7 +511,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
|
||||
';': Inc(I); { Next character }
|
||||
'*': Begin
|
||||
Inc(I); { Next character }
|
||||
While IsNumber(Pic^[I]) Do Inc(I); { Search for text }
|
||||
While Pic^[I] in ['0'..'9'] Do Inc(I); { Search for text }
|
||||
ToGroupEnd(I); { Move to group end }
|
||||
Continue; { Now continue }
|
||||
End;
|
||||
@ -554,7 +545,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
|
||||
Itr := 0; { Zero iteration }
|
||||
Iteration := prError; { Preset error result }
|
||||
Inc(I); { Skip '*' character }
|
||||
While (IsNumber(Pic^[I])) Do Begin { Entry is a number }
|
||||
While Pic^[I] in ['0'..'9'] Do Begin { Entry is a number }
|
||||
Itr := Itr * 10 + Byte(Pic^[I]) - Byte('0'); { Convert to number }
|
||||
Inc(I); { Next character }
|
||||
End;
|
||||
@ -606,7 +597,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
|
||||
While True Do
|
||||
Case Pic^[J] Of
|
||||
'[': ToGroupEnd(J); { Find name end }
|
||||
'*': If (IsNumber(Pic^[J + 1]) = False)
|
||||
'*': If not(Pic^[J + 1] in ['0'..'9'])
|
||||
Then Begin
|
||||
Inc(J); { Next name }
|
||||
ToGroupEnd(J); { Find name end }
|
||||
@ -631,7 +622,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
|
||||
End;
|
||||
Ch := Input[J]; { Fetch character }
|
||||
Case Pic^[I] of
|
||||
'#': If (NOT IsNumber(Ch)) Then Exit { Check is a number }
|
||||
'#': If NOT (Ch in ['0'..'9']) Then Exit { Check is a number }
|
||||
Else Consume(Ch); { Transfer number }
|
||||
'?': If (NOT IsLetter(Ch)) Then Exit { Check is a letter }
|
||||
Else Consume(Ch); { Transfer character }
|
||||
|
22
ide/fp.pas
22
ide/fp.pas
@ -284,6 +284,16 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{The square bullet needs an MS-DOS code page. On Unix it is for sure the code
|
||||
page is not available before video is initialized. (And only in certain
|
||||
circumstances after that, so, use a plain ascii character as bullet on Unix.)}
|
||||
|
||||
{$ifdef unix}
|
||||
const bullet='*';
|
||||
{$else}
|
||||
const bullet='þ';
|
||||
{$endif}
|
||||
|
||||
BEGIN
|
||||
{$IFDEF HasSignal}
|
||||
EnableCatchSignals;
|
||||
@ -294,12 +304,12 @@ BEGIN
|
||||
HistorySize:=16384;
|
||||
|
||||
{ Startup info }
|
||||
writeln('þ Free Pascal IDE Version '+VersionStr+' ['+{$i %date%}+']');
|
||||
writeln('þ Compiler Version '+Version_String);
|
||||
writeln(bullet+' Free Pascal IDE Version '+VersionStr+' ['+{$i %date%}+']');
|
||||
writeln(bullet+' Compiler Version '+Version_String);
|
||||
{$ifndef NODEBUG}
|
||||
writeln('þ GBD Version '+GDBVersion);
|
||||
writeln(bullet+' GBD Version '+GDBVersion);
|
||||
{$ifdef Windows}
|
||||
writeln('þ Cygwin "',GetCygwinFullName,'" version ',GetCygwinVersionString);
|
||||
writeln(bullet+' Cygwin "',GetCygwinFullName,'" version ',GetCygwinVersionString);
|
||||
CheckCygwinVersion;
|
||||
{$endif Windows}
|
||||
{$endif NODEBUG}
|
||||
@ -480,8 +490,8 @@ BEGIN
|
||||
{$ifdef unix}
|
||||
Video.ClearScreen;
|
||||
{$endif unix}
|
||||
Video.DoneVideo;
|
||||
Keyboard.DoneKeyboard;
|
||||
{ Video.DoneVideo;
|
||||
Keyboard.DoneKeyboard;}
|
||||
{$endif fpc}
|
||||
{$ifdef VESA}
|
||||
DoneVESAScreenModes;
|
||||
|
@ -879,7 +879,7 @@ begin
|
||||
{ DoneKeyboard should be called last to
|
||||
restore the keyboard correctly PM }
|
||||
{$ifndef go32v2}
|
||||
DoneScreen;
|
||||
donevideo;
|
||||
{$endif ndef go32v2}
|
||||
DoneKeyboard;
|
||||
If UseMouse then
|
||||
@ -904,7 +904,7 @@ begin
|
||||
else
|
||||
ButtonCount:=0;
|
||||
{$ifndef go32v2}
|
||||
InitScreen;
|
||||
initvideo;
|
||||
{$endif ndef go32v2}
|
||||
{$ifdef Windows}
|
||||
{ write the empty screen to dummy console handle }
|
||||
|
Loading…
Reference in New Issue
Block a user