# HG changeset patch # User gyorgyf # Date 1371722320 -3600 # Node ID 050404ae7799c4c4b92a08d60024f36f8273450f # Parent ac26de7b727a5539a50fc69433be24d632f5cef3 toggle button for boundary constraints and note recalculation diff -r ac26de7b727a -r 050404ae7799 layer/FlexiNoteLayer.cpp --- a/layer/FlexiNoteLayer.cpp Wed Jun 19 22:56:17 2013 +0100 +++ b/layer/FlexiNoteLayer.cpp Thu Jun 20 10:58:40 2013 +0100 @@ -61,7 +61,8 @@ m_editingCommand(0), m_verticalScale(AutoAlignScale), m_scaleMinimum(34), - m_scaleMaximum(77) + m_scaleMaximum(77), + m_intelligentActions(true) { } @@ -1019,10 +1020,10 @@ switch (m_editMode) { case LeftBoundary : { - // left - if (dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1; + // left + if (m_intelligentActions && dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1; // right - if (dragFrame >= m_originalPoint.frame + m_originalPoint.duration) { + if (m_intelligentActions && dragFrame >= m_originalPoint.frame + m_originalPoint.duration) { dragFrame = m_originalPoint.frame + m_originalPoint.duration - 1; } m_editingPoint.frame = dragFrame; @@ -1031,16 +1032,16 @@ } case RightBoundary : { // left - if (dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1; - if (dragFrame >= m_smallestRightNeighbourFrame) dragFrame = m_smallestRightNeighbourFrame - 1; + if (m_intelligentActions && dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1; + if (m_intelligentActions && dragFrame >= m_smallestRightNeighbourFrame) dragFrame = m_smallestRightNeighbourFrame - 1; m_editingPoint.duration = dragFrame - m_originalPoint.frame + 1; break; } case DragNote : { // left - if (dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1; + if (m_intelligentActions && dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1; // right - if (dragFrame + m_originalPoint.duration >= m_smallestRightNeighbourFrame) { + if (m_intelligentActions && dragFrame + m_originalPoint.duration >= m_smallestRightNeighbourFrame) { dragFrame = m_smallestRightNeighbourFrame - m_originalPoint.duration; } m_editingPoint.frame = dragFrame; @@ -1137,9 +1138,11 @@ FlexiNote newNote2(frame, note.value, note.duration - newNote1.duration, note.level, note.label); - - updateNoteValue(v,newNote1); - updateNoteValue(v,newNote2); + + if (m_intelligentActions) { + updateNoteValue(v,newNote1); + updateNoteValue(v,newNote2); + } FlexiNoteModel::EditCommand *command = new FlexiNoteModel::EditCommand (m_model, tr("Edit Point")); diff -r ac26de7b727a -r 050404ae7799 layer/FlexiNoteLayer.h --- a/layer/FlexiNoteLayer.h Wed Jun 19 22:56:17 2013 +0100 +++ b/layer/FlexiNoteLayer.h Thu Jun 20 10:58:40 2013 +0100 @@ -96,6 +96,8 @@ SplitNote, LeftBoundary }; + + void setIntelligentActions(bool on) { m_intelligentActions=on; } void setVerticalScale(VerticalScale scale); VerticalScale getVerticalScale() const { return m_verticalScale; } @@ -161,6 +163,7 @@ FlexiNoteModel *m_model; bool m_editing; + bool m_intelligentActions; int m_dragPointX; int m_dragPointY; int m_dragStartX;