mirror of https://github.com/GNOME/gimp.git
Keep the proxy text view from doing anything
Add GimpTextProxy, a GtkTextView subclass which does nothing but overriding the binding methods with empty implementations, so the text view has no chance of letting e.g. the display beep or doing anything else.
This commit is contained in:
parent
e170ad77b1
commit
512c80cb05
|
@ -168,6 +168,8 @@ libapptools_a_sources = \
|
||||||
gimpsourcetool.h \
|
gimpsourcetool.h \
|
||||||
gimptextoptions.c \
|
gimptextoptions.c \
|
||||||
gimptextoptions.h \
|
gimptextoptions.h \
|
||||||
|
gimptextproxy.c \
|
||||||
|
gimptextproxy.h \
|
||||||
gimptexttool.c \
|
gimptexttool.c \
|
||||||
gimptexttool.h \
|
gimptexttool.h \
|
||||||
gimpthresholdtool.c \
|
gimpthresholdtool.c \
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
/* GIMP - The GNU Image Manipulation Program
|
||||||
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
*
|
||||||
|
* GimpTextProxy
|
||||||
|
* Copyright (C) 2009 Michael Natterer <mitch@gimp.org>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "gimptextproxy.h"
|
||||||
|
|
||||||
|
|
||||||
|
static void gimp_text_proxy_move_cursor (GtkTextView *text_view,
|
||||||
|
GtkMovementStep step,
|
||||||
|
gint count,
|
||||||
|
gboolean extend_selection);
|
||||||
|
static void gimp_text_proxy_delete_from_cursor (GtkTextView *text_view,
|
||||||
|
GtkDeleteType type,
|
||||||
|
gint count);
|
||||||
|
static void gimp_text_proxy_backspace (GtkTextView *text_view);
|
||||||
|
static void gimp_text_proxy_cut_clipboard (GtkTextView *text_view);
|
||||||
|
static void gimp_text_proxy_copy_clipboard (GtkTextView *text_view);
|
||||||
|
static void gimp_text_proxy_paste_clipboard (GtkTextView *text_view);
|
||||||
|
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (GimpTextProxy, gimp_text_proxy, GTK_TYPE_TEXT_VIEW)
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
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->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;
|
||||||
|
tv_class->copy_clipboard = gimp_text_proxy_copy_clipboard;
|
||||||
|
tv_class->paste_clipboard = gimp_text_proxy_paste_clipboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_text_proxy_init (GimpTextProxy *text_proxy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_text_proxy_move_cursor (GtkTextView *text_view,
|
||||||
|
GtkMovementStep step,
|
||||||
|
gint count,
|
||||||
|
gboolean extend_selection)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_text_proxy_delete_from_cursor (GtkTextView *text_view,
|
||||||
|
GtkDeleteType type,
|
||||||
|
gint count)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_text_proxy_backspace (GtkTextView *text_view)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_text_proxy_cut_clipboard (GtkTextView *text_view)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_text_proxy_copy_clipboard (GtkTextView *text_view)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_text_proxy_paste_clipboard (GtkTextView *text_view)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* public functions */
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gimp_text_proxy_new (void)
|
||||||
|
{
|
||||||
|
GtkTextBuffer *buffer = gtk_text_buffer_new (NULL);
|
||||||
|
GtkWidget *proxy;
|
||||||
|
|
||||||
|
proxy = g_object_new (GIMP_TYPE_TEXT_PROXY,
|
||||||
|
"buffer", buffer,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_object_unref (buffer);
|
||||||
|
|
||||||
|
return proxy;
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
/* GIMP - The GNU Image Manipulation Program
|
||||||
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIMP_TEXT_PROXY_H__
|
||||||
|
#define __GIMP_TEXT_PROXY_H__
|
||||||
|
|
||||||
|
|
||||||
|
#define GIMP_TYPE_TEXT_PROXY (gimp_text_proxy_get_type ())
|
||||||
|
#define GIMP_TEXT_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_TEXT_PROXY, GimpTextProxy))
|
||||||
|
#define GIMP_IS_TEXT_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_TEXT_PROXY))
|
||||||
|
#define GIMP_TEXT_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TEXT_PROXY, GimpTextProxyClass))
|
||||||
|
#define GIMP_IS_TEXT_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TEXT_PROXY))
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _GimpTextProxy GimpTextProxy;
|
||||||
|
typedef struct _GimpTextProxyClass GimpTextProxyClass;
|
||||||
|
|
||||||
|
struct _GimpTextProxy
|
||||||
|
{
|
||||||
|
GtkTextView parent_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GimpTextProxyClass
|
||||||
|
{
|
||||||
|
GtkTextViewClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
GType gimp_text_proxy_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
GtkWidget * gimp_text_proxy_new (void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __GIMP_TEXT_PROXY_H__ */
|
|
@ -61,6 +61,7 @@
|
||||||
#include "gimprectangletool.h"
|
#include "gimprectangletool.h"
|
||||||
#include "gimprectangleoptions.h"
|
#include "gimprectangleoptions.h"
|
||||||
#include "gimptextoptions.h"
|
#include "gimptextoptions.h"
|
||||||
|
#include "gimptextproxy.h"
|
||||||
#include "gimptexttool.h"
|
#include "gimptexttool.h"
|
||||||
#include "gimptoolcontrol.h"
|
#include "gimptoolcontrol.h"
|
||||||
|
|
||||||
|
@ -1364,18 +1365,13 @@ gimp_text_tool_ensure_proxy (GimpTextTool *text_tool)
|
||||||
}
|
}
|
||||||
else if (! text_tool->offscreen_window)
|
else if (! text_tool->offscreen_window)
|
||||||
{
|
{
|
||||||
GtkTextBuffer *buffer;
|
|
||||||
|
|
||||||
text_tool->offscreen_window = gtk_window_new (GTK_WINDOW_POPUP);
|
text_tool->offscreen_window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||||
gtk_window_set_screen (GTK_WINDOW (text_tool->offscreen_window),
|
gtk_window_set_screen (GTK_WINDOW (text_tool->offscreen_window),
|
||||||
gtk_widget_get_screen (tool->display->shell));
|
gtk_widget_get_screen (tool->display->shell));
|
||||||
gtk_window_move (GTK_WINDOW (text_tool->offscreen_window), -200, -200);
|
gtk_window_move (GTK_WINDOW (text_tool->offscreen_window), -200, -200);
|
||||||
gtk_widget_show (text_tool->offscreen_window);
|
gtk_widget_show (text_tool->offscreen_window);
|
||||||
|
|
||||||
buffer = gtk_text_buffer_new (NULL);
|
text_tool->proxy_text_view = gimp_text_proxy_new ();
|
||||||
text_tool->proxy_text_view = gtk_text_view_new_with_buffer (buffer);
|
|
||||||
g_object_unref (buffer);
|
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (text_tool->offscreen_window),
|
gtk_container_add (GTK_CONTAINER (text_tool->offscreen_window),
|
||||||
text_tool->proxy_text_view);
|
text_tool->proxy_text_view);
|
||||||
gtk_widget_show (text_tool->proxy_text_view);
|
gtk_widget_show (text_tool->proxy_text_view);
|
||||||
|
|
Loading…
Reference in New Issue