Mercurial > hg > svgui
comparison view/Pane.cpp @ 248:28c8e8e3c537
* Fix many compile warnings, remove some debug output
author | Chris Cannam |
---|---|
date | Mon, 30 Apr 2007 13:36:23 +0000 |
parents | 5105be027d8e |
children | e175ade2d6b0 |
comparison
equal
deleted
inserted
replaced
247:0e9f59f991aa | 248:28c8e8e3c537 |
---|---|
550 drawVisibleText(paint, x, y, text, OutlinedText); | 550 drawVisibleText(paint, x, y, text, OutlinedText); |
551 } | 551 } |
552 | 552 |
553 QString text = QString("%1").arg(m_centreFrame); | 553 QString text = QString("%1").arg(m_centreFrame); |
554 | 554 |
555 int tw = paint.fontMetrics().width(text); | |
556 int x = width()/2 + 4; | 555 int x = width()/2 + 4; |
557 | 556 |
558 drawVisibleText(paint, x, y, text, OutlinedText); | 557 drawVisibleText(paint, x, y, text, OutlinedText); |
559 } | 558 } |
560 | 559 |
602 } | 601 } |
603 } | 602 } |
604 | 603 |
605 if (m_manager && | 604 if (m_manager && |
606 m_manager->shouldShowLayerNames() && | 605 m_manager->shouldShowLayerNames() && |
607 r.y() + r.height() >= height() - m_layers.size() * fontHeight - 6) { | 606 r.y() + r.height() >= height() - int(m_layers.size()) * fontHeight - 6) { |
608 | 607 |
609 std::vector<QString> texts; | 608 std::vector<QString> texts; |
610 int maxTextWidth = 0; | 609 int maxTextWidth = 0; |
611 | 610 |
612 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 611 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { |
639 llx -= 36; | 638 llx -= 36; |
640 } | 639 } |
641 | 640 |
642 if (r.x() + r.width() >= llx) { | 641 if (r.x() + r.width() >= llx) { |
643 | 642 |
644 for (int i = 0; i < texts.size(); ++i) { | 643 for (size_t i = 0; i < texts.size(); ++i) { |
645 | 644 |
646 if (i == texts.size() - 1) { | 645 if (i + 1 == texts.size()) { |
647 paint.setPen(Qt::black); | 646 paint.setPen(Qt::black); |
648 } | 647 } |
649 | 648 |
650 drawVisibleText(paint, llx, | 649 drawVisibleText(paint, llx, |
651 lly - fontHeight + fontAscent, | 650 lly - fontHeight + fontAscent, |
1293 float vmin = 0.f, vmax = 0.f; | 1292 float vmin = 0.f, vmax = 0.f; |
1294 float dmin = 0.f, dmax = 0.f; | 1293 float dmin = 0.f, dmax = 0.f; |
1295 | 1294 |
1296 if (getTopLayerDisplayExtents(vmin, vmax, dmin, dmax)) { | 1295 if (getTopLayerDisplayExtents(vmin, vmax, dmin, dmax)) { |
1297 | 1296 |
1298 std::cerr << "ydiff = " << ydiff << std::endl; | 1297 // std::cerr << "ydiff = " << ydiff << std::endl; |
1299 | 1298 |
1300 float perpix = (dmax - dmin) / height(); | 1299 float perpix = (dmax - dmin) / height(); |
1301 float valdiff = ydiff * perpix; | 1300 float valdiff = ydiff * perpix; |
1302 std::cerr << "valdiff = " << valdiff << std::endl; | 1301 // std::cerr << "valdiff = " << valdiff << std::endl; |
1303 | 1302 |
1304 float newmin = m_dragStartMinValue + valdiff; | 1303 float newmin = m_dragStartMinValue + valdiff; |
1305 float newmax = m_dragStartMinValue + (dmax - dmin) + valdiff; | 1304 float newmax = m_dragStartMinValue + (dmax - dmin) + valdiff; |
1306 if (newmin < vmin) { | 1305 if (newmin < vmin) { |
1307 newmax += vmin - newmin; | 1306 newmax += vmin - newmin; |
1309 } | 1308 } |
1310 if (newmax > vmax) { | 1309 if (newmax > vmax) { |
1311 newmin -= newmax - vmax; | 1310 newmin -= newmax - vmax; |
1312 newmax -= newmax - vmax; | 1311 newmax -= newmax - vmax; |
1313 } | 1312 } |
1314 std::cerr << "(" << dmin << ", " << dmax << ") -> (" | 1313 // std::cerr << "(" << dmin << ", " << dmax << ") -> (" |
1315 << newmin << ", " << newmax << ") (drag start " << m_dragStartMinValue << ")" << std::endl; | 1314 // << newmin << ", " << newmax << ") (drag start " << m_dragStartMinValue << ")" << std::endl; |
1316 | 1315 |
1317 setTopLayerDisplayExtents(newmin, newmax); | 1316 setTopLayerDisplayExtents(newmin, newmax); |
1318 updateVerticalPanner(); | 1317 updateVerticalPanner(); |
1319 } | 1318 } |
1320 } | 1319 } |
1341 if (snapFrameLeft < 0) snapFrameLeft = 0; | 1340 if (snapFrameLeft < 0) snapFrameLeft = 0; |
1342 if (snapFrameRight < 0) snapFrameRight = 0; | 1341 if (snapFrameRight < 0) snapFrameRight = 0; |
1343 | 1342 |
1344 size_t min, max; | 1343 size_t min, max; |
1345 | 1344 |
1346 if (m_selectionStartFrame > snapFrameLeft) { | 1345 if (m_selectionStartFrame > size_t(snapFrameLeft)) { |
1347 min = snapFrameLeft; | 1346 min = snapFrameLeft; |
1348 max = m_selectionStartFrame; | 1347 max = m_selectionStartFrame; |
1349 } else if (snapFrameRight > m_selectionStartFrame) { | 1348 } else if (size_t(snapFrameRight) > m_selectionStartFrame) { |
1350 min = m_selectionStartFrame; | 1349 min = m_selectionStartFrame; |
1351 max = snapFrameRight; | 1350 max = snapFrameRight; |
1352 } else { | 1351 } else { |
1353 min = snapFrameLeft; | 1352 min = snapFrameLeft; |
1354 max = snapFrameRight; | 1353 max = snapFrameRight; |
1370 if (offset >= available * 0.95) { | 1369 if (offset >= available * 0.95) { |
1371 int move = int(offset - available * 0.95) + 1; | 1370 int move = int(offset - available * 0.95) + 1; |
1372 setCentreFrame(m_centreFrame + move); | 1371 setCentreFrame(m_centreFrame + move); |
1373 } else if (offset <= available * 0.10) { | 1372 } else if (offset <= available * 0.10) { |
1374 int move = int(available * 0.10 - offset) + 1; | 1373 int move = int(available * 0.10 - offset) + 1; |
1375 if (m_centreFrame > move) { | 1374 if (move < 0) { |
1375 setCentreFrame(m_centreFrame + (-move)); | |
1376 } else if (m_centreFrame > move) { | |
1376 setCentreFrame(m_centreFrame - move); | 1377 setCentreFrame(m_centreFrame - move); |
1377 } else { | 1378 } else { |
1378 setCentreFrame(0); | 1379 setCentreFrame(0); |
1379 } | 1380 } |
1380 } | 1381 } |
1625 update(); | 1626 update(); |
1626 return true; | 1627 return true; |
1627 } | 1628 } |
1628 | 1629 |
1629 bool | 1630 bool |
1630 Pane::editSelectionEnd(QMouseEvent *e) | 1631 Pane::editSelectionEnd(QMouseEvent *) |
1631 { | 1632 { |
1632 if (m_editingSelection.isEmpty()) return false; | 1633 if (m_editingSelection.isEmpty()) return false; |
1633 | 1634 |
1634 int offset = m_mousePos.x() - m_clickPos.x(); | 1635 int offset = m_mousePos.x() - m_clickPos.x(); |
1635 Layer *layer = getSelectedLayer(); | 1636 Layer *layer = getSelectedLayer(); |