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

added argument 0 to method pluginmode in order to exit from pluginmode #1858

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions Source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,9 +1492,13 @@ void PluginProcessor::receiveSysMessage(String const& selector, std::vector<pd::
case hash("pluginmode"): {
// TODO: it would be nicer if we could specifically target the correct editor here, instead of picking the first one and praying
auto editors = getEditors();

if(!patches.isEmpty()) {
float pluginModeFloatArgument = 1.0;
if(list.size())
{
pluginModeFloatArgument = list[0].getFloat();

auto pluginModeThemeOrPath = list[0].toString();
if(pluginModeThemeOrPath.endsWith(".plugdatatheme"))
{
Expand All @@ -1513,14 +1517,21 @@ void PluginProcessor::receiveSysMessage(String const& selector, std::vector<pd::
}
}

if (!editors.isEmpty()) {
if (!editors.isEmpty()) {
auto* editor = editors[0];
if (auto* cnv = editor->getCurrentCanvas()) {
editor->getTabComponent().openInPluginMode(cnv->patch);
if(pluginModeFloatArgument)
editor->getTabComponent().openInPluginMode(cnv->patch);
else
if (editor->isInPluginMode())
editor->pluginMode->closePluginMode();
}
} else {
patches[0]->openInPluginMode = true;
}
if(pluginModeFloatArgument)
patches[0]->openInPluginMode = true;
else
patches[0]->openInPluginMode = false;
Copy link
Contributor Author

@jyg jyg Sep 23, 2024

Choose a reason for hiding this comment

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

actually, I don't know if this line (1533) is necessary

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 it is? How else you it quit pluginmode?

Copy link
Contributor Author

@jyg jyg Sep 23, 2024

Choose a reason for hiding this comment

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

I mean I don't know when this code is executed, as in the if (!editors.isEmpty()) line before (l. 1520), the condition is always true, from what I understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

You could send a [pluginmode 0( message.
Might make sense if a user does [pluginmode $1( and sends 0 or 1 in?

}
}
break;
}
Expand Down