Hosted by
|
package body Collectors.Graphic is
function Create
return Graphic_Collector_Access
is
Result : Graphic_Collector_Access := new Graphic_Collector;
begin
return Result;
end Create;
procedure Add_Stave
(This : access Graphic_Collector) is
begin
if not Quiet then Debug("adding stave"); end if;
This.Stave := Create;
end Add_Stave;
procedure Add_Measure
(This : access Graphic_Collector) is
begin
if not Quiet then Debug("adding measure"); end if;
This.Measure := Create;
Add_Measure(This.Stave, This.Measure);
end Add_Measure;
procedure Add_Clef
(This : access Graphic_Collector;
Add : access Clef) is
begin
if not Quiet then Debug("adding clef"); end if;
This.Middle_C := Get_Middle_C(Add);
if not Quiet then Debug("middle C: " & This.Middle_C'Img); end if;
Set_Clef(This.Measure, Boxes.Clefs.Create(Clef_Access(Add)));
end Add_Clef;
procedure Add_Key
(This : access Graphic_Collector;
Add : access Key) is
begin
if not Quiet then Debug("adding key"); end if;
Set_Key(This.Measure, Boxes.Keys.Create(Key_Access(Add), This.Middle_C));
end Add_Key;
procedure Add_Time
(This : access Graphic_Collector;
Add : access Time) is
begin
if not Quiet then Debug("adding time"); end if;
Add_Time(This.Measure, Boxes.Times.Create(Time_Access(Add)));
end Add_Time;
procedure Set_Barline
(This : access Graphic_Collector;
Set : access Barline) is
begin
Set_Barline(This.Measure, Get_Bar_Style(Set));
end Set_Barline;
procedure Add_Chord
(This : access Graphic_Collector) is
begin
if not Quiet then Debug("adding chord"); end if;
This.Chord := Create;
Add_Chord(This.Measure, This.Chord);
end Add_Chord;
procedure Add_Note
(This : access Graphic_Collector;
Add : access Note) is
begin
if not Quiet then Debug("adding note"); end if;
Add_Note(This.Chord, Add, This.Middle_C);
end Add_Note;
procedure Layout
(This : access Graphic_Collector;
Font : access Font_Loader) is
begin
Layout(This.Stave, Font);
end Layout;
procedure Print
(This : access Graphic_Collector;
To : access Printer'Class;
Staff_Height : in Real) is
begin
Set_Bounds(To, Get_Bounds(This.Stave), Staff_Height);
Print(This.Stave, To, (0.0, 0.0));
end Print;
end Collectors.Graphic;
|