comparison framework/Document.cpp @ 387:a4c2a4685cf1

Debug out
author Chris Cannam
date Fri, 25 Jul 2014 15:22:21 +0100
parents f1cab64363d7
children edfdb1d5db3c
comparison
equal deleted inserted replaced
386:105b4e237434 387:a4c2a4685cf1
563 oldMainModel->aboutToDelete(); 563 oldMainModel->aboutToDelete();
564 emit modelAboutToBeDeleted(oldMainModel); 564 emit modelAboutToBeDeleted(oldMainModel);
565 } 565 }
566 566
567 if (m_autoAlignment) { 567 if (m_autoAlignment) {
568 SVDEBUG << "Document::setMainModel: auto-alignment is on, aligning model if possible" << endl;
568 alignModel(m_mainModel); 569 alignModel(m_mainModel);
569 } 570 }
570 571
571 emit mainModelChanged(m_mainModel); 572 emit mainModelChanged(m_mainModel);
572 573
639 cerr << i->first << " "; 640 cerr << i->first << " ";
640 } 641 }
641 cerr << endl; 642 cerr << endl;
642 #endif 643 #endif
643 644
644 if (m_autoAlignment) alignModel(model); 645 if (m_autoAlignment) {
646 SVDEBUG << "Document::addImportedModel: auto-alignment is on, aligning model if possible" << endl;
647 alignModel(model);
648 } else {
649 SVDEBUG << "Document(" << this << "): addImportedModel: auto-alignment is off" << endl;
650 }
645 651
646 emit modelAdded(model); 652 emit modelAdded(model);
647 } 653 }
648 654
649 void 655 void
669 cerr << i->first << " "; 675 cerr << i->first << " ";
670 } 676 }
671 cerr << endl; 677 cerr << endl;
672 #endif 678 #endif
673 679
674 if (m_autoAlignment) alignModel(model); 680 if (m_autoAlignment) {
681 SVDEBUG << "Document::addAdditionalModel: auto-alignment is on, aligning model if possible" << endl;
682 alignModel(model);
683 }
675 684
676 emit modelAdded(model); 685 emit modelAdded(model);
677 } 686 }
678 687
679 Model * 688 Model *
1042 } 1051 }
1043 1052
1044 void 1053 void
1045 Document::alignModel(Model *model) 1054 Document::alignModel(Model *model)
1046 { 1055 {
1047 if (!m_mainModel) return; 1056 SVDEBUG << "Document::alignModel(" << model << ")" << endl;
1057
1058 if (!m_mainModel) {
1059 SVDEBUG << "(no main model to align to)" << endl;
1060 return;
1061 }
1048 1062
1049 RangeSummarisableTimeValueModel *rm = 1063 RangeSummarisableTimeValueModel *rm =
1050 dynamic_cast<RangeSummarisableTimeValueModel *>(model); 1064 dynamic_cast<RangeSummarisableTimeValueModel *>(model);
1051 if (!rm) return; 1065 if (!rm) {
1066 SVDEBUG << "(main model is not alignable-to)" << endl;
1067 return;
1068 }
1052 1069
1053 if (rm->getAlignmentReference() == m_mainModel) { 1070 if (rm->getAlignmentReference() == m_mainModel) {
1054 SVDEBUG << "Document::alignModel: model " << rm << " is already aligned to main model " << m_mainModel << endl; 1071 SVDEBUG << "(model " << rm << " is already aligned to main model " << m_mainModel << ")" << endl;
1055 return; 1072 return;
1056 } 1073 }
1057 1074
1058 if (model == m_mainModel) { 1075 if (model == m_mainModel) {
1059 // The reference has an empty alignment to itself. This makes 1076 // The reference has an empty alignment to itself. This makes