Skip to content

Commit

Permalink
Merge branch 'develop' for 1.7.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
essej committed Dec 11, 2023
2 parents cc71115 + b6a0564 commit 35f1062
Show file tree
Hide file tree
Showing 20 changed files with 9,389 additions and 261 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endif()
# `project()` command. `project()` sets up some helpful variables that describe source/binary
# directories, and the current project version. This is a standard CMake command.

project(SonoBus VERSION 1.7.1)
project(SonoBus VERSION 1.7.2)

set(BUILDVERSION 80)

Expand Down Expand Up @@ -460,6 +460,7 @@ function(sono_add_custom_plugin_target target_name product_name formats is_instr
juce_add_binary_data("${target_name}_SBData" SOURCES
Source/wordmaker.g
Source/GoNotoKurrent-Regular.ttf
Source/DejaVuSans.ttf
localization/localized_de.txt
localization/localized_es.txt
localization/localized_fr.txt
Expand Down
73 changes: 67 additions & 6 deletions Source/OptionsView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,24 @@ void OptionsView::initializeLanguages()
languages.add(TRANS("Portuguese (Brazil)")); languagesNative.add(CharPointer_UTF8 ("Portugu\xc3\xaas (Brasil)")); codes.add("pt-br");
languages.add(TRANS("Dutch")); languagesNative.add("Nederlands"); codes.add("nl");

languages.add(TRANS("Japanese")); languagesNative.add(CharPointer_UTF8 ("\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e")); codes.add("ja");
//languages.add(TRANS("Japanese")); languagesNative.add("Japanese"); codes.add("ja"); // TODO fix and use above when we have a font that can display this all the time
if (processor.getUseUniversalFont()) {
languages.add(TRANS("Japanese")); languagesNative.add(CharPointer_UTF8 ("\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e")); codes.add("ja");
} else {
languages.add(TRANS("Japanese")); languagesNative.add("Japanese"); codes.add("ja"); // TODO fix and use above when we have a font that can display this all the time
}

languages.add(TRANS("Korean")); languagesNative.add(juce::CharPointer_UTF8 ("\xed\x95\x9c\xea\xb5\xad\xec\x9d\xb8")); codes.add("ko");
if (processor.getUseUniversalFont()) {
languages.add(TRANS("Korean")); languagesNative.add(juce::CharPointer_UTF8 ("\xed\x95\x9c\xea\xb5\xad\xec\x9d\xb8")); codes.add("ko");
} else {
languages.add(TRANS("Korean")); languagesNative.add("Korean"); codes.add("ko");
}

//languages.add(TRANS("Chinese (Simplified)")); languagesNative.add("Chinese (Simplified)"); codes.add("zh-hans");
languages.add(TRANS("Chinese (Simplified)")); languagesNative.add(CharPointer_UTF8 ("\xe4\xb8\xad\xe6\x96\x87\xef\xbc\x88\xe7\xae\x80\xe4\xbd\x93\xef\xbc\x89")); codes.add("zh-hans");
if (processor.getUseUniversalFont()) {
languages.add(TRANS("Chinese (Simplified)")); languagesNative.add(CharPointer_UTF8 ("\xe4\xb8\xad\xe6\x96\x87\xef\xbc\x88\xe7\xae\x80\xe4\xbd\x93\xef\xbc\x89")); codes.add("zh-hans");
}
else {
languages.add(TRANS("Chinese (Simplified)")); languagesNative.add("Chinese (Simplified)"); codes.add("zh-hans");
}
//languages.add(TRANS("Chinese (Traditional)")); languagesNative.add(CharPointer_UTF8 ("\xe4\xb8\xad\xe6\x96\x87\xef\xbc\x88\xe7\xb9\x81\xe9\xab\x94\xef\xbc\x89")); codes.add("zh-hant");

languages.add(TRANS("Russian")); languagesNative.add(juce::CharPointer_UTF8 ("p\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9")); codes.add("ru");
Expand Down Expand Up @@ -169,6 +180,12 @@ OptionsView::OptionsView(SonobusAudioProcessor& proc, std::function<AudioDeviceM
mOptionsLanguageLabel->setJustificationType(Justification::centredRight);


mOptionsUnivFontButton = std::make_unique<ToggleButton>(TRANS("Use Universal Font"));
mOptionsUnivFontButton->setTooltip(TRANS("Use font that always supports Chinese, Japanese, and Korean characters. Can cause slowdowns on some systems, so only use it if you need it."));
mOptionsUnivFontButton->setToggleState(processor.getUseUniversalFont(), dontSendNotification);
mOptionsUnivFontButton->addListener(this);


//mOptionsHearLatencyButton = std::make_unique<ToggleButton>(TRANS("Make Latency Test Audible"));
//mOptionsHearLatencyButton->addListener(this);
//mHearLatencyTestAttachment = std::make_unique<AudioProcessorValueTreeState::ButtonAttachment> (p.getValueTreeState(), SonobusAudioProcessor::paramHearLatencyTest, *mOptionsHearLatencyButton);
Expand Down Expand Up @@ -359,6 +376,7 @@ OptionsView::OptionsView(SonobusAudioProcessor& proc, std::function<AudioDeviceM
mOptionsComponent->addAndMakeVisible(mOptionsChangeAllFormatButton.get());
mOptionsComponent->addAndMakeVisible(mVersionLabel.get());
mOptionsComponent->addAndMakeVisible(mOptionsLanguageChoice.get());
mOptionsComponent->addAndMakeVisible(mOptionsUnivFontButton.get());
mOptionsComponent->addAndMakeVisible(mOptionsLanguageLabel.get());
mOptionsComponent->addAndMakeVisible(mOptionsAutoDropThreshSlider.get());
mOptionsComponent->addAndMakeVisible(mOptionsAutoDropThreshLabel.get());
Expand Down Expand Up @@ -618,6 +636,8 @@ void OptionsView::updateState(bool ignorecheck)

}

mOptionsUnivFontButton->setToggleState(processor.getUseUniversalFont(), dontSendNotification);

mOptionsSliderSnapToMouseButton->setToggleState(processor.getSlidersSnapToMousePosition(), dontSendNotification);
mOptionsDisableShortcutButton->setToggleState(processor.getDisableKeyboardShortcuts(), dontSendNotification);

Expand Down Expand Up @@ -707,8 +727,9 @@ void OptionsView::updateLayout()

optionsLanguageBox.items.clear();
optionsLanguageBox.flexDirection = FlexBox::Direction::row;
optionsLanguageBox.items.add(FlexItem(minButtonWidth, minitemheight, *mOptionsLanguageLabel).withMargin(0).withFlex(1));
optionsLanguageBox.items.add(FlexItem(minButtonWidth-10, minitemheight, *mOptionsLanguageLabel).withMargin(0).withFlex(0.5f));
optionsLanguageBox.items.add(FlexItem(minButtonWidth, minitemheight, *mOptionsLanguageChoice).withMargin(0).withFlex(3));
optionsLanguageBox.items.add(FlexItem(minButtonWidth-10, minitemheight, *mOptionsUnivFontButton).withMargin(0).withFlex(1.0));

//optionsHearlatBox.items.clear();
//optionsHearlatBox.flexDirection = FlexBox::Direction::row;
Expand Down Expand Up @@ -1154,6 +1175,46 @@ void OptionsView::buttonClicked (Button* buttonThatWasClicked)
processor.resetDefaultPluginSettings();
}

else if (buttonThatWasClicked == mOptionsUnivFontButton.get()) {
bool newval = mOptionsUnivFontButton->getToggleState();
String message;
String title;
if (JUCEApplication::isStandaloneApp()) {
message = TRANS("In order to change the universal font option, the application must be closed and restarted by you.");
title = TRANS("App restart required");
} else {
message = TRANS("In order to change the universal font option, the plugin host must close the plugin view and reopen it.");
title = TRANS("Host session reload required");
}

AlertWindow::showOkCancelBox(AlertWindow::WarningIcon,
title,
message,
TRANS("Change and Close"),
TRANS("Cancel"),
this,
ModalCallbackFunction::create( [this,newval](int result) {
if (result) {

processor.setUseUniversalFont(newval);

if (JUCEApplication::isStandaloneApp()) {
if (saveSettingsIfNeeded) {
saveSettingsIfNeeded();
}
Timer::callAfterDelay(500, [] {
JUCEApplication::getInstance()->quit();
});
}
}
else {
mOptionsUnivFontButton->setToggleState(!newval, dontSendNotification);
}
}));


}

}


Expand Down
1 change: 1 addition & 0 deletions Source/OptionsView.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public MultiTimer

std::unique_ptr<SonoChoiceButton> mOptionsLanguageChoice;
std::unique_ptr<Label> mOptionsLanguageLabel;
std::unique_ptr<ToggleButton> mOptionsUnivFontButton;


std::unique_ptr<Label> mOptionsRecFilesStaticLabel;
Expand Down
111 changes: 67 additions & 44 deletions Source/SonoLookAndFeel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@

#include <JuceHeader.h>

#if JUCE_ANDROID
#define OLDFONTSTUFF 1

#if OLDFONTSTUFF

float SonoLookAndFeel::fontScale = 1.0f;
#elif JUCE_WINDOWS
float SonoLookAndFeel::fontScale = 1.35f;

#else
float SonoLookAndFeel::fontScale = 1.25f;

#if JUCE_ANDROID
float SonoLookAndFeel::fontScale = 1.0f;
#elif JUCE_WINDOWS
float SonoLookAndFeel::fontScale = 1.35f;
#else
float SonoLookAndFeel::fontScale = 1.25f;
#endif

#endif

//==============================================================================
Expand All @@ -33,15 +43,14 @@ static TextLayout sonoLayoutTooltipText (const String& text, Colour colour) noex
return tl;
}

