Skip to content
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

Merged
merged 9 commits into from
Sep 19, 2023

Conversation

jatinchowdhury18
Copy link
Collaborator

No description provided.

baconpaul and others added 7 commits September 15, 2023 14:50
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.
auto height = juce::jlimit(minH, maxH, *h);
static juce::Rectangle<int> convertToHostBounds(juce::Rectangle<int> pluginRect)
{
const auto desktopScale = juce::Desktop::getInstance().getGlobalScaleFactor();
Copy link
Collaborator Author

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)

Copy link
Collaborator

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.

@baconpaul
Copy link
Collaborator

I'll make time for a review this weekend. Amazing stuff!

Copy link
Collaborator

@baconpaul baconpaul left a 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.

auto height = juce::jlimit(minH, maxH, *h);
static juce::Rectangle<int> convertToHostBounds(juce::Rectangle<int> pluginRect)
{
const auto desktopScale = juce::Desktop::getInstance().getGlobalScaleFactor();
Copy link
Collaborator

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.


bool guiSetScale(double scale) noexcept override
{
std::cout << "GUI SET SCALE " << scale << std::endl;
Copy link
Collaborator

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

*/
bool guiAdjustSize(uint32_t *w, uint32_t *h) noexcept override
{
std::cout << "guiADJUST SIZE " << *w << " " << *h << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


*w = width;
*h = height;
std::cout << "End of GAdj " << width << " " << height << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


bool guiSetSize(uint32_t width, uint32_t height) noexcept override
{
std::cout << "GUI SET SIZE " << width << " " << height << std::endl;
Copy link
Collaborator

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;

{
auto b = editor->getBounds();
std::cout << "GUI Get Size " << editorWrapper->getBounds().toString() << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@jatinchowdhury18 jatinchowdhury18 merged commit 2c23b91 into free-audio:main Sep 19, 2023
18 checks passed
@jatinchowdhury18 jatinchowdhury18 deleted the scale-factor branch September 19, 2023 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants