OSDN Git Service

[denncoCreator] expand the rectangle of DCVCPage when a cell is placed outside the...
[dennco/denncoCreator.git] / Source / visualizer / component / dcvcpage.h
index fa1d431..acc7302 100644 (file)
@@ -21,9 +21,8 @@
 
 #include "dcvcomponent.h"
 
-class DCVCCell;
-class DCVCCellCode;
 class DCVPageComponent;
+class DCContainer;
 
 class DCVCPage : public DCVComponent
 {
@@ -38,8 +37,12 @@ class DCVCPage : public DCVComponent
     float   d_colorA;
 
     QList<DCVPageComponent*> d_cells;
+    QList<DCVPageComponent*> d_cellCodeClasses;
+
     DCVPageComponent *d_editCursor;
 
+    QString d_hash;
+
 public:
     DCVCPage(const QString &locationPath);
     virtual ~DCVCPage();
@@ -49,13 +52,50 @@ public:
     virtual DCVVisibility   getIsVisible() const { return d_colorA == 0 ?  DCV_VISIBLE_NONE : DCVComponent::getIsVisible(); }
     virtual bool            isResizingArea(float x, float y, float z) const { return false; }
     QString                 getLocationPath() const { return d_locationPath; }
+    bool                    getIsModified(DCContainer *container) const;
+    inline float            getWidth() const { return d_width; }
+    inline float            getDepth() const { return d_depth; }
 
+    const QList<DCVPageComponent*>* getCells() const { return &d_cells; }
+    const QList<DCVPageComponent*>* getCellCodeClasses() const { return &d_cellCodeClasses; }
+
+    // register / unregister cell to this page.
+    // They are called from DCVCCell.
+    // Other classes shouldn't call this directly.
+    // To change the page a cell belonging,
+    // DCMoveCellCommand() should be used instead.
     void registerCell(DCVPageComponent *cell);
     void unregisterCell(DCVPageComponent *cell);
 
+    // register / unregister cellcode to this page.
+    // They are called from DCVCCellCode.
+    // Other classes shouldn't call this directly.
+    // To change the page a cell code class belonging,
+    // DCMoveCellCodeClassCommand should be used instead.
+    void registerCellCodeClass(DCVPageComponent *cellCodeClass);
+    void unregisterCellCodeClass(DCVPageComponent *cellCodeClass);
+
+    // register / unregister cellcode to this page.
+    // They are called from DCVCEditModeCursor.
+    // Other classes shouldn't call this directly.
+    // To change the page a cell code class belonging,
+    // DCVCEditModeCursor::changePageBelonging() should be called instead.
     void registerEditCursor(DCVPageComponent *ecursor);
     void unregisterEditCursor();
 
+    /**
+     * @brief Move cells and cell codes belong to this page to newPage.
+     * @param newPage : the target page cells and cell codes are moving into.
+     *
+     * This will move cells, cell codes and connections belong to this page to the page passed in the parameter.
+     * This expected to be called from DCContainer.
+     * This shouldn't be called directly.
+     * To change the path / file name for a container file, DCMovePageCommand should be used.
+     *
+     * @return true for succuss, false for failure.
+     */
+    bool moveComponentsTo(DCVCPage *newPage);
+
     void updateVisiblity(bool linkedCellVisible, bool linkedCellRenderFull, bool linkedCellSelectable, bool otherCellVisible, bool otherCellRenderFull, bool otherCellSelectable);
 
     virtual void    prepareChildrenForDraw(bool isAnimationInterval);
@@ -71,10 +111,15 @@ public:
     virtual bool    endDrag(float x, float y, float z, bool isResizingDrag);
     virtual void    updateShape() {}
 
+    virtual void    saveAttributesToXML(QDomDocument *document, QDomElement* element) const;
+    virtual void    loadAttributesFromXML(QDomElement element);
+
     void setHeight(float height);
     void setWidth(float width);
     void setDepth(float depth);
     void setColor(float r, float g, float b, float a);
+
+    void updateSavedState(DCContainer *container);
 };
 
 #endif // DCVCPAGE_H