
//
// Boiler Draw Event Listener that allows undo and redo.
// You need to store the events in a double linked list
// and respond to the Undo/Redo messages by clearing
// Boiler Draw with "New" and replaying the events.
//

class BoilerDrawUndoListener implements BoilerDrawListener {

    BoilerDraw _bDraw;

    BoilerDrawUndoListener( BoilerDraw bDraw ) {
	_bDraw = bDraw;
    }

    public void mouseDragged( int x, int y ) {
	System.out.println("mouseDragged: x=" + x + " y=" + y );
	_bDraw.mouseDragged( x, y );
    }

    public void mousePressed( int x, int y ) {
	System.out.println("mousePressed: x=" + x + " y=" + y );
	_bDraw.mousePressed( x, y );
    }

    public void mouseReleased( int x, int y ) {
	System.out.println("mouseReleased: x=" + x + " y=" + y );
	_bDraw.mouseReleased( x, y );
    }

    public void menuOption( String option ) {
	System.out.println("menuOption: option=" + option );
	_bDraw.menuOption( option );
    }

    public void openFile( String fileName ) {
	System.out.println("openFile: fileName=" + fileName );
	_bDraw.openFile( fileName );
    }

    public void saveFile( String fileName ) {
	System.out.println("saveFile: fileName=" + fileName );
	_bDraw.saveFile( fileName );
    }

    public void addText( String text ) {
	System.out.println("addText: text=" + text );
	_bDraw.addText( text );
    }
};

