NetSurf
Functions
local_history.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "utils/errors.h"
#include "netsurf/mouse.h"
Include dependency graph for local_history.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

nserror local_history_init (void *core_window_handle, struct browser_window *bw, struct local_history_session **session)
 Initialise the local history. More...
 
nserror local_history_fini (struct local_history_session *session)
 Finalise the local history. More...
 
nserror local_history_redraw (struct local_history_session *session, int x, int y, struct rect *clip, const struct redraw_context *ctx)
 Redraw the local history. More...
 
nserror local_history_mouse_action (struct local_history_session *session, enum browser_mouse_state mouse, int x, int y)
 Handles all kinds of mouse action. More...
 
bool local_history_keypress (struct local_history_session *session, uint32_t key)
 Key press handling. More...
 
nserror local_history_set (struct local_history_session *session, struct browser_window *bw)
 Change the browser window to draw local history for. More...
 
nserror local_history_get_size (struct local_history_session *session, int *width, int *height)
 get size of local history content area. More...
 
nserror local_history_get_url (struct local_history_session *session, int x, int y, struct nsurl **url_out)
 get url of entry at position in local history content area. More...
 
nserror local_history_scroll_to_cursor (struct local_history_session *session)
 Scroll the local history window to ensure the current cursor is shown. More...
 

Function Documentation

◆ local_history_fini()

nserror local_history_fini ( struct local_history_session session)

Finalise the local history.

This destroys the local history view and the local history module's internal data. After calling this if local history is required again, local_history_init must be called to create a new session.

Parameters
sessionThe local history session to finalise.
Returns
NSERROR_OK on success and session freed appropriate error otherwise

Definition at line 342 of file local_history.c.

References NSERROR_OK.

Referenced by ami_history_local_destroy(), fb_local_history_destroy(), nsgtk_local_history_destroy(), nsw32_local_history_finalise(), and ro_gui_local_history_finalise().

Here is the caller graph for this function:

◆ local_history_get_size()

nserror local_history_get_size ( struct local_history_session session,
int *  width,
int *  height 
)

get size of local history content area.

Parameters
[in]sessionThe local history session context.
[out]widthon sucessful return the width of the localhistory content
[out]heighton sucessful return the height of the localhistory content
Returns
NSERROR_OK or appropriate error code.

Definition at line 566 of file local_history.c.

References local_history_session::bw, history::height, height, browser_window::history, NSERROR_OK, history::width, and width.

Referenced by ami_history_local_present(), fb_local_history_present(), nsgtk_local_history_present(), nsw32_local_history_present(), and ro_local_history_open().

Here is the caller graph for this function:

◆ local_history_get_url()

nserror local_history_get_url ( struct local_history_session session,
int  x,
int  y,
struct nsurl **  url_out 
)

get url of entry at position in local history content area.

Todo:
the returned url should be a referenced nsurl.
Parameters
[in]sessionThe local history session context.
[in]xThe x coordinate to get url of.
[in]yThe y coordinate to get url of.
[out]url_outreferenced url.
Returns
NSERROR_OK and url_out updated or NSERROR_NOT_FOUND if no url at location.

Definition at line 579 of file local_history.c.

References local_history_session::bw, find_entry_position(), browser_window::history, NSERROR_BAD_PARAMETER, NSERROR_NOT_FOUND, NSERROR_OK, nsurl_ref(), history_entry::page, history::start, history_page::url, history_entry::x, and history_entry::y.

Referenced by ami_history_local_mouse(), and ro_local_history_tooltip().

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

◆ local_history_init()

nserror local_history_init ( void *  core_window_handle,
struct browser_window bw,
struct local_history_session **  session 
)

Initialise the local history.

This iterates through the history object of a browser window and creates tree of visited pages with thumbnails which may be selected to cause navigation.

This must be called before any other local_history_* function.

Parameters
[in]cw_tCallback table for core_window containing the treeview.
[in]core_window_handleThe core_window in which the treeview is shown.
[in]bwbrowser window to show history of.
[out]sessionThe created local history session context.
Returns
NSERROR_OK on success and session set, appropriate error code otherwise

Definition at line 309 of file local_history.c.

References plot_font_style::background, local_history_session::bw, local_history_session::core_window_handle, plot_style_s::fill_colour, plot_font_style::foreground, local_history_set(), NSCOLOUR_SEL_BG, NSCOLOUR_WIN_EVEN_BG, NSCOLOUR_WIN_EVEN_BORDER, NSCOLOUR_WIN_EVEN_FG, nscolours, NSERROR_NOMEM, NSERROR_OK, pfstyle_node, pfstyle_node_sel, pstyle_bg, pstyle_line, pstyle_rect, pstyle_rect_cursor, pstyle_rect_sel, and plot_style_s::stroke_colour.

Referenced by ami_history_local_present(), fb_local_history_init(), nsgtk_local_history_init(), nsw32_local_history_init(), and ro_local_history_init().

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

