[gimp] app: buncha more text tool fixes
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: buncha more text tool fixes
- Date: Sat, 20 Feb 2010 15:19:47 +0000 (UTC)
commit ec0f3bdcb83d9e42f11c0f9a4dbf9a0161e55a69
Author: Michael Natterer <mitch gimp org>
Date: Sat Feb 20 16:18:41 2010 +0100
app: buncha more text tool fixes
- hide the generated "empty" menu item in the IM submenu
- pause/resume the text tool around all selection/cursor/buffer changes
(fixes most drawing artifacts)
app/tools/gimptexttool-editor.c | 16 ++++++++++++++++
app/tools/gimptexttool.c | 22 ++++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index b5e0970..28fdce0 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -605,8 +605,12 @@ static void
gimp_text_tool_insert_at_cursor (GimpTextTool *text_tool,
const gchar *str)
{
+ gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
+
gtk_text_buffer_insert_interactive_at_cursor (text_tool->text_buffer,
str, -1, TRUE);
+
+ gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
static gboolean
@@ -727,7 +731,11 @@ gimp_text_tool_delete_from_cursor (GimpTextTool *text_tool,
if (! gtk_text_iter_equal (&cursor, &end))
{
+ gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
+
gtk_text_buffer_delete_interactive (buffer, &cursor, &end, TRUE);
+
+ gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
}
@@ -738,6 +746,8 @@ gimp_text_tool_backspace (GimpTextTool *text_tool)
gimp_text_tool_reset_im_context (text_tool);
+ gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
+
if (gtk_text_buffer_get_has_selection (buffer))
{
gtk_text_buffer_delete_selection (buffer, TRUE, TRUE);
@@ -751,6 +761,8 @@ gimp_text_tool_backspace (GimpTextTool *text_tool)
gtk_text_buffer_backspace (buffer, &cursor, TRUE, TRUE);
}
+
+ gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
static void
@@ -860,6 +872,8 @@ gimp_text_tool_enter_text (GimpTextTool *text_tool,
had_selection = gtk_text_buffer_get_has_selection (buffer);
+ gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
+
gimp_text_tool_delete_selection (text_tool);
if (! had_selection && text_tool->overwrite_mode && strcmp (str, "\n"))
@@ -874,6 +888,8 @@ gimp_text_tool_enter_text (GimpTextTool *text_tool,
}
gtk_text_buffer_insert_at_cursor (buffer, str, -1);
+
+ gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
static void
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 295b353..618ddf8 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -793,6 +793,7 @@ gimp_text_tool_get_popup (GimpTool *tool,
{
GimpDialogFactory *dialog_factory;
GtkWidget *im_menu;
+ GList *children;
dialog_factory = gimp_dialog_factory_from_name ("toplevel");
@@ -807,6 +808,14 @@ gimp_text_tool_get_popup (GimpTool *tool,
if (GTK_IS_MENU_ITEM (im_menu))
im_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (im_menu));
+ /* hide the generated "empty" item */
+ children = gtk_container_get_children (GTK_CONTAINER (im_menu));
+ while (children)
+ {
+ gtk_widget_hide (children->data);
+ children = g_list_remove (children, children->data);
+ }
+
gtk_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (text_tool->im_context),
GTK_MENU_SHELL (im_menu));
}
@@ -1836,7 +1845,11 @@ gimp_text_tool_delete_selection (GimpTextTool *text_tool)
{
if (gtk_text_buffer_get_has_selection (text_tool->text_buffer))
{
+ gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
+
gtk_text_buffer_delete_selection (text_tool->text_buffer, TRUE, TRUE);
+
+ gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
}
@@ -1852,7 +1865,12 @@ gimp_text_tool_cut_clipboard (GimpTextTool *text_tool)
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
GDK_SELECTION_CLIPBOARD);
+
+ gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
+
gtk_text_buffer_cut_clipboard (text_tool->text_buffer, clipboard, TRUE);
+
+ gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
void
@@ -1884,7 +1902,11 @@ gimp_text_tool_paste_clipboard (GimpTextTool *text_tool)
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (shell),
GDK_SELECTION_CLIPBOARD);
+ gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
+
gtk_text_buffer_paste_clipboard (text_tool->text_buffer, clipboard, NULL, TRUE);
+
+ gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]