Browse Source

Implement lv2ui background/foreground color

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc2
falkTX 4 years ago
parent
commit
12318879c6
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
13 changed files with 204 additions and 62 deletions
  1. +20
    -10
      source/backend/CarlaBackend.h
  2. +2
    -0
      source/backend/CarlaEngine.hpp
  3. +10
    -0
      source/backend/CarlaStandalone.cpp
  4. +8
    -0
      source/backend/engine/CarlaEngine.cpp
  5. +2
    -0
      source/backend/engine/CarlaEngineData.cpp
  6. +55
    -6
      source/backend/plugin/CarlaPluginLV2.cpp
  7. +12
    -16
      source/bridges-ui/CarlaBridgeFormat.cpp
  8. +12
    -3
      source/bridges-ui/CarlaBridgeFormat.hpp
  9. +48
    -16
      source/bridges-ui/CarlaBridgeFormatLV2.cpp
  10. +16
    -10
      source/frontend/carla_backend.py
  11. +13
    -1
      source/frontend/carla_host.py
  12. +2
    -0
      source/includes/lv2/ui.h
  13. +4
    -0
      source/utils/CarlaBackendUtils.hpp

+ 20
- 10
source/backend/CarlaBackend.h View File

@@ -1357,51 +1357,61 @@ typedef enum {
ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 22,

/*!
* Set UI scaling used in frontend, so backend can do the same for plugin UIs.
* Set background color used in the frontend, so backend can do the same for plugin UIs.
*/
ENGINE_OPTION_FRONTEND_UI_SCALE = 23,
ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR = 23,

/*!
* Set foreground color used in the frontend, so backend can do the same for plugin UIs.
*/
ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR = 24,

/*!
* Set UI scaling used in the frontend, so backend can do the same for plugin UIs.
*/
ENGINE_OPTION_FRONTEND_UI_SCALE = 25,

/*!
* Set frontend winId, used to define as parent window for plugin UIs.
*/
ENGINE_OPTION_FRONTEND_WIN_ID = 24,
ENGINE_OPTION_FRONTEND_WIN_ID = 26,

#if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
/*!
* Set path to wine executable.
*/
ENGINE_OPTION_WINE_EXECUTABLE = 25,
ENGINE_OPTION_WINE_EXECUTABLE = 27,

/*!
* Enable automatic wineprefix detection.
*/
ENGINE_OPTION_WINE_AUTO_PREFIX = 26,
ENGINE_OPTION_WINE_AUTO_PREFIX = 28,

/*!
* Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
*/
ENGINE_OPTION_WINE_FALLBACK_PREFIX = 27,
ENGINE_OPTION_WINE_FALLBACK_PREFIX = 29,

/*!
* Enable realtime priority for Wine application and server threads.
*/
ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 28,
ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 30,

/*!
* Base realtime priority for Wine threads.
*/
ENGINE_OPTION_WINE_BASE_RT_PRIO = 29,
ENGINE_OPTION_WINE_BASE_RT_PRIO = 31,

/*!
* Wine server realtime priority.
*/
ENGINE_OPTION_WINE_SERVER_RT_PRIO = 30,
ENGINE_OPTION_WINE_SERVER_RT_PRIO = 32,
#endif

/*!
* Capture console output into debug callbacks.
*/
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 31
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33

} EngineOption;



+ 2
- 0
source/backend/CarlaEngine.hpp View File

@@ -239,6 +239,8 @@ struct CARLA_API EngineOptions {
bool preferPluginBridges;
bool preferUiBridges;
bool uisAlwaysOnTop;
uint bgColor;
uint fgColor;
float uiScale;

uint maxParameters;


+ 10
- 0
source/backend/CarlaStandalone.cpp View File

@@ -312,6 +312,8 @@ static void carla_engine_init_common(CarlaEngine* const engine)

engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, gStandalone.engineOptions.preventBadBehaviour ? 1 : 0, nullptr);

engine->setOption(CB::ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR, static_cast<int>(gStandalone.engineOptions.bgColor), nullptr);
engine->setOption(CB::ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR, static_cast<int>(gStandalone.engineOptions.fgColor), nullptr);
engine->setOption(CB::ENGINE_OPTION_FRONTEND_UI_SCALE, static_cast<int>(gStandalone.engineOptions.uiScale * 1000.0f), nullptr);

