MCPcopy Create free account
hub / github.com/MrKepzie/Natron / AddNodeCommand

Class AddNodeCommand

Gui/MultiInstancePanel.cpp:605–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603} // createMultiInstanceGui
604
605class AddNodeCommand
606 : public QUndoCommand
607{
608 Q_DECLARE_TR_FUNCTIONS(AddNodeCommand)
609
610private:
611 bool _firstRedoCalled;
612 NodePtr _node;
613 MultiInstancePanel* _panel;
614
615public:
616
617 AddNodeCommand(MultiInstancePanel* panel,
618 const NodePtr & node,
619 QUndoCommand* parent = 0)
620 : QUndoCommand(parent)
621 , _firstRedoCalled(false)
622 , _node(node)
623 , _panel(panel)
624 {
625 }
626
627 virtual ~AddNodeCommand()
628 {
629 }
630
631 virtual void undo() OVERRIDE FINAL
632 {
633 int index = _panel->getNodeIndex(_node);
634
635 assert(index != -1);
636 _panel->removeRow(index);
637 _node->deactivate();
638 _panel->getMainInstance()->getApp()->redrawAllViewers();
639 setText( tr("Add %1").arg( QString::fromUtf8( _node->getLabel().c_str() ) ) );
640 }
641
642 virtual void redo() OVERRIDE FINAL
643 {
644 if (_firstRedoCalled) {
645 _node->activate();
646 _panel->addRow(_node);
647 _panel->getMainInstance()->getApp()->redrawAllViewers();
648 }
649 _firstRedoCalled = true;
650 setText( tr("Add %1").arg( QString::fromUtf8( _node->getLabel().c_str() ) ) );
651 }
652};
653
654NodePtr
655MultiInstancePanel::createNewInstance(bool useUndoRedoStack)

Callers

nothing calls this directly

Calls 10

setTextFunction · 0.85
getNodeIndexMethod · 0.80
getMainInstanceMethod · 0.80
addRowMethod · 0.80
removeRowMethod · 0.45
deactivateMethod · 0.45
redrawAllViewersMethod · 0.45
getAppMethod · 0.45
getLabelMethod · 0.45
activateMethod · 0.45

Tested by

no test coverage detected