On Tue, 2003-12-02 at 22:05, Radek Doulík wrote: Hi Radek, > Hi Jan, > > On Tue, 2003-12-02 at 00:47, Jan Arne Petersen wrote: > > Hi, > > > > this is a patch for http://bugzilla.gnome.org/show_bug.cgi?id=127533. > > This patch makes it possible to replace the smiley with the original text by > > pressing the backspace key. > > using extra filed for smiley text seems to unnecessarily waste memory > ,most images will not use it. Larry and I suggest to use > html_object_set_data and html_object_get_data to store smiley text > instead of picto field. what do you think? Ok I agree with you. The updated patch is attached. Regards Jan Arne Petersen
Index: src/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1908
diff -u -r1.1908 ChangeLog
--- src/ChangeLog 23 Nov 2003 23:39:02 -0000 1.1908
+++ src/ChangeLog 2 Dec 2003 21:23:02 -0000
@@ -1,3 +1,10 @@
+2003-12-02 Jan Arne Petersen <jpetersen uni-bonn de>
+
+ * htmlengine-edit-cut-and-paste.c: (use_pictograms): store
+ the replaced text as "picto" data in the html image object.
+ (html_engine_delete_n): replace the smiley with the original text
+ when a smiley is deleted.
+
2003-11-24 Radek Doulik <rodo ximian com>
* htmlgdkpainter.c (item_gc): set a default color
Index: src/htmlengine-edit-cut-and-paste.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine-edit-cut-and-paste.c,v
retrieving revision 1.96
diff -u -r1.96 htmlengine-edit-cut-and-paste.c
--- src/htmlengine-edit-cut-and-paste.c 3 Oct 2003 16:12:26 -0000 1.96
+++ src/htmlengine-edit-cut-and-paste.c 2 Dec 2003 21:23:05 -0000
@@ -1265,6 +1265,7 @@
picto = html_image_new (e->image_factory, filename, NULL, NULL, -1, -1, FALSE, FALSE, 0, NULL,
HTML_VALIGN_MIDDLE, FALSE);
html_image_set_alt (HTML_IMAGE (picto), alt);
+ html_object_set_data (HTML_OBJECT (picto), "picto", alt);
g_free (alt);
html_engine_paste_object (e, picto, html_object_get_length (picto));
}
@@ -1380,6 +1381,24 @@
html_engine_set_mark (e);
html_engine_update_selection_if_necessary (e);
html_engine_freeze (e);
+ /* Remove magic smiley */
+ if (!forward && len == 1 && gtk_html_get_magic_smileys (e->widget)) {
+ HTMLObject *object = html_object_get_tail_leaf (e->cursor->object);
+
+ if (HTML_IS_IMAGE (object) && html_object_get_data (object, "picto") != NULL) {
+ gchar *picto = g_strdup (html_object_get_data (object, "picto"));
+ html_undo_level_begin (e->undo, "Remove Magic Smiley", "Undo Remove Magic Smiley");
+ html_cursor_backward (e->cursor, e);
+ html_engine_delete (e);
+ html_engine_insert_text (e, picto, -1);
+ html_undo_level_end (e->undo);
+ g_free (picto);
+
+ html_engine_unblock_selection (e);
+ html_engine_thaw (e);
+ return;
+ }
+ }
while (len != 0) {
if (forward)
html_cursor_forward (e->cursor, e);
Attachment:
signature.asc
Description: This is a digitally signed message part