diff options
-rw-r--r-- | !NetSurf/About/About,faf | 35 | ||||
-rw-r--r-- | !NetSurf/About/animlib,ff9 | bin | 0 -> 1544 bytes | |||
-rw-r--r-- | !NetSurf/About/libcurl,ff9 | bin | 0 -> 15300 bytes | |||
-rw-r--r-- | !NetSurf/About/libpng,b60 | bin | 0 -> 2399 bytes | |||
-rw-r--r-- | !NetSurf/About/libxml,b60 | bin | 0 -> 4899 bytes | |||
-rw-r--r-- | !NetSurf/About/nslogo,b60 | bin | 0 -> 13366 bytes | |||
-rw-r--r-- | !NetSurf/About/openssl,695 | bin | 0 -> 2063 bytes | |||
-rw-r--r-- | !NetSurf/Resources/en/Messages | 2 | ||||
-rw-r--r-- | makefile | 2 | ||||
-rw-r--r-- | riscos/about.c | 275 | ||||
-rw-r--r-- | riscos/about.h | 14 | ||||
-rw-r--r-- | riscos/gui.c | 10 |
12 files changed, 335 insertions, 3 deletions
diff --git a/!NetSurf/About/About,faf b/!NetSurf/About/About,faf new file mode 100644 index 000000000..f8709c820 --- /dev/null +++ b/!NetSurf/About/About,faf @@ -0,0 +1,35 @@ +<!-- Browser specific information --> +<strong><i>NetSurf makes use of the following libraries:</i></strong><br> <br> +<table border="0" cellspacing="2" width="100%"> +<tr valign="top"> + <td width="30%"><font size="2"><strong><a href="http://www.zlib.org/">zlib 1.1.4</a></strong></font></td> + <td width="70%"><font size="2">Copyright © 1995-2002 Jean-loup Gailly and Mark Adler.</font></td> +</tr> +<tr><td colspan="2" bgcolor="#dddddd" height="1"></td></tr> +<tr valign="top"> + <td width="30%"><font size="2"><strong><a href="http://www.libpng.org/">libpng 1.2.5</a></strong></font><br><img src="file:///%3CNetsurf$Dir%3E/About/libpng" alt="libpng logo"></td> + <td width="70%"><font size="2">Copyright © 1995, 1996 Guy Eric Schalnat, Group 42, Inc.;<br>Copyright © 1996, 1997 Andreas Dilger;<br>Copyright © 1998-2002 Glenn Randers-Pehrson.</font></td> +</tr> +<tr><td colspan="2" bgcolor="#dddddd" height="1"></td></tr> +<tr valign="top"> + <td width="30%"><font size="2"><strong><a href="http://utter.chaos.org/~pdh/software/intergif.htm">animlib 6.11</a></strong></font><br><img src="file:///%3CNetsurf$Dir%3E/About/animlib" alt="animlib logo"></td> + <td width="70%"><font size="2">Copyright © 1997-2000 Peter Hartley.</font></td> +</tr> +<tr><td colspan="2" bgcolor="#dddddd" height="1"></td></tr> +<tr valign="top"> + <td width="30%"><font size="2"><strong><a href="http://curl.haxx.se/libcurl/">libcurl 7.10.7</a></strong></font><br><img src="file:///%3CNetsurf$Dir%3E/About/libcurl" alt="libcurl logo"></td> + <td width="70%"><font size="2">Copyright © 1998-2003 Daniel Stenberg.</font></td> +</tr> +<tr><td colspan="2" bgcolor="#dddddd" height="1"></td></tr> +<tr valign="top"> + <td width="30%"><font size="2"><strong><a href="http://www.xmlsoft.org/">libxml 2.5.4</a></strong></font><br><img src="file:///%3CNetsurf$Dir%3E/About/libxml" alt="libxml logo"></td> + <td width="70%"><font size="2">Copyright © 1998-2002 Daniel Veillard.</font></td> +</tr> +<tr><td colspan="2" bgcolor="#dddddd" height="1"></td></tr> +<tr valign="top"> + <td width="30%"><font size="2"><strong><a href="http://www.cryptsoft.com/ssleay/">OpenSSL 0.9.7b</a></strong></font><br><img src="file:///%3CNetsurf$Dir%3E/About/openssl" alt="openssl logo"></td> + <td width="70%"><font size="2">This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (<a href="http://www.openssl.org/">http://www.openssl.org/</a>). + <br>This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).</font></td> +</tr> +</table> +<hr>
\ No newline at end of file diff --git a/!NetSurf/About/animlib,ff9 b/!NetSurf/About/animlib,ff9 Binary files differnew file mode 100644 index 000000000..32efefe62 --- /dev/null +++ b/!NetSurf/About/animlib,ff9 diff --git a/!NetSurf/About/libcurl,ff9 b/!NetSurf/About/libcurl,ff9 Binary files differnew file mode 100644 index 000000000..4e9c44775 --- /dev/null +++ b/!NetSurf/About/libcurl,ff9 diff --git a/!NetSurf/About/libpng,b60 b/!NetSurf/About/libpng,b60 Binary files differnew file mode 100644 index 000000000..49798c8ed --- /dev/null +++ b/!NetSurf/About/libpng,b60 diff --git a/!NetSurf/About/libxml,b60 b/!NetSurf/About/libxml,b60 Binary files differnew file mode 100644 index 000000000..f7605f6a6 --- /dev/null +++ b/!NetSurf/About/libxml,b60 diff --git a/!NetSurf/About/nslogo,b60 b/!NetSurf/About/nslogo,b60 Binary files differnew file mode 100644 index 000000000..9dc185593 --- /dev/null +++ b/!NetSurf/About/nslogo,b60 diff --git a/!NetSurf/About/openssl,695 b/!NetSurf/About/openssl,695 Binary files differnew file mode 100644 index 000000000..3d3c90c9f --- /dev/null +++ b/!NetSurf/About/openssl,695 diff --git a/!NetSurf/Resources/en/Messages b/!NetSurf/Resources/en/Messages index 5635197f5..a5b548f82 100644 --- a/!NetSurf/Resources/en/Messages +++ b/!NetSurf/Resources/en/Messages @@ -1,4 +1,5 @@ # English messages for NetSurf +Version:0.01 # Menus NetSurf:NetSurf @@ -27,4 +28,3 @@ Downloaded:Download complete, %lu bytes Not2xx:Server returned an error - @@ -13,7 +13,7 @@ OBJECTS_COMMON = cache.o content.o fetch.o fetchcache.o other.o \ OBJECTS = $(OBJECTS_COMMON) \ browser.o netsurf.o \ dialog.o download.o gif.o gui.o jpeg.o menus.o png.o theme.o plugin.o \ - options.o filetype.o font.o uri.o htmlredraw.o sprite.o draw.o + options.o filetype.o font.o uri.o htmlredraw.o sprite.o draw.o about.o OBJECTS_DEBUG = $(OBJECTS_COMMON) \ netsurfd.o \ optionsd.o filetyped.o fontd.o diff --git a/riscos/about.c b/riscos/about.c new file mode 100644 index 000000000..1becfdb17 --- /dev/null +++ b/riscos/about.c @@ -0,0 +1,275 @@ +/* + * This file is part of NetSurf, http://netsurf.sourceforge.net/ + * Licensed under the GNU General Public License, + * http://www.opensource.org/licenses/gpl-license + * Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk> + */ + +/** \file + * About page creation. + * Dynamically creates the about page, scanning for available plugin information. + */ + +#include <assert.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <unixlib/local.h> /* for __unixify */ + +#include "netsurf/riscos/about.h" +#include "netsurf/utils/log.h" +#include "netsurf/utils/messages.h" +#include "netsurf/utils/utils.h" + +#include "oslib/osargs.h" +#include "oslib/osfile.h" +#include "oslib/osfind.h" +#include "oslib/osfscontrol.h" + +static const char *version = "%s (%s %s %s)"; /**< version string prototype */ +static const char *pabouthdr = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><html><head><title>About NetSurf</title></head><body bgcolor=\"#f3f3ff\"><!-- About header --><table border=\"0\" width=\"100%%\" bgcolor=\"#94adff\" cellspacing=\"2\"><tr><td><a href=\"http://netsurf.sf.net\"><img src=\"file:///%%3CNetSurf$Dir%%3E/About/nslogo\" alt=\"Netsurf logo\"></a><td><table bgcolor=\"#94adff\" border=\"0\"><tr><td> <tr><td align=\"center\"><h2>NetSurf %s</h2><tr><td align=\"center\"><h5>Copyright © 2002, 2003 NetSurf Developers.</h5><tr><td> </table></table><hr>"; /**< About page header */ +static const char *pabtplghd = "<!-- Plugin information --><strong><i>The following plugins are installed on your system:</i></strong><br> <br><table border=\"0\" cellspacing=\"2\" width=\"100%\">"; /**< Plugin table header */ +static const char *paboutpl1 = "<tr valign=\"top\"><td width=\"30%%\"><font size=\"2\"><strong>%s</strong></font></td><td width=\"70%%\"><font size=\"2\">%s</font></td></tr><tr><td colspan=\"2\" bgcolor=\"#dddddd\" height=\"1\"></td></tr>"; /**< Plugin entry without image */ +static const char *paboutpl2 = "<tr valign=\"top\"><td width=\"30%%\"><font size=\"2\"><strong>%s</strong></font><br><img src=\"%s\" alt=\"%s\"></td><td width=\"70%%\"><font size=\"2\">%s</font></td></tr><tr><td colspan=\"2\" bgcolor=\"#dddddd\" height=\"1\"></td></tr>";/**< Plugin entry with image (filename=nn) */ +static const char *paboutpl3 = "<tr valign=\"top\"><td width=\"30%%\"><font size=\"2\"><strong>%s</strong></font><br><img src=\"%s\" alt=\"%s\" width=\"%d\" height=\"%d\"></td><td width=\"70%%\"><font size=\"2\">%s</font></td></tr><tr><tr><td colspan=\"2\" bgcolor=\"#dddddd\" height=\"1\"></td></tr>"; /**< Plugin entry with image (filename=nnwwwwhhhh) */ +static const char *pabtplgft = "</table>"; /**< Plugin table footer */ +static const char *paboutftr = "</body></html>"; /**< Page footer */ + +/** The about page */ +struct about_page { + + char *header; /**< page header */ + char *browser; /**< browser details */ + char *plghead; /**< plugin header */ + struct plugd *plugd; /**< plugin details list */ + char *plgfoot; /**< plugin footer */ + char *footer; /**< page footer */ +}; + +/** A set of plugin details */ +struct plugd { + + char *details; /**< plugin details */ + struct plugd *next; /**< next plugin details */ +}; + +struct plugd *new_plugin(struct plugd *pd, char* details); +char* populate_version(void); + +/** + * Fills in the version string. + * The release version is defined in the Messages file. + */ +char *populate_version(void) { + + char *p; + char *day; + char *mon; + char *year; + char *temp = xcalloc(12, sizeof(char)); + char *ret = xcalloc(20, sizeof(char)); + + sprintf(temp, "%s", __DATE__); + p = strchr(temp, ' '); + *p = 0; + mon = strdup(temp); + day = p+1; + p = strchr(day, ' '); + *p = 0; + year = p+1; + + sprintf(ret, version, messages_get("Version"), day, mon, year); + + xfree(temp); + + return ret; +} + +/** + * Adds a plugin's details to the head of the linked list of plugin details + * Returns the new head of the list + */ +struct plugd *new_plugin(struct plugd *pd, char* details) { + + struct plugd *np = xcalloc(1, sizeof(*np)); + + np->details = 0; + np->details = details; + + np->next = pd; + return np; +} + +/** + * Creates the about page and stores it in <Wimp$ScrapDir>.WWW.Netsurf + */ +void about_create(void) { + + struct about_page *abt; + struct plugd *temp; + FILE *fp; + char *buf, *val, var[20], *ptype, *pdetails, *fname, *furl, *p, *leafname; + int i, nofiles, j, w, h, size; + os_fw fh; + os_error *e; + + abt = (struct about_page*)xcalloc(1, sizeof(*abt)); + abt->plugd = 0; + + /* Page header */ + buf = xcalloc(strlen(pabouthdr) + 20, sizeof(char)); + sprintf(buf, pabouthdr, populate_version()); + abt->header = xstrdup(buf); + xfree(buf); + + /* browser details */ + xosfile_read_stamped_no_path("<NetSurf$Dir>.About.About",0,0,0,&i,0,0); + fp = fopen("<NetSurf$Dir>.About.About", "r"); + buf = xcalloc((unsigned int)i + 10, sizeof(char)); + fread(buf, sizeof(char), (unsigned int)i, fp); + fclose(fp); + abt->browser = xstrdup(buf); + xfree(buf); + + /* plugin header */ + abt->plghead = xstrdup(pabtplghd); + + /* plugin footer */ + abt->plgfoot = xstrdup(pabtplgft); + + /* Page footer */ + abt->footer = xstrdup(paboutftr); + + /* plugins registered */ + for (i=0; i!=4096; i++) { + sprintf(var, "Plugin$About_%3.3x", i); + + if ((val = getenv(var)) != 0) { + /* Plugin Name */ + sprintf(var, "Plugin$Type_%3.3x", i); + ptype = getenv(var); + + buf = xcalloc(strlen(val) + 20, sizeof(char)); + /* count files which match <Plugin$About_i>.About* */ + sprintf(buf, "%s.About*", val); + xosfscontrol_count(buf,0,0,0,0,0,0,&nofiles); + + for (j=0; j!=nofiles; j++) { + /* get plugin details */ + if (j == 0) { + sprintf(buf, "%s.About", val); + } + else { + sprintf(buf, "%s.About%2.2d", val, j); + } + e = xosfile_read_stamped_no_path(buf,0,0,0,&size,0,0); + + /* If only one file, name can be "About" or "About00" */ + if((e && j == 0) || size < 0) { + sprintf(buf, "%s.About%2.2d", val, j); + e = xosfile_read_stamped_no_path(buf,0,0,0,&size,0,0); + } + /* ok, no file found. try again */ + if(e || size < 0) { + continue; + } + + /* read contents of file */ + fp = fopen(buf, "r"); + pdetails = xcalloc((unsigned int)size + 10, sizeof(char)); + fread(pdetails, sizeof(char), (unsigned int)size, fp); + fclose(fp); + + /* now see if there's an image to display */ + sprintf(buf, "%s.%2.2d", val, j); + e = xosfile_read_stamped_no_path(buf,0,0,0,&size,0,0); + + if(e || size < 0) { + sprintf(buf, "%s.%2.2d*", val, j); + e = xosfile_read_stamped_no_path(buf,0,0,0,&size,0,0); + + if(e || size < 0) { + /* Type 1: no image file */ + furl = xcalloc(strlen(paboutpl1) + strlen(ptype) + strlen(pdetails) + 10, sizeof(char)); + sprintf(furl, paboutpl1, ptype, pdetails); + abt->plugd = new_plugin(abt->plugd, furl); + xfree(pdetails); + continue; + } + else { + /* Type 3: image file with name xxwwwwhhhh */ + /* get actual file name - isn't there an easier way? */ + fname = xcalloc(strlen(buf)+40, sizeof(char)); + xosfind_openinw(osfind_NO_PATH, buf, 0, &fh); + xosargs_read_pathw(fh, fname, (int)strlen(buf)+10,0); + xosfind_closew(fh); + + furl = xcalloc(strlen(fname) + 20, sizeof(char)); + + /* grab leafname and get width and height */ + p = strrchr(fname, '.'); + leafname = xstrdup(p); + h = atoi(leafname+7); + leafname[7] = 0; + w = atoi(leafname+3); + + /* convert to URL */ + __unixify(fname, 0, furl, strlen(fname)+20, 0); + sprintf(fname, "file://%s", furl); + xfree(furl); + + furl = xcalloc(strlen(paboutpl3) + strlen(ptype) + strlen(fname) + strlen(pdetails) + 10, sizeof(char)); + sprintf(furl, paboutpl3, ptype, fname, ptype, w, h, pdetails); + abt->plugd = new_plugin(abt->plugd, furl); + xfree(fname); + xfree(pdetails); + continue; + } + } + else { + /* Type 2: image file with name xx */ + /* convert RO path to url */ + fname = xcalloc(strlen(buf) + 10, sizeof(char)); + furl = xcalloc(strlen(buf) + 10, sizeof(char)); + __unixify(buf, 0, furl, strlen(buf) + 10, 0); + sprintf(fname, "file://%s", furl); + xfree(furl); + + furl = xcalloc(strlen(paboutpl2) + strlen(ptype) + strlen(fname) + strlen(pdetails) + 10, sizeof(char)); + sprintf(furl, paboutpl2, ptype, fname, ptype, pdetails); + abt->plugd = new_plugin(abt->plugd, furl); + xfree(fname); + xfree(pdetails); + } + } + if (buf != 0) { + xfree(buf); + } + } + } + + /* write file */ + xosfile_create_dir("<Wimp$ScrapDir>.WWW", 77); + xosfile_create_dir("<Wimp$ScrapDir>.WWW.NetSurf", 77); + + fp = fopen("<Wimp$ScrapDir>.WWW.Netsurf.About", "w+"); + fprintf(fp, "%s", abt->header); + fprintf(fp, "%s", abt->browser); + fprintf(fp, "%s", abt->plghead); + while (abt->plugd != 0) { + fprintf(fp, "%s", abt->plugd->details); + temp = abt->plugd; + abt->plugd = abt->plugd->next; + xfree(temp); + } + fprintf(fp, "%s", abt->plgfoot); + fprintf(fp, "%s", abt->footer); + fclose(fp); + + xosfile_set_type("<Wimp$ScrapDir>.WWW.NetSurf.About", 0xfaf); + + xfree(abt); + + return; +} + diff --git a/riscos/about.h b/riscos/about.h new file mode 100644 index 000000000..cdcdcc885 --- /dev/null +++ b/riscos/about.h @@ -0,0 +1,14 @@ +/* + * This file is part of NetSurf, http://netsurf.sourceforge.net/ + * Licensed under the GNU General Public License, + * http://www.opensource.org/licenses/gpl-license + * Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk> + */ + +#ifndef _NETSURF_RISCOS_ABOUT_H_ +#define _NETSURF_RISCOS_ABOUT_H_ + +void about_create(void); + +#endif + diff --git a/riscos/gui.c b/riscos/gui.c index 39764a7d9..5636a528a 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -26,6 +26,7 @@ #include "netsurf/desktop/options.h" #include "netsurf/render/font.h" #include "netsurf/render/html.h" +#include "netsurf/riscos/about.h" #include "netsurf/riscos/gui.h" #include "netsurf/riscos/plugin.h" #include "netsurf/riscos/theme.h" @@ -1377,7 +1378,14 @@ void ro_gui_keypress(wimp_key* key) xfree(g->data.browser.bw->url); g->data.browser.bw->url = NULL; } - browser_window_open_location(g->data.browser.bw, g->url); + if (strcasecmp(g->url, "about:") == 0) { + about_create(); + browser_window_open_location(g->data.browser.bw, + "file:///%3CWimp$ScrapDir%3E/WWW/NetSurf/About"); + } + else { + browser_window_open_location(g->data.browser.bw, g->url); + } return; } else if (key->c == wimp_KEY_F8) |