-- $Date: 2004/03/08 10:42:42 $
-- $Revision: 1.8 $
-- $Author: jcrocholl $
-- $Hash: 13799f2df27fb98910a565d08238d6b9 $

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

with Ada.Tags; use Ada.Tags;
with Font_Loaders; use Font_Loaders;
with Printers; use Printers;
with Lists;
with Boxes.Clefs; use Boxes.Clefs;
with Boxes.Keys; use Boxes.Keys;
with Boxes.Times; use Boxes.Times;
with Boxes.Arcs; use Boxes.Arcs;
with Boxes.Chords; use Boxes.Chords;
with Music.Barlines; use Music.Barlines;

package Boxes.Measures is

   package Time_Lists is new Lists(Time_Box_Access);
   subtype Time_List is Time_Lists.List;
   subtype Time_List_Access is Time_Lists.List_Access;

   package Chord_Lists is new Lists(Chord_Box_Access);
   subtype Chord_List is Chord_Lists.List;
   subtype Chord_List_Access is Chord_Lists.List_Access;

   Bar_Line_Width    : constant := 12.0;
   Min_Measure_Width : constant := 600.0;

   -- Public representation.
   type Measure_Box is new Box with private;

   -- Work-around for GNAT bug.
   Measure_Box_Tag : constant String;

   -- Pointer to representation data.
   type Measure_Box_Access is access all Measure_Box;

   -- Constructor for instances.
   function Create
     return Measure_Box_Access-- The newly created measure box.

   -- Mutator to update the clef of a measure box.
   procedure Set_Clef
     (This : access Measure_Box;  -- The measure box to be updated.
      Clef : in Clef_Box_Access); -- The new clef of that measure box.

   -- Accessor to read the clef of a measure box.
   function Get_Clef
     (This : access Measure_Box-- The measure box to read from.
     return Clef_Box_Access;     -- The clef of that measure box.

   -- Mutator to update the key of a measure box.
   procedure Set_Key
     (This : access Measure_Box-- The measure box to be updated.
      Key  : in Key_Box_Access); -- The new key of that measure box.

   -- Accessor to read the key of a measure box.
   function Get_Key
     (This : access Measure_Box-- The measure box to read from.
     return Key_Box_Access;      -- The key of that measure box.

   -- Accessor to read the times of a measure box.
   function Get_Times
     (This : access Measure_Box-- The measure box to read from.
     return Time_List_Access;    -- The times of that measure box.

   -- Mutator to update the arc of a measure box.
   procedure Set_Arc
     (This : access Measure_Box-- The measure box to be updated.
      Arc  : in Arc_Box_Access); -- The new arc of that measure box.

   -- Accessor to read the arc of a measure box.
   function Get_Arc
     (This : access Measure_Box-- The measure box to read from.
     return Arc_Box_Access;      -- The arc of that measure box.

   -- Accessor to read the chords of a measure box.
   function Get_Chords
     (This : access Measure_Box-- The measure box to read from.
     return Chord_List_Access;   -- The chords of that measure box.

   -- Mutator to update the barline of a measure box.
   procedure Set_Barline
     (This    : access Measure_Box-- The measure box to be updated.
      Barline : in Bar_Style_Enum); -- The new barline of that measure box.

   -- Accessor to read the barline of a measure box.
   function Get_Barline
     (This : access Measure_Box-- The measure box to read from.
     return Bar_Style_Enum;      -- The barline of that measure box.

   procedure Add_Time
     (This : access Measure_Box-- The measure box object instance.
      Add  : access Time_Box);   -- Add this time signature.

   procedure Add_Chord
     (This : access Measure_Box-- The measure box object instance.
      Add  : access Chord_Box);  -- Add this chord.

   procedure Layout
     (This : access Measure_Box;  -- The measure box object instance.
      Font : access Font_Loader); -- Use this font loader.

   procedure Print
     (This   : access Measure_Box;        -- The measure box object instance.
      To     : access Printer'Class-- Write to this printer.
      Center : in Vector);                -- Center of container.

private

   -- Private representation.
   type Measure_Box is
     new Box with
      record
         Clef    : Clef_Box_Access;   -- Zero or one clef.
         Key     : Key_Box_Access;    -- Zero or one key signature.
         Times   : Time_List_Access;  -- Zero or more time signatures.
         Arc     : Arc_Box_Access;    -- Zero or one arc.
         Chords  : Chord_List_Access-- Zero or more chords.
         Barline : Bar_Style_Enum;    -- Style of right barline.
      end record;

   -- Work-around for GNAT bug.
   Measure_Box_Tag : constant String := "boxes.measures.measure_box";

end Boxes.Measures;