SonoLookAndFeel::SonoLookAndFeel()
SonoLookAndFeel::SonoLookAndFeel(bool useUniversalFont) : mUseUniversalFont(useUniversalFont)
{
// setColour (mainBackgroundColourId, Colour::greyLevel (0.8f));
//DBG("Sonolook and feel");

setUsingNativeAlertWindows(true);

//fontScale = 1.2; // 1.125;


setColourScheme(getDarkColourScheme());

Expand Down Expand Up @@ -143,15 +152,16 @@ SonoLookAndFeel::SonoLookAndFeel()
setupDefaultMeterColours();

if (auto * deflnf = dynamic_cast<SonoLookAndFeel*>(&LookAndFeel::getDefaultLookAndFeel())) {
setLanguageCode(deflnf->languageCode);
setLanguageCode(deflnf->languageCode, mUseUniversalFont);
}

//DBG("Myfont name " << myFont.getTypefaceName());
}

void SonoLookAndFeel::setLanguageCode(const String & lang)
void SonoLookAndFeel::setLanguageCode(const String & lang, bool useUniversalFont)
{
languageCode = lang;
mUseUniversalFont = useUniversalFont;

/*
if (lang.startsWith("zh")) {
Expand All @@ -163,6 +173,8 @@ void SonoLookAndFeel::setLanguageCode(const String & lang)
*/
}



