Merge pull request #863 from jpcima/vmeter-updates
Style update for the volume meter
This commit is contained in:
commit
35f007b1f6
5 changed files with 36 additions and 10 deletions
|
|
@ -20,7 +20,7 @@ widget_class mainView {open
|
||||||
class RoundedGroup
|
class RoundedGroup
|
||||||
} {
|
} {
|
||||||
Fl_Box {} {
|
Fl_Box {} {
|
||||||
comment {tag=kTagAbout} selected
|
comment {tag=kTagAbout}
|
||||||
image {../resources/logo_text_shaded.png} xywh {32 9 120 60}
|
image {../resources/logo_text_shaded.png} xywh {32 9 120 60}
|
||||||
class AboutButton
|
class AboutButton
|
||||||
}
|
}
|
||||||
|
|
@ -147,11 +147,11 @@ widget_class mainView {open
|
||||||
class KnobCCBox
|
class KnobCCBox
|
||||||
}
|
}
|
||||||
Fl_Box leftMeter_ {
|
Fl_Box leftMeter_ {
|
||||||
xywh {740 10 15 90} box BORDER_BOX
|
xywh {740 15 15 85} box BORDER_BOX
|
||||||
class VMeter
|
class VMeter
|
||||||
}
|
}
|
||||||
Fl_Box rightMeter_ {selected
|
Fl_Box rightMeter_ {selected
|
||||||
xywh {760 10 15 90} box BORDER_BOX
|
xywh {760 15 15 85} box BORDER_BOX
|
||||||
class VMeter
|
class VMeter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -722,10 +722,10 @@ void Editor::Impl::createFrameContents()
|
||||||
};
|
};
|
||||||
auto createVMeter = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
|
auto createVMeter = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
|
||||||
SLevelMeter* meter = new SLevelMeter(bounds);
|
SLevelMeter* meter = new SLevelMeter(bounds);
|
||||||
|
meter->setFrameColor(CColor(0x00, 0x00, 0x00, 0x00));
|
||||||
meter->setNormalFillColor(CColor(0x00, 0xaa, 0x11));
|
meter->setNormalFillColor(CColor(0x00, 0xaa, 0x11));
|
||||||
meter->setDangerFillColor(CColor(0xaa, 0x00, 0x00));
|
meter->setDangerFillColor(CColor(0xaa, 0x00, 0x00));
|
||||||
OnThemeChanged.push_back([meter, palette]() {
|
OnThemeChanged.push_back([meter, palette]() {
|
||||||
meter->setFrameColor(palette->inactiveText);
|
|
||||||
meter->setBackColor(palette->knobInactiveTrack);
|
meter->setBackColor(palette->knobInactiveTrack);
|
||||||
});
|
});
|
||||||
return meter;
|
return meter;
|
||||||
|
|
|
||||||
|
|
@ -1034,18 +1034,40 @@ void SLevelMeter::draw(CDrawContext* dc)
|
||||||
fillColor.alpha = static_cast<uint8_t>(A * 255.0);
|
fillColor.alpha = static_cast<uint8_t>(A * 255.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
dc->setDrawMode(kAliasing);
|
CCoord radius = radius_;
|
||||||
|
bool isRounded = radius > 0.0;
|
||||||
|
|
||||||
|
dc->setDrawMode(isRounded ? kAntiAliasing : kAliasing);
|
||||||
|
|
||||||
|
SharedPointer<CGraphicsPath> largeRoundRect;
|
||||||
|
SharedPointer<CGraphicsPath> fillRoundRect;
|
||||||
|
|
||||||
|
if (isRounded) {
|
||||||
|
largeRoundRect = owned(dc->createRoundRectGraphicsPath(largeBounds, radius));
|
||||||
|
fillRoundRect = owned(dc->createRoundRectGraphicsPath(fillBounds, radius));
|
||||||
|
}
|
||||||
|
|
||||||
if (backColor_.alpha > 0) {
|
if (backColor_.alpha > 0) {
|
||||||
dc->setFillColor(backColor_);
|
dc->setFillColor(backColor_);
|
||||||
dc->drawRect(largeBounds, kDrawFilled);
|
if (!isRounded)
|
||||||
|
dc->drawRect(largeBounds, kDrawFilled);
|
||||||
|
else
|
||||||
|
dc->drawGraphicsPath(largeRoundRect, CDrawContext::kPathFilled);
|
||||||
}
|
}
|
||||||
|
|
||||||
dc->setFrameColor(frameColor_);
|
dc->setFrameColor(frameColor_);
|
||||||
dc->setFillColor(fillColor);
|
dc->setFillColor(fillColor);
|
||||||
|
|
||||||
dc->drawRect(fillBounds, kDrawFilled);
|
if (!isRounded) {
|
||||||
dc->drawRect(largeBounds);
|
if (fill > 0)
|
||||||
|
dc->drawRect(fillBounds, kDrawFilled);
|
||||||
|
dc->drawRect(largeBounds);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (fill > 0 && fillBounds.getHeight() >= radius)
|
||||||
|
dc->drawGraphicsPath(fillRoundRect, CDrawContext::kPathFilled);
|
||||||
|
dc->drawGraphicsPath(largeRoundRect, CDrawContext::kPathStroked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,9 @@ public:
|
||||||
CColor getDangerFillColor() const { return dangerFillColor_; }
|
CColor getDangerFillColor() const { return dangerFillColor_; }
|
||||||
void setDangerFillColor(CColor color) { dangerFillColor_ = color; invalid(); }
|
void setDangerFillColor(CColor color) { dangerFillColor_ = color; invalid(); }
|
||||||
|
|
||||||
|
CCoord getRoundRectRadius() const { return radius_; }
|
||||||
|
void setRoundRectRadius(CCoord radius) { radius_ = radius; invalid(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void draw(CDrawContext* dc) override;
|
void draw(CDrawContext* dc) override;
|
||||||
|
|
||||||
|
|
@ -398,6 +401,7 @@ private:
|
||||||
CColor safeFillColor_;
|
CColor safeFillColor_;
|
||||||
CColor dangerFillColor_;
|
CColor dangerFillColor_;
|
||||||
CColor backColor_;
|
CColor backColor_;
|
||||||
|
CCoord radius_ = 5.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,10 @@ view__25->addView(view__28);
|
||||||
auto* const view__29 = createKnobCCBox(CRect(85, 5, 155, 95), kTagSetCCPan, "Pan", kCenterText, 12);
|
auto* const view__29 = createKnobCCBox(CRect(85, 5, 155, 95), kTagSetCCPan, "Pan", kCenterText, 12);
|
||||||
panCCKnob_ = view__29;
|
panCCKnob_ = view__29;
|
||||||
view__25->addView(view__29);
|
view__25->addView(view__29);
|
||||||
auto* const view__30 = createVMeter(CRect(170, 5, 185, 95), -1, "", kCenterText, 14);
|
auto* const view__30 = createVMeter(CRect(170, 10, 185, 95), -1, "", kCenterText, 14);
|
||||||
leftMeter_ = view__30;
|
leftMeter_ = view__30;
|
||||||
view__25->addView(view__30);
|
view__25->addView(view__30);
|
||||||
auto* const view__31 = createVMeter(CRect(190, 5, 205, 95), -1, "", kCenterText, 14);
|
auto* const view__31 = createVMeter(CRect(190, 10, 205, 95), -1, "", kCenterText, 14);
|
||||||
rightMeter_ = view__31;
|
rightMeter_ = view__31;
|
||||||
view__25->addView(view__31);
|
view__25->addView(view__31);
|
||||||
enterPalette(defaultPalette);
|
enterPalette(defaultPalette);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue