From 4e65369f88be90a012a0b16b353bcd8795858b16 Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Wed, 16 Aug 2006 00:14:43 -0500 Subject: [PATCH] Made moo_text_view_get_selection(), moo_text_view_move_cursor() generic methods for GtkTextView --- moo/mooedit/mootextview.c | 18 +++++++++--------- moo/mooedit/mootextview.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/moo/mooedit/mootextview.c b/moo/mooedit/mootextview.c index 70634cb7..f207ed2e 100644 --- a/moo/mooedit/mootextview.c +++ b/moo/mooedit/mootextview.c @@ -1238,15 +1238,15 @@ moo_text_tab_key_action_get_type (void) } -char* -moo_text_view_get_selection (MooTextView *view) +char * +moo_text_view_get_selection (gpointer view) { GtkTextBuffer *buf; GtkTextIter start, end; - g_return_val_if_fail (MOO_IS_TEXT_VIEW (view), NULL); + g_return_val_if_fail (GTK_IS_TEXT_VIEW (view), NULL); - buf = get_buffer (view); + buf = gtk_text_view_get_buffer (view); if (gtk_text_buffer_get_selection_bounds (buf, &start, &end)) return gtk_text_buffer_get_slice (buf, &start, &end, TRUE); @@ -1405,7 +1405,7 @@ moo_text_view_set_indenter (MooTextView *view, typedef struct { - MooTextView *view; + GtkTextView *view; int line; int character; gboolean visual; @@ -1433,7 +1433,7 @@ do_move_cursor (Scroll *scroll) g_return_val_if_fail (MOO_IS_TEXT_VIEW (scroll->view), FALSE); g_return_val_if_fail (scroll->line >= 0, FALSE); - buffer = get_buffer (scroll->view); + buffer = gtk_text_view_get_buffer (scroll->view); if (scroll->line >= gtk_text_buffer_get_line_count (buffer)) scroll->line = gtk_text_buffer_get_line_count (buffer) - 1; @@ -1483,7 +1483,7 @@ do_move_cursor (Scroll *scroll) } gtk_text_buffer_place_cursor (buffer, &iter); - gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (scroll->view), + gtk_text_view_scroll_to_mark (scroll->view, gtk_text_buffer_get_insert (buffer), 0.2, FALSE, 0, 0); @@ -1493,7 +1493,7 @@ do_move_cursor (Scroll *scroll) void -moo_text_view_move_cursor (MooTextView *view, +moo_text_view_move_cursor (gpointer view, int line, int offset, gboolean offset_visual, @@ -1501,7 +1501,7 @@ moo_text_view_move_cursor (MooTextView *view, { Scroll *scroll; - g_return_if_fail (MOO_IS_TEXT_VIEW (view)); + g_return_if_fail (GTK_IS_TEXT_VIEW (view)); scroll = g_new (Scroll, 1); scroll->view = view; diff --git a/moo/mooedit/mootextview.h b/moo/mooedit/mootextview.h index cb87d22f..4bfc1ee8 100644 --- a/moo/mooedit/mootextview.h +++ b/moo/mooedit/mootextview.h @@ -101,7 +101,7 @@ GtkWidget *moo_text_view_new (void); void moo_text_view_select_all (MooTextView *view); -char *moo_text_view_get_selection (MooTextView *view); +char *moo_text_view_get_selection (gpointer view); char *moo_text_view_get_text (MooTextView *view); gboolean moo_text_view_has_selection (MooTextView *view); gboolean moo_text_view_has_text (MooTextView *view); @@ -126,7 +126,7 @@ void moo_text_view_set_indenter (MooTextView *view, void moo_text_view_get_cursor (MooTextView *view, GtkTextIter *iter); int moo_text_view_get_cursor_line (MooTextView *view); -void moo_text_view_move_cursor (MooTextView *view, +void moo_text_view_move_cursor (gpointer view, int line, int offset, gboolean offset_visual,