comparison view/Pane.cpp @ 649:2ad082c5a090 tonioni

boundary actions and note delete consolidated
author gyorgyf
date Sun, 16 Jun 2013 20:40:05 +0100
parents ba76130ed7e5
children 76c5dfe333ee
comparison
equal deleted inserted replaced
648:f61a54364d1d 649:2ad082c5a090
1625 dragTopLayer(e); 1625 dragTopLayer(e);
1626 } 1626 }
1627 1627
1628 } else if (mode == ViewManager::SelectMode) { 1628 } else if (mode == ViewManager::SelectMode) {
1629 1629
1630 if (!hasTopLayerTimeXAxis()) return; 1630 if (!hasTopLayerTimeXAxis()) return;
1631 1631
1632 dragExtendSelection(e); 1632 dragExtendSelection(e);
1633 1633
1634 } else if (mode == ViewManager::DrawMode) { 1634 } else if (mode == ViewManager::DrawMode) {
1635 1635
1636 Layer *layer = getSelectedLayer(); 1636 Layer *layer = getSelectedLayer();
1637 if (layer && layer->isLayerEditable()) { 1637 if (layer && layer->isLayerEditable()) {
1638 layer->drawDrag(this, e); 1638 layer->drawDrag(this, e);
1639 } 1639 }
1640 1640
1641 } else if (mode == ViewManager::EraseMode) { 1641 } else if (mode == ViewManager::EraseMode) {
1642 1642
1643 Layer *layer = getSelectedLayer(); 1643 Layer *layer = getSelectedLayer();
1644 if (layer && layer->isLayerEditable()) { 1644 if (layer && layer->isLayerEditable()) {
1645 layer->eraseDrag(this, e); 1645 layer->eraseDrag(this, e);
1646 } 1646 }
1647
1648 // GF: handling NoteEditMode dragging and boundary actions for mouseMoveEvent
1649 } else if (mode == ViewManager::NoteEditMode) {
1650
1651 bool resist = true;
1652
1653 if ((e->modifiers() & Qt::ShiftModifier)) {
1654 m_shiftPressed = true;
1655 }
1656
1657 if (m_shiftPressed) resist = false;
1658
1659 m_dragMode = updateDragMode
1660 (m_dragMode,
1661 m_clickPos,
1662 e->pos(),
1663 true, // can move horiz
1664 true, // can move vert
1665 resist, // resist horiz
1666 resist); // resist vert
1667
1668 if (!m_editing) {
1669
1670 if (m_dragMode != UnresolvedDrag) {
1671
1672 m_editing = true;
1673
1674 QMouseEvent clickEvent(QEvent::MouseButtonPress,
1675 m_clickPos,
1676 Qt::NoButton,
1677 e->buttons(),
1678 e->modifiers());
1679
1680 if (!editSelectionStart(&clickEvent)) {
1681 Layer *layer = getSelectedLayer();
1682 if (layer && layer->isLayerEditable()) {
1683 std::cerr << "calling edit start" << std::endl;
1684 layer->editStart(this, &clickEvent);
1685 }
1686 }
1687 }
1688
1689 } else {
1690
1691 if (!editSelectionDrag(e)) {
1692
1693 Layer *layer = getSelectedLayer();
1694
1695 if (layer && layer->isLayerEditable()) {
1696
1697 int x = e->x();
1698 int y = e->y();
1699 if (m_dragMode == VerticalDrag) x = m_clickPos.x();
1700 else if (m_dragMode == HorizontalDrag) y = m_clickPos.y();
1701
1702 QMouseEvent moveEvent(QEvent::MouseMove,
1703 QPoint(x, y),
1704 Qt::NoButton,
1705 e->buttons(),
1706 e->modifiers());
1707 std::cerr << "calling editDrag" << std::endl;
1708 layer->editDrag(this, &moveEvent);
1709 }
1710 }
1711 }
1647 1712
1648 } else if (mode == ViewManager::EditMode) { 1713 } else if (mode == ViewManager::EditMode) {
1649 1714
1650 bool resist = true; 1715 bool resist = true;
1651 1716