2006-02-07 19:16:23 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2006 Adrian Lees <adrianl@users.sourceforge.net>
|
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/>.
|
2006-02-07 19:16:23 +03:00
|
|
|
*/
|
|
|
|
|
2008-07-27 02:29:15 +04:00
|
|
|
#include <stdbool.h>
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/dialog.h"
|
|
|
|
#include "riscos/gui.h"
|
2013-05-26 01:46:27 +04:00
|
|
|
#include "utils/nsoption.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/wimp.h"
|
|
|
|
#include "riscos/wimp_event.h"
|
|
|
|
#include "riscos/configure.h"
|
|
|
|
#include "riscos/configure/configure.h"
|
2006-02-07 19:16:23 +03:00
|
|
|
|
|
|
|
|
2006-04-06 21:06:18 +04:00
|
|
|
#define INTERFACE_STRIP_EXTNS_OPTION 2
|
|
|
|
#define INTERFACE_CONFIRM_OVWR_OPTION 3
|
|
|
|
#define INTERFACE_URL_COMPLETE_OPTION 6
|
|
|
|
#define INTERFACE_HISTORY_TOOLTIP_OPTION 7
|
2006-07-03 05:03:07 +04:00
|
|
|
#define INTERFACE_THUMBNAIL_ICONISE_OPTION 10
|
|
|
|
#define INTERFACE_DEFAULT_BUTTON 11
|
|
|
|
#define INTERFACE_CANCEL_BUTTON 12
|
|
|
|
#define INTERFACE_OK_BUTTON 13
|
2011-10-14 02:06:07 +04:00
|
|
|
#define INTERFACE_USE_EXTERNAL_HOTLIST 16
|
2011-11-20 03:33:37 +04:00
|
|
|
#define INTERFACE_EXTERNAL_HOTLIST_APP 18
|
2006-02-07 19:16:23 +03:00
|
|
|
|
|
|
|
|
2011-11-20 03:33:37 +04:00
|
|
|
static bool ro_gui_options_interface_click(wimp_pointer *pointer);
|
2006-02-07 19:16:23 +03:00
|
|
|
static void ro_gui_options_interface_default(wimp_pointer *pointer);
|
|
|
|
static bool ro_gui_options_interface_ok(wimp_w w);
|
|
|
|
|
2008-07-27 02:29:15 +04:00
|
|
|
bool ro_gui_options_interface_initialise(wimp_w w)
|
|
|
|
{
|
2006-02-07 19:16:23 +03:00
|
|
|
/* set the current values */
|
|
|
|
ro_gui_set_icon_selected_state(w, INTERFACE_STRIP_EXTNS_OPTION,
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_bool(strip_extensions));
|
2006-02-07 19:16:23 +03:00
|
|
|
ro_gui_set_icon_selected_state(w, INTERFACE_CONFIRM_OVWR_OPTION,
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_bool(confirm_overwrite));
|
2006-04-06 21:06:18 +04:00
|
|
|
ro_gui_set_icon_selected_state(w, INTERFACE_URL_COMPLETE_OPTION,
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_bool(url_suggestion));
|
2006-04-06 21:06:18 +04:00
|
|
|
ro_gui_set_icon_selected_state(w, INTERFACE_HISTORY_TOOLTIP_OPTION,
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_bool(history_tooltip));
|
2006-07-03 05:03:07 +04:00
|
|
|
ro_gui_set_icon_selected_state(w, INTERFACE_THUMBNAIL_ICONISE_OPTION,
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_bool(thumbnail_iconise));
|
2011-10-14 02:06:07 +04:00
|
|
|
ro_gui_set_icon_selected_state(w, INTERFACE_USE_EXTERNAL_HOTLIST,
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_bool(external_hotlists));
|
2011-11-20 03:33:37 +04:00
|
|
|
ro_gui_set_icon_string(w, INTERFACE_EXTERNAL_HOTLIST_APP,
|
2012-03-22 13:34:34 +04:00
|
|
|
(nsoption_charp(external_hotlist_app)) ?
|
|
|
|
nsoption_charp(external_hotlist_app) : "", false);
|
2011-11-20 03:33:37 +04:00
|
|
|
|
|
|
|
ro_gui_set_icon_shaded_state(w, INTERFACE_EXTERNAL_HOTLIST_APP,
|
2012-03-22 13:34:34 +04:00
|
|
|
!nsoption_bool(external_hotlists));
|
2006-02-07 19:16:23 +03:00
|
|
|
|
|
|
|
/* initialise all functions for a newly created window */
|
2011-11-20 03:33:37 +04:00
|
|
|
ro_gui_wimp_event_register_mouse_click(w,
|
|
|
|
ro_gui_options_interface_click);
|
2006-02-07 19:16:23 +03:00
|
|
|
ro_gui_wimp_event_register_button(w, INTERFACE_DEFAULT_BUTTON,
|
|
|
|
ro_gui_options_interface_default);
|
|
|
|
ro_gui_wimp_event_register_cancel(w, INTERFACE_CANCEL_BUTTON);
|
|
|
|
ro_gui_wimp_event_register_ok(w, INTERFACE_OK_BUTTON,
|
|
|
|
ro_gui_options_interface_ok);
|
|
|
|
ro_gui_wimp_event_set_help_prefix(w, "HelpInterfaceConfig");
|
|
|
|
ro_gui_wimp_event_memorise(w);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-11-20 03:33:37 +04:00
|
|
|
|
|
|
|
bool ro_gui_options_interface_click(wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
bool shaded;
|
|
|
|
|
|
|
|
switch (pointer->i) {
|
|
|
|
case INTERFACE_USE_EXTERNAL_HOTLIST:
|
|
|
|
shaded = !ro_gui_get_icon_selected_state(pointer->w,
|
|
|
|
INTERFACE_USE_EXTERNAL_HOTLIST);
|
|
|
|
ro_gui_set_icon_shaded_state(pointer->w,
|
|
|
|
INTERFACE_EXTERNAL_HOTLIST_APP, shaded);
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_options_interface_default(wimp_pointer *pointer)
|
|
|
|
{
|
2006-02-07 19:16:23 +03:00
|
|
|
ro_gui_set_icon_selected_state(pointer->w,
|
|
|
|
INTERFACE_STRIP_EXTNS_OPTION, true);
|
|
|
|
ro_gui_set_icon_selected_state(pointer->w,
|
|
|
|
INTERFACE_CONFIRM_OVWR_OPTION, true);
|
2006-04-06 21:06:18 +04:00
|
|
|
ro_gui_set_icon_selected_state(pointer->w,
|
|
|
|
INTERFACE_URL_COMPLETE_OPTION, true);
|
|
|
|
ro_gui_set_icon_selected_state(pointer->w,
|
|
|
|
INTERFACE_HISTORY_TOOLTIP_OPTION, true);
|
2006-07-03 05:03:07 +04:00
|
|
|
ro_gui_set_icon_selected_state(pointer->w,
|
|
|
|
INTERFACE_THUMBNAIL_ICONISE_OPTION, true);
|
2011-10-14 02:06:07 +04:00
|
|
|
ro_gui_set_icon_selected_state(pointer->w,
|
|
|
|
INTERFACE_USE_EXTERNAL_HOTLIST, false);
|
2011-11-20 03:33:37 +04:00
|
|
|
ro_gui_set_icon_string(pointer->w, INTERFACE_EXTERNAL_HOTLIST_APP,
|
|
|
|
"", false);
|
2006-02-07 19:16:23 +03:00
|
|
|
}
|
|
|
|
|
2008-07-27 02:29:15 +04:00
|
|
|
bool ro_gui_options_interface_ok(wimp_w w)
|
|
|
|
{
|
2012-03-22 13:34:34 +04:00
|
|
|
nsoption_set_bool(strip_extensions,
|
|
|
|
ro_gui_get_icon_selected_state(w,
|
|
|
|
INTERFACE_STRIP_EXTNS_OPTION));
|
|
|
|
nsoption_set_bool(confirm_overwrite,
|
|
|
|
ro_gui_get_icon_selected_state(w,
|
|
|
|
INTERFACE_CONFIRM_OVWR_OPTION));
|
|
|
|
nsoption_set_bool(url_suggestion,
|
|
|
|
ro_gui_get_icon_selected_state(w,
|
|
|
|
INTERFACE_URL_COMPLETE_OPTION));
|
|
|
|
nsoption_set_bool(history_tooltip,
|
|
|
|
ro_gui_get_icon_selected_state(w,
|
|
|
|
INTERFACE_HISTORY_TOOLTIP_OPTION));
|
|
|
|
nsoption_set_bool(thumbnail_iconise,
|
|
|
|
ro_gui_get_icon_selected_state(w,
|
|
|
|
INTERFACE_THUMBNAIL_ICONISE_OPTION));
|
|
|
|
nsoption_set_bool(external_hotlists,
|
|
|
|
ro_gui_get_icon_selected_state(w,
|
|
|
|
INTERFACE_USE_EXTERNAL_HOTLIST));
|
|
|
|
nsoption_set_charp(external_hotlist_app,
|
|
|
|
strdup(ro_gui_get_icon_string(w,
|
|
|
|
INTERFACE_EXTERNAL_HOTLIST_APP)));
|
2006-02-07 19:16:23 +03:00
|
|
|
|
|
|
|
ro_gui_save_options();
|
|
|
|
return true;
|
|
|
|
}
|