+void ControlPanel::ToggleScreenDebugFont()
+{
+ bool state = m_screen.DebugFontShown();
+ m_screen.ShowDebugFont(!state);
+ UpdateAll();
+
+}
+
+void ControlPanel::SetViewBounds()
+{
+ bool ok;
+ Real xx = QInputDialog::getDouble(this, "View X Coordinate", "Enter X coordinate:", 0, -2e-30, 2e30,30,&ok);
+
+ Real yy = QInputDialog::getDouble(this, "View Y Coordinate", "Enter Y coordinate:", 0, -2e-30, 2e30,30,&ok);
+
+ Real w = QInputDialog::getDouble(this, "View Width", "Enter Width:", 1, -2e-30, 2e30,30,&ok);
+
+ Real h = QInputDialog::getDouble(this, "View Height", "Enter Height:", 1, -2e-30, 2e30,30,&ok);
+ m_view.SetBounds(Rect(xx,yy,w,h));
+
+}
+
+void ControlPanel::InsertTextIntoDocument()
+{
+ const Rect & bounds = m_view.GetBounds();
+ Real xx = bounds.x + bounds.w/Real(2);
+ Real yy = bounds.y + bounds.h/Real(2);
+
+ string msg = m_text_edit->toPlainText().toStdString();
+ Real scale = bounds.w / Real(2);
+ Debug("Insert \"%s\" at %f, %f, scale %f", msg.c_str(), Float(xx), Float(yy), Float(scale));
+ //m_doc.Add(RECT_OUTLINE, bounds, 0); // debugging; text needs to go in the boujnds
+ m_doc.AddText(msg, xx, yy, scale);
+ m_view.ForceRenderDirty();
+ m_view.ForceBufferDirty();
+ m_view.ForceBoundsDirty();
+}
+void ControlPanel::InsertSVGIntoDocument()
+{
+ Rect bounds(m_view.GetBounds());
+ bounds.w /= Real(m_screen.ViewportWidth());
+ bounds.h /= Real(m_screen.ViewportHeight());
+
+ m_doc.ParseSVG(m_text_edit->toPlainText().toStdString(), bounds);
+ m_view.ForceRenderDirty();
+ m_view.ForceBufferDirty();
+ m_view.ForceBoundsDirty();
+}
+
+void ControlPanel::LoadSVGIntoDocument()
+{
+
+ QString filename = QFileDialog::getOpenFileName(this, "Open SVG", "svg-tests", "Image Files (*.svg)");
+ if (filename == "")
+ return;
+
+ Rect bounds(m_view.GetBounds());
+ bounds.w /= Real(m_screen.ViewportWidth());
+ bounds.h /= Real(m_screen.ViewportHeight());
+
+ m_doc.LoadSVG(filename.toStdString(), bounds);
+ m_view.ForceRenderDirty();
+ m_view.ForceBufferDirty();
+ m_view.ForceBoundsDirty();
+}
+
+void ControlPanel::SetDocumentFont()
+{
+ QString filename = QFileDialog::getOpenFileName(this, "Set Font", "fonts", "True Type Fonts (*.ttf)");
+ if (filename != "")
+ m_doc.SetFont(filename.toStdString());
+}
+