Mercurial > hg > svgui
comparison layer/RegionLayer.cpp @ 1414:fa986b91d77f
Merge from branch fix-static-analysis
author | Chris Cannam |
---|---|
date | Wed, 09 Jan 2019 15:24:51 +0000 |
parents | d057dcc827e7 |
children | 2487521e857b |
comparison
equal
deleted
inserted
replaced
1413:0930a27ebea2 | 1414:fa986b91d77f |
---|---|
44 #include <iostream> | 44 #include <iostream> |
45 #include <cmath> | 45 #include <cmath> |
46 | 46 |
47 RegionLayer::RegionLayer() : | 47 RegionLayer::RegionLayer() : |
48 SingleColourLayer(), | 48 SingleColourLayer(), |
49 m_model(0), | 49 m_model(nullptr), |
50 m_editing(false), | 50 m_editing(false), |
51 m_dragPointX(0), | 51 m_dragPointX(0), |
52 m_dragPointY(0), | 52 m_dragPointY(0), |
53 m_dragStartX(0), | 53 m_dragStartX(0), |
54 m_dragStartY(0), | 54 m_dragStartY(0), |
55 m_originalPoint(0, 0.0, 0, tr("New Region")), | 55 m_originalPoint(0, 0.0, 0, tr("New Region")), |
56 m_editingPoint(0, 0.0, 0, tr("New Region")), | 56 m_editingPoint(0, 0.0, 0, tr("New Region")), |
57 m_editingCommand(0), | 57 m_editingCommand(nullptr), |
58 m_verticalScale(EqualSpaced), | 58 m_verticalScale(EqualSpaced), |
59 m_colourMap(0), | 59 m_colourMap(0), |
60 m_colourInverted(false), | 60 m_colourInverted(false), |
61 m_plotStyle(PlotLines) | 61 m_plotStyle(PlotLines) |
62 { | 62 { |
1200 void | 1200 void |
1201 RegionLayer::drawEnd(LayerGeometryProvider *, QMouseEvent *) | 1201 RegionLayer::drawEnd(LayerGeometryProvider *, QMouseEvent *) |
1202 { | 1202 { |
1203 if (!m_model || !m_editing) return; | 1203 if (!m_model || !m_editing) return; |
1204 finish(m_editingCommand); | 1204 finish(m_editingCommand); |
1205 m_editingCommand = 0; | 1205 m_editingCommand = nullptr; |
1206 m_editing = false; | 1206 m_editing = false; |
1207 | 1207 |
1208 recalcSpacing(); | 1208 recalcSpacing(); |
1209 } | 1209 } |
1210 | 1210 |
1215 | 1215 |
1216 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) return; | 1216 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) return; |
1217 | 1217 |
1218 if (m_editingCommand) { | 1218 if (m_editingCommand) { |
1219 finish(m_editingCommand); | 1219 finish(m_editingCommand); |
1220 m_editingCommand = 0; | 1220 m_editingCommand = nullptr; |
1221 } | 1221 } |
1222 | 1222 |
1223 m_editing = true; | 1223 m_editing = true; |
1224 recalcSpacing(); | 1224 recalcSpacing(); |
1225 } | 1225 } |
1244 (m_model, tr("Erase Region")); | 1244 (m_model, tr("Erase Region")); |
1245 | 1245 |
1246 m_editingCommand->deletePoint(m_editingPoint); | 1246 m_editingCommand->deletePoint(m_editingPoint); |
1247 | 1247 |
1248 finish(m_editingCommand); | 1248 finish(m_editingCommand); |
1249 m_editingCommand = 0; | 1249 m_editingCommand = nullptr; |
1250 m_editing = false; | 1250 m_editing = false; |
1251 recalcSpacing(); | 1251 recalcSpacing(); |
1252 } | 1252 } |
1253 | 1253 |
1254 void | 1254 void |
1265 | 1265 |
1266 m_originalPoint = m_editingPoint; | 1266 m_originalPoint = m_editingPoint; |
1267 | 1267 |
1268 if (m_editingCommand) { | 1268 if (m_editingCommand) { |
1269 finish(m_editingCommand); | 1269 finish(m_editingCommand); |
1270 m_editingCommand = 0; | 1270 m_editingCommand = nullptr; |
1271 } | 1271 } |
1272 | 1272 |
1273 m_editing = true; | 1273 m_editing = true; |
1274 m_dragStartX = e->x(); | 1274 m_dragStartX = e->x(); |
1275 m_dragStartY = e->y(); | 1275 m_dragStartY = e->y(); |
1332 | 1332 |
1333 m_editingCommand->setName(newName); | 1333 m_editingCommand->setName(newName); |
1334 finish(m_editingCommand); | 1334 finish(m_editingCommand); |
1335 } | 1335 } |
1336 | 1336 |
1337 m_editingCommand = 0; | 1337 m_editingCommand = nullptr; |
1338 m_editing = false; | 1338 m_editing = false; |
1339 recalcSpacing(); | 1339 recalcSpacing(); |
1340 } | 1340 } |
1341 | 1341 |
1342 bool | 1342 bool |