diff options
author | Radek Doulik <rodo@ximian.com> | 2001-10-31 00:38:13 +0800 |
---|---|---|
committer | Radek Doulik <rodo@src.gnome.org> | 2001-10-31 00:38:13 +0800 |
commit | d52e9c60b70085cd80e7bd17a7201e1624504cea (patch) | |
tree | f5d025e815a77a7f98f148d2f65b5c735317b4ea /composer | |
parent | f393c0aa94b37d76153f3cc8d8f69526fcb1b589 (diff) | |
download | gsoc2013-evolution-d52e9c60b70085cd80e7bd17a7201e1624504cea.tar.gz gsoc2013-evolution-d52e9c60b70085cd80e7bd17a7201e1624504cea.tar.zst gsoc2013-evolution-d52e9c60b70085cd80e7bd17a7201e1624504cea.zip |
new helper function, extracted (insert_paragraph_after): ditto
2001-10-30 Radek Doulik <rodo@ximian.com>
* listener.c (insert_paragraph_before): new helper function,
extracted
(insert_paragraph_after): ditto
(impl_event): process command_before and command_after, use new
functions
(clear_signature): reset style to be sure
(reply_indent): ditto
svn path=/trunk/; revision=14465
Diffstat (limited to 'composer')
-rw-r--r-- | composer/ChangeLog | 10 | ||||
-rw-r--r-- | composer/listener.c | 81 |
2 files changed, 76 insertions, 15 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index 4887e9792a..0d97cc7926 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,13 @@ +2001-10-30 Radek Doulik <rodo@ximian.com> + + * listener.c (insert_paragraph_before): new helper function, + extracted + (insert_paragraph_after): ditto + (impl_event): process command_before and command_after, use new + functions + (clear_signature): reset style to be sure + (reply_indent): ditto + 2001-10-30 Dan Winship <danw@ximian.com> * e-msg-composer.c (build_message): Remove Content-Disposition in diff --git a/composer/listener.c b/composer/listener.c index 0b2eaa61f1..4982034b8a 100644 --- a/composer/listener.c +++ b/composer/listener.c @@ -82,6 +82,8 @@ reply_indent (EditorListener *l, CORBA_Environment * ev) if (GNOME_GtkHTML_Editor_Engine_isPreviousParagraphEmpty (l->composer->editor_engine, ev)) GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "cursor-backward", ev); else { + GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "text-default-color", ev); + GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "italic-off", ev); GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "insert-paragraph", ev); return; } @@ -103,6 +105,60 @@ clear_signature (GNOME_GtkHTML_Editor_Engine e, CORBA_Environment * ev) GNOME_GtkHTML_Editor_Engine_setParagraphData (e, "signature", "0", ev); GNOME_GtkHTML_Editor_Engine_runCommand (e, "cursor-forward", ev); } + GNOME_GtkHTML_Editor_Engine_runCommand (e, "text-default-color", ev); + GNOME_GtkHTML_Editor_Engine_runCommand (e, "italic-off", ev); +} + +static void +insert_paragraph_before (EditorListener *l, CORBA_Environment * ev) +{ + if (!l->composer->in_signature_insert) { + CORBA_char *orig, *signature; + gboolean changed = FALSE; + /* FIXME check for insert-paragraph command */ + + orig = GNOME_GtkHTML_Editor_Engine_getParagraphData (l->composer->editor_engine, "orig", ev); + if (ev->_major == CORBA_NO_EXCEPTION) { + if (orig && *orig == '1') { + GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "text-default-color", ev); + GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "italic-off", ev); + changed = TRUE; + } + } + if (!changed) { + signature = GNOME_GtkHTML_Editor_Engine_getParagraphData (l->composer->editor_engine, "signature", ev); + if (ev->_major == CORBA_NO_EXCEPTION) { + if (signature && *signature == '1') { + GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "text-default-color", + ev); + GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "italic-off", ev); + } + } + } + } +} + +static void +insert_paragraph_after (EditorListener *l, CORBA_Environment * ev) +{ + if (!l->composer->in_signature_insert) { + CORBA_char *orig, *signature; + /* FIXME check for insert-paragraph command */ + GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "text-default-color", ev); + GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "italic-off", ev); + + orig = GNOME_GtkHTML_Editor_Engine_getParagraphData (l->composer->editor_engine, "orig", ev); + if (ev->_major == CORBA_NO_EXCEPTION) { + if (orig && *orig == '1') + reply_indent (l, ev); + GNOME_GtkHTML_Editor_Engine_setParagraphData (l->composer->editor_engine, "orig", "0", ev); + } + signature = GNOME_GtkHTML_Editor_Engine_getParagraphData (l->composer->editor_engine, "signature", ev); + if (ev->_major == CORBA_NO_EXCEPTION) { + if (signature && *signature == '1') + clear_signature (l->composer->editor_engine, ev); + } + } } static CORBA_any * @@ -112,24 +168,19 @@ impl_event (PortableServer_Servant _servant, { EditorListener *l = listener_from_servant (_servant); CORBA_any *rv = NULL; + gchar *command; printf ("impl_event = %s\n", name); - if (!strcmp (name, "command")) { - if (!l->composer->in_signature_insert) { - CORBA_char *orig, *signature; - /* FIXME check for insert-paragraph command */ - orig = GNOME_GtkHTML_Editor_Engine_getParagraphData (l->composer->editor_engine, "orig", ev); - if (ev->_major == CORBA_NO_EXCEPTION) { - if (orig && *orig == '1') - reply_indent (l, ev); - GNOME_GtkHTML_Editor_Engine_setParagraphData (l->composer->editor_engine, "orig", "0", ev); - } - signature = GNOME_GtkHTML_Editor_Engine_getParagraphData (l->composer->editor_engine, "signature", ev); - if (ev->_major == CORBA_NO_EXCEPTION) { - if (signature && *signature == '1') - clear_signature (l->composer->editor_engine, ev); - } + if (!strcmp (name, "command_before")) { + command = BONOBO_ARG_GET_STRING (arg); + if (!strcmp (command, "insert-paragraph")) { + insert_paragraph_before (l, ev); + } + } else if (!strcmp (name, "command_after")) { + command = BONOBO_ARG_GET_STRING (arg); + if (!strcmp (command, "insert-paragraph")) { + insert_paragraph_after (l, ev); } } else if (!strcmp (name, "image_url")) { gchar *url; |