[evolution] EHTMLEditorView - Move the undo/redo debug functions to the beginning of module so we can use them i
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EHTMLEditorView - Move the undo/redo debug functions to the beginning of module so we can use them i
- Date: Fri, 13 Mar 2015 10:25:26 +0000 (UTC)
commit 3560ad2eefbd058f0e83eee1d2bc6dae33af40a5
Author: Tomas Popela <tpopela redhat com>
Date: Fri Mar 13 11:19:13 2015 +0100
EHTMLEditorView - Move the undo/redo debug functions to the beginning of module so we can use them in the
whole module
e-util/e-html-editor-view.c | 328 +++++++++++++++++++++---------------------
1 files changed, 164 insertions(+), 164 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 4a2c5e9..7d482cb 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -202,6 +202,170 @@ html_editor_view_get_dom_range (EHTMLEditorView *view)
return webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
}
+#if d(1)+0
+static void
+print_fragment_inner_html (WebKitDOMDocumentFragment *fragment)
+{
+ WebKitDOMDocument *document;
+ WebKitDOMElement *div;
+ gchar *inner_html;
+
+ if (!fragment) {
+ printf ("\tNone'\n");
+ return;
+ }
+ document = webkit_dom_node_get_owner_document (WEBKIT_DOM_NODE (fragment));
+ div = webkit_dom_document_create_element (document, "div", NULL);
+ webkit_dom_node_append_child (
+ WEBKIT_DOM_NODE (div),
+ webkit_dom_node_clone_node (WEBKIT_DOM_NODE (fragment), TRUE),
+ NULL);
+
+ inner_html = webkit_dom_html_element_get_inner_html (WEBKIT_DOM_HTML_ELEMENT (div));
+ printf ("\t'%s'\n", inner_html);
+ remove_node (WEBKIT_DOM_NODE (div));
+ g_free (inner_html);
+}
+
+static void
+print_node_inner_html (WebKitDOMNode *fragment)
+{
+ WebKitDOMDocument *document;
+ WebKitDOMElement *div;
+ gchar *inner_html;
+
+ if (!fragment) {
+ printf ("\tnone\n");
+ return;
+ }
+ document = webkit_dom_node_get_owner_document (WEBKIT_DOM_NODE (fragment));
+ div = webkit_dom_document_create_element (document, "div", NULL);
+ webkit_dom_node_append_child (
+ WEBKIT_DOM_NODE (div),
+ webkit_dom_node_clone_node (WEBKIT_DOM_NODE (fragment), TRUE),
+ NULL);
+
+ inner_html = webkit_dom_html_element_get_inner_html (WEBKIT_DOM_HTML_ELEMENT (div));
+ remove_node (WEBKIT_DOM_NODE (div));
+
+ printf ("\t'%s'\n", inner_html);
+
+ g_free (inner_html);
+}
+
+static void
+print_history_event (EHTMLEditorViewHistoryEvent *event)
+{
+ printf ("HISTORY EVENT: %d ; \n", event->type);
+ printf ("\t before: start_x: %u ; start_y: %u ; end_x: %u ; end_y: %u ;\n", event->before.start.x,
event->before.start.y, event->before.end.x, event->before.end.y);
+ printf ("\t after: start_x: %u ; start_y: %u ; end_x: %u ; end_y: %u ;\n", event->after.start.x,
event->after.start.y, event->after.end.x, event->after.end.y);
+ switch (event->type) {
+ case HISTORY_DELETE:
+ case HISTORY_INPUT:
+ case HISTORY_REMOVE_LINK:
+ case HISTORY_SMILEY:
+ case HISTORY_IMAGE:
+ case HISTORY_CITATION_SPLIT:
+ print_fragment_inner_html (event->data.fragment);
+ break;
+ case HISTORY_ALIGNMENT:
+ case HISTORY_BLOCK_FORMAT:
+ case HISTORY_BOLD:
+ case HISTORY_FONT_SIZE:
+ case HISTORY_INDENT:
+ case HISTORY_ITALIC:
+ case HISTORY_MONOSPACE:
+ case HISTORY_UNDERLINE:
+ case HISTORY_STRIKETHROUGH:
+ case HISTORY_WRAP:
+ printf (" from %d to %d ;\n", event->data.style.from, event->data.style.to);
+ break;
+ case HISTORY_PASTE:
+ case HISTORY_PASTE_AS_TEXT:
+ case HISTORY_PASTE_QUOTED:
+ case HISTORY_INSERT_HTML:
+ printf (" pasting: '%s' ; \n", event->data.string.to);
+ break;
+ case HISTORY_HRULE_DIALOG:
+ case HISTORY_IMAGE_DIALOG:
+ case HISTORY_CELL_DIALOG:
+ case HISTORY_TABLE_DIALOG:
+ case HISTORY_PAGE_DIALOG:
+ print_node_inner_html (event->data.dom.from);
+ print_node_inner_html (event->data.dom.to);
+ break;
+ case HISTORY_FONT_COLOR:
+ case HISTORY_REPLACE:
+ case HISTORY_REPLACE_ALL:
+ printf (" from '%s' to '%s';\n", event->data.string.from, event->data.string.to);
+ break;
+ case HISTORY_START:
+ printf ("HISTORY START\n");
+ break;
+ default:
+ printf ("Unknown history type\n");
+ }
+}
+
+static void
+print_history (EHTMLEditorView *view)
+{
+ if (view->priv->history) {
+ printf ("\n");
+ g_list_foreach (
+ view->priv->history,
+ (GFunc) print_history_event,
+ NULL);
+ printf ("\n");
+ } else {
+ printf ("History empty!\n");
+ }
+}
+
+static void
+print_undo_events (EHTMLEditorView *view)
+{
+ GList *item = view->priv->history;
+
+ printf ("UNDO EVENTS:\n");
+ if (!item || !item->next) {
+ printf ("EMPTY\n");
+ return;
+ }
+
+ print_history_event (item->data);
+ item = item->next;
+ while (item) {
+ print_history_event (item->data);
+ item = item->next;
+ }
+
+ printf ("\n");
+
+}
+
+static void
+print_redo_events (EHTMLEditorView *view)
+{
+ GList *item = view->priv->history;
+
+ printf ("REDO EVENTS:\n");
+ if (!item || !item->prev) {
+ printf ("EMPTY\n");
+ return;
+ }
+
+ item = item->prev;
+ while (item) {
+ print_history_event (item->data);
+ item = item->prev;
+ }
+
+ printf ("\n");
+
+}
+#endif
+
gboolean
e_html_editor_view_can_redo (EHTMLEditorView *view)
{
@@ -9894,170 +10058,6 @@ e_html_editor_view_set_undo_redo_in_progress (EHTMLEditorView *view,
view->priv->undo_redo_in_progress = value;
}
-#if d(1)+0
-static void
-print_fragment_inner_html (WebKitDOMDocumentFragment *fragment)
-{
- WebKitDOMDocument *document;
- WebKitDOMElement *div;
- gchar *inner_html;
-
- if (!fragment) {
- printf ("\tNone'\n");
- return;
- }
- document = webkit_dom_node_get_owner_document (WEBKIT_DOM_NODE (fragment));
- div = webkit_dom_document_create_element (document, "div", NULL);
- webkit_dom_node_append_child (
- WEBKIT_DOM_NODE (div),
- webkit_dom_node_clone_node (WEBKIT_DOM_NODE (fragment), TRUE),
- NULL);
-
- inner_html = webkit_dom_html_element_get_inner_html (WEBKIT_DOM_HTML_ELEMENT (div));
- printf ("\t'%s'\n", inner_html);
- remove_node (WEBKIT_DOM_NODE (div));
- g_free (inner_html);
-}
-
-static void
-print_node_inner_html (WebKitDOMNode *fragment)
-{
- WebKitDOMDocument *document;
- WebKitDOMElement *div;
- gchar *inner_html;
-
- if (!fragment) {
- printf ("\tnone\n");
- return;
- }
- document = webkit_dom_node_get_owner_document (WEBKIT_DOM_NODE (fragment));
- div = webkit_dom_document_create_element (document, "div", NULL);
- webkit_dom_node_append_child (
- WEBKIT_DOM_NODE (div),
- webkit_dom_node_clone_node (WEBKIT_DOM_NODE (fragment), TRUE),
- NULL);
-
- inner_html = webkit_dom_html_element_get_inner_html (WEBKIT_DOM_HTML_ELEMENT (div));
- remove_node (WEBKIT_DOM_NODE (div));
-
- printf ("\t'%s'\n", inner_html);
-
- g_free (inner_html);
-}
-
-static void
-print_history_event (EHTMLEditorViewHistoryEvent *event)
-{
- printf ("HISTORY EVENT: %d ; \n", event->type);
- printf ("\t before: start_x: %u ; start_y: %u ; end_x: %u ; end_y: %u ;\n", event->before.start.x,
event->before.start.y, event->before.end.x, event->before.end.y);
- printf ("\t after: start_x: %u ; start_y: %u ; end_x: %u ; end_y: %u ;\n", event->after.start.x,
event->after.start.y, event->after.end.x, event->after.end.y);
- switch (event->type) {
- case HISTORY_DELETE:
- case HISTORY_INPUT:
- case HISTORY_REMOVE_LINK:
- case HISTORY_SMILEY:
- case HISTORY_IMAGE:
- case HISTORY_CITATION_SPLIT:
- print_fragment_inner_html (event->data.fragment);
- break;
- case HISTORY_ALIGNMENT:
- case HISTORY_BLOCK_FORMAT:
- case HISTORY_BOLD:
- case HISTORY_FONT_SIZE:
- case HISTORY_INDENT:
- case HISTORY_ITALIC:
- case HISTORY_MONOSPACE:
- case HISTORY_UNDERLINE:
- case HISTORY_STRIKETHROUGH:
- case HISTORY_WRAP:
- printf (" from %d to %d ;\n", event->data.style.from, event->data.style.to);
- break;
- case HISTORY_PASTE:
- case HISTORY_PASTE_AS_TEXT:
- case HISTORY_PASTE_QUOTED:
- case HISTORY_INSERT_HTML:
- printf (" pasting: '%s' ; \n", event->data.string.to);
- break;
- case HISTORY_HRULE_DIALOG:
- case HISTORY_IMAGE_DIALOG:
- case HISTORY_CELL_DIALOG:
- case HISTORY_TABLE_DIALOG:
- case HISTORY_PAGE_DIALOG:
- print_node_inner_html (event->data.dom.from);
- print_node_inner_html (event->data.dom.to);
- break;
- case HISTORY_FONT_COLOR:
- case HISTORY_REPLACE:
- case HISTORY_REPLACE_ALL:
- printf (" from '%s' to '%s';\n", event->data.string.from, event->data.string.to);
- break;
- case HISTORY_START:
- printf ("HISTORY START\n");
- break;
- default:
- printf ("Unknown history type\n");
- }
-}
-
-static void
-print_history (EHTMLEditorView *view)
-{
- if (view->priv->history) {
- printf ("\n");
- g_list_foreach (
- view->priv->history,
- (GFunc) print_history_event,
- NULL);
- printf ("\n");
- } else {
- printf ("History empty!\n");
- }
-}
-
-static void
-print_undo_events (EHTMLEditorView *view)
-{
- GList *item = view->priv->history;
-
- printf ("UNDO EVENTS:\n");
- if (!item || !item->next) {
- printf ("EMPTY\n");
- return;
- }
-
- print_history_event (item->data);
- item = item->next;
- while (item) {
- print_history_event (item->data);
- item = item->next;
- }
-
- printf ("\n");
-
-}
-
-static void
-print_redo_events (EHTMLEditorView *view)
-{
- GList *item = view->priv->history;
-
- printf ("REDO EVENTS:\n");
- if (!item || !item->prev) {
- printf ("EMPTY\n");
- return;
- }
-
- item = item->prev;
- while (item) {
- print_history_event (item->data);
- item = item->prev;
- }
-
- printf ("\n");
-
-}
-#endif
-
static void
remove_history_event (EHTMLEditorView *view,
GList *item)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]