/// <reference path="../../pxtlib.d.ts" />
import * as Blockly from "blockly";
import { FieldCustomOptions, FieldCustom } from "./field_utils";
export interface FieldNoteOptions extends FieldCustomOptions {
    editorColour?: string;
    minNote?: string;
    maxNote?: string;
    eps?: string;
}
export declare class FieldNote extends Blockly.FieldNumber implements FieldCustom {
    isFieldCustom_: boolean;
    SERIALIZABLE: boolean;
    isTextValid_: boolean;
    private static Notes;
    protected static readonly keyWidth = 22;
    protected static readonly keyHeight = 90;
    protected static readonly labelHeight = 24;
    protected static readonly prevNextHeight = 20;
    protected static readonly notesPerOctave = 12;
    protected static readonly blackKeysPerOctave = 5;
    /**
     * default number of piano keys
     */
    protected nKeys_: number;
    protected minNote_: number;
    protected maxNote_: number;
    /** Absolute error for note frequency identification (Hz) **/
    protected eps: number;
    protected primaryColour: string;
    protected borderColour: string;
    protected isExpanded: Boolean;
    protected totalPlayCount: number;
    protected currentPage: number;
    protected piano: HTMLDivElement[];
    protected noteLabel: HTMLDivElement;
    protected currentSelectedKey: HTMLDivElement;
    constructor(text: string, params: FieldNoteOptions, validator?: Blockly.FieldValidator);
    /**
     * Ensure that only a non negative number may be entered.
     * @param {string} text The user's text.
     * @return A string representing a valid positive number, or null if invalid.
     */
    doClassValidation_(text: string): number;
    /**
     * Return the current note frequency.
     * @return Current note in string format.
     */
    getValue(): string;
    /**
     * Called by setValue if the text input is valid. Updates the value of the
     * field, and updates the text of the field if it is not currently being
     * edited (i.e. handled by the htmlInput_).
     * @param {string} note The new note in string format.
     */
    doValueUpdate_(note: string): void;
    /**
     * Get the text from this field
     * @return Current text.
     */
    getText(): string;
    getFieldDescription(): string;
    private getNoteString;
    /**
     * This block shows up differently when it's being edited;
     * on any transition between `editing <--> not-editing`
     * or other change in state,
     * refresh the text to get back into a valid state.
     **/
    protected refreshText(): void;
    onFinishEditing_(text: string): void;
    protected onHide(): void;
    protected widgetDispose_(): void;
    /**
     * Create a piano under the note field.
     */
    showEditor_(e: Event): void;
    protected keyHandler: (ev: KeyboardEvent) => void;
    protected playKey(key: HTMLDivElement, frequency: number): void;
    /**
     * Close the note picker if this input is being deleted.
     */
    dispose(): void;
    private updateColor;
    protected setPage(page: number): void;
    /**
     * create a DOM to assign a style to the previous and next buttons
     * @param pianoWidth the width of the containing piano
     * @param isPrev true if is previous button, false otherwise
     * @return DOM with the new css style.s
     */
    protected getNextPrevDiv(isPrev: boolean, pianoWidth: number): HTMLDivElement;
    protected getKeyDiv(keyInd: number, leftPosition: number): HTMLDivElement;
    /**
     * @param idx index of the key
     * @return true if idx is white
     */
    protected isWhite(idx: number): boolean;
    protected whiteKeysBefore(idx: number): number;
    /**
     * get width of the piano key
     * @param idx index of the key
     * @return width of the key
     */
    protected getKeyWidth(idx: number): number;
    /**
     * get height of the piano key
     * @param idx index of the key
     * @return height of the key
     */
    protected getKeyHeight(idx: number): number;
    protected getNeighboringKeys(freq: number): {
        keyAbove: number;
        keyBelow: number;
    };
    protected getKeyFreq(keyIndex: number): number;
    protected getKeyName(keyIndex: number): string;
    private getKeyNoteData;
    /**
     * get the position of the key in the piano
     * @param idx index of the key
     * @return position of the key
     */
    protected getPosition(idx: number): number;
    private prepareNotes;
}
