NetSurf
Data Structures | Macros | Typedefs | Functions | Variables
deskmenu.c File Reference
#include <stdlib.h>
#include <cflib.h>
#include "utils/log.h"
#include "utils/nsurl.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
#include "utils/utils.h"
#include "netsurf/browser_window.h"
#include "netsurf/keypress.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/cookies.h"
#include "atari/toolbar.h"
#include "atari/settings.h"
#include "atari/misc.h"
#include "atari/gui.h"
#include "atari/findfile.h"
#include "atari/about.h"
#include "atari/plot/plot.h"
#include "atari/rootwin.h"
Include dependency graph for deskmenu.c:

Go to the source code of this file.

Data Structures

struct  s_accelerator
 
struct  s_menu_item_evnt
 

Macros

#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
 
#define NUM_MENU_TITLES   7
 

Typedefs

typedef void __CDECL(* menu_evnt_func) (short item, short title, void *data)
 

Functions

static void register_menu_str (struct s_menu_item_evnt *mi)
 
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_dec_scale (short item, short title, void *data)
 
static void __CDECL menu_inc_scale (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_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)
 
void deskmenu_init (void)
 Setup & display an desktop menu. More...
 
void deskmenu_destroy (void)
 Uninstall the desktop menu. More...
 
OBJECT * deskmenu_get_obj_tree (void)
 Return the deskmenu AES OBJECT tree. More...
 
int deskmenu_dispatch_item (short title, short item)
 Handle an menu item event. More...
 
int deskmenu_dispatch_keypress (unsigned short kcode, unsigned short kstate, unsigned short nkc)
 Handle an keypress (check for accelerator) More...
 
void deskmenu_update (void)
 Refresh the desk menu, reflecting netsurf current state. More...
 

Variables

void * h_gem_rsrc
 
bool html_redraw_debug
 
struct gui_windowinput_window
 
char options [PATH_MAX]
 
const char * option_homepage_url
 
int option_window_width
 
int option_window_height
 
int option_window_x
 
int option_window_y
 
static OBJECT * h_gem_menu
 
struct s_menu_item_evnt menu_evnt_tbl []
 

Macro Definition Documentation

◆ NUM_MENU_TITLES

#define NUM_MENU_TITLES   7

Definition at line 88 of file deskmenu.c.

◆ T_ABOUT

#define T_ABOUT   0

Definition at line 80 of file deskmenu.c.

◆ T_EDIT

#define T_EDIT   MAINMENU_T_EDIT - MAINMENU_T_FILE + 1

Definition at line 82 of file deskmenu.c.

◆ T_FILE

#define T_FILE   MAINMENU_T_FILE - MAINMENU_T_FILE + 1

Definition at line 81 of file deskmenu.c.

◆ T_HELP

#define T_HELP   MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1

Definition at line 86 of file deskmenu.c.

◆ T_NAV

#define T_NAV   MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1

Definition at line 84 of file deskmenu.c.

◆ T_UTIL

#define T_UTIL   MAINMENU_T_UTIL - MAINMENU_T_FILE + 1

Definition at line 85 of file deskmenu.c.

◆ T_VIEW

#define T_VIEW   MAINMENU_T_VIEW - MAINMENU_T_FILE + 1

Definition at line 83 of file deskmenu.c.

Typedef Documentation

◆ menu_evnt_func

typedef void __CDECL(* menu_evnt_func) (short item, short title, void *data)

Definition at line 46 of file deskmenu.c.

Function Documentation

◆ deskmenu_destroy()

void deskmenu_destroy ( void  )

Uninstall the desktop menu.

Definition at line 707 of file deskmenu.c.

References h_gem_menu, and menu_evnt_tbl.

Referenced by gui_quit().

Here is the caller graph for this function:

◆ deskmenu_dispatch_item()

int deskmenu_dispatch_item ( short  title,
short  item 
)

Handle an menu item event.

Definition at line 734 of file deskmenu.c.

References deskmenu_get_obj_tree(), menu_evnt_tbl, and s_menu_item_evnt::menu_func.

Referenced by atari_poll(), and deskmenu_dispatch_keypress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deskmenu_dispatch_keypress()

