package net.mkonrad.synes.ctrl;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseWheelEvent;

import net.mkonrad.synes.data.Layer;
import net.mkonrad.synes.util.DbgTools;

public class SynthObjAttribCtrl extends MouseAdapter
{
  private AbstractPickableObj _ctrl;
  
  public SynthObjAttribCtrl(AbstractPickableObj ctrl)
  {
    _ctrl = ctrl;
  }
  
  public void mouseWheelMoved(MouseWheelEvent wheel)
  {
    //_ctrl.getPickCtrl().getCoreCtrl().disableOrbitCtrl();
    
    if (_ctrl.getPickCtrl().getState() != CentralPickingCtrl.STATE_GRAPH_CREATE &&
        _ctrl.getPickCtrl().getState() != CentralPickingCtrl.STATE_GRAPH_EDIT)
    {
      return;
    }
    
    int layerType = _ctrl.getPickCtrl().getCoreCtrl().getCurrLayer().getType();
    boolean changeAmp = _ctrl.getPickCtrl().getMouseState() != CentralPickingCtrl.MOUSE_NOCLICK;
    
    if (wheel.getWheelRotation() < 0)
    {
      if (changeAmp)
      {
        _ctrl.changeSynthObjAmp(1);
      }
      else if (layerType == Layer.TYPE_SEQUENCER)
      {
        ((SeqLayerPickingCtrl) _ctrl).changeBeatDur(1);
      }
    } else
    {
      if (changeAmp)
      {
        _ctrl.changeSynthObjAmp(-1);
      }
      else if (layerType == Layer.TYPE_SEQUENCER)
      {
        ((SeqLayerPickingCtrl) _ctrl).changeBeatDur(-1);
      }
    }
  }
}
