Mercurial > hg > svgui
comparison layer/TimeFrequencyBoxLayer.cpp @ 1515:0fa49a6ce64f time-frequency-boxes
Item-editing updates needed for time-frequency box layer
author | Chris Cannam |
---|---|
date | Fri, 20 Sep 2019 14:19:17 +0100 (2019-09-20) |
parents | e453053a44dc |
children |
comparison
equal
deleted
inserted
replaced
1514:e453053a44dc | 1515:0fa49a6ce64f |
---|---|
937 if (!model) return false; | 937 if (!model) return false; |
938 | 938 |
939 Event region(0); | 939 Event region(0); |
940 if (!getPointToDrag(v, e->x(), e->y(), region)) return false; | 940 if (!getPointToDrag(v, e->x(), e->y(), region)) return false; |
941 | 941 |
942 ItemEditDialog::LabelOptions labelOptions; | |
943 labelOptions.valueLabel = tr("Minimum Frequency"); | |
944 labelOptions.levelLabel = tr("Frequency Extent"); | |
945 labelOptions.valueUnits = getScaleUnits(); | |
946 labelOptions.levelUnits = getScaleUnits(); | |
947 | |
942 ItemEditDialog *dialog = new ItemEditDialog | 948 ItemEditDialog *dialog = new ItemEditDialog |
943 (model->getSampleRate(), | 949 (model->getSampleRate(), |
944 ItemEditDialog::ShowTime | | 950 ItemEditDialog::ShowTime | |
945 ItemEditDialog::ShowDuration | | 951 ItemEditDialog::ShowDuration | |
946 ItemEditDialog::ShowValue | | 952 ItemEditDialog::ShowValue | |
953 ItemEditDialog::ShowLevel | | |
947 ItemEditDialog::ShowText, | 954 ItemEditDialog::ShowText, |
948 getScaleUnits()); | 955 labelOptions); |
949 | 956 |
950 dialog->setFrameTime(region.getFrame()); | 957 dialog->setFrameTime(region.getFrame()); |
951 dialog->setValue(region.getValue()); | 958 dialog->setValue(region.getValue()); |
959 dialog->setLevel(region.getLevel()); | |
952 dialog->setFrameDuration(region.getDuration()); | 960 dialog->setFrameDuration(region.getDuration()); |
953 dialog->setText(region.getLabel()); | 961 dialog->setText(region.getLabel()); |
954 | 962 |
955 if (dialog->exec() == QDialog::Accepted) { | 963 if (dialog->exec() == QDialog::Accepted) { |
956 | 964 |
957 Event newTimeFrequencyBox = region | 965 Event newTimeFrequencyBox = region |
958 .withFrame(dialog->getFrameTime()) | 966 .withFrame(dialog->getFrameTime()) |
959 .withValue(dialog->getValue()) | 967 .withValue(dialog->getValue()) |
968 .withLevel(dialog->getLevel()) | |
960 .withDuration(dialog->getFrameDuration()) | 969 .withDuration(dialog->getFrameDuration()) |
961 .withLabel(dialog->getText()); | 970 .withLabel(dialog->getText()); |
962 | 971 |
963 ChangeEventsCommand *command = new ChangeEventsCommand | 972 ChangeEventsCommand *command = new ChangeEventsCommand |
964 (m_model.untyped, tr("Edit Time-Frequency Box")); | 973 (m_model.untyped, tr("Edit Time-Frequency Box")); |
1141 return true; | 1150 return true; |
1142 } | 1151 } |
1143 | 1152 |
1144 void | 1153 void |
1145 TimeFrequencyBoxLayer::toXml(QTextStream &stream, | 1154 TimeFrequencyBoxLayer::toXml(QTextStream &stream, |
1146 QString indent, QString extraAttributes) const | 1155 QString indent, QString extraAttributes) const |
1147 { | 1156 { |
1148 QString s; | 1157 QString s; |
1149 | 1158 |
1150 s += QString("verticalScale=\"%1\" ") | 1159 s += QString("verticalScale=\"%1\" ").arg(m_verticalScale); |
1151 .arg(m_verticalScale); | |
1152 | 1160 |
1153 SingleColourLayer::toXml(stream, indent, extraAttributes + " " + s); | 1161 SingleColourLayer::toXml(stream, indent, extraAttributes + " " + s); |
1154 } | 1162 } |
1155 | 1163 |
1156 void | 1164 void |