2003-08-27 02:37:32 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2005-02-25 01:00:41 +03:00
|
|
|
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
|
2003-08-27 02:37:32 +04:00
|
|
|
* Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk>
|
2005-12-31 07:40:49 +03:00
|
|
|
* Copyright 2005 Richard Wilson <info@tinct.net>
|
2004-07-25 23:25:26 +04:00
|
|
|
* Copyright 2004 Andrew Timmins <atimmins@blueyonder.co.uk>
|
2005-07-16 09:54:45 +04:00
|
|
|
* Copyright 2005 Adrian Lees <adrianl@users.sourceforge.net>
|
2014-01-26 20:28:56 +04:00
|
|
|
* Copyright 2014 Stephen Fryatt <stevef@netsurf-browser.org>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2003-08-27 02:37:32 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
2003-12-19 03:40:28 +03:00
|
|
|
#include <stddef.h>
|
2004-08-08 15:39:31 +04:00
|
|
|
#include <stdlib.h>
|
2003-08-27 02:37:32 +04:00
|
|
|
#include <string.h>
|
2003-08-28 00:09:57 +04:00
|
|
|
#include "oslib/colourtrans.h"
|
|
|
|
#include "oslib/osfile.h"
|
|
|
|
#include "oslib/osgbpb.h"
|
2008-07-27 02:29:15 +04:00
|
|
|
#include "oslib/osspriteop.h"
|
2003-08-27 02:37:32 +04:00
|
|
|
#include "oslib/wimp.h"
|
2005-02-25 01:00:41 +03:00
|
|
|
#include "rufl.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "utils/config.h"
|
|
|
|
#include "desktop/netsurf.h"
|
|
|
|
#include "render/font.h"
|
|
|
|
#include "riscos/configure.h"
|
|
|
|
#include "riscos/cookies.h"
|
|
|
|
#include "riscos/dialog.h"
|
|
|
|
#include "riscos/global_history.h"
|
|
|
|
#include "riscos/gui.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
#include "riscos/hotlist.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/menus.h"
|
2013-05-26 01:46:27 +04:00
|
|
|
#include "utils/nsoption.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/save.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
#include "riscos/sslcert.h"
|
2011-02-21 02:16:33 +03:00
|
|
|
#include "riscos/toolbar.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/url_complete.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
#include "riscos/url_suggest.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/wimp.h"
|
|
|
|
#include "riscos/wimp_event.h"
|
2009-03-28 04:15:02 +03:00
|
|
|
#include "riscos/wimputils.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "utils/log.h"
|
|
|
|
#include "utils/messages.h"
|
|
|
|
#include "utils/url.h"
|
|
|
|
#include "utils/utils.h"
|
2003-08-27 02:37:32 +04:00
|
|
|
|
2006-09-08 20:57:26 +04:00
|
|
|
#define ICON_ZOOM_VALUE 1
|
|
|
|
#define ICON_ZOOM_DEC 2
|
|
|
|
#define ICON_ZOOM_INC 3
|
|
|
|
#define ICON_ZOOM_FRAMES 5
|
|
|
|
#define ICON_ZOOM_CANCEL 7
|
|
|
|
#define ICON_ZOOM_OK 8
|
|
|
|
|
2005-07-16 09:54:45 +04:00
|
|
|
/* The maximum number of persistent dialogues
|
2004-07-08 21:28:56 +04:00
|
|
|
*/
|
2006-07-16 04:21:15 +04:00
|
|
|
#define MAX_PERSISTENT 64
|
2004-08-31 01:03:48 +04:00
|
|
|
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
wimp_w dialog_info, dialog_saveas,
|
2004-02-25 18:12:58 +03:00
|
|
|
dialog_401li,
|
2004-05-07 23:14:54 +04:00
|
|
|
dialog_zoom, dialog_pageinfo, dialog_objinfo, dialog_tooltip,
|
2013-10-03 23:04:29 +04:00
|
|
|
dialog_warning,
|
2004-09-14 03:56:18 +04:00
|
|
|
dialog_folder, dialog_entry, dialog_search, dialog_print,
|
2005-12-31 07:40:49 +03:00
|
|
|
dialog_url_complete, dialog_openurl;
|
2004-08-31 01:03:48 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
struct gui_window *ro_gui_current_zoom_gui;
|
|
|
|
|
2004-08-31 01:03:48 +04:00
|
|
|
|
2004-07-08 21:28:56 +04:00
|
|
|
/* A simple mapping of parent and child
|
|
|
|
*/
|
2004-07-27 19:49:28 +04:00
|
|
|
static struct {
|
|
|
|
wimp_w dialog;
|
|
|
|
wimp_w parent;
|
2005-07-16 09:54:45 +04:00
|
|
|
} persistent_dialog[MAX_PERSISTENT];
|
2003-08-27 02:37:32 +04:00
|
|
|
|
2004-08-31 01:03:48 +04:00
|
|
|
|
2014-01-26 18:35:57 +04:00
|
|
|
static bool ro_gui_dialog_open_url_init(void);
|
2005-12-31 07:40:49 +03:00
|
|
|
static bool ro_gui_dialog_openurl_apply(wimp_w w);
|
2011-02-21 02:16:33 +03:00
|
|
|
static bool ro_gui_dialog_open_url_menu_prepare(wimp_w w, wimp_i i,
|
|
|
|
wimp_menu *menu, wimp_pointer *pointer);
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
static bool ro_gui_dialog_zoom_apply(wimp_w w);
|
2003-08-27 02:37:32 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Load and create dialogs from template file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_init(void)
|
|
|
|
{
|
2005-12-31 07:40:49 +03:00
|
|
|
/* warning dialog */
|
|
|
|
dialog_warning = ro_gui_dialog_create("warning");
|
|
|
|
ro_gui_wimp_event_register_ok(dialog_warning, ICON_WARNING_CONTINUE,
|
|
|
|
NULL);
|
2006-12-01 17:37:21 +03:00
|
|
|
ro_gui_wimp_event_set_help_prefix(dialog_warning, "HelpWarning");
|
2005-12-31 07:40:49 +03:00
|
|
|
|
2006-01-07 00:25:34 +03:00
|
|
|
/* tooltip for history */
|
|
|
|
dialog_tooltip = ro_gui_dialog_create("tooltip");
|
|
|
|
|
|
|
|
/* configure window */
|
|
|
|
ro_gui_configure_initialise();
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2006-01-07 00:25:34 +03:00
|
|
|
/* 401 login window */
|
|
|
|
ro_gui_401login_init();
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* theme installation */
|
|
|
|
dialog_theme_install = ro_gui_dialog_create("theme_inst");
|
|
|
|
ro_gui_wimp_event_register_cancel(dialog_theme_install,
|
|
|
|
ICON_THEME_INSTALL_CANCEL);
|
|
|
|
ro_gui_wimp_event_register_ok(dialog_theme_install,
|
|
|
|
ICON_THEME_INSTALL_INSTALL,
|
|
|
|
ro_gui_theme_install_apply);
|
|
|
|
ro_gui_wimp_event_set_help_prefix(dialog_theme_install, "HelpThemeInst");
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* search */
|
|
|
|
ro_gui_search_init();
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* print */
|
|
|
|
ro_gui_print_init();
|
|
|
|
|
|
|
|
/* about us */
|
2003-08-27 02:37:32 +04:00
|
|
|
dialog_info = ro_gui_dialog_create("info");
|
2008-08-05 05:23:04 +04:00
|
|
|
ro_gui_set_icon_string(dialog_info, 4, netsurf_version, true);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_wimp_event_set_help_prefix(dialog_info, "HelpAppInfo");
|
2003-12-19 04:00:22 +03:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* page info */
|
2004-04-03 06:59:35 +04:00
|
|
|
dialog_pageinfo = ro_gui_dialog_create("pageinfo");
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_wimp_event_set_help_prefix(dialog_pageinfo, "HelpPageInfo");
|
|
|
|
|
|
|
|
/* object info */
|
2004-05-05 04:02:13 +04:00
|
|
|
dialog_objinfo = ro_gui_dialog_create("objectinfo");
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_wimp_event_set_help_prefix(dialog_objinfo, "HelpObjInfo");
|
|
|
|
|
|
|
|
/* save as */
|
|
|
|
dialog_saveas = ro_gui_saveas_create("saveas");
|
|
|
|
ro_gui_wimp_event_register_button(dialog_saveas, ICON_SAVE_ICON,
|
|
|
|
ro_gui_save_start_drag);
|
|
|
|
ro_gui_wimp_event_register_text_field(dialog_saveas, ICON_SAVE_PATH);
|
|
|
|
ro_gui_wimp_event_register_cancel(dialog_saveas, ICON_SAVE_CANCEL);
|
|
|
|
ro_gui_wimp_event_register_ok(dialog_saveas, ICON_SAVE_OK,
|
|
|
|
ro_gui_save_ok);
|
|
|
|
ro_gui_wimp_event_set_help_prefix(dialog_saveas, "HelpSaveAs");
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* url suggestion */
|
2005-02-03 16:18:22 +03:00
|
|
|
dialog_url_complete = ro_gui_dialog_create("url_suggest");
|
2006-01-01 16:58:31 +03:00
|
|
|
ro_gui_wimp_event_register_mouse_click(dialog_url_complete,
|
|
|
|
ro_gui_url_complete_click);
|
2013-09-08 14:55:21 +04:00
|
|
|
ro_gui_wimp_event_register_pointer_entering_window(dialog_url_complete,
|
|
|
|
ro_gui_url_complete_entering);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_wimp_event_register_redraw_window(dialog_url_complete,
|
|
|
|
ro_gui_url_complete_redraw);
|
|
|
|
ro_gui_wimp_event_set_help_prefix(dialog_url_complete, "HelpAutoURL");
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* open URL */
|
2014-01-26 18:35:57 +04:00
|
|
|
ro_gui_dialog_open_url_init();
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* scale view */
|
|
|
|
dialog_zoom = ro_gui_dialog_create("zoom");
|
|
|
|
ro_gui_wimp_event_register_numeric_field(dialog_zoom, ICON_ZOOM_VALUE,
|
|
|
|
ICON_ZOOM_INC, ICON_ZOOM_DEC, 10, 1600, 10, 0);
|
2006-09-08 20:57:26 +04:00
|
|
|
ro_gui_wimp_event_register_checkbox(dialog_zoom, ICON_ZOOM_FRAMES);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_wimp_event_register_cancel(dialog_zoom, ICON_ZOOM_CANCEL);
|
|
|
|
ro_gui_wimp_event_register_ok(dialog_zoom, ICON_ZOOM_OK,
|
|
|
|
ro_gui_dialog_zoom_apply);
|
|
|
|
ro_gui_wimp_event_set_help_prefix(dialog_zoom, "HelpScaleView");
|
2010-10-05 23:14:46 +04:00
|
|
|
|
|
|
|
/* Treeview initialisation has moved to the end, to allow any
|
|
|
|
* associated dialogues to be set up first.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* certificate verification window */
|
|
|
|
ro_gui_cert_preinitialise();
|
|
|
|
|
|
|
|
/* hotlist window */
|
|
|
|
ro_gui_hotlist_preinitialise();
|
|
|
|
|
|
|
|
/* global history window */
|
|
|
|
ro_gui_global_history_preinitialise();
|
|
|
|
|
|
|
|
/* cookies window */
|
|
|
|
ro_gui_cookies_preinitialise();
|
2003-08-27 02:37:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a window from a template.
|
2004-05-09 00:44:00 +04:00
|
|
|
*
|
|
|
|
* \param template_name name of template to load
|
|
|
|
* \return window handle
|
|
|
|
*
|
|
|
|
* Exits through die() on error.
|
2003-08-27 02:37:32 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
wimp_w ro_gui_dialog_create(const char *template_name)
|
|
|
|
{
|
|
|
|
wimp_window *window;
|
|
|
|
wimp_w w;
|
2004-05-09 00:44:00 +04:00
|
|
|
os_error *error;
|
2003-08-27 02:37:32 +04:00
|
|
|
|
2004-05-09 00:44:00 +04:00
|
|
|
window = ro_gui_dialog_load_template(template_name);
|
2003-08-27 02:37:32 +04:00
|
|
|
|
2004-05-09 00:44:00 +04:00
|
|
|
/* create window */
|
2005-12-31 07:40:49 +03:00
|
|
|
window->sprite_area = gui_sprites;
|
2004-05-09 00:44:00 +04:00
|
|
|
error = xwimp_create_window(window, &w);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_create_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
xwimp_close_template();
|
|
|
|
die(error->errmess);
|
|
|
|
}
|
2003-08-27 02:37:32 +04:00
|
|
|
|
|
|
|
/* the window definition is copied by the wimp and may be freed */
|
2004-05-09 00:44:00 +04:00
|
|
|
free(window);
|
2003-08-27 02:37:32 +04:00
|
|
|
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-09 00:44:00 +04:00
|
|
|
/**
|
|
|
|
* Load a template without creating a window.
|
|
|
|
*
|
|
|
|
* \param template_name name of template to load
|
|
|
|
* \return window block
|
|
|
|
*
|
|
|
|
* Exits through die() on error.
|
|
|
|
*/
|
|
|
|
|
|
|
|
wimp_window * ro_gui_dialog_load_template(const char *template_name)
|
|
|
|
{
|
|
|
|
char name[20];
|
|
|
|
int context, window_size, data_size;
|
|
|
|
char *data;
|
|
|
|
wimp_window *window;
|
|
|
|
os_error *error;
|
|
|
|
|
2006-03-26 01:48:32 +03:00
|
|
|
/* Template names must be <= 11 chars long */
|
|
|
|
assert(strlen(template_name) <= 11);
|
|
|
|
|
2004-05-09 00:44:00 +04:00
|
|
|
/* wimp_load_template won't accept a const char * */
|
|
|
|
strncpy(name, template_name, sizeof name);
|
|
|
|
|
|
|
|
/* find required buffer sizes */
|
|
|
|
error = xwimp_load_template(wimp_GET_SIZE, 0, 0, wimp_NO_FONTS,
|
|
|
|
name, 0, &window_size, &data_size, &context);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_load_template: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
xwimp_close_template();
|
|
|
|
die(error->errmess);
|
|
|
|
}
|
|
|
|
if (!context) {
|
|
|
|
LOG(("template '%s' missing", template_name));
|
|
|
|
xwimp_close_template();
|
|
|
|
die("Template");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* allocate space for indirected data and temporary window buffer */
|
|
|
|
data = malloc(data_size);
|
|
|
|
window = malloc(window_size);
|
|
|
|
if (!data || !window) {
|
|
|
|
xwimp_close_template();
|
|
|
|
die("NoMemory");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* load template */
|
|
|
|
error = xwimp_load_template(window, data, data + data_size,
|
|
|
|
wimp_NO_FONTS, name, 0, 0, 0, 0);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_load_template: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
xwimp_close_template();
|
|
|
|
die(error->errmess);
|
|
|
|
}
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-28 00:09:57 +04:00
|
|
|
/**
|
2009-01-10 03:18:34 +03:00
|
|
|
* Open a dialog box, centred on the screen.
|
2003-08-28 00:09:57 +04:00
|
|
|
*/
|
2004-07-27 19:49:28 +04:00
|
|
|
|
2003-08-28 00:09:57 +04:00
|
|
|
void ro_gui_dialog_open(wimp_w w)
|
|
|
|
{
|
2003-11-08 02:51:13 +03:00
|
|
|
int screen_x, screen_y, dx, dy;
|
2009-01-10 03:18:34 +03:00
|
|
|
wimp_window_state state;
|
2004-07-27 19:49:28 +04:00
|
|
|
os_error *error;
|
2003-08-28 00:09:57 +04:00
|
|
|
|
2003-10-23 04:09:17 +04:00
|
|
|
/* find screen centre in os units */
|
2003-11-08 02:51:13 +03:00
|
|
|
ro_gui_screen_size(&screen_x, &screen_y);
|
|
|
|
screen_x /= 2;
|
|
|
|
screen_y /= 2;
|
2003-08-28 00:09:57 +04:00
|
|
|
|
|
|
|
/* centre and open */
|
2009-01-10 03:18:34 +03:00
|
|
|
state.w = w;
|
|
|
|
error = xwimp_get_window_state(&state);
|
2004-07-27 19:49:28 +04:00
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_window_state: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
2009-01-10 03:18:34 +03:00
|
|
|
dx = (state.visible.x1 - state.visible.x0) / 2;
|
|
|
|
dy = (state.visible.y1 - state.visible.y0) / 2;
|
|
|
|
state.visible.x0 = screen_x - dx;
|
|
|
|
state.visible.x1 = screen_x + dx;
|
|
|
|
state.visible.y0 = screen_y - dy;
|
|
|
|
state.visible.y1 = screen_y + dy;
|
|
|
|
state.next = wimp_TOP;
|
2009-03-28 04:15:02 +03:00
|
|
|
ro_gui_open_window_request(PTR_WIMP_OPEN(&state));
|
2004-07-17 17:00:38 +04:00
|
|
|
|
2009-01-10 03:18:34 +03:00
|
|
|
/* Set the caret position */
|
2004-07-12 01:45:51 +04:00
|
|
|
ro_gui_set_caret_first(w);
|
2003-08-28 00:09:57 +04:00
|
|
|
}
|
|
|
|
|
2004-07-08 21:28:56 +04:00
|
|
|
|
|
|
|
/**
|
2005-12-31 07:40:49 +03:00
|
|
|
* Close a dialog box.
|
2004-07-08 21:28:56 +04:00
|
|
|
*/
|
2004-07-27 19:49:28 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
void ro_gui_dialog_close(wimp_w close)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
wimp_caret caret;
|
2004-07-08 21:28:56 +04:00
|
|
|
os_error *error;
|
2004-07-17 17:00:38 +04:00
|
|
|
|
2006-02-23 18:06:54 +03:00
|
|
|
/* Check if we're a persistent window */
|
|
|
|
for (i = 0; i < MAX_PERSISTENT; i++) {
|
|
|
|
if (persistent_dialog[i].dialog == close) {
|
|
|
|
/* We are => invalidate record */
|
2006-07-16 04:21:15 +04:00
|
|
|
persistent_dialog[i].parent = NULL;
|
2006-02-23 18:06:54 +03:00
|
|
|
persistent_dialog[i].dialog = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-16 04:21:15 +04:00
|
|
|
/* Close any child windows */
|
2007-03-26 16:28:19 +04:00
|
|
|
ro_gui_dialog_close_persistent(close);
|
2006-07-16 04:21:15 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* Give the caret back to the parent window. This code relies on
|
|
|
|
the fact that only tree windows and browser windows open
|
|
|
|
persistent dialogues, as the caret gets placed to no icon.
|
2004-07-08 21:28:56 +04:00
|
|
|
*/
|
2005-12-31 07:40:49 +03:00
|
|
|
error = xwimp_get_caret_position(&caret);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_caret_position: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
} else if (caret.w == close) {
|
2006-02-23 18:06:54 +03:00
|
|
|
/* Check if we are a persistent window */
|
|
|
|
if (i < MAX_PERSISTENT) {
|
|
|
|
error = xwimp_set_caret_position(
|
|
|
|
persistent_dialog[i].parent,
|
|
|
|
wimp_ICON_WINDOW, -100, -100,
|
|
|
|
32, -1);
|
|
|
|
/* parent may have been closed first */
|
|
|
|
if ((error) && (error->errnum != 0x287)) {
|
|
|
|
LOG(("xwimp_set_caret_position: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
2005-12-31 07:40:49 +03:00
|
|
|
}
|
2005-04-15 09:54:44 +04:00
|
|
|
}
|
2005-12-31 07:40:49 +03:00
|
|
|
}
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
error = xwimp_close_window(close);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_close_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Moves a window to the top of the stack.
|
2006-01-08 04:51:33 +03:00
|
|
|
*
|
2005-12-31 07:40:49 +03:00
|
|
|
* If the window is currently closed then:
|
|
|
|
*
|
|
|
|
* * The window is opened in the centre of the screen (at the supplied size)
|
|
|
|
* * Any toolbar editing session is stopped
|
|
|
|
* * The scroll position is set to the top of the window
|
|
|
|
*
|
|
|
|
* If the window is currently open then:
|
|
|
|
*
|
|
|
|
* * The window is brought to the top of the stack
|
|
|
|
*
|
|
|
|
* \param w the window to show
|
|
|
|
* \param toolbar the toolbar to consider
|
|
|
|
* \param width the window width if it is currently closed (or 0 to retain)
|
|
|
|
* \param height the window height if it is currently closed (or 0 to retain)
|
|
|
|
* \return true if the window was previously open
|
|
|
|
*/
|
|
|
|
bool ro_gui_dialog_open_top(wimp_w w, struct toolbar *toolbar,
|
|
|
|
int width, int height) {
|
|
|
|
os_error *error;
|
|
|
|
int screen_width, screen_height;
|
|
|
|
wimp_window_state state;
|
|
|
|
int dimension;
|
|
|
|
int scroll_width;
|
|
|
|
bool open;
|
|
|
|
|
|
|
|
state.w = w;
|
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we're open we jump to the top of the stack, if not then we
|
|
|
|
* open in the centre of the screen. */
|
|
|
|
open = state.flags & wimp_WINDOW_OPEN;
|
|
|
|
if (!open) {
|
|
|
|
/* cancel any editing */
|
2011-02-21 02:16:33 +03:00
|
|
|
if (ro_toolbar_get_editing(toolbar))
|
|
|
|
ro_toolbar_toggle_edit(toolbar);
|
2005-12-31 07:40:49 +03:00
|
|
|
|
|
|
|
/* move to the centre */
|
|
|
|
ro_gui_screen_size(&screen_width, &screen_height);
|
|
|
|
dimension = ((width == 0) ?
|
|
|
|
(state.visible.x1 - state.visible.x0) : width);
|
|
|
|
scroll_width = ro_get_vscroll_width(w);
|
|
|
|
state.visible.x0 = (screen_width - (dimension + scroll_width)) / 2;
|
|
|
|
state.visible.x1 = state.visible.x0 + dimension;
|
|
|
|
dimension = ((height == 0) ?
|
|
|
|
(state.visible.y1 - state.visible.y0) : height);
|
|
|
|
state.visible.y0 = (screen_height - dimension) / 2;
|
|
|
|
state.visible.y1 = state.visible.y0 + dimension;
|
|
|
|
state.xscroll = 0;
|
|
|
|
state.yscroll = 0;
|
|
|
|
if (toolbar)
|
2011-02-21 02:16:33 +03:00
|
|
|
state.yscroll = ro_toolbar_height(toolbar);
|
2005-12-31 07:40:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* open the window at the top of the stack */
|
|
|
|
state.next = wimp_TOP;
|
2009-03-28 04:15:02 +03:00
|
|
|
ro_gui_open_window_request(PTR_WIMP_OPEN(&state));
|
2005-12-31 07:40:49 +03:00
|
|
|
return open;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open window at the location of the pointer.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_open_at_pointer(wimp_w w)
|
|
|
|
{
|
|
|
|
wimp_pointer ptr;
|
|
|
|
os_error *error;
|
|
|
|
|
|
|
|
/* get the pointer position */
|
|
|
|
error = xwimp_get_pointer_info(&ptr);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_pointer_info: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-10 03:18:34 +03:00
|
|
|
ro_gui_dialog_open_xy(w, ptr.pos.x - 64, ptr.pos.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open window at a specified location.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_open_xy(wimp_w w, int x, int y)
|
|
|
|
{
|
|
|
|
wimp_window_state state;
|
|
|
|
os_error *error;
|
|
|
|
int dx, dy;
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* move the window */
|
|
|
|
state.w = w;
|
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_window_state: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
dx = (state.visible.x1 - state.visible.x0);
|
|
|
|
dy = (state.visible.y1 - state.visible.y0);
|
2009-01-10 03:18:34 +03:00
|
|
|
state.visible.x0 = x;
|
|
|
|
state.visible.x1 = x + dx;
|
|
|
|
state.visible.y0 = y - dy;
|
|
|
|
state.visible.y1 = y;
|
2005-12-31 07:40:49 +03:00
|
|
|
|
2006-03-25 23:13:51 +03:00
|
|
|
/* if the window is already open, close it first so that it opens fully
|
|
|
|
* on screen */
|
|
|
|
error = xwimp_close_window(w);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_close_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* open the window at the top of the stack */
|
|
|
|
state.next = wimp_TOP;
|
2009-03-28 04:15:02 +03:00
|
|
|
ro_gui_open_window_request(PTR_WIMP_OPEN(&state));
|
2005-12-31 07:40:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens a window at the centre of either another window or the screen
|
|
|
|
*
|
|
|
|
* /param parent the parent window (NULL for centre of screen)
|
|
|
|
* /param child the child window
|
|
|
|
*/
|
|
|
|
void ro_gui_dialog_open_centre_parent(wimp_w parent, wimp_w child) {
|
|
|
|
os_error *error;
|
|
|
|
wimp_window_state state;
|
|
|
|
int mid_x, mid_y;
|
|
|
|
int dimension, scroll_width;
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* get the parent window state */
|
|
|
|
if (parent) {
|
|
|
|
state.w = parent;
|
|
|
|
error = xwimp_get_window_state(&state);
|
2004-07-27 19:49:28 +04:00
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_window_state: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
2005-12-31 07:40:49 +03:00
|
|
|
scroll_width = ro_get_vscroll_width(parent);
|
|
|
|
mid_x = (state.visible.x0 + state.visible.x1 + scroll_width);
|
|
|
|
mid_y = (state.visible.y0 + state.visible.y1);
|
2004-07-16 20:33:45 +04:00
|
|
|
} else {
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_screen_size(&mid_x, &mid_y);
|
2004-07-16 20:33:45 +04:00
|
|
|
}
|
2005-12-31 07:40:49 +03:00
|
|
|
mid_x /= 2;
|
|
|
|
mid_y /= 2;
|
2004-07-17 17:00:38 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* get the child window state */
|
|
|
|
state.w = child;
|
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_window_state: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* move to the centre of the parent at the top of the stack */
|
|
|
|
dimension = state.visible.x1 - state.visible.x0;
|
|
|
|
scroll_width = ro_get_vscroll_width(history_window);
|
|
|
|
state.visible.x0 = mid_x - (dimension + scroll_width) / 2;
|
|
|
|
state.visible.x1 = state.visible.x0 + dimension;
|
|
|
|
dimension = state.visible.y1 - state.visible.y0;
|
|
|
|
state.visible.y0 = mid_y - dimension / 2;
|
|
|
|
state.visible.y1 = state.visible.y0 + dimension;
|
|
|
|
state.next = wimp_TOP;
|
2009-03-28 04:15:02 +03:00
|
|
|
ro_gui_open_window_request(PTR_WIMP_OPEN(&state));
|
2005-12-31 07:40:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a persistent dialog box relative to the pointer.
|
|
|
|
*
|
|
|
|
* \param parent the owning window (NULL for no owner)
|
|
|
|
* \param w the dialog window
|
|
|
|
* \param pointer open the window at the pointer (centre of the parent
|
|
|
|
* otherwise)
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_open_persistent(wimp_w parent, wimp_w w, bool pointer) {
|
|
|
|
|
|
|
|
if (pointer)
|
2009-01-10 03:18:34 +03:00
|
|
|
ro_gui_dialog_open_at_pointer(w);
|
2005-12-31 07:40:49 +03:00
|
|
|
else
|
|
|
|
ro_gui_dialog_open_centre_parent(parent, w);
|
|
|
|
|
|
|
|
/* todo: use wimp_event definitions rather than special cases */
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((w == dialog_pageinfo) || (w == dialog_objinfo))
|
|
|
|
ro_gui_wimp_update_window_furniture(w, wimp_WINDOW_CLOSE_ICON,
|
|
|
|
wimp_WINDOW_CLOSE_ICON);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_dialog_add_persistent(parent, w);
|
|
|
|
ro_gui_set_caret_first(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ro_gui_dialog_add_persistent(wimp_w parent, wimp_w w) {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* all persistant windows have a back icon */
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_wimp_update_window_furniture(w, wimp_WINDOW_BACK_ICON,
|
|
|
|
wimp_WINDOW_BACK_ICON);
|
2004-07-17 17:00:38 +04:00
|
|
|
|
2004-07-08 21:28:56 +04:00
|
|
|
/* Add a mapping
|
|
|
|
*/
|
2005-12-31 07:40:49 +03:00
|
|
|
if ((parent == NULL) || (parent == wimp_ICON_BAR))
|
2004-07-27 19:49:28 +04:00
|
|
|
return;
|
2005-07-16 09:54:45 +04:00
|
|
|
for (i = 0; i < MAX_PERSISTENT; i++) {
|
|
|
|
if (persistent_dialog[i].dialog == NULL ||
|
|
|
|
persistent_dialog[i].dialog == w) {
|
|
|
|
persistent_dialog[i].dialog = w;
|
|
|
|
persistent_dialog[i].parent = parent;
|
2004-07-08 21:28:56 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2005-07-16 09:54:45 +04:00
|
|
|
LOG(("Unable to map persistent dialog to parent."));
|
2005-12-31 07:40:49 +03:00
|
|
|
return;
|
2004-07-08 21:28:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2004-07-27 19:49:28 +04:00
|
|
|
* Close persistent dialogs associated with a window.
|
2004-07-08 21:28:56 +04:00
|
|
|
*
|
2004-07-27 19:49:28 +04:00
|
|
|
* \param parent the window to close children of
|
2004-07-08 21:28:56 +04:00
|
|
|
*/
|
2004-07-27 19:49:28 +04:00
|
|
|
|
2005-07-16 09:54:45 +04:00
|
|
|
void ro_gui_dialog_close_persistent(wimp_w parent) {
|
2010-10-05 23:14:46 +04:00
|
|
|
int i;
|
|
|
|
wimp_w w;
|
|
|
|
|
|
|
|
/* Check our mappings.
|
|
|
|
*
|
|
|
|
* The window handle is copied into w before proceeding, as
|
|
|
|
* ro_gui_dialog_close() will NULL persistent_dialog[i].dialog as
|
|
|
|
* part of the closing process. This would mean that the subsequent
|
|
|
|
* event dispatch would fail. (These events are logged to allow
|
|
|
|
* side effects to be investigated -- this code hasn't worked before).
|
|
|
|
*/
|
2005-07-16 09:54:45 +04:00
|
|
|
for (i = 0; i < MAX_PERSISTENT; i++) {
|
|
|
|
if (persistent_dialog[i].parent == parent &&
|
|
|
|
persistent_dialog[i].dialog != NULL) {
|
2010-10-05 23:14:46 +04:00
|
|
|
w = persistent_dialog[i].dialog;
|
|
|
|
ro_gui_dialog_close(w);
|
|
|
|
if (ro_gui_wimp_event_close_window(w))
|
|
|
|
LOG(("Persistent dialog close event: 0x%x",
|
|
|
|
(unsigned) w));
|
2007-03-26 16:28:19 +04:00
|
|
|
persistent_dialog[i].parent = NULL;
|
2005-07-16 09:54:45 +04:00
|
|
|
persistent_dialog[i].dialog = NULL;
|
2004-07-08 21:28:56 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-26 21:18:17 +03:00
|
|
|
/**
|
2005-12-31 07:40:49 +03:00
|
|
|
* Save the current options.
|
2003-08-27 02:37:32 +04:00
|
|
|
*/
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
void ro_gui_save_options(void)
|
2003-08-27 02:37:32 +04:00
|
|
|
{
|
2013-05-28 19:44:46 +04:00
|
|
|
nsoption_write("<NetSurf$ChoicesSave>", NULL, NULL);
|
2004-11-04 04:19:46 +03:00
|
|
|
}
|
2003-08-27 02:37:32 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
bool ro_gui_dialog_zoom_apply(wimp_w w) {
|
|
|
|
unsigned int scale;
|
2006-09-08 20:57:26 +04:00
|
|
|
bool all;
|
2004-07-27 19:49:28 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
scale = atoi(ro_gui_get_icon_string(w, ICON_ZOOM_VALUE));
|
2006-09-08 20:57:26 +04:00
|
|
|
all = ro_gui_get_icon_selected_state(w, ICON_ZOOM_FRAMES);
|
|
|
|
browser_window_set_scale(ro_gui_current_zoom_gui->bw, scale * 0.01, all);
|
2005-12-31 07:40:49 +03:00
|
|
|
return true;
|
2004-07-27 19:49:28 +04:00
|
|
|
}
|
|
|
|
|
2005-02-23 02:36:14 +03:00
|
|
|
|
|
|
|
/**
|
2005-12-31 07:40:49 +03:00
|
|
|
* Prepares the Scale view dialog.
|
2005-02-23 02:36:14 +03:00
|
|
|
*/
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
void ro_gui_dialog_prepare_zoom(struct gui_window *g)
|
2005-02-23 02:36:14 +03:00
|
|
|
{
|
2005-12-31 07:40:49 +03:00
|
|
|
char scale_buffer[8];
|
2012-08-22 15:22:58 +04:00
|
|
|
sprintf(scale_buffer, "%.0f", browser_window_get_scale(g->bw) * 100);
|
2008-08-05 05:23:04 +04:00
|
|
|
ro_gui_set_icon_string(dialog_zoom, ICON_ZOOM_VALUE, scale_buffer, true);
|
2006-09-08 20:57:26 +04:00
|
|
|
ro_gui_set_icon_selected_state(dialog_zoom, ICON_ZOOM_FRAMES, true);
|
2012-08-22 15:22:58 +04:00
|
|
|
ro_gui_set_icon_shaded_state(dialog_zoom, ICON_ZOOM_FRAMES, true);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_current_zoom_gui = g;
|
|
|
|
ro_gui_wimp_event_memorise(dialog_zoom);
|
2004-11-03 02:23:07 +03:00
|
|
|
}
|
2004-07-27 19:49:28 +04:00
|
|
|
|
2007-03-03 22:46:20 +03:00
|
|
|
/**
|
|
|
|
* Update the Scale View dialog to reflect the current window settings
|
|
|
|
*
|
|
|
|
* \param g the gui_window to update for
|
|
|
|
*/
|
|
|
|
void ro_gui_dialog_update_zoom(struct gui_window *g) {
|
|
|
|
if (g == ro_gui_current_zoom_gui)
|
|
|
|
ro_gui_dialog_prepare_zoom(g);
|
|
|
|
}
|
|
|
|
|
2005-02-23 02:36:14 +03:00
|
|
|
|
2014-01-26 18:35:57 +04:00
|
|
|
/**
|
|
|
|
* Create the Open URL dialogue, allocating storage for the URL field icon
|
|
|
|
* as we go.
|
|
|
|
*
|
|
|
|
* \return true on success; false on failure (although errors with
|
|
|
|
* the templates or memory allocation will exit via die()).
|
|
|
|
*/
|
|
|
|
|
|
|
|
static bool ro_gui_dialog_open_url_init(void)
|
|
|
|
{
|
|
|
|
wimp_window *definition;
|
|
|
|
char *buffer;
|
|
|
|
os_error *error;
|
|
|
|
|
|
|
|
definition = ro_gui_dialog_load_template("open_url");
|
|
|
|
|
|
|
|
/* _load_template() should die on any error, so we trust its data. */
|
|
|
|
|
|
|
|
assert(definition != NULL);
|
|
|
|
|
|
|
|
/* Create the dialogue, with modifications. */
|
|
|
|
|
|
|
|
if ((definition->icons[ICON_OPENURL_URL].flags & wimp_ICON_INDIRECTED)
|
|
|
|
== 0) {
|
|
|
|
LOG(("open_url URL icon not indirected"));
|
|
|
|
xwimp_close_template();
|
|
|
|
die("Template");
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer = malloc(RO_GUI_MAX_URL_SIZE);
|
|
|
|
if (buffer == NULL) {
|
|
|
|
xwimp_close_template();
|
|
|
|
die("NoMemory");
|
|
|
|
}
|
|
|
|
|
|
|
|
definition->icons[ICON_OPENURL_URL].data.indirected_text.text = buffer;
|
|
|
|
definition->icons[ICON_OPENURL_URL].data.indirected_text.size =
|
|
|
|
RO_GUI_MAX_URL_SIZE;
|
|
|
|
definition->sprite_area = gui_sprites;
|
|
|
|
|
|
|
|
error = xwimp_create_window(definition, &dialog_openurl);
|
|
|
|
if (error != NULL) {
|
|
|
|
LOG(("xwimp_create_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
xwimp_close_template();
|
|
|
|
die(error->errmess);
|
|
|
|
}
|
|
|
|
|
|
|
|
free(definition);
|
|
|
|
|
|
|
|
ro_gui_wimp_event_register_menu_gright(dialog_openurl, ICON_OPENURL_URL,
|
|
|
|
ICON_OPENURL_MENU, ro_gui_url_suggest_menu);
|
|
|
|
ro_gui_wimp_event_register_cancel(dialog_openurl, ICON_OPENURL_CANCEL);
|
|
|
|
ro_gui_wimp_event_register_ok(dialog_openurl, ICON_OPENURL_OPEN,
|
|
|
|
ro_gui_dialog_openurl_apply);
|
|
|
|
ro_gui_wimp_event_register_menu_prepare(dialog_openurl,
|
|
|
|
ro_gui_dialog_open_url_menu_prepare);
|
|
|
|
ro_gui_wimp_event_set_help_prefix(dialog_openurl, "HelpOpenURL");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
bool ro_gui_dialog_openurl_apply(wimp_w w) {
|
2013-02-14 22:21:11 +04:00
|
|
|
const char *urltxt;
|
2005-12-31 07:40:49 +03:00
|
|
|
char *url2;
|
2013-02-14 22:21:11 +04:00
|
|
|
nsurl *url;
|
|
|
|
nserror error;
|
2004-09-14 03:56:18 +04:00
|
|
|
|
2013-02-14 22:21:11 +04:00
|
|
|
urltxt = ro_gui_get_icon_string(w, ICON_OPENURL_URL);
|
|
|
|
url2 = strdup(urltxt); /** @todo why is this copied */
|
|
|
|
if (url2 == NULL) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
error = nsurl_create(url2, &url);
|
|
|
|
free(url2);
|
|
|
|
if (error == NSERROR_OK) {
|
2013-02-18 15:51:42 +04:00
|
|
|
error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
|
|
|
|
BROWSER_WINDOW_HISTORY,
|
2013-02-14 22:21:11 +04:00
|
|
|
url,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
nsurl_unref(url);
|
2004-11-03 02:23:07 +03:00
|
|
|
}
|
2013-02-14 22:21:11 +04:00
|
|
|
if (error != NSERROR_OK) {
|
|
|
|
warn_user(messages_get_errorcode(error), 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
2004-07-27 19:49:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-27 02:37:32 +04:00
|
|
|
/**
|
2005-12-31 07:40:49 +03:00
|
|
|
* Prepares the Open URL dialog.
|
2003-08-27 02:37:32 +04:00
|
|
|
*/
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
void ro_gui_dialog_prepare_open_url(void)
|
2005-04-08 00:46:22 +04:00
|
|
|
{
|
2008-08-05 05:23:04 +04:00
|
|
|
ro_gui_set_icon_string(dialog_openurl, ICON_OPENURL_URL, "", true);
|
2005-05-11 02:49:41 +04:00
|
|
|
ro_gui_set_icon_shaded_state(dialog_openurl,
|
2010-10-05 23:14:46 +04:00
|
|
|
ICON_OPENURL_MENU, !ro_gui_url_suggest_prepare_menu());
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_wimp_event_memorise(dialog_openurl);
|
2004-08-31 01:03:48 +04:00
|
|
|
}
|
2011-02-21 02:16:33 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback to prepare menus in the Open URL dialog. At present, this
|
|
|
|
* only has to handle the URL Suggestion pop-up.
|
|
|
|
*
|
|
|
|
* \param w The window handle owning the menu.
|
|
|
|
* \param i The icon handle owning the menu.
|
|
|
|
* \param *menu The menu to be prepared.
|
|
|
|
* \param *pointer The associated mouse click event block, or NULL
|
|
|
|
* on an Adjust-click re-opening.
|
|
|
|
* \return true if the event was handled; false if not.
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool ro_gui_dialog_open_url_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
|
|
|
|
wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
if (menu != ro_gui_url_suggest_menu || i != ICON_OPENURL_MENU)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (pointer != NULL)
|
|
|
|
return ro_gui_url_suggest_prepare_menu();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|