// editor_interaction.h — the Sample editor's INTERACTION VOCABULARY: what a drag can be
// editing, and what the pointer can be over. Two catalogues of the editor's interactive
// surface, produced by the input TUs and read by the paint TUs; neither is behaviour, which is
// why they are named here rather than buried inside the editor class between its paint and
// layout declarations. Internal to the reasampler_editor TU family, like editor_internal.h.

#pragma once

namespace reasampler::vst {

// What a mouse drag is currently editing. kWaveMarker/kEnvNode/kCurveNode track their grabbed
// item in the editor's waveMarker_/envNode_/curvePointIndex_; kDeckKnob is a grab-anchored knob
// drag (control in dragParamId_, grab value in dragKnobStartValue_). kSplineNode is the
// overlay's peer of kCurveNode: the same VelocityCurve point drag, over the waveform overlay's
// box and the overlay-active envelope's contour rather than the popup's box and curve.
enum class DragKind { kNone, kRootMarker, kWaveMarker, kScrollThumb, kEnvNode,
                      kCurveNode, kSplineNode, kDeckKnob };

// The interactive element under the pointer, resolved live in WM_MOUSEMOVE.
enum class HoverKind {
    kNone,
    kNavBrowse,       // the chrome "Browse" toolbar button (opens the Browse modal)
    kBack,            // the Browse "back" affordance (returns to Sample)
    kSearchBox,       // the browser search box
    kFilterTab,       // a bank-filter tab (index = tab ordinal, 0 = All)
    kCard,            // a capture card (index = visible_ index)
    kBrowseConfirm,   // the Browse modal "Load" confirm button
    kBrowseCancel,    // the Browse modal "Cancel" button
    kChanMono,        // the mono channel-mode segment
    kChanStereo,      // the stereo channel-mode segment
    kLoopOff,         // the loop enable's Off segment
    kLoopOn,          // the loop enable's On segment
    kWaveMark,        // a waveform overlay mark (index = WaveMark ordinal); promotes its label
    kPreview,         // the preview-trigger button
    kBake,            // the resample-bake trigger
    kControl,         // a knob-deck element (index = control id)
    kInnerDial,       // a knob cell's inner curve dial (index = the OUTER control id)
    kEnvRadio,        // an envelope deck's overlay-select radio (index = radio control id)
    kCurveNode,       // a velocity-curve control point (index = point index)
    kVelKnob,         // the chrome preview-velocity radial knob
    kHoldKnob,        // the chrome bake-Hold radial knob
    kStripKey,        // a piano-strip key (index = MIDI note); carries the name tooltip
    kPopupClose,      // the curve popup's Close (x) button
};

// `index` disambiguates within a kind (tab ordinal, visible-card index, control-row id); -1
// when not applicable.
struct HoverTarget {
    HoverKind kind = HoverKind::kNone;
    int index = -1;
    bool operator==(const HoverTarget& o) const { return kind == o.kind && index == o.index; }
    bool operator!=(const HoverTarget& o) const { return !(*this == o); }
};

}  // namespace reasampler::vst
