comparison view/Pane.cpp @ 790:7555b8b17e6e tonioni

Move play pointer on single-click in pane in navigate mode
author Chris Cannam
date Thu, 12 Jun 2014 13:14:18 +0100
parents 488add397d34
children 584b11df8e4f
comparison
equal deleted inserted replaced
789:9fd1bdf214dd 790:7555b8b17e6e
1431 1431
1432 if (m_clickedInRange) { 1432 if (m_clickedInRange) {
1433 mouseMoveEvent(e); 1433 mouseMoveEvent(e);
1434 } 1434 }
1435 1435
1436 int mouseFrame = e ? getFrameForX(e->x()) : 0;
1437 if (mouseFrame < 0) mouseFrame == 0;
1438
1436 if (m_navigating || mode == ViewManager::NavigateMode) { 1439 if (m_navigating || mode == ViewManager::NavigateMode) {
1437 1440
1438 m_navigating = false; 1441 m_navigating = false;
1439 1442
1440 if (mode != ViewManager::NavigateMode) { 1443 if (mode != ViewManager::NavigateMode) {
1449 1452
1450 int y0 = std::min(m_clickPos.y(), m_mousePos.y()); 1453 int y0 = std::min(m_clickPos.y(), m_mousePos.y());
1451 int y1 = std::max(m_clickPos.y(), m_mousePos.y()); 1454 int y1 = std::max(m_clickPos.y(), m_mousePos.y());
1452 1455
1453 emit regionOutlined(QRect(x0, y0, x1 - x0, y1 - y0)); 1456 emit regionOutlined(QRect(x0, y0, x1 - x0, y1 - y0));
1457
1458 } else if (m_manager && m_dragMode == UnresolvedDrag) {
1459
1460 // Simple click, no drag made: move play head to the mouse
1461 // frame location
1462 m_manager->setPlaybackFrame(mouseFrame);
1454 } 1463 }
1455 1464
1456 } else if (mode == ViewManager::SelectMode) { 1465 } else if (mode == ViewManager::SelectMode) {
1457 1466
1458 if (!hasTopLayerTimeXAxis()) { 1467 if (!hasTopLayerTimeXAxis()) {
1475 if (exclusive) { 1484 if (exclusive) {
1476 m_manager->setSelection(selection); 1485 m_manager->setSelection(selection);
1477 } else { 1486 } else {
1478 m_manager->addSelection(selection); 1487 m_manager->addSelection(selection);
1479 } 1488 }
1480 } 1489
1481 else if (m_manager && !m_manager->haveInProgressSelection()) { 1490 } else if (m_manager && !m_manager->haveInProgressSelection()) {
1482 1491
1483 //cerr << "JTEST: release without selection" << endl; 1492 // Simple click, no selection made: move play head to the
1484 // Get frame location of mouse 1493 // mouse frame location
1485 int mouseFrame = getFrameForX(e->x()); 1494 m_manager->setPlaybackFrame(mouseFrame);
1486 //cerr << "JTEST: frame location of click is " << mouseFrame << endl;
1487 // Move play head to that frame location
1488 int playbackFrame = fmax(0,mouseFrame);
1489 m_manager->setPlaybackFrame(playbackFrame);
1490 } 1495 }
1491 1496
1492 update(); 1497 update();
1493 1498
1494 } else if (mode == ViewManager::DrawMode) { 1499 } else if (mode == ViewManager::DrawMode) {