|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef FXNODESELECTION_H
|
|
Toshihiro Shimizu |
890ddd |
#define FXNODESELECTION_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/selection.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfx.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/fxcommand.h"
|
|
Toshihiro Shimizu |
890ddd |
#include <qlist></qlist>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpair></qpair>
|
|
Toshihiro Shimizu |
890ddd |
#include <qmap></qmap>
|
|
Toshihiro Shimizu |
890ddd |
#include <qset></qset>
|
|
Toshihiro Shimizu |
890ddd |
#include <set></set>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// forward declaration
|
|
Toshihiro Shimizu |
890ddd |
class TXsheetHandle;
|
|
Toshihiro Shimizu |
890ddd |
class TFxHandle;
|
|
Toshihiro Shimizu |
890ddd |
class SchematicLink;
|
|
Toshihiro Shimizu |
890ddd |
class SchematicPort;
|
|
Toshihiro Shimizu |
890ddd |
class FxSchematicScene;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace TFxCommand;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=========================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// FxSelection
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class FxSelection : public QObject, public TSelection {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QList<link> m_selectedLinks;
|
|
Shinya Kitaoka |
120a6e |
QList<tfxp> m_selectedFxs;</tfxp>
|
|
Shinya Kitaoka |
120a6e |
QList<int> m_selectedColIndexes;</int>
|
|
Shinya Kitaoka |
120a6e |
TXsheetHandle *m_xshHandle;
|
|
Shinya Kitaoka |
120a6e |
TFxHandle *m_fxHandle;
|
|
Shinya Kitaoka |
120a6e |
TPointD m_pastePosition;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
FxSchematicScene *m_schematicScene;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
FxSelection();
|
|
Shinya Kitaoka |
120a6e |
FxSelection(const FxSelection &src);
|
|
Shinya Kitaoka |
120a6e |
~FxSelection();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TSelection *clone() const;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setPastePosition(const TPointD &pos) { m_pastePosition = pos; }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void enableCommands() override;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//! Return true if the selection is empty
|
|
Shinya Kitaoka |
473e70 |
bool isEmpty() const override {
|
|
Shinya Kitaoka |
120a6e |
return m_selectedFxs.empty() && m_selectedLinks.empty() &&
|
|
Shinya Kitaoka |
120a6e |
m_selectedColIndexes.isEmpty();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//! Empty the selection
|
|
Shinya Kitaoka |
473e70 |
void selectNone() override {
|
|
Shinya Kitaoka |
120a6e |
m_selectedFxs.clear();
|
|
Shinya Kitaoka |
120a6e |
m_selectedLinks.clear();
|
|
Shinya Kitaoka |
120a6e |
m_selectedColIndexes.clear();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//! Adds the \b fx to the m_selectedFxs container;
|
|
Shinya Kitaoka |
120a6e |
void select(TFxP fx);
|
|
Shinya Kitaoka |
120a6e |
//! Adds the \b colIndex to the m_selectedColIndexes container;
|
|
Shinya Kitaoka |
120a6e |
void select(int colIndex);
|
|
Shinya Kitaoka |
120a6e |
//! Removes the \b fx from the m_selectedFxs container;
|
|
Shinya Kitaoka |
120a6e |
void unselect(TFxP fx);
|
|
Shinya Kitaoka |
120a6e |
//! Removes the \b colIndex from the m_selectedColIndexes container;
|
|
Shinya Kitaoka |
120a6e |
void unselect(int colIndex);
|
|
Shinya Kitaoka |
120a6e |
//! Adds a QPair<tfxp,tfxp> to the m_selectedLinks container.</tfxp,tfxp>
|
|
Shinya Kitaoka |
120a6e |
//! The first element of of the QPair is the fx that has the link in input.
|
|
Shinya Kitaoka |
120a6e |
//! The second element of of the QPair is the fx that has the link in output
|
|
Shinya Kitaoka |
120a6e |
void select(SchematicLink *link);
|
|
Shinya Kitaoka |
120a6e |
//! Removes a QPair<tfxp,tfxp> from the m_selectedLinks container.</tfxp,tfxp>
|
|
Shinya Kitaoka |
120a6e |
void unselect(SchematicLink *link);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//! Returns true if the given \b fx is selected.
|
|
Shinya Kitaoka |
120a6e |
bool isSelected(TFxP fx) const;
|
|
Shinya Kitaoka |
120a6e |
//! Returns true if the given \b columnIndex is selected.
|
|
Shinya Kitaoka |
120a6e |
bool isSelected(int columnIndex) const;
|
|
Shinya Kitaoka |
120a6e |
//! Returns true if the QPair<tfxp,tfxp> of the fxs that bounds the given \b</tfxp,tfxp>
|
|
Shinya Kitaoka |
120a6e |
//! link is contained in the
|
|
Shinya Kitaoka |
120a6e |
//! m_selectedLinks container.
|
|
Shinya Kitaoka |
120a6e |
bool isSelected(SchematicLink *link);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
const QList<tfxp> &getFxs() const { return m_selectedFxs; }</tfxp>
|
|
Shinya Kitaoka |
120a6e |
const QList<link> &getLinks() const { return m_selectedLinks; }
|
|
Shinya Kitaoka |
120a6e |
const QList<int> &getColumnIndexes() const { return m_selectedColIndexes; }</int>
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setXsheetHandle(TXsheetHandle *xshHandle) { m_xshHandle = xshHandle; }
|
|
Shinya Kitaoka |
120a6e |
void setFxHandle(TFxHandle *fxHandle) { m_fxHandle = fxHandle; }
|
|
Shinya Kitaoka |
120a6e |
//! Returns the size of the selection.
|
|
Shinya Kitaoka |
120a6e |
//! The size is the number of fxs and link selected.
|
|
Shinya Kitaoka |
120a6e |
int size() { return m_selectedFxs.size() + m_selectedLinks.size(); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Commands
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//! Calls the TFxCommand::deleteSelection() to remove selected links or fxs.
|
|
Shinya Kitaoka |
120a6e |
void deleteSelection();
|
|
Shinya Kitaoka |
120a6e |
//! Copy selected fxs in the clipboard.
|
|
Shinya Kitaoka |
120a6e |
void copySelection();
|
|
Shinya Kitaoka |
120a6e |
//! Copy selected fxs in the clipboard and alls the
|
|
Shinya Kitaoka |
120a6e |
//! TFxCommand::deleteSelection()
|
|
Shinya Kitaoka |
120a6e |
//! to remove selected links or fxs.
|
|
Shinya Kitaoka |
120a6e |
void cutSelection();
|
|
Shinya Kitaoka |
120a6e |
//! Get fxs from the clipboards and calls the TFxCommand::pasteFxs(const
|
|
Shinya Kitaoka |
120a6e |
//! QList<tfxp> &fxs, TXsheetHandle*)</tfxp>
|
|
Shinya Kitaoka |
120a6e |
//! to insert fxs in the scene.
|
|
Shinya Kitaoka |
120a6e |
void pasteSelection();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//! Get fxs from the clipboards and calls the TFxCommand::insertPasteFxs(const
|
|
Shinya Kitaoka |
120a6e |
//! QList<tfxp> &fxs, TXsheetHandle*)</tfxp>
|
|
Shinya Kitaoka |
120a6e |
//! to insert fxs in the scene.
|
|
Shinya Kitaoka |
120a6e |
//! Fxs are pasted only if they are connected!
|
|
Shinya Kitaoka |
120a6e |
bool insertPasteSelection();
|
|
Shinya Kitaoka |
120a6e |
//! Get fxs from the clipboards and calls the TFxCommand::addPasteFxs(const
|
|
Shinya Kitaoka |
120a6e |
//! QList<tfxp> &fxs, TXsheetHandle*)</tfxp>
|
|
Shinya Kitaoka |
120a6e |
//! to insert fxs in the scene.
|
|
Shinya Kitaoka |
120a6e |
//! Fxs are pasted only if they are connected!
|
|
Shinya Kitaoka |
120a6e |
bool addPasteSelection();
|
|
Shinya Kitaoka |
120a6e |
//! Get fxs from the clipboards and calls the
|
|
Shinya Kitaoka |
120a6e |
//! TFxCommand::replacePasteFxs(const QList<tfxp> &fxs, TXsheetHandle*)</tfxp>
|
|
Shinya Kitaoka |
120a6e |
//! to insert fxs in the scene.
|
|
Shinya Kitaoka |
120a6e |
//! Fxs are pasted only if they are connected!
|
|
Shinya Kitaoka |
120a6e |
bool replacePasteSelection();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void groupSelection();
|
|
Shinya Kitaoka |
120a6e |
void ungroupSelection();
|
|
Shinya Kitaoka |
120a6e |
void collapseSelection();
|
|
Shinya Kitaoka |
120a6e |
void explodeChild();
|
|
Shinya Kitaoka |
120a6e |
Link getBoundingFxs(SchematicLink *link);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//! Return true if the selection is connected;
|
|
Shinya Kitaoka |
120a6e |
//! A selection is connected if nodes and links selected create a connected
|
|
Shinya Kitaoka |
120a6e |
//! graph
|
|
Shinya Kitaoka |
120a6e |
bool isConnected();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setFxSchematicScene(FxSchematicScene *schematicScene) {
|
|
Shinya Kitaoka |
120a6e |
m_schematicScene = schematicScene;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
// not implemented
|
|
Shinya Kitaoka |
120a6e |
FxSelection &operator=(const FxSelection &);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
Link getBoundingFxs(SchematicPort *inputPort, SchematicPort *outputPort);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void visitFx(TFx *fx, QList<tfx *=""> &visitedFxs);</tfx>
|
|
Shinya Kitaoka |
120a6e |
bool areLinked(TFx *outFx, TFx *inFx);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
void doCollapse(const QList<tfxp> &);</tfxp>
|
|
Shinya Kitaoka |
120a6e |
void doExplodeChild(const QList<tfxp> &);</tfxp>
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
3bfa54 |
#endif
|