mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 12:36:51 +03:00
Merged revisions 4114-4265,4267-4272,4275-4285,4287-4325 via svnmerge from
svn://source.netsurf-browser.org/branches/mikeL/netsurf ........ r4116 | mikeL | 2008-05-01 22:15:12 +0100 (Thu, 01 May 2008) | 2 lines Redesigned right-click menu: added back, forward, and reload, previously default menu items are now hidden unless view->toolbars->menu bar is disabled ........ r4117 | mikeL | 2008-05-02 03:54:10 +0100 (Fri, 02 May 2008) | 2 lines Added a Current Page button to Preferences next to the url entry for setting the home page ........ r4118 | mikeL | 2008-05-02 04:27:37 +0100 (Fri, 02 May 2008) | 1 line Cleanup ........ r4119 | mikeL | 2008-05-02 21:09:44 +0100 (Fri, 02 May 2008) | 1 line Preferences window is now initialized the first time edit->preferences is clicked instead of during nsgtk initialization. Expedites start-up time because preferences is a non-essential dialog. ........ r4123 | mikeL | 2008-05-04 15:43:20 +0100 (Sun, 04 May 2008) | 1 line Converted Preferences window to a dialog. Fixed spacing and naming in Preferences dialog. Split Preferences section of the Glade file into its own gtk_options.glade file. Moved all Preferences related files to gtk/dialogs. ........ r4127 | mikeL | 2008-05-05 20:45:44 +0100 (Mon, 05 May 2008) | 1 line Fixed a glaring error in directory structure. All glade files are now stored in the res directory. ........ r4128 | mikeL | 2008-05-05 20:52:08 +0100 (Mon, 05 May 2008) | 1 line Added directory 'dialogs' to revision control ........ r4129 | mikeL | 2008-05-05 20:58:53 +0100 (Mon, 05 May 2008) | 1 line Cleaned up gtk folder by removing gtk_options.c and gtk_options.h (Moved to dialogs folder) ........ r4130 | mikeL | 2008-05-05 23:42:15 +0100 (Mon, 05 May 2008) | 1 line Huzzah\! Preferences dialog is now instant apply\! ........ r4131 | mikeL | 2008-05-06 20:43:26 +0100 (Tue, 06 May 2008) | 1 line nsgtk_reflow_all_windows() is now called whenever an option that requires redrawing of the current page is changed. Preferences dialog is now *completely* instant apply ........ r4132 | mikeL | 2008-05-06 20:55:05 +0100 (Tue, 06 May 2008) | 1 line Renamed macros to better reflect their purpose ........ r4133 | mikeL | 2008-05-06 21:30:44 +0100 (Tue, 06 May 2008) | 1 line Added gtk/res/options.glade to svn control ........ r4134 | mikeL | 2008-05-06 21:39:12 +0100 (Tue, 06 May 2008) | 1 line Preferences window is now resizable ........ r4135 | mikeL | 2008-05-06 21:42:00 +0100 (Tue, 06 May 2008) | 1 line Fixed reload menu item in popup menu ........ r4136 | mikeL | 2008-05-07 00:24:35 +0100 (Wed, 07 May 2008) | 1 line Proxy configurations are now insensitive if proxy type is set to no proxy. Changing the home page with the Current Page button is now saved. Moved Current Page button in Preferences window and added Default Page. ........ r4137 | mikeL | 2008-05-07 00:41:29 +0100 (Wed, 07 May 2008) | 1 line Solved a problem with all options being saved prematurely on initialization ........ r4145 | mikeL | 2008-05-11 18:07:06 +0100 (Sun, 11 May 2008) | 1 line Optimized prefences window signal handling, entry signals are now caught on focus-out-event and checked for changes ........ r4146 | mikeL | 2008-05-11 18:16:04 +0100 (Sun, 11 May 2008) | 1 line Fixed regression where 'Set Current Page' button stopped working ........ r4147 | mikeL | 2008-05-11 18:32:10 +0100 (Sun, 11 May 2008) | 1 line Added 'Default Page' button functionality ........ r4148 | mikeL | 2008-05-11 18:33:03 +0100 (Sun, 11 May 2008) | 1 line Updated TODO list ........ r4149 | mikeL | 2008-05-12 01:04:00 +0100 (Mon, 12 May 2008) | 1 line Added 'Hide Advertisement' functionality ........ r4150 | mikeL | 2008-05-12 01:30:40 +0100 (Mon, 12 May 2008) | 1 line Re-activated the option 'Disable Animation' and fixed bug where it would actually enable animation ........ r4151 | mikeL | 2008-05-12 01:42:43 +0100 (Mon, 12 May 2008) | 1 line Added 'Send site referral information' functionality ........ r4152 | mikeL | 2008-05-12 02:01:00 +0100 (Mon, 12 May 2008) | 1 line Added 'Disc cache age' functionality ........ r4154 | mikeL | 2008-05-13 20:35:29 +0100 (Tue, 13 May 2008) | 1 line Fixed regression where preferences were not written to file in some cases and preferences dialog could not be reopened. ........ r4158 | mikeL | 2008-05-14 21:57:50 +0100 (Wed, 14 May 2008) | 1 line Added 'preview' button to fonts tab of preferences dialog. nsgtk_reflow_all_windows is now called only when that button is clicked. ........ r4162 | mikeL | 2008-05-15 20:09:30 +0100 (Thu, 15 May 2008) | 1 line Possible fix to segfault due to invalid test ........ r4163 | mikeL | 2008-05-15 20:25:28 +0100 (Thu, 15 May 2008) | 1 line Fixed typo that caused preferences dialog to be unopenable ........ r4164 | mikeL | 2008-05-15 20:57:49 +0100 (Thu, 15 May 2008) | 1 line Added initialization statement for preferences_dialog to make sure that ........ r4169 | mikeL | 2008-05-17 00:30:54 +0100 (Sat, 17 May 2008) | 1 line Added a 'parent_window' initialization parameter to the preferences dialog so that it may center itself on parent. This also optimizes the closing code as destroy is now called on the dialog when the main window is closed ........ r4174 | mikeL | 2008-05-18 15:46:43 +0100 (Sun, 18 May 2008) | 1 line Animation speed option is now insensitive when 'Disable animations' is true ........ r4175 | mikeL | 2008-05-18 15:50:06 +0100 (Sun, 18 May 2008) | 1 line Added tooltip to preview button ........ r4176 | mikeL | 2008-05-18 16:04:05 +0100 (Sun, 18 May 2008) | 1 line Animation speed is now always sensitive ........ r4177 | mikeL | 2008-05-19 02:32:21 +0100 (Mon, 19 May 2008) | 1 line Redesigned about dialog as a GtkAboutDialog and removed the respective section from netsurf.glade (May need string revision) ........ r4178 | mikeL | 2008-05-19 02:36:15 +0100 (Mon, 19 May 2008) | 1 line Fixed compile warning relating to improper cast of netsurf_version ........ r4180 | mikeL | 2008-05-19 21:42:04 +0100 (Mon, 19 May 2008) | 1 line Updated credits ........ r4181 | mikeL | 2008-05-19 21:43:16 +0100 (Mon, 19 May 2008) | 1 line launch_url is no longer static ........ r4182 | mikeL | 2008-05-19 21:50:03 +0100 (Mon, 19 May 2008) | 1 line netsurf_version is now const in function which addresses jmb's concern ........ r4183 | mikeL | 2008-05-19 21:59:55 +0100 (Mon, 19 May 2008) | 1 line Updated header ........ r4184 | mikeL | 2008-05-19 22:03:28 +0100 (Mon, 19 May 2008) | 1 line local variables are now static ........ r4186 | mikeL | 2008-05-21 22:03:43 +0100 (Wed, 21 May 2008) | 1 line Removed 'Main Development Team' from the beginning of all credits ........ r4219 | mikeL | 2008-05-28 18:17:12 +0100 (Wed, 28 May 2008) | 1 line Removed wndOpenFile from glade file. ........ r4236 | mikeL | 2008-05-31 23:25:32 +0100 (Sat, 31 May 2008) | 1 line Fixed proxy options for both riscos and gtk versions thanks to a tip from Leon Stringer ........ r4275 | mikeL | 2008-06-06 17:16:29 +0100 (Fri, 06 Jun 2008) | 1 line Added support for dragging, clicks are now emited on button release ........ r4276 | mikeL | 2008-06-06 17:18:18 +0100 (Fri, 06 Jun 2008) | 1 line gtk_window.c now sets the current_redraw_browser. Text selection now highlights properly ........ r4277 | mikeL | 2008-06-06 17:47:35 +0100 (Fri, 06 Jun 2008) | 1 line Cleaned up the button detection code ........ r4278 | mikeL | 2008-06-06 17:58:51 +0100 (Fri, 06 Jun 2008) | 1 line Removed leftover variables ........ r4279 | mikeL | 2008-06-06 18:13:58 +0100 (Fri, 06 Jun 2008) | 1 line Enabled 'Select All' ........ r4280 | mikeL | 2008-06-06 18:31:56 +0100 (Fri, 06 Jun 2008) | 1 line Fixed bug where mouse state would always remain as PRESS even if dragging ........ r4281 | mikeL | 2008-06-06 18:45:16 +0100 (Fri, 06 Jun 2008) | 1 line Fixed regression where mouse state was cleared improperly ........ r4287 | mikeL | 2008-06-07 00:21:32 +0100 (Sat, 07 Jun 2008) | 1 line Mouse code can now handle modifiers. Fixed bug where end of drag was not detected until mouse moved after being released. Improved mouse handling. ........ r4294 | mikeL | 2008-06-07 03:21:03 +0100 (Sat, 07 Jun 2008) | 1 line Added ability to handle modifiers pressed during a drag event. Mouse movement handling now uses switch statements (Thanks tlsa) ........ r4295 | mikeL | 2008-06-07 03:40:11 +0100 (Sat, 07 Jun 2008) | 1 line Fixed bug where modifier keys were being detected incorrectly ........ r4296 | mikeL | 2008-06-07 03:42:31 +0100 (Sat, 07 Jun 2008) | 1 line Reversed accidental file modification ........ r4299 | mikeL | 2008-06-07 21:32:15 +0100 (Sat, 07 Jun 2008) | 1 line Fixed inclusion of gtk_about source file instead of header ........ r4300 | mikeL | 2008-06-07 22:27:39 +0100 (Sat, 07 Jun 2008) | 1 line Fixed problem with about.h not linking properly. ........ r4301 | mikeL | 2008-06-07 22:37:28 +0100 (Sat, 07 Jun 2008) | 1 line Moved definitions of gui_window and browser_mouse to gtk_window.h. Moved all selection related functions to gtk_selection.c. Implemented copy functionality. ........ r4302 | mikeL | 2008-06-07 22:48:18 +0100 (Sat, 07 Jun 2008) | 1 line Implemented paste functionality ........ r4303 | mikeL | 2008-06-07 22:48:40 +0100 (Sat, 07 Jun 2008) | 1 line Removed old test case ........ r4304 | mikeL | 2008-06-07 22:53:56 +0100 (Sat, 07 Jun 2008) | 1 line Fixed bug where click would be sent at the end of a button 2 drag (Thanks tlsa) ........ r4305 | mikeL | 2008-06-07 23:48:01 +0100 (Sat, 07 Jun 2008) | 1 line Prevented gui_copy_to_clipboard from overwriting clipboard with a NULL string. ........ r4306 | mikeL | 2008-06-08 00:00:55 +0100 (Sun, 08 Jun 2008) | 1 line Fixed regression where the state of the modifier keys would alternate as the mouse moved. Fixed bug that prevented drags from being registered if a modifier key was pressed ........ r4308 | mikeL | 2008-06-08 00:53:26 +0100 (Sun, 08 Jun 2008) | 1 line Changed 'Select All' menu item to stock ........ r4314 | mikeL | 2008-06-09 19:09:23 +0100 (Mon, 09 Jun 2008) | 1 line Added function nsgtk_scaffolding_set_sensitive ........ r4315 | mikeL | 2008-06-09 19:14:14 +0100 (Mon, 09 Jun 2008) | 1 line Added function nsgtk_scaffolding_set_sensitive ........ r4316 | mikeL | 2008-06-09 19:20:16 +0100 (Mon, 09 Jun 2008) | 1 line Removed option 'Use Cairo for anti-aliased rendering' ........ r4317 | mikeL | 2008-06-09 20:10:55 +0100 (Mon, 09 Jun 2008) | 1 line Fixed bug where text would be selected in all windows instead of only the active one ........ r4318 | mikeL | 2008-06-09 20:29:42 +0100 (Mon, 09 Jun 2008) | 1 line (Drastically) Improved redraw handling. (Thanks jmb) ........ r4319 | mikeL | 2008-06-09 21:10:17 +0100 (Mon, 09 Jun 2008) | 1 line Removed old test case ........ r4320 | mikeL | 2008-06-10 07:27:32 +0100 (Tue, 10 Jun 2008) | 1 line Implemented (almost) the rest of the clipboard functionality. Clipboard functions now handle the url bar correctly. Clipboard menu items are now appropriately sensitive. ........ r4321 | mikeL | 2008-06-10 19:08:05 +0100 (Tue, 10 Jun 2008) | 1 line Added clipboard functions to contextual right click menu ........ r4323 | mikeL | 2008-06-10 23:57:43 +0100 (Tue, 10 Jun 2008) | 1 line Fixed regression where modifiers key states would be cleared on button release. Modifier keys are now set only on button press and can only be removed during motion or upon release. Fixed spacing (thanks tlsa) ........ svn path=/trunk/netsurf/; revision=4326
This commit is contained in:
parent
f69c024ecb
commit
5fa68a06c2
@ -49,11 +49,15 @@ S_RISCOS := 401login.c artworks.c assert.c awrender.s bitmap.c buffer.c \
|
||||
con_theme.c)
|
||||
S_RISCOS := $(addprefix riscos/,$(S_RISCOS))
|
||||
|
||||
# S_DIALOGS are sources related to dialogs but required only
|
||||
# for the GTK build
|
||||
S_DIALOGS := gtk_options.c gtk_about.c
|
||||
S_DIALOGS := $(addprefix gtk/dialogs/,$(S_DIALOGS))
|
||||
|
||||
# S_GTK are sources purely for the GTK build
|
||||
S_GTK := font_pango.c gtk_bitmap.c gtk_gui.c gtk_schedule.c \
|
||||
gtk_thumbnail.c gtk_options.c \
|
||||
gtk_plotters.c gtk_treeview.c gtk_scaffolding.c gtk_completion.c \
|
||||
gtk_login.c gtk_throbber.c \
|
||||
gtk_thumbnail.c gtk_plotters.c gtk_treeview.c gtk_scaffolding.c \
|
||||
gtk_completion.c gtk_login.c gtk_throbber.c gtk_selection.c \
|
||||
gtk_history.c gtk_window.c gtk_filetype.c gtk_download.c
|
||||
S_GTK := $(addprefix gtk/,$(S_GTK))
|
||||
|
||||
@ -123,7 +127,7 @@ EXETARGET := !NetSurf/!RunImage$(EXEEXT)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),gtk)
|
||||
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_GTK)
|
||||
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_GTK) $(S_DIALOGS)
|
||||
EXETARGET := nsgtk
|
||||
endif
|
||||
|
||||
|
@ -166,7 +166,7 @@ struct {
|
||||
{ "http_proxy", OPTION_BOOL, &option_http_proxy },
|
||||
{ "http_proxy_host", OPTION_STRING, &option_http_proxy_host },
|
||||
{ "http_proxy_port", OPTION_INTEGER, &option_http_proxy_port },
|
||||
{ "http_proxy_auth", OPTION_BOOL, &option_http_proxy_auth },
|
||||
{ "http_proxy_auth", OPTION_INTEGER, &option_http_proxy_auth },
|
||||
{ "http_proxy_auth_user", OPTION_STRING, &option_http_proxy_auth_user },
|
||||
{ "http_proxy_auth_pass", OPTION_STRING, &option_http_proxy_auth_pass },
|
||||
{ "font_size", OPTION_INTEGER, &option_font_size },
|
||||
|
@ -262,7 +262,7 @@ bool selection_click(struct selection *s, browser_mouse_state mouse,
|
||||
}
|
||||
else if (!modkeys) {
|
||||
if (mouse & BROWSER_MOUSE_DRAG_1) {
|
||||
|
||||
|
||||
/* start new selection drag */
|
||||
selection_clear(s, true);
|
||||
|
||||
|
61
gtk/dialogs/gtk_about.c
Normal file
61
gtk/dialogs/gtk_about.c
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2008 Mike Lester <element3260@gmail.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "gtk/gtk_gui.h"
|
||||
#include "gtk/dialogs/gtk_about.h"
|
||||
#include "desktop/browser.h"
|
||||
|
||||
GtkAboutDialog* about_dialog;
|
||||
|
||||
static gchar *authors[] = {"John-Mark Bell", "James Bursa",
|
||||
"Rob Kendrick", "Adrian Lees", "Vincent Sanders", "Daniel Silverstone",
|
||||
"Richard Wilson", "\nContributors:", "Kevin Bagust", "Stefaan Claes",
|
||||
"Matthew Hambley", "Rob Jackson", "Jeffrey Lee", "Phil Mellor",
|
||||
"Philip Pemberton", "Darren Salt", "Andrew Timmins", "John Tytgat",
|
||||
"Chris Williams", "\nGoogle Summer of Code Contributors:", "Adam Blokus",
|
||||
"Sean Fox", "Michael Lester", "Andrew Sidwell", NULL};
|
||||
static gchar *translators = "Sebastian Barthel \nBruno D'Arcangeli \nGerard van Katwijk \nJérôme Mathevet \nSimon Voortman.";
|
||||
static gchar *artists[] = {"Michael Drake", "\nContributors:",
|
||||
"Andrew Duffell", "John Duffell", "Richard Hallas", "Phil Mellor", NULL};
|
||||
static gchar *documenters[] = {"John-Mark Bell", "James Bursa", "Michael Drake", "Richard Wilson", "\nContributors:", "James Shaw", NULL};
|
||||
|
||||
static gchar *name = "NetSurf";
|
||||
static gchar *description = "Small as a mouse, fast as a cheetah, and available for free.\nNetsurf is a web browser for RISC OS and UNIX-like platforms.";
|
||||
static gchar *url = "http://www.netsurf-browser.org";
|
||||
static gchar *url_label = "NetSurf Website";
|
||||
static gchar *copyright = "Copyright © 2003 - 2008 The NetSurf Developers";
|
||||
|
||||
static gchar* licence = "licence";
|
||||
|
||||
static void launch_url (GtkAboutDialog *about_dialog, const gchar *url, gpointer data){
|
||||
struct browser_window *bw = data;
|
||||
browser_window_go(bw, url, 0, true);
|
||||
}
|
||||
|
||||
void nsgtk_about_dialog_init(GtkWindow *parent, struct browser_window *bw, const char *version) {
|
||||
g_file_get_contents(g_strconcat(res_dir_location, licence, NULL), &licence, NULL, NULL);
|
||||
gtk_about_dialog_set_url_hook (launch_url, (gpointer) bw, NULL);
|
||||
|
||||
gtk_show_about_dialog(parent, "artists", artists, "authors", authors,
|
||||
"comments", description,"copyright", copyright, "documenters", documenters,
|
||||
"license", licence,
|
||||
"program-name", name, "translator-credits", translators,
|
||||
"version", version, "website", url, "website-label", url_label,
|
||||
"wrap-license", FALSE, NULL);
|
||||
}
|
||||
|
30
gtk/dialogs/gtk_about.h
Normal file
30
gtk/dialogs/gtk_about.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2008 Rob Kendrick <rjek@rjek.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef NETSURF_GTK_ABOUT_H
|
||||
#define NETSURF_GTK_ABOUT_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gtk/gtk_gui.h"
|
||||
#include "desktop/netsurf.h"
|
||||
#include "desktop/browser.h"
|
||||
|
||||
void nsgtk_about_dialog_init(GtkWindow *parent, struct browser_window *bw, const char *version);
|
||||
|
||||
#endif
|
348
gtk/dialogs/gtk_options.c
Normal file
348
gtk/dialogs/gtk_options.c
Normal file
@ -0,0 +1,348 @@
|
||||
/*
|
||||
* Copyright 2006 Rob Kendrick <rjek@rjek.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glade/glade.h>
|
||||
#include "utils/log.h"
|
||||
#include "desktop/options.h"
|
||||
#include "gtk/options.h"
|
||||
#include "gtk/gtk_gui.h"
|
||||
#include "gtk/gtk_scaffolding.h"
|
||||
#include "gtk/dialogs/gtk_options.h"
|
||||
#include "gtk/gtk_window.h"
|
||||
|
||||
GtkDialog *wndPreferences;
|
||||
GladeXML *gladeFile;
|
||||
gboolean is_initialized = FALSE;
|
||||
gchar *glade_location = "options.glade";
|
||||
struct browser_window *current_browser;
|
||||
|
||||
char *proxy_port = NULL;
|
||||
int proxy_type;
|
||||
float animation_delay;
|
||||
|
||||
/* Declares both widget and callback */
|
||||
#define DECLARE(x) GtkWidget *x; gboolean on_##x##_changed( \
|
||||
GtkWidget *widget, gpointer data)
|
||||
|
||||
DECLARE(entryHomePageURL);
|
||||
DECLARE(setCurrentPage);
|
||||
DECLARE(setDefaultPage);
|
||||
DECLARE(checkHideAdverts);
|
||||
DECLARE(checkDisablePopups);
|
||||
DECLARE(checkDisablePlugins);
|
||||
DECLARE(spinHistoryAge);
|
||||
DECLARE(checkHoverURLs);
|
||||
DECLARE(checkRequestOverwrite);
|
||||
DECLARE(checkDisplayRecentURLs);
|
||||
DECLARE(checkSendReferer);
|
||||
|
||||
DECLARE(comboProxyType);
|
||||
DECLARE(entryProxyHost);
|
||||
DECLARE(entryProxyPort);
|
||||
DECLARE(entryProxyUser);
|
||||
DECLARE(entryProxyPassword);
|
||||
DECLARE(spinMaxFetchers);
|
||||
DECLARE(spinFetchesPerHost);
|
||||
DECLARE(spinCachedConnections);
|
||||
|
||||
DECLARE(checkResampleImages);
|
||||
DECLARE(spinAnimationSpeed);
|
||||
DECLARE(checkDisableAnimations);
|
||||
|
||||
DECLARE(fontSansSerif);
|
||||
DECLARE(fontSerif);
|
||||
DECLARE(fontMonospace);
|
||||
DECLARE(fontCursive);
|
||||
DECLARE(fontFantasy);
|
||||
DECLARE(comboDefault);
|
||||
DECLARE(spinDefaultSize);
|
||||
DECLARE(spinMinimumSize);
|
||||
DECLARE(fontPreview);
|
||||
|
||||
DECLARE(spinMemoryCacheSize);
|
||||
DECLARE(spinDiscCacheAge);
|
||||
|
||||
/* Used when the feature is not implemented yet */
|
||||
#define FIND_WIDGET(x) (x) = glade_xml_get_widget(gladeFile, #x); \
|
||||
if ((x) == NULL) LOG(("Unable to find widget '%s'!", #x))
|
||||
|
||||
/* Assigns widget and connects it to its callback function */
|
||||
#define CONNECT(x, y) g_signal_connect(G_OBJECT(x), y, \
|
||||
G_CALLBACK(on_##x##_changed), NULL)
|
||||
|
||||
GtkDialog* nsgtk_options_init(struct browser_window *bw, GtkWindow *parent) {
|
||||
glade_location = g_strconcat(res_dir_location, glade_location, NULL);
|
||||
LOG(("Using '%s' as Glade template file", glade_location));
|
||||
gladeFile = glade_xml_new(glade_location, NULL, NULL);
|
||||
|
||||
current_browser = bw;
|
||||
wndPreferences = GTK_DIALOG(glade_xml_get_widget(gladeFile,
|
||||
"dlgPreferences"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW(wndPreferences), parent);
|
||||
|
||||
/* set the widgets to reflect the current options */
|
||||
nsgtk_options_load();
|
||||
|
||||
/* Connect all widgets to their appropriate callbacks */
|
||||
CONNECT(entryHomePageURL, "focus-out-event");
|
||||
CONNECT(setCurrentPage, "clicked");
|
||||
CONNECT(setDefaultPage, "clicked");
|
||||
CONNECT(checkHideAdverts, "toggled");
|
||||
//CONNECT(checkDisablePopups, "toggled");
|
||||
//CONNECT(checkDisablePlugins, "toggled");
|
||||
//CONNECT(spinHistoryAge, "focus-out-event");
|
||||
//CONNECT(checkHoverURLs, "toggled");
|
||||
//CONNECT(checkRequestOverwrite, "toggled");
|
||||
CONNECT(checkDisplayRecentURLs, "toggled");
|
||||
CONNECT(checkSendReferer, "toggled");
|
||||
|
||||
CONNECT(comboProxyType, "changed");
|
||||
CONNECT(entryProxyHost, "focus-out-event");
|
||||
CONNECT(entryProxyPort, "focus-out-event");
|
||||
CONNECT(entryProxyUser, "focus-out-event");
|
||||
CONNECT(entryProxyPassword, "focus-out-event");
|
||||
CONNECT(spinMaxFetchers, "value-changed");
|
||||
CONNECT(spinFetchesPerHost, "value-changed");
|
||||
CONNECT(spinCachedConnections, "value-changed");
|
||||
|
||||
CONNECT(checkResampleImages, "toggled");
|
||||
CONNECT(spinAnimationSpeed, "value-changed");
|
||||
CONNECT(checkDisableAnimations, "toggled");
|
||||
|
||||
CONNECT(fontSansSerif, "font-set");
|
||||
CONNECT(fontSerif, "font-set");
|
||||
CONNECT(fontMonospace, "font-set");
|
||||
CONNECT(fontCursive, "font-set");
|
||||
CONNECT(fontFantasy, "font-set");
|
||||
CONNECT(comboDefault, "changed");
|
||||
CONNECT(spinDefaultSize, "value-changed");
|
||||
CONNECT(spinMinimumSize, "value-changed");
|
||||
CONNECT(fontPreview, "clicked");
|
||||
|
||||
CONNECT(spinMemoryCacheSize, "value-changed");
|
||||
CONNECT(spinDiscCacheAge, "value-changed");
|
||||
|
||||
g_signal_connect(G_OBJECT(wndPreferences), "response",
|
||||
G_CALLBACK (dialog_response_handler), NULL);
|
||||
|
||||
g_signal_connect(G_OBJECT(wndPreferences), "delete-event",
|
||||
G_CALLBACK (on_dialog_close), (gpointer)TRUE);
|
||||
|
||||
g_signal_connect(G_OBJECT(wndPreferences), "destroy",
|
||||
G_CALLBACK (on_dialog_close), (gpointer)FALSE);
|
||||
|
||||
gtk_widget_show(GTK_WIDGET(wndPreferences));
|
||||
|
||||
return wndPreferences;
|
||||
}
|
||||
|
||||
#define SET_ENTRY(x, y) (x) = glade_xml_get_widget(gladeFile, #x); \
|
||||
gtk_entry_set_text(GTK_ENTRY((x)), (y))
|
||||
#define SET_SPIN(x, y) (x) = glade_xml_get_widget(gladeFile, #x); \
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON((x)), (y))
|
||||
#define SET_CHECK(x, y) (x) = glade_xml_get_widget(gladeFile, #x); \
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON((x)), (y))
|
||||
#define SET_COMBO(x, y) (x) = glade_xml_get_widget(gladeFile, #x); \
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX((x)), (y))
|
||||
#define SET_FONT(x, y) (x) = glade_xml_get_widget(gladeFile, #x); \
|
||||
gtk_font_button_set_font_name(GTK_FONT_BUTTON((x)), (y))
|
||||
#define SET_BUTTON(x) (x) = glade_xml_get_widget(gladeFile, #x);
|
||||
|
||||
void nsgtk_options_load(void) {
|
||||
char b[20];
|
||||
int proxytype = 0;
|
||||
|
||||
SET_ENTRY(entryHomePageURL,
|
||||
option_homepage_url ? option_homepage_url : "");
|
||||
SET_BUTTON(setCurrentPage);
|
||||
SET_BUTTON(setDefaultPage);
|
||||
SET_CHECK(checkHideAdverts, option_block_ads);
|
||||
SET_CHECK(checkDisplayRecentURLs, option_url_suggestion);
|
||||
SET_CHECK(checkSendReferer, option_send_referer);
|
||||
|
||||
if (option_http_proxy == false)
|
||||
proxytype = 0;
|
||||
else
|
||||
proxytype = option_http_proxy_auth + 1;
|
||||
|
||||
SET_COMBO(comboProxyType, proxytype);
|
||||
SET_ENTRY(entryProxyHost,
|
||||
option_http_proxy_host ? option_http_proxy_host : "");
|
||||
gtk_widget_set_sensitive (entryProxyHost, !proxytype == 0);
|
||||
snprintf(b, 20, "%d", option_http_proxy_port);
|
||||
SET_ENTRY(entryProxyPort, b);
|
||||
gtk_widget_set_sensitive (entryProxyPort, !proxytype == 0);
|
||||
SET_ENTRY(entryProxyUser, option_http_proxy_auth_user ?
|
||||
option_http_proxy_auth_user : "");
|
||||
gtk_widget_set_sensitive (entryProxyUser, !proxytype == 0);
|
||||
SET_ENTRY(entryProxyPassword, option_http_proxy_auth_pass ?
|
||||
option_http_proxy_auth_pass : "");
|
||||
gtk_widget_set_sensitive (entryProxyPassword, !proxytype == 0);
|
||||
|
||||
SET_SPIN(spinMaxFetchers, option_max_fetchers);
|
||||
SET_SPIN(spinFetchesPerHost, option_max_fetchers_per_host);
|
||||
SET_SPIN(spinCachedConnections, option_max_cached_fetch_handles);
|
||||
|
||||
SET_CHECK(checkResampleImages, option_render_resample);
|
||||
SET_SPIN(spinAnimationSpeed, option_minimum_gif_delay / 100.0);
|
||||
SET_CHECK(checkDisableAnimations, !option_animate_images);
|
||||
|
||||
SET_FONT(fontSansSerif, option_font_sans);
|
||||
SET_FONT(fontSerif, option_font_serif);
|
||||
SET_FONT(fontMonospace, option_font_mono);
|
||||
SET_FONT(fontCursive, option_font_cursive);
|
||||
SET_FONT(fontFantasy, option_font_fantasy);
|
||||
SET_COMBO(comboDefault, option_font_default - 1);
|
||||
SET_SPIN(spinDefaultSize, option_font_size / 10);
|
||||
SET_SPIN(spinMinimumSize, option_font_min_size / 10);
|
||||
SET_BUTTON(fontPreview);
|
||||
|
||||
SET_SPIN(spinMemoryCacheSize, option_memory_cache_size >> 20);
|
||||
SET_SPIN(spinDiscCacheAge, option_disc_cache_age);
|
||||
}
|
||||
|
||||
static void dialog_response_handler (GtkDialog *dlg, gint res_id){
|
||||
switch (res_id)
|
||||
{
|
||||
case GTK_RESPONSE_HELP:
|
||||
/* Ready to implement Help */
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_CLOSE:
|
||||
on_dialog_close(dlg, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean on_dialog_close (GtkDialog *dlg, gboolean stay_alive){
|
||||
LOG(("Writing options to file"));
|
||||
options_write(options_file_location);
|
||||
if (stay_alive) gtk_widget_hide (GTK_WIDGET(wndPreferences));
|
||||
return stay_alive;
|
||||
}
|
||||
|
||||
|
||||
/* Defines the callback functions for all widgets and specifies
|
||||
* nsgtk_reflow_all_windows only where necessary */
|
||||
#define ENTRY_CHANGED(x, y) gboolean on_##x##_changed(GtkWidget *widget, gpointer data) { \
|
||||
if (!g_str_equal(gtk_entry_get_text(GTK_ENTRY((x))), (y))) { \
|
||||
LOG(("Signal emitted on '%s'", #x)); \
|
||||
if ((y)) free((y)); \
|
||||
(y) = strdup(gtk_entry_get_text(GTK_ENTRY((x))));
|
||||
#define CHECK_CHANGED(x, y) gboolean on_##x##_changed(GtkWidget *widget, gpointer data) { \
|
||||
LOG(("Signal emitted on '%s'", #x)); \
|
||||
(y) = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON((x)));
|
||||
#define SPIN_CHANGED(x, y) gboolean on_##x##_changed(GtkWidget *widget, gpointer data) { \
|
||||
LOG(("Signal emitted on '%s'", #x)); \
|
||||
(y) = gtk_spin_button_get_value(GTK_SPIN_BUTTON((x)));
|
||||
#define COMBO_CHANGED(x, y) gboolean on_##x##_changed(GtkWidget *widget, gpointer data) { \
|
||||
LOG(("Signal emitted on '%s'", #x)); \
|
||||
(y) = gtk_combo_box_get_active(GTK_COMBO_BOX((x)));
|
||||
#define FONT_CHANGED(x, y) gboolean on_##x##_changed(GtkWidget *widget, gpointer data) { \
|
||||
LOG(("Signal emitted on '%s'", #x)); \
|
||||
if ((y)) free((y)); \
|
||||
(y) = strdup(gtk_font_button_get_font_name(GTK_FONT_BUTTON((x))));
|
||||
#define BUTTON_CLICKED(x) gboolean on_##x##_changed(GtkWidget *widget, gpointer data) { \
|
||||
LOG(("Signal emitted on '%s'", #x));
|
||||
|
||||
ENTRY_CHANGED(entryHomePageURL, option_homepage_url)}
|
||||
return FALSE;}
|
||||
BUTTON_CLICKED(setCurrentPage)
|
||||
const gchar *url = current_browser->current_content->url;
|
||||
gtk_entry_set_text(GTK_ENTRY(entryHomePageURL), url);
|
||||
option_homepage_url =
|
||||
strdup(gtk_entry_get_text(GTK_ENTRY(entryHomePageURL)));}
|
||||
BUTTON_CLICKED(setDefaultPage)
|
||||
gtk_entry_set_text(GTK_ENTRY(entryHomePageURL),
|
||||
"http://www.netsurf-browser.org/welcome/");
|
||||
option_homepage_url =
|
||||
strdup(gtk_entry_get_text(GTK_ENTRY(entryHomePageURL)));}
|
||||
CHECK_CHANGED(checkHideAdverts, option_block_ads)}
|
||||
CHECK_CHANGED(checkDisplayRecentURLs, option_url_suggestion)}
|
||||
CHECK_CHANGED(checkSendReferer, option_send_referer)}
|
||||
|
||||
COMBO_CHANGED(comboProxyType, proxy_type)
|
||||
LOG(("proxy type: %d", proxy_type));
|
||||
switch (proxy_type)
|
||||
{
|
||||
case 0:
|
||||
option_http_proxy = false;
|
||||
option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NONE;
|
||||
break;
|
||||
case 1:
|
||||
option_http_proxy = true;
|
||||
option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NONE;
|
||||
break;
|
||||
case 2:
|
||||
option_http_proxy = true;
|
||||
option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_BASIC;
|
||||
break;
|
||||
case 3:
|
||||
option_http_proxy = true;
|
||||
option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NTLM;
|
||||
break;
|
||||
}
|
||||
gboolean sensitive = (!proxy_type == 0);
|
||||
gtk_widget_set_sensitive (entryProxyHost, sensitive);
|
||||
gtk_widget_set_sensitive (entryProxyPort, sensitive);
|
||||
gtk_widget_set_sensitive (entryProxyUser, sensitive);
|
||||
gtk_widget_set_sensitive (entryProxyPassword, sensitive);
|
||||
}
|
||||
|
||||
ENTRY_CHANGED(entryProxyHost, option_http_proxy_host)}
|
||||
return FALSE;}
|
||||
ENTRY_CHANGED(entryProxyPort, proxy_port)
|
||||
option_http_proxy_port = atoi(proxy_port);
|
||||
free(proxy_port);}
|
||||
return FALSE;}
|
||||
ENTRY_CHANGED(entryProxyUser, option_http_proxy_auth_user)}
|
||||
return FALSE;}
|
||||
ENTRY_CHANGED(entryProxyPassword, option_http_proxy_auth_pass)}
|
||||
return FALSE;}
|
||||
|
||||
SPIN_CHANGED(spinMaxFetchers, option_max_fetchers)}
|
||||
SPIN_CHANGED(spinFetchesPerHost, option_max_fetchers_per_host)}
|
||||
SPIN_CHANGED(spinCachedConnections, option_max_cached_fetch_handles)}
|
||||
|
||||
CHECK_CHANGED(checkResampleImages, option_render_resample)}
|
||||
SPIN_CHANGED(spinAnimationSpeed, animation_delay)
|
||||
option_minimum_gif_delay = round(animation_delay * 100.0);}
|
||||
CHECK_CHANGED(checkDisableAnimations, option_animate_images);
|
||||
option_animate_images = !option_animate_images;}
|
||||
|
||||
FONT_CHANGED(fontSansSerif, option_font_sans)}
|
||||
FONT_CHANGED(fontSerif, option_font_serif)}
|
||||
FONT_CHANGED(fontMonospace, option_font_mono)}
|
||||
FONT_CHANGED(fontCursive, option_font_cursive)}
|
||||
FONT_CHANGED(fontFantasy, option_font_fantasy)}
|
||||
COMBO_CHANGED(comboDefault, option_font_default)
|
||||
option_font_default++;}
|
||||
|
||||
SPIN_CHANGED(spinDefaultSize, option_font_size)
|
||||
option_font_size *= 10;}
|
||||
SPIN_CHANGED(spinMinimumSize, option_font_min_size)
|
||||
option_font_min_size *= 10;}
|
||||
BUTTON_CLICKED(fontPreview)
|
||||
nsgtk_reflow_all_windows();}
|
||||
|
||||
SPIN_CHANGED(spinMemoryCacheSize, option_memory_cache_size)
|
||||
option_memory_cache_size <<= 20;}
|
||||
SPIN_CHANGED(spinDiscCacheAge, option_disc_cache_age)}
|
@ -21,10 +21,13 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
extern GtkWindow *wndPreferences;
|
||||
extern GtkDialog *wndPreferences;
|
||||
|
||||
void nsgtk_options_init(void); /** Init options and load window */
|
||||
GtkDialog* nsgtk_options_init(struct browser_window *bw, GtkWindow *parent); /** Init options and load window */
|
||||
void nsgtk_options_load(void); /** Load current options into window */
|
||||
void nsgtk_options_save(void); /** Save options from window */
|
||||
|
||||
/** Callbacks */
|
||||
static void dialog_response_handler (GtkDialog *dlg, gint res_id);
|
||||
static gboolean on_dialog_close (GtkDialog *dlg, gboolean stay_alive);
|
||||
#endif
|
@ -42,7 +42,7 @@
|
||||
#include "desktop/netsurf.h"
|
||||
#include "desktop/options.h"
|
||||
#include "gtk/gtk_gui.h"
|
||||
#include "gtk/gtk_options.h"
|
||||
#include "gtk/dialogs/gtk_options.h"
|
||||
#include "gtk/gtk_completion.h"
|
||||
#include "gtk/gtk_window.h"
|
||||
#include "gtk/options.h"
|
||||
@ -68,6 +68,7 @@ char *default_stylesheet_url;
|
||||
char *adblock_stylesheet_url;
|
||||
char *options_file_location;
|
||||
char *glade_file_location;
|
||||
char *res_dir_location;
|
||||
|
||||
struct gui_window *search_current_window = 0;
|
||||
|
||||
@ -76,7 +77,6 @@ GtkWindow *wndWarning;
|
||||
GladeXML *gladeWindows;
|
||||
GtkWindow *wndTooltip;
|
||||
GtkLabel *labelTooltip;
|
||||
GtkDialog *wndOpenFile;
|
||||
|
||||
static GtkWidget *select_menu;
|
||||
static struct browser_window *select_menu_bw;
|
||||
@ -176,10 +176,14 @@ void gui_init(int argc, char** argv)
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
check_homedir();
|
||||
|
||||
|
||||
find_resource(buf, "netsurf.glade", "./gtk/res/netsurf.glade");
|
||||
LOG(("Using '%s' as Glade template file", buf));
|
||||
glade_file_location = strdup(buf);
|
||||
|
||||
buf[strlen(buf)- 13] = 0;
|
||||
LOG(("Using '%s' as Resources directory", buf));
|
||||
res_dir_location = strdup(buf);
|
||||
|
||||
glade_init();
|
||||
gladeWindows = glade_xml_new(glade_file_location, NULL, NULL);
|
||||
@ -239,8 +243,6 @@ void gui_init(int argc, char** argv)
|
||||
SETFONTDEFAULT(option_font_cursive, "Serif");
|
||||
SETFONTDEFAULT(option_font_fantasy, "Serif");
|
||||
|
||||
nsgtk_options_init();
|
||||
|
||||
if (!option_cookie_file) {
|
||||
find_resource(buf, "Cookies", "~/.netsurf/Cookies");
|
||||
LOG(("Using '%s' as Cookies file", buf));
|
||||
@ -297,7 +299,6 @@ void gui_init(int argc, char** argv)
|
||||
glade_xml_get_widget(gladeWindows, "textviewGPL")), fontdesc);
|
||||
|
||||
wndWarning = GTK_WINDOW(glade_xml_get_widget(gladeWindows, "wndWarning"));
|
||||
wndOpenFile = GTK_DIALOG(glade_xml_get_widget(gladeWindows, "wndOpenFile"));
|
||||
|
||||
nsgtk_history_init();
|
||||
nsgtk_download_initialise();
|
||||
@ -306,13 +307,14 @@ void gui_init(int argc, char** argv)
|
||||
|
||||
void gui_init2(int argc, char** argv)
|
||||
{
|
||||
struct browser_window *bw;
|
||||
const char *addr = "http://netsurf-browser.org/welcome/";
|
||||
|
||||
if (option_homepage_url != NULL && option_homepage_url[0] != '\0')
|
||||
addr = option_homepage_url;
|
||||
|
||||
if (argc > 1) addr = argv[1];
|
||||
browser_window_create(addr, 0, 0, true);
|
||||
bw = browser_window_create(addr, 0, 0, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@ extern bool gui_in_multitask;
|
||||
extern GladeXML *gladeWindows;
|
||||
extern char *glade_file_location;
|
||||
extern char *options_file_location;
|
||||
extern char *res_dir_location;
|
||||
|
||||
extern GtkWindow *wndAbout;
|
||||
|
||||
|
@ -1,253 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006 Rob Kendrick <rjek@rjek.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glade/glade.h>
|
||||
#include "utils/log.h"
|
||||
#include "desktop/options.h"
|
||||
#include "gtk/options.h"
|
||||
#include "gtk/gtk_gui.h"
|
||||
#include "gtk/gtk_scaffolding.h"
|
||||
#include "gtk/gtk_options.h"
|
||||
#include "gtk/gtk_window.h"
|
||||
|
||||
GtkWindow *wndPreferences;
|
||||
|
||||
static GtkWidget *entryHomePageURL,
|
||||
*checkHideAdverts,
|
||||
*checkDisablePopups,
|
||||
*checkDisablePlugins,
|
||||
*spinHistoryAge,
|
||||
*checkHoverURLs,
|
||||
*checkRequestOverwrite,
|
||||
*checkDisplayRecentURLs,
|
||||
*checkSendReferer,
|
||||
|
||||
*comboProxyType,
|
||||
*entryProxyHost,
|
||||
*entryProxyPort,
|
||||
*entryProxyUser,
|
||||
*entryProxyPassword,
|
||||
*spinMaxFetchers,
|
||||
*spinFetchesPerHost,
|
||||
*spinCachedConnections,
|
||||
|
||||
*checkUseCairo,
|
||||
*checkResampleImages,
|
||||
*spinAnimationSpeed,
|
||||
*checkDisableAnimations,
|
||||
|
||||
*fontSansSerif,
|
||||
*fontSerif,
|
||||
*fontMonospace,
|
||||
*fontCursive,
|
||||
*fontFantasy,
|
||||
*comboDefault,
|
||||
*spinDefaultSize,
|
||||
*spinMinimumSize,
|
||||
|
||||
*spinMemoryCacheSize,
|
||||
*spinDiscCacheAge;
|
||||
|
||||
#define FIND_WIDGET(x) (x) = glade_xml_get_widget(gladeWindows, #x); if ((x) == NULL) LOG(("Unable to find widget '%s'!", #x))
|
||||
|
||||
void nsgtk_options_init(void) {
|
||||
wndPreferences = GTK_WINDOW(glade_xml_get_widget(gladeWindows,
|
||||
"wndPreferences"));
|
||||
|
||||
/* get widget objects */
|
||||
FIND_WIDGET(entryHomePageURL);
|
||||
FIND_WIDGET(checkHideAdverts);
|
||||
FIND_WIDGET(checkDisablePopups);
|
||||
FIND_WIDGET(checkDisablePlugins);
|
||||
FIND_WIDGET(spinHistoryAge);
|
||||
FIND_WIDGET(checkHoverURLs);
|
||||
FIND_WIDGET(checkRequestOverwrite);
|
||||
FIND_WIDGET(checkDisplayRecentURLs);
|
||||
FIND_WIDGET(checkSendReferer);
|
||||
|
||||
FIND_WIDGET(comboProxyType);
|
||||
FIND_WIDGET(entryProxyHost);
|
||||
FIND_WIDGET(entryProxyPort);
|
||||
FIND_WIDGET(entryProxyUser);
|
||||
FIND_WIDGET(entryProxyPassword);
|
||||
FIND_WIDGET(spinMaxFetchers);
|
||||
FIND_WIDGET(spinFetchesPerHost);
|
||||
FIND_WIDGET(spinCachedConnections);
|
||||
|
||||
FIND_WIDGET(checkUseCairo);
|
||||
FIND_WIDGET(checkResampleImages);
|
||||
FIND_WIDGET(spinAnimationSpeed);
|
||||
FIND_WIDGET(checkDisableAnimations);
|
||||
|
||||
FIND_WIDGET(fontSansSerif);
|
||||
FIND_WIDGET(fontSerif);
|
||||
FIND_WIDGET(fontMonospace);
|
||||
FIND_WIDGET(fontCursive);
|
||||
FIND_WIDGET(fontFantasy);
|
||||
FIND_WIDGET(comboDefault);
|
||||
FIND_WIDGET(spinDefaultSize);
|
||||
FIND_WIDGET(spinMinimumSize);
|
||||
|
||||
FIND_WIDGET(spinMemoryCacheSize);
|
||||
FIND_WIDGET(spinDiscCacheAge);
|
||||
|
||||
/* set the widgets to reflect the current options */
|
||||
nsgtk_options_load();
|
||||
}
|
||||
|
||||
#define SET_ENTRY(x, y) gtk_entry_set_text(GTK_ENTRY((x)), (y))
|
||||
#define SET_SPIN(x, y) gtk_spin_button_set_value(GTK_SPIN_BUTTON((x)), (y))
|
||||
#define SET_CHECK(x, y) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON((x)), (y))
|
||||
#define SET_COMBO(x, y) gtk_combo_box_set_active(GTK_COMBO_BOX((x)), (y))
|
||||
#define SET_FONT(x, y) gtk_font_button_set_font_name(GTK_FONT_BUTTON((x)), (y))
|
||||
|
||||
void nsgtk_options_load(void) {
|
||||
char b[20];
|
||||
int proxytype = 0;
|
||||
|
||||
SET_ENTRY(entryHomePageURL,
|
||||
option_homepage_url ? option_homepage_url : "");
|
||||
SET_CHECK(checkHideAdverts, option_block_ads);
|
||||
SET_CHECK(checkDisplayRecentURLs, option_url_suggestion);
|
||||
SET_CHECK(checkSendReferer, option_send_referer);
|
||||
|
||||
switch (option_http_proxy_auth) {
|
||||
case OPTION_HTTP_PROXY_AUTH_NONE:
|
||||
proxytype = 1;
|
||||
break;
|
||||
case OPTION_HTTP_PROXY_AUTH_BASIC:
|
||||
proxytype = 2;
|
||||
break;
|
||||
case OPTION_HTTP_PROXY_AUTH_NTLM:
|
||||
proxytype = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
if (option_http_proxy == false)
|
||||
proxytype = 0;
|
||||
|
||||
SET_COMBO(comboProxyType, proxytype);
|
||||
SET_ENTRY(entryProxyHost,
|
||||
option_http_proxy_host ? option_http_proxy_host : "");
|
||||
snprintf(b, 20, "%d", option_http_proxy_port);
|
||||
SET_ENTRY(entryProxyPort, b);
|
||||
SET_ENTRY(entryProxyUser, option_http_proxy_auth_user ?
|
||||
option_http_proxy_auth_user : "");
|
||||
SET_ENTRY(entryProxyPassword, option_http_proxy_auth_pass ?
|
||||
option_http_proxy_auth_pass : "");
|
||||
|
||||
SET_SPIN(spinMaxFetchers, option_max_fetchers);
|
||||
SET_SPIN(spinFetchesPerHost, option_max_fetchers_per_host);
|
||||
SET_SPIN(spinCachedConnections, option_max_cached_fetch_handles);
|
||||
|
||||
SET_CHECK(checkResampleImages, option_render_resample);
|
||||
SET_SPIN(spinAnimationSpeed, option_minimum_gif_delay / 100);
|
||||
SET_CHECK(checkDisableAnimations, !option_animate_images);
|
||||
|
||||
SET_FONT(fontSansSerif, option_font_sans);
|
||||
SET_FONT(fontSerif, option_font_serif);
|
||||
SET_FONT(fontMonospace, option_font_mono);
|
||||
SET_FONT(fontCursive, option_font_cursive);
|
||||
SET_FONT(fontFantasy, option_font_fantasy);
|
||||
SET_COMBO(comboDefault, option_font_default - 1);
|
||||
SET_SPIN(spinDefaultSize, option_font_size / 10);
|
||||
SET_SPIN(spinMinimumSize, option_font_min_size / 10);
|
||||
|
||||
SET_SPIN(spinMemoryCacheSize, option_memory_cache_size >> 20);
|
||||
SET_SPIN(spinDiscCacheAge, option_disc_cache_age);
|
||||
}
|
||||
|
||||
#define GET_ENTRY(x, y) if ((y)) free((y)); \
|
||||
(y) = strdup(gtk_entry_get_text(GTK_ENTRY((x))))
|
||||
#define GET_CHECK(x, y) (y) = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON((x)))
|
||||
#define GET_SPIN(x, y) (y) = gtk_spin_button_get_value(GTK_SPIN_BUTTON((x)))
|
||||
#define GET_COMBO(x, y) (y) = gtk_combo_box_get_active(GTK_COMBO_BOX((x)))
|
||||
#define GET_FONT(x, y) if ((y)) free((y)); \
|
||||
(y) = strdup(gtk_font_button_get_font_name(GTK_FONT_BUTTON((x))))
|
||||
|
||||
void nsgtk_options_save(void) {
|
||||
char *b = NULL;
|
||||
int i;
|
||||
|
||||
GET_ENTRY(entryHomePageURL, option_homepage_url);
|
||||
GET_CHECK(checkDisplayRecentURLs, option_url_suggestion);
|
||||
|
||||
GET_COMBO(comboProxyType, i);
|
||||
LOG(("proxy type: %d", i));
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
option_http_proxy = false;
|
||||
option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NONE;
|
||||
break;
|
||||
case 1:
|
||||
option_http_proxy = true;
|
||||
option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NONE;
|
||||
break;
|
||||
case 2:
|
||||
option_http_proxy = true;
|
||||
option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_BASIC;
|
||||
break;
|
||||
case 3:
|
||||
option_http_proxy = true;
|
||||
option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NTLM;
|
||||
break;
|
||||
default:
|
||||
option_http_proxy = false;
|
||||
option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
GET_ENTRY(entryProxyHost, option_http_proxy_host);
|
||||
GET_ENTRY(entryProxyPort, b);
|
||||
option_http_proxy_port = atoi(b);
|
||||
free(b);
|
||||
GET_ENTRY(entryProxyUser, option_http_proxy_auth_user);
|
||||
GET_ENTRY(entryProxyPassword, option_http_proxy_auth_pass);
|
||||
|
||||
GET_SPIN(spinMaxFetchers, option_max_fetchers);
|
||||
GET_SPIN(spinFetchesPerHost, option_max_fetchers_per_host);
|
||||
GET_SPIN(spinCachedConnections, option_max_cached_fetch_handles);
|
||||
|
||||
GET_CHECK(checkResampleImages, option_render_resample);
|
||||
GET_SPIN(spinAnimationSpeed, option_minimum_gif_delay);
|
||||
option_minimum_gif_delay *= 100;
|
||||
|
||||
GET_FONT(fontSansSerif, option_font_sans);
|
||||
GET_FONT(fontSerif, option_font_serif);
|
||||
GET_FONT(fontMonospace, option_font_mono);
|
||||
GET_FONT(fontCursive, option_font_cursive);
|
||||
GET_FONT(fontFantasy, option_font_fantasy);
|
||||
GET_COMBO(comboDefault, option_font_default);
|
||||
option_font_default++;
|
||||
|
||||
GET_SPIN(spinDefaultSize, option_font_size);
|
||||
option_font_size *= 10;
|
||||
GET_SPIN(spinMinimumSize, option_font_min_size);
|
||||
option_font_min_size *= 10;
|
||||
|
||||
GET_SPIN(spinMemoryCacheSize, option_memory_cache_size);
|
||||
option_memory_cache_size <<= 20;
|
||||
|
||||
options_write(options_file_location);
|
||||
nsgtk_reflow_all_windows();
|
||||
}
|
@ -29,12 +29,14 @@
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/netsurf.h"
|
||||
#include "desktop/plotters.h"
|
||||
#include "desktop/selection.h"
|
||||
#include "desktop/options.h"
|
||||
#include "desktop/textinput.h"
|
||||
#include "gtk/gtk_gui.h"
|
||||
#include "gtk/gtk_plotters.h"
|
||||
#include "gtk/gtk_scaffolding.h"
|
||||
#include "gtk/gtk_options.h"
|
||||
#include "gtk/dialogs/gtk_options.h"
|
||||
#include "gtk/dialogs/gtk_about.h"
|
||||
#include "gtk/gtk_completion.h"
|
||||
#include "gtk/gtk_throbber.h"
|
||||
#include "gtk/gtk_history.h"
|
||||
@ -57,6 +59,7 @@ struct gtk_scaffolding {
|
||||
GtkEntry *url_bar;
|
||||
GtkEntryCompletion *url_bar_completion;
|
||||
GtkLabel *status_bar;
|
||||
GtkMenu *edit_menu;
|
||||
GtkToolbar *tool_bar;
|
||||
GtkToolButton *back_button;
|
||||
GtkToolButton *forward_button;
|
||||
@ -76,6 +79,7 @@ struct gtk_scaffolding {
|
||||
GtkMenu *popup_menu;
|
||||
|
||||
struct gtk_history_window *history_window;
|
||||
GtkDialog *preferences_dialog;
|
||||
|
||||
int throb_frame;
|
||||
struct gui_window *top_level;
|
||||
@ -102,6 +106,9 @@ static void nsgtk_window_destroy_event(GtkWidget *, gpointer);
|
||||
|
||||
static void nsgtk_window_update_back_forward(struct gtk_scaffolding *);
|
||||
static void nsgtk_throb(void *);
|
||||
static gboolean nsgtk_window_edit_menu_clicked(GtkWidget *widget, struct gtk_scaffolding *g);
|
||||
static gboolean nsgtk_window_edit_menu_hidden(GtkWidget *widget, struct gtk_scaffolding *g);
|
||||
static gboolean nsgtk_window_popup_menu_hidden(GtkWidget *widget, struct gtk_scaffolding *g);
|
||||
static gboolean nsgtk_window_back_button_clicked(GtkWidget *, gpointer);
|
||||
static gboolean nsgtk_window_forward_button_clicked(GtkWidget *, gpointer);
|
||||
static gboolean nsgtk_window_stop_button_clicked(GtkWidget *, gpointer);
|
||||
@ -110,6 +117,9 @@ static gboolean nsgtk_window_home_button_clicked(GtkWidget *, gpointer);
|
||||
static gboolean nsgtk_window_url_activate_event(GtkWidget *, gpointer);
|
||||
static gboolean nsgtk_window_url_changed(GtkWidget *, GdkEventKey *, gpointer);
|
||||
|
||||
static void nsgtk_scaffolding_update_edit_actions_sensitivity (struct gtk_scaffolding *g, GladeXML *xml, gboolean hide);
|
||||
static void nsgtk_scaffolding_enable_edit_actions_sensitivity (struct gtk_scaffolding *g, GladeXML *xml);
|
||||
|
||||
static gboolean nsgtk_history_expose_event(GtkWidget *, GdkEventExpose *,
|
||||
gpointer);
|
||||
static gboolean nsgtk_history_button_press_event(GtkWidget *, GdkEventButton *,
|
||||
@ -117,7 +127,7 @@ static gboolean nsgtk_history_button_press_event(GtkWidget *, GdkEventButton *,
|
||||
|
||||
static void nsgtk_attach_menu_handlers(GladeXML *, gpointer);
|
||||
|
||||
gboolean nsgtk_openfile_open(GtkWidget *widget, gpointer data);
|
||||
void nsgtk_openfile_open(char *filename);
|
||||
|
||||
#define MENUEVENT(x) { #x, G_CALLBACK(nsgtk_on_##x##_activate) }
|
||||
#define MENUPROTO(x) static gboolean nsgtk_on_##x##_activate( \
|
||||
@ -131,6 +141,10 @@ MENUPROTO(close_window);
|
||||
MENUPROTO(quit);
|
||||
|
||||
/* edit menu */
|
||||
MENUPROTO(cut);
|
||||
MENUPROTO(copy);
|
||||
MENUPROTO(paste);
|
||||
MENUPROTO(select_all);
|
||||
MENUPROTO(preferences);
|
||||
|
||||
/* view menu */
|
||||
@ -170,6 +184,10 @@ static struct menu_events menu_events[] = {
|
||||
MENUEVENT(quit),
|
||||
|
||||
/* edit menu */
|
||||
MENUEVENT(cut),
|
||||
MENUEVENT(copy),
|
||||
MENUEVENT(paste),
|
||||
MENUEVENT(select_all),
|
||||
MENUEVENT(preferences),
|
||||
|
||||
/* view menu */
|
||||
@ -255,6 +273,10 @@ void nsgtk_window_update_back_forward(struct gtk_scaffolding *g)
|
||||
history_back_available(bw->history));
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(g->forward_menu),
|
||||
history_forward_available(bw->history));
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(g->popup_xml,
|
||||
"popupBack")), history_back_available(bw->history));
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(glade_xml_get_widget(g->popup_xml,
|
||||
"popupForward")), history_forward_available(bw->history));
|
||||
|
||||
/* update the local history window, as well as queuing a redraw
|
||||
* for it.
|
||||
@ -280,7 +302,22 @@ void nsgtk_throb(void *p)
|
||||
schedule(10, nsgtk_throb, p);
|
||||
}
|
||||
|
||||
/* signal handling functions for the toolbar and URL bar */
|
||||
/* signal handling functions for the toolbar, URL bar, and menu bar */
|
||||
static gboolean nsgtk_window_edit_menu_clicked(GtkWidget *widget, struct gtk_scaffolding *g)
|
||||
{
|
||||
nsgtk_scaffolding_update_edit_actions_sensitivity (g, g->xml, FALSE);
|
||||
}
|
||||
|
||||
static gboolean nsgtk_window_edit_menu_hidden(GtkWidget *widget, struct gtk_scaffolding *g)
|
||||
{
|
||||
nsgtk_scaffolding_enable_edit_actions_sensitivity(g, g->xml);
|
||||
}
|
||||
|
||||
static gboolean nsgtk_window_popup_menu_hidden(GtkWidget *widget, struct gtk_scaffolding *g)
|
||||
{
|
||||
nsgtk_scaffolding_enable_edit_actions_sensitivity(g, g->popup_xml);
|
||||
}
|
||||
|
||||
gboolean nsgtk_window_back_button_clicked(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
struct gtk_scaffolding *g = data;
|
||||
@ -367,12 +404,10 @@ gboolean nsgtk_window_url_changed(GtkWidget *widget, GdkEventKey *event,
|
||||
}
|
||||
|
||||
|
||||
gboolean nsgtk_openfile_open(GtkWidget *widget, gpointer data)
|
||||
void nsgtk_openfile_open(char *filename)
|
||||
{
|
||||
struct browser_window *bw = nsgtk_get_browser_for_gui(
|
||||
current_model->top_level);
|
||||
char *filename = gtk_file_chooser_get_filename(
|
||||
GTK_FILE_CHOOSER(wndOpenFile));
|
||||
struct browser_window *bw = nsgtk_get_browser_for_gui(
|
||||
current_model->top_level);
|
||||
char *url = malloc(strlen(filename) + strlen("file://") + 1);
|
||||
|
||||
sprintf(url, "file://%s", filename);
|
||||
@ -381,8 +416,6 @@ gboolean nsgtk_openfile_open(GtkWidget *widget, gpointer data)
|
||||
|
||||
g_free(filename);
|
||||
free(url);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* signal handlers for menu entries */
|
||||
@ -412,8 +445,16 @@ MENUHANDLER(open_location)
|
||||
MENUHANDLER(open_file)
|
||||
{
|
||||
current_model = (struct gtk_scaffolding *)g;
|
||||
gtk_dialog_run(wndOpenFile);
|
||||
|
||||
GtkWidget *dlgOpen = gtk_file_chooser_dialog_new("Open File",
|
||||
current_model->window, GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, -6, GTK_STOCK_OPEN, -5, NULL);
|
||||
|
||||
gint response = gtk_dialog_run(GTK_DIALOG(dlgOpen));
|
||||
if (response == GTK_RESPONSE_OK){
|
||||
char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dlgOpen));
|
||||
nsgtk_openfile_open(filename);
|
||||
}
|
||||
gtk_widget_destroy(dlgOpen);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -432,10 +473,61 @@ MENUHANDLER(quit)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
MENUHANDLER(cut)
|
||||
{
|
||||
struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
|
||||
GtkWidget *focused = gtk_window_get_focus(gw->window);
|
||||
|
||||
/* If the url bar has focus, let gtk handle it */
|
||||
if (GTK_IS_EDITABLE (focused))
|
||||
gtk_editable_cut_clipboard (GTK_EDITABLE(gw->url_bar));
|
||||
else
|
||||
/* TODO: Implement Cut functionality */;
|
||||
}
|
||||
|
||||
MENUHANDLER(copy)
|
||||
{
|
||||
struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
|
||||
struct browser_window *bw = nsgtk_get_browser_for_gui(gw->top_level);
|
||||
GtkWidget *focused = gtk_window_get_focus(gw->window);
|
||||
|
||||
/* If the url bar has focus, let gtk handle it */
|
||||
if (GTK_IS_EDITABLE (focused))
|
||||
gtk_editable_copy_clipboard(GTK_EDITABLE(gw->url_bar));
|
||||
else
|
||||
gui_copy_to_clipboard(bw->sel);
|
||||
}
|
||||
|
||||
MENUHANDLER(paste)
|
||||
{
|
||||
struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
|
||||
struct gui_window *gui = gw->top_level;
|
||||
GtkWidget *focused = gtk_window_get_focus(gw->window);
|
||||
|
||||
/* If the url bar has focus, let gtk handle it */
|
||||
if (GTK_IS_EDITABLE (focused))
|
||||
gtk_editable_paste_clipboard (GTK_EDITABLE (focused));
|
||||
else
|
||||
gui_paste_from_clipboard(gui, 0, 0);
|
||||
}
|
||||
|
||||
MENUHANDLER(select_all)
|
||||
{
|
||||
struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
|
||||
struct browser_window *bw = nsgtk_get_browser_for_gui(gw->top_level);
|
||||
|
||||
LOG(("Selecting all text"));
|
||||
selection_select_all(bw->sel);
|
||||
}
|
||||
|
||||
MENUHANDLER(preferences)
|
||||
{
|
||||
gtk_widget_show(GTK_WIDGET(wndPreferences));
|
||||
|
||||
struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
|
||||
struct browser_window *bw = nsgtk_get_browser_for_gui(gw->top_level);
|
||||
if (gw->preferences_dialog == NULL)
|
||||
gw->preferences_dialog = nsgtk_options_init(bw, gw->window);
|
||||
else
|
||||
gtk_widget_show (GTK_WIDGET(gw->preferences_dialog));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -492,8 +584,19 @@ MENUHANDLER(menu_bar)
|
||||
|
||||
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
|
||||
gtk_widget_show(GTK_WIDGET(gw->menu_bar));
|
||||
|
||||
gtk_widget_show_all(GTK_WIDGET(gw->popup_menu));
|
||||
GList *widgets = glade_xml_get_widget_prefix (gw->popup_xml, "menupopup");
|
||||
for (; widgets != NULL; widgets = widgets->next)
|
||||
gtk_widget_hide (GTK_WIDGET(widgets->data));
|
||||
} else {
|
||||
gtk_widget_hide(GTK_WIDGET(gw->menu_bar));
|
||||
|
||||
gtk_widget_hide_all(GTK_WIDGET(gw->popup_menu));
|
||||
gtk_widget_show(GTK_WIDGET(gw->popup_menu));
|
||||
GList *widgets = glade_xml_get_widget_prefix (gw->popup_xml, "menupopup");
|
||||
for (; widgets != NULL; widgets = widgets->next)
|
||||
gtk_widget_show_all (GTK_WIDGET(widgets->data));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -647,8 +750,8 @@ MENUHANDLER(global_history)
|
||||
|
||||
MENUHANDLER(about)
|
||||
{
|
||||
gtk_widget_show(GTK_WIDGET(wndAbout));
|
||||
gdk_window_raise(GTK_WIDGET(wndAbout)->window);
|
||||
struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
|
||||
nsgtk_about_dialog_init(gw->window, nsgtk_get_browser_for_gui(gw->top_level), netsurf_version);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -759,6 +862,7 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
|
||||
g->url_bar = GTK_ENTRY(GET_WIDGET("URLBar"));
|
||||
g->menu_bar = GTK_MENU_BAR(GET_WIDGET("menubar"));
|
||||
g->status_bar = GTK_LABEL(GET_WIDGET("statusBar"));
|
||||
g->edit_menu = GTK_MENU(GET_WIDGET("menumain_edit"));
|
||||
g->tool_bar = GTK_TOOLBAR(GET_WIDGET("toolbar"));
|
||||
g->back_button = GTK_TOOL_BUTTON(GET_WIDGET("toolBack"));
|
||||
g->forward_button = GTK_TOOL_BUTTON(GET_WIDGET("toolForward"));
|
||||
@ -770,6 +874,8 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
|
||||
g->reload_menu = GTK_MENU_ITEM(GET_WIDGET("reload"));
|
||||
g->throbber = GTK_IMAGE(GET_WIDGET("throbber"));
|
||||
g->status_pane = GTK_PANED(GET_WIDGET("hpaned1"));
|
||||
|
||||
g->preferences_dialog = NULL;
|
||||
|
||||
/* set this window's size and position to what's in the options, or
|
||||
* or some sensible default if they're not set yet.
|
||||
@ -860,7 +966,9 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
|
||||
/* connect signals to handlers. */
|
||||
CONNECT(g->window, "destroy", nsgtk_window_destroy_event, g);
|
||||
|
||||
/* toolbar and URL bar signal handlers */
|
||||
/* toolbar, URL bar, and menu bar signal handlers */
|
||||
CONNECT(g->edit_menu, "show", nsgtk_window_edit_menu_clicked, g);
|
||||
CONNECT(g->edit_menu, "hide", nsgtk_window_edit_menu_hidden, g);
|
||||
CONNECT(g->back_button, "clicked", nsgtk_window_back_button_clicked, g);
|
||||
CONNECT(g->forward_button, "clicked",
|
||||
nsgtk_window_forward_button_clicked, g);
|
||||
@ -883,6 +991,24 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
|
||||
g->popup_xml = glade_xml_new(glade_file_location, "menuPopup", NULL);
|
||||
g->popup_menu = GTK_MENU(glade_xml_get_widget(g->popup_xml, "menuPopup"));
|
||||
|
||||
/* TODO - find a way to add g->back, g->forward... directly to popup
|
||||
* menu instead of copying in glade. Use something like:
|
||||
* gtk_menu_shell_append (GTK_MENU_SHELL(g->popup_menu),
|
||||
* GTK_WIDGET(glade_xml_get_widget(g->xml, "back"))); */
|
||||
CONNECT(g->popup_menu, "hide", nsgtk_window_popup_menu_hidden, g);
|
||||
CONNECT(glade_xml_get_widget(g->popup_xml, "popupBack"), "activate",
|
||||
nsgtk_window_back_button_clicked, g);
|
||||
CONNECT(glade_xml_get_widget(g->popup_xml, "popupForward"),"activate",
|
||||
nsgtk_window_forward_button_clicked, g);
|
||||
CONNECT(glade_xml_get_widget(g->popup_xml, "popupReload"), "activate",
|
||||
nsgtk_window_reload_button_clicked, g);
|
||||
CONNECT(glade_xml_get_widget(g->popup_xml, "cut_popup"), "activate",
|
||||
nsgtk_on_cut_activate, g);
|
||||
CONNECT(glade_xml_get_widget(g->popup_xml, "copy_popup"), "activate",
|
||||
nsgtk_on_copy_activate, g);
|
||||
CONNECT(glade_xml_get_widget(g->popup_xml, "paste_popup"),"activate",
|
||||
nsgtk_on_paste_activate, g);
|
||||
|
||||
#define POPUP_ATTACH(x, y) gtk_menu_item_set_submenu( \
|
||||
GTK_MENU_ITEM(glade_xml_get_widget(g->popup_xml, x)),\
|
||||
GTK_WIDGET(glade_xml_get_widget(g->xml, y)))
|
||||
@ -894,7 +1020,11 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
|
||||
POPUP_ATTACH("menupopup_help", "menumain_help");
|
||||
|
||||
#undef POPUP_ATTACH
|
||||
|
||||
/* hides redundant popup menu items */
|
||||
GList *widgets = glade_xml_get_widget_prefix (g->popup_xml, "menupopup");
|
||||
for (; widgets != NULL; widgets = widgets->next)
|
||||
gtk_widget_hide (GTK_WIDGET(widgets->data));
|
||||
|
||||
/* finally, show the window. */
|
||||
gtk_widget_show(GTK_WIDGET(g->window));
|
||||
|
||||
@ -965,14 +1095,82 @@ void gui_window_stop_throbber(struct gui_window* _g)
|
||||
gtk_image_set_from_pixbuf(g->throbber, nsgtk_throbber->framedata[0]);
|
||||
}
|
||||
|
||||
gboolean nsgtk_scaffolding_is_busy(nsgtk_scaffolding *scaffold)
|
||||
gboolean nsgtk_scaffolding_is_busy(struct gtk_scaffolding *scaffold)
|
||||
{
|
||||
/* We are considered "busy" if the stop button is sensitive */
|
||||
return GTK_WIDGET_SENSITIVE((GTK_WIDGET(scaffold->stop_button)));
|
||||
}
|
||||
|
||||
void nsgtk_scaffolding_popup_menu(nsgtk_scaffolding *g, guint button)
|
||||
void nsgtk_scaffolding_popup_menu(struct gtk_scaffolding *g, guint button)
|
||||
{
|
||||
nsgtk_scaffolding_update_edit_actions_sensitivity(g, g->popup_xml, TRUE);
|
||||
gtk_menu_popup(g->popup_menu, NULL, NULL, NULL, NULL, 0,
|
||||
gtk_get_current_event_time());
|
||||
}
|
||||
|
||||
static void nsgtk_scaffolding_update_edit_actions_sensitivity
|
||||
(struct gtk_scaffolding *g, GladeXML *xml, gboolean hide)
|
||||
{
|
||||
GtkWidget *widget = gtk_window_get_focus(g->window);
|
||||
gboolean can_copy, can_cut, can_undo, can_redo, can_paste;
|
||||
gboolean has_selection;
|
||||
|
||||
if (GTK_IS_EDITABLE (widget))
|
||||
{
|
||||
has_selection = gtk_editable_get_selection_bounds
|
||||
(GTK_EDITABLE (widget), NULL, NULL);
|
||||
|
||||
can_copy = has_selection;
|
||||
can_cut = has_selection;
|
||||
can_paste = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct browser_window *bw = nsgtk_get_browser_for_gui(g->top_level);
|
||||
has_selection = bw->sel->defined;
|
||||
|
||||
can_copy = has_selection;
|
||||
/* Cut and Paste do not always register properly due to a bug
|
||||
* in the core selection code. */
|
||||
can_cut = (has_selection && bw->caret_callback != 0 );
|
||||
can_paste = (bw->paste_callback != 0);
|
||||
}
|
||||
widget = glade_xml_get_widget_prefix(xml, "copy")->data;
|
||||
gtk_widget_set_sensitive (widget, can_copy);
|
||||
if (hide && !can_copy)
|
||||
gtk_widget_hide(widget);
|
||||
widget = glade_xml_get_widget_prefix(xml, "cut")->data;
|
||||
gtk_widget_set_sensitive (widget, can_cut);
|
||||
if (hide && !can_cut)
|
||||
gtk_widget_hide(widget);
|
||||
widget = glade_xml_get_widget_prefix(xml, "paste")->data;
|
||||
gtk_widget_set_sensitive (widget, can_paste);
|
||||
if (hide && !can_paste)
|
||||
gtk_widget_hide(widget);
|
||||
|
||||
/* If its for the popup menu, handle seperator too */
|
||||
if (hide && !(can_paste || can_cut || can_copy)){
|
||||
widget = glade_xml_get_widget(xml, "separator");
|
||||
gtk_widget_hide(widget);
|
||||
}
|
||||
}
|
||||
|
||||
static void nsgtk_scaffolding_enable_edit_actions_sensitivity
|
||||
(struct gtk_scaffolding *g, GladeXML *xml)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = glade_xml_get_widget_prefix(xml, "copy")->data;
|
||||
gtk_widget_set_sensitive (widget, TRUE);
|
||||
gtk_widget_show(widget);
|
||||
widget = glade_xml_get_widget_prefix(xml, "cut")->data;
|
||||
gtk_widget_set_sensitive (widget, TRUE);
|
||||
gtk_widget_show(widget);
|
||||
widget = glade_xml_get_widget_prefix(xml, "paste")->data;
|
||||
gtk_widget_set_sensitive (widget, TRUE);
|
||||
gtk_widget_show(widget);
|
||||
|
||||
widget = glade_xml_get_widget(xml, "separator");
|
||||
gtk_widget_show(widget);
|
||||
}
|
||||
|
||||
|
97
gtk/gtk_selection.c
Normal file
97
gtk/gtk_selection.c
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright 2008 Mike Lester <element3260@gmail.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "utils/log.h"
|
||||
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/textinput.h"
|
||||
#include "desktop/selection.h"
|
||||
#include "desktop/browser.h"
|
||||
#include "gtk/gtk_selection.h"
|
||||
#include "gtk/gtk_window.h"
|
||||
|
||||
GString *current_selection;
|
||||
GtkClipboard *clipboard;
|
||||
|
||||
static bool copy_handler(const char *text, size_t length, struct box *box,
|
||||
void *handle, const char *whitespace_text,
|
||||
size_t whitespace_length);
|
||||
|
||||
|
||||
bool gui_add_to_clipboard(const char *text, size_t length, bool space)
|
||||
{
|
||||
/* add the text from this box */
|
||||
current_selection = g_string_append_len (current_selection,
|
||||
text, length);
|
||||
if (space) g_string_append (current_selection, " ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool copy_handler(const char *text, size_t length, struct box *box,
|
||||
void *handle, const char *whitespace_text,
|
||||
size_t whitespace_length)
|
||||
{
|
||||
/* add any whitespace which precedes the text from this box */
|
||||
if (whitespace_text) {
|
||||
if (!gui_add_to_clipboard(whitespace_text,
|
||||
whitespace_length, false)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/* add the text from this box */
|
||||
if (!gui_add_to_clipboard(text, length, box->space))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gui_copy_to_clipboard(struct selection *s)
|
||||
{
|
||||
current_selection = g_string_new(NULL);
|
||||
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
|
||||
if (s->defined && selection_traverse(s, copy_handler, NULL))
|
||||
gtk_clipboard_set_text (clipboard, current_selection->str, -1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void gui_start_selection(struct gui_window *g)
|
||||
{
|
||||
gtk_widget_grab_focus(GTK_WIDGET(g->drawing_area));
|
||||
}
|
||||
|
||||
void gui_paste_from_clipboard(struct gui_window *g, int x, int y)
|
||||
{
|
||||
char *text;
|
||||
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
|
||||
text = gtk_clipboard_wait_for_text (clipboard);
|
||||
if (text)
|
||||
browser_window_paste_text(g->bw, text,
|
||||
strlen(text), true);
|
||||
}
|
||||
|
||||
bool gui_empty_clipboard(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gui_commit_clipboard(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
25
gtk/gtk_selection.h
Normal file
25
gtk/gtk_selection.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2008 Mike Lester <element3260@gmail.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef GTK_SELECTION_H
|
||||
#define GTK_SELECTION_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "desktop/gui.h"
|
||||
|
||||
#endif
|
170
gtk/gtk_window.c
170
gtk/gtk_window.c
@ -22,6 +22,7 @@
|
||||
#include "desktop/browser.h"
|
||||
#include "desktop/options.h"
|
||||
#include "desktop/textinput.h"
|
||||
#include "desktop/selection.h"
|
||||
#include "gtk/gtk_gui.h"
|
||||
#include "gtk/gtk_scaffolding.h"
|
||||
#include "gtk/gtk_plotters.h"
|
||||
@ -32,34 +33,6 @@
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct gui_window {
|
||||
/* All gui_window objects have an ultimate scaffold */
|
||||
nsgtk_scaffolding *scaffold;
|
||||
/* A gui_window is the rendering of a browser_window */
|
||||
struct browser_window *bw;
|
||||
|
||||
/* These are the storage for the rendering */
|
||||
int caretx, carety, careth;
|
||||
gui_pointer_shape current_pointer;
|
||||
int last_x, last_y;
|
||||
|
||||
/* Within GTK, a gui_window is a scrolled window
|
||||
* with a viewport inside
|
||||
* with a gtkfixed in that
|
||||
* with a drawing area in that
|
||||
* The scrolled window is optional and only chosen
|
||||
* for frames which need it. Otherwise we just use
|
||||
* a viewport.
|
||||
*/
|
||||
GtkScrolledWindow *scrolledwindow;
|
||||
GtkViewport *viewport;
|
||||
GtkFixed *fixed;
|
||||
GtkDrawingArea *drawing_area;
|
||||
|
||||
/* Keep gui_windows in a list for cleanup later */
|
||||
struct gui_window *next, *prev;
|
||||
};
|
||||
|
||||
static struct gui_window *window_list = 0; /**< first entry in win list*/
|
||||
|
||||
static uint32_t gdkkey_to_nskey(GdkEventKey *);
|
||||
@ -72,10 +45,13 @@ static gboolean nsgtk_window_motion_notify_event(GtkWidget *, GdkEventMotion *,
|
||||
gpointer);
|
||||
static gboolean nsgtk_window_button_press_event(GtkWidget *, GdkEventButton *,
|
||||
gpointer);
|
||||
static gboolean nsgtk_window_button_release_event(GtkWidget *, GdkEventButton *,
|
||||
gpointer);
|
||||
static gboolean nsgtk_window_keypress_event(GtkWidget *, GdkEventKey *,
|
||||
gpointer);
|
||||
static gboolean nsgtk_window_size_allocate_event(GtkWidget *, GtkAllocation *,
|
||||
gpointer);
|
||||
|
||||
/* Other useful bits */
|
||||
static void nsgtk_redraw_caret(struct gui_window *g);
|
||||
|
||||
@ -117,6 +93,12 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
LOG(("Creating gui window %p for browser window %p", g, bw));
|
||||
|
||||
g->bw = bw;
|
||||
g->mouse = malloc(sizeof(*g->mouse));
|
||||
if (!g->mouse) {
|
||||
warn_user("NoMemory", 0);
|
||||
return 0;
|
||||
}
|
||||
g->mouse->state = 0;
|
||||
g->current_pointer = GUI_POINTER_DEFAULT;
|
||||
if (clone != NULL)
|
||||
bw->scale = clone->scale;
|
||||
@ -220,6 +202,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
GDK_EXPOSURE_MASK |
|
||||
GDK_LEAVE_NOTIFY_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_KEY_PRESS_MASK |
|
||||
GDK_KEY_RELEASE_MASK);
|
||||
@ -235,7 +218,9 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
CONNECT(g->drawing_area, "motion_notify_event",
|
||||
nsgtk_window_motion_notify_event, g);
|
||||
CONNECT(g->drawing_area, "button_press_event",
|
||||
nsgtk_window_button_press_event, g);
|
||||
nsgtk_window_button_press_event, g);
|
||||
CONNECT(g->drawing_area, "button_release_event",
|
||||
nsgtk_window_button_release_event, g);
|
||||
CONNECT(g->drawing_area, "key_press_event",
|
||||
nsgtk_window_keypress_event, g);
|
||||
CONNECT(g->viewport, "size_allocate",
|
||||
@ -314,6 +299,7 @@ gboolean nsgtk_window_expose_event(GtkWidget *widget,
|
||||
|
||||
plot = nsgtk_plotters;
|
||||
nsgtk_plot_set_scale(g->bw->scale);
|
||||
current_redraw_browser = g->bw;
|
||||
content_redraw(c, 0, 0,
|
||||
widget->allocation.width * scale,
|
||||
widget->allocation.height * scale,
|
||||
@ -322,7 +308,8 @@ gboolean nsgtk_window_expose_event(GtkWidget *widget,
|
||||
event->area.x + event->area.width,
|
||||
event->area.y + event->area.height,
|
||||
g->bw->scale, 0xFFFFFF);
|
||||
|
||||
current_redraw_browser = NULL;
|
||||
|
||||
if (g->careth != 0)
|
||||
nsgtk_plot_caret(g->caretx, g->carety, g->careth);
|
||||
|
||||
@ -338,10 +325,38 @@ gboolean nsgtk_window_motion_notify_event(GtkWidget *widget,
|
||||
GdkEventMotion *event, gpointer data)
|
||||
{
|
||||
struct gui_window *g = data;
|
||||
bool shift = event->state & GDK_SHIFT_MASK;
|
||||
bool ctrl = event->state & GDK_CONTROL_MASK;
|
||||
|
||||
browser_window_mouse_track(g->bw, 0, event->x / g->bw->scale,
|
||||
event->y / g->bw->scale);
|
||||
|
||||
if (g->mouse->state & BROWSER_MOUSE_PRESS_1){
|
||||
/* Start button 1 drag */
|
||||
browser_window_mouse_click(g->bw, BROWSER_MOUSE_DRAG_1,
|
||||
event->x / g->bw->scale,
|
||||
event->y / g->bw->scale);
|
||||
/* Replace PRESS with HOLDING and declare drag in progress */
|
||||
g->mouse->state ^= (BROWSER_MOUSE_PRESS_1 |
|
||||
BROWSER_MOUSE_HOLDING_1);
|
||||
g->mouse->state |= BROWSER_MOUSE_DRAG_ON;
|
||||
}
|
||||
else if (g->mouse->state & BROWSER_MOUSE_PRESS_2){
|
||||
/* Start button 2 drag */
|
||||
browser_window_mouse_click(g->bw, BROWSER_MOUSE_DRAG_2,
|
||||
event->x / g->bw->scale,
|
||||
event->y / g->bw->scale);
|
||||
/* Replace PRESS with HOLDING and declare drag in progress */
|
||||
g->mouse->state ^= (BROWSER_MOUSE_PRESS_2 |
|
||||
BROWSER_MOUSE_HOLDING_2);
|
||||
g->mouse->state |= BROWSER_MOUSE_DRAG_ON;
|
||||
}
|
||||
/* Handle modifiers being removed */
|
||||
if (g->mouse->state & BROWSER_MOUSE_MOD_1 && !shift)
|
||||
g->mouse->state ^= BROWSER_MOUSE_MOD_1;
|
||||
if (g->mouse->state & BROWSER_MOUSE_MOD_2 && !ctrl)
|
||||
g->mouse->state ^= BROWSER_MOUSE_MOD_2;
|
||||
|
||||
browser_window_mouse_track(g->bw, g->mouse->state,
|
||||
event->x / g->bw->scale, event->y / g->bw->scale);
|
||||
|
||||
g->last_x = event->x;
|
||||
g->last_y = event->y;
|
||||
|
||||
@ -352,23 +367,54 @@ gboolean nsgtk_window_button_press_event(GtkWidget *widget,
|
||||
GdkEventButton *event, gpointer data)
|
||||
{
|
||||
struct gui_window *g = data;
|
||||
int button = BROWSER_MOUSE_CLICK_1;
|
||||
|
||||
if (event->button == 2) /* 2 == middle button on X */
|
||||
button = BROWSER_MOUSE_CLICK_2;
|
||||
|
||||
if (event->button == 3) {
|
||||
/* 3 == right button on X */
|
||||
|
||||
if (event->button == 3){
|
||||
nsgtk_scaffolding_popup_menu(g->scaffold, event->button);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
switch (event->button) {
|
||||
case 1: g->mouse->state = BROWSER_MOUSE_PRESS_1; break;
|
||||
case 2: g->mouse->state = BROWSER_MOUSE_PRESS_2; break;
|
||||
}
|
||||
/* Handle the modifiers too */
|
||||
if (event->state & GDK_SHIFT_MASK)
|
||||
g->mouse->state |= BROWSER_MOUSE_MOD_1;
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
g->mouse->state |= BROWSER_MOUSE_MOD_2;
|
||||
|
||||
browser_window_mouse_click(g->bw, g->mouse->state, event->x / g->bw->scale,
|
||||
event->y / g->bw->scale);
|
||||
}
|
||||
|
||||
browser_window_mouse_click(g->bw, button,
|
||||
event->x / g->bw->scale,
|
||||
event->y / g->bw->scale);
|
||||
|
||||
gtk_widget_grab_focus(widget);
|
||||
|
||||
gboolean nsgtk_window_button_release_event(GtkWidget *widget,
|
||||
GdkEventButton *event, gpointer data)
|
||||
{
|
||||
int button;
|
||||
struct gui_window *g = data;
|
||||
bool shift = event->state & GDK_SHIFT_MASK;
|
||||
bool ctrl = event->state & GDK_CONTROL_MASK;
|
||||
|
||||
/* If the mouse state is PRESS then we are waiting for a release to emit
|
||||
* a click event, otherwise just reset the state to nothing*/
|
||||
if (g->mouse->state & BROWSER_MOUSE_PRESS_1)
|
||||
g->mouse->state ^= (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_CLICK_1);
|
||||
else if (g->mouse->state & BROWSER_MOUSE_PRESS_2)
|
||||
g->mouse->state ^= (BROWSER_MOUSE_PRESS_2 | BROWSER_MOUSE_CLICK_2);
|
||||
|
||||
/* Handle modifiers being removed */
|
||||
if (g->mouse->state & BROWSER_MOUSE_MOD_1 && !shift)
|
||||
g->mouse->state ^= BROWSER_MOUSE_MOD_1;
|
||||
if (g->mouse->state & BROWSER_MOUSE_MOD_2 && !ctrl)
|
||||
g->mouse->state ^= BROWSER_MOUSE_MOD_2;
|
||||
|
||||
if (g->mouse->state & (BROWSER_MOUSE_CLICK_1|BROWSER_MOUSE_CLICK_2))
|
||||
browser_window_mouse_click(g->bw, g->mouse->state, event->x / g->bw->scale,
|
||||
event->y / g->bw->scale);
|
||||
else
|
||||
browser_window_mouse_drag_end(g->bw, 0, event->x, event->y);
|
||||
|
||||
g->mouse->state = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -858,38 +904,6 @@ void gui_drag_save_selection(struct selection *s, struct gui_window *g)
|
||||
|
||||
}
|
||||
|
||||
void gui_start_selection(struct gui_window *g)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void gui_paste_from_clipboard(struct gui_window *g, int x, int y)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool gui_empty_clipboard(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gui_add_to_clipboard(const char *text, size_t length, bool space)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gui_commit_clipboard(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool gui_copy_to_clipboard(struct selection *s)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
|
||||
bool scaled)
|
||||
{
|
||||
|
@ -23,6 +23,45 @@
|
||||
#include "desktop/browser.h"
|
||||
#include "gtk/gtk_scaffolding.h"
|
||||
|
||||
struct gui_window {
|
||||
/* All gui_window objects have an ultimate scaffold */
|
||||
nsgtk_scaffolding *scaffold;
|
||||
/* A gui_window is the rendering of a browser_window */
|
||||
struct browser_window *bw;
|
||||
struct browser_mouse *mouse;
|
||||
|
||||
/* These are the storage for the rendering */
|
||||
int caretx, carety, careth;
|
||||
gui_pointer_shape current_pointer;
|
||||
int last_x, last_y;
|
||||
|
||||
/* Within GTK, a gui_window is a scrolled window
|
||||
* with a viewport inside
|
||||
* with a gtkfixed in that
|
||||
* with a drawing area in that
|
||||
* The scrolled window is optional and only chosen
|
||||
* for frames which need it. Otherwise we just use
|
||||
* a viewport.
|
||||
*/
|
||||
GtkScrolledWindow *scrolledwindow;
|
||||
GtkViewport *viewport;
|
||||
GtkFixed *fixed;
|
||||
GtkDrawingArea *drawing_area;
|
||||
|
||||
/* Keep gui_windows in a list for cleanup later */
|
||||
struct gui_window *next, *prev;
|
||||
};
|
||||
|
||||
struct browser_mouse {
|
||||
struct gui_window *gui;
|
||||
struct box *box;
|
||||
|
||||
gdouble pressed_x;
|
||||
gdouble pressed_y;
|
||||
gboolean waiting;
|
||||
browser_mouse_state state;
|
||||
};
|
||||
|
||||
void nsgtk_reflow_all_windows(void);
|
||||
void nsgtk_window_process_reformats(void);
|
||||
|
||||
|
332
gtk/res/license
Normal file
332
gtk/res/license
Normal file
@ -0,0 +1,332 @@
|
||||
The source code, documentation, translatable messages files and UI
|
||||
definitions contained within NetSurf are licensed under the following terms:
|
||||
|
||||
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.
|
||||
|
||||
In addition, as a special exception, permission is granted to link the
|
||||
code of this release of NetSurf with the OpenSSL project's "OpenSSL"
|
||||
library (or with modified versions of it that use the same licence as
|
||||
the "OpenSSL" library), and distribute the linked executables. You must
|
||||
obey the GNU General Public License version 2 in all respects for all of
|
||||
the code used other than "OpenSSL". If you modify the code, you may
|
||||
extend this exception to your version of the code, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this exception
|
||||
statement from your version.
|
||||
|
||||
All visual artwork contained within NetSurf is licensed under the terms of
|
||||
the MIT License.
|
||||
|
||||
The full text of the MIT and GPL licenses are provided in Annex A and
|
||||
Annex B of this document.
|
||||
|
||||
|
||||
Annex A: The MIT License
|
||||
------------------------
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
Annex B: The GNU General Public License
|
||||
---------------------------------------
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software
|
||||
interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the
|
||||
Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS
|
||||
NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
|
||||
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
|
||||
AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF
|
||||
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OFMERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU
|
||||
ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
|
||||
MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE
|
||||
TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
|
||||
THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
|
||||
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISE
|
||||
OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
File diff suppressed because it is too large
Load Diff
1520
gtk/res/options.glade
Normal file
1520
gtk/res/options.glade
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user