diff options
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/gui.c | 47 | ||||
-rw-r--r-- | riscos/gui.h | 1 | ||||
-rw-r--r-- | riscos/window.c | 11 |
3 files changed, 47 insertions, 12 deletions
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]; @@ -2205,6 +2207,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("<Wimp$ScrapDir>.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 <Wimp$ScrapDir>.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. */ diff --git a/riscos/gui.h b/riscos/gui.h index f564b55e2..ee7ed896f 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -122,6 +122,7 @@ void ro_gui_open_window_request(wimp_open *open); void ro_gui_open_help_page(const char *page); void ro_gui_screen_size(int *width, int *height); void ro_gui_view_source(struct content *content); +void ro_gui_dump_content(struct content *content); void ro_gui_drag_box_start(wimp_pointer *pointer); bool ro_gui_prequit(void); const char *ro_gui_default_language(void); diff --git a/riscos/window.c b/riscos/window.c index b437e6362..b0dc828aa 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -2439,16 +2439,7 @@ bool ro_gui_window_keypress(wimp_key *key) case IS_WIMP_KEY + wimp_KEY_F9: /* Dump content for debugging. */ - switch (content->type) { - case CONTENT_HTML: - box_dump(content->data.html.layout, 0); - break; - case CONTENT_CSS: - css_dump_stylesheet(content->data.css.css); - break; - default: - break; - } + ro_gui_dump_content(content); return true; case IS_WIMP_KEY + wimp_KEY_CONTROL + wimp_KEY_F9: |