| #pragma once |
| |
| #ifndef FXNODESELECTION_H |
| #define FXNODESELECTION_H |
| |
| #include "toonzqt/selection.h" |
| #include "tfx.h" |
| #include "toonz/fxcommand.h" |
| #include <QList> |
| #include <QPair> |
| #include <QMap> |
| #include <QSet> |
| #include <set> |
| |
| |
| class TXsheetHandle; |
| class TFxHandle; |
| class SchematicLink; |
| class SchematicPort; |
| class FxSchematicScene; |
| |
| using namespace TFxCommand; |
| |
| |
| |
| |
| |
| |
| |
| class FxSelection final : public QObject, public TSelection { |
| Q_OBJECT |
| |
| QList<Link> m_selectedLinks; |
| QList<TFxP> m_selectedFxs; |
| QList<int> m_selectedColIndexes; |
| TXsheetHandle *m_xshHandle; |
| TFxHandle *m_fxHandle; |
| TPointD m_pastePosition; |
| |
| FxSchematicScene *m_schematicScene; |
| |
| public: |
| FxSelection(); |
| FxSelection(const FxSelection &src); |
| ~FxSelection(); |
| |
| TSelection *clone() const; |
| |
| void setPastePosition(const TPointD &pos) { m_pastePosition = pos; } |
| |
| void enableCommands() override; |
| |
| |
| bool isEmpty() const override { |
| return m_selectedFxs.empty() && m_selectedLinks.empty() && |
| m_selectedColIndexes.isEmpty(); |
| } |
| |
| |
| void selectNone() override { |
| m_selectedFxs.clear(); |
| m_selectedLinks.clear(); |
| m_selectedColIndexes.clear(); |
| } |
| |
| |
| void select(TFxP fx); |
| |
| void select(int colIndex); |
| |
| void unselect(TFxP fx); |
| |
| void unselect(int colIndex); |
| |
| |
| |
| void select(SchematicLink *link); |
| |
| void unselect(SchematicLink *link); |
| |
| |
| bool isSelected(TFxP fx) const; |
| |
| bool isSelected(int columnIndex) const; |
| |
| |
| |
| bool isSelected(SchematicLink *link); |
| |
| const QList<TFxP> &getFxs() const { return m_selectedFxs; } |
| const QList<Link> &getLinks() const { return m_selectedLinks; } |
| const QList<int> &getColumnIndexes() const { return m_selectedColIndexes; } |
| |
| void setXsheetHandle(TXsheetHandle *xshHandle) { m_xshHandle = xshHandle; } |
| void setFxHandle(TFxHandle *fxHandle) { m_fxHandle = fxHandle; } |
| |
| |
| int size() { return m_selectedFxs.size() + m_selectedLinks.size(); } |
| |
| |
| |
| |
| void deleteSelection(); |
| |
| void copySelection(); |
| |
| |
| |
| void cutSelection(); |
| |
| |
| |
| void pasteSelection(); |
| |
| |
| |
| |
| |
| bool insertPasteSelection(); |
| |
| |
| |
| |
| bool addPasteSelection(); |
| |
| |
| |
| |
| bool replacePasteSelection(); |
| |
| void groupSelection(); |
| void ungroupSelection(); |
| void collapseSelection(); |
| void explodeChild(); |
| Link getBoundingFxs(SchematicLink *link); |
| |
| |
| |
| |
| bool isConnected(); |
| |
| void setFxSchematicScene(FxSchematicScene *schematicScene) { |
| m_schematicScene = schematicScene; |
| } |
| |
| private: |
| |
| FxSelection &operator=(const FxSelection &); |
| |
| Link getBoundingFxs(SchematicPort *inputPort, SchematicPort *outputPort); |
| |
| void visitFx(TFx *fx, QList<TFx *> &visitedFxs); |
| bool areLinked(TFx *outFx, TFx *inFx); |
| |
| signals: |
| void doCollapse(const QList<TFxP> &); |
| void doExplodeChild(const QList<TFxP> &); |
| }; |
| |
| #endif |