// Path: mathdragon/src/main/java/org/teaminfty/math_dragon/view/MathShadow.java
// public class MathShadow extends DragShadowBuilder
// {
//     /** The {@link Expression} that is being dragged */
//     private Expression mathObject = null;
// 
//     /** Constructor
//      * @param mo The {@link Expression} that is to be dragged
//      */
//     public MathShadow(Expression mo)
//     {
//         setDragState(mathObject = mo);
//         mathObject.setLevel(0);
//     }
//     
//     /** Recursively sets the DRAG state for the given {@link Expression} and all of its children
//      * @param mo The {@link Expression} to set the DRAG state for */
//     private void setDragState(Expression mo)
//     {
//         // Set the state
//         mo.setState(HoverState.DRAG);
//         
//         // Loop through the children and set their states
//         for(int i = 0; i < mo.getChildCount(); ++i)
//             setDragState(mo.getChild(i));
//     }
//     
//     /** Returns the {@link Expression} in this shadow
//      * @return The {@link Expression} in this shadow */
//     public Expression getExpression()
//     { return mathObject; }
//     
//     /** Returns the bounding box of the current {@link Expression} relative to the touch point
//      * @return The requested bounding box
//      */
//     public Rect getExpressionBounding()
//     {
//         // Calculate the bounding box
//         Rect boundingBox = mathObject.getBoundingBox();
//         
//         // Translate the bounding, so that our touch point becomes the origin
//         boundingBox.offset(-boundingBox.width() / 2, -boundingBox.height() - 64);
//         
//         // Return the result
//         return boundingBox;
//     }
//     
//     @Override
//     public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint)
//     {
//         // Calculate the bounding box
//         Rect boundingBox = mathObject.getBoundingBox();
//         
//         // Set the size and the touch point
//         shadowSize.set(boundingBox.width(), boundingBox.height());
//         shadowTouchPoint.set(boundingBox.width() / 2, boundingBox.height() + 64);
//     }
//     
//     @Override
//     public void onDrawShadow(Canvas canvas)
//     {
//         // Simply draw the math object
//         mathObject.draw(canvas);
//     }
// 
// }
// 
// Path: mathdragon/src/main/java/org/teaminfty/math_dragon/view/math/source/Expression.java
// public abstract class Expression
// {
//     /** A paint that's used to draw an empty box */
//     private Paint paintEmptyBox = new Paint();
//     
//     /** Default constructor */
//     public Expression()
//     {
//         // Initialise the paint
//         paintEmptyBox.setStyle(Paint.Style.STROKE);
//         paintEmptyBox.setPathEffect(new DashPathEffect(new float[] {16.0f, 16.0f}, 0));
//     }
//     
//     /** Creates a new {@link Expression} that can be dragged
//      * @return The new {@link Expression} */
//     public abstract org.teaminfty.math_dragon.view.math.Expression createMathObject();
//     
//     /** Draws the {@link SourceExpression}
//      * @param canvas The canvas to draw on
//      * @param w The maximum width
//      * @param h The maximum height */
//     public abstract void draw(Canvas canvas, int w, int h);
//     
//     /** Helper function to draw a dashed empty box
//      * @param canvas The canvas to draw the box on
//      * @param rect The rectangle that describes the box that is to be drawn */
//     protected void drawEmptyBox(Canvas canvas, Rect rect)
//     {
//         // Copy the rectangle and then make it just a bit smaller
//         Rect copy = new Rect(rect);
//         final int d = (int) Math.ceil(org.teaminfty.math_dragon.view.math.Expression.lineWidth / 2);
//         copy.inset(d, d);
//         
//         // Draw the dashed rectangle
//         paintEmptyBox.setStrokeWidth(org.teaminfty.math_dragon.view.math.Expression.lineWidth);
//         canvas.drawRect(copy, paintEmptyBox);
//     }
// 
//     /** Helper function, returns a rectangle of the given ratio (width : height) that fits exactly in the given maximum rectangle.
//      * @param maxWidth The maximum width of the rectangle
//      * @param maxHeight The maximum height of the rectangle
//      * @param ratio The ratio (width : height)
//      * @return The rectangle fitting in the given maximum size
//      */
//     protected Rect getRectBoundingBox(int maxWidth, int maxHeight, float ratio)
//     {
//         if(maxWidth / ratio <= maxHeight)
//             return new Rect(0, 0, maxWidth, (int) (maxWidth / ratio));
//         else
//             return new Rect(0, 0, (int) (maxHeight * ratio), maxHeight);
//     }
// }


import org.teaminfty.math_dragon.R;
import org.teaminfty.math_dragon.view.MathShadow;
import org.teaminfty.math_dragon.view.math.source.Expression;
import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
package org.teaminfty.math_dragon.view.math;



