2006-11-27 20:13:24 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-11-27 20:13:24 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NETSURF_GTK_SCAFFOLDING_H
|
|
|
|
#define NETSURF_GTK_SCAFFOLDING_H 1
|
|
|
|
|
2014-02-01 16:41:23 +04:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include "utils/errors.h"
|
2006-11-27 20:13:24 +03:00
|
|
|
|
2014-05-25 03:57:48 +04:00
|
|
|
struct bitmap;
|
2014-02-01 16:41:23 +04:00
|
|
|
struct hlcache_handle;
|
|
|
|
struct gui_window;
|
2014-05-25 03:57:48 +04:00
|
|
|
struct gui_search_web_table;
|
2014-11-03 01:30:45 +03:00
|
|
|
struct nsurl;
|
2006-11-27 20:13:24 +03:00
|
|
|
|
2014-05-25 03:57:48 +04:00
|
|
|
extern struct gui_search_web_table *nsgtk_search_web_table;
|
|
|
|
|
2009-12-18 02:55:02 +03:00
|
|
|
typedef enum {
|
|
|
|
BACK_BUTTON = 0,
|
|
|
|
HISTORY_BUTTON,
|
|
|
|
FORWARD_BUTTON,
|
|
|
|
STOP_BUTTON,
|
|
|
|
RELOAD_BUTTON,
|
|
|
|
HOME_BUTTON,
|
|
|
|
URL_BAR_ITEM,
|
|
|
|
WEBSEARCH_ITEM,
|
|
|
|
THROBBER_ITEM,
|
|
|
|
NEWWINDOW_BUTTON,
|
|
|
|
NEWTAB_BUTTON,
|
|
|
|
OPENFILE_BUTTON,
|
|
|
|
CLOSETAB_BUTTON,
|
|
|
|
CLOSEWINDOW_BUTTON,
|
|
|
|
SAVEPAGE_BUTTON,
|
|
|
|
PDF_BUTTON,
|
|
|
|
PLAINTEXT_BUTTON,
|
|
|
|
DRAWFILE_BUTTON,
|
|
|
|
POSTSCRIPT_BUTTON,
|
|
|
|
PRINTPREVIEW_BUTTON,
|
|
|
|
PRINT_BUTTON,
|
|
|
|
QUIT_BUTTON,
|
|
|
|
CUT_BUTTON,
|
|
|
|
COPY_BUTTON,
|
|
|
|
PASTE_BUTTON,
|
|
|
|
DELETE_BUTTON,
|
|
|
|
SELECTALL_BUTTON,
|
|
|
|
FIND_BUTTON,
|
|
|
|
PREFERENCES_BUTTON,
|
|
|
|
ZOOMPLUS_BUTTON,
|
|
|
|
ZOOMMINUS_BUTTON,
|
|
|
|
ZOOMNORMAL_BUTTON,
|
|
|
|
FULLSCREEN_BUTTON,
|
|
|
|
VIEWSOURCE_BUTTON,
|
|
|
|
DOWNLOADS_BUTTON,
|
|
|
|
SAVEWINDOWSIZE_BUTTON,
|
|
|
|
TOGGLEDEBUGGING_BUTTON,
|
|
|
|
SAVEBOXTREE_BUTTON,
|
|
|
|
SAVEDOMTREE_BUTTON,
|
|
|
|
LOCALHISTORY_BUTTON,
|
|
|
|
GLOBALHISTORY_BUTTON,
|
|
|
|
ADDBOOKMARKS_BUTTON,
|
|
|
|
SHOWBOOKMARKS_BUTTON,
|
2010-10-05 23:14:46 +04:00
|
|
|
SHOWCOOKIES_BUTTON,
|
2009-12-18 02:55:02 +03:00
|
|
|
OPENLOCATION_BUTTON,
|
|
|
|
NEXTTAB_BUTTON,
|
|
|
|
PREVTAB_BUTTON,
|
|
|
|
CONTENTS_BUTTON,
|
|
|
|
GUIDE_BUTTON,
|
|
|
|
INFO_BUTTON,
|
|
|
|
ABOUT_BUTTON,
|
|
|
|
PLACEHOLDER_BUTTON /* size indicator; array maximum indices */
|
|
|
|
} nsgtk_toolbar_button; /* PLACEHOLDER_BUTTON - 1 */
|
|
|
|
|
|
|
|
struct gtk_history_window {
|
2014-07-27 21:06:07 +04:00
|
|
|
struct nsgtk_scaffolding *g;
|
2009-04-21 00:31:13 +04:00
|
|
|
GtkWindow *window;
|
2009-12-18 02:55:02 +03:00
|
|
|
GtkScrolledWindow *scrolled;
|
|
|
|
GtkDrawingArea *drawing_area;
|
2009-04-21 00:31:13 +04:00
|
|
|
};
|
|
|
|
|
2009-12-18 02:55:02 +03:00
|
|
|
struct gtk_search {
|
|
|
|
GtkToolbar *bar;
|
|
|
|
GtkEntry *entry;
|
|
|
|
GtkToolButton *buttons[3]; /* back, forward, */
|
|
|
|
GtkCheckButton *checkAll; /* close */
|
|
|
|
GtkCheckButton *caseSens;
|
|
|
|
};
|
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
|
|
|
|
2009-12-18 02:55:02 +03:00
|
|
|
struct nsgtk_button_connect {
|
2015-04-10 18:20:55 +03:00
|
|
|
GtkToolItem *button;
|
|
|
|
int location; /* in toolbar */
|
|
|
|
bool sensitivity;
|
|
|
|
GtkWidget *main; /* left click menu entry */
|
|
|
|
GtkWidget *rclick; /* right click menu */
|
|
|
|
GtkWidget *popup; /* popup menu entry */
|
|
|
|
void *mhandler; /* menu item clicked */
|
|
|
|
void *bhandler; /* button clicked */
|
|
|
|
void *dataplus; /* customization -> toolbar */
|
|
|
|
void *dataminus; /* customization -> store */
|
2009-12-18 02:55:02 +03:00
|
|
|
};
|
2008-08-24 14:31:38 +04:00
|
|
|
|
2014-07-25 19:29:18 +04:00
|
|
|
/**
|
|
|
|
* create a new scaffolding for a window.
|
2014-07-27 21:06:07 +04:00
|
|
|
*
|
|
|
|
* \param gw The gui window to create the new scaffold around.
|
|
|
|
* \return The newly constructed scaffold or NULL on error.
|
2014-07-25 19:29:18 +04:00
|
|
|
*/
|
2014-07-27 21:06:07 +04:00
|
|
|
struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *gw);
|
2006-11-27 20:13:24 +03:00
|
|
|
|
2014-07-25 19:29:18 +04:00
|
|
|
/**
|
|
|
|
* Obtain the most recently used scaffolding element.
|
|
|
|
*
|
|
|
|
* This allows tabs to be opened in the most recently used window
|
|
|
|
*/
|
2014-07-27 21:06:07 +04:00
|
|
|
struct nsgtk_scaffolding *nsgtk_current_scaffolding(void);
|
|
|
|
|
|
|
|
/* acessors for gtk elements withing a scaffold */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the gtk window for a scaffolding.
|
|
|
|
*/
|
|
|
|
GtkWindow *nsgtk_scaffolding_window(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the gtk notebook from a scaffold.
|
|
|
|
*/
|
|
|
|
GtkNotebook *nsgtk_scaffolding_notebook(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the gtk url bar from a scaffold.
|
|
|
|
*/
|
|
|
|
GtkWidget *nsgtk_scaffolding_urlbar(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the gtk web search entry from a scaffold.
|
|
|
|
*/
|
|
|
|
GtkWidget *nsgtk_scaffolding_websearch(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the gtk toolbar from a scaffold.
|
|
|
|
*/
|
|
|
|
GtkToolbar *nsgtk_scaffolding_toolbar(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
|
|
|
|
struct nsgtk_button_connect *nsgtk_scaffolding_button(struct nsgtk_scaffolding *g, int i);
|
|
|
|
|
|
|
|
struct gtk_search *nsgtk_scaffolding_search(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
struct gtk_history_window *nsgtk_scaffolding_history_window(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
struct gui_window *nsgtk_scaffolding_top_level(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* reset the scaffold offset value to 0.
|
|
|
|
*
|
|
|
|
* \todo The value is only ever altered in
|
|
|
|
* nsgtk_scaffolding_toolbar_size_allocate and is something to do with
|
|
|
|
* the history button either clarify or remove!
|
|
|
|
*/
|
|
|
|
void nsgtk_scaffolding_reset_offset(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Iterate through available scaffolding.
|
|
|
|
*/
|
|
|
|
struct nsgtk_scaffolding *nsgtk_scaffolding_iterate(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
void nsgtk_scaffolding_update_url_bar_ref(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
void nsgtk_scaffolding_update_throbber_ref(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
void nsgtk_scaffolding_update_websearch_ref(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
void nsgtk_scaffolding_toggle_search_bar_visibility(struct nsgtk_scaffolding *g);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the current active top level gui window.
|
|
|
|
*/
|
2009-12-18 02:55:02 +03:00
|
|
|
void nsgtk_scaffolding_set_top_level(struct gui_window *g);
|
|
|
|
|
2014-07-27 21:06:07 +04:00
|
|
|
/**
|
|
|
|
* update the sensitivity of context sensitive UI elements
|
2013-06-28 15:13:02 +04:00
|
|
|
*
|
|
|
|
* widgets altered in arrays:
|
|
|
|
* main
|
|
|
|
* right click menu
|
|
|
|
* location
|
|
|
|
* popup
|
|
|
|
* current arrays are:
|
|
|
|
* stop
|
|
|
|
* reload
|
|
|
|
* cut
|
|
|
|
* copy
|
|
|
|
* paste
|
|
|
|
* back
|
|
|
|
* forward
|
|
|
|
* nexttab
|
|
|
|
* prevtab
|
|
|
|
* closetab
|
|
|
|
*/
|
2014-07-27 21:06:07 +04:00
|
|
|
void nsgtk_scaffolding_set_sensitivity(struct nsgtk_scaffolding *g);
|
2014-07-08 02:29:06 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a context sensitive menu.
|
|
|
|
*
|
|
|
|
* \param g the scaffolding containing the browser window.
|
|
|
|
* \param x The x co-ordinate.
|
|
|
|
* \param y The y co-ordinate.
|
|
|
|
*/
|
2014-07-27 21:06:07 +04:00
|
|
|
void nsgtk_scaffolding_context_menu(struct nsgtk_scaffolding *g, gdouble x, gdouble y);
|
|
|
|
|
|
|
|
void nsgtk_scaffolding_toolbar_size_allocate(GtkWidget *widget, GtkAllocation *alloc, gpointer data);
|
|
|
|
|
2012-02-22 00:54:31 +04:00
|
|
|
void nsgtk_scaffolding_set_icon(struct gui_window *gw);
|
2009-12-18 02:55:02 +03:00
|
|
|
|
|
|
|
gboolean nsgtk_window_url_activate_event(GtkWidget *, gpointer);
|
2014-07-27 21:06:07 +04:00
|
|
|
|
2009-12-18 02:55:02 +03:00
|
|
|
gboolean nsgtk_window_url_changed(GtkWidget *, GdkEventKey *, gpointer);
|
|
|
|
|
2013-06-27 19:42:08 +04:00
|
|
|
nserror nsgtk_scaffolding_new_tab(struct gui_window *gw);
|
|
|
|
|
2014-01-12 14:27:41 +04:00
|
|
|
/* core acessors */
|
2014-11-09 01:08:29 +03:00
|
|
|
/**
|
|
|
|
* set the title in the window
|
|
|
|
*
|
|
|
|
* \param gw The gui window to set title on
|
|
|
|
* \param title The title to set which may be NULL
|
|
|
|
*/
|
|
|
|
void nsgtk_window_set_title(struct gui_window *gw, const char *title);
|
|
|
|
|
2014-11-03 01:30:45 +03:00
|
|
|
nserror gui_window_set_url(struct gui_window *g, struct nsurl *url);
|
2014-01-12 14:27:41 +04:00
|
|
|
void gui_window_start_throbber(struct gui_window *g);
|
|
|
|
void gui_window_stop_throbber(struct gui_window *g);
|
2014-05-25 03:57:48 +04:00
|
|
|
|
2015-04-12 03:12:43 +03:00
|
|
|
void nsgtk_scaffolding_toolbars(struct nsgtk_scaffolding *g, int tbi);
|
2014-01-12 14:27:41 +04:00
|
|
|
|
2006-11-27 20:13:24 +03:00
|
|
|
#endif /* NETSURF_GTK_SCAFFOLDING_H */
|