Mercurial > hg > svgui
comparison layer/ImageLayer.cpp @ 1470:696e569ff21b by-id
Further layer updates for ById
author | Chris Cannam |
---|---|
date | Fri, 28 Jun 2019 17:37:22 +0100 |
parents | 11a150e65ee1 |
children | f2525e6cbdf1 |
comparison
equal
deleted
inserted
replaced
1469:11a150e65ee1 | 1470:696e569ff21b |
---|---|
539 | 539 |
540 m_editingPoint = Event(frame); | 540 m_editingPoint = Event(frame); |
541 m_originalPoint = m_editingPoint; | 541 m_originalPoint = m_editingPoint; |
542 | 542 |
543 if (m_editingCommand) finish(m_editingCommand); | 543 if (m_editingCommand) finish(m_editingCommand); |
544 m_editingCommand = new ChangeEventsCommand<Model>(m_model, "Add Image"); | 544 m_editingCommand = new ChangeEventsCommand(m_model.untyped, "Add Image"); |
545 m_editingCommand->add(m_editingPoint); | 545 m_editingCommand->add(m_editingPoint); |
546 | 546 |
547 m_editing = true; | 547 m_editing = true; |
548 } | 548 } |
549 | 549 |
602 return false; | 602 return false; |
603 } | 603 } |
604 | 604 |
605 Event point = Event(frame).withURI(url); | 605 Event point = Event(frame).withURI(url); |
606 auto command = | 606 auto command = |
607 new ChangeEventsCommand<Model>(m_model, "Add Image"); | 607 new ChangeEventsCommand(m_model.untyped, "Add Image"); |
608 command->add(point); | 608 command->add(point); |
609 finish(command); | 609 finish(command); |
610 return true; | 610 return true; |
611 } | 611 } |
612 | 612 |
644 | 644 |
645 if (frame < 0) frame = 0; | 645 if (frame < 0) frame = 0; |
646 frame = (frame / model->getResolution()) * model->getResolution(); | 646 frame = (frame / model->getResolution()) * model->getResolution(); |
647 | 647 |
648 if (!m_editingCommand) { | 648 if (!m_editingCommand) { |
649 m_editingCommand = new ChangeEventsCommand<Model>(m_model, tr("Move Image")); | 649 m_editingCommand = new ChangeEventsCommand(m_model.untyped, tr("Move Image")); |
650 } | 650 } |
651 | 651 |
652 m_editingCommand->remove(m_editingPoint); | 652 m_editingCommand->remove(m_editingPoint); |
653 m_editingPoint = m_editingPoint | 653 m_editingPoint = m_editingPoint |
654 .withFrame(frame); | 654 .withFrame(frame); |
689 if (dialog.exec() == QDialog::Accepted) { | 689 if (dialog.exec() == QDialog::Accepted) { |
690 | 690 |
691 checkAddSource(dialog.getImage()); | 691 checkAddSource(dialog.getImage()); |
692 | 692 |
693 auto command = | 693 auto command = |
694 new ChangeEventsCommand<Model>(m_model, tr("Edit Image")); | 694 new ChangeEventsCommand(m_model.untyped, tr("Edit Image")); |
695 command->remove(*points.begin()); | 695 command->remove(*points.begin()); |
696 command->add(points.begin()-> | 696 command->add(points.begin()-> |
697 withURI(dialog.getImage()).withLabel(dialog.getLabel())); | 697 withURI(dialog.getImage()).withLabel(dialog.getLabel())); |
698 finish(command); | 698 finish(command); |
699 } | 699 } |
706 { | 706 { |
707 auto model = ModelById::getAs<ImageModel>(m_model); | 707 auto model = ModelById::getAs<ImageModel>(m_model); |
708 if (!model) return; | 708 if (!model) return; |
709 | 709 |
710 auto command = | 710 auto command = |
711 new ChangeEventsCommand<Model>(m_model, tr("Drag Selection")); | 711 new ChangeEventsCommand(m_model.untyped, tr("Drag Selection")); |
712 | 712 |
713 EventVector points = | 713 EventVector points = |
714 model->getEventsStartingWithin(s.getStartFrame(), s.getDuration()); | 714 model->getEventsStartingWithin(s.getStartFrame(), s.getDuration()); |
715 | 715 |
716 for (Event p: points) { | 716 for (Event p: points) { |
728 { | 728 { |
729 auto model = ModelById::getAs<ImageModel>(m_model); | 729 auto model = ModelById::getAs<ImageModel>(m_model); |
730 if (!model) return; | 730 if (!model) return; |
731 | 731 |
732 auto command = | 732 auto command = |
733 new ChangeEventsCommand<Model>(m_model, tr("Resize Selection")); | 733 new ChangeEventsCommand(m_model.untyped, tr("Resize Selection")); |
734 | 734 |
735 EventVector points = | 735 EventVector points = |
736 model->getEventsStartingWithin(s.getStartFrame(), s.getDuration()); | 736 model->getEventsStartingWithin(s.getStartFrame(), s.getDuration()); |
737 | 737 |
738 double ratio = double(newSize.getDuration()) / double(s.getDuration()); | 738 double ratio = double(newSize.getDuration()) / double(s.getDuration()); |
757 { | 757 { |
758 auto model = ModelById::getAs<ImageModel>(m_model); | 758 auto model = ModelById::getAs<ImageModel>(m_model); |
759 if (!model) return; | 759 if (!model) return; |
760 | 760 |
761 auto command = | 761 auto command = |
762 new ChangeEventsCommand<Model>(m_model, tr("Delete Selection")); | 762 new ChangeEventsCommand(m_model.untyped, tr("Delete Selection")); |
763 | 763 |
764 EventVector points = | 764 EventVector points = |
765 model->getEventsStartingWithin(s.getStartFrame(), s.getDuration()); | 765 model->getEventsStartingWithin(s.getStartFrame(), s.getDuration()); |
766 | 766 |
767 for (Event p: points) { | 767 for (Event p: points) { |
810 if (button == QMessageBox::Yes) { | 810 if (button == QMessageBox::Yes) { |
811 realign = true; | 811 realign = true; |
812 } | 812 } |
813 } | 813 } |
814 | 814 |
815 auto command = new ChangeEventsCommand<Model>(m_model, tr("Paste")); | 815 auto command = new ChangeEventsCommand(m_model.untyped, tr("Paste")); |
816 | 816 |
817 for (EventVector::const_iterator i = points.begin(); | 817 for (EventVector::const_iterator i = points.begin(); |
818 i != points.end(); ++i) { | 818 i != points.end(); ++i) { |
819 | 819 |
820 sv_frame_t frame = 0; | 820 sv_frame_t frame = 0; |