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

package rec.core;


///////////////////////////////////////////////////////////////////////////////
//
// FILE:	ModifyGroupModule.java
//
// AUTHOR:	Manoj D. Muzumdar
//		archon@ai.mit.edu
//
// DATE:	10-XX-98
//
// COPYRIGHT:	Massachusetts Institute of Technology
//		All rights reserved.
//
// PURPOSE:	Drawing recognition
//
// HISTORY:
//
///////////////////////////////////////////////////////////////////////////////


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

// bail stuff available in the BAIL_STUFF version.

public class ModifyGroupModule extends ModifyModeModule
{
  public ModifyGroupModule( Surface surf,
			    WSelection targetWidget )
  {
    super( "ModifyGroup", targetWidget );

    Assert.check( targetWidget.getWidget() instanceof WGroup,
		  "ModifyGroupModule must consist of a group of widgets!" );
    
    if ( targetWidget.getWidget() instanceof WCircleGroup )
      {
	remove( m_DeleteTargetRecognizer );
	m_DeleteTargetRecognizer = new DeleteGroupRecognizer( targetWidget );
	add( m_DeleteTargetRecognizer );	

	// for the delete recognizer.
	add( new LooseLineRecognizer() );
	// consumers don't make sense anymore, but we may need to restore
	// this consumers functionality.  -cja 9/8/99
	//add( m_SquiggleConsumer );
      }
  }

  public boolean recognizeWidget( Surface s, Widget w )
  {

    // put this stuff back (if necesary) when the registry stuff works again.
    
    //    if ( m_bFirstPass )
   //     {
//  	// HACK!
//  	Console.writeln( "Registering group with itself so it can alter subwidgets." );
//  	s.register( (Registerable)m_TargetWidget, m_TargetWidget );
//        }


    return super.recognizeWidget( s, w );
  }

}
