|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef SCHEMATICVIEWER_H
|
|
Toshihiro Shimizu |
890ddd |
#define SCHEMATICVIEWER_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzLib includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tstageobjectid.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzBase includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tfx.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qgraphicsscene></qgraphicsscene>
|
|
Toshihiro Shimizu |
890ddd |
#include <qgraphicsview></qgraphicsview>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// STD includes
|
|
Toshihiro Shimizu |
890ddd |
#include <set></set>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TOONZQT_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//====================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Forward declarations
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class SchematicNode;
|
|
Toshihiro Shimizu |
890ddd |
class SchematicPort;
|
|
Toshihiro Shimizu |
890ddd |
class SchematicLink;
|
|
Toshihiro Shimizu |
890ddd |
class ToonzScene;
|
|
Toshihiro Shimizu |
890ddd |
class StageSchematicScene;
|
|
Toshihiro Shimizu |
890ddd |
class FxSchematicScene;
|
|
Toshihiro Shimizu |
890ddd |
class TXsheetHandle;
|
|
Toshihiro Shimizu |
890ddd |
class TObjectHandle;
|
|
Toshihiro Shimizu |
890ddd |
class TColumnHandle;
|
|
Toshihiro Shimizu |
890ddd |
class TFxHandle;
|
|
Toshihiro Shimizu |
890ddd |
class TSceneHandle;
|
|
Toshihiro Shimizu |
890ddd |
class TFrameHandle;
|
|
Toshihiro Shimizu |
890ddd |
class TFx;
|
|
Toshihiro Shimizu |
890ddd |
class TLevel;
|
|
Toshihiro Shimizu |
890ddd |
class TSelection;
|
|
Toshihiro Shimizu |
890ddd |
class TApplication;
|
|
Toshihiro Shimizu |
890ddd |
class QToolBar;
|
|
Toshihiro Shimizu |
890ddd |
class QToolButton;
|
|
Toshihiro Shimizu |
890ddd |
class QAction;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//====================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// SchematicScene
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class DVAPI SchematicScene : public QGraphicsScene {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
SchematicScene(QWidget *parent);
|
|
Shinya Kitaoka |
120a6e |
~SchematicScene();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void clearAllItems();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
virtual QGraphicsItem *getCurrentNode() { return 0; }
|
|
Shinya Kitaoka |
120a6e |
virtual void reorderScene() = 0;
|
|
Shinya Kitaoka |
120a6e |
virtual void updateScene() = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
QList<schematiclink *=""> m_highlightedLinks;</schematiclink>
|
|
Shinya Kitaoka |
120a6e |
enum GridDimension { eLarge, eSmall };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
//! Returns \b true if no nodes intersects \b rect.
|
|
Shinya Kitaoka |
120a6e |
bool isAnEmptyZone(const QRectF &rect);
|
|
Shinya Kitaoka |
120a6e |
//! Returns a vector containing all nodes which had their bounding rects
|
|
Shinya Kitaoka |
120a6e |
//! conatined in \b node bounding
|
|
Shinya Kitaoka |
120a6e |
//! rect enlarged of 10.
|
|
Shinya Kitaoka |
120a6e |
QVector<schematicnode *=""> getPlacedNode(SchematicNode *node);</schematicnode>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void showEvent(QShowEvent *se);
|
|
Shinya Kitaoka |
120a6e |
void hideEvent(QHideEvent *se);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
virtual void onSelectionSwitched(TSelection *, TSelection *) {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// SchematicSceneViewer
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI SchematicSceneViewer final : public QGraphicsView {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
SchematicSceneViewer(QWidget *parent);
|
|
Shinya Kitaoka |
120a6e |
~SchematicSceneViewer();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void zoomQt(bool zoomin, bool resetZoom);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QPointF getOldScenePos() { return m_oldScenePos; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *me) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseMoveEvent(QMouseEvent *me) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseReleaseEvent(QMouseEvent *me) override;
|
|
Shinya Kitaoka |
473e70 |
void keyPressEvent(QKeyEvent *ke) override;
|
|
Shinya Kitaoka |
473e70 |
void wheelEvent(QWheelEvent *me) override;
|
|
Shinya Kitaoka |
473e70 |
void showEvent(QShowEvent *se) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void fitScene();
|
|
Shinya Kitaoka |
120a6e |
void centerOnCurrent();
|
|
Shinya Kitaoka |
120a6e |
void reorderScene();
|
|
Shinya Kitaoka |
120a6e |
void normalizeScene();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
Qt::MouseButton m_buttonState;
|
|
Shinya Kitaoka |
120a6e |
QPoint m_oldWinPos;
|
|
Shinya Kitaoka |
120a6e |
QPointF m_oldScenePos;
|
|
Shinya Kitaoka |
120a6e |
bool m_firstShowing;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
void changeScale(const QPoint &winPos, qreal scaleFactor);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// SchematicViewer
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI SchematicViewer final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
SchematicViewer(QWidget *parent);
|
|
Shinya Kitaoka |
120a6e |
~SchematicViewer();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setSchematicScene(SchematicScene *scene);
|
|
Shinya Kitaoka |
120a6e |
void setApplication(TApplication *app);
|
|
Shinya Kitaoka |
120a6e |
bool isStageSchematicViewed();
|
|
Shinya Kitaoka |
120a6e |
void setStageSchematicViewed(bool isStageSchematic);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void updateSchematic();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void showPreview(TFxP);
|
|
Shinya Kitaoka |
120a6e |
void doCollapse(const QList<tfxp> &);</tfxp>
|
|
Shinya Kitaoka |
120a6e |
void doCollapse(QList<tstageobjectid>);</tstageobjectid>
|
|
Shinya Kitaoka |
120a6e |
void doExplodeChild(const QList<tfxp> &);</tfxp>
|
|
Shinya Kitaoka |
120a6e |
void doExplodeChild(QList<tstageobjectid>);</tstageobjectid>
|
|
Shinya Kitaoka |
120a6e |
void editObject();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onSceneChanged();
|
|
Shinya Kitaoka |
120a6e |
void onSceneSwitched();
|
|
Shinya Kitaoka |
120a6e |
void updateScenes();
|
|
Shinya Kitaoka |
120a6e |
void changeNodeSize();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
SchematicSceneViewer *m_viewer;
|
|
Shinya Kitaoka |
120a6e |
StageSchematicScene *m_stageScene;
|
|
Shinya Kitaoka |
120a6e |
FxSchematicScene *m_fxScene;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TSceneHandle *m_sceneHandle;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QToolBar *m_stageToolbar, *m_commonToolbar, *m_fxToolbar, *m_swapToolbar;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QAction *m_fitSchematic, *m_centerOn, *m_reorder, *m_normalize, *m_nodeSize,
|
|
Shinya Kitaoka |
120a6e |
*m_changeScene;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_fullSchematic, m_maximizedNode;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
void createToolbars();
|
|
Shinya Kitaoka |
120a6e |
void createActions();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setStageSchematic();
|
|
Shinya Kitaoka |
120a6e |
void setFxSchematic();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // SCHEMATICVIEWER_H
|