Mercurial > hg > svgui
comparison layer/TimeInstantLayer.cpp @ 376:e1a9e478b7f2
* juggle some files around in order to free audioio, base, and system libraries
from dependency on QtGui
author | Chris Cannam |
---|---|
date | Wed, 12 Mar 2008 17:42:56 +0000 |
parents | d58701996fae |
children | f329416bf1a5 |
comparison
equal
deleted
inserted
replaced
375:daaf1c435d98 | 376:e1a9e478b7f2 |
---|---|
18 #include "data/model/Model.h" | 18 #include "data/model/Model.h" |
19 #include "base/RealTime.h" | 19 #include "base/RealTime.h" |
20 #include "view/View.h" | 20 #include "view/View.h" |
21 #include "base/Profiler.h" | 21 #include "base/Profiler.h" |
22 #include "base/Clipboard.h" | 22 #include "base/Clipboard.h" |
23 #include "base/ColourDatabase.h" | 23 #include "ColourDatabase.h" |
24 | 24 |
25 #include "data/model/SparseOneDimensionalModel.h" | 25 #include "data/model/SparseOneDimensionalModel.h" |
26 | 26 |
27 #include "widgets/ItemEditDialog.h" | 27 #include "widgets/ItemEditDialog.h" |
28 #include "widgets/ListInputDialog.h" | 28 #include "widgets/ListInputDialog.h" |
454 if (frame < 0) frame = 0; | 454 if (frame < 0) frame = 0; |
455 frame = frame / m_model->getResolution() * m_model->getResolution(); | 455 frame = frame / m_model->getResolution() * m_model->getResolution(); |
456 | 456 |
457 m_editingPoint = SparseOneDimensionalModel::Point(frame, tr("New Point")); | 457 m_editingPoint = SparseOneDimensionalModel::Point(frame, tr("New Point")); |
458 | 458 |
459 if (m_editingCommand) m_editingCommand->finish(); | 459 if (m_editingCommand) finish(m_editingCommand); |
460 m_editingCommand = new SparseOneDimensionalModel::EditCommand(m_model, | 460 m_editingCommand = new SparseOneDimensionalModel::EditCommand(m_model, |
461 tr("Draw Point")); | 461 tr("Draw Point")); |
462 m_editingCommand->addPoint(m_editingPoint); | 462 m_editingCommand->addPoint(m_editingPoint); |
463 | 463 |
464 m_editing = true; | 464 m_editing = true; |
487 QString newName = tr("Add Point at %1 s") | 487 QString newName = tr("Add Point at %1 s") |
488 .arg(RealTime::frame2RealTime(m_editingPoint.frame, | 488 .arg(RealTime::frame2RealTime(m_editingPoint.frame, |
489 m_model->getSampleRate()) | 489 m_model->getSampleRate()) |
490 .toText(false).c_str()); | 490 .toText(false).c_str()); |
491 m_editingCommand->setName(newName); | 491 m_editingCommand->setName(newName); |
492 m_editingCommand->finish(); | 492 finish(m_editingCommand); |
493 m_editingCommand = 0; | 493 m_editingCommand = 0; |
494 m_editing = false; | 494 m_editing = false; |
495 } | 495 } |
496 | 496 |
497 void | 497 void |
503 if (points.empty()) return; | 503 if (points.empty()) return; |
504 | 504 |
505 m_editingPoint = *points.begin(); | 505 m_editingPoint = *points.begin(); |
506 | 506 |
507 if (m_editingCommand) { | 507 if (m_editingCommand) { |
508 m_editingCommand->finish(); | 508 finish(m_editingCommand); |
509 m_editingCommand = 0; | 509 m_editingCommand = 0; |
510 } | 510 } |
511 | 511 |
512 m_editing = true; | 512 m_editing = true; |
513 } | 513 } |
531 m_editingCommand = new SparseOneDimensionalModel::EditCommand | 531 m_editingCommand = new SparseOneDimensionalModel::EditCommand |
532 (m_model, tr("Erase Point")); | 532 (m_model, tr("Erase Point")); |
533 | 533 |
534 m_editingCommand->deletePoint(m_editingPoint); | 534 m_editingCommand->deletePoint(m_editingPoint); |
535 | 535 |
536 m_editingCommand->finish(); | 536 finish(m_editingCommand); |
537 m_editingCommand = 0; | 537 m_editingCommand = 0; |
538 m_editing = false; | 538 m_editing = false; |
539 } | 539 } |
540 | 540 |
541 void | 541 void |
549 if (points.empty()) return; | 549 if (points.empty()) return; |
550 | 550 |
551 m_editingPoint = *points.begin(); | 551 m_editingPoint = *points.begin(); |
552 | 552 |
553 if (m_editingCommand) { | 553 if (m_editingCommand) { |
554 m_editingCommand->finish(); | 554 finish(m_editingCommand); |
555 m_editingCommand = 0; | 555 m_editingCommand = 0; |
556 } | 556 } |
557 | 557 |
558 m_editing = true; | 558 m_editing = true; |
559 } | 559 } |
588 QString newName = tr("Move Point to %1 s") | 588 QString newName = tr("Move Point to %1 s") |
589 .arg(RealTime::frame2RealTime(m_editingPoint.frame, | 589 .arg(RealTime::frame2RealTime(m_editingPoint.frame, |
590 m_model->getSampleRate()) | 590 m_model->getSampleRate()) |
591 .toText(false).c_str()); | 591 .toText(false).c_str()); |
592 m_editingCommand->setName(newName); | 592 m_editingCommand->setName(newName); |
593 m_editingCommand->finish(); | 593 finish(m_editingCommand); |
594 } | 594 } |
595 m_editingCommand = 0; | 595 m_editingCommand = 0; |
596 m_editing = false; | 596 m_editing = false; |
597 } | 597 } |
598 | 598 |
622 | 622 |
623 SparseOneDimensionalModel::EditCommand *command = | 623 SparseOneDimensionalModel::EditCommand *command = |
624 new SparseOneDimensionalModel::EditCommand(m_model, tr("Edit Point")); | 624 new SparseOneDimensionalModel::EditCommand(m_model, tr("Edit Point")); |
625 command->deletePoint(point); | 625 command->deletePoint(point); |
626 command->addPoint(newPoint); | 626 command->addPoint(newPoint); |
627 command->finish(); | 627 finish(command); |
628 } | 628 } |
629 | 629 |
630 delete dialog; | 630 delete dialog; |
631 return true; | 631 return true; |
632 } | 632 } |
652 command->deletePoint(*i); | 652 command->deletePoint(*i); |
653 command->addPoint(newPoint); | 653 command->addPoint(newPoint); |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
657 command->finish(); | 657 finish(command); |
658 } | 658 } |
659 | 659 |
660 void | 660 void |
661 TimeInstantLayer::resizeSelection(Selection s, Selection newSize) | 661 TimeInstantLayer::resizeSelection(Selection s, Selection newSize) |
662 { | 662 { |
687 command->deletePoint(*i); | 687 command->deletePoint(*i); |
688 command->addPoint(newPoint); | 688 command->addPoint(newPoint); |
689 } | 689 } |
690 } | 690 } |
691 | 691 |
692 command->finish(); | 692 finish(command); |
693 } | 693 } |
694 | 694 |
695 void | 695 void |
696 TimeInstantLayer::deleteSelection(Selection s) | 696 TimeInstantLayer::deleteSelection(Selection s) |
697 { | 697 { |
707 for (SparseOneDimensionalModel::PointList::iterator i = points.begin(); | 707 for (SparseOneDimensionalModel::PointList::iterator i = points.begin(); |
708 i != points.end(); ++i) { | 708 i != points.end(); ++i) { |
709 if (s.contains(i->frame)) command->deletePoint(*i); | 709 if (s.contains(i->frame)) command->deletePoint(*i); |
710 } | 710 } |
711 | 711 |
712 command->finish(); | 712 finish(command); |
713 } | 713 } |
714 | 714 |
715 void | 715 void |
716 TimeInstantLayer::copy(View *v, Selection s, Clipboard &to) | 716 TimeInstantLayer::copy(View *v, Selection s, Clipboard &to) |
717 { | 717 { |
794 } | 794 } |
795 | 795 |
796 command->addPoint(newPoint); | 796 command->addPoint(newPoint); |
797 } | 797 } |
798 | 798 |
799 command->finish(); | 799 finish(command); |
800 return true; | 800 return true; |
801 } | 801 } |
802 | 802 |
803 int | 803 int |
804 TimeInstantLayer::getDefaultColourHint(bool darkbg, bool &impose) | 804 TimeInstantLayer::getDefaultColourHint(bool darkbg, bool &impose) |