Code

apply patch 1498946 by zbsz (fixes #1492545 "PNG resolution value export")
[inkscape.git] / src / file.h
1 #ifndef __SP_FILE_H__
2 #define __SP_FILE_H__
4 /*
5  * File/Print operations
6  *
7  * Authors:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *   Chema Celorio <chema@celorio.com>
10  *
11  * Copyright (C) 1999-2002 Authors
12  * Copyright (C) 2001-2002 Ximian, Inc.
13  *
14  * Released under GNU GPL, read the file 'COPYING' for more information
15  */
17 #include <glib/gslist.h>
18 #include <gtk/gtkwidget.h>
20 #include "extension/extension-forward.h"
22 struct SPDesktop;
23 struct SPDocument;
25 namespace Inkscape {
26     namespace Extension {
27         struct Extension;
28     }
29 }
31 /*######################
32 ## N E W
33 ######################*/
35 /**
36  * Creates a new Inkscape document and window.
37  * Return value is a pointer to the newly created desktop.
38  */
39 SPDesktop* sp_file_new (const gchar *templ);
40 SPDesktop* sp_file_new_default (void);
42 /*######################
43 ## D E L E T E
44 ######################*/
46 /**
47  * Close the document/view
48  */
49 void sp_file_exit (void);
51 /*######################
52 ## O P E N
53 ######################*/
55 /**
56  * Opens a new file and window from the given URI
57  */
58 bool sp_file_open(
59   const gchar *uri, Inkscape::Extension::Extension *key,
60   bool add_to_recent = true, bool replace_empty = true
61   );
63 /**
64  * Displays a file open dialog. Calls sp_file_open on
65  * an OK.
66  */
67 void sp_file_open_dialog (gpointer object, gpointer data);
69 /**
70  * Reverts file to disk-copy on "YES"
71  */
72 void sp_file_revert_dialog ();
74 /*######################
75 ## S A V E
76 ######################*/
78 /**
79  *
80  */
81 bool sp_file_save (gpointer object, gpointer data);
83 /**
84  *  Saves the given document.  Displays a file select dialog
85  *  to choose the new name.
86  */
87 bool sp_file_save_as (gpointer object, gpointer data);
89 /**
90  *  Saves the given document.  Displays a file select dialog
91  *  if needed.
92  */
93 gboolean sp_file_save_document (SPDocument *document);
95 /* Do the saveas dialog with a document as the parameter */
96 gboolean sp_file_save_dialog (SPDocument *doc);
99 /*######################
100 ## I M P O R T
101 ######################*/
103 /**
104  * Displays a file selector dialog, to allow the
105  * user to import data into the current document.
106  */
107 void sp_file_import (GtkWidget * widget);
109 /**
110  * Imports a resource
111  */
112 void file_import(SPDocument *in_doc, gchar const *uri, Inkscape::Extension::Extension *key);
114 /*######################
115 ## E X P O R T
116 ######################*/
118 /**
119  * Displays a "Save as" dialog for the user, with an
120  * additional type selection, to allow the user to export
121  * the a document as a given type.
122  */
123 void sp_file_export_dialog (void *widget);
125 /**
126  * Export the given document as a Portable Network Graphics (PNG)
127  * file.  Returns FALSE if an error was encountered while writing
128  * the file, TRUE otherwise.
129  */
130 int sp_export_png_file (SPDocument *doc, const gchar *filename,
131                          double x0, double y0, double x1, double y1,
132                          unsigned int width, unsigned int height, double xdpi, double ydpi,
133                          unsigned long bgcolor,
134                          unsigned int (*status) (float, void *), void *data, bool force_overwrite = false, GSList *items_only = NULL);
137 /*######################
138 ## P R I N T
139 ######################*/
141 /* These functions are redundant now, but
142 would be useful as instance methods
143 */
145 /**
146  *
147  */
148 void sp_file_print (void);
150 /**
151  *
152  */
153 void sp_file_print_direct (void);
155 /**
156  *
157  */
158 void sp_file_print_preview (gpointer object, gpointer data);
160 /*#####################
161 ## U T I L I T Y
162 #####################*/
164 /**
165  * clean unused defs out of file
166  */
167 void sp_file_vacuum ();
170 namespace Inkscape {
171 namespace IO {
173 void fixupHrefs( SPDocument *doc, const gchar *uri, gboolean spns );
179 #endif