Browse Source

extend expanders in carla and ildaeil to show active state

tags/22.02
falkTX 3 years ago
parent
commit
49c7d32727
3 changed files with 68 additions and 10 deletions
  1. +30
    -0
      plugins/Cardinal/src/Carla.cpp
  2. +5
    -3
      plugins/Cardinal/src/Expanders.cpp
  3. +33
    -7
      plugins/Cardinal/src/Ildaeil.cpp

+ 30
- 0
plugins/Cardinal/src/Carla.cpp View File

@@ -463,6 +463,7 @@ static intptr_t host_dispatcher(const NativeHostHandle handle, const NativeHostD
#ifndef HEADLESS #ifndef HEADLESS
struct CarlaModuleWidget : ModuleWidgetWith9HP, IdleCallback { struct CarlaModuleWidget : ModuleWidgetWith9HP, IdleCallback {
CarlaModule* const module; CarlaModule* const module;
bool hasLeftSideExpander = false;
bool idleCallbackActive = false; bool idleCallbackActive = false;
bool visible = false; bool visible = false;


@@ -578,6 +579,26 @@ struct CarlaModuleWidget : ModuleWidgetWith9HP, IdleCallback {
{ {
drawBackground(args.vg); drawBackground(args.vg);
drawOutputJacksArea(args.vg, CarlaModule::NUM_INPUTS); drawOutputJacksArea(args.vg, CarlaModule::NUM_INPUTS);

if (hasLeftSideExpander)
{
nvgBeginPath(args.vg);
nvgRect(args.vg, 1, 90 - 19, 18, 49 * 6 - 4);
nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, 0, 18, 0, nvgRGB(0xd0, 0xd0, 0xd0), nvgRGBA(0xd0, 0xd0, 0xd0, 0)));
nvgFill(args.vg);

for (int i=1; i<6; ++i)
{
const float y = 90 + 49 * i - 23;
const int col1 = 0x18 + static_cast<int>((y / box.size.y) * (0x21 - 0x18) + 0.5f);
const int col2 = 0x19 + static_cast<int>((y / box.size.y) * (0x22 - 0x19) + 0.5f);
nvgBeginPath(args.vg);
nvgRect(args.vg, 1, y, 18, 4);
nvgFillColor(args.vg, nvgRGB(col1, col2, col2));
nvgFill(args.vg);
}
}

setupTextLines(args.vg); setupTextLines(args.vg);


drawTextLine(args.vg, 0, "Audio 1"); drawTextLine(args.vg, 0, "Audio 1");
@@ -594,6 +615,15 @@ struct CarlaModuleWidget : ModuleWidgetWith9HP, IdleCallback {
ModuleWidgetWith9HP::draw(args); ModuleWidgetWith9HP::draw(args);
} }


void step() override
{
hasLeftSideExpander = module != nullptr
&& module->leftExpander.module != nullptr
&& module->leftExpander.module->model == modelExpanderInputMIDI;

ModuleWidgetWith9HP::step();
}

void showUI() void showUI()
{ {
visible = true; visible = true;


+ 5
- 3
plugins/Cardinal/src/Expanders.cpp View File

@@ -227,19 +227,21 @@ struct CardinalExpanderForInputMIDIWidget : ModuleWidgetWithSideScrews<> {
{ {
drawBackground(args.vg); drawBackground(args.vg);


nvgScissor(args.vg, startX, 0.0f, box.size.x - startX, box.size.y);
nvgFillColor(args.vg, nvgRGB(0xd0, 0xd0, 0xd0)); nvgFillColor(args.vg, nvgRGB(0xd0, 0xd0, 0xd0));


nvgSave(args.vg);
nvgIntersectScissor(args.vg, startX, 0.0f, box.size.x - startX - 1.0f, box.size.y);

for (int i=0; i<CardinalExpanderForInputMIDI::NUM_INPUTS; ++i) for (int i=0; i<CardinalExpanderForInputMIDI::NUM_INPUTS; ++i)
{ {
const float y = startY + i* padding;
const float y = startY + i * padding;


nvgBeginPath(args.vg); nvgBeginPath(args.vg);
nvgRoundedRect(args.vg, startX, y - 19.0f, box.size.x, padding - 4.0f, 4); nvgRoundedRect(args.vg, startX, y - 19.0f, box.size.x, padding - 4.0f, 4);
nvgFill(args.vg); nvgFill(args.vg);
} }


nvgResetScissor(args.vg);
nvgRestore(args.vg);


nvgBeginPath(args.vg); nvgBeginPath(args.vg);
nvgRoundedRect(args.vg, 6.5f, startY - 19.0f, 3.0f, padding * 6.0f - 4.0f, 1); nvgRoundedRect(args.vg, 6.5f, startY - 19.0f, 3.0f, padding * 6.0f - 4.0f, 1);


+ 33
- 7
plugins/Cardinal/src/Ildaeil.cpp View File

@@ -30,6 +30,7 @@


#ifndef HEADLESS #ifndef HEADLESS
# include "ImGuiWidget.hpp" # include "ImGuiWidget.hpp"
# include "ModuleWidgets.hpp"
# include "extra/FileBrowserDialog.hpp" # include "extra/FileBrowserDialog.hpp"
# include "extra/ScopedPointer.hpp" # include "extra/ScopedPointer.hpp"
# include "extra/Thread.hpp" # include "extra/Thread.hpp"
@@ -1519,7 +1520,8 @@ static void projectLoadedFromDSP(void* const ui)


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


struct IldaeilModuleWidget : ModuleWidget {
struct IldaeilModuleWidget : ModuleWidgetWithSideScrews<> {
bool hasLeftSideExpander = false;
IldaeilWidget* ildaeilWidget = nullptr; IldaeilWidget* ildaeilWidget = nullptr;


IldaeilModuleWidget(IldaeilModule* const module) IldaeilModuleWidget(IldaeilModule* const module)
@@ -1548,13 +1550,37 @@ struct IldaeilModuleWidget : ModuleWidget {


void draw(const DrawArgs& args) override void draw(const DrawArgs& args) override
{ {
nvgBeginPath(args.vg);
nvgRect(args.vg, 0, 0, box.size.x, box.size.y);
nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, 0, 0, box.size.y,
nvgRGB(0x18, 0x19, 0x19), nvgRGB(0x21, 0x22, 0x22)));
nvgFill(args.vg);
drawBackground(args.vg);

if (hasLeftSideExpander)
{
nvgBeginPath(args.vg);
nvgRect(args.vg, 1, 90 - 19, 18, 49 * 6 - 4);
nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, 0, 18, 0, nvgRGB(0xd0, 0xd0, 0xd0), nvgRGBA(0xd0, 0xd0, 0xd0, 0)));
nvgFill(args.vg);

for (int i=1; i<6; ++i)
{
const float y = 90 + 49 * i - 23;
const int col1 = 0x18 + static_cast<int>((y / box.size.y) * (0x21 - 0x18) + 0.5f);
const int col2 = 0x19 + static_cast<int>((y / box.size.y) * (0x22 - 0x19) + 0.5f);
nvgBeginPath(args.vg);
nvgRect(args.vg, 1, y, 18, 4);
nvgFillColor(args.vg, nvgRGB(col1, col2, col2));
nvgFill(args.vg);
}
}

ModuleWidgetWithSideScrews::draw(args);
}

void step() override
{
hasLeftSideExpander = module != nullptr
&& module->leftExpander.module != nullptr
&& module->leftExpander.module->model == modelExpanderInputMIDI;


ModuleWidget::draw(args);
ModuleWidgetWithSideScrews::step();
} }


DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(IldaeilModuleWidget) DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(IldaeilModuleWidget)


Loading…
Cancel
Save