home *** CD-ROM | disk | FTP | other *** search
- {*******************************************************}
- { }
- { PC-X User Application for Turbo Vision }
- { Copyright (c) 1997 By PC-X User and Bérczi László }
- { }
- { Portions Copyright (c) 1990 by Borland Int. }
- {*******************************************************}
- {Last Edit: 1997 II 15. 21:00}
- {$X+,V-,F+,O-,S+,Q-}
-
- {Lásd a file végét a szerzô megállapodás véget ! - Licens agreements.}
-
- unit PCX_App;
-
- INTERFACE
- uses App, Views, Dialogs, PCX_Dlg, Objects;
-
- const
-
- CPCXColor =
- #$8F#$70#$78#$74#$20#$28#$24#$17#$1F#$1A#$31#$31#$1E#$71#$1F + { 1- 15}
- #$37#$3F#$3A#$13#$13#$3E#$21#$3F#$70#$7F#$7A#$13#$13#$70#$7F#$7E + { 16- 31}
- #$70#$7F#$7A#$13#$13#$70#$70#$7F#$7E#$20#$2B#$2F#$78#$2E#$70#$30 + { 32- 47}
- #$3F#$3E#$1F#$2F#$1A#$20#$72#$31#$31#$30#$2F#$3E#$31#$13#$38#$00 + { 48- 63}
- {CPCXBlueDialog}
- #$97#$9F#$F0#$70#$F0#$90#$90#$9F#$9E#$20#$2B#$2F#$78#$2E#$90#$30 + { 64- 79}
- #$3F#$3E#$1F#$2F#$7A#$20#$92#$39#$39#$9F#$0F#$9E#$90#$93#$38#$00 + { 80- 95}
- #$F7#$F0#$F2#$F0#$9E+ {PTitle+ATitle+DTitle+Icon+Drag} { 96-100}
- {CPCXRedDialog}
- #$47#$4F#$F0#$70#$F0#$4E#$47#$4F#$4E#$20#$2B#$2F#$78#$2E#$40#$30 + {101-116}
- #$3F#$3E#$70#$2F#$7A#$20#$42#$34#$34#$30#$2F#$3E#$34#$43#$38#$00 + {117-132}
- #$F7#$F0#$F2#$F0#$4E+ {PTitle+ATitle+DTitle+Icon+Drag} {133-137}
- {CPCXGrayDialog}
- #$70#$7F#$7A#$70#$F0#$70#$70#$7F#$7E#$20#$2B#$2F#$78#$2E#$70#$30 + {138-153}
- #$3F#$3E#$1F#$2F#$1A#$20#$72#$31#$31#$30#$2F#$3E#$31#$13#$38#$00 + {154-169}
- #$F7#$F0#$F2#$F0#$7E+ {PTitle+ATitle+DTitle+Icon+Drag} {180-174}
- { TPCXTitleBar }
- #$1F; {175}
-
- CPCXBlackWhite =
- #$8F#$70#$78#$74#$20#$28#$24#$17#$1F#$1A#$31#$31#$1E#$71#$1F + { 1- 15}
- #$37#$3F#$3A#$13#$13#$3E#$21#$3F#$70#$7F#$7A#$13#$13#$70#$7F#$7E + { 16- 31}
- #$70#$7F#$7A#$13#$13#$70#$70#$7F#$7E#$20#$2B#$2F#$78#$2E#$70#$30 + { 32- 47}
- #$3F#$3E#$1F#$2F#$1A#$20#$72#$31#$31#$30#$2F#$3E#$31#$13#$38#$00 + { 48- 63}
- {CPCXBlueDialog}
- #$97#$9F#$F0#$70#$F0#$90#$90#$9F#$9E#$20#$2B#$2F#$78#$2E#$90#$30 + { 64- 79}
- #$3F#$3E#$1F#$2F#$7A#$20#$92#$39#$39#$9F#$0F#$9E#$90#$93#$38#$00 + { 80- 95}
- #$F7#$F0#$F2#$F0#$9E+ {PTitle+ATitle+DTitle+Icon+Drag} { 96-100}
- {CPCXRedDialog}
- #$47#$4F#$F0#$70#$F0#$4E#$47#$4F#$4E#$20#$2B#$2F#$78#$2E#$40#$30 + {101-116}
- #$3F#$3E#$70#$2F#$7A#$20#$42#$34#$34#$30#$2F#$3E#$34#$43#$38#$00 + {117-132}
- #$F7#$F0#$F2#$F0#$4E+ {PTitle+ATitle+DTitle+Icon+Drag} {133-137}
- {CPCXGrayDialog}
- #$70#$7F#$7A#$70#$F0#$70#$70#$7F#$7E#$20#$2B#$2F#$78#$2E#$70#$30 + {138-153}
- #$3F#$3E#$1F#$2F#$1A#$20#$72#$31#$31#$30#$2F#$3E#$31#$13#$38#$00 + {154-169}
- #$F7#$F0#$F2#$F0#$7E+ {PTitle+ATitle+DTitle+Icon+Drag} {180-174}
- { TPCXTitleBar }
- #$1F; {175}
-
- CPCXMonochrome =
- #$8F#$70#$78#$74#$20#$28#$24#$17#$1F#$1A#$31#$31#$1E#$71#$1F + { 1- 15}
- #$37#$3F#$3A#$13#$13#$3E#$21#$3F#$70#$7F#$7A#$13#$13#$70#$7F#$7E + { 16- 31}
- #$70#$7F#$7A#$13#$13#$70#$70#$7F#$7E#$20#$2B#$2F#$78#$2E#$70#$30 + { 32- 47}
- #$3F#$3E#$1F#$2F#$1A#$20#$72#$31#$31#$30#$2F#$3E#$31#$13#$38#$00 + { 48- 63}
- {CPCXBlueDialog}
- #$97#$9F#$F0#$70#$F0#$90#$90#$9F#$9E#$20#$2B#$2F#$78#$2E#$90#$30 + { 64- 79}
- #$3F#$3E#$1F#$2F#$7A#$20#$92#$39#$39#$9F#$0F#$9E#$90#$93#$38#$00 + { 80- 95}
- #$F7#$F0#$F2#$F0#$9E+ {PTitle+ATitle+DTitle+Icon+Drag} { 96-100}
- {CPCXRedDialog}
- #$47#$4F#$F0#$70#$F0#$4E#$47#$4F#$4E#$20#$2B#$2F#$78#$2E#$40#$30 + {101-116}
- #$3F#$3E#$70#$2F#$7A#$20#$42#$34#$34#$30#$2F#$3E#$34#$43#$38#$00 + {117-132}
- #$F7#$F0#$F2#$F0#$4E+ {PTitle+ATitle+DTitle+Icon+Drag} {133-137}
- {CPCXGrayDialog}
- #$70#$7F#$7A#$70#$F0#$70#$70#$7F#$7E#$20#$2B#$2F#$78#$2E#$70#$30 + {138-153}
- #$3F#$3E#$1F#$2F#$1A#$20#$72#$31#$31#$30#$2F#$3E#$31#$13#$38#$00 + {154-169}
- #$F7#$F0#$F2#$F0#$7E+ {PTitle+ATitle+DTitle+Icon+Drag} {180-174}
- { TPCXTitleBar }
- #$1F; {175}
-
-
- type
-
- PPCXApplication = ^TPCXApplication;
- TPCXApplication = Object(TApplication)
- public
- ApplicationName,
- ApplicationVersion,
- UserName,
- UserCorporation : String[100];
- constructor Init(AppName, AppVer, UName, UCorp: String);
- destructor Done; virtual;
- procedure DosShell; virtual;
- procedure Draw; virtual;
- procedure InitDeskTop; virtual;
- function GetPalette: PPalette; virtual;
- procedure GetMenuBarExtent(var R: TRect);
- private
- { IntroBox : PPCXRedStatusBox;}
- ControlBoxApp: PPCXControlBoxApp;
- { Clock : PPCXClockView;
- Heap : PPCXHeapView;}
- HaveWeMouse{,
- TempBoolean} : Boolean;
- { procedure Sysinfo;}
- end;
-
- PPCXBackGround = ^TPCXBackGround;
- TPCXBackGround = Object(TBackGround)
- function GetPalette: PPalette; virtual;
- end;
-
- PPCXDeskTop = ^TPCXDeskTop;
- TPCXDeskTop = Object(TDeskTop)
- procedure InitBackGround; virtual;
- end;
-
- PPCXTitleBar = ^TPCXTitleBar;
- TPCXTitleBar = Object(TStaticText)
- constructor Init(AText: String);
- function GetPalette: PPalette; virtual;
- procedure SetTitleText(AText: String);
- end;
-
- const
-
- {PCX_App unit consts}
- IsMonoPalette: Boolean = False;
- NeedClockView: Boolean = True;
- NeedHeapView : Boolean = False;
- PCXTitlebar : PPCXTitleBar = nil;
-
- IMPLEMENTATION
- uses PCX_Util, Drivers, Memory, DOS;
-
- var
- TempScreen: TScreen; {To save screen's text }
- X, Y : Byte; {To keep cursor's position}
-
- {TPCXApplication}
- constructor TPCXApplication.Init(AppName, AppVer, UName, UCorp: String);
- var
- P: TPCXPoint;
- R: TRect;
- begin
- GetScreen(TempScreen);
-
- Inherited Init;
- IsMonoPalette:=(GetPrimaryAdapterType in[$05, $07, $0B, $FF, $22, $E8]) or SearchForParameter('/MONO');
-
- if Not IsMonoPalette then SetBackGroundIntensity(True);
-
- HaveWeMouse:=MouseEvents;
- ApplicationName :=AppName;
- ApplicationVersion:=AppVer;
- UserName :=UName;
- UserCorporation :=UCorp;
-
- New(PCXTitlebar, Init(#3+ApplicationName));
- Insert(PCXTitlebar);
- P.Assign(0,0);
- New(ControlBoxApp, Init(P));
- Insert(ControlBoxApp);
- { if NeedClockView then
- begin
- GetExtent(R);
- R.A.X := R.B.X - 9; R.B.Y := R.A.Y + 1;
- New(Clock, Init(R));
- Insert(Clock);
- end;
- if NeedHeapView then
- begin
- GetExtent(R);
- Dec(R.B.X);
- R.A.X := R.B.X - 9; R.A.Y := R.B.Y - 1;
- New(Heap, Init(R));
- Insert(Heap);
- end;}
-
- end;
-
- destructor TPCXApplication.Done;
- begin
- Inherited Done;
- if Not IsMonoPalette then SetBackGroundIntensity(False);
- PutScreen(TempScreen);
- end;
-
- procedure TPCXApplication.DosShell;
- begin
- DoneSysError;
- DoneEvents;
- DoneVideo;
- DoneDosMem;
- PutScreen(TempScreen);
- SetXY(X, Y);
- if IsPCXGraphCharsOn then PutSavedChars;
- WriteShellMsg;
- SwapVectors;
- Exec(GetEnv('COMSPEC'), '');
- SwapVectors;
- InitDosMem;
- GetScreen(TempScreen);
- GetXY(X, Y);
- if IsPCXGraphCharsOn then
- begin
- GetSaveableChars;
- SetPCXGraphChars(True);
- end;
- InitVideo;
- InitEvents;
- InitSysError;
- Redraw;
- end;
-
- procedure TPCXApplication.InitDeskTop;
- var R: TRect;
- begin
- GetExtent(R);
- Inc(R.A.Y); Dec(R.B.Y);
- DeskTop:=New(PPCXDeskTop, Init(R));
- end;
-
- procedure TPCXApplication.Draw;
- begin
- Inherited Draw;
- Message(@Self, evCommand, cmMouseChanged, @Self);
- end;
-
- function TPCXApplication.GetPalette: PPalette;
- const
- PA: Array[apColor..apMonochrome] of String[Length(CPCXColor)] =
- (CPCXColor, CPCXBlackWhite, CPCXMonochrome);
- begin
- if IsMonoPalette then GetPalette := @PA[apBlackWhite]
- else GetPalette := @PA[AppPalette];
- end;
-
- procedure TPCXApplication.GetMenuBarExtent(var R: TRect);
- begin
- GetExtent(R);
- Inc(R.A.Y);
- R.B.Y := R.A.Y + 1;
- end;
-
-
- {TPCXBackGround}
- function TPCXBackGround.GetPalette;
- const P: String[Length(CBackground)] = CBackground;
- begin
- GetPalette := @P;
- end;
-
- {TPCXDeskTop}
- procedure TPCXDeskTop.InitBackGround;
- var R: TRect;
- begin
- GetExtent(R);
- BackGround:=New(PBackground, Init(R, #32));
- end;
-
- {TPCXTitleBar}
- constructor TPCXTitleBar.Init(AText: String);
- var R: TRect;
- begin
- R.A.Y:= 0;
- R.B.Y:= R.A.Y + 1;
- R.A.X:= 0;
- R.B.X:= Application^.Size.X;
- Inherited Init(R, AText);
- end;
-
- function TPCXTitleBar.GetPalette: PPalette;
- const
- P: String[Length(CPCXTitleBar)] = CPCXTitleBar;
- begin
- GetPalette := @P;
- end;
-
- procedure TPCXTitleBar.SetTitleText(AText: String);
- begin
- if Text <> nil then Dispose(Text);
- if AText = '' then Text:=nil
- else Text:=NewStr(^C+AText);
- DrawView;
-
- end;
-
- var
- OldExitProc: Pointer;
-
- procedure PCXExitProc; far;
- begin
- if IsPCXGraphCharsOn then PutSavedChars;
- if IsBackGroundIntensityOn then SetBackGroundIntensity(False);
- SetXY(X, Y);
- ExitProc:=OldExitProc;
- end;
-
-
- BEGIN
- GetXY(X, Y);
- GetSaveableChars;
- OldExitProc:=ExitProc;
- ExitProc:=@PCXExitProc;
- END.
- {*********************************************************}
- { }
- { A unit forráskódja az IDG - PC-X szerkesztôségének, }
- { és Bérczi László-nak a tulajdona. }
- { A forráskód a kereskedelmi célokat kivéve szabadon }
- { terjeszthetô ! }
- { }
- { PC-X User (c) 1997, április }
- {*********************************************************}