home *** CD-ROM | disk | FTP | other *** search
- (***************************************
- * WG-VISION 1.0 DEMONSTRATION *
- ****************************************
- * *
- * Unit für das Demonstrationsprogramm *
- * *
- *--------------------------------------*
- * Achtung: Nur VGA ! *
- ****************************************
- * (c) 1993 Dipl.Phys. Mathias Scholz *
- ***************************************)
-
- {$I COMPILER.INC}
- {$F+,O+}
-
- UNIT DEMOLST;
-
- INTERFACE
-
- USES WDecl,
- WViews,
- WDlg,
- WDriver,
- WText,
- WEvent,
- WUtils,
- dos,
- graph;
-
- type PNewScroller=^TNewScroller;
-
- PScrollWindow=^TScrollWindow;
- TScrollWindow=object(TWindow)
- Scroller:PNewScroller;
- Nr:byte;
- constructor Init(Nummer:byte);
- procedure InitWindowScroller; virtual;
- destructor Done; virtual;
- end;
-
- TNewScroller=object(TScroller)
- procedure CreateData(DateiName:string);
- procedure ScrollDraw; virtual;
- end;
-
- PMemoryInfo=^TMemoryInfo;
- TMemoryInfo=object(TWindow)
- constructor Init;
- procedure InitBackground; virtual;
- end;
-
- PMemoryInfoBgrd=^TMemoryInfoBgrd;
- TMemoryInfoBgrd=object(TBackground)
- procedure Draw; virtual;
- end;
-
- PDateWindow=^TDateWindow;
- TDateWindow=object(TDlgWindow)
- constructor Init;
- procedure HandleEvent; virtual;
- procedure SetHelp;
- end;
-
- PHilfe=^THilfe;
- THilfe=object(TDlgWindow)
- constructor Init;
- end;
-
- tSetDateTime=record
- Schalter:string[5];
- Datum:string[10];
- Zeit:string[8]
- end;
-
- var DT : tSetDateTime;
-
- IMPLEMENTATION
-
- {Implementation TScrollWindow}
-
- constructor TScrollWindow.Init(Nummer:byte);
- var R:TRect;
- begin
- Nr:=Nummer;
- R.Assign(60,80,580,380);
- TWindow.Init(R,'Quelltext-Lister',winDouble+winPanel+winMenu+winKey);
- end;
-
- procedure TScrollWindow.InitWindowScroller;
- var R:TRect;
- i:byte;
- SBH1,SBV1:PScrollBar;
- begin
- R:=Frame^.Area;
- SBH1:=new(PScrollBar, Init(R,HorizDir));
- SBV1:=new(PScrollBar, Init(R,VertDir));
- Scroller:=new(PNewScroller, Init(R,SBH1,SBV1));
- if Nr=1 then Scroller^.CreateData(Event.InfoString);
- if Nr=2 then Scroller^.CreateData('DEMO.TXT');
- List^.InsertItem(Scroller);
- end;
-
- destructor TScrollWindow.Done;
- begin
- TWindow.Done;
- dispose(Scroller, Done);
- end;
-
- {Implementation TNewScroller}
-
- procedure TNewScroller.CreateData(DateiName:string);
- var f:text;
- LfdPtr:PLine;
- begin
- assign(f,DateiName);
- reset(f);
- while not EOF(f) do
- begin
- LfdPtr:=new(PLine, Init);
- readln(f,LfdPtr^.Eintrag);
- Liste^.InsertItem(LfdPtr);
- end;
- SetLimit(25,Liste^.AnzElem,8,19);
- end;
-
- procedure TNewScroller.ScrollDraw;
- var i:integer;
- LfdPtr:PGroup;
-
- function clip(p,n:byte;z:string):string;
- begin
- clip:=copy(z,p,n);
- end;
-
- begin
- SetFont(Sans19);
- 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);
- WriteText(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 TMemoryInfo}
-
- constructor TMemoryInfo.Init;
- var R:TRect;
- begin
- R.Assign(60,80,450,320);
- TWindow.Init(R,'Speicher-Ressourcen',winDouble+winPanel+winMenu);
- SetWindowAttrib(false);
- end;
-
- procedure TMemoryInfo.InitBackground;
- var R:TRect;
- begin
- R:=Frame^.Area;
- Bgrd:=new(PMemoryInfoBgrd, Init(R));
- List^.InsertItem(Bgrd);
- end;
-
- {Implementation TMemoryInfoBgrd}
-
- procedure TMemoryInfoBgrd.Draw;
- var z:string;
- EMS:PEMS;
- HD:PHardDisk;
- begin
- with Border do
- begin
- FillBar(A.x,A.y,B.x,B.y,Yellow,White,SolidFill);
- str(MemAvail:8,z);
- SetColor(Red);
- OutTextXY(A.x+10,A.y+25,'Hauptspeicher');
- OutTextXY(A.x+10,A.y+100,'Expanded Memory');
- OutTextXY(A.x+10,A.y+160,'Festplatte C');
- SetColor(Blue);
- OutTextXY(A.x+10,A.y+45,'freier RAM (Heap) : '+z+' Byte');
- str(MaxAvail:8,z);
- OutTextXY(A.x+10,A.y+65,'größter zusammenhängender');
- OutTextXY(A.x+10,A.y+75,'freier Speicherblock : '+z+' Byte');
- EMS:=new(PEMS, Init(Border));
- str(EMS^.FreeMemory:8,z);
- OutTextXY(A.x+10,A.y+120,'verfügbarer Speicher : '+z+' Byte');
- str(EMS^.FreeMemory div 16384:8,z);
- OutTextXY(A.x+10,A.y+140,'verfügbare Seiten : '+z+' Pages');
- dispose(EMS, Done);
- HD:=new(PHardDisk, Init(Border));
- str(HD^.FreeMemory:8,z);
- OutTextXY(A.x+10,A.y+180,'verfügbare Plattenkapazität : '+z+' Byte');
- dispose(HD, Done);
- end;
- end;
-
- {Implementation TDateWindow}
-
- constructor TDateWindow.Init;
- var RR:TRect; z:string;
- Jahr,Monat,Tag,Wochentag:word;
- Stunde,Minute,Sekunde,Sek100:word;
- begin
- RR.Assign((GetMaxX div 2)-150,140,(GetMaxX div 2)+150,300);
- TDlgWindow.Init(RR,'Datum & Uhrzeit',winDouble+winPanel+winMenu);
- SetInputLine(95,70,10,'~D~atum ',10,Ziffern-['-']);
- SetInputLine(95,105,8,'~U~hrzeit',8,Ziffern+[':']-['.','-']);
- SetPushButton(200,40,80,22,'OK',cmOK);
- SetPushButton(200,70,80,22,'~A~bbrechen',cmCloseWindow);
- SetPushButton(200,115,80,22,'~H~ilfe',90);
- with DT do
- begin
- Schalter:='LLTTT';
- Datum:=''; Zeit:='';
- GetDate(Jahr,Monat,Tag,Wochentag);
- str(Tag:2,z);
- Datum:=Datum+z+'.';
- str(Monat:2,z);
- Datum:=Datum+z+'.';
- str(Jahr:4,z);
- Datum:=Datum+z;
- GetTime(Stunde,Minute,Sekunde,Sek100);
- str(Stunde:2,z);
- Zeit:=Zeit+z+':';
- str(Minute:2,z);
- Zeit:=Zeit+z+':';
- str(Sekunde:2,z);
- Zeit:=Zeit+z;
- end;
- SetData(DT);
- end;
-
- procedure TDateWindow.HandleEvent;
- begin
- TDlgWindow.HandleEvent;
- if Event.Command=90 then SetHelp;
- if Event.Command=cmOK then
- begin
- with DT do
- begin
-
- {und hier kommen die Routinen zum Setzen des neuen
- Datums und der neuen Uhrzeit hinein. Dazu müssen Sie
- die Strings Datum und Uhrzeit zerpflücken und die
- in das word-Format umgewandelten Teilstrings den
- Routinen SetDate und SetTime übergeben}
-
- end;
- Event.Command:=cmCloseWindow;
- end;
- end;
-
- procedure TDateWindow.SetHelp;
- var HelpWindow:PHilfe;
- begin
- HelpWindow:=new(PHilfe, Init);
- FrameDeaktivated:=true;
- DrawNewFrame;
- HelpWindow^.Draw;
- InsertChildWindow(HelpWindow);
- end;
-
- {Implementation THilfe}
-
- constructor THilfe.Init;
- var RR:TRect;
- begin
- RR.Assign((GetMaxX div 2)-100,180,(GetMaxX div 2)+200,340);
- TDlgWindow.Init(RR,'Hilfe',winDouble+winPanel);
- SetStaticText(150,45,'Einstellen von',CenterText);
- SetStaticText(150,75,'Datum und Uhrzeit',CenterText);
- SetPushButton(110,130,80,22,'OK',cmCloseWindow);
- end;
-
-
- END.