Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef SCHEMATICGROUPEDITOR_H
Toshihiro Shimizu 890ddd
#define SCHEMATICGROUPEDITOR_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Campbell Barton d0e335
#include <qgraphicsitem></qgraphicsitem>
Toshihiro Shimizu 890ddd
#include "tgeometry.h"
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
Shinya Kitaoka 120a6e
// forward declaration
Toshihiro Shimizu 890ddd
class QGraphicsScene;
Toshihiro Shimizu 890ddd
class SchematicNode;
Toshihiro Shimizu 890ddd
class FxSchematicNode;
Toshihiro Shimizu 890ddd
class SchematicScene;
Toshihiro Shimizu 890ddd
class TFx;
Toshihiro Shimizu 890ddd
class TMacroFx;
Toshihiro Shimizu 890ddd
class SchematicName;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=====================================================
Toshihiro Shimizu 890ddd
//
Shinya Kitaoka 120a6e
// SchematicGroupEditor
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=====================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI SchematicWindowEditor : public QObject, public QGraphicsItem {
Shinya Kitaoka 120a6e
  Q_OBJECT
shun-iwasawa 443318
  Q_INTERFACES(QGraphicsItem)
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QPointF m_lastPos;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  QList<schematicnode *=""> m_groupedNode;</schematicnode>
Shinya Kitaoka 120a6e
  QString m_groupName;
Shinya Kitaoka 120a6e
  SchematicScene *m_scene;
Shinya Kitaoka 120a6e
  SchematicName *m_nameItem;
Shinya Kitaoka 120a6e
  bool m_isMacroEditor;
Shinya Kitaoka 120a6e
  Qt::MouseButton m_button;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  SchematicWindowEditor(const QList<schematicnode *=""> &groupedNode,</schematicnode>
Shinya Kitaoka 120a6e
                        SchematicScene *scene);
Shinya Kitaoka 120a6e
  ~SchematicWindowEditor();
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  QRectF boundingRect() const override;
Shinya Kitaoka 120a6e
  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
shun-iwasawa 443318
             QWidget *widget = 0) override;
Shinya Kitaoka 120a6e
  virtual QRectF boundingSceneRect() const      = 0;
Shinya Kitaoka 120a6e
  virtual void setGroupedNodeZValue(int zValue) = 0;
Shinya Kitaoka 120a6e
  bool contains(SchematicNode *node) const {
Shinya Kitaoka 120a6e
    return m_groupedNode.contains(node);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void resizeNodes(bool maximizeNodes);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void mousePressEvent(QGraphicsSceneMouseEvent *e) override;
Shinya Kitaoka 473e70
  void mouseMoveEvent(QGraphicsSceneMouseEvent *e) override;
Shinya Kitaoka 473e70
  void mouseReleaseEvent(QGraphicsSceneMouseEvent *e) override;
Shinya Kitaoka 473e70
  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) override;
Shinya Kitaoka 473e70
  void contextMenuEvent(QGraphicsSceneContextMenuEvent *e) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Shinya Kitaoka 120a6e
  virtual void closeEditor()   = 0;
Shinya Kitaoka 120a6e
  virtual void onNameChanged() = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  //! retrieve the group name and the group Id
Shinya Kitaoka 120a6e
  virtual void initializeEditor()                = 0;
Shinya Kitaoka 120a6e
  virtual void doResizeNodes(bool maximizeNodes) = 0;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=====================================================
Toshihiro Shimizu 890ddd
//
Shinya Kitaoka 120a6e
// FxSchematicGroupEditor
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=====================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI FxSchematicGroupEditor final : public SchematicWindowEditor {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_groupId;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  FxSchematicGroupEditor(int groupId, const QList<schematicnode *=""> &groupedNode,</schematicnode>
Shinya Kitaoka 120a6e
                         SchematicScene *scene);
Shinya Kitaoka 120a6e
  ~FxSchematicGroupEditor();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  QRectF boundingSceneRect() const override;
Shinya Kitaoka 473e70
  void setGroupedNodeZValue(int zValue) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Shinya Kitaoka 473e70
  void closeEditor() override;
Shinya Kitaoka 473e70
  void onNameChanged() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 473e70
  void initializeEditor() override;
Shinya Kitaoka 473e70
  void doResizeNodes(bool maximizeNodes) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=====================================================
Toshihiro Shimizu 890ddd
//
Shinya Kitaoka 120a6e
// FxSchematicMacroEditor
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=====================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI FxSchematicMacroEditor final : public SchematicWindowEditor {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TMacroFx *m_macro;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  FxSchematicMacroEditor(TMacroFx *macro,
Shinya Kitaoka 120a6e
                         const QList<schematicnode *=""> &groupedNode,</schematicnode>
Shinya Kitaoka 120a6e
                         SchematicScene *scene);
Shinya Kitaoka 120a6e
  ~FxSchematicMacroEditor();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  QRectF boundingSceneRect() const override;
Shinya Kitaoka 473e70
  void setGroupedNodeZValue(int zValue) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void mouseMoveEvent(QGraphicsSceneMouseEvent *e) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Shinya Kitaoka 473e70
  void closeEditor() override;
Shinya Kitaoka 473e70
  void onNameChanged() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 473e70
  void initializeEditor() override;
Shinya Kitaoka 473e70
  void doResizeNodes(bool maximizeNodes) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=====================================================
Toshihiro Shimizu 890ddd
//
Shinya Kitaoka 120a6e
// StageSchematicGroupEditor
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=====================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI StageSchematicGroupEditor final : public SchematicWindowEditor {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_groupId;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  StageSchematicGroupEditor(int groupId,
Shinya Kitaoka 120a6e
                            const QList<schematicnode *=""> &groupedNode,</schematicnode>
Shinya Kitaoka 120a6e
                            SchematicScene *scene);
Shinya Kitaoka 120a6e
  ~StageSchematicGroupEditor();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  QRectF boundingSceneRect() const override;
Shinya Kitaoka 473e70
  void setGroupedNodeZValue(int zValue) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Shinya Kitaoka 473e70
  void closeEditor() override;
Shinya Kitaoka 473e70
  void onNameChanged() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 473e70
  void initializeEditor() override;
Shinya Kitaoka 473e70
  void doResizeNodes(bool maximizeNodes) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif