summaryrefslogtreecommitdiff
path: root/app/schulis-mathematiksystem/1.0/src/mat.specialgraphic
blob: 2de7226305aa5f2b074ed7e6a93917203e206dc5 (plain)
1
2
3
4
PACKETspezialgraphicDEFINESmatmove,matdraw,grapheditget,initscreenmemory,clearscreenmemory,plotscreenmemory,loeschezeichnung,loeschezeichnungpartiell,putscreenmemory,newpicture,deletelastpicture,vervollstaendigeaktuellezeichnung,druckeaktuellezeichnung:LEThop="�",rechts="�",bell="�",links="�",rubin="�",rubout="�",return="
",escapezeichen="�",rubinmark="^",cursorverschiebung=1,blank=" ",niltext="",bildspeichertyp=1055,maximalanzahl=128,maxzeichnungen=25,printerdepot="MATHE-PRINTERDEPOT";TYPE PICROW=STRUCT(INTeof,ROWmaximalanzahlPICTUREzeichnung,ROW4REALfenstergroesseREALquellbreite,quellhoehe);BOUND PICROW VARscreenmemory;DATASPACE VARds;INT CONSTcursorbreite:=zeichenbreite-1;BOOL VARcursoron:=FALSE;INT VARaltx,alty,xpixelanzahl,ypixelanzahl;REAL VARxcmgroesse,ycmgroesse,startpunktx,startpunkty;PROCmatmove(REAL CONSTx,y):startpunktx:=x;startpunkty:=yEND PROCmatmove;PROCmatdraw(REAL CONSTx,y):BOOL VARunsichtbar;REAL VARendpunktx:=x,endpunkty:=y,letzterendpunktx,letzterendpunkty;clip(startpunktx,startpunkty,endpunktx,endpunkty,unsichtbar);IF NOTunsichtbarTHEN IFlength(screenmemory.zeichnung(screenmemory.eof))>31960THENstretchpictureEND IF;where(letzterendpunktx,letzterendpunkty);IFstartpunktx<>letzterendpunktxCORstartpunkty<>letzterendpunktyTHENmove(startpunktx,startpunkty);move(screenmemory.zeichnung(screenmemory.eof),startpunktx,startpunkty)END IF;IFletzterendpunktx<>endpunktxCORletzterendpunkty<>endpunktyTHENdraw(endpunktx,endpunkty);draw(screenmemory.zeichnung(screenmemory.eof),endpunktx,endpunkty)END IF END IF;matmove(x,y)END PROCmatdraw;PROCclip(REAL VARxbeg,ybeg,xend,yend,BOOL VARnothingvisible):REAL VARdifbeg,difend;REAL CONSTxdif:=xend-xbeg,ydif:=yend-ybeg;BOOL VARcutbeg,cutend;windowlinksclip;windowrechtsclip;windowuntenclip;windowobenclip.windowlinksclip:difbeg:=windowxmin-xbeg;difend:=windowxmin-xend;cutbeg:=(difbeg>0.0);cutend:=(difend>0.0);nothingvisible:=cutbegANDcutend;IFnothingvisibleTHEN LEAVEclipELIFcutbegTHENybeg:=ybeg+ydif/xdif*difbeg;xbeg:=windowxminELIFcutendTHENyend:=yend+ydif/xdif*difend;xend:=windowxminEND IF.windowrechtsclip:difbeg:=windowxmax-xbeg;difend:=windowxmax-xend;cutbeg:=(difbeg<0.0);cutend:=(difend<0.0);nothingvisible:=cutbegANDcutend;IFnothingvisibleTHEN LEAVEclipELIFcutbegTHENybeg:=ybeg+ydif/xdif*difbeg;xbeg:=windowxmaxELIFcutendTHENyend:=yend+ydif/xdif*difend;xend:=windowxmaxEND IF.windowuntenclip:difbeg:=windowymin-ybeg;difend:=windowymin-yend;cutbeg:=(difbeg>0.0);cutend:=(difend>0.0);nothingvisible:=cutbegANDcutend;IFnothingvisibleTHEN LEAVEclipELIFcutbegTHENxbeg:=xbeg+xdif/ydif*difbeg;ybeg:=windowyminELIFcutendTHENxend:=xend+xdif/ydif*difend;yend:=windowyminEND IF.windowobenclip:difbeg:=windowymax-ybeg;difend:=windowymax-yend;cutbeg:=(difbeg<0.0);cutend:=(difend<0.0);nothingvisible:=cutbegANDcutend;IFnothingvisibleTHEN LEAVEclipELIFcutbegTHENxbeg:=xbeg+xdif/ydif*difbeg;ybeg:=windowymaxELIFcutendTHENxend:=xend+xdif/ydif*difend;yend:=windowymaxEND IF END PROCclip;PROCeditgetcursor(INT CONSTi,j):loeschecursor;altx:=(i-1)*zeichenbreite;alty:=ypixelanzahl-(j*zeichenhoehe)-cursorverschiebung;move(altx,alty);draw(altx+cursorbreite,alty);cursoron:=TRUE;cursor(i,j)END PROCeditgetcursor;PROCloeschecursor:IFcursoronTHENpen(0,0,0,1);move(altx,alty);draw(altx+cursorbreite,alty);pen(1,1,1,1);cursoron:=FALSE END IF END PROCloeschecursor;PROCgrapheditget(TEXT VAReingabe,INT CONSTfeldlaenge,TEXT CONSTescausstiegszeichen,TEXT VARausstieg):TEXT VARch;INT VARxanfang,yanfang,cursorpos,textpointer,maxcursorpos,zielpos;BOOL VARrubinmode;initialisiereeditor;REPinchar(ch);IFch=returnTHENausstieg:=niltext;loeschecursor;eingabe:=compress(eingabe);LEAVEgrapheditgetELIFch=escapezeichenTHENinchar(ausstieg);IFpos(escausstiegszeichen,ausstieg)<>0THENloeschecursor;LEAVEgrapheditgetEND IF ELIFch=linksTHENfuehrecursorlinksausELIFch=rechtsTHENfuehrecursorrechtsausELIFch=rubinTHENfuehrerubinausELIFch=ruboutTHENfuehreruboutausELIFch=hopTHENinchar(ch);IFch=linksTHENfuehrehoplinksausELIFch=rechtsTHENfuehrehoprechtsausELIFch=
ruboutTHENfuehrehopruboutausEND IF ELIFcode(ch)>=32THENfuehrenormaleszeichenausEND IF END REP.initialisiereeditor:clearbuffer;drawingarea(xcmgroesse,ycmgroesse,xpixelanzahl,ypixelanzahl);rubinmode:=FALSE;textpointer:=1;getcursor(xanfang,yanfang);cursorpos:=xanfang;maxcursorpos:=xanfang+feldlaenge;out(text(eingabe,feldlaenge,textpointer));editgetcursor(xanfang,yanfang).fuehrecursorlinksaus:IFcursorpos>xanfangTHENcursorposDECR1;editgetcursor(cursorpos,yanfang)ELIFtextpointer>1THENtextpointerDECR1;cursor(xanfang,yanfang);out(text(eingabe,feldlaenge,textpointer));editgetcursor(xanfang,yanfang)END IF.fuehrecursorrechtsaus:IFcursorpos-xanfang+textpointer<=length(eingabe)THEN IFcursorpos<maxcursorposTHENcursorposINCR1;editgetcursor(cursorpos,yanfang)ELSEtextpointerINCR1;cursor(xanfang,yanfang);out(text(eingabe,feldlaenge,textpointer));editgetcursor(maxcursorpos,yanfang)END IF END IF.fuehrerubinaus:TEXT VARt;rubinmode:=NOTrubinmode;IFrubinmodeTHEN IFcursorpos<maxcursorposTHENout(rubinmark);pause(3);cursor(cursorpos,yanfang);t:=eingabeSUB(cursorpos-xanfang+textpointer);IFt=niltextTHENt:=blankEND IF;out(t);editgetcursor(cursorpos,yanfang)END IF END IF.fuehreruboutaus:zielpos:=cursorpos-xanfang+textpointer;change(eingabe,zielpos,zielpos,niltext);out(text(eingabe,feldlaenge-(cursorpos-xanfang),zielpos));editgetcursor(cursorpos,yanfang).fuehrehoplinksaus:IFtextpointer>1THENcursor(xanfang,yanfang);textpointer:=1;out(text(eingabe,feldlaenge,textpointer))END IF;cursorpos:=xanfang;editgetcursor(cursorpos,yanfang).fuehrehoprechtsaus:IFlength(eingabe)<feldlaengeTHENcursorpos:=length(eingabe)+xanfangELIFcursorpos-xanfang+textpointer<=length(eingabe)THENzielpos:=length(eingabe)+1-feldlaenge;cursor(xanfang,yanfang);textpointer:=zielpos;out(text(eingabe,feldlaenge,zielpos));getcursor(cursorpos,yanfang)END IF;editgetcursor(cursorpos,yanfang).fuehrehopruboutaus:zielpos:=cursorpos-xanfang;eingabe:=subtext(eingabe,1,zielpos+textpointer-1);out((feldlaenge-zielpos)*blank);editgetcursor(cursorpos,yanfang).fuehrenormaleszeichenaus:IFrubinmodeTHENzielpos:=cursorpos-xanfang+textpointer;eingabe:=subtext(eingabe,1,zielpos-1)+ch+subtext(eingabe,zielpos,length(eingabe));IFcursorpos<maxcursorposTHENout(text(eingabe,maxcursorpos-cursorpos,zielpos))ELSEcursor(xanfang,yanfang);textpointerINCR1;out(text(eingabe,feldlaenge,textpointer))END IF ELSEzielpos:=cursorpos-xanfang+textpointer;IFzielpos>length(eingabe)THENeingabeCATblankEND IF;replace(eingabe,zielpos,ch);IFcursorpos<maxcursorposTHENout(ch)ELSEcursor(xanfang,yanfang);textpointerINCR1;out(text(eingabe,feldlaenge,textpointer))END IF END IF;IFcursorpos<maxcursorposTHENcursorposINCR1END IF;editgetcursor(cursorpos,yanfang)END PROCgrapheditget;PROCinitscreenmemory:forget(ds);ds:=nilspace;screenmemory:=ds;screenmemory.eof:=1;screenmemory.zeichnung(screenmemory.eof):=nilpictureEND PROCinitscreenmemory;PROCclearscreenmemory:forget(ds)END PROCclearscreenmemory;PROCplotscreenmemory:INT VARi;FORiFROM1UPTOscreenmemory.eofREP IFlength(screenmemory.zeichnung(i))<>0THENpen(1,1,1,pen(screenmemory.zeichnung(i)));plot(screenmemory.zeichnung(i))END IF END REP END PROCplotscreenmemory;PROCloeschezeichnung:INT VARi;pen(0,0,0,1);FORiFROMscreenmemory.eofDOWNTO1REP IFlength(screenmemory.zeichnung(i))<>0THENplot(screenmemory.zeichnung(i))END IF END REP END PROCloeschezeichnung;PROCloeschezeichnungpartiell:INT VARi;pen(0,0,0,1);FORiFROMscreenmemory.eofDOWNTO2REP IFlength(screenmemory.zeichnung(i))<>0THENplot(screenmemory.zeichnung(i))END IF END REP;screenmemory.eof:=2;plotscreenmemoryEND PROCloeschezeichnungpartiell;PROCputscreenmemory(PICTURE CONSTp):IFscreenmemory.eof=maximalanzahlTHENscreenmemory.eof:=1END IF;screenmemory.zeichnung(screenmemory.eof):=p;screenmemory.eofINCR1;screenmemory.zeichnung(screenmemory.eof):=nilpictureEND PROCputscreenmemory;PROCvervollstaendigeaktuellezeichnung(REAL CONSTxmin,xmax,ymin,ymax,breite,hoehe):screenmemory.fenstergroesse(1):=xmin;screenmemory.fenstergroesse(2):=xmax;screenmemory.fenstergroesse(3):=
ymin;screenmemory.fenstergroesse(4):=ymax;screenmemory.quellbreite:=breite;screenmemory.quellhoehe:=hoeheEND PROCvervollstaendigeaktuellezeichnung;INT VARanzahlfolgebilder:=0;PROCstretchpicture:anzahlfolgebilderINCR1;setzeweiter(pen(screenmemory.zeichnung(screenmemory.eof)))END PROCstretchpicture;PROCnewpicture(INT CONSTnr):anzahlfolgebilder:=0;setzeweiter(nr)END PROCnewpicture;PROCsetzeweiter(INT CONSTnr):screenmemory.eofINCR1;IFscreenmemory.eof>maximalanzahlTHENscreenmemory.eof:=2END IF;screenmemory.zeichnung(screenmemory.eof):=nilpicture;pen(screenmemory.zeichnung(screenmemory.eof),nr)END PROCsetzeweiter;PROCdeletelastpicture:IFscreenmemory.eof>1+anzahlfolgebilderTHENscreenmemory.eofDECR(1+anzahlfolgebilder)END IF END PROCdeletelastpicture;PROCdruckeaktuellezeichnung:enablestop;bestimmezieltaskname;benennedatenraum;versendedatenraum.bestimmezieltaskname:IF NOTexiststask(printerdepot)CORinhalt(ALL(/printerdepot))>=maxzeichnungenTHENout(bell);LEAVEdruckeaktuellezeichnungEND IF.benennedatenraum:TEXT VARbilddatenraum:="ZEICHNUNG "+date+" "+timeofday;IFexists(bilddatenraum,/printerdepot)THEN INT VARzaehler:=1;bilddatenraumCAT":";WHILEexists(bilddatenraum+text(zaehler),/printerdepot)REPzaehlerINCR1END REP;bilddatenraumCATtext(zaehler)END IF;type(ds,bildspeichertyp);copy(ds,bilddatenraum).versendedatenraum:IFstatus(/printerdepot)=2THENsave(bilddatenraum,/printerdepot)ELSEout(bell)END IF;forget(bilddatenraum,quiet)END PROCdruckeaktuellezeichnung;INT PROCinhalt(THESAURUS CONSTth):INT VARi:=0,zaehler:=0;TEXT VARname;get(th,name,i);WHILEi<>0REP IFname<>niltextTHENzaehlerINCR1END IF;get(th,name,i);END REP;zaehlerEND PROCinhalt;END PACKETspezialgraphic