summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/leaving.h
blob: c91f23250e70639ed94590d610610c5cc51b664d (plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

/* Chrysalide - Outil d'analyse de fichiers binaires
 * leaving.h - prototypes pour les liens sortants d'un bloc de code dans une représentation graphique
 *
 * Copyright (C) 2019 Cyrille Bagard
 *
 *  This file is part of Chrysalide.
 *
 *  Chrysalide is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Chrysalide is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Chrysalide.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef _GTKEXT_GRAPH_LEAVING_H
#define _GTKEXT_GRAPH_LEAVING_H


#include "cluster.h"


/* Depuis incoming.h : définition du tracé d'un lien */
typedef struct _incoming_link_t incoming_link_t;

/* Détails sur le départ d'un lien */
typedef struct _leaving_link_t
{
    GGraphCluster *owner;                   /* Propriétaire du lien        */

    GdkPoint start[2];                      /* Point de départ d'un lien   */
    size_t index;                           /* Indice sur ligne de départ  */

    bool straight;                          /* Présence d'une ligne droite */
    bool forced_straight;                   /* Forçage de verticalité      */
    size_t straight_level;                  /* Rang atteint en ligne droite*/
    bool cluster_exit;                      /* Sortie du cluster d'origine */

    incoming_link_t *other;                 /* Autre extrémité du lien     */

} leaving_link_t;


#define SHOULD_BE_VERTICAL(l) ((l)->straight || (l)->forced_straight || (l)->cluster_exit)


/* Crée un point d'attache pour un lien sortant. */
leaving_link_t *create_leaving_link(GGraphCluster *, size_t);

/* Détruit un point d'attache pour un lien sortant. */
void delete_leaving_link(leaving_link_t *);

/* Calcule l'abscisse d'un lien à son départ d'un bloc. */
gint compute_leaving_link_position(const leaving_link_t *);



#endif  /* _GTKEXT_GRAPH_LEAVING_H */