public class SourceView extends android.view.View
{
    /** The {@link Expression} that will be used as a source for {@link org.teaminfty.math_dragon.view.math.Expression}s */
// Path: mathdragon/src/main/java/org/teaminfty/math_dragon/view/MathShadow.java
// public class MathShadow extends DragShadowBuilder
// {
//     /** The {@link Expression} that is being dragged */
//     private Expression mathObject = null;
// 
//     /** Constructor
//      * @param mo The {@link Expression} that is to be dragged
//      */
//     public MathShadow(Expression mo)
//     {
//         setDragState(mathObject = mo);
//         mathObject.setLevel(0);
//     }
//     
//     /** Recursively sets the DRAG state for the given {@link Expression} and all of its children
//      * @param mo The {@link Expression} to set the DRAG state for */
//     private void setDragState(Expression mo)
//     {
//         // Set the state
//         mo.setState(HoverState.DRAG);
//         
//         // Loop through the children and set their states
//         for(int i = 0; i < mo.getChildCount(); ++i)
//             setDragState(mo.getChild(i));
//     }
//     
//     /** Returns the {@link Expression} in this shadow
//      * @return The {@link Expression} in this shadow */
//     public Expression getExpression()
//     { return mathObject; }
//     
//     /** Returns the bounding box of the current {@link Expression} relative to the touch point
//      * @return The requested bounding box
//      */
//     public Rect getExpressionBounding()
//     {
//         // Calculate the bounding box
//         Rect boundingBox = mathObject.getBoundingBox();
//         
//         // Translate the bounding, so that our touch point becomes the origin
//         boundingBox.offset(-boundingBox.width() / 2, -boundingBox.height() - 64);
//         
//         // Return the result
//         return boundingBox;
//     }
//     
//     @Override
//     public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint)
//     {
//         // Calculate the bounding box
//         Rect boundingBox = mathObject.getBoundingBox();
//         
//         // Set the size and the touch point
//         shadowSize.set(boundingBox.width(), boundingBox.height());
//         shadowTouchPoint.set(boundingBox.width() / 2, boundingBox.height() + 64);
//     }
//     
//     @Override
//     public void onDrawShadow(Canvas canvas)
//     {
//         // Simply draw the math object
//         mathObject.draw(canvas);
//     }
// 
// }
// 
// Path: mathdragon/src/main/java/org/teaminfty/math_dragon/view/math/source/Expression.java
// public abstract class Expression
// {
//     /** A paint that's used to draw an empty box */
//     private Paint paintEmptyBox = new Paint();
//     
//     /** Default constructor */
//     public Expression()
//     {
//         // Initialise the paint
//         paintEmptyBox.setStyle(Paint.Style.STROKE);
//         paintEmptyBox.setPathEffect(new DashPathEffect(new float[] {16.0f, 16.0f}, 0));
//     }
//     
//     /** Creates a new {@link Expression} that can be dragged
//      * @return The new {@link Expression} */
//     public abstract org.teaminfty.math_dragon.view.math.Expression createMathObject();
//     
//     /** Draws the {@link SourceExpression}
//      * @param canvas The canvas to draw on
//      * @param w The maximum width
//      * @param h The maximum height */
//     public abstract void draw(Canvas canvas, int w, int h);
//     
//     /** Helper function to draw a dashed empty box
//      * @param canvas The canvas to draw the box on
//      * @param rect The rectangle that describes the box that is to be drawn */
//     protected void drawEmptyBox(Canvas canvas, Rect rect)
//     {
//         // Copy the rectangle and then make it just a bit smaller
//         Rect copy = new Rect(rect);
//         final int d = (int) Math.ceil(org.teaminfty.math_dragon.view.math.Expression.lineWidth / 2);
//         copy.inset(d, d);
//         
//         // Draw the dashed rectangle
//         paintEmptyBox.setStrokeWidth(org.teaminfty.math_dragon.view.math.Expression.lineWidth);
//         canvas.drawRect(copy, paintEmptyBox);
//     }
// 
//     /** Helper function, returns a rectangle of the given ratio (width : height) that fits exactly in the given maximum rectangle.
//      * @param maxWidth The maximum width of the rectangle
//      * @param maxHeight The maximum height of the rectangle
//      * @param ratio The ratio (width : height)
//      * @return The rectangle fitting in the given maximum size
//      */
//     protected Rect getRectBoundingBox(int maxWidth, int maxHeight, float ratio)
//     {
//         if(maxWidth / ratio <= maxHeight)
//             return new Rect(0, 0, maxWidth, (int) (maxWidth / ratio));
//         else
//             return new Rect(0, 0, (int) (maxHeight * ratio), maxHeight);
//     }
// }


// Path: mathdragon/src/main/java/org/teaminfty/math_dragon/view/math/SourceView.java
import org.teaminfty.math_dragon.R;
import org.teaminfty.math_dragon.view.MathShadow;
import org.teaminfty.math_dragon.view.math.source.Expression;
import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;

package org.teaminfty.math_dragon.view.math;



public class SourceView extends android.view.View
{
    /** The {@link Expression} that will be used as a source for {@link org.teaminfty.math_dragon.view.math.Expression}s */
    private Expression mathSourceObject = null;