Skip to content

Commit

Permalink
Setting plugin editor scale factor (and other plugin editor changes) (#…
Browse files Browse the repository at this point in the history
…134)

* Implement guiSetScale in a JUCE correct way

guiSetScale calles editor->setScale
but then we need to use that editor scale transform to go
from logical units to physical units when representing
set/get size at the edges.

This works in Linux / Reaper at 200% on ubuntu.

* Not working in bitwig

* Scaling works for example plugin (no resizing)

* Example plugin works with resizing

* Little tweaks

* Move GUI resizing and transform logic to a wrapper component

* Fixing some mistakes on MacOS

* Fixing plugin editor not showing after closing and re-opening

* PR fixes

---------

Co-authored-by: baconpaul <[email protected]>
  • Loading branch information
jatinchowdhury18 and baconpaul authored Sep 19, 2023
1 parent 10bc7d4 commit 2c23b91
Show file tree
Hide file tree
Showing 3 changed files with 294 additions and 128 deletions.
5 changes: 5 additions & 0 deletions examples/GainPlugin/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ PluginEditor::PluginEditor(GainPlugin &plug) : juce::AudioProcessorEditor(plug),
plugin.getValueTreeState().addParameterListener(gainParameter->paramID, this);

setSize(300, 300);
setResizable (true, true);

constrainer.setSizeLimits (200, 200, 500, 500);
constrainer.setFixedAspectRatio (1.0);
setConstrainer (&constrainer);
}

PluginEditor::~PluginEditor()
Expand Down
2 changes: 2 additions & 0 deletions examples/GainPlugin/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ class PluginEditor : public juce::AudioProcessorEditor,
std::unique_ptr<juce::Slider> gainSlider;
std::unique_ptr<juce::SliderParameterAttachment> sliderAttachment;

juce::ComponentBoundsConstrainer constrainer;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginEditor)
};
Loading

0 comments on commit 2c23b91

Please sign in to comment.