added debug statement
using textdocument in calls to viewer or add_content
fix so render_all not called from repaint_all method but in repaint.