text
stringlengths
0
234
end if;
end loop;
New_Line;
if Cle = 0 then
Etat.Menu := Menu_Principal;
else
Etat.Cle := Cle;
Etat.Menu := Menu_Arbre_Consultation;
end if;
end Afficher_Menu_Arbre_Selection;
-- Affiche les relations d'une personne.
procedure Afficher_Menu_Arbre_Consultation (Etat : in out T_Etat) is
-- Groupe toutes les relations de même étiquette ensemble.
procedure Afficher_Relations_Groupees
(Etat : in T_Etat; Etiquette : in T_Etiquette_Arete; Titre : in String)
is
Liste : T_Liste_Relations;
Relation : T_Arete_Etiquetee;
Titre_Affiche : Boolean := False;
begin
Liste_Relations (Liste, Etat.Arbre, Etat.Cle);
-- On affiche toutes les relations notées Etiquette
while Liste_Non_Vide (Liste) loop
Relation_Suivante (Liste, Relation);
if Relation.Etiquette = Etiquette then
if not Titre_Affiche then
Put_Line (Titre);
Titre_Affiche := True;
end if;
Put (" * ");
Afficher_Nom_Usuel (Etat, Relation.Destination);
New_Line;
end if;
end loop;
end Afficher_Relations_Groupees;
Liste : T_Liste_Relations;
Choix : Integer;
begin
Afficher_Nom_Usuel (Etat, Etat.Cle);
New_Line;
New_Line;
Liste_Relations (Liste, Etat.Arbre, Etat.Cle);
if not Liste_Non_Vide (Liste) then
Put_Line ("Aucune relation.");
else
Afficher_Relations_Groupees (Etat, A_Pour_Parent, "Parent(s) :");
Afficher_Relations_Groupees (Etat, A_Pour_Enfant, "Enfant(s) :");
Afficher_Relations_Groupees (Etat, A_Pour_Conjoint, "Conjoint(e) :");
end if;
New_Line;
Put_Line ("Menu :");
Put_Line ("1. Consulter dans le registre");
Put_Line ("2. Consulter une autre personne");
Put_Line ("3. Ajouter une relation");
Put_Line ("4. Supprimer une relation");
Put_Line ("5. Afficher un arbre de parenté");
Put_Line ("6. Retour");
New_Line;
Choisir (6, Choix);
New_Line;
case Choix is
when 1 =>
Etat.Menu := Menu_Registre_Consultation_Personne;
when 2 =>
Etat.Menu := Menu_Arbre_Selection;
when 3 =>
Etat.Menu := Menu_Arbre_Ajouter_Relation;
when 4 =>
Etat.Menu := Menu_Arbre_Supprimer_Relation;
when 5 =>
Etat.Menu := Menu_Arbre_Parente;
when 6 =>
Etat.Menu := Menu_Principal;
when others =>
Etat.Menu := Quitter;
end case;
end Afficher_Menu_Arbre_Consultation;
-- Permet d'ajouter une relation.
procedure Afficher_Menu_Arbre_Ajouter_Relation (Etat : in out T_Etat) is
Dates_Incompatibles : exception;
Personne_Origine : T_Personne;
Personne_Destination : T_Personne;
Cle_Destination : Integer;
Relation_Lue : Integer;
Correct : Boolean;
begin
Put_Line ("Ajouter une relation :");
Put_Line ("1. Ajouter un parent");
Put_Line ("2. Ajouter un enfant");
Put_Line ("3. Ajouter un conjoint");
New_Line;
Choisir (3, Relation_Lue);
New_Line;