-- Author: John Maxwell
-- last modified: November 9, 1981  9: 07 AM
-- Last Edited by: Maxwell, November 21, 1983 9:19 am

DIRECTORY
      Graphics: FROM "Graphics", 
    MusicDefs: FROM "MusicDefs";

Selection: DEFINITIONS
	IMPORTS MusicDefs = 
BEGIN
OPEN MusicDefs;

selection: SelectionPTR;

AddGreyLine: PROCEDURE[score: ScorePTR, time1, time2: Time];
AddLine: PROCEDURE[score: ScorePTR, time1, time2: Time];
AddNote: PROCEDURE[score: ScorePTR, n: NotePTR]; -- use clear to clear current selection
Clear: PROCEDURE;
Draw: PROCEDURE;
RemoveNote: PROCEDURE[n: NotePTR];
Enumerate: PROCEDURE[proc: PROC[ScorePTR, NotePTR]];

-- ****************************************************************************
-- procedures that take the current selection as an implicit parameter
-- ****************************************************************************

ClearBeam: PROCEDURE;
ClearChord: PROCEDURE;
ClearSync: PROCEDURE; -- may raise Piece.Overflow
ClearTie: PROCEDURE;
Delete: PROCEDURE;
HideNTuplets: PROCEDURE[invisible: BOOLEAN];
MakeBeam: PROCEDURE[beamed: BOOLEAN ← TRUE];
MakeBeamOfBeams: PROCEDURE[beamed: BOOLEAN ← TRUE];
MakeChord: PROCEDURE;
MakeNTuplet: PROCEDURE[n, a: INTEGER];
MakeNTupletOfBeams: PROCEDURE[n, a: INTEGER];
MakeSync: PROCEDURE;
MakeTie: PROCEDURE;
SetGrace: PROCEDURE[grace: BOOLEAN];
SetNoteValue: PROCEDURE[v: NoteValue, dots: INTEGER];
SetRest: PROCEDURE[rest: BOOLEAN];
SetStaff: PROCEDURE[staff: CARDINAL];
SetStem: PROCEDURE[stemUp: BOOLEAN];
Transpose: PROCEDURE[halfsteps: INTEGER];

END..

Includes: PROCEDURE[n: NotePTR] RETURNS[BOOLEAN] = INLINE
   {IF selection.voice # noVoice AND n.voice # selection.voice THEN RETURN[FALSE];
	IF selection.lineSelect
		THEN RETURN[n.sync.time IN [selection.select1..selection.select2)]
		ELSE FOR i: CARDINAL IN [0..selection.length) DO
			IF selection.note[i] = n THEN RETURN[TRUE];
			ENDLOOP;
	RETURN[FALSE]};