Typeface::Ptr SonoLookAndFeel::getTypefaceForFont (const Font& font)
{
DBG("get typeface for font " << font.getTypefaceName() << " with defaultsansser: " << Font::getDefaultSansSerifFontName());
Expand All @@ -176,55 +188,66 @@ Typeface::Ptr SonoLookAndFeel::getTypefaceForFont (const Font& font)

String slang = lang.initialSectionNotContaining("_").toLowerCase();

#if 0
if (slang.startsWith("ja")) {
DBG("Using japanese");
Font jfont(font);
if (!mUseUniversalFont)
{
if (slang.startsWith("ja")) {
DBG("Using japanese");
Font jfont(font);
#if (JUCE_MAC || JUCE_IOS)
jfont.setTypefaceName("Hiragino Sans W3");
jfont.setTypefaceName("Hiragino Sans W3");
#elif JUCE_ANDROID
//jfont.setTypefaceName("Droid Sans Fallback");
return Typeface::createSystemTypefaceFor (BinaryData::DejaVuSans_ttf, BinaryData::DejaVuSans_ttfSize);
//jfont.setTypefaceName("Droid Sans Fallback");
return Typeface::createSystemTypefaceFor (BinaryData::DejaVuSans_ttf, BinaryData::DejaVuSans_ttfSize);
#elif JUCE_WINDOWS
jfont.setTypefaceName("Arial Unicode MS");
jfont.setTypefaceName("Arial Unicode MS");
#endif
return Typeface::createSystemTypefaceFor (jfont);
}
else if (slang.startsWith("ko")) {
DBG("Using korean");
Font jfont(font);
return Typeface::createSystemTypefaceFor (jfont);
}
else if (slang.startsWith("ko")) {
DBG("Using korean");
Font jfont(font);
#if (JUCE_MAC || JUCE_IOS)
jfont.setTypefaceName("Apple SD Gothic Neo");
jfont.setTypefaceName("Apple SD Gothic Neo");
#elif JUCE_ANDROID
//jfont.setTypefaceName("Droid Sans Fallback");
return Typeface::createSystemTypefaceFor (BinaryData::DejaVuSans_ttf, BinaryData::DejaVuSans_ttfSize);
//jfont.setTypefaceName("Droid Sans Fallback");
return Typeface::createSystemTypefaceFor (BinaryData::DejaVuSans_ttf, BinaryData::DejaVuSans_ttfSize);
#elif JUCE_WINDOWS
jfont.setTypefaceName("Malgun Gothic");
//jfont.setTypefaceName("Arial Unicode MS");
jfont.setTypefaceName("Malgun Gothic");
//jfont.setTypefaceName("Arial Unicode MS");
#endif
return Typeface::createSystemTypefaceFor (jfont);
}
else if (slang.startsWith("zh")) {
DBG("Using chinese");
Font jfont(font);
return Typeface::createSystemTypefaceFor (jfont);
}
else if (slang.startsWith("zh")) {
DBG("Using chinese");
Font jfont(font);
#if (JUCE_MAC || JUCE_IOS)
jfont.setTypefaceName("PingFang SC");
jfont.setTypefaceName("PingFang SC");
#elif JUCE_WINDOWS
jfont.setTypefaceName("Arial Unicode MS");
jfont.setTypefaceName("Arial Unicode MS");
#elif JUCE_ANDROID
jfont.setTypefaceName("DroidSansFallback");
return Typeface::createSystemTypefaceFor (BinaryData::DejaVuSans_ttf, BinaryData::DejaVuSans_ttfSize);
jfont.setTypefaceName("DroidSansFallback");
return Typeface::createSystemTypefaceFor (BinaryData::DejaVuSans_ttf, BinaryData::DejaVuSans_ttfSize);
#endif
return Typeface::createSystemTypefaceFor (jfont);
return Typeface::createSystemTypefaceFor (jfont);
}
else
{
DBG("Creating custom typeface!!");

return Typeface::createSystemTypefaceFor (BinaryData::DejaVuSans_ttf, BinaryData::DejaVuSans_ttfSize);
//return Typeface::createSystemTypefaceFor (BinaryData::InterUnicode_ttf, BinaryData::InterUnicode_ttfSize);
//return Typeface::createSystemTypefaceFor (BinaryData::GoNotoKurrentRegular_ttf, BinaryData::GoNotoKurrentRegular_ttfSize);
}
}
else
#endif
{
DBG("Creating custom typeface!!");

//return Typeface::createSystemTypefaceFor (BinaryData::DejaVuSans_ttf, BinaryData::DejaVuSans_ttfSize);
//return Typeface::createSystemTypefaceFor (BinaryData::InterUnicode_ttf, BinaryData::InterUnicode_ttfSize);
return Typeface::createSystemTypefaceFor (BinaryData::GoNotoKurrentRegular_ttf, BinaryData::GoNotoKurrentRegular_ttfSize);
else {
// universal font stuff
{
DBG("Creating custom typeface!!");

//return Typeface::createSystemTypefaceFor (BinaryData::DejaVuSans_ttf, BinaryData::DejaVuSans_ttfSize);
//return Typeface::createSystemTypefaceFor (BinaryData::InterUnicode_ttf, BinaryData::InterUnicode_ttfSize);
return Typeface::createSystemTypefaceFor (BinaryData::GoNotoKurrentRegular_ttf, BinaryData::GoNotoKurrentRegular_ttfSize);
}
}
}
return LookAndFeel_V4::getTypefaceForFont(font);
Expand Down
17 changes: 11 additions & 6 deletions Source/SonoLookAndFeel.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
class SonoLookAndFeel : public LookAndFeel_V4, public foleys::LevelMeter::LookAndFeelMethods
{
public:
SonoLookAndFeel();
SonoLookAndFeel(bool useUniversalFont=false);

void setLanguageCode(const String & lang);
void setLanguageCode(const String & lang, bool useUniversalFont=false);

//void fillWithBackgroundTexture (Graphics&);
//static void fillWithBackgroundTexture (Component&, Graphics&);
Expand Down Expand Up @@ -111,15 +111,20 @@ class SonoLookAndFeel : public LookAndFeel_V4, public foleys::LevelMeter::Look
Justification sliderTextJustification = Justification::centred;

static float getFontScale() { return fontScale; }

static void setFontScale(float scale) { fontScale = scale; }


protected:

Font myFont;

static float fontScale;


Font myFont;

float labelCornerRadius = 4.0f;
String languageCode;

bool mUseUniversalFont = false;

public:

#include "LevelMeterLookAndFeelMethods.h"
Expand Down
25 changes: 19 additions & 6 deletions Source/SonobusPluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,21 @@ void SonobusAudioProcessorEditor::configEditor(TextEditor *editor, bool passwd)

//==============================================================================
SonobusAudioProcessorEditor::SonobusAudioProcessorEditor (SonobusAudioProcessor& p)
: AudioProcessorEditor (&p), processor (p), sonoSliderLNF(13), smallLNF(14), teensyLNF(11), panSliderLNF(12)
: AudioProcessorEditor (&p), processor (p), sonoLookAndFeel(p.getUseUniversalFont()), sonoSliderLNF(13), smallLNF(14), teensyLNF(11), panSliderLNF(12)
{
if (p.getUseUniversalFont()) {
#if JUCE_ANDROID
SonoLookAndFeel::setFontScale(1.0f);
#elif JUCE_WINDOWS
SonoLookAndFeel::setFontScale(1.35f);
#else
SonoLookAndFeel::setFontScale(1.25f);
#endif
}
else {
SonoLookAndFeel::setFontScale(1.0f);
}

LookAndFeel::setDefaultLookAndFeel(&sonoLookAndFeel);

sonoLookAndFeel.setUsingNativeAlertWindows(true);
Expand All @@ -283,11 +296,11 @@ SonobusAudioProcessorEditor::SonobusAudioProcessorEditor (SonobusAudioProcessor&

setupLocalisation(processor.getLanguageOverrideCode());

sonoLookAndFeel.setLanguageCode(mActiveLanguageCode);
sonoSliderLNF.setLanguageCode(mActiveLanguageCode);
smallLNF.setLanguageCode(mActiveLanguageCode);
teensyLNF.setLanguageCode(mActiveLanguageCode);
panSliderLNF.setLanguageCode(mActiveLanguageCode);
sonoLookAndFeel.setLanguageCode(mActiveLanguageCode, processor.getUseUniversalFont());
sonoSliderLNF.setLanguageCode(mActiveLanguageCode, processor.getUseUniversalFont());
smallLNF.setLanguageCode(mActiveLanguageCode, processor.getUseUniversalFont());
teensyLNF.setLanguageCode(mActiveLanguageCode, processor.getUseUniversalFont());
panSliderLNF.setLanguageCode(mActiveLanguageCode, processor.getUseUniversalFont());

setColour (nameTextColourId, Colour::fromFloatRGBA(1.0f, 1.0f, 1.0f, 0.9f));
setColour (selectedColourId, Colour::fromFloatRGBA(0.0f, 0.4f, 0.8f, 0.5f));
Expand Down
Loading

0 comments on commit 35f1062

Please sign in to comment.