unit grafik; (* Thomas Klein 1999 *) INTERFACE uses crt,graph,dos,printer,mouse; type menu_desc=record (* Menue-Beschreibung *) typ:(hor0,ver0,rec0,rec1); anzahl,anzahl2:word; x1,y1,x2,y2,abstand,abstand2:integer; end; var arrow_style:record (* Stil fr arrow-Prozedur *) spitze:integer; oeffnung,position:real; end; numdot_style:record (* Stil fr numdot-Prozedur *) ausdehnung:integer; groesse:word; end; textbox_param:record (* Textbox-Parameter, (x,y): akt. Pos *) x,y,x1,y1,x2,y2,abstand:integer; groesse,fill,backcol,txtcol:word; end; boxoutexit:boolean; (* true bei boxout-Abbruch *) window_param:record (* Window-Parameter *) x1,y1,x2,y2:integer; xmax,ymax:longint; end; procedure hireson; (* Grafik einschalten *) function epson(x_oben,y_oben,x_unten,y_unten:integer):word; (* S/W-Hardcopy auf Epson-Drucker, Rueckgabe: ioresult *) function hp(x_oben,y_oben,x_unten,y_unten:integer):word; (* S/W-Hardcopy auf HP-Drucker, Rueckgabe: ioresult *) function hrdcpy(x_oben,y_oben,x_unten,y_unten,typ:integer):word; (* Hardcopy, typ: Druckroutine(0=epson, 1=hp), Rueckgabe: ioresult *) procedure settextnorm(groesse:word); (* Groesse/Standardwerte fuer Textstil *) procedure setlinenorm; (* Standardwerte fuer Linienstil *) procedure box(x1,y1,x2,y2:integer;farbe:word); (* ausgefuelltes Rechteck zeichnen *) procedure outintxy(x,y:integer;num:longint;breite:byte); (* num:breite an (x,y) ausgeben *) procedure outint(num:longint;breite:byte); (* num:breite an aktueller Position ausgeben *) procedure outrealxy(x,y:integer;num:real;breite,nachkomma:byte); (* num:breite:nachkomma an (x,y) ausgeben *) procedure outreal(num:real;breite,nachkomma:byte); (* num:breite:nachkomma an aktueller Position ausgeben *) procedure outstrxy(x,y:integer;s:string;abstand:integer); (* string an (x,y) ausgeben, bei '~' Umbruch mit (Zeilen-)abstand *) procedure outstr(s:string;abstand:integer); (* string an akt. Position ausgeben, bei '~' Umbruch mit (Zeilen-)abstand *) procedure textbar(xoben,yoben,xunten,yunten:integer;s:string; groesse,fill,backcol,txtcol:word); (* Balken mit Text, groesse: Textgroesse, fill: Fllmuster, bei 0: Rahmen; backcol,txtcol: Farben Grafikcursor danach oben hinter Text *) procedure settextbox(x1,y1,x2,y2,abstand:integer; groesse,fill,backcol,txtcol:word); (* Rechteck fr Textausgabe definieren, Parameter s. textbar abstand: Zeilenabstand, textheight('*')+2 fr <0 *) procedure textbox; (* Textbox zeichnen('clrscr') *) procedure boxcr; (* Zeilenumbruch in Textbox *) procedure boxout(s:string;abbruch:boolean); (* s in Textbox ausgeben, Zeilenumbruch falls notwendig abbruch=true: Abbruch erlaubt, boxoutexit=true bei abbruch *) function gdir(pfad:string):boolean; (* Directory in Textbox ausgeben, false bei Fehler *) procedure dot(x,y,ausdehnung:integer); (* ausgedehnten 'Punkt' zeichnen *) procedure setnumdotstyle(ausdehnung:integer;groesse:word); (* Stil fr numdot: ausdehnung: Punktausdehnung, groesse: Textgroesse *) procedure setnumdotnorm; (* setzt Standardwerte fr numdot *) procedure numdot(x,y:integer;num:longint); (* numerierten Punkt zeichnen *) procedure setarrowstyle(spitze:integer;oeffnung,position:real); (* Stil fr arrow: spitze: Spitzengroesse, oeffnung: Oeffnungswinkel in Grad position: Spitzenposition, 0: am Anfang - 1: am Ende *) procedure setarrownorm; (* Standardwerte fr arrow-Stil *) procedure arrow(x1,y1,x2,y2:integer); (* Pfeil zeichnen *) procedure rect(x1,y1,x2,y2:integer;var desc:menu_desc); (* rechteckigen Bereich definieren *) procedure closebutton(x1,y1,x2,y2:integer;backcol,linecol:word; var desc:menu_desc); (* zeichnet Schlieábutton *) procedure hmenu(xoben,yoben,xunten,yunten,abstand:integer;menu:string; groesse,fill,backcol,txtcol,trenncol:word;var desc:menu_desc); (* horizontales Menue, abstand: zwischen menuepunkten, <0: abstand=-breite/abstand menu: 'p1|p2|...', groesse: schriftfaktor, ...col: farben fill: Fuellstil, 0: Rahmen *) procedure vmenu(xoben,yoben,xunten,yunten,abstand:integer;menu:string; groesse,fill,backcol,txtcol,trenncol:word;var desc:menu_desc); (* vertikales Menue, abstand: zwischen menuepunkten, <0: abstand=-hoehe/abstand menu: 'p1|p2|...', groesse: schriftfaktor, ...col: farben fill: Fuellstil, 0: Rahmen *) procedure rmenu(xoben,yoben,xunten,yunten,xabstand,yabstand:integer; fill,backcol,trenncol:word;var desc:menu_desc); (* rechteckiges Menue, xabstand,yabstand: zwischen menuepunkten, <0: abstand=-ausdehnung/abstand ...col: Farben, fill: Fuellstil, 0: Rahmen *) procedure rmenuentry(nr:word;menu:string; groesse,txtcol:word;desc:menu_desc); (* menu als Menueeintrag nr in rmenu mit Farbe txtcol und Schrift-groesse *) function chkrect(x,y,x1,y1,x2,y2:integer):boolean; (* x,y in Rechteck? *) function chkmenu(x,y:integer;desc:menu_desc):word; (* (x,y) -> Menuepunkt, 0 fr ausserhalb *) procedure ginput(var s:string;laenge:byte;backcol,txtcol:word); (* Eingabe an aktueller Grafikcursorposition, ...col: Farben *) procedure setwindow(x1,y1,x2,y2:integer;xmax,ymax:longint); (* Fenstergroesse (x1,y1,x2,y2) und Koord.-System (0 bis xmax,0 bis ymax) *) procedure windowon; (* Viewport mit Clipping *) procedure windowoff; (* Viewport=ganzer Bildschirm *) function xv(x:longint):integer; (* neue x-Koord. -> Viewport-y-Koord. *) function yv(y:longint):integer; (* neue y-Koord. -> Viewport-y-Koord. *) function vx(x:integer):longint; (* Viewport-x-Koord. -> neue x-Koord. *) function vy(y:integer):longint; (* Viewport-y-Koord. -> neue y-Koord. *) function mx(x:integer):longint; (* Maus-x-Koord. -> neue x-Koord. *) function my(y:integer):longint; (* Maus-y-Koord. -> neue y-Koord. *) function xm(x:longint):integer; (* neue x-Koord. -> Maus-x-Koord. *) function ym(y:longint):integer; (* neue y-Koord. -> Maus-y-Koord. *)