Mercurial > hg > svgui
diff view/Pane.cpp @ 229:387f2f6fc333 sv1-1.0pre2
* Remove tip dialog for now. I don't like it enough
* Fixes to export image
author | Chris Cannam |
---|---|
date | Wed, 14 Mar 2007 14:39:39 +0000 |
parents | 6dab3ac2fe73 |
children | 5de07bba4676 |
line wrap: on
line diff
--- a/view/Pane.cpp Tue Mar 13 19:51:09 2007 +0000 +++ b/view/Pane.cpp Wed Mar 14 14:39:39 2007 +0000 @@ -703,10 +703,9 @@ } bool -Pane::render(QPainter &paint, QRect rect) +Pane::render(QPainter &paint, int xorigin, size_t f0, size_t f1) { - if (!View::render(paint, QRect(rect.x() + m_scaleWidth, rect.y(), - rect.width() - m_scaleWidth, rect.height()))) { + if (!View::render(paint, xorigin + m_scaleWidth, f0, f1)) { return false; } @@ -719,11 +718,11 @@ paint.setPen(Qt::black); paint.setBrush(Qt::white); - paint.drawRect(0, -1, m_scaleWidth, height()+1); + paint.drawRect(xorigin, -1, m_scaleWidth, height()+1); paint.setBrush(Qt::NoBrush); (*vi)->paintVerticalScale - (this, paint, QRect(0, 0, m_scaleWidth, height())); + (this, paint, QRect(xorigin, 0, m_scaleWidth, height())); paint.restore(); break; @@ -734,11 +733,8 @@ } QImage * -Pane::toNewImage() +Pane::toNewImage(size_t f0, size_t f1) { - size_t f0 = getModelsStartFrame(); - size_t f1 = getModelsEndFrame(); - size_t x0 = f0 / getZoomLevel(); size_t x1 = f1 / getZoomLevel(); @@ -765,7 +761,7 @@ } QPainter *paint = new QPainter(image); - if (!render(*paint, image->rect())) { + if (!render(*paint, 0, f0, f1)) { delete paint; delete image; return 0; @@ -775,6 +771,26 @@ } } +QSize +Pane::getImageSize(size_t f0, size_t f1) +{ + QSize s = View::getImageSize(f0, f1); + QImage *image = new QImage(100, 100, QImage::Format_RGB32); + QPainter paint(image); + + int sw = 0; + if (m_manager && m_manager->shouldShowVerticalScale()) { + for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { + --vi; + QPainter paint(image); + sw = (*vi)->getVerticalScaleWidth(this, paint); + break; + } + } + + return QSize(sw + s.width(), s.height()); +} + size_t Pane::getFirstVisibleFrame() const {