NetSurf
Data Structures | Functions | Variables
global_history.c File Reference

Implementation of RISC OS global history. More...

#include <stdint.h>
#include <stdlib.h>
#include <oslib/wimp.h>
#include "utils/nsoption.h"
#include "utils/messages.h"
#include "utils/log.h"
#include "netsurf/window.h"
#include "netsurf/plotters.h"
#include "netsurf/keypress.h"
#include "desktop/global_history.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/menus.h"
#include "riscos/save.h"
#include "riscos/toolbar.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/corewindow.h"
#include "riscos/global_history.h"
Include dependency graph for global_history.c:

Go to the source code of this file.

Data Structures

struct  ro_global_history_window
 

Functions

static nserror global_history_draw (struct ro_corewindow *ro_cw, int originx, int originy, struct rect *r)
 callback to draw on drawable area of ro global_history window More...
 
static nserror global_history_key (struct ro_corewindow *ro_cw, uint32_t nskey)
 callback for keypress on ro coookie window More...
 
static nserror global_history_mouse (struct ro_corewindow *ro_cw, browser_mouse_state mouse_state, int x, int y)
 callback for mouse event on ro global_history window More...
 
static nserror global_history_toolbar_click (struct ro_corewindow *ro_cw, button_bar_action action)
 handle clicks in ro core window toolbar. More...
 
static nserror global_history_toolbar_update (struct ro_corewindow *ro_cw)
 Handle updating state of buttons in ro core window toolbar. More...
 
static nserror global_history_toolbar_save (struct ro_corewindow *ro_cw, char *config)
 callback for saving of toolbar state in ro global history window More...
 
static bool global_history_menu_prepare (wimp_w w, wimp_i i, wimp_menu *menu, wimp_pointer *pointer)
 Prepare the global_history menu for display. More...
 
static void global_history_menu_warning (wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action)
 Handle submenu warnings for the global_history menu. More...
 
static bool global_history_menu_select (wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action)
 Handle selections from the global_history menu. More...
 
static nserror ro_global_history_init (void)
 Creates the window for the global_history tree. More...
 
nserror ro_gui_global_history_present (void)
 make the global history window visible. More...
 
void ro_gui_global_history_initialise (void)
 initialise the global history window template ready for subsequent use. More...
 
nserror ro_gui_global_history_finalise (void)
 Free any resources allocated for the global history window. More...
 
bool ro_gui_global_history_check_window (wimp_w wh)
 check if window handle is for the global history window More...
 
bool ro_gui_global_history_check_menu (wimp_menu *menu)
 check if menu handle is for the global history menu More...
 

Variables

static struct ro_global_history_windowglobal_history_window = NULL
 global_history window is a singleton More...
 
static wimp_window * dialog_global_history_template
 riscos template for global_history window More...
 

Detailed Description

Implementation of RISC OS global history.

Definition in file global_history.c.

Function Documentation

◆ global_history_draw()

static nserror global_history_draw ( struct ro_corewindow ro_cw,
int  originx,
int  originy,
struct rect r 
)
static

callback to draw on drawable area of ro global_history window

Parameters
ro_cwThe riscos core window structure.
rThe rectangle of the window that needs updating.
originxThe risc os plotter x origin.
originyThe risc os plotter y origin.
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 69 of file global_history.c.

References global_history_redraw(), redraw_context::interactive, no_font_blending, NSERROR_OK, ro_plot_origin_x, ro_plot_origin_y, and ro_plotters.

Referenced by ro_global_history_init().

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

◆ global_history_key()

static nserror global_history_key ( struct ro_corewindow ro_cw,
uint32_t  nskey 
)
static

callback for keypress on ro coookie window

Parameters
ro_cwThe ro core window structure.
nskeyThe netsurf key code.
Returns
NSERROR_OK if key processed, NSERROR_NOT_IMPLEMENTED if key not processed otherwise apropriate error code

Definition at line 99 of file global_history.c.

References global_history_keypress(), NSERROR_NOT_IMPLEMENTED, and NSERROR_OK.

Referenced by ro_global_history_init().

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

◆ global_history_menu_prepare()

static bool global_history_menu_prepare ( wimp_w  w,
wimp_i  i,
wimp_menu *  menu,
wimp_pointer *  pointer 
)
static

Prepare the global_history menu for display.

Parameters
wThe window owning the menu.
iThe icon owning the menu.
menuThe menu from which the selection was made.
pointerThe pointer shape
Returns
true if action accepted; else false.

Definition at line 218 of file global_history.c.

References ro_global_history_window::core, global_history_has_selection(), GUI_SAVE_HISTORY_EXPORT_HTML, ro_global_history_window::menu, ro_gui_menu_set_entry_shaded(), ro_gui_menu_set_entry_ticked(), ro_gui_save_prepare(), ro_gui_wimp_event_get_user_data(), ro_toolbar_menu_buttons_tick, ro_toolbar_menu_edit_shade, ro_toolbar_menu_edit_tick, ro_toolbar_menu_option_shade, ro_corewindow::toolbar, TOOLBAR_BUTTONS, TOOLBAR_EDIT, TREE_CLEAR_SELECTION, and TREE_SELECTION.

