Replace layout and drawing macros with constants and inline functions.