From d1a5c738e62a9f0cb85658b435eefa8749006edc Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Wed, 14 Nov 2012 21:37:35 +0100 Subject: Refactored menu event handling and got rid of several windom calls. --- atari/gui.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'atari/gui.c') diff --git a/atari/gui.c b/atari/gui.c index c2158e05e..fdcb75275 100755 --- a/atari/gui.c +++ b/atari/gui.c @@ -73,7 +73,8 @@ #include "atari/plot/plot.h" #include "atari/clipboard.h" #include "atari/osspec.h" -#include "atari/search.h" +#include "atari/search.h" +#include "atari/deskmenu.h" #include "cflib.h" #define TODO() (0)/*printf("%s Unimplemented!\n", __FUNCTION__)*/ @@ -82,9 +83,8 @@ char *tmp_clipboard; 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; +//OBJECT **rsc_trindex; +//short rsc_ntree; long next_poll; bool rendering = false; @@ -789,6 +789,8 @@ void gui_quit(void) struct gui_window * gw = window_list; struct gui_window * tmp = window_list; + + unbind_global_events(); while( gw ) { tmp = gw->next; @@ -802,10 +804,8 @@ void gui_quit(void) 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 ); + + deskmenu_destroy(); if( h_gem_rsrc != NULL ) { RsrcXfree(h_gem_rsrc ); } @@ -885,7 +885,8 @@ process_cmdline(int argc, char** argv) return true; } -static inline void create_cursor(int flags, short mode, void * form, MFORM_EX * m) +static inline void create_cursor(int flags, short mode, void * form, + MFORM_EX * m) { m->flags = flags; m->number = mode; @@ -928,16 +929,18 @@ static void gui_init(int argc, char** argv) OBJECT * cursors; atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc"); - LOG(("%s ", (char*)&buf)); - h_gem_rsrc = RsrcXload( (char*) &buf ); + LOG(("%s ", (char*)&buf)); + if (rsrc_load(buf)==0) { + die("Uable to open GEM Resource file!"); + } + //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; + //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); + //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 ); @@ -981,19 +984,19 @@ static void gui_init(int argc, char** argv) die("unable to process command line.\n"); nkc_init(); - plot_init(nsoption_charp(atari_font_driver)); + plot_init(nsoption_charp(atari_font_driver)); + tree_set_icon_dir( nsoption_charp(tree_icons_path) ); } static char *theapp = (char*)"NetSurf"; static void gui_init2(int argc, char** argv) { - MenuBar( h_gem_menu , 1 ); - bind_global_events(); + deskmenu_init(); 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) ); + } + bind_global_events(); global_history_init(); hotlist_init(); toolbar_init(); -- cgit v1.2.3