comparison view/Pane.cpp @ 711:084fd76deb89 tonioni

Allow per-pane overrides for tool mode
author Chris Cannam
date Thu, 09 Jan 2014 16:41:55 +0000
parents 917039d333bb
children 6d79ad93fef0
comparison
equal deleted inserted replaced
710:c65826b5e980 711:084fd76deb89
331 Pane::shouldIlluminateLocalFeatures(const Layer *layer, QPoint &pos) const 331 Pane::shouldIlluminateLocalFeatures(const Layer *layer, QPoint &pos) const
332 { 332 {
333 QPoint discard; 333 QPoint discard;
334 bool b0, b1; 334 bool b0, b1;
335 335
336 if (m_manager && m_manager->getToolMode() == ViewManager::MeasureMode) { 336 if (m_manager && m_manager->getToolModeFor(this) == ViewManager::MeasureMode) {
337 return false; 337 return false;
338 } 338 }
339 339
340 if (m_manager && !m_manager->shouldIlluminateLocalFeatures()) { 340 if (m_manager && !m_manager->shouldIlluminateLocalFeatures()) {
341 return false; 341 return false;
356 bool &closeToLeft, 356 bool &closeToLeft,
357 bool &closeToRight) const 357 bool &closeToRight) const
358 { 358 {
359 if (m_identifyFeatures && 359 if (m_identifyFeatures &&
360 m_manager && 360 m_manager &&
361 m_manager->getToolMode() == ViewManager::EditMode && 361 m_manager->getToolModeFor(this) == ViewManager::EditMode &&
362 !m_manager->getSelections().empty() && 362 !m_manager->getSelections().empty() &&
363 !selectionIsBeingEdited()) { 363 !selectionIsBeingEdited()) {
364 364
365 Selection s(getSelectionAt(m_identifyPoint.x(), 365 Selection s(getSelectionAt(m_identifyPoint.x(),
366 closeToLeft, closeToRight)); 366 closeToLeft, closeToRight));
411 paint.begin(this); 411 paint.begin(this);
412 setPaintFont(paint); 412 setPaintFont(paint);
413 413
414 if (e) paint.setClipRect(r); 414 if (e) paint.setClipRect(r);
415 415
416 ViewManager::ToolMode toolMode = m_manager->getToolMode(); 416 ViewManager::ToolMode toolMode = m_manager->getToolModeFor(this);
417 417
418 if (m_manager && 418 if (m_manager &&
419 // !m_manager->isPlaying() && 419 // !m_manager->isPlaying() &&
420 m_mouseInWidget && 420 m_mouseInWidget &&
421 toolMode == ViewManager::MeasureMode) { 421 toolMode == ViewManager::MeasureMode) {
1294 m_ctrlPressed = (e->modifiers() & Qt::ControlModifier); 1294 m_ctrlPressed = (e->modifiers() & Qt::ControlModifier);
1295 m_altPressed = (e->modifiers() & Qt::AltModifier); 1295 m_altPressed = (e->modifiers() & Qt::AltModifier);
1296 m_dragMode = UnresolvedDrag; 1296 m_dragMode = UnresolvedDrag;
1297 1297
1298 ViewManager::ToolMode mode = ViewManager::NavigateMode; 1298 ViewManager::ToolMode mode = ViewManager::NavigateMode;
1299 if (m_manager) mode = m_manager->getToolMode(); 1299 if (m_manager) mode = m_manager->getToolModeFor(this);
1300 1300
1301 m_navigating = false; 1301 m_navigating = false;
1302 m_resizing = false; 1302 m_resizing = false;
1303 m_editing = false; 1303 m_editing = false;
1304 m_releasing = false; 1304 m_releasing = false;
1413 } 1413 }
1414 1414
1415 // cerr << "mouseReleaseEvent" << endl; 1415 // cerr << "mouseReleaseEvent" << endl;
1416 1416
1417 ViewManager::ToolMode mode = ViewManager::NavigateMode; 1417 ViewManager::ToolMode mode = ViewManager::NavigateMode;
1418 if (m_manager) mode = m_manager->getToolMode(); 1418 if (m_manager) mode = m_manager->getToolModeFor(this);
1419 1419
1420 m_releasing = true; 1420 m_releasing = true;
1421 1421
1422 if (m_clickedInRange) { 1422 if (m_clickedInRange) {
1423 mouseMoveEvent(e); 1423 mouseMoveEvent(e);
1556 return; 1556 return;
1557 } 1557 }
1558 } 1558 }
1559 1559
1560 ViewManager::ToolMode mode = ViewManager::NavigateMode; 1560 ViewManager::ToolMode mode = ViewManager::NavigateMode;
1561 if (m_manager) mode = m_manager->getToolMode(); 1561 if (m_manager) mode = m_manager->getToolModeFor(this);
1562 1562
1563 QPoint prevPoint = m_identifyPoint; 1563 QPoint prevPoint = m_identifyPoint;
1564 m_identifyPoint = e->pos(); 1564 m_identifyPoint = e->pos();
1565 1565
1566 if (!m_clickedInRange) { 1566 if (!m_clickedInRange) {
2098 m_shiftPressed = (e->modifiers() & Qt::ShiftModifier); 2098 m_shiftPressed = (e->modifiers() & Qt::ShiftModifier);
2099 m_ctrlPressed = (e->modifiers() & Qt::ControlModifier); 2099 m_ctrlPressed = (e->modifiers() & Qt::ControlModifier);
2100 m_altPressed = (e->modifiers() & Qt::AltModifier); 2100 m_altPressed = (e->modifiers() & Qt::AltModifier);
2101 2101
2102 ViewManager::ToolMode mode = ViewManager::NavigateMode; 2102 ViewManager::ToolMode mode = ViewManager::NavigateMode;
2103 if (m_manager) mode = m_manager->getToolMode(); 2103 if (m_manager) mode = m_manager->getToolModeFor(this);
2104 2104
2105 bool relocate = (mode == ViewManager::NavigateMode || 2105 bool relocate = (mode == ViewManager::NavigateMode ||
2106 (e->buttons() & Qt::MidButton)); 2106 (e->buttons() & Qt::MidButton));
2107 2107
2108 if (mode == ViewManager::NavigateMode || 2108 if (mode == ViewManager::NavigateMode ||
2419 2419
2420 bool 2420 bool
2421 Pane::editSelectionStart(QMouseEvent *e) 2421 Pane::editSelectionStart(QMouseEvent *e)
2422 { 2422 {
2423 if (!m_identifyFeatures || 2423 if (!m_identifyFeatures ||
2424 !m_manager || 2424 !m_manager ||
2425 m_manager->getToolMode() != ViewManager::EditMode) { 2425 m_manager->getToolModeFor(this) != ViewManager::EditMode) {
2426 return false; 2426 return false;
2427 } 2427 }
2428 2428
2429 bool closeToLeft, closeToRight; 2429 bool closeToLeft, closeToRight;
2430 Selection s(getSelectionAt(e->x(), closeToLeft, closeToRight)); 2430 Selection s(getSelectionAt(e->x(), closeToLeft, closeToRight));
2431 if (s.isEmpty()) return false; 2431 if (s.isEmpty()) return false;
2497 } 2497 }
2498 2498
2499 void 2499 void
2500 Pane::toolModeChanged() 2500 Pane::toolModeChanged()
2501 { 2501 {
2502 ViewManager::ToolMode mode = m_manager->getToolMode(); 2502 ViewManager::ToolMode mode = m_manager->getToolModeFor(this);
2503 // SVDEBUG << "Pane::toolModeChanged(" << mode << ")" << endl; 2503 // SVDEBUG << "Pane::toolModeChanged(" << mode << ")" << endl;
2504 2504
2505 if (mode == ViewManager::MeasureMode && !m_measureCursor1) { 2505 if (mode == ViewManager::MeasureMode && !m_measureCursor1) {
2506 m_measureCursor1 = new QCursor(QBitmap(":/icons/measure1cursor.xbm"), 2506 m_measureCursor1 = new QCursor(QBitmap(":/icons/measure1cursor.xbm"),
2507 QBitmap(":/icons/measure1mask.xbm"), 2507 QBitmap(":/icons/measure1mask.xbm"),
2627 emit contextHelpChanged(""); 2627 emit contextHelpChanged("");
2628 return; 2628 return;
2629 } 2629 }
2630 2630
2631 ViewManager::ToolMode mode = ViewManager::NavigateMode; 2631 ViewManager::ToolMode mode = ViewManager::NavigateMode;
2632 if (m_manager) mode = m_manager->getToolMode(); 2632 if (m_manager) mode = m_manager->getToolModeFor(this);
2633 2633
2634 bool editable = false; 2634 bool editable = false;
2635 Layer *layer = getSelectedLayer(); 2635 Layer *layer = getSelectedLayer();
2636 if (layer && layer->isLayerEditable()) { 2636 if (layer && layer->isLayerEditable()) {
2637 editable = true; 2637 editable = true;