| @@ -6,13 +6,34 @@ Develop | |||||
| Change | Change | ||||
| ----- | ----- | ||||
| Allow renaming and deletion of open file handles on Windows using the | |||||
| The return type of Block::getBlockAreaWithinLayout() has been changed from | |||||
| Rectangle to a simpler BlockArea struct. | |||||
| Possible Issues | |||||
| --------------- | |||||
| Classes that derive from Block and implement this pure virtual method will no | |||||
| longer compile due to a change in the function signature. | |||||
| Workaround | |||||
| ---------- | |||||
| Update the method to return a BlockArea struct and update code that calls | |||||
| getBlockAreaWithinLayout to handle a BlockArea instead of a Rectangle. | |||||
| Rationale | |||||
| --------- | |||||
| The juce_blocks_basics is ISC licensed and therefore cannot depend on the | |||||
| GPL/Commercial licensed juce_gui_basics module that contains Rectangle. | |||||
| Change | |||||
| ----- | |||||
| Renaming and deletion of open file handles on Windows is now possible using the | |||||
| FILE_SHARE_DELETE flag. | FILE_SHARE_DELETE flag. | ||||
| Possible Issues | Possible Issues | ||||
| --------------- | --------------- | ||||
| Previous code that relied on open files not being able to be renamed or | |||||
| deleted on Windows may fail. | |||||
| Previous code that relied on open files not being able to be renamed or deleted | |||||
| on Windows may fail. | |||||
| Workaround | Workaround | ||||
| ---------- | ---------- | ||||
| @@ -20,8 +41,7 @@ No workaround. | |||||
| Rationale | Rationale | ||||
| --------- | --------- | ||||
| This unifies the behaviour across OSes as POSIX systems already allow | |||||
| this. | |||||
| This unifies the behaviour across OSes as POSIX systems already allow this. | |||||
| Change | Change | ||||
| @@ -130,10 +130,13 @@ public: | |||||
| /** Returns the length of one logical device unit as physical millimeters. */ | /** Returns the length of one logical device unit as physical millimeters. */ | ||||
| virtual float getMillimetersPerUnit() const = 0; | virtual float getMillimetersPerUnit() const = 0; | ||||
| /** A simple struct representing the area of a block. */ | |||||
| struct BlockArea { int x, y, width, height; }; | |||||
| /** Returns the area that this block covers within the layout of the group as a whole. | /** Returns the area that this block covers within the layout of the group as a whole. | ||||
| The coordinates are in logical block units, and are relative to the origin, which is the master block's top-left corner. | The coordinates are in logical block units, and are relative to the origin, which is the master block's top-left corner. | ||||
| */ | */ | ||||
| virtual Rectangle<int> getBlockAreaWithinLayout() const = 0; | |||||
| virtual BlockArea getBlockAreaWithinLayout() const = 0; | |||||
| /** Returns the rotation of this block relative to the master block in 90 degree steps clockwise. */ | /** Returns the rotation of this block relative to the master block in 90 degree steps clockwise. */ | ||||
| virtual int getRotation() const = 0; | virtual int getRotation() const = 0; | ||||
| @@ -124,12 +124,12 @@ public: | |||||
| Block::UID getConnectedMasterUID() const override { return masterUID; } | Block::UID getConnectedMasterUID() const override { return masterUID; } | ||||
| int getRotation() const override { return rotation; } | int getRotation() const override { return rotation; } | ||||
| Rectangle<int> getBlockAreaWithinLayout() const override | |||||
| BlockArea getBlockAreaWithinLayout() const override | |||||
| { | { | ||||
| if (rotation % 2 == 0) | if (rotation % 2 == 0) | ||||
| return { position.getX(), position.getY(), modelData.widthUnits, modelData.heightUnits }; | |||||
| return { position.first, position.second, modelData.widthUnits, modelData.heightUnits }; | |||||
| return { position.getX(), position.getY(), modelData.heightUnits, modelData.widthUnits }; | |||||
| return { position.first, position.second, modelData.heightUnits, modelData.widthUnits }; | |||||
| } | } | ||||
| TouchSurface* getTouchSurface() const override { return touchSurface.get(); } | TouchSurface* getTouchSurface() const override { return touchSurface.get(); } | ||||
| @@ -584,7 +584,7 @@ private: | |||||
| bool isMaster = false; | bool isMaster = false; | ||||
| Block::UID masterUID = {}; | Block::UID masterUID = {}; | ||||
| Point<int> position; | |||||
| std::pair<int, int> position; | |||||
| int rotation = 0; | int rotation = 0; | ||||
| friend Detector; | friend Detector; | ||||
| @@ -573,26 +573,26 @@ private: | |||||
| + getRotationForEdge (myPort.edge) | + getRotationForEdge (myPort.edge) | ||||
| - getRotationForEdge (theirPort.edge)) % 4; | - getRotationForEdge (theirPort.edge)) % 4; | ||||
| Point<int> delta; | |||||
| std::pair<int, int> delta; | |||||
| const auto theirBounds = neighbour->getBlockAreaWithinLayout(); | const auto theirBounds = neighbour->getBlockAreaWithinLayout(); | ||||
| switch ((block->getRotation() + getRotationForEdge (myPort.edge)) % 4) | switch ((block->getRotation() + getRotationForEdge (myPort.edge)) % 4) | ||||
| { | { | ||||
| case 0: // over me | case 0: // over me | ||||
| delta = { myOffset - (theirBounds.getWidth() - (theirOffset + 1)), -theirBounds.getHeight() }; | |||||
| delta = { myOffset - (theirBounds.width - (theirOffset + 1)), -theirBounds.height }; | |||||
| break; | break; | ||||
| case 1: // right of me | case 1: // right of me | ||||
| delta = { myBounds.getWidth(), myOffset - (theirBounds.getHeight() - (theirOffset + 1)) }; | |||||
| delta = { myBounds.width, myOffset - (theirBounds.height - (theirOffset + 1)) }; | |||||
| break; | break; | ||||
| case 2: // under me | case 2: // under me | ||||
| delta = { (myBounds.getWidth() - (myOffset + 1)) - theirOffset, myBounds.getHeight() }; | |||||
| delta = { (myBounds.width - (myOffset + 1)) - theirOffset, myBounds.height }; | |||||
| break; | break; | ||||
| case 3: // left of me | case 3: // left of me | ||||
| delta = { -theirBounds.getWidth(), (myBounds.getHeight() - (myOffset + 1)) - theirOffset }; | |||||
| delta = { -theirBounds.width, (myBounds.height - (myOffset + 1)) - theirOffset }; | |||||
| break; | break; | ||||
| } | } | ||||
| neighbour->position = myBounds.getPosition() + delta; | |||||
| neighbour->position = { myBounds.x + delta.first, myBounds.y + delta.second }; | |||||
| } | } | ||||
| layoutNeighbours (neighbourPtr, topology, masterUid, visited); | layoutNeighbours (neighbourPtr, topology, masterUid, visited); | ||||