From a8248a7bb9555e558cb8c7eed1146c62ab024130 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 20 Aug 2018 22:26:41 +0100 Subject: Update windows frontend to use windows resources --- frontends/windows/Makefile | 8 +- frontends/windows/fetch.c | 133 ++++++++++++++++++++++++++++ frontends/windows/fetch.h | 40 +++++++++ frontends/windows/filetype.c | 68 -------------- frontends/windows/filetype.h | 24 ----- frontends/windows/gui.c | 1 - frontends/windows/gui.h | 3 + frontends/windows/main.c | 59 +++++++----- frontends/windows/pointers.c | 1 - frontends/windows/res/icons/arrow-l.png | 1 + frontends/windows/res/icons/content.png | 1 + frontends/windows/res/icons/directory.png | 1 + frontends/windows/res/icons/directory2.png | 1 + frontends/windows/res/icons/hotlist-add.png | 1 + frontends/windows/res/icons/hotlist-rmv.png | 1 + frontends/windows/res/icons/search.png | 1 + frontends/windows/res/resource.rc | 75 +++++++++------- frontends/windows/resourceid.h | 9 +- frontends/windows/window.c | 6 +- 19 files changed, 273 insertions(+), 161 deletions(-) create mode 100644 frontends/windows/fetch.c create mode 100644 frontends/windows/fetch.h delete mode 100644 frontends/windows/filetype.c delete mode 100644 frontends/windows/filetype.h create mode 120000 frontends/windows/res/icons/arrow-l.png create mode 120000 frontends/windows/res/icons/content.png create mode 120000 frontends/windows/res/icons/directory.png create mode 120000 frontends/windows/res/icons/directory2.png create mode 120000 frontends/windows/res/icons/hotlist-add.png create mode 120000 frontends/windows/res/icons/hotlist-rmv.png create mode 120000 frontends/windows/res/icons/search.png (limited to 'frontends') diff --git a/frontends/windows/Makefile b/frontends/windows/Makefile index f6995910d..d22e17112 100644 --- a/frontends/windows/Makefile +++ b/frontends/windows/Makefile @@ -33,11 +33,15 @@ WSCFLAGS := -std=c99 -Dnswin32 -DCURL_STATICLIB -DCARES_STATICLIB -g CFLAGS += $(WSCFLAGS) LDFLAGS += $(WSCFLAGS) +# The filter and target for split messages +MESSAGES_FILTER=win +MESSAGES_TARGET=$(FRONTEND_RESOURCES_DIR) + # ---------------------------------------------------------------------------- # built-in resource setup # ---------------------------------------------------------------------------- -$(OBJROOT)/windows_resource.o: $(FRONTEND_RESOURCES_DIR)/resource.rc +$(OBJROOT)/windows_resource.o: $(FRONTEND_RESOURCES_DIR)/resource.rc $(addsuffix /Messages,$(addprefix $(MESSAGES_TARGET)/,$(MESSAGES_LANGUAGES))) $(VQ)echo " WINDRES: compiling windows resources" ${Q}$(WINDRES) $< -O coff -o $@ @@ -49,7 +53,7 @@ S_RESOURCES := windows_resource.o # sources purely for the windows build S_FRONTEND := main.c window.c gui.c drawable.c plot.c findfile.c \ - font.c bitmap.c about.c prefs.c download.c filetype.c file.c \ + font.c bitmap.c about.c prefs.c download.c fetch.c file.c \ local_history.c schedule.c windbg.c pointers.c login.c \ corewindow.c hotlist.c cookies.c global_history.c ssl_cert.c diff --git a/frontends/windows/fetch.c b/frontends/windows/fetch.c new file mode 100644 index 000000000..f69d7ad19 --- /dev/null +++ b/frontends/windows/fetch.c @@ -0,0 +1,133 @@ +/* + * Copyright 2018 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file + * Fetch operation implementation for win32 + */ + +#include +#include + +#include "utils/log.h" +#include "utils/file.h" +#include "utils/filepath.h" +#include "content/fetch.h" +#include "netsurf/fetch.h" + +#include "windows/fetch.h" +#include "windows/gui.h" + +/** + * determine the MIME type of a local file. + * + * \param unix_path The unix style path to the file. + * \return The mime type of the file. + */ +static const char *fetch_filetype(const char *unix_path) +{ + int l; + NSLOG(netsurf, INFO, "unix path %s", unix_path); + l = strlen(unix_path); + if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0) + return "text/css"; + if (2 < l && strcasecmp(unix_path + l - 3, "jpg") == 0) + return "image/jpeg"; + if (3 < l && strcasecmp(unix_path + l - 4, "jpeg") == 0) + return "image/jpeg"; + if (2 < l && strcasecmp(unix_path + l - 3, "gif") == 0) + return "image/gif"; + if (2 < l && strcasecmp(unix_path + l - 3, "png") == 0) + return "image/png"; + if (2 < l && strcasecmp(unix_path + l - 3, "jng") == 0) + return "image/jng"; + if (2 < l && strcasecmp(unix_path + l - 3, "svg") == 0) + return "image/svg"; + if (2 < l && strcasecmp(unix_path + l - 3, "bmp") == 0) + return "image/x-ms-bmp"; + return "text/html"; +} + +/** + * Translate resource to full win32 url. + * + * Transforms a resource: path into a full URL. The returned URL + * is used as the target for a redirect. The caller takes ownership of + * the returned nsurl including unrefing it when finished with it. + * + * \param path The path of the resource to locate. + * \return A string containing the full URL of the target object or + * NULL if no suitable resource can be found. + */ +static nsurl *nsw32_get_resource_url(const char *path) +{ + char buf[PATH_MAX]; + nsurl *url = NULL; + + netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url); + + return url; +} + + +/* exported interface documented in windows/fetch.h */ +nserror +nsw32_get_resource_data(const char *path, + const uint8_t **data_out, + size_t *data_len_out) +{ + HRSRC reshandle; + HGLOBAL datahandle; + uint8_t *data; + DWORD data_len; + + reshandle = FindResource(NULL, path, "USER"); + if (reshandle == NULL) { + return NSERROR_NOT_FOUND; + } + + data_len = SizeofResource(NULL, reshandle); + if (data_len == 0) { + return NSERROR_NOT_FOUND; + } + + datahandle = LoadResource(NULL, reshandle); + if (datahandle == NULL) { + return NSERROR_NOT_FOUND; + } + data = LockResource(datahandle); + if (data == NULL) { + return NSERROR_NOT_FOUND; + } + + *data_out = data; + *data_len_out = data_len; + + return NSERROR_OK; +} + + +/** win32 fetch operation table */ +static struct gui_fetch_table fetch_table = { + .filetype = fetch_filetype, + + .get_resource_url = nsw32_get_resource_url, + .get_resource_data = nsw32_get_resource_data, +}; + +struct gui_fetch_table *win32_fetch_table = &fetch_table; diff --git a/frontends/windows/fetch.h b/frontends/windows/fetch.h new file mode 100644 index 000000000..20984f14a --- /dev/null +++ b/frontends/windows/fetch.h @@ -0,0 +1,40 @@ +/* + * Copyright 2014 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _NETSURF_WINDOWS_FILETYPE_H_ +#define _NETSURF_WINDOWS_FILETYPE_H_ + +/** + * win32 API fetch operation table + */ +struct gui_fetch_table *win32_fetch_table; + +/** + * Translate resource to win32 resource data. + * + * Obtains the data for a resource directly + * + * \param path The path of the resource to locate. + * \param data Pointer to recive data into + * \param data_len Pointer to length of returned data + * \return NSERROR_OK and the data and length values updated + * else appropriate error code. + */ +nserror nsw32_get_resource_data(const char *path, const uint8_t **data_out, size_t *data_len_out); + +#endif diff --git a/frontends/windows/filetype.c b/frontends/windows/filetype.c deleted file mode 100644 index a5fd9e95e..000000000 --- a/frontends/windows/filetype.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2003 James Bursa - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file - * Fetch operation implementation for win32 - */ - -#include -#include - -#include "utils/log.h" -#include "content/fetch.h" -#include "netsurf/fetch.h" - -#include "windows/filetype.h" - -/** - * determine the MIME type of a local file. - * - * \param unix_path The unix style path to the file. - * \return The mime type of the file. - */ -static const char *fetch_filetype(const char *unix_path) -{ - int l; - NSLOG(netsurf, INFO, "unix path %s", unix_path); - l = strlen(unix_path); - if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0) - return "text/css"; - if (2 < l && strcasecmp(unix_path + l - 3, "jpg") == 0) - return "image/jpeg"; - if (3 < l && strcasecmp(unix_path + l - 4, "jpeg") == 0) - return "image/jpeg"; - if (2 < l && strcasecmp(unix_path + l - 3, "gif") == 0) - return "image/gif"; - if (2 < l && strcasecmp(unix_path + l - 3, "png") == 0) - return "image/png"; - if (2 < l && strcasecmp(unix_path + l - 3, "jng") == 0) - return "image/jng"; - if (2 < l && strcasecmp(unix_path + l - 3, "svg") == 0) - return "image/svg"; - if (2 < l && strcasecmp(unix_path + l - 3, "bmp") == 0) - return "image/x-ms-bmp"; - return "text/html"; -} - -/** win32 fetch operation table */ -static struct gui_fetch_table fetch_table = { - .filetype = fetch_filetype, -}; - -struct gui_fetch_table *win32_fetch_table = &fetch_table; diff --git a/frontends/windows/filetype.h b/frontends/windows/filetype.h deleted file mode 100644 index f71a0b2da..000000000 --- a/frontends/windows/filetype.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2014 Vincent Sanders - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef _NETSURF_WINDOWS_FILETYPE_H_ -#define _NETSURF_WINDOWS_FILETYPE_H_ - -struct gui_fetch_table *win32_fetch_table; - -#endif diff --git a/frontends/windows/gui.c b/frontends/windows/gui.c index 674484fea..bafe5a4b7 100644 --- a/frontends/windows/gui.c +++ b/frontends/windows/gui.c @@ -40,7 +40,6 @@ #include "windows/schedule.h" #include "windows/window.h" -#include "windows/filetype.h" #include "windows/gui.h" /** diff --git a/frontends/windows/gui.h b/frontends/windows/gui.h index 5fd9decb2..95dcfc1b2 100644 --- a/frontends/windows/gui.h +++ b/frontends/windows/gui.h @@ -28,6 +28,9 @@ extern HINSTANCE hinst; /** Directory where all configuration files are held. */ extern char *nsw32_config_home; +/** resource search path vector. */ +extern char **respaths; + /* bounding box */ typedef struct bbox_s { int x0; diff --git a/frontends/windows/main.c b/frontends/windows/main.c index 5dd1e7316..fd22ae1fe 100644 --- a/frontends/windows/main.c +++ b/frontends/windows/main.c @@ -51,12 +51,12 @@ #include "windows/window.h" #include "windows/schedule.h" #include "windows/font.h" -#include "windows/filetype.h" +#include "windows/fetch.h" #include "windows/pointers.h" #include "windows/bitmap.h" #include "windows/gui.h" -static char **respaths; /** resource search path vector. */ +char **respaths; /** exported global defined in windows/gui.h */ char *nsw32_config_home; /* exported global defined in windows/gui.h */ @@ -119,15 +119,6 @@ static void die(const char *error) } -static nsurl *gui_get_resource_url(const char *path) -{ - char buf[PATH_MAX]; - nsurl *url = NULL; - - netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url); - - return url; -} /** * Ensures output logging stream is available @@ -135,7 +126,7 @@ static nsurl *gui_get_resource_url(const char *path) static bool nslog_ensure(FILE *fptr) { /* mwindows compile flag normally invalidates standard io unless - * already redirected + * already redirected */ if (_get_osfhandle(fileno(fptr)) == -1) { AllocConsole(); @@ -206,7 +197,7 @@ static nserror set_defaults(struct nsoption_s *defaults) } free(buf); - + /* ensure homepage option has a default */ nsoption_setnull_charp(homepage_url, strdup(NETSURF_HOMEPAGE)); @@ -269,6 +260,32 @@ static nserror nsw32_option_init(int *pargc, char** argv) return NSERROR_OK; } +/** + * Initialise messages + */ +static nserror nsw32_messages_init(char **respaths) +{ + char *messages; + nserror res; + const uint8_t *data; + size_t data_size; + + res = nsw32_get_resource_data("messages", &data, &data_size); + if (res == NSERROR_OK) { + res = messages_add_from_inline(data, data_size); + } else { + /* Obtain path to messages */ + messages = filepath_find(respaths, "messages"); + if (messages == NULL) { + res = NSERROR_NOT_FOUND; + } else { + res = messages_add_from_file(messages); + free(messages); + } + } + + return res; +} static struct gui_misc_table win32_misc_table = { .schedule = win32_schedule, @@ -288,7 +305,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) int argc = 0, argctemp = 0; size_t len; LPWSTR *argvw; - char *messages; nserror ret; const char *addr; nsurl *url; @@ -303,7 +319,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) .bitmap = win32_bitmap_table, .layout = win32_layout_table, }; - win32_fetch_table->get_resource_url = gui_get_resource_url; ret = netsurf_register(&win32_table); if (ret != NSERROR_OK) { @@ -339,7 +354,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) } /* initialise logging - not fatal if it fails but not much we - * can do about it + * can do about it */ nslog_init(nslog_ensure, &argc, argv); @@ -361,10 +376,14 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) respaths = nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH); - /* message init */ - messages = filepath_find(respaths, "messages"); - messages_add_from_file(messages); - free(messages); + /* Initialise translated messages */ + ret = nsw32_messages_init(respaths); + if (ret != NSERROR_OK) { + fprintf(stderr, "Unable to load translated messages (%s)\n", + messages_get_errorcode(ret)); + NSLOG(netsurf, INFO, "Unable to load translated messages"); + /** \todo decide if message load faliure should be fatal */ + } /* common initialisation */ ret = netsurf_init(NULL); diff --git a/frontends/windows/pointers.c b/frontends/windows/pointers.c index a730e4bd2..333ef1a9a 100644 --- a/frontends/windows/pointers.c +++ b/frontends/windows/pointers.c @@ -33,7 +33,6 @@ #include "windows/schedule.h" #include "windows/window.h" -#include "windows/filetype.h" #include "windows/pointers.h" struct nsws_pointers { diff --git a/frontends/windows/res/icons/arrow-l.png b/frontends/windows/res/icons/arrow-l.png new file mode 120000 index 000000000..6e580c561 --- /dev/null +++ b/frontends/windows/res/icons/arrow-l.png @@ -0,0 +1 @@ +../../../../resources/icons/arrow-l.png \ No newline at end of file diff --git a/frontends/windows/res/icons/content.png b/frontends/windows/res/icons/content.png new file mode 120000 index 000000000..dd71532dc --- /dev/null +++ b/frontends/windows/res/icons/content.png @@ -0,0 +1 @@ +../../../../resources/icons/content.png \ No newline at end of file diff --git a/frontends/windows/res/icons/directory.png b/frontends/windows/res/icons/directory.png new file mode 120000 index 000000000..71aee69d5 --- /dev/null +++ b/frontends/windows/res/icons/directory.png @@ -0,0 +1 @@ +../../../../resources/icons/directory.png \ No newline at end of file diff --git a/frontends/windows/res/icons/directory2.png b/frontends/windows/res/icons/directory2.png new file mode 120000 index 000000000..4daa093d0 --- /dev/null +++ b/frontends/windows/res/icons/directory2.png @@ -0,0 +1 @@ +../../../../resources/icons/directory2.png \ No newline at end of file diff --git a/frontends/windows/res/icons/hotlist-add.png b/frontends/windows/res/icons/hotlist-add.png new file mode 120000 index 000000000..5039509fc --- /dev/null +++ b/frontends/windows/res/icons/hotlist-add.png @@ -0,0 +1 @@ +../../../../resources/icons/hotlist-add.png \ No newline at end of file diff --git a/frontends/windows/res/icons/hotlist-rmv.png b/frontends/windows/res/icons/hotlist-rmv.png new file mode 120000 index 000000000..2b592cd13 --- /dev/null +++ b/frontends/windows/res/icons/hotlist-rmv.png @@ -0,0 +1 @@ +../../../../resources/icons/hotlist-rmv.png \ No newline at end of file diff --git a/frontends/windows/res/icons/search.png b/frontends/windows/res/icons/search.png new file mode 120000 index 000000000..e30f7bee8 --- /dev/null +++ b/frontends/windows/res/icons/search.png @@ -0,0 +1 @@ +../../../../resources/icons/search.png \ No newline at end of file diff --git a/frontends/windows/res/resource.rc b/frontends/windows/res/resource.rc index 8160bce33..e41a705a5 100644 --- a/frontends/windows/res/resource.rc +++ b/frontends/windows/res/resource.rc @@ -17,38 +17,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDR_NETSURF_BANNER BITMAP "banner.bmp" -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDR_THROBBER_FRAME0_BITMAP BITMAP "throbber/throbber0.bmp" - - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDR_THROBBER_FRAME1_BITMAP BITMAP "throbber/throbber1.bmp" - - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDR_THROBBER_FRAME2_BITMAP BITMAP "throbber/throbber2.bmp" - - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDR_THROBBER_FRAME3_BITMAP BITMAP "throbber/throbber3.bmp" - - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDR_THROBBER_FRAME4_BITMAP BITMAP "throbber/throbber4.bmp" - - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDR_THROBBER_FRAME5_BITMAP BITMAP "throbber/throbber5.bmp" - - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDR_THROBBER_FRAME6_BITMAP BITMAP "throbber/throbber6.bmp" - - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDR_THROBBER_FRAME7_BITMAP BITMAP "throbber/throbber7.bmp" - - LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDR_TOOLBAR_BITMAP BITMAP "toolbar.bmp" @@ -60,7 +28,8 @@ IDR_TOOLBAR_BITMAP_GREY BITMAP "toolbarg.bmp" LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDR_TOOLBAR_BITMAP_HOT BITMAP "toolbarh.bmp" - +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_THROBBER_AVI AVI "throbber.avi" // // Menu resources @@ -315,3 +284,43 @@ FONT 8, "MS Shell Dlg", 0, 0, 1 // LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDR_NETSURF_ICON ICON "NetSurf.ico" + + +// +// User resources +// + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +default.css USER "default.css" +adblock.css USER "adblock.css" +internal.css USER "internal.css" +quirks.css USER "quirks.css" +welcome.html USER "welcome.html" +licence.html USER "licence.html" +credits.html USER "credits.html" +netsurf.png USER "netsurf.png" +icons/arrow-l.png USER "icons/arrow-l.png" +icons/content.png USER "icons/content.png" +icons/directory.png USER "icons/directory.png" +icons/directory2.png USER "icons/directory2.png" +icons/hotlist-add.png USER "icons/hotlist-add.png" +icons/hotlist-rmv.png USER "icons/hotlist-rmv.png" +icons/search.png USER "icons/search.png" + +/* translated messages */ + +/* english is the fallback */ +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +messages USER "en/Messages" + +LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT +messages USER "fr/Messages" + +LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT +messages USER "de/Messages" + +LANGUAGE LANG_ITALIAN, SUBLANG_DEFAULT +messages USER "it/Messages" + +LANGUAGE LANG_DUTCH, SUBLANG_DEFAULT +messages USER "nl/Messages" diff --git a/frontends/windows/resourceid.h b/frontends/windows/resourceid.h index 9e70d6342..e86d8eedb 100644 --- a/frontends/windows/resourceid.h +++ b/frontends/windows/resourceid.h @@ -24,20 +24,13 @@ #endif #define IDR_NETSURF_ICON 100 +#define IDR_THROBBER_AVI 101 #define IDR_TOOLBAR_BITMAP 102 #define IDR_TOOLBAR_BITMAP_GREY 103 #define IDR_TOOLBAR_BITMAP_HOT 104 #define IDR_NETSURF_BANNER 105 #define IDR_HOME_BITMAP 106 -#define IDR_THROBBER_FRAME0_BITMAP 110 -#define IDR_THROBBER_FRAME1_BITMAP 111 -#define IDR_THROBBER_FRAME2_BITMAP 112 -#define IDR_THROBBER_FRAME3_BITMAP 113 -#define IDR_THROBBER_FRAME4_BITMAP 114 -#define IDR_THROBBER_FRAME5_BITMAP 115 -#define IDR_THROBBER_FRAME6_BITMAP 116 -#define IDR_THROBBER_FRAME7_BITMAP 117 #define IDD_ABOUT 1000 #define IDC_IMG1 1001 diff --git a/frontends/windows/window.c b/frontends/windows/window.c index 3ccf8295e..681b2e282 100644 --- a/frontends/windows/window.c +++ b/frontends/windows/window.c @@ -534,7 +534,6 @@ nsws_window_throbber_create(HINSTANCE hInstance, struct gui_window *gw) { HWND hwnd; - char avi[PATH_MAX]; int urlx, urly, urlwidth, urlheight; urlbar_dimensions(hWndParent, @@ -554,9 +553,8 @@ nsws_window_throbber_create(HINSTANCE hInstance, hInstance, NULL); - nsws_find_resource(avi, "throbber.avi", "windows/res/throbber.avi"); - NSLOG(netsurf, INFO, "setting throbber avi as %s", avi); - Animate_Open(hwnd, avi); + Animate_Open(hwnd, MAKEINTRESOURCE(IDR_THROBBER_AVI)); + if (gw->throbbing) { Animate_Play(hwnd, 0, -1, -1); } else { -- cgit v1.2.3