Code

add pdf import filter via poppler-cairo
[inkscape.git] / src / extension / init.cpp
index fca5a7e5d2481b3cc7b08dc09db5114917f08d8e..230d4b50fc3221bcf6c4aede831f6433b4c727f2 100644 (file)
 
 
 #include "inkscape.h"
+#include <glibmm/ustring.h>
 #include <glibmm/i18n.h>
 
 #include "system.h"
 #include "db.h"
 #include "internal/svgz.h"
-#include "internal/ps.h"
-#ifdef HAVE_CAIRO_PDF
-# include "internal/pdf-cairo.h"
-#endif
-#ifdef WITH_GNOME_PRINT
-# include "internal/gnome.h"
-#endif
 #ifdef WIN32
 # include "internal/win32.h"
 # include "internal/emf-win32-inout.h"
 # include "internal/emf-win32-print.h"
 #endif
-#include "internal/ps-out.h"
 #ifdef HAVE_CAIRO_PDF
-# include "internal/cairo-pdf-out.h"
 # include "internal/cairo-renderer-pdf-out.h"
 # include "internal/cairo-png-out.h"
 # include "internal/cairo-ps-out.h"
 # include "internal/pdf-input-cairo.h"
 #endif
 #include "internal/pov-out.h"
+#include "internal/javafx-out.h"
 #include "internal/odf.h"
 #include "internal/latex-pstricks-out.h"
 #include "internal/latex-pstricks.h"
-#include "internal/eps-out.h"
 #include "internal/gdkpixbuf-input.h"
 #include "internal/bluredge.h"
 #include "internal/gimpgrad.h"
 #include "internal/grid.h"
+#ifdef WITH_LIBWPG
 #include "internal/wpg-input.h"
-#include "prefs-utils.h"
+#endif
+#include "preferences.h"
 #include "io/sys.h"
+#ifdef WITH_DBUS
+#include "dbus/dbus-init.h"
+#endif
 
 #ifdef WITH_IMAGE_MAGICK
 #include "internal/bitmap/adaptiveThreshold.h"
 #include "internal/bitmap/charcoal.h"
 #include "internal/bitmap/colorize.h"
 #include "internal/bitmap/contrast.h"
-#include "internal/bitmap/convolve.h"
 #include "internal/bitmap/cycleColormap.h"
 #include "internal/bitmap/despeckle.h"
 #include "internal/bitmap/edge.h"
 #include "internal/bitmap/emboss.h"
 #include "internal/bitmap/enhance.h"
 #include "internal/bitmap/equalize.h"
-#include "internal/bitmap/flop.h"
 #include "internal/bitmap/gaussianBlur.h"
 #include "internal/bitmap/implode.h"
 #include "internal/bitmap/level.h"
 #include "internal/bitmap/opacity.h"
 #include "internal/bitmap/raise.h"
 #include "internal/bitmap/reduceNoise.h"
+#include "internal/bitmap/sample.h"
 #include "internal/bitmap/shade.h"
 #include "internal/bitmap/sharpen.h"
 #include "internal/bitmap/solarize.h"
 #include "internal/bitmap/spread.h"
 #include "internal/bitmap/swirl.h"
-#include "internal/bitmap/threshold.h"
+//#include "internal/bitmap/threshold.h"
 #include "internal/bitmap/unsharpmask.h"
 #include "internal/bitmap/wave.h"
 #endif /* WITH_IMAGE_MAGICK */
 
+#include "internal/filter/filter.h"
+
 extern gboolean inkscape_app_use_gui( Inkscape::Application const *app );
 
 namespace Inkscape {
@@ -117,29 +115,28 @@ static void check_extensions();
  * \brief     Examines the given string preference and checks to see
  *            that at least one of the registered extensions matches
  *            it.  If not, a default is assigned.
- * \param     pref_path        Preference path to load
- * \param     pref_attr        Attribute to load from the preference
+ * \param     pref_path        Preference path to update
  * \param     pref_default     Default string to set
  * \param     extension_family List of extensions to search
  */
 static void
-update_pref(gchar const *pref_path, gchar const *pref_attr,
+update_pref(Glib::ustring const &pref_path,
             gchar const *pref_default) // , GSList *extension_family)
 {
-    gchar const *pref = prefs_get_string_attribute(pref_path,pref_attr);
+    Glib::ustring pref = Inkscape::Preferences::get()->getString(pref_path);
     /*
     gboolean missing=TRUE;
     for (GSList *list = extension_family; list; list = g_slist_next(list)) {
-       g_assert( list->data );
+        g_assert( list->data );
 
-       Inkscape::Extension *extension;
-               extension = reinterpret_cast<Inkscape::Extension *>(list->data);
+        Inkscape::Extension *extension;
+        extension = reinterpret_cast<Inkscape::Extension *>(list->data);
 
         if (!strcmp(extension->get_id(),pref)) missing=FALSE;
     }
     */
-    if (!Inkscape::Extension::db.get( pref ) /*missing*/) {
-        prefs_set_string_attribute(pref_path, pref_attr, pref_default);
+    if (!Inkscape::Extension::db.get( pref.data() ) /*missing*/) {
+        Inkscape::Preferences::get()->setString(pref_path, pref_default);
     }
 }
 
@@ -156,17 +153,14 @@ init()
     /* TODO: Change to Internal */
     Internal::Svg::init();
     Internal::Svgz::init();
-    Internal::PsOutput::init();
-    Internal::EpsOutput::init();
-    Internal::PrintPS::init();
+
 #ifdef HAVE_CAIRO_PDF
-    Internal::CairoPdfOutput::init();
-    Internal::PrintCairoPDF::init();
-    if (0) {
+    //g_print ("Using CairoRendererPdfOutput: new pdf exporter\n");
     Internal::CairoRendererPdfOutput::init();
     Internal::CairoRendererOutput::init();
-    }
+
     Internal::CairoPsOutput::init();
+    Internal::CairoEpsOutput::init();
 #endif
 #ifdef HAVE_POPPLER
     Internal::PdfInput::init();
@@ -176,25 +170,29 @@ init()
     Internal::PdfInputCairo::init();
     }
 #endif
-#ifdef WITH_GNOME_PRINT
-    Internal::PrintGNOME::init();
-#endif
 #ifdef WIN32
     Internal::PrintWin32::init();
     Internal::PrintEmfWin32::init();
     Internal::EmfWin32::init();
 #endif
     Internal::PovOutput::init();
+    Internal::JavaFXOutput::init();
     Internal::OdfOutput::init();
     Internal::PrintLatex::init();
     Internal::LatexOutput::init();
+#ifdef WITH_LIBWPG
     Internal::WpgInput::init();
+#endif
 
     /* Effects */
     Internal::BlurEdge::init();
     Internal::GimpGrad::init();
     Internal::Grid::init();
-       
+
+#ifdef WITH_DBUS
+    Dbus::init();
+#endif
+
     /* Raster Effects */
 #ifdef WITH_IMAGE_MAGICK
     Internal::Bitmap::AdaptiveThreshold::init();
@@ -204,14 +202,12 @@ init()
     Internal::Bitmap::Charcoal::init();
     Internal::Bitmap::Colorize::init();
     Internal::Bitmap::Contrast::init();
-    Internal::Bitmap::Convolve::init();
     Internal::Bitmap::CycleColormap::init();
     Internal::Bitmap::Edge::init();
     Internal::Bitmap::Despeckle::init();
     Internal::Bitmap::Emboss::init();
     Internal::Bitmap::Enhance::init();
     Internal::Bitmap::Equalize::init();
-    Internal::Bitmap::Flop::init();
     Internal::Bitmap::GaussianBlur::init();
     Internal::Bitmap::Implode::init();
     Internal::Bitmap::Level::init();
@@ -224,21 +220,26 @@ init()
     Internal::Bitmap::Opacity::init();
     Internal::Bitmap::Raise::init();
     Internal::Bitmap::ReduceNoise::init();
+    Internal::Bitmap::Sample::init();
     Internal::Bitmap::Shade::init();
     Internal::Bitmap::Sharpen::init();
     Internal::Bitmap::Solarize::init();
     Internal::Bitmap::Spread::init();
     Internal::Bitmap::Swirl::init();
-    Internal::Bitmap::Threshold::init();
+    //Internal::Bitmap::Threshold::init();
     Internal::Bitmap::Unsharpmask::init();
     Internal::Bitmap::Wave::init();
 #endif /* WITH_IMAGE_MAGICK */
 
+    Internal::Filter::Filter::filters_all();
+
     /* Load search path for extensions */
     if (Inkscape::Extension::Extension::search_path.size() == 0)
     {
-       Inkscape::Extension::Extension::search_path.push_back(profile_path("extensions"));
-       Inkscape::Extension::Extension::search_path.push_back(g_strdup(INKSCAPE_EXTENSIONDIR));
+        Inkscape::Extension::Extension::search_path.push_back(profile_path("extensions"));
+
+        Inkscape::Extension::Extension::search_path.push_back(g_strdup(INKSCAPE_EXTENSIONDIR));
+
     }
 
     for (unsigned int i=0; i<Inkscape::Extension::Extension::search_path.size(); i++) {
@@ -257,7 +258,7 @@ init()
     /* This is a hack to deal with updating saved outdated module
      * names in the prefs...
      */
-    update_pref("dialogs.save_as", "default",
+    update_pref("/dialogs/save_as/default",
                 SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE
                 // Inkscape::Extension::db.get_output_list()
         );
@@ -298,7 +299,6 @@ build_module_from_dir(gchar const *dirname)
 
     gchar *filename;
     while ((filename = (gchar *)g_dir_read_name(directory)) != NULL) {
-
         if (strlen(filename) < strlen(SP_MODULE_EXTENSION)) {
             continue;
         }
@@ -307,12 +307,14 @@ build_module_from_dir(gchar const *dirname)
             continue;
         }
 
-        gchar *pathname = g_strdup_printf("%s/%s", dirname, filename);
+        gchar *pathname = g_build_filename(dirname, filename, NULL);
         build_from_file(pathname);
         g_free(pathname);
     }
 
     g_dir_close(directory);
+
+       return;
 }
 
 
@@ -337,7 +339,6 @@ check_extensions()
 
     Inkscape::Extension::Extension::error_file_open();
     while (count != 0) {
-        // printf("Check extensions pass %d\n", pass++);
         count = 0;
         db.foreach(check_extensions_internal, (gpointer)&count);
         if (count != 0) anyfail = true;
@@ -357,4 +358,4 @@ check_extensions()
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :