Browse Source

Get rid of the old DISTRHO_PLUGIN_WANT_STATEFILES

Signed-off-by: falkTX <falktx@falktx.com>
pull/375/head
parent
commit
485832aff3
8 changed files with 25 additions and 29 deletions
  1. +2
    -4
      distrho/DistrhoPlugin.hpp
  2. +1
    -3
      distrho/DistrhoUI.hpp
  3. +0
    -2
      distrho/src/DistrhoPlugin.cpp
  4. +9
    -9
      distrho/src/DistrhoPluginChecks.h
  5. +10
    -7
      distrho/src/DistrhoPluginLV2export.cpp
  6. +1
    -1
      distrho/src/DistrhoUI.cpp
  7. +2
    -2
      distrho/src/DistrhoUIPrivateData.hpp
  8. +0
    -1
      examples/FileHandling/DistrhoPluginInfo.h

+ 2
- 4
distrho/DistrhoPlugin.hpp View File

@@ -1096,12 +1096,10 @@ protected:
*/
virtual void initState(uint32_t index, State& state);

DISTRHO_DEPRECATED_BY("getStateHints(uint32_t,State&)")
DISTRHO_DEPRECATED_BY("initState(uint32_t,State&)")
virtual void initState(uint32_t, String&, String&) {}
#endif

#if DISTRHO_PLUGIN_WANT_STATEFILES
DISTRHO_DEPRECATED_BY("getStateHints")
DISTRHO_DEPRECATED_BY("initState(uint32_t,State&)")
virtual bool isStateFile(uint32_t) { return false; }
#endif



+ 1
- 3
distrho/DistrhoUI.hpp View File

@@ -164,9 +164,7 @@ public:
@TODO Document this.
*/
void setState(const char* key, const char* value);
#endif

#if DISTRHO_PLUGIN_WANT_STATEFILES
/**
Request a new file from the host, matching the properties of a state key.@n
This will use the native host file browser if available, otherwise a DPF built-in file browser is used.@n
@@ -327,7 +325,7 @@ protected:
This action happens after the user confirms the action, so the file browser dialog will be closed at this point.
The default implementation does nothing.

If you need to use files as plugin state, please setup and use DISTRHO_PLUGIN_WANT_STATEFILES instead.
If you need to use files as plugin state, please setup and use states with kStateIsFilenamePath instead.
*/
virtual void uiFileBrowserSelected(const char* filename);
#endif


+ 0
- 2
distrho/src/DistrhoPlugin.cpp View File

@@ -197,10 +197,8 @@ void Plugin::initState(const uint32_t index, State& state)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
initState(index, stateKey, defaultStateValue);
#if DISTRHO_PLUGIN_WANT_STATEFILES
if (isStateFile(index))
hints = kStateIsFilenamePath;
#endif
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))


+ 9
- 9
distrho/src/DistrhoPluginChecks.h View File

@@ -81,10 +81,6 @@
# define DISTRHO_PLUGIN_WANT_STATE 0
#endif

#ifndef DISTRHO_PLUGIN_WANT_STATEFILES
# define DISTRHO_PLUGIN_WANT_STATEFILES 0
#endif

#ifndef DISTRHO_PLUGIN_WANT_FULL_STATE
# define DISTRHO_PLUGIN_WANT_FULL_STATE 0
# define DISTRHO_PLUGIN_WANT_FULL_STATE_WAS_NOT_SET
@@ -137,11 +133,15 @@
#endif

// -----------------------------------------------------------------------
// Enable state if plugin wants state files

#if DISTRHO_PLUGIN_WANT_STATEFILES && ! DISTRHO_PLUGIN_WANT_STATE
# undef DISTRHO_PLUGIN_WANT_STATE
# define DISTRHO_PLUGIN_WANT_STATE 1
// Enable state if plugin wants state files (deprecated)

#ifdef DISTRHO_PLUGIN_WANT_STATEFILES
# warning DISTRHO_PLUGIN_WANT_STATEFILES is deprecated
# undef DISTRHO_PLUGIN_WANT_STATEFILES
# if ! DISTRHO_PLUGIN_WANT_STATE
# undef DISTRHO_PLUGIN_WANT_STATE
# define DISTRHO_PLUGIN_WANT_STATE 1
# endif
#endif

// -----------------------------------------------------------------------


+ 10
- 7
distrho/src/DistrhoPluginLV2export.cpp View File