int deskmenu_dispatch_keypress ( unsigned short  kcode,
unsigned short  kstate,
unsigned short  nkc 
)

Handle an keypress (check for accelerator)

Definition at line 769 of file deskmenu.c.

References s_menu_item_evnt::accel, s_accelerator::ascii, deskmenu_dispatch_item(), menu_evnt_tbl, s_menu_item_evnt::menu_func, and s_accelerator::mod.

Referenced by atari_poll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deskmenu_get_obj_tree()

OBJECT * deskmenu_get_obj_tree ( void  )

Return the deskmenu AES OBJECT tree.

Definition at line 726 of file deskmenu.c.

References h_gem_menu.

Referenced by deskmenu_dispatch_item().

Here is the caller graph for this function:

◆ deskmenu_init()

void deskmenu_init ( void  )

Setup & display an desktop menu.

Definition at line 676 of file deskmenu.c.

References deskmenu_update(), h_gem_menu, menu_evnt_tbl, and register_menu_str().

Referenced by gui_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deskmenu_update()

void deskmenu_update ( void  )

Refresh the desk menu, reflecting netsurf current state.

Definition at line 823 of file deskmenu.c.

References h_gem_menu, html_redraw_debug, nsoption_bool, and verbose_log.

Referenced by deskmenu_init(), and save_settings().

Here is the caller graph for this function:

◆ menu_about()

static void __CDECL menu_about ( short  item,
short  title,
void *  data 
)
static

Definition at line 177 of file deskmenu.c.

References atari_about_show().

Here is the call graph for this function:

◆ menu_add_bookmark()

static void __CDECL menu_add_bookmark ( short  item,
short  title,
void *  data 
)
static

Definition at line 503 of file deskmenu.c.

References atari_hotlist_add_page(), gui_window::browser, browser_window_access_url(), browser_window_has_content(), s_browser::bw, input_window, NSLOG, and nsurl_access().

Here is the call graph for this function:

◆ menu_back()

static void __CDECL menu_back ( short  item,
short  title,
void *  data 
)
static

Definition at line 466 of file deskmenu.c.

References input_window, NSLOG, gui_window::root, s_gui_win_root::toolbar, and toolbar_back_click().

Here is the call graph for this function:

◆ menu_bg_images()

static void __CDECL menu_bg_images ( short  item,
short  title,
void *  data 
)
static

Definition at line 459 of file deskmenu.c.

References h_gem_menu, nsoption_bool, and nsoption_set_bool.

◆ menu_bookmarks()

static void __CDECL menu_bookmarks ( short  item,
short  title,
void *  data 
)
static

Definition at line 516 of file deskmenu.c.

References atari_hotlist_open(), and NSLOG.

Here is the call graph for this function:

◆ menu_choices()

static void __CDECL menu_choices ( short  item,
short  title,
void *  data 
)
static

Definition at line 359 of file deskmenu.c.

References NSLOG, and open_settings().

Here is the call graph for this function:

◆ menu_close_win()

static void __CDECL menu_close_win ( short  item,
short  title,
void *  data 
)
static

Definition at line 281 of file deskmenu.c.

References gui_window_destroy(), input_window, and NSLOG.

Here is the call graph for this function:

◆ menu_cookies()

static void __CDECL menu_cookies ( short  item,
short  title,
void *  data 
)
static

Definition at line 522 of file deskmenu.c.

References atari_cookie_manager_open(), and NSLOG.

Here is the call graph for this function:

◆ menu_copy()

static void __CDECL menu_copy ( short  item,
short  title,
void *  data 
)
static

Definition at line 332 of file deskmenu.c.

References gui_window::browser, browser_window_key_press(), s_browser::bw, input_window, NS_KEY_COPY_SELECTION, and NSLOG.

Here is the call graph for this function:

◆ menu_cut()

static void __CDECL menu_cut ( short  item,
short  title,
void *  data 
)
static

Definition at line 326 of file deskmenu.c.

References gui_window::browser, browser_window_key_press(), s_browser::bw, input_window, and NS_KEY_CUT_SELECTION.

