1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998 Alexander Larsson
3 *
4 * dialibart.c -- libart based export plugin for dia
5 * moved out of the core 2008, Hans Breuer, <Hans@Breuer.Org>
6 *
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.
11 *
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.
16 *
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.
20 */
21
22 #include <config.h>
23 #include <stdio.h>
24
25 #include "intl.h"
26 #include "message.h"
27 #include "filter.h"
28 #include "plug-ins.h"
29
30 #include "dialibartrenderer.h"
31
32 #if defined(HAVE_LIBPNG) && defined(HAVE_LIBART)
33 extern DiaExportFilter png_export_filter;
34 #endif
35
36 static gboolean
_plugin_can_unload(PluginInfo * info)37 _plugin_can_unload (PluginInfo *info)
38 {
39 /* Can't unlaod as long as we are giving away our types, e.g. dia_libart_renderer_get_type () */
40 return FALSE;
41 }
42
43 static void
_plugin_unload(PluginInfo * info)44 _plugin_unload (PluginInfo *info)
45 {
46 #if defined(HAVE_LIBPNG) && defined(HAVE_LIBART)
47 filter_unregister_export(&png_export_filter);
48 #endif
49 }
50
51 /* --- dia plug-in interface --- */
52
53 DIA_PLUGIN_CHECK_INIT
54
55 PluginInitResult
dia_plugin_init(PluginInfo * info)56 dia_plugin_init(PluginInfo *info)
57 {
58 if (!dia_plugin_info_init(info, "Libart",
59 _("Libart based rendering"),
60 _plugin_can_unload,
61 _plugin_unload))
62 return DIA_PLUGIN_INIT_ERROR;
63
64 #if defined(HAVE_LIBPNG) && defined(HAVE_LIBART)
65 /* FIXME: need to think about of proper way of registartion, see also app/display.c */
66 png_export_filter.renderer_type = dia_libart_renderer_get_type ();
67 /* PNG with libart rendering */
68 filter_register_export(&png_export_filter);
69 #endif
70
71 return DIA_PLUGIN_INIT_OK;
72 }
73