mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-16 00:34:19 +00:00
BLOCKS: Remove dependency on juce_gui_basics
This commit is contained in:
parent
b2e2346745
commit
5189b4bbd9
4 changed files with 39 additions and 16 deletions
|
|
@ -6,13 +6,34 @@ Develop
|
|||
|
||||
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.
|
||||
|
||||
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
|
||||
----------
|
||||
|
|
@ -20,8 +41,7 @@ No workaround.
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -130,10 +130,13 @@ public:
|
|||
/** Returns the length of one logical device unit as physical millimeters. */
|
||||
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.
|
||||
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. */
|
||||
virtual int getRotation() const = 0;
|
||||
|
|
|
|||
|
|
@ -124,12 +124,12 @@ public:
|
|||
Block::UID getConnectedMasterUID() const override { return masterUID; }
|
||||
int getRotation() const override { return rotation; }
|
||||
|
||||
Rectangle<int> getBlockAreaWithinLayout() const override
|
||||
BlockArea getBlockAreaWithinLayout() const override
|
||||
{
|
||||
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(); }
|
||||
|
|
@ -584,7 +584,7 @@ private:
|
|||
bool isMaster = false;
|
||||
Block::UID masterUID = {};
|
||||
|
||||
Point<int> position;
|
||||
std::pair<int, int> position;
|
||||
int rotation = 0;
|
||||
friend Detector;
|
||||
|
||||
|
|
|
|||
|
|
@ -573,26 +573,26 @@ private:
|
|||
+ getRotationForEdge (myPort.edge)
|
||||
- getRotationForEdge (theirPort.edge)) % 4;
|
||||
|
||||
Point<int> delta;
|
||||
std::pair<int, int> delta;
|
||||
const auto theirBounds = neighbour->getBlockAreaWithinLayout();
|
||||
|
||||
switch ((block->getRotation() + getRotationForEdge (myPort.edge)) % 4)
|
||||
{
|
||||
case 0: // over me
|
||||
delta = { myOffset - (theirBounds.getWidth() - (theirOffset + 1)), -theirBounds.getHeight() };
|
||||
delta = { myOffset - (theirBounds.width - (theirOffset + 1)), -theirBounds.height };
|
||||
break;
|
||||
case 1: // right of me
|
||||
delta = { myBounds.getWidth(), myOffset - (theirBounds.getHeight() - (theirOffset + 1)) };
|
||||
delta = { myBounds.width, myOffset - (theirBounds.height - (theirOffset + 1)) };
|
||||
break;
|
||||
case 2: // under me
|
||||
delta = { (myBounds.getWidth() - (myOffset + 1)) - theirOffset, myBounds.getHeight() };
|
||||
delta = { (myBounds.width - (myOffset + 1)) - theirOffset, myBounds.height };
|
||||
break;
|
||||
case 3: // left of me
|
||||
delta = { -theirBounds.getWidth(), (myBounds.getHeight() - (myOffset + 1)) - theirOffset };
|
||||
delta = { -theirBounds.width, (myBounds.height - (myOffset + 1)) - theirOffset };
|
||||
break;
|
||||
}
|
||||
|
||||
neighbour->position = myBounds.getPosition() + delta;
|
||||
neighbour->position = { myBounds.x + delta.first, myBounds.y + delta.second };
|
||||
}
|
||||
|
||||
layoutNeighbours (neighbourPtr, topology, masterUid, visited);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue