home *** CD-ROM | disk | FTP | other *** search
- {$F+}
- (************************************************************
- * *
- * DEMONSTRATIONSPROGRAMM für die Klassenbibliothek WGRAPH *
- * *
- * Folgende Units liegen als Quelltexte in der *
- * selbstextrahierenden Datei WGDEMOQT.EXE *
- * bei *
- * *
- * GCLOCK/GINFO/GQUELL/GMINIDB/GDIAG/GPAINT/GFILEDLG *
- * *
- ************************************************************)
-
- program WGDEMO;
-
- uses Overlay,
- GDecl,
- GEvent,
- GViews,
- GDlg,
- GApp,
- GPCX,
- GClock,
- GInfo,
- GQuell,
- GMiniDB,
- GDiag,
- GPaint,
- GFileDlg,
- Graph;
-
- {$O GPCX}
- {$O GClock}
- {$O GInfo}
- {$O GQuell}
- {$O GMiniDB}
- {$O GDiag}
- {$O GPaint}
- {$O GFileDlg}
-
- const cmOwn = 101;
- cmList = 102;
- cmMemory = 103;
- cmUhr = 104;
-
- cmDPrinter = 201;
- cmVektor = 202;
- cmListBox = 203;
- cmTools = 204;
- cmMaus = 205;
- cmJoyStick = 206;
-
- cmErfassen = 301;
- cmAnzeigen = 302;
-
- cmDia1 = 401;
- cmFarn = 402;
- cmPaint = 403;
-
- cmNoFunction = 99;
-
- msgSetClock = 1; {Digitaluhr neu setzen}
-
- type TApplication=object(TApp)
- procedure SetDesktopFrame(Titel:string); virtual;
- procedure SetDesktopBackground; virtual;
- procedure InitMenuBar; virtual;
- procedure HandleEvent; virtual;
- procedure SetDialogData; virtual;
- procedure SpeicherStatus;
- procedure DigitalUhr;
- procedure Lister(Nummer:byte);
- procedure DruckerDialog;
- procedure VektorZeichensaetze;
- procedure AdressDB(DInput:boolean);
- procedure KuchenDiagramm;
- procedure FarnBlatt;
- procedure Paint;
- procedure InputDialog(FType:str12);
- procedure BildSpeichern;
- procedure ToolBar;
- procedure MausDemo;
- procedure JoystickDemo;
- end;
-
- PNewDTBgrd=^TNewDTBgrd;
- TNewDTBgrd=object(TDsktpBgrd)
- BgImage:TPCXImage;
- procedure Draw;virtual;
- end;
-
- tPDlgData=record
- Schalter:string[19]; {DruckerDialog}
- end;
-
-
- var MyProg:TApplication;
- PrintDialogData:tPDlgData;
-
- {Implementation TApplication}
-
- procedure TApplication.SetDesktopFrame(Titel:string);
- var R:TRect;
- begin
- with Desktop^ do
- begin
- GetBounds(R);
- Frame:=new(PFrame, Init(R,R,Titel,winDouble+winPanel+winMenu));
- Frame^.Palette:=Palette1;
- List^.InsertItem(Frame);
- end;
- end;
-
- procedure TApplication.SetDesktopBackground;
- var R:TRect;
- NBgrd:PNewDTBgrd;
- begin
- with Desktop^ do
- begin
- R:=Frame^.Area;
- NBgrd:=new(PNewDTBgrd, Init(R));
- NBgrd^.Palette[7]:=#14;
- NBgrd^.Palette[8]:=#11;
- List^.InsertItem(NBgrd);
- end;
- end;
-
- procedure TApplication.InitMenuBar;
- begin
- Palette[1]:=#14;
- Palette[5]:=#14;
- Palette[4]:=#4;
- Palette[12]:=#4;
- MainMenu('~F~enster',0);
- SubMenu('~I~n eigener Sache ...',cmOwn,0,0,false,false);
- SubMenu('~Q~uelltext-Lister',cmList,0,0,false,false);
- SubMenu('~S~peicher-Ressourcen',cmMemory,0,0,false,false);
- SubMenu('~D~igitaluhr',cmUhr,0,0,false,false);
- NewLine;
- SubMenu('E~x~it Alt-X',cmCloseApplication,0,altX,false,false);
- MainMenu('~D~ialogfenster',0);
- SubMenu('~D~ruckerdialog',cmDPrinter,0,0,false,false);
- SubMenu('~V~ektorzeichensätze',cmVektor,0,0,false,false);
- SubMenu('~L~istbox',cmListBox,0,0,false,false);
- SubMenu('~T~oolbar',cmTools,0,0,false,false);
- NewLine;
- SubMenu('~M~ausdemo',cmMaus,0,0,false,false);
- SubMenu('~J~oystickdemo',cmJoyStick,0,0,false,false);
- MainMenu('~A~dressen',0);
- SubMenu('~E~rfassen F2',cmErfassen,0,kbF2,false,false);
- SubMenu('~A~nzeigen F3',cmAnzeigen,0,kbF3,false,false);
- MainMenu('~G~rafik',0);
- SubMenu('~K~uchendiagramm',cmDia1,0,0,false,false);
- SubMenu('~F~arnblatt',cmFarn,0,0,false,false);
- SubMenu('~M~alen',cmPaint,0,0,false,false);
- end;
-
- procedure TApplication.HandleEvent;
- begin
- Heap^.ShowHeapStatus(523,8,White);
- TProgram.HandleEvent;
- case Event.Command of
- cmOwn : Lister(1);
- cmList : Lister(2);
- cmMemory : SpeicherStatus;
- cmUhr : DigitalUhr;
- cmDPrinter : DruckerDialog;
- cmVektor : VektorZeichensaetze;
- cmTools : ToolBar;
- cmListBox : InputDialog('*.*');
- cmMaus : MausDemo;
- cmJoyStick : JoystickDemo;
- cmErfassen : AdressDB(true);
- cmAnzeigen : AdressDB(false);
- cmDia1 : Kuchendiagramm;
- cmFarn : FarnBlatt;
- cmPaint : Paint;
- cmPLoad : InputDialog('*.pcx');
- cmPSave : BildSpeichern;
- cmNoFunction : MessageBox(1,'Bsp.: Messagebox','Keine Funktion#implementiert');
- end; {case}
- end;
-
- procedure TApplication.SetDialogData;
- begin
- with PrintDialogData do Schalter:='TTGRrrrrGrRrCGcccS';
- with Adresse do
- begin
- Schalter:='TTTTLLLLS';
- FillChar(Firma,SizeOf(Firma),' ');
- FillChar(Ort,SizeOf(Ort),' ');
- FillChar(Strasse,SizeOf(Strasse),' ');
- FillChar(Telefon,SizeOf(Telefon),' ');
- end;
- with DlgData do
- begin
- Schalter:='LBTTS';
- FillChar(DateiName,SizeOf(DateiName),' ');
- DateiName[0]:=#32;
- FillChar(Datei,SizeOf(Datei),' ');
- Datei[0]:=#12;
- end;
- with ImgData do
- begin
- Schalter:='LTTS';
- FillChar(DateiName,SizeOf(DateiName),' ');
- DateiName[0]:=#32;
- end;
- with MausData do Schalter:='TGRrrrrrrrrrTTTTTTT';
- end;
-
- procedure TApplication.SpeicherStatus;
- var R:TRect;
- Window:PMemoryInfo;
- begin
- R.Assign(60,80,450,320);
- Window:=new(PMemoryInfo, Init(R,'Speicher-Ressourcen',winDouble+winPanel+winMenu));
- Window^.SetWindowAttrib(false);
- InsertDesktop(Window);
- end;
-
- procedure TApplication.DigitalUhr;
- var R:TRect;
- Window:PDigitalUhr;
- begin
- R.Assign(360,80,550,185);
- Window:=new(PDigitalUhr, Init(R,'Uhr',winDouble+winPanel+winMenu));
- Window^.SetWindowAttrib(false);
- InsertDesktop(Window);
- end;
-
- procedure TApplication.Lister(Nummer:byte);
- var R:TRect;
- Window:PScrollWindow;
- x,y:integer;
- begin
- R.Assign(60,80,440,280);
- Window:=new(PScrollWindow, Init(R,Nummer,'ScrollWindow / Lister für TextDateien',winDouble+winPanel+winMenu+winKey));
- Window^.SetWindowAttrib(false);
- InsertDesktop(Window);
- end;
-
-
- procedure TApplication.DruckerDialog;
- var R:TRect;
- Window:PDlgWindow;
- begin
- R.Assign(60,80,440,390);
- Window:=new(PDlgWindow, Init(R,'Beispiel für einen Drucker-Dialog',winDouble+winPanel));
- with Window^ do
- begin
- SetPushButton(190,270,80,22,'OK',cmCloseWindow);
- SetPushButton(285,270,80,22,'Abbrechen',cmCloseWindow);
- SetGroupFrame(20,40,180,140,'Druckertyp',NormWidth);
- SetRadioButton(40,70,'~M~atrixdrucker',1);
- SetRadioButton(40,90,'~L~aserdrucker',1);
- SetRadioButton(40,110,'~T~ypenraddrucker',1);
- SetRadioButton(40,130,'~B~ubble-Jet',1);
- SetRadioButton(40,150,'T~h~ermodrucker',1);
- SetGroupFrame(220,40,135,90,'Auflösung',NormWidth);
- SetRadioButton(240,70,'~3~00 dpi',2);
- SetRadioButton(240,90,'~1~60 dpi',2);
- SetRadioButton(240,110,' ~7~5 dpi',2);
- SetCheckButton(225,165,'~E~inzelblatt');
- SetGroupFrame(20,200,155,88,'',ThickWidth);
- SetCheckButton(40,225,'~F~ett');
- SetCheckButton(40,245,'~K~ursiv');
- SetCheckButton(40,265,'~U~nterstrichen');
- SetStaticText(195,210,'Drucker-Dialog',LeftText);
- SetTextParameters(TSCRFont,HorizDir,1);
- ChangePalColor(10,Red);
- SetData(PrintDialogData);
- end;
- InsertDesktop(Window);
- end;
-
- procedure TApplication.VektorZeichensaetze;
- var R:TRect;
- Window:PDlgWindow;
- begin
- R.Assign(60,80,440,360);
- Window:=new(PDlgWindow, Init(R,'Unterstützte Vektor-Zeichensätze',winDouble+winPanel+winMenu+winKey));
- with Window^ do
- begin
- DlgInput:=false;
- SetPushButton(15,40,80,22,'OK',cmCloseWindow);
- SetPushButton(15,70,80,0,'#Icon/2',cmNoFunction);
- SetStaticText(150,40,'Gotischer Zeichensatz',LeftText);
- SetTextParameters(GothicFont,HorizDir,1);
- SetStaticText(150,65,'Triplex - Zeichensatz',LeftText);
- SetTextParameters(TriplexFont,HorizDir,1);
- SetStaticText(150,90,'Small - Zeichensatz',LeftText);
- SetTextParameters(SmallFont,HorizDir,6);
- SetStaticText(150,110,'Sanserif - Zeichensatz',LeftText);
- SetTextParameters(SansSerifFont,HorizDir,1);
- SetStaticText(150,125,'Script - Zeichensatz',LeftText);
- SetTextParameters(ScriptFont,HorizDir,1);
- SetStaticText(150,147,'Simple - Zeichensatz',LeftText);
- SetTextParameters(SimpleFont,HorizDir,1);
- SetStaticText(150,168,'TSCR - Zeichensatz',LeftText);
- SetTextParameters(TSCRFont,HorizDir,1);
- SetStaticText(150,185,'LCOM - Zeichensatz',LeftText);
- SetTextParameters(LCOMFont,HorizDir,1);
- SetStaticText(60,210,'Euro - Zeichensatz',LeftText);
- SetTextParameters(EuroFont,HorizDir,1);
- SetStaticText(40,140,'Vertical - Small',RightText);
- SetTextParameters(SmallFont,VertDir,4);
- end;
- InsertDesktop(Window);
- end;
-
- procedure TApplication.AdressDB(DInput:boolean);
- var R:TRect;
- Window:PAdressWindow;
- begin
- R.Assign(60,80,440,350);
- Window:=new(PAdressWindow, Init(R,'Beispiel 22 : Mini-Adressdatenbank',
- winDouble+winPanel,DInput));
- with Window^ do
- begin
- SetPushButton(150,220,80,22,'OK',cmCloseWindow);
- SetPushButton(40,220,80,22,'Sichern',cmSaveData);
- if not DInput then SetDisabled;
- SetPushButton(260,220,40,22,'<<',cmLeft);
- if DInput then SetDisabled;
- SetPushButton(310,220,40,22,'>>',cmRight);
- if DInput then SetDisabled;
- SetInputLine(140,95,25,'~F~irma :',40,ASCII);
- if not DInput then SetDisabled;
- SetInputLine(140,120,20,'~O~rt :',25,ASCII);
- if not DInput then SetDisabled;
- SetInputLine(140,145,20,'~S~traße :',30,ASCII);
- if not DInput then SetDisabled;
- SetInputLine(140,170,20,'~T~elefon :',20,ASCII);
- if not DInput then SetDisabled;
- if DInput then SetStaticText(40,35,'Adressenerfassung',LeftText)
- else SetStaticText(40,35,'Blättern in der Datei',LeftText);
- SetTextParameters(TriplexFont,HorizDir,2);
- ChangePalColor(10,Red);
- SetData(Adresse);
- end;
- InsertDesktop(Window);
- end;
-
- procedure TApplication.KuchenDiagramm;
- var R:TRect;
- Window:PDiagramm;
- begin
- R.Assign(210,120,420,320);
- Window:=new(PDiagramm, Init(R,'Demo Geschäftsgrafik',winDouble+winPanel+winMenu+winKey));
- InsertDesktop(Window);
- end;
-
- procedure TApplication.FarnBlatt;
- var R:TRect;
- Window:PFarn;
- begin
- R.Assign(210,120,420,320);
- Window:=new(PFarn, Init(R,'Demo fraktales Farnblatt',winDouble+winPanel+winMenu+winKey));
- InsertDesktop(Window);
- end;
-
- procedure TApplication.Paint;
- var R:TRect;
- Window:PPaint;
- begin
- Window:=new(PPaint, Init(WorkArea,'',winSingle));
- with Window^ do
- begin
- DlgInput:=false;
- SetPushButton(3,2,0,0,'#WGRAPH/1',cmLoadPic);
- ChangePalColor(8,LightGray);
- SetPushButton(44,2,0,0,'#WGRAPH/2',cmSavePic);
- ChangePalColor(8,LightGray);
- SetPushButton(3,43,0,0,'#WGRAPH/3',cmClearPic);
- ChangePalColor(8,LightGray);
- SetPushButton(44,43,0,0,'#WGRAPH/4',cmNoFunction);
- ChangePalColor(8,LightGray);
- SetPushButton(3,84,0,0,'#WGRAPH/5',cmTools);
- ChangePalColor(8,LightGray);
- SetPushButton(44,84,0,0,'#WGRAPH/6',cmCloseWindow);
- ChangePalColor(8,LightGray);
- end;
- InsertDesktop(Window);
- end;
-
- procedure TApplication.InputDialog(FType:str12);
- var R:TRect;
- Window:PInputDialog;
- Pfad:string[60];
- begin
- R.Assign(120,80,382,380);
- Window:=new(PInputDialog, Init(R,'Datei öffnen',winDouble+winPanel+winMenu));
- with Window^ do
- begin
- FillChar(DlgData.DateiName,SizeOf(DlgData.DateiName),' ');
- DlgData.DateiName:=FType; {erst das,}
- DlgData.DateiName[0]:=#32; {dann das !}
- GetDir(0,Pfad);
- SetInputLine(145,55,12,'Datei~n~ame :',32,ASCII);
- SetDateiListBox(15,130,127,144,'~D~ateien',VScrBar);
- SetPushButton(156,130,90,22,'OK',cmOK);
- SetPushButton(156,160,90,22,'Abbrechen',cmCancel);
- SetStaticText(20,85,'Verzeichnis : '+Pfad,LeftText);
- SetData(DlgData);
- end;
- InsertDesktop(Window);
- end;
-
- procedure TApplication.BildSpeichern;
- var R:TRect;
- Window:POutputDialog;
- Pfad:string[60];
- begin
- R.Assign(120,80,382,250);
- Window:=new(POutputDialog, Init(R,'Bild speichern',winDouble+winPanel+winMenu));
- with Window^ do
- begin
- GetDir(0,Pfad);
- SetInputLine(145,55,12,'Datei~n~ame :',32,ASCII);
- SetPushButton(56,130,90,22,'OK',cmOK);
- SetPushButton(156,130,90,22,'Abbrechen',cmCancel);
- SetStaticText(20,85,'Verzeichnis : '+Pfad,LeftText);
- SetData(ImgData);
- end;
- InsertDesktop(Window);
- end;
-
- procedure TApplication.ToolBar;
- var R:TRect;
- Window:PToolBar;
- begin
- R.Assign(120,80,220,226);
- Window:=new(PToolBar, Init(R,'Toolbar',winSingle+winPanel+winMenu));
- with Window^ do
- begin
- DlgInput:=false;
- SetPushButton(3,23,45,0,'#WGRAPH/8',cmPinsel);
- ChangePalColor(8,LightGray);
- SetPushButton(52,23,45,0,'#WGRAPH/9',cmBrush);
- ChangePalColor(8,LightGray);
- SetPushButton(3,64,45,0,'#WGRAPH/10',cmFill);
- ChangePalColor(8,LightGray);
- SetPushButton(52,64,45,0,'#WGRAPH/11',cmNoFunction);
- ChangePalColor(8,LightGray);
- SetPushButton(3,105,45,0,'#WGRAPH/12',cmNoFunction);
- ChangePalColor(8,LightGray);
- SetPushButton(52,105,45,0,'#WGRAPH/6',cmCloseWindow);
- ChangePalColor(8,LightGray);
- end;
- InsertDesktop(Window);
- end;
-
- procedure TApplication.MausDemo;
- var R:TRect;
- i:byte;
- Window:PMausDemo;
- begin
- R.Assign(60,80,460,400);
- Window:=new(PMausDemo, Init(R,'',winSingle));
- with Window^ do
- begin
- SetPushButton(268,197,80,22,'OK',cmCloseWindow);
- SetGroupFrame(20,40,195,230,'Mauszeiger',ThickWidth);
- ChangePalColor(2,LightCyan);
- ChangePalColor(1,Red);
- SetRadioButton(40,70,' ~1~ Standard',1);
- ChangePalColor(2,LightCyan);
- ChangePalColor(3,Magenta);
- SetRadioButton(40,90,' ~2~ Fadenkreuz',1);
- ChangePalColor(2,LightCyan);
- ChangePalColor(3,Magenta);
- SetRadioButton(40,110,' ~3~ Sanduhr',1);
- ChangePalColor(2,LightCyan);
- ChangePalColor(3,Magenta);
- SetRadioButton(40,130,' ~4~ Vierfach-Pfeil',1);
- ChangePalColor(2,LightCyan);
- ChangePalColor(3,Magenta);
- SetRadioButton(40,150,' ~5~ Doppelpfeil',1);
- ChangePalColor(2,LightCyan);
- ChangePalColor(3,Magenta);
- SetRadioButton(40,170,' ~6~ DPfeil/schräg',1);
- ChangePalColor(2,LightCyan);
- ChangePalColor(3,Magenta);
- SetRadioButton(40,190,' ~7~ DPfeil/gerade',1);
- ChangePalColor(2,LightCyan);
- ChangePalColor(3,Magenta);
- SetRadioButton(40,210,' ~8~ DPfeil/schräg',1);
- ChangePalColor(2,LightCyan);
- ChangePalColor(3,Magenta);
- SetRadioButton(40,230,' ~9~ Kursorstrich',1);
- ChangePalColor(2,LightCyan);
- ChangePalColor(3,Magenta);
- SetRadioButton(40,250,'1~0~ Hand',1);
- ChangePalColor(2,LightCyan);
- ChangePalColor(3,Magenta);
- for i:=1 to 7 do
- begin
- SetPushButton(212+i*22,235,16,(8-i)*8,'',1000+i);
- ChangePalColor(7,Yellow);
- ChangePalColor(8,Yellow);
- SetPushButton(212+i*22,238+(8-i)*8,16,i*8,'',1007+i);
- ChangePalColor(7,Yellow);
- ChangePalColor(8,Yellow);
- end;
-
- SetData(MausData);
- end;
- InsertDesktop(Window);
- end;
-
- procedure TApplication.JoystickDemo;
- var R:TRect;
- Window:PJoystickDemo;
- begin
- R.Assign(60,80,460,400);
- Window:=new(PJoystickDemo, Init(R,'',winDouble));
- with Window^ do
- begin
- DlgInput:=false;
- SetPushButton(297,240,80,22,'OK',cmCloseWindow);
- SetIcon(320,190,'#WGRAPH/7');
- SetStaticText(20,30,'Joystick',LeftText);
- ChangePalColor(10,Yellow);
- SetTextParameters(TriplexFont,HorizDir,3);
- end;
- InsertDesktop(Window);
- end;
-
-
-
- {Implementation TNewDTBgrd}
-
- procedure TNewDTBgrd.Draw;
- var R:TRect;
- begin
- TDsktpBgrd.Draw;
- R.Copy(Border);
- R.A.y:=R.A.y+21;
- BgImage.Init(R,'WETT.PCX');
- BgImage.LoadPCXImage(0);
- end;
-
- {--- Hauptprogramm ---}
-
- begin
- OvrInit('WGDEMO.OVR');
- MyProg.Init('Demonstrationsprogramm WGRAPH 1.0');
- MyProg.Run;
- MyProg.Done;
- end.
-
-