Move macro-related code to different files

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Added events for editor (INCOMPLETE YET)

Signed-off-by: Slava Zanko <slavazanko@gmail.com>