home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of German Only 1
/
romside_best_of_german_only_1.iso
/
wissen
/
dos
/
wgraph
/
entpack.exe
/
WGDEMOQ!.EXE
/
GHELP.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-12-01
|
3KB
|
130 lines
(*****************************************************
* *
* WGRAPH V. 1.0 Kontextsensitives Hilfesystem *
* *
******************************************************
* *
* *
* (c) 1992 Dipl.Phys. Mathias Scholz *
* *
*****************************************************)
{$A+,B-,D-,E-,F+,I-,L-,N-,O+,R-,S-,V-}
UNIT GHelp;
INTERFACE
uses GDecl,
GDrivers,
GViews,
GDlg,
GText,
Graph;
type PHelpScroller=^THelpScroller;
THelpScroller=object(TScroller)
procedure CreateData(HelpDatei:string;HelpCtx:word);
procedure ScrollDraw; virtual;
end;
PHelpWindow=^THelpWindow;
THelpWindow=object(TWindow)
HelpIndex:word;
HelpDatei:string;
Scroller:PHelpScroller;
constructor Init(Datei:string;HI:word;var Bounds:TRect;ATitle:str80;AType:byte);
procedure InitWindowScroller; virtual;
destructor Done; virtual;
end;
IMPLEMENTATION
{Implementation THelpScroller}
procedure THelpScroller.CreateData(HelpDatei:string;HelpCTX:word);
var f:text;
KZ,zz:string;
LfdPtr:PLine;
begin
str(HelpCTX,KZ);
KZ:='##'+KZ;
assign(f,HelpDatei);
reset(f);
while not EOF(f) do
begin
readln(f,zz);
if zz=KZ then
while zz<>'END' do
begin
readln(f,zz);
LfdPtr:=new(PLine, Init);
LfdPtr^.Eintrag:=zz;
Liste^.InsertItem(LfdPtr);
end;
end;
SetLimit(75,Liste^.AnzElem-1,CharLength,CharHeight);
end;
procedure THelpScroller.ScrollDraw;
var i:integer;
LfdPtr:PGroup;
function clip(p,n:byte;z:string):string;
begin
clip:=copy(z,p,n);
end;
begin
Mouse.HideMouse;
with Border do
begin
SetFillStyle(SolidFill,GetPalColor(1));
SetColor(GetPalColor(2));
for i:=Delta.y to WDelta.y do
begin
LfdPtr:=Liste^.GetItems(i);
Bar(A.x,A.y+(i-Delta.y)*Py+10,B.x,A.y+(i-Delta.y)*Py+10+Py);
if Font<>VGAF then WriteText(A.x+20,A.y+(i-Delta.y)*Py+10,clip(Delta.x,Spalten*8 div 8-5,PLine(LfdPtr)^.Eintrag))
else OutTextXY(A.x+20,A.y+(i-Delta.y)*Py+10,clip(Delta.x,Spalten*8 div 8-5,PLine(LfdPtr)^.Eintrag));
end;
if VertiScrollBar<>nil then
for i:=(WDelta.y-Delta.y)+1 to Zeilen do
Bar(A.x,A.y+i*Py+10,B.x,A.y+i*Py+10+Py);
end;
Mouse.ShowMouse;
end;
{Implementation THelpWindow}
constructor THelpWindow.Init(Datei:string;HI:word;var Bounds:TRect;ATitle:str80;AType:byte);
begin
HelpIndex:=HI;
HelpDatei:=Datei;
TWindow.Init(Bounds,ATitle,AType);
end;
procedure THelpWindow.InitWindowScroller;
var R:TRect;
SBH1,SBV1:PScrollBar;
begin
R:=Frame^.Area;
SBH1:=new(PScrollBar, Init(R,HorizDir));
SBV1:=new(PScrollBar, Init(R,VertDir));
Scroller:=new(PHelpScroller, Init(R,SBH1,SBV1));
Scroller^.CreateData(HelpDatei,HelpIndex);
List^.InsertItem(Scroller);
end;
destructor THelpWindow.Done;
begin
TWindow.Done;
dispose(Scroller, Done);
end;
END.