summaryrefslogtreecommitdiff
path: root/src/glibext/gbuffersegment.h
blob: d570e89d1fbb633ba7de6ee6fa0598b67a96317d (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

/* Chrysalide - Outil d'analyse de fichiers binaires
 * gbuffersegment.h - prototypes pour la concentration d'un fragment de caractères aux propriétés communes
 *
 * Copyright (C) 2010-2014 Cyrille Bagard
 *
 *  This file is part of Chrysalide.
 *
 *  OpenIDA 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.
 *
 *  OpenIDA 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef _GLIBEXT_GBUFFERSEGMENT_H
#define _GLIBEXT_GBUFFERSEGMENT_H


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



#define G_TYPE_BUFFER_SEGMENT                  (g_buffer_segment_get_type())
#define G_BUFFER_SEGMENT(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_BUFFER_SEGMENT, GBufferSegment))
#define G_BUFFER_SEGMENT_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_BUFFER_SEGMENT, GBufferSegmentClass))
#define G_IS_BUFFER_SEGMENT(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_BUFFER_SEGMENT))
#define G_IS_BUFFER_SEGMENT_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_BUFFER_SEGMENT))
#define G_BUFFER_SEGMENT_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BUFFER_SEGMENT, GBufferSegmentClass))


/* Types de partie de rendu */
typedef enum _RenderingTagType
{
    RTT_RAW,                                /* Contenu brut                */

    RTT_COMMENT,                            /* Commentaire                 */
    RTT_INDICATION,                         /* Aide à la lecture           */
    RTT_RAW_CODE,                           /* Code binaire brut           */

    RTT_INSTRUCTION,                        /* Code binaire brut           */

    RTT_IMMEDIATE,                          /* Valeur immédiate            */

    RTT_REGISTER,                           /* Registre                    */

    RTT_PUNCT,                              /* Signes de ponctuation       */
    RTT_HOOK,                               /* Crochets '[' et ']'         */
    RTT_SIGNS,                              /* Signes '+', '-' et '*'      */
    RTT_LTGT,                               /* Caractères '<' et '>'       */

    RTT_SECTION,                            /* Identifiant de section      */
    RTT_SEGMENT,                            /* Indication de segment       */
    RTT_STRING,                             /* Chaîne de caractères avec " */

    RTT_VAR_NAME,                           /* Nom de variable             */

    RTT_KEY_WORD,                           /* Mot clef de langage         */

    RTT_ERROR,                              /* Erreur "interne"            */

    RTT_COUNT

} RenderingTagType;

/* Types de rendus */
typedef enum _SegRenderingStyle
{
    SRS_CLASSIC,                            /* Comportement par défaut     */
    SRS_HIGHLIGHT_SAME,                     /* Surlignage des identiques   */

    SRS_COUNT

} SegRenderingStyle;

/* Types d'exportation */
typedef enum _BufferExportType
{
    BET_TEXT,

    BET_COUNT

} BufferExportType;


/* Fragment de caractères aux propriétés communes (instance) */
typedef struct _GBufferSegment GBufferSegment;

/* Fragment de caractères aux propriétés communes (classe) */
typedef struct _GBufferSegmentClass GBufferSegmentClass;



/* Détermine le type du fragment de caractères aux propriétés communes. */
GType g_buffer_segment_get_type(void);

/* Crée un nouveau fragment de texte avec des propriétés. */
GBufferSegment *g_buffer_segment_new(RenderingTagType, const char *, size_t);

/* Indique si les textes de deux segments sont identiques. */
bool g_buffer_segment_compare(const GBufferSegment *, const GBufferSegment *);

/* Fournit le texte brut conservé dans le segment. */
const char *g_buffer_segment_get_text(const GBufferSegment *);

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

/* Fournit la position idéale pour un marqueur. */
gint g_buffer_segment_get_caret_position(const GBufferSegment *, gint);

/* Module l'apparence finale du composant. */
void g_buffer_segment_set_style(GBufferSegment *, SegRenderingStyle);

/* Imprime le fragment de texte représenté. */
void g_buffer_segment_draw(GBufferSegment *, cairo_t *, gint *, gint);



#endif  /* _GLIBEXT_GBUFFERSEGMENT_H */