Skip to content

Commit c89d832

Browse files
committed
Merge branch development-juce8 into testing-juce8
2 parents f2afd1c + 1fd1768 commit c89d832

7 files changed

Lines changed: 145 additions & 33 deletions

File tree

Plugins/ArduinoOutput/ArduinoOutput.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,13 @@ void ArduinoOutput::handleTTLEvent (TTLEventPtr event)
178178
{
179179
arduino.sendDigital (
180180
getParameter ("output_pin")->getValue(),
181-
ARD_LOW);
181+
ARD_HIGH);
182182
}
183183
else
184184
{
185185
arduino.sendDigital (
186186
getParameter ("output_pin")->getValue(),
187-
ARD_HIGH);
187+
ARD_LOW);
188188
}
189189
}
190190
}

Source/Processors/AudioNode/AudioEditor.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,6 @@ AudioConfigurationWindow::AudioConfigurationWindow (AudioDeviceManager& adm, Aud
294294

295295
setContentOwned (adsc, true);
296296
setVisible (false);
297-
298-
int fixedWidth = adsc->getWidth() + 10;
299-
int fixedHeight = adsc->getHeight() + getTitleBarHeight() + 20;
300-
301-
setResizeLimits (fixedWidth, fixedHeight, fixedWidth, fixedHeight);
302297
}
303298

304299
void AudioConfigurationWindow::closeButtonPressed()

Source/Processors/Parameter/ParameterEditor.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -184,30 +184,33 @@ void TextBoxParameterEditor::resized()
184184
updateBounds();
185185
}
186186

