Mercurial > hg > svgui
comparison layer/NoteLayer.cpp @ 376:e1a9e478b7f2
* juggle some files around in order to free audioio, base, and system libraries
from dependency on QtGui
author | Chris Cannam |
---|---|
date | Wed, 12 Mar 2008 17:42:56 +0000 |
parents | d58701996fae |
children | 681542f0c8c5 |
comparison
equal
deleted
inserted
replaced
375:daaf1c435d98 | 376:e1a9e478b7f2 |
---|---|
18 #include "data/model/Model.h" | 18 #include "data/model/Model.h" |
19 #include "base/RealTime.h" | 19 #include "base/RealTime.h" |
20 #include "base/Profiler.h" | 20 #include "base/Profiler.h" |
21 #include "base/Pitch.h" | 21 #include "base/Pitch.h" |
22 #include "base/LogRange.h" | 22 #include "base/LogRange.h" |
23 #include "base/ColourDatabase.h" | 23 #include "ColourDatabase.h" |
24 #include "view/View.h" | 24 #include "view/View.h" |
25 | 25 |
26 #include "data/model/NoteModel.h" | 26 #include "data/model/NoteModel.h" |
27 | 27 |
28 #include "widgets/ItemEditDialog.h" | 28 #include "widgets/ItemEditDialog.h" |
621 float value = getValueForY(v, e->y()); | 621 float value = getValueForY(v, e->y()); |
622 | 622 |
623 m_editingPoint = NoteModel::Point(frame, value, 0, 0.8, tr("New Point")); | 623 m_editingPoint = NoteModel::Point(frame, value, 0, 0.8, tr("New Point")); |
624 m_originalPoint = m_editingPoint; | 624 m_originalPoint = m_editingPoint; |
625 | 625 |
626 if (m_editingCommand) m_editingCommand->finish(); | 626 if (m_editingCommand) finish(m_editingCommand); |
627 m_editingCommand = new NoteModel::EditCommand(m_model, | 627 m_editingCommand = new NoteModel::EditCommand(m_model, |
628 tr("Draw Point")); | 628 tr("Draw Point")); |
629 m_editingCommand->addPoint(m_editingPoint); | 629 m_editingCommand->addPoint(m_editingPoint); |
630 | 630 |
631 m_editing = true; | 631 m_editing = true; |
663 void | 663 void |
664 NoteLayer::drawEnd(View *, QMouseEvent *) | 664 NoteLayer::drawEnd(View *, QMouseEvent *) |
665 { | 665 { |
666 // std::cerr << "NoteLayer::drawEnd(" << e->x() << "," << e->y() << ")" << std::endl; | 666 // std::cerr << "NoteLayer::drawEnd(" << e->x() << "," << e->y() << ")" << std::endl; |
667 if (!m_model || !m_editing) return; | 667 if (!m_model || !m_editing) return; |
668 m_editingCommand->finish(); | 668 finish(m_editingCommand); |
669 m_editingCommand = 0; | 669 m_editingCommand = 0; |
670 m_editing = false; | 670 m_editing = false; |
671 } | 671 } |
672 | 672 |
673 void | 673 void |
679 if (points.empty()) return; | 679 if (points.empty()) return; |
680 | 680 |
681 m_editingPoint = *points.begin(); | 681 m_editingPoint = *points.begin(); |
682 | 682 |
683 if (m_editingCommand) { | 683 if (m_editingCommand) { |
684 m_editingCommand->finish(); | 684 finish(m_editingCommand); |
685 m_editingCommand = 0; | 685 m_editingCommand = 0; |
686 } | 686 } |
687 | 687 |
688 m_editing = true; | 688 m_editing = true; |
689 } | 689 } |
708 m_editingCommand = new NoteModel::EditCommand | 708 m_editingCommand = new NoteModel::EditCommand |
709 (m_model, tr("Erase Point")); | 709 (m_model, tr("Erase Point")); |
710 | 710 |
711 m_editingCommand->deletePoint(m_editingPoint); | 711 m_editingCommand->deletePoint(m_editingPoint); |
712 | 712 |
713 m_editingCommand->finish(); | 713 finish(m_editingCommand); |
714 m_editingCommand = 0; | 714 m_editingCommand = 0; |
715 m_editing = false; | 715 m_editing = false; |
716 } | 716 } |
717 | 717 |
718 void | 718 void |
727 | 727 |
728 m_editingPoint = *points.begin(); | 728 m_editingPoint = *points.begin(); |
729 m_originalPoint = m_editingPoint; | 729 m_originalPoint = m_editingPoint; |
730 | 730 |
731 if (m_editingCommand) { | 731 if (m_editingCommand) { |
732 m_editingCommand->finish(); | 732 finish(m_editingCommand); |
733 m_editingCommand = 0; | 733 m_editingCommand = 0; |
734 } | 734 } |
735 | 735 |
736 m_editing = true; | 736 m_editing = true; |
737 } | 737 } |
779 } else { | 779 } else { |
780 newName = tr("Change Point Value"); | 780 newName = tr("Change Point Value"); |
781 } | 781 } |
782 | 782 |
783 m_editingCommand->setName(newName); | 783 m_editingCommand->setName(newName); |
784 m_editingCommand->finish(); | 784 finish(m_editingCommand); |
785 } | 785 } |
786 | 786 |
787 m_editingCommand = 0; | 787 m_editingCommand = 0; |
788 m_editing = false; | 788 m_editing = false; |
789 } | 789 } |
821 | 821 |
822 NoteModel::EditCommand *command = new NoteModel::EditCommand | 822 NoteModel::EditCommand *command = new NoteModel::EditCommand |
823 (m_model, tr("Edit Point")); | 823 (m_model, tr("Edit Point")); |
824 command->deletePoint(note); | 824 command->deletePoint(note); |
825 command->addPoint(newNote); | 825 command->addPoint(newNote); |
826 command->finish(); | 826 finish(command); |
827 } | 827 } |
828 | 828 |
829 delete dialog; | 829 delete dialog; |
830 return true; | 830 return true; |
831 } | 831 } |
850 command->deletePoint(*i); | 850 command->deletePoint(*i); |
851 command->addPoint(newPoint); | 851 command->addPoint(newPoint); |
852 } | 852 } |
853 } | 853 } |
854 | 854 |
855 command->finish(); | 855 finish(command); |
856 } | 856 } |
857 | 857 |
858 void | 858 void |
859 NoteLayer::resizeSelection(Selection s, Selection newSize) | 859 NoteLayer::resizeSelection(Selection s, Selection newSize) |
860 { | 860 { |
889 command->deletePoint(*i); | 889 command->deletePoint(*i); |
890 command->addPoint(newPoint); | 890 command->addPoint(newPoint); |
891 } | 891 } |
892 } | 892 } |
893 | 893 |
894 command->finish(); | 894 finish(command); |
895 } | 895 } |
896 | 896 |
897 void | 897 void |
898 NoteLayer::deleteSelection(Selection s) | 898 NoteLayer::deleteSelection(Selection s) |
899 { | 899 { |
911 if (s.contains(i->frame)) { | 911 if (s.contains(i->frame)) { |
912 command->deletePoint(*i); | 912 command->deletePoint(*i); |
913 } | 913 } |
914 } | 914 } |
915 | 915 |
916 command->finish(); | 916 finish(command); |
917 } | 917 } |
918 | 918 |
919 void | 919 void |
920 NoteLayer::copy(View *v, Selection s, Clipboard &to) | 920 NoteLayer::copy(View *v, Selection s, Clipboard &to) |
921 { | 921 { |
1009 } | 1009 } |
1010 | 1010 |
1011 command->addPoint(newPoint); | 1011 command->addPoint(newPoint); |
1012 } | 1012 } |
1013 | 1013 |
1014 command->finish(); | 1014 finish(command); |
1015 return true; | 1015 return true; |
1016 } | 1016 } |
1017 | 1017 |
1018 int | 1018 int |
1019 NoteLayer::getDefaultColourHint(bool darkbg, bool &impose) | 1019 NoteLayer::getDefaultColourHint(bool darkbg, bool &impose) |