NetSurf
|
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include <math.h>
#include "utils/log.h"
#include "utils/nsoption.h"
#include "utils/nsurl.h"
#include "utils/utf8.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "netsurf/plotters.h"
#include "netsurf/keypress.h"
#include "desktop/browser_history.h"
#include "desktop/hotlist.h"
#include "desktop/textarea.h"
#include "atari/clipboard.h"
#include "atari/gui.h"
#include "atari/search.h"
#include "atari/toolbar.h"
#include "atari/rootwin.h"
#include "atari/misc.h"
#include "atari/plot/plot.h"
#include "cflib.h"
#include "atari/res/netsurf.rsh"
#include "atari/encoding.h"
Go to the source code of this file.
Data Structures | |
struct | s_tb_button |
struct | s_toolbar_style |
Macros | |
#define | TB_BUTTON_WIDTH 32 |
#define | THROBBER_WIDTH 32 |
#define | THROBBER_MIN_INDEX 1 |
#define | THROBBER_MAX_INDEX 12 |
#define | THROBBER_INACTIVE_INDEX 13 |
#define | TOOLBAR_BUTTON_NUM_STATES 2 |
#define | LAST_TOOLBAR_AREA TOOLBAR_AREA_SEARCH |
Enumerations | |
enum | e_toolbar_button_states { button_on = 0 , button_off = 1 } |
Functions | |
static void | tb_txt_request_redraw (void *data, int x, int y, int w, int h) |
Callback for textarea redraw. More... | |
static struct s_tb_button * | find_button (struct s_toolbar *tb, int rsc_id) |
Find a button for a specific resource ID. More... | |
static void | tb_txt_callback (void *data, struct textarea_msg *msg) |
static struct s_tb_button * | button_init (struct s_toolbar *tb, OBJECT *tree, int index, struct s_tb_button *instance) |
static short __CDECL | toolbar_url_userdraw (PARMBLK *parmblock) |
void | toolbar_init (void) |
void | toolbar_exit (void) |
struct s_toolbar * | toolbar_create (struct s_gui_win_root *owner) |
void | toolbar_destroy (struct s_toolbar *tb) |
static int | toolbar_calculate_height (struct s_toolbar *tb) |
static void | toolbar_reflow (struct s_toolbar *tb) |
void | toolbar_redraw (struct s_toolbar *tb, GRECT *clip) |
void | toolbar_update_buttons (struct s_toolbar *tb, struct browser_window *bw, short button) |
void | toolbar_set_width (struct s_toolbar *tb, short w) |
void | toolbar_set_origin (struct s_toolbar *tb, short x, short y) |
void | toolbar_set_dimensions (struct s_toolbar *tb, GRECT *area) |
void | toolbar_set_url (struct s_toolbar *tb, const char *text) |
void | toolbar_set_throbber_state (struct s_toolbar *tb, bool active) |
void | toolbar_set_visible (struct s_toolbar *tb, short area, bool visible) |
void | toolbar_set_reflow (struct s_toolbar *tb, bool do_reflow) |
void | toolbar_set_attached (struct s_toolbar *tb, bool attached) |
void | toolbar_throbber_progress (struct s_toolbar *tb) |
bool | toolbar_text_input (struct s_toolbar *tb, char *text) |
bool | toolbar_key_input (struct s_toolbar *tb, short nkc) |
void | toolbar_mouse_input (struct s_toolbar *tb, short obj, short button) |
void | toolbar_get_grect (struct s_toolbar *tb, short which, GRECT *dst) |
Receive a specific region of the toolbar. More... | |
struct textarea * | toolbar_get_textarea (struct s_toolbar *tb, enum toolbar_textarea which) |
char * | toolbar_get_url (struct s_toolbar *tb) |
nsurl * | toolbar_get_nsurl (struct s_toolbar *tb) |
OBJECT * | toolbar_get_form (struct s_toolbar *tb) |
void | toolbar_back_click (struct s_toolbar *tb) |
void | toolbar_reload_click (struct s_toolbar *tb) |
void | toolbar_forward_click (struct s_toolbar *tb) |
void | toolbar_home_click (struct s_toolbar *tb) |
void | toolbar_stop_click (struct s_toolbar *tb) |
void | toolbar_favorite_click (struct s_toolbar *tb) |
void | toolbar_crypto_click (struct s_toolbar *tb) |
Variables | |
char * | option_homepage_url |
void * | h_gem_rsrc |
struct gui_window * | input_window |
long | atari_plot_flags |
int | atari_plot_vdi_handle |
EVMULT_OUT | aes_event_out |
static OBJECT * | aes_toolbar = NULL |
static OBJECT * | throbber_form = NULL |
static bool | init = false |
static int | area_navigation_height = 0 |
static int | area_search_height = 0 |
static int | area_full_height = 0 |
static float | toolbar_url_scale = 1.0 |
static plot_font_style_t | font_style_url |
static struct s_tb_button | tb_buttons [] |
static struct s_toolbar_style | toolbar_styles [] |
static const struct redraw_context | toolbar_rdrw_ctx |
#define LAST_TOOLBAR_AREA TOOLBAR_AREA_SEARCH |
|
static |
Definition at line 221 of file toolbar.c.
References s_tb_button::index, s_tb_button::owner, and tb_buttons.
Referenced by toolbar_create().
|
static |
Find a button for a specific resource ID.
Definition at line 167 of file toolbar.c.
References s_toolbar::buttons, and s_tb_button::rsc_id.
Referenced by toolbar_mouse_input(), and toolbar_update_buttons().
|
static |
Definition at line 202 of file toolbar.c.
References textarea_msg::data, textarea_msg::redraw, tb_txt_request_redraw(), TEXTAREA_MSG_DRAG_REPORT, TEXTAREA_MSG_REDRAW_REQUEST, textarea_msg::type, rect::x0, rect::x1, rect::y0, and rect::y1.
Referenced by toolbar_create().
|
static |
Callback for textarea redraw.
Definition at line 182 of file toolbar.c.
References s_tb_button::area, s_toolbar::area, s_toolbar::attached, s_toolbar::owner, toolbar_get_grect(), and window_schedule_redraw_grect().
Referenced by tb_txt_callback().
void toolbar_back_click | ( | struct s_toolbar * | tb | ) |
Definition at line 917 of file toolbar.c.
References gui_window::browser, browser_window_back_available(), browser_window_history_back(), browser_window::bw, gui_window::bw, s_browser::bw, s_toolbar::owner, and window_get_active_gui_window().
Referenced by menu_back().
|
static |
Definition at line 347 of file toolbar.c.
References area_navigation_height, area_search_height, s_toolbar::search_visible, and s_toolbar::visible.
Referenced by toolbar_reflow().
struct s_toolbar * toolbar_create | ( | struct s_gui_win_root * | owner | ) |
Definition at line 267 of file toolbar.c.
References aes_toolbar, plot_font_style::background, textarea_setup::border_col, textarea_setup::border_width, s_toolbar::btcnt, button_init(), s_toolbar::buttons, s_toolbar_style::font_height_pt, font_style_url, plot_font_style::foreground, s_toolbar::form, textarea_setup::height, s_throbber_widget::index, init, s_throbber_widget::max_index, NSLOG, s_toolbar::owner, textarea_setup::pad_bottom, textarea_setup::pad_left, textarea_setup::pad_right, textarea_setup::pad_top, PLOT_STYLE_SCALE, s_toolbar::reflow, s_throbber_widget::running, s_toolbar::search_visible, textarea_setup::selected_bg, textarea_setup::selected_text, plot_font_style::size, s_toolbar::style, tb_buttons, tb_txt_callback(), textarea_setup::text, s_url_widget::textarea, textarea_create(), TEXTAREA_INTERNAL_CARET, s_toolbar::throbber, THROBBER_INACTIVE_INDEX, THROBBER_MAX_INDEX, toolbar_styles, s_toolbar::url, s_toolbar::visible, and textarea_setup::width.
Referenced by window_create().
void toolbar_destroy | ( | struct s_toolbar * | tb | ) |
Definition at line 337 of file toolbar.c.
References s_toolbar::buttons, s_toolbar::form, s_url_widget::textarea, textarea_destroy(), and s_toolbar::url.
Referenced by window_destroy().
void toolbar_exit | ( | void | ) |
Definition at line 261 of file toolbar.c.
Referenced by gui_quit().
void toolbar_favorite_click | ( | struct s_toolbar * | tb | ) |
Definition at line 1008 of file toolbar.c.
References hotlist_add_url(), hotlist_has_url(), hotlist_remove_url(), nsurl_create(), nsurl_unref(), and toolbar_get_url().
void toolbar_forward_click | ( | struct s_toolbar * | tb | ) |
Definition at line 945 of file toolbar.c.
References gui_window::browser, browser_window_forward_available(), browser_window_history_forward(), browser_window::bw, gui_window::bw, s_browser::bw, s_toolbar::owner, and window_get_active_gui_window().
Referenced by menu_forward().
OBJECT * toolbar_get_form | ( | struct s_toolbar * | tb | ) |
Definition at line 910 of file toolbar.c.
References s_toolbar::form.
Referenced by nsatari_search_set_back_state(), nsatari_search_set_forward_state(), on_window_key_input(), toolbar_set_visible(), and window_open_search().
void toolbar_get_grect | ( | struct s_toolbar * | tb, |
short | which, | ||
GRECT * | dst | ||
) |
Receive a specific region of the toolbar.
tb | - the toolbar pointer |
which | - the area to retrieve: 0 to receive the workarea, all other values must be an resource ID of the TOOLBAR tree. |
dst | - GRECT pointer receiving the area. |
Definition at line 854 of file toolbar.c.
References s_toolbar::form, s_toolbar::reflow, and toolbar_reflow().
Referenced by tb_txt_request_redraw(), toolbar_mouse_input(), toolbar_redraw(), toolbar_set_origin(), toolbar_set_throbber_state(), toolbar_set_url(), toolbar_set_width(), toolbar_throbber_progress(), toolbar_update_buttons(), window_get_grect(), and window_restore_active_gui_window().
Definition at line 896 of file toolbar.c.
References nsurl_create(), and toolbar_get_url().
struct textarea * toolbar_get_textarea | ( | struct s_toolbar * | tb, |
enum toolbar_textarea | which | ||
) |
Definition at line 875 of file toolbar.c.
References s_url_widget::textarea, and s_toolbar::url.
char * toolbar_get_url | ( | struct s_toolbar * | tb | ) |
Definition at line 881 of file toolbar.c.
References s_url_widget::textarea, textarea_get_text(), and s_toolbar::url.
Referenced by toolbar_favorite_click(), and toolbar_get_nsurl().
void toolbar_home_click | ( | struct s_toolbar * | tb | ) |
Definition at line 960 of file toolbar.c.
References atari_warn_user(), gui_window::browser, browser_window_navigate(), browser_window::bw, gui_window::bw, s_browser::bw, BW_NAVIGATE_HISTORY, NSERROR_OK, nsoption_charp, nsurl_create(), nsurl_unref(), s_toolbar::owner, gui_window::url, and window_get_active_gui_window().
Referenced by menu_home().
void toolbar_init | ( | void | ) |
Definition at line 236 of file toolbar.c.
References aes_toolbar, area_full_height, area_navigation_height, area_search_height, init, throbber_form, and toolbar_url_userdraw().
Referenced by gui_init().
bool toolbar_key_input | ( | struct s_toolbar * | tb, |
short | nkc | ||
) |
Definition at line 677 of file toolbar.c.
References atari_warn_user(), BROWSER, gui_window::browser, browser_window_navigate(), s_browser::bw, BW_NAVIGATE_HISTORY, clip(), clip_length, nkc_to_input_key(), NS_KEY_COPY_SELECTION, NS_KEY_CR, NS_KEY_DELETE_LEFT, NS_KEY_ESCAPE, NS_KEY_NL, NS_KEY_PASTE, NS_KEY_SELECT_ALL, NSERROR_OK, nsurl_create(), nsurl_unref(), s_toolbar::owner, PATH_MAX, scrap_txt_read(), scrap_txt_write(), text(), s_url_widget::textarea, textarea_get_text(), textarea_keypress(), toolbar_set_url(), gui_window::url, s_toolbar::url, utf8_from_local_encoding(), window_get_active_gui_window(), and window_set_focus().
Referenced by gui_window_create(), on_window_key_input(), and window_set_focus().
void toolbar_mouse_input | ( | struct s_toolbar * | tb, |
short | obj, | ||
short | button | ||
) |
Definition at line 755 of file toolbar.c.
References s_gui_win_root::active_gui_window, aes_event_out, gui_window::browser, BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_DOUBLE_CLICK, BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_HOLDING_1, BROWSER_MOUSE_HOVER, BROWSER_MOUSE_PRESS_1, button_off, s_browser::bw, s_tb_button::cb_click, find_button(), s_toolbar::form, nsatari_search_perform(), NSLOG, s_toolbar::owner, gui_window::search, SEARCH_FLAG_FORWARDS, SEARCH_INPUT, s_tb_button::state, s_url_widget::textarea, textarea_mouse_action(), toolbar_get_grect(), toolbar_update_buttons(), s_toolbar::url, URL_WIDGET, window_close_search(), window_get_active_gui_window(), window_process_redraws(), window_schedule_redraw_grect(), window_set_focus(), and window_url_widget_has_focus().
Referenced by handle_event().
void toolbar_redraw | ( | struct s_toolbar * | tb, |
GRECT * | clip | ||
) |
Definition at line 416 of file toolbar.c.
References s_toolbar::area, s_toolbar::attached, clip(), s_toolbar::form, s_throbber_widget::index, plot_set_dimensions(), plot_set_scale(), s_toolbar::reflow, s_url_widget::textarea, textarea_redraw(), s_toolbar::throbber, throbber_form, toolbar_get_grect(), toolbar_rdrw_ctx, toolbar_reflow(), toolbar_url_scale, s_toolbar::url, and rect::x0.
Referenced by toolbar_redraw_cb(), and window_process_redraws().
|
static |
Definition at line 364 of file toolbar.c.
References s_toolbar::area, s_toolbar::btcnt, button_off, button_on, s_toolbar::buttons, s_toolbar::form, s_throbber_widget::index, s_toolbar::reflow, s_tb_button::rsc_id, s_toolbar::search_visible, s_tb_button::state, s_toolbar::throbber, throbber_form, and toolbar_calculate_height().
Referenced by toolbar_get_grect(), toolbar_redraw(), toolbar_set_dimensions(), and toolbar_set_width().
void toolbar_reload_click | ( | struct s_toolbar * | tb | ) |
Definition at line 932 of file toolbar.c.
References gui_window::browser, browser_window_reload(), browser_window::bw, gui_window::bw, s_browser::bw, s_toolbar::owner, and window_get_active_gui_window().
Referenced by menu_reload().
void toolbar_set_attached | ( | struct s_toolbar * | tb, |
bool | attached | ||
) |
Definition at line 643 of file toolbar.c.
References s_toolbar::attached.
Referenced by window_open().
void toolbar_set_dimensions | ( | struct s_toolbar * | tb, |
GRECT * | area | ||
) |
Definition at line 561 of file toolbar.c.
References s_tb_button::area, s_toolbar::area, s_toolbar::form, s_toolbar::reflow, s_url_widget::textarea, textarea_set_dimensions(), toolbar_reflow(), and s_toolbar::url.
Referenced by window_open().
void toolbar_set_origin | ( | struct s_toolbar * | tb, |
short | x, | ||
short | y | ||
) |
Definition at line 548 of file toolbar.c.
References s_toolbar::area, s_toolbar::reflow, and toolbar_get_grect().
Referenced by on_resized().
void toolbar_set_reflow | ( | struct s_toolbar * | tb, |
bool | do_reflow | ||
) |
Definition at line 638 of file toolbar.c.
References s_toolbar::reflow.
void toolbar_set_throbber_state | ( | struct s_toolbar * | tb, |
bool | active | ||
) |
Definition at line 600 of file toolbar.c.
References gui_window::active, s_throbber_widget::index, s_toolbar::owner, s_toolbar::reflow, s_throbber_widget::running, s_toolbar::throbber, THROBBER_INACTIVE_INDEX, THROBBER_MIN_INDEX, toolbar_get_grect(), and window_schedule_redraw_grect().
Referenced by gui_window_start_throbber(), and gui_window_stop_throbber().
void toolbar_set_url | ( | struct s_toolbar * | tb, |
const char * | text | ||
) |
Definition at line 584 of file toolbar.c.
References s_tb_button::area, s_toolbar::attached, gui_window::browser, s_browser::bw, NSLOG, s_toolbar::owner, text(), s_url_widget::textarea, textarea_set_text(), toolbar_get_grect(), toolbar_update_buttons(), s_toolbar::url, s_toolbar::visible, window_get_active_gui_window(), and window_schedule_redraw_grect().
Referenced by gui_window_set_url(), toolbar_key_input(), and window_restore_active_gui_window().
void toolbar_set_visible | ( | struct s_toolbar * | tb, |
short | area, | ||
bool | visible | ||
) |
Definition at line 616 of file toolbar.c.
References s_toolbar::reflow, s_toolbar::search_visible, toolbar_get_form(), and s_toolbar::visible.
Referenced by window_close_search(), and window_open_search().
void toolbar_set_width | ( | struct s_toolbar * | tb, |
short | w | ||
) |
Definition at line 528 of file toolbar.c.
References s_toolbar::area, s_toolbar::form, s_toolbar::reflow, s_url_widget::textarea, textarea_set_dimensions(), toolbar_get_grect(), toolbar_reflow(), and s_toolbar::url.
Referenced by on_resized().
void toolbar_stop_click | ( | struct s_toolbar * | tb | ) |
Definition at line 992 of file toolbar.c.
References gui_window::browser, browser_window_stop(), browser_window::bw, gui_window::bw, s_browser::bw, s_toolbar::owner, and window_get_active_gui_window().
Referenced by menu_stop().
bool toolbar_text_input | ( | struct s_toolbar * | tb, |
char * | text | ||
) |
void toolbar_throbber_progress | ( | struct s_toolbar * | tb | ) |
Definition at line 649 of file toolbar.c.
References s_throbber_widget::index, s_toolbar::owner, s_toolbar::reflow, s_throbber_widget::running, s_toolbar::throbber, THROBBER_MAX_INDEX, THROBBER_MIN_INDEX, toolbar_get_grect(), and window_schedule_redraw_grect().
Referenced by throbber_advance().
void toolbar_update_buttons | ( | struct s_toolbar * | tb, |
struct browser_window * | bw, | ||
short | button | ||
) |
Definition at line 458 of file toolbar.c.
References s_tb_button::area, s_toolbar::attached, browser_window_back_available(), browser_window_forward_available(), browser_window_reload_available(), browser_window_stop_available(), button_off, button_on, find_button(), NSLOG, s_toolbar::owner, s_tb_button::state, toolbar_get_grect(), and window_schedule_redraw_grect().
Referenced by toolbar_mouse_input(), toolbar_set_url(), and window_update_back_forward().
|
static |
Definition at line 231 of file toolbar.c.
Referenced by toolbar_init().
|
extern |
Definition at line 105 of file gui.c.
Referenced by atari_poll(), and toolbar_mouse_input().
|
static |
Definition at line 87 of file toolbar.c.
Referenced by toolbar_create(), and toolbar_init().
|
static |
Definition at line 92 of file toolbar.c.
Referenced by toolbar_init().
|
static |
Definition at line 90 of file toolbar.c.
Referenced by toolbar_calculate_height(), and toolbar_init().
|
static |
Definition at line 91 of file toolbar.c.
Referenced by toolbar_calculate_height(), and toolbar_init().
|
extern |
Definition at line 209 of file plot.c.
Referenced by bitmap_convert_tc(), plot_get_flags(), plot_init(), plot_lock(), and plot_unlock().
|
extern |
Definition at line 208 of file plot.c.
Referenced by plot_arc(), plot_blit_bitmap(), plot_blit_mfdb(), plot_clip(), plot_copy_rect(), plot_disc(), plot_finalise(), plot_get_vdi_handle(), plot_init(), plot_line(), plot_polygon(), plot_rectangle(), plot_unlock(), and snapshot_create_native_mfdb().
|
static |
Definition at line 95 of file toolbar.c.
Referenced by toolbar_create().
|
static |
Definition at line 89 of file toolbar.c.
Referenced by menu_save_page(), toolbar_create(), and toolbar_init().
|
extern |
Definition at line 74 of file gui.c.
Referenced by atari_poll(), atari_window_set_status(), gui_get_input_window(), gui_set_input_gui_window(), gui_window_destroy(), gui_window_set_icon(), gui_window_set_pointer(), gui_window_set_title(), and gui_window_set_url().
|
extern |
Definition at line 88 of file gui.c.
Referenced by main(), and process_cmdline().
|
static |
Definition at line 107 of file toolbar.c.
Referenced by button_init(), ro_corewindow_init(), and toolbar_create().
|
static |
Definition at line 88 of file toolbar.c.
Referenced by toolbar_init(), toolbar_redraw(), and toolbar_reflow().
|
static |
Definition at line 156 of file toolbar.c.
Referenced by toolbar_redraw().
|
static |
Definition at line 145 of file toolbar.c.
Referenced by toolbar_create().
|
static |
Definition at line 93 of file toolbar.c.
Referenced by toolbar_redraw().