[gimp] Simplify and clean up text tool clipboard handling.
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Subject: [gimp] Simplify and clean up text tool clipboard handling.
- Date: Sat, 27 Jun 2009 19:52:29 +0000 (UTC)
commit bcfaed96d2c66394461ef57b47d17830e5f3b442
Author: Michael Natterer <mitch gimp org>
Date: Sat Jun 27 21:51:52 2009 +0200
Simplify and clean up text tool clipboard handling.
app/actions/text-tool-commands.c | 6 ++--
app/tools/gimptexttool.c | 61 +++++++++++++------------------------
app/tools/gimptexttool.h | 8 ++---
3 files changed, 28 insertions(+), 47 deletions(-)
---
diff --git a/app/actions/text-tool-commands.c b/app/actions/text-tool-commands.c
index 5e4317c..2b6b616 100644
--- a/app/actions/text-tool-commands.c
+++ b/app/actions/text-tool-commands.c
@@ -57,7 +57,7 @@ text_tool_cut_cmd_callback (GtkAction *action,
{
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
- gimp_text_tool_clipboard_cut (text_tool);
+ gimp_text_tool_cut_clipboard (text_tool);
}
void
@@ -66,7 +66,7 @@ text_tool_copy_cmd_callback (GtkAction *action,
{
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
- gimp_text_tool_clipboard_copy (text_tool, TRUE);
+ gimp_text_tool_copy_clipboard (text_tool);
}
void
@@ -75,7 +75,7 @@ text_tool_paste_cmd_callback (GtkAction *action,
{
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
- gimp_text_tool_clipboard_paste (text_tool, TRUE);
+ gimp_text_tool_paste_clipboard (text_tool);
}
void
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 82a3190..ac44ccb 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -140,9 +140,6 @@ static void gimp_text_tool_delete_from_cursor (GimpTextTool *text_tool,
GtkDeleteType type,
gint count);
static void gimp_text_tool_backspace (GimpTextTool *text_tool);
-static void gimp_text_tool_cut_clipboard (GimpTextTool *text_tool);
-static void gimp_text_tool_copy_clipboard (GimpTextTool *text_tool);
-static void gimp_text_tool_paste_clipboard (GimpTextTool *text_tool);
static void gimp_text_tool_toggle_overwrite (GimpTextTool *text_tool);
static void gimp_text_tool_select_all (GimpTextTool *text_tool,
gboolean select);
@@ -638,7 +635,14 @@ gimp_text_tool_button_release (GimpTool *tool,
if (text_tool->selecting)
{
if (gtk_text_buffer_get_has_selection (text_tool->text_buffer))
- gimp_text_tool_clipboard_copy (text_tool, FALSE);
+ {
+ GtkClipboard *clipboard;
+
+ clipboard = gtk_widget_get_clipboard (tool->display->shell,
+ GDK_SELECTION_PRIMARY);
+
+ gtk_text_buffer_copy_clipboard (text_tool->text_buffer, clipboard);
+ }
text_tool->selecting = FALSE;
}
@@ -1736,24 +1740,6 @@ gimp_text_tool_backspace (GimpTextTool *text_tool)
}
static void
-gimp_text_tool_cut_clipboard (GimpTextTool *text_tool)
-{
- gimp_text_tool_clipboard_cut (text_tool);
-}
-
-static void
-gimp_text_tool_copy_clipboard (GimpTextTool *text_tool)
-{
- gimp_text_tool_clipboard_copy (text_tool, TRUE);
-}
-
-static void
-gimp_text_tool_paste_clipboard (GimpTextTool *text_tool)
-{
- gimp_text_tool_clipboard_paste (text_tool, TRUE);
-}
-
-static void
gimp_text_tool_toggle_overwrite (GimpTextTool *text_tool)
{
gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
@@ -2747,42 +2733,39 @@ gimp_text_tool_delete_selection (GimpTextTool *text_tool)
}
void
-gimp_text_tool_clipboard_cut (GimpTextTool *text_tool)
+gimp_text_tool_cut_clipboard (GimpTextTool *text_tool)
{
- GimpTool *tool = GIMP_TOOL (text_tool);
GtkClipboard *clipboard;
- clipboard = gtk_widget_get_clipboard (tool->display->shell,
+ g_return_if_fail (GIMP_IS_TEXT_TOOL (text_tool));
+
+ clipboard = gtk_widget_get_clipboard (GIMP_TOOL (text_tool)->display->shell,
GDK_SELECTION_CLIPBOARD);
gtk_text_buffer_cut_clipboard (text_tool->text_buffer, clipboard, TRUE);
}
void
-gimp_text_tool_clipboard_copy (GimpTextTool *text_tool,
- gboolean use_clipboard)
+gimp_text_tool_copy_clipboard (GimpTextTool *text_tool)
{
- GimpTool *tool = GIMP_TOOL (text_tool);
GtkClipboard *clipboard;
- clipboard = gtk_widget_get_clipboard (tool->display->shell,
- use_clipboard ?
- GDK_SELECTION_CLIPBOARD :
- GDK_SELECTION_PRIMARY);
+ g_return_if_fail (GIMP_IS_TEXT_TOOL (text_tool));
+
+ clipboard = gtk_widget_get_clipboard (GIMP_TOOL (text_tool)->display->shell,
+ GDK_SELECTION_CLIPBOARD);
gtk_text_buffer_copy_clipboard (text_tool->text_buffer, clipboard);
}
void
-gimp_text_tool_clipboard_paste (GimpTextTool *text_tool,
- gboolean use_clipboard)
+gimp_text_tool_paste_clipboard (GimpTextTool *text_tool)
{
- GimpTool *tool = GIMP_TOOL (text_tool);
GtkClipboard *clipboard;
- clipboard = gtk_widget_get_clipboard (tool->display->shell,
- use_clipboard ?
- GDK_SELECTION_CLIPBOARD :
- GDK_SELECTION_PRIMARY);
+ g_return_if_fail (GIMP_IS_TEXT_TOOL (text_tool));
+
+ clipboard = gtk_widget_get_clipboard (GIMP_TOOL (text_tool)->display->shell,
+ GDK_SELECTION_CLIPBOARD);
gtk_text_buffer_paste_clipboard (text_tool->text_buffer, clipboard, NULL, TRUE);
}
diff --git a/app/tools/gimptexttool.h b/app/tools/gimptexttool.h
index 7ee36bd..3780d7e 100644
--- a/app/tools/gimptexttool.h
+++ b/app/tools/gimptexttool.h
@@ -97,11 +97,9 @@ void gimp_text_tool_set_layer (GimpTextTool *text_tool,
gboolean gimp_text_tool_get_has_text_selection (GimpTextTool *text_tool);
void gimp_text_tool_delete_selection (GimpTextTool *text_tool);
-void gimp_text_tool_clipboard_cut (GimpTextTool *text_tool);
-void gimp_text_tool_clipboard_copy (GimpTextTool *text_tool,
- gboolean use_clipboard);
-void gimp_text_tool_clipboard_paste (GimpTextTool *text_tool,
- gboolean use_clipboard);
+void gimp_text_tool_cut_clipboard (GimpTextTool *text_tool);
+void gimp_text_tool_copy_clipboard (GimpTextTool *text_tool);
+void gimp_text_tool_paste_clipboard (GimpTextTool *text_tool);
void gimp_text_tool_create_vectors (GimpTextTool *text_tool);
void gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]