// (c) MIT 2003.  All rights reserved.

package rec.house;


import java.util.*;
import rec.sys.*;
import rec.util.*;
import rec.core.*;

public class DragModifyModeRecognizer extends Recognizer
{
  private boolean m_HaveRotator = true;

  public DragModifyModeRecognizer()
  {
    this.m_HaveRotator = true;
  }

  public DragModifyModeRecognizer( String have_rotator )
  {
    this.m_HaveRotator =  have_rotator.startsWith( "t" );
    Console.writeln( "arg passed module-" + m_HaveRotator );
  }

  public DragModifyModeRecognizer( boolean have_rotator )
  {
    this.m_HaveRotator = have_rotator;
  }

  ///////////////////////////////////////////////////////////////////////////

  public boolean recognize( Surface s, Widget w )
  {
    WSelection sl = (WSelection)w;

    Widget wl = sl.getWidget();

    ModifyModeModule m = null;
    if ( wl instanceof rec.core.WGroup )
      m = new ModifyGroupModule( s, sl );
    else
      m = new ModifyModeModule( sl );

    // commented out because luke hated the rotation function
    //    if ( ! m_HaveRotator )
    // m.remove( m.m_RotateTargetRecognizer );

    // add dragging capabilities
    m.add( new MoveContainRecognizer() );

    s.addRecognizerModule( m );

    return( true );
  }

  public Iterator getInputTypes()
  {
    Vector v = new Vector();

    v.addElement( "rec.core.WSelection" );

    return( v.iterator() );
  }

  public Iterator getOutputTypes()
  {
    return( null );
  }
}

////////////////////////////////////////////////////////////////////////////////
