diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-06-24 17:50:36 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-06-24 17:50:36 +0000 |
| commit | d71265c629a103d8c821fe85ccf71bd9c93baf47 (patch) | |
| tree | c01fe4543cd48f64a8ca4b60e01e1bb5040922d9 | |
| parent | Working with powerclip and powermask (diff) | |
| parent | Merge branch 'ui-files-for-ui-xml' (diff) | |
| download | inkscape-d71265c629a103d8c821fe85ccf71bd9c93baf47.tar.gz inkscape-d71265c629a103d8c821fe85ccf71bd9c93baf47.zip | |
Updating to master
45 files changed, 1484 insertions, 1245 deletions
diff --git a/.bzrignore b/.bzrignore deleted file mode 100644 index 792535e49..000000000 --- a/.bzrignore +++ /dev/null @@ -1,289 +0,0 @@ -./Info.plist -./Makefile -./ABOUT-NLS -./build -./build.dep -./compile -./compile.lst -./config.guess -./config.h -./config.h.in -./config.log -./config.status -./config.status.lineno -./config.sub -./configure -./depcomp -./inkscape -./inkscape.1 -./inkscape.desktop -./inkscape.de.1 -./inkscape.el.1 -./inkscape.fr.1 -./inkscape.ja.1 -./inkscape.sk.1 -./inkscape.zh_TW.1 -./man/inkscape.1 -./man/inkscape.de.1 -./man/inkscape.de.pod -./man/inkscape.de.tmp -./man/inkscape.el.1 -./man/inkscape.el.pod -./man/inkscape.el.tmp -./man/inkscape.fr.1 -./man/inkscape.fr.pod -./man/inkscape.fr.tmp -./man/inkscape.ja.1 -./man/inkscape.ja.pod -./man/inkscape.ja.tmp -./man/inkscape.pod -./man/inkscape.sk.1 -./man/inkscape.sk.pod -./man/inkscape.sk.tmp -./man/inkscape.tmp -./man/inkscape.zh_TW.1 -./man/inkscape.zh_TW.pod -./man/inkscape.zh_TW.tmp -./man/inkview.pod -./inkscape.appdata.xml -./inkscape.spec -./inkview.1 -./install -./install-sh -./intltool-extract.in -./intltool-merge.in -./intltool-update.in -./libtool -./missing -./stamp-h1 -./CMakeLists.txt.user -.deps -.dirstamp -doc/Makefile -packaging/autopackage/default.apspec -po/.intltool-merge-cache -po/*.gmo -po/boldquot.sed -po/en@boldquot.header -po/en@quot.header -po/insert-header.sin -po/messages.mo -po/Makefile -po/Makefile.in.in -po/Makevars.template -po/POTFILES -po/quot.sed -po/remove-potcdate.sin -po/Rules-quot -po/stamp-it -share/Makefile -share/attributes/Makefile -share/branding/Makefile -share/clipart/Makefile -share/examples/Makefile -share/extensions/Barcode/Makefile -share/extensions/Makefile -share/extensions/Poly3DObjects/Makefile -share/extensions/alphabet_soup/Makefile -share/extensions/ink2canvas/Makefile -share/extensions/test/Makefile -share/extensions/xaml2svg/Makefile -share/filters/Makefile -share/filters/filters.svg.h -share/fonts/Makefile -share/gradients/Makefile -share/icons/Makefile -share/icons/application/16x16/Makefile -share/icons/application/22x22/Makefile -share/icons/application/24x24/Makefile -share/icons/application/256x256/Makefile -share/icons/application/32x32/Makefile -share/icons/application/48x48/Makefile -share/icons/application/Makefile -share/keys/Makefile -share/markers/Makefile -share/palettes/Makefile -share/palettes/palettes.h -share/patterns/Makefile -share/patterns/patterns.svg.h -share/screens/Makefile -share/symbols/Makefile -share/symbols/symbols.h -share/templates/Makefile -share/templates/templates.h -share/tutorials/Makefile -share/ui/Makefile -src/.libs/ -src/2geom/makefile -src/Makefile -src/algorithms/makefile -src/application/makefile -src/bind/makefile -src/check-header-compile -src/cxxtests.cpp -src/debug/makefile -src/dialogs/makefile -src/display/makefile -src/dom/makefile -src/extension/dbus/wrapper/inkdbus.pc -src/extension/implementation/makefile -src/extension/internal/makefile -src/extension/makefile -src/extension/script/makefile -src/filters/makefile -src/helper/makefile -src/helper/sp-marshal.cpp -src/helper/sp-marshal.h -src/inkscape -src/inkscape-version.cpp -src/inkview -src/io/makefile -src/jabber_whiteboard/makefile -src/libavoid/makefile -src/libcroco/makefile -src/libgdl/makefile -src/libnr/makefile -src/libnrtype/makefile -src/libuemf/makefile -src/livarot/makefile -src/live_effects/makefile -src/live_effects/parameter/makefile -src/pedro/makefile -src/removeoverlap/makefile -src/svg/makefile -src/trace/makefile -src/traits/makefile -src/ui/cache/makefile -src/ui/dialog/makefile -src/ui/makefile -src/ui/view/makefile -src/ui/widget/makefile -src/util/makefile -src/widgets/makefile -src/xml/makefile -src/test-main.cpp -src/test-src.cpp -src/display/test-display.cpp -src/helper/test-helper.cpp -src/libnr/test-nr.cpp -src/svg/test-svg.cpp -src/util/test-util.cpp -src/xml/test-xml.cpp -gc.log -ltmain.sh -backup.bzr -mkinstalldirs -Inkscape.config -Inkscape.creator -Inkscape.creator.user -Inkscape.files -Inkscape.includes -# osxapp (X11) -build-osxapp -inst-osxapp -packaging/macosx/ScriptExec/build -packaging/macosx/Inkscape.app - -# cmake bits -cmake_install.cmake -cmake_uninstall.cmake -CMakeCache.txt -CMakeFiles -Makefile -bin/ -lib/ -include/ - -.project -.cproject -.settings -am.po.old -ar.po.old -as.po.old -az.po.old -be.po.old -bg.po.old -bn_BD.po.old -bn.po.old -br.po.old -brx.po.old -ca.po.old -ca@valencia.po.old -cs.po.old -da.po.old -de.po.old -doi.po.old -dz.po.old -el.po.old -en_AU.po.old -en_CA.po.old -en_GB.po.old -en_US@piglatin.po.old -eo.po.old -es_MX.po.old -es.po.old -et.po.old -eu.po.old -fa.po.old -fi.po.old -fr.po.old -ga.po.old -gl.po.old -gu.po.old -he.po.old -hi.po.old -hr.po.old -hu.po.old -hy.po.old -id.po.old -is.po.old -it.po.old -ja.po.old -km.po.old -kn.po.old -kok@latin.po.old -kok.po.old -ko.po.old -ks@aran.po.old -ks@deva.po.old -lt.po.old -lv.po.old -mai.po.old -mk.po.old -ml.po.old -mni@beng.po.old -mni.po.old -mn.po.old -mr.po.old -nb.po.old -ne.po.old -nl.po.old -nn.po.old -or.po.old -pa.po.old -pl.po.old -pt_BR.po.old -pt.po.old -ro.po.old -ru.po.old -rw.po.old -sa.po.old -sat@deva.po.old -sat.po.old -sd@deva.po.old -sd.po.old -sk.po.old -sl.po.old -sq.po.old -sr@latin.po.old -sr.po.old -sv.po.old -ta.po.old -te.po.old -th.po.old -tr.po.old -uk.po.old -ur.po.old -vi.po.old -zh_CN.po.old -zh_TW.po.old diff --git a/.gitignore b/.gitignore index 279750420..af122980b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ -share/filters/filters.svg.h -share/palettes/palettes.h -share/patterns/patterns.svg.h -share/symbols/symbols.h -share/templates/templates.h doxygen_warnings.log doxygen/ +build +share/inkscape +share/*/*.h + +*.old +*.swp + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 34db594a4..2d36019e6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,9 @@ -image: ubuntu:16.04 +# Dependencies are managed in the Dockerfile in the inkscape-ci-docker +# Git repository. Change them there, wait a bit, and then we'll use +# the new ones here in these builds. +image: registry.gitlab.com/inkscape/inkscape-ci-docker/master before_script: - - apt-get update -yqq - # Tools - - apt-get install -y -qq cmake intltool pkg-config python-dev libtool ccache - # Libraries - - apt-get install -y -qq libart-2.0-dev libaspell-dev libboost-dev libcdr-dev libgc-dev libgdl-3-dev libglib2.0-dev libgnomevfs2-dev libgsl-dev libgtk-3-dev libgtkmm-3.0-dev libgtkspell-dev liblcms2-dev libmagick++-dev libpango1.0-dev libpng12-dev libpoppler-glib-dev libpoppler-private-dev libpopt-dev libpotrace-dev librevenge-dev libsigc++-2.0-dev libvisio-dev libwpg-dev libxml-parser-perl libxml2-dev libxslt1-dev libyaml-dev python-lxml zlib1g-dev - # Testing Tools - - apt-get install -y -qq google-mock libgtest-dev # CCache Config - mkdir -p ccache - export CCACHE_BASEDIR=${PWD} @@ -17,22 +13,53 @@ cache: paths: - ccache/ +# Building inkscape inkscape: stage: build script: - mkdir -p build - cd build - cmake .. -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug - - make + - make -j3 - cd .. - - tar vfcz inkscape-build.tgz build/ artifacts: + expire_in: 1 year paths: - - inkscape-build.tgz + - build/ + +# This job is a static analysis build by clang. +# It takes MORE THAN 3 HOURS, and depending on worker sometimes 4 hours. +# Make sure the timeout of the build is big enough +clang: + stage: build + only: + - schedules + script: + - apt-get install -y clang-3.8 clang + - mkdir -p clang-build + - cd clang-build + - scan-build cmake .. -DCMAKE_BUILD_TYPE=Debug + - VERBOSE=1 scan-build -o ../scan make -j2 + artifacts: + paths: + - scan/ test: stage: test script: - - tar xvfz inkscape-build.tgz - cd build - make test + +# uploads the clang scan to user.gitlab.io/inkscape/ +pages: + stage: deploy + when: manual + dependencies: + - clang + script: + - if test -e scan; then cp -r scan/* public; fi + artifacts: + paths: + - public + only: + - master diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b22c2869..8daaabe3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ endif() # console output is slow as hell on Windows and as a result status messages of the "install" target slow down # the whole build process considerably (especially since we also copy a lot of files from the devlibs) # TODO: Is this worth to be configurable / also applicable to other platforms? -if(WIN32) +if(WIN32 AND NOT CMAKE_INSTALL_MESSAGE) set(CMAKE_INSTALL_MESSAGE "LAZY") endif() @@ -70,8 +70,8 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING # ----------------------------------------------------------------------------- # Redirect output files # ----------------------------------------------------------------------------- -set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" ) -set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" ) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "Output directory for runtime binaries") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE PATH "Output directory for libraries") # ----------------------------------------------------------------------------- # Options @@ -99,21 +99,26 @@ option(ENABLE_BINRELOC "Enable relocatable binaries" OFF) # ----------------------------------------------------------------------------- # Test Harness # ----------------------------------------------------------------------------- -if(NOT GMOCK_DIR) - find_path(GMOCK_DIR - NAMES src/gmock.cc - PATHS "$ENV{GMOCK_DIR}" - "/usr/src/googletest/googlemock" - "/usr/src/gmock" - "${CMAKE_SOURCE_DIR}/gtest/gmock-1.7.0" - ) -endif(NOT GMOCK_DIR) - -if(EXISTS "${GMOCK_DIR}" AND IS_DIRECTORY "${GMOCK_DIR}") +find_package(gtest) # gtest 1.8.0 and later already include gmock +if(GTEST_FOUND AND EXISTS "${GTEST_INCLUDE_DIR}/gmock" AND IS_DIRECTORY "${GTEST_INCLUDE_DIR}/gmock") set(GMOCK_PRESENT ON) else() - set(GMOCK_PRESENT OFF) - message("No gmock/gtest found! Perhaps you wish to run 'bash download-gtest.sh' to download it.") + unset(GTEST_FOUND) + if(NOT GMOCK_DIR) + find_path(GMOCK_DIR + NAMES src/gmock.cc + PATHS "$ENV{GMOCK_DIR}" + "/usr/src/googletest/googlemock" + "/usr/src/gmock" + "${CMAKE_SOURCE_DIR}/gtest/gmock-1.7.0" + ) + endif(NOT GMOCK_DIR) + if(EXISTS "${GMOCK_DIR}" AND IS_DIRECTORY "${GMOCK_DIR}") + set(GMOCK_PRESENT ON) + else() + set(GMOCK_PRESENT OFF) + message("No gmock/gtest found! Perhaps you wish to run 'bash download-gtest.sh' to download it.") + endif() endif() include(CMakeScripts/DefineDependsandFlags.cmake) # Includes, Compiler Flags, and Link Libraries @@ -241,8 +246,9 @@ add_custom_target(clean-all #----------------------------------------------------------------------------- if(GMOCK_PRESENT) set(CMAKE_CTEST_COMMAND ctest -V) + set(CMAKE_CTEST_ENV INKSCAPE_DATADIR=${CMAKE_CURRENT_SOURCE_DIR}/share) enable_testing() - add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) + add_custom_target(check COMMAND ${CMAKE_COMMAND} -E env ${CMAKE_CTEST_ENV} ${CMAKE_CTEST_COMMAND}) add_subdirectory(testfiles) endif() diff --git a/CMakeScripts/ConfigChecks.cmake b/CMakeScripts/ConfigChecks.cmake index 3d986d8dd..04c077026 100644 --- a/CMakeScripts/ConfigChecks.cmake +++ b/CMakeScripts/ConfigChecks.cmake @@ -13,35 +13,21 @@ include(CheckStructHasMember) set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${INKSCAPE_LIBS}) set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${INKSCAPE_INCS_SYS}) -CHECK_INCLUDE_FILE_CXX(boost/concept_check.hpp HAVE_BOOST_CONCEPT_CHECK_HPP) CHECK_INCLUDE_FILES(cairo-pdf.h HAVE_CAIRO_PDF) CHECK_FUNCTION_EXISTS(floor HAVE_FLOOR) CHECK_FUNCTION_EXISTS(fpsetmask HAVE_FPSETMASK) -CHECK_INCLUDE_FILES(gc/gc.h HAVE_GC_GC_H) -CHECK_INCLUDE_FILES(gc.h HAVE_GC_H) CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) -CHECK_FUNCTION_EXISTS(gtk_window_fullscreen HAVE_GTK_WINDOW_FULLSCREEN) -CHECK_FUNCTION_EXISTS(gtk_window_set_default_icon_from_file HAVE_GTK_WINDOW_SET_DEFAULT_ICON_FROM_FILE) CHECK_INCLUDE_FILES(ieeefp.h HAVE_IEEEFP_H) CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H) -CHECK_INCLUDE_FILES(locale.h HAVE_LC_MESSAGES) -CHECK_INCLUDE_FILES(locale.h HAVE_LOCALE_H) -CHECK_INCLUDE_FILES(libintl.h HAVE_LIBINTL_H) CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H) CHECK_FUNCTION_EXISTS(mallinfo HAVE_MALLINFO) CHECK_INCLUDE_FILES(malloc.h HAVE_MALLOC_H) CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE) CHECK_INCLUDE_FILES(memory.h HAVE_MEMORY_H) CHECK_FUNCTION_EXISTS(memset HAVE_MEMSET) -CHECK_FUNCTION_EXISTS(mkdir HAVE_MKDIR) CHECK_FUNCTION_EXISTS(pow HAVE_POW) CHECK_FUNCTION_EXISTS(sqrt HAVE_SQRT) -CHECK_INCLUDE_FILES(stddef.h HAVE_STDDEF_H) CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H) -CHECK_INCLUDE_FILES(stdlib.h HAVE_STDLIB_H) -CHECK_INCLUDE_FILES(strings.h HAVE_STRINGS_H) -CHECK_INCLUDE_FILES(string.h HAVE_STRING_H) -CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP) CHECK_FUNCTION_EXISTS(strpbrk HAVE_STRPBRK) CHECK_FUNCTION_EXISTS(strrchr HAVE_STRRCHR) CHECK_FUNCTION_EXISTS(strspn HAVE_STRSPN) @@ -52,14 +38,10 @@ CHECK_STRUCT_HAS_MEMBER(fsmblks mallinfo malloc.h HAVE_STRUCT_MALLINFO_FSMBLKS) CHECK_STRUCT_HAS_MEMBER(hblkhd mallinfo malloc.h HAVE_STRUCT_MALLINFO_HBLKHD) CHECK_STRUCT_HAS_MEMBER(uordblks mallinfo malloc.h HAVE_STRUCT_MALLINFO_UORDBLKS) CHECK_STRUCT_HAS_MEMBER(usmblks mallinfo malloc.h HAVE_STRUCT_MALLINFO_USMBLKS) -CHECK_INCLUDE_FILES(sys/filio.h HAVE_SYS_FILIO_H) CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H) CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H) CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H) CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H) -CHECK_INCLUDE_FILES(zlib.h HAVE_ZLIB_H) - -CHECK_INCLUDE_FILE_CXX(unordered_set HAVE_NATIVE_UNORDERED_SET) # Enable pango defines, necessary for compilation on Win32, how about Linux? # yes but needs to be done a better way diff --git a/CMakeScripts/ConfigEnv.cmake b/CMakeScripts/ConfigEnv.cmake index dd4e7e10c..1c4a64b39 100644 --- a/CMakeScripts/ConfigEnv.cmake +++ b/CMakeScripts/ConfigEnv.cmake @@ -47,8 +47,4 @@ if(APPLE) if(DEFINED ENV{GTKMM_BASEPATH})
message("GTKMM_BASEPATH: $ENV{GTKMM_BASEPATH}")
endif()
-
- # detect current GTK+ backend
- pkg_check_variable(gtk+-2.0 target)
- message("GTK2 backend: ${GTK+_2.0_TARGET}")
endif()
diff --git a/CMakeScripts/ConfigPaths.cmake b/CMakeScripts/ConfigPaths.cmake index de053c4d8..f62d14c4e 100644 --- a/CMakeScripts/ConfigPaths.cmake +++ b/CMakeScripts/ConfigPaths.cmake @@ -7,7 +7,7 @@ if(WIN32) endif() set(INKSCAPE_LIBDIR "\\\\lib") - set(INKSCAPE_DATADIR "") + set(INKSCAPE_DATADIR "") # can be set via the evironment variable INKSCAPE_DATADIR at runtime set(PACKAGE_LOCALE_DIR "\\\\share\\\\locale") diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake index 8cc0f0cd9..52410fb2b 100644 --- a/CMakeScripts/DefineDependsandFlags.cmake +++ b/CMakeScripts/DefineDependsandFlags.cmake @@ -45,7 +45,6 @@ pkg_check_modules(INKSCAPE_DEP REQUIRED pangocairo pangoft2 fontconfig - gthread-2.0 gsl gmodule-2.0) @@ -57,18 +56,6 @@ add_definitions(${INKSCAPE_DEP_CFLAGS_OTHER}) if(APPLE AND DEFINED ENV{CMAKE_PREFIX_PATH}) list(APPEND INKSCAPE_LIBS "-L$ENV{CMAKE_PREFIX_PATH}/lib") endif() -if(APPLE) - if(${GTK+_2.0_TARGET} MATCHES "x11") - pkg_check_modules(x11 REQUIRED x11) - list(APPEND INKSCAPE_LIBS ${x11_LDFLAGS}) - endif() -elseif(WIN32) -# X11 not available on windows -else() - pkg_check_modules(x11 REQUIRED x11) - list(APPEND INKSCAPE_LIBS ${x11_LDFLAGS}) - -endif() if(WITH_GNOME_VFS) find_package(GnomeVFS2) @@ -299,11 +286,7 @@ set(TRY_GTKSPELL ON) ${GTKSPELL3_LIBRARIES} ) -find_package(Freetype REQUIRED) -list(APPEND INKSCAPE_INCS_SYS ${FREETYPE_INCLUDE_DIRS}) -list(APPEND INKSCAPE_LIBS ${FREETYPE_LIBRARIES}) - -find_package(Boost REQUIRED) +find_package(Boost 1.19.0 REQUIRED) list(APPEND INKSCAPE_INCS_SYS ${Boost_INCLUDE_DIRS}) # list(APPEND INKSCAPE_LIBS ${Boost_LIBRARIES}) diff --git a/CMakeScripts/Install.cmake b/CMakeScripts/Install.cmake index 782161dc2..a188ba2c9 100644 --- a/CMakeScripts/Install.cmake +++ b/CMakeScripts/Install.cmake @@ -10,7 +10,7 @@ if(WIN32) AUTHORS
COPYING
NEWS
- README
+ README.md
TRANSLATORS
GPL2.txt
GPL3.txt
diff --git a/CMakeScripts/InstallMSYS2.cmake b/CMakeScripts/InstallMSYS2.cmake index dcdc738a0..65ced10e2 100644 --- a/CMakeScripts/InstallMSYS2.cmake +++ b/CMakeScripts/InstallMSYS2.cmake @@ -3,7 +3,7 @@ if(WIN32) AUTHORS
COPYING
NEWS
- README
+ README.md
TRANSLATORS
GPL2.txt
GPL3.txt
@@ -84,7 +84,7 @@ if(WIN32) ${MINGW_BIN}/libplc4.dll
${MINGW_BIN}/libplds4.dll
${MINGW_BIN}/libpng16-16.dll
- ${MINGW_BIN}/libpoppler-66.dll
+ ${MINGW_BIN}/libpoppler-67.dll
${MINGW_BIN}/libpoppler-glib-8.dll
${MINGW_BIN}/libpopt-0.dll
${MINGW_BIN}/libpotrace-0.dll
@@ -1,7 +1,7 @@ Inkscape. Draw Freely. ====================== -http://www.inkscape.org/ +[https://www.inkscape.org/](https://www.inkscape.org/) Inkscape is an open source drawing tool with capabilities similar to Illustrator, Freehand, and CorelDraw that uses the W3C standard scalable @@ -19,58 +19,76 @@ lightweight core with powerful features added as extensions, and the establishment of a friendly, open, community-oriented development processes. +[](https://gitlab.com/inkscape/inkscape/commits/master) Basic Installation ================== Inkscape version 0.92 and newer can be build using cmake: - mkdir build - cd build - cmake .. - make - make install +```bash +mkdir build +cd build +cmake .. +make +make install +``` Other platforms such as Windows and Mac require a lot more and are considered a developer and packager task. These instructions are kept on the Inkscape wiki. +Running Without Installing +========================== + +For developers and others who want to run inkscape without installing it: + +```bash +ln -s . share/inkscape +mkdir -p build/conf +cd build +cmake -DCMAKE_INSTALL_PREFIX:PATH=$PWD/../ +make -j4 +export INKSCAPE_PROFILE_DIR=$PWD/conf +./bin/inkscape +``` + +This won't work for other platforms such as Windows and Mac, see above. But +what it is doing is linking the share directory into a location where +the inkscape binary will be able to find it. Allowing you to change the +inkscape shared files without rebuilding or installing. + +Then setting a local configuration directory, keeping your configurations +seperate from any installed version. + Required Dependencies ===================== + The Inkscape core depends on several other libraries that you will need install, if they are not already present on your system. The most typical libraries you may need to install are: - * Boehm-GC - * libsigc++ - * glibmm - * gtkmm + * [Boehm-GC](http://www.hboehm.info/gc/) + * [libsigc++](http://libsigc.sourceforge.net/) + * [gtkmm](https://www.gtkmm.org/) -Please see http://wiki.inkscape.org/wiki/index.php/CompilingInkscape for the +Please see [the wiki page on compiling Inkscape](http://wiki.inkscape.org/wiki/index.php/CompilingInkscape) for the most current dependencies, including links to the source tarballs. Extension Dependencies ====================== Inkscape also has a number of extensions for implementing various -features such as support for non-SVG file formats, etc. In theory, all +features such as support for non-SVG file formats. In theory, all extensions are optional, however in practice you will want to have these installed and working. Unfortunately, there is a great deal of variability in how you can get these functioning properly. Here are some recommendations: -First, make sure you have Perl and Python. If you are on Windows you -should also install Cygwin. - -Next, you will need to ensure the dependencies for each extension is -present. Depending on which extensions you need, the dependencies are -going to vary, but here are some you may need to install: - - * XML::Parser - * XML::XQL +First, make sure you have Python. If you are on Windows you +should also install [Cygwin](https://www.cygwin.com/). -If you install dependencies to non-standard locations, such as -installing XML::Parser someplace in your home directory, you may need to -take some extra steps to indicate where those dependencies are to be -found. For instance, with Perl modules, set the PERLLIB or PERL5LIB -variable (see `man perlrun`) +Second, if an extension does not work, check the file +`extensions-errors.log` located on Linux at `~/.config/inkscape` and on +Windows at `%userprofile%\Application Data\Inkscape\`. Any missing +programs will be listed. diff --git a/appveyor.sh b/appveyor.sh index 26d75571a..6818aa3b5 100644 --- a/appveyor.sh +++ b/appveyor.sh @@ -1,12 +1,20 @@ #!/usr/bin/env bash +### functions +message() { echo -e "\e[1;32m\n${1}\n\e[0m"; } +warning() { echo -e "\e[1;33m\nWarning: ${1}\n\e[0m"; } +error() { echo -e "\e[1;31m\nError: ${1}\n\e[0m"; exit 1; } + + + +### setup + +# do everything in /build cd "$(dirname "$0")" mkdir build cd build - - -# Write an empty fonts.conf to speed up fc-cache +# write an empty fonts.conf to speed up fc-cache export FONTCONFIG_FILE=/dummy-fonts.conf cat >"$FONTCONFIG_FILE" <<EOF <?xml version="1.0"?> @@ -14,25 +22,52 @@ cat >"$FONTCONFIG_FILE" <<EOF <fontconfig></fontconfig> EOF +# install dependencies +message "--- Installing dependencies" +source ../msys2installdeps.sh +pacman -S $MINGW_PACKAGE_PREFIX-{ccache,gtest} --needed --noconfirm --noprogressbar +ccache --max-size=200M -# update/install dependecies -pacman -Suu --needed --noconfirm --noprogressbar -pacman -S $MINGW_PACKAGE_PREFIX-ccache --needed --noconfirm --noprogressbar -source ../msys2installdeps.sh + +### build / test + +message "\n\n##### STARTING BUILD #####" # configure -ccache --max-size=200M -cmake .. -G Ninja -DCMAKE_C_COMPILER_LAUNCHER="ccache" -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" +message "--- Configuring the build" +cmake .. -G Ninja \ + -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ + -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ + -DCMAKE_INSTALL_MESSAGE="NEVER" \ + || error "cmake failed" # build +message "--- Compiling Inkscape" ccache --zero-stats -ninja +ninja || error "compilation failed" ccache --show-stats -ninja install + +# install +message "--- Installing the project" +ninja install || error "installation failed" # test -inkscape/inkscape.exe -V +message "--- Running tests" +# check if the installed executable works +inkscape/inkscape.exe -V || error "installed executable won't run" +PATH= inkscape/inkscape.exe -V >/dev/null || error "installed executable won't run with empty PATH (missing dependecies?)" +err=$(PATH= inkscape/inkscape.exe -V 2>&1 >/dev/null) +if [ -n "$err" ]; then warning "installed executable produces output on stderr:"; echo "$err"; fi +# check if the uninstalled executable works +INKSCAPE_DATADIR=../share bin/inkscape.exe -V >/dev/null || error "uninstalled executable won't run" +err=$(INKSCAPE_DATADIR=../share bin/inkscape.exe -V 2>&1 >/dev/null) +if [ -n "$err" ]; then warning "installed executable produces output on stderr:"; echo "$err"; fi +# run tests (don't fail yet as most tests SEGFAULT on exit) +#ninja check || warning "tests failed" # disabled because of sporadic deadlocks :-( + +message "##### BUILD SUCCESSFULL #####\n\n" + -# package +### package 7z a inkscape.7z inkscape diff --git a/appveyor.yml b/appveyor.yml index dd484b49e..4bf250aed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,5 @@ version: '{branch}-{build}' -branches: - only: - - master - clone_depth: 10 environment: @@ -20,3 +16,5 @@ artifacts: cache: - C:\msys64\home\appveyor\.ccache + +test: off diff --git a/config.h.cmake b/config.h.cmake index 637d49558..35e9818a9 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -33,23 +33,11 @@ /* Define to 1 if you have the `bind_textdomain_codeset' function. */ #cmakedefine HAVE_BIND_TEXTDOMAIN_CODESET 1 -/* Define to 1 if you have the <concept_check.hpp> header file. */ -#cmakedefine HAVE_BOOST_CONCEPT_CHECK_HPP 1 - /* Whether the Cairo PDF backend is available */ #cmakedefine HAVE_CAIRO_PDF 1 #cmakedefine PANGO_ENABLE_ENGINE 1 #cmakedefine RENDER_WITH_PANGO_CAIRO 1 -/* define to 1 if Carbon is available */ -#cmakedefine HAVE_CARBON 1 - -/* Define to 1 if you have the `dcgettext' function. */ -#cmakedefine HAVE_DCGETTEXT 1 - -/* Define to 1 if you have the `ecvt' function. */ -#cmakedefine HAVE_ECVT 1 - /* Define to 1 if you have the <fcntl.h> header file. */ #cmakedefine HAVE_FCNTL_H 1 @@ -59,36 +47,15 @@ /* Define to 1 if you have the `fpsetmask' function. */ #cmakedefine HAVE_FPSETMASK 1 -/* Define to 1 if you have the <gc/gc.h> header file. */ -#cmakedefine HAVE_GC_GC_H 1 - -/* Define to 1 if you have the <gc.h> header file. */ -#cmakedefine HAVE_GC_H 1 - -#cmakedefine HAVE_GETOPT_H 1 - -/* Define if the GNU gettext() function is already present or preinstalled. */ -#cmakedefine HAVE_GETTEXT 1 - /* Define to 1 if you have the `gettimeofday' function. */ #cmakedefine HAVE_GETTIMEOFDAY 1 -/* Define to 1 if you have the `gtk_window_fullscreen' function. */ -#cmakedefine HAVE_GTK_WINDOW_FULLSCREEN 1 - -/* Define to 1 if you have the `gtk_window_set_default_icon_from_file' - function. */ -#cmakedefine HAVE_GTK_WINDOW_SET_DEFAULT_ICON_FROM_FILE 1 - /* Build with Gtkmm 3.0.x or higher */ #cmakedefine WITH_GTKMM_3_0 1 /* Build with Gtkmm 3.10.x or higher */ #cmakedefine WITH_GTKMM_3_10 1 -/* Build with external GDL */ -#cmakedefine WITH_EXT_GDL 1 - /* Build with GDL 3.6 or higher */ #cmakedefine WITH_GDL_3_6 1 @@ -98,18 +65,6 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #cmakedefine HAVE_INTTYPES_H 1 -/* Define if your <locale.h> file defines LC_MESSAGES. */ -#cmakedefine HAVE_LC_MESSAGES 1 - -/* Define to 1 if you have the <libintl.h> header file. */ -#cmakedefine HAVE_LIBINTL_H 1 - -/* Define to 1 if you have the `m' library (-lm). */ -#cmakedefine HAVE_LIBM 1 - -/* Define to 1 if you have the <locale.h> header file. */ -#cmakedefine HAVE_LOCALE_H 1 - /* Define to 1 if you have the `mallinfo' function. */ #cmakedefine HAVE_MALLINFO 1 @@ -125,9 +80,6 @@ /* Define to 1 if you have the `memset' function. */ #cmakedefine HAVE_MEMSET 1 -/* Define to 1 if you have the `mkdir' function. */ -#cmakedefine HAVE_MKDIR 1 - /* Use OpenMP (via cmake) */ #cmakedefine HAVE_OPENMP 1 @@ -155,31 +107,9 @@ /* Define to 1 if you have the `sqrt' function. */ #cmakedefine HAVE_SQRT 1 -/* Define to 1 if `stat' has the bug that it succeeds when given the - zero-length file name argument. */ -#cmakedefine HAVE_STAT_EMPTY_STRING_BUG 1 - -/* Define to 1 if you have the <stddef.h> header file. */ -#cmakedefine HAVE_STDDEF_H 1 - /* Define to 1 if you have the <stdint.h> header file. */ #cmakedefine HAVE_STDINT_H 1 -/* Define to 1 if you have the <stdlib.h> header file. */ -#cmakedefine HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strftime' function. */ -#cmakedefine HAVE_STRFTIME 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#cmakedefine HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#cmakedefine HAVE_STRING_H 1 - -/* Define to 1 if you have the `strncasecmp' function. */ -#cmakedefine HAVE_STRNCASECMP 1 - /* Define to 1 if you have the `strpbrk' function. */ #cmakedefine HAVE_STRPBRK 1 @@ -210,9 +140,6 @@ /* Define to 1 if `usmblks' is member of `struct mallinfo'. */ #cmakedefine HAVE_STRUCT_MALLINFO_USMBLKS 1 -/* Define to 1 if you have the <sys/filio.h> header file. */ -#cmakedefine HAVE_SYS_FILIO_H 1 - /* Define to 1 if you have the <sys/stat.h> header file. */ #cmakedefine HAVE_SYS_STAT_H 1 @@ -225,31 +152,15 @@ /* Define to 1 if you have the <unistd.h> header file. */ #cmakedefine HAVE_UNISTD_H 1 -/* Define to 1 if you have the <unordered_set> header file. */ -#cmakedefine HAVE_NATIVE_UNORDERED_SET 1 - -/* Define to 1 if you have the <zlib.h> header file. */ -#cmakedefine HAVE_ZLIB_H 1 - /* Base data directory -- only path-prefix.h should use it! */ #define INKSCAPE_DATADIR "${INKSCAPE_DATADIR}" /* Base library directory -- only path-prefix.h should use it! */ #define INKSCAPE_LIBDIR "${INKSCAPE_LIBDIR}" -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#cmakedefine LSTAT_FOLLOWS_SLASHED_SYMLINK 1 - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#cmakedefine NO_MINUS_C_MINUS_O 1 - /* Name of package */ #define PACKAGE "${PROJECT_NAME}" -/* Define to the address where bug reports for this package should be sent. */ -#cmakedefine PACKAGE_BUGREPORT "" - /* Localization directory */ #define PACKAGE_LOCALE_DIR "${PACKAGE_LOCALE_DIR}" @@ -268,21 +179,6 @@ /* Build in dbus */ #cmakedefine WITH_DBUS 1 -/* Define as the return type of signal handlers (`int' or `void'). */ -#cmakedefine RETSIGTYPE - -/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ -#cmakedefine STAT_MACROS_BROKEN 1 - -/* Define to 1 if you have the ANSI C header files. */ -#cmakedefine STDC_HEADERS 1 - -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#cmakedefine TIME_WITH_SYS_TIME 1 - -/* Define to 1 if your <sys/time.h> declares `struct tm'. */ -#cmakedefine TM_IN_SYS_TIME 1 - /* Use gnome vfs file load functionality */ #cmakedefine WITH_GNOME_VFS 1 @@ -295,12 +191,6 @@ /* Use libjpeg */ #cmakedefine HAVE_JPEG 1 -/* Build in Inkboard support */ -#cmakedefine WITH_INKBOARD 1 - -/* Build in SSL support for Inkboard */ -#cmakedefine WITH_INKBOARD_SSL 1 - /* Build in libcdr */ #cmakedefine WITH_LIBCDR 1 @@ -331,21 +221,6 @@ /* Build in libwpg-0.3 */ #cmakedefine WITH_LIBWPG03 1 -/* Use MMX optimizations, if CPU supports it */ -#cmakedefine WITH_MMX 1 - -/* Use experimental module support */ -#cmakedefine WITH_MODULES 1 - -/* use Perl for embedded scripting */ -#cmakedefine WITH_PERL 1 - -/* use Python for embedded scripting */ -#cmakedefine WITH_PYTHON 1 - -/* Use Xft font database */ -#cmakedefine WITH_XFT 1 - /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #cmakedefine WORDS_BIGENDIAN 1 @@ -353,9 +228,6 @@ /* Do we want experimental, unsupported, unguaranteed, etc., LivePathEffects enabled? */ #cmakedefine LPE_ENABLE_TEST_EFFECTS 1 -/* Define to `int' if <sys/types.h> does not define. */ -#cmakedefine mode_t - #endif /* _CONFIG_H_ */ diff --git a/share/ui/CMakeLists.txt b/share/ui/CMakeLists.txt index 8cd974ad3..80bcd1b5d 100644 --- a/share/ui/CMakeLists.txt +++ b/share/ui/CMakeLists.txt @@ -1,3 +1,3 @@ -file(GLOB _FILES "*.xml" "*.rc" "*.css") +file(GLOB _FILES "*.xml" "*.rc" "*.css" "*.ui") install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/ui) diff --git a/share/ui/commands-toolbar.ui b/share/ui/commands-toolbar.ui new file mode 100644 index 000000000..c2b1ed965 --- /dev/null +++ b/share/ui/commands-toolbar.ui @@ -0,0 +1,38 @@ +<ui> + <toolbar name='CommandsToolbar'> + <toolitem action='FileNew' /> + <toolitem action='FileOpen' /> + <toolitem action='FileSave' /> + <toolitem action='FilePrint' /> + <separator /> + <toolitem action='FileImport' /> + <toolitem action='DialogExport' /> + <separator /> + <toolitem action='EditUndo' /> + <toolitem action='EditRedo' /> + <separator /> + <toolitem action='EditCopy' /> + <toolitem action='EditCut' /> + <toolitem action='EditPaste' /> + <separator /> + <toolitem action='ZoomSelection' /> + <toolitem action='ZoomDrawing' /> + <toolitem action='ZoomPage' /> + <separator /> + <toolitem action='EditDuplicate' /> + <toolitem action='EditClone' /> + <toolitem action='EditUnlinkClone' /> + <separator /> + <toolitem action='SelectionGroup' /> + <toolitem action='SelectionUnGroup' /> + <separator /> + <toolitem action='DialogFillStroke' /> + <toolitem action='DialogText' /> + <toolitem action='DialogLayers' /> + <toolitem action='DialogXMLEditor' /> + <toolitem action='DialogAlignDistribute' /> + <separator /> + <toolitem action='DialogDocumentProperties' /> + <toolitem action='DialogPreferences' /> + </toolbar> +</ui> diff --git a/share/ui/menus.xml b/share/ui/menus.xml new file mode 100644 index 000000000..2880a7c67 --- /dev/null +++ b/share/ui/menus.xml @@ -0,0 +1,304 @@ +<inkscape version="1.0" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"> + + <submenu name="_File"> + <verb verb-id="FileNew" /> + <verb verb-id="FileTemplates" /> + <verb verb-id="FileOpen" /> + <recent-file-list/> + <verb verb-id="FileRevert" /> + <verb verb-id="FileSave" /> + <verb verb-id="FileSaveAs" /> + <verb verb-id="FileSaveACopy" /> + <separator/> + <verb verb-id="FileImport" /> + <verb verb-id="DialogExport" /> + <verb verb-id="FileImportFromOCAL" /> + <!--verb verb-id="FileExportToOCAL" /--> + <separator/> + <verb verb-id="FilePrint" /> + <separator/> + <verb verb-id="FileVacuum" /> + <separator/> + <verb verb-id="DialogDocumentProperties" /> + <!--verb verb-id="DialogMetadata" /--> + <separator/> + <verb verb-id="FileClose" /> + <verb verb-id="FileQuit" /> + </submenu> + <submenu name="_Edit"> + <verb verb-id="EditUndo" /> + <verb verb-id="EditRedo" /> + <verb verb-id="DialogUndoHistory" /> + <separator/> + <verb verb-id="EditCut" /> + <verb verb-id="EditCopy" /> + <verb verb-id="EditPaste" /> + <verb verb-id="EditPasteInPlace" /> + <verb verb-id="EditPasteStyle" /> + <submenu name="Paste Si_ze"> + <verb verb-id="EditPasteSize" /> + <verb verb-id="EditPasteWidth" /> + <verb verb-id="EditPasteHeight" /> + <verb verb-id="EditPasteSizeSeparately" /> + <verb verb-id="EditPasteWidthSeparately" /> + <verb verb-id="EditPasteHeightSeparately" /> + </submenu> + <separator/> + <verb verb-id="DialogFind" /> + <separator/> + <verb verb-id="EditDuplicate" /> + <submenu name="Clo_ne"> + <verb verb-id="EditClone" /> + <verb verb-id="DialogClonetiler" /> + <verb verb-id="EditUnlinkClone" /> + <verb verb-id="EditUnlinkCloneRecursive" /> + <verb verb-id="EditRelinkClone" /> + <verb verb-id="EditCloneSelectOriginal" /> + <verb verb-id="EditCloneOriginalPathLPE" /> + </submenu> + <verb verb-id="SelectionCreateBitmap" /> + <separator/> + <verb verb-id="EditDelete" /> + <separator/> + <verb verb-id="EditSelectAll" /> + <verb verb-id="EditSelectAllInAllLayers" /> + <submenu name="Select Sa_me"> + <verb verb-id="EditSelectSameFillStroke" /> + <verb verb-id="EditSelectSameFillColor" /> + <verb verb-id="EditSelectSameStrokeColor" /> + <verb verb-id="EditSelectSameStrokeStyle" /> + <verb verb-id="EditSelectSameObjectType" /> + </submenu> + <verb verb-id="EditInvert" /> + <verb verb-id="EditDeselect" /> + <separator/> + <verb verb-id="FitCanvasToSelectionOrDrawing" /> + <separator/> + <verb verb-id="EditGuidesAroundPage" /> + <verb verb-id="EditGuidesToggleLock" check="yes" /> + <verb verb-id="EditRemoveAllGuides" /> + <separator/> + <verb verb-id="DialogXMLEditor" /> + <separator/> + <verb verb-id="DialogInput" /> + <verb verb-id="DialogPreferences" /> + </submenu> + <submenu name="_View"> + <submenu name="_Zoom"> + <verb verb-id="ZoomIn" /> + <verb verb-id="ZoomOut" /> + <separator/> + <verb verb-id="Zoom1:0" /> + <verb verb-id="Zoom1:2" /> + <verb verb-id="Zoom2:1" /> + <separator/> + <verb verb-id="ZoomSelection" /> + <verb verb-id="ZoomDrawing" /> + <verb verb-id="ZoomPage" /> + <verb verb-id="ZoomPageWidth" /> + <separator/> + <verb verb-id="ZoomPrev" /> + <verb verb-id="ZoomNext" /> + </submenu> + <submenu name="_Display mode"> + <verb verb-id="ViewModeToggle"/> + <verb verb-id="ViewModeNormal" radio="yes" default="yes"/> + <verb verb-id="ViewModeNoFilters" radio="yes"/> + <verb verb-id="ViewModeOutline" radio="yes"/> + <!--Better location in menu needs to be found--> + <!--verb verb-id="ViewModePrintColorsPreview" radio="yes"/--> + <!--verb verb-id="DialogPrintColorsPreview" /--> + </submenu> + <submenu name="_Color display mode"> + <verb verb-id="ViewColorModeToggle"/> + <verb verb-id="ViewColorModeNormal" radio="yes" default="yes"/> + <verb verb-id="ViewColorModeGrayscale" radio="yes"/> + <!--Better location in menu needs to be found--> + <!--verb verb-id="ViewColorModePrintColorsPreview" radio="yes"/--> + <!--verb verb-id="DialogPrintColorsPreview" /--> + </submenu> + <separator/> + <verb verb-id="ToggleGrid" check="yes" /> + <verb verb-id="ToggleGuides" check="yes" /> + <verb verb-id="ViewCmsToggle" check="yes" /> + <separator/> + <submenu name="Sh_ow/Hide"> + <objects-checkboxes/> + </submenu> + <verb verb-id="DialogsToggle" /> + <separator/> + <verb verb-id="DialogSwatches" /> + <verb verb-id="DialogDebug" /> + <separator/> + <verb verb-id="PrevWindow" /> + <verb verb-id="NextWindow" /> + <separator/> + <verb verb-id="ViewIconPreview" /> + <verb verb-id="ViewNew" /> + <separator/> + <verb verb-id="FullScreen" /> + <separator/> + <task-checkboxes/> + <!-- Not quite ready to be in the menus. + <verb verb-id="FocusToggle" /--> + </submenu> + <submenu name="_Layer"> + <verb verb-id="LayerNew" /> + <verb verb-id="LayerRename" /> + <separator/> + <verb verb-id="LayerToggleHide" /> + <verb verb-id="LayerToggleLock" /> + <separator/> + <verb verb-id="LayerNext" /> + <verb verb-id="LayerPrev" /> + <separator/> + <verb verb-id="LayerMoveToNext" /> + <verb verb-id="LayerMoveToPrev" /> + <verb verb-id="LayerMoveTo" /> + <separator/> + <verb verb-id="LayerRaise" /> + <verb verb-id="LayerLower" /> + <verb verb-id="LayerToTop" /> + <verb verb-id="LayerToBottom" /> + <separator/> + <verb verb-id="LayerDuplicate" /> + <verb verb-id="LayerDelete" /> + <separator/> + <verb verb-id="DialogLayers" /> + </submenu> + <submenu name="_Object"> + <verb verb-id="DialogObjects" /> + <verb verb-id="DialogTags" /> + <verb verb-id="DialogStyle" /> + <separator/> + <verb verb-id="DialogFillStroke" /> + <verb verb-id="DialogObjectProperties" /> + <verb verb-id="DialogSymbols" /> + <separator/> + <verb verb-id="SelectionGroup" /> + <verb verb-id="SelectionUnGroup" /> + <verb verb-id="SelectionUnGroupPopSelection" /> + <separator/> + <submenu name="Cli_p"> + <verb verb-id="ObjectSetClipPath" /> + <verb verb-id="ObjectUnSetClipPath" /> + </submenu> + <submenu name="Mas_k"> + <verb verb-id="ObjectSetMask" /> + <verb verb-id="ObjectUnSetMask" /> + </submenu> + <submenu name="Patter_n"> + <verb verb-id="ObjectsToPattern" /> + <verb verb-id="ObjectsFromPattern" /> + </submenu> + <verb verb-id="ObjectsToMarker" /> + <verb verb-id="ObjectsToGuides" /> + <separator/> + <verb verb-id="SelectionRaise" /> + <verb verb-id="SelectionLower" /> + <verb verb-id="SelectionToFront" /> + <verb verb-id="SelectionToBack" /> + <separator/> + <verb verb-id="ObjectRotate90" /> + <verb verb-id="ObjectRotate90CCW" /> + <verb verb-id="ObjectFlipHorizontally" /> + <verb verb-id="ObjectFlipVertically" /> + <separator/> + <verb verb-id="UnhideAll" /> + <verb verb-id="UnlockAll" /> + <separator/> + <verb verb-id="DialogTransform" /> + <verb verb-id="DialogAlignDistribute" /> + <verb verb-id="DialogArrange" /> + <verb verb-id="DialogPrototype" /> + </submenu> + <submenu name="_Path"> + <verb verb-id="ObjectToPath" /> + <verb verb-id="StrokeToPath" /> + +#if HAVE_POTRACE + <verb verb-id="SelectionTrace" /> +#endif + + <verb verb-id="SelectionPixelArt" /> + <separator/> + <verb verb-id="SelectionUnion" /> + <verb verb-id="SelectionDiff" /> + <verb verb-id="SelectionIntersect" /> + <verb verb-id="SelectionSymDiff" /> + <verb verb-id="SelectionDivide" /> + <verb verb-id="SelectionCutPath" /> + <separator/> + <verb verb-id="SelectionCombine" /> + <verb verb-id="SelectionBreakApart" /> + <separator/> + <verb verb-id="SelectionInset" /> + <verb verb-id="SelectionOffset" /> + <verb verb-id="SelectionDynOffset" /> + <verb verb-id="SelectionLinkedOffset" /> + <separator/> + <verb verb-id="SelectionSimplify" /> + <verb verb-id="SelectionReverse" /> + <separator/> + <verb verb-id="DialogLivePathEffect" /> + <verb verb-id="PasteLivePathEffect" /> + <verb verb-id="RemoveLivePathEffect" /> + </submenu> + <submenu name="_Text"> + <verb verb-id="DialogText" /> + <verb verb-id="DialogSVGFonts" /> + <verb verb-id="DialogGlyphs" /> + <separator/> + <verb verb-id="SelectionTextToPath" /> + <verb verb-id="SelectionTextFromPath" /> + <separator/> + <verb verb-id="ObjectFlowText" /> + <verb verb-id="ObjectUnFlowText" /> + <verb verb-id="ObjectFlowtextToText" /> + <separator/> + <verb verb-id="SelectionTextRemoveKerns" /> + <!--ifdef HAVE_ASPELL--> + <separator/> + <verb verb-id="DialogSpellcheck" /> + </submenu> + <submenu name="Filter_s"> + <filters-list/> + <separator/> + <verb verb-id="DialogFilterEffects" /> + <verb verb-id="RemoveFilter" /> + </submenu> + <submenu name="Exte_nsions"> + <verb verb-id="EffectLast" /> + <verb verb-id="EffectLastPref" /> + <separator/> + <effects-list/> + </submenu> + <submenu name="_Help"> + <verb verb-id="org.inkscape.help.manual" /> + <verb verb-id="org.inkscape.help.keys" /> + <verb verb-id="org.inkscape.help.askaquestion" /> + <submenu name="Tutorials"> + <verb verb-id="TutorialsBasic" /> + <verb verb-id="TutorialsShapes" /> + <verb verb-id="TutorialsAdvanced" /> + <verb verb-id="TutorialsTracing" /> + <verb verb-id="TutorialsTracingPixelArt" /> + <verb verb-id="TutorialsCalligraphy" /> + <verb verb-id="TutorialsInterpolate" /> + <verb verb-id="TutorialsDesign" /> + <verb verb-id="TutorialsTips" /> + </submenu> + <!--verb verb-id="org.inkscape.dialogs.extensioneditor" /--> + <verb verb-id="org.inkscape.help.commandline" /> + <verb verb-id="org.inkscape.help.faq" /> + <verb verb-id="org.inkscape.help.relnotes" /> + <verb verb-id="org.inkscape.help.reportabug" /> + <verb verb-id="org.inkscape.help.svgspec" /> + <separator/> + <verb verb-id="HelpAboutMemory" /> + <verb verb-id="HelpAbout" /> + <!--verb verb-id="ShowLicense" /--> + </submenu> +</inkscape> diff --git a/share/ui/select-toolbar.ui b/share/ui/select-toolbar.ui new file mode 100644 index 000000000..c9f488b87 --- /dev/null +++ b/share/ui/select-toolbar.ui @@ -0,0 +1,383 @@ +<ui> + <toolbar name='SelectToolbar'> + <toolitem action='EditSelectAll' /> + <toolitem action='EditSelectAllInAllLayers' /> + <toolitem action='EditDeselect' /> + <separator /> + <toolitem action='ObjectRotate90CCW' /> + <toolitem action='ObjectRotate90' /> + <toolitem action='ObjectFlipHorizontally' /> + <toolitem action='ObjectFlipVertically' /> + <separator /> + <toolitem action='SelectionToBack' /> + <toolitem action='SelectionLower' /> + <toolitem action='SelectionRaise' /> + <toolitem action='SelectionToFront' /> + <separator /> + <toolitem action='XAction' /> + <toolitem action='YAction' /> + <toolitem action='WidthAction' /> + <toolitem action='LockAction' /> + <toolitem action='HeightAction' /> + <toolitem action='UnitsAction' /> + <separator /> + <toolitem action='transform_stroke' /> + <toolitem action='transform_corners' /> + <toolitem action='transform_gradient' /> + <toolitem action='transform_pattern' /> + </toolbar> + + <toolbar name='NodeToolbar'> + <separator /> + <toolitem action='NodeInsertAction'> + <menu action='NodeInsertActionMenu'> + <menuitem action='NodeInsertActionMinX' /> + <menuitem action='NodeInsertActionMaxX' /> + <menuitem action='NodeInsertActionMinY' /> + <menuitem action='NodeInsertActionMaxY' /> + </menu> + </toolitem> + <toolitem action='NodeDeleteAction' /> + <separator /> + <toolitem action='NodeJoinAction' /> + <toolitem action='NodeBreakAction' /> + <separator /> + <toolitem action='NodeJoinSegmentAction' /> + <toolitem action='NodeDeleteSegmentAction' /> + <separator /> + <toolitem action='NodeCuspAction' /> + <toolitem action='NodeSmoothAction' /> + <toolitem action='NodeSymmetricAction' /> + <toolitem action='NodeAutoAction' /> + <separator /> + <toolitem action='NodeLineAction' /> + <toolitem action='NodeCurveAction' /> + <separator /> + <toolitem action='ObjectToPath' /> + <toolitem action='StrokeToPath' /> + <separator /> + <toolitem action='NodeXAction' /> + <toolitem action='NodeYAction' /> + <toolitem action='NodeUnitsAction' /> + <separator /> + <toolitem action='ObjectEditClipPathAction' /> + <toolitem action='ObjectEditMaskPathAction' /> + <toolitem action='EditNextPathEffectParameter' /> + <separator /> + <toolitem action='NodesShowTransformHandlesAction' /> + <toolitem action='NodesShowHandlesAction' /> + <toolitem action='NodesShowHelperpath' /> + </toolbar> + + <toolbar name='TweakToolbar'> + <toolitem action='TweakWidthAction' /> + <separator /> + <toolitem action='TweakForceAction' /> + <toolitem action='TweakPressureAction' /> + <separator /> + <toolitem action='TweakModeAction' /> + <separator /> + <toolitem action='TweakFidelityAction' /> + <separator /> + <toolitem action='TweakChannelsLabel' /> + <toolitem action='TweakDoH' /> + <toolitem action='TweakDoS' /> + <toolitem action='TweakDoL' /> + <toolitem action='TweakDoO' /> + </toolbar> + + <toolbar name='SprayToolbar'> + <toolitem action='SprayModeAction' /> + <separator /> + <toolitem action='SprayWidthAction' /> + <toolitem action='SprayPressureWidthAction' /> + <toolitem action='SprayPopulationAction' /> + <toolitem action='SprayPressurePopulationAction' /> + <separator /> + <toolitem action='SprayRotationAction' /> + <toolitem action='SprayScaleAction' /> + <toolitem action='SprayPressureScaleAction' /> + <separator /> + <toolitem action='SprayStandard_deviationAction' /> + <toolitem action='SprayMeanAction' /> + <separator /> + <toolitem action='SprayOverNoTransparentAction' /> + <toolitem action='SprayOverTransparentAction' /> + <toolitem action='SprayPickNoOverlapAction' /> + <toolitem action='SprayNoOverlapAction' /> + <toolitem action='SprayToolOffsetAction' /> + <separator /> + <toolitem action='SprayPickColorAction' /> + <toolitem action='SprayPickFillAction' /> + <toolitem action='SprayPickStrokeAction' /> + <toolitem action='SprayPickInverseValueAction' /> + <toolitem action='SprayPickCenterAction' /> + </toolbar> + + <toolbar name='ZoomToolbar'> + <toolitem action='ZoomIn' /> + <toolitem action='ZoomOut' /> + <separator /> + <toolitem action='Zoom1:0' /> + <toolitem action='Zoom1:2' /> + <toolitem action='Zoom2:1' /> + <separator /> + <toolitem action='ZoomSelection' /> + <toolitem action='ZoomDrawing' /> + <toolitem action='ZoomPage' /> + <toolitem action='ZoomPageWidth' /> + <separator /> + <toolitem action='ZoomPrev' /> + <toolitem action='ZoomNext' /> + </toolbar> + + <toolbar name='MeasureToolbar'> + <toolitem action='MeasureFontSizeAction' /> + <separator /> + <toolitem action='MeasurePrecisionAction' /> + <separator /> + <toolitem action='MeasureScaleAction' /> + <separator /> + <toolitem action='measure_units_label' /> + <toolitem action='MeasureUnitsAction' /> + <toolitem action='MeasureIgnore1stAndLast' /> + <toolitem action='MeasureInBettween' /> + <toolitem action='MeasureShowHidden' /> + <toolitem action='MeasureAllLayers' /> + <toolitem action='MeasureReverse' /> + <toolitem action='MeasureToPhantom' /> + <toolitem action='MeasureToGuides' /> + <toolitem action='MeasureToItem' /> + <toolitem action='MeasureMarkDimension' /> + <toolitem action='MeasureOffsetAction' /> + </toolbar> + + <toolbar name='StarToolbar'> + <separator /> + <toolitem action='StarStateAction' /> + <separator /> + <toolitem action='FlatAction' /> + <separator /> + <toolitem action='MagnitudeAction' /> + <toolitem action='SpokeAction' /> + <toolitem action='RoundednessAction' /> + <toolitem action='RandomizationAction' /> + <separator /> + <toolitem action='StarResetAction' /> + </toolbar> + + <toolbar name='RectToolbar'> + <toolitem action='RectStateAction' /> + <toolitem action='RectWidthAction' /> + <toolitem action='RectHeightAction' /> + <toolitem action='RadiusXAction' /> + <toolitem action='RadiusYAction' /> + <toolitem action='RectUnitsAction' /> + <separator /> + <toolitem action='RectResetAction' /> + </toolbar> + + <toolbar name='3DBoxToolbar'> + <toolitem action='3DBoxAngleXAction' /> + <toolitem action='3DBoxVPXStateAction' /> + <separator /> + <toolitem action='3DBoxAngleYAction' /> + <toolitem action='3DBoxVPYStateAction' /> + <separator /> + <toolitem action='3DBoxAngleZAction' /> + <toolitem action='3DBoxVPZStateAction' /> + </toolbar> + + <toolbar name='SpiralToolbar'> + <toolitem action='SpiralStateAction' /> + <toolitem action='SpiralRevolutionAction' /> + <toolitem action='SpiralExpansionAction' /> + <toolitem action='SpiralT0Action' /> + <separator /> + <toolitem action='SpiralResetAction' /> + </toolbar> + + <toolbar name='PenToolbar'> + <toolitem action='FreehandModeActionPen' /> + <separator /> + <toolitem action='SetPenShapeAction'/> + </toolbar> + + <toolbar name='PencilToolbar'> + <toolitem action='FreehandModeActionPencil' /> + <separator /> + <toolitem action='PencilToleranceAction' /> + <toolitem action='PencilLpeSimplify' /> + <toolitem action='PencilLpeSimplifyFlatten' /> + <separator /> + <toolitem action='PencilResetAction' /> + <separator /> + <toolitem action='SetPencilShapeAction'/> + </toolbar> + + <toolbar name='CalligraphyToolbar'> + <separator /> + <toolitem action='SetProfileAction'/> + <toolitem action='ProfileEditAction'/> + <separator /> + <toolitem action='CalligraphyWidthAction' /> + <toolitem action='PressureAction' /> + <toolitem action='TraceAction' /> + <toolitem action='ThinningAction' /> + <separator /> + <toolitem action='AngleAction' /> + <toolitem action='TiltAction' /> + <toolitem action='FixationAction' /> + <separator /> + <toolitem action='CapRoundingAction' /> + <separator /> + <toolitem action='TremorAction' /> + <toolitem action='WiggleAction' /> + <toolitem action='MassAction' /> + <separator /> + </toolbar> + + <toolbar name='ArcToolbar'> + <toolitem action='ArcStateAction' /> + <separator /> + <toolitem action='ArcStartAction' /> + <toolitem action='ArcEndAction' /> + <separator /> + <toolitem action='ArcOpenAction' /> + <separator /> + <toolitem action='ArcResetAction' /> + <separator /> + </toolbar> + + <toolbar name='PaintbucketToolbar'> + <toolitem action='ChannelsAction' /> + <separator /> + <toolitem action='ThresholdAction' /> + <separator /> + <toolitem action='OffsetAction' /> + <toolitem action='PaintbucketUnitsAction' /> + <separator /> + <toolitem action='AutoGapAction' /> + <separator /> + <toolitem action='PaintbucketResetAction' /> + </toolbar> + + <toolbar name='EraserToolbar'> + <toolitem action='EraserModeAction' /> + <separator /> + <toolitem action='EraserWidthAction' /> + <toolitem action='EraserPressureAction' /> + <separator /> + <toolitem action='EraserThinningAction' /> + <separator /> + <toolitem action='EraserCapRoundingAction' /> + <separator /> + <toolitem action='EraserTremorAction' /> + <separator /> + <toolitem action='EraserMassAction' /> + <separator /> + <toolitem action='EraserBreakAppart' /> + </toolbar> + + <toolbar name='TextToolbar'> + <toolitem action='TextFontFamilyAction' /> + <toolitem action='TextFontStyleAction' /> + <separator /> + <toolitem action='TextOuterStyleAction' /> + <toolitem action='TextFontSizeAction' /> + <toolitem action='TextLineHeightAction' /> + <toolitem action='TextLineHeightUnitsAction' /> + <toolitem action='TextLineHeightUnsetAction' /> + <separator /> + <toolitem action='TextAlignAction' /> + <separator /> + <toolitem action='TextSuperscriptAction' /> + <toolitem action='TextSubscriptAction' /> + <separator /> + <toolitem action='TextLetterSpacingAction' /> + <toolitem action='TextWordSpacingAction' /> + <toolitem action='TextDxAction' /> + <toolitem action='TextDyAction' /> + <toolitem action='TextRotationAction' /> + <separator /> + <toolitem action='TextWritingModeAction' /> + <separator /> + <toolitem action='TextOrientationAction' /> + <separator /> + <toolitem action='TextDirectionAction' /> + </toolbar> + + <toolbar name='LPEToolToolbar'> + <toolitem action='LPEToolModeAction' /> + <separator /> + <toolitem action='LPEShowBBoxAction' /> + <toolitem action='LPEBBoxFromSelectionAction' /> + <separator /> + <toolitem action='LPELineSegmentAction' /> + <separator /> + <toolitem action='LPEMeasuringAction' /> + <toolitem action='LPEToolUnitsAction' /> + <separator /> + <toolitem action='LPEOpenLPEDialogAction' /> + </toolbar> + + <toolbar name='GradientToolbar'> + <toolitem action='GradientNewTypeAction' /> + <toolitem action='GradientNewFillStrokeAction' /> + <separator /> + <toolitem action='GradientSelectGradientAction' /> + <toolitem action='GradientEditLinkAction' /> + <toolitem action='GradientEditReverseAction' /> + <toolitem action='GradientSelectRepeatAction' /> + <separator /> + <toolitem action='GradientEditStopsAction' /> + <toolitem action='GradientEditOffsetAction' /> + <toolitem action='GradientEditAddAction' /> + <toolitem action='GradientEditDeleteAction' /> + </toolbar> + + <toolbar name='MeshToolbar'> + <toolitem action='MeshNewTypeAction' /> + <toolitem action='MeshNewFillStrokeAction' /> + <toolitem action='MeshRowAction' /> + <toolitem action='MeshColumnAction' /> + <separator /> +<!-- + <toolitem action='MeshEditFillAction' /> + <toolitem action='MeshEditStrokeAction' /> + <toolitem action='MeshShowHandlesAction' /> +--> + <toolitem action='MeshToggleSidesAction' /> + <toolitem action='MeshMakeEllipticalAction' /> + <toolitem action='MeshPickColorsAction' /> + <toolitem action='MeshFitInBoundingBoxAction' /> + <separator /> + <toolitem action='MeshShowHandlesAction' /> + <toolitem action='MeshEditFillAction' /> + <toolitem action='MeshEditStrokeAction' /> + <separator /> + <toolitem action='MeshWarningAction' /> + <separator /> + <toolitem action='MeshSmoothAction' /> + </toolbar> + + <toolbar name='DropperToolbar'> + <toolitem action='DropperOpacityAction' /> + <toolitem action='DropperPickAlphaAction' /> + <toolitem action='DropperSetAlphaAction' /> + </toolbar> + + <toolbar name='ConnectorToolbar'> + <toolitem action='ConnectorAvoidAction' /> + <toolitem action='ConnectorIgnoreAction' /> + <toolitem action='ConnectorOrthogonalAction' /> + <toolitem action='ConnectorCurvatureAction' /> + <toolitem action='ConnectorSpacingAction' /> + <toolitem action='ConnectorGraphAction' /> + <toolitem action='ConnectorLengthAction' /> + <toolitem action='ConnectorDirectedAction' /> + <toolitem action='ConnectorOverlapAction' /> + </toolbar> + +</ui> + diff --git a/share/ui/snap-toolbar.ui b/share/ui/snap-toolbar.ui new file mode 100644 index 000000000..90fa6bd61 --- /dev/null +++ b/share/ui/snap-toolbar.ui @@ -0,0 +1,28 @@ +<ui> + <toolbar name='SnapToolbar'> + <toolitem action='ToggleSnapGlobal' /> + <separator /> + <toolitem action='ToggleSnapFromBBoxCorner' /> + <toolitem action='ToggleSnapToBBoxPath' /> + <toolitem action='ToggleSnapToBBoxNode' /> + <toolitem action='ToggleSnapToFromBBoxEdgeMidpoints' /> + <toolitem action='ToggleSnapToFromBBoxCenters' /> + <separator /> + <toolitem action='ToggleSnapFromNode' /> + <toolitem action='ToggleSnapToItemPath' /> + <toolitem action='ToggleSnapToPathIntersections' /> + <toolitem action='ToggleSnapToItemNode' /> + <toolitem action='ToggleSnapToSmoothNodes' /> + <toolitem action='ToggleSnapToFromLineMidpoints' /> + <separator /> + <toolitem action='ToggleSnapFromOthers' /> + <toolitem action='ToggleSnapToFromObjectCenters' /> + <toolitem action='ToggleSnapToFromRotationCenter' /> + <toolitem action='ToggleSnapToFromTextBaseline' /> + <separator /> + <toolitem action='ToggleSnapToPageBorder' /> + <toolitem action='ToggleSnapToGrids' /> + <toolitem action='ToggleSnapToGuides' /> + <!--toolitem action='ToggleSnapToGridGuideIntersections' /--> + </toolbar> +</ui> diff --git a/share/ui/tool-toolbar.ui b/share/ui/tool-toolbar.ui new file mode 100644 index 000000000..a5dedad56 --- /dev/null +++ b/share/ui/tool-toolbar.ui @@ -0,0 +1,39 @@ +<ui> + <toolbar name='ToolToolbar'> + <!-- Basics --> + <toolitem action='ToolSelector' /> + <toolitem action='ToolNode' /> + <toolitem action='ToolTweak' /> + <toolitem action='ToolZoom' /> + <toolitem action='ToolMeasure' /> + + <!-- Shapes --> + <toolitem action='ToolRect' /> + <toolitem action='Tool3DBox' /> + <toolitem action='ToolArc' /> + <toolitem action='ToolStar' /> + <toolitem action='ToolSpiral' /> + + <!-- Paths --> + <toolitem action='ToolPencil' /> + <toolitem action='ToolPen' /> + <toolitem action='ToolCalligraphic' /> + + <!-- Text --> + <toolitem action='ToolText' /> + + <!-- Paint large areas --> + <toolitem action='ToolSpray' /> + <toolitem action='ToolEraser' /> + + <!-- Fill --> + <toolitem action='ToolPaintBucket' /> + + <toolitem action='ToolGradient' /> + <toolitem action='ToolMesh' /> + <toolitem action='ToolDropper' /> + + <toolitem action='ToolConnector' /> + <toolitem action='ToolLPETool' /> + </toolbar> +</ui> diff --git a/src/attributes.cpp b/src/attributes.cpp index c375ba903..9ba646ab4 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -480,6 +480,9 @@ static SPStyleProp const props[] = { {SP_PROP_FONT_VARIANT_EAST_ASIAN, "font-variant-east-asian"}, {SP_PROP_FONT_FEATURE_SETTINGS, "font-feature-settings"}, + /* Variable Fonts (CSS Fonts Module Level 4) */ + {SP_PROP_FONT_VARIATION_SETTINGS, "font-variation-settings"}, + /* Text */ {SP_PROP_TEXT_INDENT, "text-indent"}, {SP_PROP_TEXT_ALIGN, "text-align"}, diff --git a/src/attributes.h b/src/attributes.h index c4658b85b..3fee14133 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -488,6 +488,9 @@ enum SPAttributeEnum { SP_PROP_FONT_VARIANT_EAST_ASIAN, SP_PROP_FONT_FEATURE_SETTINGS, + /* Variable Fonts (CSS Fonts Module Level 4) */ + SP_PROP_FONT_VARIATION_SETTINGS, + /* Text Layout */ SP_PROP_TEXT_INDENT, SP_PROP_TEXT_ALIGN, diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 21902db7d..c513744a8 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -128,7 +128,8 @@ CairoRenderContext::CairoRenderContext(CairoRenderer *parent) : _renderer(parent), _render_mode(RENDER_MODE_NORMAL), _clip_mode(CLIP_MODE_MASK), - _omittext_state(EMPTY) + _omittext_state(EMPTY), + _omittext_missing_pages(0) { } @@ -884,6 +885,13 @@ CairoRenderContext::finish(void) if (_vector_based_target) cairo_show_page(_cr); + // PDF+TeX Output, see CairoRenderContext::_prepareRenderGraphic() + while (_omittext_missing_pages > 0) { + _omittext_missing_pages--; + g_warning("PDF+TeX output: issuing blank PDF page at end (workaround for previous error)"); + cairo_show_page(_cr); + } + cairo_destroy(_cr); cairo_surface_finish(_surface); cairo_status_t status = cairo_surface_status(_surface); @@ -1435,8 +1443,29 @@ CairoRenderContext::_prepareRenderGraphic() // Only PDFLaTeX supports importing a single page of a graphics file, // so only PDF backend gets interleaved text/graphics if (_is_omittext && _target == CAIRO_SURFACE_TYPE_PDF) { - if (_omittext_state == NEW_PAGE_ON_GRAPHIC) - cairo_show_page(_cr); + if (_omittext_state == NEW_PAGE_ON_GRAPHIC) { + if (cairo_get_group_target(_cr) != cairo_get_target(_cr)) { + // we are in the middle of a group, i. e., between cairo_push_group() and cairo_pop_group(). + // cairo_show_page() has no effect here! + // To ensure that the the generated TeX source doesn't try to include non-existing pages, + // we will later output an extra blank page. + // This is a workaround for bug #1417470. + g_warning("PDF+TeX output: Found text inside a clipped/masked group. This is not supported, the Z-order will be incorrect. Blank pages will be added to the PDF output to work around bug #1417470."); + _omittext_missing_pages++; + } else { + // no group is active, create new page + cairo_show_page(_cr); + // Output missing pages (workaround for the 'if' case above). + // With this solution, the Z-order is more wrong than necessary. + // It would be better to print the blank pages first, and then the actual current page. + // However, this isn't easily possible with cairo. + while (_omittext_missing_pages > 0) { + _omittext_missing_pages--; + g_warning("PDF+TeX output: issuing blank PDF page (workaround for previous error)"); + cairo_show_page(_cr); + } + } + } _omittext_state = GRAPHIC_ON_TOP; } } diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h index dfa6084d1..9b976fd6d 100644 --- a/src/extension/internal/cairo-render-context.h +++ b/src/extension/internal/cairo-render-context.h @@ -207,6 +207,7 @@ protected: CairoClipMode _clip_mode; CairoOmitTextPageState _omittext_state; + int _omittext_missing_pages; cairo_pattern_t *_createPatternForPaintServer(SPPaintServer const *const paintserver, Geom::OptRect const &pbox, float alpha); diff --git a/src/inkgc/gc-core.h b/src/inkgc/gc-core.h index a27510f50..407c857fb 100644 --- a/src/inkgc/gc-core.h +++ b/src/inkgc/gc-core.h @@ -19,11 +19,7 @@ #include <new> #include <cstdlib> -#ifdef HAVE_GC_GC_H -# include <gc/gc.h> -#else # include <gc.h> -#endif namespace Inkscape { namespace GC { diff --git a/src/io/resource.cpp b/src/io/resource.cpp index 501eab03b..52ac884b1 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -19,15 +19,18 @@ #include <glib.h> // g_assert() #include "path-prefix.h" #include "inkscape.h" +#include "io/sys.h" #include "io/resource.h" +using Inkscape::IO::file_test; + namespace Inkscape { namespace IO { namespace Resource { -Util::ptr_shared<char> get_path(Domain domain, Type type, char const *filename) +gchar *_get_path(Domain domain, Type type, char const *filename) { gchar *path=NULL; switch (domain) { @@ -71,7 +74,8 @@ Util::ptr_shared<char> get_path(Domain domain, Type type, char const *filename) case PALETTES: name = "palettes"; break; case PATTERNS: name = "patterns"; break; case TEMPLATES: name = "templates"; break; - default: return get_path(SYSTEM, type, filename); + case UI: name = "ui"; break; + default: return _get_path(SYSTEM, type, filename); } path = Inkscape::Application::profile_path(name); } break; @@ -83,11 +87,39 @@ Util::ptr_shared<char> get_path(Domain domain, Type type, char const *filename) path = temp; } + return path; +} + +Util::ptr_shared<char> get_path(Domain domain, Type type, char const *filename) +{ + char *path = _get_path(domain, type, filename); Util::ptr_shared<char> result=Util::share_string(path); g_free(path); return result; } +/* + * Same as get_path, but checks for file's existance and falls back + * from USER to SYSTEM modes. + */ +Util::ptr_shared<char> get_filename(Type type, char const *filename) +{ + Util::ptr_shared<char> result; + char *user_filename = _get_path(USER, type, filename); + char *sys_filename = _get_path(SYSTEM, type, filename); + + if (file_test(user_filename, G_FILE_TEST_EXISTS)) { + result = Util::share_string(user_filename); + } else if(file_test(sys_filename, G_FILE_TEST_EXISTS)) { + result = Util::share_string(sys_filename); + } else { + g_warning("Failed to load resource: %s", filename); + } + g_free(user_filename); + g_free(sys_filename); + return result; +} + } } diff --git a/src/io/resource.h b/src/io/resource.h index 36fe5f81e..fbf2111f4 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -48,6 +48,8 @@ enum Domain { Util::ptr_shared<char> get_path(Domain domain, Type type, char const *filename=NULL); +Util::ptr_shared<char> get_filename(Type type, char const *filename=NULL); + } } diff --git a/src/path-prefix.h b/src/path-prefix.h index 8a39ede84..e54a80f28 100644 --- a/src/path-prefix.h +++ b/src/path-prefix.h @@ -51,22 +51,22 @@ #else # ifdef WIN32 # define INKSCAPE_APPICONDIR WIN32_DATADIR("pixmaps") -# define INKSCAPE_ATTRRELDIR WIN32_DATADIR("share\\attributes") -# define INKSCAPE_BINDDIR WIN32_DATADIR("share\\bind") -# define INKSCAPE_EXAMPLESDIR WIN32_DATADIR("share\\examples") -# define INKSCAPE_EXTENSIONDIR WIN32_DATADIR("share\\extensions") -# define INKSCAPE_FILTERDIR WIN32_DATADIR("share\\filters") -# define INKSCAPE_GRADIENTSDIR WIN32_DATADIR("share\\gradients") -# define INKSCAPE_KEYSDIR WIN32_DATADIR("share\\keys") -# define INKSCAPE_PIXMAPDIR WIN32_DATADIR("share\\icons") -# define INKSCAPE_MARKERSDIR WIN32_DATADIR("share\\markers") -# define INKSCAPE_PALETTESDIR WIN32_DATADIR("share\\palettes") -# define INKSCAPE_PATTERNSDIR WIN32_DATADIR("share\\patterns") -# define INKSCAPE_SCREENSDIR WIN32_DATADIR("share\\screens") -# define INKSCAPE_SYMBOLSDIR WIN32_DATADIR("share\\symbols") -# define INKSCAPE_TUTORIALSDIR WIN32_DATADIR("share\\tutorials") -# define INKSCAPE_TEMPLATESDIR WIN32_DATADIR("share\\templates") -# define INKSCAPE_UIDIR WIN32_DATADIR("share\\ui") +# define INKSCAPE_ATTRRELDIR WIN32_DATADIR("attributes") +# define INKSCAPE_BINDDIR WIN32_DATADIR("bind") +# define INKSCAPE_EXAMPLESDIR WIN32_DATADIR("examples") +# define INKSCAPE_EXTENSIONDIR WIN32_DATADIR("extensions") +# define INKSCAPE_FILTERDIR WIN32_DATADIR("filters") +# define INKSCAPE_GRADIENTSDIR WIN32_DATADIR("gradients") +# define INKSCAPE_KEYSDIR WIN32_DATADIR("keys") +# define INKSCAPE_PIXMAPDIR WIN32_DATADIR("icons") +# define INKSCAPE_MARKERSDIR WIN32_DATADIR("markers") +# define INKSCAPE_PALETTESDIR WIN32_DATADIR("palettes") +# define INKSCAPE_PATTERNSDIR WIN32_DATADIR("patterns") +# define INKSCAPE_SCREENSDIR WIN32_DATADIR("screens") +# define INKSCAPE_SYMBOLSDIR WIN32_DATADIR("symbols") +# define INKSCAPE_TUTORIALSDIR WIN32_DATADIR("tutorials") +# define INKSCAPE_TEMPLATESDIR WIN32_DATADIR("templates") +# define INKSCAPE_UIDIR WIN32_DATADIR("ui") //CREATE V0.1 WIN32 support # define CREATE_GRADIENTSDIR WIN32_DATADIR("create\\gradients\\gimp") # define CREATE_PALETTESDIR WIN32_DATADIR("create\\swatches") diff --git a/src/prefix.cpp b/src/prefix.cpp index 4e2204cff..c8bf7abec 100644 --- a/src/prefix.cpp +++ b/src/prefix.cpp @@ -419,72 +419,37 @@ br_extract_prefix (const char *path) #ifdef __WIN32__ - /** * Provide a similar mechanism for Win32. Enable a macro, * WIN32_DATADIR, that can look up subpaths for inkscape resources - */ - -#include <windows.h> -#include <glibmm/ustring.h> - -/** - * Return the directory of the .exe that is currently running */ -Glib::ustring win32_getExePath() -{ - gunichar2 path[2048]; - GetModuleFileNameW(0, (WCHAR*) path, 2048); - gchar *exe = g_utf16_to_utf8(path, -1, 0,0,0); - gchar *dir = g_path_get_dirname(exe); - Glib::ustring ret = dir; - g_free(dir); - g_free(exe); - return ret; -} - /** - * Return the relocatable version of the datadir, - * probably c:\inkscape + * Get the Windows-equivalent of INKSCAPE_DATADIR and append a relative path + * + * - by default INKSCAPE_DATADIR will be relative to the called executable + * (typically inkscape/share but also handles the case where the executable is in a /bin subfolder) + * - to override set the INKSCAPE_DATADIR environment variable */ -static Glib::ustring win32_getDataDir() -{ - Glib::ustring dir = win32_getExePath(); - if (INKSCAPE_DATADIR && *INKSCAPE_DATADIR && - strcmp(INKSCAPE_DATADIR, ".") != 0) - { - dir += "\\"; - dir += INKSCAPE_DATADIR; - } - return dir; -} - -static Glib::ustring win32_getResourcePath(const Glib::ustring &childPath) +char *win32_append_datadir(const char *relative_path) { - Glib::ustring dir = win32_getDataDir(); - if (childPath.size() > 0) - { - dir += "\\"; - dir += childPath; + static gchar *datadir; + if (!datadir) { + gchar const *inkscape_datadir = g_getenv("INKSCAPE_DATADIR"); + if (inkscape_datadir) { + datadir = g_strdup(inkscape_datadir); + } else { + gchar *module_path = g_win32_get_package_installation_directory_of_module(NULL); + datadir = g_build_filename(module_path, "share", NULL); + g_free(module_path); } - return dir; -} + } + if (!relative_path) { + relative_path = ""; + } -/** - * This is the visible utility function - */ -char *win32_relative_path(const char *childPath) -{ - static char *returnPath = 0; - if (!childPath) - childPath = ""; - Glib::ustring resourcePath = win32_getResourcePath(childPath); - if (returnPath) - free(returnPath); - returnPath = strdup(resourcePath.c_str()); - return returnPath; + return g_build_filename(datadir, relative_path, NULL); } #endif /* __WIN32__ */ diff --git a/src/prefix.h b/src/prefix.h index 7c5a1fd3c..d28e896d0 100644 --- a/src/prefix.h +++ b/src/prefix.h @@ -119,14 +119,10 @@ char *br_extract_prefix(const char *path); #endif /* __cplusplus */ #ifdef __WIN32__ - -#include <glibmm/ustring.h> - -Glib::ustring win32_getExePath(); -char *win32_relative_path(const char *childPath); - -#define WIN32_DATADIR(suffix) (win32_relative_path(suffix)) - +char *win32_append_datadir(const char *relative_path); +#undef INKSCAPE_DATADIR +#define INKSCAPE_DATADIR win32_append_datadir(NULL) +#define WIN32_DATADIR(suffix) (win32_append_datadir(suffix)) #endif #endif /* _PREFIX_H_ */ diff --git a/src/style-internal.cpp b/src/style-internal.cpp index 54d1a0867..5c2f5697f 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -521,6 +521,89 @@ SPILengthOrNormal::operator==(const SPIBase& rhs) { } +// SPIFontVariationSettings ---------------------------------------------------- + +void +SPIFontVariationSettings::read( gchar const *str ) { + + if( !str ) return; + + if ( !strcmp(str, "normal") ) { + set = true; + inherit = false; + normal = true; + axes.empty(); + return; + } + + gchar ** strarray = g_strsplit(str, " ", 0); + unsigned int i=0; + while (strarray[i]){ + char axis_name[5]; + if (strlen(strarray[i]) >= 8 + && (strarray[i][0] == '\"' || strarray[i][0] == '\'') + && (strarray[i][5] == '\"' || strarray[i][5] == '\'') + && strarray[i][6] == ' ') { + strncpy(axis_name, &strarray[i][1], 4); + axis_name[4] = '\0'; + + gfloat value; + if (sp_svg_number_read_f(&strarray[i][7], &value)) { + set = true; + inherit = false; + axes.insert(std::pair<char*,float>(axis_name,value)); + } else { + //invalid syntax while parsing attribute + break; + } + normal = false; + } + i++; + } + g_strfreev (strarray); +}; + +const Glib::ustring +SPIFontVariationSettings::write( guint const flags, SPStyleSrc const &style_src_req, SPIBase const *const base) const { + + SPIFontVariationSettings const *const my_base = dynamic_cast<const SPIFontVariationSettings*>(base); + bool dfp = (!inherits || !my_base || (my_base != this)); // Different from parent + bool src = (style_src_req == style_src || !(flags & SP_STYLE_FLAG_IFSRC)); + if (should_write(flags, set, dfp, src)) { + if (this->normal) { + return (name + ":normal;"); + } else { + Inkscape::CSSOStringStream os; + for (std::map<char*,float>::const_iterator it=axes.begin(); it!=axes.end(); ++it){ + os << "\"" << it->first << "\" " << it->second << " "; + // FIXME: can we avoid the last space char ? + } + return os.str(); + } + } + return Glib::ustring(""); +} + +void +SPIFontVariationSettings::cascade( const SPIBase* const parent ) { +// std::cerr << "SPIVariableFontAxisOrNormal::cascade(): TODO: Implement-me!" << std::endl; +} + +void +SPIFontVariationSettings::merge( const SPIBase* const parent ) { +// std::cerr << "SPIVariableFontAxisOrNormal::merge(): TODO: Implement-me!" << std::endl; +} + +bool +SPIFontVariationSettings::operator==(const SPIBase& rhs) { + if( const SPIFontVariationSettings* r = dynamic_cast<const SPIFontVariationSettings*>(&rhs) ) { + if( normal && r->normal ) { return true; } + if( normal != r->normal ) { return false; } + return axes == r->axes; + } else { + return false; + } +} // SPIEnum -------------------------------------------------------------- diff --git a/src/style-internal.h b/src/style-internal.h index 154538833..c0b2f3e72 100644 --- a/src/style-internal.h +++ b/src/style-internal.h @@ -29,6 +29,7 @@ #include "xml/repr.h" #include <vector> +#include <map> struct SPStyleEnum; @@ -447,6 +448,56 @@ public: }; +/// Extended length type internal to SPStyle. +// Used for: font-variation-settings +class SPIFontVariationSettings : public SPIBase +{ + +public: + SPIFontVariationSettings() + : SPIBase( "anonymous_fontvariationsettings" ), + normal(true) + {} + + SPIFontVariationSettings( Glib::ustring const &name ) + : SPIBase( name ), + normal(true) + {} + + virtual ~SPIFontVariationSettings() + {} + + virtual void read( gchar const *str ); + virtual const Glib::ustring write( guint const flags = SP_STYLE_FLAG_IFSET, + SPStyleSrc const &style_src_req = SP_STYLE_SRC_STYLE_PROP, + SPIBase const *const base = NULL ) const; + virtual void clear() { + axes.empty(); + normal = true; + } + + virtual void cascade( const SPIBase* const parent ); + virtual void merge( const SPIBase* const parent ); + + SPIFontVariationSettings& operator=(const SPIFontVariationSettings& rhs) { + axes = rhs.axes; + normal = rhs.normal; + return *this; + } + + virtual bool operator==(const SPIBase& rhs); + virtual bool operator!=(const SPIBase& rhs) { + return !(*this == rhs); + } + + // To do: make private +public: + bool normal : 1; + bool inherit : 1; + std::map<char*, float> axes; +}; + + /// Enum type internal to SPStyle. // Used for many properties. 'font-stretch' and 'font-weight' must be special cased. class SPIEnum : public SPIBase diff --git a/src/style.cpp b/src/style.cpp index 0b0358bb2..ca0eed6f7 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -115,6 +115,9 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : font_variant_east_asian("font-variant-east-asian", enum_font_variant_east_asian, SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL ), font_feature_settings( "font-feature-settings", "normal" ), + // Variable Fonts + font_variation_settings( "font-variation-settings" ), // SPIFontVariationSettings + // Text related properties text_indent( "text-indent", 0.0 ), // SPILength text_align( "text-align", enum_text_align, SP_CSS_TEXT_ALIGN_START ), @@ -298,6 +301,9 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : _properties.push_back( &font_variant_east_asian ); _properties.push_back( &font_feature_settings ); + // Variable Fonts + _properties.push_back( &font_variation_settings ); + _properties.push_back( &text_indent ); _properties.push_back( &text_align ); @@ -741,6 +747,10 @@ SPStyle::readIfUnset( gint id, gchar const *val, SPStyleSrc const &source ) { font_feature_settings.readIfUnset( val, source ); break; + case SP_PROP_FONT_VARIATION_SETTINGS: + font_variation_settings.readIfUnset( val, source ); + break; + /* Text */ case SP_PROP_TEXT_INDENT: text_indent.readIfUnset( val, source ); diff --git a/src/style.h b/src/style.h index 00c8c032a..fc50c3580 100644 --- a/src/style.h +++ b/src/style.h @@ -128,6 +128,9 @@ public: /** Font feature settings (Low level access to TrueType tables) */ SPIString font_feature_settings; + /** Font variation settings (Low level access to OpenType variable font design-coordinate values) */ + SPIFontVariationSettings font_variation_settings; + /* Text ----------------------------- */ /** First line indent of paragraphs (css2 16.1) */ diff --git a/src/trace/trace.h b/src/trace/trace.h index f562e89aa..4bf13123b 100644 --- a/src/trace/trace.h +++ b/src/trace/trace.h @@ -13,9 +13,7 @@ # include "config.h" #endif -#ifdef HAVE_STRING_H # include <string.h> -#endif #include <glibmm/refptr.h> #include <gdkmm/pixbuf.h> diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 1efec7d52..4fb8089ee 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -1586,10 +1586,15 @@ FileSaveDialogImplWin32::FileSaveDialogImplWin32(Gtk::Window &parent, if (len != 0 && udir[len - 1] == '\\') udir.erase(len - 1); // Remove the extension: remove everything past the last period found past the last slash - size_t last_slash_index = udir.find_last_of( '\\' ); - size_t last_period_index = udir.find_last_of( '.' ); - if (last_period_index > last_slash_index) { - myFilename = udir.substr(0, last_period_index ); + // (not for CUSTOM_TYPE as we can not automatically add a file extension in that case yet) + if (dialogType == CUSTOM_TYPE) { + myFilename = udir; + } else { + size_t last_slash_index = udir.find_last_of( '\\' ); + size_t last_period_index = udir.find_last_of( '.' ); + if (last_period_index > last_slash_index) { + myFilename = udir.substr(0, last_period_index ); + } } // remove one slash if double @@ -1685,28 +1690,28 @@ void FileSaveDialogImplWin32::addFileType(Glib::ustring name, Glib::ustring patt knownExtensions.clear(); - int extension_index = 0; - int filter_length = 1; - - ustring all_exe_files_filter = pattern; Filter all_exe_files; const gchar *all_exe_files_filter_name = name.data(); + const gchar *all_exe_files_filter = pattern.data(); // Calculate the amount of memory required int filter_count = 1; - + int filter_length = 1; // Filter Executable Files all_exe_files.name = g_utf8_to_utf16(all_exe_files_filter_name, -1, NULL, &all_exe_files.name_length, NULL); - all_exe_files.filter = g_utf8_to_utf16(all_exe_files_filter.data(), + all_exe_files.filter = g_utf8_to_utf16(all_exe_files_filter, -1, NULL, &all_exe_files.filter_length, NULL); all_exe_files.mod = NULL; filter_list.push_front(all_exe_files); + + filter_length = all_exe_files.name_length + all_exe_files.filter_length + 3; // Add 3 for two \0s and a * knownExtensions.insert( Glib::ustring(all_exe_files_filter).casefold() ); + int extension_index = 0; _extension_map = new Inkscape::Extension::Extension*[filter_count]; _filter = new wchar_t[filter_length]; diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index b1bcddd45..8679659ce 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -45,6 +45,7 @@ namespace Inkscape { namespace UI { namespace Dialog { +// Keeps a watch on style element class StyleDialog::NodeObserver : public Inkscape::XML::NodeObserver { public: NodeObserver(StyleDialog* styleDialog) : @@ -78,6 +79,93 @@ StyleDialog::NodeObserver::notifyContentChanged( } +// Keeps a watch for new/removed/changed nodes +// (Must update objects that selectors match.) +class StyleDialog::NodeWatcher : public Inkscape::XML::NodeObserver { +public: + NodeWatcher(StyleDialog* styleDialog, Inkscape::XML::Node *repr) : + _styleDialog(styleDialog), + _repr(repr) + { +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::NodeWatcher: Constructor" << std::endl; +#endif + }; + + virtual void notifyChildAdded( Inkscape::XML::Node &/*node*/, + Inkscape::XML::Node &child, + Inkscape::XML::Node */*prev*/ ) + { + if ( _styleDialog && _repr ) { + _styleDialog->_nodeAdded( child ); + } + } + + virtual void notifyChildRemoved( Inkscape::XML::Node &/*node*/, + Inkscape::XML::Node &child, + Inkscape::XML::Node */*prev*/ ) + { + if ( _styleDialog && _repr ) { + _styleDialog->_nodeRemoved( child ); + } + } + + virtual void notifyAttributeChanged( Inkscape::XML::Node &node, + GQuark qname, + Util::ptr_shared<char> /*old_value*/, + Util::ptr_shared<char> /*new_value*/ ) { + if ( _styleDialog && _repr ) { + + // For the moment only care about attributes that are directly used in selectors. + const gchar * cname = g_quark_to_string (qname ); + Glib::ustring name; + if (cname) { + name = cname; + } + + if ( name == "id" || name == "class" ) { + _styleDialog->_nodeChanged( node ); + } + } + } + + StyleDialog * _styleDialog; + Inkscape::XML::Node * _repr; // Need to track if document changes. +}; + +void +StyleDialog::_nodeAdded( Inkscape::XML::Node &node ) { + + StyleDialog::NodeWatcher *w = new StyleDialog::NodeWatcher (this, &node); + node.addObserver (*w); + _nodeWatchers.push_back(w); + + _readStyleElement(); + _selectRow(); +} + +void +StyleDialog::_nodeRemoved( Inkscape::XML::Node &repr ) { + + for (auto it = _nodeWatchers.begin(); it != _nodeWatchers.end(); ++it) { + if ( (*it)->_repr == &repr ) { + (*it)->_repr->removeObserver (**it); + _nodeWatchers.erase( it ); + break; + } + } + + _readStyleElement(); + _selectRow(); +} + +void +StyleDialog::_nodeChanged( Inkscape::XML::Node &object ) { + + _readStyleElement(); + _selectRow(); +} + StyleDialog::TreeStore::TreeStore() { } @@ -248,6 +336,9 @@ StyleDialog::StyleDialog() : _selection_changed_connection = getDesktop()->getSelection()->connectChanged( sigc::hide(sigc::mem_fun(this, &StyleDialog::_handleSelectionChanged))); + // Add watchers + _updateWatchers(); + // Load tree _readStyleElement(); _selectRow(); @@ -407,6 +498,7 @@ void StyleDialog::_readStyleElement() // Add as children, objects that match selector. for (auto& obj: objVec) { + if (obj->cloned) continue; // Skip cloned objects (they also don't have 'id'). Gtk::TreeModel::Row childrow = *(_store->append(row->children())); childrow[_mColumns._colSelector] = "#" + Glib::ustring(obj->getId()); childrow[_mColumns._colIsSelector] = false; @@ -446,6 +538,49 @@ void StyleDialog::_writeStyleElement() } +void StyleDialog::_addWatcherRecursive(Inkscape::XML::Node *node) { + +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_addWatcherRecursive()" << std::endl; +#endif + + StyleDialog::NodeWatcher *w = new StyleDialog::NodeWatcher(this, node); + node->addObserver(*w); + _nodeWatchers.push_back(w); + + for (unsigned i = 0; i < node->childCount(); ++i) { + _addWatcherRecursive(node->nthChild(i)); + } +} + +/** + * @brief StyleDialog::_updateWatchers + * Update the watchers on objects. + */ +void StyleDialog::_updateWatchers() +{ + _updating = true; + + // Remove old document watchers + while (!_nodeWatchers.empty()) { + StyleDialog::NodeWatcher *w = _nodeWatchers.back(); + w->_repr->removeObserver(*w); + _nodeWatchers.pop_back(); + delete w; + } + + // Recursively add new watchers + Inkscape::XML::Node *root = SP_ACTIVE_DOCUMENT->getReprRoot(); + _addWatcherRecursive(root); + +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_updateWatchers(): " << _nodeWatchers.size() << std::endl; +#endif + + _updating = false; +} + + /** * @brief StyleDialog::_addToSelector * @param row @@ -711,6 +846,7 @@ void StyleDialog::_selectObjects(int eventX, int eventY) Gtk::TreeModel::Row row = *iter; Gtk::TreeModel::Children children = row.children(); std::vector<SPObject *> objVec = row[_mColumns._colObj]; + for (unsigned i = 0; i < objVec.size(); ++i) { SPObject *obj = objVec[i]; getDesktop()->selection->add(obj); @@ -1046,6 +1182,7 @@ StyleDialog::_handleDocumentReplaced(SPDesktop *desktop, SPDocument * /* documen _selection_changed_connection = desktop->getSelection()->connectChanged( sigc::hide(sigc::mem_fun(this, &StyleDialog::_handleSelectionChanged))); + _updateWatchers(); _readStyleElement(); _selectRow(); } @@ -1076,6 +1213,7 @@ StyleDialog::_handleDesktopChanged(SPDesktop* desktop) { _document_replaced_connection = desktop->connectDocumentReplaced( sigc::mem_fun(this, &StyleDialog::_handleDocumentReplaced)); + _updateWatchers(); _readStyleElement(); _selectRow(); } diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index e84489e66..dbbc1e480 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -58,6 +58,14 @@ private: // Monitor <style> element for changes. class NodeObserver; + // Monitor all objects for addition/removal/attribute change + class NodeWatcher; + + std::vector<StyleDialog::NodeWatcher*> _nodeWatchers; + void _nodeAdded( Inkscape::XML::Node &repr ); + void _nodeRemoved( Inkscape::XML::Node &repr ); + void _nodeChanged( Inkscape::XML::Node &repr ); + // Data structure class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: @@ -112,6 +120,10 @@ private: Inkscape::XML::Node *_getStyleTextNode(); void _readStyleElement(); void _writeStyleElement(); + + // Update watchers + void _addWatcherRecursive(Inkscape::XML::Node *node); + void _updateWatchers(); // Manipulate Tree void _addToSelector(Gtk::TreeModel::Row row); diff --git a/src/util/ege-tags.cpp b/src/util/ege-tags.cpp index 8a2ce0529..dcc28f370 100644 --- a/src/util/ege-tags.cpp +++ b/src/util/ege-tags.cpp @@ -38,9 +38,7 @@ #include "config.h" #endif // HAVE_CONFIG_H -#if HAVE_LIBINTL_H #include <libintl.h> -#endif // HAVE_LIBINTL_H #if !defined(_) #define _(s) gettext(s) diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index d8c27f5b7..ce4c5936c 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -66,6 +66,7 @@ #include <gtkmm/cssprovider.h> #include <gtkmm/paned.h> #include <gtkmm/messagedialog.h> +#include "inkscape-version.h" using Inkscape::UI::Widget::UnitTracker; using Inkscape::UI::UXManager; @@ -761,69 +762,52 @@ SPDesktopWidget::updateTitle(gchar const* uri) Gtk::Window *window = static_cast<Gtk::Window*>(g_object_get_data(G_OBJECT(this), "window")); if (window) { - gchar const *fname = uri; - GString *name = g_string_new (""); - - gchar const *grayscalename = N_("grayscale"); - gchar const *grayscalenamecomma = N_(", grayscale"); - gchar const *printcolorsname = N_("print colors preview"); - gchar const *printcolorsnamecomma = N_(", print colors preview"); - gchar const *outlinename = N_("outline"); - gchar const *nofiltersname = N_("no filters"); - gchar const *colormodename = NULL; - gchar const *colormodenamecomma = NULL; - gchar const *rendermodename = NULL; - gchar const *modifiedname = ""; + SPDocument *doc = this->desktop->doc(); + + std::string Name; if (doc->isModifiedSinceSave()) { - modifiedname = "*"; + Name += "*"; } - if (this->desktop->getColorMode() == Inkscape::COLORMODE_GRAYSCALE) { - colormodename = grayscalename; - colormodenamecomma = grayscalenamecomma; - } else if (this->desktop->getColorMode() == Inkscape::COLORMODE_PRINT_COLORS_PREVIEW) { - colormodename = printcolorsname; - colormodenamecomma = printcolorsnamecomma; + Name += uri; + + if (desktop->number > 1) { + Name += ": "; + Name += std::to_string(desktop->number); } - if (this->desktop->getMode() == Inkscape::RENDERMODE_OUTLINE) { - rendermodename = outlinename; - } else if (this->desktop->getMode() == Inkscape::RENDERMODE_NO_FILTERS) { - rendermodename = nofiltersname; + Name += " ("; + + if (desktop->getMode() == Inkscape::RENDERMODE_OUTLINE) { + Name += N_("outline"); + } else if (desktop->getMode() == Inkscape::RENDERMODE_NO_FILTERS) { + Name += N_("no filters"); } - - - if (this->desktop->number > 1) { - if (rendermodename) { - if (colormodenamecomma) { - g_string_printf (name, _("%s%s: %d (%s%s) - Inkscape"), modifiedname, fname, this->desktop->number, _(rendermodename), _(colormodenamecomma)); - } else { - g_string_printf (name, _("%s%s: %d (%s) - Inkscape"), modifiedname, fname, this->desktop->number, _(rendermodename)); - } - } else { - if (colormodename) { - g_string_printf (name, _("%s%s: %d (%s) - Inkscape"), modifiedname, fname, this->desktop->number, _(colormodename)); - } else { - g_string_printf (name, _("%s%s: %d - Inkscape"), modifiedname, fname, this->desktop->number); - } - } + + if (desktop->getColorMode() != Inkscape::COLORMODE_NORMAL && + desktop->getMode() != Inkscape::RENDERMODE_NORMAL) { + Name += ", "; + } + + if (desktop->getColorMode() == Inkscape::COLORMODE_GRAYSCALE) { + Name += N_("grayscale"); + } else if (desktop->getColorMode() == Inkscape::COLORMODE_PRINT_COLORS_PREVIEW) { + Name += N_("print colors preview"); + } + + if (*Name.rbegin() == '(') { // Can not use C++11 .back() or .pop_back() with ustring! + Name.erase(Name.size() - 2); } else { - if (rendermodename) { - if (colormodenamecomma) { - g_string_printf (name, _("%s%s (%s%s) - Inkscape"), modifiedname, fname, _(rendermodename), _(colormodenamecomma)); - } else { - g_string_printf (name, _("%s%s (%s) - Inkscape"), modifiedname, fname, _(rendermodename)); - } - } else { - if (colormodename) { - g_string_printf (name, _("%s%s (%s) - Inkscape"), modifiedname, fname, _(colormodename)); - } else { - g_string_printf (name, _("%s%s - Inkscape"), modifiedname, fname); - } - } + Name += ")"; } - window->set_title (name->str); - g_string_free (name, TRUE); + + Name += " - Inkscape"; + + // Name += " ("; + // Name += Inkscape::version_string; + // Name += ")"; + + window->set_title (Name); } } diff --git a/src/widgets/ege-paint-def.cpp b/src/widgets/ege-paint-def.cpp index 1a8ad041a..8e0ec9352 100644 --- a/src/widgets/ege-paint-def.cpp +++ b/src/widgets/ege-paint-def.cpp @@ -36,9 +36,7 @@ #include "config.h" -#ifdef HAVE_LIBINTL_H #include <libintl.h> -#endif #include <stdint.h> #include <string> diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 016eafdaa..65c54f0ce 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -61,7 +61,7 @@ #include "../xml/attribute-record.h" #include "../xml/node-event-vector.h" #include "ui/uxmanager.h" - +#include "io/resource.h" #include "arc-toolbar.h" #include "box3d-toolbar.h" @@ -101,6 +101,9 @@ using Inkscape::UI::PrefPusher; using Inkscape::UI::ToolboxFactory; using Inkscape::UI::Tools::ToolBase; +using Inkscape::IO::Resource::get_filename; +using Inkscape::IO::Resource::UI; + typedef void (*SetupFunction)(GtkWidget *toolbox, SPDesktop *desktop); typedef void (*UpdateFunction)(SPDesktop *desktop, ToolBase *eventcontext, GtkWidget *toolbox); @@ -153,6 +156,9 @@ static struct { { "/tools/eraser", "eraser_tool", SP_VERB_CONTEXT_ERASER, SP_VERB_CONTEXT_ERASER_PREFS }, #if HAVE_POTRACE { "/tools/paintbucket", "paintbucket_tool", SP_VERB_CONTEXT_PAINTBUCKET, SP_VERB_CONTEXT_PAINTBUCKET_PREFS }, +#else + // Replacement blank action for ToolPaintBucket to prevent loading errors in ui file + { "/tools/paintbucket", "ToolPaintBucket", SP_VERB_NONE, SP_VERB_NONE }, #endif { "/tools/text", "text_tool", SP_VERB_CONTEXT_TEXT, SP_VERB_CONTEXT_TEXT_PREFS }, { "/tools/connector","connector_tool", SP_VERB_CONTEXT_CONNECTOR, SP_VERB_CONTEXT_CONNECTOR_PREFS }, @@ -218,394 +224,12 @@ static struct { #if HAVE_POTRACE { "/tools/paintbucket", "paintbucket_toolbox", 0, sp_paintbucket_toolbox_prep, "PaintbucketToolbar", SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "/tools/paintbucket", N_("Style of Paint Bucket fill objects")}, +#else + { "/tools/paintbucket", "paintbucket_toolbox", 0, NULL, "PaintbucketToolbar", SP_VERB_NONE, "/tools/paintbucket", N_("Disabled")}, #endif { NULL, NULL, NULL, NULL, NULL, SP_VERB_INVALID, NULL, NULL } }; -static gchar const * ui_descr = - "<ui>" - " <toolbar name='SelectToolbar'>" - " <toolitem action='EditSelectAll' />" - " <toolitem action='EditSelectAllInAllLayers' />" - " <toolitem action='EditDeselect' />" - " <separator />" - " <toolitem action='ObjectRotate90CCW' />" - " <toolitem action='ObjectRotate90' />" - " <toolitem action='ObjectFlipHorizontally' />" - " <toolitem action='ObjectFlipVertically' />" - " <separator />" - " <toolitem action='SelectionToBack' />" - " <toolitem action='SelectionLower' />" - " <toolitem action='SelectionRaise' />" - " <toolitem action='SelectionToFront' />" - " <separator />" - " <toolitem action='XAction' />" - " <toolitem action='YAction' />" - " <toolitem action='WidthAction' />" - " <toolitem action='LockAction' />" - " <toolitem action='HeightAction' />" - " <toolitem action='UnitsAction' />" - " <separator />" - " <toolitem action='transform_stroke' />" - " <toolitem action='transform_corners' />" - " <toolitem action='transform_gradient' />" - " <toolitem action='transform_pattern' />" - " </toolbar>" - - " <toolbar name='NodeToolbar'>" - " <separator />" - " <toolitem action='NodeInsertAction'>" - " <menu action='NodeInsertActionMenu'>" - " <menuitem action='NodeInsertActionMinX' />" - " <menuitem action='NodeInsertActionMaxX' />" - " <menuitem action='NodeInsertActionMinY' />" - " <menuitem action='NodeInsertActionMaxY' />" - " </menu>" - " </toolitem>" - " <toolitem action='NodeDeleteAction' />" - " <separator />" - " <toolitem action='NodeJoinAction' />" - " <toolitem action='NodeBreakAction' />" - " <separator />" - " <toolitem action='NodeJoinSegmentAction' />" - " <toolitem action='NodeDeleteSegmentAction' />" - " <separator />" - " <toolitem action='NodeCuspAction' />" - " <toolitem action='NodeSmoothAction' />" - " <toolitem action='NodeSymmetricAction' />" - " <toolitem action='NodeAutoAction' />" - " <separator />" - " <toolitem action='NodeLineAction' />" - " <toolitem action='NodeCurveAction' />" - " <separator />" - " <toolitem action='ObjectToPath' />" - " <toolitem action='StrokeToPath' />" - " <separator />" - " <toolitem action='NodeXAction' />" - " <toolitem action='NodeYAction' />" - " <toolitem action='NodeUnitsAction' />" - " <separator />" - " <toolitem action='ObjectEditClipPathAction' />" - " <toolitem action='ObjectEditMaskPathAction' />" - " <toolitem action='EditNextPathEffectParameter' />" - " <separator />" - " <toolitem action='NodesShowTransformHandlesAction' />" - " <toolitem action='NodesShowHandlesAction' />" - " <toolitem action='NodesShowHelperpath' />" - " </toolbar>" - - " <toolbar name='TweakToolbar'>" - " <toolitem action='TweakWidthAction' />" - " <separator />" - " <toolitem action='TweakForceAction' />" - " <toolitem action='TweakPressureAction' />" - " <separator />" - " <toolitem action='TweakModeAction' />" - " <separator />" - " <toolitem action='TweakFidelityAction' />" - " <separator />" - " <toolitem action='TweakChannelsLabel' />" - " <toolitem action='TweakDoH' />" - " <toolitem action='TweakDoS' />" - " <toolitem action='TweakDoL' />" - " <toolitem action='TweakDoO' />" - " </toolbar>" - - " <toolbar name='SprayToolbar'>" - " <toolitem action='SprayModeAction' />" - " <separator />" - " <toolitem action='SprayWidthAction' />" - " <toolitem action='SprayPressureWidthAction' />" - " <toolitem action='SprayPopulationAction' />" - " <toolitem action='SprayPressurePopulationAction' />" - " <separator />" - " <toolitem action='SprayRotationAction' />" - " <toolitem action='SprayScaleAction' />" - " <toolitem action='SprayPressureScaleAction' />" - " <separator />" - " <toolitem action='SprayStandard_deviationAction' />" - " <toolitem action='SprayMeanAction' />" - " <separator />" - " <toolitem action='SprayOverNoTransparentAction' />" - " <toolitem action='SprayOverTransparentAction' />" - " <toolitem action='SprayPickNoOverlapAction' />" - " <toolitem action='SprayNoOverlapAction' />" - " <toolitem action='SprayToolOffsetAction' />" - " <separator />" - " <toolitem action='SprayPickColorAction' />" - " <toolitem action='SprayPickFillAction' />" - " <toolitem action='SprayPickStrokeAction' />" - " <toolitem action='SprayPickInverseValueAction' />" - " <toolitem action='SprayPickCenterAction' />" - " </toolbar>" - - " <toolbar name='ZoomToolbar'>" - " <toolitem action='ZoomIn' />" - " <toolitem action='ZoomOut' />" - " <separator />" - " <toolitem action='Zoom1:0' />" - " <toolitem action='Zoom1:2' />" - " <toolitem action='Zoom2:1' />" - " <separator />" - " <toolitem action='ZoomSelection' />" - " <toolitem action='ZoomDrawing' />" - " <toolitem action='ZoomPage' />" - " <toolitem action='ZoomPageWidth' />" - " <separator />" - " <toolitem action='ZoomPrev' />" - " <toolitem action='ZoomNext' />" - " </toolbar>" - - " <toolbar name='MeasureToolbar'>" - " <toolitem action='MeasureFontSizeAction' />" - " <separator />" - " <toolitem action='MeasurePrecisionAction' />" - " <separator />" - " <toolitem action='MeasureScaleAction' />" - " <separator />" - " <toolitem action='measure_units_label' />" - " <toolitem action='MeasureUnitsAction' />" - " <toolitem action='MeasureIgnore1stAndLast' />" - " <toolitem action='MeasureInBettween' />" - " <toolitem action='MeasureShowHidden' />" - " <toolitem action='MeasureAllLayers' />" - " <toolitem action='MeasureReverse' />" - " <toolitem action='MeasureToPhantom' />" - " <toolitem action='MeasureToGuides' />" - " <toolitem action='MeasureToItem' />" - " <toolitem action='MeasureMarkDimension' />" - " <toolitem action='MeasureOffsetAction' />" - " </toolbar>" - - " <toolbar name='StarToolbar'>" - " <separator />" - " <toolitem action='StarStateAction' />" - " <separator />" - " <toolitem action='FlatAction' />" - " <separator />" - " <toolitem action='MagnitudeAction' />" - " <toolitem action='SpokeAction' />" - " <toolitem action='RoundednessAction' />" - " <toolitem action='RandomizationAction' />" - " <separator />" - " <toolitem action='StarResetAction' />" - " </toolbar>" - - " <toolbar name='RectToolbar'>" - " <toolitem action='RectStateAction' />" - " <toolitem action='RectWidthAction' />" - " <toolitem action='RectHeightAction' />" - " <toolitem action='RadiusXAction' />" - " <toolitem action='RadiusYAction' />" - " <toolitem action='RectUnitsAction' />" - " <separator />" - " <toolitem action='RectResetAction' />" - " </toolbar>" - - " <toolbar name='3DBoxToolbar'>" - " <toolitem action='3DBoxAngleXAction' />" - " <toolitem action='3DBoxVPXStateAction' />" - " <separator />" - " <toolitem action='3DBoxAngleYAction' />" - " <toolitem action='3DBoxVPYStateAction' />" - " <separator />" - " <toolitem action='3DBoxAngleZAction' />" - " <toolitem action='3DBoxVPZStateAction' />" - " </toolbar>" - - " <toolbar name='SpiralToolbar'>" - " <toolitem action='SpiralStateAction' />" - " <toolitem action='SpiralRevolutionAction' />" - " <toolitem action='SpiralExpansionAction' />" - " <toolitem action='SpiralT0Action' />" - " <separator />" - " <toolitem action='SpiralResetAction' />" - " </toolbar>" - - " <toolbar name='PenToolbar'>" - " <toolitem action='FreehandModeActionPen' />" - " <separator />" - " <toolitem action='SetPenShapeAction'/>" - " </toolbar>" - - " <toolbar name='PencilToolbar'>" - " <toolitem action='FreehandModeActionPencil' />" - " <separator />" - " <toolitem action='PencilToleranceAction' />" - " <toolitem action='PencilLpeSimplify' />" - " <toolitem action='PencilLpeSimplifyFlatten' />" - " <separator />" - " <toolitem action='PencilResetAction' />" - " <separator />" - " <toolitem action='SetPencilShapeAction'/>" - " </toolbar>" - - " <toolbar name='CalligraphyToolbar'>" - " <separator />" - " <toolitem action='SetProfileAction'/>" - " <toolitem action='ProfileEditAction'/>" - " <separator />" - " <toolitem action='CalligraphyWidthAction' />" - " <toolitem action='PressureAction' />" - " <toolitem action='TraceAction' />" - " <toolitem action='ThinningAction' />" - " <separator />" - " <toolitem action='AngleAction' />" - " <toolitem action='TiltAction' />" - " <toolitem action='FixationAction' />" - " <separator />" - " <toolitem action='CapRoundingAction' />" - " <separator />" - " <toolitem action='TremorAction' />" - " <toolitem action='WiggleAction' />" - " <toolitem action='MassAction' />" - " <separator />" - " </toolbar>" - - " <toolbar name='ArcToolbar'>" - " <toolitem action='ArcStateAction' />" - " <separator />" - " <toolitem action='ArcStartAction' />" - " <toolitem action='ArcEndAction' />" - " <separator />" - " <toolitem action='ArcOpenAction' />" - " <separator />" - " <toolitem action='ArcResetAction' />" - " <separator />" - " </toolbar>" - -#if HAVE_POTRACE - " <toolbar name='PaintbucketToolbar'>" - " <toolitem action='ChannelsAction' />" - " <separator />" - " <toolitem action='ThresholdAction' />" - " <separator />" - " <toolitem action='OffsetAction' />" - " <toolitem action='PaintbucketUnitsAction' />" - " <separator />" - " <toolitem action='AutoGapAction' />" - " <separator />" - " <toolitem action='PaintbucketResetAction' />" - " </toolbar>" -#endif - - " <toolbar name='EraserToolbar'>" - " <toolitem action='EraserModeAction' />" - " <separator />" - " <toolitem action='EraserWidthAction' />" - " <toolitem action='EraserPressureAction' />" - " <separator />" - " <toolitem action='EraserThinningAction' />" - " <separator />" - " <toolitem action='EraserCapRoundingAction' />" - " <separator />" - " <toolitem action='EraserTremorAction' />" - " <separator />" - " <toolitem action='EraserMassAction' />" - " <separator />" - " <toolitem action='EraserBreakAppart' />" - " </toolbar>" - - " <toolbar name='TextToolbar'>" - " <toolitem action='TextFontFamilyAction' />" - " <toolitem action='TextFontStyleAction' />" - " <separator />" - " <toolitem action='TextOuterStyleAction' />" - " <toolitem action='TextFontSizeAction' />" - " <toolitem action='TextLineHeightAction' />" - " <toolitem action='TextLineHeightUnitsAction' />" - " <toolitem action='TextLineHeightUnsetAction' />" - " <separator />" - " <toolitem action='TextAlignAction' />" - " <separator />" - " <toolitem action='TextSuperscriptAction' />" - " <toolitem action='TextSubscriptAction' />" - " <separator />" - " <toolitem action='TextLetterSpacingAction' />" - " <toolitem action='TextWordSpacingAction' />" - " <toolitem action='TextDxAction' />" - " <toolitem action='TextDyAction' />" - " <toolitem action='TextRotationAction' />" - " <separator />" - " <toolitem action='TextWritingModeAction' />" - " <separator />" - " <toolitem action='TextOrientationAction' />" - " <separator />" - " <toolitem action='TextDirectionAction' />" - " </toolbar>" - - " <toolbar name='LPEToolToolbar'>" - " <toolitem action='LPEToolModeAction' />" - " <separator />" - " <toolitem action='LPEShowBBoxAction' />" - " <toolitem action='LPEBBoxFromSelectionAction' />" - " <separator />" - " <toolitem action='LPELineSegmentAction' />" - " <separator />" - " <toolitem action='LPEMeasuringAction' />" - " <toolitem action='LPEToolUnitsAction' />" - " <separator />" - " <toolitem action='LPEOpenLPEDialogAction' />" - " </toolbar>" - - " <toolbar name='GradientToolbar'>" - " <toolitem action='GradientNewTypeAction' />" - " <toolitem action='GradientNewFillStrokeAction' />" - " <separator />" - " <toolitem action='GradientSelectGradientAction' />" - " <toolitem action='GradientEditLinkAction' />" - " <toolitem action='GradientEditReverseAction' />" - " <toolitem action='GradientSelectRepeatAction' />" - " <separator />" - " <toolitem action='GradientEditStopsAction' />" - " <toolitem action='GradientEditOffsetAction' />" - " <toolitem action='GradientEditAddAction' />" - " <toolitem action='GradientEditDeleteAction' />" - " </toolbar>" - - " <toolbar name='MeshToolbar'>" - " <toolitem action='MeshNewTypeAction' />" - " <toolitem action='MeshNewFillStrokeAction' />" - " <toolitem action='MeshRowAction' />" - " <toolitem action='MeshColumnAction' />" - " <separator />" -// " <toolitem action='MeshEditFillAction' />" -// " <toolitem action='MeshEditStrokeAction' />" -// " <toolitem action='MeshShowHandlesAction' />" - " <toolitem action='MeshToggleSidesAction' />" - " <toolitem action='MeshMakeEllipticalAction' />" - " <toolitem action='MeshPickColorsAction' />" - " <toolitem action='MeshFitInBoundingBoxAction' />" - " <separator />" - " <toolitem action='MeshShowHandlesAction' />" - " <toolitem action='MeshEditFillAction' />" - " <toolitem action='MeshEditStrokeAction' />" - " <separator />" - " <toolitem action='MeshWarningAction' />" - " <separator />" - " <toolitem action='MeshSmoothAction' />" - " </toolbar>" - - " <toolbar name='DropperToolbar'>" - " <toolitem action='DropperOpacityAction' />" - " <toolitem action='DropperPickAlphaAction' />" - " <toolitem action='DropperSetAlphaAction' />" - " </toolbar>" - - " <toolbar name='ConnectorToolbar'>" - " <toolitem action='ConnectorAvoidAction' />" - " <toolitem action='ConnectorIgnoreAction' />" - " <toolitem action='ConnectorOrthogonalAction' />" - " <toolitem action='ConnectorCurvatureAction' />" - " <toolitem action='ConnectorSpacingAction' />" - " <toolitem action='ConnectorGraphAction' />" - " <toolitem action='ConnectorLengthAction' />" - " <toolitem action='ConnectorDirectedAction' />" - " <toolitem action='ConnectorOverlapAction' />" - " </toolbar>" - - "</ui>" -; static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* desktop ); @@ -995,6 +619,12 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto if ( i == 0 ) { va->set_active(true); } + } else { + // This creates a blank action using the data_name, this can replace + // tools that have been disabled by compile time options. + Glib::RefPtr<Gtk::Action> act = Gtk::Action::create(Glib::ustring(tools[i].data_name)); + act->set_sensitive(false); + mainActions->add(act); } } } @@ -1196,7 +826,7 @@ void ToolboxFactory::setToolboxDesktop(GtkWidget *toolbox, SPDesktop *desktop) static void setupToolboxCommon( GtkWidget *toolbox, SPDesktop *desktop, - gchar const *descr, + gchar const *ui_file, gchar const* toolbarName, gchar const* sizePref ) { @@ -1204,12 +834,19 @@ static void setupToolboxCommon( GtkWidget *toolbox, Inkscape::Preferences *prefs = Inkscape::Preferences::get(); GtkUIManager* mgr = gtk_ui_manager_new(); - GError* errVal = 0; + GError* err = 0; GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL; gtk_ui_manager_insert_action_group( mgr, mainActions->gobj(), 0 ); - gtk_ui_manager_add_ui_from_string( mgr, descr, -1, &errVal ); + + char const *filename = get_filename(UI, ui_file); + gtk_ui_manager_add_ui_from_file( mgr, filename, &err ); + if(err) { + g_warning("Failed to load %s: %s", filename, err->message); + g_error_free(err); + return; + } GtkWidget* toolBar = gtk_ui_manager_get_widget( mgr, toolbarName ); if ( prefs->getBool("/toolbox/icononly", true) ) { @@ -1313,57 +950,10 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati void setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { - gchar const * descr = - "<ui>" - " <toolbar name='ToolToolbar'>" - - " <!-- Basics -->" - " <toolitem action='ToolSelector' />" - " <toolitem action='ToolNode' />" - " <toolitem action='ToolTweak' />" - " <toolitem action='ToolZoom' />" - " <toolitem action='ToolMeasure' />" - - " <!-- Shapes -->" - " <toolitem action='ToolRect' />" - " <toolitem action='Tool3DBox' />" - " <toolitem action='ToolArc' />" - " <toolitem action='ToolStar' />" - " <toolitem action='ToolSpiral' />" - - " <!-- Paths -->" - " <toolitem action='ToolPencil' />" - " <toolitem action='ToolPen' />" - " <toolitem action='ToolCalligraphic' />" - - " <!-- Text -->" - " <toolitem action='ToolText' />" - - " <!-- Paint large areas -->" - " <toolitem action='ToolSpray' />" - " <toolitem action='ToolEraser' />" - -#if HAVE_POTRACE - " <!-- Fill -->" - " <toolitem action='ToolPaintBucket' />" -#endif - - " <toolitem action='ToolGradient' />" -#ifdef WITH_MESH - " <toolitem action='ToolMesh' />" -#endif - " <toolitem action='ToolDropper' />" - - " <toolitem action='ToolConnector' />" -#ifdef WITH_LPETOOL - " <toolitem action='ToolLPETool' />" -#endif - " </toolbar>" - "</ui>"; - - setupToolboxCommon( toolbox, desktop, descr, - "/ui/ToolToolbar", - "/toolbox/tools/small"); + setupToolboxCommon( toolbox, desktop, + "tool-toolbar.ui", + "/ui/ToolToolbar", + "/toolbox/tools/small"); } void update_tool_toolbox( SPDesktop *desktop, ToolBase *eventcontext, GtkWidget * /*toolbox*/ ) @@ -1391,9 +981,16 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop) GtkSizeGroup* grouper = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); Glib::RefPtr<Gtk::ActionGroup> mainActions = create_or_fetch_actions( desktop ); GtkUIManager* mgr = gtk_ui_manager_new(); - GError* errVal = 0; + GError *err = 0; gtk_ui_manager_insert_action_group( mgr, mainActions->gobj(), 0 ); - gtk_ui_manager_add_ui_from_string( mgr, ui_descr, -1, &errVal ); + + char const *filename = get_filename(UI, "select-toolbar.ui"); + guint ret = gtk_ui_manager_add_ui_from_file(mgr, filename, &err); + if(err) { + g_warning("Failed to load aux toolbar %s: %s", filename, err->message); + g_error_free(err); + return; + } std::map<std::string, GtkWidget*> dataHolders; @@ -1494,49 +1091,10 @@ void update_aux_toolbox(SPDesktop * /*desktop*/, ToolBase *eventcontext, GtkWidg void setup_commands_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { - gchar const * descr = - "<ui>" - " <toolbar name='CommandsToolbar'>" - " <toolitem action='FileNew' />" - " <toolitem action='FileOpen' />" - " <toolitem action='FileSave' />" - " <toolitem action='FilePrint' />" - " <separator />" - " <toolitem action='FileImport' />" - " <toolitem action='DialogExport' />" - " <separator />" - " <toolitem action='EditUndo' />" - " <toolitem action='EditRedo' />" - " <separator />" - " <toolitem action='EditCopy' />" - " <toolitem action='EditCut' />" - " <toolitem action='EditPaste' />" - " <separator />" - " <toolitem action='ZoomSelection' />" - " <toolitem action='ZoomDrawing' />" - " <toolitem action='ZoomPage' />" - " <separator />" - " <toolitem action='EditDuplicate' />" - " <toolitem action='EditClone' />" - " <toolitem action='EditUnlinkClone' />" - " <separator />" - " <toolitem action='SelectionGroup' />" - " <toolitem action='SelectionUnGroup' />" - " <separator />" - " <toolitem action='DialogFillStroke' />" - " <toolitem action='DialogText' />" - " <toolitem action='DialogLayers' />" - " <toolitem action='DialogXMLEditor' />" - " <toolitem action='DialogAlignDistribute' />" - " <separator />" - " <toolitem action='DialogDocumentProperties' />" - " <toolitem action='DialogPreferences' />" - " </toolbar>" - "</ui>"; - - setupToolboxCommon( toolbox, desktop, descr, - "/ui/CommandsToolbar", - "/toolbox/small" ); + setupToolboxCommon( toolbox, desktop, + "commands-toolbar.ui", + "/ui/CommandsToolbar", + "/toolbox/small" ); } void update_commands_toolbox(SPDesktop * /*desktop*/, ToolBase * /*eventcontext*/, GtkWidget * /*toolbox*/) @@ -1672,36 +1230,6 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { Glib::RefPtr<Gtk::ActionGroup> mainActions = create_or_fetch_actions(desktop); - gchar const * descr = - "<ui>" - " <toolbar name='SnapToolbar'>" - " <toolitem action='ToggleSnapGlobal' />" - " <separator />" - " <toolitem action='ToggleSnapFromBBoxCorner' />" - " <toolitem action='ToggleSnapToBBoxPath' />" - " <toolitem action='ToggleSnapToBBoxNode' />" - " <toolitem action='ToggleSnapToFromBBoxEdgeMidpoints' />" - " <toolitem action='ToggleSnapToFromBBoxCenters' />" - " <separator />" - " <toolitem action='ToggleSnapFromNode' />" - " <toolitem action='ToggleSnapToItemPath' />" - " <toolitem action='ToggleSnapToPathIntersections' />" - " <toolitem action='ToggleSnapToItemNode' />" - " <toolitem action='ToggleSnapToSmoothNodes' />" - " <toolitem action='ToggleSnapToFromLineMidpoints' />" - " <separator />" - " <toolitem action='ToggleSnapFromOthers' />" - " <toolitem action='ToggleSnapToFromObjectCenters' />" - " <toolitem action='ToggleSnapToFromRotationCenter' />" - " <toolitem action='ToggleSnapToFromTextBaseline' />" - " <separator />" - " <toolitem action='ToggleSnapToPageBorder' />" - " <toolitem action='ToggleSnapToGrids' />" - " <toolitem action='ToggleSnapToGuides' />" - //" <toolitem action='ToggleSnapToGridGuideIntersections' />" - " </toolbar>" - "</ui>"; - Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1); { @@ -1880,9 +1408,10 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); } - setupToolboxCommon( toolbox, desktop, descr, - "/ui/SnapToolbar", - "/toolbox/secondary" ); + setupToolboxCommon( toolbox, desktop, + "snap-toolbar.ui", + "/ui/SnapToolbar", + "/toolbox/secondary" ); } Glib::ustring ToolboxFactory::getToolboxName(GtkWidget* toolbox) diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index 4d093a4ea..6da1233db 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -17,13 +17,9 @@ #include "config.h" -#if HAVE_STRING_H # include <cstring> -#endif -#if HAVE_STDLIB_H # include <cstdlib> -#endif #include <glib.h> diff --git a/testfiles/CMakeLists.txt b/testfiles/CMakeLists.txt index 3de607894..af200bea8 100644 --- a/testfiles/CMakeLists.txt +++ b/testfiles/CMakeLists.txt @@ -1,17 +1,13 @@ # ----------------------------------------------------------------------------- # # ----------------------------------------------------------------------------- -add_subdirectory(${GMOCK_DIR} ${CMAKE_BINARY_DIR}/gmock) +if(NOT GTEST_FOUND) # not required for gtest 1.8.0 and later + add_subdirectory(${GMOCK_DIR} ${CMAKE_BINARY_DIR}/gmock) -include_directories(SYSTEM ${GMOCK_DIR}/gtest/include - ${GMOCK_DIR}/include - ${CMAKE_SOURCE_DIR}/gtest/gtest/include) - -set_source_files_properties( - ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp - PROPERTIES GENERATED TRUE) - -include_directories(${CMAKE_BINARY_DIR}/src) + include_directories(SYSTEM ${GMOCK_DIR}/gtest/include + ${GMOCK_DIR}/include + ${CMAKE_SOURCE_DIR}/gtest/gtest/include) +endif() set(TEST_SOURCES attributes-test @@ -22,25 +18,12 @@ set(TEST_SOURCES set(TEST_LIBS gmock_main - inkscape_base - nrtype_LIB - croco_LIB - avoid_LIB - cola_LIB - vpsc_LIB - livarot_LIB - uemf_LIB - 2geom_LIB - depixelize_LIB - util_LIB - gc_LIB - ${INKSCAPE_LIBS} -) + inkscape_base) foreach(source ${TEST_SOURCES}) add_executable(${source} src/${source}.cpp unittest.cpp doc-per-case-test.cpp) target_link_libraries(${source} ${TEST_LIBS}) - add_test(NAME ${source} COMMAND ${EXECUTABLE_OUTPUT_PATH}/${source}) + add_test(NAME ${source} COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${source}) add_dependencies(${source} inkscape_version) add_dependencies(check ${source}) endforeach()
\ No newline at end of file diff --git a/testfiles/src/attributes-test.cpp b/testfiles/src/attributes-test.cpp index d71aa03d2..f6881fc09 100644 --- a/testfiles/src/attributes-test.cpp +++ b/testfiles/src/attributes-test.cpp @@ -38,7 +38,8 @@ typedef std::vector<AttributeInfo>::iterator AttrItr; std::vector<AttributeInfo> getKnownAttrs() { -/* Extracted mechanically from http://www.w3.org/TR/SVG11/attindex.html: +/* Originally extracted mechanically from + http://www.w3.org/TR/SVG11/attindex.html: tidy -wrap 999 -asxml < attindex.html 2>/dev/null | tr -d \\n | @@ -146,6 +147,7 @@ std::vector<AttributeInfo> getKnownAttrs() AttributeInfo("font-variant-numeric", true), AttributeInfo("font-variant-east-asian", true), AttributeInfo("font-variant-alternates", true), + AttributeInfo("font-variation-settings", true), AttributeInfo("font-weight", true), AttributeInfo("format", false), AttributeInfo("from", true), |
