Sheet.mesa
Copyright (C) 1982, 1983, 1984 Xerox Corporation. All rights reserved.
Author: John Maxwell
last modified: May 19, 1982 9: 11 am
Last Edited by: Maxwell, November 22, 1983 8:19 am
Last Edited by: Doug Wyatt, June 18, 1984 12:39:58 pm PDT
DIRECTORY
MusicDefs USING [ColorType, NotePTR, ScorePTR, SheetPTR, StavesPTR, Time];
Sheet: CEDAR DEFINITIONS
= BEGIN
OPEN MusicDefs;
New: PROC[length: CARDINAL] RETURNS[sheet: SheetPTR];
Free: PROC[sheet: SheetPTR];
Reset: PROC[score: ScorePTR]; -- reconstructs the sheet from the score
Scale: PROC[score: ScorePTR, newScale: INTEGER]; -- causes a Reset
SetBegin: PROC[sheet: SheetPTR, now: Time];
Scroll: PROC[sheet: SheetPTR, lines: INTEGER]; -- "currentLine ← currentLine+lines"
Draw: PROC[sheet: SheetPTR]; -- draws what is currently visible
DrawKey: PROC[sheet: SheetPTR, key, oldKey: INTEGER, time: Time];
DrawClef: PROC[sheet: SheetPTR, pitch, staff: INTEGER, time: Time];
DrawOctava: PROC[sheet: SheetPTR, pitch, staff, height: INTEGER, t1, t2: Time];
HiLite: PROC[sheet: SheetPTR, texture: ColorType, t1, t2: Time];
FindLine: PROC[sheet: SheetPTR, t: Time] RETURNS[INTEGER];
FindSection: PROC[sheet: SheetPTR, t: Time] RETURNS[INTEGER];
INLINE Procedures
FindStaves: PROC[sheet: SheetPTR, t: Time] RETURNS[StavesPTR];
Last: PROC[sheet: SheetPTR, l: CARDINAL] RETURNS[CARDINAL];
LineNumber: PROC[sheet: SheetPTR, l: CARDINAL] RETURNS[n: CARDINAL ← 1];
NextLine: PROC[sheet: SheetPTR, l: CARDINAL] RETURNS[CARDINAL];
NextStaff: PROC[sheet: SheetPTR, s: CARDINAL, t: Time] RETURNS[CARDINAL];
NormalPitch: PROC[sheet: SheetPTR, staff: CARDINAL] RETURNS[INTEGER];
PriorLine: PROC[sheet: SheetPTR, l: CARDINAL] RETURNS[CARDINAL];
PriorStaff: PROC[sheet: SheetPTR, s: CARDINAL, t: Time] RETURNS[CARDINAL];
OctavaHeight: PROC[pitch, height: INTEGER] RETURNS[INTEGER];
*************************************************************************
mapping from sheet to screen and vice-versa
*************************************************************************
NotePTR => [Time, Pitch, Staff] => [Time, Height] => ScreenPoint; UNAMBIGUOUSLY!
[Time, Height] < = ScreenPoint; ambiguous when point is between lines
[Time, Pitch, Staff] < = [Time, Height]; ambiguous between staffs
NotePTR < = [Time, Pitch, Staff]; ambiguous because of graphical adjustments
default: INTEGER = 1000;
AlternateTime: PROC[sheet: SheetPTR, t1: Time, h1, lines: INTEGER]
RETURNS[time: Time, height: INTEGER]; -- points on the screen are ambiguous
Height: PROC[sheet: SheetPTR, t: Time, pitch: INTEGER ← default, staff: CARDINAL]
RETURNS[INTEGER]; -- defaults to the bottom of the staff
NearestStaff: PROC[sheet: SheetPTR, t: Time, height: INTEGER]
RETURNS[INTEGER];
NearestTime: PROC[sheet: SheetPTR, x, y: INTEGER ← default]
RETURNS[time: Time, height: INTEGER]; -- defaults to the position of the mouse
Map: PROC[sheet: SheetPTR, t: Time, pitch: INTEGER ← default, staff: CARDINAL]
RETURNS[x, y: INTEGER]; -- defaults to the bottom of the staff
MapHeight: PROC[sheet: SheetPTR, t: Time, height: INTEGER]
RETURNS[x, y: INTEGER];
MapNote: PROC[sheet: SheetPTR, n: NotePTR]
RETURNS[x, y: INTEGER];
Pitch: PROC[sheet: SheetPTR, t: Time, height: INTEGER, staff: CARDINAL]
RETURNS[INTEGER];
ScreenPoint: PROC[sheet: SheetPTR] RETURNS[x, y: INTEGER]; -- position of the mouse
END..