Here is the call graph for this function:

◆ menu_debug_render()

static void __CDECL menu_debug_render ( short  item,
short  title,
void *  data 
)
static

Definition at line 435 of file deskmenu.c.

References gui_window::browser, BROWSER_AREA_CONTENT, browser_window_reformat(), s_browser::bw, h_gem_menu, html_redraw_debug, input_window, NSLOG, gui_window::root, and window_get_grect().

Here is the call graph for this function:

◆ menu_dec_scale()

static void __CDECL menu_dec_scale ( short  item,
short  title,
void *  data 
)
static

Definition at line 394 of file deskmenu.c.

References gui_window::browser, browser_window_set_scale(), s_browser::bw, and input_window.

Here is the call graph for this function:

◆ menu_fg_images()

static void __CDECL menu_fg_images ( short  item,
short  title,
void *  data 
)
static

Definition at line 452 of file deskmenu.c.

References h_gem_menu, nsoption_bool, and nsoption_set_bool.

◆ menu_find()

static void __CDECL menu_find ( short  item,
short  title,
void *  data 
)
static

Definition at line 346 of file deskmenu.c.

References input_window, NSLOG, gui_window::root, gui_window::search, window_close_search(), and window_open_search().

Here is the call graph for this function:

◆ menu_forward()

static void __CDECL menu_forward ( short  item,
short  title,
void *  data 
)
static

Definition at line 474 of file deskmenu.c.

References input_window, NSLOG, gui_window::root, s_gui_win_root::toolbar, and toolbar_forward_click().

Here is the call graph for this function:

◆ menu_ghistory()

static void __CDECL menu_ghistory ( short  item,
short  title,
void *  data 
)
static

Definition at line 497 of file deskmenu.c.

References atari_global_history_open(), and NSLOG.

Here is the call graph for this function:

◆ menu_help_content()

static void __CDECL menu_help_content ( short  item,
short  title,
void *  data 
)
static

Definition at line 535 of file deskmenu.c.

References NSLOG.

◆ menu_home()

static void __CDECL menu_home ( short  item,
short  title,
void *  data 
)
static

Definition at line 482 of file deskmenu.c.

References input_window, NSLOG, gui_window::root, s_gui_win_root::toolbar, and toolbar_home_click().

Here is the call graph for this function:

◆ menu_inc_scale()

static void __CDECL menu_inc_scale ( short  item,
short  title,
void *  data 
)
static

Definition at line 385 of file deskmenu.c.

References gui_window::browser, browser_window_set_scale(), s_browser::bw, and input_window.

Here is the call graph for this function:

◆ menu_lhistory()

static void __CDECL menu_lhistory ( short  item,
short  title,
void *  data 
)
static

Definition at line 490 of file deskmenu.c.

References input_window, and NSLOG.

◆ menu_new_win()

static void __CDECL menu_new_win ( short  item,
short  title,
void *  data 
)
static

Definition at line 205 of file deskmenu.c.

References atari_warn_user(), browser_window_create(), BW_CREATE_HISTORY, messages_get_errorcode(), NSERROR_OK, NSLOG, nsoption_charp, nsurl_create(), and nsurl_unref().

Here is the call graph for this function:

◆ menu_open_file()

static void __CDECL menu_open_file ( short  item,
short  title,
void *  data 
)
static

Definition at line 251 of file deskmenu.c.

References atari_warn_user(), browser_window_create(), BW_CREATE_HISTORY, file_select(), local_file_to_url(), messages_get(), messages_get_errorcode(), NSERROR_OK, NSLOG, nsurl_create(), and nsurl_unref().

Here is the call graph for this function:

◆ menu_open_url()

static void __CDECL menu_open_url ( short  item,
short  title,
void *  data 
)
static

Definition at line 235 of file deskmenu.c.

References browser_window_create(), browser_window::bw, BW_CREATE_HISTORY, input_window, and NSLOG.

Here is the call graph for this function:

◆ menu_paste()

static void __CDECL menu_paste ( short  item,
short  title,
void *  data 
)
static

Definition at line 339 of file deskmenu.c.

