mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-03 01:34:25 +03:00
Fix line endings.
This commit is contained in:
parent
1b0a968f1c
commit
99e0cfbd1f
632
atari/deskmenu.c
632
atari/deskmenu.c
@ -1,20 +1,20 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
/*
|
||||
* 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 <stdlib.h>
|
||||
#include <cflib.h>
|
||||
@ -44,19 +44,19 @@
|
||||
|
||||
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_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;
|
||||
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);
|
||||
@ -67,23 +67,23 @@ 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_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: */
|
||||
|
||||
/* 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
|
||||
|
||||
|
||||
@ -119,50 +119,50 @@ static void __CDECL menu_cookies(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},
|
||||
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_INC_SCALE, menu_inc_scale, {'+',0,K_CTRL}, NULL},
|
||||
{T_VIEW, MAINMENU_DEC_SCALE, menu_dec_scale, {'-',0,K_CTRL}, 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_DEC_SCALE, menu_dec_scale, {'-',0,K_CTRL}, 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,0,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_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,0,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_COOKIES, menu_cookies, {0,0,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 }
|
||||
{T_UTIL, MAINMENU_M_COOKIES, menu_cookies, {0,0,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;
|
||||
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]);
|
||||
@ -172,18 +172,18 @@ static void __CDECL evnt_menu(WINDOW * win, short buff[8])
|
||||
/*
|
||||
Menu item event handlers:
|
||||
*/
|
||||
|
||||
static void __CDECL menu_about(short item, short title, void *data)
|
||||
|
||||
static void __CDECL menu_about(short item, short title, void *data)
|
||||
{
|
||||
/*
|
||||
/*
|
||||
nsurl *url;
|
||||
nserror error;
|
||||
char buf[PATH_MAX];
|
||||
char buf[PATH_MAX];
|
||||
|
||||
LOG(("%s", __FUNCTION__));
|
||||
strcpy((char*)&buf, "file://");
|
||||
LOG(("%s", __FUNCTION__));
|
||||
strcpy((char*)&buf, "file://");
|
||||
strncat((char*)&buf, (char*)"./doc/README.TXT",
|
||||
PATH_MAX - (strlen("file://")+1) );
|
||||
PATH_MAX - (strlen("file://")+1) );
|
||||
|
||||
error = nsurl_create(buf, &url);
|
||||
if (error == NSERROR_OK) {
|
||||
@ -199,15 +199,15 @@ static void __CDECL menu_about(short item, short title, void *data)
|
||||
}
|
||||
*/
|
||||
atari_about_show();
|
||||
}
|
||||
|
||||
static void __CDECL menu_new_win(short item, short title, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
static void __CDECL menu_new_win(short item, short title, void *data)
|
||||
{
|
||||
nsurl *url;
|
||||
nserror error;
|
||||
const char *addr;
|
||||
|
||||
LOG(("%s", __FUNCTION__));
|
||||
LOG(("%s", __FUNCTION__));
|
||||
|
||||
if (nsoption_charp(homepage_url) != NULL) {
|
||||
addr = nsoption_charp(homepage_url);
|
||||
@ -229,16 +229,16 @@ static void __CDECL menu_new_win(short item, short title, void *data)
|
||||
if (error != NSERROR_OK) {
|
||||
warn_user(messages_get_errorcode(error), 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void __CDECL menu_open_url(short item, short title, void *data)
|
||||
{
|
||||
struct gui_window * gw;
|
||||
struct browser_window * bw ;
|
||||
}
|
||||
|
||||
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 ) {
|
||||
|
||||
gw = input_window;
|
||||
if( gw == NULL ) {
|
||||
browser_window_create(BW_CREATE_HISTORY,
|
||||
NULL,
|
||||
NULL,
|
||||
@ -253,12 +253,12 @@ static void __CDECL menu_open_url(short item, short title, void *data)
|
||||
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)
|
||||
toolbar_key_input(gw->root->toolbar, NK_DEL);
|
||||
}
|
||||
|
||||
static void __CDECL menu_open_file(short item, short title, void *data)
|
||||
{
|
||||
|
||||
|
||||
LOG(("%s", __FUNCTION__));
|
||||
|
||||
const char * filename = file_select(messages_get("OpenFile"), "");
|
||||
@ -284,18 +284,18 @@ static void __CDECL menu_open_file(short item, short title, void *data)
|
||||
free( urltxt );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
@ -319,41 +319,41 @@ static void __CDECL menu_save_page(short item, short title, void *data)
|
||||
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__));
|
||||
gemtk_wm_send_msg(NULL, AP_TERM, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
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 void __CDECL menu_quit(short item, short title, void *data)
|
||||
{
|
||||
static bool visible = false;
|
||||
LOG(("%s", __FUNCTION__));
|
||||
short buff[8];
|
||||
memset( &buff, 0, sizeof(short)*8 );
|
||||
LOG(("%s", __FUNCTION__));
|
||||
gemtk_wm_send_msg(NULL, AP_TERM, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
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);
|
||||
@ -361,72 +361,72 @@ static void __CDECL menu_find(short item, short title, void *data)
|
||||
else {
|
||||
window_open_search(input_window->root, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void __CDECL menu_choices(short item, short title, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
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 )
|
||||
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__));
|
||||
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_inc_scale(short item, short title, void *data)
|
||||
static void __CDECL menu_inc_scale(short item, short title, void *data)
|
||||
{
|
||||
if(input_window == NULL)
|
||||
return;
|
||||
|
||||
gui_window_set_scale(input_window, gui_window_get_scale(input_window)+0.25);
|
||||
}
|
||||
|
||||
|
||||
static void __CDECL menu_dec_scale(short item, short title, void *data)
|
||||
{
|
||||
if(input_window == NULL)
|
||||
if(input_window == NULL)
|
||||
return;
|
||||
|
||||
gui_window_set_scale(input_window, gui_window_get_scale(input_window)-0.25);
|
||||
gui_window_set_scale(input_window, gui_window_get_scale(input_window)+0.25);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void __CDECL menu_toolbars(short item, short title, void *data)
|
||||
|
||||
static void __CDECL menu_dec_scale(short item, short title, void *data)
|
||||
{
|
||||
static int state = 0;
|
||||
if(input_window == NULL)
|
||||
return;
|
||||
|
||||
gui_window_set_scale(input_window, gui_window_get_scale(input_window)-0.25);
|
||||
}
|
||||
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
&rect);
|
||||
option_window_width = rect.g_w;
|
||||
option_window_height = rect.g_h;
|
||||
option_window_x = rect.g_x;
|
||||
@ -437,112 +437,112 @@ static void __CDECL menu_savewin(short item, short title, void *data)
|
||||
nsoption_set_int(window_y, rect.g_y);
|
||||
nsoption_write((const char*)&options, NULL, NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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 ) {
|
||||
|
||||
}
|
||||
|
||||
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) {
|
||||
&& input_window->browser->bw != NULL) {
|
||||
GRECT rect;
|
||||
window_get_grect(input_window->root, BROWSER_AREA_CONTENT, &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);
|
||||
}
|
||||
}
|
||||
(html_redraw_debug) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void __CDECL menu_fg_images(short item, short title, void *data)
|
||||
{
|
||||
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);
|
||||
(nsoption_bool(foreground_images)) ? 1 : 0);
|
||||
}
|
||||
|
||||
static void __CDECL menu_bg_images(short item, short title, void *data)
|
||||
{
|
||||
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);
|
||||
(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__));
|
||||
atari_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__));
|
||||
atari_hotlist_open();
|
||||
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_cookies(short item, short title, void *data)
|
||||
{
|
||||
LOG(("%s", __FUNCTION__));
|
||||
atari_cookie_manager_open();
|
||||
}
|
||||
|
||||
static void __CDECL menu_vlog(short item, short title, void *data)
|
||||
{
|
||||
LOG(("%s", __FUNCTION__));
|
||||
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__));
|
||||
atari_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__));
|
||||
atari_hotlist_open();
|
||||
}
|
||||
|
||||
static void __CDECL menu_cookies(short item, short title, void *data)
|
||||
{
|
||||
LOG(("%s", __FUNCTION__));
|
||||
atari_cookie_manager_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__));
|
||||
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__));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -687,8 +687,8 @@ void deskmenu_init(void)
|
||||
/* Install menu: */
|
||||
menu_bar(h_gem_menu, MENU_INSTALL);
|
||||
|
||||
/* parse and update menu items: */
|
||||
i = 0;
|
||||
/* parse and update menu items: */
|
||||
i = 0;
|
||||
while (menu_evnt_tbl[i].rid != -1) {
|
||||
if(menu_evnt_tbl[i].rid > 0 && menu_evnt_tbl[i].title > 0){
|
||||
register_menu_str( &menu_evnt_tbl[i] );
|
||||
@ -698,7 +698,7 @@ void deskmenu_init(void)
|
||||
menu_evnt_tbl[i].menustr);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
deskmenu_update();
|
||||
/* Redraw menu: */
|
||||
@ -713,14 +713,14 @@ void deskmenu_destroy(void)
|
||||
int i;
|
||||
|
||||
/* Remove menu from desktop: */
|
||||
menu_bar(h_gem_menu, MENU_REMOVE);
|
||||
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++;
|
||||
i=0;
|
||||
while(menu_evnt_tbl[i].rid != -1) {
|
||||
if( menu_evnt_tbl[i].menustr != NULL )
|
||||
free(menu_evnt_tbl[i].menustr);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -747,21 +747,21 @@ int deskmenu_dispatch_item(short title, short item)
|
||||
|
||||
// legacy code, is this sensible?:
|
||||
/*
|
||||
while( gw ) {
|
||||
window_set_focus( gw, WIDGET_NONE, NULL );
|
||||
gw = gw->next;
|
||||
while( gw ) {
|
||||
window_set_focus( gw, WIDGET_NONE, NULL );
|
||||
gw = gw->next;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
while (menu_evnt_tbl[i].rid != -1) {
|
||||
while (menu_evnt_tbl[i].rid != -1) {
|
||||
if (menu_evnt_tbl[i].rid == item) {
|
||||
if (menu_evnt_tbl[i].menu_func != NULL) {
|
||||
if (menu_evnt_tbl[i].menu_func != NULL) {
|
||||
menu_evnt_tbl[i].menu_func(item, title, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return(retval);
|
||||
@ -782,10 +782,10 @@ int deskmenu_dispatch_keypress(unsigned short kcode, unsigned short kstate,
|
||||
sascii = gemtk_keybd2ascii(kcode, K_LSHIFT);
|
||||
}
|
||||
|
||||
/* Iterate through the menu function table: */
|
||||
while( menu_evnt_tbl[i].rid != -1 && done == false) {
|
||||
/* 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) {
|
||||
&& menu_evnt_tbl[i].accel.ascii != 0) {
|
||||
if( menu_evnt_tbl[i].accel.ascii == sascii) {
|
||||
if (menu_evnt_tbl[i].title > 0 && menu_evnt_tbl[i].rid > 0) {
|
||||
deskmenu_dispatch_item(menu_evnt_tbl[i].title,
|
||||
@ -794,15 +794,15 @@ int deskmenu_dispatch_keypress(unsigned short kcode, unsigned short kstate,
|
||||
else {
|
||||
/* Keyboard shortcut not displayed within menu: */
|
||||
menu_evnt_tbl[i].menu_func(0, 0, NULL);
|
||||
}
|
||||
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) {
|
||||
}
|
||||
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) {
|
||||
if (menu_evnt_tbl[i].title > 0 && menu_evnt_tbl[i].rid > 0) {
|
||||
deskmenu_dispatch_item(menu_evnt_tbl[i].title,
|
||||
menu_evnt_tbl[i].rid);
|
||||
@ -810,13 +810,13 @@ int deskmenu_dispatch_keypress(unsigned short kcode, unsigned short kstate,
|
||||
else {
|
||||
/* Keyboard shortcut not displayed within menu: */
|
||||
menu_evnt_tbl[i].menu_func(0, 0, NULL);
|
||||
}
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return((done==true) ? 1 : 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user