# The geometry vocabulary every instrument UI module speaks (the Rect alias + contains())
# is header-only, hence INTERFACE.
add_library(editor_geometry INTERFACE)
target_include_directories(editor_geometry INTERFACE ${REASAMPLER_SRC_DIR})

reasampler_pure_library(sample_bands SOURCES sample_bands.cpp LINK PUBLIC editor_geometry)
reasampler_test(sample_bands LINK sample_bands)

reasampler_pure_library(sample_chrome SOURCES sample_chrome.cpp LINK PUBLIC sample_bands)
# knob_deck is linked for the test only: the knob size the shell hands chromeRects is
# kDeckKnobSize, and the test reads the real constant rather than copying its value.
reasampler_test(sample_chrome LINK sample_chrome knob_deck)

reasampler_pure_library(embed_strip SOURCES embed_strip.cpp LINK PUBLIC editor_geometry)
reasampler_test(embed_strip LINK embed_strip)

reasampler_pure_library(capture_browser SOURCES capture_browser.cpp LINK PUBLIC editor_geometry)
reasampler_test(capture_browser LINK capture_browser)

reasampler_pure_library(keyboard_strip SOURCES keyboard_strip.cpp LINK PUBLIC editor_geometry)
reasampler_test(keyboard_strip LINK keyboard_strip sample_bands sample_chrome)

# sample_bands is PRIVATE: the lane split is used internally and nothing in the public
# header needs it.
reasampler_pure_library(waveform_view
    SOURCES waveform_view.cpp
    LINK PUBLIC editor_geometry peaks PRIVATE sample_bands)
# sample_bands is linked directly here because the test exercises the lane metrics that
# waveform_view does not re-export.
reasampler_test(waveform_view LINK waveform_view sample_bands)

reasampler_pure_library(browser_scroll
    SOURCES browser_scroll.cpp
    LINK PUBLIC capture_browser sample_chrome)
reasampler_test(browser_scroll LINK browser_scroll)

reasampler_pure_library(param_slider
    SOURCES param_slider.cpp
    LINK PUBLIC editor_geometry param_taper)
reasampler_test(param_slider LINK param_slider)

reasampler_pure_library(envelope_overlay
    SOURCES envelope_overlay.cpp
    LINK PUBLIC editor_geometry curve_law param_taper)
# sample_bands is linked for the test only: the tapered-axis legibility assertion is judged at the
# editor's own floor width, read from the allocator rather than copied as a number.
reasampler_test(envelope_overlay LINK envelope_overlay sample_bands)

reasampler_pure_library(envelope_edit SOURCES envelope_edit.cpp LINK PUBLIC envelope_overlay)
reasampler_test(envelope_edit LINK envelope_edit)

reasampler_pure_library(knob_deck SOURCES knob_deck.cpp LINK PUBLIC editor_geometry)
reasampler_test(knob_deck LINK knob_deck)

# The deck's group COMPOSITION, split from its layout: knob_deck stays engine-free (see
# core/instrument/CLAUDE.md's deck_groups entry for why this module, not knob_deck, reads
# PlayMode). velocity_curve is the filter's own curve field; peaks is play_params.h's
# AudioSample dependency. play_params.h also drags in filter/'s headers (FilterSettings,
# MorphLaw) for the v9 filter tail -- plain value types, no filter symbol linked.
reasampler_pure_library(deck_groups
    SOURCES deck_groups.cpp
    LINK PUBLIC knob_deck velocity_curve peaks curve_law)
# sample_bands is linked directly for the test only: the deck-fits-the-floor-window assertion
# needs the band allocator deck_groups itself has no reason to depend on.
reasampler_test(deck_groups LINK deck_groups sample_bands)

# The point-editing grammar both spline consumers share, so it links the curve itself (unlike
# envelope_overlay/envelope_edit, which stay engine-free — the staged envelopes touch no curve).
reasampler_pure_library(spline_edit
    SOURCES spline_edit.cpp
    LINK PUBLIC editor_geometry velocity_curve)
# waveform_view and sample_bands are linked for the test only: resolveWaveformClaim's
# smallest-target-first tests build the real node/tab/marker geometry
# editor_input_waveform.cpp's mouseDownWaveform composes (the shell that calls it has no test
# target of its own), which needs waveform_view's marker/tab primitives and sample_bands'
# kWaveformMinHeight floor.
reasampler_test(spline_edit LINK spline_edit waveform_view sample_bands)

# The deck's VALUE binding, split from its composition on the same axis deck_groups was split
# from knob_deck. Links the header-only play_seconds, NOT sample_map: PlaySeconds is all a deck
# knob edits, and sample_map would drag the bank model and the WAV codec in behind it. Same for
# the filter's MorphLaw — an enum, so no filter symbol is linked.
reasampler_pure_library(deck_values
    SOURCES deck_values.cpp
    LINK PUBLIC deck_groups play_seconds envelope_overlay param_taper master_gain)
reasampler_test(deck_values LINK deck_values)

# The bake Hold knob's value domain. Links the ladder alone — it computes no geometry, so it
# does not even take editor_geometry.
reasampler_pure_library(bake_hold SOURCES bake_hold.cpp LINK PUBLIC musical_division)
reasampler_test(bake_hold LINK bake_hold)

reasampler_pure_library(curve_popup SOURCES curve_popup.cpp LINK PUBLIC editor_geometry)
# velocity_curve is linked for the test only: the sheet's geometry is domain-agnostic, and
# proving that takes a curve of each domain mapped through the one curveBox.
reasampler_test(curve_popup LINK curve_popup velocity_curve)

# The ONE norm<->value taper and modifier vocabulary every variable control shares. Declared
# last, but it sits at the BOTTOM of this directory's dependency order: param_slider,
# envelope_overlay and deck_values all read it — which is exactly why it could not stay inside
# deck_values, which sits above envelope_overlay.
reasampler_pure_library(param_taper SOURCES param_taper.cpp LINK PUBLIC curve_law)
# envelope_overlay and sample_bands are linked for the test only: the finest-drag-step assertion
# is judged against the envelope node drag at the editor's own floor width (the sharper of the
# taper's two consumers), read from the allocator/overlay rather than copied as a number.
reasampler_test(param_taper LINK param_taper envelope_overlay sample_bands)
