 class EditorView: NSView {
     
     // MARK: Defined types
+    
+    enum DragState: Int {
+        case Started
+        case DraggingFromLeft, DraggingFromRight
+        case Ended
+    }
+    
     struct LevelGroup {
         let levels: Float[]
         var average: Float {

            return height
        }
        
        var startPointX = Int(CGRectGetMidX(bounds)) - Int(optimumWidth / 2)
        let currentContext: CGContextRef = Unmanaged<CGContext>.fromOpaque(NSGraphicsContext.currentContext().graphicsPort()).takeUnretainedValue()
        
        CGContextSetLineWidth(currentContext, 1.0)

    // MARK: instance variables
    var minimumPower: Float = 0
    var maximumPower: Float = 160.0
    var canvasWidth: CGFloat = 0
    var levelGroups: LevelGroup[] = []
    var levelOffset: Float = 0
    var trimView: NSView?
    var dragState = DragState.Ended
    var previousPoint = CGPointZero
    var firstBandX: CGFloat {
    return CGRectGetMidX(bounds) - CGFloat(canvasWidth / 2)
    }
    var canvasRect: CGRect {
    return CGRectMake(firstBandX, 0.0, canvasWidth, bounds.size.height)
    }
    
    // MARK: properties
    var audioLevels: Float[] = [] {