@@ -641,8 +641,9 @@ void lv2_generate_ttl(const char* const basename)
# if DISTRHO_PLUGIN_WANT_MIDI_INPUT
pluginString += " atom:supports midi:MidiEvent ;\n";
# endif
# if DISTRHO_PLUGIN_WANT_STATEFILES
pluginString += " atom:supports <" LV2_PATCH__Message "> ;\n";
# if DISTRHO_PLUGIN_WANT_STATE
if (hasHostVisibleState)
pluginString += " atom:supports <" LV2_PATCH__Message "> ;\n";
# endif
# if DISTRHO_PLUGIN_WANT_TIMEPOS
pluginString += " atom:supports <" LV2_TIME__Position "> ;\n";
@@ -665,8 +666,9 @@ void lv2_generate_ttl(const char* const basename)
# if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
pluginString += " atom:supports midi:MidiEvent ;\n";
# endif
# if DISTRHO_PLUGIN_WANT_STATEFILES
pluginString += " atom:supports <" LV2_PATCH__Message "> ;\n";
# if DISTRHO_PLUGIN_WANT_STATE
if (hasHostVisibleState)
pluginString += " atom:supports <" LV2_PATCH__Message "> ;\n";
# endif
pluginString += " ] ;\n\n";
++portIndex;
@@ -1262,10 +1264,11 @@ void lv2_generate_ttl(const char* const basename)
# if DISTRHO_PLUGIN_WANT_FULL_STATE
for (uint32_t i=0; i<numStates; ++i)
{
# if DISTRHO_PLUGIN_WANT_STATEFILES
if (plugin.isStateFile(i))
if (plugin.getStateHints(i) & kStateIsHostReadable)
continue;
# endif

// readable states are defined as lv2 parameters.
// non-readable states have no definition, but one is needed for presets and ttl validation.
presetString = "<" DISTRHO_PLUGIN_LV2_STATE_PREFIX + plugin.getStateKey(i) + ">\n";
presetString += " a owl:DatatypeProperty ;\n";
presetString += " rdfs:label \"Plugin state key-value string pair\" ;\n";


+ 1
- 1
distrho/src/DistrhoUI.cpp View File

@@ -264,7 +264,7 @@ void UI::setState(const char* key, const char* value)
}
#endif

#if DISTRHO_PLUGIN_WANT_STATEFILES
#if DISTRHO_PLUGIN_WANT_STATE
bool UI::requestStateFile(const char* key)
{
return uiData->fileRequestCallback(key);


+ 2
- 2
distrho/src/DistrhoUIPrivateData.hpp View File

@@ -441,7 +441,7 @@ inline bool UI::PrivateData::fileRequestCallback(const char* const key)
if (fileRequestCallbackFunc != nullptr)
return fileRequestCallbackFunc(callbacksPtr, key);

#if DISTRHO_PLUGIN_WANT_STATEFILES && !DISTRHO_PLUGIN_HAS_EXTERNAL_UI && !defined(DGL_FILE_BROWSER_DISABLED)
#if DISTRHO_PLUGIN_WANT_STATE && !DISTRHO_PLUGIN_HAS_EXTERNAL_UI && !defined(DGL_FILE_BROWSER_DISABLED)
std::free(uiStateFileKeyRequest);
uiStateFileKeyRequest = strdup(key);
DISTRHO_SAFE_ASSERT_RETURN(uiStateFileKeyRequest != nullptr, false);
@@ -473,7 +473,7 @@ inline void PluginWindow::onFileSelected(const char* const filename)
if (initializing)
return;

# if DISTRHO_PLUGIN_WANT_STATEFILES
# if DISTRHO_PLUGIN_WANT_STATE
if (char* const key = ui->uiData->uiStateFileKeyRequest)
{
ui->uiData->uiStateFileKeyRequest = nullptr;


+ 0
- 1
examples/FileHandling/DistrhoPluginInfo.h View File

@@ -26,7 +26,6 @@
#define DISTRHO_PLUGIN_NUM_INPUTS 1
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1
#define DISTRHO_PLUGIN_WANT_STATE 1
#define DISTRHO_PLUGIN_WANT_STATEFILES 1
#define DISTRHO_UI_USER_RESIZABLE 1
#define DISTRHO_UI_USE_NANOVG 1



Loading…
Cancel
Save