2nd Pass Render
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "core/ui/footer_bar.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
namespace reasampler::ui {
|
||||
|
||||
namespace {
|
||||
@@ -50,8 +52,18 @@ FooterBarLayout computeFooterBar(const FooterRect& footer, const FooterBarSpec&
|
||||
}
|
||||
|
||||
// Tail button.
|
||||
if (fitsLeftOf(cursorX, spec.tailWidth, rightBound))
|
||||
if (fitsLeftOf(cursorX, spec.tailWidth, rightBound)) {
|
||||
out.tail = FooterBarRect{cursorX, top, spec.tailWidth, boxH};
|
||||
cursorX += spec.tailWidth + spec.gap;
|
||||
}
|
||||
// 2nd Pass Render button.
|
||||
if (fitsLeftOf(cursorX, spec.secondPassWidth, rightBound)) {
|
||||
out.secondPass = FooterBarRect{cursorX,top, spec.secondPassWidth, boxH};
|
||||
// no need to increment the cursor for final element
|
||||
}
|
||||
|
||||
// Package the whole footer bounds into the layout object
|
||||
out.footer = FooterRect{footer};
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -61,7 +73,10 @@ FooterHit hitTestFooterBar(int px, int py, const FooterBarLayout& layout) {
|
||||
// count label is a passive readout — never a hit target.
|
||||
if (pointIn(px, py, layout.toggle)) return FooterHit::Toggle;
|
||||
if (pointIn(px, py, layout.tail)) return FooterHit::Tail;
|
||||
return FooterHit::None;
|
||||
if (pointIn(px, py, layout.secondPass)) return FooterHit::SecondPass;
|
||||
// Finally test if it's within the footer at all
|
||||
if (pointIn(px, py, layout.footer)) return FooterHit::Invalid;
|
||||
return FooterHit::Outside;
|
||||
}
|
||||
|
||||
bool modeSegmentEnabled(bool isActiveSegment, bool transportRunning, bool routable) {
|
||||
|
||||
@@ -25,18 +25,24 @@ using FooterBarRect = Rect;
|
||||
// left of the reserved right margin; placement is greedy left-to-right (toggle survives longest,
|
||||
// Tail drops first on a very narrow footer).
|
||||
struct FooterBarLayout {
|
||||
FooterRect footer;
|
||||
FooterBarRect toggle;
|
||||
FooterBarRect count;
|
||||
FooterBarRect tail;
|
||||
FooterBarRect secondPass;
|
||||
|
||||
bool operator==(const FooterBarLayout& o) const {
|
||||
return toggle == o.toggle && count == o.count && tail == o.tail;
|
||||
return footer == o.footer &&
|
||||
toggle == o.toggle &&
|
||||
count == o.count &&
|
||||
tail == o.tail &&
|
||||
secondPass == o.secondPass;
|
||||
}
|
||||
};
|
||||
|
||||
// Which footer LEFT-group affordance a point landed on. Prune is hit-tested separately via
|
||||
// hitTestPruneButton.
|
||||
enum class FooterHit { None, Toggle, Tail };
|
||||
enum class FooterHit { Invalid, Toggle, Tail, SecondPass, Outside };
|
||||
|
||||
// Layout inputs, in pixels; defaults are the bank_panel footer metrics.
|
||||
// * rightReserve — pixels reserved at the footer's right for the prune button + version
|
||||
@@ -45,6 +51,7 @@ struct FooterBarSpec {
|
||||
int toggleWidth = 132;
|
||||
int countWidth = 64;
|
||||
int tailWidth = 132;
|
||||
int secondPassWidth = 96;
|
||||
int gap = 6;
|
||||
int leftPad = 8;
|
||||
int verticalInset = 4;
|
||||
|
||||
Reference in New Issue
Block a user