From 21db9de5f8ede54e042a111f6a753cd43816530b Mon Sep 17 00:00:00 2001 From: James Bursa Date: Mon, 20 Aug 2007 02:39:49 +0000 Subject: Make F9 dump box tree to an editor for easier debugging. svn path=/trunk/netsurf/; revision=3529 --- riscos/gui.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'riscos/gui.c') diff --git a/riscos/gui.c b/riscos/gui.c index 1289cc6b7..f1b5d3d7e 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -847,7 +847,7 @@ void ro_gui_signal(int sig) for (c = content_list; c; c = c->next) if (c->type == CONTENT_HTML && c->data.html.layout) { LOG(("Dumping: '%s'", c->url)); - box_dump(c->data.html.layout, 0); + box_dump(stderr, c->data.html.layout, 0); } options_dump(); /*rufl_dump_state();*/ @@ -2108,6 +2108,7 @@ void ro_gui_open_help_page(const char *page) browser_window_create(url, NULL, 0, true); } + /** * Send the source of a content to a text editor. */ @@ -2187,7 +2188,8 @@ void ro_gui_view_source(struct content *content) } -void ro_gui_view_source_bounce(wimp_message *message) { +void ro_gui_view_source_bounce(wimp_message *message) +{ char *filename; os_error *error; char command[256]; @@ -2204,6 +2206,47 @@ void ro_gui_view_source_bounce(wimp_message *message) { } +/** + * Send the debug dump of a content to a text editor. + */ + +void ro_gui_dump_content(struct content *content) +{ + os_error *error; + + /* open file for dump */ + FILE *stream = fopen(".WWW.NetSurf.dump", "w"); + if (!stream) { + LOG(("fopen: errno %i", errno)); + warn_user("SaveError", strerror(errno)); + return; + } + + /* output debug information to file */ + switch (content->type) { + case CONTENT_HTML: + box_dump(stream, content->data.html.layout, 0); + break; + case CONTENT_CSS: + css_dump_stylesheet(content->data.css.css); + break; + default: + break; + } + + fclose(stream); + + /* launch file in editor */ + error = xwimp_start_task("Filer_Run .WWW.NetSurf.dump", + 0); + if (error) { + LOG(("xwimp_start_task failed: 0x%x: %s", + error->errnum, error->errmess)); + warn_user("WimpError", error->errmess); + } +} + + /** * Broadcast an URL that we can't handle. */ -- cgit v1.2.3