comparison layer/NoteLayer.cpp @ 586:1ae54a29e59e

Merge from debug-output branch
author Chris Cannam
date Tue, 14 Jun 2011 14:48:29 +0100
parents f4960f8ce798
children 4806715f7a19
comparison
equal deleted inserted replaced
583:4c484636d5ec 586:1ae54a29e59e
58 if (m_model == model) return; 58 if (m_model == model) return;
59 m_model = model; 59 m_model = model;
60 60
61 connectSignals(m_model); 61 connectSignals(m_model);
62 62
63 // std::cerr << "NoteLayer::setModel(" << model << ")" << std::endl; 63 // DEBUG << "NoteLayer::setModel(" << model << ")" << endl;
64 64
65 m_scaleMinimum = 0; 65 m_scaleMinimum = 0;
66 m_scaleMaximum = 0; 66 m_scaleMaximum = 0;
67 67
68 emit modelReplaced(); 68 emit modelReplaced();
251 } 251 }
252 252
253 m_scaleMinimum = min; 253 m_scaleMinimum = min;
254 m_scaleMaximum = max; 254 m_scaleMaximum = max;
255 255
256 // std::cerr << "NoteLayer::setDisplayExtents: min = " << min << ", max = " << max << std::endl; 256 // DEBUG << "NoteLayer::setDisplayExtents: min = " << min << ", max = " << max << endl;
257 257
258 emit layerParametersChanged(); 258 emit layerParametersChanged();
259 return true; 259 return true;
260 } 260 }
261 261
332 } 332 }
333 if (newmax > max) { 333 if (newmax > max) {
334 newmax = max; 334 newmax = max;
335 } 335 }
336 336
337 std::cerr << "NoteLayer::setVerticalZoomStep: " << step << ": " << newmin << " -> " << newmax << " (range " << newdist << ")" << std::endl; 337 DEBUG << "NoteLayer::setVerticalZoomStep: " << step << ": " << newmin << " -> " << newmax << " (range " << newdist << ")" << endl;
338 338
339 setDisplayExtents(newmin, newmax); 339 setDisplayExtents(newmin, newmax);
340 } 340 }
341 341
342 RangeMapper * 342 RangeMapper *
722 paint.setPen(getBaseQColor()); 722 paint.setPen(getBaseQColor());
723 723
724 QColor brushColour(getBaseQColor()); 724 QColor brushColour(getBaseQColor());
725 brushColour.setAlpha(80); 725 brushColour.setAlpha(80);
726 726
727 // std::cerr << "NoteLayer::paint: resolution is " 727 // DEBUG << "NoteLayer::paint: resolution is "
728 // << m_model->getResolution() << " frames" << std::endl; 728 // << m_model->getResolution() << " frames" << endl;
729 729
730 float min = m_model->getValueMinimum(); 730 float min = m_model->getValueMinimum();
731 float max = m_model->getValueMaximum(); 731 float max = m_model->getValueMaximum();
732 if (max == min) max = min + 1.0; 732 if (max == min) max = min + 1.0;
733 733
792 } 792 }
793 793
794 void 794 void
795 NoteLayer::drawStart(View *v, QMouseEvent *e) 795 NoteLayer::drawStart(View *v, QMouseEvent *e)
796 { 796 {
797 // std::cerr << "NoteLayer::drawStart(" << e->x() << "," << e->y() << ")" << std::endl; 797 // DEBUG << "NoteLayer::drawStart(" << e->x() << "," << e->y() << ")" << endl;
798 798
799 if (!m_model) return; 799 if (!m_model) return;
800 800
801 long frame = v->getFrameForX(e->x()); 801 long frame = v->getFrameForX(e->x());
802 if (frame < 0) frame = 0; 802 if (frame < 0) frame = 0;
816 } 816 }
817 817
818 void 818 void
819 NoteLayer::drawDrag(View *v, QMouseEvent *e) 819 NoteLayer::drawDrag(View *v, QMouseEvent *e)
820 { 820 {
821 // std::cerr << "NoteLayer::drawDrag(" << e->x() << "," << e->y() << ")" << std::endl; 821 // DEBUG << "NoteLayer::drawDrag(" << e->x() << "," << e->y() << ")" << endl;
822 822
823 if (!m_model || !m_editing) return; 823 if (!m_model || !m_editing) return;
824 824
825 long frame = v->getFrameForX(e->x()); 825 long frame = v->getFrameForX(e->x());
826 if (frame < 0) frame = 0; 826 if (frame < 0) frame = 0;
845 } 845 }
846 846
847 void 847 void
848 NoteLayer::drawEnd(View *, QMouseEvent *) 848 NoteLayer::drawEnd(View *, QMouseEvent *)
849 { 849 {
850 // std::cerr << "NoteLayer::drawEnd(" << e->x() << "," << e->y() << ")" << std::endl; 850 // DEBUG << "NoteLayer::drawEnd(" << e->x() << "," << e->y() << ")" << endl;
851 if (!m_model || !m_editing) return; 851 if (!m_model || !m_editing) return;
852 finish(m_editingCommand); 852 finish(m_editingCommand);
853 m_editingCommand = 0; 853 m_editingCommand = 0;
854 m_editing = false; 854 m_editing = false;
855 } 855 }
895 } 895 }
896 896
897 void 897 void
898 NoteLayer::editStart(View *v, QMouseEvent *e) 898 NoteLayer::editStart(View *v, QMouseEvent *e)
899 { 899 {
900 // std::cerr << "NoteLayer::editStart(" << e->x() << "," << e->y() << ")" << std::endl; 900 // DEBUG << "NoteLayer::editStart(" << e->x() << "," << e->y() << ")" << endl;
901 901
902 if (!m_model) return; 902 if (!m_model) return;
903 903
904 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) return; 904 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) return;
905 m_originalPoint = m_editingPoint; 905 m_originalPoint = m_editingPoint;
918 } 918 }
919 919
920 void 920 void
921 NoteLayer::editDrag(View *v, QMouseEvent *e) 921 NoteLayer::editDrag(View *v, QMouseEvent *e)
922 { 922 {
923 // std::cerr << "NoteLayer::editDrag(" << e->x() << "," << e->y() << ")" << std::endl; 923 // DEBUG << "NoteLayer::editDrag(" << e->x() << "," << e->y() << ")" << endl;
924 924
925 if (!m_model || !m_editing) return; 925 if (!m_model || !m_editing) return;
926 926
927 int xdist = e->x() - m_dragStartX; 927 int xdist = e->x() - m_dragStartX;
928 int ydist = e->y() - m_dragStartY; 928 int ydist = e->y() - m_dragStartY;
947 } 947 }
948 948
949 void 949 void
950 NoteLayer::editEnd(View *, QMouseEvent *) 950 NoteLayer::editEnd(View *, QMouseEvent *)
951 { 951 {
952 // std::cerr << "NoteLayer::editEnd(" << e->x() << "," << e->y() << ")" << std::endl; 952 // DEBUG << "NoteLayer::editEnd(" << e->x() << "," << e->y() << ")" << endl;
953 if (!m_model || !m_editing) return; 953 if (!m_model || !m_editing) return;
954 954
955 if (m_editingCommand) { 955 if (m_editingCommand) {
956 956
957 QString newName = m_editingCommand->getName(); 957 QString newName = m_editingCommand->getName();