diff options
Diffstat (limited to 'frontends/atari')
29 files changed, 182 insertions, 987 deletions
diff --git a/frontends/atari/Makefile b/frontends/atari/Makefile index a2f27e2f2..2f6d7118b 100644 --- a/frontends/atari/Makefile +++ b/frontends/atari/Makefile @@ -8,7 +8,7 @@ # toolchain is located in /usr/bin and the wildcard matching # fails then. So this wildcard matches only works for # the netsurf environment! -STRIP := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*strip) +STRIP := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*-strip) STACK := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*stack) FT2CF := $(GCCSDK_INSTALL_ENV)/bin/freetype-config @@ -33,10 +33,31 @@ endif # non-pkgconfig components -FREETYPE_FONT_CFLAGS := $(shell $(FT2CF) --cflags) -DWITH_FREETYPE_FONT_DRIVER SPIDERMONKEY_CFLAGS := -DXP_UNIX -DJS_HAS_FILE_OBJECT=0 -DJSOPTION_JIT=0 -DPOSIX_SOURCE -D_BSD_SOURCE -$(eval $(call feature_enabled,ATARI_FREETYPE_FONT,$(FREETYPE_FONT_CFLAGS),-lfreetype,(Freetype))) +# freetype is optional but older versions do not use pkg-config +ifeq ($(NETSURF_USE_ATARI_FREETYPE_FONT),YES) + NETSURF_USE_FREETYPE2 := AUTO + NETSURF_FEATURE_FREETYPE2_CFLAGS := -DWITH_FREETYPE_FONT_DRIVER + + $(eval $(call pkg_config_find_and_add_enabled,FREETYPE2,freetype2,freetype2)) + + # try and use non pkg-config method + ifeq ($(NETSURF_USE_FREETYPE2),NO) + FREETYPE_CONFIG_EXISTS := $(shell $(FT2CF) --cflags >/dev/null && echo yes) + ifeq ($(FREETYPE_CONFIG_EXISTS),yes) + NETSURF_USE_FREETYPE2 := YES + CFLAGS += $(shell $(FT2CF) --cflags) $(NETSURF_FEATURE_FREETYPE2_CFLAGS) + LDFLAGS += $(shell $(FT2CF) --libs) + $(info FT2.CNFG: freetype2 (freetype2) enabled) + else + $(info FT2.CNFG: freetype2 (freetype2) failed) + $(error Unable to find library for: freetype2) + endif + endif +endif + + $(eval $(call feature_enabled,ATARI_NETSURF_FONT,-DWITH_INTERNAL_FONT_DRIVER,,(Internal Font))) $(eval $(call feature_enabled,ATARI_VDI_FONT,-DWITH_VDI_FONT_DRIVER,,(VDI Font))) $(eval $(call feature_enabled,ATARI_8BPP_SUPPORT,-DWITH_8BPP_SUPPORT,,(Indexed screen format support))) @@ -64,7 +85,6 @@ S_FRONTEND := \ clipboard.c \ ctxmenu.c \ cookies.c \ - certview.c \ deskmenu.c \ download.c \ encoding.c \ @@ -75,7 +95,6 @@ S_FRONTEND := \ gui.c \ hotlist.c \ history.c \ - login.c \ misc.c \ osspec.c \ redrawslots.c \ @@ -104,8 +123,16 @@ S_FRONTEND := \ # Note this is deliberately *not* expanded here as common and image # are not yet available SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_FRONTEND) + +# --------------------------------------------------------------------------- +# Target setup +# --------------------------------------------------------------------------- + EXETARGET := ns$(SUBTARGET)$(PRGSUFFIX) +# The filter and target for split messages +MESSAGES_FILTER=atari + # ---------------------------------------------------------------------------- # Install target # ---------------------------------------------------------------------------- @@ -118,12 +145,8 @@ ATARI_FONT_SOURCE_URL := http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-ve #ATARI_FONT_SOURCE_URL := http://localhost/$(ATARI_FONT_NAME).tar.gz ATARI_FONT_TMP_DIR := $(DEPROOT)/../ ATARI_FONT_SOURCE_DIR := $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME)/ -ATARI_GENERIC_RESOURCES := de en it ja -ATARI_RESOURCES := $(addprefix \!NetSurf/Resources/,$(ATARI_GENERIC_RESOURCES)) - -# ---------------------------------------------------------------------------- -# Install target -# ---------------------------------------------------------------------------- +ATARI_GENERIC_RESOURCES := de en it ja nl +ATARI_RESOURCES := $(addprefix resources/,$(ATARI_GENERIC_RESOURCES)) install-atari: @@ -138,7 +161,7 @@ $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME): package-atari: $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME) $(PKGNAME) $(VQ)echo Creating $(PKGNAME) -$(PKGNAME): $(EXETARGET) +$(PKGNAME): $(EXETARGET) $(POSTEXES) ifneq ($(strip $(STRIP)),) $(Q)echo Stripping symbols from $(EXETARGET) with $(STRIP) $(Q)$(STRIP) $(EXETARGET) @@ -168,20 +191,19 @@ endif $(Q)cp $(ATARI_RES_DIR)/netsurf.rsc $(ATARI_TARGET_DIR)res/netsurf.rsc $(Q)cp $(ATARI_RES_DIR)/languages $(ATARI_TARGET_DIR)res/languages $(Q)cp $(ATARI_RES_DIR)/icons/toolbar -R $(ATARI_TARGET_DIR)res/icons - $(Q)cp \!NetSurf/Resources/Icons/* -R $(ATARI_TARGET_DIR)res/icons/ - - $(Q)cp \!NetSurf/Resources/netsurf.png,b60 $(ATARI_TARGET_DIR)res/netsurf.png - $(Q)cp \!NetSurf/Resources/AdBlock,f79 $(ATARI_TARGET_DIR)res/adblock.css - $(Q)cp \!NetSurf/Resources/CSS,f79 $(ATARI_TARGET_DIR)res/default.css - $(Q)cp \!NetSurf/Resources/Quirks,f79 $(ATARI_TARGET_DIR)res/quirks.css - $(Q)cp \!NetSurf/Resources/internal.css,f79 $(ATARI_TARGET_DIR)res/internal.css - $(Q)cp \!NetSurf/Resources/SearchEngines $(ATARI_TARGET_DIR)res/search - $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle - $(Q)$(SPLIT_MESSAGES) -l en -p atari -f messages resources/FatMessages > $(ATARI_TARGET_DIR)res/messages - $(Q)cp \!NetSurf/Resources/en/welcome.html,faf $(ATARI_TARGET_DIR)res/welcome.html - $(Q)cp \!NetSurf/Resources/en/maps.html,faf $(ATARI_TARGET_DIR)res/maps.html - $(Q)cp \!NetSurf/Resources/en/licence.html,faf $(ATARI_TARGET_DIR)res/licence.html - $(Q)cp \!NetSurf/Resources/en/credits.html,faf $(ATARI_TARGET_DIR)res/credits.html + $(Q)cp resources/icons/* -R $(ATARI_TARGET_DIR)res/icons/ + + $(Q)cp resources/netsurf.png $(ATARI_TARGET_DIR)res/netsurf.png + $(Q)cp resources/adblock.css $(ATARI_TARGET_DIR)res/adblock.css + $(Q)cp resources/default.css $(ATARI_TARGET_DIR)res/default.css + $(Q)cp resources/quirks.css $(ATARI_TARGET_DIR)res/quirks.css + $(Q)cp resources/internal.css $(ATARI_TARGET_DIR)res/internal.css + $(Q)cp resources/SearchEngines $(ATARI_TARGET_DIR)res/search + $(Q)cp resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle + $(Q)$(INSTALL) -m 644 -T $(MESSAGES_TARGET)/en/Messages $(ATARI_TARGET_DIR)res/messages + $(Q)cp resources/en/welcome.html $(ATARI_TARGET_DIR)res/welcome.html + $(Q)cp resources/en/licence.html $(ATARI_TARGET_DIR)res/licence.html + $(Q)cp resources/en/credits.html $(ATARI_TARGET_DIR)res/credits.html # copy "Bitstream Vera" font: $(Q)cp $(ATARI_FONT_SOURCE_DIR)RELEASENOTES.TXT $(ATARI_TARGET_DIR)res/fonts/ diff --git a/frontends/atari/Makefile.tools b/frontends/atari/Makefile.tools new file mode 100644 index 000000000..971ab21be --- /dev/null +++ b/frontends/atari/Makefile.tools @@ -0,0 +1,19 @@ +# -*- mode: makefile-gmake -*- +## +## atari target tool setup +## + +ifeq ($(HOST),atari) + PKG_CONFIG := pkg-config +else + ifeq ($(HOST),mint) + PKG_CONFIG := pkg-config + else + GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-atari-mint/env + GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/m68k-atari-mint/cross/bin + + CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc) + + PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config + endif +endif
\ No newline at end of file diff --git a/frontends/atari/bitmap.c b/frontends/atari/bitmap.c index ae42da837..9b5a016a5 100644 --- a/frontends/atari/bitmap.c +++ b/frontends/atari/bitmap.c @@ -77,36 +77,36 @@ int init_mfdb(int bpp, int w, int h, uint32_t flags, MFDB * out ) * \param pixdata NULL or an memory address to use as the bitmap pixdata * \return an opaque struct bitmap, or NULL on memory exhaustion */ -static void *atari_bitmap_create_ex( int w, int h, short bpp, int rowstride, unsigned int state, void * pixdata ) +static void *atari_bitmap_create_ex( int w, int h, short bpp, int rowstride, enum gui_bitmap_flags flags, void * pixdata ) { - struct bitmap * bitmap; + struct bitmap * bitmap; - NSLOG(netsurf, INFO, - "width %d (rowstride: %d, bpp: %d), height %d, state %u", w, - rowstride, bpp, h, state); + NSLOG(netsurf, INFO, + "width %d (rowstride: %d, bpp: %d), height %d, flags %u", w, + rowstride, bpp, h, (unsigned)flags); if( rowstride == 0) { rowstride = bpp * w; } assert( rowstride >= (w * bpp) ); - bitmap = calloc(1 , sizeof(struct bitmap) ); - if (bitmap) { + bitmap = calloc(1 , sizeof(struct bitmap) ); + if (bitmap) { if( pixdata == NULL) { - bitmap->pixdata = calloc(1, (rowstride * h)+128); + bitmap->pixdata = calloc(1, (rowstride * h)+128); } else { bitmap->pixdata = pixdata; } - if (bitmap->pixdata != NULL) { + if (bitmap->pixdata != NULL) { bitmap->width = w; bitmap->height = h; - bitmap->opaque = (state & BITMAP_OPAQUE) ? true : false; + bitmap->opaque = (flags & BITMAP_OPAQUE) ? true : false; bitmap->bpp = bpp; bitmap->resized = NULL; bitmap->rowstride = rowstride; - } else { + } else { free(bitmap); bitmap=NULL; NSLOG(netsurf, INFO, "Out of memory!"); @@ -118,9 +118,9 @@ static void *atari_bitmap_create_ex( int w, int h, short bpp, int rowstride, uns /* exported interface documented in atari/bitmap.h */ -void *atari_bitmap_create(int w, int h, unsigned int state) +void *atari_bitmap_create(int w, int h, enum gui_bitmap_flags flags) { - return atari_bitmap_create_ex( w, h, NS_BMP_DEFAULT_BPP, w * NS_BMP_DEFAULT_BPP, state, NULL ); + return atari_bitmap_create_ex( w, h, NS_BMP_DEFAULT_BPP, w * NS_BMP_DEFAULT_BPP, flags, NULL ); } /** @@ -249,21 +249,6 @@ void atari_bitmap_destroy(void *bitmap) /** - * Save a bitmap in the platform's native format. - * - * \param bitmap a bitmap, as returned by bitmap_create() - * \param path pathname for file - * \param flags flags controlling how the bitmap is saved. - * \return true on success, false on error and error reported - */ - -static bool bitmap_save(void *bitmap, const char *path, unsigned flags) -{ - return true; -} - - -/** * Sets whether a bitmap should be plotted opaque * * \param bitmap a bitmap, as returned by bitmap_create() @@ -284,40 +269,6 @@ static void bitmap_set_opaque(void *bitmap, bool opaque) } -/** - * Tests whether a bitmap has an opaque alpha channel - * - * \param bitmap a bitmap, as returned by bitmap_create() - * \return whether the bitmap is opaque - */ -static bool bitmap_test_opaque(void *bitmap) -{ - int tst; - struct bitmap *bm = bitmap; - - if (bitmap == NULL) { - NSLOG(netsurf, INFO, "NULL bitmap!"); - return false; - } - - if( nsoption_int(atari_transparency) == 0 ){ - return( true ); - } - - tst = bm->width * bm->height; - - while (tst-- > 0) { - if (bm->pixdata[(tst << 2) + 3] != 0xff) { - NSLOG(netsurf, INFO, - "bitmap %p has transparency", bm); - return false; - } - } - NSLOG(netsurf, INFO, "bitmap %p is opaque", bm); - return true; -} - - /* exported interface documented in atari/bitmap.h */ bool atari_bitmap_get_opaque(void *bitmap) { @@ -358,22 +309,12 @@ int atari_bitmap_get_height(void *bitmap) return(bm->height); } - -/** - * Gets the number of BYTES per pixel. - */ -static size_t bitmap_get_bpp(void *bitmap) -{ - struct bitmap *bm = bitmap; - return bm->bpp; -} - /* exported interface documented in atari/bitmap.h */ bool atari_bitmap_resize(struct bitmap *img, HermesHandle hermes_h, HermesFormat *fmt, int nw, int nh) { - unsigned int state = 0; - short bpp = bitmap_get_bpp( img ); + enum gui_bitmap_flags flags = 0; + short bpp = img->bpp; int stride = atari_bitmap_get_rowstride( img ); int err; @@ -389,9 +330,9 @@ bool atari_bitmap_resize(struct bitmap *img, HermesHandle hermes_h, /* allocate the mem for resized bitmap */ if (img->opaque == true) { - state |= BITMAP_OPAQUE; + flags |= BITMAP_OPAQUE; } - img->resized = atari_bitmap_create_ex( nw, nh, bpp, nw*bpp, state, NULL ); + img->resized = atari_bitmap_create_ex( nw, nh, bpp, nw*bpp, flags, NULL ); if( img->resized == NULL ) { printf("W: %d, H: %d, bpp: %d\n", nw, nh, bpp); assert(img->resized); @@ -439,13 +380,10 @@ static struct gui_bitmap_table bitmap_table = { .destroy = atari_bitmap_destroy, .set_opaque = bitmap_set_opaque, .get_opaque = atari_bitmap_get_opaque, - .test_opaque = bitmap_test_opaque, .get_buffer = bitmap_get_buffer, .get_rowstride = atari_bitmap_get_rowstride, .get_width = atari_bitmap_get_width, .get_height = atari_bitmap_get_height, - .get_bpp = bitmap_get_bpp, - .save = bitmap_save, .modified = bitmap_modified, .render = bitmap_render, }; diff --git a/frontends/atari/bitmap.h b/frontends/atari/bitmap.h index b0fa18069..88985ad3c 100644 --- a/frontends/atari/bitmap.h +++ b/frontends/atari/bitmap.h @@ -54,7 +54,7 @@ */ #define MFDB_SIZE( bpp, stride, h ) ( ((stride >> 3) * h) * bpp ) -struct gui_bitmap_table *atari_bitmap_table; +extern struct gui_bitmap_table *atari_bitmap_table; struct bitmap { int width; @@ -90,7 +90,7 @@ int init_mfdb(int bpp, int w, int h, uint32_t flags, MFDB * out ); * \param state a flag word indicating the initial state * \return an opaque struct bitmap, or NULL on memory exhaustion */ -void *atari_bitmap_create(int w, int h, unsigned int state); +void *atari_bitmap_create(int w, int h, enum gui_bitmap_flags flags); /** * Find the width of a pixel row in bytes. diff --git a/frontends/atari/certview.c b/frontends/atari/certview.c deleted file mode 100644 index 80d18a059..000000000 --- a/frontends/atari/certview.c +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright 2013 Ole Loots <ole@monochrom.net> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -#include <ctype.h> -#include <string.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <time.h> - -#include "utils/nsoption.h" -#include "utils/log.h" -#include "utils/messages.h" -#include "utils/utils.h" -#include "desktop/sslcert_viewer.h" - -#include "atari/gui.h" -#include "atari/misc.h" -#include "atari/treeview.h" -#include "atari/certview.h" -#include "atari/findfile.h" -#include "atari/gemtk/gemtk.h" -#include "atari/res/netsurf.rsh" - -extern GRECT desk_area; - - -/* Setup Atari Treeview Callbacks: */ -static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw, - struct core_window_callback_table * default_callbacks); -static void atari_sslcert_viewer_finish(struct core_window *cw); -static void atari_sslcert_viewer_keypress(struct core_window *cw, - uint32_t ucs4); -static void atari_sslcert_viewer_mouse_action(struct core_window *cw, - browser_mouse_state mouse, - int x, int y); -static void atari_sslcert_viewer_draw(struct core_window *cw, int x, - int y, struct rect *clip, - const struct redraw_context *ctx); -static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]); - -static struct atari_treeview_callbacks atari_sslcert_viewer_treeview_callbacks = { - .init_phase2 = atari_sslcert_viewer_init_phase2, - .finish = atari_sslcert_viewer_finish, - .draw = atari_sslcert_viewer_draw, - .keypress = atari_sslcert_viewer_keypress, - .mouse_action = atari_sslcert_viewer_mouse_action, - .gemtk_user_func = handle_event -}; - -/* static functions */ -static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin); - - -static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw, - struct core_window_callback_table *cb_t) -{ - struct atari_sslcert_viewer_s *cvwin; - struct sslcert_session_data *ssl_d; - - cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw); - - assert(cvwin); - - ssl_d = cvwin->ssl_session_data; - - assert(ssl_d); - - NSLOG(netsurf, INFO, "cw %p", cw); - - return(sslcert_viewer_init(cb_t, cw, ssl_d)); -} - -static void atari_sslcert_viewer_finish(struct core_window *cw) -{ - struct atari_sslcert_viewer_s *cvwin; - - assert(cw); - - cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw); - - /* This will also free the session data: */ - sslcert_viewer_fini(cvwin->ssl_session_data); - - NSLOG(netsurf, INFO, "cw %p", cw); -} - -static void atari_sslcert_viewer_draw(struct core_window *cw, int x, - int y, struct rect *clip, - const struct redraw_context *ctx) -{ - struct atari_sslcert_viewer_s *cvwin; - - assert(cw); - - cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw); - - assert(cvwin); - - sslcert_viewer_redraw(cvwin->ssl_session_data, x, y, clip, ctx); -} - -static void atari_sslcert_viewer_keypress(struct core_window *cw, uint32_t ucs4) -{ - struct atari_sslcert_viewer_s *cvwin; - - assert(cw); - - cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw); - - NSLOG(netsurf, INFO, "ucs4: %"PRIu32, ucs4); - sslcert_viewer_keypress(cvwin->ssl_session_data, ucs4); -} - -static void atari_sslcert_viewer_mouse_action(struct core_window *cw, - browser_mouse_state mouse, - int x, int y) -{ - struct atari_sslcert_viewer_s *cvwin; - - assert(cw); - - cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw); - - sslcert_viewer_mouse_action(cvwin->ssl_session_data, mouse, x, y); -} - - -static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) -{ - struct core_window *tv=NULL; - GRECT tb_area; - GUIWIN * gemtk_win; - struct atari_sslcert_viewer_s *cvwin = NULL; - short retval = 0; - OBJECT *toolbar; - - NSLOG(netsurf, INFO, "win %p", win); - - if(ev_out->emo_events & MU_MESAG){ - switch (msg[0]) { - - case WM_TOOLBAR: - toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT); - NSLOG(netsurf, INFO, "CERTVIEWER WM_TOOLBAR"); - tv = (struct core_window*) gemtk_wm_get_user_data(win); - assert(tv); - cvwin = (struct atari_sslcert_viewer_s *) - atari_treeview_get_user_data(tv); - switch (msg[4]) { - - case TOOLBAR_SSL_CERT_TRUSTED: - - if (toolbar[msg[4]].ob_state & OS_SELECTED) { - - } else { - - } - break; - } - - - gemtk_win = atari_treeview_get_gemtk_window(tv); - assert(gemtk_win); - //gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED; - atari_treeview_get_grect(tv, TREEVIEW_AREA_TOOLBAR, &tb_area); - evnt_timer(150); - gemtk_wm_exec_redraw(gemtk_win, &tb_area); - retval = 1; - break; - - case WM_CLOSED: - // TODO set perrmissions - toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT); - tv = (struct core_window*) gemtk_wm_get_user_data(win); - assert(tv); - cvwin = (struct atari_sslcert_viewer_s *) - atari_treeview_get_user_data(tv); - if (toolbar[TOOLBAR_SSL_CERT_TRUSTED].ob_state & OS_SELECTED) { - sslcert_viewer_accept(cvwin->ssl_session_data); - } else { - sslcert_viewer_reject(cvwin->ssl_session_data); - } - atari_sslcert_viewer_destroy(cvwin); - retval = 1; - break; - - default: break; - } - } - - return(retval); -} - -static void atari_sslcert_viewer_init(struct atari_sslcert_viewer_s * cvwin, - struct sslcert_session_data *ssl_d) -{ - assert(cvwin->init == false); - assert(cvwin->window == NULL); - assert(cvwin->tv == NULL); - - int flags = ATARI_TREEVIEW_WIDGETS; - short handle = -1; - OBJECT * tree = gemtk_obj_get_tree(TOOLBAR_SSL_CERT); - assert( tree ); - - handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h); - cvwin->window = gemtk_wm_add(handle, - GEMTK_WM_FLAG_DEFAULTS, NULL); - if (cvwin->window == NULL ) { - gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, - "Failed to allocate Treeview:\nCertviewer"); - return; - } - wind_set_str(handle, WF_NAME, (char*)"SSL Certificate"); - gemtk_wm_set_toolbar(cvwin->window, tree, 0, 0); - gemtk_wm_unlink(cvwin->window); - - cvwin->ssl_session_data = ssl_d; - cvwin->tv = atari_treeview_create(cvwin->window, - &atari_sslcert_viewer_treeview_callbacks, - cvwin, flags); - - if (cvwin->tv == NULL) { - /* handle it properly, clean up previous allocs */ - NSLOG(netsurf, INFO, "Failed to allocate treeview"); - return; - } - - cvwin->init = true; -} - -/* - * documented in certview.h - */ -void atari_sslcert_viewer_open(struct sslcert_session_data *ssl_d) -{ - struct atari_sslcert_viewer_s * cvwin; - - cvwin = calloc(1, sizeof(struct atari_sslcert_viewer_s)); - - assert(cvwin); - - atari_sslcert_viewer_init(cvwin, ssl_d); - - if (atari_treeview_is_open(cvwin->tv) == false) { - - GRECT pos; - pos.g_x = desk_area.g_w - desk_area.g_w / 4; - pos.g_y = desk_area.g_y; - pos.g_w = desk_area.g_w / 4; - pos.g_h = desk_area.g_h; - - atari_treeview_open(cvwin->tv, &pos); - } else { - wind_set(gemtk_wm_get_handle(cvwin->window), WF_TOP, 1, 0, - 0, 0); - } -} - - -static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin) -{ - assert(cvwin); - assert(cvwin->init); - assert(cvwin->window); - - NSLOG(netsurf, INFO, "cvwin %p", cvwin); - - if (atari_treeview_is_open(cvwin->tv)) - atari_treeview_close(cvwin->tv); - wind_delete(gemtk_wm_get_handle(cvwin->window)); - gemtk_wm_remove(cvwin->window); - cvwin->window = NULL; - atari_treeview_delete(cvwin->tv); - free(cvwin); - NSLOG(netsurf, INFO, "done"); -} diff --git a/frontends/atari/certview.h b/frontends/atari/certview.h deleted file mode 100644 index ff15d8076..000000000 --- a/frontends/atari/certview.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2013 Ole Loots <ole@monochrom.net> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -#ifndef CERTVIEW_H_INCLUDED -#define CERTVIEW_H_INCLUDED - -#include <inttypes.h> -#include <sys/types.h> -#include <string.h> - - -#include "assert.h" -#include "utils/nsoption.h" -#include "utils/log.h" -#include "desktop/sslcert_viewer.h" - -struct core_window; - -struct atari_sslcert_viewer_s { - GUIWIN * window; - //struct atari_treeview_window *tv;/*< The hotlist treeview handle. */ - struct core_window *tv; - struct sslcert_session_data *ssl_session_data; - bool init; -}; - -/** - * Initializes and opens an certificate inspector window - * \param ssl_d ssl session data created by sslcert_viewer_create_session_data - * - * The window takes ownership of the session data and free's the memory on exit. - */ -void atari_sslcert_viewer_open(struct sslcert_session_data *ssl_d); - - -#endif // CERTVIEW_H_INCLUDED diff --git a/frontends/atari/ctxmenu.c b/frontends/atari/ctxmenu.c index ef4f01ae2..eb6cc1611 100644 --- a/frontends/atari/ctxmenu.c +++ b/frontends/atari/ctxmenu.c @@ -216,7 +216,7 @@ void context_popup(struct gui_window * gw, short x, short y) browser_window_navigate( gw->browser->bw, hlcache_handle_get_url(ctx->ccdata.object), - browser_window_get_url(gw->browser->bw), + browser_window_access_url(gw->browser->bw), BW_NAVIGATE_DOWNLOAD, NULL, NULL, @@ -232,7 +232,7 @@ void context_popup(struct gui_window * gw, short x, short y) error = browser_window_navigate( gw->browser->bw, ctx->ccdata.link, - browser_window_get_url(gw->browser->bw), + browser_window_access_url(gw->browser->bw), BW_NAVIGATE_DOWNLOAD, NULL, NULL, @@ -269,7 +269,7 @@ void context_popup(struct gui_window * gw, short x, short y) error = browser_window_create( BW_CREATE_HISTORY | BW_CREATE_CLONE, ctx->ccdata.link, - browser_window_get_url(gw->browser->bw), + browser_window_access_url(gw->browser->bw), gw->browser->bw, NULL); if (error != NSERROR_OK) { diff --git a/frontends/atari/deskmenu.c b/frontends/atari/deskmenu.c index ded68ca5b..4426415bc 100644 --- a/frontends/atari/deskmenu.c +++ b/frontends/atari/deskmenu.c @@ -387,9 +387,7 @@ static void __CDECL menu_inc_scale(short item, short title, void *data) if(input_window == NULL) return; - browser_window_set_scale(input_window->browser->bw, - browser_window_get_scale(input_window->browser->bw) + 0.25, - true); + browser_window_set_scale(input_window->browser->bw, +0.25, false); } @@ -398,9 +396,7 @@ static void __CDECL menu_dec_scale(short item, short title, void *data) if(input_window == NULL) return; - browser_window_set_scale(input_window->browser->bw, - browser_window_get_scale(input_window->browser->bw) - 0.25, - true); + browser_window_set_scale(input_window->browser->bw, -0.25, false); } @@ -510,7 +506,7 @@ static void __CDECL menu_add_bookmark(short item, short title, void *data) if (input_window) { if( browser_window_has_content(input_window->browser->bw) ){ atari_hotlist_add_page( - nsurl_access(browser_window_get_url(input_window->browser->bw)), + nsurl_access(browser_window_access_url(input_window->browser->bw)), NULL ); } diff --git a/frontends/atari/encoding.h b/frontends/atari/encoding.h index 784aa8273..53db7b78b 100644 --- a/frontends/atari/encoding.h +++ b/frontends/atari/encoding.h @@ -25,7 +25,7 @@ #include "utils/utf8.h" -struct gui_utf8_table *atari_utf8_table; +extern struct gui_utf8_table *atari_utf8_table; nserror utf8_to_local_encoding(const char *string, size_t len, char **result); nserror utf8_from_local_encoding(const char *string, size_t len, char **result); diff --git a/frontends/atari/file.c b/frontends/atari/file.c index 235d8240f..81b67e86c 100644 --- a/frontends/atari/file.c +++ b/frontends/atari/file.c @@ -234,7 +234,7 @@ static nserror atari_mkdir_all(const char *fname) dname = strdup(fname); - sep = strrchr(dname, '/'); + sep = strrchr(dname, '\\'); if (sep == NULL) { /* no directory separator path is just filename so its ok */ free(dname); @@ -251,13 +251,13 @@ static nserror atari_mkdir_all(const char *fname) } return NSERROR_NOT_DIRECTORY; } - *sep = '/'; /* restore separator */ + *sep = '\\'; /* restore separator */ sep = dname; - while (*sep == '/') { + while (*sep == '\\') { sep++; } - while ((sep = strchr(sep, '/')) != NULL) { + while ((sep = strchr(sep, '\\')) != NULL) { *sep = 0; if (stat(dname, &sb) != 0) { if (nsmkdir(dname, S_IRWXU) != 0) { @@ -272,9 +272,9 @@ static nserror atari_mkdir_all(const char *fname) return NSERROR_NOT_DIRECTORY; } } - *sep = '/'; /* restore separator */ + *sep = '\\'; /* restore separator */ /* skip directory separators */ - while (*sep == '/') { + while (*sep == '\\') { sep++; } } diff --git a/frontends/atari/file.h b/frontends/atari/file.h index b368567c7..3e568834b 100644 --- a/frontends/atari/file.h +++ b/frontends/atari/file.h @@ -21,7 +21,7 @@ #include "utils/file.h" -struct gui_file_table *atari_file_table; +extern struct gui_file_table *atari_file_table; #endif /* FILE_C_INCLUDED */ diff --git a/frontends/atari/font.h b/frontends/atari/font.h index a01d000c0..c0eb99dcd 100644 --- a/frontends/atari/font.h +++ b/frontends/atari/font.h @@ -19,7 +19,7 @@ #ifndef NS_ATARI_FONT_H #define NS_ATARI_FONT_H -struct gui_layout_table *atari_layout_table; +extern struct gui_layout_table *atari_layout_table; #endif /* NETSURF_FB_FONT_H */ diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c index 6ee63b301..3b324f507 100644 --- a/frontends/atari/gui.c +++ b/frontends/atari/gui.c @@ -29,6 +29,7 @@ #include "utils/log.h" #include "utils/messages.h" #include "utils/corestrings.h" +#include "utils/nsoption.h" #include "netsurf/browser_window.h" #include "netsurf/layout.h" #include "netsurf/window.h" @@ -52,9 +53,7 @@ #include "atari/toolbar.h" #include "atari/hotlist.h" #include "atari/cookies.h" -#include "atari/certview.h" #include "atari/history.h" -#include "atari/login.h" #include "atari/encoding.h" #include "atari/res/netsurf.rsh" #include "atari/plot/plot.h" @@ -299,15 +298,11 @@ void gui_window_destroy(struct gui_window *gw) * \param gw The gui window to measure content area of. * \param width receives width of window * \param height receives height of window - * \param scaled whether to return scaled values * \return NSERROR_OK on sucess and width and height updated * else error code. */ static nserror -gui_window_get_dimensions(struct gui_window *gw, - int *width, - int *height, - bool scaled) +gui_window_get_dimensions(struct gui_window *gw, int *width, int *height) { GRECT rect; window_get_grect(gw->root, BROWSER_AREA_CONTENT, &rect); @@ -766,53 +761,6 @@ static void gui_set_clipboard(const char *buffer, size_t length, } } -static void gui_401login_open(nsurl *url, const char *realm, - nserror (*cb)(bool proceed, void *pw), void *cbpw) -{ - bool bres; - char * out = NULL; - bres = login_form_do( url, (char*)realm, &out); - if (bres) { - NSLOG(netsurf, INFO, "url: %s, realm: %s, auth: %s\n", - nsurl_access(url), realm, out); - urldb_set_auth_details(url, realm, out); - } - if (out != NULL) { - free( out ); - } - if (cb != NULL) { - cb(bres, cbpw); - } - -} - -static nserror -gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, - unsigned long num, nserror (*cb)(bool proceed, void *pw), - void *cbpw) -{ - struct sslcert_session_data *data; - NSLOG(netsurf, INFO, "url %s", nsurl_access(url)); - - // TODO: localize string - int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort|Details...]"); - if(b == 1){ - // Accept - urldb_set_cert_permissions(url, true); - cb(true, cbpw); - } else if(b == 2) { - // Reject - urldb_set_cert_permissions(url, false); - cb(false, cbpw); - } else if(b == 3) { - // Inspect - sslcert_viewer_create_session_data(num, url, cb, cbpw, certs, - &data); - atari_sslcert_viewer_open(data); - } - return NSERROR_OK; -} - void gui_set_input_gui_window(struct gui_window *gw) { NSLOG(netsurf, INFO, "Setting input window from: %p to %p\n", @@ -1065,6 +1013,45 @@ static void gui_init(int argc, char** argv) toolbar_init(); } + +/** + * process miscellaneous window events + * + * \param gw The window receiving the event. + * \param event The event code. + * \return NSERROR_OK when processed ok + */ +static nserror +gui_window_event(struct gui_window *gw, enum gui_window_event event) +{ + switch (event) { + case GW_EVENT_UPDATE_EXTENT: + gui_window_update_extent(gw); + break; + + case GW_EVENT_REMOVE_CARET: + gui_window_remove_caret(gw); + break; + + case GW_EVENT_NEW_CONTENT: + gui_window_new_content(gw); + break; + + case GW_EVENT_START_THROBBER: + gui_window_start_throbber(gw); + break; + + case GW_EVENT_STOP_THROBBER: + gui_window_stop_throbber(gw); + break; + + default: + break; + } + return NSERROR_OK; +} + + static struct gui_window_table atari_window_table = { .create = gui_window_create, .destroy = gui_window_destroy, @@ -1072,7 +1059,7 @@ static struct gui_window_table atari_window_table = { .get_scroll = gui_window_get_scroll, .set_scroll = gui_window_set_scroll, .get_dimensions = gui_window_get_dimensions, - .update_extent = gui_window_update_extent, + .event = gui_window_event, .set_title = gui_window_set_title, .set_url = gui_window_set_url, @@ -1080,10 +1067,6 @@ static struct gui_window_table atari_window_table = { .set_status = atari_window_set_status, .set_pointer = gui_window_set_pointer, .place_caret = gui_window_place_caret, - .remove_caret = gui_window_remove_caret, - .new_content = gui_window_new_content, - .start_throbber = gui_window_start_throbber, - .stop_throbber = gui_window_stop_throbber, }; static struct gui_clipboard_table atari_clipboard_table = { @@ -1099,11 +1082,8 @@ static struct gui_fetch_table atari_fetch_table = { static struct gui_misc_table atari_misc_table = { .schedule = atari_schedule, - .warning = atari_warn_user, .quit = gui_quit, - .cert_verify = gui_cert_verify, - .login = gui_401login_open, }; /* #define WITH_DBG_LOGFILE 1 */ diff --git a/frontends/atari/gui.h b/frontends/atari/gui.h index 9c9aaaa58..b10aef798 100644 --- a/frontends/atari/gui.h +++ b/frontends/atari/gui.h @@ -122,7 +122,6 @@ struct s_gui_win_root CMP_TOOLBAR toolbar; CMP_STATUSBAR statusbar; struct s_focus_info focus; - float scale; char * title; struct bitmap * icon; struct gui_window *active_gui_window; diff --git a/frontends/atari/login.c b/frontends/atari/login.c deleted file mode 100644 index 1b21c5d2a..000000000 --- a/frontends/atari/login.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2010 Ole Loots <ole@monochrom.net> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -#include "utils/config.h" -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdbool.h> -#include <cflib.h> - -#include "utils/errors.h" -#include "utils/utils.h" -#include "utils/messages.h" -#include "utils/log.h" - -#include "atari/gui.h" -#include "atari/misc.h" -#include "atari/login.h" -#include "atari/res/netsurf.rsh" - - -bool login_form_do(nsurl * url, char * realm, char ** out) -{ - char user[255]; - char pass[255]; - //const char * auth; - short exit_obj = 0; - OBJECT * tree; - - user[0] = 0; - pass[0] = 0; - - // TODO: use auth details for predefined login data - // auth = urldb_get_auth_details(url, realm); - tree = gemtk_obj_get_tree(LOGIN); - - assert(tree != NULL); - - exit_obj = simple_mdial(tree, 0); - - if(exit_obj == LOGIN_BT_LOGIN) { - get_string(tree, LOGIN_TB_USER, user); - get_string(tree, LOGIN_TB_PASSWORD, pass); - int size = strlen((char*)&user) + strlen((char*)&pass) + 2 ; - *out = malloc(size); - snprintf(*out, size, "%s:%s", user, pass); - } else { - *out = NULL; - } - return((exit_obj == LOGIN_BT_LOGIN)); -} - diff --git a/frontends/atari/login.h b/frontends/atari/login.h deleted file mode 100644 index b61808c71..000000000 --- a/frontends/atari/login.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2010 Ole Loots <ole@monochrom.net> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -#ifndef NS_LOGIN_H_INCLUDED -#define NS_LOGIN_H_INCLUDED - -#include "utils/nsurl.h" - -bool login_form_do( nsurl * host, char * realm, char **cbpw ); - -#endif diff --git a/frontends/atari/plot/font_freetype.c b/frontends/atari/plot/font_freetype.c index 1688e978b..3ff4ab115 100644 --- a/frontends/atari/plot/font_freetype.c +++ b/frontends/atari/plot/font_freetype.c @@ -25,6 +25,7 @@ #include "utils/log.h" #include "utils/nsoption.h" #include "netsurf/mouse.h" +#include "netsurf/bitmap.h" #include "netsurf/plot_style.h" #include "atari/gui.h" @@ -250,7 +251,7 @@ static void ft_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec) srec->face_id = (FTC_FaceID)font_faces[selected_face]; - srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE; + srec->width = srec->height = (fstyle->size * 64) / PLOT_STYLE_SCALE; srec->pixel = 0; /* calculate x/y resolution, when browser_get_dpi() isn't available */ diff --git a/frontends/atari/plot/font_internal.c b/frontends/atari/plot/font_internal.c index 709697f74..11732c5ea 100644 --- a/frontends/atari/plot/font_internal.c +++ b/frontends/atari/plot/font_internal.c @@ -25,6 +25,7 @@ #include "utils/utf8.h" #include "utils/log.h" #include "netsurf/mouse.h" +#include "netsurf/bitmap.h" #include "netsurf/plot_style.h" #include "atari/gui.h" diff --git a/frontends/atari/plot/font_vdi.c b/frontends/atari/plot/font_vdi.c index 7cd82ddc9..556c08e82 100644 --- a/frontends/atari/plot/font_vdi.c +++ b/frontends/atari/plot/font_vdi.c @@ -106,9 +106,9 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const c fx |= 1; vst_effects( self->vdi_handle, fx ); /* TODO: replace 90 with global dpi setting */ - //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); + //pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 / 72 ); //vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); - pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 ); + pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 ); vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh); /* if(slen != utf8_bounded_length(str, length)){ @@ -148,10 +148,10 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const if( fstyle->weight > 450 ) fx |= 1; vst_effects( self->vdi_handle, fx ); - //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); + //pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 / 72 ); //vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); - pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 ); + pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 ); vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh); *actual_x = 0; //*char_offset = 0; @@ -216,7 +216,7 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const if( fstyle->weight > 450 ) fx |= 1; vst_effects(self->vdi_handle, fx); - pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); + pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 / 72 ); vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); *actual_x = 0; *char_offset = 0; @@ -283,8 +283,8 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng /* TODO: netsurf uses 90 as default dpi ( somewhere defined in libcss), use that value or pass it as arg, to reduce netsurf dependency */ - //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); - pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); + //pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 / 72 ); + pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 / 72 ); plot_get_dimensions(&canvas); x += canvas.g_x; diff --git a/frontends/atari/plot/plot.c b/frontends/atari/plot/plot.c index 14c670352..4935b1776 100644 --- a/frontends/atari/plot/plot.c +++ b/frontends/atari/plot/plot.c @@ -2124,7 +2124,7 @@ plot_line(const struct redraw_context *ctx, { short pxy[4]; uint32_t lt; - int sw = pstyle->stroke_width; + int sw = plot_style_fixed_to_int(pstyle->stroke_width); if (((line->x0 < 0) && (line->x1 < 0)) || ((line->y0 < 0) && (line->y1 < 0))) { @@ -2183,7 +2183,7 @@ plot_rectangle(const struct redraw_context *ctx, { short pxy[4]; GRECT r, rclip, sclip; - int sw = pstyle->stroke_width; + int sw = plot_style_fixed_to_int(pstyle->stroke_width); uint32_t lt; /* current canvas clip: */ @@ -2266,7 +2266,7 @@ plot_rectangle(const struct redraw_context *ctx, if (pstyle->fill_type != PLOT_OP_TYPE_NONE ) { short stroke_width = (short)(pstyle->stroke_type != PLOT_OP_TYPE_NONE) ? - pstyle->stroke_width : 0; + plot_style_fixed_to_int(pstyle->stroke_width) : 0; vsf_rgbcolor(atari_plot_vdi_handle, pstyle->fill_colour); vsf_perimeter(atari_plot_vdi_handle, 0); @@ -2343,7 +2343,6 @@ plot_polygon(const struct redraw_context *ctx, * \param pstyle Style controlling the path plot. * \param p elements of path * \param n nunber of elements on path - * \param width The width of the path * \param transform A transform to apply to the path. * \return NSERROR_OK on success else error code. */ @@ -2352,7 +2351,6 @@ plot_path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, - float width, const float transform[6]) { /** \todo Implement atari path plot */ diff --git a/frontends/atari/res/netsurf.rsh b/frontends/atari/res/netsurf.rsh index c856501ae..be2bc949c 100755 --- a/frontends/atari/res/netsurf.rsh +++ b/frontends/atari/res/netsurf.rsh @@ -147,9 +147,6 @@ #define SETTINGS_EDIT_MIN_FONT_SIZE 28 /* FTEXT in tree SETTINGS */
#define SETTINGS_DEC_MIN_FONT_SIZE 29 /* BOXCHAR in tree SETTINGS */
#define SETTINGS_INC_MIN_FONT_SIZE 30 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_EDIT_MIN_GIF_DELAY 35 /* FTEXT in tree SETTINGS */
-#define SETTINGS_INC_GIF_DELAY 36 /* BOXCHAR in tree SETTINGS */
-#define SETTINGS_DEC_GIF_DELAY 37 /* BOXCHAR in tree SETTINGS */
#define SETTINGS_CB_ENABLE_ANIMATION 40 /* BUTTON in tree SETTINGS */
#define SETTINGS_CB_BG_IMAGES 42 /* BUTTON in tree SETTINGS */
#define SETTINGS_CB_FG_IMAGES 44 /* BUTTON in tree SETTINGS */
diff --git a/frontends/atari/res/netsurf.rsm b/frontends/atari/res/netsurf.rsm index 6c240d371..3122791f7 100755 --- a/frontends/atari/res/netsurf.rsm +++ b/frontends/atari/res/netsurf.rsm @@ -132,9 +132,6 @@ ResourceMaster v3.651 #O 28@29@EDIT_MIN_FONT_SIZE@@
#O 29@27@DEC_MIN_FONT_SIZE@@
#O 30@27@INC_MIN_FONT_SIZE@@
-#O 35@29@EDIT_MIN_GIF_DELAY@@
-#O 36@27@INC_GIF_DELAY@@
-#O 37@27@DEC_GIF_DELAY@@
#O 40@26@CB_ENABLE_ANIMATION@@
#O 42@26@CB_BG_IMAGES@@
#O 44@26@CB_FG_IMAGES@@
diff --git a/frontends/atari/rootwin.c b/frontends/atari/rootwin.c index 6576eac77..8fb3ec0f7 100644 --- a/frontends/atari/rootwin.c +++ b/frontends/atari/rootwin.c @@ -288,8 +288,6 @@ int window_create(struct gui_window * gw, assert(gw->browser); gw->browser->bw = bw; - gw->scale = browser_window_get_scale(bw); - /* create statusbar component: */ if(sb) { diff --git a/frontends/atari/search.h b/frontends/atari/search.h index 04dfed4eb..adac62652 100644 --- a/frontends/atari/search.h +++ b/frontends/atari/search.h @@ -43,7 +43,7 @@ typedef struct s_search_form_session * SEARCH_FORM_SESSION; struct s_search_form_session * nsatari_search_session_create(OBJECT * obj, struct gui_window *gw); -struct gui_search_table *atari_search_table; +extern struct gui_search_table *atari_search_table; void nsatari_search_session_destroy(struct s_search_form_session *s); void nsatari_search_perform(struct s_search_form_session *s, OBJECT *obj, diff --git a/frontends/atari/settings.c b/frontends/atari/settings.c index 7084bacf7..d76468c17 100644 --- a/frontends/atari/settings.c +++ b/frontends/atari/settings.c @@ -48,7 +48,6 @@ extern char options[PATH_MAX]; extern GRECT desk_area; -static float tmp_option_minimum_gif_delay; static unsigned tmp_option_memory_cache_size; static unsigned int tmp_option_disc_cache_size; static unsigned int tmp_option_expire_url; @@ -308,10 +307,6 @@ static void display_settings(void) INPUT_MIN_REFLOW_PERIOD_MAX_LEN ); - tmp_option_minimum_gif_delay = (float)nsoption_int(minimum_gif_delay) / (float)100; - snprintf( spare, 255, "%01.1f", tmp_option_minimum_gif_delay ); - set_text( SETTINGS_EDIT_MIN_GIF_DELAY, spare, 3 ); - /* "Network" tab: */ set_text( SETTINGS_EDIT_PROXY_HOST, nsoption_charp(http_proxy_host), INPUT_PROXY_HOST_MAX_LEN ); @@ -464,11 +459,6 @@ static void form_event(int index, int external) break; case SETTINGS_CB_ENABLE_ANIMATION: - if( checked ) { - ENABLE_OBJ( SETTINGS_EDIT_MIN_GIF_DELAY ); - } else { - DISABLE_OBJ( SETTINGS_EDIT_MIN_GIF_DELAY ); - } break; case SETTINGS_BT_SEL_FONT_RENDERER: @@ -697,23 +687,6 @@ static void form_event(int index, int external) OBJ_REDRAW(SETTINGS_EDIT_HISTORY_AGE); break; - case SETTINGS_INC_GIF_DELAY: - case SETTINGS_DEC_GIF_DELAY: - if( index == SETTINGS_INC_GIF_DELAY ) - tmp_option_minimum_gif_delay += 0.1; - else - tmp_option_minimum_gif_delay -= 0.1; - - if( tmp_option_minimum_gif_delay < 0.1 ) - tmp_option_minimum_gif_delay = 0.1; - if( tmp_option_minimum_gif_delay > 9.0 ) - tmp_option_minimum_gif_delay = 9.0; - snprintf( spare, 255, "%01.1f", tmp_option_minimum_gif_delay ); - set_text( SETTINGS_EDIT_MIN_GIF_DELAY, spare, 3 ); - is_button = true; - OBJ_REDRAW(SETTINGS_EDIT_MIN_GIF_DELAY); - break; - case SETTINGS_INC_MIN_FONT_SIZE: case SETTINGS_DEC_MIN_FONT_SIZE: if( index == SETTINGS_INC_MIN_FONT_SIZE ) @@ -817,8 +790,6 @@ static void apply_settings(void) OBJ_SELECTED(SETTINGS_CB_TRANSPARENCY)); nsoption_set_bool(animate_images, OBJ_SELECTED(SETTINGS_CB_ENABLE_ANIMATION)); - nsoption_set_int(minimum_gif_delay, - (int)(tmp_option_minimum_gif_delay*100+0.5)); /* nsoption_set_bool(incremental_reflow, OBJ_SELECTED(SETTINGS_CB_INCREMENTAL_REFLOW));*/ nsoption_set_int(min_reflow_period, tmp_option_min_reflow_period); diff --git a/frontends/atari/toolbar.c b/frontends/atari/toolbar.c index fdfedcbee..b8f42267f 100644 --- a/frontends/atari/toolbar.c +++ b/frontends/atari/toolbar.c @@ -94,7 +94,7 @@ static float toolbar_url_scale = 1.0; static plot_font_style_t font_style_url = { .family = PLOT_FONT_FAMILY_SANS_SERIF, - .size = 14*FONT_SIZE_SCALE, + .size = 14*PLOT_STYLE_SCALE, .weight = 400, .flags = FONTF_NONE, .background = 0xffffff, @@ -302,7 +302,7 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner) /* create the url widget: */ font_style_url.size = - toolbar_styles[t->style].font_height_pt * FONT_SIZE_SCALE; + toolbar_styles[t->style].font_height_pt * PLOT_STYLE_SCALE; textarea_flags ta_flags = TEXTAREA_INTERNAL_CARET; textarea_setup ta_setup; diff --git a/frontends/atari/treeview.c b/frontends/atari/treeview.c index 23db41309..6ab09991a 100644 --- a/frontends/atari/treeview.c +++ b/frontends/atari/treeview.c @@ -426,7 +426,7 @@ atari_treeview_invalidate_area(struct core_window *cw, * \param width the width in px, or negative if don't care * \param height the height in px, or negative if don't care */ -static void +static nserror atari_treeview_update_size(struct core_window *cw, int width, int height) { GRECT area; @@ -436,7 +436,7 @@ atari_treeview_update_size(struct core_window *cw, int width, int height) if (tv != NULL) { if (tv->disposing) - return; + return NSERROR_INVALID; /* Get acces to the gemtk window slider settings: */ slid = gemtk_wm_get_scroll_info(tv->window); @@ -465,6 +465,8 @@ atari_treeview_update_size(struct core_window *cw, int width, int height) */ gemtk_wm_update_slider(tv->window, GEMTK_WM_VH_SLIDER); } + + return NSERROR_OK; } @@ -474,11 +476,18 @@ atari_treeview_update_size(struct core_window *cw, int width, int height) * \param cw the core window object * \param r rectangle to make visible */ -static void -atari_treeview_scroll_visible(struct core_window *cw, const struct rect *r) +static nserror +atari_treeview_set_scroll(struct core_window *cw, int x, int y) { - /* atari frontend doesn't support dragging outside the treeview */ - /* so there is no need to implement this? */ + /* TODO */ + return NSERROR_OK; +} + +static nserror +atari_treeview_get_scroll(const struct core_window *cw, int *x, int *y) +{ + /* TODO */ + return NSERROR_NOT_IMPLEMENTED; } @@ -489,8 +498,8 @@ atari_treeview_scroll_visible(struct core_window *cw, const struct rect *r) * \param width to be set to viewport width in px, if non NULL * \param height to be set to viewport height in px, if non NULL */ -static void -atari_treeview_get_window_dimensions(struct core_window *cw, +static nserror +atari_treeview_get_window_dimensions(const struct core_window *cw, int *width, int *height) { @@ -501,6 +510,8 @@ atari_treeview_get_window_dimensions(struct core_window *cw, *width = work.g_w; *height = work.g_h; } + + return NSERROR_OK; } @@ -510,10 +521,10 @@ atari_treeview_get_window_dimensions(struct core_window *cw, * \param cw the core window object * \param ds the current drag status */ -static void +static nserror atari_treeview_drag_status(struct core_window *cw, core_window_drag_status ds) { - + return NSERROR_NOT_IMPLEMENTED; } @@ -523,7 +534,8 @@ atari_treeview_drag_status(struct core_window *cw, core_window_drag_status ds) static struct core_window_callback_table cw_t = { .invalidate = atari_treeview_invalidate_area, .update_size = atari_treeview_update_size, - .scroll_visible = atari_treeview_scroll_visible, + .set_scroll = atari_treeview_set_scroll, + .get_scroll = atari_treeview_get_scroll, .get_window_dimensions = atari_treeview_get_window_dimensions, .drag_status = atari_treeview_drag_status }; diff --git a/frontends/atari/verify_ssl.c b/frontends/atari/verify_ssl.c deleted file mode 100644 index b099fe488..000000000 --- a/frontends/atari/verify_ssl.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright 2010 Ole Loots <ole@monochrom.net> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdbool.h> -#include <windom.h> - -#include "utils/errors.h" -#include "utils/utils.h" -#include "utils/log.h" -#include "utils/messages.h" - -#include "atari/res/netsurf.rsh" -#include "atari/verify_ssl.h" - -/* - todo: this file need to use the treeview api - complete rework, - current implementation is not used in any way. -*/ - -extern void * h_gem_rsrc; -extern short atari_plot_vdi_handle; - - -#define CERT_INF_LINES 8 - -static struct ssl_info_draw_param -{ - struct ssl_cert_info * cert_infos_n; - unsigned long num_certs; - int current; - int scrollx; - int cols; - int scrolly; - int rows; /* assumed to be 8 */ - OBJECT * tree; -} dp; - - -static int cert_display_width( struct ssl_cert_info * cert_info ) -{ - int l1, l2; - int add = 16; /* strlen("Issuer: "); */ - - l1 = strlen(cert_info->issuer) + add; - l2 = strlen(cert_info->subject) + add; - return( MAX(l1, l2) ); -} - - -static void __CDECL cert_info_draw( WINDOW * win, short buf[8], void * data) -{ - struct ssl_info_draw_param * dp = (struct ssl_info_draw_param *)data; - GRECT work; - short pxy[4]; - int maxchars; - short d, cbh, cbw; - int i = 0; - short x,y,w,h; - int px_ypos; - char * line = malloc(512); - if( line == NULL ) - return; - - NSLOG(netsurf, INFO, - "Cert info draw, win: %p, data: %p, scrollx: %d", win, data, - dp->scrollx); - - WindGet( win, WF_WORKXYWH, &x, &y, &w, &h ); - /*using static values here, as RsrcUserDraw has mem leaks & a very small stack */ - pxy[0] = work.g_x = x + 8; - pxy[1] = work.g_y = y + 80; - pxy[2] = x + 8 + 272; - pxy[3] = y + 80 + 176; - work.g_w = 272; - work.g_h = 176; - - maxchars = (work.g_w / 8)+1; - vs_clip( atari_plot_vdi_handle, 1,(short*) &pxy ); - vswr_mode( atari_plot_vdi_handle, MD_REPLACE ); - vsf_interior( atari_plot_vdi_handle, 1 ); - vsf_color( atari_plot_vdi_handle, LWHITE ); - v_bar( atari_plot_vdi_handle, (short*)&pxy ); - vst_height( atari_plot_vdi_handle, 16, &d, &d, &cbw, &cbh ); - vst_alignment(atari_plot_vdi_handle, 0, 5, &d, &d ); - vst_color( atari_plot_vdi_handle, BLACK ); - vst_effects( atari_plot_vdi_handle, 0 ); - px_ypos = 0; - for(i=0; i<CERT_INF_LINES; i++ ) { - switch( i ) { - case 0: - sprintf(line, "Cert Version: %d", dp->cert_infos_n[dp->current].version ); - break; - - case 1: - sprintf(line, "Invalid before: %s", &dp->cert_infos_n[dp->current].not_before ); - break; - - case 2: - sprintf(line, "Invalid after: %s", &dp->cert_infos_n[dp->current].not_after ); - break; - - case 3: - sprintf(line, "Signature type: %d", dp->cert_infos_n[dp->current].sig_type ); - break; - - case 4: - sprintf(line, "Serial: %d", dp->cert_infos_n[dp->current].serial ); - break; - - case 5: - sprintf(line, "Issuer: %s", &dp->cert_infos_n[dp->current].issuer ); - break; - - case 6: - sprintf(line, "Subject: %s", &dp->cert_infos_n[dp->current].subject ); - break; - - case 7: - sprintf(line, "Cert type: %d", dp->cert_infos_n[dp->current].cert_type ); - break; - - default: - break; - } - if( (int)strlen(line) > dp->scrollx ) { - if( dp->scrollx + maxchars < 511 && ( (signed int)strlen(line) - dp->scrollx) > maxchars ) - line[dp->scrollx + maxchars] = 0; - v_gtext(atari_plot_vdi_handle, work.g_x + 1, work.g_y + px_ypos, &line[dp->scrollx]); - } - px_ypos += cbh; - } - vst_alignment(atari_plot_vdi_handle, 0, 0, &d, &d ); - vs_clip( atari_plot_vdi_handle, 0, (short*)&pxy ); - free( line ); -} - - -static void do_popup( WINDOW *win, int index, int mode, void *data) -{ - struct ssl_info_draw_param * dp = (struct ssl_info_draw_param *)data; - char * items[dp->num_certs]; - short x, y; - unsigned int i; - NSLOG(netsurf, INFO, "do_popup: num certs: %d", dp->num_certs); - for( i = 0; i<dp->num_certs; i++) { - items[i] = malloc( 48 ); - strncpy(items[i], (char*)&dp->cert_infos_n[i].issuer, 46 ); - } - objc_offset( FORM(win), index, &x, &y ); - dp->current = MenuPopUp( items, x, y, - dp->num_certs, MIN( 3, dp->num_certs), 0, - P_LIST + P_WNDW + P_CHCK ); - ObjcChange( OC_FORM, win, index, NORMAL, TRUE ); - dp->cols = cert_display_width( &dp->cert_infos_n[dp->current] ); - dp->rows = 8; - dp->scrollx = 0; - dp->scrolly = 0; - - /* Send (!) redraw ( OC_MSG ) */ - ObjcDrawParent( OC_FORM, FORM(win), VERIFY_BOX_DETAILS, 1, 7 | OC_MSG ); - for( i = 0; i<dp->num_certs; i++) { - free( items[i] ); - } -} - - - -bool -verify_ssl_form_do(const char * url, - const struct ssl_cert_info * cert_infos_n, - unsigned long num_certs) -{ - OBJECT *tree; - WINDOW * form; - - bool bres = false; - bool cont = true; - int res = 0; - - RsrcGaddr (h_gem_rsrc , R_TREE, VERIFY, &tree); - ObjcString( tree, VERIFY_LBL_HOST, (char*)url ); - ObjcChange( OC_OBJC, tree, VERIFY_BT_ACCEPT, 0, 0 ); - ObjcChange( OC_OBJC, tree, VERIFY_BT_REJECT, 0, 0 ); - form = FormWindBegin( tree, (char*)"SSL Verify failed" ); - - dp.cert_infos_n = (struct ssl_cert_info *)cert_infos_n; - dp.num_certs = num_certs; - dp.scrollx = 0; - dp.scrolly = 0; - dp.current = 0; - dp.cols = cert_display_width( &dp.cert_infos_n[dp.current] ); - dp.rows = 8; - dp.tree = tree; - EvntDataAdd( form, WM_REDRAW, cert_info_draw, (void*)&dp, EV_BOT ); - /* this results in some extended objects which can not be freed: :( */ - /* RsrcUserDraw( OC_FORM, tree, VERIFY_BOX_DETAILS, cert_info_draw,(void*)&dp ) ; */ - ObjcAttachFormFunc( form, VERIFY_BT_NEXT_CERT, do_popup, &dp ); - /* - ObjcAttachFormFunc( form, VERIFY_BT_NEXT_CERT, do_popup, &dp ); - ObjcAttachFormFunc( form, VERIFY_BT_NEXT_CERT, do_popup, &dp ); - */ - while( cont ) { - res = FormWindDo( MU_MESAG ); - cont = false; - switch( res ){ - case VERIFY_BT_ACCEPT: - bres = true; - break; - - case VERIFY_BT_NEXT_CERT: - /* select box clicked or dragged... */ - cont = true; - break; - - case VERIFY_BT_REJECT: - bres = false; - break; - - case VERIFY_BT_SCROLL_D: - cont = true; - dp.scrolly += 1; - ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG ); - break; - - case VERIFY_BT_SCROLL_U: - cont = true; - dp.scrolly -= 1; - ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG ); - break; - - case VERIFY_BT_SCROLL_R: - NSLOG(netsurf, INFO, "scroll r!"); - cont = true; - dp.scrollx += 1; - if( dp.scrollx > (dp.cols - (272 / 8 )) ) - dp.scrollx -= 1; - ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG); - break; - - case VERIFY_BT_SCROLL_L: - cont = true; - dp.scrollx -= 1; - if( dp.scrollx < 0 ) - dp.scrollx = 0; - ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG ); - break; - - default: - break; - } - } - FormWindEnd( ); - return( bres ); -} diff --git a/frontends/atari/verify_ssl.h b/frontends/atari/verify_ssl.h deleted file mode 100644 index b69bc9cfb..000000000 --- a/frontends/atari/verify_ssl.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2010 Ole Loots <ole@monochrom.net> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -#ifndef NS_VERIFY_SSL_H_INCLUDED -#define NS_VERIFY_SSL_H_INCLUDED - -bool verify_ssl_form_do( const char * url, const struct ssl_cert_info * cert_infos_n , unsigned long num_certs ); - -#endif |