Browse Source

Add Reset button

Signed-off-by: falkTX <falktx@falktx.com>
tags/v1.0
falkTX 3 years ago
parent
commit
75024944e8
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 30 additions and 15 deletions
  1. +30
    -15
      plugins/Common/IldaeilUI.cpp

+ 30
- 15
plugins/Common/IldaeilUI.cpp View File

@@ -323,6 +323,25 @@ public:
}
}

bool loadPlugin(const CarlaHostHandle handle, const char* const label)
{
if (carla_get_current_plugin_count(handle) != 0)
{
hidePluginUI();
carla_replace_plugin(handle, 0);
}

if (carla_add_plugin(handle, BINARY_NATIVE, PLUGIN_LV2, nullptr, nullptr,
label, 0, 0x0, PLUGIN_OPTIONS_NULL))
{
fPluginGenericUI = nullptr;
showPluginUI(handle);
return true;
}

return false;
}

protected:
void pluginWindowResized(uint width, uint height) override
{
@@ -444,6 +463,13 @@ protected:
setSize(kInitialWidth * scaleFactor, kInitialHeight * scaleFactor);
}

ImGui::SameLine();

if (ImGui::Button("Reset"))
{
loadPlugin(handle, carla_get_plugin_info(handle, 0)->label);
}

if (fDrawingState == kDrawingPluginGenericUI && fPluginHasCustomUI)
{
ImGui::SameLine();
@@ -574,7 +600,6 @@ protected:
setupMainWindowPos();

const CarlaHostHandle handle = fPlugin->fCarlaHostHandle;
const bool pluginIsRunning = carla_get_current_plugin_count(handle) != 0;

if (ImGui::Begin("Plugin List", nullptr, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize))
{
@@ -585,12 +610,6 @@ protected:

if (ImGui::Button("Load Plugin"))
{
if (pluginIsRunning)
{
hidePluginUI();
carla_replace_plugin(handle, 0);
}

do {
const PluginInfoCache& info(fPlugins[fPluginSelected]);

@@ -599,22 +618,16 @@ protected:

d_stdout("Loading %s...", info.name);

if (carla_add_plugin(handle, BINARY_NATIVE, PLUGIN_LV2, nullptr, nullptr,
slash+1, 0, 0x0, PLUGIN_OPTIONS_NULL))
if (loadPlugin(handle, slash+1))
{
fPluginGenericUI = nullptr;
showPluginUI(handle);
ImGui::EndDisabled();
ImGui::End();
return;
}

} while (false);
}

ImGui::EndDisabled();

if (pluginIsRunning)
if (carla_get_current_plugin_count(handle) != 0)
{
ImGui::SameLine();

@@ -624,6 +637,8 @@ protected:
}
}

ImGui::EndDisabled();

if (ImGui::BeginChild("pluginlistwindow"))
{
if (ImGui::BeginTable("pluginlist", 3, ImGuiTableFlags_NoSavedSettings|ImGuiTableFlags_NoClip))


Loading…
Cancel
Save