Mercurial > hg > svgui
comparison layer/ImageLayer.cpp @ 585:f4960f8ce798 debug-output
Convert many cerrs to DEBUGs
author | Chris Cannam |
---|---|
date | Mon, 16 May 2011 17:19:25 +0100 |
parents | 1fe7951a61e8 |
children | 4806715f7a19 |
comparison
equal
deleted
inserted
replaced
584:1fe7951a61e8 | 585:f4960f8ce798 |
---|---|
125 ImageModel::PointList | 125 ImageModel::PointList |
126 ImageLayer::getLocalPoints(View *v, int x, int y) const | 126 ImageLayer::getLocalPoints(View *v, int x, int y) const |
127 { | 127 { |
128 if (!m_model) return ImageModel::PointList(); | 128 if (!m_model) return ImageModel::PointList(); |
129 | 129 |
130 // std::cerr << "ImageLayer::getLocalPoints(" << x << "," << y << "):"; | 130 // DEBUG << "ImageLayer::getLocalPoints(" << x << "," << y << "):"; |
131 const ImageModel::PointList &points(m_model->getPoints()); | 131 const ImageModel::PointList &points(m_model->getPoints()); |
132 | 132 |
133 ImageModel::PointList rv; | 133 ImageModel::PointList rv; |
134 | 134 |
135 for (ImageModel::PointList::const_iterator i = points.begin(); | 135 for (ImageModel::PointList::const_iterator i = points.begin(); |
153 // this image is a candidate, test it properly | 153 // this image is a candidate, test it properly |
154 | 154 |
155 int width = 32; | 155 int width = 32; |
156 if (m_scaled[v].find(p.image) != m_scaled[v].end()) { | 156 if (m_scaled[v].find(p.image) != m_scaled[v].end()) { |
157 width = m_scaled[v][p.image].width(); | 157 width = m_scaled[v][p.image].width(); |
158 // std::cerr << "scaled width = " << width << std::endl; | 158 // DEBUG << "scaled width = " << width << endl; |
159 } | 159 } |
160 | 160 |
161 if (x >= px && x < px + width) { | 161 if (x >= px && x < px + width) { |
162 rv.insert(p); | 162 rv.insert(p); |
163 } | 163 } |
519 QImage | 519 QImage |
520 ImageLayer::getImage(View *v, QString name, QSize maxSize) const | 520 ImageLayer::getImage(View *v, QString name, QSize maxSize) const |
521 { | 521 { |
522 bool need = false; | 522 bool need = false; |
523 | 523 |
524 // std::cerr << "ImageLayer::getImage(" << v << ", " << name << ", (" | 524 // DEBUG << "ImageLayer::getImage(" << v << ", " << name << ", (" |
525 // << maxSize.width() << "x" << maxSize.height() << "))" << std::endl; | 525 // << maxSize.width() << "x" << maxSize.height() << "))" << endl; |
526 | 526 |
527 if (!m_scaled[v][name].isNull() && | 527 if (!m_scaled[v][name].isNull() && |
528 ((m_scaled[v][name].width() == maxSize.width() && | 528 ((m_scaled[v][name].width() == maxSize.width() && |
529 m_scaled[v][name].height() <= maxSize.height()) || | 529 m_scaled[v][name].height() <= maxSize.height()) || |
530 (m_scaled[v][name].width() <= maxSize.width() && | 530 (m_scaled[v][name].width() <= maxSize.width() && |
556 } | 556 } |
557 | 557 |
558 void | 558 void |
559 ImageLayer::drawStart(View *v, QMouseEvent *e) | 559 ImageLayer::drawStart(View *v, QMouseEvent *e) |
560 { | 560 { |
561 // std::cerr << "ImageLayer::drawStart(" << e->x() << "," << e->y() << ")" << std::endl; | 561 // DEBUG << "ImageLayer::drawStart(" << e->x() << "," << e->y() << ")" << endl; |
562 | 562 |
563 if (!m_model) { | 563 if (!m_model) { |
564 std::cerr << "ImageLayer::drawStart: no model" << std::endl; | 564 DEBUG << "ImageLayer::drawStart: no model" << endl; |
565 return; | 565 return; |
566 } | 566 } |
567 | 567 |
568 long frame = v->getFrameForX(e->x()); | 568 long frame = v->getFrameForX(e->x()); |
569 if (frame < 0) frame = 0; | 569 if (frame < 0) frame = 0; |
580 } | 580 } |
581 | 581 |
582 void | 582 void |
583 ImageLayer::drawDrag(View *v, QMouseEvent *e) | 583 ImageLayer::drawDrag(View *v, QMouseEvent *e) |
584 { | 584 { |
585 // std::cerr << "ImageLayer::drawDrag(" << e->x() << "," << e->y() << ")" << std::endl; | 585 // DEBUG << "ImageLayer::drawDrag(" << e->x() << "," << e->y() << ")" << endl; |
586 | 586 |
587 if (!m_model || !m_editing) return; | 587 if (!m_model || !m_editing) return; |
588 | 588 |
589 long frame = v->getFrameForX(e->x()); | 589 long frame = v->getFrameForX(e->x()); |
590 if (frame < 0) frame = 0; | 590 if (frame < 0) frame = 0; |
596 } | 596 } |
597 | 597 |
598 void | 598 void |
599 ImageLayer::drawEnd(View *v, QMouseEvent *) | 599 ImageLayer::drawEnd(View *v, QMouseEvent *) |
600 { | 600 { |
601 // std::cerr << "ImageLayer::drawEnd(" << e->x() << "," << e->y() << ")" << std::endl; | 601 // DEBUG << "ImageLayer::drawEnd(" << e->x() << "," << e->y() << ")" << endl; |
602 if (!m_model || !m_editing) return; | 602 if (!m_model || !m_editing) return; |
603 | 603 |
604 bool ok = false; | 604 bool ok = false; |
605 | 605 |
606 ImageDialog dialog(tr("Select image"), "", ""); | 606 ImageDialog dialog(tr("Select image"), "", ""); |
642 } | 642 } |
643 | 643 |
644 void | 644 void |
645 ImageLayer::editStart(View *v, QMouseEvent *e) | 645 ImageLayer::editStart(View *v, QMouseEvent *e) |
646 { | 646 { |
647 // std::cerr << "ImageLayer::editStart(" << e->x() << "," << e->y() << ")" << std::endl; | 647 // DEBUG << "ImageLayer::editStart(" << e->x() << "," << e->y() << ")" << endl; |
648 | 648 |
649 if (!m_model) return; | 649 if (!m_model) return; |
650 | 650 |
651 ImageModel::PointList points = getLocalPoints(v, e->x(), e->y()); | 651 ImageModel::PointList points = getLocalPoints(v, e->x(), e->y()); |
652 if (points.empty()) return; | 652 if (points.empty()) return; |
684 } | 684 } |
685 | 685 |
686 void | 686 void |
687 ImageLayer::editEnd(View *, QMouseEvent *) | 687 ImageLayer::editEnd(View *, QMouseEvent *) |
688 { | 688 { |
689 // std::cerr << "ImageLayer::editEnd(" << e->x() << "," << e->y() << ")" << std::endl; | 689 // DEBUG << "ImageLayer::editEnd(" << e->x() << "," << e->y() << ")" << endl; |
690 if (!m_model || !m_editing) return; | 690 if (!m_model || !m_editing) return; |
691 | 691 |
692 if (m_editingCommand) { | 692 if (m_editingCommand) { |
693 finish(m_editingCommand); | 693 finish(m_editingCommand); |
694 } | 694 } |
904 } | 904 } |
905 | 905 |
906 void | 906 void |
907 ImageLayer::checkAddSource(QString img) const | 907 ImageLayer::checkAddSource(QString img) const |
908 { | 908 { |
909 std::cerr << "ImageLayer::checkAddSource(" << img << "): yes, trying..." << std::endl; | 909 DEBUG << "ImageLayer::checkAddSource(" << img << "): yes, trying..." << endl; |
910 | 910 |
911 if (m_fileSources.find(img) != m_fileSources.end()) { | 911 if (m_fileSources.find(img) != m_fileSources.end()) { |
912 return; | 912 return; |
913 } | 913 } |
914 | 914 |
936 } | 936 } |
937 | 937 |
938 void | 938 void |
939 ImageLayer::fileSourceReady() | 939 ImageLayer::fileSourceReady() |
940 { | 940 { |
941 // std::cerr << "ImageLayer::fileSourceReady" << std::endl; | 941 // DEBUG << "ImageLayer::fileSourceReady" << endl; |
942 | 942 |
943 FileSource *rf = dynamic_cast<FileSource *>(sender()); | 943 FileSource *rf = dynamic_cast<FileSource *>(sender()); |
944 if (!rf) return; | 944 if (!rf) return; |
945 | 945 |
946 QString img; | 946 QString img; |