-- $Date: 2004/03/08 10:42:42 $
-- $Revision: 1.7 $
-- $Author: jcrocholl $
-- $Hash: 1fa8fe98f5d450a1fcb9811831454bd6 $

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

with Integer_Strings; use Integer_Strings;
with Enum_Strings; use Enum_Strings;
with Messages; use Messages;
with String_Tools; use String_Tools;

package body Boxes.Clefs is

   -- Constructor for instances.
   function Create
     (Clef : in Clef_Access-- The initial clef.
     return Clef_Box_Access  -- The newly created clef box.
   is
      Result : Clef_Box_Access := new Clef_Box;
   begin
      Result.Clef := Clef;
      return Result;
   end Create;

   procedure Layout
     (This : access Clef_Box;    -- The clef box object instance.
      Font : access Font_Loader-- Use this font loader.
   is
      Sign : String := Get_Sign(This.Clef)'Img;
   begin
      if not Quiet then Debug("preparing clef layout"); end if;
      To_Lower(Sign);
      This.Glyph := Load_Glyph(Font, "clefs/hand/" & Sign);
      This.Offset := 300.0 - 100.0 * Real(Get_Line(This.Clef));
      This.Bounds := Get_Bounds(This.Glyph) + (0.0, This.Offset);
   end Layout;

   procedure Print
     (This   : access Clef_Box;           -- The clef box object instance.
      To     : access Printer'Class-- Render to this printer.
      Center : in Vector) is              -- Center of container.
   begin
      if not Quiet then Debug("printing clef"); end if;
      Print(To, This.Glyph, This.Center + (0.0, This.Offset));
   end Print;

end Boxes.Clefs;