2004-02-26 03:44:42 +03:00
|
|
|
/*
|
2007-07-05 08:29:09 +04:00
|
|
|
* Copyright 2004-2007 James Bursa <bursa@users.sourceforge.net>
|
2005-04-20 16:24:41 +04:00
|
|
|
* Copyright 2005 Adrian Lees <adrianl@users.sourceforge.net>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-02-26 03:44:42 +03:00
|
|
|
*/
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* Save dialog and drag and drop saving implementation for RISC OS.
|
2004-02-26 03:44:42 +03:00
|
|
|
*/
|
|
|
|
|
2005-05-02 06:11:06 +04:00
|
|
|
#include <assert.h>
|
2004-04-11 00:04:11 +04:00
|
|
|
#include <ctype.h>
|
2004-03-27 21:47:56 +03:00
|
|
|
#include <errno.h>
|
2004-05-06 04:56:15 +04:00
|
|
|
#include <stdbool.h>
|
2004-03-27 21:47:56 +03:00
|
|
|
#include <stdio.h>
|
2004-02-26 03:44:42 +03:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2008-07-27 02:29:15 +04:00
|
|
|
#include "oslib/dragasprite.h"
|
|
|
|
#include "oslib/osbyte.h"
|
|
|
|
#include "oslib/osfile.h"
|
|
|
|
#include "oslib/osmodule.h"
|
|
|
|
#include "oslib/osspriteop.h"
|
|
|
|
#include "oslib/wimp.h"
|
|
|
|
#include "oslib/wimpspriteop.h"
|
2014-02-01 14:45:20 +04:00
|
|
|
|
|
|
|
#include "utils/config.h"
|
|
|
|
#include "utils/log.h"
|
|
|
|
#include "utils/messages.h"
|
|
|
|
#include "utils/utf8.h"
|
2016-06-06 10:59:23 +03:00
|
|
|
#include "utils/nsurl.h"
|
2016-05-30 19:32:57 +03:00
|
|
|
#include "netsurf/browser_window.h"
|
2016-06-06 11:00:52 +03:00
|
|
|
#include "netsurf/window.h"
|
|
|
|
#include "netsurf/bitmap.h"
|
|
|
|
#include "netsurf/content.h"
|
2016-06-14 14:39:54 +03:00
|
|
|
#include "netsurf/form.h"
|
2013-09-03 01:41:04 +04:00
|
|
|
#include "desktop/hotlist.h"
|
|
|
|
#include "desktop/global_history.h"
|
2014-10-13 18:08:16 +04:00
|
|
|
#include "desktop/version.h"
|
2009-12-18 02:55:02 +03:00
|
|
|
#include "desktop/save_complete.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "desktop/save_text.h"
|
2014-02-01 14:45:20 +04:00
|
|
|
|
2013-10-04 00:11:54 +04:00
|
|
|
#include "riscos/bitmap.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/dialog.h"
|
|
|
|
#include "riscos/gui.h"
|
2017-06-11 13:46:18 +03:00
|
|
|
#include "riscos/window.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/menus.h"
|
2007-06-05 10:17:16 +04:00
|
|
|
#include "riscos/message.h"
|
2013-09-08 03:47:55 +04:00
|
|
|
#include "riscos/mouse.h"
|
2013-05-26 01:46:27 +04:00
|
|
|
#include "utils/nsoption.h"
|
2009-01-10 03:18:34 +03:00
|
|
|
#include "riscos/query.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/save.h"
|
|
|
|
#include "riscos/save_draw.h"
|
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
|
|
|
#include "riscos/save_pdf.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "riscos/textselection.h"
|
|
|
|
#include "riscos/wimp.h"
|
|
|
|
#include "riscos/wimp_event.h"
|
2014-02-02 02:17:36 +04:00
|
|
|
#include "riscos/ucstables.h"
|
2014-06-04 19:44:29 +04:00
|
|
|
#include "riscos/filetype.h"
|
2004-02-26 03:44:42 +03:00
|
|
|
|
2009-01-10 03:18:34 +03:00
|
|
|
//typedef enum
|
|
|
|
//{
|
|
|
|
// QueryRsn_Quit,
|
|
|
|
// QueryRsn_Abort,
|
|
|
|
// QueryRsn_Overwrite
|
|
|
|
//} query_reason;
|
|
|
|
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/**
|
|
|
|
* \todo much of the state information for a save should probably be
|
|
|
|
* moved into a structure now since we could have multiple saves
|
|
|
|
* outstanding.
|
|
|
|
*/
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
static gui_save_type gui_save_current_type;
|
2016-06-06 10:59:23 +03:00
|
|
|
static struct hlcache_handle *gui_save_content = NULL;
|
2013-02-22 16:19:35 +04:00
|
|
|
static char *gui_save_selection = NULL;
|
2009-01-30 08:06:30 +03:00
|
|
|
static const char *gui_save_url = NULL;
|
|
|
|
static const char *gui_save_title = NULL;
|
2004-07-11 17:05:38 +04:00
|
|
|
static int gui_save_filetype;
|
2009-01-10 03:18:34 +03:00
|
|
|
static query_id gui_save_query;
|
|
|
|
static bool gui_save_send_dataload;
|
|
|
|
static wimp_message gui_save_message;
|
|
|
|
static bool gui_save_close_after = true;
|
2004-05-05 04:02:13 +04:00
|
|
|
|
2008-12-26 12:25:30 +03:00
|
|
|
static bool dragbox_active = false; /** in-progress Wimp_DragBox/DragASprite op */
|
2005-04-15 09:54:44 +04:00
|
|
|
static bool using_dragasprite = true;
|
2005-04-18 15:52:26 +04:00
|
|
|
static bool saving_from_dialog = true;
|
2005-07-16 09:54:45 +04:00
|
|
|
static osspriteop_area *saveas_area = NULL;
|
2005-04-18 15:52:26 +04:00
|
|
|
static wimp_w gui_save_sourcew = (wimp_w)-1;
|
2005-07-24 00:43:37 +04:00
|
|
|
#define LEAFNAME_MAX 200
|
|
|
|
static char save_leafname[LEAFNAME_MAX];
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2009-01-10 03:18:34 +03:00
|
|
|
/** Current save directory (updated by and used for dialog-based saving) */
|
|
|
|
static char *save_dir = NULL;
|
|
|
|
static size_t save_dir_len;
|
|
|
|
|
2004-05-06 04:52:31 +04:00
|
|
|
typedef enum { LINK_ACORN, LINK_ANT, LINK_TEXT } link_format;
|
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
/** An entry in gui_save_table. */
|
|
|
|
struct gui_save_table_entry {
|
|
|
|
int filetype;
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/**
|
|
|
|
* Table of filetypes and default filenames. Must be in sync with
|
2004-07-11 17:05:38 +04:00
|
|
|
* gui_save_type (riscos/gui.h). A filetype of 0 indicates the content should
|
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
|
|
|
* be used.
|
|
|
|
*/
|
|
|
|
static const struct gui_save_table_entry gui_save_table[] = {
|
2004-07-11 17:05:38 +04:00
|
|
|
/* GUI_SAVE_SOURCE, */ { 0, "SaveSource" },
|
|
|
|
/* GUI_SAVE_DRAW, */ { 0xaff, "SaveDraw" },
|
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
|
|
|
/* GUI_SAVE_PDF, */ { 0xadf, "SavePDF" },
|
2004-07-11 17:05:38 +04:00
|
|
|
/* GUI_SAVE_TEXT, */ { 0xfff, "SaveText" },
|
|
|
|
/* GUI_SAVE_COMPLETE, */ { 0xfaf, "SaveComplete" },
|
|
|
|
/* GUI_SAVE_OBJECT_ORIG, */ { 0, "SaveObject" },
|
2009-01-30 08:06:30 +03:00
|
|
|
/* GUI_SAVE_OBJECT_NATIVE, */ { 0, "SaveObject" },
|
2004-07-11 17:05:38 +04:00
|
|
|
/* GUI_SAVE_LINK_URI, */ { 0xf91, "SaveLink" },
|
|
|
|
/* GUI_SAVE_LINK_URL, */ { 0xb28, "SaveLink" },
|
|
|
|
/* GUI_SAVE_LINK_TEXT, */ { 0xfff, "SaveLink" },
|
|
|
|
/* GUI_SAVE_HOTLIST_EXPORT_HTML, */ { 0xfaf, "Hotlist" },
|
2005-02-07 17:28:43 +03:00
|
|
|
/* GUI_SAVE_HISTORY_EXPORT_HTML, */ { 0xfaf, "History" },
|
2005-07-24 03:16:53 +04:00
|
|
|
/* GUI_SAVE_TEXT_SELECTION, */ { 0xfff, "SaveSelection" },
|
2004-07-11 17:05:38 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
static bool ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite);
|
|
|
|
|
|
|
|
|
2005-07-16 09:54:45 +04:00
|
|
|
/**
|
|
|
|
* Create the saveas dialogue from the given template, and the sprite area
|
|
|
|
* necessary for our thumbnail (full page save)
|
|
|
|
*
|
|
|
|
* \param template_name name of template to be used
|
|
|
|
* \return window handle of created dialogue
|
|
|
|
*/
|
|
|
|
wimp_w ro_gui_saveas_create(const char *template_name)
|
|
|
|
{
|
|
|
|
const int sprite_size = (68 * 68 * 4) + ((68 * 68) / 8); /* 32bpp with mask */
|
|
|
|
int area_size = sizeof(osspriteop_area) + sizeof(osspriteop_header) +
|
|
|
|
256 * 8 + sprite_size;
|
2009-03-28 04:02:29 +03:00
|
|
|
void *area = NULL;
|
2005-07-16 09:54:45 +04:00
|
|
|
wimp_window *window;
|
|
|
|
os_error *error;
|
|
|
|
wimp_icon *icons;
|
|
|
|
wimp_w w;
|
|
|
|
|
|
|
|
window = ro_gui_dialog_load_template(template_name);
|
|
|
|
assert(window);
|
|
|
|
|
|
|
|
icons = window->icons;
|
|
|
|
|
2009-03-28 04:02:29 +03:00
|
|
|
error = xosmodule_alloc(area_size, (void **) &area);
|
2005-07-16 09:54:45 +04:00
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xosmodule_alloc: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2005-07-16 09:54:45 +04:00
|
|
|
xwimp_close_template();
|
|
|
|
die(error->errmess);
|
2009-03-28 04:02:29 +03:00
|
|
|
} else {
|
|
|
|
saveas_area = area;
|
2005-07-16 09:54:45 +04:00
|
|
|
saveas_area->size = area_size;
|
|
|
|
saveas_area->first = 16;
|
|
|
|
|
|
|
|
error = xosspriteop_clear_sprites(osspriteop_USER_AREA, saveas_area);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"xosspriteop_clear_sprites: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("MiscError", error->errmess);
|
2005-07-16 09:54:45 +04:00
|
|
|
|
|
|
|
xosmodule_free(saveas_area);
|
|
|
|
saveas_area = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assert((icons[ICON_SAVE_ICON].flags &
|
|
|
|
(wimp_ICON_TEXT | wimp_ICON_SPRITE | wimp_ICON_INDIRECTED)) ==
|
|
|
|
(wimp_ICON_SPRITE | wimp_ICON_INDIRECTED));
|
|
|
|
icons[ICON_SAVE_ICON].data.indirected_sprite.area = saveas_area;
|
|
|
|
|
|
|
|
/* create window */
|
|
|
|
error = xwimp_create_window(window, &w);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2005-07-16 09:54:45 +04:00
|
|
|
xwimp_close_template();
|
|
|
|
die(error->errmess);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the window definition is copied by the wimp and may be freed */
|
|
|
|
free(window);
|
|
|
|
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-01-10 03:18:34 +03:00
|
|
|
* Clean-up function that releases our sprite area and memory.
|
2005-07-16 09:54:45 +04:00
|
|
|
*/
|
|
|
|
void ro_gui_saveas_quit(void)
|
|
|
|
{
|
|
|
|
if (saveas_area) {
|
|
|
|
os_error *error = xosmodule_free(saveas_area);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xosmodule_free: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("MiscError", error->errmess);
|
2005-07-16 09:54:45 +04:00
|
|
|
}
|
|
|
|
saveas_area = NULL;
|
|
|
|
}
|
2009-01-10 03:18:34 +03:00
|
|
|
|
|
|
|
free(save_dir);
|
|
|
|
save_dir = NULL;
|
2005-07-16 09:54:45 +04:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a thumbnail sprite for the page being saved.
|
|
|
|
*
|
|
|
|
* \param h content to be converted
|
|
|
|
* \param name sprite name to use
|
|
|
|
* \return true iff successful
|
|
|
|
*/
|
|
|
|
static bool
|
|
|
|
ro_gui_save_create_thumbnail(struct hlcache_handle *h, const char *name)
|
|
|
|
{
|
|
|
|
osspriteop_header *sprite_header;
|
|
|
|
struct bitmap *bitmap;
|
|
|
|
osspriteop_area *area;
|
|
|
|
|
|
|
|
bitmap = riscos_bitmap_create(34, 34, BITMAP_NEW | BITMAP_OPAQUE | BITMAP_CLEAR_MEMORY);
|
|
|
|
if (!bitmap) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Thumbnail initialisation failed.");
|
2016-06-06 11:00:52 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
riscos_bitmap_render(bitmap, h);
|
|
|
|
area = riscos_bitmap_convert_8bpp(bitmap);
|
|
|
|
riscos_bitmap_destroy(bitmap);
|
|
|
|
if (!area) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Thumbnail conversion failed.");
|
2016-06-06 11:00:52 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite_header = (osspriteop_header *)(area + 1);
|
|
|
|
strncpy(sprite_header->name, name, 12);
|
|
|
|
|
|
|
|
|
|
|
|
/* we can't resize the saveas sprite area because it may move
|
|
|
|
* and we have no elegant way to update the window definition
|
|
|
|
* on all OS versions
|
|
|
|
*/
|
|
|
|
assert(sprite_header->size <= saveas_area->size - saveas_area->first);
|
|
|
|
|
|
|
|
memcpy((byte*)saveas_area + saveas_area->first,
|
|
|
|
sprite_header, sprite_header->size);
|
|
|
|
|
|
|
|
saveas_area->sprite_count = 1;
|
|
|
|
saveas_area->used = saveas_area->first + sprite_header->size;
|
|
|
|
|
|
|
|
free(area);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Suggest a leafname and sprite name for the given content.
|
|
|
|
*
|
|
|
|
* \param h content being saved
|
|
|
|
* \param save_type type of save operation being performed
|
|
|
|
* \param url used to determine leafname
|
|
|
|
* \param leaf_buf buffer to receive suggested leafname.
|
|
|
|
* \param leaf_len size of buffer to receive suggested leafname.
|
|
|
|
* \param icon_buf buffer to receive sprite name.
|
|
|
|
* \param icon_len size of buffer to receive icon name.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
ro_gui_save_set_state(struct hlcache_handle *h, gui_save_type save_type,
|
|
|
|
const nsurl *url, char *leaf_buf, size_t leaf_len,
|
|
|
|
char *icon_buf, size_t icon_len)
|
|
|
|
{
|
|
|
|
/* filename */
|
|
|
|
const char *name = gui_save_table[save_type].name;
|
|
|
|
bool done = false;
|
|
|
|
char *nice = NULL;
|
|
|
|
nserror err;
|
|
|
|
char *local_name;
|
|
|
|
|
|
|
|
assert(icon_len >= 13);
|
|
|
|
|
|
|
|
/* parameters that we need to remember */
|
|
|
|
gui_save_current_type = save_type;
|
|
|
|
gui_save_content = h;
|
|
|
|
|
|
|
|
/* suggest a filetype based upon the content */
|
|
|
|
gui_save_filetype = gui_save_table[save_type].filetype;
|
|
|
|
if (!gui_save_filetype && h) {
|
|
|
|
if (save_type == GUI_SAVE_OBJECT_NATIVE) {
|
|
|
|
switch (ro_content_native_type(h)) {
|
|
|
|
case osfile_TYPE_SPRITE:
|
|
|
|
gui_save_filetype = osfile_TYPE_SPRITE;
|
|
|
|
break;
|
|
|
|
case osfile_TYPE_DRAW:
|
|
|
|
gui_save_filetype = osfile_TYPE_DRAW;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!gui_save_filetype)
|
|
|
|
gui_save_filetype = ro_content_filetype(h);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* leafname */
|
|
|
|
if ((url != NULL) &&
|
|
|
|
(nsurl_nice(url, &nice, nsoption_bool(strip_extensions)) ==
|
|
|
|
NSERROR_OK)) {
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; nice[i]; i++) {
|
|
|
|
if (nice[i] == '.')
|
|
|
|
nice[i] = '/';
|
|
|
|
else if (nice[i] <= ' ' ||
|
|
|
|
strchr(":*#$&@^%\\", nice[i]))
|
|
|
|
nice[i] = '_';
|
|
|
|
}
|
|
|
|
name = nice;
|
|
|
|
} else {
|
|
|
|
name = messages_get(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* filename is utf8 */
|
|
|
|
if (save_type == GUI_SAVE_COMPLETE && leaf_len > 0) {
|
|
|
|
leaf_buf[0] = '!';
|
|
|
|
leaf_buf++;
|
|
|
|
leaf_len--;
|
|
|
|
}
|
|
|
|
strncpy(leaf_buf, name, leaf_len);
|
|
|
|
leaf_buf[leaf_len - 1] = 0;
|
|
|
|
|
|
|
|
err = utf8_to_local_encoding(name, 0, &local_name);
|
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
/* badenc should never happen */
|
|
|
|
assert(err != NSERROR_BAD_ENCODING);
|
|
|
|
local_name = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (local_name != NULL)
|
|
|
|
name = local_name;
|
|
|
|
|
|
|
|
/* sprite name used for icon and dragging */
|
|
|
|
if (save_type == GUI_SAVE_COMPLETE) {
|
|
|
|
int index;
|
|
|
|
|
|
|
|
/* Paint gets confused with uppercase characters and we need to
|
|
|
|
convert spaces to hard spaces */
|
|
|
|
icon_buf[0] = '!';
|
|
|
|
for (index = 0; index < 11 && name[index]; ) {
|
|
|
|
char ch = name[index];
|
|
|
|
if (ch == ' ')
|
|
|
|
icon_buf[++index] = 0xa0;
|
|
|
|
else
|
|
|
|
icon_buf[++index] = tolower(ch);
|
|
|
|
}
|
|
|
|
memset(&icon_buf[index + 1], 0, 11 - index);
|
|
|
|
icon_buf[12] = '\0';
|
|
|
|
|
|
|
|
if (ro_gui_save_create_thumbnail(h, icon_buf))
|
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!done) {
|
|
|
|
osspriteop_header *sprite;
|
|
|
|
os_error *error;
|
|
|
|
|
|
|
|
sprintf(icon_buf, "file_%.3x", gui_save_filetype);
|
|
|
|
|
|
|
|
error = ro_gui_wimp_get_sprite(icon_buf, &sprite);
|
|
|
|
if (error && error->errnum == error_SPRITE_OP_DOESNT_EXIST) {
|
|
|
|
/* try the 'unknown' filetype sprite as a fallback */
|
|
|
|
memcpy(icon_buf, "file_xxx", 9);
|
|
|
|
error = ro_gui_wimp_get_sprite(icon_buf, &sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"ro_gui_wimp_get_sprite: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("MiscError", error->errmess);
|
|
|
|
} else {
|
|
|
|
/* the sprite area should always be large enough for
|
|
|
|
* file_xxx sprites */
|
|
|
|
assert(sprite->size <= saveas_area->size -
|
|
|
|
saveas_area->first);
|
|
|
|
|
|
|
|
memcpy((byte*)saveas_area + saveas_area->first,
|
|
|
|
sprite,
|
|
|
|
sprite->size);
|
|
|
|
|
|
|
|
saveas_area->sprite_count = 1;
|
|
|
|
saveas_area->used = saveas_area->first + sprite->size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
free(local_name);
|
|
|
|
free(nice);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
/**
|
|
|
|
* Prepares the save box to reflect gui_save_type and a content, and
|
|
|
|
* opens it.
|
|
|
|
*
|
|
|
|
* \param save_type type of save
|
2010-04-07 21:01:27 +04:00
|
|
|
* \param h content to save
|
2009-01-30 08:06:30 +03:00
|
|
|
* \param s selection to save
|
|
|
|
* \param url url to be saved (link types)
|
|
|
|
* \param title title (if any), when saving links
|
2004-07-11 17:05:38 +04:00
|
|
|
*/
|
2016-06-06 10:59:23 +03:00
|
|
|
void ro_gui_save_prepare(gui_save_type save_type, struct hlcache_handle *h,
|
2014-10-31 03:24:57 +03:00
|
|
|
char *s, const nsurl *url, const char *title)
|
2004-07-11 17:05:38 +04:00
|
|
|
{
|
2009-01-10 03:18:34 +03:00
|
|
|
char name_buf[FILENAME_MAX];
|
|
|
|
size_t leaf_offset = 0;
|
2004-07-11 17:05:38 +04:00
|
|
|
char icon_buf[20];
|
|
|
|
|
2009-01-30 08:06:30 +03:00
|
|
|
assert( (save_type == GUI_SAVE_LINK_URI) ||
|
|
|
|
(save_type == GUI_SAVE_LINK_URL) ||
|
|
|
|
(save_type == GUI_SAVE_LINK_TEXT) ||
|
|
|
|
(save_type == GUI_SAVE_HOTLIST_EXPORT_HTML) ||
|
|
|
|
(save_type == GUI_SAVE_HISTORY_EXPORT_HTML) ||
|
2010-04-07 21:01:27 +04:00
|
|
|
(save_type == GUI_SAVE_TEXT_SELECTION) || h);
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2013-02-22 16:19:35 +04:00
|
|
|
if (gui_save_selection == NULL)
|
|
|
|
free(gui_save_selection);
|
|
|
|
|
2009-01-30 08:06:30 +03:00
|
|
|
gui_save_selection = s;
|
2014-10-31 03:24:57 +03:00
|
|
|
if (url != NULL) {
|
|
|
|
gui_save_url = nsurl_access(url);
|
|
|
|
} else {
|
|
|
|
gui_save_url = NULL;
|
|
|
|
}
|
2009-01-30 08:06:30 +03:00
|
|
|
gui_save_title = title;
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2009-01-10 03:18:34 +03:00
|
|
|
if (save_dir) {
|
|
|
|
leaf_offset = save_dir_len;
|
|
|
|
memcpy(name_buf, save_dir, leaf_offset);
|
|
|
|
name_buf[leaf_offset++] = '.';
|
|
|
|
}
|
|
|
|
|
2014-10-31 03:24:57 +03:00
|
|
|
if (h != NULL) {
|
|
|
|
url = hlcache_handle_get_url(h);
|
|
|
|
}
|
|
|
|
|
|
|
|
ro_gui_save_set_state(h, save_type, url,
|
2011-10-12 01:15:44 +04:00
|
|
|
name_buf + leaf_offset, FILENAME_MAX - leaf_offset,
|
|
|
|
icon_buf, sizeof(icon_buf));
|
2004-07-11 17:05:38 +04:00
|
|
|
|
2005-07-16 18:35:25 +04:00
|
|
|
ro_gui_set_icon_sprite(dialog_saveas, ICON_SAVE_ICON, saveas_area,
|
|
|
|
icon_buf);
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2008-08-05 05:23:04 +04:00
|
|
|
ro_gui_set_icon_string(dialog_saveas, ICON_SAVE_PATH, name_buf, true);
|
2005-12-31 07:40:49 +03:00
|
|
|
ro_gui_wimp_event_memorise(dialog_saveas);
|
2004-07-11 17:05:38 +04:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Handle lack of Message_DataSaveAck for drags, saveas dialogs and clipboard code
|
2005-04-18 15:52:26 +04:00
|
|
|
*
|
2016-06-06 11:00:52 +03:00
|
|
|
* \param message A wimp message.
|
2004-02-26 03:44:42 +03:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
static void ro_gui_save_bounced(wimp_message *message)
|
2004-02-26 03:44:42 +03:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
gui_current_drag_type = GUI_DRAG_NONE;
|
2004-02-26 03:44:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Handle User_Drag_Box event for a drag from the save dialog or browser window.
|
2005-04-18 15:52:26 +04:00
|
|
|
*
|
2016-06-06 11:00:52 +03:00
|
|
|
* \param *drag The Wimp_DragEnd data block.
|
|
|
|
* \param *data NULL, as function is used as a callback from ro_mouse.
|
2005-04-15 09:54:44 +04:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
static void ro_gui_save_drag_end(wimp_dragged *drag, void *data)
|
2005-04-15 09:54:44 +04:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
const char *name;
|
2009-01-10 03:18:34 +03:00
|
|
|
wimp_pointer pointer;
|
2016-06-06 11:00:52 +03:00
|
|
|
wimp_message message;
|
|
|
|
os_error *error;
|
|
|
|
char *dp, *ep;
|
|
|
|
char *local_name = NULL;
|
2005-05-02 06:11:06 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (dragbox_active)
|
|
|
|
ro_gui_drag_box_cancel();
|
2005-04-15 09:54:44 +04:00
|
|
|
|
|
|
|
error = xwimp_get_pointer_info(&pointer);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
2004-02-26 03:44:42 +03:00
|
|
|
return;
|
2005-04-15 09:54:44 +04:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* perform hit-test if the destination is the same as the
|
|
|
|
* source window; we want to allow drag-saving from a page
|
|
|
|
* into the input fields within the page, but avoid accidental
|
|
|
|
* replacements of the current page
|
|
|
|
*/
|
|
|
|
if (gui_save_sourcew != (wimp_w)-1 && pointer.w == gui_save_sourcew) {
|
|
|
|
int dx = (drag->final.x1 + drag->final.x0)/2;
|
|
|
|
int dy = (drag->final.y1 + drag->final.y0)/2;
|
|
|
|
struct gui_window *g;
|
|
|
|
bool dest_ok = false;
|
|
|
|
os_coord pos;
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
g = ro_gui_window_lookup(gui_save_sourcew);
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (g && ro_gui_window_to_window_pos(g, dx, dy, &pos)) {
|
|
|
|
dest_ok = browser_window_drop_file_at_point(g->bw,
|
|
|
|
pos.x, pos.y, NULL);
|
|
|
|
}
|
|
|
|
if (!dest_ok)
|
|
|
|
return;
|
|
|
|
}
|
2005-04-18 15:52:26 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (!saving_from_dialog) {
|
|
|
|
/* saving directly from browser window, choose a
|
|
|
|
* name based upon the URL */
|
|
|
|
nserror err;
|
|
|
|
err = utf8_to_local_encoding(save_leafname, 0, &local_name);
|
|
|
|
if (err != NSERROR_OK) {
|
|
|
|
/* badenc should never happen */
|
|
|
|
assert(err != NSERROR_BAD_ENCODING);
|
|
|
|
local_name = NULL;
|
|
|
|
}
|
|
|
|
name = local_name ? local_name : save_leafname;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
char *dot;
|
2004-02-26 03:44:42 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* saving from dialog, grab leafname from icon */
|
|
|
|
name = ro_gui_get_icon_string(gui_save_sourcew, ICON_SAVE_PATH);
|
|
|
|
dot = strrchr(name, '.');
|
|
|
|
if (dot)
|
|
|
|
name = dot + 1;
|
|
|
|
}
|
2004-02-26 03:44:42 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
dp = message.data.data_xfer.file_name;
|
|
|
|
ep = dp + sizeof message.data.data_xfer.file_name;
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (gui_save_current_type == GUI_SAVE_COMPLETE) {
|
|
|
|
message.data.data_xfer.file_type = 0x2000;
|
|
|
|
if (*name != '!') *dp++ = '!';
|
|
|
|
} else
|
|
|
|
message.data.data_xfer.file_type = gui_save_filetype;
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_gui_convert_save_path(dp, ep - dp, name);
|
2013-02-22 16:19:35 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/** \todo we're supposed to set this if drag-n-drop used */
|
|
|
|
message.your_ref = 0;
|
2013-02-22 16:19:35 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
message.action = message_DATA_SAVE;
|
|
|
|
message.data.data_xfer.w = pointer.w;
|
|
|
|
message.data.data_xfer.i = pointer.i;
|
|
|
|
message.data.data_xfer.pos.x = pointer.pos.x;
|
|
|
|
message.data.data_xfer.pos.y = pointer.pos.y;
|
|
|
|
message.data.data_xfer.est_size = 1000;
|
|
|
|
message.size = 44 + ((strlen(message.data.data_xfer.file_name) + 4) &
|
|
|
|
(~3u));
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_message_send_message_to_window(wimp_USER_MESSAGE_RECORDED, &message,
|
|
|
|
pointer.w, pointer.i, ro_gui_save_bounced, NULL);
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
gui_current_drag_type = GUI_DRAG_SAVE;
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
free(local_name);
|
2005-04-15 09:54:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-31 06:43:06 +03:00
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Starts a drag for the save dialog
|
2009-01-31 06:43:06 +03:00
|
|
|
*
|
2016-06-06 11:00:52 +03:00
|
|
|
* \param pointer mouse position info from Wimp
|
2009-01-31 06:43:06 +03:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
void ro_gui_save_start_drag(wimp_pointer *pointer)
|
|
|
|
{
|
|
|
|
if (pointer->buttons & (wimp_DRAG_SELECT | wimp_DRAG_ADJUST)) {
|
|
|
|
const char *sprite = ro_gui_get_icon_string(pointer->w, pointer->i);
|
|
|
|
int x = pointer->pos.x, y = pointer->pos.y;
|
|
|
|
wimp_window_state wstate;
|
|
|
|
wimp_icon_state istate;
|
|
|
|
/* start the drag from the icon's exact location, rather than the pointer */
|
|
|
|
istate.w = wstate.w = pointer->w;
|
|
|
|
istate.i = pointer->i;
|
|
|
|
if (!xwimp_get_window_state(&wstate) && !xwimp_get_icon_state(&istate)) {
|
|
|
|
x = (istate.icon.extent.x1 + istate.icon.extent.x0)/2 +
|
|
|
|
wstate.visible.x0 - wstate.xscroll;
|
|
|
|
y = (istate.icon.extent.y1 + istate.icon.extent.y0)/2 +
|
|
|
|
wstate.visible.y1 - wstate.yscroll;
|
|
|
|
}
|
|
|
|
ro_mouse_drag_start(ro_gui_save_drag_end, NULL, NULL, NULL);
|
|
|
|
gui_save_sourcew = pointer->w;
|
|
|
|
saving_from_dialog = true;
|
|
|
|
gui_save_close_after = !(pointer->buttons & wimp_DRAG_ADJUST);
|
|
|
|
ro_gui_drag_icon(x, y, sprite);
|
|
|
|
}
|
|
|
|
}
|
2009-01-31 06:43:06 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Save completed, inform recipient and close our 'save as' dialog.
|
|
|
|
*/
|
|
|
|
static void ro_gui_save_done(void)
|
2009-01-31 06:43:06 +03:00
|
|
|
{
|
|
|
|
os_error *error;
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (gui_save_send_dataload) {
|
|
|
|
/* Ack successful save with message_DATA_LOAD */
|
|
|
|
wimp_message *message = &gui_save_message;
|
|
|
|
message->action = message_DATA_LOAD;
|
|
|
|
message->your_ref = message->my_ref;
|
|
|
|
error = xwimp_send_message(wimp_USER_MESSAGE, message,
|
|
|
|
message->sender);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("SaveError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
2009-01-31 06:43:06 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (saving_from_dialog) {
|
|
|
|
/* remember the save directory if saving to the Filer */
|
|
|
|
if (!gui_save_send_dataload ||
|
|
|
|
gui_save_message.data.data_xfer.est_size != -1) {
|
|
|
|
char *sp = gui_save_message.data.data_xfer.file_name;
|
|
|
|
char *ep = sp + sizeof(gui_save_message.data.data_xfer.file_name);
|
|
|
|
char *lastdot = NULL;
|
|
|
|
char *p = sp;
|
2009-01-31 06:43:06 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
while (p < ep && *p >= 0x20) {
|
|
|
|
if (*p == '.') {
|
|
|
|
/* don't remember the directory if it's a temporary file */
|
|
|
|
if (!lastdot && p == sp + 12 &&
|
|
|
|
!memcmp(sp, "<Wimp$Scrap>", 12)) break;
|
|
|
|
lastdot = p;
|
|
|
|
}
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
if (lastdot) {
|
|
|
|
/* remember the directory */
|
|
|
|
char *new_dir = realloc(save_dir, (lastdot+1)-sp);
|
|
|
|
if (new_dir) {
|
|
|
|
save_dir_len = lastdot - sp;
|
|
|
|
memcpy(new_dir, sp, save_dir_len);
|
|
|
|
new_dir[save_dir_len] = '\0';
|
|
|
|
save_dir = new_dir;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gui_save_close_after) {
|
|
|
|
/* Close the save window */
|
|
|
|
ro_gui_dialog_close(dialog_saveas);
|
|
|
|
error = xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"xwimp_create_menu: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("MenuError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
2009-01-31 06:43:06 +03:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (!saving_from_dialog || gui_save_close_after)
|
|
|
|
gui_save_content = 0;
|
|
|
|
}
|
2009-01-31 06:43:06 +03:00
|
|
|
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/**
|
|
|
|
* User has opted not to overwrite the existing file.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
ro_gui_save_overwrite_cancelled(query_id id, enum query_response res, void *p)
|
|
|
|
{
|
|
|
|
if (!saving_from_dialog) {
|
|
|
|
// ro_gui_save_prepare(gui_save_current_type, gui_save_content);
|
|
|
|
// ro_gui_dialog_open_persistent(g->window, dialog_saveas, true);
|
|
|
|
}
|
2009-01-31 06:43:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-15 09:54:44 +04:00
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Overwrite of existing file confirmed, proceed with the save.
|
2005-04-15 09:54:44 +04:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
static void
|
|
|
|
ro_gui_save_overwrite_confirmed(query_id id, enum query_response res, void *p)
|
2005-04-15 09:54:44 +04:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
if (ro_gui_save_content(gui_save_content, gui_save_message.data.data_xfer.file_name, true)) {
|
|
|
|
ro_gui_save_done();
|
|
|
|
}
|
|
|
|
}
|
2005-04-15 09:54:44 +04:00
|
|
|
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/**
|
|
|
|
* Save a link file.
|
|
|
|
*
|
|
|
|
* \param url url to be saved
|
|
|
|
* \param title corresponding title, if any
|
|
|
|
* \param format format of link file
|
|
|
|
* \param path pathname for link file
|
|
|
|
* \return true on success, false on failure and reports the error
|
|
|
|
*/
|
|
|
|
static bool
|
|
|
|
ro_gui_save_link(const char *url, const char *title, link_format format,
|
|
|
|
char *path)
|
|
|
|
{
|
|
|
|
FILE *fp = fopen(path, "w");
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (!fp) {
|
|
|
|
ro_warn_user("SaveError", strerror(errno));
|
|
|
|
return false;
|
2005-04-15 09:54:44 +04:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
switch (format) {
|
|
|
|
case LINK_ACORN: /* URI */
|
|
|
|
fprintf(fp, "%s\t%s\n", "URI", "100");
|
|
|
|
fprintf(fp, "\t# NetSurf %s\n\n", netsurf_version);
|
|
|
|
fprintf(fp, "\t%s\n", url);
|
|
|
|
if (title)
|
|
|
|
fprintf(fp, "\t%s\n", title);
|
|
|
|
else
|
|
|
|
fprintf(fp, "\t*\n");
|
|
|
|
break;
|
|
|
|
case LINK_ANT: /* URL */
|
|
|
|
case LINK_TEXT: /* Text */
|
|
|
|
fprintf(fp, "%s\n", url);
|
|
|
|
break;
|
|
|
|
}
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
fclose(fp);
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
switch (format) {
|
|
|
|
case LINK_ACORN: /* URI */
|
|
|
|
xosfile_set_type(path, 0xf91);
|
|
|
|
break;
|
|
|
|
case LINK_ANT: /* URL */
|
|
|
|
xosfile_set_type(path, 0xb28);
|
|
|
|
break;
|
|
|
|
case LINK_TEXT: /* Text */
|
|
|
|
xosfile_set_type(path, 0xfff);
|
|
|
|
break;
|
2004-02-26 03:44:42 +03:00
|
|
|
}
|
2016-06-06 11:00:52 +03:00
|
|
|
|
|
|
|
return true;
|
2004-02-26 03:44:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-02 06:11:06 +04:00
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* set RISC OS filetype of file from mimetype
|
2005-05-02 06:11:06 +04:00
|
|
|
*
|
2016-06-06 11:00:52 +03:00
|
|
|
* \param path The path of the file to set filetype on
|
|
|
|
* \param mime_type The mime type to set.
|
2005-05-02 06:11:06 +04:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
static void ro_gui_save_set_file_type(const char *path, lwc_string *mime_type)
|
2005-05-02 06:11:06 +04:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
int rotype = ro_content_filetype_from_mime_type(mime_type);
|
|
|
|
os_error *error;
|
2005-05-02 06:11:06 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
error = xosfile_set_type(path, rotype);
|
|
|
|
if (error != NULL) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2006-02-16 02:09:55 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Prepare an application directory and save_complete() to it.
|
2013-09-08 03:47:55 +04:00
|
|
|
*
|
2016-06-06 11:00:52 +03:00
|
|
|
* \param h content of type CONTENT_HTML to save
|
|
|
|
* \param path path to save as
|
|
|
|
* \return true on success, false on error and error reported
|
2004-02-26 03:44:42 +03:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
static bool ro_gui_save_complete(struct hlcache_handle *h, char *path)
|
2004-02-26 03:44:42 +03:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
void *spr = ((byte *) saveas_area) + saveas_area->first;
|
|
|
|
osspriteop_header *sprite = (osspriteop_header *) spr;
|
|
|
|
char name[12];
|
|
|
|
char buf[256];
|
|
|
|
FILE *fp;
|
2005-04-17 01:26:15 +04:00
|
|
|
os_error *error;
|
2016-06-06 11:00:52 +03:00
|
|
|
size_t len;
|
|
|
|
char *dot;
|
|
|
|
int i;
|
2004-02-26 03:44:42 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* Create dir */
|
|
|
|
error = xosfile_create_dir(path, 0);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xosfile_create_dir: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("SaveError", error->errmess);
|
|
|
|
return false;
|
|
|
|
}
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* Save !Run file */
|
|
|
|
snprintf(buf, sizeof buf, "%s.!Run", path);
|
|
|
|
fp = fopen(buf, "w");
|
|
|
|
if (!fp) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "fopen(): errno = %i", errno);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("SaveError", strerror(errno));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
fprintf(fp, "IconSprites <Obey$Dir>.!Sprites\n");
|
|
|
|
fprintf(fp, "Filer_Run <Obey$Dir>.index\n");
|
|
|
|
fclose(fp);
|
|
|
|
error = xosfile_set_type(buf, 0xfeb);
|
2005-04-17 01:26:15 +04:00
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("SaveError", error->errmess);
|
|
|
|
return false;
|
2005-04-17 01:26:15 +04:00
|
|
|
}
|
2004-02-26 03:44:42 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* create an empty !Runimage so the date gets correctly set */
|
|
|
|
snprintf(buf, sizeof buf, "%s.!RunImage", path);
|
|
|
|
fp = fopen(buf, "w");
|
|
|
|
if (!fp) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Creating !RunImage failed: errno = %i",
|
|
|
|
errno);
|
2016-06-06 11:00:52 +03:00
|
|
|
} else {
|
|
|
|
fclose(fp);
|
|
|
|
}
|
2008-12-26 12:25:30 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* Make sure the sprite name matches the directory name, because
|
|
|
|
the user may have renamed the directory since we created the
|
|
|
|
thumbnail sprite */
|
2008-12-26 12:25:30 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
dot = strrchr(path, '.');
|
|
|
|
if (dot) dot++; else dot = path;
|
|
|
|
len = strlen(dot);
|
|
|
|
if (len >= 12) len = 12;
|
2005-04-18 15:52:26 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
memcpy(name, sprite->name, 12); /* remember original name */
|
|
|
|
memcpy(sprite->name, dot, len);
|
|
|
|
memset(sprite->name + len, 0, 12 - len);
|
|
|
|
for (i = 0; i < 12; i++) /* convert to lower case */
|
|
|
|
if (sprite->name[i] != '\0')
|
|
|
|
sprite->name[i] = tolower(sprite->name[i]);
|
2005-04-17 01:26:15 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* Create !Sprites */
|
|
|
|
snprintf(buf, sizeof buf, "%s.!Sprites", path);
|
|
|
|
|
|
|
|
error = xosspriteop_save_sprite_file(osspriteop_NAME, saveas_area, buf);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"xosspriteop_save_sprite_file: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("SaveError", error->errmess);
|
|
|
|
return false;
|
2005-04-15 09:54:44 +04:00
|
|
|
}
|
2004-03-27 21:47:56 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* restore sprite name in case the save fails and we need to try again */
|
|
|
|
memcpy(sprite->name, name, 12);
|
2005-05-02 06:11:06 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* save URL file with original URL */
|
|
|
|
snprintf(buf, sizeof buf, "%s.URL", path);
|
|
|
|
if (!ro_gui_save_link(nsurl_access(hlcache_handle_get_url(h)),
|
|
|
|
content_get_title(h), LINK_ANT, buf))
|
|
|
|
return false;
|
2004-02-26 03:44:42 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
return save_complete(h, path, ro_gui_save_set_file_type);
|
|
|
|
}
|
2004-02-26 03:44:42 +03:00
|
|
|
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Overwrite confirmation callbacks
|
2004-02-26 03:44:42 +03:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
static const query_callback overwrite_funcs =
|
2004-02-26 03:44:42 +03:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_gui_save_overwrite_confirmed,
|
|
|
|
ro_gui_save_overwrite_cancelled
|
|
|
|
};
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
|
2007-06-05 09:14:54 +04:00
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Save object in native type
|
2007-06-05 09:14:54 +04:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
static bool ro_gui_save_object_native(struct hlcache_handle *h, char *path)
|
2007-06-05 09:14:54 +04:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
int file_type = ro_content_filetype(h);
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (file_type == osfile_TYPE_SPRITE || file_type == osfile_TYPE_DRAW) {
|
|
|
|
/* Native sprite or drawfile */
|
2019-05-06 00:46:40 +03:00
|
|
|
const uint8_t *source_data;
|
|
|
|
size_t source_size;
|
2016-06-06 11:00:52 +03:00
|
|
|
os_error *error;
|
2004-02-26 03:44:42 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
source_data = content_get_source_data(h, &source_size);
|
|
|
|
error = xosfile_save_stamped(path, file_type,
|
|
|
|
(byte *) source_data,
|
|
|
|
(byte *) source_data + source_size);
|
|
|
|
if (error != NULL) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"xosfile_save_stamped: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("SaveError", error->errmess);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Non-native type: export */
|
|
|
|
switch (ro_content_native_type(h)) {
|
|
|
|
case osfile_TYPE_SPRITE:
|
|
|
|
{
|
|
|
|
unsigned flags = (os_version == 0xA9) ?
|
|
|
|
BITMAP_SAVE_FULL_ALPHA : 0;
|
|
|
|
riscos_bitmap_save(content_get_bitmap(h), path, flags);
|
|
|
|
}
|
2004-03-27 21:47:56 +03:00
|
|
|
break;
|
2016-06-06 11:00:52 +03:00
|
|
|
case osfile_TYPE_DRAW:
|
|
|
|
/* Must be SVG */
|
|
|
|
return save_as_draw(h, path);
|
2005-04-15 09:54:44 +04:00
|
|
|
default:
|
2016-06-06 11:00:52 +03:00
|
|
|
return false;
|
|
|
|
}
|
2005-04-15 09:54:44 +04:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
return true;
|
2005-04-15 09:54:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Does the actual saving
|
|
|
|
*
|
2016-06-06 11:00:52 +03:00
|
|
|
* \param h handle to content to save (or NULL for other)
|
|
|
|
* \param path path to save to
|
2014-11-13 01:36:11 +03:00
|
|
|
* \param force_overwrite true iff required to overwrite without prompting
|
2009-01-10 03:18:34 +03:00
|
|
|
* \return true on success,
|
|
|
|
* false on (i) error and error reported
|
|
|
|
* or (ii) deferred awaiting user confirmation
|
2005-04-15 09:54:44 +04:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
static bool
|
|
|
|
ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite)
|
2005-04-15 09:54:44 +04:00
|
|
|
{
|
|
|
|
os_error *error;
|
2019-05-06 00:46:40 +03:00
|
|
|
const uint8_t *source_data;
|
|
|
|
size_t source_size;
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2009-01-10 03:18:34 +03:00
|
|
|
/* does the user want to check for collisions when saving? */
|
|
|
|
if (!force_overwrite) {
|
|
|
|
fileswitch_object_type obj_type;
|
|
|
|
/* check whether the destination file/dir already exists */
|
|
|
|
error = xosfile_read_stamped(path, &obj_type,
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xosfile_read_stamped: 0x%x:%s",
|
|
|
|
error->errnum, error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("SaveError", error->errmess);
|
2009-01-10 03:18:34 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (obj_type) {
|
|
|
|
case osfile_NOT_FOUND:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case osfile_IS_FILE:
|
2016-06-06 11:00:52 +03:00
|
|
|
gui_save_query = query_user("OverwriteFile", NULL, &overwrite_funcs, NULL, messages_get("Replace"), messages_get("DontReplace"));
|
2009-01-10 03:18:34 +03:00
|
|
|
// gui_save_query_rsn = QueryRsn_Overwrite;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
default:
|
|
|
|
error = xosfile_make_error(path, obj_type);
|
|
|
|
assert(error);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("SaveError", error->errmess);
|
2009-01-10 03:18:34 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-15 09:54:44 +04:00
|
|
|
switch (gui_save_current_type) {
|
2009-06-20 23:38:56 +04:00
|
|
|
#ifdef WITH_DRAW_EXPORT
|
2004-02-26 03:44:42 +03:00
|
|
|
case GUI_SAVE_DRAW:
|
2010-04-07 21:01:27 +04:00
|
|
|
return save_as_draw(h, path);
|
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
|
|
|
|
case GUI_SAVE_PDF:
|
2010-04-07 21:01:27 +04:00
|
|
|
return save_as_pdf(h, path);
|
2004-08-28 03:10:55 +04:00
|
|
|
#endif
|
2004-03-25 02:51:08 +03:00
|
|
|
case GUI_SAVE_TEXT:
|
2010-04-07 21:01:27 +04:00
|
|
|
save_as_text(h, path);
|
2004-03-28 18:09:55 +04:00
|
|
|
xosfile_set_type(path, 0xfff);
|
2004-03-25 02:51:08 +03:00
|
|
|
break;
|
2005-04-15 09:54:44 +04:00
|
|
|
case GUI_SAVE_COMPLETE:
|
2010-04-07 21:01:27 +04:00
|
|
|
assert(h);
|
|
|
|
if (content_get_type(h) == CONTENT_HTML) {
|
2005-04-15 09:54:44 +04:00
|
|
|
if (strcmp(path, "<Wimp$Scrap>"))
|
2010-04-07 21:01:27 +04:00
|
|
|
return ro_gui_save_complete(h, path);
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2010-04-07 21:01:27 +04:00
|
|
|
/* we can't send a whole directory to another
|
|
|
|
* application, so just send the HTML source */
|
2005-04-15 09:54:44 +04:00
|
|
|
gui_save_current_type = GUI_SAVE_SOURCE;
|
|
|
|
}
|
|
|
|
else
|
2016-06-06 11:00:52 +03:00
|
|
|
gui_save_current_type = GUI_SAVE_OBJECT_ORIG; /** \todo do this earlier? */
|
2005-04-15 09:54:44 +04:00
|
|
|
/* no break */
|
|
|
|
case GUI_SAVE_SOURCE:
|
2004-05-05 04:02:13 +04:00
|
|
|
case GUI_SAVE_OBJECT_ORIG:
|
2010-04-07 21:01:27 +04:00
|
|
|
source_data = content_get_source_data(h, &source_size);
|
2004-05-06 16:14:47 +04:00
|
|
|
error = xosfile_save_stamped(path,
|
2010-04-07 21:01:27 +04:00
|
|
|
ro_content_filetype(h),
|
|
|
|
(byte *) source_data,
|
|
|
|
(byte *) source_data + source_size);
|
2004-05-05 04:02:13 +04:00
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"xosfile_save_stamped: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2016-04-26 17:16:33 +03:00
|
|
|
ro_warn_user("SaveError", error->errmess);
|
2005-04-15 09:54:44 +04:00
|
|
|
return false;
|
2004-05-05 04:02:13 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GUI_SAVE_OBJECT_NATIVE:
|
2010-04-07 21:01:27 +04:00
|
|
|
return ro_gui_save_object_native(h, path);
|
2004-05-05 04:02:13 +04:00
|
|
|
|
|
|
|
case GUI_SAVE_LINK_URI:
|
2010-04-07 21:01:27 +04:00
|
|
|
return ro_gui_save_link(gui_save_url, gui_save_title,
|
|
|
|
LINK_ACORN, path);
|
2004-05-05 04:02:13 +04:00
|
|
|
|
|
|
|
case GUI_SAVE_LINK_URL:
|
2010-04-07 21:01:27 +04:00
|
|
|
return ro_gui_save_link(gui_save_url, gui_save_title,
|
|
|
|
LINK_ANT, path);
|
2004-05-05 04:02:13 +04:00
|
|
|
|
|
|
|
case GUI_SAVE_LINK_TEXT:
|
2010-04-07 21:01:27 +04:00
|
|
|
return ro_gui_save_link(gui_save_url, gui_save_title,
|
|
|
|
LINK_TEXT, path);
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2004-07-11 17:05:38 +04:00
|
|
|
case GUI_SAVE_HOTLIST_EXPORT_HTML:
|
2013-09-03 01:41:04 +04:00
|
|
|
if (hotlist_export(path, NULL) != NSERROR_OK)
|
2005-04-15 09:54:44 +04:00
|
|
|
return false;
|
2005-02-07 17:28:43 +03:00
|
|
|
error = xosfile_set_type(path, 0xfaf);
|
|
|
|
if (error)
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"xosfile_set_type: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2005-02-07 17:28:43 +03:00
|
|
|
break;
|
|
|
|
case GUI_SAVE_HISTORY_EXPORT_HTML:
|
2013-09-03 01:41:04 +04:00
|
|
|
if (global_history_export(path, NULL) != NSERROR_OK)
|
2005-04-15 09:54:44 +04:00
|
|
|
return false;
|
2004-12-09 13:30:44 +03:00
|
|
|
error = xosfile_set_type(path, 0xfaf);
|
|
|
|
if (error)
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"xosfile_set_type: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2004-07-06 02:17:59 +04:00
|
|
|
break;
|
2004-07-11 04:22:05 +04:00
|
|
|
|
2005-04-15 09:54:44 +04:00
|
|
|
case GUI_SAVE_TEXT_SELECTION:
|
2013-02-22 16:19:35 +04:00
|
|
|
if (gui_save_selection == NULL)
|
|
|
|
return false;
|
|
|
|
if (!utf8_save_text(gui_save_selection, path)) {
|
|
|
|
free(gui_save_selection);
|
|
|
|
gui_save_selection = NULL;
|
2006-04-26 21:26:03 +04:00
|
|
|
return false;
|
2013-02-22 16:19:35 +04:00
|
|
|
}
|
|
|
|
free(gui_save_selection);
|
|
|
|
gui_save_selection = NULL;
|
2005-04-15 09:54:44 +04:00
|
|
|
xosfile_set_type(path, 0xfff);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GUI_SAVE_CLIPBOARD_CONTENTS:
|
|
|
|
return ro_gui_save_clipboard(path);
|
|
|
|
|
|
|
|
default:
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Unexpected content type: %d, path %s",
|
|
|
|
gui_save_current_type,
|
|
|
|
path);
|
2005-04-15 09:54:44 +04:00
|
|
|
return false;
|
2004-05-06 16:14:47 +04:00
|
|
|
}
|
2005-04-15 09:54:44 +04:00
|
|
|
return true;
|
2004-02-26 03:44:42 +03:00
|
|
|
}
|
2004-03-27 21:47:56 +03:00
|
|
|
|
|
|
|
|
2009-01-10 03:18:34 +03:00
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Handle OK click/keypress in the save dialog.
|
|
|
|
*
|
|
|
|
* \param w window handle of save dialog
|
|
|
|
* \return true on success, false on failure
|
2009-01-10 03:18:34 +03:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
bool ro_gui_save_ok(wimp_w w)
|
2009-01-10 03:18:34 +03:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
const char *name = ro_gui_get_icon_string(w, ICON_SAVE_PATH);
|
|
|
|
wimp_pointer pointer;
|
|
|
|
char path[256];
|
2009-01-10 03:18:34 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (!strrchr(name, '.')) {
|
|
|
|
ro_warn_user("NoPathError", NULL);
|
|
|
|
return false;
|
2009-01-10 03:18:34 +03:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_gui_convert_save_path(path, sizeof path, name);
|
|
|
|
gui_save_sourcew = w;
|
|
|
|
saving_from_dialog = true;
|
|
|
|
gui_save_send_dataload = false;
|
|
|
|
gui_save_close_after = xwimp_get_pointer_info(&pointer)
|
|
|
|
|| !(pointer.buttons & wimp_CLICK_ADJUST);
|
|
|
|
memcpy(&gui_save_message.data.data_xfer.file_name, path, 1 + strlen(path));
|
2009-01-10 03:18:34 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (ro_gui_save_content(gui_save_content, path, !nsoption_bool(confirm_overwrite))) {
|
|
|
|
ro_gui_save_done();
|
|
|
|
return true;
|
2009-01-10 03:18:34 +03:00
|
|
|
}
|
2016-06-06 11:00:52 +03:00
|
|
|
return false;
|
2009-01-10 03:18:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-27 21:47:56 +03:00
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Initiates drag saving of an object directly from a browser window
|
2004-06-06 23:39:17 +04:00
|
|
|
*
|
2016-06-06 11:00:52 +03:00
|
|
|
* \param g gui window
|
|
|
|
* \param c content to save
|
|
|
|
* \param save_type type of save
|
2004-03-27 21:47:56 +03:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
void gui_drag_save_object(struct gui_window *g,
|
|
|
|
struct hlcache_handle *c,
|
|
|
|
gui_save_type save_type)
|
2004-03-27 21:47:56 +03:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
wimp_pointer pointer;
|
|
|
|
char icon_buf[20];
|
2004-03-27 21:47:56 +03:00
|
|
|
os_error *error;
|
2005-07-16 18:02:15 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* Close the save window because otherwise we need two contexts
|
|
|
|
*/
|
|
|
|
xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
|
|
|
ro_gui_dialog_close(dialog_saveas);
|
2005-07-16 18:02:15 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
gui_save_sourcew = g->window;
|
|
|
|
saving_from_dialog = false;
|
2004-04-11 00:04:11 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
error = xwimp_get_pointer_info(&pointer);
|
2004-03-28 18:33:52 +04:00
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
2004-03-28 18:33:52 +04:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_gui_save_set_state(c, save_type, hlcache_handle_get_url(c),
|
|
|
|
save_leafname, LEAFNAME_MAX,
|
|
|
|
icon_buf, sizeof(icon_buf));
|
2011-05-07 00:40:09 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_mouse_drag_start(ro_gui_save_drag_end, NULL, NULL, NULL);
|
2011-05-07 00:40:09 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_gui_drag_icon(pointer.pos.x, pointer.pos.y, icon_buf);
|
2004-05-05 04:02:13 +04:00
|
|
|
}
|
|
|
|
|
2004-05-06 16:14:47 +04:00
|
|
|
|
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Initiates drag saving of a selection from a browser window
|
2004-05-06 16:14:47 +04:00
|
|
|
*
|
2016-06-06 11:00:52 +03:00
|
|
|
* \param g gui window
|
|
|
|
* \param selection selection object
|
2004-05-06 16:14:47 +04:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
void gui_drag_save_selection(struct gui_window *g, const char *selection)
|
2004-05-05 04:02:13 +04:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
wimp_pointer pointer;
|
|
|
|
char icon_buf[20];
|
|
|
|
os_error *error;
|
2004-05-05 04:02:13 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* Close the save window because otherwise we need two contexts
|
|
|
|
*/
|
|
|
|
xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
|
|
|
ro_gui_dialog_close(dialog_saveas);
|
2004-05-05 04:02:13 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
gui_save_sourcew = g->window;
|
|
|
|
saving_from_dialog = false;
|
|
|
|
|
|
|
|
error = xwimp_get_pointer_info(&pointer);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
2004-08-28 03:10:55 +04:00
|
|
|
}
|
2004-05-05 04:02:13 +04:00
|
|
|
|
2004-08-28 03:10:55 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (gui_save_selection == NULL)
|
|
|
|
free(gui_save_selection);
|
2004-05-06 16:14:47 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (selection == NULL)
|
|
|
|
gui_save_selection = strdup("");
|
|
|
|
else
|
|
|
|
gui_save_selection = strdup(selection);
|
|
|
|
|
|
|
|
ro_gui_save_set_state(NULL, GUI_SAVE_TEXT_SELECTION, NULL,
|
|
|
|
save_leafname, LEAFNAME_MAX,
|
|
|
|
icon_buf, sizeof(icon_buf));
|
|
|
|
|
|
|
|
ro_mouse_drag_start(ro_gui_save_drag_end, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
ro_gui_drag_icon(pointer.pos.x, pointer.pos.y, icon_buf);
|
2004-05-05 04:02:13 +04:00
|
|
|
}
|
2005-07-16 09:54:45 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Initiates drag saving of a link/URL file
|
2005-07-16 09:54:45 +04:00
|
|
|
*
|
2016-06-06 11:00:52 +03:00
|
|
|
* \param save_type format in which URL should be saved
|
|
|
|
* \param url url to be saved
|
|
|
|
* \param title title to be included in URI format, if any
|
|
|
|
* \param g gui window to save from
|
|
|
|
* \
|
2005-07-16 09:54:45 +04:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
void ro_gui_drag_save_link(gui_save_type save_type, const nsurl *url,
|
|
|
|
const char *title, struct gui_window *g)
|
2005-07-16 09:54:45 +04:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
wimp_pointer pointer;
|
|
|
|
char icon_buf[20];
|
|
|
|
os_error *error;
|
2005-07-16 18:35:25 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* Close the save window because otherwise we need two contexts
|
|
|
|
*/
|
|
|
|
xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
|
|
|
|
ro_gui_dialog_close(dialog_saveas);
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
gui_save_url = nsurl_access(url);
|
|
|
|
gui_save_title = title;
|
|
|
|
gui_save_sourcew = g->window;
|
|
|
|
saving_from_dialog = false;
|
|
|
|
|
|
|
|
error = xwimp_get_pointer_info(&pointer);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
|
|
|
return;
|
2005-07-16 18:35:25 +04:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_gui_save_set_state(NULL, save_type, url, save_leafname,
|
|
|
|
LEAFNAME_MAX, icon_buf, sizeof(icon_buf));
|
2005-07-16 18:35:25 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_mouse_drag_start(ro_gui_save_drag_end, NULL, NULL, NULL);
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_gui_drag_icon(pointer.pos.x, pointer.pos.y, icon_buf);
|
|
|
|
}
|
2005-07-16 09:54:45 +04:00
|
|
|
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/**
|
|
|
|
* Start drag of icon under the pointer.
|
|
|
|
*
|
|
|
|
* \param x The x coordinate of the drag start
|
|
|
|
* \param y The y coordinate of the drag start
|
|
|
|
* \param sprite The sprite to use for the drag.
|
|
|
|
*/
|
|
|
|
void ro_gui_drag_icon(int x, int y, const char *sprite)
|
|
|
|
{
|
|
|
|
os_error *error;
|
|
|
|
wimp_drag drag;
|
|
|
|
int r2;
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
drag.initial.x0 = x - 34;
|
|
|
|
drag.initial.y0 = y - 34;
|
|
|
|
drag.initial.x1 = x + 34;
|
|
|
|
drag.initial.y1 = y + 34;
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (sprite && (xosbyte2(osbyte_READ_CMOS, 28, 0, &r2) || (r2 & 2))) {
|
|
|
|
osspriteop_area *area = (osspriteop_area*)1;
|
2005-09-06 15:07:42 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* first try our local sprite area in case it's a thumbnail sprite */
|
|
|
|
if (saveas_area) {
|
|
|
|
error = xosspriteop_select_sprite(osspriteop_USER_AREA,
|
|
|
|
saveas_area, (osspriteop_id)sprite, NULL);
|
|
|
|
if (error) {
|
|
|
|
if (error->errnum != error_SPRITE_OP_DOESNT_EXIST) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"xosspriteop_select_sprite: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("MiscError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
area = saveas_area;
|
|
|
|
}
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
error = xdragasprite_start(dragasprite_HPOS_CENTRE |
|
|
|
|
dragasprite_VPOS_CENTRE |
|
|
|
|
dragasprite_BOUND_POINTER |
|
|
|
|
dragasprite_DROP_SHADOW,
|
|
|
|
area, sprite, &drag.initial, 0);
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (!error) {
|
|
|
|
using_dragasprite = true;
|
|
|
|
dragbox_active = true;
|
|
|
|
return;
|
2005-07-16 09:54:45 +04:00
|
|
|
}
|
2016-06-06 11:00:52 +03:00
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xdragasprite_start: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2005-07-16 09:54:45 +04:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
drag.type = wimp_DRAG_USER_FIXED;
|
|
|
|
drag.bbox.x0 = -0x8000;
|
|
|
|
drag.bbox.y0 = -0x8000;
|
|
|
|
drag.bbox.x1 = 0x7fff;
|
|
|
|
drag.bbox.y1 = 0x7fff;
|
|
|
|
|
|
|
|
using_dragasprite = false;
|
|
|
|
error = xwimp_drag_box(&drag);
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("DragError", error->errmess);
|
|
|
|
} else {
|
|
|
|
dragbox_active = true;
|
|
|
|
}
|
|
|
|
}
|
2005-07-16 09:54:45 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Convert a ctrl-char terminated pathname possibly containing spaces
|
|
|
|
* to a NUL-terminated one containing only hard spaces.
|
2005-07-16 09:54:45 +04:00
|
|
|
*
|
2016-06-06 11:00:52 +03:00
|
|
|
* \param dp destination buffer to receive pathname
|
|
|
|
* \param len size of destination buffer
|
|
|
|
* \param p source pathname, ctrl-char terminated
|
2005-07-16 09:54:45 +04:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
void ro_gui_convert_save_path(char *dp, size_t len, const char *p)
|
2005-07-16 09:54:45 +04:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
char *ep = dp + len - 1; /* leave room for NUL */
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
assert(p <= dp || p > ep); /* in-situ conversion /is/ allowed */
|
|
|
|
|
|
|
|
while (dp < ep && *p >= ' ') /* ctrl-char terminated */
|
|
|
|
{
|
|
|
|
*dp++ = (*p == ' ') ? 160 : *p;
|
|
|
|
p++;
|
2005-07-16 09:54:45 +04:00
|
|
|
}
|
2016-06-06 11:00:52 +03:00
|
|
|
*dp = '\0';
|
|
|
|
}
|
2005-07-16 09:54:45 +04:00
|
|
|
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
void ro_gui_drag_box_cancel(void)
|
|
|
|
{
|
|
|
|
if (dragbox_active) {
|
|
|
|
os_error *error;
|
|
|
|
if (using_dragasprite) {
|
|
|
|
error = xdragasprite_stop();
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"xdragasprite_stop: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
error = xwimp_drag_box(NULL);
|
|
|
|
if (error) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"xwimp_drag_box: 0x%x: %s",
|
|
|
|
error->errnum,
|
|
|
|
error->errmess);
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_warn_user("WimpError", error->errmess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dragbox_active = false;
|
|
|
|
}
|
|
|
|
}
|
2006-07-10 18:49:16 +04:00
|
|
|
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/**
|
|
|
|
* Send DataSave message on behalf of clipboard code and remember that it's the
|
|
|
|
* clipboard contents we're being asked for when the DataSaveAck reply arrives
|
|
|
|
*/
|
|
|
|
void ro_gui_send_datasave(gui_save_type save_type,
|
|
|
|
wimp_full_message_data_xfer *message, wimp_t to)
|
|
|
|
{
|
|
|
|
/* Close the save window because otherwise we need two contexts
|
|
|
|
*/
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
ro_gui_dialog_close(dialog_saveas);
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (ro_message_send_message(wimp_USER_MESSAGE_RECORDED, (wimp_message*)message,
|
|
|
|
to, ro_gui_save_bounced)) {
|
|
|
|
gui_save_current_type = save_type;
|
|
|
|
gui_save_sourcew = (wimp_w)-1;
|
|
|
|
saving_from_dialog = false;
|
2005-07-16 09:54:45 +04:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
gui_current_drag_type = GUI_DRAG_SAVE;
|
|
|
|
}
|
2005-07-16 09:54:45 +04:00
|
|
|
}
|
2009-01-10 03:18:34 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2016-06-06 11:00:52 +03:00
|
|
|
* Handle Message_DataSaveAck for a drag from the save dialog or browser window,
|
|
|
|
* or Clipboard protocol.
|
2009-01-10 03:18:34 +03:00
|
|
|
*/
|
2016-06-06 11:00:52 +03:00
|
|
|
void ro_gui_save_datasave_ack(wimp_message *message)
|
2009-01-10 03:18:34 +03:00
|
|
|
{
|
2016-06-06 11:00:52 +03:00
|
|
|
char *path = message->data.data_xfer.file_name;
|
|
|
|
struct hlcache_handle *h = gui_save_content;
|
|
|
|
bool force_overwrite;
|
|
|
|
|
|
|
|
switch (gui_save_current_type) {
|
|
|
|
case GUI_SAVE_LINK_URI:
|
|
|
|
case GUI_SAVE_LINK_URL:
|
|
|
|
case GUI_SAVE_LINK_TEXT:
|
|
|
|
case GUI_SAVE_HOTLIST_EXPORT_HTML:
|
|
|
|
case GUI_SAVE_HISTORY_EXPORT_HTML:
|
|
|
|
case GUI_SAVE_TEXT_SELECTION:
|
|
|
|
case GUI_SAVE_CLIPBOARD_CONTENTS:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if (!gui_save_content) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"unexpected DataSaveAck: gui_save_content not set");
|
2016-06-06 11:00:52 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
2009-01-10 03:18:34 +03:00
|
|
|
}
|
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (saving_from_dialog)
|
|
|
|
ro_gui_set_icon_string(gui_save_sourcew, ICON_SAVE_PATH,
|
|
|
|
path, true);
|
|
|
|
|
|
|
|
gui_save_send_dataload = true;
|
|
|
|
memcpy(&gui_save_message, message, sizeof(gui_save_message));
|
2009-01-10 03:18:34 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
/* if saving/pasting to another application, don't request user
|
|
|
|
confirmation; a ScrapFile almost certainly exists already */
|
|
|
|
if (message->data.data_xfer.est_size == -1)
|
|
|
|
force_overwrite = true;
|
|
|
|
else
|
|
|
|
force_overwrite = !nsoption_bool(confirm_overwrite);
|
2009-01-10 03:18:34 +03:00
|
|
|
|
2016-06-06 11:00:52 +03:00
|
|
|
if (ro_gui_save_content(h, path, force_overwrite))
|
2009-01-10 03:18:34 +03:00
|
|
|
ro_gui_save_done();
|
|
|
|
}
|