187-
void CustomToggleButton::paintButton (juce::Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
187+
void CustomToggleButton::paintButton (juce::Graphics& g, bool isMouseOver, bool isButtonDown)
188188
{
189-
// Set the colour based on the button state
189+
Colour backgroundColour = findColour (ThemeColours::widgetBackground);
190+
190191
if (getToggleState())
191192
{
192-
g.setColour (findColour (ThemeColours::highlightedFill));
193-
}
194-
else
195-
{
196-
g.setColour (findColour (ThemeColours::defaultFill));
193+
backgroundColour = findColour (ThemeColours::highlightedFill);
197194
}
198195

199-
// Draw a rounded rectangle
200-
g.fillRoundedRectangle (getLocalBounds().toFloat(), 3.0f);
196+
auto baseColour = backgroundColour.withMultipliedSaturation (hasKeyboardFocus (true) ? 1.3f : 1.0f)
197+
.withMultipliedAlpha (isEnabled() ? 1.0f : 0.5f);
201198

202-
// Set the text colour
203-
g.setColour (findColour (ThemeColours::outline));
199+
if (isButtonDown || isMouseOver)
200+
baseColour = baseColour.contrasting (isButtonDown ? 0.2f : 0.05f);
204201

205-
// Draw a rounded rectangle border
206-
g.drawRoundedRectangle (getLocalBounds().toFloat(), 3.0f, 1.0f);
202+
g.setColour (baseColour);
203+
g.fillRoundedRectangle (getLocalBounds().toFloat().reduced (0.5f), 3.0f);
204+
205+
g.setColour (findColour (ThemeColours::outline).withAlpha (isEnabled() ? 1.0f : 0.5f));
206+
g.drawRoundedRectangle (getLocalBounds().toFloat().reduced (0.5f), 3.0f, 1.0f);
207207

208-
// Set the text font
209208
g.setFont (FontOptions ("Inter", "Regular", int (0.75 * getHeight())));
210-
g.setColour (findColour (ThemeColours::defaultText));
209+
210+
if (! isEnabled() || isButtonDown)
211+
g.setColour (findColour (ThemeColours::defaultText).withAlpha (0.4f));
212+
else
213+
g.setColour (findColour (ThemeColours::defaultText));
211214

212215
// Set the text based on the button state
213216
if (getToggleState())

Source/Processors/Synchronizer/Synchronizer.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,21 @@ void SyncStream::syncWith (const SyncStream* mainStream)
218218
{
219219
actualSampleRate = estimatedActualSampleRate;
220220

221-
if (! isSynchronized)
222-
221+
if (std::abs(estimatedGlobalStartTime) < 1.0)
223222
{
224-
globalStartTime = estimatedGlobalStartTime;
225-
isSynchronized = true;
223+
if (! isSynchronized)
224+
225+
{
226+
globalStartTime = estimatedGlobalStartTime;
227+
isSynchronized = true;
228+
}
226229
}
230+
else
231+
{
232+
//LOGD ("Estimated global start time of ", estimatedGlobalStartTime, " is out of bounds. Ignoring.");
233+
}
234+
235+
227236
}
228237
else
229238
{

Source/UI/ControlPanel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ void ControlPanel::startAcquisition (bool recordingShouldAlsoStart)
587587
playButton->setToggleState (false, dontSendNotification);
588588
recordButton->setToggleState (false, dontSendNotification);
589589

590-
String errorMsg = "No output device found. Unable to start acquisition!";
590+
String errorMsg = "No output device found. Unable to start acquisition.";
591591
LOGE (errorMsg);
592592

593593
if (! isConsoleApp)
@@ -597,7 +597,7 @@ void ControlPanel::startAcquisition (bool recordingShouldAlsoStart)
597597
"and ensure there is an output device selected.";
598598

599599
AlertWindow::showMessageBox (AlertWindow::WarningIcon,
600-
"Acquisition Error!",
600+
"Acquisition Error",
601601
errorMsg);
602602
}
603603

@@ -609,7 +609,7 @@ void ControlPanel::startAcquisition (bool recordingShouldAlsoStart)
609609
playButton->setToggleState (false, dontSendNotification);
610610
recordButton->setToggleState (false, dontSendNotification);
611611

612-
String errorMsg = "Sample rate too low. Unable to start acquisition!";
612+
String errorMsg = "Sample rate too low. Unable to start acquisition.";
613613
LOGE (errorMsg);
614614

615615
if (! isConsoleApp)
@@ -619,7 +619,7 @@ void ControlPanel::startAcquisition (bool recordingShouldAlsoStart)
619619
"to a value of 44.1 kHz or higher. If no such option is available, try changing the output device type.";
620620

621621
AlertWindow::showMessageBox (AlertWindow::WarningIcon,
622-
"Acquisition Error!",
622+
"Acquisition Error",
623623
errorMsg);
624624
}
625625

Source/UI/LookAndFeel/CustomLookAndFeel.cpp

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ void CustomLookAndFeel::drawMenuBarBackground (Graphics& g, int width, int heigh
727727

728728
if (menuBar.getName().equalsIgnoreCase ("MainMenu"))
729729
{
730-
g.setColour (findColour (ThemeColours::defaultText));
730+
g.setColour (findColour (ThemeColours::defaultText).withAlpha (menuBar.isEnabled() ? 1.0f : 0.5f));
731731
String ver = "v" + String (ProjectInfo::versionString);
732732
g.setFont (getCommonMenuFont());
733733
int verStrWidth = GlyphArrangement::getStringWidthInt (getCommonMenuFont(), ver);
@@ -960,7 +960,7 @@ class CustomDocumentWindowButton : public Button
960960

961961
void paintButton (Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
962962
{
963-
auto pathColour = findColour (ThemeColours::controlPanelText);
963+
auto pathColour = findColour (ThemeColours::controlPanelText).withAlpha (isEnabled() ? 1.0f : 0.5f);
964964

965965
// g.fillAll (background);
966966

@@ -1117,6 +1117,110 @@ void CustomLookAndFeel::drawDocumentWindowTitleBar (DocumentWindow& window, Grap
11171117
g.drawText (window.getName(), textX, 0, textW, h, Justification::centredLeft, true);
11181118
}
11191119

1120+
//==================================================================
1121+
// ALERT WINDOW METHODS :
1122+
//==================================================================
1123+
1124+
AlertWindow* CustomLookAndFeel::createAlertWindow (const String& title,
1125+
const String& message,
1126+
const String& button1,
1127+
const String& button2,
1128+
const String& button3,
1129+
MessageBoxIconType iconType,
1130+
int numButtons,
1131+
Component* associatedComponent)
1132+
{
1133+
auto boundsOffset = 20;
1134+
1135+
auto* aw = LookAndFeel_V2::createAlertWindow (title, message, button1, button2, button3, iconType, numButtons, associatedComponent);
1136+
1137+
auto bounds = aw->getBounds();
1138+
bounds = bounds.withSizeKeepingCentre (bounds.getWidth() + boundsOffset, bounds.getHeight() + boundsOffset);
1139+
aw->setBounds (bounds);
1140+
1141+
for (auto* child : aw->getChildren())
1142+
if (auto* button = dynamic_cast<TextButton*> (child))
1143+
button->setBounds (button->getBounds() + Point<int> (10, 10));
1144+
1145+
return aw;
1146+
}
1147+
1148+
void CustomLookAndFeel::drawAlertBox (Graphics& g, AlertWindow& alert, const Rectangle<int>& textArea, TextLayout& textLayout)
1149+
{
1150+
auto cornerSize = 0.0f;
1151+
1152+
g.setColour (alert.findColour (AlertWindow::outlineColourId));
1153+
g.drawRoundedRectangle (alert.getLocalBounds().toFloat(), cornerSize, 2.0f);
1154+
1155+
auto bounds = alert.getLocalBounds().reduced (1);
1156+
g.reduceClipRegion (bounds);
1157+
1158+
g.setColour (alert.findColour (AlertWindow::backgroundColourId));
1159+
g.fillRoundedRectangle (bounds.toFloat(), cornerSize);
1160+
1161+
auto iconSpaceUsed = 0;
1162+
1163+
auto iconWidth = 50;
1164+
auto iconSize = jmin (iconWidth, bounds.getHeight());
1165+
1166+
if (alert.containsAnyExtraComponents() || alert.getNumButtons() > 2)
1167+
iconSize = jmin (iconSize, textArea.getHeight() + 50);
1168+
1169+
juce::Rectangle<int> iconRect (10, 30, iconSize, iconSize);
1170+
1171+
if (alert.getAlertType() != MessageBoxIconType::NoIcon)
1172+
{
1173+
Path icon;
1174+
char character;
1175+
Colour colour;
1176+
1177+
if (alert.getAlertType() == MessageBoxIconType::WarningIcon)
1178+
{
1179+
character = '!';
1180+
1181+
icon.addTriangle ((float) iconRect.getX() + (float) iconRect.getWidth() * 0.5f,
1182+
(float) iconRect.getY(),
1183+
static_cast<float> (iconRect.getRight()),
1184+
static_cast<float> (iconRect.getBottom()),
1185+
static_cast<float> (iconRect.getX()),
1186+
static_cast<float> (iconRect.getBottom()));
1187+
1188+
icon = icon.createPathWithRoundedCorners (5.0f);
1189+
colour = findColour (ProcessorColour::SOURCE_COLOUR);
1190+
}
1191+
else
1192+
{
1193+
colour = findColour (ProcessorColour::FILTER_COLOUR);
1194+
character = alert.getAlertType() == MessageBoxIconType::InfoIcon ? 'i' : '?';
1195+
1196+
icon.addEllipse (iconRect.toFloat());
1197+
}
1198+
1199+
GlyphArrangement ga;
1200+
ga.addFittedText (withDefaultMetrics (FontOptions { (float) iconRect.getHeight() * 0.9f, Font::bold }),
1201+
String::charToString ((juce_wchar) (uint8) character),
1202+
static_cast<float> (iconRect.getX()),
1203+
static_cast<float> (iconRect.getY()),
1204+
static_cast<float> (iconRect.getWidth()),
1205+
static_cast<float> (iconRect.getHeight()),
1206+
Justification::centred,
1207+
1);
1208+
1209+
g.setColour (Colour (colour));
1210+
g.fillPath (icon);
1211+
1212+
g.setColour (Colours::white);
1213+
ga.draw (g);
1214+
1215+
iconSpaceUsed = iconWidth + 20;
1216+
}
1217+
1218+
juce::Rectangle<int> alertBounds (bounds.getX() + iconSpaceUsed, 30, bounds.getWidth() - iconSpaceUsed, bounds.getHeight() - getAlertWindowButtonHeight() - 50);
1219+
1220+
g.setColour (alert.findColour (AlertWindow::textColourId));
1221+
textLayout.draw (g, alertBounds.toFloat());
1222+
}
1223+
11201224
int CustomLookAndFeel::getAlertWindowButtonHeight() { return 30; }
11211225
Font CustomLookAndFeel::getAlertWindowTitleFont() { return FontOptions { "Inter", "Bold", 20.f }; }
11221226
Font CustomLookAndFeel::getAlertWindowMessageFont() { return FontOptions { "Inter", "Medium", 18.f }; }

Source/UI/LookAndFeel/CustomLookAndFeel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,14 @@ class TESTABLE CustomLookAndFeel : public LookAndFeel_V4
183183
void drawDocumentWindowTitleBar (DocumentWindow&, Graphics&, int, int, int, int, const Image*, bool) override;
184184

185185
// ========= custom Alert Window methods: ===========================
186+
AlertWindow* createAlertWindow (const String& title, const String& message, const String& button1, const String& button2, const String& button3, MessageBoxIconType iconType, int numButtons, Component* associatedComponent) override;
187+
void drawAlertBox (Graphics&, AlertWindow&, const juce::Rectangle<int>& textArea, TextLayout&) override;
186188
int getAlertWindowButtonHeight() override;
187189
Font getAlertWindowTitleFont() override;
188190
Font getAlertWindowMessageFont() override;
189191
Font getAlertWindowFont() override;
190192

191193
// ======== custom TabButton methods: ================================
192-
193194
int getTabButtonSpaceAroundImage() override;
194195
int getTabButtonOverlap (int tabDepth) override;
195196
int getTabButtonBestWidth (TabBarButton&, int tabDepth) override;

0 commit comments

Comments
 (0)