PROCEDURE faltkarte;
CONST 
	pageWidth=297;
	pageHeight=210;
	pageFoldY=100;
VAR
	objectX1,objectX2,objectX3,objectX4,objectX5,objectX6,objectX7,objectX8,objectX9:REAL;
	objectXX1,objectXX2,objectXX3,objectXX4,objectXX5,objectXX6,objectXX7,objectXX8,objectXX9,objectXX10:REAL;
	objectY1,objectY2,objectY3,objectYY0,objectYY1,objectYY2,objectYY3:REAL;
	width,depth,height,distance:	REAL;
	wwidth,ddepth,hheight,ddistance:	REAL;
	nVolumes:  INTEGER;
	i,u:  INTEGER;
BEGIN
	{*werte in variablen speichern*}
	nVolumes:=7;
	width:=30;
	wwidth:=20;
	distance:=(pageWidth-(nVolumes*width))/2;
	ddistance:=width-wwidth;
	depth:=80;
	ddepth:=50;
	height:=15;
	hheight:=10;

	{*yWerte für die Linien berechnen*}
		objectY1:=pageFoldY - depth;
		objectY3:=pageFoldY + height;
		objectY2:=objectY3-depth;

		objectYY1:=objectY3-ddepth;
		objectYY3:=objectY3+hheight;
		objectYY2:=objectYY3-ddepth;
		objectYY0:=objectYY1-height;

	
	{*dina a4 blatt zeichnen*}
	penFore(0,0,65535);
	moveto(0,0);
	lineto(pageWidth,0);
	lineto(pageWidth,pageHeight);
	lineto(0,pageHeight);
	lineto(0,0);

{*zum ersten papierfaltpunkt bewegen*}
	{*rot*}
	penFore(65535,0,0);
	objectX1:=distance;
	moveto(0,pageFoldY);
	lineto(objectX1,pageFoldY);
	objectXX1:=distance+2*ddistance;
	moveto(objectX1,objectY3);
	lineto(objectXX1,objectY3);
	objectXX1:=3*(ddistance+wwidth)+distance+2*ddistance;
	moveto(objectXX1,objectY3);
	objectXX1:=4*(ddistance+wwidth)+distance+2*ddistance;
	lineto(objectXX1,objectY3);
{*in dieser Schleife werden die weissen Tasten gezeichnet*}

	FOR i:=0 TO 6 DO BEGIN
			IF (NOT((i=0)OR(i=4))) THEN BEGIN		
				{*links und rechts des Volumes berechnen*}
				objectX1:=distance+(i*width);
				objectX2:=distance+width+(6*width);
	
				{*blau*}
				penFore(0,0,65535);
				moveto(objectX1,objectY1);
				lineto(objectX1,objectYY1);
				moveto(objectX2,objectY1);
				lineto(objectX2,objectY3);		
			END
			ELSE BEGIN
				objectX1:=distance+(i*width);
				objectX2:=distance+width+(6*width);
				{*blau*}
				penFore(0,0,65535);
				moveto(objectX1,objectY1);
				lineto(objectX1,objectY3);
				{*rot*}
				penFore(65535,0,0);
				moveto(objectX1,objectY1);
				lineto(objectX2,objectY1);	
				moveto(objectX1,objectY2);
				lineto(objectX2,objectY2);	
			END;
	END;
FOR u:=0 TO 5 DO BEGIN
	IF (NOT(u=3)) THEN BEGIN		
		{*links und rechts des Volumes berechnen*}
		objectXX1:=u*(ddistance+wwidth)+distance+2*ddistance;
		objectXX2:=objectXX1+wwidth;
		objectxx3:=(u+1)*(ddistance+wwidth)+distance+2*ddistance;

{*blau*}
		penFore(0,0,65535);

		moveto(objectXX1,objectYY1);
		lineto(objectXX1,objectYY3);
		moveto(objectXX2,objectYY1);
		lineto(objectXX2,objectYY3);

		{*rot*}
		penFore(65535,0,0);
		moveto(objectXX1,objectYY1);
		lineto(objectXX2,objectYY1);
		moveto(objectXX1,objectYY2);
		lineto(objectXX2,objectYY2);
		moveto(objectXX1,objectYY3);
		lineto(objectXX2,objectYY3);
		moveto(objectXX2,objectY3);
		lineto(objectXX3,objectY3);
	
	END;
END;
message('Piano ohne Accord');
	moveto(objectXX2,objectY3);
	lineto(objectX2,objectY3);	

moveto(objectX2,pageFoldY);	
lineTo(pageWidth,pageFoldY);

	
END;
RUN(faltkarte);