Commits

Ivan Vendrov committed e581526

Added struct and delete_var support to anim managr

Comments (0)

Files changed (2)

ca.usask.cs/giraffe/compiler/anim/AnimationStripper.java

 																		// remove
 																		// +1
 		
-		//try {
-			GiraffeLogger.error("Received DD of type " + delDescriptor.deltaType());
-		//}catch (WrongSubclassException e){
-		//	System.out.println("JOEY!");			
-		//}
 		LinkedList<AnimationDescriptor> animations = new LinkedList<AnimationDescriptor>();
 
 		// handle different types of animations
 				animations.add(ad);
 				break;
 			case DEL_VAR:
+				ad = new DisappearAnimationDescriptor(delDescriptor.deleteVar_name());
+				animations.add(ad);
 				nextStep();
 				break;
 			case START_FUNC:

ca.usask.cs/giraffe/compiler/anim/DataDisplayManager.java

 import java.awt.Point;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Map.Entry;
+
 import giraffe.ui.anim.DisplayProperties;
+import giraffe.compiler.Type;
 import giraffe.compiler.TypeTree;
 import giraffe.core.GiraffeLogger;
 
 	/**
 	 * The horizontal point at which to insert the next array/struct
 	 */
-	private int nextArray;
+	private int nextCompoundData;
 
 	/**
 	 * Constructs a new manager
 
 		// initialize the regions
 		numPrims = 0;
-		nextArray = height / 2 + DIST_V;
+		nextCompoundData = height / 2 + DIST_V;
 	}
 
 	// determines dimensions needed to display object of this type, NOT counting
 			int arheight = elemSize.height
 					+ DisplayProperties.ARRAY_HEIGHT_OVERHEAD;
 			return new Dimension(arwidth, arheight);
+		} else if (type.isArray()) {
+			int width = 0;
+			int height = 0;
+			for (Entry<String, Type> field : type.structMemberTypes().entrySet()){
+				Dimension fieldSize = size(field.getValue());
+				width = Math.max(width,  fieldSize.width);
+				height += fieldSize.height;
+			}
+			height += DisplayProperties.STRUCT_HEIGHT_OVERHEAD;
+			width += DisplayProperties.NAME_WIDTH; // space for name of field
+			return new Dimension(width, height);
 		}
 		GiraffeLogger.error("Type not implemented by DataDisplayManager: "
 				+ type.getPrimType());
 			int y = (row + 1) * DIST_V + row * (newbox.height);
 			numPrims++;
 			return new Point(x, y + DisplayProperties.FUNCTION_NAME_HEIGHT);
-		} else if (type.isArray()) {
-			int y = nextArray;
+		} else if (type.isArray() || type.isStruct()) {
+			int y = nextCompoundData;
 			int x = DIST_H;
-			nextArray += newbox.height + DIST_V;
+			nextCompoundData += newbox.height + DIST_V;
 			return new Point(x, y + DisplayProperties.FUNCTION_NAME_HEIGHT);
 		}
+		
 		GiraffeLogger.error("Type not implemented by DataDisplayManager: "
 				+ type.getPrimType());
-		return new Point(0, 0);
+		return new Point(0,0);
 	}
 
 	/**