upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
@ -38,14 +38,14 @@ namespace
|
||||
{
|
||||
for (int i = atts.size(); --i >= 0;)
|
||||
{
|
||||
const AttributedString::Attribute& att = atts.getReference (i);
|
||||
const int offset = position - att.range.getStart();
|
||||
const auto& att = atts.getUnchecked (i);
|
||||
auto offset = position - att.range.getStart();
|
||||
|
||||
if (offset >= 0)
|
||||
{
|
||||
if (offset > 0 && position < att.range.getEnd())
|
||||
{
|
||||
atts.insert (i + 1, att);
|
||||
atts.insert (i + 1, AttributedString::Attribute (att));
|
||||
atts.getReference (i).range.setEnd (position);
|
||||
atts.getReference (i + 1).range.setStart (position);
|
||||
}
|
||||
@ -57,7 +57,7 @@ namespace
|
||||
|
||||
Range<int> splitAttributeRanges (Array<AttributedString::Attribute>& atts, Range<int> newRange)
|
||||
{
|
||||
newRange = newRange.getIntersectionWith (Range<int> (0, getLength (atts)));
|
||||
newRange = newRange.getIntersectionWith ({ 0, getLength (atts) });
|
||||
|
||||
if (! newRange.isEmpty())
|
||||
{
|
||||
@ -72,8 +72,8 @@ namespace
|
||||
{
|
||||
for (int i = atts.size() - 1; --i >= 0;)
|
||||
{
|
||||
AttributedString::Attribute& a1 = atts.getReference (i);
|
||||
AttributedString::Attribute& a2 = atts.getReference (i + 1);
|
||||
auto& a1 = atts.getReference (i);
|
||||
auto& a2 = atts.getReference (i + 1);
|
||||
|
||||
if (a1.colour == a2.colour && a1.font == a2.font)
|
||||
{
|
||||
@ -91,16 +91,15 @@ namespace
|
||||
{
|
||||
if (atts.size() == 0)
|
||||
{
|
||||
atts.add (AttributedString::Attribute (Range<int> (0, length),
|
||||
f != nullptr ? *f : Font(),
|
||||
c != nullptr ? *c : Colour (0xff000000)));
|
||||
atts.add ({ Range<int> (0, length), f != nullptr ? *f : Font(), c != nullptr ? *c : Colour (0xff000000) });
|
||||
}
|
||||
else
|
||||
{
|
||||
const int start = getLength (atts);
|
||||
atts.add (AttributedString::Attribute (Range<int> (start, start + length),
|
||||
f != nullptr ? *f : atts.getReference (atts.size() - 1).font,
|
||||
c != nullptr ? *c : atts.getReference (atts.size() - 1).colour));
|
||||
auto start = getLength (atts);
|
||||
atts.add ({ Range<int> (start, start + length),
|
||||
f != nullptr ? *f : atts.getReference (atts.size() - 1).font,
|
||||
c != nullptr ? *c : atts.getReference (atts.size() - 1).colour });
|
||||
|
||||
mergeAdjacentRanges (atts);
|
||||
}
|
||||
}
|
||||
@ -110,10 +109,8 @@ namespace
|
||||
{
|
||||
range = splitAttributeRanges (atts, range);
|
||||
|
||||
for (int i = 0; i < atts.size(); ++i)
|
||||
for (auto& att : atts)
|
||||
{
|
||||
AttributedString::Attribute& att = atts.getReference (i);
|
||||
|
||||
if (range.getStart() < att.range.getEnd())
|
||||
{
|
||||
if (range.getEnd() <= att.range.getStart())
|
||||
@ -138,12 +135,9 @@ namespace
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
AttributedString::Attribute::Attribute() noexcept : colour (0xff000000) {}
|
||||
AttributedString::Attribute::~Attribute() noexcept {}
|
||||
|
||||
AttributedString::Attribute::Attribute (Attribute&& other) noexcept
|
||||
: range (other.range),
|
||||
font (static_cast<Font&&> (other.font)),
|
||||
font (std::move (other.font)),
|
||||
colour (other.colour)
|
||||
{
|
||||
}
|
||||
@ -151,22 +145,7 @@ AttributedString::Attribute::Attribute (Attribute&& other) noexcept
|
||||
AttributedString::Attribute& AttributedString::Attribute::operator= (Attribute&& other) noexcept
|
||||
{
|
||||
range = other.range;
|
||||
font = static_cast<Font&&> (other.font);
|
||||
colour = other.colour;
|
||||
return *this;
|
||||
}
|
||||
|
||||
AttributedString::Attribute::Attribute (const Attribute& other) noexcept
|
||||
: range (other.range),
|
||||
font (other.font),
|
||||
colour (other.colour)
|
||||
{
|
||||
}
|
||||
|
||||
AttributedString::Attribute& AttributedString::Attribute::operator= (const Attribute& other) noexcept
|
||||
{
|
||||
range = other.range;
|
||||
font = other.font;
|
||||
font = std::move (other.font);
|
||||
colour = other.colour;
|
||||
return *this;
|
||||
}
|
||||
@ -177,75 +156,32 @@ AttributedString::Attribute::Attribute (Range<int> r, const Font& f, Colour c) n
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
AttributedString::AttributedString()
|
||||
: lineSpacing (0.0f),
|
||||
justification (Justification::left),
|
||||
wordWrap (AttributedString::byWord),
|
||||
readingDirection (AttributedString::natural)
|
||||
{
|
||||
}
|
||||
|
||||
AttributedString::AttributedString (const String& newString)
|
||||
: lineSpacing (0.0f),
|
||||
justification (Justification::left),
|
||||
wordWrap (AttributedString::byWord),
|
||||
readingDirection (AttributedString::natural)
|
||||
{
|
||||
setText (newString);
|
||||
}
|
||||
|
||||
AttributedString::AttributedString (const AttributedString& other)
|
||||
: text (other.text),
|
||||
lineSpacing (other.lineSpacing),
|
||||
justification (other.justification),
|
||||
wordWrap (other.wordWrap),
|
||||
readingDirection (other.readingDirection),
|
||||
attributes (other.attributes)
|
||||
{
|
||||
}
|
||||
|
||||
AttributedString& AttributedString::operator= (const AttributedString& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
text = other.text;
|
||||
lineSpacing = other.lineSpacing;
|
||||
justification = other.justification;
|
||||
wordWrap = other.wordWrap;
|
||||
readingDirection = other.readingDirection;
|
||||
attributes = other.attributes;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
AttributedString::AttributedString (AttributedString&& other) noexcept
|
||||
: text (static_cast<String&&> (other.text)),
|
||||
: text (std::move (other.text)),
|
||||
lineSpacing (other.lineSpacing),
|
||||
justification (other.justification),
|
||||
wordWrap (other.wordWrap),
|
||||
readingDirection (other.readingDirection),
|
||||
attributes (static_cast<Array<Attribute>&&> (other.attributes))
|
||||
attributes (std::move (other.attributes))
|
||||
{
|
||||
}
|
||||
|
||||
AttributedString& AttributedString::operator= (AttributedString&& other) noexcept
|
||||
{
|
||||
text = static_cast<String&&> (other.text);
|
||||
text = std::move (other.text);
|
||||
lineSpacing = other.lineSpacing;
|
||||
justification = other.justification;
|
||||
wordWrap = other.wordWrap;
|
||||
readingDirection = other.readingDirection;
|
||||
attributes = static_cast<Array<Attribute>&&> (other.attributes);
|
||||
attributes = std::move (other.attributes);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
AttributedString::~AttributedString() noexcept {}
|
||||
|
||||
void AttributedString::setText (const String& newText)
|
||||
{
|
||||
const int newLength = newText.length();
|
||||
const int oldLength = getLength (attributes);
|
||||
auto newLength = newText.length();
|
||||
auto oldLength = getLength (attributes);
|
||||
|
||||
if (newLength > oldLength)
|
||||
appendRange (attributes, newLength - oldLength, nullptr, nullptr);
|
||||
@ -281,12 +217,12 @@ void AttributedString::append (const String& textToAppend, const Font& font, Col
|
||||
|
||||
void AttributedString::append (const AttributedString& other)
|
||||
{
|
||||
const int originalLength = getLength (attributes);
|
||||
const int originalNumAtts = attributes.size();
|
||||
auto originalLength = getLength (attributes);
|
||||
auto originalNumAtts = attributes.size();
|
||||
text += other.text;
|
||||
attributes.addArray (other.attributes);
|
||||
|
||||
for (int i = originalNumAtts; i < attributes.size(); ++i)
|
||||
for (auto i = originalNumAtts; i < attributes.size(); ++i)
|
||||
attributes.getReference (i).range += originalLength;
|
||||
|
||||
mergeAdjacentRanges (attributes);
|
||||
@ -330,12 +266,12 @@ void AttributedString::setFont (Range<int> range, const Font& font)
|
||||
|
||||
void AttributedString::setColour (Colour colour)
|
||||
{
|
||||
setColour (Range<int> (0, getLength (attributes)), colour);
|
||||
setColour ({ 0, getLength (attributes) }, colour);
|
||||
}
|
||||
|
||||
void AttributedString::setFont (const Font& font)
|
||||
{
|
||||
setFont (Range<int> (0, getLength (attributes)), font);
|
||||
setFont ({ 0, getLength (attributes) }, font);
|
||||
}
|
||||
|
||||
void AttributedString::draw (Graphics& g, const Rectangle<float>& area) const
|
||||
|
@ -43,22 +43,21 @@ class JUCE_API AttributedString
|
||||
{
|
||||
public:
|
||||
/** Creates an empty attributed string. */
|
||||
AttributedString();
|
||||
AttributedString() = default;
|
||||
|
||||
/** Creates an attributed string with the given text. */
|
||||
explicit AttributedString (const String& text);
|
||||
explicit AttributedString (const String& newString) { setText (newString); }
|
||||
|
||||
AttributedString (const AttributedString&);
|
||||
AttributedString& operator= (const AttributedString&);
|
||||
AttributedString (const AttributedString&) = default;
|
||||
AttributedString& operator= (const AttributedString&) = default;
|
||||
|
||||
// VS2013 can't default move constructors and assignments
|
||||
AttributedString (AttributedString&&) noexcept;
|
||||
AttributedString& operator= (AttributedString&&) noexcept;
|
||||
|
||||
/** Destructor. */
|
||||
~AttributedString() noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the complete text of this attributed string. */
|
||||
const String& getText() const noexcept { return text; }
|
||||
const String& getText() const noexcept { return text; }
|
||||
|
||||
/** Replaces all the text.
|
||||
This will change the text, but won't affect any of the colour or font attributes
|
||||
@ -151,10 +150,12 @@ public:
|
||||
class JUCE_API Attribute
|
||||
{
|
||||
public:
|
||||
Attribute() noexcept;
|
||||
~Attribute() noexcept;
|
||||
Attribute (const Attribute&) noexcept;
|
||||
Attribute& operator= (const Attribute&) noexcept;
|
||||
Attribute() = default;
|
||||
|
||||
Attribute (const Attribute&) = default;
|
||||
Attribute& operator= (const Attribute&) = default;
|
||||
|
||||
// VS2013 can't default move constructors and assignments
|
||||
Attribute (Attribute&&) noexcept;
|
||||
Attribute& operator= (Attribute&&) noexcept;
|
||||
|
||||
@ -168,7 +169,7 @@ public:
|
||||
Font font;
|
||||
|
||||
/** The colour for this range of characters. */
|
||||
Colour colour;
|
||||
Colour colour { 0xff000000 };
|
||||
|
||||
private:
|
||||
JUCE_LEAK_DETECTOR (Attribute)
|
||||
@ -197,10 +198,10 @@ public:
|
||||
|
||||
private:
|
||||
String text;
|
||||
float lineSpacing;
|
||||
Justification justification;
|
||||
WordWrap wordWrap;
|
||||
ReadingDirection readingDirection;
|
||||
float lineSpacing = 0.0f;
|
||||
Justification justification = Justification::left;
|
||||
WordWrap wordWrap = AttributedString::byWord;
|
||||
ReadingDirection readingDirection = AttributedString::natural;
|
||||
Array<Attribute> attributes;
|
||||
|
||||
JUCE_LEAK_DETECTOR (AttributedString)
|
||||
|
@ -313,7 +313,7 @@ float CustomTypeface::getStringWidth (const String& text)
|
||||
else
|
||||
{
|
||||
if (auto fallbackTypeface = Typeface::getFallbackTypeface())
|
||||
if (fallbackTypeface != this)
|
||||
if (fallbackTypeface.get() != this)
|
||||
x += fallbackTypeface->getStringWidth (String::charToString (c));
|
||||
}
|
||||
}
|
||||
@ -342,7 +342,7 @@ void CustomTypeface::getGlyphPositions (const String& text, Array<int>& resultGl
|
||||
{
|
||||
auto fallbackTypeface = getFallbackTypeface();
|
||||
|
||||
if (fallbackTypeface != nullptr && fallbackTypeface != this)
|
||||
if (fallbackTypeface != nullptr && fallbackTypeface.get() != this)
|
||||
{
|
||||
Array<int> subGlyphs;
|
||||
Array<float> subOffsets;
|
||||
@ -371,7 +371,7 @@ bool CustomTypeface::getOutlineForGlyph (int glyphNumber, Path& path)
|
||||
}
|
||||
|
||||
if (auto fallbackTypeface = getFallbackTypeface())
|
||||
if (fallbackTypeface != this)
|
||||
if (fallbackTypeface.get() != this)
|
||||
return fallbackTypeface->getOutlineForGlyph (glyphNumber, path);
|
||||
|
||||
return false;
|
||||
@ -389,7 +389,7 @@ EdgeTable* CustomTypeface::getEdgeTableForGlyph (int glyphNumber, const AffineTr
|
||||
else
|
||||
{
|
||||
if (auto fallbackTypeface = getFallbackTypeface())
|
||||
if (fallbackTypeface != this)
|
||||
if (fallbackTypeface.get() != this)
|
||||
return fallbackTypeface->getEdgeTableForGlyph (glyphNumber, transform, fontHeight);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
explicit CustomTypeface (InputStream& serialisedTypefaceStream);
|
||||
|
||||
/** Destructor. */
|
||||
~CustomTypeface();
|
||||
~CustomTypeface() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Resets this typeface, deleting all its glyphs and settings. */
|
||||
@ -155,9 +155,8 @@ protected:
|
||||
private:
|
||||
//==============================================================================
|
||||
class GlyphInfo;
|
||||
friend struct ContainerDeletePolicy<GlyphInfo>;
|
||||
OwnedArray<GlyphInfo> glyphs;
|
||||
short lookupTable [128];
|
||||
short lookupTable[128];
|
||||
|
||||
GlyphInfo* findGlyph (const juce_wchar character, bool loadIfNeeded) noexcept;
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace FontValues
|
||||
String fallbackFontStyle;
|
||||
}
|
||||
|
||||
typedef Typeface::Ptr (*GetTypefaceForFont) (const Font&);
|
||||
using GetTypefaceForFont = Typeface::Ptr (*)(const Font&);
|
||||
GetTypefaceForFont juce_getTypefaceForFont = nullptr;
|
||||
|
||||
float Font::getDefaultMinimumHorizontalScaleFactor() noexcept { return FontValues::minimumHorizontalScale; }
|
||||
@ -280,13 +280,13 @@ Font& Font::operator= (const Font& other) noexcept
|
||||
}
|
||||
|
||||
Font::Font (Font&& other) noexcept
|
||||
: font (static_cast<ReferenceCountedObjectPtr<SharedFontInternal>&&> (other.font))
|
||||
: font (std::move (other.font))
|
||||
{
|
||||
}
|
||||
|
||||
Font& Font::operator= (Font&& other) noexcept
|
||||
{
|
||||
font = static_cast<ReferenceCountedObjectPtr<SharedFontInternal>&&> (other.font);
|
||||
font = std::move (other.font);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -308,7 +308,7 @@ bool Font::operator!= (const Font& other) const noexcept
|
||||
void Font::dupeInternalIfShared()
|
||||
{
|
||||
if (font->getReferenceCount() > 1)
|
||||
font = new SharedFontInternal (*font);
|
||||
font = *new SharedFontInternal (*font);
|
||||
}
|
||||
|
||||
void Font::checkTypefaceSuitability()
|
||||
@ -392,7 +392,7 @@ Typeface* Font::getTypeface() const
|
||||
jassert (font->typeface != nullptr);
|
||||
}
|
||||
|
||||
return font->typeface;
|
||||
return font->typeface.get();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
@ -40,7 +40,7 @@ PositionedGlyph::PositionedGlyph (const Font& font_, juce_wchar character_, int
|
||||
}
|
||||
|
||||
PositionedGlyph::PositionedGlyph (PositionedGlyph&& other) noexcept
|
||||
: font (static_cast<Font&&> (other.font)),
|
||||
: font (std::move (other.font)),
|
||||
character (other.character), glyph (other.glyph),
|
||||
x (other.x), y (other.y), w (other.w), whitespace (other.whitespace)
|
||||
{
|
||||
@ -48,7 +48,7 @@ PositionedGlyph::PositionedGlyph (PositionedGlyph&& other) noexcept
|
||||
|
||||
PositionedGlyph& PositionedGlyph::operator= (PositionedGlyph&& other) noexcept
|
||||
{
|
||||
font = static_cast<Font&&> (other.font);
|
||||
font = std::move (other.font);
|
||||
character = other.character;
|
||||
glyph = other.glyph;
|
||||
x = other.x;
|
||||
@ -129,13 +129,13 @@ GlyphArrangement::GlyphArrangement()
|
||||
}
|
||||
|
||||
GlyphArrangement::GlyphArrangement (GlyphArrangement&& other)
|
||||
: glyphs (static_cast<Array<PositionedGlyph>&&> (other.glyphs))
|
||||
: glyphs (std::move (other.glyphs))
|
||||
{
|
||||
}
|
||||
|
||||
GlyphArrangement& GlyphArrangement::operator= (GlyphArrangement&& other)
|
||||
{
|
||||
glyphs = static_cast<Array<PositionedGlyph>&&> (other.glyphs);
|
||||
glyphs = std::move (other.glyphs);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
PositionedGlyph (const PositionedGlyph&) = default;
|
||||
PositionedGlyph& operator= (const PositionedGlyph&) = default;
|
||||
|
||||
// VS2013 can't default move constructors and assignmants
|
||||
// VS2013 can't default move constructors and assignments
|
||||
PositionedGlyph (PositionedGlyph&&) noexcept;
|
||||
PositionedGlyph& operator= (PositionedGlyph&&) noexcept;
|
||||
|
||||
|
@ -168,7 +168,7 @@ TextLayout::TextLayout (const TextLayout& other)
|
||||
}
|
||||
|
||||
TextLayout::TextLayout (TextLayout&& other) noexcept
|
||||
: lines (static_cast<OwnedArray<Line>&&> (other.lines)),
|
||||
: lines (std::move (other.lines)),
|
||||
width (other.width), height (other.height),
|
||||
justification (other.justification)
|
||||
{
|
||||
@ -176,7 +176,7 @@ TextLayout::TextLayout (TextLayout&& other) noexcept
|
||||
|
||||
TextLayout& TextLayout::operator= (TextLayout&& other) noexcept
|
||||
{
|
||||
lines = static_cast<OwnedArray<Line>&&> (other.lines);
|
||||
lines = std::move (other.lines);
|
||||
width = other.width;
|
||||
height = other.height;
|
||||
justification = other.justification;
|
||||
|
@ -118,7 +118,7 @@ Typeface::~Typeface()
|
||||
Typeface::Ptr Typeface::getFallbackTypeface()
|
||||
{
|
||||
const Font fallbackFont (Font::getFallbackFontName(), Font::getFallbackFontStyle(), 10.0f);
|
||||
return fallbackFont.getTypeface();
|
||||
return Typeface::Ptr (fallbackFont.getTypeface());
|
||||
}
|
||||
|
||||
EdgeTable* Typeface::getEdgeTableForGlyph (int glyphNumber, const AffineTransform& transform, float fontHeight)
|
||||
@ -140,9 +140,8 @@ EdgeTable* Typeface::getEdgeTableForGlyph (int glyphNumber, const AffineTransfor
|
||||
struct Typeface::HintingParams
|
||||
{
|
||||
HintingParams (Typeface& t)
|
||||
: cachedSize (0), top (0), middle (0), bottom (0)
|
||||
{
|
||||
Font font (&t);
|
||||
Font font (t);
|
||||
font = font.withHeight ((float) standardHeight);
|
||||
|
||||
top = getAverageY (font, "BDEFPRTZOQ", true);
|
||||
@ -209,7 +208,7 @@ private:
|
||||
float middle, upperScale, upperOffset, lowerScale, lowerOffset;
|
||||
};
|
||||
|
||||
float cachedSize;
|
||||
float cachedSize = 0;
|
||||
Scaling cachedScale;
|
||||
|
||||
static float getAverageY (const Font& font, const char* chars, bool getTop)
|
||||
@ -248,7 +247,7 @@ private:
|
||||
}
|
||||
|
||||
enum { standardHeight = 100 };
|
||||
float top, middle, bottom;
|
||||
float top = 0, middle = 0, bottom = 0;
|
||||
};
|
||||
|
||||
void Typeface::applyVerticalHintingTransform (float fontSize, Path& path)
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
|
||||
//==============================================================================
|
||||
/** Destructor. */
|
||||
virtual ~Typeface();
|
||||
~Typeface() override;
|
||||
|
||||
/** Returns true if this typeface can be used to render the specified font.
|
||||
When called, the font will already have been checked to make sure that its name and
|
||||
@ -153,7 +153,6 @@ protected:
|
||||
|
||||
private:
|
||||
struct HintingParams;
|
||||
friend struct ContainerDeletePolicy<HintingParams>;
|
||||
std::unique_ptr<HintingParams> hintingParams;
|
||||
CriticalSection hintingLock;
|
||||
|
||||
|
Reference in New Issue
Block a user