comparison layer/TimeInstantLayer.cpp @ 1414:fa986b91d77f

Merge from branch fix-static-analysis
author Chris Cannam
date Wed, 09 Jan 2019 15:24:51 +0000
parents c8a6fd3f9dff
children 62e908518c71
comparison
equal deleted inserted replaced
1413:0930a27ebea2 1414:fa986b91d77f
39 39
40 //#define DEBUG_TIME_INSTANT_LAYER 1 40 //#define DEBUG_TIME_INSTANT_LAYER 1
41 41
42 TimeInstantLayer::TimeInstantLayer() : 42 TimeInstantLayer::TimeInstantLayer() :
43 SingleColourLayer(), 43 SingleColourLayer(),
44 m_model(0), 44 m_model(nullptr),
45 m_editing(false), 45 m_editing(false),
46 m_editingPoint(0, tr("New Point")), 46 m_editingPoint(0, tr("New Point")),
47 m_editingCommand(0), 47 m_editingCommand(nullptr),
48 m_plotStyle(PlotInstants) 48 m_plotStyle(PlotInstants)
49 { 49 {
50 } 50 }
51 51
52 TimeInstantLayer::~TimeInstantLayer() 52 TimeInstantLayer::~TimeInstantLayer()
520 .arg(RealTime::frame2RealTime(m_editingPoint.frame, 520 .arg(RealTime::frame2RealTime(m_editingPoint.frame,
521 m_model->getSampleRate()) 521 m_model->getSampleRate())
522 .toText(false).c_str()); 522 .toText(false).c_str());
523 m_editingCommand->setName(newName); 523 m_editingCommand->setName(newName);
524 finish(m_editingCommand); 524 finish(m_editingCommand);
525 m_editingCommand = 0; 525 m_editingCommand = nullptr;
526 m_editing = false; 526 m_editing = false;
527 } 527 }
528 528
529 void 529 void
530 TimeInstantLayer::eraseStart(LayerGeometryProvider *v, QMouseEvent *e) 530 TimeInstantLayer::eraseStart(LayerGeometryProvider *v, QMouseEvent *e)
536 536
537 m_editingPoint = *points.begin(); 537 m_editingPoint = *points.begin();
538 538
539 if (m_editingCommand) { 539 if (m_editingCommand) {
540 finish(m_editingCommand); 540 finish(m_editingCommand);
541 m_editingCommand = 0; 541 m_editingCommand = nullptr;
542 } 542 }
543 543
544 m_editing = true; 544 m_editing = true;
545 } 545 }
546 546
564 (m_model, tr("Erase Point")); 564 (m_model, tr("Erase Point"));
565 565
566 m_editingCommand->deletePoint(m_editingPoint); 566 m_editingCommand->deletePoint(m_editingPoint);
567 567
568 finish(m_editingCommand); 568 finish(m_editingCommand);
569 m_editingCommand = 0; 569 m_editingCommand = nullptr;
570 m_editing = false; 570 m_editing = false;
571 } 571 }
572 572
573 void 573 void
574 TimeInstantLayer::editStart(LayerGeometryProvider *v, QMouseEvent *e) 574 TimeInstantLayer::editStart(LayerGeometryProvider *v, QMouseEvent *e)
584 584
585 m_editingPoint = *points.begin(); 585 m_editingPoint = *points.begin();
586 586
587 if (m_editingCommand) { 587 if (m_editingCommand) {
588 finish(m_editingCommand); 588 finish(m_editingCommand);
589 m_editingCommand = 0; 589 m_editingCommand = nullptr;
590 } 590 }
591 591
592 m_editing = true; 592 m_editing = true;
593 } 593 }
594 594
628 m_model->getSampleRate()) 628 m_model->getSampleRate())
629 .toText(false).c_str()); 629 .toText(false).c_str());
630 m_editingCommand->setName(newName); 630 m_editingCommand->setName(newName);
631 finish(m_editingCommand); 631 finish(m_editingCommand);
632 } 632 }
633 m_editingCommand = 0; 633 m_editingCommand = nullptr;
634 m_editing = false; 634 m_editing = false;
635 } 635 }
636 636
637 bool 637 bool
638 TimeInstantLayer::editOpen(LayerGeometryProvider *v, QMouseEvent *e) 638 TimeInstantLayer::editOpen(LayerGeometryProvider *v, QMouseEvent *e)