Mercurial > hg > svgui
comparison layer/TimeValueLayer.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 |
---|---|
990 } | 990 } |
991 | 991 |
992 void | 992 void |
993 TimeValueLayer::moveSelection(Selection s, size_t newStartFrame) | 993 TimeValueLayer::moveSelection(Selection s, size_t newStartFrame) |
994 { | 994 { |
995 if (!m_model) return; | |
996 | |
995 SparseTimeValueModel::EditCommand *command = | 997 SparseTimeValueModel::EditCommand *command = |
996 new SparseTimeValueModel::EditCommand(m_model, | 998 new SparseTimeValueModel::EditCommand(m_model, |
997 tr("Drag Selection")); | 999 tr("Drag Selection")); |
998 | 1000 |
999 SparseTimeValueModel::PointList points = | 1001 SparseTimeValueModel::PointList points = |
1014 } | 1016 } |
1015 | 1017 |
1016 void | 1018 void |
1017 TimeValueLayer::resizeSelection(Selection s, Selection newSize) | 1019 TimeValueLayer::resizeSelection(Selection s, Selection newSize) |
1018 { | 1020 { |
1021 if (!m_model) return; | |
1022 | |
1019 SparseTimeValueModel::EditCommand *command = | 1023 SparseTimeValueModel::EditCommand *command = |
1020 new SparseTimeValueModel::EditCommand(m_model, | 1024 new SparseTimeValueModel::EditCommand(m_model, |
1021 tr("Resize Selection")); | 1025 tr("Resize Selection")); |
1022 | 1026 |
1023 SparseTimeValueModel::PointList points = | 1027 SparseTimeValueModel::PointList points = |
1047 } | 1051 } |
1048 | 1052 |
1049 void | 1053 void |
1050 TimeValueLayer::deleteSelection(Selection s) | 1054 TimeValueLayer::deleteSelection(Selection s) |
1051 { | 1055 { |
1056 if (!m_model) return; | |
1057 | |
1052 SparseTimeValueModel::EditCommand *command = | 1058 SparseTimeValueModel::EditCommand *command = |
1053 new SparseTimeValueModel::EditCommand(m_model, | 1059 new SparseTimeValueModel::EditCommand(m_model, |
1054 tr("Delete Selected Points")); | 1060 tr("Delete Selected Points")); |
1055 | 1061 |
1056 SparseTimeValueModel::PointList points = | 1062 SparseTimeValueModel::PointList points = |
1068 } | 1074 } |
1069 | 1075 |
1070 void | 1076 void |
1071 TimeValueLayer::copy(Selection s, Clipboard &to) | 1077 TimeValueLayer::copy(Selection s, Clipboard &to) |
1072 { | 1078 { |
1079 if (!m_model) return; | |
1080 | |
1073 SparseTimeValueModel::PointList points = | 1081 SparseTimeValueModel::PointList points = |
1074 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); | 1082 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); |
1075 | 1083 |
1076 for (SparseTimeValueModel::PointList::iterator i = points.begin(); | 1084 for (SparseTimeValueModel::PointList::iterator i = points.begin(); |
1077 i != points.end(); ++i) { | 1085 i != points.end(); ++i) { |
1083 } | 1091 } |
1084 | 1092 |
1085 void | 1093 void |
1086 TimeValueLayer::paste(const Clipboard &from, int frameOffset) | 1094 TimeValueLayer::paste(const Clipboard &from, int frameOffset) |
1087 { | 1095 { |
1096 if (!m_model) return; | |
1097 | |
1088 const Clipboard::PointList &points = from.getPoints(); | 1098 const Clipboard::PointList &points = from.getPoints(); |
1089 | 1099 |
1090 SparseTimeValueModel::EditCommand *command = | 1100 SparseTimeValueModel::EditCommand *command = |
1091 new SparseTimeValueModel::EditCommand(m_model, tr("Paste")); | 1101 new SparseTimeValueModel::EditCommand(m_model, tr("Paste")); |
1092 | 1102 |