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"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "content/urldb.h"
|
|
|
|
#include "desktop/gui.h"
|
|
|
|
#include "desktop/history_core.h"
|
|
|
|
#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"
|
|
|
|
#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"
|
|
|
|
#include "riscos/menus.h"
|
|
|
|
#include "riscos/options.h"
|
|
|
|
#include "riscos/save.h"
|
|
|
|
#include "riscos/tinct.h"
|
|
|
|
#include "riscos/theme.h"
|
|
|
|
#include "riscos/treeview.h"
|
|
|
|
#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 ns_menu_entry {
|
|
|
|
const char *text; /**< menu text (from messages) */
|
|
|
|
menu_action action; /**< associated action */
|
2009-03-29 04:14:28 +04:00
|
|
|
wimp_w *sub_window; /**< sub-window if any */
|
2003-08-22 01:39:07 +04:00
|
|
|
};
|
2004-05-05 02:23:44 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
struct ns_menu {
|
|
|
|
const char *title;
|
2009-03-29 04:14:28 +04:00
|
|
|
struct ns_menu_entry entries[];
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-03-29 04:14:28 +04:00
|
|
|
static wimp_menu *ro_gui_menu_define_menu(const struct ns_menu *menu);
|
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_set_entry_shaded(wimp_menu *menu, menu_action action,
|
|
|
|
bool shaded);
|
|
|
|
static void ro_gui_menu_set_entry_ticked(wimp_menu *menu, menu_action action,
|
|
|
|
bool ticked);
|
|
|
|
static void ro_gui_menu_get_window_details(wimp_w w, struct gui_window **g,
|
|
|
|
struct browser_window **bw, struct content **content,
|
|
|
|
struct toolbar **toolbar, struct tree **tree);
|
|
|
|
static int ro_gui_menu_get_checksum(void);
|
|
|
|
static bool ro_gui_menu_prepare_url_suggest(void);
|
|
|
|
static void ro_gui_menu_prepare_pageinfo(struct gui_window *g);
|
2009-02-01 05:19:01 +03:00
|
|
|
static void ro_gui_menu_prepare_objectinfo(struct content *object, const char *href);
|
2005-04-08 00:46:22 +04:00
|
|
|
static void ro_gui_menu_refresh_toolbar(struct toolbar *toolbar);
|
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. */
|
|
|
|
static struct content *current_menu_object = 0;
|
|
|
|
/** 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 */
|
2006-07-13 16:46:02 +04:00
|
|
|
wimp_menu *iconbar_menu, *browser_menu, *hotlist_menu, *global_history_menu, *cookies_menu,
|
2005-04-08 00:46:22 +04:00
|
|
|
*image_quality_menu, *browser_toolbar_menu,
|
2006-04-07 02:42:22 +04:00
|
|
|
*tree_toolbar_menu, *proxy_type_menu, *languages_menu;
|
2005-04-08 00:46:22 +04:00
|
|
|
/** URL suggestion menu */
|
2005-02-07 17:28:43 +03:00
|
|
|
static wimp_MENU(GLOBAL_HISTORY_RECENT_URLS) url_suggest;
|
|
|
|
wimp_menu *url_suggest_menu = (wimp_menu *)&url_suggest;
|
|
|
|
|
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
|
|
|
|
|
|
|
/* hotlist menu */
|
2009-03-29 04:14:28 +04:00
|
|
|
static wimp_w one = (wimp_w) 1;
|
|
|
|
static const struct ns_menu hotlist_definition = {
|
2005-04-08 00:46:22 +04:00
|
|
|
"Hotlist", {
|
|
|
|
{ "Hotlist", NO_ACTION, 0 },
|
|
|
|
{ "Hotlist.New", NO_ACTION, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "Hotlist.New.Folder", TREE_NEW_FOLDER, &dialog_folder },
|
|
|
|
{ "Hotlist.New.Link", TREE_NEW_LINK, &dialog_entry },
|
|
|
|
{ "_Hotlist.Export", HOTLIST_EXPORT, &dialog_saveas },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Hotlist.Expand", TREE_EXPAND_ALL, 0 },
|
|
|
|
{ "Hotlist.Expand.All", TREE_EXPAND_ALL, 0 },
|
|
|
|
{ "Hotlist.Expand.Folders", TREE_EXPAND_FOLDERS, 0 },
|
|
|
|
{ "Hotlist.Expand.Links", TREE_EXPAND_LINKS, 0 },
|
|
|
|
{ "Hotlist.Collapse", TREE_COLLAPSE_ALL, 0 },
|
|
|
|
{ "Hotlist.Collapse.All", TREE_COLLAPSE_ALL, 0 },
|
|
|
|
{ "Hotlist.Collapse.Folders", TREE_COLLAPSE_FOLDERS, 0 },
|
|
|
|
{ "Hotlist.Collapse.Links", TREE_COLLAPSE_LINKS, 0 },
|
|
|
|
{ "Hotlist.Toolbars", NO_ACTION, 0 },
|
2005-07-16 18:35:25 +04:00
|
|
|
{ "_Hotlist.Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Hotlist.Toolbars.EditToolbar", TOOLBAR_EDIT, 0 },
|
|
|
|
{ "Selection", TREE_SELECTION, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
/* We want a window, but it changes depending upon
|
|
|
|
* context. Therefore, ensure that the structure is
|
|
|
|
* created so that we can dynamically modify the
|
|
|
|
* actual item presented. We do this by creating a
|
|
|
|
* fake wimp_w with the value 1, which indicates a
|
|
|
|
* window handle as opposed to a submenu. */
|
|
|
|
{ "Selection.Edit", TREE_SELECTION_EDIT, &one },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "Selection.Launch", TREE_SELECTION_LAUNCH, 0 },
|
|
|
|
{ "Selection.Delete", TREE_SELECTION_DELETE, 0 },
|
|
|
|
{ "SelectAll", TREE_SELECT_ALL, 0 },
|
|
|
|
{ "Clear", TREE_CLEAR_SELECTION, 0 },
|
|
|
|
{NULL, 0, 0}
|
|
|
|
}
|
|
|
|
};
|
2009-03-29 04:14:28 +04:00
|
|
|
hotlist_menu = ro_gui_menu_define_menu(&hotlist_definition);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
/* history menu */
|
2009-03-29 04:14:28 +04:00
|
|
|
static const struct ns_menu global_history_definition = {
|
2005-04-08 00:46:22 +04:00
|
|
|
"History", {
|
|
|
|
{ "History", NO_ACTION, 0 },
|
2009-03-29 04:14:28 +04:00
|
|
|
{ "_History.Export", HISTORY_EXPORT, &dialog_saveas },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "History.Expand", TREE_EXPAND_ALL, 0 },
|
|
|
|
{ "History.Expand.All", TREE_EXPAND_ALL, 0 },
|
|
|
|
{ "History.Expand.Folders", TREE_EXPAND_FOLDERS, 0 },
|
|
|
|
{ "History.Expand.Links", TREE_EXPAND_LINKS, 0 },
|
|
|
|
{ "History.Collapse", TREE_COLLAPSE_ALL, 0 },
|
|
|
|
{ "History.Collapse.All", TREE_COLLAPSE_ALL, 0 },
|
|
|
|
{ "History.Collapse.Folders", TREE_COLLAPSE_FOLDERS, 0 },
|
|
|
|
{ "History.Collapse.Links", TREE_COLLAPSE_LINKS, 0 },
|
|
|
|
{ "History.Toolbars", NO_ACTION, 0 },
|
2005-07-16 18:35:25 +04:00
|
|
|
{ "_History.Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
|
2005-04-08 00:46:22 +04:00
|
|
|
{ "History.Toolbars.EditToolbar",TOOLBAR_EDIT, 0 },
|
|
|
|
{ "Selection", TREE_SELECTION, 0 },
|
|
|
|
{ "Selection.Launch", TREE_SELECTION_LAUNCH, 0 },
|
|
|
|
{ "Selection.Delete", TREE_SELECTION_DELETE, 0 },
|
|
|
|
{ "SelectAll", TREE_SELECT_ALL, 0 },
|
|
|
|
{ "Clear", TREE_CLEAR_SELECTION, 0 },
|
|
|
|
{NULL, 0, 0}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
global_history_menu = ro_gui_menu_define_menu(
|
2009-03-29 04:14:28 +04:00
|
|
|
&global_history_definition);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
2006-07-13 16:46:02 +04:00
|
|
|
/* history menu */
|
2009-03-29 04:14:28 +04:00
|
|
|
static const struct ns_menu cookies_definition = {
|
2006-07-13 16:46:02 +04:00
|
|
|
"Cookies", {
|
|
|
|
{ "Cookies", NO_ACTION, 0 },
|
|
|
|
{ "Cookies.Expand", TREE_EXPAND_ALL, 0 },
|
|
|
|
{ "Cookies.Expand.All", TREE_EXPAND_ALL, 0 },
|
|
|
|
{ "Cookies.Expand.Folders", TREE_EXPAND_FOLDERS, 0 },
|
|
|
|
{ "Cookies.Expand.Links", TREE_EXPAND_LINKS, 0 },
|
|
|
|
{ "Cookies.Collapse", TREE_COLLAPSE_ALL, 0 },
|
|
|
|
{ "Cookies.Collapse.All", TREE_COLLAPSE_ALL, 0 },
|
|
|
|
{ "Cookies.Collapse.Folders", TREE_COLLAPSE_FOLDERS, 0 },
|
|
|
|
{ "Cookies.Collapse.Links", TREE_COLLAPSE_LINKS, 0 },
|
|
|
|
{ "Cookies.Toolbars", NO_ACTION, 0 },
|
|
|
|
{ "_Cookies.Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
|
|
|
|
{ "Cookies.Toolbars.EditToolbar",TOOLBAR_EDIT, 0 },
|
|
|
|
{ "Selection", TREE_SELECTION, 0 },
|
|
|
|
{ "Selection.Delete", TREE_SELECTION_DELETE, 0 },
|
|
|
|
{ "SelectAll", TREE_SELECT_ALL, 0 },
|
|
|
|
{ "Clear", TREE_CLEAR_SELECTION, 0 },
|
|
|
|
{NULL, 0, 0}
|
|
|
|
}
|
|
|
|
};
|
2009-03-29 04:14:28 +04:00
|
|
|
cookies_menu = ro_gui_menu_define_menu(&cookies_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
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
url_suggest_menu->title_data.indirected_text.text =
|
2009-03-29 04:14:28 +04:00
|
|
|
(char *) messages_get("URLSuggest");
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_menu_init_structure(url_suggest_menu, GLOBAL_HISTORY_RECENT_URLS);
|
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.
|
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_menu_create(wimp_menu *menu, int x, int y, wimp_w w)
|
|
|
|
{
|
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)) {
|
|
|
|
g = ro_gui_window_lookup(w);
|
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;
|
|
|
|
if (g->bw->current_content) {
|
|
|
|
switch (g->bw->current_content->type) {
|
|
|
|
case CONTENT_HTML: {
|
|
|
|
struct box *box;
|
|
|
|
box = box_object_at_point(g->bw->current_content, pos.x, pos.y);
|
|
|
|
current_menu_object = box ? box->object : NULL;
|
|
|
|
box = box_href_at_point(g->bw->current_content, pos.x, pos.y);
|
|
|
|
current_menu_url = box ? box->href : NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONTENT_TEXTPLAIN:
|
|
|
|
/* no object, no url */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
current_menu_object = g->bw->current_content;
|
|
|
|
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) {
|
2005-02-07 17:28:43 +03:00
|
|
|
if (!ro_gui_menu_prepare_url_suggest())
|
|
|
|
return;
|
2005-12-31 07:40:49 +03:00
|
|
|
} else if (menu == recent_search_menu) {
|
|
|
|
if (!ro_gui_search_prepare_menu())
|
|
|
|
return;
|
2005-04-08 00:46:22 +04:00
|
|
|
} else {
|
|
|
|
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 -
|
2005-04-08 00:46:22 +04:00
|
|
|
state.yscroll, w);
|
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;
|
|
|
|
struct content *c;
|
|
|
|
struct toolbar *t;
|
|
|
|
struct tree *tree;
|
2004-06-27 19:34:46 +04:00
|
|
|
os_error *error;
|
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,
|
|
|
|
&g, &bw, &c, &t, &tree);
|
2005-05-04 01:55:42 +04:00
|
|
|
current_menu = NULL;
|
2005-07-19 07:56:17 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
if (cleanup) {
|
2007-03-27 00:33:50 +04:00
|
|
|
ro_gui_wimp_event_menus_closed();
|
2006-01-08 04:51:33 +03:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
if (tree)
|
|
|
|
ro_gui_tree_menu_closed(tree);
|
|
|
|
}
|
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)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
int i, j;
|
|
|
|
wimp_menu_entry *menu_entry;
|
|
|
|
menu_action action;
|
|
|
|
wimp_pointer pointer;
|
|
|
|
struct gui_window *g = NULL;
|
|
|
|
wimp_menu *menu;
|
|
|
|
os_error *error;
|
2005-12-31 07:40:49 +03:00
|
|
|
int previous_menu_icon = current_menu_icon;
|
2006-02-22 16:03:57 +03:00
|
|
|
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
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* get the menu entry and associated action */
|
|
|
|
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
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* perform menu action */
|
|
|
|
if (action != NO_ACTION)
|
|
|
|
ro_gui_menu_handle_action(current_menu_window, action, false);
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* perform non-automated actions */
|
|
|
|
if (current_menu == url_suggest_menu) {
|
|
|
|
g = ro_gui_toolbar_lookup(current_menu_window);
|
2006-02-22 16:03:57 +03:00
|
|
|
if (g) {
|
2009-05-30 03:43:53 +04:00
|
|
|
url = url_suggest_menu->entries[selection->items[0]].
|
|
|
|
data.indirected_text.text;
|
2006-02-22 16:03:57 +03:00
|
|
|
gui_window_set_url(g, url);
|
2006-04-22 22:24:18 +04:00
|
|
|
browser_window_go(g->bw, url, 0, true);
|
2006-02-22 16:03:57 +03:00
|
|
|
global_history_add_recent(url);
|
|
|
|
}
|
2009-05-30 03:43:53 +04:00
|
|
|
} else if (current_menu == gui_form_select_menu) {
|
2005-04-08 00:46:22 +04:00
|
|
|
g = ro_gui_window_lookup(current_menu_window);
|
|
|
|
assert(g);
|
2009-05-30 03:43:53 +04:00
|
|
|
|
|
|
|
if (selection->items[0] >= 0) {
|
|
|
|
browser_window_form_select(g->bw,
|
|
|
|
gui_form_select_control,
|
|
|
|
selection->items[0]);
|
|
|
|
}
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
/* allow automatic menus to have their data updated */
|
|
|
|
ro_gui_wimp_event_menu_selection(current_menu_window, current_menu_icon,
|
|
|
|
current_menu, selection);
|
|
|
|
|
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 */
|
2005-04-08 00:46:22 +04:00
|
|
|
i = 0;
|
|
|
|
menu = current_menu;
|
|
|
|
do {
|
|
|
|
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++];
|
2005-04-28 05:05:40 +04:00
|
|
|
if (j != -1) {
|
2005-04-08 00:46:22 +04:00
|
|
|
menu = menu->entries[j].sub_menu;
|
2005-04-28 05:05:40 +04:00
|
|
|
if ((!menu) || (menu == wimp_NO_SUB_MENU))
|
|
|
|
break;
|
|
|
|
}
|
2005-04-08 00:46:22 +04:00
|
|
|
} 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
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_create(current_menu, 0, 0, current_menu_window);
|
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]];
|
|
|
|
|
2005-12-31 07:40:49 +03:00
|
|
|
if (IS_MENU(menu_entry->sub_menu)) {
|
2007-03-27 00:33:50 +04:00
|
|
|
ro_gui_wimp_event_register_submenu((wimp_w)0);
|
2005-04-08 00:46:22 +04:00
|
|
|
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 {
|
2007-03-27 00:33:50 +04:00
|
|
|
ro_gui_wimp_event_register_submenu((wimp_w)menu_entry->sub_menu);
|
2005-04-08 00:46:22 +04:00
|
|
|
action = ro_gui_menu_find_action(current_menu, menu_entry);
|
|
|
|
if (action != NO_ACTION)
|
|
|
|
ro_gui_menu_prepare_action(current_menu_window,
|
|
|
|
action, true);
|
|
|
|
/* remove the close icon */
|
|
|
|
ro_gui_wimp_update_window_furniture((wimp_w)menu_entry->sub_menu,
|
|
|
|
wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_BACK_ICON, 0);
|
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-07-21 00:02:59 +04:00
|
|
|
/**
|
2005-04-08 00:46:22 +04:00
|
|
|
* Refresh a toolbar after it has been updated
|
|
|
|
*
|
|
|
|
* \param toolbar the toolbar to update
|
2004-07-07 04:31:57 +04:00
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_menu_refresh_toolbar(struct toolbar *toolbar)
|
|
|
|
{
|
2004-12-09 13:30:44 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
assert(toolbar);
|
2004-12-09 13:30:44 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
toolbar->reformat_buttons = true;
|
|
|
|
ro_gui_theme_process_toolbar(toolbar, -1);
|
|
|
|
if (toolbar->type == THEME_BROWSER_TOOLBAR) {
|
2006-09-07 02:15:58 +04:00
|
|
|
gui_window_update_extent(ro_gui_window_lookup(current_menu_window));
|
2005-04-08 00:46:22 +04:00
|
|
|
} else if (toolbar->type == THEME_HOTLIST_TOOLBAR) {
|
|
|
|
tree_resized(hotlist_tree);
|
|
|
|
xwimp_force_redraw((wimp_w)hotlist_tree->handle,
|
|
|
|
0,-16384, 16384, 16384);
|
|
|
|
} else if (toolbar->type == THEME_HISTORY_TOOLBAR) {
|
|
|
|
tree_resized(global_history_tree);
|
|
|
|
xwimp_force_redraw((wimp_w)global_history_tree->handle,
|
|
|
|
0,-16384, 16384, 16384);
|
2006-09-07 02:15:58 +04:00
|
|
|
} else if (toolbar->type == THEME_COOKIES_TOOLBAR) {
|
|
|
|
tree_resized(cookies_tree);
|
|
|
|
xwimp_force_redraw((wimp_w)cookies_tree->handle,
|
|
|
|
0,-16384, 16384, 16384);
|
2004-07-07 04:31:57 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
/**
|
2005-04-08 00:46:22 +04:00
|
|
|
* Builds the URL suggestion menu
|
2005-02-07 17:28:43 +03:00
|
|
|
*/
|
2005-04-08 00:46:22 +04:00
|
|
|
bool ro_gui_menu_prepare_url_suggest(void) {
|
|
|
|
char **suggest_text;
|
|
|
|
int suggestions;
|
|
|
|
int i;
|
2005-03-19 02:52:38 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
suggest_text = global_history_get_recent(&suggestions);
|
|
|
|
if (suggestions < 1)
|
|
|
|
return false;
|
2005-02-07 17:28:43 +03:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
for (i = 0; i < suggestions; i++) {
|
|
|
|
url_suggest_menu->entries[i].menu_flags = 0;
|
|
|
|
url_suggest_menu->entries[i].data.indirected_text.text =
|
|
|
|
suggest_text[i];
|
|
|
|
url_suggest_menu->entries[i].data.indirected_text.size =
|
|
|
|
strlen(suggest_text[i]) + 1;
|
2005-02-07 17:28:43 +03:00
|
|
|
}
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
url_suggest_menu->entries[0].menu_flags |= wimp_MENU_TITLE_INDIRECTED;
|
|
|
|
url_suggest_menu->entries[suggestions - 1].menu_flags |= wimp_MENU_LAST;
|
|
|
|
return true;
|
2005-02-07 17:28:43 +03: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
|
|
|
int suggestions;
|
2004-04-13 23:04:32 +04:00
|
|
|
|
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) {
|
|
|
|
global_history_get_recent(&suggestions);
|
|
|
|
ro_gui_set_icon_shaded_state(gui->toolbar->toolbar_handle,
|
|
|
|
ICON_TOOLBAR_SUGGEST, (suggestions <= 0));
|
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)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
struct content *c = 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;
|
|
|
|
const char *title = "-";
|
|
|
|
const char *url = "-";
|
|
|
|
const char *enc = "-";
|
|
|
|
const char *mime = "-";
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
assert(c);
|
2004-06-27 02:31:34 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
if (c->title)
|
|
|
|
title = c->title;
|
|
|
|
if (c->url)
|
|
|
|
url = c->url;
|
|
|
|
if (c->mime_type)
|
|
|
|
mime = c->mime_type;
|
2004-06-27 02:31:34 +04:00
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
sprintf(icon_buf, "file_%x", ro_content_filetype(c));
|
|
|
|
if (!ro_gui_wimp_sprite_exists(icon_buf))
|
2004-07-08 21:28:56 +04:00
|
|
|
sprintf(icon_buf, "file_xxx");
|
|
|
|
|
2005-01-02 01:05:21 +03:00
|
|
|
if (c->type == CONTENT_HTML) {
|
|
|
|
if (c->data.html.encoding) {
|
|
|
|
enc_token[8] = '0' + c->data.html.encoding_source;
|
|
|
|
snprintf(enc_buf, sizeof enc_buf, "%s (%s)",
|
|
|
|
c->data.html.encoding,
|
|
|
|
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
|
|
|
*/
|
2009-02-01 05:19:01 +03:00
|
|
|
void ro_gui_menu_prepare_objectinfo(struct content *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";
|
|
|
|
const char *url = "-";
|
|
|
|
const char *target = "-";
|
|
|
|
const char *mime = "-";
|
|
|
|
|
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");
|
|
|
|
|
2009-02-01 05:19:01 +03:00
|
|
|
if (object->url)
|
|
|
|
url = object->url;
|
|
|
|
if (href)
|
|
|
|
target = href;
|
|
|
|
if (object->mime_type)
|
|
|
|
mime = object->mime_type;
|
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,
|
|
|
|
pointer.pos.x, pointer.pos.y, bw->window->window);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a wimp_menu and adds it to the list to handle actions for.
|
|
|
|
*
|
|
|
|
* \param menu the data to create the menu with
|
|
|
|
* \return the menu created, or NULL on failure
|
|
|
|
*/
|
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;
|
|
|
|
struct content *c = NULL;
|
|
|
|
struct toolbar *t = NULL;
|
|
|
|
struct tree *tree;
|
|
|
|
struct node *node;
|
|
|
|
os_error *error;
|
|
|
|
char url[80];
|
2006-04-10 03:21:13 +04:00
|
|
|
const struct url_data *data;
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
ro_gui_menu_get_window_details(owner, &g, &bw, &c, &t, &tree);
|
|
|
|
|
|
|
|
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:
|
|
|
|
ro_gui_tree_show(global_history_tree);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* hotlist actions */
|
|
|
|
case HOTLIST_ADD_URL:
|
2005-06-23 21:24:23 +04:00
|
|
|
if ((!hotlist_tree) || (!c) || (!c->url))
|
2005-04-08 00:46:22 +04:00
|
|
|
return false;
|
2006-04-10 03:21:13 +04:00
|
|
|
data = urldb_get_url_data(c->url);
|
2005-12-31 07:40:49 +03:00
|
|
|
if (data) {
|
2006-09-05 18:56:18 +04:00
|
|
|
node = tree_create_URL_node(hotlist_tree->root, c->url, data, data->title);
|
2005-12-31 07:40:49 +03:00
|
|
|
if (node) {
|
|
|
|
tree_redraw_area(hotlist_tree,
|
|
|
|
node->box.x - NODE_INSTEP, 0,
|
|
|
|
NODE_INSTEP, 16384);
|
|
|
|
tree_handle_node_changed(hotlist_tree, node,
|
|
|
|
false, true);
|
|
|
|
ro_gui_tree_scroll_visible(hotlist_tree,
|
|
|
|
&node->data);
|
|
|
|
ro_gui_hotlist_save();
|
|
|
|
}
|
2005-04-08 00:46:22 +04:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
case HOTLIST_SHOW:
|
|
|
|
ro_gui_tree_show(hotlist_tree);
|
|
|
|
return true;
|
|
|
|
|
2006-07-13 16:46:02 +04:00
|
|
|
/* cookies actions */
|
|
|
|
case COOKIES_SHOW:
|
|
|
|
ro_gui_tree_show(cookies_tree);
|
|
|
|
return true;
|
|
|
|
|
2006-07-17 01:42:37 +04:00
|
|
|
case COOKIES_DELETE:
|
|
|
|
if (cookies_tree->root->child)
|
|
|
|
tree_delete_node(cookies_tree, cookies_tree->root->child, true);
|
|
|
|
return true;
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
/* page actions */
|
|
|
|
case BROWSER_PAGE_INFO:
|
|
|
|
if (!c)
|
|
|
|
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:
|
|
|
|
if (!c)
|
|
|
|
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:
|
|
|
|
if (!c)
|
|
|
|
return false;
|
2008-08-24 14:31:38 +04:00
|
|
|
browser_window_create(c->url, bw, 0, false, false);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case BROWSER_VIEW_SOURCE:
|
|
|
|
if (!c)
|
|
|
|
return false;
|
|
|
|
ro_gui_view_source(c);
|
|
|
|
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;
|
2009-02-01 05:19:01 +03:00
|
|
|
current_menu_object->fresh = false;
|
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;
|
2009-02-01 05:19:01 +03:00
|
|
|
browser_window_download(bw, current_menu_url, c->url);
|
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;
|
2009-02-01 05:19:01 +03:00
|
|
|
browser_window_create(current_menu_url, bw, c->url, 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:
|
2009-02-01 05:19:01 +03:00
|
|
|
c = 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:
|
|
|
|
if (!c)
|
|
|
|
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
|
|
|
case HOTLIST_EXPORT:
|
|
|
|
case HISTORY_EXPORT:
|
|
|
|
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:
|
|
|
|
if ((!bw) || (!c))
|
|
|
|
return false;
|
2006-07-05 20:50:35 +04:00
|
|
|
return ro_gui_window_navigate_up(bw->window, c->url);
|
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:
|
|
|
|
if (!c)
|
|
|
|
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:
|
2006-02-16 02:28:18 +03:00
|
|
|
if (!c || (c->type != CONTENT_HTML && c->type != CONTENT_TEXTPLAIN))
|
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;
|
|
|
|
|
|
|
|
/* tree actions */
|
|
|
|
case TREE_NEW_FOLDER:
|
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
2005-07-16 09:54:45 +04:00
|
|
|
ro_gui_dialog_open_persistent((wimp_w)tree->handle,
|
2005-04-21 03:22:49 +04:00
|
|
|
dialog_folder, windows_at_pointer);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case TREE_NEW_LINK:
|
|
|
|
ro_gui_menu_prepare_action(owner, action, true);
|
2005-07-16 09:54:45 +04:00
|
|
|
ro_gui_dialog_open_persistent((wimp_w)tree->handle,
|
2005-04-21 03:22:49 +04:00
|
|
|
dialog_entry, windows_at_pointer);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case TREE_EXPAND_ALL:
|
|
|
|
case TREE_EXPAND_FOLDERS:
|
|
|
|
case TREE_EXPAND_LINKS:
|
|
|
|
tree_handle_expansion(tree, tree->root, true,
|
|
|
|
(action != TREE_EXPAND_LINKS),
|
|
|
|
(action != TREE_EXPAND_FOLDERS));
|
|
|
|
return true;
|
|
|
|
case TREE_COLLAPSE_ALL:
|
|
|
|
case TREE_COLLAPSE_FOLDERS:
|
|
|
|
case TREE_COLLAPSE_LINKS:
|
|
|
|
tree_handle_expansion(tree, tree->root, false,
|
|
|
|
(action != TREE_COLLAPSE_LINKS),
|
|
|
|
(action != TREE_COLLAPSE_FOLDERS));
|
|
|
|
return true;
|
|
|
|
case TREE_SELECTION_EDIT:
|
|
|
|
return true;
|
|
|
|
case TREE_SELECTION_LAUNCH:
|
|
|
|
ro_gui_tree_launch_selected(tree);
|
|
|
|
return true;
|
|
|
|
case TREE_SELECTION_DELETE:
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_tree_stop_edit(tree);
|
2005-04-08 00:46:22 +04:00
|
|
|
tree_delete_selected_nodes(tree, tree->root);
|
2005-12-31 07:40:49 +03:00
|
|
|
if (tree == hotlist_tree)
|
|
|
|
ro_gui_hotlist_save();
|
|
|
|
ro_gui_menu_prepare_action(owner, TREE_CLEAR_SELECTION, true);
|
|
|
|
ro_gui_menu_prepare_action(owner, TREE_SELECTION, true);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case TREE_SELECT_ALL:
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_tree_stop_edit(tree);
|
|
|
|
if (tree->root->child) {
|
|
|
|
tree->temp_selection = NULL;
|
|
|
|
tree_set_node_selected(tree, tree->root, true);
|
|
|
|
}
|
|
|
|
ro_gui_menu_prepare_action(owner, TREE_CLEAR_SELECTION, true);
|
|
|
|
ro_gui_menu_prepare_action(owner, TREE_SELECTION, true);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
case TREE_CLEAR_SELECTION:
|
2005-12-31 07:40:49 +03:00
|
|
|
tree->temp_selection = NULL;
|
|
|
|
ro_gui_tree_stop_edit(tree);
|
|
|
|
tree_set_node_selected(tree, tree->root, false);
|
|
|
|
ro_gui_menu_prepare_action(owner, TREE_CLEAR_SELECTION, true);
|
|
|
|
ro_gui_menu_prepare_action(owner, TREE_SELECTION, true);
|
2005-04-08 00:46:22 +04:00
|
|
|
return true;
|
|
|
|
|
|
|
|
/* toolbar actions */
|
|
|
|
case TOOLBAR_BUTTONS:
|
|
|
|
assert(t);
|
|
|
|
t->display_buttons = !t->display_buttons;
|
|
|
|
ro_gui_menu_refresh_toolbar(t);
|
|
|
|
return true;
|
|
|
|
case TOOLBAR_ADDRESS_BAR:
|
|
|
|
assert(t);
|
|
|
|
t->display_url = !t->display_url;
|
|
|
|
ro_gui_menu_refresh_toolbar(t);
|
|
|
|
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;
|
|
|
|
ro_gui_menu_refresh_toolbar(t);
|
|
|
|
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 menu_definition_entry *entry;
|
|
|
|
struct gui_window *g;
|
|
|
|
struct browser_window *bw;
|
|
|
|
struct content *c;
|
|
|
|
struct toolbar *t;
|
|
|
|
struct tree *tree;
|
|
|
|
struct node *node;
|
|
|
|
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;
|
2005-04-08 00:46:22 +04:00
|
|
|
|
|
|
|
ro_gui_menu_get_window_details(owner, &g, &bw, &c, &t, &tree);
|
|
|
|
if (current_menu_open)
|
|
|
|
checksum = ro_gui_menu_get_checksum();
|
2009-02-01 05:19:01 +03:00
|
|
|
if (!c) {
|
|
|
|
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) ||
|
|
|
|
!(c || history_back_available(bw->history) ||
|
|
|
|
history_forward_available(bw->history))));
|
|
|
|
break;
|
|
|
|
case HISTORY_SHOW_GLOBAL:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
!global_history_tree);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* hotlist actions */
|
|
|
|
case HOTLIST_ADD_URL:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
(!c || !hotlist_tree));
|
|
|
|
break;
|
|
|
|
case HOTLIST_SHOW:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
!hotlist_tree);
|
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,
|
|
|
|
ICON_TOOLBAR_BOOKMARK,
|
|
|
|
!hotlist_tree);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
|
2006-07-13 16:46:02 +04:00
|
|
|
/* cookies actions */
|
|
|
|
case COOKIES_SHOW:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
!cookies_tree);
|
|
|
|
break;
|
2006-07-17 01:42:37 +04:00
|
|
|
case COOKIES_DELETE:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
!(cookies_tree && cookies_tree->root->child));
|
|
|
|
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,
|
2009-02-01 05:19:01 +03:00
|
|
|
action, !c || (c->type != CONTENT_HTML &&
|
|
|
|
c->type != 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,
|
|
|
|
action, !c);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((windows) && (c))
|
|
|
|
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,
|
|
|
|
action, !c);
|
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,
|
2005-04-08 00:46:22 +04:00
|
|
|
ICON_TOOLBAR_PRINT, !c);
|
|
|
|
if ((windows) && (c))
|
|
|
|
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,
|
2005-04-08 00:46:22 +04:00
|
|
|
ICON_TOOLBAR_PRINT, !c);
|
|
|
|
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,
|
|
|
|
action, !c);
|
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,
|
2009-02-01 05:19:01 +03: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)
|
|
|
|
ro_gui_menu_prepare_objectinfo(current_menu_object,
|
|
|
|
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 */
|
|
|
|
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)
|
2009-02-03 02:20:20 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_OBJECT_ORIG, current_menu_object,
|
|
|
|
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)
|
|
|
|
c = current_menu_object;
|
2009-01-30 08:08:54 +03:00
|
|
|
|
|
|
|
if (c) {
|
|
|
|
switch (c->type) {
|
|
|
|
/* \todo - this classification should prob be done in content_() */
|
|
|
|
/* bitmap types (Sprite export possible) */
|
|
|
|
#ifdef WITH_JPEG
|
|
|
|
case CONTENT_JPEG:
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_MNG
|
|
|
|
case CONTENT_JNG:
|
|
|
|
case CONTENT_MNG:
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_GIF
|
|
|
|
case CONTENT_GIF:
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_BMP
|
|
|
|
case CONTENT_BMP:
|
|
|
|
case CONTENT_ICO:
|
|
|
|
#endif
|
|
|
|
#if defined(WITH_MNG) || defined(WITH_PNG)
|
|
|
|
case CONTENT_PNG:
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_SPRITE
|
|
|
|
case CONTENT_SPRITE:
|
|
|
|
#endif
|
|
|
|
exp_sprite = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* vector types (Draw export possible) */
|
|
|
|
#if defined(WITH_NS_SVG) || defined(WITH_RSVG)
|
2009-02-03 00:44:54 +03:00
|
|
|
case CONTENT_SVG:
|
|
|
|
#endif
|
2009-01-30 08:08:54 +03:00
|
|
|
#ifdef WITH_DRAW
|
|
|
|
case CONTENT_DRAW:
|
|
|
|
#endif
|
|
|
|
exp_draw = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (action) {
|
|
|
|
case BROWSER_OBJECT_EXPORT_SPRITE: if (!exp_sprite) c = NULL; break;
|
|
|
|
case BROWSER_OBJECT_EXPORT_DRAW: if (!exp_draw) c = NULL; break;
|
|
|
|
default: if (!exp_sprite && !exp_draw) c = NULL; break;
|
|
|
|
}
|
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, !c);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((c) && (windows))
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE, c, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
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:
|
2009-02-02 03:06:31 +03: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,
|
2009-02-02 03:06:31 +03:00
|
|
|
!c || (c->type != CONTENT_HTML && c->type != CONTENT_TEXTPLAIN));
|
2009-01-30 08:08:54 +03:00
|
|
|
break;
|
|
|
|
case BROWSER_SELECTION_SAVE:
|
|
|
|
if (c && (!bw->sel || !selection_defined(bw->sel))) c = NULL;
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action, !c);
|
|
|
|
if ((c) && (windows))
|
|
|
|
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,
|
|
|
|
!(c && bw->sel && selection_defined(bw->sel)));
|
|
|
|
break;
|
2009-02-02 03:06:31 +03:00
|
|
|
case BROWSER_SELECTION_CUT:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
!(c && bw->sel && selection_defined(bw->sel)
|
|
|
|
&& !selection_read_only(bw->sel)));
|
|
|
|
break;
|
2009-01-30 08:08:54 +03:00
|
|
|
case BROWSER_SELECTION_PASTE:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action, !(c && 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,
|
|
|
|
action, !c);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((c) && (windows))
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_SOURCE, c, 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,
|
2005-04-08 00:46:22 +04:00
|
|
|
ICON_TOOLBAR_SAVE, !c);
|
|
|
|
break;
|
|
|
|
case BROWSER_SAVE_COMPLETE:
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, !c);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((c) && (windows))
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_COMPLETE, c, 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,
|
|
|
|
action, !c);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((c) && (windows))
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_DRAW, c, 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,
|
|
|
|
action, !c);
|
|
|
|
if ((c) && (windows))
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_PDF, c, 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,
|
|
|
|
action, !c);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((c) && (windows))
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_TEXT, c, NULL, NULL, NULL);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_OBJECT_SAVE_URL_URI:
|
2009-02-01 05:19:01 +03:00
|
|
|
if (c && c->type == CONTENT_HTML)
|
|
|
|
c = 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,
|
|
|
|
action, !c);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((c) && (windows))
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL, NULL,
|
|
|
|
c->url, c->title);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_OBJECT_SAVE_URL_URL:
|
2009-02-01 05:19:01 +03:00
|
|
|
if (c && c->type == CONTENT_HTML)
|
|
|
|
c = 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,
|
|
|
|
action, !c);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((c) && (windows))
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL,
|
|
|
|
c->url, c->title);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case BROWSER_OBJECT_SAVE_URL_TEXT:
|
2009-02-01 05:19:01 +03:00
|
|
|
c = 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,
|
|
|
|
action, !c);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((c) && (windows))
|
2009-01-30 08:08:54 +03:00
|
|
|
ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL, NULL,
|
|
|
|
c->url, c->title);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case HOTLIST_EXPORT:
|
|
|
|
if ((tree) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_HOTLIST_EXPORT_HTML,
|
2009-01-30 08:08:54 +03:00
|
|
|
NULL, NULL, NULL, NULL);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case HISTORY_EXPORT:
|
|
|
|
if ((tree) && (windows))
|
|
|
|
ro_gui_save_prepare(GUI_SAVE_HISTORY_EXPORT_HTML,
|
2009-01-30 08:08:54 +03:00
|
|
|
NULL, NULL, NULL, NULL);
|
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:
|
|
|
|
result = (bw && c);
|
|
|
|
if (result) {
|
|
|
|
res = url_parent(c->url, &parent);
|
|
|
|
if (res == URL_FUNC_OK) {
|
2009-03-24 01:56:31 +03:00
|
|
|
res = url_compare(c->url, parent,
|
2008-02-03 15:04:48 +03:00
|
|
|
false, &compare);
|
|
|
|
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,
|
|
|
|
action, !c);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((c) && (windows))
|
|
|
|
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,
|
2005-04-08 00:46:22 +04:00
|
|
|
ICON_TOOLBAR_SCALE, !c);
|
|
|
|
break;
|
|
|
|
case BROWSER_FIND_TEXT:
|
2006-02-16 02:28:18 +03:00
|
|
|
result = !c || (c->type != CONTENT_HTML && c->type != 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)) {
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_search_prepare(g);
|
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_NEW_FOLDER:
|
|
|
|
ro_gui_hotlist_prepare_folder_dialog(NULL);
|
|
|
|
break;
|
|
|
|
case TREE_NEW_LINK:
|
|
|
|
ro_gui_hotlist_prepare_entry_dialog(NULL);
|
|
|
|
break;
|
|
|
|
case TREE_EXPAND_ALL:
|
|
|
|
case TREE_EXPAND_FOLDERS:
|
|
|
|
case TREE_EXPAND_LINKS:
|
|
|
|
case TREE_COLLAPSE_ALL:
|
|
|
|
case TREE_COLLAPSE_FOLDERS:
|
|
|
|
case TREE_COLLAPSE_LINKS:
|
2009-05-30 03:43:53 +04:00
|
|
|
if ((tree) && (tree->root)) {
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, !tree->root->child);
|
2009-05-30 03:43:53 +04:00
|
|
|
|
|
|
|
if ((t) && (!t->editor) && (t->type !=
|
|
|
|
THEME_BROWSER_TOOLBAR)) {
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
|
|
|
ICON_TOOLBAR_EXPAND,
|
|
|
|
!tree->root->child);
|
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
|
|
|
ICON_TOOLBAR_OPEN,
|
|
|
|
!tree->root->child);
|
|
|
|
}
|
2006-07-13 16:46:02 +04:00
|
|
|
}
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case TREE_SELECTION:
|
|
|
|
if ((!tree) || (!tree->root))
|
|
|
|
break;
|
|
|
|
if (tree->root->child)
|
|
|
|
result = tree_has_selection(tree->root->child);
|
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_DELETE, !result);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_set_icon_shaded_state(
|
|
|
|
t->toolbar_handle,
|
2005-04-08 00:46:22 +04:00
|
|
|
ICON_TOOLBAR_LAUNCH, !result);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TREE_SELECTION_EDIT:
|
|
|
|
node = tree_get_selected_node(tree->root);
|
|
|
|
entry = ro_gui_menu_find_entry(current_menu, action);
|
|
|
|
if ((!node) || (!entry))
|
|
|
|
break;
|
|
|
|
if (node->folder) {
|
|
|
|
entry->menu_entry->sub_menu =
|
|
|
|
(wimp_menu *)dialog_folder;
|
|
|
|
if (windows)
|
|
|
|
ro_gui_hotlist_prepare_folder_dialog(node);
|
|
|
|
} else {
|
|
|
|
entry->menu_entry->sub_menu =
|
|
|
|
(wimp_menu *)dialog_entry;
|
|
|
|
if (windows)
|
|
|
|
ro_gui_hotlist_prepare_entry_dialog(node);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TREE_SELECTION_LAUNCH:
|
|
|
|
case TREE_SELECTION_DELETE:
|
2005-12-31 07:40:49 +03:00
|
|
|
case TREE_CLEAR_SELECTION:
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((!tree) || (!tree->root))
|
|
|
|
break;
|
|
|
|
if (tree->root->child)
|
|
|
|
result = tree_has_selection(tree->root->child);
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_menu_set_entry_shaded(current_menu,
|
|
|
|
action, !result);
|
2005-04-08 00:46:22 +04:00
|
|
|
break;
|
|
|
|
case TREE_SELECT_ALL:
|
|
|
|
ro_gui_menu_set_entry_shaded(current_menu, action,
|
|
|
|
!tree->root->child);
|
|
|
|
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,
|
|
|
|
struct browser_window **bw, struct content **content,
|
2008-07-27 02:29:15 +04:00
|
|
|
struct toolbar **toolbar, struct tree **tree)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
*g = ro_gui_window_lookup(w);
|
|
|
|
if (*g) {
|
|
|
|
*bw = (*g)->bw;
|
|
|
|
*toolbar = (*g)->toolbar;
|
|
|
|
if (*bw)
|
|
|
|
*content = (*bw)->current_content;
|
|
|
|
*tree = NULL;
|
|
|
|
} else {
|
|
|
|
*bw = NULL;
|
|
|
|
*content = NULL;
|
|
|
|
if ((hotlist_tree) && (w == (wimp_w)hotlist_tree->handle))
|
|
|
|
*tree = hotlist_tree;
|
|
|
|
else if ((global_history_tree) &&
|
|
|
|
(w == (wimp_w)global_history_tree->handle))
|
|
|
|
*tree = global_history_tree;
|
2006-07-13 16:46:02 +04:00
|
|
|
else if ((cookies_tree) && (w == (wimp_w)cookies_tree->handle))
|
|
|
|
*tree = cookies_tree;
|
2005-04-08 00:46:22 +04:00
|
|
|
else
|
|
|
|
*tree = NULL;
|
|
|
|
if (*tree)
|
|
|
|
*toolbar = (*tree)->toolbar;
|
|
|
|
else
|
|
|
|
*toolbar = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
}
|