diff options
author | Ole Loots <ole@monochrom.net> | 2013-01-07 20:04:44 +0100 |
---|---|---|
committer | Ole Loots <ole@monochrom.net> | 2013-01-07 20:04:44 +0100 |
commit | 0bbccaa9359b3cedf9f37cd8e322edc90240a7bc (patch) | |
tree | 3161618fdbc1f716d8949c60605a1427f92451a2 | |
parent | 5acf36b89ecda31515de975be85197e0a4395db7 (diff) | |
download | netsurf-0bbccaa9359b3cedf9f37cd8e322edc90240a7bc.tar.gz netsurf-0bbccaa9359b3cedf9f37cd8e322edc90240a7bc.tar.bz2 |
Finally it compiles without WinDom - still some things to bring back:
- Serch window
- Pop Menus in the settings dialog
-rw-r--r-- | atari/Makefile.target | 3 | ||||
-rw-r--r-- | atari/ctxmenu.c | 66 | ||||
-rw-r--r-- | atari/deskmenu.c | 15 | ||||
-rwxr-xr-x | atari/download.c | 30 | ||||
-rwxr-xr-x | atari/gemtk/dragdrop.c | 1 | ||||
-rw-r--r-- | atari/gemtk/gemtk.h | 9 | ||||
-rw-r--r-- | atari/gemtk/objc.c | 48 | ||||
-rw-r--r-- | atari/gemtk/utils.c | 86 | ||||
-rwxr-xr-x | atari/gui.c | 56 | ||||
-rwxr-xr-x | atari/misc.c | 27 | ||||
-rwxr-xr-x | atari/misc.h | 2 | ||||
-rw-r--r-- | atari/osspec.c | 1 | ||||
-rw-r--r-- | atari/plot/font_internal.c | 2 | ||||
-rwxr-xr-x | atari/plot/plot.c | 33 | ||||
-rwxr-xr-x | atari/plot/plot.h | 1 | ||||
-rw-r--r-- | atari/redrawslots.c | 3 | ||||
-rwxr-xr-x | atari/res/netsurf.rsc | bin | 38600 -> 38600 bytes | |||
-rwxr-xr-x | atari/res/netsurf.rsm | 4 | ||||
-rwxr-xr-x | atari/rootwin.c | 24 | ||||
-rw-r--r-- | atari/search.c | 65 | ||||
-rw-r--r-- | atari/settings.c | 45 | ||||
-rwxr-xr-x | atari/treeview.c | 19 |
22 files changed, 322 insertions, 218 deletions
diff --git a/atari/Makefile.target b/atari/Makefile.target index e8c51f0ea..169e3c742 100644 --- a/atari/Makefile.target +++ b/atari/Makefile.target @@ -68,7 +68,7 @@ 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 @@ -85,7 +85,6 @@ S_ATARI := \ download.c \ thumbnail.c \ login.c \ - verify_ssl.c \ treeview.c \ hotlist.c \ history.c\ diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c index 664556463..ada4d76dc 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"
@@ -125,7 +124,8 @@ 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 );
if (pop == NULL)
@@ -136,37 +136,41 @@ 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 = get_tree(POP_CTX); + pop_menu.mn_menu = 0; + pop_menu.mn_item = POP_CTX_CUT_SEL; + pop_menu.mn_scroll = SCROLL_LISTBOX; + 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 );
@@ -243,6 +247,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, '\\'); @@ -250,16 +255,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 index c6e7f27a9..c01c50312 100644 --- a/atari/deskmenu.c +++ b/atari/deskmenu.c @@ -39,7 +39,7 @@ struct s_menu_item_evnt { }; static void register_menu_str(struct s_menu_item_evnt * mi); -static void __CDECL evnt_menu(WINDOW * win, short buff[8]); +//static void __CDECL evnt_menu(WINDOW * win, short buff[8]); extern void *h_gem_rsrc; extern bool html_redraw_debug; @@ -152,12 +152,13 @@ static void register_menu_str( struct s_menu_item_evnt * mi ) { assert(h_gem_menu != NULL); - 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; + int i, l=0, x=-1; + char str[255]; + get_string(h_gem_menu, mi->rid, NULL); + + i = l = strlen(str); while (i > 2) { if( str[i] == '['){ x = i; @@ -208,7 +209,7 @@ static void register_menu_str( struct s_menu_item_evnt * mi ) } } } - +/* static void __CDECL evnt_menu(WINDOW * win, short buff[8])
{
int title = buff[3];
@@ -219,6 +220,7 @@ static void __CDECL evnt_menu(WINDOW * win, short buff[8]) deskmenu_dispatch_item(buff[3], buff[4]); } +*/ /* Menu item event handlers: @@ -524,7 +526,6 @@ void deskmenu_init(void) /* 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] ); /* Update menu string if not null: */ if( menu_evnt_tbl[i].menustr != NULL ){ diff --git a/atari/download.c b/atari/download.c index c01ac805f..4dcc5cb1e 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"
@@ -142,11 +141,11 @@ static void on_redraw(struct gui_download_window *dw, GRECT *clip) 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 |= (SELECTED | CROSSED); + tree[DOWNLOAD_CB_CLOSE_RDY].ob_state |= (OS_SELECTED | OS_CROSSED); } else { - tree[DOWNLOAD_CB_CLOSE_RDY].ob_state &= ~(SELECTED | CROSSED); + tree[DOWNLOAD_CB_CLOSE_RDY].ob_state &= ~(OS_SELECTED | OS_CROSSED); } - tree[DOWNLOAD_BT_ABORT].ob_state &= ~SELECTED; + 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); @@ -218,19 +217,20 @@ 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,
diff --git a/atari/gemtk/dragdrop.c b/atari/gemtk/dragdrop.c index d9fd9c723..e4ae2da4d 100755 --- a/atari/gemtk/dragdrop.c +++ b/atari/gemtk/dragdrop.c @@ -18,7 +18,6 @@ #include <string.h> #include <stdio.h> -//#include "windom.h" #include "gemtk.h" #include "cflib.h" diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h index ee4ebc0c0..01588dc63 100644 --- a/atari/gemtk/gemtk.h +++ b/atari/gemtk/gemtk.h @@ -39,6 +39,12 @@ unsigned short _systype (void); */ bool rc_intersect_ro(GRECT *a, GRECT *b); +/* +* Convert keycode returned by evnt_multi to ascii value +*/ +int keybd2ascii( int keybd, int shift); + + #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)) @@ -183,8 +189,9 @@ void guiwin_clear(GUIWIN *win); /* -------------------------------------------------------------------------- */ /* AES OBJECT TREE TOOLS */ /* -------------------------------------------------------------------------- */ - +char *get_text(OBJECT * tree, short idx); GRECT * obj_screen_rect(OBJECT * tree, short obj); bool obj_is_inside(OBJECT * tree, short obj, GRECT *area); OBJECT *get_tree(int idx); +void obj_mouse_sprite(OBJECT *tree, int index); #endif // GEMTK_H_INCLUDED diff --git a/atari/gemtk/objc.c b/atari/gemtk/objc.c index 90c4d88ac..3bf8ebbe0 100644 --- a/atari/gemtk/objc.c +++ b/atari/gemtk/objc.c @@ -23,6 +23,31 @@ #include "gemtk.h"
+char *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); +} OBJECT *get_tree(int idx) {
@@ -56,3 +81,26 @@ GRECT * obj_screen_rect(OBJECT * tree, short obj) return(&obj_screen); } + + +void 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); +} diff --git a/atari/gemtk/utils.c b/atari/gemtk/utils.c index d365aefb5..3fc668a06 100644 --- a/atari/gemtk/utils.c +++ b/atari/gemtk/utils.c @@ -4,47 +4,63 @@ #include <gem.h> #include "gemtk.h" -/* -------------------------------------------------------------------------- */
-/* GEM Utillity functions: */
/* -------------------------------------------------------------------------- */ +/* GEM Utillity functions: */ +/* -------------------------------------------------------------------------- */ + +unsigned short _systype_v; +unsigned short _systype (void) +{ + int32_t * cptr = NULL; + _systype_v = SYS_TOS; -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;
+ 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 rc_intersect_ro(GRECT *a, GRECT *b) { - GRECT r1, r2; + GRECT r1, r2; + + r1 = *a; + r2 = *b; + + return((bool)rc_intersect(&r1, &r2)); +} + - r1 = *a; - r2 = *b; +typedef struct { + char *unshift; + char *shift; + char *capslock; +} MY_KEYTAB; - return((bool)rc_intersect(&r1, &r2)); +int keybd2ascii( int keybd, int shift) +{ + + MY_KEYTAB *key; + key = (MY_KEYTAB *)Keytbl( (char*)-1, (char*)-1, (char*)-1); + return (shift)?key->shift[keybd>>8]:key->unshift[keybd>>8]; } + diff --git a/atari/gui.c b/atari/gui.c index e5038dcf1..164ab312c 100755 --- a/atari/gui.c +++ b/atari/gui.c @@ -28,7 +28,6 @@ #include <unistd.h> #include <string.h> #include <stdbool.h> -#include <windom.h> #include <hubbub/hubbub.h> #include "content/urldb.h" @@ -63,7 +62,6 @@ #include "atari/rootwin.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" @@ -562,8 +560,9 @@ void gui_window_set_url(struct gui_window *w, const 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) @@ -851,10 +850,7 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, 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; @@ -921,7 +917,8 @@ process_cmdline(int argc, char** argv) 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) { + if (option_window_width <= desk_area.g_w + && option_window_height < desk_area.g_h) { set_default_dimensions = false; } } @@ -929,10 +926,10 @@ process_cmdline(int argc, char** argv) 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); + 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; @@ -1019,6 +1016,8 @@ static void gui_init(int argc, char** argv) 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); @@ -1060,16 +1059,19 @@ static void gui_init(int argc, char** argv) 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)); - wind_get_grect(0, WF_WORKXYWH, &desk_area); 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); - + //next_poll = clock() + (CLOCKS_PER_SEC>>3); } static char *theapp = (char*)"NetSurf"; @@ -1103,26 +1105,40 @@ int main(int argc, char** argv) freopen("stdout.log", "a+", stdout); freopen("stderr.log", "a+", stderr); #endif - // todo: replace with appl_init - ApplInit(); - gl_apid = _AESapid; + 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); - browser_window_create(option_homepage_url, 0, 0, true, false); + 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")); - ApplExit(); #ifdef WITH_DBG_LOGFILE fclose(stdout); fclose(stderr); #endif + exit_gem(); return 0; } diff --git a/atari/misc.c b/atari/misc.c index 27c68b664..21b636e2a 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,7 +36,8 @@ #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"
@@ -321,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 ) { + obj_mouse_sprite(cursor->tree, cursor->number);
} else {
graf_mouse(cursor->number, NULL );
}
@@ -472,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]; @@ -481,26 +483,21 @@ 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)) { + if (select_file(path, tmpname, (char*)"*", use_title, NULL)) { snprintf(fullname, PATH_MAX, "%s%s", path, tmpname); - return( (const char*)&fullname ); + 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(const char * str, GRECT * r)
{
printf("%s: x: %d, y: %d, w: %d, h: %d (x2: %d, y2: %d)\n", str,
diff --git a/atari/misc.h b/atari/misc.h index b59f19dd7..677f8f69b 100755 --- a/atari/misc.h +++ b/atari/misc.h @@ -19,7 +19,6 @@ #ifndef NS_ATARI_MISC_H #define NS_ATARI_MISC_H -#include <windom.h> #include "cflib.h" #include "content/content.h" #include "content/hlcache.h" @@ -49,7 +48,6 @@ void gem_set_cursor( MFORM_EX * cursor ); hlcache_handle *load_icon( const char *name, hlcache_handle_callback cb, void * pw ); void dbg_grect(const char * str, GRECT * r); -void dbg_lgrect( char * str, LGRECT * r); void dbg_pxy(const char * str, short * pxy); void dbg_rect(const char * str, int * pxy); void * ldg_open( char * name, short * global ); diff --git a/atari/osspec.c b/atari/osspec.c index c2e2252dd..ada1e05c4 100644 --- a/atari/osspec.c +++ b/atari/osspec.c @@ -25,7 +25,6 @@ #include <string.h>
#include <mint/osbind.h>
#include <mint/cookie.h>
-#include <windom.h>
#include "utils/log.h"
#include "atari/osspec.h" diff --git a/atari/plot/font_internal.c b/atari/plot/font_internal.c index 4edec4565..6e6e330ef 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;
diff --git a/atari/plot/plot.c b/atari/plot/plot.c index 9d1ba80fc..71382db2b 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 */ @@ -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; @@ -740,7 +743,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 ); @@ -757,7 +760,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; @@ -767,7 +770,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 ); } @@ -1445,7 +1448,7 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, MFDB screen, tran; MFDB * src; short pxy[8]; - short c[2] = {fgcolor, WHITE}; + short c[2] = {fgcolor, G_WHITE}; GRECT off; plot_get_clip_grect(&off); @@ -1515,7 +1518,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) ; @@ -1530,7 +1541,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; @@ -1557,14 +1568,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: @@ -1573,7 +1584,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]; diff --git a/atari/plot/plot.h b/atari/plot/plot.h index 0c1db0f7a..df34be4d5 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> diff --git a/atari/redrawslots.c b/atari/redrawslots.c index fdc35554a..496faac75 100644 --- a/atari/redrawslots.c +++ b/atari/redrawslots.c @@ -17,10 +17,11 @@ */ #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! diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc Binary files differindex 2ead38de5..127dee913 100755 --- a/atari/res/netsurf.rsc +++ b/atari/res/netsurf.rsc diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm index b759953f6..954750256 100755 --- a/atari/res/netsurf.rsm +++ b/atari/res/netsurf.rsm @@ -3,7 +3,7 @@ ResourceMaster v3.65 #N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
#R 0@0@2@1@2@1@
-#M 20010100@0@7728@629@
+#M 20010100@0@7728@630@
#T 0@1@MAINMENU@@62@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -238,4 +238,4 @@ ResourceMaster v3.65 #O 92@29@EDIT_CA_BUNDLE@@
#O 93@29@EDIT_CA_CERTS_PATH@@
#O 94@29@EDIT_EDITOR@@
-#c 20608@
+#c 20720@
diff --git a/atari/rootwin.c b/atari/rootwin.c index f902286bc..84591c3cd 100755 --- a/atari/rootwin.c +++ b/atari/rootwin.c @@ -30,11 +30,12 @@ #include <string.h> #include <stdlib.h> #include <stdbool.h> -#include <windom.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" @@ -67,6 +68,7 @@ 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; @@ -231,8 +233,8 @@ int window_create(struct gui_window * gw, redraw_slots_init(&gw->root->redraw_slots, 8); - // TODO: use desk size - gw->root->aes_handle = wind_create(flags, 40, 40, app.w, app.h); + 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); @@ -245,8 +247,8 @@ int window_create(struct gui_window * gw, data->rootwin = gw->root; guiwin_set_user_data(gw->root->win, (void*)data); struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(gw->root->win); - slid->y_unit_px = 16; - slid->x_unit_px = 16; + slid->y_unit_px = 32; + slid->x_unit_px = 32; /* create toolbar component: */ guiwin_set_toolbar(gw->root->win, get_tree(TOOLBAR), 0, 0); @@ -277,7 +279,7 @@ int window_create(struct gui_window * gw, } // Setup some window defaults: - wind_set_str(gw->root->aes_handle, WF_ICONTITLE, (char*)"NetSurf"); + 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); @@ -351,7 +353,6 @@ int window_destroy(ROOTWIN *rootwin) } - void window_open(ROOTWIN *rootwin, GRECT pos) { GRECT br, g; @@ -375,7 +376,6 @@ void window_open(ROOTWIN *rootwin, GRECT pos) } - /* update back forward buttons (see tb_update_buttons (bug) ) */ void window_update_back_forward(struct s_gui_win_root *rootwin) { @@ -423,12 +423,17 @@ void window_scroll_by(ROOTWIN *root, int sx, int sy) guiwin_update_slider(root->win, GUIWIN_VH_SLIDER); } +/** +* Set the dimensions of the scrollable content. +* +*/ void window_set_content_size(ROOTWIN *rootwin, int width, int height) { GRECT area; struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(rootwin->win); guiwin_get_grect(rootwin->win, GUIWIN_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) @@ -436,7 +441,6 @@ void window_set_content_size(ROOTWIN *rootwin, int width, int height) if(slid->y_units < slid->y_pos) slid->y_pos = 0; guiwin_update_slider(rootwin->win, GUIWIN_VH_SLIDER); - // TODO: reset slider to 0 } /* set focus to an arbitary element */ @@ -684,7 +688,7 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int content_x, int i, scroll_x, scroll_y; uint16_t *fd_addr; struct guiwin_scroll_info_s *slid; - short colors[2] = {BLACK, WHITE}; + short colors[2] = {G_BLACK, G_WHITE}; bool render_required = false; // avoid duplicate draw of the caret: diff --git a/atari/search.c b/atari/search.c index a8bde07ce..0b2ed2b05 100644 --- a/atari/search.c +++ b/atari/search.c @@ -29,7 +29,6 @@ #include <string.h>
#include <stdbool.h>
#include <assert.h>
-#include <windom.h>
#include "desktop/gui.h"
#include "desktop/browser.h"
@@ -140,6 +139,23 @@ 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)
{
@@ -151,27 +167,27 @@ static void destroy_search_session(SEARCH_FORM_SESSION s) static int apply_form(GUIWIN *win, struct s_search_form_state * s)
{
- OBJECT * obj = dlgtree;
+ OBJECT * obj = dlgtree; + char * cstr; +
if( obj == NULL ){
goto error;
- }
+ } +
s->flags = 0;
- if( (obj[SEARCH_CB_FWD].ob_state & SELECTED) != 0 )
+ if( (obj[SEARCH_CB_FWD].ob_state & OS_SELECTED) != 0 )
s->flags = SEARCH_FLAG_FORWARDS;
- if( (obj[SEARCH_CB_CASESENSE].ob_state & SELECTED) != 0 )
+ if( (obj[SEARCH_CB_CASESENSE].ob_state & OS_SELECTED) != 0 )
s->flags |= SEARCH_FLAG_CASE_SENSITIVE;
- if( (obj[SEARCH_CB_SHOWALL].ob_state & SELECTED) != 0 )
+ if( (obj[SEARCH_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 = get_text(dlgtree, SEARCH_TB_SRCH); + snprintf(s->text, 31, "%s", cstr); return ( 0 );
error:
s->flags = SEARCH_FLAG_FORWARDS;
- /* s->forward = true; */
strncpy((char*)&s->text[0], "", 31 );
return( 1 );
}
@@ -183,9 +199,9 @@ static bool form_changed(GUIWIN * w) struct s_search_form_state cur;
SEARCH_FORM_SESSION s = get_search_session(w);
if( s == NULL )
- return false;
- OBJECT * obj = (OC_FORM, w);
- assert( s != NULL && obj != NULL );
+ return false; + OBJECT * obj = dlgtree;
+ assert(s != NULL && obj != NULL);
uint32_t flags_old = s->state.flags;
apply_form(w, &cur);
@@ -196,7 +212,8 @@ static bool form_changed(GUIWIN * w) return( true );
}
- char * cstr = ObjcString( obj, SEARCH_TB_SRCH, NULL );
+ char * cstr; + cstr = get_text(obj, SEARCH_TB_SRCH);
if (cstr != NULL){
if (strcmp(cstr, (char*)&s->state.text) != 0) {
return (true);
@@ -207,7 +224,7 @@ static bool form_changed(GUIWIN * w) }
-static void __CDECL evnt_bt_srch_click( WINDOW *win, int index, int unused, void *unused2)
+static void __CDECL evnt_bt_srch_click(GUIWIN * win, int index, int unused, void *unused2)
{
bool fwd;
@@ -215,31 +232,31 @@ static void __CDECL evnt_bt_srch_click( WINDOW *win, int index, int unused, void OBJECT * obj = dlgtree;
search_flags_t flags = 0;
- ObjcChange(OC_FORM, win, index, ~SELECTED , TRUE);
+
if( form_changed(searchwin) ){
browser_window_search_destroy_context(s->bw);
- apply_form(searchwin, &s->state );
+ apply_form(searchwin, &s->state);
} else {
/* get search direction manually: */
- if( (obj[SEARCH_CB_FWD].ob_state & SELECTED) != 0 )
+ 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, ObjcString( obj, SEARCH_TB_SRCH, NULL ) );
+ browser_window_search_step(s->bw, s->state.flags, get_text(obj, SEARCH_TB_SRCH));
}
}
-static void __CDECL evnt_cb_click( WINDOW *win, int index, int unused, void *unused2)
+static void __CDECL evnt_cb_click(GUIWIN *win, int index, int unused, void *unused2)
{
short newstate;
}
-static void __CDECL evnt_close( WINDOW *win, short buff[8])
+static void __CDECL evnt_close(GUIWIN *win, short buff[8])
{
}
@@ -322,7 +339,7 @@ SEARCH_FORM_SESSION open_browser_search(struct gui_window * gw) EvntAdd(sfs->formwind, WM_CLOSED, evnt_close, EV_TOP);
*/ apply_form(searchwin, &sfs->state ); - set_string(dlgtree, SEARCH_TB_SRCH, "");
+ set_text(SEARCH_TB_SRCH, "", 31);
return( current );
diff --git a/atari/settings.c b/atari/settings.c index c5cc3ae52..cee3ec9f2 100644 --- a/atari/settings.c +++ b/atari/settings.c @@ -95,33 +95,7 @@ static void set_text( short idx, char * text, int len ) set_string( dlgtree, idx, spare);
} - - -static char *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); -}
+
/**
@@ -297,7 +271,8 @@ static void form_event(int index, int external) 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; @@ -351,17 +326,20 @@ static void form_event(int index, int external) case SETTINGS_BT_SEL_FONT_RENDERER:
if( external ){
- objc_offset(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER, &x, &y);
+ objc_offset(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER, &x, &y); + // TODO: add menu popup + /*
choice = MenuPopUp (font_driver_items, x, y,
num_font_drivers,
- -1, -1, P_LIST + P_WNDW + P_CHCK );
+ -1, -1, P_LIST + P_WNDW + P_CHCK);
if( choice > 0 &&
choice <= num_font_drivers ){ set_text(SETTINGS_BT_SEL_FONT_RENDERER, (char*)font_driver_items[choice-1], LABEL_FONT_RENDERER_MAX_LEN); OBJ_REDRAW(SETTINGS_BT_SEL_FONT_RENDERER);
- }
+ } + */
}
tmp = get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER);
if( strcmp(tmp, "freetype") == 0 ){
@@ -372,13 +350,16 @@ static void form_event(int index, int external) break;
case SETTINGS_BT_SEL_LOCALE:
- objc_offset(dlgtree, SETTINGS_BT_SEL_LOCALE, &x, &y);
+ objc_offset(dlgtree, SETTINGS_BT_SEL_LOCALE, &x, &y); + // TODO: open locales popup + /*
choice = MenuPopUp ( locales, x, y,
num_locales,
-1, -1, P_LIST + P_WNDW + P_CHCK );
if( choice > 0 && choice <= num_locales ){ set_text(SETTINGS_BT_SEL_LOCALE, (char*)locales[choice-1], 5);
} + */ OBJ_REDRAW(SETTINGS_BT_SEL_LOCALE);
break;
diff --git a/atari/treeview.c b/atari/treeview.c index 52859e306..e865de527 100755 --- a/atari/treeview.c +++ b/atari/treeview.c @@ -176,33 +176,32 @@ static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT *ev_out, { struct guiwin_scroll_info_s *slid; GRECT work; + short mx, my; if(tv == NULL) return; - if( evnt.mbut & 2 ) { - /* do not handle right click */ - return; - } guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work); slid = guiwin_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 = (ev_out->emo_mouse.p_x-work.g_x) + + short origin_rel_x = (mx-work.g_x) + (slid->x_pos*slid->x_unit_px); - short origin_rel_y = (ev_out->emo_mouse.p_y-work.g_y) + + short origin_rel_y = (my-work.g_y) + (slid->y_pos*slid->y_unit_px); 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 ) + && 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( evnt.nb_click == 2 ){ + 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 ); @@ -212,7 +211,7 @@ static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT *ev_out, 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 ) { + if(ev_out->emo_mclicks == 2 ) { bms = BROWSER_MOUSE_DOUBLE_CLICK; } tree_mouse_action(tv->tree, bms, origin_rel_x, origin_rel_y ); |