Referenced by ro_global_history_init().

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

◆ global_history_menu_select()

static bool global_history_menu_select ( wimp_w  w,
wimp_i  i,
wimp_menu *  menu,
wimp_selection *  selection,
menu_action  action 
)
static

Handle selections from the global_history menu.

Parameters
wThe window owning the menu.
iThe icon owning the menu.
menuThe menu from which the selection was made.
selectionThe wimp menu selection data.
actionThe selected menu action.
Returns
true if action accepted; else false.

Definition at line 286 of file global_history.c.

References ro_global_history_window::core, dialog_saveas, global_history_contract(), global_history_expand(), global_history_keypress(), HISTORY_EXPORT, ro_global_history_window::menu, NS_KEY_CLEAR_SELECTION, NS_KEY_CR, NS_KEY_DELETE_LEFT, NS_KEY_SELECT_ALL, ro_gui_dialog_open_persistent(), ro_gui_wimp_event_get_user_data(), ro_toolbar_get_display_buttons(), ro_toolbar_set_display_buttons(), ro_toolbar_toggle_edit(), ro_corewindow::toolbar, TOOLBAR_BUTTONS, TOOLBAR_EDIT, TREE_CLEAR_SELECTION, TREE_COLLAPSE_ALL, TREE_COLLAPSE_FOLDERS, TREE_COLLAPSE_LINKS, TREE_EXPAND_ALL, TREE_EXPAND_FOLDERS, TREE_EXPAND_LINKS, TREE_SELECT_ALL, TREE_SELECTION_DELETE, and TREE_SELECTION_LAUNCH.

Referenced by ro_global_history_init().

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

◆ global_history_menu_warning()

static void global_history_menu_warning ( wimp_w  w,
wimp_i  i,
wimp_menu *  menu,
wimp_selection *  selection,
menu_action  action 
)
static

Handle submenu warnings for the global_history menu.

Parameters
wThe window owning the menu.
iThe icon owning the menu.
menuThe menu to which the warning applies.
selectionThe wimp menu selection data.
actionThe selected menu action.

Definition at line 265 of file global_history.c.

Referenced by ro_global_history_init().

Here is the caller graph for this function:

◆ global_history_mouse()

static nserror global_history_mouse ( struct ro_corewindow ro_cw,
browser_mouse_state  mouse_state,
int  x,
int  y 
)
static

callback for mouse event on ro global_history window

Parameters
ro_cwThe ro core window structure.
mouse_statemouse state
xlocation of event
ylocation of event
Returns
NSERROR_OK on sucess otherwise apropriate error code.

Definition at line 118 of file global_history.c.

References global_history_mouse_action(), and NSERROR_OK.

Referenced by ro_global_history_init().

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

◆ global_history_toolbar_click()

static nserror global_history_toolbar_click ( struct ro_corewindow ro_cw,
button_bar_action  action 
)
static

handle clicks in ro core window toolbar.

Parameters
ro_cwThe ro core window structure.
actionThe button bar action.
Returns
NSERROR_OK if config saved, otherwise apropriate error code

Definition at line 136 of file global_history.c.

References global_history_contract(), global_history_expand(), global_history_keypress(), NS_KEY_CR, NS_KEY_DELETE_LEFT, NSERROR_OK, TOOLBAR_BUTTON_CLOSE, TOOLBAR_BUTTON_COLLAPSE, TOOLBAR_BUTTON_DELETE, TOOLBAR_BUTTON_EXPAND, TOOLBAR_BUTTON_LAUNCH, and TOOLBAR_BUTTON_OPEN.

Referenced by ro_global_history_init().

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

◆ global_history_toolbar_save()

static nserror global_history_toolbar_save ( struct ro_corewindow ro_cw,
char *  config 
)
static

callback for saving of toolbar state in ro global history window

Parameters
ro_cwThe ro core window structure.
configThe new toolbar configuration.
Returns
NSERROR_OK if config saved, otherwise apropriate error code

Definition at line 199 of file global_history.c.

References NSERROR_OK, nsoption_set_charp, and ro_gui_save_options().

Referenced by ro_global_history_init().

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

◆ global_history_toolbar_update()

static nserror global_history_toolbar_update ( struct ro_corewindow ro_cw)
static

Handle updating state of buttons in ro core window toolbar.

Parameters
ro_cwThe ro core window structure.
Returns
NSERROR_OK if config saved, otherwise apropriate error code

Definition at line 178 of file global_history.c.

