1 #ifndef INKSCAPE_EXTENSION_DOCUMENT_INTERFACE_H_
2 #define INKSCAPE_EXTENSION_DOCUMENT_INTERFACE_H_
4 #include <glib.h>
5 #include <dbus/dbus-glib.h>
6 #include <dbus/dbus-glib-bindings.h>
7 #include <dbus/dbus-glib-lowlevel.h>
8 #include "desktop.h"
10 #define DBUS_DOCUMENT_INTERFACE_PATH "/org/inkscape/document"
12 #define TYPE_DOCUMENT_INTERFACE (document_interface_get_type ())
13 #define DOCUMENT_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TYPE_DOCUMENT_INTERFACE, DocumentInterface))
14 #define DOCUMENT_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOCUMENT_INTERFACE, DocumentInterfaceClass))
15 #define IS_DOCUMENT_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TYPE_DOCUMENT_INTERFACE))
16 #define IS_DOCUMENT_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOCUMENT_INTERFACE))
17 #define DOCUMENT_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOCUMENT_INTERFACE, DocumentInterfaceClass))
19 G_BEGIN_DECLS
21 typedef struct _DocumentInterface DocumentInterface;
22 typedef struct _DocumentInterfaceClass DocumentInterfaceClass;
24 struct _DocumentInterface {
25 GObject parent;
26 SPDesktop *desk;
27 gboolean updates;
28 };
30 struct _DocumentInterfaceClass {
31 GObjectClass parent;
32 };
34 typedef enum
35 {
36 INKSCAPE_ERROR_SELECTION,
37 INKSCAPE_ERROR_OBJECT,
38 INKSCAPE_ERROR_VERB,
39 INKSCAPE_ERROR_OTHER
40 } InkscapeError;
42 #define INKSCAPE_ERROR (inkscape_error_quark ())
43 #define INKSCAPE_TYPE_ERROR (inkscape_error_get_type ())
45 GQuark inkscape_error_quark (void);
46 GType inkscape_error_get_type (void);
48 struct DBUSPoint {
49 int x;
50 int y;
51 };
52 /****************************************************************************
53 MISC FUNCTIONS
54 ****************************************************************************/
56 gboolean
57 document_interface_delete_all (DocumentInterface *object, GError **error);
59 gboolean
60 document_interface_call_verb (DocumentInterface *object,
61 gchar *verbid, GError **error);
63 /****************************************************************************
64 CREATION FUNCTIONS
65 ****************************************************************************/
67 gchar*
68 document_interface_rectangle (DocumentInterface *object, int x, int y,
69 int width, int height, GError **error);
71 gchar*
72 document_interface_ellipse (DocumentInterface *object, int x, int y,
73 int width, int height, GError **error);
75 gchar*
76 document_interface_polygon (DocumentInterface *object, int cx, int cy,
77 int radius, int rotation, int sides,
78 GError **error);
80 gchar*
81 document_interface_star (DocumentInterface *object, int cx, int cy,
82 int r1, int r2, int sides, gdouble rounded,
83 gdouble arg1, gdouble arg2, GError **error);
85 gchar*
86 document_interface_spiral (DocumentInterface *object, int cx, int cy,
87 int r, int revolutions, GError **error);
89 gchar*
90 document_interface_line (DocumentInterface *object, int x, int y,
91 int x2, int y2, GError **error);
93 gboolean
94 document_interface_text (DocumentInterface *object, int x, int y,
95 gchar *text, GError **error);
97 gchar*
98 document_interface_node (DocumentInterface *object, gchar *svgtype,
99 GError **error);
102 /****************************************************************************
103 ENVIORNMENT FUNCTIONS
104 ****************************************************************************/
105 gdouble
106 document_interface_document_get_width (DocumentInterface *object);
108 gdouble
109 document_interface_document_get_height (DocumentInterface *object);
111 gchar *
112 document_interface_document_get_css (DocumentInterface *object, GError **error);
114 gboolean
115 document_interface_document_merge_css (DocumentInterface *object,
116 gchar *stylestring, GError **error);
118 gboolean
119 document_interface_document_set_css (DocumentInterface *object,
120 gchar *stylestring, GError **error);
122 gboolean
123 document_interface_document_resize_to_fit_selection (DocumentInterface *object,
124 GError **error);
126 /****************************************************************************
127 OBJECT FUNCTIONS
128 ****************************************************************************/
130 gboolean
131 document_interface_set_attribute (DocumentInterface *object,
132 char *shape, char *attribute,
133 char *newval, GError **error);
135 gboolean
136 document_interface_set_int_attribute (DocumentInterface *object,
137 char *shape, char *attribute,
138 int newval, GError **error);
140 gboolean
141 document_interface_set_double_attribute (DocumentInterface *object,
142 char *shape, char *attribute,
143 double newval, GError **error);
145 gchar *
146 document_interface_get_attribute (DocumentInterface *object,
147 char *shape, char *attribute, GError **error);
149 gboolean
150 document_interface_move (DocumentInterface *object, gchar *name,
151 gdouble x, gdouble y, GError **error);
153 gboolean
154 document_interface_move_to (DocumentInterface *object, gchar *name,
155 gdouble x, gdouble y, GError **error);
157 gboolean
158 document_interface_object_to_path (DocumentInterface *object,
159 char *shape, GError **error);
161 gchar *
162 document_interface_get_path (DocumentInterface *object,
163 char *pathname, GError **error);
165 gboolean
166 document_interface_transform (DocumentInterface *object, gchar *shape,
167 gchar *transformstr, GError **error);
169 gchar *
170 document_interface_get_css (DocumentInterface *object, gchar *shape,
171 GError **error);
173 gboolean
174 document_interface_modify_css (DocumentInterface *object, gchar *shape,
175 gchar *cssattrb, gchar *newval, GError **error);
177 gboolean
178 document_interface_merge_css (DocumentInterface *object, gchar *shape,
179 gchar *stylestring, GError **error);
181 gboolean
182 document_interface_move_to_layer (DocumentInterface *object, gchar *shape,
183 gchar *layerstr, GError **error);
186 GArray *
187 document_interface_get_node_coordinates (DocumentInterface *object, gchar *shape);
189 /****************************************************************************
190 FILE I/O FUNCTIONS
191 ****************************************************************************/
193 gboolean
194 document_interface_save (DocumentInterface *object, GError **error);
196 gboolean
197 document_interface_load (DocumentInterface *object,
198 gchar *filename, GError **error);
200 gboolean
201 document_interface_save_as (DocumentInterface *object,
202 gchar *filename, GError **error);
204 gboolean
205 document_interface_mark_as_unmodified (DocumentInterface *object, GError **error);
206 /*
207 gboolean
208 document_interface_print_to_file (DocumentInterface *object, GError **error);
209 */
211 /****************************************************************************
212 PROGRAM CONTROL FUNCTIONS
213 ****************************************************************************/
215 gboolean
216 document_interface_close (DocumentInterface *object, GError **error);
218 gboolean
219 document_interface_exit (DocumentInterface *object, GError **error);
221 gboolean
222 document_interface_undo (DocumentInterface *object, GError **error);
224 gboolean
225 document_interface_redo (DocumentInterface *object, GError **error);
228 /****************************************************************************
229 UPDATE FUNCTIONS
230 ****************************************************************************/
231 void
232 document_interface_pause_updates (DocumentInterface *object, GError **error);
234 void
235 document_interface_resume_updates (DocumentInterface *object, GError **error);
237 void
238 document_interface_update (DocumentInterface *object, GError **error);
240 /****************************************************************************
241 SELECTION FUNCTIONS
242 ****************************************************************************/
243 gboolean
244 document_interface_selection_get (DocumentInterface *object, char ***out, GError **error);
246 gboolean
247 document_interface_selection_add (DocumentInterface *object,
248 char *name, GError **error);
250 gboolean
251 document_interface_selection_add_list (DocumentInterface *object,
252 char **names, GError **error);
254 gboolean
255 document_interface_selection_set (DocumentInterface *object,
256 char *name, GError **error);
258 gboolean
259 document_interface_selection_set_list (DocumentInterface *object,
260 gchar **names, GError **error);
262 gboolean
263 document_interface_selection_rotate (DocumentInterface *object,
264 int angle, GError **error);
266 gboolean
267 document_interface_selection_delete(DocumentInterface *object, GError **error);
269 gboolean
270 document_interface_selection_clear(DocumentInterface *object, GError **error);
272 gboolean
273 document_interface_select_all(DocumentInterface *object, GError **error);
275 gboolean
276 document_interface_select_all_in_all_layers(DocumentInterface *object,
277 GError **error);
279 gboolean
280 document_interface_selection_box (DocumentInterface *object, int x, int y,
281 int x2, int y2, gboolean replace,
282 GError **error);
284 gboolean
285 document_interface_selection_invert (DocumentInterface *object, GError **error);
287 gboolean
288 document_interface_selection_group(DocumentInterface *object, GError **error);
290 gboolean
291 document_interface_selection_ungroup(DocumentInterface *object, GError **error);
293 gboolean
294 document_interface_selection_cut(DocumentInterface *object, GError **error);
296 gboolean
297 document_interface_selection_copy(DocumentInterface *object, GError **error);
299 gboolean
300 document_interface_selection_paste(DocumentInterface *object, GError **error);
302 gboolean
303 document_interface_selection_scale (DocumentInterface *object,
304 gdouble grow, GError **error);
306 gboolean
307 document_interface_selection_move (DocumentInterface *object, gdouble x,
308 gdouble y, GError **error);
310 gboolean
311 document_interface_selection_move_to (DocumentInterface *object, gdouble x,
312 gdouble y, GError **error);
314 gboolean
315 document_interface_selection_move_to_layer (DocumentInterface *object,
316 gchar *layerstr, GError **error);
318 GArray *
319 document_interface_selection_get_center (DocumentInterface *object);
321 gboolean
322 document_interface_selection_to_path (DocumentInterface *object, GError **error);
324 gchar *
325 document_interface_selection_combine (DocumentInterface *object, gchar *cmd,
326 GError **error);
328 gboolean
329 document_interface_selection_divide (DocumentInterface *object,
330 char ***out, GError **error);
333 gboolean
334 document_interface_selection_change_level (DocumentInterface *object, gchar *cmd,
335 GError **error);
337 /****************************************************************************
338 LAYER FUNCTIONS
339 ****************************************************************************/
341 gchar *
342 document_interface_layer_new (DocumentInterface *object, GError **error);
344 gboolean
345 document_interface_layer_set (DocumentInterface *object,
346 gchar *layerstr, GError **error);
348 gchar **
349 document_interface_layer_get_all (DocumentInterface *object);
351 gboolean
352 document_interface_layer_change_level (DocumentInterface *object,
353 gchar *cmd, GError **error);
355 gboolean
356 document_interface_layer_next (DocumentInterface *object, GError **error);
358 gboolean
359 document_interface_layer_previous (DocumentInterface *object, GError **error);
368 DocumentInterface *document_interface_new (void);
369 GType document_interface_get_type (void);
372 G_END_DECLS
374 #endif // INKSCAPE_EXTENSION_DOCUMENT_INTERFACE_H_