Merge: drop membership count from mode switch labels
This commit is contained in:
+4
-14
@@ -383,8 +383,7 @@ int modeCount() {
|
|||||||
|
|
||||||
// Draws the segmented mode switch into the header strip of width `w`: one segment
|
// Draws the segmented mode switch into the header strip of width `w`: one segment
|
||||||
// per registered mode (ordinal order), the active mode lit, each labeled with its
|
// per registered mode (ordinal order), the active mode lit, each labeled with its
|
||||||
// display name and a cheap membership indicator (count of tracks tagged into that
|
// display name. READ-ONLY: reads g_session->view() live; never mutates the model here
|
||||||
// mode). READ-ONLY: reads g_session->view() live; never mutates the model here
|
|
||||||
// (activation happens on click, in handleClick).
|
// (activation happens on click, in handleClick).
|
||||||
void drawModeSwitch(LICE_IBitmap* bmp, int w) {
|
void drawModeSwitch(LICE_IBitmap* bmp, int w) {
|
||||||
if (!g_panel.session) return;
|
if (!g_panel.session) return;
|
||||||
@@ -400,11 +399,6 @@ void drawModeSwitch(LICE_IBitmap* bmp, int w) {
|
|||||||
const std::vector<SegmentRect> segs = computeSegmentRects(header, n);
|
const std::vector<SegmentRect> segs = computeSegmentRects(header, n);
|
||||||
if (segs.empty()) return;
|
if (segs.empty()) return;
|
||||||
|
|
||||||
// Cheap per-mode membership count: how many tagged leaves opted into this mode.
|
|
||||||
// Iterate the membership index once per mode (tiny N of modes; the index is the
|
|
||||||
// set of TAGGED tracks, not all tracks — bounded and cheap). Untagged tracks are
|
|
||||||
// Arrange members by default but are NOT in the index, so this is a "tagged into"
|
|
||||||
// count, which is the sensible, cheap indicator (not a full tree walk).
|
|
||||||
const std::string& activeId = view.activeModeId();
|
const std::string& activeId = view.activeModeId();
|
||||||
HDC dc = bmp->getDC();
|
HDC dc = bmp->getDC();
|
||||||
|
|
||||||
@@ -419,13 +413,9 @@ void drawModeSwitch(LICE_IBitmap* bmp, int w) {
|
|||||||
|
|
||||||
if (!dc) continue;
|
if (!dc) continue;
|
||||||
|
|
||||||
int members = 0;
|
// Display name centered in the segment. A single-line centered label;
|
||||||
for (const auto& entry : view.membership().all())
|
// the segment is wide enough for the seed modes' short names.
|
||||||
if (entry.second.modeIds.count(mode.id) != 0) ++members;
|
const std::string& label = mode.displayName;
|
||||||
|
|
||||||
// "DisplayName (count)" centered in the segment. A single-line centered
|
|
||||||
// label; the segment is wide enough for the seed modes' short names.
|
|
||||||
std::string label = mode.displayName + " (" + std::to_string(members) + ")";
|
|
||||||
RECT rc{s.x, s.y, s.x + s.width, s.y + s.height};
|
RECT rc{s.x, s.y, s.x + s.width, s.y + s.height};
|
||||||
SetTextColor(dc, active ? kRgbSegActiveText : kRgbSegText);
|
SetTextColor(dc, active ? kRgbSegActiveText : kRgbSegText);
|
||||||
SetBkMode(dc, TRANSPARENT);
|
SetBkMode(dc, TRANSPARENT);
|
||||||
|
|||||||
+2
-2
@@ -30,8 +30,8 @@ struct HeaderRect {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// One segment's pixel rectangle within the header, top-left origin. These are the
|
// One segment's pixel rectangle within the header, top-left origin. These are the
|
||||||
// draw bounds for one mode's button; the panel draws the mode's label + membership
|
// draw bounds for one mode's button; the panel draws the mode's display name inside
|
||||||
// indicator inside it and lights it when it is the active mode.
|
// it and lights it when it is the active mode.
|
||||||
struct SegmentRect {
|
struct SegmentRect {
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user