◆ local_history_keypress()

bool local_history_keypress ( struct local_history_session session,
uint32_t  key 
)

Key press handling.

Parameters
[in]sessionThe local history session context.
[in]keyThe ucs4 character codepoint
Returns
true if the keypress is dealt with, false otherwise.

Definition at line 457 of file local_history.c.

References _local_history_find_branch_point(), history_entry::back, browser_window_history_go(), local_history_session::bw, local_history_session::core_window_handle, netsurf_table::corewindow, history::current, local_history_session::cursor, history_entry::forward, history_entry::forward_pref, guit, browser_window::history, core_window_table::invalidate, local_history_scroll_to_cursor(), history_entry::next, NS_KEY_CR, NS_KEY_DOWN, NS_KEY_LEFT, NS_KEY_NL, NS_KEY_RIGHT, and NS_KEY_UP.

Referenced by ami_history_local_key(), fb_local_history_key(), nsgtk_local_history_key(), nsw32_local_history_key(), and ro_local_history_key().

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

◆ local_history_mouse_action()

nserror local_history_mouse_action ( struct local_history_session session,
enum browser_mouse_state  mouse,
int  x,
int  y 
)

Handles all kinds of mouse action.

Parameters
[in]sessionThe local history session context.
[in]mouseThe current mouse state
[in]xThe current mouse X coordinate
[in]yThe current mouse Y coordinate
Returns
NSERROR_OK if mouse action was processed. NSERROR_NOT_FOUND if nothing under the pointer where it was clicked NSERROR_NOT_IMPLEMENTED if the action was not processed. NSERROR_PERMISSION if the clicked item was the current page

Definition at line 387 of file local_history.c.

References BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, browser_window_history_go(), local_history_session::bw, history::current, find_entry_position(), browser_window::history, NSERROR_BAD_PARAMETER, NSERROR_NOT_FOUND, NSERROR_NOT_IMPLEMENTED, NSERROR_OK, NSERROR_PERMISSION, history::start, history_entry::x, and history_entry::y.

Referenced by ami_history_local_mouse(), fb_local_history_mouse(), nsgtk_local_history_mouse(), nsw32_local_history_mouse(), and ro_local_history_mouse().

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

◆ local_history_redraw()

nserror local_history_redraw ( struct local_history_session session,
int  x,
int  y,
struct rect clip,
const struct redraw_context ctx 
)

Redraw the local history.

Causes the local history viewer to issue plot operations to redraw the specified area of the viewport.

Parameters
[in]sessionThe local history session context.
[in]xX coordinate to render history at
[in]yY coordinate to render history at
[in]clipCurrent clip rectangle (wrt tree origin)
[in]ctxCurrent redraw context

Definition at line 352 of file local_history.c.

References local_history_session::bw, clip(), plotter_table::clip, local_history_session::cursor, browser_window::history, NSERROR_OK, redraw_context::plot, pstyle_bg, plotter_table::rectangle, redraw_entry(), history::start, and rect::x0.

Referenced by ami_history_local_draw(), fb_local_history_draw(), nsgtk_local_history_draw(), nsw32_local_history_draw(), and ro_local_history_draw().

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

◆ local_history_scroll_to_cursor()

nserror local_history_scroll_to_cursor ( struct local_history_session session)

Scroll the local history window to ensure the current cursor is shown.

Parameters
sessionThe local history session

Definition at line 289 of file local_history.c.

References local_history_session::core_window_handle, local_history_session::cursor, cw_helper_scroll_visible(), LOCAL_HISTORY_BOTTOM_MARGIN, LOCAL_HISTORY_HEIGHT, LOCAL_HISTORY_RIGHT_MARGIN, LOCAL_HISTORY_WIDTH, NSERROR_OK, history_entry::x, rect::x0, rect::x1, history_entry::y, rect::y0, and rect::y1.

Referenced by ami_history_local_present(), fb_local_history_present(), local_history_keypress(), local_history_set(), nsgtk_local_history_present(), nsw32_local_history_present(), and ro_local_history_open().

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

◆ local_history_set()

nserror local_history_set ( struct local_history_session session,
struct browser_window bw 
)

Change the browser window to draw local history for.

Parameters
[in]sessionThe local history session context.
bwbrowser window to show history of.
Returns
NSERROR_OK or appropriate error code.

Definition at line 544 of file local_history.c.

References local_history_session::bw, local_history_session::core_window_handle, netsurf_table::corewindow, history::current, local_history_session::cursor, guit, history::height, browser_window::history, local_history_scroll_to_cursor(), NSERROR_OK, core_window_table::set_extent, and history::width.

Referenced by ami_history_local_present(), fb_local_history_hide(), fb_local_history_init(), local_history_init(), nsgtk_local_history_hide(), nsgtk_local_history_init(), nsw32_local_history_hide(), nsw32_local_history_init(), and ro_local_history_init().

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