diff --git a/.gitignore b/.gitignore index 5f66c5b561c..feb692e12cf 100644 --- a/.gitignore +++ b/.gitignore @@ -233,3 +233,11 @@ synfig-studio/doc /.project /.cproject /.settings/ + +# ------------------------------------------------------------------------ +# Netbeans projects +# ------------------------------------------------------------------------ +/nbproject/ +/ETL/nbproject/ +/synfig-core/nbproject/ +/synfig-studio/nbproject/ diff --git a/autobuild/default-nixpkgs.nix b/autobuild/default-nixpkgs.nix index 11c63f76bd4..a53ffb48e0d 100644 --- a/autobuild/default-nixpkgs.nix +++ b/autobuild/default-nixpkgs.nix @@ -52,7 +52,7 @@ let ETL boost cairo fftw glibmm intltool libjpeg libsigcxx libxmlxx mlt imagemagick pango which ]; - + preConfigure = "./bootstrap.sh"; }; @@ -68,7 +68,7 @@ stdenv.mkDerivation rec { buildInputs = [ ETL boost cairo fftw glibmm gnome3.defaultIconTheme gtk3 gtkmm3 imagemagick intltool libjack2 libsigcxx libxmlxx makeWrapper mlt - synfig which + synfig which SDL2 SDL2_mixer ]; postInstall = '' diff --git a/autobuild/default.nix b/autobuild/default.nix index 19d8a4f061a..9faeae67769 100644 --- a/autobuild/default.nix +++ b/autobuild/default.nix @@ -30,26 +30,26 @@ stdenv.mkDerivation rec { buildInputs = [ boost cairo ffmpeg fftw intltool glibmm gnome3.defaultIconTheme gtk3 gtkmm3 imagemagick intltool libjpeg libjack2 libsigcxx libxmlxx mlt - pango which + pango which SDL2 SDL2_mixer ]; - + preConfigure = ""; configureScript = ""; - + BOOST_CONFIGURE_OPTIONS = " --with-boost=${boost.dev} --with-boost-libdir=${boost.out}/lib "; ADWAITA_PATH = "${gnome3.adwaita-icon-theme.out}"; MAKE_WRAPPER_PATH = "${makeWrapper.out}"; - + sourceRoot = "."; - + postUnpack = '' touch configure.ac ''; - + buildPhase = '' PREFIX=$out ./autobuild/build.sh ''; - + installPhase = '' echo ''; diff --git a/autobuild/install-requirements-linux.sh b/autobuild/install-requirements-linux.sh index e1c3e050a64..96d9b96c923 100755 --- a/autobuild/install-requirements-linux.sh +++ b/autobuild/install-requirements-linux.sh @@ -24,6 +24,8 @@ DEB_LIST_MINIMAL="\ libatk1.0-dev \ libgl1-mesa-dev \ imagemagick \ + libsdl2-dev \ + libsdl2-mixer-dev \ bzip2" if which dnf >/dev/null; then # @@ -64,7 +66,9 @@ if which dnf >/dev/null; then ocl-icd-devel \ opencl-headers \ gtkmm30-devel \ - glibmm24-devel" + glibmm24-devel \ + SDL2-devel \ + SDL2_mixer-devel" fi if ! ( rpm -qv $PKG_LIST ); then echo "Running dnf (you need root privelegies to do that)..." @@ -109,7 +113,9 @@ elif which yum >/dev/null; then ocl-icd-devel \ opencl-headers \ gtkmm30-devel \ - glibmm24-devel" + glibmm24-devel \ + SDL2-devel \ + SDL2_mixer-devel" fi if ! ( rpm -qv $PKG_LIST ); then echo "Running yum (you need root privelegies to do that)..." diff --git a/autobuild/osx/brew/install-requirements-osx.sh b/autobuild/osx/brew/install-requirements-osx.sh index 897f8e9b9fe..20824ad6d0e 100755 --- a/autobuild/osx/brew/install-requirements-osx.sh +++ b/autobuild/osx/brew/install-requirements-osx.sh @@ -13,7 +13,7 @@ set -e -PACKAGES="autoconf automake ccache libtool intltool gettext pkg-config glibmm libxml++ cairo fftw pango mlt boost gtkmm3" +PACKAGES="autoconf automake ccache libtool intltool gettext pkg-config glibmm libxml++ cairo fftw pango mlt boost gtkmm3 ывд2 sdl2_mixer" export HOMEBREW_NO_AUTO_UPDATE=1 export HOMEBREW_NO_ANALYTICS=1 diff --git a/autobuild/synfigstudio-osx-build.sh b/autobuild/synfigstudio-osx-build.sh index 375e3c1076a..4ca7185ff69 100755 --- a/autobuild/synfigstudio-osx-build.sh +++ b/autobuild/synfigstudio-osx-build.sh @@ -16,14 +16,14 @@ # # # = Usage notes = -# +# # * You need to have XCode and git installed # * Builds from current repository, current revision. So you should manually checkout the desired revision to build # * If no repository found - then sources fetched into ~/src/synfig and the latest master branch is built # * Executing script without arguments makes a full clean build and produces dmg package -# * You can pass arguments to the script to invoke particular stage. +# * You can pass arguments to the script to invoke particular stage. # Available stages: mkmacports, mkdeps, mketl, mksynfig, mksynfigstudio, mkapp, mkdmg -# Example: +# Example: # synfigstudio-osx-build.sh mkdeps # * You can pass a custom command to be invoked in the build environment. # Example (uninstalls glibmm package from the buildroot): @@ -105,19 +105,19 @@ fi prepare() { # == workarounds == - + #We should do that, otherwise python won't build: if [ -e $MACPORTS/tmp/app ]; then [ ! -e $MACPORTS/tmp/app.bak ] || rm -rf $MACPORTS/tmp/app.bak echo "Backing up custom /Applications/MacPorts dir..." mv $MACPORTS/tmp/app $MACPORTS/tmp/app.bak || true fi - + # Cleanup some stuff, remaining from older installations rm /Library/LaunchDaemons/org.macports.rsyncd.plist || true - + # == symlinks == - + if [ ! -e "$BUILDDIR" ]; then mkdir -p "$BUILDDIR" fi @@ -206,11 +206,11 @@ mkdeps() rm -rf "$MACPORTS" mkmacports fi - + # Don't write into /Applications/MacPorts [ -d $MACPORTS/tmp/app ] || mkdir -p $MACPORTS/tmp/app sed -i "" -e "s|/Applications/MacPorts|$MACPORTS/tmp/app|g" "$MACPORTS/etc/macports/macports.conf" || true - + if [[ ! $UNIVERSAL == 0 ]]; then if [[ $X11 == 1 ]]; then echo "+universal +x11 +nonfree" > $MACPORTS/etc/macports/variants.conf @@ -224,23 +224,23 @@ mkdeps() echo "+no_x11 +quartz -x11 +nonfree" > $MACPORTS/etc/macports/variants.conf fi fi - + pushd ${SCRIPTPATH}/macports portindex popd echo "file://${SCRIPTPATH}/macports [nosync]" > $MACPORTS/etc/macports/sources.conf echo "rsync://rsync.macports.org/release/tarballs/ports.tar [default]" >> $MACPORTS/etc/macports/sources.conf - + # workaround the bug introduced in MacPorts 2.2.0 - https://trac.macports.org/ticket/39850 cp -rf $MACPORTS/etc/macports/macports.conf $MACPORTS/etc/macports/macports.conf.bak sed '/sandbox_enable/d' $MACPORTS/etc/macports/macports.conf.bak > $MACPORTS/etc/macports/macports.conf echo "sandbox_enable no" >> $MACPORTS/etc/macports/macports.conf port selfupdate - + # We have to make sure python 2 is default, because some packages won't build with python 3 port select --set python python27 || true - + port upgrade outdated || true CORE_DEPS=" \ @@ -259,14 +259,16 @@ mkdeps() ffmpeg \ boost \ cairo \ - libtool" + libtool \ + libsdl2 \ + libsdl2_mixer" STUDIO_DEPS=" \ gtkmm3 \ python33 \ gnome-themes-standard \ intltool" port install -f $CORE_DEPS $STUDIO_DEPS - + # We have to make sure python 2 is default, because some packages won't build with python 3 port select --set python python27 @@ -274,7 +276,7 @@ mkdeps() pushd $MACPORTS/bin/ > /dev/null ln -sf python3.3 python3 popd > /dev/null - + cp ${SCRIPTPATH}/gtk-3.0/settings.ini ${MACPORTS}/etc/gtk-3.0/ } @@ -311,7 +313,7 @@ mksynfigstudio() # Copy launch script, so we can test synfigstudio without building an app package [ ! -e "${MACPORTS}/../MacOS" ] || rm -rf "${MACPORTS}/../MacOS" cp -rf $SCRIPTPATH/app-template/Contents/MacOS ${MACPORTS}/../MacOS - + # building synfig-studio pushd ${SYNFIG_REPO_DIR}/synfig-studio @@ -328,7 +330,7 @@ mksynfigstudio() do cp -f $n ${MACPORTS} done - + popd } @@ -336,11 +338,11 @@ mkapp() { VERSION=`get_version_release_string` echo Now trying to build your new SynfigStudio app ... - + DIR=`dirname "$BUILDDIR"` APPDIR="$DIR/SynfigStudio-new-app" APPCONTENTS="$APPDIR/Contents/Resources" - + # initial cleanup [ ! -e $DIR/SynfigStudio-new-app ] || rm -rf $DIR/SynfigStudio-new-app [ ! -e $DIR/SynfigStudio.app ] || rm -rf $DIR/SynfigStudio.app @@ -352,14 +354,14 @@ mkapp() #cp -R "$MACPORTS/bin/ffmpeg" "$APPCONTENTS/bin" #"$SCRIPTPATH/macos-gather-deps.sh" "$APPCONTENTS/bin/ffmpeg" #exit 0 - + #cp -R "$MACPORTS/synfig/bin/synfig" "$APPCONTENTS/bin" mkdir -p "$APPCONTENTS/etc" mkdir -p "$APPCONTENTS/share" - + # Synfig "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/synfig/bin/synfig" "$MACPORTS" "$APPCONTENTS" - "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/synfig/bin/synfigstudio" "$MACPORTS" "$APPCONTENTS" + "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/synfig/bin/synfigstudio" "$MACPORTS" "$APPCONTENTS" pushd "$MACPORTS/synfig/lib/synfig/modules/" for FILE in `ls -1 *.so`; do "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/synfig/lib/synfig/modules/$FILE" "$MACPORTS" "$APPCONTENTS" @@ -368,13 +370,13 @@ mkapp() popd cp -R "$MACPORTS/synfig/etc" "$APPCONTENTS/synfig/" cp -R "$MACPORTS/synfig/share" "$APPCONTENTS/synfig/" - + "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/bin/ffmpeg" "$MACPORTS" "$APPCONTENTS" "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/bin/ffprobe" "$MACPORTS" "$APPCONTENTS" - + "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/bin/encodedv" "$MACPORTS" "$APPCONTENTS" "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/bin/sox" "$MACPORTS" "$APPCONTENTS" - + # Gtk3 "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/bin/gdk-pixbuf-query-loaders" "$MACPORTS" "$APPCONTENTS" "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/bin/gdk-pixbuf-pixdata" "$MACPORTS" "$APPCONTENTS" @@ -409,7 +411,7 @@ mkapp() cp -R "$MACPORTS/lib/girepository-1.0" "$APPCONTENTS/lib/" mkdir -p "$APPCONTENTS/share/glib-2.0/" cp -R "$MACPORTS/share/glib-2.0/schemas" "$APPCONTENTS/share/glib-2.0" - + # Python 3 "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/bin/python3" "$MACPORTS" "$APPCONTENTS" "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/Library/Frameworks/Python.framework/Versions/3.3/Resources/Python.app/Contents/MacOS/Python" "$MACPORTS" "$APPCONTENTS" @@ -417,7 +419,7 @@ mkapp() rsync -av --exclude "__pycache__" "$MACPORTS/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/" "$APPCONTENTS/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/" #cp -R "$MACPORTS/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3" "$APPCONTENTS/Library/Frameworks/Python.framework/Versions/3.3/lib/" #find $APPCONTENTS/Library/Frameworks/Python.framework/Versions/3.3/lib -name "__pycache__" -exec rm -rf {} \; - + # MLT "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/bin/melt" "$MACPORTS" "$APPCONTENTS" pushd "$MACPORTS/lib/mlt/" @@ -426,7 +428,7 @@ mkapp() done popd cp -R "$MACPORTS/share/mlt" "$APPCONTENTS/share/" - + # ImageMagick "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/bin/animate" "$MACPORTS" "$APPCONTENTS" "$SCRIPTPATH/osx-relocate-binary.sh" "$MACPORTS/bin/composite" "$MACPORTS" "$APPCONTENTS" @@ -445,15 +447,15 @@ mkapp() popd cp -R "$MACPORTS/lib/ImageMagick-6.9.2/config-Q16" "$APPCONTENTS/lib/ImageMagick-6.9.2/" cp -R "$MACPORTS/etc/ImageMagick-6" "$APPCONTENTS/etc/" - + cp -R "$MACPORTS/share/icons" "$APPCONTENTS/share/" cp -R "$MACPORTS/share/themes" "$APPCONTENTS/share/" cp -R "$MACPORTS/share/mime" "$APPCONTENTS/share/" - + # app bundle files echo "*** Please do _NOT_ delete this file. The file script depends on it. ***" > "$APPCONTENTS/v$VERSION" - sed -i "" -e "s/_VERSION_/$VERSION/g" "$APPDIR/Contents/MacOS/SynfigStudio" - sed -i "" -e "s/_VERSION_/$VERSION/g" "$APPDIR/Contents/Info.plist" + sed -i "" -e "s/_VERSION_/$VERSION/g" "$APPDIR/Contents/MacOS/SynfigStudio" + sed -i "" -e "s/_VERSION_/$VERSION/g" "$APPDIR/Contents/Info.plist" # save information about the ports which make up this build echo "Synfig Studio $VERSION for Mac OS X $OSNAME" > "$APPCONTENTS/build-info.txt" @@ -471,7 +473,7 @@ mkapp() mkdmg() { cd ~ - + # get OS major version OSXVER=`uname -r | cut -f 1 -d '.'` @@ -485,13 +487,13 @@ mkdmg() else export FINAL_FILENAME=SynfigStudio-"$VERSION"."$ARCH" fi - + VOLNAME="SynfigStudio" TRANSITORY_FILENAME="synfig-wla.sparseimage" - + APPDIR=`dirname "$BUILDDIR"`/SynfigStudio.app - + /usr/bin/hdiutil detach /Volumes/"$VOLNAME" || true echo "Creating and attaching disk image..." @@ -543,7 +545,7 @@ get_version_release_string() #fi VERSION=${VERSION%%-*} fi - if [ ! -z $BREED ]; then + if [ ! -z $BREED ]; then BREED=`echo $BREED | tr _ . | tr - .` # No "-" or "_" characters, becuse RPM and DEB complain BREED=.$BREED fi @@ -609,7 +611,7 @@ do_cleanup() ###=================================== MAIN ====================================== main() # dummy for navigation -{ +{ true } diff --git a/synfig-studio/Makefile.am b/synfig-studio/Makefile.am index 8e9b20230d3..e6c8789cd4e 100644 --- a/synfig-studio/Makefile.am +++ b/synfig-studio/Makefile.am @@ -23,7 +23,7 @@ MAINTAINERCLEANFILES = \ config.status \ .doc_stamp \ .DS_Store - + DISTCLEANFILES = \ synfigstudio.desktop \ $(appdata_DATA) @@ -32,11 +32,16 @@ if WITH_IMAGES IMAGE_DIR = images endif +#if WITH_SOUNDS +SOUND_DIR = sounds +#endif + SUBDIRS = \ build_tools \ brushes \ src \ $(IMAGE_DIR) \ + $(SOUND_DIR) \ plugins \ po @@ -57,7 +62,6 @@ EXTRA_DIST = \ synfigstudio.xml.in \ synfigstudio-thumbnailer.schemas.in - DISTCHECK_CONFIGURE_FLAGS = --disable-update-mimedb # Desktop entry @@ -104,7 +108,7 @@ stats: -@wc -l `shell find $(top_srcdir)/src -name '*.[ch]*' | $(GREP) -v libavcodec` | $(GREP) total -@$(PRINTF) "Total size: " -@du -hcs `shell find $(top_srcdir)/src -name '*.[ch]*' | $(GREP) -v libavcodec` | $(GREP) total - -@echo + -@echo listfixmes: -@echo diff --git a/synfig-studio/configure.ac b/synfig-studio/configure.ac index 3ac7987d71f..9a63bf9c6c2 100755 --- a/synfig-studio/configure.ac +++ b/synfig-studio/configure.ac @@ -22,6 +22,7 @@ API_VERSION=1.0 imageext=png imagedir="${datadir}/pixmaps/synfigstudio" plugindir="${datadir}/synfig/plugins" +sounddir="${datadir}/synfig/sounds" GETTEXT_PACKAGE=synfigstudio LOCALEDIR=[${prefix}/${DATADIRNAME}/locale] @@ -94,6 +95,26 @@ esac # -- L I B R A R I E S ---------------------------------------- +#AC_INIT +#m4_include([m4/sdl.m4]) +m4_include([m4/sdl2.m4]) +AC_CONFIG_MACRO_DIR([m4]) + +dnl Check for SDL +#SDL_VERSION=1.2.0 +#AM_PATH_SDL($SDL_VERSION,:,AC_MSG_ERROR([*** SDL version $SDL_VERSION not found! ***])) +#SDL_CFLAGS=$(sdl-config --cflags) +#SDL_LIBS=$(sdl-config --libs) + +SDL_VERSION=2.0 +AM_PATH_SDL2($SDL_VERSION,:,AC_MSG_ERROR([*** SDL version $SDL_VERSION not found! ***])) + +SDL_CFLAGS=$(sdl2-config --cflags) +SDL_LIBS=$(sdl2-config --libs) + +CFLAGS="$CFLAGS $SDL_CFLAGS" +LIBS="$LIBS $SDL_LIBS -lSDL2_mixer" + # Gtk compatibility hacks: # Since 3.14 some our hacks for GUI decorations works in other way # Since 3.14 for checkboxes STATE_FLAG_ACTIVE replaced with STATE_FLAG_CHECKED @@ -169,6 +190,7 @@ AC_SUBST(API_VERSION) AC_SUBST(imageext) AC_SUBST(imagedir) AC_SUBST(plugindir) +AC_SUBST(sounddir) AC_PATH_PROG(UPDATE_MIME_DATABASE, update-mime-database, no) AC_ARG_ENABLE(update-mimedb, @@ -177,7 +199,7 @@ AC_ARG_ENABLE(update-mimedb, enable_update_mimedb=yes) AM_CONDITIONAL(ENABLE_UPDATE_MIMEDB, (test x$enable_update_mimedb = xyes) && (test x$UPDATE_MIME_DATABASE != xno)) -AC_ARG_WITH([images], +AC_ARG_WITH([images], AS_HELP_STRING([--without-images], [skip building images]), [], [with_images=yes] @@ -204,6 +226,7 @@ AC_CONFIG_FILES([ plugins/Makefile plugins/add-skeleton-simple/Makefile plugins/view-unhide-all-layers/Makefile + sounds/Makefile ]) AC_OUTPUT @@ -226,6 +249,8 @@ Build images ---------------------> $with_images "'$'"CXX ------------------------------> '$CXX' "'$'"CXXFLAGS -------------------------> '$CXXFLAGS' "'$'"LDFLAGS --------------------------> '$LDFLAGS' +"'$'"SDL_CFLAGS -----------------------> '$SDL_CFLAGS' +"'$'"SDL_LIBS -------------------------> '$SDL_LIBS' "'$'"SYNFIG_CFLAGS --------------------> '$SYNFIG_CFLAGS' "'$'"SYNFIG_LIBS ----------------------> '$SYNFIG_LIBS' "'$'"GTKMM_CFLAGS ---------------------> '$GTKMM_CFLAGS' diff --git a/synfig-studio/m4/sdl2.m4 b/synfig-studio/m4/sdl2.m4 new file mode 100644 index 00000000000..b915f99edec --- /dev/null +++ b/synfig-studio/m4/sdl2.m4 @@ -0,0 +1,234 @@ +# Configure paths for SDL +# Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor +# +# Changelog: +# * also look for SDL2.framework under Mac OS X + +# serial 1 + +dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS +dnl +AC_DEFUN([AM_PATH_SDL2], +[dnl +dnl Get the cflags and libraries from the sdl2-config script +dnl +AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], + sdl_prefix="$withval", sdl_prefix="") +AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], + sdl_exec_prefix="$withval", sdl_exec_prefix="") +AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], + , enable_sdltest=yes) +AC_ARG_ENABLE(sdlframework, [ --disable-sdlframework Do not search for SDL2.framework], + , search_sdl_framework=yes) + +AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) + + min_sdl_version=ifelse([$1], ,2.0.0,$1) + + if test "x$sdl_prefix$sdl_exec_prefix" = x ; then + PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version], + [sdl_pc=yes], + [sdl_pc=no]) + else + sdl_pc=no + if test x$sdl_exec_prefix != x ; then + sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL2_CONFIG+set} != xset ; then + SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" + if test x${SDL2_CONFIG+set} != xset ; then + SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + fi + fi + fi + + if test "x$sdl_pc" = xyes ; then + no_sdl="" + SDL2_CONFIG="pkg-config sdl2" + else + as_save_PATH="$PATH" + if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then + PATH="$prefix/bin:$prefix/usr/bin:$PATH" + fi + AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) + PATH="$as_save_PATH" + no_sdl="" + + if test "$SDL2_CONFIG" = "no" -a "x$search_sdl_framework" = "xyes"; then + AC_MSG_CHECKING(for SDL2.framework) + if test "x$SDL2_FRAMEWORK" != x; then + sdl_framework=$SDL2_FRAMEWORK + else + for d in / ~/ /System/; do + if test -d "$dLibrary/Frameworks/SDL2.framework"; then + sdl_framework="$dLibrary/Frameworks/SDL2.framework" + fi + done + fi + + if test -d $sdl_framework; then + AC_MSG_RESULT($sdl_framework) + sdl_framework_dir=`dirname $sdl_framework` + SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include" + SDL_LIBS="-F$sdl_framework_dir -Wl,-framework,SDL2" + else + no_sdl=yes + fi + fi + + if test "$SDL2_CONFIG" != "no"; then + if test "x$sdl_pc" = "xno"; then + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + fi + + sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SDL is sufficiently new. (Also sanity +dnl checks the results of sdl2-config to some extent +dnl + rm -f conf.sdltest + AC_TRY_RUN([ +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdltest"); + */ + { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdl_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); + printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + + fi + if test "x$sdl_pc" = "xno"; then + if test "x$no_sdl" = "xyes"; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + fi + fi + fi + fi + if test "x$no_sdl" = x ; then + ifelse([$2], , :, [$2]) + else + if test "$SDL2_CONFIG" = "no" ; then + echo "*** The sdl2-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL2_CONFIG environment variable to the" + echo "*** full path to sdl2-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + AC_TRY_LINK([ +#include +#include "SDL.h" + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SDL_CFLAGS) + AC_SUBST(SDL_LIBS) + rm -f conf.sdltest +]) diff --git a/synfig-studio/sounds/Makefile.am b/synfig-studio/sounds/Makefile.am new file mode 100644 index 00000000000..243a550b4d9 --- /dev/null +++ b/synfig-studio/sounds/Makefile.am @@ -0,0 +1,9 @@ +# $Id$ + +MAINTAINERCLEANFILES = Makefile.in + +SOUNDS = readme.txt \ + renderdone.wav + +#sounddir = ${datadir}/synfig/sounds +sound_DATA = $(SOUNDS) diff --git a/synfig-studio/sounds/readme.txt b/synfig-studio/sounds/readme.txt new file mode 100644 index 00000000000..769e2abcc74 --- /dev/null +++ b/synfig-studio/sounds/readme.txt @@ -0,0 +1,7 @@ +Samples origins and licenses +============================ + +renderdone.wav +-------------- +BobSynfig / Public Domain +E arppegio Glockenspiel (patch #43) - Yamaha PSS-790 diff --git a/synfig-studio/sounds/renderdone.wav b/synfig-studio/sounds/renderdone.wav new file mode 100644 index 00000000000..f0c5631b038 Binary files /dev/null and b/synfig-studio/sounds/renderdone.wav differ diff --git a/synfig-studio/src/gui/Makefile.am b/synfig-studio/src/gui/Makefile.am index 103292a0330..55f4f98d462 100644 --- a/synfig-studio/src/gui/Makefile.am +++ b/synfig-studio/src/gui/Makefile.am @@ -112,7 +112,8 @@ synfigstudio_LDADD = \ ../synfigapp/libsynfigapp.la \ @SYNFIG_LIBS@ \ @GTKMM_LIBS@ \ - @JACK_LIBS@ + @JACK_LIBS@ \ + @SDL_LIBS@ synfigstudio_LDFLAGS = \ -dlopen self @@ -121,7 +122,9 @@ synfigstudio_CXXFLAGS = \ @SYNFIG_CFLAGS@ \ @GTKMM_CFLAGS@ \ @JACK_CFLAGS@ \ + @SDL_CFLAGS@ \ -DIMAGE_DIR=\"$(imagedir)\" \ -DIMAGE_EXT=\"$(imageext)\" \ -DPLUGIN_DIR=\"$(plugindir)\" \ + -DSOUND_DIR=\"$(sounddir)\" \ -DLOCALEDIR=\"${LOCALEDIR}\" diff --git a/synfig-studio/src/gui/app.cpp b/synfig-studio/src/gui/app.cpp index f874dc5165a..b3ea2e95ba9 100644 --- a/synfig-studio/src/gui/app.cpp +++ b/synfig-studio/src/gui/app.cpp @@ -147,6 +147,9 @@ #include +#include +#include + #endif /* === U S I N G =========================================================== */ @@ -189,6 +192,17 @@ using namespace studio; # define PLUGIN_DIR "/usr/local/share/synfig/plugins" #endif +#ifdef _WIN32 +# ifdef SOUND_DIR +# undef SOUND_DIR +# define SOUND_DIR "share\\synfig\\sounds" +# endif +#endif + +#ifndef SOUND_DIR +# define SOUND_DIR "/usr/local/share/synfig/sounds" +#endif + #include /* === S I G N A L S ======================================================= */ @@ -338,6 +352,9 @@ delete_widget(Gtk::Widget *widget) Glib::signal_timeout().connect(sigc::bind(sigc::ptr_fun(&really_delete_widget), widget), 50); } +//Static members need to be initialized outside of class declaration +Mix_Chunk* App::gRenderDone = NULL; + }; // END of namespace studio studio::StateManager* state_manager; @@ -1739,6 +1756,48 @@ App::App(const synfig::String& basepath, int *argc, char ***argv): { get_ui_interface()->error(_("Unknown exception caught when constructing App.\nThis software may be unstable.")); } + + // + } StateManager* App::get_state_manager() { return state_manager; } @@ -1780,6 +1839,16 @@ App::~App() delete dock_manager; instance_list.clear(); + + // } synfig::String @@ -2215,7 +2284,7 @@ App::apply_gtk_settings() try { css->load_from_data(data); } catch (Gtk::CssProviderError &e) { - synfig::warning("Failed to load css rules. %s", e.what().c_str()); + synfig::warning("Failed to load css rules. %s", e.what().c_str()); } Glib::RefPtr screen = Gdk::Screen::get_default(); Gtk::StyleContext::add_provider_for_screen(screen,css, GTK_STYLE_PROVIDER_PRIORITY_USER); @@ -3560,10 +3629,10 @@ App::open_as(std::string filename,std::string as,synfig::FileContainerZip::file_ // wrap into temporary file system canvas_file_system = wrap_into_temporary_filesystem(canvas_file_system, filename, as, truncate_storage_size); - + // file to open inside canvas file-system String canvas_filename = CanvasFileNaming::project_file(filename); - + etl::handle canvas = open_canvas_as(canvas_file_system ->get_identifier(canvas_filename), as, errors, warnings); if(canvas && get_instance(canvas)) { diff --git a/synfig-studio/src/gui/app.h b/synfig-studio/src/gui/app.h index a41902effb4..22f0168511c 100644 --- a/synfig-studio/src/gui/app.h +++ b/synfig-studio/src/gui/app.h @@ -49,6 +49,9 @@ #include "iconcontroller.h" #include "mainwindow.h" +#include +#include + /* === M A C R O S ========================================================= */ #define MISC_DIR_PREFERENCE "misc_dir" @@ -235,6 +238,9 @@ class App : public Gtk::Main, private IconController static synfig::String ui_language; static long ui_handle_tooltip_flag; + //The sound effects that will be used + static Mix_Chunk* gRenderDone; + /* -- ** -- S I G N A L S ------------------------------------------------------- */ diff --git a/synfig-studio/src/gui/render.cpp b/synfig-studio/src/gui/render.cpp index bfc6799cff7..54d06aad899 100644 --- a/synfig-studio/src/gui/render.cpp +++ b/synfig-studio/src/gui/render.cpp @@ -48,6 +48,9 @@ #include #include +#include +#include + #endif /* === U S I N G =========================================================== */ @@ -169,7 +172,7 @@ RenderSettings::RenderSettings(Gtk::Window& parent, etl::handleattach(toggle_single_frame, 2, 3, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); toggle_single_frame.set_active(false); - + toggle_extract_alpha.set_alignment(0, 0.5); settings_table->attach(toggle_extract_alpha, 2, 3, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); toggle_extract_alpha.set_active(false); @@ -327,38 +330,38 @@ RenderSettings::on_render_pressed() } hide(); - + render_passes.clear(); if (toggle_extract_alpha.get_active()) { String filename_alpha(filename_sans_extension(filename)+"-alpha"+filename_extension(filename)); - + render_passes.push_back(make_pair(TARGET_ALPHA_MODE_EXTRACT, filename_alpha)); render_passes.push_back(make_pair(TARGET_ALPHA_MODE_REDUCE, filename)); - + } else { render_passes.push_back(make_pair(TARGET_ALPHA_MODE_KEEP, filename)); } - + submit_next_render_pass(); - + return; } - + void RenderSettings::submit_next_render_pass() { if (render_passes.size()>0) { pair pass_info = render_passes.back(); render_passes.pop_back(); - + TargetAlphaMode pass_alpha_mode = pass_info.first; #ifdef _WIN32 String pass_filename = Glib::locale_from_utf8(pass_info.second); #else String pass_filename = pass_info.second; #endif - + Target::Handle target=Target::create(calculated_target_name,pass_filename, tparam); if(!target) { @@ -380,7 +383,7 @@ RenderSettings::submit_next_render_pass() // If we are to only render the current frame if(toggle_single_frame.get_active()) rend_desc.set_time(canvas_interface_->get_time()); - + target->set_rend_desc(&rend_desc); target->set_quality((int)adjustment_quality->get_value()); if( !target->init(canvas_interface_->get_ui_interface().get()) ){ @@ -391,7 +394,7 @@ RenderSettings::submit_next_render_pass() target->set_alpha_mode(pass_alpha_mode); canvas_interface_->get_ui_interface()->task(_("Rendering ")+pass_filename); - + /* if(async_renderer) { @@ -427,8 +430,11 @@ RenderSettings::on_finished() canvas_interface_->get_ui_interface()->task(text); canvas_interface_->get_ui_interface()->amount_complete(0,10000); - + submit_next_render_pass(); + + //Sound effect - RenderDone (-1 : play on first free channel, 0 : no repeat) + Mix_PlayChannel( -1, App::gRenderDone, 0 ); } void