NetSurf
|
Local history viewer implementation. More...
#include <stdlib.h>
#include <string.h>
#include "utils/nsurl.h"
#include "utils/errors.h"
#include "netsurf/types.h"
#include "netsurf/layout.h"
#include "netsurf/browser_window.h"
#include "netsurf/core_window.h"
#include "netsurf/plotters.h"
#include "netsurf/keypress.h"
#include "utils/nscolour.h"
#include "desktop/cw_helper.h"
#include "desktop/gui_internal.h"
#include "desktop/system_colour.h"
#include "desktop/browser_private.h"
#include "desktop/browser_history.h"
#include "desktop/local_history_private.h"
#include "desktop/local_history.h"
Go to the source code of this file.
Data Structures | |
struct | local_history_session |
local history viewer context More... | |
Functions | |
static nserror | redraw_entry (struct history *history, struct history_entry *entry, struct history_entry *cursor, struct rect *clip, int x, int y, const struct redraw_context *ctx) |
Recursively redraw a history entry. More... | |
static struct history_entry * | find_entry_position (struct history_entry *entry, int x, int y) |
Find the history entry at a position. 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... | |
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... | |
static void | _local_history_find_branch_point (struct history_entry *ent, struct history_entry **branch_point) |
Determine the point on the parent line where this history line branches. 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, nsurl **url_out) |
get url of entry at position in local history content area. More... | |
Variables | |
static plot_style_t | pstyle_line |
plot style for drawing lines between nodes More... | |
static plot_style_t | pstyle_bg |
plot style for drawing background More... | |
static plot_style_t | pstyle_rect |
plot style for drawing rectangle round unselected nodes More... | |
static plot_style_t | pstyle_rect_sel |
plot style for drawing rectangle round selected nodes More... | |
static plot_style_t | pstyle_rect_cursor |
plot style for drawing rectangle round the cursor node More... | |
static plot_font_style_t | pfstyle_node |
plot style for font on unselected nodes More... | |
static plot_font_style_t | pfstyle_node_sel |
plot style for font on unselected nodes More... | |
Local history viewer implementation.
Definition in file local_history.c.
|
static |
Determine the point on the parent line where this history line branches.
If branch_point
gets set then there is a guarantee that (a) ent
is a transitive child (forward) of that point. and (b) branch_point
has a parent.
[in] | ent | The entry to work backward from |
[out] | branch_point | The entry to set to the branch point if one is found |
Definition at line 436 of file local_history.c.
References history_entry::back, history_entry::forward, and history_entry::forward_last.
Referenced by local_history_keypress().
|
static |
Find the history entry at a position.
entry | entry to search from |
x | coordinate |
y | coordinate |
Definition at line 261 of file local_history.c.
References find_entry_position(), history_entry::forward, LOCAL_HISTORY_HEIGHT, LOCAL_HISTORY_WIDTH, history_entry::next, history_entry::x, and history_entry::y.
Referenced by find_entry_position(), local_history_get_url(), and local_history_mouse_action().
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.
session | The local history session to finalise. |
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().
nserror local_history_get_size | ( | struct local_history_session * | session, |
int * | width, | ||
int * | height | ||
) |
get size of local history content area.
[in] | session | The local history session context. |
[out] | width | on sucessful return the width of the localhistory content |
[out] | height | on sucessful return the height of the localhistory content |
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().
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.
[in] | session | The local history session context. |
[in] | x | The x coordinate to get url of. |
[in] | y | The y coordinate to get url of. |
[out] | url_out | referenced url. |
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().
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.
[in] | cw_t | Callback table for core_window containing the treeview. |
[in] | core_window_handle | The core_window in which the treeview is shown. |
[in] | bw | browser window to show history of. |
[out] | session | The created local history session context. |
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().
bool local_history_keypress | ( | struct local_history_session * | session, |
uint32_t | key | ||
) |
Key press handling.
[in] | session | The local history session context. |
[in] | key | The ucs4 character codepoint |
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().
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.
[in] | session | The local history session context. |
[in] | mouse | The current mouse state |
[in] | x | The current mouse X coordinate |
[in] | y | The current mouse Y coordinate |
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().
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.
[in] | session | The local history session context. |
[in] | x | X coordinate to render history at |
[in] | y | Y coordinate to render history at |
[in] | clip | Current clip rectangle (wrt tree origin) |
[in] | ctx | Current 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().
nserror local_history_scroll_to_cursor | ( | struct local_history_session * | session | ) |
Scroll the local history window to ensure the current cursor is shown.
session | The 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().
nserror local_history_set | ( | struct local_history_session * | session, |
struct browser_window * | bw | ||
) |
Change the browser window to draw local history for.
[in] | session | The local history session context. |
bw | browser window to show history of. |
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().
|
static |
Recursively redraw a history entry.
history | history containing the entry |
entry | entry to render |
clip | redraw area |
x | window x offset |
y | window y offset |
ctx | current redraw context |
Definition at line 134 of file local_history.c.
References history_page::bitmap, plotter_table::bitmap, clip(), history::current, history_entry::forward, guit, netsurf_table::layout, plotter_table::line, LOCAL_HISTORY_HEIGHT, LOCAL_HISTORY_WIDTH, history_entry::next, NSERROR_OK, history_entry::page, pfstyle_node, pfstyle_node_sel, redraw_context::plot, plot_style_font, gui_layout_table::position, pstyle_line, pstyle_rect, pstyle_rect_cursor, pstyle_rect_sel, plotter_table::rectangle, redraw_entry(), plotter_table::text, history_page::title, history_entry::x, rect::x0, rect::x1, history_entry::y, rect::y0, and rect::y1.
Referenced by local_history_redraw(), and redraw_entry().
|
static |
plot style for font on unselected nodes
Definition at line 104 of file local_history.c.
Referenced by local_history_init(), and redraw_entry().
|
static |
plot style for font on unselected nodes
Definition at line 115 of file local_history.c.
Referenced by local_history_init(), and redraw_entry().
|
static |
plot style for drawing background
Definition at line 69 of file local_history.c.
Referenced by local_history_init(), and local_history_redraw().
|
static |
plot style for drawing lines between nodes
Definition at line 60 of file local_history.c.
Referenced by local_history_init(), and redraw_entry().
|
static |
plot style for drawing rectangle round unselected nodes
Definition at line 77 of file local_history.c.
Referenced by local_history_init(), and redraw_entry().
|
static |
plot style for drawing rectangle round the cursor node
Definition at line 95 of file local_history.c.
Referenced by local_history_init(), and redraw_entry().
|
static |
plot style for drawing rectangle round selected nodes
Definition at line 86 of file local_history.c.
Referenced by local_history_init(), and redraw_entry().