Mercurial > hg > svgui
comparison layer/RegionLayer.cpp @ 543:b73f486fc2e4
* minor fixes
author | Chris Cannam |
---|---|
date | Wed, 05 Aug 2009 16:36:07 +0000 |
parents | 5930f2b0b1d2 |
children | d666f5f8b154 |
comparison
equal
deleted
inserted
replaced
542:5930f2b0b1d2 | 543:b73f486fc2e4 |
---|---|
38 | 38 |
39 RegionLayer::RegionLayer() : | 39 RegionLayer::RegionLayer() : |
40 SingleColourLayer(), | 40 SingleColourLayer(), |
41 m_model(0), | 41 m_model(0), |
42 m_editing(false), | 42 m_editing(false), |
43 m_originalPoint(0, 0.0, 0, tr("New Point")), | 43 m_originalPoint(0, 0.0, 0, tr("New Region")), |
44 m_editingPoint(0, 0.0, 0, tr("New Point")), | 44 m_editingPoint(0, 0.0, 0, tr("New Region")), |
45 m_editingCommand(0), | 45 m_editingCommand(0), |
46 m_verticalScale(EqualSpaced), | 46 m_verticalScale(EqualSpaced), |
47 m_colourMap(0), | 47 m_colourMap(0), |
48 m_plotStyle(PlotLines) | 48 m_plotStyle(PlotLines) |
49 { | 49 { |
850 if (frame < 0) frame = 0; | 850 if (frame < 0) frame = 0; |
851 frame = frame / m_model->getResolution() * m_model->getResolution(); | 851 frame = frame / m_model->getResolution() * m_model->getResolution(); |
852 | 852 |
853 float value = getValueForY(v, e->y()); | 853 float value = getValueForY(v, e->y()); |
854 | 854 |
855 m_editingPoint = RegionModel::Point(frame, value, 0, tr("New Point")); | 855 m_editingPoint = RegionModel::Point(frame, value, 0, tr("New Region")); |
856 m_originalPoint = m_editingPoint; | 856 m_originalPoint = m_editingPoint; |
857 | 857 |
858 if (m_editingCommand) finish(m_editingCommand); | 858 if (m_editingCommand) finish(m_editingCommand); |
859 m_editingCommand = new RegionModel::EditCommand(m_model, | 859 m_editingCommand = new RegionModel::EditCommand(m_model, |
860 tr("Draw Point")); | 860 tr("Draw Region")); |
861 m_editingCommand->addPoint(m_editingPoint); | 861 m_editingCommand->addPoint(m_editingPoint); |
862 | 862 |
863 m_editing = true; | 863 m_editing = true; |
864 } | 864 } |
865 | 865 |
937 if (points.empty()) return; | 937 if (points.empty()) return; |
938 if (points.begin()->frame != m_editingPoint.frame || | 938 if (points.begin()->frame != m_editingPoint.frame || |
939 points.begin()->value != m_editingPoint.value) return; | 939 points.begin()->value != m_editingPoint.value) return; |
940 | 940 |
941 m_editingCommand = new RegionModel::EditCommand | 941 m_editingCommand = new RegionModel::EditCommand |
942 (m_model, tr("Erase Point")); | 942 (m_model, tr("Erase Region")); |
943 | 943 |
944 m_editingCommand->deletePoint(m_editingPoint); | 944 m_editingCommand->deletePoint(m_editingPoint); |
945 | 945 |
946 finish(m_editingCommand); | 946 finish(m_editingCommand); |
947 m_editingCommand = 0; | 947 m_editingCommand = 0; |
982 | 982 |
983 float value = getValueForY(v, e->y()); | 983 float value = getValueForY(v, e->y()); |
984 | 984 |
985 if (!m_editingCommand) { | 985 if (!m_editingCommand) { |
986 m_editingCommand = new RegionModel::EditCommand(m_model, | 986 m_editingCommand = new RegionModel::EditCommand(m_model, |
987 tr("Drag Point")); | 987 tr("Drag Region")); |
988 } | 988 } |
989 | 989 |
990 m_editingCommand->deletePoint(m_editingPoint); | 990 m_editingCommand->deletePoint(m_editingPoint); |
991 m_editingPoint.frame = frame; | 991 m_editingPoint.frame = frame; |
992 m_editingPoint.value = value; | 992 m_editingPoint.value = value; |
1003 | 1003 |
1004 QString newName = m_editingCommand->getName(); | 1004 QString newName = m_editingCommand->getName(); |
1005 | 1005 |
1006 if (m_editingPoint.frame != m_originalPoint.frame) { | 1006 if (m_editingPoint.frame != m_originalPoint.frame) { |
1007 if (m_editingPoint.value != m_originalPoint.value) { | 1007 if (m_editingPoint.value != m_originalPoint.value) { |
1008 newName = tr("Edit Point"); | 1008 newName = tr("Edit Region"); |
1009 } else { | 1009 } else { |
1010 newName = tr("Relocate Point"); | 1010 newName = tr("Relocate Region"); |
1011 } | 1011 } |
1012 } else { | 1012 } else { |
1013 newName = tr("Change Point Value"); | 1013 newName = tr("Change Point Value"); |
1014 } | 1014 } |
1015 | 1015 |
1051 newRegion.value = dialog->getValue(); | 1051 newRegion.value = dialog->getValue(); |
1052 newRegion.duration = dialog->getFrameDuration(); | 1052 newRegion.duration = dialog->getFrameDuration(); |
1053 newRegion.label = dialog->getText(); | 1053 newRegion.label = dialog->getText(); |
1054 | 1054 |
1055 RegionModel::EditCommand *command = new RegionModel::EditCommand | 1055 RegionModel::EditCommand *command = new RegionModel::EditCommand |
1056 (m_model, tr("Edit Point")); | 1056 (m_model, tr("Edit Region")); |
1057 command->deletePoint(region); | 1057 command->deletePoint(region); |
1058 command->addPoint(newRegion); | 1058 command->addPoint(newRegion); |
1059 finish(command); | 1059 finish(command); |
1060 } | 1060 } |
1061 | 1061 |