|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef FXSCHEMATIC_H
|
|
Toshihiro Shimizu |
890ddd |
#define FXSCHEMATIC_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/addfxcontextmenu.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "schematicviewer.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tgeometry.h"
|
|
Toshihiro Shimizu |
890ddd |
#include <qmap></qmap>
|
|
Toshihiro Shimizu |
890ddd |
#include <tfx.h></tfx.h>
|
|
Toshihiro Shimizu |
890ddd |
#include <set></set>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//forward declaration
|
|
Toshihiro Shimizu |
890ddd |
class FxSchematicNode;
|
|
Toshihiro Shimizu |
890ddd |
class TFxHandle;
|
|
Toshihiro Shimizu |
890ddd |
class FxSelection;
|
|
Toshihiro Shimizu |
890ddd |
class FxSchematicNode;
|
|
Toshihiro Shimizu |
890ddd |
class TXsheet;
|
|
Toshihiro Shimizu |
890ddd |
class TSceneHandle;
|
|
Toshihiro Shimizu |
890ddd |
class QMenu;
|
|
Toshihiro Shimizu |
890ddd |
class SchematicLink;
|
|
Toshihiro Shimizu |
890ddd |
class FxGroupNode;
|
|
Toshihiro Shimizu |
890ddd |
class FxSchematicGroupEditor;
|
|
Toshihiro Shimizu |
890ddd |
class FxSchematicMacroEditor;
|
|
Toshihiro Shimizu |
890ddd |
class TMacroFx;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// FXSchematic
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class FxSchematicScene : public SchematicScene
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class SupportLinks
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QList<schematiclink *=""> m_bridges;</schematiclink>
|
|
Toshihiro Shimizu |
890ddd |
QList<schematiclink *=""> m_inputs;</schematiclink>
|
|
Toshihiro Shimizu |
890ddd |
QList<schematiclink *=""> m_outputs;</schematiclink>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
SupportLinks() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void addBridgeLink(SchematicLink *link);
|
|
Toshihiro Shimizu |
890ddd |
void addInputLink(SchematicLink *link);
|
|
Toshihiro Shimizu |
890ddd |
void addOutputLink(SchematicLink *link);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QList<schematiclink *=""> getBridgeLinks() { return m_bridges; }</schematiclink>
|
|
Toshihiro Shimizu |
890ddd |
QList<schematiclink *=""> getInputLinks() { return m_inputs; }</schematiclink>
|
|
Toshihiro Shimizu |
890ddd |
QList<schematiclink *=""> getOutputLinks() { return m_outputs; }</schematiclink>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void hideBridgeLinks();
|
|
Toshihiro Shimizu |
890ddd |
void hideInputLinks();
|
|
Toshihiro Shimizu |
890ddd |
void hideOutputLinks();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void showBridgeLinks();
|
|
Toshihiro Shimizu |
890ddd |
void showInputLinks();
|
|
Toshihiro Shimizu |
890ddd |
void showOutputLinks();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void removeBridgeLinks(bool deleteLink = false);
|
|
Toshihiro Shimizu |
890ddd |
void removeInputLinks(bool deleteLink = false);
|
|
Toshihiro Shimizu |
890ddd |
void removeOutputLinks(bool deleteLink = false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isABridgeLink(SchematicLink *link) { return m_bridges.contains(link); }
|
|
Toshihiro Shimizu |
890ddd |
bool isAnInputLink(SchematicLink *link) { return m_inputs.contains(link); }
|
|
Toshihiro Shimizu |
890ddd |
bool isAnOutputLink(SchematicLink *link) { return m_outputs.contains(link); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void clearAll();
|
|
Toshihiro Shimizu |
890ddd |
int size();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TApplication *m_app;
|
|
Toshihiro Shimizu |
890ddd |
TXsheetHandle *m_xshHandle;
|
|
Toshihiro Shimizu |
890ddd |
TFxHandle *m_fxHandle;
|
|
Toshihiro Shimizu |
890ddd |
TFrameHandle *m_frameHandle;
|
|
Toshihiro Shimizu |
890ddd |
TColumnHandle *m_columnHandle;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QPointF m_firstPoint;
|
|
Toshihiro Shimizu |
890ddd |
QMap<tfx *="" *,="" fxschematicnode=""> m_table;</tfx>
|
|
Toshihiro Shimizu |
890ddd |
QMap<int, *="" fxgroupnode=""> m_groupedTable;</int,>
|
|
Toshihiro Shimizu |
890ddd |
QMap<int, *="" fxschematicgroupeditor=""> m_groupEditorTable;</int,>
|
|
Toshihiro Shimizu |
890ddd |
QMap<tmacrofx *="" *,="" fxschematicmacroeditor=""> m_macroEditorTable;</tmacrofx>
|
|
Toshihiro Shimizu |
890ddd |
FxSelection *m_selection;
|
|
Toshihiro Shimizu |
890ddd |
AddFxContextMenu m_addFxContextMenu;
|
|
Toshihiro Shimizu |
890ddd |
SupportLinks m_disconnectionLinks, m_connectionLinks;
|
|
Toshihiro Shimizu |
890ddd |
bool m_isConnected;
|
|
Toshihiro Shimizu |
890ddd |
bool m_linkUnlinkSimulation;
|
|
Toshihiro Shimizu |
890ddd |
bool m_altPressed;
|
|
Toshihiro Shimizu |
890ddd |
QPointF m_lastPos;
|
|
Toshihiro Shimizu |
890ddd |
QList<qpair<tfxp, tpointd="">> m_selectionOldPos;</qpair<tfxp,>
|
|
Toshihiro Shimizu |
890ddd |
QList<tfx *=""> m_placedFxs;</tfx>
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicNode *m_currentFxNode;
|
|
Toshihiro Shimizu |
890ddd |
int m_gridDimension;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool m_isLargeScaled;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QMap<tfx *="" *,="" qlist<fxschematicnode="">> m_nodesToPlace;</tfx>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicScene(QWidget *parent);
|
|
Toshihiro Shimizu |
890ddd |
~FxSchematicScene();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void updateScene();
|
|
Toshihiro Shimizu |
890ddd |
QGraphicsItem *getCurrentNode();
|
|
Toshihiro Shimizu |
890ddd |
void reorderScene();
|
|
Toshihiro Shimizu |
890ddd |
TXsheet *getXsheet();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setApplication(TApplication *app);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TApplication *getApplication() const { return m_app; }
|
|
Toshihiro Shimizu |
890ddd |
TXsheetHandle *getXsheetHandle() const { return m_xshHandle; }
|
|
Toshihiro Shimizu |
890ddd |
TFxHandle *getFxHandle() const { return m_fxHandle; }
|
|
Toshihiro Shimizu |
890ddd |
TFrameHandle *getFrameHandle() const { return m_frameHandle; }
|
|
Toshihiro Shimizu |
890ddd |
TColumnHandle *getColumnHandle() const { return m_columnHandle; }
|
|
Toshihiro Shimizu |
890ddd |
TFx *getCurrentFx();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QMenu *getInsertFxMenu() { return m_addFxContextMenu.getInsertMenu(); }
|
|
Toshihiro Shimizu |
890ddd |
QMenu *getAddFxMenu() { return m_addFxContextMenu.getAddMenu(); }
|
|
Toshihiro Shimizu |
890ddd |
QMenu *getReplaceFxMenu() { return m_addFxContextMenu.getReplaceMenu(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QAction *getAgainAction(int commands) { return m_addFxContextMenu.getAgainCommand(commands); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
FxSelection *getFxSelection() const { return m_selection; }
|
|
Toshihiro Shimizu |
890ddd |
//!Disconnects or connects selected item from the rest of the graph.
|
|
Toshihiro Shimizu |
890ddd |
//!Selection must be a connected subgraph. If \b disconnect is true, the selection is disconnected; connected otherwise.
|
|
Toshihiro Shimizu |
890ddd |
void simulateDisconnectSelection(bool disconnect);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//!Updates all Group Editors containing fx.
|
|
Toshihiro Shimizu |
890ddd |
//!Each fx is only in one group, but each gruop can contains othe group. All nested Groups must be updated.
|
|
Toshihiro Shimizu |
890ddd |
void updateNestedGroupEditors(FxSchematicNode *node, const QPointF &newPos);
|
|
Toshihiro Shimizu |
890ddd |
void closeInnerMacroEditor(int groupId);
|
|
Toshihiro Shimizu |
890ddd |
void resizeNodes(bool maximizedNode);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void initCursorScenePos()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_addFxContextMenu.setCurrentCursorScenePos(QPointF(0, 0));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
void selectNodes(QList<tfxp> &fxs);</tfxp>
|
|
Toshihiro Shimizu |
890ddd |
bool isLargeScaled() { return m_isLargeScaled; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void contextMenuEvent(QGraphicsSceneContextMenuEvent *cme);
|
|
Toshihiro Shimizu |
890ddd |
void mousePressEvent(QGraphicsSceneMouseEvent *me);
|
|
Toshihiro Shimizu |
890ddd |
void mouseMoveEvent(QGraphicsSceneMouseEvent *me);
|
|
Toshihiro Shimizu |
890ddd |
void mouseReleaseEvent(QGraphicsSceneMouseEvent *me);
|
|
Toshihiro Shimizu |
890ddd |
bool event(QEvent *e);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicNode *addFxSchematicNode(TFx *fx);
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicNode *addGroupedFxSchematicNode(int groupId, const QList<tfxp> &groupedFxs);</tfxp>
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicGroupEditor *addEditedGroupedFxSchematicNode(int groupId, const QList<schematicnode *=""> &groupedFxs);</schematicnode>
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicMacroEditor *addEditedMacroFxSchematicNode(TMacroFx *macro, const QList<schematicnode *=""> &groupedFxs);</schematicnode>
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicNode *createFxSchematicNode(TFx *fx);
|
|
Toshihiro Shimizu |
890ddd |
void placeNode(FxSchematicNode *node);
|
|
Toshihiro Shimizu |
890ddd |
void updateLink();
|
|
Toshihiro Shimizu |
890ddd |
void updateDuplcatedNodesLink();
|
|
Toshihiro Shimizu |
890ddd |
void updateEditedGroups(const QMap<int, *="" qlist<schematicnode="">> &editedGroup);</int,>
|
|
Toshihiro Shimizu |
890ddd |
void updateEditedMacros(const QMap<tmacrofx *="" *,="" qlist<schematicnode="">> &editedMacro);</tmacrofx>
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicNode *getFxNodeFromPosition(const QPointF &pos);
|
|
Toshihiro Shimizu |
890ddd |
void placeNodeAndParents(TFx *fx, double x, double &maxX, double &maxY);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QPointF nearestPoint(const QPointF &point);
|
|
Toshihiro Shimizu |
890ddd |
void highlightLinks(FxSchematicNode *node, bool value);
|
|
Toshihiro Shimizu |
890ddd |
void updatePosition(FxSchematicNode *node, const TPointD &pos);
|
|
Toshihiro Shimizu |
890ddd |
void simulateInsertSelection(SchematicLink *link, bool connect);
|
|
Toshihiro Shimizu |
890ddd |
void updatePositionOnResize(TFx *fx, bool maximizedNode);
|
|
Toshihiro Shimizu |
890ddd |
void removeRetroLinks(TFx *fx, double &maxX);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
void showPreview(TFxP);
|
|
Toshihiro Shimizu |
890ddd |
void cacheFx(TFxP);
|
|
Toshihiro Shimizu |
890ddd |
void doCollapse(const QList<tfxp> &);</tfxp>
|
|
Toshihiro Shimizu |
890ddd |
void doExplodeChild(const QList<tfxp> &);</tfxp>
|
|
Toshihiro Shimizu |
890ddd |
void editObject();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
void onSelectionSwitched(TSelection *oldSel, TSelection *newSel);
|
|
Toshihiro Shimizu |
890ddd |
void onSelectionChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//void onOutputFxAdded();
|
|
Toshihiro Shimizu |
890ddd |
void onDisconnectFromXSheet();
|
|
Toshihiro Shimizu |
890ddd |
void onConnectToXSheet();
|
|
Toshihiro Shimizu |
890ddd |
void onDeleteFx();
|
|
Toshihiro Shimizu |
890ddd |
void onDuplicateFx();
|
|
Toshihiro Shimizu |
890ddd |
void onUnlinkFx();
|
|
Toshihiro Shimizu |
890ddd |
void onMacroFx();
|
|
Toshihiro Shimizu |
890ddd |
void onExplodeMacroFx();
|
|
Toshihiro Shimizu |
890ddd |
void onOpenMacroFx();
|
|
Toshihiro Shimizu |
890ddd |
void onSavePresetFx();
|
|
Toshihiro Shimizu |
890ddd |
void onRemoveOutput();
|
|
Toshihiro Shimizu |
890ddd |
void onActivateOutput();
|
|
Toshihiro Shimizu |
890ddd |
void onPreview();
|
|
Toshihiro Shimizu |
890ddd |
void onCacheFx();
|
|
Toshihiro Shimizu |
890ddd |
void onUncacheFx();
|
|
Toshihiro Shimizu |
890ddd |
void onCollapse(const QList<tfxp> &);</tfxp>
|
|
Toshihiro Shimizu |
890ddd |
void onOpenSubxsheet();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onXsheetChanged();
|
|
Toshihiro Shimizu |
890ddd |
void onSceneChanged();
|
|
Toshihiro Shimizu |
890ddd |
void onSwitchCurrentFx(TFx *);
|
|
Toshihiro Shimizu |
890ddd |
void onCurrentFxSwitched();
|
|
Toshihiro Shimizu |
890ddd |
void onCurrentColumnChanged(int);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onFxNodeDoubleClicked();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onInsertPaste();
|
|
Toshihiro Shimizu |
890ddd |
void onAddPaste();
|
|
Toshihiro Shimizu |
890ddd |
void onReplacePaste();
|
|
Toshihiro Shimizu |
890ddd |
void onAltModifierChanged(bool);
|
|
Toshihiro Shimizu |
890ddd |
void onEditGroup();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
void setEnableCache(bool toggle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicScene(const FxSchematicScene &);
|
|
Toshihiro Shimizu |
890ddd |
const FxSchematicScene &operator=(const FxSchematicScene &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif //FXSCHEMATIC_H
|