Move event-related code to event.{cc,h}.

#802