diff --git a/plugins/Cardinal/src/AudioFile.cpp b/plugins/Cardinal/src/AudioFile.cpp index e02277c..8497fab 100644 --- a/plugins/Cardinal/src/AudioFile.cpp +++ b/plugins/Cardinal/src/AudioFile.cpp @@ -490,27 +490,13 @@ struct AudioFileWidget : ModuleWidget { } } - void draw(const DrawArgs& args) override + void drawLayer(const DrawArgs& args, int layer) 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); + if (layer != 1) + return ModuleWidget::drawLayer(args, layer); const Rect audioPreviewPos = Rect(8, box.size.y - 80 - 80, box.size.x - 16, 80); - - nvgBeginPath(args.vg); - nvgRoundedRect(args.vg, - audioPreviewPos.pos.x, audioPreviewPos.pos.y, - audioPreviewPos.size.x, audioPreviewPos.size.y, 4.0f); - nvgFillColor(args.vg, nvgRGB(0x75, 0x17, 0x00)); - nvgFill(args.vg); - nvgStrokeWidth(args.vg, 2.0f); - nvgStrokeColor(args.vg, nvgRGB(0xd6, 0x75, 0x16)); - nvgStroke(args.vg); - + const float alpha = 1.0f - (0.5f - settings::rackBrightness * 0.5f); char textInfo[0xff]; if (module != nullptr && module->audioInfo.channels != 0) @@ -518,7 +504,7 @@ struct AudioFileWidget : ModuleWidget { const float audioPreviewBarHeight = audioPreviewPos.size.y - 20; const size_t position = (module->audioInfo.position * 0.01f) * ARRAY_SIZE(module->audioInfo.preview); - nvgFillColor(args.vg, nvgRGB(0xd6, 0x75, 0x16)); + nvgFillColor(args.vg, nvgRGBAf(0.839f, 0.459f, 0.086f, alpha)); for (size_t i=0; iaudioInfo.preview); ++i) { @@ -527,7 +513,7 @@ struct AudioFileWidget : ModuleWidget { const float y = audioPreviewPos.pos.y + audioPreviewBarHeight - height; if (position == i) - nvgFillColor(args.vg, color::WHITE); + nvgFillColor(args.vg, nvgRGBAf(1.0f, 1.0f, 1.0f, alpha)); nvgBeginPath(args.vg); nvgRect(args.vg, @@ -547,38 +533,50 @@ struct AudioFileWidget : ModuleWidget { std::strcpy(textInfo, "No file loaded"); } - nvgFillColor(args.vg, color::WHITE); + nvgFillColor(args.vg, nvgRGBAf(1.0f, 1.0f, 1.0f, alpha)); nvgFontFaceId(args.vg, 0); nvgFontSize(args.vg, 13); nvgTextAlign(args.vg, NVG_ALIGN_LEFT); - nvgText(args.vg, audioPreviewPos.pos.x + 4, audioPreviewPos.pos.y + audioPreviewPos.size.y - 6, + nvgText(args.vg, + audioPreviewPos.pos.x + 4, + audioPreviewPos.pos.y + audioPreviewPos.size.y - 6, textInfo, nullptr); + } - nvgFontSize(args.vg, 11); - nvgTextAlign(args.vg, NVG_ALIGN_CENTER); - // nvgTextBounds(vg, 0, 0, text, nullptr, nullptr); + 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); + + const Rect audioPreviewPos = Rect(8, box.size.y - 80 - 80, box.size.x - 16, 80); nvgBeginPath(args.vg); - nvgRoundedRect(args.vg, startX_Out - 4.0f, RACK_GRID_HEIGHT - padding * CarlaInternalPluginModule::NUM_INPUTS - 2.0f, - padding, padding * CarlaInternalPluginModule::NUM_INPUTS, 4); + nvgRoundedRect(args.vg, + audioPreviewPos.pos.x, audioPreviewPos.pos.y, + audioPreviewPos.size.x, audioPreviewPos.size.y, 4.0f); + nvgFillColor(args.vg, nvgRGB(0x75, 0x17, 0x00)); + nvgFill(args.vg); + nvgStrokeWidth(args.vg, 2.0f); + nvgStrokeColor(args.vg, nvgRGB(0xd6, 0x75, 0x16)); + nvgStroke(args.vg); + + nvgBeginPath(args.vg); + nvgRoundedRect(args.vg, + startX_Out - 4.0f, + RACK_GRID_HEIGHT - padding * CarlaInternalPluginModule::NUM_INPUTS - 2.0f, + padding, + padding * CarlaInternalPluginModule::NUM_INPUTS, 4); nvgFillColor(args.vg, nvgRGB(0xd0, 0xd0, 0xd0)); nvgFill(args.vg); ModuleWidget::draw(args); } -// void step() override -// { -// if (d_isNotEqual(module->audioInfo.position, lastPosition)) -// { -// lastPosition = module->audioInfo.position; -// // setDirty(true); -// } -// -// ModuleWidget::step(); -// } - void appendContextMenu(ui::Menu* const menu) override { menu->addChild(new ui::MenuSeparator); diff --git a/plugins/Cardinal/src/glBars.cpp b/plugins/Cardinal/src/glBars.cpp index 1027dcb..e105b2b 100644 --- a/plugins/Cardinal/src/glBars.cpp +++ b/plugins/Cardinal/src/glBars.cpp @@ -71,6 +71,18 @@ struct glBarsRendererWidget : OpenGlWidget { oversample = 2.0f; } + void draw(const DrawArgs&) override + { + } + + void drawLayer(const DrawArgs& args, int layer) override + { + if (layer != 1) + return; + + OpenGlWidget::draw(args); + } + void drawFramebuffer() override { math::Vec fbSize = getFramebufferSize();