Skip to content

Commit d0b4fd2

Browse files
committed
More JUCE 8 support.
And changed numElementsInArray() usage to std::size().
1 parent 5bf54aa commit d0b4fd2

File tree

10 files changed

+30
-45
lines changed

10 files changed

+30
-45
lines changed

demo/JuceLibraryCode/AppConfig.h

+13-28
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,7 @@
2020

2121
// [END_USER_CODE_SECTION]
2222

23-
/*
24-
==============================================================================
25-
26-
In accordance with the terms of the JUCE 7 End-Use License Agreement, the
27-
JUCE Code in SECTION A cannot be removed, changed or otherwise rendered
28-
ineffective unless you have a JUCE Indie or Pro license, or are using JUCE
29-
under the GPL v3 license.
30-
31-
End User License Agreement: www.juce.com/juce-7-licence
32-
33-
==============================================================================
34-
*/
35-
36-
// BEGIN SECTION A
37-
38-
#ifndef JUCE_DISPLAY_SPLASH_SCREEN
39-
#define JUCE_DISPLAY_SPLASH_SCREEN 0
40-
#endif
41-
42-
// END SECTION A
43-
44-
#define JUCE_USE_DARK_SPLASH_SCREEN 1
45-
46-
#define JUCE_PROJUCER_VERSION 0x70005
23+
#define JUCE_PROJUCER_VERSION 0x80000
4724

4825
//==============================================================================
4926
#define JUCE_MODULE_AVAILABLE_juce_analytics 1
@@ -267,10 +244,6 @@
267244
//#define JUCE_USE_COREIMAGE_LOADER 1
268245
#endif
269246

270-
#ifndef JUCE_USE_DIRECTWRITE
271-
//#define JUCE_USE_DIRECTWRITE 1
272-
#endif
273-
274247
#ifndef JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING
275248
//#define JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING 0
276249
#endif
@@ -313,6 +286,10 @@
313286
//#define JUCE_WEB_BROWSER 1
314287
#endif
315288

289+
#ifndef JUCE_USE_WIN_WEBVIEW2_WITH_STATIC_LINKING
290+
//#define JUCE_USE_WIN_WEBVIEW2_WITH_STATIC_LINKING 0
291+
#endif
292+
316293
#ifndef JUCE_USE_WIN_WEBVIEW2
317294
#define JUCE_USE_WIN_WEBVIEW2 1
318295
#endif
@@ -370,6 +347,14 @@
370347
//#define SQUAREPINE_LOG_NETWORK_CALLS 1
371348
#endif
372349

350+
#ifndef SQUAREPINE_AUTOCONFIG_MAIN_THREAD_LOG_FILTERS
351+
//#define SQUAREPINE_AUTOCONFIG_MAIN_THREAD_LOG_FILTERS 0
352+
#endif
353+
354+
#ifndef SQUAREPINE_AUTOLOG_FUNCTION_AND_LINE
355+
//#define SQUAREPINE_AUTOLOG_FUNCTION_AND_LINE 0
356+
#endif
357+
373358
#ifndef SQUAREPINE_USE_GOOGLE_ANALYTICS
374359
//#define SQUAREPINE_USE_GOOGLE_ANALYTICS 1
375360
#endif

demo/source/demos/EasingsDemo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class CurveDisplayComponent final : public Component
131131

132132
if (stroke)
133133
PathStrokeType (1.0f)
134-
.createDashedStroke (scalablePlot, scalablePlot, dashPattern, numElementsInArray (dashPattern));
134+
.createDashedStroke (scalablePlot, scalablePlot, dashPattern, (int) std::size (dashPattern));
135135
}
136136

137137
ballArea = b.reduced (halfMargin).toFloat();

demo/source/demos/EffectChainDemo.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ void EffectChainDemo::resized()
505505
topArea.removeFromLeft (margin);
506506
topArea.removeFromRight (margin);
507507

508-
const auto w = topArea.getWidth() / numElementsInArray (buttons);
508+
const auto w = topArea.getWidth() / (int) std::size (buttons);
509509

510510
for (auto* button : buttons)
511511
button->setBounds (topArea.removeFromLeft (w));

