More light panel things

This commit is contained in:
falkTX 2022-07-19 21:00:22 +01:00
parent 8cec74e966
commit ca1ac162ff
5 changed files with 18 additions and 36 deletions

2
carla

@ -1 +1 @@
Subproject commit f8d7d9afcea4c01aaf502b5af884dde31dfb28a7 Subproject commit 9e2defbba8a36e840b4bbb9f322f9a3debc388d8

View file

@ -1,6 +1,6 @@
/* /*
* DISTRHO Cardinal Plugin * DISTRHO Cardinal Plugin
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@ -16,6 +16,7 @@
*/ */
#include "plugin.hpp" #include "plugin.hpp"
#include "ModuleWidgets.hpp"
struct CardinalBlankModule : Module { struct CardinalBlankModule : Module {
enum ParamIds { enum ParamIds {
@ -77,15 +78,12 @@ struct CardinalBlankImage : Widget {
} }
}; };
struct CardinalBlankWidget : ModuleWidget { struct CardinalBlankWidget : ModuleWidgetWith9HP {
CardinalBlankWidget(CardinalBlankModule* const module) { CardinalBlankWidget(CardinalBlankModule* const module) {
setModule(module); setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Blank.svg"))); setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Blank.svg")));
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, 0))); createAndAddScrews();
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
FramebufferWidget* const fbWidget = new FramebufferWidget; FramebufferWidget* const fbWidget = new FramebufferWidget;
fbWidget->oversample = 2.0; fbWidget->oversample = 2.0;
@ -95,13 +93,8 @@ struct CardinalBlankWidget : ModuleWidget {
void draw(const DrawArgs& args) override void draw(const DrawArgs& args) override
{ {
nvgBeginPath(args.vg); drawBackground(args.vg);
nvgRect(args.vg, 0, 0, box.size.x, box.size.y); ModuleWidgetWith9HP::draw(args);
nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, 0, 0, box.size.y,
nvgRGB(0x18, 0x19, 0x19), nvgRGB(0x21, 0x22, 0x22)));
nvgFill(args.vg);
ModuleWidget::draw(args);
} }
}; };

View file

@ -26,6 +26,7 @@
*/ */
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp"
#include "Widgets.hpp" #include "Widgets.hpp"
#include <algorithm> #include <algorithm>
@ -707,7 +708,7 @@ struct CCGridDisplay : Widget {
} }
}; };
struct HostMIDICCWidget : ModuleWidget { struct HostMIDICCWidget : ModuleWidgetWith14HP {
static constexpr const float startX_In = 14.0f; static constexpr const float startX_In = 14.0f;
static constexpr const float startX_Out = 115.0f; static constexpr const float startX_Out = 115.0f;
static constexpr const float startY = 190.0f; static constexpr const float startY = 190.0f;
@ -721,10 +722,7 @@ struct HostMIDICCWidget : ModuleWidget {
setModule(m); setModule(m);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDICC.svg"))); setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDICC.svg")));
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, 0))); createAndAddScrews();
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
for (int i=0; i<18; ++i) for (int i=0; i<18; ++i)
{ {
@ -748,18 +746,14 @@ struct HostMIDICCWidget : ModuleWidget {
void draw(const DrawArgs& args) override void draw(const DrawArgs& args) override
{ {
nvgBeginPath(args.vg); drawBackground(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);
nvgBeginPath(args.vg); nvgBeginPath(args.vg);
nvgRoundedRect(args.vg, startX_Out - 2.5f, startY - 2.0f, padding * 3, padding * 6, 4); nvgRoundedRect(args.vg, startX_Out - 2.5f, startY - 2.0f, padding * 3, padding * 6, 4);
nvgFillColor(args.vg, nvgRGB(0xd0, 0xd0, 0xd0)); nvgFillColor(args.vg, nvgRGB(0xd0, 0xd0, 0xd0));
nvgFill(args.vg); nvgFill(args.vg);
ModuleWidget::draw(args); ModuleWidgetWith14HP::draw(args);
} }
void appendContextMenu(Menu* const menu) override void appendContextMenu(Menu* const menu) override

View file

@ -26,6 +26,7 @@
*/ */
#include "plugincontext.hpp" #include "plugincontext.hpp"
#include "ModuleWidgets.hpp"
#include "Widgets.hpp" #include "Widgets.hpp"
#include <algorithm> #include <algorithm>
@ -616,7 +617,7 @@ struct NoteGridDisplay : Widget {
} }
}; };
struct HostMIDIGateWidget : ModuleWidget { struct HostMIDIGateWidget : ModuleWidgetWith14HP {
static constexpr const float startX_In = 14.0f; static constexpr const float startX_In = 14.0f;
static constexpr const float startX_Out = 115.0f; static constexpr const float startX_Out = 115.0f;
static constexpr const float startY = 190.0f; static constexpr const float startY = 190.0f;
@ -630,10 +631,7 @@ struct HostMIDIGateWidget : ModuleWidget {
setModule(m); setModule(m);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDIGate.svg"))); setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDIGate.svg")));
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, 0))); createAndAddScrews();
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
for (int i=0; i<18; ++i) for (int i=0; i<18; ++i)
{ {
@ -657,18 +655,14 @@ struct HostMIDIGateWidget : ModuleWidget {
void draw(const DrawArgs& args) override void draw(const DrawArgs& args) override
{ {
nvgBeginPath(args.vg); drawBackground(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);
nvgBeginPath(args.vg); nvgBeginPath(args.vg);
nvgRoundedRect(args.vg, startX_Out - 2.5f, startY - 2.0f, padding * 3, padding * 6, 4); nvgRoundedRect(args.vg, startX_Out - 2.5f, startY - 2.0f, padding * 3, padding * 6, 4);
nvgFillColor(args.vg, nvgRGB(0xd0, 0xd0, 0xd0)); nvgFillColor(args.vg, nvgRGB(0xd0, 0xd0, 0xd0));
nvgFill(args.vg); nvgFill(args.vg);
ModuleWidget::draw(args); ModuleWidgetWith14HP::draw(args);
} }
void appendContextMenu(Menu* const menu) override void appendContextMenu(Menu* const menu) override

View file

@ -100,4 +100,5 @@ typedef ModuleWidgetWithSideScrews<3> ModuleWidgetWith3HP;
typedef ModuleWidgetWithSideScrews<8> ModuleWidgetWith8HP; typedef ModuleWidgetWithSideScrews<8> ModuleWidgetWith8HP;
typedef ModuleWidgetWithSideScrews<9> ModuleWidgetWith9HP; typedef ModuleWidgetWithSideScrews<9> ModuleWidgetWith9HP;
typedef ModuleWidgetWithSideScrews<11> ModuleWidgetWith11HP; typedef ModuleWidgetWithSideScrews<11> ModuleWidgetWith11HP;
typedef ModuleWidgetWithSideScrews<14> ModuleWidgetWith14HP;
typedef ModuleWidgetWithSideScrews<25> ModuleWidgetWith25HP; typedef ModuleWidgetWithSideScrews<25> ModuleWidgetWith25HP;