diff options
Diffstat (limited to 'src/glibext/gbufferline.c')
-rw-r--r-- | src/glibext/gbufferline.c | 65 |
1 files changed, 54 insertions, 11 deletions
diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c index 95d6126..18f8a2a 100644 --- a/src/glibext/gbufferline.c +++ b/src/glibext/gbufferline.c @@ -61,7 +61,7 @@ static gint get_column_width(buffer_line_column *); static void add_segment_to_column(buffer_line_column *, GBufferSegment *); /* Donne le segment d'une colonne présent à une abscisse donnée. */ -static GBufferSegment *get_segment_at(const buffer_line_column *, gint); +static GBufferSegment *get_segment_at(const buffer_line_column *, gint *, bool); /* Met en surbrillance des segments similaires. */ GSList *highlight_all_same_segments(const buffer_line_column *, GSList *, const GBufferSegment *); @@ -194,7 +194,8 @@ static void add_segment_to_column(buffer_line_column *column, GBufferSegment *se /****************************************************************************** * * * Paramètres : column = colonne de ligne de texte à consulter. * -* x = position de recherche à ajuster. * +* x = position de recherche à ajuster. [OUT] * +* force = accepte les segments en bordure au pire. * * * * Description : Donne le segment d'une colonne présent à une abscisse donnée.* * * @@ -204,7 +205,7 @@ static void add_segment_to_column(buffer_line_column *column, GBufferSegment *se * * ******************************************************************************/ -static GBufferSegment *get_segment_at(const buffer_line_column *column, gint x) +static GBufferSegment *get_segment_at(const buffer_line_column *column, gint *x, bool force) { GBufferSegment *result; /* Trouvaille à retourner */ size_t i; /* Boucle de parcours */ @@ -216,11 +217,11 @@ static GBufferSegment *get_segment_at(const buffer_line_column *column, gint x) { width = g_buffer_segment_get_width(column->segments[i]); - if (width <= x) - x -= width; + if (width > *x || ((i + 1) == column->count && force)) + result = column->segments[i]; else - result = column->segments[i]; + *x -= width; } @@ -552,7 +553,8 @@ void g_buffer_line_add_segment(GBufferLine *line, BufferLineColumn index, GBuffe * * * Paramètres : line = ligne à venir consulter. * * max_widths = largeurs de colonne à respecter. * -* x = position à la colonne visée par la procédure. * +* x = position à la colonne visée. [OUT] * +* force = accepte les segments en bordure au pire. * * * * Description : Donne le segment présent à une abscisse donnée. * * * @@ -562,7 +564,7 @@ void g_buffer_line_add_segment(GBufferLine *line, BufferLineColumn index, GBuffe * * ******************************************************************************/ -GBufferSegment *g_buffer_line_get_segment_at(const GBufferLine *line, const gint max_widths[BLC_COUNT], gint x) +GBufferSegment *g_buffer_line_get_segment_at(const GBufferLine *line, const gint max_widths[BLC_COUNT], gint *x, bool force) { GBufferSegment *result; /* Trouvaille à retourner */ BufferLineColumn i; /* Boucle de parcours */ @@ -570,11 +572,22 @@ GBufferSegment *g_buffer_line_get_segment_at(const GBufferLine *line, const gint result = NULL; for (i = BLC_ADDRESS; i < BLC_COUNT; i++) - if (x < max_widths[i]) break; - else x -= (max_widths[i] + COL_MARGIN); + { + /* FIXME : addr/code */ + + if (*x < max_widths[i]) break; + else *x -= (max_widths[i] + COL_MARGIN); + + } + + if (i == BLC_COUNT && force) + { + i = BLC_COUNT - 1; + *x += (max_widths[i] + COL_MARGIN); + } if (i < BLC_COUNT) - result = get_segment_at(&line->columns[i], x); + result = get_segment_at(&line->columns[i], x, force); return result; @@ -583,6 +596,36 @@ GBufferSegment *g_buffer_line_get_segment_at(const GBufferLine *line, const gint /****************************************************************************** * * +* Paramètres : line = ligne à venir consulter. * +* caret = position du curseur à faire évoluer. * +* ctrl = indique la demande d'un parcours rapide. * +* dir = direction du parcours. * +* addr = indique si les positions doivent être affichées. * +* code = indique si le code binaire doit être affiché. * +* * +* Description : Déplace le curseur au sein d'une vue de tampon. * +* * +* Retour : true si un déplacement a été effectué, false sinon. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool g_buffer_line_move_caret(const GBufferLine *line, GdkRectangle *caret, bool ctrl, GdkScrollDirection dir, bool addr, bool code) +{ + + caret->x += (dir == GDK_SCROLL_RIGHT ? 10 : -10); + + return true; + + + return false; + +} + + +/****************************************************************************** +* * * Paramètres : line = ligne à venir consulter. * * list = liste de segments identiques à constituer. * * ref = segment de référence à comparer avec tous les autres. * |