-- The change whereby a piece is removed from the design room.

class
	RETURN

inherit
  CHANGE

creation
  make

feature{NONE}

  make( is_fg : BOOLEAN ; p : PALETTE_PIECE ; c : DESIGN_CELL ) is
  do
    piece := p
    is_foreground := is_fg
    cell := c
  end

feature

  piece : PALETTE_PIECE
  -- Palette piece associated with the removed
  -- design piece.

  is_foreground : BOOLEAN
  -- is the design piece that's being returned a foreground piece?

  cell : DESIGN_CELL
  -- Cell from which the piece was removed.

  undo is
  -- Put a new design piece back where the old one was.
  require else
    is_foreground implies not cell.foreground_piece_exists
    not is_foreground implies not cell.background_piece_exists
  do
    piece.target.accept( piece, cell )
  end

  redo is
  require else
    is_foreground implies cell.foreground_piece_exists
    not is_foreground implies cell.background_piece_exists
  do
    if is_foreground then
      cell.foreground_piece.return
    else
      cell.background_piece.return
    end
  end


end 
 
