Do not use custom FileBrowserDialog.hpp in Ildaeil and TextEditor

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-07-07 00:34:00 +01:00
parent 575fe6c8a1
commit 9802ea885e
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
2 changed files with 8 additions and 29 deletions

View file

@ -31,7 +31,6 @@
#ifndef HEADLESS #ifndef HEADLESS
# include "ImGuiWidget.hpp" # include "ImGuiWidget.hpp"
# include "ModuleWidgets.hpp" # include "ModuleWidgets.hpp"
# include "extra/FileBrowserDialog.hpp"
# include "extra/Mutex.hpp" # include "extra/Mutex.hpp"
# include "extra/Runner.hpp" # include "extra/Runner.hpp"
# include "extra/ScopedPointer.hpp" # include "extra/ScopedPointer.hpp"
@ -711,8 +710,6 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
String fPopupError; String fPopupError;
FileBrowserHandle fileBrowserHandle = nullptr;
bool idleCallbackActive = false; bool idleCallbackActive = false;
IldaeilModule* const module; IldaeilModule* const module;
@ -749,13 +746,8 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
if (module != nullptr && module->fCarlaHostHandle != nullptr) if (module != nullptr && 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);
@ -819,12 +811,15 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
DISTRHO_SAFE_ASSERT_RETURN(idleCallbackActive,); DISTRHO_SAFE_ASSERT_RETURN(idleCallbackActive,);
DISTRHO_SAFE_ASSERT_RETURN(fPluginType == PLUGIN_INTERNAL || fPluginType == PLUGIN_LV2,); DISTRHO_SAFE_ASSERT_RETURN(fPluginType == PLUGIN_INTERNAL || fPluginType == PLUGIN_LV2,);
const CardinalPluginContext* const pcontext = module->pcontext; const CarlaHostHandle handle = module->fCarlaHostHandle;
async_dialog_filebrowser(false, nullptr, nullptr, title, [handle](char* path)
{
if (path == nullptr)
return;
// FIXME isEmbed carla_set_custom_data(handle, 0, CUSTOM_DATA_TYPE_PATH, "file", path);
FileBrowserOptions opts; std::free(path);
opts.title = title; });
fileBrowserHandle = fileBrowserCreate(true, pcontext->nativeWindowId, pcontext->window->pixelRatio, opts);
} }
void createOrUpdatePluginGenericUI(const CarlaHostHandle handle) void createOrUpdatePluginGenericUI(const CarlaHostHandle handle)
@ -1030,12 +1025,6 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
{ {
idleCallbackActive = false; idleCallbackActive = false;
pcontext->removeIdleCallback(this); pcontext->removeIdleCallback(this);
if (fileBrowserHandle != nullptr)
{
fileBrowserClose(fileBrowserHandle);
fileBrowserHandle = nullptr;
}
} }
} }
} }
@ -1049,15 +1038,6 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
carla_juce_idle(); carla_juce_idle();
*/ */
if (fileBrowserHandle != nullptr && fileBrowserIdle(fileBrowserHandle))
{
if (const char* const path = fileBrowserGetPath(fileBrowserHandle))
carla_set_custom_data(handle, 0, CUSTOM_DATA_TYPE_PATH, "file", path);
fileBrowserClose(fileBrowserHandle);
fileBrowserHandle = nullptr;
}
if (fDrawingState == kDrawingPluginGenericUI && fPluginGenericUI != nullptr && fPluginHasOutputParameters) if (fDrawingState == kDrawingPluginGenericUI && fPluginGenericUI != nullptr && fPluginHasOutputParameters)
{ {
updatePluginGenericUI(handle); updatePluginGenericUI(handle);

View file

@ -19,7 +19,6 @@
#ifndef HEADLESS #ifndef HEADLESS
# include "ImGuiTextEditor.hpp" # include "ImGuiTextEditor.hpp"
# include "extra/FileBrowserDialog.hpp"
#endif #endif
#include <fstream> #include <fstream>