From e042008f2b7295243d2e6c72f948febe3cad0516 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sun, 18 Nov 2012 23:15:48 +0100 Subject: Revert "Refactored menu event handling and got rid of several windom calls." This reverts commit d1a5c738e62a9f0cb85658b435eefa8749006edc. this change belongs into a new branch --- atari/gui.c | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) (limited to 'atari/gui.c') diff --git a/atari/gui.c b/atari/gui.c index fdcb75275..c2158e05e 100755 --- a/atari/gui.c +++ b/atari/gui.c @@ -73,8 +73,7 @@ #include "atari/plot/plot.h" #include "atari/clipboard.h" #include "atari/osspec.h" -#include "atari/search.h" -#include "atari/deskmenu.h" +#include "atari/search.h" #include "cflib.h" #define TODO() (0)/*printf("%s Unimplemented!\n", __FUNCTION__)*/ @@ -83,8 +82,9 @@ char *tmp_clipboard; struct gui_window *input_window = NULL; struct gui_window *window_list = NULL; void * h_gem_rsrc; -//OBJECT **rsc_trindex; -//short rsc_ntree; +OBJECT * h_gem_menu; +OBJECT **rsc_trindex; +short rsc_ntree; long next_poll; bool rendering = false; @@ -789,8 +789,6 @@ void gui_quit(void) struct gui_window * gw = window_list; struct gui_window * tmp = window_list; - - unbind_global_events(); while( gw ) { tmp = gw->next; @@ -804,8 +802,10 @@ void gui_quit(void) urldb_save_cookies(nsoption_charp(cookie_file)); urldb_save(nsoption_charp(url_file)); - - deskmenu_destroy(); + + RsrcXtype( 0, rsc_trindex, rsc_ntree); + unbind_global_events(); + MenuBar( h_gem_menu , 0 ); if( h_gem_rsrc != NULL ) { RsrcXfree(h_gem_rsrc ); } @@ -885,8 +885,7 @@ 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; @@ -929,18 +928,16 @@ static void gui_init(int argc, char** argv) 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!"); - } - //h_gem_rsrc = RsrcXload( (char*) &buf ); + 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; + 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; - //RsrcXtype( RSRC_XTYPE, rsc_trindex, rsc_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 ); @@ -984,19 +981,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)); - tree_set_icon_dir( nsoption_charp(tree_icons_path) ); + plot_init(nsoption_charp(atari_font_driver)); } static char *theapp = (char*)"NetSurf"; static void gui_init2(int argc, char** argv) { - deskmenu_init(); + 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 "); - } - bind_global_events(); + } + tree_set_icon_dir( nsoption_charp(tree_icons_path) ); global_history_init(); hotlist_init(); toolbar_init(); -- cgit v1.2.3