X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fcontrolpanel.cpp;h=5b62e9167cade63ad95f55c92915b9ae703b594e;hp=41013d0bea1406e3cf2e005c1138808d8fd3aa6e;hb=d83560835237d360f6d12776435e91676c8ab45f;hpb=398e6b2732decd57cdb57deb3f91d3ff08669e8b;ds=sidebyside diff --git a/src/controlpanel.cpp b/src/controlpanel.cpp index 41013d0..5b62e91 100644 --- a/src/controlpanel.cpp +++ b/src/controlpanel.cpp @@ -95,6 +95,16 @@ QMenu * ControlPanel::CreateViewMenu() view->addAction(m_view_set_bounds); connect(m_view_set_bounds, SIGNAL(triggered()), this, SLOT(SetViewBounds())); + m_view_show_object_bounds = new QAction("&Show Object Bounds", this); + m_view_show_object_bounds->setCheckable(true); + view->addAction(m_view_show_object_bounds); + connect(m_view_show_object_bounds, SIGNAL(triggered()), this, SLOT(ToggleShowObjectBounds())); + + m_view_enable_shading = new QAction("&Enable Shading", this); + m_view_enable_shading->setCheckable(true); + view->addAction(m_view_enable_shading); + connect(m_view_enable_shading, SIGNAL(triggered()), this, SLOT(ToggleEnableShading())); + return view; } @@ -147,6 +157,9 @@ void ControlPanel::UpdateAll() m_screen_cpu_rendering->setChecked(!using_gpu_rendering); m_screen_show_debug->setChecked(m_screen.DebugFontShown()); + m_view_show_object_bounds->setChecked(m_view.ShowingObjectBounds()); + m_view_enable_shading->setChecked(m_view.PerformingShading()); + // update things based on state const char * title; const char * tooltip; @@ -187,6 +200,20 @@ void ControlPanel::UpdateAll() setToolTip(tooltip); } +void ControlPanel::ToggleShowObjectBounds() +{ + bool state = m_view.ShowingObjectBounds(); + m_view.ShowObjectBounds(!state); + UpdateAll(); +} + +void ControlPanel::ToggleEnableShading() +{ + bool state = m_view.PerformingShading(); + m_view.PerformShading(!state); + UpdateAll(); +} + void ControlPanel::SetGPURendering() { m_view.SetGPURendering(true); @@ -224,14 +251,13 @@ void ControlPanel::SetViewBounds() void ControlPanel::InsertTextIntoDocument() { const Rect & bounds = m_view.GetBounds(); - Real xx = bounds.x + bounds.w/Real(2); + Real xx = bounds.x; Real yy = bounds.y + bounds.h/Real(2); string msg = m_text_edit->toPlainText().toStdString(); - Real scale = bounds.w / Real(2); + Real scale = bounds.h / 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_doc.AddText(msg, scale, xx, yy); m_view.ForceRenderDirty(); m_view.ForceBufferDirty(); m_view.ForceBoundsDirty();