comparison view/Pane.cpp @ 590:241929c5d57c sonification

Check the scale width in the View (which has access to it); ask the layer to do something when the user clicks in the scale regardless of the edit mode, and continue with normal processing if the layer has nothing interesting to do
author Chris Cannam
date Fri, 24 Jun 2011 14:27:32 +0100
parents 7ebd5a21d74f
children a13aa5320221
comparison
equal deleted inserted replaced
589:7ebd5a21d74f 590:241929c5d57c
1288 1288
1289 m_navigating = false; 1289 m_navigating = false;
1290 m_resizing = false; 1290 m_resizing = false;
1291 m_editing = false; 1291 m_editing = false;
1292 m_releasing = false; 1292 m_releasing = false;
1293
1294 if (e->x() < getVerticalScaleWidth()) {
1295 // Click occurred over the layer's scale area. Ask the layer
1296 // to do something with it: if it does so (i.e. returns true),
1297 // we've nothing else to do
1298 Layer *layer = getTopLayer();
1299 if (layer) {
1300 if (layer->scaleClicked(this, e)) {
1301 m_clickedInRange = false;
1302 emit paneInteractedWith();
1303 return;
1304 }
1305 }
1306 }
1293 1307
1294 if (mode == ViewManager::NavigateMode || 1308 if (mode == ViewManager::NavigateMode ||
1295 (e->buttons() & Qt::MidButton) || 1309 (e->buttons() & Qt::MidButton) ||
1296 (mode == ViewManager::MeasureMode && 1310 (mode == ViewManager::MeasureMode &&
1297 (e->buttons() & Qt::LeftButton) && m_shiftPressed)) { 1311 (e->buttons() & Qt::LeftButton) && m_shiftPressed)) {
1306 1320
1307 float vmin, vmax, dmin, dmax; 1321 float vmin, vmax, dmin, dmax;
1308 if (getTopLayerDisplayExtents(vmin, vmax, dmin, dmax)) { 1322 if (getTopLayerDisplayExtents(vmin, vmax, dmin, dmax)) {
1309 m_dragStartMinValue = dmin; 1323 m_dragStartMinValue = dmin;
1310 } 1324 }
1311
1312 //to process the mouse event when a left click is made in the layer and the tool mode is Select
1313 //(to handle e.g. the audio feedback of the piano keyboard notes)
1314 //does not work with the Navigate tool mode: (mode == ViewManager::NavigateMode) ||
1315 //which could be also interesting
1316 } else if ((mode == ViewManager::SelectMode) &&
1317 (e->buttons() & Qt::LeftButton)) {
1318
1319 Layer *layer = getTopLayer();
1320 LayerFactory::LayerType type = LayerFactory::getInstance()->getLayerType(layer);
1321
1322 //if (type==(LayerFactory::LayerType) MelodicRangeSpectrogram) layer->checkMouseClick(this, e);
1323
1324 //std::cerr << "Vertical scale width: " << getVerticalScaleWidth() << std::endl;
1325
1326 //should call processMouseEvent only when a LogFrequencyScale is used but this is handled by
1327 //overidding the function only in the relevant layer types
1328 layer->processMouseEvent(this, e, getVerticalScaleWidth());
1329 1325
1330 } else if (mode == ViewManager::SelectMode) { 1326 } else if (mode == ViewManager::SelectMode) {
1331 1327
1332 if (!hasTopLayerTimeXAxis()) return; 1328 if (!hasTopLayerTimeXAxis()) return;
1333 1329