1 /* Dia -- a diagram creation/manipulation program
2 * Copyright (C) 1998 Alexander Larsson
4 * filter.h: definitions for adding new loaders and export filters.
5 * Copyright (C) 1999 James Henstridge
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include <diagramdata.h>
28 typedef void (* DiaExportFunc
) (DiagramData
*dia
, const gchar
*filename
,
29 const gchar
*diafilename
, void* user_data
);
31 struct _DiaExportFilter
{
32 const gchar
*description
;
33 /* NULL terminated array of extensions for this file format. The first
34 * one is the prefered extension for files of this type. */
35 const gchar
**extensions
;
40 /* returns FALSE on error loading diagram */
41 typedef gboolean (* DiaImportFunc
) (const gchar
*filename
, DiagramData
*dia
,
44 struct _DiaImportFilter
{
45 const gchar
*description
;
46 /* NULL terminated array of extensions for this file format. The first
47 * one is the prefered extension for files of this type. */
48 const gchar
**extensions
;
53 /* gets called as menu callback */
54 typedef void (* DiaCallbackFunc
) (DiagramData
*dia
,
55 guint flags
, /* further additions */
58 struct _DiaCallbackFilter
{
59 const gchar
*description
;
60 const gchar
*menupath
;
61 DiaCallbackFunc callback
;
65 /* register an export filter. The DiaExportFilter should be static, and
66 * none of its fields should be freed */
67 void filter_register_export(DiaExportFilter
*efilter
);
69 /* returns a sorted list of the export filters. */
70 GList
*filter_get_export_filters(void);
72 /* creates a nice label for the export filter (must be g_free'd) */
73 gchar
*filter_get_export_filter_label(DiaExportFilter
*efilter
);
75 /* guess the filter for a given filename. */
76 DiaExportFilter
*filter_guess_export_filter(const gchar
*filename
);
78 void filter_register_import(DiaImportFilter
*ifilter
);
79 GList
*filter_get_import_filters(void);
80 gchar
*filter_get_import_filter_label(DiaImportFilter
*ifilter
);
81 DiaImportFilter
*filter_guess_import_filter(const gchar
*filename
);
83 void filter_register_callback(DiaCallbackFilter
*cbfilter
);
84 /* returns all registered callbacks */
85 GList
*filter_get_callbacks(void);