Mercurial > hg > svgui
comparison layer/NoteLayer.cpp @ 99:453f7da3534e
* Fix serious failure to reload "imported" (i.e. all non-derived non-main)
models from .sv file
* Give a short playback duration to notes with formal duration of 0 or 1
* Show crosshairs on spectrogram even when there is another layer on top
(if it isn't opaque)
* Always paste to the same time in the layer as the cut/copy was from, rather
than to the playback pointer -- less flexible, but more predictable and
less annoying. We probably need a way to get the old behaviour if pasting
from somewhere else in the future (e.g. from a text file), but we can't do
that yet anyway
* Use a compound operation for dragging and resizing selections, so as to
ensure a single undo operation works
* Use a note model as the target for feature extraction plugins that output
variable samplerate data with more than one value per feature
* Avoid possible crashes in cut/paste if a layer proves to have no model
author | Chris Cannam |
---|---|
date | Thu, 11 May 2006 11:35:46 +0000 |
parents | 4b98bda7e94d |
children | 0db5e7492ce8 |
comparison
equal
deleted
inserted
replaced
98:2be85befe873 | 99:453f7da3534e |
---|---|
686 } | 686 } |
687 | 687 |
688 void | 688 void |
689 NoteLayer::moveSelection(Selection s, size_t newStartFrame) | 689 NoteLayer::moveSelection(Selection s, size_t newStartFrame) |
690 { | 690 { |
691 if (!m_model) return; | |
692 | |
691 NoteModel::EditCommand *command = | 693 NoteModel::EditCommand *command = |
692 new NoteModel::EditCommand(m_model, tr("Drag Selection")); | 694 new NoteModel::EditCommand(m_model, tr("Drag Selection")); |
693 | 695 |
694 NoteModel::PointList points = | 696 NoteModel::PointList points = |
695 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); | 697 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); |
709 } | 711 } |
710 | 712 |
711 void | 713 void |
712 NoteLayer::resizeSelection(Selection s, Selection newSize) | 714 NoteLayer::resizeSelection(Selection s, Selection newSize) |
713 { | 715 { |
716 if (!m_model) return; | |
717 | |
714 NoteModel::EditCommand *command = | 718 NoteModel::EditCommand *command = |
715 new NoteModel::EditCommand(m_model, tr("Resize Selection")); | 719 new NoteModel::EditCommand(m_model, tr("Resize Selection")); |
716 | 720 |
717 NoteModel::PointList points = | 721 NoteModel::PointList points = |
718 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); | 722 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); |
746 } | 750 } |
747 | 751 |
748 void | 752 void |
749 NoteLayer::deleteSelection(Selection s) | 753 NoteLayer::deleteSelection(Selection s) |
750 { | 754 { |
755 if (!m_model) return; | |
756 | |
751 NoteModel::EditCommand *command = | 757 NoteModel::EditCommand *command = |
752 new NoteModel::EditCommand(m_model, tr("Delete Selected Points")); | 758 new NoteModel::EditCommand(m_model, tr("Delete Selected Points")); |
753 | 759 |
754 NoteModel::PointList points = | 760 NoteModel::PointList points = |
755 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); | 761 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); |
766 } | 772 } |
767 | 773 |
768 void | 774 void |
769 NoteLayer::copy(Selection s, Clipboard &to) | 775 NoteLayer::copy(Selection s, Clipboard &to) |
770 { | 776 { |
777 if (!m_model) return; | |
778 | |
771 NoteModel::PointList points = | 779 NoteModel::PointList points = |
772 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); | 780 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); |
773 | 781 |
774 for (NoteModel::PointList::iterator i = points.begin(); | 782 for (NoteModel::PointList::iterator i = points.begin(); |
775 i != points.end(); ++i) { | 783 i != points.end(); ++i) { |
781 } | 789 } |
782 | 790 |
783 void | 791 void |
784 NoteLayer::paste(const Clipboard &from, int frameOffset) | 792 NoteLayer::paste(const Clipboard &from, int frameOffset) |
785 { | 793 { |
794 if (!m_model) return; | |
795 | |
786 const Clipboard::PointList &points = from.getPoints(); | 796 const Clipboard::PointList &points = from.getPoints(); |
787 | 797 |
788 NoteModel::EditCommand *command = | 798 NoteModel::EditCommand *command = |
789 new NoteModel::EditCommand(m_model, tr("Paste")); | 799 new NoteModel::EditCommand(m_model, tr("Paste")); |
790 | 800 |