References gui_window::browser, browser_window_key_press(), s_browser::bw, input_window, NS_KEY_PASTE, and NSLOG.

Here is the call graph for this function:

◆ menu_quit()

static void __CDECL menu_quit ( short  item,
short  title,
void *  data 
)
static

Definition at line 318 of file deskmenu.c.

References NSLOG.

◆ menu_reload()

static void __CDECL menu_reload ( short  item,
short  title,
void *  data 
)
static

Definition at line 376 of file deskmenu.c.

References input_window, NSLOG, gui_window::root, s_gui_win_root::toolbar, and toolbar_reload_click().

Here is the call graph for this function:

◆ menu_save_page()

static void __CDECL menu_save_page ( short  item,
short  title,
void *  data 
)
static

Definition at line 289 of file deskmenu.c.

References gui_window::browser, browser_window_get_content(), s_browser::bw, file_select(), init, input_window, is_dir(), NSLOG, path(), save_complete(), and save_complete_init().

Here is the call graph for this function:

◆ menu_savewin()

static void __CDECL menu_savewin ( short  item,
short  title,
void *  data 
)
static

Definition at line 415 of file deskmenu.c.

References gui_window::browser, input_window, NSLOG, nsoption_set_int, nsoption_write(), option_window_height, option_window_width, option_window_x, option_window_y, options, gui_window::root, and s_gui_win_root::win.

Here is the call graph for this function:

◆ menu_stop()

static void __CDECL menu_stop ( short  item,
short  title,
void *  data 
)
static

Definition at line 365 of file deskmenu.c.

References input_window, NSLOG, gui_window::root, s_gui_win_root::toolbar, and toolbar_stop_click().

Here is the call graph for this function:

◆ menu_toolbars()

static void __CDECL menu_toolbars ( short  item,
short  title,
void *  data 
)
static

Definition at line 404 of file deskmenu.c.

References input_window, NSLOG, gui_window::root, and s_gui_win_root::toolbar.

◆ menu_vlog()

static void __CDECL menu_vlog ( short  item,
short  title,
void *  data 
)
static

Definition at line 528 of file deskmenu.c.

References h_gem_menu, NSLOG, and verbose_log.

◆ register_menu_str()

static void register_menu_str ( struct s_menu_item_evnt mi)
static

Definition at line 564 of file deskmenu.c.

References s_menu_item_evnt::accel, s_accelerator::ascii, h_gem_menu, s_accelerator::keycode, s_menu_item_evnt::menustr, s_accelerator::mod, NSLOG, and s_menu_item_evnt::rid.

Referenced by deskmenu_init().

Here is the caller graph for this function:

Variable Documentation

◆ h_gem_menu

OBJECT* h_gem_menu
static

◆ h_gem_rsrc

void* h_gem_rsrc
extern

Definition at line 76 of file gui.c.

◆ html_redraw_debug

bool html_redraw_debug
extern

Definition at line 68 of file redraw.c.

Referenced by deskmenu_update(), html_debug(), and menu_debug_render().

◆ input_window

struct gui_window* input_window
extern

◆ menu_evnt_tbl

struct s_menu_item_evnt menu_evnt_tbl[]

◆ option_homepage_url

const char* option_homepage_url
extern

Definition at line 88 of file gui.c.

◆ option_window_height

int option_window_height
extern

Definition at line 83 of file gui.c.

Referenced by gui_window_create(), menu_savewin(), and process_cmdline().

◆ option_window_width

int option_window_width
extern

Definition at line 82 of file gui.c.

Referenced by gui_window_create(), menu_savewin(), and process_cmdline().

◆ option_window_x

int option_window_x
extern

Definition at line 84 of file gui.c.

Referenced by gui_window_create(), menu_savewin(), and process_cmdline().

◆ option_window_y

int option_window_y
extern

Definition at line 85 of file gui.c.

Referenced by gui_window_create(), menu_savewin(), and process_cmdline().

◆ options

char options[PATH_MAX]
extern

Definition at line 91 of file gui.c.

Referenced by form_dom_to_data_select(), gui_init_replicant(), main(), and menu_savewin().