31#include <oslib/colourtrans.h>
32#include <oslib/osfile.h>
33#include <oslib/osgbpb.h>
34#include <oslib/osspriteop.h>
35#include <oslib/wimp.h>
63#define ICON_ZOOM_VALUE 1
64#define ICON_ZOOM_DEC 2
65#define ICON_ZOOM_INC 3
66#define ICON_ZOOM_FRAMES 5
67#define ICON_ZOOM_CANCEL 7
72#define MAX_PERSISTENT 64
95 wimp_menu *menu, wimp_pointer *pointer);
218 error = xwimp_create_window(window, &w);
220 NSLOG(netsurf, INFO,
"xwimp_create_window: 0x%x: %s",
221 error->errnum, error->errmess);
222 xwimp_close_template();
245 int context, window_size, data_size;
251 assert(strlen(template_name) <= 11);
254 strncpy(name, template_name,
sizeof name);
257 error = xwimp_load_template(wimp_GET_SIZE, 0, 0, wimp_NO_FONTS,
258 name, 0, &window_size, &data_size, &context);
260 NSLOG(netsurf, INFO,
"xwimp_load_template: 0x%x: %s",
261 error->errnum, error->errmess);
262 xwimp_close_template();
266 NSLOG(netsurf, INFO,
"template '%s' missing", template_name);
267 xwimp_close_template();
272 data = malloc(data_size);
273 window = malloc(window_size);
274 if (!data || !window) {
275 xwimp_close_template();
280 error = xwimp_load_template(window, data, data + data_size,
281 wimp_NO_FONTS, name, 0, 0, 0, 0);
283 NSLOG(netsurf, INFO,
"xwimp_load_template: 0x%x: %s",
284 error->errnum, error->errmess);
285 xwimp_close_template();
299 int screen_x, screen_y, dx, dy;
300 wimp_window_state state;
310 error = xwimp_get_window_state(&state);
312 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
313 error->errnum, error->errmess);
317 dx = (state.visible.x1 - state.visible.x0) / 2;
318 dy = (state.visible.y1 - state.visible.y0) / 2;
319 state.visible.x0 = screen_x - dx;
320 state.visible.x1 = screen_x + dx;
321 state.visible.y0 = screen_y - dy;
322 state.visible.y1 = screen_y + dy;
323 state.next = wimp_TOP;
339 wimp_w
parent = (wimp_w)-1;
362 error = xwimp_get_caret_position(&caret);
364 NSLOG(netsurf, INFO,
"xwimp_get_caret_position: 0x%x: %s",
365 error->errnum, error->errmess);
367 }
else if (caret.w == close) {
370 error = xwimp_set_caret_position(
372 wimp_ICON_WINDOW, -100, -100,
375 if ((error) && (error->errnum != 0x287)) {
377 "xwimp_set_caret_position: 0x%x: %s",
385 error = xwimp_close_window(close);
387 NSLOG(netsurf, INFO,
"xwimp_close_window: 0x%x: %s",
388 error->errnum, error->errmess);
416 int screen_width, screen_height;
417 wimp_window_state state;
421 error = xwimp_get_window_state(&state);
429 open = state.flags & wimp_WINDOW_OPEN;
439 dimension = ((
width == 0) ?
440 (state.visible.x1 - state.visible.x0) :
width);
442 state.visible.x0 = (screen_width - (dimension + scroll_width)) / 2;
443 state.visible.x1 = state.visible.x0 + dimension;
444 dimension = ((
height == 0) ?
445 (state.visible.y1 - state.visible.y0) :
height);
446 state.visible.y0 = (screen_height - dimension) / 2;
447 state.visible.y1 = state.visible.y0 + dimension;
455 state.next = wimp_TOP;
471 error = xwimp_get_pointer_info(&ptr);
473 NSLOG(netsurf, INFO,
"xwimp_get_pointer_info: 0x%x: %s",
474 error->errnum, error->errmess);
489 wimp_window_state state;
495 error = xwimp_get_window_state(&state);
497 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
498 error->errnum, error->errmess);
502 dx = (state.visible.x1 - state.visible.x0);
503 dy = (state.visible.y1 - state.visible.y0);
504 state.visible.x0 = x;
505 state.visible.x1 = x + dx;
506 state.visible.y0 = y - dy;
507 state.visible.y1 = y;
511 error = xwimp_close_window(w);
513 NSLOG(netsurf, INFO,
"xwimp_close_window: 0x%x: %s",
514 error->errnum, error->errmess);
520 state.next = wimp_TOP;
534 wimp_window_state state;
536 int dimension, scroll_width;
541 error = xwimp_get_window_state(&state);
544 "xwimp_get_window_state: 0x%x: %s",
551 mid_x = (state.visible.x0 + state.visible.x1 + scroll_width);
552 mid_y = (state.visible.y0 + state.visible.y1);
561 error = xwimp_get_window_state(&state);
563 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
564 error->errnum, error->errmess);
570 dimension = state.visible.x1 - state.visible.x0;
572 state.visible.x0 = mid_x - (dimension + scroll_width) / 2;
573 state.visible.x1 = state.visible.x0 + dimension;
574 dimension = state.visible.y1 - state.visible.y0;
575 state.visible.y0 = mid_y - dimension / 2;
576 state.visible.y1 = state.visible.y0 + dimension;
577 state.next = wimp_TOP;
602 wimp_WINDOW_CLOSE_ICON);
613 wimp_WINDOW_BACK_ICON);
627 NSLOG(netsurf, INFO,
"Unable to map persistent dialog to parent.");
657 "Persistent dialog close event: 0x%x",
691 char scale_buffer[8];
721 wimp_window *definition;
729 assert(definition != NULL);
735 NSLOG(netsurf, INFO,
"open_url URL icon not indirected");
736 xwimp_close_template();
742 xwimp_close_template();
753 NSLOG(netsurf, INFO,
"xwimp_create_window: 0x%x: %s",
754 error->errnum, error->errmess);
755 xwimp_close_template();
829 wimp_pointer *pointer)
void die(const char *error)
Cause an abnormal program termination.
Browser window creation and manipulation interface.
float browser_window_get_scale(struct browser_window *bw)
Gets the scale of a browser window.
nserror browser_window_create(enum browser_window_create_flags flags, struct nsurl *url, struct nsurl *referrer, struct browser_window *existing, struct browser_window **bw)
Create and open a new root browser window with the given page.
@ BW_CREATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
static osspriteop_area * buffer
The buffer characteristics.
nserror search_web_omni(const char *term, enum search_web_omni_flags flags, struct nsurl **url_out)
Generate a nsurl from a search term.
static struct @45 persistent_dialog[MAX_PERSISTENT]
static bool ro_gui_dialog_openurl_apply(wimp_w w)
wimp_w dialog_url_complete
void ro_gui_dialog_close_persistent(wimp_w parent)
Close persistent dialogs associated with a window.
void ro_gui_dialog_add_persistent(wimp_w parent, wimp_w w)
static bool ro_gui_dialog_open_url_init(void)
Create the Open URL dialogue, allocating storage for the URL field icon as we go.
void ro_gui_dialog_prepare_open_url(void)
Prepares the Open URL dialog.
static void ro_gui_dialog_open_centre_parent(wimp_w parent, wimp_w child)
Opens a window at the centre of either another window or the screen.
void ro_gui_dialog_update_zoom(struct gui_window *g)
Update the Scale View dialog to reflect the current window settings.
void ro_gui_dialog_open_persistent(wimp_w parent, wimp_w w, bool pointer)
Open a persistent dialog box relative to the pointer.
void ro_gui_dialog_open_at_pointer(wimp_w w)
Open window at the location of the pointer.
wimp_window * ro_gui_dialog_load_template(const char *template_name)
Load a template without creating a window.
void ro_gui_dialog_open(wimp_w w)
Open a dialog box, centred on the screen.
void ro_gui_save_options(void)
Save the current options.
bool ro_gui_dialog_open_top(wimp_w w, struct toolbar *toolbar, int width, int height)
Moves a window to the top of the stack.
void ro_gui_dialog_prepare_zoom(struct gui_window *g)
Prepares the Scale view dialog.
wimp_w ro_gui_dialog_create(const char *template_name)
Create a window from a template.
void ro_gui_dialog_init(void)
Load and create dialogs from template file.
void ro_gui_dialog_close(wimp_w close)
Close a dialog box.
static bool ro_gui_dialog_open_url_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu, wimp_pointer *pointer)
Callback to prepare menus in the Open URL dialog.
struct gui_window * ro_gui_current_zoom_gui
static bool ro_gui_dialog_zoom_apply(wimp_w w)
void ro_gui_dialog_open_xy(wimp_w w, int x, int y)
Open window at a specified location.
nserror
Enumeration of error codes.
void ro_gui_global_history_initialise(void)
initialise the global history window template ready for subsequent use.
RISc OS global history interface.
void ro_gui_hotlist_initialise(void)
initialise the hotlist window template ready for subsequent use.
void ro_gui_local_history_initialise(void)
initialise the local history window template ready for subsequent use.
RISC OS local history interface.
Browser window handling (interface).
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
Localised message support (interface).
NetSurf URL handling (interface).
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
void ro_gui_cookies_initialise(void)
initialise the cookies window template ready for subsequent use.
Interface to riscos cookie viewing using riscos core window.
void ro_gui_screen_size(int *width, int *height)
Find screen size in OS units.
osspriteop_area * gui_sprites
Sprite area containing pointer and hotlist sprites.
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
void ro_gui_open_window_request(wimp_open *open)
Handle Open_Window_Request events.
bool ro_gui_theme_install_apply(wimp_w w)
Install the downloaded theme.
#define ICON_WARNING_CONTINUE
#define ICON_THEME_INSTALL_CANCEL
wimp_w dialog_theme_install
void ro_gui_print_init(void)
Initialise the print dialog.
#define ICON_OPENURL_OPEN
#define RO_GUI_MAX_URL_SIZE
#define ICON_OPENURL_CANCEL
#define ICON_OPENURL_MENU
void ro_gui_search_init(void)
#define ICON_THEME_INSTALL_INSTALL
nserror ro_gui_pageinfo_initialise(void)
initialise the pageinfo window template ready for subsequent use.
Interface to page info core window for RISC OS.
File/object/selection saving (Interface).
void ro_gui_window_set_scale(struct gui_window *g, float scale)
Set a gui_window's scale.
bool ro_gui_save_ok(wimp_w w)
Handle OK click/keypress in the save dialog.
wimp_w ro_gui_saveas_create(const char *template_name)
Create the saveas dialogue from the given template, and the sprite area necessary for our thumbnail (...
void ro_gui_save_start_drag(wimp_pointer *pointer)
Starts a drag for the save dialog.
core web search facilities interface.
@ SEARCH_WEB_OMNI_NONE
no changes to default operation
Interface to utility string handling.
first entry in window list
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
void ro_gui_url_complete_entering(wimp_entering *entering)
Handle the pointer entering the URL completion window.
bool ro_gui_url_complete_click(wimp_pointer *pointer)
Handle mouse clicks in the URL completion window.
void ro_gui_url_complete_redraw(wimp_draw *redraw)
Redraws a section of the URL completion window.
Central repository for URL data (interface).
bool ro_gui_url_suggest_prepare_menu(void)
Builds the URL suggestion menu.
URL Suggestion Menu (interface).
wimp_menu * ro_gui_url_suggest_menu
nserror nsoption_write(const char *path, struct nsoption_s *opts, struct nsoption_s *defs)
Write options that have changed from the defaults to a file.
Option reading and saving interface.
Version information interface.
void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8)
Set the contents of a text or sprite icon to a string.
void ro_gui_wimp_update_window_furniture(wimp_w w, wimp_window_flags bic_mask, wimp_window_flags xor_mask)
Sets whether a piece of window furniture is present for a window.
void ro_gui_set_icon_shaded_state(wimp_w w, wimp_i i, bool state)
Set the shaded state of an icon.
const char * ro_gui_get_icon_string(wimp_w w, wimp_i i)
Read the contents of a text or sprite icon.
void ro_gui_set_icon_selected_state(wimp_w w, wimp_i i, bool state)
Set the selected state of an icon.
bool ro_gui_set_caret_first(wimp_w w)
Places the caret in the first available icon.
int ro_get_vscroll_width(wimp_w w)
Gets the vertical scrollbar width.
General RISC OS WIMP/OS library functions (interface).
bool ro_gui_wimp_event_register_text_field(wimp_w w, wimp_i i)
Register a text field to be automatically handled.
bool ro_gui_wimp_event_register_numeric_field(wimp_w w, wimp_i i, wimp_i up, wimp_i down, int min, int max, int stepping, int decimal_places)
Register a numeric field to be automatically handled.
bool ro_gui_wimp_event_set_help_prefix(wimp_w w, const char *help_prefix)
Set the associated help prefix for a given window.
bool ro_gui_wimp_event_register_redraw_window(wimp_w w, void(*callback)(wimp_draw *redraw))
Register a function to be called for all window redraw operations.
bool ro_gui_wimp_event_register_menu_gright(wimp_w w, wimp_i i, wimp_i gright, wimp_menu *menu)
Register an icon menu to be automatically handled.
bool ro_gui_wimp_event_register_cancel(wimp_w w, wimp_i i)
Register a function to be called for the Cancel action on a window.
bool ro_gui_wimp_event_memorise(wimp_w w)
Memorises the current state of any registered components in a window.
bool ro_gui_wimp_event_close_window(wimp_w w)
Service any close window handlers.
bool ro_gui_wimp_event_register_mouse_click(wimp_w w, bool(*callback)(wimp_pointer *pointer))
Register a function to be called for all mouse-clicks to icons in a window that don't have registered...
bool ro_gui_wimp_event_register_checkbox(wimp_w w, wimp_i i)
Register a checkbox to be automatically handled.
bool ro_gui_wimp_event_register_menu_prepare(wimp_w w, bool(*callback)(wimp_w w, wimp_i i, wimp_menu *m, wimp_pointer *p))
Register a function to be called before a menu is (re-)opened.
bool ro_gui_wimp_event_register_ok(wimp_w w, wimp_i i, bool(*callback)(wimp_w w))
Register a function to be called for the OK action on a window.
bool ro_gui_wimp_event_register_pointer_entering_window(wimp_w w, void(*callback)(wimp_entering *entering))
Register a function to be called for all pointer entering window requests.
bool ro_gui_wimp_event_register_button(wimp_w w, wimp_i i, void(*callback)(wimp_pointer *pointer))
Register a function to be called when a particular button is pressed.
Automated RISC OS WIMP event handling (interface).
A collection of grubby utilities for working with OSLib's wimp API.
#define PTR_WIMP_OPEN(pstate)