2003-08-27 02:37:32 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2004-02-13 19:09:12 +03:00
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
2003-08-27 02:37:32 +04:00
|
|
|
* Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk>
|
2004-04-17 20:45:46 +04:00
|
|
|
* Copyright 2004 Richard Wilson <not_ginger_matt@users.sourceforge.net>
|
2003-08-27 02:37:32 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
2003-12-19 03:40:28 +03:00
|
|
|
#include <stddef.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"
|
|
|
|
#include "oslib/osspriteop.h"
|
2003-08-27 02:37:32 +04:00
|
|
|
#include "oslib/wimp.h"
|
2004-01-05 05:10:59 +03:00
|
|
|
#include "netsurf/utils/config.h"
|
2003-12-19 20:11:07 +03:00
|
|
|
#include "netsurf/desktop/netsurf.h"
|
2003-08-27 02:37:32 +04:00
|
|
|
#include "netsurf/riscos/gui.h"
|
|
|
|
#include "netsurf/riscos/options.h"
|
2004-05-23 03:04:44 +04:00
|
|
|
#include "netsurf/riscos/theme.h"
|
2004-05-05 02:23:44 +04:00
|
|
|
#include "netsurf/riscos/wimp.h"
|
2003-08-28 00:09:57 +04:00
|
|
|
#include "netsurf/utils/log.h"
|
2003-11-09 00:47:10 +03:00
|
|
|
#include "netsurf/utils/messages.h"
|
2003-08-27 02:37:32 +04:00
|
|
|
#include "netsurf/utils/utils.h"
|
|
|
|
|
2004-07-08 21:28:56 +04:00
|
|
|
/* The maximum number of persistant dialogues
|
|
|
|
*/
|
|
|
|
#define MAX_PERSISTANT 8
|
|
|
|
|
2003-08-27 02:37:32 +04:00
|
|
|
wimp_w dialog_info, dialog_saveas, dialog_config, dialog_config_br,
|
2004-02-25 18:12:58 +03:00
|
|
|
dialog_config_prox, dialog_config_th, download_template,
|
2004-01-05 05:10:59 +03:00
|
|
|
#ifdef WITH_AUTH
|
2004-02-25 18:12:58 +03:00
|
|
|
dialog_401li,
|
2004-01-05 05:10:59 +03:00
|
|
|
#endif
|
2004-05-07 23:14:54 +04:00
|
|
|
dialog_zoom, dialog_pageinfo, dialog_objinfo, dialog_tooltip,
|
2004-07-09 02:05:35 +04:00
|
|
|
dialog_warning, dialog_config_th_pane, dialog_debug,
|
|
|
|
dialog_folder, dialog_entry;
|
2003-08-28 00:09:57 +04:00
|
|
|
|
2004-02-14 02:07:42 +03:00
|
|
|
static int font_size;
|
|
|
|
static int font_min_size;
|
2004-05-23 03:04:44 +04:00
|
|
|
static char *theme_choice = 0;
|
|
|
|
static struct theme_entry *theme_list = 0;
|
|
|
|
static unsigned int theme_list_entries = 0;
|
2004-02-14 02:07:42 +03:00
|
|
|
|
2004-07-08 21:28:56 +04:00
|
|
|
/* A simple mapping of parent and child
|
|
|
|
*/
|
|
|
|
static wimp_w persistant_dialog[MAX_PERSISTANT][1];
|
2003-08-27 02:37:32 +04:00
|
|
|
|
|
|
|
static void ro_gui_dialog_click_config(wimp_pointer *pointer);
|
|
|
|
static void ro_gui_dialog_click_config_br(wimp_pointer *pointer);
|
2004-02-14 02:07:42 +03:00
|
|
|
static void ro_gui_dialog_update_config_br(void);
|
2003-08-27 02:37:32 +04:00
|
|
|
static void ro_gui_dialog_click_config_prox(wimp_pointer *pointer);
|
2004-05-23 03:04:44 +04:00
|
|
|
static void ro_gui_dialog_open_config_th(void);
|
2003-08-27 02:37:32 +04:00
|
|
|
static void ro_gui_dialog_click_config_th(wimp_pointer *pointer);
|
2004-05-23 03:04:44 +04:00
|
|
|
static void ro_gui_dialog_click_config_th_pane(wimp_pointer *pointer);
|
|
|
|
static void ro_gui_redraw_config_th_pane_plot(wimp_draw *redraw);
|
2004-02-25 18:12:58 +03:00
|
|
|
static void ro_gui_dialog_click_zoom(wimp_pointer *pointer);
|
2004-04-17 20:45:46 +04:00
|
|
|
static void ro_gui_dialog_reset_zoom(void);
|
2004-05-07 23:14:54 +04:00
|
|
|
static void ro_gui_dialog_click_warning(wimp_pointer *pointer);
|
2004-02-13 19:09:12 +03:00
|
|
|
static void set_browser_choices(void);
|
|
|
|
static void get_browser_choices(void);
|
|
|
|
static void set_proxy_choices(void);
|
|
|
|
static void get_proxy_choices(void);
|
|
|
|
static void set_theme_choices(void);
|
|
|
|
static void get_theme_choices(void);
|
2004-03-08 03:03:58 +03:00
|
|
|
static const char *language_name(const char *code);
|
2003-08-27 02:37:32 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load and create dialogs from template file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_init(void)
|
|
|
|
{
|
|
|
|
dialog_info = ro_gui_dialog_create("info");
|
2003-11-09 00:47:10 +03:00
|
|
|
/* fill in about box version info */
|
2004-02-26 03:44:42 +03:00
|
|
|
ro_gui_set_icon_string(dialog_info, 4, netsurf_version);
|
2003-12-19 04:00:22 +03:00
|
|
|
|
2003-08-27 02:37:32 +04:00
|
|
|
dialog_saveas = ro_gui_dialog_create("saveas");
|
|
|
|
dialog_config = ro_gui_dialog_create("config");
|
|
|
|
dialog_config_br = ro_gui_dialog_create("config_br");
|
|
|
|
dialog_config_prox = ro_gui_dialog_create("config_prox");
|
|
|
|
dialog_config_th = ro_gui_dialog_create("config_th");
|
2004-06-05 20:07:13 +04:00
|
|
|
dialog_config_th_pane = ro_gui_dialog_create("config_th_p");
|
2004-02-25 18:12:58 +03:00
|
|
|
dialog_zoom = ro_gui_dialog_create("zoom");
|
2004-04-03 06:59:35 +04:00
|
|
|
dialog_pageinfo = ro_gui_dialog_create("pageinfo");
|
2004-05-05 04:02:13 +04:00
|
|
|
dialog_objinfo = ro_gui_dialog_create("objectinfo");
|
2004-04-13 01:46:08 +04:00
|
|
|
dialog_tooltip = ro_gui_dialog_create("tooltip");
|
2004-05-07 23:14:54 +04:00
|
|
|
dialog_warning = ro_gui_dialog_create("warning");
|
2004-06-11 00:41:26 +04:00
|
|
|
dialog_debug = ro_gui_dialog_create("debug");
|
2004-07-09 02:05:35 +04:00
|
|
|
dialog_folder = ro_gui_dialog_create("new_folder");
|
|
|
|
dialog_entry = ro_gui_dialog_create("new_entry");
|
2003-08-28 00:09:57 +04:00
|
|
|
|
2004-02-13 19:09:12 +03:00
|
|
|
set_browser_choices();
|
|
|
|
set_proxy_choices();
|
|
|
|
set_theme_choices();
|
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 */
|
|
|
|
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;
|
|
|
|
|
|
|
|
/* 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
|
|
|
/**
|
|
|
|
* Open a dialog box, centered on the screen.
|
|
|
|
*/
|
|
|
|
void ro_gui_dialog_open(wimp_w w)
|
|
|
|
{
|
2003-11-08 02:51:13 +03:00
|
|
|
int screen_x, screen_y, dx, dy;
|
2004-05-23 03:04:44 +04:00
|
|
|
wimp_window_state open;
|
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 */
|
|
|
|
open.w = w;
|
|
|
|
wimp_get_window_state(&open);
|
|
|
|
dx = (open.visible.x1 - open.visible.x0) / 2;
|
|
|
|
dy = (open.visible.y1 - open.visible.y0) / 2;
|
|
|
|
open.visible.x0 = screen_x - dx;
|
|
|
|
open.visible.x1 = screen_x + dx;
|
|
|
|
open.visible.y0 = screen_y - dy;
|
|
|
|
open.visible.y1 = screen_y + dy;
|
|
|
|
open.next = wimp_TOP;
|
|
|
|
wimp_open_window((wimp_open *) &open);
|
2004-07-12 01:45:51 +04:00
|
|
|
|
|
|
|
/* Set the caret position
|
|
|
|
*/
|
|
|
|
ro_gui_set_caret_first(w);
|
2003-08-28 00:09:57 +04:00
|
|
|
}
|
|
|
|
|
2004-07-08 21:28:56 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a persistant dialog box relative to the pointer.
|
|
|
|
*
|
2004-07-16 20:33:45 +04:00
|
|
|
* \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)
|
2004-07-08 21:28:56 +04:00
|
|
|
*/
|
2004-07-16 20:33:45 +04:00
|
|
|
void ro_gui_dialog_open_persistant(wimp_w parent, wimp_w w, bool pointer) {
|
2004-07-08 21:28:56 +04:00
|
|
|
int dx, dy, i;
|
2004-07-16 20:33:45 +04:00
|
|
|
wimp_pointer ptr;
|
2004-07-08 21:28:56 +04:00
|
|
|
wimp_window_state open;
|
|
|
|
os_error *error;
|
|
|
|
|
|
|
|
/* Get the pointer position
|
|
|
|
*/
|
2004-07-16 20:33:45 +04:00
|
|
|
error = xwimp_get_pointer_info(&ptr);
|
2004-07-08 21:28:56 +04:00
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_pointer_info: 0x%x: %s\n",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Move and open
|
|
|
|
*/
|
2004-07-16 20:33:45 +04:00
|
|
|
if (pointer) {
|
|
|
|
open.w = w;
|
|
|
|
wimp_get_window_state(&open);
|
|
|
|
dx = (open.visible.x1 - open.visible.x0);
|
|
|
|
dy = (open.visible.y1 - open.visible.y0);
|
|
|
|
open.visible.x0 = ptr.pos.x - 64;
|
|
|
|
open.visible.x1 = ptr.pos.x - 64 + dx;
|
|
|
|
open.visible.y0 = ptr.pos.y - dy;
|
|
|
|
open.visible.y1 = ptr.pos.y;
|
|
|
|
open.next = wimp_TOP;
|
|
|
|
wimp_open_window((wimp_open *) &open);
|
|
|
|
} else {
|
|
|
|
ro_gui_open_window_centre(parent, w);
|
|
|
|
}
|
2004-07-08 21:28:56 +04:00
|
|
|
|
2004-07-12 01:45:51 +04:00
|
|
|
/* Set the caret position
|
|
|
|
*/
|
|
|
|
ro_gui_set_caret_first(w);
|
|
|
|
|
2004-07-08 21:28:56 +04:00
|
|
|
/* Add a mapping
|
|
|
|
*/
|
|
|
|
if (parent == NULL) return;
|
|
|
|
for (i = 0; i < MAX_PERSISTANT; i++) {
|
|
|
|
if ((persistant_dialog[i][0] == NULL) || (persistant_dialog[i][0] == w)) {
|
|
|
|
persistant_dialog[i][0] = w;
|
|
|
|
persistant_dialog[i][1] = parent;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Log that we failed to create a mapping
|
|
|
|
*/
|
|
|
|
LOG(("Unable to map persistant dialog to parent."));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a persistant dialog box relative to the pointer.
|
|
|
|
*
|
|
|
|
* \param parent the window to close children of
|
|
|
|
*/
|
|
|
|
void ro_gui_dialog_close_persistant(wimp_w parent) {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Check our mappings
|
|
|
|
*/
|
|
|
|
if (parent == NULL) return;
|
|
|
|
for (i = 0; i < MAX_PERSISTANT; i++) {
|
2004-07-12 23:55:49 +04:00
|
|
|
if ((persistant_dialog[i][1] == parent) && (persistant_dialog[i][0] != NULL)) {
|
|
|
|
ro_gui_dialog_close(persistant_dialog[i][0]);
|
2004-07-08 21:28:56 +04:00
|
|
|
persistant_dialog[i][0] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-26 21:18:17 +03:00
|
|
|
/**
|
|
|
|
* Handle key presses in one of the dialog boxes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool ro_gui_dialog_keypress(wimp_key *key)
|
|
|
|
{
|
2004-07-12 03:14:24 +04:00
|
|
|
wimp_pointer pointer;
|
2004-07-12 01:45:51 +04:00
|
|
|
if (key->c == wimp_KEY_ESCAPE) {
|
|
|
|
ro_gui_dialog_close(key->w);
|
|
|
|
return true;
|
|
|
|
}
|
2004-07-12 03:14:24 +04:00
|
|
|
if (key->c == wimp_KEY_RETURN) {
|
|
|
|
if ((key->w == dialog_folder) || (key->w == dialog_entry)) {
|
|
|
|
pointer.w = key->w;
|
|
|
|
pointer.i = (key->w == dialog_folder) ? 3 : 5;
|
|
|
|
pointer.buttons = wimp_CLICK_SELECT;
|
|
|
|
ro_gui_hotlist_dialog_click(&pointer);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2004-01-05 05:10:59 +03:00
|
|
|
#ifdef WITH_AUTH
|
2003-12-26 21:18:17 +03:00
|
|
|
if (key->w == dialog_401li)
|
|
|
|
return ro_gui_401login_keypress(key);
|
2004-01-05 05:10:59 +03:00
|
|
|
#endif
|
2003-12-26 21:18:17 +03:00
|
|
|
return false;
|
|
|
|
}
|
2003-08-28 00:09:57 +04:00
|
|
|
|
2003-08-27 02:37:32 +04:00
|
|
|
/**
|
|
|
|
* Handle clicks in one of the dialog boxes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_click(wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
if (pointer->buttons == wimp_CLICK_MENU)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (pointer->w == dialog_config)
|
|
|
|
ro_gui_dialog_click_config(pointer);
|
|
|
|
else if (pointer->w == dialog_config_br)
|
|
|
|
ro_gui_dialog_click_config_br(pointer);
|
|
|
|
else if (pointer->w == dialog_config_prox)
|
|
|
|
ro_gui_dialog_click_config_prox(pointer);
|
|
|
|
else if (pointer->w == dialog_config_th)
|
|
|
|
ro_gui_dialog_click_config_th(pointer);
|
2004-05-23 03:04:44 +04:00
|
|
|
else if (pointer->w == dialog_config_th_pane)
|
|
|
|
ro_gui_dialog_click_config_th_pane(pointer);
|
2004-01-05 05:10:59 +03:00
|
|
|
#ifdef WITH_AUTH
|
2003-10-23 04:09:17 +04:00
|
|
|
else if (pointer->w == dialog_401li)
|
|
|
|
ro_gui_401login_click(pointer);
|
2004-01-05 05:10:59 +03:00
|
|
|
#endif
|
2004-02-25 18:12:58 +03:00
|
|
|
else if (pointer->w == dialog_zoom)
|
2004-05-07 23:14:54 +04:00
|
|
|
ro_gui_dialog_click_zoom(pointer);
|
|
|
|
else if (pointer->w == dialog_warning)
|
|
|
|
ro_gui_dialog_click_warning(pointer);
|
2004-07-12 03:14:24 +04:00
|
|
|
else if ((pointer->w == dialog_folder) || (pointer->w == dialog_entry))
|
|
|
|
ro_gui_hotlist_dialog_click(pointer);
|
2003-08-27 02:37:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle clicks in the main Choices dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_click_config(wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
switch (pointer->i) {
|
|
|
|
case ICON_CONFIG_SAVE:
|
2004-02-13 19:09:12 +03:00
|
|
|
get_browser_choices();
|
|
|
|
get_proxy_choices();
|
|
|
|
get_theme_choices();
|
2004-06-27 18:41:14 +04:00
|
|
|
ro_gui_save_options();
|
2003-08-27 02:37:32 +04:00
|
|
|
if (pointer->buttons == wimp_CLICK_SELECT) {
|
|
|
|
ro_gui_dialog_close(dialog_config_br);
|
|
|
|
ro_gui_dialog_close(dialog_config_prox);
|
|
|
|
ro_gui_dialog_close(dialog_config_th);
|
|
|
|
ro_gui_dialog_close(dialog_config);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ICON_CONFIG_CANCEL:
|
|
|
|
if (pointer->buttons == wimp_CLICK_SELECT) {
|
|
|
|
ro_gui_dialog_close(dialog_config_br);
|
|
|
|
ro_gui_dialog_close(dialog_config_prox);
|
|
|
|
ro_gui_dialog_close(dialog_config_th);
|
|
|
|
ro_gui_dialog_close(dialog_config);
|
|
|
|
}
|
2004-02-13 19:09:12 +03:00
|
|
|
set_browser_choices();
|
|
|
|
set_proxy_choices();
|
|
|
|
set_theme_choices();
|
2003-08-27 02:37:32 +04:00
|
|
|
break;
|
|
|
|
case ICON_CONFIG_BROWSER:
|
2003-08-28 00:09:57 +04:00
|
|
|
ro_gui_dialog_open(dialog_config_br);
|
2003-08-27 02:37:32 +04:00
|
|
|
break;
|
|
|
|
case ICON_CONFIG_PROXY:
|
2003-08-28 00:09:57 +04:00
|
|
|
ro_gui_dialog_open(dialog_config_prox);
|
2003-08-27 02:37:32 +04:00
|
|
|
break;
|
|
|
|
case ICON_CONFIG_THEME:
|
2004-05-23 03:04:44 +04:00
|
|
|
ro_gui_dialog_open_config_th();
|
2003-08-27 02:37:32 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-27 18:41:14 +04:00
|
|
|
/**
|
|
|
|
* Save the current options
|
|
|
|
*/
|
|
|
|
void ro_gui_save_options(void) {
|
|
|
|
xosfile_create_dir("<Choices$Write>.WWW", 0);
|
|
|
|
xosfile_create_dir("<Choices$Write>.WWW.NetSurf", 0);
|
|
|
|
options_write("<Choices$Write>.WWW.NetSurf.Choices");
|
|
|
|
}
|
2003-08-27 02:37:32 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle clicks in the Browser Choices dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_click_config_br(wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
switch (pointer->i) {
|
|
|
|
case ICON_CONFIG_BR_OK:
|
|
|
|
if (pointer->buttons == wimp_CLICK_SELECT)
|
|
|
|
ro_gui_dialog_close(dialog_config_br);
|
|
|
|
break;
|
|
|
|
case ICON_CONFIG_BR_CANCEL:
|
|
|
|
if (pointer->buttons == wimp_CLICK_SELECT)
|
|
|
|
ro_gui_dialog_close(dialog_config_br);
|
2004-02-13 19:09:12 +03:00
|
|
|
set_browser_choices();
|
2003-08-27 02:37:32 +04:00
|
|
|
break;
|
2004-02-14 02:07:42 +03:00
|
|
|
case ICON_CONFIG_BR_FONTSIZE_DEC:
|
|
|
|
if (font_size == 50)
|
|
|
|
break;
|
|
|
|
font_size--;
|
|
|
|
if (font_size < font_min_size)
|
|
|
|
font_min_size = font_size;
|
|
|
|
ro_gui_dialog_update_config_br();
|
|
|
|
break;
|
|
|
|
case ICON_CONFIG_BR_FONTSIZE_INC:
|
|
|
|
if (font_size == 1000)
|
|
|
|
break;
|
|
|
|
font_size++;
|
|
|
|
ro_gui_dialog_update_config_br();
|
|
|
|
break;
|
|
|
|
case ICON_CONFIG_BR_MINSIZE_DEC:
|
|
|
|
if (font_min_size == 10)
|
|
|
|
break;
|
|
|
|
font_min_size--;
|
|
|
|
ro_gui_dialog_update_config_br();
|
|
|
|
break;
|
|
|
|
case ICON_CONFIG_BR_MINSIZE_INC:
|
|
|
|
if (font_min_size == 500)
|
|
|
|
break;
|
|
|
|
font_min_size++;
|
|
|
|
if (font_size < font_min_size)
|
|
|
|
font_size = font_min_size;
|
|
|
|
ro_gui_dialog_update_config_br();
|
|
|
|
break;
|
2003-08-27 02:37:32 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-14 02:07:42 +03:00
|
|
|
/**
|
|
|
|
* Update font size icons in browser choices dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_update_config_br(void)
|
|
|
|
{
|
|
|
|
char s[10];
|
|
|
|
sprintf(s, "%i.%ipt", font_size / 10, font_size % 10);
|
2004-02-26 03:44:42 +03:00
|
|
|
ro_gui_set_icon_string(dialog_config_br, ICON_CONFIG_BR_FONTSIZE, s);
|
2004-02-14 02:07:42 +03:00
|
|
|
sprintf(s, "%i.%ipt", font_min_size / 10, font_min_size % 10);
|
2004-02-26 03:44:42 +03:00
|
|
|
ro_gui_set_icon_string(dialog_config_br, ICON_CONFIG_BR_MINSIZE, s);
|
2004-02-14 02:07:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-27 02:37:32 +04:00
|
|
|
/**
|
|
|
|
* Handle clicks in the Proxy Choices dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_click_config_prox(wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
switch (pointer->i) {
|
|
|
|
case ICON_CONFIG_PROX_OK:
|
|
|
|
if (pointer->buttons == wimp_CLICK_SELECT)
|
|
|
|
ro_gui_dialog_close(dialog_config_prox);
|
|
|
|
break;
|
|
|
|
case ICON_CONFIG_PROX_CANCEL:
|
|
|
|
if (pointer->buttons == wimp_CLICK_SELECT)
|
|
|
|
ro_gui_dialog_close(dialog_config_prox);
|
2004-02-13 19:09:12 +03:00
|
|
|
set_proxy_choices();
|
2003-08-27 02:37:32 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-23 03:04:44 +04:00
|
|
|
/**
|
|
|
|
* Prepare and open the Theme Choices dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_open_config_th(void)
|
|
|
|
{
|
2004-05-25 00:47:32 +04:00
|
|
|
wimp_window_state state;
|
2004-05-23 03:04:44 +04:00
|
|
|
if (theme_list)
|
|
|
|
ro_theme_list_free(theme_list, theme_list_entries);
|
|
|
|
|
|
|
|
theme_list = ro_theme_list(&theme_list_entries);
|
|
|
|
if (!theme_list)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ro_gui_dialog_open(dialog_config_th);
|
2004-05-25 00:47:32 +04:00
|
|
|
// ro_gui_dialog_open(dialog_config_th_pane);
|
|
|
|
|
|
|
|
state.w = dialog_config_th;
|
|
|
|
xwimp_get_window_state(&state);
|
|
|
|
state.w = dialog_config_th_pane;
|
|
|
|
state.visible.x0 += 24;
|
|
|
|
state.visible.y1 -= 12;
|
|
|
|
state.xscroll = 0;
|
|
|
|
state.yscroll = 0;
|
|
|
|
state.next = wimp_TOP;
|
|
|
|
if (xwimp_open_window_nested((wimp_open *)&state, dialog_config_th,
|
|
|
|
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
|
|
|
|
<< wimp_CHILD_XORIGIN_SHIFT |
|
|
|
|
wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
|
|
|
|
<< wimp_CHILD_YORIGIN_SHIFT |
|
|
|
|
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
|
|
|
|
<< wimp_CHILD_LS_EDGE_SHIFT |
|
|
|
|
wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
|
|
|
|
<< wimp_CHILD_BS_EDGE_SHIFT |
|
|
|
|
wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
|
|
|
|
<< wimp_CHILD_RS_EDGE_SHIFT |
|
|
|
|
wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT << wimp_CHILD_TS_EDGE_SHIFT)) {
|
|
|
|
LOG(("Unable to open theme pane window"));
|
|
|
|
}
|
2004-05-23 03:04:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-27 02:37:32 +04:00
|
|
|
/**
|
|
|
|
* Handle clicks in the Theme Choices dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_click_config_th(wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
switch (pointer->i) {
|
|
|
|
case ICON_CONFIG_TH_OK:
|
|
|
|
if (pointer->buttons == wimp_CLICK_SELECT)
|
|
|
|
ro_gui_dialog_close(dialog_config_th);
|
|
|
|
break;
|
|
|
|
case ICON_CONFIG_TH_CANCEL:
|
|
|
|
if (pointer->buttons == wimp_CLICK_SELECT)
|
|
|
|
ro_gui_dialog_close(dialog_config_th);
|
2004-02-13 19:09:12 +03:00
|
|
|
set_theme_choices();
|
2003-08-27 02:37:32 +04:00
|
|
|
break;
|
|
|
|
case ICON_CONFIG_TH_MANAGE:
|
|
|
|
os_cli("Filer_OpenDir " THEMES_DIR);
|
|
|
|
break;
|
|
|
|
case ICON_CONFIG_TH_GET:
|
2004-06-21 19:27:56 +04:00
|
|
|
browser_window_create(
|
|
|
|
"http://netsurf.sourceforge.net/themes/",
|
|
|
|
NULL);
|
2003-08-27 02:37:32 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-23 03:04:44 +04:00
|
|
|
#define THEME_HEIGHT 80
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle clicks in the scrolling Theme Choices list pane.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_click_config_th_pane(wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
unsigned int i, y;
|
|
|
|
wimp_window_state state;
|
|
|
|
os_error *error;
|
|
|
|
|
|
|
|
state.w = dialog_config_th_pane;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
y = -(pointer->pos.y - (state.visible.y1 - state.yscroll)) /
|
|
|
|
THEME_HEIGHT;
|
|
|
|
|
|
|
|
if (!theme_list || theme_list_entries <= y)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (theme_choice && strcmp(theme_choice, theme_list[y].name) == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (theme_choice) {
|
|
|
|
for (i = 0; i != theme_list_entries &&
|
|
|
|
strcmp(theme_choice, theme_list[i].name); i++)
|
|
|
|
;
|
|
|
|
if (i != theme_list_entries) {
|
|
|
|
error = xwimp_force_redraw(dialog_config_th_pane,
|
|
|
|
0, -i * THEME_HEIGHT - THEME_HEIGHT - 2,
|
|
|
|
600, -i * THEME_HEIGHT + 2);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_force_redraw: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
free(theme_choice);
|
|
|
|
theme_choice = strdup(theme_list[y].name);
|
|
|
|
|
|
|
|
error = xwimp_force_redraw(dialog_config_th_pane,
|
|
|
|
0, -y * THEME_HEIGHT - THEME_HEIGHT - 2,
|
|
|
|
600, -y * THEME_HEIGHT + 2);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_force_redraw: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Redraw the scrolling Theme Choices list pane.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_redraw_config_th_pane(wimp_draw *redraw)
|
|
|
|
{
|
|
|
|
osbool more;
|
|
|
|
os_error *error;
|
|
|
|
|
|
|
|
error = xwimp_redraw_window(redraw, &more);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_redraw_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
while (more) {
|
|
|
|
ro_gui_redraw_config_th_pane_plot(redraw);
|
|
|
|
error = xwimp_get_rectangle(redraw, &more);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_rectangle: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Redraw the scrolling Theme Choices list pane.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_redraw_config_th_pane_plot(wimp_draw *redraw)
|
|
|
|
{
|
|
|
|
unsigned int i, j;
|
|
|
|
int x0 = redraw->box.x0 - redraw->xscroll;
|
|
|
|
int y0 = redraw->box.y1 - redraw->yscroll;
|
|
|
|
int x;
|
|
|
|
static char sprite[][10] = { "back", "forward", "stop", "reload",
|
|
|
|
"history", "scale", "save" };
|
|
|
|
wimp_icon icon;
|
|
|
|
os_error *error = 0;
|
|
|
|
|
|
|
|
icon.flags = wimp_ICON_SPRITE | wimp_ICON_HCENTRED |
|
|
|
|
wimp_ICON_VCENTRED | wimp_ICON_INDIRECTED;
|
|
|
|
|
|
|
|
for (i = 0; i != theme_list_entries; i++) {
|
|
|
|
error = xwimptextop_set_colour(os_COLOUR_BLACK,
|
|
|
|
os_COLOUR_VERY_LIGHT_GREY);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* plot background for selected theme */
|
|
|
|
if (theme_choice &&
|
|
|
|
strcmp(theme_list[i].name, theme_choice) == 0) {
|
|
|
|
error = xcolourtrans_set_gcol(os_COLOUR_LIGHT_GREY,
|
|
|
|
0, os_ACTION_OVERWRITE, 0, 0);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
error = xos_plot(os_MOVE_TO, x0, y0 - i * THEME_HEIGHT);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
error = xos_plot(os_PLOT_RECTANGLE | os_PLOT_BY,
|
|
|
|
600, -THEME_HEIGHT);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
error = xwimptextop_set_colour(os_COLOUR_BLACK,
|
|
|
|
os_COLOUR_LIGHT_GREY);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* icons */
|
|
|
|
icon.extent.y0 = -i * THEME_HEIGHT - THEME_HEIGHT;
|
|
|
|
icon.extent.y1 = -i * THEME_HEIGHT;
|
|
|
|
icon.data.indirected_sprite.area = theme_list[i].sprite_area;
|
|
|
|
icon.data.indirected_sprite.size = 12;
|
|
|
|
for (j = 0, x = 0; j != sizeof sprite / sizeof sprite[0]; j++) {
|
|
|
|
icon.extent.x0 = x;
|
|
|
|
icon.extent.x1 = x + 50;
|
|
|
|
icon.data.indirected_sprite.id =
|
|
|
|
(osspriteop_id) sprite[j];
|
|
|
|
error = xwimp_plot_icon(&icon);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
x += 50;
|
|
|
|
}
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* theme name */
|
|
|
|
error = xwimptextop_paint(0, theme_list[i].name,
|
|
|
|
x0 + 400,
|
|
|
|
y0 - i * THEME_HEIGHT - THEME_HEIGHT / 2);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
LOG(("0x%x: %s", error->errnum, error->errmess));
|
|
|
|
warn_user("MiscError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/**
|
|
|
|
* Handle clicks in the Scale view dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_click_zoom(wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
unsigned int scale;
|
2004-04-17 20:45:46 +04:00
|
|
|
int stepping = 10;
|
2004-02-26 03:44:42 +03:00
|
|
|
scale = atoi(ro_gui_get_icon_string(dialog_zoom, ICON_ZOOM_VALUE));
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2004-04-17 20:45:46 +04:00
|
|
|
/* Adjust moves values the opposite direction
|
|
|
|
*/
|
2004-06-12 21:43:37 +04:00
|
|
|
if (pointer->buttons == wimp_CLICK_ADJUST)
|
|
|
|
stepping = -stepping;
|
2004-04-17 20:45:46 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
switch (pointer->i) {
|
2004-04-17 20:45:46 +04:00
|
|
|
case ICON_ZOOM_DEC: scale -= stepping; break;
|
|
|
|
case ICON_ZOOM_INC: scale += stepping; break;
|
2004-02-25 18:12:58 +03:00
|
|
|
case ICON_ZOOM_50: scale = 50; break;
|
|
|
|
case ICON_ZOOM_80: scale = 80; break;
|
|
|
|
case ICON_ZOOM_100: scale = 100; break;
|
|
|
|
case ICON_ZOOM_120: scale = 120; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (scale < 10)
|
|
|
|
scale = 10;
|
2004-06-12 21:43:37 +04:00
|
|
|
else if (1000 < scale)
|
|
|
|
scale = 1000;
|
2004-05-05 02:23:44 +04:00
|
|
|
ro_gui_set_icon_integer(dialog_zoom, ICON_ZOOM_VALUE, scale);
|
2004-02-25 18:12:58 +03:00
|
|
|
|
|
|
|
if (pointer->i == ICON_ZOOM_OK) {
|
|
|
|
current_gui->scale = scale * 0.01;
|
|
|
|
current_gui->data.browser.reformat_pending = true;
|
|
|
|
gui_reformat_pending = true;
|
|
|
|
}
|
|
|
|
|
2004-04-17 20:45:46 +04:00
|
|
|
if ((pointer->buttons == wimp_CLICK_ADJUST) && (pointer->i == ICON_ZOOM_CANCEL)) {
|
|
|
|
ro_gui_dialog_reset_zoom();
|
|
|
|
}
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
if (pointer->buttons == wimp_CLICK_SELECT &&
|
|
|
|
(pointer->i == ICON_ZOOM_CANCEL ||
|
|
|
|
pointer->i == ICON_ZOOM_OK))
|
|
|
|
wimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-23 03:04:44 +04:00
|
|
|
/**
|
|
|
|
* Resets the Scale view dialog.
|
2004-04-17 20:45:46 +04:00
|
|
|
*/
|
2004-05-23 03:04:44 +04:00
|
|
|
|
2004-04-17 20:45:46 +04:00
|
|
|
void ro_gui_dialog_reset_zoom(void) {
|
2004-05-23 03:04:44 +04:00
|
|
|
char scale_buffer[8];
|
2004-04-17 20:45:46 +04:00
|
|
|
sprintf(scale_buffer, "%.0f", current_gui->scale * 100);
|
|
|
|
ro_gui_set_icon_string(dialog_zoom, ICON_ZOOM_VALUE, scale_buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-07 23:14:54 +04:00
|
|
|
/**
|
|
|
|
* Handle clicks in the warning dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_click_warning(wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
if (pointer->i == ICON_WARNING_CONTINUE)
|
|
|
|
ro_gui_dialog_close(dialog_warning);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-27 02:37:32 +04:00
|
|
|
/**
|
|
|
|
* Close a dialog box.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void ro_gui_dialog_close(wimp_w close)
|
|
|
|
{
|
2004-07-12 23:55:49 +04:00
|
|
|
int i;
|
|
|
|
wimp_caret caret;
|
|
|
|
os_error *error = NULL;
|
|
|
|
|
|
|
|
/* Give the caret back to the parent window. This code relies on the fact that
|
|
|
|
only hotlist windows and browser windows open persistant dialogues, as the caret
|
|
|
|
gets placed to no icon.
|
|
|
|
*/
|
|
|
|
if (!xwimp_get_caret_position(&caret)) {
|
|
|
|
if (caret.w == close) {
|
|
|
|
|
|
|
|
/* Check if we are a persistant window
|
|
|
|
*/
|
|
|
|
for (i = 0; i < MAX_PERSISTANT; i++) {
|
|
|
|
if (persistant_dialog[i][0] == close) {
|
|
|
|
persistant_dialog[i][0] = NULL;
|
|
|
|
error = xwimp_set_caret_position(persistant_dialog[i][1],
|
|
|
|
wimp_ICON_WINDOW, -100, -100, 32, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_set_caret_position: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
2004-05-23 03:04:44 +04:00
|
|
|
|
|
|
|
error = xwimp_close_window(close);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_close_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (close == dialog_config_th) {
|
|
|
|
error = xwimp_close_window(dialog_config_th_pane);
|
|
|
|
|
|
|
|
if (theme_list) {
|
|
|
|
ro_theme_list_free(theme_list, theme_list_entries);
|
|
|
|
theme_list = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_close_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2004-07-12 23:55:49 +04:00
|
|
|
|
2003-08-28 00:09:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-13 19:09:12 +03:00
|
|
|
/**
|
|
|
|
* Update the browser choices dialog with the current options.
|
|
|
|
*/
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
void set_browser_choices(void) {
|
2004-02-14 02:07:42 +03:00
|
|
|
font_size = option_font_size;
|
|
|
|
font_min_size = option_font_min_size;
|
|
|
|
ro_gui_dialog_update_config_br();
|
2004-03-08 03:03:58 +03:00
|
|
|
ro_gui_set_icon_string(dialog_config_br, ICON_CONFIG_BR_LANG,
|
|
|
|
language_name(option_language ?
|
|
|
|
option_language : "en"));
|
|
|
|
ro_gui_set_icon_string(dialog_config_br, ICON_CONFIG_BR_ALANG,
|
|
|
|
language_name(option_accept_language ?
|
|
|
|
option_accept_language : "en"));
|
2004-02-13 19:09:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the current options to the settings in the browser choices dialog.
|
|
|
|
*/
|
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
void get_browser_choices(void) {
|
2004-02-14 02:07:42 +03:00
|
|
|
option_font_size = font_size;
|
|
|
|
option_font_min_size = font_min_size;
|
2004-02-13 19:09:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the proxy choices dialog with the current options.
|
|
|
|
*/
|
2003-08-28 00:09:57 +04:00
|
|
|
|
2004-02-13 19:09:12 +03:00
|
|
|
void set_proxy_choices(void)
|
2003-08-28 00:09:57 +04:00
|
|
|
{
|
2004-05-05 02:23:44 +04:00
|
|
|
ro_gui_set_icon_selected_state(dialog_config_prox, ICON_CONFIG_PROX_HTTP,
|
2004-02-13 19:09:12 +03:00
|
|
|
option_http_proxy);
|
2004-02-26 03:44:42 +03:00
|
|
|
ro_gui_set_icon_string(dialog_config_prox, ICON_CONFIG_PROX_HTTPHOST,
|
2004-02-14 02:18:29 +03:00
|
|
|
option_http_proxy_host ? option_http_proxy_host : "");
|
2004-05-05 02:23:44 +04:00
|
|
|
ro_gui_set_icon_integer(dialog_config_prox, ICON_CONFIG_PROX_HTTPPORT,
|
2004-02-13 19:09:12 +03:00
|
|
|
option_http_proxy_port);
|
2003-08-28 00:09:57 +04:00
|
|
|
}
|
|
|
|
|
2004-02-13 19:09:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the current options to the settings in the proxy choices dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void get_proxy_choices(void)
|
2003-08-28 00:09:57 +04:00
|
|
|
{
|
2004-05-05 02:23:44 +04:00
|
|
|
option_http_proxy = ro_gui_get_icon_selected_state(dialog_config_prox,
|
2004-02-13 19:09:12 +03:00
|
|
|
ICON_CONFIG_PROX_HTTP);
|
|
|
|
free(option_http_proxy_host);
|
2004-02-26 03:44:42 +03:00
|
|
|
option_http_proxy_host = strdup(ro_gui_get_icon_string(dialog_config_prox,
|
2004-02-13 19:09:12 +03:00
|
|
|
ICON_CONFIG_PROX_HTTPHOST));
|
2004-02-26 03:44:42 +03:00
|
|
|
option_http_proxy_port = atoi(ro_gui_get_icon_string(dialog_config_prox,
|
2004-02-13 19:09:12 +03:00
|
|
|
ICON_CONFIG_PROX_HTTPPORT));
|
2003-08-28 00:09:57 +04:00
|
|
|
}
|
|
|
|
|
2004-02-13 19:09:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the theme choices dialog with the current options.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void set_theme_choices(void)
|
2003-08-28 00:09:57 +04:00
|
|
|
{
|
2004-05-23 03:04:44 +04:00
|
|
|
free(theme_choice);
|
|
|
|
theme_choice = 0;
|
|
|
|
if (option_theme)
|
|
|
|
theme_choice = strdup(option_theme);
|
2003-08-28 00:09:57 +04:00
|
|
|
}
|
|
|
|
|
2004-02-13 19:09:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the current options to the settings in the theme choices dialog.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void get_theme_choices(void)
|
2003-08-28 00:09:57 +04:00
|
|
|
{
|
2004-02-13 19:09:12 +03:00
|
|
|
free(option_theme);
|
2004-05-23 03:04:44 +04:00
|
|
|
option_theme = strdup(theme_choice);
|
2003-08-28 00:09:57 +04:00
|
|
|
}
|
|
|
|
|
2004-02-13 19:09:12 +03:00
|
|
|
|
2004-03-08 03:03:58 +03:00
|
|
|
/**
|
|
|
|
* Convert a 2-letter ISO language code to the language name.
|
|
|
|
*
|
|
|
|
* \param code 2-letter ISO language code
|
|
|
|
* \return language name, or code if unknown
|
|
|
|
*/
|
|
|
|
|
|
|
|
const char *language_name(const char *code)
|
|
|
|
{
|
|
|
|
char key[] = "lang_xx";
|
|
|
|
key[5] = code[0];
|
|
|
|
key[6] = code[1];
|
|
|
|
return messages_get(key);
|
|
|
|
}
|