2003-06-30 16:44:03 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2006-11-26 23:11:20 +03:00
|
|
|
* Copyright 2006 James Bursa <bursa@users.sourceforge.net>
|
2004-07-27 00:13:45 +04:00
|
|
|
* Copyright 2004 Andrew Timmins <atimmins@blueyonder.co.uk>
|
2008-08-05 05:30:31 +04:00
|
|
|
* Copyright 2004 John Tytgat <joty@netsurf-browser.org>
|
2006-11-26 23:11:20 +03:00
|
|
|
* Copyright 2006 Richard Wilson <info@tinct.net>
|
2008-04-11 21:51:43 +04:00
|
|
|
* Copyright 2008 Michael Drake <tlsa@netsurf-browser.org>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-02-25 18:12:58 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Browser window creation and manipulation (implementation).
|
2002-09-11 18:24:02 +04:00
|
|
|
*/
|
|
|
|
|
2003-07-18 03:01:02 +04:00
|
|
|
#include <assert.h>
|
|
|
|
#include <limits.h>
|
2003-10-09 19:23:10 +04:00
|
|
|
#include <stdbool.h>
|
2005-08-21 16:04:18 +04:00
|
|
|
#include <stdint.h>
|
2003-07-18 03:01:02 +04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2008-08-11 20:44:12 +04:00
|
|
|
#include <strings.h>
|
2008-07-29 00:32:51 +04:00
|
|
|
#include <math.h>
|
2007-01-30 01:27:15 +03:00
|
|
|
#include <sys/select.h>
|
2006-10-01 22:10:55 +04:00
|
|
|
#include "curl/curl.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "utils/config.h"
|
|
|
|
#include "content/fetch.h"
|
|
|
|
#include "content/fetchcache.h"
|
|
|
|
#include "content/urldb.h"
|
|
|
|
#include "css/css.h"
|
|
|
|
#include "desktop/401login.h"
|
|
|
|
#include "desktop/browser.h"
|
|
|
|
#include "desktop/frames.h"
|
|
|
|
#include "desktop/history_core.h"
|
|
|
|
#include "desktop/gui.h"
|
|
|
|
#include "desktop/options.h"
|
|
|
|
#include "desktop/selection.h"
|
|
|
|
#include "desktop/textinput.h"
|
|
|
|
#include "render/box.h"
|
|
|
|
#include "render/form.h"
|
|
|
|
#include "render/font.h"
|
|
|
|
#include "render/imagemap.h"
|
|
|
|
#include "render/layout.h"
|
|
|
|
#include "render/textplain.h"
|
|
|
|
#include "utils/log.h"
|
|
|
|
#include "utils/messages.h"
|
|
|
|
#include "utils/talloc.h"
|
|
|
|
#include "utils/url.h"
|
|
|
|
#include "utils/utils.h"
|
|
|
|
#include "utils/utf8.h"
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
/** browser window which is being redrawn. Valid only during redraw. */
|
|
|
|
struct browser_window *current_redraw_browser;
|
|
|
|
|
2006-07-04 23:56:37 +04:00
|
|
|
/** fake content for <a> being saved as a link */
|
|
|
|
struct content browser_window_href_content;
|
|
|
|
|
2007-08-07 07:55:18 +04:00
|
|
|
/** one or more windows require a reformat */
|
|
|
|
bool browser_reformat_pending;
|
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
/** maximum frame depth */
|
|
|
|
#define FRAME_DEPTH 8
|
|
|
|
|
2007-01-27 23:58:20 +03:00
|
|
|
static void browser_window_go_post(struct browser_window *bw,
|
|
|
|
const char *url, char *post_urlenc,
|
|
|
|
struct form_successful_control *post_multipart,
|
2009-03-17 15:26:41 +03:00
|
|
|
bool add_to_history, const char *referer, bool download,
|
2007-02-03 02:08:13 +03:00
|
|
|
bool verifiable, const char *parent_url);
|
2004-02-25 18:12:58 +03:00
|
|
|
static void browser_window_callback(content_msg msg, struct content *c,
|
2005-08-21 16:04:18 +04:00
|
|
|
intptr_t p1, intptr_t p2, union content_msg_data data);
|
2006-01-25 09:52:38 +03:00
|
|
|
static void browser_window_refresh(void *p);
|
2006-09-02 19:52:41 +04:00
|
|
|
static bool browser_window_check_throbber(struct browser_window *bw);
|
2004-06-28 03:24:11 +04:00
|
|
|
static void browser_window_convert_to_download(struct browser_window *bw);
|
2004-02-25 18:12:58 +03:00
|
|
|
static void browser_window_start_throbber(struct browser_window *bw);
|
|
|
|
static void browser_window_stop_throbber(struct browser_window *bw);
|
|
|
|
static void browser_window_set_status(struct browser_window *bw,
|
|
|
|
const char *text);
|
2006-11-26 23:11:20 +03:00
|
|
|
static void browser_window_set_pointer(struct gui_window *g,
|
|
|
|
gui_pointer_shape shape);
|
2006-02-23 18:06:54 +03:00
|
|
|
static void download_window_callback(fetch_msg msg, void *p, const void *data,
|
2004-06-28 03:24:11 +04:00
|
|
|
unsigned long size);
|
2006-09-02 19:52:41 +04:00
|
|
|
static void browser_window_destroy_children(struct browser_window *bw);
|
|
|
|
static void browser_window_destroy_internal(struct browser_window *bw);
|
2006-11-26 23:11:20 +03:00
|
|
|
static void browser_window_set_scale_internal(struct browser_window *bw,
|
|
|
|
float scale);
|
|
|
|
static struct browser_window *browser_window_find_target(
|
2008-11-29 03:24:09 +03:00
|
|
|
struct browser_window *bw, const char *target,
|
|
|
|
browser_mouse_state mouse);
|
2006-11-26 23:11:20 +03:00
|
|
|
static void browser_window_find_target_internal(struct browser_window *bw,
|
|
|
|
const char *target, int depth, struct browser_window *page,
|
|
|
|
int *rdepth, struct browser_window **bw_target);
|
2005-04-15 09:52:25 +04:00
|
|
|
static void browser_window_mouse_action_html(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y);
|
2006-02-16 02:09:55 +03:00
|
|
|
static void browser_window_mouse_action_text(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y);
|
2005-04-15 09:52:25 +04:00
|
|
|
static void browser_window_mouse_track_html(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y);
|
2006-02-16 02:09:55 +03:00
|
|
|
static void browser_window_mouse_track_text(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y);
|
2004-11-20 03:02:56 +03:00
|
|
|
static const char *browser_window_scrollbar_click(struct browser_window *bw,
|
2005-04-15 09:52:25 +04:00
|
|
|
browser_mouse_state mouse, struct box *box,
|
2004-11-20 03:02:56 +03:00
|
|
|
int box_x, int box_y, int x, int y);
|
2004-07-18 21:38:01 +04:00
|
|
|
static void browser_radio_set(struct content *content,
|
|
|
|
struct form_control *radio);
|
2009-02-20 22:34:40 +03:00
|
|
|
static gui_pointer_shape get_pointer_shape(struct box *box, bool imagemap);
|
2008-04-11 19:52:56 +04:00
|
|
|
static bool browser_window_nearer_text_box(struct box *box, int bx, int by,
|
|
|
|
int x, int y, int dir, struct box **nearest, int *tx, int *ty,
|
|
|
|
int *nr_xd, int *nr_yd);
|
|
|
|
static bool browser_window_nearest_text_box(struct box *box, int bx, int by,
|
2008-04-11 21:51:43 +04:00
|
|
|
int fx, int fy, int x, int y, int dir, struct box **nearest,
|
2008-04-11 19:52:56 +04:00
|
|
|
int *tx, int *ty, int *nr_xd, int *nr_yd);
|
2005-04-15 09:52:25 +04:00
|
|
|
static struct box *browser_window_pick_text_box(struct browser_window *bw,
|
2008-04-11 21:51:43 +04:00
|
|
|
int x, int y, int dir, int *dx, int *dy);
|
2005-10-31 00:22:37 +03:00
|
|
|
static void browser_window_page_drag_start(struct browser_window *bw,
|
|
|
|
int x, int y);
|
|
|
|
static void browser_window_scroll_box(struct browser_window *bw,
|
|
|
|
struct box *box, int scroll_x, int scroll_y);
|
2005-07-21 03:27:28 +04:00
|
|
|
|
2003-02-09 15:58:15 +03:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/**
|
|
|
|
* Create and open a new browser window with the given page.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param url URL to start fetching in the new window (copied)
|
2005-01-03 05:09:20 +03:00
|
|
|
* \param clone The browser window to clone
|
2007-01-27 23:58:20 +03:00
|
|
|
* \param referer The referring uri (copied), or 0 if none
|
2004-02-25 18:12:58 +03:00
|
|
|
*/
|
2002-10-15 14:41:12 +04:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
struct browser_window *browser_window_create(const char *url,
|
|
|
|
struct browser_window *clone,
|
2009-04-05 23:17:24 +04:00
|
|
|
const char *referer, bool history_add, bool new_tab)
|
2002-10-15 14:41:12 +04:00
|
|
|
{
|
2004-02-25 18:12:58 +03:00
|
|
|
struct browser_window *bw;
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2009-04-05 23:17:24 +04:00
|
|
|
assert(clone || history_add);
|
2006-04-22 22:24:18 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
if ((bw = calloc(1, sizeof *bw)) == NULL) {
|
2004-05-07 23:14:54 +04:00
|
|
|
warn_user("NoMemory", 0);
|
2006-07-05 05:23:25 +04:00
|
|
|
return NULL;
|
2004-02-25 18:12:58 +03:00
|
|
|
}
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2007-08-07 11:58:04 +04:00
|
|
|
/* Initialise common parts */
|
|
|
|
browser_window_initialise_common(bw, clone);
|
2006-09-02 19:52:41 +04:00
|
|
|
|
|
|
|
/* window characteristics */
|
|
|
|
bw->browser_window_type = BROWSER_WINDOW_NORMAL;
|
2008-08-24 17:05:53 +04:00
|
|
|
bw->scrolling = SCROLLING_YES;
|
2006-09-02 19:52:41 +04:00
|
|
|
bw->border = true;
|
|
|
|
bw->no_resize = true;
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
/* gui window */
|
2008-08-24 14:31:38 +04:00
|
|
|
if ((bw->window = gui_create_browser_window(bw, clone, new_tab)) == NULL) {
|
2006-09-02 19:52:41 +04:00
|
|
|
browser_window_destroy(bw);
|
2006-07-05 05:23:25 +04:00
|
|
|
return NULL;
|
2004-02-25 18:12:58 +03:00
|
|
|
}
|
2006-07-05 05:23:25 +04:00
|
|
|
if (url)
|
2009-04-05 23:17:24 +04:00
|
|
|
browser_window_go(bw, url, referer, history_add);
|
2007-01-27 23:58:20 +03:00
|
|
|
|
2006-07-05 05:23:25 +04:00
|
|
|
return bw;
|
2002-09-11 18:24:02 +04:00
|
|
|
}
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2007-08-07 11:58:04 +04:00
|
|
|
/**
|
|
|
|
* Initialise common parts of a browser window
|
|
|
|
*
|
|
|
|
* \param bw The window to initialise
|
|
|
|
* \param clone The window to clone, or NULL if none
|
|
|
|
*/
|
|
|
|
void browser_window_initialise_common(struct browser_window *bw,
|
|
|
|
struct browser_window *clone)
|
|
|
|
{
|
|
|
|
assert(bw);
|
|
|
|
|
|
|
|
if (!clone)
|
|
|
|
bw->history = history_create();
|
|
|
|
else
|
|
|
|
bw->history = history_clone(clone->history);
|
|
|
|
|
|
|
|
/* window characteristics */
|
|
|
|
bw->sel = selection_create(bw);
|
|
|
|
bw->refresh_interval = -1;
|
|
|
|
|
|
|
|
bw->reformat_pending = false;
|
|
|
|
bw->drag_type = DRAGGING_NONE;
|
|
|
|
bw->scale = (float) option_scale / 100.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/**
|
|
|
|
* Start fetching a page in a browser window.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
|
|
|
* \param url URL to start fetching (copied)
|
2007-01-27 23:58:20 +03:00
|
|
|
* \param referer the referring uri (copied), or 0 if none
|
2004-02-25 18:12:58 +03:00
|
|
|
*
|
|
|
|
* Any existing fetches in the window are aborted.
|
|
|
|
*/
|
|
|
|
|
2004-10-01 04:06:49 +04:00
|
|
|
void browser_window_go(struct browser_window *bw, const char *url,
|
2009-04-05 23:17:24 +04:00
|
|
|
const char *referer, bool history_add)
|
2002-10-15 14:41:12 +04:00
|
|
|
{
|
2007-01-27 23:58:20 +03:00
|
|
|
/* All fetches passing through here are verifiable
|
|
|
|
* (i.e are the result of user action) */
|
2009-04-05 23:17:24 +04:00
|
|
|
browser_window_go_post(bw, url, 0, 0, history_add, referer,
|
2007-02-03 02:08:13 +03:00
|
|
|
false, true, referer);
|
2002-10-15 14:41:12 +04:00
|
|
|
}
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2009-01-30 08:07:07 +03:00
|
|
|
/**
|
|
|
|
* Start a download of the given URL from a browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \param url URL to start downloading (copied)
|
|
|
|
* \param referer the referring uri (copied), or 0 if none
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_download(struct browser_window *bw, const char *url,
|
|
|
|
const char *referrer)
|
|
|
|
{
|
|
|
|
browser_window_go_post(bw, url, 0, 0, false, referrer,
|
|
|
|
true, true, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-27 23:58:20 +03:00
|
|
|
/**
|
|
|
|
* Start fetching a page in a browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \param url URL to start fetching (copied)
|
|
|
|
* \param referer the referring uri (copied), or 0 if none
|
|
|
|
*
|
|
|
|
* Any existing fetches in the window are aborted.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_go_unverifiable(struct browser_window *bw,
|
2009-04-05 23:17:24 +04:00
|
|
|
const char *url, const char *referer, bool history_add)
|
2007-01-27 23:58:20 +03:00
|
|
|
{
|
|
|
|
/* All fetches passing through here are unverifiable
|
|
|
|
* (i.e are not the result of user action) */
|
2009-04-05 23:17:24 +04:00
|
|
|
browser_window_go_post(bw, url, 0, 0, history_add, referer,
|
2007-02-03 02:08:13 +03:00
|
|
|
false, false, referer);
|
2007-01-27 23:58:20 +03:00
|
|
|
}
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/**
|
|
|
|
* Start fetching a page in a browser window, POSTing form data.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
|
|
|
* \param url URL to start fetching (copied)
|
|
|
|
* \param post_urlenc url encoded post data, or 0 if none
|
2004-02-25 18:12:58 +03:00
|
|
|
* \param post_multipart multipart post data, or 0 if none
|
2009-03-17 15:26:41 +03:00
|
|
|
* \param add_to_history add to window history
|
2007-01-27 23:58:20 +03:00
|
|
|
* \param referer the referring uri (copied), or 0 if none
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param download download, rather than render the uri
|
2007-01-27 23:58:20 +03:00
|
|
|
* \param verifiable this transaction is verifiable
|
2007-02-03 02:08:13 +03:00
|
|
|
* \param parent_url URL of fetch which spawned this one (copied),
|
|
|
|
* or 0 if none
|
2004-02-25 18:12:58 +03:00
|
|
|
*
|
|
|
|
* Any existing fetches in the window are aborted.
|
|
|
|
*
|
|
|
|
* If post_urlenc and post_multipart are 0 the url is fetched using GET.
|
|
|
|
*
|
2009-03-24 01:22:30 +03:00
|
|
|
* The page is not added to the window history if add_to_history is false.
|
2009-03-17 15:26:41 +03:00
|
|
|
* This should be used when returning to a page in the window history.
|
2004-02-25 18:12:58 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_go_post(struct browser_window *bw, const char *url,
|
|
|
|
char *post_urlenc,
|
|
|
|
struct form_successful_control *post_multipart,
|
2009-03-17 15:26:41 +03:00
|
|
|
bool add_to_history, const char *referer, bool download,
|
2007-02-03 02:08:13 +03:00
|
|
|
bool verifiable, const char *parent_url)
|
2002-10-15 14:41:12 +04:00
|
|
|
{
|
2004-02-25 18:12:58 +03:00
|
|
|
struct content *c;
|
2004-03-10 23:45:27 +03:00
|
|
|
char *url2;
|
2008-02-03 15:04:48 +03:00
|
|
|
char *fragment;
|
2004-08-09 20:11:58 +04:00
|
|
|
url_func_result res;
|
2006-09-05 21:59:29 +04:00
|
|
|
int depth = 0;
|
|
|
|
struct browser_window *cur;
|
2006-09-07 02:15:58 +04:00
|
|
|
int width, height;
|
2004-06-11 03:55:23 +04:00
|
|
|
|
|
|
|
LOG(("bw %p, url %s", bw, url));
|
2006-03-25 23:30:35 +03:00
|
|
|
assert(bw);
|
|
|
|
assert(url);
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-05 21:59:29 +04:00
|
|
|
/* don't allow massively nested framesets */
|
|
|
|
for (cur = bw; cur->parent; cur = cur->parent)
|
|
|
|
depth++;
|
|
|
|
if (depth > FRAME_DEPTH) {
|
2007-01-27 23:58:20 +03:00
|
|
|
LOG(("frame depth too high."));
|
2006-09-05 21:59:29 +04:00
|
|
|
return;
|
|
|
|
}
|
2004-03-10 23:45:27 +03:00
|
|
|
|
2004-08-09 20:11:58 +04:00
|
|
|
res = url_normalize(url, &url2);
|
|
|
|
if (res != URL_FUNC_OK) {
|
2004-03-10 23:45:27 +03:00
|
|
|
LOG(("failed to normalize url %s", url));
|
|
|
|
return;
|
|
|
|
}
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2004-11-23 02:29:50 +03:00
|
|
|
/* check we can actually handle this URL */
|
|
|
|
if (!fetch_can_fetch(url2)) {
|
|
|
|
gui_launch_url(url2);
|
|
|
|
free(url2);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-02-03 15:04:48 +03:00
|
|
|
free(bw->frag_id);
|
|
|
|
bw->frag_id = NULL;
|
2006-10-01 22:10:55 +04:00
|
|
|
|
2008-02-03 15:04:48 +03:00
|
|
|
/* find any fragment identifier on end of URL */
|
|
|
|
res = url_fragment(url2, &fragment);
|
|
|
|
if (res == URL_FUNC_NOMEM) {
|
|
|
|
free(url2);
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
return;
|
|
|
|
} else if (res == URL_FUNC_OK) {
|
|
|
|
bool same_url = false;
|
|
|
|
|
|
|
|
bw->frag_id = fragment;
|
|
|
|
|
|
|
|
/* Compare new URL with existing one (ignoring fragments) */
|
|
|
|
if (bw->current_content && bw->current_content->url) {
|
2008-04-07 13:00:21 +04:00
|
|
|
res = url_compare(bw->current_content->url, url2,
|
2008-02-03 15:04:48 +03:00
|
|
|
true, &same_url);
|
|
|
|
if (res == URL_FUNC_NOMEM) {
|
|
|
|
free(url2);
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
return;
|
|
|
|
} else if (res == URL_FUNC_FAILED) {
|
|
|
|
same_url = false;
|
|
|
|
}
|
2006-10-01 22:10:55 +04:00
|
|
|
}
|
|
|
|
|
2005-03-20 06:35:50 +03:00
|
|
|
/* if we're simply moving to another ID on the same page,
|
2006-02-24 23:43:45 +03:00
|
|
|
* don't bother to fetch, just update the window.
|
2005-03-20 06:35:50 +03:00
|
|
|
*/
|
2008-04-07 13:00:21 +04:00
|
|
|
if (same_url && !post_urlenc && !post_multipart &&
|
2008-02-03 15:04:48 +03:00
|
|
|
!strchr(url2, '?')) {
|
2005-03-20 06:35:50 +03:00
|
|
|
free(url2);
|
2009-03-17 15:26:41 +03:00
|
|
|
if (add_to_history)
|
|
|
|
history_add(bw->history, bw->current_content,
|
|
|
|
bw->frag_id);
|
2009-04-05 23:17:24 +04:00
|
|
|
browser_window_update(bw, false);
|
2009-03-30 19:46:26 +04:00
|
|
|
if (bw->current_content) {
|
2009-03-31 15:06:09 +04:00
|
|
|
browser_window_refresh_url_bar(bw,
|
2009-03-30 19:46:26 +04:00
|
|
|
bw->current_content->url,
|
|
|
|
bw->frag_id);
|
|
|
|
}
|
2005-03-20 06:35:50 +03:00
|
|
|
return;
|
|
|
|
}
|
2004-08-07 02:19:13 +04:00
|
|
|
}
|
|
|
|
|
2005-03-21 02:42:23 +03:00
|
|
|
browser_window_stop(bw);
|
|
|
|
browser_window_remove_caret(bw);
|
2006-09-02 19:52:41 +04:00
|
|
|
browser_window_destroy_children(bw);
|
2005-03-21 02:42:23 +03:00
|
|
|
|
2006-09-07 02:15:58 +04:00
|
|
|
gui_window_get_dimensions(bw->window, &width, &height, true);
|
2007-01-03 18:15:54 +03:00
|
|
|
LOG(("Loading '%s' width %i, height %i", url2, width, height));
|
2006-09-07 02:15:58 +04:00
|
|
|
|
2004-02-27 20:45:19 +03:00
|
|
|
browser_window_set_status(bw, messages_get("Loading"));
|
2009-04-05 23:17:24 +04:00
|
|
|
bw->history_add = add_to_history;
|
2005-08-21 16:04:18 +04:00
|
|
|
c = fetchcache(url2, browser_window_callback, (intptr_t) bw, 0,
|
2006-09-07 02:15:58 +04:00
|
|
|
width, height, false,
|
2007-01-27 23:58:20 +03:00
|
|
|
post_urlenc, post_multipart, verifiable, download);
|
2004-03-10 23:45:27 +03:00
|
|
|
free(url2);
|
2004-02-25 18:12:58 +03:00
|
|
|
if (!c) {
|
2004-06-11 03:55:23 +04:00
|
|
|
browser_window_set_status(bw, messages_get("NoMemory"));
|
|
|
|
warn_user("NoMemory", 0);
|
2004-02-25 18:12:58 +03:00
|
|
|
return;
|
|
|
|
}
|
2004-08-07 02:19:13 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
bw->loading_content = c;
|
|
|
|
browser_window_start_throbber(bw);
|
|
|
|
|
2004-10-02 03:19:08 +04:00
|
|
|
if (referer && referer != bw->referer) {
|
|
|
|
free(bw->referer);
|
|
|
|
bw->referer = strdup(referer);
|
|
|
|
}
|
|
|
|
|
2005-01-03 05:09:20 +03:00
|
|
|
bw->download = download;
|
2007-01-27 23:58:20 +03:00
|
|
|
fetchcache_go(c, referer, browser_window_callback,
|
|
|
|
(intptr_t) bw, 0, width, height,
|
2007-02-03 02:08:13 +03:00
|
|
|
post_urlenc, post_multipart, verifiable, parent_url);
|
2002-09-11 18:24:02 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/**
|
|
|
|
* Callback for fetchcache() for browser window fetches.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_callback(content_msg msg, struct content *c,
|
2005-08-21 16:04:18 +04:00
|
|
|
intptr_t p1, intptr_t p2, union content_msg_data data)
|
2002-09-11 18:24:02 +04:00
|
|
|
{
|
2005-08-21 16:04:18 +04:00
|
|
|
struct browser_window *bw = (struct browser_window *) p1;
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
switch (msg) {
|
2006-11-26 23:11:20 +03:00
|
|
|
case CONTENT_MSG_LOADING:
|
|
|
|
assert(bw->loading_content == c);
|
2004-06-28 03:24:11 +04:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
if (c->type == CONTENT_OTHER)
|
|
|
|
browser_window_convert_to_download(bw);
|
2005-01-14 01:42:39 +03:00
|
|
|
#ifdef WITH_THEME_INSTALL
|
2006-11-26 23:11:20 +03:00
|
|
|
else if (c->type == CONTENT_THEME) {
|
|
|
|
theme_install_start(c);
|
|
|
|
bw->loading_content = 0;
|
|
|
|
content_remove_user(c, browser_window_callback,
|
|
|
|
(intptr_t) bw, 0);
|
|
|
|
browser_window_stop_throbber(bw);
|
|
|
|
}
|
2005-01-14 01:42:39 +03:00
|
|
|
#endif
|
2006-11-26 23:11:20 +03:00
|
|
|
else {
|
2009-03-30 19:46:26 +04:00
|
|
|
browser_window_refresh_url_bar(bw, c->url, bw->frag_id);
|
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
bw->refresh_interval = -1;
|
2007-01-13 03:21:15 +03:00
|
|
|
browser_window_set_status(bw, c->status_message);
|
2006-11-26 23:11:20 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CONTENT_MSG_READY:
|
|
|
|
assert(bw->loading_content == c);
|
|
|
|
|
|
|
|
if (bw->current_content) {
|
|
|
|
if (bw->current_content->status ==
|
|
|
|
CONTENT_STATUS_READY ||
|
|
|
|
bw->current_content->status ==
|
|
|
|
CONTENT_STATUS_DONE)
|
|
|
|
content_close(bw->current_content);
|
|
|
|
content_remove_user(bw->current_content,
|
|
|
|
browser_window_callback,
|
|
|
|
(intptr_t) bw, 0);
|
|
|
|
}
|
|
|
|
bw->current_content = c;
|
|
|
|
bw->loading_content = NULL;
|
|
|
|
browser_window_remove_caret(bw);
|
|
|
|
bw->scrolling_box = NULL;
|
|
|
|
gui_window_new_content(bw->window);
|
2009-03-30 19:46:26 +04:00
|
|
|
if (bw->current_content) {
|
2009-03-31 15:06:09 +04:00
|
|
|
browser_window_refresh_url_bar(bw,
|
2009-03-30 19:46:26 +04:00
|
|
|
bw->current_content->url,
|
|
|
|
bw->frag_id);
|
|
|
|
}
|
2009-04-08 15:07:30 +04:00
|
|
|
/* new content; set scroll_to_top */
|
|
|
|
browser_window_update(bw, true);
|
2006-11-26 23:11:20 +03:00
|
|
|
content_open(c, bw, 0, 0, 0, 0);
|
|
|
|
browser_window_set_status(bw, c->status_message);
|
|
|
|
|
|
|
|
/* history */
|
2009-04-05 23:17:24 +04:00
|
|
|
if (bw->history_add && bw->history) {
|
2006-11-26 23:11:20 +03:00
|
|
|
history_add(bw->history, c, bw->frag_id);
|
|
|
|
if (urldb_add_url(c->url)) {
|
|
|
|
urldb_set_url_title(c->url,
|
|
|
|
c->title ? c->title : c->url);
|
|
|
|
urldb_update_url_visit_data(c->url);
|
|
|
|
urldb_set_url_content_type(c->url,
|
|
|
|
c->type);
|
|
|
|
/* This is safe as we've just
|
|
|
|
* added the URL */
|
|
|
|
global_history_add(
|
|
|
|
urldb_get_url(c->url));
|
2006-02-16 02:09:55 +03:00
|
|
|
}
|
2006-11-26 23:11:20 +03:00
|
|
|
}
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
/* text selection */
|
|
|
|
if (c->type == CONTENT_HTML)
|
|
|
|
selection_init(bw->sel,
|
|
|
|
bw->current_content->data.html.layout);
|
|
|
|
if (c->type == CONTENT_TEXTPLAIN)
|
|
|
|
selection_init(bw->sel, NULL);
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
/* frames */
|
|
|
|
if (c->type == CONTENT_HTML && c->data.html.frameset)
|
|
|
|
browser_window_create_frameset(bw,
|
|
|
|
c->data.html.frameset);
|
|
|
|
if (c->type == CONTENT_HTML && c->data.html.iframe)
|
|
|
|
browser_window_create_iframes(bw, c->data.html.iframe);
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
break;
|
2003-12-22 01:10:15 +03:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
case CONTENT_MSG_DONE:
|
|
|
|
assert(bw->current_content == c);
|
|
|
|
|
2009-04-05 23:17:24 +04:00
|
|
|
browser_window_update(bw, false);
|
2007-01-13 03:21:15 +03:00
|
|
|
browser_window_set_status(bw, c->status_message);
|
2006-11-26 23:11:20 +03:00
|
|
|
browser_window_stop_throbber(bw);
|
|
|
|
history_update(bw->history, c);
|
|
|
|
hotlist_visited(c);
|
|
|
|
free(bw->referer);
|
|
|
|
bw->referer = 0;
|
|
|
|
if (bw->refresh_interval != -1)
|
|
|
|
schedule(bw->refresh_interval,
|
2006-11-27 00:04:42 +03:00
|
|
|
browser_window_refresh, bw);
|
2006-11-26 23:11:20 +03:00
|
|
|
break;
|
2003-12-22 01:10:15 +03:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
case CONTENT_MSG_ERROR:
|
|
|
|
browser_window_set_status(bw, data.error);
|
2007-03-12 01:08:57 +03:00
|
|
|
|
|
|
|
/* Only warn the user about errors in top-level windows */
|
|
|
|
if (bw->browser_window_type == BROWSER_WINDOW_NORMAL)
|
|
|
|
warn_user(data.error, 0);
|
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
if (c == bw->loading_content)
|
2004-02-25 18:12:58 +03:00
|
|
|
bw->loading_content = 0;
|
2006-11-26 23:11:20 +03:00
|
|
|
else if (c == bw->current_content) {
|
|
|
|
bw->current_content = 0;
|
|
|
|
browser_window_remove_caret(bw);
|
|
|
|
bw->scrolling_box = NULL;
|
|
|
|
selection_init(bw->sel, NULL);
|
|
|
|
}
|
|
|
|
browser_window_stop_throbber(bw);
|
|
|
|
free(bw->referer);
|
|
|
|
bw->referer = 0;
|
|
|
|
break;
|
2003-12-30 02:09:39 +03:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
case CONTENT_MSG_STATUS:
|
|
|
|
browser_window_set_status(bw, c->status_message);
|
|
|
|
break;
|
2003-12-30 02:09:39 +03:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
case CONTENT_MSG_REFORMAT:
|
|
|
|
if (c == bw->current_content &&
|
|
|
|
c->type == CONTENT_HTML) {
|
2007-01-03 18:15:54 +03:00
|
|
|
/* reposition frames */
|
|
|
|
if (c->data.html.frameset)
|
|
|
|
browser_window_recalculate_frameset(bw);
|
2007-01-27 23:58:20 +03:00
|
|
|
/* reflow iframe positions */
|
2006-12-30 05:10:46 +03:00
|
|
|
if (c->data.html.iframe)
|
|
|
|
browser_window_recalculate_iframes(bw);
|
2006-11-26 23:11:20 +03:00
|
|
|
/* box tree may have changed, need to relabel */
|
|
|
|
selection_reinit(bw->sel, c->data.html.layout);
|
|
|
|
}
|
|
|
|
if (bw->move_callback)
|
|
|
|
bw->move_callback(bw, bw->caret_p);
|
2009-04-05 23:17:24 +04:00
|
|
|
browser_window_update(bw, false);
|
2006-11-26 23:11:20 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CONTENT_MSG_REDRAW:
|
|
|
|
gui_window_update_box(bw->window, &data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CONTENT_MSG_NEWPTR:
|
|
|
|
bw->loading_content = c;
|
2008-02-03 15:04:48 +03:00
|
|
|
if (data.new_url) {
|
|
|
|
/* Replacement URL too, so check for new fragment */
|
|
|
|
char *fragment;
|
|
|
|
url_func_result res;
|
|
|
|
|
|
|
|
/* Remove any existing fragment */
|
|
|
|
free(bw->frag_id);
|
|
|
|
bw->frag_id = NULL;
|
|
|
|
|
|
|
|
/* Extract new one, if any */
|
|
|
|
res = url_fragment(data.new_url, &fragment);
|
|
|
|
if (res == URL_FUNC_OK) {
|
|
|
|
/* Save for later use */
|
|
|
|
bw->frag_id = fragment;
|
|
|
|
}
|
|
|
|
/* Ignore memory exhaustion here -- it'll simply result
|
|
|
|
* in the window being scrolled to the top rather than
|
|
|
|
* to the fragment. That's acceptable, given that it's
|
|
|
|
* likely that more important things will complain
|
|
|
|
* about memory shortage. */
|
|
|
|
}
|
2006-11-26 23:11:20 +03:00
|
|
|
break;
|
2004-08-11 23:02:32 +04:00
|
|
|
|
2008-04-19 15:07:42 +04:00
|
|
|
case CONTENT_MSG_LAUNCH:
|
|
|
|
assert(data.launch_url != NULL);
|
|
|
|
|
|
|
|
bw->loading_content = NULL;
|
|
|
|
|
|
|
|
gui_launch_url(data.launch_url);
|
|
|
|
|
|
|
|
browser_window_stop_throbber(bw);
|
|
|
|
free(bw->referer);
|
|
|
|
bw->referer = 0;
|
|
|
|
break;
|
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
case CONTENT_MSG_AUTH:
|
|
|
|
gui_401login_open(bw, c, data.auth_realm);
|
|
|
|
if (c == bw->loading_content)
|
|
|
|
bw->loading_content = 0;
|
|
|
|
else if (c == bw->current_content) {
|
|
|
|
bw->current_content = 0;
|
|
|
|
browser_window_remove_caret(bw);
|
|
|
|
bw->scrolling_box = NULL;
|
|
|
|
selection_init(bw->sel, NULL);
|
|
|
|
}
|
|
|
|
browser_window_stop_throbber(bw);
|
|
|
|
free(bw->referer);
|
|
|
|
bw->referer = 0;
|
|
|
|
break;
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
case CONTENT_MSG_SSL:
|
|
|
|
gui_cert_verify(bw, c, data.ssl.certs, data.ssl.num);
|
|
|
|
if (c == bw->loading_content)
|
|
|
|
bw->loading_content = 0;
|
|
|
|
else if (c == bw->current_content) {
|
|
|
|
bw->current_content = 0;
|
|
|
|
browser_window_remove_caret(bw);
|
|
|
|
bw->scrolling_box = NULL;
|
|
|
|
selection_init(bw->sel, NULL);
|
|
|
|
}
|
|
|
|
browser_window_stop_throbber(bw);
|
|
|
|
free(bw->referer);
|
|
|
|
bw->referer = 0;
|
|
|
|
break;
|
2006-02-23 18:06:54 +03:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
case CONTENT_MSG_REFRESH:
|
|
|
|
bw->refresh_interval = data.delay * 100;
|
|
|
|
break;
|
2006-01-25 09:52:38 +03:00
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
default:
|
|
|
|
assert(0);
|
2004-02-25 18:12:58 +03:00
|
|
|
}
|
2002-09-11 18:24:02 +04:00
|
|
|
}
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Transfer the loading_content to a new download window.
|
|
|
|
*/
|
|
|
|
|
2004-06-28 03:24:11 +04:00
|
|
|
void browser_window_convert_to_download(struct browser_window *bw)
|
2002-09-11 18:24:02 +04:00
|
|
|
{
|
2004-06-28 03:24:11 +04:00
|
|
|
struct gui_download_window *download_window;
|
2004-02-25 18:12:58 +03:00
|
|
|
struct content *c = bw->loading_content;
|
2004-06-28 03:24:11 +04:00
|
|
|
struct fetch *fetch;
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
assert(c);
|
|
|
|
|
2004-06-28 03:24:11 +04:00
|
|
|
fetch = c->fetch;
|
|
|
|
|
|
|
|
if (fetch) {
|
|
|
|
/* create download window */
|
|
|
|
download_window = gui_download_window_create(c->url,
|
2008-08-24 17:05:53 +04:00
|
|
|
c->mime_type, fetch, c->total_size,
|
Merged revisions 4282-4285,4288-4293,4297-4298,4307,4309-4313,4322,4324-4680 via svnmerge from
svn://svn.netsurf-browser.org/branches/mikeL/netsurf
........
r4432 | mikeL | 2008-06-24 04:00:36 +0100 (Tue, 24 Jun 2008) | 1 line
Drag events are now emited from where the press originated, instead of from where they became a drag
........
r4433 | mikeL | 2008-06-24 04:25:33 +0100 (Tue, 24 Jun 2008) | 1 line
Added accelerator to 'Select All'
........
r4495 | mikeL | 2008-07-02 21:36:32 +0100 (Wed, 02 Jul 2008) | 1 line
Selections are now deleted and replaced when a key is typed in a text area or text box. All input box behavior while a selection is active is now implemented (ex: pressing the right arrow key moves the caret to the end of the selection). Cut now works properly in both versions. Fixed discrepancy between where the caret was placed and selection began when starting a drag-select. Fixed bug with calculation of a selections end box.
........
r4496 | mikeL | 2008-07-02 22:11:24 +0100 (Wed, 02 Jul 2008) | 1 line
Added support for cut in input boxes
........
r4497 | mikeL | 2008-07-02 22:21:35 +0100 (Wed, 02 Jul 2008) | 1 line
Removed unused variables (Thanks tlsa)
........
r4498 | mikeL | 2008-07-02 23:30:30 +0100 (Wed, 02 Jul 2008) | 1 line
Modified selection clearing behavior to allow for drag-saves
........
r4499 | mikeL | 2008-07-03 00:51:50 +0100 (Thu, 03 Jul 2008) | 1 line
Fixed regression where it would take two clicks to place caret in an input (Thanks tlsa)
........
r4509 | mikeL | 2008-07-06 07:55:09 +0100 (Sun, 06 Jul 2008) | 1 line
Basic download support implemented. Only downloading of text files works
........
r4510 | mikeL | 2008-07-06 18:55:31 +0100 (Sun, 06 Jul 2008) | 1 line
Downloading of non-text files is now possible. Progress bar and size downloaded are now updated
........
r4511 | mikeL | 2008-07-06 20:46:00 +0100 (Sun, 06 Jul 2008) | 1 line
Added downloads glade file
........
r4512 | mikeL | 2008-07-06 20:47:39 +0100 (Sun, 06 Jul 2008) | 1 line
Downloads window now spawns in the center of the parent browser window
........
r4513 | mikeL | 2008-07-06 20:56:12 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed bug where backspace would be ignored if the selection began at the beginning on an input
........
r4514 | mikeL | 2008-07-06 21:26:45 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed compiler warnings by adding casts
........
r4516 | mikeL | 2008-07-06 21:32:41 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed initialization of size string, added initialization of progress
........
r4518 | mikeL | 2008-07-06 21:51:08 +0100 (Sun, 06 Jul 2008) | 1 line
Added an option for short units (with space) to human_friendly_bytesize
........
r4519 | mikeL | 2008-07-06 21:52:05 +0100 (Sun, 06 Jul 2008) | 1 line
Removed function size_to_string
........
r4520 | mikeL | 2008-07-06 22:03:11 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed pedantic error (kB instead of KB). Added missing necessary parameters to human_friendly_bytesize. Fixed incorrect bool types
........
r4521 | mikeL | 2008-07-06 22:08:15 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnecessary parameter and units list from human_friendly_bytesize
........
r4522 | mikeL | 2008-07-06 22:57:03 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnused variable
........
r4523 | mikeL | 2008-07-06 23:03:46 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed url parsing by replacing url_parse_filename with url_nice. Total size and size downloaded are now in human readable form. Speed is now calculated (roughly)
........
r4524 | mikeL | 2008-07-07 01:19:01 +0100 (Mon, 07 Jul 2008) | 1 line
Added file overwrite confirmation. Changed speed to a double
........
r4546 | mikeL | 2008-07-09 17:21:43 +0100 (Wed, 09 Jul 2008) | 1 line
Changed parameter of selection_get_end/start to a size_t instead of int and changed all offset variables to size_t as well
........
r4547 | mikeL | 2008-07-09 17:30:47 +0100 (Wed, 09 Jul 2008) | 1 line
Added action buttons to the bottom toolbar. Added ability to clear selected (and completed) downloads with a framework for other actions.
........
r4556 | jmb | 2008-07-10 00:17:24 +0100 (Thu, 10 Jul 2008) | 3 lines
A large bunch of tidying and general fixes to text input handling.
Make selection code treat password fields as inputs, too.
........
r4557 | mikeL | 2008-07-10 00:24:46 +0100 (Thu, 10 Jul 2008) | 1 line
Added functionality to gui_empty_clipboard and gui_start_selection (Thanks jmb)
........
r4573 | mikeL | 2008-07-10 16:33:27 +0100 (Thu, 10 Jul 2008) | 1 line
Removed example download. Made the list store row aware of its download and vise versa. Added new way of handling actions from the dialog (e.g. buttons) which handles all rows in the selection. Added a few memory management function calls to clean up better
........
r4577 | mikeL | 2008-07-10 21:11:51 +0100 (Thu, 10 Jul 2008) | 1 line
Download write channels now close properly. Added status column to the tree store which will change the progress bar text if a download is canceled or completed. Implemented cancel button functionality.
........
r4578 | mikeL | 2008-07-10 21:17:51 +0100 (Thu, 10 Jul 2008) | 1 line
Speed is now displayed as '-' when 0 or download has stopped
........
r4580 | mikeL | 2008-07-11 02:10:57 +0100 (Fri, 11 Jul 2008) | 1 line
Added two download related options (Download directory & Clear completed downloads) and a Downloads tab to the preferences dialog. Also moved the option to ask when overwriting files to Downloads tab. Added another option to the pre-download dialog, Save, which downloads the file immediately to your 'Download directory'
........
r4581 | mikeL | 2008-07-11 02:26:00 +0100 (Fri, 11 Jul 2008) | 1 line
Rearranged pre-download dialog buttons to conform to the HIG
........
r4616 | mikeL | 2008-07-11 19:54:12 +0100 (Fri, 11 Jul 2008) | 1 line
Limited download window updates to a user-defined variable that can be set in options (default is .5). Updates are now only done if the download window is visible. This greatly reduces the cpu usage.
........
r4617 | mikeL | 2008-07-11 20:07:48 +0100 (Fri, 11 Jul 2008) | 1 line
Removed unnecessary update limit option (it is now fixed at .5)
........
r4629 | mikeL | 2008-07-13 04:21:07 +0100 (Sun, 13 Jul 2008) | 1 line
Reorganized button sensitivity functions. Sensitivities are now updated when the selection changes as well as when a selected download's state changes.
........
r4635 | mikeL | 2008-07-13 17:00:05 +0100 (Sun, 13 Jul 2008) | 1 line
Added error handling. Added word-wrap to the "info" cell renderer so that to keep everything under control. Fixed bug where downloads would always go to you default folder (missing breaks).
........
r4642 | mikeL | 2008-07-13 21:46:09 +0100 (Sun, 13 Jul 2008) | 1 line
Added time remaining column. Fixed regression where the download info would be erased upon completion/cancelation.
........
r4655 | mikeL | 2008-07-14 23:20:33 +0100 (Mon, 14 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. When it is closed (when NS shuts down) all incomplete downloads are canceled (and the files deleted). Added a warning dialog when netsurf tries to close with incomplete downloads. Fixed bug where default save directory would initialize to NULL.
........
r4676 | mikeL | 2008-07-15 21:01:17 +0100 (Tue, 15 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. (This is the second half of the patch, last commit was only partial for some reason)
........
r4678 | mikeL | 2008-07-16 01:18:52 +0100 (Wed, 16 Jul 2008) | 1 line
Addresses almost all of rjek and jmb's concerns, fixes most of the sloppiness that was present earlier. Downloads without a total_size are now handled correctly (thanks tlsa). Changes to the default download directly are now saved correctly. Billions of other small bugs fixed
........
svn path=/trunk/netsurf/; revision=4681
2008-07-16 14:19:30 +04:00
|
|
|
bw->window);
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2004-06-28 03:24:11 +04:00
|
|
|
if (download_window) {
|
|
|
|
/* extract fetch from content */
|
|
|
|
c->fetch = 0;
|
|
|
|
c->fresh = false;
|
|
|
|
fetch_change_callback(fetch, download_window_callback,
|
|
|
|
download_window);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* must already be a download window for this fetch */
|
|
|
|
/** \todo open it at top of stack */
|
|
|
|
}
|
2004-02-25 18:12:58 +03:00
|
|
|
|
|
|
|
/* remove content from browser window */
|
|
|
|
bw->loading_content = 0;
|
2005-08-21 16:04:18 +04:00
|
|
|
content_remove_user(c, browser_window_callback, (intptr_t) bw, 0);
|
2004-02-25 18:12:58 +03:00
|
|
|
browser_window_stop_throbber(bw);
|
2002-09-11 18:24:02 +04:00
|
|
|
}
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2006-11-27 00:04:42 +03:00
|
|
|
/**
|
|
|
|
* Handle meta http-equiv refresh time elapsing by loading a new page.
|
|
|
|
*
|
|
|
|
* \param p browser window to refresh with new page
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_refresh(void *p)
|
|
|
|
{
|
|
|
|
struct browser_window *bw = p;
|
2009-04-05 23:17:24 +04:00
|
|
|
bool history_add = true;
|
2006-11-27 00:04:42 +03:00
|
|
|
|
2008-02-27 21:38:41 +03:00
|
|
|
assert(bw->current_content &&
|
|
|
|
(bw->current_content->status == CONTENT_STATUS_READY ||
|
|
|
|
bw->current_content->status == CONTENT_STATUS_DONE));
|
|
|
|
|
2008-04-07 13:00:21 +04:00
|
|
|
/* Ignore if the refresh URL has gone
|
2008-02-27 21:38:41 +03:00
|
|
|
* (may happen if a fetch error occurred) */
|
|
|
|
if (!bw->current_content->refresh)
|
|
|
|
return;
|
2006-11-27 00:04:42 +03:00
|
|
|
|
|
|
|
/* mark this content as invalid so it gets flushed from the cache */
|
|
|
|
bw->current_content->fresh = false;
|
|
|
|
|
|
|
|
if ((bw->current_content->url) &&
|
|
|
|
(bw->current_content->refresh) &&
|
|
|
|
(!strcmp(bw->current_content->url,
|
|
|
|
bw->current_content->refresh)))
|
2009-04-05 23:17:24 +04:00
|
|
|
history_add = false;
|
2006-11-27 00:04:42 +03:00
|
|
|
|
2009-03-10 12:10:43 +03:00
|
|
|
/* Treat an (almost) immediate refresh in a top-level browser window as
|
2009-03-24 01:22:30 +03:00
|
|
|
* if it were an HTTP redirect, and thus make the resulting fetch
|
2009-03-10 12:10:43 +03:00
|
|
|
* verifiable.
|
|
|
|
*
|
|
|
|
* See fetchcache.c for why redirected fetches should be verifiable at
|
|
|
|
* all.
|
|
|
|
*/
|
2009-03-10 12:14:25 +03:00
|
|
|
if (bw->refresh_interval <= 100 && bw->parent == NULL) {
|
2009-03-10 12:10:43 +03:00
|
|
|
browser_window_go(bw, bw->current_content->refresh,
|
2009-04-05 23:17:24 +04:00
|
|
|
bw->current_content->url, history_add);
|
2009-03-10 12:10:43 +03:00
|
|
|
} else {
|
|
|
|
browser_window_go_unverifiable(bw, bw->current_content->refresh,
|
2009-04-05 23:17:24 +04:00
|
|
|
bw->current_content->url, history_add);
|
2009-03-10 12:10:43 +03:00
|
|
|
}
|
2006-11-27 00:04:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/**
|
|
|
|
* Start the busy indicator.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_start_throbber(struct browser_window *bw)
|
2002-09-11 18:24:02 +04:00
|
|
|
{
|
2004-02-25 18:12:58 +03:00
|
|
|
bw->throbbing = true;
|
2006-09-02 19:52:41 +04:00
|
|
|
|
|
|
|
while (bw->parent)
|
|
|
|
bw = bw->parent;
|
2004-02-25 18:12:58 +03:00
|
|
|
gui_window_start_throbber(bw->window);
|
|
|
|
}
|
2003-12-22 01:10:15 +03:00
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/**
|
|
|
|
* Stop the busy indicator.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
*/
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
void browser_window_stop_throbber(struct browser_window *bw)
|
|
|
|
{
|
|
|
|
bw->throbbing = false;
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
while (bw->parent)
|
|
|
|
bw = bw->parent;
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
if (!browser_window_check_throbber(bw))
|
|
|
|
gui_window_stop_throbber(bw->window);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool browser_window_check_throbber(struct browser_window *bw)
|
|
|
|
{
|
|
|
|
int children, index;
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
if (bw->throbbing)
|
|
|
|
return true;
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
if (bw->children) {
|
|
|
|
children = bw->rows * bw->cols;
|
|
|
|
for (index = 0; index < children; index++) {
|
|
|
|
if (browser_window_check_throbber(&bw->children[index]))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bw->iframes) {
|
|
|
|
for (index = 0; index < bw->iframe_count; index++) {
|
|
|
|
if (browser_window_check_throbber(&bw->iframes[index]))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2004-02-25 18:12:58 +03:00
|
|
|
}
|
2004-01-05 05:10:59 +03:00
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/**
|
|
|
|
* Redraw browser window, set extent to content, and update title.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser_window
|
2004-02-25 18:12:58 +03:00
|
|
|
* \param scroll_to_top move view to top of page
|
|
|
|
*/
|
2004-01-05 05:10:59 +03:00
|
|
|
|
2009-04-05 23:17:24 +04:00
|
|
|
void browser_window_update(struct browser_window *bw,
|
|
|
|
bool scroll_to_top)
|
2004-02-25 18:12:58 +03:00
|
|
|
{
|
2004-08-07 02:19:13 +04:00
|
|
|
struct box *pos;
|
2009-04-05 23:17:24 +04:00
|
|
|
int x, y;
|
2004-07-06 00:19:52 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
if (!bw->current_content)
|
|
|
|
return;
|
2004-01-05 05:10:59 +03:00
|
|
|
|
2005-06-08 01:29:26 +04:00
|
|
|
if (bw->current_content->title != NULL) {
|
2005-07-16 18:35:25 +04:00
|
|
|
gui_window_set_title(bw->window, bw->current_content->title);
|
2004-07-06 00:19:52 +04:00
|
|
|
} else
|
2004-02-25 18:12:58 +03:00
|
|
|
gui_window_set_title(bw->window, bw->current_content->url);
|
2004-01-05 05:10:59 +03:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
gui_window_update_extent(bw->window);
|
2004-01-05 05:10:59 +03:00
|
|
|
|
2009-04-05 23:17:24 +04:00
|
|
|
if (scroll_to_top)
|
|
|
|
gui_window_set_scroll(bw->window, 0, 0);
|
2009-03-24 01:22:30 +03:00
|
|
|
|
2009-04-05 23:17:24 +04:00
|
|
|
/** \todo don't do this if the user has scrolled */
|
2004-08-07 02:19:13 +04:00
|
|
|
/* if frag_id exists, then try to scroll to it */
|
2009-04-05 23:17:24 +04:00
|
|
|
if (bw->frag_id && bw->current_content->type == CONTENT_HTML) {
|
2009-03-31 15:06:09 +04:00
|
|
|
if ((pos = box_find_by_id(bw->current_content->data.html.layout,
|
|
|
|
bw->frag_id)) != 0) {
|
2004-08-07 02:19:13 +04:00
|
|
|
box_coords(pos, &x, &y);
|
|
|
|
gui_window_set_scroll(bw->window, x, y);
|
|
|
|
}
|
2009-04-05 23:17:24 +04:00
|
|
|
}
|
2004-08-07 02:19:13 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
gui_window_redraw_window(bw->window);
|
2002-09-11 18:24:02 +04:00
|
|
|
}
|
|
|
|
|
2002-12-23 23:06:21 +03:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/**
|
|
|
|
* Stop all fetching activity in a browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
*/
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
void browser_window_stop(struct browser_window *bw)
|
|
|
|
{
|
2006-09-02 19:52:41 +04:00
|
|
|
int children, index;
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
if (bw->loading_content) {
|
|
|
|
content_remove_user(bw->loading_content,
|
2005-08-21 16:04:18 +04:00
|
|
|
browser_window_callback, (intptr_t) bw, 0);
|
2004-02-25 18:12:58 +03:00
|
|
|
bw->loading_content = 0;
|
|
|
|
}
|
2003-12-28 19:17:31 +03:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
if (bw->current_content &&
|
|
|
|
bw->current_content->status != CONTENT_STATUS_DONE) {
|
|
|
|
assert(bw->current_content->status == CONTENT_STATUS_READY);
|
2004-06-21 03:09:52 +04:00
|
|
|
content_stop(bw->current_content,
|
2005-08-21 16:04:18 +04:00
|
|
|
browser_window_callback, (intptr_t) bw, 0);
|
2004-02-25 18:12:58 +03:00
|
|
|
}
|
2003-12-22 01:10:15 +03:00
|
|
|
|
2006-01-25 11:25:38 +03:00
|
|
|
schedule_remove(browser_window_refresh, bw);
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
if (bw->children) {
|
|
|
|
children = bw->rows * bw->cols;
|
|
|
|
for (index = 0; index < children; index++)
|
|
|
|
browser_window_stop(&bw->children[index]);
|
|
|
|
}
|
|
|
|
if (bw->iframes) {
|
|
|
|
children = bw->iframe_count;
|
|
|
|
for (index = 0; index < children; index++)
|
|
|
|
browser_window_stop(&bw->iframes[index]);
|
|
|
|
}
|
2006-01-25 11:25:38 +03:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
browser_window_stop_throbber(bw);
|
|
|
|
}
|
2003-10-25 23:20:13 +04:00
|
|
|
|
|
|
|
|
2004-06-23 00:39:16 +04:00
|
|
|
/**
|
|
|
|
* Reload the page in a browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
2004-06-29 23:08:19 +04:00
|
|
|
* \param all whether to reload all objects associated with the page
|
2004-06-23 00:39:16 +04:00
|
|
|
*/
|
|
|
|
|
2004-06-29 23:08:19 +04:00
|
|
|
void browser_window_reload(struct browser_window *bw, bool all)
|
2004-06-23 00:39:16 +04:00
|
|
|
{
|
2004-06-29 23:08:19 +04:00
|
|
|
struct content *c;
|
|
|
|
unsigned int i;
|
|
|
|
|
2004-06-23 00:39:16 +04:00
|
|
|
if (!bw->current_content || bw->loading_content)
|
|
|
|
return;
|
|
|
|
|
2004-06-29 23:08:19 +04:00
|
|
|
if (all && bw->current_content->type == CONTENT_HTML) {
|
|
|
|
c = bw->current_content;
|
|
|
|
/* invalidate objects */
|
2005-10-31 00:22:37 +03:00
|
|
|
for (i = 0; i != c->data.html.object_count; i++) {
|
|
|
|
if (c->data.html.object[i].content)
|
2004-06-29 23:08:19 +04:00
|
|
|
c->data.html.object[i].content->fresh = false;
|
|
|
|
}
|
|
|
|
/* invalidate stylesheets */
|
2005-10-31 00:22:37 +03:00
|
|
|
for (i = STYLESHEET_START; i != c->data.html.stylesheet_count;
|
|
|
|
i++) {
|
|
|
|
if (c->data.html.stylesheet_content[i])
|
|
|
|
c->data.html.stylesheet_content[i]->fresh =
|
|
|
|
false;
|
2004-06-29 23:08:19 +04:00
|
|
|
}
|
|
|
|
}
|
2004-06-23 00:39:16 +04:00
|
|
|
bw->current_content->fresh = false;
|
2005-01-03 05:09:20 +03:00
|
|
|
browser_window_go_post(bw, bw->current_content->url, 0, 0,
|
2007-02-03 02:08:13 +03:00
|
|
|
false, 0, false, true, 0);
|
2004-06-23 00:39:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/**
|
|
|
|
* Change the status bar of a browser window.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
2004-02-25 18:12:58 +03:00
|
|
|
* \param text new status text (copied)
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_set_status(struct browser_window *bw, const char *text)
|
|
|
|
{
|
2006-09-02 19:52:41 +04:00
|
|
|
while (bw->parent)
|
|
|
|
bw = bw->parent;
|
2004-02-25 18:12:58 +03:00
|
|
|
gui_window_set_status(bw->window, text);
|
2002-09-11 18:24:02 +04:00
|
|
|
}
|
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
|
2004-04-01 04:26:05 +04:00
|
|
|
/**
|
|
|
|
* Change the shape of the mouse pointer
|
|
|
|
*
|
|
|
|
* \param shape shape to use
|
|
|
|
*/
|
|
|
|
|
2006-03-10 12:09:03 +03:00
|
|
|
void browser_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
|
2004-04-01 04:26:05 +04:00
|
|
|
{
|
2006-03-10 12:09:03 +03:00
|
|
|
gui_window_set_pointer(g, shape);
|
2004-04-01 04:26:05 +04:00
|
|
|
}
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Close and destroy a browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_destroy(struct browser_window *bw)
|
2003-10-25 18:13:49 +04:00
|
|
|
{
|
2006-09-02 19:52:41 +04:00
|
|
|
/* can't destoy child windows on their own */
|
|
|
|
assert(!bw->parent);
|
|
|
|
|
|
|
|
/* destroy */
|
|
|
|
browser_window_destroy_internal(bw);
|
|
|
|
free(bw);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Close and destroy all child browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_destroy_children(struct browser_window *bw)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (bw->children) {
|
|
|
|
for (i = 0; i < (bw->rows * bw->cols); i++)
|
|
|
|
browser_window_destroy_internal(&bw->children[i]);
|
|
|
|
free(bw->children);
|
|
|
|
bw->children = NULL;
|
|
|
|
bw->rows = 0;
|
|
|
|
bw->cols = 0;
|
|
|
|
}
|
|
|
|
if (bw->iframes) {
|
|
|
|
for (i = 0; i < bw->iframe_count; i++)
|
|
|
|
browser_window_destroy_internal(&bw->iframes[i]);
|
|
|
|
free(bw->iframes);
|
|
|
|
bw->iframes = NULL;
|
|
|
|
bw->iframe_count = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Release all memory associated with a browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_destroy_internal(struct browser_window *bw)
|
|
|
|
{
|
|
|
|
assert(bw);
|
|
|
|
|
2006-12-30 03:34:26 +03:00
|
|
|
LOG(("Destroying window"));
|
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
if ((bw->children) || (bw->iframes))
|
|
|
|
browser_window_destroy_children(bw);
|
2004-02-25 18:12:58 +03:00
|
|
|
if (bw->loading_content) {
|
|
|
|
content_remove_user(bw->loading_content,
|
2005-08-21 16:04:18 +04:00
|
|
|
browser_window_callback, (intptr_t) bw, 0);
|
2004-02-25 18:12:58 +03:00
|
|
|
bw->loading_content = 0;
|
|
|
|
}
|
|
|
|
if (bw->current_content) {
|
2004-08-12 02:08:26 +04:00
|
|
|
if (bw->current_content->status == CONTENT_STATUS_READY ||
|
|
|
|
bw->current_content->status ==
|
|
|
|
CONTENT_STATUS_DONE)
|
|
|
|
content_close(bw->current_content);
|
2004-02-25 18:12:58 +03:00
|
|
|
content_remove_user(bw->current_content,
|
2005-08-21 16:04:18 +04:00
|
|
|
browser_window_callback, (intptr_t) bw, 0);
|
2006-09-02 19:52:41 +04:00
|
|
|
bw->current_content = 0;
|
2004-02-25 18:12:58 +03:00
|
|
|
}
|
|
|
|
|
2006-01-25 11:25:38 +03:00
|
|
|
schedule_remove(browser_window_refresh, bw);
|
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
selection_destroy(bw->sel);
|
2004-02-25 18:12:58 +03:00
|
|
|
history_destroy(bw->history);
|
|
|
|
gui_window_destroy(bw->window);
|
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
free(bw->name);
|
2004-08-07 02:19:13 +04:00
|
|
|
free(bw->frag_id);
|
2006-09-02 19:52:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
/**
|
|
|
|
* Returns the browser window that is responsible for the child.
|
|
|
|
*
|
|
|
|
* \param bw The browser window to find the owner of
|
|
|
|
* \return the browser window's owner
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct browser_window *browser_window_owner(struct browser_window *bw)
|
|
|
|
{
|
|
|
|
/* an iframe's parent is just the parent window */
|
|
|
|
if (bw->browser_window_type == BROWSER_WINDOW_IFRAME)
|
|
|
|
return bw->parent;
|
|
|
|
|
|
|
|
/* the parent of a frameset is either a NORMAL window or an IFRAME */
|
|
|
|
while (bw->parent) {
|
|
|
|
switch (bw->browser_window_type) {
|
|
|
|
case BROWSER_WINDOW_NORMAL:
|
|
|
|
case BROWSER_WINDOW_IFRAME:
|
|
|
|
return bw;
|
|
|
|
case BROWSER_WINDOW_FRAME:
|
|
|
|
case BROWSER_WINDOW_FRAMESET:
|
|
|
|
bw = bw->parent;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bw;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-27 00:04:42 +03:00
|
|
|
/**
|
|
|
|
* Reformat a browser window contents to a new width or height.
|
|
|
|
*
|
|
|
|
* \param bw the browser window to reformat
|
|
|
|
* \param width new width
|
|
|
|
* \param height new height
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_reformat(struct browser_window *bw, int width, int height)
|
|
|
|
{
|
|
|
|
struct content *c = bw->current_content;
|
|
|
|
|
|
|
|
if (!c)
|
|
|
|
return;
|
|
|
|
|
2007-08-07 07:55:18 +04:00
|
|
|
content_reformat(c, width / bw->scale, height / bw->scale);
|
2006-11-27 00:04:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-26 23:11:20 +03:00
|
|
|
/**
|
|
|
|
* Sets the scale of a browser window
|
|
|
|
*
|
|
|
|
* \param bw The browser window to scale
|
|
|
|
* \param scale The new scale
|
|
|
|
* \param all Scale all windows in the tree (ie work up aswell as down)
|
|
|
|
*/
|
|
|
|
|
2006-11-27 18:35:18 +03:00
|
|
|
void browser_window_set_scale(struct browser_window *bw, float scale, bool all)
|
2006-11-27 00:04:42 +03:00
|
|
|
{
|
2006-11-26 23:11:20 +03:00
|
|
|
while (bw->parent && all)
|
|
|
|
bw = bw->parent;
|
|
|
|
browser_window_set_scale_internal(bw, scale);
|
|
|
|
if (bw->parent)
|
|
|
|
bw = bw->parent;
|
|
|
|
browser_window_recalculate_frameset(bw);
|
|
|
|
}
|
|
|
|
|
2006-11-27 00:04:42 +03:00
|
|
|
void browser_window_set_scale_internal(struct browser_window *bw, float scale)
|
|
|
|
{
|
2007-03-25 23:32:41 +04:00
|
|
|
int i;
|
2007-08-07 07:55:18 +04:00
|
|
|
struct content *c;
|
|
|
|
|
2007-10-28 20:05:39 +03:00
|
|
|
if (fabs(bw->scale-scale) < 0.0001)
|
2007-08-07 07:55:18 +04:00
|
|
|
return;
|
|
|
|
bw->scale = scale;
|
|
|
|
c = bw->current_content;
|
|
|
|
if (c) {
|
|
|
|
if (!content_can_reformat(c)) {
|
2009-04-05 23:17:24 +04:00
|
|
|
browser_window_update(bw, false);
|
2007-08-07 07:55:18 +04:00
|
|
|
} else {
|
|
|
|
bw->reformat_pending = true;
|
|
|
|
browser_reformat_pending = true;
|
|
|
|
}
|
|
|
|
}
|
2006-11-26 23:11:20 +03:00
|
|
|
|
2007-03-25 23:32:41 +04:00
|
|
|
gui_window_set_scale(bw->window, scale);
|
2006-11-26 23:11:20 +03:00
|
|
|
|
|
|
|
for (i = 0; i < (bw->cols * bw->rows); i++)
|
|
|
|
browser_window_set_scale_internal(&bw->children[i], scale);
|
|
|
|
for (i = 0; i < bw->iframe_count; i++)
|
|
|
|
browser_window_set_scale_internal(&bw->iframes[i], scale);
|
|
|
|
}
|
|
|
|
|
2009-03-31 15:06:09 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Update URL bar for a given browser window to given URL
|
|
|
|
*
|
|
|
|
* \param bw Browser window to update URL bar for.
|
2009-03-31 15:12:36 +04:00
|
|
|
* \param url URL for content displayed by bw, excluding any fragment.
|
|
|
|
* \param frag Additional fragment. May be NULL if none.
|
2009-03-31 15:06:09 +04:00
|
|
|
*/
|
|
|
|
|
2009-03-30 19:46:26 +04:00
|
|
|
void browser_window_refresh_url_bar(struct browser_window *bw, const char *url,
|
|
|
|
const char *frag)
|
2009-03-31 15:06:09 +04:00
|
|
|
{
|
2009-03-30 19:46:26 +04:00
|
|
|
char *url_buf;
|
2009-03-31 16:55:23 +04:00
|
|
|
|
|
|
|
assert(bw);
|
|
|
|
assert(url);
|
|
|
|
|
|
|
|
if (frag == NULL) {
|
|
|
|
/* With no fragment, we may as well pass url straight through
|
|
|
|
* saving a malloc, copy, free cycle.
|
|
|
|
*/
|
|
|
|
gui_window_set_url(bw->window, url);
|
|
|
|
} else {
|
|
|
|
url_buf = malloc(strlen(url) + 1 /* # */ +
|
|
|
|
strlen(frag) + 1 /* \0 */);
|
|
|
|
if (url_buf != NULL) {
|
|
|
|
/* This sprintf is safe because of the above size
|
|
|
|
* calculation, thus we don't need snprintf
|
|
|
|
*/
|
|
|
|
sprintf(url_buf, "%s#%s", url, frag);
|
|
|
|
gui_window_set_url(bw->window, url_buf);
|
|
|
|
free(url_buf);
|
|
|
|
} else {
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
}
|
|
|
|
}
|
2009-03-30 19:46:26 +04:00
|
|
|
}
|
2006-11-26 23:11:20 +03:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
/**
|
|
|
|
* Locate a browser window in the specified stack according.
|
|
|
|
*
|
|
|
|
* \param bw the browser_window to search all relatives of
|
|
|
|
* \param target the target to locate
|
2007-04-08 03:08:31 +04:00
|
|
|
* \param new_window always return a new window (ie 'Open Link in New Window')
|
2006-09-02 19:52:41 +04:00
|
|
|
*/
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2008-11-29 03:24:09 +03:00
|
|
|
struct browser_window *browser_window_find_target(struct browser_window *bw,
|
|
|
|
const char *target, browser_mouse_state mouse)
|
2006-09-02 19:52:41 +04:00
|
|
|
{
|
|
|
|
struct browser_window *bw_target;
|
|
|
|
struct browser_window *top;
|
|
|
|
struct content *c;
|
|
|
|
int rdepth;
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
/* use the base target if we don't have one */
|
|
|
|
c = bw->current_content;
|
|
|
|
if (!target && c && c->data.html.base_target)
|
|
|
|
target = c->data.html.base_target;
|
2007-04-08 03:08:31 +04:00
|
|
|
if (!target)
|
|
|
|
target = TARGET_SELF;
|
2006-09-02 19:52:41 +04:00
|
|
|
|
2008-11-29 03:24:09 +03:00
|
|
|
/* allow the simple case of target="_blank" to be ignored if requested
|
|
|
|
*/
|
|
|
|
if ((!(mouse & BROWSER_MOUSE_CLICK_2)) &&
|
|
|
|
(!((mouse & BROWSER_MOUSE_CLICK_2) &&
|
|
|
|
(mouse & BROWSER_MOUSE_MOD_2))) &&
|
|
|
|
(!option_target_blank)) {
|
|
|
|
/* not a mouse button 2 click
|
|
|
|
* not a mouse button 1 click with ctrl pressed
|
|
|
|
* configured to ignore target="_blank" */
|
2007-04-08 21:49:42 +04:00
|
|
|
if ((target == TARGET_BLANK) || (!strcasecmp(target, "_blank")))
|
|
|
|
return bw;
|
|
|
|
}
|
2006-09-02 19:52:41 +04:00
|
|
|
|
2007-04-08 03:08:31 +04:00
|
|
|
/* handle reserved keywords */
|
2008-11-29 03:24:09 +03:00
|
|
|
if (((option_button_2_tab) && (mouse & BROWSER_MOUSE_CLICK_2)) ||
|
|
|
|
((!option_button_2_tab) &&
|
|
|
|
((mouse & BROWSER_MOUSE_CLICK_1) &&
|
|
|
|
(mouse & BROWSER_MOUSE_MOD_2))) ||
|
|
|
|
((option_button_2_tab) && ((target == TARGET_BLANK) ||
|
|
|
|
(!strcasecmp(target, "_blank"))))) {
|
|
|
|
/* open in new tab if:
|
|
|
|
* - button_2 opens in new tab and button_2 was pressed
|
|
|
|
* OR
|
|
|
|
* - button_2 doesn't open in new tabs and button_1 was
|
|
|
|
* pressed with ctrl held
|
|
|
|
* OR
|
|
|
|
* - button_2 opens in new tab and the link target is "_blank"
|
|
|
|
*/
|
|
|
|
bw_target = browser_window_create(NULL, bw, NULL, false, true);
|
|
|
|
if (!bw_target)
|
|
|
|
return bw;
|
|
|
|
return bw_target;
|
|
|
|
} else if (((!option_button_2_tab) &&
|
|
|
|
(mouse & BROWSER_MOUSE_CLICK_2)) ||
|
|
|
|
((option_button_2_tab) &&
|
|
|
|
((mouse & BROWSER_MOUSE_CLICK_1) &&
|
|
|
|
(mouse & BROWSER_MOUSE_MOD_2))) ||
|
|
|
|
((!option_button_2_tab) && ((target == TARGET_BLANK) ||
|
|
|
|
(!strcasecmp(target, "_blank"))))) {
|
|
|
|
/* open in new window if:
|
|
|
|
* - button_2 doesn't open in new tabs and button_2 was pressed
|
|
|
|
* OR
|
|
|
|
* - button_2 opens in new tab and button_1 was pressed with
|
|
|
|
* ctrl held
|
|
|
|
* OR
|
|
|
|
* - button_2 doesn't open in new tabs and the link target is
|
|
|
|
* "_blank"
|
|
|
|
*/
|
2008-08-24 14:31:38 +04:00
|
|
|
bw_target = browser_window_create(NULL, bw, NULL, false, false);
|
2007-04-08 03:08:31 +04:00
|
|
|
if (!bw_target)
|
|
|
|
return bw;
|
|
|
|
return bw_target;
|
|
|
|
} else if ((target == TARGET_SELF) || (!strcasecmp(target, "_self"))) {
|
2006-09-02 19:52:41 +04:00
|
|
|
return bw;
|
2008-11-29 03:24:09 +03:00
|
|
|
} else if ((target == TARGET_PARENT) ||
|
|
|
|
(!strcasecmp(target, "_parent"))) {
|
2006-09-02 19:52:41 +04:00
|
|
|
if (bw->parent)
|
|
|
|
return bw->parent;
|
|
|
|
return bw;
|
|
|
|
} else if ((target == TARGET_TOP) || (!strcasecmp(target, "_top"))) {
|
|
|
|
while (bw->parent)
|
|
|
|
bw = bw->parent;
|
|
|
|
return bw;
|
|
|
|
}
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
/* find frame according to B.8, ie using the following priorities:
|
|
|
|
*
|
|
|
|
* 1) current frame
|
|
|
|
* 2) closest to front
|
|
|
|
*/
|
|
|
|
rdepth = -1;
|
2007-04-08 03:08:31 +04:00
|
|
|
bw_target = NULL;
|
2006-09-02 19:52:41 +04:00
|
|
|
for (top = bw; top->parent; top = top->parent);
|
2009-03-31 15:06:09 +04:00
|
|
|
browser_window_find_target_internal(top, target, 0, bw, &rdepth,
|
|
|
|
&bw_target);
|
2007-04-08 03:08:31 +04:00
|
|
|
if (bw_target)
|
|
|
|
return bw_target;
|
2007-08-07 11:58:04 +04:00
|
|
|
|
2007-04-08 03:08:31 +04:00
|
|
|
/* we require a new window using the target name */
|
|
|
|
if (!option_target_blank)
|
|
|
|
return bw;
|
2008-08-24 14:31:38 +04:00
|
|
|
bw_target = browser_window_create(NULL, bw, NULL, false, false);
|
2007-04-08 03:08:31 +04:00
|
|
|
if (!bw_target)
|
|
|
|
return bw;
|
2007-08-07 11:58:04 +04:00
|
|
|
|
2009-03-31 15:06:09 +04:00
|
|
|
/* frame names should begin with an alphabetic character (a-z,A-Z),
|
|
|
|
* however in practice you get things such as '_new' and '2left'. The
|
|
|
|
* only real effect this has is when giving out names as it can be
|
|
|
|
* assumed that an author intended '_new' to create a new nameless
|
|
|
|
* window (ie '_blank') whereas in the case of '2left' the intention
|
|
|
|
* was for a new named window. As such we merely special case windows
|
|
|
|
* that begin with an underscore. */
|
2007-04-08 03:08:31 +04:00
|
|
|
if (target[0] != '_') {
|
|
|
|
bw_target->name = strdup(target);
|
|
|
|
if (!bw_target->name)
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
}
|
2006-09-02 19:52:41 +04:00
|
|
|
return bw_target;
|
|
|
|
}
|
|
|
|
|
2009-03-31 15:06:09 +04:00
|
|
|
void browser_window_find_target_internal(struct browser_window *bw,
|
|
|
|
const char *target, int depth, struct browser_window *page,
|
|
|
|
int *rdepth, struct browser_window **bw_target)
|
2006-09-02 19:52:41 +04:00
|
|
|
{
|
|
|
|
int i;
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
if ((bw->name) && (!strcasecmp(bw->name, target))) {
|
|
|
|
if ((bw == page) || (depth > *rdepth)) {
|
|
|
|
*rdepth = depth;
|
|
|
|
*bw_target = bw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((!bw->children) && (!bw->iframes))
|
|
|
|
return;
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
depth++;
|
|
|
|
for (i = 0; i < (bw->cols * bw->rows); i++) {
|
2009-03-31 15:06:09 +04:00
|
|
|
if ((bw->children[i].name) &&
|
|
|
|
(!strcasecmp(bw->children[i].name, target))) {
|
2006-09-02 19:52:41 +04:00
|
|
|
if ((page == &bw->children[i]) || (depth > *rdepth)) {
|
|
|
|
*rdepth = depth;
|
|
|
|
*bw_target = &bw->children[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bw->children[i].children)
|
2009-03-31 15:06:09 +04:00
|
|
|
browser_window_find_target_internal(&bw->children[i],
|
|
|
|
target, depth, page, rdepth, bw_target);
|
2006-09-02 19:52:41 +04:00
|
|
|
}
|
|
|
|
for (i = 0; i < bw->iframe_count; i++)
|
2009-03-31 15:06:09 +04:00
|
|
|
browser_window_find_target_internal(&bw->iframes[i], target,
|
|
|
|
depth, page, rdepth, bw_target);
|
2003-10-25 18:13:49 +04:00
|
|
|
}
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
|
|
|
|
/**
|
2004-06-28 03:24:11 +04:00
|
|
|
* Callback for fetch for download window fetches.
|
2004-02-25 18:12:58 +03:00
|
|
|
*/
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2006-02-23 18:06:54 +03:00
|
|
|
void download_window_callback(fetch_msg msg, void *p, const void *data,
|
2004-06-28 03:24:11 +04:00
|
|
|
unsigned long size)
|
2003-08-28 23:21:27 +04:00
|
|
|
{
|
2004-06-28 03:24:11 +04:00
|
|
|
struct gui_download_window *download_window = p;
|
2003-08-28 23:21:27 +04:00
|
|
|
|
|
|
|
switch (msg) {
|
2004-07-10 06:35:31 +04:00
|
|
|
case FETCH_PROGRESS:
|
|
|
|
break;
|
2004-06-28 03:24:11 +04:00
|
|
|
case FETCH_DATA:
|
|
|
|
gui_download_window_data(download_window, data, size);
|
2003-08-28 23:21:27 +04:00
|
|
|
break;
|
|
|
|
|
2004-06-28 03:24:11 +04:00
|
|
|
case FETCH_FINISHED:
|
2003-08-28 23:21:27 +04:00
|
|
|
gui_download_window_done(download_window);
|
|
|
|
break;
|
|
|
|
|
2004-06-28 03:24:11 +04:00
|
|
|
case FETCH_ERROR:
|
|
|
|
gui_download_window_error(download_window, data);
|
2003-08-28 23:21:27 +04:00
|
|
|
break;
|
|
|
|
|
2004-06-28 03:24:11 +04:00
|
|
|
case FETCH_TYPE:
|
2006-02-06 03:10:09 +03:00
|
|
|
case FETCH_NOTMODIFIED:
|
2004-06-28 03:24:11 +04:00
|
|
|
case FETCH_AUTH:
|
2006-02-23 18:06:54 +03:00
|
|
|
case FETCH_CERT_ERR:
|
2004-06-28 03:24:11 +04:00
|
|
|
default:
|
|
|
|
/* not possible */
|
2003-08-28 23:21:27 +04:00
|
|
|
assert(0);
|
|
|
|
break;
|
2004-07-20 00:40:11 +04:00
|
|
|
}
|
2003-08-28 23:21:27 +04:00
|
|
|
}
|
|
|
|
|
2004-06-28 03:24:11 +04:00
|
|
|
|
2004-07-18 03:32:09 +04:00
|
|
|
/**
|
|
|
|
* Handle mouse clicks in a browser window.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
2005-04-15 09:52:25 +04:00
|
|
|
* \param mouse state of mouse buttons and modifier keys
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param x coordinate of mouse
|
|
|
|
* \param y coordinate of mouse
|
2004-07-18 03:32:09 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_mouse_click(struct browser_window *bw,
|
2005-04-15 09:52:25 +04:00
|
|
|
browser_mouse_state mouse, int x, int y)
|
2004-07-18 03:32:09 +04:00
|
|
|
{
|
2005-04-15 09:52:25 +04:00
|
|
|
struct content *c = bw->current_content;
|
2004-07-18 03:32:09 +04:00
|
|
|
|
2005-08-21 14:52:17 +04:00
|
|
|
if (!c)
|
|
|
|
return;
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2005-08-21 14:52:17 +04:00
|
|
|
switch (c->type) {
|
|
|
|
case CONTENT_HTML:
|
|
|
|
browser_window_mouse_action_html(bw, mouse, x, y);
|
|
|
|
break;
|
|
|
|
|
2006-02-16 02:09:55 +03:00
|
|
|
case CONTENT_TEXTPLAIN:
|
|
|
|
browser_window_mouse_action_text(bw, mouse, x, y);
|
|
|
|
break;
|
|
|
|
|
2005-08-21 14:52:17 +04:00
|
|
|
default:
|
|
|
|
if (mouse & BROWSER_MOUSE_MOD_2) {
|
|
|
|
if (mouse & BROWSER_MOUSE_DRAG_2)
|
|
|
|
gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, c,
|
|
|
|
bw->window);
|
|
|
|
else if (mouse & BROWSER_MOUSE_DRAG_1)
|
|
|
|
gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, c,
|
|
|
|
bw->window);
|
|
|
|
}
|
|
|
|
else if (mouse & (BROWSER_MOUSE_DRAG_1 |
|
|
|
|
BROWSER_MOUSE_DRAG_2)) {
|
|
|
|
browser_window_page_drag_start(bw, x, y);
|
2006-03-10 12:09:03 +03:00
|
|
|
browser_window_set_pointer(bw->window, GUI_POINTER_MOVE);
|
2005-08-21 14:52:17 +04:00
|
|
|
}
|
|
|
|
break;
|
2005-04-15 09:52:25 +04:00
|
|
|
}
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-04-15 09:52:25 +04:00
|
|
|
* Handle mouse clicks and movements in an HTML content window.
|
2004-07-18 03:32:09 +04:00
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
2006-02-16 02:09:55 +03:00
|
|
|
* \param mouse state of mouse buttons and modifier keys
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param x coordinate of mouse
|
|
|
|
* \param y coordinate of mouse
|
2005-08-21 14:52:17 +04:00
|
|
|
*
|
|
|
|
* This function handles both hovering and clicking. It is important that the
|
|
|
|
* code path is identical (except that hovering doesn't carry out the action),
|
|
|
|
* so that the status bar reflects exactly what will happen. Having separate
|
|
|
|
* code paths opens the possibility that an attacker will make the status bar
|
|
|
|
* show some harmless action where clicking will be harmful.
|
2004-07-18 03:32:09 +04:00
|
|
|
*/
|
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
void browser_window_mouse_action_html(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y)
|
2004-07-18 03:32:09 +04:00
|
|
|
{
|
2007-11-04 04:16:50 +03:00
|
|
|
enum { ACTION_NONE, ACTION_SUBMIT, ACTION_GO } action = ACTION_NONE;
|
2004-07-18 03:32:09 +04:00
|
|
|
char *title = 0;
|
2006-09-06 04:15:10 +04:00
|
|
|
const char *url = 0;
|
2005-08-21 14:52:17 +04:00
|
|
|
const char *target = 0;
|
2004-07-18 03:32:09 +04:00
|
|
|
char status_buffer[200];
|
2004-07-18 21:38:01 +04:00
|
|
|
const char *status = 0;
|
2004-07-18 03:32:09 +04:00
|
|
|
gui_pointer_shape pointer = GUI_POINTER_DEFAULT;
|
2009-02-20 22:34:40 +03:00
|
|
|
bool imagemap = false;
|
2004-07-18 21:38:01 +04:00
|
|
|
int box_x = 0, box_y = 0;
|
2004-07-19 18:31:31 +04:00
|
|
|
int gadget_box_x = 0, gadget_box_y = 0;
|
2004-11-20 03:02:56 +03:00
|
|
|
int scroll_box_x = 0, scroll_box_y = 0;
|
2009-05-28 18:35:12 +04:00
|
|
|
int text_box_x = 0;
|
2009-02-18 18:57:08 +03:00
|
|
|
struct box *url_box = 0;
|
2004-07-18 21:38:01 +04:00
|
|
|
struct box *gadget_box = 0;
|
2004-11-20 03:02:56 +03:00
|
|
|
struct box *scroll_box = 0;
|
2005-04-15 09:52:25 +04:00
|
|
|
struct box *text_box = 0;
|
2004-07-18 21:38:01 +04:00
|
|
|
struct content *c = bw->current_content;
|
2004-08-26 03:56:49 +04:00
|
|
|
struct box *box;
|
2004-07-18 21:38:01 +04:00
|
|
|
struct content *content = c;
|
|
|
|
struct content *gadget_content = c;
|
|
|
|
struct form_control *gadget = 0;
|
2005-04-15 09:52:25 +04:00
|
|
|
struct content *object = NULL;
|
2005-07-24 10:13:25 +04:00
|
|
|
struct box *next_box;
|
2004-07-18 03:32:09 +04:00
|
|
|
|
2004-10-18 01:11:29 +04:00
|
|
|
bw->drag_type = DRAGGING_NONE;
|
2004-08-26 03:56:49 +04:00
|
|
|
bw->scrolling_box = NULL;
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2004-08-26 03:56:49 +04:00
|
|
|
/* search the box tree for a link, imagemap, form control, or
|
2004-10-18 01:11:29 +04:00
|
|
|
* box with scrollbars */
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2004-08-26 03:56:49 +04:00
|
|
|
box = c->data.html.layout;
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2006-03-27 03:06:18 +04:00
|
|
|
/* Consider the margins of the html page now */
|
|
|
|
box_x = box->margin[LEFT];
|
|
|
|
box_y = box->margin[TOP];
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2005-07-24 10:13:25 +04:00
|
|
|
while ((next_box = box_at_point(box, x, y, &box_x, &box_y, &content)) !=
|
2004-08-26 03:56:49 +04:00
|
|
|
NULL) {
|
2005-07-24 10:13:25 +04:00
|
|
|
box = next_box;
|
|
|
|
|
2004-07-18 03:32:09 +04:00
|
|
|
if (box->style &&
|
|
|
|
box->style->visibility == CSS_VISIBILITY_HIDDEN)
|
|
|
|
continue;
|
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
if (box->object)
|
|
|
|
object = box->object;
|
|
|
|
|
2005-08-21 14:52:17 +04:00
|
|
|
if (box->href) {
|
2005-07-02 22:17:51 +04:00
|
|
|
url = box->href;
|
2005-08-21 14:52:17 +04:00
|
|
|
target = box->target;
|
2009-02-18 18:57:08 +03:00
|
|
|
url_box = box;
|
2005-08-21 14:52:17 +04:00
|
|
|
}
|
2004-07-18 03:32:09 +04:00
|
|
|
|
2009-02-20 22:34:40 +03:00
|
|
|
if (box->usemap) {
|
2005-07-02 22:17:51 +04:00
|
|
|
url = imagemap_get(content, box->usemap,
|
2006-09-06 04:15:10 +04:00
|
|
|
box_x, box_y, x, y, &target);
|
2009-02-20 22:34:40 +03:00
|
|
|
if (url) {
|
|
|
|
imagemap = true;
|
|
|
|
url_box = box;
|
|
|
|
}
|
|
|
|
}
|
2004-07-18 03:32:09 +04:00
|
|
|
|
|
|
|
if (box->gadget) {
|
|
|
|
gadget_content = content;
|
|
|
|
gadget = box->gadget;
|
2004-07-18 04:12:18 +04:00
|
|
|
gadget_box = box;
|
2004-07-19 18:31:31 +04:00
|
|
|
gadget_box_x = box_x;
|
|
|
|
gadget_box_y = box_y;
|
2006-12-30 03:34:26 +03:00
|
|
|
if (gadget->form)
|
|
|
|
target = gadget->form->target;
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (box->title)
|
|
|
|
title = box->title;
|
|
|
|
|
|
|
|
if (box->style && box->style->cursor != CSS_CURSOR_UNKNOWN)
|
2009-02-20 22:34:40 +03:00
|
|
|
pointer = get_pointer_shape(box, false);
|
2004-08-26 03:56:49 +04:00
|
|
|
|
2004-11-20 03:02:56 +03:00
|
|
|
if (box->style && box->type != BOX_BR &&
|
|
|
|
box->type != BOX_INLINE &&
|
2005-07-02 22:17:51 +04:00
|
|
|
box->type != BOX_TEXT &&
|
2004-11-20 03:02:56 +03:00
|
|
|
(box->style->overflow == CSS_OVERFLOW_SCROLL ||
|
|
|
|
box->style->overflow == CSS_OVERFLOW_AUTO) &&
|
|
|
|
((box_vscrollbar_present(box) &&
|
|
|
|
box_x + box->scroll_x + box->padding[LEFT] +
|
|
|
|
box->width < x) ||
|
|
|
|
(box_hscrollbar_present(box) &&
|
|
|
|
box_y + box->scroll_y + box->padding[TOP] +
|
|
|
|
box->height < y))) {
|
|
|
|
scroll_box = box;
|
|
|
|
scroll_box_x = box_x + box->scroll_x;
|
|
|
|
scroll_box_y = box_y + box->scroll_y;
|
2004-08-26 03:56:49 +04:00
|
|
|
}
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2006-05-25 02:55:37 +04:00
|
|
|
if (box->text && !box->object) {
|
2005-04-15 09:52:25 +04:00
|
|
|
text_box = box;
|
2006-05-25 02:55:37 +04:00
|
|
|
text_box_x = box_x;
|
|
|
|
}
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
|
2006-05-25 02:55:37 +04:00
|
|
|
/* use of box_x, box_y, or content below this point is probably a
|
|
|
|
* mistake; they will refer to the last box returned by box_at_point */
|
|
|
|
|
2004-11-20 03:02:56 +03:00
|
|
|
if (scroll_box) {
|
2005-04-15 09:52:25 +04:00
|
|
|
status = browser_window_scrollbar_click(bw, mouse, scroll_box,
|
2004-11-20 03:02:56 +03:00
|
|
|
scroll_box_x, scroll_box_y,
|
|
|
|
x - scroll_box_x, y - scroll_box_y);
|
2009-03-02 15:48:20 +03:00
|
|
|
pointer = GUI_POINTER_DEFAULT;
|
2004-10-18 01:11:29 +04:00
|
|
|
} else if (gadget) {
|
2004-07-18 03:32:09 +04:00
|
|
|
switch (gadget->type) {
|
|
|
|
case GADGET_SELECT:
|
|
|
|
status = messages_get("FormSelect");
|
|
|
|
pointer = GUI_POINTER_MENU;
|
2005-04-15 09:52:25 +04:00
|
|
|
if (mouse & BROWSER_MOUSE_CLICK_1)
|
2004-07-18 03:32:09 +04:00
|
|
|
gui_create_form_select_menu(bw, gadget);
|
|
|
|
break;
|
|
|
|
case GADGET_CHECKBOX:
|
|
|
|
status = messages_get("FormCheckbox");
|
2005-04-15 09:52:25 +04:00
|
|
|
if (mouse & BROWSER_MOUSE_CLICK_1) {
|
2004-07-18 03:32:09 +04:00
|
|
|
gadget->selected = !gadget->selected;
|
2004-07-18 21:38:01 +04:00
|
|
|
browser_redraw_box(gadget_content, gadget_box);
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GADGET_RADIO:
|
|
|
|
status = messages_get("FormRadio");
|
2005-04-15 09:52:25 +04:00
|
|
|
if (mouse & BROWSER_MOUSE_CLICK_1)
|
2004-07-18 21:38:01 +04:00
|
|
|
browser_radio_set(gadget_content, gadget);
|
2004-07-18 03:32:09 +04:00
|
|
|
break;
|
|
|
|
case GADGET_IMAGE:
|
2005-04-15 09:52:25 +04:00
|
|
|
if (mouse & BROWSER_MOUSE_CLICK_1) {
|
2004-07-19 18:31:31 +04:00
|
|
|
gadget->data.image.mx = x - gadget_box_x;
|
|
|
|
gadget->data.image.my = y - gadget_box_y;
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
/* drop through */
|
|
|
|
case GADGET_SUBMIT:
|
|
|
|
if (gadget->form) {
|
|
|
|
snprintf(status_buffer, sizeof status_buffer,
|
|
|
|
messages_get("FormSubmit"),
|
|
|
|
gadget->form->action);
|
|
|
|
status = status_buffer;
|
2009-02-20 22:34:40 +03:00
|
|
|
pointer = get_pointer_shape(gadget_box, false);
|
2009-02-18 18:57:08 +03:00
|
|
|
if (mouse & (BROWSER_MOUSE_CLICK_1 |
|
|
|
|
BROWSER_MOUSE_CLICK_2))
|
2007-11-04 04:16:50 +03:00
|
|
|
action = ACTION_SUBMIT;
|
2004-07-18 03:32:09 +04:00
|
|
|
} else {
|
|
|
|
status = messages_get("FormBadSubmit");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GADGET_TEXTAREA:
|
|
|
|
status = messages_get("FormTextarea");
|
2009-02-20 22:34:40 +03:00
|
|
|
pointer = get_pointer_shape(gadget_box, false);
|
2006-02-11 21:33:05 +03:00
|
|
|
|
2009-02-18 18:57:08 +03:00
|
|
|
if (mouse & (BROWSER_MOUSE_PRESS_1 |
|
|
|
|
BROWSER_MOUSE_PRESS_2)) {
|
|
|
|
if (text_box && selection_root(bw->sel) !=
|
|
|
|
gadget_box)
|
2006-02-11 21:33:05 +03:00
|
|
|
selection_init(bw->sel, gadget_box);
|
|
|
|
|
2005-08-21 14:52:17 +04:00
|
|
|
browser_window_textarea_click(bw,
|
|
|
|
mouse,
|
|
|
|
gadget_box,
|
|
|
|
gadget_box_x,
|
|
|
|
gadget_box_y,
|
|
|
|
x - gadget_box_x,
|
|
|
|
y - gadget_box_y);
|
2006-02-11 21:33:05 +03:00
|
|
|
}
|
2005-07-21 03:27:28 +04:00
|
|
|
|
2006-02-11 21:33:05 +03:00
|
|
|
if (text_box) {
|
2006-02-16 02:09:55 +03:00
|
|
|
int pixel_offset;
|
2008-02-25 20:58:00 +03:00
|
|
|
size_t idx;
|
2006-02-16 02:09:55 +03:00
|
|
|
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
nsfont.font_position_in_string(text_box->style,
|
2006-02-16 02:09:55 +03:00
|
|
|
text_box->text,
|
|
|
|
text_box->length,
|
Merged revisions 4282-4285,4288-4293,4297-4298,4307,4309-4313,4322,4324-4680 via svnmerge from
svn://svn.netsurf-browser.org/branches/mikeL/netsurf
........
r4432 | mikeL | 2008-06-24 04:00:36 +0100 (Tue, 24 Jun 2008) | 1 line
Drag events are now emited from where the press originated, instead of from where they became a drag
........
r4433 | mikeL | 2008-06-24 04:25:33 +0100 (Tue, 24 Jun 2008) | 1 line
Added accelerator to 'Select All'
........
r4495 | mikeL | 2008-07-02 21:36:32 +0100 (Wed, 02 Jul 2008) | 1 line
Selections are now deleted and replaced when a key is typed in a text area or text box. All input box behavior while a selection is active is now implemented (ex: pressing the right arrow key moves the caret to the end of the selection). Cut now works properly in both versions. Fixed discrepancy between where the caret was placed and selection began when starting a drag-select. Fixed bug with calculation of a selections end box.
........
r4496 | mikeL | 2008-07-02 22:11:24 +0100 (Wed, 02 Jul 2008) | 1 line
Added support for cut in input boxes
........
r4497 | mikeL | 2008-07-02 22:21:35 +0100 (Wed, 02 Jul 2008) | 1 line
Removed unused variables (Thanks tlsa)
........
r4498 | mikeL | 2008-07-02 23:30:30 +0100 (Wed, 02 Jul 2008) | 1 line
Modified selection clearing behavior to allow for drag-saves
........
r4499 | mikeL | 2008-07-03 00:51:50 +0100 (Thu, 03 Jul 2008) | 1 line
Fixed regression where it would take two clicks to place caret in an input (Thanks tlsa)
........
r4509 | mikeL | 2008-07-06 07:55:09 +0100 (Sun, 06 Jul 2008) | 1 line
Basic download support implemented. Only downloading of text files works
........
r4510 | mikeL | 2008-07-06 18:55:31 +0100 (Sun, 06 Jul 2008) | 1 line
Downloading of non-text files is now possible. Progress bar and size downloaded are now updated
........
r4511 | mikeL | 2008-07-06 20:46:00 +0100 (Sun, 06 Jul 2008) | 1 line
Added downloads glade file
........
r4512 | mikeL | 2008-07-06 20:47:39 +0100 (Sun, 06 Jul 2008) | 1 line
Downloads window now spawns in the center of the parent browser window
........
r4513 | mikeL | 2008-07-06 20:56:12 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed bug where backspace would be ignored if the selection began at the beginning on an input
........
r4514 | mikeL | 2008-07-06 21:26:45 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed compiler warnings by adding casts
........
r4516 | mikeL | 2008-07-06 21:32:41 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed initialization of size string, added initialization of progress
........
r4518 | mikeL | 2008-07-06 21:51:08 +0100 (Sun, 06 Jul 2008) | 1 line
Added an option for short units (with space) to human_friendly_bytesize
........
r4519 | mikeL | 2008-07-06 21:52:05 +0100 (Sun, 06 Jul 2008) | 1 line
Removed function size_to_string
........
r4520 | mikeL | 2008-07-06 22:03:11 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed pedantic error (kB instead of KB). Added missing necessary parameters to human_friendly_bytesize. Fixed incorrect bool types
........
r4521 | mikeL | 2008-07-06 22:08:15 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnecessary parameter and units list from human_friendly_bytesize
........
r4522 | mikeL | 2008-07-06 22:57:03 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnused variable
........
r4523 | mikeL | 2008-07-06 23:03:46 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed url parsing by replacing url_parse_filename with url_nice. Total size and size downloaded are now in human readable form. Speed is now calculated (roughly)
........
r4524 | mikeL | 2008-07-07 01:19:01 +0100 (Mon, 07 Jul 2008) | 1 line
Added file overwrite confirmation. Changed speed to a double
........
r4546 | mikeL | 2008-07-09 17:21:43 +0100 (Wed, 09 Jul 2008) | 1 line
Changed parameter of selection_get_end/start to a size_t instead of int and changed all offset variables to size_t as well
........
r4547 | mikeL | 2008-07-09 17:30:47 +0100 (Wed, 09 Jul 2008) | 1 line
Added action buttons to the bottom toolbar. Added ability to clear selected (and completed) downloads with a framework for other actions.
........
r4556 | jmb | 2008-07-10 00:17:24 +0100 (Thu, 10 Jul 2008) | 3 lines
A large bunch of tidying and general fixes to text input handling.
Make selection code treat password fields as inputs, too.
........
r4557 | mikeL | 2008-07-10 00:24:46 +0100 (Thu, 10 Jul 2008) | 1 line
Added functionality to gui_empty_clipboard and gui_start_selection (Thanks jmb)
........
r4573 | mikeL | 2008-07-10 16:33:27 +0100 (Thu, 10 Jul 2008) | 1 line
Removed example download. Made the list store row aware of its download and vise versa. Added new way of handling actions from the dialog (e.g. buttons) which handles all rows in the selection. Added a few memory management function calls to clean up better
........
r4577 | mikeL | 2008-07-10 21:11:51 +0100 (Thu, 10 Jul 2008) | 1 line
Download write channels now close properly. Added status column to the tree store which will change the progress bar text if a download is canceled or completed. Implemented cancel button functionality.
........
r4578 | mikeL | 2008-07-10 21:17:51 +0100 (Thu, 10 Jul 2008) | 1 line
Speed is now displayed as '-' when 0 or download has stopped
........
r4580 | mikeL | 2008-07-11 02:10:57 +0100 (Fri, 11 Jul 2008) | 1 line
Added two download related options (Download directory & Clear completed downloads) and a Downloads tab to the preferences dialog. Also moved the option to ask when overwriting files to Downloads tab. Added another option to the pre-download dialog, Save, which downloads the file immediately to your 'Download directory'
........
r4581 | mikeL | 2008-07-11 02:26:00 +0100 (Fri, 11 Jul 2008) | 1 line
Rearranged pre-download dialog buttons to conform to the HIG
........
r4616 | mikeL | 2008-07-11 19:54:12 +0100 (Fri, 11 Jul 2008) | 1 line
Limited download window updates to a user-defined variable that can be set in options (default is .5). Updates are now only done if the download window is visible. This greatly reduces the cpu usage.
........
r4617 | mikeL | 2008-07-11 20:07:48 +0100 (Fri, 11 Jul 2008) | 1 line
Removed unnecessary update limit option (it is now fixed at .5)
........
r4629 | mikeL | 2008-07-13 04:21:07 +0100 (Sun, 13 Jul 2008) | 1 line
Reorganized button sensitivity functions. Sensitivities are now updated when the selection changes as well as when a selected download's state changes.
........
r4635 | mikeL | 2008-07-13 17:00:05 +0100 (Sun, 13 Jul 2008) | 1 line
Added error handling. Added word-wrap to the "info" cell renderer so that to keep everything under control. Fixed bug where downloads would always go to you default folder (missing breaks).
........
r4642 | mikeL | 2008-07-13 21:46:09 +0100 (Sun, 13 Jul 2008) | 1 line
Added time remaining column. Fixed regression where the download info would be erased upon completion/cancelation.
........
r4655 | mikeL | 2008-07-14 23:20:33 +0100 (Mon, 14 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. When it is closed (when NS shuts down) all incomplete downloads are canceled (and the files deleted). Added a warning dialog when netsurf tries to close with incomplete downloads. Fixed bug where default save directory would initialize to NULL.
........
r4676 | mikeL | 2008-07-15 21:01:17 +0100 (Tue, 15 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. (This is the second half of the patch, last commit was only partial for some reason)
........
r4678 | mikeL | 2008-07-16 01:18:52 +0100 (Wed, 16 Jul 2008) | 1 line
Addresses almost all of rjek and jmb's concerns, fixes most of the sloppiness that was present earlier. Downloads without a total_size are now handled correctly (thanks tlsa). Changes to the default download directly are now saved correctly. Billions of other small bugs fixed
........
svn path=/trunk/netsurf/; revision=4681
2008-07-16 14:19:30 +04:00
|
|
|
x - gadget_box_x - text_box->x,
|
2006-02-16 02:09:55 +03:00
|
|
|
&idx,
|
|
|
|
&pixel_offset);
|
|
|
|
|
2008-04-07 13:00:21 +04:00
|
|
|
selection_click(bw->sel, mouse,
|
2008-02-25 20:58:00 +03:00
|
|
|
text_box->byte_offset + idx);
|
2006-02-11 21:33:05 +03:00
|
|
|
|
|
|
|
if (selection_dragging(bw->sel)) {
|
2005-08-21 14:52:17 +04:00
|
|
|
bw->drag_type = DRAGGING_SELECTION;
|
2006-02-11 21:33:05 +03:00
|
|
|
status = messages_get("Selecting");
|
|
|
|
} else
|
|
|
|
status = c->status_message;
|
2005-07-21 03:27:28 +04:00
|
|
|
}
|
Merged revisions 4282-4285,4288-4293,4297-4298,4307,4309-4313,4322,4324-4680 via svnmerge from
svn://svn.netsurf-browser.org/branches/mikeL/netsurf
........
r4432 | mikeL | 2008-06-24 04:00:36 +0100 (Tue, 24 Jun 2008) | 1 line
Drag events are now emited from where the press originated, instead of from where they became a drag
........
r4433 | mikeL | 2008-06-24 04:25:33 +0100 (Tue, 24 Jun 2008) | 1 line
Added accelerator to 'Select All'
........
r4495 | mikeL | 2008-07-02 21:36:32 +0100 (Wed, 02 Jul 2008) | 1 line
Selections are now deleted and replaced when a key is typed in a text area or text box. All input box behavior while a selection is active is now implemented (ex: pressing the right arrow key moves the caret to the end of the selection). Cut now works properly in both versions. Fixed discrepancy between where the caret was placed and selection began when starting a drag-select. Fixed bug with calculation of a selections end box.
........
r4496 | mikeL | 2008-07-02 22:11:24 +0100 (Wed, 02 Jul 2008) | 1 line
Added support for cut in input boxes
........
r4497 | mikeL | 2008-07-02 22:21:35 +0100 (Wed, 02 Jul 2008) | 1 line
Removed unused variables (Thanks tlsa)
........
r4498 | mikeL | 2008-07-02 23:30:30 +0100 (Wed, 02 Jul 2008) | 1 line
Modified selection clearing behavior to allow for drag-saves
........
r4499 | mikeL | 2008-07-03 00:51:50 +0100 (Thu, 03 Jul 2008) | 1 line
Fixed regression where it would take two clicks to place caret in an input (Thanks tlsa)
........
r4509 | mikeL | 2008-07-06 07:55:09 +0100 (Sun, 06 Jul 2008) | 1 line
Basic download support implemented. Only downloading of text files works
........
r4510 | mikeL | 2008-07-06 18:55:31 +0100 (Sun, 06 Jul 2008) | 1 line
Downloading of non-text files is now possible. Progress bar and size downloaded are now updated
........
r4511 | mikeL | 2008-07-06 20:46:00 +0100 (Sun, 06 Jul 2008) | 1 line
Added downloads glade file
........
r4512 | mikeL | 2008-07-06 20:47:39 +0100 (Sun, 06 Jul 2008) | 1 line
Downloads window now spawns in the center of the parent browser window
........
r4513 | mikeL | 2008-07-06 20:56:12 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed bug where backspace would be ignored if the selection began at the beginning on an input
........
r4514 | mikeL | 2008-07-06 21:26:45 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed compiler warnings by adding casts
........
r4516 | mikeL | 2008-07-06 21:32:41 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed initialization of size string, added initialization of progress
........
r4518 | mikeL | 2008-07-06 21:51:08 +0100 (Sun, 06 Jul 2008) | 1 line
Added an option for short units (with space) to human_friendly_bytesize
........
r4519 | mikeL | 2008-07-06 21:52:05 +0100 (Sun, 06 Jul 2008) | 1 line
Removed function size_to_string
........
r4520 | mikeL | 2008-07-06 22:03:11 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed pedantic error (kB instead of KB). Added missing necessary parameters to human_friendly_bytesize. Fixed incorrect bool types
........
r4521 | mikeL | 2008-07-06 22:08:15 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnecessary parameter and units list from human_friendly_bytesize
........
r4522 | mikeL | 2008-07-06 22:57:03 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnused variable
........
r4523 | mikeL | 2008-07-06 23:03:46 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed url parsing by replacing url_parse_filename with url_nice. Total size and size downloaded are now in human readable form. Speed is now calculated (roughly)
........
r4524 | mikeL | 2008-07-07 01:19:01 +0100 (Mon, 07 Jul 2008) | 1 line
Added file overwrite confirmation. Changed speed to a double
........
r4546 | mikeL | 2008-07-09 17:21:43 +0100 (Wed, 09 Jul 2008) | 1 line
Changed parameter of selection_get_end/start to a size_t instead of int and changed all offset variables to size_t as well
........
r4547 | mikeL | 2008-07-09 17:30:47 +0100 (Wed, 09 Jul 2008) | 1 line
Added action buttons to the bottom toolbar. Added ability to clear selected (and completed) downloads with a framework for other actions.
........
r4556 | jmb | 2008-07-10 00:17:24 +0100 (Thu, 10 Jul 2008) | 3 lines
A large bunch of tidying and general fixes to text input handling.
Make selection code treat password fields as inputs, too.
........
r4557 | mikeL | 2008-07-10 00:24:46 +0100 (Thu, 10 Jul 2008) | 1 line
Added functionality to gui_empty_clipboard and gui_start_selection (Thanks jmb)
........
r4573 | mikeL | 2008-07-10 16:33:27 +0100 (Thu, 10 Jul 2008) | 1 line
Removed example download. Made the list store row aware of its download and vise versa. Added new way of handling actions from the dialog (e.g. buttons) which handles all rows in the selection. Added a few memory management function calls to clean up better
........
r4577 | mikeL | 2008-07-10 21:11:51 +0100 (Thu, 10 Jul 2008) | 1 line
Download write channels now close properly. Added status column to the tree store which will change the progress bar text if a download is canceled or completed. Implemented cancel button functionality.
........
r4578 | mikeL | 2008-07-10 21:17:51 +0100 (Thu, 10 Jul 2008) | 1 line
Speed is now displayed as '-' when 0 or download has stopped
........
r4580 | mikeL | 2008-07-11 02:10:57 +0100 (Fri, 11 Jul 2008) | 1 line
Added two download related options (Download directory & Clear completed downloads) and a Downloads tab to the preferences dialog. Also moved the option to ask when overwriting files to Downloads tab. Added another option to the pre-download dialog, Save, which downloads the file immediately to your 'Download directory'
........
r4581 | mikeL | 2008-07-11 02:26:00 +0100 (Fri, 11 Jul 2008) | 1 line
Rearranged pre-download dialog buttons to conform to the HIG
........
r4616 | mikeL | 2008-07-11 19:54:12 +0100 (Fri, 11 Jul 2008) | 1 line
Limited download window updates to a user-defined variable that can be set in options (default is .5). Updates are now only done if the download window is visible. This greatly reduces the cpu usage.
........
r4617 | mikeL | 2008-07-11 20:07:48 +0100 (Fri, 11 Jul 2008) | 1 line
Removed unnecessary update limit option (it is now fixed at .5)
........
r4629 | mikeL | 2008-07-13 04:21:07 +0100 (Sun, 13 Jul 2008) | 1 line
Reorganized button sensitivity functions. Sensitivities are now updated when the selection changes as well as when a selected download's state changes.
........
r4635 | mikeL | 2008-07-13 17:00:05 +0100 (Sun, 13 Jul 2008) | 1 line
Added error handling. Added word-wrap to the "info" cell renderer so that to keep everything under control. Fixed bug where downloads would always go to you default folder (missing breaks).
........
r4642 | mikeL | 2008-07-13 21:46:09 +0100 (Sun, 13 Jul 2008) | 1 line
Added time remaining column. Fixed regression where the download info would be erased upon completion/cancelation.
........
r4655 | mikeL | 2008-07-14 23:20:33 +0100 (Mon, 14 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. When it is closed (when NS shuts down) all incomplete downloads are canceled (and the files deleted). Added a warning dialog when netsurf tries to close with incomplete downloads. Fixed bug where default save directory would initialize to NULL.
........
r4676 | mikeL | 2008-07-15 21:01:17 +0100 (Tue, 15 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. (This is the second half of the patch, last commit was only partial for some reason)
........
r4678 | mikeL | 2008-07-16 01:18:52 +0100 (Wed, 16 Jul 2008) | 1 line
Addresses almost all of rjek and jmb's concerns, fixes most of the sloppiness that was present earlier. Downloads without a total_size are now handled correctly (thanks tlsa). Changes to the default download directly are now saved correctly. Billions of other small bugs fixed
........
svn path=/trunk/netsurf/; revision=4681
2008-07-16 14:19:30 +04:00
|
|
|
else if (mouse & BROWSER_MOUSE_PRESS_1)
|
2008-04-08 16:40:05 +04:00
|
|
|
selection_clear(bw->sel, true);
|
2004-07-18 03:32:09 +04:00
|
|
|
break;
|
|
|
|
case GADGET_TEXTBOX:
|
|
|
|
case GADGET_PASSWORD:
|
|
|
|
status = messages_get("FormTextbox");
|
2009-02-20 22:34:40 +03:00
|
|
|
pointer = get_pointer_shape(gadget_box, false);
|
2009-02-18 18:57:08 +03:00
|
|
|
|
Merged revisions 4282-4285,4288-4293,4297-4298,4307,4309-4313,4322,4324-4680 via svnmerge from
svn://svn.netsurf-browser.org/branches/mikeL/netsurf
........
r4432 | mikeL | 2008-06-24 04:00:36 +0100 (Tue, 24 Jun 2008) | 1 line
Drag events are now emited from where the press originated, instead of from where they became a drag
........
r4433 | mikeL | 2008-06-24 04:25:33 +0100 (Tue, 24 Jun 2008) | 1 line
Added accelerator to 'Select All'
........
r4495 | mikeL | 2008-07-02 21:36:32 +0100 (Wed, 02 Jul 2008) | 1 line
Selections are now deleted and replaced when a key is typed in a text area or text box. All input box behavior while a selection is active is now implemented (ex: pressing the right arrow key moves the caret to the end of the selection). Cut now works properly in both versions. Fixed discrepancy between where the caret was placed and selection began when starting a drag-select. Fixed bug with calculation of a selections end box.
........
r4496 | mikeL | 2008-07-02 22:11:24 +0100 (Wed, 02 Jul 2008) | 1 line
Added support for cut in input boxes
........
r4497 | mikeL | 2008-07-02 22:21:35 +0100 (Wed, 02 Jul 2008) | 1 line
Removed unused variables (Thanks tlsa)
........
r4498 | mikeL | 2008-07-02 23:30:30 +0100 (Wed, 02 Jul 2008) | 1 line
Modified selection clearing behavior to allow for drag-saves
........
r4499 | mikeL | 2008-07-03 00:51:50 +0100 (Thu, 03 Jul 2008) | 1 line
Fixed regression where it would take two clicks to place caret in an input (Thanks tlsa)
........
r4509 | mikeL | 2008-07-06 07:55:09 +0100 (Sun, 06 Jul 2008) | 1 line
Basic download support implemented. Only downloading of text files works
........
r4510 | mikeL | 2008-07-06 18:55:31 +0100 (Sun, 06 Jul 2008) | 1 line
Downloading of non-text files is now possible. Progress bar and size downloaded are now updated
........
r4511 | mikeL | 2008-07-06 20:46:00 +0100 (Sun, 06 Jul 2008) | 1 line
Added downloads glade file
........
r4512 | mikeL | 2008-07-06 20:47:39 +0100 (Sun, 06 Jul 2008) | 1 line
Downloads window now spawns in the center of the parent browser window
........
r4513 | mikeL | 2008-07-06 20:56:12 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed bug where backspace would be ignored if the selection began at the beginning on an input
........
r4514 | mikeL | 2008-07-06 21:26:45 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed compiler warnings by adding casts
........
r4516 | mikeL | 2008-07-06 21:32:41 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed initialization of size string, added initialization of progress
........
r4518 | mikeL | 2008-07-06 21:51:08 +0100 (Sun, 06 Jul 2008) | 1 line
Added an option for short units (with space) to human_friendly_bytesize
........
r4519 | mikeL | 2008-07-06 21:52:05 +0100 (Sun, 06 Jul 2008) | 1 line
Removed function size_to_string
........
r4520 | mikeL | 2008-07-06 22:03:11 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed pedantic error (kB instead of KB). Added missing necessary parameters to human_friendly_bytesize. Fixed incorrect bool types
........
r4521 | mikeL | 2008-07-06 22:08:15 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnecessary parameter and units list from human_friendly_bytesize
........
r4522 | mikeL | 2008-07-06 22:57:03 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnused variable
........
r4523 | mikeL | 2008-07-06 23:03:46 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed url parsing by replacing url_parse_filename with url_nice. Total size and size downloaded are now in human readable form. Speed is now calculated (roughly)
........
r4524 | mikeL | 2008-07-07 01:19:01 +0100 (Mon, 07 Jul 2008) | 1 line
Added file overwrite confirmation. Changed speed to a double
........
r4546 | mikeL | 2008-07-09 17:21:43 +0100 (Wed, 09 Jul 2008) | 1 line
Changed parameter of selection_get_end/start to a size_t instead of int and changed all offset variables to size_t as well
........
r4547 | mikeL | 2008-07-09 17:30:47 +0100 (Wed, 09 Jul 2008) | 1 line
Added action buttons to the bottom toolbar. Added ability to clear selected (and completed) downloads with a framework for other actions.
........
r4556 | jmb | 2008-07-10 00:17:24 +0100 (Thu, 10 Jul 2008) | 3 lines
A large bunch of tidying and general fixes to text input handling.
Make selection code treat password fields as inputs, too.
........
r4557 | mikeL | 2008-07-10 00:24:46 +0100 (Thu, 10 Jul 2008) | 1 line
Added functionality to gui_empty_clipboard and gui_start_selection (Thanks jmb)
........
r4573 | mikeL | 2008-07-10 16:33:27 +0100 (Thu, 10 Jul 2008) | 1 line
Removed example download. Made the list store row aware of its download and vise versa. Added new way of handling actions from the dialog (e.g. buttons) which handles all rows in the selection. Added a few memory management function calls to clean up better
........
r4577 | mikeL | 2008-07-10 21:11:51 +0100 (Thu, 10 Jul 2008) | 1 line
Download write channels now close properly. Added status column to the tree store which will change the progress bar text if a download is canceled or completed. Implemented cancel button functionality.
........
r4578 | mikeL | 2008-07-10 21:17:51 +0100 (Thu, 10 Jul 2008) | 1 line
Speed is now displayed as '-' when 0 or download has stopped
........
r4580 | mikeL | 2008-07-11 02:10:57 +0100 (Fri, 11 Jul 2008) | 1 line
Added two download related options (Download directory & Clear completed downloads) and a Downloads tab to the preferences dialog. Also moved the option to ask when overwriting files to Downloads tab. Added another option to the pre-download dialog, Save, which downloads the file immediately to your 'Download directory'
........
r4581 | mikeL | 2008-07-11 02:26:00 +0100 (Fri, 11 Jul 2008) | 1 line
Rearranged pre-download dialog buttons to conform to the HIG
........
r4616 | mikeL | 2008-07-11 19:54:12 +0100 (Fri, 11 Jul 2008) | 1 line
Limited download window updates to a user-defined variable that can be set in options (default is .5). Updates are now only done if the download window is visible. This greatly reduces the cpu usage.
........
r4617 | mikeL | 2008-07-11 20:07:48 +0100 (Fri, 11 Jul 2008) | 1 line
Removed unnecessary update limit option (it is now fixed at .5)
........
r4629 | mikeL | 2008-07-13 04:21:07 +0100 (Sun, 13 Jul 2008) | 1 line
Reorganized button sensitivity functions. Sensitivities are now updated when the selection changes as well as when a selected download's state changes.
........
r4635 | mikeL | 2008-07-13 17:00:05 +0100 (Sun, 13 Jul 2008) | 1 line
Added error handling. Added word-wrap to the "info" cell renderer so that to keep everything under control. Fixed bug where downloads would always go to you default folder (missing breaks).
........
r4642 | mikeL | 2008-07-13 21:46:09 +0100 (Sun, 13 Jul 2008) | 1 line
Added time remaining column. Fixed regression where the download info would be erased upon completion/cancelation.
........
r4655 | mikeL | 2008-07-14 23:20:33 +0100 (Mon, 14 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. When it is closed (when NS shuts down) all incomplete downloads are canceled (and the files deleted). Added a warning dialog when netsurf tries to close with incomplete downloads. Fixed bug where default save directory would initialize to NULL.
........
r4676 | mikeL | 2008-07-15 21:01:17 +0100 (Tue, 15 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. (This is the second half of the patch, last commit was only partial for some reason)
........
r4678 | mikeL | 2008-07-16 01:18:52 +0100 (Wed, 16 Jul 2008) | 1 line
Addresses almost all of rjek and jmb's concerns, fixes most of the sloppiness that was present earlier. Downloads without a total_size are now handled correctly (thanks tlsa). Changes to the default download directly are now saved correctly. Billions of other small bugs fixed
........
svn path=/trunk/netsurf/; revision=4681
2008-07-16 14:19:30 +04:00
|
|
|
if ((mouse & BROWSER_MOUSE_PRESS_1) &&
|
2005-08-21 14:52:17 +04:00
|
|
|
!(mouse & (BROWSER_MOUSE_MOD_1 |
|
|
|
|
BROWSER_MOUSE_MOD_2))) {
|
2004-07-18 03:32:09 +04:00
|
|
|
browser_window_input_click(bw,
|
2004-07-19 18:31:31 +04:00
|
|
|
gadget_box,
|
|
|
|
gadget_box_x,
|
|
|
|
gadget_box_y,
|
|
|
|
x - gadget_box_x,
|
|
|
|
y - gadget_box_y);
|
2005-04-15 09:52:25 +04:00
|
|
|
}
|
2008-04-08 16:40:05 +04:00
|
|
|
if (text_box) {
|
2006-02-16 02:09:55 +03:00
|
|
|
int pixel_offset;
|
2008-02-25 20:58:00 +03:00
|
|
|
size_t idx;
|
2006-02-16 02:09:55 +03:00
|
|
|
|
2008-04-07 13:00:21 +04:00
|
|
|
if (mouse & (BROWSER_MOUSE_DRAG_1 |
|
2008-02-25 20:58:00 +03:00
|
|
|
BROWSER_MOUSE_DRAG_2))
|
2005-07-21 03:27:28 +04:00
|
|
|
selection_init(bw->sel, gadget_box);
|
|
|
|
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
nsfont.font_position_in_string(text_box->style,
|
2006-02-16 02:09:55 +03:00
|
|
|
text_box->text,
|
|
|
|
text_box->length,
|
Merged revisions 4282-4285,4288-4293,4297-4298,4307,4309-4313,4322,4324-4680 via svnmerge from
svn://svn.netsurf-browser.org/branches/mikeL/netsurf
........
r4432 | mikeL | 2008-06-24 04:00:36 +0100 (Tue, 24 Jun 2008) | 1 line
Drag events are now emited from where the press originated, instead of from where they became a drag
........
r4433 | mikeL | 2008-06-24 04:25:33 +0100 (Tue, 24 Jun 2008) | 1 line
Added accelerator to 'Select All'
........
r4495 | mikeL | 2008-07-02 21:36:32 +0100 (Wed, 02 Jul 2008) | 1 line
Selections are now deleted and replaced when a key is typed in a text area or text box. All input box behavior while a selection is active is now implemented (ex: pressing the right arrow key moves the caret to the end of the selection). Cut now works properly in both versions. Fixed discrepancy between where the caret was placed and selection began when starting a drag-select. Fixed bug with calculation of a selections end box.
........
r4496 | mikeL | 2008-07-02 22:11:24 +0100 (Wed, 02 Jul 2008) | 1 line
Added support for cut in input boxes
........
r4497 | mikeL | 2008-07-02 22:21:35 +0100 (Wed, 02 Jul 2008) | 1 line
Removed unused variables (Thanks tlsa)
........
r4498 | mikeL | 2008-07-02 23:30:30 +0100 (Wed, 02 Jul 2008) | 1 line
Modified selection clearing behavior to allow for drag-saves
........
r4499 | mikeL | 2008-07-03 00:51:50 +0100 (Thu, 03 Jul 2008) | 1 line
Fixed regression where it would take two clicks to place caret in an input (Thanks tlsa)
........
r4509 | mikeL | 2008-07-06 07:55:09 +0100 (Sun, 06 Jul 2008) | 1 line
Basic download support implemented. Only downloading of text files works
........
r4510 | mikeL | 2008-07-06 18:55:31 +0100 (Sun, 06 Jul 2008) | 1 line
Downloading of non-text files is now possible. Progress bar and size downloaded are now updated
........
r4511 | mikeL | 2008-07-06 20:46:00 +0100 (Sun, 06 Jul 2008) | 1 line
Added downloads glade file
........
r4512 | mikeL | 2008-07-06 20:47:39 +0100 (Sun, 06 Jul 2008) | 1 line
Downloads window now spawns in the center of the parent browser window
........
r4513 | mikeL | 2008-07-06 20:56:12 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed bug where backspace would be ignored if the selection began at the beginning on an input
........
r4514 | mikeL | 2008-07-06 21:26:45 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed compiler warnings by adding casts
........
r4516 | mikeL | 2008-07-06 21:32:41 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed initialization of size string, added initialization of progress
........
r4518 | mikeL | 2008-07-06 21:51:08 +0100 (Sun, 06 Jul 2008) | 1 line
Added an option for short units (with space) to human_friendly_bytesize
........
r4519 | mikeL | 2008-07-06 21:52:05 +0100 (Sun, 06 Jul 2008) | 1 line
Removed function size_to_string
........
r4520 | mikeL | 2008-07-06 22:03:11 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed pedantic error (kB instead of KB). Added missing necessary parameters to human_friendly_bytesize. Fixed incorrect bool types
........
r4521 | mikeL | 2008-07-06 22:08:15 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnecessary parameter and units list from human_friendly_bytesize
........
r4522 | mikeL | 2008-07-06 22:57:03 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnused variable
........
r4523 | mikeL | 2008-07-06 23:03:46 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed url parsing by replacing url_parse_filename with url_nice. Total size and size downloaded are now in human readable form. Speed is now calculated (roughly)
........
r4524 | mikeL | 2008-07-07 01:19:01 +0100 (Mon, 07 Jul 2008) | 1 line
Added file overwrite confirmation. Changed speed to a double
........
r4546 | mikeL | 2008-07-09 17:21:43 +0100 (Wed, 09 Jul 2008) | 1 line
Changed parameter of selection_get_end/start to a size_t instead of int and changed all offset variables to size_t as well
........
r4547 | mikeL | 2008-07-09 17:30:47 +0100 (Wed, 09 Jul 2008) | 1 line
Added action buttons to the bottom toolbar. Added ability to clear selected (and completed) downloads with a framework for other actions.
........
r4556 | jmb | 2008-07-10 00:17:24 +0100 (Thu, 10 Jul 2008) | 3 lines
A large bunch of tidying and general fixes to text input handling.
Make selection code treat password fields as inputs, too.
........
r4557 | mikeL | 2008-07-10 00:24:46 +0100 (Thu, 10 Jul 2008) | 1 line
Added functionality to gui_empty_clipboard and gui_start_selection (Thanks jmb)
........
r4573 | mikeL | 2008-07-10 16:33:27 +0100 (Thu, 10 Jul 2008) | 1 line
Removed example download. Made the list store row aware of its download and vise versa. Added new way of handling actions from the dialog (e.g. buttons) which handles all rows in the selection. Added a few memory management function calls to clean up better
........
r4577 | mikeL | 2008-07-10 21:11:51 +0100 (Thu, 10 Jul 2008) | 1 line
Download write channels now close properly. Added status column to the tree store which will change the progress bar text if a download is canceled or completed. Implemented cancel button functionality.
........
r4578 | mikeL | 2008-07-10 21:17:51 +0100 (Thu, 10 Jul 2008) | 1 line
Speed is now displayed as '-' when 0 or download has stopped
........
r4580 | mikeL | 2008-07-11 02:10:57 +0100 (Fri, 11 Jul 2008) | 1 line
Added two download related options (Download directory & Clear completed downloads) and a Downloads tab to the preferences dialog. Also moved the option to ask when overwriting files to Downloads tab. Added another option to the pre-download dialog, Save, which downloads the file immediately to your 'Download directory'
........
r4581 | mikeL | 2008-07-11 02:26:00 +0100 (Fri, 11 Jul 2008) | 1 line
Rearranged pre-download dialog buttons to conform to the HIG
........
r4616 | mikeL | 2008-07-11 19:54:12 +0100 (Fri, 11 Jul 2008) | 1 line
Limited download window updates to a user-defined variable that can be set in options (default is .5). Updates are now only done if the download window is visible. This greatly reduces the cpu usage.
........
r4617 | mikeL | 2008-07-11 20:07:48 +0100 (Fri, 11 Jul 2008) | 1 line
Removed unnecessary update limit option (it is now fixed at .5)
........
r4629 | mikeL | 2008-07-13 04:21:07 +0100 (Sun, 13 Jul 2008) | 1 line
Reorganized button sensitivity functions. Sensitivities are now updated when the selection changes as well as when a selected download's state changes.
........
r4635 | mikeL | 2008-07-13 17:00:05 +0100 (Sun, 13 Jul 2008) | 1 line
Added error handling. Added word-wrap to the "info" cell renderer so that to keep everything under control. Fixed bug where downloads would always go to you default folder (missing breaks).
........
r4642 | mikeL | 2008-07-13 21:46:09 +0100 (Sun, 13 Jul 2008) | 1 line
Added time remaining column. Fixed regression where the download info would be erased upon completion/cancelation.
........
r4655 | mikeL | 2008-07-14 23:20:33 +0100 (Mon, 14 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. When it is closed (when NS shuts down) all incomplete downloads are canceled (and the files deleted). Added a warning dialog when netsurf tries to close with incomplete downloads. Fixed bug where default save directory would initialize to NULL.
........
r4676 | mikeL | 2008-07-15 21:01:17 +0100 (Tue, 15 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. (This is the second half of the patch, last commit was only partial for some reason)
........
r4678 | mikeL | 2008-07-16 01:18:52 +0100 (Wed, 16 Jul 2008) | 1 line
Addresses almost all of rjek and jmb's concerns, fixes most of the sloppiness that was present earlier. Downloads without a total_size are now handled correctly (thanks tlsa). Changes to the default download directly are now saved correctly. Billions of other small bugs fixed
........
svn path=/trunk/netsurf/; revision=4681
2008-07-16 14:19:30 +04:00
|
|
|
x - gadget_box_x - text_box->x,
|
2006-02-16 02:09:55 +03:00
|
|
|
&idx,
|
|
|
|
&pixel_offset);
|
|
|
|
|
2008-04-07 13:00:21 +04:00
|
|
|
selection_click(bw->sel, mouse,
|
2008-02-25 20:58:00 +03:00
|
|
|
text_box->byte_offset + idx);
|
2006-02-16 02:09:55 +03:00
|
|
|
|
2005-07-21 03:27:28 +04:00
|
|
|
if (selection_dragging(bw->sel))
|
|
|
|
bw->drag_type = DRAGGING_SELECTION;
|
2005-04-15 09:52:25 +04:00
|
|
|
}
|
Merged revisions 4282-4285,4288-4293,4297-4298,4307,4309-4313,4322,4324-4680 via svnmerge from
svn://svn.netsurf-browser.org/branches/mikeL/netsurf
........
r4432 | mikeL | 2008-06-24 04:00:36 +0100 (Tue, 24 Jun 2008) | 1 line
Drag events are now emited from where the press originated, instead of from where they became a drag
........
r4433 | mikeL | 2008-06-24 04:25:33 +0100 (Tue, 24 Jun 2008) | 1 line
Added accelerator to 'Select All'
........
r4495 | mikeL | 2008-07-02 21:36:32 +0100 (Wed, 02 Jul 2008) | 1 line
Selections are now deleted and replaced when a key is typed in a text area or text box. All input box behavior while a selection is active is now implemented (ex: pressing the right arrow key moves the caret to the end of the selection). Cut now works properly in both versions. Fixed discrepancy between where the caret was placed and selection began when starting a drag-select. Fixed bug with calculation of a selections end box.
........
r4496 | mikeL | 2008-07-02 22:11:24 +0100 (Wed, 02 Jul 2008) | 1 line
Added support for cut in input boxes
........
r4497 | mikeL | 2008-07-02 22:21:35 +0100 (Wed, 02 Jul 2008) | 1 line
Removed unused variables (Thanks tlsa)
........
r4498 | mikeL | 2008-07-02 23:30:30 +0100 (Wed, 02 Jul 2008) | 1 line
Modified selection clearing behavior to allow for drag-saves
........
r4499 | mikeL | 2008-07-03 00:51:50 +0100 (Thu, 03 Jul 2008) | 1 line
Fixed regression where it would take two clicks to place caret in an input (Thanks tlsa)
........
r4509 | mikeL | 2008-07-06 07:55:09 +0100 (Sun, 06 Jul 2008) | 1 line
Basic download support implemented. Only downloading of text files works
........
r4510 | mikeL | 2008-07-06 18:55:31 +0100 (Sun, 06 Jul 2008) | 1 line
Downloading of non-text files is now possible. Progress bar and size downloaded are now updated
........
r4511 | mikeL | 2008-07-06 20:46:00 +0100 (Sun, 06 Jul 2008) | 1 line
Added downloads glade file
........
r4512 | mikeL | 2008-07-06 20:47:39 +0100 (Sun, 06 Jul 2008) | 1 line
Downloads window now spawns in the center of the parent browser window
........
r4513 | mikeL | 2008-07-06 20:56:12 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed bug where backspace would be ignored if the selection began at the beginning on an input
........
r4514 | mikeL | 2008-07-06 21:26:45 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed compiler warnings by adding casts
........
r4516 | mikeL | 2008-07-06 21:32:41 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed initialization of size string, added initialization of progress
........
r4518 | mikeL | 2008-07-06 21:51:08 +0100 (Sun, 06 Jul 2008) | 1 line
Added an option for short units (with space) to human_friendly_bytesize
........
r4519 | mikeL | 2008-07-06 21:52:05 +0100 (Sun, 06 Jul 2008) | 1 line
Removed function size_to_string
........
r4520 | mikeL | 2008-07-06 22:03:11 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed pedantic error (kB instead of KB). Added missing necessary parameters to human_friendly_bytesize. Fixed incorrect bool types
........
r4521 | mikeL | 2008-07-06 22:08:15 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnecessary parameter and units list from human_friendly_bytesize
........
r4522 | mikeL | 2008-07-06 22:57:03 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnused variable
........
r4523 | mikeL | 2008-07-06 23:03:46 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed url parsing by replacing url_parse_filename with url_nice. Total size and size downloaded are now in human readable form. Speed is now calculated (roughly)
........
r4524 | mikeL | 2008-07-07 01:19:01 +0100 (Mon, 07 Jul 2008) | 1 line
Added file overwrite confirmation. Changed speed to a double
........
r4546 | mikeL | 2008-07-09 17:21:43 +0100 (Wed, 09 Jul 2008) | 1 line
Changed parameter of selection_get_end/start to a size_t instead of int and changed all offset variables to size_t as well
........
r4547 | mikeL | 2008-07-09 17:30:47 +0100 (Wed, 09 Jul 2008) | 1 line
Added action buttons to the bottom toolbar. Added ability to clear selected (and completed) downloads with a framework for other actions.
........
r4556 | jmb | 2008-07-10 00:17:24 +0100 (Thu, 10 Jul 2008) | 3 lines
A large bunch of tidying and general fixes to text input handling.
Make selection code treat password fields as inputs, too.
........
r4557 | mikeL | 2008-07-10 00:24:46 +0100 (Thu, 10 Jul 2008) | 1 line
Added functionality to gui_empty_clipboard and gui_start_selection (Thanks jmb)
........
r4573 | mikeL | 2008-07-10 16:33:27 +0100 (Thu, 10 Jul 2008) | 1 line
Removed example download. Made the list store row aware of its download and vise versa. Added new way of handling actions from the dialog (e.g. buttons) which handles all rows in the selection. Added a few memory management function calls to clean up better
........
r4577 | mikeL | 2008-07-10 21:11:51 +0100 (Thu, 10 Jul 2008) | 1 line
Download write channels now close properly. Added status column to the tree store which will change the progress bar text if a download is canceled or completed. Implemented cancel button functionality.
........
r4578 | mikeL | 2008-07-10 21:17:51 +0100 (Thu, 10 Jul 2008) | 1 line
Speed is now displayed as '-' when 0 or download has stopped
........
r4580 | mikeL | 2008-07-11 02:10:57 +0100 (Fri, 11 Jul 2008) | 1 line
Added two download related options (Download directory & Clear completed downloads) and a Downloads tab to the preferences dialog. Also moved the option to ask when overwriting files to Downloads tab. Added another option to the pre-download dialog, Save, which downloads the file immediately to your 'Download directory'
........
r4581 | mikeL | 2008-07-11 02:26:00 +0100 (Fri, 11 Jul 2008) | 1 line
Rearranged pre-download dialog buttons to conform to the HIG
........
r4616 | mikeL | 2008-07-11 19:54:12 +0100 (Fri, 11 Jul 2008) | 1 line
Limited download window updates to a user-defined variable that can be set in options (default is .5). Updates are now only done if the download window is visible. This greatly reduces the cpu usage.
........
r4617 | mikeL | 2008-07-11 20:07:48 +0100 (Fri, 11 Jul 2008) | 1 line
Removed unnecessary update limit option (it is now fixed at .5)
........
r4629 | mikeL | 2008-07-13 04:21:07 +0100 (Sun, 13 Jul 2008) | 1 line
Reorganized button sensitivity functions. Sensitivities are now updated when the selection changes as well as when a selected download's state changes.
........
r4635 | mikeL | 2008-07-13 17:00:05 +0100 (Sun, 13 Jul 2008) | 1 line
Added error handling. Added word-wrap to the "info" cell renderer so that to keep everything under control. Fixed bug where downloads would always go to you default folder (missing breaks).
........
r4642 | mikeL | 2008-07-13 21:46:09 +0100 (Sun, 13 Jul 2008) | 1 line
Added time remaining column. Fixed regression where the download info would be erased upon completion/cancelation.
........
r4655 | mikeL | 2008-07-14 23:20:33 +0100 (Mon, 14 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. When it is closed (when NS shuts down) all incomplete downloads are canceled (and the files deleted). Added a warning dialog when netsurf tries to close with incomplete downloads. Fixed bug where default save directory would initialize to NULL.
........
r4676 | mikeL | 2008-07-15 21:01:17 +0100 (Tue, 15 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. (This is the second half of the patch, last commit was only partial for some reason)
........
r4678 | mikeL | 2008-07-16 01:18:52 +0100 (Wed, 16 Jul 2008) | 1 line
Addresses almost all of rjek and jmb's concerns, fixes most of the sloppiness that was present earlier. Downloads without a total_size are now handled correctly (thanks tlsa). Changes to the default download directly are now saved correctly. Billions of other small bugs fixed
........
svn path=/trunk/netsurf/; revision=4681
2008-07-16 14:19:30 +04:00
|
|
|
else if (mouse & BROWSER_MOUSE_PRESS_1)
|
2008-04-08 16:40:05 +04:00
|
|
|
selection_clear(bw->sel, true);
|
2004-07-18 03:32:09 +04:00
|
|
|
break;
|
|
|
|
case GADGET_HIDDEN:
|
|
|
|
/* not possible: no box generated */
|
|
|
|
break;
|
|
|
|
case GADGET_RESET:
|
|
|
|
status = messages_get("FormReset");
|
|
|
|
break;
|
|
|
|
case GADGET_FILE:
|
|
|
|
status = messages_get("FormFile");
|
|
|
|
break;
|
2009-02-20 14:39:25 +03:00
|
|
|
case GADGET_BUTTON:
|
2009-02-20 23:48:30 +03:00
|
|
|
/* This gadget cannot be activated */
|
|
|
|
status = messages_get("FormButton");
|
2009-02-20 14:39:25 +03:00
|
|
|
break;
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
} else if (object && (mouse & BROWSER_MOUSE_MOD_2)) {
|
|
|
|
|
|
|
|
if (mouse & BROWSER_MOUSE_DRAG_2)
|
2005-08-21 14:52:17 +04:00
|
|
|
gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, object,
|
|
|
|
bw->window);
|
2005-04-15 09:52:25 +04:00
|
|
|
else if (mouse & BROWSER_MOUSE_DRAG_1)
|
2005-08-21 14:52:17 +04:00
|
|
|
gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, object,
|
|
|
|
bw->window);
|
2005-04-15 09:52:25 +04:00
|
|
|
|
|
|
|
/* \todo should have a drag-saving object msg */
|
|
|
|
status = c->status_message;
|
|
|
|
|
2005-07-02 22:17:51 +04:00
|
|
|
} else if (url) {
|
2004-07-18 03:32:09 +04:00
|
|
|
if (title) {
|
|
|
|
snprintf(status_buffer, sizeof status_buffer, "%s: %s",
|
2005-07-02 22:17:51 +04:00
|
|
|
url, title);
|
2004-07-18 03:32:09 +04:00
|
|
|
status = status_buffer;
|
|
|
|
} else
|
|
|
|
status = url;
|
|
|
|
|
2009-02-20 22:34:40 +03:00
|
|
|
pointer = get_pointer_shape(url_box, imagemap);
|
2004-07-18 03:32:09 +04:00
|
|
|
|
2005-10-31 00:22:37 +03:00
|
|
|
if (mouse & BROWSER_MOUSE_CLICK_1 &&
|
|
|
|
mouse & BROWSER_MOUSE_MOD_1) {
|
|
|
|
/* force download of link */
|
|
|
|
browser_window_go_post(bw, url, 0, 0, false,
|
2007-02-03 02:08:13 +03:00
|
|
|
c->url, true, true, 0);
|
2005-10-31 00:22:37 +03:00
|
|
|
} else if (mouse & BROWSER_MOUSE_CLICK_2 &&
|
|
|
|
mouse & BROWSER_MOUSE_MOD_1) {
|
2006-07-04 23:56:37 +04:00
|
|
|
free(browser_window_href_content.url);
|
|
|
|
browser_window_href_content.url = strdup(url);
|
|
|
|
if (!browser_window_href_content.url)
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
else
|
2007-01-27 23:58:20 +03:00
|
|
|
gui_window_save_as_link(bw->window,
|
|
|
|
&browser_window_href_content);
|
2007-08-26 20:58:06 +04:00
|
|
|
|
2009-02-18 18:57:08 +03:00
|
|
|
} else if (mouse & (BROWSER_MOUSE_CLICK_1 |
|
|
|
|
BROWSER_MOUSE_CLICK_2))
|
2007-11-04 04:16:50 +03:00
|
|
|
action = ACTION_GO;
|
2005-04-15 09:52:25 +04:00
|
|
|
|
|
|
|
} else {
|
2006-02-16 02:09:55 +03:00
|
|
|
bool done = false;
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
/* frame resizing */
|
|
|
|
if (bw->parent) {
|
|
|
|
struct browser_window *parent;
|
2009-02-18 18:57:08 +03:00
|
|
|
for (parent = bw->parent; parent->parent;
|
|
|
|
parent = parent->parent);
|
|
|
|
browser_window_resize_frames(parent, mouse,
|
|
|
|
x + bw->x0, y + bw->y0,
|
2006-09-02 19:52:41 +04:00
|
|
|
&pointer, &status, &done);
|
2006-09-06 04:15:10 +04:00
|
|
|
}
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2009-02-18 18:57:08 +03:00
|
|
|
/* if clicking in the main page, remove the selection from any
|
|
|
|
* text areas */
|
2006-09-02 19:52:41 +04:00
|
|
|
if (!done) {
|
|
|
|
if (text_box &&
|
2009-02-18 18:57:08 +03:00
|
|
|
(mouse & (BROWSER_MOUSE_CLICK_1 |
|
|
|
|
BROWSER_MOUSE_CLICK_2)) &&
|
2006-09-02 19:52:41 +04:00
|
|
|
selection_root(bw->sel) != c->data.html.layout)
|
|
|
|
selection_init(bw->sel, c->data.html.layout);
|
2006-02-16 02:09:55 +03:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
if (text_box) {
|
|
|
|
int pixel_offset;
|
2008-02-25 20:58:00 +03:00
|
|
|
size_t idx;
|
2006-09-02 19:52:41 +04:00
|
|
|
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
nsfont.font_position_in_string(text_box->style,
|
2006-09-02 19:52:41 +04:00
|
|
|
text_box->text,
|
|
|
|
text_box->length,
|
|
|
|
x - text_box_x,
|
|
|
|
&idx,
|
|
|
|
&pixel_offset);
|
2006-02-16 02:09:55 +03:00
|
|
|
|
2008-04-07 13:00:21 +04:00
|
|
|
if (selection_click(bw->sel, mouse,
|
2008-02-25 20:58:00 +03:00
|
|
|
text_box->byte_offset + idx)) {
|
2008-04-07 13:00:21 +04:00
|
|
|
/* key presses must be directed at the
|
|
|
|
* main browser window, paste text
|
2008-02-25 20:58:00 +03:00
|
|
|
* operations ignored */
|
2006-09-02 19:52:41 +04:00
|
|
|
|
|
|
|
if (selection_dragging(bw->sel)) {
|
2008-04-07 13:00:21 +04:00
|
|
|
bw->drag_type =
|
2008-02-25 20:58:00 +03:00
|
|
|
DRAGGING_SELECTION;
|
2008-04-07 13:00:21 +04:00
|
|
|
status =
|
2008-02-25 20:58:00 +03:00
|
|
|
messages_get("Selecting");
|
2006-09-02 19:52:41 +04:00
|
|
|
} else
|
|
|
|
status = c->status_message;
|
|
|
|
|
|
|
|
done = true;
|
|
|
|
}
|
2006-02-16 02:09:55 +03:00
|
|
|
}
|
Merged revisions 4282-4285,4288-4293,4297-4298,4307,4309-4313,4322,4324-4680 via svnmerge from
svn://svn.netsurf-browser.org/branches/mikeL/netsurf
........
r4432 | mikeL | 2008-06-24 04:00:36 +0100 (Tue, 24 Jun 2008) | 1 line
Drag events are now emited from where the press originated, instead of from where they became a drag
........
r4433 | mikeL | 2008-06-24 04:25:33 +0100 (Tue, 24 Jun 2008) | 1 line
Added accelerator to 'Select All'
........
r4495 | mikeL | 2008-07-02 21:36:32 +0100 (Wed, 02 Jul 2008) | 1 line
Selections are now deleted and replaced when a key is typed in a text area or text box. All input box behavior while a selection is active is now implemented (ex: pressing the right arrow key moves the caret to the end of the selection). Cut now works properly in both versions. Fixed discrepancy between where the caret was placed and selection began when starting a drag-select. Fixed bug with calculation of a selections end box.
........
r4496 | mikeL | 2008-07-02 22:11:24 +0100 (Wed, 02 Jul 2008) | 1 line
Added support for cut in input boxes
........
r4497 | mikeL | 2008-07-02 22:21:35 +0100 (Wed, 02 Jul 2008) | 1 line
Removed unused variables (Thanks tlsa)
........
r4498 | mikeL | 2008-07-02 23:30:30 +0100 (Wed, 02 Jul 2008) | 1 line
Modified selection clearing behavior to allow for drag-saves
........
r4499 | mikeL | 2008-07-03 00:51:50 +0100 (Thu, 03 Jul 2008) | 1 line
Fixed regression where it would take two clicks to place caret in an input (Thanks tlsa)
........
r4509 | mikeL | 2008-07-06 07:55:09 +0100 (Sun, 06 Jul 2008) | 1 line
Basic download support implemented. Only downloading of text files works
........
r4510 | mikeL | 2008-07-06 18:55:31 +0100 (Sun, 06 Jul 2008) | 1 line
Downloading of non-text files is now possible. Progress bar and size downloaded are now updated
........
r4511 | mikeL | 2008-07-06 20:46:00 +0100 (Sun, 06 Jul 2008) | 1 line
Added downloads glade file
........
r4512 | mikeL | 2008-07-06 20:47:39 +0100 (Sun, 06 Jul 2008) | 1 line
Downloads window now spawns in the center of the parent browser window
........
r4513 | mikeL | 2008-07-06 20:56:12 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed bug where backspace would be ignored if the selection began at the beginning on an input
........
r4514 | mikeL | 2008-07-06 21:26:45 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed compiler warnings by adding casts
........
r4516 | mikeL | 2008-07-06 21:32:41 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed initialization of size string, added initialization of progress
........
r4518 | mikeL | 2008-07-06 21:51:08 +0100 (Sun, 06 Jul 2008) | 1 line
Added an option for short units (with space) to human_friendly_bytesize
........
r4519 | mikeL | 2008-07-06 21:52:05 +0100 (Sun, 06 Jul 2008) | 1 line
Removed function size_to_string
........
r4520 | mikeL | 2008-07-06 22:03:11 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed pedantic error (kB instead of KB). Added missing necessary parameters to human_friendly_bytesize. Fixed incorrect bool types
........
r4521 | mikeL | 2008-07-06 22:08:15 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnecessary parameter and units list from human_friendly_bytesize
........
r4522 | mikeL | 2008-07-06 22:57:03 +0100 (Sun, 06 Jul 2008) | 1 line
Removed unnused variable
........
r4523 | mikeL | 2008-07-06 23:03:46 +0100 (Sun, 06 Jul 2008) | 1 line
Fixed url parsing by replacing url_parse_filename with url_nice. Total size and size downloaded are now in human readable form. Speed is now calculated (roughly)
........
r4524 | mikeL | 2008-07-07 01:19:01 +0100 (Mon, 07 Jul 2008) | 1 line
Added file overwrite confirmation. Changed speed to a double
........
r4546 | mikeL | 2008-07-09 17:21:43 +0100 (Wed, 09 Jul 2008) | 1 line
Changed parameter of selection_get_end/start to a size_t instead of int and changed all offset variables to size_t as well
........
r4547 | mikeL | 2008-07-09 17:30:47 +0100 (Wed, 09 Jul 2008) | 1 line
Added action buttons to the bottom toolbar. Added ability to clear selected (and completed) downloads with a framework for other actions.
........
r4556 | jmb | 2008-07-10 00:17:24 +0100 (Thu, 10 Jul 2008) | 3 lines
A large bunch of tidying and general fixes to text input handling.
Make selection code treat password fields as inputs, too.
........
r4557 | mikeL | 2008-07-10 00:24:46 +0100 (Thu, 10 Jul 2008) | 1 line
Added functionality to gui_empty_clipboard and gui_start_selection (Thanks jmb)
........
r4573 | mikeL | 2008-07-10 16:33:27 +0100 (Thu, 10 Jul 2008) | 1 line
Removed example download. Made the list store row aware of its download and vise versa. Added new way of handling actions from the dialog (e.g. buttons) which handles all rows in the selection. Added a few memory management function calls to clean up better
........
r4577 | mikeL | 2008-07-10 21:11:51 +0100 (Thu, 10 Jul 2008) | 1 line
Download write channels now close properly. Added status column to the tree store which will change the progress bar text if a download is canceled or completed. Implemented cancel button functionality.
........
r4578 | mikeL | 2008-07-10 21:17:51 +0100 (Thu, 10 Jul 2008) | 1 line
Speed is now displayed as '-' when 0 or download has stopped
........
r4580 | mikeL | 2008-07-11 02:10:57 +0100 (Fri, 11 Jul 2008) | 1 line
Added two download related options (Download directory & Clear completed downloads) and a Downloads tab to the preferences dialog. Also moved the option to ask when overwriting files to Downloads tab. Added another option to the pre-download dialog, Save, which downloads the file immediately to your 'Download directory'
........
r4581 | mikeL | 2008-07-11 02:26:00 +0100 (Fri, 11 Jul 2008) | 1 line
Rearranged pre-download dialog buttons to conform to the HIG
........
r4616 | mikeL | 2008-07-11 19:54:12 +0100 (Fri, 11 Jul 2008) | 1 line
Limited download window updates to a user-defined variable that can be set in options (default is .5). Updates are now only done if the download window is visible. This greatly reduces the cpu usage.
........
r4617 | mikeL | 2008-07-11 20:07:48 +0100 (Fri, 11 Jul 2008) | 1 line
Removed unnecessary update limit option (it is now fixed at .5)
........
r4629 | mikeL | 2008-07-13 04:21:07 +0100 (Sun, 13 Jul 2008) | 1 line
Reorganized button sensitivity functions. Sensitivities are now updated when the selection changes as well as when a selected download's state changes.
........
r4635 | mikeL | 2008-07-13 17:00:05 +0100 (Sun, 13 Jul 2008) | 1 line
Added error handling. Added word-wrap to the "info" cell renderer so that to keep everything under control. Fixed bug where downloads would always go to you default folder (missing breaks).
........
r4642 | mikeL | 2008-07-13 21:46:09 +0100 (Sun, 13 Jul 2008) | 1 line
Added time remaining column. Fixed regression where the download info would be erased upon completion/cancelation.
........
r4655 | mikeL | 2008-07-14 23:20:33 +0100 (Mon, 14 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. When it is closed (when NS shuts down) all incomplete downloads are canceled (and the files deleted). Added a warning dialog when netsurf tries to close with incomplete downloads. Fixed bug where default save directory would initialize to NULL.
........
r4676 | mikeL | 2008-07-15 21:01:17 +0100 (Tue, 15 Jul 2008) | 1 line
Downloads dialog is now initialized in gtk_gui.c with no parent window. The parent windows are now set when a download is created (through an extra parameter in gui_download_window_create) and when nsgtk_download_show is called. (This is the second half of the patch, last commit was only partial for some reason)
........
r4678 | mikeL | 2008-07-16 01:18:52 +0100 (Wed, 16 Jul 2008) | 1 line
Addresses almost all of rjek and jmb's concerns, fixes most of the sloppiness that was present earlier. Downloads without a total_size are now handled correctly (thanks tlsa). Changes to the default download directly are now saved correctly. Billions of other small bugs fixed
........
svn path=/trunk/netsurf/; revision=4681
2008-07-16 14:19:30 +04:00
|
|
|
else if (mouse & BROWSER_MOUSE_PRESS_1)
|
2008-04-07 13:00:21 +04:00
|
|
|
selection_clear(bw->sel, true);
|
2005-01-03 05:09:20 +03:00
|
|
|
}
|
2006-09-06 04:15:10 +04:00
|
|
|
|
2006-02-16 02:09:55 +03:00
|
|
|
if (!done) {
|
2005-04-15 09:52:25 +04:00
|
|
|
if (title)
|
|
|
|
status = title;
|
|
|
|
else if (bw->loading_content)
|
|
|
|
status = bw->loading_content->status_message;
|
|
|
|
else
|
|
|
|
status = c->status_message;
|
2004-07-18 03:32:09 +04:00
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
if (mouse & BROWSER_MOUSE_DRAG_1) {
|
|
|
|
if (mouse & BROWSER_MOUSE_MOD_2) {
|
2005-08-21 14:52:17 +04:00
|
|
|
gui_drag_save_object(GUI_SAVE_COMPLETE,
|
|
|
|
c, bw->window);
|
|
|
|
} else {
|
|
|
|
browser_window_page_drag_start(bw,
|
|
|
|
x, y);
|
2005-04-15 09:52:25 +04:00
|
|
|
pointer = GUI_POINTER_MOVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mouse & BROWSER_MOUSE_DRAG_2) {
|
|
|
|
if (mouse & BROWSER_MOUSE_MOD_2) {
|
2005-08-21 14:52:17 +04:00
|
|
|
gui_drag_save_object(GUI_SAVE_SOURCE,
|
|
|
|
c, bw->window);
|
|
|
|
} else {
|
|
|
|
browser_window_page_drag_start(bw,
|
|
|
|
x, y);
|
2005-04-15 09:52:25 +04:00
|
|
|
pointer = GUI_POINTER_MOVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-18 18:57:08 +03:00
|
|
|
if ((mouse & BROWSER_MOUSE_CLICK_1) &&
|
|
|
|
!selection_defined(bw->sel)) {
|
2009-01-30 08:07:07 +03:00
|
|
|
/* ensure key presses still act on the browser window */
|
|
|
|
browser_window_remove_caret(bw);
|
|
|
|
}
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
assert(status);
|
|
|
|
|
|
|
|
browser_window_set_status(bw, status);
|
2006-03-10 12:09:03 +03:00
|
|
|
browser_window_set_pointer(bw->window, pointer);
|
2007-11-04 04:16:50 +03:00
|
|
|
|
|
|
|
/* deferred actions that can cause this browser_window to be destroyed
|
|
|
|
and must therefore be done after set_status/pointer
|
|
|
|
*/
|
|
|
|
switch (action) {
|
2007-11-04 16:47:36 +03:00
|
|
|
case ACTION_SUBMIT:
|
|
|
|
browser_form_submit(bw,
|
2008-11-29 03:24:09 +03:00
|
|
|
browser_window_find_target(bw, target, mouse),
|
2007-11-04 16:47:36 +03:00
|
|
|
gadget->form, gadget);
|
|
|
|
break;
|
|
|
|
case ACTION_GO:
|
2008-11-29 03:24:09 +03:00
|
|
|
browser_window_go(browser_window_find_target(bw, target, mouse),
|
2007-11-04 16:47:36 +03:00
|
|
|
url, c->url, true);
|
|
|
|
break;
|
|
|
|
case ACTION_NONE:
|
|
|
|
break;
|
2007-11-04 04:16:50 +03:00
|
|
|
}
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-16 02:09:55 +03:00
|
|
|
/**
|
|
|
|
* Handle mouse clicks and movements in a TEXTPLAIN content window.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
2006-02-16 02:09:55 +03:00
|
|
|
* \param click type of mouse click
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param x coordinate of mouse
|
|
|
|
* \param y coordinate of mouse
|
2006-02-16 02:09:55 +03:00
|
|
|
*
|
|
|
|
* This function handles both hovering and clicking. It is important that the
|
|
|
|
* code path is identical (except that hovering doesn't carry out the action),
|
|
|
|
* so that the status bar reflects exactly what will happen. Having separate
|
|
|
|
* code paths opens the possibility that an attacker will make the status bar
|
|
|
|
* show some harmless action where clicking will be harmful.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_mouse_action_text(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y)
|
|
|
|
{
|
|
|
|
struct content *c = bw->current_content;
|
|
|
|
gui_pointer_shape pointer = GUI_POINTER_DEFAULT;
|
|
|
|
const char *status = 0;
|
|
|
|
size_t idx;
|
|
|
|
int dir = 0;
|
|
|
|
|
|
|
|
bw->drag_type = DRAGGING_NONE;
|
|
|
|
|
|
|
|
if (!bw->sel) return;
|
|
|
|
|
|
|
|
idx = textplain_offset_from_coords(c, x, y, dir);
|
|
|
|
if (selection_click(bw->sel, mouse, idx)) {
|
|
|
|
|
|
|
|
if (selection_dragging(bw->sel)) {
|
|
|
|
bw->drag_type = DRAGGING_SELECTION;
|
|
|
|
status = messages_get("Selecting");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
status = c->status_message;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (bw->loading_content)
|
|
|
|
status = bw->loading_content->status_message;
|
|
|
|
else
|
|
|
|
status = c->status_message;
|
|
|
|
|
|
|
|
if (mouse & (BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_2)) {
|
|
|
|
browser_window_page_drag_start(bw, x, y);
|
|
|
|
pointer = GUI_POINTER_MOVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(status);
|
|
|
|
|
|
|
|
browser_window_set_status(bw, status);
|
2006-03-10 12:09:03 +03:00
|
|
|
browser_window_set_pointer(bw->window, pointer);
|
2006-02-16 02:09:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-18 01:11:29 +04:00
|
|
|
/**
|
2005-04-15 09:52:25 +04:00
|
|
|
* Handle mouse movements in a browser window.
|
2004-10-18 01:11:29 +04:00
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
2005-04-15 09:52:25 +04:00
|
|
|
* \param mouse state of mouse buttons and modifier keys
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param x coordinate of mouse
|
|
|
|
* \param y coordinate of mouse
|
2004-10-18 01:11:29 +04:00
|
|
|
*/
|
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
void browser_window_mouse_track(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y)
|
2004-10-18 01:11:29 +04:00
|
|
|
{
|
2005-04-15 09:52:25 +04:00
|
|
|
struct content *c = bw->current_content;
|
2009-05-28 18:35:12 +04:00
|
|
|
|
|
|
|
if (c == NULL && bw->drag_type != DRAGGING_FRAME)
|
2005-08-21 14:52:17 +04:00
|
|
|
return;
|
2004-10-18 01:11:29 +04:00
|
|
|
|
2005-04-18 15:52:26 +04:00
|
|
|
/* detect end of drag operation in case the platform-specific code
|
|
|
|
doesn't call browser_mouse_drag_end() (RISC OS code does) */
|
2005-04-15 09:52:25 +04:00
|
|
|
|
|
|
|
if (bw->drag_type != DRAGGING_NONE && !mouse) {
|
|
|
|
browser_window_mouse_drag_end(bw, mouse, x, y);
|
|
|
|
}
|
2009-05-28 18:35:12 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
if (bw->drag_type == DRAGGING_FRAME) {
|
|
|
|
browser_window_resize_frame(bw, bw->x0 + x, bw->y0 + y);
|
|
|
|
} else if (bw->drag_type == DRAGGING_PAGE_SCROLL) {
|
2005-08-21 14:52:17 +04:00
|
|
|
/* mouse movement since drag started */
|
2006-09-02 19:52:41 +04:00
|
|
|
int scrollx = bw->drag_start_x - x;
|
|
|
|
int scrolly = bw->drag_start_y - y;
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2005-08-21 14:52:17 +04:00
|
|
|
/* new scroll offsets */
|
2006-09-02 19:52:41 +04:00
|
|
|
scrollx += bw->drag_start_scroll_x;
|
|
|
|
scrolly += bw->drag_start_scroll_y;
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
bw->drag_start_scroll_x = scrollx;
|
|
|
|
bw->drag_start_scroll_y = scrolly;
|
2005-04-15 09:52:25 +04:00
|
|
|
|
|
|
|
gui_window_set_scroll(bw->window, scrollx, scrolly);
|
2009-05-28 18:35:12 +04:00
|
|
|
} else {
|
|
|
|
assert(c != NULL);
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2009-05-28 18:35:12 +04:00
|
|
|
switch (c->type) {
|
|
|
|
case CONTENT_HTML:
|
|
|
|
browser_window_mouse_track_html(bw, mouse, x, y);
|
|
|
|
break;
|
2005-07-24 11:00:47 +04:00
|
|
|
|
2009-05-28 18:35:12 +04:00
|
|
|
case CONTENT_TEXTPLAIN:
|
|
|
|
browser_window_mouse_track_text(bw, mouse, x, y);
|
|
|
|
break;
|
2006-02-16 02:09:55 +03:00
|
|
|
|
2009-05-28 18:35:12 +04:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2005-04-15 09:52:25 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle mouse tracking (including drags) in an HTML content window.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
2006-02-16 02:09:55 +03:00
|
|
|
* \param mouse state of mouse buttons and modifier keys
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param x coordinate of mouse
|
|
|
|
* \param y coordinate of mouse
|
2005-04-15 09:52:25 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_mouse_track_html(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y)
|
|
|
|
{
|
|
|
|
switch (bw->drag_type) {
|
2005-07-21 03:27:28 +04:00
|
|
|
case DRAGGING_HSCROLL:
|
|
|
|
case DRAGGING_VSCROLL:
|
|
|
|
case DRAGGING_2DSCROLL: {
|
2005-04-15 09:52:25 +04:00
|
|
|
struct box *box = bw->scrolling_box;
|
2005-07-21 03:27:28 +04:00
|
|
|
int scroll_y;
|
|
|
|
int scroll_x;
|
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
assert(box);
|
2005-07-21 03:27:28 +04:00
|
|
|
|
|
|
|
if (bw->drag_type == DRAGGING_HSCROLL) {
|
|
|
|
scroll_y = box->scroll_y;
|
|
|
|
} else {
|
2006-09-02 19:52:41 +04:00
|
|
|
scroll_y = bw->drag_start_scroll_y +
|
|
|
|
(float) (y - bw->drag_start_y) /
|
|
|
|
(float) bw->drag_well_height *
|
2005-07-21 03:27:28 +04:00
|
|
|
(float) (box->descendant_y1 -
|
|
|
|
box->descendant_y0);
|
|
|
|
if (scroll_y < box->descendant_y0)
|
|
|
|
scroll_y = box->descendant_y0;
|
2009-02-18 18:57:08 +03:00
|
|
|
else if (box->descendant_y1 - box->height <
|
|
|
|
scroll_y)
|
|
|
|
scroll_y = box->descendant_y1 -
|
|
|
|
box->height;
|
2005-07-21 03:27:28 +04:00
|
|
|
if (scroll_y == box->scroll_y)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bw->drag_type == DRAGGING_VSCROLL) {
|
|
|
|
scroll_x = box->scroll_x;
|
|
|
|
} else {
|
2006-09-02 19:52:41 +04:00
|
|
|
scroll_x = bw->drag_start_scroll_x +
|
|
|
|
(float) (x - bw->drag_start_x) /
|
|
|
|
(float) bw->drag_well_width *
|
2005-07-21 03:27:28 +04:00
|
|
|
(float) (box->descendant_x1 -
|
|
|
|
box->descendant_x0);
|
|
|
|
if (scroll_x < box->descendant_x0)
|
|
|
|
scroll_x = box->descendant_x0;
|
2009-02-18 18:57:08 +03:00
|
|
|
else if (box->descendant_x1 - box->width <
|
|
|
|
scroll_x)
|
|
|
|
scroll_x = box->descendant_x1 -
|
|
|
|
box->width;
|
2005-07-21 03:27:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
browser_window_scroll_box(bw, box, scroll_x, scroll_y);
|
2005-04-15 09:52:25 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DRAGGING_SELECTION: {
|
|
|
|
struct box *box;
|
2005-07-24 11:00:47 +04:00
|
|
|
int dir = -1;
|
2005-04-15 09:52:25 +04:00
|
|
|
int dx, dy;
|
|
|
|
|
2005-07-24 11:00:47 +04:00
|
|
|
if (selection_dragging_start(bw->sel)) dir = 1;
|
|
|
|
|
2008-04-11 21:51:43 +04:00
|
|
|
box = browser_window_pick_text_box(bw, x, y, dir,
|
|
|
|
&dx, &dy);
|
2006-02-16 02:09:55 +03:00
|
|
|
if (box) {
|
|
|
|
int pixel_offset;
|
2008-02-25 20:58:00 +03:00
|
|
|
size_t idx;
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
nsfont.font_position_in_string(box->style,
|
2008-04-11 19:52:56 +04:00
|
|
|
box->text, box->length,
|
2008-08-24 17:05:53 +04:00
|
|
|
dx, &idx, &pixel_offset);
|
2006-02-16 02:09:55 +03:00
|
|
|
|
2008-04-07 13:00:21 +04:00
|
|
|
selection_track(bw->sel, mouse,
|
2008-02-25 20:58:00 +03:00
|
|
|
box->byte_offset + idx);
|
2006-02-16 02:09:55 +03:00
|
|
|
}
|
2005-04-15 09:52:25 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
browser_window_mouse_action_html(bw, mouse, x, y);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2006-02-16 02:09:55 +03:00
|
|
|
* Handle mouse tracking (including drags) in a TEXTPLAIN content window.
|
2005-04-15 09:52:25 +04:00
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
2005-04-15 09:52:25 +04:00
|
|
|
* \param mouse state of mouse buttons and modifier keys
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param x coordinate of mouse
|
|
|
|
* \param y coordinate of mouse
|
2005-04-15 09:52:25 +04:00
|
|
|
*/
|
|
|
|
|
2006-02-16 02:09:55 +03:00
|
|
|
void browser_window_mouse_track_text(struct browser_window *bw,
|
2005-04-15 09:52:25 +04:00
|
|
|
browser_mouse_state mouse, int x, int y)
|
|
|
|
{
|
|
|
|
switch (bw->drag_type) {
|
2006-02-16 02:09:55 +03:00
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
case DRAGGING_SELECTION: {
|
2006-02-16 02:09:55 +03:00
|
|
|
struct content *c = bw->current_content;
|
2005-07-24 11:00:47 +04:00
|
|
|
int dir = -1;
|
2006-02-16 02:09:55 +03:00
|
|
|
size_t idx;
|
2005-07-24 11:00:47 +04:00
|
|
|
|
|
|
|
if (selection_dragging_start(bw->sel)) dir = 1;
|
|
|
|
|
2006-02-16 02:09:55 +03:00
|
|
|
idx = textplain_offset_from_coords(c, x, y, dir);
|
|
|
|
selection_track(bw->sel, mouse, idx);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
browser_window_mouse_action_text(bw, mouse, x, y);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles the end of a drag operation in a browser window.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
2006-02-16 02:09:55 +03:00
|
|
|
* \param mouse state of mouse buttons and modifier keys
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param x coordinate of mouse
|
|
|
|
* \param y coordinate of mouse
|
2006-02-16 02:09:55 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_mouse_drag_end(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y)
|
|
|
|
{
|
|
|
|
switch (bw->drag_type) {
|
|
|
|
case DRAGGING_SELECTION: {
|
|
|
|
struct content *c = bw->current_content;
|
|
|
|
if (c) {
|
|
|
|
bool found = true;
|
|
|
|
int dir = -1;
|
2008-02-25 20:58:00 +03:00
|
|
|
size_t idx;
|
2006-02-16 02:09:55 +03:00
|
|
|
|
|
|
|
if (selection_dragging_start(bw->sel)) dir = 1;
|
|
|
|
|
|
|
|
if (c->type == CONTENT_HTML) {
|
|
|
|
int pixel_offset;
|
|
|
|
struct box *box;
|
|
|
|
int dx, dy;
|
|
|
|
|
2008-04-11 19:52:56 +04:00
|
|
|
box = browser_window_pick_text_box(bw,
|
2008-04-11 21:51:43 +04:00
|
|
|
x, y, dir, &dx, &dy);
|
2006-02-16 02:09:55 +03:00
|
|
|
if (box) {
|
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'.
Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from
svn://svn.netsurf-browser.org/branches/adamblokus/netsurf
........
r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines
Pdf plotting skeleton pinned on Print Preview in GTK.
Just creates a file and draws lines.
........
r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines
Pdf plotter - added drawing some graphic primitives.
Still with limited functionality, but a snapshot of the
currently viewed page can be made and resembles the original.
........
r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines
Corrected encoding name
........
r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines
Colours and polygons added.
........
r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines
Added rectangles, filled boxes and clipping.
Taken into consideration joty's comments.
Added a todo list for this part.
Added some debug stuff and checking boundaries.
........
r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines
Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles
........
r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines
Some more options in graphic primitives and normalizing some parameters.
........
r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines
Plotting changed as jmb suggested (is the least invasive one from the possible)
Added dummy bitmap plotting - way of plotting an image is determined by its type.
........
r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines
Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;)
........
r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines
Added hadling images other than png and jpeg - with transparency.
........
r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
........
r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines
Added a first prototype of the paged-output organization.
Still not sure about naming, file locations etc.
Works with the same pdf plotting as before.
........
r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines
Added primitive width adjustment and outputing the whole
website in multiple pages.
........
r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line
Fix RISC OS build failure (change r4235 wasn't complete).
........
r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines
This enables "Export PDF" in RISC OS build:
- Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT
- Makefile.sources(S_PDF): Add to RISC OS target as well.
- utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have
PDF export functionality or not.
- riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made
by Adam Blokus to write a PDF file under RISC OS.
- riscos/save.c: Call save_as_pdf added.
- riscos/menus.c: Add 'Export->PDF' menu entry.
- riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF.
- desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF.
- desktop/print.c(print_run): Added return value.
- Makefile(CCACHE): Moved closed to the place where CC is set for the first time.
(LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs.
........
r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines
Added margins and page size adjustment.
........
r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines
Added 'fuzzy' margins on page bottom.
Disabled direct png embedding, because it is too unstable in Haru now.
........
r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines
Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path.
........
r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines
Added skeleton of applying loose layout.
Minor code cleaning-up.
........
r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines
Implemented the elementar ideas of the loose layout.
Added scaling in the printing routine.
Added some basic demonstrations.
........
r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines
Cleaned up the loosing code - commited to much of leftover rubbish code.
........
r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines
Added duplicating box tree and current content - window flickering during printing solved.
Minor error checking after new HPDF_Image_AddSMask call.
........
r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines
Changes in loosen layout (image resizing).
........
r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines
Added pdf font handling and rendering functions with the use of Haru functions.
........
r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines
Added a very basic and still buggy GTK print implementation.
........
r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines
Added gtk printing one more time - I have forgotten to add the main file.
........
r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines
removed error with comment
........
r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines
Major style improvements - added a lot of doxygen comments,
followed tlsa's style guide.
Added some more error checking, too.
........
r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines
Cleaned up the code.
........
r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines
Changed everything according to jmb's review plus some minor bug fixes to gtk_print.
........
r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines
Solved the netsurf.glade clash from r4421.
........
r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug with wrong number of pages in gtk printing.
........
r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines
- fixed uncommented line from the previous commit
- fixed bug with scale bigger than 1.0 (incorretly clipped page)
........
r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines
Fixed bug in gtk_print_font_paint (and nsfont_paint).
........
r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines
Bug fix in nsfont_paint.
........
r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines
Added gtk_selection files.
........
r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines
Addam missing glade files.
........
r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line
Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions.
........
r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line
Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS.
........
r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines
Applied changes according to joty's review.
Added checking the dimensions of a plotted image to pdf plotter.
Commented out jpg embedding (it seems to cause some problems
I'll bring it back when I figure out what's wrong) .
Added back some files removed by mistake.
........
svn path=/trunk/netsurf/; revision=4741
2008-07-26 20:01:59 +04:00
|
|
|
nsfont.font_position_in_string(
|
2008-02-25 20:58:00 +03:00
|
|
|
box->style,
|
2006-02-16 02:09:55 +03:00
|
|
|
box->text,
|
|
|
|
box->length,
|
|
|
|
dx,
|
|
|
|
&idx,
|
|
|
|
&pixel_offset);
|
|
|
|
|
|
|
|
idx += box->byte_offset;
|
2008-02-25 20:58:00 +03:00
|
|
|
selection_track(bw->sel, mouse,
|
|
|
|
idx);
|
2006-02-16 02:09:55 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
found = false;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
assert(c->type == CONTENT_TEXTPLAIN);
|
2009-03-31 15:06:09 +04:00
|
|
|
idx = textplain_offset_from_coords(c, x,
|
|
|
|
y, dir);
|
2006-02-16 02:09:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (found)
|
|
|
|
selection_track(bw->sel, mouse, idx);
|
|
|
|
}
|
|
|
|
selection_drag_end(bw->sel);
|
2005-07-24 11:00:47 +04:00
|
|
|
}
|
|
|
|
break;
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2005-07-21 03:27:28 +04:00
|
|
|
case DRAGGING_2DSCROLL:
|
2005-04-17 01:44:37 +04:00
|
|
|
case DRAGGING_PAGE_SCROLL:
|
2006-09-02 19:52:41 +04:00
|
|
|
case DRAGGING_FRAME:
|
2009-03-31 15:06:09 +04:00
|
|
|
browser_window_set_pointer(bw->window,
|
|
|
|
GUI_POINTER_DEFAULT);
|
2005-04-17 01:44:37 +04:00
|
|
|
break;
|
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
bw->drag_type = DRAGGING_NONE;
|
2004-10-18 01:11:29 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-20 03:02:56 +03:00
|
|
|
/**
|
|
|
|
* Handle mouse clicks in a box scrollbar.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
2005-04-15 09:52:25 +04:00
|
|
|
* \param mouse state of mouse buttons and modifier keys
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param box scrolling box
|
2004-11-20 03:02:56 +03:00
|
|
|
* \param box_x position of box in global document coordinates
|
|
|
|
* \param box_y position of box in global document coordinates
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param x coordinate of click relative to box position
|
|
|
|
* \param y coordinate of click relative to box position
|
2004-11-20 03:02:56 +03:00
|
|
|
* \return status bar message
|
|
|
|
*/
|
|
|
|
|
|
|
|
const char *browser_window_scrollbar_click(struct browser_window *bw,
|
2005-04-15 09:52:25 +04:00
|
|
|
browser_mouse_state mouse, struct box *box,
|
2004-11-20 03:02:56 +03:00
|
|
|
int box_x, int box_y, int x, int y)
|
|
|
|
{
|
2008-06-06 22:23:40 +04:00
|
|
|
bool but1 = ((mouse & BROWSER_MOUSE_PRESS_1) ||
|
2008-06-06 17:58:56 +04:00
|
|
|
((mouse & BROWSER_MOUSE_HOLDING_1) &&
|
2008-06-06 22:26:26 +04:00
|
|
|
(mouse & BROWSER_MOUSE_DRAG_ON)));
|
2008-06-06 22:23:40 +04:00
|
|
|
bool but2 = ((mouse & BROWSER_MOUSE_PRESS_2) ||
|
2008-06-06 17:58:56 +04:00
|
|
|
((mouse & BROWSER_MOUSE_HOLDING_2) &&
|
2008-06-06 22:26:26 +04:00
|
|
|
(mouse & BROWSER_MOUSE_DRAG_ON)));
|
2004-11-20 03:02:56 +03:00
|
|
|
const int w = SCROLLBAR_WIDTH;
|
|
|
|
bool vscroll, hscroll;
|
|
|
|
int well_height, bar_top, bar_height;
|
|
|
|
int well_width, bar_left, bar_width;
|
|
|
|
const char *status = 0;
|
|
|
|
bool vert;
|
|
|
|
int z, scroll, bar_start, bar_size, well_size, page;
|
|
|
|
|
|
|
|
box_scrollbar_dimensions(box,
|
|
|
|
box->padding[LEFT] + box->width + box->padding[RIGHT],
|
|
|
|
box->padding[TOP] + box->height + box->padding[BOTTOM],
|
|
|
|
w,
|
|
|
|
&vscroll, &hscroll,
|
|
|
|
&well_height, &bar_top, &bar_height,
|
|
|
|
&well_width, &bar_left, &bar_width);
|
|
|
|
|
|
|
|
/* store some data for scroll drags */
|
|
|
|
bw->scrolling_box = box;
|
2006-09-02 19:52:41 +04:00
|
|
|
bw->drag_start_x = box_x + x;
|
|
|
|
bw->drag_start_y = box_y + y;
|
|
|
|
bw->drag_start_scroll_x = box->scroll_x;
|
|
|
|
bw->drag_start_scroll_y = box->scroll_y;
|
|
|
|
bw->drag_well_width = well_width;
|
|
|
|
bw->drag_well_height = well_height;
|
2004-11-20 03:02:56 +03:00
|
|
|
|
|
|
|
/* determine which scrollbar was clicked */
|
|
|
|
if (box_vscrollbar_present(box) &&
|
|
|
|
box->padding[LEFT] + box->width < x) {
|
|
|
|
vert = true;
|
|
|
|
z = y;
|
|
|
|
scroll = box->scroll_y;
|
|
|
|
well_size = well_height;
|
|
|
|
bar_start = bar_top;
|
|
|
|
bar_size = bar_height;
|
|
|
|
page = box->height;
|
|
|
|
} else {
|
|
|
|
vert = false;
|
|
|
|
z = x;
|
|
|
|
scroll = box->scroll_x;
|
|
|
|
well_size = well_width;
|
|
|
|
bar_start = bar_left;
|
|
|
|
bar_size = bar_width;
|
|
|
|
page = box->width;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* find icon in scrollbar and calculate scroll */
|
|
|
|
if (z < w) {
|
2008-06-06 17:58:56 +04:00
|
|
|
/* on scrollbar bump arrow button */
|
2004-11-20 03:02:56 +03:00
|
|
|
status = messages_get(vert ? "ScrollUp" : "ScrollLeft");
|
2008-06-06 17:58:56 +04:00
|
|
|
if (but1)
|
2006-08-19 23:27:59 +04:00
|
|
|
scroll -= 16;
|
2008-06-06 17:58:56 +04:00
|
|
|
else if (but2)
|
|
|
|
scroll += 16;
|
2004-11-20 03:02:56 +03:00
|
|
|
} else if (z < w + bar_start + w / 4) {
|
2008-06-06 17:58:56 +04:00
|
|
|
/* in scrollbar well */
|
2004-11-20 03:02:56 +03:00
|
|
|
status = messages_get(vert ? "ScrollPUp" : "ScrollPLeft");
|
2008-06-06 17:58:56 +04:00
|
|
|
if (but1)
|
2004-11-20 03:02:56 +03:00
|
|
|
scroll -= page;
|
2008-06-06 17:58:56 +04:00
|
|
|
else if (but2)
|
2004-11-20 03:02:56 +03:00
|
|
|
scroll += page;
|
|
|
|
} else if (z < w + bar_start + bar_size - w / 4) {
|
2008-06-06 17:58:56 +04:00
|
|
|
/* in scrollbar */
|
2004-11-20 03:02:56 +03:00
|
|
|
status = messages_get(vert ? "ScrollV" : "ScrollH");
|
2005-07-21 03:27:28 +04:00
|
|
|
|
2008-06-06 22:18:08 +04:00
|
|
|
if (mouse & (BROWSER_MOUSE_HOLDING_1 |
|
|
|
|
BROWSER_MOUSE_HOLDING_2)) {
|
2005-07-21 03:27:28 +04:00
|
|
|
int x0 = 0, x1 = 0;
|
|
|
|
int y0 = 0, y1 = 0;
|
|
|
|
|
2008-06-06 22:18:08 +04:00
|
|
|
if (mouse & BROWSER_MOUSE_HOLDING_1) {
|
2005-07-21 03:27:28 +04:00
|
|
|
bw->drag_type = vert ? DRAGGING_VSCROLL :
|
|
|
|
DRAGGING_HSCROLL;
|
|
|
|
} else
|
|
|
|
bw->drag_type = DRAGGING_2DSCROLL;
|
|
|
|
|
|
|
|
/* \todo - some proper numbers please! */
|
|
|
|
if (bw->drag_type != DRAGGING_VSCROLL) {
|
|
|
|
x0 = -1024;
|
|
|
|
x1 = 1024;
|
|
|
|
}
|
|
|
|
if (bw->drag_type != DRAGGING_HSCROLL) {
|
|
|
|
y0 = -1024;
|
|
|
|
y1 = 1024;
|
|
|
|
}
|
|
|
|
gui_window_box_scroll_start(bw->window, x0, y0, x1, y1);
|
|
|
|
if (bw->drag_type == DRAGGING_2DSCROLL)
|
2006-03-10 12:09:03 +03:00
|
|
|
gui_window_hide_pointer(bw->window);
|
2005-07-21 03:27:28 +04:00
|
|
|
}
|
2004-11-20 03:02:56 +03:00
|
|
|
} else if (z < w + well_size) {
|
2008-06-06 17:58:56 +04:00
|
|
|
/* in scrollbar well */
|
2004-11-20 03:02:56 +03:00
|
|
|
status = messages_get(vert ? "ScrollPDown" : "ScrollPRight");
|
2008-06-06 17:58:56 +04:00
|
|
|
if (but1)
|
2004-11-20 03:02:56 +03:00
|
|
|
scroll += page;
|
2008-06-06 17:58:56 +04:00
|
|
|
else if (but2)
|
2004-11-20 03:02:56 +03:00
|
|
|
scroll -= page;
|
|
|
|
} else {
|
2008-06-06 17:58:56 +04:00
|
|
|
/* on scrollbar bump arrow button */
|
2004-11-20 03:02:56 +03:00
|
|
|
status = messages_get(vert ? "ScrollDown" : "ScrollRight");
|
2008-06-06 17:58:56 +04:00
|
|
|
if (but1)
|
2006-08-19 23:27:59 +04:00
|
|
|
scroll += 16;
|
2008-06-06 17:58:56 +04:00
|
|
|
else if (but2)
|
|
|
|
scroll -= 16;
|
2004-11-20 03:02:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* update box and redraw */
|
|
|
|
if (vert) {
|
|
|
|
if (scroll < box->descendant_y0)
|
|
|
|
scroll = box->descendant_y0;
|
|
|
|
else if (box->descendant_y1 - box->height < scroll)
|
|
|
|
scroll = box->descendant_y1 - box->height;
|
2005-07-21 03:27:28 +04:00
|
|
|
if (scroll != box->scroll_y)
|
2009-03-31 15:06:09 +04:00
|
|
|
browser_window_scroll_box(bw, box, box->scroll_x,
|
|
|
|
scroll);
|
2005-07-21 03:27:28 +04:00
|
|
|
|
2004-11-20 03:02:56 +03:00
|
|
|
} else {
|
|
|
|
if (scroll < box->descendant_x0)
|
|
|
|
scroll = box->descendant_x0;
|
|
|
|
else if (box->descendant_x1 - box->width < scroll)
|
|
|
|
scroll = box->descendant_x1 - box->width;
|
2005-07-21 03:27:28 +04:00
|
|
|
if (scroll != box->scroll_x)
|
2009-03-31 15:06:09 +04:00
|
|
|
browser_window_scroll_box(bw, box, scroll,
|
|
|
|
box->scroll_y);
|
2004-11-20 03:02:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
/**
|
|
|
|
* Set a radio form control and clear the others in the group.
|
|
|
|
*
|
|
|
|
* \param content content containing the form, of type CONTENT_TYPE
|
|
|
|
* \param radio form control of type GADGET_RADIO
|
|
|
|
*/
|
2004-07-18 03:32:09 +04:00
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
void browser_radio_set(struct content *content,
|
|
|
|
struct form_control *radio)
|
2002-12-31 01:56:30 +03:00
|
|
|
{
|
2004-07-18 21:38:01 +04:00
|
|
|
struct form_control *control;
|
|
|
|
|
2004-11-20 03:02:56 +03:00
|
|
|
assert(content);
|
|
|
|
assert(radio);
|
|
|
|
if (!radio->form)
|
2004-09-30 20:48:04 +04:00
|
|
|
return;
|
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
if (radio->selected)
|
2002-12-31 01:56:30 +03:00
|
|
|
return;
|
2004-07-18 21:38:01 +04:00
|
|
|
|
|
|
|
for (control = radio->form->controls; control;
|
|
|
|
control = control->next) {
|
|
|
|
if (control->type != GADGET_RADIO)
|
|
|
|
continue;
|
|
|
|
if (control == radio)
|
|
|
|
continue;
|
|
|
|
if (strcmp(control->name, radio->name) != 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (control->selected) {
|
|
|
|
control->selected = false;
|
|
|
|
browser_redraw_box(content, control->box);
|
2002-12-31 01:56:30 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
radio->selected = true;
|
|
|
|
browser_redraw_box(content, radio->box);
|
2002-12-31 01:56:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
/**
|
|
|
|
* Redraw a rectangular region of a browser window
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window to be redrawn
|
|
|
|
* \param x x co-ord of top-left
|
|
|
|
* \param y y co-ord of top-left
|
2005-04-15 09:52:25 +04:00
|
|
|
* \param width width of rectangle
|
|
|
|
* \param height height of rectangle
|
|
|
|
*/
|
|
|
|
|
2005-07-24 11:00:47 +04:00
|
|
|
void browser_window_redraw_rect(struct browser_window *bw, int x, int y,
|
|
|
|
int width, int height)
|
2005-04-15 09:52:25 +04:00
|
|
|
{
|
|
|
|
struct content *c = bw->current_content;
|
|
|
|
|
2006-02-16 02:09:55 +03:00
|
|
|
if (c) {
|
2005-04-15 09:52:25 +04:00
|
|
|
union content_msg_data data;
|
2005-04-15 22:00:21 +04:00
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
data.redraw.x = x;
|
|
|
|
data.redraw.y = y;
|
|
|
|
data.redraw.width = width;
|
|
|
|
data.redraw.height = height;
|
2005-04-15 22:00:21 +04:00
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
data.redraw.full_redraw = true;
|
2005-04-15 22:00:21 +04:00
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
data.redraw.object = c;
|
|
|
|
data.redraw.object_x = 0;
|
|
|
|
data.redraw.object_y = 0;
|
|
|
|
data.redraw.object_width = c->width;
|
|
|
|
data.redraw.object_height = c->height;
|
2005-04-15 22:00:21 +04:00
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
content_broadcast(c, CONTENT_MSG_REDRAW, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
/**
|
|
|
|
* Redraw a box.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param c content containing the box, of type CONTENT_HTML
|
2004-07-18 21:38:01 +04:00
|
|
|
* \param box box to redraw
|
|
|
|
*/
|
2003-04-12 16:38:32 +04:00
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
void browser_redraw_box(struct content *c, struct box *box)
|
|
|
|
{
|
|
|
|
int x, y;
|
2008-08-24 17:05:53 +04:00
|
|
|
union content_msg_data data;
|
2002-12-31 01:56:30 +03:00
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
box_coords(box, &x, &y);
|
2002-12-31 01:56:30 +03:00
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
data.redraw.x = x;
|
|
|
|
data.redraw.y = y;
|
2004-10-18 01:11:29 +04:00
|
|
|
data.redraw.width = box->padding[LEFT] + box->width +
|
|
|
|
box->padding[RIGHT];
|
|
|
|
data.redraw.height = box->padding[TOP] + box->height +
|
|
|
|
box->padding[BOTTOM];
|
2004-07-18 21:38:01 +04:00
|
|
|
|
|
|
|
data.redraw.full_redraw = true;
|
2002-12-31 01:56:30 +03:00
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
data.redraw.object = c;
|
|
|
|
data.redraw.object_x = 0;
|
|
|
|
data.redraw.object_y = 0;
|
|
|
|
data.redraw.object_width = c->width;
|
|
|
|
data.redraw.object_height = c->height;
|
2002-12-31 01:56:30 +03:00
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
content_broadcast(c, CONTENT_MSG_REDRAW, data);
|
|
|
|
}
|
2002-12-31 01:56:30 +03:00
|
|
|
|
2003-09-23 01:55:08 +04:00
|
|
|
|
2005-07-21 03:27:28 +04:00
|
|
|
/**
|
|
|
|
* Update the scroll offsets of a box within a browser window
|
|
|
|
* (In future, copying where possible, rather than redrawing the entire box)
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
|
|
|
* \param box box to be updated
|
2005-07-21 03:27:28 +04:00
|
|
|
* \param scroll_x new horizontal scroll offset
|
|
|
|
* \param scroll_y new vertical scroll offset
|
|
|
|
*/
|
|
|
|
|
2005-07-24 11:00:47 +04:00
|
|
|
void browser_window_scroll_box(struct browser_window *bw, struct box *box,
|
|
|
|
int scroll_x, int scroll_y)
|
2005-07-21 03:27:28 +04:00
|
|
|
{
|
|
|
|
box->scroll_x = scroll_x;
|
|
|
|
box->scroll_y = scroll_y;
|
|
|
|
|
|
|
|
/* fall back to redrawing the whole box */
|
|
|
|
browser_redraw_box(bw->current_content, box);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-18 03:32:09 +04:00
|
|
|
/**
|
|
|
|
* Process a selection from a form select menu.
|
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window with menu
|
2004-07-18 03:32:09 +04:00
|
|
|
* \param control form control with menu
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param item index of item selected from the menu
|
2004-07-18 03:32:09 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_form_select(struct browser_window *bw,
|
|
|
|
struct form_control *control, int item)
|
2002-09-11 18:24:02 +04:00
|
|
|
{
|
2008-07-29 13:28:45 +04:00
|
|
|
struct box *inline_box;
|
2004-07-18 03:32:09 +04:00
|
|
|
struct form_option *o;
|
|
|
|
int count;
|
2005-04-09 13:57:19 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
assert(bw);
|
|
|
|
assert(control);
|
2005-04-09 13:57:19 +04:00
|
|
|
|
2008-07-29 13:28:45 +04:00
|
|
|
inline_box = control->box->children->children;
|
2004-07-18 03:32:09 +04:00
|
|
|
|
|
|
|
for (count = 0, o = control->data.select.items;
|
|
|
|
o != NULL;
|
|
|
|
count++, o = o->next) {
|
|
|
|
if (!control->data.select.multiple)
|
|
|
|
o->selected = false;
|
|
|
|
if (count == item) {
|
|
|
|
if (control->data.select.multiple) {
|
|
|
|
if (o->selected) {
|
|
|
|
o->selected = false;
|
|
|
|
control->data.select.num_selected--;
|
|
|
|
} else {
|
|
|
|
o->selected = true;
|
|
|
|
control->data.select.num_selected++;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
o->selected = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (o->selected)
|
|
|
|
control->data.select.current = o;
|
2004-02-25 18:12:58 +03:00
|
|
|
}
|
2004-07-18 03:32:09 +04:00
|
|
|
|
2005-04-09 13:47:37 +04:00
|
|
|
talloc_free(inline_box->text);
|
2004-07-18 03:32:09 +04:00
|
|
|
inline_box->text = 0;
|
|
|
|
if (control->data.select.num_selected == 0)
|
2005-04-09 13:47:37 +04:00
|
|
|
inline_box->text = talloc_strdup(bw->current_content,
|
|
|
|
messages_get("Form_None"));
|
2004-07-18 03:32:09 +04:00
|
|
|
else if (control->data.select.num_selected == 1)
|
2005-04-09 13:47:37 +04:00
|
|
|
inline_box->text = talloc_strdup(bw->current_content,
|
|
|
|
control->data.select.current->text);
|
2004-07-18 03:32:09 +04:00
|
|
|
else
|
2005-04-09 13:47:37 +04:00
|
|
|
inline_box->text = talloc_strdup(bw->current_content,
|
|
|
|
messages_get("Form_Many"));
|
2004-07-18 03:32:09 +04:00
|
|
|
if (!inline_box->text) {
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
inline_box->length = 0;
|
|
|
|
} else
|
|
|
|
inline_box->length = strlen(inline_box->text);
|
|
|
|
inline_box->width = control->box->width;
|
|
|
|
|
2004-07-19 19:02:22 +04:00
|
|
|
browser_redraw_box(bw->current_content, control->box);
|
2002-09-11 18:24:02 +04:00
|
|
|
}
|
|
|
|
|
2004-07-18 03:32:09 +04:00
|
|
|
|
2009-02-20 22:34:40 +03:00
|
|
|
gui_pointer_shape get_pointer_shape(struct box *box, bool imagemap)
|
2004-07-20 00:40:11 +04:00
|
|
|
{
|
|
|
|
gui_pointer_shape pointer;
|
2009-02-20 15:12:32 +03:00
|
|
|
struct css_style *style;
|
2004-07-20 00:40:11 +04:00
|
|
|
|
2009-02-20 15:12:32 +03:00
|
|
|
if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT)
|
|
|
|
style = box->children->style;
|
|
|
|
else
|
|
|
|
style = box->style;
|
|
|
|
|
|
|
|
assert(style);
|
|
|
|
switch (style->cursor) {
|
2009-02-18 18:57:08 +03:00
|
|
|
case CSS_CURSOR_AUTO:
|
|
|
|
if (box->href || (box->gadget &&
|
|
|
|
(box->gadget->type == GADGET_IMAGE ||
|
2009-02-20 22:34:40 +03:00
|
|
|
box->gadget->type == GADGET_SUBMIT)) ||
|
|
|
|
imagemap)
|
2009-02-18 18:57:08 +03:00
|
|
|
/* link */
|
|
|
|
pointer = GUI_POINTER_POINT;
|
|
|
|
else if (box->gadget &&
|
|
|
|
(box->gadget->type == GADGET_TEXTBOX ||
|
|
|
|
box->gadget->type == GADGET_PASSWORD ||
|
|
|
|
box->gadget->type == GADGET_TEXTAREA))
|
|
|
|
/* text input */
|
|
|
|
pointer = GUI_POINTER_CARET;
|
|
|
|
else
|
|
|
|
/* anything else */
|
|
|
|
pointer = GUI_POINTER_DEFAULT;
|
|
|
|
break;
|
2004-07-20 00:40:11 +04:00
|
|
|
case CSS_CURSOR_CROSSHAIR:
|
|
|
|
pointer = GUI_POINTER_CROSS;
|
|
|
|
break;
|
|
|
|
case CSS_CURSOR_POINTER:
|
|
|
|
pointer = GUI_POINTER_POINT;
|
|
|
|
break;
|
|
|
|
case CSS_CURSOR_MOVE:
|
|
|
|
pointer = GUI_POINTER_MOVE;
|
|
|
|
break;
|
|
|
|
case CSS_CURSOR_E_RESIZE:
|
2006-03-19 20:49:32 +03:00
|
|
|
pointer = GUI_POINTER_RIGHT;
|
|
|
|
break;
|
2004-07-20 00:40:11 +04:00
|
|
|
case CSS_CURSOR_W_RESIZE:
|
2006-03-19 20:49:32 +03:00
|
|
|
pointer = GUI_POINTER_LEFT;
|
2004-07-20 00:40:11 +04:00
|
|
|
break;
|
|
|
|
case CSS_CURSOR_N_RESIZE:
|
2006-03-19 20:49:32 +03:00
|
|
|
pointer = GUI_POINTER_UP;
|
|
|
|
break;
|
2004-07-20 00:40:11 +04:00
|
|
|
case CSS_CURSOR_S_RESIZE:
|
2006-03-19 20:49:32 +03:00
|
|
|
pointer = GUI_POINTER_DOWN;
|
2004-07-20 00:40:11 +04:00
|
|
|
break;
|
|
|
|
case CSS_CURSOR_NE_RESIZE:
|
2006-03-19 20:49:32 +03:00
|
|
|
pointer = GUI_POINTER_RU;
|
|
|
|
break;
|
2004-07-20 00:40:11 +04:00
|
|
|
case CSS_CURSOR_SW_RESIZE:
|
|
|
|
pointer = GUI_POINTER_LD;
|
|
|
|
break;
|
|
|
|
case CSS_CURSOR_SE_RESIZE:
|
|
|
|
pointer = GUI_POINTER_RD;
|
|
|
|
break;
|
2006-03-19 20:49:32 +03:00
|
|
|
case CSS_CURSOR_NW_RESIZE:
|
|
|
|
pointer = GUI_POINTER_LU;
|
|
|
|
break;
|
2004-07-20 00:40:11 +04:00
|
|
|
case CSS_CURSOR_TEXT:
|
|
|
|
pointer = GUI_POINTER_CARET;
|
|
|
|
break;
|
2006-03-19 20:49:32 +03:00
|
|
|
case CSS_CURSOR_WAIT:
|
|
|
|
pointer = GUI_POINTER_WAIT;
|
|
|
|
break;
|
|
|
|
case CSS_CURSOR_PROGRESS:
|
|
|
|
pointer = GUI_POINTER_PROGRESS;
|
2006-03-23 02:37:59 +03:00
|
|
|
break;
|
2006-03-19 20:49:32 +03:00
|
|
|
case CSS_CURSOR_NO_DROP:
|
|
|
|
pointer = GUI_POINTER_NO_DROP;
|
2006-03-23 02:37:59 +03:00
|
|
|
break;
|
2006-03-19 20:49:32 +03:00
|
|
|
case CSS_CURSOR_NOT_ALLOWED:
|
|
|
|
pointer = GUI_POINTER_NOT_ALLOWED;
|
2006-03-23 02:37:59 +03:00
|
|
|
break;
|
2006-03-19 20:49:32 +03:00
|
|
|
case CSS_CURSOR_HELP:
|
|
|
|
pointer = GUI_POINTER_HELP;
|
2006-03-23 02:37:59 +03:00
|
|
|
break;
|
2004-07-20 00:40:11 +04:00
|
|
|
default:
|
|
|
|
pointer = GUI_POINTER_DEFAULT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return pointer;
|
2004-04-03 03:12:26 +04:00
|
|
|
}
|
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2003-10-25 18:13:49 +04:00
|
|
|
/**
|
|
|
|
* Collect controls and submit a form.
|
|
|
|
*/
|
|
|
|
|
2007-04-08 03:08:31 +04:00
|
|
|
void browser_form_submit(struct browser_window *bw, struct browser_window *target,
|
2006-12-30 03:34:26 +03:00
|
|
|
struct form *form, struct form_control *submit_button)
|
2003-05-22 17:21:45 +04:00
|
|
|
{
|
2006-07-04 01:41:25 +04:00
|
|
|
char *data = 0, *url = 0;
|
2003-10-25 04:35:49 +04:00
|
|
|
struct form_successful_control *success;
|
2003-05-22 17:21:45 +04:00
|
|
|
|
2003-12-11 22:06:39 +03:00
|
|
|
assert(form);
|
2003-12-26 03:17:55 +03:00
|
|
|
assert(bw->current_content->type == CONTENT_HTML);
|
2003-12-11 22:06:39 +03:00
|
|
|
|
2004-08-08 23:13:40 +04:00
|
|
|
if (!form_successful_controls(form, submit_button, &success)) {
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
return;
|
|
|
|
}
|
2006-07-14 01:57:35 +04:00
|
|
|
|
2003-10-25 18:13:49 +04:00
|
|
|
switch (form->method) {
|
|
|
|
case method_GET:
|
2005-04-16 09:09:33 +04:00
|
|
|
data = form_url_encode(form, success);
|
2004-08-08 23:13:40 +04:00
|
|
|
if (!data) {
|
|
|
|
form_free_successful(success);
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
return;
|
|
|
|
}
|
2007-01-27 23:58:20 +03:00
|
|
|
url = calloc(1, strlen(form->action) +
|
|
|
|
strlen(data) + 2);
|
2004-12-08 03:31:11 +03:00
|
|
|
if (!url) {
|
|
|
|
form_free_successful(success);
|
2006-09-02 19:52:41 +04:00
|
|
|
free(data);
|
2004-12-08 03:31:11 +03:00
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
return;
|
|
|
|
}
|
2006-07-04 01:41:25 +04:00
|
|
|
if (form->action[strlen(form->action)-1] == '?') {
|
2004-07-20 00:40:11 +04:00
|
|
|
sprintf(url, "%s%s", form->action, data);
|
2004-02-03 02:38:02 +03:00
|
|
|
}
|
|
|
|
else {
|
2004-07-20 00:40:11 +04:00
|
|
|
sprintf(url, "%s?%s", form->action, data);
|
2004-02-03 02:38:02 +03:00
|
|
|
}
|
2007-04-08 03:08:31 +04:00
|
|
|
browser_window_go(target, url,
|
2007-01-27 23:58:20 +03:00
|
|
|
bw->current_content->url, true);
|
2004-07-20 00:40:11 +04:00
|
|
|
break;
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2004-07-20 00:40:11 +04:00
|
|
|
case method_POST_URLENC:
|
2005-04-16 09:09:33 +04:00
|
|
|
data = form_url_encode(form, success);
|
2004-08-08 23:13:40 +04:00
|
|
|
if (!data) {
|
|
|
|
form_free_successful(success);
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
return;
|
|
|
|
}
|
2007-04-08 03:08:31 +04:00
|
|
|
browser_window_go_post(target, form->action, data, 0,
|
2006-07-04 01:41:25 +04:00
|
|
|
true, bw->current_content->url,
|
2007-02-03 02:08:13 +03:00
|
|
|
false, true, 0);
|
2004-07-20 00:40:11 +04:00
|
|
|
break;
|
2003-10-25 18:13:49 +04:00
|
|
|
|
2004-07-20 00:40:11 +04:00
|
|
|
case method_POST_MULTIPART:
|
2007-04-08 03:08:31 +04:00
|
|
|
browser_window_go_post(target, form->action, 0,
|
2007-01-27 23:58:20 +03:00
|
|
|
success, true,
|
|
|
|
bw->current_content->url,
|
2007-02-03 02:08:13 +03:00
|
|
|
false, true, 0);
|
2004-07-20 00:40:11 +04:00
|
|
|
break;
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2004-07-20 00:40:11 +04:00
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2003-05-22 17:21:45 +04:00
|
|
|
|
2003-10-25 04:35:49 +04:00
|
|
|
form_free_successful(success);
|
2003-12-26 03:17:55 +03:00
|
|
|
free(data);
|
|
|
|
free(url);
|
2003-05-22 17:21:45 +04:00
|
|
|
}
|
2005-04-15 09:52:25 +04:00
|
|
|
|
|
|
|
|
2008-04-11 19:52:56 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether box is nearer mouse coordinates than current nearest box
|
|
|
|
*
|
|
|
|
* \param box box to test
|
|
|
|
* \param bx position of box, in global document coordinates
|
|
|
|
* \param by position of box, in global document coordinates
|
|
|
|
* \param x mouse point, in global document coordinates
|
|
|
|
* \param y mouse point, in global document coordinates
|
|
|
|
* \param dir direction in which to search (-1 = above-left,
|
|
|
|
* +1 = below-right)
|
|
|
|
* \param nearest nearest text box found, or NULL if none
|
2008-04-11 21:51:43 +04:00
|
|
|
* updated if box is nearer than existing nearest
|
2008-04-11 19:52:56 +04:00
|
|
|
* \param tx position of text_box, in global document coordinates
|
2008-04-11 21:51:43 +04:00
|
|
|
* updated if box is nearer than existing nearest
|
2008-04-11 19:52:56 +04:00
|
|
|
* \param ty position of text_box, in global document coordinates
|
2008-04-11 21:51:43 +04:00
|
|
|
* updated if box is nearer than existing nearest
|
2008-04-11 19:52:56 +04:00
|
|
|
* \param nr_xd distance to nearest text box found
|
2008-04-11 21:51:43 +04:00
|
|
|
* updated if box is nearer than existing nearest
|
2008-04-11 19:52:56 +04:00
|
|
|
* \param ny_yd distance to nearest text box found
|
2008-04-11 21:51:43 +04:00
|
|
|
* updated if box is nearer than existing nearest
|
2008-04-11 19:52:56 +04:00
|
|
|
* \return true if mouse point is inside box
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool browser_window_nearer_text_box(struct box *box, int bx, int by,
|
|
|
|
int x, int y, int dir, struct box **nearest, int *tx, int *ty,
|
|
|
|
int *nr_xd, int *nr_yd)
|
|
|
|
{
|
|
|
|
int w = box->padding[LEFT] + box->width + box->padding[RIGHT];
|
|
|
|
int h = box->padding[TOP] + box->height + box->padding[BOTTOM];
|
|
|
|
int y1 = by + h;
|
|
|
|
int x1 = bx + w;
|
|
|
|
int yd = INT_MAX;
|
|
|
|
int xd = INT_MAX;
|
|
|
|
|
|
|
|
if (x >= bx && x1 > x && y >= by && y1 > y) {
|
|
|
|
*nearest = box;
|
|
|
|
*tx = bx;
|
|
|
|
*ty = by;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (box->parent->list_marker != box) {
|
|
|
|
if (dir < 0) {
|
|
|
|
/* consider only those children (partly) above-left */
|
|
|
|
if (by <= y && bx < x) {
|
|
|
|
yd = y <= y1 ? 0 : y - y1;
|
|
|
|
xd = x <= x1 ? 0 : x - x1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* consider only those children (partly) below-right */
|
|
|
|
if (y1 > y && x1 > x) {
|
|
|
|
yd = y > by ? 0 : by - y;
|
|
|
|
xd = x > bx ? 0 : bx - x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* give y displacement precedence over x */
|
|
|
|
if (yd < *nr_yd || (yd == *nr_yd && xd <= *nr_xd)) {
|
|
|
|
*nr_yd = yd;
|
|
|
|
*nr_xd = xd;
|
|
|
|
*nearest = box;
|
|
|
|
*tx = bx;
|
|
|
|
*ty = by;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-24 10:13:25 +04:00
|
|
|
/**
|
2005-07-24 11:00:47 +04:00
|
|
|
* Pick the text box child of 'box' that is closest to and above-left
|
|
|
|
* (dir -ve) or below-right (dir +ve) of the point 'x,y'
|
2005-07-24 10:13:25 +04:00
|
|
|
*
|
2008-04-11 21:51:43 +04:00
|
|
|
* \param box parent box
|
|
|
|
* \param bx position of box, in global document coordinates
|
|
|
|
* \param by position of box, in global document coordinates
|
|
|
|
* \param fx position of float parent, in global document coordinates
|
|
|
|
* \param fy position of float parent, in global document coordinates
|
|
|
|
* \param x mouse point, in global document coordinates
|
|
|
|
* \param y mouse point, in global document coordinates
|
|
|
|
* \param dir direction in which to search (-1 = above-left,
|
|
|
|
* +1 = below-right)
|
|
|
|
* \param nearest nearest text box found, or NULL if none
|
|
|
|
* updated if a descendant of box is nearer than old nearest
|
|
|
|
* \param tx position of nearest, in global document coordinates
|
|
|
|
* updated if a descendant of box is nearer than old nearest
|
|
|
|
* \param ty position of nearest, in global document coordinates
|
|
|
|
* updated if a descendant of box is nearer than old nearest
|
|
|
|
* \param nr_xd distance to nearest text box found
|
|
|
|
* updated if a descendant of box is nearer than old nearest
|
|
|
|
* \param ny_yd distance to nearest text box found
|
|
|
|
* updated if a descendant of box is nearer than old nearest
|
2008-04-11 19:52:56 +04:00
|
|
|
* \return true if mouse point is inside text_box
|
2005-07-24 10:13:25 +04:00
|
|
|
*/
|
|
|
|
|
2008-04-11 19:52:56 +04:00
|
|
|
bool browser_window_nearest_text_box(struct box *box, int bx, int by,
|
2008-04-11 21:51:43 +04:00
|
|
|
int fx, int fy, int x, int y, int dir, struct box **nearest,
|
2008-04-11 19:52:56 +04:00
|
|
|
int *tx, int *ty, int *nr_xd, int *nr_yd)
|
2005-07-24 10:13:25 +04:00
|
|
|
{
|
|
|
|
struct box *child = box->children;
|
2008-04-11 19:52:56 +04:00
|
|
|
int c_bx, c_by;
|
|
|
|
int c_fx, c_fy;
|
|
|
|
bool in_box = false;
|
2005-07-24 10:13:25 +04:00
|
|
|
|
2008-04-11 21:51:43 +04:00
|
|
|
if (*nearest == NULL) {
|
2008-04-11 19:52:56 +04:00
|
|
|
*nr_xd = INT_MAX / 2; /* displacement of 'nearest so far' */
|
|
|
|
*nr_yd = INT_MAX / 2;
|
|
|
|
}
|
|
|
|
if (box->type == BOX_INLINE_CONTAINER) {
|
|
|
|
int bw = box->padding[LEFT] + box->width + box->padding[RIGHT];
|
|
|
|
int bh = box->padding[TOP] + box->height + box->padding[BOTTOM];
|
|
|
|
int b_y1 = by + bh;
|
|
|
|
int b_x1 = bx + bw;
|
|
|
|
if (x >= bx && b_x1 > x && y >= by && b_y1 > y) {
|
|
|
|
in_box = true;
|
|
|
|
}
|
|
|
|
}
|
2005-07-24 10:13:25 +04:00
|
|
|
|
2008-04-11 19:52:56 +04:00
|
|
|
while (child) {
|
|
|
|
if (child->type == BOX_FLOAT_LEFT ||
|
|
|
|
child->type == BOX_FLOAT_RIGHT) {
|
|
|
|
c_bx = fx + child->x - child->scroll_x;
|
|
|
|
c_by = fy + child->y - child->scroll_y;
|
|
|
|
} else {
|
|
|
|
c_bx = bx + child->x - child->scroll_x;
|
|
|
|
c_by = by + child->y - child->scroll_y;
|
|
|
|
}
|
|
|
|
if (child->float_children) {
|
|
|
|
c_fx = c_bx;
|
|
|
|
c_fy = c_by;
|
|
|
|
} else {
|
|
|
|
c_fx = fx;
|
|
|
|
c_fy = fy;
|
|
|
|
}
|
|
|
|
if (in_box && child->text && !child->object) {
|
|
|
|
if (browser_window_nearer_text_box(child,
|
2008-04-11 21:51:43 +04:00
|
|
|
c_bx, c_by, x, y, dir, nearest,
|
2008-04-11 19:52:56 +04:00
|
|
|
tx, ty, nr_xd, nr_yd))
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
if (child->list_marker) {
|
|
|
|
if (browser_window_nearer_text_box(
|
|
|
|
child->list_marker,
|
|
|
|
c_bx + child->list_marker->x,
|
|
|
|
c_by + child->list_marker->y,
|
2008-04-11 21:51:43 +04:00
|
|
|
x, y, dir, nearest,
|
2008-04-11 19:52:56 +04:00
|
|
|
tx, ty, nr_xd, nr_yd))
|
|
|
|
return true;
|
2005-07-24 10:13:25 +04:00
|
|
|
}
|
2008-04-11 19:52:56 +04:00
|
|
|
if (browser_window_nearest_text_box(child, c_bx, c_by,
|
2008-04-11 21:51:43 +04:00
|
|
|
c_fx, c_fy, x, y, dir, nearest, tx, ty,
|
2008-04-11 19:52:56 +04:00
|
|
|
nr_xd, nr_yd))
|
|
|
|
return true;
|
2005-07-24 10:13:25 +04:00
|
|
|
}
|
|
|
|
child = child->next;
|
|
|
|
}
|
|
|
|
|
2008-04-11 19:52:56 +04:00
|
|
|
return false;
|
2005-07-24 10:13:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-15 09:52:25 +04:00
|
|
|
/**
|
|
|
|
* Peform pick text on browser window contents to locate the box under
|
2005-07-24 11:00:47 +04:00
|
|
|
* the mouse pointer, or nearest in the given direction if the pointer is
|
|
|
|
* not over a text box.
|
2005-04-15 09:52:25 +04:00
|
|
|
*
|
2006-09-02 19:52:41 +04:00
|
|
|
* \param bw browser window
|
|
|
|
* \param x coordinate of mouse
|
|
|
|
* \param y coordinate of mouse
|
2008-04-11 21:51:43 +04:00
|
|
|
* \param dir direction to search (-1 = above-left, +1 = below-right)
|
2008-04-11 19:52:56 +04:00
|
|
|
* \param dx receives x ordinate of mouse relative to text box
|
|
|
|
* \param dy receives y ordinate of mouse relative to text box
|
2005-04-15 09:52:25 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct box *browser_window_pick_text_box(struct browser_window *bw,
|
2008-04-11 21:51:43 +04:00
|
|
|
int x, int y, int dir, int *dx, int *dy)
|
2005-04-15 09:52:25 +04:00
|
|
|
{
|
|
|
|
struct content *c = bw->current_content;
|
|
|
|
struct box *text_box = NULL;
|
|
|
|
|
2005-07-24 10:13:25 +04:00
|
|
|
if (c && c->type == CONTENT_HTML) {
|
|
|
|
struct box *box = c->data.html.layout;
|
2008-04-11 19:52:56 +04:00
|
|
|
int nr_xd, nr_yd;
|
|
|
|
int bx = box->margin[LEFT];
|
|
|
|
int by = box->margin[TOP];
|
|
|
|
int fx = bx;
|
|
|
|
int fy = by;
|
|
|
|
int tx, ty;
|
|
|
|
|
|
|
|
if (!browser_window_nearest_text_box(box, bx, by, fx, fy, x, y,
|
|
|
|
dir, &text_box, &tx, &ty, &nr_xd, &nr_yd)) {
|
|
|
|
if (text_box && text_box->text && !text_box->object) {
|
|
|
|
int w = (text_box->padding[LEFT] +
|
|
|
|
text_box->width +
|
|
|
|
text_box->padding[RIGHT]);
|
|
|
|
int h = (text_box->padding[TOP] +
|
|
|
|
text_box->height +
|
|
|
|
text_box->padding[BOTTOM]);
|
2005-07-24 11:00:47 +04:00
|
|
|
int x1, y1;
|
2005-07-24 10:13:25 +04:00
|
|
|
|
2008-04-11 19:52:56 +04:00
|
|
|
y1 = ty + h;
|
|
|
|
x1 = tx + w;
|
2005-07-24 10:13:25 +04:00
|
|
|
|
2005-07-24 11:00:47 +04:00
|
|
|
/* ensure point lies within the text box */
|
2008-04-11 19:52:56 +04:00
|
|
|
if (x < tx) x = tx;
|
|
|
|
if (y < ty) y = ty;
|
2005-07-24 10:13:25 +04:00
|
|
|
if (y > y1) y = y1;
|
|
|
|
if (x > x1) x = x1;
|
|
|
|
}
|
2005-04-15 09:52:25 +04:00
|
|
|
}
|
2005-07-24 10:13:25 +04:00
|
|
|
|
|
|
|
/* return coordinates relative to box */
|
2008-04-11 19:52:56 +04:00
|
|
|
*dx = x - tx;
|
|
|
|
*dy = y - ty;
|
2005-04-15 09:52:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return text_box;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start drag scrolling the contents of the browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \param x x ordinate of initial mouse position
|
|
|
|
* \param y y ordinate
|
|
|
|
*/
|
|
|
|
|
|
|
|
void browser_window_page_drag_start(struct browser_window *bw, int x, int y)
|
|
|
|
{
|
|
|
|
bw->drag_type = DRAGGING_PAGE_SCROLL;
|
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
bw->drag_start_x = x;
|
|
|
|
bw->drag_start_y = y;
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
gui_window_get_scroll(bw->window, &bw->drag_start_scroll_x, &bw->drag_start_scroll_y);
|
2005-04-15 09:52:25 +04:00
|
|
|
|
|
|
|
gui_window_scroll_start(bw->window);
|
|
|
|
}
|
2009-03-24 01:22:30 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check availability of Back action for a given browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \return true if Back action is available
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool browser_window_back_available(struct browser_window *bw)
|
|
|
|
{
|
|
|
|
return (bw && bw->history && history_back_available(bw->history));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check availability of Forward action for a given browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \return true if Forward action is available
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool browser_window_forward_available(struct browser_window *bw)
|
|
|
|
{
|
|
|
|
return (bw && bw->history && history_forward_available(bw->history));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check availability of Reload action for a given browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \return true if Reload action is available
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool browser_window_reload_available(struct browser_window *bw)
|
|
|
|
{
|
|
|
|
return (bw && bw->current_content && !bw->loading_content);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check availability of Stop action for a given browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \return true if Stop action is available
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool browser_window_stop_available(struct browser_window *bw)
|
|
|
|
{
|
|
|
|
return (bw && (bw->loading_content ||
|
|
|
|
(bw->current_content &&
|
|
|
|
(bw->current_content->status != CONTENT_STATUS_DONE))));
|
|
|
|
}
|