summaryrefslogtreecommitdiff
path: root/src/gtkext
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext')
-rw-r--r--src/gtkext/gtkblockview.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c
index 70cd8ea..5c5d0f6 100644
--- a/src/gtkext/gtkblockview.c
+++ b/src/gtkext/gtkblockview.c
@@ -43,6 +43,9 @@
#endif
+static void gtk_block_view_compute_real_coord(GtkBlockView *view, gint *x, gint *y);
+
+
/* -------------------------- INSERTION DIFFEREE DE LIGNES -------------------------- */
@@ -638,26 +641,35 @@ static gboolean gtk_block_view_button_press(GtkWidget *widget, GdkEventButton *e
{
gboolean result; /* Décision à retourner */
GtkBlockView *view; /* Composant GTK réel */
- GtkTextIter iter; /* Point d'insertion */
- GtkTextMark *mark; /* Marquage de ligne associée */
- GRenderingLine *line; /* Ligne de rendu */
+ gint real_x; /* Abscisse réelle du point */
+ gint real_y; /* Ordonnée réelle du point */
+ GBufferLine *bline; /* Ligne intégrée au tampon */
+ GRenderingLine *line; /* Ligne de rendu interne */
result = FALSE;
-#if 0
- view = GTK_BLOCK_VIEW(widget);
- gtk_text_layout_get_line_at_y(view->layout, &iter, event->y, NULL);
- mark = gtk_text_iter_get_marks(&iter)->data;
+ view = GTK_BLOCK_VIEW(widget);
- line = g_object_get_data(G_OBJECT(mark), "line");
+ real_x = event->x;
+ real_y = event->y;
+ gtk_block_view_compute_real_coord(view, &real_x, &real_y);
/* Clic dans la marge */
- if (event->type == GDK_BUTTON_PRESS && event->x < view->left_margin)
+ if (event->type == GDK_BUTTON_PRESS && real_x < view->left_margin)
{
- result = TRUE;
- g_rendering_line_toggle_flag(line, RLF_BREAK_POINT);
+ bline = g_buffer_view_find_line_at(view->buffer_view, real_y);
+
+ if (bline != NULL)
+ {
+ line = G_RENDERING_LINE(g_object_get_data(G_OBJECT(bline), "line"));
+
+ result = TRUE;
+ g_rendering_line_toggle_flag(line, RLF_BREAK_POINT);
+
+ }
+
}
-#endif
+
return result;
}
@@ -733,11 +745,11 @@ static void gtk_block_view_compute_fake_coord(GtkBlockView *view, gint *x, gint
static void gtk_block_view_compute_real_coord(GtkBlockView *view, gint *x, gint *y)
{
- if (GTK_BIN_VIEW(view)->hadjustment != NULL)
+ if (x != NULL && GTK_BIN_VIEW(view)->hadjustment != NULL)
*x += gtk_adjustment_get_value(GTK_BIN_VIEW(view)->hadjustment);
- if (GTK_BIN_VIEW(view)->vadjustment != NULL)
- *y -= gtk_adjustment_get_value(GTK_BIN_VIEW(view)->vadjustment);
+ if (y != NULL && GTK_BIN_VIEW(view)->vadjustment != NULL)
+ *y += gtk_adjustment_get_value(GTK_BIN_VIEW(view)->vadjustment);
}
@@ -1039,11 +1051,11 @@ static void gtk_block_view_complete_building_content(GDelayedInsertion *insertio
gdk_threads_enter();
/* Taille des marges */
-#if 0
- view->line_height = rect.height;
- view->left_margin = 2 * rect.height;
- view->left_text = -2.5 * rect.height;
-#endif
+
+ view->line_height = g_buffer_view_get_line_height(view->buffer_view);
+ view->left_margin = 2 * view->line_height;
+ view->left_text = -2.5 * view->line_height;
+
/* Validation finale */
gtk_block_view_recompute_size_request(view);