diff options
Diffstat (limited to 'atari')
78 files changed, 14499 insertions, 6867 deletions
diff --git a/atari/Makefile.defaults b/atari/Makefile.defaults index 150358843..83464d6fd 100644 --- a/atari/Makefile.defaults +++ b/atari/Makefile.defaults @@ -32,17 +32,21 @@ # Valid options: YES, NO NETSURF_USE_ATARI_NETSURF_FONT := YES + # Enable VDI Font rendering + # Valid options: YES, NO + NETSURF_USE_ATARI_VDI_FONT := NO + # Configure support for screen drivers with no true colour mode # Valid options: YES, NO NETSURF_USE_ATARI_8BPP_SUPPORT := NO # Configure the CPU target # Valid options: 68000, 68020-60, 5475 (coldfire) - ATARI_ARCH = 68020-60 + ATARIARCH = 68020-60 # enable optimizations # -O2 is currently broken with m68000 / m68020-60 builds - CFLAGS += -O1 + CFLAGS += -O3 # override warning flags removing -Wall WARNFLAGS = -W -Wundef -Wpointer-arith \ diff --git a/atari/Makefile.target b/atari/Makefile.target index 8e87a741d..d3392928d 100644 --- a/atari/Makefile.target +++ b/atari/Makefile.target @@ -7,23 +7,23 @@ # manually via env. variables, because the m68k-atari-mint # toolchain is located in /usr/bin and the wildcard matching # fails then. So this wildcard matches only works for -# the netsurf environment! +# the netsurf environment! STRIP := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*strip) STACK := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*stack) -ifeq ($(ATARI_ARCH),68000) +ifeq ($(ATARIARCH),68000) PRGSUFFIX := 000.app PKGNAME := ns000.zip endif -ifeq ($(ATARI_ARCH),68020-60) +ifeq ($(ATARIARCH),68020-60) CFLAGS += -m68020-60 LDFLAGS += -m68020-60 PRGSUFFIX := 020.app PKGNAME := ns020.zip endif -ifeq ($(ATARI_ARCH),5475) +ifeq ($(ATARIARCH),v4e) CFLAGS += -mcpu=5475 LDFLAGS += -mcpu=5475 PRGSUFFIX := v4e.app @@ -40,6 +40,7 @@ $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng))) $(eval $(call feature_enabled,MOZJS,$(SPIDERMONKEY_CFLAGS),-ljs,JavaScript (Spidermonkey))) $(eval $(call feature_enabled,ATARI_FREETYPE_FONT,$(FREETYPE_FONT_CFLAGS),-lfreetype,(Freetype))) $(eval $(call feature_enabled,ATARI_NETSURF_FONT,-DWITH_INTERNAL_FONT_DRIVER,,(Internal Font))) +$(eval $(call feature_enabled,ATARI_VDI_FONT,-DWITH_VDI_FONT_DRIVER,,(Internal Font))) $(eval $(call feature_enabled,ATARI_8BPP_SUPPORT,-DWITH_8BPP_SUPPORT,,(Indexed screen format support))) # define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here @@ -68,20 +69,50 @@ CFLAGS += -U__STRICT_ANSI__ -std=c99 -Dsmall $(WARNFLAGS) -Dnsatari \ LDFLAGS += -lcflib -lcurl LDFLAGS += -lcss -lparserutils -ldom -lwapcaplet -lhubbub LDFLAGS += -lssl -lcrypto -LDFLAGS += -lz -liconv -lcares -lHermes -lwindom -lgem -lm +LDFLAGS += -lz -liconv -lcares -lHermes -lgem -lm LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib # S_ATARI are sources purely for the Atari FreeMiNT build -S_ATARI := gui.c findfile.c filetype.c misc.c bitmap.c schedule.c \ - download.c thumbnail.c login.c verify_ssl.c treeview.c hotlist.c history.c\ - search.c font.c \ - plot/plot.c plot/fontplot.c plot/eddi.s \ - plot/font_freetype.c plot/font_internal.c \ - redrawslots.c encoding.c \ - browser_win.c toolbar.c statusbar.c browser.c \ - global_evnt.c osspec.c dragdrop.c system_colour.c \ - ctxmenu.c settings.c msgbox.c +S_ATARI := \ + bitmap.c \ + clipboard.c \ + findfile.c \ + filetype.c \ + font.c \ + gui.c \ + misc.c \ + schedule.c \ + download.c \ + thumbnail.c \ + login.c \ + treeview.c \ + hotlist.c \ + history.c\ + search.c \ + redrawslots.c \ + encoding.c \ + rootwin.c \ + toolbar.c \ + statusbar.c \ + osspec.c \ + system_colour.c \ + ctxmenu.c \ + settings.c \ + deskmenu.c \ + plot/plot.c \ + plot/fontplot.c \ + plot/eddi.s \ + plot/font_freetype.c \ + plot/font_internal.c \ + plot/font_vdi.c \ + gemtk/aestabs.c \ + gemtk/dragdrop.c \ + gemtk/guiwin.c \ + gemtk/msgbox.c \ + gemtk/utils.c \ + gemtk/objc.c + S_ATARI := $(addprefix atari/,$(S_ATARI)) # This is the final source build list diff --git a/atari/Makefile.target.orig b/atari/Makefile.target.orig new file mode 100644 index 000000000..25951b961 --- /dev/null +++ b/atari/Makefile.target.orig @@ -0,0 +1,120 @@ +# ---------------------------------------------------------------------------- +# Atari target setup +# ---------------------------------------------------------------------------- + +ifeq ($(ATARI_ARCH),68000) +PRGSUFFIX := 000.app +PKGNAME := ns000.zip +endif + +ifeq ($(ATARI_ARCH),68020-60) +CFLAGS += -m68020-60 +LDFLAGS += -m68020-60 +PRGSUFFIX := 020.app +PKGNAME := ns020.zip +endif + +ifeq ($(ATARI_ARCH),5475) +CFLAGS += -mcpu=5475 +LDFLAGS += -mcpu=5475 +PRGSUFFIX := v4e.app +PKGNAME := nsv4e.zip +endif + +# non-pkgconfig components + +FREETYPE_FONT_CFLAGS := $(shell freetype-config --cflags) -DWITH_FREETYPE_FONT_DRIVER +SPIDERMONKEY_CFLAGS := -DWITH_MOZJS -DXP_UNIX -DJS_HAS_FILE_OBJECT=0 -DJSOPTION_JIT=0 -DPOSIX_SOURCE -D_BSD_SOURCE + +$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG/MNG/JNG (libmng))) +$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng))) +$(eval $(call feature_enabled,MOZJS,$(SPIDERMONKEY_CFLAGS),-ljs,JavaScript (Spidermonkey))) +$(eval $(call feature_enabled,ATARI_FREETYPE_FONT,$(FREETYPE_FONT_CFLAGS),-lfreetype,(Freetype))) +$(eval $(call feature_enabled,ATARI_NETSURF_FONT,-DWITH_INTERNAL_FONT_DRIVER,,(Internal Font))) +$(eval $(call feature_enabled,ATARI_8BPP_SUPPORT,-DWITH_8BPP_SUPPORT,,(Indexed screen format support))) + +# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here +NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG +NETSURF_FEATURE_HUBBUB_CFLAGS := -DWITH_HUBBUB +NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP +NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF +NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0 +NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0 + +ifeq ($(NETSURF_USE_MOZJS),YES) +NETSURF_USE_JS:=YES +NETSURF_USE_MOZJS:=YES +endif + +$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP)) +$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF)) + +CFLAGS += -U__STRICT_ANSI__ -std=c99 -I. -Dsmall $(WARNFLAGS) -Dnsatari \ + -D_BSD_SOURCE \ + -D_XOPEN_SOURCE=600 \ + -D_POSIX_C_SOURCE=200112L \ + $(shell $(PKG_CONFIG) --cflags libhubbub libcss openssl ) \ + $(shell $(PKG_CONFIG) --cflags libxml-2.0 ) \ + $(shell $(PKG_CONFIG) --cflags libcurl ) + +LDFLAGS += -lcflib -lcurl +LDFLAGS += -lcss -lparserutils -ldom -lwapcaplet -lhubbub +LDFLAGS += -lssl -lcrypto +LDFLAGS += -lxml2 -lz -liconv -lcares -lHermes -lwindom -lgem -lm +LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib + + +# S_ATARI are sources purely for the Atari FreeMiNT build +S_ATARI := gui.c findfile.c filetype.c misc.c bitmap.c schedule.c \ + download.c thumbnail.c login.c verify_ssl.c treeview.c hotlist.c history.c\ + search.c font.c \ + plot/plot.c plot/fontplot.c plot/eddi.s \ + plot/font_freetype.c plot/font_internal.c \ + redrawslots.c encoding.c \ + browser_win.c toolbar.c statusbar.c browser.c \ + global_evnt.c osspec.c dragdrop.c system_colour.c \ + ctxmenu.c save.c settings.c +S_ATARI := $(addprefix atari/,$(S_ATARI)) + +# This is the final source build list +# Note this is deliberately *not* expanded here as common and image +# are not yet available +SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_ATARI) +EXETARGET := ns$(SUBTARGET)$(PRGSUFFIX) + +# ---------------------------------------------------------------------------- +# Install target +# ---------------------------------------------------------------------------- + +<<<<<<< Updated upstream +install-atari: + +# ---------------------------------------------------------------------------- +# Package target +# ---------------------------------------------------------------------------- + +package-atari: +======= +ATARI_INSTALL_TARGET_DIR := nsatari.package +ATARI_RES_DIR := atari/res + +install-atari: $(PKGNAME) + $(VQ)echo Creating $(PKGNAME) + +$(PKGNAME): $(EXETARGET) + $(Q)rm -rf $(ATARI_INSTALL_TARGET_DIR) + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/ + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/doc + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/download + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/fonts + #$(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/icons + $(Q)touch $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/cookies + $(Q)cp $(ATARI_RES_DIR)/netsurf.rsc $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/netsurf.rsc + $(Q)cp $(ATARI_RES_DIR)/icons/ $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/icons/ -R + + + $(Q)cp $(EXETARGET) $(ATARI_INSTALL_TARGET_DIR)/netsurf + +>>>>>>> Stashed changes diff --git a/atari/bitmap.c b/atari/bitmap.c index 1b5611fde..10b5c8cfa 100755 --- a/atari/bitmap.c +++ b/atari/bitmap.c @@ -19,7 +19,6 @@ #include <inttypes.h> #include <sys/types.h> #include <string.h> -#include <windom.h> #include "assert.h" @@ -31,8 +30,11 @@ /* - bpp: bits per pixel, - + * param bpp bits per pixel, + * param w width of the buffer (in pixel) + * param h height of the buffer (in pixel) + * param flags MFDB_FLAG_NOALLOC | MFDB_FLAG_ZEROMEM | MFDB_FLAG_STAND + * returns size of the fd_addr buffer required or allocated */ int init_mfdb(int bpp, int w, int h, uint32_t flags, MFDB * out ) { diff --git a/atari/browser.c b/atari/browser.c deleted file mode 100755 index 034f89a64..000000000 --- a/atari/browser.c +++ /dev/null @@ -1,972 +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/>.
- *
- * Module Description:
- *
- * This WinDom compo
- *
- *
- */
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdbool.h>
-#include <assert.h>
-#include <windom.h>
-
-#include "desktop/gui.h"
-#include "desktop/netsurf.h"
-#include "desktop/browser.h"
-#include "desktop/browser_private.h"
-#include "desktop/mouse.h"
-#include "desktop/textinput.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "css/css.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-
-#include "atari/gui.h"
-#include "atari/browser_win.h"
-#include "atari/misc.h"
-#include "atari/global_evnt.h"
-#include "atari/res/netsurf.rsh"
-#include "atari/redrawslots.h"
-#include "atari/browser.h"
-#include "atari/plot/plot.h"
-#include "atari/plot/plot.h"
-#include "atari/encoding.h"
-#include "atari/ctxmenu.h"
-#include "cflib.h"
-
-extern struct gui_window *input_window;
-
-extern long atari_plot_flags;
-extern int atari_plot_vdi_handle;
-
-static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect );
-static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff,
- struct rect * area );
-static void __CDECL browser_evnt_destroy( COMPONENT * c, long buff[8],
- void * data);
-static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8],
- void * data);
-static void __CDECL browser_evnt_mbutton( COMPONENT * c, long buff[8],
- void * data);
-
-
-/*
- Create an browser component.
- Currently, this area is the area which is used to display HTML content.
- However, it could also contains other areas, these need to be handled within
- "browser_get_rect" function.
-*/
-struct s_browser * browser_create
-(
- struct gui_window * gw,
- struct browser_window *bw,
- struct browser_window * clone,
- int lt, int w, int flex
-)
-{
- CMP_BROWSER bnew = (CMP_BROWSER)malloc( sizeof(struct s_browser) );
- if( bnew )
- {
- memset(bnew, 0, sizeof(struct s_browser) );
- bnew->bw = bw;
- bnew->attached = false;
- if(clone)
- bw->scale = clone->scale;
- else
- bw->scale = 1;
- redraw_slots_init( &bnew->redraw, MAX_REDRW_SLOTS );
- bnew->comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL, 100, 1);
- if( bnew->comp == NULL ) {
- free(bnew);
- return(NULL);
- }
-
- /* Attach events to the component: */
- mt_CompEvntDataAdd( &app, bnew->comp, WM_XBUTTON,
- browser_evnt_mbutton, (void*)gw, EV_BOT
- );
- mt_CompEvntDataAttach( &app, bnew->comp, WM_REDRAW,
- browser_evnt_redraw, (void*)gw
- );
- mt_CompEvntDataAttach( &app, bnew->comp, WM_DESTROY,
- browser_evnt_destroy, (void*)bnew
- );
-
- /* Set the gui_window owner. */
- /* it is an link to the netsurf window system */
- mt_CompDataAttach( &app, bnew->comp, CDT_OWNER, gw );
-
- bnew->scroll.requested.y = 0;
- bnew->scroll.requested.x = 0;
- bnew->scroll.current.x = 0;
- bnew->scroll.current.y = 0;
- bnew->reformat_pending = false;
-
- }
- return( bnew );
-}
-
-bool browser_destroy( struct s_browser * b )
-{
-
- LOG(("%s\n", b->bw->name ));
-
- assert( b != NULL );
- assert( b->comp != NULL );
- assert( b->bw != NULL );
-
- if( b->comp != NULL ){
- mt_CompDelete(&app, b->comp );
- }
- return( true );
-}
-
-/*
- Query the browser component for widget rectangles.
-*/
-void browser_get_rect( struct gui_window * gw, enum browser_rect type, LGRECT * out)
-{
- LGRECT cur;
-
- /* Query component for it's current size: */
- mt_CompGetLGrect(&app, gw->browser->comp, WF_WORKXYWH, &cur);
-
- /* And extract the different widget dimensions: */
- if( type == BR_CONTENT ){
- out->g_w = cur.g_w;
- out->g_h = cur.g_h;
- out->g_x = cur.g_x;
- out->g_y = cur.g_y;
- }
-
- return;
-}
-
-/* Report an resize to the COMPONENT interface */
-void browser_update_rects(struct gui_window * gw )
-{
- short buff[8];
- mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH, (GRECT*)&buff[4]);
- buff[0] = CM_REFLOW;
- buff[1] = _AESapid;
- buff[2] = 0;
- EvntExec(gw->root->handle, buff);
-}
-
-void browser_set_content_size(struct gui_window * gw, int w, int h)
-{
- CMP_BROWSER b = gw->browser;
- LGRECT work;
- browser_get_rect( gw, BR_CONTENT, &work );
-
- gw->root->handle->xpos_max = w;
- gw->root->handle->ypos_max = h;
-
- if( w < work.g_w + b->scroll.current.x || w < work.g_h + b->scroll.current.y ) {
- /* let the scroll routine detect invalid scroll values... */
- browser_scroll(gw, WA_LFLINE, b->scroll.current.x, true );
- browser_scroll(gw, WA_UPLINE, b->scroll.current.y, true );
- /* force update of scrollbars: */
- b->scroll.required = true;
- }
-}
-
-
-static void __CDECL browser_evnt_destroy( COMPONENT * c, long buff[8], void * data)
-{
- struct s_browser * b = (struct s_browser*)data;
- struct gui_window * gw = b->bw->window;
- LOG(("%s\n",gw->browser->bw->name));
-
- assert( b != NULL );
- assert( gw != NULL );
- free( b );
- gw->browser = NULL;
- LOG(("evnt_destroy done!"));
-}
-
-/*
- Mouse Button handler for browser component.
-*/
-
-static void __CDECL browser_evnt_mbutton( COMPONENT * c, long buff[8], void * data)
-{
- short mx, my, dummy, mbut;
- LGRECT cwork;
- browser_mouse_state bmstate = 0;
- struct gui_window * gw = data;
-
- if( input_window != gw ){
- input_window = gw;
- }
-
- window_set_focus( gw, BROWSER, (void*)gw->browser );
- browser_get_rect( gw, BR_CONTENT, &cwork );
-
- /* convert screen coords to component coords: */
- mx = evnt.mx - cwork.g_x;
- my = evnt.my - cwork.g_y;
-
- /* Translate GEM key state to netsurf mouse modifier */
- if( evnt.mkstate & (K_RSHIFT | K_LSHIFT) ){
- bmstate |= BROWSER_MOUSE_MOD_1;
- } else {
- bmstate &= ~(BROWSER_MOUSE_MOD_1);
- }
- if( (evnt.mkstate & K_CTRL) ){
- bmstate |= BROWSER_MOUSE_MOD_2;
- } else {
- bmstate &= ~(BROWSER_MOUSE_MOD_2);
- }
- if( (evnt.mkstate & K_ALT) ){
- bmstate |= BROWSER_MOUSE_MOD_3;
- } else {
- bmstate &= ~(BROWSER_MOUSE_MOD_3);
- }
-
- /* convert component coords to scrolled content coords: */
- int sx_origin = (mx + gw->browser->scroll.current.x);
- int sy_origin = (my + gw->browser->scroll.current.y);
-
- short rel_cur_x, rel_cur_y;
- short prev_x=sx_origin, prev_y=sy_origin;
- bool dragmode = 0;
-
- /* Detect left mouse button state and compare with event state: */
- graf_mkstate(&rel_cur_x, &rel_cur_y, &mbut, &dummy);
- if( (mbut & 1) && (evnt.mbut & 1) ){
- /* Mouse still pressed, report drag */
- rel_cur_x = (rel_cur_x - cwork.g_x) + gw->browser->scroll.current.x;
- rel_cur_y = (rel_cur_y - cwork.g_y) + gw->browser->scroll.current.y;
- browser_window_mouse_click( gw->browser->bw,
- BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_DRAG_1,
- sx_origin, sy_origin);
- do{
- if( abs(prev_x-rel_cur_x) > 5 || abs(prev_y-rel_cur_y) > 5 ){
- browser_window_mouse_track( gw->browser->bw,
- BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_DRAG_1,
- rel_cur_x, rel_cur_y);
- prev_x = rel_cur_x;
- prev_y = rel_cur_y;
- dragmode = true;
- } else {
- if( dragmode == false ){
- browser_window_mouse_track( gw->browser->bw,BROWSER_MOUSE_PRESS_1,
- rel_cur_x, rel_cur_y);
- }
- }
- if( browser_redraw_required( gw ) ){
- browser_redraw( gw );
- }
- graf_mkstate(&rel_cur_x, &rel_cur_y, &mbut, &dummy);
- rel_cur_x = (rel_cur_x - cwork.g_x) + gw->browser->scroll.current.x;
- rel_cur_y = (rel_cur_y - cwork.g_y) + gw->browser->scroll.current.y;
- } while( mbut & 1 );
- browser_window_mouse_track(gw->browser->bw, 0, rel_cur_x,rel_cur_y);
- } else {
- /* Right button pressed? */
- if( (evnt.mbut & 2 ) ) {
- context_popup( gw, evnt.mx, evnt.my );
- } else {
- browser_window_mouse_click(gw->browser->bw,
- bmstate|BROWSER_MOUSE_PRESS_1,
- sx_origin,sy_origin);
- browser_window_mouse_click(gw->browser->bw,
- bmstate|BROWSER_MOUSE_CLICK_1,
- sx_origin,sy_origin);
- }
- }
-
-
-}
-
-
-/*
- Report scroll event to the browser component.
-*/
-void browser_scroll( struct gui_window * gw, short mode, int value, bool abs )
-{
- LGRECT work;
- int max_y_scroll;
- int max_x_scroll;
- int oldx = gw->browser->scroll.current.x;
- int oldy = gw->browser->scroll.current.y;
- struct s_browser * b = gw->browser;
- LOG((""));
-
- if( b->bw->current_content != NULL ) {
- browser_get_rect( gw, BR_CONTENT, &work);
- max_y_scroll = (content_get_height( b->bw->current_content ) - work.g_h );
- max_x_scroll = (content_get_width( b->bw->current_content ) - work.g_w);
- } else {
- return;
- }
-
-
- switch( mode ) {
-
- case WA_UPPAGE:
- case WA_UPLINE:
- if( max_y_scroll < 1 )
- return;
- if( abs == false )
- b->scroll.requested.y -= value;
- else
- b->scroll.requested.y = value - b->scroll.current.y;
- break;
-
- case WA_DNPAGE:
- case WA_DNLINE:
- if( max_y_scroll < 1 )
- return;
- if( abs == false )
- b->scroll.requested.y += value;
- else
- b->scroll.requested.y = value - b->scroll.current.y;
- break;
-
- case WA_LFPAGE:
- case WA_LFLINE:
- if( max_x_scroll < 1 )
- return;
- if( abs == false )
- b->scroll.requested.x -= value;
- else
- b->scroll.requested.x = value - b->scroll.current.x;
- break;
-
- case WA_RTPAGE:
- case WA_RTLINE:
- if( max_x_scroll < 1 )
- return;
- if( abs == false )
- b->scroll.requested.x += value;
- else
- b->scroll.requested.x = value - b->scroll.current.x;
- break;
-
- default: break;
- }
-
- if( b->scroll.current.y + b->scroll.requested.y < 0 ) {
- b->scroll.requested.y = -b->scroll.current.y;
- }
-
- if( b->scroll.current.y + b->scroll.requested.y > max_y_scroll ) {
- b->scroll.requested.y = max_y_scroll - b->scroll.current.y;
- }
-
- if( b->scroll.current.x + b->scroll.requested.x < 0 ) {
- b->scroll.requested.x = -b->scroll.current.x;
- }
-
- if( b->scroll.current.x + b->scroll.requested.x > max_x_scroll ) {
- b->scroll.requested.x = max_x_scroll - b->scroll.current.x;
- }
-
- if( oldy != b->scroll.current.y + b->scroll.requested.y ||
- oldx != b->scroll.current.x + b->scroll.requested.x ) {
- b->scroll.required = true;
- }
-}
-
-/*
- perform the requested scrolling.
- gw -> the browser window to act upon.
- bwrect -> the dimensions of the browser, so that this function
- doesn't need to get it.
-*/
-static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect )
-{
- struct s_browser * b = gw->browser;
- GRECT src;
- GRECT dst;
- short h,w;
-
- if( gw->browser->bw->current_content == NULL )
- return;
-
- h = (short) abs( b->scroll.requested.y );
- w = (short) abs( b->scroll.requested.x );
-
- /* if the request exceeds the browser size, redraw the whole area */
- if ( b->scroll.requested.y > bwrect.g_h || b->scroll.requested.y < -bwrect.g_h ||
- b->scroll.requested.x > bwrect.g_w || b->scroll.requested.x < -bwrect.g_w ) {
- b->scroll.current.y += b->scroll.requested.y;
- b->scroll.current.x += b->scroll.requested.x;
- browser_schedule_redraw( gw, 0, 0, bwrect.g_w, bwrect.g_h);
- /* don't scroll again: */
- b->scroll.requested.y = 0;
- b->scroll.requested.x = 0;
- }
- if( b->scroll.requested.y < 0 ) {
- /* scroll up */
- src.g_x = 0;
- src.g_y = 0;
- src.g_w = bwrect.g_w;
- src.g_h = bwrect.g_h - h;
- dst.g_x = 0;
- dst.g_y = h;
- dst.g_w = src.g_w;
- dst.g_h = src.g_h;
- plot_copy_rect(src, dst);
- b->scroll.current.y += b->scroll.requested.y;
- browser_schedule_redraw( gw, 0, 0, bwrect.g_w, h );
- }
-
- if( b->scroll.requested.y > 0 ) {
- /* scroll down */
- src.g_x = 0;
- src.g_y = h;
- src.g_w = bwrect.g_w;
- src.g_h = bwrect.g_h - h;
- dst.g_x = 0;
- dst.g_y = 0;
- dst.g_w = bwrect.g_w;
- dst.g_h = bwrect.g_h - h;
- plot_copy_rect(src, dst );
- b->scroll.current.y += b->scroll.requested.y;
- browser_schedule_redraw( gw, 0, bwrect.g_h - h, bwrect.g_w, bwrect.g_h );
- }
-
- if( b->scroll.requested.x < 0 ) {
- /* scroll to the left */
- src.g_x = 0;
- src.g_y = 0;
- src.g_w = bwrect.g_w - w;
- src.g_h = bwrect.g_h;
- dst.g_x = w;
- dst.g_y = 0;
- dst.g_w = bwrect.g_w - w;
- dst.g_h = bwrect.g_h;
- plot_copy_rect(src, dst );
- b->scroll.current.x += b->scroll.requested.x;
- browser_schedule_redraw( gw, 0, 0, w, bwrect.g_h );
- }
-
- if( b->scroll.requested.x > 0 ) {
- /* scroll to the right */
- src.g_x = w;
- src.g_y = 0;
- src.g_w = bwrect.g_w - w;
- src.g_h = bwrect.g_h;
- dst.g_x = 0;
- dst.g_y = 0;
- dst.g_w = bwrect.g_w - w;
- dst.g_h = bwrect.g_h;
- plot_copy_rect(src, dst );
- b->scroll.current.x += b->scroll.requested.x;
- browser_schedule_redraw( gw, bwrect.g_w - w, 0, bwrect.g_w, bwrect.g_h );
- }
- b->scroll.requested.y = 0;
- b->scroll.requested.x = 0;
- if( b->caret.requested.g_w > 0 ){
- b->caret.redraw = true;
- }
-
- gw->root->handle->xpos = b->scroll.current.x;
- gw->root->handle->ypos = b->scroll.current.y;
-
- mt_WindSlider( &app, gw->root->handle, HSLIDER|VSLIDER );
-}
-
-/*
- Report keypress to browser component.
- The browser component doesn't listen for keyinput by itself.
- parameter:
- - gui_window ( compocnent owner ).
- - unsigned short nkc ( CFLIB normalised key code )
-*/
-bool browser_input( struct gui_window * gw, unsigned short nkc )
-{
- LGRECT work;
- bool r = false;
- unsigned char ascii = (nkc & 0xFF);
- long ucs4;
- long ik = nkc_to_input_key( nkc, &ucs4 );
-
- // pass event to specific control?
-
- if( ik == 0 ){
- if (ascii >= 9 ) {
- r = browser_window_key_press(gw->browser->bw, ucs4 );
- }
- } else {
- r = browser_window_key_press(gw->browser->bw, ik );
- if( r == false ){
- browser_get_rect(gw, BR_CONTENT, &work);
- switch( ik ){
- case KEY_LINE_START:
- browser_scroll( gw, WA_LFPAGE, work.g_w, false );
- break;
-
- case KEY_LINE_END:
- browser_scroll( gw, WA_RTPAGE, work.g_w, false );
- break;
-
- case KEY_PAGE_UP:
- browser_scroll( gw, WA_UPPAGE, work.g_h, false );
- break;
-
- case KEY_PAGE_DOWN:
- browser_scroll( gw, WA_DNPAGE, work.g_h, false );
- break;
-
- case KEY_RIGHT:
- browser_scroll( gw, WA_RTLINE, 16, false );
- break;
-
- case KEY_LEFT:
- browser_scroll( gw, WA_LFLINE, 16, false );
- break;
-
- case KEY_UP:
- browser_scroll( gw, WA_UPLINE, 16, false);
- break;
-
- case KEY_DOWN:
- browser_scroll( gw, WA_DNLINE, 16, false);
- break;
-
- default:
- break;
- }
- }
- }
-
- return( r );
-}
-
-/* determines if a browser window needs redraw */
-bool browser_redraw_required( struct gui_window * gw)
-{
- bool ret = true;
- CMP_BROWSER b = gw->browser;
-
- if( b->bw->current_content == NULL )
- return ( false );
-
- /* disable redraws when the browser awaits WM_REDRAW caused by resize */
- if( b->reformat_pending )
- return( false );
-
- ret = ( ((b->redraw.areas_used > 0) )
- || b->scroll.required
- || b->caret.redraw);
- return( ret );
-}
-
-
-/* schedule a redraw of content */
-/* coords are relative to the framebuffer */
-void browser_schedule_redraw_rect(struct gui_window * gw, short x, short y, short w, short h)
-{
- if( x < 0 ){
- w += x;
- x = 0;
- }
-
- if( y < 0 ) {
- h += y;
- y = 0;
- }
- browser_schedule_redraw( gw, x, y, x+w, y+h );
-}
-
-
-/*
- schedule a redraw of content, coords are relative to the framebuffer
-*/
-void browser_schedule_redraw(struct gui_window * gw, short x0, short y0, short x1, short y1)
-{
- assert( gw != NULL );
- CMP_BROWSER b = gw->browser;
- LGRECT work;
-
- if( y1 < 0 || x1 < 0 )
- return;
-
- browser_get_rect( gw, BR_CONTENT, &work);
- if( x0 > work.g_w )
- return;
- if( y0 > work.g_h )
- return;
-
- redraw_slot_schedule( &b->redraw, x0, y0, x1, y1 );
-
- return;
-}
-
-static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff,
- struct rect * area )
-{
- CMP_BROWSER b = gw->browser;
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &atari_plotters
- };
-
- LOG(("%s : %d,%d - %d,%d\n", b->bw->name, area->x0,
- area->y0, area->x1, area->y1
- ));
-
-
- browser_window_redraw( b->bw, -b->scroll.current.x,
- -b->scroll.current.y, area, &ctx );
-
-}
-
-/*
- area: the browser canvas
-*/
-void browser_restore_caret_background( struct gui_window * gw, LGRECT * area)
-{
- CMP_BROWSER b = gw->browser;
- LGRECT rect;
- if( area == NULL ){
- browser_get_rect( gw, BR_CONTENT, &rect );
- area = ▭
- }
- /* This call restores the background and releases the memory: */
- // TODO: only release memory/clear flag when the caret is not clipped.
- // TODO: apply clipping.
- w_put_bkgr( &app,
- area->g_x-b->scroll.current.x+b->caret.current.g_x,
- area->g_y-b->scroll.current.y+b->caret.current.g_y,
- gw->browser->caret.current.g_w,
- gw->browser->caret.current.g_h+1,
- &gw->browser->caret.background
- );
- gw->browser->caret.background.fd_addr = NULL;
-}
-
-/*
- area: the browser canvas
-*/
-void browser_redraw_caret( struct gui_window * gw, LGRECT * area )
-{ -
- if( gw->browser->caret.redraw && gw->browser->caret.requested.g_w > 0 ){ - - short wind_info[4]; - - /* Only redraw caret when window is topped. */ - wind_get( 0, WF_TOP, &wind_info[0], &wind_info[1], &wind_info[2], &wind_info[3]); - if (gw->root->handle->handle != wind_info[0]) { - return; - } - -
- LGRECT caret;
- struct s_browser * b = gw->browser;
- struct rect old_clip;
- struct rect clip;
-
- if( b->caret.current.g_w > 0 && b->caret.background.fd_addr != NULL ){
- browser_restore_caret_background( gw, area );
- }
-
- caret = b->caret.requested;
- caret.g_x -= b->scroll.current.x - area->g_x;
- caret.g_y -= b->scroll.current.y - area->g_y;
-
- if( !rc_lintersect( area, &caret ) ) {
- return;
- }
-
- MFDB screen;
- short pxy[8];
-
- /* save background: */
- //assert( b->caret.background.fd_addr == NULL );
- init_mfdb(app.nplanes, caret.g_w, caret.g_h, 0,
- &b->caret.background);
- init_mfdb(0, caret.g_w, caret.g_h, 0, &screen);
- pxy[0] = caret.g_x;
- pxy[1] = caret.g_y;
- pxy[2] = caret.g_x + caret.g_w;
- pxy[3] = caret.g_y + caret.g_h;
- pxy[4] = 0;
- pxy[5] = 0;
- pxy[6] = caret.g_w;
- pxy[7] = caret.g_h;
- /* hide the mouse */
- v_hide_c (app.graf.handle);
- /* copy screen image */
- vro_cpyfm (app.graf.handle, S_ONLY, pxy, &screen, &b->caret.background);
- /* draw caret: */
- caret.g_x -= area->g_x;
- caret.g_y -= area->g_y;
- clip.x0 = caret.g_x;
- clip.y0 = caret.g_y;
- clip.x1 = caret.g_x + caret.g_w;
- clip.y1 = caret.g_y + caret.g_h;
- /* store old clip before adjusting it: */
- plot_get_clip( &old_clip );
- /* clip to cursor: */
- plot_clip( &clip );
- plot_line( caret.g_x, caret.g_y, caret.g_x, caret.g_y + caret.g_h,
- plot_style_caret );
- /* restore old clip area: */
- plot_clip( &old_clip );
- /* restore the mouse */
- v_show_c ( app.graf.handle, 1);
- b->caret.current.g_x = caret.g_x + gw->browser->scroll.current.x;
- b->caret.current.g_y = caret.g_y + gw->browser->scroll.current.y;
- b->caret.current.g_w = caret.g_w;
- b->caret.current.g_h = caret.g_h;
- }
-}
-
-void browser_redraw( struct gui_window * gw )
-{
- LGRECT bwrect;
- struct s_browser * b = gw->browser;
- short todo[4];
- struct rect clip;
- /* used for clipping of content redraw: */
- struct rect redraw_area;
-
- if( b->attached == false || b->bw->current_content == NULL ) {
- return;
- }
-
- browser_get_rect(gw, BR_CONTENT, &bwrect);
-
- plot_set_dimensions(bwrect.g_x, bwrect.g_y, bwrect.g_w, bwrect.g_h);
- clip.x0 = 0;
- clip.y0 = 0;
- clip.x1 = bwrect.g_w;
- clip.y1 = bwrect.g_h;
- plot_clip(&clip);
- if (plot_lock() == false)
- return;
-
- if( b->scroll.required == true && b->bw->current_content != NULL) {
- browser_process_scroll( gw, bwrect );
- b->scroll.required = false;
- }
-
- if ((b->redraw.areas_used > 0) && b->bw->current_content != NULL ) {
- if( (atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0 ) {
-
- int i;
- GRECT area;
- GRECT fbwork;
- short wf_top[4];
- todo[0] = bwrect.g_x;
- todo[1] = bwrect.g_y;
- todo[2] = todo[0] + bwrect.g_w-1;
- todo[3] = todo[1] + bwrect.g_h-1;
- vs_clip(atari_plot_vdi_handle, 1, (short*)&todo[0]);
-
- wind_get( 0, WF_TOP, &wf_top[0], &wf_top[1],
- &wf_top[2], &wf_top[3] );
-
- if( wf_top[0] == gw->root->handle->handle
- && wf_top[1] == _AESapid ){
- /* The window is on top, so there is no need to walk the */
- /* AES rectangle list. */
- for( i=0; i<b->redraw.areas_used; i++ ){
- fbwork.g_x = todo[0] - bwrect.g_x;
- fbwork.g_y = todo[1] - bwrect.g_y;
- if( fbwork.g_x < 0 ){
- fbwork.g_w = todo[2] + todo[0];
- fbwork.g_x = 0;
- } else {
- fbwork.g_w = todo[2];
- }
- if( fbwork.g_y < 0 ){
- fbwork.g_h = todo[3] + todo[1];
- fbwork.g_y = 0;
- } else {
- fbwork.g_h = todo[3];
- }
- area.g_x = b->redraw.areas[i].x0;
- area.g_y = b->redraw.areas[i].y0;
- area.g_w = b->redraw.areas[i].x1 - b->redraw.areas[i].x0;
- area.g_h = b->redraw.areas[i].y1 - b->redraw.areas[i].y0;
- if (rc_intersect((GRECT *)&fbwork,(GRECT *)&area)) {
- redraw_area.x0 = area.g_x;
- redraw_area.y0 = area.g_y;
- redraw_area.x1 = area.g_x + area.g_w;
- redraw_area.y1 = area.g_y + area.g_h;
- browser_redraw_content( gw, 0, 0, &redraw_area );
- } else {
- /* the area should be kept scheduled for later redraw,*/
- /* but because this is onscreen plotter, it doesn't */
- /* make much sense anyway... */
- }
- }
- } else {
- /* walk the AES rectangle list: */
- if( wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
- &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
- while (todo[2] && todo[3]) {
- /* convert screen to framebuffer coords: */
- fbwork.g_x = todo[0] - bwrect.g_x;
- fbwork.g_y = todo[1] - bwrect.g_y;
- if( fbwork.g_x < 0 ){
- fbwork.g_w = todo[2] + todo[0];
- fbwork.g_x = 0;
- } else {
- fbwork.g_w = todo[2];
- }
- if( fbwork.g_y < 0 ){
- fbwork.g_h = todo[3] + todo[1];
- fbwork.g_y = 0;
- } else {
- fbwork.g_h = todo[3];
- }
- /* walk the redraw requests: */
- for( i=0; i<b->redraw.areas_used; i++ ){
- area.g_x = b->redraw.areas[i].x0;
- area.g_y = b->redraw.areas[i].y0;
- area.g_w = b->redraw.areas[i].x1 - b->redraw.areas[i].x0;
- area.g_h = b->redraw.areas[i].y1 - b->redraw.areas[i].y0;
- if (rc_intersect((GRECT *)&fbwork,(GRECT *)&area)) {
- redraw_area.x0 = area.g_x;
- redraw_area.y0 = area.g_y;
- redraw_area.x1 = area.g_x + area.g_w;
- redraw_area.y1 = area.g_y + area.g_h;
- browser_redraw_content( gw, 0, 0, &redraw_area );
- } else {
- /* the area should be kept scheduled for later redraw,*/
- /* but because this is onscreen plotter, it doesn't */
- /* make much sense anyway... */
- }
-
- }
- if (wind_get(gw->root->handle->handle, WF_NEXTXYWH,
- &todo[0], &todo[1], &todo[2], &todo[3])==0) {
- break;
- }
- }
- }
- }
- vs_clip(atari_plot_vdi_handle, 0, (short*)&todo);
- } else {
-
- /* its save to do a complete redraw without knowledge about GEM windows :) */
- /* walk the redraw requests: */
- int i;
- for( i=0; i<b->redraw.areas_used; i++ ){
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &atari_plotters
- };
- browser_window_redraw( b->bw, -b->scroll.current.x,
- -b->scroll.current.y, &b->redraw.areas[i], &ctx );
- }
- GRECT area;
- area.g_x = bwrect.g_x;
- area.g_y = bwrect.g_y;
- area.g_w = bwrect.g_w;
- area.g_h = bwrect.g_h;
- //plot_blit( plotter, &area );
- }
- b->redraw.areas_used = 0;
- }
- if( b->caret.redraw == true && b->bw->current_content != NULL ) {
- LGRECT area;
- todo[0] = bwrect.g_x;
- todo[1] = bwrect.g_y;
- todo[2] = todo[0] + bwrect.g_w;
- todo[3] = todo[1] + bwrect.g_h;
- area.g_x = bwrect.g_x;
- area.g_y = bwrect.g_y;
- area.g_w = bwrect.g_w;
- area.g_h = bwrect.g_h;
- vs_clip(atari_plot_vdi_handle, 1, (short*)&todo[0]);
- browser_redraw_caret( gw, &area );
- vs_clip(atari_plot_vdi_handle, 0, (short*)&todo[0]);
- b->caret.redraw = false;
- }
- plot_unlock();
- /* TODO: if we use offscreen bitmap, trigger content redraw here */
-}
-
-static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8], void * data)
-{
- struct gui_window * gw = (struct gui_window *) data;
- CMP_BROWSER b = gw->browser;
- LGRECT work, lclip;
-
- browser_get_rect( gw, BR_CONTENT, &work );
- lclip = work;
- if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) return;
-
- if( b->bw->current_content == NULL ){
- short pxy[4];
- pxy[0] = lclip.g_x;
- pxy[1] = lclip.g_y;
- pxy[2] = lclip.g_x + lclip.g_w - 1;
- pxy[3] = lclip.g_y + lclip.g_h - 1;
- vsf_color( gw->root->handle->graf->handle, WHITE );
- vsf_perimeter( gw->root->handle->graf->handle, 0);
- vsf_interior( gw->root->handle->graf->handle, FIS_SOLID );
- vsf_style( gw->root->handle->graf->handle, 1);
- v_bar( gw->root->handle->graf->handle, (short*)&pxy );
- return;
- }
-
- /* convert redraw coords to framebuffer coords: */
- lclip.g_x -= work.g_x;
- lclip.g_y -= work.g_y;
-
- if( lclip.g_x < 0 ) {
- lclip.g_w = work.g_w + lclip.g_x;
- lclip.g_x = 0;
- }
-
- if( lclip.g_y < 0 ) {
- lclip.g_h = work.g_h + lclip.g_y;
- lclip.g_y = 0;
- }
-
- if( lclip.g_h > 0 && lclip.g_w > 0 ) {
-
- if( gw->browser->reformat_pending == true ){
- LGRECT newsize;
- gw->browser->reformat_pending = false;
- browser_get_rect(gw, BR_CONTENT, &newsize);
- /* this call will also schedule an redraw for the complete */
- /* area. */
- /* Resize must be handled here, because otherwise */
- /* a redraw is scheduled twice (1. by the frontend, 2. by AES) */
- browser_window_reformat(b->bw, false, newsize.g_w, newsize.g_h );
- } else {
- browser_schedule_redraw( gw, lclip.g_x, lclip.g_y,
- lclip.g_x + lclip.g_w, lclip.g_y + lclip.g_h
- );
- }
- }
-
- return;
-}
diff --git a/atari/browser.h b/atari/browser.h deleted file mode 100755 index 3eb94374f..000000000 --- a/atari/browser.h +++ /dev/null @@ -1,119 +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_ATARI_BROWSER_H
-#define NS_ATARI_BROWSER_H - -#include "atari/redrawslots.h"
-
-/*
- Each browser_window in the Atari Port is represented by an struct s_browser,
- which consist mainly of an WinDom COMPONENT.
-*/
-
-/*
- BROWSER_SCROLL_SVAL
- The small scroll inc. value (used by scroll-wheel, arrow click):
-*/
-#define BROWSER_SCROLL_SVAL 64
-
-
-enum browser_rect
-{
- BR_CONTENT = 1,
- BR_FULL = 2,
- BR_HSLIDER = 3,
- BR_VSLIDER = 4
-};
-
-
-/*
- This struct contains info of current browser viewport scroll
- and the scroll which is requested. If a scroll is requested,
- the field required is set to true.
-*/
-struct s_scroll_info
-{
- POINT requested;
- POINT current;
- bool required;
-};
-
-/*
- This struct holds information of the cursor within the browser
- viewport.
-*/
-struct s_caret
-{
- LGRECT requested;
- LGRECT current;
- bool redraw; - MFDB background;
-};
-
-/*
- This is the browser content area (viewport). - It is redrawable and scrollable. It is based on the WinDOM - Component window (undocumented feature). - - It's an windom component containing it's own Window controls, - like scrollbars, resizer, etc. - - Now that the NetSurf core handles frames, the advantages of this - choice have probably vanished.
-*/
-struct s_browser
-{
- int type;
- COMPONENT * comp;
- struct browser_window * bw;
- struct s_scroll_info scroll;
- struct s_redrw_slots redraw; - struct s_caret caret;
- bool attached; - bool reformat_pending;
-};
-
-struct s_browser * browser_create( struct gui_window * gw, struct browser_window * clone, struct browser_window *bw, int lt, int w, int flex );
-bool browser_destroy( struct s_browser * b );
-void browser_get_rect( struct gui_window * gw, enum browser_rect type, LGRECT * out);
-bool browser_input( struct gui_window * gw, unsigned short nkc ) ;
-void browser_redraw( struct gui_window * gw );
-void browser_set_content_size(struct gui_window * gw, int w, int h);
-void browser_scroll( struct gui_window * gw, short MODE, int value, bool abs );
-struct gui_window * browser_find_root( struct gui_window * gw );
-bool browser_redraw_required( struct gui_window * gw);
-void browser_redraw_caret( struct gui_window * gw, LGRECT * area); -void browser_restore_caret_background(struct gui_window * gw, LGRECT * area);
-/* update loc / size of the browser widgets: */
-void browser_update_rects(struct gui_window * gw ); -/*
- This queues an redraw to one of the slots.
- The following strategy is used:
- 1. It checks if the rectangle to be scheduled is within one of the
- already queued bboxes. If yes, it will return.
- 2. It checks for an intersection, and it will merge the rectangle to
- already queued rectangle where it fits best.
- 3. it tries to put the rectangle into one available slot.
- 4. if no slot is available, it will simply merge the new rectangle with
- the last available slot.
-*/
-void browser_schedule_redraw_rect(struct gui_window * gw, short x, short y, short w, short h);
-void browser_schedule_redraw(struct gui_window * gw, short x, short y, short w, short h );
-
-#endif
diff --git a/atari/browser_win.c b/atari/browser_win.c deleted file mode 100755 index f6daf37c4..000000000 --- a/atari/browser_win.c +++ /dev/null @@ -1,589 +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 <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <windom.h>
-#include <assert.h>
-#include <math.h>
-#include <osbind.h>
-
-#include "utils/log.h"
-#include "desktop/gui.h"
-#include "desktop/history_core.h"
-#include "desktop/netsurf.h"
-#include "desktop/browser.h"
-#include "desktop/browser_private.h"
-#include "desktop/mouse.h"
-#include "desktop/plotters.h"
-#include "desktop/textinput.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "css/css.h"
-#include "atari/gui.h"
-#include "atari/browser_win.h"
-#include "atari/browser.h"
-#include "atari/misc.h"
-#include "atari/plot/plot.h"
-#include "atari/global_evnt.h"
-#include "atari/res/netsurf.rsh"
-#include "atari/browser.h"
-#include "atari/toolbar.h"
-#include "atari/statusbar.h"
-#include "atari/dragdrop.h"
-#include "atari/search.h"
-#include "atari/osspec.h"
-#include "atari/encoding.h"
-#include "atari/toolbar.h"
-
-extern void * h_gem_rsrc;
-extern struct gui_window *input_window;
-
-void __CDECL std_szd( WINDOW * win, short buff[8], void * );
-void __CDECL std_mvd( WINDOW * win, short buff[8], void * );
-
-
-/* -------------------------------------------------------------------------- */
-/* Static module methods follow here: */
-/* -------------------------------------------------------------------------- */
-static void __CDECL evnt_window_icondraw( WINDOW *win, short buff[8], void *data );
-static void __CDECL evnt_window_newtop( WINDOW *win, short buff[8], void *data );
-void __CDECL evnt_window_resize( WINDOW *win, short buff[8], void * data );
-static void __CDECL evnt_window_move( WINDOW *win, short buff[8], void * data );
-static void __CDECL evnt_window_rt_resize( WINDOW *win, short buff[8], void * date );
-static void __CDECL evnt_window_close( WINDOW *win, short buff[8], void *data );
-static void __CDECL evnt_window_dd( WINDOW *win, short wbuff[8], void * data ) ;
-static void __CDECL evnt_window_destroy( WINDOW *win, short buff[8], void *data );
-static void __CDECL evnt_window_slider( WINDOW * win, short buff[8], void * data);
-static void __CDECL evnt_window_arrowed( WINDOW *win, short buff[8], void *data );
-static void __CDECL evnt_window_uniconify( WINDOW *win, short buff[8], void * data );
-static void __CDECL evnt_window_iconify( WINDOW *win, short buff[8], void * data );
-
-/* -------------------------------------------------------------------------- */
-/* Module public functions: */
-/* -------------------------------------------------------------------------- */
-
-
-int window_create( struct gui_window * gw,
- struct browser_window * bw,
- unsigned long inflags )
-{
- int err = 0;
- bool tb, sb;
- int flags;
-
- tb = (inflags & WIDGET_TOOLBAR );
- sb = (inflags & WIDGET_STATUSBAR );
-
- flags = CLOSER | MOVER | NAME | FULLER | SMALLER;
- if( inflags & WIDGET_SCROLL ){
- flags |= (UPARROW | DNARROW | LFARROW | RTARROW | VSLIDE | HSLIDE);
- }
- if( inflags & WIDGET_RESIZE ){
- flags |= ( SIZER );
- } - if( inflags & WIDGET_STATUSBAR ){
- flags |= ( INFO );
- }
-
- gw->root = malloc( sizeof(struct s_gui_win_root) );
- if( gw->root == NULL )
- return( -1 );
- memset( gw->root, 0, sizeof(struct s_gui_win_root) );
- gw->root->title = malloc(atari_sysinfo.aes_max_win_title_len+1);
- gw->root->handle = WindCreate( flags, 40, 40, app.w, app.h );
- if( gw->root->handle == NULL ) {
- free( gw->root->title );
- free( gw->root );
- return( -1 );
- }
-
- /* set scroll / content granularity ( 1 unit ) */
- gw->root->handle->w_u = 1;
- gw->root->handle->h_u = 1;
-
- /* Create Root component: */
- gw->root->cmproot = mt_CompCreate(&app, CLT_VERTICAL, 1, 1);
- WindSetPtr( gw->root->handle, WF_COMPONENT, gw->root->cmproot, NULL);
-
- /* create toolbar component: */
- if( tb ) {
- gw->root->toolbar = tb_create( gw );
- assert( gw->root->toolbar );
- mt_CompAttach( &app, gw->root->cmproot, gw->root->toolbar->comp );
-
- } else {
- gw->root->toolbar = NULL;
- }
-
- /* create browser component: */
- gw->browser = browser_create( gw, bw, NULL, CLT_HORIZONTAL, 1, 1 );
- mt_CompAttach( &app, gw->root->cmproot, gw->browser->comp );
-
- /* create statusbar component: */
- if( sb ) {
- gw->root->statusbar = sb_create( gw ); -#ifdef WITH_COMOPONENT_STATUSBAR
- mt_CompAttach( &app, gw->root->cmproot, gw->root->statusbar->comp ); -#endif
- } else {
- gw->root->statusbar = NULL;
- }
-
- WindSetStr(gw->root->handle, WF_ICONTITLE, (char*)"NetSurf");
-
- /* Event Handlers: */
- EvntDataAttach( gw->root->handle, WM_CLOSED, evnt_window_close, gw );
- /* capture resize/move events so we can handle that manually */
- EvntDataAdd( gw->root->handle, WM_SIZED, evnt_window_rt_resize, gw, EV_BOT );
- EvntDataAdd( gw->root->handle, WM_MOVED, evnt_window_rt_resize, gw, EV_BOT );
- EvntDataAdd( gw->root->handle, WM_FULLED, evnt_window_rt_resize, gw, EV_BOT );
- EvntDataAdd( gw->root->handle, WM_DESTROY,evnt_window_destroy, gw, EV_TOP );
- EvntDataAdd( gw->root->handle, WM_ARROWED,evnt_window_arrowed, gw, EV_TOP );
- EvntDataAdd( gw->root->handle, WM_NEWTOP, evnt_window_newtop, gw, EV_BOT);
- EvntDataAdd( gw->root->handle, WM_TOPPED, evnt_window_newtop, gw, EV_BOT);
- EvntDataAdd( gw->root->handle, WM_ICONIFY, evnt_window_iconify, gw, EV_BOT);
- EvntDataAdd( gw->root->handle, WM_UNICONIFY, evnt_window_uniconify, gw, EV_BOT);
- EvntDataAttach( gw->root->handle, AP_DRAGDROP, evnt_window_dd, gw );
- EvntDataAttach( gw->root->handle, WM_ICONDRAW, evnt_window_icondraw, gw);
- EvntDataAttach( gw->root->handle, WM_SLIDEXY, evnt_window_slider, gw );
-
- if (inflags & WIN_TOP) { - window_set_focus( gw, BROWSER, gw->browser); - }
-
- return (err);
-}
-
-int window_destroy( struct gui_window * gw)
-{
- int err = 0;
-
- search_destroy( gw );
- if( input_window == gw )
- input_window = NULL;
-
- if( gw->root ) {
- if( gw->root->toolbar )
- tb_destroy( gw->root->toolbar );
-
- if( gw->root->statusbar )
- sb_destroy( gw->root->statusbar );
- }
-
- search_destroy( gw );
-
- if( gw->browser )
- browser_destroy( gw->browser );
-
- /* needed? */ /*listRemove( (LINKABLE*)gw->root->cmproot ); */
- if( gw->root ) {
- /* TODO: check if no other browser is bound to this root window! */
- /* only needed for tabs */
- if( gw->root->title )
- free( gw->root->title );
- if( gw->root->cmproot )
- mt_CompDelete( &app, gw->root->cmproot );
- ApplWrite( _AESapid, WM_DESTROY, gw->root->handle->handle, 0, 0, 0, 0);
- EvntWindom( MU_MESAG );
- gw->root->handle = NULL;
- free( gw->root );
- gw->root = NULL;
- }
- return( err );
-}
-
-
-
-void window_open( struct gui_window * gw, GRECT pos )
-{
- LGRECT br;
-
- WindOpen(gw->root->handle, pos.g_x, pos.g_y, pos.g_w, pos.g_h );
- WindClear( gw->root->handle );
- WindSetStr( gw->root->handle, WF_NAME, (char *)"" );
-
- /* apply focus to the root frame: */
- long lfbuff[8] = { CM_GETFOCUS };
- mt_CompEvntExec( gl_appvar, gw->browser->comp, lfbuff );
-
- /* recompute the nested component sizes and positions: */
- browser_update_rects( gw );
- mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH, (GRECT*)&gw->root->loc);
- browser_get_rect( gw, BR_CONTENT, &br );
- plot_set_dimensions(br.g_x, br.g_y, br.g_w, br.g_h);
- gw->browser->attached = true;
- if( gw->root->statusbar != NULL ){
- sb_attach(gw->root->statusbar, gw);
- }
- tb_adjust_size( gw );
- /*TBD: get already present content and set size? */
- input_window = gw;
- window_set_focus( gw, BROWSER, gw->browser );
-}
-
-
-
-/* update back forward buttons (see tb_update_buttons (bug) ) */
-void window_update_back_forward( struct gui_window * gw)
-{
- tb_update_buttons( gw, -1 );
-}
-
-void window_set_stauts(struct gui_window * gw , char * text )
-{
- if( gw->root == NULL )
- return;
-
- CMP_STATUSBAR sb = gw->root->statusbar;
-
- if( sb == NULL || gw->browser->attached == false )
- return;
-
- sb_set_text( sb, text );
-}
-
-/* set focus to an arbitary element */
-void window_set_focus( struct gui_window * gw, enum focus_element_type type, void * element )
-{
- if( gw->root->focus.type != type || gw->root->focus.element != element ) {
- LOG(("Set focus: %p (%d)\n", element, type));
- gw->root->focus.type = type;
- gw->root->focus.element = element;
- if( element != NULL ){
- switch( type ){
-
- case URL_WIDGET:
- textarea_keypress(((struct s_url_widget*)(element))->textarea,
- KEY_SELECT_ALL );
- break;
-
- default: break;
-
- }
- }
- }
-}
-
-/* check if the url widget has focus */
-bool window_url_widget_has_focus( struct gui_window * gw )
-{
- assert( gw );
- assert( gw->root );
- if( gw->root->focus.type == URL_WIDGET && gw->root->focus.element != NULL ) {
- assert( ( &gw->root->toolbar->url == (struct s_url_widget*)gw->root->focus.element ) );
- assert( GUIWIN_VISIBLE(gw) );
- return true;
- }
- return false;
-}
-
-/* check if an arbitary window widget / or frame has the focus */
-bool window_widget_has_focus( struct gui_window * gw, enum focus_element_type t, void * element )
-{
- if( gw == NULL )
- return( false );
- if( element == NULL ){
- assert( 1 != 0 );
- return( (gw->root->focus.type == t ) );
- }
- assert( gw->root != NULL );
- return( ( element == gw->root->focus.element && t == gw->root->focus.type) );
-} - -void window_set_icon(struct gui_window *gw, struct bitmap * bmp ) -{ - gw->icon = bmp; - /* redraw window when it is iconyfied: */ - if (gw->icon != NULL) { - short info, dummy; - WindGet(gw->root->handle, WF_ICONIFY, &info, &dummy, &dummy, &dummy); - if (info == 1) { - window_redraw_favicon(gw, NULL); - } - } -} - - -/** - * Redraw the favicon -*/ -void window_redraw_favicon(struct gui_window *gw, GRECT *clip) -{ - GRECT work; - - assert(gw->root); - - WINDOW * bw = gw->root->handle;
-
- WindClear(bw);
- WindGet(bw, WF_WORKXYWH, &work.g_x, &work.g_y, &work.g_w, &work.g_h); - if (clip == NULL) { - clip = &work; - } - - if (gw->icon == NULL) {
- OBJECT * tree;
- RsrcGaddr( h_gem_rsrc, R_TREE, ICONIFY , &tree);
- tree->ob_x = work.g_x;
- tree->ob_y = work.g_y;
- tree->ob_width = work.g_w;
- tree->ob_height = work.g_h;
- objc_draw(tree, 0, 8, clip->g_x, clip->g_y, clip->g_w, clip->g_h);
- } else { - // TODO: consider the clipping rectangle - struct rect work_clip = { 0,0,work.g_w,work.g_h }; - int xoff=0; - if (work.g_w > work.g_h) { - xoff = ((work.g_w-work.g_h)/2); - work.g_w = work.g_h; - }
- plot_set_dimensions( work.g_x+xoff, work.g_y, work.g_w, work.g_h);
- plot_clip(&work_clip);
- atari_plotters.bitmap(0, 0, work.g_w, work.g_h, gw->icon, 0xffffff, 0);
- } -}
-
-
-/* -------------------------------------------------------------------------- */
-/* Event Handlers: */
-/* -------------------------------------------------------------------------- */
-
-static void __CDECL evnt_window_arrowed( WINDOW *win, short buff[8], void *data )
-{
- bool abs = false;
- LGRECT cwork;
- struct gui_window * gw = data;
- int value = BROWSER_SCROLL_SVAL;
-
- assert( gw != NULL );
-
- browser_get_rect( gw, BR_CONTENT, &cwork );
-
- switch( buff[4] ) {
- case WA_UPPAGE:
- case WA_DNPAGE:
- value = cwork.g_h;
- break;
-
-
- case WA_LFPAGE:
- case WA_RTPAGE:
- value = cwork.g_w;
- break;
-
- default:
- break;
- }
- browser_scroll( gw, buff[4], value, abs );
-}
-
-
-static void __CDECL evnt_window_dd( WINDOW *win, short wbuff[8], void * data )
-{
- struct gui_window * gw = (struct gui_window *)data;
- char file[DD_NAMEMAX];
- char name[DD_NAMEMAX];
- char *buff=NULL;
- int dd_hdl;
- int dd_msg; /* pipe-handle */
- long size;
- char ext[32];
- short mx,my,bmstat,mkstat;
- graf_mkstate(&mx, &my, &bmstat, &mkstat);
-
- if( gw == NULL )
- return;
- if( (win->status & WS_ICONIFY))
- return;
-
- dd_hdl = ddopen( wbuff[7], DD_OK);
- if( dd_hdl<0)
- return; /* pipe not open */
- memset( ext, 0, 32);
- strcpy( ext, "ARGS");
- dd_msg = ddsexts( dd_hdl, ext);
- if( dd_msg<0)
- goto error;
- dd_msg = ddrtry( dd_hdl, (char*)&name[0], (char*)&file[0], (char*)&ext[0], &size);
- if( size+1 >= PATH_MAX )
- goto error;
- if( !strncmp( ext, "ARGS", 4) && dd_msg > 0)
- {
- ddreply(dd_hdl, DD_OK);
- buff = (char*)malloc(sizeof(char)*(size+1));
- if (buff != NULL)
- {
- if (Fread(dd_hdl, size, buff ) == size)
- buff[size] = 0;
- LOG(("file: %s, ext: %s, size: %d dropped at: %d,%d\n",
- (char*)buff, (char*)&ext,
- size, mx, my
- ));
- {
- LGRECT bwrect;
- struct browser_window * bw = gw->browser->bw;
- browser_get_rect( gw, BR_CONTENT, &bwrect );
- mx = mx - bwrect.g_x;
- my = my - bwrect.g_y;
- if( (mx < 0 || mx > bwrect.g_w) || (my < 0 || my > bwrect.g_h) )
- return;
-
- utf8_convert_ret ret;
- char *utf8_fn;
-
- ret = utf8_from_local_encoding(buff, 0, &utf8_fn);
- if (ret != UTF8_CONVERT_OK) { - free(buff);
- /* A bad encoding should never happen */
- LOG(("utf8_from_local_encoding failed"));
- assert(ret != UTF8_CONVERT_BADENC);
- /* no memory */
- return;
- }
- browser_window_drop_file_at_point( gw->browser->bw,
- mx+gw->browser->scroll.current.x,
- my+gw->browser->scroll.current.y,
- utf8_fn );
- free(utf8_fn); - free(buff);
- }
- }
- }
-error:
- ddclose( dd_hdl);
-}
-
-static void __CDECL evnt_window_destroy( WINDOW *win, short buff[8], void *data )
-{
- LOG(("%s\n", __FUNCTION__ ));
-}
-
-static void __CDECL evnt_window_close( WINDOW *win, short buff[8], void *data )
-{
- struct gui_window * gw = (struct gui_window *) data ;
- if( gw != NULL ) {
- browser_window_destroy( gw->browser->bw );
- }
-}
-
-
-static void __CDECL evnt_window_newtop( WINDOW *win, short buff[8], void *data )
-{
- input_window = (struct gui_window *) data;
- window_set_focus( input_window, BROWSER, input_window->browser );
- LOG(("newtop gui window: %p, WINDOW: %p", input_window, win ));
- assert( input_window != NULL );
-}
-
-static void __CDECL evnt_window_slider( WINDOW * win, short buff[8], void * data)
-{
- int dx = buff[4];
- int dy = buff[5];
- struct gui_window * gw = data;
-
- if (!dx && !dy) return;
-
- if( input_window == NULL || input_window != gw ) {
- return;
- }
-
- /* update the sliders _before_ we call redraw
- (which might depend on the slider possitions) */
- WindSlider( win, (dx?HSLIDER:0) | (dy?VSLIDER:0) );
-
- if( dy > 0 )
- browser_scroll( gw, WA_DNPAGE, abs(dy), false );
- else if ( dy < 0)
- browser_scroll( gw, WA_UPPAGE, abs(dy), false );
- if( dx > 0 )
- browser_scroll( gw, WA_RTPAGE, abs(dx), false );
- else if( dx < 0 )
- browser_scroll( gw, WA_LFPAGE, abs(dx), false );
-}
-
-static void __CDECL evnt_window_uniconify( WINDOW *win, short buff[8], void * data )
-{
- struct gui_window * gw = (struct gui_window *)data;
-
- input_window = gw;
- WindTop( gw->root->handle );
- window_set_focus( gw, BROWSER, gw->browser );
-}
-
-static void __CDECL evnt_window_iconify( WINDOW *win, short buff[8], void * data )
-{
- struct gui_window * gw = (struct gui_window *)data;
- if( input_window == gw){
- input_window = NULL;
- }
-}
- -
-static void __CDECL evnt_window_icondraw(WINDOW *win, short buff[8], void * data)
-{ - struct gui_window *gw = (struct gui_window*) data; - GRECT clip = {buff[4], buff[5], buff[6], buff[7]};
- window_redraw_favicon(gw, &clip);
-}
-
-/* perform the actual resize */
-static void __CDECL evnt_window_rt_resize( WINDOW *win, short buff[8], void * data )
-{
- short x,y,w,h;
- struct gui_window * gw;
-
- wind_get( win->handle, WF_CURRXYWH, &x, &y, &w, &h );
- gw = (struct gui_window *)data;
-
- assert( gw != NULL );
-
- if(gw->root->loc.g_w != w || gw->root->loc.g_h != h ){
- /* report resize to component interface: */
- browser_update_rects( gw );
- tb_adjust_size( gw );
- if( gw->browser->bw->current_content != NULL ){
- /* Reformat will happen when next redraw message arrives: */
- gw->browser->reformat_pending = true;
- if( sys_XAAES() ){
- if( gw->root->loc.g_w > w || gw->root->loc.g_h > h ){
- ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
- gw->root->loc.g_x, gw->root->loc.g_y,
- gw->root->loc.g_w, gw->root->loc.g_h );
- }
- }
- mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH,
- (GRECT*)&gw->root->loc);
- }
- else {
- WindClear( gw->root->handle );
- }
- } else {
- if(gw->root->loc.g_x != x || gw->root->loc.g_y != y ){
- mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH, (GRECT*)&gw->root->loc);
- browser_update_rects( gw );
- }
- }
-}
diff --git a/atari/browser_win.h b/atari/browser_win.h deleted file mode 100755 index 28001baad..000000000 --- a/atari/browser_win.h +++ /dev/null @@ -1,70 +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_ATARI_BROWSER_WIN_H
-#define NS_ATARI_BROWSER_WIN_H
-
-#define GUIWIN_VISIBLE(gw) (gw->root->handle->status & WS_OPEN)
-#define GEMWIN_VISIBLE(win) (win->status & WS_OPEN)
-
-#define WIDGET_STATUSBAR 0x1
-#define WIDGET_TOOLBAR 0x2
-#define WIDGET_SCROLL 0x4 -#define WIDGET_RESIZE 0x8 - -#define WIN_TOP 0x100 -
-/* WinDom & Custom bindings for gui window */
-
-/* -------------------------------------------------------------------------- */
-/* Public module functions: */
-/* -------------------------------------------------------------------------- */
-
-/* Creates an normal Browser window with [toolbar], [statusbar] */
-int window_create( struct gui_window * gw, - struct browser_window * bw, unsigned long flags );
-/* Destroys WinDom part of gui_window */
-int window_destroy( struct gui_window * gw );
-
-/* show the window */
-void window_open( struct gui_window * gw, GRECT pos);
-
-void window_snd_redraw(struct gui_window * gw, short x, short y, short w, short h );
-/* Update Shade / Unshade state of the fwd/back buttons*/
-void window_update_back_forward(struct gui_window * gw);
-/* set root browser component: */
-void window_attach_browser( struct gui_window * gw, CMP_BROWSER b);
-
-/* set focus element */
-void window_set_focus( struct gui_window * gw, enum focus_element_type type, void * element );
-/* adjust scroll settings */
-void window_set_scroll_info(struct gui_window *gw, int content_h, int content_w);
-/* Shade / Unshade the forward/back bt. of toolbar, depending on history.*/
-bool window_widget_has_focus( struct gui_window * gw, enum focus_element_type t, void * element);
-bool window_url_widget_has_focus( struct gui_window * gw );
-void window_set_url( struct gui_window * gw, const char * text);
-void window_set_stauts( struct gui_window * gw , char * text );
-void window_set_icon(struct gui_window * gw, struct bitmap * bmp ); -void window_redraw_favicon(struct gui_window *gw, GRECT *clip);
-
-
-/* -------------------------------------------------------------------------- */
-/* Public event handlers: */
-/* -------------------------------------------------------------------------- */
-
-#endif
diff --git a/atari/clipboard.c b/atari/clipboard.c new file mode 100644 index 000000000..bcd4ee6df --- /dev/null +++ b/atari/clipboard.c @@ -0,0 +1,80 @@ +/*
+ * 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/>.
+ *
+ * Module Description:
+ *
+ *
+ *
+ */
+ +#include <stdlib.h> +#include <stdint.h> +#include <string.h> +#include <stdio.h> +#include <mint/osbind.h> +#include <cflib.h> +#include "atari/clipboard.h" + + +static int filesize(char * path) +{ + FILE *f; + int fs; + + f = fopen( path, "r+b"); + if(!f) + return(-1); + + fseek(f, 0L, SEEK_END); + fs = ftell(f); + fclose(f); + + return(fs); +} + +int scrap_txt_write(char *str) +{ + scrap_wtxt(str); +} +
+char *scrap_txt_read(void) +{ + char * buf = NULL; + char path[80]; + int file; + int len; + + if (get_scrapdir (path)) + { + strcat (path, "scrap.txt"); + len = filesize(path); + if(len > 0){ + if ((file = (int) Fopen (path, 0)) >= 0) + { + buf = malloc(len); + if(buf){ + len = Fread (file, len, buf); + Fclose (file); + buf[len] = '\0'; + return buf; + } + } + } + } + +} + diff --git a/atari/clipboard.h b/atari/clipboard.h index e505d9f6d..f35161e13 100755 --- a/atari/clipboard.h +++ b/atari/clipboard.h @@ -17,9 +17,9 @@ */
#ifndef NS_ATARI_CLIPBOARD_H
-#define NS_ATARI_CLIPBOARD_H
+#define NS_ATARI_CLIPBOARD_H -int scrap_txt_write( APPvar app, char *str);
-char *scrap_txt_read( APPvar app );
+int scrap_txt_write(char *str);
+char *scrap_txt_read(void);
-#endif
\ No newline at end of file +#endif diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c index 84f5d870d..d89060a65 100644 --- a/atari/ctxmenu.c +++ b/atari/ctxmenu.c @@ -22,8 +22,7 @@ #include <unistd.h>
#include <string.h>
#include <stdbool.h>
-#include <assert.h>
-#include <windom.h> +#include <assert.h> #include <mint/osbind.h>
#include "desktop/gui.h"
@@ -40,8 +39,7 @@ #include "utils/messages.h"
#include "atari/gui.h"
-#include "atari/browser.h"
-#include "atari/browser_win.h"
+#include "atari/rootwin.h"
#include "atari/misc.h"
#include "atari/clipboard.h"
#include "desktop/options.h"
@@ -50,7 +48,6 @@ #define CNT_INVALID 0
-#define CNT_URLINPUT 32
#define CNT_BROWSER 64
#define CNT_HREF 128
#define CNT_SELECTION 256
@@ -68,48 +65,52 @@ struct s_context_info ctxinfo; static struct s_context_info * get_context_info( struct gui_window * gw, short mx, short my )
{
hlcache_handle *h;
- LGRECT bwrect;
+ GRECT area;
struct contextual_content ccdata;
- struct browser_window * bw = gw->browser->bw;
+ struct browser_window * bw = gw->browser->bw; + int sx, sy;
h = bw->current_content;
- ctxinfo.flags = 0;
-
- browser_get_rect( gw, BR_CONTENT, &bwrect );
- mx -= bwrect.g_x;
- my -= bwrect.g_y;
- if( (mx < 0 || mx > bwrect.g_w) || (my < 0 || my > bwrect.g_h) ){
- // TODO: check for urlinput location
- // and set CNT_URLINPUT
- return(&ctxinfo);
- }
+ ctxinfo.flags = 0; + + window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area); + if (POINT_WITHIN(mx, my, area)) { + + mx -= area.g_x;
+ my -= area.g_y; + + if (!bw->current_content || content_get_type(h) != CONTENT_HTML){
+ return(&ctxinfo);
+ }
- if (!bw->current_content || content_get_type(h) != CONTENT_HTML){
- return(&ctxinfo);
- }
+ ctxinfo.flags |= CNT_BROWSER;
+ + memset( &ctxinfo.ccdata, sizeof(struct contextual_content), 0 ); + + gui_window_get_scroll(gw, &sx, &sy); - ctxinfo.flags |= CNT_BROWSER;
- memset( &ctxinfo.ccdata, sizeof(struct contextual_content), 0 );
- browser_window_get_contextual_content(
- gw->browser->bw,
- mx+gw->browser->scroll.current.x,
- my+gw->browser->scroll.current.y,
- (struct contextual_content*)&ctxinfo.ccdata
- );
- if( ctxinfo.ccdata.link_url ){
- ctxinfo.flags |= CNT_HREF;
- }
- if( ctxinfo.ccdata.object) {
- if( content_get_type(ctxinfo.ccdata.object) == CONTENT_IMAGE ){
- ctxinfo.flags |= CNT_IMG;
+ browser_window_get_contextual_content( gw->browser->bw, mx+sx, my+sy,
+ (struct contextual_content*)&ctxinfo.ccdata); +
+ if( ctxinfo.ccdata.link_url ){
+ ctxinfo.flags |= CNT_HREF;
}
- }
- if ( ctxinfo.ccdata.form_features == CTX_FORM_TEXT )
- ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION);
- return( &ctxinfo );
-}
+ if( ctxinfo.ccdata.object) {
+ if( content_get_type(ctxinfo.ccdata.object) == CONTENT_IMAGE ){
+ ctxinfo.flags |= CNT_IMG;
+ }
+ }
+ if ( ctxinfo.ccdata.form_features == CTX_FORM_TEXT )
+ ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION); + } + + return(&ctxinfo); -void context_popup( struct gui_window * gw, short x, short y )
+
+}
+ +//TODO: do not open popup for gui_window, but for a rootwin?
+void context_popup(struct gui_window * gw, short x, short y)
{
#define POP_FIRST_ITEM POP_CTX_CUT_SEL
@@ -124,9 +125,10 @@ void context_popup( struct gui_window * gw, short x, short y ) char * tempfile;
int err = 0;
char * editor, *lastslash;
- char cmdline[PATH_MAX];
+ char cmdline[PATH_MAX]; + MENU pop_menu, me_data;
- pop = get_tree( POP_CTX );
+ pop = gemtk_obj_get_tree( POP_CTX );
if (pop == NULL)
return;
ctx = get_context_info(gw, x, y);
@@ -135,44 +137,48 @@ void context_popup( struct gui_window * gw, short x, short y ) Disable all items by default:
*/
for( choice = POP_FIRST_ITEM; choice<=POP_LAST_ITEM; choice++ ){
- SET_BIT(pop[ choice ].ob_state, DISABLED, 1);
+ SET_BIT(pop[ choice ].ob_state, OS_DISABLED, 1);
}
if( ctx->flags & CNT_INTERACTIVE ){
- SET_BIT(pop[ POP_CTX_PASTE_SEL ].ob_state, DISABLED, 0);
+ SET_BIT(pop[ POP_CTX_PASTE_SEL ].ob_state, OS_DISABLED, 0);
}
if( (ctx->flags & CNT_BROWSER) ){
- SET_BIT(pop[ POP_CTX_SELECT_ALL ].ob_state, DISABLED, 0);
- SET_BIT(pop[ POP_CTX_COPY_SEL ].ob_state, DISABLED, 0);
- SET_BIT(pop[ POP_CTX_VIEW_SOURCE ].ob_state, DISABLED, 0);
- }
+ SET_BIT(pop[ POP_CTX_SELECT_ALL ].ob_state, OS_DISABLED, 0);
+ SET_BIT(pop[ POP_CTX_COPY_SEL ].ob_state, OS_DISABLED, 0);
+ SET_BIT(pop[ POP_CTX_VIEW_SOURCE ].ob_state, OS_DISABLED, 0);
+ } if( ctx->flags & CNT_HREF ){
- SET_BIT(pop[ POP_CTX_COPY_LINK ].ob_state, DISABLED, 0);
- SET_BIT(pop[ POP_CTX_OPEN_NEW ].ob_state, DISABLED, 0);
- SET_BIT(pop[ POP_CTX_SAVE_LINK_AS ].ob_state, DISABLED, 0);
+ SET_BIT(pop[ POP_CTX_COPY_LINK ].ob_state, OS_DISABLED, 0);
+ SET_BIT(pop[ POP_CTX_OPEN_NEW ].ob_state, OS_DISABLED, 0);
+ SET_BIT(pop[ POP_CTX_SAVE_LINK_AS ].ob_state, OS_DISABLED, 0);
}
if( ctx->flags & CNT_IMG ){
- SET_BIT(pop[ POP_CTX_SAVE_AS ].ob_state, DISABLED, 0);
- SET_BIT(pop[ POP_CTX_COPY_URL ].ob_state, DISABLED, 0);
- SET_BIT(pop[ POP_CTX_OPEN_NEW ].ob_state, DISABLED, 0);
- }
-
- choice = MenuPopUp(
- pop, x, y,
- -1, -1, -1,
- P_WNDW + P_CHCK
- );
-
+ SET_BIT(pop[ POP_CTX_SAVE_AS ].ob_state, OS_DISABLED, 0);
+ SET_BIT(pop[ POP_CTX_COPY_URL ].ob_state, OS_DISABLED, 0);
+ SET_BIT(pop[ POP_CTX_OPEN_NEW ].ob_state, OS_DISABLED, 0);
+ } + + // point mn_tree tree to states popup: + pop_menu.mn_tree = gemtk_obj_get_tree(POP_CTX); + pop_menu.mn_menu = 0; + pop_menu.mn_item = POP_CTX_CUT_SEL; + pop_menu.mn_scroll = SCROLL_NO; + pop_menu.mn_keystate = 0;
+ + menu_popup(&pop_menu, x, y, &me_data); + choice = me_data.mn_item;
+ switch( choice ){
case POP_CTX_COPY_SEL:
- browser_window_key_press( gw->browser->bw, KEY_COPY_SELECTION );
+ browser_window_key_press(gw->browser->bw, KEY_COPY_SELECTION);
break;
case POP_CTX_CUT_SEL:
- browser_window_key_press( gw->browser->bw, KEY_CUT_SELECTION );
+ browser_window_key_press(gw->browser->bw, KEY_CUT_SELECTION);
break;
case POP_CTX_PASTE_SEL: @@ -180,11 +186,11 @@ void context_popup( struct gui_window * gw, short x, short y ) break;
case POP_CTX_SELECT_ALL:
- browser_window_key_press( gw->browser->bw, KEY_SELECT_ALL );
+ browser_window_key_press(gw->browser->bw, KEY_SELECT_ALL);
break;
case POP_CTX_SAVE_AS:
- if( ctx->ccdata.object != NULL ) {
+ if (ctx->ccdata.object != NULL) {
if( hlcache_handle_get_url(ctx->ccdata.object) != NULL ) {
browser_window_download(
gw->browser->bw,
@@ -195,7 +201,7 @@ void context_popup( struct gui_window * gw, short x, short y ) }
case POP_CTX_SAVE_LINK_AS:
- if( ctx->ccdata.link_url != NULL ) {
+ if (ctx->ccdata.link_url != NULL) {
browser_window_download(
gw->browser->bw,
ctx->ccdata.link_url,
@@ -206,21 +212,22 @@ void context_popup( struct gui_window * gw, short x, short y ) break;
case POP_CTX_COPY_URL:
- if( (ctx->flags & CNT_IMG) && (ctx->ccdata.object != NULL) ){
+ if ((ctx->flags & CNT_IMG) && (ctx->ccdata.object != NULL)) {
if( hlcache_handle_get_url(ctx->ccdata.object) != NULL ){
- scrap_txt_write(&app, (char*)nsurl_access(hlcache_handle_get_url(ctx->ccdata.object)) );
+ scrap_txt_write((char*)nsurl_access( + hlcache_handle_get_url(ctx->ccdata.object)));
}
}
break;
case POP_CTX_COPY_LINK:
- if( (ctx->flags & CNT_HREF) && ctx->ccdata.link_url != NULL ){
- scrap_txt_write(&app, (char*)ctx->ccdata.link_url);
+ if ((ctx->flags & CNT_HREF) && ctx->ccdata.link_url != NULL) {
+ scrap_txt_write((char*)ctx->ccdata.link_url);
}
break;
case POP_CTX_OPEN_NEW:
- if( (ctx->flags & CNT_HREF) && ctx->ccdata.link_url) {
+ if ((ctx->flags & CNT_HREF) && ctx->ccdata.link_url) {
browser_window_create(
ctx->ccdata.link_url,
gw->browser->bw,
@@ -241,6 +248,7 @@ void context_popup( struct gui_window * gw, short x, short y ) if (fp_tmpfile != NULL){
fwrite(data, size, 1, fp_tmpfile);
fclose(fp_tmpfile ); + /* lastslash = strrchr(editor, '/'); if (lastslash == NULL) lastslash = strrchr(editor, '\\'); @@ -248,16 +256,25 @@ void context_popup( struct gui_window * gw, short x, short y ) lastslash = editor; else lastslash++; - if(is_process_running(lastslash)){ - err = ShelWrite( editor, tempfile , editor, 1, 0); + */ + + if(strlen(tempfile)<=125){ + shel_write(1,1,0,editor,tempfile); + } + + /*if(is_process_running(lastslash)){ + if(strlen(tempfile)<=125){ + shel_write(1,1,0,editor,tempfile); + } } else { - /* check for max length of simple commandline param: */ + // check for max length of simple commandline param: if(strlen(tempfile)<=125){ sprintf(cmdline, "%c%s", (char)strlen(tempfile), tempfile); Pexec(100, editor, cmdline, NULL); } - }
+ } + */
} else {
printf("Could not open temp file: %s!\n", tempfile );
}
diff --git a/atari/deskmenu.c b/atari/deskmenu.c new file mode 100644 index 000000000..df31ba012 --- /dev/null +++ b/atari/deskmenu.c @@ -0,0 +1,664 @@ +#include <stdlib.h> + +#include "utils/log.h" +#include "utils/messages.h"
+#include "utils/url.h" +#include "desktop/browser.h" +#include "desktop/browser_private.h" +#include "desktop/options.h" +#include "desktop/save_complete.h"
+#include "atari/res/netsurf.rsh" +#include "atari/gemtk/gemtk.h" +#include "atari/deskmenu.h" +#include "atari/hotlist.h" +#include "atari/history.h" +#include "atari/toolbar.h" +#include "atari/settings.h" +#include "atari/search.h" +#include "atari/misc.h" +#include "atari/gui.h" +#include "atari/findfile.h" + +#include "atari/rootwin.h" + +typedef void __CDECL (*menu_evnt_func)(short item, short title, void * data); + +struct s_accelerator
+{
+ char ascii; /* either ascii or */
+ long keycode; /* normalised keycode is valid */
+ short mod; /* shift / ctrl etc */
+};
+ +struct s_menu_item_evnt {
+ short title; /* to which menu this item belongs */
+ short rid; /* resource ID */
+ menu_evnt_func menu_func; /* click handler */
+ struct s_accelerator accel; /* accelerator info */
+ char * menustr;
+}; + +static void register_menu_str(struct s_menu_item_evnt * mi); +//static void __CDECL evnt_menu(WINDOW * win, short buff[8]); + +extern void *h_gem_rsrc; +extern bool html_redraw_debug; +extern struct gui_window * input_window; +extern char options[PATH_MAX]; +extern const char * option_homepage_url; +extern int option_window_width;
+extern int option_window_height; +extern int option_window_x; +extern int option_window_y; + +static OBJECT * h_gem_menu; + +
+/* Zero based resource tree ids: */
+#define T_ABOUT 0
+#define T_FILE MAINMENU_T_FILE - MAINMENU_T_FILE + 1
+#define T_EDIT MAINMENU_T_EDIT - MAINMENU_T_FILE + 1
+#define T_VIEW MAINMENU_T_VIEW - MAINMENU_T_FILE + 1
+#define T_NAV MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1
+#define T_UTIL MAINMENU_T_UTIL - MAINMENU_T_FILE + 1
+#define T_HELP MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1
+/* Count of the above defines: */
+#define NUM_MENU_TITLES 7 + + +static void __CDECL menu_about(short item, short title, void *data); +static void __CDECL menu_new_win(short item, short title, void *data); +static void __CDECL menu_open_url(short item, short title, void *data); +static void __CDECL menu_open_file(short item, short title, void *data); +static void __CDECL menu_close_win(short item, short title, void *data); +static void __CDECL menu_save_page(short item, short title, void *data); +static void __CDECL menu_quit(short item, short title, void *data); +static void __CDECL menu_cut(short item, short title, void *data); +static void __CDECL menu_copy(short item, short title, void *data); +static void __CDECL menu_paste(short item, short title, void *data); +static void __CDECL menu_find(short item, short title, void *data); +static void __CDECL menu_choices(short item, short title, void *data); +static void __CDECL menu_stop(short item, short title, void *data); +static void __CDECL menu_reload(short item, short title, void *data); +static void __CDECL menu_toolbars(short item, short title, void *data); +static void __CDECL menu_savewin(short item, short title, void *data); +static void __CDECL menu_debug_render(short item, short title, void *data); +static void __CDECL menu_fg_images(short item, short title, void *data); +static void __CDECL menu_bg_images(short item, short title, void *data); +static void __CDECL menu_back(short item, short title, void *data); +static void __CDECL menu_forward(short item, short title, void *data); +static void __CDECL menu_home(short item, short title, void *data); +static void __CDECL menu_lhistory(short item, short title, void *data); +static void __CDECL menu_ghistory(short item, short title, void *data); +static void __CDECL menu_add_bookmark(short item, short title, void *data); +static void __CDECL menu_bookmarks(short item, short title, void *data); +static void __CDECL menu_vlog(short item, short title, void *data); +static void __CDECL menu_help_content(short item, short title, void *data); + +struct s_menu_item_evnt menu_evnt_tbl[] =
+{
+ {T_ABOUT,MAINMENU_M_ABOUT, menu_about, {0,0,0}, NULL },
+ {T_FILE, MAINMENU_M_NEWWIN, menu_new_win, {0,0,0}, NULL},
+ {T_FILE, MAINMENU_M_OPENURL, menu_open_url, {'G',0,K_CTRL}, NULL},
+ {T_FILE, MAINMENU_M_OPENFILE, menu_open_file, {'O',0,K_CTRL}, NULL},
+ {T_FILE, MAINMENU_M_CLOSEWIN, menu_close_win, {0,0,0}, NULL},
+ {T_FILE, MAINMENU_M_SAVEPAGE, menu_save_page, {0,NK_F3,0}, NULL},
+ {T_FILE, MAINMENU_M_QUIT, menu_quit, {'Q',0,K_CTRL}, NULL},
+ {T_EDIT, MAINMENU_M_CUT, menu_cut, {'X',0,K_CTRL}, NULL},
+ {T_EDIT, MAINMENU_M_COPY, menu_copy, {'C',0,K_CTRL}, NULL},
+ {T_EDIT, MAINMENU_M_PASTE, menu_paste, {'V',0,K_CTRL}, NULL},
+ {T_EDIT, MAINMENU_M_FIND, menu_find, {0,NK_F4,0}, NULL},
+ {T_VIEW, MAINMENU_M_RELOAD, menu_reload, {0,NK_F5,0}, NULL},
+ {T_VIEW, MAINMENU_M_TOOLBARS, menu_toolbars, {0,NK_F1,K_CTRL}, NULL},
+ {T_VIEW, MAINMENU_M_SAVEWIN, menu_savewin, {0,0,0}, NULL},
+ {T_VIEW, MAINMENU_M_DEBUG_RENDER, menu_debug_render, {0,0,0}, NULL}, + {T_VIEW, MAINMENU_M_FG_IMAGES, menu_fg_images, {0,0,0}, NULL}, + {T_VIEW, MAINMENU_M_BG_IMAGES, menu_bg_images, {0,0,0}, NULL},
+ {T_VIEW, MAINMENU_M_STOP, menu_stop, {0,NK_ESC,K_ALT}, NULL},
+ {T_NAV, MAINMENU_M_BACK, menu_back, {0,NK_LEFT,K_ALT}, NULL},
+ {T_NAV, MAINMENU_M_FORWARD, menu_forward, {0,NK_RIGHT,K_ALT}, NULL},
+ {T_NAV, MAINMENU_M_HOME, menu_home, {0,NK_CLRHOME,0}, NULL},
+ {T_UTIL, MAINMENU_M_LHISTORY,menu_lhistory, {0,NK_F7,0}, NULL},
+ {T_UTIL, MAINMENU_M_GHISTORY, menu_ghistory, {0,NK_F7,K_CTRL}, NULL},
+ {T_UTIL, MAINMENU_M_ADD_BOOKMARK, menu_add_bookmark, {'D',0,K_CTRL}, NULL},
+ {T_UTIL, MAINMENU_M_BOOKMARKS, menu_bookmarks, {0,NK_F6,0}, NULL},
+ {T_UTIL, MAINMENU_M_CHOICES, menu_choices, {0,0,0}, NULL},
+ {T_UTIL, MAINMENU_M_VLOG, menu_vlog, {'V',0,K_ALT}, NULL},
+ {T_HELP, MAINMENU_M_HELP_CONTENT, menu_help_content, {0,NK_F1,0}, NULL},
+ {-1, -1, NULL,{0,0,0}, NULL }
+}; + + +/* +static void __CDECL evnt_menu(WINDOW * win, short buff[8])
+{
+ int title = buff[3];
+ INT16 x,y;
+ char *str;
+ struct gui_window * gw = window_list;
+ int i=0; + + deskmenu_dispatch_item(buff[3], buff[4]); +} +*/ + +/* + Menu item event handlers: +*/ +
+static void __CDECL menu_about(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ char buf[PATH_MAX];
+ strcpy((char*)&buf, "file://");
+ strncat((char*)&buf, (char*)"./doc/README.TXT", + PATH_MAX - (strlen("file://")+1) );
+ browser_window_create((char*)&buf, 0, 0, true, false);
+}
+
+static void __CDECL menu_new_win(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ browser_window_create(option_homepage_url, 0, 0, true, false);
+}
+
+static void __CDECL menu_open_url(short item, short title, void *data)
+{
+ struct gui_window * gw;
+ struct browser_window * bw ;
+ LOG(("%s", __FUNCTION__)); +
+ gw = input_window;
+ if( gw == NULL ) {
+ bw = browser_window_create("", 0, 0, true, false);
+ gw = bw->window; + } + /* Loose focus: */ + window_set_focus(gw->root, WIDGET_NONE, NULL ); + + /* trigger on-focus event (select all text): */ + window_set_focus(gw->root, URL_WIDGET, NULL); + + /* delete selection: */ + toolbar_key_input(gw->root->toolbar, NK_DEL);
+}
+
+static void __CDECL menu_open_file(short item, short title, void *data)
+{ + struct gui_window * gw;
+ struct browser_window * bw ;
+
+ LOG(("%s", __FUNCTION__)); + + const char * filename = file_select(messages_get("OpenFile"), ""); + if( filename != NULL ){ + char * url = local_file_to_url( filename ); + if( url ){ + bw = browser_window_create(url, NULL, NULL, true, false); + free( url ); + } + } +}
+
+static void __CDECL menu_close_win(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ if( input_window == NULL )
+ return;
+ gui_window_destroy( input_window );
+}
+
+static void __CDECL menu_save_page(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__)); + static bool init = true; + bool is_folder=false; + const char * path; + + if( !input_window ) + return; + + if( init ){ + init = false; + save_complete_init(); + } + + do { + // TODO: localize string + path = file_select("Select folder", ""); + if (path) + is_folder = is_dir(path); + } while( !is_folder && path != NULL ); + + if( path != NULL ){ + save_complete( input_window->browser->bw->current_content, path, NULL ); + } +
+}
+
+static void __CDECL menu_quit(short item, short title, void *data)
+{
+ short buff[8];
+ memset( &buff, 0, sizeof(short)*8 );
+ LOG(("%s", __FUNCTION__));
+ netsurf_quit = true;
+}
+
+static void __CDECL menu_cut(short item, short title, void *data)
+{
+ if( input_window != NULL )
+ browser_window_key_press( input_window->browser->bw, KEY_CUT_SELECTION);
+}
+
+static void __CDECL menu_copy(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ if( input_window != NULL )
+ browser_window_key_press( input_window->browser->bw, KEY_COPY_SELECTION);
+}
+
+static void __CDECL menu_paste(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ if( input_window != NULL )
+ browser_window_key_press( input_window->browser->bw, KEY_PASTE);
+}
+
+static void __CDECL menu_find(short item, short title, void *data)
+{ + static bool visible = false;
+ LOG(("%s", __FUNCTION__));
+ if (input_window != NULL) { + if (input_window->search) { + window_close_search(input_window->root); + } + else { + window_open_search(input_window->root, true); + } + }
+}
+
+static void __CDECL menu_choices(short item, short title, void *data)
+{ + LOG(("%s", __FUNCTION__)); + open_settings();
+}
+
+static void __CDECL menu_stop(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ if( input_window == NULL )
+ return; + + assert(input_window && input_window->root);
+ toolbar_stop_click(input_window->root->toolbar);
+
+}
+
+static void __CDECL menu_reload(short item, short title, void *data)
+{
+ if(input_window == NULL)
+ return;
+ toolbar_reload_click(input_window->root->toolbar);
+ LOG(("%s", __FUNCTION__));
+}
+
+static void __CDECL menu_toolbars(short item, short title, void *data)
+{ + static int state = 0;
+ LOG(("%s", __FUNCTION__)); + if( input_window != null && input_window->root->toolbar != null ){ + state = !state; + // TODO: implement toolbar hide + //toolbar_hide(input_window->root->toolbar, state ); + }
+}
+
+static void __CDECL menu_savewin(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__)); + if (input_window && input_window->browser) { + GRECT rect; + wind_get_grect(gemtk_wm_get_handle(input_window->root->win), WF_CURRXYWH, + &rect);
+ option_window_width = rect.g_w; + option_window_height = rect.g_h; + option_window_x = rect.g_x; + option_window_y = rect.g_y; + nsoption_set_int(window_width, rect.g_w); + nsoption_set_int(window_height, rect.g_h); + nsoption_set_int(window_x, rect.g_x); + nsoption_set_int(window_y, rect.g_y); + nsoption_write((const char*)&options); + } +
+}
+
+static void __CDECL menu_debug_render(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ html_redraw_debug = !html_redraw_debug;
+ if( input_window != NULL ) {
+ if ( input_window->browser != NULL + && input_window->browser->bw != NULL) {
+ GRECT rect; + window_get_grect(input_window->root, BROWSER_AREA_CONTENT, &rect);
+ browser_window_reformat(input_window->browser->bw, false, + rect.g_w, rect.g_h ); + menu_icheck(h_gem_menu, MAINMENU_M_DEBUG_RENDER, + (html_redraw_debug) ? 1 : 0);
+ }
+ }
+} + +static void __CDECL menu_fg_images(short item, short title, void *data)
+{
+ nsoption_set_bool(foreground_images, !nsoption_bool(foreground_images)); + menu_icheck(h_gem_menu, MAINMENU_M_FG_IMAGES, + (nsoption_bool(foreground_images)) ? 1 : 0);
+} + +static void __CDECL menu_bg_images(short item, short title, void *data)
+{
+ nsoption_set_bool(background_images, !nsoption_bool(background_images)); + menu_icheck(h_gem_menu, MAINMENU_M_BG_IMAGES, + (nsoption_bool(background_images)) ? 1 : 0);
+} + +static void __CDECL menu_back(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ if( input_window == NULL )
+ return;
+ toolbar_back_click(input_window->root->toolbar);
+}
+
+static void __CDECL menu_forward(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ if( input_window == NULL )
+ return;
+ toolbar_forward_click(input_window->root->toolbar);
+}
+
+static void __CDECL menu_home(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ if( input_window == NULL )
+ return;
+ toolbar_home_click(input_window->root->toolbar);
+}
+
+static void __CDECL menu_lhistory(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ if( input_window == NULL )
+ return;
+}
+
+static void __CDECL menu_ghistory(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ global_history_open();
+}
+
+static void __CDECL menu_add_bookmark(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ if (input_window) {
+ if( input_window->browser->bw->current_content != NULL ){
+ atari_hotlist_add_page(
+ nsurl_access(hlcache_handle_get_url(input_window->browser->bw->current_content)),
+ NULL
+ );
+ }
+ }
+}
+
+static void __CDECL menu_bookmarks(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ hotlist_open();
+}
+
+static void __CDECL menu_vlog(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+ verbose_log = !verbose_log; + menu_icheck(h_gem_menu, MAINMENU_M_VLOG, (verbose_log) ? 1 : 0);
+}
+
+static void __CDECL menu_help_content(short item, short title, void *data)
+{
+ LOG(("%s", __FUNCTION__));
+} + +/* + Public deskmenu interface: +*/ + + +/* + Parse encoded menu key shortcut + + The format is: + + "[" - marks start of the shortcut + "@,^,<" - If the keyshortcut is only valid + with modifier keys, one of these characters must directly + follow the start mark. + Meaning: + @ -> Alternate + ^ -> Control + "#" - keycode or ascii character. + The value is handled as keycode if the character value + is <= 28 ( Atari chracter table ) + or if it is interpreted as function key string. + (strings: F1 - F10) + +*/ +static void register_menu_str( struct s_menu_item_evnt * mi ) +{ + assert(h_gem_menu != NULL); + + struct s_accelerator * accel = &mi->accel; + int i, l=0, x=-1; + char str[255]; + + get_string(h_gem_menu, mi->rid, str); + + i = l = strlen(str); + while (i > 2) { + if( str[i] == '['){ + x = i; + break; + } + i--; + } + if( x > -1 ){ + mi->menustr = malloc( l+1 ); + strcpy(mi->menustr, str ); + mi->menustr[x]=' '; + x++; + if( str[x] == '@' ){ + accel->mod = K_ALT; + mi->menustr[x] = 0x07; + x++; + } + else if( str[x] == '^' ) { + accel->mod = K_CTRL; + x++; + } + if( str[x] <= 28 ){ + // parse symbol + unsigned short keycode=0; + switch( str[x] ){ + case 0x03: + accel->keycode = NK_RIGHT; + break; + case 0x04: + accel->keycode = NK_LEFT; + break; + case 0x1B: + accel->keycode = NK_ESC; + break; + default: + break; + } + } else { + if(str[x] == 'F' && ( str[x+1] >= '1' && str[x+1] <= '9') ){ + // parse function key + short fkey = atoi( &str[x+1] ); + if( (fkey >= 0) && (fkey <= 10) ){ + accel->keycode = NK_F1 - 1 + fkey; + } + } else { + accel->ascii = str[x]; + } + } + } +} + +/** +* Setup & display an desktop menu. +*/ + +void deskmenu_init(void) +{ + int i; + + h_gem_menu = gemtk_obj_get_tree(MAINMENU); + + + /* Install menu: */ + menu_bar(h_gem_menu, MENU_INSTALL); + + /* parse and update menu items: */
+ i = 0;
+ while( menu_evnt_tbl[i].rid != -1 ) { + register_menu_str( &menu_evnt_tbl[i] ); + /* Update menu string if not null: */ + if( menu_evnt_tbl[i].menustr != NULL ){ + menu_text(h_gem_menu, menu_evnt_tbl[i].rid, + menu_evnt_tbl[i].menustr); + }
+ i++;
+ } + deskmenu_update(); + /* Redraw menu: */ + menu_bar(h_gem_menu, MENU_UPDATE); +} + +/** +* Uninstall the desktop menu +*/ +void deskmenu_destroy(void) +{ + int i; + + /* Remove menu from desktop: */ + menu_bar(h_gem_menu, MENU_REMOVE);
+ + /* Free modified menu titles: */ + i=0;
+ while(menu_evnt_tbl[i].rid != -1) {
+ if( menu_evnt_tbl[i].menustr != NULL )
+ free(menu_evnt_tbl[i].menustr);
+ i++;
+ } +} + +/** +* Return the deskmenu AES OBJECT tree +*/ +OBJECT * deskmenu_get_obj_tree(void) +{ + return(h_gem_menu); +} + +/** +* Handle an menu item event +*/ +int deskmenu_dispatch_item(short title, short item) +{ + int i=0; + int retval = 0; + OBJECT * menu_root = deskmenu_get_obj_tree(); + + menu_tnormal(menu_root, item, 1); + menu_tnormal(menu_root, title, 1); + menu_bar(menu_root, 1); + + // legacy code, is this sensible?: + /* + while( gw ) {
+ window_set_focus( gw, WIDGET_NONE, NULL );
+ gw = gw->next;
+ } + */ + + + while (menu_evnt_tbl[i].rid != -1) {
+ if (menu_evnt_tbl[i].rid == item) { + if (menu_evnt_tbl[i].menu_func != NULL) {
+ menu_evnt_tbl[i].menu_func(item, title, NULL); + }
+ break;
+ }
+ i++;
+ } + + return(retval); +} + +/** +* Handle an keypress (check for accelerator) +*/ +int deskmenu_dispatch_keypress(unsigned short kcode, unsigned short kstate, + unsigned short nkc) +{ + char sascii; + bool done = 0; + int i = 0; + + sascii = gemtk_keybd2ascii(kcode, K_LSHIFT); + + /* Iterate through the menu function table: */
+ while( menu_evnt_tbl[i].rid != -1 && done == false) {
+ if( kstate == menu_evnt_tbl[i].accel.mod + && menu_evnt_tbl[i].accel.ascii != 0) {
+ if( menu_evnt_tbl[i].accel.ascii == sascii) { + deskmenu_dispatch_item(menu_evnt_tbl[i].title, + menu_evnt_tbl[i].rid);
+ done = true;
+ break;
+ }
+ } else {
+ /* the accel code hides in the keycode: */
+ if( menu_evnt_tbl[i].accel.keycode != 0) {
+ if( menu_evnt_tbl[i].accel.keycode == (nkc & 0xFF) &&
+ kstate == menu_evnt_tbl[i].accel.mod) {
+ deskmenu_dispatch_item(menu_evnt_tbl[i].title, + menu_evnt_tbl[i].rid);
+ done = true;
+ break;
+ }
+ }
+ }
+ i++;
+ } + return((done==true) ? 1 : 0); +} + +/** +* Refresh the desk menu, reflecting netsurf current state. +*/ +void deskmenu_update(void) +{ + menu_icheck(h_gem_menu, MAINMENU_M_DEBUG_RENDER, (html_redraw_debug) ? 1 : 0); + menu_icheck(h_gem_menu, MAINMENU_M_FG_IMAGES, + (nsoption_bool(foreground_images)) ? 1 : 0); + menu_icheck(h_gem_menu, MAINMENU_M_BG_IMAGES, + (nsoption_bool(background_images)) ? 1 : 0); +} + diff --git a/atari/deskmenu.h b/atari/deskmenu.h new file mode 100644 index 000000000..6ab00dcc9 --- /dev/null +++ b/atari/deskmenu.h @@ -0,0 +1,12 @@ +#ifndef DESKMENU_H_INCLUDED
+#define DESKMENU_H_INCLUDED + +void deskmenu_init(void); +void deskmenu_destroy(void); +int deskmenu_dispatch_item(short title, short item);
+int deskmenu_dispatch_keypress(unsigned short kcode, unsigned short kstate, + unsigned short nkc); +OBJECT * deskmenu_get_obj_tree(void); +void deskmenu_update( void ); +
+#endif // DESKMENU_H_INCLUDED
diff --git a/atari/download.c b/atari/download.c index e852a03b8..936b8a551 100755 --- a/atari/download.c +++ b/atari/download.c @@ -23,8 +23,7 @@ #include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <stdbool.h>
-#include <windom.h>
+#include <stdbool.h> #include "content/urldb.h"
#include "content/fetch.h"
@@ -47,77 +46,182 @@ #include "atari/download.h"
#include "atari/osspec.h"
-extern struct gui_window * input_window;
-
-static void gui_download_window_destroy( struct gui_download_window * gdw );
+extern struct gui_window * input_window; +extern GRECT desk_area; + +static void gui_download_window_destroy( struct gui_download_window * gdw ); +static void on_abort_click(struct gui_download_window *dw); +static void on_cbrdy_click(struct gui_download_window *dw); +static void on_close(struct gui_download_window * dw); +static void on_redraw(struct gui_download_window *dw, GRECT *clip); +static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip); + +static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip) +{ + struct gui_download_window *data; + + if (msg != WM_REDRAW) { + data = gemtk_wm_get_user_data(win); + + assert(data); + + on_redraw(data, clip); + } +} + +static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) +{ + short retval = 0; + struct gui_download_window *data; + + GRECT clip; + + data = gemtk_wm_get_user_data(win); + + if ((ev_out->emo_events & MU_MESAG) != 0) { + // handle message + //printf("download win msg: %d\n", msg[0]); + switch (msg[0]) { + + case WM_REDRAW: + clip.g_x = msg[4]; + clip.g_y = msg[5]; + clip.g_w = msg[6]; + clip.g_h = msg[7]; + on_redraw(data, &clip); + break; + + case WM_CLOSED: + // TODO: this needs to iterate through all gui windows and + // check if the rootwin is this window... + on_close(data); + break; + + case WM_TOOLBAR: + switch(msg[4]){ + + case DOWNLOAD_BT_ABORT: + on_abort_click(data); + break; + + case DOWNLOAD_CB_CLOSE_RDY: + on_cbrdy_click(data); + break; + + default: break; + } + break; + + default: + break; + } + } + if ((ev_out->emo_events & MU_KEYBD) != 0) { + + + } + if ((ev_out->emo_events & MU_BUTTON) != 0) { + + } + + return(retval); +}
+ +static void on_redraw(struct gui_download_window *dw, GRECT *clip) +{ + OBJECT *tree = dw->tree; + GRECT work, visible; + uint32_t p = 0; + + gemtk_wm_get_grect(dw->guiwin, GEMTK_WM_AREA_TOOLBAR, &work); + tree->ob_x = work.g_x; + tree->ob_y = work.g_y; + + if(!rc_intersect(clip, &work)){ + return; + } + + /* + Update the AES Object to reflect current state of download: + */ + ((TEDINFO *)get_obspec(tree, DOWNLOAD_FILENAME))->te_ptext = dw->lbl_file; + ((TEDINFO *)get_obspec(tree, DOWNLOAD_LBL_BYTES))->te_ptext = dw->lbl_done; + ((TEDINFO *)get_obspec(tree, DOWNLOAD_LBL_PERCENT))->te_ptext = dw->lbl_percent; + ((TEDINFO *)get_obspec(tree, DOWNLOAD_LBL_SPEED))->te_ptext = dw->lbl_speed; + + if (dw->size_total > 0 ) {
+ p = ((double)dw->size_downloaded / (double)dw->size_total * 100);
+ } + tree[DOWNLOAD_PROGRESS_DONE].ob_width = MAX( MIN( p*(DOWNLOAD_BAR_MAX/100), + DOWNLOAD_BAR_MAX ), 1); + if (dw->close_on_finish) { + tree[DOWNLOAD_CB_CLOSE_RDY].ob_state |= (OS_SELECTED | OS_CROSSED); + } else { + tree[DOWNLOAD_CB_CLOSE_RDY].ob_state &= ~(OS_SELECTED | OS_CROSSED); + } + tree[DOWNLOAD_BT_ABORT].ob_state &= ~OS_SELECTED; + + /*Walk the AES rectangle list and redraw the visible areas of the window: */ + wind_get_grect(dw->aes_handle, WF_FIRSTXYWH, &visible); + while (visible.g_x && visible.g_y) { + if (rc_intersect(&work, &visible)) { + objc_draw_grect(tree, 0, 8, &visible); + } + wind_get_grect(dw->aes_handle, WF_NEXTXYWH, &visible); + } +} -static void __CDECL evnt_bt_abort_click
-(
- WINDOW *win,
- int index,
- int unused,
- void * data
-)
+static void on_abort_click(struct gui_download_window *dw)
{
- struct gui_download_window * dw = (struct gui_download_window *)data;
- assert( dw != NULL );
- ObjcChange( OC_FORM, win, index, ~SELECTED, TRUE); if( dw->status == NSATARI_DOWNLOAD_COMPLETE || dw->status == NSATARI_DOWNLOAD_ERROR ) { - ApplWrite( _AESapid, WM_CLOSED, win->handle, 0,0,0,0); + gemtk_wm_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0); }
else if( dw->status != NSATARI_DOWNLOAD_CANCELED ){
dw->abort = true;
}
}
-static void __CDECL evnt_cbrdy_click
-(
- WINDOW *win,
- int index,
- int unused,
- void * data
-)
-{
- struct gui_download_window * dw = (struct gui_download_window *)data;
- assert( dw != NULL ); - if( dw->status == NSATARI_DOWNLOAD_COMPLETE ){ - ApplWrite( _AESapid, WM_CLOSED, win->handle, 0,0,0,0); - }
+static void on_cbrdy_click(struct gui_download_window *dw)
+{ + dw->close_on_finish = !dw->close_on_finish;
+ if (dw->close_on_finish && dw->status == NSATARI_DOWNLOAD_COMPLETE) { + gemtk_wm_send_msg(dw->guiwin, WM_CLOSED, 0,0,0,0); + } + gemtk_wm_send_redraw(dw->guiwin, NULL); + evnt_timer(250);
}
-static void __CDECL evnt_close( WINDOW *win, short buff[8], void * data)
+static void on_close(struct gui_download_window * dw)
{
- struct gui_download_window * dw = (struct gui_download_window *)data;
- assert( dw != NULL );
- gui_download_window_destroy( dw );
- ApplWrite( _AESapid, WM_DESTROY, win->handle, 0,0,0,0);
+ gui_download_window_destroy(dw);
}
-static void gui_download_window_destroy( struct gui_download_window * gdw )
+static void gui_download_window_destroy( struct gui_download_window * gdw)
{
-
- if( gdw->status == NSATARI_DOWNLOAD_WORKING ){
- download_context_abort( gdw->ctx );
- }
- download_context_destroy( gdw->ctx );
- if( gdw->form != NULL ){
- /* first destroy the form, so that it won't acces the gdw members */
- ApplWrite( _AESapid, WM_DESTROY, gdw->form->handle, 0,0,0,0);
- EvntWindom( MU_MESAG );
+ + + LOG((""));
+ if (gdw->status == NSATARI_DOWNLOAD_WORKING) {
+ download_context_abort(gdw->ctx);
}
- if( gdw->destination ) {
+ + download_context_destroy(gdw->ctx);
+ + if (gdw->destination) {
free( gdw->destination );
}
- if( gdw->fd != NULL ){
+ if (gdw->fd != NULL) {
fclose(gdw->fd);
gdw->fd = NULL;
}
- if( gdw->fbuf != NULL ){
+ if (gdw->fbuf != NULL) {
free( gdw->fbuf );
}
-
- free( gdw );
+ gemtk_wm_remove(gdw->guiwin); + wind_close(gdw->aes_handle); + wind_delete(gdw->aes_handle);
+ free(gdw);
} static char * select_filepath( const char * path, const char * filename ) @@ -127,40 +231,48 @@ static char * select_filepath( const char * path, const char * filename ) char res_file[PATH_MAX]; char * ret = NULL; - - strncpy( res_path, path, PATH_MAX ); - strncpy( res_file, filename, PATH_MAX ); + strncpy(res_path, path, PATH_MAX); + strncpy(res_file, filename, PATH_MAX); res_file[PATH_MAX-1] = 0; res_path[PATH_MAX-1] = 0; - if( mt_FselInput( &app, res_path, res_file, (char*)"*", - (char*)messages_get("SaveAsNS"), res_path, NULL ) ) { - assert( (strlen( res_path ) + strlen( res_file ) + 2) < PATH_MAX ); - snprintf(tmp, PATH_MAX, "%s%s", res_path, res_file ); - ret = malloc( strlen(tmp)+1 ); - strcpy( ret, tmp ); + + if(select_file(res_path, res_file, (char*)"*", + (char*)messages_get("SaveAsNS"), NULL)) { + snprintf(tmp, PATH_MAX, "%s%s", res_path, res_file); + ret = malloc(strlen(tmp)+1); + strcpy(ret, tmp); } - return( ret ); + + printf("download file: %s\n", ret); + return(ret); }
-
-struct gui_download_window *gui_download_window_create(download_context *ctx,
- struct gui_window *parent)
-{
-
- char *filename;
+ +struct gui_download_window * gui_download_window_create(download_context *ctx,
+ struct gui_window *parent) +{ + const char *filename;
char *destination;
char gdos_path[PATH_MAX];
const char * url;
struct gui_download_window * gdw; int dlgres = 0; - OBJECT * tree = get_tree(DOWNLOAD); + OBJECT * tree = gemtk_obj_get_tree(DOWNLOAD); + char alert[200]; + + + LOG(("Creating download window for gui window: %p", parent)); /* TODO: Implement real form and use messages file strings! */
- if( tree == NULL )
- return( NULL );
- - filename = download_context_get_filename( ctx ); - dlgres = form_alert(2, "[2][Accept download?][Yes|Save as...|No]");
+ if (tree == NULL){ + die("Couldn't find AES Object tree for download window!"); + return(NULL); + } +
+ filename = download_context_get_filename((const download_context*)ctx); + snprintf(alert, 200, "[2][Accept download?|%.*s][Yes|Save as...|No]", + 40,filename); + dlgres = form_alert(2, alert);
if( dlgres == 3){
return( NULL );
} @@ -175,11 +287,12 @@ struct gui_download_window *gui_download_window_create(download_context *ctx, gemdos_realpath(nsoption_charp(downloads_path), gdos_path); dstsize = strlen(gdos_path) + strlen(filename) + 2; destination = malloc( dstsize ); - snprintf( destination, dstsize, "%s/%s", gdos_path, filename ); + snprintf(destination, dstsize, "%s/%s", gdos_path, filename); } - gdw = calloc( 1, sizeof(struct gui_download_window) );
+ gdw = calloc(1, sizeof(struct gui_download_window));
if( gdw == NULL ){ + warn_user(NULL, "Out of memory!"); free( destination );
return( NULL ); } @@ -193,12 +306,15 @@ struct gui_download_window *gui_download_window_create(download_context *ctx, gdw->fbufsize = MAX(BUFSIZ, 48000);
gdw->size_downloaded = 0;
gdw->size_total = download_context_get_total_length(ctx); - gdw->destination = destination;
+ gdw->destination = destination; + gdw->tree = tree;
url = download_context_get_url(ctx);
- gdw->fd = fopen(gdw->destination, "wb" );
- if( gdw->fd == NULL ){
- free( filename );
+ gdw->fd = fopen(gdw->destination, "wb");
+ if( gdw->fd == NULL ){ + char spare[200]; + snprintf(spare, 200, "Couldn't open %s for writing!", gdw->destination); + gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, spare);
gui_download_window_destroy(gdw);
return( NULL );
} @@ -206,70 +322,79 @@ struct gui_download_window *gui_download_window_create(download_context *ctx, gdw->fbuf = malloc( gdw->fbufsize+1 );
if( gdw->fbuf != NULL ){
setvbuf( gdw->fd, gdw->fbuf, _IOFBF, gdw->fbufsize );
- }
- gdw->form = mt_FormCreate( &app, tree, WAT_FORM,
- NULL, (char*)"Download",
- NULL, true, true );
- if( gdw->form == NULL || gdw->fd == NULL ){
- free( filename );
+ } + + gdw->aes_handle = wind_create_grect(CLOSER | NAME | MOVER, &desk_area); + wind_set_str(gdw->aes_handle, WF_NAME, "Download"); + unsigned long gwflags = GEMTK_WM_FLAG_DEFAULTS; + gdw->guiwin = gemtk_wm_add(gdw->aes_handle, gwflags, on_aes_event); + if( gdw->guiwin == NULL || gdw->fd == NULL ){ + die("could not create guiwin");
gui_download_window_destroy(gdw);
return( NULL );
- }
+ } + gemtk_wm_set_user_data(gdw->guiwin, gdw); + gemtk_wm_set_toolbar(gdw->guiwin, tree, 0, 0); + gemtk_wm_set_toolbar_redraw_func(gdw->guiwin, toolbar_redraw_cb);
- tree = ObjcTree(OC_FORM, gdw->form );
- ObjcAttachFormFunc( gdw->form, DOWNLOAD_BT_ABORT,
- evnt_bt_abort_click, gdw
- );
- ObjcAttachFormFunc( gdw->form, DOWNLOAD_CB_CLOSE_RDY,
- evnt_cbrdy_click, gdw
- );
- EvntDataAdd( gdw->form, WM_CLOSED, evnt_close, gdw, EV_TOP);
strncpy((char*)&gdw->lbl_file, filename, MAX_SLEN_LBL_FILE-1);
- ObjcString( tree, DOWNLOAD_FILENAME, (char*)&gdw->lbl_file );
- ObjcString( tree, DOWNLOAD_LBL_BYTES, (char*)&gdw->lbl_done );
- ObjcString( tree, DOWNLOAD_LBL_PERCENT, (char*)&gdw->lbl_percent );
- ObjcString( tree, DOWNLOAD_LBL_SPEED, (char*)&gdw->lbl_speed );
-
- free( filename );
LOG(("created download: %s (total size: %d)",
gdw->destination, gdw->size_total
- ));
+ )); + + GRECT work, curr; + work.g_x = 0; + work.g_y = 0; + work.g_w = tree->ob_width; + work.g_h = tree->ob_height; + + wind_calc_grect(WC_BORDER, CLOSER | MOVER | NAME, &work, &curr); + + curr.g_x = (desk_area.g_w / 2) - (curr.g_w / 2); + curr.g_y = (desk_area.g_h / 2) - (curr.g_h / 2); + + wind_open_grect(gdw->aes_handle, &curr); + gdw->lastrdw = clock() / (CLOCKS_PER_SEC >> 3); + + return(gdw); +} - return gdw;
-}
nserror gui_download_window_data(struct gui_download_window *dw,
const char *data, unsigned int size)
{
+ + uint32_t clck = clock();
+ uint32_t tnow = clck / (CLOCKS_PER_SEC>>3);
+ uint32_t sdiff = (clck / (CLOCKS_PER_SEC)) - dw->start; uint32_t p = 0;
- uint32_t tnow = clock() / CLOCKS_PER_SEC;
- uint32_t sdiff = tnow - dw->start;
float speed;
- float pf = 0;
- OBJECT * tree;
-
- if( dw->abort == true ){
+ float pf = 0; + + LOG(("")); + + OBJECT * tree = dw->tree; + + if(dw->abort == true){ dw->status = NSATARI_DOWNLOAD_CANCELED;
dw->abort = false;
- download_context_abort( dw->ctx );
- ObjcChange( OC_FORM, dw->form, DOWNLOAD_BT_ABORT, DISABLED, TRUE);
- return( NSERROR_OK );
+ download_context_abort(dw->ctx); + gemtk_wm_send_redraw(dw->guiwin, NULL);
+ return(NSERROR_OK);
}
/* save data */
fwrite( data , size, sizeof(unsigned char),dw->fd );
- dw->size_downloaded += size;
-
- /* Update the progress bar... */
- if( tnow - dw->lastrdw > 1 ) {
+ dw->size_downloaded += size; + + /* Update GUI */
+ if ((tnow - dw->lastrdw) > 1) { + dw->lastrdw = tnow;
- tree = ObjcTree(OC_FORM, dw->form );
- if( dw->size_total > 0 ){
- p = ((double)dw->size_downloaded / (double)dw->size_total * 100);
- }
speed = dw->size_downloaded / sdiff;
- tree[DOWNLOAD_PROGRESS_DONE].ob_width = MAX( MIN( p*(DOWNLOAD_BAR_MAX/100), DOWNLOAD_BAR_MAX ), 1);
- if( dw->size_total > 0 ){
+
+ if( dw->size_total > 0 ){ + p = ((double)dw->size_downloaded / (double)dw->size_total * 100);
snprintf( (char*)&dw->lbl_percent, MAX_SLEN_LBL_PERCENT,
"%lu%s", p, "%"
);
@@ -284,11 +409,9 @@ nserror gui_download_window_data(struct gui_download_window *dw, snprintf( (char*)&dw->lbl_done, MAX_SLEN_LBL_DONE, "%s / %s",
human_friendly_bytesize(dw->size_downloaded),
(dw->size_total>0) ? human_friendly_bytesize(dw->size_total) : "?"
- );
- ObjcString( tree, DOWNLOAD_LBL_BYTES, (char*)&dw->lbl_done );
- ObjcString( tree, DOWNLOAD_LBL_PERCENT, (char*)&dw->lbl_percent );
- ObjcString( tree, DOWNLOAD_LBL_SPEED, (char*)&dw->lbl_speed );
- snd_rdw( dw->form );
+ ); + + gemtk_wm_send_redraw(dw->guiwin, NULL);
}
return NSERROR_OK;
}
@@ -299,15 +422,17 @@ void gui_download_window_error(struct gui_download_window *dw, LOG(("%s", error_msg));
strncpy((char*)&dw->lbl_file, error_msg, MAX_SLEN_LBL_FILE-1);
dw->status = NSATARI_DOWNLOAD_ERROR;
- snd_rdw( dw->form ); - gui_window_set_status(input_window, messages_get("Done") );
+ gemtk_wm_send_redraw(dw->guiwin, NULL); + gui_window_set_status(input_window, messages_get("Done") ); + // TODO: change abort to close
}
void gui_download_window_done(struct gui_download_window *dw)
{ OBJECT * tree;
LOG(("")); -
+ +// TODO: change abort to close
dw->status = NSATARI_DOWNLOAD_COMPLETE; if( dw->fd != NULL ) {
@@ -315,24 +440,18 @@ void gui_download_window_done(struct gui_download_window *dw) dw->fd = NULL;
}
- - tree = ObjcTree(OC_FORM, dw->form ); -
- if( (tree[DOWNLOAD_CB_CLOSE_RDY].ob_state & SELECTED) != 0 ) {
- ApplWrite( _AESapid, WM_CLOSED, dw->form->handle, 0,0,0,0);
- } else {
- tree[DOWNLOAD_PROGRESS_DONE].ob_width = DOWNLOAD_BAR_MAX;
+ tree = dw->tree; + if (dw->close_on_finish) { + gemtk_wm_send_msg(dw->guiwin, WM_CLOSED, 0, 0, 0, 0);
+ } else { snprintf( (char*)&dw->lbl_percent, MAX_SLEN_LBL_PERCENT,
"%lu%s", 100, "%"
);
snprintf( (char*)&dw->lbl_done, MAX_SLEN_LBL_DONE, "%s / %s",
human_friendly_bytesize(dw->size_downloaded),
(dw->size_total>0) ? human_friendly_bytesize(dw->size_total) : human_friendly_bytesize(dw->size_downloaded)
- ); - ObjcString( tree, DOWNLOAD_LBL_BYTES, (char*)&dw->lbl_done );
- ObjcString( tree, DOWNLOAD_LBL_PERCENT, (char*)&dw->lbl_percent ); - ObjcString( tree, DOWNLOAD_BT_ABORT, (char*)"Close" );
- snd_rdw( dw->form ); + );
+ gemtk_wm_send_redraw(dw->guiwin, NULL); } gui_window_set_status(input_window, messages_get("Done") );
}
diff --git a/atari/download.h b/atari/download.h index ee5783e71..e25893d4a 100755 --- a/atari/download.h +++ b/atari/download.h @@ -38,7 +38,9 @@ typedef enum { struct gui_download_window {
struct download_context *ctx;
struct gui_window * parent;
- WINDOW * form;
+ GUIWIN *guiwin; + short aes_handle; + OBJECT *tree;
nsatari_download_status status;
char *destination;
FILE * fd;
@@ -52,7 +54,8 @@ struct gui_download_window { uint32_t size_downloaded;
char * fbuf;
size_t fbufsize;
- bool abort;
+ bool abort; + bool close_on_finish;
};
#endif
diff --git a/atari/dragdrop.h b/atari/dragdrop.h deleted file mode 100755 index dccd3e371..000000000 --- a/atari/dragdrop.h +++ /dev/null @@ -1,19 +0,0 @@ -/*
-* MultiTOS Drag&Drop Header file
-*/
-
-/*
-* Declarations
-*/
-
-short ddcreate(short *pipe);
-short ddmessage(short apid, short fd, short winid, short mx, short my, short kstate, short pipename);
-short ddrexts(short fd, char *exts);
-short ddstry(short fd, char *ext, char *text, char *name, long size);
-void ddclose(short fd);
-void ddgetsig(long *oldsig);
-void ddsetsig(long oldsig);
-short ddopen(short ddnam, char ddmsg);
-short ddsexts(short fd, char *exts);
-short ddrtry(short fd, char *name, char *file, char *whichext, long *size);
-short ddreply(short fd, char ack);
diff --git a/atari/encoding.c b/atari/encoding.c index 2cd26709a..75d0fec90 100644 --- a/atari/encoding.c +++ b/atari/encoding.c @@ -67,3 +67,5 @@ int atari_to_ucs4(unsigned char atari) ucs4 = (int)atari;
return( ucs4 );
} + + diff --git a/atari/encoding.h b/atari/encoding.h index 7b9cc8291..c85bac9fc 100644 --- a/atari/encoding.h +++ b/atari/encoding.h @@ -22,7 +22,6 @@ #include <inttypes.h>
#include <assert.h>
#include <stdbool.h> -#include <windom.h> #include "css/css.h"
#include "render/font.h" diff --git a/atari/extract.php b/atari/extract.php new file mode 100755 index 000000000..865b70ed7 --- /dev/null +++ b/atari/extract.php @@ -0,0 +1,10 @@ +#!/usr/bin/php +<? +$lines = file("deskmenu.c"); + +foreach($lines as $line){ + if(stripos($line, "static void __CDECL menu_") === 0){ + echo $line; + } +} +?> diff --git a/atari/findfile.c b/atari/findfile.c index 93bf4638e..d4c4c308d 100755 --- a/atari/findfile.c +++ b/atari/findfile.c @@ -24,10 +24,10 @@ #include <string.h> #include <assert.h> #include <curl/curl.h> -#include <windom.h> #include "utils/log.h" #include "utils/url.h" +#include "atari/gemtk/gemtk.h" #include "atari/findfile.h" #include "atari/gui.h" #include "atari/misc.h" diff --git a/atari/font.c b/atari/font.c index afb12092a..dfa0efee5 100755 --- a/atari/font.c +++ b/atari/font.c @@ -37,7 +37,6 @@ */ #include <stdbool.h>
-#include <windom.h>
#include "css/css.h"
#include "render/font.h"
diff --git a/atari/gemtk/aestabs.c b/atari/gemtk/aestabs.c new file mode 100644 index 000000000..414d5c290 --- /dev/null +++ b/atari/gemtk/aestabs.c @@ -0,0 +1,173 @@ +#include <stdlib.h> +#include <assert.h> +#include <gem.h> +#include <cflib.h> +#include "aestabs.h" + +#ifndef NDEBUG +# define DEBUG_PRINT(x) printf x +#else +# define DEBUG_PRINT(x) +#endif + + +AES_TABLIST * tablist_declare(OBJECT *tree, aes_tablist_user_func user_func) +{ + AES_TABLIST * newlist = malloc(sizeof(AES_TABLIST)); + + newlist->first = NULL; + newlist->tree = tree; + newlist->user_func = user_func; + DEBUG_PRINT(("aes_tablist_declare: %p\n", newlist)); + return(newlist); +} + + +AES_TAB * tablist_add(AES_TABLIST * tablist, short obj_tab, OBJECT * page_tree, + short obj_page) +{ + AES_TAB * newtab = malloc(sizeof(AES_TAB)); + + assert(newtab); + assert(tablist); + + newtab->next = NULL; + newtab->prev = NULL; + newtab->obj_tab = obj_tab; + newtab->obj_page = obj_page; + newtab->page_tree = page_tree; + + if(newtab->page_tree == NULL){ + newtab->page_tree = tablist->tree; + } + + if (tablist->first == NULL) { + tablist->first = newtab; + set_state(tablist->tree, newtab->obj_tab, OS_SELECTED, 0); + } else { + AES_TAB *tmp = tablist->first; + while( tmp->next != NULL ) { + tmp = tmp->next; + } + tmp->next = newtab; + newtab->prev = tmp; + newtab->next = NULL; + set_state(tablist->tree, newtab->obj_tab, OS_SELECTED, 0); + } + + // TODO: Set the visible flag on that register? + + DEBUG_PRINT(("tablist_add: Tab=%p\n", newtab)); + + return(newtab); +} + + +short tablist_activate(AES_TABLIST * tablist, short tab, short options) +{ + AES_TAB *tmp, *activated=NULL, *deactivated=NULL; + struct aes_tab_s *active; + short activated_pg = -1; + short is_tab = 0; + + assert(tablist); + assert(tablist->first); + + active = tablist_get_active(tablist); + + if (active != NULL) { + if ((options & AES_TABLIST_OPTION_FORCE_EVENTS) == 0) { + if(active->obj_tab == tab) + return(0); + } + } + + tmp = tablist->first; + while (tmp != NULL) { + if(tmp->obj_tab == tab) { + is_tab = 1; + } + tmp = tmp->next; + } + + if(is_tab == 0) { + return(0); + } + + tmp = tablist->first; + while ( tmp != NULL ) { + if(tab != tmp->obj_tab) { + if (get_state(tablist->tree, tmp->obj_tab, OS_SELECTED) != 0) { + deactivated = tmp; + set_state(tablist->tree, tmp->obj_tab, OS_SELECTED, 0); + } + // the tab registers can share the same page, consider that: + if (tablist->tree == tmp->page_tree + && activated_pg != tmp->obj_page) { + + set_flag(tablist->tree, tmp->obj_page, OF_HIDETREE, 1); + } + } else { + activated = tmp; + // this tab must the selected / visible + set_state(tablist->tree, tmp->obj_tab, OS_SELECTED, 1); + if(tablist->tree == tmp->page_tree) + set_flag(tablist->tree, tmp->obj_page, OF_HIDETREE, 0); + activated_pg = tmp->obj_page; + } + tmp = tmp->next; + } + + if(tablist->user_func != NULL) { + AES_TABLIST_FUNC_ARGS args; + if(deactivated){ + args.event = AES_TABLIST_TAB_DEACTIVATED; + args.tab = deactivated; + tablist->user_func(tablist, &args); + } + if(activated){ + args.event = AES_TABLIST_TAB_ACTIVATED; + args.tab = activated; + tablist->user_func(tablist, &args); + } + } + return(1); +} + +struct aes_tab_s *tablist_get_active(AES_TABLIST * tablist) +{ + AES_TAB *tmp = tablist->first; + while( tmp != NULL ) { + if(get_state(tablist->tree, tmp->obj_tab, OS_SELECTED) != 0) { + // that's the one + return(tmp); + } + tmp = tmp->next; + } + return(NULL); +} + +AES_TAB * tablist_find(AES_TABLIST * tablist, OBJECT * page, short tab) +{ + AES_TAB *tmp = tablist->first; + while( tmp != NULL ) { + if((tmp->page_tree == page) && (tab == tmp->obj_tab)) { + return(tmp); + } + tmp = tmp->next; + } + return(NULL); +} + +void tablist_delete(AES_TABLIST *tablist) +{ + AES_TAB *tmp = tablist->first, *cur; + while ( tmp != NULL ) { + cur = tmp; + tmp = tmp->next; + DEBUG_PRINT(("tablist_delete, Freeing tab: %p\n", cur)); + free(cur); + } + DEBUG_PRINT(("tablist_delete, Freeing list: %p\n", tablist)); + free(tablist); +} diff --git a/atari/gemtk/aestabs.h b/atari/gemtk/aestabs.h new file mode 100644 index 000000000..c72054acc --- /dev/null +++ b/atari/gemtk/aestabs.h @@ -0,0 +1,56 @@ +#ifndef AESTABS_H_INCLUDED
+#define AESTABS_H_INCLUDED
+ +struct aes_tab_s; +struct aes_tablist_s; +typedef struct aes_tab_s AES_TAB; +typedef struct aes_tablist_s AES_TABLIST; + +#define AES_TABLIST_TAB_ACTIVATED 0x01 +#define AES_TABLIST_TAB_DEACTIVATED 0x02 + +#define AES_TABLIST_OPTION_FORCE_EVENTS 0x01 // do not eat events which do + // not changed the internal state + // this is required for tabs which + // require "activate" events + // for tabs which are already + // selected. + + +struct aes_tablist_user_args_s +{ + short event; + AES_TAB *tab; +}; + +typedef struct aes_tablist_user_args_s AES_TABLIST_FUNC_ARGS; + +typedef void (*aes_tablist_user_func)(AES_TABLIST * list, + AES_TABLIST_FUNC_ARGS * args); + +struct aes_tab_s { + short obj_tab; + short obj_page; + OBJECT * page_tree; + AES_TAB * next, *prev; +}; + +struct aes_tablist_s { + OBJECT *tree; + AES_TAB * first; + aes_tablist_user_func user_func; +}; + + + +AES_TABLIST * tablist_declare(OBJECT *tree, aes_tablist_user_func user_func); +void tablist_delete(AES_TABLIST * tablist); +AES_TAB * tablist_add(AES_TABLIST * tablist, short tab, OBJECT *page_tree, + short page); +short tablist_activate(AES_TABLIST * tablist, short tab, short option); +struct aes_tab_s *tablist_get_active(AES_TABLIST * tablist); +AES_TAB * tablist_find(AES_TABLIST * tablist, OBJECT *page, short tab); + +#define AES_TAB_IS_ACTIVE(l, x) (tablist_get_active(l) == x) +
+#endif // AESTABS_H_INCLUDED
diff --git a/atari/dragdrop.c b/atari/gemtk/dragdrop.c index bc7f5659b..a4b7b82a3 100755 --- a/atari/dragdrop.c +++ b/atari/gemtk/dragdrop.c @@ -18,8 +18,7 @@ #include <string.h> #include <stdio.h> -#include "windom.h" -#include "dragdrop.h" +#include "gemtk.h" #include "cflib.h" #ifndef EACCDN @@ -51,7 +50,7 @@ static long pipesig; * -1: Fehler beim Erzeugen der Pipe */ -short ddcreate(short *pipe) +short gemtk_dd_create(short *pipe) { long fd = -1; @@ -84,7 +83,7 @@ short ddcreate(short *pipe) /* Signalhandler konfigurieren */ - ddgetsig(&pipesig); + gemtk_dd_getsig(&pipesig); return((short) fd); @@ -114,7 +113,7 @@ short ddcreate(short *pipe) * -3: Fehler bei appl_write() */ -short ddmessage(short apid, short fd, short winid, short mx, short my, short kstate, short pipeid) +short gemtk_dd_message(short apid, short fd, short winid, short mx, short my, short kstate, short pipeid) { char c; short i, msg[8]; @@ -136,7 +135,7 @@ short ddmessage(short apid, short fd, short winid, short mx, short my, short kst if (i == 0) { - ddclose(fd); + gemtk_dd_close(fd); return(-3); } @@ -149,7 +148,7 @@ short ddmessage(short apid, short fd, short winid, short mx, short my, short kst { /* Timeout eingetreten */ - ddclose(fd); + gemtk_dd_close(fd); return(-2); } @@ -158,13 +157,13 @@ short ddmessage(short apid, short fd, short winid, short mx, short my, short kst if (Fread(fd, 1L, &c) != 1L) { - ddclose(fd); + gemtk_dd_close(fd); return(-1); } if (c != DD_OK) { - ddclose(fd); + gemtk_dd_close(fd); return(-1); } @@ -188,11 +187,11 @@ short ddmessage(short apid, short fd, short winid, short mx, short my, short kst * -1: Fehler beim Lesen aus der Pipe */ -short ddrexts(short fd, char *exts) +short gemtk_dd_rexts(short fd, char *exts) { if (Fread(fd, DD_EXTSIZE, exts) != DD_EXTSIZE) { - ddclose(fd); + gemtk_dd_close(fd); return(-1); } @@ -205,7 +204,7 @@ short ddrexts(short fd, char *exts) * Testet, ob der Empf„nger einen Datentyp akzeptiert * * Eingabeparameter: -* fd - Filehandle (von ddcreate()) +* fd - Filehandle (von gemtk_dd_create()) * ext - Zeiger auf Datentyp (4 Bytes zB. "ARGS") * text - Zeiger auf Datenbeschreibung (optional, zB. "DESKTOP args") * name - Zeiger auf Datendateiname (optional, zB. "SAMPLE.TXT") @@ -224,7 +223,7 @@ short ddrexts(short fd, char *exts) * DD_CLIPBOARD - Drop erfolgte auf Clipboard */ -short ddstry(short fd, char *ext, char *text, char *name, long size) +short gemtk_dd_stry(short fd, char *ext, char *text, char *name, long size) { char c; short hdrlen, i; @@ -265,11 +264,11 @@ short ddstry(short fd, char *ext, char *text, char *name, long size) * Pipe schliežen (Drag&Drop beenden/abbrechen) */ -void ddclose(short fd) +void gemtk_dd_close(short fd) { /* Signalhandler restaurieren */ - ddsetsig(pipesig); + gemtk_dd_setsig(pipesig); Fclose(fd); @@ -289,7 +288,7 @@ void ddclose(short fd) * keine */ -void ddgetsig(long *oldsig) +void gemtk_dd_getsig(long *oldsig) { *oldsig = (long) Psignal(SIGPIPE, (void *) SIG_IGN); } @@ -299,7 +298,7 @@ void ddgetsig(long *oldsig) * Signalhandler nach D&D restaurieren * * Eingabeparameter: -* oldsig - Alter Handlerwert (von ddgetsig) +* oldsig - Alter Handlerwert (von gemtk_dd_getsig) * * Ausgabeparameter: * keine @@ -308,7 +307,7 @@ void ddgetsig(long *oldsig) * keine */ -void ddsetsig(long oldsig) +void gemtk_dd_setsig(long oldsig) { if (oldsig != -32L) Psignal(SIGPIPE, (void *) oldsig); @@ -333,7 +332,7 @@ void ddsetsig(long oldsig) * -1 - Drag&Drop abgebrochen */ -short ddopen(short ddnam, char ddmsg) +short gemtk_dd_open(short ddnam, char ddmsg) { long fd; @@ -348,12 +347,12 @@ short ddopen(short ddnam, char ddmsg) /* Signalhandler konfigurieren */ - ddgetsig(&pipesig); + gemtk_dd_getsig(&pipesig); if (Fwrite((short) fd, 1L, &ddmsg) != 1L) { - ddclose((short) fd); + gemtk_dd_close((short) fd); return(-1); } @@ -381,11 +380,11 @@ short ddopen(short ddnam, char ddmsg) * -1: Fehler beim Schreiben in die Pipe */ -short ddsexts(short fd, char *exts) +short gemtk_dd_sexts(short fd, char *exts) { if (Fwrite(fd, DD_EXTSIZE, exts) != DD_EXTSIZE) { - ddclose(fd); + gemtk_dd_close(fd); return(-1); } @@ -398,7 +397,7 @@ short ddsexts(short fd, char *exts) * N„chsten Header vom Sender holen * * Eingabeparameter: -* fd - Filehandle der Pipe (von ddopen()) +* fd - Filehandle der Pipe (von gemtk_dd_open()) * * Ausgabeparameters: * name - Zeiger auf Buffer fr Datenbeschreibung (min. DD_NAMEMAX!) @@ -420,7 +419,7 @@ short ddsexts(short fd, char *exts) * les string sont limit‚ a 128 octets */ -short ddrtry(short fd, char *name, char *file, char *whichext, long *size) +short gemtk_dd_rtry(short fd, char *name, char *file, char *whichext, long *size) { char buf[DD_NAMEMAX * 2]; short hdrlen, i, len; @@ -491,7 +490,7 @@ short ddrtry(short fd, char *name, char *file, char *whichext, long *size) * Sendet der Senderapplikation eine 1 Byte Antwort * * Eingabeparameter: -* fd - Filehandle der Pipe (von ddopen()) +* fd - Filehandle der Pipe (von gemtk_dd_open()) * ack - Byte das gesendet werden soll (zB. DD_OK) * * Ausgabeparameter: @@ -502,11 +501,11 @@ short ddrtry(short fd, char *name, char *file, char *whichext, long *size) * -1: Fehler (die Pipe wird automatisch geschlossen!) */ -short ddreply(short fd, char ack) +short gemtk_dd_reply(short fd, char ack) { if (Fwrite(fd, 1L, &ack) != 1L) { - ddclose(fd); + gemtk_dd_close(fd); return(-1); } diff --git a/atari/gemtk/dragdrop.h b/atari/gemtk/dragdrop.h new file mode 100755 index 000000000..38466137b --- /dev/null +++ b/atari/gemtk/dragdrop.h @@ -0,0 +1,4 @@ +#ifndef DD_H_INCLUDED +#define DD_H_INCLUDED + +#endif diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h new file mode 100644 index 000000000..1853e75bc --- /dev/null +++ b/atari/gemtk/gemtk.h @@ -0,0 +1,260 @@ +#ifndef GEMTK_H_INCLUDED +#define GEMTK_H_INCLUDED + +#include <stdint.h> +#include <stdbool.h> + +#include <mint/osbind.h> +#include <mint/cookie.h> + +#include <gem.h> +#include <cflib.h> + + +/* -------------------------------------------------------------------------- */ +/* SYSTEM UTILS */ +/* -------------------------------------------------------------------------- */ + +/* System type detection added by [GS] */ +/* detect the system type, AES + kernel */ +#define SYS_TOS 0x0001 +#define SYS_MAGIC 0x0002 +#define SYS_MINT 0x0004 +#define SYS_GENEVA 0x0010 +#define SYS_NAES 0x0020 +#define SYS_XAAES 0x0040 +#define sys_type() (_systype_v ? _systype_v : _systype()) +#define sys_MAGIC() ((sys_type() & SYS_MAGIC) != 0) +#define sys_NAES() ((sys_type() & SYS_NAES) != 0) +#define sys_XAAES() ((sys_type() & SYS_XAAES) != 0) + +#define TOS4VER 0x03300 /* this is assumed to be the last single tasking OS */ + +extern unsigned short _systype_v; +unsigned short _systype (void); + +/* +* Chech for GRECT intersection without modifiend the src rectangles +* return true when the GRECT's intersect, fals otherwise. +*/ +bool gemtk_rc_intersect_ro(GRECT *a, GRECT *b); + +/* +* Convert keycode returned by evnt_multi to ascii value +*/ +int gemtk_keybd2ascii( int keybd, int shift); + +/** set VDI clip area by passing an GRECT */ +void gemtk_clip_grect(VdiHdl vh, GRECT *rect); + +#ifndef POINT_WITHIN +# define POINT_WITHIN(_x,_y, r) ((_x >= r.g_x) && (_x <= r.g_x + r.g_w ) \ + && (_y >= r.g_y) && (_y <= r.g_y + r.g_h)) +#endif + +#ifndef RC_WITHIN +# define RC_WITHIN(a,b) \ + (((a)->g_x >= (b)->g_x) \ + && (((a)->g_x + (a)->g_w) <= ((b)->g_x + (b)->g_w))) \ + && (((a)->g_y >= (b)->g_y) \ + && (((a)->g_y + (a)->g_h) <= ((b)->g_y + (b)->g_h))) +#endif + +#ifndef MAX +# define MAX(_a,_b) ((_a>_b) ? _a : _b) +#endif + +#ifndef MIN +# define MIN(_a,_b) ((_a<_b) ? _a : _b) +#endif + +#ifndef SET_BIT +# define SET_BIT(field,bit,val) field = (val)?((field)|(bit)):((field) & ~(bit)) +#endif + +/* -------------------------------------------------------------------------- */ +/* MultiTOS Drag & Drop */ +/* -------------------------------------------------------------------------- */ +short gemtk_dd_create(short *pipe); +short gemtk_dd_message(short apid, short fd, short winid, short mx, short my, short kstate, short pipename); +short gemtk_dd_rexts(short fd, char *exts); +short gemtk_dd_stry(short fd, char *ext, char *text, char *name, long size); +void gemtk_dd_close(short fd); +void gemtk_dd_getsig(long *oldsig); +void gemtk_dd_setsig(long oldsig); +short gemtk_dd_open(short ddnam, char ddmsg); +short gemtk_dd_sexts(short fd, char *exts); +short gemtk_dd_rtry(short fd, char *name, char *file, char *whichext, long *size); +short gemtk_dd_reply(short fd, char ack); + +/* -------------------------------------------------------------------------- */ +/* Message Box module */ +/* -------------------------------------------------------------------------- */ +#define GEMTK_MSG_BOX_ALERT 1 +#define GEMTK_MSG_BOX_CONFIRM 2 + +short gemtk_msg_box_show(short type, const char * msg); + +/* -------------------------------------------------------------------------- */ +/* GUIWIN Module */ +/* -------------------------------------------------------------------------- */ +#define GEMTK_WM_FLAG_PREPROC_WM 0x01 // let guiwin API handle some events +#define GEMTK_WM_FLAG_RECV_PREPROC_WM 0x02 // get notified even when pre-processed +#define GEMTK_WM_FLAG_HAS_VTOOLBAR 0x04 // the attached toolbar is vertical +#define GEMTK_WM_FLAG_CUSTOM_TOOLBAR 0x08 // no internal toolbar handling +#define GEMTK_WM_FLAG_CUSTOM_SCROLLING 0x20 // no internal scroller handling + +#define GEMTK_WM_FLAG_DEFAULTS \ + (GEMTK_WM_FLAG_PREPROC_WM | GEMTK_WM_FLAG_RECV_PREPROC_WM) + +#define GEMTK_WM_STATUS_ICONIFIED 0x01 +#define GEMTK_WM_STATUS_SHADED 0x02 + +#define GEMTK_WM_VSLIDER 0x01 +#define GEMTK_WM_HSLIDER 0x02 +#define GEMTK_WM_VH_SLIDER 0x03 + +/* + Message sent to the client application when an AES object is + clicked in an window which contains an form. + + Message Parameters: + msg[4] = Clicked Object. + msg[5] = Number of clicks. + msg[6] = Modifier keys. +*/ +#define GEMTK_WM_WM_FORM_CLICK 1001 +#define GEMTK_WM_WM_FORM_KEY 1002 + +struct gemtk_window_s; + +/** list struct for managing AES windows */ +typedef struct gemtk_window_s GUIWIN; + +/** GUIWIN event handler */ +typedef short (*gemtk_wm_event_handler_f)(GUIWIN *gw, + EVMULT_OUT *ev_out, short msg[8]); + +typedef void (*gemtk_wm_redraw_f)(GUIWIN *win, uint16_t msg, GRECT *clip); + +struct gemtk_wm_scroll_info_s { + + /** Definition of a content unit (horizontal) measured in pixel */ + int x_unit_px; + + /** Definition of content unit (vertical) measured in pixel */ + int y_unit_px; + + /** Current scroll position (in content units) */ + int x_pos; + + /** Current scroll position (in content units) */ + int y_pos; + + /** Size of content (horizontal) measured in content units */ + int x_units; + + /** Size of content (vertical) measured in content units */ + int y_units; +}; + +/** Well known areas inside the window */ +enum guwin_area_e { + GEMTK_WM_AREA_WORK = 0, + GEMTK_WM_AREA_TOOLBAR, + GEMTK_WM_AREA_CONTENT +}; + +/* -------------------------------------------------------------------------- */ +/* GUIWIN functions (document in guiwin.c) */ +/* -------------------------------------------------------------------------- */ + +short +gemtk_wm_init(void); + +void gemtk_wm_exit(void); + +GUIWIN * gemtk_wm_add(short handle, uint32_t flags, + gemtk_wm_event_handler_f handler); + +GUIWIN * gemtk_wm_find(short handle); + +short gemtk_wm_remove(GUIWIN *win); + +GUIWIN * gemtk_wm_validate_ptr(GUIWIN *win); + +GUIWIN *gemtk_wm_link(GUIWIN *win); + +GUIWIN *gemtk_wm_unlink(GUIWIN *win); + +short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]); + +void gemtk_wm_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest); + +short gemtk_wm_get_handle(GUIWIN *win); + +uint32_t gemtk_wm_get_state(GUIWIN *win); + +void gemtk_wm_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx, + uint32_t flags); + +void gemtk_wm_set_event_handler(GUIWIN *win,gemtk_wm_event_handler_f cb); + +void gemtk_wm_set_user_data(GUIWIN *win, void *data); + +void * gemtk_wm_get_user_data(GUIWIN *win); + +struct gemtk_wm_scroll_info_s * gemtk_wm_get_scroll_info(GUIWIN *win); + +void gemtk_wm_set_scroll_grid(GUIWIN * win, short x, short y); + +void gemtk_wm_set_content_units(GUIWIN * win, short x, short y); + +void gemtk_wm_set_form(GUIWIN *win, OBJECT *tree, short index); + +void gemtk_wm_set_toolbar_size(GUIWIN *win, uint16_t s); + +void gemtk_wm_set_toolbar_edit_obj(GUIWIN *win, uint16_t obj, short kreturn); + +void gemtk_wm_set_toolbar_redraw_func(GUIWIN *win, gemtk_wm_redraw_f func); + +bool gemtk_wm_update_slider(GUIWIN *win, short mode); + +void gemtk_wm_scroll(GUIWIN *gw, short orientation, int units, bool refresh); + +void gemtk_wm_send_msg(GUIWIN *win, short msgtype, short a, short b, short c, + short d); + +void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area); + +VdiHdl gemtk_wm_get_vdi_handle(GUIWIN *win); + +short getm_wm_get_toolbar_edit_obj(GUIWIN *win); + +bool gemtk_wm_has_intersection(GUIWIN *win, GRECT *work); + +void gemtk_wm_toolbar_redraw(GUIWIN *win, uint16_t msg, GRECT *clip); + +void gemtk_wm_form_redraw(GUIWIN *gw, GRECT *clip); + +void gemtk_wm_clear(GUIWIN *win); + +/* -------------------------------------------------------------------------- */ +/* AES SCROLLER MODULE */ +/* -------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------- */ +/* AES TABS MODULE */ +/* -------------------------------------------------------------------------- */ + +/* -------------------------------------------------------------------------- */ +/* AES OBJECT TREE TOOLS */ +/* -------------------------------------------------------------------------- */ +char gemtk_obj_set_str_safe(OBJECT * tree, short idx, char *txt); +char *gemtk_obj_get_text(OBJECT * tree, short idx); +GRECT * gemtk_obj_screen_rect(OBJECT * tree, short obj); +bool gemtk_obj_is_inside(OBJECT * tree, short obj, GRECT *area); +OBJECT *gemtk_obj_get_tree(int idx); +void gemtk_obj_mouse_sprite(OBJECT *tree, int index); +OBJECT *gemtk_obj_tree_copy(OBJECT *tree); +#endif // GEMTK_H_INCLUDED diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c new file mode 100644 index 000000000..0334e58df --- /dev/null +++ b/atari/gemtk/guiwin.c @@ -0,0 +1,1337 @@ +/* + * Copyright 2012 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 <stdint.h> +#include <stdbool.h> +#include <assert.h> + +#include <gem.h> +#include <gemx.h> +#include <cflib.h> + +#include "gemtk.h" + +//#define DEBUG_PRINT(x) printf x +#define DEBUG_PRINT(x) + +struct gemtk_window_s { + + /** The AES handle of the window */ + short handle; + + /** the generic event handler function for events passed to the client */ + gemtk_wm_event_handler_f handler_func; + + /** The custom toolbar redraw function, if any */ + gemtk_wm_redraw_f toolbar_redraw_func; + + /** window configuration */ + uint32_t flags; + + /** window state */ + uint32_t state; + + /** AES Tree used as toolbar */ + OBJECT *toolbar; + + /** Current edit object selected in the toolbar, if any. */ + short toolbar_edit_obj; + + /** Current selected object in the toolbar, if any. */ + short toolbar_focus_obj; + + /** Describes the start of the toolbar tree (usually 0) */ + short toolbar_idx; + + /** depending on the flag GEMTK_WM_FLAG_HAS_VTOOLBAR this defines the toolbar + height or the toolbar width (GEMTK_WM_FLAG_HAS_VTOOLBAR means width). + */ + short toolbar_size; + + /** AES Object tree to be used for windowed dialogs. */ + OBJECT *form; + + /** Current form edit object, if any. */ + short form_edit_obj; + + /** Current form focus object, if any */ + short form_focus_obj; + + /** Describes the start of the form tree */ + short form_idx; + + /** Scroll state */ + struct gemtk_wm_scroll_info_s scroll_info; + + /** Arbitary data set by the user */ + void *user_data; + + /** linked list items */ + struct gemtk_window_s *next, *prev; +}; + +static GUIWIN * winlist; +static VdiHdl v_vdi_h = -1; +static short work_out[57]; + +static void move_rect(GUIWIN * win, GRECT *rect, int dx, int dy) +{ + INT16 xy[ 8]; + long dum = 0L; + GRECT g; + + VdiHdl vh = gemtk_wm_get_vdi_handle(win); + + while(!wind_update(BEG_UPDATE)); + graf_mouse(M_OFF, 0L); + + /* get intersection with screen area */ + wind_get_grect(0, WF_CURRXYWH, &g); + rc_intersect(&g, rect); + xy[0] = rect->g_x; + xy[1] = rect->g_y; + xy[2] = xy[0] + rect->g_w-1; + xy[3] = xy[1] + rect->g_h-1; + xy[4] = xy[0] + dx; + xy[5] = xy[1] + dy; + xy[6] = xy[2] + dx; + xy[7] = xy[3] + dy; + vro_cpyfm(vh, S_ONLY, xy, (MFDB *)&dum, (MFDB *)&dum); + + graf_mouse(M_ON, 0L); + wind_update(END_UPDATE); +} + +/** +* Handles common events. +* returns 0 when the event was not handled, 1 otherwise. +*/ +static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8]) +{ + GRECT g, g_ro, g2; + short retval = 1; + int val = 1, old_val; + struct gemtk_wm_scroll_info_s *slid; + + switch(msg[0]) { + + case WM_HSLID: + gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g); + wind_set(gw->handle, WF_HSLIDE, msg[4], 0, 0, 0); + slid = gemtk_wm_get_scroll_info(gw); + val = (float)(slid->x_units-(g.g_w/slid->x_unit_px))/1000*(float)msg[4]; + if(val != slid->x_pos) { + if (val < slid->x_pos) { + val = -(MAX(0, slid->x_pos-val)); + } else { + val = val-slid->x_pos; + } + gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, val, false); + } + break; + + case WM_VSLID: + gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g); + wind_set(gw->handle, WF_VSLIDE, msg[4], 0, 0, 0); + slid = gemtk_wm_get_scroll_info(gw); + val = (float)(slid->y_units-(g.g_h/slid->y_unit_px))/1000*(float)msg[4]; + if(val != slid->y_pos) { + if (val < slid->y_pos) { + val = -(slid->y_pos - val); + } else { + val = val -slid->y_pos; + } + gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, val, false); + } + break; + + case WM_ARROWED: + if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) { + + slid = gemtk_wm_get_scroll_info(gw); + gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g); + g_ro = g; + + switch(msg[4]) { + + case WA_UPPAGE: + /* scroll page up */ + gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, -(g.g_h/slid->y_unit_px), + true); + break; + + case WA_UPLINE: + /* scroll line up */ + gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, -1, true); + break; + + case WA_DNPAGE: + /* scroll page down */ + gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, g.g_h/slid->y_unit_px, + true); + break; + + case WA_DNLINE: + /* scroll line down */ + gemtk_wm_scroll(gw, GEMTK_WM_VSLIDER, +1, true); + break; + + case WA_LFPAGE: + /* scroll page left */ + gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, -(g.g_w/slid->x_unit_px), + true); + break; + + case WA_LFLINE: + /* scroll line left */ + gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, -1, + true); + break; + + case WA_RTPAGE: + /* scroll page right */ + gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, (g.g_w/slid->x_unit_px), + true); + break; + + case WA_RTLINE: + /* scroll line right */ + gemtk_wm_scroll(gw, GEMTK_WM_HSLIDER, 1, + true); + break; + + default: + break; + } + } + break; + + case WM_TOPPED: + wind_set(gw->handle, WF_TOP, 1, 0, 0, 0); + break; + + case WM_MOVED: + wind_get_grect(gw->handle, WF_CURRXYWH, &g); + wind_set(gw->handle, WF_CURRXYWH, msg[4], msg[5], g.g_w, g.g_h); + + if (gw->form) { + + gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &g); + slid = gemtk_wm_get_scroll_info(gw); + + gw->form[gw->form_idx].ob_x = g.g_x - + (slid->x_pos * slid->x_unit_px); + + gw->form[gw->form_idx].ob_y = g.g_y - + (slid->y_pos * slid->y_unit_px); + } + + break; + + case WM_SIZED: + case WM_REPOSED: + wind_get_grect(gw->handle, WF_FULLXYWH, &g2); + wind_get_grect(gw->handle, WF_CURRXYWH, &g); + g.g_w = MIN(msg[6], g2.g_w); + g.g_h = MIN(msg[7], g2.g_h); + if(g2.g_w != g.g_w || g2.g_h != g.g_h) { + wind_set(gw->handle, WF_CURRXYWH, g.g_x, g.g_y, g.g_w, g.g_h); + if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) { + if(gemtk_wm_update_slider(gw, GEMTK_WM_VH_SLIDER)) { + gemtk_wm_send_redraw(gw, NULL); + } + } + } + + + break; + + case WM_FULLED: + wind_get_grect(DESKTOP_HANDLE, WF_WORKXYWH, &g); + wind_get_grect(gw->handle, WF_CURRXYWH, &g2); + if(g.g_w == g2.g_w && g.g_h == g2.g_h) { + wind_get_grect(gw->handle, WF_PREVXYWH, &g); + } + wind_set_grect(gw->handle, WF_CURRXYWH, &g); + if((gw->flags & GEMTK_WM_FLAG_CUSTOM_SCROLLING) == 0) { + if(gemtk_wm_update_slider(gw, GEMTK_WM_VH_SLIDER)) { + gemtk_wm_send_redraw(gw, NULL); + } + } + break; + + case WM_ICONIFY: + wind_set(gw->handle, WF_ICONIFY, msg[4], msg[5], msg[6], msg[7]); + gw->state |= GEMTK_WM_STATUS_ICONIFIED; + break; + + case WM_UNICONIFY: + wind_set(gw->handle, WF_UNICONIFY, msg[4], msg[5], msg[6], msg[7]); + gw->state &= ~(GEMTK_WM_STATUS_ICONIFIED); + break; + + case WM_SHADED: + gw->state |= GEMTK_WM_STATUS_SHADED; + break; + + case WM_UNSHADED: + gw->state &= ~(GEMTK_WM_STATUS_SHADED); + break; + + case WM_REDRAW: + if ((gw->flags & GEMTK_WM_FLAG_CUSTOM_TOOLBAR) == 0) { + g.g_x = msg[4]; + g.g_y = msg[5]; + g.g_w = msg[6]; + g.g_h = msg[7]; + gemtk_wm_toolbar_redraw(gw, WM_REDRAW, &g); + } + if (gw->form != NULL) { + g.g_x = msg[4]; + g.g_y = msg[5]; + g.g_w = msg[6]; + g.g_h = msg[7]; + gemtk_wm_form_redraw(gw, &g); + } + break; + + default: + retval = 0; + break; + + } + + return(retval); +} + +/** +* Preprocess mouse events +*/ +static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8]) +{ + short retval = 0, obj_idx = 0; + + DEBUG_PRINT(("preproc_mu_button\n")); + + // toolbar handling: + if ((gw->flags & GEMTK_WM_FLAG_CUSTOM_TOOLBAR) == 0 + && gw->toolbar != NULL) { + + GRECT tb_area; + + gemtk_wm_get_grect(gw, GEMTK_WM_AREA_TOOLBAR, &tb_area); + + if (POINT_WITHIN(ev_out->emo_mouse.p_x, + ev_out->emo_mouse.p_y, tb_area)) { + + gw->toolbar[gw->toolbar_idx].ob_x = tb_area.g_x; + gw->toolbar[gw->toolbar_idx].ob_y = tb_area.g_y; + obj_idx = objc_find(gw->toolbar, + gw->toolbar_idx, 8, + ev_out->emo_mouse.p_x, + ev_out->emo_mouse.p_y); + + gw->toolbar_focus_obj = obj_idx; + + DEBUG_PRINT(("Toolbar index: %d\n", obj_idx)); + if (obj_idx > -1 + && (gw->toolbar[obj_idx].ob_state & OS_DISABLED)== 0 + && ((gw->flags & GEMTK_WM_FLAG_CUSTOM_TOOLBAR) == 0)) { + + uint16_t type = (gw->toolbar[obj_idx].ob_type & 0xFF); + uint16_t nextobj; + + DEBUG_PRINT(("toolbar item type: %d\n", type)); + // report mouse click to the tree: + retval = form_wbutton(gw->toolbar, gw->toolbar_focus_obj, + ev_out->emo_mclicks, &nextobj, + gw->handle); + if (nextobj == obj_idx + && (type == G_FTEXT || type == G_FBOXTEXT)) { + gw->toolbar_edit_obj = obj_idx; + } + else { + gw->toolbar_edit_obj = -1; + } + } + + // send WM_TOOLBAR message + short oldevents = ev_out->emo_events; + short msg_out[8] = {WM_TOOLBAR, gl_apid, + 0, gw->handle, + obj_idx, ev_out->emo_mclicks, + ev_out->emo_kmeta, ev_out->emo_mbutton + }; + ev_out->emo_events = MU_MESAG; + // notify the window about toolbar click: + gw->handler_func(gw, ev_out, msg_out); + ev_out->emo_events = oldevents; + retval = 1; + } else { + if (gw->toolbar_edit_obj != -1) { + gw->toolbar_edit_obj = -1; + } + } + } + + if (gw->form != NULL) { + + GRECT content_area; + struct gemtk_wm_scroll_info_s *slid; + + DEBUG_PRINT(("preproc_mu_button: handling form click.\n")); + + gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &content_area); + + if (POINT_WITHIN(ev_out->emo_mouse.p_x, + ev_out->emo_mouse.p_y, content_area)) { + + slid = gemtk_wm_get_scroll_info(gw); + + // adjust form position (considering window and scroll position): + gw->form[gw->form_idx].ob_x = content_area.g_x - + (slid->x_pos * slid->x_unit_px); + gw->form[gw->form_idx].ob_y = content_area.g_y - + (slid->y_pos * slid->y_unit_px); + + obj_idx = objc_find(gw->form, gw->form_idx, 8, + ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y); + gw->form_focus_obj = obj_idx; + DEBUG_PRINT(("Window Form click, obj: %d\n", gw->form_focus_obj)); + if (obj_idx > -1 + && (gw->form[obj_idx].ob_state & OS_DISABLED)== 0) { + + uint16_t type = (gw->form[obj_idx].ob_type & 0xFF); + uint16_t nextobj; + + DEBUG_PRINT(("type: %d\n", type)); + + retval = form_wbutton(gw->form, gw->form_focus_obj, + ev_out->emo_mclicks, &nextobj, + gw->handle); + + if (nextobj == obj_idx + && (type == G_FTEXT || type == G_FBOXTEXT)) { + gw->form_edit_obj = obj_idx; + } + else { + gw->form_edit_obj = -1; + } + + short oldevents = ev_out->emo_events; + short msg_out[8] = { GEMTK_WM_WM_FORM_CLICK, gl_apid, + 0, gw->handle, + gw->form_focus_obj, ev_out->emo_mclicks, + ev_out->emo_kmeta, 0 + }; + ev_out->emo_events = MU_MESAG; + // notify the window about form click: + gw->handler_func(gw, ev_out, msg_out); + ev_out->emo_events = oldevents; + retval = 1; + evnt_timer(150); + } + } + else { + gw->form_edit_obj = -1; + + } + } + + return(retval); +} + +/** +* Preprocess keyboard events (for forms/toolbars) +*/ +static short preproc_mu_keybd(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8]) +{ + short retval = 0; + + if((gw->toolbar != NULL) && (gw->toolbar_edit_obj > -1) ) { + + short next_edit_obj = gw->toolbar_edit_obj; + short next_char = -1; + short edit_idx; + short r; + + r = form_wkeybd(gw->toolbar, gw->toolbar_edit_obj, next_edit_obj, + ev_out->emo_kreturn, + &next_edit_obj, &next_char, gw->handle); + + if (next_edit_obj != gw->toolbar_edit_obj) { + + gemtk_wm_set_toolbar_edit_obj(gw, next_edit_obj, + ev_out->emo_kreturn); + } else { + if(next_char > 13) + r = objc_wedit(gw->toolbar, gw->toolbar_edit_obj, + ev_out->emo_kreturn, &edit_idx, + EDCHAR, gw->handle); + } + //retval = 1; + /*gemtk_wm_send_msg(gw, GEMTK_WM_WM_FORM_KEY, gw->toolbar_edit_obj, + ev_out->emo_kreturn, 0, 0);*/ + } + + if((gw->form != NULL) && (gw->form_edit_obj > -1) ) { + + short next_edit_obj = gw->form_edit_obj; + short next_char = -1; + short edit_idx; + short r; + + r = form_wkeybd(gw->form, gw->form_edit_obj, next_edit_obj, + ev_out->emo_kreturn, + &next_edit_obj, &next_char, gw->handle); + + if (next_edit_obj != gw->form_edit_obj) { + + if(gw->form_edit_obj != -1) { + objc_wedit(gw->form, gw->form_edit_obj, + ev_out->emo_kreturn, &edit_idx, + EDEND, gw->handle); + } + + gw->form_edit_obj = next_edit_obj; + + objc_wedit(gw->form, gw->form_edit_obj, + ev_out->emo_kreturn, &edit_idx, + EDINIT, gw->handle); + } else { + if(next_char > 13) + r = objc_wedit(gw->form, gw->form_edit_obj, + ev_out->emo_kreturn, &edit_idx, + EDCHAR, gw->handle); + } + } + return(retval); +} + +/** +* Event Dispatcher function. The guiwin API doesn't own an event loop, +* so you have to inform it for every event that you want it to handle. +*/ +short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]) +{ + GUIWIN *dest; + short retval = 0; + bool handler_called = false; + + if( (ev_out->emo_events & MU_MESAG) != 0 ) { + DEBUG_PRINT(("gemtk_wm_handle_event_multi_fast: %d (%x)\n", msg[0], + msg[0])); + switch (msg[0]) { + case WM_REDRAW: + case WM_CLOSED: + case WM_TOPPED: + case WM_ARROWED: + case WM_HSLID: + case WM_VSLID: + case WM_FULLED: + case WM_SIZED: + case WM_REPOSED: + case WM_MOVED: + case WM_NEWTOP: + case WM_UNTOPPED: + case WM_ONTOP: + case WM_BOTTOM: + case WM_ICONIFY: + case WM_UNICONIFY: + case WM_ALLICONIFY: + case WM_TOOLBAR: + case AP_DRAGDROP: + case AP_TERM: + case AP_TFAIL: + dest = gemtk_wm_find(msg[3]); + if (dest) { + DEBUG_PRINT(("Found WM_ dest: %p (%d), flags: %d, cb: %p\n", dest, dest->handle, dest->flags, dest->handler_func)); + if (dest->flags&GEMTK_WM_FLAG_PREPROC_WM) { + retval = preproc_wm(dest, ev_out, msg); + if(((retval == 0)||(dest->flags&GEMTK_WM_FLAG_RECV_PREPROC_WM))) { + retval = dest->handler_func(dest, ev_out, msg); + handler_called = true; + } + } else { + if (dest->handler_func) { + retval = dest->handler_func(dest, ev_out, msg); + handler_called = true; + } + } + + } + break; + } + } else { + + short h_aes; + h_aes = wind_find(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y); + if(h_aes > 0 && (ev_out->emo_events != MU_TIMER)) { + + dest = gemtk_wm_find(h_aes); + + if (dest == NULL || dest->handler_func == NULL) + return(0); + + if ((ev_out->emo_events & MU_BUTTON) != 0) { + + DEBUG_PRINT(("Found MU_BUTTON dest: %p (%d), flags: %d, cb: %p\n", dest, dest->handle, dest->flags, dest->handler_func)); + retval = preproc_mu_button(dest, ev_out, msg); + if(retval != 0) { + handler_called = true; + } + } + + if ((ev_out->emo_events & MU_KEYBD)) { + retval = preproc_mu_keybd(dest, ev_out, msg); + if(retval != 0) { + handler_called = true; + } + } + + if (handler_called==false) { + dest->handler_func(dest, ev_out, msg); + } + } + } + + return(retval); +} + +/** +* Initialises the guiwin API +*/ +short gemtk_wm_init(void) +{ + if(v_vdi_h == -1) { + short dummy; + short work_in[12] = {Getrez()+2,1,1,1,1,1,1,1,1,1,2,1}; + v_vdi_h=graf_handle(&dummy, &dummy, &dummy, &dummy); + v_opnvwk(work_in, &v_vdi_h, work_out); + } + return(0); +} + +void gemtk_wm_exit(void) +{ + v_clsvwk(v_vdi_h); +} + +/** +* Adds and AES handle to the guiwin list and creates and GUIWIN management +* structure. +* +* \param handle The AES handle +* \param flags Creation flags, configures how the AES window is handled +* \param cb event handler function for that window +*/ +GUIWIN * gemtk_wm_add(short handle, uint32_t flags, gemtk_wm_event_handler_f cb) +{ + + GUIWIN *win = calloc(sizeof(GUIWIN),1); + + assert(win!=NULL); + DEBUG_PRINT(("gemtk_wm_add: %d, %p, cb: %p\n", handle, win, cb)); + + win->handle = handle; + win->handler_func = cb; + win->flags = flags; + gemtk_wm_link(win); + + DEBUG_PRINT(("Added guiwin: %p, tb: %p\n", win, win->toolbar)); + return(win); +} + +/** +* Returns an GUIWIN* for AES handle, when that AES window is managed by guiwin +*/ +GUIWIN *gemtk_wm_find(short handle) +{ + GUIWIN *g; + DEBUG_PRINT(("guiwin search handle: %d\n", handle)); + for( g = winlist; g != NULL; g=g->next ) { + if(g->handle == handle) { + DEBUG_PRINT(("guiwin found handle: %p\n", g)); + return(g); + } + } + return(NULL); +} + + +/** +* Check's if the pointer is managed by the guiwin API. +*/ +GUIWIN *gemtk_wm_validate_ptr(GUIWIN *win) +{ + GUIWIN *g; + for( g = winlist; g != NULL; g=g->next ) { + DEBUG_PRINT(("guiwin gemtk_wm_validate_ptr check: %p\n", g)); + if(g == win) { + DEBUG_PRINT(("gemtk_wm_validate_ptr valid: %p\n", g)); + return(g); + } + } + return(NULL); +} + +GUIWIN *gemtk_wm_link(GUIWIN *win) +{ + /* Make sure the window is not linked: */ + GUIWIN *win_val = gemtk_wm_validate_ptr(win); + if(win_val){ + DEBUG_PRINT(("GUIWIN %p is already linked!\n", win)); + return(NULL); + } + + if (winlist == NULL) { + winlist = win; + win->next = NULL; + win->prev = NULL; + } else { + GUIWIN *tmp = winlist; + while( tmp->next != NULL ) { + tmp = tmp->next; + } + tmp->next = win; + win->prev = tmp; + win->next = NULL; + } +} + +GUIWIN *gemtk_wm_unlink(GUIWIN *win) +{ + GUIWIN * win_val; + + /* Make sure the window is linked: */ + win_val = gemtk_wm_validate_ptr(win); + if (win_val == NULL){ + DEBUG_PRINT(("GUIWIN %p is not linked!\n", win)); + return(NULL); + } + + + /* unlink the window: */ + if(win->prev != NULL ) { + win->prev->next = win->next; + } else { + winlist = win->next; + } + if (win->next != NULL) { + win->next->prev = win->prev; + } + return(win); +} + +/** +* Remove an GUIWIN from the list of managed windows and free the GUIWIN. +* Call this when the AES window is closed or deleted. +*/ +short gemtk_wm_remove(GUIWIN *win) +{ + gemtk_wm_unlink(win); + DEBUG_PRINT(("guiwin free: %p\n", win)); + free(win); + return(0); +} + +/** Calculate & get a well known area within the GUIWIN. +* \param win The GUIWIN ptr. +* \param mode Specifies the area to retrieve. +* \param dest The calculated rectangle. +*/ +void gemtk_wm_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest) +{ + + assert(win != NULL); + + wind_get_grect(win->handle, WF_WORKXYWH, dest); + + if (mode == GEMTK_WM_AREA_CONTENT) { + GRECT tb_area; + gemtk_wm_get_grect(win, GEMTK_WM_AREA_TOOLBAR, &tb_area); + if (win->flags & GEMTK_WM_FLAG_HAS_VTOOLBAR) { + dest->g_x += tb_area.g_w; + dest->g_w -= tb_area.g_w; + } + else { + dest->g_y += tb_area.g_h; + dest->g_h -= tb_area.g_h; + } + } else if (mode == GEMTK_WM_AREA_TOOLBAR) { + if (win->toolbar) { + if (win->flags & GEMTK_WM_FLAG_HAS_VTOOLBAR) { + dest->g_w = win->toolbar_size; + } else { + dest->g_h = win->toolbar_size; + } + } + else { + dest->g_w = 0; + dest->g_h = 0; + } + } +} + + +/** +* Scroll the content area (GEMTK_WM_AREA_CONTENT) in the specified dimension +* (GEMTK_WM_VSLIDER, GEMTK_WM_HSLIDER) +* \param win The GUIWIN +* \param orientation GEMTK_WM_VSLIDER or GEMTK_WM_HSLIDER +* \param units the amout to scroll (pass negative values to scroll up) +* \param refresh Sliders will be updated when this flag is set +*/ +void gemtk_wm_scroll(GUIWIN *win, short orientation, int units, bool refresh) +{ + struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(win); + int oldpos = 0, newpos = 0, vis_units=0, pix = 0; + int abs_pix = 0; + GRECT *redraw=NULL, g, g_ro; + + gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &g); + g_ro = g; + + if (orientation == GEMTK_WM_VSLIDER) { + pix = units*slid->y_unit_px; + abs_pix = abs(pix); + oldpos = slid->y_pos; + vis_units = g.g_h/slid->y_unit_px; + newpos = slid->y_pos = MIN(slid->y_units-vis_units, + MAX(0, slid->y_pos+units)); + if(newpos < 0) { + newpos = slid->y_pos = 0; + } + if(oldpos == newpos) + return; + + if (units>=vis_units || gemtk_wm_has_intersection(win, &g_ro)) { + // send complete redraw + redraw = &g_ro; + } else { + // only adjust ypos when scrolling down: + if(pix < 0 ) { + // blit screen area: + g.g_h -= abs_pix; + move_rect(win, &g, 0, abs_pix); + g.g_y = g_ro.g_y; + g.g_h = abs_pix; + redraw = &g; + } else { + // blit screen area: + g.g_y += abs_pix; + g.g_h -= abs_pix; + move_rect(win, &g, 0, -abs_pix); + g.g_y = g_ro.g_y + g_ro.g_h - abs_pix; + g.g_h = abs_pix; + redraw = &g; + } + } + } else { + pix = units*slid->x_unit_px; + abs_pix = abs(pix); + oldpos = slid->x_pos; + vis_units = g.g_w/slid->x_unit_px; + newpos = slid->x_pos = MIN(slid->x_units-vis_units, + MAX(0, slid->x_pos+units)); + + if(newpos < 0) { + newpos = slid->x_pos = 0; + } + + if(oldpos == newpos) + return; + if (units>=vis_units || gemtk_wm_has_intersection(win, &g_ro)) { + // send complete redraw + redraw = &g_ro; + } else { + // only adjust ypos when scrolling down: + if(pix < 0 ) { + // blit screen area: + g.g_w -= abs_pix; + move_rect(win, &g, abs_pix, 0); + g.g_x = g_ro.g_x; + g.g_w = abs_pix; + redraw = &g; + } else { + // blit screen area: + g.g_x += abs_pix; + g.g_w -= abs_pix; + move_rect(win, &g, -abs_pix, 0); + g.g_x = g_ro.g_x + g_ro.g_w - abs_pix; + g.g_w = abs_pix; + redraw = &g; + } + } + } + + if (refresh) { + gemtk_wm_update_slider(win, orientation); + } + + if ((redraw != NULL) && (redraw->g_h > 0)) { + gemtk_wm_send_redraw(win, redraw); + } +} + +/** +* Refresh the sliders of the window. +* \param win the GUIWIN +* \param mode bitmask, valid bits: GEMTK_WM_VSLIDER, GEMTK_WM_HSLIDER +*/ +bool gemtk_wm_update_slider(GUIWIN *win, short mode) +{ + GRECT viewport; + struct gemtk_wm_scroll_info_s * slid; + unsigned long size, pos; + int old_x, old_y; + + short handle = gemtk_wm_get_handle(win); + gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &viewport); + slid = gemtk_wm_get_scroll_info(win); + + old_x = slid->x_pos; + old_y = slid->y_pos; + + // TODO: check if the window has sliders of that direction...? + + if((mode & GEMTK_WM_VSLIDER) && (slid->y_unit_px > 0)) { + if ( slid->y_units < (long)viewport.g_h/slid->y_unit_px) { + size = 1000L; + } else + size = MAX( 50L, (unsigned long)viewport.g_h*1000L/ + (unsigned long)(slid->y_unit_px*slid->y_units)); + wind_set(handle, WF_VSLSIZE, (int)size, 0, 0, 0); + + if (slid->y_units > (long)viewport.g_h/slid->y_unit_px) { + pos = (unsigned long)slid->y_pos *1000L/ + (unsigned long)(slid->y_units-viewport.g_h/slid->y_unit_px); + wind_set(handle, WF_VSLIDE, (int)pos, 0, 0, 0); + } else if (slid->y_pos) { + slid->y_pos = 0; + wind_set(handle, WF_VSLIDE, 0, 0, 0, 0); + } + } + if((mode & GEMTK_WM_HSLIDER) && (slid->x_unit_px > 0)) { + if ( slid->x_units < (long)viewport.g_w/slid->x_unit_px) + size = 1000L; + else + size = MAX( 50L, (unsigned long)viewport.g_w*1000L/ + (unsigned long)(slid->x_unit_px*slid->x_units)); + wind_set(handle, WF_HSLSIZE, (int)size, 0, 0, 0); + + if( slid->x_units > (long)viewport.g_w/slid->x_unit_px) { + pos = (unsigned long)slid->x_pos*1000L/ + (unsigned long)(slid->x_units-viewport.g_w/slid->x_unit_px); + wind_set(handle, WF_HSLIDE, (int)pos, 0, 0, 0); + } else if (slid->x_pos) { + slid->x_pos = 0; + wind_set(handle, WF_HSLIDE, 0, 0, 0, 0); + } + } + + if(old_x != slid->x_pos || old_y != slid->y_pos) { + return(true); + } + return(false); +} + +/** +* Return the AES handle for the GUIWIN. +*/ +short gemtk_wm_get_handle(GUIWIN *win) +{ + return(win->handle); +} + +/** +* Return the VDI handle for an GUIWIN. +*/ +VdiHdl gemtk_wm_get_vdi_handle(GUIWIN *win) +{ + return(v_vdi_h); +} + +/** +* Returns the state bitmask of the window +*/ +uint32_t gemtk_wm_get_state(GUIWIN *win) +{ + return(win->state); +} + + +/** +* Set and new event handler function. +*/ +void gemtk_wm_set_event_handler(GUIWIN *win,gemtk_wm_event_handler_f cb) +{ + win->handler_func = cb; +} + +/** +* Configure the window so that it shows an toolbar or at least reserves +* an area to draw an toolbar. +* \param win The GUIWIN +* \param toolbar the AES form +* \param idx index within the toolbar tree (0 in most cases...) +* \param flags optional configuration flags +*/ +//TODO: document flags +void gemtk_wm_set_toolbar(GUIWIN *win, OBJECT *toolbar, short idx, uint32_t flags) +{ + win->toolbar = toolbar; + win->toolbar_idx = idx; + win->toolbar_edit_obj = -1; + if (flags & GEMTK_WM_FLAG_HAS_VTOOLBAR) { + win->flags |= GEMTK_WM_FLAG_HAS_VTOOLBAR; + win->toolbar_size = win->toolbar[idx].ob_width; + } + else { + win->toolbar_size = win->toolbar[idx].ob_height; + } +} + +/** Update width/height of the toolbar region +* \param win the GUIWIN +* \param s depending on the flag GEMTK_WM_FLAG_HAS_VTOOLBAR this is the width or the height +*/ +void gemtk_wm_set_toolbar_size(GUIWIN *win, uint16_t s) +{ + win->toolbar_size = s; +} + +short getm_wm_get_toolbar_edit_obj(GUIWIN *win) +{ + return(win->toolbar_edit_obj); +} + +/** Set the current active edit object */ +void gemtk_wm_set_toolbar_edit_obj(GUIWIN *win, uint16_t obj, short kreturn) +{ + short edit_idx; + + if (obj != win->toolbar_edit_obj) { + + if(win->toolbar_edit_obj != -1) { + objc_wedit(win->toolbar, win->toolbar_edit_obj, kreturn, &edit_idx, + EDEND, win->handle); + } + + win->toolbar_edit_obj = obj; + + objc_wedit(win->toolbar, win->toolbar_edit_obj, kreturn, &edit_idx, + EDINIT, win->handle); + } +} + +/** Set an custom toolbar redraw function which is called instead of +* default drawing routine. +* \param win the GUIWIN +* \param func the custom redraw function +*/ +void gemtk_wm_set_toolbar_redraw_func(GUIWIN *win, gemtk_wm_redraw_f func) +{ + win->toolbar_redraw_func = func; +} + +/** +* Attach an arbitary pointer to the GUIWIN +*/ +void gemtk_wm_set_user_data(GUIWIN *win, void *data) +{ + win->user_data = data; +} + +/** +* Retrieve the user_data pointer attached to the GUIWIN. +*/ +void *gemtk_wm_get_user_data(GUIWIN *win) +{ + return(win->user_data); +} + +/** Get the scroll management structure for a GUIWIN +*/ +struct gemtk_wm_scroll_info_s *gemtk_wm_get_scroll_info(GUIWIN *win) { + return(&win->scroll_info); +} + +/** +* Get the amount of content dimensions within the window +* which is calculated by using the scroll_info attached to the GUIWIN. +*/ +void gemtk_wm_set_scroll_grid(GUIWIN * win, short x, short y) +{ + struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(win); + + assert(slid != NULL); + + slid->y_unit_px = x; + slid->x_unit_px = y; +} + + +/** Set the size of the content measured in content units +* \param win the GUIWIN +* \param x horizontal size +* \param y vertical size +*/ +void gemtk_wm_set_content_units(GUIWIN * win, short x, short y) +{ + struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(win); + + assert(slid != NULL); + + slid->x_units = x; + slid->y_units = y; +} + +/** Send an Message to a GUIWIN using AES message pipe +* \param win the GUIWIN which shall receive the message +* \param msg_type the WM_ message definition +* \param a the 4th parameter to appl_write +* \param b the 5th parameter to appl_write +* \param c the 6th parameter to appl_write +* \param d the 7th parameter to appl_write +*/ +void gemtk_wm_send_msg(GUIWIN *win, short msg_type, short a, short b, short c, + short d) +{ + short msg[8]; + + msg[0] = msg_type; + msg[1] = gl_apid; + msg[2] = 0; + msg[3] = win->handle; + msg[4] = a; + msg[5] = b; + msg[6] = c; + msg[7] = d; + + appl_write(gl_apid, 16, &msg); +} + +// TODO: rename, document and implement alternative (gemtk_wm_exec_event) +void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area) +{ + short msg[8], retval; + GRECT work; + + EVMULT_IN event_in = { + .emi_flags = MU_MESAG | MU_TIMER | MU_KEYBD | MU_BUTTON, + .emi_bclicks = 258, + .emi_bmask = 3, + .emi_bstate = 0, + .emi_m1leave = MO_ENTER, + .emi_m1 = {0,0,0,0}, + .emi_m2leave = 0, + .emi_m2 = {0,0,0,0}, + .emi_tlow = 0, + .emi_thigh = 0 + }; + EVMULT_OUT event_out; + + if (area == NULL) { + gemtk_wm_get_grect(win, GEMTK_WM_AREA_WORK, &work); + if (work.g_w < 1 || work.g_h < 1) { + if (win->toolbar != NULL) { + gemtk_wm_get_grect(win, GEMTK_WM_AREA_TOOLBAR, &work); + if (work.g_w < 1 || work.g_h < 1) { + return; + } + } + } + area = &work; + } + + msg[0] = WM_REDRAW; + msg[1] = gl_apid; + msg[2] = 0; + msg[3] = win->handle; + msg[4] = area->g_x; + msg[5] = area->g_y; + msg[6] = area->g_w; + msg[7] = area->g_h; + + event_out.emo_events = MU_MESAG; + retval = preproc_wm(win, &event_out, msg); + if (retval == 0 || (win->flags & GEMTK_WM_FLAG_PREPROC_WM) != 0){ + win->handler_func(win, &event_out, msg); + } + + + + //appl_write(gl_apid, 16, &msg); +} + +/** Attach an AES FORM to the GUIWIN, similar feature like the toolbar +*/ +void gemtk_wm_set_form(GUIWIN *win, OBJECT *tree, short index) +{ + DEBUG_PRINT(("Setting form %p (%d) for window %p\n", tree, index, win)); + win->form = tree; + win->form_edit_obj = -1; + win->form_focus_obj = -1; + win->form_idx = index; +} + +/** Checks if a GUIWIN is overlapped by other windows. +*/ +bool gemtk_wm_has_intersection(GUIWIN *win, GRECT *work) +{ + GRECT area, mywork; + bool retval = true; + + if (work == NULL) { + gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &mywork); + work = &mywork; + } + + wind_get_grect(win->handle, WF_FIRSTXYWH, &area); + while (area.g_w && area.g_w) { + //GRECT * ptr = &area; + if (RC_WITHIN(work, &area)) { + retval = false; + } + wind_get_grect(win->handle, WF_NEXTXYWH, &area); + } + + return(retval); +} + +/** Execute an toolbar redraw +* \param msg specifies the AES message which initiated the redraw, or 0 when +* the function was called without AES message context. +*/ +void gemtk_wm_toolbar_redraw(GUIWIN *gw, uint16_t msg, GRECT *clip) +{ + GRECT tb_area, tb_area_ro, g; + + gemtk_wm_get_grect(gw, GEMTK_WM_AREA_TOOLBAR, &tb_area_ro); + + if(clip == NULL) { + clip = &tb_area_ro; + } + + tb_area = tb_area_ro; + + if (rc_intersect(clip, &tb_area)) { + + if (gw->toolbar_redraw_func != NULL) { + + // customized redraw: + gw->toolbar_redraw_func(gw, msg, &tb_area); + + } else { + + // Default redraw action + + // Update object position: + gw->toolbar[gw->toolbar_idx].ob_x = tb_area_ro.g_x; + gw->toolbar[gw->toolbar_idx].ob_y = tb_area_ro.g_y; + gw->toolbar[gw->toolbar_idx].ob_width = tb_area_ro.g_w; + gw->toolbar[gw->toolbar_idx].ob_height = tb_area_ro.g_h; + + wind_get_grect(gw->handle, WF_FIRSTXYWH, &g); + while (g.g_h > 0 || g.g_w > 0) { + if(rc_intersect(&tb_area, &g)) { + objc_draw(gw->toolbar, gw->toolbar_idx, 8, g.g_x, g.g_y, + g.g_w, g.g_h); + + } + wind_get_grect(gw->handle, WF_NEXTXYWH, &g); + } + } + } +} + +/** Execute FORM redraw +*/ +void gemtk_wm_form_redraw(GUIWIN *gw, GRECT *clip) +{ + GRECT area, area_ro, g; + int scroll_px_x, scroll_px_y; + struct gemtk_wm_scroll_info_s *slid; + //int new_x, new_y, old_x, old_y; + short edit_idx; + + DEBUG_PRINT(("gemtk_wm_form_redraw\n")); + + // calculate form coordinates, include scrolling: + gemtk_wm_get_grect(gw, GEMTK_WM_AREA_CONTENT, &area_ro); + slid = gemtk_wm_get_scroll_info(gw); + + // Update form position: + gw->form[gw->form_idx].ob_x = area_ro.g_x - (slid->x_pos * slid->x_unit_px); + gw->form[gw->form_idx].ob_y = area_ro.g_y - (slid->y_pos * slid->y_unit_px); + + if(clip == NULL) { + clip = &area_ro; + } + + area = area_ro; + + /* Walk the AES rectangle list and redraw the visible areas of the window:*/ + if(rc_intersect(clip, &area)) { + + wind_get_grect(gw->handle, WF_FIRSTXYWH, &g); + while (g.g_h > 0 || g.g_w > 0) { + if(rc_intersect(&area, &g)) { + objc_draw(gw->form, gw->form_idx, 8, g.g_x, g.g_y, + g.g_w, g.g_h); + + } + wind_get_grect(gw->handle, WF_NEXTXYWH, &g); + } + } +} + + +/** Fill the content area with white color +*/ +void gemtk_wm_clear(GUIWIN *win) +{ + GRECT area, g; + short pxy[4]; + VdiHdl vh; + + vh = gemtk_wm_get_vdi_handle(win); + + if(win->state & GEMTK_WM_STATUS_ICONIFIED) { + // also clear the toolbar area when iconified: + gemtk_wm_get_grect(win, GEMTK_WM_AREA_WORK, &area); + } else { + gemtk_wm_get_grect(win, GEMTK_WM_AREA_CONTENT, &area); + } + + vsf_interior(vh, FIS_SOLID); + vsf_color(vh, 0); + vswr_mode(vh, MD_REPLACE); + wind_get_grect(win->handle, WF_FIRSTXYWH, &g); + while (g.g_h > 0 || g.g_w > 0) { + if(rc_intersect(&area, &g)) { + pxy[0] = g.g_x; + pxy[1] = g.g_y; + pxy[2] = g.g_x+g.g_w-1; + pxy[3] = g.g_y+g.g_h-1; + v_bar(vh, pxy); + } + wind_get_grect(win->handle, WF_NEXTXYWH, &g); + } +} diff --git a/atari/gemtk/guiwin.h b/atari/gemtk/guiwin.h new file mode 100644 index 000000000..6daf16ca9 --- /dev/null +++ b/atari/gemtk/guiwin.h @@ -0,0 +1,4 @@ +#ifndef OPKG_GUI_GUIWIN_H +#define OPKG_GUI_GUIWIN_ + +#endif /* OPKG_GUIWIN_H */ diff --git a/atari/msgbox.c b/atari/gemtk/msgbox.c index a9de5d299..150bcc7f5 100644 --- a/atari/msgbox.c +++ b/atari/gemtk/msgbox.c @@ -2,15 +2,15 @@ #include <stdlib.h> #include <string.h> #include <gem.h> -#include "atari/msgbox.h" +#include "gemtk.h" #ifndef min # define min(x,y) ((x<y) ? x : y ) #endif -short msg_box_show(short type, char * msg) +short gemtk_msg_box_show(short type, const char * msg) { - #define MSG_BOX_STR_SIZE 256 + #define GEMTK_MSG_BOX_STR_SIZE 256 short retval=0, i=0, z=0, l=0; char c; int len_msg = strlen(msg); @@ -19,13 +19,13 @@ short msg_box_show(short type, char * msg) const char *str_yes = "Yes"; const char *str_no = "No"; const char *str_ok = "OK"; - char msg_box_str[MSG_BOX_STR_SIZE]; + char msg_box_str[GEMTK_MSG_BOX_STR_SIZE]; char *dst = msg_box_str; - memset(msg_box_str, 0, MSG_BOX_STR_SIZE); + memset(msg_box_str, 0, GEMTK_MSG_BOX_STR_SIZE); - strncat(msg_box_str, "[1]", MSG_BOX_STR_SIZE); - strncat(msg_box_str, "[", MSG_BOX_STR_SIZE); + strncat(msg_box_str, "[1]", GEMTK_MSG_BOX_STR_SIZE); + strncat(msg_box_str, "[", GEMTK_MSG_BOX_STR_SIZE); dst = msg_box_str + strlen(msg_box_str); @@ -61,24 +61,24 @@ short msg_box_show(short type, char * msg) dst++; } } - strncat(msg_box_str, "][", MSG_BOX_STR_SIZE); + strncat(msg_box_str, "][", GEMTK_MSG_BOX_STR_SIZE); - if(type == MSG_BOX_CONFIRM){ - strncat(msg_box_str, str_yes, MSG_BOX_STR_SIZE); - strncat(msg_box_str, "|", MSG_BOX_STR_SIZE); - strncat(msg_box_str, str_no, MSG_BOX_STR_SIZE); + if(type == GEMTK_MSG_BOX_CONFIRM){ + strncat(msg_box_str, str_yes, GEMTK_MSG_BOX_STR_SIZE); + strncat(msg_box_str, "|", GEMTK_MSG_BOX_STR_SIZE); + strncat(msg_box_str, str_no, GEMTK_MSG_BOX_STR_SIZE); } else { - strncat(msg_box_str, str_ok, MSG_BOX_STR_SIZE); + strncat(msg_box_str, str_ok, GEMTK_MSG_BOX_STR_SIZE); } - strncat(msg_box_str, "]", MSG_BOX_STR_SIZE); + strncat(msg_box_str, "]", GEMTK_MSG_BOX_STR_SIZE); retval = form_alert(type, msg_box_str); - if(type == MSG_BOX_CONFIRM){ + if(type == GEMTK_MSG_BOX_CONFIRM){ if(retval != 1){ retval = 0; } } return(retval); - #undef MSG_BOX_STR_SIZE + #undef GEMTK_MSG_BOX_STR_SIZE } diff --git a/atari/gemtk/msgbox.h b/atari/gemtk/msgbox.h new file mode 100644 index 000000000..7a46900ef --- /dev/null +++ b/atari/gemtk/msgbox.h @@ -0,0 +1,5 @@ +#ifndef GUIMSG_H_INCLUDED
+#define GUIMSG_H_INCLUDED + +
+#endif // GUIMSG_H_INCLUDED
diff --git a/atari/gemtk/objc.c b/atari/gemtk/objc.c new file mode 100644 index 000000000..2a5eaae5b --- /dev/null +++ b/atari/gemtk/objc.c @@ -0,0 +1,368 @@ +/* + * 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/>. + * + * Module Description: + * + * AES Object tree tools. + * + */ + +#include <assert.h> +#include "gemtk.h" + +char *gemtk_obj_get_text(OBJECT * tree, short idx) +{ + static char p[]=""; + USERBLK *user; + char *retval; + + switch (tree[idx].ob_type & 0x00FF) { + case G_BUTTON: + case G_STRING: + case G_TITLE: + return( tree[idx].ob_spec.free_string); + case G_TEXT: + case G_BOXTEXT: + case G_FTEXT: + case G_FBOXTEXT: + return (tree[idx].ob_spec.tedinfo->te_ptext); + case G_ICON: + case G_CICON: + return (tree[idx].ob_spec.iconblk->ib_ptext); + break; + + default: + break; + } + return (p); +} + +static void set_text(OBJECT *obj, short idx, char * text, int len) +{ + char spare[255]; + + if( len > 254 ) + len = 254; + if( text != NULL ) { + strncpy(spare, text, 254); + } else { + strcpy(spare, ""); + } + + set_string(obj, idx, spare); +} + +char gemtk_obj_set_str_safe(OBJECT * tree, short idx, char *txt) +{ + char spare[204]; + short type = 0; + short maxlen = 0; + TEDINFO *ted; + + + type = (tree[idx].ob_type & 0xFF); + if (type == G_FTEXT || type == G_FBOXTEXT) { + TEDINFO *ted = ((TEDINFO *)get_obspec(tree, idx)); + maxlen = ted->te_txtlen+1; + if (maxlen > 200) { + maxlen = 200; + } else if (maxlen < 0) { + maxlen = 0; + } + } else { + assert((type == G_FTEXT) || (type == G_FBOXTEXT)); + } + + snprintf(spare, maxlen, "%s", txt); + set_string(tree, idx, spare); +} + +OBJECT *gemtk_obj_get_tree(int idx) +{ + + OBJECT *tree; + + rsrc_gaddr(R_TREE, idx, &tree); + + return tree; +} + +bool gemtk_obj_is_inside(OBJECT * tree, short obj, GRECT *area) +{ + GRECT obj_screen; + bool ret = false; + + objc_offset(tree, obj, &obj_screen.g_x, &obj_screen.g_y); + obj_screen.g_w = tree[obj].ob_width; + obj_screen.g_h = tree[obj].ob_height; + + ret = RC_WITHIN(&obj_screen, area); + + return(ret); +} + +GRECT * gemtk_obj_screen_rect(OBJECT * tree, short obj) +{ + static GRECT obj_screen; + + get_objframe(tree, obj, &obj_screen); + + return(&obj_screen); +} + + +void gemtk_obj_mouse_sprite(OBJECT *tree, int index) +{ + MFORM mform; + int dum; + + if ((tree[index].ob_type & 0xFF) != G_ICON) + return; + + dum = tree[index].ob_spec.iconblk->ib_char; + mform . mf_nplanes = 1; + mform . mf_fg = (dum>>8)&0x0F; + mform . mf_bg = dum>>12; + mform . mf_xhot = 0; /* to prevent the mform to "jump" on the */ + mform . mf_yhot = 0; /* screen (zebulon rules!) */ + + for( dum = 0; dum<16; dum ++) { + mform . mf_mask[dum] = tree[index].ob_spec.iconblk->ib_pmask[dum]; + mform . mf_data[dum] = tree[index].ob_spec.iconblk->ib_pdata[dum]; + } + graf_mouse(USER_DEF, &mform); +} + + +/* + * gemtk_obj_tree_copy + * + * Copy a complete object-tree including all substructures (optional). + * + * CAUTION: The object-tree *must* have the LASTOB-flag (0x20) set in + * it's physically last member. + * + * BUG: Up to now tree_copy won't copy the color-icon-structure, + * because I'm too lazy ;) Maybe I'll do that one day. If you need it + * urgently, contact me and force me to work... Btw, this doesn't mean + * that G_CICONs won't be copied at all, but the copied tree will + * share the CICONBLKs with the original. + * + * Input: + * tree: Pointer to tree which should be copied + * what: Specifies what substructures should be copied, too (see the + * C_xxx-definitions in tree-copy.h for details) + * + * Output: + * NULL: Tree couldn't be copied (due to lack of memory) + * otherwise: Pointer to copied tree, use free to dealloc it's memory + */ +OBJECT *gemtk_obj_tree_copy(OBJECT *tree) +{ + int16_t i, objects; + size_t to_malloc, size; + OBJECT *new_tree; + char *area; + + /* Calculate the number of bytes we need for the new tree */ + to_malloc = (size_t) 0; + for (i = 0;;) { + + /* Size of the OBJECT-structure itself */ + to_malloc += sizeof(OBJECT); + + switch (tree[i].ob_type & 0xff) { + case G_TEXT: + case G_BOXTEXT: + case G_FTEXT: + case G_FBOXTEXT: + /* Size of a TEDINFO-structure */ + to_malloc += sizeof(TEDINFO); + + /* Sizes of the strings in the TEDINFO-structure */ + to_malloc += (size_t)tree[i].ob_spec.tedinfo->te_txtlen; + to_malloc += (size_t)tree[i].ob_spec.tedinfo->te_txtlen; + to_malloc += (size_t)tree[i].ob_spec.tedinfo->te_tmplen; + break; + + case G_IMAGE: + + /* Size of the BITBLK-structure */ + to_malloc += sizeof(BITBLK); + + /* Size of the image-data in the BITBLK-structure */ + to_malloc += (size_t)((int32_t)tree[i].ob_spec.bitblk->bi_wb * + (int32_t)tree[i].ob_spec.bitblk->bi_hl); + + break; + + case G_USERDEF: + /* Size of the USERBLK-structure */ + to_malloc += sizeof(USERBLK); + break; + + case G_BUTTON: + case G_STRING: + case G_TITLE: + /* Size of the string (with one null character at the end) */ + to_malloc += strlen(tree[i].ob_spec.free_string) + 1L; + break; + + case G_ICON: + /* Size of the ICONBLK-structure */ + to_malloc += sizeof(BITBLK); + + /* Sizes of icon-data, icon-mask and icon-text */ + to_malloc += (size_t)((int32_t)tree[i].ob_spec.iconblk->ib_wicon * + (int32_t)tree[i].ob_spec.iconblk->ib_hicon / + 4L + 1L + + (int32_t)strlen(tree[i].ob_spec.iconblk->ib_ptext)); + + break; + } + + /* If the size is odd, make it even */ + if ((long)to_malloc & 1) + to_malloc++; + + /* Exit if we've reached the last object in the tree */ + if (tree[i].ob_flags & OF_LASTOB) + break; + + i++; + } + + objects = i + 1; + + /* If there's not enough memory left for the new tree, return NULL */ + if ((new_tree = (OBJECT *)calloc(1, to_malloc)) == NULL) { + return(NULL); + } + + /* + * area contains a pointer to the area where we copy the structures to + */ + area = (char *)((int32_t)new_tree+(int32_t)objects*(int32_t)sizeof(OBJECT)); + + for (i = 0; i < objects; i++) { + + /* Copy the contents of the OBJECT-structure */ + new_tree[i] = tree[i]; + + /* This was added to assure true copies of the object type */ + new_tree[i].ob_type = tree[i].ob_type; + + switch (tree[i].ob_type & 0xff) { + case G_TEXT: + case G_BOXTEXT: + case G_FTEXT: + case G_FBOXTEXT: + + /* Copy the contents of the TEDINFO-structure */ + *(TEDINFO *)area = *tree[i].ob_spec.tedinfo; + new_tree[i].ob_spec.tedinfo = (TEDINFO *)area; + area += sizeof(TEDINFO); + + /* Copy the strings in the TEDINFO-structure */ + strncpy(area, tree[i].ob_spec.tedinfo->te_ptext, + tree[i].ob_spec.tedinfo->te_txtlen); + new_tree[i].ob_spec.tedinfo->te_ptext = area; + area += tree[i].ob_spec.tedinfo->te_txtlen; + strncpy(area, tree[i].ob_spec.tedinfo->te_ptmplt, + tree[i].ob_spec.tedinfo->te_tmplen); + new_tree[i].ob_spec.tedinfo->te_ptmplt = area; + area += tree[i].ob_spec.tedinfo->te_tmplen; + strncpy(area, tree[i].ob_spec.tedinfo->te_pvalid, + tree[i].ob_spec.tedinfo->te_txtlen); + new_tree[i].ob_spec.tedinfo->te_pvalid = area; + area += tree[i].ob_spec.tedinfo->te_txtlen; + + break; + + case G_IMAGE: + + /* Copy the contents of the BITBLK-structure */ + *(BITBLK *)area = *tree[i].ob_spec.bitblk; + new_tree[i].ob_spec.bitblk = (BITBLK *)area; + area += sizeof(BITBLK); + + /* Copy the image-data */ + size = (size_t)((int32_t)tree[i].ob_spec.bitblk->bi_wb * + (int32_t)tree[i].ob_spec.bitblk->bi_hl); + memcpy(area, tree[i].ob_spec.bitblk->bi_pdata, size); + new_tree[i].ob_spec.bitblk->bi_pdata = (int16_t *)area; + area += size; + + break; + + case G_USERDEF: + + /* Copy the contents of the USERBLK-structure */ + *(USERBLK *)area = *tree[i].ob_spec.userblk; + new_tree[i].ob_spec.userblk = (USERBLK *)area; + area += sizeof(USERBLK); + + break; + + case G_BUTTON: + case G_STRING: + case G_TITLE: + + /* Copy the string */ + size = strlen(tree[i].ob_spec.free_string) + 1L; + strcpy(area, tree[i].ob_spec.free_string); + new_tree[i].ob_spec.free_string = area; + area += size; + + break; + + case G_ICON: + + /* Copy the contents of the ICONBLK-structure */ + *(ICONBLK *)area = *tree[i].ob_spec.iconblk; + new_tree[i].ob_spec.iconblk = (ICONBLK *)area; + area += sizeof(ICONBLK); + + size = (size_t)((int32_t)tree[i].ob_spec.iconblk->ib_wicon * + (int32_t)tree[i].ob_spec.iconblk->ib_hicon / + 8L); + /* Copy the mask-data */ + memcpy(area, tree[i].ob_spec.iconblk->ib_pmask, size); + new_tree[i].ob_spec.iconblk->ib_pmask = (int16_t *)area; + area += size; + + /* Copy the icon-data */ + memcpy(area, tree[i].ob_spec.iconblk->ib_pdata, size); + new_tree[i].ob_spec.iconblk->ib_pdata = (int16_t *)area; + area += size; + size = strlen(tree[i].ob_spec.iconblk->ib_ptext) + 1L; + + /* Copy the icon-string */ + strcpy(area, tree[i].ob_spec.iconblk->ib_ptext); + new_tree[i].ob_spec.iconblk->ib_ptext = area; + area += size; + + break; + } + + /* Assure that area contains an even address */ + if ((int32_t)area & 1) + area++; + } + + return(new_tree); +} diff --git a/atari/gemtk/objc.h b/atari/gemtk/objc.h new file mode 100644 index 000000000..6fa1072b7 --- /dev/null +++ b/atari/gemtk/objc.h @@ -0,0 +1,7 @@ +#ifndef GEMTK_OBJC_H +#define GEMTK_OBJC_H + + + +#endif // GEMTK_OBJC_H + diff --git a/atari/gemtk/redrawslots.c b/atari/gemtk/redrawslots.c new file mode 100644 index 000000000..ee5627daf --- /dev/null +++ b/atari/gemtk/redrawslots.c @@ -0,0 +1,123 @@ +/*
+ * Copyright 2011 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 <stdbool.h> +#define WITH_RECT +#include "gemtk.h" +#undef WITH_RECT + +void redraw_slots_init(struct s_redrw_slots * slots, short size) +{ + // TODO: allocate slots dynamically! + slots->size = MIN( MAX_REDRW_SLOTS , size); + slots->areas_used = 0; +} + +void redraw_slots_free(struct s_redrw_slots * slots) +{ + // TOOD: free areas... +} + + +static inline bool rect_intersect( struct rect * box1, struct rect * box2 )
+{
+ if (box2->x1 < box1->x0)
+ return false;
+
+ if (box2->y1 < box1->y0)
+ return false;
+
+ if (box2->x0 > box1->x1)
+ return false;
+
+ if (box2->y0 > box1->y1)
+ return false;
+
+ return true;
+} + + +void redraw_slot_schedule_grect(struct s_redrw_slots * slots, GRECT *area, + bool force) +{ + redraw_slot_schedule(slots, area->g_x, area->g_y, + area->g_x + area->g_w, area->g_y + area->g_h, force); +} + +/*
+ schedule redraw coords.
+*/
+void redraw_slot_schedule(struct s_redrw_slots * slots, short x0, short y0, + short x1, short y1, bool force)
+{
+ int i = 0;
+ struct rect area;
+
+ area.x0 = x0;
+ area.y0 = y0;
+ area.x1 = x1;
+ area.y1 = y1;
+ + if (force == false) {
+ for (i=0; i<slots->areas_used; i++) {
+ if (slots->areas[i].x0 <= x0
+ && slots->areas[i].x1 >= x1
+ && slots->areas[i].y0 <= y0
+ && slots->areas[i].y1 >= y1) {
+ /* the area is already queued for redraw */
+ return;
+ } else {
+ if (rect_intersect(&slots->areas[i], &area )) {
+ slots->areas[i].x0 = MIN(slots->areas[i].x0, x0);
+ slots->areas[i].y0 = MIN(slots->areas[i].y0, y0);
+ slots->areas[i].x1 = MAX(slots->areas[i].x1, x1);
+ slots->areas[i].y1 = MAX(slots->areas[i].y1, y1);
+ return;
+ }
+ }
+ } + }
+
+ if (slots->areas_used < slots->size) {
+ slots->areas[slots->areas_used].x0 = x0;
+ slots->areas[slots->areas_used].x1 = x1;
+ slots->areas[slots->areas_used].y0 = y0;
+ slots->areas[slots->areas_used].y1 = y1;
+ slots->areas_used++;
+ } else {
+ /*
+ we are out of available slots, merge box with last slot
+ this is dumb... but also a very rare case.
+ */
+ slots->areas[slots->size-1].x0 = MIN(slots->areas[i].x0, x0);
+ slots->areas[slots->size-1].y0 = MIN(slots->areas[i].y0, y0);
+ slots->areas[slots->size-1].x1 = MAX(slots->areas[i].x1, x1);
+ slots->areas[slots->size-1].y1 = MAX(slots->areas[i].y1, y1);
+ }
+done: + return;
+} + +void redraw_slots_remove_area(struct s_redrw_slots * slots, int i) +{ + int x; + for(x = i+1; i<slots->areas_used; x++){ + slots->areas[x-1] = slots->areas[x]; + } + slots->areas_used--; +} diff --git a/atari/gemtk/redrawslots.h b/atari/gemtk/redrawslots.h new file mode 100644 index 000000000..d045b3965 --- /dev/null +++ b/atari/gemtk/redrawslots.h @@ -0,0 +1,28 @@ +/*
+ * Copyright 2012 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 ATARI_REDRAW_SLOTS_H +#define ATARI_REDRAW_SLOTS_H + +#include <mt_gem.h> +#include "utils/types.h" + + + +#endif diff --git a/atari/gemtk/utils.c b/atari/gemtk/utils.c new file mode 100644 index 000000000..fae9d749b --- /dev/null +++ b/atari/gemtk/utils.c @@ -0,0 +1,80 @@ +#include <stdlib.h> +#include <stdint.h> +#include <stdbool.h> +#include <mt_gem.h> +#include "gemtk.h" + +/* -------------------------------------------------------------------------- */ +/* GEM Utillity functions: */ +/* -------------------------------------------------------------------------- */ + +unsigned short _systype_v; +unsigned short _systype (void) +{ + int32_t * cptr = NULL; + _systype_v = SYS_TOS; + + cptr = (int32_t *)Setexc(0x0168, -1L); + if (cptr == NULL ) { + return _systype_v; /* stone old TOS without any cookie support */ + } + while (*cptr) { + if (*cptr == C_MgMc || *cptr == C_MgMx ) { + _systype_v = (_systype_v & ~0xF) | SYS_MAGIC; + } else if (*cptr == C_MiNT ) { + _systype_v = (_systype_v & ~0xF) | SYS_MINT; + } else if (*cptr == C_Gnva /* Gnva */ ) { + _systype_v |= SYS_GENEVA; + } else if (*cptr == C_nAES /* nAES */ ) { + _systype_v |= SYS_NAES; + } + cptr += 2; + } + if (_systype_v & SYS_MINT) { /* check for XaAES */ + short out = 0, u; + if (wind_get (0, (((short)'X') <<8)|'A', &out, &u,&u,&u) && out) { + _systype_v |= SYS_XAAES; + } + } + return _systype_v; +} + +bool gemtk_rc_intersect_ro(GRECT *a, GRECT *b) +{ + GRECT r1, r2; + + r1 = *a; + r2 = *b; + + return((bool)rc_intersect(&r1, &r2)); +} + + +typedef struct { + char *unshift; + char *shift; + char *capslock; +} KEYTAB; + +int gemtk_keybd2ascii( int keybd, int shift) +{ + + KEYTAB *key; + key = (KEYTAB *)Keytbl( (char*)-1, (char*)-1, (char*)-1); + return (shift)?key->shift[keybd>>8]:key->unshift[keybd>>8]; +} + + +void gemtk_clip_grect(VdiHdl vh, GRECT *rect) +{ + PXY pxy[2]; + + pxy[0].p_x = rect->g_x; + pxy[0].p_y = rect->g_y; + pxy[1].p_x = pxy[0].p_x + rect->g_w - 1; + pxy[1].p_y = pxy[0].p_y + rect->g_h - 1; + + vs_clip_pxy(vh, pxy); +} + + diff --git a/atari/gemtk/utils.h b/atari/gemtk/utils.h new file mode 100644 index 000000000..7ebbcf228 --- /dev/null +++ b/atari/gemtk/utils.h @@ -0,0 +1,5 @@ +#ifndef UTILS_H_INCLUDED
+#define UTILS_H_INCLUDED
+
+
+#endif // UTILS_H_INCLUDED
diff --git a/atari/global_evnt.c b/atari/global_evnt.c deleted file mode 100755 index 3b15af877..000000000 --- a/atari/global_evnt.c +++ /dev/null @@ -1,677 +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 <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdbool.h>
-#include <assert.h>
-#include <windom.h>
-
-#include "desktop/gui.h"
-#include "desktop/netsurf.h"
-#include "desktop/browser.h"
-#include "desktop/browser_private.h" -#include "desktop/mouse.h"
-#include "desktop/textinput.h"
-#include "desktop/hotlist.h" -#include "desktop/save_complete.h" -#include "desktop/options.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/url.h" -
-#include "atari/gui.h"
-#include "atari/browser_win.h"
-#include "atari/toolbar.h"
-#include "atari/browser.h"
-#include "atari/hotlist.h" -#include "atari/history.h"
-#include "atari/misc.h"
-#include "atari/global_evnt.h"
-#include "atari/browser_win.h"
-#include "atari/res/netsurf.rsh"
-#include "atari/search.h"
-#include "atari/findfile.h" -#include "atari/settings.h"
-#include "cflib.h"
-
-extern struct gui_window *input_window;
-extern OBJECT * h_gem_menu;
-extern int mouse_click_time[3];
-extern int mouse_hold_start[3];
-extern browser_mouse_state bmstate;
-extern short last_drag_x;
-extern short last_drag_y; -extern bool html_redraw_debug; - -extern const char * option_homepage_url; -extern int option_window_width;
-extern int option_window_height; -extern int option_window_x; -extern int option_window_y; -extern char options[PATH_MAX];
-
-/* Zero based resource tree ids: */
-#define T_ABOUT 0
-#define T_FILE MAINMENU_T_FILE - MAINMENU_T_FILE + 1
-#define T_EDIT MAINMENU_T_EDIT - MAINMENU_T_FILE + 1
-#define T_VIEW MAINMENU_T_VIEW - MAINMENU_T_FILE + 1
-#define T_NAV MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1
-#define T_UTIL MAINMENU_T_UTIL - MAINMENU_T_FILE + 1
-#define T_HELP MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1
-/* Count of the above defines: */
-#define NUM_MENU_TITLES 7 - -/* Global event handlers: */
-static void __CDECL global_evnt_apterm( WINDOW * win, short buff[8] );
-static void __CDECL global_evnt_menu( WINDOW * win, short buff[8] ); -static void __CDECL global_evnt_m1( WINDOW * win, short buff[8] );
-static void __CDECL global_evnt_keybd( WINDOW * win, short buff[8],void * data);
-
-/* Menu event handlers: */
-static void __CDECL menu_about(WINDOW *win, int item, int title, void *data);
-
-
-/* Menu event handlers: */
-static void __CDECL menu_about(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- char buf[PATH_MAX];
- strcpy((char*)&buf, "file://");
- strncat((char*)&buf, (char*)"./doc/README.TXT", PATH_MAX - (strlen("file://")+1) );
- browser_window_create((char*)&buf, 0, 0, true, false);
-}
-
-static void __CDECL menu_new_win(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- browser_window_create(option_homepage_url, 0, 0, true, false);
-}
-
-static void __CDECL menu_open_url(WINDOW *win, int item, int title, void *data)
-{
- struct gui_window * gw;
- struct browser_window * bw ;
- LOG(("%s", __FUNCTION__)); -
- gw = input_window;
- if( gw == NULL ) {
- bw = browser_window_create("", 0, 0, true, false);
- gw = bw->window; -
- } - /* Loose focus: */ - window_set_focus( gw, WIDGET_NONE, NULL ); - - /* trigger on-focus event (select all text): */ - window_set_focus( gw, URL_WIDGET, &gw->root->toolbar->url ); - - /* delete selection: */ - tb_url_input( gw, NK_DEL );
-}
-
-static void __CDECL menu_open_file(WINDOW *win, int item, int title, void *data)
-{ - struct gui_window * gw;
- struct browser_window * bw ;
-
- LOG(("%s", __FUNCTION__)); - - const char * filename = file_select( messages_get("OpenFile"), "" ); - if( filename != NULL ){ - char * url = local_file_to_url( filename ); - if( url ){ - bw = browser_window_create(url, NULL, NULL, true, false); - free( url ); - } - } -}
-
-static void __CDECL menu_close_win(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- if( input_window == NULL )
- return;
- gui_window_destroy( input_window );
-}
-
-static void __CDECL menu_save_page(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__)); - static bool init = true; - bool is_folder=false; - const char * path; - - if( !input_window ) - return; - - if( init ){ - init = false; - save_complete_init(); - } - - do { - // TODO: localize string - path = file_select("Select folder", ""); - if (path) - is_folder = is_dir(path); - } while( !is_folder && path != NULL ); - - if( path != NULL ){ - save_complete( input_window->browser->bw->current_content, path, NULL ); - } -
-}
-
-static void __CDECL menu_quit(WINDOW *win, int item, int title, void *data)
-{
- short buff[8];
- memset( &buff, 0, sizeof(short)*8 );
- LOG(("%s", __FUNCTION__));
- global_evnt_apterm( NULL, buff );
-}
-
-static void __CDECL menu_cut(WINDOW *win, int item, int title, void *data)
-{
- if( input_window != NULL )
- browser_window_key_press( input_window->browser->bw, KEY_CUT_SELECTION);
-}
-
-static void __CDECL menu_copy(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- if( input_window != NULL )
- browser_window_key_press( input_window->browser->bw, KEY_COPY_SELECTION);
-}
-
-static void __CDECL menu_paste(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- if( input_window != NULL )
- browser_window_key_press( input_window->browser->bw, KEY_PASTE);
-}
-
-static void __CDECL menu_find(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- if( input_window != NULL )
- open_browser_search( input_window );
-}
-
-static void __CDECL menu_choices(WINDOW *win, int item, int title, void *data)
-{ - static WINDOW * settings_dlg = NULL;
- LOG(("%s", __FUNCTION__)); - settings_dlg = open_settings();
-}
-
-static void __CDECL menu_stop(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- if( input_window == NULL )
- return;
- tb_stop_click( input_window );
-
-}
-
-static void __CDECL menu_reload(WINDOW *win, int item, int title, void *data)
-{
- if( input_window == NULL)
- return;
- tb_reload_click( input_window );
- LOG(("%s", __FUNCTION__));
-}
-
-static void __CDECL menu_toolbars(WINDOW *win, int item, int title, void *data)
-{ - static int state = 0;
- LOG(("%s", __FUNCTION__)); - if( input_window != null && input_window->root->toolbar != null ){ - state = !state; - tb_hide( input_window, state ); - }
-}
-
-static void __CDECL menu_savewin(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__)); - if (input_window && input_window->browser) { - GRECT rect; - wind_get_grect(input_window->root->handle->handle, WF_CURRXYWH, &rect);
- option_window_width = rect.g_w; - option_window_height = rect.g_h; - option_window_x = rect.g_x; - option_window_y = rect.g_y; - nsoption_set_int(window_width, rect.g_w); - nsoption_set_int(window_height, rect.g_h); - nsoption_set_int(window_x, rect.g_x); - nsoption_set_int(window_y, rect.g_y); - nsoption_write((const char*)&options); - } -
-}
-
-static void __CDECL menu_debug_render(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- html_redraw_debug = !html_redraw_debug;
- if( input_window != NULL ) {
- if ( input_window->browser != NULL && input_window->browser->bw != NULL) {
- LGRECT rect;
- browser_get_rect( input_window, BR_CONTENT, &rect );
- browser_window_reformat(input_window->browser->bw, false, - rect.g_w, rect.g_h ); - MenuIcheck(NULL, MAINMENU_M_DEBUG_RENDER, - (html_redraw_debug) ? 1 : 0 );
- }
- }
-} - -static void __CDECL menu_fg_images(WINDOW *win, int item, int title, void *data)
-{
- nsoption_set_bool(foreground_images, !nsoption_bool(foreground_images)); - MenuIcheck( NULL, MAINMENU_M_FG_IMAGES, (nsoption_bool(foreground_images)) ? 1 : 0);
-} - -static void __CDECL menu_bg_images(WINDOW *win, int item, int title, void *data)
-{
- nsoption_set_bool(background_images, !nsoption_bool(background_images)); - MenuIcheck( NULL, MAINMENU_M_BG_IMAGES, (nsoption_bool(background_images)) ? 1 : 0);
-} - -static void __CDECL menu_back(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- if( input_window == NULL )
- return;
- tb_back_click( input_window );
-}
-
-static void __CDECL menu_forward(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- if( input_window == NULL )
- return;
- tb_forward_click( input_window );
-}
-
-static void __CDECL menu_home(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- if( input_window == NULL )
- return;
- tb_home_click( input_window );
-}
-
-static void __CDECL menu_lhistory(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- if( input_window == NULL )
- return;
-}
-
-static void __CDECL menu_ghistory(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- global_history_open();
-}
-
-static void __CDECL menu_add_bookmark(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- if( input_window ) {
- if( input_window->browser->bw->current_content != NULL ){
- atari_hotlist_add_page(
- nsurl_access(hlcache_handle_get_url( input_window->browser->bw->current_content)),
- NULL
- );
- }
- }
-}
-
-static void __CDECL menu_bookmarks(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- hotlist_open();
-}
-
-static void __CDECL menu_vlog(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
- verbose_log = !verbose_log;
- MenuIcheck(NULL, MAINMENU_M_VLOG, (verbose_log) ? 1 : 0 );
-}
-
-static void __CDECL menu_help_content(WINDOW *win, int item, int title, void *data)
-{
- LOG(("%s", __FUNCTION__));
-}
-
-static struct s_menu_item_evnt menu_evnt_tbl[] =
-{
- {T_ABOUT,MAINMENU_M_ABOUT, menu_about, {0,0,0}, NULL },
- {T_FILE, MAINMENU_M_NEWWIN, menu_new_win, {0,0,0}, NULL},
- {T_FILE, MAINMENU_M_OPENURL, menu_open_url, {'G',0,K_CTRL}, NULL},
- {T_FILE, MAINMENU_M_OPENFILE, menu_open_file, {'O',0,K_CTRL}, NULL},
- {T_FILE, MAINMENU_M_CLOSEWIN, menu_close_win, {0,0,0}, NULL},
- {T_FILE, MAINMENU_M_SAVEPAGE, menu_save_page, {0,NK_F3,0}, NULL},
- {T_FILE, MAINMENU_M_QUIT, menu_quit, {'Q',0,K_CTRL}, NULL},
- {T_EDIT, MAINMENU_M_CUT, menu_cut, {'X',0,K_CTRL}, NULL},
- {T_EDIT, MAINMENU_M_COPY, menu_copy, {'C',0,K_CTRL}, NULL},
- {T_EDIT, MAINMENU_M_PASTE, menu_paste, {'V',0,K_CTRL}, NULL},
- {T_EDIT, MAINMENU_M_FIND, menu_find, {0,NK_F4,0}, NULL},
- {T_VIEW, MAINMENU_M_RELOAD, menu_reload, {0,NK_F5,0}, NULL},
- {T_VIEW, MAINMENU_M_TOOLBARS, menu_toolbars, {0,NK_F1,K_CTRL}, NULL},
- {T_VIEW, MAINMENU_M_SAVEWIN, menu_savewin, {0,0,0}, NULL},
- {T_VIEW, MAINMENU_M_DEBUG_RENDER, menu_debug_render, {0,0,0}, NULL}, - {T_VIEW, MAINMENU_M_FG_IMAGES, menu_fg_images, {0,0,0}, NULL}, - {T_VIEW, MAINMENU_M_BG_IMAGES, menu_bg_images, {0,0,0}, NULL},
- {T_VIEW, MAINMENU_M_STOP, menu_stop, {0,NK_ESC,K_ALT}, NULL},
- {T_NAV, MAINMENU_M_BACK, menu_back, {0,NK_LEFT,K_ALT}, NULL},
- {T_NAV, MAINMENU_M_FORWARD, menu_forward, {0,NK_RIGHT,K_ALT}, NULL},
- {T_NAV, MAINMENU_M_HOME, menu_home, {0,NK_CLRHOME,0}, NULL},
- {T_UTIL, MAINMENU_M_LHISTORY,menu_lhistory, {0,NK_F7,0}, NULL},
- {T_UTIL, MAINMENU_M_GHISTORY, menu_ghistory, {0,NK_F7,K_CTRL}, NULL},
- {T_UTIL, MAINMENU_M_ADD_BOOKMARK, menu_add_bookmark, {'D',0,K_CTRL}, NULL},
- {T_UTIL, MAINMENU_M_BOOKMARKS, menu_bookmarks, {0,NK_F6,0}, NULL},
- {T_UTIL, MAINMENU_M_CHOICES, menu_choices, {0,0,0}, NULL},
- {T_UTIL, MAINMENU_M_VLOG, menu_vlog, {'V',0,K_ALT}, NULL},
- {T_HELP, MAINMENU_M_HELP_CONTENT, menu_help_content, {0,NK_F1,0}, NULL},
- {T_HELP, -1, NULL,{0,0,0}, NULL }
-};
-
-void __CDECL global_evnt_apterm( WINDOW * win, short buff[8] )
-{
- int i = 0;
- LOG((""));
- netsurf_quit = true;
-} - -
-static void __CDECL global_evnt_m1( WINDOW * win, short buff[8] )
-{
- struct gui_window * gw = input_window;
- static bool prev_url = false; - static short prev_x=0; - static short prev_y=0;
- bool within = false;
- LGRECT urlbox, bwbox, sbbox; - int nx, ny; -
- if( gw == NULL)
- return; - - if( prev_x == evnt.mx && prev_y == evnt.my ){ - return; - } - - short ghandle = wind_find( evnt.mx, evnt.my ); - if( input_window->root->handle->handle == ghandle ){ - - // The window found at x,y is an gui_window - // and it's the input window. -
- browser_get_rect( gw, BR_CONTENT, &bwbox );
-
- if( evnt.mx > bwbox.g_x && evnt.mx < bwbox.g_x + bwbox.g_w &&
- evnt.my > bwbox.g_y && evnt.my < bwbox.g_y + bwbox.g_h ){
- within = true; - browser_window_mouse_track(
- input_window->browser->bw,
- 0,
- evnt.mx - bwbox.g_x + gw->browser->scroll.current.x,
- evnt.my - bwbox.g_y + gw->browser->scroll.current.y
- );
- } - - if( gw->root->toolbar && within == false ) { - mt_CompGetLGrect(&app, gw->root->toolbar->url.comp, WF_WORKXYWH, &urlbox);
- if( (evnt.mx > urlbox.g_x && evnt.mx < urlbox.g_x + urlbox.g_w ) &&
- (evnt.my > urlbox.g_y && evnt.my < + urlbox.g_y + urlbox.g_h )) {
- gem_set_cursor( &gem_cursors.ibeam );
- prev_url = true;
- } else { - if( prev_url ) {
- gem_set_cursor( &gem_cursors.arrow );
- prev_url = false;
- } - }
- } - } else { - gem_set_cursor( &gem_cursors.arrow ); - prev_url = false; - } - - prev_x = evnt.mx; - prev_y = evnt.my;
-}
-
-void __CDECL global_evnt_keybd( WINDOW * win, short buff[8], void * data)
-{
- char sascii;
- long kstate = 0;
- long kcode = 0;
- unsigned short nkc = 0;
- unsigned short nks = 0;
-
- int i=0;
- bool done = false;
- struct gui_window * gw = input_window;
- struct gui_window * gw_tmp;
- if( gw == NULL )
- return;
- kstate = evnt.mkstate;
- kcode = evnt.keybd;
- nkc= gem_to_norm( (short)kstate, (short)kcode );
- nks = (nkc & 0xFF00);
- if( kstate & (K_LSHIFT|K_RSHIFT))
- kstate |= K_LSHIFT|K_RSHIFT;
- if( window_url_widget_has_focus( gw ) ) {
- /* make sure we report for the root window and report...: */ - done = tb_url_input( gw, nkc ); - } else {
- gw_tmp = window_list;
- /* search for active browser component: */
- while( gw_tmp != NULL && done == false ) {
- /* todo: only handle when input_window == ontop */
- if( window_widget_has_focus( (struct gui_window *)input_window,
- BROWSER,(void*)gw_tmp->browser)) {
- done = browser_input( gw_tmp, nkc );
- break;
- } else {
- gw_tmp = gw_tmp->next;
- }
- }
- }
- sascii = keybd2ascii( evnt.keybd, K_LSHIFT);
- while( menu_evnt_tbl[i].rid != -1 && done == false) {
- if( kstate == menu_evnt_tbl[i].accel.mod && menu_evnt_tbl[i].accel.ascii != 0) {
- if( menu_evnt_tbl[i].accel.ascii == sascii) {
- menu_evnt_tbl[i].menu_func( NULL, menu_evnt_tbl[i].rid, MAINMENU, buff);
- done = true;
- break;
- }
- } else {
- /* the accel code hides in the keycode: */
- if( menu_evnt_tbl[i].accel.keycode != 0) {
- if( menu_evnt_tbl[i].accel.keycode == (nkc & 0xFF) &&
- kstate == menu_evnt_tbl[i].accel.mod &&
- menu_evnt_tbl[i].menu_func != NULL) {
- menu_evnt_tbl[i].menu_func( NULL,
- menu_evnt_tbl[i].rid,
- MAINMENU, buff
- );
- done = true;
- break;
- }
- }
- }
- i++;
- }
-}
- -/* - Parse encoded menu key shortcut - - The format is: - - "[" - marks start of the shortcut - "@,^,<" - If the keyshortcut is only valid - with modifier keys, one of these characters must directly - follow the start mark. - Meaning: - @ -> Alternate - ^ -> Control - "#" - keycode or ascii character. - The value is handled as keycode if the character value - is <= 28 ( Atari chracter table ) - or if it is interpreted as function key string. - (strings: F1 - F10) - -*/ -static void register_menu_str( struct s_menu_item_evnt * mi ) -{ - char * str = ObjcString( h_gem_menu, mi->rid, NULL ); - int l = strlen(str); - int i = l; - int x = -1; - struct s_accelerator * accel = &mi->accel; - - - - while( i>2 ){ - if( str[i] == '['){ - x = i; - break; - } - i--; - } - if( x > -1 ){ - mi->menustr = malloc( l+1 ); - strcpy(mi->menustr, str ); - mi->menustr[x]=' '; - x++; - if( str[x] == '@' ){ - accel->mod = K_ALT; - mi->menustr[x] = 0x07; - x++; - } - else if( str[x] == '^' ) { - accel->mod = K_CTRL; - x++; - } - if( str[x] <= 28 ){ - // parse symbol - unsigned short keycode=0; - switch( str[x] ){ - case 0x03: - accel->keycode = NK_RIGHT; - break; - case 0x04: - accel->keycode = NK_LEFT; - break; - case 0x1B: - accel->keycode = NK_ESC; - break; - default: - break; - } - } else { - if(str[x] == 'F' && ( str[x+1] >= '1' && str[x+1] <= '9') ){ - // parse function key - short fkey = atoi( &str[x+1] ); - if( (fkey >= 0) && (fkey <= 10) ){ - accel->keycode = NK_F1 - 1 + fkey; - } - } else { - accel->ascii = str[x]; - } - } - } -}
-
-
-void __CDECL global_evnt_menu( WINDOW * win, short buff[8] )
-{
- int title = buff[ 3];
- INT16 x,y;
- char *str;
- struct gui_window * gw = window_list;
- int i=0;
- MenuTnormal( NULL, title, 1);
- while( gw ) {
- window_set_focus( gw, WIDGET_NONE, NULL );
- gw = gw->next;
- }
- while( menu_evnt_tbl[i].rid != -1) {
- if( menu_evnt_tbl[i].rid == buff[4] ) {
- menu_evnt_tbl[i].menu_func(win, (int)buff[4], (int)buff[3], NULL );
- break;
- }
- i++;
- }
-}
-
-void main_menu_update( void ) -{ - MenuIcheck( NULL, MAINMENU_M_DEBUG_RENDER, (html_redraw_debug) ? 1 : 0); - MenuIcheck( NULL, MAINMENU_M_FG_IMAGES, (nsoption_bool(foreground_images)) ? 1 : 0); - MenuIcheck( NULL, MAINMENU_M_BG_IMAGES, (nsoption_bool(background_images)) ? 1 : 0); -}
-
-
-/* Bind global and menu events to event handler functions, create accelerators */
-void bind_global_events( void )
-{
- int i, len;
- int maxlen[NUM_MENU_TITLES]={0};
- char * m, *u, *t;
- char spare[128];
- memset( (void*)&evnt_data, 0, sizeof(struct s_evnt_data) );
- EvntDataAttach( NULL, WM_XKEYBD, global_evnt_keybd, (void*)&evnt_data );
- EvntAttach( NULL, AP_TERM, global_evnt_apterm );
- EvntAttach( NULL, MN_SELECTED, global_evnt_menu ); - EvntAttach( NULL, WM_XM1, global_evnt_m1 );
- - /* parse and update menu items: */
- i = 0;
- while( menu_evnt_tbl[i].rid != -1 ) { - char * str = ObjcString( h_gem_menu, menu_evnt_tbl[i].rid, NULL );
- register_menu_str( &menu_evnt_tbl[i] ); - if( menu_evnt_tbl[i].menustr != NULL ){ - MenuText( NULL, menu_evnt_tbl[i].rid, menu_evnt_tbl[i].menustr ); - }
- i++;
- } - main_menu_update();
-}
-
-void unbind_global_events( void )
-{
- int i;
- i=0;
- while(menu_evnt_tbl[i].rid != -1) {
- if( menu_evnt_tbl[i].menustr != NULL )
- free(menu_evnt_tbl[i].menustr);
- i++;
- }
-}
-
diff --git a/atari/global_evnt.h b/atari/global_evnt.h deleted file mode 100755 index 1e13264a2..000000000 --- a/atari/global_evnt.h +++ /dev/null @@ -1,62 +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_ATARI_GLOBAL_EVNT_H
-#define NS_ATARI_GLOBAL_EVNT_H
-
-struct s_keybd_evnt_data
-{
- char ascii;
-} keybd_evnt_data;
-
-struct s_evnt_data
-{
- bool ignore;
- union {
- struct s_keybd_evnt_data keybd;
- } u;
-};
-
-struct s_evnt_data evnt_data;
-
-struct s_accelerator
-{
- char ascii; /* either ascii or */
- long keycode; /* normalised keycode is valid */
- short mod; /* shift / ctrl etc */
-};
-
-typedef void __CDECL (*menu_evnt_func)(WINDOW * win, int item, int title, void * data);
-struct s_menu_item_evnt {
- short title; /* to which menu this item belongs */
- short rid; /* resource ID */
- menu_evnt_func menu_func; /* click handler */
- struct s_accelerator accel; /* accelerator info */
- char * menustr;
-};
-
-/*
- Global & Menu event handlers
-*/
-
-void bind_global_events( void );
-void unbind_global_events( void ); -void main_menu_update( void );
-
-
-#endif
diff --git a/atari/gui.c b/atari/gui.c index 8f5591307..a59caa8e5 100755..100644 --- a/atari/gui.c +++ b/atari/gui.c @@ -1,620 +1,678 @@ -/*
- * Copyright 2010 <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/>.
- */
-
- /*
- This File provides all the mandatory functions prefixed with gui_
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <time.h>
-#include <limits.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdbool.h>
-#include <windom.h>
-#include <hubbub/hubbub.h>
-
-#include "content/urldb.h"
-#include "content/fetch.h"
-#include "content/fetchers/resource.h"
-#include "css/utils.h"
-#include "desktop/gui.h"
-#include "desktop/history_core.h"
-#include "desktop/plotters.h"
-#include "desktop/netsurf.h"
-#include "desktop/401login.h"
-
-#include "desktop/options.h"
-#include "desktop/save_complete.h"
-#include "desktop/selection.h"
-#include "desktop/textinput.h"
-#include "desktop/browser.h"
-#include "desktop/browser_private.h"
-#include "desktop/mouse.h"
-#include "render/font.h"
-#include "utils/schedule.h"
-#include "utils/url.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-
-#include "atari/gui.h"
-#include "atari/misc.h"
-#include "atari/findfile.h"
-#include "atari/schedule.h"
-#include "atari/browser_win.h"
-#include "atari/browser.h"
-#include "atari/statusbar.h"
-#include "atari/toolbar.h"
-#include "atari/verify_ssl.h"
-#include "atari/hotlist.h"
-#include "atari/history.h"
-#include "atari/login.h"
-#include "atari/global_evnt.h"
-#include "atari/encoding.h"
-#include "atari/res/netsurf.rsh"
-#include "atari/plot/plot.h"
-#include "atari/clipboard.h"
-#include "atari/osspec.h"
-#include "atari/search.h"
-#include "cflib.h"
-
-#define TODO() (0)/*printf("%s Unimplemented!\n", __FUNCTION__)*/
- -struct gui_window *input_window = NULL;
-struct gui_window *window_list = NULL;
-void * h_gem_rsrc;
-OBJECT * h_gem_menu;
-OBJECT **rsc_trindex;
-short rsc_ntree;
-long next_poll;
-bool rendering = false;
-
-
-/* Comandline / Options: */
-int option_window_width;
-int option_window_height;
-int option_window_x;
-int option_window_y;
-
-/* Defaults to option_homepage_url, commandline options overwrites that value */
-const char * option_homepage_url;
-
-/* path to choices file: */
-char options[PATH_MAX];
-
-
-void gui_poll(bool active)
-{
- short winloc[4];
- // int timeout; /* timeout in milliseconds */
- int flags = MU_MESAG | MU_KEYBD | MU_BUTTON ;
- short mx, my, dummy;
-
- evnt.timer = schedule_run();
-
- if( active || rendering ) {
- if( clock() >= next_poll ) {
- evnt.timer = 0;
- flags |= MU_TIMER;
- EvntWindom( flags );
- next_poll = clock() + (CLOCKS_PER_SEC>>3);
- }
- } else {
- if (input_window != NULL) {
- wind_get( 0, WF_TOP, &winloc[0], &winloc[1], &winloc[2], &winloc[3]);
- if (winloc[1] == _AESapid) {
- /* only check for mouse move when netsurf is on top: */
- // move that into m1 event handler
- graf_mkstate( &mx, &my, &dummy, &dummy );
- flags |= MU_M1;
- evnt.m1_flag = MO_LEAVE;
- evnt.m1_w = evnt.m1_h = 1;
- evnt.m1_x = mx;
- evnt.m1_y = my;
- }
- }
- flags |= MU_TIMER;
- EvntWindom( flags );
- }
-
- struct gui_window * g;
- for( g = window_list; g != NULL; g=g->next ) {
- if( browser_redraw_required( g ) ){
- browser_redraw( g );
- }
- if( g->root->toolbar ){
- if(g->root->toolbar->url.redraw ){
- tb_url_redraw( g );
- }
- }
- }
- if( evnt.timer != 0 && !active ){
- /* this suits for stuff with lower priority */
- /* TBD: really be spare on redraws??? */
- hotlist_redraw();
- global_history_redraw();
- }
-}
-
-struct gui_window *
-gui_create_browser_window(struct browser_window *bw,
- struct browser_window *clone,
- bool new_tab)
-{
- struct gui_window *gw=NULL;
- LOG(( "gw: %p, BW: %p, clone %p, tab: %d\n" , gw, bw, clone,
- (int)new_tab
- ));
-
- gw = malloc( sizeof(struct gui_window) );
- if (gw == NULL)
- return NULL;
- memset( gw, 0, sizeof(struct gui_window) );
-
- LOG(("new window: %p, bw: %p\n", gw, bw));
- window_create(gw, bw, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE|WIDGET_SCROLL );
- if( gw->root->handle ) {
- GRECT pos = {
- option_window_x, option_window_y,
- option_window_width, option_window_height
- };
- window_open( gw , pos );
- /* Recalculate windows browser area now */
- browser_update_rects( gw );
- tb_update_buttons( gw, -1 );
- input_window = gw;
- /* TODO:... this line: placeholder to create a local history widget ... */
- }
-
- /* add the window to the window list: */
- if( window_list == NULL ) {
- window_list = gw;
- gw->next = NULL;
- gw->prev = NULL;
- } else {
- struct gui_window * tmp = window_list;
- while( tmp->next != NULL ) {
- tmp = tmp->next;
- }
- tmp->next = gw;
- gw->prev = tmp;
- gw->next = NULL;
- }
-
- return( gw );
-
-}
-
-void gui_window_destroy(struct gui_window *w)
-{
- if (w == NULL)
- return;
-
- LOG(("%s\n", __FUNCTION__ ));
-
- input_window = NULL;
-
- window_destroy( w );
-
- /* unlink the window: */
- if(w->prev != NULL ) {
- w->prev->next = w->next;
- } else {
- window_list = w->next;
- }
- if( w->next != NULL ) {
- w->next->prev = w->prev;
- }
- free(w);
- w = NULL;
-
- w = window_list;
- while( w != NULL ) {
- if( w->root ) {
- input_window = w;
- break;
- }
- w = w->next;
- }
-}
-
-void gui_window_get_dimensions(struct gui_window *w, int *width, int *height,
- bool scaled)
-{
- if (w == NULL)
- return;
- LGRECT rect;
- browser_get_rect( w, BR_CONTENT, &rect );
- *width = rect.g_w;
- *height = rect.g_h;
-}
-
-void gui_window_set_title(struct gui_window *gw, const char *title)
-{
- int l;
- char * conv;
-
- if (gw == NULL)
- return;
- if( gw->root ){
- l = strlen(title);
- if( utf8_to_local_encoding(title, l, &conv) == UTF8_CONVERT_OK ){
- strncpy(gw->root->title, conv, atari_sysinfo.aes_max_win_title_len);
- free( conv );
- } else {
- strncpy(gw->root->title, title, atari_sysinfo.aes_max_win_title_len);
- }
- gw->root->title[atari_sysinfo.aes_max_win_title_len] = 0;
- WindSetStr( gw->root->handle, WF_NAME, gw->root->title );
- }
-}
-
-/**
- * set the status bar message
- */
-void gui_window_set_status(struct gui_window *w, const char *text)
-{
- if (w == NULL || text == NULL )
- return;
- window_set_stauts( w , (char*)text );
-}
-
-void gui_window_redraw_window(struct gui_window *gw)
-{
- CMP_BROWSER b;
- LGRECT rect;
- if (gw == NULL)
- return;
- b = gw->browser;
- browser_get_rect( gw, BR_CONTENT, &rect );
- browser_schedule_redraw( gw, 0, 0, rect.g_w, rect.g_h );
-}
-
-void gui_window_update_box(struct gui_window *gw, const struct rect *rect)
-{
- CMP_BROWSER b;
- if (gw == NULL)
- return;
- b = gw->browser;
- int x0 = rect->x0 - b->scroll.current.x;
- int y0 = rect->y0 - b->scroll.current.y;
- int w,h;
- w = rect->x1 - rect->x0;
- h = rect->y1 - rect->y0;
- browser_schedule_redraw_rect( gw, x0, y0, w, h );
-}
-
-bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy)
-{
- if (w == NULL)
- return false;
- *sx = w->browser->scroll.current.x;
- *sy = w->browser->scroll.current.y;
- return( true );
-}
-
-void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
-{
- if ((w == NULL) ||
- (w->browser->bw == NULL) ||
- (w->browser->bw->current_content == NULL))
- return;
- if( sx != 0 ) {
- if( sx < 0 ) {
- browser_scroll(w, WA_LFLINE, abs(sx), true );
- } else {
- browser_scroll(w, WA_RTLINE, abs(sx), true );
- }
- }
-
- if( sy != 0 ) {
- if( sy < 0) {
- browser_scroll(w, WA_UPLINE, abs(sy), true );
- } else {
- browser_scroll(w, WA_DNLINE, abs(sy), true );
- }
- }
- return;
-
-}
-
-void gui_window_scroll_visible(struct gui_window *w, int x0, int y0, int x1, int y1)
-{
- LOG(("%s:(%p, %d, %d, %d, %d)", __func__, w, x0, y0, x1, y1));
- gui_window_set_scroll(w,x0,y0);
- browser_schedule_redraw_rect( w, 0, 0, x1-x0,y1-y0);
-}
-
-
-/* It seems this method is called when content size got adjusted,
- so that we can adjust scroll info. We also have to call it when tab
- change occurs.
-*/
-void gui_window_update_extent(struct gui_window *gw)
-{
- int oldx, oldy;
- oldx = gw->browser->scroll.current.x;
- oldy = gw->browser->scroll.current.y;
- if( gw->browser->bw->current_content != NULL ) {
- browser_set_content_size( gw,
- content_get_width(gw->browser->bw->current_content),
- content_get_height(gw->browser->bw->current_content)
- );
- }
-}
-
-
-void gui_clear_selection(struct gui_window *g)
-{
-
-}
-
-
-
-/**
- * set the pointer shape
- */
-void gui_window_set_pointer(struct gui_window *w, gui_pointer_shape shape)
-{
- if (w == NULL)
- return;
- switch (shape) {
- case GUI_POINTER_POINT: /* link */
- gem_set_cursor(&gem_cursors.hand);
- break;
-
- case GUI_POINTER_MENU:
- gem_set_cursor(&gem_cursors.menu);
- break;
-
- case GUI_POINTER_CARET: /* input */
- gem_set_cursor(&gem_cursors.ibeam);
- break;
-
- case GUI_POINTER_CROSS:
- gem_set_cursor(&gem_cursors.cross);
- break;
-
- case GUI_POINTER_MOVE:
- gem_set_cursor(&gem_cursors.sizeall);
- break;
-
- case GUI_POINTER_RIGHT:
- case GUI_POINTER_LEFT:
- gem_set_cursor(&gem_cursors.sizewe);
- break;
-
- case GUI_POINTER_UP:
- case GUI_POINTER_DOWN:
- gem_set_cursor(&gem_cursors.sizens);
- break;
-
- case GUI_POINTER_RU:
- case GUI_POINTER_LD:
- gem_set_cursor(&gem_cursors.sizenesw);
- break;
-
- case GUI_POINTER_RD:
- case GUI_POINTER_LU:
- gem_set_cursor(&gem_cursors.sizenwse);
- break;
-
- case GUI_POINTER_WAIT:
- gem_set_cursor(&gem_cursors.wait);
- break;
-
- case GUI_POINTER_PROGRESS:
- gem_set_cursor(&gem_cursors.appstarting);
- break;
-
- case GUI_POINTER_NO_DROP:
- gem_set_cursor(&gem_cursors.nodrop);
- break;
-
- case GUI_POINTER_NOT_ALLOWED:
- gem_set_cursor(&gem_cursors.deny);
- break;
-
- case GUI_POINTER_HELP:
- gem_set_cursor(&gem_cursors.help);
- break;
-
- default:
- gem_set_cursor(&gem_cursors.arrow);
- break;
- }
-}
-
-void gui_window_hide_pointer(struct gui_window *w)
-{
- TODO();
-}
-
-
-void gui_window_set_url(struct gui_window *w, const char *url)
-{
- if (w == NULL)
- return;
- tb_url_set(w, (char*)url );
-}
-
-static void throbber_advance( void * data )
-{
- LGRECT work;
- struct gui_window * gw = (struct gui_window *)data;
- if( gw->root == NULL )
- return;
- if( gw->root->toolbar == NULL )
- return;
- if( gw->root->toolbar->throbber.running == false )
- return;
- mt_CompGetLGrect(&app, gw->root->toolbar->throbber.comp,
- WF_WORKXYWH, &work);
- gw->root->toolbar->throbber.index++;
- if( gw->root->toolbar->throbber.index > gw->root->toolbar->throbber.max_index )
- gw->root->toolbar->throbber.index = THROBBER_MIN_INDEX;
- ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
- work.g_x, work.g_y, work.g_w, work.g_h );
- schedule(100, throbber_advance, gw );
-}
-
-void gui_window_start_throbber(struct gui_window *w)
-{
- LGRECT work;
- if (w == NULL)
- return;
- if( w->root->toolbar->throbber.running == true )
- return;
- mt_CompGetLGrect(&app, w->root->toolbar->throbber.comp,
- WF_WORKXYWH, &work);
- w->root->toolbar->throbber.running = true;
- w->root->toolbar->throbber.index = THROBBER_MIN_INDEX;
- schedule(100, throbber_advance, w );
- ApplWrite( _AESapid, WM_REDRAW, w->root->handle->handle,
- work.g_x, work.g_y, work.g_w, work.g_h );
-
- rendering = true;
-}
-
-void gui_window_stop_throbber(struct gui_window *w)
-{
- LGRECT work;
- if (w == NULL)
- return;
- if( w->root->toolbar->throbber.running == false )
- return;
-
- schedule_remove(throbber_advance, w);
-
- /* refresh toolbar buttons: */
- tb_update_buttons( w, -1 );
-
- /* redraw throbber: */
- mt_CompGetLGrect(&app, w->root->toolbar->throbber.comp,
- WF_WORKXYWH, &work);
- w->root->toolbar->throbber.running = false;
- ApplWrite( _AESapid, WM_REDRAW, w->root->handle->handle,
- work.g_x, work.g_y, work.g_w, work.g_h );
-
- rendering = false;
-}
-
-/* Place caret in window */
-void gui_window_place_caret(struct gui_window *w, int x, int y, int height)
-{
- if (w == NULL)
- return;
- if( w->browser->caret.current.g_w > 0 )
- gui_window_remove_caret( w );
- w->browser->caret.requested.g_x = x;
- w->browser->caret.requested.g_y = y;
- w->browser->caret.requested.g_w = 1;
- w->browser->caret.requested.g_h = height;
- w->browser->caret.redraw = true;
- return;
-}
-
-
-/**
- * clear window caret
- */
-void
-gui_window_remove_caret(struct gui_window *w)
-{
- if (w == NULL)
- return;
-
- if( w->browser->caret.background.fd_addr != NULL ){
- browser_restore_caret_background( w, NULL );
- w->browser->caret.requested.g_w = 0;
- w->browser->caret.current.g_w = 0;
- }
- return;
-}
-
-void
-gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
-{
- struct bitmap *bmp_icon;
-
- bmp_icon = (icon != NULL) ? content_get_bitmap(icon) : NULL;
-
- window_set_icon(g, bmp_icon);
-}
-
-void
-gui_window_set_search_ico(hlcache_handle *ico)
-{
- TODO();
-}
-
-void gui_window_new_content(struct gui_window *w)
-{
- w->browser->scroll.current.x = 0;
- w->browser->scroll.current.y = 0;
- w->browser->scroll.requested.x = 0;
- w->browser->scroll.requested.y = 0;
- w->browser->scroll.required = true;
- gui_window_redraw_window( w );
-}
-
-bool gui_window_scroll_start(struct gui_window *w)
-{
- TODO();
- return true;
-}
-
-bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
- const struct rect *rect)
-{
- TODO();
- return true;
-}
-
-void gui_window_save_link(struct gui_window *g, const char *url,
- const char *title)
-{
- LOG(("%s -> %s", title, url ));
- TODO();
-}
-
-void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
- struct gui_window *w)
-{
- LOG((""));
- TODO();
-}
-
-void gui_drag_save_selection(struct selection *s, struct gui_window *w)
-{
- LOG((""));
- TODO();
-}
-
-void gui_start_selection(struct gui_window *w)
-{
-
+/* + * Copyright 2010 <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/>. + */ + +/* + This File provides all the mandatory functions prefixed with gui_ +*/ + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <time.h> +#include <limits.h> +#include <unistd.h> +#include <string.h> +#include <stdbool.h> +#include <hubbub/hubbub.h> + +#include "content/urldb.h" +#include "content/fetch.h" +#include "content/fetchers/resource.h" +#include "css/utils.h" +#include "desktop/gui.h" +#include "desktop/history_core.h" +#include "desktop/plotters.h" +#include "desktop/netsurf.h" +#include "desktop/401login.h" + +#include "desktop/options.h" +#include "desktop/save_complete.h" +#include "desktop/selection.h" +#include "desktop/textinput.h" +#include "desktop/browser.h" +#include "desktop/browser_private.h" +#include "desktop/mouse.h" +#include "render/font.h" +#include "utils/schedule.h" +#include "utils/url.h" +#include "utils/log.h" +#include "utils/messages.h" +#include "utils/utils.h" + +#include "atari/gemtk/gemtk.h" +#include "atari/gui.h" +#include "atari/misc.h" +#include "atari/findfile.h" +#include "atari/schedule.h" +#include "atari/rootwin.h" +#include "atari/statusbar.h" +#include "atari/toolbar.h" +#include "atari/hotlist.h" +#include "atari/history.h" +#include "atari/login.h" +#include "atari/encoding.h" +#include "atari/res/netsurf.rsh" +#include "atari/plot/plot.h" +#include "atari/clipboard.h" +#include "atari/osspec.h" +#include "atari/search.h" +#include "atari/deskmenu.h" +#include "cflib.h" + +#define TODO() (0)/*printf("%s Unimplemented!\n", __FUNCTION__)*/ + +struct gui_window *input_window = NULL; +struct gui_window *window_list = NULL; +void * h_gem_rsrc; +long next_poll; +bool rendering = false; +GRECT desk_area; + + +/* Comandline / Options: */ +int option_window_width; +int option_window_height; +int option_window_x; +int option_window_y; + +/* Defaults to option_homepage_url, commandline options overwrites that value */ +const char * option_homepage_url; + +/* path to choices file: */ +char options[PATH_MAX]; + +EVMULT_IN aes_event_in = { + .emi_flags = MU_MESAG | MU_TIMER | MU_KEYBD | MU_BUTTON | MU_M1, + .emi_bclicks = 258, + .emi_bmask = 3, + .emi_bstate = 0, + .emi_m1leave = MO_ENTER, + .emi_m1 = {0,0,0,0}, + .emi_m2leave = 0, + .emi_m2 = {0,0,0,0}, + .emi_tlow = 0, + .emi_thigh = 0 +}; +EVMULT_OUT aes_event_out; +short aes_msg_out[8]; + + + +void gui_poll(bool active) +{ + + struct gui_window *tmp; + short mx, my, dummy; + unsigned short nkc = 0; + + aes_event_in.emi_tlow = schedule_run(); + + if(active || rendering) + aes_event_in.emi_tlow = 0; + + if(aes_event_in.emi_tlow < 0) { + aes_event_in.emi_tlow = 10000; + printf("long poll!\n"); + } + + struct gui_window * g; + + if( !active ) { + if(input_window && input_window->root->redraw_slots.areas_used > 0) { + window_process_redraws(input_window->root); + } + } + + graf_mkstate(&mx, &my, &dummy, &dummy); + aes_event_in.emi_m1.g_x = mx; + aes_event_in.emi_m1.g_y = my; + evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out); + if(!gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out)) { + if( (aes_event_out.emo_events & MU_MESAG) != 0 ) { + LOG(("WM: %d\n", aes_msg_out[0])); + switch(aes_msg_out[0]) { + + case MN_SELECTED: + LOG(("Menu Item: %d\n",aes_msg_out[4])); + deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]); + break; + default: + break; + } + } + if((aes_event_out.emo_events & MU_KEYBD) != 0) { + uint16_t nkc = gem_to_norm( (short)aes_event_out.emo_kmeta, + (short)aes_event_out.emo_kreturn); + deskmenu_dispatch_keypress(aes_event_out.emo_kreturn, + aes_event_out.emo_kmeta, nkc); + } + } + + tmp = window_list; + while(tmp){ + if(tmp->root->redraw_slots.areas_used > 0){ + window_process_redraws(tmp->root); + } + tmp = tmp->next; + } + + if(hl.tv->redraw){ + atari_treeview_redraw(hl.tv); + } + + if(gl_history.tv->redraw){ + atari_treeview_redraw(gl_history.tv); + } +} + + +struct gui_window * +gui_create_browser_window(struct browser_window *bw, + struct browser_window *clone, + bool new_tab) { + struct gui_window *gw=NULL; + LOG(( "gw: %p, BW: %p, clone %p, tab: %d\n" , gw, bw, clone, + (int)new_tab + )); + + gw = calloc( sizeof(struct gui_window), 1); + if (gw == NULL) + return NULL; + + LOG(("new window: %p, bw: %p\n", gw, bw)); + window_create(gw, bw, clone, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE\ + |WIDGET_SCROLL); + if (gw->root->win) { + GRECT pos = { + option_window_x, option_window_y, + option_window_width, option_window_height + }; + gui_window_set_url(gw, ""); + gui_window_set_pointer(gw, BROWSER_POINTER_DEFAULT); + gui_set_input_gui_window(gw); + window_open(gw->root, gw, pos); + } + + /* add the window to the window list: */ + if( window_list == NULL ) { + window_list = gw; + gw->next = NULL; + gw->prev = NULL; + } else { + struct gui_window * tmp = window_list; + while( tmp->next != NULL ) { + tmp = tmp->next; + } + tmp->next = gw; + gw->prev = tmp; + gw->next = NULL; + } + + return( gw ); + +} + +void gui_window_destroy(struct gui_window *w) +{ + if (w == NULL) + return; + + LOG(("%s\n", __FUNCTION__ )); + + if (input_window == w) { + gui_set_input_gui_window(NULL); + } + + nsatari_search_session_destroy(w->search); + free(w->browser); + free(w->status); + free(w->title); + free(w->url); + + /* unlink the window: */ + if(w->prev != NULL ) { + w->prev->next = w->next; + } else { + window_list = w->next; + } + if( w->next != NULL ) { + w->next->prev = w->prev; + } + + window_unref_gui_window(w->root, w); + + free(w); + w = NULL; + + if(input_window == NULL) { + w = window_list; + while( w != NULL ) { + if(w->root) { + gui_set_input_gui_window(w); + break; + } + w = w->next; + } + } +} + +void gui_window_get_dimensions(struct gui_window *w, int *width, int *height, + bool scaled) +{ + if (w == NULL) + return; + GRECT rect; + window_get_grect(w->root, BROWSER_AREA_CONTENT, &rect); + *width = rect.g_w; + *height = rect.g_h; +} + +void gui_window_set_title(struct gui_window *gw, const char *title) +{ + + if (gw == NULL) + return; + + if (gw->root) { + + int l; + char * conv; + l = strlen(title)+1; + if (utf8_to_local_encoding(title, l-1, &conv) == UTF8_CONVERT_OK ) { + l = MIN((uint32_t)atari_sysinfo.aes_max_win_title_len, strlen(conv)); + if(gw->title == NULL) + gw->title = malloc(l); + else + gw->title = realloc(gw->title, l); + + strncpy(gw->title, conv, l); + free( conv ); + } else { + l = MIN((size_t)atari_sysinfo.aes_max_win_title_len, strlen(title)); + if(gw->title == NULL) + gw->title = malloc(l); + else + gw->title = realloc(gw->title, l); + strncpy(gw->title, title, l); + } + gw->title[l] = 0; + if(input_window == gw) + window_set_title(gw->root, gw->title); + } } /** + * set the status bar message + */ +void gui_window_set_status(struct gui_window *w, const char *text) +{ + int l; + if (w == NULL || text == NULL) + return; + + assert(w->root); + + l = strlen(text)+1; + if(w->status == NULL) + w->status = malloc(l); + else + w->status = realloc(w->status, l); + + strncpy(w->status, text, l); + w->status[l] = 0; + + if(input_window == w) + window_set_stauts(w->root, (char*)text); +} + +void gui_window_redraw_window(struct gui_window *gw) +{ + CMP_BROWSER b; + GRECT rect; + if (gw == NULL) + return; + b = gw->browser; + window_get_grect(gw->root, BROWSER_AREA_CONTENT, &rect); + window_schedule_redraw_grect(gw->root, &rect); +} + +void gui_window_update_box(struct gui_window *gw, const struct rect *rect) +{ + GRECT area; + struct gemtk_wm_scroll_info_s *slid; + + if (gw == NULL) + return; + + slid = gemtk_wm_get_scroll_info(gw->root->win); + + window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area); + area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px); + area.g_y += rect->y0 - (slid->y_pos * slid->y_unit_px); + area.g_w = rect->x1 - rect->x0; + area.g_h = rect->y1 - rect->y0; + //dbg_grect("update box", &area); + window_schedule_redraw_grect(gw->root, &area); +} + +bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy) +{ + int x,y; + if (w == NULL) + return false; + + window_get_scroll(w->root, sx, sy); + + return( true ); +} + +void gui_window_set_scroll(struct gui_window *w, int sx, int sy) +{ + int units = 0; + if ((w == NULL) + || (w->browser->bw == NULL) + || (w->browser->bw->current_content == NULL)) + return; + + LOG(("scroll (gui_window: %p) %d, %d\n", w, sx, sy)); + window_scroll_by(w->root, sx, sy); + return; + +} + +void gui_window_scroll_visible(struct gui_window *w, int x0, int y0, int x1, int y1) +{ + LOG(("%s:(%p, %d, %d, %d, %d)", __func__, w, x0, y0, x1, y1)); + gui_window_set_scroll(w,x0,y0); +} + + +/* It seems this method is called when content size got adjusted, + so that we can adjust scroll info. We also have to call it when tab + change occurs. +*/ +void gui_window_update_extent(struct gui_window *gw) +{ + + if( gw->browser->bw->current_content != NULL ) { + // TODO: store content size! + if(window_get_active_gui_window(gw->root) == gw) { + window_set_content_size( gw->root, + content_get_width(gw->browser->bw->current_content), + content_get_height(gw->browser->bw->current_content) + ); + window_update_back_forward(gw->root); + GRECT area; + window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area); + window_schedule_redraw_grect(gw->root, &area); + } + } +} + + +void gui_clear_selection(struct gui_window *g) +{ + +} + + + +/** + * set the pointer shape + */ +void gui_window_set_pointer(struct gui_window *gw, gui_pointer_shape shape) +{ + if (gw == NULL) + return; + + switch (shape) { + case GUI_POINTER_POINT: /* link */ + gw->cursor = &gem_cursors.hand; + break; + + case GUI_POINTER_MENU: + gw->cursor = &gem_cursors.menu; + break; + + case GUI_POINTER_CARET: /* input */ + gw->cursor = &gem_cursors.ibeam; + break; + + case GUI_POINTER_CROSS: + gw->cursor = &gem_cursors.cross; + break; + + case GUI_POINTER_MOVE: + gw->cursor = &gem_cursors.sizeall; + break; + + case GUI_POINTER_RIGHT: + case GUI_POINTER_LEFT: + gw->cursor = &gem_cursors.sizewe; + break; + + case GUI_POINTER_UP: + case GUI_POINTER_DOWN: + gw->cursor = &gem_cursors.sizens; + break; + + case GUI_POINTER_RU: + case GUI_POINTER_LD: + gw->cursor = &gem_cursors.sizenesw; + break; + + case GUI_POINTER_RD: + case GUI_POINTER_LU: + gw->cursor = &gem_cursors.sizenwse; + break; + + case GUI_POINTER_WAIT: + gw->cursor = &gem_cursors.wait; + break; + + case GUI_POINTER_PROGRESS: + gw->cursor = &gem_cursors.appstarting; + break; + + case GUI_POINTER_NO_DROP: + gw->cursor = &gem_cursors.nodrop; + break; + + case GUI_POINTER_NOT_ALLOWED: + gw->cursor = &gem_cursors.deny; + break; + + case GUI_POINTER_HELP: + gw->cursor = &gem_cursors.help; + break; + + default: + gw->cursor = &gem_cursors.arrow; + break; + } + + if (input_window == gw) { + gem_set_cursor(gw->cursor); + } +} + +void gui_window_hide_pointer(struct gui_window *w) +{ + TODO(); +} + + +void gui_window_set_url(struct gui_window *w, const char *url) +{ + int l; + + if (w == NULL) + return; + + l = strlen(url)+1; + + if (w->url == NULL) { + w->url = malloc(l); + } else { + w->url = realloc(w->url, l); + } + strncpy(w->url, url, l); + w->url[l] = 0; + if(input_window == w->root->active_gui_window) { + toolbar_set_url(w->root->toolbar, url); + } +} + +static void throbber_advance( void * data ) +{ + + struct gui_window * gw = (struct gui_window *)data; + + if (gw->root == NULL) + return; + if (gw->root->toolbar == NULL) + return; + + if (gw->root->toolbar->throbber.running == false) + return; + + toolbar_throbber_progress(gw->root->toolbar); + schedule(100, throbber_advance, gw ); +} + +void gui_window_start_throbber(struct gui_window *w) +{ + GRECT work; + if (w == NULL) + return; + + toolbar_set_throbber_state(w->root->toolbar, true); + schedule(100, throbber_advance, w ); + rendering = true; +} + +void gui_window_stop_throbber(struct gui_window *w) +{ + if (w == NULL) + return; + if (w->root->toolbar->throbber.running == false) + return; + + schedule_remove(throbber_advance, w); + + toolbar_set_throbber_state(w->root->toolbar, false); + + rendering = false; +} + +/* Place caret in window */ +void gui_window_place_caret(struct gui_window *w, int x, int y, int height) +{ + window_place_caret(w->root, 1, x, y, height, NULL); + w->root->caret.state |= CARET_STATE_ENABLED; + return; +} + + +/** + * clear window caret + */ +void +gui_window_remove_caret(struct gui_window *w) +{ + if (w == NULL) + return; + + if ((w->root->caret.state & CARET_STATE_ENABLED) != 0) { + //printf("gw hide caret\n"); + window_place_caret(w->root, 0, -1, -1, -1, NULL); + w->root->caret.state &= ~CARET_STATE_ENABLED; + } + return; +} + +void +gui_window_set_icon(struct gui_window *g, hlcache_handle *icon) +{ + struct bitmap *bmp_icon; + + bmp_icon = (icon != NULL) ? content_get_bitmap(icon) : NULL; + g->icon = bmp_icon; + if(input_window == g) { + window_set_icon(g->root, bmp_icon); + } +} + +void +gui_window_set_search_ico(hlcache_handle *ico) +{ + TODO(); +} + +void gui_window_new_content(struct gui_window *w) +{ + struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w->root->win); + slid->x_pos = 0; + slid->y_pos = 0; + gemtk_wm_update_slider(w->root->win, GEMTK_WM_VH_SLIDER); + gui_window_redraw_window(w); +} + +bool gui_window_scroll_start(struct gui_window *w) +{ + TODO(); + return true; +} + +bool gui_window_drag_start(struct gui_window *g, gui_drag_type type, + const struct rect *rect) +{ + TODO(); + return true; +} + +void gui_window_save_link(struct gui_window *g, const char *url, + const char *title) +{ + LOG(("%s -> %s", title, url )); + TODO(); +} + +void gui_drag_save_object(gui_save_type type, hlcache_handle *c, + struct gui_window *w) +{ + LOG(("")); + TODO(); +} + +void gui_drag_save_selection(struct selection *s, struct gui_window *w) +{ + LOG(("")); + TODO(); +} + +void gui_start_selection(struct gui_window *w) +{ + +} + + +/** * Core asks front end for clipboard contents. * * \param buffer UTF-8 text, allocated by front end, ownership yeilded to core @@ -622,37 +680,36 @@ void gui_start_selection(struct gui_window *w) */ void gui_get_clipboard(char **buffer, size_t *length) { - char *clip; - size_t clip_len; + char *clip; + size_t clip_len; - *length = 0; - *buffer = 0; + *length = 0; + *buffer = 0; - clip = scrap_txt_read(&app); + clip = scrap_txt_read(); - if(clip == NULL){ - return; - } else { + if(clip == NULL) { + return; + } else { - // clipboard is in atari encoding, convert it to utf8: + // clipboard is in atari encoding, convert it to utf8: - char *utf8 = NULL;
- utf8_convert_ret ret; + char *utf8 = NULL; + utf8_convert_ret ret; - clip_len = strlen(clip); - if (clip_len > 0) { - ret = utf8_to_local_encoding(clip, clip_len, &utf8); - if (ret == UTF8_CONVERT_OK && utf8 != NULL) {
- *buffer = utf8; - *length = strlen(utf8);
- } - else { - assert(ret == UTF8_CONVERT_OK && utf8 != NULL); - } - } -
- free(clip); - } + clip_len = strlen(clip); + if (clip_len > 0) { + ret = utf8_to_local_encoding(clip, clip_len, &utf8); + if (ret == UTF8_CONVERT_OK && utf8 != NULL) { + *buffer = utf8; + *length = strlen(utf8); + } else { + assert(ret == UTF8_CONVERT_OK && utf8 != NULL); + } + } + + free(clip); + } } /** @@ -664,327 +721,354 @@ void gui_get_clipboard(char **buffer, size_t *length) * \param n_styles Number of text run styles in array */ void gui_set_clipboard(const char *buffer, size_t length, - nsclipboard_styles styles[], int n_styles) + nsclipboard_styles styles[], int n_styles) { - if (length > 0 && buffer != NULL) { + if (length > 0 && buffer != NULL) { - // convert utf8 input to atari encoding: + // convert utf8 input to atari encoding: + + utf8_convert_ret ret; + char *clip = NULL; + + ret = utf8_to_local_encoding(buffer,length, &clip); + if (ret == UTF8_CONVERT_OK) { + scrap_txt_write(clip); + } else { + assert(ret == UTF8_CONVERT_OK); + } + free(clip); + } +} + + +void gui_create_form_select_menu(struct browser_window *bw, + struct form_control *control) +{ + TODO(); +} + +/** + * Broadcast an URL that we can't handle. + */ +void gui_launch_url(const char *url) +{ + TODO(); + LOG(("launch file: %s\n", url)); +} + +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) { + LOG(("url: %s, realm: %s, auth: %s\n", url, realm, out )); + urldb_set_auth_details(url, realm, out); + } + if (out != NULL) { + free( out ); + } + if (cb != NULL) { + cb(bres, cbpw); + } + +} + +void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, + unsigned long num, + nserror (*cb)(bool proceed, void *pw), void *cbpw) +{ + LOG(("")); + + bool bres; + + // TODO: localize string + int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort]"); + bres = (b==1)? true : false; + LOG(("Trust: %d", bres )); + urldb_set_cert_permissions(url, bres); + cb(bres, cbpw); +} + +void gui_set_input_gui_window(struct gui_window *gw) +{ + LOG(("Setting input window from: %p to %p\n", input_window, gw)); + input_window = gw; +} + +void gui_quit(void) +{ + LOG(("")); + + struct gui_window * gw = window_list; + struct gui_window * tmp = window_list; + + while( gw ) { + tmp = gw->next; + browser_window_destroy(gw->browser->bw); + gw = tmp; + } + + global_history_destroy(); + hotlist_destroy(); + toolbar_exit(); + + urldb_save_cookies(nsoption_charp(cookie_file)); + urldb_save(nsoption_charp(url_file)); + + deskmenu_destroy(); + gemtk_wm_exit(); + + rsrc_free(); + + LOG(("Shutting down plotter")); + plot_finalise(); + LOG(("done")); +} + + + + +static bool +process_cmdline(int argc, char** argv) +{ + int opt; + bool set_default_dimensions = true; + + LOG(("argc %d, argv %p", argc, argv)); + + if ((nsoption_int(window_width) != 0) && (nsoption_int(window_height) != 0)) { + + option_window_width = nsoption_int(window_width); + option_window_height = nsoption_int(window_height); + option_window_x = nsoption_int(window_x); + option_window_y = nsoption_int(window_y); + + if (option_window_width <= desk_area.g_w + && option_window_height < desk_area.g_h) { + set_default_dimensions = false; + } + } + + if (set_default_dimensions) { + if( sys_type() == SYS_TOS ) { + /* on single tasking OS, start as fulled window: */ + option_window_width = desk_area.g_w; + option_window_height = desk_area.g_h; + option_window_x = desk_area.g_w/2-(option_window_width/2); + option_window_y = (desk_area.g_h/2)-(option_window_height/2); + } else { + option_window_width = 600; + option_window_height = 360; + option_window_x = 10; + option_window_y = 30; + } + } + + if (nsoption_charp(homepage_url) != NULL) + option_homepage_url = nsoption_charp(homepage_url); + else + option_homepage_url = NETSURF_HOMEPAGE; + + while((opt = getopt(argc, argv, "w:h:")) != -1) { + switch (opt) { + case 'w': + option_window_width = atoi(optarg); + break; + + case 'h': + option_window_height = atoi(optarg); + break; + + default: + fprintf(stderr, + "Usage: %s [w,h,v] url\n", + argv[0]); + return false; + } + } + + if (optind < argc) { + option_homepage_url = argv[optind]; + } + return true; +} + +static inline void create_cursor(int flags, short mode, void * form, + MFORM_EX * m) +{ + m->flags = flags; + m->number = mode; + if( flags & MFORM_EX_FLAG_USERFORM ) { + m->number = mode; + m->tree = (OBJECT*)form; + } +} + +nsurl *gui_get_resource_url(const char *path) +{ + char buf[PATH_MAX]; + char *raw; + nsurl *url = NULL; + + atari_find_resource((char*)&buf, path, path); + raw = path_to_url((char*)&buf); + if (raw != NULL) { + nsurl_create(raw, &url); + free(raw); + } + + return url; +} + +/* Documented in desktop/options.h */ +void gui_options_init_defaults(void) +{ + /* Set defaults for absent option strings */ + nsoption_setnull_charp(cookie_file, strdup("cookies")); + if (nsoption_charp(cookie_file) == NULL) { + die("Failed initialising string options"); + } + + nsoption_set_int(min_reflow_period, 350); +} + +static void gui_init(int argc, char** argv) +{ + char buf[PATH_MAX]; + OBJECT * cursors; + + atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc"); + LOG(("%s ", (char*)&buf)); + if (rsrc_load(buf)==0) { + die("Uable to open GEM Resource file!"); + } + + wind_get_grect(0, WF_WORKXYWH, &desk_area); + + create_cursor(0, POINT_HAND, NULL, &gem_cursors.hand ); + create_cursor(0, TEXT_CRSR, NULL, &gem_cursors.ibeam ); + create_cursor(0, THIN_CROSS, NULL, &gem_cursors.cross); + create_cursor(0, BUSY_BEE, NULL, &gem_cursors.wait); + create_cursor(0, ARROW, NULL, &gem_cursors.arrow); + create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizeall); + create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenesw); + create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenwse); + cursors = gemtk_obj_get_tree(CURSOR); + create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_APPSTART, + cursors, &gem_cursors.appstarting); + gem_set_cursor( &gem_cursors.appstarting ); + create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZEWE, + cursors, &gem_cursors.sizewe); + create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZENS, + cursors, &gem_cursors.sizens); + create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_NODROP, + cursors, &gem_cursors.nodrop); + create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_DENY, + cursors, &gem_cursors.deny); + create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_MENU, + cursors, &gem_cursors.menu); + create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_HELP, + cursors, &gem_cursors.help); + + LOG(("Enabling core select menu")); + nsoption_set_bool(core_select_menu, true); + + LOG(("Loading url.db from: %s", nsoption_charp(url_file) )); + if( strlen(nsoption_charp(url_file)) ) { + urldb_load(nsoption_charp(url_file)); + } + + LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) )); + if( strlen(nsoption_charp(cookie_file)) ) { + urldb_load_cookies(nsoption_charp(cookie_file)); + } + + if (process_cmdline(argc,argv) != true) + die("unable to process command line.\n"); + + LOG(("Initializing NKC...")); + nkc_init(); + + + LOG(("Initializing plotters...")); + plot_init(nsoption_charp(atari_font_driver)); + + tree_set_icon_dir(nsoption_charp(tree_icons_path)); + + aes_event_in.emi_m1leave = MO_LEAVE; + aes_event_in.emi_m1.g_w = 1; + aes_event_in.emi_m1.g_h = 1; + //next_poll = clock() + (CLOCKS_PER_SEC>>3); +} + +static char *theapp = (char*)"NetSurf"; +static void gui_init2(int argc, char** argv) +{ + deskmenu_init(); + menu_register( -1, theapp); + if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) { + menu_register( _AESapid, (char*)" NetSurf "); + } + gemtk_wm_init(); + global_history_init(); + hotlist_init(); + toolbar_init(); +} + +/* #define WITH_DBG_LOGFILE 1 */ +/** Entry point from OS. + * + * /param argc The number of arguments in the string vector. + * /param argv The argument string vector. + * /return The return code to the OS + */ +int main(int argc, char** argv) +{ + char messages[PATH_MAX]; + + setbuf(stderr, NULL); + setbuf(stdout, NULL); +#ifdef WITH_DBG_LOGFILE + freopen("stdout.log", "a+", stdout); + freopen("stderr.log", "a+", stderr); +#endif + + graf_mouse(BUSY_BEE, NULL); + + init_app(NULL); + + init_os_info(); + + atari_find_resource((char*)&messages, "messages", "res/messages"); + atari_find_resource((char*)&options, "Choices", "Choices"); + + LOG(("Initialising core...")); + netsurf_init(&argc, &argv, options, messages); + + LOG(("Initializing GUI...")); + gui_init(argc, argv); + + LOG(("Initializing GUI2")); + gui_init2(argc, argv); + + graf_mouse( ARROW , NULL); + + LOG(("Creating initial browser window...")); + browser_window_create(option_homepage_url, 0, 0, true, false); + + LOG(("Entering NetSurf mainloop...")); + netsurf_main_loop(); + + netsurf_exit(); + LOG(("ApplExit")); +#ifdef WITH_DBG_LOGFILE + fclose(stdout); + fclose(stderr); +#endif + exit_gem(); + + return 0; +} - utf8_convert_ret ret; - char *clip = NULL; -
- ret = utf8_to_local_encoding(buffer,length, &clip);
- if (ret == UTF8_CONVERT_OK) { - scrap_txt_write(&app, clip); - } else { - assert(ret == UTF8_CONVERT_OK); - } - free(clip);
- } -} - - -
-void gui_create_form_select_menu(struct browser_window *bw,
- struct form_control *control)
-{
- TODO();
-}
-
-/**
- * Broadcast an URL that we can't handle.
- */
-void gui_launch_url(const char *url)
-{
- TODO();
- LOG(("launch file: %s\n", url));
-}
-
-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 ) {
- LOG(("url: %s, realm: %s, auth: %s\n", url, realm, out ));
- urldb_set_auth_details(url, realm, out );
- }
- if( out != NULL ){
- free( out );
- }
- if( cb != NULL )
- cb(bres, cbpw);
-}
-
-void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
- unsigned long num,
- nserror (*cb)(bool proceed, void *pw), void *cbpw)
-{
- LOG((""));
-
- bool bres;
- /*bres = verify_ssl_form_do(url, certs, num);
- if( bres )
- urldb_set_cert_permissions(url, true);
- */
- // TODO: localize string
- int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort]");
- bres = (b==1)? true : false;
- LOG(("Trust: %d", bres ));
- urldb_set_cert_permissions(url, bres);
- cb(bres, cbpw);
-}
-
-void gui_quit(void)
-{
- LOG((""));
-
- struct gui_window * gw = window_list;
- struct gui_window * tmp = window_list;
-
- while( gw ) {
- tmp = gw->next;
- browser_window_destroy(gw->browser->bw);
- gw = tmp;
- }
-
- global_history_destroy();
- hotlist_destroy();
- toolbar_exit();
-
- urldb_save_cookies(nsoption_charp(cookie_file));
- urldb_save(nsoption_charp(url_file));
-
- RsrcXtype( 0, rsc_trindex, rsc_ntree);
- unbind_global_events();
- MenuBar( h_gem_menu , 0 );
- if( h_gem_rsrc != NULL ) {
- RsrcXfree(h_gem_rsrc );
- }
- LOG(("Shutting down plotter"));
- plot_finalise();
- LOG(("done"));
-}
-
-
-
-
-static bool
-process_cmdline(int argc, char** argv)
-{
- int opt;
- bool set_default_dimensions = true;
-
- LOG(("argc %d, argv %p", argc, argv));
-
- if ((nsoption_int(window_width) != 0) && (nsoption_int(window_height) != 0)) {
-
- option_window_width = nsoption_int(window_width);
- option_window_height = nsoption_int(window_height);
- option_window_x = nsoption_int(window_x);
- option_window_y = nsoption_int(window_y);
-
- if (option_window_width <= app.w && option_window_height < app.h) {
- set_default_dimensions = false;
- }
- }
-
- if (set_default_dimensions) {
- if( sys_type() == SYS_TOS ){
- /* on single tasking OS, start as fulled window: */
- option_window_width = app.w;
- option_window_height = app.h-20;
- option_window_x = app.w/2-(option_window_width/2);
- option_window_y = (app.h/2)-(option_window_height/2);
- } else {
- option_window_width = 600;
- option_window_height = 360;
- option_window_x = 10;
- option_window_y = 30;
- }
- }
-
- if (nsoption_charp(homepage_url) != NULL)
- option_homepage_url = nsoption_charp(homepage_url);
- else
- option_homepage_url = NETSURF_HOMEPAGE;
-
- while((opt = getopt(argc, argv, "w:h:")) != -1) {
- switch (opt) {
- case 'w':
- option_window_width = atoi(optarg);
- break;
-
- case 'h':
- option_window_height = atoi(optarg);
- break;
-
- default:
- fprintf(stderr,
- "Usage: %s [w,h,v] url\n",
- argv[0]);
- return false;
- }
- }
-
- if (optind < argc) {
- option_homepage_url = argv[optind];
- }
- return true;
-}
-
-static inline void create_cursor(int flags, short mode, void * form, MFORM_EX * m)
-{
- m->flags = flags;
- m->number = mode;
- if( flags & MFORM_EX_FLAG_USERFORM ) {
- m->number = mode;
- m->tree = (OBJECT*)form;
- }
-}
-
-nsurl *gui_get_resource_url(const char *path)
-{
- char buf[PATH_MAX];
- char *raw;
- nsurl *url = NULL;
-
- atari_find_resource((char*)&buf, path, path);
- raw = path_to_url((char*)&buf);
- if (raw != NULL) {
- nsurl_create(raw, &url);
- free(raw);
- }
-
- return url;
-}
-
-/* Documented in desktop/options.h */
-void gui_options_init_defaults(void)
-{
- /* Set defaults for absent option strings */
- nsoption_setnull_charp(cookie_file, strdup("cookies"));
-
- if (nsoption_charp(cookie_file) == NULL) {
- die("Failed initialising string options");
- }
-}
-
-static void gui_init(int argc, char** argv)
-{
- char buf[PATH_MAX];
- OBJECT * cursors;
-
- atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc");
- LOG(("%s ", (char*)&buf));
- h_gem_rsrc = RsrcXload( (char*) &buf );
-
- if( !h_gem_rsrc )
- die("Uable to open GEM Resource file!");
- rsc_trindex = RsrcGhdr(h_gem_rsrc)->trindex;
- rsc_ntree = RsrcGhdr(h_gem_rsrc)->ntree;
-
- RsrcGaddr( h_gem_rsrc, R_TREE, MAINMENU , &h_gem_menu );
- RsrcXtype( RSRC_XTYPE, rsc_trindex, rsc_ntree);
-
- create_cursor(0, POINT_HAND, NULL, &gem_cursors.hand );
- create_cursor(0, TEXT_CRSR, NULL, &gem_cursors.ibeam );
- create_cursor(0, THIN_CROSS, NULL, &gem_cursors.cross);
- create_cursor(0, BUSY_BEE, NULL, &gem_cursors.wait);
- create_cursor(0, ARROW, NULL, &gem_cursors.arrow);
- create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizeall);
- create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenesw);
- create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenwse);
- RsrcGaddr( h_gem_rsrc, R_TREE, CURSOR , &cursors );
- create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_APPSTART,
- cursors, &gem_cursors.appstarting);
- gem_set_cursor( &gem_cursors.appstarting );
- create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZEWE,
- cursors, &gem_cursors.sizewe);
- create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZENS,
- cursors, &gem_cursors.sizens);
- create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_NODROP,
- cursors, &gem_cursors.nodrop);
- create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_DENY,
- cursors, &gem_cursors.deny);
- create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_MENU,
- cursors, &gem_cursors.menu);
- create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_HELP,
- cursors, &gem_cursors.help);
-
- LOG(("Enabling core select menu"));
- nsoption_set_bool(core_select_menu, true);
-
- LOG(("Loading url.db from: %s", nsoption_charp(url_file) ));
- if( strlen(nsoption_charp(url_file)) ){
- urldb_load(nsoption_charp(url_file));
- }
-
- LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) ));
- if( strlen(nsoption_charp(cookie_file)) ){
- urldb_load_cookies(nsoption_charp(cookie_file));
- }
-
- if (process_cmdline(argc,argv) != true)
- die("unable to process command line.\n");
-
- nkc_init();
- plot_init(nsoption_charp(atari_font_driver));
-}
-
-static char *theapp = (char*)"NetSurf";
-static void gui_init2(int argc, char** argv)
-{
- MenuBar( h_gem_menu , 1 );
- bind_global_events();
- menu_register( -1, theapp);
- if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) {
- menu_register( _AESapid, (char*)" NetSurf ");
- }
- tree_set_icon_dir( nsoption_charp(tree_icons_path) );
- global_history_init();
- hotlist_init();
- toolbar_init();
-}
-
-/* #define WITH_DBG_LOGFILE 1 */
-/** Entry point from OS.
- *
- * /param argc The number of arguments in the string vector.
- * /param argv The argument string vector.
- * /return The return code to the OS
- */
-int main(int argc, char** argv)
-{
- char messages[PATH_MAX];
-
- setbuf(stderr, NULL);
- setbuf(stdout, NULL);
-#ifdef WITH_DBG_LOGFILE
- freopen("stdout.log", "a+", stdout);
- freopen("stderr.log", "a+", stderr);
-#endif
- ApplInit();
- graf_mouse(BUSY_BEE, NULL);
- init_os_info();
- atari_find_resource((char*)&messages, "messages", "res/messages");
- atari_find_resource((char*)&options, "Choices", "Choices");
- netsurf_init(&argc, &argv, options, messages);
- gui_init(argc, argv);
- gui_init2(argc, argv);
- browser_window_create(option_homepage_url, 0, 0, true, false);
- graf_mouse( ARROW , NULL);
- netsurf_main_loop();
- netsurf_exit();
- LOG(("ApplExit"));
- ApplExit();
-#ifdef WITH_DBG_LOGFILE
- fclose(stdout);
- fclose(stderr);
-#endif
-
- return 0;
-}
-
-
diff --git a/atari/gui.h b/atari/gui.h index 76de07f37..fef686a57 100755 --- a/atari/gui.h +++ b/atari/gui.h @@ -19,7 +19,22 @@ #ifndef NS_ATARI_GUI_H_ #define NS_ATARI_GUI_H_ -#include <windom.h> +#include <stdbool.h> +#include <mt_gem.h> + +#include "atari/search.h" +#include "atari/redrawslots.h" +#include "atari/gemtk/gemtk.h" + +#define CARET_STATE_VISIBLE 0x01 +#define CARET_STATE_ENABLED 0x02 + +struct s_caret { + GRECT dimensions; + MFDB symbol; + int fd_size; + unsigned short state; +}; struct point_s { int x; @@ -60,6 +75,7 @@ struct s_gem_cursors { enum focus_element_type { WIDGET_NONE=0, URL_WIDGET, + SEARCH_INPUT, BROWSER }; @@ -96,17 +112,28 @@ typedef struct s_browser * CMP_BROWSER; */ struct s_gui_win_root { - WINDOW * handle; + short aes_handle; + GUIWIN *win; CMP_TOOLBAR toolbar; CMP_STATUSBAR statusbar; - COMPONENT * cmproot; - MFORM_EX cursor; struct s_focus_info focus; float scale; char * title; + struct bitmap * icon; + struct gui_window *active_gui_window; + struct s_redrw_slots redraw_slots; + struct s_caret caret; /* current size of window on screen: */ GRECT loc; }; +typedef struct s_gui_win_root ROOTWIN; + +struct s_browser
+{
+ struct browser_window * bw;
+ bool attached; + bool reformat_pending;
+}; /* This is the part of the gui which is known by netsurf core. @@ -117,11 +144,22 @@ struct s_gui_win_root struct gui_window { struct s_gui_win_root * root; CMP_BROWSER browser; + MFORM_EX *cursor; /* icon to be drawn when iconified, or NULL for default resource. */ + char * status; + char * title; + char * url; struct bitmap * icon; + struct s_caret caret; + struct s_search_form_session *search; struct gui_window *next, *prev; }; extern struct gui_window *window_list; +/* -------------------------------------------------------------------------- */ +/* Public - non standard gui window functions */ +/* -------------------------------------------------------------------------- */ +void gui_set_input_gui_window(struct gui_window *gw); + #endif diff --git a/atari/history.c b/atari/history.c index ad5deb2bd..aa32cbf7e 100755 --- a/atari/history.c +++ b/atari/history.c @@ -38,87 +38,107 @@ #include "atari/res/netsurf.rsh" #include "atari/history.h" + +//TODO: remove/add guiwin handle on close / open - so that the list +// is kept tiny. + extern char * tree_directory_icon_name; +extern GRECT desk_area; struct s_atari_global_history gl_history; void global_history_open( void ) { - GRECT pos = {app.w - (app.w/3), app.y, app.w/3, app.h/2}; - + global_history_init(); if (gl_history.init == false ) { - printf("history not init"); return; } if( gl_history.open == false ) { - WindOpen( gl_history.window, pos.g_x, pos.g_y, pos.g_w, pos.g_h); + + GRECT pos; + wind_get_grect(0, WF_WORKXYWH, &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; + + wind_open(gemtk_wm_get_handle(gl_history.window), pos.g_x, pos.g_y, + pos.g_w, pos.g_h); gl_history.open = true; - atari_treeview_open( gl_history.tv ); + atari_treeview_open(gl_history.tv); } else { - WindTop( gl_history.window ); + wind_set(gemtk_wm_get_handle(gl_history.window), WF_TOP, 1, 0, 0, 0); } } void global_history_close( void ) { - WindClose(gl_history.window); + wind_close(gemtk_wm_get_handle(gl_history.window)); gl_history.open = false; - atari_treeview_close( gl_history.tv ); + atari_treeview_close(gl_history.tv); } - -static void __CDECL evnt_history_close( WINDOW *win, short buff[8] ) +static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) { - global_history_close(); -} + NSTREEVIEW tv=NULL; + //printf("Hotlist event %d, open: %d\n", ev_out->emo_events, gl_history.open); -static void __CDECL evnt_history_mbutton( WINDOW *win, short buff[8] ) -{ - /* todo: implement popup? - if(evnt.mbut & 2) { + if(ev_out->emo_events & MU_MESAG){ + switch (msg[0]) { + + case WM_CLOSED: + global_history_close(); + break; + default: break; + } } - */ + + // TODO: implement selectable objects in toolbar API: + // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG ); } bool global_history_init( void ) { - if( gl_history.init == false ) { + if( gl_history.init == false ) { + + short handle; + GRECT desk; + int flags = ATARI_TREEVIEW_WIDGETS; - int flags = ATARI_TREEVIEW_WIDGETS; - gl_history.open = false; - gl_history.window = WindCreate( flags, 40, 40, app.w, app.h ); - if( gl_history.window == NULL ) { + gl_history.open = false; + handle = wind_create(flags, 40, 40, desk_area.g_w, desk_area.g_h); + gl_history.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL); + if( gl_history.window == NULL ) { LOG(("Failed to allocate history window")); return( false ); } - WindSetStr(gl_history.window, WF_NAME, messages_get("GlobalHistory")); - //WindSetPtr( gl_history.window, WF_TOOLBAR, tree, evnt_history_toolbar ); - EvntAttach( gl_history.window, WM_CLOSED, evnt_history_close ); - EvntAttach( gl_history.window, WM_XBUTTON,evnt_history_mbutton ); - - gl_history.tv = atari_treeview_create( - history_global_get_tree_flags(), - gl_history.window - ); - if (gl_history.tv == NULL) { - /* handle it properly, clean up previous allocs */ - LOG(("Failed to allocate history treeview")); - return( false ); - } + wind_set_str(handle, WF_NAME, (char*)messages_get("GlobalHistory")); - history_global_initialise( gl_history.tv->tree, "dir.png" ); - gl_history.init = true; - } + gl_history.tv = atari_treeview_create(history_global_get_tree_flags(), + gl_history.window, handle_event); + + gemtk_wm_unlink(gl_history.window); + + if (gl_history.tv == NULL) { + /* TODO: handle it properly, clean up previous allocs */ + LOG(("Failed to allocate history treeview")); + return( false ); + } + + history_global_initialise(gl_history.tv->tree, "dir.png"); + gl_history.init = true; + } return( true ); } void global_history_destroy( void ) { + if( gl_history.init == false ) { return; } @@ -126,12 +146,18 @@ void global_history_destroy( void ) history_global_cleanup(); if( gl_history.open ) global_history_close(); - WindDelete( gl_history.window ); + wind_delete(gemtk_wm_get_handle(gl_history.window)); + gemtk_wm_remove(gl_history.window); gl_history.window = NULL; - atari_treeview_destroy( gl_history.tv ); + atari_treeview_destroy(gl_history.tv); gl_history.init = false; } LOG(("done")); } +void global_history_redraw( void )
+{
+ atari_treeview_redraw( gl_history.tv );
+} + diff --git a/atari/history.h b/atari/history.h index bfea9ec1d..6185e2ac0 100755 --- a/atari/history.h +++ b/atari/history.h @@ -20,12 +20,12 @@ #define NS_ATARI_HISTORY_H #include <stdbool.h>
-#include <windom.h>
#include "desktop/tree.h"
#include "atari/treeview.h" +#include "atari/gemtk/gemtk.h" struct s_atari_global_history {
- WINDOW * window;
+ GUIWIN *window; /*< The GEMTK window ref */
NSTREEVIEW tv; /*< The history treeview handle. */
bool open;
bool init;
@@ -38,11 +38,8 @@ void global_history_destroy( void ); void global_history_open( void ); void global_history_close( void ); -inline void global_history_redraw( void ); -inline void global_history_redraw( void )
-{
- atari_treeview_redraw( gl_history.tv );
-} +void global_history_redraw( void ); + #endif diff --git a/atari/hotlist.c b/atari/hotlist.c index bdd10d922..3684a9a85 100755 --- a/atari/hotlist.c +++ b/atari/hotlist.c @@ -22,6 +22,7 @@ #include <stdio.h> #include <stdlib.h> #include <time.h> + #include "desktop/browser.h" #include "content/content.h" #include "content/hlcache.h" @@ -40,91 +41,115 @@ #include "atari/treeview.h" #include "atari/hotlist.h" #include "atari/findfile.h" +#include "atari/gemtk/gemtk.h" #include "atari/res/netsurf.rsh" +//TODO: remove/add guiwin handle on close / open - so that the list +// is kept tiny. + +extern GRECT desk_area; + struct atari_hotlist hl; -static void evnt_hl_toolbar( WINDOW *win, short buff[8]) { - /* handle toolbar object (index in buff[4] ) */ - switch( buff[4] ) { - case TOOLBAR_HOTLIST_CREATE_FOLDER: - hotlist_add_folder(true); - break; +static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) +{ + NSTREEVIEW tv=NULL; + GRECT tb_area; - case TOOLBAR_HOTLIST_ADD: - atari_hotlist_add_page("http://www.de", ""); - break; + if(ev_out->emo_events & MU_MESAG){ + switch (msg[0]) { - case TOOLBAR_HOTLIST_DELETE: - hotlist_delete_selected(); - break; + case WM_TOOLBAR: - case TOOLBAR_HOTLIST_EDIT: - hotlist_edit_selected(); - break; - } - ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG ); -} + tv = (NSTREEVIEW) gemtk_wm_get_user_data(win); + switch (msg[4]) { + case TOOLBAR_HOTLIST_CREATE_FOLDER: + hotlist_add_folder(true); + break; -static void __CDECL evnt_hl_close( WINDOW *win, short buff[8] ) -{ - hotlist_close(); -} + case TOOLBAR_HOTLIST_ADD: + atari_hotlist_add_page("http://www.de", ""); + break; + case TOOLBAR_HOTLIST_DELETE: + hotlist_delete_selected(); + gemtk_wm_send_redraw(tv->window, NULL); + break; -static void __CDECL evnt_hl_mbutton( WINDOW *win, short buff[8] ) -{ - /* todo: implement popup? - if(evnt.mbut & 2) { + case TOOLBAR_HOTLIST_EDIT: + hotlist_edit_selected(); + break; + } + + gemtk_obj_get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED; + gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, &tb_area); + evnt_timer(150); + gemtk_wm_send_redraw(tv->window, &tb_area); + break; + case WM_CLOSED: + hotlist_close(); + break; + + default: break; + } } - */ + + // TODO: implement selectable objects in toolbar API: + // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG ); } + void hotlist_init(void) { - if( strcmp(nsoption_charp(hotlist_file), "") == 0 ){ - atari_find_resource( (char*)&hl.path, "hotlist", "hotlist" ); - } else { - strncpy( (char*)&hl.path, nsoption_charp(hotlist_file), PATH_MAX-1 ); - } - - LOG(("Hotlist: %s", (char*)&hl.path )); - - if( hl.window == NULL ){ - int flags = ATARI_TREEVIEW_WIDGETS; - OBJECT * tree = get_tree(TOOLBAR_HOTLIST); - assert( tree ); - hl.open = false; - hl.window = WindCreate( flags, 40, 40, app.w, app.h ); - if( hl.window == NULL ) { - LOG(("Failed to allocate Hotlist")); - return; - } - WindSetStr( hl.window, WF_NAME, (char*)messages_get("Hotlist") ); - WindSetPtr( hl.window, WF_TOOLBAR, tree, evnt_hl_toolbar ); - EvntAttach( hl.window, WM_CLOSED, evnt_hl_close ); - EvntAttach( hl.window, WM_XBUTTON,evnt_hl_mbutton ); - hl.tv = atari_treeview_create( - hotlist_get_tree_flags(), - hl.window - ); - if (hl.tv == NULL) { - /* handle it properly, clean up previous allocs */ - LOG(("Failed to allocate treeview")); - return; + if (hl.init == false) { + if( strcmp(nsoption_charp(hotlist_file), "") == 0 ){ + atari_find_resource( (char*)&hl.path, "hotlist", "hotlist" ); + } else { + strncpy( (char*)&hl.path, nsoption_charp(hotlist_file), PATH_MAX-1 ); } - hotlist_initialise( - hl.tv->tree, - (char*)&hl.path, - "dir.png" - ); - - } else { + LOG(("Hotlist: %s", (char*)&hl.path )); + + if( hl.window == NULL ){ + int flags = ATARI_TREEVIEW_WIDGETS; + short handle = -1; + GRECT desk; + OBJECT * tree = gemtk_obj_get_tree(TOOLBAR_HOTLIST); + assert( tree ); + hl.open = false; + + handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h); + hl.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL); + if( hl.window == NULL ) { + LOG(("Failed to allocate Hotlist")); + return; + } + wind_set_str(handle, WF_NAME, (char*)messages_get("Hotlist")); + gemtk_wm_set_toolbar(hl.window, tree, 0, 0); + gemtk_wm_unlink(hl.window); + hl.tv = atari_treeview_create( + hotlist_get_tree_flags(), + hl.window, + handle_event + ); + if (hl.tv == NULL) { + /* handle it properly, clean up previous allocs */ + LOG(("Failed to allocate treeview")); + return; + } + + hotlist_initialise( + hl.tv->tree, + (char*)&hl.path, + "dir.png" + ); + + } else { + } } hl.init = true; } @@ -132,45 +157,59 @@ void hotlist_init(void) void hotlist_open(void) { - GRECT pos = {app.w - (app.w/3), app.y, app.w/3, app.h/2}; - + hotlist_init(); if( hl.init == false ) { return; } if( hl.open == false ) { - WindOpen( hl.window, pos.g_x, pos.g_y, pos.g_w, pos.g_h); + + 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; + + wind_open_grect(gemtk_wm_get_handle(hl.window), &pos); hl.open = true; atari_treeview_open( hl.tv ); } else { - WindTop( hl.window ); + wind_set(gemtk_wm_get_handle(hl.window), WF_TOP, 1, 0, 0, 0); } } void hotlist_close(void) { - WindClose(hl.window); + wind_close(gemtk_wm_get_handle(hl.window)); hl.open = false; - atari_treeview_close( hl.tv ); + atari_treeview_close(hl.tv); } void hotlist_destroy(void) { - if( hl.init == false ) { + + if( hl.init == false) { return; } if( hl.window != NULL ) { hotlist_cleanup( (char*)&hl.path ); - if( hl.open ) + if (hl.open) hotlist_close(); - WindDelete( hl.window ); + wind_delete(gemtk_wm_get_handle(hl.window)); + gemtk_wm_remove(hl.window); hl.window = NULL; - atari_treeview_destroy( hl.tv ); + atari_treeview_destroy(hl.tv); hl.init = false; } LOG(("done")); } +void hotlist_redraw(void) +{ + int i = 01; + atari_treeview_redraw(hl.tv); +} + struct node; void atari_hotlist_add_page( const char * url, const char * title ) @@ -181,6 +220,8 @@ void atari_hotlist_add_page( const char * url, const char * title ) NSTREEVIEW tv = hl.tv; if(hl.tv == NULL ) return; + // TODO: do no open hotlist, and remove guiwin on close... + hotlist_open(); if( hl.tv->click.x >= 0 && hl.tv->click.y >= 0 ){ hotlist_add_page_xy( url, hl.tv->click.x, hl.tv->click.y ); } else { diff --git a/atari/hotlist.h b/atari/hotlist.h index 70b4d8a70..9fbf38932 100755 --- a/atari/hotlist.h +++ b/atari/hotlist.h @@ -19,13 +19,13 @@ #ifndef NS_ATARI_HOTLIST_H
#define NS_ATARI_HOTLIST_H
#include <stdbool.h>
-#include <windom.h>
#include "desktop/tree.h"
+#include "atari/gemtk/gemtk.h" #include "atari/treeview.h"
/* The hotlist window, toolbar and treeview data. */
struct atari_hotlist {
- WINDOW * window;
+ GUIWIN * window;
NSTREEVIEW tv; /*< The hotlist treeview handle. */
bool open;
bool init;
@@ -40,10 +40,7 @@ void hotlist_close( void ); void hotlist_destroy( void );
void atari_hotlist_add_page( const char * url, const char * title );
-inline void hotlist_redraw( void );
-inline void hotlist_redraw( void )
-{
- atari_treeview_redraw( hl.tv );
-}
+void hotlist_redraw( void );
+
#endif diff --git a/atari/login.c b/atari/login.c index ddcfeba43..461a2f985 100755 --- a/atari/login.c +++ b/atari/login.c @@ -21,7 +21,7 @@ #include <stdlib.h> #include <string.h> #include <stdbool.h> -#include <windom.h> +#include <cflib.h> #include "utils/config.h" #include "content/content.h" #include "content/hlcache.h" @@ -36,77 +36,39 @@ #include "utils/url.h" #include "content/urldb.h" #include "content/fetch.h" +#include "atari/misc.h" #include "atari/login.h" #include "atari/res/netsurf.rsh" -extern void * h_gem_rsrc; - -bool login_form_do( nsurl * url, char * realm, char ** out ) +bool login_form_do(nsurl * url, char * realm, char ** out) { - OBJECT *tree, *newtree; - WINDOW * form; char user[255]; char pass[255]; - bool bres = false; - int res = 0; - const char * auth; - lwc_string * host = nsurl_get_component(url, NSURL_HOST); - assert(host != NULL); - - if( realm == NULL ){ - realm = (char*)"Secure Area"; - } + //const char * auth; + short exit_obj = 0; + OBJECT * tree; - int len = strlen(realm) + lwc_string_length(host) + 4; - char * title = malloc( len ); - strncpy(title, realm, len ); - strncpy(title, ": ", len-strlen(realm) ); - strncat(title, lwc_string_data(host), len-strlen(realm)+2 ); - - lwc_string_unref(host); - - auth = urldb_get_auth_details(url, realm); user[0] = 0; pass[0] = 0; - /* - TODO: use auth details if available: - if( auth == NULL ){ - } else { - - }*/ - - RsrcGaddr (h_gem_rsrc , R_TREE, LOGIN, &tree); - ObjcChange( OC_OBJC, tree, LOGIN_BT_LOGIN, 0, 0 ); - ObjcChange( OC_OBJC, tree, LOGIN_BT_ABORT, 0, 0 ); - ObjcString( tree, LOGIN_TB_USER, (char*)&user ); - ObjcString( tree, LOGIN_TB_PASSWORD, (char*)&pass ); - form = FormWindBegin( tree, (char *)title ); - res = -1; - while( res != LOGIN_BT_LOGIN && res != LOGIN_BT_ABORT ){ - res = FormWindDo( MU_MESAG ); - switch( res ){ - case LOGIN_BT_LOGIN: - bres = true; - break; + // TODO: use auth details for predefined login data + // auth = urldb_get_auth_details(url, realm); + tree = gemtk_obj_get_tree(LOGIN); - case LOGIN_BT_ABORT: - bres = false; - break; - } - } - - if( bres ) { - *out = malloc(strlen((char*)&user) + strlen((char*)&pass) + 2 ); - strcpy(*out, (char*)&user); - strcat(*out, ":"); - strcat(*out, (char*)&pass); + 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; } - - FormWindEnd( ); - free( title ); - return( bres ); + return((exit_obj == LOGIN_BT_LOGIN)); } + diff --git a/atari/misc.c b/atari/misc.c index 8b745fd2f..1b4c3eaf4 100755 --- a/atari/misc.c +++ b/atari/misc.c @@ -21,9 +21,9 @@ #include <stdio.h> #include <stdbool.h>
#include <string.h>
+ #include <sys/types.h>
-#include <mint/osbind.h>
-#include <windom.h> +#include <mint/osbind.h> #include "content/content.h" #include "content/hlcache.h"
@@ -36,13 +36,14 @@ #include "utils/utils.h"
#include "utils/url.h"
#include "utils/log.h"
-#include "content/fetch.h"
+#include "content/fetch.h" +
#include "atari/gui.h"
#include "atari/toolbar.h"
-#include "atari/browser.h"
+
#include "atari/misc.h" #include "atari/encoding.h" -#include "atari/msgbox.h" +#include "atari/gemtk/gemtk.h" #include "cflib.h"
extern void * h_gem_rsrc;
@@ -60,13 +61,13 @@ void warn_user(const char *warning, const char *detail) snprintf(message, len, messages_get(warning), detail);
printf("%s\n", message); - msg_box_show(MSG_BOX_ALERT, message);
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, message);
}
void die(const char *error)
{ printf("%s\n", error);
- msg_box_show(MSG_BOX_ALERT, error); + gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, error); exit(1);
}
@@ -111,10 +112,7 @@ bool path_add_part(char *path, int length, const char *newpart) return true;
} -/* - TBD: make use of this function or remove it... -*/
-struct gui_window * find_gui_window( unsigned long handle, short mode ){
+struct gui_window * find_guiwin_by_aes_handle(short handle){
struct gui_window * gw;
gw = window_list;
@@ -122,47 +120,20 @@ struct gui_window * find_gui_window( unsigned long handle, short mode ){ if( handle == 0 ){
return( NULL ); } - else if( mode == BY_WINDOM_HANDLE ){ - WINDOW * win = (WINDOW*) handle; - while( gw != NULL) {
- if( gw->root->handle == win ) {
- return( gw );
- }
- else
- gw = gw->next;
- } - } - else if( mode == BY_GEM_HANDLE ){ - short ghandle = (short)handle; - while( gw != NULL) {
- if( gw->root->handle != NULL - && gw->root->handle->handle == ghandle ) {
- return( gw );
- }
- else
- gw = gw->next;
- } - }
-
- return( NULL );
-} -
-
-struct gui_window * find_cmp_window( COMPONENT * c )
-{
- struct gui_window * gw;
- gw = window_list;
- while( gw != NULL ) {
- assert( gw->browser != NULL );
- if( gw->browser->comp == c ) {
- return( gw );
+ + while(gw != NULL) {
+ if( gw->root->win != NULL + && gemtk_wm_get_handle(gw->root->win) == handle ) {
+ return(gw);
}
else
gw = gw->next;
}
+
return( NULL );
} - +
+
static int scan_process_list(scan_process_callback cb, void *data) { int pid, count = 0; @@ -260,25 +231,6 @@ bool is_process_running(const char * name) }
-/* -------------------------------------------------------------------------- */
-/* GEM Utillity functions: */
-/* -------------------------------------------------------------------------- */
-
-/* Return a string from resource file */
-char *get_rsc_string( int idx) {
- char *txt;
- RsrcGaddr( h_gem_rsrc, R_STRING, idx, &txt );
- return txt;
-}
-
-OBJECT *get_tree( int idx) {
- OBJECT *tree;
- RsrcGaddr( h_gem_rsrc, R_TREE, idx, &tree);
- return tree;
-} - - - /** * Callback for load_icon(). Should be removed once bitmaps get loaded directly * from disc @@ -370,8 +322,8 @@ void gem_set_cursor( MFORM_EX * cursor ) static int number = 255;
if( flags == cursor->flags && number == cursor->number )
return;
- if( cursor->flags & MFORM_EX_FLAG_USERFORM ) {
- MouseSprite( cursor->tree, cursor->number);
+ if( cursor->flags & MFORM_EX_FLAG_USERFORM ) { + gemtk_obj_mouse_sprite(cursor->tree, cursor->number);
} else {
graf_mouse(cursor->number, NULL );
}
@@ -521,7 +473,8 @@ long nkc_to_input_key(short nkc, long * ucs4_out) * \param name Default file name * \return a static char pointer or null if the user aborted the selection. */ -const char * file_select( const char * title, const char * name ) { +const char * file_select(const char * title, const char * name ) { + static char path[PATH_MAX]=""; // First usage : current directory static char fullname[PATH_MAX]=""; char tmpname[255]; @@ -530,43 +483,39 @@ const char * file_select( const char * title, const char * name ) { if( strlen(name)>254) return( NULL ); - strcpy( tmpname, name ); + strcpy(tmpname, name); if( use_title == NULL ){ use_title = (char*)""; } - if( FselInput( path, tmpname, (char*)"", use_title, NULL, NULL)) { - strncpy( fullname, path, PATH_MAX-1 ); - strncat( fullname, tmpname, PATH_MAX-strlen(fullname)-1 ); - return( (const char*)&fullname ); + if (select_file(path, tmpname, (char*)"*", use_title, NULL)) { + snprintf(fullname, PATH_MAX, "%s%s", path, tmpname); + return((const char*)&fullname); } + return( NULL ); } -void dbg_lgrect( char * str, LGRECT * r )
-{
- printf("%s: x: %d, y: %d, w: %d, h: %d\n", str,
- r->g_x, r->g_y, r->g_w, r->g_h );
-}
-
-void dbg_grect( char * str, GRECT * r )
+void dbg_grect(const char * str, GRECT * r)
{
- printf("%s: x: %d, y: %d, w: %d, h: %d\n", str,
- r->g_x, r->g_y, r->g_w, r->g_h );
+ printf("%s: x: %d, y: %d, w: %d, h: %d (x2: %d, y2: %d)\n", str,
+ r->g_x, r->g_y, r->g_w, r->g_h, r->g_x + r->g_w, r->g_y + r->g_h);
}
-void dbg_pxy( char * str, short * pxy )
+void dbg_pxy(const char * str, short * pxy )
{
printf("%s: x: %d, y: %d, w: %d, h: %d\n", str,
pxy[0], pxy[1], pxy[2], pxy[3] );
} -void dbg_rect( char * str, int * pxy )
+void dbg_rect(const char * str, int * pxy)
{
- printf("%s: x: %d, y: %d, w: %d, h: %d\n", str,
- pxy[0], pxy[1], pxy[2], pxy[3] );
+ printf("%s: x0: %d, y0: %d, x1: %d, y1: %d (w: %d, h: %d)\n", str,
+ pxy[0], pxy[1], pxy[2], pxy[3], + pxy[2] - pxy[0], + pxy[3] - pxy[1] );
}
/* some LDG functions here to reduce dependencies */
diff --git a/atari/misc.h b/atari/misc.h index 612113fc1..677f8f69b 100755 --- a/atari/misc.h +++ b/atari/misc.h @@ -1,22 +1,22 @@ -/*
- * 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_ATARI_MISC_H
+/* + * 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_ATARI_MISC_H #define NS_ATARI_MISC_H #include "cflib.h" @@ -24,39 +24,36 @@ #include "content/hlcache.h" #include "desktop/textinput.h" #include "atari/gui.h" -
-#define SBUF8_TO_LBUF8(sbuf,lbuf)\
- lbuf[0] = (long)sbuf[0];\
- lbuf[1] = (long)sbuf[1];\
- lbuf[2] = (long)sbuf[2];\
- lbuf[3] = (long)sbuf[3];\
- lbuf[4] = (long)sbuf[4];\
- lbuf[5] = (long)sbuf[5];\
- lbuf[6] = (long)sbuf[6];\
- lbuf[7] = (long)sbuf[7];
-
+ +#define SBUF8_TO_LBUF8(sbuf,lbuf)\ + lbuf[0] = (long)sbuf[0];\ + lbuf[1] = (long)sbuf[1];\ + lbuf[2] = (long)sbuf[2];\ + lbuf[3] = (long)sbuf[3];\ + lbuf[4] = (long)sbuf[4];\ + lbuf[5] = (long)sbuf[5];\ + lbuf[6] = (long)sbuf[6];\ + lbuf[7] = (long)sbuf[7]; + /* Modes for find_gui_window: */ #define BY_WINDOM_HANDLE 0x0 #define BY_GEM_HANDLE 0x1 typedef int (*scan_process_callback)(int pid, void *data); -
-struct gui_window * find_gui_window( unsigned long, short mode );
-struct gui_window * find_cmp_window( COMPONENT * c ); -bool is_process_running(const char * name);
-OBJECT *get_tree( int idx );
-char *get_rsc_string( int idx );
+ +struct gui_window * find_guiwin_by_aes_handle(short handle); +bool is_process_running(const char * name); void gem_set_cursor( MFORM_EX * cursor ); hlcache_handle *load_icon( const char *name, hlcache_handle_callback cb, - void * pw );
-void dbg_grect( char * str, GRECT * r ); -void dbg_lgrect( char * str, LGRECT * r );
-void dbg_pxy( char * str, short * pxy );
-void * ldg_open( char * name, short * global );
-void * ldg_find( char * name, short * ldg );
+ void * pw ); +void dbg_grect(const char * str, GRECT * r); +void dbg_pxy(const char * str, short * pxy); +void dbg_rect(const char * str, int * pxy); +void * ldg_open( char * name, short * global ); +void * ldg_find( char * name, short * ldg ); const char * file_select( const char * title, const char * name ); int ldg_close( void * ldg, short * global ); long nkc_to_input_key(short nkc, long * ucs4_out); -#endif
+#endif diff --git a/atari/msgbox.h b/atari/msgbox.h deleted file mode 100644 index 204a49050..000000000 --- a/atari/msgbox.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GUIMSG_H_INCLUDED
-#define GUIMSG_H_INCLUDED - -#define MSG_BOX_ALERT 1 -#define MSG_BOX_CONFIRM 2 - -short msg_box_show(short type, char * msg); -
-
-#endif // GUIMSG_H_INCLUDED
diff --git a/atari/options.h b/atari/options.h index f48a0e871..f9bb3b4c5 100755 --- a/atari/options.h +++ b/atari/options.h @@ -29,9 +29,6 @@ int atari_font_monochrom; \ int atari_dither; \ int atari_transparency; \ - int atari_image_toolbar; \ - colour atari_toolbar_bg; \ - char *atari_image_toolbar_folder; \ char *atari_face_sans_serif; /* default sans face */ \ char *atari_face_sans_serif_bold; /* bold sans face */ \ char *atari_face_sans_serif_italic; /* bold sans face */ \ @@ -53,9 +50,6 @@ .atari_font_monochrom = 0, \ .atari_dither = 1, \ .atari_transparency = 1, \ - .atari_image_toolbar_folder = (char*)"default", \ - .atari_image_toolbar = 1, \ - .atari_toolbar_bg = 0xbbbbbb, \ .atari_face_sans_serif = NULL, \ .atari_face_sans_serif_bold = NULL, \ .atari_face_sans_serif_italic = NULL, \ @@ -75,12 +69,9 @@ #define NSOPTION_EXTRA_TABLE \ { "atari_font_driver", OPTION_STRING, &nsoptions.atari_font_driver },\ { "atari_font_monochrom", OPTION_INTEGER, &nsoptions.atari_font_monochrom },\ - { "atari_image_toolbar", OPTION_INTEGER, &nsoptions.atari_image_toolbar },\ - { "atari_toolbar_bg", OPTION_COLOUR, &nsoptions.atari_toolbar_bg },\ { "atari_transparency", OPTION_INTEGER, &nsoptions.atari_transparency },\ { "atari_dither", OPTION_INTEGER, &nsoptions.atari_dither },\ { "atari_editor", OPTION_STRING, &nsoptions.atari_editor },\ - { "atari_image_toolbar_folder", OPTION_STRING, &nsoptions.atari_image_toolbar_folder },\ { "font_face_sans_serif", OPTION_STRING, &nsoptions.atari_face_sans_serif },\ { "font_face_sans_serif_bold", OPTION_STRING, &nsoptions.atari_face_sans_serif_bold },\ { "font_face_sans_serif_italic", OPTION_STRING, &nsoptions.atari_face_sans_serif_italic },\ diff --git a/atari/osspec.c b/atari/osspec.c index d697f43d9..ada1e05c4 100644 --- a/atari/osspec.c +++ b/atari/osspec.c @@ -25,10 +25,10 @@ #include <string.h>
#include <mint/osbind.h>
#include <mint/cookie.h>
-#include <windom.h>
#include "utils/log.h"
-#include "atari/osspec.h"
+#include "atari/osspec.h" +#include "atari/gemtk/gemtk.h"
#ifndef PATH_MAX
#define PATH_MAX 1024
@@ -36,38 +36,6 @@ NS_ATARI_SYSINFO atari_sysinfo;
-unsigned short _systype_v;
-unsigned short _systype (void)
-{
- int32_t * cptr = NULL;
- _systype_v = SYS_TOS;
-
- cptr = (int32_t *)Setexc(0x0168, -1L);
- if (cptr == NULL ) {
- return _systype_v; /* stone old TOS without any cookie support */
- }
- while (*cptr) {
- if (*cptr == C_MgMc || *cptr == C_MgMx ) {
- _systype_v = (_systype_v & ~0xF) | SYS_MAGIC;
- } else if (*cptr == C_MiNT ) {
- _systype_v = (_systype_v & ~0xF) | SYS_MINT;
- } else if (*cptr == C_Gnva /* Gnva */ ) {
- _systype_v |= SYS_GENEVA;
- } else if (*cptr == C_nAES /* nAES */ ) {
- _systype_v |= SYS_NAES;
- }
- cptr += 2;
- }
- if (_systype_v & SYS_MINT) { /* check for XaAES */
- short out = 0, u;
- if (wind_get (0, (((short)'X') <<8)|'A', &out, &u,&u,&u) && out) {
- _systype_v |= SYS_XAAES;
- }
- }
- LOG(("Detected OS: %d\n", _systype_v ));
- return _systype_v;
-}
-
void init_os_info(void)
{
int16_t out[4];
diff --git a/atari/osspec.h b/atari/osspec.h index 91cf2f03b..29f87cccf 100644 --- a/atari/osspec.h +++ b/atari/osspec.h @@ -17,27 +17,13 @@ */
#ifndef NS_ATARI_OSSPEC_H
-#define NS_ATARI_OSSPEC_H
-
+#define NS_ATARI_OSSPEC_H + typedef struct {
long c;
long v;
} COOKIE;
-/* System type detection added by [GS] */
-#define SYS_TOS 0x0001
-#define SYS_MAGIC 0x0002
-#define SYS_MINT 0x0004
-#define SYS_GENEVA 0x0010
-#define SYS_NAES 0x0020
-#define SYS_XAAES 0x0040
-/* detect the system type, AES + kernel */
-#define sys_type() (_systype_v ? _systype_v : _systype())
-#define sys_MAGIC() ((sys_type() & SYS_MAGIC) != 0)
-#define sys_NAES() ((sys_type() & SYS_NAES) != 0)
-#define sys_XAAES() ((sys_type() & SYS_XAAES) != 0)
-
-
typedef struct {
unsigned short gemdos_version;
unsigned short gdos_FSMC;
@@ -50,13 +36,9 @@ typedef struct { } NS_ATARI_SYSINFO;
extern NS_ATARI_SYSINFO atari_sysinfo;
-extern unsigned short _systype_v;
-
-#define TOS4VER 0x03300 /* this is assumed to be the last single tasking OS */
void init_os_info(void);
-int tos_getcookie( long tag, long * value );
void fix_path(char * path);
-char * gemdos_realpath(const char * path, char * rpath);
-unsigned short _systype (void);
-#endif
\ No newline at end of file +char * gemdos_realpath(const char * path, char * rpath); +int tos_getcookie( long tag, long * value );
+#endif diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c index 2339cd659..8db7cc2c0 100755 --- a/atari/plot/font_freetype.c +++ b/atari/plot/font_freetype.c @@ -607,9 +607,10 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng #ifdef WITH_8BPP_SUPPORT
if( app.nplanes > 8 ){
#endif
- unsigned short out[4];
- rgb_to_vdi1000( (unsigned char*)&c, (unsigned short*)&out );
- vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0]);
+ RGB1000 out;
+ rgb_to_vdi1000( (unsigned char*)&c, &out);
+ vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, + (unsigned short*)&out);
#ifdef WITH_8BPP_SUPPORT
} else {
c = RGB_TO_VDI(c);
diff --git a/atari/plot/font_internal.c b/atari/plot/font_internal.c index 4edec4565..3db29eba5 100644 --- a/atari/plot/font_internal.c +++ b/atari/plot/font_internal.c @@ -25,8 +25,6 @@ #include "utils/utf8.h"
#include "utils/log.h"
-
-#include <windom.h>
extern unsigned long atari_plot_flags; extern int atari_plot_vdi_handle;
@@ -247,10 +245,18 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng #ifdef WITH_8BPP_SUPPORT if( app.nplanes > 8 ){ #endif
- unsigned short out[4];
- rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned short*)&out );
- vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0] );
- plot_blit_mfdb(&loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS ); + //unsigned short out[4]; + RGB1000 out;
+ //rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned short*)&out ); + out.blue = 0; + out.green = 1000; + out.red = 0; + vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (short *)&out); + vq_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, 1, (short *)&out); + //printf("r:%d,g:%d,b:%d", out.red, out.green, out.blue); + //vsl_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR); + //vsf_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR);
+ plot_blit_mfdb(&loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS); #ifdef WITH_8BPP_SUPPORT } else { unsigned char c = RGB_TO_VDI(fstyle->foreground); diff --git a/atari/plot/font_vdi.c b/atari/plot/font_vdi.c index 89596b38a..4ebab24fb 100755 --- a/atari/plot/font_vdi.c +++ b/atari/plot/font_vdi.c @@ -16,15 +16,20 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef WITH_VDI_FONT_DRIVER
+#ifdef WITH_VDI_FONT_DRIVER + +#include <mt_gemx.h> + #include "atari/plot/plot.h"
#include "atari/plot/font_vdi.h"
#include "utils/utf8.h"
-#include "utils/log.h"
+#include "utils/log.h" + -static char * lstr = NULL;
+
+//static char * lstr = NULL;
static int dtor( FONT_PLOTTER self );
@@ -39,6 +44,25 @@ static bool init = false; static int vdih;
extern struct s_vdi_sysinfo vdi_sysinfo;
+ +static inline void atari_to_vdi_str(char *lstr, int length) +{ + int i, z; + + for (i=z=0; i<length; ) { + if (((char)lstr[i]==(char)0xC2) && ((char)lstr[i+1] == (char)0xA0)) { + lstr[z] = ' '; + lstr[z+1] = ' '; + i=i+2; + z=z+2; + } + else { + lstr[z] = lstr[i]; + i++; + z++; + } + } +} int ctor_font_plotter_vdi( FONT_PLOTTER self )
{
@@ -65,11 +89,15 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const c {
short cw, ch, cellw, cellh;
short pxsize;
- short fx=0;
- lstr = (char*)str;
- utf8_to_enc(str, "ATARIST", length, &lstr );
+ short fx=0; + char * lstr = NULL; +
+ utf8_to_local_encoding(str, length, &lstr);
assert( lstr != NULL );
- int slen = strlen(lstr);
+ int slen = strlen(lstr); + + + atari_to_vdi_str(lstr, slen);
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
@@ -79,11 +107,19 @@ 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 );
- vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
+ //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); + //vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); + pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 );
+ vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh); +/* + if(slen != utf8_bounded_length(str, length)){ + printf("sl: %d, utl: %d\n ", slen, utf8_bounded_length(str, length)); + printf("s: %s // %s\n", str, lstr ); + }*/ + +
*width = slen * cellw;
- free( (void*)lstr );
- lstr = NULL;
+ free((void*)lstr);
return( 0 );
}
@@ -94,15 +130,19 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const short pxsize;
short fx=0;
int i;
- lstr = (char*)string;
- int slen = 0;
+ char *lstr = NULL;
+ size_t slen = 0;
int last_space_x = 0;
- int last_space_idx = 0;
+ int last_space_idx = 0; + size_t nxtchr = 0;
- utf8_to_enc(string, "ATARIST", length, &lstr );
+ utf8_to_local_encoding(string, length, &lstr );
assert( lstr != NULL );
+ slen = strlen(lstr); + + + atari_to_vdi_str(lstr, slen); - slen = strlen(lstr);
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
if( fstyle->flags & FONTF_OBLIQUE )
@@ -110,27 +150,50 @@ 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 );
- vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
+ //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
+ //vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); + + pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 );
+ vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
*actual_x = 0;
- *char_offset = 0;
- int cpos=0;
- for( i=0; i<slen; i++) {
- if( lstr[i] == ' ' ) {
+ //*char_offset = 0;
+ int cpos=0; + while (nxtchr < slen) { + if( lstr[nxtchr] == ' ' ) {
last_space_x = *actual_x;
- last_space_idx = cpos;
- }
- if( *actual_x > x ) {
- *actual_x = last_space_x;
- *char_offset = last_space_idx;
- return true;
- }
- *actual_x += cellw;
- cpos++;
- }
- *char_offset = cpos;
+ last_space_idx = nxtchr;
+ } + *actual_x += cellw; + if (*actual_x > x) { + *actual_x = last_space_x; + *char_offset = last_space_idx; + //printf("at: %s\n", lstr); + return(0); + } + + nxtchr++; + } + if(nxtchr >= length){ + nxtchr = length-1; + } + + *char_offset = nxtchr; +
+// for( i=0; i<slen; i++) {
+// if( lstr[i] == ' ' ) {
+// last_space_x = *actual_x;
+// last_space_idx = cpos;
+// }
+// if( *actual_x > x ) {
+// *actual_x = last_space_x;
+// *char_offset = last_space_idx;
+// return true;
+// }
+// *actual_x += cellw;
+// cpos++;
+// }
+// *char_offset = cpos;
free( (void*)lstr );
- lstr = NULL;
return( 0 );
}
@@ -141,19 +204,22 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const short pxsize=0;
short fx=0;
- lstr = (char*)string;
+ char *lstr = NULL;
int i=0;
int curpx=0;
- utf8_to_enc(string, "ATRIST", length, &lstr );
+ utf8_to_local_encoding(string, length, &lstr );
assert( lstr != NULL );
- int slen = strlen(lstr);
+ int slen = strlen(lstr); + + atari_to_vdi_str(lstr, slen); +
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
if( fstyle->flags & FONTF_OBLIQUE )
fx |= 16;
if( fstyle->weight > 450 )
fx |= 1;
- vst_effects( self->vdi_handle, fx );
+ vst_effects(self->vdi_handle, fx);
pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
*actual_x = 0;
@@ -166,24 +232,30 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const break;
}
}
- free( (void*)lstr );
+ free((void*)lstr);
lstr = NULL;
return( 0 );
}
static inline void vst_rgbcolor( short vdih, uint32_t cin )
{
- if( vdi_sysinfo.scr_bpp > 8 ) {
- unsigned short c[4];
- rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c );
- vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0] );
+#ifdef WITH_8BPP_SUPPORT + if( vdi_sysinfo.scr_bpp > 8 ) { +#endif
+ //unsigned short c[4]; + RGB1000 c; +
+ rgb_to_vdi1000( (unsigned char*)&cin, &c );
+ vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c);
vst_color( vdih, OFFSET_CUSTOM_COLOR );
+#ifdef WITH_8BPP_SUPPORT } else {
if( vdi_sysinfo.scr_bpp >= 4 )
vst_color( vdih, RGB_TO_VDI(cin) );
else
vst_color( vdih, BLACK );
- }
+ } +#endif
}
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
@@ -192,16 +264,20 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng /* todo: either limit the string to max 80 chars, or use v_ftext instead of v_gtext */
short cw, ch, cellw, cellh;
short pxsize=8;
- short fx=0;
- lstr = (char*)text;
- utf8_to_enc(text, "ATARIST", length, &lstr );
- assert( lstr != NULL );
- int slen = strlen(lstr);
- size_t mylen = MIN(511, slen );
- char textcpy[mylen+1];
+ short fx=0; + GRECT canvas;
+ char *lstr = NULL; + assert( utf8_to_local_encoding(text, length, &lstr) == UTF8_CONVERT_OK);
+ assert( lstr != NULL ); +
+ int slen = strlen(lstr); + if(slen > 800){ + lstr[800]=0; + } + + + atari_to_vdi_str(lstr, slen);
- textcpy[mylen] = 0;
- strncpy((char*)&textcpy, lstr, mylen+1 );
if( fstyle != NULL){
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
@@ -212,20 +288,25 @@ 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 );
- }
- x += CURFB(self->plotter).x;
- y += CURFB(self->plotter).y;
+ } + plot_get_dimensions(&canvas);
+ x += canvas.g_x;
+ y += canvas.g_y;
vst_effects( self->vdi_handle, fx );
- vst_alignment(vdih, 0, 4, &cw, &ch );
- vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
+ vst_alignment(vdih, 0, 0, &cw, &ch ); + vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
+ //vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
vswr_mode( self->vdi_handle, MD_TRANS );
- vst_rgbcolor(self->vdi_handle, fstyle->foreground );
+ vst_rgbcolor(self->vdi_handle, fstyle->foreground);
- if( atari_sysinfo.gdos_FSMC ){
- v_ftext( self->vdi_handle, x, y, (char*)&textcpy );
- } else {
- v_gtext( self->vdi_handle, x, y, (char*)&textcpy );
+ if( atari_sysinfo.gdos_FSMC ){ + //printf("\nftext\n");
+ v_ftext( self->vdi_handle, x, y, (char*)lstr );
+ } else { + //printf("\ngtext\n");
+ v_gtext( self->vdi_handle, x, y, (char*)lstr );
}
free( lstr );
return( 0 );
diff --git a/atari/plot/plot.c b/atari/plot/plot.c index ca3f2b726..2a8fd6868 100755 --- a/atari/plot/plot.c +++ b/atari/plot/plot.c @@ -22,7 +22,8 @@ #include <limits.h> #include <math.h> #include <stdbool.h> -#include <windom.h> + +#include <mt_gem.h> #include "image/bitmap.h" #include "utils/log.h" @@ -36,6 +37,8 @@ #include "desktop/options.h" #include "atari/plot/plot.h" +void vq_scrninfo(VdiHdl handle, short *work_out); + struct s_view { short x; /* drawing (screen) offset x */ short y; /* drawing (screen) offset y */ @@ -154,7 +157,7 @@ static HermesFormat vfmt; /* netsurf source bitmap format */ static HermesFormat nsfmt; -static struct s_vdi_sysinfo vdi_sysinfo; +struct s_vdi_sysinfo vdi_sysinfo; /* bit depth of framebuffers: */ static int atari_plot_bpp_virt; static struct s_view view; @@ -166,7 +169,7 @@ static HermesHandle hermes_res_h; static short prev_vdi_clip[4]; static struct bitmap snapshot; -int atari_plot_vdi_handle; +VdiHdl atari_plot_vdi_handle = -1; unsigned long atari_plot_flags; unsigned long atari_font_flags; @@ -190,9 +193,10 @@ inline static void vsl_rgbcolor(short vdih, colour cin) #ifdef WITH_8BPP_SUPPORT if( vdi_sysinfo.scr_bpp > 8 ) { #endif - unsigned short c[4]; - rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c); - vs_color(vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0]); + //unsigned short c[4]; + RGB1000 c; + rgb_to_vdi1000( (unsigned char*)&cin, &c); + vs_color(vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c); vsl_color(vdih, OFFSET_CUSTOM_COLOR); #ifdef WITH_8BPP_SUPPORT } else { @@ -216,9 +220,9 @@ inline static void vsf_rgbcolor(short vdih, colour cin) #ifdef WITH_8BPP_SUPPORT if( vdi_sysinfo.scr_bpp > 8 ) { #endif - unsigned short c[4]; - rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c ); - vs_color( vdih, OFFSET_CUSTOM_COLOR, &c[0] ); + RGB1000 c; + rgb_to_vdi1000( (unsigned char*)&cin, &c); + vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c); vsf_color( vdih, OFFSET_CUSTOM_COLOR ); #ifdef WITH_8BPP_SUPPORT } else { @@ -255,9 +259,9 @@ inline static void plot_get_visible_grect(GRECT * out) /* all values of the region are set to zero. */ inline static void update_visible_rect(void) { - GRECT screen; - GRECT common; - GRECT frame; + GRECT screen; // dimensions of the screen + GRECT frame; // dimensions of the drawing area + GRECT common; // dimensions of intersection of both screen.g_x = 0; screen.g_y = 0; @@ -269,14 +273,14 @@ inline static void update_visible_rect(void) common.g_w = frame.g_w = view.w; common.g_h = frame.g_h = view.h; - if( rc_intersect( &screen, &common ) ) { + if (rc_intersect(&screen, &common)) { view.vis_w = common.g_w; view.vis_h = common.g_h; - if( view.x < screen.g_x ) + if (view.x < screen.g_x) view.vis_x = frame.g_w - common.g_w; else view.vis_x = 0; - if( view.y <screen.g_y ) + if (view.y <screen.g_y) view.vis_y = frame.g_h - common.g_h; else view.vis_y = 0; @@ -321,32 +325,6 @@ inline static bool fbrect_to_screen(GRECT box, GRECT * ret) return ( true ); } -/* convert framebuffer clipping to vdi clipping and activates it */ -inline static void plot_vdi_clip(bool set) -{ - // TODO : check this - return; - if( set == true ) { - struct rect c; - short vdiflags[58]; - short newclip[4]; - plot_get_clip(&c); - vq_extnd(atari_plot_vdi_handle, 1, (short*)&vdiflags); - prev_vdi_clip[0] = vdiflags[45]; - prev_vdi_clip[1] = vdiflags[46]; - prev_vdi_clip[2] = vdiflags[47]; - prev_vdi_clip[3] = vdiflags[48]; - newclip[0] = view.x + MAX(c.x0, 0); - newclip[1] = view.y + MAX(c.y0, 0); - newclip[2] = MIN(view.x+view.w, newclip[0] + (c.x1 - c.x0) )-1; - newclip[3] = MIN(view.y+view.h, newclip[1] + (c.y1 - c.y0) )-1; - vs_clip(atari_plot_vdi_handle, 1, (short*)&newclip ); - } else { - vs_clip(atari_plot_vdi_handle, 1, (short *)&prev_vdi_clip ); - } -} - - /* copy an rectangle from the plot buffer to screen */ /* because this is an on-screen plotter, this is an screen to screen copy. */ bool plot_copy_rect(GRECT src, GRECT dst) @@ -535,14 +513,14 @@ static struct s_vdi_sysinfo * read_vdi_sysinfo(short vdih, struct s_vdi_sysinfo /* Convert an RGB color to an VDI Color */ -inline void rgb_to_vdi1000(unsigned char * in, unsigned short * out) +inline void rgb_to_vdi1000(unsigned char * in, RGB1000 *out) { double r = ((double)in[3]/255); /* prozentsatz red */ double g = ((double)in[2]/255); /* prozentsatz green */ double b = ((double)in[1]/255); /* prozentsatz blue */ - out[0] = 1000 * r + 0.5; - out[1] = 1000 * g + 0.5; - out[2] = 1000 * b + 0.5; + out->red = 1000 * r + 0.5; + out->green = 1000 * g + 0.5; + out->blue = 1000 * b + 0.5; return; } @@ -766,7 +744,7 @@ static MFDB * snapshot_create_std_mfdb(int x, int y, int w, int h) /* allocate memory for the snapshot */ { int scr_stride = MFDB_STRIDE( w ); - int scr_size = ( ((scr_stride >> 3) * h) * app.nplanes ); + int scr_size = ( ((scr_stride >> 3) * h) * vdi_sysinfo.scr_bpp ); if(size_buf_std == 0 ){ /* init screen mfdb */ buf_std.fd_addr = malloc( scr_size ); @@ -783,7 +761,7 @@ static MFDB * snapshot_create_std_mfdb(int x, int y, int w, int h) size_buf_std = 0; return( NULL ); } - buf_std.fd_nplanes = app.nplanes; + buf_std.fd_nplanes = 8; buf_std.fd_w = scr_stride; buf_std.fd_h = h; buf_std.fd_stand = 1; @@ -793,7 +771,7 @@ static MFDB * snapshot_create_std_mfdb(int x, int y, int w, int h) MFDB * native = snapshot_create_native_mfdb(x,y,w,h ); assert( native ); - vr_trnfm(atari_plot_vdi_handle, native, &buf_std ); + vr_trnfm(atari_plot_vdi_handle, native, &buf_std); return( &buf_std ); } @@ -1464,14 +1442,14 @@ bool plot_blit_bitmap(struct bitmap * bmp, int x, int y, return(true); } -bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, +bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor, uint32_t flags) { MFDB screen, tran; MFDB * src; short pxy[8]; - short c[2] = {fgcolor, WHITE}; + short c[2] = {fgcolor, 0}; GRECT off; plot_get_clip_grect(&off); @@ -1480,29 +1458,30 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, } init_mfdb( 0, loc->g_w, loc->g_h, 0, &screen ); - - if( insrc->fd_stand ){ - int size = init_mfdb( insrc->fd_nplanes, loc->g_w, loc->g_h, - MFDB_FLAG_NOALLOC, - &tran - ); - if( size_buf_scr == 0 ){ - buf_scr.fd_addr = malloc( size ); - size_buf_scr = size; - } else { - if( size > size_buf_scr ) { - buf_scr.fd_addr = realloc( - buf_scr.fd_addr, size - ); - size_buf_scr = size; - } - } - tran.fd_addr = buf_scr.fd_addr; - vr_trnfm(atari_plot_vdi_handle, insrc, &tran ); - src = &tran; - } else { +// +// if( insrc->fd_stand){ +// printf("st\n"); +// int size = init_mfdb( insrc->fd_nplanes, loc->g_w, loc->g_h, +// MFDB_FLAG_NOALLOC, +// &tran +// ); +// if( size_buf_scr == 0 ){ +// buf_scr.fd_addr = malloc( size ); +// size_buf_scr = size; +// } else { +// if( size > size_buf_scr ) { +// buf_scr.fd_addr = realloc( +// buf_scr.fd_addr, size +// ); +// size_buf_scr = size; +// } +// } +// tran.fd_addr = buf_scr.fd_addr; +// vr_trnfm(atari_plot_vdi_handle, insrc, &tran ); +// src = &tran; +// } else { src = insrc; - } +// } pxy[0] = off.g_x - loc->g_x; pxy[1] = off.g_y - loc->g_y; @@ -1515,7 +1494,7 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, if( flags & PLOT_FLAG_TRANS && src->fd_nplanes == 1){ - vrt_cpyfm(atari_plot_vdi_handle, MD_TRANS, (short*)pxy, src, &screen, (short*)&c ); + vrt_cpyfm(atari_plot_vdi_handle, MD_REPLACE/*MD_TRANS*/, (short*)pxy, src, &screen, (short*)&c); } else { /* this method only plots transparent bitmaps, right now... */ } @@ -1541,7 +1520,15 @@ int plot_init(char * fdrvrname) if( nsoption_int(atari_font_monochrom) == 1 ) atari_font_flags |= FONTPLOT_FLAG_MONOGLYPH; - atari_plot_vdi_handle = app.graf.handle; + if(atari_plot_vdi_handle == -1) { + + short dummy; + short work_in[12] = {Getrez()+2,1,1,1,1,1,1,1,1,1,2,1}; + short work_out[57]; + atari_plot_vdi_handle=graf_handle(&dummy, &dummy, &dummy, &dummy); + v_opnvwk(work_in, &atari_plot_vdi_handle, work_out); + LOG(("Plot VDI handle: %d", atari_plot_vdi_handle)); + } read_vdi_sysinfo(atari_plot_vdi_handle, &vdi_sysinfo); if(verbose_log) { dump_vdi_info(atari_plot_vdi_handle) ; @@ -1556,7 +1543,7 @@ int plot_init(char * fdrvrname) } memset(&view, 0, sizeof(struct s_view)); - atari_plot_bpp_virt = app.nplanes; + atari_plot_bpp_virt = vdi_sysinfo.scr_bpp; view.x = loc_pos.g_x; view.y = loc_pos.g_y; view.w = loc_pos.g_w; @@ -1583,14 +1570,14 @@ int plot_init(char * fdrvrname) assert(Hermes_Init()); #ifdef WITH_8BPP_SUPPORT - bitmap_convert = (app.nplanes > 8) ? bitmap_convert_tc : bitmap_convert_8; + bitmap_convert = (vdi_sysinfo.scr_bpp > 8) ? bitmap_convert_tc : bitmap_convert_8; /* Setup color lookup tables and palette */ i = 0; unsigned char * col; unsigned char rgbcol[4]; unsigned char graytone=0; - if( app.nplanes <= 8 ){ + if( vdi_sysinfo.scr_bpp <= 8 ){ for( i=0; i<=255; i++ ) { // get the current color and save it for restore: @@ -1599,7 +1586,7 @@ int plot_init(char * fdrvrname) pal[i][0] = sys_pal[i][0]; pal[i][1] = sys_pal[i][1]; pal[i][2] = sys_pal[i][2]; - } else if( app.nplanes >= 8 ) { + } else if( vdi_sysinfo.scr_bpp >= 8 ) { if ( i < OFFSET_CUST_PAL ){ pal[i][0] = vdi_web_pal[i-OFFSET_WEB_PAL][0]; pal[i][1] = vdi_web_pal[i-OFFSET_WEB_PAL][1]; @@ -1700,6 +1687,7 @@ bool plot_unlock(void) wind_update(END_MCTRL); wind_update(END_UPDATE); graf_mouse(M_ON, NULL); + vs_clip_off(atari_plot_vdi_handle); atari_plot_flags &= ~PLOT_FLAG_LOCKED; return(false); } @@ -1816,12 +1804,23 @@ bool plot_line(int x0, int y0, int x1, int y1, uint32_t lt; int sw = pstyle->stroke_width; - pxy[0] = view.x + x0; - pxy[1] = view.y + y0; - pxy[2] = view.x + x1; - pxy[3] = view.y + y1; + if((x0 < 0 && x1 < 0) || (y0 < 0 && y1 < 0)){ + return(true); + } + + pxy[0] = view.x + MAX(0,x0); + pxy[1] = view.y + MAX(0,y0); + pxy[2] = view.x + MAX(0,x1); + pxy[3] = view.y + MAX(0,y1); + + if((y0 > view.h-1) && (y1 > view.h-1)) + return(true); + + //printf("view: %d,%d,%d,%d\n", view.x, view.y, view.w, view.h); + //printf("line: %d,%d,%d,%d\n", x0, y0, x1, y1); + - plot_vdi_clip(true); + //plot_vdi_clip(true); if( sw == 0) sw = 1; NSLT2VDI(lt, pstyle) @@ -1833,8 +1832,8 @@ bool plot_line(int x0, int y0, int x1, int y1, vsl_width(atari_plot_vdi_handle, (short)sw); vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour); v_pline(atari_plot_vdi_handle, 2, (short *)&pxy ); - plot_vdi_clip(false); - return ( true ); + //plot_vdi_clip(false); + return (true); } static bool plot_polygon(const int *p, unsigned int n, @@ -1845,7 +1844,7 @@ static bool plot_polygon(const int *p, unsigned int n, short d[4]; if (vdi_sysinfo.maxpolycoords > 0) assert( (signed int)n < vdi_sysinfo.maxpolycoords); - plot_vdi_clip(true); + vsf_interior(atari_plot_vdi_handle, FIS_SOLID); vsf_style(atari_plot_vdi_handle, 1); for (i = 0; i<n*2; i=i+2) { @@ -1861,7 +1860,7 @@ static bool plot_polygon(const int *p, unsigned int n, vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour); v_pline(atari_plot_vdi_handle, n+1, (short *)&pxy); } - plot_vdi_clip(false); + return ( true ); } @@ -1888,13 +1887,61 @@ bool plot_set_dimensions(int x, int y, int w, int h) return(true); } +bool plot_get_dimensions(GRECT *dst) +{ + + dst->g_x = view.x; + dst->g_y = view.y; + dst->g_w = view.w; + dst->g_h = view.h; + return(true); +} + bool plot_clip(const struct rect *clip) { - // FIXME: consider the canvas size - view.clipping.x0 = clip->x0; + GRECT canvas, screen, gclip, isection; + short pxy[4]; + + screen.g_x = 0; + screen.g_y = 0; + screen.g_w = vdi_sysinfo.scr_w; + screen.g_h = vdi_sysinfo.scr_h; + + plot_get_dimensions(&canvas); + view.clipping.y0 = clip->y0; - view.clipping.x1 = clip->x1; view.clipping.y1 = clip->y1; + view.clipping.x0 = clip->x0; + view.clipping.x1 = clip->x1; + + plot_get_clip_grect(&gclip); + + gclip.g_x += canvas.g_x; + gclip.g_y += canvas.g_y; + + rc_intersect(&canvas, &gclip); + + if(gclip.g_h < 0){ + gclip.g_h = 0; + } + + if (!rc_intersect(&screen, &gclip)) { + dbg_rect("cliprect: ", &view.clipping); + dbg_grect("screen: ", &canvas); + dbg_grect("canvas clipped: ", &gclip); + //assert(1 == 0); + } + + //assert(rc_intersect(&screen, &gclip)); + + //dbg_grect("canvas clipped to screen", &gclip); + + pxy[0] = gclip.g_x; + pxy[1] = gclip.g_y; + pxy[2] = pxy[0] + gclip.g_w; + pxy[3] = pxy[1] + gclip.g_h; + + vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy); return ( true ); } @@ -1912,7 +1959,9 @@ bool plot_get_clip(struct rect * out) void plot_get_clip_grect(GRECT * out) { struct rect clip={0,0,0,0}; + plot_get_clip(&clip); + out->g_x = clip.x0; out->g_y = clip.y0; out->g_w = clip.x1 - clip.x0; @@ -1927,7 +1976,6 @@ static bool plot_text(int x, int y, const char *text, size_t length, const plot_ static bool plot_disc(int x, int y, int radius, const plot_style_t *pstyle) { - plot_vdi_clip(true); if (pstyle->fill_type != PLOT_OP_TYPE_SOLID) { vsf_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour); vsf_perimeter(atari_plot_vdi_handle, 1); @@ -1939,14 +1987,14 @@ static bool plot_disc(int x, int y, int radius, const plot_style_t *pstyle) vsf_interior(atari_plot_vdi_handle, FIS_SOLID); v_circle(atari_plot_vdi_handle, view.x + x, view.y + y, radius); } - plot_vdi_clip(false); - return ( true ); + + return(true); } static bool plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *pstyle) { - //plot_vdi_clip(true); + vswr_mode(atari_plot_vdi_handle, MD_REPLACE ); if (pstyle->fill_type == PLOT_OP_TYPE_NONE) return(true); @@ -1961,7 +2009,7 @@ static bool plot_arc(int x, int y, int radius, int angle1, int angle2, vsf_perimeter(atari_plot_vdi_handle, 1); v_arc(atari_plot_vdi_handle, view.x + x, view.y + y, radius, angle1*10, angle2*10); } - //plot_vdi_clip(true); + return (true); } diff --git a/atari/plot/plot.h b/atari/plot/plot.h index 53a2645f8..b0ec58b5a 100755 --- a/atari/plot/plot.h +++ b/atari/plot/plot.h @@ -24,7 +24,6 @@ #include <stdio.h> #include <string.h> #include <math.h> -#include <windom.h> #include <assert.h> #include <mint/osbind.h> #include <mint/cookie.h> @@ -107,6 +106,7 @@ const char* plot_err_str(int i) ; bool plot_lock(void); bool plot_unlock(void); bool plot_set_dimensions( int x, int y, int w, int h ); +bool plot_get_dimensions(GRECT *dst); bool plot_get_clip(struct rect * out); /* Get clipping for current framebuffer as GRECT */ void plot_get_clip_grect(GRECT * out); @@ -115,7 +115,7 @@ bool plot_rectangle( int x0, int y0, int x1, int y1,const plot_style_t *style ); bool plot_line( int x0, int y0, int x1, int y1, const plot_style_t *style ); bool plot_blit_bitmap(struct bitmap * bmp, int x, int y, unsigned long bg, unsigned long flags); -bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, +bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor, uint32_t flags); bool plot_copy_rect(GRECT src, GRECT dst); @@ -123,7 +123,7 @@ bool plot_copy_rect(GRECT src, GRECT dst); void vdi1000_to_rgb( unsigned short * in, unsigned char * out ); /* convert an bgra color to vdi1000 color */ -void rgb_to_vdi1000( unsigned char * in, unsigned short * out ); +void rgb_to_vdi1000( unsigned char * in, RGB1000 *out); /* convert an rgb color to an index into the web palette */ short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b); diff --git a/atari/redrawslots.c b/atari/redrawslots.c index 9fe71610e..496faac75 100644 --- a/atari/redrawslots.c +++ b/atari/redrawslots.c @@ -17,16 +17,23 @@ */ #include <stdbool.h> -#include "windom.h" #include "utils/types.h" #include "atari/redrawslots.h" +#include "atari/gemtk/gemtk.h" + void redraw_slots_init(struct s_redrw_slots * slots, short size) { + // TODO: allocate slots dynamically! slots->size = MIN( MAX_REDRW_SLOTS , size); slots->areas_used = 0; } +void redraw_slots_free(struct s_redrw_slots * slots) +{ + // TOOD: free areas... +} + static inline bool rect_intersect( struct rect * box1, struct rect * box2 )
{
@@ -44,38 +51,50 @@ static inline bool rect_intersect( struct rect * box1, struct rect * box2 ) return true;
} + + +void redraw_slot_schedule_grect(struct s_redrw_slots * slots, GRECT *area, + bool force) +{ + redraw_slot_schedule(slots, area->g_x, area->g_y, + area->g_x + area->g_w, area->g_y + area->g_h, force); +} + /*
- schedule a slots, coords are relative.
+ schedule redraw coords.
*/
-void redraw_slot_schedule(struct s_redrw_slots * slots, short x0, short y0, short x1, short y1)
+void redraw_slot_schedule(struct s_redrw_slots * slots, short x0, short y0, + short x1, short y1, bool force)
{
- int i;
+ int i = 0;
struct rect area;
area.x0 = x0;
area.y0 = y0;
area.x1 = x1;
area.y1 = y1;
-
- for( i=0; i<slots->areas_used; i++) {
- if( slots->areas[i].x0 <= x0
- && slots->areas[i].x1 >= x1
- && slots->areas[i].y0 <= y0
- && slots->areas[i].y1 >= y1 ){
- /* the area is already queued for redraw */
- return;
- } else {
- if( rect_intersect(&slots->areas[i], &area ) ){
- slots->areas[i].x0 = MIN(slots->areas[i].x0, x0);
- slots->areas[i].y0 = MIN(slots->areas[i].y0, y0);
- slots->areas[i].x1 = MAX(slots->areas[i].x1, x1);
- slots->areas[i].y1 = MAX(slots->areas[i].y1, y1);
- return;
- }
- }
+ + if (force == false) {
+ for (i=0; i<slots->areas_used; i++) {
+ if (slots->areas[i].x0 <= x0
+ && slots->areas[i].x1 >= x1
+ && slots->areas[i].y0 <= y0
+ && slots->areas[i].y1 >= y1) {
+ /* the area is already queued for redraw */
+ return;
+ } else {
+ if (rect_intersect(&slots->areas[i], &area )) {
+ slots->areas[i].x0 = MIN(slots->areas[i].x0, x0);
+ slots->areas[i].y0 = MIN(slots->areas[i].y0, y0);
+ slots->areas[i].x1 = MAX(slots->areas[i].x1, x1);
+ slots->areas[i].y1 = MAX(slots->areas[i].y1, y1);
+ return;
+ }
+ }
+ } }
- if( slots->areas_used < slots->size ) {
+ if (slots->areas_used < slots->size) {
slots->areas[slots->areas_used].x0 = x0;
slots->areas[slots->areas_used].x1 = x1;
slots->areas[slots->areas_used].y0 = y0;
@@ -91,6 +110,15 @@ void redraw_slot_schedule(struct s_redrw_slots * slots, short x0, short y0, shor slots->areas[slots->size-1].x1 = MAX(slots->areas[i].x1, x1);
slots->areas[slots->size-1].y1 = MAX(slots->areas[i].y1, y1);
}
-done:
+done: return;
} + +void redraw_slots_remove_area(struct s_redrw_slots * slots, int i) +{ + int x; + for(x = i+1; i<slots->areas_used; x++){ + slots->areas[x-1] = slots->areas[x]; + } + slots->areas_used--; +} diff --git a/atari/redrawslots.h b/atari/redrawslots.h index d1f0fc285..2c932bbc1 100644 --- a/atari/redrawslots.h +++ b/atari/redrawslots.h @@ -20,6 +20,10 @@ #ifndef ATARI_REDRAW_SLOTS_H #define ATARI_REDRAW_SLOTS_H +#include <mt_gem.h> +#include "utils/types.h" + + /*
MAX_REDRW_SLOTS
This is the number of redraw requests that the slotlist can store.
@@ -36,11 +40,15 @@ struct s_redrw_slots {
struct rect areas[MAX_REDRW_SLOTS]; short size;
- short areas_used;
+ short volatile areas_used;
}; void redraw_slots_init(struct s_redrw_slots * slots, short size); -void redraw_slot_schedule(struct s_redrw_slots * slots, short x0, short y0, short x1, short y1); - +void redraw_slot_schedule(struct s_redrw_slots * slots, short x0, short y0, + short x1, short y1, bool force); +void redraw_slot_schedule_grect(struct s_redrw_slots * slots, GRECT *area, + bool force); +void redraw_slots_remove_area(struct s_redrw_slots * slots, int i); +void redraw_slots_free(struct s_redrw_slots * slots); #endif diff --git a/atari/res/netsurf.c b/atari/res/netsurf.c new file mode 100644 index 000000000..d6ee900f1 --- /dev/null +++ b/atari/res/netsurf.c @@ -0,0 +1,4379 @@ +/* erzeugt mit RSM2CS V1.01 Beta von Armin Diedering aus "S:\Sources\netsurf.git\netsurf\atari\res\netsurf.rsc" */
+/* nach Sourcen von Holger Weets */
+
+#include <portab.h>
+
+static char rs_s0[] = "";
+static char rs_s1[] = "-------------------------";
+static char rs_s2[] = "------------------------------";
+static char rs_s3[] = "-----------------------";
+static char rs_s4[] = "Abort";
+static char rs_s5[] = "X";
+static char rs_s7[] = "__";
+static char rs_s6[] = "n";
+static char rs_s8[] = "___";
+static char rs_s9[] = "____________________________________________";
+
+static char rs_s10[] = "";
+static char rs_s11[] = "";
+static char rs_s12[] = "";
+static char rs_s13[] = "";
+static char rs_s14[] = "";
+static char rs_s15[] = "";
+static char rs_s16[] = "";
+static char rs_s17[] = "";
+static char rs_s18[] = "";
+static char rs_s19[] = "";
+static char rs_s20[] = "";
+static char rs_s21[] = "";
+static char rs_s22[] = "";
+static char rs_s23[] = "";
+static char rs_s24[] = "";
+static char rs_s25[] = "";
+static char rs_s26[] = "";
+static char rs_s27[] = "";
+static char rs_s28[] = "";
+static char rs_s29[] = "";
+static char rs_s30[] = "";
+static char rs_s31[] = "";
+static char rs_s32[] = "";
+static char rs_s33[] = "";
+static char rs_s34[] = "";
+static char rs_s35[] = "";
+static char rs_s36[] = "";
+static char rs_s37[] = "";
+static char rs_s38[] = "";
+static char rs_s39[] = "";
+static char rs_s40[] = "";
+static char rs_s41[] = "";
+static char rs_s42[] = "";
+static char rs_s43[] = "";
+static char rs_s44[] = "";
+static char rs_s45[] = "-------------------";
+static char rs_s46[] = "-------------------";
+static char rs_s51[] = "03";
+static char rs_s47[] = "_____";
+static char rs_s48[] = "_____";
+static char rs_s49[] = "_____________________________________";
+static char rs_s50[] = "_____________________________________";
+static char rs_s52[] = "03";
+static char rs_s53[] = "03";
+static char rs_s54[] = "03";
+static char rs_s55[] = "____________________________________________";
+static char rs_s56[] = "____________________________________________";
+static char rs_s57[] = "____________________________________________";
+static char rs_s58[] = "____________________________________________";
+static char rs_s59[] = "____________________________________________";
+
+#define FLAGS11 0x0800
+#define FLAGS12 0x1000
+#define FLAGS13 0x2000
+#define FLAGS14 0x4000
+#define FLAGS15 0x8000
+#define STATE8 0x0100
+#define STATE9 0x0200
+#define STATE10 0x0400
+#define STATE11 0x0800
+#define STATE12 0x1000
+#define STATE13 0x2000
+#define STATE14 0x4000
+#define STATE15 0x8000
+
+#define RS_NTED 43
+
+static TEDINFO rs_tedinfo[] = {
+ "NetSurf",
+ rs_s0,
+ rs_s0,
+ SMALL, 6, TE_LEFT, 4352, 0, 0, 8, 1,
+
+ rs_s45,
+ "User: ___________________",
+ rs_s5,
+ IBM, 6, TE_CNTR, 4480, 0, -2, 20, 30,
+
+ rs_s46,
+ "Password: ___________________",
+ rs_s5,
+ IBM, 6, TE_CNTR, 4480, 0, -2, 20, 30,
+
+ "SSL Verify failed!",
+ rs_s0,
+ rs_s0,
+ IBM, 1, TE_LEFT, 4480, 10, -1, 19, 1,
+
+ "XY",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 3, 1,
+
+ "Text\0@@@@@@@@@@@@@@@@@@@@",
+ "Search : _________________________",
+ rs_s5,
+ IBM, 0, TE_LEFT, 4480, 0, -2, 26, 37,
+
+ "File",
+ rs_s0,
+ rs_s0,
+ SMALL, 6, TE_LEFT, 4352, 0, -1, 5, 1,
+
+ "100000 MB / 100000 MB",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4352, 0, -1, 22, 1,
+
+ "100%",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_RIGHT, 4352, 0, -1, 5, 1,
+
+ "99999 KB/s ",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_RIGHT, 4352, 0, -1, 12, 1,
+
+ " Cut",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 6, 1,
+
+ " Copy",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 7, 1,
+
+ " Paste",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 8, 1,
+
+ " Select All",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 13, 1,
+
+ "---------------------",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_CNTR, 4480, 0, -1, 22, 1,
+
+ " Open in new Window",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 21, 1,
+
+ " Copy Link",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 12, 1,
+
+ " Copy URL",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 11, 1,
+
+ " Save as...",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 13, 1,
+
+ " View source...",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 17, 1,
+
+ " Save link as...",
+ rs_s0,
+ rs_s0,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 18, 1,
+
+ "\0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",
+ "Homepage: ____________________________________________",
+ rs_s5,
+ IBM, 0, TE_LEFT, 4480, 10, -2, 45, 55,
+
+ rs_s51,
+ rs_s7,
+ rs_s6,
+ IBM, 0, TE_CNTR, 4480, 0, -2, 3, 3,
+
+ "Browser",
+ "_______",
+ rs_s5,
+ SMALL, 1, TE_CNTR, 4480, 9, 1, 8, 8,
+
+ "_______________________________",
+ "Proxy Host: _______________________________",
+ rs_s5,
+ IBM, 0, TE_LEFT, 4480, 0, -2, 32, 44,
+
+ rs_s47,
+ rs_s48,
+ rs_s6,
+ IBM, 0, TE_LEFT, 4480, 0, -2, 6, 6,
+
+ rs_s49,
+ "Username: _____________________________________",
+ rs_s5,
+ IBM, 0, TE_LEFT, 4480, 0, -2, 38, 50,
+
+ rs_s50,
+ "Password: _____________________________________",
+ rs_s5,
+ IBM, 0, TE_LEFT, 4480, 0, -2, 38, 50,
+
+ rs_s52,
+ rs_s7,
+ rs_s6,
+ IBM, 0, TE_LEFT, 4352, 0, -2, 3, 3,
+
+ rs_s53,
+ rs_s7,
+ rs_s6,
+ IBM, 0, TE_LEFT, 4352, 0, -2, 3, 3,
+
+ rs_s54,
+ rs_s7,
+ rs_s6,
+ IBM, 0, TE_LEFT, 4352, 0, -2, 3, 3,
+
+ "Network",
+ rs_s0,
+ rs_s0,
+ SMALL, 1, TE_CNTR, 4480, 9, -1, 8, 1,
+
+ "130",
+ rs_s8,
+ rs_s6,
+ IBM, 0, TE_LEFT, 4352, 0, -2, 4, 4,
+
+ "100",
+ rs_s8,
+ rs_s6,
+ IBM, 0, TE_LEFT, 4352, 0, -2, 4, 4,
+
+ "0.5",
+ rs_s8,
+ rs_s6,
+ IBM, 0, TE_LEFT, 4352, 0, -2, 4, 4,
+
+ "0350",
+ "____",
+ rs_s6,
+ IBM, 0, TE_LEFT, 4352, 0, -2, 5, 5,
+
+ "Rendering",
+ rs_s0,
+ rs_s0,
+ SMALL, 1, TE_CNTR, 4480, 9, -1, 10, 1,
+
+ rs_s55,
+ rs_s9,
+ rs_s5,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 45, 45,
+
+ rs_s56,
+ rs_s9,
+ rs_s5,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 45, 45,
+
+ rs_s57,
+ rs_s9,
+ rs_s5,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 45, 45,
+
+ rs_s58,
+ rs_s9,
+ rs_s5,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 45, 45,
+
+ rs_s59,
+ rs_s9,
+ rs_s5,
+ IBM, 6, TE_LEFT, 4480, 0, -1, 45, 45,
+
+ "Directories",
+ rs_s0,
+ rs_s0,
+ SMALL, 1, TE_CNTR, 4480, 9, -1, 12, 1
+};
+
+static int rs_b222img[] = {
+ 0x07ff,0xffff,0xff80,0x0c00,0x0000,0x00c0,0x183f,0xf03f,
+ 0xf060,0x187f,0xf860,0x1860,0x187f,0xf860,0x1860,0x187f,
+ 0xf860,0x1860,0x187f,0xf860,0x1860,0x187f,0xf860,0x1860,
+ 0x187f,0xf860,0x1860,0x187f,0xf860,0x1860,0x187f,0xf860,
+ 0x1860,0x187f,0xf860,0x1860,0x187f,0xf860,0x1860,0x187f,
+ 0xf860,0x1860,0x183f,0xf03f,0xf060,0x0c00,0x0000,0x00c0,
+ 0x07ff,0xffff,0xff80,0x0000,0x0000,0x0000,0x3f30,0xc787,
+ 0x8fe0,0x0c39,0xcccc,0xcc00,0x0c36,0xcfcc,0x0f80,0x0c30,
+ 0xcccd,0xcc00,0x3f30,0xccc7,0xcfe0,0x0000,0x0000,0x0000
+};
+
+static int rs_b221img[] = {
+ 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
+ 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
+};
+
+static int rs_b220img[] = {
+ 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
+ 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000,
+ 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
+ 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000,
+ 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
+ 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000,
+ 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
+ 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
+};
+
+static int rs_b219img[] = {
+ 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
+ 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
+};
+
+static int rs_b218img[] = {
+ 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
+ 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000,
+ 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
+ 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000,
+ 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
+ 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000,
+ 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
+ 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000
+};
+
+static int rs_b217img[] = {
+ 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
+ 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
+};
+
+static int rs_b216img[] = {
+ 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
+ 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
+};
+
+static int rs_b215img[] = {
+ 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
+ 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
+};
+
+static int rs_b214img[] = {
+ 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
+ 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000
+};
+
+static int rs_b213img[] = {
+ 0x0000,0x0180,0x0340,0x02c0,0x0560,0x06a0,0x0d50,0x0ab0,
+ 0x1558,0x1aa8,0x3554,0x2aac,0x5556,0x7ffe,0x0000,0x0000
+};
+
+static int rs_b212img[] = {
+ 0x0000,0x0180,0x03c0,0x03c0,0x07e0,0x07e0,0x0ff0,0x0ff0,
+ 0x1ff8,0x1ff8,0x3ffc,0x3ffc,0x7ffe,0x7ffe,0x0000,0x0000
+};
+
+static int rs_b211img[] = {
+ 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
+ 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
+};
+
+static int rs_b210img[] = {
+ 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
+ 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000,
+ 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
+ 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000,
+ 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
+ 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000,
+ 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
+ 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
+};
+
+static int rs_b209img[] = {
+ 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
+ 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
+};
+
+static int rs_b208img[] = {
+ 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
+ 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000,
+ 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
+ 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000,
+ 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
+ 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000,
+ 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
+ 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000
+};
+
+static int rs_b207img[] = {
+ 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
+ 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
+};
+
+static int rs_b206img[] = {
+ 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
+ 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
+};
+
+static int rs_b205img[] = {
+ 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
+ 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
+};
+
+static int rs_b204img[] = {
+ 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
+ 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000
+};
+
+static int rs_b203img[] = {
+ 0x0000,0x0000,0x7ffe,0x5556,0x2aac,0x3554,0x1aa8,0x1558,
+ 0x0ab0,0x0d50,0x06a0,0x0560,0x02c0,0x0340,0x0180,0x0000
+};
+
+static int rs_b202img[] = {
+ 0x0000,0x0000,0x7ffe,0x7ffe,0x3ffc,0x3ffc,0x1ff8,0x1ff8,
+ 0x0ff0,0x0ff0,0x07e0,0x07e0,0x03c0,0x03c0,0x0180,0x0000
+};
+
+static int rs_b201img[] = {
+ 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
+ 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
+};
+
+static int rs_b200img[] = {
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
+};
+
+static int rs_b199img[] = {
+ 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
+};
+
+static int rs_b198img[] = {
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe
+};
+
+static int rs_b197img[] = {
+ 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
+ 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
+};
+
+static int rs_b196img[] = {
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
+};
+
+static int rs_b195img[] = {
+ 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
+};
+
+static int rs_b194img[] = {
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe
+};
+
+static int rs_b193img[] = {
+ 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
+ 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
+};
+
+static int rs_b192img[] = {
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
+};
+
+static int rs_b191img[] = {
+ 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
+};
+
+static int rs_b190img[] = {
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe
+};
+
+static int rs_b189img[] = {
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6086,0x6146,0x6246,
+ 0x6286,0x6486,0x6706,0x6606,0x6406,0x6006,0x7ffe,0x7ffe
+};
+
+static int rs_b188img[] = {
+ 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
+};
+
+static int rs_b187img[] = {
+ 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
+ 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000
+};
+
+static int rs_b186img[] = {
+ 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
+ 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000,
+ 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
+ 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,
+ 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
+ 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,
+ 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
+ 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,
+ 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
+ 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000,
+ 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
+ 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000,
+ 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
+ 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000,
+ 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
+ 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000
+};
+
+static int rs_b185img[] = {
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8
+};
+
+static int rs_b184img[] = {
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
+ 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8,
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
+ 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8,
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
+ 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8,
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
+ 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8,
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
+ 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8
+};
+
+static int rs_b183img[] = {
+ 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
+ 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000
+};
+
+static int rs_b182img[] = {
+ 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
+ 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000,
+ 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
+ 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,
+ 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
+ 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,
+ 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
+ 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000
+};
+
+static int rs_b181img[] = {
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8
+};
+
+static int rs_b180img[] = {
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
+ 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8,
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8
+};
+
+static int rs_b179img[] = {
+ 0x0000,0x0380,0x0440,0x3ff8,0x1ff0,0x1ff0,0x1ff0,0x1ff0,
+ 0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000
+};
+
+static int rs_b178img[] = {
+ 0x0000,0x0380,0x0440,0x3ff8,0x1010,0x1550,0x1550,0x1550,
+ 0x1550,0x1550,0x1550,0x1550,0x1550,0x1010,0x1ff0,0x0000
+};
+
+static int rs_b177img[] = {
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8
+};
+
+static int rs_b176img[] = {
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
+ 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8
+};
+
+static int rs_b175img[] = {
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3018,0x3558,0x3558,0x3558,
+ 0x3558,0x3558,0x3558,0x3558,0x3558,0x3018,0x3ff8,0x3ff8
+};
+
+static int rs_b174img[] = {
+ 0x0380,0x0440,0x7ffc,0x7ffc,0x3ff8,0x3ff8,0x3ff8,0x3ff8,
+ 0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8,0x3ff8
+};
+
+static int rs_b173img[] = {
+ 0x0000,0x0000,0x1c00,0x3e00,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x0000
+};
+
+static int rs_b172img[] = {
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000
+};
+
+static int rs_b171img[] = {
+ 0x0000,0x3800,0x7c00,0xffff,0xffff,0xffff,0xffff,0xffff,
+ 0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff
+};
+
+static int rs_b170img[] = {
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff
+};
+
+static int rs_b169img[] = {
+ 0x0000,0x0000,0x1c00,0x3e00,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x0000
+};
+
+static int rs_b168img[] = {
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000,
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000
+};
+
+static int rs_b167img[] = {
+ 0x0000,0x3800,0x7c00,0xffff,0xffff,0xffff,0xffff,0xffff,
+ 0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff
+};
+
+static int rs_b166img[] = {
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff,
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff
+};
+
+static int rs_b165img[] = {
+ 0x0000,0x0000,0x1c00,0x3e00,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x0000
+};
+
+static int rs_b164img[] = {
+ 0x0000,0x0000,0x1c00,0x2200,0x41fe,0x4002,0x4002,0x4102,
+ 0x4102,0x47c2,0x4102,0x4102,0x4002,0x4002,0x7ffe,0x0000
+};
+
+static int rs_b163img[] = {
+ 0x0000,0x3800,0x7c00,0xffff,0xffff,0xffff,0xffff,0xffff,
+ 0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff
+};
+
+static int rs_b162img[] = {
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff
+};
+
+static int rs_b161img[] = {
+ 0x0000,0x3800,0x7c00,0xc7ff,0xc3ff,0xc003,0xc003,0xc103,
+ 0xc103,0xc7c3,0xc103,0xc103,0xc003,0xc003,0xffff,0xffff
+};
+
+static int rs_b160img[] = {
+ 0x0000,0x3800,0x7c00,0xffff,0xffff,0xffff,0xffff,0xffff,
+ 0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff
+};
+
+static int rs_b159img[] = {
+ 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
+ 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
+};
+
+static int rs_b158img[] = {
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
+};
+
+static int rs_b157img[] = {
+ 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
+};
+
+static int rs_b156img[] = {
+ 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
+ 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
+ 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
+ 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
+ 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b155img[] = {
+ 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
+ 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
+};
+
+static int rs_b154img[] = {
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000,
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
+};
+
+static int rs_b153img[] = {
+ 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
+};
+
+static int rs_b152img[] = {
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6006,0x6106,0x6106,
+ 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6006,0x6106,0x6106,
+ 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6006,0x6106,0x6106,
+ 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe,
+ 0x7fe0,0x7ff0,0x6028,0x6024,0x603e,0x6006,0x6106,0x6106,
+ 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe
+};
+
+static int rs_b151img[] = {
+ 0x0000,0x3fe0,0x3ff0,0x3ff8,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
+ 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x0000
+};
+
+static int rs_b150img[] = {
+ 0x0000,0x3fe0,0x2050,0x2048,0x2044,0x207c,0x2104,0x2104,
+ 0x27c4,0x2104,0x2104,0x2004,0x2004,0x2004,0x3ffc,0x0000
+};
+
+static int rs_b149img[] = {
+ 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
+};
+
+static int rs_b148img[] = {
+ 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
+ 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe
+};
+
+static int rs_b147img[] = {
+ 0x7fe0,0x7ff0,0x6068,0x6064,0x607e,0x607e,0x6106,0x6106,
+ 0x67c6,0x6106,0x6106,0x6006,0x6006,0x6006,0x7ffe,0x7ffe
+};
+
+static int rs_b146img[] = {
+ 0x7fe0,0x7ff0,0x7ff8,0x7ffc,0x7ffe,0x7ffe,0x7ffe,0x7ffe,
+ 0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe,0x7ffe
+};
+
+static int rs_b145img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b144img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b143img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b142img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b141img[] = {
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b140img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b139img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b138img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b137img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b136img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b135img[] = {
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b134img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b133img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b132img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
+ 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b131img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b130img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b129img[] = {
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
+ 0x481e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b128img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b127img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b126img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b125img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b124img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
+ 0x481e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b123img[] = {
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
+ 0x481e,0x781e,0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000
+};
+
+static int rs_b122img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b121img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b120img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
+ 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b119img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b118img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
+ 0x481e,0x781e,0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b117img[] = {
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
+ 0x481e,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000
+};
+
+static int rs_b116img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b115img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b114img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b113img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b112img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x481e,
+ 0x481e,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b111img[] = {
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x4812,
+ 0x4812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000
+};
+
+static int rs_b110img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b109img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b108img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b107img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b106img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1278,0x1278,0x1e78,0x0000,0x781e,0x4812,
+ 0x4812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b105img[] = {
+ 0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000,0x781e,0x4812,
+ 0x4812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000
+};
+
+static int rs_b104img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b103img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b102img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b101img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b100img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x4812,
+ 0x4812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b99img[] = {
+ 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x4812,
+ 0x4812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000
+};
+
+static int rs_b98img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b97img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b96img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
+ 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b95img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b94img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
+ 0x7812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b93img[] = {
+ 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
+ 0x7812,0x781e,0x0000,0x1e78,0x1248,0x1248,0x1e78,0x0000
+};
+
+static int rs_b92img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b91img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b90img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b89img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b88img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
+ 0x7812,0x781e,0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b87img[] = {
+ 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
+ 0x7812,0x781e,0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000
+};
+
+static int rs_b86img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b85img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b84img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
+ 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b83img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b82img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
+ 0x7812,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b81img[] = {
+ 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x7812,
+ 0x7812,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b80img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b79img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b78img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x1e00,0x1e00,0x1e00,0x1e00,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b77img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b76img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b75img[] = {
+ 0x0000,0x1e78,0x1e48,0x1e48,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b74img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b73img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b72img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x7800,0x7800,
+ 0x7800,0x7800,0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0078,0x0078,0x0078,0x0078,0x0000,0x001e,0x001e,
+ 0x001e,0x001e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b71img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b70img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b69img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b68img[] = {
+ 0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000,0x781e,0x781e,
+ 0x781e,0x781e,0x0000,0x1e78,0x1e78,0x1e78,0x1e78,0x0000
+};
+
+static int rs_b67img[] = {
+ 0xffff,0xfffe,0xffff,0xffff,0xc000,0x0003,0xc03f,0xe003,
+ 0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,
+ 0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,
+ 0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,
+ 0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,0xc01f,0xf003,
+ 0xc000,0x0003,0xc03f,0xe003,0xc03f,0xf003,0xc03f,0xf003,
+ 0xc03f,0xf003,0xc03f,0xf003,0xc03f,0xf003,0xc01f,0xf003,
+ 0xc000,0x0003,0xc000,0x0003,0xffff,0xffff,0x7fff,0xffff
+};
+
+static int rs_b66img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x0000,0x0000,0x0000,0x0000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0xffff,0xfffe,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
+ 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
+ 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
+ 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
+ 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
+ 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
+ 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,
+ 0x8000,0x0002,0x8000,0x0002,0xffff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b65img[] = {
+ 0x0000,0x0000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x0000,0x0000,0x0000,0x0000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000
+};
+
+static int rs_b64img[] = {
+ 0x0000,0x0000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x0000,0x0000,0x0000,0x0000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,
+ 0x001f,0xf000,0x001f,0xf000,0x001f,0xf000,0x001f,0xf000
+};
+
+static int rs_b63img[] = {
+ 0x0000,0x0000,0x0000,0x0038,0x007c,0x00fe,0x7ffe,0xfffe,
+ 0x7ffe,0x7ffe,0x2bfe,0x007c,0x0038,0x0000,0x0000,0x0000
+};
+
+static int rs_b62img[] = {
+ 0x0000,0x0000,0x0000,0x0038,0x004c,0x00be,0x7f3e,0xfffe,
+ 0x7ffe,0x7ffe,0x2bfe,0x007c,0x0038,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0038,0x004c,0x00be,0x7f3e,0xfffe,
+ 0x7ffe,0x7ffe,0x2bfe,0x007c,0x0038,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0038,0x0044,0x0082,0x7f12,0x8012,
+ 0x4012,0x5402,0x2b82,0x0044,0x0038,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0038,0x0044,0x0082,0x7f16,0x8016,
+ 0x47d6,0x7fd6,0x2bfe,0x007c,0x0038,0x0000,0x0000,0x0000
+};
+
+static int rs_b61img[] = {
+ 0x0000,0x0000,0x0000,0x0038,0x0044,0x0082,0x7f12,0x8012,
+ 0x4012,0x5412,0x2b82,0x0044,0x0038,0x0000,0x0000,0x0000
+};
+
+static int rs_b60img[] = {
+ 0x0000,0x0000,0x0000,0x0038,0x007c,0x00fe,0x7ffe,0xfffe,
+ 0x7ffe,0x7ffe,0x2bfe,0x007c,0x0038,0x0000,0x0000,0x0000
+};
+
+static int rs_b59img[] = {
+ 0x0000,0x0380,0x07c0,0x0fe0,0x0fe0,0x0fe0,0x07c0,0x0380,
+ 0x07c0,0x0fe0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,0x0000
+};
+
+static int rs_b58img[] = {
+ 0x0000,0x0380,0x04c0,0x09a0,0x0ba0,0x0b20,0x0640,0x0380,
+ 0x0440,0x0820,0x1010,0x1010,0x1010,0x1ff0,0x0000,0x0000,
+ 0x0000,0x0380,0x04c0,0x09a0,0x0ba0,0x0b20,0x0640,0x0380,
+ 0x05c0,0x0be0,0x17f0,0x17f0,0x1ff0,0x1ff0,0x0000,0x0000,
+ 0x0000,0x0380,0x04c0,0x09a0,0x0ba0,0x0b20,0x0640,0x0380,
+ 0x05c0,0x0be0,0x17f0,0x17f0,0x1ff0,0x1ff0,0x0000,0x0000,
+ 0x0000,0x0380,0x0440,0x0860,0x0860,0x08e0,0x05c0,0x0380,
+ 0x0440,0x0860,0x1030,0x1070,0x17f0,0x1ff0,0x0000,0x0000
+};
+
+static int rs_b57img[] = {
+ 0x0000,0x0380,0x0440,0x0820,0x0860,0x08a0,0x0540,0x0380,
+ 0x0540,0x0aa0,0x1570,0x1ab0,0x15f0,0x1ff0,0x0000,0x0000
+};
+
+static int rs_b56img[] = {
+ 0x0000,0x0380,0x07c0,0x0fe0,0x0fe0,0x0fe0,0x07c0,0x0380,
+ 0x07c0,0x0fe0,0x1ff0,0x1ff0,0x1ff0,0x1ff0,0x0000,0x0000
+};
+
+static int rs_b55img[] = {
+ 0x03e0,0x0ff8,0x1ffc,0x3ffe,0x3ffe,0x7fff,0x7fff,0x7fff,
+ 0x7fff,0x7fff,0x3ffe,0x3ffe,0x1ffc,0x0ff8,0x03e0,0x0000
+};
+
+static int rs_b54img[] = {
+ 0x03e0,0x0d18,0x1604,0x2d5a,0x3e4a,0x4c89,0x5679,0x4c01,
+ 0x6403,0x4009,0x2062,0x2702,0x1004,0x0c18,0x03e0,0x0000,
+ 0x03e0,0x0ff8,0x1ffc,0x3fde,0x3fce,0x7f8d,0x7ffd,0x7ffb,
+ 0x7fff,0x7fe9,0x2ef2,0x27a2,0x1144,0x0c18,0x03e0,0x0000,
+ 0x03e0,0x0ff8,0x1ffc,0x3fde,0x3fce,0x7f8d,0x7ffd,0x7ffb,
+ 0x7fff,0x7fe9,0x2ef2,0x27a2,0x1144,0x0c18,0x03e0,0x0000,
+ 0x03e0,0x0c18,0x1204,0x2002,0x2402,0x4403,0x4003,0x4405,
+ 0x4403,0x401f,0x316e,0x3f5e,0x1ebc,0x0ff8,0x03e0,0x0000
+};
+
+static int rs_b53img[] = {
+ 0x03e0,0x0ff8,0x1ffc,0x3ffe,0x3ffe,0x7fff,0x7fff,0x7fff,
+ 0x7fff,0x7fff,0x3ffe,0x3ffe,0x1ffc,0x0ff8,0x03e0,0x0000
+};
+
+static int rs_b52img[] = {
+ 0x0120,0x0838,0x100c,0x2006,0x2002,0x4001,0x0020,0x0001,
+ 0x4001,0x4005,0x310a,0x3a06,0x0a0c,0x0d18,0x0020,0x0000,
+ 0x03e0,0x0d18,0x1604,0x2d52,0x1e4a,0x4c8b,0x5673,0x4c05,
+ 0x6403,0x401b,0x2066,0x275a,0x04bc,0x0ef8,0x02e0,0x0000,
+ 0x0260,0x01c0,0x10d0,0x2908,0x1284,0x4080,0x5589,0x32e1,
+ 0x7380,0x7f03,0x0e8a,0x0004,0x1018,0x0550,0x03c0,0x0000,
+ 0x01a0,0x0730,0x1928,0x3b8c,0x1302,0x738a,0x3c2a,0x4114,
+ 0x2800,0x4015,0x1104,0x1858,0x0ea8,0x02a0,0x0000,0x0000,
+ 0x03c0,0x0fd8,0x09f4,0x1b8a,0x1386,0x338d,0x7dad,0x73fb,
+ 0x7bfd,0x3fe0,0x2e92,0x20a2,0x114c,0x0c18,0x03e0,0x0000,
+ 0x0180,0x0cd8,0x00d4,0x000a,0x0086,0x0009,0x01a8,0x72e0,
+ 0x1381,0x3f02,0x2e88,0x2006,0x1014,0x0948,0x0120,0x0000,
+ 0x0000,0x08e8,0x06dc,0x0456,0x2ccc,0x0c0f,0x03f6,0x3eee,
+ 0x17ff,0x3ffc,0x3ff4,0x3ffa,0x1fe4,0x0aa8,0x0120,0x0000,
+ 0x0000,0x0b08,0x0d24,0x1fda,0x1b48,0x3b89,0x3e78,0x0910,
+ 0x2801,0x0000,0x2000,0x2002,0x1004,0x0808,0x0120,0x0000
+};
+
+static int rs_b51img[] = {
+ 0x03e0,0x0c18,0x1224,0x2052,0x244a,0x4485,0x4059,0x4421,
+ 0x4403,0x400d,0x3062,0x2702,0x1004,0x0d18,0x03e0,0x0000
+};
+
+static int rs_b50img[] = {
+ 0x03e0,0x0ff8,0x1ffc,0x3ffe,0x3ffe,0x7fff,0x7fff,0x7fff,
+ 0x7fff,0x7fff,0x3ffe,0x3ffe,0x1ffc,0x0ff8,0x03e0,0x0000
+};
+
+static int rs_b49img[] = {
+ 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x03ff,0xff80,
+ 0x07ff,0xffc0,0x0fff,0xffe0,0x1fff,0xfff0,0x3fff,0xfff8,
+ 0x3fff,0xfff8,0x7fff,0xfffc,0x7fff,0xfffc,0x7fff,0xfffc,
+ 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,
+ 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0x7fff,0xfffc,
+ 0x7fff,0xfffc,0x7fff,0xfffc,0x3fff,0xfff8,0x3fff,0xfff8,
+ 0x1fff,0xfff0,0x0fff,0xffe0,0x07ff,0xffc0,0x03ff,0xff80,
+ 0x01ff,0xff00,0x007f,0xfc00,0x000f,0xe000,0x0000,0x0000
+};
+
+static int rs_b48img[] = {
+ 0x000f,0xe000,0x0070,0x1c00,0x0180,0x0300,0x0200,0x0080,
+ 0x0500,0x0040,0x0a00,0x0420,0x1000,0x2090,0x2000,0x0008,
+ 0x2600,0x0008,0x4600,0x0004,0x4400,0x8004,0x4000,0x0004,
+ 0x8000,0x0042,0x8000,0x0002,0x8600,0x0002,0x8200,0x0002,
+ 0x8000,0x0002,0x8000,0x0002,0x8000,0x0002,0x4000,0x0004,
+ 0x4300,0x0004,0x4300,0x00e4,0x2180,0x0108,0x3000,0x7808,
+ 0x151a,0x6810,0x0ef8,0x0020,0x0460,0x0040,0x0210,0x0080,
+ 0x0180,0x0300,0x007c,0x1c00,0x000f,0xe000,0x0000,0x0000,
+ 0x000f,0xe000,0x0074,0x1c00,0x01a9,0x0300,0x0224,0x4180,
+ 0x05d9,0x0840,0x0b54,0x04a0,0x1fe9,0x3090,0x2a94,0x40d8,
+ 0x3f69,0x40c8,0x6ed4,0xc00c,0x5552,0x8014,0x5548,0x002c,
+ 0x9551,0x014a,0xc888,0x6a36,0xa724,0x0496,0x8800,0x095a,
+ 0xa450,0x0456,0x8000,0x12be,0x8000,0x42aa,0x4000,0x156c,
+ 0x4200,0x92dc,0x4002,0x2b74,0x2148,0xa5d8,0x3405,0x3b78,
+ 0x13cf,0x32f0,0x0944,0xafa0,0x043b,0x5ac0,0x0365,0xbf80,
+ 0x01d5,0x7700,0x007b,0xbc00,0x000f,0xe000,0x0000,0x0000,
+ 0x000f,0xe000,0x0076,0xfc00,0x01ac,0x7f00,0x03a5,0x3f80,
+ 0x075b,0xb2c0,0x0f51,0x6260,0x1ca9,0x8030,0x2f96,0x8008,
+ 0x33e8,0x4008,0x6ed1,0x0014,0x5552,0x0004,0x5543,0x8044,
+ 0x955b,0xc042,0x98dd,0xc082,0xedaf,0xf102,0xa777,0xfe06,
+ 0xf7ff,0xe90a,0xfedf,0xea06,0xdbff,0xa812,0x7fff,0x520c,
+ 0x7efd,0xa80c,0x7df6,0x40ec,0x2a5a,0x91a8,0x3554,0xb858,
+ 0x1b2c,0x1150,0x08c0,0x00a0,0x0420,0x0b40,0x0220,0x2580,
+ 0x0180,0xab00,0x0074,0x5c00,0x000f,0xe000,0x0000,0x0000,
+ 0x000f,0xe000,0x007d,0x1c00,0x01fb,0x8300,0x03fe,0xc180,
+ 0x077d,0x4440,0x0dfe,0x9520,0x1cbf,0x2090,0x3ffd,0x0058,
+ 0x31ff,0xc0a8,0x7dfe,0x402c,0x7fff,0x8054,0x7ffc,0x402c,
+ 0xfff5,0x000a,0xefaa,0x7276,0xb574,0x0296,0xde88,0x095e,
+ 0xaa50,0x045e,0x8120,0x12ba,0xa400,0x42ba,0x4000,0x156c,
+ 0x4200,0x92d4,0x4302,0x2bfc,0x21c8,0xa438,0x3405,0x5328,
+ 0x1553,0x7bb0,0x0ef2,0xaf20,0x047b,0x51c0,0x0355,0x9a80,
+ 0x01d5,0xdf00,0x007f,0xfc00,0x000f,0xe000,0x0000,0x0000,
+ 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x037f,0xfe80,
+ 0x077f,0xf7c0,0x0fff,0xf760,0x1cbf,0xa0f0,0x3fff,0x8028,
+ 0x37ff,0xc0b8,0x7fff,0x4034,0x7fff,0x806c,0x7fff,0xc054,
+ 0xffff,0xc036,0xffff,0xf3ca,0xffff,0xfb6a,0xf9ff,0xf6a2,
+ 0xfdff,0xfba2,0xffff,0xed42,0xffff,0xbd46,0x7fff,0xea9c,
+ 0x7cff,0x6d24,0x7dfd,0xd4e4,0x3f37,0x5b88,0x3bfa,0xac88,
+ 0x1a2e,0xb410,0x0881,0x5060,0x0784,0xa440,0x02aa,0x4080,
+ 0x01aa,0x0300,0x007c,0x1c00,0x000f,0xe000,0x0000,0x0000,
+ 0x000f,0xe000,0x0072,0xfc00,0x0185,0x7f00,0x0381,0x7f80,
+ 0x0702,0xb2c0,0x0c05,0x6660,0x1000,0xa0b0,0x2502,0x8008,
+ 0x2481,0x0088,0x4405,0x4014,0x4400,0x8004,0x400b,0x8044,
+ 0x800a,0xc002,0xd055,0xa282,0xce8b,0xf102,0xaf77,0xfe06,
+ 0xd3af,0xe90a,0xfedf,0xea06,0xdbff,0xa812,0x7fff,0x5204,
+ 0x7cfd,0xa80c,0x7cf6,0x404c,0x2b5a,0x9028,0x3554,0x8058,
+ 0x1822,0x2150,0x0800,0x00a0,0x0400,0x0b40,0x0200,0x2580,
+ 0x0180,0xab00,0x0078,0x5c00,0x000f,0xe000,0x0000,0x0000,
+ 0x000f,0xe000,0x0072,0xfc00,0x0185,0x7f00,0x0281,0x7f80,
+ 0x0582,0xbbc0,0x0805,0x66e0,0x1340,0xb0f0,0x2002,0xc0f8,
+ 0x2c01,0x00d8,0x4405,0xc01c,0x4400,0x803c,0x400b,0x807c,
+ 0x800a,0xc13e,0xd055,0xabbe,0xce8b,0xfdfe,0xaf77,0xfffa,
+ 0xd3af,0xfff6,0xfedf,0xfffa,0xdbff,0xffea,0x7fff,0xfff4,
+ 0x7dff,0xfff4,0x7eff,0xff54,0x3eff,0xfe58,0x3fff,0xc7a8,
+ 0x1cf1,0xceb0,0x0f3f,0xff60,0x07df,0xf4c0,0x03df,0xda80,
+ 0x01ff,0x5700,0x0073,0xbc00,0x000f,0xe000,0x0000,0x0000,
+ 0x000f,0xe000,0x007d,0x1c00,0x01fa,0x8300,0x037e,0x8080,
+ 0x07fd,0x4c40,0x0ffa,0x95a0,0x1fff,0x3090,0x3ffd,0x4088,
+ 0x3ffe,0xc0e8,0x7ffa,0xc024,0x7fff,0x8044,0x7ff4,0x4004,
+ 0xfff5,0x0102,0xafaa,0x7a42,0xb574,0x0602,0xd488,0x0002,
+ 0xa850,0x0002,0x8120,0x0002,0xa400,0x0002,0x4000,0x0004,
+ 0x4000,0x0004,0x4000,0x0044,0x2000,0x0008,0x3000,0x0008,
+ 0x1000,0x0010,0x0800,0x0020,0x0400,0x0040,0x0200,0x0080,
+ 0x0180,0x0300,0x0070,0x1c00,0x000f,0xe000,0x0000,0x0000
+};
+
+static int rs_b47img[] = {
+ 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x03ff,0xff80,
+ 0x07ff,0xffc0,0x0fff,0xffe0,0x1fff,0xfff0,0x3fff,0xfff8,
+ 0x3fff,0xfff8,0x7fff,0xfffc,0x7fff,0xfffc,0x7fff,0xfffc,
+ 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,
+ 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0x7fff,0xfffc,
+ 0x7fff,0xfffc,0x7fff,0xfffc,0x3fff,0xfff8,0x3fff,0xfff8,
+ 0x1fff,0xfff0,0x0fff,0xffe0,0x07ff,0xffc0,0x03ff,0xff80,
+ 0x01ff,0xff00,0x007f,0xfc00,0x000f,0xe000,0x0000,0x0000
+};
+
+static int rs_b46img[] = {
+ 0x000f,0xe000,0x0074,0x1c00,0x01a9,0x0300,0x0324,0x4080,
+ 0x07d9,0x0840,0x0d54,0x04a0,0x1fe9,0x3090,0x2a94,0x4088,
+ 0x3d69,0x40c8,0x6cd4,0xc004,0x5552,0x8004,0x5540,0x0004,
+ 0x9551,0x0142,0xc888,0x6a02,0xa524,0x0402,0x8c00,0x0002,
+ 0xa450,0x0002,0x8000,0x0002,0x8000,0x0006,0x4000,0x0004,
+ 0x4200,0x0004,0x4100,0x0044,0x2100,0x0188,0x3000,0x3808,
+ 0x130e,0x2010,0x0840,0x0020,0x0420,0x0040,0x0220,0x0080,
+ 0x0180,0x0300,0x0070,0x1c00,0x000f,0xe000,0x0000,0x0000,
+ 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x037f,0xff80,
+ 0x07ff,0xffc0,0x0fff,0xf7e0,0x1fff,0xb0f0,0x3fff,0xc0a8,
+ 0x3fff,0xc0f8,0x7fff,0xc034,0x7fff,0x806c,0x7fff,0xc054,
+ 0xffff,0xc176,0xffff,0xfbca,0xffff,0xff6a,0xfdff,0xf6a6,
+ 0xfdff,0xfbaa,0xffff,0xed42,0xffff,0xbd56,0x7fff,0xea94,
+ 0x7eff,0x6d24,0x7dfd,0xd74c,0x3f37,0x5ba8,0x3bfa,0xbc88,
+ 0x1b2e,0xa510,0x0841,0x5060,0x07a4,0xa540,0x02aa,0x4080,
+ 0x01aa,0x8b00,0x0070,0x5c00,0x000f,0xe000,0x0000,0x0000,
+ 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x037f,0xff80,
+ 0x07ff,0xffc0,0x0fff,0xf7e0,0x1fff,0xb0f0,0x3fff,0xc0a8,
+ 0x3fff,0xc0f8,0x7fff,0xc034,0x7fff,0x806c,0x7fff,0xc054,
+ 0xffff,0xc176,0xffff,0xfbca,0xffff,0xff6a,0xfdff,0xf6a6,
+ 0xfdff,0xfbaa,0xffff,0xed42,0xffff,0xbd56,0x7fff,0xea94,
+ 0x7eff,0x6d24,0x7dfd,0xd74c,0x3f37,0x5ba8,0x3bfa,0xbc88,
+ 0x1b2e,0xa510,0x0841,0x5060,0x07a4,0xa540,0x02aa,0x4080,
+ 0x01aa,0x8b00,0x0070,0x5c00,0x000f,0xe000,0x0000,0x0000,
+ 0x000f,0xe000,0x0070,0x1c00,0x0180,0x0300,0x0280,0x0080,
+ 0x0500,0x0040,0x0800,0x0020,0x1000,0x0010,0x2000,0x0058,
+ 0x2400,0x0008,0x4400,0x000c,0x4400,0x0014,0x4000,0x002c,
+ 0x8000,0x000a,0x8000,0x0036,0x8400,0x0096,0x8600,0x095a,
+ 0x8600,0x0456,0x8000,0x12be,0x8000,0x42ae,0x4000,0x156c,
+ 0x4300,0x92dc,0x4302,0x28f4,0x21c8,0xa5d8,0x3405,0x7b78,
+ 0x17df,0x7af0,0x0ffe,0xafa0,0x047b,0x5ac0,0x0375,0xbf80,
+ 0x01d5,0x7700,0x007f,0xbc00,0x000f,0xe000,0x0000,0x0000
+};
+
+static int rs_b45img[] = {
+ 0x000f,0xe000,0x0070,0x1c00,0x0180,0x0300,0x0280,0x0080,
+ 0x0500,0x0840,0x0800,0x08a0,0x1000,0x7790,0x2000,0x2088,
+ 0x2400,0x2048,0x4400,0xc064,0x4400,0x2084,0x4000,0x2084,
+ 0x8000,0x3bc2,0x8000,0x6402,0x8400,0x0402,0x8400,0x0002,
+ 0x8400,0x0002,0x8000,0x0002,0x8000,0x0006,0x4000,0x000c,
+ 0x4200,0x0004,0x4100,0x0044,0x2100,0x0188,0x3000,0x1808,
+ 0x130e,0x6010,0x0840,0x0020,0x0420,0x0040,0x0220,0x0080,
+ 0x0180,0x0300,0x0070,0x1c00,0x000f,0xe000,0x0000,0x0000
+};
+
+static int rs_b44img[] = {
+ 0x000f,0xe000,0x007f,0xfc00,0x01ff,0xff00,0x03ff,0xff80,
+ 0x07ff,0xffc0,0x0fff,0xffe0,0x1fff,0xfff0,0x3fff,0xfff8,
+ 0x3fff,0xfff8,0x7fff,0xfffc,0x7fff,0xfffc,0x7fff,0xfffc,
+ 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,
+ 0xffff,0xfffe,0xffff,0xfffe,0xffff,0xfffe,0x7fff,0xfffc,
+ 0x7fff,0xfffc,0x7fff,0xfffc,0x3fff,0xfff8,0x3fff,0xfff8,
+ 0x1fff,0xfff0,0x0fff,0xffe0,0x07ff,0xffc0,0x03ff,0xff80,
+ 0x01ff,0xff00,0x007f,0xfc00,0x000f,0xe000,0x0000,0x0000
+};
+
+static int rs_b43img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0x0003,
+ 0x4007,0xe003,0x4007,0xf203,0x4007,0xfe03,0x4000,0x7e03,
+ 0x4000,0x3e03,0x407e,0x3e03,0x407c,0x7e03,0x407c,0x0003,
+ 0x407e,0x0003,0x407f,0xc003,0x404f,0xc003,0x4007,0xc003,
+ 0x4000,0x0003,0x4000,0x0003,0x4000,0x0003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b42img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4007,0xe002,
+ 0x4007,0xf202,0x4007,0xfe02,0x4000,0x7e02,0x4000,0x3e02,
+ 0x407e,0x3e02,0x407c,0x7e02,0x407c,0x0002,0x407e,0x0002,
+ 0x407f,0xc002,0x404f,0xc002,0x4007,0xc002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b41img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0x0003,
+ 0x4007,0xe003,0x4007,0xf303,0x4007,0xff03,0x4007,0xff03,
+ 0x4000,0x3f03,0x407f,0xbf03,0x407f,0x7f03,0x407e,0x7f03,
+ 0x407e,0x0003,0x407f,0xe003,0x407f,0xe003,0x4067,0xe003,
+ 0x4047,0xe003,0x4000,0x0003,0x4000,0x0003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b40img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0007,0xe000,0x0007,0xf200,0x0007,0xfe00,0x0000,0x7e00,
+ 0x0000,0x3e00,0x007e,0x3e00,0x007c,0x7e00,0x007c,0x0000,
+ 0x007e,0x0000,0x007f,0xc000,0x004f,0xc000,0x0007,0xc000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4007,0xe002,
+ 0x4007,0xf202,0x4007,0xfe02,0x4000,0x7e02,0x4000,0x3e02,
+ 0x407e,0x3e02,0x407c,0x7e02,0x407c,0x0002,0x407e,0x0002,
+ 0x407f,0xc002,0x404f,0xc002,0x4007,0xc002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b39img[] = {
+ 0x7fff,0xfffe,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4007,0xe002,0x4007,0xf202,0x4007,0xfe02,0x4000,0x7e02,
+ 0x4000,0x3e02,0x407e,0x3e02,0x407c,0x7e02,0x407c,0x0002,
+ 0x407e,0x0002,0x407f,0xc002,0x404f,0xc002,0x4007,0xc002,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,
+ 0x0000,0x0000
+};
+
+static int rs_b38img[] = {
+ 0x7fff,0xfffe,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b37img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0x0003,
+ 0x4030,0x1803,0x4078,0x3c03,0x407c,0x7c03,0x403e,0xf803,
+ 0x401f,0xf003,0x400f,0xe003,0x4007,0xc003,0x400f,0xe003,
+ 0x401f,0xf003,0x403e,0xf803,0x407c,0x7c03,0x4078,0x3c03,
+ 0x4030,0x1803,0x4000,0x0003,0x4000,0x0003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b36img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4030,0x1802,
+ 0x4078,0x3c02,0x407c,0x7c02,0x403e,0xf802,0x401f,0xf002,
+ 0x400f,0xe002,0x4007,0xc002,0x400f,0xe002,0x401f,0xf002,
+ 0x403e,0xf802,0x407c,0x7c02,0x4078,0x3c02,0x4030,0x1802,
+ 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b35img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0x0003,
+ 0x4030,0x1803,0x4078,0x3e03,0x407c,0x7e03,0x403e,0xfe03,
+ 0x401f,0xfc03,0x400f,0xf803,0x4007,0xf003,0x400f,0xe003,
+ 0x401f,0xf003,0x403f,0xf803,0x407f,0x7c03,0x407e,0x3e03,
+ 0x403c,0x1e03,0x4038,0x1c03,0x4000,0x0003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b34img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0030,0x1800,0x0078,0x3c00,0x007c,0x7c00,0x003e,0xf800,
+ 0x001f,0xf000,0x000f,0xe000,0x0007,0xc000,0x000f,0xe000,
+ 0x001f,0xf000,0x003e,0xf800,0x007c,0x7c00,0x0078,0x3c00,
+ 0x0030,0x1800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b33img[] = {
+ 0x7fff,0xfffe,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4030,0x1802,0x4078,0x3c02,0x407c,0x7c02,0x403e,0xf802,
+ 0x401f,0xf002,0x400f,0xe002,0x4007,0xc002,0x400f,0xe002,
+ 0x401f,0xf002,0x403e,0xf802,0x407c,0x7c02,0x4078,0x3c02,
+ 0x4030,0x1802,0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,
+ 0x0000,0x0000
+};
+
+static int rs_b32img[] = {
+ 0x7fff,0xfffe,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b31img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x0003,
+ 0x4001,0x8003,0x4001,0xc003,0x4001,0xe003,0x4001,0xf003,
+ 0x407f,0xf803,0x407f,0xfc03,0x407f,0xfe03,0x407f,0xfc03,
+ 0x407f,0xf803,0x4001,0xf003,0x4001,0xe003,0x4001,0xc003,
+ 0x4001,0x8003,0x4001,0x0003,0x4000,0x0003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b30img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
+ 0x4000,0x0002,0x4000,0x0002,0x4001,0x0002,0x4001,0x8002,
+ 0x4001,0xc002,0x4001,0xe002,0x4001,0xf002,0x407f,0xf802,
+ 0x407f,0xfc02,0x407f,0xfe02,0x407f,0xfc02,0x407f,0xf802,
+ 0x4001,0xf002,0x4001,0xe002,0x4001,0xc002,0x4001,0x8002,
+ 0x4001,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b29img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x0003,
+ 0x4001,0x8003,0x4001,0xc003,0x4001,0xe003,0x4001,0xf003,
+ 0x407f,0xf803,0x407f,0xfc03,0x407f,0xfe03,0x407f,0xff03,
+ 0x407f,0xfe03,0x407f,0xfc03,0x4001,0xf803,0x4001,0xf003,
+ 0x4001,0xe003,0x4001,0xc003,0x4001,0x8003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b28img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0001,0x0000,0x0001,0x8000,0x0001,0xc000,
+ 0x0001,0xe000,0x0001,0xf000,0x007f,0xf800,0x007f,0xfc00,
+ 0x007f,0xfe00,0x007f,0xfc00,0x007f,0xf800,0x0001,0xf000,
+ 0x0001,0xe000,0x0001,0xc000,0x0001,0x8000,0x0001,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b27img[] = {
+ 0x7fff,0xfffe,0x4000,0x0002,0x4000,0x0002,0x4001,0x0002,
+ 0x4001,0x8002,0x4001,0x4002,0x4001,0x2002,0x407f,0x1002,
+ 0x4040,0x0802,0x4040,0x0402,0x406a,0xaa02,0x4055,0x5402,
+ 0x406a,0xa802,0x407f,0x5002,0x4001,0xa002,0x4001,0x4002,
+ 0x4001,0x8002,0x4001,0x0002,0x4000,0x0002,0x7fff,0xfffe,
+ 0x0000,0x0000
+};
+
+static int rs_b26img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x0003,
+ 0x4001,0x8003,0x4001,0xc003,0x4001,0xe003,0x407f,0xf003,
+ 0x407f,0xf803,0x407f,0xfc03,0x407f,0xfe03,0x407f,0xfc03,
+ 0x407f,0xf803,0x407f,0xf003,0x4001,0xe003,0x4001,0xc003,
+ 0x4001,0x8003,0x4001,0x0003,0x4000,0x0003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b25img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x1c03,
+ 0x4003,0x9c03,0x4007,0xdc03,0x400f,0xfc03,0x401f,0xfc03,
+ 0x403f,0xfc03,0x407f,0xfc03,0x40ff,0xfe03,0x41ff,0xff03,
+ 0x41ff,0xff03,0x40ff,0xfe03,0x40ff,0xfe03,0x40ff,0xfe03,
+ 0x40ff,0xfe03,0x4000,0x0003,0x4000,0x0003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b24img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0001,0x0800,0x0003,0x8800,0x0006,0xc800,0x000d,0x6800,
+ 0x001b,0xb000,0x0037,0xd800,0x006f,0xec00,0x00d8,0x3600,
+ 0x003b,0xb800,0x007b,0xbc00,0x007b,0xbc00,0x007b,0xbc00,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0001,0x0800,0x0003,0x8800,0x0006,0xc800,
+ 0x000d,0x6800,0x001b,0xb000,0x0037,0xd800,0x006f,0xec00,
+ 0x00d8,0x3600,0x003b,0xb800,0x007b,0xbc00,0x007b,0xbc00,
+ 0x007b,0xbc00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0001,0x0800,0x0003,0x8800,
+ 0x0006,0xc800,0x000d,0x6800,0x001b,0xb000,0x0037,0xd800,
+ 0x006f,0xec00,0x00d8,0x3600,0x003b,0xb800,0x007b,0xbc00,
+ 0x007b,0xbc00,0x007b,0xbc00,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
+ 0x4000,0x0002,0x4000,0x0002,0x4001,0x1c02,0x4002,0x9402,
+ 0x4004,0x5402,0x4009,0x3402,0x4012,0x9402,0x4024,0x4c02,
+ 0x4048,0x2402,0x4090,0x1202,0x4127,0xc902,0x41c4,0x4702,
+ 0x4084,0x4202,0x4084,0x4202,0x4084,0x4202,0x40ff,0xfe02,
+ 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b23img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x1c03,
+ 0x4003,0x9e03,0x4007,0xde03,0x400f,0xfe03,0x401f,0xfe03,
+ 0x403f,0xfe03,0x407f,0xfe03,0x40ff,0xfe03,0x41ff,0xff03,
+ 0x41ff,0xff83,0x40ff,0xff83,0x40ff,0xff03,0x40ff,0xff03,
+ 0x40ff,0xff03,0x407f,0xff03,0x4000,0x0003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b22img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,0x1c00,
+ 0x0003,0x9c00,0x0007,0xdc00,0x000f,0xfc00,0x001e,0xfc00,
+ 0x003c,0x7c00,0x0078,0x3c00,0x00f0,0x1e00,0x01e7,0xcf00,
+ 0x01c7,0xc700,0x0087,0xc200,0x0087,0xc200,0x0087,0xc200,
+ 0x00ff,0xfe00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0001,0x1c00,0x0003,0x9400,0x0007,0xd400,0x000f,0xf400,
+ 0x001e,0xf400,0x003c,0x7c00,0x0078,0x3c00,0x00f0,0x1e00,
+ 0x01e7,0xcf00,0x01c7,0xc700,0x0087,0xc200,0x0087,0xc200,
+ 0x0087,0xc200,0x00ff,0xfe00,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0001,0x1c00,0x0002,0x9400,0x0004,0x5400,
+ 0x0009,0x3400,0x0012,0x9400,0x0024,0x4c00,0x0048,0x2400,
+ 0x0090,0x1200,0x0127,0xc900,0x01c4,0x4700,0x0084,0x4200,
+ 0x0084,0x4200,0x0084,0x4200,0x00ff,0xfe00,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
+ 0x4000,0x0002,0x4000,0x0002,0x4001,0x1c02,0x4002,0x9602,
+ 0x4004,0x5602,0x4009,0x3602,0x4013,0x9602,0x4026,0xce02,
+ 0x404c,0x6602,0x4098,0x3202,0x4137,0xd902,0x41e7,0xcf82,
+ 0x4087,0xc382,0x4087,0xc302,0x4087,0xc302,0x40ff,0xff02,
+ 0x407f,0xff02,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b21img[] = {
+ 0x7fff,0xfffe,0x4000,0x0002,0x4000,0x0002,0x4001,0x1c02,
+ 0x4002,0x9c02,0x4004,0x5c02,0x4009,0x3c02,0x4012,0x9c02,
+ 0x4024,0x4c02,0x4048,0x2402,0x4090,0x1202,0x4120,0x0902,
+ 0x41c7,0xc702,0x4087,0xc202,0x4087,0xc202,0x4087,0xc202,
+ 0x4087,0xc202,0x40ff,0xfe02,0x4000,0x0002,0x7fff,0xfffe,
+ 0x0000,0x0000
+};
+
+static int rs_b20img[] = {
+ 0x7fff,0xfffe,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b19img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0x8003,
+ 0x4001,0x8003,0x4003,0x8003,0x4007,0x8003,0x400f,0x8003,
+ 0x401f,0xfe03,0x403f,0xfe03,0x407f,0xfe03,0x403f,0xfe03,
+ 0x401f,0xfe03,0x400f,0x8003,0x4007,0x8003,0x4003,0x8003,
+ 0x4001,0x8003,0x4000,0x8003,0x4000,0x0003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b18img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x8002,0x4001,0x8002,
+ 0x4003,0x8002,0x4007,0x8002,0x400f,0x8002,0x401f,0xfe02,
+ 0x403f,0xfe02,0x407f,0xfe02,0x403f,0xfe02,0x401f,0xfe02,
+ 0x400f,0x8002,0x4007,0x8002,0x4003,0x8002,0x4001,0x8002,
+ 0x4000,0x8002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b17img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4000,0xc003,
+ 0x4001,0xc003,0x4003,0xc003,0x4007,0xc003,0x400f,0xc003,
+ 0x401f,0xff03,0x403f,0xff03,0x407f,0xff03,0x403f,0xff03,
+ 0x401f,0xff03,0x400f,0xff03,0x4007,0xc003,0x4003,0xc003,
+ 0x4001,0xc003,0x4000,0xc003,0x4000,0x4003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b16img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x8000,0x0001,0x8000,0x0003,0x8000,
+ 0x0007,0x8000,0x000f,0x8000,0x001f,0xfe00,0x003f,0xfe00,
+ 0x007f,0xfe00,0x003f,0xfe00,0x001f,0xfe00,0x000f,0x8000,
+ 0x0007,0x8000,0x0003,0x8000,0x0001,0x8000,0x0000,0x8000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x7fff,0xfffe,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,0x4000,0x0002,
+ 0x4000,0x0002,0x4000,0x0002,0x7fff,0xfffe,0x0000,0x0000
+};
+
+static int rs_b15img[] = {
+ 0x7fff,0xfffe,0x4000,0x0002,0x4000,0x0002,0x4001,0x0002,
+ 0x4003,0x0002,0x4005,0x0002,0x4009,0x0002,0x4011,0xfc02,
+ 0x4020,0x0402,0x4040,0x0402,0x40aa,0xac02,0x4055,0x5402,
+ 0x402a,0xac02,0x4015,0xfc02,0x400b,0x0002,0x4005,0x0002,
+ 0x4003,0x0002,0x4001,0x0002,0x4000,0x0002,0x7fff,0xfffe,
+ 0x0000,0x0000
+};
+
+static int rs_b14img[] = {
+ 0x7fff,0xfffe,0x4000,0x0003,0x4000,0x0003,0x4001,0x0003,
+ 0x4003,0x0003,0x4007,0x0003,0x400f,0x0003,0x401f,0xfc03,
+ 0x403f,0xfc03,0x407f,0xfc03,0x40ff,0xfc03,0x407f,0xfc03,
+ 0x403f,0xfc03,0x401f,0xfc03,0x400f,0x0003,0x4007,0x0003,
+ 0x4003,0x0003,0x4001,0x0003,0x4000,0x0003,0x7fff,0xffff,
+ 0x3fff,0xffff
+};
+
+static int rs_b13img[] = {
+ 0x0000,0x3ffc,0x2004,0x2ff4,0x2004,0x3ffc,0x303c,0x3ffc,
+ 0x2004,0x2ff4,0x2004,0x2fe4,0x2004,0x2ff4,0x2004,0x3ffc
+};
+
+static int rs_b12img[] = {
+ 0x0000,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,
+ 0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc,0x3ffc
+};
+
+static int rs_b11img[] = {
+ 0x0000,0x0000,0x0180,0x03c0,0x07e0,0x0ff0,0x0180,0x0180,
+ 0x0180,0x0180,0x0180,0x0ff0,0x07e0,0x03c0,0x0180,0x0000
+};
+
+static int rs_b10img[] = {
+ 0x0000,0x0180,0x03c0,0x07e0,0x0ff0,0x1ff8,0x0ff0,0x03c0,
+ 0x03c0,0x03c0,0x0ff0,0x1ff8,0x0ff0,0x07e0,0x03c0,0x0180
+};
+
+static int rs_b9img[] = {
+ 0x0000,0x0000,0x0000,0x0000,0x0810,0x1818,0x381c,0x7ffe,
+ 0x7ffe,0x381c,0x1818,0x0810,0x0000,0x0000,0x0000,0x0000
+};
+
+static int rs_b8img[] = {
+ 0x0000,0x0000,0x0000,0x0810,0x1c38,0x3c3c,0x7ffe,0xffff,
+ 0xffff,0x7ffe,0x3c3c,0x1c38,0x0810,0x0000,0x0000,0x0000
+};
+
+static int rs_b7img[] = {
+ 0x0000,0x0000,0x1008,0x381c,0x1c38,0x0e70,0x07e0,0x03c0,
+ 0x03c0,0x07e0,0x0e70,0x1c38,0x381c,0x1008,0x0000,0x0000
+};
+
+static int rs_b6img[] = {
+ 0x0000,0x1008,0x381c,0x7c3e,0x3e7c,0x1ff8,0x0ff0,0x07e0,
+ 0x07e0,0x0ff0,0x1ff8,0x3e3c,0x7c3e,0x381c,0x1008,0x0000
+};
+
+static int rs_b5img[] = {
+ 0x0000,0x4000,0x60fe,0x7082,0x78c6,0x7c6c,0x7e38,0x7f38,
+ 0x7fc4,0x7c82,0x6cfe,0x46fe,0x0600,0x0300,0x0300,0x0000
+};
+
+static int rs_b4img[] = {
+ 0xc000,0xe0fe,0xf1ff,0xf9ff,0xfdff,0xfefe,0xff7c,0xfffc,
+ 0xfffe,0xffff,0xffff,0xefff,0xcffe,0x8780,0x0780,0x0380
+};
+
+static int rs_b3img[] = {
+ 0x0000,0x4000,0x60f0,0x71f8,0x7b1c,0x7e3e,0x7e76,0x7ee6,
+ 0x7fc6,0x7f8c,0x6df8,0x46f0,0x0600,0x0300,0x0300,0x0000
+};
+
+static int rs_b2img[] = {
+ 0xc000,0xe0f0,0xf1f8,0xfbfc,0xfffe,0xffff,0xffff,0xffff,
+ 0xffff,0xfffe,0xfffc,0xeff8,0xcff0,0x8780,0x0780,0x0380
+};
+
+static int rs_b1img[] = {
+ 0x0000,0x4000,0x603c,0x707e,0x786e,0x7c1c,0x7e38,0x7f76,
+ 0x7ffe,0x7c3c,0x6c00,0x4618,0x0618,0x0300,0x0300,0x0000
+};
+
+static int rs_b0img[] = {
+ 0xc000,0xe03c,0xf03e,0xf8ff,0xfcff,0xfe7e,0xff7e,0xffff,
+ 0xffff,0xfffe,0xfe3c,0xff3c,0xcf3c,0x8798,0x0780,0x0380
+};
+
+#define RS_NBITBLK 1
+
+static BITBLK rs_bitblk[] = {
+ rs_b222img, 6, 24, 0, 0, 1
+};
+
+#define RS_NICNBLK 7
+
+static ICONBLK rs_icnblk[] = {
+ rs_b0img, rs_b1img, rs_s10, 4096, 0, 0,
+ 0, 0, 16, 16, 8, 2, 0, 0,
+
+ rs_b2img, rs_b3img, rs_s11, 4096, 0, 0,
+ 0, 0, 16, 16, 8, 2, 0, 0,
+
+ rs_b4img, rs_b5img, rs_s12, 4096, 0, 0,
+ 0, 0, 16, 16, 8, 2, 0, 0,
+
+ rs_b6img, rs_b7img, rs_s13, 4096, 6, 6,
+ 0, 0, 16, 16, 7, 8, 0, 0,
+
+ rs_b8img, rs_b9img, rs_s14, 4096, 8, 8,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+
+ rs_b10img, rs_b11img, rs_s15, 4096, 8, 8,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+
+ rs_b12img, rs_b13img, rs_s16, 4096, 7, 8,
+ 0, 0, 16, 16, 5, 5, 0, 0
+};
+
+static CICON rs_cicon[] = {
+#define CI0 0
+/* CICON 0 */
+ 4, rs_b16img, rs_b17img, rs_b18img, rs_b19img, 0L,
+
+#define CI1 1
+/* CICON 1 */
+ 4, rs_b22img, rs_b23img, rs_b24img, rs_b25img, 0L,
+
+#define CI2 2
+/* CICON 2 */
+ 4, rs_b28img, rs_b29img, rs_b30img, rs_b31img, 0L,
+
+#define CI3 3
+/* CICON 3 */
+ 4, rs_b34img, rs_b35img, rs_b36img, rs_b37img, 0L,
+
+#define CI4 4
+/* CICON 4 */
+ 4, rs_b40img, rs_b41img, rs_b42img, rs_b43img, 0L,
+
+#define CI5 5
+/* CICON 5 */
+ 4, rs_b46img, rs_b47img, 0L, 0L, &rs_cicon[6],
+ 8, rs_b48img, rs_b49img, 0L, 0L, 0L,
+
+#define CI6 7
+/* CICON 6 */
+ 8, rs_b52img, rs_b53img, 0L, 0L, &rs_cicon[8],
+ 4, rs_b54img, rs_b55img, 0L, 0L, 0L,
+
+#define CI7 9
+/* CICON 7 */
+ 4, rs_b58img, rs_b59img, 0L, 0L, 0L,
+
+#define CI8 10
+/* CICON 8 */
+ 4, rs_b62img, rs_b63img, 0L, 0L, 0L,
+
+#define CI9 11
+/* CICON 9 */
+ 4, rs_b66img, rs_b67img, 0L, 0L, 0L,
+
+#define CI10 12
+/* CICON 10 */
+ 4, rs_b70img, rs_b71img, 0L, 0L, &rs_cicon[13],
+ 8, rs_b72img, rs_b73img, 0L, 0L, 0L,
+
+#define CI11 14
+/* CICON 11 */
+ 4, rs_b76img, rs_b77img, 0L, 0L, &rs_cicon[15],
+ 8, rs_b78img, rs_b79img, 0L, 0L, 0L,
+
+#define CI12 16
+/* CICON 12 */
+ 4, rs_b82img, rs_b83img, 0L, 0L, &rs_cicon[17],
+ 8, rs_b84img, rs_b85img, 0L, 0L, 0L,
+
+#define CI13 18
+/* CICON 13 */
+ 4, rs_b88img, rs_b89img, 0L, 0L, &rs_cicon[19],
+ 8, rs_b90img, rs_b91img, 0L, 0L, 0L,
+
+#define CI14 20
+/* CICON 14 */
+ 4, rs_b94img, rs_b95img, 0L, 0L, &rs_cicon[21],
+ 8, rs_b96img, rs_b97img, 0L, 0L, 0L,
+
+#define CI15 22
+/* CICON 15 */
+ 4, rs_b100img, rs_b101img, 0L, 0L, &rs_cicon[23],
+ 8, rs_b102img, rs_b103img, 0L, 0L, 0L,
+
+#define CI16 24
+/* CICON 16 */
+ 4, rs_b106img, rs_b107img, 0L, 0L, &rs_cicon[25],
+ 8, rs_b108img, rs_b109img, 0L, 0L, 0L,
+
+#define CI17 26
+/* CICON 17 */
+ 4, rs_b112img, rs_b113img, 0L, 0L, &rs_cicon[27],
+ 8, rs_b114img, rs_b115img, 0L, 0L, 0L,
+
+#define CI18 28
+/* CICON 18 */
+ 4, rs_b118img, rs_b119img, 0L, 0L, &rs_cicon[29],
+ 8, rs_b120img, rs_b121img, 0L, 0L, 0L,
+
+#define CI19 30
+/* CICON 19 */
+ 4, rs_b124img, rs_b125img, 0L, 0L, &rs_cicon[31],
+ 8, rs_b126img, rs_b127img, 0L, 0L, 0L,
+
+#define CI20 32
+/* CICON 20 */
+ 4, rs_b130img, rs_b131img, 0L, 0L, &rs_cicon[33],
+ 8, rs_b132img, rs_b133img, 0L, 0L, 0L,
+
+#define CI21 34
+/* CICON 21 */
+ 4, rs_b136img, rs_b137img, 0L, 0L, &rs_cicon[35],
+ 8, rs_b138img, rs_b139img, 0L, 0L, 0L,
+
+#define CI22 36
+/* CICON 22 */
+ 4, rs_b142img, rs_b143img, 0L, 0L, &rs_cicon[37],
+ 8, rs_b144img, rs_b145img, 0L, 0L, 0L,
+
+#define CI23 38
+/* CICON 23 */
+ 1, rs_b148img, rs_b149img, rs_b150img, rs_b151img, &rs_cicon[39],
+ 4, rs_b152img, rs_b153img, rs_b154img, rs_b155img, &rs_cicon[40],
+ 8, rs_b156img, rs_b157img, rs_b158img, rs_b159img, 0L,
+
+#define CI24 41
+/* CICON 24 */
+ 1, rs_b162img, rs_b163img, rs_b164img, rs_b165img, &rs_cicon[42],
+ 4, rs_b166img, rs_b167img, rs_b168img, rs_b169img, &rs_cicon[43],
+ 8, rs_b170img, rs_b171img, rs_b172img, rs_b173img, 0L,
+
+#define CI25 44
+/* CICON 25 */
+ 1, rs_b176img, rs_b177img, rs_b178img, rs_b179img, &rs_cicon[45],
+ 4, rs_b180img, rs_b181img, rs_b182img, rs_b183img, &rs_cicon[46],
+ 8, rs_b184img, rs_b185img, rs_b186img, rs_b187img, 0L,
+
+#define CI26 47
+/* CICON 26 */
+ 1, rs_b190img, rs_b191img, rs_b192img, rs_b193img, &rs_cicon[48],
+ 4, rs_b194img, rs_b195img, rs_b196img, rs_b197img, &rs_cicon[49],
+ 8, rs_b198img, rs_b199img, rs_b200img, rs_b201img, 0L,
+
+#define CI27 50
+/* CICON 27 */
+ 1, rs_b204img, rs_b205img, rs_b206img, rs_b207img, &rs_cicon[51],
+ 4, rs_b208img, rs_b209img, rs_b210img, rs_b211img, 0L,
+
+#define CI28 52
+/* CICON 28 */
+ 1, rs_b214img, rs_b215img, rs_b216img, rs_b217img, &rs_cicon[53],
+ 4, rs_b218img, rs_b219img, rs_b220img, rs_b221img, 0L
+};
+
+#define RS_NCICNBLK 29
+
+static CICONBLK rs_ciconblk[] = {
+ rs_b14img, rs_b15img, rs_s17, 4096, 0, 0,
+ 0, 0, 32, 21, 12, 7, 0, 0,
+ &rs_cicon[CI0],
+
+ rs_b20img, rs_b21img, rs_s18, 4096, 0, 0,
+ 0, 0, 32, 21, 13, 7, 0, 0,
+ &rs_cicon[CI1],
+
+ rs_b26img, rs_b27img, rs_s19, 4096, 0, 0,
+ 0, 0, 32, 21, 14, 7, 0, 0,
+ &rs_cicon[CI2],
+
+ rs_b32img, rs_b33img, rs_s20, 4096, 0, 0,
+ 0, 0, 32, 21, 13, 7, 0, 0,
+ &rs_cicon[CI3],
+
+ rs_b38img, rs_b39img, rs_s21, 4096, 0, 0,
+ 0, 0, 32, 21, 13, 7, 0, 0,
+ &rs_cicon[CI4],
+
+ rs_b44img, rs_b45img, rs_s22, 4096, 0, 0,
+ 0, 0, 32, 32, 13, 13, 0, 0,
+ &rs_cicon[CI5],
+
+ rs_b50img, rs_b51img, "FAVICON", 4096, 0, 0,
+ 28, 0, 16, 16, 0, 16, 72, 8,
+ &rs_cicon[CI6],
+
+ rs_b56img, rs_b57img, rs_s23, 4096, 5, 6,
+ 0, 0, 16, 16, 5, 5, 6, 8,
+ &rs_cicon[CI7],
+
+ rs_b60img, rs_b61img, rs_s24, 4096, 5, 6,
+ 0, 0, 16, 16, 5, 5, 6, 8,
+ &rs_cicon[CI8],
+
+ rs_b64img, rs_b65img, rs_s25, 4096, 14, 21,
+ 0, 0, 32, 32, 12, 13, 6, 8,
+ &rs_cicon[CI9],
+
+ rs_b68img, rs_b69img, rs_s26, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI10],
+
+ rs_b74img, rs_b75img, rs_s27, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI11],
+
+ rs_b80img, rs_b81img, rs_s28, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI12],
+
+ rs_b86img, rs_b87img, rs_s29, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI13],
+
+ rs_b92img, rs_b93img, rs_s30, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI14],
+
+ rs_b98img, rs_b99img, rs_s31, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI15],
+
+ rs_b104img, rs_b105img, rs_s32, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI16],
+
+ rs_b110img, rs_b111img, rs_s33, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI17],
+
+ rs_b116img, rs_b117img, rs_s34, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI18],
+
+ rs_b122img, rs_b123img, rs_s35, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI19],
+
+ rs_b128img, rs_b129img, rs_s36, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI20],
+
+ rs_b134img, rs_b135img, rs_s37, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI21],
+
+ rs_b140img, rs_b141img, rs_s38, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI22],
+
+ rs_b146img, rs_b147img, rs_s39, 4096, 7, 8,
+ 0, 0, 16, 16, 15, 8, 0, 0,
+ &rs_cicon[CI23],
+
+ rs_b160img, rs_b161img, rs_s40, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI24],
+
+ rs_b174img, rs_b175img, rs_s41, 4096, 0, 0,
+ 0, 0, 16, 16, 5, 5, 0, 0,
+ &rs_cicon[CI25],
+
+ rs_b188img, rs_b189img, rs_s42, 4096, 7, 8,
+ 0, 0, 16, 16, 15, 8, 0, 0,
+ &rs_cicon[CI26],
+
+ rs_b202img, rs_b203img, rs_s43, 4096, 16, 0,
+ 0, 0, 16, 16, 0, 0, 0, 0,
+ &rs_cicon[CI27],
+
+ rs_b212img, rs_b213img, rs_s44, 4096, 16, 0,
+ 0, 0, 16, 16, 0, 0, 0, 0,
+ &rs_cicon[CI28]
+};
+
+#define RS_NOBS 280
+
+static OBJECT rs_obj[] = {
+#define TR0 0
+/* TREE 0 */
+ -1, 1, 10, G_IBOX, /*** 0 ***/
+ NONE,
+ NORMAL,
+ (long) 0L,
+ 0, 0, 80, 25,
+
+ 10, 2, 2, G_BOX, /*** 1 ***/
+ NONE,
+ NORMAL,
+ (long) 4352L,
+ 0, 0, 80, 513,
+
+ 1, 3, 9, G_IBOX, /*** 2 ***/
+ NONE,
+ NORMAL,
+ (long) 0L,
+ 2, 0, 65, 769,
+
+ 4, -1, -1, G_TITLE, /*** 3 ***/
+ NONE,
+ NORMAL,
+ (long) " NetSurf ",
+ 0, 0, 11, 769,
+
+ 5, -1, -1, G_TITLE, /*** 4 ***/
+ NONE,
+ NORMAL,
+ (long) " File ",
+ 11, 0, 7, 769,
+
+ 6, -1, -1, G_TITLE, /*** 5 ***/
+ NONE,
+ NORMAL,
+ (long) " Edit ",
+ 18, 0, 7, 769,
+
+ 7, -1, -1, G_TITLE, /*** 6 ***/
+ NONE,
+ NORMAL,
+ (long) " Display ",
+ 25, 0, 10, 769,
+
+ 8, -1, -1, G_TITLE, /*** 7 ***/
+ NONE,
+ NORMAL,
+ (long) " Navigate ",
+ 35, 0, 11, 769,
+
+ 9, -1, -1, G_TITLE, /*** 8 ***/
+ NONE,
+ NORMAL,
+ (long) " Utilities ",
+ 46, 0, 12, 769,
+
+ 2, -1, -1, G_TITLE, /*** 9 ***/
+ NONE,
+ NORMAL,
+ (long) " Help ",
+ 58, 0, 7, 769,
+
+ 0, 11, 60, G_IBOX, /*** 10 ***/
+ NONE,
+ NORMAL,
+ (long) 0L,
+ 0, 769, 79, 11,
+
+ 20, 12, 19, G_BOX, /*** 11 ***/
+ NONE,
+ NORMAL,
+ (long) 16716032L,
+ 2, 0, 22, 8,
+
+ 13, -1, -1, G_STRING, /*** 12 ***/
+ NONE,
+ NORMAL,
+ (long) " About... ",
+ 0, 0, 22, 1,
+
+ 14, -1, -1, G_STRING, /*** 13 ***/
+ NONE,
+ DISABLED,
+ (long) "----------------------",
+ 0, 1, 22, 1,
+
+ 15, -1, -1, G_STRING, /*** 14 ***/
+ NONE,
+ NORMAL,
+ (long) " Desk Accessory 1 ",
+ 0, 2, 22, 1,
+
+ 16, -1, -1, G_STRING, /*** 15 ***/
+ NONE,
+ NORMAL,
+ (long) " Desk Accessory 2",
+ 0, 3, 22, 1,
+
+ 17, -1, -1, G_STRING, /*** 16 ***/
+ NONE,
+ NORMAL,
+ (long) " Desk Accessory 3",
+ 0, 4, 22, 1,
+
+ 18, -1, -1, G_STRING, /*** 17 ***/
+ NONE,
+ NORMAL,
+ (long) " Desk Accessory 4",
+ 0, 5, 22, 1,
+
+ 19, -1, -1, G_STRING, /*** 18 ***/
+ NONE,
+ NORMAL,
+ (long) " Desk Accessory 5",
+ 0, 6, 22, 1,
+
+ 11, -1, -1, G_STRING, /*** 19 ***/
+ NONE,
+ NORMAL,
+ (long) " Desk Accessory 6",
+ 0, 7, 22, 1,
+
+ 29, 21, 28, G_BOX, /*** 20 ***/
+ NONE,
+ NORMAL,
+ (long) 16716032L,
+ 13, 0, 25, 8,
+
+ 22, -1, -1, G_STRING, /*** 21 ***/
+ NONE,
+ NORMAL,
+ (long) " New window [^N",
+ 0, 0, 25, 1,
+
+ 23, -1, -1, G_STRING, /*** 22 ***/
+ NONE,
+ NORMAL,
+ (long) " Open local file...[^O",
+ 0, 1, 25, 1,
+
+ 24, -1, -1, G_STRING, /*** 23 ***/
+ NONE,
+ NORMAL,
+ (long) " Open location [^G",
+ 0, 2, 25, 1,
+
+ 25, -1, -1, G_STRING, /*** 24 ***/
+ NONE,
+ NORMAL,
+ (long) " Close window",
+ 0, 3, 25, 1,
+
+ 26, -1, -1, G_STRING, /*** 25 ***/
+ NONE,
+ DISABLED,
+ (long) rs_s1,
+ 0, 4, 25, 1,
+
+ 27, -1, -1, G_STRING, /*** 26 ***/
+ NONE,
+ NORMAL,
+ (long) " Save page [^S",
+ 0, 5, 25, 1,
+
+ 28, -1, -1, G_STRING, /*** 27 ***/
+ NONE,
+ DISABLED,
+ (long) rs_s1,
+ 0, 6, 25, 1,
+
+ 20, -1, -1, G_STRING, /*** 28 ***/
+ NONE,
+ NORMAL,
+ (long) " Quit [^Q",
+ 0, 7, 25, 1,
+
+ 35, 30, 34, G_BOX, /*** 29 ***/
+ NONE,
+ NORMAL,
+ (long) 16716032L,
+ 20, 0, 28, 5,
+
+ 31, -1, -1, G_STRING, /*** 30 ***/
+ NONE,
+ NORMAL,
+ (long) " Cut to clipboard [^X",
+ 0, 0, 28, 1,
+
+ 32, -1, -1, G_STRING, /*** 31 ***/
+ NONE,
+ NORMAL,
+ (long) " Copy to clipboard [^C",
+ 0, 1, 28, 1,
+
+ 33, -1, -1, G_STRING, /*** 32 ***/
+ NONE,
+ NORMAL,
+ (long) " Paste from clipboard [^V",
+ 0, 2, 28, 1,
+
+ 34, -1, -1, G_STRING, /*** 33 ***/
+ NONE,
+ DISABLED,
+ (long) "----------------------------",
+ 0, 3, 28, 1,
+
+ 29, -1, -1, G_STRING, /*** 34 ***/
+ NONE,
+ NORMAL,
+ (long) " Find... [F4",
+ 0, 4, 28, 1,
+
+ 47, 36, 46, G_BOX, /*** 35 ***/
+ NONE,
+ NORMAL,
+ (long) 16716032L,
+ 27, 0, 30, 11,
+
+ 37, -1, -1, G_STRING, /*** 36 ***/
+ NONE,
+ NORMAL,
+ (long) " Stop loading this Page [^\033",
+ 0, 0, 30, 1,
+
+ 38, -1, -1, G_STRING, /*** 37 ***/
+ NONE,
+ NORMAL,
+ (long) " Reload [F5",
+ 0, 1, 30, 1,
+
+ 39, -1, -1, G_STRING, /*** 38 ***/
+ NONE,
+ DISABLED,
+ (long) rs_s2,
+ 0, 2, 30, 1,
+
+ 40, -1, -1, G_STRING, /*** 39 ***/
+ NONE,
+ NORMAL,
+ (long) " Scale View...",
+ 0, 3, 30, 1,
+
+ 41, -1, -1, G_STRING, /*** 40 ***/
+ NONE,
+ DISABLED,
+ (long) rs_s2,
+ 0, 4, 30, 1,
+
+ 42, -1, -1, G_STRING, /*** 41 ***/
+ NONE,
+ NORMAL,
+ (long) " Toolbars [^F1",
+ 0, 5, 30, 1,
+
+ 43, -1, -1, G_STRING, /*** 42 ***/
+ NONE,
+ DISABLED,
+ (long) rs_s2,
+ 0, 6, 30, 1,
+
+ 44, -1, -1, G_STRING, /*** 43 ***/
+ NONE,
+ NORMAL,
+ (long) " Save window size",
+ 0, 7, 30, 1,
+
+ 45, -1, -1, G_STRING, /*** 44 ***/
+ NONE,
+ NORMAL,
+ (long) " Debug rendering",
+ 0, 8, 30, 1,
+
+ 46, -1, -1, G_STRING, /*** 45 ***/
+ NONE,
+ NORMAL,
+ (long) " Background images",
+ 0, 9, 30, 1,
+
+ 35, -1, -1, G_STRING, /*** 46 ***/
+ NONE,
+ NORMAL,
+ (long) " Foreground images",
+ 0, 10, 30, 1,
+
+ 51, 48, 50, G_BOX, /*** 47 ***/
+ NONE,
+ NORMAL,
+ (long) 16716032L,
+ 37, 0, 24, 3,
+
+ 49, -1, -1, G_STRING, /*** 48 ***/
+ NONE,
+ NORMAL,
+ (long) " Back one page [@\004",
+ 0, 0, 24, 1,
+
+ 50, -1, -1, G_STRING, /*** 49 ***/
+ NONE,
+ NORMAL,
+ (long) " Forward one page [@\003",
+ 0, 1, 24, 1,
+
+ 47, -1, -1, G_STRING, /*** 50 ***/
+ NONE,
+ NORMAL,
+ (long) " Home",
+ 0, 2, 24, 1,
+
+ 60, 52, 59, G_BOX, /*** 51 ***/
+ NONE,
+ NORMAL,
+ (long) 16716032L,
+ 48, 0, 23, 8,
+
+ 53, -1, -1, G_STRING, /*** 52 ***/
+ NONE,
+ NORMAL,
+ (long) " Local History [F7",
+ 0, 0, 23, 1,
+
+ 54, -1, -1, G_STRING, /*** 53 ***/
+ NONE,
+ NORMAL,
+ (long) " Global History",
+ 0, 1, 23, 1,
+
+ 55, -1, -1, G_STRING, /*** 54 ***/
+ NONE,
+ DISABLED,
+ (long) rs_s3,
+ 0, 2, 23, 1,
+
+ 56, -1, -1, G_STRING, /*** 55 ***/
+ NONE,
+ NORMAL,
+ (long) " Add to bookmarks[^D",
+ 0, 3, 23, 1,
+
+ 57, -1, -1, G_STRING, /*** 56 ***/
+ NONE,
+ NORMAL,
+ (long) " Show bookmarks [F6",
+ 0, 4, 23, 1,
+
+ 58, -1, -1, G_STRING, /*** 57 ***/
+ NONE,
+ DISABLED,
+ (long) rs_s3,
+ 0, 5, 23, 1,
+
+ 59, -1, -1, G_STRING, /*** 58 ***/
+ NONE,
+ NORMAL,
+ (long) " Choices... ",
+ 0, 6, 23, 1,
+
+ 51, -1, -1, G_STRING, /*** 59 ***/
+ NONE,
+ NORMAL,
+ (long) " Verbose Log",
+ 0, 7, 23, 1,
+
+ 10, 61, 61, G_BOX, /*** 60 ***/
+ NONE,
+ NORMAL,
+ (long) 16716032L,
+ 60, 0, 19, 1,
+
+ 60, -1, -1, G_STRING, /*** 61 ***/
+ LASTOB,
+ NORMAL,
+ (long) " Help Content[F1",
+ 0, 0, 19, 1,
+
+#define TR1 62
+/* TREE 1 */
+ -1, 1, 8, G_BOX, /*** 0 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 0, 0, 48, 2049,
+
+ 7, 2, 6, G_BOX, /*** 1 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 0, 0, 21, 1793,
+
+ 3, -1, -1, G_CICON, /*** 2 ***/
+ TOUCHEXIT,
+ NORMAL,
+ (long) &rs_ciconblk[0],
+ 512, 256, 4, 1281,
+
+ 4, -1, -1, G_CICON, /*** 3 ***/
+ TOUCHEXIT,
+ NORMAL,
+ (long) &rs_ciconblk[1],
+ -1531, 256, 4, 1281,
+
+ 5, -1, -1, G_CICON, /*** 4 ***/
+ TOUCHEXIT,
+ NORMAL,
+ (long) &rs_ciconblk[2],
+ 520, 256, 4, 1281,
+
+ 6, -1, -1, G_CICON, /*** 5 ***/
+ TOUCHEXIT,
+ NORMAL,
+ (long) &rs_ciconblk[3],
+ 524, 256, 4, 1281,
+
+ 1, -1, -1, G_CICON, /*** 6 ***/
+ TOUCHEXIT,
+ NORMAL,
+ (long) &rs_ciconblk[4],
+ 23045, 256, 4, 1281,
+
+ 8, -1, -1, G_BOX, /*** 7 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 16720240L,
+ 21, 512, 22, 1025,
+
+ 0, -1, -1, G_BOX, /*** 8 ***/
+ LASTOB|FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 45, 256, 1026, 1537,
+
+#define TR2 71
+/* TREE 2 */
+ -1, 1, 2, G_BOX, /*** 0 ***/
+ NONE,
+ NORMAL,
+ (long) 4352L,
+ 0, 0, 9, 4,
+
+ 2, -1, -1, G_CICON, /*** 1 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[5],
+ 2, 1536, 4, 2,
+
+ 0, -1, -1, G_TEXT, /*** 2 ***/
+ LASTOB,
+ NORMAL,
+ (long) &rs_tedinfo[0],
+ -510, -2557, 517, 2048,
+
+#define TR3 74
+/* TREE 3 */
+ -1, 1, 1, G_BOX, /*** 0 ***/
+ NONE,
+ OUTLINED,
+ (long) 135424L,
+ 0, 0, 11, 4,
+
+ 0, -1, -1, G_CICON, /*** 1 ***/
+ LASTOB,
+ NORMAL,
+ (long) &rs_ciconblk[6],
+ 1, 1, 9, 2049,
+
+#define TR4 76
+/* TREE 4 */
+ -1, 1, 7, G_BOX, /*** 0 ***/
+ NONE,
+ OUTLINED,
+ (long) 135424L,
+ 0, 0, 42, 3,
+
+ 2, -1, -1, G_ICON, /*** 1 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_icnblk[0],
+ 2, 1, 2, 1,
+
+ 3, -1, -1, G_ICON, /*** 2 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_icnblk[1],
+ 5, 1, 2, 1,
+
+ 4, -1, -1, G_ICON, /*** 3 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_icnblk[2],
+ 8, 1, 2, 1,
+
+ 5, -1, -1, G_ICON, /*** 4 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_icnblk[3],
+ 11, 1, 2, 1,
+
+ 6, -1, -1, G_ICON, /*** 5 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_icnblk[4],
+ 14, 1, 2, 1,
+
+ 7, -1, -1, G_ICON, /*** 6 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_icnblk[5],
+ 17, 1, 2, 1,
+
+ 0, -1, -1, G_ICON, /*** 7 ***/
+ LASTOB,
+ NORMAL,
+ (long) &rs_icnblk[6],
+ 20, 1, 2, 1,
+
+#define TR5 84
+/* TREE 5 */
+ -1, 1, 6, G_BOX, /*** 0 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 135424L,
+ 0, 0, 1059, 7,
+
+ 2, -1, -1, G_CICON, /*** 1 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[7],
+ 1025, 1, 2, 1,
+
+ 3, -1, -1, G_FTEXT, /*** 2 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[1],
+ 1028, 1, 29, 1,
+
+ 4, -1, -1, G_CICON, /*** 3 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[8],
+ 1025, 3, 2, 1,
+
+ 5, -1, -1, G_FTEXT, /*** 4 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[2],
+ 1028, 3, 29, 1,
+
+ 6, -1, -1, G_BUTTON, /*** 5 ***/
+ SELECTABLE|DEFAULT|EXIT|FL3DIND|FL3DBAK,
+ NORMAL,
+ (long) "Login",
+ 15, 5, 8, 1,
+
+ 0, -1, -1, G_BUTTON, /*** 6 ***/
+ SELECTABLE|EXIT|LASTOB|FL3DIND|FL3DBAK,
+ NORMAL,
+ (long) rs_s4,
+ 25, 5, 8, 1,
+
+#define TR6 91
+/* TREE 6 */
+ -1, 1, 16, G_BOX, /*** 0 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 16650496L,
+ 0, 0, 38, 20,
+
+ 2, -1, -1, G_CICON, /*** 1 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[9],
+ 1, 1, 4, 2,
+
+ 3, -1, -1, G_TEXT, /*** 2 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[3],
+ 6, 1, 31, 1,
+
+ 4, -1, -1, G_TEXT, /*** 3 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[4],
+ 13, 2, 24, 1,
+
+ 5, -1, -1, G_BUTTON, /*** 4 ***/
+ SELECTABLE|DEFAULT|EXIT|FL3DIND|FL3DBAK,
+ NORMAL,
+ (long) "Accept",
+ 1, 18, 7, 1,
+
+ 6, -1, -1, G_BUTTON, /*** 5 ***/
+ SELECTABLE|EXIT|FL3DIND|FL3DBAK,
+ NORMAL,
+ (long) "Reject",
+ 30, 18, 7, 1,
+
+ 7, -1, -1, G_STRING, /*** 6 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) "Server:",
+ 2053, 2, 7, 1,
+
+ 8, -1, -1, G_BUTTON, /*** 7 ***/
+ SELECTABLE|TOUCHEXIT|FL3DIND,
+ NORMAL,
+ (long) "NEXT CERT INFO",
+ 513, -1276, 33, 1,
+
+ 9, -1, -1, G_BOX, /*** 8 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 16716128L,
+ 1, 5, 34, 11,
+
+ 10, -1, -1, G_BOX, /*** 9 ***/
+ TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16716049L,
+ 3, 272, -226, 1,
+
+ 11, -1, -1, G_BOXCHAR, /*** 10 ***/
+ TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 67047680L,
+ 33, 272, 2, 1,
+
+ 12, -1, -1, G_BOXCHAR, /*** 11 ***/
+ TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 83824896L,
+ 2048, 272, 2, 1,
+
+ 13, -1, -1, G_BOX, /*** 12 ***/
+ TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16716032L,
+ 3, 272, 26, 1,
+
+ 14, -1, -1, G_BOXCHAR, /*** 13 ***/
+ TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 33493248L,
+ 291, 5, 2, 1,
+
+ 15, -1, -1, G_BOXCHAR, /*** 14 ***/
+ TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 50270464L,
+ 291, 15, 2, 1,
+
+ 16, -1, -1, G_BOX, /*** 15 ***/
+ TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16716049L,
+ 291, 6, 2, -247,
+
+ 0, -1, -1, G_BOX, /*** 16 ***/
+ LASTOB|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16716032L,
+ 291, 6, 2, 1030,
+
+#define TR7 108
+/* TREE 7 */
+ -1, 1, 13, G_BOX, /*** 0 ***/
+ FL3DBAK,
+ OUTLINED,
+ (long) 135424L,
+ 0, 0, 44, 3,
+
+ 2, -1, -1, G_CICON|(119<<8), /*** 1 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[10],
+ 2, 1, 2, 1,
+
+ 3, -1, -1, G_CICON|(119<<8), /*** 2 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[11],
+ 5, 1, 2, 1,
+
+ 4, -1, -1, G_CICON|(119<<8), /*** 3 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[12],
+ 8, 1, 2, 1,
+
+ 5, -1, -1, G_CICON|(119<<8), /*** 4 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[13],
+ 11, 1, 2, 1,
+
+ 6, -1, -1, G_CICON|(119<<8), /*** 5 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[14],
+ 14, 1, 2, 1,
+
+ 7, -1, -1, G_CICON|(119<<8), /*** 6 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[15],
+ 17, 1, 2, 1,
+
+ 8, -1, -1, G_CICON|(119<<8), /*** 7 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[16],
+ 20, 1, 2, 1,
+
+ 9, -1, -1, G_CICON|(119<<8), /*** 8 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[17],
+ 23, 1, 2, 1,
+
+ 10, -1, -1, G_CICON|(119<<8), /*** 9 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[18],
+ 26, 1, 2, 1,
+
+ 11, -1, -1, G_CICON|(119<<8), /*** 10 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[19],
+ 29, 1, 2, 1,
+
+ 12, -1, -1, G_CICON|(119<<8), /*** 11 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[20],
+ 32, 1, 2, 1,
+
+ 13, -1, -1, G_CICON|(119<<8), /*** 12 ***/
+ NONE,
+ NORMAL,
+ (long) &rs_ciconblk[21],
+ 35, 1, 2, 1,
+
+ 0, -1, -1, G_CICON|(119<<8), /*** 13 ***/
+ LASTOB,
+ NORMAL,
+ (long) &rs_ciconblk[22],
+ 39, 1, 2, 1,
+
+#define TR8 122
+/* TREE 8 */
+ -1, 1, 4, G_BOX, /*** 0 ***/
+ TOUCHEXIT|FL3DBAK,
+ WHITEBAK,
+ (long) 4352L,
+ 0, 0, 10, 1025,
+
+ 2, -1, -1, G_CICON, /*** 1 ***/
+ SELECTABLE|TOUCHEXIT,
+ NORMAL,
+ (long) &rs_ciconblk[23],
+ 1024, 512, 2, 1,
+
+ 3, -1, -1, G_CICON, /*** 2 ***/
+ SELECTABLE|TOUCHEXIT,
+ NORMAL,
+ (long) &rs_ciconblk[24],
+ 3, 512, 2, 1,
+
+ 4, -1, -1, G_CICON, /*** 3 ***/
+ SELECTABLE|TOUCHEXIT,
+ NORMAL,
+ (long) &rs_ciconblk[25],
+ -504, 512, 2, 1,
+
+ 0, -1, -1, G_CICON, /*** 4 ***/
+ SELECTABLE|LASTOB|TOUCHEXIT,
+ NORMAL,
+ (long) &rs_ciconblk[26],
+ 1029, 512, 2, 1,
+
+#define TR9 127
+/* TREE 9 */
+ -1, 1, 8, G_BOX, /*** 0 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 1, 1, 49, 5,
+
+ 2, -1, -1, G_FTEXT, /*** 1 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[5],
+ 1, 1, 37, 1,
+
+ 3, -1, -1, G_STRING, /*** 2 ***/
+ NONE,
+ DRAW3D,
+ (long) "Show all",
+ 25, 3, 9, 1,
+
+ 4, -1, -1, G_STRING, /*** 3 ***/
+ NONE,
+ NORMAL,
+ (long) "Case sensitive",
+ 5, 3, 14, 1,
+
+ 5, -1, -1, G_BUTTON, /*** 4 ***/
+ SELECTABLE|DEFAULT|TOUCHEXIT|FL3DIND,
+ WHITEBAK|DRAW3D,
+ (long) "Search",
+ 39, 1, 8, 1,
+
+ 6, -1, -1, G_STRING, /*** 5 ***/
+ NONE,
+ DRAW3D,
+ (long) "Forward",
+ 39, 3, 9, 1,
+
+ 7, -1, -1, G_BUTTON|(18<<8), /*** 6 ***/
+ SELECTABLE|TOUCHEXIT|FL3DIND|FL3DBAK,
+ DRAW3D,
+ (long) rs_s0,
+ 2, 3, 2, 1,
+
+ 8, -1, -1, G_BUTTON|(18<<8), /*** 7 ***/
+ SELECTABLE|TOUCHEXIT|FL3DIND|FL3DBAK,
+ DRAW3D,
+ (long) rs_s0,
+ 22, 3, 2, 1,
+
+ 0, -1, -1, G_BUTTON|(18<<8), /*** 8 ***/
+ SELECTABLE|LASTOB|TOUCHEXIT|FL3DIND|FL3DBAK,
+ SELECTED|DRAW3D,
+ (long) rs_s0,
+ 36, 3, 2, 1,
+
+#define TR10 136
+/* TREE 10 */
+ -1, 1, 9, G_BOX, /*** 0 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 16650496L,
+ 0, 0, 40, 6,
+
+ 3, 2, 2, G_BOX, /*** 1 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 69953L,
+ 1, 1, 1061, 1,
+
+ 1, -1, -1, G_BOX, /*** 2 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 70003L,
+ 0, 0, 513, 1,
+
+ 4, -1, -1, G_TEXT, /*** 3 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[6],
+ 1, 0, 38, 1,
+
+ 5, -1, -1, G_BUTTON, /*** 4 ***/
+ SELECTABLE|TOUCHEXIT|FL3DIND|FL3DBAK,
+ NORMAL,
+ (long) rs_s4,
+ 31, 4, 8, 1,
+
+ 6, -1, -1, G_STRING, /*** 5 ***/
+ NONE,
+ NORMAL,
+ (long) "Close dialog when finished",
+ 4, 4, 26, 1,
+
+ 7, -1, -1, G_TEXT, /*** 6 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[7],
+ 1, 2, 21, 1,
+
+ 8, -1, -1, G_TEXT, /*** 7 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[8],
+ 22, 2, 5, 1,
+
+ 9, -1, -1, G_TEXT, /*** 8 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[9],
+ 29, 2, 11, 1,
+
+ 0, -1, -1, G_BOXCHAR|(18<<8), /*** 9 ***/
+ SELECTABLE|LASTOB|TOUCHEXIT|FL3DIND|FL3DBAK,
+ CROSSED|SHADOWED,
+ (long) 4096L,
+ 1025, 516, 1025, -1023,
+
+#define TR11 146
+/* TREE 11 */
+ -1, 1, 1, G_BOX, /*** 0 ***/
+ FL3DBAK,
+ OUTLINED,
+ (long) 135424L,
+ 1, 1, 52, 9,
+
+ 0, -1, -1, G_IMAGE, /*** 1 ***/
+ LASTOB|FL3DBAK,
+ NORMAL,
+ (long) &rs_bitblk[0],
+ 3, 1, 6, 2049,
+
+#define TR12 148
+/* TREE 12 */
+ -1, 1, 11, G_BOX, /*** 0 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 16650496L,
+ 0, 0, 22, 11,
+
+ 2, -1, -1, G_TEXT, /*** 1 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[10],
+ 0, 0, 22, 1,
+
+ 3, -1, -1, G_TEXT, /*** 2 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[11],
+ 0, 1, 22, 1,
+
+ 4, -1, -1, G_TEXT, /*** 3 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[12],
+ 0, 2, 22, 1,
+
+ 5, -1, -1, G_TEXT, /*** 4 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[13],
+ 0, 3, 22, 1,
+
+ 6, -1, -1, G_TEXT, /*** 5 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[14],
+ 0, 4, 22, 1,
+
+ 7, -1, -1, G_TEXT, /*** 6 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[15],
+ 0, 5, 22, 1,
+
+ 8, -1, -1, G_TEXT, /*** 7 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[16],
+ 0, 6, 22, 1,
+
+ 9, -1, -1, G_TEXT, /*** 8 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[17],
+ 0, 7, 22, 1,
+
+ 10, -1, -1, G_TEXT, /*** 9 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[18],
+ 0, 8, 22, 1,
+
+ 11, -1, -1, G_TEXT, /*** 10 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[19],
+ 0, 10, 22, 1,
+
+ 0, -1, -1, G_TEXT, /*** 11 ***/
+ SELECTABLE|LASTOB|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[20],
+ 0, 9, 22, 1,
+
+#define TR13 160
+/* TREE 13 */
+ -1, 1, 1, G_BOX, /*** 0 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 1, 1, 11, 9,
+
+ 0, 2, 4, G_BOX, /*** 1 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 69888L,
+ 1, 1, -509, 7,
+
+ 7, 3, 3, G_BUTTON, /*** 2 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED,
+ (long) rs_s0,
+ 768, 1537, 2, 3,
+
+ 2, -1, -1, G_BUTTON, /*** 3 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) rs_s0,
+ 0, 0, 2, 2,
+
+ 1, -1, -1, G_CICON, /*** 4 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) &rs_ciconblk[28],
+ 768, 512, 2, 1,
+
+ 7, -1, -1, G_CICON, /*** 5 ***/
+ SELECTABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_ciconblk[27],
+ 512, 256, 2, 1,
+
+ 4, -1, -1, G_IBOX, /*** 6 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 16716032L,
+ 256, 256, 1026, 513,
+
+ 6, 5, 5, G_IBOX, /*** 7 ***/
+ LASTOB|FL3DBAK,
+ NORMAL,
+ (long) 16716032L,
+ 256, -2298, 1026, 513,
+
+#define TR14 168
+/* TREE 14 */
+ -1, 1, 86, G_BOX, /*** 0 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 0, 0, 63, 2112,
+
+ 2, -1, -1, G_BUTTON, /*** 1 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ NORMAL,
+ (long) "Save",
+ 1077, 63, 8, 1,
+
+ 3, -1, -1, G_BUTTON, /*** 2 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ NORMAL,
+ (long) rs_s4,
+ 1067, 63, 8, 1,
+
+ 32, 4, 31, G_IBOX, /*** 3 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 0, 0, 63, 2062,
+
+ 31, 5, 30, G_BOX, /*** 4 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 16748800L,
+ 1, 1, 61, 13,
+
+ 6, -1, -1, G_FTEXT, /*** 5 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[21],
+ 1, 1, 54, 1,
+
+ 7, -1, -1, G_STRING, /*** 6 ***/
+ NONE,
+ NORMAL,
+ (long) "Hide advertisements",
+ 1028, 2050, 27, 1,
+
+ 8, -1, -1, G_STRING|(18<<8), /*** 7 ***/
+ NONE,
+ DRAW3D|STATE8,
+ (long) "Disable pop-up windows",
+ 1028, 4, 27, 1,
+
+ 9, -1, -1, G_BOXCHAR|(101<<8), /*** 8 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 1025, 2050, 2, 1,
+
+ 10, -1, -1, G_BOXCHAR|(101<<8), /*** 9 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 1025, 4, 2, 1,
+
+ 11, -1, -1, G_STRING, /*** 10 ***/
+ NONE,
+ NORMAL,
+ (long) "Send referrer",
+ 1063, 2050, 1044, 1,
+
+ 12, -1, -1, G_BOXCHAR|(101<<8), /*** 11 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 1060, 2050, 2, 1,
+
+ 13, -1, -1, G_STRING, /*** 12 ***/
+ NONE,
+ NORMAL,
+ (long) "Send do not track",
+ 1063, 4, 1044, 1,
+
+ 14, -1, -1, G_BOXCHAR|(101<<8), /*** 13 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 1060, 4, 2, 1,
+
+ 15, -1, -1, G_STRING, /*** 14 ***/
+ NONE,
+ NORMAL,
+ (long) "Keep history:",
+ 1026, 9, 13, 1,
+
+ 16, -1, -1, G_BUTTON, /*** 15 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ NORMAL,
+ (long) "Clear history",
+ 1060, 9, 13, 1,
+
+ 17, -1, -1, G_STRING, /*** 16 ***/
+ NONE,
+ NORMAL,
+ (long) "Request locale:",
+ 1, 6, 15, 1,
+
+ 18, -1, -1, G_BUTTON, /*** 17 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ DRAW3D|STATE8,
+ (long) "______",
+ 1042, 6, 8, 1,
+
+ 19, -1, -1, G_STRING, /*** 18 ***/
+ NONE,
+ DISABLED,
+ (long) "GUI language:",
+ 1026, 2055, 13, 1,
+
+ 20, -1, -1, G_BUTTON, /*** 19 ***/
+ SELECTABLE|FL3DBAK,
+ DISABLED|DRAW3D|STATE8,
+ (long) "en",
+ 1042, 2055, 8, 1,
+
+ 21, -1, -1, G_STRING, /*** 20 ***/
+ NONE,
+ NORMAL,
+ (long) "Memory Cache:",
+ 1026, 2058, 13, 1,
+
+ 26, 22, 25, G_IBOX, /*** 21 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 1042, 2058, 15, 1,
+
+ 23, -1, -1, G_BOXCHAR, /*** 22 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16847104L,
+ 7, 0, 2, 1,
+
+ 24, -1, -1, G_BOXCHAR, /*** 23 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 33624320L,
+ 0, 0, 2, 1,
+
+ 25, -1, -1, G_STRING, /*** 24 ***/
+ NONE,
+ DRAW3D,
+ (long) "999.5",
+ 2, 0, 5, 1,
+
+ 21, -1, -1, G_STRING, /*** 25 ***/
+ NONE,
+ NORMAL,
+ (long) "MB",
+ 1034, 0, 3, 1,
+
+ 30, 27, 29, G_IBOX, /*** 26 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 1042, 9, 15, 1,
+
+ 28, -1, -1, G_BOXCHAR, /*** 27 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 33624320L,
+ 0, 0, 2, 1,
+
+ 29, -1, -1, G_FTEXT, /*** 28 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[22],
+ 2, 0, 1028, 1,
+
+ 26, -1, -1, G_BOXCHAR, /*** 29 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16847104L,
+ 7, 0, 2, 1,
+
+ 4, -1, -1, G_STRING, /*** 30 ***/
+ NONE,
+ NORMAL,
+ (long) "Days",
+ 29, 9, 1028, 1,
+
+ 3, -1, -1, G_FTEXT, /*** 31 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[23],
+ 2, 2048, 8, 1,
+
+ 59, 33, 58, G_IBOX, /*** 32 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 0, 15, 63, 15,
+
+ 58, 34, 54, G_BOX, /*** 33 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 16748800L,
+ 1, 1, 61, 2061,
+
+ 35, -1, -1, G_BOXCHAR|(101<<8), /*** 34 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 1025, 1, 2, 1,
+
+ 36, -1, -1, G_STRING, /*** 35 ***/
+ NONE,
+ NORMAL,
+ (long) "Enable Proxy",
+ 1028, 1, 13, 1,
+
+ 37, -1, -1, G_FTEXT, /*** 36 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[24],
+ 1, 2050, 43, 1,
+
+ 38, -1, -1, G_STRING, /*** 37 ***/
+ NONE,
+ NORMAL,
+ (long) ":",
+ 44, 2050, 1, 1,
+
+ 39, -1, -1, G_FTEXT, /*** 38 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[25],
+ 45, 2050, 5, 1,
+
+ 40, -1, -1, G_BOXCHAR|(101<<8), /*** 39 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 1025, 4, 2, 1,
+
+ 41, -1, -1, G_STRING, /*** 40 ***/
+ NONE,
+ NORMAL,
+ (long) "Proxy Authentication",
+ 1028, 4, 20, 1,
+
+ 42, -1, -1, G_FTEXT, /*** 41 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[26],
+ 1, 2053, 49, 1,
+
+ 43, -1, -1, G_FTEXT, /*** 42 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[27],
+ 1, 7, 49, 1,
+
+ 44, -1, -1, G_STRING, /*** 43 ***/
+ EDITABLE|FL3DBAK,
+ DRAW3D,
+ (long) "Maximum fetchers:",
+ 1, 9, 21, 1,
+
+ 45, -1, -1, G_STRING, /*** 44 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) "Fetchers per Host:",
+ 1, 2058, 21, 1,
+
+ 46, -1, -1, G_STRING, /*** 45 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) "Cached connections:",
+ 1, 12, 21, 1,
+
+ 50, 47, 49, G_IBOX, /*** 46 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 36, 9, 8, 1,
+
+ 48, -1, -1, G_FTEXT, /*** 47 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[28],
+ 2, 0, 2, 1,
+
+ 49, -1, -1, G_BOXCHAR, /*** 48 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16847104L,
+ 4, 0, 2, 1,
+
+ 46, -1, -1, G_BOXCHAR, /*** 49 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 33624320L,
+ 0, 0, 2, 1,
+
+ 54, 51, 53, G_IBOX, /*** 50 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 36, 2058, 8, 1,
+
+ 52, -1, -1, G_BOXCHAR, /*** 51 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 33624320L,
+ 0, 0, 2, 1,
+
+ 53, -1, -1, G_FTEXT, /*** 52 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[29],
+ 2, 0, 2, 1,
+
+ 50, -1, -1, G_BOXCHAR, /*** 53 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16847104L,
+ 4, 0, 2, 1,
+
+ 33, 55, 57, G_IBOX, /*** 54 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 36, 12, 1032, 1,
+
+ 56, -1, -1, G_BOXCHAR, /*** 55 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 33624320L,
+ 0, 0, 2, 1,
+
+ 57, -1, -1, G_FTEXT, /*** 56 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[30],
+ 2, 0, 2, 1,
+
+ 54, -1, -1, G_BOXCHAR, /*** 57 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16847104L,
+ 4, 0, 2, 1,
+
+ 32, -1, -1, G_TEXT, /*** 58 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[31],
+ 3, 2048, 8, 1,
+
+ 86, 60, 85, G_IBOX, /*** 59 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 0, 2078, 63, 15,
+
+ 85, 61, 108, G_BOX, /*** 60 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 16748800L,
+ 1, 1, 61, 14,
+
+ 62, -1, -1, G_STRING, /*** 61 ***/
+ NONE,
+ NORMAL,
+ (long) "Font renderer:",
+ 1025, 1, 14, 1,
+
+ 63, -1, -1, G_BUTTON, /*** 62 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) "_freetype_",
+ 1041, 1, 12, 1,
+
+ 64, -1, -1, G_BOXCHAR|(101<<8), /*** 63 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 1060, 1, 2, 1,
+
+ 65, -1, -1, G_STRING, /*** 64 ***/
+ NONE,
+ NORMAL,
+ (long) "Anti Aliasing",
+ 1063, 1, 13, 1,
+
+ 66, -1, -1, G_BOXCHAR|(101<<8), /*** 65 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 1025, 8, 2, 1,
+
+ 75, -1, -1, G_STRING, /*** 66 ***/
+ NONE,
+ NORMAL,
+ (long) "Transparent Images",
+ 1028, 8, 18, 1,
+
+ 68, -1, -1, G_BOXCHAR|(101<<8), /*** 67 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 1025, 0, 2, 1,
+
+ 100, -1, -1, G_STRING, /*** 68 ***/
+ NONE,
+ NORMAL,
+ (long) "Enable Animations",
+ 1028, 0, 17, 1,
+
+ 71, -1, -1, G_STRING, /*** 69 ***/
+ NONE,
+ NORMAL,
+ (long) "Limit speed to",
+ 1024, 0, 15, 1,
+
+ 99, -1, -1, G_STRING, /*** 70 ***/
+ NONE,
+ NORMAL,
+ (long) "seconds between frames.",
+ 1048, 0, 24, 1,
+
+ 70, 72, 74, G_IBOX, /*** 71 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 16, 0, 1032, 1,
+
+ 73, -1, -1, G_FTEXT, /*** 72 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[34],
+ 2, 0, 3, 1,
+
+ 74, -1, -1, G_BOXCHAR, /*** 73 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16847104L,
+ 5, 0, 2, 1,
+
+ 71, -1, -1, G_BOXCHAR, /*** 74 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 33624320L,
+ 0, 0, 2, 1,
+
+ 76, -1, -1, G_STRING, /*** 75 ***/
+ NONE,
+ NORMAL,
+ (long) "Default Font Size:",
+ 1025, 2050, 18, 1,
+
+ 80, 77, 79, G_IBOX, /*** 76 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 36, 2050, 10, 1,
+
+ 78, -1, -1, G_FTEXT, /*** 77 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[32],
+ 2, 0, 3, 1,
+
+ 79, -1, -1, G_BOXCHAR, /*** 78 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 33624320L,
+ 0, 0, 2, 1,
+
+ 76, -1, -1, G_BOXCHAR, /*** 79 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16847104L,
+ 5, 0, 2, 1,
+
+ 84, 81, 83, G_IBOX, /*** 80 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 36, 4, 9, 1,
+
+ 82, -1, -1, G_FTEXT, /*** 81 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[33],
+ 2, 0, 3, 1,
+
+ 83, -1, -1, G_BOXCHAR, /*** 82 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 33624320L,
+ 0, 0, 2, 1,
+
+ 80, -1, -1, G_BOXCHAR, /*** 83 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16847104L,
+ 5, 0, 2, 1,
+
+ 99, -1, -1, G_STRING, /*** 84 ***/
+ NONE,
+ NORMAL,
+ (long) "Minimum Font Size:",
+ 1025, 4, 18, 1,
+
+ 59, -1, -1, G_TEXT, /*** 85 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[36],
+ 3, 2048, 9, 1,
+
+ 0, 87, 88, G_IBOX, /*** 86 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 0, 46, 63, 15,
+
+ 88, 89, 98, G_BOX, /*** 87 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 16748800L,
+ 1, 1, 61, 2061,
+
+ 86, -1, -1, G_TEXT, /*** 88 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[42],
+ 1027, 2048, 11, 1,
+
+ 90, -1, -1, G_STRING, /*** 89 ***/
+ EDITABLE,
+ WHITEBAK|DRAW3D,
+ (long) "Downloads:",
+ 1, 2048, 11, 1,
+
+ 91, -1, -1, G_FTEXT, /*** 90 ***/
+ EDITABLE|FL3DBAK,
+ OUTLINED|DRAW3D,
+ (long) &rs_tedinfo[37],
+ 1039, 2048, 44, 1,
+
+ 92, -1, -1, G_FTEXT, /*** 91 ***/
+ EDITABLE|FL3DBAK,
+ OUTLINED,
+ (long) &rs_tedinfo[38],
+ 1039, 2, 44, 1,
+
+ 93, -1, -1, G_FTEXT, /*** 92 ***/
+ EDITABLE|FL3DBAK,
+ OUTLINED,
+ (long) &rs_tedinfo[39],
+ 1039, 2051, 44, 1,
+
+ 94, -1, -1, G_FTEXT, /*** 93 ***/
+ EDITABLE|FL3DBAK,
+ OUTLINED,
+ (long) &rs_tedinfo[40],
+ 1039, 5, 44, 1,
+
+ 95, -1, -1, G_FTEXT, /*** 94 ***/
+ EDITABLE|FL3DBAK,
+ OUTLINED,
+ (long) &rs_tedinfo[41],
+ 1039, 2054, 44, 1,
+
+ 96, -1, -1, G_STRING, /*** 95 ***/
+ EDITABLE,
+ WHITEBAK|DRAW3D,
+ (long) "Hotlist:",
+ 3, 2, 8, 1,
+
+ 97, -1, -1, G_STRING, /*** 96 ***/
+ EDITABLE,
+ WHITEBAK|DRAW3D,
+ (long) "CA Bundle:",
+ 1, 2051, 10, 1,
+
+ 98, -1, -1, G_STRING, /*** 97 ***/
+ EDITABLE,
+ WHITEBAK|DRAW3D,
+ (long) "CA Certs:",
+ 2, 5, 9, 1,
+
+ 87, -1, -1, G_STRING, /*** 98 ***/
+ EDITABLE,
+ WHITEBAK|DRAW3D,
+ (long) "Editor:",
+ 4, 2054, 7, 1,
+
+ 100, 69, 70, G_IBOX, /*** 99 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 4, 11, 1074, 1,
+
+ 101, 67, 68, G_IBOX, /*** 100 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 0, 2057, 1053, 1,
+
+ 104, 102, 103, G_IBOX, /*** 101 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 0, 2054, 1053, 1,
+
+ 103, -1, -1, G_BOXCHAR|(101<<8), /*** 102 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 1025, 0, 2, 1,
+
+ 101, -1, -1, G_STRING, /*** 103 ***/
+ NONE,
+ NORMAL,
+ (long) "Background Images",
+ 1028, 0, 17, 1,
+
+ 107, 105, 106, G_IBOX, /*** 104 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 34, 2054, 1048, 1,
+
+ 106, -1, -1, G_BOXCHAR|(101<<8), /*** 105 ***/
+ SELECTABLE|FL3DIND|FL3DBAK,
+ SELECTED|CROSSED,
+ (long) 4352L,
+ 2, 0, 2, 1,
+
+ 104, -1, -1, G_STRING, /*** 106 ***/
+ NONE,
+ NORMAL,
+ (long) "Foreground Images",
+ 5, 0, 17, 1,
+
+ 108, -1, -1, G_STRING, /*** 107 ***/
+ NONE,
+ NORMAL,
+ (long) "Minimum reflow period (ms):",
+ 1028, 2060, 27, 1,
+
+ 60, 109, 111, G_IBOX, /*** 108 ***/
+ FL3DBAK,
+ NORMAL,
+ (long) 4352L,
+ 1059, 2060, 13, 1,
+
+ 110, -1, -1, G_FTEXT, /*** 109 ***/
+ EDITABLE|FL3DBAK,
+ NORMAL,
+ (long) &rs_tedinfo[35],
+ 2, 0, 4, 1,
+
+ 111, -1, -1, G_BOXCHAR, /*** 110 ***/
+ SELECTABLE|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 33624320L,
+ 0, 0, 2, 1,
+
+ 108, -1, -1, G_BOXCHAR, /*** 111 ***/
+ SELECTABLE|LASTOB|TOUCHEXIT|FL3DBAK,
+ NORMAL,
+ (long) 16847104L,
+ 6, 0, 2, 1
+};
+
+OBJECT *MAINMENU = &rs_obj[TR0];
+OBJECT *TOOLBAR = &rs_obj[TR1];
+OBJECT *ICONIFY = &rs_obj[TR2];
+OBJECT *FAVICON = &rs_obj[TR3];
+OBJECT *CURSOR = &rs_obj[TR4];
+OBJECT *LOGIN = &rs_obj[TR5];
+OBJECT *VERIFY = &rs_obj[TR6];
+OBJECT *THROBBER = &rs_obj[TR7];
+OBJECT *TOOLBAR_HOTLIST = &rs_obj[TR8];
+OBJECT *SEARCH = &rs_obj[TR9];
+OBJECT *DOWNLOAD = &rs_obj[TR10];
+OBJECT *ABOUT = &rs_obj[TR11];
+OBJECT *POP_CTX = &rs_obj[TR12];
+OBJECT *VSCROLLER = &rs_obj[TR13];
+OBJECT *SETTINGS = &rs_obj[TR14];
+
+
+void rs_init(void);
+void rs_exit(void);
+
+LONG rs_ciconinit(CICONBLK *ciconblks, WORD ncib, OBJECT *objects, WORD nobj);
+void rs_ciconexit(LONG deskript);
+
+static LONG rs_cid;
+void rs_init(void)
+{
+ register OBJECT *obj=rs_obj;
+ register WORD i=0;
+
+ do
+ {
+ rsrc_obfix(obj, i);
+ } while (++i<RS_NOBS);
+ rs_cid = rs_ciconinit(&rs_ciconblk[0], 29, &rs_obj[0], 280);
+}
+void rs_exit(void)
+{
+ rs_ciconexit(rs_cid);
+}
diff --git a/atari/res/netsurf.csc b/atari/res/netsurf.csc new file mode 100644 index 000000000..644ecf3d2 --- /dev/null +++ b/atari/res/netsurf.csc @@ -0,0 +1,22 @@ +static vars=TRUE
+short file=FALSE
+blank lines=TRUE
+object numbers=TRUE
+init te_ptext=TRUE
+no init function=FALSE
+init function=rs_init
+exit function=rs_exit
+ciconinit function=rs_ciconinit
+ciconexit function=rs_ciconexit
+optimize images=FALSE
+optimize strings=TRUE
+optimize icontext=FALSE
+optimize substrings=FALSE
+optimize emtystrings=TRUE
+includes=
+ob_spec=long
+ub_code=long
+ub_parm=long
+draw function=mydraw
+obfix function=rsrc_obfix
+bi_pdata=int
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc Binary files differindex de493636b..64a8e35a6 100755 --- a/atari/res/netsurf.rsc +++ b/atari/res/netsurf.rsc diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh index 3c2353ede..268aff523 100755 --- a/atari/res/netsurf.rsh +++ b/atari/res/netsurf.rsh @@ -41,11 +41,23 @@ #define MAINMENU_M_HELP_CONTENT 61 /* STRING in tree MAINMENU */
#define TOOLBAR 1 /* form/dial */
-#define TOOLBAR_BT_BACK 2 /* CICON in tree TOOLBAR */
-#define TOOLBAR_BT_HOME 3 /* CICON in tree TOOLBAR */
-#define TOOLBAR_BT_FORWARD 4 /* CICON in tree TOOLBAR */
-#define TOOLBAR_BT_STOP 5 /* CICON in tree TOOLBAR */
-#define TOOLBAR_BT_RELOAD 6 /* CICON in tree TOOLBAR */
+#define TOOLBAR_AREA_SEARCH 1 /* BOX in tree TOOLBAR */
+#define TOOLBAR_BT_SEARCH_FWD 2 /* BUTTON in tree TOOLBAR */
+#define TOOLBAR_BT_SEARCH_BACK 3 /* BUTTON in tree TOOLBAR */
+#define TOOLBAR_CB_CASESENSE 5 /* BUTTON in tree TOOLBAR */
+#define TOOLBAR_CB_SHOWALL 6 /* BUTTON in tree TOOLBAR */
+#define TOOLBAR_TB_SRCH 7 /* FTEXT in tree TOOLBAR */
+#define TOOLBAR_SEARCH_ALIGN_RIGHT 8 /* IBOX in tree TOOLBAR */
+#define TOOLBAR_BT_CLOSE_SEARCH 9 /* BUTTON in tree TOOLBAR */
+#define TOOLBAR_AREA_NAVIGATION 10 /* BOX in tree TOOLBAR */
+#define TOOLBAR_AREA_BUTTONS 11 /* IBOX in tree TOOLBAR */
+#define TOOLBAR_BT_BACK 12 /* CICON in tree TOOLBAR */
+#define TOOLBAR_BT_HOME 13 /* CICON in tree TOOLBAR */
+#define TOOLBAR_BT_FORWARD 14 /* CICON in tree TOOLBAR */
+#define TOOLBAR_BT_STOP 15 /* CICON in tree TOOLBAR */
+#define TOOLBAR_BT_RELOAD 16 /* CICON in tree TOOLBAR */
+#define TOOLBAR_AREA_URL 17 /* USERDEF in tree TOOLBAR */
+#define TOOLBAR_THROBBER_AREA 18 /* BOX in tree TOOLBAR */
#define ICONIFY 2 /* form/dial */
#define ICONIFY_GLOBE 1 /* CICON in tree ICONIFY */
@@ -67,40 +79,25 @@ #define LOGIN_BT_LOGIN 5 /* BUTTON in tree LOGIN */
#define LOGIN_BT_ABORT 6 /* BUTTON in tree LOGIN */
-#define VERIFY 6 /* form/dial */
-#define VERIFY_LBL_HOST 3 /* TEXT in tree VERIFY */
-#define VERIFY_BT_ACCEPT 4 /* BUTTON in tree VERIFY */
-#define VERIFY_BT_REJECT 5 /* BUTTON in tree VERIFY */
-#define VERIFY_BT_NEXT_CERT 7 /* BUTTON in tree VERIFY */
-#define VERIFY_BOX_DETAILS 8 /* BOX in tree VERIFY */
-#define VERIFY_BOX_H 9 /* BOX in tree VERIFY */
-#define VERIFY_BT_SCROLL_R 10 /* BOXCHAR in tree VERIFY */
-#define VERIFY_BT_SCROLL_L 11 /* BOXCHAR in tree VERIFY */
-#define VERIFY_BOX_MOVER_H 12 /* BOX in tree VERIFY */
-#define VERIFY_BT_SCROLL_U 13 /* BOXCHAR in tree VERIFY */
-#define VERIFY_BT_SCROLL_D 14 /* BOXCHAR in tree VERIFY */
-#define VERIFY_BOX_V 15 /* BOX in tree VERIFY */
-#define VERIFY_MOVER_V 16 /* BOX in tree VERIFY */
-
-#define THROBBER 7 /* form/dial */
-
-#define TOOLBAR_HOTLIST 8 /* form/dial */
+#define THROBBER 6 /* form/dial */
+
+#define TOOLBAR_HOTLIST 7 /* form/dial */
#define TOOLBAR_HOTLIST_ADD 1 /* CICON in tree TOOLBAR_HOTLIST */
#define TOOLBAR_HOTLIST_CREATE_FOLDER 2 /* CICON in tree TOOLBAR_HOTLIST */
#define TOOLBAR_HOTLIST_DELETE 3 /* CICON in tree TOOLBAR_HOTLIST */
#define TOOLBAR_HOTLIST_EDIT 4 /* CICON in tree TOOLBAR_HOTLIST */
-#define SEARCH 9 /* form/dial */
-#define SEARCH_TB_SRCH 1 /* FTEXT in tree SEARCH */
-#define SEARCH_LBL_SHOWALL 2 /* STRING in tree SEARCH */
-#define SEARCH_LBL_CASESENSE 3 /* STRING in tree SEARCH */
-#define SEARCH_BT_SEARCH 4 /* BUTTON in tree SEARCH */
-#define SEARCH_LBL_FWD 5 /* STRING in tree SEARCH */
-#define SEARCH_CB_CASESENSE 6 /* BUTTON in tree SEARCH */
-#define SEARCH_CB_SHOWALL 7 /* BUTTON in tree SEARCH */
-#define SEARCH_CB_FWD 8 /* BUTTON in tree SEARCH */
-
-#define DOWNLOAD 10 /* form/dial */
+#define SEARCH 8 /* form/dial */
+#define SEARCH_BT_SEARCH 1 /* BUTTON in tree SEARCH */
+#define SEARCH_CB_FWD 2 /* BUTTON in tree SEARCH */
+#define SEARCH_BT_SEARCH_BACK 3 /* BUTTON in tree SEARCH */
+#define SEARCH_CB_CASESENSE 5 /* BOXCHAR in tree SEARCH */
+#define SEARCH_CB_SHOWALL 6 /* BOXCHAR in tree SEARCH */
+#define SEARCH_LBL_SHOWALL 7 /* STRING in tree SEARCH */
+#define SEARCH_LBL_CASESENSE 8 /* TEXT in tree SEARCH */
+#define SEARCH_TB_SRCH 9 /* FTEXT in tree SEARCH */
+
+#define DOWNLOAD 9 /* form/dial */
/* Width ist 400, code depends on that! If you change it, change it in download.c */
#define DOWNLOAD_PROGRESS 1 /* BOX in tree DOWNLOAD */
#define DOWNLOAD_PROGRESS_DONE 2 /* BOX in tree DOWNLOAD */
@@ -110,11 +107,11 @@ #define DOWNLOAD_LBL_BYTES 6 /* TEXT in tree DOWNLOAD */
#define DOWNLOAD_LBL_PERCENT 7 /* TEXT in tree DOWNLOAD */
#define DOWNLOAD_LBL_SPEED 8 /* TEXT in tree DOWNLOAD */
-#define DOWNLOAD_CB_CLOSE_RDY 9 /* BUTTON in tree DOWNLOAD */
+#define DOWNLOAD_CB_CLOSE_RDY 9 /* BOXCHAR in tree DOWNLOAD */
-#define ABOUT 11 /* form/dial */
+#define ABOUT 10 /* form/dial */
-#define POP_CTX 12 /* form/dial */
+#define POP_CTX 11 /* form/dial */
#define POP_CTX_CUT_SEL 1 /* TEXT in tree POP_CTX */
#define POP_CTX_COPY_SEL 2 /* TEXT in tree POP_CTX */
#define POP_CTX_PASTE_SEL 3 /* TEXT in tree POP_CTX */
@@ -126,74 +123,89 @@ #define POP_CTX_VIEW_SOURCE 10 /* TEXT in tree POP_CTX */
#define POP_CTX_SAVE_LINK_AS 11 /* TEXT in tree POP_CTX */
-#define CHOICES 13 /* form/dial */
-#define CHOICES_REG_BROWSER 1 /* BUTTON in tree CHOICES */
-#define CHOICES_REG_RENDER 2 /* BUTTON in tree CHOICES */
-#define CHOICES_REG_STYLE 3 /* BUTTON in tree CHOICES */
-#define CHOICES_REG_NETWORK 4 /* BUTTON in tree CHOICES */
-#define CHOICES_REG_PATH 5 /* BUTTON in tree CHOICES */
-#define CHOICES_REG_CACHE 6 /* BUTTON in tree CHOICES */
-#define CHOICES_TAB_STYLE 7 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_DEF_FONT_SIZE 10 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_DEF_FONT_SIZE 11 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_DEF_FONT_SIZE 12 /* BOXCHAR in tree CHOICES */
-#define CHOICES_EDIT_MIN_FONT_SIZE 16 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_MIN_FONT_SIZE 17 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_MIN_FONT_SIZE 18 /* BOXCHAR in tree CHOICES */
-#define CHOICES_BT_TOOLBAR_ICONSET 22 /* BUTTON in tree CHOICES */
-#define CHOICES_INPUT_TOOLBAR_BGCOLOR 24 /* FTEXT in tree CHOICES */
-#define CHOICES_TAB_RENDER 25 /* BUTTON in tree CHOICES */
+#define VSCROLLER 12 /* form/dial */
+#define VSCROLLER_AREA 1 /* BOX in tree VSCROLLER */
+#define VSCROLLER_SLIDER_AREA 2 /* BUTTON in tree VSCROLLER */
+#define VSCROLLER_SLIDER 3 /* BUTTON in tree VSCROLLER */
+#define VSCROLLER_BT_DOWN 7 /* IBOX in tree VSCROLLER */
+#define VSCROLLER_BT_DOWN_PIC 5 /* CICON in tree VSCROLLER */
+#define VSCROLLER_BT_UP 6 /* IBOX in tree VSCROLLER */
+#define VSCROLLER_BT_UP_PIC 4 /* CICON in tree VSCROLLER */
+
+#define SETTINGS 13 /* form/dial */
+#define SETTINGS_SAVE 1 /* BUTTON in tree SETTINGS */
+#define SETTINGS_ABORT 2 /* BUTTON in tree SETTINGS */
+#define SETTINGS_EDIT_DOWNLOAD_PATH 5 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_HOTLIST_FILE 6 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_CA_BUNDLE 7 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_CA_CERTS_PATH 8 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_EDITOR 9 /* FTEXT in tree SETTINGS */
/* Make sure that initial value is large enough! */
-#define CHOICES_BT_SEL_FONT_RENDERER 26 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_TRANSPARENCY 28 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_ENABLE_ANIMATION 30 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_MIN_GIF_DELAY 33 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_GIF_DELAY 34 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_GIF_DELAY 35 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_INCREMENTAL_REFLOW 37 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_MIN_REFLOW_PERIOD 39 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_INCREMENTAL_REFLOW 40 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_INCREMENTAL_REFLOW 41 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_ANTI_ALIASING 43 /* BUTTON in tree CHOICES */
-#define CHOICES_TAB_PATH 44 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_CA_CERTS_PATH 49 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_DOWNLOAD_PATH 50 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_HOTLIST_FILE 51 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_CA_BUNDLE 52 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_EDITOR 53 /* FTEXT in tree CHOICES */
-#define CHOICES_TAB_CACHE 55 /* BUTTON in tree CHOICES */
-#define CHOICES_INC_MEM_CACHE 59 /* BOXCHAR in tree CHOICES */
-#define CHOICES_DEC_MEM_CACHE 60 /* BOXCHAR in tree CHOICES */
-#define CHOICES_STR_MAX_MEM_CACHE 61 /* STRING in tree CHOICES */
-#define CHOICES_TAB_BROWSER 62 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_HIDE_ADVERTISEMENT 64 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_DISABLE_POPUP_WINDOWS 65 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_SEND_DO_NOT_TRACK 66 /* BUTTON in tree CHOICES */
-#define CHOICES_BT_SEL_LOCALE 68 /* BUTTON in tree CHOICES */
-#define CHOICES_BT_GUI_LANG 71 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_HISTORY_AGE 74 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_HISTORY_AGE 75 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_HISTORY_AGE 76 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_SEND_HTTP_REFERRER 80 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_HOMEPAGE 81 /* FTEXT in tree CHOICES */
-#define CHOICES_BT_CLEAR_HISTORY 82 /* BUTTON in tree CHOICES */
-#define CHOICES_TAB_NETWORK 83 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_USE_PROXY 85 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_PROXY_HOST 86 /* FTEXT in tree CHOICES */
-#define CHOICES_CB_PROXY_AUTH 87 /* BUTTON in tree CHOICES */
-#define CHOICES_EDIT_PROXY_USERNAME 88 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_PROXY_PASSWORD 89 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_PROXY_PORT 91 /* FTEXT in tree CHOICES */
-#define CHOICES_INC_MAX_FETCHERS_PER_HOST 96 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_CACHED_CONNECTIONS 97 /* BOXCHAR in tree CHOICES */
-#define CHOICES_DEC_MAX_FETCHERS_PER_HOST 98 /* BOXCHAR in tree CHOICES */
-#define CHOICES_DEC_CACHED_CONNECTIONS 99 /* BOXCHAR in tree CHOICES */
-#define CHOICES_EDIT_MAX_FETCHERS_PER_HOST 100 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_MAX_CACHED_CONNECTIONS 101 /* FTEXT in tree CHOICES */
-#define CHOICES_EDIT_MAX_FETCHERS 103 /* FTEXT in tree CHOICES */
-#define CHOICES_DEC_MAX_FETCHERS 104 /* BOXCHAR in tree CHOICES */
-#define CHOICES_INC_MAX_FETCHERS 105 /* BOXCHAR in tree CHOICES */
-#define CHOICES_CB_FG_IMAGES 106 /* BUTTON in tree CHOICES */
-#define CHOICES_CB_BG_IMAGES 107 /* BUTTON in tree CHOICES */
-#define CHOICES_ABORT 108 /* BUTTON in tree CHOICES */
-#define CHOICES_OK 109 /* BUTTON in tree CHOICES */
+#define SETTINGS_BT_SEL_FONT_RENDERER 16 /* BUTTON in tree SETTINGS */
+#define SETTINGS_CB_ANTI_ALIASING 17 /* BUTTON in tree SETTINGS */
+#define SETTINGS_CB_TRANSPARENCY 18 /* BUTTON in tree SETTINGS */
+#define SETTINGS_EDIT_DEF_FONT_SIZE 21 /* FTEXT in tree SETTINGS */
+#define SETTINGS_DEC_DEF_FONT_SIZE 22 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_INC_DEF_FONT_SIZE 23 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MIN_FONT_SIZE 25 /* FTEXT in tree SETTINGS */
+#define SETTINGS_DEC_MIN_FONT_SIZE 26 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_INC_MIN_FONT_SIZE 27 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MIN_GIF_DELAY 32 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_GIF_DELAY 33 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_GIF_DELAY 34 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_ENABLE_ANIMATION 37 /* BUTTON in tree SETTINGS */
+#define SETTINGS_CB_BG_IMAGES 39 /* BUTTON in tree SETTINGS */
+#define SETTINGS_CB_FG_IMAGES 41 /* BUTTON in tree SETTINGS */
+#define SETTINGS_EDIT_MIN_REFLOW_PERIOD 44 /* FTEXT in tree SETTINGS */
+#define SETTINGS_DEC_INCREMENTAL_REFLOW 45 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_INC_INCREMENTAL_REFLOW 46 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_CB_USE_PROXY 48 /* BUTTON in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_HOST 49 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_PORT 51 /* FTEXT in tree SETTINGS */
+#define SETTINGS_CB_PROXY_AUTH 52 /* BUTTON in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_USERNAME 53 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_PROXY_PASSWORD 54 /* FTEXT in tree SETTINGS */
+#define SETTINGS_EDIT_MAX_FETCHERS 59 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_MAX_FETCHERS 60 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_MAX_FETCHERS 61 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_MAX_FETCHERS_PER_HOST 63 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MAX_FETCHERS_PER_HOST 64 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_MAX_FETCHERS_PER_HOST 65 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_CACHED_CONNECTIONS 67 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_MAX_CACHED_CONNECTIONS 68 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_CACHED_CONNECTIONS 69 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_HOMEPAGE 71 /* FTEXT in tree SETTINGS */
+#define SETTINGS_CB_HIDE_ADVERTISEMENT 72 /* BUTTON in tree SETTINGS */
+#define SETTINGS_CB_DISABLE_POPUP_WINDOWS 73 /* BUTTON in tree SETTINGS */
+#define SETTINGS_CB_SEND_HTTP_REFERRER 74 /* BUTTON in tree SETTINGS */
+#define SETTINGS_CB_SEND_DO_NOT_TRACK 75 /* BUTTON in tree SETTINGS */
+#define SETTINGS_BT_CLEAR_HISTORY 77 /* BUTTON in tree SETTINGS */
+#define SETTINGS_BT_SEL_LOCALE 79 /* BUTTON in tree SETTINGS */
+#define SETTINGS_BT_GUI_LANG 81 /* BUTTON in tree SETTINGS */
+#define SETTINGS_INC_MEM_CACHE 84 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_DEC_MEM_CACHE 85 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_STR_MAX_MEM_CACHE 86 /* STRING in tree SETTINGS */
+#define SETTINGS_DEC_HISTORY_AGE 89 /* BOXCHAR in tree SETTINGS */
+#define SETTINGS_EDIT_HISTORY_AGE 90 /* FTEXT in tree SETTINGS */
+#define SETTINGS_INC_HISTORY_AGE 91 /* BOXCHAR in tree SETTINGS */
+
+#define POP_LANGUAGE 14 /* form/dial */
+#define POP_LANGUAGE_CS 1 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_DE 2 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_EN 3 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_EN_GB 4 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_DE_DE 5 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_EN_US 6 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_ES 7 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_FR 8 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_IT 9 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_NL 10 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_NO 11 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_PL 12 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_RU 13 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_SK 14 /* STRING in tree POP_LANGUAGE */
+#define POP_LANGUAGE_SV 15 /* STRING in tree POP_LANGUAGE */
+
+#define POP_FONT_RENDERER 15 /* form/dial */
+#define POP_FONT_RENDERER_INTERNAL 1 /* STRING in tree POP_FONT_RENDERER */
+#define POP_FONT_RENDERER_FREETYPE 2 /* STRING in tree POP_FONT_RENDERER */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm index 67af68f5c..189c6001f 100755 --- a/atari/res/netsurf.rsm +++ b/atari/res/netsurf.rsm @@ -1,9 +1,9 @@ ResourceMaster v3.65
-#C 14@0@0@0@
+#C 16@0@0@0@
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
-#R 0@0@1@1@1@1@
-#M 20010100@0@7728@603@
+#R 0@0@1@1@2@1@
+#M 20010100@0@7728@640@
#T 0@1@MAINMENU@@62@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -43,12 +43,24 @@ ResourceMaster v3.65 #O 58@28@M_CHOICES@@
#O 59@28@M_VLOG@@
#O 61@28@M_HELP_CONTENT@@
-#T 1@2@TOOLBAR@@7@@
-#O 2@33@BT_BACK@@
-#O 3@33@BT_HOME@@
-#O 4@33@BT_FORWARD@@
-#O 5@33@BT_STOP@@
-#O 6@33@BT_RELOAD@@
+#T 1@2@TOOLBAR@@19@@
+#O 1@20@AREA_SEARCH@@
+#O 2@26@BT_SEARCH_FWD@@
+#O 3@26@BT_SEARCH_BACK@@
+#O 5@26@CB_CASESENSE@@
+#O 6@26@CB_SHOWALL@@
+#O 7@29@TB_SRCH@@
+#O 8@25@SEARCH_ALIGN_RIGHT@@
+#O 9@26@BT_CLOSE_SEARCH@@
+#O 10@20@AREA_NAVIGATION@@
+#O 11@25@AREA_BUTTONS@@
+#O 12@33@BT_BACK@@
+#O 13@33@BT_HOME@@
+#O 14@33@BT_FORWARD@@
+#O 15@33@BT_STOP@@
+#O 16@33@BT_RELOAD@@
+#O 17@24@AREA_URL@@
+#O 18@20@THROBBER_AREA@@
#T 2@2@ICONIFY@@3@@
#O 1@33@GLOBE@@
#T 3@2@FAVICON@@2@@
@@ -65,37 +77,22 @@ ResourceMaster v3.65 #O 4@29@TB_PASSWORD@@
#O 5@26@BT_LOGIN@@
#O 6@26@BT_ABORT@@
-#T 6@2@VERIFY@@17@@
-#O 0@20@@VERT SLIDER SIND HIDDEN!@
-#O 3@21@LBL_HOST@@
-#O 4@26@BT_ACCEPT@@
-#O 5@26@BT_REJECT@@
-#O 7@26@BT_NEXT_CERT@@
-#O 8@20@BOX_DETAILS@@
-#O 9@20@BOX_H@@
-#O 10@27@BT_SCROLL_R@@
-#O 11@27@BT_SCROLL_L@@
-#O 12@20@BOX_MOVER_H@@
-#O 13@27@BT_SCROLL_U@@
-#O 14@27@BT_SCROLL_D@@
-#O 15@20@BOX_V@@
-#O 16@20@MOVER_V@@
-#T 7@2@THROBBER@@14@@
-#T 8@2@TOOLBAR_HOTLIST@@5@@
+#T 6@2@THROBBER@@14@@
+#T 7@2@TOOLBAR_HOTLIST@@5@@
#O 1@33@ADD@@
#O 2@33@CREATE_FOLDER@@
#O 3@33@DELETE@@
#O 4@33@EDIT@@
-#T 9@2@SEARCH@@9@@
-#O 1@29@TB_SRCH@@
-#O 2@28@LBL_SHOWALL@@
-#O 3@28@LBL_CASESENSE@@
-#O 4@26@BT_SEARCH@@
-#O 5@28@LBL_FWD@@
-#O 6@26@CB_CASESENSE@@
-#O 7@26@CB_SHOWALL@@
-#O 8@26@CB_FWD@@
-#T 10@2@DOWNLOAD@@10@@
+#T 8@2@SEARCH@@10@@
+#O 1@26@BT_SEARCH@@
+#O 2@26@CB_FWD@@
+#O 3@26@BT_SEARCH_BACK@@
+#O 5@27@CB_CASESENSE@@
+#O 6@27@CB_SHOWALL@@
+#O 7@28@LBL_SHOWALL@@
+#O 8@21@LBL_CASESENSE@@
+#O 9@29@TB_SRCH@@
+#T 9@2@DOWNLOAD@@10@@
#O 1@20@PROGRESS@Width ist 400, code depends on that! If you change it, change it in download.c@
#O 2@20@PROGRESS_DONE@@
#O 3@21@FILENAME@@
@@ -104,9 +101,9 @@ ResourceMaster v3.65 #O 6@21@LBL_BYTES@@
#O 7@21@LBL_PERCENT@@
#O 8@21@LBL_SPEED@@
-#O 9@26@CB_CLOSE_RDY@@
-#T 11@2@ABOUT@@2@@
-#T 12@2@POP_CTX@@12@@
+#O 9@27@CB_CLOSE_RDY@@
+#T 10@2@ABOUT@@2@@
+#T 11@2@POP_CTX@@12@@
#O 1@21@CUT_SEL@@
#O 2@21@COPY_SEL@@
#O 3@21@PASTE_SEL@@
@@ -117,74 +114,86 @@ ResourceMaster v3.65 #O 9@21@SAVE_AS@@
#O 10@21@VIEW_SOURCE@@
#O 11@21@SAVE_LINK_AS@@
-#T 13@2@CHOICES@@110@@
-#O 1@26@REG_BROWSER@@
-#O 2@26@REG_RENDER@@
-#O 3@26@REG_STYLE@@
-#O 4@26@REG_NETWORK@@
-#O 5@26@REG_PATH@@
-#O 6@26@REG_CACHE@@
-#O 7@26@TAB_STYLE@@
-#O 10@29@EDIT_DEF_FONT_SIZE@@
-#O 11@27@DEC_DEF_FONT_SIZE@@
-#O 12@27@INC_DEF_FONT_SIZE@@
-#O 16@29@EDIT_MIN_FONT_SIZE@@
-#O 17@27@DEC_MIN_FONT_SIZE@@
-#O 18@27@INC_MIN_FONT_SIZE@@
-#O 22@26@BT_TOOLBAR_ICONSET@@
-#O 24@29@INPUT_TOOLBAR_BGCOLOR@@
-#O 25@26@TAB_RENDER@@
-#O 26@26@BT_SEL_FONT_RENDERER@Make sure that initial value is large enough!@
-#O 28@26@CB_TRANSPARENCY@@
-#O 30@26@CB_ENABLE_ANIMATION@@
-#O 33@29@EDIT_MIN_GIF_DELAY@@
+#T 12@2@VSCROLLER@@8@@
+#O 1@20@AREA@@
+#O 2@26@SLIDER_AREA@@
+#O 3@26@SLIDER@@
+#O 7@25@BT_DOWN@@
+#O 5@33@BT_DOWN_PIC@@
+#O 6@25@BT_UP@@
+#O 4@33@BT_UP_PIC@@
+#T 13@2@SETTINGS@@93@@
+#O 1@26@SAVE@@
+#O 2@26@ABORT@@
+#O 5@29@EDIT_DOWNLOAD_PATH@@
+#O 6@29@EDIT_HOTLIST_FILE@@
+#O 7@29@EDIT_CA_BUNDLE@@
+#O 8@29@EDIT_CA_CERTS_PATH@@
+#O 9@29@EDIT_EDITOR@@
+#O 16@26@BT_SEL_FONT_RENDERER@Make sure that initial value is large enough!@
+#O 17@26@CB_ANTI_ALIASING@@
+#O 18@26@CB_TRANSPARENCY@@
+#O 21@29@EDIT_DEF_FONT_SIZE@@
+#O 22@27@DEC_DEF_FONT_SIZE@@
+#O 23@27@INC_DEF_FONT_SIZE@@
+#O 25@29@EDIT_MIN_FONT_SIZE@@
+#O 26@27@DEC_MIN_FONT_SIZE@@
+#O 27@27@INC_MIN_FONT_SIZE@@
+#O 32@29@EDIT_MIN_GIF_DELAY@@
+#O 33@27@INC_GIF_DELAY@@
#O 34@27@DEC_GIF_DELAY@@
-#O 35@27@INC_GIF_DELAY@@
-#O 37@26@CB_INCREMENTAL_REFLOW@@
-#O 39@29@EDIT_MIN_REFLOW_PERIOD@@
-#O 40@27@DEC_INCREMENTAL_REFLOW@@
-#O 41@27@INC_INCREMENTAL_REFLOW@@
-#O 43@26@CB_ANTI_ALIASING@@
-#O 44@26@TAB_PATH@@
-#O 49@29@EDIT_CA_CERTS_PATH@@
-#O 50@29@EDIT_DOWNLOAD_PATH@@
-#O 51@29@EDIT_HOTLIST_FILE@@
-#O 52@29@EDIT_CA_BUNDLE@@
-#O 53@29@EDIT_EDITOR@@
-#O 55@26@TAB_CACHE@@
-#O 59@27@INC_MEM_CACHE@@
-#O 60@27@DEC_MEM_CACHE@@
-#O 61@28@STR_MAX_MEM_CACHE@@
-#O 62@26@TAB_BROWSER@@
-#O 64@26@CB_HIDE_ADVERTISEMENT@@
-#O 65@26@CB_DISABLE_POPUP_WINDOWS@@
-#O 66@26@CB_SEND_DO_NOT_TRACK@@
-#O 68@26@BT_SEL_LOCALE@@
-#O 71@26@BT_GUI_LANG@@
-#O 74@29@EDIT_HISTORY_AGE@@
-#O 75@27@DEC_HISTORY_AGE@@
-#O 76@27@INC_HISTORY_AGE@@
-#O 80@26@CB_SEND_HTTP_REFERRER@@
-#O 81@29@EDIT_HOMEPAGE@@
-#O 82@26@BT_CLEAR_HISTORY@@
-#O 83@26@TAB_NETWORK@@
-#O 85@26@CB_USE_PROXY@@
-#O 86@29@EDIT_PROXY_HOST@@
-#O 87@26@CB_PROXY_AUTH@@
-#O 88@29@EDIT_PROXY_USERNAME@@
-#O 89@29@EDIT_PROXY_PASSWORD@@
-#O 91@29@EDIT_PROXY_PORT@@
-#O 96@27@INC_MAX_FETCHERS_PER_HOST@@
-#O 97@27@INC_CACHED_CONNECTIONS@@
-#O 98@27@DEC_MAX_FETCHERS_PER_HOST@@
-#O 99@27@DEC_CACHED_CONNECTIONS@@
-#O 100@29@EDIT_MAX_FETCHERS_PER_HOST@@
-#O 101@29@EDIT_MAX_CACHED_CONNECTIONS@@
-#O 103@29@EDIT_MAX_FETCHERS@@
-#O 104@27@DEC_MAX_FETCHERS@@
-#O 105@27@INC_MAX_FETCHERS@@
-#O 106@26@CB_FG_IMAGES@@
-#O 107@26@CB_BG_IMAGES@@
-#O 108@26@ABORT@@
-#O 109@26@OK@@
-#c 31683@
+#O 37@26@CB_ENABLE_ANIMATION@@
+#O 39@26@CB_BG_IMAGES@@
+#O 41@26@CB_FG_IMAGES@@
+#O 44@29@EDIT_MIN_REFLOW_PERIOD@@
+#O 45@27@DEC_INCREMENTAL_REFLOW@@
+#O 46@27@INC_INCREMENTAL_REFLOW@@
+#O 48@26@CB_USE_PROXY@@
+#O 49@29@EDIT_PROXY_HOST@@
+#O 51@29@EDIT_PROXY_PORT@@
+#O 52@26@CB_PROXY_AUTH@@
+#O 53@29@EDIT_PROXY_USERNAME@@
+#O 54@29@EDIT_PROXY_PASSWORD@@
+#O 59@29@EDIT_MAX_FETCHERS@@
+#O 60@27@INC_MAX_FETCHERS@@
+#O 61@27@DEC_MAX_FETCHERS@@
+#O 63@27@DEC_MAX_FETCHERS_PER_HOST@@
+#O 64@29@EDIT_MAX_FETCHERS_PER_HOST@@
+#O 65@27@INC_MAX_FETCHERS_PER_HOST@@
+#O 67@27@DEC_CACHED_CONNECTIONS@@
+#O 68@29@EDIT_MAX_CACHED_CONNECTIONS@@
+#O 69@27@INC_CACHED_CONNECTIONS@@
+#O 71@29@EDIT_HOMEPAGE@@
+#O 72@26@CB_HIDE_ADVERTISEMENT@@
+#O 73@26@CB_DISABLE_POPUP_WINDOWS@@
+#O 74@26@CB_SEND_HTTP_REFERRER@@
+#O 75@26@CB_SEND_DO_NOT_TRACK@@
+#O 77@26@BT_CLEAR_HISTORY@@
+#O 79@26@BT_SEL_LOCALE@@
+#O 81@26@BT_GUI_LANG@@
+#O 84@27@INC_MEM_CACHE@@
+#O 85@27@DEC_MEM_CACHE@@
+#O 86@28@STR_MAX_MEM_CACHE@@
+#O 89@27@DEC_HISTORY_AGE@@
+#O 90@29@EDIT_HISTORY_AGE@@
+#O 91@27@INC_HISTORY_AGE@@
+#T 14@2@POP_LANGUAGE@@16@@
+#O 1@28@CS@@
+#O 2@28@DE@@
+#O 3@28@EN@@
+#O 4@28@EN_GB@@
+#O 5@28@DE_DE@@
+#O 6@28@EN_US@@
+#O 7@28@ES@@
+#O 8@28@FR@@
+#O 9@28@IT@@
+#O 10@28@NL@@
+#O 11@28@NO@@
+#O 12@28@PL@@
+#O 13@28@RU@@
+#O 14@28@SK@@
+#O 15@28@SV@@
+#T 15@2@POP_FONT_RENDERER@@3@@
+#O 1@28@INTERNAL@@
+#O 2@28@FREETYPE@@
+#c 22411@
diff --git a/atari/rootwin.c b/atari/rootwin.c new file mode 100755 index 000000000..45f55684f --- /dev/null +++ b/atari/rootwin.c @@ -0,0 +1,1470 @@ +/* + * 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/>. + * + * Module Description: + * + * This File implements the NetSurf Browser window, or passed functionality to + * the appropriate widget's. + * + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <limits.h> +#include <unistd.h> +#include <string.h> +#include <stdlib.h> +#include <stdbool.h> +#include <assert.h> +#include <math.h> +#include <osbind.h> + +#include <mt_gem.h> + +#include "utils/log.h" +#include "desktop/gui.h" +#include "desktop/history_core.h" +#include "desktop/netsurf.h" +#include "desktop/browser.h" +#include "desktop/browser_private.h" +#include "desktop/mouse.h" +#include "desktop/plotters.h" +#include "desktop/textinput.h" +#include "content/content.h" +#include "content/hlcache.h" +#include "content/urldb.h" +#include "css/css.h" + +#include "atari/res/netsurf.rsh" +#include "atari/gemtk/gemtk.h" +#include "atari/ctxmenu.h" +#include "atari/gui.h" +#include "atari/rootwin.h" +#include "atari/misc.h" +#include "atari/plot/plot.h" +#include "atari/toolbar.h" +#include "atari/statusbar.h" +#include "atari/search.h" +#include "atari/osspec.h" +#include "atari/encoding.h" +#include "atari/redrawslots.h" +#include "atari/toolbar.h" +#include "atari/gemtk/gemtk.h" + +extern struct gui_window *input_window; +extern EVMULT_OUT aes_event_out; +extern GRECT desk_area; + +struct rootwin_data_s { + struct s_gui_win_root *rootwin; +}; + +/* -------------------------------------------------------------------------- */ +/* Static module event handlers */ +/* -------------------------------------------------------------------------- */ +static void on_redraw(ROOTWIN *rootwin, short msg[8]); +static void on_resized(ROOTWIN *rootwin); +static void on_file_dropped(ROOTWIN *rootwin, short msg[8]); +static short on_window_key_input(ROOTWIN * rootwin, unsigned short nkc); +static bool on_content_mouse_click(ROOTWIN *rootwin); +static bool on_content_mouse_move(ROOTWIN *rootwin, GRECT *content_area); +static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip); + +static bool redraw_active = false; + +static const struct redraw_context rootwin_rdrw_ctx = { + .interactive = true, + .background_images = true, + .plot = &atari_plotters +}; + +static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) +{ + short retval = 0; + GRECT area; + static bool prev_url = false; + static short prev_x=0; + static short prev_y=0; + struct rootwin_data_s * data = gemtk_wm_get_user_data(win); + struct gui_window *tmp; + OBJECT *obj; + + + if ((ev_out->emo_events & MU_MESAG) != 0) { + // handle message + //printf("root win msg: %d\n", msg[0]); + switch (msg[0]) { + + case WM_REDRAW: + LOG(("WM_REDRAW")); + on_redraw(data->rootwin, msg); + break; + + case WM_REPOSED: + case WM_SIZED: + case WM_MOVED: + case WM_FULLED: + LOG(("WM_SIZED")); + on_resized(data->rootwin); + break; + + case WM_ICONIFY: + // TODO: find next active gui window and schedule redraw for that. + tmp = window_list; + while(tmp != NULL){ + if(tmp->root != data->rootwin){ + gemtk_wm_send_msg(tmp->root->win, WM_TOPPED, 0, 0, 0, 0); + break; + } + tmp = tmp->next; + } + break; + + case WM_TOPPED: + case WM_NEWTOP: + case WM_UNICONIFY: + LOG(("WM_TOPPED")); + gui_set_input_gui_window(data->rootwin->active_gui_window); + //window_restore_active_gui_window(data->rootwin); + // TODO: use something like "restore_active_gui_window_state()" + + break; + + case WM_CLOSED: + // TODO: this needs to iterate through all gui windows and + // check if the rootwin is this window... + if (data->rootwin->active_gui_window != NULL) { + LOG(("WM_CLOSED initiated destroy for bw %p", + data->rootwin->active_gui_window->browser->bw)); + browser_window_destroy( + data->rootwin->active_gui_window->browser->bw); + } + break; + + case AP_DRAGDROP: + on_file_dropped(data->rootwin, msg); + break; + + case WM_TOOLBAR: + toolbar_mouse_input(data->rootwin->toolbar, msg[4], msg[7]); + break; + + default: + break; + } + } + if ((ev_out->emo_events & MU_KEYBD) != 0) { + + // handle key + uint16_t nkc = gem_to_norm( (short)ev_out->emo_kmeta, + (short)ev_out->emo_kreturn); + retval = on_window_key_input(data->rootwin, nkc); + + } + if ((ev_out->emo_events & MU_BUTTON) != 0) { + window_get_grect(data->rootwin, BROWSER_AREA_CONTENT, + &area); + if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y, + area)) { + on_content_mouse_click(data->rootwin); + } + } + if ((ev_out->emo_events & (MU_M1)) != 0) { + + short ghandle = wind_find(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y); + + if (data->rootwin->aes_handle==ghandle) { + // The window found at x,y is an gui_window + // and it's the input window. + window_get_grect(data->rootwin, BROWSER_AREA_CONTENT, + &area); + if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y, + area)) { + on_content_mouse_move(data->rootwin, &area); + } else { + GRECT tb_area; + window_get_grect(data->rootwin, BROWSER_AREA_URL_INPUT, &tb_area); + if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y, + tb_area)) { + gem_set_cursor(&gem_cursors.ibeam); + prev_url = true; + } else { + if(prev_url) { + struct gui_window *gw; + gw = window_get_active_gui_window(data->rootwin); + gem_set_cursor(gw->cursor); + prev_url = false; + } + } + } + } + } + + return(retval); +} + +/* -------------------------------------------------------------------------- */ +/* Module public functions: */ +/* -------------------------------------------------------------------------- */ + +int window_create(struct gui_window * gw, + struct browser_window * bw, + struct browser_window * clone, + unsigned long inflags) +{ + int err = 0; + bool tb, sb; + int flags; + struct rootwin_data_s *data; + struct gemtk_wm_scroll_info_s *slid; + + tb = (inflags & WIDGET_TOOLBAR); + sb = (inflags & WIDGET_STATUSBAR); + + flags = CLOSER | MOVER | NAME | FULLER | SMALLER; + if( inflags & WIDGET_SCROLL ) { + flags |= (UPARROW | DNARROW | LFARROW | RTARROW | VSLIDE | HSLIDE); + } + if( inflags & WIDGET_RESIZE ) { + flags |= ( SIZER ); + } + if( inflags & WIDGET_STATUSBAR ) { + flags |= ( INFO ); + } + + gw->root = malloc(sizeof(struct s_gui_win_root)); + if (gw->root == NULL) + return(-1); + memset(gw->root, 0, sizeof(struct s_gui_win_root) ); + gw->root->title = malloc(atari_sysinfo.aes_max_win_title_len+1); + + redraw_slots_init(&gw->root->redraw_slots, 8); + + gw->root->aes_handle = wind_create(flags, 40, 40, desk_area.g_w, + desk_area.g_h); + if(gw->root->aes_handle<0) { + free(gw->root->title); + free(gw->root); + return( -1 ); + } + gw->root->win = gemtk_wm_add(gw->root->aes_handle, + GEMTK_WM_FLAG_PREPROC_WM | GEMTK_WM_FLAG_RECV_PREPROC_WM, handle_event); + + data = malloc(sizeof(struct rootwin_data_s)); + data->rootwin = gw->root; + gemtk_wm_set_user_data(gw->root->win, (void*)data); + slid = gemtk_wm_get_scroll_info(gw->root->win); + slid->y_unit_px = 32; + slid->x_unit_px = 32; + + /* create */ + if(tb) { + gw->root->toolbar = toolbar_create(gw->root); + assert(gw->root->toolbar); + gemtk_wm_set_toolbar(gw->root->win, gw->root->toolbar->form, 0, 0); + gemtk_wm_set_toolbar_redraw_func(gw->root->win, toolbar_redraw_cb); + } else { + gw->root->toolbar = NULL; + } + + /* create browser component: */ + gw->browser = (struct s_browser *)malloc( sizeof(struct s_browser)); + + assert(gw->browser); + + gw->browser->bw = bw; + if(clone) + gw->browser->bw->scale = clone->scale; + else + gw->browser->bw->scale = 1; + + + /* create statusbar component: */ + if(sb) { + gw->root->statusbar = sb_create( gw ); + } else { + gw->root->statusbar = NULL; + } + + // Setup some window defaults: + wind_set_str(gw->root->aes_handle, WF_NAME, (char*)"NetSurf"); + wind_set(gw->root->aes_handle, WF_OPTS, 1, WO0_FULLREDRAW, 0, 0); + wind_set(gw->root->aes_handle, WF_OPTS, 1, WO0_NOBLITW, 0, 0); + wind_set(gw->root->aes_handle, WF_OPTS, 1, WO0_NOBLITH, 0, 0); + + if (inflags & WIN_TOP) { + window_set_focus(gw->root, BROWSER, gw->browser); + } + + return (err); +} + +void window_unref_gui_window(ROOTWIN *rootwin, struct gui_window *gw) +{ + struct gui_window *w; + input_window = NULL; + + LOG(("window: %p, gui_window: %p", rootwin, gw)); + + w = window_list; + // find the next active tab: + while( w != NULL ) { + if(w->root == rootwin && w != gw) { + LOG(("activating next tab %p", w)); + gui_set_input_gui_window(w); + break; + } + w = w->next; + } + if(input_window == NULL) { + // the last gui window for this rootwin was removed: + redraw_slots_free(&rootwin->redraw_slots); + window_destroy(rootwin); + } +} + +int window_destroy(ROOTWIN *rootwin) +{ + int err = 0; + struct gui_window *w; + + assert(rootwin != NULL); + + LOG(("%p", rootwin)); + + if (gemtk_wm_get_user_data(rootwin->win) != NULL) { + free(gemtk_wm_get_user_data(rootwin->win)); + } + + // make sure we do not destroy windows which have gui_windows attached: + w = window_list; + while( w != NULL ) { + if(w->root == rootwin) { + assert(rootwin == NULL); + } + w = w->next; + } + + if (rootwin->toolbar) + toolbar_destroy(rootwin->toolbar); + + if(rootwin->statusbar) + sb_destroy(rootwin->statusbar); + + if(rootwin->title) + free(rootwin->title); + + gemtk_wm_remove(rootwin->win); + wind_close(rootwin->aes_handle); + wind_delete(rootwin->aes_handle); + free(rootwin); + return(err); +} + + +void window_open(ROOTWIN *rootwin, struct gui_window *gw, GRECT pos) +{ + GRECT br, g; + + rootwin->active_gui_window = gw; + + assert(rootwin->active_gui_window != NULL); + + wind_open(rootwin->aes_handle, pos.g_x, pos.g_y, pos.g_w, pos.g_h ); + wind_set_str(rootwin->aes_handle, WF_NAME, (char *)""); + + rootwin->active_gui_window->browser->attached = true; + if(rootwin->statusbar != NULL) { + sb_attach(rootwin->statusbar, rootwin->active_gui_window); + } + gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_TOOLBAR, &g); + toolbar_set_attached(rootwin->toolbar, true); + toolbar_set_dimensions(rootwin->toolbar, &g); + window_update_back_forward(rootwin); + + window_set_focus(rootwin, BROWSER, rootwin->active_gui_window->browser); +} + +void window_restore_active_gui_window(ROOTWIN *rootwin) +{ + GRECT tb_area; + struct gui_window *gw; + + LOG(("")); + + assert(rootwin->active_gui_window); + + gw = rootwin->active_gui_window; + + window_set_icon(rootwin, gw->icon); + window_set_stauts(rootwin, gw->status); + window_set_title(rootwin, gw->title); + + if (gw->search != NULL) { + // TODO: update search session (especially browser window) + } + + toolbar_get_grect(rootwin->toolbar, 0, &tb_area); + gemtk_wm_set_toolbar_size(rootwin->win, tb_area.g_h); + + window_update_back_forward(rootwin); + + toolbar_set_url(rootwin->toolbar, gw->url); +} + + +/* update back forward buttons (see tb_update_buttons (bug) ) */ +void window_update_back_forward(struct s_gui_win_root *rootwin) +{ + struct gui_window * active_gw = rootwin->active_gui_window; + toolbar_update_buttons(rootwin->toolbar, active_gw->browser->bw, -1); +} + +void window_set_stauts(struct s_gui_win_root *rootwin, char * text) +{ + assert(rootwin != NULL); + + CMP_STATUSBAR sb = rootwin->statusbar; + + if( sb == NULL) + return; + + if(text != NULL) + sb_set_text(sb, text); + else + sb_set_text(sb, ""); +} + +void window_set_title(struct s_gui_win_root * rootwin, char *title) +{ + wind_set_str(rootwin->aes_handle, WF_NAME, title); +} + +void window_scroll_by(ROOTWIN *root, int sx, int sy) +{ + int units; + GRECT content_area; + struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(root->win); + + if(sx < 0) { + sx = 0; + } + if(sy<0) { + sy = 0; + } + int xunits = sx / slid->x_unit_px; + int yunits = sy / slid->y_unit_px; + + gemtk_wm_scroll(root->win, GEMTK_WM_VSLIDER, yunits - slid->y_pos, false); + gemtk_wm_scroll(root->win, GEMTK_WM_HSLIDER, xunits - slid->x_pos, false); + gemtk_wm_update_slider(root->win, GEMTK_WM_VH_SLIDER); +} + +/** +* Set the dimensions of the scrollable content. +* +*/ +void window_set_content_size(ROOTWIN *rootwin, int width, int height) +{ + GRECT area; + struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(rootwin->win); + + window_get_grect(rootwin, BROWSER_AREA_CONTENT, &area); + + slid->x_units = (width/slid->x_unit_px); + slid->y_units = (height/slid->y_unit_px); + if(slid->x_units < slid->x_pos) + slid->x_pos = 0; + if(slid->y_units < slid->y_pos) + slid->y_pos = 0; + gemtk_wm_update_slider(rootwin->win, GEMTK_WM_VH_SLIDER); +} + +/* set focus to an arbitary element */ +void window_set_focus(struct s_gui_win_root *rootwin, + enum focus_element_type type, void * element) +{ + struct textarea * ta; + + assert(rootwin != NULL); + + if (rootwin->focus.type != type || rootwin->focus.element != element) { + LOG(("Set focus: %p (%d)\n", element, type)); + rootwin->focus.type = type; + rootwin->focus.element = element; + switch( type ) { + + case URL_WIDGET: + // TODO: make something like: toolbar_text_select_all(); + toolbar_key_input(rootwin->toolbar, (short)(NKF_CTRL | 'A') ); +/* + ta = toolbar_get_textarea(rootwin->toolbar, + URL_INPUT_TEXT_AREA); + textarea_keypress(ta, KEY_SELECT_ALL); + */ + break; + + case SEARCH_INPUT: + gemtk_wm_set_toolbar_edit_obj(rootwin->win, TOOLBAR_TB_SRCH, 0); + break; + + default: + break; + + } + } +} + +/* check if the url widget has focus */ +bool window_url_widget_has_focus(struct s_gui_win_root *rootwin) +{ + assert(rootwin != NULL); + + if (rootwin->focus.type == URL_WIDGET) { + return true; + } + return false; +} + +/* check if an arbitary window widget / or frame has the focus */ +bool window_widget_has_focus(struct s_gui_win_root *rootwin, + enum focus_element_type t, void * element) +{ + assert(rootwin != NULL); + if( element == NULL ) { + return((rootwin->focus.type == t)); + } + + return((element == rootwin->focus.element && t == rootwin->focus.type)); +} + +void window_set_icon(ROOTWIN *rootwin, struct bitmap * bmp ) +{ + rootwin->icon = bmp; + /* redraw window when it is iconyfied: */ + if (rootwin->icon != NULL) { + short info, dummy; + if (gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED) { + window_redraw_favicon(rootwin, NULL); + } + } +} + +void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window *gw) +{ + struct gui_window *old_gw = rootwin->active_gui_window; + + LOG(("")); + + if (rootwin->active_gui_window != NULL) { + if(rootwin->active_gui_window == gw) { + LOG(("nothing to do...")); + return; + } + } + + // TODO: when the window isn't on top, initiate WM_TOPPED. + + rootwin->active_gui_window = gw; + if (old_gw != NULL) { + LOG(("restoring window...")); + window_restore_active_gui_window(rootwin); + } +} + +struct gui_window * window_get_active_gui_window(ROOTWIN * rootwin) +{ + return(rootwin->active_gui_window); +} + +void window_get_scroll(ROOTWIN *rootwin, int *x, int *y) +{ + struct gemtk_wm_scroll_info_s *slid; + + slid = gemtk_wm_get_scroll_info(rootwin->win); + + *x = slid->x_pos * slid->x_unit_px; + *y = slid->y_pos * slid->y_unit_px; +} + +void window_get_grect(ROOTWIN *rootwin, enum browser_area_e which, GRECT *d) +{ + + d->g_x = 0; + d->g_y = 0; + d->g_w = 0; + d->g_h = 0; + + if (which == BROWSER_AREA_TOOLBAR) { + // gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_TOOLBAR, d); + toolbar_get_grect(rootwin->toolbar, 0, d); + + } else if (which == BROWSER_AREA_CONTENT) { + + GRECT tb_area; + + gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, d); + toolbar_get_grect(rootwin->toolbar, 0, &tb_area); + + d->g_y += tb_area.g_h; + d->g_h -= tb_area.g_h; + + } else if (which == BROWSER_AREA_URL_INPUT) { + + toolbar_get_grect(rootwin->toolbar, TOOLBAR_AREA_URL, d); + + } else if (which == BROWSER_AREA_SEARCH) { + // todo: check if search is visible + toolbar_get_grect(rootwin->toolbar, TOOLBAR_AREA_SEARCH, d); + } else { + + } + + + // sanitize the results + if (d->g_h < 0) { + d->g_h = 0; + } + if (d->g_w < 0) { + d->g_w = 0; + } + + //printf("window_get_grect %d:", which); + //dbg_grect("", d); + +} + + +void window_open_search(ROOTWIN *rootwin, bool reformat) +{ + struct browser_window *bw; + struct gui_window *gw; + GRECT area; + OBJECT *obj; + + LOG(("")); + + gw = rootwin->active_gui_window; + bw = gw->browser->bw; + obj = toolbar_get_form(rootwin->toolbar); + + if (gw->search == NULL) { + gw->search = nsatari_search_session_create(obj, bw); + } + + toolbar_set_visible(rootwin->toolbar, TOOLBAR_AREA_SEARCH, true); + window_get_grect(rootwin, BROWSER_AREA_TOOLBAR, &area); + gemtk_wm_set_toolbar_size(rootwin->win, area.g_h); + window_get_grect(rootwin, BROWSER_AREA_SEARCH, &area); + window_schedule_redraw_grect(rootwin, &area); + window_process_redraws(rootwin); + window_set_focus(rootwin, SEARCH_INPUT, NULL); + + window_get_grect(rootwin, BROWSER_AREA_CONTENT, &area); + if (reformat) { + browser_window_reformat(bw, false, area.g_w, area.g_h); + } +} + +void window_close_search(ROOTWIN *rootwin) +{ + struct browser_window *bw; + struct gui_window *gw; + GRECT area; + OBJECT *obj; + + + gw = rootwin->active_gui_window; + bw = gw->browser->bw; + obj = gemtk_obj_get_tree(TOOLBAR); + + if (gw->search != NULL) { + nsatari_search_session_destroy(gw->search); + gw->search = NULL; + } + + toolbar_set_visible(rootwin->toolbar, TOOLBAR_AREA_SEARCH, false); + window_get_grect(rootwin, BROWSER_AREA_TOOLBAR, &area); + gemtk_wm_set_toolbar_size(rootwin->win, area.g_h); + window_get_grect(rootwin, BROWSER_AREA_CONTENT, &area); + browser_window_reformat(bw, false, area.g_w, area.g_h); +} + +/** + * Redraw the favicon +*/ +void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip) +{ + GRECT work; + + assert(rootwin); + + //printf("window_redraw_favicon: root: %p, win: %p\n", rootwin, rootwin->win); + + gemtk_wm_clear(rootwin->win); + gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, &work); + + if (clip == NULL) { + clip = &work; + } else { + if(!rc_intersect(&work, clip)) { + return; + } + } + + if (rootwin->icon == NULL) { + //printf("window_redraw_favicon OBJCTREE\n"); + OBJECT * tree = gemtk_obj_get_tree(ICONIFY); + tree->ob_x = work.g_x; + tree->ob_y = work.g_y; + tree->ob_width = work.g_w; + tree->ob_height = work.g_h; + objc_draw(tree, 0, 8, clip->g_x, clip->g_y, clip->g_w, clip->g_h); + } else { + // TODO: consider the clipping rectangle + printf("window_redraw_favicon image %p\n", rootwin->icon); + struct rect work_clip = { 0,0,work.g_w,work.g_h }; + int xoff=0; + if (work.g_w > work.g_h) { + xoff = ((work.g_w-work.g_h)/2); + work.g_w = work.g_h; + } + plot_set_dimensions( work.g_x+xoff, work.g_y, work.g_w, work.g_h); + plot_clip(&work_clip); + atari_plotters.bitmap(0, 0, work.g_w, work.g_h, rootwin->icon, 0xffffff, 0); + } +} + +/*** +* Schedule an redraw area, redraw requests during redraw are +* not optimized (merged) into other areas, so that the redraw +* functions can spot the change. +* +*/ +void window_schedule_redraw_grect(ROOTWIN *rootwin, GRECT *area) +{ + GRECT work; + + + //dbg_grect("window_schedule_redraw_grect input ", area); + + gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, &work); + if(!rc_intersect(area, &work)) + return; + + //dbg_grect("window_schedule_redraw_grect intersection ", &work); + + redraw_slot_schedule_grect(&rootwin->redraw_slots, &work, redraw_active); +} + +static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area, + GRECT *clip, + struct gemtk_wm_scroll_info_s * slid, + struct browser_window *bw) +{ + + struct rect redraw_area; + GRECT content_area_rel; + + if(bw->window->browser->reformat_pending) { + browser_window_reformat(bw, true, content_area->g_w, + content_area->g_h); + bw->window->browser->reformat_pending = false; + //return; + } + + //dbg_grect("browser redraw, content area", content_area); + //dbg_grect("browser redraw, content clip", clip); + + plot_set_dimensions(content_area->g_x, content_area->g_y, + content_area->g_w, content_area->g_h); + + + /* first, we make the coords relative to the content area: */ + content_area_rel.g_x = clip->g_x - content_area->g_x; + content_area_rel.g_y = clip->g_y - content_area->g_y; + content_area_rel.g_w = clip->g_w; + content_area_rel.g_h = clip->g_h; + + if (content_area_rel.g_x < 0) { + content_area_rel.g_w += content_area_rel.g_x; + content_area_rel.g_x = 0; + } + + if (content_area_rel.g_y < 0) { + content_area_rel.g_h += content_area_rel.g_y; + content_area_rel.g_y = 0; + } + + //dbg_grect("browser redraw, relative plot coords:", &content_area_rel); + + redraw_area.x0 = content_area_rel.g_x; + redraw_area.y0 = content_area_rel.g_y; + redraw_area.x1 = content_area_rel.g_x + content_area_rel.g_w; + redraw_area.y1 = content_area_rel.g_y + content_area_rel.g_h; + + plot_clip(&redraw_area); + + //dbg_rect("rdrw area", &redraw_area); + + browser_window_redraw( bw, -(slid->x_pos*slid->x_unit_px), + -(slid->y_pos*slid->y_unit_px), &redraw_area, &rootwin_rdrw_ctx); +} + + +void window_place_caret(ROOTWIN *rootwin, short mode, int content_x, + int content_y, int h, GRECT *work) +{ + struct s_caret *caret = &rootwin->caret; + VdiHdl vh = gemtk_wm_get_vdi_handle(rootwin->win); + short pxy[8]; + GRECT mywork, caret_pos; + MFDB screen; + int i, scroll_x, scroll_y; + uint16_t *fd_addr; + struct gemtk_wm_scroll_info_s *slid; + short colors[2] = {G_BLACK, G_WHITE}; + bool render_required = false; + + // avoid duplicate draw of the caret: + if (mode == 1 &&(caret->state&CARET_STATE_VISIBLE)!=0) { + if (caret->dimensions.g_x == content_x + && caret->dimensions.g_y == content_y + && caret->dimensions.g_h == h) { + return; + } + } + + if(work == NULL) { + window_get_grect(rootwin, BROWSER_AREA_CONTENT, &mywork); + work = &mywork; + } + slid = gemtk_wm_get_scroll_info(rootwin->win); + + scroll_x = slid->x_pos * slid->x_unit_px; + scroll_y = slid->y_pos * slid->y_unit_px; + + init_mfdb(0, 1, h, 0, &screen); + + // enable clipping: + pxy[0] = work->g_x; + pxy[1] = work->g_y; + pxy[2] = pxy[0] + work->g_w - 1; + pxy[3] = pxy[1] + work->g_h - 1; + vs_clip(vh, 1, pxy); + + // when the caret is visible, undraw it: + if (caret->symbol.fd_addr != NULL + && (caret->state&CARET_STATE_VISIBLE)!=0) { + + caret_pos.g_x = work->g_x + (caret->dimensions.g_x - scroll_x); + caret_pos.g_y = work->g_y + (caret->dimensions.g_y - scroll_y); + caret_pos.g_w = caret->dimensions.g_w; + caret_pos.g_h = caret->dimensions.g_h; + + if (rc_intersect(work, &caret_pos)) { + + pxy[0] = 0; + pxy[1] = 0; + pxy[2] = caret->dimensions.g_w-1; + pxy[3] = caret->dimensions.g_h-1; + + pxy[4] = caret_pos.g_x; + pxy[5] = caret_pos.g_y; + pxy[6] = pxy[4] + caret_pos.g_w-1; + pxy[7] = pxy[5] + caret_pos.g_h-1; + + vrt_cpyfm(vh, MD_XOR, pxy, &caret->symbol, &screen, colors); + } + } + if (mode == 0) { + // update state: + caret->state &= ~CARET_STATE_VISIBLE; + goto exit; + } + + // when the caret isn't allocated, create it: + if (caret->symbol.fd_addr == NULL) { + caret->fd_size = init_mfdb(1, 16, h, MFDB_FLAG_ZEROMEM, + &caret->symbol); + render_required = true; + } else { + // the caret may need more memory: + if (caret->dimensions.g_h < h) { + caret->fd_size = init_mfdb(1, 16, h, MFDB_FLAG_NOALLOC, + &caret->symbol); + realloc(caret->symbol.fd_addr, caret->fd_size); + render_required = true; + } + } + + // set new caret position: + caret->dimensions.g_x = content_x; + caret->dimensions.g_y = content_y; + caret->dimensions.g_w = 1; + caret->dimensions.g_h = h; + + // draw the caret into the mfdb buffer: + if (render_required) { + + assert(caret->symbol.fd_nplanes == 1); + assert(caret->symbol.fd_w == 16); + + // draw an vertical line into the mfdb buffer + fd_addr = (uint16_t*)caret->symbol.fd_addr; + for(i = 0; i<caret->symbol.fd_h; i++) { + fd_addr[i] = 0xFFFF; + } + } + + // convert content coords to screen coords: + + caret_pos.g_x = work->g_x + (content_x - scroll_x); + caret_pos.g_y = work->g_y + (content_y - scroll_y); + caret_pos.g_w = caret->dimensions.g_w; + caret_pos.g_h = caret->dimensions.g_h; + + if (rc_intersect(work, &caret_pos) && redraw_active == false) { + + pxy[0] = 0; + pxy[1] = 0; + pxy[2] = caret->dimensions.g_w-1; + pxy[3] = caret->dimensions.g_h-1; + + pxy[4] = caret_pos.g_x; + pxy[5] = caret_pos.g_y; + pxy[6] = pxy[4] + caret_pos.g_w-1; + pxy[7] = pxy[5] + caret_pos.g_h-1; + + //dbg_pxy("caret screen coords (md_repl)", &pxy[4]); + + // draw caret to screen coords: + vrt_cpyfm(vh, /*MD_REPLACE*/ MD_XOR, pxy, &caret->symbol, &screen, colors); + + // update state: + caret->state |= CARET_STATE_VISIBLE; + } + +exit: + // disable clipping: + vs_clip(gemtk_wm_get_vdi_handle(rootwin->win), 0, pxy); +} + +void window_process_redraws(ROOTWIN * rootwin) +{ + GRECT work, visible_ro, tb_area, content_area; + short i; + short scroll_x=0, scroll_y=0; + bool toolbar_rdrw_required; + bool caret_rdrw_required = false; + struct gemtk_wm_scroll_info_s *slid =NULL; + int caret_h = 0; + struct s_caret *caret = &rootwin->caret; + + redraw_active = true; + + toolbar_get_grect(rootwin->toolbar, 0, &tb_area); + //gemtk_wm_set_toolbar_size(rootwin->win, tb_area.g_h); + window_get_grect(rootwin, BROWSER_AREA_CONTENT, &content_area); + + //dbg_grect("content area", &content_area); + //dbg_grect("window_process_redraws toolbar area", &tb_area); + + while(plot_lock() == false); + + if (((rootwin->caret.state & CARET_STATE_ENABLED)!=0) + && rootwin->caret.dimensions.g_h > 0) { + // hide caret: + window_place_caret(rootwin, 0, -1, -1, -1, &content_area); + } +/* + short pxy_clip[4]; + pxy_clip[0] = tb_area.g_x; + pxy_clip[0] = tb_area.g_y; + pxy_clip[0] = pxy_clip[0] + tb_area.g_w + content_area.g_w - 1; + pxy_clip[0] = pxy_clip[1] + tb_area.g_h + content_area.g_h - 1; + vs_clip(gemtk_wm_get_vdi_handle(rootwin->win), 1, pxy_clip); + //gemtk_wm_clear(rootwin->win); +*/ + wind_get_grect(rootwin->aes_handle, WF_FIRSTXYWH, &visible_ro); + while (visible_ro.g_w > 0 && visible_ro.g_h > 0) { + + // TODO: optimze the rectangle list - + // remove rectangles which were completly inside the visible area. + // that way we don't have to loop over again... + for(i=0; i<rootwin->redraw_slots.areas_used; i++) { + + GRECT rdrw_area_ro = { + rootwin->redraw_slots.areas[i].x0, + rootwin->redraw_slots.areas[i].y0, + rootwin->redraw_slots.areas[i].x1 - + rootwin->redraw_slots.areas[i].x0, + rootwin->redraw_slots.areas[i].y1 - + rootwin->redraw_slots.areas[i].y0 + }; + rc_intersect(&visible_ro, &rdrw_area_ro); + GRECT rdrw_area = rdrw_area_ro; + + if (rc_intersect(&tb_area, &rdrw_area)) { + toolbar_redraw(rootwin->toolbar, &rdrw_area); + } + + rdrw_area = rdrw_area_ro; + if (rc_intersect(&content_area, &rdrw_area)) { + + if(slid == NULL) { + slid = gemtk_wm_get_scroll_info(rootwin->win); + + scroll_x = slid->x_pos * slid->x_unit_px; + scroll_y = slid->y_pos * slid->y_unit_px; + } + + window_redraw_content(rootwin, &content_area, &rdrw_area, + slid, + rootwin->active_gui_window->browser->bw); + if (((rootwin->caret.state & CARET_STATE_ENABLED)!=0)) { + + GRECT caret_pos; + + caret_pos.g_x = content_area.g_x + + (caret->dimensions.g_x - scroll_x); + caret_pos.g_y = content_area.g_y + + (caret->dimensions.g_y - scroll_y); + caret_pos.g_w = caret->dimensions.g_w; + caret_pos.g_h = caret->dimensions.g_h; + + if (gemtk_rc_intersect_ro(&caret_pos, &content_area)) { + caret_rdrw_required = true; + } + } + + } + } + wind_get_grect(rootwin->aes_handle, WF_NEXTXYWH, &visible_ro); + } + + + // disable clipping: + //vs_clip(gemtk_wm_get_vdi_handle(rootwin->win), 0, pxy_clip); + + if (caret_rdrw_required && ((rootwin->caret.state & CARET_STATE_ENABLED)!=0)) { + + // force redraw of caret: + caret_h = rootwin->caret.dimensions.g_h; + rootwin->caret.dimensions.g_h = 0; + redraw_active = false; + window_place_caret(rootwin, 1, rootwin->caret.dimensions.g_x, + rootwin->caret.dimensions.g_y, + caret_h, &content_area); + } + + rootwin->redraw_slots.areas_used = 0; + redraw_active = false; + + plot_unlock(); +} + + +/* -------------------------------------------------------------------------- */ +/* Event Handlers: */ +/* -------------------------------------------------------------------------- */ +static bool on_content_mouse_move(ROOTWIN *rootwin, GRECT *content_area) +{ + int mx, my, sx, sy; + struct gemtk_wm_scroll_info_s *slid; + struct gui_window *gw; + struct browser_window *bw; + + // make relative mouse coords: + mx = aes_event_out.emo_mouse.p_x - content_area->g_x; + my = aes_event_out.emo_mouse.p_y - content_area->g_y; + + slid = gemtk_wm_get_scroll_info(rootwin->win); + gw = window_get_active_gui_window(rootwin); + bw = gw->browser->bw; + + // calculate scroll pos. in pixel: + sx = slid->x_pos * slid->x_unit_px; + sy = slid->y_pos * slid->y_unit_px; + + browser_window_mouse_track(bw, 0, mx + sx, my + sy); +} + +static bool on_content_mouse_click(ROOTWIN *rootwin) +{ + short dummy, mbut, mx, my; + GRECT cwork; + browser_mouse_state bmstate = 0; + struct gui_window *gw; + struct gemtk_wm_scroll_info_s *slid; + + gw = window_get_active_gui_window(rootwin); + if(input_window != gw) { + gui_set_input_gui_window(gw); + } + + window_set_focus(gw->root, BROWSER, (void*)gw->browser ); + window_get_grect(gw->root, BROWSER_AREA_CONTENT, &cwork); + + /* convert screen coords to component coords: */ + mx = aes_event_out.emo_mouse.p_x - cwork.g_x; + my = aes_event_out.emo_mouse.p_y - cwork.g_y; + //printf("content click at %d,%d\n", mx, my); + + /* Translate GEM key state to netsurf mouse modifier */ + if ( aes_event_out.emo_kmeta & (K_RSHIFT | K_LSHIFT)) { + bmstate |= BROWSER_MOUSE_MOD_1; + } else { + bmstate &= ~(BROWSER_MOUSE_MOD_1); + } + if ( (aes_event_out.emo_kmeta & K_CTRL) ) { + bmstate |= BROWSER_MOUSE_MOD_2; + } else { + bmstate &= ~(BROWSER_MOUSE_MOD_2); + } + if ( (aes_event_out.emo_kmeta & K_ALT) ) { + bmstate |= BROWSER_MOUSE_MOD_3; + } else { + bmstate &= ~(BROWSER_MOUSE_MOD_3); + } + + /* convert component coords to scrolled content coords: */ + slid = gemtk_wm_get_scroll_info(rootwin->win); + int sx_origin = mx; + int sy_origin = my; + + short rel_cur_x, rel_cur_y; + short prev_x=sx_origin, prev_y=sy_origin; + bool dragmode = false; + + /* Detect left mouse button state and compare with event state: */ + graf_mkstate(&rel_cur_x, &rel_cur_y, &mbut, &dummy); + if( (mbut & 1) && (aes_event_out.emo_mbutton & 1) ) { + /* Mouse still pressed, report drag */ + rel_cur_x = (rel_cur_x - cwork.g_x); + rel_cur_y = (rel_cur_y - cwork.g_y); + browser_window_mouse_click( gw->browser->bw, + BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_DRAG_1, + rel_cur_x + slid->x_pos * slid->x_unit_px, + rel_cur_y + slid->y_pos * slid->y_unit_px); + do { + // only consider movements of 5px or more as drag...: + if( abs(prev_x-rel_cur_x) > 5 || abs(prev_y-rel_cur_y) > 5 ) { + browser_window_mouse_track( gw->browser->bw, + BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_DRAG_1, + rel_cur_x + slid->x_pos * slid->x_unit_px, + rel_cur_y + slid->y_pos * slid->y_unit_px); + prev_x = rel_cur_x; + prev_y = rel_cur_y; + dragmode = true; + } else { + if( dragmode == false ) { + browser_window_mouse_track( gw->browser->bw,BROWSER_MOUSE_PRESS_1, + rel_cur_x + slid->x_pos * slid->x_unit_px, + rel_cur_y + slid->y_pos * slid->y_unit_px); + } + } + + // we may need to process scrolling: + // TODO: this doesn't work, because gemtk schedules redraw via + // AES window messages but we do not process them right here... + if (rootwin->redraw_slots.areas_used > 0) { + window_process_redraws(rootwin); + } + evnt_timer(150); + + graf_mkstate(&rel_cur_x, &rel_cur_y, &mbut, &dummy); + rel_cur_x = (rel_cur_x - cwork.g_x); + rel_cur_y = (rel_cur_y - cwork.g_y); + } while( mbut & 1 ); + browser_window_mouse_track(gw->browser->bw, 0, + rel_cur_x + slid->x_pos * slid->x_unit_px, + rel_cur_y + slid->y_pos * slid->y_unit_px); + } else { + /* Right button pressed? */ + if ((aes_event_out.emo_mbutton & 2 ) ) { + context_popup(gw, aes_event_out.emo_mouse.p_x, + aes_event_out.emo_mouse.p_y); + } else { + browser_window_mouse_click(gw->browser->bw, + bmstate|BROWSER_MOUSE_PRESS_1, + sx_origin + slid->x_pos * slid->x_unit_px, + sy_origin + slid->y_pos * slid->y_unit_px); + browser_window_mouse_click(gw->browser->bw, + bmstate|BROWSER_MOUSE_CLICK_1, + sx_origin + slid->x_pos * slid->x_unit_px, + sy_origin + slid->y_pos * slid->y_unit_px); + } + } + if (rootwin->redraw_slots.areas_used > 0) { + window_process_redraws(rootwin); + } +} + +/* + Report keypress to browser component. + parameter: + - unsigned short nkc ( CFLIB normalised key code ) +*/ +static bool on_content_keypress(struct browser_window *bw, unsigned short nkc) +{ + bool r = false; + unsigned char ascii = (nkc & 0xFF); + long ucs4; + long ik = nkc_to_input_key( nkc, &ucs4 ); + + // pass event to specific control? + + if (ik == 0) { + if (ascii >= 9) { + r = browser_window_key_press(bw, ucs4); + } + } else { + r = browser_window_key_press(bw, ik); + if (r == false) { + + GRECT g; + GUIWIN * w = bw->window->root->win; + window_get_grect(bw->window->root, BROWSER_AREA_CONTENT, &g); + + struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w); + + switch( ik ) { + case KEY_LINE_START: + gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, -(g.g_w/slid->x_unit_px), + false); + break; + + case KEY_LINE_END: + gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, (g.g_w/slid->x_unit_px), + false); + break; + + case KEY_PAGE_UP: + gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, (g.g_h/slid->y_unit_px), + false); + break; + + case KEY_PAGE_DOWN: + gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, (g.g_h/slid->y_unit_px), + false); + break; + + case KEY_RIGHT: + gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, -1, false); + break; + + case KEY_LEFT: + gemtk_wm_scroll(w, GEMTK_WM_HSLIDER, 1, false); + break; + + case KEY_UP: + gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, -1, false); + break; + + case KEY_DOWN: + gemtk_wm_scroll(w, GEMTK_WM_VSLIDER, 1, false); + break; + + default: + break; + } + gemtk_wm_update_slider(w, GEMTK_WM_VSLIDER|GEMTK_WM_HSLIDER); + } + } + + return(r); +} + +static short on_window_key_input(ROOTWIN *rootwin, unsigned short nkc) +{ + bool done = false; + struct gui_window * gw = window_get_active_gui_window(rootwin); + struct gui_window * gw_tmp; + + if( gw == NULL ) + return(false); + + if(window_url_widget_has_focus((void*)gw->root)) { + /* make sure we report for the root window and report...: */ + done = toolbar_key_input(gw->root->toolbar, nkc); + } else { + if( window_widget_has_focus(input_window->root, BROWSER, + (void*)input_window->browser)) { + done = on_content_keypress(input_window->browser->bw, nkc); + } + else if(window_widget_has_focus(input_window->root, SEARCH_INPUT, NULL)) { + OBJECT * obj; + obj = toolbar_get_form(input_window->root->toolbar); + obj[TOOLBAR_BT_SEARCH_FWD].ob_state &= ~OS_DISABLED; + obj[TOOLBAR_BT_SEARCH_BACK].ob_state &= ~OS_DISABLED; + window_schedule_redraw_grect(input_window->root, + gemtk_obj_screen_rect(obj, TOOLBAR_BT_SEARCH_FWD)); + window_schedule_redraw_grect(input_window->root, + gemtk_obj_screen_rect(obj, TOOLBAR_BT_SEARCH_BACK)); + } + } + return((done==true) ? 1 : 0); +} + + +static void on_redraw(ROOTWIN *rootwin, short msg[8]) +{ + short handle; + + GRECT clip = {msg[4], msg[5], msg[6], msg[7]}; + + //dbg_grect("on_redraw", &clip); + + if(gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED) { + GRECT clip = {msg[4], msg[5], msg[6], msg[7]}; + window_redraw_favicon(rootwin, &clip); + } else { + window_schedule_redraw_grect(rootwin, &clip); + } +} + +static void on_resized(ROOTWIN *rootwin) +{ + GRECT g, work; + OBJECT *toolbar; + struct gui_window *gw; + + gw = window_get_active_gui_window(rootwin); + + //printf("resized...\n"); + + assert(gw != NULL); + + if(gw == NULL) + return; + + wind_get_grect(rootwin->aes_handle, WF_CURRXYWH, &g); + gemtk_wm_get_grect(rootwin->win, GEMTK_WM_AREA_WORK, &work); + + if (rootwin->loc.g_w != g.g_w || rootwin->loc.g_h != g.g_h) { + + /* resized */ + toolbar_set_width(rootwin->toolbar, work.g_w); + + if ( gw->browser->bw->current_content != NULL ) { + /* Reformat will happen when redraw is processed: */ + // TODO: call reformat directly, this was introduced because + // of bad AES knowledge, it's ok to call it directly here... + //printf("reformat......\n"); + rootwin->active_gui_window->browser->reformat_pending = true; + } + } + if (rootwin->loc.g_x != g.g_x || rootwin->loc.g_y != g.g_y) { + /* moved */ + toolbar_set_origin(rootwin->toolbar, work.g_x, work.g_y); + } + + rootwin->loc = g; +} + +static void on_file_dropped(ROOTWIN *rootwin, short msg[8]) +{ + char file[DD_NAMEMAX]; + char name[DD_NAMEMAX]; + char *buff=NULL; + int dd_hdl; + int dd_msg; /* pipe-handle */ + long size; + char ext[32]; + short mx,my,bmstat,mkstat; + struct gui_window *gw; + + graf_mkstate(&mx, &my, &bmstat, &mkstat); + + gw = window_get_active_gui_window(rootwin); + + if( gw == NULL ) + return; + + if(gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED) + return; + + dd_hdl = gemtk_dd_open( msg[7], DD_OK); + if( dd_hdl<0) + return; /* pipe not open */ + memset( ext, 0, 32); + strcpy( ext, "ARGS"); + dd_msg = gemtk_dd_sexts( dd_hdl, ext); + if( dd_msg<0) + goto error; + dd_msg = gemtk_dd_rtry( dd_hdl, (char*)&name[0], (char*)&file[0], (char*)&ext[0], &size); + if( size+1 >= PATH_MAX ) + goto error; + if( !strncmp( ext, "ARGS", 4) && dd_msg > 0) { + gemtk_dd_reply(dd_hdl, DD_OK); + buff = (char*)malloc(sizeof(char)*(size+1)); + if (buff != NULL) { + if (Fread(dd_hdl, size, buff ) == size) + buff[size] = 0; + LOG(("file: %s, ext: %s, size: %d dropped at: %d,%d\n", + (char*)buff, (char*)&ext, + size, mx, my + )); + { + GRECT content_area; + struct browser_window * bw = gw->browser->bw; + window_get_grect(rootwin, BROWSER_AREA_CONTENT, &content_area); + mx = mx - content_area.g_x; + my = my - content_area.g_y; + if( (mx < 0 || mx > content_area.g_w) + || (my < 0 || my > content_area.g_h) ) + return; + + utf8_convert_ret ret; + char *utf8_fn; + int sx, sy; + + ret = utf8_from_local_encoding(buff, 0, &utf8_fn); + if (ret != UTF8_CONVERT_OK) { + free(buff); + /* A bad encoding should never happen */ + LOG(("utf8_from_local_encoding failed")); + assert(ret != UTF8_CONVERT_BADENC); + /* no memory */ + return; + } + gui_window_get_scroll(gw, &sx, &sy); + browser_window_drop_file_at_point( gw->browser->bw, mx+sx, + my+sy, utf8_fn ); + free(utf8_fn); + free(buff); + } + } + } +error: + gemtk_dd_close( dd_hdl); +} + +static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip) +{ + struct rootwin_data_s * ud; + + if (msg != WM_REDRAW) { + ud = gemtk_wm_get_user_data(win); + + assert(ud); + + toolbar_redraw(ud->rootwin->toolbar, clip); + } +} diff --git a/atari/rootwin.h b/atari/rootwin.h new file mode 100755 index 000000000..d2cd04a35 --- /dev/null +++ b/atari/rootwin.h @@ -0,0 +1,97 @@ +/*
+ * 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_ATARI_BROWSER_WIN_H
+#define NS_ATARI_BROWSER_WIN_H + +#include <atari/gui.h>
+
+#define GEMTK_WM_VISIBLE(gw) (gw->root->handle->status & WS_OPEN)
+#define GEMWIN_VISIBLE(win) (win->status & WS_OPEN)
+
+#define WIDGET_STATUSBAR 0x1
+#define WIDGET_TOOLBAR 0x2
+#define WIDGET_SCROLL 0x4 +#define WIDGET_RESIZE 0x8 +#define WIN_TOP 0x100 + +enum browser_area_e { + BROWSER_AREA_CONTENT = 1, + BROWSER_AREA_STATUSBAR, + BROWSER_AREA_TOOLBAR, + BROWSER_AREA_URL_INPUT, + BROWSER_AREA_SEARCH +}; +
+
+/* -------------------------------------------------------------------------- */
+/* Public module functions: */
+/* -------------------------------------------------------------------------- */
+
+/* Creates an normal Browser window with [toolbar], [statusbar] */
+int window_create(struct gui_window * gw, + struct browser_window * bw, + struct browser_window * clone, + unsigned long flags );
+/* Destroys WinDom part of gui_window */
+int window_destroy(ROOTWIN *rootwin);
+
+/** show the window at specified position and make gw the active tab. */
+void window_open(ROOTWIN *rootwin, struct gui_window *gw, GRECT pos);
+
+void window_snd_redraw(ROOTWIN *rootwin, short x, short y, short w, short h );
+/* Update Shade / Unshade state of the fwd/back buttons*/
+void window_update_back_forward(struct s_gui_win_root * rootwin);
+/* set root browser component: */
+void window_attach_browser(ROOTWIN *rootwin, CMP_BROWSER b);
+
+/* set focus element */
+void window_set_focus(ROOTWIN *rootwin, enum focus_element_type type, + void * element );
+/* Shade / Unshade the forward/back bt. of toolbar, depending on history.*/
+bool window_widget_has_focus(ROOTWIN *rootwin, enum focus_element_type t, + void * element);
+bool window_url_widget_has_focus(ROOTWIN *rootwin);
+void window_set_url(ROOTWIN *rootwin, const char * text);
+void window_set_stauts(ROOTWIN *rootwin, char * text); +void window_set_title(ROOTWIN *rootwin, char * text); +void window_set_content_size(ROOTWIN *rootwin, int w, int h);
+void window_set_icon(ROOTWIN *rootwin, struct bitmap * bmp ); +void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window *gw); +void window_restore_active_gui_window(ROOTWIN *rootwin); +void window_open_search(ROOTWIN *rootwin, bool reformat); +void window_close_search(ROOTWIN *rootwin); +void window_scroll_by(ROOTWIN *rootwin, int x, int y); +void window_schedule_redraw_grect(ROOTWIN *rootwin, GRECT *area); +void window_process_redraws(ROOTWIN * rootwin); +void window_place_caret(ROOTWIN *rootwin, short mode, int content_x, + int content_y, int h, GRECT *work); +struct gui_window * window_get_active_gui_window(ROOTWIN * rootwin); +void window_get_scroll(ROOTWIN *rootwin, int *x, int *y); +void window_get_grect(ROOTWIN *rootwin, enum browser_area_e which, GRECT *d); +void window_redraw_favicon(struct s_gui_win_root * rootwin, GRECT *clip); +void window_unref_gui_window(ROOTWIN *rootwin, struct gui_window *gw); +bool window_key_input(unsigned short kcode, unsigned short kstate, + unsigned short nkc);
+
+
+/* -------------------------------------------------------------------------- */
+/* Public event handlers: */
+/* -------------------------------------------------------------------------- */
+
+#endif
diff --git a/atari/schedule.c b/atari/schedule.c index 8040c80a8..a91c510b3 100755 --- a/atari/schedule.c +++ b/atari/schedule.c @@ -158,8 +158,8 @@ schedule_run(void) prev_nscb = NULL; nexttime = cur_nscb->timeout; - while ( cur_nscb != NULL ) { - if ( now > cur_nscb->timeout ) { + while (cur_nscb != NULL) { + if (now > cur_nscb->timeout) { /* scheduled time */ /* remove callback */ @@ -194,7 +194,7 @@ schedule_run(void) /* if the time to the event is sooner than the * currently recorded soonest event record it */ - if( nexttime > cur_nscb->timeout ){ + if (nexttime > cur_nscb->timeout) { nexttime = cur_nscb->timeout; } /* move to next element */ diff --git a/atari/search.c b/atari/search.c index b5e2fdd61..17241d1ae 100644 --- a/atari/search.c +++ b/atari/search.c @@ -1,5 +1,5 @@ /*
- * Copyright 2012 Ole Loots <ole@monochrom.net>
+ * Copyright 2013 Ole Loots <ole@monochrom.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -14,7 +14,13 @@ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- */ + *
+ * Module Description:
+ *
+ *
+ *
+ */
+ #include <limits.h>
#include <stdlib.h>
@@ -23,7 +29,6 @@ #include <string.h>
#include <stdbool.h>
#include <assert.h>
-#include <windom.h>
#include "desktop/gui.h"
#include "desktop/browser.h"
@@ -31,18 +36,17 @@ #include "desktop/search.h"
#include "utils/log.h"
#include "utils/messages.h"
-#include "atari/gui.h"
+#include "atari/gui.h" +#include "atari/rootwin.h"
#include "atari/misc.h"
-#include "atari/browser.h"
-#include "atari/search.h"
+#include "atari/toolbar.h" +#include "atari/search.h" +#include "atari/gemtk/gemtk.h"
#include "atari/res/netsurf.rsh"
extern struct gui_window * input_window;
-extern void * h_gem_rsrc;
-static SEARCH_FORM_SESSION current;
-
static void nsatari_search_set_status(bool found, void *p);
static void nsatari_search_set_hourglass(bool active, void *p);
static void nsatari_search_add_recent(const char *string, void *p);
@@ -66,7 +70,8 @@ static struct gui_search_callbacks nsatari_search_callbacks = { void nsatari_search_set_status(bool found, void *p)
{
- LOG(("%p set status: %d\n", p, found));
+ LOG(("%p set status: %d\n", p, found)); + // TODO: maybe update GUI
}
/**
@@ -78,8 +83,8 @@ void nsatari_search_set_status(bool found, void *p) void nsatari_search_set_hourglass(bool active, void *p)
{
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
- LOG((""));
- if( active && current != NULL )
+ LOG(("active: %d, session: %p", active, p));
+ if (active)
gui_window_set_pointer(s->bw->window, GUI_POINTER_PROGRESS);
else
gui_window_set_pointer(s->bw->window, GUI_POINTER_DEFAULT);
@@ -106,10 +111,24 @@ void nsatari_search_add_recent(const char *string, void *p) */
void nsatari_search_set_forward_state(bool active, void *p)
-{
+{ + struct gui_window *gw; + OBJECT *toolbar; + GRECT area;
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
/* deactivate back cb */
- LOG(("%p: set forward state: %d\n", p, active));
+ LOG(("%p: set forward state: %d\n", p, active)); +
+ gw = s->bw->window; + + toolbar = toolbar_get_form(gw->root->toolbar); + if(active) + toolbar[TOOLBAR_BT_SEARCH_FWD].ob_state &= ~OS_DISABLED; + else + toolbar[TOOLBAR_BT_SEARCH_FWD].ob_state |= OS_DISABLED; + window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area); + window_schedule_redraw_grect(gw->root, &area); +
}
/**
@@ -120,184 +139,173 @@ void nsatari_search_set_forward_state(bool active, void *p) void nsatari_search_set_back_state(bool active, void *p)
{
+ struct gui_window *gw; + OBJECT *toolbar; + GRECT area; SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
/* deactivate back cb */
- LOG(("%p: set back state: %d\n", p, active));
-}
-
+ LOG(("%p: set back state: %d\n", p, active)); + + s->state.back_avail = active; + gw = s->bw->window; + + toolbar = toolbar_get_form(gw->root->toolbar); + if(active) + toolbar[TOOLBAR_BT_SEARCH_BACK].ob_state &= ~OS_DISABLED; + else + toolbar[TOOLBAR_BT_SEARCH_BACK].ob_state |= OS_DISABLED; + window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area); + window_schedule_redraw_grect(gw->root, &area);
+} + -static SEARCH_FORM_SESSION get_search_session(WINDOW * win)
+static int apply_form(OBJECT *obj, struct s_search_form_state *s)
{
- return (current);
-}
+ char * cstr; + + assert(s != NULL); -static void destroy_search_session( SEARCH_FORM_SESSION s )
-{
- if( s != NULL ){
- LOG((""));
- free( s );
- }
-}
+ s->flags = 0; -static int apply_form( WINDOW * win, struct s_search_form_state * s )
-{
- OBJECT * obj = ObjcTree(OC_FORM, win );
- if( obj == NULL ){
- goto error;
- }
- s->flags = 0;
- if( (obj[SEARCH_CB_FWD].ob_state & SELECTED) != 0 )
- s->flags = SEARCH_FLAG_FORWARDS;
- if( (obj[SEARCH_CB_CASESENSE].ob_state & SELECTED) != 0 )
+ if( (obj[TOOLBAR_CB_CASESENSE].ob_state & OS_SELECTED) != 0 )
s->flags |= SEARCH_FLAG_CASE_SENSITIVE;
- if( (obj[SEARCH_CB_SHOWALL].ob_state & SELECTED) != 0 )
+ if( (obj[TOOLBAR_CB_SHOWALL].ob_state & OS_SELECTED) != 0 )
s->flags |= SEARCH_FLAG_SHOWALL;
-
- char * cstr = ObjcString( obj, SEARCH_TB_SRCH, NULL );
- if( cstr != NULL ) {
- strncpy((char*)&s->text[0], cstr, 31 );
- }
+ + cstr = gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH); + snprintf(s->text, 32, "%s", cstr); return ( 0 );
-error:
- s->flags = SEARCH_FLAG_FORWARDS;
- /* s->forward = true; */
- strncpy((char*)&s->text[0], "", 31 );
- return( 1 );
}
-
-/* checks if search parameters changes */
-static bool form_changed( WINDOW * w )
+ +static void set_text(OBJECT *obj, short idx, char * text, int len)
{
- bool check;
- struct s_search_form_state cur;
- SEARCH_FORM_SESSION s = get_search_session(w);
- if( s == NULL )
- return false;
- OBJECT * obj = ObjcTree(OC_FORM, w);
- assert( s != NULL && obj != NULL );
- uint32_t flags_old = s->state.flags;
- apply_form(w, &cur);
-
- /* adjust the forward flag, it should not init an new search */
- flags_old |= SEARCH_FLAG_FORWARDS;
- cur.flags |= SEARCH_FLAG_FORWARDS;
- if( cur.flags != flags_old ){
- return( true );
- }
+ char spare[255];
- char * cstr = ObjcString( obj, SEARCH_TB_SRCH, NULL );
- if( cstr != NULL ){
- if( strcmp(cstr, (char*)&s->state.text) != 0 ) {
- return ( true );
- }
- }
-
- return( false );
-}
+ if( len > 254 )
+ len = 254;
+ if( text != NULL ){
+ strncpy(spare, text, 254);
+ } else {
+ strcpy(spare, "");
+ } + set_string(obj, idx, spare);
+} + +void nsatari_search_restore_form( struct s_search_form_session *s, OBJECT *obj) +{ + if ((s->state.flags & SEARCH_FLAG_SHOWALL) != 0) { + obj[TOOLBAR_CB_SHOWALL].ob_state |= OS_SELECTED; + } + else { + obj[TOOLBAR_CB_SHOWALL].ob_state &= ~OS_SELECTED; + } + + if ((s->state.flags & SEARCH_FLAG_CASE_SENSITIVE) != 0) { + obj[TOOLBAR_CB_CASESENSE].ob_state |= OS_SELECTED; + } + else { + obj[TOOLBAR_CB_CASESENSE].ob_state &= ~OS_SELECTED; + } + + if (s->state.back_avail == false) { + obj[TOOLBAR_BT_SEARCH_BACK].ob_state |= OS_DISABLED; + } else { + obj[TOOLBAR_BT_SEARCH_BACK].ob_state &= ~OS_DISABLED; + } + + TEDINFO *t = ((TEDINFO *)get_obspec(obj, TOOLBAR_TB_SRCH)); + set_text(obj, TOOLBAR_TB_SRCH, s->state.text, t->te_txtlen); + +} -static void __CDECL evnt_bt_srch_click( WINDOW *win, int index, int unused, void *unused2)
+void nsatari_search_session_destroy(struct s_search_form_session *s)
{
-
- bool fwd;
- SEARCH_FORM_SESSION s = get_search_session(win);
- OBJECT * obj = ObjcTree(OC_FORM, s->formwind );
- search_flags_t flags = 0;
-
- ObjcChange(OC_FORM, win, index, ~SELECTED , TRUE);
- if( form_changed(win) ){
+ if (s != NULL) {
+ LOG(("")); browser_window_search_destroy_context(s->bw);
- apply_form( win, &s->state );
- } else {
- /* get search direction manually: */
- if( (obj[SEARCH_CB_FWD].ob_state & SELECTED) != 0 )
- s->state.flags |= SEARCH_FLAG_FORWARDS;
- else
- s->state.flags &= (~SEARCH_FLAG_FORWARDS);
- }
- if( browser_window_search_verify_new(s->bw, &nsatari_search_callbacks, s) ){
- browser_window_search_step(s->bw, s->state.flags, ObjcString( obj, SEARCH_TB_SRCH, NULL ) );
+ free(s);
}
-
}
-static void __CDECL evnt_cb_click( WINDOW *win, int index, int unused, void *unused2)
+/** checks for search parameters changes */
+static bool search_session_compare(struct s_search_form_session *s, OBJECT *obj)
{
+ bool check; + uint32_t flags_old;
+ uint32_t flags_mask = SEARCH_FLAG_SHOWALL | SEARCH_FLAG_CASE_SENSITIVE; + struct s_search_form_state cur;
+ + assert(s != NULL && obj != NULL); - short newstate;
- OBJECT * obj = ObjcTree(OC_FORM, get_search_session(win)->formwind );
-}
-
-static void __CDECL evnt_close( WINDOW *win, short buff[8])
-{
- /* Free Search Contexts */
- /* todo: destroy search context, if any? */
- SEARCH_FORM_SESSION s = get_search_session(win);
- if( s != NULL ){
- destroy_search_session( s );
- }
- current = NULL;
- ApplWrite( _AESapid, WM_DESTROY, win->handle, 0,0,0,0 );
-}
+ flags_old = s->state.flags; -void search_destroy( struct gui_window * gw )
-{
- LOG(("search_destroy %p / %p", gw, current ));
- if( current != NULL && current->formwind != NULL ){
- ApplWrite( _AESapid, WM_CLOSED, current->formwind->handle, 0,0,0,0);
- /* Handle Close event */
- EvntWindom( MU_MESAG );
- /* Handle Destroy Event */
- EvntWindom( MU_MESAG );
+ apply_form(obj, &cur);
+ if ((cur.flags&flags_mask) != (flags_old&flags_mask)) {
+ return( true );
}
- LOG(("done"));
-}
-SEARCH_FORM_SESSION open_browser_search( struct gui_window * gw )
-{
- char * title;
- SEARCH_FORM_SESSION sfs;
- GRECT pos, treesize;
- OBJECT * tree = get_tree(SEARCH);
- if( tree == NULL ){
- return( NULL );
+ char * cstr; + cstr = gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH);
+ if (cstr != NULL){
+ if (strcmp(cstr, (char*)&s->state.text) != 0) {
+ return (true);
+ }
}
- sfs = calloc(1, sizeof(struct s_search_form_session));
- if( sfs == NULL )
- return( NULL );
+ return( false );
+}
- title = (char*)messages_get("FindTextNS");
- if( title == NULL )
- title = (char*)"Find text ...";
- search_destroy( gw );
+void nsatari_search_perform(struct s_search_form_session *s, OBJECT *obj, + search_flags_t f)
+{
- /* setup dipslay position: right corner */
- treesize.g_x = 0;
- treesize.g_y = 0;
- treesize.g_w = tree->ob_width;
- treesize.g_h = tree->ob_height;
- wind_calc_grect(WC_BORDER, WAT_FORM, &treesize, &pos);
- pos.g_x = app.w - pos.g_w;
- pos.g_y = app.h - pos.g_h;
+ bool fwd;
+ search_flags_t flags = f; + + assert(s!=null); + assert(input_window->browser->bw == s->bw); - current = sfs;
- sfs->bw = gw->browser->bw;
- sfs->formwind = mt_FormCreate( &app, tree, WAT_FORM,
- NULL, title,
- &pos, true, false);
+ if(search_session_compare(s, obj)){ + browser_window_search_destroy_context(s->bw);
+ apply_form(obj, &s->state);
+ } else {
- ObjcAttachFormFunc( sfs->formwind, SEARCH_BT_SEARCH, evnt_bt_srch_click, NULL);
- ObjcAttachFormFunc( sfs->formwind, SEARCH_CB_CASESENSE, evnt_cb_click, NULL);
- ObjcAttachFormFunc( sfs->formwind, SEARCH_CB_SHOWALL, evnt_cb_click, NULL);
- ObjcAttachFormFunc( sfs->formwind, SEARCH_CB_FWD, evnt_cb_click, NULL);
- EvntAdd( sfs->formwind, WM_CLOSED, evnt_close, EV_TOP);
- apply_form(sfs->formwind, &sfs->state );
- strncpy( ObjcString( tree, SEARCH_TB_SRCH, NULL ), "", SEARCH_MAX_SLEN);
+ } + + /* get search direction manually: */
+ if ( (f&SEARCH_FLAG_FORWARDS) != 0 )
+ s->state.flags |= SEARCH_FLAG_FORWARDS;
+ else
+ s->state.flags &= (~SEARCH_FLAG_FORWARDS); - return( current );
+ if( browser_window_search_verify_new(s->bw, &nsatari_search_callbacks, s) ){ + LOG(("searching for: %s\n", gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH)));
+ browser_window_search_step(s->bw, s->state.flags, + gemtk_obj_get_text(obj, TOOLBAR_TB_SRCH));
+ }
}
+
+ +struct s_search_form_session * nsatari_search_session_create(OBJECT * obj, + struct browser_window *bw) +{ + struct s_search_form_session *sfs; + + sfs = calloc(1, sizeof(struct s_search_form_session)); + + assert(obj); + assert(sfs); + + sfs->bw = bw; + + apply_form(obj, &sfs->state); + + browser_window_search_destroy_context(bw); + + return(sfs); +} diff --git a/atari/search.c.old b/atari/search.c.old new file mode 100644 index 000000000..efe6cebb2 --- /dev/null +++ b/atari/search.c.old @@ -0,0 +1,375 @@ +/*
+ * 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/>.
+ *
+ * Module Description:
+ *
+ *
+ *
+ */
+ + +#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdbool.h>
+#include <assert.h>
+
+#include "desktop/gui.h"
+#include "desktop/browser.h"
+#include "desktop/browser_private.h"
+#include "desktop/search.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "atari/gui.h" +#include "atari/rootwin.h"
+#include "atari/misc.h"
+#include "atari/search.h" +#include "atari/gemtk/gemtk.h"
+#include "atari/res/netsurf.rsh"
+
+extern struct gui_window * input_window;
+extern void * h_gem_rsrc; +extern GRECT desk_area;
+
+
+static SEARCH_FORM_SESSION current; +static OBJECT *dlgtree; +static GUIWIN *searchwin; +static short h_aes_win;
+
+static void nsatari_search_set_status(bool found, void *p);
+static void nsatari_search_set_hourglass(bool active, void *p);
+static void nsatari_search_add_recent(const char *string, void *p);
+void nsatari_search_set_forward_state(bool active, void *p);
+void nsatari_search_set_back_state(bool active, void *p);
+
+static struct gui_search_callbacks nsatari_search_callbacks = {
+ nsatari_search_set_forward_state,
+ nsatari_search_set_back_state,
+ nsatari_search_set_status,
+ nsatari_search_set_hourglass,
+ nsatari_search_add_recent
+};
+
+
+/**
+* Change the displayed search status.
+* \param found search pattern matched in text
+* \param p the pointer sent to search_verify_new() / search_create_context()
+*/
+
+void nsatari_search_set_status(bool found, void *p)
+{
+ LOG(("%p set status: %d\n", p, found));
+}
+
+/**
+* display hourglass while searching
+* \param active start/stop indicator
+* \param p the pointer sent to search_verify_new() / search_create_context()
+*/
+
+void nsatari_search_set_hourglass(bool active, void *p)
+{
+ SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
+ LOG((""));
+ if (active && current != NULL)
+ gui_window_set_pointer(s->bw->window, GUI_POINTER_PROGRESS);
+ else
+ gui_window_set_pointer(s->bw->window, GUI_POINTER_DEFAULT);
+}
+
+/**
+* add search string to recent searches list
+* front is at liberty how to implement the bare notification
+* should normally store a strdup() of the string;
+* core gives no guarantee of the integrity of the const char *
+* \param string search pattern
+* \param p the pointer sent to search_verify_new() / search_create_context()
+*/
+
+void nsatari_search_add_recent(const char *string, void *p)
+{
+ LOG(("%p add recent: %s\n", p, string));
+}
+
+/**
+* activate search forwards button in gui
+* \param active activate/inactivate
+* \param p the pointer sent to search_verify_new() / search_create_context()
+*/
+
+void nsatari_search_set_forward_state(bool active, void *p)
+{
+ SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
+ /* deactivate back cb */
+ LOG(("%p: set forward state: %d\n", p, active));
+}
+
+/**
+* activate search back button in gui
+* \param active activate/inactivate
+* \param p the pointer sent to search_verify_new() / search_create_context()
+*/
+
+void nsatari_search_set_back_state(bool active, void *p)
+{
+ SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
+ /* deactivate back cb */
+ LOG(("%p: set back state: %d\n", p, active));
+}
+ +/*
+void search_redraw(void *session, GRECT *clip) +{ + GRECT area, clipped_area; + struct gui_window *gw = input_window; + short pxy[4]; + VdiHdl vh; + + if(gw == NULL) + return; + + window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area); + + clipped_area = area; + + if (!rc_intersect(clip, &clipped_area)) { + return; + } + + OBJECT * tree = get_tree(SEARCH); + tree->ob_x = area.g_x; + tree->ob_y = area.g_y; + tree->ob_width = area.g_w; + tree->ob_height = area.g_h; + + objc_draw_grect(tree, 0, 8, &clipped_area); +} +*/ +
+static SEARCH_FORM_SESSION get_search_session(GUIWIN * win)
+{
+ return (current);
+}
+ + + +static void set_text( short idx, char * text, int len )
+{
+ char spare[255];
+
+ if( len > 254 )
+ len = 254;
+ if( text != NULL ){
+ strncpy(spare, text, 254);
+ } else {
+ strcpy(spare, "");
+ } +
+ set_string(dlgtree, idx, spare);
+} +
+static void destroy_search_session(SEARCH_FORM_SESSION s)
+{
+ if(s != NULL ){
+ LOG((""));
+ free(s);
+ }
+}
+
+static int apply_form(GUIWIN *win, struct s_search_form_state * s)
+{
+ OBJECT * obj = dlgtree; + char * cstr; +
+ if( obj == NULL ){
+ goto error;
+ } +
+ s->flags = 0;
+ if( (obj[SEARCH_CB_FWD].ob_state & OS_SELECTED) != 0 )
+ s->flags = SEARCH_FLAG_FORWARDS;
+ if( (obj[SEARCH_CB_CASESENSE].ob_state & OS_SELECTED) != 0 )
+ s->flags |= SEARCH_FLAG_CASE_SENSITIVE;
+ if( (obj[SEARCH_CB_SHOWALL].ob_state & OS_SELECTED) != 0 )
+ s->flags |= SEARCH_FLAG_SHOWALL;
+ + cstr = get_text(dlgtree, SEARCH_TB_SRCH); + snprintf(s->text, 31, "%s", cstr); + return ( 0 );
+
+error:
+ s->flags = SEARCH_FLAG_FORWARDS;
+ strncpy((char*)&s->text[0], "", 31 );
+ return( 1 );
+}
+
+/* checks for search parameters changes */
+static bool form_changed(GUIWIN * w)
+{
+ bool check;
+ struct s_search_form_state cur;
+ SEARCH_FORM_SESSION s = get_search_session(w);
+ if( s == NULL )
+ return false; + OBJECT * obj = dlgtree;
+ assert(s != NULL && obj != NULL);
+ uint32_t flags_old = s->state.flags;
+ apply_form(w, &cur);
+
+ /* adjust the forward flag, it should not init an new search */
+ flags_old |= SEARCH_FLAG_FORWARDS;
+ cur.flags |= SEARCH_FLAG_FORWARDS;
+ if( cur.flags != flags_old ){
+ return( true );
+ }
+
+ char * cstr; + cstr = get_text(obj, SEARCH_TB_SRCH);
+ if (cstr != NULL){
+ if (strcmp(cstr, (char*)&s->state.text) != 0) {
+ return (true);
+ }
+ }
+
+ return( false );
+}
+
+
+static void __CDECL evnt_bt_srch_click(GUIWIN * win, int index, int unused, void *unused2)
+{
+
+ bool fwd;
+ SEARCH_FORM_SESSION s = get_search_session(searchwin);
+ OBJECT * obj = dlgtree;
+ search_flags_t flags = 0;
+
+
+ if( form_changed(searchwin) ){
+ browser_window_search_destroy_context(s->bw);
+ apply_form(searchwin, &s->state);
+ } else {
+ /* get search direction manually: */
+ if( (obj[SEARCH_CB_FWD].ob_state & OS_SELECTED) != 0 )
+ s->state.flags |= SEARCH_FLAG_FORWARDS;
+ else
+ s->state.flags &= (~SEARCH_FLAG_FORWARDS);
+ }
+ if( browser_window_search_verify_new(s->bw, &nsatari_search_callbacks, s) ){
+ browser_window_search_step(s->bw, s->state.flags, get_text(obj, SEARCH_TB_SRCH));
+ }
+
+}
+
+static void __CDECL evnt_cb_click(GUIWIN *win, int index, int unused, void *unused2)
+{
+
+ short newstate;
+
+}
+
+static void __CDECL evnt_close(GUIWIN *win, short buff[8])
+{
+
+}
+ +void search_destroy(struct gui_window *gw) +{ + /* Free Search Contexts */
+ /* todo: destroy search context, if any? */ + LOG(("")); +
+ if (current != NULL){
+ destroy_search_session(current); + current = NULL;
+ } + + guiwin_remove(searchwin); + searchwin = NULL; + + wind_close(h_aes_win); + wind_delete(h_aes_win); + h_aes_win = -1; + + LOG(("done")); +} +
+SEARCH_FORM_SESSION open_browser_search(struct gui_window * gw)
+{
+ char * title;
+ SEARCH_FORM_SESSION sfs;
+ GRECT pos, treesize; + uint32_t kind = CLOSER | NAME | MOVER; + + if (dlgtree == NULL) { + dlgtree = get_tree(SEARCH);
+ if (dlgtree == NULL) {
+ return( NULL );
+ } + } + + if(searchwin){ + search_destroy(gw); + } +
+
+ sfs = calloc(1, sizeof(struct s_search_form_session));
+ if( sfs == NULL )
+ return( NULL );
+
+ title = (char*)messages_get("FindTextNS");
+ if (title == NULL)
+ title = (char*)"Find text ..."; + + /* setup dipslay position: right corner */
+ treesize.g_x = 0;
+ treesize.g_y = 0;
+ treesize.g_w = dlgtree->ob_width;
+ treesize.g_h = dlgtree->ob_height;
+ wind_calc_grect(WC_BORDER, kind, &treesize, &pos);
+ pos.g_x = desk_area.g_w - pos.g_w;
+ pos.g_y = desk_area.g_h - pos.g_h;
+ + /* create the dialog: */ + h_aes_win = wind_create_grect(kind, &pos); + wind_set_str(h_aes_win, WF_NAME, title); +
+
+ current = sfs;
+ sfs->bw = gw->browser->bw; +/*
+ sfs->formwind = mt_FormCreate( &app, tree, WAT_FORM,
+ NULL, title,
+ &pos, true, false);
+*/ +/*
+ ObjcAttachFormFunc(sfs->formwind, SEARCH_BT_SEARCH, evnt_bt_srch_click, + NULL);
+ ObjcAttachFormFunc(sfs->formwind, SEARCH_CB_CASESENSE, evnt_cb_click, NULL);
+ ObjcAttachFormFunc(sfs->formwind, SEARCH_CB_SHOWALL, evnt_cb_click, NULL);
+ ObjcAttachFormFunc(sfs->formwind, SEARCH_CB_FWD, evnt_cb_click, NULL);
+ EvntAdd(sfs->formwind, WM_CLOSED, evnt_close, EV_TOP);
+*/ + apply_form(searchwin, &sfs->state ); + set_text(SEARCH_TB_SRCH, (char*)"", 31);
+
+ return(current);
+
+}
diff --git a/atari/search.h b/atari/search.h index 7913803cd..00671e4a7 100644 --- a/atari/search.h +++ b/atari/search.h @@ -1,5 +1,5 @@ /*
- * Copyright 2012 Ole Loots <ole@monochrom.net>
+ * Copyright 2013 Ole Loots <ole@monochrom.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -14,29 +14,44 @@ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- */ + *
+ * Module Description:
+ *
+ *
+ *
+ */
+ +#include "desktop/browser.h" +#include "desktop/search.h" #ifndef NS_ATARI_SEARCH_H
#define NS_ATARI_SEARCH_H
-#define SEARCH_MAX_SLEN 24
+#define SEARCH_MAX_SLEN 24 + +struct gui_window; +struct browser_window;
struct s_search_form_state
{
char text[32];
- uint32_t flags;
+ uint32_t flags; + bool back_avail;
};
struct s_search_form_session {
struct browser_window * bw;
- WINDOW * formwind;
struct s_search_form_state state;
};
typedef struct s_search_form_session * SEARCH_FORM_SESSION;
-SEARCH_FORM_SESSION open_browser_search(struct gui_window * gw);
-void search_destroy( struct gui_window * gw );
+struct s_search_form_session * nsatari_search_session_create(OBJECT * obj, + struct browser_window *bw); +void nsatari_search_session_destroy(struct s_search_form_session *s); +void nsatari_search_perform(struct s_search_form_session *s, OBJECT *obj, + search_flags_t f); +void nsatari_search_restore_form( struct s_search_form_session *s, OBJECT *obj); #endif diff --git a/atari/search.h.old b/atari/search.h.old new file mode 100644 index 000000000..5cb8d07b6 --- /dev/null +++ b/atari/search.h.old @@ -0,0 +1,52 @@ +/*
+ * 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/>.
+ *
+ * Module Description:
+ *
+ *
+ *
+ */
+ + +#ifndef NS_ATARI_SEARCH_H
+#define NS_ATARI_SEARCH_H
+
+#define SEARCH_MAX_SLEN 24 + +struct gui_window; +struct browser_window;
+
+struct s_search_form_state
+{
+ char text[32];
+ uint32_t flags;
+};
+
+struct s_search_form_session {
+ struct browser_window * bw;
+ struct s_search_form_state state;
+};
+
+
+typedef struct s_search_form_session * SEARCH_FORM_SESSION;
+
+SEARCH_FORM_SESSION open_browser_search(struct gui_window * gw);
+void search_destroy(struct gui_window * gw);
+ +struct s_search_session +
+#endif diff --git a/atari/settings.c b/atari/settings.c index 8143cdcc6..4f73fc3db 100644 --- a/atari/settings.c +++ b/atari/settings.c @@ -1,955 +1,767 @@ -/*
- * Copyright 2012 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 <sys/types.h> +#include <sys/stat.h> +#include <dirent.h> +#include <fcntl.h> +#include <time.h> +#include <limits.h> +#include <unistd.h> +#include <string.h> +#include <stdbool.h> +#include <cflib.h> + +#include "desktop/options.h" +#include "desktop/plot_style.h" +#include "atari/res/netsurf.rsh" +#include "atari/settings.h" +#include "atari/deskmenu.h" +#include "atari/misc.h" +#include "atari/plot/plot.h" +#include "atari/bitmap.h" +#include "atari/findfile.h" +#include "atari/gemtk/gemtk.h" + +extern char options[PATH_MAX]; +extern GRECT desk_area; + +static float tmp_option_memory_cache_size; +static float tmp_option_minimum_gif_delay; +static unsigned int tmp_option_expire_url; +static unsigned int tmp_option_font_min_size; +static unsigned int tmp_option_font_size; +static unsigned int tmp_option_min_reflow_period; +static unsigned int tmp_option_max_fetchers; +static unsigned int tmp_option_max_fetchers_per_host; +static unsigned int tmp_option_max_cached_fetch_handles; +static colour tmp_option_atari_toolbar_bg; + +static short h_aes_win = 0; +static short edit_obj = -1; +static short any_obj = -1; +static GUIWIN * settings_guiwin = NULL; +static OBJECT * dlgtree; + +#define OBJ_SELECTED(idx) ((bool)((dlgtree[idx].ob_state & OS_SELECTED)!=0)) + +#define OBJ_CHECK(idx) (dlgtree[idx].ob_state |= (OS_SELECTED)); + +#define OBJ_UNCHECK(idx) (dlgtree[idx].ob_state &= ~(OS_SELECTED)); + +#define OBJ_REDRAW(idx) gemtk_wm_send_redraw(settings_guiwin, \ + gemtk_obj_screen_rect(dlgtree, idx)); + +#define DISABLE_OBJ(idx) (dlgtree[idx].ob_state |= OS_DISABLED); \ + gemtk_wm_send_redraw(settings_guiwin, \ + gemtk_obj_screen_rect(dlgtree, idx)); + +#define ENABLE_OBJ(idx) (dlgtree[idx].ob_state &= ~(OS_DISABLED)); \ + gemtk_wm_send_redraw(settings_guiwin, \ + gemtk_obj_screen_rect(dlgtree, idx)); + +#define FORMEVENT(idx) form_event(idx, 0); + +#define INPUT_HOMEPAGE_URL_MAX_LEN 44 +#define INPUT_LOCALE_MAX_LEN 6 +#define INPUT_PROXY_HOST_MAX_LEN 31 +#define INPUT_PROXY_USERNAME_MAX_LEN 36 +#define INPUT_PROXY_PASSWORD_MAX_LEN 36 +#define INPUT_PROXY_PORT_MAX_LEN 5 +#define INPUT_MIN_REFLOW_PERIOD_MAX_LEN 4 +#define LABEL_FONT_RENDERER_MAX_LEN 8 +#define LABEL_PATH_MAX_LEN 43 +#define LABEL_ICONSET_MAX_LEN 8 +#define INPUT_TOOLBAR_COLOR_MAX_LEN 6 + +static void on_close(void); +static void on_redraw(GRECT *clip); +static void form_event(int index, int external); +static void apply_settings(void); +static void save_settings(void); + + +static void set_text( short idx, char * text, int len ) +{ + char spare[255]; + + if( len > 254 ) + len = 254; + if( text != NULL ) { + strncpy( spare, text, 254); + } else { + strcpy(spare, ""); + } + + set_string( dlgtree, idx, spare); +} + + + + +/** + * Toogle all objects which are directly influenced by other GUI elements + * ( like checkbox ) */ +static void toggle_objects(void) +{ + /* enable / disable (refresh) objects depending on radio button values: */ + FORMEVENT(SETTINGS_CB_USE_PROXY); + FORMEVENT(SETTINGS_CB_PROXY_AUTH); + FORMEVENT(SETTINGS_BT_SEL_FONT_RENDERER); +} + + +static void save_settings(void) +{ + apply_settings(); + // Save settings + nsoption_write( (const char*)&options ); + nsoption_read( (const char*)&options ); + close_settings(); + form_alert(1, "[1][Some options require an netsurf restart!][OK]"); + deskmenu_update(); +} + +/* this gets called each time the settings dialog is opened: */ +static void display_settings(void) +{ + char spare[255]; + // read current settings and display them + + + /* "Browser" tab: */ + set_text( SETTINGS_EDIT_HOMEPAGE, nsoption_charp(homepage_url), + INPUT_HOMEPAGE_URL_MAX_LEN ); + + if( nsoption_bool(block_ads) ) { + OBJ_CHECK( SETTINGS_CB_HIDE_ADVERTISEMENT ); + } else { + OBJ_UNCHECK( SETTINGS_CB_HIDE_ADVERTISEMENT ); + } + if( nsoption_bool(target_blank) ) { + OBJ_UNCHECK( SETTINGS_CB_DISABLE_POPUP_WINDOWS ); + } else { + OBJ_CHECK( SETTINGS_CB_DISABLE_POPUP_WINDOWS ); + } + if( nsoption_bool(send_referer) ) { + OBJ_CHECK( SETTINGS_CB_SEND_HTTP_REFERRER ); + } else { + OBJ_UNCHECK( SETTINGS_CB_SEND_HTTP_REFERRER ); + } + if( nsoption_bool(do_not_track) ) { + OBJ_CHECK( SETTINGS_CB_SEND_DO_NOT_TRACK ); + } else { + OBJ_UNCHECK( SETTINGS_CB_SEND_DO_NOT_TRACK ); + } + + set_text( SETTINGS_BT_SEL_LOCALE, + nsoption_charp(accept_language) ? nsoption_charp(accept_language) : (char*)"en", + INPUT_LOCALE_MAX_LEN ); + + tmp_option_expire_url = nsoption_int(expire_url); + snprintf( spare, 255, "%02d", nsoption_int(expire_url) ); + set_text( SETTINGS_EDIT_HISTORY_AGE, spare, 2 ); + + /* "Cache" tab: */ + tmp_option_memory_cache_size = nsoption_int(memory_cache_size) / 1000000; + snprintf( spare, 255, "%03.1f", tmp_option_memory_cache_size ); + set_text( SETTINGS_STR_MAX_MEM_CACHE, spare, 5 ); + + /* "Paths" tab: */ + set_text( SETTINGS_EDIT_DOWNLOAD_PATH, nsoption_charp(downloads_path), + LABEL_PATH_MAX_LEN ); + set_text( SETTINGS_EDIT_HOTLIST_FILE, nsoption_charp(hotlist_file), + LABEL_PATH_MAX_LEN ); + set_text( SETTINGS_EDIT_CA_BUNDLE, nsoption_charp(ca_bundle), + LABEL_PATH_MAX_LEN ); + set_text( SETTINGS_EDIT_CA_CERTS_PATH, nsoption_charp(ca_path), + LABEL_PATH_MAX_LEN ); + set_text( SETTINGS_EDIT_EDITOR, nsoption_charp(atari_editor), + LABEL_PATH_MAX_LEN ); + + /* "Rendering" tab: */ + set_text( SETTINGS_BT_SEL_FONT_RENDERER, nsoption_charp(atari_font_driver), + LABEL_FONT_RENDERER_MAX_LEN ); + SET_BIT(dlgtree[SETTINGS_CB_TRANSPARENCY].ob_state, + OS_SELECTED, nsoption_int(atari_transparency) ? 1 : 0 ); + SET_BIT(dlgtree[SETTINGS_CB_ENABLE_ANIMATION].ob_state, + OS_SELECTED, nsoption_bool(animate_images) ? 1 : 0 ); + SET_BIT(dlgtree[SETTINGS_CB_FG_IMAGES].ob_state, + OS_SELECTED, nsoption_bool(foreground_images) ? 1 : 0 ); + SET_BIT(dlgtree[SETTINGS_CB_BG_IMAGES].ob_state, + OS_SELECTED, nsoption_bool(background_images) ? 1 : 0 ); + + + // TODO: enable this option? + /* SET_BIT(dlgtree[SETTINGS_CB_INCREMENTAL_REFLOW].ob_state, + OS_SELECTED, nsoption_bool(incremental_reflow) ? 1 : 0 );*/ + + SET_BIT(dlgtree[SETTINGS_CB_ANTI_ALIASING].ob_state, + OS_SELECTED, nsoption_int(atari_font_monochrom) ? 0 : 1 ); + + + // TODO: activate this option? + tmp_option_min_reflow_period = nsoption_int(min_reflow_period); + snprintf( spare, 255, "%04d", tmp_option_min_reflow_period ); + set_text( SETTINGS_EDIT_MIN_REFLOW_PERIOD, spare, + 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 ); + snprintf( spare, 255, "%5d", nsoption_int(http_proxy_port) ); + set_text( SETTINGS_EDIT_PROXY_PORT, spare, + INPUT_PROXY_PORT_MAX_LEN ); + + set_text( SETTINGS_EDIT_PROXY_USERNAME, nsoption_charp(http_proxy_auth_user), + INPUT_PROXY_USERNAME_MAX_LEN ); + set_text( SETTINGS_EDIT_PROXY_PASSWORD, nsoption_charp(http_proxy_auth_pass), + INPUT_PROXY_PASSWORD_MAX_LEN ); + SET_BIT(dlgtree[SETTINGS_CB_USE_PROXY].ob_state, + OS_SELECTED, nsoption_bool(http_proxy) ? 1 : 0 ); + SET_BIT(dlgtree[SETTINGS_CB_PROXY_AUTH].ob_state, + OS_SELECTED, nsoption_int(http_proxy_auth) ? 1 : 0 ); + + tmp_option_max_cached_fetch_handles = nsoption_int(max_cached_fetch_handles); + snprintf( spare, 255, "%2d", nsoption_int(max_cached_fetch_handles) ); + set_text( SETTINGS_EDIT_MAX_CACHED_CONNECTIONS, spare , 2 ); + + tmp_option_max_fetchers = nsoption_int(max_fetchers); + snprintf( spare, 255, "%2d", nsoption_int(max_fetchers) ); + set_text( SETTINGS_EDIT_MAX_FETCHERS, spare , 2 ); + + tmp_option_max_fetchers_per_host = nsoption_int(max_fetchers_per_host); + snprintf( spare, 255, "%2d", nsoption_int(max_fetchers_per_host) ); + set_text( SETTINGS_EDIT_MAX_FETCHERS_PER_HOST, spare , 2 ); + + + /* "Style" tab: */ + tmp_option_font_min_size = nsoption_int(font_min_size); + snprintf( spare, 255, "%3d", nsoption_int(font_min_size) ); + set_text( SETTINGS_EDIT_MIN_FONT_SIZE, spare , 3 ); + + tmp_option_font_size = nsoption_int(font_size); + snprintf( spare, 255, "%3d", nsoption_int(font_size) ); + set_text( SETTINGS_EDIT_DEF_FONT_SIZE, spare , 3 ); + + toggle_objects(); +} + + +static void form_event(int index, int external) +{ + char spare[255]; + bool is_button = false; + bool checked = OBJ_SELECTED(index); + char * tmp; + MENU pop_menu, me_data; + + /* For font driver popup: */ + int num_font_drivers = 2; + + /* + Just a small collection of locales, each country has at least one + ATARI-clone user! :) + */ + int num_locales = 15; + short x, y; + int choice, i; + + switch(index) { + + case SETTINGS_SAVE: + OBJ_UNCHECK(index); + OBJ_REDRAW(index); + save_settings(); + break; + + case SETTINGS_ABORT: + OBJ_UNCHECK(index); + OBJ_REDRAW(index); + close_settings(); + break; + + case SETTINGS_CB_USE_PROXY: + if( checked ) { + ENABLE_OBJ(SETTINGS_EDIT_PROXY_HOST); + ENABLE_OBJ(SETTINGS_EDIT_PROXY_PORT); + ENABLE_OBJ(SETTINGS_CB_PROXY_AUTH); + } else { + DISABLE_OBJ(SETTINGS_EDIT_PROXY_HOST); + DISABLE_OBJ(SETTINGS_EDIT_PROXY_PORT); + DISABLE_OBJ(SETTINGS_CB_PROXY_AUTH); + } + FORMEVENT(SETTINGS_CB_PROXY_AUTH); + OBJ_REDRAW(SETTINGS_CB_USE_PROXY); + break; + + case SETTINGS_CB_PROXY_AUTH: + if( checked && OBJ_SELECTED( SETTINGS_CB_USE_PROXY ) ) { + ENABLE_OBJ(SETTINGS_EDIT_PROXY_USERNAME); + ENABLE_OBJ(SETTINGS_EDIT_PROXY_PASSWORD); + } else { + DISABLE_OBJ(SETTINGS_EDIT_PROXY_USERNAME); + DISABLE_OBJ(SETTINGS_EDIT_PROXY_PASSWORD); + } + 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: + if( external ) { + objc_offset(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER, &x, &y); + // point mn_tree tree to states popup: + pop_menu.mn_tree = gemtk_obj_get_tree(POP_FONT_RENDERER); + pop_menu.mn_menu = 0; + pop_menu.mn_item = POP_FONT_RENDERER_INTERNAL; + pop_menu.mn_scroll = SCROLL_NO; + pop_menu.mn_keystate = 0; + + // find the selected menu item and uncheck others: + for(i=pop_menu.mn_item; i<=num_font_drivers; i++) { + get_string(pop_menu.mn_tree, i, spare); + tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER); + if (strcasecmp(&spare[2], tmp)) { + menu_icheck(pop_menu.mn_tree, i, 0); + } else { + menu_icheck(pop_menu.mn_tree, i, 1); + } + set_string(pop_menu.mn_tree, i, spare); + } + + menu_popup(&pop_menu, x, y, &me_data); + choice = me_data.mn_item; + if( choice > 0 && choice <= num_font_drivers ) { + get_string(pop_menu.mn_tree, choice, spare); + for(i=2; i<(int)strlen(spare); i++) { + spare[i]= (char)tolower(spare[i]); + } + set_text(SETTINGS_BT_SEL_FONT_RENDERER, + (char*)&spare[2], + LABEL_FONT_RENDERER_MAX_LEN); + OBJ_REDRAW(SETTINGS_BT_SEL_FONT_RENDERER); + } + } + tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER); + if (strcasecmp(tmp, "freetype") == 0) { + ENABLE_OBJ(SETTINGS_CB_ANTI_ALIASING); + } else { + DISABLE_OBJ(SETTINGS_CB_ANTI_ALIASING); + } + break; + + case SETTINGS_BT_SEL_LOCALE: + objc_offset(dlgtree, SETTINGS_BT_SEL_LOCALE, &x, &y); + + // point mn_tree tree to states popup: + pop_menu.mn_tree = gemtk_obj_get_tree(POP_LANGUAGE); + pop_menu.mn_menu = 0; + pop_menu.mn_item = POP_LANGUAGE_CS; + pop_menu.mn_scroll = SCROLL_NO; + pop_menu.mn_keystate = 0; + + // find the selected menu item and uncheck others: + for(i=pop_menu.mn_item; i<=num_locales; i++) { + get_string(pop_menu.mn_tree, i, spare); + tmp = gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_LOCALE); + if (strcasecmp(&spare[2], tmp)) { + menu_icheck(pop_menu.mn_tree, i, 0); + } else { + menu_icheck(pop_menu.mn_tree, i, 1); + } + set_string(pop_menu.mn_tree, i, spare); + } + + + menu_popup(&pop_menu, x, y, &me_data); + choice = me_data.mn_item; + if( choice > 0 && choice <= num_locales ) { + get_string(pop_menu.mn_tree, choice, spare); + for(i=2; i<(int)strlen(spare); i++) { + spare[i]= (char)tolower(spare[i]); + } + set_text(SETTINGS_BT_SEL_LOCALE, (char*)&spare[2], 5); + } + + OBJ_REDRAW(SETTINGS_BT_SEL_LOCALE); + break; + + /* + case SETTINGS_INPUT_TOOLBAR_BGCOLOR: + objc_offset( FORM(win), SETTINGS_INPUT_TOOLBAR_BGCOLOR, &x, &y ); + choice = color_popup(x, y, tmp_option_atari_toolbar_bg); + snprintf( spare, 255, "%06x", choice ); + tmp_option_atari_toolbar_bg = choice; + ObjcStrCpy( dlgtree, SETTINGS_INPUT_TOOLBAR_BGCOLOR, + spare ); + is_button = true; + OBJ_REDRAW(SETTINGS_INPUT_TOOLBAR_BGCOLOR); + break; + */ + /* + case SETTINGS_BT_TOOLBAR_ICONSET: + objc_offset( FORM(win), SETTINGS_BT_TOOLBAR_ICONSET, &x, &y ); + tmp = toolbar_iconset_popup(x,y); + if( tmp != NULL ){ + ObjcStrCpy( dlgtree, SETTINGS_BT_TOOLBAR_ICONSET, tmp ); + } + is_button = true; + break; + */ + case SETTINGS_INC_MEM_CACHE: + case SETTINGS_DEC_MEM_CACHE: + if( index == SETTINGS_DEC_MEM_CACHE ) + tmp_option_memory_cache_size -= 0.1; + else + tmp_option_memory_cache_size += 0.1; + + if( tmp_option_memory_cache_size < 0.5 ) + tmp_option_memory_cache_size = 0.5; + if( tmp_option_memory_cache_size > 999.9 ) + tmp_option_memory_cache_size = 999.9; + snprintf( spare, 255, "%03.1f", tmp_option_memory_cache_size ); + set_text( SETTINGS_STR_MAX_MEM_CACHE, spare, 5 ); + is_button = true; + OBJ_REDRAW(SETTINGS_STR_MAX_MEM_CACHE); + break; + + case SETTINGS_INC_CACHED_CONNECTIONS: + case SETTINGS_DEC_CACHED_CONNECTIONS: + if( index == SETTINGS_INC_CACHED_CONNECTIONS ) + tmp_option_max_cached_fetch_handles += 1; + else + tmp_option_max_cached_fetch_handles -= 1; + if( tmp_option_max_cached_fetch_handles > 31 ) + tmp_option_max_cached_fetch_handles = 31; + + snprintf( spare, 255, "%02d", tmp_option_max_cached_fetch_handles ); + set_text( SETTINGS_EDIT_MAX_CACHED_CONNECTIONS, spare, 2 ); + is_button = true; + OBJ_REDRAW(SETTINGS_EDIT_MAX_CACHED_CONNECTIONS); + break; + + case SETTINGS_INC_MAX_FETCHERS: + case SETTINGS_DEC_MAX_FETCHERS: + if( index == SETTINGS_INC_MAX_FETCHERS ) + tmp_option_max_fetchers += 1; + else + tmp_option_max_fetchers -= 1; + if( tmp_option_max_fetchers > 31 ) + tmp_option_max_fetchers = 31; + + snprintf( spare, 255, "%02d", tmp_option_max_fetchers ); + set_text( SETTINGS_EDIT_MAX_FETCHERS, spare, 2 ); + is_button = true; + OBJ_REDRAW(SETTINGS_EDIT_MAX_FETCHERS); + break; + + case SETTINGS_INC_MAX_FETCHERS_PER_HOST: + case SETTINGS_DEC_MAX_FETCHERS_PER_HOST: + if( index == SETTINGS_INC_MAX_FETCHERS_PER_HOST ) + tmp_option_max_fetchers_per_host += 1; + else + tmp_option_max_fetchers_per_host -= 1; + if( tmp_option_max_fetchers_per_host > 31 ) + tmp_option_max_fetchers_per_host = 31; + + snprintf( spare, 255, "%02d", tmp_option_max_fetchers_per_host ); + set_text( SETTINGS_EDIT_MAX_FETCHERS_PER_HOST, spare, 2 ); + is_button = true; + OBJ_REDRAW(SETTINGS_EDIT_MAX_FETCHERS_PER_HOST); + break; + + case SETTINGS_INC_HISTORY_AGE: + case SETTINGS_DEC_HISTORY_AGE: + if( index == SETTINGS_INC_HISTORY_AGE ) + tmp_option_expire_url += 1; + else + tmp_option_expire_url -= 1; + + if( tmp_option_expire_url > 99 ) + tmp_option_expire_url = 0; + + snprintf( spare, 255, "%02d", tmp_option_expire_url ); + set_text( SETTINGS_EDIT_HISTORY_AGE, spare, 2 ); + is_button = true; + 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 ) + tmp_option_font_min_size += 1; + else + tmp_option_font_min_size -= 1; + + if( tmp_option_font_min_size > 500 ) + tmp_option_font_min_size = 500; + if( tmp_option_font_min_size < 10 ) + tmp_option_font_min_size = 10; + + snprintf( spare, 255, "%03d", tmp_option_font_min_size ); + set_text( SETTINGS_EDIT_MIN_FONT_SIZE, spare, 3 ); + is_button = true; + OBJ_REDRAW(SETTINGS_EDIT_MIN_FONT_SIZE); + break; + + case SETTINGS_INC_DEF_FONT_SIZE: + case SETTINGS_DEC_DEF_FONT_SIZE: + if( index == SETTINGS_INC_DEF_FONT_SIZE ) + tmp_option_font_size += 1; + else + tmp_option_font_size -= 1; + + if( tmp_option_font_size > 999 ) + tmp_option_font_size = 999; + if( tmp_option_font_size < 50 ) + tmp_option_font_size = 50; + + snprintf( spare, 255, "%03d", tmp_option_font_size ); + set_text( SETTINGS_EDIT_DEF_FONT_SIZE, spare, 3 ); + is_button = true; + OBJ_REDRAW(SETTINGS_EDIT_DEF_FONT_SIZE); + break; + + case SETTINGS_INC_INCREMENTAL_REFLOW: + case SETTINGS_DEC_INCREMENTAL_REFLOW: + if( index == SETTINGS_INC_INCREMENTAL_REFLOW ) + tmp_option_min_reflow_period += 1; + else + tmp_option_min_reflow_period -= 1; + + if( tmp_option_min_reflow_period > 9999 ) + tmp_option_min_reflow_period = 10; + + snprintf( spare, 255, "%04d", tmp_option_min_reflow_period ); + set_text( SETTINGS_EDIT_MIN_REFLOW_PERIOD, spare, 4 ); + is_button = true; + OBJ_REDRAW(SETTINGS_EDIT_MIN_REFLOW_PERIOD); + break; + + default: + break; + } + + if( is_button ) { + // remove selection indicator from button element: + OBJ_UNCHECK(index); + OBJ_REDRAW(index); + } +} + + +static void apply_settings(void) +{ + /* "Network" tab: */ + nsoption_set_bool(http_proxy, OBJ_SELECTED(SETTINGS_CB_USE_PROXY)); + if ( OBJ_SELECTED(SETTINGS_CB_PROXY_AUTH) ) { + nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_BASIC); + } else { + nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_NONE); + } + nsoption_set_charp(http_proxy_auth_pass, + gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_PASSWORD)); + nsoption_set_charp(http_proxy_auth_user, + gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_USERNAME)); + nsoption_set_charp(http_proxy_host, + gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_HOST)); + nsoption_set_int(http_proxy_port, + atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_PORT) )); + nsoption_set_int(max_fetchers_per_host, + atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_MAX_FETCHERS_PER_HOST))); + nsoption_set_int(max_cached_fetch_handles, + atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_MAX_CACHED_CONNECTIONS))); + nsoption_set_int(max_fetchers, + atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_MAX_FETCHERS) )); + nsoption_set_bool(foreground_images, + OBJ_SELECTED( SETTINGS_CB_FG_IMAGES )); + nsoption_set_bool(background_images, + OBJ_SELECTED( SETTINGS_CB_BG_IMAGES )); + + /* "Style" tab: */ + nsoption_set_int(font_min_size, tmp_option_font_min_size); + nsoption_set_int(font_size, tmp_option_font_size); + + /* "Rendering" tab: */ + nsoption_set_charp(atari_font_driver, + gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER)); + nsoption_set_bool(atari_transparency, + 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); + nsoption_set_int(atari_font_monochrom, + !OBJ_SELECTED( SETTINGS_CB_ANTI_ALIASING )); + + /* "Paths" tabs: */ + nsoption_set_charp(ca_bundle, + gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_BUNDLE)); + nsoption_set_charp(ca_path, + gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH)); + nsoption_set_charp(homepage_url, + gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH)); + nsoption_set_charp(hotlist_file, + gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HOTLIST_FILE)); + nsoption_set_charp(atari_editor, + gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_EDITOR)); + nsoption_set_charp(downloads_path, + gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_DOWNLOAD_PATH)); + + /* "Cache" tab: */ + nsoption_set_int(memory_cache_size, + tmp_option_memory_cache_size * 1000000); + + /* "Browser" tab: */ + nsoption_set_bool(target_blank, + !OBJ_SELECTED(SETTINGS_CB_DISABLE_POPUP_WINDOWS)); + nsoption_set_bool(block_ads, + OBJ_SELECTED(SETTINGS_CB_HIDE_ADVERTISEMENT)); + nsoption_set_charp(accept_language, + gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_LOCALE)); + nsoption_set_int(expire_url, + atoi(gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HISTORY_AGE))); + nsoption_set_bool(send_referer, + OBJ_SELECTED(SETTINGS_CB_SEND_HTTP_REFERRER)); + nsoption_set_bool(do_not_track, + OBJ_SELECTED(SETTINGS_CB_SEND_DO_NOT_TRACK)); + nsoption_set_charp(homepage_url, + gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HOMEPAGE)); +} + +static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) +{ + short retval = 0; + GRECT clip, work; + static short edit_idx = 0; + struct gemtk_wm_scroll_info_s *slid; + + if ((ev_out->emo_events & MU_MESAG) != 0) { + // handle message + // printf("settings win msg: %d\n", msg[0]); + switch (msg[0]) { + + + case WM_CLOSED: + // TODO: this needs to iterate through all gui windows and + // check if the rootwin is this window... + close_settings(); + break; + + case WM_SIZED: + gemtk_wm_update_slider(win, GEMTK_WM_VH_SLIDER); + break; + + case WM_MOVED: + break; + + case WM_TOOLBAR: + switch(msg[4]) { + default: + break; + } + break; + + case GEMTK_WM_WM_FORM_CLICK: + form_event(msg[4], 1); + break; + + default: + break; + } + } + + if ((ev_out->emo_events & MU_KEYBD) != 0) { + } + + if ((ev_out->emo_events & MU_BUTTON) != 0) { + } + + return(retval); +} + +void open_settings(void) +{ + if (h_aes_win == 0) { + + GRECT curr, area; + struct gemtk_wm_scroll_info_s *slid; + uint32_t kind = CLOSER | NAME | MOVER | VSLIDE | HSLIDE | UPARROW + | DNARROW | LFARROW | RTARROW | SIZER | FULLER; + + dlgtree = gemtk_obj_get_tree(SETTINGS); + area.g_x = area.g_y = 0; + area.g_w = MIN(dlgtree->ob_width, desk_area.g_w); + area.g_h = MIN(dlgtree->ob_height, desk_area.g_h); + wind_calc_grect(WC_BORDER, kind, &area, &area); + h_aes_win = wind_create_grect(kind, &area); + wind_set_str(h_aes_win, WF_NAME, "Settings"); + settings_guiwin = gemtk_wm_add(h_aes_win, GEMTK_WM_FLAG_DEFAULTS, + on_aes_event); + curr.g_w = MIN(dlgtree->ob_width, desk_area.g_w); + curr.g_h = MIN(dlgtree->ob_height, desk_area.g_h-64); + curr.g_x = 1; + curr.g_y = (desk_area.g_h / 2) - (curr.g_h / 2); + + wind_calc_grect(WC_BORDER, kind, &curr, &curr); + + dlgtree->ob_x = curr.g_x; + dlgtree->ob_y = curr.g_y; + + /* set current config values: */ + display_settings(); + + wind_open_grect(h_aes_win, &curr); + + gemtk_wm_set_form(settings_guiwin, dlgtree, 0); + gemtk_wm_set_scroll_grid(settings_guiwin, 32, 32); + gemtk_wm_get_grect(settings_guiwin, GEMTK_WM_AREA_CONTENT, &area); + + slid = gemtk_wm_get_scroll_info(settings_guiwin); + gemtk_wm_set_content_units(settings_guiwin, + (dlgtree->ob_width/slid->x_unit_px), + (dlgtree->ob_height/slid->y_unit_px)); + gemtk_wm_update_slider(settings_guiwin, GEMTK_WM_VH_SLIDER); + } +} + +void close_settings(void) +{ + LOG(("")); + gemtk_wm_remove(settings_guiwin); + settings_guiwin = NULL; + wind_close(h_aes_win); + wind_delete(h_aes_win); + h_aes_win = 0; + LOG(("Done")); +} -#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <time.h>
-#include <limits.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdbool.h>
-#include <windom.h>
-
-#include "desktop/options.h"
-#include "desktop/plot_style.h"
-#include "atari/res/netsurf.rsh"
-#include "atari/settings.h"
-#include "atari/global_evnt.h"
-#include "atari/misc.h"
-#include "atari/plot/plot.h"
-#include "atari/bitmap.h"
-#include "atari/findfile.h"
-
-extern char options[PATH_MAX];
-
-static OBJECT * dlgtree;
-static WINDOW * dlgwin;
-
-static float tmp_option_memory_cache_size;
-static float tmp_option_minimum_gif_delay;
-static unsigned int tmp_option_expire_url;
-static unsigned int tmp_option_font_min_size;
-static unsigned int tmp_option_font_size;
-static unsigned int tmp_option_min_reflow_period;
-static unsigned int tmp_option_max_fetchers;
-static unsigned int tmp_option_max_fetchers_per_host;
-static unsigned int tmp_option_max_cached_fetch_handles;
-static colour tmp_option_atari_toolbar_bg;
-
-/* Tab forms and their buttons: */
-static int frms[] = {
- CHOICES_TAB_BROWSER,
- CHOICES_TAB_RENDER,
- CHOICES_TAB_STYLE,
- CHOICES_TAB_NETWORK,
- CHOICES_TAB_PATH,
- CHOICES_TAB_CACHE
-};
-
-static int buts[] = {
- CHOICES_REG_BROWSER,
- CHOICES_REG_RENDER,
- CHOICES_REG_STYLE,
- CHOICES_REG_NETWORK,
- CHOICES_REG_PATH,
- CHOICES_REG_CACHE
-};
-
-#define OBJ_SELECTED(idx) ((dlgtree[idx].ob_state & SELECTED)!=0)
-#define OBJ_CHECK(idx) SET_BIT(dlgtree[idx].ob_state, SELECTED, 1);
-#define OBJ_UNCHECK(idx) SET_BIT(dlgtree[idx].ob_state, SELECTED, 0);
-
-#define DISABLE_OBJ(idx) SET_BIT(dlgtree[idx].ob_state, DISABLED, 1); \
- ObjcDraw( OC_FORM, dlgwin, idx, 1 )
-
-#define ENABLE_OBJ(idx) SET_BIT(dlgtree[idx].ob_state, DISABLED, 0); \
- ObjcDraw( OC_FORM, dlgwin, idx, 1 )
-
-#define FORMEVENT(idx) form_event( NULL, idx, 0, NULL );
-
-#define INPUT_HOMEPAGE_URL_MAX_LEN 44
-#define INPUT_LOCALE_MAX_LEN 6
-#define INPUT_PROXY_HOST_MAX_LEN 31
-#define INPUT_PROXY_USERNAME_MAX_LEN 36
-#define INPUT_PROXY_PASSWORD_MAX_LEN 36
-#define INPUT_PROXY_PORT_MAX_LEN 5
-#define INPUT_MIN_REFLOW_PERIOD_MAX_LEN 4
-#define LABEL_FONT_RENDERER_MAX_LEN 8
-#define LABEL_PATH_MAX_LEN 43
-#define LABEL_ICONSET_MAX_LEN 8
-#define INPUT_TOOLBAR_COLOR_MAX_LEN 6
-
-static void toggle_objects( void );
-static void display_settings( void );
-static void apply_settings( void );
-static void __CDECL onclose( WINDOW *win, short buff[8] );
-static void __CDECL
- closeform( WINDOW *win, int index, int unused, void *unused2);
-static void __CDECL
- saveform( WINDOW *win, int index, int unused, void *unused2);
-static void __CDECL
- form_event( WINDOW *win, int index, int unused, void *unused2);
-static void __CDECL
- clear_history( WINDOW *win, int index, int unused, void *unused2);
-
-
-
-WINDOW * open_settings()
-{
-
- if( dlgtree == NULL){
- dlgtree = get_tree(CHOICES);
- if( dlgtree == NULL ){
- return( NULL );
- }
- }
-
- if( dlgwin == NULL){
- // TODO: localize title
- dlgwin = FormCreate(dlgtree, WAT_FORM, NULL, (char*)"Settings",
- NULL, TRUE, FALSE);
- if( !dlgwin ){
- return( NULL );
- }
- FormThumb( dlgwin, frms, buts, sizeof(frms) / sizeof(int) );
-
- /* Atach events to dialog buttons: */
- ObjcAttachFormFunc( dlgwin, CHOICES_ABORT, closeform, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_OK, saveform, NULL);
-
- /* Connect interactive dialog elements to generic event handler: */
- ObjcAttachFormFunc( dlgwin, CHOICES_CB_USE_PROXY, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_CB_PROXY_AUTH, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_EDIT_DOWNLOAD_PATH, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_EDIT_HOTLIST_FILE, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_EDIT_CA_BUNDLE, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_EDIT_CA_CERTS_PATH, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_EDIT_EDITOR, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_INC_GIF_DELAY, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_DEC_GIF_DELAY, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_INC_INCREMENTAL_REFLOW, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_DEC_INCREMENTAL_REFLOW, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_INC_CACHED_CONNECTIONS, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_DEC_CACHED_CONNECTIONS, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_INC_MAX_FETCHERS_PER_HOST, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_DEC_MAX_FETCHERS_PER_HOST, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_DEC_MAX_FETCHERS, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_INC_MAX_FETCHERS, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_INC_DEF_FONT_SIZE, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_DEC_DEF_FONT_SIZE, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_INC_MIN_FONT_SIZE, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_DEC_MIN_FONT_SIZE, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_INC_MEM_CACHE, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_DEC_MEM_CACHE, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_INC_HISTORY_AGE, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_DEC_HISTORY_AGE, form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_BT_SEL_FONT_RENDERER,
- form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_BT_SEL_LOCALE,
- form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_INPUT_TOOLBAR_BGCOLOR,
- form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_BT_TOOLBAR_ICONSET,
- form_event, NULL);
- ObjcAttachFormFunc( dlgwin, CHOICES_BT_CLEAR_HISTORY,
- clear_history, NULL);
-
- EvntAdd( dlgwin, WM_CLOSED, onclose, EV_TOP );
- display_settings(); - toggle_objects();
-
- } else {
- WindTop( dlgwin ); - display_settings();
- toggle_objects();
- }
- return( dlgwin );
-}
-
-void close_settings(void)
-{
- if( dlgwin != NULL ){
- /* Duplicated form tree must be free'd manualy? */
- WindClose(dlgwin);
- dlgwin = NULL;
- }
-
-}
-
-static void set_text( short idx, char * text, int len )
-{
- char spare[255];
-
- if( len > 254 )
- len = 254;
- if( text != NULL ){
- strncpy( spare, text, 254);
- ObjcStrFmt( spare, text, len );
- } else {
- strcpy(spare, "");
- }
- ObjcStrCpy( dlgtree, idx, spare );
-
-}
-
-
-static void __CDECL onclose( WINDOW *win, short buff[8] )
-{
- close_settings();
-}
-
-static void __CDECL
-closeform( WINDOW *win, int index, int unused, void *unused2)
-{
- ObjcChange( OC_FORM, win, index, ~SELECTED, TRUE);
- close_settings();
-}
-
-static void __CDECL
-saveform( WINDOW *win, int index, int unused, void *unused2)
-{
- apply_settings();
- // Save settings
- nsoption_write( (const char*)&options );
- nsoption_read( (const char*)&options );
- close_settings();
- ObjcChange( OC_FORM, win, index, NORMAL, TRUE);
- form_alert(1, "[1][Some options require an netsurf restart!][OK]");
- main_menu_update();
-}
-
-static void __CDECL clear_history( WINDOW *win, int index, int unused,
- void *unused2)
-{
-
-}
-
-
-static colour color_popup(int x, int y, colour current)
-{
-#define GRID_ROWS 9
-#define GRID_COLS 27
- colour retval = current;
- int boxwidth=6, boxheight=8;
- struct bitmap *palette_img;
- MFDB bg, screen;
- GRECT bgarea = {x, y, GRID_COLS*boxwidth+4, GRID_ROWS*boxheight+4};
- short web_std_colors[6] = {0, 51, 102, 153, 204, 255};
- int r,g,b;
- int xpos = 0, ypos = 0;
- colour palette[216+8];
- int i=0;
-
- plot_style_t drawcolour = {
- .stroke_type = PLOT_OP_TYPE_NONE,
- .fill_type = PLOT_OP_TYPE_SOLID,
- .fill_colour = 0
- };
-
- plot_style_t outline = {
- .stroke_type = PLOT_OP_TYPE_SOLID,
- .stroke_colour = 0xAAAAAA,
- .stroke_width = 2,
- .fill_type = PLOT_OP_TYPE_NONE,
- .fill_colour = 0
- };
-
- /* create a palette array (web colors): */
- for (r=0; r<6; r++) {
- for (g=0; g<6; g++) {
- for (b=0; b<6; b++) {
- palette[i] = ((web_std_colors[b]<<16)
- | (web_std_colors[g]<<8)
- | web_std_colors[r]);
- i++;
- }
- }
- }
-
- /* setup the gray color values: */
- int z = 0;
- colour grays[15] = {0x111111, 0x222222, 0x333333, 0x444444,
- 0x555555, 0x666666, 0x777777, 0x888888,
- 0x999999, 0x999999, 0xAAAAAA, 0xBBBBBB,
- 0xCCCCCC, 0xDDDDDD, 0xEEEEEE};
- for (z=0;i<243;i++) {
- if (z<15)
- palette[i] = grays[z];
- else
- palette[i] = 0x000000;
- z++;
- }
-
- plot_set_dimensions(x, y,
- (GRID_COLS*boxwidth)+4, (GRID_ROWS*boxheight)+4);
- plot_lock();
-
- // store background:
- short pxy[8];
- init_mfdb(app.nplanes, bgarea.g_w, bgarea.g_h, 0, &bg);
- init_mfdb(0, bgarea.g_w, bgarea.g_h, 0, &screen);
-
- pxy[0] = bgarea.g_x;
- pxy[1] = bgarea.g_y;
- pxy[2] = bgarea.g_x + bgarea.g_w - 1;
- pxy[3] = bgarea.g_y + bgarea.g_h - 1;
- pxy[4] = 0;
- pxy[5] = 0;
- pxy[6] = bgarea.g_w - 1;
- pxy[7] = bgarea.g_h - 1;
-
- /* copy screen image */
- vro_cpyfm (app.graf.handle, S_ONLY, pxy, &screen, &bg);
-
- plot_line(x, y, x+(GRID_COLS*boxwidth)+2, y,
- &outline);
-
- plot_line(x, y+(GRID_ROWS*boxheight)+2, x+(GRID_COLS*boxwidth)+2,
- y+(GRID_ROWS*boxheight)+2,
- &outline);
-
- /* draw a 27*8 grid: */
- for (i=0; i<243; i++){
- drawcolour.fill_colour = palette[i];
- plot_rectangle(xpos+2, ypos+2, xpos+boxwidth+2, ypos+boxheight+2,
- &drawcolour);
- xpos += boxwidth;
- if (xpos >= GRID_COLS*boxwidth) {
- xpos = 0;
- ypos += boxheight;
- }
- } - - // enable mouse cursor (screen keeps beeing locked):
- graf_mouse(M_ON, NULL); -
- /* fetch mouse event: */
- mt_EvntDisable(&app, dlgwin, WM_XBUTTON);
- EvntWindom(MU_BUTTON);
- mt_EvntEnable(&app, dlgwin, WM_XBUTTON);
-
- /* calulate clicked grid coords: */
- int row = ((evnt.my-y)/boxheight);
- int col = ((evnt.mx-x)/boxwidth);
-
- if (row >= 0 && row <= GRID_ROWS-1 && col >= 0 && col <= GRID_COLS-1) {
- assert( (GRID_COLS*row)+(col) >= 0 );
- assert( (GRID_COLS*row)+(col) < 243 );
- retval = palette[(GRID_COLS*row)+(col)];
- }
-
- /* restore background: */
- w_put_bkgr(&app, bgarea.g_x, bgarea.g_y, bgarea.g_w, bgarea.g_h, &bg);
- free(bg.fd_addr);
-
- plot_unlock();
-
-#undef GRID_COLS
-#undef GRID_ROWS
-
- return(retval);
-}
-
-/**
-* Displays a popup to select available icon sets,
- the returned string is no longer than 8 characters.
-* \param x x pos of popup
-* \param y y pos of popup
-* \return the selected string or NULL on failure.
-*/
-static char * toolbar_iconset_popup( int x, int y )
-{
- #define MAX_SETS 24
- DIR *dp;
- struct dirent *ep;
- struct stat statbuf;
- char * current = NULL;
- char *avail[MAX_SETS];
- int selected = 0, navail = 0, i, choice=-1;
- static char toolbar_folder[PATH_MAX];
- char fullpath[PATH_MAX];
-
- strncpy( fullpath, nsoption_charp(tree_icons_path), 255 );
- path_add_part( fullpath, 255, "toolbar/" );
-
- /* Get current set (for pre-selection): */
- memset( avail, 0, MAX_SETS );
- current = nsoption_charp(atari_image_toolbar_folder);
-
- /* locate the toolbar folder: */
- atari_find_resource( toolbar_folder, fullpath, fullpath );
-
- /* search for iconset folders: */
- dp = opendir (toolbar_folder);
- if (dp != NULL){
- while (ep = readdir (dp)) {
- if (strlen(ep->d_name) < 3)
- continue;
- snprintf(fullpath, PATH_MAX-1, "%s/%s", toolbar_folder, ep->d_name ); - if (is_dir(fullpath)) { - if (strcmp(ep->d_name, current) == 0)
- selected = navail;
- /* store the folder name: */
- avail[navail] = malloc( strlen(ep->d_name)+1 );
- sprintf( avail[navail], "%s", ep->d_name );
- navail++;
- if( navail >= MAX_SETS )
- break; - }
- }
- (void) closedir (dp);
- }
-
-
- if (navail > 0){
- choice = MenuPopUp( avail, x, y, navail,
- -1, selected, P_LIST | P_CHCK );
- if (choice > 0)
- snprintf( toolbar_folder, 9, "%s", avail[choice-1] );
- }
-
- for (i=0;i<navail; i++ ) {
- free( avail[i] );
- }
- if (choice > 0)
- return( toolbar_folder );
- else
- return( NULL );
- #undef MAX_SETS
-}
-
-static void __CDECL
-form_event( WINDOW *win, int index, int external, void *unused2)
-{
- char spare[255];
- bool is_button = false;
- bool checked = OBJ_SELECTED( index );
- char * tmp;
-
- /* For font driver popup: */
- const char *font_driver_items[] = {"freetype", "internal" };
- int num_font_drivers = (sizeof(font_driver_items)/sizeof(char*));
-
- /*
- Just a small collection of locales, each country has at least one
- ATARI-clone user! :)
- */
- const char *locales[] = {
- "cs", "de", "de-de" , "en", "en-gb", "en-us", "es",
- "fr", "it", "nl", "no", "pl", "ru", "sk", "sv"
- };
- int num_locales = (sizeof(locales)/sizeof(char*));
- short x, y;
- int choice; - - switch( index ){
-
- case CHOICES_CB_USE_PROXY: - if( checked ){
- ENABLE_OBJ( CHOICES_EDIT_PROXY_HOST );
- ENABLE_OBJ( CHOICES_CB_PROXY_AUTH );
- }
- else {
- DISABLE_OBJ( CHOICES_EDIT_PROXY_HOST );
- DISABLE_OBJ( CHOICES_CB_PROXY_AUTH );
- }
- FORMEVENT( CHOICES_CB_PROXY_AUTH ); - ObjcDrawParent(OC_FORM, dlgwin, index, 9, 1 );
- break;
-
- case CHOICES_CB_PROXY_AUTH:
- if( checked && OBJ_SELECTED( CHOICES_CB_USE_PROXY ) ){
- ENABLE_OBJ(CHOICES_EDIT_PROXY_USERNAME);
- ENABLE_OBJ(CHOICES_EDIT_PROXY_PASSWORD);
- }
- else {
- DISABLE_OBJ(CHOICES_EDIT_PROXY_USERNAME);
- DISABLE_OBJ(CHOICES_EDIT_PROXY_PASSWORD);
- }
- break;
-
- case CHOICES_CB_ENABLE_ANIMATION:
- if( checked ){
- ENABLE_OBJ( CHOICES_EDIT_MIN_GIF_DELAY );
- }
- else {
- DISABLE_OBJ( CHOICES_EDIT_MIN_GIF_DELAY );
- }
- break;
-
- case CHOICES_BT_SEL_FONT_RENDERER:
- if( external ){
- objc_offset( FORM(win), CHOICES_BT_SEL_FONT_RENDERER, &x, &y);
- choice = MenuPopUp ( font_driver_items, x, y,
- num_font_drivers,
- -1, -1, P_LIST + P_WNDW + P_CHCK );
- if( choice > 0 &&
- choice <= num_font_drivers ){
- ObjcStrCpy( dlgtree, CHOICES_BT_SEL_FONT_RENDERER,
- (char*)font_driver_items[choice-1] );
- }
- ObjcChange( OC_FORM, win, index, NORMAL, TRUE);
- }
- tmp = ObjcString( dlgtree, CHOICES_BT_SEL_FONT_RENDERER, NULL);
- if( strcmp(tmp, "freetype") == 0 ){
- ENABLE_OBJ( CHOICES_CB_ANTI_ALIASING );
- } else {
- DISABLE_OBJ( CHOICES_CB_ANTI_ALIASING );
- }
- break;
-
- case CHOICES_BT_SEL_LOCALE:
- objc_offset( FORM(win), CHOICES_BT_SEL_LOCALE, &x, &y);
- choice = MenuPopUp ( locales, x, y,
- num_locales,
- -1, -1, P_LIST + P_WNDW + P_CHCK );
- if( choice > 0 && choice <= num_locales ){
- ObjcStrCpy( dlgtree, CHOICES_BT_SEL_LOCALE,
- (char*)locales[choice-1] );
- }
- ObjcChange( OC_FORM, win, index, NORMAL, TRUE);
- break;
-
- case CHOICES_INPUT_TOOLBAR_BGCOLOR:
- objc_offset( FORM(win), CHOICES_INPUT_TOOLBAR_BGCOLOR, &x, &y );
- choice = color_popup(x, y, tmp_option_atari_toolbar_bg);
- snprintf( spare, 255, "%06x", choice );
- tmp_option_atari_toolbar_bg = choice;
- ObjcStrCpy( dlgtree, CHOICES_INPUT_TOOLBAR_BGCOLOR,
- spare );
- is_button = true;
- ObjcChange( OC_FORM, win, index, NORMAL, TRUE);
- ObjcDrawParent(OC_FORM, dlgwin, CHOICES_INPUT_TOOLBAR_BGCOLOR, 2, 1 );
- break;
-
- case CHOICES_BT_TOOLBAR_ICONSET:
- objc_offset( FORM(win), CHOICES_BT_TOOLBAR_ICONSET, &x, &y );
- tmp = toolbar_iconset_popup(x,y);
- if( tmp != NULL ){
- ObjcStrCpy( dlgtree, CHOICES_BT_TOOLBAR_ICONSET, tmp );
- }
- is_button = true;
- ObjcChange( OC_FORM, win, index, NORMAL, TRUE);
- break;
-
- case CHOICES_INC_MEM_CACHE:
- case CHOICES_DEC_MEM_CACHE:
- if( index == CHOICES_DEC_MEM_CACHE )
- tmp_option_memory_cache_size -= 0.1;
- else
- tmp_option_memory_cache_size += 0.1;
-
- if( tmp_option_memory_cache_size < 0.5 )
- tmp_option_memory_cache_size = 0.5;
- if( tmp_option_memory_cache_size > 999.9 )
- tmp_option_memory_cache_size = 999.9;
- snprintf( spare, 255, "%03.1f", tmp_option_memory_cache_size );
- set_text( CHOICES_STR_MAX_MEM_CACHE, spare, 5 );
- is_button = true;
- ObjcDrawParent(OC_FORM, dlgwin, CHOICES_STR_MAX_MEM_CACHE, 2, 1 );
- break;
-
- case CHOICES_INC_CACHED_CONNECTIONS:
- case CHOICES_DEC_CACHED_CONNECTIONS:
- if( index == CHOICES_INC_CACHED_CONNECTIONS )
- tmp_option_max_cached_fetch_handles += 1;
- else
- tmp_option_max_cached_fetch_handles -= 1;
- if( tmp_option_max_cached_fetch_handles > 31 )
- tmp_option_max_cached_fetch_handles = 31;
-
- snprintf( spare, 255, "%02d", tmp_option_max_cached_fetch_handles );
- set_text( CHOICES_EDIT_MAX_CACHED_CONNECTIONS, spare, 2 );
- is_button = true;
- ObjcDrawParent(OC_FORM, dlgwin, CHOICES_EDIT_MAX_CACHED_CONNECTIONS,
- 2, 1 );
- break;
-
- case CHOICES_INC_MAX_FETCHERS:
- case CHOICES_DEC_MAX_FETCHERS:
- if( index == CHOICES_INC_MAX_FETCHERS )
- tmp_option_max_fetchers += 1;
- else
- tmp_option_max_fetchers -= 1;
- if( tmp_option_max_fetchers > 31 )
- tmp_option_max_fetchers = 31;
-
- snprintf( spare, 255, "%02d", tmp_option_max_fetchers );
- set_text( CHOICES_EDIT_MAX_FETCHERS, spare, 2 );
- is_button = true;
- ObjcDrawParent(OC_FORM, dlgwin, CHOICES_EDIT_MAX_FETCHERS,
- 3, 1 );
- break;
-
- case CHOICES_INC_MAX_FETCHERS_PER_HOST:
- case CHOICES_DEC_MAX_FETCHERS_PER_HOST:
- if( index == CHOICES_INC_MAX_FETCHERS_PER_HOST )
- tmp_option_max_fetchers_per_host += 1;
- else
- tmp_option_max_fetchers_per_host -= 1;
- if( tmp_option_max_fetchers_per_host > 31 )
- tmp_option_max_fetchers_per_host = 31;
-
- snprintf( spare, 255, "%02d", tmp_option_max_fetchers_per_host );
- set_text( CHOICES_EDIT_MAX_FETCHERS_PER_HOST, spare, 2 );
- is_button = true;
- ObjcDrawParent(OC_FORM, dlgwin, CHOICES_EDIT_MAX_FETCHERS_PER_HOST,
- 2, 1 );
- break;
-
- case CHOICES_INC_HISTORY_AGE:
- case CHOICES_DEC_HISTORY_AGE:
- if( index == CHOICES_INC_HISTORY_AGE )
- tmp_option_expire_url += 1;
- else
- tmp_option_expire_url -= 1;
-
- if( tmp_option_expire_url > 99 )
- tmp_option_expire_url = 0;
-
- snprintf( spare, 255, "%02d", tmp_option_expire_url );
- set_text( CHOICES_EDIT_HISTORY_AGE, spare, 2 );
- is_button = true;
- ObjcDrawParent(OC_FORM, dlgwin, CHOICES_EDIT_HISTORY_AGE,
- 3, 1 );
- break;
-
- case CHOICES_INC_GIF_DELAY:
- case CHOICES_DEC_GIF_DELAY:
- if( index == CHOICES_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( CHOICES_EDIT_MIN_GIF_DELAY, spare, 3 );
- is_button = true;
- ObjcDrawParent(OC_FORM, dlgwin, CHOICES_EDIT_MIN_GIF_DELAY, 3, 1 );
- break;
-
- case CHOICES_INC_MIN_FONT_SIZE:
- case CHOICES_DEC_MIN_FONT_SIZE:
- if( index == CHOICES_INC_MIN_FONT_SIZE )
- tmp_option_font_min_size += 1;
- else
- tmp_option_font_min_size -= 1;
-
- if( tmp_option_font_min_size > 500 )
- tmp_option_font_min_size = 500;
- if( tmp_option_font_min_size < 10 )
- tmp_option_font_min_size = 10;
-
- snprintf( spare, 255, "%03d", tmp_option_font_min_size );
- set_text( CHOICES_EDIT_MIN_FONT_SIZE, spare, 3 );
- is_button = true;
- ObjcDrawParent(OC_FORM, dlgwin, CHOICES_EDIT_MIN_FONT_SIZE,
- 3, 1 );
- break;
-
- case CHOICES_INC_DEF_FONT_SIZE:
- case CHOICES_DEC_DEF_FONT_SIZE:
- if( index == CHOICES_INC_DEF_FONT_SIZE )
- tmp_option_font_size += 1;
- else
- tmp_option_font_size -= 1;
-
- if( tmp_option_font_size > 999 )
- tmp_option_font_size = 999;
- if( tmp_option_font_size < 50 )
- tmp_option_font_size = 50;
-
- snprintf( spare, 255, "%03d", tmp_option_font_size );
- set_text( CHOICES_EDIT_DEF_FONT_SIZE, spare, 3 );
- is_button = true;
- ObjcDrawParent(OC_FORM, dlgwin, CHOICES_EDIT_DEF_FONT_SIZE,
- 3, 1 );
-
- break;
-
- case CHOICES_INC_INCREMENTAL_REFLOW:
- case CHOICES_DEC_INCREMENTAL_REFLOW:
- if( index == CHOICES_INC_INCREMENTAL_REFLOW )
- tmp_option_min_reflow_period += 1;
- else
- tmp_option_min_reflow_period -= 1;
-
- if( tmp_option_min_reflow_period > 9999 )
- tmp_option_min_reflow_period = 10;
-
- snprintf( spare, 255, "%04d", tmp_option_min_reflow_period );
- set_text( CHOICES_EDIT_MIN_REFLOW_PERIOD, spare, 4 );
- is_button = true;
- ObjcDrawParent(OC_FORM, dlgwin, CHOICES_EDIT_MIN_REFLOW_PERIOD,
- 3, 1 );
- break;
-
- default: break;
- }
- if( is_button ){
- // remove selection indicator from button element:
- OBJ_UNCHECK( index );
- ObjcDraw( OC_FORM, dlgwin, index, 1 );
- }
-}
-
-/**
- * Toogle all objects which are directly influenced by other GUI elements
- * ( like checkbox )
- */
-static void toggle_objects( void )
-{
- /* enable / disable (refresh) objects depending on radio button values: */
- FORMEVENT(CHOICES_CB_USE_PROXY);
- FORMEVENT(CHOICES_CB_PROXY_AUTH);
- FORMEVENT(CHOICES_BT_SEL_FONT_RENDERER);
-}
-
-
-/* this gets called each time the settings dialog is opened: */
-static void display_settings( void )
-{
- char spare[255];
- // read current settings and display them
-
- /* "Browser" tab: */
- set_text( CHOICES_EDIT_HOMEPAGE, nsoption_charp(homepage_url),
- INPUT_HOMEPAGE_URL_MAX_LEN );
-
- if( nsoption_bool(block_ads) ){
- OBJ_CHECK( CHOICES_CB_HIDE_ADVERTISEMENT );
- } else {
- OBJ_UNCHECK( CHOICES_CB_HIDE_ADVERTISEMENT );
- }
- if( nsoption_bool(target_blank) ){
- OBJ_UNCHECK( CHOICES_CB_DISABLE_POPUP_WINDOWS );
- } else {
- OBJ_CHECK( CHOICES_CB_DISABLE_POPUP_WINDOWS );
- }
- if( nsoption_bool(send_referer) ){
- OBJ_CHECK( CHOICES_CB_SEND_HTTP_REFERRER );
- } else {
- OBJ_UNCHECK( CHOICES_CB_SEND_HTTP_REFERRER );
- }
- if( nsoption_bool(do_not_track) ){
- OBJ_CHECK( CHOICES_CB_SEND_DO_NOT_TRACK );
- } else {
- OBJ_UNCHECK( CHOICES_CB_SEND_DO_NOT_TRACK );
- }
-
- set_text( CHOICES_BT_SEL_LOCALE,
- nsoption_charp(accept_language) ? nsoption_charp(accept_language) : (char*)"en",
- INPUT_LOCALE_MAX_LEN );
-
- tmp_option_expire_url = nsoption_int(expire_url);
- snprintf( spare, 255, "%02d", nsoption_int(expire_url) );
- set_text( CHOICES_EDIT_HISTORY_AGE, spare, 2 );
-
- /* "Cache" tab: */
- tmp_option_memory_cache_size = nsoption_int(memory_cache_size) / 100000;
- snprintf( spare, 255, "%03.1f", tmp_option_memory_cache_size );
- set_text( CHOICES_STR_MAX_MEM_CACHE, spare, 5 );
-
- /* "Paths" tab: */
- set_text( CHOICES_EDIT_DOWNLOAD_PATH, nsoption_charp(downloads_path),
- LABEL_PATH_MAX_LEN );
- set_text( CHOICES_EDIT_HOTLIST_FILE, nsoption_charp(hotlist_file),
- LABEL_PATH_MAX_LEN );
- set_text( CHOICES_EDIT_CA_BUNDLE, nsoption_charp(ca_bundle),
- LABEL_PATH_MAX_LEN );
- set_text( CHOICES_EDIT_CA_CERTS_PATH, nsoption_charp(ca_path),
- LABEL_PATH_MAX_LEN );
- set_text( CHOICES_EDIT_EDITOR, nsoption_charp(atari_editor),
- LABEL_PATH_MAX_LEN );
-
- /* "Rendering" tab: */
- set_text( CHOICES_BT_SEL_FONT_RENDERER, nsoption_charp(atari_font_driver),
- LABEL_FONT_RENDERER_MAX_LEN );
- SET_BIT(dlgtree[CHOICES_CB_TRANSPARENCY].ob_state,
- SELECTED, nsoption_int(atari_transparency) ? 1 : 0 );
- SET_BIT(dlgtree[CHOICES_CB_ENABLE_ANIMATION].ob_state,
- SELECTED, nsoption_bool(animate_images) ? 1 : 0 );
- SET_BIT(dlgtree[CHOICES_CB_INCREMENTAL_REFLOW].ob_state,
- SELECTED, nsoption_bool(incremental_reflow) ? 1 : 0 );
- SET_BIT(dlgtree[CHOICES_CB_ANTI_ALIASING].ob_state,
- SELECTED, nsoption_int(atari_font_monochrom) ? 0 : 1 );
-
- tmp_option_min_reflow_period = nsoption_int(min_reflow_period);
- snprintf( spare, 255, "%04d", tmp_option_min_reflow_period );
- set_text( CHOICES_EDIT_MIN_REFLOW_PERIOD, spare,
- 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( CHOICES_EDIT_MIN_GIF_DELAY, spare, 3 );
-
- /* "Network" tab: */
- set_text( CHOICES_EDIT_PROXY_HOST, nsoption_charp(http_proxy_host),
- INPUT_PROXY_HOST_MAX_LEN );
- snprintf( spare, 255, "%5d", nsoption_int(http_proxy_port) );
- set_text( CHOICES_EDIT_PROXY_PORT, spare,
- INPUT_PROXY_PORT_MAX_LEN );
-
- set_text( CHOICES_EDIT_PROXY_USERNAME, nsoption_charp(http_proxy_auth_user),
- INPUT_PROXY_USERNAME_MAX_LEN );
- set_text( CHOICES_EDIT_PROXY_PASSWORD, nsoption_charp(http_proxy_auth_pass),
- INPUT_PROXY_PASSWORD_MAX_LEN );
- SET_BIT(dlgtree[CHOICES_CB_USE_PROXY].ob_state,
- SELECTED, nsoption_bool(http_proxy) ? 1 : 0 );
- SET_BIT(dlgtree[CHOICES_CB_PROXY_AUTH].ob_state,
- SELECTED, nsoption_int(http_proxy_auth) ? 1 : 0 );
- SET_BIT(dlgtree[CHOICES_CB_FG_IMAGES].ob_state,
- SELECTED, nsoption_bool(foreground_images) ? 1 : 0 );
- SET_BIT(dlgtree[CHOICES_CB_BG_IMAGES].ob_state,
- SELECTED, nsoption_bool(background_images) ? 1 : 0 );
-
- tmp_option_max_cached_fetch_handles = nsoption_int(max_cached_fetch_handles);
- snprintf( spare, 255, "%2d", nsoption_int(max_cached_fetch_handles) );
- set_text( CHOICES_EDIT_MAX_CACHED_CONNECTIONS, spare , 2 );
-
- tmp_option_max_fetchers = nsoption_int(max_fetchers);
- snprintf( spare, 255, "%2d", nsoption_int(max_fetchers) );
- set_text( CHOICES_EDIT_MAX_FETCHERS, spare , 2 );
-
- tmp_option_max_fetchers_per_host = nsoption_int(max_fetchers_per_host);
- snprintf( spare, 255, "%2d", nsoption_int(max_fetchers_per_host) );
- set_text( CHOICES_EDIT_MAX_FETCHERS_PER_HOST, spare , 2 );
-
-
- /* "Style" tab: */
- tmp_option_font_min_size = nsoption_int(font_min_size);
- snprintf( spare, 255, "%3d", nsoption_int(font_min_size) );
- set_text( CHOICES_EDIT_MIN_FONT_SIZE, spare , 3 );
-
- tmp_option_font_size = nsoption_int(font_size);
- snprintf( spare, 255, "%3d", nsoption_int(font_size) );
- set_text( CHOICES_EDIT_DEF_FONT_SIZE, spare , 3 );
-
- set_text(CHOICES_BT_TOOLBAR_ICONSET,
- nsoption_charp(atari_image_toolbar_folder), LABEL_ICONSET_MAX_LEN);
-
- tmp_option_atari_toolbar_bg = nsoption_int(atari_toolbar_bg);
- snprintf( spare, 255, "%06x", tmp_option_atari_toolbar_bg);
- set_text(CHOICES_INPUT_TOOLBAR_BGCOLOR, spare,
- INPUT_TOOLBAR_COLOR_MAX_LEN );
-
- /* Only first tab is refreshed: */
- ObjcDraw( OC_FORM, dlgwin, CHOICES_TAB_BROWSER, 4 );
-
- // update elements (enable/disable) chained to form events:
- toggle_objects();
-}
-
-static void apply_settings( void )
-{
- /* "Network" tab: */
- nsoption_set_bool(http_proxy, OBJ_SELECTED(CHOICES_CB_USE_PROXY));
- if ( OBJ_SELECTED(CHOICES_CB_PROXY_AUTH) ) {
- nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_BASIC);
- } else {
- nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_NONE);
- }
- nsoption_set_charp(http_proxy_auth_pass,
- ObjcString( dlgtree, CHOICES_EDIT_PROXY_PASSWORD, NULL));
- nsoption_set_charp(http_proxy_auth_user,
- ObjcString( dlgtree, CHOICES_EDIT_PROXY_USERNAME, NULL)); - nsoption_set_charp(http_proxy_host,
- ObjcString( dlgtree, CHOICES_EDIT_PROXY_HOST, NULL));
- nsoption_set_int(http_proxy_port,
- atoi( ObjcString( dlgtree, CHOICES_EDIT_PROXY_PORT, NULL) ));
- nsoption_set_int(max_fetchers_per_host,
- atoi( ObjcString( dlgtree, CHOICES_EDIT_MAX_FETCHERS_PER_HOST, NULL)));
- nsoption_set_int(max_cached_fetch_handles,
- atoi( ObjcString( dlgtree, CHOICES_EDIT_MAX_CACHED_CONNECTIONS, NULL)));
- nsoption_set_int(max_fetchers,
- atoi( ObjcString( dlgtree, CHOICES_EDIT_MAX_FETCHERS, NULL) ));
- nsoption_set_bool(foreground_images,
- OBJ_SELECTED( CHOICES_CB_FG_IMAGES ));
- nsoption_set_bool(background_images,
- OBJ_SELECTED( CHOICES_CB_BG_IMAGES ));
-
- /* "Style" tab: */
- nsoption_set_int(font_min_size, tmp_option_font_min_size);
- nsoption_set_int(font_size, tmp_option_font_size);
- nsoption_set_colour(atari_toolbar_bg, tmp_option_atari_toolbar_bg);
- nsoption_set_charp(atari_image_toolbar_folder,
- ObjcString( dlgtree, CHOICES_BT_TOOLBAR_ICONSET, NULL)
- );
-
- /* "Rendering" tab: */
- nsoption_set_charp(atari_font_driver,
- ObjcString( dlgtree, CHOICES_BT_SEL_FONT_RENDERER, NULL));
- nsoption_set_bool(atari_transparency,
- OBJ_SELECTED(CHOICES_CB_TRANSPARENCY));
- nsoption_set_bool(animate_images,
- OBJ_SELECTED(CHOICES_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(CHOICES_CB_INCREMENTAL_REFLOW));
- nsoption_set_int(min_reflow_period, tmp_option_min_reflow_period);
- nsoption_set_int(atari_font_monochrom,
- !OBJ_SELECTED( CHOICES_CB_ANTI_ALIASING ));
-
- /* "Paths" tabs: */
- nsoption_set_charp(ca_bundle,
- ObjcString( dlgtree, CHOICES_EDIT_CA_BUNDLE, NULL));
- nsoption_set_charp(ca_path,
- ObjcString( dlgtree, CHOICES_EDIT_CA_CERTS_PATH, NULL));
- nsoption_set_charp(homepage_url,
- ObjcString( dlgtree, CHOICES_EDIT_CA_CERTS_PATH, NULL));
- nsoption_set_charp(hotlist_file,
- ObjcString( dlgtree, CHOICES_EDIT_HOTLIST_FILE, NULL));
- nsoption_set_charp(atari_editor,
- ObjcString( dlgtree, CHOICES_EDIT_EDITOR, NULL));
- nsoption_set_charp(downloads_path,
- ObjcString( dlgtree, CHOICES_EDIT_DOWNLOAD_PATH, NULL));
-
- /* "Cache" tab: */
- nsoption_set_int(memory_cache_size,
- tmp_option_memory_cache_size * 100000);
-
- /* "Browser" tab: */
- nsoption_set_bool(target_blank,
- !OBJ_SELECTED(CHOICES_CB_DISABLE_POPUP_WINDOWS));
- nsoption_set_bool(block_ads,
- OBJ_SELECTED(CHOICES_CB_HIDE_ADVERTISEMENT));
- nsoption_set_charp(accept_language,
- ObjcString( dlgtree, CHOICES_BT_SEL_LOCALE, NULL));
- nsoption_set_int(expire_url,
- atoi(ObjcString( dlgtree, CHOICES_EDIT_HISTORY_AGE, NULL)));
- nsoption_set_bool(send_referer,
- OBJ_SELECTED(CHOICES_CB_SEND_HTTP_REFERRER));
- nsoption_set_bool(do_not_track,
- OBJ_SELECTED(CHOICES_CB_SEND_HTTP_REFERRER));
- nsoption_set_charp(homepage_url,
- ObjcString( dlgtree, CHOICES_EDIT_HOMEPAGE, NULL));
-}
-
-#undef OBJ_SELECTED
-#undef OBJ_CHECK
-#undef OBJ_UNCHECK
-#undef DISABLE_OBJ
-#undef ENABLE_OBJ
-#undef FORMEVENT
-
diff --git a/atari/settings.h b/atari/settings.h index 97b194111..87597e6a0 100644 --- a/atari/settings.h +++ b/atari/settings.h @@ -1,9 +1,8 @@ #ifndef NS_ATARI_SETTINGS #define NS_ATARI_SETTINGS -#include <windom.h> -WINDOW * open_settings(void); +void open_settings(void); void close_settings(void); #endif diff --git a/atari/statusbar.c b/atari/statusbar.c index 08a62c55d..9f26d7bca 100755 --- a/atari/statusbar.c +++ b/atari/statusbar.c @@ -24,7 +24,6 @@ #include <string.h>
#include <stdlib.h>
#include <stdbool.h>
-#include <windom.h>
#include <assert.h>
#include <math.h>
@@ -38,9 +37,9 @@ #include "atari/gui.h"
#include "atari/statusbar.h"
-#include "atari/browser_win.h"
+#include "atari/rootwin.h" #include "atari/misc.h"
-#include "atari/global_evnt.h"
+
#include "atari/res/netsurf.rsh"
#include "atari/plot/plot.h"
#include "atari/osspec.h"
@@ -182,7 +181,7 @@ void sb_destroy( CMP_STATUSBAR s ) }
}
-void sb_set_text( CMP_STATUSBAR sb , char * text )
+void sb_set_text(CMP_STATUSBAR sb , const char * text)
{ LGRECT work;
@@ -221,13 +220,12 @@ void sb_destroy( CMP_STATUSBAR s ) void sb_attach(CMP_STATUSBAR sb, struct gui_window * gw) { - sb->aes_win = gw->root->handle->handle; + sb->aes_win = gemtk_wm_get_handle(gw->root->win); sb->attached = true; }
-void sb_set_text(CMP_STATUSBAR sb, char * text )
+void sb_set_text(CMP_STATUSBAR sb, const char * text )
{
- LGRECT work;
assert( sb != NULL );
strncpy(sb->text, text, STATUSBAR_MAX_SLEN);
sb->text[STATUSBAR_MAX_SLEN]=0;
diff --git a/atari/statusbar.h b/atari/statusbar.h index fc6749e91..7739c6fed 100755 --- a/atari/statusbar.h +++ b/atari/statusbar.h @@ -36,6 +36,6 @@ struct s_statusbar CMP_STATUSBAR sb_create( struct gui_window * gw );
void sb_destroy( CMP_STATUSBAR s );
-void sb_set_text( CMP_STATUSBAR sb , char * text ); +void sb_set_text( CMP_STATUSBAR sb , const char * text ); void sb_attach(CMP_STATUSBAR sb, struct gui_window * gw);
#endif
diff --git a/atari/toolbar.c b/atari/toolbar.c index cf68194d6..0f032b2aa 100755..100644 --- a/atari/toolbar.c +++ b/atari/toolbar.c @@ -1,5 +1,5 @@ /*
- * Copyright 2010 Ole Loots <ole@monochrom.net>
+ * Copyright 2012 Ole Loots <ole@monochrom.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -24,7 +24,6 @@ #include <string.h>
#include <stdlib.h>
#include <stdbool.h>
-#include <windom.h>
#include <assert.h>
#include <math.h>
@@ -43,14 +42,48 @@ #include "atari/clipboard.h"
#include "atari/gui.h"
#include "atari/toolbar.h"
-#include "atari/browser_win.h"
-#include "atari/browser.h"
+#include "atari/rootwin.h"
+
#include "atari/clipboard.h"
#include "atari/misc.h"
-#include "atari/global_evnt.h"
#include "atari/plot/plot.h"
#include "cflib.h"
-#include "atari/res/netsurf.rsh"
+#include "atari/res/netsurf.rsh" + +#include "desktop/textarea.h" +#include "desktop/textinput.h" +#include "content/hlcache.h" + +
+#define TB_BUTTON_WIDTH 32
+#define THROBBER_WIDTH 32
+#define THROBBER_MIN_INDEX 1
+#define THROBBER_MAX_INDEX 12
+#define THROBBER_INACTIVE_INDEX 13
+ +#define TOOLBAR_URL_MARGIN_LEFT 2
+#define TOOLBAR_URL_MARGIN_RIGHT 2 +#define TOOLBAR_URL_MARGIN_TOP 2 +#define TOOLBAR_URL_MARGIN_BOTTOM 2 +
+enum e_toolbar_button_states {
+ button_on = 0,
+ button_off = 1
+};
+#define TOOLBAR_BUTTON_NUM_STATES 2
+ +struct s_toolbar; +
+struct s_tb_button
+{
+ short rsc_id;
+ void (*cb_click)(struct s_toolbar *tb); + hlcache_handle *icon[TOOLBAR_BUTTON_NUM_STATES]; + struct s_toolbar *owner; + enum e_toolbar_button_states state;
+ short index; + GRECT area;
+};
extern char * option_homepage_url;
@@ -58,17 +91,14 @@ extern void * h_gem_rsrc; extern struct gui_window * input_window; extern long atari_plot_flags; extern int atari_plot_vdi_handle; +extern EVMULT_OUT aes_event_out; -static OBJECT * toolbar_buttons = NULL; +static OBJECT * aes_toolbar = NULL; static OBJECT * throbber_form = NULL; -static bool img_toolbar = false;
-static char * toolbar_image_folder = (char *)"default";
-static uint32_t toolbar_bg_color = 0xFFFFFF; -static hlcache_handle * toolbar_image; -static hlcache_handle * throbber_image; -static bool toolbar_image_ready = false; -static bool throbber_image_ready = false; -
+static bool init = false; +static int area_navigation_height = 0; +static int area_search_height = 0; +static int area_full_height = 0; static plot_font_style_t font_style_url = {
.family = PLOT_FONT_FAMILY_SANS_SERIF,
@@ -77,454 +107,171 @@ static plot_font_style_t font_style_url = { .flags = FONTF_NONE,
.background = 0xffffff,
.foreground = 0x0
- }; + };
+ /* prototypes & order for button widgets: */ + static struct s_tb_button tb_buttons[] =
{
{
TOOLBAR_BT_BACK,
- tb_back_click,
- 0,
+ toolbar_back_click,
{0,0},
- 0, 0, 0
+ 0, 0, 0, {0,0,0,0}
},
{
TOOLBAR_BT_HOME,
- tb_home_click,
- 0, {0,0}, 0, 0, 0
+ toolbar_home_click,
+ {0,0}, + 0, 0, 0, {0,0,0,0}
},
{
TOOLBAR_BT_FORWARD,
- tb_forward_click,
- 0,
- {0,0},
- 0, 0, 0
+ toolbar_forward_click,
+ {0,0}, + 0, 0, 0, {0,0,0,0}
},
{
TOOLBAR_BT_STOP,
- tb_stop_click,
- 0,
- {0,0},
- 0, 0, 0
+ toolbar_stop_click,
+ {0,0}, + 0, 0, 0, {0,0,0,0}
},
{
TOOLBAR_BT_RELOAD,
- tb_reload_click,
- 0,
- {0,0},
- 0, 0, 0
+ toolbar_reload_click,
+ {0,0}, + 0, 0, 0, {0,0,0,0}
},
- { 0, 0, 0, {0,0}, 0, 0, -1 }
+ { 0, 0, {0,0}, 0, -1, 0, {0,0,0,0}}
}; +// TODO: most of this struct can be deleted struct s_toolbar_style { int font_height_pt; - int height; - int icon_width; - int icon_height; - int button_hmargin; - int button_vmargin; - /* RRGGBBAA: */ - uint32_t icon_bgcolor; }; static struct s_toolbar_style toolbar_styles[] = { /* small (18 px height) */ - { 9, 18, 16, 16, 0, 0, 0 }, + {9}, /* medium (default - 26 px height) */ - {14, 26, 24, 24, 1, 4, 0 }, + {14}, /* large ( 49 px height ) */ - {18, 34, 64, 64, 2, 0, 0 }, + {18}, /* custom style: */ - {18, 34, 64, 64, 2, 0, 0 } -};
+ {18} +}; + +static const struct redraw_context toolbar_rdrw_ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &atari_plotters
+ };
-static void tb_txt_request_redraw( void *data, int x, int y, int w, int h ); +static void tb_txt_request_redraw(void *data, int x, int y, int w, int h ); static nserror toolbar_icon_callback( hlcache_handle *handle, const hlcache_event *event, void *pw ); +/** +* Find a button for a specific resource ID +*/ +static struct s_tb_button *find_button(struct s_toolbar *tb, int rsc_id)
+{
+ int i = 0;
+ while (i < tb->btcnt) {
+ if (tb->buttons[i].rsc_id == rsc_id) {
+ return(&tb->buttons[i]);
+ }
+ i++;
+ } + return(NULL);
+} -void toolbar_init( void ) +/** +* Callback for textarea redraw +*/ +static void tb_txt_request_redraw(void *data, int x, int y, int w, int h)
{ - int i=0, n; - short vdicolor[3]; - uint32_t rgbcolor; - - toolbar_image_folder = nsoption_charp(atari_image_toolbar_folder); - toolbar_bg_color = (nsoption_colour(atari_toolbar_bg)); - img_toolbar = (nsoption_int( atari_image_toolbar ) > 0 ) ? true : false; - if( img_toolbar ){ -
- char imgfile[PATH_MAX]; - const char * imgfiletmpl = "toolbar/%s/%s";
- while( tb_buttons[i].rsc_id != 0){ - tb_buttons[i].index = i; - i++; - } - snprintf( imgfile, PATH_MAX-1, imgfiletmpl, toolbar_image_folder, - "main.png" ); - toolbar_image = load_icon( imgfile, - toolbar_icon_callback, NULL ); - snprintf( imgfile, PATH_MAX-1, imgfiletmpl, toolbar_image_folder, - "throbber.png" ); - throbber_image = load_icon( imgfile, - toolbar_icon_callback, NULL ); - - } else { - RsrcGaddr( h_gem_rsrc, R_TREE, TOOLBAR, &toolbar_buttons ); - toolbar_buttons->ob_x = 0;
- toolbar_buttons->ob_y = 0; -
- RsrcGaddr( h_gem_rsrc, R_TREE, THROBBER , &throbber_form );
- throbber_form->ob_x = 0;
- throbber_form->ob_y = 0; - }
- n = (sizeof( toolbar_styles ) / sizeof( struct s_toolbar_style ));
- for (i=0; i<n; i++) { - toolbar_styles[i].icon_bgcolor = ABGR_TO_RGB(toolbar_bg_color);
+ GRECT area; + struct s_toolbar * tb = (struct s_toolbar *)data; + + if (tb->attached == false) { + return; } -} -void toolbar_exit( void ) -{ - if( toolbar_image ) - hlcache_handle_release( toolbar_image ); - if( throbber_image ) - hlcache_handle_release( throbber_image ); + toolbar_get_grect(tb, TOOLBAR_AREA_URL, &area); + area.g_x += x; + area.g_y += y; + area.g_w = w; + area.g_h = h; + //dbg_grect("tb_txt_request_redraw", &area); + window_schedule_redraw_grect(tb->owner, &area); + return;
} -/** - * Callback for load_icon(). Should be removed once bitmaps get loaded directly - * from disc - */ -static nserror toolbar_icon_callback(hlcache_handle *handle, - const hlcache_event *event, void *pw) +static struct s_tb_button *button_init(struct s_toolbar *tb, OBJECT * tree, int index, + struct s_tb_button * instance)
{ - if( event->type == CONTENT_MSG_READY ){ - if( handle == toolbar_image ){ - toolbar_image_ready = true; - if( input_window != NULL ) - tb_update_buttons( input_window, 0 ); - } - else if( handle == throbber_image ){ - throbber_image_ready = true; - } - } + *instance = tb_buttons[index]; + instance->owner = tb; - return NSERROR_OK; + return(instance);
} -
-
-static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
-{ - - OBJECT *tree=NULL;
- LGRECT work,clip;
- GRECT todo,crect; - struct s_tb_button *bt = (struct s_tb_button*)data; - struct gui_window * gw = bt->gw; - struct s_toolbar * tb = gw->root->toolbar; - short pxy[4]; - int bmpx=0, bmpy=0, bmpw=0, bmph = 0, drawstate=0; - struct bitmap * icon = NULL; - struct rect icon_clip; - GRECT icon_dim = {0,0,0,0}; - plot_style_t plot_style_background = { - .fill_type = PLOT_OP_TYPE_SOLID, - .fill_colour = toolbar_bg_color, - .stroke_type = PLOT_OP_TYPE_NONE - }; +static short __CDECL toolbar_url_userdraw(PARMBLK *parmblock) +{ + return(0); +} - mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work); - work.g_h = work.g_h - 1;
- clip = work; -
- /* return if component and redraw region does not intersect: */
- if (!rc_lintersect( (LGRECT*)&buff[4], &clip)) {
- return;
- } +void toolbar_init( void ) +{ + static USERBLK userblk; - drawstate = bt->state; - if( img_toolbar ){ + aes_toolbar = gemtk_obj_get_tree(TOOLBAR); + throbber_form = gemtk_obj_get_tree(THROBBER); - if( toolbar_image_ready == false ){ - return; - } + userblk.ub_code = toolbar_url_userdraw; + userblk.ub_parm = (long) aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk; + aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk = &userblk; - icon = content_get_bitmap( toolbar_image ); - if( icon == NULL ){ - return;
- } + aes_toolbar[TOOLBAR_CB_SHOWALL].ob_state &= ~OS_SELECTED; + aes_toolbar[TOOLBAR_CB_CASESENSE].ob_state &= ~OS_SELECTED; - bmpw = bitmap_get_width(icon); - bmph = bitmap_get_height(icon); - bmpx = 0; - bmpy = 0; - icon_clip.x0 = bmpx+(toolbar_styles[tb->style].icon_width*bt->index); - icon_clip.y0 = bmpy+(toolbar_styles[tb->style].icon_height*drawstate); - icon_clip.x1 = icon_clip.x0+toolbar_styles[tb->style].icon_width; - icon_clip.y1 = icon_clip.y0+toolbar_styles[tb->style].icon_height; - icon_dim.g_x = work.g_x-(toolbar_styles[tb->style].icon_width * bt->index)+toolbar_styles[tb->style].button_vmargin; - icon_dim.g_y = work.g_y-(toolbar_styles[tb->style].icon_height * drawstate)+toolbar_styles[tb->style].button_hmargin; - icon_dim.g_w = toolbar_styles[tb->style].icon_width*(bt->index+1); - icon_dim.g_h = toolbar_styles[tb->style].icon_height*(drawstate+1); - } else { - /* Place the CICON into workarea: */ - tree = &toolbar_buttons[bt->rsc_id]; - if( tree == NULL ) - return; - tree->ob_x = work.g_x;
- tree->ob_y = work.g_y + (work.g_h - tree->ob_height) / 2; - if( drawstate == button_off ) {
- tree->ob_state |= OS_DISABLED;
- } else {
- tree->ob_state &= ~OS_DISABLED;
- } - } + /* init default values: */ + gemtk_obj_set_str_safe(aes_toolbar, TOOLBAR_TB_SRCH, (char*)""); - /* Setup draw mode: */
- vsf_interior(atari_plot_vdi_handle , 1 );
- vswr_mode(atari_plot_vdi_handle, MD_REPLACE); - - /* go through the rectangle list, using classic AES methods. */
- /* Windom ComGetLGrect is buggy for WF_FIRST/NEXTXYWH */
- crect.g_x = clip.g_x;
- crect.g_y = clip.g_y;
- crect.g_w = clip.g_w;
- crect.g_h = clip.g_h;
- wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
- &todo.g_x, &todo.g_y, &todo.g_w, &todo.g_h );
- while( (todo.g_w > 0) && (todo.g_h > 0) ){
-
- if (rc_intersect(&crect, &todo )) { - - struct rect bgclip = {0,0,todo.g_w, todo.g_h}; - pxy[0] = todo.g_x;
- pxy[1] = todo.g_y;
- pxy[2] = todo.g_w + todo.g_x-1;
- pxy[3] = todo.g_h + todo.g_y-1;
- - vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy ); - plot_set_dimensions(todo.g_x, todo.g_y, todo.g_w, todo.g_h); - plot_rectangle(0, 0, crect.g_w, crect.g_h, &plot_style_background); - - if( img_toolbar == true ){ - plot_set_dimensions(icon_dim.g_x, icon_dim.g_y, - icon_dim.g_w, icon_dim.g_h); - plot_clip( &icon_clip ); - atari_plotters.bitmap( bmpx, bmpy, bmpw, bmph, icon, - toolbar_styles[tb->style].icon_bgcolor, - BITMAPF_BUFFER_NATIVE ); - } else { - objc_draw( tree, 0, 0, todo.g_x, todo.g_y, todo.g_w, todo.g_h ); - } - vs_clip(atari_plot_vdi_handle, 0, (short*)&clip );
- }
- wind_get(gw->root->handle->handle, WF_NEXTXYWH,
- &todo.g_x, &todo.g_y, &todo.g_w, &todo.g_h );
- }
-}
+ area_full_height = aes_toolbar->ob_height; + area_search_height = aes_toolbar[TOOLBAR_AREA_SEARCH].ob_height; + area_navigation_height = aes_toolbar[TOOLBAR_AREA_NAVIGATION].ob_height; + init = true;
+} -static void __CDECL button_click( COMPONENT *c, long buff[8], void * data )
-{ - struct s_tb_button * bt = (struct s_tb_button *)data;
- int i = 0;
- struct gui_window * gw = bt->gw;
- assert( gw );
- gw->root->toolbar->buttons[bt->index].cb_click( gw );
-}
-
-static struct s_tb_button * find_button( struct gui_window * gw, int rsc_id )
-{
- int i = 0;
- while( i < gw->root->toolbar->btcnt ) {
- if( gw->root->toolbar->buttons[i].rsc_id == rsc_id ) {
- return( &gw->root->toolbar->buttons[i] );
- }
- i++;
- }
-}
-
-
-static COMPONENT *button_init( CMP_TOOLBAR t, OBJECT * tree, int index, - struct s_tb_button * instance )
+void toolbar_exit(void) { - int comp_width; - - *instance = tb_buttons[index]; - instance->gw = t->owner; - comp_width = toolbar_styles[t->style].icon_width + \ - ( toolbar_styles[t->style].button_vmargin * 2 ); +} - instance->comp = mt_CompCreate( &app, CLT_VERTICAL, comp_width, 0 ); - assert( instance->comp ); - instance->comp->bounds.max_width = comp_width; - mt_CompEvntDataAttach( &app, instance->comp, WM_REDRAW, button_redraw, - instance );
- mt_CompEvntDataAttach( &app, instance->comp, WM_XBUTTON, button_click, - instance );
- return instance->comp;
-}
-
-
-static
-void __CDECL evnt_throbber_redraw( COMPONENT *c, long buff[8])
+struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
{
- LGRECT work, clip;
- int idx;
- short pxy[4]; - struct s_toolbar * tb; - struct gui_window * gw = (struct gui_window *)mt_CompDataSearch(&app, - c, - CDT_OWNER ); - plot_style_t plot_style_background = { - .fill_type = PLOT_OP_TYPE_SOLID, - .fill_colour = toolbar_bg_color, - .stroke_type = PLOT_OP_TYPE_NONE - }; - - tb = gw->root->toolbar;
- mt_CompGetLGrect(&app, c, WF_WORKXYWH, &work);
- clip = work;
- if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
-
- vsf_interior(atari_plot_vdi_handle , 1 );
- pxy[0] = (short)buff[4];
- pxy[1] = (short)buff[5];
- pxy[2] = (short)buff[4] + buff[6]-1;
- pxy[3] = (short)buff[5] + buff[7]-2; - vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy ); - - if (app.nplanes > 2 ) { - plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h); - plot_rectangle( 0, 0, work.g_w, work.g_h, &plot_style_background); - }
- else { - vsf_color(atari_plot_vdi_handle, WHITE );
- v_bar(atari_plot_vdi_handle, (short*)&pxy ); - }
- - if( img_toolbar ){ + int i; + GRECT url_area; + struct s_toolbar *t; - int bmpx=0, bmpy=0, bmpw=0, bmph = 0, drawstate=0; - struct rect icon_clip; - struct bitmap * icon = NULL; + LOG(("")); - if( throbber_image_ready == false ){ - return; - } - icon = content_get_bitmap( throbber_image ); - if( icon == NULL ){ - return;
- } - - if( tb->throbber.running == false ) {
- idx = 0;
- } - else {
- idx = tb->throbber.index;
- if( idx > tb->throbber.max_index ) {
- idx = tb->throbber.index = 1;
- }
- } - bmpw = bitmap_get_width(icon); - bmph = bitmap_get_height(icon); - bmpx = 0; - bmpy = 0; - - /* - for some reason, adding - toolbar_styles[tb->style].button_vmargin to the x pos of - the plotter shifts the icon a bit to much. - Maybe that's becasue the icon is inside an padded form. - */ - plot_set_dimensions( - work.g_x-(toolbar_styles[tb->style].icon_width * idx), - work.g_y+toolbar_styles[tb->style].button_hmargin, - toolbar_styles[tb->style].icon_width*(idx+1), - toolbar_styles[tb->style].icon_height - ); - icon_clip.x0 = bmpx+(toolbar_styles[tb->style].icon_width*idx); - icon_clip.y0 = bmpy; - icon_clip.x1 = icon_clip.x0+toolbar_styles[tb->style].icon_width; - icon_clip.y1 = icon_clip.y0+toolbar_styles[tb->style].icon_height; - plot_clip( &icon_clip ); - atari_plotters.bitmap( bmpx, bmpy, bmpw, bmph, icon, - toolbar_styles[tb->style].icon_bgcolor, - BITMAPF_BUFFER_NATIVE ); - } - else { - if( throbber_form != NULL ) { - if( gw->root->toolbar->throbber.running == false ) {
- idx = THROBBER_INACTIVE_INDEX;
- } else {
- idx = gw->root->toolbar->throbber.index;
- if( idx > THROBBER_MAX_INDEX || idx < THROBBER_MIN_INDEX ) {
- idx = THROBBER_MIN_INDEX;
- }
- }
- throbber_form[idx].ob_x = work.g_x+1;
- throbber_form[idx].ob_y = work.g_y+4;
- mt_objc_draw( throbber_form, idx, 8, clip.g_x, clip.g_y, clip.g_w, clip.g_h, app.aes_global );
- } - }
-
-}
-
-static
-void __CDECL evnt_url_redraw( COMPONENT *c, long buff[8], void * data)
-{
- LGRECT work, clip;
- struct gui_window * gw;
- short pxy[10]; - plot_style_t plot_style_background = { - .fill_type = PLOT_OP_TYPE_SOLID, - .fill_colour = toolbar_bg_color, - .stroke_type = PLOT_OP_TYPE_NONE - };
-
- CMP_TOOLBAR tb = (CMP_TOOLBAR)data;
- mt_CompGetLGrect(&app, tb->url.comp, WF_WORKXYWH, &work);
-
- // this last pixel is drawn by the root component of the toolbar:
- // it's the black border, so we leave it out:
- work.g_h--;
- clip = work;
- if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
- - plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h); - - //left margin: - plot_rectangle(0, 0, TOOLBAR_URL_MARGIN_LEFT, work.g_h, - &plot_style_background); - // right margin: - plot_rectangle(work.g_w-TOOLBAR_URL_MARGIN_RIGHT, 0, work.g_w, work.g_h, - &plot_style_background); - - // top margin: - plot_rectangle(0, 0, work.g_w, TOOLBAR_URL_MARGIN_TOP, - &plot_style_background); - - // bottom margin: - plot_rectangle(0, work.g_h-TOOLBAR_URL_MARGIN_BOTTOM, work.g_w, work.g_h, - &plot_style_background); -
- // TBD: request redraw of textarea for specific region.
- clip.g_x -= work.g_x+TOOLBAR_URL_MARGIN_LEFT;
- clip.g_y -= work.g_y+TOOLBAR_URL_MARGIN_TOP;
- tb_txt_request_redraw( tb, clip.g_x, clip.g_y, clip.g_w, clip.g_h );
-}
+ assert(init == true);
+<<<<<<< HEAD + t = calloc(sizeof(struct s_toolbar), 1);
+======= static
void __CDECL evnt_url_click( COMPONENT *c, long buff[8] )
{
@@ -584,8 +331,21 @@ void __CDECL evnt_url_click( COMPONENT *c, long buff[8] ) ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
work.g_x, work.g_y, work.g_w, work.g_h );
}
+>>>>>>> master + + assert(t);
+<<<<<<< HEAD + /* initialize the toolbar values: */
+ t->owner = owner; + t->style = 1; + t->search_visible = false; + t->visible = true; + t->reflow = true; + /* dublicate the form template: */ + t->form = gemtk_obj_tree_copy(aes_toolbar); +======= void tb_adjust_size( struct gui_window * gw )
{
LGRECT work;
@@ -761,32 +521,31 @@ CMP_TOOLBAR tb_create( struct gui_window * gw ) t->owner = gw; t->style = 1;
+>>>>>>> master - /* create the root component: */
- t->comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL, - toolbar_styles[t->style].height, 0 );
- t->comp->rect.g_h = toolbar_styles[t->style].height;
- t->comp->bounds.max_height = toolbar_styles[t->style].height;
- mt_CompEvntDataAdd(&app, t->comp, WM_REDRAW, evnt_toolbar_redraw, - gw, EV_BOT);
/* count buttons and add them as components: */
i = 0;
- while( tb_buttons[i].rsc_id > 0 ) {
+ while(tb_buttons[i].rsc_id > 0) {
i++;
}
t->btcnt = i;
- t->buttons = malloc( t->btcnt * sizeof(struct s_tb_button) ); - memset( t->buttons, 0, t->btcnt * sizeof(struct s_tb_button) );
- for( i=0; i < t->btcnt; i++ ) {
- button_init( t, toolbar_buttons, i, &t->buttons[i] );
- mt_CompAttach( &app, t->comp, t->buttons[i].comp );
+ t->buttons = malloc(t->btcnt * sizeof(struct s_tb_button)); + memset(t->buttons, 0, t->btcnt * sizeof(struct s_tb_button));
+ for (i=0; i < t->btcnt; i++) {
+ button_init(t, aes_toolbar, i, &t->buttons[i]);
}
/* create the url widget: */ font_style_url.size = toolbar_styles[t->style].font_height_pt * FONT_SIZE_SCALE; +<<<<<<< HEAD + toolbar_get_grect(t, TOOLBAR_AREA_URL, &url_area); + url_area.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM);
+ t->url.textarea = textarea_create(300, url_area.g_h, 0, &font_style_url, + tb_txt_request_redraw, t);
+======= int ta_height = toolbar_styles[t->style].height; ta_height -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM);
textarea_setup ta_setup; @@ -815,192 +574,395 @@ CMP_TOOLBAR tb_create( struct gui_window * gw ) mt_CompEvntAttach( &app, t->url.comp, WM_XBUTTON, evnt_url_click );
mt_CompDataAttach( &app, t->url.comp, CDT_OWNER, gw );
mt_CompAttach( &app, t->comp, t->url.comp );
+>>>>>>> master /* create the throbber widget: */
- t->throbber.comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL, - toolbar_styles[t->style].height, 0);
- t->throbber.comp->rect.g_h = toolbar_styles[t->style].height;
- t->throbber.comp->rect.g_w = t->throbber.comp->bounds.max_width = \ - toolbar_styles[t->style].icon_width + \ - (2*toolbar_styles[t->style].button_vmargin );
- t->throbber.comp->bounds.max_height = toolbar_styles[t->style].height; - if( img_toolbar == true ){ - t->throbber.index = 0;
- t->throbber.max_index = 8; - } else { - t->throbber.index = THROBBER_MIN_INDEX;
- t->throbber.max_index = THROBBER_MAX_INDEX; - }
- t->throbber.running = false;
- mt_CompEvntAttach( &app, t->throbber.comp, WM_REDRAW, evnt_throbber_redraw );
- mt_CompDataAttach( &app, t->throbber.comp, CDT_OWNER, gw );
- mt_CompAttach( &app, t->comp, t->throbber.comp );
+ t->throbber.index = THROBBER_INACTIVE_INDEX;
+ t->throbber.max_index = THROBBER_MAX_INDEX;
+ t->throbber.running = false; + + LOG(("created toolbar: %p, root: %p, textarea: %p, throbber: %p", t, + owner, t->url.textarea, t->throbber));
return( t );
-}
-
-
-void tb_destroy( CMP_TOOLBAR tb )
+} + + +void toolbar_destroy(struct s_toolbar *tb) { - free( tb->buttons );
- textarea_destroy( tb->url.textarea );
- mt_CompDelete( &app, tb->comp);
- free( tb );
-}
-
-
-struct gui_window * tb_gui_window( CMP_TOOLBAR tb )
-{
- struct gui_window * gw;
- gw = window_list;
- while( gw != NULL ) {
- if( gw->root->toolbar == tb ) {
- LOG(("found tb gw: %p (tb: %p) for tb: %p", gw, gw->root->toolbar, tb ));
- return( gw );
- }
- else
- gw = gw->next;
- }
- return( NULL );
-}
-
-
-void tb_update_buttons( struct gui_window * gw, short button )
+ free(tb->buttons);
+ free(tb->form); + + textarea_destroy(tb->url.textarea);
+ + free(tb); +} + +static int toolbar_calculate_height(struct s_toolbar *tb) { -
-#define FIRST_BUTTON TOOLBAR_BT_BACK + int r = 0; + + if (tb->visible == false) { + return(0); + } + + r += area_navigation_height; + + if (tb->search_visible) { + r += area_search_height; + } + + return(r); +} + +static void toolbar_reflow(struct s_toolbar *tb) +{ + int i; + + // position toolbar areas: + tb->form->ob_x = tb->area.g_x; + tb->form->ob_y = tb->area.g_y; + tb->form->ob_width = tb->area.g_w; + tb->form->ob_height = toolbar_calculate_height(tb); + + // expand the "main" areas to the current width: + tb->form[TOOLBAR_AREA_NAVIGATION].ob_width = tb->area.g_w; + tb->form[TOOLBAR_AREA_SEARCH].ob_width = tb->area.g_w; + + if (tb->search_visible) { + tb->form[TOOLBAR_AREA_SEARCH].ob_state &= ~OF_HIDETREE; + } else { + tb->form[TOOLBAR_AREA_SEARCH].ob_state |= OF_HIDETREE; + + } + + // align the throbber area at right edge: + tb->form[TOOLBAR_THROBBER_AREA].ob_x = tb->area.g_w + - tb->form[TOOLBAR_THROBBER_AREA].ob_width; + + // align the search button: + tb->form[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_x = tb->area.g_w + - tb->form[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_width; + + // center the URL area: + tb->form[TOOLBAR_AREA_URL].ob_width = tb->area.g_w + - (tb->form[TOOLBAR_AREA_BUTTONS].ob_width + + tb->form[TOOLBAR_THROBBER_AREA].ob_width + 1); + + + // position throbber image: + throbber_form[tb->throbber.index].ob_x = tb->area.g_x + + tb->form[TOOLBAR_THROBBER_AREA].ob_x; + + throbber_form[tb->throbber.index].ob_x = tb->area.g_x + + tb->form[TOOLBAR_THROBBER_AREA].ob_x + + ((tb->form[TOOLBAR_THROBBER_AREA].ob_width + - throbber_form[tb->throbber.index].ob_width) >> 1); + + throbber_form[tb->throbber.index].ob_y = tb->area.g_y + + ((tb->form[TOOLBAR_THROBBER_AREA].ob_height + - throbber_form[tb->throbber.index].ob_height) >> 1); + + // set button states: + for (i=0; i < tb->btcnt; i++ ) { + if (tb->buttons[i].state == button_off) { + tb->form[tb->buttons[i].rsc_id].ob_state |= OS_DISABLED; + } + else if (tb->buttons[i].state == button_on) { + tb->form[tb->buttons[i].rsc_id].ob_state &= ~OS_DISABLED; + }
+ } + tb->reflow = false; + // TODO: iterate through all other toolbars and set reflow = true +} + +void toolbar_redraw(struct s_toolbar *tb, GRECT *clip) +{ + GRECT area, area_ro; + + if (tb->attached == false) { + return; + } + + if(tb->reflow == true) + toolbar_reflow(tb); + + //TODO: fix redraw under popup menu ... that not handled correctly somehow. + + //dbg_grect("toolbar redraw clip", clip); + + objc_draw_grect(tb->form,0,8,clip); + objc_draw_grect(&throbber_form[tb->throbber.index], 0, 1, clip); + + toolbar_get_grect(tb, TOOLBAR_AREA_URL, &area_ro); + area = area_ro; + + if (rc_intersect(clip, &area)) { + + plot_set_dimensions(area_ro.g_x, area_ro.g_y, area_ro.g_w, area_ro.g_h); + struct rect r = {
+ .x0 = MAX(0,area.g_x - area_ro.g_x), + .y0 = MAX(0,area.g_y - area_ro.g_y),
+ .x1 = MAX(0,area.g_x - area_ro.g_x) + area.g_w, + .y1 = MAX(0,area.g_y - area_ro.g_y) + area.g_h
+ }; + //dbg_rect("tb textarea clip: ", &r); + // TODO: let this be handled by an userdef object redraw function: + textarea_redraw(tb->url.textarea, 0, 0, &r, &toolbar_rdrw_ctx); + } +} + + +void toolbar_update_buttons(struct s_toolbar *tb, struct browser_window *bw, + short button) +{ + LOG(("")); struct s_tb_button * bt;
bool enable = false; - if( button == TOOLBAR_BT_BACK || button <= 0 ){ - bt = &gw->root->toolbar->buttons[TOOLBAR_BT_BACK-FIRST_BUTTON]; - enable = browser_window_back_available(gw->browser->bw);
- if( enable ){
+ GRECT area; + + assert(bw != NULL); + + if (button == TOOLBAR_BT_BACK || button <= 0 ) { + bt = find_button(tb, TOOLBAR_BT_BACK); + enable = browser_window_back_available(bw);
+ if (enable) {
bt->state = button_on;
} else {
bt->state = button_off;
} - mt_CompEvntRedraw( &app, bt->comp ); } - if( button == TOOLBAR_BT_HOME || button <= 0 ){
- bt = &gw->root->toolbar->buttons[TOOLBAR_BT_HOME-FIRST_BUTTON];
- mt_CompEvntRedraw( &app, bt->comp ); + if (button == TOOLBAR_BT_HOME || button <= 0 ) {
+ }
- if( button == TOOLBAR_BT_FORWARD || button <= 0 ){ - bt = &gw->root->toolbar->buttons[TOOLBAR_BT_FORWARD-FIRST_BUTTON]; - enable = browser_window_forward_available(gw->browser->bw);
- if( enable ){
+ if (button == TOOLBAR_BT_FORWARD || button <= 0 ) { + bt = find_button(tb, TOOLBAR_BT_FORWARD); + enable = browser_window_forward_available(bw);
+ if (enable) {
bt->state = button_on;
} else {
bt->state = button_off;
- } - mt_CompEvntRedraw( &app, bt->comp );
+ }
}
- if( button == TOOLBAR_BT_RELOAD || button <= 0 ){ - bt = &gw->root->toolbar->buttons[TOOLBAR_BT_RELOAD-FIRST_BUTTON]; - enable = browser_window_reload_available(gw->browser->bw);
- if( enable ){
+ if (button == TOOLBAR_BT_RELOAD || button <= 0 ) { + bt = find_button(tb, TOOLBAR_BT_RELOAD); + enable = browser_window_reload_available(bw);
+ if (enable) {
bt->state = button_on;
} else {
bt->state = button_off;
} - mt_CompEvntRedraw( &app, bt->comp ); }
- if( button == TOOLBAR_BT_STOP || button <= 0 ){
- bt = &gw->root->toolbar->buttons[TOOLBAR_BT_STOP-FIRST_BUTTON]; - enable = browser_window_stop_available(gw->browser->bw);
- if( enable ){
+ if (button == TOOLBAR_BT_STOP || button <= 0) { + bt = find_button(tb, TOOLBAR_BT_STOP); + enable = browser_window_stop_available(bw);
+ if (enable) {
bt->state = button_on;
} else {
bt->state = button_off;
} - mt_CompEvntRedraw( &app, bt->comp ); } -#undef FIRST_BUTON
-}
-
-
-
-void tb_url_set( struct gui_window * gw, char * text )
-{
- LGRECT work;
- int len = strlen(text);
- char * newtext;
- int newsize;
-
- if( gw->root->toolbar == NULL )
- return;
-
- if( gw->browser->attached == false )
- return;
-
- struct s_url_widget * url = &gw->root->toolbar->url;
-
- assert( gw != NULL );
- assert( gw->browser != NULL );
- assert( gw->root != NULL );
- assert( gw->browser->bw != NULL );
-
- textarea_set_text(url->textarea, text);
-
- mt_CompGetLGrect( &app, gw->root->toolbar->url.comp, WF_WORKXYWH, &work);
- work.g_w -= (TOOLBAR_URL_MARGIN_LEFT + TOOLBAR_URL_MARGIN_RIGHT);
- /* do not overwrite the black border, because of that, add 1 */
- work.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM+1);
- tb_txt_request_redraw( gw->root->toolbar, 0,0,work.g_w,work.g_h ); - tb_update_buttons( gw, TOOLBAR_BT_STOP );
- return;
-}
-
-
-/* -------------------------------------------------------------------------- */
-/* Public Module event handlers: */
-/* -------------------------------------------------------------------------- */
+ if (tb->attached) { + if (button > 0) { + toolbar_get_grect(tb, button, &area); + window_schedule_redraw_grect(tb->owner, &area); + } + else { + toolbar_get_grect(tb, TOOLBAR_AREA_BUTTONS, &area); + window_schedule_redraw_grect(tb->owner, &area); + } + } +} + +void toolbar_set_width(struct s_toolbar *tb, short w) +{ + GRECT cur; + + toolbar_get_grect(tb, 0, &cur); + + if (w != cur.g_w) { + + tb->area.g_w = w; + + /* reflow now, just for url input calucation: */ + toolbar_reflow(tb); + /* this will request an textarea redraw: */ + textarea_set_dimensions(tb->url.textarea, + tb->form[TOOLBAR_AREA_URL].ob_width, + tb->form[TOOLBAR_AREA_URL].ob_height); + tb->reflow = true; + } +} + +void toolbar_set_origin(struct s_toolbar *tb, short x, short y) +{ + GRECT cur; + + toolbar_get_grect(tb, 0, &cur); + + if (x != cur.g_x || y != cur.g_y) { + tb->area.g_x = x; + tb->area.g_y = y; + tb->reflow = true; + } +} + +void toolbar_set_dimensions(struct s_toolbar *tb, GRECT *area) +{ + if (area->g_w != tb->area.g_w) { + + tb->area = *area; + + /* reflow now, just for url input calucation: */ + toolbar_reflow(tb); + /* this will request an textarea redraw: */ + textarea_set_dimensions(tb->url.textarea, + tb->form[TOOLBAR_AREA_URL].ob_width, + tb->form[TOOLBAR_AREA_URL].ob_height); + } + else { + tb->area = *area; + } + /* reflow for next redraw: */ + /* TODO: that's only required because we do not reset others toolbars reflow + state on reflow */ + tb->reflow = true; +} + + +void toolbar_set_url(struct s_toolbar *tb, const char * text) +{ + LOG(("")); + textarea_set_text(tb->url.textarea, text); + + if (tb->attached) { + GRECT area; + toolbar_get_grect(tb, TOOLBAR_AREA_URL, &area); + window_schedule_redraw_grect(tb->owner, &area); + struct gui_window * gw = window_get_active_gui_window(tb->owner); + assert(gw != NULL); + toolbar_update_buttons(tb, gw->browser->bw , 0); + } +} + +void toolbar_set_throbber_state(struct s_toolbar *tb, bool active) +{ + GRECT throbber_area; + + tb->throbber.running = active; + if (active) { + tb->throbber.index = THROBBER_MIN_INDEX; + } else { + tb->throbber.index = THROBBER_INACTIVE_INDEX; + } + + tb->reflow = true; + toolbar_get_grect(tb, TOOLBAR_THROBBER_AREA, &throbber_area); + window_schedule_redraw_grect(tb->owner, &throbber_area); +} + +void toolbar_set_visible(struct s_toolbar *tb, short area, bool visible) +{ + if (area == 0) { + if ((visible == false) && (tb->visible == true)) { + tb->visible = false; + tb->reflow = true; + } else if((visible == true) && (tb->visible == false)) { + tb->visible = false; + tb->reflow = true; + } + } + else if (area == TOOLBAR_AREA_SEARCH) { + tb->search_visible = visible; + tb->reflow = true; + } +} + +void toolbar_set_reflow(struct s_toolbar *tb, bool do_reflow) +{ + tb->reflow = do_reflow; +} + +void toolbar_set_attached(struct s_toolbar *tb, bool attached) +{ + tb->attached = attached; + +} + +void toolbar_throbber_progress(struct s_toolbar *tb) +{ + GRECT throbber_area; + + assert(tb->throbber.running == true); + + if(tb->throbber.running == false) + return; + + tb->throbber.index++; + if(tb->throbber.index > THROBBER_MAX_INDEX) + tb->throbber.index = THROBBER_MIN_INDEX; + + tb->reflow = true; + toolbar_get_grect(tb, TOOLBAR_THROBBER_AREA, &throbber_area); + window_schedule_redraw_grect(tb->owner, &throbber_area); +} + +bool toolbar_text_input(struct s_toolbar *tb, char *text) +{ + bool handled = true; + + LOG(("")); + + return(handled); +} + +bool toolbar_key_input(struct s_toolbar *tb, short nkc) +{ + + assert(tb!=NULL); -bool tb_url_input( struct gui_window * gw, short nkc )
-{
- CMP_TOOLBAR tb = gw->root->toolbar;
- assert(tb!=NULL);
- LGRECT work;
- bool ret = false;
+ GRECT work; + bool ret = false; + struct gui_window *gw = window_get_active_gui_window(tb->owner);
assert( gw != NULL );
long ucs4;
- long ik = nkc_to_input_key( nkc, &ucs4 );
-
- if( ik == 0 ){
- if ( (nkc&0xFF) >= 9 ) {
- ret = textarea_keypress( tb->url.textarea, ucs4 );
+ long ik = nkc_to_input_key(nkc, &ucs4);
+ + if (ik == 0) {
+ if ((nkc&0xFF) >= 9) {
+ ret = textarea_keypress(tb->url.textarea, ucs4);
}
}
- else if( ik == KEY_CR || ik == KEY_NL ){
+ else if (ik == KEY_CR || ik == KEY_NL) {
char tmp_url[PATH_MAX];
- if( textarea_get_text( tb->url.textarea, tmp_url, PATH_MAX) > 0 ) {
- window_set_focus( gw, BROWSER, gw->browser);
+ if ( textarea_get_text( tb->url.textarea, tmp_url, PATH_MAX) > 0 ) {
+ window_set_focus(tb->owner, BROWSER, gw->browser);
browser_window_go(gw->browser->bw, (const char*)&tmp_url, 0, true);
ret = true;
}
}
- else if( ik == KEY_COPY_SELECTION ){
+ else if (ik == KEY_COPY_SELECTION) {
// copy whole text
char * text;
int len;
len = textarea_get_text( tb->url.textarea, NULL, 0 );
text = malloc( len+1 );
- if( text ){
+ if (text){
textarea_get_text( tb->url.textarea, text, len+1 );
- scrap_txt_write( &app, text );
+ scrap_txt_write(text);
free( text );
}
} - else if( ik == KEY_PASTE ){ - char * clip = scrap_txt_read( &app );
- if( clip != NULL ){ + else if ( ik == KEY_PASTE) { + char * clip = scrap_txt_read();
+ if ( clip != NULL ){ int clip_length = strlen( clip );
if ( clip_length > 0 ) {
char *utf8;
@@ -1009,15 +971,15 @@ bool tb_url_input( struct gui_window * gw, short nkc ) * convert to UTF8 */
res = utf8_from_local_encoding( clip, clip_length, &utf8 );
if ( res == UTF8_CONVERT_OK ) {
- tb_url_set( gw, utf8 );
+ toolbar_set_url(tb, utf8);
free(utf8); ret = true;
}
- free( clip );
} + free( clip ); } } - else if( ik == KEY_ESCAPE ) { + else if (ik == KEY_ESCAPE) { textarea_keypress( tb->url.textarea, KEY_SELECT_ALL ); textarea_keypress( tb->url.textarea, KEY_DELETE_LEFT ); }
@@ -1025,57 +987,217 @@ bool tb_url_input( struct gui_window * gw, short nkc ) ret = textarea_keypress( tb->url.textarea, ik );
}
- return( ret );
-}
-
-void tb_back_click( struct gui_window * gw )
-{
- struct browser_window *bw = gw->browser->bw;
+ return( ret ); +} + + +void toolbar_mouse_input(struct s_toolbar *tb, short obj, short button) +{ + LOG(("")); + GRECT work;
+ short mx, my, mb, kstat;
+ int old; + OBJECT * toolbar_tree; + struct gui_window * gw; + + + if (obj==TOOLBAR_AREA_URL){ + + graf_mkstate(&mx, &my, &mb, &kstat); + toolbar_get_grect(tb, TOOLBAR_AREA_URL, &work); + mx -= work.g_x;
+ my -= work.g_y; +
+ /* TODO: reset mouse state of browser window? */
+ /* select whole text when newly focused, otherwise set caret to + end of text */ + if (!window_url_widget_has_focus(tb->owner)) { + window_set_focus(tb->owner, URL_WIDGET, (void*)&tb->url); + } + /* url widget has focus and mouse button is still pressed... */ + else if (mb & 1) { + + textarea_mouse_action(tb->url.textarea, BROWSER_MOUSE_DRAG_1,
+ mx, my );
+ short prev_x = mx;
+ short prev_y = my;
+ do {
+ if (abs(prev_x-mx) > 5 || abs(prev_y-my) > 5) {
+ textarea_mouse_action( tb->url.textarea,
+ BROWSER_MOUSE_HOLDING_1, mx, my );
+ prev_x = mx;
+ prev_y = my; + window_schedule_redraw_grect(tb->owner, &work); + window_process_redraws(tb->owner);
+ }
+ graf_mkstate( &mx, &my, &mb, &kstat );
+ mx = mx - (work.g_x + TOOLBAR_URL_MARGIN_LEFT);
+ my = my - (work.g_y + TOOLBAR_URL_MARGIN_TOP); + } while (mb & 1); - if( history_back_available(bw->history) )
+ textarea_drag_end( tb->url.textarea, 0, mx, my); + } + else if (button & 2) { + // TODO: open a context popup + } + else { + /* when execution reaches here, mouse input is a click or dclick */ + /* TODO: recognize click + shitoolbar_update_buttonsft key */
+ int mstate = BROWSER_MOUSE_PRESS_1;
+ if ((kstat & (K_LSHIFT|K_RSHIFT)) != 0) {
+ mstate = BROWSER_MOUSE_MOD_1; + } + if (aes_event_out.emo_mclicks == 2 ) { + textarea_mouse_action( tb->url.textarea,
+ BROWSER_MOUSE_DOUBLE_CLICK | BROWSER_MOUSE_CLICK_1, mx, + my); + toolbar_get_grect(tb, TOOLBAR_AREA_URL, &work); + window_schedule_redraw_grect(tb->owner, &work); + } else { + textarea_mouse_action(tb->url.textarea,
+ BROWSER_MOUSE_PRESS_1, mx, my ); + } + } + } + else if(obj==TOOLBAR_TB_SRCH) { + window_set_focus(tb->owner, SEARCH_INPUT, NULL); + } + else if (obj==TOOLBAR_BT_SEARCH_FWD) { + gw = tb->owner->active_gui_window; + assert(gw->search); + nsatari_search_perform(gw->search, tb->form, SEARCH_FLAG_FORWARDS); + } + else if (obj==TOOLBAR_BT_SEARCH_BACK) { + gw = tb->owner->active_gui_window; + assert(gw->search); + nsatari_search_perform(gw->search, tb->form, 0); + } + else if (obj==TOOLBAR_BT_CLOSE_SEARCH) { + tb->form[TOOLBAR_BT_CLOSE_SEARCH].ob_state &= ~OS_SELECTED; + window_close_search(tb->owner); + } + else { + struct s_tb_button *bt = find_button(tb, obj); + if (bt != NULL && bt->state != button_off) { + bt->cb_click(tb); + struct gui_window * gw = window_get_active_gui_window(tb->owner); + toolbar_update_buttons(tb, gw->browser->bw, 0); + } + + } +} + + +/** +* Receive a specific region of the toolbar. +* @param tb - the toolbar pointer +* @param which - the area to retrieve: 0 to receive the workarea, + all other values must be + an resource ID of the TOOLBAR tree. +* @param dst - GRECT pointer receiving the area. +*/ + +void toolbar_get_grect(struct s_toolbar *tb, short which, GRECT *dst) +{ + #define LAST_TOOLBAR_AREA TOOLBAR_AREA_SEARCH + + if (tb->reflow == true) { + toolbar_reflow(tb); + } + + objc_offset(tb->form, which, &dst->g_x, &dst->g_y); + + dst->g_w = tb->form[which].ob_width; + dst->g_h = tb->form[which].ob_height; + //tb->form[which].ob_height; + + //printf("Toolbar get grect (%d): ", which); + //dbg_grect("", dst); + + #undef LAST_TOOLBAR_AREA +} + + +struct textarea *toolbar_get_textarea(struct s_toolbar *tb, + enum toolbar_textarea which) +{ + return(tb->url.textarea); +} + +OBJECT *toolbar_get_form(struct s_toolbar *tb) +{ + return(tb->form); +} + + +/* public event handler */
+void toolbar_back_click(struct s_toolbar *tb)
+{ + struct browser_window * bw; + struct gui_window * gw; + + gw = window_get_active_gui_window(tb->owner); + assert(gw != NULL); + bw = gw->browser->bw; + assert(bw != NULL); + + if( history_back_available(bw->history) )
history_back(bw, bw->history);
}
-void tb_reload_click( struct gui_window * gw )
+void toolbar_reload_click(struct s_toolbar *tb)
{ - browser_window_reload( gw->browser->bw, true );
+ struct browser_window * bw; + struct gui_window * gw; + + gw = window_get_active_gui_window(tb->owner); + assert(gw != NULL); + bw = gw->browser->bw; + assert(bw != NULL); + + browser_window_reload(bw, true);
}
-void tb_forward_click( struct gui_window * gw )
-{
- struct browser_window *bw = gw->browser->bw;
+void toolbar_forward_click(struct s_toolbar *tb)
+{ + struct browser_window * bw; + struct gui_window * gw; + + gw = window_get_active_gui_window(tb->owner); + assert(gw != NULL); + bw = gw->browser->bw; + assert(bw != NULL); +
if (history_forward_available(bw->history))
history_forward(bw, bw->history);
}
-void tb_home_click( struct gui_window * gw )
+void toolbar_home_click(struct s_toolbar *tb)
{ - browser_window_go(gw->browser->bw, option_homepage_url, 0, true);
+ struct browser_window * bw; + struct gui_window * gw; + + gw = window_get_active_gui_window(tb->owner); + assert(gw != NULL); + bw = gw->browser->bw; + assert(bw != NULL); + browser_window_go(bw, option_homepage_url, 0, true);
}
-void tb_stop_click( struct gui_window * gw )
+void toolbar_stop_click(struct s_toolbar *tb)
{ - browser_window_stop(gw->browser->bw);
-} + struct browser_window * bw; + struct gui_window * gw; + gw = window_get_active_gui_window(tb->owner); + + assert(gw != NULL); + + bw = gw->browser->bw; + + assert(bw != NULL); + + browser_window_stop(bw);
+} -void tb_hide( struct gui_window * gw, short mode ) -{ - CMP_TOOLBAR tb = gw->root->toolbar; - assert( tb != NULL ); - if( mode == 1 ){ - tb->hidden = true; - tb->comp->rect.g_h = 0; - tb->comp->bounds.max_height = 0; - - } else { - tb->hidden = false; - tb->comp->rect.g_h = toolbar_styles[tb->style].height; - tb->comp->bounds.max_height = toolbar_styles[tb->style].height; - } - gw->browser->reformat_pending = true; - browser_update_rects( gw ); - snd_rdw( gw->root->handle ); -}
-
diff --git a/atari/toolbar.h b/atari/toolbar.h index 69908de35..3116aa9d6 100755..100644 --- a/atari/toolbar.h +++ b/atari/toolbar.h @@ -1,69 +1,26 @@ -/*
- * 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_ATARI_TOOLBAR_H
+#ifndef NS_ATARI_TOOLBAR_H #define NS_ATARI_TOOLBAR_H +#include <stdbool.h> +#include <stdint.h> + #include "desktop/textarea.h" -#include "desktop/textinput.h" -#include "content/hlcache.h" -#include "atari/browser.h" -
-#define TB_BUTTON_WIDTH 32
-#define THROBBER_WIDTH 32
-#define THROBBER_MIN_INDEX 1
-#define THROBBER_MAX_INDEX 12
-#define THROBBER_INACTIVE_INDEX 13
+#include "desktop/browser.h" + +struct s_toolbar; + +enum toolbar_textarea { + URL_INPUT_TEXT_AREA = 1 +}; -#define TOOLBAR_URL_MARGIN_LEFT 2
-#define TOOLBAR_URL_MARGIN_RIGHT 2 -#define TOOLBAR_URL_MARGIN_TOP 2 -#define TOOLBAR_URL_MARGIN_BOTTOM 2 -
-enum e_toolbar_button_states {
- button_on = 0,
- button_off = 1
-};
-#define TOOLBAR_BUTTON_NUM_STATES 2
-
-struct s_tb_button
-{
- short rsc_id;
- void (*cb_click)(struct gui_window * gw); - COMPONENT * comp; - hlcache_handle * icon[TOOLBAR_BUTTON_NUM_STATES]; - struct gui_window * gw; - short state;
- short index;
-};
-
-
struct s_url_widget
{
- bool redraw; /* widget is only redrawn when this flag is set */
struct textarea *textarea; - COMPONENT * comp; - GRECT rdw_area;
-};
-
+ GRECT area;
+}; + struct s_throbber_widget
{
- COMPONENT * comp;
short index;
short max_index;
bool running;
@@ -71,48 +28,51 @@ struct s_throbber_widget struct s_toolbar
{
- COMPONENT * comp;
- struct gui_window * owner; + struct s_gui_win_root *owner; struct s_url_widget url;
struct s_throbber_widget throbber; - GRECT btdim;
+ OBJECT *form; + GRECT area;
/* size & location of buttons: */ struct s_tb_button * buttons; - bool hidden;
int btcnt; int style; - bool redraw;
-};
+ bool attached; + bool reflow; + bool visible; + bool search_visible;
+}; -/* interface to the toolbar */ -
-/* Must be called before any other toolbar function is called: */ -void toolbar_init( void ); -/*Must be called when netsurf exits to free toolbar resources: */ + +void toolbar_init(void); +struct s_toolbar *toolbar_create(struct s_gui_win_root *owner); +void toolbar_destroy(struct s_toolbar * tb); void toolbar_exit( void ); -CMP_TOOLBAR tb_create( struct gui_window * gw );
-void tb_destroy( CMP_TOOLBAR tb );
-/* recalculate size/position of nested controls within the toolbar: */ -void tb_adjust_size( struct gui_window * gw );
-/* report click to toolbar, relative coords : */
-void tb_click( struct gui_window * gw, short mx, short my, short mb, short kstat );
-void tb_back_click( struct gui_window * gw );
-void tb_reload_click( struct gui_window * gw );
-void tb_forward_click( struct gui_window * gw );
-void tb_home_click( struct gui_window * gw );
-void tb_stop_click( struct gui_window * gw );
-/* enable / disable buttons etc. */
-void tb_update_buttons( struct gui_window * gw, short buttonid );
-/* handles clicks on url widget: */
-void tb_url_click( struct gui_window * gw, short mx, short my, short mb, short kstat );
-/* handle keybd event while url widget has focus:*/
-bool tb_url_input( struct gui_window * gw, short keycode );
-/* set the url: */
-void tb_url_set( struct gui_window * gw, char * text ); -/* perform redraw of invalidated url textinput areas: */ -void tb_url_redraw( struct gui_window * gw );
-struct gui_window * tb_gui_window( CMP_TOOLBAR tb ); -/* hide toolbar, mode = 1: hide, mode = 0: show */ -void tb_hide( struct gui_window * gw, short mode );
-
-#endif
+bool toolbar_text_input(struct s_toolbar *tb, char *text); +bool toolbar_key_input(struct s_toolbar *tb, short nkc); +void toolbar_mouse_input(struct s_toolbar *tb, short obj, short mbut); +void toolbar_update_buttons(struct s_toolbar *tb, struct browser_window *bw, + short idx); +void toolbar_get_grect(struct s_toolbar *tb, short which, GRECT *g); +OBJECT *toolbar_get_form(struct s_toolbar *tb); +struct textarea *toolbar_get_textarea(struct s_toolbar *tb, + enum toolbar_textarea which); +void toolbar_set_throbber_state(struct s_toolbar *tb, bool active); +void toolbar_set_attached(struct s_toolbar *tb, bool attached); +void toolbar_set_visible(struct s_toolbar *tb, short area, bool visible); +void toolbar_set_reflow(struct s_toolbar *tb, bool do_reflow); +void toolbar_set_width(struct s_toolbar *tb, short w); +void toolbar_set_origin(struct s_toolbar *tb, short x, short y); +void toolbar_set_dimensions(struct s_toolbar *tb, GRECT *area); +void toolbar_set_url(struct s_toolbar *tb, const char *text); +void toolbar_redraw(struct s_toolbar *tb, GRECT *clip); +void toolbar_throbber_progress(struct s_toolbar *tb); +/* public events handlers: */ +void toolbar_back_click(struct s_toolbar *tb);
+void toolbar_reload_click(struct s_toolbar *tb);
+void toolbar_forward_click(struct s_toolbar *tb);
+void toolbar_home_click(struct s_toolbar *tb);
+void toolbar_stop_click(struct s_toolbar *tb); + + +#endif diff --git a/atari/treeview.c b/atari/treeview.c index 4a5cb0a75..0aedb4cfc 100755 --- a/atari/treeview.c +++ b/atari/treeview.c @@ -1,446 +1,549 @@ -/*
- * 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 <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <windom.h>
-
-#include "content/urldb.h"
-#include "desktop/browser.h"
-#include "desktop/plotters.h"
-#include "desktop/textinput.h"
-#include "desktop/tree.h"
-#include "desktop/tree_url_node.h"
-#include "desktop/textinput.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "atari/gui.h"
-#include "atari/treeview.h"
-#include "atari/plot/plot.h"
-#include "atari/misc.h"
-#include "cflib.h"
-
-extern int mouse_hold_start[3];
-extern browser_mouse_state bmstate;
-extern short last_drag_x;
-extern short last_drag_y;
+/* + * 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 <stdbool.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include "content/urldb.h" +#include "desktop/browser.h" +#include "desktop/plotters.h" +#include "desktop/textinput.h" +#include "desktop/tree.h" +#include "desktop/tree_url_node.h" +#include "desktop/textinput.h" +#include "utils/log.h" +#include "utils/messages.h" +#include "utils/utils.h" +#include "atari/gui.h" +#include "atari/treeview.h" +#include "atari/plot/plot.h" +#include "atari/misc.h" +#include "atari/gemtk/gemtk.h" +#include "cflib.h" + +enum treeview_area_e { + TREEVIEW_AREA_WORK = 0, + TREEVIEW_AREA_TOOLBAR, + TREEVIEW_AREA_CONTENT +}; + +extern int mouse_hold_start[3]; +extern browser_mouse_state bmstate; +extern short last_drag_x; +extern short last_drag_y; extern long atari_plot_flags; extern int atari_plot_vdi_handle; -
-static void atari_treeview_resized(struct tree *tree,int w,int h,void *pw);
-static void atari_treeview_scroll_visible(int y, int h, void *pw);
-static void atari_treeview_get_dimensions(int *width, int *height,void *pw);
-
-static const struct treeview_table atari_tree_callbacks = {
- atari_treeview_request_redraw,
- atari_treeview_resized,
- atari_treeview_scroll_visible,
- atari_treeview_get_dimensions
-};
-
-static void __CDECL evnt_tv_keybd( WINDOW *win, short buff[8], void * data )
-{
- bool r=false;
- long kstate = 0;
- long kcode = 0;
- long ucs4;
- long ik;
- unsigned short nkc = 0;
- unsigned short nks = 0;
- unsigned char ascii;
-
- NSTREEVIEW tv = (NSTREEVIEW) data;
- kstate = evnt.mkstate;
- kcode = evnt.keybd;
- nkc= gem_to_norm( (short)kstate, (short)kcode );
- ascii = (nkc & 0xFF);
- ik = nkc_to_input_key( nkc, &ucs4 );
-
- if( ik == 0 ){
- if (ascii >= 9 ) {
- r = tree_keypress( tv->tree, ucs4 );
- }
- } else {
- r = tree_keypress( tv->tree, ik );
- }
-}
-
-
-static void __CDECL evnt_tv_redraw( WINDOW *win, short buff[8], void * data )
-{
- GRECT work, clip;
- NSTREEVIEW tv = (NSTREEVIEW) data;
- if( tv == NULL )
- return;
- WindGetGrect( win, WF_WORKXYWH, &work );
- clip = work;
- if ( !rc_intersect( (GRECT*)&buff[4], &clip ) ) return;
- clip.g_x -= work.g_x;
- clip.g_y -= work.g_y;
- if( clip.g_x < 0 ) {
- clip.g_w = work.g_w + clip.g_x;
- clip.g_x = 0;
- }
- if( clip.g_y < 0 ) {
- clip.g_h = work.g_h + clip.g_y;
- clip.g_y = 0;
- }
- if( clip.g_h > 0 && clip.g_w > 0 ) {
- atari_treeview_request_redraw(
- win->xpos*win->w_u + clip.g_x,
- win->ypos*win->h_u + clip.g_y,
- clip.g_w, clip.g_h, tv
- );
- }
-}
-
-static void __CDECL evnt_tv_mbutton( WINDOW *win, short buff[8], void * data )
-{
- GRECT work;
- NSTREEVIEW tv = (NSTREEVIEW) data;
- if( tv == NULL )
- return;
- if( evnt.mbut & 2 ) {
- /* do not handle right click */
- return;
- }
-
- WindGetGrect( tv->window, WF_WORKXYWH, &work );
-
- /* mouse click relative origin: */
- short origin_rel_x = (evnt.mx-work.g_x)+(win->xpos*win->w_u);
- short origin_rel_y = (evnt.my-work.g_y)+(win->ypos*win->h_u);
-
- if( origin_rel_x >= 0 && origin_rel_y >= 0
- && evnt.mx < work.g_x + work.g_w
- && evnt.my < work.g_y + work.g_h )
- {
- int bms;
- bool ignore=false;
- short cur_rel_x, cur_rel_y, dummy, mbut;
-
- if( evnt.nb_click == 2 ){
- tree_mouse_action(tv->tree,
- BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_DOUBLE_CLICK,
- origin_rel_x, origin_rel_y );
- return;
- }
-
- graf_mkstate(&cur_rel_x, &cur_rel_x, &mbut, &dummy);
- if( (mbut&1) == 0 ){
- bms = BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1;
- if( evnt.nb_click == 2 ) {
- bms = BROWSER_MOUSE_DOUBLE_CLICK;
- }
- tree_mouse_action(tv->tree, bms, origin_rel_x, origin_rel_y );
- } else {
- /* button still pressed */
-
- short prev_x = origin_rel_x;
- short prev_y = origin_rel_y;
-
- cur_rel_x = origin_rel_x;
- cur_rel_y = origin_rel_y;
-
- if( tree_is_edited(tv->tree) ){
- gem_set_cursor(&gem_cursors.ibeam);
- } else {
- gem_set_cursor(&gem_cursors.hand);
- }
-
- tv->startdrag.x = origin_rel_x;
- tv->startdrag.y = origin_rel_y;
-
- tree_mouse_action( tv->tree,
- BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON ,
- cur_rel_x, cur_rel_y );
- do{
- if( abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5 ){
- tree_mouse_action( tv->tree,
- BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON,
- cur_rel_x, cur_rel_y);
- prev_x = cur_rel_x;
- prev_y = cur_rel_y;
- }
-
- if( tv->redraw )
- atari_treeview_redraw( tv );
- /* sample mouse button state: */
- graf_mkstate(&cur_rel_x, &cur_rel_y, &mbut, &dummy);
- cur_rel_x = (cur_rel_x-work.g_x)+(win->xpos*win->w_u);
- cur_rel_y = (cur_rel_y-work.g_y)+(win->ypos*win->h_u);
- } while( mbut & 1 );
-
- tree_drag_end(tv->tree, 0, tv->startdrag.x, tv->startdrag.y,
- cur_rel_x, cur_rel_y );
- gem_set_cursor(&gem_cursors.arrow);
- }
- }
-}
-
-NSTREEVIEW atari_treeview_create( uint32_t flags, WINDOW *win )
-{
- if( win == NULL )
- return( NULL );
- NSTREEVIEW new = malloc(sizeof(struct atari_treeview));
- if (new == NULL)
- return NULL;
- memset( new, 0, sizeof(struct atari_treeview));
- new->tree = tree_create(flags, &atari_tree_callbacks, new);
- if (new->tree == NULL) {
- free(new);
- return NULL;
- }
- new->window = win;
-
- win->w_u = 16;
- win->h_u = 16;
-
- EvntDataAdd( new->window, WM_XBUTTON, evnt_tv_mbutton, new, EV_BOT );
- EvntDataAttach( new->window, WM_REDRAW, evnt_tv_redraw, new );
- EvntDataAttach( new->window, WM_XKEYBD, evnt_tv_keybd, new );
-
- return(new);
-}
-
-void atari_treeview_open( NSTREEVIEW tv )
-{
- if( tv->window != NULL ) {
- tree_set_redraw(tv->tree, true);
- }
-}
-
-void atari_treeview_close( NSTREEVIEW tv )
-{
- if( tv->window != NULL ) {
- tree_set_redraw(tv->tree, false);
- }
-}
-
-void atari_treeview_destroy( NSTREEVIEW tv )
-{
- if( tv != NULL ){
- tv->disposing = true;
- LOG(("tree: %p", tv));
- if( tv->tree != NULL ) {
- tree_delete(tv->tree);
- tv->tree = NULL;
- }
- free( tv );
- }
-}
-
-bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y)
-{
- if( tv == NULL )
- return ( false );
- GRECT work;
- WindGetGrect( tv->window, WF_WORKXYWH, &work );
- int rx = (x-work.g_x)+(tv->window->xpos*tv->window->w_u);
- int ry = (y-work.g_y)+(tv->window->ypos*tv->window->h_u);
- tree_mouse_action(tv->tree, bms, rx, ry );
- tv->click.x = rx;
- tv->click.y = ry;
- return( true );
-}
-
-
-
-void atari_treeview_redraw( NSTREEVIEW tv)
+ +static void atari_treeview_resized(struct tree *tree,int w,int h, void *pw); +static void atari_treeview_scroll_visible(int y, int h, void *pw); +static void atari_treeview_get_dimensions(int *width, int *height, void *pw); +static void atari_treeview_get_grect(NSTREEVIEW tree, + enum treeview_area_e mode, GRECT *dest); + +static const struct treeview_table atari_tree_callbacks = { + atari_treeview_request_redraw, + atari_treeview_resized, + atari_treeview_scroll_visible, + atari_treeview_get_dimensions +}; + +static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT *ev_out, + short msg[8]); +static void __CDECL on_keybd_event(NSTREEVIEW tv, EVMULT_OUT *ev_out, + short msg[8]); +static void __CDECL on_redraw_event(NSTREEVIEW tv, EVMULT_OUT *ev_out, + short msg[8]); + +static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) { -
- if (tv != NULL) {
- if( tv->redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) ) {
- short todo[4];
- GRECT work;
- WindGetGrect( tv->window, WF_WORKXYWH, &work );
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &atari_plotters
- };
- plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
- if (plot_lock() == false)
- return;
-
- todo[0] = work.g_x;
- todo[1] = work.g_y;
- todo[2] = todo[0] + work.g_w-1;
- todo[3] = todo[1] + work.g_h-1;
- vs_clip(atari_plot_vdi_handle, 1, (short*)&todo );
-
- if( wind_get(tv->window->handle, WF_FIRSTXYWH,
- &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
- while (todo[2] && todo[3]) {
-
- /* convert screen to treeview coords: */
- todo[0] = todo[0] - work.g_x + tv->window->xpos*tv->window->w_u;
- todo[1] = todo[1] - work.g_y + tv->window->ypos*tv->window->h_u;
- if( todo[0] < 0 ){
- todo[2] = todo[2] + todo[0];
- todo[0] = 0;
- }
- if( todo[1] < 0 ){
- todo[3] = todo[3] + todo[1];
- todo[1] = 0;
- }
-
- if (rc_intersect((GRECT *)&tv->rdw_area,(GRECT *)&todo)) {
- tree_draw(tv->tree, -tv->window->xpos*16, -tv->window->ypos*16,
- todo[0], todo[1], todo[2], todo[3], &ctx
- );
- }
- if (wind_get(tv->window->handle, WF_NEXTXYWH,
- &todo[0], &todo[1], &todo[2], &todo[3])==0) {
- break;
- }
- }
- } else {
- plot_unlock();
- return;
- }
- plot_unlock();
- vs_clip(atari_plot_vdi_handle, 0, (short*)&todo);
- tv->redraw = false;
- tv->rdw_area.g_x = 65000;
- tv->rdw_area.g_y = 65000;
- tv->rdw_area.g_w = -1;
- tv->rdw_area.g_h = -1;
- } else {
- /* just copy stuff from the offscreen buffer */
- }
- }
-}
-
-
-/**
- * Callback to force a redraw of part of the treeview window.
- *
- * \param x Min X Coordinate of area to be redrawn.
- * \param y Min Y Coordinate of area to be redrawn.
- * \param width Width of area to be redrawn.
- * \param height Height of area to be redrawn.
- * \param pw The treeview object to be redrawn.
- */
-void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw)
-{
- if ( pw != NULL ) {
- NSTREEVIEW tv = (NSTREEVIEW) pw;
- if( tv->redraw == false ){
- tv->redraw = true;
- tv->rdw_area.g_x = x;
- tv->rdw_area.g_y = y;
- tv->rdw_area.g_w = w;
- tv->rdw_area.g_h = h;
- } else {
- /* merge the redraw area to the new area.: */
- int newx1 = x+w;
- int newy1 = y+h;
- int oldx1 = tv->rdw_area.g_x + tv->rdw_area.g_w;
- int oldy1 = tv->rdw_area.g_y + tv->rdw_area.g_h;
- tv->rdw_area.g_x = MIN(tv->rdw_area.g_x, x);
- tv->rdw_area.g_y = MIN(tv->rdw_area.g_y, y);
- tv->rdw_area.g_w = ( oldx1 > newx1 ) ? oldx1 - tv->rdw_area.g_x : newx1 - tv->rdw_area.g_x;
- tv->rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - tv->rdw_area.g_y : newy1 - tv->rdw_area.g_y;
- }
- }
-}
-
-
-/**
- * Callback to notify us of a new overall tree size.
- *
- * \param tree The tree being resized.
- * \param width The new width of the window.
- * \param height The new height of the window.
- * \param *pw The treeview object to be resized.
- */
-
-void atari_treeview_resized(struct tree *tree, int width, int height, void *pw)
-{
- if (pw != NULL) {
- NSTREEVIEW tv = (NSTREEVIEW) pw;
- if( tv->disposing )
- return;
- tv->extent.x = width;
- tv->extent.y = height;
- tv->window->ypos_max = (height / tv->window->w_u)+0.5;
- tv->window->xpos_max = (width / tv->window->h_u)+0.5;
- WindSlider( tv->window, HSLIDER|VSLIDER );
- }
-}
-
-
-/**
- * Callback to request that a section of the tree is scrolled into view.
- *
- * \param y The Y coordinate of top of the area in NS units.
- * \param height The height of the area in NS units.
- * \param *pw The treeview object affected.
- */
-
-void atari_treeview_scroll_visible(int y, int height, void *pw)
-{
- /* we don't support dragging outside the treeview */
- /* so we don't need to implement this? */
-}
-
-/**
- * Callback to return the tree window dimensions to the treeview system.
- *
- * \param *width Return the window width.
- * \param *height Return the window height.
- * \param *pw The treeview object to use.
- */
-
-void atari_treeview_get_dimensions(int *width, int *height,
- void *pw)
-{
- if (pw != NULL && (width != NULL || height != NULL)) {
- NSTREEVIEW tv = (NSTREEVIEW) pw;
- GRECT work;
- WindGetGrect( tv->window, WF_WORKXYWH, &work );
- *width = work.g_w;
- *height = work.g_h;
- }
-}
-
-
-/**
- * Translates a content_type to the name of a respective icon
- *
- * \param content_type content type
- * \param buffer buffer for the icon name
- */
-void tree_icon_name_from_content_type(char *buffer, content_type type)
-{
- switch (type) {
- case CONTENT_HTML:
- case CONTENT_TEXTPLAIN:
- case CONTENT_CSS:
- case CONTENT_IMAGE:
- default:
- strcpy( buffer, "content.png" );
- break;
- }
-}
+ + NSTREEVIEW tv = (NSTREEVIEW) gemtk_wm_get_user_data(win); + + if( (ev_out->emo_events & MU_MESAG) != 0 ) { + // handle message + switch (msg[0]) { + + case WM_REDRAW: + on_redraw_event(tv, ev_out, msg); + break; + + case WM_SIZED: + case WM_FULLED: + //atari_treeview_resized(tv->tree, tv->extent.x, tv->extent.y, tv); + break; + + default: + break; + } + } + if( (ev_out->emo_events & MU_KEYBD) != 0 ) { + on_keybd_event(tv, ev_out, msg); + } + if( (ev_out->emo_events & MU_BUTTON) != 0 ) { + LOG(("Treeview click at: %d,%d\n", ev_out->emo_mouse.p_x, + ev_out->emo_mouse.p_y)); + on_mbutton_event(tv, ev_out, msg); + } + + if(tv != NULL && tv->user_func != NULL){ + tv->user_func(win, ev_out, msg); + } + + return(0); +} + +static void __CDECL on_keybd_event(NSTREEVIEW tv, EVMULT_OUT *ev_out, + short msg[8]) +{ + bool r=false; + long kstate = 0; + long kcode = 0; + long ucs4; + long ik; + unsigned short nkc = 0; + unsigned short nks = 0; + unsigned char ascii; + + kstate = ev_out->emo_kmeta; + kcode = ev_out->emo_kreturn; + nkc= gem_to_norm( (short)kstate, (short)kcode ); + ascii = (nkc & 0xFF); + ik = nkc_to_input_key( nkc, &ucs4 ); + + if( ik == 0 ){ + if (ascii >= 9 ) { + r = tree_keypress( tv->tree, ucs4 ); + } + } else { + r = tree_keypress( tv->tree, ik ); + } +} + + +static void __CDECL on_redraw_event(NSTREEVIEW tv, EVMULT_OUT *ev_out, + short msg[8]) +{ + GRECT work, clip; + struct gemtk_wm_scroll_info_s *slid; + + if( tv == NULL ) + return; + + gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work); + slid = gemtk_wm_get_scroll_info(tv->window); + + clip = work; + if ( !rc_intersect( (GRECT*)&msg[4], &clip ) ) return; + clip.g_x -= work.g_x; + clip.g_y -= work.g_y; + if( clip.g_x < 0 ) { + clip.g_w = work.g_w + clip.g_x; + clip.g_x = 0; + } + if( clip.g_y < 0 ) { + clip.g_h = work.g_h + clip.g_y; + clip.g_y = 0; + } + if( clip.g_h > 0 && clip.g_w > 0 ) { + // TODO: get slider values + atari_treeview_request_redraw((slid->x_pos*slid->x_unit_px) + clip.g_x, + (slid->y_pos*slid->y_unit_px) + clip.g_y, + clip.g_w, clip.g_h, tv + ); + } +} + +static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT *ev_out, + short msg[8]) +{ + struct gemtk_wm_scroll_info_s *slid; + GRECT work; + short mx, my; + + if(tv == NULL) + return; + + gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work); + slid = gemtk_wm_get_scroll_info(tv->window); + mx = ev_out->emo_mouse.p_x; + my = ev_out->emo_mouse.p_y; + + /* mouse click relative origin: */ + + short origin_rel_x = (mx-work.g_x) + + (slid->x_pos*slid->x_unit_px); + short origin_rel_y = (my-work.g_y) + + (slid->y_pos*slid->y_unit_px); + + if( origin_rel_x >= 0 && origin_rel_y >= 0 + && mx < work.g_x + work.g_w + && my < work.g_y + work.g_h ) + { + int bms; + bool ignore=false; + short cur_rel_x, cur_rel_y, dummy, mbut; + + if (ev_out->emo_mclicks == 2) { + tree_mouse_action(tv->tree, + BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_DOUBLE_CLICK, + origin_rel_x, origin_rel_y ); + return; + } + + graf_mkstate(&cur_rel_x, &cur_rel_x, &mbut, &dummy); + if( (mbut&1) == 0 ){ + bms = BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1; + if(ev_out->emo_mclicks == 2 ) { + bms = BROWSER_MOUSE_DOUBLE_CLICK; + } + tree_mouse_action(tv->tree, bms, origin_rel_x, origin_rel_y ); + } else { + /* button still pressed */ + + short prev_x = origin_rel_x; + short prev_y = origin_rel_y; + + cur_rel_x = origin_rel_x; + cur_rel_y = origin_rel_y; + + if( tree_is_edited(tv->tree) ){ + gem_set_cursor(&gem_cursors.ibeam); + } else { + gem_set_cursor(&gem_cursors.hand); + } + + tv->startdrag.x = origin_rel_x; + tv->startdrag.y = origin_rel_y; + + tree_mouse_action( tv->tree, + BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON , + cur_rel_x, cur_rel_y ); + do{ + if( abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5 ){ + tree_mouse_action( tv->tree, + BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON, + cur_rel_x, cur_rel_y); + prev_x = cur_rel_x; + prev_y = cur_rel_y; + } + + if( tv->redraw ) + atari_treeview_redraw( tv ); + /* sample mouse button state: */ + graf_mkstate(&cur_rel_x, &cur_rel_y, &mbut, &dummy); + cur_rel_x = (cur_rel_x-work.g_x)+(slid->x_pos*slid->x_unit_px); + cur_rel_y = (cur_rel_y-work.g_y)+(slid->y_pos*slid->y_unit_px); + } while( mbut & 1 ); + + tree_drag_end(tv->tree, 0, tv->startdrag.x, tv->startdrag.y, + cur_rel_x, cur_rel_y ); + gem_set_cursor(&gem_cursors.arrow); + } + } +} + +NSTREEVIEW atari_treeview_create(uint32_t flags, GUIWIN *win, + gemtk_wm_event_handler_f user_func) +{ + struct gemtk_wm_scroll_info_s *slid; + + if( win == NULL ) + return( NULL ); + NSTREEVIEW new = malloc(sizeof(struct atari_treeview)); + if (new == NULL) + return NULL; + memset( new, 0, sizeof(struct atari_treeview)); + new->tree = tree_create(flags, &atari_tree_callbacks, new); + if (new->tree == NULL) { + free(new); + return NULL; + } + new->window = win; + new->user_func = user_func; + + gemtk_wm_set_event_handler(win, handle_event); + gemtk_wm_set_user_data(win, (void*)new); + + slid = gemtk_wm_get_scroll_info(new->window); + slid->y_unit_px = 16; + slid->x_unit_px = 16; + + return(new); +} + +void atari_treeview_open( NSTREEVIEW tv ) +{ + if( tv->window != NULL ) { + gemtk_wm_link(tv->window); + tree_set_redraw(tv->tree, true); + + } +} + +void atari_treeview_close(NSTREEVIEW tv) +{ + if(tv->window != NULL) { + tree_set_redraw(tv->tree, false); + gemtk_wm_unlink(tv->window); + } +} + +void atari_treeview_destroy( NSTREEVIEW tv ) +{ + if( tv != NULL ){ + tv->disposing = true; + LOG(("tree: %p", tv)); + if( tv->tree != NULL ) { + tree_delete(tv->tree); + tv->tree = NULL; + } + free( tv ); + } +} + +bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y) +{ + GRECT work; + struct gemtk_wm_scroll_info_s *slid; + + if( tv == NULL ) + return ( false ); + + gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work); + slid = gemtk_wm_get_scroll_info(tv->window); + + int rx = (x-work.g_x)+(slid->x_pos*slid->x_unit_px); + int ry = (y-work.g_y)+(slid->y_pos*slid->y_unit_px); + + tree_mouse_action(tv->tree, bms, rx, ry); + + tv->click.x = rx; + tv->click.y = ry; + + return( true ); +} + + + +void atari_treeview_redraw(NSTREEVIEW tv) +{ + if (tv != NULL) { + if( tv->redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) ) { + + short todo[4]; + GRECT work; + short handle = gemtk_wm_get_handle(tv->window); + struct gemtk_wm_scroll_info_s *slid; + + gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work); + slid = gemtk_wm_get_scroll_info(tv->window); + + struct redraw_context ctx = { + .interactive = true, + .background_images = true, + .plot = &atari_plotters + }; + plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h); + if (plot_lock() == false) + return; + + if( wind_get(handle, WF_FIRSTXYWH, + &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) { + while (todo[2] && todo[3]) { + + short pxy[4]; + pxy[0] = todo[0]; + pxy[1] = todo[1]; + pxy[2] = todo[0] + todo[2]-1; + pxy[3] = todo[1] + todo[3]-1; + vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy); + + /* convert screen to treeview coords: */ + todo[0] = todo[0] - work.g_x + slid->x_pos*slid->x_unit_px; + todo[1] = todo[1] - work.g_y + slid->y_pos*slid->y_unit_px; + if( todo[0] < 0 ){ + todo[2] = todo[2] + todo[0]; + todo[0] = 0; + } + if( todo[1] < 0 ){ + todo[3] = todo[3] + todo[1]; + todo[1] = 0; + } + + // TODO: get slider values + if (rc_intersect((GRECT *)&tv->rdw_area,(GRECT *)&todo)) { + tree_draw(tv->tree, -(slid->x_pos*slid->x_unit_px), + -(slid->y_pos*slid->y_unit_px), + todo[0], todo[1], todo[2], todo[3], &ctx + ); + } + vs_clip(atari_plot_vdi_handle, 0, (short*)&pxy); + if (wind_get(handle, WF_NEXTXYWH, + &todo[0], &todo[1], &todo[2], &todo[3])==0) { + break; + } + } + } else { + plot_unlock(); + return; + } + plot_unlock(); + tv->redraw = false; + tv->rdw_area.g_x = 65000; + tv->rdw_area.g_y = 65000; + tv->rdw_area.g_w = -1; + tv->rdw_area.g_h = -1; + } else { + /* just copy stuff from the offscreen buffer */ + } + } +} + + +/** + * Callback to force a redraw of part of the treeview window. + * + * \param x Min X Coordinate of area to be redrawn. + * \param y Min Y Coordinate of area to be redrawn. + * \param width Width of area to be redrawn. + * \param height Height of area to be redrawn. + * \param pw The treeview object to be redrawn. + */ +void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw) +{ + if ( pw != NULL ) { + NSTREEVIEW tv = (NSTREEVIEW) pw; + if( tv->redraw == false ){ + tv->redraw = true; + tv->rdw_area.g_x = x; + tv->rdw_area.g_y = y; + tv->rdw_area.g_w = w; + tv->rdw_area.g_h = h; + } else { + /* merge the redraw area to the new area.: */ + int newx1 = x+w; + int newy1 = y+h; + int oldx1 = tv->rdw_area.g_x + tv->rdw_area.g_w; + int oldy1 = tv->rdw_area.g_y + tv->rdw_area.g_h; + tv->rdw_area.g_x = MIN(tv->rdw_area.g_x, x); + tv->rdw_area.g_y = MIN(tv->rdw_area.g_y, y); + tv->rdw_area.g_w = ( oldx1 > newx1 ) ? oldx1 - tv->rdw_area.g_x : newx1 - tv->rdw_area.g_x; + tv->rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - tv->rdw_area.g_y : newy1 - tv->rdw_area.g_y; + } + dbg_grect("atari_treeview_request_redraw", &tv->rdw_area); + } +} + + +/** + * Callback to notify us of a new overall tree size. + * + * \param tree The tree being resized. + * \param width The new width of the window. + * \param height The new height of the window. + * \param *pw The treeview object to be resized. + */ + +void atari_treeview_resized(struct tree *tree, int width, int height, void *pw) +{ + GRECT area; + if (pw != NULL) { + NSTREEVIEW tv = (NSTREEVIEW) pw; + if( tv->disposing ) + return; + tv->extent.x = width; + tv->extent.y = height; + struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(tv->window); + gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &area); + slid->x_units = (width/slid->x_unit_px); + slid->y_units = (height/slid->y_unit_px); + /*printf("units content: %d, units viewport: %d\n", (height/slid->y_unit_px), + (area.g_h/slid->y_unit_px));*/ + gemtk_wm_update_slider(tv->window, GEMTK_WM_VH_SLIDER); + } +} + + +/** + * Callback to request that a section of the tree is scrolled into view. + * + * \param y The Y coordinate of top of the area in NS units. + * \param height The height of the area in NS units. + * \param *pw The treeview object affected. + */ + +void atari_treeview_scroll_visible(int y, int height, void *pw) +{ + /* we don't support dragging outside the treeview */ + /* so we don't need to implement this? */ +} + +static void atari_treeview_get_grect(NSTREEVIEW tv, enum treeview_area_e mode, + GRECT *dest) +{ + + if (mode == TREEVIEW_AREA_CONTENT) { + gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, dest); + } + else if (mode == TREEVIEW_AREA_TOOLBAR) { + gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, dest); + } +} + +/** + * Callback to return the tree window dimensions to the treeview system. + * + * \param *width Return the window width. + * \param *height Return the window height. + * \param *pw The treeview object to use. + */ + +void atari_treeview_get_dimensions(int *width, int *height, + void *pw) +{ + if (pw != NULL && (width != NULL || height != NULL)) { + NSTREEVIEW tv = (NSTREEVIEW) pw; + GRECT work; + atari_treeview_get_grect(tv, TREEVIEW_AREA_CONTENT, &work); + *width = work.g_w; + *height = work.g_h; + } +} + + +/** + * Translates a content_type to the name of a respective icon + * + * \param content_type content type + * \param buffer buffer for the icon name + */ +void tree_icon_name_from_content_type(char *buffer, content_type type) +{ + switch (type) { + case CONTENT_HTML: + case CONTENT_TEXTPLAIN: + case CONTENT_CSS: + case CONTENT_IMAGE: + default: + strcpy( buffer, "content.png" ); + break; + } +} diff --git a/atari/treeview.h b/atari/treeview.h index 3796665af..664b3a4d1 100755 --- a/atari/treeview.h +++ b/atari/treeview.h @@ -1,53 +1,55 @@ -/*
- * 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_ATARI_TREEVIEW_H
-#define NS_ATARI_TREEVIEW_H
-
-#include <stdbool.h>
-#include <windom.h>
-#include "desktop/tree.h"
-#include "atari/gui.h"
-
-#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | LFARROW | RTARROW)
-
-struct atari_treeview
-{
- struct tree * tree;
- WINDOW * window;
- bool disposing;
- bool redraw;
- GRECT rdw_area;
- POINT click;
- POINT extent;
- POINT startdrag;
-};
-
-typedef struct atari_treeview * NSTREEVIEW;
-
-NSTREEVIEW atari_treeview_create( uint32_t flags, WINDOW * win );
-void atari_treeview_destroy( NSTREEVIEW tv );
-void atari_treeview_open( NSTREEVIEW tv );
-void atari_treeview_close( NSTREEVIEW tv );
-void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw);
-void atari_treeview_redraw( NSTREEVIEW tv );
-bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y);
-
-
-
+/* + * 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_ATARI_TREEVIEW_H +#define NS_ATARI_TREEVIEW_H + +#include <stdbool.h> +#include "desktop/tree.h" +#include "atari/gui.h" +#include "atari/gemtk/gemtk.h" + +#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | LFARROW | RTARROW) + +struct atari_treeview +{ + struct tree * tree; + GUIWIN * window; + bool disposing; + bool redraw; + GRECT rdw_area; + POINT extent; + POINT click; + POINT startdrag; + gemtk_wm_event_handler_f user_func; +}; + +typedef struct atari_treeview * NSTREEVIEW; + +NSTREEVIEW atari_treeview_create( uint32_t flags, GUIWIN *win, + gemtk_wm_event_handler_f user_func); +void atari_treeview_destroy( NSTREEVIEW tv ); +void atari_treeview_open( NSTREEVIEW tv ); +void atari_treeview_close( NSTREEVIEW tv ); +void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw); +void atari_treeview_redraw( NSTREEVIEW tv ); +bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y); + + + #endif |