demo/source/main/DemoLookAndFeel.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ TextLayout DemoLookAndFeel::layoutTooltipText (const String& text, Colour textCo
5959

6060
AttributedString s;
6161
s.setJustification (Justification::topLeft);
62-
s.append (text, Font (tooltipFontSize), textColour);
62+
s.append (text, Font (FontOptions (tooltipFontSize)), textColour);
6363

6464
TextLayout tl;
6565
tl.createLayoutWithBalancedLineLengths (s, (float) maxTooltipWidth);
@@ -142,7 +142,7 @@ void DemoLookAndFeel::drawMenuBarItem (Graphics& g, int width, int height,
142142
//==============================================================================
143143
int DemoLookAndFeel::getTabButtonBestWidth (TabBarButton& button, int tabDepth)
144144
{
145-
auto width = Font ((float) tabDepth).getStringWidth (button.getButtonText().trim())
145+
auto width = Font (FontOptions ((float) tabDepth)).getStringWidth (button.getButtonText().trim())
146146
+ getTabButtonOverlap (tabDepth) * 2;
147147

148148
if (auto* extraComponent = button.getExtraComponent())
@@ -368,7 +368,7 @@ void DemoLookAndFeel::drawComboBox (Graphics& g, int width, int height, bool isB
368368

369369
Font DemoLookAndFeel::getTextButtonFont (TextButton&, int)
370370
{
371-
return { defaultFontHeight };
371+
return FontOptions (defaultFontHeight);
372372
}
373373

374374
void DemoLookAndFeel::drawButtonBackground (Graphics& g, Button& button, const Colour& backgroundColour,
@@ -472,7 +472,7 @@ void DemoLookAndFeel::changeToggleButtonWidthToFitText (ToggleButton& button)
472472
const auto fontSize = defaultFontHeight;
473473
const auto tickWidth = fontSize * 1.1f;
474474

475-
button.setSize (roundToIntAccurate (Font (fontSize).getStringWidthFloat (button.getButtonText()) + tickWidth + defaultFontHeight),
475+
button.setSize (roundToIntAccurate (Font (FontOptions (fontSize)).getStringWidthFloat (button.getButtonText()) + tickWidth + defaultFontHeight),
476476
button.getHeight());
477477
}
478478

demo/source/main/DemoLookAndFeel.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ class DemoLookAndFeel final : public LookAndFeel_V4,
219219
/** @internal */
220220
int getDefaultMenuBarHeight() override { return roundToInt (defaultFontHeight * 1.5f); }
221221
/** @internal */
222-
Font getMenuBarFont (MenuBarComponent&, int, const String&) override { return defaultFontHeight; }
222+
Font getMenuBarFont (MenuBarComponent&, int, const String&) override { return FontOptions (defaultFontHeight); }
223223
/** @internal */
224224
void drawMenuBarBackground (Graphics&, int, int, bool, MenuBarComponent&) override;
225225
/** @internal */
@@ -235,7 +235,7 @@ class DemoLookAndFeel final : public LookAndFeel_V4,
235235
/** @internal */
236236
void drawTooltip (Graphics&, const String&, int, int) override;
237237
/** @internal */
238-
Font getPopupMenuFont() override { return defaultFontHeight; }
238+
Font getPopupMenuFont() override { return FontOptions (defaultFontHeight); }
239239
/** @internal */
240240
void drawLabel (Graphics&, Label&) override;
241241
/** @internal */
@@ -253,7 +253,7 @@ class DemoLookAndFeel final : public LookAndFeel_V4,
253253
/** @internal */
254254
void drawTabButton (TabBarButton&, Graphics&, bool, bool) override;
255255
/** @internal */
256-
Font getTabButtonFont (TabBarButton&, float) override { return defaultFontHeight; }
256+
Font getTabButtonFont (TabBarButton&, float) override { return FontOptions (defaultFontHeight); }
257257
/** @internal */
258258
void drawTabButtonText (TabBarButton&, Graphics&, bool, bool) override;
259259
/** @internal */

modules/squarepine_audio/codecs/ALACAudioFormat.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ class ALACAudioFormatWriter final : public AudioFormatWriter
217217
//==============================================================================
218218
bool write (const int** data, int numSamples) override
219219
{
220-
jassert (numSamples >= 0);
221-
jassert (data != nullptr && *data != nullptr); // the input must contain at least one channel!
220+
jassertquiet (numSamples >= 0);
221+
jassertquiet (data != nullptr && *data != nullptr); // the input must contain at least one channel!
222222

223223
return true;
224224
}

modules/squarepine_audio/effects/SimpleEQProcessor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class SimpleEQProcessor::Program final
237237

238238
auto& filts = parent.filters;
239239

240-
jassert (numElementsInArray (bands) == filts.size());
240+
jassert ((int) std::size (bands) == filts.size());
241241

242242
for (int i = 0; i < filts.size(); ++i)
243243
{
@@ -291,7 +291,7 @@ AudioProcessorValueTreeState::ParameterLayout SimpleEQProcessor::createParameter
291291
{ NEEDS_TRANS ("HighShelf"), FilterType::lowpass, 19000.0f }
292292
};
293293

294-
filters.ensureStorageAllocated (numElementsInArray (configs));
294+
filters.ensureStorageAllocated ((int) std::size (configs));
295295

296296
auto layout = createDefaultParameterLayout();
297297

modules/squarepine_core/cryptography/SHA2.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class SHA2
270270
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
271271
};
272272

273-
jassert (i < (size_t) numElementsInArray (K32));
273+
jassert (i < (size_t) (int) std::size (K32));
274274
return static_cast<Type> (K32[i]);
275275
}
276276

@@ -297,7 +297,7 @@ class SHA2
297297
0x431d67c49c100d4c, 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817
298298
};
299299

300-
jassert (i < (size_t) numElementsInArray (K64));
300+
jassert (i < (size_t) (int) std::size (K64));
301301
return static_cast<Type> (K64[i]);
302302
}
303303

modules/squarepine_graphics/components/ValueTreeEditor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class ValueTreeEditor final : public Component
237237
{
238238
Component* comps[] = { &treeView, &layoutResizer, &propertyEditor };
239239

240-
layout.layOutComponents (comps, numElementsInArray (comps),
240+
layout.layOutComponents (comps, (int) std::size (comps),
241241
0, 0, getWidth(), getHeight(),
242242
true, true);
243243
}

modules/squarepine_graphics/images/SVGParser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ inline AffineTransform parseTransform (String t)
293293

294294
float numbers[6];
295295

296-
for (int i = 0; i < numElementsInArray (numbers); ++i)
296+
for (int i = 0; i < (int) std::size (numbers); ++i)
297297
numbers[i] = parseSafeFloat (tokens[i]);
298298

299299
AffineTransform trans;

0 commit comments

Comments
 (0)