Ildaeil: Implement file browser requests, used in internal plugins
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
7fbf0bd8e7
commit
da4eca8d20
1 changed files with 33 additions and 6 deletions
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#ifndef HEADLESS
|
#ifndef HEADLESS
|
||||||
# include "ImGuiWidget.hpp"
|
# include "ImGuiWidget.hpp"
|
||||||
|
# include "extra/FileBrowserDialog.hpp"
|
||||||
# include "extra/ScopedPointer.hpp"
|
# include "extra/ScopedPointer.hpp"
|
||||||
# include "extra/Thread.hpp"
|
# include "extra/Thread.hpp"
|
||||||
#else
|
#else
|
||||||
|
@ -649,6 +650,8 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
||||||
|
|
||||||
String fPopupError;
|
String fPopupError;
|
||||||
|
|
||||||
|
FileBrowserHandle fileBrowserHandle = nullptr;
|
||||||
|
|
||||||
bool idleCallbackActive = false;
|
bool idleCallbackActive = false;
|
||||||
IldaeilModule* const module;
|
IldaeilModule* const module;
|
||||||
|
|
||||||
|
@ -680,8 +683,13 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
||||||
if (module->fCarlaHostHandle != nullptr)
|
if (module->fCarlaHostHandle != nullptr)
|
||||||
{
|
{
|
||||||
if (idleCallbackActive)
|
if (idleCallbackActive)
|
||||||
|
{
|
||||||
module->pcontext->removeIdleCallback(this);
|
module->pcontext->removeIdleCallback(this);
|
||||||
|
|
||||||
|
if (fileBrowserHandle != nullptr)
|
||||||
|
fileBrowserClose(fileBrowserHandle);
|
||||||
|
}
|
||||||
|
|
||||||
if (fPluginRunning)
|
if (fPluginRunning)
|
||||||
carla_show_custom_ui(module->fCarlaHostHandle, 0, false);
|
carla_show_custom_ui(module->fCarlaHostHandle, 0, false);
|
||||||
|
|
||||||
|
@ -741,13 +749,17 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void openFileFromDSP(const bool isDir, const char* const title, const char* const filter)
|
void openFileFromDSP(bool /* isDir */, const char* const title, const char* /* filter */)
|
||||||
{
|
{
|
||||||
/*
|
DISTRHO_SAFE_ASSERT_RETURN(idleCallbackActive,);
|
||||||
Window::FileBrowserOptions opts;
|
DISTRHO_SAFE_ASSERT_RETURN(fPluginType == PLUGIN_INTERNAL,);
|
||||||
|
|
||||||
|
CardinalPluginContext* const pcontext = module->pcontext;
|
||||||
|
|
||||||
|
// FIXME isEmbed
|
||||||
|
FileBrowserOptions opts;
|
||||||
opts.title = title;
|
opts.title = title;
|
||||||
getWindow().openFileBrowser(opts);
|
fileBrowserHandle = fileBrowserCreate(true, pcontext->nativeWindowId, pcontext->window->pixelRatio, opts);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void createOrUpdatePluginGenericUI(const CarlaHostHandle handle)
|
void createOrUpdatePluginGenericUI(const CarlaHostHandle handle)
|
||||||
|
@ -935,6 +947,12 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
||||||
{
|
{
|
||||||
idleCallbackActive = false;
|
idleCallbackActive = false;
|
||||||
pcontext->removeIdleCallback(this);
|
pcontext->removeIdleCallback(this);
|
||||||
|
|
||||||
|
if (fileBrowserHandle != nullptr)
|
||||||
|
{
|
||||||
|
fileBrowserClose(fileBrowserHandle);
|
||||||
|
fileBrowserHandle = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -944,6 +962,15 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
||||||
const CarlaHostHandle handle = module->fCarlaHostHandle;
|
const CarlaHostHandle handle = module->fCarlaHostHandle;
|
||||||
DISTRHO_SAFE_ASSERT_RETURN(handle != nullptr,);
|
DISTRHO_SAFE_ASSERT_RETURN(handle != nullptr,);
|
||||||
|
|
||||||
|
if (fileBrowserHandle != nullptr && fileBrowserIdle(fileBrowserHandle))
|
||||||
|
{
|
||||||
|
if (const char* const path = fileBrowserGetPath(fileBrowserHandle))
|
||||||
|
carla_set_custom_data(handle, 0, CUSTOM_DATA_TYPE_STRING, "file", path);
|
||||||
|
|
||||||
|
fileBrowserClose(fileBrowserHandle);
|
||||||
|
fileBrowserHandle = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
switch (fIdleState)
|
switch (fIdleState)
|
||||||
{
|
{
|
||||||
case kIdleInit:
|
case kIdleInit:
|
||||||
|
@ -1079,7 +1106,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
||||||
continue;
|
continue;
|
||||||
if (info->audioIns != 0 && info->audioIns != 2)
|
if (info->audioIns != 0 && info->audioIns != 2)
|
||||||
continue;
|
continue;
|
||||||
if (info->audioOuts != 0 && info->audioOuts != 2)
|
if (info->audioOuts > 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
j = fPluginCount;
|
j = fPluginCount;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue