Mercurial > hg > svgui
comparison view/Pane.cpp @ 756:9cfcb2924ee3 tony_integration
Merge from branch tonioni
author | Chris Cannam |
---|---|
date | Wed, 02 Apr 2014 08:51:33 +0100 |
parents | ad01e7d4a956 09e2677e34e7 |
children | 410816717c2c |
comparison
equal
deleted
inserted
replaced
755:ad01e7d4a956 | 756:9cfcb2924ee3 |
---|---|
342 if (m_manager && !m_manager->shouldIlluminateLocalFeatures()) { | 342 if (m_manager && !m_manager->shouldIlluminateLocalFeatures()) { |
343 return false; | 343 return false; |
344 } | 344 } |
345 | 345 |
346 if (layer == getSelectedLayer() && | 346 if (layer == getSelectedLayer() && |
347 !shouldIlluminateLocalSelection(discard, b0, b1)) { | 347 !shouldIlluminateLocalSelection(discard, b0, b1)) { |
348 | 348 |
349 pos = m_identifyPoint; | 349 pos = m_identifyPoint; |
350 return m_identifyFeatures; | 350 return m_identifyFeatures; |
351 } | 351 } |
352 | 352 |
353 return false; | 353 return false; |
354 } | 354 } |
355 | 355 |
362 m_manager && | 362 m_manager && |
363 m_manager->getToolModeFor(this) == ViewManager::EditMode && | 363 m_manager->getToolModeFor(this) == ViewManager::EditMode && |
364 !m_manager->getSelections().empty() && | 364 !m_manager->getSelections().empty() && |
365 !selectionIsBeingEdited()) { | 365 !selectionIsBeingEdited()) { |
366 | 366 |
367 Selection s(getSelectionAt(m_identifyPoint.x(), | 367 Selection s(getSelectionAt(m_identifyPoint.x(), |
368 closeToLeft, closeToRight)); | 368 closeToLeft, closeToRight)); |
369 | 369 |
370 if (!s.isEmpty()) { | 370 if (!s.isEmpty()) { |
371 if (getSelectedLayer() && getSelectedLayer()->isLayerEditable()) { | 371 if (getSelectedLayer() && getSelectedLayer()->isLayerEditable()) { |
372 | 372 |
373 pos = m_identifyPoint; | 373 pos = m_identifyPoint; |
374 return true; | 374 return true; |
375 } | 375 } |
376 } | 376 } |
377 } | 377 } |
378 | 378 |
379 return false; | 379 return false; |
380 } | 380 } |
381 | 381 |
1233 tr("Double-click middle button to relocate with any tool")); | 1233 tr("Double-click middle button to relocate with any tool")); |
1234 kr.registerShortcut(tr("Menu"), tr("Right"), | 1234 kr.registerShortcut(tr("Menu"), tr("Right"), |
1235 tr("Show pane context menu")); | 1235 tr("Show pane context menu")); |
1236 } | 1236 } |
1237 | 1237 |
1238 Layer * | |
1239 Pane::getTopFlexiNoteLayer() | |
1240 { | |
1241 for (int i = int(m_layers.size()) - 1; i >= 0; --i) { | |
1242 if (LayerFactory::getInstance()->getLayerType(m_layers[i]) == | |
1243 LayerFactory::FlexiNotes) { | |
1244 return m_layers[i]; | |
1245 } | |
1246 } | |
1247 return 0; | |
1248 } | |
1249 | |
1238 void | 1250 void |
1239 Pane::mousePressEvent(QMouseEvent *e) | 1251 Pane::mousePressEvent(QMouseEvent *e) |
1240 { | 1252 { |
1241 if (e->buttons() & Qt::RightButton) { | 1253 if (e->buttons() & Qt::RightButton) { |
1242 emit contextHelpChanged(""); | 1254 emit contextHelpChanged(""); |
1344 | 1356 |
1345 // GF: handle mouse press for NoteEditMode | 1357 // GF: handle mouse press for NoteEditMode |
1346 } else if (mode == ViewManager::NoteEditMode) { | 1358 } else if (mode == ViewManager::NoteEditMode) { |
1347 | 1359 |
1348 std::cerr << "mouse pressed in note edit mode" << std::endl; | 1360 std::cerr << "mouse pressed in note edit mode" << std::endl; |
1349 Layer *layer = getSelectedLayer(); | 1361 Layer *layer = getTopFlexiNoteLayer(); |
1350 if (layer && layer->isLayerEditable()) { | 1362 if (layer) { |
1351 layer->splitStart(this, e); | 1363 layer->splitStart(this, e); |
1352 } | 1364 } |
1353 | 1365 |
1354 } else if (mode == ViewManager::EditMode) { | 1366 } else if (mode == ViewManager::EditMode) { |
1355 | 1367 |
1459 } | 1471 } |
1460 | 1472 |
1461 } else if (mode == ViewManager::NoteEditMode) { | 1473 } else if (mode == ViewManager::NoteEditMode) { |
1462 | 1474 |
1463 //GF: handle mouse release for NoteEditMode (note: works but will need to re-think this a bit later) | 1475 //GF: handle mouse release for NoteEditMode (note: works but will need to re-think this a bit later) |
1464 Layer *layer = getSelectedLayer(); | 1476 Layer *layer = getTopFlexiNoteLayer(); |
1465 if (layer && layer->isLayerEditable()) { | 1477 |
1478 if (layer) { | |
1466 layer->splitEnd(this, e); | 1479 layer->splitEnd(this, e); |
1467 update(); } | 1480 update(); |
1468 | 1481 |
1482 if (m_editing) { | |
1483 if (!editSelectionEnd(e)) { | |
1484 layer->editEnd(this, e); | |
1485 update(); | |
1486 } | |
1487 } | |
1488 } | |
1489 | |
1490 } else if (mode == ViewManager::EditMode) { | |
1491 | |
1469 if (m_editing) { | 1492 if (m_editing) { |
1470 if (!editSelectionEnd(e)) { | 1493 if (!editSelectionEnd(e)) { |
1471 Layer *layer = getSelectedLayer(); | 1494 Layer *layer = getSelectedLayer(); |
1472 if (layer && layer->isLayerEditable()) { | 1495 if (layer && layer->isLayerEditable()) { |
1473 layer->editEnd(this, e); | 1496 layer->editEnd(this, e); |
1474 update(); | 1497 update(); |
1475 } | 1498 } |
1476 } | 1499 } |
1477 } | 1500 } |
1478 | 1501 |
1479 } else if (mode == ViewManager::EditMode) { | |
1480 | |
1481 // GF: edited this previously, but restored to original state | |
1482 if (m_editing) { | |
1483 if (!editSelectionEnd(e)) { | |
1484 Layer *layer = getSelectedLayer(); | |
1485 if (layer && layer->isLayerEditable()) { | |
1486 layer->editEnd(this, e); | |
1487 update(); | |
1488 } | |
1489 } | |
1490 } | |
1491 | |
1492 } else if (mode == ViewManager::MeasureMode) { | 1502 } else if (mode == ViewManager::MeasureMode) { |
1493 | 1503 |
1494 Layer *layer = getTopLayer(); | 1504 Layer *layer = getTopLayer(); |
1495 if (layer) layer->measureEnd(this, e); | 1505 if (layer) layer->measureEnd(this, e); |
1496 if (m_measureCursor1) setCursor(*m_measureCursor1); | 1506 if (m_measureCursor1) setCursor(*m_measureCursor1); |
1537 | 1547 |
1538 if (!m_clickedInRange) { | 1548 if (!m_clickedInRange) { |
1539 | 1549 |
1540 // GF: handle mouse move for context sensitive cursor switching in NoteEditMode. | 1550 // GF: handle mouse move for context sensitive cursor switching in NoteEditMode. |
1541 // GF: Propagate the event to FlexiNoteLayer. I somehow feel it's best handeled there rather than here, but perhaps not if this will be needed elsewhere too. | 1551 // GF: Propagate the event to FlexiNoteLayer. I somehow feel it's best handeled there rather than here, but perhaps not if this will be needed elsewhere too. |
1542 if (mode == ViewManager::NoteEditMode && LayerFactory::getInstance()->getLayerType(getTopLayer()) == LayerFactory::FlexiNotes) { | 1552 if (mode == ViewManager::NoteEditMode) { |
1543 | 1553 FlexiNoteLayer *layer = qobject_cast<FlexiNoteLayer *>(getTopFlexiNoteLayer()); |
1544 dynamic_cast<FlexiNoteLayer *>(getTopLayer())->mouseMoveEvent(this, e); | 1554 if (layer) { |
1545 | 1555 layer->mouseMoveEvent(this, e); //!!! ew |
1556 return; | |
1557 } | |
1546 } | 1558 } |
1547 | 1559 |
1548 if (mode == ViewManager::SelectMode && hasTopLayerTimeXAxis()) { | 1560 if (mode == ViewManager::SelectMode && hasTopLayerTimeXAxis()) { |
1549 bool closeToLeft = false, closeToRight = false; | 1561 bool closeToLeft = false, closeToRight = false; |
1550 getSelectionAt(e->x(), closeToLeft, closeToRight); | 1562 getSelectionAt(e->x(), closeToLeft, closeToRight); |
1649 Qt::NoButton, | 1661 Qt::NoButton, |
1650 e->buttons(), | 1662 e->buttons(), |
1651 e->modifiers()); | 1663 e->modifiers()); |
1652 | 1664 |
1653 if (!editSelectionStart(&clickEvent)) { | 1665 if (!editSelectionStart(&clickEvent)) { |
1654 Layer *layer = getSelectedLayer(); | 1666 Layer *layer = getTopFlexiNoteLayer(); |
1655 if (layer && layer->isLayerEditable()) { | 1667 if (layer) { |
1656 std::cerr << "calling edit start" << std::endl; | 1668 std::cerr << "calling edit start" << std::endl; |
1657 layer->editStart(this, &clickEvent); | 1669 layer->editStart(this, &clickEvent); |
1658 } | 1670 } |
1659 } | 1671 } |
1660 } | 1672 } |