[ either fixes #39702 or comes damn, damn close. also, fixes EText to not

2003-04-02  Chris Toshok  <toshok@ximian.com>

	[ either fixes #39702 or comes damn, damn close.  also, fixes EText
	to not suck *nearly* as much. ]
	* gal/util/e-marshal.list: add NONE:POINTER,INT,OBJECT.

	* gal/e-text/e-entry.h: (struct _EEntryClass): popup ->
	populate_popup.

	* gal/e-text/e-entry.c (proxy_changed): rename, the old name was
	too damn long.
	(proxy_activate): same.
	(proxy_populate_popup): same, and change from popup to
	populate_popup.
	(e_entry_init): track change to cb names, and populate_popup.
	also, pass the ECanvas's im_context to the EText.
	(e_entry_class_init): POPUP -> POPULATE_POPUP.

	* gal/e-text/e-text.h (struct _EText): remove the old selection
	stuff, and add im_context/reset_im_context fields.
	(struct _ETextClass): popup -> populate_popup.

	* gal/e-text/e-text.c (e_text_dispose): remove all the
	GtkInvisible based selection stuff, and disconnect from/unref the
	im_context.
	(e_text_set_property): add "im_context" handling.
	(e_text_get_property): same.
	(e_text_event): connect/disconnect from the IM context's signals
	in the FOCUS_CHANGE handler.  in the KEY_PRESS/RELEASE handler,
	use gtk_im_context_filter_keypress if we have an im_context.
	also, use e_text_do_popup now instead of just emitting the "popup"
	signal.
	(e_text_copy_clipboard): new function.
	(e_text_delete_selection): new function.
	(e_text_cut_clipboard): new function.
	(e_text_paste_clipboard): new function.
	(e_text_select_all): new function.
	(primary_get_cb): new function, handle requests for the primary
	selection when we're the owner.
	(primary_clear_cb): new function, unfinished.
	(e_text_update_primary_selection): new function.
	(paste_received): new function, insert pasted text.
	(e_text_paste): new function,
	(popup_menu_detach): new function, not needed really.
	(popup_targets_received): new function, pop up the popup once we
	have the selection information necessary to sensitize the c/c/p
	buttons.
	(e_text_do_popup): new function, request the selection.
	(e_text_reset_im_context): new function.
	(e_text_command): for E_TEP_SELECT, call
	e_text_update_primary_selection.  for E_TEP_DELETE/INSERT,
	_delete_selection -> e_text_delete_selection.  for E_TEP_COPY,
	call e_text_copy_clipboard.  for E_TEP_PASTE/E_TEP_GET_SELECTION
	call e_text_paste.
	(e_text_class_init): change the "popup" signal to
	"populate_popup".  Also, add the "im_context" property.
	(e_text_commit_cb): new function. IM context callback.
	(e_text_retrieve_surrounding_cb): new function.  IM context
	callback.
	(e_text_delete_surrounding_cb): new function.  IM context
	callback.  unfinished.

svn path=/trunk/; revision=20653
This commit is contained in:
Chris Toshok
2003-04-03 06:06:20 +00:00
committed by Chris Toshok
parent 7143de721b
commit d2af55db1a
5 changed files with 474 additions and 461 deletions

View File

@ -44,6 +44,7 @@ NONE:POINTER,BOOLEAN,BOOLEAN,BOOLEAN
NONE:POINTER,INT
NONE:POINTER,INT,INT
NONE:POINTER,INT,INT,INT
NONE:POINTER,INT,OBJECT
NONE:POINTER,POINTER
NONE:POINTER,POINTER,INT
OBJECT:OBJECT,DOUBLE,DOUBLE,BOOLEAN

View File

@ -54,7 +54,7 @@ static GtkObjectClass *parent_class;
enum {
E_ENTRY_CHANGED,
E_ENTRY_ACTIVATE,
E_ENTRY_POPUP,
E_ENTRY_POPULATE_POPUP,
E_ENTRY_COMPLETION_POPUP,
E_ENTRY_LAST_SIGNAL
};
@ -98,7 +98,7 @@ struct _EEntryPrivate {
guint changed_proxy_tag;
guint activate_proxy_tag;
guint popup_proxy_tag;
guint populate_popup_proxy_tag;
/* Data related to completions */
ECompletion *completion;
EEntryCompletionHandler handler;
@ -270,7 +270,7 @@ changed_since_keypress_timeout_fn (gpointer user_data)
}
static void
e_entry_proxy_changed (EText *text, EEntry *entry)
proxy_changed (EText *text, EEntry *entry)
{
if (entry->priv->changed_since_keypress_tag)
gtk_timeout_remove (entry->priv->changed_since_keypress_tag);
@ -281,15 +281,15 @@ e_entry_proxy_changed (EText *text, EEntry *entry)
}
static void
e_entry_proxy_activate (EText *text, EEntry *entry)
proxy_activate (EText *text, EEntry *entry)
{
g_signal_emit (entry, e_entry_signals [E_ENTRY_ACTIVATE], 0);
}
static void
e_entry_proxy_popup (EText *text, GdkEventButton *ev, gint pos, EEntry *entry)
proxy_populate_popup (EText *text, GdkEventButton *ev, gint pos, GtkWidget *menu, EEntry *entry)
{
g_signal_emit (entry, e_entry_signals [E_ENTRY_POPUP], 0, ev, pos);
g_signal_emit (entry, e_entry_signals [E_ENTRY_POPULATE_POPUP], 0, ev, pos, menu);
}
static void
@ -334,6 +334,7 @@ e_entry_init (GtkObject *object)
"max_lines", 1,
"editable", TRUE,
"allow_newlines", FALSE,
"im_context", E_CANVAS (entry->canvas)->im_context,
NULL));
g_signal_connect (entry->item,
@ -355,16 +356,16 @@ e_entry_init (GtkObject *object)
*/
entry->priv->changed_proxy_tag = g_signal_connect (entry->item,
"changed",
G_CALLBACK (e_entry_proxy_changed),
G_CALLBACK (proxy_changed),
entry);
entry->priv->activate_proxy_tag = g_signal_connect (entry->item,
"activate",
G_CALLBACK (e_entry_proxy_activate),
G_CALLBACK (proxy_activate),
entry);
entry->priv->popup_proxy_tag = g_signal_connect (entry->item,
"popup",
G_CALLBACK (e_entry_proxy_popup),
entry);
entry->priv->populate_popup_proxy_tag = g_signal_connect (entry->item,
"populate_popup",
G_CALLBACK (proxy_populate_popup),
entry);
entry->priv->completion_delay = 1;
}
@ -1214,14 +1215,14 @@ e_entry_class_init (GObjectClass *object_class)
e_marshal_NONE__NONE,
G_TYPE_NONE, 0);
e_entry_signals[E_ENTRY_POPUP] =
g_signal_new ("popup",
e_entry_signals[E_ENTRY_POPULATE_POPUP] =
g_signal_new ("populate_popup",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EEntryClass, popup),
G_STRUCT_OFFSET (EEntryClass, populate_popup),
NULL, NULL,
e_marshal_NONE__POINTER_INT,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_INT);
e_marshal_NONE__POINTER_INT_OBJECT,
G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, GTK_TYPE_MENU);
e_entry_signals[E_ENTRY_COMPLETION_POPUP] =
g_signal_new ("completion_popup",

View File

@ -59,7 +59,7 @@ struct _EEntryClass {
void (* changed) (EEntry *entry);
void (* activate) (EEntry *entry);
void (* popup) (EEntry *entry, GdkEventButton *ev, gint pos);
void (* populate_popup) (EEntry *entry, GdkEventButton *ev, gint pos, GtkMenu *menu);
void (* completion_popup) (EEntry *entry, gint visible);
};

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@
#ifndef E_TEXT_H
#define E_TEXT_H
#include <gtk/gtkobject.h>
#include <gtk/gtkmenu.h>
#include <gal/widgets/e-font.h>
#include <gal/util/e-text-event-processor.h>
@ -162,12 +162,7 @@ struct _EText {
ETextEventProcessor *tep; /* Text Event Processor */
gint tep_command_id;
GtkWidget *invisible; /* For selection handling */
gboolean has_selection; /* TRUE if we have the selection */
gchar *primary_selection; /* Primary selection text */
gint primary_length; /* Primary selection text length */
gchar *clipboard_selection; /* Clipboard selection text */
gint clipboard_length; /* Clipboard selection text length*/
guint clip : 1; /* Use clip rectangle? */
guint fill_clip_rectangle : 1; /* Fill the clipping rectangle. */
@ -216,16 +211,19 @@ struct _EText {
guint32 last_time_request; /* The time of the last selection request. */
GdkAtom last_selection_request; /* The time of the last selection request. */
GList *queued_requests; /* Queued selection requests. */
GtkIMContext *im_context;
gboolean need_im_reset;
};
struct _ETextClass {
GnomeCanvasItemClass parent_class;
void (* changed) (EText *text);
void (* activate) (EText *text);
void (* keypress) (EText *text, guint keyval, guint state);
void (* popup) (EText *text, GdkEventButton *ev, gint pos);
void (* style_set) (EText *text, GtkStyle *previous_style);
void (* changed) (EText *text);
void (* activate) (EText *text);
void (* keypress) (EText *text, guint keyval, guint state);
void (* populate_popup) (EText *text, GdkEventButton *ev, gint pos, GtkMenu *menu);
void (* style_set) (EText *text, GtkStyle *previous_style);
};
@ -234,6 +232,11 @@ GtkType e_text_get_type (void);
void e_text_cancel_editing (EText *text);
void e_text_stop_editing (EText *text);
void e_text_delete_selection (EText *text);
void e_text_cut_clipboard (EText *text);
void e_text_paste_clipboard (EText *text);
void e_text_select_all (EText *text);
G_END_DECLS
#endif