References global_history_has_selection(), NSERROR_OK, ro_toolbar_set_button_shaded_state(), ro_corewindow::toolbar, TOOLBAR_BUTTON_DELETE, and TOOLBAR_BUTTON_LAUNCH.

Referenced by ro_global_history_init().

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

◆ ro_global_history_init()

static nserror ro_global_history_init ( void  )
static

Creates the window for the global_history tree.

Returns
NSERROR_OK on success else appropriate error code on faliure.

Definition at line 368 of file global_history.c.

References ro_corewindow::cb_table, ro_global_history_window::core, dialog_global_history_template, dialog_saveas, ro_corewindow::draw, global_history_draw(), global_history_init(), global_history_key(), global_history_menu_prepare(), global_history_menu_select(), global_history_menu_warning(), global_history_mouse(), global_history_toolbar_click(), global_history_toolbar_save(), global_history_toolbar_update(), global_history_window, HISTORY_EXPORT, ro_corewindow::key, ro_global_history_window::menu, messages_get(), ro_corewindow::mouse, NO_ACTION, NSERROR_NOMEM, NSERROR_OK, NSLOG, nsoption_charp, ro_corewindow_init(), ro_gui_menu_define_menu(), ro_gui_set_window_title(), ro_gui_wimp_event_register_menu(), ro_gui_wimp_event_register_menu_prepare(), ro_gui_wimp_event_register_menu_selection(), ro_gui_wimp_event_register_menu_warning(), ro_warn_user(), THEME_STYLE_GLOBAL_HISTORY_TOOLBAR, TOOLBAR_BUTTON_CLOSE, TOOLBAR_BUTTON_COLLAPSE, TOOLBAR_BUTTON_DELETE, TOOLBAR_BUTTON_EXPAND, TOOLBAR_BUTTON_LAUNCH, TOOLBAR_BUTTON_NONE, TOOLBAR_BUTTON_OPEN, TOOLBAR_BUTTONS, ro_corewindow::toolbar_click, TOOLBAR_EDIT, ro_corewindow::toolbar_save, ro_corewindow::toolbar_update, TREE_CLEAR_SELECTION, TREE_COLLAPSE_ALL, TREE_COLLAPSE_FOLDERS, TREE_COLLAPSE_LINKS, TREE_EXPAND_ALL, TREE_EXPAND_FOLDERS, TREE_EXPAND_LINKS, TREE_SELECT_ALL, TREE_SELECTION, TREE_SELECTION_DELETE, TREE_SELECTION_LAUNCH, and ro_corewindow::wh.

Referenced by ro_gui_global_history_present().

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

◆ ro_gui_global_history_check_menu()

bool ro_gui_global_history_check_menu ( wimp_menu *  menu)

check if menu handle is for the global history menu

Definition at line 541 of file global_history.c.

References global_history_window, and ro_global_history_window::menu.

Referenced by ro_gui_interactive_help_request().

Here is the caller graph for this function:

◆ ro_gui_global_history_check_window()

bool ro_gui_global_history_check_window ( wimp_w  wh)

check if window handle is for the global history window

Definition at line 530 of file global_history.c.

References ro_global_history_window::core, global_history_window, and ro_corewindow::wh.

Referenced by ro_gui_interactive_help_request().

Here is the caller graph for this function:

◆ ro_gui_global_history_finalise()

nserror ro_gui_global_history_finalise ( void  )

Free any resources allocated for the global history window.

Returns
NSERROR_OK on success else appropriate error code on faliure.

Definition at line 509 of file global_history.c.

References ro_global_history_window::core, global_history_fini(), global_history_window, NSERROR_OK, and ro_corewindow_fini().

Referenced by gui_quit().

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

◆ ro_gui_global_history_initialise()

void ro_gui_global_history_initialise ( void  )

initialise the global history window template ready for subsequent use.

Definition at line 502 of file global_history.c.

References dialog_global_history_template, and ro_gui_dialog_load_template().

Referenced by ro_gui_dialog_init().

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

◆ ro_gui_global_history_present()

nserror ro_gui_global_history_present ( void  )

make the global history window visible.

Returns
NSERROR_OK on success else appropriate error code on faliure.

Definition at line 483 of file global_history.c.

References ro_global_history_window::core, global_history_window, NSERROR_OK, NSLOG, ro_global_history_init(), ro_gui_dialog_open_top(), ro_corewindow::toolbar, and ro_corewindow::wh.

Referenced by ro_gui_iconbar_menu_select(), ro_gui_window_handle_local_keypress(), ro_gui_window_menu_select(), and ro_gui_window_toolbar_click().

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

Variable Documentation

◆ dialog_global_history_template

wimp_window* dialog_global_history_template
static

riscos template for global_history window

Definition at line 56 of file global_history.c.

Referenced by ro_global_history_init(), and ro_gui_global_history_initialise().

◆ global_history_window

struct ro_global_history_window* global_history_window = NULL
static