51#include "atari/res/netsurf.rsh"
55#define TB_BUTTON_WIDTH 32
56#define THROBBER_WIDTH 32
57#define THROBBER_MIN_INDEX 1
58#define THROBBER_MAX_INDEX 12
59#define THROBBER_INACTIVE_INDEX 13
65#define TOOLBAR_BUTTON_NUM_STATES 2
100 .background = 0xffffff,
138 { 0, 0, {0,0}, 0, -1, 0, {0,0,0,0}}
158 .background_images =
true,
170 while (i < tb->btcnt) {
225 instance->
owner = tb;
238 static USERBLK userblk;
244 userblk.ub_parm = (long)
aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk;
245 aes_toolbar[TOOLBAR_AREA_URL].ob_spec.userblk = &userblk;
247 aes_toolbar[TOOLBAR_CB_SHOWALL].ob_state &= ~OS_SELECTED;
248 aes_toolbar[TOOLBAR_CB_CASESENSE].ob_state &= ~OS_SELECTED;
251 gemtk_obj_set_str_safe(
aes_toolbar, TOOLBAR_TB_SRCH, (
char*)
"");
274 assert(
init ==
true);
299 for (i=0; i < t->
btcnt; i++) {
309 ta_setup.
width = 300;
310 ta_setup.
height = t->
form[TOOLBAR_AREA_URL].ob_height;
331 "created toolbar: %p, root: %p, textarea: %p, throbber: %p", t,
376 tb->
form[TOOLBAR_AREA_NAVIGATION].ob_width = tb->
area.g_w;
377 tb->
form[TOOLBAR_AREA_SEARCH].ob_width = tb->
area.g_w;
380 tb->
form[TOOLBAR_AREA_SEARCH].ob_state &= ~OF_HIDETREE;
382 tb->
form[TOOLBAR_AREA_SEARCH].ob_state |= OF_HIDETREE;
387 tb->
form[TOOLBAR_AREA_RIGHT].ob_x = tb->
area.g_w
388 - tb->
form[TOOLBAR_AREA_RIGHT].ob_width;
391 tb->
form[TOOLBAR_AREA_URL].ob_width = tb->
area.g_w
392 - (tb->
form[TOOLBAR_AREA_LEFT].ob_width
393 + tb->
form[TOOLBAR_AREA_RIGHT].ob_width);
396 objc_offset(tb->
form, TOOLBAR_THROBBER_AREA, &offx, &offy);
401 tb->
form[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_x = tb->
area.g_w
402 - tb->
form[TOOLBAR_SEARCH_ALIGN_RIGHT].ob_width;
405 for (i=0; i < tb->
btcnt; i++ ) {
441 .
x0 = MAX(0,area.g_x - area_ro.g_x),
442 .y0 = MAX(0,area.g_y - area_ro.g_y),
443 .x1 = MAX(0,area.g_x - area_ro.g_x) + area.g_w,
444 .y1 = MAX(0,area.g_y - area_ro.g_y) + area.g_h
462 NSLOG(netsurf, INFO,
"tb %p", tb);
470 if (button == TOOLBAR_BT_BACK || button <= 0 ) {
480 if (button == TOOLBAR_BT_HOME || button <= 0 ) {
484 if (button == TOOLBAR_BT_FORWARD || button <= 0 ) {
494 if (button == TOOLBAR_BT_RELOAD || button <= 0 ) {
504 if (button == TOOLBAR_BT_STOP || button <= 0) {
542 tb->
form[TOOLBAR_AREA_URL].ob_width,
543 tb->
form[TOOLBAR_AREA_URL].ob_height);
554 if (x != cur.g_x || y != cur.g_y) {
571 tb->
form[TOOLBAR_AREA_URL].ob_width,
572 tb->
form[TOOLBAR_AREA_URL].ob_height-1);
586 NSLOG(netsurf, INFO,
"tb %p", tb);
619 if ((visible ==
false) && (tb->
visible ==
true)) {
622 }
else if((visible ==
true) && (tb->
visible ==
false)) {
626 }
else if (area == TOOLBAR_AREA_SEARCH) {
630 if(visible ==
false){
631 frm[TOOLBAR_AREA_SEARCH].ob_flags |= OF_HIDETREE;
633 frm[TOOLBAR_AREA_SEARCH].ob_flags &= ~OF_HIDETREE;
672 NSLOG(netsurf, INFO,
"tb %p", tb);
684 assert( gw != NULL );
690 if ((nkc&0xFF) >= 9) {
716 text = malloc( len+1 );
758 short mx, my, mb, kstat;
761 NSLOG(netsurf, INFO,
"tb %p", tb);
764 if (obj==TOOLBAR_AREA_URL) {
765 graf_mkstate(&mx, &my, &mb, &kstat);
784 if (abs(prev_x-mx) > 5 || abs(prev_y-my) > 5) {
792 graf_mkstate( &mx, &my, &mb, &kstat );
793 mx = mx - (work.g_x);
794 my = my - (work.g_y);
800 }
else if (button & 2) {
818 }
else if(obj==TOOLBAR_TB_SRCH) {
821 }
else if (obj==TOOLBAR_BT_SEARCH_FWD) {
826 }
else if (obj==TOOLBAR_BT_SEARCH_BACK) {
831 }
else if (obj==TOOLBAR_BT_CLOSE_SEARCH) {
832 tb->
form[TOOLBAR_BT_CLOSE_SEARCH].ob_state &= ~OS_SELECTED;
856#define LAST_TOOLBAR_AREA TOOLBAR_AREA_SEARCH
862 objc_offset(tb->
form, which, &dst->g_x, &dst->g_y);
864 dst->g_w = tb->
form[which].ob_width;
865 dst->g_h = tb->
form[which].ob_height;
871#undef LAST_TOOLBAR_AREA
888 if (c_url_len > -1) {
889 c_url = malloc(c_url_len+1);
898 nsurl * ns_url = NULL;
965 char * use_url = NULL;
973 if (use_url == NULL || strlen(use_url) == 0){
974 use_url = (
char*)
"about:welcome";
1010 nsurl * ns_url = NULL;
1015 c_url_len = strlen(c_url);
1020 char msg[c_url_len+100];
1021 snprintf(msg, c_url_len+100,
"Really delete from favorites: \"%s\"",
1023 if (gemtk_msg_box_show(GEMTK_MSG_BOX_CONFIRM, msg)) {
int scrap_txt_write(char *str)
char * scrap_txt_read(void)
nserror atari_warn_user(const char *warning, const char *detail)
Warn the user of an event.
long nkc_to_input_key(short nkc, long *ucs4_out)
Convert NKC to netsurf input key code and/or to ucs4 (depends on keycode).
const struct plotter_table atari_plotters
atari plottr operation table
float plot_set_scale(float scale)
set scale of plotter.
bool plot_set_dimensions(const struct redraw_context *ctx, int x, int y, int w, int h)
Set plot origin and canvas size.
nserror browser_window_history_forward(struct browser_window *bw, bool new_window)
Go forward in the history.
nserror browser_window_history_back(struct browser_window *bw, bool new_window)
Go back in the history.
Interface to browser history operations.
Browser window creation and manipulation interface.
nserror browser_window_navigate(struct browser_window *bw, struct nsurl *url, struct nsurl *referrer, enum browser_window_nav_flags flags, char *post_urlenc, struct fetch_multipart_data *post_multipart, struct hlcache_handle *parent)
Start fetching a page in a browser window.
bool browser_window_back_available(struct browser_window *bw)
Check availability of Back action for a given browser window.
nserror browser_window_reload(struct browser_window *bw, bool all)
Reload the page in a browser window.
bool browser_window_reload_available(struct browser_window *bw)
Check availability of Reload action for a given browser window.
bool browser_window_forward_available(struct browser_window *bw)
Check availability of Forward action for a given browser window.
void browser_window_stop(struct browser_window *bw)
Stop all fetching activity in a browser window.
bool browser_window_stop_available(struct browser_window *bw)
Check availability of Stop action for a given browser window.
@ BW_NAVIGATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
nserror hotlist_add_url(nsurl *url)
Add an entry to the hotlist for given URL.
bool hotlist_has_url(nsurl *url)
Check whether given URL is present in hotlist.
void hotlist_remove_url(nsurl *url)
Remove any entries matching the given URL from the hotlist.
void textarea_redraw(struct textarea *ta, int x, int y, colour bg, float scale, const struct rect *clip, const struct redraw_context *ctx)
Handle redraw requests for text areas.
void textarea_set_dimensions(struct textarea *ta, int width, int height)
Set the dimensions of a textarea.
struct textarea * textarea_create(const textarea_flags flags, const textarea_setup *setup, textarea_client_callback callback, void *data)
Create a text area.
void textarea_destroy(struct textarea *ta)
Destroy a text area.
bool textarea_set_text(struct textarea *ta, const char *text)
Set the text in a text area, discarding any current text.
int textarea_get_text(struct textarea *ta, char *buf, unsigned int len)
Extract the text from a text area.
textarea_mouse_status textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
bool textarea_keypress(struct textarea *ta, uint32_t key)
Key press handling for text areas.
Single/Multi-line UTF-8 text area interface.
textarea_flags
Text area flags.
@ TEXTAREA_INTERNAL_CARET
Render own caret.
@ TEXTAREA_MSG_DRAG_REPORT
Textarea drag start/end report.
@ TEXTAREA_MSG_REDRAW_REQUEST
Textarea redraw request.
nserror
Enumeration of error codes.
nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
void nsatari_search_perform(struct s_search_form_session *s, OBJECT *obj, search_flags_t f)
static size_t clip_length
Core mouse and pointer states.
@ BROWSER_MOUSE_PRESS_1
primary button pressed
@ BROWSER_MOUSE_HOVER
No mouse buttons pressed, May be used to indicate hover or end of drag.
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
@ BROWSER_MOUSE_DOUBLE_CLICK
button double clicked
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
@ BROWSER_MOUSE_HOLDING_1
during button 1 drag
Target independent plotting interface.
Interface to key press operations.
#define NSLOG(catname, level, logmsg, args...)
NetSurf URL handling (interface).
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
@ PLOT_FONT_FAMILY_SANS_SERIF
#define PLOT_STYLE_SCALE
Scaling factor for plot styles.
struct gui_window * window_get_active_gui_window(ROOTWIN *rootwin)
void window_set_focus(struct s_gui_win_root *rootwin, enum focus_element_type type, void *element)
void window_schedule_redraw_grect(ROOTWIN *rootwin, GRECT *area)
void window_close_search(ROOTWIN *rootwin)
bool window_url_widget_has_focus(struct s_gui_win_root *rootwin)
void window_process_redraws(ROOTWIN *rootwin)
Interface to utility string handling.
struct browser_window * bw
first entry in window list
bool active
Whether the throbber should be active.
struct s_search_form_session * search
struct s_browser * browser
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
plot_font_generic_family_t family
Generic family to plot with.
colour foreground
Colour of text.
plot_style_fixed size
Font size, in pt.
colour background
Background colour to blend to, if appropriate.
bool interactive
Redraw to show interactive features.
struct browser_window * bw
struct gui_window * active_gui_window
textarea_msg_type type
Indicates message data type.
struct rect redraw
With _REDRAW_REQUEST.
union textarea_msg::@79 data
Depends on msg type.
textarea setup parameters
int pad_top
Textarea top padding.
colour border_col
Textarea border colour.
int height
Textarea height.
int border_width
Textarea border width.
int pad_right
Textarea right padding.
int pad_left
Textarea left padding.
plot_font_style_t text
Textarea background colour and font.
int pad_bottom
Textarea bottom padding.
colour selected_text
Textarea selected text colour.
colour selected_bg
Textarea selection background colour.
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
UTF-8 manipulation functions (interface).
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.