emdee_0.2.1_514ac5e1/src/session.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--  SPDX-License-Identifier: GPL-3.0-or-later
--  SPDX-FileCopyrightText: Copyright 2024 Stephen Merrony

with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;   use Ada.Strings.Unbounded;

with TOML;      use TOML;

with Track;     use Track;

package Session is

   package Track_Vectors is new Ada.Containers.Vectors (
      Index_Type => Positive,
      Element_Type => Track_T
   );

   type Session_T is record
      Desc,
      Comment   : Unbounded_String;
      MIDI_Port : Unbounded_String;
      Updated   : TOML.Any_Local_Datetime;
      Tracks    : Track_Vectors.Vector;
      Lead_In_Silence : Natural;
      Font_Size : Unbounded_String;
      Filename  : Unbounded_String;       --  Not stored in TOML
   end record;

   Sess : Session_T;

   --  TOML exceptions
   Already_Exists,
   Could_Not_Parse,
   Duplicate_Configuration,
   Incomplete_Configuration,
   Unknown_Configuration_Item : exception;

   procedure Load_Session (Filename : String);
   procedure Save_Session (Filename : String);
   procedure Clear_Session;
   procedure Set_Dirty;
   procedure Set_Clean;
   function  Is_Dirty return Boolean;

private

   Dirty_Flag : Boolean := False;

end Session;