2003-08-22 01:39:07 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2005-02-25 01:00:41 +03:00
|
|
|
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
|
2003-08-22 01:39:07 +04:00
|
|
|
* Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk>
|
2005-02-07 17:28:43 +03:00
|
|
|
* Copyright 2005 Richard Wilson <info@tinct.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/>.
|
2003-08-22 01:39:07 +04:00
|
|
|
*/
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/** \file
|
|
|
|
* Menu creation and handling (implementation).
|
|
|
|
*/
|
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
#include <ctype.h>
|
2003-08-22 01:39:07 +04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2004-05-14 23:59:09 +04:00
|
|
|
#include "oslib/os.h"
|
2005-07-16 18:35:25 +04:00
|
|
|
#include "oslib/osbyte.h"
|
2004-07-28 00:44:46 +04:00
|
|
|
#include "oslib/osgbpb.h"
|
2005-07-16 18:35:25 +04:00
|
|
|
#include "oslib/territory.h"
|
2003-08-22 01:39:07 +04:00
|
|
|
#include "oslib/wimp.h"
|
2010-04-07 16:45:18 +04:00
|
|
|
#include "content/content.h"
|
|
|
|
#include "content/hlcache.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "content/urldb.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
#include "desktop/cookies.h"
|
2010-06-04 13:35:08 +04:00
|
|
|
#include "desktop/browser.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "desktop/gui.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
#include "desktop/history_global_core.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "desktop/history_core.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
#include "desktop/hotlist.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "desktop/netsurf.h"
|
2009-01-30 08:08:54 +03:00
|
|
|
#include "desktop/selection.h"
|
2009-02-01 05:19:01 +03:00
|
|
|
#include "desktop/textinput.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "render/box.h"
|
2010-06-04 13:35:08 +04:00
|
|
|
#include "render/form.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/dialog.h"
|
|
|
|
#include "render/form.h"
|
|
|
|
#include "riscos/configure.h"
|
|
|
|
#include "riscos/cookies.h"
|
|
|
|
#include "riscos/gui.h"
|
|
|
|
#include "riscos/global_history.h"
|
|
|
|
#include "riscos/help.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
#include "riscos/hotlist.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/menus.h"
|
|
|
|
#include "riscos/options.h"
|
|
|
|
#include "riscos/save.h"
|
|
|
|
#include "riscos/tinct.h"
|
|
|
|
#include "riscos/theme.h"
|
|
|
|
#include "riscos/treeview.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
#include "riscos/url_suggest.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/wimp.h"
|
|
|
|
#include "riscos/wimp_event.h"
|
|
|
|
#include "utils/log.h"
|
|
|
|
#include "utils/messages.h"
|
|
|
|
#include "utils/url.h"
|
|
|
|
#include "utils/utils.h"
|
|
|
|
#include "utils/utf8.h"
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
struct menu_definition_entry {
|
|
|
|
menu_action action; /**< menu action */
|
|
|
|
wimp_menu_entry *menu_entry; /**< corresponding menu entry */
|
2005-07-16 18:35:25 +04:00
|
|
|
const char *entry_key; /**< Messages key for entry text */
|
2005-04-08 00:46:22 +04:00
|
|
|
struct menu_definition_entry *next; /**< next menu entry */
|
2004-07-04 22:44:51 +04:00
|
|
|
};
|
2004-11-03 02:23:07 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
struct menu_definition {
|
|
|
|
wimp_menu *menu; /**< corresponding menu */
|
2005-07-16 18:35:25 +04:00
|
|
|
const char *title_key; /**< Messages key for title text */
|
|
|
|
int current_encoding; /**< Identifier for current text encoding of menu text (as per OS_Byte,71,127) */
|
2005-04-08 00:46:22 +04:00
|
|
|
struct menu_definition_entry *entries; /**< menu entries */
|
|
|
|
struct menu_definition *next; /**< next menu */
|
2004-10-05 03:54:42 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
static void ro_gui_menu_define_menu_add(struct menu_definition *definition,
|
2009-03-29 04:14:28 +04:00
|
|
|
const struct ns_menu *menu, int depth,
|
2005-07-16 18:35:25 +04:00
|
|
|
wimp_menu_entry *parent_entry,
|
2005-04-08 00:46:22 +04:00
|
|
|
int first, int last, const char *prefix, int prefix_length);
|
|
|
|
static struct menu_definition *ro_gui_menu_find_menu(wimp_menu *menu);
|
|
|
|
static struct menu_definition_entry *ro_gui_menu_find_entry(wimp_menu *menu,
|
|
|
|
menu_action action);
|
|
|
|
static menu_action ro_gui_menu_find_action(wimp_menu *menu,
|
|
|
|
wimp_menu_entry *menu_entry);
|
|
|
|
static void ro_gui_menu_get_window_details(wimp_w w, struct gui_window **g,
|
2010-04-07 18:09:13 +04:00
|
|
|
struct browser_window **bw, hlcache_handle **h,
|
2010-10-05 23:14:46 +04:00
|
|
|
struct toolbar **toolbar,
|
|
|
|
bool *is_cookies, bool *is_hotlist, bool *is_global_history);
|
2005-04-08 00:46:22 +04:00
|
|
|
static int ro_gui_menu_get_checksum(void);
|
|
|
|
static void ro_gui_menu_prepare_pageinfo(struct gui_window *g);
|
2010-04-07 18:09:13 +04:00
|
|
|
static void ro_gui_menu_prepare_objectinfo(hlcache_handle *object,
|
|
|
|
const char *href);
|
2005-07-16 18:35:25 +04:00
|
|
|
static bool ro_gui_menu_translate(struct menu_definition *menu);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* default menu item flags */
|
|
|
|
#define DEFAULT_FLAGS (wimp_ICON_TEXT | wimp_ICON_FILLED | \
|
|
|
|
(wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) | \
|
|
|
|
(wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT))
|
2004-07-04 22:44:51 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/** The currently defined menus to perform actions for */
|
|
|
|
static struct menu_definition *ro_gui_menu_definitions;
|
|
|
|
/** The current menu being worked with (may not be open) */
|
|
|
|
wimp_menu *current_menu;
|
|
|
|
/** Whether a menu is currently open */
|
2005-12-31 07:40:49 +03:00
|
|
|
bool current_menu_open = false;
|
2009-02-01 05:19:01 +03:00
|
|
|
/** Object under menu, or 0 if no object. */
|
2010-04-07 20:39:24 +04:00
|
|
|
static hlcache_handle *current_menu_object = 0;
|
2009-02-01 05:19:01 +03:00
|
|
|
/** URL of link under menu, or 0 if no link. */
|
|
|
|
static const char *current_menu_url = 0;
|
2005-04-08 00:46:22 +04:00
|
|
|
/** Menu of options for form select controls. */
|
|
|
|
static wimp_menu *gui_form_select_menu = 0;
|
|
|
|
/** Form control which gui_form_select_menu is for. */
|
|
|
|
static struct form_control *gui_form_select_control;
|
|
|
|
/** Window that owns the current menu */
|
2005-12-31 07:40:49 +03:00
|
|
|
wimp_w current_menu_window;
|
|
|
|
/** Icon that owns the current menu (only valid for popup menus) */
|
|
|
|
static wimp_i current_menu_icon;
|
2005-04-08 00:46:22 +04:00
|
|
|
/** The height of the iconbar menu */
|
|
|
|
int iconbar_menu_height = 5 * 44;
|
|
|
|
/** The available menus */
|
2010-10-05 23:14:46 +04:00
|
|
|
wimp_menu *iconbar_menu, *browser_menu, *image_quality_menu,
|
|
|
|
*browser_toolbar_menu, *tree_toolbar_menu,
|
|
|
|
*proxy_type_menu, *languages_menu;
|
|
|
|
|
|
|
|
static wimp_MENU(URL_SUGGEST_MAX_URLS) url_suggest_menu_block;
|
|
|
|
wimp_menu *url_suggest_menu = (wimp_menu *) &url_suggest_menu_block;
|
2005-02-07 17:28:43 +03:00
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
/* the values given in PRM 3-157 for how to check menus/windows are
|
2005-11-28 03:20:15 +03:00
|
|
|
* incorrect so we use a hack of checking if the sub-menu has bit 0
|
|
|
|
* set which is undocumented but true of window handles on
|
|
|
|
* all target OS versions */
|
2005-12-31 07:40:49 +03:00
|
|
|
#define IS_MENU(menu) !((int)(menu) & 1)
|
2005-11-28 03:20:15 +03:00
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
/**
|
|
|
|
* Create menu structures.
|
|
|
|
*/
|
2005-07-16 18:35:25 +04:00
|
|
|
void ro_gui_menu_init(void)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
/* iconbar menu */
|
2009-03-29 04:14:28 +04:00
|
|
|
static const struct ns_menu iconbar_definition = {
|
2005-04-08 00:46:22 +04:00
|
|
|
"NetSurf", {
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Info", NO_ACTION, &dialog_info },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "AppHelp", HELP_OPEN_CONTENTS, 0 },
|
2006-12-03 15:09:35 +03:00
|
|
|
{ "Open", BROWSER_NAVIGATE_URL, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Open.OpenURL", BROWSER_NAVIGATE_URL, &dialog_openurl },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Open.HotlistShow", HOTLIST_SHOW, 0 },
|
|
|
|
{ "Open.HistGlobal", HISTORY_SHOW_GLOBAL, 0 },
|
2006-07-13 16:46:02 +04:00
|
|
|
{ "Open.ShowCookies", COOKIES_SHOW, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Choices", CHOICES_SHOW, 0 },
|
|
|
|
{ "Quit", APPLICATION_QUIT, 0 },
|
|
|
|
{NULL, 0, 0}
|
|
|
|
}
|
|
|
|
};
|
2009-03-29 04:14:28 +04:00
|
|
|
iconbar_menu = ro_gui_menu_define_menu(&iconbar_definition);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
/* browser menu */
|
2009-03-29 04:14:28 +04:00
|
|
|
static const struct ns_menu browser_definition = {
|
2005-04-08 00:46:22 +04:00
|
|
|
"NetSurf", {
|
|
|
|
{ "Page", BROWSER_PAGE, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Page.PageInfo",BROWSER_PAGE_INFO, &dialog_pageinfo },
|
|
|
|
{ "Page.Save", BROWSER_SAVE, &dialog_saveas },
|
|
|
|
{ "Page.SaveComp", BROWSER_SAVE_COMPLETE, &dialog_saveas },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Page.Export", NO_ACTION, 0 },
|
2009-06-20 23:38:56 +04:00
|
|
|
#ifdef WITH_DRAW_EXPORT
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Page.Export.Draw", BROWSER_EXPORT_DRAW, &dialog_saveas },
|
2009-06-20 23:38:56 +04:00
|
|
|
#endif
|
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
|
|
|
#ifdef WITH_PDF_EXPORT
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Page.Export.PDF", BROWSER_EXPORT_PDF, &dialog_saveas },
|
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
|
|
|
#endif
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Page.Export.Text", BROWSER_EXPORT_TEXT, &dialog_saveas },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Page.SaveURL", NO_ACTION, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Page.SaveURL.URI", BROWSER_SAVE_URL_URI, &dialog_saveas },
|
|
|
|
{ "Page.SaveURL.URL", BROWSER_SAVE_URL_URL, &dialog_saveas },
|
|
|
|
{ "Page.SaveURL.LinkText", BROWSER_SAVE_URL_TEXT, &dialog_saveas },
|
|
|
|
{ "_Page.Print", BROWSER_PRINT, &dialog_print },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Page.NewWindow", BROWSER_NEW_WINDOW, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Page.FindText", BROWSER_FIND_TEXT, &dialog_search },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Page.ViewSrc", BROWSER_VIEW_SOURCE, 0 },
|
|
|
|
{ "Object", BROWSER_OBJECT, 0 },
|
2009-01-30 08:08:54 +03:00
|
|
|
{ "Object.Object", BROWSER_OBJECT_OBJECT, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Object.Object.ObjInfo", BROWSER_OBJECT_INFO, &dialog_objinfo },
|
|
|
|
{ "Object.Object.ObjSave", BROWSER_OBJECT_SAVE, &dialog_saveas },
|
2009-01-30 08:08:54 +03:00
|
|
|
{ "Object.Object.Export", BROWSER_OBJECT_EXPORT, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Object.Object.Export.Sprite", BROWSER_OBJECT_EXPORT_SPRITE, &dialog_saveas },
|
2009-06-20 23:38:56 +04:00
|
|
|
#ifdef WITH_DRAW_EXPORT
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Object.Object.Export.ObjDraw", BROWSER_OBJECT_EXPORT_DRAW, &dialog_saveas },
|
2009-06-20 23:38:56 +04:00
|
|
|
#endif
|
2009-01-30 08:08:54 +03:00
|
|
|
{ "Object.Object.SaveURL", NO_ACTION, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Object.Object.SaveURL.URI", BROWSER_OBJECT_SAVE_URL_URI, &dialog_saveas },
|
|
|
|
{ "Object.Object.SaveURL.URL", BROWSER_OBJECT_SAVE_URL_URL, &dialog_saveas },
|
|
|
|
{ "Object.Object.SaveURL.LinkText", BROWSER_OBJECT_SAVE_URL_TEXT, &dialog_saveas },
|
2009-02-01 05:19:01 +03:00
|
|
|
{ "Object.Object.ObjPrint", BROWSER_OBJECT_PRINT, 0 },
|
2009-01-31 06:43:06 +03:00
|
|
|
{ "Object.Object.ObjReload", BROWSER_OBJECT_RELOAD, 0 },
|
2009-01-30 08:08:54 +03:00
|
|
|
{ "Object.Link", BROWSER_OBJECT_LINK, 0 },
|
|
|
|
{ "Object.Link.LinkSave", BROWSER_LINK_SAVE, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Object.Link.LinkSave.URI", BROWSER_LINK_SAVE_URI, &dialog_saveas },
|
|
|
|
{ "Object.Link.LinkSave.URL", BROWSER_LINK_SAVE_URL, &dialog_saveas },
|
|
|
|
{ "Object.Link.LinkSave.LinkText", BROWSER_LINK_SAVE_TEXT, &dialog_saveas },
|
2009-01-30 08:08:54 +03:00
|
|
|
{ "_Object.Link.LinkDload", BROWSER_LINK_DOWNLOAD, 0 },
|
|
|
|
{ "Object.Link.LinkNew", BROWSER_LINK_NEW_WINDOW, 0 },
|
|
|
|
{ "Selection", BROWSER_SELECTION, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "_Selection.SelSave", BROWSER_SELECTION_SAVE, &dialog_saveas },
|
2009-01-30 08:08:54 +03:00
|
|
|
{ "Selection.Copy", BROWSER_SELECTION_COPY, 0 },
|
|
|
|
{ "Selection.Cut", BROWSER_SELECTION_CUT, 0 },
|
2009-02-01 05:19:01 +03:00
|
|
|
{ "_Selection.Paste", BROWSER_SELECTION_PASTE, 0 },
|
|
|
|
{ "Selection.Clear", BROWSER_SELECTION_CLEAR, 0 },
|
|
|
|
{ "Selection.SelectAll", BROWSER_SELECTION_ALL, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Navigate", NO_ACTION, 0 },
|
|
|
|
{ "Navigate.Home", BROWSER_NAVIGATE_HOME, 0 },
|
|
|
|
{ "Navigate.Back", BROWSER_NAVIGATE_BACK, 0 },
|
2006-07-04 01:07:02 +04:00
|
|
|
{ "Navigate.Forward", BROWSER_NAVIGATE_FORWARD, 0 },
|
|
|
|
{ "_Navigate.UpLevel", BROWSER_NAVIGATE_UP, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Navigate.Reload", BROWSER_NAVIGATE_RELOAD_ALL, 0 },
|
|
|
|
{ "Navigate.Stop", BROWSER_NAVIGATE_STOP, 0 },
|
|
|
|
{ "View", NO_ACTION, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "View.ScaleView", BROWSER_SCALE_VIEW, &dialog_zoom },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "View.Images", NO_ACTION, 0 },
|
|
|
|
{ "View.Images.ForeImg", BROWSER_IMAGES_FOREGROUND, 0 },
|
|
|
|
{ "View.Images.BackImg", BROWSER_IMAGES_BACKGROUND, 0 },
|
|
|
|
{ "View.Toolbars", NO_ACTION, 0 },
|
|
|
|
{ "View.Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
|
|
|
|
{ "View.Toolbars.ToolAddress", TOOLBAR_ADDRESS_BAR, 0 },
|
2006-11-30 18:30:54 +03:00
|
|
|
{ "_View.Toolbars.ToolThrob", TOOLBAR_THROBBER, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "View.Toolbars.EditToolbar", TOOLBAR_EDIT, 0 },
|
2005-07-16 18:35:25 +04:00
|
|
|
{ "_View.Render", NO_ACTION, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "View.Render.RenderAnims", BROWSER_BUFFER_ANIMS, 0 },
|
|
|
|
{ "View.Render.RenderAll", BROWSER_BUFFER_ALL, 0 },
|
2009-01-30 08:08:54 +03:00
|
|
|
{ "_View.OptDefault", BROWSER_SAVE_VIEW, 0 },
|
|
|
|
{ "View.Window", NO_ACTION, 0 },
|
|
|
|
{ "View.Window.WindowSave", BROWSER_WINDOW_DEFAULT, 0 },
|
|
|
|
{ "View.Window.WindowStagr", BROWSER_WINDOW_STAGGER, 0 },
|
|
|
|
{ "_View.Window.WindowSize", BROWSER_WINDOW_COPY, 0 },
|
|
|
|
{ "View.Window.WindowReset", BROWSER_WINDOW_RESET, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Utilities", NO_ACTION, 0 },
|
|
|
|
{ "Utilities.Hotlist", HOTLIST_SHOW, 0 },
|
|
|
|
{ "Utilities.Hotlist.HotlistAdd", HOTLIST_ADD_URL, 0 },
|
|
|
|
{ "Utilities.Hotlist.HotlistShow", HOTLIST_SHOW, 0 },
|
|
|
|
{ "Utilities.History", HISTORY_SHOW_GLOBAL, 0 },
|
|
|
|
{ "Utilities.History.HistLocal", HISTORY_SHOW_LOCAL, 0 },
|
|
|
|
{ "Utilities.History.HistGlobal", HISTORY_SHOW_GLOBAL, 0 },
|
2006-07-13 16:46:02 +04:00
|
|
|
{ "Utilities.Cookies", COOKIES_SHOW, 0 },
|
|
|
|
{ "Utilities.Cookies.ShowCookies", COOKIES_SHOW, 0 },
|
2006-07-17 01:42:37 +04:00
|
|
|
{ "Utilities.Cookies.DeleteCookies", COOKIES_DELETE, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Help", HELP_OPEN_CONTENTS, 0 },
|
|
|
|
{ "Help.HelpContent", HELP_OPEN_CONTENTS, 0 },
|
|
|
|
{ "Help.HelpGuide", HELP_OPEN_GUIDE, 0 },
|
2005-07-16 18:35:25 +04:00
|
|
|
{ "_Help.HelpInfo", HELP_OPEN_INFORMATION, 0 },
|
|
|
|
{ "_Help.HelpAbout", HELP_OPEN_ABOUT, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Help.HelpInter", HELP_LAUNCH_INTERACTIVE, 0 },
|
|
|
|
{NULL, 0, 0}
|
|
|
|
}
|
|
|
|
};
|
2009-03-29 04:14:28 +04:00
|
|
|
browser_menu = ro_gui_menu_define_menu(&browser_definition);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
/* image quality menu */
|
2009-03-29 04:14:28 +04:00
|
|
|
static const struct ns_menu images_definition = {
|
2005-04-08 00:46:22 +04:00
|
|
|
"Display", {
|
|
|
|
{ "ImgStyle0", NO_ACTION, 0 },
|
|
|
|
{ "ImgStyle1", NO_ACTION, 0 },
|
|
|
|
{ "ImgStyle2", NO_ACTION, 0 },
|
|
|
|
{ "ImgStyle3", NO_ACTION, 0 },
|
|
|
|
{NULL, 0, 0}
|
|
|
|
}
|
|
|
|
};
|
2009-03-29 04:14:28 +04:00
|
|
|
image_quality_menu = ro_gui_menu_define_menu(&images_definition);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
/* browser toolbar menu */
|
2009-03-29 04:14:28 +04:00
|
|
|
static const struct ns_menu browser_toolbar_definition = {
|
2005-04-08 00:46:22 +04:00
|
|
|
"Toolbar", {
|
|
|
|
{ "Toolbars", NO_ACTION, 0 },
|
|
|
|
{ "Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
|
|
|
|
{ "Toolbars.ToolAddress", TOOLBAR_ADDRESS_BAR, 0 },
|
|
|
|
{ "Toolbars.ToolThrob", TOOLBAR_THROBBER, 0 },
|
|
|
|
{ "EditToolbar", TOOLBAR_EDIT, 0 },
|
|
|
|
{NULL, 0, 0}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
browser_toolbar_menu = ro_gui_menu_define_menu(
|
2009-03-29 04:14:28 +04:00
|
|
|
&browser_toolbar_definition);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
/* tree toolbar menu */
|
2009-03-29 04:14:28 +04:00
|
|
|
static const struct ns_menu tree_toolbar_definition = {
|
2005-04-08 00:46:22 +04:00
|
|
|
"Toolbar", {
|
|
|
|
{ "Toolbars", NO_ACTION, 0 },
|
|
|
|
{ "Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
|
|
|
|
{ "EditToolbar", TOOLBAR_EDIT, 0 },
|
|
|
|
{NULL, 0, 0}
|
|
|
|
}
|
|
|
|
};
|
2009-03-29 04:14:28 +04:00
|
|
|
tree_toolbar_menu = ro_gui_menu_define_menu(&tree_toolbar_definition);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
2010-10-25 03:17:21 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* proxy menu */
|
2009-03-29 04:14:28 +04:00
|
|
|
static const struct ns_menu proxy_type_definition = {
|
2006-04-07 02:42:22 +04:00
|
|
|
"ProxyType", {
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "ProxyNone", NO_ACTION, 0 },
|
2006-04-07 02:42:22 +04:00
|
|
|
{ "ProxyNoAuth", NO_ACTION, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "ProxyBasic", NO_ACTION, 0 },
|
|
|
|
{ "ProxyNTLM", NO_ACTION, 0 },
|
|
|
|
{NULL, 0, 0}
|
|
|
|
}
|
|
|
|
};
|
2009-03-29 04:14:28 +04:00
|
|
|
proxy_type_menu = ro_gui_menu_define_menu(&proxy_type_definition);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
/* special case menus */
|
2010-10-05 23:14:46 +04:00
|
|
|
ro_gui_url_suggest_init(url_suggest_menu);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
/* Note: This table *must* be kept in sync with the LangNames file */
|
2009-03-29 04:14:28 +04:00
|
|
|
static const struct ns_menu lang_definition = {
|
2005-07-16 18:35:25 +04:00
|
|
|
"Languages", {
|
|
|
|
{ "lang_af", NO_ACTION, 0 },
|
|
|
|
{ "lang_bm", NO_ACTION, 0 },
|
|
|
|
{ "lang_ca", NO_ACTION, 0 },
|
|
|
|
{ "lang_cs", NO_ACTION, 0 },
|
|
|
|
{ "lang_cy", NO_ACTION, 0 },
|
|
|
|
{ "lang_da", NO_ACTION, 0 },
|
|
|
|
{ "lang_de", NO_ACTION, 0 },
|
|
|
|
{ "lang_en", NO_ACTION, 0 },
|
|
|
|
{ "lang_es", NO_ACTION, 0 },
|
|
|
|
{ "lang_et", NO_ACTION, 0 },
|
|
|
|
{ "lang_eu", NO_ACTION, 0 },
|
|
|
|
{ "lang_ff", NO_ACTION, 0 },
|
|
|
|
{ "lang_fi", NO_ACTION, 0 },
|
|
|
|
{ "lang_fr", NO_ACTION, 0 },
|
|
|
|
{ "lang_ga", NO_ACTION, 0 },
|
|
|
|
{ "lang_gl", NO_ACTION, 0 },
|
|
|
|
{ "lang_ha", NO_ACTION, 0 },
|
|
|
|
{ "lang_hr", NO_ACTION, 0 },
|
|
|
|
{ "lang_hu", NO_ACTION, 0 },
|
|
|
|
{ "lang_id", NO_ACTION, 0 },
|
|
|
|
{ "lang_is", NO_ACTION, 0 },
|
|
|
|
{ "lang_it", NO_ACTION, 0 },
|
|
|
|
{ "lang_lt", NO_ACTION, 0 },
|
|
|
|
{ "lang_lv", NO_ACTION, 0 },
|
|
|
|
{ "lang_ms", NO_ACTION, 0 },
|
|
|
|
{ "lang_mt", NO_ACTION, 0 },
|
|
|
|
{ "lang_nl", NO_ACTION, 0 },
|
|
|
|
{ "lang_no", NO_ACTION, 0 },
|
|
|
|
{ "lang_pl", NO_ACTION, 0 },
|
|
|
|
{ "lang_pt", NO_ACTION, 0 },
|
|
|
|
{ "lang_rn", NO_ACTION, 0 },
|
|
|
|
{ "lang_ro", NO_ACTION, 0 },
|
|
|
|
{ "lang_rw", NO_ACTION, 0 },
|
|
|
|
{ "lang_sk", NO_ACTION, 0 },
|
|
|
|
{ "lang_sl", NO_ACTION, 0 },
|
|
|
|
{ "lang_so", NO_ACTION, 0 },
|
|
|
|
{ "lang_sq", NO_ACTION, 0 },
|
|
|
|
{ "lang_sr", NO_ACTION, 0 },
|
|
|
|
{ "lang_sv", NO_ACTION, 0 },
|
|
|
|
{ "lang_sw", NO_ACTION, 0 },
|
|
|
|
{ "lang_tr", NO_ACTION, 0 },
|
|
|
|
{ "lang_uz", NO_ACTION, 0 },
|
|
|
|
{ "lang_vi", NO_ACTION, 0 },
|
|
|
|
{ "lang_wo", NO_ACTION, 0 },
|
|
|
|
{ "lang_xs", NO_ACTION, 0 },
|
|
|
|
{ "lang_yo", NO_ACTION, 0 },
|
|
|
|
{ "lang_zu", NO_ACTION, 0 },
|
|
|
|
{ NULL, 0, 0 }
|
|
|
|
}
|
|
|
|
};
|
2009-03-29 04:14:28 +04:00
|
|
|
languages_menu = ro_gui_menu_define_menu(&lang_definition);
|
2004-07-28 00:44:46 +04:00
|
|
|
}
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Display a menu.
|
2010-10-25 03:17:21 +04:00
|
|
|
*
|
|
|
|
* \param *menu Pointer to the menu to be displayed.
|
|
|
|
* \param x The x position.
|
|
|
|
* \param y The y position.
|
|
|
|
* \param w The window that the menu belongs to.
|
|
|
|
* \param prepare true if the menu is to be prepared; otherwise
|
|
|
|
* false (mainly for use by wimp_event module).
|
2005-02-07 17:28:43 +03:00
|
|
|
*/
|
2010-10-25 03:17:21 +04:00
|
|
|
void ro_gui_menu_create(wimp_menu *menu, int x, int y, wimp_w w, bool prepare)
|
2008-07-27 02:29:15 +04:00
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
struct gui_window *g;
|
2004-07-18 21:38:01 +04:00
|
|
|
os_error *error;
|
2006-09-07 02:15:58 +04:00
|
|
|
os_coord pos;
|
2005-04-08 00:46:22 +04:00
|
|
|
int i;
|
|
|
|
menu_action action;
|
2005-07-16 18:35:25 +04:00
|
|
|
struct menu_definition *definition;
|
|
|
|
|
|
|
|
/* translate menu, if necessary (this returns quickly
|
|
|
|
* if there's nothing to be done) */
|
|
|
|
definition = ro_gui_menu_find_menu(menu);
|
|
|
|
if (definition) {
|
|
|
|
if (!ro_gui_menu_translate(definition)) {
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2004-07-18 21:38:01 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* read the object under the pointer for a new gui_window menu */
|
|
|
|
if ((!current_menu) && (menu == browser_menu)) {
|
2010-04-07 19:34:01 +04:00
|
|
|
hlcache_handle *h;
|
2010-04-07 16:45:18 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
g = ro_gui_window_lookup(w);
|
2010-04-07 19:34:01 +04:00
|
|
|
h = g->bw->current_content;
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-09-07 02:15:58 +04:00
|
|
|
if (!ro_gui_window_to_window_pos(g, x, y, &pos))
|
|
|
|
return;
|
2009-02-01 05:19:01 +03:00
|
|
|
current_menu_object = NULL;
|
|
|
|
current_menu_url = NULL;
|
2010-04-07 19:34:01 +04:00
|
|
|
if (h) {
|
|
|
|
switch (content_get_type(h)) {
|
2009-02-01 05:19:01 +03:00
|
|
|
case CONTENT_HTML: {
|
|
|
|
struct box *box;
|
2010-04-07 19:34:01 +04:00
|
|
|
box = box_object_at_point(h, pos.x,
|
|
|
|
pos.y);
|
|
|
|
current_menu_object = box ?
|
|
|
|
box->object : NULL;
|
|
|
|
box = box_href_at_point(h, pos.x,
|
|
|
|
pos.y);
|
|
|
|
current_menu_url = box ?
|
|
|
|
box->href : NULL;
|
2009-02-01 05:19:01 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONTENT_TEXTPLAIN:
|
|
|
|
/* no object, no url */
|
|
|
|
break;
|
|
|
|
default:
|
2010-04-07 19:34:01 +04:00
|
|
|
current_menu_object = h;
|
2009-02-01 05:19:01 +03:00
|
|
|
break;
|
|
|
|
}
|
2009-01-30 08:08:54 +03:00
|
|
|
}
|
2005-04-08 00:46:22 +04:00
|
|
|
}
|
2004-07-18 21:38:01 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* store the menu characteristics */
|
|
|
|
current_menu = menu;
|
|
|
|
current_menu_window = w;
|
2005-12-31 07:40:49 +03:00
|
|
|
current_menu_icon = -1;
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
/* prepare the menu state */
|
|
|
|
if (menu == url_suggest_menu) {
|
2010-10-05 23:14:46 +04:00
|
|
|
if (!ro_gui_url_suggest_prepare_menu())
|
2005-02-07 17:28:43 +03:00
|
|
|
return;
|
2005-12-31 07:40:49 +03:00
|
|
|
} else if (menu == recent_search_menu) {
|
|
|
|
if (!ro_gui_search_prepare_menu())
|
|
|
|
return;
|
2010-10-25 03:17:21 +04:00
|
|
|
} else if (prepare) {
|
2005-04-08 00:46:22 +04:00
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
action = ro_gui_menu_find_action(menu,
|
|
|
|
&menu->entries[i]);
|
|
|
|
if (action != NO_ACTION)
|
|
|
|
ro_gui_menu_prepare_action(w, action, false);
|
|
|
|
} while (!(menu->entries[i++].menu_flags & wimp_MENU_LAST));
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
2004-07-18 21:38:01 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* create the menu */
|
|
|
|
current_menu_open = true;
|
2004-07-18 21:38:01 +04:00
|
|
|
error = xwimp_create_menu(menu, x - 64, y);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_create_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_closed(true);
|
2004-07-18 21:38:01 +04:00
|
|
|
}
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-19 03:40:28 +03:00
|
|
|
/**
|
|
|
|
* Display a pop-up menu next to the specified icon.
|
2005-02-25 01:00:41 +03:00
|
|
|
*
|
|
|
|
* \param menu menu to open
|
2005-04-08 00:46:22 +04:00
|
|
|
* \param w window handle
|
|
|
|
* \param i icon handle
|
2003-12-19 03:40:28 +03:00
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i)
|
|
|
|
{
|
2003-12-27 03:11:57 +03:00
|
|
|
wimp_window_state state;
|
|
|
|
wimp_icon_state icon_state;
|
2005-02-25 01:00:41 +03:00
|
|
|
os_error *error;
|
|
|
|
|
2003-12-27 03:11:57 +03:00
|
|
|
state.w = w;
|
|
|
|
icon_state.w = w;
|
|
|
|
icon_state.i = i;
|
2005-02-25 01:00:41 +03:00
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_window_state: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
error = xwimp_get_icon_state(&icon_state);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_icon_state: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
|
|
|
return;
|
|
|
|
}
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_create(menu,
|
2004-07-18 21:38:01 +04:00
|
|
|
state.visible.x0 + icon_state.icon.extent.x1 + 64,
|
2005-02-25 01:00:41 +03:00
|
|
|
state.visible.y1 + icon_state.icon.extent.y1 -
|
2010-10-25 03:17:21 +04:00
|
|
|
state.yscroll, w, true);
|
2005-12-31 07:40:49 +03:00
|
|
|
current_menu_icon = i;
|
2003-12-19 03:40:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
/**
|
2005-04-08 00:46:22 +04:00
|
|
|
* Clean up after a menu has been closed, or forcible close an open menu.
|
2005-12-31 07:40:49 +03:00
|
|
|
*
|
|
|
|
* \param cleanup Call any terminating functions (sub-window isn't going to be instantly re-opened)
|
2003-08-22 01:39:07 +04:00
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_menu_closed(bool cleanup)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
struct gui_window *g;
|
|
|
|
struct browser_window *bw;
|
2010-04-07 18:09:13 +04:00
|
|
|
hlcache_handle *h;
|
2005-04-08 00:46:22 +04:00
|
|
|
struct toolbar *t;
|
2004-06-27 19:34:46 +04:00
|
|
|
os_error *error;
|
2010-10-05 23:14:46 +04:00
|
|
|
bool is_cookies, is_hotlist, is_global_history;
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2005-04-28 21:15:29 +04:00
|
|
|
if (current_menu) {
|
2005-07-19 07:56:17 +04:00
|
|
|
|
2005-04-28 21:15:29 +04:00
|
|
|
error = xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_create_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
|
|
|
}
|
|
|
|
ro_gui_menu_get_window_details(current_menu_window,
|
2010-10-05 23:14:46 +04:00
|
|
|
&g, &bw, &h, &t,
|
|
|
|
&is_cookies, &is_hotlist,
|
|
|
|
&is_global_history);
|
2005-07-19 07:56:17 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
if (cleanup) {
|
2010-10-05 23:14:46 +04:00
|
|
|
ro_gui_wimp_event_menus_closed(current_menu_window,
|
|
|
|
current_menu_icon, current_menu);
|
2005-12-31 07:40:49 +03:00
|
|
|
}
|
2010-10-05 23:14:46 +04:00
|
|
|
|
|
|
|
current_menu = NULL;
|
2003-08-22 01:39:07 +04:00
|
|
|
}
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
current_menu_window = NULL;
|
2009-03-27 05:14:23 +03:00
|
|
|
current_menu_icon = 0;
|
2005-04-08 00:46:22 +04:00
|
|
|
current_menu_open = false;
|
2005-04-28 21:15:29 +04:00
|
|
|
gui_form_select_control = NULL;
|
2005-03-19 15:50:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
/**
|
2005-04-08 00:46:22 +04:00
|
|
|
* The content has changed, reset object references
|
2004-02-26 03:44:42 +03:00
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_menu_objects_moved(void)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
gui_form_select_control = NULL;
|
2009-02-01 05:19:01 +03:00
|
|
|
current_menu_object = NULL;
|
|
|
|
current_menu_url = NULL;
|
2005-06-08 01:29:26 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_prepare_action(0, BROWSER_OBJECT, false);
|
2005-04-28 05:05:40 +04:00
|
|
|
if ((current_menu) && (current_menu == gui_form_select_menu))
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_closed(true);
|
2004-07-11 17:05:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-04-08 00:46:22 +04:00
|
|
|
* Handle menu selection.
|
2004-07-11 17:05:38 +04:00
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_menu_selection(wimp_selection *selection)
|
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
int i, j;
|
|
|
|
bool needs_prepare;
|
|
|
|
wimp_menu_entry *menu_entry;
|
|
|
|
menu_action action;
|
|
|
|
wimp_pointer pointer;
|
|
|
|
struct gui_window *g = NULL;
|
|
|
|
wimp_menu *menu;
|
|
|
|
os_error *error;
|
|
|
|
int previous_menu_icon = current_menu_icon;
|
|
|
|
char *url;
|
2005-12-31 07:40:49 +03:00
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
/* if we are using gui_multitask then menu selection events
|
|
|
|
* may be delivered after the menu has been closed. As such,
|
|
|
|
* we simply ignore these events. */
|
2005-05-14 20:13:36 +04:00
|
|
|
if (!current_menu)
|
|
|
|
return
|
2009-05-30 03:43:53 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
assert(current_menu_window);
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
/* get the menu entry and associated action and definition */
|
2005-04-08 00:46:22 +04:00
|
|
|
menu_entry = ¤t_menu->entries[selection->items[0]];
|
|
|
|
for (i = 1; selection->items[i] != -1; i++)
|
|
|
|
menu_entry = &menu_entry->sub_menu->
|
|
|
|
entries[selection->items[i]];
|
|
|
|
action = ro_gui_menu_find_action(current_menu, menu_entry);
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
/* Deal with the menu action. We first pass it to Wimp_Event to
|
|
|
|
* handle any automatic menus. If this doesn't recognise the details,
|
|
|
|
* it is passed on to the code in menus.c.
|
|
|
|
*/
|
|
|
|
|
|
|
|
needs_prepare = false;
|
|
|
|
|
|
|
|
if (!ro_gui_wimp_event_menu_selection(current_menu_window,
|
|
|
|
current_menu_icon, current_menu, selection, action)) {
|
|
|
|
|
|
|
|
/* perform menu action */
|
|
|
|
if (action != NO_ACTION)
|
|
|
|
ro_gui_menu_handle_action(current_menu_window,
|
|
|
|
action, false);
|
|
|
|
|
|
|
|
/* perform non-automated actions */
|
|
|
|
if (current_menu == url_suggest_menu) {
|
|
|
|
g = ro_gui_toolbar_lookup(current_menu_window);
|
|
|
|
if (g) {
|
|
|
|
url = url_suggest_menu->entries[selection->items[0]].
|
|
|
|
data.indirected_text.text;
|
|
|
|
gui_window_set_url(g, url);
|
|
|
|
browser_window_go(g->bw, url, 0, true);
|
|
|
|
}
|
|
|
|
} else if (current_menu == gui_form_select_menu) {
|
|
|
|
g = ro_gui_window_lookup(current_menu_window);
|
|
|
|
assert(g);
|
|
|
|
|
|
|
|
if (selection->items[0] >= 0) {
|
|
|
|
form_select_process_selection(g->bw->current_content,
|
|
|
|
gui_form_select_control,
|
|
|
|
selection->items[0]);
|
|
|
|
}
|
2009-05-30 03:43:53 +04:00
|
|
|
}
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
/* allow automatic menus to have their data updated */
|
|
|
|
// ro_gui_wimp_event_menu_selection(current_menu_window,
|
|
|
|
// current_menu_icon, current_menu, selection);
|
|
|
|
|
|
|
|
/* Menus not handled by ro_gui_wimp_event_menu_selection()
|
|
|
|
* will need to be re-prepared before an adjust reopening.
|
|
|
|
*/
|
|
|
|
|
|
|
|
needs_prepare = true;
|
|
|
|
}
|
2005-12-31 07:40:49 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* re-open the menu for Adjust clicks */
|
|
|
|
error = xwimp_get_pointer_info(&pointer);
|
2004-07-06 02:17:59 +04:00
|
|
|
if (error) {
|
2005-04-08 00:46:22 +04:00
|
|
|
LOG(("xwimp_get_pointer_info: 0x%x: %s",
|
2004-07-11 17:05:38 +04:00
|
|
|
error->errnum, error->errmess));
|
2005-04-08 00:46:22 +04:00
|
|
|
warn_user("WimpError", error->errmess);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_closed(true);
|
2005-04-08 00:46:22 +04:00
|
|
|
return;
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
2004-03-27 21:46:08 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
if (pointer.buttons != wimp_CLICK_ADJUST) {
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_closed(true);
|
2005-04-08 00:46:22 +04:00
|
|
|
return;
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
2004-03-27 21:46:08 +03:00
|
|
|
|
2009-05-30 03:43:53 +04:00
|
|
|
/* re-prepare all the visible entries */
|
2010-10-05 23:14:46 +04:00
|
|
|
if (needs_prepare) {
|
|
|
|
i = 0;
|
|
|
|
menu = current_menu;
|
2005-04-08 00:46:22 +04:00
|
|
|
do {
|
2010-10-05 23:14:46 +04:00
|
|
|
j = 0;
|
|
|
|
do {
|
|
|
|
action = ro_gui_menu_find_action(current_menu,
|
|
|
|
&menu->entries[j]);
|
|
|
|
if (action != NO_ACTION)
|
|
|
|
ro_gui_menu_prepare_action(current_menu_window,
|
|
|
|
action, false);
|
|
|
|
} while (!(menu->entries[j++].menu_flags & wimp_MENU_LAST));
|
|
|
|
j = selection->items[i++];
|
|
|
|
if (j != -1) {
|
|
|
|
menu = menu->entries[j].sub_menu;
|
|
|
|
if ((!menu) || (menu == wimp_NO_SUB_MENU))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (j != -1);
|
|
|
|
}
|
2009-05-30 03:43:53 +04:00
|
|
|
|
|
|
|
if (current_menu == gui_form_select_menu) {
|
|
|
|
assert(g); /* Keep scan-build happy */
|
|
|
|
gui_create_form_select_menu(g->bw, gui_form_select_control);
|
|
|
|
} else
|
2010-10-25 03:17:21 +04:00
|
|
|
ro_gui_menu_create(current_menu, 0, 0, current_menu_window, true);
|
2009-05-30 03:43:53 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
current_menu_icon = previous_menu_icon;
|
2004-03-27 21:46:08 +03:00
|
|
|
}
|
2004-04-03 06:59:35 +04:00
|
|
|
|
2004-05-05 02:23:44 +04:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
/**
|
2005-04-08 00:46:22 +04:00
|
|
|
* Handle Message_MenuWarning.
|
2005-02-07 17:28:43 +03:00
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_menu_warning(wimp_message_menu_warning *warning)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
int i;
|
|
|
|
menu_action action;
|
|
|
|
wimp_menu_entry *menu_entry;
|
|
|
|
wimp_menu *sub_menu;
|
|
|
|
os_error *error;
|
2005-02-07 17:28:43 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
assert(current_menu);
|
|
|
|
assert(current_menu_window);
|
|
|
|
|
|
|
|
/* get the sub-menu of the warning */
|
|
|
|
if (warning->selection.items[0] == -1)
|
|
|
|
return;
|
|
|
|
menu_entry = ¤t_menu->entries[warning->selection.items[0]];
|
|
|
|
for (i = 1; warning->selection.items[i] != -1; i++)
|
|
|
|
menu_entry = &menu_entry->sub_menu->
|
|
|
|
entries[warning->selection.items[i]];
|
2010-10-05 23:14:46 +04:00
|
|
|
action = ro_gui_menu_find_action(current_menu, menu_entry);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
/* We only process the menu in the old way if the wimp_event module
|
|
|
|
* hasn't processed it for us.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!ro_gui_wimp_event_submenu_warning(current_menu_window,
|
|
|
|
current_menu_icon, current_menu, &(warning->selection),
|
|
|
|
action)) {
|
|
|
|
if (IS_MENU(menu_entry->sub_menu)) {
|
|
|
|
ro_gui_wimp_event_register_submenu((wimp_w)0);
|
|
|
|
sub_menu = menu_entry->sub_menu;
|
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
action = ro_gui_menu_find_action(current_menu,
|
|
|
|
&sub_menu->entries[i]);
|
|
|
|
if (action != NO_ACTION)
|
|
|
|
ro_gui_menu_prepare_action(current_menu_window,
|
|
|
|
action, false);
|
|
|
|
} while (!(sub_menu->entries[i++].menu_flags &
|
|
|
|
wimp_MENU_LAST));
|
|
|
|
} else {
|
|
|
|
ro_gui_wimp_event_register_submenu((wimp_w)menu_entry->sub_menu);
|
|
|
|
action = ro_gui_menu_find_action(current_menu, menu_entry);
|
2005-04-08 00:46:22 +04:00
|
|
|
if (action != NO_ACTION)
|
|
|
|
ro_gui_menu_prepare_action(current_menu_window,
|
2010-10-05 23:14:46 +04:00
|
|
|
action, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If this is a dialogue box, remove the close and back icons. */
|
|
|
|
|
|
|
|
if (!(IS_MENU(menu_entry->sub_menu)))
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_wimp_update_window_furniture((wimp_w)menu_entry->sub_menu,
|
|
|
|
wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_BACK_ICON, 0);
|
2010-10-05 23:14:46 +04:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* open the sub-menu */
|
|
|
|
error = xwimp_create_sub_menu(menu_entry->sub_menu,
|
|
|
|
warning->pos.x, warning->pos.y);
|
2005-02-07 17:28:43 +03:00
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_create_sub_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-04-13 23:04:32 +04:00
|
|
|
|
2004-05-14 23:59:09 +04:00
|
|
|
/**
|
2005-04-08 00:46:22 +04:00
|
|
|
* Update navigate menu status and toolbar icons.
|
2004-05-14 23:59:09 +04:00
|
|
|
*
|
2005-04-08 00:46:22 +04:00
|
|
|
* /param gui the gui_window to update
|
2004-05-14 23:59:09 +04:00
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_prepare_navigate(struct gui_window *gui)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_prepare_action(gui->window, HOTLIST_SHOW, false);
|
|
|
|
ro_gui_menu_prepare_action(gui->window, BROWSER_NAVIGATE_STOP, false);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_prepare_action(gui->window, BROWSER_NAVIGATE_RELOAD_ALL,
|
|
|
|
false);
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_prepare_action(gui->window, BROWSER_NAVIGATE_BACK, false);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_prepare_action(gui->window, BROWSER_NAVIGATE_FORWARD,
|
|
|
|
false);
|
2006-07-04 01:07:02 +04:00
|
|
|
ro_gui_menu_prepare_action(gui->window, BROWSER_NAVIGATE_UP, false);
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_prepare_action(gui->window, HOTLIST_SHOW, false);
|
|
|
|
ro_gui_menu_prepare_action(gui->window, BROWSER_SAVE, false);
|
|
|
|
ro_gui_menu_prepare_action(gui->window, BROWSER_PRINT, false);
|
|
|
|
ro_gui_menu_prepare_action(gui->window, BROWSER_SCALE_VIEW, false);
|
|
|
|
ro_gui_menu_prepare_action(gui->window, BROWSER_FIND_TEXT, false);
|
|
|
|
|
|
|
|
if (gui->toolbar) {
|
|
|
|
ro_gui_set_icon_shaded_state(gui->toolbar->toolbar_handle,
|
2010-10-05 23:14:46 +04:00
|
|
|
ICON_TOOLBAR_SUGGEST,
|
|
|
|
!ro_gui_url_suggest_prepare_menu());
|
2004-09-02 00:57:25 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare the page info window for use
|
|
|
|
*
|
|
|
|
* \param g the gui_window to set the display icons for
|
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_menu_prepare_pageinfo(struct gui_window *g)
|
|
|
|
{
|
2010-04-07 18:09:13 +04:00
|
|
|
hlcache_handle *h = g->bw->current_content;
|
2004-06-27 02:31:34 +04:00
|
|
|
char icon_buf[20] = "file_xxx";
|
2005-01-02 01:05:21 +03:00
|
|
|
char enc_buf[40];
|
|
|
|
char enc_token[10] = "Encoding0";
|
2004-06-27 02:31:34 +04:00
|
|
|
const char *icon = icon_buf;
|
2010-04-07 16:45:18 +04:00
|
|
|
const char *title, *url, *mime;
|
2004-06-27 02:31:34 +04:00
|
|
|
const char *enc = "-";
|
|
|
|
|
2010-04-07 16:45:18 +04:00
|
|
|
assert(h);
|
2004-06-27 02:31:34 +04:00
|
|
|
|
2010-04-07 16:45:18 +04:00
|
|
|
title = content_get_title(h);
|
|
|
|
if (title == NULL)
|
|
|
|
title = "-";
|
|
|
|
url = content_get_url(h);
|
|
|
|
if (url == NULL)
|
|
|
|
url = "-";
|
|
|
|
mime = content_get_mime_type(h);
|
|
|
|
if (mime == NULL)
|
|
|
|
mime = "-";
|
2004-06-27 02:31:34 +04:00
|
|
|
|
2010-04-07 16:45:18 +04:00
|
|
|
sprintf(icon_buf, "file_%x", ro_content_filetype(h));
|
2005-04-08 00:46:22 +04:00
|
|
|
if (!ro_gui_wimp_sprite_exists(icon_buf))
|
2004-07-08 21:28:56 +04:00
|
|
|
sprintf(icon_buf, "file_xxx");
|
|
|
|
|
2010-04-07 16:45:18 +04:00
|
|
|
if (content_get_type(h) == CONTENT_HTML) {
|
2010-04-07 17:14:00 +04:00
|
|
|
if (html_get_encoding(h)) {
|
|
|
|
enc_token[8] = '0' + html_get_encoding_source(h);
|
2005-01-02 01:05:21 +03:00
|
|
|
snprintf(enc_buf, sizeof enc_buf, "%s (%s)",
|
2010-04-07 17:14:00 +04:00
|
|
|
html_get_encoding(h),
|
2005-01-02 01:05:21 +03:00
|
|
|
messages_get(enc_token));
|
|
|
|
enc = enc_buf;
|
|
|
|
} else {
|
|
|
|
enc = messages_get("EncodingUnk");
|
|
|
|
}
|
2004-06-27 02:31:34 +04:00
|
|
|
}
|
|
|
|
|
2008-08-05 05:23:04 +04:00
|
|
|
ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_ICON, icon, true);
|
|
|
|
ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_TITLE, title, true);
|
|
|
|
ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_URL, url, true);
|
|
|
|
ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_ENC, enc, true);
|
|
|
|
ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_TYPE, mime, true);
|
2004-04-03 06:59:35 +04:00
|
|
|
}
|
2004-05-05 04:02:13 +04:00
|
|
|
|
2004-07-18 21:38:01 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/**
|
|
|
|
* Prepare the object info window for use
|
|
|
|
*
|
2009-02-01 05:19:01 +03:00
|
|
|
* \param object the object for which information is to be displayed
|
|
|
|
* \param href corresponding href, if any
|
2005-04-08 00:46:22 +04:00
|
|
|
*/
|
2010-04-07 18:09:13 +04:00
|
|
|
void ro_gui_menu_prepare_objectinfo(hlcache_handle *object, const char *href)
|
2008-07-27 02:29:15 +04:00
|
|
|
{
|
2004-06-27 02:31:34 +04:00
|
|
|
char icon_buf[20] = "file_xxx";
|
2010-04-07 18:09:13 +04:00
|
|
|
const char *url, *mime;
|
2004-06-27 02:31:34 +04:00
|
|
|
const char *target = "-";
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
sprintf(icon_buf, "file_%.3x",
|
2009-02-01 05:19:01 +03:00
|
|
|
ro_content_filetype(object));
|
2004-12-09 13:30:44 +03:00
|
|
|
if (!ro_gui_wimp_sprite_exists(icon_buf))
|
|
|
|
sprintf(icon_buf, "file_xxx");
|
|
|
|
|
2010-04-07 18:09:13 +04:00
|
|
|
url = content_get_url(object);
|
|
|
|
if (url == NULL)
|
|
|
|
url = "-";
|
|
|
|
mime = content_get_mime_type(object);
|
|
|
|
if (mime == NULL)
|
|
|
|
mime = "-";
|
2010-10-25 01:52:16 +04:00
|
|
|
|
2009-02-01 05:19:01 +03:00
|
|
|
if (href)
|
|
|
|
target = href;
|
2004-06-27 02:31:34 +04:00
|
|
|
|
2008-08-05 05:23:04 +04:00
|
|
|
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_ICON, icon_buf, true);
|
|
|
|
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_URL, url, true);
|
|
|
|
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_TARGET, target, true);
|
|
|
|
ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_TYPE, mime, true);
|
2004-06-29 21:26:42 +04:00
|
|
|
}
|
|
|
|
|
2004-07-18 03:32:09 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Display a menu of options for a form select control.
|
|
|
|
*
|
2004-10-05 03:54:42 +04:00
|
|
|
* \param bw browser window containing form control
|
2004-07-18 03:32:09 +04:00
|
|
|
* \param control form control of type GADGET_SELECT
|
|
|
|
*/
|
|
|
|
void gui_create_form_select_menu(struct browser_window *bw,
|
2008-07-27 02:29:15 +04:00
|
|
|
struct form_control *control)
|
|
|
|
{
|
2005-12-31 07:40:49 +03:00
|
|
|
unsigned int i, entries;
|
2005-07-16 20:17:49 +04:00
|
|
|
char *text_convert, *temp;
|
2004-07-18 03:32:09 +04:00
|
|
|
struct form_option *option;
|
|
|
|
wimp_pointer pointer;
|
|
|
|
os_error *error;
|
2005-04-28 21:15:29 +04:00
|
|
|
bool reopen = true;
|
2005-06-08 01:29:26 +04:00
|
|
|
utf8_convert_ret err;
|
2005-04-28 21:15:29 +04:00
|
|
|
|
|
|
|
assert(control);
|
2004-07-18 03:32:09 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
for (entries = 0, option = control->data.select.items; option;
|
2005-07-16 18:35:25 +04:00
|
|
|
option = option->next)
|
2005-12-31 07:40:49 +03:00
|
|
|
entries++;
|
|
|
|
if (entries == 0) {
|
|
|
|
ro_gui_menu_closed(true);
|
2004-07-18 03:32:09 +04:00
|
|
|
return;
|
2005-04-28 05:05:40 +04:00
|
|
|
}
|
2004-07-18 03:32:09 +04:00
|
|
|
|
2005-04-28 21:15:29 +04:00
|
|
|
if ((gui_form_select_menu) && (control != gui_form_select_control)) {
|
2005-12-31 07:40:49 +03:00
|
|
|
for (i = 0; ; i++) {
|
|
|
|
free(gui_form_select_menu->entries[i].data.
|
2004-07-18 03:32:09 +04:00
|
|
|
indirected_text.text);
|
2005-12-31 07:40:49 +03:00
|
|
|
if (gui_form_select_menu->entries[i].menu_flags &
|
2004-07-18 03:32:09 +04:00
|
|
|
wimp_MENU_LAST)
|
|
|
|
break;
|
|
|
|
}
|
2005-07-16 18:35:25 +04:00
|
|
|
free(gui_form_select_menu->title_data.indirected_text.text);
|
2004-07-18 03:32:09 +04:00
|
|
|
free(gui_form_select_menu);
|
|
|
|
gui_form_select_menu = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gui_form_select_menu) {
|
2005-04-28 21:15:29 +04:00
|
|
|
reopen = false;
|
2005-12-31 07:40:49 +03:00
|
|
|
gui_form_select_menu = malloc(wimp_SIZEOF_MENU(entries));
|
2005-04-28 21:15:29 +04:00
|
|
|
if (!gui_form_select_menu) {
|
|
|
|
warn_user("NoMemory", 0);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_closed(true);
|
2005-04-28 21:15:29 +04:00
|
|
|
return;
|
|
|
|
}
|
2005-07-16 18:35:25 +04:00
|
|
|
err = utf8_to_local_encoding(messages_get("SelectMenu"), 0,
|
|
|
|
&text_convert);
|
|
|
|
if (err != UTF8_CONVERT_OK) {
|
|
|
|
/* badenc should never happen */
|
|
|
|
assert(err != UTF8_CONVERT_BADENC);
|
|
|
|
LOG(("utf8_to_local_encoding failed"));
|
|
|
|
warn_user("NoMemory", 0);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_closed(true);
|
2005-07-16 18:35:25 +04:00
|
|
|
return;
|
|
|
|
}
|
2005-04-28 21:15:29 +04:00
|
|
|
gui_form_select_menu->title_data.indirected_text.text =
|
2005-07-16 18:35:25 +04:00
|
|
|
text_convert;
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_init_structure(gui_form_select_menu, entries);
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0, option = control->data.select.items; option;
|
|
|
|
i++, option = option->next) {
|
|
|
|
gui_form_select_menu->entries[i].menu_flags = 0;
|
|
|
|
if (option->selected)
|
|
|
|
gui_form_select_menu->entries[i].menu_flags =
|
|
|
|
wimp_MENU_TICKED;
|
2005-04-28 21:15:29 +04:00
|
|
|
if (!reopen) {
|
2005-07-16 20:17:49 +04:00
|
|
|
|
|
|
|
/* convert spaces to hard spaces to stop things
|
|
|
|
* like 'Go Home' being treated as if 'Home' is a
|
|
|
|
* keyboard shortcut and right aligned in the menu.
|
|
|
|
*/
|
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
temp = cnv_space2nbsp(option->text);
|
|
|
|
if (!temp) {
|
|
|
|
LOG(("cnv_space2nbsp failed"));
|
|
|
|
warn_user("NoMemory", 0);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_closed(true);
|
2005-07-16 18:35:25 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-07-16 20:17:49 +04:00
|
|
|
err = utf8_to_local_encoding(temp,
|
2005-07-16 18:35:25 +04:00
|
|
|
0, &text_convert);
|
2005-06-08 01:58:17 +04:00
|
|
|
if (err != UTF8_CONVERT_OK) {
|
|
|
|
/* A bad encoding should never happen,
|
|
|
|
* so assert this */
|
|
|
|
assert(err != UTF8_CONVERT_BADENC);
|
|
|
|
LOG(("utf8_to_enc failed"));
|
|
|
|
warn_user("NoMemory", 0);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_closed(true);
|
2005-06-08 01:58:17 +04:00
|
|
|
return;
|
|
|
|
}
|
2005-06-08 01:29:26 +04:00
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
free(temp);
|
|
|
|
|
2005-04-28 21:15:29 +04:00
|
|
|
gui_form_select_menu->entries[i].data.indirected_text.text =
|
|
|
|
text_convert;
|
|
|
|
gui_form_select_menu->entries[i].data.indirected_text.size =
|
|
|
|
strlen(gui_form_select_menu->entries[i].
|
|
|
|
data.indirected_text.text) + 1;
|
|
|
|
}
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
gui_form_select_menu->entries[0].menu_flags |=
|
|
|
|
wimp_MENU_TITLE_INDIRECTED;
|
|
|
|
gui_form_select_menu->entries[i - 1].menu_flags |= wimp_MENU_LAST;
|
|
|
|
|
|
|
|
error = xwimp_get_pointer_info(&pointer);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_pointer_info: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("WimpError", error->errmess);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_closed(true);
|
2005-04-08 00:46:22 +04:00
|
|
|
return;
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
gui_form_select_control = control;
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_create(gui_form_select_menu,
|
2010-10-25 03:17:21 +04:00
|
|
|
pointer.pos.x, pointer.pos.y, bw->window->window, true);
|
2005-04-08 00:46:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a wimp_menu and adds it to the list to handle actions for.
|
|
|
|
*
|
2010-10-05 23:14:46 +04:00
|
|
|
* \param *menu The data to create the menu with
|
|
|
|
* \param *callbacks A callback table for the menu (NULL if to be
|
|
|
|
* handled in the 'old-fashined way' by menus.c).
|
|
|
|
* \return The menu created, or NULL on failure
|
2005-04-08 00:46:22 +04:00
|
|
|
*/
|
2009-03-29 04:14:28 +04:00
|
|
|
wimp_menu *ro_gui_menu_define_menu(const struct ns_menu *menu)
|
2008-07-27 02:29:15 +04:00
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
struct menu_definition *definition;
|
|
|
|
int entry;
|
|
|
|
|
|
|
|
definition = calloc(sizeof(struct menu_definition), 1);
|
2009-05-30 03:43:53 +04:00
|
|
|
if (!definition) {
|
2005-04-08 00:46:22 +04:00
|
|
|
die("No memory to create menu definition.");
|
2009-05-30 03:43:53 +04:00
|
|
|
return NULL; /* For the benefit of scan-build */
|
|
|
|
}
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
/* link in the menu to our list */
|
|
|
|
definition->next = ro_gui_menu_definitions;
|
|
|
|
ro_gui_menu_definitions = definition;
|
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
/* count number of menu entries */
|
|
|
|
for (entry = 0; menu->entries[entry].text; entry++)
|
|
|
|
/* do nothing */;
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* create our definitions */
|
|
|
|
ro_gui_menu_define_menu_add(definition, menu, 0, NULL,
|
|
|
|
0, entry, NULL, 0);
|
2005-07-16 18:35:25 +04:00
|
|
|
|
|
|
|
/* and translate menu into current encoding */
|
|
|
|
if (!ro_gui_menu_translate(definition))
|
|
|
|
die("No memory to translate menu.");
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
return definition->menu;
|
|
|
|
}
|
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
/**
|
|
|
|
* Create a wimp menu tree from ns_menu data.
|
|
|
|
* This function does *not* deal with the menu textual content - it simply
|
|
|
|
* creates and populates the appropriate structures. Textual content is
|
|
|
|
* generated by ro_gui_menu_translate_menu()
|
|
|
|
*
|
|
|
|
* \param definition Top level menu definition
|
|
|
|
* \param menu Menu declaration data
|
|
|
|
* \param depth Depth of menu we're currently building
|
|
|
|
* \param parent_entry Entry in parent menu, or NULL if root menu
|
|
|
|
* \param first First index in declaration data that is used by this menu
|
2005-11-27 15:53:59 +03:00
|
|
|
* \param last Last index in declaration data that is used by this menu
|
2005-07-16 18:35:25 +04:00
|
|
|
* \param prefix Prefix pf menu declaration string already seen
|
|
|
|
* \param prefix_length Length of prefix
|
|
|
|
*/
|
2005-04-08 00:46:22 +04:00
|
|
|
void ro_gui_menu_define_menu_add(struct menu_definition *definition,
|
2009-03-29 04:14:28 +04:00
|
|
|
const struct ns_menu *menu, int depth,
|
2005-07-16 18:35:25 +04:00
|
|
|
wimp_menu_entry *parent_entry, int first, int last,
|
2008-07-27 02:29:15 +04:00
|
|
|
const char *prefix, int prefix_length)
|
|
|
|
{
|
2005-07-16 18:35:25 +04:00
|
|
|
int entry, id, cur_depth;
|
2005-04-08 00:46:22 +04:00
|
|
|
int entries = 0;
|
|
|
|
int matches[last - first + 1];
|
|
|
|
const char *match;
|
2005-07-16 18:35:25 +04:00
|
|
|
const char *text, *menu_text;
|
2005-04-08 00:46:22 +04:00
|
|
|
wimp_menu *new_menu;
|
|
|
|
struct menu_definition_entry *definition_entry;
|
|
|
|
|
|
|
|
/* step 1: store the matches for depth and subset string */
|
|
|
|
for (entry = first; entry < last; entry++) {
|
|
|
|
cur_depth = 0;
|
|
|
|
match = menu->entries[entry].text;
|
2005-07-16 18:35:25 +04:00
|
|
|
|
|
|
|
/* skip specials at start of string */
|
|
|
|
while (!isalnum(*match))
|
|
|
|
match++;
|
|
|
|
|
|
|
|
/* attempt prefix match */
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((prefix) && (strncmp(match, prefix, prefix_length)))
|
|
|
|
continue;
|
2005-07-16 18:35:25 +04:00
|
|
|
|
|
|
|
/* Find depth of this entry */
|
2005-04-08 00:46:22 +04:00
|
|
|
while (*match)
|
|
|
|
if (*match++ == '.')
|
|
|
|
cur_depth++;
|
2005-07-16 18:35:25 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
if (depth == cur_depth)
|
|
|
|
matches[entries++] = entry;
|
|
|
|
}
|
|
|
|
matches[entries] = last;
|
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
/* no entries, so exit */
|
2005-04-08 00:46:22 +04:00
|
|
|
if (entries == 0)
|
|
|
|
return;
|
2005-07-16 18:35:25 +04:00
|
|
|
|
|
|
|
/* step 2: build and link the menu. we must use realloc to stop
|
|
|
|
* our memory fragmenting so we can test for sub-menus easily */
|
2005-04-08 00:46:22 +04:00
|
|
|
new_menu = (wimp_menu *)malloc(wimp_SIZEOF_MENU(entries));
|
|
|
|
if (!new_menu)
|
|
|
|
die("No memory to create menu.");
|
2005-07-16 18:35:25 +04:00
|
|
|
|
|
|
|
if (parent_entry) {
|
|
|
|
/* Fix up sub menu pointer */
|
|
|
|
parent_entry->sub_menu = new_menu;
|
2005-04-08 00:46:22 +04:00
|
|
|
} else {
|
2005-07-16 18:35:25 +04:00
|
|
|
/* Root menu => fill in definition struct */
|
|
|
|
definition->title_key = menu->title;
|
|
|
|
definition->current_encoding = 0;
|
2005-04-08 00:46:22 +04:00
|
|
|
definition->menu = new_menu;
|
|
|
|
}
|
2005-07-16 18:35:25 +04:00
|
|
|
|
|
|
|
/* this is fixed up in ro_gui_menu_translate() */
|
|
|
|
new_menu->title_data.indirected_text.text = NULL;
|
|
|
|
|
|
|
|
/* fill in menu flags */
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_init_structure(new_menu, entries);
|
2005-07-16 18:35:25 +04:00
|
|
|
|
|
|
|
/* and then create the entries */
|
2005-04-08 00:46:22 +04:00
|
|
|
for (entry = 0; entry < entries; entry++) {
|
|
|
|
/* add the entry */
|
|
|
|
id = matches[entry];
|
2005-07-16 18:35:25 +04:00
|
|
|
|
|
|
|
text = menu->entries[id].text;
|
|
|
|
|
|
|
|
/* fill in menu flags from specials at start of string */
|
2005-04-08 00:46:22 +04:00
|
|
|
new_menu->entries[entry].menu_flags = 0;
|
2005-07-16 18:35:25 +04:00
|
|
|
while (!isalnum(*text)) {
|
|
|
|
if (*text == '_')
|
2005-04-08 00:46:22 +04:00
|
|
|
new_menu->entries[entry].menu_flags |=
|
2005-07-16 18:35:25 +04:00
|
|
|
wimp_MENU_SEPARATE;
|
|
|
|
text++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get messages key for menu entry */
|
|
|
|
menu_text = strrchr(text, '.');
|
|
|
|
if (!menu_text)
|
|
|
|
/* no '.' => top-level entry */
|
|
|
|
menu_text = text;
|
|
|
|
else
|
|
|
|
menu_text++; /* and move past the '.' */
|
|
|
|
|
|
|
|
/* fill in submenu data */
|
2005-04-08 00:46:22 +04:00
|
|
|
if (menu->entries[id].sub_window)
|
2005-07-16 18:35:25 +04:00
|
|
|
new_menu->entries[entry].sub_menu =
|
2009-03-29 04:14:28 +04:00
|
|
|
(wimp_menu *) (*menu->entries[id].sub_window);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
/* this is fixed up in ro_gui_menu_translate() */
|
|
|
|
new_menu->entries[entry].data.indirected_text.text = NULL;
|
|
|
|
|
|
|
|
/* create definition entry */
|
|
|
|
definition_entry =
|
|
|
|
malloc(sizeof(struct menu_definition_entry));
|
|
|
|
if (!definition_entry)
|
|
|
|
die("Unable to create menu definition entry");
|
|
|
|
definition_entry->action = menu->entries[id].action;
|
|
|
|
definition_entry->menu_entry = &new_menu->entries[entry];
|
|
|
|
definition_entry->entry_key = menu_text;
|
|
|
|
definition_entry->next = definition->entries;
|
|
|
|
definition->entries = definition_entry;
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
/* recurse */
|
|
|
|
if (new_menu->entries[entry].sub_menu == wimp_NO_SUB_MENU) {
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_define_menu_add(definition, menu,
|
|
|
|
depth + 1, &new_menu->entries[entry],
|
2005-04-08 00:46:22 +04:00
|
|
|
matches[entry], matches[entry + 1],
|
2005-07-16 18:35:25 +04:00
|
|
|
text, strlen(text));
|
2005-04-08 00:46:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* give menu warnings */
|
|
|
|
if (new_menu->entries[entry].sub_menu != wimp_NO_SUB_MENU)
|
|
|
|
new_menu->entries[entry].menu_flags |=
|
2005-07-16 18:35:25 +04:00
|
|
|
wimp_MENU_GIVE_WARNING;
|
2005-04-08 00:46:22 +04:00
|
|
|
}
|
|
|
|
new_menu->entries[0].menu_flags |= wimp_MENU_TITLE_INDIRECTED;
|
|
|
|
new_menu->entries[entries - 1].menu_flags |= wimp_MENU_LAST;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/**
|
|
|
|
* Initialise the basic state of a menu structure so all entries are
|
|
|
|
* indirected text with no flags, no submenu.
|
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_menu_init_structure(wimp_menu *menu, int entries)
|
|
|
|
{
|
2005-12-31 07:40:49 +03:00
|
|
|
int i;
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
menu->title_fg = wimp_COLOUR_BLACK;
|
|
|
|
menu->title_bg = wimp_COLOUR_LIGHT_GREY;
|
|
|
|
menu->work_fg = wimp_COLOUR_BLACK;
|
|
|
|
menu->work_bg = wimp_COLOUR_WHITE;
|
|
|
|
menu->width = 200;
|
|
|
|
menu->height = wimp_MENU_ITEM_HEIGHT;
|
|
|
|
menu->gap = wimp_MENU_ITEM_GAP;
|
|
|
|
|
|
|
|
for (i = 0; i < entries; i++) {
|
|
|
|
menu->entries[i].menu_flags = 0;
|
|
|
|
menu->entries[i].sub_menu = wimp_NO_SUB_MENU;
|
|
|
|
menu->entries[i].icon_flags =
|
|
|
|
DEFAULT_FLAGS | wimp_ICON_INDIRECTED;
|
|
|
|
menu->entries[i].data.indirected_text.validation =
|
|
|
|
(char *)-1;
|
|
|
|
}
|
|
|
|
menu->entries[0].menu_flags |= wimp_MENU_TITLE_INDIRECTED;
|
2006-01-03 01:09:23 +03:00
|
|
|
menu->entries[i - 1].menu_flags |= wimp_MENU_LAST;
|
2005-12-31 07:40:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/**
|
|
|
|
* Finds the menu_definition corresponding to a wimp_menu.
|
|
|
|
*
|
|
|
|
* \param menu the menu to find the definition for
|
|
|
|
* \return the associated definition, or NULL if one could not be found
|
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
struct menu_definition *ro_gui_menu_find_menu(wimp_menu *menu)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
struct menu_definition *definition;
|
|
|
|
|
|
|
|
if (!menu)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (definition = ro_gui_menu_definitions; definition;
|
|
|
|
definition = definition->next)
|
|
|
|
if (definition->menu == menu)
|
|
|
|
return definition;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-25 05:43:07 +03:00
|
|
|
/**
|
|
|
|
* Finds the key associated with a menu entry translation.
|
|
|
|
*
|
|
|
|
* \param menu the menu to search
|
|
|
|
* \param translated the translated text
|
|
|
|
* \return the original message key, or NULL if one could not be found
|
|
|
|
*/
|
|
|
|
const char *ro_gui_menu_find_menu_entry_key(wimp_menu *menu,
|
2008-07-27 02:29:15 +04:00
|
|
|
const char *translated)
|
|
|
|
{
|
2006-01-25 05:43:07 +03:00
|
|
|
struct menu_definition_entry *entry;
|
|
|
|
struct menu_definition *definition = ro_gui_menu_find_menu(menu);
|
|
|
|
|
|
|
|
if (!definition)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (entry = definition->entries; entry; entry = entry->next)
|
|
|
|
if (!strcmp(entry->menu_entry->data.indirected_text.text, translated))
|
|
|
|
return entry->entry_key;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/**
|
|
|
|
* Finds the menu_definition_entry corresponding to an action for a wimp_menu.
|
|
|
|
*
|
|
|
|
* \param menu the menu to search for an action within
|
|
|
|
* \param action the action to find
|
|
|
|
* \return the associated menu entry, or NULL if one could not be found
|
|
|
|
*/
|
|
|
|
struct menu_definition_entry *ro_gui_menu_find_entry(wimp_menu *menu,
|
2008-07-27 02:29:15 +04:00
|
|
|
menu_action action)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
struct menu_definition_entry *entry;
|
|
|
|
struct menu_definition *definition = ro_gui_menu_find_menu(menu);
|
|
|
|
|
|
|
|
if (!definition)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (entry = definition->entries; entry; entry = entry->next)
|
|
|
|
if (entry->action == action)
|
|
|
|
return entry;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Finds the action corresponding to a wimp_menu_entry for a wimp_menu.
|
|
|
|
*
|
|
|
|
* \param menu the menu to search for an action within
|
|
|
|
* \param menu_entry the menu_entry to find
|
|
|
|
* \return the associated action, or 0 if one could not be found
|
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
menu_action ro_gui_menu_find_action(wimp_menu *menu, wimp_menu_entry *menu_entry)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
struct menu_definition_entry *entry;
|
|
|
|
struct menu_definition *definition = ro_gui_menu_find_menu(menu);
|
|
|
|
|
|
|
|
if (!definition)
|
|
|
|
return NO_ACTION;
|
|
|
|
|
|
|
|
for (entry = definition->entries; entry; entry = entry->next) {
|
|
|
|
if (entry->menu_entry == menu_entry)
|
|
|
|
return entry->action;
|
|
|
|
}
|
|
|
|
return NO_ACTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets an action within a menu as having a specific ticked status.
|
|
|
|
*
|
|
|
|
* \param menu the menu containing the action
|
|
|
|
* \param action the action to tick/untick
|
|
|
|
* \param ticked whether to set the item as ticked
|
|
|
|
*/
|
|
|
|
void ro_gui_menu_set_entry_shaded(wimp_menu *menu, menu_action action,
|
2008-07-27 02:29:15 +04:00
|
|
|
bool shaded)
|
|
|
|
{
|
2006-07-13 16:46:02 +04:00
|
|
|
struct menu_definition_entry *entry;
|
|
|
|
struct menu_definition *definition = ro_gui_menu_find_menu(menu);
|
|
|
|
|
|
|
|
if (!definition)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* we can't use find_entry as multiple actions may appear in one menu */
|
|
|
|
for (entry = definition->entries; entry; entry = entry->next)
|
|
|
|
if (entry->action == action) {
|
|
|
|
if (shaded)
|
|
|
|
entry->menu_entry->icon_flags |= wimp_ICON_SHADED;
|
|
|
|
else
|
|
|
|
entry->menu_entry->icon_flags &= ~wimp_ICON_SHADED;
|
|
|
|
}
|
2005-04-08 00:46:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets an action within a menu as having a specific ticked status.
|
|
|
|
*
|
|
|
|
* \param menu the menu containing the action
|
|
|
|
* \param action the action to tick/untick
|
|
|
|
* \param ticked whether to set the item as ticked
|
|
|
|
*/
|
|
|
|
void ro_gui_menu_set_entry_ticked(wimp_menu *menu, menu_action action,
|
2008-07-27 02:29:15 +04:00
|
|
|
bool ticked)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
struct menu_definition_entry *entry =
|
|
|
|
ro_gui_menu_find_entry(menu, action);
|
|
|
|
if (entry) {
|
|
|
|
if (ticked)
|
|
|
|
entry->menu_entry->menu_flags |= wimp_MENU_TICKED;
|
|
|
|
else
|
|
|
|
entry->menu_entry->menu_flags &= ~wimp_MENU_TICKED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles an action.
|
|
|
|
*
|
|
|
|
* \param owner the window to handle the action for
|
|
|
|
* \param action the action to handle
|
|
|
|
* \param windows_at_pointer whether to open any windows at the pointer location
|
|
|
|
*/
|
|
|
|
bool ro_gui_menu_handle_action(wimp_w owner, menu_action action,
|
2005-07-16 18:35:25 +04:00
|
|
|
bool windows_at_pointer)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
wimp_window_state state;
|
|
|
|
struct gui_window *g = NULL;
|
|
|
|
struct browser_window *bw = NULL;
|
2010-04-07 18:09:13 +04:00
|
|
|
hlcache_handle *h = NULL;
|
2005-04-08 00:46:22 +04:00
|
|
|
struct toolbar *t = NULL;
|
|
|
|
os_error *error;
|
|
|
|
char url[80];
|
2010-10-05 23:14:46 +04:00
|
|
|
bool is_cookies, is_hotlist, is_global_history;
|
2005-04-08 00:46:22 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
ro_gui_menu_get_window_details(owner, &g, &bw, &h, &t,
|
|
|
|
&is_cookies, &is_hotlist, &is_global_history);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
switch (action) {
|
|
|
|
|
|
|
|
/* help actions */
|
|
|
|
case HELP_OPEN_CONTENTS:
|
2008-01-20 02:29:28 +03:00
|
|
|
ro_gui_open_help_page("documentation/index");
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case HELP_OPEN_GUIDE:
|
2008-01-20 02:29:28 +03:00
|
|
|
ro_gui_open_help_page("documentation/guide");
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case HELP_OPEN_INFORMATION:
|
2008-01-20 02:29:28 +03:00
|
|
|
ro_gui_open_help_page("documentation/info");
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case HELP_OPEN_ABOUT:
|
2008-01-20 02:29:28 +03:00
|
|
|
ro_gui_open_help_page("about/index");
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case HELP_LAUNCH_INTERACTIVE:
|
2007-10-11 01:22:36 +04:00
|
|
|
if (!ro_gui_interactive_help_available()) {
|
|
|
|
ro_gui_interactive_help_start();
|
|
|
|
option_interactive_help = true;
|
|
|
|
} else {
|
|
|
|
option_interactive_help = !option_interactive_help;
|
|
|
|
}
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
|
|
|
|
/* history actions */
|
|
|
|
case HISTORY_SHOW_LOCAL:
|
|
|
|
if ((!bw) || (!bw->history))
|
|
|
|
return false;
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_history_open(bw, bw->history,
|
|
|
|
windows_at_pointer);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case HISTORY_SHOW_GLOBAL:
|
2010-10-05 23:14:46 +04:00
|
|
|
ro_gui_global_history_open();
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
|
|
|
|
/* hotlist actions */
|
|
|
|
case HOTLIST_ADD_URL:
|
2010-10-05 23:14:46 +04:00
|
|
|
if (h == NULL || content_get_url(h) == NULL)
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
2010-10-05 23:14:46 +04:00
|
|
|
hotlist_add_page(content_get_url(h));
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case HOTLIST_SHOW:
|
2010-10-05 23:14:46 +04:00
|
|
|
ro_gui_hotlist_open();
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
|
2006-07-13 16:46:02 +04:00
|
|
|
/* cookies actions */
|
|
|
|
case COOKIES_SHOW:
|
2010-10-05 23:14:46 +04:00
|
|
|
ro_gui_cookies_open();
|
2006-07-13 16:46:02 +04:00
|
|
|
return true;
|
|
|
|
|
2006-07-17 01:42:37 +04:00
|
|
|
case COOKIES_DELETE:
|
2010-10-05 23:14:46 +04:00
|
|
|
cookies_delete_all();
|
2006-07-17 01:42:37 +04:00
|
|
|
return true;
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* page actions */
|
|
|
|
case BROWSER_PAGE_INFO:
|
2010-04-07 18:09:13 +04:00
|
|
|
if (!h)
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_dialog_open_persistent(g->window,
|
|
|
|
dialog_pageinfo, windows_at_pointer);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case BROWSER_PRINT:
|
2010-04-07 18:09:13 +04:00
|
|
|
if (!h)
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_dialog_open_persistent(g->window,
|
|
|
|
dialog_print, windows_at_pointer);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case BROWSER_NEW_WINDOW:
|
2010-04-07 18:09:13 +04:00
|
|
|
if (!h)
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
2010-04-07 18:09:13 +04:00
|
|
|
browser_window_create(content_get_url(h), bw, 0, false,
|
|
|
|
false);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case BROWSER_VIEW_SOURCE:
|
2010-04-07 18:09:13 +04:00
|
|
|
if (!h)
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
2010-04-07 18:09:13 +04:00
|
|
|
ro_gui_view_source(h);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
|
|
|
|
/* object actions */
|
|
|
|
case BROWSER_OBJECT_INFO:
|
2009-02-01 05:19:01 +03:00
|
|
|
if (!current_menu_object)
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_dialog_open_persistent(g->window,
|
|
|
|
dialog_objinfo, windows_at_pointer);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case BROWSER_OBJECT_RELOAD:
|
2009-02-01 05:19:01 +03:00
|
|
|
if (!current_menu_object)
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
2010-04-07 19:34:01 +04:00
|
|
|
content_invalidate_reuse_data(current_menu_object);
|
2005-04-08 00:46:22 +04:00
|
|
|
browser_window_reload(bw, false);
|
|
|
|
return true;
|
|
|
|
|
2009-01-30 08:08:54 +03:00
|
|
|
/* link actions */
|
|
|
|
case BROWSER_LINK_SAVE_URI:
|
|
|
|
case BROWSER_LINK_SAVE_URL:
|
|
|
|
case BROWSER_LINK_SAVE_TEXT:
|
2009-02-01 05:19:01 +03:00
|
|
|
if (!current_menu_url)
|
2009-01-30 08:08:54 +03:00
|
|
|
return false;
|
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
|
|
|
ro_gui_dialog_open_persistent(owner, dialog_saveas,
|
|
|
|
windows_at_pointer);
|
|
|
|
break;
|
|
|
|
case BROWSER_LINK_DOWNLOAD:
|
2009-02-01 05:19:01 +03:00
|
|
|
if (!current_menu_url)
|
2009-01-30 08:08:54 +03:00
|
|
|
return false;
|
2010-04-07 18:09:13 +04:00
|
|
|
browser_window_download(bw, current_menu_url,
|
|
|
|
content_get_url(h));
|
2009-01-30 08:08:54 +03:00
|
|
|
break;
|
|
|
|
case BROWSER_LINK_NEW_WINDOW:
|
2009-02-01 05:19:01 +03:00
|
|
|
if (!current_menu_url)
|
2009-01-30 08:08:54 +03:00
|
|
|
return false;
|
2010-04-07 18:09:13 +04:00
|
|
|
browser_window_create(current_menu_url, bw,
|
|
|
|
content_get_url(h), true, false);
|
2009-01-30 08:08:54 +03:00
|
|
|
break;
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* save actions */
|
|
|
|
case BROWSER_OBJECT_SAVE:
|
|
|
|
case BROWSER_OBJECT_EXPORT_SPRITE:
|
2009-01-30 08:08:54 +03:00
|
|
|
case BROWSER_OBJECT_EXPORT_DRAW:
|
2010-04-07 18:09:13 +04:00
|
|
|
h = current_menu_object;
|
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
|
|
|
/* Fall through */
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_SAVE:
|
|
|
|
case BROWSER_SAVE_COMPLETE:
|
|
|
|
case BROWSER_EXPORT_DRAW:
|
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
|
|
|
case BROWSER_EXPORT_PDF:
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_EXPORT_TEXT:
|
|
|
|
case BROWSER_SAVE_URL_URI:
|
|
|
|
case BROWSER_SAVE_URL_URL:
|
|
|
|
case BROWSER_SAVE_URL_TEXT:
|
2010-04-07 18:09:13 +04:00
|
|
|
if (!h)
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
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
|
|
|
/* Fall through */
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
2005-07-16 09:54:45 +04:00
|
|
|
ro_gui_dialog_open_persistent(owner, dialog_saveas,
|
2005-04-08 00:46:22 +04:00
|
|
|
windows_at_pointer);
|
|
|
|
return true;
|
|
|
|
|
2009-01-30 08:08:54 +03:00
|
|
|
/* selection actions */
|
|
|
|
case BROWSER_SELECTION_SAVE:
|
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
|
|
|
ro_gui_dialog_open_persistent(owner, dialog_saveas,
|
|
|
|
windows_at_pointer);
|
|
|
|
return true;
|
|
|
|
case BROWSER_SELECTION_COPY:
|
2009-02-01 05:19:01 +03:00
|
|
|
browser_window_key_press(bw, KEY_COPY_SELECTION);
|
2009-01-30 08:08:54 +03:00
|
|
|
break;
|
|
|
|
case BROWSER_SELECTION_CUT:
|
2009-02-01 05:19:01 +03:00
|
|
|
browser_window_key_press(bw, KEY_CUT_SELECTION);
|
2009-01-30 08:08:54 +03:00
|
|
|
return true;
|
|
|
|
case BROWSER_SELECTION_PASTE:
|
2009-02-01 05:19:01 +03:00
|
|
|
browser_window_key_press(bw, KEY_PASTE);
|
2009-01-30 08:08:54 +03:00
|
|
|
return true;
|
2009-02-01 05:19:01 +03:00
|
|
|
case BROWSER_SELECTION_ALL:
|
|
|
|
browser_window_key_press(bw, KEY_SELECT_ALL);
|
|
|
|
break;
|
|
|
|
case BROWSER_SELECTION_CLEAR:
|
|
|
|
browser_window_key_press(bw, KEY_CLEAR_SELECTION);
|
|
|
|
break;
|
2009-01-30 08:08:54 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* navigation actions */
|
|
|
|
case BROWSER_NAVIGATE_HOME:
|
|
|
|
if (!bw)
|
|
|
|
return false;
|
2005-07-16 18:35:25 +04:00
|
|
|
if ((option_homepage_url) &&
|
|
|
|
(option_homepage_url[0])) {
|
|
|
|
browser_window_go(g->bw,
|
2006-04-22 22:24:18 +04:00
|
|
|
option_homepage_url, 0, true);
|
2005-04-08 00:46:22 +04:00
|
|
|
} else {
|
|
|
|
snprintf(url, sizeof url,
|
2008-01-20 02:30:30 +03:00
|
|
|
"file:///<NetSurf$Dir>/Docs/welcome/index_%s",
|
2005-04-08 00:46:22 +04:00
|
|
|
option_language);
|
2006-04-22 22:24:18 +04:00
|
|
|
browser_window_go(g->bw, url, 0, true);
|
2005-04-08 00:46:22 +04:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
case BROWSER_NAVIGATE_BACK:
|
|
|
|
if ((!bw) || (!bw->history))
|
|
|
|
return false;
|
|
|
|
history_back(bw, bw->history);
|
|
|
|
return true;
|
|
|
|
case BROWSER_NAVIGATE_FORWARD:
|
|
|
|
if ((!bw) || (!bw->history))
|
|
|
|
return false;
|
|
|
|
history_forward(bw, bw->history);
|
|
|
|
return true;
|
2006-07-04 01:07:02 +04:00
|
|
|
case BROWSER_NAVIGATE_UP:
|
2010-04-07 18:09:13 +04:00
|
|
|
if ((!bw) || (!h))
|
2006-07-04 01:07:02 +04:00
|
|
|
return false;
|
2010-04-07 18:09:13 +04:00
|
|
|
return ro_gui_window_navigate_up(bw->window,
|
|
|
|
content_get_url(h));
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_NAVIGATE_RELOAD:
|
|
|
|
case BROWSER_NAVIGATE_RELOAD_ALL:
|
|
|
|
if (!bw)
|
|
|
|
return false;
|
|
|
|
browser_window_reload(bw,
|
|
|
|
(action == BROWSER_NAVIGATE_RELOAD_ALL));
|
|
|
|
return true;
|
|
|
|
case BROWSER_NAVIGATE_STOP:
|
|
|
|
if (!bw)
|
|
|
|
return false;
|
|
|
|
browser_window_stop(bw);
|
|
|
|
return true;
|
|
|
|
case BROWSER_NAVIGATE_URL:
|
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
2005-07-16 09:54:45 +04:00
|
|
|
ro_gui_dialog_open_persistent(NULL, dialog_openurl,
|
2005-04-08 00:46:22 +04:00
|
|
|
windows_at_pointer);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* browser window/display actions */
|
|
|
|
case BROWSER_SCALE_VIEW:
|
2010-04-07 18:09:13 +04:00
|
|
|
if (!h)
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
2005-07-16 09:54:45 +04:00
|
|
|
ro_gui_dialog_open_persistent(g->window, dialog_zoom,
|
2005-04-08 00:46:22 +04:00
|
|
|
windows_at_pointer);
|
|
|
|
return true;
|
|
|
|
case BROWSER_FIND_TEXT:
|
2010-04-07 18:09:13 +04:00
|
|
|
if (!h || (content_get_type(h) != CONTENT_TEXTPLAIN &&
|
|
|
|
content_get_type(h) != CONTENT_HTML))
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_dialog_open_persistent(g->window,
|
|
|
|
dialog_search, windows_at_pointer);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case BROWSER_IMAGES_BACKGROUND:
|
|
|
|
if (!g)
|
|
|
|
return false;
|
2005-07-16 18:35:25 +04:00
|
|
|
g->option.background_images =
|
|
|
|
!g->option.background_images;
|
2005-04-08 00:46:22 +04:00
|
|
|
gui_window_redraw_window(g);
|
|
|
|
return true;
|
|
|
|
case BROWSER_BUFFER_ANIMS:
|
|
|
|
if (!g)
|
|
|
|
return false;
|
2005-07-16 18:35:25 +04:00
|
|
|
g->option.buffer_animations =
|
|
|
|
!g->option.buffer_animations;
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_BUFFER_ALL:
|
|
|
|
if (!g)
|
|
|
|
return false;
|
2005-07-16 18:35:25 +04:00
|
|
|
g->option.buffer_everything =
|
|
|
|
!g->option.buffer_everything;
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_SAVE_VIEW:
|
|
|
|
if (!bw)
|
|
|
|
return false;
|
|
|
|
ro_gui_window_default_options(bw);
|
|
|
|
ro_gui_save_options();
|
|
|
|
return true;
|
|
|
|
case BROWSER_WINDOW_DEFAULT:
|
|
|
|
if (!g)
|
|
|
|
return false;
|
|
|
|
ro_gui_screen_size(&option_window_screen_width,
|
|
|
|
&option_window_screen_height);
|
|
|
|
state.w = current_menu_window;
|
|
|
|
error = xwimp_get_window_state(&state);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_window_state: 0x%x: %s",
|
2005-07-16 18:35:25 +04:00
|
|
|
error->errnum,
|
|
|
|
error->errmess));
|
2005-04-08 00:46:22 +04:00
|
|
|
warn_user("WimpError", error->errmess);
|
|
|
|
}
|
|
|
|
option_window_x = state.visible.x0;
|
|
|
|
option_window_y = state.visible.y0;
|
2005-07-16 18:35:25 +04:00
|
|
|
option_window_width =
|
|
|
|
state.visible.x1 - state.visible.x0;
|
|
|
|
option_window_height =
|
|
|
|
state.visible.y1 - state.visible.y0;
|
2005-08-03 21:02:16 +04:00
|
|
|
ro_gui_save_options();
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case BROWSER_WINDOW_STAGGER:
|
|
|
|
option_window_stagger = !option_window_stagger;
|
|
|
|
ro_gui_save_options();
|
|
|
|
return true;
|
|
|
|
case BROWSER_WINDOW_COPY:
|
|
|
|
option_window_size_clone = !option_window_size_clone;
|
|
|
|
ro_gui_save_options();
|
|
|
|
return true;
|
|
|
|
case BROWSER_WINDOW_RESET:
|
|
|
|
option_window_screen_width = 0;
|
|
|
|
option_window_screen_height = 0;
|
|
|
|
ro_gui_save_options();
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* toolbar actions */
|
|
|
|
case TOOLBAR_BUTTONS:
|
|
|
|
assert(t);
|
|
|
|
t->display_buttons = !t->display_buttons;
|
2010-10-25 01:52:16 +04:00
|
|
|
ro_gui_theme_refresh_toolbar(t);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case TOOLBAR_ADDRESS_BAR:
|
|
|
|
assert(t);
|
|
|
|
t->display_url = !t->display_url;
|
2010-10-25 01:52:16 +04:00
|
|
|
ro_gui_theme_refresh_toolbar(t);
|
2005-04-08 00:46:22 +04:00
|
|
|
if (t->display_url)
|
|
|
|
ro_gui_set_caret_first(t->toolbar_handle);
|
|
|
|
return true;
|
|
|
|
case TOOLBAR_THROBBER:
|
|
|
|
assert(t);
|
|
|
|
t->display_throbber = !t->display_throbber;
|
2010-10-25 01:52:16 +04:00
|
|
|
ro_gui_theme_refresh_toolbar(t);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case TOOLBAR_EDIT:
|
|
|
|
assert(t);
|
|
|
|
ro_gui_theme_toggle_edit(t);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* misc actions */
|
|
|
|
case APPLICATION_QUIT:
|
2005-12-10 21:02:36 +03:00
|
|
|
if (ro_gui_prequit()) {
|
|
|
|
LOG(("QUIT in response to user request"));
|
2005-04-23 06:58:27 +04:00
|
|
|
netsurf_quit = true;
|
2005-12-10 21:02:36 +03:00
|
|
|
}
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case CHOICES_SHOW:
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_configure_show();
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
|
|
|
|
/* unknown action */
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepares an action for use.
|
|
|
|
*
|
|
|
|
* \param owner the window to prepare the action for
|
|
|
|
* \param action the action to prepare
|
|
|
|
* \param windows whether to update sub-windows
|
|
|
|
*/
|
2005-07-16 18:35:25 +04:00
|
|
|
void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
|
|
|
bool windows)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
struct gui_window *g;
|
|
|
|
struct browser_window *bw;
|
2010-04-07 18:09:13 +04:00
|
|
|
hlcache_handle *h;
|
2005-04-08 00:46:22 +04:00
|
|
|
struct toolbar *t;
|
|
|
|
bool result = false;
|
|
|
|
int checksum = 0;
|
|
|
|
os_error *error;
|
2006-07-04 01:07:02 +04:00
|
|
|
char *parent;
|
|
|
|
url_func_result res;
|
|
|
|
bool compare;
|
2010-10-05 23:14:46 +04:00
|
|
|
bool is_cookies, is_hotlist, is_global_history;
|
2005-04-08 00:46:22 +04:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
ro_gui_menu_get_window_details(owner, &g, &bw, &h, &t,
|
|
|
|
&is_cookies, &is_hotlist, &is_global_history);
|
2005-04-08 00:46:22 +04:00
|
|
|
if (current_menu_open)
|
|
|
|
checksum = ro_gui_menu_get_checksum();
|
2010-04-07 18:09:13 +04:00
|
|
|
if (!h) {
|
2009-02-01 05:19:01 +03:00
|
|
|
current_menu_object = NULL;
|
|
|
|
current_menu_url = NULL;
|
|
|
|
}
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
switch (action) {
|
|
|
|
|
|
|
|
/* help actions */
|
|
|
|
case HELP_LAUNCH_INTERACTIVE:
|
2007-10-11 01:22:36 +04:00
|
|
|
result = ro_gui_interactive_help_available()
|
|
|
|
&& option_interactive_help;
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_ticked(current_menu,
|
|
|
|
action, result);
|
2007-10-11 01:22:36 +04:00
|
|
|
ro_gui_save_options();
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* history actions */
|
|
|
|
case HISTORY_SHOW_LOCAL:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
(!bw || (!bw->history) ||
|
2010-04-07 18:09:13 +04:00
|
|
|
!(h || history_back_available(bw->history) ||
|
2005-04-08 00:46:22 +04:00
|
|
|
history_forward_available(bw->history))));
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* hotlist actions */
|
|
|
|
case HOTLIST_ADD_URL:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
2010-10-05 23:14:46 +04:00
|
|
|
h == NULL);
|
2006-07-17 01:42:37 +04:00
|
|
|
break;
|
2006-07-13 16:46:02 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* page actions */
|
2009-01-30 08:08:54 +03:00
|
|
|
case BROWSER_PAGE:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h ||
|
|
|
|
(content_get_type(h) != CONTENT_HTML &&
|
|
|
|
content_get_type(h) != CONTENT_TEXTPLAIN));
|
2009-01-30 08:08:54 +03:00
|
|
|
break;
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_PAGE_INFO:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((windows) && (h))
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_prepare_pageinfo(g);
|
|
|
|
break;
|
|
|
|
case BROWSER_PRINT:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((t) && (t->type == THEME_BROWSER_TOOLBAR))
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
2010-04-07 18:09:13 +04:00
|
|
|
ICON_TOOLBAR_PRINT, !h);
|
|
|
|
if ((windows) && (h))
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_print_prepare(g);
|
2005-07-16 18:35:25 +04:00
|
|
|
if ((t) && (!t->editor) &&
|
|
|
|
(t->type == THEME_BROWSER_TOOLBAR))
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
2010-04-07 18:09:13 +04:00
|
|
|
ICON_TOOLBAR_PRINT, !h);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_NEW_WINDOW:
|
|
|
|
case BROWSER_VIEW_SOURCE:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* object actions */
|
|
|
|
case BROWSER_OBJECT:
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
2010-10-05 23:14:46 +04:00
|
|
|
!current_menu_object &&
|
|
|
|
!current_menu_url);
|
2009-01-30 08:08:54 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BROWSER_OBJECT_LINK:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
2009-02-01 05:19:01 +03:00
|
|
|
!current_menu_url);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
2009-01-30 08:08:54 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_OBJECT_INFO:
|
2009-02-01 05:19:01 +03:00
|
|
|
if (windows && current_menu_object)
|
2010-10-05 23:14:46 +04:00
|
|
|
ro_gui_menu_prepare_objectinfo(
|
|
|
|
current_menu_object,
|
2009-02-01 05:19:01 +03:00
|
|
|
current_menu_url);
|
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
|
|
|
/* Fall through */
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_OBJECT_RELOAD:
|
2009-02-01 05:19:01 +03:00
|
|
|
case BROWSER_OBJECT_OBJECT:
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
2009-02-01 05:19:01 +03:00
|
|
|
!current_menu_object);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BROWSER_OBJECT_PRINT:
|
|
|
|
/* not yet implemented */
|
2010-10-05 23:14:46 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
true);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* save actions (browser, hotlist, history) */
|
|
|
|
case BROWSER_OBJECT_SAVE:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2009-02-01 05:19:01 +03:00
|
|
|
action, !current_menu_object);
|
|
|
|
if (windows && current_menu_object)
|
2010-10-05 23:14:46 +04:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_OBJECT_ORIG,
|
|
|
|
current_menu_object,
|
2009-02-03 02:20:20 +03:00
|
|
|
NULL, NULL, NULL);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
2009-01-30 08:08:54 +03:00
|
|
|
case BROWSER_OBJECT_EXPORT:
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_OBJECT_EXPORT_SPRITE:
|
2009-01-30 08:08:54 +03:00
|
|
|
case BROWSER_OBJECT_EXPORT_DRAW: {
|
|
|
|
bool exp_sprite = false;
|
|
|
|
bool exp_draw = false;
|
|
|
|
|
2009-02-01 05:19:01 +03:00
|
|
|
if (current_menu_object)
|
2010-04-07 18:09:13 +04:00
|
|
|
h = current_menu_object;
|
2009-01-30 08:08:54 +03:00
|
|
|
|
2010-04-07 18:09:13 +04:00
|
|
|
if (h) {
|
|
|
|
switch (content_get_type(h)) {
|
2009-01-30 08:08:54 +03:00
|
|
|
/* \todo - this classification should prob be done in content_() */
|
2010-10-05 23:14:46 +04:00
|
|
|
/* bitmap types (Sprite export possible) */
|
2009-01-30 08:08:54 +03:00
|
|
|
#ifdef WITH_JPEG
|
2010-10-05 23:14:46 +04:00
|
|
|
case CONTENT_JPEG:
|
2009-01-30 08:08:54 +03:00
|
|
|
#endif
|
|
|
|
#ifdef WITH_MNG
|
2010-10-05 23:14:46 +04:00
|
|
|
case CONTENT_JNG:
|
|
|
|
case CONTENT_MNG:
|
2009-01-30 08:08:54 +03:00
|
|
|
#endif
|
|
|
|
#ifdef WITH_GIF
|
2010-10-05 23:14:46 +04:00
|
|
|
case CONTENT_GIF:
|
2009-01-30 08:08:54 +03:00
|
|
|
#endif
|
|
|
|
#ifdef WITH_BMP
|
2010-10-05 23:14:46 +04:00
|
|
|
case CONTENT_BMP:
|
|
|
|
case CONTENT_ICO:
|
2009-01-30 08:08:54 +03:00
|
|
|
#endif
|
|
|
|
#if defined(WITH_MNG) || defined(WITH_PNG)
|
2010-10-05 23:14:46 +04:00
|
|
|
case CONTENT_PNG:
|
2009-01-30 08:08:54 +03:00
|
|
|
#endif
|
|
|
|
#ifdef WITH_SPRITE
|
2010-10-05 23:14:46 +04:00
|
|
|
case CONTENT_SPRITE:
|
2009-01-30 08:08:54 +03:00
|
|
|
#endif
|
2010-10-05 23:14:46 +04:00
|
|
|
exp_sprite = true;
|
|
|
|
break;
|
2009-01-30 08:08:54 +03:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
/* vector types (Draw export possible) */
|
2009-01-30 08:08:54 +03:00
|
|
|
#if defined(WITH_NS_SVG) || defined(WITH_RSVG)
|
2010-10-05 23:14:46 +04:00
|
|
|
case CONTENT_SVG:
|
2009-02-03 00:44:54 +03:00
|
|
|
#endif
|
2009-01-30 08:08:54 +03:00
|
|
|
#ifdef WITH_DRAW
|
2010-10-05 23:14:46 +04:00
|
|
|
case CONTENT_DRAW:
|
2009-01-30 08:08:54 +03:00
|
|
|
#endif
|
2010-10-05 23:14:46 +04:00
|
|
|
exp_draw = true;
|
|
|
|
break;
|
2009-01-30 08:08:54 +03:00
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
default: break;
|
2009-01-30 08:08:54 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (action) {
|
2010-04-07 18:09:13 +04:00
|
|
|
case BROWSER_OBJECT_EXPORT_SPRITE:
|
|
|
|
if (!exp_sprite)
|
|
|
|
h = NULL;
|
|
|
|
break;
|
|
|
|
case BROWSER_OBJECT_EXPORT_DRAW:
|
|
|
|
if (!exp_draw)
|
|
|
|
h = NULL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (!exp_sprite && !exp_draw)
|
|
|
|
h = NULL;
|
|
|
|
break;
|
2009-01-30 08:08:54 +03:00
|
|
|
}
|
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((h) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE, h, NULL, NULL, NULL);
|
2009-01-30 08:08:54 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BROWSER_LINK_SAVE_URI:
|
|
|
|
case BROWSER_LINK_SAVE_URL:
|
|
|
|
case BROWSER_LINK_SAVE_TEXT:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2009-02-01 05:19:01 +03:00
|
|
|
action, !current_menu_url);
|
|
|
|
if (windows && current_menu_url) {
|
2009-01-30 08:08:54 +03:00
|
|
|
gui_save_type save_type;
|
|
|
|
switch (action) {
|
|
|
|
case BROWSER_LINK_SAVE_URI:
|
|
|
|
save_type = GUI_SAVE_LINK_URI;
|
|
|
|
break;
|
|
|
|
case BROWSER_LINK_SAVE_URL:
|
|
|
|
save_type = GUI_SAVE_LINK_URL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
save_type = GUI_SAVE_LINK_TEXT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ro_gui_save_prepare(save_type, NULL, NULL,
|
2009-02-01 05:19:01 +03:00
|
|
|
current_menu_url, NULL);
|
2009-01-30 08:08:54 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BROWSER_SELECTION:
|
2010-04-07 18:09:13 +04:00
|
|
|
/* make menu available if there's anything that /could/
|
|
|
|
* be selected */
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
2010-04-07 18:09:13 +04:00
|
|
|
!h || (content_get_type(h) != CONTENT_HTML &&
|
|
|
|
content_get_type(h) != CONTENT_TEXTPLAIN));
|
2009-01-30 08:08:54 +03:00
|
|
|
break;
|
|
|
|
case BROWSER_SELECTION_SAVE:
|
2010-04-07 18:09:13 +04:00
|
|
|
if (h && (!bw->sel || !selection_defined(bw->sel)))
|
|
|
|
h = NULL;
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action, !h);
|
|
|
|
if ((h) && (windows))
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_TEXT_SELECTION, NULL, bw->sel, NULL, NULL);
|
|
|
|
break;
|
|
|
|
case BROWSER_SELECTION_COPY:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
2010-04-07 18:09:13 +04:00
|
|
|
!(h && bw->sel && selection_defined(bw->sel)));
|
2009-01-30 08:08:54 +03:00
|
|
|
break;
|
2009-02-02 03:06:31 +03:00
|
|
|
case BROWSER_SELECTION_CUT:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
2010-04-07 18:09:13 +04:00
|
|
|
!(h && bw->sel && selection_defined(bw->sel)
|
2009-02-02 03:06:31 +03:00
|
|
|
&& !selection_read_only(bw->sel)));
|
|
|
|
break;
|
2009-01-30 08:08:54 +03:00
|
|
|
case BROWSER_SELECTION_PASTE:
|
2010-04-07 18:09:13 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
!(h && bw->paste_callback));
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_SAVE:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((h) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_SOURCE, h, NULL, NULL, NULL);
|
2005-07-16 18:35:25 +04:00
|
|
|
if ((t) && (!t->editor) &&
|
|
|
|
(t->type == THEME_BROWSER_TOOLBAR))
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
2010-04-07 18:09:13 +04:00
|
|
|
ICON_TOOLBAR_SAVE, !h);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_SAVE_COMPLETE:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((h) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_COMPLETE, h, NULL, NULL, NULL);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_EXPORT_DRAW:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((h) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_DRAW, h, NULL, NULL, NULL);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
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
|
|
|
case BROWSER_EXPORT_PDF:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((h) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_PDF, h, NULL, NULL, NULL);
|
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
|
|
|
break;
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_EXPORT_TEXT:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((h) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_TEXT, h, NULL, NULL, NULL);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_OBJECT_SAVE_URL_URI:
|
2010-04-07 18:09:13 +04:00
|
|
|
if (h && content_get_type(h) == CONTENT_HTML)
|
|
|
|
h = current_menu_object;
|
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
|
|
|
/* Fall through */
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_SAVE_URL_URI:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((h) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL,
|
|
|
|
NULL,
|
|
|
|
content_get_url(h),
|
|
|
|
content_get_title(h));
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_OBJECT_SAVE_URL_URL:
|
2010-04-07 18:09:13 +04:00
|
|
|
if (h && content_get_type(h) == CONTENT_HTML)
|
|
|
|
h = current_menu_object;
|
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
|
|
|
/* Fall through */
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_SAVE_URL_URL:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((h) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL,
|
|
|
|
NULL,
|
|
|
|
content_get_url(h),
|
|
|
|
content_get_title(h));
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_OBJECT_SAVE_URL_TEXT:
|
2010-04-07 18:09:13 +04:00
|
|
|
h = current_menu_object;
|
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
|
|
|
/* Fall through */
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_SAVE_URL_TEXT:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((h) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL,
|
|
|
|
NULL,
|
|
|
|
content_get_url(h),
|
|
|
|
content_get_title(h));
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* navigation actions */
|
|
|
|
case BROWSER_NAVIGATE_BACK:
|
2009-03-24 01:56:31 +03:00
|
|
|
result = browser_window_back_available(bw);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2009-03-24 01:56:31 +03:00
|
|
|
action, !result);
|
2005-07-16 18:35:25 +04:00
|
|
|
if ((t) && (!t->editor) &&
|
|
|
|
(t->type == THEME_BROWSER_TOOLBAR))
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
2009-03-24 01:56:31 +03:00
|
|
|
ICON_TOOLBAR_BACK, !result);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_NAVIGATE_FORWARD:
|
2009-03-24 01:56:31 +03:00
|
|
|
result = browser_window_forward_available(bw);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2009-03-24 01:56:31 +03:00
|
|
|
action, !result);
|
2005-07-16 18:35:25 +04:00
|
|
|
if ((t) && (!t->editor) &&
|
|
|
|
(t->type == THEME_BROWSER_TOOLBAR))
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
2009-03-24 01:56:31 +03:00
|
|
|
ICON_TOOLBAR_FORWARD, !result);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
2006-07-04 01:07:02 +04:00
|
|
|
case BROWSER_NAVIGATE_UP:
|
2010-04-07 18:09:13 +04:00
|
|
|
result = (bw && h);
|
2006-07-04 01:07:02 +04:00
|
|
|
if (result) {
|
2010-04-07 18:09:13 +04:00
|
|
|
res = url_parent(content_get_url(h), &parent);
|
2006-07-04 01:07:02 +04:00
|
|
|
if (res == URL_FUNC_OK) {
|
2010-04-07 18:09:13 +04:00
|
|
|
res = url_compare(content_get_url(h),
|
|
|
|
parent, false,
|
|
|
|
&compare);
|
2008-02-03 15:04:48 +03:00
|
|
|
if (res == URL_FUNC_OK)
|
|
|
|
result = !compare;
|
2006-07-04 01:07:02 +04:00
|
|
|
free(parent);
|
|
|
|
} else {
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, !result);
|
|
|
|
if ((t) && (!t->editor) &&
|
|
|
|
(t->type == THEME_BROWSER_TOOLBAR))
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
|
|
|
ICON_TOOLBAR_UP, !result);
|
|
|
|
break;
|
2005-04-08 00:46:22 +04:00
|
|
|
case BROWSER_NAVIGATE_RELOAD:
|
|
|
|
case BROWSER_NAVIGATE_RELOAD_ALL:
|
2009-03-24 01:56:31 +03:00
|
|
|
result = browser_window_reload_available(bw);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, !result);
|
|
|
|
if ((t) && (!t->editor) &&
|
|
|
|
(t->type == THEME_BROWSER_TOOLBAR))
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
2005-04-08 00:46:22 +04:00
|
|
|
ICON_TOOLBAR_RELOAD, !result);
|
|
|
|
break;
|
|
|
|
case BROWSER_NAVIGATE_STOP:
|
2009-03-24 01:56:31 +03:00
|
|
|
result = browser_window_stop_available(bw);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, !result);
|
|
|
|
if ((t) && (!t->editor) &&
|
|
|
|
(t->type == THEME_BROWSER_TOOLBAR))
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
2005-04-08 00:46:22 +04:00
|
|
|
ICON_TOOLBAR_STOP, !result);
|
|
|
|
break;
|
|
|
|
case BROWSER_NAVIGATE_URL:
|
|
|
|
if (windows)
|
|
|
|
ro_gui_dialog_prepare_open_url();
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* display actions */
|
|
|
|
case BROWSER_SCALE_VIEW:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
2010-04-07 18:09:13 +04:00
|
|
|
action, !h);
|
|
|
|
if ((h) && (windows))
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_dialog_prepare_zoom(g);
|
2005-07-16 18:35:25 +04:00
|
|
|
if ((t) && (!t->editor) &&
|
|
|
|
(t->type == THEME_BROWSER_TOOLBAR))
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
2010-04-07 18:09:13 +04:00
|
|
|
ICON_TOOLBAR_SCALE, !h);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_FIND_TEXT:
|
2010-04-07 18:09:13 +04:00
|
|
|
result = !h || (content_get_type(h) != CONTENT_HTML &&
|
|
|
|
content_get_type(h) != CONTENT_TEXTPLAIN);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, result);
|
2005-12-31 07:40:49 +03:00
|
|
|
if ((!result) && (windows)) {
|
2009-12-18 02:55:02 +03:00
|
|
|
ro_gui_search_prepare(g->bw);
|
2005-12-31 07:40:49 +03:00
|
|
|
}
|
2005-07-16 18:35:25 +04:00
|
|
|
if ((t) && (!t->editor) &&
|
|
|
|
(t->type == THEME_BROWSER_TOOLBAR))
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
2005-04-29 09:58:25 +04:00
|
|
|
ICON_TOOLBAR_SEARCH, result);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_IMAGES_FOREGROUND:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, true);
|
|
|
|
ro_gui_menu_set_entry_ticked(current_menu,
|
|
|
|
action, true);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_IMAGES_BACKGROUND:
|
|
|
|
if (g)
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_ticked(current_menu,
|
|
|
|
action, g->option.background_images);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_BUFFER_ANIMS:
|
|
|
|
if (g) {
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, g->option.buffer_everything);
|
|
|
|
ro_gui_menu_set_entry_ticked(current_menu,
|
|
|
|
action,
|
2005-04-08 00:46:22 +04:00
|
|
|
g->option.buffer_animations ||
|
|
|
|
g->option.buffer_everything);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BROWSER_BUFFER_ALL:
|
|
|
|
if (g)
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_ticked(current_menu,
|
|
|
|
action, g->option.buffer_everything);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_WINDOW_STAGGER:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
option_window_screen_width == 0);
|
|
|
|
ro_gui_menu_set_entry_ticked(current_menu, action,
|
|
|
|
((option_window_screen_width == 0) ||
|
|
|
|
option_window_stagger));
|
|
|
|
break;
|
|
|
|
case BROWSER_WINDOW_COPY:
|
|
|
|
ro_gui_menu_set_entry_ticked(current_menu, action,
|
|
|
|
option_window_size_clone);
|
|
|
|
break;
|
|
|
|
case BROWSER_WINDOW_RESET:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
option_window_screen_width == 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* tree actions */
|
|
|
|
case TREE_SELECTION:
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* toolbar actions */
|
|
|
|
case TOOLBAR_BUTTONS:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, (!t || (t->editor)));
|
|
|
|
ro_gui_menu_set_entry_ticked(current_menu,
|
|
|
|
action, (t &&
|
2005-04-08 00:46:22 +04:00
|
|
|
((t->display_buttons) || (t->editor))));
|
|
|
|
break;
|
|
|
|
case TOOLBAR_ADDRESS_BAR:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, !t);
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_set_entry_ticked(current_menu, action,
|
|
|
|
(t && t->display_url));
|
|
|
|
break;
|
|
|
|
case TOOLBAR_THROBBER:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, !t);
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_set_entry_ticked(current_menu, action,
|
|
|
|
(t && t->display_throbber));
|
|
|
|
break;
|
|
|
|
case TOOLBAR_EDIT:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, !t);
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_set_entry_ticked(current_menu, action,
|
|
|
|
(t && t->editor));
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* unknown action */
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* update open menus */
|
|
|
|
if ((current_menu_open) &&
|
|
|
|
(checksum != ro_gui_menu_get_checksum())) {
|
|
|
|
error = xwimp_create_menu(current_menu, 0, 0);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_create_menu: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets various details relating to a window
|
|
|
|
*
|
|
|
|
* \param w the window to complete information for
|
|
|
|
*/
|
|
|
|
void ro_gui_menu_get_window_details(wimp_w w, struct gui_window **g,
|
2010-04-07 18:09:13 +04:00
|
|
|
struct browser_window **bw, hlcache_handle **h,
|
2010-10-05 23:14:46 +04:00
|
|
|
struct toolbar **toolbar,
|
|
|
|
bool *is_cookies, bool *is_hotlist, bool *is_global_history)
|
2008-07-27 02:29:15 +04:00
|
|
|
{
|
2010-10-05 23:14:46 +04:00
|
|
|
*is_cookies = false;
|
|
|
|
*is_hotlist = false;
|
|
|
|
*is_global_history = false;
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
*g = ro_gui_window_lookup(w);
|
2010-10-05 23:14:46 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
if (*g) {
|
|
|
|
*bw = (*g)->bw;
|
|
|
|
*toolbar = (*g)->toolbar;
|
|
|
|
if (*bw)
|
2010-04-07 18:09:13 +04:00
|
|
|
*h = (*bw)->current_content;
|
2005-04-08 00:46:22 +04:00
|
|
|
} else {
|
|
|
|
*bw = NULL;
|
2010-04-07 18:09:13 +04:00
|
|
|
*h = NULL;
|
2010-10-05 23:14:46 +04:00
|
|
|
if (ro_gui_hotlist_check_window(w)) {
|
|
|
|
*is_hotlist = true;
|
|
|
|
// *toolbar = treeview_window->toolbar;
|
|
|
|
} else if (ro_gui_global_history_check_window(w)) {
|
|
|
|
*is_global_history = true;
|
|
|
|
// *toolbar = treeview_window->toolbar;
|
|
|
|
} else if (ro_gui_cookies_check_window(w)) {
|
|
|
|
*is_cookies = true;
|
|
|
|
// *toolbar = treeview_window->toolbar;
|
|
|
|
} else {
|
2005-04-08 00:46:22 +04:00
|
|
|
*toolbar = NULL;
|
2010-10-05 23:14:46 +04:00
|
|
|
}
|
2005-04-08 00:46:22 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculates a simple checksum for the current menu state
|
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
int ro_gui_menu_get_checksum(void)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
wimp_selection menu_tree;
|
|
|
|
int i = 0, j, checksum = 0;
|
|
|
|
os_error *error;
|
|
|
|
wimp_menu *menu;
|
2005-06-08 01:29:26 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
if (!current_menu_open)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error = xwimp_get_menu_state((wimp_menu_state_flags)0,
|
|
|
|
&menu_tree, 0, 0);
|
|
|
|
if (error) {
|
|
|
|
LOG(("xwimp_get_menu_state: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
warn_user("MenuError", error->errmess);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
menu = current_menu;
|
2005-12-31 07:40:49 +03:00
|
|
|
do {
|
2005-04-08 00:46:22 +04:00
|
|
|
j = 0;
|
|
|
|
do {
|
|
|
|
if (menu->entries[j].icon_flags & wimp_ICON_SHADED)
|
|
|
|
checksum ^= (1 << (i + j * 2));
|
|
|
|
if (menu->entries[j].menu_flags & wimp_MENU_TICKED)
|
|
|
|
checksum ^= (2 << (i + j * 2));
|
|
|
|
} while (!(menu->entries[j++].menu_flags & wimp_MENU_LAST));
|
2005-06-09 22:37:27 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
j = menu_tree.items[i++];
|
2005-12-31 07:40:49 +03:00
|
|
|
if (j != -1) {
|
|
|
|
menu = menu->entries[j].sub_menu;
|
|
|
|
if ((!menu) || (menu == wimp_NO_SUB_MENU) || (!IS_MENU(menu)))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (j != -1);
|
2005-06-09 22:37:27 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
return checksum;
|
2004-07-18 03:32:09 +04:00
|
|
|
}
|
2005-07-16 18:35:25 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Translate a menu's textual content into the system local encoding
|
|
|
|
*
|
|
|
|
* \param menu The menu to translate
|
|
|
|
* \return false if out of memory, true otherwise
|
|
|
|
*/
|
|
|
|
bool ro_gui_menu_translate(struct menu_definition *menu)
|
|
|
|
{
|
|
|
|
os_error *error;
|
|
|
|
int alphabet;
|
|
|
|
struct menu_definition_entry *entry;
|
|
|
|
char *translated;
|
|
|
|
utf8_convert_ret err;
|
|
|
|
|
2010-10-05 23:14:46 +04:00
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
/* read current alphabet */
|
|
|
|
error = xosbyte1(osbyte_ALPHABET_NUMBER, 127, 0, &alphabet);
|
|
|
|
if (error) {
|
|
|
|
LOG(("failed reading alphabet: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
/* assume Latin1 */
|
|
|
|
alphabet = territory_ALPHABET_LATIN1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (menu->current_encoding == alphabet)
|
|
|
|
/* menu text is already in the correct encoding */
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* translate root menu title text */
|
|
|
|
free(menu->menu->title_data.indirected_text.text);
|
|
|
|
err = utf8_to_local_encoding(messages_get(menu->title_key),
|
|
|
|
0, &translated);
|
|
|
|
if (err != UTF8_CONVERT_OK) {
|
|
|
|
assert(err != UTF8_CONVERT_BADENC);
|
|
|
|
LOG(("utf8_to_enc failed"));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* and fill in WIMP menu field */
|
|
|
|
menu->menu->title_data.indirected_text.text = translated;
|
|
|
|
|
|
|
|
/* now the menu entries */
|
|
|
|
for (entry = menu->entries; entry; entry = entry->next) {
|
|
|
|
wimp_menu *submenu = entry->menu_entry->sub_menu;
|
|
|
|
|
|
|
|
/* tranlate menu entry text */
|
|
|
|
free(entry->menu_entry->data.indirected_text.text);
|
|
|
|
err = utf8_to_local_encoding(messages_get(entry->entry_key),
|
|
|
|
0, &translated);
|
|
|
|
if (err != UTF8_CONVERT_OK) {
|
|
|
|
assert(err != UTF8_CONVERT_BADENC);
|
|
|
|
LOG(("utf8_to_enc failed"));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fill in WIMP menu fields */
|
|
|
|
entry->menu_entry->data.indirected_text.text = translated;
|
|
|
|
entry->menu_entry->data.indirected_text.validation =
|
|
|
|
(char *) -1;
|
|
|
|
entry->menu_entry->data.indirected_text.size =
|
|
|
|
strlen(translated);
|
|
|
|
|
|
|
|
/* child menu title - this is the same as the text of
|
|
|
|
* the parent menu entry, so just copy the pointer */
|
2005-12-31 07:40:49 +03:00
|
|
|
if (submenu != wimp_NO_SUB_MENU && IS_MENU(submenu)) {
|
2005-07-16 18:35:25 +04:00
|
|
|
submenu->title_data.indirected_text.text =
|
|
|
|
translated;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* finally, set the current encoding of the menu */
|
|
|
|
menu->current_encoding = alphabet;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|