Implement insert_at_cursor() so bindings can insert text

This commit is contained in:
Michael Natterer 2009-06-24 21:31:39 +02:00
parent 92a89666cf
commit e78bda44b3
2 changed files with 22 additions and 0 deletions

View File

@ -135,6 +135,8 @@ static void gimp_text_tool_move_cursor (GimpTextTool *text_tool,
GtkMovementStep step,
gint count,
gboolean extend_selection);
static void gimp_text_tool_insert_at_cursor (GimpTextTool *text_tool,
const gchar *str);
static void gimp_text_tool_delete_from_cursor (GimpTextTool *text_tool,
GtkDeleteType type,
gint count);
@ -1379,6 +1381,9 @@ gimp_text_tool_ensure_proxy (GimpTextTool *text_tool)
g_signal_connect_swapped (text_tool->proxy_text_view, "move-cursor",
G_CALLBACK (gimp_text_tool_move_cursor),
text_tool);
g_signal_connect_swapped (text_tool->proxy_text_view, "insert-at-cursor",
G_CALLBACK (gimp_text_tool_insert_at_cursor),
text_tool);
g_signal_connect_swapped (text_tool->proxy_text_view, "delete-from-cursor",
G_CALLBACK (gimp_text_tool_delete_from_cursor),
text_tool);
@ -1598,6 +1603,14 @@ gimp_text_tool_move_cursor (GimpTextTool *text_tool,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
static void
gimp_text_tool_insert_at_cursor (GimpTextTool *text_tool,
const gchar *str)
{
gtk_text_buffer_insert_interactive_at_cursor (text_tool->text_buffer,
str, -1, TRUE);
}
static gboolean
is_whitespace (gunichar ch,
gpointer user_data)

View File

@ -29,6 +29,8 @@ static void gimp_text_proxy_move_cursor (GtkTextView *text_view,
GtkMovementStep step,
gint count,
gboolean extend_selection);
static void gimp_text_proxy_insert_at_cursor (GtkTextView *text_view,
const gchar *str);
static void gimp_text_proxy_delete_from_cursor (GtkTextView *text_view,
GtkDeleteType type,
gint count);
@ -47,6 +49,7 @@ gimp_text_proxy_class_init (GimpTextProxyClass *klass)
GtkTextViewClass *tv_class = GTK_TEXT_VIEW_CLASS (klass);
tv_class->move_cursor = gimp_text_proxy_move_cursor;
tv_class->insert_at_cursor = gimp_text_proxy_insert_at_cursor;
tv_class->delete_from_cursor = gimp_text_proxy_delete_from_cursor;
tv_class->backspace = gimp_text_proxy_backspace;
tv_class->cut_clipboard = gimp_text_proxy_cut_clipboard;
@ -67,6 +70,12 @@ gimp_text_proxy_move_cursor (GtkTextView *text_view,
{
}
static void
gimp_text_proxy_insert_at_cursor (GtkTextView *text_view,
const gchar *str)
{
}
static void
gimp_text_proxy_delete_from_cursor (GtkTextView *text_view,
GtkDeleteType type,