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
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 120a6e
  QRectF boundingRect() const;
Shinya Kitaoka 120a6e
  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
Shinya Kitaoka 120a6e
             QWidget *widget                    = 0);
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 120a6e
  void mousePressEvent(QGraphicsSceneMouseEvent *e);
Shinya Kitaoka 120a6e
  virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *e);
Shinya Kitaoka 120a6e
  void mouseReleaseEvent(QGraphicsSceneMouseEvent *e);
Shinya Kitaoka 120a6e
  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e);
Shinya Kitaoka 120a6e
  void contextMenuEvent(QGraphicsSceneContextMenuEvent *e);
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 120a6e
class DVAPI FxSchematicGroupEditor : 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 120a6e
  QRectF boundingSceneRect() const;
Shinya Kitaoka 120a6e
  void setGroupedNodeZValue(int zValue);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Shinya Kitaoka 120a6e
  void closeEditor();
Shinya Kitaoka 120a6e
  void onNameChanged();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  void initializeEditor();
Shinya Kitaoka 120a6e
  void doResizeNodes(bool maximizeNodes);
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 120a6e
class DVAPI FxSchematicMacroEditor : 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 120a6e
  QRectF boundingSceneRect() const;
Shinya Kitaoka 120a6e
  void setGroupedNodeZValue(int zValue);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  void mouseMoveEvent(QGraphicsSceneMouseEvent *e);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Shinya Kitaoka 120a6e
  void closeEditor();
Shinya Kitaoka 120a6e
  void onNameChanged();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  void initializeEditor();
Shinya Kitaoka 120a6e
  void doResizeNodes(bool maximizeNodes);
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 120a6e
class DVAPI StageSchematicGroupEditor : 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 120a6e
  QRectF boundingSceneRect() const;
Shinya Kitaoka 120a6e
  void setGroupedNodeZValue(int zValue);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Shinya Kitaoka 120a6e
  void closeEditor();
Shinya Kitaoka 120a6e
  void onNameChanged();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  void initializeEditor();
Shinya Kitaoka 120a6e
  void doResizeNodes(bool maximizeNodes);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif