comparison layer/TextLayer.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 2e8194a30f40
comparison
equal deleted inserted replaced
375:daaf1c435d98 376:e1a9e478b7f2
16 #include "TextLayer.h" 16 #include "TextLayer.h"
17 17
18 #include "data/model/Model.h" 18 #include "data/model/Model.h"
19 #include "base/RealTime.h" 19 #include "base/RealTime.h"
20 #include "base/Profiler.h" 20 #include "base/Profiler.h"
21 #include "base/ColourDatabase.h" 21 #include "ColourDatabase.h"
22 #include "view/View.h" 22 #include "view/View.h"
23 23
24 #include "data/model/TextModel.h" 24 #include "data/model/TextModel.h"
25 25
26 #include <QPainter> 26 #include <QPainter>
396 float height = getHeightForY(v, e->y()); 396 float height = getHeightForY(v, e->y());
397 397
398 m_editingPoint = TextModel::Point(frame, height, ""); 398 m_editingPoint = TextModel::Point(frame, height, "");
399 m_originalPoint = m_editingPoint; 399 m_originalPoint = m_editingPoint;
400 400
401 if (m_editingCommand) m_editingCommand->finish(); 401 if (m_editingCommand) finish(m_editingCommand);
402 m_editingCommand = new TextModel::EditCommand(m_model, "Add Label"); 402 m_editingCommand = new TextModel::EditCommand(m_model, "Add Label");
403 m_editingCommand->addPoint(m_editingPoint); 403 m_editingCommand->addPoint(m_editingPoint);
404 404
405 m_editing = true; 405 m_editing = true;
406 } 406 }
441 m_editingCommand->addCommand(command); 441 m_editingCommand->addCommand(command);
442 } else { 442 } else {
443 m_editingCommand->deletePoint(m_editingPoint); 443 m_editingCommand->deletePoint(m_editingPoint);
444 } 444 }
445 445
446 m_editingCommand->finish(); 446 finish(m_editingCommand);
447 m_editingCommand = 0; 447 m_editingCommand = 0;
448 m_editing = false; 448 m_editing = false;
449 } 449 }
450 450
451 void 451 void
457 if (points.empty()) return; 457 if (points.empty()) return;
458 458
459 m_editingPoint = *points.begin(); 459 m_editingPoint = *points.begin();
460 460
461 if (m_editingCommand) { 461 if (m_editingCommand) {
462 m_editingCommand->finish(); 462 finish(m_editingCommand);
463 m_editingCommand = 0; 463 m_editingCommand = 0;
464 } 464 }
465 465
466 m_editing = true; 466 m_editing = true;
467 } 467 }
486 m_editingCommand = new TextModel::EditCommand 486 m_editingCommand = new TextModel::EditCommand
487 (m_model, tr("Erase Point")); 487 (m_model, tr("Erase Point"));
488 488
489 m_editingCommand->deletePoint(m_editingPoint); 489 m_editingCommand->deletePoint(m_editingPoint);
490 490
491 m_editingCommand->finish(); 491 finish(m_editingCommand);
492 m_editingCommand = 0; 492 m_editingCommand = 0;
493 m_editing = false; 493 m_editing = false;
494 } 494 }
495 495
496 void 496 void
506 m_editOrigin = e->pos(); 506 m_editOrigin = e->pos();
507 m_editingPoint = *points.begin(); 507 m_editingPoint = *points.begin();
508 m_originalPoint = m_editingPoint; 508 m_originalPoint = m_editingPoint;
509 509
510 if (m_editingCommand) { 510 if (m_editingCommand) {
511 m_editingCommand->finish(); 511 finish(m_editingCommand);
512 m_editingCommand = 0; 512 m_editingCommand = 0;
513 } 513 }
514 514
515 m_editing = true; 515 m_editing = true;
516 } 516 }
561 } else { 561 } else {
562 newName = tr("Move Label Vertically"); 562 newName = tr("Move Label Vertically");
563 } 563 }
564 564
565 m_editingCommand->setName(newName); 565 m_editingCommand->setName(newName);
566 m_editingCommand->finish(); 566 finish(m_editingCommand);
567 } 567 }
568 568
569 m_editingCommand = 0; 569 m_editingCommand = 0;
570 m_editing = false; 570 m_editing = false;
571 } 571 }
613 command->deletePoint(*i); 613 command->deletePoint(*i);
614 command->addPoint(newPoint); 614 command->addPoint(newPoint);
615 } 615 }
616 } 616 }
617 617
618 command->finish(); 618 finish(command);
619 } 619 }
620 620
621 void 621 void
622 TextLayer::resizeSelection(Selection s, Selection newSize) 622 TextLayer::resizeSelection(Selection s, Selection newSize)
623 { 623 {
647 command->deletePoint(*i); 647 command->deletePoint(*i);
648 command->addPoint(newPoint); 648 command->addPoint(newPoint);
649 } 649 }
650 } 650 }
651 651
652 command->finish(); 652 finish(command);
653 } 653 }
654 654
655 void 655 void
656 TextLayer::deleteSelection(Selection s) 656 TextLayer::deleteSelection(Selection s)
657 { 657 {
666 for (TextModel::PointList::iterator i = points.begin(); 666 for (TextModel::PointList::iterator i = points.begin();
667 i != points.end(); ++i) { 667 i != points.end(); ++i) {
668 if (s.contains(i->frame)) command->deletePoint(*i); 668 if (s.contains(i->frame)) command->deletePoint(*i);
669 } 669 }
670 670
671 command->finish(); 671 finish(command);
672 } 672 }
673 673
674 void 674 void
675 TextLayer::copy(View *v, Selection s, Clipboard &to) 675 TextLayer::copy(View *v, Selection s, Clipboard &to)
676 { 676 {
765 } 765 }
766 766
767 command->addPoint(newPoint); 767 command->addPoint(newPoint);
768 } 768 }
769 769
770 command->finish(); 770 finish(command);
771 return true; 771 return true;
772 } 772 }
773 773
774 int 774 int
775 TextLayer::getDefaultColourHint(bool darkbg, bool &impose) 775 TextLayer::getDefaultColourHint(bool darkbg, bool &impose)