NetSurf
con_inter.c
Go to the documentation of this file.
1/*
2 * Copyright 2006 Adrian Lees <adrianl@users.sourceforge.net>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <stdbool.h>
20
21#include "utils/nsoption.h"
22
23#include "riscos/gui.h"
24#include "riscos/wimp.h"
25#include "riscos/wimp_event.h"
26#include "riscos/configure.h"
28#include "riscos/dialog.h"
29
30#define INTERFACE_STRIP_EXTNS_OPTION 2
31#define INTERFACE_CONFIRM_OVWR_OPTION 3
32#define INTERFACE_URL_COMPLETE_OPTION 6
33#define INTERFACE_HISTORY_TOOLTIP_OPTION 7
34#define INTERFACE_THUMBNAIL_ICONISE_OPTION 10
35#define INTERFACE_DEFAULT_BUTTON 11
36#define INTERFACE_CANCEL_BUTTON 12
37#define INTERFACE_OK_BUTTON 13
38#define INTERFACE_USE_EXTERNAL_HOTLIST 16
39#define INTERFACE_EXTERNAL_HOTLIST_APP 18
40
41
42static bool ro_gui_options_interface_click(wimp_pointer *pointer);
43static void ro_gui_options_interface_default(wimp_pointer *pointer);
44static bool ro_gui_options_interface_ok(wimp_w w);
45
47{
48 /* set the current values */
50 nsoption_bool(strip_extensions));
52 nsoption_bool(confirm_overwrite));
54 nsoption_bool(url_suggestion));
56 nsoption_bool(history_tooltip));
58 nsoption_bool(thumbnail_iconise));
60 nsoption_bool(external_hotlists));
62 (nsoption_charp(external_hotlist_app)) ?
63 nsoption_charp(external_hotlist_app) : "", false);
64
66 !nsoption_bool(external_hotlists));
67
68 /* initialise all functions for a newly created window */
76 ro_gui_wimp_event_set_help_prefix(w, "HelpInterfaceConfig");
78 return true;
79
80}
81
82
83bool ro_gui_options_interface_click(wimp_pointer *pointer)
84{
85 bool shaded;
86
87 switch (pointer->i) {
89 shaded = !ro_gui_get_icon_selected_state(pointer->w,
93 return false;
94 break;
95 }
96 return false;
97}
98
99
100
101void ro_gui_options_interface_default(wimp_pointer *pointer)
102{
116 "", false);
117}
118
120{
121 nsoption_set_bool(strip_extensions,
124 nsoption_set_bool(confirm_overwrite,
127 nsoption_set_bool(url_suggestion,
130 nsoption_set_bool(history_tooltip,
133 nsoption_set_bool(thumbnail_iconise,
136 nsoption_set_bool(external_hotlists,
139 nsoption_set_charp(external_hotlist_app,
140 strdup(ro_gui_get_icon_string(w,
142
144 return true;
145}
#define INTERFACE_DEFAULT_BUTTON
Definition: con_inter.c:35
#define INTERFACE_CONFIRM_OVWR_OPTION
Definition: con_inter.c:31
#define INTERFACE_THUMBNAIL_ICONISE_OPTION
Definition: con_inter.c:34
#define INTERFACE_STRIP_EXTNS_OPTION
Definition: con_inter.c:30
static bool ro_gui_options_interface_ok(wimp_w w)
Definition: con_inter.c:119
bool ro_gui_options_interface_initialise(wimp_w w)
Definition: con_inter.c:46
#define INTERFACE_EXTERNAL_HOTLIST_APP
Definition: con_inter.c:39
#define INTERFACE_OK_BUTTON
Definition: con_inter.c:37
#define INTERFACE_URL_COMPLETE_OPTION
Definition: con_inter.c:32
#define INTERFACE_USE_EXTERNAL_HOTLIST
Definition: con_inter.c:38
#define INTERFACE_HISTORY_TOOLTIP_OPTION
Definition: con_inter.c:33
static bool ro_gui_options_interface_click(wimp_pointer *pointer)
Definition: con_inter.c:83
#define INTERFACE_CANCEL_BUTTON
Definition: con_inter.c:36
static void ro_gui_options_interface_default(wimp_pointer *pointer)
Definition: con_inter.c:101
Automated RISC OS WIMP event handling (interface).
RISC OS option setting (interface).
void ro_gui_save_options(void)
Save the current options.
Definition: dialog.c:670
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
Definition: nsoption.h:331
#define nsoption_set_bool(OPTION, VALUE)
set a boolean option in the default table
Definition: nsoption.h:344
#define nsoption_set_charp(OPTION, VALUE)
set string option in default table
Definition: nsoption.h:372
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Definition: nsoption.h:304
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.
Definition: wimp.c:269
void ro_gui_set_icon_shaded_state(wimp_w w, wimp_i i, bool state)
Set the shaded state of an icon.
Definition: wimp.c:487
const char * ro_gui_get_icon_string(wimp_w w, wimp_i i)
Read the contents of a text or sprite icon.
Definition: wimp.c:235
void ro_gui_set_icon_selected_state(wimp_w w, wimp_i i, bool state)
Set the selected state of an icon.
Definition: wimp.c:444
bool ro_gui_get_icon_selected_state(wimp_w w, wimp_i i)
Gets the selected state of an icon.
Definition: wimp.c:463
General RISC OS WIMP/OS library functions (interface).
bool ro_gui_wimp_event_set_help_prefix(wimp_w w, const char *help_prefix)
Set the associated help prefix for a given window.
Definition: wimp_event.c:390
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.
Definition: wimp_event.c:1403
bool ro_gui_wimp_event_memorise(wimp_w w)
Memorises the current state of any registered components in a window.
Definition: wimp_event.c:139
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...
Definition: wimp_event.c:1439
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.
Definition: wimp_event.c:1417
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.
Definition: wimp_event.c:1387
Automated RISC OS WIMP event handling (interface).