Skip to content

Commit 63bb026

Browse files
committed
Merge branch 'develop' of https://github.com/plugdata-team/plugdata into develop
2 parents 2093757 + 53d367d commit 63bb026

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

Source/Objects/ImplementationBase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void ObjectImplementationManager::handleAsyncUpdate()
153153
for (auto it = objectImplementations.cbegin(); it != objectImplementations.cend();) {
154154
auto& [ptr, implementation] = *it;
155155

156-
if (allObjects.contains(ptr)) {
156+
if (!allObjects.contains(ptr)) {
157157
it = objectImplementations.erase(it); // Erase and move iterator forward.
158158
} else {
159159
++it;

Source/PluginMode.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ class PluginMode final : public Component
4848
editor->getTopLevelComponent()->sendLookAndFeelChange();
4949
}
5050

51+
auto metaFile = patchPtr.get()->getPatchFile().getSiblingFile("meta.json");
52+
if (metaFile.existsAsFile()) {
53+
auto json = juce::JSON::parse(metaFile.loadFileAsString());
54+
if (json.isObject()) {
55+
auto jsonObject = json.getDynamicObject();
56+
if (jsonObject != nullptr && jsonObject->hasProperty("Scale")) {
57+
scaleDPIMult = jsonObject->getProperty("Scale");
58+
}
59+
}
60+
}
61+
5162
desktopWindow = editor->getPeer();
5263

5364
editor->nvgSurface.invalidateAll();
@@ -135,8 +146,9 @@ class PluginMode final : public Component
135146
setWidthAndHeight(previousScale * 0.01f);
136147
}
137148

138-
void setWidthAndHeight(float const scale)
149+
void setWidthAndHeight(float scale)
139150
{
151+
scale *= scaleDPIMult;
140152
auto newWidth = static_cast<int>(width * scale);
141153
auto newHeight = static_cast<int>(height * scale) + titlebarHeight + nativeTitleBarHeight;
142154

@@ -322,7 +334,7 @@ class PluginMode final : public Component
322334
cnv->setTransform(cnv->getTransform().scale(scale));
323335
cnv->setBounds(-b.getX() + x / scale, -b.getY() + y / scale, b.getWidth() + b.getX(), b.getHeight() + b.getY());
324336
} else {
325-
float scale = getWidth() / width;
337+
float scale = (getWidth() / width);
326338
pluginModeScale = scale;
327339
scaleComboBox.setVisible(true);
328340
editorButton->setVisible(true);
@@ -474,6 +486,7 @@ class PluginMode final : public Component
474486
float const height = static_cast<float>(cnv->patchHeight.getValue()) + 1.0f;
475487

476488
float pluginModeScale = 1.0f;
489+
float scaleDPIMult = 1.0f;
477490

478491
String lastTheme;
479492

Source/PluginProcessor.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,11 @@ void PluginProcessor::setEnableLimiter(bool const enabled)
689689
enableLimiter = enabled;
690690
}
691691

692+
bool PluginProcessor::getEnableLimiter()
693+
{
694+
return enableLimiter;
695+
}
696+
692697
void PluginProcessor::numChannelsChanged()
693698
{
694699
auto const blockSize = AudioProcessor::getBlockSize();
@@ -1767,8 +1772,8 @@ void PluginProcessor::receiveSysMessage(SmallString const& selector, SmallArray<
17671772
}
17681773
case hash("limit"): {
17691774
bool limit = list[0].getFloat();
1775+
setEnableLimiter(limit);
17701776
for (auto* editor : getEditors()) {
1771-
editor->pd->setEnableLimiter(limit);
17721777
editor->statusbar->showLimiterState(limit);
17731778
}
17741779
break;

Source/PluginProcessor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class PluginProcessor final : public AudioProcessor
4949
void setOversampling(int amount);
5050
void setLimiterThreshold(int amount);
5151
void setEnableLimiter(bool enabled);
52+
bool getEnableLimiter();
53+
5254
void prepareToPlay(double sampleRate, int samplesPerBlock) override;
5355
void numChannelsChanged() override;
5456
void releaseResources() override {};

Source/Statusbar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ Statusbar::Statusbar(PluginProcessor* processor, PluginEditor* e)
13571357

13581358
limiterButton = std::make_unique<StatusbarTextButton>();
13591359
limiterButton->setButtonText("Limit");
1360-
limiterButton->setToggleState(SettingsFile::getInstance()->getProperty<bool>("protected"), dontSendNotification);
1360+
limiterButton->setToggleState(pd->getEnableLimiter(), dontSendNotification);
13611361
limiterButton->setClickingTogglesState(true);
13621362

13631363
limiterButton->onStateChange = [this] {

0 commit comments

Comments
 (0)