summaryrefslogtreecommitdiff
path: root/src/glibext/linecolumn.h
blob: 308e6f4e6693f8e968821d5fcc0b936e83c3d106 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

/* Chrysalide - Outil d'analyse de fichiers binaires
 * linecolumn.h - prototypes pour le regroupement des segments de texte par colonnes
 *
 * Copyright (C) 2016-2017 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 _GLIBEXT_LINECOLUMN_H
#define _GLIBEXT_LINECOLUMN_H


#include <stdbool.h>
#include <glib-object.h>
#include <gdk/gdk.h>


#include "linesegment.h"



/* Informations sur le contenu d'une colonne */
typedef struct _line_column line_column;


/* Informations sur le contenu d'une colonne */
struct _line_column
{
    line_segment **segments;                /* Liste des segments contenus */
    size_t count;                           /* Taille de cette liste       */

    int max_width;                          /* Largeur max. de l'espace    */

};


/* Initialise une colonne de ligne. */
void init_line_column(line_column *);

/* Réinitialise une colonne de ligne. */
void reset_line_column(line_column *);

/* Recalcule la largeur d'une colonne de segments. */
void refresh_line_column_width(line_column *);

/* Fournit la quantité de pixels requise pour l'impression. */
gint get_column_width(const line_column *);

/* Ajoute un fragment de texte à une colonne de ligne. */
size_t append_text_to_line_column(line_column *, const char *, size_t, RenderingTagType);

/* Remplace un fragment de texte dans une colonne de ligne. */
void replace_text_in_line_column(line_column *, size_t, const char *, size_t);

/* Indique l'indice du premier contenu de la colonne. */
bool get_line_column_first_content_index(const line_column *, size_t *);

/* Indique l'indice du dernier contenu de la colonne. */
bool get_line_column_last_content_index(const line_column *, size_t *);

/* Fournit le segment voisin d'un autre segment identifié. */
bool find_near_segment(const line_column *, size_t *, GdkScrollDirection);

/* Indique l'indice du contenu de colonne à une abscisse donnée. */
bool get_line_column_content_index_at(const line_column *, gint *, GdkScrollDirection, gint *, size_t *);

/* Donne le segment d'une colonne présent à un indice donné. */
line_segment *get_line_column_content_from_index(const line_column *, size_t);

/* Imprime le contenu d'une colonne de ligne de texte. */
void draw_line_column_segments(const line_column *, cairo_t *, gint, gint, const segcnt_list *);

/* Donne le texte représenté par une colonne de ligne de texte. */
char *get_line_column_text(const line_column *, bool);

/* Exporte la ligne de texte représentée. */
void export_line_column_segments(const line_column *, buffer_export_context *, BufferExportType, int);



#endif  /* _GLIBEXT_LINECOLUMN_H */