comparison layer/TextLayer.cpp @ 586:1ae54a29e59e

Merge from debug-output branch
author Chris Cannam
date Tue, 14 Jun 2011 14:48:29 +0100
parents f4960f8ce798
children 4806715f7a19
comparison
equal deleted inserted replaced
583:4c484636d5ec 586:1ae54a29e59e
49 if (m_model == model) return; 49 if (m_model == model) return;
50 m_model = model; 50 m_model = model;
51 51
52 connectSignals(m_model); 52 connectSignals(m_model);
53 53
54 // std::cerr << "TextLayer::setModel(" << model << ")" << std::endl; 54 // DEBUG << "TextLayer::setModel(" << model << ")" << endl;
55 55
56 emit modelReplaced(); 56 emit modelReplaced();
57 } 57 }
58 58
59 Layer::PropertyList 59 Layer::PropertyList
329 brushColour.setHsv(h, s, 255, 100); 329 brushColour.setHsv(h, s, 255, 100);
330 330
331 QColor penColour; 331 QColor penColour;
332 penColour = v->getForeground(); 332 penColour = v->getForeground();
333 333
334 // std::cerr << "TextLayer::paint: resolution is " 334 // DEBUG << "TextLayer::paint: resolution is "
335 // << m_model->getResolution() << " frames" << std::endl; 335 // << m_model->getResolution() << " frames" << endl;
336 336
337 QPoint localPos; 337 QPoint localPos;
338 TextModel::Point illuminatePoint(0); 338 TextModel::Point illuminatePoint(0);
339 bool shouldIlluminate; 339 bool shouldIlluminate;
340 340
411 } 411 }
412 412
413 void 413 void
414 TextLayer::drawStart(View *v, QMouseEvent *e) 414 TextLayer::drawStart(View *v, QMouseEvent *e)
415 { 415 {
416 // std::cerr << "TextLayer::drawStart(" << e->x() << "," << e->y() << ")" << std::endl; 416 // DEBUG << "TextLayer::drawStart(" << e->x() << "," << e->y() << ")" << endl;
417 417
418 if (!m_model) { 418 if (!m_model) {
419 std::cerr << "TextLayer::drawStart: no model" << std::endl; 419 DEBUG << "TextLayer::drawStart: no model" << endl;
420 return; 420 return;
421 } 421 }
422 422
423 long frame = v->getFrameForX(e->x()); 423 long frame = v->getFrameForX(e->x());
424 if (frame < 0) frame = 0; 424 if (frame < 0) frame = 0;
437 } 437 }
438 438
439 void 439 void
440 TextLayer::drawDrag(View *v, QMouseEvent *e) 440 TextLayer::drawDrag(View *v, QMouseEvent *e)
441 { 441 {
442 // std::cerr << "TextLayer::drawDrag(" << e->x() << "," << e->y() << ")" << std::endl; 442 // DEBUG << "TextLayer::drawDrag(" << e->x() << "," << e->y() << ")" << endl;
443 443
444 if (!m_model || !m_editing) return; 444 if (!m_model || !m_editing) return;
445 445
446 long frame = v->getFrameForX(e->x()); 446 long frame = v->getFrameForX(e->x());
447 if (frame < 0) frame = 0; 447 if (frame < 0) frame = 0;
456 } 456 }
457 457
458 void 458 void
459 TextLayer::drawEnd(View *v, QMouseEvent *) 459 TextLayer::drawEnd(View *v, QMouseEvent *)
460 { 460 {
461 // std::cerr << "TextLayer::drawEnd(" << e->x() << "," << e->y() << ")" << std::endl; 461 // DEBUG << "TextLayer::drawEnd(" << e->x() << "," << e->y() << ")" << endl;
462 if (!m_model || !m_editing) return; 462 if (!m_model || !m_editing) return;
463 463
464 bool ok = false; 464 bool ok = false;
465 QString label = QInputDialog::getText(v, tr("Enter label"), 465 QString label = QInputDialog::getText(v, tr("Enter label"),
466 tr("Please enter a new label:"), 466 tr("Please enter a new label:"),
521 } 521 }
522 522
523 void 523 void
524 TextLayer::editStart(View *v, QMouseEvent *e) 524 TextLayer::editStart(View *v, QMouseEvent *e)
525 { 525 {
526 // std::cerr << "TextLayer::editStart(" << e->x() << "," << e->y() << ")" << std::endl; 526 // DEBUG << "TextLayer::editStart(" << e->x() << "," << e->y() << ")" << endl;
527 527
528 if (!m_model) return; 528 if (!m_model) return;
529 529
530 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) { 530 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) {
531 return; 531 return;
570 } 570 }
571 571
572 void 572 void
573 TextLayer::editEnd(View *, QMouseEvent *) 573 TextLayer::editEnd(View *, QMouseEvent *)
574 { 574 {
575 // std::cerr << "TextLayer::editEnd(" << e->x() << "," << e->y() << ")" << std::endl; 575 // DEBUG << "TextLayer::editEnd(" << e->x() << "," << e->y() << ")" << endl;
576 if (!m_model || !m_editing) return; 576 if (!m_model || !m_editing) return;
577 577
578 if (m_editingCommand) { 578 if (m_editingCommand) {
579 579
580 QString newName = m_editingCommand->getName(); 580 QString newName = m_editingCommand->getName();