Mercurial > hg > svgui
comparison view/Pane.cpp @ 260:6d113226bb4c
* a bit more work on measurement tool mode
* use arrow cursors on thumbwheels and panner in pane HUD
author | Chris Cannam |
---|---|
date | Thu, 14 Jun 2007 15:20:49 +0000 |
parents | 2d891e02c5ce |
children | 11021509c4eb |
comparison
equal
deleted
inserted
replaced
259:2d891e02c5ce | 260:6d113226bb4c |
---|---|
100 layout->setSpacing(0); | 100 layout->setSpacing(0); |
101 m_headsUpDisplay->setLayout(layout); | 101 m_headsUpDisplay->setLayout(layout); |
102 | 102 |
103 m_hthumb = new Thumbwheel(Qt::Horizontal); | 103 m_hthumb = new Thumbwheel(Qt::Horizontal); |
104 m_hthumb->setObjectName(tr("Horizontal Zoom")); | 104 m_hthumb->setObjectName(tr("Horizontal Zoom")); |
105 m_hthumb->setCursor(Qt::ArrowCursor); | |
105 layout->addWidget(m_hthumb, 1, 0, 1, 2); | 106 layout->addWidget(m_hthumb, 1, 0, 1, 2); |
106 m_hthumb->setFixedWidth(70); | 107 m_hthumb->setFixedWidth(70); |
107 m_hthumb->setFixedHeight(16); | 108 m_hthumb->setFixedHeight(16); |
108 m_hthumb->setDefaultValue(0); | 109 m_hthumb->setDefaultValue(0); |
109 m_hthumb->setSpeed(0.6); | 110 m_hthumb->setSpeed(0.6); |
111 SLOT(horizontalThumbwheelMoved(int))); | 112 SLOT(horizontalThumbwheelMoved(int))); |
112 connect(m_hthumb, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | 113 connect(m_hthumb, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); |
113 connect(m_hthumb, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | 114 connect(m_hthumb, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); |
114 | 115 |
115 m_vpan = new Panner; | 116 m_vpan = new Panner; |
117 m_vpan->setCursor(Qt::ArrowCursor); | |
116 layout->addWidget(m_vpan, 0, 1); | 118 layout->addWidget(m_vpan, 0, 1); |
117 m_vpan->setFixedWidth(12); | 119 m_vpan->setFixedWidth(12); |
118 m_vpan->setFixedHeight(70); | 120 m_vpan->setFixedHeight(70); |
119 m_vpan->setAlpha(80, 130); | 121 m_vpan->setAlpha(80, 130); |
120 connect(m_vpan, SIGNAL(rectExtentsChanged(float, float, float, float)), | 122 connect(m_vpan, SIGNAL(rectExtentsChanged(float, float, float, float)), |
124 connect(m_vpan, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | 126 connect(m_vpan, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); |
125 connect(m_vpan, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | 127 connect(m_vpan, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); |
126 | 128 |
127 m_vthumb = new Thumbwheel(Qt::Vertical); | 129 m_vthumb = new Thumbwheel(Qt::Vertical); |
128 m_vthumb->setObjectName(tr("Vertical Zoom")); | 130 m_vthumb->setObjectName(tr("Vertical Zoom")); |
131 m_vthumb->setCursor(Qt::ArrowCursor); | |
129 layout->addWidget(m_vthumb, 0, 2); | 132 layout->addWidget(m_vthumb, 0, 2); |
130 m_vthumb->setFixedWidth(16); | 133 m_vthumb->setFixedWidth(16); |
131 m_vthumb->setFixedHeight(70); | 134 m_vthumb->setFixedHeight(70); |
132 connect(m_vthumb, SIGNAL(valueChanged(int)), this, | 135 connect(m_vthumb, SIGNAL(valueChanged(int)), this, |
133 SLOT(verticalThumbwheelMoved(int))); | 136 SLOT(verticalThumbwheelMoved(int))); |
138 RangeMapper *rm = layer->getNewVerticalZoomRangeMapper(); | 141 RangeMapper *rm = layer->getNewVerticalZoomRangeMapper(); |
139 if (rm) m_vthumb->setRangeMapper(rm); | 142 if (rm) m_vthumb->setRangeMapper(rm); |
140 } | 143 } |
141 | 144 |
142 m_reset = new NotifyingPushButton; | 145 m_reset = new NotifyingPushButton; |
146 m_reset->setCursor(Qt::ArrowCursor); | |
143 m_reset->setFixedHeight(16); | 147 m_reset->setFixedHeight(16); |
144 m_reset->setFixedWidth(16); | 148 m_reset->setFixedWidth(16); |
145 layout->addWidget(m_reset, 1, 2); | 149 layout->addWidget(m_reset, 1, 2); |
146 connect(m_reset, SIGNAL(clicked()), m_hthumb, SLOT(resetToDefault())); | 150 connect(m_reset, SIGNAL(clicked()), m_hthumb, SLOT(resetToDefault())); |
147 connect(m_reset, SIGNAL(clicked()), m_vthumb, SLOT(resetToDefault())); | 151 connect(m_reset, SIGNAL(clicked()), m_vthumb, SLOT(resetToDefault())); |
733 } | 737 } |
734 } | 738 } |
735 } | 739 } |
736 | 740 |
737 if (m_clickedInRange && m_manager) { | 741 if (m_clickedInRange && m_manager) { |
738 if ((m_shiftPressed && toolMode == ViewManager::NavigateMode) || | 742 |
739 toolMode == ViewManager::MeasureMode) { | 743 //!!! be nice if this looked a bit more in keeping with the |
740 //!!! be nice if this looked a bit more in keeping with the | 744 //selection block |
741 //selection block | 745 |
742 paint.setPen(toolMode == ViewManager::MeasureMode ? Qt::green : | 746 if (m_shiftPressed && toolMode == ViewManager::NavigateMode) { |
743 Qt::blue); | 747 |
748 paint.setPen(Qt::blue); | |
749 //!!! shouldn't use clickPos -- needs to use a clicked frame | |
750 paint.drawRect(m_clickPos.x(), m_clickPos.y(), | |
751 m_mousePos.x() - m_clickPos.x(), | |
752 m_mousePos.y() - m_clickPos.y()); | |
753 | |
754 } else if (toolMode == ViewManager::MeasureMode && topLayer) { | |
755 | |
756 float v0, v1; | |
757 QString u0, u1; | |
758 bool b0, b1; | |
759 | |
760 if ((b0 = topLayer->getXScaleValue(this, m_clickPos.x(), v0, u0))) { | |
761 drawVisibleText(paint, | |
762 m_clickPos.x() + 2, | |
763 m_clickPos.y() + fontAscent + 2, | |
764 QString("%1 %2").arg(v0).arg(u0), | |
765 OutlinedText); | |
766 | |
767 if ((b1 = topLayer->getXScaleValue(this, m_mousePos.x(), v1, u1)) | |
768 && u1 == u0) { | |
769 QString t = QString("%1 %2").arg(v1 - v0).arg(u1); | |
770 drawVisibleText(paint, | |
771 m_mousePos.x() - paint.fontMetrics().width(t) - 2, | |
772 m_mousePos.y() - 2, | |
773 t, | |
774 OutlinedText); | |
775 } | |
776 } | |
777 | |
778 paint.setPen(Qt::green); | |
779 | |
744 //!!! shouldn't use clickPos -- needs to use a clicked frame | 780 //!!! shouldn't use clickPos -- needs to use a clicked frame |
745 paint.drawRect(m_clickPos.x(), m_clickPos.y(), | 781 paint.drawRect(m_clickPos.x(), m_clickPos.y(), |
746 m_mousePos.x() - m_clickPos.x(), | 782 m_mousePos.x() - m_clickPos.x(), |
747 m_mousePos.y() - m_clickPos.y()); | 783 m_mousePos.y() - m_clickPos.y()); |
748 } | 784 } |