-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting plugin editor scale factor (and other plugin editor changes) #134
Setting plugin editor scale factor (and other plugin editor changes) #134
Conversation
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.
src/wrapper/clap-juce-wrapper.cpp
Outdated
auto height = juce::jlimit(minH, maxH, *h); | ||
static juce::Rectangle<int> convertToHostBounds(juce::Rectangle<int> pluginRect) | ||
{ | ||
const auto desktopScale = juce::Desktop::getInstance().getGlobalScaleFactor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this from the JUCE VST3 wrapper, but I wonder if we should prefer to use the scale factor requested by the CLAP host instead? (I imagine in many cases it would be the same)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use the one provided by gui_set_scale yeah; whether it is different or not is less relevant than if it is what the host wants. An assert if they are different might be interesting though.
I'll make time for a review this weekend. Amazing stuff! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great and correct both. Only comment is the stdout is still on. Perhaps retain them though with a TRACE macro as suggested in stream.
src/wrapper/clap-juce-wrapper.cpp
Outdated
auto height = juce::jlimit(minH, maxH, *h); | ||
static juce::Rectangle<int> convertToHostBounds(juce::Rectangle<int> pluginRect) | ||
{ | ||
const auto desktopScale = juce::Desktop::getInstance().getGlobalScaleFactor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use the one provided by gui_set_scale yeah; whether it is different or not is less relevant than if it is what the host wants. An assert if they are different might be interesting though.
src/wrapper/clap-juce-wrapper.cpp
Outdated
|
||
bool guiSetScale(double scale) noexcept override | ||
{ | ||
std::cout << "GUI SET SCALE " << scale << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to merge this cout
src/wrapper/clap-juce-wrapper.cpp
Outdated
*/ | ||
bool guiAdjustSize(uint32_t *w, uint32_t *h) noexcept override | ||
{ | ||
std::cout << "guiADJUST SIZE " << *w << " " << *h << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/wrapper/clap-juce-wrapper.cpp
Outdated
|
||
*w = width; | ||
*h = height; | ||
std::cout << "End of GAdj " << width << " " << height << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/wrapper/clap-juce-wrapper.cpp
Outdated
|
||
bool guiSetSize(uint32_t width, uint32_t height) noexcept override | ||
{ | ||
std::cout << "GUI SET SIZE " << width << " " << height << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto. maybe actually we want a TRACE_GUI_SIZE
macro left here so we can debug later? so like
#define TRACE_GUI_SIZE(x)
// #define TRACE_GUI_SIZE(x) std::cout << __FILE__ <<":" << __LINE__ << " " << x << std::endl;
src/wrapper/clap-juce-wrapper.cpp
Outdated
{ | ||
auto b = editor->getBounds(); | ||
std::cout << "GUI Get Size " << editorWrapper->getBounds().toString() << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
No description provided.