Browse Source

Fix Core Blank panel

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
3f2476073d
2 changed files with 29 additions and 11 deletions
  1. +25
    -7
      src/Core/Blank.cpp
  2. +4
    -4
      src/app/ParamQuantity.cpp

+ 25
- 7
src/Core/Blank.cpp View File

@@ -4,6 +4,28 @@
using namespace rack; using namespace rack;




struct BlankPanel : virtual Widget {
Widget *panelBorder;

BlankPanel() {
panelBorder = new PanelBorder;
addChild(panelBorder);
}

void step() override {
panelBorder->box.size = box.size;
}

void draw(NVGcontext *vg) override {
nvgBeginPath(vg);
nvgRect(vg, 0.0, 0.0, box.size.x, box.size.y);
nvgFillColor(vg, nvgRGB(0xe6, 0xe6, 0xe6));
nvgFill(vg);
Widget::draw(vg);
}
};


struct ModuleResizeHandle : virtual Widget { struct ModuleResizeHandle : virtual Widget {
bool right = false; bool right = false;
float dragX; float dragX;
@@ -58,7 +80,6 @@ struct ModuleResizeHandle : virtual Widget {




struct BlankWidget : ModuleWidget { struct BlankWidget : ModuleWidget {
// Panel *panel;
Widget *topRightScrew; Widget *topRightScrew;
Widget *bottomRightScrew; Widget *bottomRightScrew;
Widget *rightHandle; Widget *rightHandle;
@@ -66,11 +87,8 @@ struct BlankWidget : ModuleWidget {
BlankWidget(Module *module) : ModuleWidget(module) { BlankWidget(Module *module) : ModuleWidget(module) {
box.size = Vec(RACK_GRID_WIDTH * 10, RACK_GRID_HEIGHT); box.size = Vec(RACK_GRID_WIDTH * 10, RACK_GRID_HEIGHT);


// {
// panel = new LightPanel;
// panel->box.size = box.size;
// addChild(panel);
// }
panel = new BlankPanel;
addChild(panel);


ModuleResizeHandle *leftHandle = new ModuleResizeHandle; ModuleResizeHandle *leftHandle = new ModuleResizeHandle;
ModuleResizeHandle *rightHandle = new ModuleResizeHandle; ModuleResizeHandle *rightHandle = new ModuleResizeHandle;
@@ -88,7 +106,7 @@ struct BlankWidget : ModuleWidget {
} }


void step() override { void step() override {
// panel->box.size = box.size;
panel->box.size = box.size;
topRightScrew->box.pos.x = box.size.x - 30; topRightScrew->box.pos.x = box.size.x - 30;
bottomRightScrew->box.pos.x = box.size.x - 30; bottomRightScrew->box.pos.x = box.size.x - 30;
if (box.size.x < RACK_GRID_WIDTH * 6) { if (box.size.x < RACK_GRID_WIDTH * 6) {


+ 4
- 4
src/app/ParamQuantity.cpp View File

@@ -24,25 +24,25 @@ void ParamQuantity::setValue(float value) {


float ParamQuantity::getValue() { float ParamQuantity::getValue() {
if (!module) if (!module)
return Quantity::getValue();
return 0.f;
return getParam()->value; return getParam()->value;
} }


float ParamQuantity::getMinValue() { float ParamQuantity::getMinValue() {
if (!module) if (!module)
return Quantity::getMinValue();
return -1.f;
return getParam()->minValue; return getParam()->minValue;
} }


float ParamQuantity::getMaxValue() { float ParamQuantity::getMaxValue() {
if (!module) if (!module)
return Quantity::getMaxValue();
return 1.f;
return getParam()->maxValue; return getParam()->maxValue;
} }


float ParamQuantity::getDefaultValue() { float ParamQuantity::getDefaultValue() {
if (!module) if (!module)
return Quantity::getDefaultValue();
return 0.f;
return getParam()->defaultValue; return getParam()->defaultValue;
} }




Loading…
Cancel
Save