olena-2.0-13-gad921ba First attempts for gimp plugin

--- milena/mln/convert/from_to.hxx | 4 + milena/mln/tag/skeleton.hh | 3 +- milena/mln/value/qt/rgb32.hh | 16 +- .../nivault/plugin-gimp => plugin-gimp}/.gitignore | 0 .../nivault/plugin-gimp => plugin-gimp}/AUTHORS | 0 .../nivault/plugin-gimp => plugin-gimp}/COPYING | 0 .../nivault/plugin-gimp => plugin-gimp}/ChangeLog | 0 .../nivault/plugin-gimp => plugin-gimp}/HACKING | 0 .../nivault/plugin-gimp => plugin-gimp}/INSTALL | 0 .../plugin-gimp => plugin-gimp}/Makefile.am | 0 .../nivault/plugin-gimp => plugin-gimp}/TODO | 0 .../nivault/plugin-gimp => plugin-gimp}/autogen.sh | 0 plugin-gimp/configure.ac | 125 ++ .../plugin-gimp => plugin-gimp}/help/Makefile.am | 0 .../help/en/Makefile.am | 0 .../help/en/gimp-help.xml | 0 .../plugin-gimp => plugin-gimp}/help/en/index.html | 0 .../help/images/Makefile.am | 0 .../help/images/wilber.png | Bin 5022 -> 5022 bytes .../plugin-gimp => plugin-gimp}/po/ChangeLog | 0 .../po/POTFILES.in | 0 .../nivault/plugin-gimp => plugin-gimp}/po/az.po | 0 .../nivault/plugin-gimp => plugin-gimp}/po/de.po | 0 .../nivault/plugin-gimp => plugin-gimp}/po/fr.po | 0 .../nivault/plugin-gimp => plugin-gimp}/po/sk.po | 0 .../nivault/plugin-gimp => plugin-gimp}/po/sv.po | 0 plugin-gimp/src/Makefile.am | 28 + .../plugin-gimp => plugin-gimp}/src/build-image.hh | 0 plugin-gimp/src/build-image.hxx | 113 ++ plugin-gimp/src/gimp-image.hh | 588 +++++++ .../plugin-gimp => plugin-gimp}/src/interface.hh | 0 plugin-gimp/src/interface.hxx | 95 ++ plugin-gimp/src/main.cc | 183 +++ plugin-gimp/src/main2.cc | 83 + .../plugin-gimp => plugin-gimp}/src/plugin-intl.hh | 0 plugins/olena.c | 75 + .../demo/scribogimpplugin/AUTHORS | 0 scribo/demo/scribogimpplugin/COPYING | 674 ++++++++ .../demo/scribogimpplugin/ChangeLog | 0 INSTALL => scribo/demo/scribogimpplugin/INSTALL | 0 scribo/demo/scribogimpplugin/Makefile.am | 15 + .../demo/scribogimpplugin/NEWS | 0 .../demo/scribogimpplugin/README | 0 scribo/demo/scribogimpplugin/aclocal.m4 | 1607 ++++++++++++++++++++ scribo/demo/scribogimpplugin/autogen.sh | 188 +++ .../demo/scribogimpplugin/build-aux}/autotroll.mk | 0 scribo/demo/scribogimpplugin/configure.ac | 158 ++ .../demo/scribogimpplugin}/help/Makefile.am | 0 .../demo/scribogimpplugin}/help/en/Makefile.am | 0 .../demo/scribogimpplugin}/help/en/gimp-help.xml | 0 .../demo/scribogimpplugin}/help/en/index.html | 0 .../demo/scribogimpplugin}/help/images/Makefile.am | 0 .../demo/scribogimpplugin}/help/images/wilber.png | Bin 5022 -> 5022 bytes .../demo/scribogimpplugin/m4}/autotroll.m4 | 0 scribo/demo/scribogimpplugin/m4/intltool.m4 | 216 +++ .../demo/scribogimpplugin/m4}/oln-with-lib.m4 | 0 .../demo/scribogimpplugin/po/POTFILES.in | 0 .../demo/scribogimpplugin}/po/az.po | 0 .../demo/scribogimpplugin}/po/de.po | 0 .../demo/scribogimpplugin}/po/fr.po | 0 .../demo/scribogimpplugin}/po/sk.po | 0 .../demo/scribogimpplugin}/po/sv.po | 0 scribo/demo/scribogimpplugin/src/Makefile.am | 75 + .../demo/scribogimpplugin}/src/build-image.hh | 0 scribo/demo/scribogimpplugin/src/build-image.hxx | 103 ++ .../{viewer => scribogimpplugin/src}/config.cc | 0 .../{viewer => scribogimpplugin/src}/config.hh | 0 .../demo/scribogimpplugin/src/general_options.cc | 39 + .../demo/scribogimpplugin/src/general_options.hh | 38 + .../demo/scribogimpplugin/src/general_options.ui | 56 + scribo/demo/scribogimpplugin/src/gimp-image.hh | 471 ++++++ scribo/demo/scribogimpplugin/src/main.cc | 323 ++++ scribo/demo/scribogimpplugin/src/ocr_options.cc | 1 + scribo/demo/scribogimpplugin/src/ocr_options.hh | 1 + scribo/demo/scribogimpplugin/src/ocr_options.ui | 1 + scribo/demo/scribogimpplugin/src/option_widget.cc | 1 + scribo/demo/scribogimpplugin/src/option_widget.hh | 1 + .../scribogimpplugin/src/preferences_dialog.cc | 326 ++++ .../scribogimpplugin/src/preferences_dialog.hh | 70 + .../scribogimpplugin/src/preferences_dialog.ui | 121 ++ scribo/demo/scribogimpplugin/src/preprocess.cc | 1 + scribo/demo/scribogimpplugin/src/preprocess.hh | 1 + .../scribogimpplugin/src/preprocessing_options.cc | 1 + .../scribogimpplugin/src/preprocessing_options.hh | 1 + .../scribogimpplugin/src/preprocessing_options.ui | 1 + scribo/demo/scribogimpplugin/src/process.cc | 1 + scribo/demo/scribogimpplugin/src/process.hh | 1 + scribo/demo/scribogimpplugin/src/runner.cc | 161 ++ scribo/demo/scribogimpplugin/src/runner.hh | 76 + .../scribogimpplugin/src/segmentation_options.cc | 1 + .../scribogimpplugin/src/segmentation_options.hh | 1 + .../scribogimpplugin/src/segmentation_options.ui | 1 + 92 files changed, 6043 insertions(+), 2 deletions(-) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/.gitignore (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/AUTHORS (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/COPYING (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/ChangeLog (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/HACKING (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/INSTALL (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/Makefile.am (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/TODO (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/autogen.sh (100%) create mode 100644 plugin-gimp/configure.ac copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/help/Makefile.am (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/help/en/Makefile.am (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/help/en/gimp-help.xml (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/help/en/index.html (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/help/images/Makefile.am (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/help/images/wilber.png (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/po/ChangeLog (100%) copy milena/doc/outputs/accu-right-instantiation.txt => plugin-gimp/po/POTFILES.in (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/po/az.po (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/po/de.po (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/po/fr.po (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/po/sk.po (100%) copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/po/sv.po (100%) create mode 100644 plugin-gimp/src/Makefile.am copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/src/build-image.hh (100%) create mode 100644 plugin-gimp/src/build-image.hxx create mode 100644 plugin-gimp/src/gimp-image.hh copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/src/interface.hh (100%) create mode 100644 plugin-gimp/src/interface.hxx create mode 100644 plugin-gimp/src/main.cc create mode 100644 plugin-gimp/src/main2.cc copy {milena/sandbox/nivault/plugin-gimp => plugin-gimp}/src/plugin-intl.hh (100%) create mode 100644 plugins/olena.c copy milena/doc/outputs/accu-right-instantiation.txt => scribo/demo/scribogimpplugin/AUTHORS (100%) create mode 100644 scribo/demo/scribogimpplugin/COPYING copy milena/doc/outputs/accu-right-instantiation.txt => scribo/demo/scribogimpplugin/ChangeLog (100%) copy INSTALL => scribo/demo/scribogimpplugin/INSTALL (100%) create mode 100644 scribo/demo/scribogimpplugin/Makefile.am copy milena/doc/outputs/accu-right-instantiation.txt => scribo/demo/scribogimpplugin/NEWS (100%) copy milena/doc/outputs/accu-right-instantiation.txt => scribo/demo/scribogimpplugin/README (100%) create mode 100644 scribo/demo/scribogimpplugin/aclocal.m4 create mode 100755 scribo/demo/scribogimpplugin/autogen.sh copy {build-aux => scribo/demo/scribogimpplugin/build-aux}/autotroll.mk (100%) create mode 100644 scribo/demo/scribogimpplugin/configure.ac copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/help/Makefile.am (100%) copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/help/en/Makefile.am (100%) copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/help/en/gimp-help.xml (100%) copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/help/en/index.html (100%) copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/help/images/Makefile.am (100%) copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/help/images/wilber.png (100%) copy {m4 => scribo/demo/scribogimpplugin/m4}/autotroll.m4 (100%) create mode 100644 scribo/demo/scribogimpplugin/m4/intltool.m4 copy {m4 => scribo/demo/scribogimpplugin/m4}/oln-with-lib.m4 (100%) copy milena/doc/outputs/accu-right-instantiation.txt => scribo/demo/scribogimpplugin/po/POTFILES.in (100%) copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/po/az.po (100%) copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/po/de.po (100%) copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/po/fr.po (100%) copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/po/sk.po (100%) copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/po/sv.po (100%) create mode 100644 scribo/demo/scribogimpplugin/src/Makefile.am copy {milena/sandbox/nivault/plugin-gimp => scribo/demo/scribogimpplugin}/src/build-image.hh (100%) create mode 100644 scribo/demo/scribogimpplugin/src/build-image.hxx copy scribo/demo/{viewer => scribogimpplugin/src}/config.cc (100%) copy scribo/demo/{viewer => scribogimpplugin/src}/config.hh (100%) create mode 100644 scribo/demo/scribogimpplugin/src/general_options.cc create mode 100644 scribo/demo/scribogimpplugin/src/general_options.hh create mode 100644 scribo/demo/scribogimpplugin/src/general_options.ui create mode 100644 scribo/demo/scribogimpplugin/src/gimp-image.hh create mode 100644 scribo/demo/scribogimpplugin/src/main.cc create mode 120000 scribo/demo/scribogimpplugin/src/ocr_options.cc create mode 120000 scribo/demo/scribogimpplugin/src/ocr_options.hh create mode 120000 scribo/demo/scribogimpplugin/src/ocr_options.ui create mode 120000 scribo/demo/scribogimpplugin/src/option_widget.cc create mode 120000 scribo/demo/scribogimpplugin/src/option_widget.hh create mode 100644 scribo/demo/scribogimpplugin/src/preferences_dialog.cc create mode 100644 scribo/demo/scribogimpplugin/src/preferences_dialog.hh create mode 100644 scribo/demo/scribogimpplugin/src/preferences_dialog.ui create mode 120000 scribo/demo/scribogimpplugin/src/preprocess.cc create mode 120000 scribo/demo/scribogimpplugin/src/preprocess.hh create mode 120000 scribo/demo/scribogimpplugin/src/preprocessing_options.cc create mode 120000 scribo/demo/scribogimpplugin/src/preprocessing_options.hh create mode 120000 scribo/demo/scribogimpplugin/src/preprocessing_options.ui create mode 120000 scribo/demo/scribogimpplugin/src/process.cc create mode 120000 scribo/demo/scribogimpplugin/src/process.hh create mode 100644 scribo/demo/scribogimpplugin/src/runner.cc create mode 100644 scribo/demo/scribogimpplugin/src/runner.hh create mode 120000 scribo/demo/scribogimpplugin/src/segmentation_options.cc create mode 120000 scribo/demo/scribogimpplugin/src/segmentation_options.hh create mode 120000 scribo/demo/scribogimpplugin/src/segmentation_options.ui diff --git a/milena/mln/convert/from_to.hxx b/milena/mln/convert/from_to.hxx index 7891e9a..5e1da48 100644 --- a/milena/mln/convert/from_to.hxx +++ b/milena/mln/convert/from_to.hxx @@ -187,6 +187,10 @@ namespace mln template <unsigned m> void from_to_(const value::int_u<m>& from, value::rgb<m>& to); + // rgb8 -> rgb. + template <unsigned m> + void from_to_(const value::rgb<8>& from, value::qt::rgb32& to); + // int_u -> qt::rgb32. template <unsigned m> void from_to_(const value::int_u<m>& from, value::qt::rgb32& to); diff --git a/milena/mln/tag/skeleton.hh b/milena/mln/tag/skeleton.hh index f446317..8af8cd8 100644 --- a/milena/mln/tag/skeleton.hh +++ b/milena/mln/tag/skeleton.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // diff --git a/milena/mln/value/qt/rgb32.hh b/milena/mln/value/qt/rgb32.hh index 511d6a7..38536dd 100644 --- a/milena/mln/value/qt/rgb32.hh +++ b/milena/mln/value/qt/rgb32.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -82,6 +83,10 @@ namespace mln namespace over_load { + // rgb8 -> rgb. + template <unsigned m> + void from_to_(const value::rgb8& from, value::qt::rgb32& to); + // int_u -> rgb. template <unsigned m> void from_to_(const value::int_u<m>& from, value::qt::rgb32& to); @@ -763,6 +768,15 @@ namespace mln namespace over_load { + // rgb8 -> qt::rgb32 + template <unsigned m> + void + from_to_(const value::rgb8& from, value::qt::rgb32& to) + { + to = value::qt::rgb32(from.red(), from.green(), from.blue()); + } + + // int_u -> qt::rgb32 template <unsigned m> void diff --git a/milena/sandbox/nivault/plugin-gimp/.gitignore b/plugin-gimp/.gitignore similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/.gitignore copy to plugin-gimp/.gitignore diff --git a/milena/sandbox/nivault/plugin-gimp/AUTHORS b/plugin-gimp/AUTHORS similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/AUTHORS copy to plugin-gimp/AUTHORS diff --git a/milena/sandbox/nivault/plugin-gimp/COPYING b/plugin-gimp/COPYING similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/COPYING copy to plugin-gimp/COPYING diff --git a/milena/sandbox/nivault/plugin-gimp/ChangeLog b/plugin-gimp/ChangeLog similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/ChangeLog copy to plugin-gimp/ChangeLog diff --git a/milena/sandbox/nivault/plugin-gimp/HACKING b/plugin-gimp/HACKING similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/HACKING copy to plugin-gimp/HACKING diff --git a/milena/sandbox/nivault/plugin-gimp/INSTALL b/plugin-gimp/INSTALL similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/INSTALL copy to plugin-gimp/INSTALL diff --git a/milena/sandbox/nivault/plugin-gimp/Makefile.am b/plugin-gimp/Makefile.am similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/Makefile.am copy to plugin-gimp/Makefile.am diff --git a/milena/sandbox/nivault/plugin-gimp/TODO b/plugin-gimp/TODO similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/TODO copy to plugin-gimp/TODO diff --git a/milena/sandbox/nivault/plugin-gimp/autogen.sh b/plugin-gimp/autogen.sh similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/autogen.sh copy to plugin-gimp/autogen.sh diff --git a/plugin-gimp/configure.ac b/plugin-gimp/configure.ac new file mode 100644 index 0000000..7937d58 --- /dev/null +++ b/plugin-gimp/configure.ac @@ -0,0 +1,125 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.54) + +dnl Name your plug-in here +m4_define([plugin_name], [gimp-plugin-milena]) + +dnl These three define the plug-in version number +m4_define([plugin_major_version], [0]) +m4_define([plugin_minor_version], [1]) + +m4_define([plugin_version], + [plugin_major_version.plugin_minor_version.plugin_micro_version]) + +AC_INIT([plugin_name], [plugin_version]) + +AC_DEFINE(PLUGIN_NAME, PACKAGE_NAME, [Plug-In name]) +AC_DEFINE(PLUGIN_VERSION, PACKAGE_VERSION, [Plug-In version]) + +AC_DEFINE(PLUGIN_MAJOR_VERSION, plugin_major_version, [Plug-In major version]) +AC_DEFINE(PLUGIN_MINOR_VERSION, plugin_minor_version, [Plug-In minor version]) +AC_DEFINE(PLUGIN_MICRO_VERSION, plugin_micro_version, [Plug-In micro version]) + +AC_CONFIG_SRCDIR([src/main.cc]) +AM_CONFIG_HEADER(config.h) + +AM_INIT_AUTOMAKE([no-define foreign]) + +AC_ISC_POSIX +AC_LANG([C++]) +AC_PROG_CXX +#AC_LANG([C]) +#AC_PROG_CC +#AM_PROG_CC_STDC +AC_HEADER_STDC + + +ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + +AM_MAINTAINER_MODE + + +dnl Use -Wall if we have gcc. +changequote(,)dnl +if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wall" ;; + esac +fi +changequote([,])dnl + + +GIMP_REQUIRED_VERSION=2.2.0 + +PKG_CHECK_MODULES(GIMP, + gimp-2.0 >= $GIMP_REQUIRED_VERSION gimpui-2.0 >= $GIMP_REQUIRED_VERSION) + +AC_SUBST(GIMP_CFLAGS) +AC_SUBST(GIMP_LIBS) + +#GIMP_LIBDIR=`$PKG_CONFIG --variable=gimplibdir gimp-2.0` +GIMP_LIBDIR=`echo ~/.gimp-2.4` +AC_SUBST(GIMP_LIBDIR) + + +dnl i18n stuff + +GETTEXT_PACKAGE=gimp20-plugin-template +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", + [The gettext translation domain.]) + +dnl Add the languages which your application supports here. +ALL_LINGUAS="az de fr sk sv zh_TW" + +AC_PROG_INTLTOOL +AM_GLIB_GNU_GETTEXT + +AC_CHECK_FUNCS(bind_textdomain_codeset) + +LOCALEDIR='${datadir}/locale' +DATADIR='${datadir}/plugin_name' + +AC_SUBST(LOCALEDIR) +AC_SUBST(DATADIR) + + +AC_MSG_CHECKING([if GTK+ is version 2.7.0 or newer]) +if $PKG_CONFIG --atleast-version=2.7.0 gtk+-2.0; then + have_gtk_2_7=yes +else + have_gtk_2_7=no +fi +AC_MSG_RESULT($have_gtk_2_7) + +if test "x$have_gtk_2_7" != "xyes"; then + CPPFLAGS="$CPPFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" +fi + + +AC_MSG_CHECKING([if GIMP is version 2.3.0 or newer]) +if $PKG_CONFIG --atleast-version=2.3.0 gimp-2.0; then + have_gimp_2_3=yes +else + have_gimp_2_3=no +fi +AC_MSG_RESULT($have_gimp_2_3) + +if test "x$have_gimp_2_3" != "xyes"; then + CPPFLAGS="$CPPFLAGS -DGIMP_DISABLE_DEPRECATED" +fi + + + +AC_CONFIG_FILES([ +Makefile +po/Makefile.in +src/Makefile +help/Makefile +help/en/Makefile +help/images/Makefile +]) + +AC_OUTPUT diff --git a/milena/sandbox/nivault/plugin-gimp/help/Makefile.am b/plugin-gimp/help/Makefile.am similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/Makefile.am copy to plugin-gimp/help/Makefile.am diff --git a/milena/sandbox/nivault/plugin-gimp/help/en/Makefile.am b/plugin-gimp/help/en/Makefile.am similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/en/Makefile.am copy to plugin-gimp/help/en/Makefile.am diff --git a/milena/sandbox/nivault/plugin-gimp/help/en/gimp-help.xml b/plugin-gimp/help/en/gimp-help.xml similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/en/gimp-help.xml copy to plugin-gimp/help/en/gimp-help.xml diff --git a/milena/sandbox/nivault/plugin-gimp/help/en/index.html b/plugin-gimp/help/en/index.html similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/en/index.html copy to plugin-gimp/help/en/index.html diff --git a/milena/sandbox/nivault/plugin-gimp/help/images/Makefile.am b/plugin-gimp/help/images/Makefile.am similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/images/Makefile.am copy to plugin-gimp/help/images/Makefile.am diff --git a/milena/sandbox/nivault/plugin-gimp/help/images/wilber.png b/plugin-gimp/help/images/wilber.png similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/images/wilber.png copy to plugin-gimp/help/images/wilber.png diff --git a/milena/sandbox/nivault/plugin-gimp/po/ChangeLog b/plugin-gimp/po/ChangeLog similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/ChangeLog copy to plugin-gimp/po/ChangeLog diff --git a/milena/doc/outputs/accu-right-instantiation.txt b/plugin-gimp/po/POTFILES.in similarity index 100% copy from milena/doc/outputs/accu-right-instantiation.txt copy to plugin-gimp/po/POTFILES.in diff --git a/milena/sandbox/nivault/plugin-gimp/po/az.po b/plugin-gimp/po/az.po similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/az.po copy to plugin-gimp/po/az.po diff --git a/milena/sandbox/nivault/plugin-gimp/po/de.po b/plugin-gimp/po/de.po similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/de.po copy to plugin-gimp/po/de.po diff --git a/milena/sandbox/nivault/plugin-gimp/po/fr.po b/plugin-gimp/po/fr.po similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/fr.po copy to plugin-gimp/po/fr.po diff --git a/milena/sandbox/nivault/plugin-gimp/po/sk.po b/plugin-gimp/po/sk.po similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/sk.po copy to plugin-gimp/po/sk.po diff --git a/milena/sandbox/nivault/plugin-gimp/po/sv.po b/plugin-gimp/po/sv.po similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/sv.po copy to plugin-gimp/po/sv.po diff --git a/plugin-gimp/src/Makefile.am b/plugin-gimp/src/Makefile.am new file mode 100644 index 0000000..fc30a5a --- /dev/null +++ b/plugin-gimp/src/Makefile.am @@ -0,0 +1,28 @@ +## Process this file with automake to produce Makefile.in + +bin_PROGRAMS = milena + +bindir = $(GIMP_LIBDIR)/plug-ins + +INCS = build-image.hh \ + build-image.hxx \ + gimp-image.hh \ + plugin-intl.hh \ + interface.hxx \ + interface.hh + +milena_SOURCES = main.cc \ + $(INCS) + +milena_CPPFLAGS = \ + -DLOCALEDIR=\""$(LOCALEDIR)"\" \ + -DDATADIR=\""$(DATADIR)"\" \ + -I$(top_srcdir) \ + -I$(OLN)/milena \ + @GIMP_CFLAGS@ \ + -I$(includedir) \ + +CXXFLAGS = -g -O0 + +LDADD = $(GIMP_LIBS) + diff --git a/milena/sandbox/nivault/plugin-gimp/src/build-image.hh b/plugin-gimp/src/build-image.hh similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/src/build-image.hh copy to plugin-gimp/src/build-image.hh diff --git a/plugin-gimp/src/build-image.hxx b/plugin-gimp/src/build-image.hxx new file mode 100644 index 0000000..c4092d3 --- /dev/null +++ b/plugin-gimp/src/build-image.hxx @@ -0,0 +1,113 @@ +/* GIMP Plug-in Template + * Copyright (C) 2000-2004 Michael Natterer <mitch@gimp.org> (the "Author"). + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the Author of the + * Software shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the Author. + */ + +#include "build-image.hh" + +typedef mln::gimp_image<GIMP_RGB_IMAGE> I; + +static I ima; + +const I& get_ima() +{ + return ima; +} + +struct toto : mln::Function_v2v<toto> +{ + typedef mln::value::rgb8 result; + mln::value::rgb8 operator()(const mln::value::rgb8& c) const + { + return mln::value::rgb8(255 - c.red(), 255 - c.green(), 255 - c.blue()); + } +}; + +void build_milena_image(GimpPixelRgn *in, + GimpPixelRgn *out) +{ + (void) out; + I tmp(in); +// g_message(region->dirty ? "saaale" : "pas saaale"); +// g_message(region->shadow ? "shadoooow" : "pas shadoooow"); + ima = tmp; + + mln_piter_(I) p(ima.domain()); + for_all(p) + std::cout << "."; + std::cout << std::endl; + + mln::point2d p1(0,0); + mln::point2d p2(0,5); + mln::point2d p3(20,50); +// mln::io::ppm::save(ima, "/goinfre/out.ppm"); + std::cout << p1 << " : " << ima(p1) << std::endl; + std::cout << p2 << " : " << ima(p2) << std::endl; + std::cout << p3 << " : " << ima(p3) << std::endl; +// mln::data::fill(ima, mln::literal::blue); + + // toto fun; + // mln::image2d<mln::value::rgb8> + // tmp2 = mln::data::transform(ima, fun); + // mln::border::resize(tmp2, 0); + + // gimp_pixel_rgn_set_rect(out, + // (const guchar *) ima.buffer(), + // 0, + // 0, + // out->w, + // out->h); + + // gimp_drawable_flush (out->drawable); + // gimp_drawable_merge_shadow (out->drawable->drawable_id, TRUE); +} + +gboolean draw_milena_image(GtkWidget* area, + GdkEventExpose *event, + gpointer data) +{ + (void) event; + (void) data; + + GimpDrawable* drawable = gimp_drawable_preview_get_drawable((GimpDrawablePreview *)area); + assert(drawable != NULL); + GimpPixelRgn region; + std::stringstream ss; + gimp_pixel_rgn_init(®ion, + drawable, + 0, + 0, + drawable->width, + drawable->height, + FALSE, + FALSE); + +// gimp_pixel_rgn_set_rect(®ion, +// (const guchar *) ima.buffer(), +// 0, +// 0, +// drawable->width, +// drawable->height); +} diff --git a/plugin-gimp/src/gimp-image.hh b/plugin-gimp/src/gimp-image.hh new file mode 100644 index 0000000..be0fd4f --- /dev/null +++ b/plugin-gimp/src/gimp-image.hh @@ -0,0 +1,588 @@ +// Copyright (C) 2007, 2011 EPITA Research and Development Laboratory +// +// This file is part of the Milena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef __IMAGEGIMP_HH__ +# define __IMAGEGIMP_HH__ + +# include <libgimp/gimp.h> +# include <libgimp/gimpui.h> + +# include <mln/core/concept/proxy.hh> +# include <mln/core/internal/image_primary.hh> + +# include <mln/core/alias/box2d.hh> +# include <mln/value/set.hh> +# include <mln/value/rgb8.hh> +# include <mln/value/int_u8.hh> +# include <mln/literal/all.hh> + +# include <iostream> +# include <sstream> + +namespace mln +{ + + // Fwd decl. + template <GimpImageType TI> struct gimp_image; + + template <typename T1, typename T2> + struct my_shell + : public Proxy< my_shell<T1,T2> >, + public mln::internal::proxy_impl< T1, my_shell<T1,T2> > + { + // Equiv + typedef T1 equiv; + + T1 subj_() + { + return val_; + } + + my_shell(GimpPixelRgn* rgn, const point2d& p) + : rgn_(rgn), p_(p) + { + gimp_pixel_rgn_get_pixel(rgn_, + (guchar *) &val_, + p_.col(), p_.row()); + } + + my_shell<T1, T2>& operator=(const T1& nval) + { + val_ = nval; + gimp_pixel_rgn_set_pixel(rgn_, + (guchar *) &val_, + p_.col(), p_.row()); + } + + + T1 val_; + GimpPixelRgn* rgn_; + point2d p_; + + }; + + namespace internal + { + + /// Trait that give mln type from gimp value tag. + template <GimpImageType TI> + struct gimp_value_tag_to_mln + { + typedef void type; + }; + + template <> + struct gimp_value_tag_to_mln<GIMP_RGB_IMAGE> + { + typedef value::rgb8 type; + }; + + template <> + struct gimp_value_tag_to_mln<GIMP_GRAY_IMAGE> + { + typedef value::int_u8 type; + }; + + + template <GimpImageType TI> + struct data< gimp_image<TI> > + { + typedef typename internal::gimp_value_tag_to_mln<TI>::type T; + + /// Constructor. + /// { + data(GimpPixelRgn* rgn); + /// } + + /// Destructor. + ~data(); + + /// Gimp region. + GimpPixelRgn* rgn_; + + guchar *rdata_; + + // Columns pointers + //guchar** array_; + + /// theoretical box + box2d b_; + }; + + } // end of namespace mln::internal + + namespace trait + { + + template <GimpImageType TI> + struct image_< gimp_image<TI> > : default_image_< mln::value::rgb8, gimp_image<TI> > + { + // misc + typedef trait::image::category::primary category; + typedef trait::image::speed::fast speed; + typedef trait::image::size::regular size; + + // value + typedef trait::image::vw_io::none vw_io; + typedef trait::image::vw_set::none vw_set; + typedef trait::image::value_access::computed value_access; + typedef trait::image::value_storage::one_block value_storage; + typedef trait::image::value_browsing::site_wise_only value_browsing; + typedef trait::image::value_alignment::with_grid value_alignment; + typedef trait::image::value_io::read_write value_io; + + + // site / domain + typedef trait::image::pw_io::read_write pw_io; + typedef trait::image::localization::basic_grid localization; + typedef trait::image::dimension::two_d dimension; + + // extended domain + typedef trait::image::ext_domain::none ext_domain; + typedef trait::image::ext_value::multiple ext_value; + typedef trait::image::ext_io::read_only ext_io; + }; + + } // end of namespace mln::trait + + + + /*! \brief Basic 2D image class. + * + */ + template <GimpImageType TI> + struct gimp_image + : public internal::image_primary<typename internal::gimp_value_tag_to_mln<TI>::type, + box2d, gimp_image<TI> > + { + typedef internal::image_primary<typename internal::gimp_value_tag_to_mln<TI>::type, + box2d, gimp_image<TI> > super_; + + // Warning: just to make effective types appear in Doxygen: + typedef box2d pset; + typedef point2d psite; + typedef point2d point; + typedef dpoint2d dpoint; + typedef mln_fwd_piter(box2d) fwd_piter; + typedef mln_bkd_piter(box2d) bkd_piter; + // End of warning. + + typedef typename internal::gimp_value_tag_to_mln<TI>::type T; + + /// Value associated type. + typedef T value; + + /// Return type of read-only access. + typedef my_shell<T,guchar> rvalue; + + /// Return type of read-write access. + typedef my_shell<T,guchar> lvalue; + + + /// Skeleton. + typedef gimp_image<TI> skeleton; + + + /// Value_Set associated type. + typedef mln::value::set<value> vset; + + + /// Constructor without argument. + gimp_image(); + + /// Constructor with a gimp region. + gimp_image(GimpPixelRgn* rgn); + + /// Constructor with a box2d. + gimp_image(box2d box); + + /// Constructor with with the numbers of rows and columns. + gimp_image(int nrows, int ncols); + + /// Initialise an image from a gimp region. + void init_(GimpPixelRgn* rgn); + + // /// Initialise an image from a box2d. + // void init_(box2d box); + + /// Test if \p p is valid. + bool has(const point2d& p) const; + + /// Give the set of values of the image. + const vset& values() const; + + /// Give the definition domain. + const box2d& domain() const; + + /// const-only access to the image value located at point \p p. + rvalue operator()(const point& p) const; + + /// Read-write access to the image value located at point \p p. + lvalue operator()(const point& p); + + + // As a fastest image: + // ------------------- + + // // Give the index of a point. + // unsigned index_of_point(const point& p) const; + + + /// Give the border thickness. + unsigned border() const; + + /// Give the number of elements (points including border ones). + unsigned nelements() const; + + /// Read-only access to the image value located at index \p i. + rvalue element(unsigned i) const; + + /// Read-write access to the image value located at index \p i. + lvalue element(unsigned i); + + /// Give the delta-index corresponding to the delta-point \p dp. + int delta_index(const dpoint2d& dp) const; + + // /// Give the point corresponding to the index \p i. + // point2d point_at_index(unsigned i) const; + + /// Give a hook to the value buffer. + const guchar* buffer() const; + + /// Give a hook to the value buffer. + guchar* buffer(); + + + /// Gimp Image method + + /// Give a hook to the GimpPixelRgn. + GimpPixelRgn* gimp_region(); + + /// Give a hook to the GimpDrawable. + GimpDrawable* gimp_drawable(); + }; + + +# ifndef MLN_INCLUDE_ONLY + + namespace internal + { + + template <GimpImageType TI> + data< gimp_image<TI> >::data(GimpPixelRgn* rgn) + : rgn_(rgn) + { + mln_assertion(rgn != NULL); + + rgn_ = rgn; + + rdata_ = rgn->data; + mln_assertion(rdata_ != 0); + + // unsigned + // nr = b_.height(), + // nc = b_.width(); + // array_ = new guchar*[nc]; + // guchar* buf = rgn_->data; + // for (unsigned i = 0; i < nc; ++i) + // { + // array_[i] = buf; + // buf += nr * sizeof(T); + // } + + b_ = make::box2d(rgn->y, rgn->x, + rgn->y + rgn->h - 1, + rgn->x + rgn->w - 1); + } + + template <GimpImageType TI> + data< gimp_image<TI> >::~data() + { + // FIXME : Flush! + } + + } // end of namespace mln::internal + + // gimp_image<TI> + + + template <GimpImageType TI> + gimp_image<TI>::gimp_image() + { + } + + template <GimpImageType TI> + gimp_image<TI>::gimp_image(GimpPixelRgn* rgn) + { + init_(rgn); + gimp_tile_cache_ntiles(3 * (this->data_->rgn_->w / gimp_tile_width())); + } + + template <GimpImageType TI> + void + gimp_image<TI>::init_(GimpPixelRgn* rgn) + { + this->data_ = new internal::data< gimp_image<TI> >(rgn); + } + + template <GimpImageType TI> + const box2d& + gimp_image<TI>::domain() const + { + mln_precondition(this->is_valid()); + return this->data_->b_; + } + + // template <GimpImageType TI> + // unsigned + // gimp_image<TI>::index_of_point(const point& p) const + // { + // mln_precondition(this->is_valid()); + // mln_precondition(this->has(p)); + + // unsigned i = (this->operator()(p).address_() - this->buffer()) / sizeof(T); + // mln_postcondition(p == this->point_at_index(i)); + // return i; + // } + + + template <GimpImageType TI> + unsigned + gimp_image<TI>::border() const + { + return 0; + } + + template <GimpImageType TI> + unsigned + gimp_image<TI>::nelements() const + { + mln_precondition(this->is_valid()); + return this->data_->b_.nsites(); + } + + // template <GimpImageType TI> + // inline + // typename gimp_image<TI>::rvalue + // gimp_image<TI>::element(unsigned i) const + // { + // mln_precondition(i < nelements()); + // return rvalue(this->data_->rdata_ + 3 * i); + // } + + // template <GimpImageType TI> + // inline + // typename gimp_image<TI>::lvalue + // gimp_image<TI>::element(unsigned i) + // { + // mln_precondition(i < nelements()); + // return lvalue(this->data_->rdata_ + 3 * i); + // } + + + template <GimpImageType TI> + bool + gimp_image<TI>::has(const point2d& p) const + { + mln_precondition(this->is_valid()); + return this->data_->b_.has(p); + } + + template <GimpImageType TI> + typename gimp_image<TI>::rvalue + gimp_image<TI>::operator()(const point& p) const + { + mln_precondition(this->has(p)); + // return rvalue(&this->data_->array_[p.col()][p.row() * 3]); + // return rvalue(this->data_->rdata_ + 3 * (p.row() * this->data_->b_.width() + p.col())); + // static T c; + // gimp_pixel_rgn_get_pixel(this->data_->rgn_, + // (guchar *) &c, + // p.col(), p.row()); + // return c; + return rvalue(this->data_->rgn_, p); + } + + template <GimpImageType TI> + typename gimp_image<TI>::lvalue + gimp_image<TI>::operator()(const point& p) + { + mln_precondition(this->has(p)); + return rvalue(this->data_->rgn_, p); +// return lvalue(&this->data_->array_[p.col()][p.row() * 3]); + //return rvalue(this->data_->rdata_ + 3 * (p.row() * this->data_->b_.width() + p.col())); + } + + // template <GimpImageType TI> + // inline + // int + // gimp_image<TI>::delta_index(const dpoint2d& dp) const + // { + // mln_precondition(this->is_valid()); + // int o = dp[0] * this->data_->b_.width() * 3 + dp[1] * 3; + // return o; + // } + + // template <GimpImageType TI> + // inline + // point2d + // gimp_image<TI>::point_at_index(unsigned i) const + // { + // mln_precondition(i < nelements()); + // def::coord + // row = static_cast<def::coord>(i / this->data_->b_.height() + this->data_->b_.min_col()), + // col = static_cast<def::coord>(i % this->data_->b_.height() + this->data_->b_.min_row()); + // point2d p = point2d(row, col); + // mln_postcondition(this->operator()(p).address_() == this->data_->rdata_ + sizeof(T) * i); + // return p; + // } + + // template <GimpImageType TI> + // const guchar* + // gimp_image<TI>::buffer() const + // { + // return this->data_->rdata_; + // } + + + // template <GimpImageType TI> + // guchar* + // gimp_image<TI>::buffer() + // { + // return this->data_->rdata_; + // } + + + template <GimpImageType TI> + GimpPixelRgn* + gimp_image<TI>::gimp_region() + { + return this->data_->rgn_; + } + + template <GimpImageType TI> + GimpDrawable* + gimp_image<TI>::gimp_drawable() + { + return this->data_->rgn_->drawable; + } + + +# endif // ! MLN_INCLUDE_ONLY + +} // end of namespace mln + + + +# include <mln/core/trait/pixter.hh> +# include <mln/core/dpoints_pixter.hh> +# include <mln/core/pixter2d.hh> +# include <mln/core/w_window.hh> + + +namespace mln +{ + + namespace trait + { + + // pixter + + + template <GimpImageType TI> + struct fwd_pixter< gimp_image<TI> > + { + typedef fwd_pixter2d< gimp_image<TI> > ret; + }; + + + template <GimpImageType TI> + struct fwd_pixter< const gimp_image<TI> > + { + typedef fwd_pixter2d< const gimp_image<TI> > ret; + }; + + + template <GimpImageType TI> + struct bkd_pixter< gimp_image<TI> > + { + typedef bkd_pixter2d< gimp_image<TI> > ret; + }; + + + template <GimpImageType TI> + struct bkd_pixter< const gimp_image<TI> > + { + typedef bkd_pixter2d< const gimp_image<TI> > ret; + }; + + // qixter + + template <typename W, GimpImageType TI> + struct fwd_qixter< gimp_image<TI>, W > + { + typedef dpoints_fwd_pixter< gimp_image<TI> > ret; + }; + + template <typename W, GimpImageType TI> + struct fwd_qixter< const gimp_image<TI>, W > + { + typedef dpoints_fwd_pixter< const gimp_image<TI> > ret; + }; + + template <typename W, GimpImageType TI> + struct bkd_qixter< gimp_image<TI>, W > + { + typedef mln::internal::fixme ret; + }; + + // nixter + + template <typename N, GimpImageType TI> + struct fwd_nixter< gimp_image<TI>, N > + { + typedef dpoints_fwd_pixter< gimp_image<TI> > ret; + }; + + template <typename N, GimpImageType TI> + struct fwd_nixter< const gimp_image<TI>, N > + { + typedef dpoints_fwd_pixter< const gimp_image<TI> > ret; + }; + + template <typename N, GimpImageType TI> + struct bkd_nixter< gimp_image<TI>, N > + { + typedef mln::internal::fixme ret; + }; + + } // end of namespace mln::trait + +} // end of namespace mln + + +#endif // ! __GIMP_IMAGE_HH__ diff --git a/milena/sandbox/nivault/plugin-gimp/src/interface.hh b/plugin-gimp/src/interface.hh similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/src/interface.hh copy to plugin-gimp/src/interface.hh diff --git a/plugin-gimp/src/interface.hxx b/plugin-gimp/src/interface.hxx new file mode 100644 index 0000000..a092302 --- /dev/null +++ b/plugin-gimp/src/interface.hxx @@ -0,0 +1,95 @@ +/* GIMP Plug-in Template + * Copyright (C) 2000-2004 Michael Natterer <mitch@gimp.org> (the "Author"). + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the Author of the + * Software shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the Author. + */ + +#include "config.h" + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "interface.hh" + +#include "plugin-intl.hh" + + +/* Constants */ + +#define SCALE_WIDTH 180 +#define SPIN_BUTTON_WIDTH 75 +#define RANDOM_SEED_WIDTH 100 + +/* Give access to drawing areas */ +static GtkWidget *drawing_area = NULL; + +/* Public functions */ + +gboolean +dialog (gint32 image_ID, + GimpDrawable *drawable) +{ + GtkWidget *dlg; + GtkWidget *main_vbox; + GtkWidget *frame; + GimpRGB color; + + (void) image_ID; + + gimp_ui_init (PLUGIN_NAME, TRUE); + + dlg = gimp_dialog_new (_("Milena toolbox !"), PLUGIN_NAME, + NULL, (GtkDialogFlags)0, + gimp_standard_help_func, "plug-in-milena", NULL); + + main_vbox = gtk_vbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), main_vbox); + + /* + ** Image Layout. + */ + + frame = gimp_frame_new (_("Display box :")); + gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + gimp_rgb_set(&color, 0, 0, 0); + + drawing_area = gimp_drawable_preview_new(drawable, NULL); + gtk_container_add (GTK_CONTAINER (frame), drawing_area); + + gtk_widget_set_size_request(drawing_area, + 500, + 500); +// draw_milena_image(drawing_area, NULL, 0); + gtk_widget_show (drawing_area); + + gtk_widget_show (main_vbox); + gtk_widget_show (dlg); + + gimp_dialog_run (GIMP_DIALOG (dlg)); + gtk_widget_destroy (dlg); + + return TRUE; +} diff --git a/plugin-gimp/src/main.cc b/plugin-gimp/src/main.cc new file mode 100644 index 0000000..7af1ffa --- /dev/null +++ b/plugin-gimp/src/main.cc @@ -0,0 +1,183 @@ +/* GIMP Plug-in Template + * Copyright (C) 2000 Michael Natterer <mitch@gimp.org> (the "Author"). + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the Author of the + * Software shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the Author. + */ + +#include "config.h" + +#include <string.h> +#include <stdio.h> + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "interface.hh" + +#include "plugin-intl.hh" + +#include "build-image.hh" + +/* Constants */ + +#define PROCEDURE_NAME "milena" + +/* Local function prototypes */ + +static void query (void); +static void run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); + + +GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + query, /* query_proc */ + run, /* run_proc */ +}; + +int main(int argc, char **argv) +{ + int result; + getchar(); + result = gimp_main(&PLUG_IN_INFO, argc, argv); + return result; +} + + +static void +query (void) +{ + static GimpParamDef args[] = + { + { GIMP_PDB_INT32, (gchar *)"run_mode", (gchar *)"Interactive, non-interactive" }, + { GIMP_PDB_IMAGE, (gchar *)"image", (gchar *)"Input image" }, + { GIMP_PDB_DRAWABLE, (gchar *)"drawable", (gchar *)"Input drawable" } + }; + + gimp_install_procedure (PROCEDURE_NAME, + "Milena", + "Perform many image processing using Milena library", + "Olena Team <olena@lrde.epita.fr>", + "EPITA Research and Development Laboratory (LRDE)", + "2007-2011", + N_("Milena toolbox..."), + "RGB*, GRAY*, INDEXED*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); + + gimp_plugin_menu_register (PROCEDURE_NAME, "<Image>/Filters/Milena"); +} + +static void +run (const gchar *name, + gint n_params, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals) +{ + (void) name; + (void) n_params; + + static GimpParam values[1]; + GimpDrawable *drawable; + GimpPixelRgn in, out; + gint32 image_ID; + gint x1, y1, x2, y2; + gint width, height; + GimpRunMode run_mode; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; + + *nreturn_vals = 1; + *return_vals = values; + + run_mode = (GimpRunMode) param[0].data.d_int32; + image_ID = param[1].data.d_int32; + drawable = gimp_drawable_get (param[2].data.d_drawable); + + gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2); + + width = drawable->width; + height = drawable->height; + + gimp_pixel_rgn_init(&out, drawable, 0, 0, width, height, TRUE, TRUE); + gimp_pixel_rgns_register(1, &out); + + std::cout << "Run - with data: " << out.data << std::endl; + + I tmp(&out); + + //mln::data::fill(tmp, mln::literal::black); + // mln_piter_(I) p(tmp.domain()); + // for_all(p) + // tmp(p) = mln::value::rgb8(0, 0, 0); + + tmp(mln::point2d(0,0)) = mln::value::rgb8(0, 255, 0); + tmp(mln::point2d(1,0)) = mln::value::rgb8(0, 255, 0); + tmp(mln::point2d(0,1)) = mln::value::rgb8(0, 255, 0); + tmp(mln::point2d(1,1)) = mln::value::rgb8(0, 255, 0); + + mln::io::ppm::save(tmp, "/tmp/gimp_image.ppm"); + // std::cout << "."; + // std::cout << std::endl; + + + // build_milena_image(&in, & out); + + // if (strcmp (name, PROCEDURE_NAME) == 0) + // { + // switch (run_mode) + // { + // case GIMP_RUN_NONINTERACTIVE: + // break; + + // case GIMP_RUN_INTERACTIVE: + // dialog (image_ID, drawable); + // break; + + // case GIMP_RUN_WITH_LAST_VALS: + // break; + + // default: + // break; + // } + // } + // else + // { + // status = GIMP_PDB_CALLING_ERROR; + // } + + // gimp_drawable_update (drawable->drawable_id, x1, y1, (x2 - x1), (y2 - y1)); + + // gimp_displays_flush (); + // gimp_drawable_detach (drawable); + + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = status; +} diff --git a/plugin-gimp/src/main2.cc b/plugin-gimp/src/main2.cc new file mode 100644 index 0000000..4859bb2 --- /dev/null +++ b/plugin-gimp/src/main2.cc @@ -0,0 +1,83 @@ +/* GIMP Plug-in Template + * Copyright (C) 2000 Michael Natterer <mitch@gimp.org> (the "Author"). + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the Author of the + * Software shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the Author. + */ + +#include "config.h" + +#include <string.h> + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "interface.hh" + +#include "plugin-intl.hh" + +#include "build-image.hh" + + + +int main(int argc, char *argv[]) +{ + + // Gimp* g = gimp_new("Gimp", "test", false, true, true, + // true, true, true, + // GIMP_STACK_TRACE_QUERY, GIMP_PDB_COMPAT_ON); + + int width = 50, height = 50; + + gint32 new_image_id = gimp_image_new(width, + height, + GIMP_RGB); + /* create new layer */ + gint32 new_layer_id = gimp_layer_new(new_image_id, + "titi", + width, height, + GIMP_RGB_IMAGE, + 100, + GIMP_NORMAL_MODE); + gimp_image_add_layer(new_image_id, new_layer_id, 0); + GimpDrawable *new_drawable = gimp_drawable_get(new_layer_id); + GimpPixelRgn new_region; + gint32 x1, y1, x2, y2; + gimp_pixel_rgn_init(&new_region, new_drawable, x1, y1, x2, y2, TRUE, TRUE); + + I tmp(&new_region); + mln_piter_(I) p(tmp.domain()); + for_all(p) + tmp(p) = mln::value::rgb8(255, 0, 0); + + mln::io::ppm::save(tmp, "/tmp/gimp_image.ppm"); + + gimp_drawable_flush(new_drawable); + gimp_drawable_merge_shadow(new_drawable->drawable_id, TRUE); + gimp_drawable_update(new_drawable->drawable_id, x1, y1, x2, y2); + gimp_drawable_detach(new_drawable); + + /* free buffer */ + gimp_displays_flush(); + +} diff --git a/milena/sandbox/nivault/plugin-gimp/src/plugin-intl.hh b/plugin-gimp/src/plugin-intl.hh similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/src/plugin-intl.hh copy to plugin-gimp/src/plugin-intl.hh diff --git a/plugins/olena.c b/plugins/olena.c new file mode 100644 index 0000000..f189e1b --- /dev/null +++ b/plugins/olena.c @@ -0,0 +1,75 @@ +#include <libgimp/gimp.h> + +static void query (void) +{ + static GimpParamDef args[] = { + { + GIMP_PDB_INT32, + "run-mode", + "Run mode" + }, + { + GIMP_PDB_IMAGE, + "image", + "Input image" + }, + { + GIMP_PDB_DRAWABLE, + "drawable", + "Input drawable" + } + }; + + gimp_install_procedure ( + "Olena-plugin", + "Document Layout analysis", + "Find different blocks of a document.", + "Olena Team", + "Copyright EPITA/LRDE", + "2011", + "_Analyse Layout...", + "RGB*, GRAY*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); + + gimp_plugin_menu_register ("Olena-plugin", + "<Image>/Olena/Scribo/"); +} + + +static void +run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals) +{ + static GimpParam values[1]; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; + GimpRunMode run_mode; + + /* Setting mandatory output values */ + *nreturn_vals = 1; + *return_vals = values; + + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = status; + + /* Getting run_mode - we won't display a dialog if + * we are in NONINTERACTIVE mode */ + run_mode = param[0].data.d_int32; + + if (run_mode != GIMP_RUN_NONINTERACTIVE) + g_message("Hello, world!\n"); +} + + +GimpPlugInInfo PLUG_IN_INFO = { + NULL, //init + NULL, //quit + query, + run +}; + +MAIN() diff --git a/milena/doc/outputs/accu-right-instantiation.txt b/scribo/demo/scribogimpplugin/AUTHORS similarity index 100% copy from milena/doc/outputs/accu-right-instantiation.txt copy to scribo/demo/scribogimpplugin/AUTHORS diff --git a/scribo/demo/scribogimpplugin/COPYING b/scribo/demo/scribogimpplugin/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/scribo/demo/scribogimpplugin/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/milena/doc/outputs/accu-right-instantiation.txt b/scribo/demo/scribogimpplugin/ChangeLog similarity index 100% copy from milena/doc/outputs/accu-right-instantiation.txt copy to scribo/demo/scribogimpplugin/ChangeLog diff --git a/INSTALL b/scribo/demo/scribogimpplugin/INSTALL similarity index 100% copy from INSTALL copy to scribo/demo/scribogimpplugin/INSTALL diff --git a/scribo/demo/scribogimpplugin/Makefile.am b/scribo/demo/scribogimpplugin/Makefile.am new file mode 100644 index 0000000..6e1366c --- /dev/null +++ b/scribo/demo/scribogimpplugin/Makefile.am @@ -0,0 +1,15 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = po src help + +EXTRA_DIST = \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in + +DISTCLEANFILES = \ + intltool-extract \ + intltool-merge \ + intltool-update + +ACLOCAL_AMFLAGS = -I m4 \ No newline at end of file diff --git a/milena/doc/outputs/accu-right-instantiation.txt b/scribo/demo/scribogimpplugin/NEWS similarity index 100% copy from milena/doc/outputs/accu-right-instantiation.txt copy to scribo/demo/scribogimpplugin/NEWS diff --git a/milena/doc/outputs/accu-right-instantiation.txt b/scribo/demo/scribogimpplugin/README similarity index 100% copy from milena/doc/outputs/accu-right-instantiation.txt copy to scribo/demo/scribogimpplugin/README diff --git a/scribo/demo/scribogimpplugin/aclocal.m4 b/scribo/demo/scribogimpplugin/aclocal.m4 new file mode 100644 index 0000000..a61dd00 --- /dev/null +++ b/scribo/demo/scribogimpplugin/aclocal.m4 @@ -0,0 +1,1607 @@ +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, +[m4_warning([this file was generated for autoconf 2.67. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# Copyright (C) 1995-2002 Free Software Foundation, Inc. +# Copyright (C) 2001-2003,2004 Red Hat, Inc. +# +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# +# Macro to add for using GNU gettext. +# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996 +# +# Modified to never use included libintl. +# Owen Taylor <otaylor@redhat.com>, 12/15/1998 +# +# Major rework to remove unused code +# Owen Taylor <otaylor@redhat.com>, 12/11/2002 +# +# Added better handling of ALL_LINGUAS from GNU gettext version +# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002 +# +# Modified to require ngettext +# Matthias Clasen <mclasen@redhat.com> 08/06/2004 +# +# We need this here as well, since someone might use autoconf-2.5x +# to configure GLib then an older version to configure a package +# using AM_GLIB_GNU_GETTEXT +AC_PREREQ(2.53) + +dnl +dnl We go to great lengths to make sure that aclocal won't +dnl try to pull in the installed version of these macros +dnl when running aclocal in the glib directory. +dnl +m4_copy([AC_DEFUN],[glib_DEFUN]) +m4_copy([AC_REQUIRE],[glib_REQUIRE]) +dnl +dnl At the end, if we're not within glib, we'll define the public +dnl definitions in terms of our private definitions. +dnl + +# GLIB_LC_MESSAGES +#-------------------- +glib_DEFUN([GLIB_LC_MESSAGES], + [AC_CHECK_HEADERS([locale.h]) + if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your <locale.h> file defines LC_MESSAGES.]) + fi + fi]) + +# GLIB_PATH_PROG_WITH_TEST +#---------------------------- +dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +glib_DEFUN([GLIB_PATH_PROG_WITH_TEST], +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +# GLIB_WITH_NLS +#----------------- +glib_DEFUN([GLIB_WITH_NLS], + dnl NLS is obligatory + [USE_NLS=yes + AC_SUBST(USE_NLS) + + gt_cv_have_gettext=no + + CATOBJEXT=NONE + XGETTEXT=: + INTLLIBS= + + AC_CHECK_HEADER(libintl.h, + [gt_cv_func_dgettext_libintl="no" + libintl_extra_libs="" + + # + # First check in libc + # + AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc, + [AC_TRY_LINK([ +#include <libintl.h> +], + [return !ngettext ("","", 1)], + gt_cv_func_ngettext_libc=yes, + gt_cv_func_ngettext_libc=no) + ]) + + if test "$gt_cv_func_ngettext_libc" = "yes" ; then + AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, + [AC_TRY_LINK([ +#include <libintl.h> +], + [return !dgettext ("","")], + gt_cv_func_dgettext_libc=yes, + gt_cv_func_dgettext_libc=no) + ]) + fi + + if test "$gt_cv_func_ngettext_libc" = "yes" ; then + AC_CHECK_FUNCS(bind_textdomain_codeset) + fi + + # + # If we don't have everything we want, check in libintl + # + if test "$gt_cv_func_dgettext_libc" != "yes" \ + || test "$gt_cv_func_ngettext_libc" != "yes" \ + || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then + + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CHECK_LIB(intl, ngettext, + [AC_CHECK_LIB(intl, dgettext, + gt_cv_func_dgettext_libintl=yes)])]) + + if test "$gt_cv_func_dgettext_libintl" != "yes" ; then + AC_MSG_CHECKING([if -liconv is needed to use gettext]) + AC_MSG_RESULT([]) + AC_CHECK_LIB(intl, ngettext, + [AC_CHECK_LIB(intl, dcgettext, + [gt_cv_func_dgettext_libintl=yes + libintl_extra_libs=-liconv], + :,-liconv)], + :,-liconv) + fi + + # + # If we found libintl, then check in it for bind_textdomain_codeset(); + # we'll prefer libc if neither have bind_textdomain_codeset(), + # and both have dgettext and ngettext + # + if test "$gt_cv_func_dgettext_libintl" = "yes" ; then + glib_save_LIBS="$LIBS" + LIBS="$LIBS -lintl $libintl_extra_libs" + unset ac_cv_func_bind_textdomain_codeset + AC_CHECK_FUNCS(bind_textdomain_codeset) + LIBS="$glib_save_LIBS" + + if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then + gt_cv_func_dgettext_libc=no + else + if test "$gt_cv_func_dgettext_libc" = "yes" \ + && test "$gt_cv_func_ngettext_libc" = "yes"; then + gt_cv_func_dgettext_libintl=no + fi + fi + fi + fi + + if test "$gt_cv_func_dgettext_libc" = "yes" \ + || test "$gt_cv_func_dgettext_libintl" = "yes"; then + gt_cv_have_gettext=yes + fi + + if test "$gt_cv_func_dgettext_libintl" = "yes"; then + INTLLIBS="-lintl $libintl_extra_libs" + fi + + if test "$gt_cv_have_gettext" = "yes"; then + AC_DEFINE(HAVE_GETTEXT,1, + [Define if the GNU gettext() function is already present or preinstalled.]) + GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl + if test "$MSGFMT" != "no"; then + glib_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + AC_CHECK_FUNCS(dcgettext) + MSGFMT_OPTS= + AC_MSG_CHECKING([if msgfmt accepts -c]) + GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: test 1.0\n" +"PO-Revision-Date: 2007-02-15 12:01+0100\n" +"Last-Translator: test <foo@bar.xx>\n" +"Language-Team: C <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) + AC_SUBST(MSGFMT_OPTS) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr], + [CATOBJEXT=.gmo + DATADIRNAME=share], + [case $host in + *-*-solaris*) + dnl On Solaris, if bind_textdomain_codeset is in libc, + dnl GNU format message catalog is always supported, + dnl since both are added to the libc all together. + dnl Hence, we'd like to go with DATADIRNAME=share and + dnl and CATOBJEXT=.gmo in this case. + AC_CHECK_FUNC(bind_textdomain_codeset, + [CATOBJEXT=.gmo + DATADIRNAME=share], + [CATOBJEXT=.mo + DATADIRNAME=lib]) + ;; + *) + CATOBJEXT=.mo + DATADIRNAME=lib + ;; + esac]) + LIBS="$glib_save_LIBS" + INSTOBJEXT=.mo + else + gt_cv_have_gettext=no + fi + fi + ]) + + if test "$gt_cv_have_gettext" = "yes" ; then + AC_DEFINE(ENABLE_NLS, 1, + [always defined to indicate that i18n is enabled]) + fi + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is not GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + + AC_OUTPUT_COMMANDS( + [case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac]) + + dnl These rules are solely for the distribution goal. While doing this + dnl we only have to keep exactly one list of the available catalogs + dnl in configure.in. + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + dnl Make all variables we use known to autoconf. + AC_SUBST(CATALOGS) + AC_SUBST(CATOBJEXT) + AC_SUBST(DATADIRNAME) + AC_SUBST(GMOFILES) + AC_SUBST(INSTOBJEXT) + AC_SUBST(INTLLIBS) + AC_SUBST(PO_IN_DATADIR_TRUE) + AC_SUBST(PO_IN_DATADIR_FALSE) + AC_SUBST(POFILES) + AC_SUBST(POSUB) + ]) + +# AM_GLIB_GNU_GETTEXT +# ------------------- +# Do checks necessary for use of gettext. If a suitable implementation +# of gettext is found in either in libintl or in the C library, +# it will set INTLLIBS to the libraries needed for use of gettext +# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable +# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST() +# on various variables needed by the Makefile.in.in installed by +# glib-gettextize. +dnl +glib_DEFUN([GLIB_GNU_GETTEXT], + [AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + + GLIB_LC_MESSAGES + GLIB_WITH_NLS + + if test "$gt_cv_have_gettext" = "yes"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + + dnl Generate list of files to be processed by xgettext which will + dnl be included in po/Makefile. + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + ]) + +# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE) +# ------------------------------- +# Define VARIABLE to the location where catalog files will +# be installed by po/Makefile. +glib_DEFUN([GLIB_DEFINE_LOCALEDIR], +[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl +glib_save_prefix="$prefix" +glib_save_exec_prefix="$exec_prefix" +glib_save_datarootdir="$datarootdir" +test "x$prefix" = xNONE && prefix=$ac_default_prefix +test "x$exec_prefix" = xNONE && exec_prefix=$prefix +datarootdir=`eval echo "${datarootdir}"` +if test "x$CATOBJEXT" = "x.mo" ; then + localedir=`eval echo "${libdir}/locale"` +else + localedir=`eval echo "${datadir}/locale"` +fi +prefix="$glib_save_prefix" +exec_prefix="$glib_save_exec_prefix" +datarootdir="$glib_save_datarootdir" +AC_DEFINE_UNQUOTED($1, "$localedir", + [Define the location where the catalogs will be installed]) +]) + +dnl +dnl Now the definitions that aclocal will find +dnl +ifdef(glib_configure_in,[],[ +AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)]) +AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)]) +])dnl + +# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL]) +# +# Create a temporary file with TEST-FILE as its contents and pass the +# file name to PROGRAM. Perform ACTION-IF-PASS if PROGRAM exits with +# 0 and perform ACTION-IF-FAIL for any other exit status. +AC_DEFUN([GLIB_RUN_PROG], +[cat >conftest.foo <<_ACEOF +$2 +_ACEOF +if AC_RUN_LOG([$1 conftest.foo]); then + m4_ifval([$3], [$3], [:]) +m4_ifvaln([$4], [else $4])dnl +echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD +sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD +fi]) + + +# nls.m4 serial 5 (gettext-0.18) +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. +dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. + +AC_PREREQ([2.50]) + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE([nls], + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT([$USE_NLS]) + AC_SUBST([USE_NLS]) +]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 10 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar <conftest.tar]) + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/autotroll.m4]) +m4_include([m4/intltool.m4]) +m4_include([m4/oln-with-lib.m4]) diff --git a/scribo/demo/scribogimpplugin/autogen.sh b/scribo/demo/scribogimpplugin/autogen.sh new file mode 100755 index 0000000..75b081e --- /dev/null +++ b/scribo/demo/scribogimpplugin/autogen.sh @@ -0,0 +1,188 @@ +#!/bin/sh + +# This script does all the magic calls to automake/autoconf and +# friends that are needed to configure a cvs checkout. You need a +# couple of extra tools to run this script successfully. +# +# If you are compiling from a released tarball you don't need these +# tools and you shouldn't use this script. Just call ./configure +# directly. + +PROJECT="GIMP Plug-In Template" +TEST_TYPE=-f +FILE=src/main.cc + +AUTOCONF_REQUIRED_VERSION=2.66 +AUTOMAKE_REQUIRED_VERSION=1.11 +GLIB_REQUIRED_VERSION=2.24.2 +INTLTOOL_REQUIRED_VERSION=0.41 + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. +ORIGDIR=`pwd` +cd $srcdir + +check_version () +{ + if expr $1 \>= $2 > /dev/null; then + echo "yes (version $1)" + else + echo "Too old (found version $1)!" + DIE=1 + fi +} + +echo +echo "I am testing that you have the required versions of autoconf," +echo "automake, glib-gettextize and intltoolize..." +echo + +DIE=0 + +echo -n "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... " +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + VER=`autoconf --version \ + | grep -iw autoconf | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/" \ + | head -n 1` + check_version $VER $AUTOCONF_REQUIRED_VERSION +else + echo + echo " You must have autoconf installed to compile $PROJECT." + echo " Download the appropriate package for your distribution," + echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1; +fi + +echo -n "checking for automake >= $AUTOMAKE_REQUIRED_VERSION ... " +if (automake-1.7 --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake-1.7 + ACLOCAL=aclocal-1.7 +elif (automake-1.11 --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake-1.11 + ACLOCAL=aclocal-1.11 +elif (automake-1.8 --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake-1.8 + ACLOCAL=aclocal-1.8 +elif (automake-1.9 --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake-1.9 + ACLOCAL=aclocal-1.9 +elif (automake-1.6 --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake-1.6 + ACLOCAL=aclocal-1.6 +else + echo + echo " You must have automake 1.6 or newer installed to compile $PROJECT." + echo " Download the appropriate package for your distribution," + echo " or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/" + DIE=1 +fi + +if test x$AUTOMAKE != x; then + VER=`$AUTOMAKE --version \ + | grep automake | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"` + check_version $VER $AUTOMAKE_REQUIRED_VERSION +fi + +echo -n "checking for glib-gettextize >= $GLIB_REQUIRED_VERSION ... " +if (glib-gettextize --version) < /dev/null > /dev/null 2>&1; then + VER=`glib-gettextize --version \ + | grep glib-gettextize | sed "s/.* \([0-9.]*\)/\1/"` + check_version $VER $GLIB_REQUIRED_VERSION +else + echo + echo " You must have glib-gettextize installed to compile $PROJECT." + echo " glib-gettextize is part of glib-2.0, so you should already" + echo " have it. Make sure it is in your PATH." + DIE=1 +fi + +echo -n "checking for intltool >= $INTLTOOL_REQUIRED_VERSION ... " +if (intltoolize --version) < /dev/null > /dev/null 2>&1; then + VER=`intltoolize --version \ + | grep intltoolize | sed "s/.* \([0-9.]*\)/\1/"` + check_version $VER $INTLTOOL_REQUIRED_VERSION +else + echo + echo " You must have intltool installed to compile $PROJECT." + echo " Get the latest version from" + echo " ftp://ftp.gnome.org/pub/GNOME/sources/intltool/" + DIE=1 +fi + +if test "$DIE" -eq 1; then + echo + echo "Please install/upgrade the missing tools and call me again." + echo + exit 1 +fi + + +test $TEST_TYPE $FILE || { + echo + echo "You must run this script in the top-level $PROJECT directory." + echo + exit 1 +} + + +echo +echo "I am going to run ./configure with the following arguments:" +echo +echo " --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS $@" +echo + +if test -z "$*"; then + echo "If you wish to pass additional arguments, please specify them " + echo "on the $0 command line or set the AUTOGEN_CONFIGURE_ARGS " + echo "environment variable." + echo +fi + +if test -z "$ACLOCAL_FLAGS"; then + + acdir=`$ACLOCAL --print-ac-dir` + m4list="glib-gettext.m4 intltool.m4" + + for file in $m4list + do + if [ ! -f "$acdir/$file" ]; then + echo + echo "WARNING: aclocal's directory is $acdir, but..." + echo " no file $acdir/$file" + echo " You may see fatal macro warnings below." + echo " If these files are installed in /some/dir, set the ACLOCAL_FLAGS " + echo " environment variable to \"-I /some/dir\", or install" + echo " $acdir/$file." + echo + fi + done +fi + +$ACLOCAL $ACLOCAL_FLAGS -I m4/ +RC=$? +if test $RC -ne 0; then + echo "$ACLOCAL gave errors. Please fix the error conditions and try again." + exit 1 +fi + +# optionally feature autoheader +(autoheader --version) < /dev/null > /dev/null 2>&1 && autoheader || exit 1 + +$AUTOMAKE --add-missing || exit 1 +autoconf || exit 1 + +glib-gettextize --copy --force || exit 1 +intltoolize --copy --force --automake || exit 1 + +cd $ORIGDIR + +$srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" +RC=$? +if test $RC -ne 0; then + echo + echo "Configure failed or did not finish!" + exit $RC +fi + +echo +echo "Now type 'make' to compile $PROJECT." diff --git a/build-aux/autotroll.mk b/scribo/demo/scribogimpplugin/build-aux/autotroll.mk similarity index 100% copy from build-aux/autotroll.mk copy to scribo/demo/scribogimpplugin/build-aux/autotroll.mk diff --git a/scribo/demo/scribogimpplugin/configure.ac b/scribo/demo/scribogimpplugin/configure.ac new file mode 100644 index 0000000..0cb30d6 --- /dev/null +++ b/scribo/demo/scribogimpplugin/configure.ac @@ -0,0 +1,158 @@ +# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 EPITA Research and +# Development Laboratory (LRDE). +# +# This file is part of Olena. +# +# Olena is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, version 2 of the License. +# +# Olena is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Olena. If not, see <http://www.gnu.org/licenses/>. + +m4_pattern_forbid([^OLN_]) + +AC_PREREQ([2.61]) + +## ---------------- ## +## Package set up. ## +## ---------------- ## + +AC_INIT([scribogimpplugin], [0.1], [olena@lrde.epita.fr], [scribo]) + +# M4 macros. +AC_CONFIG_MACRO_DIR([m4]) + +# Auxiliary files. +AC_CONFIG_AUX_DIR([build-aux]) + +# Automake +AM_INIT_AUTOMAKE([1.10 subdir-objects check-news tar-ustar dist-bzip2 nostdinc -Wall]) + + +# Package metadata. +AC_DEFINE_UNQUOTED([SCRIBO_PACKAGE_NAME], ["$PACKAGE_NAME"], + [Package Full name.]) +AC_DEFINE_UNQUOTED([SCRIBO_PACKAGE_BUGREPORT], ["$PACKAGE_BUGREPORT"], + [Bug report address.]) +AC_DEFINE_UNQUOTED([SCRIBO_PACKAGE_STRING], ["$PACKAGE_STRING"], + [Full name and version.]) +AC_DEFINE_UNQUOTED([SCRIBO_PACKAGE_VERSION], ["$PACKAGE_VERSION"], + [Package Version.]) + +AC_ISC_POSIX +AC_LANG([C++]) +AC_PROG_CXX +#AC_LANG([C]) +#AC_PROG_CC +#AM_PROG_CC_STDC +AC_HEADER_STDC + + +ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + +#AM_MAINTAINER_MODE + +# ---- # +# Qt. # +# ---- # + +AT_WITH_QT([xml], [], [], [:], [oln_have_qt=yes]) +if test x$oln_have_qt = xyes; then + AT_REQUIRE_QT_VERSION([4], + AC_MSG_WARN([Qt-dependent programs will be disabled.]), + oln_have_expected_qt_version=yes) +fi +AM_CONDITIONAL([HAVE_QT], [test "x$oln_have_expected_qt_version" = xyes]) + +# ----------- # +# Tesseract. # +# ----------- # + +OLN_WITH_TESSERACT + + +# ----- # +# Gimp # +# ----- # + +GIMP_REQUIRED_VERSION=2.2.0 +PKG_CHECK_MODULES(GIMP, + gimp-2.0 >= $GIMP_REQUIRED_VERSION gimpui-2.0 >= $GIMP_REQUIRED_VERSION) +AC_SUBST(GIMP_CFLAGS) +AC_SUBST(GIMP_LIBS) +#GIMP_LIBDIR=`$PKG_CONFIG --variable=gimplibdir gimp-2.0` +GIMP_LIBDIR=`echo ~/.gimp-2.4` +AC_SUBST(GIMP_LIBDIR) + + +AM_CONFIG_HEADER(config.h) + +# Project Files +AC_CONFIG_SRCDIR([src/main.cc]) + + +# i18n stuff + +GETTEXT_PACKAGE=gimp20-plugin-template +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", + [The gettext translation domain.]) + +# Add the languages which your application supports here. +ALL_LINGUAS="az de fr sk sv zh_TW" + +AC_PROG_INTLTOOL +AM_GLIB_GNU_GETTEXT + +AC_CHECK_FUNCS(bind_textdomain_codeset) + +LOCALEDIR='${datadir}/locale' +DATADIR='${datadir}/plugin_name' + +AC_SUBST(LOCALEDIR) +AC_SUBST(DATADIR) + + +AC_MSG_CHECKING([if GTK+ is version 2.7.0 or newer]) +if $PKG_CONFIG --atleast-version=2.7.0 gtk+-2.0; then + have_gtk_2_7=yes +else + have_gtk_2_7=no +fi +AC_MSG_RESULT($have_gtk_2_7) + +if test "x$have_gtk_2_7" != "xyes"; then + CPPFLAGS="$CPPFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" +fi + + +AC_MSG_CHECKING([if GIMP is version 2.3.0 or newer]) +if $PKG_CONFIG --atleast-version=2.3.0 gimp-2.0; then + have_gimp_2_3=yes +else + have_gimp_2_3=no +fi +AC_MSG_RESULT($have_gimp_2_3) + +if test "x$have_gimp_2_3" != "xyes"; then + CPPFLAGS="$CPPFLAGS -DGIMP_DISABLE_DEPRECATED" +fi + + + +AC_CONFIG_FILES([ +Makefile +help/Makefile +help/en/Makefile +help/images/Makefile +src/Makefile +po/Makefile.in +]) + +AC_OUTPUT diff --git a/milena/sandbox/nivault/plugin-gimp/help/Makefile.am b/scribo/demo/scribogimpplugin/help/Makefile.am similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/Makefile.am copy to scribo/demo/scribogimpplugin/help/Makefile.am diff --git a/milena/sandbox/nivault/plugin-gimp/help/en/Makefile.am b/scribo/demo/scribogimpplugin/help/en/Makefile.am similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/en/Makefile.am copy to scribo/demo/scribogimpplugin/help/en/Makefile.am diff --git a/milena/sandbox/nivault/plugin-gimp/help/en/gimp-help.xml b/scribo/demo/scribogimpplugin/help/en/gimp-help.xml similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/en/gimp-help.xml copy to scribo/demo/scribogimpplugin/help/en/gimp-help.xml diff --git a/milena/sandbox/nivault/plugin-gimp/help/en/index.html b/scribo/demo/scribogimpplugin/help/en/index.html similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/en/index.html copy to scribo/demo/scribogimpplugin/help/en/index.html diff --git a/milena/sandbox/nivault/plugin-gimp/help/images/Makefile.am b/scribo/demo/scribogimpplugin/help/images/Makefile.am similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/images/Makefile.am copy to scribo/demo/scribogimpplugin/help/images/Makefile.am diff --git a/milena/sandbox/nivault/plugin-gimp/help/images/wilber.png b/scribo/demo/scribogimpplugin/help/images/wilber.png similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/help/images/wilber.png copy to scribo/demo/scribogimpplugin/help/images/wilber.png diff --git a/m4/autotroll.m4 b/scribo/demo/scribogimpplugin/m4/autotroll.m4 similarity index 100% copy from m4/autotroll.m4 copy to scribo/demo/scribogimpplugin/m4/autotroll.m4 diff --git a/scribo/demo/scribogimpplugin/m4/intltool.m4 b/scribo/demo/scribogimpplugin/m4/intltool.m4 new file mode 100644 index 0000000..839e855 --- /dev/null +++ b/scribo/demo/scribogimpplugin/m4/intltool.m4 @@ -0,0 +1,216 @@ +## intltool.m4 - Configure intltool for the target system. -*-Shell-script-*- +## Copyright (C) 2001 Eazel, Inc. +## Author: Maciej Stachowiak <mjs@noisehavoc.org> +## Kenneth Christiansen <kenneth@gnu.org> +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml]) +# serial 40 IT_PROG_INTLTOOL +AC_DEFUN([IT_PROG_INTLTOOL], [ +AC_PREREQ([2.50])dnl +AC_REQUIRE([AM_NLS])dnl + +case "$am__api_version" in + 1.[01234]) + AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool]) + ;; + *) + ;; +esac + +if test -n "$1"; then + AC_MSG_CHECKING([for intltool >= $1]) + + INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` + INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` + [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` + ] + AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) + test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || + AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.]) +fi + +AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update]) +AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge]) +AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract]) +if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then + AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.]) +fi + + INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< [$]@' + INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< [$]@' + INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + +_IT_SUBST(INTLTOOL_DESKTOP_RULE) +_IT_SUBST(INTLTOOL_DIRECTORY_RULE) +_IT_SUBST(INTLTOOL_KEYS_RULE) +_IT_SUBST(INTLTOOL_PROP_RULE) +_IT_SUBST(INTLTOOL_OAF_RULE) +_IT_SUBST(INTLTOOL_PONG_RULE) +_IT_SUBST(INTLTOOL_SERVER_RULE) +_IT_SUBST(INTLTOOL_SHEET_RULE) +_IT_SUBST(INTLTOOL_SOUNDLIST_RULE) +_IT_SUBST(INTLTOOL_UI_RULE) +_IT_SUBST(INTLTOOL_XAM_RULE) +_IT_SUBST(INTLTOOL_KBD_RULE) +_IT_SUBST(INTLTOOL_XML_RULE) +_IT_SUBST(INTLTOOL_XML_NOMERGE_RULE) +_IT_SUBST(INTLTOOL_CAVES_RULE) +_IT_SUBST(INTLTOOL_SCHEMAS_RULE) +_IT_SUBST(INTLTOOL_THEME_RULE) +_IT_SUBST(INTLTOOL_SERVICE_RULE) +_IT_SUBST(INTLTOOL_POLICY_RULE) + +# Check the gettext tools to make sure they are GNU +AC_PATH_PROG(XGETTEXT, xgettext) +AC_PATH_PROG(MSGMERGE, msgmerge) +AC_PATH_PROG(MSGFMT, msgfmt) +AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) +if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then + AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) +fi +xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`" +mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`" +mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`" +if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then + AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) +fi + +AC_PATH_PROG(INTLTOOL_PERL, perl) +if test -z "$INTLTOOL_PERL"; then + AC_MSG_ERROR([perl not found]) +fi +AC_MSG_CHECKING([for perl >= 5.8.1]) +$INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1 +if test $? -ne 0; then + AC_MSG_ERROR([perl 5.8.1 is required for intltool]) +else + IT_PERL_VERSION="`$INTLTOOL_PERL -e \"printf '%vd', $^V\"`" + AC_MSG_RESULT([$IT_PERL_VERSION]) +fi +if test "x$2" != "xno-xml"; then + AC_MSG_CHECKING([for XML::Parser]) + if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then + AC_MSG_RESULT([ok]) + else + AC_MSG_ERROR([XML::Parser perl module is required for intltool]) + fi +fi + +# Substitute ALL_LINGUAS so we can use it in po/Makefile +AC_SUBST(ALL_LINGUAS) + +# Set DATADIRNAME correctly if it is not set yet +# (copied from glib-gettext.m4) +if test -z "$DATADIRNAME"; then + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[]], + [[extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr]])], + [DATADIRNAME=share], + [case $host in + *-*-solaris*) + dnl On Solaris, if bind_textdomain_codeset is in libc, + dnl GNU format message catalog is always supported, + dnl since both are added to the libc all together. + dnl Hence, we'd like to go with DATADIRNAME=share + dnl in this case. + AC_CHECK_FUNC(bind_textdomain_codeset, + [DATADIRNAME=share], [DATADIRNAME=lib]) + ;; + *) + [DATADIRNAME=lib] + ;; + esac]) +fi +AC_SUBST(DATADIRNAME) + +IT_PO_SUBDIR([po]) + +]) + + +# IT_PO_SUBDIR(DIRNAME) +# --------------------- +# All po subdirs have to be declared with this macro; the subdir "po" is +# declared by IT_PROG_INTLTOOL. +# +AC_DEFUN([IT_PO_SUBDIR], +[AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS. +dnl +dnl The following CONFIG_COMMANDS should be executed at the very end +dnl of config.status. +AC_CONFIG_COMMANDS_PRE([ + AC_CONFIG_COMMANDS([$1/stamp-it], [ + if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ]; then + AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.]) + fi + rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp" + >"$1/stamp-it.tmp" + [sed '/^#/d + s/^[[].*] *// + /^[ ]*$/d + '"s|^| $ac_top_srcdir/|" \ + "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES" + ] + [sed '/^POTFILES =/,/[^\\]$/ { + /^POTFILES =/!d + r $1/POTFILES + } + ' "$1/Makefile.in" >"$1/Makefile"] + rm -f "$1/Makefile.tmp" + mv "$1/stamp-it.tmp" "$1/stamp-it" + ]) +])dnl +]) + +# _IT_SUBST(VARIABLE) +# ------------------- +# Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST +# +AC_DEFUN([_IT_SUBST], +[ +AC_SUBST([$1]) +m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])]) +] +) + +# deprecated macros +AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL]) +# A hint is needed for aclocal from Automake <= 1.9.4: +# AC_DEFUN([AC_PROG_INTLTOOL], ...) + diff --git a/m4/oln-with-lib.m4 b/scribo/demo/scribogimpplugin/m4/oln-with-lib.m4 similarity index 100% copy from m4/oln-with-lib.m4 copy to scribo/demo/scribogimpplugin/m4/oln-with-lib.m4 diff --git a/milena/doc/outputs/accu-right-instantiation.txt b/scribo/demo/scribogimpplugin/po/POTFILES.in similarity index 100% copy from milena/doc/outputs/accu-right-instantiation.txt copy to scribo/demo/scribogimpplugin/po/POTFILES.in diff --git a/milena/sandbox/nivault/plugin-gimp/po/az.po b/scribo/demo/scribogimpplugin/po/az.po similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/az.po copy to scribo/demo/scribogimpplugin/po/az.po diff --git a/milena/sandbox/nivault/plugin-gimp/po/de.po b/scribo/demo/scribogimpplugin/po/de.po similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/de.po copy to scribo/demo/scribogimpplugin/po/de.po diff --git a/milena/sandbox/nivault/plugin-gimp/po/fr.po b/scribo/demo/scribogimpplugin/po/fr.po similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/fr.po copy to scribo/demo/scribogimpplugin/po/fr.po diff --git a/milena/sandbox/nivault/plugin-gimp/po/sk.po b/scribo/demo/scribogimpplugin/po/sk.po similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/sk.po copy to scribo/demo/scribogimpplugin/po/sk.po diff --git a/milena/sandbox/nivault/plugin-gimp/po/sv.po b/scribo/demo/scribogimpplugin/po/sv.po similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/po/sv.po copy to scribo/demo/scribogimpplugin/po/sv.po diff --git a/scribo/demo/scribogimpplugin/src/Makefile.am b/scribo/demo/scribogimpplugin/src/Makefile.am new file mode 100644 index 0000000..9823ac5 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/Makefile.am @@ -0,0 +1,75 @@ +## Process this file with automake to produce Makefile.in + +include $(top_srcdir)/../../../build-aux/autotroll.mk + +bin_PROGRAMS = scribo-plugin + +bindir = $(GIMP_LIBDIR)/plug-ins + +scribo_plugin_SOURCES = \ + main.cc \ + preprocessing_options.cc \ + segmentation_options.cc \ + ocr_options.cc \ + general_options.cc \ + preferences_dialog.cc \ + config.cc \ + option_widget.cc \ + process.cc \ + preprocess.cc \ + runner.cc + +BUILT_SOURCES = preprocessing_options.moc.cc \ + preprocessing_options.ui.h \ + segmentation_options.moc.cc \ + segmentation_options.ui.h \ + ocr_options.moc.cc \ + ocr_options.ui.h \ + preferences_dialog.moc.cc \ + preferences_dialog.ui.h \ + general_options.moc.cc \ + general_options.ui.h \ + process.moc.cc \ + preprocess.moc.cc \ + runner.moc.cc + +nodist_scribo_plugin_SOURCES = $(BUILT_SOURCES) + +CLEANFILES = $(BUILT_SOURCES) + +noinst_HEADERS = preprocessing_options.hh \ + segmentation_options.hh \ + ocr_options.hh \ + general_options.hh \ + preferences_dialog.hh \ + config.hh \ + option_widget.hh \ + runner.hh + +scribo_plugin_CPPFLAGS = \ + $(QT_CPPFLAGS) $(AM_CPPFLAGS) \ + $(TESSERACT_CPPFLAGS) \ + -DLOCALEDIR=\""$(LOCALEDIR)"\" \ + -DDATADIR=\""$(DATADIR)"\" \ + -I$(top_srcdir) \ + -I$(srcdir) \ + -I$(top_builddir) \ + -I$(OLN)/milena \ + -I$(OLN)/scribo \ + -I$(OLN)/scribo/demo/viewer \ + @GIMP_CFLAGS@ \ + -DNDEBUG -DMLN_WO_GLOBAL_VARS + +scribo_plugin_CXXFLAGS = $(QT_CXXFLAGS) $(AM_CXXFLAGS) -O3 +scribo_plugin_LDFLAGS = $(QT_LDFLAGS) $(TESSERACT_LDFLAGS) $(LDFLAGS) +scribo_plugin_LDADD = $(QT_LIBS) $(LDADD) $(GIMP_LIBS) + +EXTRA_DIST = \ + general_options.ui \ + preferences_dialog.ui \ + preprocessing_options.ui\ + segmentation_options.ui \ + ocr_options.ui + + + diff --git a/milena/sandbox/nivault/plugin-gimp/src/build-image.hh b/scribo/demo/scribogimpplugin/src/build-image.hh similarity index 100% copy from milena/sandbox/nivault/plugin-gimp/src/build-image.hh copy to scribo/demo/scribogimpplugin/src/build-image.hh diff --git a/scribo/demo/scribogimpplugin/src/build-image.hxx b/scribo/demo/scribogimpplugin/src/build-image.hxx new file mode 100644 index 0000000..9a226d1 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/build-image.hxx @@ -0,0 +1,103 @@ +/* GIMP Plug-in Template + * Copyright (C) 2000-2004 Michael Natterer <mitch@gimp.org> (the "Author"). + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the Author of the + * Software shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the Author. + */ + +#include "build-image.hh" + +typedef mln::gimp_image<GIMP_RGB_IMAGE> I; + +static I ima; + +const I& get_ima() +{ + return ima; +} + +struct toto : mln::Function_v2v<toto> +{ + typedef mln::value::rgb8 result; + mln::value::rgb8 operator()(const mln::value::rgb8& c) const + { + return mln::value::rgb8(255 - c.red(), 255 - c.green(), 255 - c.blue()); + } +}; + +void build_milena_image(GimpPixelRgn *in, + GimpPixelRgn *out) +{ + I tmp(in); +// g_message(region->dirty ? "saaale" : "pas saaale"); +// g_message(region->shadow ? "shadoooow" : "pas shadoooow"); + ima = tmp; + mln::point2d p1(0,0); + mln::point2d p2(0,5); + mln::point2d p3(20,50); +// mln::io::ppm::save(ima, "/goinfre/out.ppm"); + std::cout << p1 << " : " << ima(p1) << std::endl; + std::cout << p2 << " : " << ima(p2) << std::endl; + std::cout << p3 << " : " << ima(p3) << std::endl; +// mln::data::fill(ima, mln::literal::blue); + + // toto fun; + // mln::image2d<mln::value::rgb8> + // tmp2 = mln::data::transform(ima, fun); + // mln::border::resize(tmp2, 0); + + gimp_pixel_rgn_set_rect(out, + (const guchar *) ima.buffer(), + 0, + 0, + out->w, + out->h); + + gimp_drawable_flush (out->drawable); + gimp_drawable_merge_shadow (out->drawable->drawable_id, TRUE); +} + +gboolean draw_milena_image(GtkWidget* area, + GdkEventExpose *event, + gpointer data) +{ + GimpDrawable* drawable = gimp_drawable_preview_get_drawable((GimpDrawablePreview *)area); + assert(drawable != NULL); + GimpPixelRgn region; + std::stringstream ss; + gimp_pixel_rgn_init(®ion, + drawable, + 0, + 0, + drawable->width, + drawable->height, + FALSE, + FALSE); + +// gimp_pixel_rgn_set_rect(®ion, +// (const guchar *) ima.buffer(), +// 0, +// 0, +// drawable->width, +// drawable->height); +} diff --git a/scribo/demo/viewer/config.cc b/scribo/demo/scribogimpplugin/src/config.cc similarity index 100% copy from scribo/demo/viewer/config.cc copy to scribo/demo/scribogimpplugin/src/config.cc diff --git a/scribo/demo/viewer/config.hh b/scribo/demo/scribogimpplugin/src/config.hh similarity index 100% copy from scribo/demo/viewer/config.hh copy to scribo/demo/scribogimpplugin/src/config.hh diff --git a/scribo/demo/scribogimpplugin/src/general_options.cc b/scribo/demo/scribogimpplugin/src/general_options.cc new file mode 100644 index 0000000..903a1c3 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/general_options.cc @@ -0,0 +1,39 @@ +// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <http://www.gnu.org/licenses/>. + +#include "general_options.hh" +#include "config.hh" + + +general_options::general_options(QWidget *parent) + : OptionWidget(parent) +{ + setupUi(this); +} + +general_options::~general_options() +{ +} + + +void general_options::load_config() +{ +} + + +void general_options::save_config() +{ +} diff --git a/scribo/demo/scribogimpplugin/src/general_options.hh b/scribo/demo/scribogimpplugin/src/general_options.hh new file mode 100644 index 0000000..123671e --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/general_options.hh @@ -0,0 +1,38 @@ +// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <http://www.gnu.org/licenses/>. + +#ifndef SCRIBO_DEMO_VIEWER_GENERAL_OPTIONS_HH +# define SCRIBO_DEMO_VIEWER_GENERAL_OPTIONS_HH + +# include <QtGui> +# include <general_options.ui.h> +# include "option_widget.hh" + +class general_options : public OptionWidget, private Ui::GeneralOptions +{ + Q_OBJECT; + +public: + general_options(QWidget *parent = 0); + ~general_options(); + + virtual void load_config(); + virtual void save_config(); + + +}; + +#endif // ! SCRIBO_DEMO_VIEWER_GENERAL_OPTIONS_HH diff --git a/scribo/demo/scribogimpplugin/src/general_options.ui b/scribo/demo/scribogimpplugin/src/general_options.ui new file mode 100644 index 0000000..81bcf3e --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/general_options.ui @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>GeneralOptions</class> + <widget class="QWidget" name="GeneralOptions"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt; font-weight:600;">Document Image Layout Analysis</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; font-weight:600;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">Please select options and parameters for the layout analysis.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">This algorithms produces a new image with different layers for each kind of elements in the document:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">- Text</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">- Pictures</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">- Separators</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">- Others</span></p></body></html></string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/scribo/demo/scribogimpplugin/src/gimp-image.hh b/scribo/demo/scribogimpplugin/src/gimp-image.hh new file mode 100644 index 0000000..63d9686 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/gimp-image.hh @@ -0,0 +1,471 @@ +// Copyright (C) 2007, 2011 EPITA Research and Development Laboratory +// +// This file is part of the Milena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef __IMAGEGIMP_HH__ +# define __IMAGEGIMP_HH__ + +extern "C" +{ +# include <libgimp/gimp.h> +# include <libgimp/gimpui.h> +} + +# include <mln/core/internal/image_primary.hh> + +# include <mln/core/alias/box2d.hh> +# include <mln/value/set.hh> +# include <mln/value/rgb8.hh> +# include <mln/literal/all.hh> + +# include <iostream> +# include <sstream> + +namespace mln +{ + + // Fwd decl. + template <GimpImageType TI> struct gimp_image; + + namespace internal + { + + template <GimpImageType TI> + struct data< gimp_image<TI> > + { + /// Constructor. + /// { + data(GimpPixelRgn* rgn_); + /// } + + /// Destructor. + ~data(); + + /// Gimp region. + GimpPixelRgn* rgn_; + + ///Pointer to pixel buffer. + mln_value(gimp_image<TI>)* buffer_; + + // FIXME: currently not initialized but may be faster! See if + // Gimp supports such things. + ///Pointer to an array of pointer on images lines. + mln_value(gimp_image<TI>)** array_; + + /// theoretical box + box2d b_; + + /// Smap data between images. + void swap_(data< gimp_image<TI> >& other_); + }; + + /// Trait that give mln type from gimp value tag. + template <GimpImageType TI> + struct gimp_value_tag_to_mln + { + typedef void type; + }; + + template <> + struct gimp_value_tag_to_mln<GIMP_RGB_IMAGE> + { + typedef value::rgb8 type; + }; + + } // end of namespace mln::internal + + namespace trait + { + + template <GimpImageType TI> + struct image_< gimp_image<TI> > : default_image_< mln::value::rgb8, gimp_image<TI> > + { + // misc + typedef trait::image::category::primary category; + typedef trait::image::speed::fast speed; + typedef trait::image::size::regular size; + + // value + typedef trait::image::vw_io::none vw_io; + typedef trait::image::vw_set::none vw_set; + typedef trait::image::value_access::computed value_access; + typedef trait::image::value_storage::one_block value_storage; + typedef trait::image::value_browsing::site_wise_only value_browsing; + typedef trait::image::value_alignment::with_grid value_alignment; + typedef trait::image::value_io::read_write value_io; + + + // site / domain + typedef trait::image::pw_io::read_write pw_io; + typedef trait::image::localization::basic_grid localization; + typedef trait::image::dimension::two_d dimension; + + // extended domain + typedef trait::image::ext_domain::none ext_domain; + typedef trait::image::ext_value::multiple ext_value; + typedef trait::image::ext_io::read_only ext_io; + }; + + } // end of namespace mln::trait + + + + /*! \brief Basic 2D image class. + * + */ + template <GimpImageType TI> + struct gimp_image + : public internal::image_primary<typename internal::gimp_value_tag_to_mln<TI>::type, + box2d, gimp_image<TI> > + { + // Warning: just to make effective types appear in Doxygen: + typedef box2d pset; + typedef point2d psite; + typedef point2d point; + typedef dpoint2d dpoint; + typedef mln_fwd_piter(box2d) fwd_piter; + typedef mln_bkd_piter(box2d) bkd_piter; + // End of warning. + + typedef typename internal::gimp_value_tag_to_mln<TI>::type T; + + /// Value associated type. + typedef T value; + + /// Return type of read-only access. + typedef const T& rvalue; + + /// Return type of read-write access. + typedef T& lvalue; + + + /// Skeleton. + typedef gimp_image<TI> skeleton; + + + /// Value_Set associated type. + typedef mln::value::set<value> vset; + + + /// Constructor without argument. + gimp_image(); + + /// Constructor with a gimp region. + gimp_image(GimpPixelRgn* rgn); + + /// Initialise an image from a gimp region. + void init_(GimpPixelRgn* rgn); + + /// Test if \p p is valid. + bool has(const point2d& p) const; + + /// Give the set of values of the image. + const vset& values() const; + + /// Give the definition domain. + const box2d& domain() const; + + /// Give the border thickness. + unsigned border() const; + + /// Give the number of cells (points including border ones). + std::size_t nelements() const; + + /// const-only access to the image value located at point \p p. + const T& operator()(const point& p) const; + + // FIXME: does not work! We need a shell object for enabling writing! + /// Read-write access to the image value located at point \p p. + T& operator()(const point& p); + + /// Fast Image method + + /// Give a hook to the value buffer. + // const T* buffer() const; + + // /// Give a hook to the value buffer. + // T* buffer(); + + /// Gimp Image method + + /// Give a hook to the GimpPixelRgn. + GimpPixelRgn* gimp_region(); + + /// Give a hook to the GimpDrawable. + GimpDrawable* gimp_drawable(); + }; + + +# ifndef MLN_INCLUDE_ONLY + + namespace internal + { + + template <GimpImageType TI> + data< gimp_image<TI> >::data(GimpPixelRgn* rgn) + : rgn_(rgn) + { + mln_assertion(rgn != NULL); +// buffer_ = (typename gimp_image<TI>::value*) rgn->data; + b_ = make::box2d(rgn->y, rgn->x, + rgn->y + rgn->h - 1, + rgn->x + rgn->w - 1); + } + + template <GimpImageType TI> + data< gimp_image<TI> >::~data() + { + } + + template <GimpImageType TI> + void + data< gimp_image<TI> >::swap_(data< gimp_image<TI> >& other_) + { + data< gimp_image<TI> > self_ = *this; + *this = other_; + other_ = self_; + } + + } // end of namespace mln::internal + + // gimp_image<TI> + + + template <GimpImageType TI> + gimp_image<TI>::gimp_image() + { + } + + template <GimpImageType TI> + gimp_image<TI>::gimp_image(GimpPixelRgn* rgn) + { + init_(rgn); + } + + template <GimpImageType TI> + void + gimp_image<TI>::init_(GimpPixelRgn* rgn) + { + mln_precondition(! this->is_valid()); + this->data_ = new internal::data< gimp_image<TI> >(rgn); + } + + + template <GimpImageType TI> + const typename gimp_image<TI>::vset& + gimp_image<TI>::values() const + { + return vset::the(); + } + + + template <GimpImageType TI> + const box2d& + gimp_image<TI>::domain() const + { + mln_precondition(this->is_valid()); + return this->data_->b_; + } + + + template <GimpImageType TI> + unsigned + gimp_image<TI>::border() const + { + return 0; + } + + + template <GimpImageType TI> + std::size_t + gimp_image<TI>::nelements() const + { + mln_precondition(this->is_valid()); + return this->data_->b_.nsites(); + } + + + template <GimpImageType TI> + bool + gimp_image<TI>::has(const point2d& p) const + { + mln_precondition(this->is_valid()); + return this->data_->b_.has(p); + } + + + template <GimpImageType TI> + const mln_value(gimp_image<TI>)& + gimp_image<TI>::operator()(const point& p) const + { + // mln_precondition(this->has(p)); + // FIXME HERE value*) this->data_->rgn->data + + static mln::value::rgb8 c; + gimp_pixel_rgn_get_pixel(this->data_->rgn_, + (guchar *) &c, + p[1], p[0]); + return c; + } + + template <GimpImageType TI> + mln_value(gimp_image<TI>)& + gimp_image<TI>::operator()(const point& p) + { + // mln_precondition(this->has(p)); + static mln::value::rgb8 c; + gimp_pixel_rgn_get_pixel(this->data_->rgn_, + (guchar *) &c, + p[1], p[0]); + return c; + } + + // template <GimpImageType TI> + // const mln_value(gimp_image<TI>)* + // gimp_image<TI>::buffer() const + // { + // mln_precondition(this->is_valid()); + // return this->data_->buffer_; + // } + + + // template <GimpImageType TI> + // mln_value(gimp_image<TI>)* + // gimp_image<TI>::buffer() + // { + // mln_precondition(this->is_valid()); + // return this->data_->buffer_; + // } + + template <GimpImageType TI> + GimpPixelRgn* + gimp_image<TI>::gimp_region() + { + return this->data_->rgn_; + } + + template <GimpImageType TI> + GimpDrawable* + gimp_image<TI>::gimp_drawable() + { + return this->data_->rgn_->drawable; + } + + +# endif // ! MLN_INCLUDE_ONLY + +} // end of namespace mln + + + +# include <mln/core/trait/pixter.hh> +# include <mln/core/dpoints_pixter.hh> +# include <mln/core/pixter2d.hh> +# include <mln/core/w_window.hh> + + +namespace mln +{ + + namespace trait + { + + // pixter + + + template <GimpImageType TI> + struct fwd_pixter< gimp_image<TI> > + { + typedef fwd_pixter2d< gimp_image<TI> > ret; + }; + + + template <GimpImageType TI> + struct fwd_pixter< const gimp_image<TI> > + { + typedef fwd_pixter2d< const gimp_image<TI> > ret; + }; + + + template <GimpImageType TI> + struct bkd_pixter< gimp_image<TI> > + { + typedef bkd_pixter2d< gimp_image<TI> > ret; + }; + + + template <GimpImageType TI> + struct bkd_pixter< const gimp_image<TI> > + { + typedef bkd_pixter2d< const gimp_image<TI> > ret; + }; + + // qixter + + template <typename W, GimpImageType TI> + struct fwd_qixter< gimp_image<TI>, W > + { + typedef dpoints_fwd_pixter< gimp_image<TI> > ret; + }; + + template <typename W, GimpImageType TI> + struct fwd_qixter< const gimp_image<TI>, W > + { + typedef dpoints_fwd_pixter< const gimp_image<TI> > ret; + }; + + template <typename W, GimpImageType TI> + struct bkd_qixter< gimp_image<TI>, W > + { + typedef mln::internal::fixme ret; + }; + + // nixter + + template <typename N, GimpImageType TI> + struct fwd_nixter< gimp_image<TI>, N > + { + typedef dpoints_fwd_pixter< gimp_image<TI> > ret; + }; + + template <typename N, GimpImageType TI> + struct fwd_nixter< const gimp_image<TI>, N > + { + typedef dpoints_fwd_pixter< const gimp_image<TI> > ret; + }; + + template <typename N, GimpImageType TI> + struct bkd_nixter< gimp_image<TI>, N > + { + typedef mln::internal::fixme ret; + }; + + } // end of namespace mln::trait + +} // end of namespace mln + + +#endif // ! __GIMP_IMAGE_HH__ diff --git a/scribo/demo/scribogimpplugin/src/main.cc b/scribo/demo/scribogimpplugin/src/main.cc new file mode 100644 index 0000000..855a6ad --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/main.cc @@ -0,0 +1,323 @@ +#include "config.h" + +extern "C" +{ +#include <libgimp/gimp.h> +} + +#include <stdlib.h> +#include <stdio.h> +#include <iostream> + +#undef MLN_WO_GLOBAL_VARS +#include <gimp-image.hh> + +#include <QApplication> +#include <QMainWindow> +#include <QGtkStyle> +#include <QObject> + + +#include <mln/core/image/image2d.hh> +#include <mln/debug/filename.hh> +#include <mln/math/pi.hh> +#include <mln/data/paste.hh> +#include <mln/border/resize.hh> +#include <mln/io/ppm/save.hh> + +#include <preferences_dialog.hh> + +extern "C" +{ + static void query_proc(void); + static void run_proc(const gchar* name, + gint nparams, + const GimpParam* param, + gint* nreturn_vals, + GimpParam** return_vals); +} + +// int copy_to_gimp(QImage& image); + +GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, + NULL, + query_proc, + run_proc +}; + + +// FIXME: Useful ? +void qisMessageHandler(QtMsgType type, const char *msg ) +{ + (void) type; + (void) msg; + //simply ignore all messages +} + + +int main(int argc, char **argv) +{ + int result; + + std::cout << "Main is called" << std::endl; + + // FIXME: useful? + //install the message handler, if the the environment variable + //DEBUG_QUITEINSANE_GIMPPLUGIN isn't set + const char* env_v = getenv("DEBUG_QUITEINSANE_GIMPPLUGIN"); + if(env_v == NULL) + qInstallMsgHandler(qisMessageHandler); + + QApplication app(0, 0); + //app.setQuitOnLastWindowClosed(false); + + + result = gimp_main(&PLUG_IN_INFO, argc, argv); + std::cout << "Exiting gimp main" << std::endl; + + return result; +} + + + +extern "C" +{ + static void query_proc(void) + { + static GimpParamDef args[] = + { + { GIMP_PDB_INT32, "run_mode", "Interactive,non-interactive"}, + { GIMP_PDB_IMAGE, "image_id", "Input image" }, + { GIMP_PDB_DRAWABLE, "drawable_id", "Input drawable" } + }; + + static GimpParamDef *return_vals = NULL; + static int nargs = sizeof(args) / sizeof(args[0]); + static int nreturn_vals = 0; + + gimp_install_procedure("Scribo", + "SCRIBO Frontend", + "Document Image Analysis", + "Olena Team", + "Copyright EPITA/LRDE", + "2011", + "_Analyse Layout...", + "RGB*, GRAY*", + GIMP_PLUGIN, + nargs, nreturn_vals, + args, return_vals); + + gimp_plugin_menu_register ("Scribo", + "<Image>/Olena/Scribo/"); + + } + + + static void run_proc(const gchar* name, + gint nparams, + const GimpParam* param, + gint* nreturn_vals, + GimpParam** return_vals) + { + static GimpParam values[1]; + GimpRunMode run_mode; + + (void) name; + (void) nparams; + + /* Setting mandatory output values */ + *nreturn_vals = 1; + *return_vals = values; + + /* Getting run_mode - we won't display a dialog if + * we are in NONINTERACTIVE mode */ + run_mode = (GimpRunMode)param[0].data.d_int32; + + // Prepare for setting return status. + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = GIMP_PDB_CALLING_ERROR; + + // ========================== + // Begin of GIMP2Milena image + // ========================== + + // FIXME: move into the switch/case below. + GimpPixelRgn in; + gint32 x1, y1, x2, y2; + + gint32 drawable_id = param[2].data.d_drawable; + GimpDrawable *drawable = gimp_drawable_get(drawable_id); + + gimp_drawable_mask_bounds(drawable_id, &x1, &y1, &x2, &y2); + gint32 width = drawable->width; + gint32 height = drawable->height; + + gimp_pixel_rgn_init(&in, drawable, x1, y1, x2, y2, FALSE, FALSE); + + typedef mln::gimp_image<GIMP_RGB_IMAGE> I; + I tmp(&in); + mln::image2d<mln::value::rgb8> input(height, width); + std::cout << "Paste data into Olena image" << std::endl; + mln::data::paste(tmp, input); + mln::io::ppm::save(input, "/tmp/gimp_out.ppm"); + std::cout << "Paste data into Olena image: Done." << std::endl; + + // // Create a new image + // gint32 new_image_id = gimp_image_new(width, + // height, + // gimp_image_base_type(param[1].data.d_image)); + // /* create new layer */ + // gint32 new_layer_id = gimp_layer_new(new_image_id, + // "titi", + // width, height, + // gimp_drawable_type(drawable_id), + // 100, + // GIMP_NORMAL_MODE); + // gimp_image_add_layer(new_image_id, new_layer_id, 0); + // GimpDrawable *new_drawable = gimp_drawable_get(new_layer_id); + // GimpPixelRgn new_region; + // gimp_pixel_rgn_init(&new_region, new_drawable, x1, y1, x2, y2, TRUE, TRUE); + + // mln::border::resize(input, 0); + + // gimp_pixel_rgn_set_rect(&new_region, + // (const guchar *) input.buffer(), + // 0, + // 0, + // new_region.w, + // new_region.h); + + // /* Tidy up dirty drawable */ + // gimp_drawable_flush(new_drawable); + // gimp_drawable_merge_shadow(new_drawable->drawable_id, TRUE); + // gimp_drawable_update(new_drawable->drawable_id, x1, y1, x2, y2); + // gimp_drawable_detach(new_drawable); + + // /* free buffer */ + // gimp_displays_flush(); + // gimp_display_new(new_image_id); + + // ========================== + // end of GIMP2Milena image + // ========================== + + + + switch (run_mode) + { + case GIMP_RUN_INTERACTIVE: + { + preferences_dialog dialog; + dialog.set_current_image(input, param[1].data.d_image); + dialog.show(); + + // Run application. + qApp->setStyle(new QGtkStyle()); + std::cout << "Running app" << std::endl; + qApp->exec(); + std::cout << "Exiting app" << std::endl; + + values[0].data.d_status = GIMP_PDB_SUCCESS; + } + break; + + case GIMP_RUN_NONINTERACTIVE: + { + } + break; + + case GIMP_RUN_WITH_LAST_VALS: + { + } + break; + + default: + { + } + break; + } + } +} + + + +// int copy_to_gimp(QImage& image) +// { +// int is_rgb = 0; +// int x,y; +// int remaining; +// size_t tile_size; +// GimpImageBaseType image_type = GIMP_GRAY; +// GimpImageType drawable_type = GIMP_GRAY_IMAGE; +// gint32 layer_ID; +// gint32 image_ID; +// GimpDrawable *drawable; +// guchar *tile; +// GimpPixelRgn region; +// unsigned int tile_offset = 0; + +// tile_size = image.width() * gimp_tile_height(); +// if(image.depth() == 32) +// { +// is_rgb = 1; +// tile_size *= 3; +// image_type = GIMP_RGB; +// drawable_type = GIMP_RGB_IMAGE; +// } + +// image_ID = gimp_image_new(image.width(),image.height(),image_type); +// layer_ID = gimp_layer_new(image_ID,"Background",image.width(),image.height(), +// drawable_type, 100.0, GIMP_NORMAL_MODE); +// gimp_image_set_resolution(image_ID, +// int(double(image.dotsPerMeterX()) * 2.54 / 100.0), +// int(double(image.dotsPerMeterY()) * 2.54 / 100.0)); +// gimp_image_add_layer(image_ID, layer_ID, 0); +// drawable = gimp_drawable_get(layer_ID); +// gimp_pixel_rgn_init(®ion, drawable, 0, 0, drawable->width, drawable->height, TRUE, FALSE); +// tile = g_new(guchar, tile_size); +// x=0; +// y=0; +// for(y = 0; y < image.height(); y++) +// { +// for(x = 0; x < image.width(); x++) +// { +// QRgb rgb = image.pixel(x,y); +// if(is_rgb == 1) +// { +// tile[tile_offset] = (guchar)qRed(rgb); +// ++tile_offset; +// tile[tile_offset] = (guchar)qGreen(rgb); +// ++tile_offset; +// tile[tile_offset] = (guchar)qBlue(rgb); +// ++tile_offset; +// } +// else +// { +// tile[tile_offset] = (guchar)qGray(rgb); +// ++tile_offset; +// } +// } +// int tile_height = gimp_tile_height(); +// if ((y+1) % tile_height == 0) +// { +// gimp_pixel_rgn_set_rect(®ion, tile,0,(y+1) - tile_height,image.width(),tile_height); +// tile_offset = 0; +// } +// } +// remaining = image.height() % gimp_tile_height(); + +// if (remaining) +// { +// gimp_pixel_rgn_set_rect(®ion, tile, 0, image.height() - remaining, +// image.width(), remaining); +// } + +// gimp_drawable_flush(drawable); +// gimp_display_new(image_ID); +// gimp_drawable_detach(drawable); +// g_free(tile); +// tile = 0; +// return 0; +// } diff --git a/scribo/demo/scribogimpplugin/src/ocr_options.cc b/scribo/demo/scribogimpplugin/src/ocr_options.cc new file mode 120000 index 0000000..c5f8414 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/ocr_options.cc @@ -0,0 +1 @@ +../../viewer/ocr_options.cc \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/ocr_options.hh b/scribo/demo/scribogimpplugin/src/ocr_options.hh new file mode 120000 index 0000000..e2b44ea --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/ocr_options.hh @@ -0,0 +1 @@ +../../viewer/ocr_options.hh \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/ocr_options.ui b/scribo/demo/scribogimpplugin/src/ocr_options.ui new file mode 120000 index 0000000..69e245c --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/ocr_options.ui @@ -0,0 +1 @@ +../../viewer/ocr_options.ui \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/option_widget.cc b/scribo/demo/scribogimpplugin/src/option_widget.cc new file mode 120000 index 0000000..2a1b3c2 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/option_widget.cc @@ -0,0 +1 @@ +../../viewer/option_widget.cc \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/option_widget.hh b/scribo/demo/scribogimpplugin/src/option_widget.hh new file mode 120000 index 0000000..cd3415a --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/option_widget.hh @@ -0,0 +1 @@ +../../viewer/option_widget.hh \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/preferences_dialog.cc b/scribo/demo/scribogimpplugin/src/preferences_dialog.cc new file mode 100644 index 0000000..8daea32 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/preferences_dialog.cc @@ -0,0 +1,326 @@ +// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory +// (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <http://www.gnu.org/licenses/>. + +#include <scribo/core/document.hh> + +#include "preferences_dialog.hh" +#include "general_options.hh" +#include "ocr_options.hh" +#include "preprocessing_options.hh" +#include "segmentation_options.hh" + +// FIXME +#include <mln/value/qt/rgb32.hh> +#include <mln/data/convert.hh> +#include <mln/data/paste_without_localization.hh> +#include <mln/core/image/dmorph/image_if.hh> + + +preferences_dialog::preferences_dialog(QWidget *parent) + : QDialog(parent) +{ + setupUi(this); + + // We may want to remove this useless object in the ui file. + delete widget; + + setAttribute(Qt::WA_DeleteOnClose); + + load_option_list(); + optionList->setCurrentRow(0); + + // Progress dialog setup + pdialog_.setModal(true); + pdialog_.setAutoClose(false); + pdialog_.setCancelButton(0); + connect(&runner_, SIGNAL(finished()), + &pdialog_, SLOT(close())); + connect(&runner_, SIGNAL(finished()), + this, SLOT(diplay_result())); + connect(&runner_, SIGNAL(new_step(const QString&)), + &pdialog_, SLOT(setWindowTitle(const QString&))); + connect(&runner_, SIGNAL(new_progress_max_value(int)), + &pdialog_, SLOT(setMaximum(int))); + connect(&runner_, SIGNAL(new_progress_label(const QString&)), + &pdialog_, SLOT(setLabelText(const QString&))); + + // Runner setup + connect(&runner_, SIGNAL(progress(int)), + &pdialog_, SLOT(setValue(int))); + +} + +preferences_dialog::~preferences_dialog() +{ + for (int i = 0; i < widgets_.size(); ++i) + if (widgets_[i]) + { + static_cast<OptionWidget *>(widgets_[i])->save_config(); + delete widgets_[i]; + } +} + + +void preferences_dialog::set_current_image(const mln::image2d<mln::value::rgb8>& ima, gint32 image_id) +{ + current_image_ = ima; + image_id_ = image_id; +} + + +void preferences_dialog::load_option_list() +{ + static const char *options[] = { "General", "Preprocessing", "Segmentation", "OCR", 0 }; + + int i; + for (i = 0; options[i]; ++i) + optionList->insertItem(i, options[i]); + + widgets_.fill(0, i); +} + +void preferences_dialog::on_optionList_currentRowChanged(int row) +{ + select_option_widget(row); +} + + +void preferences_dialog::select_option_widget(int row) +{ + if (row >= widgets_.size()) + { + qDebug() << "select_option_widget - Hu? Something wrong... Invalid row"; + return; + } + + if (!widgets_[row]) + { + QWidget *widget = 0; + + switch (row) + { + case 0: + widget = new general_options(this); + break; + + case 1: + widget = new preprocessing_options(this); + break; + + case 2: + widget = new segmentation_options(this); + break; + + case 3: + widget = new ocr_options(this); + break; + + default: + qDebug() << "select_option_widget - Hu? Something wrong..."; + } + + if (widget) + widgets_[row] = widget; + } + + if (horizontalLayout_2->count() == 2) + { + QWidget *current_widget = horizontalLayout_2->itemAt(1)->widget(); + horizontalLayout_2->removeWidget(current_widget); + current_widget->hide(); + } + + horizontalLayout_2->insertWidget(1, widgets_[row]); + widgets_[row]->show(); +} + + +void preferences_dialog::accept() +{ + // for (int i = 0; i < widgets_.size(); ++i) + // if (widgets_[i]) + // { + // static_cast<OptionWidget *>(widgets_[i])->save_config(); + // delete widgets_[i]; + // } + hide(); + process(); +// QDialog::accept(); +} + +void preferences_dialog::process() +{ + // Run process ? + reset_progress_dialog(); + std::cout << "Starting demat" << std::endl; + runner_.start_demat(current_image_); + std::cout << "Ending demat" << std::endl; +} + + + + +void preferences_dialog::reject() +{ + for (int i = 0; i < widgets_.size(); ++i) + delete widgets_[i]; + QDialog::reject(); +} + +void preferences_dialog::reset_progress_dialog() +{ + pdialog_.setValue(0); + pdialog_.setLabelText(""); + pdialog_.show(); +} + +void preferences_dialog::diplay_result() +{ + std::cout << "Creating result image" << std::endl; + + // Make sure there is not border in input image. + mln::border::resize(current_image_, 0); + + // Getting retrieved document. + const scribo::document<L>& doc = runner_.result(); + + image2d<value::qt::rgb32> in_32 = data::convert(value::qt::rgb32(), current_image_); + + int + width = current_image_.bbox().width(), + height = current_image_.bbox().height(); + + // Get active drawable in input image. + gint32 drawable_id = gimp_image_get_active_drawable(image_id_); + + // Get coordinates of the processed area in the input image. + gint32 x1, y1, x2, y2; + gimp_drawable_mask_bounds(drawable_id, &x1, &y1, &x2, &y2); + + // Create a new image + gint32 new_image_id = gimp_image_new(width, + height, + gimp_image_base_type(image_id_)); + + /* create background layer */ + gint32 new_layer_id = gimp_layer_new(new_image_id, + "Background", + width, height, + gimp_drawable_type(drawable_id), + 100, + GIMP_NORMAL_MODE); + gimp_image_add_layer(new_image_id, new_layer_id, 0); + + + if (doc.has_text()) + { + /* create new layer */ + gint32 new_layer_id = gimp_layer_new(new_image_id, + "Text", + width, height, + gimp_drawable_type(drawable_id), + 100, + GIMP_NORMAL_MODE); + gimp_image_add_layer(new_image_id, new_layer_id, -1); + gimp_layer_add_alpha(new_layer_id); + + GimpDrawable *new_drawable = gimp_drawable_get(new_layer_id); + GimpPixelRgn new_region; + gimp_pixel_rgn_init(&new_region, new_drawable, x1, y1, x2, y2, TRUE, TRUE); + + for_all_lines(i, doc.lines()) + if (doc.lines()(i).is_textline()) + { + std::cout << "Drawing text with bbox " << doc.lines()(i).bbox() << std::endl; + const scribo::line_info<L>& line = doc.lines()(i); + + // FIXME: Slow! gimp_pixel_rgn_set_rect does not support + // stride information thus, requires that relevant data in the + // buffer is contiguous. + mln::image2d<value::qt::rgb32> tmp(line.bbox(), 0); + mln::data::paste_without_localization(in_32 | line.bbox(), tmp); + + gimp_pixel_rgn_set_rect(&new_region, + (const guchar *) tmp.buffer(), + line.bbox().pmin().col(), + line.bbox().pmin().row(), + line.bbox().width(), + line.bbox().height()); + } + + /* Tidy up dirty drawable */ + gimp_drawable_flush(new_drawable); + gimp_drawable_merge_shadow(new_drawable->drawable_id, TRUE); + gimp_drawable_update(new_drawable->drawable_id, x1, y1, x2, y2); + gimp_drawable_detach(new_drawable); + + gimp_displays_flush(); + } + + + if (doc.has_whitespace_seps()) + std::cout << "doc has whitespace seps!" << std::endl; + + + if (doc.has_elements()) + { + /* create new layer */ + gint32 new_layer_id = gimp_layer_new(new_image_id, + "Elements", + width, height, + gimp_drawable_type(drawable_id), + 100, + GIMP_NORMAL_MODE); + gimp_image_add_layer(new_image_id, new_layer_id, -1); + gimp_layer_add_alpha(new_layer_id); + + GimpDrawable *new_drawable = gimp_drawable_get(new_layer_id); + GimpPixelRgn new_region; + gimp_pixel_rgn_init(&new_region, new_drawable, x1, y1, x2, y2, TRUE, TRUE); + + for_all_comps(i, doc.elements()) + if (doc.elements()(i).is_valid()) + { + std::cout << "Drawing image with bbox " << doc.elements()(i).bbox() << std::endl; + const scribo::component_info<L>& elt = doc.elements()(i); + + // FIXME: Slow! gimp_pixel_rgn_set_rect does not support + // stride information thus, requires that relevant data in the + // buffer is contiguous. + mln::image2d<value::qt::rgb32> tmp(elt.bbox(), 0); + mln::data::paste_without_localization(in_32 | elt.bbox(), tmp); + + gimp_pixel_rgn_set_rect(&new_region, + (const guchar *) tmp.buffer(), + elt.bbox().pmin().col(), + elt.bbox().pmin().row(), + elt.bbox().width(), + elt.bbox().height()); + } + + /* Tidy up dirty drawable */ + gimp_drawable_flush(new_drawable); + gimp_drawable_merge_shadow(new_drawable->drawable_id, TRUE); + gimp_drawable_update(new_drawable->drawable_id, x1, y1, x2, y2); + gimp_drawable_detach(new_drawable); + + gimp_displays_flush(); + } + + /* free buffer */ + gimp_display_new(new_image_id); +} diff --git a/scribo/demo/scribogimpplugin/src/preferences_dialog.hh b/scribo/demo/scribogimpplugin/src/preferences_dialog.hh new file mode 100644 index 0000000..1e6f163 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/preferences_dialog.hh @@ -0,0 +1,70 @@ +// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory +// (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <http://www.gnu.org/licenses/>. + +#ifndef SCRIBO_DEMO_VIEWER_PREFERENCES_DIALOG_HH +# define SCRIBO_DEMO_VIEWER_PREFERENCES_DIALOG_HH + +extern "C" +{ +#include <libgimp/gimp.h> +} + + +# include <QtGui> +# include <preferences_dialog.ui.h> + +# include <runner.hh> + +# include <mln/core/image/image2d.hh> +# include <scribo/core/def/lbl_type.hh> + + +class preferences_dialog : public QDialog, private Ui::PreferencesDialog +{ + Q_OBJECT; + + typedef mln::image2d<scribo::def::lbl_type> L; + +public: + preferences_dialog(QWidget *parent = 0); + ~preferences_dialog(); + + void set_current_image(const mln::image2d<mln::value::rgb8>& ima, gint32 image_id); + +private slots: + void on_optionList_currentRowChanged(int row); + virtual void accept(); + virtual void reject(); + void diplay_result(); + +private: // Methods + void load_option_list(); + void select_option_widget(int row); + void reset_progress_dialog(); + void process(); + +private: // Attributes + QVector<QWidget *> widgets_; + + runner runner_; + QProgressDialog pdialog_; + + mln::image2d<mln::value::rgb8> current_image_; + gint32 image_id_; +}; + +#endif // ! SCRIBO_DEMO_VIEWER_PREFERENCES_DIALOG_HH diff --git a/scribo/demo/scribogimpplugin/src/preferences_dialog.ui b/scribo/demo/scribogimpplugin/src/preferences_dialog.ui new file mode 100644 index 0000000..147c545 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/preferences_dialog.ui @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PreferencesDialog</class> + <widget class="QDialog" name="PreferencesDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>668</width> + <height>418</height> + </rect> + </property> + <property name="windowTitle"> + <string>Preferences</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Layout Analysis</span></p></body></html></string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QListWidget" name="optionList"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>200</width> + <height>16777215</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QWidget" name="widget" native="true"/> + </item> + </layout> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>PreferencesDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>PreferencesDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/scribo/demo/scribogimpplugin/src/preprocess.cc b/scribo/demo/scribogimpplugin/src/preprocess.cc new file mode 120000 index 0000000..9635806 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/preprocess.cc @@ -0,0 +1 @@ +../../viewer/preprocess.cc \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/preprocess.hh b/scribo/demo/scribogimpplugin/src/preprocess.hh new file mode 120000 index 0000000..dda1183 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/preprocess.hh @@ -0,0 +1 @@ +../../viewer/preprocess.hh \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/preprocessing_options.cc b/scribo/demo/scribogimpplugin/src/preprocessing_options.cc new file mode 120000 index 0000000..e39fb42 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/preprocessing_options.cc @@ -0,0 +1 @@ +../../viewer/preprocessing_options.cc \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/preprocessing_options.hh b/scribo/demo/scribogimpplugin/src/preprocessing_options.hh new file mode 120000 index 0000000..f13da3c --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/preprocessing_options.hh @@ -0,0 +1 @@ +../../viewer/preprocessing_options.hh \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/preprocessing_options.ui b/scribo/demo/scribogimpplugin/src/preprocessing_options.ui new file mode 120000 index 0000000..be35553 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/preprocessing_options.ui @@ -0,0 +1 @@ +../../viewer/preprocessing_options.ui \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/process.cc b/scribo/demo/scribogimpplugin/src/process.cc new file mode 120000 index 0000000..6f4f6a8 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/process.cc @@ -0,0 +1 @@ +../../viewer/process.cc \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/process.hh b/scribo/demo/scribogimpplugin/src/process.hh new file mode 120000 index 0000000..3bbf208 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/process.hh @@ -0,0 +1 @@ +../../viewer/process.hh \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/runner.cc b/scribo/demo/scribogimpplugin/src/runner.cc new file mode 100644 index 0000000..82e83e2 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/runner.cc @@ -0,0 +1,161 @@ +// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory +// (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <http://www.gnu.org/licenses/>. + +#include "runner.hh" + +#include <mln/core/image/image2d.hh> +#include <mln/value/rgb8.hh> +#include <mln/io/magick/load.hh> + +#include "process.hh" +#include "preprocess.hh" +#include "config.hh" +#include "defs.hh" + + + +using namespace mln; +using namespace scribo::toolchain::internal; + + +runner::runner(QObject *parent) + : QThread(parent) +{ + moveToThread(this); +} + + +void runner::run() +{ + + switch(mode_) + { + default: + case Demat: + { + image2d<bool> bin_ima = preprocess(args_.at(0)); + process(args_.at(0), bin_ima); + } + break; + } + + emit finished(); + qDebug() << "Done."; +} + + +void runner::stop() +{ + terminate(); +} + + + +// Demat related stuff + +void +runner::start_demat(const image2d<value::rgb8>& image) +{ + args_.clear(); + args_ << image; + mode_ = Demat; + + QThread::start(); +} + +const runner::doc_t& +runner::result() const +{ + return doc_; +} + +void +runner::progress_value() +{ + emit progress(++step_); +} + +image2d<bool> +runner::preprocess(const image2d<value::rgb8>& ima) +{ + emit new_step("Preprocessing"); + + ::preprocess f; + + // Load config. + config * const conf = config::get_instance(); + + // Init runner and functor connections. + step_ = 0; + connect(&f, SIGNAL(progress()), this, SLOT(progress_value())); + connect(&f, SIGNAL(new_progress_label(const QString&)), + this, SIGNAL(new_progress_label(const QString&))); + + f.enable_subsample = conf->preprocessing_subsample(); + f.enable_fg_extraction = conf->preprocessing_remove_bg(); + f.enable_deskew = conf->preprocessing_deskew(); + f.enable_denoising = conf->preprocessing_remove_noise(); + + f.binarization_algo = static_cast<Binarization_Algo>(conf->preprocessing_bin_algo()); + + emit new_progress_max_value(f.nsteps()); + + // Perform preprocessing. + f(ima); + + qDebug() << "Preprocess Done."; + return f.output; +} + + +void runner::process(const image2d<value::rgb8>& original_ima, + const image2d<bool>& processed_ima) +{ + emit new_step("Page segmentation"); + + ::process f("fixme.jpg"); + + // Init runner and functor connections. + step_ = 0; + connect(&f, SIGNAL(progress()), this, SLOT(progress_value())); + connect(&f, SIGNAL(new_progress_label(const QString&)), + this, SIGNAL(new_progress_label(const QString&))); + + // Load config. + config * const conf = config::get_instance(); + + defs::FindSeparators + find_seps = static_cast<defs::FindSeparators>(conf->segmentation_find_seps()); + f.enable_line_seps = (find_seps == defs::Lines + || find_seps == defs::LinesAndWhitespaces); + f.enable_whitespace_seps = (find_seps == defs::Whitespaces + || find_seps == defs::LinesAndWhitespaces); + f.enable_ocr = conf->ocr_enabled(); + f.ocr_language = conf->ocr_language().toAscii().data(); + f.save_doc_as_xml = false; + + emit new_progress_max_value(f.nsteps()); + + // Perform text detection. + f(original_ima, processed_ima); + + doc_ = f.doc; + + qDebug() << "Process Done."; +} + + diff --git a/scribo/demo/scribogimpplugin/src/runner.hh b/scribo/demo/scribogimpplugin/src/runner.hh new file mode 100644 index 0000000..d08e1a0 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/runner.hh @@ -0,0 +1,76 @@ +// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of Olena. +// +// Olena is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation, version 2 of the License. +// +// Olena is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Olena. If not, see <http://www.gnu.org/licenses/>. + +#ifndef SCRIBO_DEMO_VIEWER_RUNNER_HH +# define SCRIBO_DEMO_VIEWER_RUNNER_HH + +# include <QtGui> + +# include <mln/core/image/image2d.hh> +# include <mln/value/rgb8.hh> +# include <mln/value/int_u16.hh> +# include <scribo/core/document.hh> +# include <scribo/core/def/lbl_type.hh> + +using namespace mln; + +enum RunMode +{ + Demat, + Export +}; + +class runner : public QThread +{ + Q_OBJECT; + +public: + typedef scribo::document<image2d<scribo::def::lbl_type> > doc_t; + + runner(QObject *parent = 0); + + void start_demat(const image2d<value::rgb8>& filename); + + const doc_t& result() const; + +public slots: + void stop(); + void progress_value(); + +signals: + void new_step(const QString& step_name); + void new_progress_max_value(int i); + void new_progress_label(const QString& msg); + void progress(int step); + void finished(); + +private: // members + image2d<bool> preprocess(const image2d<value::rgb8>& ima); + void process(const image2d<value::rgb8>& original_ima, + const image2d<bool>& processed_ima); + + virtual void run(); + +private: // attributes + QList<image2d<value::rgb8> > args_; + RunMode mode_; + int step_; + + doc_t doc_; +}; + + +#endif // ! SCRIBO_DEMO_VIEWER_RUNNER_HH diff --git a/scribo/demo/scribogimpplugin/src/segmentation_options.cc b/scribo/demo/scribogimpplugin/src/segmentation_options.cc new file mode 120000 index 0000000..8243fb2 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/segmentation_options.cc @@ -0,0 +1 @@ +../../viewer/segmentation_options.cc \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/segmentation_options.hh b/scribo/demo/scribogimpplugin/src/segmentation_options.hh new file mode 120000 index 0000000..7e08b73 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/segmentation_options.hh @@ -0,0 +1 @@ +../../viewer/segmentation_options.hh \ No newline at end of file diff --git a/scribo/demo/scribogimpplugin/src/segmentation_options.ui b/scribo/demo/scribogimpplugin/src/segmentation_options.ui new file mode 120000 index 0000000..3727c19 --- /dev/null +++ b/scribo/demo/scribogimpplugin/src/segmentation_options.ui @@ -0,0 +1 @@ +../../viewer/segmentation_options.ui \ No newline at end of file -- 1.7.2.5
participants (1)
-
Guillaume Lazzara