if (gStandalone.engineOptions.frontendWinId != 0)
@@ -848,6 +850,14 @@ void carla_set_engine_option(EngineOption option, int value, const char* valueSt
gStandalone.engineOptions.preventBadBehaviour = (value != 0);
break;

case CB::ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR:
gStandalone.engineOptions.bgColor = static_cast<uint>(value);
break;

case CB::ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR:
gStandalone.engineOptions.fgColor = static_cast<uint>(value);
break;

case CB::ENGINE_OPTION_FRONTEND_UI_SCALE:
CARLA_SAFE_ASSERT_RETURN(value > 0,);
gStandalone.engineOptions.uiScale = static_cast<float>(value) / 1000;


+ 8
- 0
source/backend/engine/CarlaEngine.cpp View File

@@ -1901,6 +1901,14 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
#endif
} break;

case ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR:
pData->options.bgColor = static_cast<uint>(value);
break;

case ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR:
pData->options.fgColor = static_cast<uint>(value);
break;

case ENGINE_OPTION_FRONTEND_UI_SCALE:
CARLA_SAFE_ASSERT_RETURN(value > 0,);
pData->options.uiScale = static_cast<float>(value) / 1000;


+ 2
- 0
source/backend/engine/CarlaEngineData.cpp View File

@@ -192,6 +192,8 @@ EngineOptions::EngineOptions() noexcept
preferUiBridges(true),
#endif
uisAlwaysOnTop(true),
bgColor(0x000000ff),
fgColor(0xffffffff),
uiScale(1.0f),
maxParameters(MAX_DEFAULT_PARAMETERS),
uiBridgesTimeout(4000),


+ 55
- 6
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -132,11 +132,16 @@ enum CarlaLv2URIDs {
kUridTimeTicksPerBeat,
kUridMidiEvent,
kUridParamSampleRate,
// ui stuff
kUridBackgroundColor,
kUridForegroundColor,
kUridScaleFactor,
kUridWindowTitle,
// custom carla props
kUridCarlaAtomWorkerIn,
kUridCarlaAtomWorkerResp,
kUridCarlaTransientWindowId,
// count
kUridCount
};

