summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Boczkowski <penginsbacon@gmail.com>2015-05-09 11:38:22 +0000
committerTomasz Boczkowski <penginsbacon@gmail.com>2015-05-09 11:38:22 +0000
commitdb85d12f8c106586a0b11f60bf32cdb8ca75d8f2 (patch)
treeae5cbc2ad4fdbb93dbc1d7fc8b92ee2e2012e853
parentrenamed SPPattern methods to match coding style (diff)
parentfix crash introduces by recent rev when clipping (diff)
downloadinkscape-db85d12f8c106586a0b11f60bf32cdb8ca75d8f2.tar.gz
inkscape-db85d12f8c106586a0b11f60bf32cdb8ca75d8f2.zip
merged trunk
(bzr r14059.1.21)
-rw-r--r--CMakeLists.txt46
-rw-r--r--CMakeScripts/ConfigPaths.cmake8
-rw-r--r--CMakeScripts/DefineDependsandFlags.cmake64
-rw-r--r--CMakeScripts/Modules/FindIconv.cmake60
-rw-r--r--CMakeScripts/Modules/FindIntl.cmake127
-rw-r--r--CMakeScripts/Modules/FindLibWPG.cmake4
-rw-r--r--share/CMakeLists.txt17
-rw-r--r--share/attributes/CMakeLists.txt2
-rw-r--r--share/branding/CMakeLists.txt2
-rw-r--r--share/examples/CMakeLists.txt2
-rw-r--r--share/extensions/CMakeLists.txt46
-rwxr-xr-xshare/extensions/synfig_prepare.py2
-rw-r--r--share/filters/CMakeLists.txt10
-rw-r--r--share/fonts/CMakeLists.txt1
-rw-r--r--share/gradients/CMakeLists.txt1
-rw-r--r--share/icons/CMakeLists.txt6
-rw-r--r--share/icons/application/CMakeLists.txt9
-rw-r--r--share/keys/CMakeLists.txt2
-rw-r--r--share/markers/CMakeLists.txt2
-rw-r--r--share/palettes/CMakeLists.txt13
-rw-r--r--share/patterns/CMakeLists.txt10
-rw-r--r--share/screens/CMakeLists.txt2
-rw-r--r--share/symbols/CMakeLists.txt11
-rw-r--r--share/templates/CMakeLists.txt11
-rw-r--r--share/tutorials/CMakeLists.txt2
-rw-r--r--share/ui/CMakeLists.txt3
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/attributes.cpp24
-rw-r--r--src/attributes.h23
-rw-r--r--src/desktop.cpp1
-rw-r--r--src/dir-util.cpp2
-rw-r--r--src/dir-util.h4
-rw-r--r--src/display/canvas-arena.cpp2
-rw-r--r--src/display/canvas-grid.cpp24
-rw-r--r--src/document.cpp2
-rw-r--r--src/extension/implementation/script.cpp16
-rw-r--r--src/extension/internal/cairo-render-context.cpp1
-rw-r--r--src/extension/internal/cairo-renderer.cpp2
-rw-r--r--src/extension/internal/latex-text-renderer.cpp2
-rw-r--r--src/extension/internal/wmf-inout.cpp6
-rw-r--r--src/file.cpp6
-rw-r--r--src/gradient-drag.cpp2
-rw-r--r--src/helper-fns.h2
-rw-r--r--src/helper/geom.cpp9
-rw-r--r--src/inkview.cpp2
-rw-r--r--src/libavoid/connector.cpp6
-rw-r--r--src/libavoid/graph.cpp4
-rw-r--r--src/libavoid/orthogonal.cpp1
-rw-r--r--src/libnrtype/Layout-TNG-OutIter.cpp4
-rw-r--r--src/libnrtype/Layout-TNG.h6
-rw-r--r--src/live_effects/lpe-gears.cpp2
-rw-r--r--src/live_effects/lpe-taperstroke.cpp4
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.cpp1
-rw-r--r--src/path-chemistry.cpp4
-rw-r--r--src/selection-chemistry.cpp150
-rw-r--r--src/selection.cpp9
-rw-r--r--src/sp-clippath.cpp9
-rw-r--r--src/sp-clippath.h2
-rw-r--r--src/sp-filter.cpp10
-rw-r--r--src/sp-filter.h3
-rw-r--r--src/sp-item-transform.cpp6
-rw-r--r--src/sp-mask.cpp9
-rw-r--r--src/sp-mask.h2
-rw-r--r--src/sp-use.cpp62
-rw-r--r--src/style-enums.h137
-rw-r--r--src/style.cpp63
-rw-r--r--src/style.h18
-rw-r--r--src/trace/siox.cpp2
-rw-r--r--src/ui/dialog/document-properties.cpp4
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp31
-rw-r--r--src/ui/dialog/filter-effects-dialog.h4
-rw-r--r--src/ui/dialog/floating-behavior.cpp2
-rw-r--r--src/ui/dialog/grid-arrange-tab.cpp1
-rw-r--r--src/ui/dialog/icon-preview.cpp2
-rw-r--r--src/ui/dialog/object-properties.cpp4
-rw-r--r--src/ui/interface.cpp2
-rw-r--r--src/ui/tools/box3d-tool.cpp2
-rw-r--r--src/ui/tools/eraser-tool.cpp2
-rw-r--r--src/ui/tools/flood-tool.cpp2
-rw-r--r--src/ui/tools/pen-tool.cpp15
-rw-r--r--src/ui/tools/pencil-tool.cpp3
-rw-r--r--src/ui/tools/rect-tool.cpp1
-rw-r--r--src/ui/tools/select-tool.cpp1
-rw-r--r--src/ui/widget/object-composite-settings.cpp4
-rw-r--r--src/ui/widget/style-subject.cpp24
-rw-r--r--src/ui/widget/style-subject.h10
-rw-r--r--src/util/ziptool.cpp2
-rw-r--r--src/widgets/desktop-widget.cpp4
-rw-r--r--src/widgets/ege-adjustment-action.cpp2
-rw-r--r--src/widgets/gradient-vector.cpp1
-rw-r--r--src/widgets/paint-selector.cpp13
-rw-r--r--test/CMakeLists.txt478
-rw-r--r--test/doc-per-case-test.cpp52
-rw-r--r--test/doc-per-case-test.h43
-rw-r--r--test/src/attributes-test.cpp618
-rw-r--r--test/src/color-profile-test.cpp126
-rw-r--r--test/src/dir-util-test.cpp63
-rw-r--r--test/unittest.cpp58
98 files changed, 2405 insertions, 278 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7f1726b2d..23dd58708 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,18 +61,30 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE )
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE )
# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+set(GMOCK_DIR "${CMAKE_SOURCE_DIR}/gtest/gmock-1.7.0"
+ CACHE PATH "The path to the GoogleMock test framework.")
+
+if(EXISTS "${GMOCK_DIR}" AND IS_DIRECTORY "${GMOCK_DIR}")
+ set(GMOCK_PRESENT ON)
+endif()
+
+# -----------------------------------------------------------------------------
# Options
# -----------------------------------------------------------------------------
option(WITH_DBUS "Compile with support for DBus interface" OFF)
option(ENABLE_LCMS "Compile with LCMS support" ON)
option(WITH_GNOME_VFS "Compile with support for Gnome VFS" ON)
#option(WITH_INKJAR "Enable support for openoffice files (SVG jars)" ON)
+option(WITH_GTEST "Compile with Google Test support" ${GMOCK_PRESENT})
option(WITH_PROFILING "Turn on profiling" OFF) # Set to true if compiler/linker should enable profiling
option(WITH_GTKSPELL "Compile with support for GTK spelling widget" ON)
option(ENABLE_POPPLER "Compile with support of libpoppler" ON)
option(ENABLE_POPPLER_CAIRO "Compile with support of libpoppler-cairo for rendering PDF preview (depends on ENABLE_POPPLER)" ON)
+option(WITH_IMAGE_MAGICK "Compile with support of ImageMagick for raster extensions and image import resolution" ON)
option(WITH_LIBCDR "Compile with support of libcdr for CorelDRAW Diagrams" ON)
option(WITH_LIBVISIO "Compile with support of libvisio for Microsoft Visio Diagrams" ON)
option(WITH_LIBWPG "Compile with support of libwpg for WordPerfect Graphics" ON)
@@ -138,31 +150,21 @@ if(UNIX)
install(
FILES ${CMAKE_BINARY_DIR}/inkscape.desktop
- DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
+ DESTINATION ${SHARE_INSTALL}/applications
)
- install(
- DIRECTORY
- ${CMAKE_SOURCE_DIR}/share/attributes
- ${CMAKE_SOURCE_DIR}/share/branding
- ${CMAKE_SOURCE_DIR}/share/examples
- ${CMAKE_SOURCE_DIR}/share/extensions
- ${CMAKE_SOURCE_DIR}/share/filters
- ${CMAKE_SOURCE_DIR}/share/fonts
- ${CMAKE_SOURCE_DIR}/share/gradients
- ${CMAKE_SOURCE_DIR}/share/icons
- ${CMAKE_SOURCE_DIR}/share/keys
- ${CMAKE_SOURCE_DIR}/share/markers
- ${CMAKE_SOURCE_DIR}/share/palettes
- ${CMAKE_SOURCE_DIR}/share/patterns
- ${CMAKE_SOURCE_DIR}/share/screens
- ${CMAKE_SOURCE_DIR}/share/symbols
- ${CMAKE_SOURCE_DIR}/share/templates
- ${CMAKE_SOURCE_DIR}/share/tutorials
- ${CMAKE_SOURCE_DIR}/share/ui
- DESTINATION ${CMAKE_INSTALL_PREFIX}/share/inkscape
- )
+ # this should probably be done no matter what the platform is, just set SHARE_INSTALL first
+ add_subdirectory(share)
else()
# TODO, WIN32/APPLE
endif()
+
+#-----------------------------------------------------------------------------
+
+add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
+
+if (WITH_GTEST)
+ enable_testing()
+ add_subdirectory(test EXCLUDE_FROM_ALL)
+endif()
diff --git a/CMakeScripts/ConfigPaths.cmake b/CMakeScripts/ConfigPaths.cmake
index af0a7d50c..770e0c6ad 100644
--- a/CMakeScripts/ConfigPaths.cmake
+++ b/CMakeScripts/ConfigPaths.cmake
@@ -2,9 +2,15 @@ MESSAGE(STATUS "Creating build files in: ${CMAKE_CURRENT_BINARY_DIR}")
IF(WIN32)
SET(PACKAGE_LOCALE_DIR "locale")
-ELSEIF(WIN32)
+ set(SHARE_INSTALL "share" CACHE STRING "Data file install path. Must be a relative path (from CMAKE_INSTALL_PREFIX), with no trailing slash.")
+ELSE(WIN32)
# TODO: check and change this to correct value:
SET(PACKAGE_LOCALE_DIR "locale")
+
+ if(NOT SHARE_INSTALL)
+ set(SHARE_INSTALL "share" CACHE STRING "Data file install path. Must be a relative path (from CMAKE_INSTALL_PREFIX), with no trailing slash.")
+ endif(NOT SHARE_INSTALL)
+ mark_as_advanced(SHARE_INSTALL)
ENDIF(WIN32)
#SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake
index e96609d34..dceed9560 100644
--- a/CMakeScripts/DefineDependsandFlags.cmake
+++ b/CMakeScripts/DefineDependsandFlags.cmake
@@ -19,7 +19,6 @@ list(APPEND INKSCAPE_INCS_SYS ${GSL_INCLUDE_DIRS})
list(APPEND INKSCAPE_LIBS ${GSL_LIBRARIES})
if (WIN32)
list(APPEND INKSCAPE_LIBS "-L$ENV{DEVLIBS_PATH}/lib") # FIXME
- list(APPEND INKSCAPE_LIBS "-lintl.dll") # FIXME
list(APPEND INKSCAPE_LIBS "-lpangocairo-1.0.dll") # FIXME
list(APPEND INKSCAPE_LIBS "-lpangoft2-1.0.dll") # FIXME
list(APPEND INKSCAPE_LIBS "-lpangowin32-1.0.dll") # FIXME
@@ -31,23 +30,13 @@ elseif(APPLE)
# Cmake then can rely on the hard-coded paths in its modules.
# Only prepend search path if $CMAKE_PREFIX_PATH is defined:
list(APPEND INKSCAPE_LIBS "-L$ENV{CMAKE_PREFIX_PATH}/lib") # FIXME
- # TODO: verify whether linking the next two libs explicitly is always
- # required, or only if MacPorts is installed in custom prefix:
- list(APPEND INKSCAPE_LIBS "-liconv") # FIXME
- list(APPEND INKSCAPE_LIBS "-lintl") # FIXME
endif()
list(APPEND INKSCAPE_LIBS "-lpangocairo-1.0") # FIXME
list(APPEND INKSCAPE_LIBS "-lpangoft2-1.0") # FIXME
list(APPEND INKSCAPE_LIBS "-lfontconfig") # FIXME
- # GTK+ backend
if(${GTK+_2.0_TARGET} MATCHES "x11")
# only link X11 if using X11 backend of GTK2
list(APPEND INKSCAPE_LIBS "-lX11") # FIXME
- elseif(${GTK+_2.0_TARGET} MATCHES "quartz")
- # TODO: gtk-mac-integration (currently only useful for osxmenu branch)
- # 1) add configure option (ON/OFF) for gtk-mac-integration
- # 2) add checks (GTK+ backend must be "quartz")
- # 3) link relevant lib(s)
endif()
else()
list(APPEND INKSCAPE_LIBS "-ldl") # FIXME
@@ -93,6 +82,16 @@ if(ENABLE_LCMS)
endif()
endif()
+find_package(Iconv REQUIRED)
+list(APPEND INKSCAPE_INCS_SYS ${ICONV_INCLUDE_DIRS})
+list(APPEND INKSCAPE_LIBS ${ICONV_LIBRARIES})
+add_definitions(${ICONV_DEFINITIONS})
+
+find_package(Intl REQUIRED)
+list(APPEND INKSCAPE_INCS_SYS ${Intl_INCLUDE_DIRS})
+list(APPEND INKSCAPE_LIBS ${Intl_LIBRARIES})
+add_definitions(${Intl_DEFINITIONS})
+
find_package(BoehmGC REQUIRED)
list(APPEND INKSCAPE_INCS_SYS ${BOEHMGC_INCLUDE_DIRS})
list(APPEND INKSCAPE_LIBS ${BOEHMGC_LIBRARIES})
@@ -176,8 +175,8 @@ endif()
if(WITH_LIBCDR)
find_package(LibCDR)
if(LIBCDR_FOUND)
- set(WITH_LIBCDR00 ${LIBVISIO-0.0_FOUND})
- set(WITH_LIBCDR01 ${LIBVISIO-0.1_FOUND})
+ set(WITH_LIBCDR00 ${LIBCDR-0.0_FOUND})
+ set(WITH_LIBCDR01 ${LIBCDR-0.1_FOUND})
list(APPEND INKSCAPE_INCS_SYS ${LIBCDR_INCLUDE_DIRS})
list(APPEND INKSCAPE_LIBS ${LIBCDR_LIBRARIES})
add_definitions(${LIBCDR_DEFINITIONS})
@@ -214,6 +213,14 @@ if(WITH_DBUS)
endif()
endif()
+if(WITH_GTEST)
+ if(EXISTS "${GMOCK_DIR}" AND IS_DIRECTORY "${GMOCK_DIR}")
+
+ else()
+ set(WITH_GTEST off)
+ endif()
+endif()
+
# ----------------------------------------------------------------------------
# CMake's builtin
# ----------------------------------------------------------------------------
@@ -290,8 +297,9 @@ if(WITH_GTKSPELL)
list(APPEND INKSCAPE_INCS_SYS ${GTKSPELL_INCLUDE_DIR})
list(APPEND INKSCAPE_LIBS ${GTKSPELL_LIBRARIES})
add_definitions(${GTKSPELL_DEFINITIONS})
+ else()
+ set(WITH_GTKSPELL OFF)
endif()
- set(WITH_GTKSPELL ${GTKSPELL_FOUND})
endif()
#find_package(OpenSSL)
@@ -323,21 +331,29 @@ find_package(ZLIB REQUIRED)
list(APPEND INKSCAPE_INCS_SYS ${ZLIB_INCLUDE_DIRS})
list(APPEND INKSCAPE_LIBS ${ZLIB_LIBRARIES})
-find_package(ImageMagick COMPONENTS MagickCore Magick++)
-if(ImageMagick_FOUND)
- list(APPEND INKSCAPE_INCS_SYS ${ImageMagick_MagickCore_INCLUDE_DIR})
- list(APPEND INKSCAPE_LIBS ${ImageMagick_Magick++_LIBRARY})
- set(WITH_IMAGE_MAGICK ON) # enable 'Extensions > Raster'
- # TODO: Cmake's ImageMagick module misses required defines for newer
- # versions of ImageMagick. See also:
- # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776832
- #add_definitions(-DMAGICKCORE_HDRI_ENABLE=0) # FIXME (version check?)
- #add_definitions(-DMAGICKCORE_QUANTUM_DEPTH=16) # FIXME (version check?)
+if(WITH_IMAGE_MAGICK)
+ find_package(ImageMagick COMPONENTS MagickCore Magick++)
+ if(ImageMagick_FOUND)
+ # the component-specific paths apparently fail to get detected correctly
+ # on some linux distros (or with older Cmake versions).
+ # Use variables which list all include dirs and libraries instead:
+ list(APPEND INKSCAPE_INCS_SYS ${ImageMagick_INCLUDE_DIRS})
+ list(APPEND INKSCAPE_LIBS ${ImageMagick_LIBRARIES})
+ # TODO: Cmake's ImageMagick module misses required defines for newer
+ # versions of ImageMagick. See also:
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776832
+ #add_definitions(-DMAGICKCORE_HDRI_ENABLE=0) # FIXME (version check?)
+ #add_definitions(-DMAGICKCORE_QUANTUM_DEPTH=16) # FIXME (version check?)
+ else()
+ set(WITH_IMAGE_MAGICK OFF) # enable 'Extensions > Raster'
+ endif()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/IncludeJava.cmake)
# end Dependencies
+list(REMOVE_DUPLICATES INKSCAPE_LIBS)
+list(REMOVE_DUPLICATES INKSCAPE_INCS_SYS)
# C/C++ Flags
include_directories(${INKSCAPE_INCS})
diff --git a/CMakeScripts/Modules/FindIconv.cmake b/CMakeScripts/Modules/FindIconv.cmake
new file mode 100644
index 000000000..338d17d05
--- /dev/null
+++ b/CMakeScripts/Modules/FindIconv.cmake
@@ -0,0 +1,60 @@
+# - Try to find Iconv
+# Once done this will define
+#
+# ICONV_FOUND - system has Iconv
+# ICONV_INCLUDE_DIR - the Iconv include directory
+# ICONV_LIBRARIES - Link these to use Iconv
+# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
+#
+include(CheckCXXSourceCompiles)
+
+IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
+ # Already in cache, be silent
+ SET(ICONV_FIND_QUIETLY TRUE)
+ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
+
+FIND_PATH(ICONV_INCLUDE_DIR iconv.h)
+
+FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c)
+
+IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
+ SET(ICONV_FOUND TRUE)
+ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
+
+set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
+set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
+IF(ICONV_FOUND)
+ check_cxx_source_compiles("
+ #include <iconv.h>
+ int main(){
+ iconv_t conv = 0;
+ const char* in = 0;
+ size_t ilen = 0;
+ char* out = 0;
+ size_t olen = 0;
+ iconv(conv, &in, &ilen, &out, &olen);
+ return 0;
+ }
+" ICONV_SECOND_ARGUMENT_IS_CONST )
+ IF(ICONV_SECOND_ARGUMENT_IS_CONST)
+ SET(ICONV_CONST "const")
+ ENDIF(ICONV_SECOND_ARGUMENT_IS_CONST)
+ENDIF(ICONV_FOUND)
+set(CMAKE_REQUIRED_INCLUDES)
+set(CMAKE_REQUIRED_LIBRARIES)
+
+IF(ICONV_FOUND)
+ IF(NOT ICONV_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
+ ENDIF(NOT ICONV_FIND_QUIETLY)
+ELSE(ICONV_FOUND)
+ IF(Iconv_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find Iconv")
+ ENDIF(Iconv_FIND_REQUIRED)
+ENDIF(ICONV_FOUND)
+
+MARK_AS_ADVANCED(
+ ICONV_INCLUDE_DIR
+ ICONV_LIBRARIES
+ ICONV_SECOND_ARGUMENT_IS_CONST
+)
diff --git a/CMakeScripts/Modules/FindIntl.cmake b/CMakeScripts/Modules/FindIntl.cmake
new file mode 100644
index 000000000..e6c5f6d0c
--- /dev/null
+++ b/CMakeScripts/Modules/FindIntl.cmake
@@ -0,0 +1,127 @@
+#.rst:
+# FindIntl
+# --------
+#
+# Find the Gettext libintl headers and libraries.
+#
+# This module reports information about the Gettext libintl
+# installation in several variables. General variables::
+#
+# Intl_FOUND - true if the libintl headers and libraries were found
+# Intl_INCLUDE_DIRS - the directory containing the libintl headers
+# Intl_LIBRARIES - libintl libraries to be linked
+#
+# The following cache variables may also be set::
+#
+# Intl_INCLUDE_DIR - the directory containing the libintl headers
+# Intl_LIBRARY - the libintl library (if any)
+#
+# .. note::
+# On some platforms, such as Linux with GNU libc, the gettext
+# functions are present in the C standard library and libintl
+# is not required. ``Intl_LIBRARIES`` will be empty in this
+# case.
+#
+# .. note::
+# If you wish to use the Gettext tools (``msgmerge``,
+# ``msgfmt``, etc.), use :module:`FindGettext`.
+
+
+# Written by Roger Leigh <rleigh@codelibre.net>
+
+#=============================================================================
+# Copyright 2014 Roger Leigh <rleigh@codelibre.net>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2015 Kitware, Inc.
+# Copyright 2000-2011 Insight Software Consortium
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+# nor the names of their contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ------------------------------------------------------------------------------
+#
+# The above copyright and license notice applies to distributions of
+# CMake in source and binary form. Some source files contain additional
+# notices of original copyright by their contributors; see each source
+# for details. Third-party software packages supplied with CMake under
+# compatible licenses provide their own copyright notices documented in
+# corresponding subdirectories.
+#
+# ------------------------------------------------------------------------------
+#
+# CMake was initially developed by Kitware with the following sponsorship:
+#
+# * National Library of Medicine at the National Institutes of Health
+# as part of the Insight Segmentation and Registration Toolkit (ITK).
+#
+# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
+# Visualization Initiative.
+#
+# * National Alliance for Medical Image Computing (NAMIC) is funded by the
+# National Institutes of Health through the NIH Roadmap for Medical Research,
+# Grant U54 EB005149.
+#
+# * Kitware, Inc.
+
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Find include directory
+find_path(Intl_INCLUDE_DIR
+ NAMES "libintl.h"
+ DOC "libintl include directory")
+mark_as_advanced(Intl_INCLUDE_DIR)
+
+# Find all Intl libraries
+find_library(Intl_LIBRARY "intl"
+ DOC "libintl libraries (if not in the C library)")
+mark_as_advanced(Intl_LIBRARY)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
+ FOUND_VAR Intl_FOUND
+ REQUIRED_VARS Intl_INCLUDE_DIR
+ FAIL_MESSAGE "Failed to find Gettext libintl")
+
+if(Intl_FOUND)
+ set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
+ if(Intl_LIBRARY)
+ set(Intl_LIBRARIES "${Intl_LIBRARY}")
+ else()
+ unset(Intl_LIBRARIES)
+ endif()
+endif()
diff --git a/CMakeScripts/Modules/FindLibWPG.cmake b/CMakeScripts/Modules/FindLibWPG.cmake
index 0eaf8f102..ea241a570 100644
--- a/CMakeScripts/Modules/FindLibWPG.cmake
+++ b/CMakeScripts/Modules/FindLibWPG.cmake
@@ -29,8 +29,8 @@ else (LIBWPG_LIBRARIES AND LIBWPG_INCLUDE_DIRS)
if (LIBREVENGE_FOUND)
list(APPEND LIBWPG_INCLUDE_DIRS ${LIBWPG-0.3_INCLUDE_DIRS})
list(APPEND LIBWPG_LIBRARIES ${LIBWPG-0.3_LIBRARIES})
- list(APPEND LIBWPG_INCLUDE_DIRS ${LIBREVENGE-0.0_INCLUDE_DIRS})
- list(APPEND LIBWPG_LIBRARIES ${LIBREVENGE-0.0_LIBRARIES})
+ list(APPEND LIBWPG_INCLUDE_DIRS ${LIBREVENGE_INCLUDE_DIRS})
+ list(APPEND LIBWPG_LIBRARIES ${LIBREVENGE_LIBRARIES})
set(LIBWPG03_FOUND TRUE)
endif (LIBREVENGE_FOUND)
else()
diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt
new file mode 100644
index 000000000..b34875502
--- /dev/null
+++ b/share/CMakeLists.txt
@@ -0,0 +1,17 @@
+add_subdirectory(attributes)
+add_subdirectory(branding)
+add_subdirectory(examples)
+add_subdirectory(extensions)
+add_subdirectory(filters)
+add_subdirectory(fonts)
+add_subdirectory(gradients)
+add_subdirectory(icons)
+add_subdirectory(keys)
+add_subdirectory(markers)
+add_subdirectory(palettes)
+add_subdirectory(patterns)
+add_subdirectory(screens)
+add_subdirectory(symbols)
+add_subdirectory(templates)
+add_subdirectory(tutorials)
+add_subdirectory(ui) \ No newline at end of file
diff --git a/share/attributes/CMakeLists.txt b/share/attributes/CMakeLists.txt
new file mode 100644
index 000000000..9b6b0de0a
--- /dev/null
+++ b/share/attributes/CMakeLists.txt
@@ -0,0 +1,2 @@
+set(_FILES "svgprops" "cssprops" "css_defaults" "README")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/attributes)
diff --git a/share/branding/CMakeLists.txt b/share/branding/CMakeLists.txt
new file mode 100644
index 000000000..ff12059ca
--- /dev/null
+++ b/share/branding/CMakeLists.txt
@@ -0,0 +1,2 @@
+file(GLOB _FILES "README" "*.svg")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/branding)
diff --git a/share/examples/CMakeLists.txt b/share/examples/CMakeLists.txt
new file mode 100644
index 000000000..be73c5a87
--- /dev/null
+++ b/share/examples/CMakeLists.txt
@@ -0,0 +1,2 @@
+file(GLOB _FILES "README" "*.svg" "*.svgz" "*.pov")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/examples)
diff --git a/share/extensions/CMakeLists.txt b/share/extensions/CMakeLists.txt
new file mode 100644
index 000000000..c167a156a
--- /dev/null
+++ b/share/extensions/CMakeLists.txt
@@ -0,0 +1,46 @@
+file(GLOB _FILES
+ "README"
+ "fontfix.conf"
+ "inkweb.js"
+ "jessyInk.js"
+ "jessyInk_core_mouseHandler_noclick.js"
+ "jessyInk_core_mouseHandler_zoomControl.js"
+ "aisvg.xslt"
+ "colors.xml"
+ "jessyInk_video.svg"
+ "seamless_pattern.svg"
+ "svg2fxg.xsl"
+ "svg2xaml.xsl"
+ "xaml2svg.xsl"
+ "inkscape.extension.rng"
+ "*.py"
+ "*.pl"
+ "*.sh"
+ "*.rb"
+ "*.inx"
+ )
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions)
+
+file(GLOB _FILES "alphabet_soup/*.svg")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/alphabet_soup)
+
+file(GLOB _FILES "Barcode/*.py")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/Barcode)
+
+file(GLOB _FILES "Poly3DObjects/*.obj")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/Poly3DObjects)
+
+# file(GLOB _FILES
+# "test/*.svg"
+# "test/*.sh"
+# "test/*.py"
+# "test/*.js"
+# "test/run-all-extension-tests"
+# )
+# install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/test)
+
+file(GLOB _FILES "ink2canvas/*.py")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/ink2canvas)
+
+file(GLOB _FILES "xaml2svg/*.xsl")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/xaml2svg)
diff --git a/share/extensions/synfig_prepare.py b/share/extensions/synfig_prepare.py
index c6ad48c97..ebc50fd8e 100755
--- a/share/extensions/synfig_prepare.py
+++ b/share/extensions/synfig_prepare.py
@@ -86,7 +86,7 @@ class InkscapeActionGroup(object):
def select_id(self, object_id):
"""Select object with given id"""
- self.command += "--select='%s' " % (object_id)
+ self.command += "--select=%s " % (object_id)
if not self.has_selection:
self.has_selection = True
diff --git a/share/filters/CMakeLists.txt b/share/filters/CMakeLists.txt
new file mode 100644
index 000000000..6b5356e53
--- /dev/null
+++ b/share/filters/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_custom_command(
+ OUTPUT filters.svg.h
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${CMAKE_CURRENT_SOURCE_DIR}/filters.svg > ${CMAKE_CURRENT_BINARY_DIR}/filters.svg.h
+ MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/filters.svg
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py
+)
+add_custom_target(filters.svg.h ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/filters.svg.h)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/filters.svg.h DESTINATION ${SHARE_INSTALL}/inkscape/filters)
+install(FILES "filters.svg" "README" DESTINATION ${SHARE_INSTALL}/inkscape/filters)
diff --git a/share/fonts/CMakeLists.txt b/share/fonts/CMakeLists.txt
new file mode 100644
index 000000000..d8d9e3684
--- /dev/null
+++ b/share/fonts/CMakeLists.txt
@@ -0,0 +1 @@
+install(FILES "README" DESTINATION ${SHARE_INSTALL}/inkscape/fonts)
diff --git a/share/gradients/CMakeLists.txt b/share/gradients/CMakeLists.txt
new file mode 100644
index 000000000..ec5e388af
--- /dev/null
+++ b/share/gradients/CMakeLists.txt
@@ -0,0 +1 @@
+install(FILES "README" DESTINATION ${SHARE_INSTALL}/inkscape/gradients)
diff --git a/share/icons/CMakeLists.txt b/share/icons/CMakeLists.txt
new file mode 100644
index 000000000..d4994a694
--- /dev/null
+++ b/share/icons/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_subdirectory(application)
+
+file(GLOB _FILES "*.svg" "*.jpg" "*.png" "README")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/icons)
+
+install(FILES ../branding/inkscape.svg DESTINATION ${SHARE_INSTALL}/inkscape/icons)
diff --git a/share/icons/application/CMakeLists.txt b/share/icons/application/CMakeLists.txt
new file mode 100644
index 000000000..f93b4068e
--- /dev/null
+++ b/share/icons/application/CMakeLists.txt
@@ -0,0 +1,9 @@
+set(PIXMAP_SIZES "16x16" "22x22" "24x24" "32x32" "48x48" "256x256")
+set(THEME hicolor)
+foreach(pixmap_size ${PIXMAP_SIZES})
+ FILE(GLOB PIXMAP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${pixmap_size}/*.png ${CMAKE_CURRENT_SOURCE_DIR}/${pixmap_size}/*.svg)
+ install(FILES ${PIXMAP_FILES} DESTINATION ${SHARE_INSTALL}/icons/${THEME}/${pixmap_size}/apps)
+endforeach(pixmap_size)
+
+# I hope that this is actually run after installing the files.
+install(CODE "execute_process(COMMAND gtk-update-icon-cache -f -t ${CMAKE_INSTALL_PREFIX}/${SHARE_INSTALL}/icons/${THEME})") \ No newline at end of file
diff --git a/share/keys/CMakeLists.txt b/share/keys/CMakeLists.txt
new file mode 100644
index 000000000..e968007dc
--- /dev/null
+++ b/share/keys/CMakeLists.txt
@@ -0,0 +1,2 @@
+file(GLOB _FILES "*.xml")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/keys)
diff --git a/share/markers/CMakeLists.txt b/share/markers/CMakeLists.txt
new file mode 100644
index 000000000..410df1cf4
--- /dev/null
+++ b/share/markers/CMakeLists.txt
@@ -0,0 +1,2 @@
+file(GLOB _FILES "*.svg")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/markers)
diff --git a/share/palettes/CMakeLists.txt b/share/palettes/CMakeLists.txt
new file mode 100644
index 000000000..77b4b2a37
--- /dev/null
+++ b/share/palettes/CMakeLists.txt
@@ -0,0 +1,13 @@
+set(I18N_FILES "inkscape.gpl" "svg.gpl" "Tango-Palette.gpl")
+
+add_custom_command(
+ OUTPUT palettes.h
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${I18N_FILES} > ${CMAKE_CURRENT_BINARY_DIR}/palettes.h
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${I18N_FILES}
+)
+add_custom_target(palettes.h ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/palettes.h)
+
+file(GLOB _FILES "*.gpl")
+
+install(FILES ${_FILES} "README" ${CMAKE_CURRENT_BINARY_DIR}/palettes.h DESTINATION ${SHARE_INSTALL}/inkscape/palettes)
diff --git a/share/patterns/CMakeLists.txt b/share/patterns/CMakeLists.txt
new file mode 100644
index 000000000..98415b225
--- /dev/null
+++ b/share/patterns/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_custom_command(
+ OUTPUT patterns.svg.h
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${CMAKE_CURRENT_SOURCE_DIR}/patterns.svg > ${CMAKE_CURRENT_BINARY_DIR}/patterns.svg.h
+ MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/patterns.svg
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py
+)
+add_custom_target(patterns.svg.h ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/patterns.svg.h)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/patterns.svg.h DESTINATION ${SHARE_INSTALL}/inkscape/patterns)
+install(FILES "patterns.svg" "README" DESTINATION ${SHARE_INSTALL}/inkscape/patterns) \ No newline at end of file
diff --git a/share/screens/CMakeLists.txt b/share/screens/CMakeLists.txt
new file mode 100644
index 000000000..b8b848708
--- /dev/null
+++ b/share/screens/CMakeLists.txt
@@ -0,0 +1,2 @@
+file(GLOB _FILES "README" "*.svg")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/screens)
diff --git a/share/symbols/CMakeLists.txt b/share/symbols/CMakeLists.txt
new file mode 100644
index 000000000..ef44c89e4
--- /dev/null
+++ b/share/symbols/CMakeLists.txt
@@ -0,0 +1,11 @@
+file(GLOB _FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.svg")
+
+add_custom_command(
+ OUTPUT symbols.h
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${_FILES} > ${CMAKE_CURRENT_BINARY_DIR}/symbols.h
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${_FILES}
+)
+add_custom_target(symbols.h ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/symbols.h)
+
+install(FILES ${_FILES} "README" ${CMAKE_CURRENT_BINARY_DIR}/symbols.h DESTINATION ${SHARE_INSTALL}/inkscape/symbols)
diff --git a/share/templates/CMakeLists.txt b/share/templates/CMakeLists.txt
new file mode 100644
index 000000000..eee5b4458
--- /dev/null
+++ b/share/templates/CMakeLists.txt
@@ -0,0 +1,11 @@
+file(GLOB _FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.svg")
+
+add_custom_command(
+ OUTPUT templates.h
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${_FILES} > ${CMAKE_CURRENT_BINARY_DIR}/templates.h
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${_FILES}
+)
+add_custom_target(templates.h ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/templates.h)
+
+install(FILES ${_FILES} "README" ${CMAKE_CURRENT_BINARY_DIR}/templates.h DESTINATION ${SHARE_INSTALL}/inkscape/templates)
diff --git a/share/tutorials/CMakeLists.txt b/share/tutorials/CMakeLists.txt
new file mode 100644
index 000000000..f8491bf32
--- /dev/null
+++ b/share/tutorials/CMakeLists.txt
@@ -0,0 +1,2 @@
+file(GLOB _FILES "README" "*.svg" "*.jpg" "*.png")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/tutorials)
diff --git a/share/ui/CMakeLists.txt b/share/ui/CMakeLists.txt
new file mode 100644
index 000000000..89b9f9b0f
--- /dev/null
+++ b/share/ui/CMakeLists.txt
@@ -0,0 +1,3 @@
+file(GLOB _FILES "*.xml" "*.rc")
+install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/ui)
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 27c5e49db..efb604aca 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -519,7 +519,7 @@ add_dependencies(inkscape inkscape_version)
target_link_libraries(inkscape
# order from automake
#sp_LIB
- nrtype_LIB
+ #nrtype_LIB
#inkscape_LIB
#sp_LIB # annoying, we need both!
diff --git a/src/attributes.cpp b/src/attributes.cpp
index 568f0528a..af19360c1 100644
--- a/src/attributes.cpp
+++ b/src/attributes.cpp
@@ -419,6 +419,16 @@ static SPStyleProp const props[] = {
{SP_PROP_FONT_STYLE, "font-style"},
{SP_PROP_FONT_VARIANT, "font-variant"},
{SP_PROP_FONT_WEIGHT, "font-weight"},
+
+ /* Font Variants CSS 3 */
+ {SP_PROP_FONT_VARIANT_LIGATURES, "font-variant-ligatures"},
+ {SP_PROP_FONT_VARIANT_POSITION, "font-variant-position"},
+ {SP_PROP_FONT_VARIANT_CAPS, "font-variant-caps"},
+ {SP_PROP_FONT_VARIANT_NUMERIC, "font-variant-numeric"},
+ {SP_PROP_FONT_VARIANT_ALTERNATES, "font-variant-alternates"},
+ {SP_PROP_FONT_VARIANT_EAST_ASIAN, "font-variant-east-asian"},
+ {SP_PROP_FONT_FEATURE_SETTINGS, "font-feature-settings"},
+
/* Text */
{SP_PROP_TEXT_INDENT, "text-indent"},
{SP_PROP_TEXT_ALIGN, "text-align"},
@@ -426,6 +436,7 @@ static SPStyleProp const props[] = {
{SP_PROP_LETTER_SPACING, "letter-spacing"},
{SP_PROP_WORD_SPACING, "word-spacing"},
{SP_PROP_TEXT_TRANSFORM, "text-transform"},
+
/* Text (css3) */
{SP_PROP_DIRECTION, "direction"},
{SP_PROP_BLOCK_PROGRESSION, "block-progression"},
@@ -439,16 +450,21 @@ static SPStyleProp const props[] = {
{SP_PROP_KERNING, "kerning"},
{SP_PROP_TEXT_ANCHOR, "text-anchor"},
{SP_PROP_WHITE_SPACE, "white-space"},
+
/* SVG 2 Text Wrapping */
{SP_PROP_SHAPE_INSIDE, "shape-inside"},
{SP_PROP_SHAPE_OUTSIDE, "shape-outside"},
{SP_PROP_SHAPE_PADDING, "shape-padding"},
{SP_PROP_SHAPE_MARGIN, "shape-margin"},
+
/* Text Decoration */
- {SP_PROP_TEXT_DECORATION, "text-decoration"},
- {SP_PROP_TEXT_DECORATION_LINE, "text-decoration-line"},
- {SP_PROP_TEXT_DECORATION_STYLE,"text-decoration-style"},
- {SP_PROP_TEXT_DECORATION_COLOR,"text-decoration-color"},
+ {SP_PROP_TEXT_DECORATION, "text-decoration"},
+ {SP_PROP_TEXT_DECORATION_LINE, "text-decoration-line"},
+ {SP_PROP_TEXT_DECORATION_STYLE, "text-decoration-style"},
+ {SP_PROP_TEXT_DECORATION_COLOR, "text-decoration-color"},
+ {SP_PROP_TEXT_DECORATION_FILL, "text-decoration-fill"},
+ {SP_PROP_TEXT_DECORATION_STROKE,"text-decoration-stroke"},
+
/* Misc */
{SP_PROP_CLIP, "clip"},
{SP_PROP_COLOR, "color"},
diff --git a/src/attributes.h b/src/attributes.h
index 91c8868f9..7d6ea70a0 100644
--- a/src/attributes.h
+++ b/src/attributes.h
@@ -424,6 +424,15 @@ enum SPAttributeEnum {
SP_PROP_FONT_VARIANT,
SP_PROP_FONT_WEIGHT,
+ /* Font Variants CSS 3 */
+ SP_PROP_FONT_VARIANT_LIGATURES,
+ SP_PROP_FONT_VARIANT_POSITION,
+ SP_PROP_FONT_VARIANT_CAPS,
+ SP_PROP_FONT_VARIANT_NUMERIC,
+ SP_PROP_FONT_VARIANT_ALTERNATES,
+ SP_PROP_FONT_VARIANT_EAST_ASIAN,
+ SP_PROP_FONT_FEATURE_SETTINGS,
+
/* Text Layout */
SP_PROP_TEXT_INDENT,
SP_PROP_TEXT_ALIGN,
@@ -446,16 +455,20 @@ enum SPAttributeEnum {
SP_PROP_TEXT_ANCHOR,
SP_PROP_WHITE_SPACE,
+ /* SVG 2 Text Wrapping */
SP_PROP_SHAPE_INSIDE,
SP_PROP_SHAPE_OUTSIDE,
SP_PROP_SHAPE_PADDING,
SP_PROP_SHAPE_MARGIN,
- /* Text Decoration */
- SP_PROP_TEXT_DECORATION, /* SVG 1 underline etc.( no color or style) OR SVG2 with _LINE, _STYLE, _COLOR values */
- SP_PROP_TEXT_DECORATION_LINE, /* SVG 2 underline etc. */
- SP_PROP_TEXT_DECORATION_STYLE, /* SVG 2 proposed solid [SVG 1], dotted, etc.)*/
- SP_PROP_TEXT_DECORATION_COLOR, /* SVG 2 proposed same as text [SVG 1], specified*/
+ /* Text Decoration CSS 2/CSS 3 Shorthand */
+ SP_PROP_TEXT_DECORATION,
+ /* Text Decoration CSS 3/SVG 2 */
+ SP_PROP_TEXT_DECORATION_LINE,
+ SP_PROP_TEXT_DECORATION_STYLE,
+ SP_PROP_TEXT_DECORATION_COLOR,
+ SP_PROP_TEXT_DECORATION_FILL,
+ SP_PROP_TEXT_DECORATION_STROKE,
/* Misc */
SP_PROP_CLIP,
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 5a1558b0f..02df50c6b 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -947,7 +947,6 @@ void SPDesktop::zoom_quick(bool enable)
if (!zoomed) {
zoom_relative(_quick_zoom_stored_area.midpoint()[Geom::X], _quick_zoom_stored_area.midpoint()[Geom::Y], 2.0);
- zoomed = true;
}
} else {
set_display_area(_quick_zoom_stored_area, false);
diff --git a/src/dir-util.cpp b/src/dir-util.cpp
index c9b88b007..64f7ab7e7 100644
--- a/src/dir-util.cpp
+++ b/src/dir-util.cpp
@@ -217,7 +217,7 @@ erange:
return (NULL);
}
-gchar *prepend_current_dir_if_relative(gchar const *uri)
+char *prepend_current_dir_if_relative(gchar const *uri)
{
if (!uri) {
return NULL;
diff --git a/src/dir-util.h b/src/dir-util.h
index e78cad6a6..327e1ad5f 100644
--- a/src/dir-util.h
+++ b/src/dir-util.h
@@ -12,7 +12,7 @@
#include <cstdlib>
#include <string>
-/**
+/**
* Returns a form of \a path relative to \a base if that is easy to construct (eg if \a path
* appears to be in the directory specified by \a base), otherwise returns \a path.
*
@@ -49,7 +49,7 @@ char *inkscape_rel2abs(char const *path, char const *base, char *result, size_t
char *inkscape_abs2rel(char const *path, char const *base, char *result, size_t const size);
-gchar *prepend_current_dir_if_relative(char const *filename);
+char *prepend_current_dir_if_relative(char const *filename);
#endif // !SEEN_DIR_UTIL_H
diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp
index 8738b93e4..ec99eca9a 100644
--- a/src/display/canvas-arena.cpp
+++ b/src/display/canvas-arena.cpp
@@ -290,7 +290,7 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event)
ret = sp_canvas_arena_send_event (arena, (GdkEvent *) &ec);
}
}
- ret = sp_canvas_arena_send_event (arena, event);
+ ret = ret || sp_canvas_arena_send_event (arena, event);
break;
case GDK_SCROLL: {
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 4eda9b194..decf93626 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -906,7 +906,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf)
gdouble const syg = floor ((buf->rect.top() - ow[Geom::Y]) / sw[Geom::Y]) * sw[Geom::Y] + ow[Geom::Y];
gint const ylinestart = round((syg - ow[Geom::Y]) / sw[Geom::Y]);
- //set correct coloring, depending preference (when zoomed out, always major coloring or minor coloring)
+ // no_emphasize_when_zoomedout determines color (minor or major) when only major grid lines/dots shown.
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
guint32 _empcolor;
bool no_emp_when_zoomed_out = prefs->getBool("/options/grids/no_emphasize_when_zoomedout", false);
@@ -922,6 +922,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf)
cairo_set_line_cap(buf->ct, CAIRO_LINE_CAP_SQUARE);
if (!render_dotted) {
+ // Line grid
gint ylinenum;
gdouble y;
for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) {
@@ -944,8 +945,23 @@ CanvasXYGrid::Render (SPCanvasBuf *buf)
}
}
} else {
+ // Dotted grid
gint ylinenum;
gdouble y;
+
+ // alpha needs to be larger than in the line case to maintain a similar visual impact but
+ // setting it to the maximal value makes the dots dominant in some cases. Solution,
+ // increase the alpha by a factor of 4. This then allows some user adjustment.
+ guint32 _empdot = (_empcolor & 0xff) << 2;
+ if (_empdot > 0xff)
+ _empdot = 0xff;
+ _empdot += (_empcolor & 0xffffff00);
+
+ guint32 _colordot = (color & 0xff) << 2;
+ if (_colordot > 0xff)
+ _colordot = 0xff;
+ _colordot += (color & 0xffffff00);
+
for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) {
gint const iy = round(y);
@@ -957,13 +973,15 @@ CanvasXYGrid::Render (SPCanvasBuf *buf)
|| (!scaled[Geom::Y] && (ylinenum % empspacing) != 0)
|| ((scaled[Geom::X] || scaled[Geom::Y]) && no_emp_when_zoomed_out) )
{
- grid_dot (buf, ix, iy, color | (guint32)0x000000FF); // put alpha to max value
+ // Minor point: dot only
+ grid_dot (buf, ix, iy, _colordot); // | (guint32)0x000000FF); // put alpha to max value
} else {
+ // Major point: small cross
gint const pitch = 1;
grid_dot (buf, ix-pitch, iy, _empcolor);
grid_dot (buf, ix+pitch, iy, _empcolor);
- grid_dot (buf, ix, iy, _empcolor | (guint32)0x000000FF); // put alpha to max value
+ grid_dot (buf, ix, iy, _empdot ); // | (guint32)0x000000FF); // put alpha to max value
grid_dot (buf, ix, iy-pitch, _empcolor);
grid_dot (buf, ix, iy+pitch, _empcolor);
diff --git a/src/document.cpp b/src/document.cpp
index f06953e34..741e7c812 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -1591,7 +1591,7 @@ static void vacuum_document_recursive(SPObject *obj)
unsigned int SPDocument::vacuumDocument()
{
unsigned int start = objects_in_document(this);
- unsigned int end = start;
+ unsigned int end;
unsigned int newend = start;
unsigned int iterations = 0;
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index 5cab3a2b2..e07a3963c 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -812,6 +812,12 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr
}
}
+ if(!oldroot_namedview)
+ {
+ g_warning("Error on copy_doc: No namedview on destination document.");
+ return;
+ }
+
// Unparent (delete)
for (unsigned int i = 0; i < delete_list.size(); i++) {
sp_repr_unparent(delete_list[i]);
@@ -823,12 +829,10 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr
child = child->next()) {
if (!strcmp("sodipodi:namedview", child->name())) {
newroot_namedview = child;
- if (oldroot_namedview != NULL) {
- for (Inkscape::XML::Node * newroot_namedview_child = child->firstChild();
- newroot_namedview_child != NULL;
- newroot_namedview_child = newroot_namedview_child->next()) {
- oldroot_namedview->appendChild(newroot_namedview_child->duplicate(oldroot->document()));
- }
+ for (Inkscape::XML::Node * newroot_namedview_child = child->firstChild();
+ newroot_namedview_child != NULL;
+ newroot_namedview_child = newroot_namedview_child->next()) {
+ oldroot_namedview->appendChild(newroot_namedview_child->duplicate(oldroot->document()));
}
} else {
oldroot->appendChild(child->duplicate(oldroot->document()));
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index b5859c283..c3e416184 100644
--- a/src/extension/internal/cairo-render-context.cpp
+++ b/src/extension/internal/cairo-render-context.cpp
@@ -1392,6 +1392,7 @@ CairoRenderContext::_setStrokeStyle(SPStyle const *style, Geom::OptRect const &p
dashes[i] = style->stroke_dasharray.values[i];
}
cairo_set_dash(_cr, dashes, ndashes, style->stroke_dashoffset.value);
+ free(dashes);
} else {
cairo_set_dash(_cr, NULL, 0, 0.0); // disable dashing
}
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp
index 49e145de0..5a5553e97 100644
--- a/src/extension/internal/cairo-renderer.cpp
+++ b/src/extension/internal/cairo-renderer.cpp
@@ -296,7 +296,7 @@ static void sp_group_render(SPGroup *group, CairoRenderContext *ctx)
std::vector<SPObject*> l(group->childList(false));
for(std::vector<SPObject*>::const_iterator x = l.begin(); x!= l.end(); x++){
- SPItem *item = static_cast<SPItem*>(*x);
+ SPItem *item = dynamic_cast<SPItem*>(*x);
if (item) {
renderer->renderItem(ctx, item);
}
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index ab863f8b1..1026f51ad 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -230,7 +230,7 @@ void LaTeXTextRenderer::sp_group_render(SPGroup *group)
{
std::vector<SPObject*> l = (group->childList(false));
for(std::vector<SPObject*>::const_iterator x = l.begin(); x != l.end(); x++){
- SPItem *item = static_cast<SPItem*>(*x);
+ SPItem *item = dynamic_cast<SPItem*>(*x);
if (item) {
renderItem(item);
}
diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp
index 3ab7a4e89..f76fa16b4 100644
--- a/src/extension/internal/wmf-inout.cpp
+++ b/src/extension/internal/wmf-inout.cpp
@@ -95,7 +95,6 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename)
SPPrintContext context;
const gchar *oldconst;
gchar *oldoutput;
- unsigned int ret;
doc->ensureUpToDate();
@@ -114,13 +113,12 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename)
mod->root = mod->base->invoke_show(drawing, mod->dkey, SP_ITEM_SHOW_DISPLAY);
drawing.setRoot(mod->root);
/* Print document */
- ret = mod->begin(doc);
- if (ret) {
+ if (mod->begin(doc)) {
g_free(oldoutput);
throw Inkscape::Extension::Output::save_failed();
}
mod->base->invoke_print(&context);
- ret = mod->finish();
+ mod->finish();
/* Release arena */
mod->base->invoke_hide(mod->dkey);
mod->base = NULL;
diff --git a/src/file.cpp b/src/file.cpp
index d1dd2bcd6..984bf7e08 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -769,7 +769,7 @@ file_save_remote(SPDocument */*doc*/,
return false;
}
- result = gnome_vfs_create (&to_handle, uri_local, GNOME_VFS_OPEN_WRITE, FALSE, GNOME_VFS_PERM_USER_ALL);
+ gnome_vfs_create (&to_handle, uri_local, GNOME_VFS_OPEN_WRITE, FALSE, GNOME_VFS_PERM_USER_ALL);
result = gnome_vfs_open (&to_handle, uri_local, GNOME_VFS_OPEN_WRITE);
if (result != GNOME_VFS_OK) {
@@ -782,8 +782,8 @@ file_save_remote(SPDocument */*doc*/,
result = gnome_vfs_read (from_handle, buffer, 8192, &bytes_read);
if ((result == GNOME_VFS_ERROR_EOF) &&(!bytes_read)){
- result = gnome_vfs_close (from_handle);
- result = gnome_vfs_close (to_handle);
+ gnome_vfs_close (from_handle);
+ gnome_vfs_close (to_handle);
return true;
}
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index 169710114..b22714959 100644
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -1155,7 +1155,7 @@ static void gr_knot_clicked_handler(SPKnot */*knot*/, guint state, gpointer data
break;
default:
- break;
+ return;
}
diff --git a/src/helper-fns.h b/src/helper-fns.h
index 2f1829c37..79771a001 100644
--- a/src/helper-fns.h
+++ b/src/helper-fns.h
@@ -78,7 +78,7 @@ inline std::vector<gdouble> helperfns_read_vector(const gchar* value){
g_warning("helper-fns::helperfns_read_vector() Unable to convert \"%s\" to number", beg);
// We could leave this out, too. If strtod can't convert
// anything, it will return zero.
- ret = 0;
+ // ret = 0;
break;
}
v.push_back(ret);
diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp
index 91689375f..77cba4736 100644
--- a/src/helper/geom.cpp
+++ b/src/helper/geom.cpp
@@ -266,14 +266,13 @@ geom_cubic_bbox_wind_distance (Geom::Coord x000, Geom::Coord y000,
Geom::Coord tolerance)
{
Geom::Coord x0, y0, x1, y1, len2;
- int needdist, needwind, needline;
+ int needdist, needwind;
const Geom::Coord Px = pt[X];
const Geom::Coord Py = pt[Y];
needdist = 0;
needwind = 0;
- needline = 0;
if (bbox) cubic_bbox (x000, y000, x001, y001, x011, y011, x111, y111, *bbox);
@@ -303,8 +302,6 @@ geom_cubic_bbox_wind_distance (Geom::Coord x000, Geom::Coord y000,
/* fixme: (Lauris) */
if (((y1 - y0) > 5.0) || ((x1 - x0) > 5.0)) {
needdist = 1;
- } else {
- needline = 1;
}
}
}
@@ -315,8 +312,6 @@ geom_cubic_bbox_wind_distance (Geom::Coord x000, Geom::Coord y000,
/* fixme: (Lauris) */
if (((y1 - y0) > 5.0) || ((x1 - x0) > 5.0)) {
needwind = 1;
- } else {
- needline = 1;
}
}
}
@@ -345,7 +340,7 @@ geom_cubic_bbox_wind_distance (Geom::Coord x000, Geom::Coord y000,
geom_cubic_bbox_wind_distance (x000, y000, x00t, y00t, x0tt, y0tt, xttt, yttt, pt, NULL, wind, best, tolerance);
geom_cubic_bbox_wind_distance (xttt, yttt, x1tt, y1tt, x11t, y11t, x111, y111, pt, NULL, wind, best, tolerance);
- } else if (1 || needline) {
+ } else {
geom_line_wind_distance (x000, y000, x111, y111, pt, wind, best);
}
}
diff --git a/src/inkview.cpp b/src/inkview.cpp
index 2c667237e..8b7492798 100644
--- a/src/inkview.cpp
+++ b/src/inkview.cpp
@@ -274,7 +274,7 @@ main (int argc, const char **argv)
gchar *last_filename = jar_file_reader.get_last_filename();
if (ss.doc) {
ss.slides[ss.length++] = strdup (last_filename);
- (ss.doc)->setUri (strdup(last_filename));
+ (ss.doc)->setUri (last_filename);
}
g_byte_array_free(gba, TRUE);
g_free(last_filename);
diff --git a/src/libavoid/connector.cpp b/src/libavoid/connector.cpp
index 40ded7498..36892c668 100644
--- a/src/libavoid/connector.cpp
+++ b/src/libavoid/connector.cpp
@@ -1476,7 +1476,6 @@ CrossingsInfoPair countRealCrossings(Avoid::Polygon& poly,
int prevTurnDir = -1;
int startCornerSide = 1;
int endCornerSide = 1;
- bool reversed = false;
if (!front_same)
{
// If there is a divergence at the beginning,
@@ -1485,7 +1484,6 @@ CrossingsInfoPair countRealCrossings(Avoid::Polygon& poly,
startCornerSide = Avoid::cornerSide(*c_path[0], *c_path[1],
*c_path[2], *p_path[0])
* segDir(*c_path[1], *c_path[2]);
- reversed = (startCornerSide != -prevTurnDir);
}
if (!back_same)
{
@@ -1497,7 +1495,6 @@ CrossingsInfoPair countRealCrossings(Avoid::Polygon& poly,
*c_path[size - 2], *c_path[size - 1],
*p_path[size - 1])
* segDir(*c_path[size - 3], *c_path[size - 2]);
- reversed = (endCornerSide != -prevTurnDir);
}
else
{
@@ -1578,10 +1575,9 @@ CrossingsInfoPair countRealCrossings(Avoid::Polygon& poly,
}
}
#endif
- prevTurnDir = 0;
if (pointOrders)
{
- reversed = false;
+ bool reversed = false;
size_t startPt = (front_same) ? 0 : 1;
// Orthogonal should always have at least one segment.
diff --git a/src/libavoid/graph.cpp b/src/libavoid/graph.cpp
index 728f8c085..5b617f123 100644
--- a/src/libavoid/graph.cpp
+++ b/src/libavoid/graph.cpp
@@ -129,7 +129,9 @@ static inline int orthogTurnOrder(const Point& a, const Point& b,
// Note: This method assumes the two Edges that share a common point.
bool EdgeInf::rotationLessThan(const VertInf *lastV, const EdgeInf *rhs) const
{
- if ((_v1 == rhs->_v1) && (_v2 == rhs->_v2))
+ assert(_v1 == rhs->_v1 || _v1 == rhs->_v2 || _v2 == rhs->_v1 || _v2 == rhs->_v2 );
+
+ if ((_v1 == rhs->_v1) && (_v2 == rhs->_v2))
{
// Effectively the same visibility edge, so they are equal.
return false;
diff --git a/src/libavoid/orthogonal.cpp b/src/libavoid/orthogonal.cpp
index b5ef8d7e8..466d1dd58 100644
--- a/src/libavoid/orthogonal.cpp
+++ b/src/libavoid/orthogonal.cpp
@@ -1548,7 +1548,6 @@ extern void generateStaticOrthogonalVisGraph(Router *router)
// Process the horizontal sweep
thisPos = (totalEvents > 0) ? events[0]->pos : 0;
posStartIndex = 0;
- posFinishIndex = 0;
for (unsigned i = 0; i <= totalEvents; ++i)
{
// If we have finished the current scanline or all events, then we
diff --git a/src/libnrtype/Layout-TNG-OutIter.cpp b/src/libnrtype/Layout-TNG-OutIter.cpp
index c9c318960..707897f50 100644
--- a/src/libnrtype/Layout-TNG-OutIter.cpp
+++ b/src/libnrtype/Layout-TNG-OutIter.cpp
@@ -788,12 +788,12 @@ bool Layout::iterator::prevLineCursor(int n)
{
if (!_cursor_moving_vertically)
beginCursorUpDown();
- unsigned line_index;
+ int line_index;
if (_char_index == _parent_layout->_characters.size())
line_index = _parent_layout->_lines.size() - 1;
else
line_index = _parent_layout->_characters[_char_index].chunk(_parent_layout).in_line;
- if (line_index == 0)
+ if (line_index <= 0)
return false; // nowhere to go
else
n = MIN (n, static_cast<int>(line_index));
diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h
index e91c32ebe..26db1fad9 100644
--- a/src/libnrtype/Layout-TNG.h
+++ b/src/libnrtype/Layout-TNG.h
@@ -701,7 +701,11 @@ private:
/** The overall block-progression of the whole flow. */
inline Direction _blockProgression() const
- {return static_cast<InputStreamTextSource*>(_input_stream.front())->styleGetBlockProgression();}
+ {
+ if(!_input_stream.empty())
+ return static_cast<InputStreamTextSource*>(_input_stream.front())->styleGetBlockProgression();
+ return TOP_TO_BOTTOM;
+ }
/** so that LEFT_TO_RIGHT == RIGHT_TO_LEFT but != TOP_TO_BOTTOM */
static bool _directions_are_orthogonal(Direction d1, Direction d2);
diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp
index 003e22567..fafe143b5 100644
--- a/src/live_effects/lpe-gears.cpp
+++ b/src/live_effects/lpe-gears.cpp
@@ -168,7 +168,7 @@ Geom::Path Gear::path() {
D2<SBasis> root = _arc(cursor, cursor+root_advance, root_radius());
makeContinuous(root, prev);
pb.append(SBasisCurve(root));
- cursor += root_advance;
+ //cursor += root_advance;
prev = root.at1();
if (base_radius() > root_radius()) {
diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp
index 2c74af6d6..451810d04 100644
--- a/src/live_effects/lpe-taperstroke.cpp
+++ b/src/live_effects/lpe-taperstroke.cpp
@@ -389,13 +389,9 @@ Piecewise<D2<SBasis> > stretch_along(Piecewise<D2<SBasis> > pwd2_in, Geom::Path
x0 -= pattBndsX->min();
y0 -= pattBndsY->middle();
- double xspace = 0;
double noffset = 0;
double toffset = 0;
// Prevent more than 90% overlap...
- if (xspace < -pattBndsX->extent()*.9) {
- xspace = -pattBndsX->extent()*.9;
- }
y0+=noffset;
diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp
index e9d375b93..f05f401e4 100644
--- a/src/live_effects/parameter/filletchamferpointarray.cpp
+++ b/src/live_effects/parameter/filletchamferpointarray.cpp
@@ -506,7 +506,6 @@ std::vector<double> FilletChamferPointArrayParam::get_times(int index, std::vect
time_it1 = 0;
}
double resultLenght = 0;
- time_it1_B = 1;
if (subpaths[positions.first].closed() && last) {
time_it2 = modf(to_time(index - positions.second , _vector[index - positions.second ][X]), &intpart);
resultLenght = it1_length + to_len(index - positions.second, _vector[index - positions.second ][X]);
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 8d2695b85..7bd5b6298 100644
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
@@ -388,7 +388,7 @@ sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>&
if (repr) {
to_select.insert(to_select.begin(),repr);
did = true;
- selected.erase(find(selected.begin(),selected.end(),item));
+ selected.erase(remove(selected.begin(), selected.end(), item), selected.end());
}
continue;
@@ -413,7 +413,7 @@ sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>&
continue;
did = true;
- selected.erase(find(selected.begin(),selected.end(),item));
+ selected.erase(remove(selected.begin(), selected.end(), item), selected.end());
// remember the position of the item
gint pos = item->getRepr()->position();
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index a604064cc..971c8dcee 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -927,7 +927,7 @@ static SPObject *prev_sibling(SPObject *child)
return prev;
}
-int sp_item_repr_compare_position_obj(SPObject const *first, SPObject const *second)
+bool sp_item_repr_compare_position_bool(SPObject const *first, SPObject const *second)
{
return sp_repr_compare_position(((SPItem*)first)->getRepr(),
((SPItem*)second)->getRepr())<0;
@@ -952,7 +952,7 @@ sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop)
/* Construct reverse-ordered list of selected children. */
std::vector<SPItem*> rev(items);
- sort(rev.begin(),rev.end(),sp_item_repr_compare_position);
+ sort(rev.begin(),rev.end(),sp_item_repr_compare_position_bool);
// Determine the common bbox of the selected items.
Geom::OptRect selected = enclose_items(items);
@@ -1034,7 +1034,7 @@ void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop)
/* Construct direct-ordered list of selected children. */
std::vector<SPItem*> rev(items);
- sort(rev.begin(),rev.end(),sp_item_repr_compare_position);
+ sort(rev.begin(),rev.end(),sp_item_repr_compare_position_bool);
// Iterate over all objects in the selection (starting from top).
if (selected) {
@@ -1837,6 +1837,15 @@ void sp_select_same_fill_stroke_style(SPDesktop *desktop, gboolean fill, gboolea
Inkscape::Selection *selection = desktop->getSelection();
std::vector<SPItem*> items = selection->itemList();
+
+ std::vector<SPItem*> tmp;
+ for (std::vector<SPItem*>::const_iterator iter=all_list.begin();iter!=all_list.end();iter++) {
+ if(!SP_IS_GROUP(*iter)){
+ tmp.push_back(*iter);
+ }
+ }
+ all_list=tmp;
+
for (std::vector<SPItem*>::const_iterator sel_iter=items.begin();sel_iter!=items.end();sel_iter++) {
SPItem *sel = *sel_iter;
std::vector<SPItem*> matches = all_list;
@@ -3509,7 +3518,7 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop)
std::vector<SPItem*> items(selection->itemList());
// Sort items so that the topmost comes last
- sort(items.begin(),items.end(),sp_item_repr_compare_position);
+ sort(items.begin(),items.end(),sp_item_repr_compare_position_bool);
// Generate a random value from the current time (you may create bitmap from the same object(s)
// multiple times, and this is done so that they don't clash)
@@ -3778,13 +3787,11 @@ void sp_selection_set_clipgroup(SPDesktop *desktop)
clone->setAttribute("inkscape:transform-center-y", inner->attribute("inkscape:transform-center-y"), false);
const Geom::Affine maskTransform(Geom::Affine::identity());
- GSList *templist = NULL;
-
- templist = g_slist_append(templist, clone);
+ std::vector<Inkscape::XML::Node*> templist;
+ templist.push_back(clone);
// add the new clone to the top of the original's parent
gchar const *mask_id = SPClipPath::create(templist, doc, &maskTransform);
- g_slist_free(templist);
outer->setAttribute("clip-path", g_strdup_printf("url(#%s)", mask_id));
@@ -3842,9 +3849,9 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
selection->clear();
// create a list of duplicates
- GSList *mask_items = NULL;
- GSList *apply_to_items = NULL;
- GSList *items_to_delete = NULL;
+ std::vector<Inkscape::XML::Node*> mask_items;
+ std::vector<SPItem*> apply_to_items;
+ std::vector<SPItem*> items_to_delete;
std::vector<SPItem*> items_to_select;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -3854,54 +3861,36 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
if (apply_to_layer) {
// all selected items are used for mask, which is applied to a layer
- apply_to_items = g_slist_prepend(apply_to_items, desktop->currentLayer());
+ apply_to_items.push_back(SP_ITEM(desktop->currentLayer()));
+ }
- for (std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++) {
+ for (std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++) {
+ if((!topmost && !apply_to_layer && *i == items.front())
+ || (topmost && !apply_to_layer && *i == items.back())
+ || apply_to_layer){
+
+ Geom::Affine oldtr=(*i)->transform;
+ (*i)->doWriteTransform((*i)->getRepr(), (*i)->i2doc_affine());
Inkscape::XML::Node *dup = (*i)->getRepr()->duplicate(xml_doc);
- mask_items = g_slist_prepend(mask_items, dup);
+ (*i)->doWriteTransform((*i)->getRepr(), oldtr);
+ mask_items.push_back(dup);
- SPObject *item = *i;
if (remove_original) {
- items_to_delete = g_slist_prepend(items_to_delete, item);
+ items_to_delete.push_back(*i);
}
else {
- items_to_select.push_back((SPItem*)item);
+ items_to_select.push_back(*i);
}
- }
- } else if (!topmost) {
- // topmost item is used as a mask, which is applied to other items in a selection
- Inkscape::XML::Node *dup = items[0]->getRepr()->duplicate(xml_doc);
- mask_items = g_slist_prepend(mask_items, dup);
-
- if (remove_original) {
- SPObject *item = items.front();
- items_to_delete = g_slist_prepend(items_to_delete, item);
- }
-
- for (std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++) {
- if(i==items.begin())continue;
- apply_to_items = g_slist_prepend(apply_to_items, *i);
+ continue;
+ }else{
+ apply_to_items.push_back(*i);
items_to_select.push_back(*i);
}
- } else {
- SPItem *i = NULL;
- for (std::vector<SPItem*>::const_iterator j=items.begin();j!=items.end();j++) {
- i=*j;
- apply_to_items = g_slist_prepend(apply_to_items, i);
- items_to_select.push_back(i);
- }
-
- Inkscape::XML::Node *dup = SP_OBJECT(i)->getRepr()->duplicate(xml_doc);
- mask_items = g_slist_prepend(mask_items, dup);
-
- if (remove_original) {
- SPObject *item = reinterpret_cast<SPObject*>(i);
- items_to_delete = g_slist_prepend(items_to_delete, item);
- }
}
+
items.clear();
- if (apply_to_items && grouping == PREFS_MASKOBJECT_GROUPING_ALL) {
+ if (grouping == PREFS_MASKOBJECT_GROUPING_ALL) {
// group all those objects into one group
// and apply mask to that
Inkscape::XML::Node *group = xml_doc->createElement("svg:g");
@@ -3910,48 +3899,35 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
group->setAttribute("inkscape:groupmode", "maskhelper");
std::vector<Inkscape::XML::Node*> reprs_to_group;
-
- for (GSList *i = apply_to_items ; NULL != i ; i = i->next) {
- reprs_to_group.push_back(static_cast<SPObject*>(i->data)->getRepr());
- items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),static_cast<SPObject*>(i->data)));
+ for (std::vector<SPItem*>::const_iterator i = apply_to_items.begin(); i != apply_to_items.end(); i++) {
+ reprs_to_group.push_back(static_cast<SPObject*>(*i)->getRepr());
}
+ items_to_select.clear();
sp_selection_group_impl(reprs_to_group, group, xml_doc, doc);
// apply clip/mask only to newly created group
- g_slist_free(apply_to_items);
- apply_to_items = NULL;
- apply_to_items = g_slist_prepend(apply_to_items, doc->getObjectByRepr(group));
+ apply_to_items.clear();
+ apply_to_items.push_back(dynamic_cast<SPItem*>(doc->getObjectByRepr(group)));
items_to_select.push_back((SPItem*)(doc->getObjectByRepr(group)));
Inkscape::GC::release(group);
}
+ if (grouping == PREFS_MASKOBJECT_GROUPING_SEPARATE) {
+ items_to_select.clear();
+ }
+
gchar const *attributeName = apply_clip_path ? "clip-path" : "mask";
- for (GSList *i = apply_to_items; NULL != i; i = i->next) {
- SPItem *item = reinterpret_cast<SPItem *>(i->data);
+ for (std::vector<SPItem*>::const_reverse_iterator i = apply_to_items.rbegin(); i != apply_to_items.rend(); i++) {
+ SPItem *item = reinterpret_cast<SPItem *>(*i);
// inverted object transform should be applied to a mask object,
// as mask is calculated in user space (after applying transform)
- Geom::Affine maskTransform(item->transform.inverse());
-
- GSList *mask_items_dup = NULL;
- for (GSList *mask_item = mask_items; NULL != mask_item; mask_item = mask_item->next) {
- Inkscape::XML::Node *dup = reinterpret_cast<Inkscape::XML::Node *>(mask_item->data)->duplicate(xml_doc);
- mask_items_dup = g_slist_prepend(mask_items_dup, dup);
- }
-
- gchar const *mask_id = NULL;
- if (apply_clip_path) {
- mask_id = SPClipPath::create(mask_items_dup, doc, &maskTransform);
- } else {
- mask_id = sp_mask_create(mask_items_dup, doc, &maskTransform);
- }
-
- g_slist_free(mask_items_dup);
- mask_items_dup = NULL;
-
- Inkscape::XML::Node *current = SP_OBJECT(i->data)->getRepr();
+ std::vector<Inkscape::XML::Node*> mask_items_dup;
+ for(std::vector<Inkscape::XML::Node*>::const_iterator it=mask_items.begin();it!=mask_items.end();it++)
+ mask_items_dup.push_back((*it)->duplicate(xml_doc));
+ Inkscape::XML::Node *current = SP_OBJECT(*i)->getRepr();
// Node to apply mask to
Inkscape::XML::Node *apply_mask_to = current;
@@ -3963,7 +3939,6 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
Inkscape::XML::Node *spnew = current->duplicate(xml_doc);
gint position = current->position();
- items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),item));
current->parent()->appendChild(group);
sp_repr_unparent(current);
group->appendChild(spnew);
@@ -3972,24 +3947,29 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
// Apply clip/mask to group instead
apply_mask_to = group;
- items_to_select.push_back((SPItem*)(doc->getObjectByRepr(group)));
+ items_to_select.push_back(item = (SPItem*)(doc->getObjectByRepr(group)));
Inkscape::GC::release(spnew);
Inkscape::GC::release(group);
}
+ Geom::Affine maskTransform(item->i2doc_affine().inverse());
+
+ gchar const *mask_id = NULL;
+ if (apply_clip_path) {
+ mask_id = SPClipPath::create(mask_items_dup, doc, &maskTransform);
+ } else {
+ mask_id = sp_mask_create(mask_items_dup, doc, &maskTransform);
+ }
+
apply_mask_to->setAttribute(attributeName, Glib::ustring("url(#") + mask_id + ')');
}
- g_slist_free(mask_items);
- g_slist_free(apply_to_items);
-
- for (GSList *i = items_to_delete; NULL != i; i = i->next) {
- SPObject *item = reinterpret_cast<SPObject*>(i->data);
+ for (std::vector<SPItem*>::const_iterator i = items_to_delete.begin(); i != items_to_delete.end(); i++) {
+ SPObject *item = reinterpret_cast<SPObject*>(*i);
item->deleteObject(false);
- items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),item));
+ items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), item), items_to_select.end());
}
- g_slist_free(items_to_delete);
selection->addList(items_to_select);
@@ -4112,7 +4092,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) {
for (GSList *i = items_to_ungroup ; NULL != i ; i = i->next) {
SPGroup *group = dynamic_cast<SPGroup *>(static_cast<SPObject *>(i->data));
if (group) {
- items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),group));
+ items_to_select.erase(remove(items_to_select.begin(), items_to_select.end(), group), items_to_select.end());
std::vector<SPItem*> children;
sp_item_group_ungroup(group, children, false);
items_to_select.insert(items_to_select.end(),children.rbegin(),children.rend());
diff --git a/src/selection.cpp b/src/selection.cpp
index 53772c381..7979b5d61 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -178,6 +178,7 @@ void Selection::_add(SPObject *obj) {
// (to prevent double-selection)
_removeObjectDescendants(obj);
_removeObjectAncestors(obj);
+ g_return_if_fail(SP_IS_OBJECT(obj));
_objs.push_front(obj);
_objs_set.insert(obj);
@@ -481,17 +482,21 @@ std::vector<Inkscape::SnapCandidatePoint> Selection::getSnapPoints(SnapPreferenc
}
void Selection::_removeObjectDescendants(SPObject *obj) {
+ std::vector<SPObject*> toremove;
for ( std::list<SPObject*>::const_iterator iter=_objs.begin();iter!=_objs.end();iter++ ) {
- SPObject *sel_obj= *iter;
+ SPObject *sel_obj= dynamic_cast<SPObject*>(*iter);
SPObject *parent = sel_obj->parent;
while (parent) {
if ( parent == obj ) {
- _remove(sel_obj);
+ toremove.push_back(sel_obj);
break;
}
parent = parent->parent;
}
}
+ for ( std::vector<SPObject*>::const_iterator iter=toremove.begin();iter!=toremove.end();iter++ ) {
+ _remove(*iter);
+ }
}
void Selection::_removeObjectAncestors(SPObject *obj) {
diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp
index 3c6167438..d66508eae 100644
--- a/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
@@ -296,7 +296,7 @@ sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view)
}
// Create a mask element (using passed elements), add it to <defs>
-const gchar *SPClipPath::create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform)
+const gchar *SPClipPath::create (std::vector<Inkscape::XML::Node*> &reprs, SPDocument *document, Geom::Affine const* applyTransform)
{
Inkscape::XML::Node *defsrepr = document->getDefs()->getRepr();
@@ -308,13 +308,12 @@ const gchar *SPClipPath::create (GSList *reprs, SPDocument *document, Geom::Affi
const gchar *id = repr->attribute("id");
SPObject *clip_path_object = document->getObjectById(id);
- for (GSList *it = reprs; it != NULL; it = it->next) {
- Inkscape::XML::Node *node = (Inkscape::XML::Node *)(it->data);
+ for (std::vector<Inkscape::XML::Node*>::const_iterator it = reprs.begin(); it != reprs.end(); it++) {
+ Inkscape::XML::Node *node = (*it);
SPItem *item = SP_ITEM(clip_path_object->appendChildRepr(node));
if (NULL != applyTransform) {
- Geom::Affine transform (item->transform);
- transform *= (*applyTransform);
+ Geom::Affine transform (item->transform * (*applyTransform));
item->doWriteTransform(item->getRepr(), transform);
}
}
diff --git a/src/sp-clippath.h b/src/sp-clippath.h
index eb8b14174..91dcfd625 100644
--- a/src/sp-clippath.h
+++ b/src/sp-clippath.h
@@ -45,7 +45,7 @@ public:
unsigned int clipPathUnits : 1;
SPClipPathView *display;
- static char const *create(GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform);
+ static char const *create(std::vector<Inkscape::XML::Node*> &reprs, SPDocument *document, Geom::Affine const* applyTransform);
//static GType sp_clippath_get_type(void);
Inkscape::DrawingItem *show(Inkscape::Drawing &drawing, unsigned int key);
diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp
index 2bf1b11a6..1bde69dd1 100644
--- a/src/sp-filter.cpp
+++ b/src/sp-filter.cpp
@@ -79,6 +79,7 @@ void SPFilter::build(SPDocument *document, Inkscape::XML::Node *repr) {
this->readAttr( "height" );
this->readAttr( "filterRes" );
this->readAttr( "xlink:href" );
+ this->_refcount = 0;
SPObject::build(document, repr);
@@ -190,6 +191,15 @@ void SPFilter::set(unsigned int key, gchar const *value) {
}
}
+
+/**
+ * Returns the number of references to the filter.
+ */
+guint SPFilter::getRefCount() {
+ // NOTE: this is currently updated by sp_style_filter_ref_changed() in style.cpp
+ return _refcount;
+}
+
/**
* Receives update notifications.
*/
diff --git a/src/sp-filter.h b/src/sp-filter.h
index e6318c569..1c214c6b7 100644
--- a/src/sp-filter.h
+++ b/src/sp-filter.h
@@ -54,6 +54,9 @@ public:
NumberOptNumber filterRes;
SPFilterReference *href;
sigc::connection modified_connection;
+
+ guint getRefCount();
+ guint _refcount;
Inkscape::Filters::Filter *_renderer;
diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp
index 767f0ed91..f1c69cdf6 100644
--- a/src/sp-item-transform.cpp
+++ b/src/sp-item-transform.cpp
@@ -152,7 +152,7 @@ Geom::Affine get_scale_transform_for_uniform_stroke(Geom::Rect const &bbox_visua
gdouble scale_x = 1;
gdouble scale_y = 1;
- gdouble r1 = r0;
+ gdouble r1;
if ((fabs(w0 - stroke_x) < 1e-6) || w1 == 0) { // We have a vertical line at hand
scale_y = h1/h0;
@@ -310,8 +310,8 @@ Geom::Affine get_scale_transform_for_variable_stroke(Geom::Rect const &bbox_visu
gdouble scale_x = 1;
gdouble scale_y = 1;
- gdouble r1h = r0h;
- gdouble r1w = r0w;
+ gdouble r1h;
+ gdouble r1w;
if ((fabs(w0 - r0w) < 1e-6) || w1 == 0) { // We have a vertical line at hand
scale_y = h1/h0;
diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp
index d60473e1d..f8fb7aff4 100644
--- a/src/sp-mask.cpp
+++ b/src/sp-mask.cpp
@@ -209,7 +209,7 @@ Inkscape::XML::Node* SPMask::write(Inkscape::XML::Document* xml_doc, Inkscape::X
// Create a mask element (using passed elements), add it to <defs>
const gchar *
-sp_mask_create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform)
+sp_mask_create (std::vector<Inkscape::XML::Node*> &reprs, SPDocument *document, Geom::Affine const* applyTransform)
{
Inkscape::XML::Node *defsrepr = document->getDefs()->getRepr();
@@ -221,13 +221,12 @@ sp_mask_create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTr
const gchar *mask_id = repr->attribute("id");
SPObject *mask_object = document->getObjectById(mask_id);
- for (GSList *it = reprs; it != NULL; it = it->next) {
- Inkscape::XML::Node *node = (Inkscape::XML::Node *)(it->data);
+ for (std::vector<Inkscape::XML::Node*>::const_iterator it = reprs.begin(); it != reprs.end(); it++) {
+ Inkscape::XML::Node *node = (*it);
SPItem *item = SP_ITEM(mask_object->appendChildRepr(node));
if (NULL != applyTransform) {
- Geom::Affine transform (item->transform);
- transform *= (*applyTransform);
+ Geom::Affine transform (item->transform * (*applyTransform));
item->doWriteTransform(item->getRepr(), transform);
}
}
diff --git a/src/sp-mask.h b/src/sp-mask.h
index e991fedb6..3559483bb 100644
--- a/src/sp-mask.h
+++ b/src/sp-mask.h
@@ -108,6 +108,6 @@ protected:
}
};
-const char *sp_mask_create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform);
+const char *sp_mask_create (std::vector<Inkscape::XML::Node*> &reprs, SPDocument *document, Geom::Affine const* applyTransform);
#endif // SEEN_SP_MASK_H
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index 239f487a4..c8a0830c1 100644
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
@@ -22,6 +22,8 @@
#include "display/drawing-group.h"
#include "attributes.h"
#include "document.h"
+#include "sp-clippath.h"
+#include "sp-mask.h"
#include "sp-factory.h"
#include "sp-flowregion.h"
#include "uri.h"
@@ -426,16 +428,43 @@ void SPUse::move_compensate(Geom::Affine const *mp) {
return;
Geom::Affine m(*mp);
+ Geom::Affine t = this->get_parent_transform();
+ Geom::Affine clone_move = t.inverse() * m * t;
// this is not a simple move, do not try to compensate
- if (!(m.isTranslation()))
+ if (!(m.isTranslation())){
+ //BUT move clippaths accordingly.
+ //if clone has a clippath, move it accordingly
+ if(clip_ref->getObject()){
+ SPObject *clip = clip_ref->getObject()->firstChild() ;
+ while(clip){
+ SPItem *item = (SPItem*) clip;
+ if(item){
+ item->transform *= m;
+ Geom::Affine identity;
+ item->doWriteTransform(clip->getRepr(),item->transform, &identity);
+ }
+ clip = clip->getNext();
+ }
+ }
+ if(mask_ref->getObject()){
+ SPObject *mask = mask_ref->getObject()->firstChild() ;
+ while(mask){
+ SPItem *item = (SPItem*) mask;
+ if(item){
+ item->transform *= m;
+ Geom::Affine identity;
+ item->doWriteTransform(mask->getRepr(),item->transform, &identity);
+ }
+ mask = mask->getNext();
+ }
+ }
return;
+ }
// restore item->transform field from the repr, in case it was changed by seltrans
this->readAttr ("transform");
- Geom::Affine t = this->get_parent_transform();
- Geom::Affine clone_move = t.inverse() * m * t;
// calculate the compensation matrix and the advertized movement matrix
Geom::Affine advertized_move;
@@ -449,6 +478,33 @@ void SPUse::move_compensate(Geom::Affine const *mp) {
g_assert_not_reached();
}
+ //if clone has a clippath, move it accordingly
+ if(clip_ref->getObject()){
+ SPObject *clip = clip_ref->getObject()->firstChild() ;
+ while(clip){
+ SPItem *item = (SPItem*) clip;
+ if(item){
+ item->transform *= clone_move.inverse();
+ Geom::Affine identity;
+ item->doWriteTransform(clip->getRepr(),item->transform, &identity);
+ }
+ clip = clip->getNext();
+ }
+ }
+ if(mask_ref->getObject()){
+ SPObject *mask = mask_ref->getObject()->firstChild() ;
+ while(mask){
+ SPItem *item = (SPItem*) mask;
+ if(item){
+ item->transform *= clone_move.inverse();
+ Geom::Affine identity;
+ item->doWriteTransform(mask->getRepr(),item->transform, &identity);
+ }
+ mask = mask->getNext();
+ }
+ }
+
+
// commit the compensation
this->transform *= clone_move;
this->doWriteTransform(this->getRepr(), this->transform, &advertized_move);
diff --git a/src/style-enums.h b/src/style-enums.h
index f52752018..f235b6699 100644
--- a/src/style-enums.h
+++ b/src/style-enums.h
@@ -72,6 +72,72 @@ enum SPCSSFontStretch {
SP_CSS_FONT_STRETCH_WIDER
};
+// Can select more than one
+enum SPCSSFontVariantLigatures {
+ SP_CSS_FONT_VARIANT_LIGATURES_NORMAL,
+ SP_CSS_FONT_VARIANT_LIGATURES_NONE,
+ SP_CSS_FONT_VARIANT_LIGATURES_COMMON,
+ SP_CSS_FONT_VARIANT_LIGATURES_NO_COMMON,
+ SP_CSS_FONT_VARIANT_LIGATURES_DISCRETIONARY,
+ SP_CSS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY,
+ SP_CSS_FONT_VARIANT_LIGATURES_HISTORICAL,
+ SP_CSS_FONT_VARIANT_LIGATURES_NO_HISTORICAL,
+ SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL,
+ SP_CSS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL
+};
+
+enum SPCSSFontVariantPosition {
+ SP_CSS_FONT_VARIANT_POSITION_NORMAL,
+ SP_CSS_FONT_VARIANT_POSITION_SUB,
+ SP_CSS_FONT_VARIANT_POSITION_SUPER
+};
+
+enum SPCSSFontVariantCaps {
+ SP_CSS_FONT_VARIANT_CAPS_NORMAL,
+ SP_CSS_FONT_VARIANT_CAPS_SMALL,
+ SP_CSS_FONT_VARIANT_CAPS_ALL_SMALL,
+ SP_CSS_FONT_VARIANT_CAPS_PETITE,
+ SP_CSS_FONT_VARIANT_CAPS_ALL_PETITE,
+ SP_CSS_FONT_VARIANT_CAPS_UNICASE,
+ SP_CSS_FONT_VARIANT_CAPS_TITLING,
+};
+
+enum SPCSSFontVariantNumeric {
+ SP_CSS_FONT_VARIANT_NUMERIC_NORMAL,
+ SP_CSS_FONT_VARIANT_NUMERIC_LINING_NUMS,
+ SP_CSS_FONT_VARIANT_NUMERIC_OLDSTYLE_NUMS,
+ SP_CSS_FONT_VARIANT_NUMERIC_PROPORTIONAL_NUMS,
+ SP_CSS_FONT_VARIANT_NUMERIC_TABULAR_NUMS,
+ SP_CSS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS,
+ SP_CSS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS,
+ SP_CSS_FONT_VARIANT_NUMERIC_ORDINAL,
+ SP_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO
+};
+
+enum SPCSSFontVariantAlternates {
+ SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL,
+ SP_CSS_FONT_VARIANT_ALTERNATES_HISTORICAL_FORMS,
+ SP_CSS_FONT_VARIANT_ALTERNATES_STYLISTIC,
+ SP_CSS_FONT_VARIANT_ALTERNATES_STYLESET,
+ SP_CSS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT,
+ SP_CSS_FONT_VARIANT_ALTERNATES_SWASH,
+ SP_CSS_FONT_VARIANT_ALTERNATES_ORNAMENTS,
+ SP_CSS_FONT_VARIANT_ALTERNATES_ANNOTATION
+};
+
+enum SPCSSFontVariantEastAsian {
+ SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL,
+ SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS78,
+ SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS83,
+ SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS90,
+ SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS04,
+ SP_CSS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED,
+ SP_CSS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL,
+ SP_CSS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH,
+ SP_CSS_FONT_VARIANT_EAST_ASIAN_PROPORTIONAL_WIDTH,
+ SP_CSS_FONT_VARIANT_EAST_ASIAN_RUBY
+};
+
enum SPCSSTextAlign {
SP_CSS_TEXT_ALIGN_START,
SP_CSS_TEXT_ALIGN_END,
@@ -309,6 +375,77 @@ static SPStyleEnum const enum_font_stretch[] = {
{NULL, -1}
};
+static SPStyleEnum const enum_font_variant_ligatures[] = {
+ {"normal", SP_CSS_FONT_VARIANT_LIGATURES_NORMAL},
+ {"none", SP_CSS_FONT_VARIANT_LIGATURES_NONE},
+ {"common-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_COMMON},
+ {"no-common-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_COMMON},
+ {"discretionary-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_DISCRETIONARY},
+ {"no-discretionary-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY},
+ {"historical-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_HISTORICAL},
+ {"nohistorical-ligatures", SP_CSS_FONT_VARIANT_LIGATURES_NO_HISTORICAL},
+ {"contextual", SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL},
+ {"no-contextual", SP_CSS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL},
+ {NULL, -1}
+};
+
+static SPStyleEnum const enum_font_variant_position[] = {
+ {"normal", SP_CSS_FONT_VARIANT_POSITION_NORMAL},
+ {"sub", SP_CSS_FONT_VARIANT_POSITION_SUB},
+ {"super", SP_CSS_FONT_VARIANT_POSITION_SUPER},
+ {NULL, -1}
+};
+
+static SPStyleEnum const enum_font_variant_caps[] = {
+ {"normal", SP_CSS_FONT_VARIANT_CAPS_NORMAL},
+ {"small-caps", SP_CSS_FONT_VARIANT_CAPS_SMALL},
+ {"all-small-caps", SP_CSS_FONT_VARIANT_CAPS_ALL_SMALL},
+ {"petite-caps", SP_CSS_FONT_VARIANT_CAPS_PETITE},
+ {"all_petite-caps", SP_CSS_FONT_VARIANT_CAPS_ALL_PETITE},
+ {"unicase", SP_CSS_FONT_VARIANT_CAPS_UNICASE},
+ {"titling", SP_CSS_FONT_VARIANT_CAPS_TITLING},
+ {NULL, -1}
+};
+
+static SPStyleEnum const enum_font_variant_numeric[] = {
+ {"normal", SP_CSS_FONT_VARIANT_NUMERIC_NORMAL},
+ {"lining-nums", SP_CSS_FONT_VARIANT_NUMERIC_LINING_NUMS},
+ {"oldstyle-nums", SP_CSS_FONT_VARIANT_NUMERIC_OLDSTYLE_NUMS},
+ {"proportional-nums", SP_CSS_FONT_VARIANT_NUMERIC_PROPORTIONAL_NUMS},
+ {"tabular-nums", SP_CSS_FONT_VARIANT_NUMERIC_TABULAR_NUMS},
+ {"diagonal-fractions", SP_CSS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS},
+ {"stacked-fractions", SP_CSS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS},
+ {"ordinal", SP_CSS_FONT_VARIANT_NUMERIC_ORDINAL},
+ {"slashed-zero", SP_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO},
+ {NULL, -1}
+};
+
+static SPStyleEnum const enum_font_variant_alternates[] = {
+ {"normal", SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL},
+ {"historical-forms", SP_CSS_FONT_VARIANT_ALTERNATES_HISTORICAL_FORMS},
+ {"stylistic", SP_CSS_FONT_VARIANT_ALTERNATES_STYLISTIC},
+ {"styleset", SP_CSS_FONT_VARIANT_ALTERNATES_STYLESET},
+ {"character_variant", SP_CSS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT},
+ {"swash", SP_CSS_FONT_VARIANT_ALTERNATES_SWASH},
+ {"ornaments", SP_CSS_FONT_VARIANT_ALTERNATES_ORNAMENTS},
+ {"annotation", SP_CSS_FONT_VARIANT_ALTERNATES_ANNOTATION},
+ {NULL, -1}
+};
+
+static SPStyleEnum const enum_font_variant_east_asian[] = {
+ {"normal", SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL},
+ {"jis78", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS78},
+ {"jis83", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS83},
+ {"jis90", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS90},
+ {"jis04", SP_CSS_FONT_VARIANT_EAST_ASIAN_JIS04},
+ {"simplified", SP_CSS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED},
+ {"traditional", SP_CSS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL},
+ {"full-width", SP_CSS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH},
+ {"proportional-width", SP_CSS_FONT_VARIANT_EAST_ASIAN_PROPORTIONAL_WIDTH},
+ {"ruby", SP_CSS_FONT_VARIANT_EAST_ASIAN_RUBY},
+ {NULL, -1}
+};
+
static SPStyleEnum const enum_text_align[] = {
{"start", SP_CSS_TEXT_ALIGN_START},
{"end", SP_CSS_TEXT_ALIGN_END},
diff --git a/src/style.cpp b/src/style.cpp
index b65bff53f..49a13604b 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -14,7 +14,7 @@
* Copyright (C) 2001 Ximian, Inc.
* Copyright (C) 2005 Monash University
* Copyright (C) 2012 Kris De Gussem
- * Copyright (C) 2014 Tavmjong Bah
+ * Copyright (C) 2014-2015 Tavmjong Bah
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -118,6 +118,15 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) :
font(), // SPIFont
font_specification( "-inkscape-font-specification" ), // SPIString
+ // Font variants
+ font_variant_ligatures( "font-variant-ligatures", enum_font_variant_ligatures, SP_CSS_FONT_VARIANT_LIGATURES_NORMAL ),
+ font_variant_position( "font-variant-position", enum_font_variant_position, SP_CSS_FONT_VARIANT_POSITION_NORMAL ),
+ font_variant_caps( "font-variant-caps", enum_font_variant_caps, SP_CSS_FONT_VARIANT_CAPS_NORMAL ),
+ font_variant_numeric( "font-variant-numeric", enum_font_variant_numeric, SP_CSS_FONT_VARIANT_NUMERIC_NORMAL ),
+ font_variant_alternates("font-variant-alternates", enum_font_variant_alternates, SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL ),
+ 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" ),
+
// Text related properties
text_indent( "text-indent", 0.0 ), // SPILength
text_align( "text-align", enum_text_align, SP_CSS_TEXT_ALIGN_START ),
@@ -288,6 +297,15 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) :
_properties.push_back( &font );
_properties.push_back( &font_specification );
+ // Font variants
+ _properties.push_back( &font_variant_ligatures );
+ _properties.push_back( &font_variant_position );
+ _properties.push_back( &font_variant_caps );
+ _properties.push_back( &font_variant_numeric );
+ _properties.push_back( &font_variant_alternates );
+ _properties.push_back( &font_variant_east_asian );
+ _properties.push_back( &font_feature_settings );
+
_properties.push_back( &text_indent );
_properties.push_back( &text_align );
@@ -374,6 +392,14 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) :
// _propmap.insert( std::make_pair( font.name, reinterpret_cast<SPIBasePtr>(&SPStyle::font ) ) );
// _propmap.insert( std::make_pair( font_specification.name, reinterpret_cast<SPIBasePtr>(&SPStyle::font_specification ) ) );
+ // font_variant_ligatures );
+ // font_variant_position );
+ // font_variant_caps );
+ // font_variant_numeric );
+ // font_variant_alternates );
+ // font_variant_east_asian );
+ // font_feature_settings );
+
// _propmap.insert( std::make_pair( text_indent.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_indent ) ) );
// _propmap.insert( std::make_pair( text_align.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_align ) ) );
@@ -573,7 +599,15 @@ SPStyle::read( SPObject *object, Inkscape::XML::Node *repr ) {
/* 3 Presentation attributes */
// std::cout << " MERGING PRESENTATION ATTRIBUTES" << std::endl;
for(std::vector<SPIBase*>::size_type i = 0; i != _properties.size(); ++i) {
- _properties[i]->readAttribute( repr );
+
+ // Shorthands are not allowed as presentation properites. Note: text-decoration and
+ // font-variant are converted to shorthands in CSS 3 but can still be read as a
+ // non-shorthand for compatability with older renders, so they should not be in this list.
+ // We could add a flag to SPIBase to avoid string comparison.
+ if( _properties[i]->name.compare( "font" ) != 0 &&
+ _properties[i]->name.compare( "marker" ) != 0 ) {
+ _properties[i]->readAttribute( repr );
+ }
}
// for(SPPropMap::iterator i = _propmap.begin(); i != _propmap.end(); ++i ) {
// (this->*(i->second)).readAttribute( repr );
@@ -686,6 +720,29 @@ SPStyle::readIfUnset( gint id, gchar const *val ) {
font.readIfUnset( val );
break;
+ /* Font Variants CSS 3 */
+ case SP_PROP_FONT_VARIANT_LIGATURES:
+ font_variant_ligatures.readIfUnset( val );
+ break;
+ case SP_PROP_FONT_VARIANT_POSITION:
+ font_variant_position.readIfUnset( val );
+ break;
+ case SP_PROP_FONT_VARIANT_CAPS:
+ font_variant_caps.readIfUnset( val );
+ break;
+ case SP_PROP_FONT_VARIANT_NUMERIC:
+ font_variant_numeric.readIfUnset( val );
+ break;
+ case SP_PROP_FONT_VARIANT_ALTERNATES:
+ font_variant_alternates.readIfUnset( val );
+ break;
+ case SP_PROP_FONT_VARIANT_EAST_ASIAN:
+ font_variant_east_asian.readIfUnset( val );
+ break;
+ case SP_PROP_FONT_FEATURE_SETTINGS:
+ font_feature_settings.readIfUnset( val );
+ break;
+
/* Text */
case SP_PROP_TEXT_INDENT:
text_indent.readIfUnset( val );
@@ -1169,10 +1226,12 @@ void
sp_style_filter_ref_changed(SPObject *old_ref, SPObject *ref, SPStyle *style)
{
if (old_ref) {
+ (dynamic_cast<SPFilter *>( old_ref ))->_refcount--;
style->filter_modified_connection.disconnect();
}
if ( SP_IS_FILTER(ref))
{
+ (dynamic_cast<SPFilter *>( ref ))->_refcount++;
style->filter_modified_connection =
ref->connectModified(sigc::bind(sigc::ptr_fun(&sp_style_filter_ref_modified), style));
}
diff --git a/src/style.h b/src/style.h
index ab34476b3..2618662f5 100644
--- a/src/style.h
+++ b/src/style.h
@@ -94,7 +94,7 @@ public:
/** Font style */
SPIEnum font_style;
- /** Which substyle of the font */
+ /** Which substyle of the font (CSS 2. CSS 3 redefines as shorthand) */
SPIEnum font_variant;
/** Weight of the font */
SPIEnum font_weight;
@@ -111,6 +111,22 @@ public:
/** Full font name, as font_factory::ConstructFontSpecification would give, for internal use. */
SPIString font_specification;
+ /* Font variants -------------------- */
+ /** Font variant ligatures */
+ SPIEnum font_variant_ligatures;
+ /** Font variant position (subscript/superscript) */
+ SPIEnum font_variant_position;
+ /** Font variant caps (small caps) */
+ SPIEnum font_variant_caps;
+ /** Font variant numeric (numerical formatting) */
+ SPIEnum font_variant_numeric;
+ /** Font variant alternates (alternates/swatches) */
+ SPIEnum font_variant_alternates;
+ /** Font variant East Asian */
+ SPIEnum font_variant_east_asian;
+ /** Font feature settings (Low level access to TrueType tables) */
+ SPIString font_feature_settings;
+
/* Text ----------------------------- */
/** First line indent of paragraphs (css2 16.1) */
diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp
index 065e891ed..9df4e561c 100644
--- a/src/trace/siox.cpp
+++ b/src/trace/siox.cpp
@@ -682,7 +682,7 @@ GdkPixbuf *SioxImage::getGdkPixbuf()
}
row += rowstride;
}
-
+ free(pixdata);
return buf;
}
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index c381ed755..b04e8ecc1 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -1672,10 +1672,10 @@ void DocumentProperties::onDocUnitChange()
Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr();
- Inkscape::Util::Unit const *old_doc_unit = unit_table.getUnit("px");
+ /*Inkscape::Util::Unit const *old_doc_unit = unit_table.getUnit("px");
if(repr->attribute("inkscape:document-units")) {
old_doc_unit = unit_table.getUnit(repr->attribute("inkscape:document-units"));
- }
+ }*/
Inkscape::Util::Unit const *doc_unit = _rum_deflt.getUnit();
// Set document unit
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index f81519ed1..1ff9e4a1b 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -8,6 +8,7 @@
* Felipe C. da S. Sanches <juca@members.fsf.org>
* Jon A. Cruz <jon@joncruz.org>
* Abhishek Sharma
+ * insaner
*
* Copyright (C) 2007 Authors
*
@@ -1360,8 +1361,15 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d)
((Gtk::CellRendererText*)_list.get_column(1)->get_first_cell())->
signal_edited().connect(sigc::mem_fun(*this, &FilterEffectsDialog::FilterModifier::on_name_edited));
+ _list.append_column("#", _columns.count);
+ _list.get_column(2)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
+ _list.get_column(2)->set_expand(false);
+
sw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
_list.get_column(1)->set_resizable(true);
+ _list.get_column(1)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
+ _list.get_column(1)->set_expand(true);
+
_list.set_reorderable(true);
_list.enable_model_drag_dest (Gdk::ACTION_MOVE);
@@ -1494,6 +1502,7 @@ void FilterEffectsDialog::FilterModifier::update_selection(Selection *sel)
(*iter)[_columns.sel] = 0;
}
}
+ update_counts();
}
void FilterEffectsDialog::FilterModifier::on_filter_selection_changed()
@@ -1565,6 +1574,15 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri
}
}
+
+void FilterEffectsDialog::FilterModifier::update_counts()
+{
+ for(Gtk::TreeModel::iterator i = _model->children().begin(); i != _model->children().end(); ++i) {
+ SPFilter* f = SP_FILTER((*i)[_columns.filter]);
+ (*i)[_columns.count] = f->getRefCount();
+ }
+}
+
/* Add all filters in the document to the combobox.
Keeps the same selection if possible, otherwise selects the first element */
void FilterEffectsDialog::FilterModifier::update_filters()
@@ -2419,7 +2437,7 @@ bool FilterEffectsDialog::PrimitiveList::on_motion_notify_event(GdkEventMotion*
get_visible_rect(vis);
int vis_x, vis_y;
- int vis_x2, vis_y2; // NOTE: insaner added -- necessary to get the scrolling while dragging to work
+ int vis_x2, vis_y2;
convert_widget_to_tree_coords(vis.get_x(), vis.get_y(), vis_x2, vis_y2);
convert_tree_to_widget_coords(vis.get_x(), vis.get_y(), vis_x, vis_y);
@@ -2439,7 +2457,6 @@ bool FilterEffectsDialog::PrimitiveList::on_motion_notify_event(GdkEventMotion*
else
_autoscroll_y = 0;
- // NOTE: insaner added -- necessary to get the scrolling while dragging to work
double e2 = ( e->x - vis_x2/2);
// horizontal scrolling
if(e2 < vis_x)
@@ -2752,20 +2769,22 @@ FilterEffectsDialog::FilterEffectsDialog()
Gtk::ScrolledWindow* sw_infobox = Gtk::manage(new Gtk::ScrolledWindow);
Gtk::HBox* infobox = Gtk::manage(new Gtk::HBox(/*homogeneous:*/false, /*spacing:*/4));
Gtk::HBox* hb_prims = Gtk::manage(new Gtk::HBox);
+ Gtk::VBox* vb_prims = Gtk::manage(new Gtk::VBox);
_getContents()->add(*hpaned);
hpaned->pack1(_filter_modifier);
hpaned->pack2(_primitive_box);
_primitive_box.pack_start(*sw_prims);
- _primitive_box.pack_start(*hb_prims, false, false);
_primitive_box.pack_start(*sw_infobox, false, false);
sw_prims->add(_primitive_list);
- sw_infobox->add(*infobox);
+ sw_infobox->add(*vb_prims);
infobox->pack_start(_infobox_icon, false, false);
infobox->pack_start(_infobox_desc, false, false);
_infobox_desc.set_line_wrap(true);
- _infobox_desc.set_size_request(200, -1);
+ _infobox_desc.set_size_request(250, -1);
+ vb_prims->pack_start(*hb_prims);
+ vb_prims->pack_start(*infobox);
hb_prims->pack_start(_add_primitive, false, false);
hb_prims->pack_start(_add_primitive_type, false, false);
@@ -2781,7 +2800,7 @@ FilterEffectsDialog::FilterEffectsDialog()
_add_primitive_type.signal_changed().connect(
sigc::mem_fun(*this, &FilterEffectsDialog::update_primitive_infobox));
- sw_prims->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); /* NOTE: insaner -- SCROLL the connections panel thing!!! */
+ sw_prims->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
sw_prims->set_shadow_type(Gtk::SHADOW_IN);
sw_infobox->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER);
diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h
index 3fc19e7de..a067cd70c 100644
--- a/src/ui/dialog/filter-effects-dialog.h
+++ b/src/ui/dialog/filter-effects-dialog.h
@@ -4,6 +4,7 @@
/* Authors:
* Nicholas Bishop <nicholasbishop@gmail.com>
* Rodrigo Kumpera <kumpera@gmail.com>
+ * insaner
*
* Copyright (C) 2007 Authors
*
@@ -69,11 +70,13 @@ private:
add(filter);
add(label);
add(sel);
+ add(count);
}
Gtk::TreeModelColumn<SPFilter*> filter;
Gtk::TreeModelColumn<Glib::ustring> label;
Gtk::TreeModelColumn<int> sel;
+ Gtk::TreeModelColumn<int> count;
};
void setTargetDesktop(SPDesktop *desktop);
@@ -89,6 +92,7 @@ private:
bool on_filter_move(const Glib::RefPtr<Gdk::DragContext>& /*context*/, int x, int y, guint /*time*/);
void on_selection_toggled(const Glib::ustring&);
+ void update_counts();
void update_filters();
void filter_list_button_release(GdkEventButton*);
void add_filter();
diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp
index 740acd989..55ef0c5bb 100644
--- a/src/ui/dialog/floating-behavior.cpp
+++ b/src/ui/dialog/floating-behavior.cpp
@@ -112,7 +112,7 @@ bool FloatingBehavior::_trans_timer (void) {
}
float goal, current;
- goal = current = _d->get_opacity();
+ current = _d->get_opacity();
if (_dialog_active.get_value()) {
goal = _trans_focus;
diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp
index 4465d73a9..c44f66a4d 100644
--- a/src/ui/dialog/grid-arrange-tab.cpp
+++ b/src/ui/dialog/grid-arrange-tab.cpp
@@ -170,7 +170,6 @@ void GridArrangeTab::arrange()
Inkscape::Selection *selection = desktop->getSelection();
const std::vector<SPItem*> items = selection ? selection->itemList() : std::vector<SPItem*>();
- cnt=0;
for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end();i++){
SPItem *item = *i;
Geom::OptRect b = item->documentVisualBounds();
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index 7dc55c95c..77f120e1a 100644
--- a/src/ui/dialog/icon-preview.cpp
+++ b/src/ui/dialog/icon-preview.cpp
@@ -312,7 +312,7 @@ void IconPreviewPanel::setDesktop( SPDesktop* desktop )
if ( this->desktop ) {
docReplacedConn = this->desktop->connectDocumentReplaced(sigc::hide<0>(sigc::mem_fun(this, &IconPreviewPanel::setDocument)));
if ( this->desktop->selection && Inkscape::Preferences::get()->getBool("/iconpreview/autoRefresh", true) ) {
- selChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(this, &IconPreviewPanel::queueRefresh)));
+ selChangedConn = this->desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(this, &IconPreviewPanel::queueRefresh)));
}
}
}
diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp
index dfe211e94..fc21a30d4 100644
--- a/src/ui/dialog/object-properties.cpp
+++ b/src/ui/dialog/object-properties.cpp
@@ -467,14 +467,14 @@ void ObjectProperties::_labelChanged()
gchar *id = g_strdup(_entry_id.get_text().c_str());
g_strcanon(id, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.:", '_');
if (strcmp(id, item->getId()) == 0) {
- _label_id.set_markup_with_mnemonic(_("_ID:"));
+ _label_id.set_markup_with_mnemonic(_("_ID:") + Glib::ustring(" "));
} else if (!*id || !isalnum (*id)) {
_label_id.set_text(_("Id invalid! "));
} else if (SP_ACTIVE_DOCUMENT->getObjectById(id) != NULL) {
_label_id.set_text(_("Id exists! "));
} else {
SPException ex;
- _label_id.set_markup_with_mnemonic(_("_ID:"));
+ _label_id.set_markup_with_mnemonic(_("_ID:") + Glib::ustring(" "));
SP_EXCEPTION_INIT(&ex);
item->setAttribute("id", id, &ex);
DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, _("Set object ID"));
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 760d19e89..a129d4b92 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -439,7 +439,7 @@ sp_ui_dialog_title_string(Inkscape::Verb *verb, gchar *c)
gchar* key = sp_shortcut_get_label(shortcut);
s = g_stpcpy(s, " (");
s = g_stpcpy(s, key);
- s = g_stpcpy(s, ")");
+ g_stpcpy(s, ")");
g_free(key);
}
}
diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp
index 538e0c7e2..27e755add 100644
--- a/src/ui/tools/box3d-tool.cpp
+++ b/src/ui/tools/box3d-tool.cpp
@@ -165,7 +165,7 @@ bool Box3dTool::item_handler(SPItem* item, GdkEvent* event) {
case GDK_BUTTON_PRESS:
if ( event->button.button == 1 && !this->space_panning) {
Inkscape::setup_for_drag_start(desktop, this, event);
- ret = TRUE;
+ //ret = TRUE;
}
break;
// motion and release are always on root (why?)
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index 01b75fdb4..10f8c8694 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -674,7 +674,7 @@ void EraserTool::set_to_accumulated() {
Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop);
toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints());
}
- toWorkOn.erase(find(toWorkOn.begin(),toWorkOn.end(),acid));
+ toWorkOn.erase(std::remove(toWorkOn.begin(), toWorkOn.end(), acid), toWorkOn.end());
} else {
toWorkOn= selection->itemList();
wasSelection = true;
diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp
index ffd41d97d..748c82717 100644
--- a/src/ui/tools/flood-tool.cpp
+++ b/src/ui/tools/flood-tool.cpp
@@ -932,7 +932,7 @@ static void sp_flood_do_flood_fill(ToolBase *event_context, GdkEvent *event, boo
std::deque<Geom::Point>::iterator start_sort = fill_queue.begin();
std::deque<Geom::Point>::iterator end_sort = fill_queue.begin();
unsigned int sort_y = (unsigned int)cp[Geom::Y];
- unsigned int current_y = sort_y;
+ unsigned int current_y;
for (std::deque<Geom::Point>::iterator i = fill_queue.begin(); i != fill_queue.end(); ++i) {
Geom::Point current = *i;
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index daffc7032..be6156fa2 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -762,14 +762,12 @@ bool PenTool::_handleButtonRelease(GdkEventButton const &revent) {
}
}
this->state = PenTool::CONTROL;
- ret = true;
break;
case PenTool::CONTROL:
// End current segment
this->_endpointSnap(p, revent.state);
this->_finishSegment(p, revent.state);
this->state = PenTool::POINT;
- ret = true;
break;
case PenTool::CLOSE:
// End current segment
@@ -783,12 +781,10 @@ bool PenTool::_handleButtonRelease(GdkEventButton const &revent) {
}
this->_finish(true);
this->state = PenTool::POINT;
- ret = true;
break;
case PenTool::STOP:
// This is allowed, if we just canceled curve
this->state = PenTool::POINT;
- ret = true;
break;
default:
break;
@@ -823,7 +819,6 @@ bool PenTool::_handleButtonRelease(GdkEventButton const &revent) {
break;
}
this->state = PenTool::POINT;
- ret = true;
break;
default:
break;
@@ -1432,8 +1427,7 @@ void PenTool::_bsplineSpiroStartAnchorOn()
{
using Geom::X;
using Geom::Y;
- SPCurve *tmp_curve = new SPCurve();
- tmp_curve = this->sa->curve->copy();
+ SPCurve *tmp_curve = this->sa->curve->copy();
if(this->sa->start)
tmp_curve = tmp_curve ->create_reverse();
Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const*>(&*tmp_curve ->last_segment());
@@ -1465,8 +1459,7 @@ void PenTool::_bsplineSpiroStartAnchorOn()
void PenTool::_bsplineSpiroStartAnchorOff()
{
- SPCurve *tmp_curve = new SPCurve();
- tmp_curve = this->sa->curve->copy();
+ SPCurve *tmp_curve = this->sa->curve->copy();
if(this->sa->start)
tmp_curve = tmp_curve ->create_reverse();
Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const*>(&*tmp_curve ->last_segment());
@@ -1564,7 +1557,7 @@ void PenTool::_bsplineSpiroEndAnchorOn()
using Geom::Y;
this->p[2] = this->p[3] + (1./3)*(this->p[0] - this->p[3]);
this->p[2] = Geom::Point(this->p[2][X] + HANDLE_CUBIC_GAP,this->p[2][Y] + HANDLE_CUBIC_GAP);
- SPCurve *tmp_curve = new SPCurve();
+ SPCurve *tmp_curve;
SPCurve *last_segment = new SPCurve();
Geom::Point point_c(0,0);
bool reverse = false;
@@ -1621,7 +1614,7 @@ void PenTool::_bsplineSpiroEndAnchorOn()
void PenTool::_bsplineSpiroEndAnchorOff()
{
- SPCurve *tmp_curve = new SPCurve();
+ SPCurve *tmp_curve;
SPCurve *last_segment = new SPCurve();
bool reverse = false;
this->p[2] = this->p[3];
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index 008804162..ba103fa8e 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -357,7 +357,6 @@ bool PencilTool::_handleButtonRelease(GdkEventButton const &revent) {
// Ctrl+click creates a single point so only set context in ADDLINE mode when Ctrl isn't pressed
this->state = SP_PENCIL_CONTEXT_ADDLINE;
}
- ret = true;
break;
case SP_PENCIL_CONTEXT_ADDLINE:
/* Finish segment now */
@@ -371,7 +370,6 @@ bool PencilTool::_handleButtonRelease(GdkEventButton const &revent) {
this->_finishEndpoint();
this->state = SP_PENCIL_CONTEXT_IDLE;
sp_event_context_discard_delayed_snap_event(this);
- ret = true;
break;
case SP_PENCIL_CONTEXT_FREEHAND:
if (revent.state & GDK_MOD1_MASK) {
@@ -413,7 +411,6 @@ bool PencilTool::_handleButtonRelease(GdkEventButton const &revent) {
// reset sketch mode too
this->sketch_n = 0;
}
- ret = true;
break;
case SP_PENCIL_CONTEXT_SKETCH:
default:
diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp
index 62a9006ea..844965c4d 100644
--- a/src/ui/tools/rect-tool.cpp
+++ b/src/ui/tools/rect-tool.cpp
@@ -143,7 +143,6 @@ bool RectTool::item_handler(SPItem* item, GdkEvent* event) {
case GDK_BUTTON_PRESS:
if ( event->button.button == 1 && !this->space_panning) {
Inkscape::setup_for_drag_start(desktop, this, event);
- ret = TRUE;
}
break;
// motion and release are always on root (why?)
diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp
index f8375a1bb..f06b03d91 100644
--- a/src/ui/tools/select-tool.cpp
+++ b/src/ui/tools/select-tool.cpp
@@ -777,7 +777,6 @@ bool SelectTool::root_handler(GdkEvent* event) {
}
rb_escaped = 0;
- ret = TRUE;
}
}
}
diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp
index 598a90e95..8acf083d0 100644
--- a/src/ui/widget/object-composite-settings.cpp
+++ b/src/ui/widget/object-composite-settings.cpp
@@ -125,8 +125,8 @@ ObjectCompositeSettings::_blendBlurValueChanged()
const Glib::ustring blendmode = _fe_cb.get_blend_mode();
//apply created filter to every selected item
- std::vector<SPItem*> sel=_subject->getDesktop()->getSelection()->itemList();
- for (std::vector<SPItem*>::const_iterator i = sel.begin() ; i != sel.end() ; ++i ) {
+ std::vector<SPObject*> sel=_subject->list();
+ for (std::vector<SPObject*>::const_iterator i = sel.begin() ; i != sel.end() ; ++i ) {
if (!SP_IS_ITEM(*i)) {
continue;
}
diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp
index 95b89bf5f..da3bbcd20 100644
--- a/src/ui/widget/style-subject.cpp
+++ b/src/ui/widget/style-subject.cpp
@@ -54,15 +54,13 @@ Inkscape::Selection *StyleSubject::Selection::_getSelection() const {
return NULL;
}
}
-/*
-StyleSubject::iterator StyleSubject::Selection::begin() {
+
+std::vector<SPObject*> StyleSubject::Selection::list(){
Inkscape::Selection *selection = _getSelection();
- if (selection) {
- return iterator(selection->list());
- } else {
- return iterator(NULL);
- }
-}*/
+ if(selection)
+ return selection->list();
+ else return std::vector<SPObject*>();
+}
Geom::OptRect StyleSubject::Selection::getBounds(SPItem::BBoxType type) {
Inkscape::Selection *selection = _getSelection();
@@ -133,10 +131,12 @@ SPObject *StyleSubject::CurrentLayer::_getLayerSList() const {
return _element;
}
-/*
-StyleSubject::iterator StyleSubject::CurrentLayer::begin() {
- return iterator(_getLayerSList());
-}*/
+
+std::vector<SPObject*> StyleSubject::CurrentLayer::list(){
+ std::vector<SPObject*> list;
+ list.push_back(_element);
+ return list;
+}
Geom::OptRect StyleSubject::CurrentLayer::getBounds(SPItem::BBoxType type) {
SPObject *layer = _getLayer();
diff --git a/src/ui/widget/style-subject.h b/src/ui/widget/style-subject.h
index 60f979eb0..15a072f44 100644
--- a/src/ui/widget/style-subject.h
+++ b/src/ui/widget/style-subject.h
@@ -10,7 +10,6 @@
#ifndef SEEN_INKSCAPE_UI_WIDGET_STYLE_SUBJECT_H
#define SEEN_INKSCAPE_UI_WIDGET_STYLE_SUBJECT_H
-#include "util/glib-list-iterators.h"
#include <boost/optional.hpp>
#include <2geom/rect.h>
#include "sp-item.h"
@@ -35,8 +34,6 @@ public:
class Selection;
class CurrentLayer;
- //typedef Util::GSListConstIterator<SPObject *> iterator;
- typedef std::list<SPObject*>::iterator iterator;
StyleSubject();
virtual ~StyleSubject();
@@ -44,11 +41,10 @@ public:
void setDesktop(SPDesktop *desktop);
SPDesktop *getDesktop() const { return _desktop; }
-// virtual iterator begin() = 0;
-// virtual iterator end() { return iterator(NULL); }
virtual Geom::OptRect getBounds(SPItem::BBoxType type) = 0;
virtual int queryStyle(SPStyle *query, int property) = 0;
virtual void setCSS(SPCSSAttr *css) = 0;
+ virtual std::vector<SPObject*> list(){return std::vector<SPObject*>();};
sigc::connection connectChanged(sigc::signal<void>::slot_type slot) {
return _changed_signal.connect(slot);
@@ -68,10 +64,10 @@ public:
Selection();
~Selection();
-// virtual iterator begin();
virtual Geom::OptRect getBounds(SPItem::BBoxType type);
virtual int queryStyle(SPStyle *query, int property);
virtual void setCSS(SPCSSAttr *css);
+ virtual std::vector<SPObject*> list();
protected:
virtual void _afterDesktopSwitch(SPDesktop *desktop);
@@ -89,10 +85,10 @@ public:
CurrentLayer();
~CurrentLayer();
-// virtual iterator begin();
virtual Geom::OptRect getBounds(SPItem::BBoxType type);
virtual int queryStyle(SPStyle *query, int property);
virtual void setCSS(SPCSSAttr *css);
+ virtual std::vector<SPObject*> list();
protected:
virtual void _afterDesktopSwitch(SPDesktop *desktop);
diff --git a/src/util/ziptool.cpp b/src/util/ziptool.cpp
index cf024008f..2eb516b2e 100644
--- a/src/util/ziptool.cpp
+++ b/src/util/ziptool.cpp
@@ -2605,7 +2605,7 @@ bool ZipFile::readFileData()
if (gpBitFlag & 0x8)//bit 3 was set. means we dont know compressed size
{
unsigned char c1, c2, c3, c4;
- c1 = c2 = c3 = c4 = 0;
+ c2 = c3 = c4 = 0;
while (true)
{
unsigned char ch;
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index fd3756220..e19f56e48 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -1433,8 +1433,10 @@ sp_desktop_widget_maximize(SPDesktopWidget *dtw)
if (!dtw->desktop->is_iconified() && !dtw->desktop->is_fullscreen())
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- gint w, h, x, y;
+ gint w = -1;
+ gint h, x, y;
dtw->getWindowGeometry(x, y, w, h);
+ g_assert(w != -1);
prefs->setInt("/desktop/geometry/width", w);
prefs->setInt("/desktop/geometry/height", h);
prefs->setInt("/desktop/geometry/x", x);
diff --git a/src/widgets/ege-adjustment-action.cpp b/src/widgets/ege-adjustment-action.cpp
index d89a6e3f1..a91149f4c 100644
--- a/src/widgets/ege-adjustment-action.cpp
+++ b/src/widgets/ege-adjustment-action.cpp
@@ -742,7 +742,7 @@ static GtkWidget* create_popup_number_menu( EgeAdjustmentAction* act )
if ( act->private_data->descriptions ) {
gdouble value = ((EgeAdjustmentDescr*)act->private_data->descriptions->data)->value;
- addOns = flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, value );
+ flush_explicit_items( addOns, G_CALLBACK(process_menu_action), BUMP_CUSTOM, menu, act, &single, &group, value );
}
return menu;
diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp
index 31bd01719..259d4c9af 100644
--- a/src/widgets/gradient-vector.cpp
+++ b/src/widgets/gradient-vector.cpp
@@ -552,6 +552,7 @@ static void verify_grad(SPGradient *gradient)
child->setAttribute("style", os.str().c_str());
gradient->getRepr()->addChild(child, NULL);
Inkscape::GC::release(child);
+ return;
}
if (i < 2) {
sp_repr_set_css_double(stop->getRepr(), "offset", 0.0);
diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp
index e2483343f..3b191b2f3 100644
--- a/src/widgets/paint-selector.cpp
+++ b/src/widgets/paint-selector.cpp
@@ -34,6 +34,7 @@
#include "sp-linear-gradient.h"
#include "sp-radial-gradient.h"
#include "sp-mesh.h"
+#include "sp-stop.h"
/* fixme: Move it from dialogs to here */
#include "gradient-selector.h"
#include <inkscape.h>
@@ -665,6 +666,18 @@ static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelec
{
using Inkscape::UI::Widget::ColorNotebook;
+ if ((psel->mode == SPPaintSelector::MODE_SWATCH)
+ || (psel->mode == SPPaintSelector::MODE_GRADIENT_LINEAR)
+ || (psel->mode == SPPaintSelector::MODE_GRADIENT_RADIAL) ) {
+ SPGradientSelector *gsel = getGradientFromData(psel);
+ if (gsel) {
+ SPGradient *gradient = gsel->getVector();
+ SPColor color = gradient->getFirstStop()->specified_color;
+ float alpha = gradient->getFirstStop()->opacity;
+ psel->selected_color->setColorAlpha(color, alpha);
+ }
+ }
+
sp_paint_selector_set_style_buttons(psel, psel->solid);
gtk_widget_set_sensitive(psel->style, TRUE);
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 000000000..0b9584631
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,478 @@
+# -----------------------------------------------------------------------------
+#
+# -----------------------------------------------------------------------------
+
+set(CMAKE_CTEST_COMMAND ctest -V)
+
+add_subdirectory(${GMOCK_DIR} ${CMAKE_BINARY_DIR}/gmock)
+
+include_directories(SYSTEM ${GMOCK_DIR}/gtest/include
+ ${GMOCK_DIR}/include)
+
+# copied from ../src/CMakeLists.txt
+# TODO resolve to shared definition
+set(sp_SRC
+ ../src/attribute-rel-css.cpp
+ ../src/attribute-rel-svg.cpp
+ ../src/attribute-rel-util.cpp
+ ../src/sp-anchor.cpp
+ ../src/sp-clippath.cpp
+ ../src/sp-conn-end-pair.cpp
+ ../src/sp-conn-end.cpp
+ ../src/sp-cursor.cpp
+ ../src/sp-defs.cpp
+ ../src/sp-desc.cpp
+ ../src/sp-ellipse.cpp
+ ../src/sp-factory.cpp
+ ../src/sp-filter-primitive.cpp
+ ../src/sp-filter-reference.cpp
+ ../src/sp-filter.cpp
+ ../src/sp-flowdiv.cpp
+ ../src/sp-flowregion.cpp
+ ../src/sp-flowtext.cpp
+ ../src/sp-font-face.cpp
+ ../src/sp-font.cpp
+ ../src/sp-glyph-kerning.cpp
+ ../src/sp-glyph.cpp
+ ../src/sp-gradient-reference.cpp
+ ../src/sp-gradient.cpp
+ ../src/sp-guide.cpp
+ ../src/sp-hatch-path.cpp
+ ../src/sp-hatch.cpp
+ ../src/sp-image.cpp
+ ../src/sp-item-group.cpp
+ ../src/sp-item-notify-moveto.cpp
+ ../src/sp-item-rm-unsatisfied-cns.cpp
+ ../src/sp-item-transform.cpp
+ ../src/sp-item-update-cns.cpp
+ ../src/sp-item.cpp
+ ../src/sp-line.cpp
+ ../src/sp-linear-gradient.cpp
+ ../src/sp-lpe-item.cpp
+ ../src/sp-marker.cpp
+ ../src/sp-mask.cpp
+ ../src/sp-mesh-array.cpp
+ ../src/sp-mesh-patch.cpp
+ ../src/sp-mesh-row.cpp
+ ../src/sp-mesh.cpp
+ ../src/sp-metadata.cpp
+ ../src/sp-missing-glyph.cpp
+ ../src/sp-namedview.cpp
+ ../src/sp-object-group.cpp
+ ../src/sp-object.cpp
+ ../src/sp-offset.cpp
+ ../src/sp-paint-server.cpp
+ ../src/sp-path.cpp
+ ../src/sp-pattern.cpp
+ ../src/sp-polygon.cpp
+ ../src/sp-polyline.cpp
+ ../src/sp-radial-gradient.cpp
+ ../src/sp-rect.cpp
+ ../src/sp-root.cpp
+ ../src/sp-script.cpp
+ ../src/sp-shape.cpp
+ ../src/sp-solid-color.cpp
+ ../src/sp-spiral.cpp
+ ../src/sp-star.cpp
+ ../src/sp-stop.cpp
+ ../src/sp-string.cpp
+ ../src/sp-style-elem.cpp
+ ../src/sp-switch.cpp
+ ../src/sp-symbol.cpp
+ ../src/sp-tag-use-reference.cpp
+ ../src/sp-tag-use.cpp
+ ../src/sp-tag.cpp
+ ../src/sp-text.cpp
+ ../src/sp-title.cpp
+ ../src/sp-tref-reference.cpp
+ ../src/sp-tref.cpp
+ ../src/sp-tspan.cpp
+ ../src/sp-use-reference.cpp
+ ../src/sp-use.cpp
+ ../src/splivarot.cpp
+ ../src/viewbox.cpp
+
+ # -------
+ # Headers
+ ../src/attribute-rel-css.h
+ ../src/attribute-rel-svg.h
+ ../src/attribute-rel-util.h
+ ../src/sp-anchor.h
+ ../src/sp-clippath.h
+ ../src/sp-conn-end-pair.h
+ ../src/sp-conn-end.h
+ ../src/sp-cursor.h
+ ../src/sp-defs.h
+ ../src/sp-desc.h
+ ../src/sp-ellipse.h
+ ../src/sp-factory.h
+ ../src/sp-filter-primitive.h
+ ../src/sp-filter-reference.h
+ ../src/sp-filter-units.h
+ ../src/sp-filter.h
+ ../src/sp-flowdiv.h
+ ../src/sp-flowregion.h
+ ../src/sp-flowtext.h
+ ../src/sp-font-face.h
+ ../src/sp-font.h
+ ../src/sp-glyph-kerning.h
+ ../src/sp-glyph.h
+ ../src/sp-gradient-reference.h
+ ../src/sp-gradient-spread.h
+ ../src/sp-gradient-test.h
+ ../src/sp-gradient-units.h
+ ../src/sp-gradient-vector.h
+ ../src/sp-gradient.h
+ ../src/sp-guide-attachment.h
+ ../src/sp-guide-constraint.h
+ ../src/sp-guide.h
+ ../src/sp-hatch-path.h
+ ../src/sp-hatch.h
+ ../src/sp-image.h
+ ../src/sp-item-group.h
+ ../src/sp-item-notify-moveto.h
+ ../src/sp-item-rm-unsatisfied-cns.h
+ ../src/sp-item-transform.h
+ ../src/sp-item-update-cns.h
+ ../src/sp-item.h
+ ../src/sp-line.h
+ ../src/sp-linear-gradient.h
+ ../src/sp-lpe-item.h
+ ../src/sp-marker-loc.h
+ ../src/sp-marker.h
+ ../src/sp-mask.h
+ ../src/sp-mesh-array.h
+ ../src/sp-mesh-patch.h
+ ../src/sp-mesh-row.h
+ ../src/sp-mesh.h
+ ../src/sp-metadata.h
+ ../src/sp-missing-glyph.h
+ ../src/sp-namedview.h
+ ../src/sp-object-group.h
+ ../src/sp-object.h
+ ../src/sp-offset.h
+ ../src/sp-paint-server-reference.h
+ ../src/sp-paint-server.h
+ ../src/sp-path.h
+ ../src/sp-pattern.h
+ ../src/sp-polygon.h
+ ../src/sp-polyline.h
+ ../src/sp-radial-gradient.h
+ ../src/sp-rect.h
+ ../src/sp-root.h
+ ../src/sp-script.h
+ ../src/sp-shape.h
+ ../src/sp-solid-color.h
+ ../src/sp-spiral.h
+ ../src/sp-star.h
+ ../src/sp-stop.h
+ ../src/sp-string.h
+ ../src/sp-style-elem-test.h
+ ../src/sp-style-elem.h
+ ../src/sp-switch.h
+ ../src/sp-symbol.h
+ ../src/sp-text.h
+ ../src/sp-textpath.h
+ ../src/sp-title.h
+ ../src/sp-tref-reference.h
+ ../src/sp-tref.h
+ ../src/sp-tspan.h
+ ../src/sp-use-reference.h
+ ../src/sp-use.h
+ ../src/viewbox.h
+)
+
+# copied from ../src/CMakeLists.txt
+# TODO resolve to shared definition
+set(inkscape_SRC
+ ../src/attributes.cpp
+ ../src/axis-manip.cpp
+ ../src/box3d-side.cpp
+ ../src/box3d.cpp
+ ../src/color-profile.cpp
+ ../src/color.cpp
+ ../src/composite-undo-stack-observer.cpp
+ ../src/conditions.cpp
+ ../src/conn-avoid-ref.cpp
+ ../src/console-output-undo-observer.cpp
+ ../src/context-fns.cpp
+ ../src/desktop-events.cpp
+ ../src/desktop-style.cpp
+ ../src/desktop.cpp
+ ../src/device-manager.cpp
+ ../src/dir-util.cpp
+ ../src/document-subset.cpp
+ ../src/document-undo.cpp
+ ../src/document.cpp
+ ../src/ege-color-prof-tracker.cpp
+ ../src/event-log.cpp
+ ../src/extract-uri.cpp
+ ../src/file.cpp
+ ../src/filter-chemistry.cpp
+ ../src/filter-enums.cpp
+ ../src/gc-anchored.cpp
+ ../src/gc-finalized.cpp
+ ../src/gradient-chemistry.cpp
+ ../src/gradient-drag.cpp
+ ../src/graphlayout.cpp
+ ../src/guide-snapper.cpp
+ ../src/help.cpp
+ ../src/id-clash.cpp
+ ../src/inkscape.cpp
+ ../src/knot-holder-entity.cpp
+ ../src/knot-ptr.cpp
+ ../src/knot.cpp
+ ../src/knotholder.cpp
+ ../src/layer-fns.cpp
+ ../src/layer-manager.cpp
+ ../src/layer-model.cpp
+ ../src/line-geometry.cpp
+ ../src/line-snapper.cpp
+ ../src/main-cmdlineact.cpp
+ ../src/media.cpp
+ ../src/message-context.cpp
+ ../src/message-stack.cpp
+ ../src/mod360.cpp
+ ../src/object-hierarchy.cpp
+ ../src/object-snapper.cpp
+ ../src/path-chemistry.cpp
+ ../src/persp3d-reference.cpp
+ ../src/persp3d.cpp
+ ../src/perspective-line.cpp
+ ../src/preferences.cpp
+ ../src/prefix.cpp
+ ../src/print.cpp
+ ../src/profile-manager.cpp
+ ../src/proj_pt.cpp
+ ../src/rdf.cpp
+ ../src/removeoverlap.cpp
+ ../src/resource-manager.cpp
+ ../src/rubberband.cpp
+ ../src/satisfied-guide-cns.cpp
+ ../src/selcue.cpp
+ ../src/selection-chemistry.cpp
+ ../src/selection-describer.cpp
+ ../src/selection.cpp
+ ../src/seltrans-handles.cpp
+ ../src/seltrans.cpp
+ ../src/shortcuts.cpp
+ ../src/snap-preferences.cpp
+ ../src/snap.cpp
+ ../src/snapped-curve.cpp
+ ../src/snapped-line.cpp
+ ../src/snapped-point.cpp
+ ../src/snapper.cpp
+ ../src/style-internal.cpp
+ ../src/style.cpp
+ ../src/svg-view-widget.cpp
+ ../src/svg-view.cpp
+ ../src/text-chemistry.cpp
+ ../src/text-editing.cpp
+ ../src/transf_mat_3x4.cpp
+ ../src/unclump.cpp
+ ../src/unicoderange.cpp
+ ../src/uri-references.cpp
+ ../src/uri.cpp
+ ../src/vanishing-point.cpp
+ ../src/verbs.cpp
+ ../src/version.cpp
+
+ # -------
+ # Headers
+ ../src/MultiPrinter.h
+ ../src/PylogFormatter.h
+ ../src/TRPIFormatter.h
+ ../src/attributes-test.h
+ ../src/attributes.h
+ ../src/axis-manip.h
+ ../src/bad-uri-exception.h
+ ../src/box3d-side.h
+ ../src/box3d.h
+ ../src/cms-color-types.h
+ ../src/cms-system.h
+ ../src/color-profile-cms-fns.h
+ ../src/color-profile-test.h
+ ../src/color-profile.h
+ ../src/color-rgba.h
+ ../src/color.h
+ ../src/colorspace.h
+ ../src/composite-undo-stack-observer.h
+ ../src/conditions.h
+ ../src/conn-avoid-ref.h
+ ../src/console-output-undo-observer.h
+ ../src/context-fns.h
+ ../src/decimal-round.h
+ ../src/desktop-events.h
+ ../src/desktop-style.h
+ ../src/desktop.h
+ ../src/device-manager.h
+ ../src/dir-util-test.h
+ ../src/dir-util.h
+ ../src/document-private.h
+ ../src/document-subset.h
+ ../src/document-undo.h
+ ../src/document.h
+ ../src/ege-color-prof-tracker.h
+ ../src/enums.h
+ ../src/event-log.h
+ ../src/event.h
+ ../src/extract-uri-test.h
+ ../src/extract-uri.h
+ ../src/file.h
+ ../src/fill-or-stroke.h
+ ../src/filter-chemistry.h
+ ../src/filter-enums.h
+ ../src/gc-anchored.h
+ ../src/gc-finalized.h
+ ../src/gradient-chemistry.h
+ ../src/gradient-drag.h
+ ../src/graphlayout.h
+ ../src/guide-snapper.h
+ ../src/help.h
+ ../src/helper-fns.h
+ ../src/icon-size.h
+ ../src/id-clash.h
+ ../src/inkscape-version.h
+ ../src/inkscape.h
+ ../src/isinf.h
+ ../src/knot-enums.h
+ ../src/knot-holder-entity.h
+ ../src/knot-ptr.h
+ ../src/knot.h
+ ../src/knotholder.h
+ ../src/layer-fns.h
+ ../src/layer-manager.h
+ ../src/layer-model.h
+ ../src/line-geometry.h
+ ../src/line-snapper.h
+ ../src/macros.h
+ ../src/main-cmdlineact.h
+ ../src/marker-test.h
+ ../src/media.h
+ ../src/menus-skeleton.h
+ ../src/message-context.h
+ ../src/message-stack.h
+ ../src/message.h
+ ../src/mod360-test.h
+ ../src/mod360.h
+ ../src/number-opt-number.h
+ ../src/object-hierarchy.h
+ ../src/object-snapper.h
+ ../src/object-test.h
+ ../src/path-chemistry.h
+ ../src/path-prefix.h
+ ../src/persp3d-reference.h
+ ../src/persp3d.h
+ ../src/perspective-line.h
+ ../src/preferences-skeleton.h
+ ../src/preferences-test.h
+ ../src/preferences.h
+ ../src/prefix.h
+ ../src/print.h
+ ../src/profile-manager.h
+ ../src/proj_pt.h
+ ../src/rdf.h
+ ../src/remove-last.h
+ ../src/removeoverlap.h
+ ../src/require-config.h
+ ../src/resource-manager.h
+ ../src/round-test.h
+ ../src/round.h
+ ../src/rubberband.h
+ ../src/satisfied-guide-cns.h
+ ../src/selcue.h
+ ../src/selection-chemistry.h
+ ../src/selection-describer.h
+ ../src/selection.h
+ ../src/seltrans-handles.h
+ ../src/seltrans.h
+ ../src/shortcuts.h
+ ../src/snap-candidate.h
+ ../src/snap-enums.h
+ ../src/snap-preferences.h
+ ../src/snap.h
+ ../src/snapped-curve.h
+ ../src/snapped-line.h
+ ../src/snapped-point.h
+ ../src/snapper.h
+ ../src/splivarot.h
+ ../src/streq.h
+ ../src/strneq.h
+ ../src/style-enums.h
+ ../src/style-internal.h
+ ../src/style-test.h
+ ../src/style.h
+ ../src/svg-profile.h
+ ../src/svg-view-widget.h
+ ../src/svg-view.h
+ ../src/syseq.h
+ ../src/test-helpers.h
+ ../src/text-chemistry.h
+ ../src/text-editing.h
+ ../src/text-tag-attributes.h
+ ../src/transf_mat_3x4.h
+ ../src/unclump.h
+ ../src/undo-stack-observer.h
+ ../src/unicoderange.h
+ ../src/uri-references.h
+ ../src/uri-test.h
+ ../src/uri.h
+ ../src/vanishing-point.h
+ ../src/verbs-test.h
+ ../src/verbs.h
+ ../src/version.h
+)
+
+get_property(inkscape_global_SRC GLOBAL PROPERTY inkscape_global_SRC)
+
+set_source_files_properties(
+ ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp
+ PROPERTIES GENERATED TRUE)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/__/src)
+
+add_executable(unittest
+ unittest.cpp
+ doc-per-case-test.cpp
+ src/attributes-test.cpp
+ src/color-profile-test.cpp
+ src/dir-util-test.cpp
+ ${inkscape_SRC}
+ ${sp_SRC}
+ ${inkscape_global_SRC}
+ ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp
+)
+
+add_dependencies(unittest inkscape_version)
+
+target_link_libraries(unittest
+ gmock_main
+
+ # order from automake
+ #sp_LIB
+ nrtype_LIB
+
+ #inkscape_LIB
+ #sp_LIB # annoying, we need both!
+ nrtype_LIB # annoying, we need both!
+
+ croco_LIB
+ avoid_LIB
+ gdl_LIB
+ cola_LIB
+ vpsc_LIB
+ livarot_LIB
+ uemf_LIB
+ 2geom_LIB
+ depixelize_LIB
+ util_LIB
+ gc_LIB
+
+ ${INKSCAPE_LIBS}
+)
+
+add_test(BaseTest ${EXECUTABLE_OUTPUT_PATH}/unittest)
+
+add_dependencies(check unittest)
+
+#
diff --git a/test/doc-per-case-test.cpp b/test/doc-per-case-test.cpp
new file mode 100644
index 000000000..da75b1e65
--- /dev/null
+++ b/test/doc-per-case-test.cpp
@@ -0,0 +1,52 @@
+/*
+ * Test fixture with SPDocument per entire test case.
+ *
+ * Author:
+ * Jon A. Cruz <jon@joncruz.org>
+ *
+ * Copyright (C) 2015 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "doc-per-case-test.h"
+
+#include "inkscape.h"
+
+SPDocument *DocPerCaseTest::_doc = 0;
+
+DocPerCaseTest::DocPerCaseTest() :
+ ::testing::Test()
+{
+}
+
+void DocPerCaseTest::SetUpTestCase()
+{
+ if ( !Inkscape::Application::exists() )
+ {
+ // Create the global inkscape object.
+ Inkscape::Application::create("", false);
+ }
+
+ _doc = SPDocument::createNewDoc( NULL, TRUE, true );
+ ASSERT_TRUE( _doc != NULL );
+}
+
+void DocPerCaseTest::TearDownTestCase()
+{
+ if (_doc) {
+ _doc->doUnref();
+ _doc = NULL;
+ }
+}
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/test/doc-per-case-test.h b/test/doc-per-case-test.h
new file mode 100644
index 000000000..b6f01403a
--- /dev/null
+++ b/test/doc-per-case-test.h
@@ -0,0 +1,43 @@
+/*
+ * Test fixture with SPDocument per entire test case.
+ *
+ * Author:
+ * Jon A. Cruz <jon@joncruz.org>
+ *
+ * Copyright (C) 2015 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "gtest/gtest.h"
+
+#include "document.h"
+
+
+/**
+ * Simple fixture that creates a single SPDocument to be shared between all tests
+ * in this test case.
+ */
+class DocPerCaseTest : public ::testing::Test
+{
+public:
+ DocPerCaseTest();
+
+protected:
+ static void SetUpTestCase();
+
+ static void TearDownTestCase();
+
+ static SPDocument *_doc;
+};
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/test/src/attributes-test.cpp b/test/src/attributes-test.cpp
new file mode 100644
index 000000000..ab1c3cec6
--- /dev/null
+++ b/test/src/attributes-test.cpp
@@ -0,0 +1,618 @@
+/*
+ * Unit tests for attributes.
+ *
+ * Author:
+ * Jon A. Cruz <jon@joncruz.org>
+ *
+ * Copyright (C) 2015 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include <string>
+#include <vector>
+
+#include "gtest/gtest.h"
+
+#include "attributes.h"
+
+namespace {
+
+static const unsigned int FIRST_VALID_ID = 1;
+
+class AttributeInfo
+{
+public:
+ AttributeInfo(std::string const &attr, bool supported) :
+ attr(attr),
+ supported(supported)
+ {
+ }
+
+ std::string attr;
+ bool supported;
+};
+
+typedef std::vector<AttributeInfo>::iterator AttrItr;
+
+std::vector<AttributeInfo> getKnownAttrs()
+{
+/* Extracted mechanically from http://www.w3.org/TR/SVG11/attindex.html:
+
+ tidy -wrap 999 -asxml < attindex.html 2>/dev/null |
+ tr -d \\n |
+ sed 's,<tr>,@,g' |
+ tr @ \\n |
+ sed 's,</td>.*,,;s,^<td>,,;1,/^%/d;/^%/d;s,^, {",;s/$/", false},/' |
+ uniq
+
+ attindex.html lacks attributeName, begin, additive, font, marker;
+ I've added these manually.
+
+ SVG 2: white-space, shape-inside, shape-outside, shape-padding, shape-margin
+*/
+ AttributeInfo all_attrs[] = {
+ AttributeInfo("attributeName", true),
+ AttributeInfo("begin", true),
+ AttributeInfo("additive", true),
+ AttributeInfo("font", true),
+ AttributeInfo("-inkscape-font-specification", true), // TODO look into this attribute's name
+ AttributeInfo("marker", true),
+ AttributeInfo("line-height", true),
+
+ AttributeInfo("accent-height", true),
+ AttributeInfo("accumulate", true),
+ AttributeInfo("alignment-baseline", true),
+ AttributeInfo("alphabetic", true),
+ AttributeInfo("amplitude", true),
+ AttributeInfo("animate", false),
+ AttributeInfo("arabic-form", true),
+ AttributeInfo("ascent", true),
+ AttributeInfo("attributeType", true),
+ AttributeInfo("azimuth", true),
+ AttributeInfo("baseFrequency", true),
+ AttributeInfo("baseline-shift", true),
+ AttributeInfo("baseProfile", false),
+ AttributeInfo("bbox", true),
+ AttributeInfo("bias", true),
+ AttributeInfo("block-progression", true),
+ AttributeInfo("by", true),
+ AttributeInfo("calcMode", true),
+ AttributeInfo("cap-height", true),
+ AttributeInfo("class", false),
+ AttributeInfo("clip", true),
+ AttributeInfo("clip-path", true),
+ AttributeInfo("clip-rule", true),
+ AttributeInfo("clipPathUnits", true),
+ AttributeInfo("color", true),
+ AttributeInfo("color-interpolation", true),
+ AttributeInfo("color-interpolation-filters", true),
+ AttributeInfo("color-profile", true),
+ AttributeInfo("color-rendering", true),
+ AttributeInfo("contentScriptType", false),
+ AttributeInfo("contentStyleType", false),
+ AttributeInfo("cursor", true),
+ AttributeInfo("cx", true),
+ AttributeInfo("cy", true),
+ AttributeInfo("d", true),
+ AttributeInfo("descent", true),
+ AttributeInfo("diffuseConstant", true),
+ AttributeInfo("direction", true),
+ AttributeInfo("display", true),
+ AttributeInfo("divisor", true),
+ AttributeInfo("dominant-baseline", true),
+ AttributeInfo("dur", true),
+ AttributeInfo("dx", true),
+ AttributeInfo("dy", true),
+ AttributeInfo("edgeMode", true),
+ AttributeInfo("elevation", true),
+ AttributeInfo("enable-background", true),
+ AttributeInfo("end", true),
+ AttributeInfo("exponent", true),
+ AttributeInfo("externalResourcesRequired", false),
+ AttributeInfo("feBlend", false),
+ AttributeInfo("feColorMatrix", false),
+ AttributeInfo("feComponentTransfer", false),
+ AttributeInfo("feComposite", false),
+ AttributeInfo("feConvolveMatrix", false),
+ AttributeInfo("feDiffuseLighting", false),
+ AttributeInfo("feDisplacementMap", false),
+ AttributeInfo("feFlood", false),
+ AttributeInfo("feGaussianBlur", false),
+ AttributeInfo("feImage", false),
+ AttributeInfo("feMerge", false),
+ AttributeInfo("feMorphology", false),
+ AttributeInfo("feOffset", false),
+ AttributeInfo("feSpecularLighting", false),
+ AttributeInfo("feTile", false),
+ AttributeInfo("fill", true),
+ AttributeInfo("fill-opacity", true),
+ AttributeInfo("fill-rule", true),
+ AttributeInfo("filter", true),
+ AttributeInfo("filterRes", true),
+ AttributeInfo("filterUnits", true),
+ AttributeInfo("flood-color", true),
+ AttributeInfo("flood-opacity", true),
+ AttributeInfo("font-family", true),
+ AttributeInfo("font-size", true),
+ AttributeInfo("font-size-adjust", true),
+ AttributeInfo("font-stretch", true),
+ AttributeInfo("font-style", true),
+ AttributeInfo("font-variant", true),
+ AttributeInfo("font-weight", true),
+ AttributeInfo("format", false),
+ AttributeInfo("from", true),
+ AttributeInfo("fx", true),
+ AttributeInfo("fy", true),
+ AttributeInfo("g1", true),
+ AttributeInfo("g2", true),
+ AttributeInfo("glyph-name", true),
+ AttributeInfo("glyph-orientation-horizontal", true),
+ AttributeInfo("glyph-orientation-vertical", true),
+ AttributeInfo("glyphRef", false),
+ AttributeInfo("gradientTransform", true),
+ AttributeInfo("gradientUnits", true),
+ AttributeInfo("hanging", true),
+ AttributeInfo("hatchContentUnits", true), // SVG 2.0
+ AttributeInfo("hatchTransform", true), // SVG 2.0 TODO renamed to transform
+ AttributeInfo("hatchUnits", true), // SVG 2.0
+ AttributeInfo("height", true),
+ AttributeInfo("horiz-adv-x", true),
+ AttributeInfo("horiz-origin-x", true),
+ AttributeInfo("horiz-origin-y", true),
+ AttributeInfo("ideographic", true),
+ AttributeInfo("image-rendering", true),
+ AttributeInfo("in", true),
+ AttributeInfo("in2", true),
+ AttributeInfo("intercept", true),
+ AttributeInfo("isolation", true),
+ AttributeInfo("k", true),
+ AttributeInfo("k1", true),
+ AttributeInfo("k2", true),
+ AttributeInfo("k3", true),
+ AttributeInfo("k4", true),
+ AttributeInfo("kernelMatrix", true),
+ AttributeInfo("kernelUnitLength", true),
+ AttributeInfo("kerning", true),
+ AttributeInfo("keyPoints", false),
+ AttributeInfo("keySplines", true),
+ AttributeInfo("keyTimes", true),
+ AttributeInfo("lang", true),
+ AttributeInfo("lengthAdjust", true),
+ AttributeInfo("letter-spacing", true),
+ AttributeInfo("lighting-color", true),
+ AttributeInfo("limitingConeAngle", true),
+ AttributeInfo("local", true),
+ AttributeInfo("marker-end", true),
+ AttributeInfo("marker-mid", true),
+ AttributeInfo("marker-start", true),
+ AttributeInfo("markerHeight", true),
+ AttributeInfo("markerUnits", true),
+ AttributeInfo("markerWidth", true),
+ AttributeInfo("mask", true),
+ AttributeInfo("maskContentUnits", true),
+ AttributeInfo("maskUnits", true),
+ AttributeInfo("mathematical", true),
+ AttributeInfo("max", true),
+ AttributeInfo("media", false),
+ AttributeInfo("method", false),
+ AttributeInfo("min", true),
+ AttributeInfo("mix-blend-mode", true),
+ AttributeInfo("mode", true),
+ AttributeInfo("name", true),
+ AttributeInfo("numOctaves", true),
+ AttributeInfo("offset", true),
+ AttributeInfo("onabort", false),
+ AttributeInfo("onactivate", false),
+ AttributeInfo("onbegin", false),
+ AttributeInfo("onclick", false),
+ AttributeInfo("onend", false),
+ AttributeInfo("onerror", false),
+ AttributeInfo("onfocusin", false),
+ AttributeInfo("onfocusout", false),
+ AttributeInfo("onload", true),
+ AttributeInfo("onmousedown", false),
+ AttributeInfo("onmousemove", false),
+ AttributeInfo("onmouseout", false),
+ AttributeInfo("onmouseover", false),
+ AttributeInfo("onmouseup", false),
+ AttributeInfo("onrepeat", false),
+ AttributeInfo("onresize", false),
+ AttributeInfo("onscroll", false),
+ AttributeInfo("onunload", false),
+ AttributeInfo("onzoom", false),
+ AttributeInfo("opacity", true),
+ AttributeInfo("operator", true),
+ AttributeInfo("order", true),
+ AttributeInfo("orient", true),
+ AttributeInfo("orientation", true),
+ AttributeInfo("origin", false),
+ AttributeInfo("overflow", true),
+ AttributeInfo("overline-position", true),
+ AttributeInfo("overline-thickness", true),
+ AttributeInfo("paint-order", true),
+ AttributeInfo("panose-1", true),
+ AttributeInfo("path", true),
+ AttributeInfo("pathLength", false),
+ AttributeInfo("patternContentUnits", true),
+ AttributeInfo("patternTransform", true),
+ AttributeInfo("patternUnits", true),
+ AttributeInfo("pitch", true), // SVG 2.-
+ AttributeInfo("pointer-events", true),
+ AttributeInfo("points", true),
+ AttributeInfo("pointsAtX", true),
+ AttributeInfo("pointsAtY", true),
+ AttributeInfo("pointsAtZ", true),
+ AttributeInfo("preserveAlpha", true),
+ AttributeInfo("preserveAspectRatio", true),
+ AttributeInfo("primitiveUnits", true),
+ AttributeInfo("r", true),
+ AttributeInfo("radius", true),
+ AttributeInfo("refX", true),
+ AttributeInfo("refY", true),
+ AttributeInfo("rendering-intent", true),
+ AttributeInfo("repeatCount", true),
+ AttributeInfo("repeatDur", true),
+ AttributeInfo("requiredFeatures", true),
+ AttributeInfo("requiredExtensions", true),
+ AttributeInfo("restart", true),
+ AttributeInfo("result", true),
+ AttributeInfo("rotate", true),
+ AttributeInfo("rx", true),
+ AttributeInfo("ry", true),
+ AttributeInfo("scale", true),
+ AttributeInfo("seed", true),
+ AttributeInfo("shape-inside", true),
+ AttributeInfo("shape-margin", true),
+ AttributeInfo("shape-outside", true),
+ AttributeInfo("shape-padding", true),
+ AttributeInfo("shape-rendering", true),
+ AttributeInfo("slope", true),
+ AttributeInfo("solid-color", true), // SVG 2.0
+ AttributeInfo("solid-opacity", true), // SVG 2.0
+ AttributeInfo("spacing", false),
+ AttributeInfo("specularConstant", true),
+ AttributeInfo("specularExponent", true),
+ AttributeInfo("spreadMethod", true),
+ AttributeInfo("startOffset", true),
+ AttributeInfo("stdDeviation", true),
+ AttributeInfo("stemh", true),
+ AttributeInfo("stemv", true),
+ AttributeInfo("stitchTiles", true),
+ AttributeInfo("stop-color", true),
+ AttributeInfo("stop-opacity", true),
+ AttributeInfo("strikethrough-position", true),
+ AttributeInfo("strikethrough-thickness", true),
+ AttributeInfo("stroke", true),
+ AttributeInfo("stroke-dasharray", true),
+ AttributeInfo("stroke-dashoffset", true),
+ AttributeInfo("stroke-linecap", true),
+ AttributeInfo("stroke-linejoin", true),
+ AttributeInfo("stroke-miterlimit", true),
+ AttributeInfo("stroke-opacity", true),
+ AttributeInfo("stroke-width", true),
+ AttributeInfo("style", true),
+ AttributeInfo("surfaceScale", true),
+ AttributeInfo("systemLanguage", true),
+ AttributeInfo("tableValues", true),
+ AttributeInfo("target", true),
+ AttributeInfo("targetX", true),
+ AttributeInfo("targetY", true),
+ AttributeInfo("text-align", true),
+ AttributeInfo("text-anchor", true),
+ AttributeInfo("text-decoration", true),
+ AttributeInfo("text-decoration-color", true),
+ AttributeInfo("text-decoration-line", true),
+ AttributeInfo("text-decoration-style", true),
+ AttributeInfo("text-indent", true),
+ AttributeInfo("text-rendering", true),
+ AttributeInfo("text-transform", true),
+ AttributeInfo("textLength", true),
+ AttributeInfo("title", false),
+ AttributeInfo("to", true),
+ AttributeInfo("transform", true),
+ AttributeInfo("type", true),
+ AttributeInfo("u1", true),
+ AttributeInfo("u2", true),
+ AttributeInfo("underline-position", true),
+ AttributeInfo("underline-thickness", true),
+ AttributeInfo("unicode", true),
+ AttributeInfo("unicode-bidi", true),
+ AttributeInfo("unicode-range", true),
+ AttributeInfo("units-per-em", true),
+ AttributeInfo("v-alphabetic", true),
+ AttributeInfo("v-hanging", true),
+ AttributeInfo("v-ideographic", true),
+ AttributeInfo("v-mathematical", true),
+ AttributeInfo("values", true),
+ AttributeInfo("version", true),
+ AttributeInfo("vert-adv-y", true),
+ AttributeInfo("vert-origin-x", true),
+ AttributeInfo("vert-origin-y", true),
+ AttributeInfo("viewBox", true),
+ AttributeInfo("viewTarget", false),
+ AttributeInfo("visibility", true),
+ AttributeInfo("white-space", true),
+ AttributeInfo("width", true),
+ AttributeInfo("widths", true),
+ AttributeInfo("word-spacing", true),
+ AttributeInfo("writing-mode", true),
+ AttributeInfo("x", true),
+ AttributeInfo("x-height", true),
+ AttributeInfo("x1", true),
+ AttributeInfo("x2", true),
+ AttributeInfo("xChannelSelector", true),
+ AttributeInfo("xlink:actuate", true),
+ AttributeInfo("xlink:arcrole", true),
+ AttributeInfo("xlink:href", true),
+ AttributeInfo("xlink:role", true),
+ AttributeInfo("xlink:show", true),
+ AttributeInfo("xlink:title", true),
+ AttributeInfo("xlink:type", true),
+ AttributeInfo("xml:base", false),
+ AttributeInfo("xml:space", true),
+ AttributeInfo("xmlns", false),
+ AttributeInfo("xmlns:xlink", false),
+ AttributeInfo("y", true),
+ AttributeInfo("y1", true),
+ AttributeInfo("y2", true),
+ AttributeInfo("yChannelSelector", true),
+ AttributeInfo("z", true),
+ AttributeInfo("zoomAndPan", false),
+
+ // Extra attributes.
+ AttributeInfo("id", true),
+ AttributeInfo("inkscape:bbox-nodes", true),
+ AttributeInfo("inkscape:bbox-paths", true),
+ AttributeInfo("inkscape:box3dsidetype", true),
+ AttributeInfo("inkscape:collect", true),
+ AttributeInfo("inkscape:connection-end", true),
+ AttributeInfo("inkscape:connection-end-point", true),
+ AttributeInfo("inkscape:connection-points", true),
+ AttributeInfo("inkscape:connection-start", true),
+ AttributeInfo("inkscape:connection-start-point", true),
+ AttributeInfo("inkscape:connector-avoid", true),
+ AttributeInfo("inkscape:connector-curvature", true),
+ AttributeInfo("inkscape:connector-spacing", true),
+ AttributeInfo("inkscape:connector-type", true),
+ AttributeInfo("inkscape:corner0", true),
+ AttributeInfo("inkscape:corner7", true),
+ AttributeInfo("inkscape:current-layer", true),
+ AttributeInfo("inkscape:cx", true),
+ AttributeInfo("inkscape:cy", true),
+ AttributeInfo("inkscape:document-units", true),
+ AttributeInfo("inkscape:dstBox", true),
+ AttributeInfo("inkscape:dstColumn", true),
+ AttributeInfo("inkscape:dstPath", true),
+ AttributeInfo("inkscape:dstShape", true),
+ AttributeInfo("inkscape:excludeShape", true),
+ AttributeInfo("inkscape:expanded", true),
+ AttributeInfo("inkscape:flatsided", true),
+ AttributeInfo("inkscape:groupmode", true),
+ AttributeInfo("inkscape:highlight-color", true),
+ AttributeInfo("inkscape:href", true),
+ AttributeInfo("inkscape:label", true),
+ AttributeInfo("inkscape:layoutOptions", true),
+ AttributeInfo("inkscape:object-nodes", true),
+ AttributeInfo("inkscape:object-paths", true),
+ AttributeInfo("inkscape:original", true),
+ AttributeInfo("inkscape:original-d", true),
+ AttributeInfo("inkscape:pageopacity", true),
+ AttributeInfo("inkscape:pageshadow", true),
+ AttributeInfo("inkscape:path-effect", true),
+ AttributeInfo("inkscape:persp3d", true),
+ AttributeInfo("inkscape:persp3d-origin", true),
+ AttributeInfo("inkscape:perspectiveID", true),
+ AttributeInfo("inkscape:radius", true),
+ AttributeInfo("inkscape:randomized", true),
+ AttributeInfo("inkscape:rounded", true),
+ AttributeInfo("inkscape:snap-bbox", true),
+ AttributeInfo("inkscape:snap-bbox-edge-midpoints", true),
+ AttributeInfo("inkscape:snap-bbox-midpoints", true),
+ AttributeInfo("inkscape:snap-center", true),
+ AttributeInfo("inkscape:snap-global", true),
+ AttributeInfo("inkscape:snap-grids", true),
+ AttributeInfo("inkscape:snap-intersection-paths", true),
+ AttributeInfo("inkscape:snap-midpoints", true),
+ AttributeInfo("inkscape:snap-nodes", true),
+ AttributeInfo("inkscape:snap-object-midpoints", true),
+ AttributeInfo("inkscape:snap-others", true),
+ AttributeInfo("inkscape:snap-page", true),
+ AttributeInfo("inkscape:snap-path-clip", true),
+ AttributeInfo("inkscape:snap-path-mask", true),
+ AttributeInfo("inkscape:snap-perpendicular", true),
+ AttributeInfo("inkscape:snap-smooth-nodes", true),
+ AttributeInfo("inkscape:snap-tangential", true),
+ AttributeInfo("inkscape:snap-text-baseline", true),
+ AttributeInfo("inkscape:snap-to-guides", true),
+ AttributeInfo("inkscape:srcNoMarkup", true),
+ AttributeInfo("inkscape:srcPango", true),
+ AttributeInfo("inkscape:transform-center-x", true),
+ AttributeInfo("inkscape:transform-center-y", true),
+ AttributeInfo("inkscape:version", true),
+ AttributeInfo("inkscape:vp_x", true),
+ AttributeInfo("inkscape:vp_y", true),
+ AttributeInfo("inkscape:vp_z", true),
+ AttributeInfo("inkscape:window-height", true),
+ AttributeInfo("inkscape:window-maximized", true),
+ AttributeInfo("inkscape:window-width", true),
+ AttributeInfo("inkscape:window-x", true),
+ AttributeInfo("inkscape:window-y", true),
+ AttributeInfo("inkscape:zoom", true),
+ AttributeInfo("osb:paint", true),
+ AttributeInfo("sodipodi:arg1", true),
+ AttributeInfo("sodipodi:arg2", true),
+ AttributeInfo("sodipodi:argument", true),
+ AttributeInfo("sodipodi:cx", true),
+ AttributeInfo("sodipodi:cy", true),
+ AttributeInfo("sodipodi:end", true),
+ AttributeInfo("sodipodi:expansion", true),
+ AttributeInfo("sodipodi:insensitive", true),
+ AttributeInfo("sodipodi:linespacing", true),
+ AttributeInfo("sodipodi:nonprintable", true),
+ AttributeInfo("sodipodi:open", true),
+ AttributeInfo("sodipodi:original", true),
+ AttributeInfo("sodipodi:r1", true),
+ AttributeInfo("sodipodi:r2", true),
+ AttributeInfo("sodipodi:radius", true),
+ AttributeInfo("sodipodi:revolution", true),
+ AttributeInfo("sodipodi:role", true),
+ AttributeInfo("sodipodi:rx", true),
+ AttributeInfo("sodipodi:ry", true),
+ AttributeInfo("sodipodi:sides", true),
+ AttributeInfo("sodipodi:start", true),
+ AttributeInfo("sodipodi:t0", true),
+ AttributeInfo("sodipodi:version", false),
+
+ // SPMeshPatch
+ AttributeInfo("tensor", true),
+
+ // SPNamedView
+ AttributeInfo("fit-margin-top", true),
+ AttributeInfo("fit-margin-left", true),
+ AttributeInfo("fit-margin-right", true),
+ AttributeInfo("fit-margin-bottom", true),
+ AttributeInfo("units", true),
+ AttributeInfo("viewonly", true),
+ AttributeInfo("showgrid", true),
+// AttributeInfo("gridtype", true),
+ AttributeInfo("showguides", true),
+ AttributeInfo("gridtolerance", true),
+ AttributeInfo("guidetolerance", true),
+ AttributeInfo("objecttolerance", true),
+/* AttributeInfo("gridoriginx", true),
+ AttributeInfo("gridoriginy", true),
+ AttributeInfo("gridspacingx", true),
+ AttributeInfo("gridspacingy", true),
+ AttributeInfo("gridanglex", true),
+ AttributeInfo("gridanglez", true),
+ AttributeInfo("gridcolor", true),
+ AttributeInfo("gridopacity", true),
+ AttributeInfo("gridempcolor", true),
+ AttributeInfo("gridempopacity", true),
+ AttributeInfo("gridempspacing", true), */
+ AttributeInfo("guidecolor", true),
+ AttributeInfo("guideopacity", true),
+ AttributeInfo("guidehicolor", true),
+ AttributeInfo("guidehiopacity", true),
+ AttributeInfo("showborder", true),
+ AttributeInfo("inkscape:showpageshadow", true),
+ AttributeInfo("borderlayer", true),
+ AttributeInfo("bordercolor", true),
+ AttributeInfo("borderopacity", true),
+ AttributeInfo("pagecolor", true),
+
+ // SPGuide
+ AttributeInfo("position", true)
+ };
+
+ size_t count = sizeof(all_attrs) / sizeof(all_attrs[0]);
+ std::vector<AttributeInfo> vect(all_attrs, all_attrs + count);
+ EXPECT_GT(vect.size(), size_t(100)); // should be more than
+ return vect;
+}
+
+/**
+ * Returns a vector with counts for all IDs up to the highest known value.
+ *
+ * The index is the ID, and the value is the number of times that ID is seen.
+ */
+std::vector<size_t> getIdIds()
+{
+ std::vector<size_t> ids;
+ std::vector<AttributeInfo> all_attrs = getKnownAttrs();
+ ids.reserve(all_attrs.size()); // minimize memory thrashing
+ for (AttrItr it(all_attrs.begin()); it != all_attrs.end(); ++it) {
+ unsigned int id = sp_attribute_lookup(it->attr.c_str());
+ if (id >= ids.size()) {
+ ids.resize(id + 1);
+ }
+ ids[id]++;
+ }
+
+ return ids;
+}
+
+// Ensure 'supported' value for each known attribute is correct.
+TEST(AttributesTest, SupportedKnown)
+{
+ std::vector<AttributeInfo> all_attrs = getKnownAttrs();
+ for (AttrItr it(all_attrs.begin()); it != all_attrs.end(); ++it) {
+ unsigned int id = sp_attribute_lookup(it->attr.c_str());
+ EXPECT_EQ(it->supported, id != 0u) << "Matching for attribute '" << it->attr << "'";
+ }
+}
+
+// Ensure names of known attributes are preserved when converted to id and back.
+TEST(AttributesTest, NameRoundTrip)
+{
+ std::vector<AttributeInfo> all_attrs = getKnownAttrs();
+ for (AttrItr it(all_attrs.begin()); it != all_attrs.end(); ++it) {
+ if (it->supported) {
+ unsigned int id = sp_attribute_lookup(it->attr.c_str());
+ char const *redoneName = reinterpret_cast<char const *>(sp_attribute_name(id));
+ EXPECT_TRUE(redoneName != NULL) << "For attribute '" << it->attr << "'";
+ if (redoneName) {
+ EXPECT_EQ(it->attr, redoneName);
+ }
+ }
+ }
+}
+
+/* Test for any attributes that this test program doesn't know about.
+ *
+ * If any are found, then:
+ *
+ * If it is in the `inkscape:' namespace then simply add it to all_attrs with
+ * `true' as the second field (`supported').
+ *
+ * If it is in the `sodipodi:' namespace then check the spelling against sodipodi
+ * sources. If you don't have sodipodi sources, then don't add it: leave to someone
+ * else.
+ *
+ * Otherwise, it's probably a bug: ~all SVG 1.1 attributes should already be
+ * in the all_attrs table. However, the comment above all_attrs does mention
+ * some things missing from attindex.html, so there may be more. Check the SVG
+ * spec. Another possibility is that the attribute is new in SVG 1.2. In this case,
+ * check the spelling against the [draft] SVG 1.2 spec before adding to all_attrs.
+ * (If you can't be bothered checking the spec, then don't update all_attrs.)
+ *
+ * If the attribute isn't in either SVG 1.1 or 1.2 then it's probably a mistake
+ * for it not to be in the inkscape namespace. (Not sure about attributes used only
+ * on elements in the inkscape namespace though.)
+ *
+ * In any case, make sure that the attribute's source is documented accordingly.
+ */
+TEST(AttributesTest, ValuesAreKnown)
+{
+ std::vector<size_t> ids = getIdIds();
+ for (size_t i = FIRST_VALID_ID; i < ids.size(); ++i) {
+ if (!ids[i]) {
+ unsigned char const *name = sp_attribute_name(i);
+ EXPECT_TRUE(ids[i] > 0) << "Attribute string with enum " << i << " {" << name << "} not handled";
+ }
+ }
+}
+
+// Ensure two different names aren't mapped to the same enum value.
+TEST(AttributesTest, ValuesUnique)
+{
+ std::vector<size_t> ids = getIdIds();
+ for (size_t i = FIRST_VALID_ID; i < ids.size(); ++i) {
+ EXPECT_LE(ids[i], size_t(1)) << "Attribute enum " << i << " used for multiple strings"
+ << " including {" << sp_attribute_name(i) << "}";
+ }
+}
+
+} // namespace
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/test/src/color-profile-test.cpp b/test/src/color-profile-test.cpp
new file mode 100644
index 000000000..365be687a
--- /dev/null
+++ b/test/src/color-profile-test.cpp
@@ -0,0 +1,126 @@
+/*
+ * Unit tests for color profile.
+ *
+ * Author:
+ * Jon A. Cruz <jon@joncruz.org>
+ *
+ * Copyright (C) 2015 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "gtest/gtest.h"
+
+#include "attributes.h"
+#include "cms-system.h"
+#include "color-profile.h"
+#include "doc-per-case-test.h"
+
+namespace {
+
+/**
+ * Test fixture to inherit a shared doc and create a color profile instance per test.
+ */
+class ProfTest : public DocPerCaseTest
+{
+public:
+ ProfTest() :
+ DocPerCaseTest(),
+ _prof(0)
+ {
+ }
+
+protected:
+ virtual void SetUp()
+ {
+ DocPerCaseTest::SetUp();
+ _prof = new Inkscape::ColorProfile();
+ ASSERT_TRUE( _prof != NULL );
+ _prof->document = _doc;
+ }
+
+ virtual void TearDown()
+ {
+ if (_prof) {
+ delete _prof;
+ _prof = NULL;
+ }
+ DocPerCaseTest::TearDown();
+ }
+
+ Inkscape::ColorProfile *_prof;
+};
+
+typedef ProfTest ColorProfileTest;
+
+TEST_F(ColorProfileTest, SetRenderingIntent)
+{
+ struct {
+ gchar const *attr;
+ guint intVal;
+ }
+ const cases[] = {
+ {"auto", (guint)Inkscape::RENDERING_INTENT_AUTO},
+ {"perceptual", (guint)Inkscape::RENDERING_INTENT_PERCEPTUAL},
+ {"relative-colorimetric", (guint)Inkscape::RENDERING_INTENT_RELATIVE_COLORIMETRIC},
+ {"saturation", (guint)Inkscape::RENDERING_INTENT_SATURATION},
+ {"absolute-colorimetric", (guint)Inkscape::RENDERING_INTENT_ABSOLUTE_COLORIMETRIC},
+ {"something-else", (guint)Inkscape::RENDERING_INTENT_UNKNOWN},
+ {"auto2", (guint)Inkscape::RENDERING_INTENT_UNKNOWN},
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS( cases ); i++ ) {
+ _prof->setKeyValue( SP_ATTR_RENDERING_INTENT, cases[i].attr);
+ ASSERT_EQ( (guint)cases[i].intVal, _prof->rendering_intent ) << cases[i].attr;
+ }
+}
+
+TEST_F(ColorProfileTest, SetLocal)
+{
+ gchar const* cases[] = {
+ "local",
+ "something",
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS( cases ); i++ ) {
+ _prof->setKeyValue( SP_ATTR_LOCAL, cases[i]);
+ ASSERT_TRUE( _prof->local != NULL );
+ if ( _prof->local ) {
+ ASSERT_EQ( std::string(cases[i]), _prof->local );
+ }
+ }
+ _prof->setKeyValue( SP_ATTR_LOCAL, NULL);
+ ASSERT_EQ( (gchar*)0, _prof->local );
+}
+
+TEST_F(ColorProfileTest, SetName)
+{
+ gchar const* cases[] = {
+ "name",
+ "something",
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS( cases ); i++ ) {
+ _prof->setKeyValue( SP_ATTR_NAME, cases[i]);
+ ASSERT_TRUE( _prof->name != NULL );
+ if ( _prof->name ) {
+ ASSERT_EQ( std::string(cases[i]), _prof->name );
+ }
+ }
+ _prof->setKeyValue( SP_ATTR_NAME, NULL );
+ ASSERT_EQ( (gchar*)0, _prof->name );
+}
+
+
+} // namespace
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/test/src/dir-util-test.cpp b/test/src/dir-util-test.cpp
new file mode 100644
index 000000000..32b3fce74
--- /dev/null
+++ b/test/src/dir-util-test.cpp
@@ -0,0 +1,63 @@
+/*
+ * Unit tests for dir utils.
+ *
+ * Author:
+ * Jon A. Cruz <jon@joncruz.org>
+ *
+ * Copyright (C) 2015 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "gtest/gtest.h"
+
+#include <glib.h>
+
+#include "dir-util.h"
+
+namespace {
+
+
+TEST(DirUtilTest, Base)
+{
+ char const* cases[][3] = {
+#if defined(WIN32) || defined(__WIN32__)
+ {"\\foo\\bar", "\\foo", "bar"},
+ {"\\foo\\barney", "\\foo\\bar", "\\foo\\barney"},
+ {"\\foo\\bar\\baz", "\\foo\\", "bar\\baz"},
+ {"\\foo\\bar\\baz", "\\", "foo\\bar\\baz"},
+ {"\\foo\\bar\\baz", "\\foo\\qux", "\\foo\\bar\\baz"},
+#else
+ {"/foo/bar", "/foo", "bar"},
+ {"/foo/barney", "/foo/bar", "/foo/barney"},
+ {"/foo/bar/baz", "/foo/", "bar/baz"},
+ {"/foo/bar/baz", "/", "foo/bar/baz"},
+ {"/foo/bar/baz", "/foo/qux", "/foo/bar/baz"},
+#endif
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
+ {
+ if ( cases[i][0] && cases[i][1] ) { // std::string can't use null.
+ std::string result = sp_relative_path_from_path( cases[i][0], cases[i][1] );
+ ASSERT_FALSE( result.empty() );
+ if ( !result.empty() )
+ {
+ ASSERT_EQ( std::string(cases[i][2]), result );
+ }
+ }
+ }
+}
+
+} // namespace
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/test/unittest.cpp b/test/unittest.cpp
new file mode 100644
index 000000000..0ec8f0383
--- /dev/null
+++ b/test/unittest.cpp
@@ -0,0 +1,58 @@
+/*
+ * Unit test main.
+ *
+ * Author:
+ * Jon A. Cruz <jon@joncruz.org>
+ *
+ * Copyright (C) 2015 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "gtest/gtest.h"
+
+#include <gtkmm.h>
+
+#include "inkgc/gc-core.h"
+#include "inkscape.h"
+
+namespace {
+
+// Ensure that a known positive test works
+TEST(PreTest, WorldIsSane)
+{
+ EXPECT_EQ(4, 2 + 2);
+}
+
+// Example of type casting to avoid compile warnings.
+
+
+} // namespace
+
+int main(int argc, char **argv) {
+
+ // setup general environment
+#if !GLIB_CHECK_VERSION(2,36,0)
+ g_type_init();
+#endif
+ int tmpArgc = 1;
+ char const *tmp[] = {"foo", ""};
+ char **tmpArgv = const_cast<char **>(tmp);
+ Gtk::Main(tmpArgc, tmpArgv);
+
+ Inkscape::GC::init();
+
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :