Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
228:1c4c9e3e44e6 | 229:387f2f6fc333 |
---|---|
701 | 701 |
702 paint.end(); | 702 paint.end(); |
703 } | 703 } |
704 | 704 |
705 bool | 705 bool |
706 Pane::render(QPainter &paint, QRect rect) | 706 Pane::render(QPainter &paint, int xorigin, size_t f0, size_t f1) |
707 { | 707 { |
708 if (!View::render(paint, QRect(rect.x() + m_scaleWidth, rect.y(), | 708 if (!View::render(paint, xorigin + m_scaleWidth, f0, f1)) { |
709 rect.width() - m_scaleWidth, rect.height()))) { | |
710 return false; | 709 return false; |
711 } | 710 } |
712 | 711 |
713 if (m_scaleWidth > 0) { | 712 if (m_scaleWidth > 0) { |
714 | 713 |
717 | 716 |
718 paint.save(); | 717 paint.save(); |
719 | 718 |
720 paint.setPen(Qt::black); | 719 paint.setPen(Qt::black); |
721 paint.setBrush(Qt::white); | 720 paint.setBrush(Qt::white); |
722 paint.drawRect(0, -1, m_scaleWidth, height()+1); | 721 paint.drawRect(xorigin, -1, m_scaleWidth, height()+1); |
723 | 722 |
724 paint.setBrush(Qt::NoBrush); | 723 paint.setBrush(Qt::NoBrush); |
725 (*vi)->paintVerticalScale | 724 (*vi)->paintVerticalScale |
726 (this, paint, QRect(0, 0, m_scaleWidth, height())); | 725 (this, paint, QRect(xorigin, 0, m_scaleWidth, height())); |
727 | 726 |
728 paint.restore(); | 727 paint.restore(); |
729 break; | 728 break; |
730 } | 729 } |
731 } | 730 } |
732 | 731 |
733 return true; | 732 return true; |
734 } | 733 } |
735 | 734 |
736 QImage * | 735 QImage * |
737 Pane::toNewImage() | 736 Pane::toNewImage(size_t f0, size_t f1) |
738 { | 737 { |
739 size_t f0 = getModelsStartFrame(); | |
740 size_t f1 = getModelsEndFrame(); | |
741 | |
742 size_t x0 = f0 / getZoomLevel(); | 738 size_t x0 = f0 / getZoomLevel(); |
743 size_t x1 = f1 / getZoomLevel(); | 739 size_t x1 = f1 / getZoomLevel(); |
744 | 740 |
745 QImage *image = new QImage(x1 - x0 + m_scaleWidth, | 741 QImage *image = new QImage(x1 - x0 + m_scaleWidth, |
746 height(), QImage::Format_RGB32); | 742 height(), QImage::Format_RGB32); |
763 image = new QImage(x1 - x0 + m_scaleWidth, | 759 image = new QImage(x1 - x0 + m_scaleWidth, |
764 height(), QImage::Format_RGB32); | 760 height(), QImage::Format_RGB32); |
765 } | 761 } |
766 | 762 |
767 QPainter *paint = new QPainter(image); | 763 QPainter *paint = new QPainter(image); |
768 if (!render(*paint, image->rect())) { | 764 if (!render(*paint, 0, f0, f1)) { |
769 delete paint; | 765 delete paint; |
770 delete image; | 766 delete image; |
771 return 0; | 767 return 0; |
772 } else { | 768 } else { |
773 delete paint; | 769 delete paint; |
774 return image; | 770 return image; |
775 } | 771 } |
772 } | |
773 | |
774 QSize | |
775 Pane::getImageSize(size_t f0, size_t f1) | |
776 { | |
777 QSize s = View::getImageSize(f0, f1); | |
778 QImage *image = new QImage(100, 100, QImage::Format_RGB32); | |
779 QPainter paint(image); | |
780 | |
781 int sw = 0; | |
782 if (m_manager && m_manager->shouldShowVerticalScale()) { | |
783 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { | |
784 --vi; | |
785 QPainter paint(image); | |
786 sw = (*vi)->getVerticalScaleWidth(this, paint); | |
787 break; | |
788 } | |
789 } | |
790 | |
791 return QSize(sw + s.width(), s.height()); | |
776 } | 792 } |
777 | 793 |
778 size_t | 794 size_t |
779 Pane::getFirstVisibleFrame() const | 795 Pane::getFirstVisibleFrame() const |
780 { | 796 { |