@@ -316,6 +321,8 @@ struct CarlaPluginLV2Options {
SequenceSize,
SampleRate,
TransientWinId,
BackgroundColor,
ForegroundColor,
ScaleFactor,
WindowTitle,
Null,
@@ -328,6 +335,8 @@ struct CarlaPluginLV2Options {
int sequenceSize;
float sampleRate;
int64_t transientWinId;
uint32_t bgColor;
uint32_t fgColor;
float uiScale;
const char* windowTitle;
LV2_Options_Option opts[Count];
@@ -339,6 +348,8 @@ struct CarlaPluginLV2Options {
sequenceSize(MAX_DEFAULT_BUFFER_SIZE),
sampleRate(0.0),
transientWinId(0),
bgColor(0x000000ff),
fgColor(0xffffffff),
uiScale(1.0f),
windowTitle(nullptr)
{
@@ -374,6 +385,22 @@ struct CarlaPluginLV2Options {
optSequenceSize.type = kUridAtomInt;
optSequenceSize.value = &sequenceSize;

LV2_Options_Option& optBackgroundColor(opts[BackgroundColor]);
optBackgroundColor.context = LV2_OPTIONS_INSTANCE;
optBackgroundColor.subject = 0;
optBackgroundColor.key = kUridBackgroundColor;
optBackgroundColor.size = sizeof(int32_t);
optBackgroundColor.type = kUridAtomInt;
optBackgroundColor.value = &bgColor;

LV2_Options_Option& optForegroundColor(opts[ForegroundColor]);
optForegroundColor.context = LV2_OPTIONS_INSTANCE;
optForegroundColor.subject = 0;
optForegroundColor.key = kUridForegroundColor;
optForegroundColor.size = sizeof(int32_t);
optForegroundColor.type = kUridAtomInt;
optForegroundColor.value = &fgColor;

LV2_Options_Option& optScaleFactor(opts[ScaleFactor]);
optScaleFactor.context = LV2_OPTIONS_INSTANCE;
optScaleFactor.subject = 0;
@@ -1576,11 +1603,21 @@ public:
if (! fPipeServer.writeMessage("uiOptions\n", 10))
return;

const EngineOptions& opts(pData->engine->getOptions());

std::snprintf(tmpBuf, 0xff, "%g\n", pData->engine->getSampleRate());
if (! fPipeServer.writeMessage(tmpBuf))
return;

std::snprintf(tmpBuf, 0xff, "%.12g\n", static_cast<double>(pData->engine->getOptions().uiScale));
std::snprintf(tmpBuf, 0xff, "%u\n", opts.bgColor);
if (! fPipeServer.writeMessage(tmpBuf))
return;

std::snprintf(tmpBuf, 0xff, "%u\n", opts.fgColor);
if (! fPipeServer.writeMessage(tmpBuf))
return;

std::snprintf(tmpBuf, 0xff, "%.12g\n", static_cast<double>(opts.uiScale));
if (! fPipeServer.writeMessage(tmpBuf))
return;

@@ -5541,13 +5578,15 @@ public:
return false;
}

const EngineOptions& opts(pData->engine->getOptions());

// ---------------------------------------------------------------
// Init LV2 World if needed, sets LV2_PATH for lilv

Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());

if (pData->engine->getOptions().pathLV2 != nullptr && pData->engine->getOptions().pathLV2[0] != '\0')
lv2World.initIfNeeded(pData->engine->getOptions().pathLV2);
if (opts.pathLV2 != nullptr && opts.pathLV2[0] != '\0')
lv2World.initIfNeeded(opts.pathLV2);
else if (const char* const LV2_PATH = std::getenv("LV2_PATH"))
lv2World.initIfNeeded(LV2_PATH);
else
@@ -5725,7 +5764,7 @@ public:
fLv2Options.maxBufferSize = bufferSize;
fLv2Options.nominalBufferSize = bufferSize;
fLv2Options.sampleRate = static_cast<float>(pData->engine->getSampleRate());
fLv2Options.transientWinId = static_cast<int64_t>(pData->engine->getOptions().frontendWinId);
fLv2Options.transientWinId = static_cast<int64_t>(opts.frontendWinId);

uint32_t eventBufferSize = MAX_DEFAULT_BUFFER_SIZE;

@@ -5742,7 +5781,9 @@ public:

fLv2Options.sequenceSize = static_cast<int>(eventBufferSize);

fLv2Options.uiScale = pData->engine->getOptions().uiScale;
fLv2Options.bgColor = opts.bgColor;
fLv2Options.fgColor = opts.fgColor;
fLv2Options.uiScale = opts.uiScale;

// ---------------------------------------------------------------
// initialize features (part 1)
@@ -5903,7 +5944,7 @@ public:
else if (options & PLUGIN_OPTION_FIXED_BUFFERS)
pData->options |= PLUGIN_OPTION_FIXED_BUFFERS;

if (pData->engine->getOptions().forceStereo)
if (opts.forceStereo)
pData->options |= PLUGIN_OPTION_FORCE_STEREO;
else if (options & PLUGIN_OPTION_FORCE_STEREO)
pData->options |= PLUGIN_OPTION_FORCE_STEREO;
@@ -6816,6 +6857,10 @@ private:
return kUridMidiEvent;
if (std::strcmp(uri, LV2_PARAMETERS__sampleRate) == 0)
return kUridParamSampleRate;
if (std::strcmp(uri, LV2_UI__backgroundColor) == 0)
return kUridBackgroundColor;
if (std::strcmp(uri, LV2_UI__foregroundColor) == 0)
return kUridForegroundColor;
if (std::strcmp(uri, LV2_UI__scaleFactor) == 0)
return kUridScaleFactor;
if (std::strcmp(uri, LV2_UI__windowTitle) == 0)
@@ -6946,6 +6991,10 @@ private:
return LV2_MIDI__MidiEvent;
case kUridParamSampleRate:
return LV2_PARAMETERS__sampleRate;
case kUridBackgroundColor:
return LV2_UI__backgroundColor;
case kUridForegroundColor:
return LV2_UI__foregroundColor;
case kUridScaleFactor:
return LV2_UI__scaleFactor;
case kUridWindowTitle:


+ 12
- 16
source/bridges-ui/CarlaBridgeFormat.cpp View File

@@ -226,25 +226,21 @@ bool CarlaBridgeFormat::msgReceived(const char* const msg) noexcept

if (std::strcmp(msg, "uiOptions") == 0)
{
double sampleRate;
bool useTheme, useThemeColors;
float uiScale;
const char* windowTitle;
uint64_t transientWindowId;

CARLA_SAFE_ASSERT_RETURN(readNextLineAsDouble(sampleRate), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsFloat(uiScale), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(useTheme), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(useThemeColors), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(windowTitle), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsULong(transientWindowId), true);
BridgeFormatOptions opts;

CARLA_SAFE_ASSERT_RETURN(readNextLineAsDouble(opts.sampleRate), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(opts.bgColor), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsUInt(opts.fgColor), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsFloat(opts.uiScale), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(opts.useTheme), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(opts.useThemeColors), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsString(opts.windowTitle), true);
CARLA_SAFE_ASSERT_RETURN(readNextLineAsULong(opts.transientWindowId), true);

fGotOptions = true;
uiOptionsChanged(sampleRate, uiScale,
useTheme, useThemeColors,
windowTitle, static_cast<uintptr_t>(transientWindowId));
uiOptionsChanged(opts);

delete[] windowTitle;
delete[] opts.windowTitle;
return true;
}



+ 12
- 3
source/bridges-ui/CarlaBridgeFormat.hpp View File

@@ -69,9 +69,18 @@ protected:
virtual void dspAtomReceived(const uint32_t index, const LV2_Atom* const atom) = 0;
virtual void dspURIDReceived(const LV2_URID urid, const char* const uri) = 0;

virtual void uiOptionsChanged(const double sampleRate, const float uiScale,
const bool useTheme, const bool useThemeColors,
const char* const windowTitle, const uintptr_t transientWindowId) = 0;
struct BridgeFormatOptions {
double sampleRate;
uint32_t bgColor;
uint32_t fgColor;
float uiScale;
bool useTheme;
bool useThemeColors;
const char* windowTitle;
uintptr_t transientWindowId;
};

virtual void uiOptionsChanged(const BridgeFormatOptions& opts) = 0;

public:
// ---------------------------------------------------------------------


+ 48
- 16
source/bridges-ui/CarlaBridgeFormatLV2.cpp View File

@@ -93,11 +93,16 @@ enum CarlaLv2URIDs {
kUridTimeTicksPerBeat,
kUridMidiEvent,
kUridParamSampleRate,
// ui stuff
kUridBackgroundColor,
kUridForegroundColor,
kUridScaleFactor,
kUridWindowTitle,
// custom carla props
kUridCarlaAtomWorkerIn,
kUridCarlaAtomWorkerResp,
kUridCarlaTransientWindowId,
// count
kUridCount
};

@@ -131,6 +136,8 @@ struct Lv2PluginOptions {
enum OptIndex {
SampleRate,
TransientWinId,
BackgroundColor,
ForegroundColor,
ScaleFactor,
WindowTitle,
Null,
@@ -139,12 +146,16 @@ struct Lv2PluginOptions {

float sampleRate;
int64_t transientWinId;
uint32_t bgColor;
uint32_t fgColor;
float uiScale;
LV2_Options_Option opts[Count];

Lv2PluginOptions() noexcept
: sampleRate(static_cast<float>(gInitialSampleRate)),
transientWinId(0),
bgColor(0x000000ff),
fgColor(0xffffffff),
uiScale(1.0f)
{
LV2_Options_Option& optSampleRate(opts[SampleRate]);
@@ -155,6 +166,22 @@ struct Lv2PluginOptions {
optSampleRate.type = kUridAtomFloat;
optSampleRate.value = &sampleRate;

LV2_Options_Option& optBackgroundColor(opts[BackgroundColor]);
optBackgroundColor.context = LV2_OPTIONS_INSTANCE;
optBackgroundColor.subject = 0;
optBackgroundColor.key = kUridBackgroundColor;
optBackgroundColor.size = sizeof(int32_t);
optBackgroundColor.type = kUridAtomInt;
optBackgroundColor.value = &bgColor;

LV2_Options_Option& optForegroundColor(opts[ForegroundColor]);
optForegroundColor.context = LV2_OPTIONS_INSTANCE;
optForegroundColor.subject = 0;
optForegroundColor.key = kUridForegroundColor;
optForegroundColor.size = sizeof(int32_t);
optForegroundColor.type = kUridAtomInt;
optForegroundColor.value = &fgColor;

LV2_Options_Option& optScaleFactor(opts[ScaleFactor]);
optScaleFactor.context = LV2_OPTIONS_INSTANCE;
optScaleFactor.subject = 0;
@@ -598,19 +625,14 @@ public:
fCustomURIDs.push_back(uri);
}

void uiOptionsChanged(const double sampleRate, const float uiScale,
const bool useTheme, const bool useThemeColors,
const char* const windowTitle, const uintptr_t transientWindowId) override
void uiOptionsChanged(const BridgeFormatOptions& opts) override
{
carla_debug("CarlaLv2Client::uiOptionsChanged(%f, %f, %s, %s, \"%s\", " P_UINTPTR ")",
sampleRate, static_cast<double>(uiScale),
bool2str(useTheme), bool2str(useThemeColors),
windowTitle, transientWindowId);
carla_debug("CarlaLv2Client::uiOptionsChanged()");

// ------------------------------------------------------------------------------------------------------------
// sample rate

const float sampleRatef = static_cast<float>(sampleRate);
const float sampleRatef = static_cast<float>(opts.sampleRate);

if (carla_isNotEqual(fLv2Options.sampleRate, sampleRatef))
{
@@ -634,15 +656,17 @@ public:
}

// ------------------------------------------------------------------------------------------------------------
// ui scale
// ui colors and scale

fLv2Options.uiScale = uiScale;
fLv2Options.bgColor = opts.bgColor;
fLv2Options.fgColor = opts.fgColor;
fLv2Options.uiScale = opts.uiScale;

// ------------------------------------------------------------------------------------------------------------
// window title

if (windowTitle != nullptr)
fUiOptions.windowTitle = windowTitle;
if (opts.windowTitle != nullptr)
fUiOptions.windowTitle = opts.windowTitle;
else
fUiOptions.windowTitle.clear();

@@ -652,14 +676,14 @@ public:
// ------------------------------------------------------------------------------------------------------------
// transient win id

fLv2Options.transientWinId = static_cast<int64_t>(transientWindowId);
fUiOptions.transientWindowId = transientWindowId;
fLv2Options.transientWinId = static_cast<int64_t>(opts.transientWindowId);
fUiOptions.transientWindowId = opts.transientWindowId;

// ------------------------------------------------------------------------------------------------------------
// other

fUiOptions.useTheme = useTheme;
fUiOptions.useThemeColors = useThemeColors;
fUiOptions.useTheme = opts.useTheme;
fUiOptions.useThemeColors = opts.useThemeColors;
}

void uiResized(const uint width, const uint height) override
@@ -1060,6 +1084,10 @@ private:
return kUridMidiEvent;
if (std::strcmp(uri, LV2_PARAMETERS__sampleRate) == 0)
return kUridParamSampleRate;
if (std::strcmp(uri, LV2_UI__backgroundColor) == 0)
return kUridBackgroundColor;
if (std::strcmp(uri, LV2_UI__foregroundColor) == 0)
return kUridForegroundColor;
if (std::strcmp(uri, LV2_UI__scaleFactor) == 0)
return kUridScaleFactor;
if (std::strcmp(uri, LV2_UI__windowTitle) == 0)
@@ -1190,6 +1218,10 @@ private:
return LV2_MIDI__MidiEvent;
case kUridParamSampleRate:
return LV2_PARAMETERS__sampleRate;
case kUridBackgroundColor:
return LV2_UI__backgroundColor;
case kUridForegroundColor:
return LV2_UI__foregroundColor;
case kUridScaleFactor:
return LV2_UI__scaleFactor;
case kUridWindowTitle:


+ 16
- 10
source/frontend/carla_backend.py View File

@@ -959,32 +959,38 @@ ENGINE_OPTION_PATH_RESOURCES = 21
# @note: Linux only
ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 22

# Set UI scaling used in frontend, so backend can do the same for plugin UIs.
ENGINE_OPTION_FRONTEND_UI_SCALE = 23
# Set background color used in the frontend, so backend can do the same for plugin UIs.
ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR = 23

# Set foreground color used in the frontend, so backend can do the same for plugin UIs.
ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR = 24

# Set UI scaling used in the frontend, so backend can do the same for plugin UIs.
ENGINE_OPTION_FRONTEND_UI_SCALE = 25

# Set frontend winId, used to define as parent window for plugin UIs.
ENGINE_OPTION_FRONTEND_WIN_ID = 24
ENGINE_OPTION_FRONTEND_WIN_ID = 26

# Set path to wine executable.
ENGINE_OPTION_WINE_EXECUTABLE = 25
ENGINE_OPTION_WINE_EXECUTABLE = 27

# Enable automatic wineprefix detection.
ENGINE_OPTION_WINE_AUTO_PREFIX = 26
ENGINE_OPTION_WINE_AUTO_PREFIX = 28

# Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
ENGINE_OPTION_WINE_FALLBACK_PREFIX = 27
ENGINE_OPTION_WINE_FALLBACK_PREFIX = 29

# Enable realtime priority for Wine application and server threads.
ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 28
ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 30

# Base realtime priority for Wine threads.
ENGINE_OPTION_WINE_BASE_RT_PRIO = 29
ENGINE_OPTION_WINE_BASE_RT_PRIO = 31

# Wine server realtime priority.
ENGINE_OPTION_WINE_SERVER_RT_PRIO = 30
ENGINE_OPTION_WINE_SERVER_RT_PRIO = 32

# Capture console output into debug callbacks
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 31
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33

# ------------------------------------------------------------------------------------------------------------
# Engine Process Mode


+ 13
- 1
source/frontend/carla_host.py View File

@@ -2542,7 +2542,9 @@ class HostWindow(QMainWindow):
else:
value_fix = 1.5

bg_color = self.ui.rack.palette().window().color()
rack_pal = self.ui.rack.palette()
bg_color = rack_pal.window().color()
fg_color = rack_pal.text().color()
bg_value = 1.0 - bg_color.blackF()
if bg_value != 0.0 and bg_value < min_value:
pad_color = bg_color.lighter(100*min_value/bg_value*value_fix)
@@ -2574,6 +2576,16 @@ class HostWindow(QMainWindow):
self.ui.pad_right.setPalette(self.imgR_palette)
self.ui.pad_right.setAutoFillBackground(True)

# qt's rgba is actually argb, so convert that
bg_color_value = bg_color.rgba()
bg_color_value = ((bg_color_value & 0xffffff) << 8) | (bg_color_value >> 24)

fg_color_value = fg_color.rgba()
fg_color_value = ((fg_color_value & 0xffffff) << 8) | (fg_color_value >> 24)

self.host.set_engine_option(ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR, bg_color_value, "")
self.host.set_engine_option(ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR, fg_color_value, "")

# --------------------------------------------------------------------------------------------------------
# paint event



+ 2
- 0
source/includes/lv2/ui.h View File

@@ -45,8 +45,10 @@
#define LV2_UI__UI LV2_UI_PREFIX "UI" ///< http://lv2plug.in/ns/extensions/ui#UI
#define LV2_UI__WindowsUI LV2_UI_PREFIX "WindowsUI" ///< http://lv2plug.in/ns/extensions/ui#WindowsUI
#define LV2_UI__X11UI LV2_UI_PREFIX "X11UI" ///< http://lv2plug.in/ns/extensions/ui#X11UI
#define LV2_UI__backgroundColor LV2_UI_PREFIX "backgroundColor" ///< http://lv2plug.in/ns/extensions/ui#backgroundColor
#define LV2_UI__binary LV2_UI_PREFIX "binary" ///< http://lv2plug.in/ns/extensions/ui#binary
#define LV2_UI__fixedSize LV2_UI_PREFIX "fixedSize" ///< http://lv2plug.in/ns/extensions/ui#fixedSize
#define LV2_UI__foregroundColor LV2_UI_PREFIX "foregroundColor" ///< http://lv2plug.in/ns/extensions/ui#foregroundColor
#define LV2_UI__idleInterface LV2_UI_PREFIX "idleInterface" ///< http://lv2plug.in/ns/extensions/ui#idleInterface
#define LV2_UI__noUserResize LV2_UI_PREFIX "noUserResize" ///< http://lv2plug.in/ns/extensions/ui#noUserResize
#define LV2_UI__notifyType LV2_UI_PREFIX "notifyType" ///< http://lv2plug.in/ns/extensions/ui#notifyType


+ 4
- 0
source/utils/CarlaBackendUtils.hpp View File

@@ -372,6 +372,10 @@ const char* EngineOption2Str(const EngineOption option) noexcept
return "ENGINE_OPTION_PATH_RESOURCES";
case ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR:
return "ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR";
case ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR:
return "ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR";
case ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR:
return "ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR";
case ENGINE_OPTION_FRONTEND_UI_SCALE:
return "ENGINE_OPTION_FRONTEND_UI_SCALE";
case ENGINE_OPTION_FRONTEND_WIN_ID:


Loading…
Cancel
Save