1) we had just heard the news when you rang.
2) I had already thought of that before you suggested it.
3) When I turned TV the programme had already started.
4) she was hungry because she hadn't eaten anything all day.
5) by the time I left school I had decided to become a musician.