-- $Date: 2004/03/08 10:44:41 $
-- $Revision: 1.8 $
-- $Author: jcrocholl $
-- $Hash: c25c4f5f2addb7b861e3bb1e29e3955c $

-- This file was automatically created with ado.php.
-- Manual changes will be lost when it is updated.

package body Collectors.Graphic is

   -- Constructor for instances.
   function Create
     return Graphic_Collector_Access -- The newly created graphic collector.
   is
      Result : Graphic_Collector_Access := new Graphic_Collector;
   begin
      return Result;
   end Create;

   procedure Add_Stave
     (This : access Graphic_Collector) is -- The graphic collector object instance.
   begin
      if not Quiet then Debug("adding stave"); end if;
      This.Stave := Create;
   end Add_Stave;

   procedure Add_Measure
     (This : access Graphic_Collector) is -- The graphic collector object instance.
   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-- The graphic collector object instance.
      Add  : access Clef) is           -- Add this clef.
   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-- The graphic collector object instance.
      Add  : access Key) is            -- Add this key.
   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-- The graphic collector object instance.
      Add  : access Time) is           -- Add this time signature.
   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-- The graphic collector object instance.
      Set  : access Barline) is        -- Set this barline.
   begin
      Set_Barline(This.Measure, Get_Bar_Style(Set));
   end Set_Barline;

   procedure Add_Chord
     (This : access Graphic_Collector) is -- The graphic collector object instance.
   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-- The graphic collector object instance.
      Add  : access Note) is           -- Add this note.
   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-- The graphic collector object instance.
      Font : access Font_Loader) is    -- Use this font loader.
   begin
      Layout(This.Stave, Font);
   end Layout;

   procedure Print
     (This         : access Graphic_Collector;  -- The graphic collector object instance.
      To           : access Printer'Class-- Print to this output filter.
      Staff_Height : in Real) is                -- Output zoom factor.
   begin
      Set_Bounds(To, Get_Bounds(This.Stave), Staff_Height);
      Print(This.Stave, To, (0.0, 0.0));
   end Print;

end Collectors.Graphic;