comparison view/Pane.cpp @ 646:ba76130ed7e5 tonioni

added context sensitive mouse pointers in note edit tool mode
author gyorgyf
date Sat, 15 Jun 2013 17:04:03 +0100
parents c8f45afb83d5
children 2ad082c5a090 12d570c27d85
comparison
equal deleted inserted replaced
645:c8f45afb83d5 646:ba76130ed7e5
22 #include "ViewManager.h" 22 #include "ViewManager.h"
23 #include "widgets/CommandHistory.h" 23 #include "widgets/CommandHistory.h"
24 #include "widgets/TextAbbrev.h" 24 #include "widgets/TextAbbrev.h"
25 #include "base/Preferences.h" 25 #include "base/Preferences.h"
26 #include "layer/WaveformLayer.h" 26 #include "layer/WaveformLayer.h"
27
28 // GF: added so we can propagate the mouse move event to the note layer for context handling.
29 #include "layer/LayerFactory.h"
30 #include "layer/FlexiNoteLayer.h"
31
27 32
28 //!!! ugh 33 //!!! ugh
29 #include "data/model/WaveFileModel.h" 34 #include "data/model/WaveFileModel.h"
30 35
31 #include <QPaintEvent> 36 #include <QPaintEvent>
1557 QPoint prevPoint = m_identifyPoint; 1562 QPoint prevPoint = m_identifyPoint;
1558 m_identifyPoint = e->pos(); 1563 m_identifyPoint = e->pos();
1559 1564
1560 if (!m_clickedInRange) { 1565 if (!m_clickedInRange) {
1561 1566
1562 if (mode == ViewManager::SelectMode && hasTopLayerTimeXAxis()) { 1567 // GF: handle mouse move for context sensitive cursor switching in NoteEditMode.
1563 bool closeToLeft = false, closeToRight = false; 1568 // GF: Propagate the event to FlexiNoteLayer. I somehow feel it's best handeled there rather than here, but perhaps not if this will be needed elsewhere too.
1564 getSelectionAt(e->x(), closeToLeft, closeToRight); 1569 if (mode == ViewManager::NoteEditMode && LayerFactory::getInstance()->getLayerType(getTopLayer()) == LayerFactory::FlexiNotes) {
1565 if ((closeToLeft || closeToRight) && !(closeToLeft && closeToRight)) { 1570
1566 setCursor(Qt::SizeHorCursor); 1571 dynamic_cast<FlexiNoteLayer *>(getTopLayer())->mouseMoveEvent(this, e);
1567 } else { 1572
1568 setCursor(Qt::ArrowCursor); 1573 }
1569 } 1574
1570 } 1575 if (mode == ViewManager::SelectMode && hasTopLayerTimeXAxis()) {
1576 bool closeToLeft = false, closeToRight = false;
1577 getSelectionAt(e->x(), closeToLeft, closeToRight);
1578 if ((closeToLeft || closeToRight) && !(closeToLeft && closeToRight)) {
1579 setCursor(Qt::SizeHorCursor);
1580 } else {
1581 setCursor(Qt::ArrowCursor);
1582 }
1583 }
1571 1584
1572 if (!m_manager->isPlaying()) { 1585 if (!m_manager->isPlaying()) {
1573 1586
1574 bool updating = false; 1587 bool updating = false;
1575 1588