implement pre_advance event

pre advance event fires before the user sees the advancement dialog.
Implements fr https://gna.org/bugs/?21464
Merge pull request #264 from gfgtdf/preadvance

implement pre_advance event (https://gna.org/bugs/?21464)