feat(slices): non-overlapping flag packing + per-slice colored letters

Flags (A + B+) now lay out in one pass: each sits beside its own filter
band as before, but a left neighbour pushes the next flag right so they
never cross (forward pack + backward pull-in on right-edge overflow).
LayoutFlags replaces the per-flag positioning; PositionVfoOverlay/
PositionSliceFlags are thin wrappers.

Identity is shown by a letter drawn at the top of each filter band in
the spectrum (both CPU + GL renderers), so a flag pushed away from its
band is still traceable. Letters and the flag letter-badge share one
per-slice palette (SliceColor); F is violet, not red, to avoid clashing
with the TX indicator.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 13:19:50 +03:00
co-authored by Claude Opus 4.8
parent 3fbde19b9f
commit 30a6616dbe
4 changed files with 177 additions and 102 deletions
+23
View File
@@ -49,6 +49,8 @@ type
Tex: TGLTextureCache;
LastX, LastY, LastW, LastH: Integer;
end;
// Кэш текстур букв A..H для меток на полосе фильтра (грузятся лениво).
FLetterTex: array[0..7] of TGLTextureCache;
FLastAGCText: string;
FLastAGCY: Integer;
FLastAGCHangY: Integer;
@@ -91,6 +93,7 @@ type
procedure DrawCachedOverlays(W, H: Integer);
procedure DrawSliceOverlays(W, H: Integer);
procedure DrawSliceFilterMarkers(W, H: Integer);
procedure DrawBandLetterGL(X1, X2: Integer; L: Char);
function SliceTexIndex(O: TVfoOverlay): Integer; // индекс в FSliceTex, -1 если нет
function FormatFreqGL(Hz: Double): string;
function ActiveVfoFrequency: Double;
@@ -161,6 +164,7 @@ begin
DeleteTexture(FVfoOverlayTex);
DeleteTexture(FBandOverlayTex);
for i := 0 to High(FSliceTex) do DeleteTexture(FSliceTex[i].Tex);
for i := 0 to High(FLetterTex) do DeleteTexture(FLetterTex[i]);
end;
SetLength(FSliceTex, 0);
inherited Destroy;
@@ -557,6 +561,10 @@ begin
DrawRect(TXVfoX - 5, 0, TXVfoX + 5, 8, TColor($002030E0), 1);
end;
// Буква главного флага (A) на его полосе — только когда есть слайсы.
if (SliceOverlayCount > 0) and (FActiveVfo = 0) and Assigned(FVfoOverlay) then
DrawBandLetterGL(X1, X2, FVfoOverlay.SliceLetter);
DrawSliceFilterMarkers(W, H);
end;
@@ -578,9 +586,24 @@ begin
DrawLine(SX1, 0, SX1, H, SLICE_CLR, 1, False);
DrawLine(SX2, 0, SX2, H, SLICE_CLR, 1, False);
DrawLine(SVfoX, 0, SVfoX, H - 12, SLICE_CLR, 2, False);
DrawBandLetterGL(SX1, SX2, O.SliceLetter);
end;
end;
// Буква слайса по центру полосы фильтра сверху (аналог CPU DrawBandLetter).
procedure TSpectrumViewOpenGL.DrawBandLetterGL(X1, X2: Integer; L: Char);
var
idx, cx: Integer;
begin
if (L < 'A') or (L > 'H') then Exit;
if X2 <= X1 then Exit;
idx := Ord(L) - Ord('A');
if FLetterTex[idx].Tex = 0 then
UploadText(FLetterTex[idx], L, SliceColor(L), 8, True); // цвет слайса
cx := (X1 + X2) div 2;
DrawTexture(FLetterTex[idx], cx - FLetterTex[idx].W div 2, 0);
end;
procedure TSpectrumViewOpenGL.DrawAGCLines(W, H: Integer; DBmax,
InvRange: Double);
var