import React from 'react'; import { FaMousePointer, FaPencilAlt } from 'react-icons/fa'; import { KGDropdown } from '../common'; import { KGPianoRollState } from '../../core/state/KGPianoRollState'; import { KGCore } from '../../core/KGCore'; const POWER_OPTIONS = [ { label: 'Linear', value: '1.0' }, { label: '√ (default)', value: '0.5' }, { label: 'Mild', value: '0.4' }, { label: 'Strong', value: '0.3' }, ]; interface PianoRollToolbarProps { activeTool: 'pointer' | 'pencil'; onToolSelect: (tool: 'pointer' | 'pencil') => void; quantPosition: string; quantLength: string; onQuantSelect: (type: 'position' | 'length', value: string) => void; snapping: string; onSnappingSelect: (value: string) => void; selectedMode: string; onModeChange: (value: string) => void; chordGuide: string; onChordGuideChange: (value: string) => void; blinkButton?: string | null; mode?: 'midi-edit' | 'spectrogram' | 'hybrid'; thresholdDb?: number; onThresholdChange?: (db: number) => void; power?: number; onPowerChange?: (power: number) => void; } const PianoRollToolbar: React.FC = ({ activeTool, onToolSelect, quantPosition, quantLength, onQuantSelect, snapping, onSnappingSelect, selectedMode, onModeChange, chordGuide, onChordGuideChange, blinkButton = null, mode = 'midi-edit', thresholdDb = -25, onThresholdChange, power = 0.5, onPowerChange, }) => { const isSpectrogram = mode === 'spectrogram'; const showMidiControls = mode !== 'spectrogram'; // midi-edit and hybrid const showSpecControls = mode === 'spectrogram' || mode === 'hybrid'; return (
{showMidiControls && (
({ label: data.name, value: id }))} value={selectedMode} onChange={(value) => onModeChange(value)} label="Mode" buttonClassName="mode-dropdown" showValueAsLabel={true} /> onChordGuideChange(value)} label="Chord" buttonClassName="chord-guide-dropdown" showValueAsLabel={true} />
)}
{showMidiControls && ( <> onSnappingSelect(value)} label="Snap" buttonClassName="snapping" showValueAsLabel={true} /> onQuantSelect('position', value)} label="Qua. Pos." buttonClassName={`quant-position ${blinkButton === 'quant-position' ? 'button-blink' : ''}`} /> onQuantSelect('length', value)} label="Qua. Len." buttonClassName={`quant-length ${blinkButton === 'quant-length' ? 'button-blink' : ''}`} /> )} {showSpecControls && (
Floor onThresholdChange?.(parseInt(e.target.value))} title={`Noise floor: ${thresholdDb} dB`} /> {thresholdDb} dB onPowerChange?.(parseFloat(v))} label="Curve" buttonClassName="curve-dropdown" showValueAsLabel={true} />
)}
); }; export default PianoRollToolbar;